skill-creator 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README-zh.md +298 -0
- package/README.md +108 -112
- package/dist/cli.js +723 -320
- package/dist/cli.js.map +4 -4
- package/dist/daemon.js +637 -147
- package/dist/daemon.js.map +4 -4
- package/dist/package.json +1 -1
- package/dist/webui/_app/immutable/assets/0.BfQ9GZ7H.css +2 -0
- package/dist/webui/_app/immutable/chunks/{Ce_bE79q.js → 9b6xLvUw.js} +1 -1
- package/dist/webui/_app/immutable/chunks/{DUYTokm-.js → B0yogbIO.js} +1 -1
- package/dist/webui/_app/immutable/chunks/BDe0K-12.js +1 -0
- package/dist/webui/_app/immutable/chunks/{DFx4VmvA.js → BKjuWHgW.js} +4 -4
- package/dist/webui/_app/immutable/chunks/{BFnZD865.js → Bos6D7ir.js} +1 -1
- package/dist/webui/_app/immutable/chunks/{D68T6slS.js → CY3MARMs.js} +1 -1
- package/dist/webui/_app/immutable/chunks/D-ihBChi.js +1 -0
- package/dist/webui/_app/immutable/chunks/{Ce6RiTD3.js → D7i1h2eW.js} +2 -2
- package/dist/webui/_app/immutable/chunks/DFDHkP9N.js +1 -0
- package/dist/webui/_app/immutable/chunks/{CQhmWGDZ.js → DFdxGYRu.js} +1 -1
- package/dist/webui/_app/immutable/chunks/{CnsFCObb.js → Dbn_qXWm.js} +1 -1
- package/dist/webui/_app/immutable/chunks/{CLM6PwBO.js → K56ab8zF.js} +1 -1
- package/dist/webui/_app/immutable/chunks/{C36hgawG.js → NO3Cfsmo.js} +1 -1
- package/dist/webui/_app/immutable/chunks/{DkjKuLZP.js → QU8DIUJz.js} +1 -1
- package/dist/webui/_app/immutable/chunks/{CryWMAmp.js → UsOmL8ol.js} +1 -1
- package/dist/webui/_app/immutable/chunks/{BNZqT8Gb.js → hrRIAQd7.js} +1 -1
- package/dist/webui/_app/immutable/entry/{app.CEIXmsDN.js → app.CkIQoKd-.js} +2 -2
- package/dist/webui/_app/immutable/entry/start.DG-jtr9O.js +1 -0
- package/dist/webui/_app/immutable/nodes/0.DY8kli0K.js +234 -0
- package/dist/webui/_app/immutable/nodes/{1.sVOukQaO.js → 1.DxOotYUD.js} +1 -1
- package/dist/webui/_app/immutable/nodes/{2.Cpm2DXYr.js → 2.BhwY9m4H.js} +1 -1
- package/dist/webui/_app/version.json +1 -1
- package/dist/webui/index.html +15 -15
- package/package.json +26 -23
- package/dist/webui/_app/immutable/assets/0.0XN00VKF.css +0 -2
- package/dist/webui/_app/immutable/chunks/CLVPf5uP.js +0 -1
- package/dist/webui/_app/immutable/chunks/DbA0Nfjq.js +0 -1
- package/dist/webui/_app/immutable/chunks/DrGEPnFY.js +0 -1
- package/dist/webui/_app/immutable/entry/start.A-8tRY5f.js +0 -1
- package/dist/webui/_app/immutable/nodes/0.DtX11nez.js +0 -231
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/Ce6RiTD3.js","../chunks/CmCJ0SKP.js","../chunks/CLVPf5uP.js","../chunks/xihTtKlq.js","../chunks/DrGEPnFY.js","../chunks/BkEnd9_Z.js","../chunks/DbA0Nfjq.js","../chunks/DFx4VmvA.js","../chunks/CNPsST_i.js","../chunks/CryWMAmp.js","../chunks/DUYTokm-.js","../chunks/Dl8eQ129.js","../chunks/BEPs9Z9s.js","../chunks/Bs27XW8_.js","../chunks/BIfnT_mK.js","../chunks/D-V0xBeS.js","../chunks/Ce_bE79q.js","../chunks/BNZqT8Gb.js","../chunks/CLM6PwBO.js","../assets/shell.U4CQV8re.css","../chunks/Ckw1quWt.js","../chunks/CIFG41pU.js","../chunks/s48N5eaK.js","../chunks/D8Der6oM.js","../assets/ProviderView.DEH95hqa.css","../chunks/CQhmWGDZ.js","../chunks/UeEccMjN.js","../chunks/CeR4do8T.js","../chunks/C36hgawG.js","../chunks/0umLG1IN.js","../chunks/BYNWtKcf.js","../chunks/DkjKuLZP.js","../chunks/CQD9uzpA.js","../chunks/CnsFCObb.js","../chunks/D68T6slS.js","../chunks/BFnZD865.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{$ as e,A as t,At as n,B as r,Ct as i,D as a,Dt as o,E as s,F as c,G as l,H as u,J as d,K as f,M as p,Mt as m,N as h,Nt as g,O as _,Q as v,R as y,S as b,St as x,T as S,U as C,V as w,W as T,X as E,_ as D,_t as O,a as k,at as A,b as j,bt as ee,c as te,ct as M,d as N,f as P,ft as F,gt as I,h as L,ht as ne,it as re,j as ie,jt as R,k as ae,kt as oe,l as se,lt as z,m as B,mt as V,n as ce,nt as H,o as U,ot as W,p as le,q as G,r as ue,rt as de,s as K,st as q,ut as J,v as fe,w as pe,wt as me,x as Y,y as he,z as X}from"../chunks/CmCJ0SKP.js";import{t as ge}from"../chunks/CLVPf5uP.js";import{t as _e}from"../chunks/HclGiUj8.js";import"../chunks/xihTtKlq.js";import{t as ve}from"../chunks/CLM6PwBO.js";import"../chunks/DrGEPnFY.js";import{t as ye}from"../chunks/BkEnd9_Z.js";import{A as be,C as xe,D as Z,E as Se,F as Ce,I as we,M as Te,N as Ee,O as De,P as Oe,S as ke,T as Ae,_ as je,a as Me,b as Ne,c as Pe,d as Fe,f as Ie,g as Le,h as Re,i as ze,j as Be,k as Ve,l as He,m as Ue,n as We,o as Ge,p as Ke,r as Q,s as qe,t as Je,u as Ye,v as Xe,w as Ze,y as Qe}from"../chunks/DbA0Nfjq.js";import{c as $e,d as et,l as tt,n as nt,o as rt,s as it,t as at,u as ot}from"../chunks/BNZqT8Gb.js";import{A as st,C as ct,D as lt,E as ut,O as dt,S as ft,T as pt,a as mt,b as ht,c as gt,f as _t,g as vt,i as yt,k as bt,n as xt,o as St,p as Ct,r as wt,s as Tt,t as Et,v as Dt,w as Ot,x as kt}from"../chunks/DFx4VmvA.js";import{r as At}from"../chunks/CryWMAmp.js";import{i as jt,n as Mt,o as Nt,t as Pt}from"../chunks/DUYTokm-.js";import{A as Ft,B as It,C as Lt,D as Rt,E as zt,F as Bt,G as Vt,H as Ht,I as Ut,J as $,K as Wt,L as Gt,M as Kt,N as qt,O as Jt,P as Yt,R as Xt,S as Zt,T as Qt,U as $t,V as en,W as tn,Y as nn,_ as rn,a as an,b as on,c as sn,d as cn,f as ln,g as un,h as dn,i as fn,j as pn,k as mn,l as hn,m as gn,n as _n,o as vn,p as yn,q as bn,r as xn,s as Sn,t as Cn,u as wn,v as Tn,w as En,x as Dn,y as On,z as kn}from"../chunks/Dl8eQ129.js";import"../chunks/DZ_Kltd5.js";import{a as An,i as jn,n as Mn,o as Nn,r as Pn,s as Fn,t as In}from"../chunks/CNPsST_i.js";import{t as Ln}from"../chunks/BEPs9Z9s.js";import{n as Rn,r as zn,t as Bn}from"../chunks/Ckw1quWt.js";import{n as Vn,t as Hn}from"../chunks/0umLG1IN.js";import{t as Un}from"../chunks/CIFG41pU.js";import{t as Wn}from"../chunks/BIfnT_mK.js";import{t as Gn}from"../chunks/UeEccMjN.js";import{n as Kn,r as qn,t as Jn}from"../chunks/CQD9uzpA.js";var Yn=g({prerender:()=>!1,ssr:()=>!1,trailingSlash:()=>Xn}),Xn=`ignore`;it({id:`workspaces`,name:`Workspaces`,icon:we,activities:[$e({pattern:`/workspaces`,entry:!0,root:tt({id:`workspaces.home`,component:()=>_e(()=>import(`../chunks/Ce6RiTD3.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url)})}),$e({pattern:`/workspaces`,root:ot({id:`workspaces.provider`,pattern:`:wsId/:providerId`,params:ut({wsId:kt,providerId:ht}),search:ut({q:dt().optional(),skill:dt().optional(),view:ft([`list`,`detail`]).optional()}),component:()=>_e(()=>import(`../chunks/Ce_bE79q.js`),__vite__mapDeps([16,1,3,5,17,2,18,4,7,19,9,10,8,12,20,21,22,15,23,24]),import.meta.url)})}),$e({pattern:`/workspaces`,root:ot({id:`workspaces.intelligence`,pattern:`intelligence/:wsId/:providerId`,params:ut({wsId:kt,providerId:ht}),search:ut({severity:ft([`all`,`error`,`warning`,`info`]).optional()}),component:()=>_e(()=>import(`../chunks/CQhmWGDZ.js`),__vite__mapDeps([25,1,3,5,17,2,18,4,7,19,9,10,8,14,26,13,27,15,23]),import.meta.url)})})]});var Zn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qn(e,t){let n=U(t,Zn),r=[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`}],[`path`,{d:`M8 18h1`}]];ye(e,K({name:`file-pen-line`},()=>n,{get iconNode(){return r}}))}it({id:`creator`,name:`Creator`,icon:Qn,activities:[$e({pattern:`/creator`,entry:!0,root:tt({id:`creator.home`,component:()=>_e(()=>import(`../chunks/C36hgawG.js`),__vite__mapDeps([28,1,2,3,4,5,9,7,10,29,30]),import.meta.url)})}),$e({pattern:`/creator`,root:ot({id:`creator.workspace`,pattern:`:mode/:wsId/:providerId`,params:ut({mode:ft([`edit`,`new`]),wsId:kt,providerId:ht}),search:ut({subview:ft([`file`,`log`,`preview`,`validate`,`test`]).optional(),template:dt().optional()}),component:()=>_e(()=>import(`../chunks/DkjKuLZP.js`),__vite__mapDeps([31,1,2,3,18,4,5,17,7,19,9,10,11,8,12,13,20,32,30,22,27]),import.meta.url),children:[ot({id:`creator.workspace.skill`,pattern:`:skillId`,params:ut({skillId:Dt}),component:()=>_e(()=>import(`../chunks/DkjKuLZP.js`),__vite__mapDeps([31,1,2,3,18,4,5,17,7,19,9,10,11,8,12,13,20,32,30,22,27]),import.meta.url)})]})})]});var $n=new Set([`$$slots`,`$$events`,`$$legacy`]);function er(e,t){let n=U(t,$n),r=[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`}],[`circle`,{cx:`6`,cy:`18`,r:`3`}]];ye(e,K({name:`git-branch`},()=>n,{get iconNode(){return r}}))}it({id:`repository`,name:`Repository`,icon:er,activities:[$e({pattern:`/repository`,entry:!0,root:ot({id:`repository.home`,pattern:``,search:ut({q:dt().optional()}),component:()=>_e(()=>import(`../chunks/CnsFCObb.js`),__vite__mapDeps([33,1,2,3,4,5,17,18,7,19,11,8,12,13,34]),import.meta.url),children:[ot({id:`repository.scan`,pattern:`scan/:sourceId`,params:ut({sourceId:dt().min(1).max(128).regex(/^[a-z0-9_-]+$/i)}),search:ut({selected:dt().optional(),targets:dt().optional(),skill:dt().optional()}),component:()=>_e(()=>import(`../chunks/BFnZD865.js`),__vite__mapDeps([35,1,2,3,18,4,17,7,19,10,34]),import.meta.url)})]})})]});var tr=r(`<div class="drag-strip no-drag shrink-0 svelte-11tvdi8" role="banner" aria-label="window titlebar"><!> <div class="flex-1"></div> <!></div>`);function nr(e,t){i(t,!0);let r=k(t,`variant`,3,`main`),a=k(t,`left`,3,null),o=k(t,`right`,3,null),s=V(8),c=V(8),u=()=>navigator.opentrayWindow??navigator.opentray?.window??void 0;function d(e){let t=u();try{t?.startAppRegionDrag?.({x:e.clientX,y:e.clientY,pointerId:e.pointerId})?.catch?.(()=>{})}catch{}}function f(e){let t=globalThis.innerWidth,n=Math.max(0,Math.round(e.x)),r=Math.max(0,Math.round(t-e.x-e.width));F(s,n+(n>0?4:0)),F(c,r+(r>0?4:0))}ue(()=>{let e=u()?.overlay;if(!e)return;let t=null;return(async()=>{try{if(f(await e.getTitlebarAreaRect()),e.listen)t=await e.listen(`geometrychange`,e=>f(e.titlebarAreaRect));else if(e.addEventListener){let n=e=>f(e.titlebarAreaRect);e.addEventListener(`geometrychange`,n),t=()=>e.removeEventListener?.(`geometrychange`,n)}}catch{}})(),()=>{t?.()}});var p=tr(),m=W(p),g=e=>{var t=X(),n=q(t);_(n,a),y(e,t)};h(m,e=>{r()===`main`&&a()&&e(g)});var v=z(m,4),b=e=>{var t=X(),n=q(t);_(n,o),y(e,t)};h(v,e=>{r()===`main`&&o()&&e(b)}),n(p),H(()=>j(p,`padding-left: ${E(s)??``}px; padding-right: ${E(c)??``}px`)),l(`pointerdown`,p,d),y(e,p),x()}T([`pointerdown`]);var rr={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`,transform:`translateX(-100%)`};Vt(rr);function ir(t){de(()=>e(()=>t()))}var ar=[`top`,`right`,`bottom`,`left`],or=Math.min,sr=Math.max,cr=Math.round,lr=Math.floor,ur=e=>({x:e,y:e}),dr={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function fr(e,t,n){return sr(e,or(t,n))}function pr(e,t){return typeof e==`function`?e(t):e}function mr(e){return e.split(`-`)[0]}function hr(e){return e.split(`-`)[1]}function gr(e){return e===`x`?`y`:`x`}function _r(e){return e===`y`?`height`:`width`}function vr(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function yr(e){return gr(vr(e))}function br(e,t,n){n===void 0&&(n=!1);let r=hr(e),i=yr(e),a=_r(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=kr(o)),[o,kr(o)]}function xr(e){let t=kr(e);return[Sr(e),t,Sr(t)]}function Sr(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Cr=[`left`,`right`],wr=[`right`,`left`],Tr=[`top`,`bottom`],Er=[`bottom`,`top`];function Dr(e,t,n){switch(e){case`top`:case`bottom`:return n?t?wr:Cr:t?Cr:wr;case`left`:case`right`:return t?Tr:Er;default:return[]}}function Or(e,t,n,r){let i=hr(e),a=Dr(mr(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Sr)))),a}function kr(e){let t=mr(e);return dr[t]+e.slice(t.length)}function Ar(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function jr(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ar(e)}function Mr(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Nr(e,t,n){let{reference:r,floating:i}=e,a=vr(t),o=yr(t),s=_r(o),c=mr(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=hr(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Pr(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=pr(t,e),p=jr(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Mr(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Mr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Fr=50,Ir=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Pr},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Nr(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Fr&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Nr(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Lr=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=pr(e,t)||{};if(l==null)return{};let d=jr(u),f={x:n,y:r},p=yr(i),m=_r(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=or(d[_],T),D=or(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=fr(E,k,O),j=!c.arrow&&hr(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ee=j?k<E?k-E:k-O:0;return{[p]:f[p]+ee,data:{[p]:A,centerOffset:k-A-ee,...j&&{alignmentOffset:ee}},reset:j}}}),Rr=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=pr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=mr(r),_=vr(o),v=mr(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[kr(o)]:xr(o)),x=p!==`none`;!d&&x&&b.push(...Or(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=br(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===vr(t)||T.every(e=>vr(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=vr(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function zr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Br(e){return ar.some(t=>e[t]>=0)}var Vr=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=pr(e,t);switch(i){case`referenceHidden`:{let e=zr(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Br(e)}}}case`escaped`:{let e=zr(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Br(e)}}}default:return{}}}}},Hr=new Set([`left`,`top`]);async function Ur(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=mr(n),s=hr(n),c=vr(n)===`y`,l=Hr.has(o)?-1:1,u=a&&c?-1:1,d=pr(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Wr=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Ur(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Gr=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=pr(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=vr(i),p=gr(f),m=u[p],h=u[f],g=(e,t)=>fr(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Kr=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=pr(e,t),u={x:n,y:r},d=vr(i),f=gr(d),p=u[f],m=u[d],h=pr(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Hr.has(mr(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},qr=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=pr(e,t),c=await i.detectOverflow(t,s),l=mr(n),u=hr(n),d=vr(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=or(p-c[m],g),y=or(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*sr(c.left,c.right):S=p-2*sr(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Jr(){return typeof window<`u`}function Yr(e){return Qr(e)?(e.nodeName||``).toLowerCase():`#document`}function Xr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zr(e){return((Qr(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Qr(e){return Jr()?e instanceof Node||e instanceof Xr(e).Node:!1}function $r(e){return Jr()?e instanceof Element||e instanceof Xr(e).Element:!1}function ei(e){return Jr()?e instanceof HTMLElement||e instanceof Xr(e).HTMLElement:!1}function ti(e){return!Jr()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Xr(e).ShadowRoot}function ni(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=pi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ri(e){return/^(table|td|th)$/.test(Yr(e))}function ii(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ai=/transform|translate|scale|rotate|perspective|filter/,oi=/paint|layout|strict|content/,si=e=>!!e&&e!==`none`,ci;function li(e){let t=$r(e)?pi(e):e;return si(t.transform)||si(t.translate)||si(t.scale)||si(t.rotate)||si(t.perspective)||!di()&&(si(t.backdropFilter)||si(t.filter))||ai.test(t.willChange||``)||oi.test(t.contain||``)}function ui(e){let t=hi(e);for(;ei(t)&&!fi(t);){if(li(t))return t;if(ii(t))return null;t=hi(t)}return null}function di(){return ci??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ci}function fi(e){return/^(html|body|#document)$/.test(Yr(e))}function pi(e){return Xr(e).getComputedStyle(e)}function mi(e){return $r(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hi(e){if(Yr(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ti(e)&&e.host||Zr(e);return ti(t)?t.host:t}function gi(e){let t=hi(e);return fi(t)?(e.ownerDocument||e).body:ei(t)&&ni(t)?t:gi(t)}function _i(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=gi(e),i=r===e.ownerDocument?.body,a=Xr(r);if(i){let e=vi(a);return t.concat(a,a.visualViewport||[],ni(r)?r:[],e&&n?_i(e):[])}return t.concat(r,_i(r,[],n))}function vi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yi(e){let t=pi(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ei(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=cr(n)!==a||cr(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function bi(e){return $r(e)?e:e.contextElement}function xi(e){let t=bi(e);if(!ei(t))return ur(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=yi(t),o=(a?cr(n.width):n.width)/r,s=(a?cr(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Si=ur(0);function Ci(e){let t=Xr(e);return!di()||!t.visualViewport?Si:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wi(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Xr(e)}function Ti(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=bi(e),o=ur(1);t&&(r?$r(r)&&(o=xi(r)):o=xi(e));let s=wi(a,n,r)?Ci(a):ur(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Xr(a),t=$r(r)?Xr(r):r,n=e,i=vi(n);for(;i&&t!==n;){let e=xi(i),t=i.getBoundingClientRect(),r=pi(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Xr(i),i=vi(n)}}return Mr({width:u,height:d,x:c,y:l})}function Ei(e,t){let n=mi(e).scrollLeft;return t?t.left+n:Ti(Zr(e)).left+n}function Di(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ei(e,n),y:n.top+t.scrollTop}}function Oi(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Zr(r),s=t?ii(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ur(1),u=ur(0),d=ei(r);if((d||!a)&&((Yr(r)!==`body`||ni(o))&&(c=mi(r)),d)){let e=Ti(r);l=xi(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Di(o,c):ur(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ki(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ai(e){let t=mi(e),n=e.ownerDocument.body,r=sr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=sr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Ei(e),o=-t.scrollTop;return pi(n).direction===`rtl`&&(a+=sr(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ji=25;function Mi(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Xr(e),a=Zr(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!di()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Ei(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ji&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ni(e,t){let n=Ti(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=xi(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Pi(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Mi(e,n,t);else if(t===`document`)r=Ai(Zr(e));else if($r(t))r=Ni(t,n);else{let n=Ci(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Mr(r)}function Fi(e,t){let n=t.get(e);if(n)return n;let r=_i(e,[],!1).filter(e=>$r(e)&&Yr(e)!==`body`),i=null,a=pi(e).position===`fixed`,o=a?hi(e):e;for(;$r(o)&&!fi(o);){let e=pi(o),t=li(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=hi(o)}return t.set(e,r),r}function Ii(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ii(t)?[]:Fi(t,this._c):[].concat(n),r],o=Pi(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Pi(t,a[e],i);s=sr(n.top,s),c=or(n.right,c),l=or(n.bottom,l),u=sr(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Li(e){let{width:t,height:n}=yi(e);return{width:t,height:n}}function Ri(e,t,n){let r=ei(t),i=Zr(t),a=n===`fixed`,o=Ti(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ur(0);if((r||!a)&&((Yr(t)!==`body`||ni(i))&&(s=mi(t)),r)){let e=Ti(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Ei(i));let l=i&&!r&&!a?Di(i,s):ur(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function zi(e){return pi(e).position===`static`}function Bi(e,t){if(!ei(e)||pi(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Zr(e)===n&&(n=n.ownerDocument.body),n}function Vi(e,t){let n=Xr(e);if(ii(e))return n;if(!ei(e)){let t=hi(e);for(;t&&!fi(t);){if($r(t)&&!zi(t))return t;t=hi(t)}return n}let r=Bi(e,t);for(;r&&ri(r)&&zi(r);)r=Bi(r,t);return r&&fi(r)&&zi(r)&&!li(r)?n:r||ui(e)||n}var Hi=async function(e){let t=this.getOffsetParent||Vi,n=this.getDimensions,r=await n(e.floating);return{reference:Ri(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ui(e){return pi(e).direction===`rtl`}var Wi={convertOffsetParentRelativeRectToViewportRelativeRect:Oi,getDocumentElement:Zr,getClippingRect:Ii,getOffsetParent:Vi,getElementRects:Hi,getClientRects:ki,getDimensions:Li,getScale:xi,isElement:$r,isRTL:Ui};function Gi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ki(e,t,n){let r=null,i,a=Zr(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=lr(d),h=lr(a.clientWidth-(u+f)),g=lr(a.clientHeight-(d+p)),_=lr(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:sr(0,or(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Gi(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Xr(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function qi(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=bi(e),u=i||a?[...l?_i(l):[],...t?_i(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ki(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ti(e):null;c&&g();function g(){let t=Ti(e);h&&!Gi(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ji=Wr,Yi=Gr,Xi=Rr,Zi=qr,Qi=Vr,$i=Lr,ea=Kr,ta=(e,t,n)=>{let r=new Map,i=n??{},a={...Wi,...i.platform,_c:r};return Ir(e,t,{...i,platform:a})};function na(e){return typeof e==`function`?e():e}function ra(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ia(e,t){let n=ra(e);return Math.round(t*n)/n}function aa(e){return{[`--bits-${e}-content-transform-origin`]:`var(--bits-floating-transform-origin)`,[`--bits-${e}-content-available-width`]:`var(--bits-floating-available-width)`,[`--bits-${e}-content-available-height`]:`var(--bits-floating-available-height)`,[`--bits-${e}-anchor-width`]:`var(--bits-floating-anchor-width)`,[`--bits-${e}-anchor-height`]:`var(--bits-floating-anchor-height)`}}function oa(e){let t=e.whileElementsMounted,n=I(()=>na(e.open)??!0),r=I(()=>na(e.middleware)),i=I(()=>na(e.transform)??!0),a=I(()=>na(e.placement)??`bottom`),o=I(()=>na(e.strategy)??`absolute`),s=I(()=>na(e.sideOffset)??0),c=I(()=>na(e.alignOffset)??0),l=e.reference,u=V(0),d=V(0),f=nn(null),p=V(J(E(o))),m=V(J(E(a))),h=V(J({})),g=V(!1),_=!1,v=0,y=I(()=>{let e=f.current?ia(f.current,E(u)):E(u),t=f.current?ia(f.current,E(d)):E(d);return E(i)?{position:E(p),left:`0`,top:`0`,transform:`translate(${e}px, ${t}px)`,...f.current&&ra(f.current)>=1.5&&{willChange:`transform`}}:{position:E(p),left:`${e}px`,top:`${t}px`}}),b;function x(){if(l.current===null||f.current===null)return;let e=l.current,t=f.current,i=++v;ta(e,t,{middleware:E(r),placement:E(a),strategy:E(o)}).then(r=>{if(i===v&&l.current===e&&f.current===t){if(sa(e)){F(h,{...E(h),hide:{...E(h).hide,referenceHidden:!0}},!0);return}if(!E(n)&&E(u)!==0&&E(d)!==0){let e=Math.max(Math.abs(E(s)),Math.abs(E(c)),15);if(r.x<=e&&r.y<=e)return}F(u,r.x,!0),F(d,r.y,!0),F(p,r.strategy,!0),F(m,r.placement,!0),F(h,r.middlewareData,!0),F(g,!0)}})}function S(){typeof b==`function`&&(b(),b=void 0),v++}function C(){if(S(),t===void 0){x();return}E(n)&&l.current!==null&&f.current!==null&&(b=t(l.current,f.current,x))}function w(){!E(n)&&f.current===null&&F(g,!1)}function T(){return[E(r),E(a),E(o),E(s),E(c),E(n)]}return de(()=>{t===void 0&&E(n)&&x()}),de(C),de(()=>{if(t!==void 0){if(T(),!E(n)){_=!1;return}if(!E(g)){_=!1;return}if(!_){_=!0;return}x()}}),de(w),de(()=>S),{floating:f,reference:l,get strategy(){return E(p)},get placement(){return E(m)},get middlewareData(){return E(h)},get isPositioned(){return E(g)},get floatingStyles(){return E(y)},get update(){return x}}}function sa(e){return e instanceof Element?!e.isConnected||e instanceof HTMLElement&&e.hidden?!0:e.getClientRects().length===0:!1}var ca={top:`bottom`,right:`left`,bottom:`top`,left:`right`},la=new $t(`Floating.Root`),ua=new $t(`Floating.Content`),da=new $t(`Floating.Root`),fa=class e{static create(t=!1){return t?da.set(new e):la.set(new e)}anchorNode=nn(null);customAnchorNode=nn(null);triggerNode=nn(null);constructor(){de(()=>{this.customAnchorNode.current?typeof this.customAnchorNode.current==`string`?this.anchorNode.current=document.querySelector(this.customAnchorNode.current):this.anchorNode.current=this.customAnchorNode.current:this.anchorNode.current=this.triggerNode.current})}},pa=class e{static create(t,n=!1){return n?ua.set(new e(t,da.get())):ua.set(new e(t,la.get()))}opts;root;contentRef=nn(null);wrapperRef=nn(null);arrowRef=nn(null);contentAttachment=Ut(this.contentRef);wrapperAttachment=Ut(this.wrapperRef);arrowAttachment=Ut(this.arrowRef);arrowId=nn(hn());#e=I(()=>{if(typeof this.opts.style==`string`)return Wt(this.opts.style);if(!this.opts.style)return{}});#t=void 0;#n=new en(()=>this.arrowRef.current??void 0);#r=I(()=>this.#n?.width??0);#i=I(()=>this.#n?.height??0);#a=I(()=>this.opts.side?.current+(this.opts.align.current===`center`?``:`-${this.opts.align.current}`));#o=I(()=>Array.isArray(this.opts.collisionBoundary.current)?this.opts.collisionBoundary.current:[this.opts.collisionBoundary.current]);#s=I(()=>E(this.#o).length>0);get hasExplicitBoundaries(){return E(this.#s)}set hasExplicitBoundaries(e){F(this.#s,e)}#c=I(()=>({padding:this.opts.collisionPadding.current,boundary:E(this.#o).filter(zt),altBoundary:this.hasExplicitBoundaries}));get detectOverflowOptions(){return E(this.#c)}set detectOverflowOptions(e){F(this.#c,e)}#l=V(void 0);#u=V(void 0);#d=V(void 0);#f=V(void 0);#p=I(()=>[Ji({mainAxis:this.opts.sideOffset.current+E(this.#i),alignmentAxis:this.opts.alignOffset.current}),this.opts.avoidCollisions.current&&Yi({mainAxis:!0,crossAxis:!1,limiter:this.opts.sticky.current===`partial`?ea():void 0,...this.detectOverflowOptions}),this.opts.avoidCollisions.current&&Xi({...this.detectOverflowOptions}),Zi({...this.detectOverflowOptions,apply:({rects:e,availableWidth:t,availableHeight:n})=>{let{width:r,height:i}=e.reference;F(this.#l,t,!0),F(this.#u,n,!0),F(this.#d,r,!0),F(this.#f,i,!0)}}),this.arrowRef.current&&$i({element:this.arrowRef.current,padding:this.opts.arrowPadding.current}),ha({arrowWidth:E(this.#r),arrowHeight:E(this.#i)}),this.opts.hideWhenDetached.current&&Qi({strategy:`referenceHidden`,...this.detectOverflowOptions})].filter(Boolean));get middleware(){return E(this.#p)}set middleware(e){F(this.#p,e)}floating;#m=I(()=>_a(this.floating.placement));get placedSide(){return E(this.#m)}set placedSide(e){F(this.#m,e)}#h=I(()=>va(this.floating.placement));get placedAlign(){return E(this.#h)}set placedAlign(e){F(this.#h,e)}#g=I(()=>this.floating.middlewareData.arrow?.x??0);get arrowX(){return E(this.#g)}set arrowX(e){F(this.#g,e)}#_=I(()=>this.floating.middlewareData.arrow?.y??0);get arrowY(){return E(this.#_)}set arrowY(e){F(this.#_,e)}#v=I(()=>this.floating.middlewareData.arrow?.centerOffset!==0);get cannotCenterArrow(){return E(this.#v)}set cannotCenterArrow(e){F(this.#v,e)}#y=V();get contentZIndex(){return E(this.#y)}set contentZIndex(e){F(this.#y,e,!0)}#b=I(()=>ca[this.placedSide]);get arrowBaseSide(){return E(this.#b)}set arrowBaseSide(e){F(this.#b,e)}#x=I(()=>({id:this.opts.wrapperId.current,"data-bits-floating-content-wrapper":``,style:{...this.floating.floatingStyles,transform:this.floating.isPositioned?this.floating.floatingStyles.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:this.contentZIndex,"--bits-floating-transform-origin":`${this.floating.middlewareData.transformOrigin?.x} ${this.floating.middlewareData.transformOrigin?.y}`,"--bits-floating-available-width":`${E(this.#l)}px`,"--bits-floating-available-height":`${E(this.#u)}px`,"--bits-floating-anchor-width":`${E(this.#d)}px`,"--bits-floating-anchor-height":`${E(this.#f)}px`,...this.floating.middlewareData.hide?.referenceHidden&&{visibility:`hidden`,"pointer-events":`none`},...E(this.#e)},dir:this.opts.dir.current,...this.wrapperAttachment}));get wrapperProps(){return E(this.#x)}set wrapperProps(e){F(this.#x,e)}#S=I(()=>({"data-side":this.placedSide,"data-align":this.placedAlign,style:Vt({...E(this.#e)}),...this.contentAttachment}));get props(){return E(this.#S)}set props(e){F(this.#S,e)}#C=I(()=>({position:`absolute`,left:this.arrowX?`${this.arrowX}px`:void 0,top:this.arrowY?`${this.arrowY}px`:void 0,[this.arrowBaseSide]:0,"transform-origin":{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[this.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[this.placedSide],visibility:this.cannotCenterArrow?`hidden`:void 0}));get arrowStyle(){return E(this.#C)}set arrowStyle(e){F(this.#C,e)}constructor(e,t){this.opts=e,this.root=t,this.#t=e.updatePositionStrategy,e.customAnchor&&(this.root.customAnchorNode.current=e.customAnchor.current),Ht(()=>e.customAnchor.current,e=>{this.root.customAnchorNode.current=e}),this.floating=oa({strategy:()=>this.opts.strategy.current,placement:()=>E(this.#a),middleware:()=>this.middleware,reference:this.root.anchorNode,whileElementsMounted:(...e)=>qi(...e,{animationFrame:this.#t?.current===`always`}),open:()=>this.opts.enabled.current,sideOffset:()=>this.opts.sideOffset.current,alignOffset:()=>this.opts.alignOffset.current}),de(()=>{this.floating.isPositioned&&this.opts.onPlaced?.current()}),Ht(()=>this.contentRef.current,e=>{if(!e||!this.opts.enabled.current)return;let t=Gt(e),n=t.requestAnimationFrame(()=>{if(this.contentRef.current!==e||!this.opts.enabled.current)return;let n=t.getComputedStyle(e).zIndex;n!==this.contentZIndex&&(this.contentZIndex=n)});return()=>{t.cancelAnimationFrame(n)}}),de(()=>{this.floating.floating.current=this.wrapperRef.current})}},ma=class e{static create(t,n=!1){return n?new e(t,da.get()):new e(t,la.get())}opts;root;constructor(e,t){this.opts=e,this.root=t,t.triggerNode=e.virtualEl&&e.virtualEl.current?bn(e.virtualEl.current):e.ref}};function ha(e){return{name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=ga(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}}function ga(e){let[t,n=`center`]=e.split(`-`);return[t,n]}function _a(e){return ga(e)[0]}function va(e){return ga(e)[1]}function ya(e,t){i(t,!0);let n=k(t,`tooltip`,3,!1);fa.create(n());var r=X(),a=q(r);_(a,()=>t.children??R),y(e,r),x()}function ba(e,t){i(t,!0);let n=k(t,`tooltip`,3,!1);ma.create({id:$(()=>t.id),virtualEl:$(()=>t.virtualEl),ref:t.ref},n());var r=X(),a=q(r);_(a,()=>t.children??R),y(e,r),x()}function xa(e,t){i(t,!0);let n=k(t,`side`,3,`bottom`),r=k(t,`sideOffset`,3,0),a=k(t,`align`,3,`center`),o=k(t,`alignOffset`,3,0),s=k(t,`arrowPadding`,3,0),c=k(t,`avoidCollisions`,3,!0),l=k(t,`collisionBoundary`,19,()=>[]),u=k(t,`collisionPadding`,3,0),d=k(t,`hideWhenDetached`,3,!1),f=k(t,`onPlaced`,3,()=>{}),p=k(t,`sticky`,3,`partial`),m=k(t,`updatePositionStrategy`,3,`optimized`),h=k(t,`strategy`,3,`fixed`),g=k(t,`dir`,3,`ltr`),v=k(t,`style`,19,()=>({})),b=k(t,`wrapperId`,19,hn),S=k(t,`customAnchor`,3,null),C=k(t,`tooltip`,3,!1),w=pa.create({side:$(()=>n()),sideOffset:$(()=>r()),align:$(()=>a()),alignOffset:$(()=>o()),id:$(()=>t.id),arrowPadding:$(()=>s()),avoidCollisions:$(()=>c()),collisionBoundary:$(()=>l()),collisionPadding:$(()=>u()),hideWhenDetached:$(()=>d()),onPlaced:$(()=>f()),sticky:$(()=>p()),updatePositionStrategy:$(()=>m()),strategy:$(()=>h()),dir:$(()=>g()),style:$(()=>v()),enabled:$(()=>t.enabled),wrapperId:$(()=>b()),customAnchor:$(()=>S())},C()),T=I(()=>tn(w.wrapperProps,{style:{pointerEvents:`auto`}}));var D=X(),O=q(D);_(O,()=>t.content??R,()=>({props:w.props,wrapperProps:E(T)})),y(e,D),x()}function Sa(e,t){i(t,!0),ue(()=>{t.onPlaced?.()});var n=X(),r=q(n);_(r,()=>t.content??R,()=>({props:{},wrapperProps:{}})),y(e,n),x()}var Ca=new Set([`$$slots`,`$$events`,`$$legacy`,`content`,`isStatic`,`onPlaced`]);function wa(e,t){let n=k(t,`isStatic`,3,!1),r=U(t,Ca);var i=X(),a=q(i),o=e=>{Sa(e,{get content(){return t.content},get onPlaced(){return t.onPlaced}})},s=e=>{xa(e,K({get content(){return t.content},get onPlaced(){return t.onPlaced}},()=>r))};h(a,e=>{n()?e(o):e(s,-1)}),y(e,i)}var Ta=new Set(`$$slots.$$events.$$legacy.popper.onEscapeKeydown.escapeKeydownBehavior.preventOverflowTextSelection.id.onPointerDown.onPointerUp.side.sideOffset.align.alignOffset.arrowPadding.avoidCollisions.collisionBoundary.collisionPadding.sticky.hideWhenDetached.updatePositionStrategy.strategy.dir.preventScroll.wrapperId.style.onPlaced.onInteractOutside.onCloseAutoFocus.onOpenAutoFocus.onFocusOutside.interactOutsideBehavior.loop.trapFocus.isValidEvent.customAnchor.isStatic.enabled.ref.tooltip.contentPointerEvents`.split(`.`)),Ea=r(`<!> <!>`,1);function Da(e,t){i(t,!0);let n=k(t,`interactOutsideBehavior`,3,`close`),r=k(t,`trapFocus`,3,!0),a=k(t,`isValidEvent`,3,()=>!1),o=k(t,`customAnchor`,3,null),s=k(t,`isStatic`,3,!1),c=k(t,`tooltip`,3,!1),l=k(t,`contentPointerEvents`,3,`auto`),u=U(t,Ta),d=I(()=>t.preventScroll??!0),f=I(()=>t.strategy??(E(d)?`fixed`:`absolute`));wa(e,{get isStatic(){return s()},get id(){return t.id},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return E(f)},get dir(){return t.dir},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return o()},get enabled(){return t.enabled},get tooltip(){return c()},content:(e,i)=>{let o=()=>(i?.()).props,s=()=>(i?.()).wrapperProps;var c=Ea(),f=q(c),p=e=>{sn(e,{get preventScroll(){return E(d)}})},m=e=>{sn(e,{get preventScroll(){return E(d)}})};h(f,e=>{t.forceMount&&t.enabled?e(p):t.forceMount||e(m,1)});var g=z(f,2);cn(g,{get onOpenAutoFocus(){return t.onOpenAutoFocus},get onCloseAutoFocus(){return t.onCloseAutoFocus},get loop(){return t.loop},get enabled(){return t.enabled},get trapFocus(){return r()},get forceMount(){return t.forceMount},get ref(){return t.ref},focusScope:(e,r)=>{let i=()=>(r?.()).props;ln(e,{get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get enabled(){return t.enabled},get ref(){return t.ref},children:(e,r)=>{yn(e,{get id(){return t.id},get onInteractOutside(){return t.onInteractOutside},get onFocusOutside(){return t.onFocusOutside},get interactOutsideBehavior(){return n()},get isValidEvent(){return a()},get enabled(){return t.enabled},get ref(){return t.ref},children:(e,n)=>{let r=()=>(n?.()).props;wn(e,{get id(){return t.id},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get enabled(){return t.enabled},get ref(){return t.ref},children:(e,n)=>{var a=X(),c=q(a);{let e=I(()=>({props:tn(u,o(),r(),i(),{style:{pointerEvents:l()}}),wrapperProps:s()}));_(c,()=>t.popper??R,()=>E(e))}y(e,a)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{focusScope:!0}}),y(e,c)},$$slots:{content:!0}}),x()}var Oa=new Set(`$$slots.$$events.$$legacy.popper.open.onEscapeKeydown.escapeKeydownBehavior.preventOverflowTextSelection.id.onPointerDown.onPointerUp.side.sideOffset.align.alignOffset.arrowPadding.avoidCollisions.collisionBoundary.collisionPadding.sticky.hideWhenDetached.updatePositionStrategy.strategy.dir.preventScroll.wrapperId.style.onPlaced.onInteractOutside.onCloseAutoFocus.onOpenAutoFocus.onFocusOutside.interactOutsideBehavior.loop.trapFocus.isValidEvent.customAnchor.isStatic.ref.shouldRender`.split(`.`));function ka(e,t){let n=k(t,`interactOutsideBehavior`,3,`close`),r=k(t,`trapFocus`,3,!0),i=k(t,`isValidEvent`,3,()=>!1),a=k(t,`customAnchor`,3,null),o=k(t,`isStatic`,3,!1),s=U(t,Oa);var c=X(),l=q(c),u=e=>{Da(e,K({get popper(){return t.popper},get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get id(){return t.id},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get preventScroll(){return t.preventScroll},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return a()},get isStatic(){return o()},get enabled(){return t.open},get onInteractOutside(){return t.onInteractOutside},get onCloseAutoFocus(){return t.onCloseAutoFocus},get onOpenAutoFocus(){return t.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return t.loop},get trapFocus(){return r()},get isValidEvent(){return i()},get onFocusOutside(){return t.onFocusOutside},forceMount:!1,get ref(){return t.ref}},()=>s))};h(l,e=>{t.shouldRender&&e(u)}),y(e,c)}var Aa=new Set(`$$slots.$$events.$$legacy.popper.onEscapeKeydown.escapeKeydownBehavior.preventOverflowTextSelection.id.onPointerDown.onPointerUp.side.sideOffset.align.alignOffset.arrowPadding.avoidCollisions.collisionBoundary.collisionPadding.sticky.hideWhenDetached.updatePositionStrategy.strategy.dir.preventScroll.wrapperId.style.onPlaced.onInteractOutside.onCloseAutoFocus.onOpenAutoFocus.onFocusOutside.interactOutsideBehavior.loop.trapFocus.isValidEvent.customAnchor.isStatic.enabled`.split(`.`));function ja(e,t){let n=k(t,`interactOutsideBehavior`,3,`close`),r=k(t,`trapFocus`,3,!0),i=k(t,`isValidEvent`,3,()=>!1),a=k(t,`customAnchor`,3,null),o=k(t,`isStatic`,3,!1),s=U(t,Aa);Da(e,K({get popper(){return t.popper},get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get id(){return t.id},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get preventScroll(){return t.preventScroll},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return a()},get isStatic(){return o()},get enabled(){return t.enabled},get onInteractOutside(){return t.onInteractOutside},get onCloseAutoFocus(){return t.onCloseAutoFocus},get onOpenAutoFocus(){return t.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return t.loop},get trapFocus(){return r()},get isValidEvent(){return i()},get onFocusOutside(){return t.onFocusOutside}},()=>s,{forceMount:!0}))}function Ma(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Na(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Pa(e){if(typeof CSS<`u`&&typeof CSS.escape==`function`)return CSS.escape(e);let t=e.length,n=-1,r,i=``,a=e.charCodeAt(0);if(t===1&&a===45)return`\\`+e;for(;++n<t;){if(r=e.charCodeAt(n),r===0){i+=`�`;continue}if(r>=1&&r<=31||r===127||n===0&&r>=48&&r<=57||n===1&&r>=48&&r<=57&&a===45){i+=`\\`+r.toString(16)+` `;continue}if(r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){i+=e.charAt(n);continue}i+=`\\`+e.charAt(n)}return i}var Fa=`data-value`,Ia=Bt({component:`command`,parts:[`root`,`list`,`input`,`separator`,`loading`,`empty`,`group`,`group-items`,`group-heading`,`item`,`viewport`,`input-label`]}),La=Ia.selector(`group`),Ra=Ia.selector(`group-items`),za=Ia.selector(`group-heading`),Ba=Ia.selector(`item`),Va=`${Ia.selector(`item`)}:not([aria-disabled="true"])`,Ha=new $t(`Command.Root`),Ua=new $t(`Command.List`),Wa=new $t(`Command.Group`),Ga={search:``,value:``,filtered:{count:0,items:new Map,groups:new Set}},Ka=class e{static create(t){return Ha.set(new e(t))}opts;attachment;#e=!1;#t=!0;sortAfterTick=!1;sortAndFilterAfterTick=!1;allItems=new Set;allGroups=new Map;allIds=new Map;#n=V(0);get key(){return E(this.#n)}set key(e){F(this.#n,e,!0)}#r=V(null);get viewportNode(){return E(this.#r)}set viewportNode(e){F(this.#r,e,!0)}#i=V(null);get inputNode(){return E(this.#i)}set inputNode(e){F(this.#i,e,!0)}#a=V(null);get labelNode(){return E(this.#a)}set labelNode(e){F(this.#a,e,!0)}#o=V(Ga);get commandState(){return E(this.#o)}set commandState(e){F(this.#o,e)}#s=V(J(Ga));get _commandState(){return E(this.#s)}set _commandState(e){F(this.#s,e,!0)}#c(){return o(this._commandState)}#l(){this.#e||(this.#e=!0,Xt(()=>{this.#e=!1;let e=this.#c();Object.is(this.commandState,e)||(this.commandState=e,this.opts.onStateChange?.current?.(e))}))}setState(e,t,n){Object.is(this._commandState[e],t)||(this._commandState[e]=t,e===`search`?(this.#m(),this.#d()):e===`value`&&(n||this.#g()),this.#l())}constructor(e){this.opts=e,this.attachment=Ut(this.opts.ref);let t={...this._commandState,value:this.opts.value.current??``};this._commandState=t,this.commandState=t,this.onkeydown=this.onkeydown.bind(this)}#u(e,t){let n=this.opts.filter.current??qo;return e?n(e,this._commandState.search,t):0}#d(){if(!this._commandState.search||this.opts.shouldFilter.current===!1){!this._commandState.value||!this.#t?this.#f():this.#t&&this._commandState.value&&this.#p();return}let e=this._commandState.filtered.items,t=[];for(let n of this._commandState.filtered.groups){let r=this.allGroups.get(n),i=0;if(!r){t.push([n,i]);continue}for(let t of r){let n=e.get(t);i=Math.max(n??0,i)}t.push([n,i])}let n=this.viewportNode,r=this.getValidItems().sort((t,n)=>{let r=t.getAttribute(`data-value`),i=n.getAttribute(`data-value`),a=e.get(r)??0;return(e.get(i)??0)-a});for(let e of r){let t=e.closest(Ra);if(t){let n=e.parentElement===t?e:e.closest(`${Ra} > *`);n&&t.appendChild(n)}else{let t=e.parentElement===n?e:e.closest(`${Ra} > *`);t&&n?.appendChild(t)}}let i=t.sort((e,t)=>t[1]-e[1]);for(let e of i){let t=n?.querySelector(`${La}[${Fa}="${Pa(e[0])}"]`);t?.parentElement?.appendChild(t)}this.#f()}setValue(e,t){e!==this.opts.value.current&&e===``&&Xt(()=>{this.key++}),this.setState(`value`,e,t),this.opts.value.current=e}#f(){Xt(()=>{let e=this.getValidItems().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Fa),t=this.#t&&this.opts.disableInitialScroll.current;this.setValue(e??``,t),this.#t=!1})}#p(){Xt(()=>{this.opts.disableInitialScroll.current||this.#g(),this.#t=!1})}#m(){if(!this._commandState.search||this.opts.shouldFilter.current===!1){this._commandState.filtered.count=this.allItems.size;return}this._commandState.filtered.groups=new Set;let e=0;for(let t of this.allItems){let n=this.allIds.get(t)?.value??``,r=this.allIds.get(t)?.keywords??[],i=this.#u(n,r);this._commandState.filtered.items.set(t,i),i>0&&e++}for(let[e,t]of this.allGroups)for(let n of t){let t=this._commandState.filtered.items.get(n);if(t&&t>0){this._commandState.filtered.groups.add(e);break}}this._commandState.filtered.count=e}getValidItems(){let e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(Va)).filter(e=>!!e):[]}getVisibleItems(){let e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(Ba)).filter(e=>!!e):[]}get itemsGrid(){if(!this.isGrid)return[];let e=this.opts.columns.current??1,t=this.getVisibleItems(),n=[[]],r=t[0]?.getAttribute(`data-group`),i=0,a=0;for(let o=0;o<t.length;o++){let s=t[o],c=s?.getAttribute(`data-group`);r===c?(i++,i>e&&(a++,i=1,n.push([])),n[a]?.push({index:o,firstRowOfGroup:n[a]?.[0]?.firstRowOfGroup??o===0,ref:s})):(r=c,i=1,a++,n.push([{index:o,firstRowOfGroup:!0,ref:s}]))}return n}#h(){let e=this.opts.ref.current;if(!e)return;let t=e.querySelector(`${Va}[data-selected]`);if(t)return t}#g(){Xt(()=>{let e=this.#h();if(!e)return;let t=e.parentElement?.parentElement;if(t){if(this.isGrid){let t=this.#_(e);if(e.scrollIntoView({block:`nearest`}),t){(e?.closest(La)?.querySelector(za))?.scrollIntoView({block:`nearest`});return}}else{let n=Zt(t);if(n&&n.dataset?.value===e.dataset?.value){(e?.closest(La)?.querySelector(za))?.scrollIntoView({block:`nearest`});return}}e.scrollIntoView({block:`nearest`})}})}#_(e){let t=this.itemsGrid;if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t[n];if(r!==void 0)for(let t=0;t<r.length;t++){let n=r[t];if(n!==void 0&&n.ref===e)return n.firstRowOfGroup}}return!1}updateSelectedToIndex(e){let t=this.getValidItems()[e];t&&this.setValue(t.getAttribute(Fa)??``)}updateSelectedByItem(e){let t=this.#h(),n=this.getValidItems(),r=n.findIndex(e=>e===t),i=n[r+e];this.opts.loop.current&&(i=r+e<0?n[n.length-1]:r+e===n.length?n[0]:n[r+e]),i&&this.setValue(i.getAttribute(Fa)??``)}updateSelectedByGroup(e){let t=this.#h()?.closest(La),n;for(;t&&!n;)t=e>0?Ma(t,La):Na(t,La),n=t?.querySelector(Va);n?this.setValue(n.getAttribute(Fa)??``):this.updateSelectedByItem(e)}registerValue(e,t){return e&&e===this.allIds.get(e)?.value||this.allIds.set(e,{value:e,keywords:t}),this._commandState.filtered.items.set(e,this.#u(e,t)),this.sortAfterTick||(this.sortAfterTick=!0,Xt(()=>{this.#d(),this.sortAfterTick=!1})),()=>{this.allIds.delete(e)}}registerItem(e,t){return this.allItems.add(e),t&&(this.allGroups.has(t)?this.allGroups.get(t).add(e):this.allGroups.set(t,new Set([e]))),this.sortAndFilterAfterTick||(this.sortAndFilterAfterTick=!0,Xt(()=>{this.#m(),this.#d(),this.sortAndFilterAfterTick=!1})),this.#l(),()=>{let t=this.#h();this.allItems.delete(e),this.commandState.filtered.items.delete(e),this.#m(),t?.getAttribute(`id`)===e&&this.#f(),this.#l()}}registerGroup(e){return this.allGroups.has(e)||this.allGroups.set(e,new Set),()=>{this.allIds.delete(e),this.allGroups.delete(e)}}get isGrid(){return this.opts.columns.current!==null}#v(){return this.updateSelectedToIndex(this.getValidItems().length-1)}#y(e){e.preventDefault(),e.metaKey?this.#v():e.altKey?this.updateSelectedByGroup(1):this.updateSelectedByItem(1)}#b(e){this.opts.columns.current!==null&&(e.preventDefault(),e.metaKey?this.updateSelectedByGroup(1):this.updateSelectedByItem(this.#S(e)))}#x(e,t){if(t.length===0)return null;for(let n=0;n<t.length;n++){let r=t[n];if(r!==void 0)for(let t=0;t<r.length;t++){let i=r[t];if(i!==void 0&&i.ref===e)return{columnIndex:t,rowIndex:n}}}return null}#S(e){let t=this.itemsGrid,n=this.#h();if(!n)return 0;let r=this.#x(n,t);if(!r)return 0;let i=null,a=+!!e.altKey;if(e.altKey&&r.rowIndex===t.length-2&&!this.opts.loop.current)i=this.#C({start:t.length-1,end:t.length,expectedColumnIndex:r.columnIndex,grid:t});else if(r.rowIndex===t.length-1){if(!this.opts.loop.current)return 0;i=this.#C({start:0+a,end:r.rowIndex,expectedColumnIndex:r.columnIndex,grid:t})}else i=this.#C({start:r.rowIndex+1+a,end:t.length,expectedColumnIndex:r.columnIndex,grid:t}),i===null&&this.opts.loop.current&&(i=this.#C({start:0,end:r.rowIndex,expectedColumnIndex:r.columnIndex,grid:t}));return this.#w(n,i)}#C({start:e,end:t,grid:n,expectedColumnIndex:r}){let i=null;for(let a=e;a<t;a++){let e=n[a];if(i=e[r]?.ref??null,i!==null&&qa(i)){i=null;continue}if(i===null)for(let t=e.length-1;t>=0;t--){let t=e[e.length-1];if(!(t===void 0||qa(t.ref))){i=t.ref;break}}break}return i}#w(e,t){if(t===null)return 0;let n=this.getValidItems(),r=n.findIndex(t=>t===e);return n.findIndex(e=>e===t)-r}#T(e){this.opts.columns.current!==null&&(e.preventDefault(),e.metaKey?this.updateSelectedByGroup(-1):this.updateSelectedByItem(this.#E(e)))}#E(e){let t=this.itemsGrid,n=this.#h();if(n===void 0)return 0;let r=this.#x(n,t);if(r===null)return 0;let i=null,a=+!!e.altKey;if(e.altKey&&r.rowIndex===1&&this.opts.loop.current===!1)i=this.#D({start:0,end:0,expectedColumnIndex:r.columnIndex,grid:t});else if(r.rowIndex===0){if(this.opts.loop.current===!1)return 0;i=this.#D({start:t.length-1-a,end:r.rowIndex+1,expectedColumnIndex:r.columnIndex,grid:t})}else i=this.#D({start:r.rowIndex-1-a,end:0,expectedColumnIndex:r.columnIndex,grid:t}),i===null&&this.opts.loop.current&&(i=this.#D({start:t.length-1,end:r.rowIndex+1,expectedColumnIndex:r.columnIndex,grid:t}));return this.#w(n,i)}#D({start:e,end:t,grid:n,expectedColumnIndex:r}){let i=null;for(let a=e;a>=t;a--){let e=n[a];if(e!==void 0){if(i=e[r]?.ref??null,i!==null&&qa(i)){i=null;continue}if(i===null)for(let t=e.length-1;t>=0;t--){let t=e[e.length-1];if(!(t===void 0||qa(t.ref))){i=t.ref;break}}break}}return i}#O(e){e.preventDefault(),e.metaKey?this.updateSelectedToIndex(0):e.altKey?this.updateSelectedByGroup(-1):this.updateSelectedByItem(-1)}onkeydown(e){let t=this.opts.vimBindings.current&&e.ctrlKey;switch(e.key){case`n`:case`j`:t&&(this.isGrid?this.#b(e):this.#y(e));break;case`l`:t&&this.isGrid&&this.#y(e);break;case Rt:this.isGrid?this.#b(e):this.#y(e);break;case mn:if(!this.isGrid)break;this.#y(e);break;case`p`:case`k`:t&&(this.isGrid?this.#T(e):this.#O(e));break;case`h`:t&&this.isGrid&&this.#O(e);break;case Ft:this.isGrid?this.#T(e):this.#O(e);break;case Jt:if(!this.isGrid)break;this.#O(e);break;case Kt:e.preventDefault(),this.updateSelectedToIndex(0);break;case`End`:e.preventDefault(),this.#v();break;case pn:if(!e.isComposing&&e.keyCode!==229){e.preventDefault();let t=this.#h();t&&t?.click()}}}#k=I(()=>({id:this.opts.id.current,role:`application`,[Ia.root]:``,tabindex:-1,onkeydown:this.onkeydown,...this.attachment}));get props(){return E(this.#k)}set props(e){F(this.#k,e)}};function qa(e){return e.getAttribute(`aria-disabled`)===`true`}var Ja=class e{static create(t){return new e(t,Ha.get())}opts;root;attachment;#e=I(()=>this.root._commandState.filtered.count===0&&this.#t===!1||this.opts.forceMount.current);get shouldRender(){return E(this.#e)}set shouldRender(e){F(this.#e,e)}#t=!0;constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref),re(()=>{this.#t=!1})}#n=I(()=>({id:this.opts.id.current,role:`presentation`,[Ia.empty]:``,...this.attachment}));get props(){return E(this.#n)}set props(e){F(this.#n,e)}},Ya=class e{static create(t){return Wa.set(new e(t,Ha.get()))}opts;root;attachment;#e=I(()=>this.opts.forceMount.current||this.root.opts.shouldFilter.current===!1||!this.root.commandState.search?!0:this.root._commandState.filtered.groups.has(this.trueValue));get shouldRender(){return E(this.#e)}set shouldRender(e){F(this.#e,e)}#t=V(null);get headingNode(){return E(this.#t)}set headingNode(e){F(this.#t,e,!0)}#n=V(``);get trueValue(){return E(this.#n)}set trueValue(e){F(this.#n,e,!0)}constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref),this.trueValue=e.value.current??e.id.current,Ht(()=>this.trueValue,()=>this.root.registerGroup(this.trueValue)),de(()=>this.opts.value.current?(this.trueValue=this.opts.value.current,this.root.registerValue(this.opts.value.current)):this.headingNode&&this.headingNode.textContent?(this.trueValue=this.headingNode.textContent.trim().toLowerCase(),this.root.registerValue(this.trueValue)):(this.trueValue=`-----${this.opts.id.current}`,this.root.registerValue(this.trueValue)))}#r=I(()=>({id:this.opts.id.current,role:`presentation`,hidden:!this.shouldRender||void 0,"data-value":this.trueValue,[Ia.group]:``,...this.attachment}));get props(){return E(this.#r)}set props(e){F(this.#r,e)}},Xa=class e{static create(t){return new e(t,Wa.get())}opts;group;attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=Ut(this.opts.ref,e=>this.group.headingNode=e)}#e=I(()=>({id:this.opts.id.current,[Ia[`group-heading`]]:``,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},Za=class e{static create(t){return new e(t,Wa.get())}opts;group;attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=Ut(this.opts.ref)}#e=I(()=>({id:this.opts.id.current,role:`group`,[Ia[`group-items`]]:``,"aria-labelledby":this.group.headingNode?.id??void 0,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},Qa=class e{static create(t){return new e(t,Ha.get())}opts;root;attachment;#e=I(()=>{let e=this.root.viewportNode?.querySelector(`${Ba}[${Fa}="${Pa(this.root.opts.value.current)}"]`);if(e!=null)return e.getAttribute(`id`)??void 0});constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref,e=>this.root.inputNode=e),Ht(()=>this.opts.ref.current,()=>{let e=this.opts.ref.current;e&&this.opts.autofocus.current&&kn(10,()=>e.focus())}),Ht(()=>this.opts.value.current,()=>{this.root.commandState.search!==this.opts.value.current&&this.root.setState(`search`,this.opts.value.current)})}#t=I(()=>({id:this.opts.id.current,type:`text`,[Ia.input]:``,autocomplete:`off`,autocorrect:`off`,spellcheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":Yt(!0),"aria-controls":this.root.viewportNode?.id??void 0,"aria-labelledby":this.root.labelNode?.id??void 0,"aria-activedescendant":E(this.#e),...this.attachment}));get props(){return E(this.#t)}set props(e){F(this.#t,e)}},$a=class e{static create(t){let n=Wa.getOr(null);return new e({...t,group:n},Ha.get())}opts;root;attachment;#e=null;#t=I(()=>this.opts.forceMount.current||this.#e?.opts.forceMount.current===!0);#n=I(()=>{if(this.opts.ref.current,E(this.#t)||this.root.opts.shouldFilter.current===!1||!this.root.commandState.search)return!0;let e=this.root.commandState.filtered.items.get(this.trueValue);return e!==void 0&&e>0});get shouldRender(){return E(this.#n)}set shouldRender(e){F(this.#n,e)}#r=I(()=>this.root.opts.value.current===this.trueValue&&this.trueValue!==``);get isSelected(){return E(this.#r)}set isSelected(e){F(this.#r,e)}#i=V(``);get trueValue(){return E(this.#i)}set trueValue(e){F(this.#i,e,!0)}constructor(e,t){this.opts=e,this.root=t,this.#e=Wa.getOr(null),this.trueValue=e.value.current,this.attachment=Ut(this.opts.ref),Ht([()=>this.trueValue,()=>this.#e?.trueValue,()=>this.opts.forceMount.current],()=>{if(!this.opts.forceMount.current&&this.trueValue)return this.root.registerItem(this.trueValue,this.#e?.trueValue)}),Ht([()=>this.opts.value.current,()=>this.opts.ref.current],()=>{this.opts.value.current?this.trueValue=this.opts.value.current:this.opts.ref.current?.textContent&&(this.trueValue=this.opts.ref.current.textContent.trim()),this.trueValue&&(this.root.registerValue(this.trueValue,e.keywords.current.map(e=>e.trim())),this.opts.ref.current?.setAttribute(Fa,this.trueValue))}),this.onclick=this.onclick.bind(this),this.onpointermove=this.onpointermove.bind(this)}#a(){this.opts.disabled.current||(this.#o(),this.opts.onSelect?.current())}#o(){this.opts.disabled.current||this.root.setValue(this.trueValue,!0)}onpointermove(e){this.opts.disabled.current||this.root.opts.disablePointerSelection.current||this.#o()}onclick(e){this.opts.disabled.current||this.#a()}#s=I(()=>({id:this.opts.id.current,"aria-disabled":Yt(this.opts.disabled.current),"aria-selected":Yt(this.isSelected),"data-disabled":qt(this.opts.disabled.current),"data-selected":qt(this.isSelected),"data-value":this.trueValue,"data-group":this.#e?.trueValue,[Ia.item]:``,role:`option`,onpointermove:this.onpointermove,onclick:this.onclick,...this.attachment}));get props(){return E(this.#s)}set props(e){F(this.#s,e)}},eo=class e{static create(t){return Ua.set(new e(t,Ha.get()))}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref)}#e=I(()=>({id:this.opts.id.current,role:`listbox`,"aria-label":this.opts.ariaLabel.current,[Ia.list]:``,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},to=class e{static create(t){return new e(t,Ha.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Ut(this.opts.ref,e=>this.root.labelNode=e)}#e=I(()=>({id:this.opts.id.current,[Ia[`input-label`]]:``,for:this.opts.for?.current,style:rr,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},no=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`]),ro=r(`<label><!></label>`);function io(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,no),c=to.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props));var d=ro();P(d,()=>({...E(l)}));var f=W(d);_(f,()=>t.children??R),n(d),y(e,d),x()}var ao=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`onValueChange`,`onStateChange`,`loop`,`shouldFilter`,`filter`,`label`,`vimBindings`,`disablePointerSelection`,`disableInitialScroll`,`columns`,`children`,`child`]),oo=r(`<!> <!>`,1),so=r(`<div><!> <!></div>`);function co(e,t){let r=u();i(t,!0);let a=e=>{io(e,{children:(e,t)=>{oe();var n=C();H(()=>c(n,v())),y(e,n)},$$slots:{default:!0}})},o=k(t,`id`,19,()=>En(r)),s=k(t,`ref`,15,null),l=k(t,`value`,15,``),d=k(t,`onValueChange`,3,Qt),f=k(t,`onStateChange`,3,Qt),p=k(t,`loop`,3,!1),m=k(t,`shouldFilter`,3,!0),g=k(t,`filter`,3,qo),v=k(t,`label`,3,``),b=k(t,`vimBindings`,3,!0),S=k(t,`disablePointerSelection`,3,!1),w=k(t,`disableInitialScroll`,3,!1),T=k(t,`columns`,3,null),D=U(t,ao),O=Ka.create({id:$(()=>o()),ref:$(()=>s(),e=>s(e)),filter:$(()=>g()),shouldFilter:$(()=>m()),loop:$(()=>p()),value:$(()=>l(),e=>{l()!==e&&(l(e),d()(e))}),vimBindings:$(()=>b()),disablePointerSelection:$(()=>S()),disableInitialScroll:$(()=>w()),onStateChange:$(()=>f()),columns:$(()=>T())}),A=e=>O.updateSelectedToIndex(e),j=e=>O.updateSelectedByGroup(e),ee=e=>O.updateSelectedByItem(e),te=()=>O.getValidItems(),M=I(()=>tn(D,O.props));var N={updateSelectedToIndex:A,updateSelectedByGroup:j,updateSelectedByItem:ee,getValidItems:te},F=X(),L=q(F),ne=e=>{var n=oo(),r=q(n);a(r);var i=z(r,2);_(i,()=>t.child,()=>({props:E(M)})),y(e,n)},re=e=>{var r=so();P(r,()=>({...E(M)}));var i=W(r);a(i);var o=z(i,2);_(o,()=>t.children??R),n(r),y(e,r)};return h(L,e=>{t.child?e(ne):e(re,-1)}),y(e,F),x(N)}var lo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`,`forceMount`]),uo=r(`<div><!></div>`);function fo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`forceMount`,3,!1),c=U(t,lo),l=Ja.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),forceMount:$(()=>s())}),d=I(()=>tn(l.props,c));var f=X(),p=q(f),m=e=>{var r=X(),i=q(r),a=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(d)})),y(e,n)},o=e=>{var r=uo();P(r,()=>({...E(d)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(i,e=>{t.child?e(a):e(o,-1)}),y(e,r)};h(p,e=>{l.shouldRender&&e(m)}),y(e,f),x()}var po=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`forceMount`,`children`,`child`]),mo=r(`<div><!></div>`);function ho(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`value`,3,``),c=k(t,`forceMount`,3,!1),l=U(t,po),d=Ya.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),forceMount:$(()=>c()),value:$(()=>s())}),f=I(()=>tn(l,d.props));var p=X(),m=q(p),g=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(f)})),y(e,n)},v=e=>{var r=mo();P(r,()=>({...E(f)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(m,e=>{t.child?e(g):e(v,-1)}),y(e,p),x()}var go=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`]),_o=r(`<div><!></div>`);function vo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,go),c=Xa.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props));var d=X(),f=q(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=_o();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var yo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`children`,`child`]),bo=r(`<div><!></div>`),xo=r(`<div style="display: contents;"><!></div>`);function So(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,yo),c=Za.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props));var d=xo(),f=W(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=bo();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),n(d),y(e,d),x()}var Co=new Set([`$$slots`,`$$events`,`$$legacy`,`value`,`autofocus`,`id`,`ref`,`child`]),wo=r(`<input/>`);function To(e,t){let n=u();i(t,!0);let r=k(t,`value`,15,``),a=k(t,`autofocus`,3,!1),o=k(t,`id`,19,()=>En(n)),s=k(t,`ref`,15,null),c=U(t,Co),l=Qa.create({id:$(()=>o()),ref:$(()=>s(),e=>s(e)),value:$(()=>r(),e=>{r(e)}),autofocus:$(()=>a()??!1)}),d=I(()=>tn(c,l.props));var f=X(),p=q(f),m=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(d)})),y(e,n)},g=e=>{var t=wo();P(t,()=>({...E(d)}),void 0,void 0,void 0,void 0,!0),N(t,r),y(e,t)};h(p,e=>{t.child?e(m):e(g,-1)}),y(e,f),x()}var Eo=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`value`,`disabled`,`children`,`child`,`onSelect`,`forceMount`,`keywords`]),Do=r(`<div><!></div>`),Oo=r(`<div style="display: contents;" data-item-wrapper=""><!></div>`);function ko(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`value`,3,``),c=k(t,`disabled`,3,!1),l=k(t,`onSelect`,3,Qt),d=k(t,`forceMount`,3,!1),f=k(t,`keywords`,19,()=>[]),m=U(t,Eo),g=$a.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),value:$(()=>s()),disabled:$(()=>c()),onSelect:$(()=>l()),forceMount:$(()=>d()),keywords:$(()=>f())}),v=I(()=>tn(m,g.props));var b=X(),S=q(b);p(S,()=>g.root.key,e=>{var r=Oo(),i=W(r),a=e=>{var r=X(),i=q(r),a=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(v)})),y(e,n)},o=e=>{var r=Do();P(r,()=>({...E(v)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(i,e=>{t.child?e(a):e(o,-1)}),y(e,r)};h(i,e=>{g.shouldRender&&e(a)}),n(r),H(()=>B(r,`data-value`,g.trueValue)),y(e,r)}),y(e,b),x()}var Ao=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`aria-label`]),jo=r(`<div><!></div>`);function Mo(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,Ao),c=eo.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e)),ariaLabel:$(()=>t[`aria-label`]??`Suggestions...`)}),l=I(()=>tn(s,c.props));var d=X(),f=q(d);p(f,()=>c.root._commandState.search===``,e=>{var r=X(),i=q(r),a=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},o=e=>{var r=jo();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(i,e=>{t.child?e(a):e(o,-1)}),y(e,r)}),y(e,d),x()}var No=1,Po=.9,Fo=.8,Io=.17,Lo=.1,Ro=.999,zo=.9999,Bo=.99,Vo=/[\\/_+.#"@[({&]/,Ho=/[\\/_+.#"@[({&]/g,Uo=/[\s-]/,Wo=/[\s-]/g;function Go(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?No:Bo;let s=`${i},${a}`;if(o[s]!==void 0)return o[s];let c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;for(;l>=0;)d=Go(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=No:Vo.test(e.charAt(l-1))?(d*=Fo,p=e.slice(i,l-1).match(Ho),p&&i>0&&(d*=Ro**p.length)):Uo.test(e.charAt(l-1))?(d*=Po,m=e.slice(i,l-1).match(Wo),m&&i>0&&(d*=Ro**m.length)):(d*=Io,i>0&&(d*=Ro**(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=zo)),(d<Lo&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Go(e,t,n,r,l+1,a+2,o),f*Lo>d&&(d=f*Lo)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ko(e){return e.toLowerCase().replace(Wo,` `)}function qo(e,t,n){return e=n&&n.length>0?`${`${e} ${n?.join(` `)}`}`:e,Go(e,t,Ko(e),Ko(t),0,0,{})}var Jo=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`,`disabled`,`onSelect`,`closeOnSelect`]),Yo=r(`<div><!></div>`);function Xo(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=k(t,`disabled`,3,!1),c=k(t,`onSelect`,3,Qt),l=k(t,`closeOnSelect`,3,!0),d=U(t,Jo),f=Tn.create({id:$(()=>o()),disabled:$(()=>s()),onSelect:$(()=>c()),ref:$(()=>a(),e=>a(e)),closeOnSelect:$(()=>l())}),p=I(()=>tn(d,f.props));var m=X(),g=q(m),v=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(p)})),y(e,n)},b=e=>{var r=Yo();P(r,()=>({...E(p)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(g,e=>{t.child?e(v):e(b,-1)}),y(e,m),x()}var Zo=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`ref`,`id`]),Qo=r(`<div><!></div>`);function $o(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=U(t,Zo),c=rn.create({id:$(()=>o()),ref:$(()=>a(),e=>a(e))}),l=I(()=>tn(s,c.props));var d=X(),f=q(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=Qo();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var es=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`ref`,`id`]),ts=r(`<div><!></div>`);function ns(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=U(t,es),c=un.create({id:$(()=>o()),ref:$(()=>a(),e=>a(e))}),l=I(()=>tn(s,c.props));var d=X(),f=q(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=ts();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var rs=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`id`,`child`,`children`]),is=r(`<div><!></div>`);function as(e,t){let r=u();i(t,!0);let a=k(t,`ref`,15,null),o=k(t,`id`,19,()=>En(r)),s=U(t,rs),c=Dn.create({id:$(()=>o()),ref:$(()=>a(),e=>a(e))}),l=I(()=>tn(s,c.props));var d=X(),f=q(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=is();P(r,()=>({...E(l)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}function os(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=k(t,`dir`,3,`ltr`),a=k(t,`onOpenChange`,3,Qt),o=k(t,`onOpenChangeComplete`,3,Qt),s=k(t,`_internal_variant`,3,`dropdown-menu`),c=k(t,`_internal_should_skip_exit_animation`,3,void 0),l=on.create({variant:$(()=>s()),dir:$(()=>r()),onClose:()=>{n(!1),a()(!1)},shouldSkipExitAnimation:()=>c()?.()??!1});On.create({open:$(()=>n(),e=>{n(e),a()(e)}),onOpenChangeComplete:$(()=>o())},l),ya(e,{children:(e,n)=>{var r=X(),i=q(r);_(i,()=>t.children??R),y(e,r)},$$slots:{default:!0}}),x()}var ss=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`child`,`children`,`ref`,`loop`,`onInteractOutside`,`onEscapeKeydown`,`onCloseAutoFocus`,`forceMount`,`trapFocus`,`style`]),cs=r(`<div><div><!></div></div>`);function ls(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`loop`,3,!0),c=k(t,`onInteractOutside`,3,Qt),l=k(t,`onEscapeKeydown`,3,Qt),d=k(t,`onCloseAutoFocus`,3,Qt),f=k(t,`forceMount`,3,!1),p=k(t,`trapFocus`,3,!1),m=U(t,ss),g=dn.create({id:$(()=>a()),loop:$(()=>s()),ref:$(()=>o(),e=>o(e)),onCloseAutoFocus:$(()=>d())}),v=I(()=>tn(m,g.props));function b(e){if(g.handleInteractOutside(e),!e.defaultPrevented&&(c()(e),!e.defaultPrevented)){if(e.target&&e.target instanceof Element){let t=`[${g.parentMenu.root.getBitsAttr(`sub-content`)}]`;if(e.target.closest(t))return}g.parentMenu.onClose()}}function S(e){l()(e),!e.defaultPrevented&&g.parentMenu.onClose()}var C=X(),w=q(C),T=e=>{ja(e,K(()=>E(v),()=>g.popperProps,{get ref(){return g.opts.ref},get enabled(){return g.parentMenu.opts.open.current},onInteractOutside:b,onEscapeKeydown:S,get trapFocus(){return p()},get loop(){return s()},forceMount:!0,get id(){return a()},get shouldRender(){return g.shouldRender},popper:(e,r)=>{let i=()=>(r?.()).props,a=()=>(r?.()).wrapperProps,o=I(()=>tn(i(),{style:aa(`dropdown-menu`)},{style:t.style}));var s=X(),c=q(s),l=e=>{var n=X(),r=q(n);{let e=I(()=>({props:E(o),wrapperProps:a(),...g.snippetProps}));_(r,()=>t.child,()=>E(e))}y(e,n)},u=e=>{var r=cs();P(r,()=>({...a()}));var i=W(r);P(i,()=>({...E(o)}));var s=W(i);_(s,()=>t.children??R),n(i),n(r),y(e,r)};h(c,e=>{t.child?e(l):e(u,-1)}),y(e,s)},$$slots:{popper:!0}}))},D=e=>{ka(e,K(()=>E(v),()=>g.popperProps,{get ref(){return g.opts.ref},get open(){return g.parentMenu.opts.open.current},onInteractOutside:b,onEscapeKeydown:S,get trapFocus(){return p()},get loop(){return s()},forceMount:!1,get id(){return a()},get shouldRender(){return g.shouldRender},popper:(e,r)=>{let i=()=>(r?.()).props,a=()=>(r?.()).wrapperProps,o=I(()=>tn(i(),{style:aa(`dropdown-menu`)},{style:t.style}));var s=X(),c=q(s),l=e=>{var n=X(),r=q(n);{let e=I(()=>({props:E(o),wrapperProps:a(),...g.snippetProps}));_(r,()=>t.child,()=>E(e))}y(e,n)},u=e=>{var r=cs();P(r,()=>({...a()}));var i=W(r);P(i,()=>({...E(o)}));var s=W(i);_(s,()=>t.children??R),n(i),n(r),y(e,r)};h(c,e=>{t.child?e(l):e(u,-1)}),y(e,s)},$$slots:{popper:!0}}))};h(w,e=>{f()?e(T):f()||e(D,1)}),y(e,C),x()}var us=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`disabled`,`type`]),ds=r(`<button><!></button>`);function fs(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=k(t,`disabled`,3,!1),c=k(t,`type`,3,`button`),l=U(t,us),d=gn.create({id:$(()=>a()),disabled:$(()=>s()??!1),ref:$(()=>o(),e=>o(e))}),f=I(()=>tn(l,d.props,{type:c()}));ba(e,{get id(){return a()},get ref(){return d.opts.ref},children:(e,r)=>{var i=X(),a=q(i),o=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(f)})),y(e,n)},s=e=>{var r=ds();P(r,()=>({...E(f)}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(a,e=>{t.child?e(o):e(s,-1)}),y(e,i)},$$slots:{default:!0}}),x()}var ps=Bt({component:`label`,parts:[`root`]}),ms=class e{static create(t){return new e(t)}opts;attachment;constructor(e){this.opts=e,this.attachment=Ut(this.opts.ref),this.onmousedown=this.onmousedown.bind(this)}onmousedown(e){e.detail>1&&e.preventDefault()}#e=I(()=>({id:this.opts.id.current,[ps.root]:``,onmousedown:this.onmousedown,...this.attachment}));get props(){return E(this.#e)}set props(e){F(this.#e,e)}},hs=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`for`]),gs=r(`<label><!></label>`);function _s(e,t){let r=u();i(t,!0);let a=k(t,`id`,19,()=>En(r)),o=k(t,`ref`,15,null),s=U(t,hs),c=ms.create({id:$(()=>a()),ref:$(()=>o(),e=>o(e))}),l=I(()=>tn(s,c.props,{for:t.for}));var d=X(),f=q(d),p=e=>{var n=X(),r=q(n);_(r,()=>t.child,()=>({props:E(l)})),y(e,n)},m=e=>{var r=gs();P(r,()=>({...E(l),for:t.for}));var i=W(r);_(i,()=>t.children??R),n(r),y(e,r)};h(f,e=>{t.child?e(p):e(m,-1)}),y(e,d),x()}var vs=class{#e;#t;#n=null;constructor(e,t){this.#t=e,this.#e=t,this.stop=this.stop.bind(this),this.start=this.start.bind(this),It(this.stop)}#r(){this.#n!==null&&(window.clearTimeout(this.#n),this.#n=null)}stop(){this.#r()}start(...e){this.#r(),this.#n=window.setTimeout(()=>{this.#n=null,this.#t(...e)},this.#e)}};Bt({component:`tooltip`,parts:[`content`,`trigger`]});var ys=new $t(`Tooltip.Provider`);new $t(`Tooltip.Root`);var bs=class e{static create(t){return ys.set(new e(t))}opts;#e=V(!0);get isOpenDelayed(){return E(this.#e)}set isOpenDelayed(e){F(this.#e,e,!0)}isPointerInTransit=nn(!1);#t;#n=V(null);constructor(e){this.opts=e,this.#t=new vs(()=>{this.isOpenDelayed=!0},this.opts.skipDelayDuration.current),ir(()=>G(window,`scroll`,e=>{let t=E(this.#n);if(!t)return;let n=t.triggerNode;if(!n)return;let r=e.target;(r instanceof Element||r instanceof Document)&&r.contains(n)&&t.handleClose()}))}#r=()=>{if(this.opts.skipDelayDuration.current===0){this.isOpenDelayed=!0;return}this.#t.start()};#i=()=>{this.#t.stop()};onOpen=e=>{E(this.#n)&&E(this.#n)!==e&&E(this.#n).handleClose(),this.#i(),this.isOpenDelayed=!1,F(this.#n,e,!0)};onClose=e=>{E(this.#n)===e&&(F(this.#n,null),this.#r())};isTooltipOpen=e=>E(this.#n)===e};function xs(e,t){i(t,!0);let n=k(t,`delayDuration`,3,700),r=k(t,`disableCloseOnTriggerClick`,3,!1),a=k(t,`disableHoverableContent`,3,!1),o=k(t,`disabled`,3,!1),s=k(t,`ignoreNonKeyboardFocus`,3,!1),c=k(t,`skipDelayDuration`,3,300);bs.create({delayDuration:$(()=>n()),disableCloseOnTriggerClick:$(()=>r()),disableHoverableContent:$(()=>a()),disabled:$(()=>o()),ignoreNonKeyboardFocus:$(()=>s()),skipDelayDuration:$(()=>c())});var l=X(),u=q(l);_(u,()=>t.children??R),y(e,l),x()}var Ss=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function Cs(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Ss);var o=X(),s=q(o);{let e=I(()=>Fn(`gap-2 text-xs/relaxed leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed`,t.class));a(s,()=>_s,(t,i)=>{i(t,K({"data-slot":`label`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var ws=r(`<!> Import workspace`,1),Ts=r(`<!> <!>`,1),Es=r(`<div class="rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs text-destructive"> </div>`),Ds=r(`Display name <span class="text-muted-foreground">(optional)</span>`,1),Os=r(`<!> Import`,1),ks=r(`<!> <!> <div class="space-y-3"><div class="space-y-1.5"><!> <!> <p class="text-[11px] text-muted-foreground">Absolute path to a directory containing skill folders.</p></div> <div class="space-y-1.5"><!> <!></div> <div class="flex justify-end gap-2 pt-1"><!> <!></div></div>`,1);function As(e,t){i(t,!0);let r=V(!1);de(()=>{Oe.open=E(r)}),de(()=>{Oe.open&&F(r,!0)}),de(()=>{E(r)&&(F(o,``),F(s,``),F(u,null))});let o=V(``),s=V(``),l=V(!1),u=V(null);async function d(){if(!E(o).trim()){F(u,`A directory path is required.`);return}F(l,!0),F(u,null);try{let e=await Pt(E(o).trim(),E(s).trim()||void 0);if(!e)return;F(r,!1),await ge(Nt(e))}catch(e){F(u,e instanceof Error?e.message:String(e),!0)}finally{F(l,!1)}}var f=X(),p=q(f);a(p,()=>Sn,(e,t)=>{t(e,{get open(){return E(r)},set open(e){F(r,e,!0)},children:(e,t)=>{var i=X(),f=q(i);a(f,()=>fn,(e,t)=>{t(e,{class:`sm:max-w-[460px]`,children:(e,t)=>{var i=ks(),f=q(i);a(f,()=>an,(e,t)=>{t(e,{children:(e,t)=>{var n=Ts(),r=q(n);a(r,()=>vn,(e,t)=>{t(e,{class:`flex items-center gap-2`,children:(e,t)=>{var n=ws(),r=q(n);Vn(r,{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>xn,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C(`Import a directory as a skill workspace. Its skills will be discovered and managed here.`);y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})});var p=z(f,2),m=e=>{var t=Es(),n=M(t,!0);H(()=>c(n,E(u))),y(e,t)};h(p,e=>{E(u)&&e(m)});var g=z(p,2),_=W(g),v=W(_);Cs(v,{for:`ws-path`,children:(e,t)=>{oe();var n=C(`Directory path`);y(e,n)},$$slots:{default:!0}});var b=z(v,2);zn(b,{id:`ws-path`,placeholder:`/Users/me/.claude/skills`,class:`font-mono text-xs`,get value(){return E(o)},set value(e){F(o,e,!0)}}),oe(2),n(_);var x=z(_,2),S=W(x);Cs(S,{for:`ws-label`,children:(e,t)=>{oe();var n=Ds();oe(),y(e,n)},$$slots:{default:!0}});var w=z(S,2);zn(w,{id:`ws-label`,placeholder:`My Skills`,get value(){return E(s)},set value(e){F(s,e,!0)}}),n(x);var T=z(x,2),D=W(T);An(D,{variant:`outline`,size:`sm`,onclick:()=>F(r,!1),children:(e,t)=>{oe();var n=C(`Cancel`);y(e,n)},$$slots:{default:!0}});var O=z(D,2);An(O,{size:`sm`,get disabled(){return E(l)},onclick:d,children:(e,t)=>{var n=Os(),r=q(n),i=e=>{jn(e,{class:`h-3.5 w-3.5 animate-spin`})};h(r,e=>{E(l)&&e(i)}),oe(),y(e,n)},$$slots:{default:!0}}),n(T),n(g),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,f),x()}var js=new Set([`$$slots`,`$$events`,`$$legacy`,`api`,`ref`,`value`,`class`]);function Ms(e,t){i(t,!0);let n=k(t,`api`,15,null),r=k(t,`ref`,15,null),o=k(t,`value`,15,``),s=U(t,js);var c=X(),l=q(c);{let e=I(()=>Fn(`bg-popover text-popover-foreground rounded-xl p-1 flex size-full flex-col overflow-hidden`,t.class));a(l,()=>co,(t,i)=>{se(i(t,K({"data-slot":`command`,get class(){return E(e)}},()=>s,{get value(){return o()},set value(e){o(e)},get ref(){return r()},set ref(e){r(e)}})),e=>n(e),()=>n())})}y(e,c),x()}var Ns=new Set([`$$slots`,`$$events`,`$$legacy`,`open`,`ref`,`value`,`title`,`description`,`showCloseButton`,`portalProps`,`children`,`class`]),Ps=r(`<!> <!>`,1);function Fs(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=k(t,`ref`,15,null),o=k(t,`value`,15,``),s=k(t,`title`,3,`Command Palette`),l=k(t,`description`,3,`Search for a command to run...`),u=k(t,`showCloseButton`,3,!1),d=U(t,Ns);var f=X(),p=q(f);a(p,()=>Sn,(e,i)=>{i(e,K(()=>d,{get open(){return n()},set open(e){n(e)},children:(e,n)=>{var i=Ps(),f=q(i);a(f,()=>an,(e,t)=>{t(e,{class:`sr-only`,children:(e,t)=>{var n=Ps(),r=q(n);a(r,()=>vn,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C();H(()=>c(n,s())),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>xn,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C();H(()=>c(n,l())),y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})});var p=z(f,2);{let e=I(()=>Fn(`rounded-xl! p-0 top-1/3 translate-y-0 overflow-hidden p-0`,t.class));a(p,()=>fn,(n,i)=>{i(n,{get class(){return E(e)},get showCloseButton(){return u()},get portalProps(){return t.portalProps},children:(e,n)=>{Ms(e,K(()=>d,{get children(){return t.children},get value(){return o()},set value(e){o(e)},get ref(){return r()},set ref(e){r(e)}}))},$$slots:{default:!0}})})}y(e,i)},$$slots:{default:!0}}))}),y(e,f),x()}var Is=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function Ls(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Is);var o=X(),s=q(o);{let e=I(()=>Fn(`py-6 text-center text-xs/relaxed`,t.class));a(s,()=>fo,(t,i)=>{i(t,K({"data-slot":`command-empty`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var Rs=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`,`heading`,`value`]),zs=r(`<!> <!>`,1);function Bs(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Rs);var o=X(),s=q(o);{let e=I(()=>Fn(`text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2.5 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium`,t.class)),i=I(()=>t.value??t.heading??`----${hn()}`);a(s,()=>ho,(o,s)=>{s(o,K({"data-slot":`command-group`,get class(){return E(e)},get value(){return E(i)}},()=>r,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var r=zs(),i=q(r),o=e=>{var n=X(),r=q(n);a(r,()=>vo,(e,n)=>{n(e,{class:`text-muted-foreground px-2 py-1.5 text-xs font-medium`,children:(e,n)=>{oe();var r=C();H(()=>c(r,t.heading)),y(e,r)},$$slots:{default:!0}})}),y(e,n)};h(i,e=>{t.heading&&e(o)});var s=z(i,2);a(s,()=>So,(e,n)=>{n(e,{get children(){return t.children}})}),y(e,r)},$$slots:{default:!0}}))})}y(e,o),x()}var Vs=new Set([`$$slots`,`$$events`,`$$legacy`]);function Hs(e,t){let n=U(t,Vs),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];ye(e,K({name:`check`},()=>n,{get iconNode(){return r}}))}var Us=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),Ws=r(`<!> <!>`,1);function Gs(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,Us);var o=X(),s=q(o);{let e=I(()=>Fn(`group/command-item data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,t.class));a(s,()=>ko,(i,a)=>{a(i,K({"data-slot":`command-item`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)},children:(e,n)=>{var r=Ws(),i=q(r);_(i,()=>t.children??R),Hs(z(i,2),{class:`cn-command-item-indicator ml-auto opacity-0 group-has-[[data-slot=command-shortcut]]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`}),y(e,r)},$$slots:{default:!0}}))})}y(e,o),x()}var Ks=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),qs=r(`<div><!></div>`);function Js(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=U(t,Ks);var o=qs();P(o,e=>({"data-slot":`input-group`,role:`group`,class:e,...a}),[()=>Fn(`group/input-group border-input bg-input/20 dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 h-7 rounded-md border transition-colors in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-2 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto`,t.class)]);var s=W(o);_(s,()=>t.children??R),n(o),se(o,e=>r(e),()=>r()),y(e,o),x()}var Ys=Nn({base:`text-muted-foreground **:data-[slot=kbd]:bg-muted-foreground/10 h-auto gap-1 py-2 text-xs/relaxed font-medium group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5 flex cursor-text items-center justify-center select-none`,variants:{align:{"inline-start":`pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem] order-first`,"inline-end":`pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem] order-last`,"block-start":`px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start`,"block-end":`px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start`}},defaultVariants:{align:`inline-start`}}),Xs=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`,`align`]),Zs=r(`<div><!></div>`);function Qs(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=k(t,`align`,3,`inline-start`),o=U(t,Xs);var s=Zs(),c=e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()};P(s,e=>({role:`group`,"data-slot":`input-group-addon`,"data-align":a(),class:e,onclick:c,...o}),[()=>Fn(Ys({align:a()}),t.class)]);var l=W(s);_(l,()=>t.children??R),n(s),se(s,e=>r(e),()=>r()),y(e,s),x()}Nn({base:`gap-2 rounded-md text-xs/relaxed flex items-center shadow-none`,variants:{size:{xs:`h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3`,sm:`gap-1`,"icon-xs":`size-6 p-0 has-[>svg]:p-0`,"icon-sm":`size-7 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});var $s=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`value`,`class`]);function ec(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=k(t,`value`,15),a=U(t,$s);{let i=I(()=>Fn(`rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1`,t.class));zn(e,K({"data-slot":`input-group-control`,get class(){return E(i)}},()=>a,{get ref(){return n()},set ref(e){n(e)},get value(){return r()},set value(e){r(e)}}))}x()}var tc=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`value`]),nc=r(`<!> <!>`,1),rc=r(`<div data-slot="command-input-wrapper" class="p-1 pb-0"><!></div>`);function ic(e,t){i(t,!0);let r=k(t,`ref`,15,null),o=k(t,`value`,15,``),s=U(t,tc);var c=rc(),l=W(c);a(l,()=>Js,(e,n)=>{n(e,{class:`bg-input/20 dark:bg-input/30 h-8!`,children:(e,n)=>{var i=nc(),c=q(i);{let e=(e,t)=>{let n=()=>(t?.()).props;var i=X(),s=q(i);a(s,()=>ec,(e,t)=>{t(e,K(n,{get value(){return o()},set value(e){o(e)},get ref(){return r()},set ref(e){r(e)}}))}),y(e,i)},n=I(()=>Fn(`w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,t.class));a(c,()=>To,(t,r)=>{r(t,K({get value(){return o()},"data-slot":`command-input`,get class(){return E(n)}},()=>s,{child:e,$$slots:{child:!0}}))})}var l=z(c,2);a(l,()=>Qs,(e,t)=>{t(e,{children:(e,t)=>{Un(e,{class:`size-3.5 shrink-0 opacity-50`})},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),n(c),y(e,c),x()}var ac=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function oc(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,ac);var o=X(),s=q(o);{let e=I(()=>Fn(`no-scrollbar max-h-72 scroll-py-1 outline-none overflow-x-hidden overflow-y-auto`,t.class));a(s,()=>Mo,(t,i)=>{i(t,K({"data-slot":`command-list`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var sc=new Set([`$$slots`,`$$events`,`$$legacy`]);function cc(e,t){let n=U(t,sc),r=[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M14 19h6`}],[`path`,{d:`M17 16v6`}]];ye(e,K({name:`file-plus-corner`},()=>n,{get iconNode(){return r}}))}var lc=new Set([`$$slots`,`$$events`,`$$legacy`]);function uc(e,t){let n=U(t,lc),r=[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`}]];ye(e,K({name:`layout-grid`},()=>n,{get iconNode(){return r}}))}var dc=r(`<!> Workspaces`,1),fc=r(`<!> Creator`,1),pc=r(`<!> Repository`,1),mc=r(`<!> <!> <!>`,1),hc=r(`<!> <span class="flex-1 truncate"> </span> <span class="text-[10px] tabular-nums text-muted-foreground"> </span>`,1),gc=r(`<!> <!>`,1);function _c(e,n){i(n,!0);let r=V(!1);de(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),F(r,!E(r)))};return globalThis.addEventListener(`keydown`,e),()=>globalThis.removeEventListener(`keydown`,e)});function o(e){F(r,!1),e()}var s=X(),l=q(s);a(l,()=>Fs,(e,n)=>{n(e,{get open(){return E(r)},set open(e){F(r,e,!0)},children:(e,n)=>{var r=gc(),i=q(r);a(i,()=>ic,(e,t)=>{t(e,{placeholder:`Search navigation and workspaces…`})});var s=z(i,2);a(s,()=>oc,(e,n)=>{n(e,{children:(e,n)=>{var r=mc(),i=q(r);a(i,()=>Ls,(e,t)=>{t(e,{children:(e,t)=>{oe();var n=C(`No matching destination.`);y(e,n)},$$slots:{default:!0}})});var s=z(i,2);a(s,()=>Bs,(e,t)=>{t(e,{heading:`Navigate`,children:(e,t)=>{var n=mc(),r=q(n);a(r,()=>Gs,(e,t)=>{t(e,{onSelect:()=>o(()=>ge(`/workspaces`)),value:`go workspaces manage locations`,children:(e,t)=>{var n=dc();uc(q(n),{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var i=z(r,2);a(i,()=>Gs,(e,t)=>{t(e,{onSelect:()=>o(()=>ge(`/creator`)),value:`go creator new skill`,children:(e,t)=>{var n=fc();cc(q(n),{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})});var s=z(i,2);a(s,()=>Gs,(e,t)=>{t(e,{onSelect:()=>o(()=>ge(`/repository`)),value:`go repository browse remote`,children:(e,t)=>{var n=pc(),r=q(n);Ee(r,{class:`h-4 w-4`}),oe(),y(e,n)},$$slots:{default:!0}})}),y(e,n)},$$slots:{default:!0}})});var l=z(s,2),u=e=>{var n=X(),r=q(n);a(r,()=>Bs,(e,n)=>{n(e,{heading:`Workspaces`,children:(e,n)=>{var r=X(),i=q(r);t(i,17,()=>jt.workspaces,e=>e.id,(e,t)=>{var n=X(),r=q(n);{let e=I(()=>`workspace ${E(t).label} ${E(t).path}`);a(r,()=>Gs,(n,r)=>{r(n,{get value(){return E(e)},onSelect:()=>o(()=>ge(Nt(E(t)))),children:(e,n)=>{var r=hc(),i=q(r);Vn(i,{class:`h-4 w-4`});var a=z(i,2),o=M(a,!0),s=z(a,2),l=M(s,!0);H(()=>{c(o,E(t).label),c(l,E(t).skillCount??0)}),y(e,r)},$$slots:{default:!0}})})}y(e,n)}),y(e,r)},$$slots:{default:!0}})}),y(e,n)};h(l,e=>{jt.workspaces.length>0&&e(u)}),y(e,r)},$$slots:{default:!0}})}),y(e,r)},$$slots:{default:!0}})}),y(e,s),x()}var vc=r(`<button class="text-xs font-medium text-primary hover:underline"> </button>`),yc=r(`<div class="pointer-events-auto flex items-center gap-3 rounded-md border border-border bg-popover px-4 py-2.5 text-sm"><span class="flex-1 text-foreground"> </span> <!> <button class="text-muted-foreground hover:text-foreground" aria-label="Dismiss notification" title="Dismiss notification"><!></button></div>`),bc=r(`<div class="pointer-events-none fixed bottom-4 right-4 z-50 flex flex-col gap-2" aria-live="polite" aria-relevant="additions text"></div>`);function xc(e,r){i(r,!1),te();var a=bc();t(a,5,()=>Pn,e=>e.id,(e,t)=>{var r=yc(),i=W(r),a=M(i,!0),o=z(i,2),s=e=>{var n=vc(),r=M(n,!0);H(()=>c(r,E(t).action.label)),l(`click`,n,()=>{E(t).action.run(),In(E(t).id)}),y(e,n)};h(o,e=>{E(t).action&&e(s)});var u=z(o,2),d=W(u);Ln(d,{class:`h-3.5 w-3.5`}),n(u),n(r),H(()=>c(a,E(t).message)),l(`click`,u,()=>In(E(t).id)),y(e,r)}),n(a),y(e,a),x()}T([`click`]);var Sc=new Set([`$$slots`,`$$events`,`$$legacy`,`delayDuration`]);function Cc(e,t){let n=k(t,`delayDuration`,3,0),r=U(t,Sc);var i=X(),o=q(i);a(o,()=>xs,(e,t)=>{t(e,K({get delayDuration(){return n()}},()=>r))}),y(e,i)}var wc=()=>navigator.opentrayWindow??navigator.opentray?.window??void 0,Tc={width:960,height:680},Ec={width:1100,height:760};async function Dc(e){let t=wc();if(t?.resizeTo&&t.getBounds)try{let n=await t.getBounds(),r=Math.max(n.width,e.width),i=Math.max(n.height,e.height);if(r===n.width&&i===n.height)return;await t.resizeTo(r,i)}catch{}}var Oc=new Set([`$$slots`,`$$events`,`$$legacy`]);function kc(e,t){let n=U(t,Oc),r=[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`}]];ye(e,K({name:`command`},()=>n,{get iconNode(){return r}}))}var Ac=new Set([`$$slots`,`$$events`,`$$legacy`]);function jc(e,t){let n=U(t,Ac),r=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];ye(e,K({name:`settings`},()=>n,{get iconNode(){return r}}))}var Mc=r(`<option>New session…</option>`),Nc=r(`<option>No sessions</option>`),Pc=r(`<option> </option>`),Fc=r(`<button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground" title="New session" aria-label="New session"><!></button>`),Ic=r(`<header class="flex h-10 shrink-0 items-center gap-1 border-b border-border px-2"><span class="px-1 text-xs font-medium text-muted-foreground">Agent</span> <select class="h-8 min-w-0 flex-1 rounded-md border border-border bg-transparent px-2 py-0 text-xs" aria-label="Session"><!><!><!></select> <!> <button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground" title="Close panel" aria-label="Close panel"><!></button></header>`);function Lc(e,r){i(r,!0);let a=I(()=>{let e=Me.sessions.find(e=>e.sessionId===ze.sessionId);return e?`${e.title||e.sessionId} (${e.status})`:void 0});var o=Ic(),s=z(W(o),2),u=W(s),d=e=>{var t=Mc();t.value=t.__value=``,y(e,t)};h(u,e=>{ze.sessionId===null&&e(d)});var f=z(u),p=e=>{var t=Nc();t.value=t.__value=``,y(e,t)};h(f,e=>{Me.sessions.length===0&&ze.sessionId!==null&&e(p)});var m=z(f);t(m,17,()=>Me.sessions,e=>e.sessionId,(e,t)=>{var n=Pc(),r=M(n),i={};H(e=>{c(r,`${e??``}
|
|
3
|
-
${E(t).status===`disposed`?`· ended`:`· ${E(t).status}`}`),i!==(i=E(t).sessionId)&&(n.value=(n.__value=i)??``)},[()=>E(t).title||E(t).sessionId.slice(0,14)]),y(e,n)}),n(s);var g;fe(s);var _=z(s,2),v=e=>{var t=Fc(),r=W(t);Hn(r,{class:`h-4 w-4`}),n(t),l(`click`,t,()=>qe()),y(e,t)};h(_,e=>{ze.sessionId&&e(v)});var b=z(_,2),S=W(b);Ln(S,{class:`h-4 w-4`}),n(b),n(o),H(()=>{B(s,`title`,E(a)),g!==(g=ze.sessionId??``)&&(s.value=(s.__value=g)??``,he(s,g))}),l(`change`,s,e=>Re(e.currentTarget.value)),l(`click`,b,()=>Xe(!1)),y(e,o),x()}T([`change`,`click`]);var Rc=new Set([`$$slots`,`$$events`,`$$legacy`]);function zc(e,t){let n=U(t,Rc),r=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]];ye(e,K({name:`copy`},()=>n,{get iconNode(){return r}}))}var Bc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vc(e,t){let n=U(t,Bc),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}]];ye(e,K({name:`file`},()=>n,{get iconNode(){return r}}))}var Hc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Uc(e,t){let n=U(t,Hc),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}]];ye(e,K({name:`image`},()=>n,{get iconNode(){return r}}))}var Wc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gc(e,t){let n=U(t,Wc),r=[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]];ye(e,K({name:`arrow-down`},()=>n,{get iconNode(){return r}}))}var Kc=r(`<div class="text-[11px] font-medium text-muted-foreground"> </div>`),qc=r(`<div class="whitespace-pre-wrap text-[11px] text-muted-foreground"> </div>`),Jc=r(`<span class="block text-[10px] text-muted-foreground"> </span>`),Yc=r(`<button> <!></button>`),Xc=r(`<div class="flex flex-wrap gap-1.5"></div>`),Zc=r(`<div class="mb-2 space-y-1.5"><!> <div class="whitespace-pre-wrap"> </div> <!> <!> <!></div>`),Qc=r(`<div class="flex justify-end"><!></div>`),$c=r(`<div class="rounded-lg border border-amber-500/40 bg-amber-500/5 px-3 py-2.5 text-xs" role="group"><div class="mb-2 flex items-center gap-1.5 font-medium text-amber-600 dark:text-amber-400"> </div> <!> <!></div>`);function el(e,r){i(r,!0);let a=J({}),o=J({});function s(e,t){let n=a[e.id]??[];e.multiSelect?a[e.id]=n.includes(t)?n.filter(e=>e!==t):[...n,t]:a[e.id]=n.includes(t)?[]:[t]}function u(){return r.questions.every(e=>(a[e.id]??[]).length>0||(o[e.id]??``).trim().length>0)}function d(){Ge(r.seq,r.questions.map(e=>({id:e.id,selected:a[e.id]??[],custom:(o[e.id]??``).trim()||void 0})))}var f=$c(),p=W(f),m=M(p,!0),g=z(p,2);t(g,17,()=>r.questions,e=>e.id,(e,i)=>{var u=Zc(),d=W(u),f=e=>{var t=Kc(),n=M(t,!0);H(()=>c(n,E(i).header)),y(e,t)};h(d,e=>{E(i).header&&e(f)});var p=z(d,2),m=M(p,!0),g=z(p,2),_=e=>{var t=qc(),n=M(t,!0);H(()=>c(n,E(i).detail)),y(e,t)};h(g,e=>{E(i).detail&&e(_)});var v=z(g,2),b=e=>{var o=Xc();t(o,21,()=>E(i).options,e=>e.label,(e,t)=>{var o=Yc(),u=W(o),d=z(u),f=e=>{var n=Jc(),r=M(n,!0);H(()=>c(r,E(t).description)),y(e,n)};h(d,e=>{E(t).description&&e(f)}),n(o),H((e,n)=>{Y(o,1,`rounded-md border px-2 py-1 transition-colors ${e??``}`),o.disabled=r.resolved,B(o,`aria-pressed`,n),c(u,`${E(t).label??``} `)},[()=>(a[E(i).id]??[]).includes(E(t).label)?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`,()=>(a[E(i).id]??[]).includes(E(t).label)]),l(`click`,o,()=>s(E(i),E(t).label)),y(e,o)}),n(o),y(e,o)};h(v,e=>{E(i).options&&E(i).options.length>0&&e(b)});var x=z(v,2);{let e=I(()=>o[E(i).id]??``);zn(x,{placeholder:`Custom answer (optional)`,get disabled(){return r.resolved},get value(){return E(e)},onchange:e=>o[E(i).id]=e.currentTarget.value,class:`h-7 text-xs`,get"aria-label"(){return`Custom answer for ${E(i).question??``}`}})}n(u),H(()=>c(m,E(i).question)),y(e,u)});var _=z(g,2),v=e=>{var t=Qc(),r=W(t);{let e=I(()=>!u());An(r,{size:`sm`,get disabled(){return E(e)},onclick:d,children:(e,t)=>{oe();var n=C(`Submit answer`);y(e,n)},$$slots:{default:!0}})}n(t),y(e,t)};h(_,e=>{r.resolved||e(v)}),n(f),H(()=>{B(f,`aria-label`,r.resolved?`Answered question`:`Pending question`),c(m,r.resolved?`Answered`:`Your decision`)}),y(e,f),x()}T([`click`]);var tl=new Set([`$$slots`,`$$events`,`$$legacy`]);function nl(e,t){let n=U(t,tl),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];ye(e,K({name:`terminal`},()=>n,{get iconNode(){return r}}))}var rl=new Set([`$$slots`,`$$events`,`$$legacy`]);function il(e,t){let n=U(t,rl),r=[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`}]];ye(e,K({name:`wrench`},()=>n,{get iconNode(){return r}}))}var al=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-destructive" title="Tool error" aria-label="Tool error"></span>`),ol=r(`<button type="button" class="disclosure-row"><span class="flex items-center justify-center text-muted-foreground" aria-hidden="true"><!></span> <span class="flex items-center gap-1 overflow-hidden"><span class="max-w-40 truncate text-left font-medium text-foreground"> </span> <!></span> <span class="text-center text-muted-foreground/70" aria-hidden="true">·</span> <span> </span> <!></button>`);function sl(e,t){i(t,!0);let r=k(t,`summary`,3,``),o=k(t,`open`,3,!1),s=k(t,`running`,3,!1),u=k(t,`error`,3,!1);var d=ol(),f=W(d),p=W(f);a(p,()=>t.icon,(e,t)=>{t(e,{class:`h-3.5 w-3.5`})}),n(f);var m=z(f,2),g=W(m),_=M(g,!0),v=z(g,2),b=e=>{var t=al();y(e,t)};h(v,e=>{u()&&e(b)}),n(m);var S=z(m,4),C=M(S,!0),w=z(S,2);qn(w,{class:`disclosure-chevron h-3.5 w-3.5 shrink-0 text-muted-foreground`}),n(d),H(()=>{B(d,`data-open`,o()),B(d,`aria-expanded`,o()),B(d,`title`,r().length>0?`${t.title} · ${r()}`:t.title),c(_,t.title),Y(S,1,`disclosure-summary ${s()?`sweep`:``}`),c(C,r())}),l(`click`,d,function(...e){t.onToggle?.apply(this,e)}),y(e,d),x()}T([`click`]);var cl=r(`<iframe sandbox="allow-scripts"></iframe>`),ll=r(`<div class="px-3 py-2 text-[11px] text-muted-foreground"> </div>`),ul=r(`<div class="px-3 py-2 text-[11px] text-muted-foreground" role="status">Loading card…</div>`),dl=r(`<div class="my-1 overflow-hidden rounded-lg border border-border"><!></div>`);function fl(e,t){i(t,!0);let r=V(null),a=V(!1),o=V(null),s=V(null);de(()=>{let e=t.resourceUri;F(r,null),F(a,!1),Tt().agent.card.get({uri:e}).then(e=>{if(e.html===null){F(a,!0);return}F(r,e.html,!0)}).catch(()=>{F(a,!0)})});function l(e){let t=e.data;if(typeof t==`object`&&t&&t.source===`skill-creator-card`&&E(s)!==null&&e.source===E(s).contentWindow){if(t.type===`ui/navigate`&&typeof t.intent==`string`&&t.intent.startsWith(`/`)&&!t.intent.startsWith(`//`)){ge(t.intent);return}if(t.type===`ui/resize`){let e=Number(t.height);Number.isFinite(e)&&e>0&&F(o,Math.min(400,Math.max(40,Math.ceil(e))),!0)}}}function u(e,t){return e.srcdoc=t,{update(t){e.srcdoc=t}}}var p=dl();f(`message`,A,l);var m=W(p),g=e=>{var n=cl();se(n,e=>F(s,e),()=>E(s)),pe(n,(e,t)=>u?.(e,t),()=>E(r)),H(()=>{B(n,`title`,t.title),Y(n,1,`w-full border-0 bg-transparent ${E(o)===null?`h-44`:``}`),j(n,E(o)===null?void 0:`height:${E(o)}px`)}),d(n),y(e,n)},_=e=>{var n=ll(),r=M(n);H(()=>c(r,`Card unavailable: ${t.title??``}`)),y(e,n)},v=e=>{var t=ul();y(e,t)};h(m,e=>{E(r)===null?E(a)?e(_,1):e(v,-1):e(g)}),n(p),H(()=>B(p,`data-card-uri`,t.resourceUri)),y(e,p),x()}var pl=r(`<div class="mt-2 flex justify-end gap-1.5"><!> <!></div>`),ml=r(`<div class="rounded-lg border border-amber-500/40 bg-amber-500/5 px-3 py-2.5 text-xs" role="group" aria-label="Mutation proposal"><div class="mb-1.5 flex items-center gap-1.5 font-medium text-amber-600 dark:text-amber-400"> </div> <div class="font-mono text-[11px]"> </div> <pre class="mt-1 max-h-32 overflow-auto rounded bg-muted/40 p-1.5 font-mono text-[10px] whitespace-pre-wrap"> </pre> <!></div>`);function hl(e,t){i(t,!0);let r=V(!1),a=V(null),o=I(()=>E(a)??t.status),s=I(()=>{try{return JSON.stringify(t.input,null,2)}catch{return String(t.input)}});async function l(e){F(r,!0);try{let n=Tt(),r=e===`approve`?await n.agent.proposals.approve({proposalId:t.proposalId}):await n.agent.proposals.reject({proposalId:t.proposalId});F(a,r.proposal.status,!0),Mn(e===`approve`?E(o)===`executed`?`Proposal executed: ${t.capability}`:`Proposal failed: ${t.capability}`:`Proposal rejected: ${t.capability}`)}catch(e){Mn(e instanceof Error?e.message:String(e))}finally{F(r,!1)}}var u=ml(),d=W(u),f=M(d),p=z(d,2),m=M(p,!0),g=z(p,2),_=M(g,!0),v=z(g,2),b=e=>{var t=pl(),i=W(t);An(i,{size:`sm`,variant:`outline`,get disabled(){return E(r)},onclick:()=>void l(`reject`),children:(e,t)=>{oe();var n=C(`Reject`);y(e,n)},$$slots:{default:!0}});var a=z(i,2);An(a,{size:`sm`,get disabled(){return E(r)},onclick:()=>void l(`approve`),children:(e,t)=>{oe();var n=C(`Approve`);y(e,n)},$$slots:{default:!0}}),n(t),y(e,t)};h(v,e=>{E(o)===`pending`&&e(b)}),n(u),H(()=>{c(f,`Proposal — ${E(o)??``}`),c(m,t.capability),c(_,E(s))}),y(e,u),x()}var gl=lt(dt(),st()),_l=bt([dt(),ut({content:ct(ut({text:dt().optional()}).loose()).optional()}).loose(),lt(dt(),st())]),vl=ut({kind:pt(`proposed`),proposalId:dt().min(1),capability:dt().optional(),status:dt().optional()}),yl=ut({uiCard:ut({resourceUri:dt().min(1),title:dt().optional()})}),bl=ut({content:ct(st()).optional()}),xl=ut({text:dt().optional()}),Sl=ut({status:dt().optional()}),Cl=ut({error:dt().min(1).optional()});function wl(e){if(e===void 0||e.length===0)return null;try{let t=JSON.parse(e),n=gl.safeParse(t);return n.success?n.data:null}catch{let t={};for(let n of[`command`,`description`,`file_path`,`path`,`pattern`,`url`,`query`]){let r=e.match(RegExp(`"${n}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)"`))??e.match(RegExp(`"${n}"\\s*:\\s*"((?:[^"\\\\]|\\.)*)$`));r&&(t[n]=r[1])}return Object.keys(t).length>0?t:null}}function Tl(e){if(e===void 0)return``;let t=_l.safeParse(e);if(t.success){let e=t.data;if(typeof e==`string`)return e;if(Array.isArray(e.content)){let t=[];for(let n of e.content)typeof n.text==`string`&&t.push(n.text);if(t.length>0)return t.join(`
|
|
4
|
-
`)}}try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}function El(e,t){if(e===void 0)return null;let n=vl.safeParse(e);return n.success?{proposalId:n.data.proposalId,capability:n.data.capability??t,status:n.data.status??`pending`}:null}function Dl(e){if(e===void 0)return null;let t=[e],n=bl.safeParse(e);if(n.success&&n.data.content!==void 0)for(let e of n.data.content){let n=xl.safeParse(e);n.success&&typeof n.data.text==`string`&&t.push(n.data.text)}for(let e of t)if(typeof e==`string`)try{let t=JSON.parse(e),n=yl.safeParse(t);if(n.success)return{resourceUri:n.data.uiCard.resourceUri,title:n.data.uiCard.title??`Card`}}catch{}return null}function Ol(e){if(!Array.isArray(e))return null;let t=0;for(let n of e){let e=Sl.safeParse(n);e.success&&e.data.status===`completed`&&(t+=1)}let n=e.length;return`${n} todo${n===1?``:`s`} · ${t} done`}function kl(e,t){let n=Cl.safeParse(e);if(n.success&&n.data.error!==void 0)return(n.data.error.split(`
|
|
5
|
-
`,1)[0]??``).trim();let r=(t.split(`
|
|
6
|
-
`,1)[0]??``).trim();return r.length>80?`${r.slice(0,80)}…`:r}function Al(e){return/^\+(?![-+])/.test(e)?`bg-emerald-500/10`:/^-(?![-+])/.test(e)?`bg-rose-500/10`:``}var jl=r(`<div class="mt-1 rounded-lg bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive"> </div>`),Ml=r(`<span class="sweep px-1">running</span>`),Nl=r(`<div class="tool-card mt-1 overflow-hidden border-border bg-[#0c1016] text-zinc-200"><div class="flex items-center justify-between px-2 py-1 text-[10px] text-zinc-400"><span> </span> <!></div> <pre class="max-h-[260px] overflow-auto border-t border-white/10 px-2 py-1.5 whitespace-pre-wrap"> </pre></div>`),Pl=r(`<span> </span>`),Fl=r(`<div class="tool-card mt-1 overflow-hidden"><div class="truncate border-b border-border px-2 py-1 text-[10px] text-muted-foreground"> </div> <div class="max-h-[150px] overflow-auto px-2 py-1.5 whitespace-pre-wrap"></div></div>`),Il=r(`<div class="tool-card mt-1 overflow-hidden"><div class="border-b border-border px-2 py-1 text-[10px] text-muted-foreground"> </div> <pre class="max-h-[150px] overflow-auto px-2 py-1.5 whitespace-pre-wrap"> </pre></div>`),Ll=r(`<div class="tool-card max-h-[150px] overflow-auto"><div class="sticky top-0 bg-muted px-2 py-1 text-[10px] text-muted-foreground">Input</div> <pre class="px-2 py-1.5 whitespace-pre-wrap"> </pre></div>`),Rl=r(`<div class="tool-card max-h-[150px] overflow-auto"><div class="sticky top-0 bg-muted px-2 py-1 text-[10px] text-muted-foreground">Output</div> <pre class="px-2 py-1.5 whitespace-pre-wrap"> </pre></div>`),zl=r(`<div class="tool-card sweep px-2 py-1.5 text-muted-foreground">running…</div>`),Bl=r(`<div class="mt-1 space-y-1"><!> <!></div>`),Vl=r(`<!> <!>`,1),Hl=r(`<div class="flow-item"><!> <!> <!></div>`);function Ul(e,r){i(r,!0);let a=k(r,`running`,3,!1),o=V(!1),s=I(()=>r.toolName.replace(/^mcp__[^_]+__/,``)),l=I(()=>{let e=r.toolName.toLowerCase();return e.includes(`bash`)||e.includes(`shell`)||e.includes(`terminal`)?`bash`:/read|write|edit|file|glob|grep/.test(e)?`file`:e.includes(`image`)?`image`:`generic`}),u=I(()=>E(l)===`bash`?nl:E(l)===`file`?Rn:E(l)===`image`?Uc:il),d=I(()=>wl(r.argsText)),f=e=>typeof e==`string`?e:``;function p(e){return(e.split(`
|
|
7
|
-
`,1)[0]??``).trim()}let m=I(()=>{let e=E(d);if(E(l)===`bash`){let t=f(e?.description);if(t.length>0)return t;let n=f(e?.command);return n.length>0?p(n):``}if(E(l)===`file`){let t=f(e?.file_path)||f(e?.path);if(t.length>0)return t}let t=Ol(e?.todos);if(t!==null)return t;if(e!==null){for(let t of Object.values(e))if(typeof t==`string`&&t.length>0)return t.length>64?`${t.slice(0,64)}…`:t;let t=(()=>{try{return JSON.stringify(e)}catch{return``}})();if(t.length>0)return t.length>64?`${t.slice(0,64)}…`:t}return``}),g=I(()=>Tl(r.result)),_=I(()=>r.phase===`error`?kl(r.result,E(g)):``),v=I(()=>El(r.result,r.toolName)),S=I(()=>Dl(r.result)),C=I(()=>{if(r.argsText===void 0||r.argsText.length===0)return``;try{let e=JSON.parse(r.argsText);return JSON.stringify(e,null,2)??r.argsText}catch{return r.argsText}}),w=I(()=>(E(g).length>0?E(g):E(C)).split(`
|
|
8
|
-
`)),T=I(()=>{if(r.startedAt===void 0||r.endedAt===void 0)return``;let e=Date.parse(r.endedAt)-Date.parse(r.startedAt);return!Number.isFinite(e)||e<0?``:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}),D=I(()=>{let e=[E(s)];return E(T)&&e.push(E(T)),r.phase===`error`&&e.push(`error`),e.join(` · `)});var O=Hl(),A=W(O),j=e=>{hl(e,{get proposalId(){return E(v).proposalId},get capability(){return E(v).capability},get input(){return r.result},get status(){return E(v).status}})},ee=e=>{fl(e,{get resourceUri(){return E(S).resourceUri},get title(){return E(S).title}})};h(A,e=>{E(v)?e(j):E(S)&&e(ee,1)});var te=z(A,2);{let e=I(()=>a()&&r.phase===`calling`),t=I(()=>r.phase===`error`);sl(te,{get icon(){return E(u)},get title(){return E(s)},get summary(){return E(m)},get open(){return E(o)},get running(){return E(e)},get error(){return E(t)},onToggle:()=>F(o,!E(o))})}var N=z(te,2),P=e=>{var i=Vl(),o=q(i),s=e=>{var t=jl(),n=M(t,!0);H(()=>c(n,E(_))),y(e,t)};h(o,e=>{r.phase===`error`&&E(_).length>0&&e(s)});var u=z(o,2),p=e=>{let t=I(()=>f(E(d)?.command));var i=Nl(),o=W(i),s=W(o),l=M(s,!0),u=z(s,2),p=e=>{var t=Ml();y(e,t)};h(u,e=>{a()&&r.phase===`calling`&&e(p)}),n(o);var m=z(o,2),_=M(m,!0);n(i),H(()=>{c(l,E(D)),c(_,E(t).length>0?`$ ${E(t)}${E(g).length>0?`\n\n${E(g)}`:``}`:E(g))}),y(e,i)},m=e=>{var r=Fl(),i=W(r),a=M(i,!0),o=z(i,2);t(o,21,()=>E(w),ie,(e,t,n)=>{var r=Pl(),i=M(r);H(e=>{Y(r,1,e),c(i,`${E(t)??``}${n<E(w).length-1?`
|
|
9
|
-
`:``}`)},[()=>b(Al(E(t)))]),y(e,r)}),n(o),n(r),H(e=>c(a,e),[()=>f(E(d)?.file_path)||f(E(d)?.path)||E(D)]),y(e,r)},v=e=>{var t=Il(),r=W(t),i=M(r,!0),a=z(r,2),o=M(a,!0);n(t),H(()=>{c(i,E(D)),c(o,E(C)||E(g))}),y(e,t)},x=e=>{var t=Bl(),i=W(t),a=e=>{var t=Ll(),r=z(W(t),2),i=M(r,!0);n(t),H(()=>c(i,E(C))),y(e,t)};h(i,e=>{E(C).length>0&&e(a)});var o=z(i,2),s=e=>{var t=Rl(),r=z(W(t),2),i=M(r,!0);n(t),H(()=>c(i,E(g))),y(e,t)},l=e=>{var t=zl();y(e,t)};h(o,e=>{E(g).length>0?e(s):r.phase===`calling`&&e(l,1)}),n(t),y(e,t)};h(u,e=>{E(l)===`bash`?e(p):E(l)===`file`?e(m,1):E(l)===`image`?e(v,2):e(x,-1)}),y(e,i)};h(N,e=>{E(o)&&e(P)}),n(O),y(e,O),x()}function Wl(e){return Number.isFinite(e)?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function Gl(e){return!Number.isFinite(e)||e<0?``:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}var Kl=Object.create,ql=Object.defineProperty,Jl=Object.getOwnPropertyDescriptor,Yl=Object.getOwnPropertyNames,Xl=Object.getPrototypeOf,Zl=Object.prototype.hasOwnProperty,Ql=(e,t)=>function(){return t||(0,e[Yl(e)[0]])((t={exports:{}}).exports,t),t.exports},$l=e=>{let t={};for(var n in e)ql(t,n,{get:e[n],enumerable:!0});return t},eu=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Yl(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Zl.call(e,s)&&s!==n&&ql(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Jl(t,s))||r.enumerable});return e},tu=(e,t,n)=>(n=e==null?{}:Kl(Xl(e)),eu(t||!e||!e.__esModule?ql(n,`default`,{value:e,enumerable:!0}):n,e));function nu(e,t,n,r){let i=Number(e[t].meta.id+1).toString(),a=``;return typeof r.docId==`string`&&(a=`-${r.docId}-`),a+i}function ru(e,t){let n=Number(e[t].meta.id+1).toString();return e[t].meta.subId>0&&(n+=`:${e[t].meta.subId}`),`[${n}]`}function iu(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i),o=i.rules.footnote_caption(e,t,n,r,i),s=a;return e[t].meta.subId>0&&(s+=`:${e[t].meta.subId}`),`<sup class="footnote-ref"><a href="#fn${a}" id="fnref${s}">${o}</a></sup>`}function au(e,t,n){return(n.xhtmlOut?`<hr class="footnotes-sep" />
|
|
10
|
-
`:`<hr class="footnotes-sep">
|
|
11
|
-
`)+`<section class="footnotes">
|
|
12
|
-
<ol class="footnotes-list">
|
|
13
|
-
`}function ou(){return`</ol>
|
|
14
|
-
</section>
|
|
15
|
-
`}function su(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i);return e[t].meta.subId>0&&(a+=`:${e[t].meta.subId}`),`<li id="fn${a}" class="footnote-item">`}function cu(){return`</li>
|
|
16
|
-
`}function lu(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i);return e[t].meta.subId>0&&(a+=`:${e[t].meta.subId}`),` <a href="#fnref${a}" class="footnote-backref">\u21a9\uFE0E</a>`}function uu(e){let t=e.helpers.parseLinkLabel,n=e.utils.isSpace;e.renderer.rules.footnote_ref=iu,e.renderer.rules.footnote_block_open=au,e.renderer.rules.footnote_block_close=ou,e.renderer.rules.footnote_open=su,e.renderer.rules.footnote_close=cu,e.renderer.rules.footnote_anchor=lu,e.renderer.rules.footnote_caption=ru,e.renderer.rules.footnote_anchor_name=nu;function r(e,t,r,i){let a=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(a+4>o||e.src.charCodeAt(a)!==91||e.src.charCodeAt(a+1)!==94)return!1;let s;for(s=a+2;s<o;s++){if(e.src.charCodeAt(s)===32)return!1;if(e.src.charCodeAt(s)===93)break}if(s===a+2||s+1>=o||e.src.charCodeAt(++s)!==58)return!1;if(i)return!0;s++,e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.refs||(e.env.footnotes.refs={});let c=e.src.slice(a+2,s-2);e.env.footnotes.refs[`:${c}`]=-1;let l=new e.Token(`footnote_reference_open`,``,1);l.meta={label:c},l.level=e.level++,e.tokens.push(l);let u=e.bMarks[t],d=e.tShift[t],f=e.sCount[t],p=e.parentType,m=s,h=e.sCount[t]+s-(e.bMarks[t]+e.tShift[t]),g=h;for(;s<o;){let t=e.src.charCodeAt(s);if(n(t))t===9?g+=4-g%4:g++;else break;s++}e.tShift[t]=s-m,e.sCount[t]=g-h,e.bMarks[t]=m,e.blkIndent+=4,e.parentType=`footnote`,e.sCount[t]<e.blkIndent&&(e.sCount[t]+=e.blkIndent),e.md.block.tokenize(e,t,r,!0),e.parentType=p,e.blkIndent-=4,e.tShift[t]=d,e.sCount[t]=f,e.bMarks[t]=u;let _=new e.Token(`footnote_reference_close`,``,-1);return _.level=--e.level,e.tokens.push(_),!0}function i(e,n){let r=e.posMax,i=e.pos;if(i+2>=r||e.src.charCodeAt(i)!==94||e.src.charCodeAt(i+1)!==91)return!1;let a=i+2,o=t(e,i+1);if(o<0)return!1;if(!n){e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.list||(e.env.footnotes.list=[]);let t=e.env.footnotes.list.length,n=[];e.md.inline.parse(e.src.slice(a,o),e.md,e.env,n);let r=e.push(`footnote_ref`,``,0);r.meta={id:t},e.env.footnotes.list[t]={content:e.src.slice(a,o),tokens:n}}return e.pos=o+1,e.posMax=r,!0}function a(e,t){let n=e.posMax,r=e.pos;if(r+3>n||!e.env.footnotes||!e.env.footnotes.refs||e.src.charCodeAt(r)!==91||e.src.charCodeAt(r+1)!==94)return!1;let i;for(i=r+2;i<n;i++){if(e.src.charCodeAt(i)===32||e.src.charCodeAt(i)===10)return!1;if(e.src.charCodeAt(i)===93)break}if(i===r+2||i>=n)return!1;i++;let a=e.src.slice(r+2,i-1);if(e.env.footnotes.refs[`:${a}`]===void 0)return!1;if(!t){e.env.footnotes.list||(e.env.footnotes.list=[]);let t;e.env.footnotes.refs[`:${a}`]<0?(t=e.env.footnotes.list.length,e.env.footnotes.list[t]={label:a,count:0},e.env.footnotes.refs[`:${a}`]=t):t=e.env.footnotes.refs[`:${a}`];let n=e.env.footnotes.list[t].count;e.env.footnotes.list[t].count++;let r=e.push(`footnote_ref`,``,0);r.meta={id:t,subId:n,label:a}}return e.pos=i,e.posMax=n,!0}function o(e){let t,n,r,i=!1,a={};if(!e.env.footnotes||(e.tokens=e.tokens.filter(function(e){return e.type===`footnote_reference_open`?(i=!0,n=[],r=e.meta.label,!1):e.type===`footnote_reference_close`?(i=!1,a[`:`+r]=n,!1):(i&&n.push(e),!i)}),!e.env.footnotes.list))return;let o=e.env.footnotes.list;e.tokens.push(new e.Token(`footnote_block_open`,``,1));for(let n=0,r=o.length;n<r;n++){let r=new e.Token(`footnote_open`,``,1);if(r.meta={id:n,label:o[n].label},e.tokens.push(r),o[n].tokens){t=[];let r=new e.Token(`paragraph_open`,`p`,1);r.block=!0,t.push(r);let i=new e.Token(`inline`,``,0);i.children=o[n].tokens,i.content=o[n].content,t.push(i);let a=new e.Token(`paragraph_close`,`p`,-1);a.block=!0,t.push(a)}else o[n].label&&(t=a[`:${o[n].label}`]);t&&(e.tokens=e.tokens.concat(t));let i;i=e.tokens[e.tokens.length-1].type===`paragraph_close`?e.tokens.pop():null;let s=o[n].count>0?o[n].count:1;for(let t=0;t<s;t++){let r=new e.Token(`footnote_anchor`,``,0);r.meta={id:n,subId:t,label:o[n].label},e.tokens.push(r)}i&&e.tokens.push(i),e.tokens.push(new e.Token(`footnote_close`,``,-1))}e.tokens.push(new e.Token(`footnote_block_close`,``,-1))}e.block.ruler.before(`reference`,`footnote_def`,r,{alt:[`paragraph`,`reference`]}),e.inline.ruler.after(`image`,`footnote_inline`,i),e.inline.ruler.after(`footnote_inline`,`footnote_ref`,a),e.core.ruler.after(`inline`,`footnote_tail`,o)}function du(e){function t(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==43)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;if(a%2){let t=e.push(`text`,``,0);t.content=o,a--}for(let t=0;t<a;t+=2){let n=e.push(`text`,``,0);n.content=o+o,(i.can_open||i.can_close)&&e.delimiters.push({marker:r,length:0,jump:t/2,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function n(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==43||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`ins_open`,n.tag=`ins`,n.nesting=1,n.markup=`++`,n.content=``,n=e.tokens[o.token],n.type=`ins_close`,n.tag=`ins`,n.nesting=-1,n.markup=`++`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`+`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`ins_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}e.inline.ruler.before(`emphasis`,`ins`,t),e.inline.ruler2.before(`emphasis`,`ins`,function(e){let t=e.tokens_meta,r=(e.tokens_meta||[]).length;n(e,e.delimiters);for(let i=0;i<r;i++)t[i]&&t[i].delimiters&&n(e,t[i].delimiters)})}function fu(e){function t(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==61)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;if(a%2){let t=e.push(`text`,``,0);t.content=o,a--}for(let t=0;t<a;t+=2){let n=e.push(`text`,``,0);n.content=o+o,(i.can_open||i.can_close)&&e.delimiters.push({marker:r,length:0,jump:t/2,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function n(e,t){let n=[],r=t.length;for(let i=0;i<r;i++){let r=t[i];if(r.marker!==61||r.end===-1)continue;let a=t[r.end],o=e.tokens[r.token];o.type=`mark_open`,o.tag=`mark`,o.nesting=1,o.markup=`==`,o.content=``;let s=e.tokens[a.token];s.type=`mark_close`,s.tag=`mark`,s.nesting=-1,s.markup=`==`,s.content=``,e.tokens[a.token-1].type===`text`&&e.tokens[a.token-1].content===`=`&&n.push(a.token-1)}for(;n.length;){let t=n.pop(),r=t+1;for(;r<e.tokens.length&&e.tokens[r].type===`mark_close`;)r++;if(r--,t!==r){let n=e.tokens[r];e.tokens[r]=e.tokens[t],e.tokens[t]=n}}}e.inline.ruler.before(`emphasis`,`mark`,t),e.inline.ruler2.before(`emphasis`,`mark`,function(e){let t,r=e.tokens_meta,i=(e.tokens_meta||[]).length;for(n(e,e.delimiters),t=0;t<i;t++)r[t]&&r[t].delimiters&&n(e,r[t].delimiters)})}var pu=/\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;function mu(e,t){let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==94||t||r+2>=n)return!1;e.pos=r+1;let i=!1;for(;e.pos<n;){if(e.src.charCodeAt(e.pos)===94){i=!0;break}e.md.inline.skipToken(e)}if(!i||r+1===e.pos)return e.pos=r,!1;let a=e.src.slice(r+1,e.pos);if(a.match(/(^|[^\\])(\\\\)*\s/))return e.pos=r,!1;e.posMax=e.pos,e.pos=r+1;let o=e.push(`sup_open`,`sup`,1);o.markup=`^`;let s=e.push(`text`,``,0);s.content=a.replace(pu,`$1`);let c=e.push(`sup_close`,`sup`,-1);return c.markup=`^`,e.pos=e.posMax+1,e.posMax=n,!0}function hu(e){e.inline.ruler.after(`emphasis`,`sup`,mu)}var gu=Ql({"../../node_modules/.pnpm/markdown-it-task-checkbox@1.0.6/node_modules/markdown-it-task-checkbox/index.js":((e,t)=>{t.exports=function(e,t){t=Object.assign({},{disabled:!0,divWrap:!1,divClass:`checkbox`,idPrefix:`cbx_`,ulClass:`task-list`,liClass:`task-list-item`},t),e.core.ruler.after(`inline`,`github-task-lists`,function(e){for(var o=e.tokens,s=0,c=2;c<o.length;c++)i(o,c)&&(a(o[c],s,t,e.Token),s+=1,n(o[c-2],`class`,t.liClass),n(o[r(o,c-2)],`class`,t.ulClass))})};function n(e,t,n){var r=e.attrIndex(t),i=[t,n];r<0?e.attrPush(i):e.attrs[r]=i}function r(e,t){for(var n=e[t].level-1,r=t-1;r>=0;r--)if(e[r].level===n)return r;return-1}function i(e,t){return d(e[t])&&f(e[t-1])&&p(e[t-2])&&m(e[t])}function a(e,t,n,r){var i=n.idPrefix+t;e.children[0].content=e.children[0].content.slice(3),e.children.unshift(s(i,r)),e.children.push(c(r)),e.children.unshift(o(e,i,n,r)),n.divWrap&&(e.children.unshift(l(n,r)),e.children.push(u(r)))}function o(e,t,n,r){var i=new r(`checkbox_input`,`input`,0);return i.attrs=[[`type`,`checkbox`],[`id`,t]],/^\[[xX]\][ \u00A0]/.test(e.content)===!0&&i.attrs.push([`checked`,`true`]),n.disabled===!0&&i.attrs.push([`disabled`,`true`]),i}function s(e,t){var n=new t(`label_open`,`label`,1);return n.attrs=[[`for`,e]],n}function c(e){return new e(`label_close`,`label`,-1)}function l(e,t){var n=new t(`checkbox_open`,`div`,0);return n.attrs=[[`class`,e.divClass]],n}function u(e){return new e(`checkbox_close`,`div`,-1)}function d(e){return e.type===`inline`}function f(e){return e.type===`paragraph_open`}function p(e){return e.type===`list_item_open`}function m(e){return/^\[[xX \u00A0]\][ \u00A0]/.test(e.content)}})}),_u=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function vu(e){return e>=55296&&e<=57343||e>1114111?65533:_u.get(e)??e}function yu(e){let t=atob(e),n=t.length&-2,r=new Uint16Array(n/2);for(let e=0,i=0;e<n;e+=2){let n=t.charCodeAt(e),a=t.charCodeAt(e+1);r[i++]=n|a<<8}return r}var bu=yu(`QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBRAFKAU0B8iFvbgxhZABpAGwAO4DHAMdAcgBjAAhhbiJpbnQAAKAwIm8AdAAKYQABZG5ZAV0BaSJsbGEAuGB0I2VyRG90ALdg8gA5AWkAp2NyImNsZQAAAkRNUFRwAXQBeQF9AW8AdAAAoJkiaSJudXMAAKCWIuwhdXMAoJUiaSJtZXMAAKCXIm8AAAFjc4cBlAFrKndpc2VDb250b3VySW50ZWdyYWwAAKAyImUjQ3VybHkAAAFEUZwBpAFvJXVibGVRdW90ZQAAoB0gdSJvdGUAAKAZIAACbG5wdbABtgHNAdgBbwBuAGWgNyIAoHQqgAFnaXQAvAHBAcUB8iJ1ZW50AKBhIm4AdAAAoC8i7yV1ckludGVncmFsAKAuIgABZnLRAdMBAKACIe8iZHVjdACgECJuLnRlckNsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbAAAoDMi7yFzcwCgLypjAHIAAOA12J7ccABDoNMiYQBwAACgTSKABURKU1phY2VmaW9zAAsCEgIVAhgCGwIsAjQCOQI9AnMCfwNvoEUh9CJyYWhkAKARKWMAeQACZGMAeQAFZGMAeQAPZIABZ3JzACECJQIoAuchZXIAoCEgcgAAoKEhaAB2AACg5CoAAWF5MAIzAvIhb24OYRRkbAB0oAciYQCUY3IAAOA12AfdAAFhZkECawIAAWNtRQJnAvIjaXRpY2FsAAJBREdUUAJUAl8CYwJjInV0ZQC0YG8AdAFZAloC2WJiJGxlQWN1dGUA3WJyImF2ZQBgYGkibGRlANxi7yFuZACgxCJmJWVyZW50aWFsRAAAoEYhcAR9AgAAAAAAAIECjgIAABoDZgAA4DXYO91EoagAhQKJAm8AdAAAoNwgcSJ1YWwAAKBQIuIhbGUAA0NETFJVVpkCqAK1Au8C/wIRA28AbgB0AG8AdQByAEkAbgB0AGUAZwByAGEA7ADEAW8AdAKvAgAAAACwAqhgbiNBcnJvdwAAoNMhAAFlb7kC0AJmAHQAgAFBUlQAwQLGAs0CciJyb3cAAKDQIekkZ2h0QXJyb3cAoNQhZQDlACsCbgBnAAABTFLWAugC5SFmdAABQVLcAuECciJyb3cAAKD4J+kkZ2h0QXJyb3cAoPon6SRnaHRBcnJvdwCg+SdpImdodAAAAUFU9gL7AnIicm93AACg0iFlAGUAAKCoInAAQQIGAwAAAAALA3Iicm93AACg0SFvJHduQXJyb3cAAKDVIWUlcnRpY2FsQmFyAACgJSJuAAADQUJMUlRhJAM2AzoDWgNxA3oDciJyb3cAAKGTIUJVLAMwA2EAcgAAoBMpcCNBcnJvdwAAoPUhciJldmUAEWPlIWZ00gJDAwAASwMAAFIDaSVnaHRWZWN0b3IAAKBQKWUkZVZlY3RvcgAAoF4p5SJjdG9yQqC9IWEAcgAAoFYpaSJnaHQA1AFiAwAAaQNlJGVWZWN0b3IAAKBfKeUiY3RvckKgwSFhAHIAAKBXKWUAZQBBoKQiciJyb3cAAKCnIXIAcgBvAPcAtAIAAWN0gwOHA3IAAOA12J/c8iFvaxBhAAhOVGFjZGZnbG1vcHFzdHV4owOlA6kDsAO/A8IDxgPNA9ID8gP9AwEEFAQeBCAEJQRHAEphSAA7gNAA0EBjAHUAdABlADuAyQDJQIABYWl5ALYDuQO+A/Ihb24aYXIAYwA7gMoAykAtZG8AdAAWYXIAAOA12AjdcgBhAHYAZQA7gMgAyEDlIm1lbnQAoAgiAAFhcNYD2QNjAHIAEmF0AHkAUwLhAwAAAADpA20lYWxsU3F1YXJlAACg+yVlJ3J5U21hbGxTcXVhcmUAAKCrJQABZ3D2A/kDbwBuABhhZgAA4DXYPN3zImlsb26VY3UAAAFhaQYEDgRsAFSgdSppImxkZQAAoEIi7CNpYnJpdW0AoMwhAAFjaRgEGwRyAACgMCFtAACgcyphAJdjbQBsADuAywDLQAABaXApBC0E8yF0cwCgAyLvJG5lbnRpYWxFAKBHIYACY2Zpb3MAPQQ/BEMEXQRyBHkAJGRyAADgNdgJ3WwibGVkAFMCTAQAAAAAVARtJWFsbFNxdWFyZQAAoPwlZSdyeVNtYWxsU3F1YXJlAACgqiVwA2UEAABpBAAAAABtBGYAAOA12D3dwSFsbACgACLyI2llcnRyZgCgMSFjAPIAcQQABkpUYWJjZGZnb3JzdIgEiwSOBJMElwSkBKcEqwStBLIE5QTqBGMAeQADZDuAPgA+QO0hbWFkoJMD3GNyImV2ZQAeYYABZWl5AJ0EoASjBOQhaWwiYXIAYwAcYRNkbwB0ACBhcgAA4DXYCt0AoNkicABmAADgNdg+3eUiYXRlcgADRUZHTFNUvwTIBM8E1QTZBOAEcSJ1YWwATKBlIuUhc3MAoNsidSRsbEVxdWFsAACgZyJyI2VhdGVyAACgoirlIXNzAKB3IuwkYW50RXF1YWwAoH4qaSJsZGUAAKBzImMAcgAA4DXYotwAoGsiAARBYWNmaW9zdfkE/QQFBQgFCwUTBSIFKwVSIkRjeQAqZAABY3QBBQQFZQBrAMdiXmDpIXJjJGFyAACgDCFsJWJlcnRTcGFjZQAAoAsh8AEYBQAAGwVmAACgDSHpJXpvbnRhbExpbmUAoAAlAAFjdCYFKAXyABIF8iFvayZhbQBwAEQBMQU5BW8AdwBuAEgAdQBtAPAAAAFxInVhbAAAoE8iAAdFSk9hY2RmZ21ub3N0dVMFVgVZBVwFYwVtBXAFcwV6BZAFtgXFBckFzQVjAHkAFWTsIWlnMmFjAHkAAWRjAHUAdABlADuAzQDNQAABaXlnBWwFcgBjADuAzgDOQBhkbwB0ADBhcgAAoBEhcgBhAHYAZQA7gMwAzEAAoREhYXB/BYsFAAFjZ4MFhQVyACphaSNuYXJ5SQAAoEghbABpAGUA8wD6AvQBlQUAAKUFZaAsIgABZ3KaBZ4F8iFhbACgKyLzI2VjdGlvbgCgwiJpI3NpYmxlAAABQ1SsBbEFbyJtbWEAAKBjIGkibWVzAACgYiCAAWdwdAC8Bb8FwwVvAG4ALmFmAADgNdhA3WEAmWNjAHIAAKAQIWkibGRlAChh6wHSBQAA1QVjAHkABmRsADuAzwDPQIACY2Zvc3UA4QXpBe0F8gX9BQABaXnlBegFcgBjADRhGWRyAADgNdgN3XAAZgAA4DXYQd3jAfcFAAD7BXIAAOA12KXc8iFjeQhk6yFjeQRkgANISmFjZm9zAAwGDwYSBhUGHQYhBiYGYwB5ACVkYwB5AAxk8CFwYZpjAAFleRkGHAbkIWlsNmEaZHIAAOA12A7dcABmAADgNdhC3WMAcgAA4DXYptyABUpUYWNlZmxtb3N0AD0GQAZDBl4GawZkB2gHcAd0B80H2gdjAHkACWQ7gDwAPECAAmNtbnByAEwGTwZSBlUGWwb1IXRlOWHiIWRhm2NnAACg6ifsI2FjZXRyZgCgEiFyAACgniGAAWFleQBkBmcGagbyIW9uPWHkIWlsO2EbZAABZnNvBjQHdAAABUFDREZSVFVWYXKABp4GpAbGBssG3AYDByEHwQIqBwABbnKEBowGZyVsZUJyYWNrZXQAAKDoJ/Ihb3cAoZAhQlKTBpcGYQByAACg5CHpJGdodEFycm93AKDGIWUjaWxpbmcAAKAII28A9QGqBgAAsgZiJWxlQnJhY2tldAAAoOYnbgDUAbcGAAC+BmUkZVZlY3RvcgAAoGEp5SJjdG9yQqDDIWEAcgAAoFkpbCJvb3IAAKAKI2kiZ2h0AAABQVbSBtcGciJyb3cAAKCUIeUiY3RvcgCgTikAAWVy4AbwBmUAAKGjIkFW5gbrBnIicm93AACgpCHlImN0b3IAoFopaSNhbmdsZQBCorIi+wYAAAAA/wZhAHIAAKDPKXEidWFsAACgtCJwAIABRFRWAAoHEQcYB+8kd25WZWN0b3IAoFEpZSRlVmVjdG9yAACgYCnlImN0b3JCoL8hYQByAACgWCnlImN0b3JCoLwhYQByAACgUilpAGcAaAB0AGEAcgByAG8A9wDMAnMAAANFRkdMU1Q/B0cHTgdUB1gHXwfxJXVhbEdyZWF0ZXIAoNoidSRsbEVxdWFsAACgZiJyI2VhdGVyAACgdiLlIXNzAKChKuwkYW50RXF1YWwAoH0qaSJsZGUAAKByInIAAOA12A/dZaDYIuYjdGFycm93AKDaIWkiZG90AD9hgAFucHcAege1B7kHZwAAAkxSbHKCB5QHmwerB+UhZnQAAUFSiAeNB3Iicm93AACg9SfpJGdodEFycm93AKD3J+kkZ2h0QXJyb3cAoPYn5SFmdAABYXLcAqEHaQBnAGgAdABhAHIAcgBvAPcA5wJpAGcAaAB0AGEAcgByAG8A9wDuAmYAAOA12EPdZQByAAABTFK/B8YHZSRmdEFycm93AACgmSHpJGdodEFycm93AKCYIYABY2h0ANMH1QfXB/IAWgYAoLAh8iFva0FhAKBqIgAEYWNlZmlvc3XpB+wH7gf/BwMICQgOCBEIcAAAoAUpeQAcZAABZGzyB/kHaSR1bVNwYWNlAACgXyBsI2ludHJmAACgMyFyAADgNdgQ3e4jdXNQbHVzAKATInAAZgAA4DXYRN1jAPIA/gecY4AESmFjZWZvc3R1ACEIJAgoCDUIgQiFCDsKQApHCmMAeQAKZGMidXRlAENhgAFhZXkALggxCDQI8iFvbkdh5CFpbEVhHWSAAWdzdwA7CGEIfQjhInRpdmWAAU1UVgBECEwIWQhlJWRpdW1TcGFjZQAAoAsgaABpAAABY25SCFMIawBTAHAAYQBjAOUASwhlAHIAeQBUAGgAaQDuAFQI9CFlZAABR0xnCHUIcgBlAGEAdABlAHIARwByAGUAYQB0AGUA8gDrBGUAcwBzAEwAZQBzAPMA2wdMImluZQAKYHIAAOA12BHdAAJCbnB0jAiRCJkInAhyImVhawAAoGAgwiZyZWFraW5nU3BhY2WgYGYAAKAVIUOq7CqzCMIIzQgAAOcIGwkAAAAAAAAtCQAAbwkAAIcJAACdCcAJGQoAADQKAAFvdbYIvAjuI2dydWVudACgYiJwIkNhcAAAoG0ibyh1YmxlVmVydGljYWxCYXIAAKAmIoABbHF4ANII1wjhCOUibWVudACgCSL1IWFsVKBgImkibGRlAADgQiI4A2kic3RzAACgBCJyI2VhdGVyAACjbyJFRkdMU1T1CPoIAgkJCQ0JFQlxInVhbAAAoHEidSRsbEVxdWFsAADgZyI4A3IjZWF0ZXIAAOBrIjgD5SFzcwCgeSLsJGFudEVxdWFsAOB+KjgDaSJsZGUAAKB1IvUhbXBEASAJJwnvI3duSHVtcADgTiI4A3EidWFsAADgTyI4A2UAAAFmczEJRgn0JFRyaWFuZ2xlQqLqIj0JAAAAAEIJYQByAADgzyk4A3EidWFsAACg7CJzAICibiJFR0xTVABRCVYJXAlhCWkJcSJ1YWwAAKBwInIjZWF0ZXIAAKB4IuUhc3MA4GoiOAPsJGFudEVxdWFsAOB9KjgDaSJsZGUAAKB0IuUic3RlZAABR0x1CX8J8iZlYXRlckdyZWF0ZXIA4KIqOAPlI3NzTGVzcwDgoSo4A/IjZWNlZGVzAKGAIkVTjwmVCXEidWFsAADgryo4A+wkYW50RXF1YWwAoOAiAAFlaaAJqQl2JmVyc2VFbGVtZW50AACgDCLnJWh0VHJpYW5nbGVCousitgkAAAAAuwlhAHIAAODQKTgDcSJ1YWwAAKDtIgABcXXDCeAJdSNhcmVTdQAAAWJwywnVCfMhZXRF4I8iOANxInVhbAAAoOIi5SJyc2V0ReCQIjgDcSJ1YWwAAKDjIoABYmNwAOYJ8AkNCvMhZXRF4IIi0iBxInVhbAAAoIgi4yJlZWRzgKGBIkVTVAD6CQAKBwpxInVhbAAA4LAqOAPsJGFudEVxdWFsAKDhImkibGRlAADgfyI4A+UicnNldEXggyLSIHEidWFsAACgiSJpImxkZQCAoUEiRUZUACIKJwouCnEidWFsAACgRCJ1JGxsRXF1YWwAAKBHImkibGRlAACgSSJlJXJ0aWNhbEJhcgAAoCQiYwByAADgNdip3GkAbABkAGUAO4DRANFAnWMAB0VhY2RmZ21vcHJzdHV2XgphCmgKcgp2CnoKgQqRCpYKqwqtCrsKyArNCuwhaWdSYWMAdQB0AGUAO4DTANNAAAFpeWwKcQpyAGMAO4DUANRAHmRiImxhYwBQYXIAAOA12BLdcgBhAHYAZQA7gNIA0kCAAWFlaQCHCooKjQpjAHIATGFnAGEAqWNjInJvbgCfY3AAZgAA4DXYRt3lI25DdXJseQABRFGeCqYKbyV1YmxlUXVvdGUAAKAcIHUib3RlAACgGCAAoFQqAAFjbLEKtQpyAADgNdiq3GEAcwBoADuA2ADYQGkAbAHACsUKZABlADuA1QDVQGUAcwAAoDcqbQBsADuA1gDWQGUAcgAAAUJQ0wrmCgABYXLXCtoKcgAAoD4gYQBjAAABZWvgCuIKAKDeI2UAdAAAoLQjYSVyZW50aGVzaXMAAKDcI4AEYWNmaGlsb3JzAP0KAwsFCwkLCwsMCxELIwtaC3IjdGlhbEQAAKACInkAH2RyAADgNdgT3WkApmOgY/Ujc01pbnVzsWAAAWlwFQsgC24AYwBhAHIAZQBwAGwAYQBuAOUACgVmAACgGSGAobsqZWlvACoLRQtJC+MiZWRlc4CheiJFU1QANAs5C0ALcSJ1YWwAAKCvKuwkYW50RXF1YWwAoHwiaSJsZGUAAKB+Im0AZQAAoDMgAAFkcE0LUQv1IWN0AKAPIm8jcnRpb24AYaA3ImwAAKAdIgABY2leC2ILcgAA4DXYq9yoYwACVWZvc2oLbwtzC3cLTwBUADuAIgAiQHIAAOA12BTdcABmAACgGiFjAHIAAOA12KzcAAZCRWFjZWZoaW9yc3WPC5MLlwupC7YL2AvbC90LhQyTDJoMowzhIXJyAKAQKUcAO4CuAK5AgAFjbnIAnQugC6ML9SF0ZVRhZwAAoOsncgB0oKAhbAAAoBYpgAFhZXkArwuyC7UL8iFvblhh5CFpbFZhIGR2oBwhZSJyc2UAAAFFVb8LzwsAAWxxwwvIC+UibWVudACgCyL1JGlsaWJyaXVtAKDLIXAmRXF1aWxpYnJpdW0AAKBvKXIAAKAcIW8AoWPnIWh0AARBQ0RGVFVWYewLCgwQDDIMNwxeDHwM9gIAAW5y8Av4C2clbGVCcmFja2V0AACg6SfyIW93AKGSIUJM/wsDDGEAcgAAoOUhZSRmdEFycm93AACgxCFlI2lsaW5nAACgCSNvAPUBFgwAAB4MYiVsZUJyYWNrZXQAAKDnJ24A1AEjDAAAKgxlJGVWZWN0b3IAAKBdKeUiY3RvckKgwiFhAHIAAKBVKWwib29yAACgCyMAAWVyOwxLDGUAAKGiIkFWQQxGDHIicm93AACgpiHlImN0b3IAoFspaSNhbmdsZQBCorMiVgwAAAAAWgxhAHIAAKDQKXEidWFsAACgtSJwAIABRFRWAGUMbAxzDO8kd25WZWN0b3IAoE8pZSRlVmVjdG9yAACgXCnlImN0b3JCoL4hYQByAACgVCnlImN0b3JCoMAhYQByAACgUykAAXB1iQyMDGYAAKAdIe4kZEltcGxpZXMAoHAp6SRnaHRhcnJvdwCg2yEAAWNongyhDHIAAKAbIQCgsSHsJGVEZWxheWVkAKD0KYAGSE9hY2ZoaW1vcXN0dQC/DMgMzAzQDOIM5gwKDQ0NFA0ZDU8NVA1YDQABQ2PDDMYMyCFjeSlkeQAoZEYiVGN5ACxkYyJ1dGUAWmEAorwqYWVpedgM2wzeDOEM8iFvbmBh5CFpbF5hcgBjAFxhIWRyAADgNdgW3e8hcnQAAkRMUlXvDPYM/QwEDW8kd25BcnJvdwAAoJMhZSRmdEFycm93AACgkCHpJGdodEFycm93AKCSIXAjQXJyb3cAAKCRIechbWGjY+EkbGxDaXJjbGUAoBgicABmAADgNdhK3XICHw0AAAAAIg10AACgGiLhIXJlgKGhJUlTVQAqDTINSg3uJXRlcnNlY3Rpb24AoJMidQAAAWJwNw1ADfMhZXRFoI8icSJ1YWwAAKCRIuUicnNldEWgkCJxInVhbAAAoJIibiJpb24AAKCUImMAcgAA4DXYrtxhAHIAAKDGIgACYmNtcF8Nag2ODZANc6DQImUAdABFoNAicSJ1YWwAAKCGIgABY2huDYkNZSJlZHMAgKF7IkVTVAB4DX0NhA1xInVhbAAAoLAq7CRhbnRFcXVhbACgfSJpImxkZQAAoH8iVABoAGEA9ADHCwCgESIAodEiZXOVDZ8NciJzZXQARaCDInEidWFsAACghyJlAHQAAKDRIoAFSFJTYWNmaGlvcnMAtQ27Db8NyA3ODdsN3w3+DRgOHQ4jDk8AUgBOADuA3gDeQMEhREUAoCIhAAFIY8MNxg1jAHkAC2R5ACZkAAFidcwNzQ0JYKRjgAFhZXkA1A3XDdoN8iFvbmRh5CFpbGJhImRyAADgNdgX3QABZWnjDe4N8gHoDQAA7Q3lImZvcmUAoDQiYQCYYwABY27yDfkNayNTcGFjZQAA4F8gCiDTInBhY2UAoAkg7CFkZYChPCJFRlQABw4MDhMOcSJ1YWwAAKBDInUkbGxFcXVhbAAAoEUiaSJsZGUAAKBIInAAZgAA4DXYS93pI3BsZURvdACg2yAAAWN0Jw4rDnIAAOA12K/c8iFva2Zh4QpFDlYOYA5qDgAAbg5yDgAAAAAAAAAAAAB5DnwOqA6zDgAADg8RDxYPGg8AAWNySA5ODnUAdABlADuA2gDaQHIAb6CfIeMhaXIAoEkpcgDjAVsOAABdDnkADmR2AGUAbGEAAWl5Yw5oDnIAYwA7gNsA20AjZGIibGFjAHBhcgAA4DXYGN1yAGEAdgBlADuA2QDZQOEhY3JqYQABZGl/Dp8OZQByAAABQlCFDpcOAAFhcokOiw5yAF9gYQBjAAABZWuRDpMOAKDfI2UAdAAAoLUjYSVyZW50aGVzaXMAAKDdI28AbgBQoMMi7CF1cwCgjiIAAWdwqw6uDm8AbgByYWYAAOA12EzdAARBREVUYWRwc78O0g7ZDuEOBQPqDvMOBw9yInJvdwDCoZEhyA4AAMwOYQByAACgEilvJHduQXJyb3cAAKDFIW8kd25BcnJvdwAAoJUhcSV1aWxpYnJpdW0AAKBuKWUAZQBBoKUiciJyb3cAAKClIW8AdwBuAGEAcgByAG8A9wAQA2UAcgAAAUxS+Q4AD2UkZnRBcnJvdwAAoJYh6SRnaHRBcnJvdwCglyFpAGyg0gNvAG4ApWPpIW5nbmFjAHIAAOA12LDcaSJsZGUAaGFtAGwAO4DcANxAgAREYmNkZWZvc3YALQ8xDzUPNw89D3IPdg97D4AP4SFzaACgqyJhAHIAAKDrKnkAEmThIXNobKCpIgCg5ioAAWVyQQ9DDwCgwSKAAWJ0eQBJD00Paw9hAHIAAKAWIGmgFiDjIWFsAAJCTFNUWA9cD18PZg9hAHIAAKAjIukhbmV8YGUkcGFyYXRvcgAAoFgnaSJsZGUAAKBAItQkaGluU3BhY2UAoAogcgAA4DXYGd1wAGYAAOA12E3dYwByAADgNdix3GQiYXNoAACgqiKAAmNlZm9zAI4PkQ+VD5kPng/pIXJjdGHkIWdlAKDAInIAAOA12BrdcABmAADgNdhO3WMAcgAA4DXYstwAAmZpb3OqD64Prw+0D3IAAOA12BvdnmNwAGYAAOA12E/dYwByAADgNdiz3IAEQUlVYWNmb3N1AMgPyw/OD9EP2A/gD+QP6Q/uD2MAeQAvZGMAeQAHZGMAeQAuZGMAdQB0AGUAO4DdAN1AAAFpedwP3w9yAGMAdmErZHIAAOA12BzdcABmAADgNdhQ3WMAcgAA4DXYtNxtAGwAeGEABEhhY2RlZm9z/g8BEAUQDRAQEB0QIBAkEGMAeQAWZGMidXRlAHlhAAFheQkQDBDyIW9ufWEXZG8AdAB7YfIBFRAAABwQbwBXAGkAZAB0AOgAVAhhAJZjcgAAoCghcABmAACgJCFjAHIAAOA12LXc4QtCEEkQTRAAAGcQbRByEAAAAAAAAAAAeRCKEJcQ8hD9EAAAGxEhETIROREAAD4RYwB1AHQAZQA7gOEA4UByImV2ZQADYYCiPiJFZGl1eQBWEFkQWxBgEGUQAOA+IjMDAKA/InIAYwA7gOIA4kB0AGUAO4C0ALRAMGRsAGkAZwA7gOYA5kByoGEgAOA12B7dcgBhAHYAZQA7gOAA4EAAAWVwfBCGEAABZnCAEIQQ8yF5bQCgNSHoAIMQaABhALFjAAFhcI0QWwAAAWNskRCTEHIAAWFnAACgPypkApwQAAAAALEQAKInImFkc3ajEKcQqRCuEG4AZAAAoFUqAKBcKmwib3BlAACgWCoAoFoqAKMgImVsbXJzersQvRDAEN0Q5RDtEACgpCllAACgICJzAGQAYaAhImEEzhDQENIQ1BDWENgQ2hDcEACgqCkAoKkpAKCqKQCgqykAoKwpAKCtKQCgrikAoK8pdAB2oB8iYgBkoL4iAKCdKQABcHTpEOwQaAAAoCIixWDhIXJyAKB8IwABZ3D1EPgQbwBuAAVhZgAA4DXYUt0Ao0giRWFlaW9wBxEJEQ0RDxESERQRAKBwKuMhaXIAoG8qAKBKImQAAKBLInMAJ2DyIW94ZaBIIvEADhFpAG4AZwA7gOUA5UCAAWN0eQAmESoRKxFyAADgNdi23CpgbQBwAGWgSCLxAPgBaQBsAGQAZQA7gOMA40BtAGwAO4DkAORAAAFjaUERRxFvAG4AaQBuAPQA6AFuAHQAAKARKgAITmFiY2RlZmlrbG5vcHJzdWQRaBGXEZ8RpxGrEdIR1hErEjASexKKEn0RThNbE3oTbwB0AACg7SoAAWNybBGJEWsAAAJjZXBzdBF4EX0RghHvIW5nAKBMInAjc2lsb24A9mNyImltZQAAoDUgaQBtAGWgPSJxAACgzSJ2AY0RkRFlAGUAAKC9ImUAZABnoAUjZQAAoAUjcgBrAHSgtSPiIXJrAKC2IwABb3mjEaYRbgDnAHcRMWTxIXVvAKAeIIACY21wcnQAtBG5Eb4RwRHFEeEhdXPloDUi5ABwInR5dgAAoLApcwDpAH0RbgBvAPUA6gCAAWFodwDLEcwRzhGyYwCgNiHlIWVuAKBsInIAAOA12B/dZwCAA2Nvc3R1dncA4xHyEQUSEhIhEiYSKRKAAWFpdQDpEesR7xHwAKMFcgBjAACg7yVwAACgwyKAAWRwdAD4EfwRABJvAHQAAKAAKuwhdXMAoAEqaSJtZXMAAKACKnECCxIAAAAADxLjIXVwAKAGKmEAcgAAoAUm8iNpYW5nbGUAAWR1GhIeEu8hd24AoL0lcAAAoLMlcCJsdXMAAKAEKmUA5QBCD+UAkg9hInJvdwAAoA0pgAFha28ANhJoEncSAAFjbjoSZRJrAIABbHN0AEESRxJNEm8jemVuZ2UAAKDrKXEAdQBhAHIA5QBcBPIjaWFuZ2xlgKG0JWRscgBYElwSYBLvIXduAKC+JeUhZnQAoMIlaSJnaHQAAKC4JWsAAKAjJLEBbRIAAHUSsgFxEgAAcxIAoJIlAKCRJTQAAKCTJWMAawAAoIglAAFlb38ShxJx4D0A5SD1IWl2AOBhIuUgdAAAoBAjAAJwdHd4kRKVEpsSnxJmAADgNdhT3XSgpSJvAG0AAKClIvQhaWUAoMgiAAZESFVWYmRobXB0dXayEsES0RLgEvcS+xIKExoTHxMjEygTNxMAAkxSbHK5ErsSvRK/EgCgVyUAoFQlAKBWJQCgUyUAolAlRFVkdckSyxLNEs8SAKBmJQCgaSUAoGQlAKBnJQACTFJsctgS2hLcEt4SAKBdJQCgWiUAoFwlAKBZJQCjUSVITFJobHLrEu0S7xLxEvMS9RIAoGwlAKBjJQCgYCUAoGslAKBiJQCgXyVvAHgAAKDJKQACTFJscgITBBMGEwgTAKBVJQCgUiUAoBAlAKAMJQCiACVEVWR1EhMUExYTGBMAoGUlAKBoJQCgLCUAoDQlaSJudXMAAKCfIuwhdXMAoJ4iaSJtZXMAAKCgIgACTFJsci8TMRMzEzUTAKBbJQCgWCUAoBglAKAUJQCjAiVITFJobHJCE0QTRhNIE0oTTBMAoGolAKBhJQCgXiUAoDwlAKAkJQCgHCUAAWV2UhNVE3YA5QD5AGIAYQByADuApgCmQAACY2Vpb2ITZhNqE24TcgAA4DXYt9xtAGkAAKBPIG0A5aA9IogRbAAAoVwAYmh0E3YTAKDFKfMhdWIAoMgnbAF+E4QTbABloCIgdAAAoCIgcAAAoU4iRWWJE4sTAKCuKvGgTyI8BeEMqRMAAN8TABQDFB8UAAAjFDQUAAAAAIUUAAAAAI0UAAAAANcU4xT3FPsUAACIFQAAlhWAAWNwcgCuE7ET1RP1IXRlB2GAoikiYWJjZHMAuxO/E8QTzhPSE24AZAAAoEQqciJjdXAAAKBJKgABYXXIE8sTcAAAoEsqcAAAoEcqbwB0AACgQCoA4CkiAP4AAWVv2RPcE3QAAKBBIO4ABAUAAmFlaXXlE+8T9RP4E/AB6hMAAO0TcwAAoE0qbwBuAA1hZABpAGwAO4DnAOdAcgBjAAlhcABzAHOgTCptAACgUCpvAHQAC2GAAWRtbgAIFA0UEhRpAGwAO4C4ALhAcCJ0eXYAAKCyKXQAAIGiADtlGBQZFKJAcgBkAG8A9ABiAXIAAOA12CDdgAFjZWkAKBQqFDIUeQBHZGMAawBtoBMn4SFyawCgEyfHY3IAAKPLJUVjZWZtcz8UQRRHFHcUfBSAFACgwykAocYCZWxGFEkUcQAAoFciZQBhAlAUAAAAAGAUciJyb3cAAAFsclYUWhTlIWZ0AKC6IWkiZ2h0AACguyGAAlJTYWNkAGgUaRRrFG8UcxSuYACgyCRzAHQAAKCbIukhcmMAoJoi4SFzaACgnSJuImludAAAoBAqaQBkAACg7yrjIWlyAKDCKfUhYnN1oGMmaQB0AACgYybsApMUmhS2FAAAwxRvAG4AZaA6APGgVCKrAG0CnxQAAAAAoxRhAHSgLABAYAChASJmbKcUqRTuABMNZQAAAW14rhSyFOUhbnQAoAEiZQDzANIB5wG6FAAAwBRkoEUibwB0AACgbSpuAPQAzAGAAWZyeQDIFMsUzhQA4DXYVN1vAOQA1wEAgakAO3MeAdMUcgAAoBchAAFhb9oU3hRyAHIAAKC1IXMAcwAAoBcnAAFjdeYU6hRyAADgNdi43AABYnDuFPIUZaDPKgCg0SploNAqAKDSKuQhb3QAoO8igANkZWxwcnZ3AAYVEBUbFSEVRBVlFYQV4SFycgABbHIMFQ4VAKA4KQCgNSlwAhYVAAAAABkVcgAAoN4iYwAAoN8i4SFycnCgtiEAoD0pgKIqImJjZG9zACsVMBU6FT4VQRVyImNhcAAAoEgqAAFhdTQVNxVwAACgRipwAACgSipvAHQAAKCNInIAAKBFKgDgKiIA/gACYWxydksVURVuFXMVcgByAG2gtyEAoDwpeQCAAWV2dwBYFWUVaRVxAHACXxUAAAAAYxVyAGUA4wAXFXUA4wAZFWUAZQAAoM4iZSJkZ2UAAKDPImUAbgA7gKQApEBlI2Fycm93AAABbHJ7FX8V5SFmdACgtiFpImdodAAAoLchZQDkAG0VAAFjaYsVkRVvAG4AaQBuAPQAkwFuAHQAAKAxImwiY3R5AACgLSOACUFIYWJjZGVmaGlqbG9yc3R1d3oAuBW7Fb8V1RXgFegV+RUKFhUWHxZUFlcWZRbFFtsW7xb7FgUXChdyAPIAtAJhAHIAAKBlKQACZ2xyc8YVyhXOFdAV5yFlcgCgICDlIXRoAKA4IfIA9QxoAHagECAAoKMiawHZFd4VYSJyb3cAAKAPKWEA4wBfAgABYXnkFecV8iFvbg9hNGQAoUYhYW/tFfQVAAFnciEC8RVyAACgyiF0InNlcQAAoHcqgAFnbG0A/xUCFgUWO4CwALBAdABhALRjcCJ0eXYAAKCxKQABaXIOFhIW8yFodACgfykA4DXYId1hAHIAAAFschsWHRYAoMMhAKDCIYACYWVnc3YAKBauAjYWOhY+Fm0AAKHEIm9zLhY0Fm4AZABzoMQi9SFpdACgZiZhIm1tYQDdY2kAbgAAoPIiAKH3AGlvQxZRFmQAZQAAgfcAO29KFksW90BuI3RpbWVzAACgxyJuAPgAUBZjAHkAUmRjAG8CXhYAAAAAYhZyAG4AAKAeI28AcAAAoA0jgAJscHR1dwBuFnEWdRaSFp4W7CFhciRgZgAA4DXYVd0AotkCZW1wc30WhBaJFo0WcQBkoFAibwB0AACgUSJpIm51cwAAoDgi7CF1cwCgFCLxInVhcmUAoKEiYgBsAGUAYgBhAHIAdwBlAGQAZwDlANcAbgCAAWFkaAClFqoWtBZyAHIAbwD3APUMbwB3AG4AYQByAHIAbwB3APMA8xVhI3Jwb29uAAABbHK8FsAWZQBmAPQAHBZpAGcAaAD0AB4WYgHJFs8WawBhAHIAbwD3AJILbwLUFgAAAADYFnIAbgAAoB8jbwBwAACgDCOAAWNvdADhFukW7BYAAXJ55RboFgDgNdi53FVkbAAAoPYp8iFvaxFhAAFkcvMW9xZvAHQAAKDxImkA5qC/JVsSAAFhaP8WAhdyAPIANQNhAPIA1wvhIm5nbGUAoKYpAAFjaQ4XEBd5AF9k5yJyYXJyAKD/JwAJRGFjZGVmZ2xtbm9wcXJzdHV4MRc4F0YXWxcyBF4XaRd5F40XrBe0F78X2RcVGCEYLRg1GEAYAAFEbzUXgRZvAPQA+BUAAWNzPBdCF3UAdABlADuA6QDpQPQhZXIAoG4qAAJhaW95TRdQF1YXWhfyIW9uG2FyAGOgViI7gOoA6kDsIW9uAKBVIk1kbwB0ABdhAAFEcmIXZhdvAHQAAKBSIgDgNdgi3XKhmipuF3QXYQB2AGUAO4DoAOhAZKCWKm8AdAAAoJgqgKGZKmlscwCAF4UXhxfuInRlcnMAoOcjAKATIWSglSpvAHQAAKCXKoABYXBzAJMXlheiF2MAcgATYXQAeQBzogUinxcAAAAAoRdlAHQAAKAFInAAMaADIDMBqRerFwCgBCAAoAUgAAFnc7AXsRdLYXAAAKACIAABZ3C4F7sXbwBuABlhZgAA4DXYVt2AAWFscwDFF8sXzxdyAHOg1SJsAACg4yl1AHMAAKBxKmkAAKG1A2x21RfYF28AbgC1Y/VjAAJjc3V24BfoF/0XEBgAAWlv5BdWF3IAYwAAoFYiaQLuFwAAAADwF+0ADQThIW50AAFnbPUX+Rd0AHIAAKCWKuUhc3MAoJUqgAFhZWkAAxgGGAoYbABzAD1gcwB0AACgXyJ2AESgYSJEAACgeCrwImFyc2wAoOUpAAFEYRkYHRhvAHQAAKBTInIAcgAAoHEpgAFjZGkAJxgqGO0XcgAAoC8hbwD0AIwCAAFhaDEYMhi3YzuA8ADwQAABbXI5GD0YbAA7gOsA60BvAACgrCCAAWNpcABGGEgYSxhsACFgcwD0ACwEAAFlb08YVxhjAHQAYQB0AGkAbwDuABoEbgBlAG4AdABpAGEAbADlADME4Ql1GAAAgRgAAIMYiBgAAAAAoRilGAAAqhgAALsYvhjRGAAA1xgnGWwAbABpAG4AZwBkAG8AdABzAGUA8QBlF3kARGRtImFsZQAAoEAmgAFpbHIAjRiRGJ0Y7CFpZwCgA/tpApcYAAAAAJoYZwAAoAD7aQBnAACgBPsA4DXYI93sIWlnAKAB++whaWcA4GYAagCAAWFsdACvGLIYthh0AACgbSZpAGcAAKAC+24AcwAAoLElbwBmAJJh8AHCGAAAxhhmAADgNdhX3QABYWvJGMwYbADsAGsEdqDUIgCg2SphI3J0aW50AACgDSoAAWFv2hgiGQABY3PeGB8ZsQPnGP0YBRkSGRUZAAAdGbID7xjyGPQY9xj5GAAA+xg7gL0AvUAAoFMhO4C8ALxAAKBVIQCgWSEAoFshswEBGQAAAxkAoFQhAKBWIbQCCxkOGQAAAAAQGTuAvgC+QACgVyEAoFwhNQAAoFghtgEZGQAAGxkAoFohAKBdITgAAKBeIWwAAKBEIHcAbgAAoCIjYwByAADgNdi73IAIRWFiY2RlZmdpamxub3JzdHYARhlKGVoZXhlmGWkZkhmWGZkZnRmgGa0ZxhnLGc8Z4BkjGmygZyIAoIwqgAFjbXAAUBlTGVgZ9SF0ZfVhbQBhAOSgswM6FgCghipyImV2ZQAfYQABaXliGWUZcgBjAB1hM2RvAHQAIWGAoWUibHFzAMYEcBl6GfGhZSLOBAAAdhlsAGEAbgD0AN8EgKF+KmNkbACBGYQZjBljAACgqSpvAHQAb6CAKmyggioAoIQqZeDbIgD+cwAAoJQqcgAA4DXYJN3noGsirATtIWVsAKA3IWMAeQBTZIChdyJFYWoApxmpGasZAKCSKgCgpSoAoKQqAAJFYWVztBm2Gb0ZwhkAoGkicABwoIoq8iFveACgiipxoIgq8aCIKrUZaQBtAACg5yJwAGYAAOA12FjdYQB2AOUAYwIAAWNp0xnWGXIAAKAKIW0AAKFzImVs3BneGQCgjioAoJAqAIM+ADtjZGxxco0E6xn0GfgZ/BkBGgABY2nvGfEZAKCnKnIAAKB6Km8AdAAAoNci0CFhcgCglSl1ImVzdAAAoHwqgAJhZGVscwAKGvQZFhrVBCAa8AEPGgAAFBpwAHIAbwD4AFkZcgAAoHgpcQAAAWxxxAQbGmwAZQBzAPMASRlpAO0A5AQAAWVuJxouGnIjdG5lcXEAAOBpIgD+xQAsGgAFQWFiY2Vma29zeUAaQxpmGmoabRqDGocalhrCGtMacgDyAMwCAAJpbG1yShpOGlAaVBpyAHMA8ABxD2YAvWBpAGwA9AASBQABZHJYGlsaYwB5AEpkAKGUIWN3YBpkGmkAcgAAoEgpAKCtIWEAcgAAoA8h6SFyYyVhgAFhbHIAcxp7Gn8a8iF0c3WgZSZpAHQAAKBlJuwhaXAAoCYg4yFvbgCguSJyAADgNdgl3XMAAAFld4wakRphInJvdwAAoCUpYSJyb3cAAKAmKYACYW1vcHIAnxqjGqcauhq+GnIAcgAAoP8h9CFodACgOyJrAAABbHKsGrMaZSRmdGFycm93AACgqSHpJGdodGFycm93AKCqIWYAAOA12Fnd4iFhcgCgFSCAAWNsdADIGswa0BpyAADgNdi93GEAcwDoAGka8iFvaydhAAFicNca2xr1IWxsAKBDIOghZW4AoBAg4Qr2GgAA/RoAAAgbExsaGwAAIRs7GwAAAAA+G2IbmRuVG6sbAACyG80b0htjAHUAdABlADuA7QDtQAChYyBpeQEbBhtyAGMAO4DuAO5AOGQAAWN4CxsNG3kANWRjAGwAO4ChAKFAAAFmcssCFhsA4DXYJt1yAGEAdgBlADuA7ADsQIChSCFpbm8AJxsyGzYbAAFpbisbLxtuAHQAAKAMKnQAAKAtIuYhaW4AoNwpdABhAACgKSHsIWlnM2GAAWFvcABDG1sbXhuAAWNndABJG0sbWRtyACthgAFlbHAAcQVRG1UbaQBuAOUAyAVhAHIA9AByBWgAMWFmAACgtyJlAGQAtWEAoggiY2ZvdGkbbRt1G3kb4SFyZQCgBSFpAG4AdKAeImkAZQAAoN0pZABvAPQAWxsAoisiY2VscIEbhRuPG5QbYQBsAACguiIAAWdyiRuNG2UAcgDzACMQ4wCCG2EicmhrAACgFyryIW9kAKA8KgACY2dwdJ8boRukG6gbeQBRZG8AbgAvYWYAAOA12FrdYQC5Y3UAZQBzAHQAO4C/AL9AAAFjabUbuRtyAADgNdi+3G4AAKIIIkVkc3bCG8QbyBvQAwCg+SJvAHQAAKD1Inag9CIAoPMiaaBiIOwhZGUpYesB1hsAANkbYwB5AFZkbAA7gO8A70AAA2NmbW9zdeYb7hvyG/Ub+hsFHAABaXnqG+0bcgBjADVhOWRyAADgNdgn3eEhdGg3YnAAZgAA4DXYW93jAf8bAAADHHIAAOA12L/c8iFjeVhk6yFjeVRkAARhY2ZnaGpvcxUcGhwiHCYcKhwtHDAcNRzwIXBhdqC6A/BjAAFleR4cIRzkIWlsN2E6ZHIAAOA12CjdciJlZW4AOGFjAHkARWRjAHkAXGRwAGYAAOA12FzdYwByAADgNdjA3IALQUJFSGFiY2RlZmdoamxtbm9wcnN0dXYAXhxtHHEcdRx5HN8cBx0dHTwd3B3tHfEdAR4EHh0eLB5FHrwewx7hHgkfPR9LH4ABYXJ0AGQcZxxpHHIA8gBvB/IAxQLhIWlsAKAbKeEhcnIAoA4pZ6BmIgCgiyphAHIAAKBiKWMJjRwAAJAcAACVHAAAAAAAAAAAAACZHJwcAACmHKgcrRwAANIc9SF0ZTph7SJwdHl2AKC0KXIAYQDuAFoG4iFkYbtjZwAAoegnZGyhHKMcAKCRKeUAiwYAoIUqdQBvADuAqwCrQHIAgKOQIWJmaGxwc3QAuhy/HMIcxBzHHMoczhxmoOQhcwAAoB8pcwAAoB0p6wCyGnAAAKCrIWwAAKA5KWkAbQAAoHMpbAAAoKIhAKGrKmFl1hzaHGkAbAAAoBkpc6CtKgDgrSoA/oABYWJyAOUc6RztHHIAcgAAoAwpcgBrAACgcicAAWFr8Rz4HGMAAAFla/Yc9xx7YFtgAAFlc/wc/hwAoIspbAAAAWR1Ax0FHQCgjykAoI0pAAJhZXV5Dh0RHRodHB3yIW9uPmEAAWRpFR0YHWkAbAA8YewAowbiAPccO2QAAmNxcnMkHScdLB05HWEAAKA2KXUAbwDyoBwgqhEAAWR1MB00HeghYXIAoGcpcyJoYXIAAKBLKWgAAKCyIQCiZCJmZ3FzRB1FB5Qdnh10AIACYWhscnQATh1WHWUdbB2NHXIicm93AHSgkCFhAOkAzxxhI3Jwb29uAAABZHVeHWId7yF3bgCgvSFwAACgvCHlJGZ0YXJyb3dzAKDHIWkiZ2h0AIABYWhzAHUdex2DHXIicm93APOglCGdBmEAcgBwAG8AbwBuAPMAzgtxAHUAaQBnAGEAcgByAG8A9wBlGugkcmVldGltZXMAoMsi8aFkIk0HAACaHWwAYQBuAPQAXgcAon0qY2Rnc6YdqR2xHbcdYwAAoKgqbwB0AG+gfypyoIEqAKCDKmXg2iIA/nMAAKCTKoACYWRlZ3MAwB3GHcod1h3ZHXAAcAByAG8A+ACmHG8AdAAAoNYicQAAAWdxzx3SHXQA8gBGB2cAdADyAHQcdADyAFMHaQDtAGMHgAFpbHIA4h3mHeod8yFodACgfClvAG8A8gDKBgDgNdgp3UWgdiIAoJEqYQH1Hf4dcgAAAWR1YB35HWygvCEAoGopbABrAACghCVjAHkAWWQAomoiYWNodAweDx4VHhkecgDyAGsdbwByAG4AZQDyAGAW4SFyZACgaylyAGkAAKD6JQABaW8hHiQe5CFvdEBh9SFzdGGgsCPjIWhlAKCwIwACRWFlczMeNR48HkEeAKBoInAAcKCJKvIhb3gAoIkqcaCHKvGghyo0HmkAbQAAoOYiAARhYm5vcHR3elIeXB5fHoUelh6mHqsetB4AAW5yVh5ZHmcAAKDsJ3IAAKD9IXIA6wCwBmcAgAFsbXIAZh52Hnse5SFmdAABYXKIB2weaQBnAGgAdABhAHIAcgBvAPcAkwfhInBzdG8AoPwnaQBnAGgAdABhAHIAcgBvAPcAmgdwI2Fycm93AAABbHKNHpEeZQBmAPQAxhxpImdodAAAoKwhgAFhZmwAnB6fHqIecgAAoIUpAOA12F3ddQBzAACgLSppIm1lcwAAoDQqYQGvHrMecwB0AACgFyLhAIoOZaHKJbkeRhLuIWdlAKDKJWEAcgBsoCgAdAAAoJMpgAJhY2htdADMHs8e1R7bHt0ecgDyAJ0GbwByAG4AZQDyANYWYQByAGSgyyEAoG0pAKAOIHIAaQAAoL8iAANhY2hpcXTrHu8e1QfzHv0eBh/xIXVvAKA5IHIAAOA12MHcbQDloXIi+h4AAPweAKCNKgCgjyoAAWJ19xwBH28AcqAYIACgGiDyIW9rQmEAhDwAO2NkaGlscXJCBhcfxh0gHyQfKB8sHzEfAAFjaRsfHR8AoKYqcgAAoHkqcgBlAOUAkx3tIWVzAKDJIuEhcnIAoHYpdSJlc3QAAKB7KgABUGk1HzkfYQByAACglillocMlAgdfEnIAAAFkdUIfRx9zImhhcgAAoEop6CFhcgCgZikAAWVuTx9WH3IjdG5lcXEAAOBoIgD+xQBUHwAHRGFjZGVmaGlsbm9wc3VuH3Ifoh+rH68ftx+7H74f5h/uH/MfBwj/HwsgxCFvdACgOiIAAmNscHJ5H30fiR+eH3IAO4CvAK9AAAFldIEfgx8AoEImZaAgJ3MAZQAAoCAnc6CmIXQAbwCAoaYhZGx1AJQfmB+cH28AdwDuAHkDZQBmAPQA6gbwAOkO6yFlcgCgriUAAW95ph+qH+0hbWEAoCkqPGThIXNoAKAUIOElc3VyZWRhbmdsZQCgISJyAADgNdgq3W8AAKAnIYABY2RuAMQfyR/bH3IAbwA7gLUAtUBhoiMi0B8AANMf1x9zAPQAKxFpAHIAAKDwKm8AdAA7gLcAt0B1AHMA4qESIh4TAADjH3WgOCIAoCoqYwHqH+0fcAAAoNsq8gB+GnAAbAB1APMACAgAAWRw9x/7H+UhbHMAoKciZgAA4DXYXt0AAWN0AyAHIHIAAOA12MLc8CFvcwCgPiJsobwDECAVIPQiaW1hcACguCJhAPAAEyAADEdMUlZhYmNkZWZnaGlqbG1vcHJzdHV2dzwgRyBmIG0geSCqILgg2iDeIBEhFSEyIUMhTSFQIZwhnyHSIQAiIyKLIrEivyIUIwABZ3RAIEMgAODZIjgD9uBrItIgBwmAAWVsdABNIF8gYiBmAHQAAAFhclMgWCByInJvdwAAoM0h6SRnaHRhcnJvdwCgziEA4NgiOAP24Goi0iBfCekkZ2h0YXJyb3cAoM8hAAFEZHEgdSDhIXNoAKCvIuEhc2gAoK4igAJiY25wdACCIIYgiSCNIKIgbABhAACgByL1IXRlRGFnAADgICLSIACiSSJFaW9wlSCYIJwgniAA4HAqOANkAADgSyI4A3MASWFyAG8A+AAyCnUAcgBhoG4mbADzoG4mmwjzAa8gAACzIHAAO4CgAKBAbQBwAOXgTiI4AyoJgAJhZW91eQDBIMogzSDWINkg8AHGIAAAyCAAoEMqbwBuAEhh5CFpbEZhbgBnAGSgRyJvAHQAAOBtKjgDcAAAoEIqPWThIXNoAKATIACjYCJBYWRxc3jpIO0g+SD+IAIhDCFyAHIAAKDXIXIAAAFocvIg9SBrAACgJClvoJch9wAGD28AdAAA4FAiOAN1AGkA9gC7CAABZWkGIQohYQByAACgKCntAN8I6SFzdPOgBCLlCHIAAOA12CvdAAJFZXN0/wgcISshLiHxoXEiIiEAABMJ8aFxIgAJAAAnIWwAYQBuAPQAEwlpAO0AGQlyoG8iAKBvIoABQWFwADghOyE/IXIA8gBeIHIAcgAAoK4hYQByAACg8ipzogsiSiEAAAAAxwtkoPwiAKD6ImMAeQBaZIADQUVhZGVzdABcIV8hYiFmIWkhkyGWIXIA8gBXIADgZiI4A3IAcgAAoJohcgAAoCUggKFwImZxcwBwIYQhjiF0AAABYXJ1IXohcgByAG8A9wBlIWkAZwBoAHQAYQByAHIAbwD3AD4h8aFwImAhAACKIWwAYQBuAPQAZwlz4H0qOAMAoG4iaQDtAG0JcqBuImkA5aDqIkUJaQDkADoKAAFwdKMhpyFmAADgNdhf3YCBrAA7aW4AriGvIcchrEBuAIChCSJFZHYAtyG6Ib8hAOD5IjgDbwB0AADg9SI4A+EB1gjEIcYhAKD3IgCg9iJpAHagDCLhAagJzyHRIQCg/iIAoP0igAFhb3IA2CHsIfEhcgCAoSYiYXN0AOAh5SHpIWwAbABlAOwAywhsAADg/SrlIADgAiI4A2wiaW50AACgFCrjoYAi9yEAAPohdQDlAJsJY+CvKjgDZaCAIvEAkwkAAkFhaXQHIgoiFyIeInIA8gBsIHIAcgAAoZshY3cRIhQiAOAzKTgDAOCdITgDZyRodGFycm93AACgmyFyAGkA5aDrIr4JgANjaGltcHF1AC8iPCJHIpwhTSJQIloigKGBImNlcgA2Iv0JOSJ1AOUABgoA4DXYw9zvIXJ0bQKdIQAAAABEImEAcgDhAOEhbQBloEEi8aBEIiYKYQDyAMsIcwB1AAABYnBWIlgi5QDUCeUA3wmAAWJjcABgInMieCKAoYQiRWVzAGci7glqIgDgxSo4A2UAdABl4IIi0iBxAPGgiCJoImMAZaCBIvEA/gmAoYUiRWVzAH8iFgqCIgDgxio4A2UAdABl4IMi0iBxAPGgiSKAIgACZ2lscpIilCKaIpwi7AAMCWwAZABlADuA8QDxQOcAWwlpI2FuZ2xlAAABbHKkIqoi5SFmdGWg6iLxAEUJaSJnaHQAZaDrIvEAvgltoL0DAKEjAGVzuCK8InIAbwAAoBYhcAAAoAcggARESGFkZ2lscnMAziLSItYi2iLeIugi7SICIw8j4SFzaACgrSLhIXJyAKAEKXAAAOBNItIg4SFzaACgrCIAAWV04iLlIgDgZSLSIADgPgDSIG4iZmluAACg3imAAUFldADzIvci+iJyAHIAAKACKQDgZCLSIHLgPADSIGkAZQAA4LQi0iAAAUF0BiMKI3IAcgAAoAMp8iFpZQDgtSLSIGkAbQAA4Dwi0iCAAUFhbgAaIx4jKiNyAHIAAKDWIXIAAAFociMjJiNrAACgIylvoJYh9wD/DuUhYXIAoCcpUxJqFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVCMAAF4jaSN/I4IjjSOeI8AUAAAAAKYjwCMAANoj3yMAAO8jHiQvJD8kRCQAAWNzVyNsFHUAdABlADuA8wDzQAABaXlhI2cjcgBjoJoiO4D0APRAPmSAAmFiaW9zAHEjdCN3I3EBeiNzAOgAdhTsIWFjUWF2AACgOCrvIWxkAKC8KewhaWdTYQABY3KFI4kjaQByAACgvykA4DXYLN1vA5QjAAAAAJYjAACcI24A22JhAHYAZQA7gPIA8kAAoMEpAAFibaEjjAphAHIAAKC1KQACYWNpdKwjryO6I70jcgDyAFkUAAFpcrMjtiNyAACgvinvIXNzAKC7KW4A5QDZCgCgwCmAAWFlaQDFI8gjyyNjAHIATWFnAGEAyWOAAWNkbgDRI9Qj1iPyIW9uv2MAoLYpdQDzAHgBcABmAADgNdhg3YABYWVsAOQj5yPrI3IAAKC3KXIAcAAAoLkpdQDzAHwBAKMoImFkaW9zdvkj/CMPJBMkFiQbJHIA8gBeFIChXSplZm0AAyQJJAwkcgBvoDQhZgAAoDQhO4CqAKpAO4C6ALpA5yFvZgCgtiJyAACgVipsIm9wZQAAoFcqAKBbKoABY2xvACMkJSQrJPIACCRhAHMAaAA7gPgA+EBsAACgmCJpAGwBMyQ4JGQAZQA7gPUA9UBlAHMAYaCXInMAAKA2Km0AbAA7gPYA9kDiIWFyAKA9I+EKXiQAAHokAAB8JJQkAACYJKkkAAAAALUkEQsAAPAkAAAAAAQleiUAAIMlcgCAoSUiYXN0AGUkbyQBCwCBtgA7bGokayS2QGwAZQDsABgDaQJ1JAAAAAB4JG0AAKDzKgCg/Sp5AD9kcgCAAmNpbXB0AIUkiCSLJJkSjyRuAHQAJWBvAGQALmBpAGwAAKAwIOUhbmsAoDEgcgAA4DXYLd2AAWltbwCdJKAkpCR2oMYD1WNtAGEA9AD+B24AZQAAoA4m9KHAA64kAAC0JGMjaGZvcmsAAKDUItZjAAFhdbgkxCRuAAABY2u9JMIkawBooA8hAKAOIfYAaRpzAACkKwBhYmNkZW1zdNMkIRPXJNsk4STjJOck6yTjIWlyAKAjKmkAcgAAoCIqAAFvdYsW3yQAoCUqAKByKm4AO4CxALFAaQBtAACgJip3AG8AAKAnKoABaXB1APUk+iT+JO4idGludACgFSpmAADgNdhh3W4AZAA7gKMAo0CApHoiRWFjZWlub3N1ABMlFSUYJRslTCVRJVklSSV1JQCgsypwAACgtyp1AOUAPwtjoK8qgKJ6ImFjZW5zACclLSU0JTYlSSVwAHAAcgBvAPgAFyV1AHIAbAB5AGUA8QA/C/EAOAuAAWFlcwA8JUElRSXwInByb3gAoLkqcQBxAACgtSppAG0AAKDoImkA7QBEC20AZQDzoDIgIguAAUVhcwBDJVclRSXwAEAlgAFkZnAATwtfJXElgAFhbHMAZSVpJW0l7CFhcgCgLiPpIW5lAKASI/UhcmYAoBMjdKAdIu8AWQvyIWVsAKCwIgABY2l9JYElcgAA4DXYxdzIY24iY3NwAACgCCAAA2Zpb3BzdZElKxuVJZolnyWkJXIAAOA12C7dcABmAADgNdhi3XIiaW1lAACgVyBjAHIAAOA12MbcgAFhZW8AqiW6JcAldAAAAWVpryW2JXIAbgBpAG8AbgDzABkFbgB0AACgFipzAHQAZaA/APEACRj0AG0LgApBQkhhYmNkZWZoaWxtbm9wcnN0dXgA4yXyJfYl+iVpJpAmpia9JtUm5ib4JlonaCdxJ3UnnietJ7EnyCfiJ+cngAFhcnQA6SXsJe4lcgDyAJkM8gD6AuEhaWwAoBwpYQByAPIA3BVhAHIAAKBkKYADY2RlbnFydAAGJhAmEyYYJiYmKyZaJgABZXUKJg0mAOA9IjEDdABlAFVhaQDjACAN7SJwdHl2AKCzKWcAgKHpJ2RlbAAgJiImJCYAoJIpAKClKeUA9wt1AG8AO4C7ALtAcgAApZIhYWJjZmhscHN0dz0mQCZFJkcmSiZMJk4mUSZVJlgmcAAAoHUpZqDlIXMAAKAgKQCgMylzAACgHinrALka8ACVHmwAAKBFKWkAbQAAoHQpbAAAoKMhAKCdIQABYWleJmImaQBsAACgGilvAG6gNiJhAGwA8wB2C4ABYWJyAG8mciZ2JnIA8gAvEnIAawAAoHMnAAFha3omgSZjAAABZWt/JoAmfWBdYAABZXOFJocmAKCMKWwAAAFkdYwmjiYAoI4pAKCQKQACYWV1eZcmmiajJqUm8iFvbllhAAFkaZ4moSZpAGwAV2HsAA8M4gCAJkBkAAJjbHFzrSawJrUmuiZhAACgNylkImhhcgAAoGkpdQBvAPKgHSCjAWgAAKCzIYABYWNnAMMm0iaUC2wAgKEcIWlwcwDLJs4migxuAOUAoAxhAHIA9ADaC3QAAKCtJYABaWxyANsm3ybjJvMhaHQAoH0pbwBvAPIANgwA4DXYL90AAWFv6ib1JnIAAAFkde8m8SYAoMEhbKDAIQCgbCl2oMED8WOAAWducwD+Jk4nUCdoAHQAAANhaGxyc3QKJxInISc1Jz0nRydyInJvdwB0oJIhYQDpAFYmYSNycG9vbgAAAWR1GiceJ28AdwDuAPAmcAAAoMAh5SFmdAABYWgnJy0ncgByAG8AdwDzAAkMYQByAHAAbwBvAG4A8wATBGklZ2h0YXJyb3dzAACgySFxAHUAaQBnAGEAcgByAG8A9wBZJugkcmVldGltZXMAoMwiZwDaYmkAbgBnAGQAbwB0AHMAZQDxABwYgAFhaG0AYCdjJ2YncgDyAAkMYQDyABMEAKAPIG8idXN0AGGgsSPjIWhlAKCxI+0haWQAoO4qAAJhYnB0fCeGJ4knmScAAW5ygCeDJ2cAAKDtJ3IAAKD+IXIA6wAcDIABYWZsAI8nkieVJ3IAAKCGKQDgNdhj3XUAcwAAoC4qaSJtZXMAAKA1KgABYXCiJ6gncgBnoCkAdAAAoJQp7yJsaW50AKASKmEAcgDyADwnAAJhY2hxuCe8J6EMwCfxIXVvAKA6IHIAAOA12MfcAAFidYAmxCdvAPKgGSCoAYABaGlyAM4n0ifWJ3IAZQDlAE0n7SFlcwCgyiJpAIChuSVlZmwAXAxjEt4n9CFyaQCgzinsInVoYXIAoGgpAKAeIWENBSgJKA0oSyhVKIYoAACLKLAoAAAAAOMo5ygAABApJCkxKW0pcSmHKaYpAACYKgAAAACxKmMidXRlAFthcQB1AO8ABR+ApHsiRWFjZWlucHN5ABwoHignKCooLygyKEEoRihJKACgtCrwASMoAAAlKACguCpvAG4AYWF1AOUAgw1koLAqaQBsAF9hcgBjAF1hgAFFYXMAOCg6KD0oAKC2KnAAAKC6KmkAbQAAoOki7yJsaW50AKATKmkA7QCIDUFkbwB0AGKixSKRFgAAAABTKACgZiqAA0FhY21zdHgAYChkKG8ocyh1KHkogihyAHIAAKDYIXIAAAFocmkoayjrAJAab6CYIfcAzAd0ADuApwCnQGkAO2D3IWFyAKApKW0AAAFpbn4ozQBuAHUA8wDOAHQAAKA2J3IA7+A12DDdIxkAAmFjb3mRKJUonSisKHIAcAAAoG8mAAFoeZkonChjAHkASWRIZHIAdABtAqUoAAAAAKgoaQDkAFsPYQByAGEA7ABsJDuArQCtQAABZ22zKLsobQBhAAChwwNmdroouijCY4CjPCJkZWdsbnByAMgozCjPKNMo1yjaKN4obwB0AACgairxoEMiCw5FoJ4qAKCgKkWgnSoAoJ8qZQAAoEYi7CF1cwCgJCrhIXJyAKByKWEAcgDyAPwMAAJhZWl07Sj8KAEpCCkAAWxz8Sj4KGwAcwBlAHQAbQDpAH8oaABwAACgMyrwImFyc2wAoOQpAAFkbFoPBSllAACgIyNloKoqc6CsKgDgrCoA/oABZmxwABUpGCkfKfQhY3lMZGKgLwBhoMQpcgAAoD8jZgAA4DXYZN1hAAABZHIoKRcDZQBzAHWgYCZpAHQAAKBgJoABY3N1ADYpRilhKQABYXU6KUApcABzoJMiAOCTIgD+cABzoJQiAOCUIgD+dQAAAWJwSylWKQChjyJlcz4NUCllAHQAZaCPIvEAPw0AoZAiZXNIDVspZQB0AGWgkCLxAEkNAKGhJWFmZilbBHIAZQFrKVwEAKChJWEAcgDyAAMNAAJjZW10dyl7KX8pgilyAADgNdjI3HQAbQDuAM4AaQDsAAYpYQByAOYAVw0AAWFyiimOKXIA5qAGJhESAAFhbpIpoylpImdodAAAAWVwmSmgKXAAcwBpAGwAbwDuANkXaADpAKAkcwCvYIACYmNtbnAArin8KY4NJSooKgCkgiJFZGVtbnByc7wpvinCKcgpzCnUKdgp3CkAoMUqbwB0AACgvSpkoIYibwB0AACgwyr1IWx0AKDBKgABRWXQKdIpAKDLKgCgiiLsIXVzAKC/KuEhcnIAoHkpgAFlaXUA4inxKfQpdAAAoYIiZW7oKewpcQDxoIYivSllAHEA8aCKItEpbQAAoMcqAAFicPgp+ikAoNUqAKDTKmMAgKJ7ImFjZW5zAAcqDSoUKhYqRihwAHAAcgBvAPgAIyh1AHIAbAB5AGUA8QCDDfEAfA2AAWFlcwAcKiIqPShwAHAAcgBvAPgAPChxAPEAOShnAACgaiYApoMiMTIzRWRlaGxtbnBzPCo/KkIqRSpHKlIqWCpjKmcqaypzKncqO4C5ALlAO4CyALJAO4CzALNAAKDGKgABb3NLKk4qdAAAoL4qdQBiAACg2CpkoIcibwB0AACgxCpzAAABb3VdKmAqbAAAoMknYgAAoNcq4SFycgCgeyn1IWx0AKDCKgABRWVvKnEqAKDMKgCgiyLsIXVzAKDAKoABZWl1AH0qjCqPKnQAAKGDImVugyqHKnEA8aCHIkYqZQBxAPGgiyJwKm0AAKDIKgABYnCTKpUqAKDUKgCg1iqAAUFhbgCdKqEqrCpyAHIAAKDZIXIAAAFocqYqqCrrAJUab6CZIfcAxQf3IWFyAKAqKWwAaQBnADuA3wDfQOELzyrZKtwq6SrsKvEqAAD1KjQrAAAAAAAAAAAAAEwrbCsAAHErvSsAAAAAAADRK3IC1CoAAAAA2CrnIWV0AKAWI8RjcgDrAOUKgAFhZXkA4SrkKucq8iFvbmVh5CFpbGNhQmRvAPQAIg5sInJlYwAAoBUjcgAA4DXYMd0AAmVpa2/7KhIrKCsuK/IBACsAAAkrZQAAATRm6g0EK28AcgDlAOsNYQBzorgDECsAAAAAEit5AG0A0WMAAWNuFislK2sAAAFhcxsrIStwAHAAcgBvAPgAFw5pAG0AAKA8InMA8AD9DQABYXMsKyEr8AAXDnIAbgA7gP4A/kDsATgrOyswG2QA5QBnAmUAcwCAgdcAO2JkAEMrRCtJK9dAYaCgInIAAKAxKgCgMCqAAWVwcwBRK1MraSvhAAkh4qKkIlsrXysAAAAAYytvAHQAAKA2I2kAcgAAoPEqb+A12GXdcgBrAACg2irhAHgociJpbWUAAKA0IIABYWlwAHYreSu3K2QA5QC+DYADYWRlbXBzdACFK6MrmiunK6wrsCuzK24iZ2xlAACitSVkbHFykCuUK5ornCvvIXduAKC/JeUhZnRloMMl8QACBwCgXCJpImdodABloLkl8QBdDG8AdAAAoOwlaSJudXMAAKA6KuwhdXMAoDkqYgAAoM0p6SFtZQCgOyrlInppdW0AoOIjgAFjaHQAwivKK80rAAFyecYrySsA4DXYydxGZGMAeQBbZPIhb2tnYQABaW/UK9creAD0ANERaCJlYWQAAAFsct4r5ytlAGYAdABhAHIAcgBvAPcAXQbpJGdodGFycm93AKCgIQAJQUhhYmNkZmdobG1vcHJzdHV3CiwNLBEsHSwnLDEsQCxLLFIsYix6LIQsjyzLLOgs7Sz/LAotcgDyAAkDYQByAACgYykAAWNyFSwbLHUAdABlADuA+gD6QPIACQ1yAOMBIywAACUseQBeZHYAZQBtYQABaXkrLDAscgBjADuA+wD7QENkgAFhYmgANyw6LD0scgDyANEO7CFhY3FhYQDyAOAOAAFpckQsSCzzIWh0AKB+KQDgNdgy3XIAYQB2AGUAO4D5APlAYQFWLF8scgAAAWxyWixcLACgvyEAoL4hbABrAACggCUAAWN0Zix2LG8CbCwAAAAAcyxyAG4AZaAcI3IAAKAcI28AcAAAoA8jcgBpAACg+CUAAWFsfiyBLGMAcgBrYTuAqACoQAABZ3CILIssbwBuAHNhZgAA4DXYZt0AA2FkaGxzdZksniynLLgsuyzFLHIAcgBvAPcACQ1vAHcAbgBhAHIAcgBvAPcA2A5hI3Jwb29uAAABbHKvLLMsZQBmAPQAWyxpAGcAaAD0AF0sdQDzAKYOaQAAocUDaGzBLMIs0mNvAG4AxWPwI2Fycm93cwCgyCGAAWNpdADRLOEs5CxvAtcsAAAAAN4scgBuAGWgHSNyAACgHSNvAHAAAKAOI24AZwBvYXIAaQAAoPklYwByAADgNdjK3IABZGlyAPMs9yz6LG8AdAAAoPAi7CFkZWlhaQBmoLUlAKC0JQABYW0DLQYtcgDyAMosbAA7gPwA/EDhIm5nbGUAoKcpgAdBQkRhY2RlZmxub3Byc3oAJy0qLTAtNC2bLZ0toS2/LcMtxy3TLdgt3C3gLfwtcgDyABADYQByAHag6CoAoOkqYQBzAOgA/gIAAW5yOC08LechcnQAoJwpgANla25wcnN0AJkpSC1NLVQtXi1iLYItYQBwAHAA4QAaHG8AdABoAGkAbgDnAKEXgAFoaXIAoSmzJFotbwBwAPQAdCVooJUh7wD4JgABaXVmLWotZwBtAOEAuygAAWJwbi14LXMjZXRuZXEAceCKIgD+AODLKgD+cyNldG5lcQBx4IsiAP4A4MwqAP4AAWhyhi2KLWUAdADhABIraSNhbmdsZQAAAWxyki2WLeUhZnQAoLIiaSJnaHQAAKCzInkAMmThIXNoAKCiIoABZWxyAKcttC24LWKiKCKuLQAAAACyLWEAcgAAoLsicQAAoFoi7CFpcACg7iIAAWJ0vC1eD2EA8gBfD3IAAOA12DPddAByAOkAlS1zAHUAAAFicM0t0C0A4IIi0iAA4IMi0iBwAGYAAOA12GfdcgBvAPAAWQt0AHIA6QCaLQABY3XkLegtcgAA4DXYy9wAAWJw7C30LW4AAAFFZXUt8S0A4IoiAP5uAAABRWV/LfktAOCLIgD+6SJnemFnAKCaKYADY2Vmb3BycwANLhAuJS4pLiMuLi40LukhcmN1YQABZGkULiEuAAFiZxguHC5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg`),xu;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.FLAG13=8192]=`FLAG13`,e[e.BRANCH_LENGTH=8064]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(xu||={});var Su;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(Su||={});var Cu=32;function wu(e){return e>=Su.ZERO&&e<=Su.NINE}function Tu(e){return e>=Su.UPPER_A&&e<=Su.UPPER_F||e>=Su.LOWER_A&&e<=Su.LOWER_F}function Eu(e){return e>=Su.UPPER_A&&e<=Su.UPPER_Z||e>=Su.LOWER_A&&e<=Su.LOWER_Z||wu(e)}function Du(e){return e===Su.EQUALS||Eu(e)}var Ou;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(Ou||={});var ku;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(ku||={});var Au=class{decodeTree;emitCodePoint;errors;constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n}state=Ou.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=ku.Strict;runConsumed=0;startEntity(e){this.decodeMode=e,this.state=Ou.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(e,t){switch(this.state){case Ou.EntityStart:return e.charCodeAt(t)===Su.NUM?(this.state=Ou.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=Ou.NamedEntity,this.stateNamedEntity(e,t));case Ou.NumericStart:return this.stateNumericStart(e,t);case Ou.NumericDecimal:return this.stateNumericDecimal(e,t);case Ou.NumericHex:return this.stateNumericHex(e,t);case Ou.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|Cu)===Su.LOWER_X?(this.state=Ou.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=Ou.NumericDecimal,this.stateNumericDecimal(e,t))}stateNumericHex(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(wu(n)||Tu(n)){let e=n<=Su.NINE?n-Su.ZERO:(n|Cu)-Su.LOWER_A+10;this.result=this.result*16+e,this.consumed++,t++}else return this.emitNumericEntity(n,3)}return-1}stateNumericDecimal(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(wu(n))this.result=this.result*10+(n-Su.ZERO),this.consumed++,t++;else return this.emitNumericEntity(n,2)}return-1}emitNumericEntity(e,t){if(this.consumed<=t)return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Su.SEMI)this.consumed+=1;else if(this.decodeMode===ku.Strict)return 0;return this.emitCodePoint(vu(this.result),this.consumed),this.errors&&(e!==Su.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&xu.VALUE_LENGTH)>>14;for(;t<e.length;){if(i===0&&(r&xu.FLAG13)!==0){let a=(r&xu.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let n=r&xu.JUMP_TABLE;if(e.charCodeAt(t)!==n)return this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}for(;this.runConsumed<a;){if(t>=e.length)return-1;let r=this.runConsumed-1,i=n[this.treeIndex+1+(r>>1)],a=r%2==0?i&255:i>>8&255;if(e.charCodeAt(t)!==a)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(a>>1),r=n[this.treeIndex],i=(r&xu.VALUE_LENGTH)>>14}if(t>=e.length)break;let a=e.charCodeAt(t);if(a===Su.SEMI&&i!==0&&(r&xu.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);if(this.treeIndex=Mu(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===ku.Attribute&&(i===0||Du(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&xu.VALUE_LENGTH)>>14,i!==0){if(a===Su.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==ku.Strict&&(r&xu.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}t++,this.excess++}return-1}emitNotTerminatedNamedEntity(){let{result:e,decodeTree:t}=this,n=(t[e]&xu.VALUE_LENGTH)>>14;return this.emitNamedEntityData(e,n,this.consumed),this.errors?.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~(xu.VALUE_LENGTH|xu.FLAG13):r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){switch(this.state){case Ou.NamedEntity:return this.result!==0&&(this.decodeMode!==ku.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ou.NumericDecimal:return this.emitNumericEntity(0,2);case Ou.NumericHex:return this.emitNumericEntity(0,3);case Ou.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ou.EntityStart:return 0}}};function ju(e){let t=``,n=new Au(e,e=>t+=String.fromCodePoint(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function Mu(e,t,n,r){let i=(t&xu.BRANCH_LENGTH)>>7,a=t&xu.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=i+1>>1,s=0,c=i-1;for(;s<=c;){let t=s+c>>>1,i=e[n+(t>>1)]>>(t&1)*8&255;if(i<r)s=t+1;else if(i>r)c=t-1;else return e[n+o+t]}return-1}var Nu=ju(bu);function Pu(e,t=ku.Legacy){return Nu(e,t)}var Fu=tu(gu(),1),Iu={};function Lu(e){let t=Iu[e];if(t)return t;t=Iu[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function Ru(e,t){typeof t!=`string`&&(t=Ru.defaultChars);let n=Lu(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;t+=e<128?`��`:String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;t+=e<2048||e>=55296&&e<=57343?`���`:String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}Ru.defaultChars=`;/?:@&=+$,#`,Ru.componentChars=``;var zu=Ru,Bu={};function Vu(e){let t=Bu[e];if(t)return t;t=Bu[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function Hu(e,t,n){typeof t!=`string`&&(n=t,t=Hu.defaultChars),n===void 0&&(n=!0);let r=Vu(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}Hu.defaultChars=`;/?:@&=+$,-_.!~*'()#`,Hu.componentChars=`-_.!~*'()`;var Uu=Hu;function Wu(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function Gu(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var Ku=/^([a-z0-9.+-]+:)/i,qu=/:[0-9]*$/,Ju=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Yu=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
|
|
17
|
-
`,` `],Xu=[`/`,`?`,`#`],Zu=255,Qu=/^[+a-z0-9A-Z_-]{0,63}$/,$u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ed={javascript:!0,"javascript:":!0},td={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function nd(e,t){if(e&&e instanceof Gu)return e;let n=new Gu;return n.parse(e,t),n}Gu.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=Ju.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=Ku.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&ed[o])&&(a=a.substr(2),this.slashes=!0)),!ed[o]&&(i||o&&!td[o])){let e=-1;for(let t=0;t<Xu.length;t++)r=a.indexOf(Xu[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<Yu.length;t++)r=a.indexOf(Yu[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(Qu)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(Qu)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match($u);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>Zu&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),td[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},Gu.prototype.parseHost=function(e){let t=qu.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var rd=nd,id=$l({decode:()=>zu,encode:()=>Uu,format:()=>Wu,parse:()=>rd}),ad=Object.defineProperty,od=e=>{let t={};for(var n in e)ad(t,n,{get:e[n],enumerable:!0});return t},sd=class{type;tag;attrs;map;nesting;level;children;content;markup;info;meta;block;hidden;constructor(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content=``,this.markup=``,this.info=``,this.meta=null,this.block=!1,this.hidden=!1}attrIndex(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1}attrPush(e){this.attrs?this.attrs.push(e):this.attrs=[e]}attrSet(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r}attrGet(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},cd=od({arrayReplaceAt:()=>Sd,assign:()=>md,countLines:()=>zd,escapeHtml:()=>Fd,escapeRE:()=>Ld,fromCodePoint:()=>wd,has:()=>pd,isMdAsciiPunct:()=>bd,isPunctChar:()=>_d,isPunctCode:()=>yd,isSpace:()=>hd,isString:()=>dd,isValidEntityCode:()=>Cd,isWhiteSpace:()=>gd,lib:()=>Rd,mdurl:()=>id,normalizeReference:()=>xd,ucmicro:()=>ld,unescapeAll:()=>Ad,unescapeMd:()=>kd}),ld={Any:/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Cc:/[\0-\x1F\x7F-\x9F]/,Cf:/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,P:/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,S:/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,Z:/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/};function ud(e){return Object.prototype.toString.call(e)}function dd(e){return ud(e)===`[object String]`}var fd=Object.prototype.hasOwnProperty;function pd(e,t){return fd.call(e,t)}function md(e,...t){return t.forEach(t=>{if(t){if(typeof t!=`object`)throw TypeError(`${String(t)}must be object`);Object.keys(t).forEach(n=>{e[n]=t[n]})}}),e}function hd(e){return e===9||e===32}function gd(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function _d(e){return ld.P.test(e)||ld.S.test(e)}var vd=new Map;function yd(e){if(bd(e))return!0;if(e>=0&&e<128)return!1;let t=vd.get(e);if(t!==void 0)return t;let n=_d(String.fromCharCode(e));return vd.set(e,n),n}function bd(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function xd(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function Sd(e,t,n){return[...e.slice(0,t),...n,...e.slice(t+1)]}function Cd(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function wd(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var Td=/\\([!"#$%&'()*+,\-\./:;<=>?@[\\\]^_`{|}~])/g,Ed=RegExp(`${Td.source}|&([a-z#][a-z0-9]{1,31});`,`gi`),Dd=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Od(e,t){if(t.charCodeAt(0)===35&&Dd.test(t)){let n=t[1].toLowerCase()===`x`?Number.parseInt(t.slice(2),16):Number.parseInt(t.slice(1),10);return Cd(n)?wd(n):e}let n=Pu(e);return n===e?e:n}function kd(e){return e.includes(`\\`)?e.replace(Td,`$1`):e}function Ad(e){return!e.includes(`\\`)&&!e.includes(`&`)?e:e.replace(Ed,(e,t,n)=>t||Od(e,n))}var jd=/[&<>"]/,Md=/[&<>"]/g,Nd={"&":`&`,"<":`<`,">":`>`,'"':`"`};function Pd(e){return Nd[e]}function Fd(e){return jd.test(e)?e.replace(Md,Pd):e}var Id=/[.?*+^$[\]\\(){}|-]/g;function Ld(e){return e.replace(Id,`\\$&`)}var Rd={mdurl:id,ucmicro:ld};function zd(e){if(e.length===0)return 0;let t=0,n=-1;for(;(n=e.indexOf(`
|
|
18
|
-
`,n+1))!==-1;)t++;return t}var Bd=/(?:^|\n)[ \t]{0,3}\[\^[^\]\n]+\]:/m,Vd=/(?:^|\n)[ \t]{0,3}\*\[[^\]\n]+\]:/m,Hd=[`references`,`footnotes`,`abbreviations`,`abbr`,`abbrs`],Ud=Symbol.for(`markdown-it-ts.global-state`),Wd=Object.prototype.hasOwnProperty;function Gd(e){let t=e.length,n=0;for(;n<t;){let r=e.indexOf(`[`,n);if(r===-1)return!1;let i=0,a=r-1;for(;a>=0&&e.charCodeAt(a)!==10;){let t=e.charCodeAt(a);if(t===32||t===9){i++,a--;continue}break}if((a<0||e.charCodeAt(a)===10)&&i<=3&&e.charCodeAt(r+1)!==94){let i=r+1;if(i>=t||e.charCodeAt(i)===93){n=r+1;continue}for(;i<t;){let n=e.charCodeAt(i);if(n===93){let n=i+1;for(;n<t&&(e.charCodeAt(n)===32||e.charCodeAt(n)===9);)n++;if(n<t&&e.charCodeAt(n)===58)return!0;break}if(n===91)break;if(n===92){i+=2;continue}i++}}n=r+1}return!1}function Kd(e){return e===`reference-definition`||e===`footnote-definition`||e===`abbreviation-definition`}function qd(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Jd(e){if(Array.isArray(e))return e.map(e=>Jd(e));if(qd(e)){let t={};for(let n of Object.keys(e))t[n]=Jd(e[n]);return t}return e}function Yd(e){return Array.isArray(e)?e.map((e,t)=>String(t)):qd(e)?Object.keys(e):[]}function Xd(e,t){if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Xd(e[n],t[n]))return!1;return!0}if(qd(e)||qd(t)){if(!qd(e)||!qd(t))return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Wd.call(t,r)||!Xd(e[r],t[r]))return!1;return!0}return Object.is(e,t)}function Zd(e,t){if(Array.isArray(e))return e[Number(t)];if(qd(e))return e[t]}function Qd(e,t){if(Array.isArray(e)&&Array.isArray(t)){e.length=t.length;for(let n=0;n<t.length;n++)e[n]=Jd(t[n]);return e}if(qd(e)&&qd(t)){for(let n of Object.keys(e))Wd.call(t,n)||delete e[n];for(let n of Object.keys(t))e[n]=Jd(t[n]);return e}return Jd(t)}function $d(e,t,n){let r=n.ownedKeys??[],i=e[t];if(qd(i)||Array.isArray(i)){let a=new Set(Yd(n.value));for(let e of r)n.existed&&a.has(e)?i[e]=Jd(Zd(n.value,e)):delete i[e];!n.existed&&Yd(i).length===0&&delete e[t];return}n.existed?e[t]=Jd(n.value):delete e[t]}function ef(e){let t=e[Ud];return Kd(t)?{reason:t,snapshot:{}}:t&&typeof t==`object`&&Kd(t.reason)&&t.snapshot&&typeof t.snapshot==`object`?t:null}function tf(e,t){Object.defineProperty(e,Ud,{value:t,enumerable:!1,configurable:!0,writable:!0})}function nf(e){return!e||!e.includes(`]:`)&&!e.includes(`*[`)?null:Bd.test(e)?`footnote-definition`:Vd.test(e)?`abbreviation-definition`:Gd(e)?`reference-definition`:null}function rf(e){return ef(e)?.reason??null}function af(e,t,n){if(rf(e)&&cf(e),!t)return n();of(e,t);try{let t=n();return sf(e),t}catch(t){throw cf(e),t}}function of(e,t){try{cf(e);let n={};for(let t of Hd)n[t]=Wd.call(e,t)?{existed:!0,value:Jd(e[t])}:{existed:!1};tf(e,{reason:t,snapshot:n})}catch{}}function sf(e){let t=ef(e);if(t)for(let n of Hd){let r=t.snapshot[n];if(!r)continue;r.ownedKeys=[];let i=e[n];if(!qd(i)&&!Array.isArray(i))continue;let a=new Set(Yd(r.existed?r.value:void 0));r.ownedKeys=Yd(i).filter(e=>!a.has(e)||!Xd(i[e],Zd(r.value,e)))}}function cf(e){let t=ef(e);if(t){for(let n of Hd){let r=t.snapshot[n];if(!r){delete e[n];continue}if(r.ownedKeys){$d(e,n,r);continue}r.existed?e[n]=Qd(e[n],r.value):delete e[n]}delete e[Ud]}}function lf(e){return{area:e,attempted:!0,matched:!1,attemptMs:0,blocks:0,headings:0,paragraphs:0,lists:0,fences:0,paragraphCacheHits:0,paragraphCacheMisses:0,paragraphCacheBypasses:0,listCacheHits:0,listCacheMisses:0,fenceCacheHits:0,fenceCacheMisses:0}}var uf=Symbol.for(`markdown-it-ts.diagnostics`);function df(e,t){if(e)try{let n=e[uf];if(n&&typeof n==`object`)return n;if(!t)return;let r={};return e[uf]=r,r}catch{return}}function ff(e){return df(e,!1)}function pf(e){if(e)try{let t=e[uf];t&&typeof t==`object`&&(delete t.strategy,delete t.chunk,delete t.unbounded,delete t.editable,delete t.stockFast)}catch{}}function mf(e){pf(e)}function hf(e,t){let n=df(e,!0);n&&(n.stockFast=t)}function gf(e,t){let n=df(e,!0);n&&(n.strategy=t)}function _f(e,t){let n=df(e,!0);n&&(n.chunk=t)}function vf(e,t){let n=df(e,!0);n&&(n.unbounded=t)}var yf=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,bf=/[\0-\x1F\x7F-\x9F]/,xf=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,Sf=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,Cf=class{src_Any=yf.source;src_Cc=bf.source;src_Z=Sf.source;src_P=xf.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join(`|`);src_ZCc=[this.src_Z,this.src_Cc].join(`|`);cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}nestedPairRE(e,t,n=4){let r=this.escapeRE(e),i=this.escapeRE(t),a=`(?:(?!${this.src_ZCc}|${r}|${i}).)`,o=`${r}${a}{0,1000}${i}`;for(let e=2;e<=n;e++)o=`${r}(?:${a}|${o}){0,1000}${i}`;return o}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=RegExp(`(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])`)}get_ipv6_addr(){let e=`[0-9A-Fa-f]{1,4}`,t=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=RegExp(`(?:(?:${e}:){6}${t}|::(?:${e}:){5}${t}|(?:${e})?::(?:${e}:){4}${t}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${t}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${t}|(?:(?:${e}:){0,3}${e})?::${e}:${t}|(?:(?:${e}:){0,4}${e})?::${t}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=RegExp(`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`)}get_host_terminator(){return this.cache.src_host_terminator??=RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts[`---`]?`-(?!--)|`:`-|`}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=RegExp(`(?:[/?#](?:${this.nestedPairRE(`[`,`]`)}|${this.nestedPairRE(`(`,`)`)}|${this.nestedPairRE(`{`,`}`)}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts[`---`]?`\\-(?!--(?:[^-]|$))(?:-{0,19})|`:`\\-{1,20}|`)+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=RegExp(`xn--[a-z0-9\\-]{1,59}`)}get_tld(){if(this.cache.tld)return this.cache.tld;let e=[...new Set(this.opts.tlds||[])].sort().reverse().join(`|`);return this.cache.tld=RegExp(`${e||`$#none#$`}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=RegExp(`(?:`+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=RegExp(`(?:`+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=RegExp(`(?:`+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=RegExp(`(?:`+(this.opts.fuzzyIP?this.get_ipv4_addr().source+`|`:``)+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=RegExp(`(?:`+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=RegExp(`(?:`+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=RegExp(``)}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=RegExp(`@${this.get_fuzzy_mail_host().source}`,`ig`)}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${this.src_ZPCc}))(?:(?![$+<=>^\`|\uff5c])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,`ig`)}get_http_validator(){return this.cache.http_validator??=RegExp(`\\/\\/`+(this.opts.urlAuth?this.get_auth().source:``)+this.get_url_host_port().source+this.get_path().source,`iy`)}get_relative_proto_validator(){return this.cache.relative_proto_validator??=RegExp((this.opts.urlAuth?this.get_auth().source:``)+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,`iy`)}get_mail_name_validator(){return this.cache.mail_name_validator??=RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,`iy`)}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join(`|`))}get_schema_search(){return this.cache.schema_search??=RegExp(`(^|(?!_)(?:[><\uff5c]|${this.src_ZPCc}))(${this.get_schema_names().source})`,`ig`)}get_schema_at_start(){return this.cache.schema_at_start??=RegExp(`^${this.get_schema_search().source}`,`i`)}},wf={validate:(e,t,n)=>{let r=n.re.get_http_validator();r.lastIndex=t;let i=r.exec(e);return i?i[0].length:0},normalize:(e,t)=>t.normalize(e)},Tf={"http:":wf,"https:":wf,"ftp:":wf,"//":{validate:function(e,t,n){let r=n.re.get_relative_proto_validator();r.lastIndex=t;let i=r.exec(e);return i?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:i[0].length:0},normalize:(e,t)=>t.normalize(e)},"mailto:":{validate:function(e,t,n){let r=n.re.get_mailto_validator();r.lastIndex=t;let i=r.exec(e);return i?i[0].length:0},normalize:(e,t)=>t.normalize(e)}},Ef=`a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw`,Df=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`;function Of(){let e=Df.split(`|`);return Ef.split(`|`).forEach(t=>{let n=t.indexOf(`:`),r=t.slice(0,n);for(let i of t.slice(n+1))e.push(r+i)}),e}var kf={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Of(),urlAuth:!1,maxLength:1e4},Af=class{schema;index;lastIndex;raw;text;url;constructor(e,t,n,r){let i=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}},jf=class{__opts__;__schemas__;re;constructor(e={}){let{rebuilder:t,...n}=e;this.__opts__={...kf,...n},this.__schemas__={...Tf},this.re=t||new Cf,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,t=null){if(!t)delete this.__schemas__[e];else{let n={normalize:(e,t)=>t.normalize(e),...t};this.__schemas__[e]=n}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let t,n;for(n=this.re.get_schema_search(),n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__[`http:`]&&(n=this.re.get_fuzzy_link_search(),n.lastIndex=0,n.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__[`mailto:`]&&e.indexOf(`@`)>=0){let n=this.re.get_fuzzy_mail_host_search(),r=this.re.get_mail_name_validator();for(n.lastIndex=0;(t=n.exec(e))!==null;){let n=e.slice(Math.max(0,t.index-65),t.index);if(r.test(n))return!0}}return!1}testSchemaAt(e,t,n){return this.__schemas__[t.toLowerCase()]?this.__schemas__[t.toLowerCase()].validate(e.slice(0,n+this.__opts__.maxLength),n,this):0}match(e){let t=[],n=this.re.get_schema_search(),r,i,a,o,s,c,l=!1,u=!1,d=!1,f=0;if(!e.length)return null;for(n.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__[`http:`]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__[`mailto:`]&&(i=this.re.get_fuzzy_mail_host_search(),i.lastIndex=0,a=this.re.get_mail_name_validator());;){let p=Math.max(f-1,0);if(i&&a&&!d&&(!s||s.index<f))for(i.lastIndex<p&&(i.lastIndex=p);;){let t=i.exec(e);if(!t){d=!0,s=void 0;break}let n=a.exec(e.slice(Math.max(0,t.index-65),t.index));if(n){if(s={schema:`mailto:`,index:t.index-n[1].length,lastIndex:t.index+t[0].length},s.index>=f)break;i.lastIndex<p&&(i.lastIndex=p)}}if(r&&!u&&(!o||o.index<f))for(r.lastIndex<p&&(r.lastIndex=p);;){let t=r.exec(e);if(!t){u=!0,o=void 0;break}if(o={schema:``,index:t.index+t[1].length,lastIndex:t.index+t[0].length},o.index>=f)break;r.lastIndex<p&&(r.lastIndex=p)}let m=s;(!m||o&&(o.index<m.index||o.index===m.index&&o.lastIndex>m.lastIndex))&&(m=o);let h;if(!l)for(;;){if(!c){n.lastIndex<p&&(n.lastIndex=p);let t=n.exec(e);if(!t){l=!0;break}c={schema:t[2],index:t.index+t[1].length,lastIndex:t.index+t[0].length}}if(c.index<f){c=void 0;continue}if(m&&c.index>m.index)break;let t=c;c=void 0;let r=this.testSchemaAt(e,t.schema,t.lastIndex);if(r){h={schema:t.schema,index:t.index,lastIndex:t.lastIndex+r};break}}let g=h;if((!g||s&&(s.index<g.index||s.index===g.index&&s.lastIndex>g.lastIndex))&&(g=s),(!g||o&&(o.index<g.index||o.index===g.index&&o.lastIndex>g.lastIndex))&&(g=o),!g)break;g===s?s=void 0:g===o&&(o=void 0);let _=new Af(e,g.schema,g.index,g.lastIndex);_.schema?this.__schemas__[_.schema].normalize(_,this):this.normalize(_),t.push(_),f=g.lastIndex}return t.length?t:null}matchAtStart(e){if(!e.length)return null;let t=this.re.get_schema_at_start().exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;let r=new Af(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__schemas__[r.schema].normalize(r,this),r}tlds(e,t=!1){return e=Array.isArray(e)?e:[e],t?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}},Mf=tu(Ql({"../../node_modules/.pnpm/punycode.js@2.3.1/node_modules/punycode.js/punycode.js":((e,t)=>{let n=2147483647,r=/^xn--/,i=/[^\0-\x7F]/,a=/[\x2E\u3002\uFF0E\uFF61]/g,o={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},s=Math.floor,c=String.fromCharCode;function l(e){throw RangeError(o[e])}function u(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function d(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(a,`.`);let i=u(e.split(`.`),t).join(`.`);return r+i}function f(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}let p=e=>String.fromCodePoint(...e),m=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:36},h=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},g=function(e,t,n){let r=0;for(e=n?s(e/700):e>>1,e+=s(e/t);e>455;r+=36)e=s(e/35);return s(r+36*e/(e+38))},_=function(e){let t=[],r=e.length,i=0,a=128,o=72,c=e.lastIndexOf(`-`);c<0&&(c=0);for(let n=0;n<c;++n)e.charCodeAt(n)>=128&&l(`not-basic`),t.push(e.charCodeAt(n));for(let u=c>0?c+1:0;u<r;){let c=i;for(let t=1,a=36;;a+=36){u>=r&&l(`invalid-input`);let c=m(e.charCodeAt(u++));c>=36&&l(`invalid-input`),c>s((n-i)/t)&&l(`overflow`),i+=c*t;let d=a<=o?1:a>=o+26?26:a-o;if(c<d)break;let f=36-d;t>s(n/f)&&l(`overflow`),t*=f}let d=t.length+1;o=g(i-c,d,c==0),s(i/d)>n-a&&l(`overflow`),a+=s(i/d),i%=d,t.splice(i++,0,a)}return String.fromCodePoint(...t)},v=function(e){let t=[];e=f(e);let r=e.length,i=128,a=0,o=72;for(let n of e)n<128&&t.push(c(n));let u=t.length,d=u;for(u&&t.push(`-`);d<r;){let r=n;for(let t of e)t>=i&&t<r&&(r=t);let f=d+1;r-i>s((n-a)/f)&&l(`overflow`),a+=(r-i)*f,i=r;for(let r of e)if(r<i&&++a>n&&l(`overflow`),r===i){let e=a;for(let n=36;;n+=36){let r=n<=o?1:n>=o+26?26:n-o;if(e<r)break;let i=e-r,a=36-r;t.push(c(h(r+i%a,0))),e=s(i/a)}t.push(c(h(e,0))),o=g(a,f,d===u),a=0,++d}++a,++i}return t.join(``)};t.exports={version:`2.3.1`,ucs2:{decode:f,encode:p},decode:_,encode:v,toASCII:function(e){return d(e,function(e){return i.test(e)?`xn--`+v(e):e})},toUnicode:function(e){return d(e,function(e){return r.test(e)?_(e.slice(4).toLowerCase()):e})}}})})(),1);function Nf(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=Ad(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=Ad(e.slice(t,i)),a.pos=i,a.ok=!0,a)}var Pf=Nf,Ff=-2;function If(e,t,n,r){let i=1,a=t+1;for(;a<n;){let t=e.charCodeAt(a);if(t===93){if(i--,i===0)return a;if(r){let t=a+1<n?e.charCodeAt(a+1):0;if(t===40||t===91)return Ff}a++;continue}if(t===92){a+=2;continue}if(t===96||t===60||t===33&&a+1<n&&e.charCodeAt(a+1)===91)return Ff;if(t===91){i++,a++;continue}a++}return-1}function Lf(e,t,n){let r=1,i=!1,a,o,s=e.src,c=e.posMax,l=e.pos,u=e.linkLabelNoCloseFrom;if(u>=0&&t+1>=u)return-1;let d=s.indexOf(`]`,t+1);if(d<0||d>=c)return e.linkLabelNoCloseFrom=t+1,-1;let f=If(s,t,c,n);if(f!==Ff)return f;for(e.pos=t+1;e.pos<c;){if(a=s.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=l,-1}}let p=-1;return i&&(p=e.pos),e.pos=l,p}var Rf=Lf;function zf(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=Ad(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=Ad(e.slice(t,a)),o}var Bf=zf;function Vf(e,t){if(!e.attrs)return-1;for(let n=0;n<e.attrs.length;n++)if(e.attrs[n][0]===t)return n;return-1}function Hf(e,t){e.attrs||=[],e.attrs.push(t)}function Uf(e,t,n){let r=Vf(e,t),i=[t,n];r<0?Hf(e,i):e.attrs[r]=i}function Wf(e,t){let n=Vf(e,t);return n>=0?e.attrs[n][1]:null}function Gf(e,t,n){let r=Vf(e,t);r<0?Hf(e,[t,n]):e.attrs[r][1]=`${e.attrs[r][1]} ${n}`}var Kf=od({attrGet:()=>Wf,attrIndex:()=>Vf,attrJoin:()=>Gf,attrPush:()=>Hf,attrSet:()=>Uf,parseLinkDestination:()=>Nf,parseLinkLabel:()=>Lf,parseLinkTitle:()=>zf});function qf(e){return e.includes(`\r`)||e.includes(`\0`)}function Jf(e){return typeof e==`string`?e:e.toString()}function Yf(e){if(e.inlineMode){let t=new sd(`inline`,``,0);t.content=Jf(e.src),t.map=[0,1],t.children=[],t.level=0,e.tokens.push(t)}else e.md&&e.md.block&&e.md.block.parse(e.src,e.md,e.env,e.tokens)}var Xf=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Zf=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Qf(e,t){let n=e.pos,r=e.src;if(r.charCodeAt(n)!==60)return!1;let i=n,a=e.posMax;for(;;){if(++n>=a)return!1;let e=r.charCodeAt(n);if(e===60)return!1;if(e===62)break}let o=r.slice(i+1,n);if(Zf.test(o)){let n=e.md.normalizeLink(o);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(o);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=o.length+2,!0}if(Xf.test(o)){let n=e.md.normalizeLink(`mailto:${o}`);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(o);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=o.length+2,!0}return!1}var $f=Qf;function ep(e,t){let n=e.src,r=e.pos;if(n.charCodeAt(r)!==96)return!1;let i=r;r++;let a=e.posMax;for(;r<a&&n.charCodeAt(r)===96;)r++;let o=n.slice(i,r),s=o.length;if(e.backticksScanned&&(e.backticks[s]||0)<=i)return t||(e.pending+=o),e.pos+=s,!0;let c=r,l;for(;(l=n.indexOf("`",c))!==-1;){for(c=l+1;c<a&&n.charCodeAt(c)===96;)c++;let i=c-l;if(i===s){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=o;let i=n.slice(r,l);i.includes(`
|
|
19
|
-
`)&&(i=i.replace(/\n/g,` `)),i.length>2&&i.charCodeAt(0)===32&&i.charCodeAt(i.length-1)===32&&(i=i.slice(1,-1)),t.content=i}return e.pos=c,!0}e.backticks[i]=l}return e.backticksScanned=!0,t||(e.pending+=o),e.pos+=s,!0}var tp=ep;function np(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;Object.prototype.hasOwnProperty.call(t,n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function rp(e){let t=e.tokens_meta,n=e.tokens_meta.length;np(e.delimiters);for(let e=0;e<n;e++)t[e]&&t[e].delimiters&&np(t[e].delimiters)}var ip=rp,ap=`*`,op=`_`;function sp(e,t){if(t)return!1;let n=e.src.charCodeAt(e.pos);if(n!==95&&n!==42)return!1;let r=e.scanDelims(e.pos,n===42);if(!r||r.length===0)return!1;let i=n===42?ap:op,a=r.length,o=r.can_open,s=r.can_close,c=e.tokens,l=e.delimiters;for(let t=0;t<a;t++){let t=e.push(`text`,``,0);t.content=i,l.push({marker:n,length:a,token:c.length-1,end:-1,open:o,close:s})}return e.pos+=a,!0}function cp(e,t){let n=t.length,r=e.tokens;for(let e=n-1;e>=0;e--){let n=t[e],i=n.marker;if(i!==95&&i!==42||n.end===-1)continue;let a=t[n.end],o=n.token,s=a.token,c=e>0&&t[e-1].end===n.end+1&&t[e-1].marker===i&&t[e-1].token===o-1&&t[n.end+1].token===s+1,l=i===42?ap:op,u=r[o];c?(u.type=`strong_open`,u.tag=`strong`,u.nesting=1,u.markup=l+l,u.content=``):(u.type=`em_open`,u.tag=`em`,u.nesting=1,u.markup=l,u.content=``);let d=r[s];c?(d.type=`strong_close`,d.tag=`strong`,d.nesting=-1,d.markup=l+l,d.content=``):(d.type=`em_close`,d.tag=`em`,d.nesting=-1,d.markup=l,d.content=``),c&&(r[t[e-1].token].content=``,r[t[n.end+1].token].content=``,e--)}}function lp(e){let t=e.tokens_meta,n=e.tokens_meta.length;cp(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&cp(e,t[r].delimiters)}var up={tokenize:sp,postProcess:lp};function dp(e){return Pu(e)}function fp(e){return e>=48&&e<=57}function pp(e){let t=e|32;return fp(e)||t>=97&&t<=102}function mp(e){let t=e|32;return t>=97&&t<=122}function hp(e){return mp(e)||fp(e)}function gp(e,t,n){let r=t+2;if(r>=n)return null;let i=!1,a=7,o=r;for((e.charCodeAt(r)|32)==120&&(i=!0,a=6,r++,o=r);r<n&&r-o<a;){let t=e.charCodeAt(r);if(!(i?pp(t):fp(t)))break;r++}return r===o||r>=n||e.charCodeAt(r)!==59?null:e.slice(t,r+1)}function _p(e,t,n){let r=t+1;if(r>=n||!mp(e.charCodeAt(r)))return null;for(r++;r<n&&r-t-1<32&&hp(e.charCodeAt(r));)r++;if(r-t-1<2||r>=n||e.charCodeAt(r)!==59)return null;let i=e.slice(t,r+1);return dp(i)===i?null:i}function vp(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let i=gp(e.src,n,r);if(i){if(!t){let t=(i.charCodeAt(2)|32)==120?Number.parseInt(i.slice(3,-1),16):Number.parseInt(i.slice(2,-1),10),n=e.push(`text_special`,``,0);n.content=Cd(t)?wd(t):wd(65533),n.markup=i,n.info=`entity`}return e.pos+=i.length,!0}}else{let i=_p(e.src,n,r);if(i){let n=dp(i);if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=i,t.info=`entity`}return e.pos+=i.length,!0}}return!1}var yp=vp,bp=(()=>{let e=Array(256).fill(0);for(let t=0;t<32;t++)e[`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.charCodeAt(t)]=1;return e})(),xp=Array(128),Sp=Array(128);for(let e=0;e<128;e++){let t=String.fromCharCode(e);xp[e]=`\\${t}`,Sp[e]=bp[e]?t:xp[e]}function Cp(e,t,n){e.pending&&e.pushPending();let r=new sd(`text_special`,``,0);r.level=e.level,r.content=t,r.markup=n,r.info=`escape`,e.pendingLevel=e.level,e.tokens.push(r),e.tokens_meta.push(null)}function wp(e,t){let n=e.pos,r=e.posMax,i=e.src;if(i.charCodeAt(n)!==92||(n++,n>=r))return!1;let a=i.charCodeAt(n);if(a===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(a=i.charCodeAt(n),a===9||a===32);)n++;return e.pos=n,!0}if(a<128)return t?(e.pos=n+1,!0):(Cp(e,Sp[a],xp[a]),e.pos=n+1,!0);if(t){if(a>=55296&&a<=56319&&n+1<r){let e=i.charCodeAt(n+1);e>=56320&&e<=57343&&n++}return e.pos=n+1,!0}let o=i.charAt(n);if(a>=55296&&a<=56319&&n+1<r){let e=i.charCodeAt(n+1);e>=56320&&e<=57343&&(o+=i.charAt(n+1),n++)}let s=`\\${o}`;return Cp(e,a<256&&bp[a]?o:s,s),e.pos=n+1,!0}var Tp=wp;function Ep(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++){let e=i[t];e&&(e.nesting&&e.nesting<0&&r--,e.level=r,e.nesting&&e.nesting>0&&r++,e.type===`text`&&t+1<a&&i[t+1]?.type===`text`?i[t+1].content=e.content+i[t+1].content:(t!==n&&(i[n]=e),n++))}t!==n&&(i.length=n)}var Dp=Ep,Op=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,kp=`<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>`,Ap=RegExp(`^(?:${Op}|${kp}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<\\?[\\s\\S]*?\\?>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),jp=RegExp(`^(?:${Op}|${kp})`);function Mp(e){return e===32||e===9||e===10||e===12||e===13}function Np(e){if(e.length<3||e.charCodeAt(0)!==60||(e.charCodeAt(1)|32)!=97)return!1;let t=e.charCodeAt(2);return t===62||Mp(t)}function Pp(e){if(e.length<4||e.charCodeAt(0)!==60||e.charCodeAt(1)!==47||(e.charCodeAt(2)|32)!=97)return!1;for(let t=3;t<e.length;t++){let n=e.charCodeAt(t);if(n===62)return!0;if(!Mp(n))return!1}return!1}function Fp(e){let t=e|32;return t>=97&&t<=122}function Ip(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos,i=e.src;if(i.charCodeAt(r)!==60||r+2>=n)return!1;let a=i.charCodeAt(r+1);if(a!==33&&a!==63&&a!==47&&!Fp(a))return!1;let o=i.slice(r).match(Ap);if(!o)return!1;let s=o[0];if(!t){let t=e.pushSimple(`html_inline`,``);t.content=s,Np(s)&&e.linkLevel++,Pp(s)&&e.linkLevel--}return e.pos+=s.length,!0}var Lp=Ip;function Rp(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=Rf(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),n===32||n===10);a++);if(a>=f)return!1;if(s=Pf(e.src,a,e.posMax),s.ok){for(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``,l=a;a<f&&(n=e.src.charCodeAt(a),n===32||n===10);a++);if(s=Bf(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),n===32||n===10);a++);else c=``}if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=Rf(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),o=e.env.references[xd(i)],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0);n.attrs=[[`src`,u],[`alt`,``]],n.children=t,n.content=r,c&&n.attrs.push([`title`,c])}return e.pos=a,e.posMax=f,!0}var zp=Rp;function Bp(e,t,n){for(;t<n;){let n=e.charCodeAt(t);if(n!==32&&n!==10)break;t++}return t}function Vp(e,t){if(e.src.charCodeAt(e.pos)!==91)return!1;let n=e.src,r=e.pos,i=e.posMax,a=e.pos+1,o=Rf(e,e.pos,!0);if(o<0)return!1;let s=o+1,c=``,l=``,u=!0;if(s<i&&n.charCodeAt(s)===40){s=Bp(n,s+1,i);let t=Pf(n,s,i);if(t.ok){let n=e.md.normalizeLink(t.str);e.md.validateLink(n)&&(c=n,s=t.pos,u=!1)}else s<i&&n.charCodeAt(s)===41&&(c=``,u=!1);if(!u){if(s=Bp(n,s,i),s<i&&n.charCodeAt(s)!==41){let e=Bf(n,s,i);e.ok&&(l=e.str,s=Bp(n,e.pos,i))}s<i&&n.charCodeAt(s)===41?s++:u=!0}}if(u){if(e.env.references===void 0)return!1;let t;if(s=o+1,s<i&&n.charCodeAt(s)===91){let r=s+1,i=Rf(e,s);i>=0?(t=n.slice(r,i),t||=n.slice(a,o),s=i+1):t=n.slice(a,o)}else t=n.slice(a,o);let u=e.env.references[xd(t)];if(!u)return e.pos=r,!1;c=u.href,l=u.title}if(!t){e.pos=a,e.posMax=o;let t=e.push(`link_open`,`a`,1);t.attrs=l?[[`href`,c],[`title`,l]]:[[`href`,c]],e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=s,e.posMax=i,!0}var Hp=Vp;function Up(e){let t=e|32;return t>=97&&t<=122}function Wp(e){return e>=48&&e<=57}function Gp(e){return Up(e)||Wp(e)||e===43||e===45||e===46}function Kp(e){if(e.length===0)return null;let t=e.length-1;for(;t>=0&&Gp(e.charCodeAt(t));)t--;return t++,t>=e.length||!Up(e.charCodeAt(t))?null:e.slice(t)}function qp(e,t,n){let r=t;for(;r<n;){let t=e.charCodeAt(r);if(t<=32||t===127||t===60)break;r++}return e.slice(t,r)}function Jp(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=Kp(e.pending);if(!i)return!1;let a=qp(e.src,n-i.length,r),o=e.md.linkify.matchAtStart(a);if(!o)return!1;let s=o.url;if(s.length<=i.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-i.length,!0}function Yp(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t){if(r>=0&&e.pending.charCodeAt(r)===32){if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.pushSimple(`hardbreak`,`br`)}else e.pending=e.pending.slice(0,-1),e.pushSimple(`softbreak`,`br`)}else e.pushSimple(`softbreak`,`br`)}for(n++;n<i;){let t=e.src.charCodeAt(n);if(t!==9&&t!==32)break;n++}return e.pos=n,!0}var Xp=Yp;function Zp(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0);if(!i)return!1;let a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function Qp(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function $p(e){let t=e.delimiters;Qp(e,t);let n=e.tokens_meta;if(n)for(let t=0;t<n.length;t++)n[t]&&n[t].delimiters&&Qp(e,n[t].delimiters)}var em={tokenize:Zp,postProcess:$p},tm=new Uint8Array(256);for(let e of[10,33,35,36,37,38,42,43,45,58,60,61,62,64,91,92,93,94,95,96,123,125,126])tm[e]=1;function nm(e){return e<256&&tm[e]===1}function rm(e,t){let n=e.src,r=e.pos,i=e.posMax;if(r>=i||nm(n.charCodeAt(r)))return!1;let a=r+1;for(;a<i&&!nm(n.charCodeAt(a));)a++;return t||(e.pending+=a===r+1?n.charAt(r):n.slice(r,a)),e.pos=a,!0}var im=rm;function am(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function om(e){if(e.length===0)return 0;let t=e.slice().sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2==0?(t[n-1]+t[n])/2:t[n]}function sm(e,t){return{chain:e,name:t,calls:0,hits:0,inclusiveMs:0,medianMs:0,maxMs:0,normalCalls:0,normalHits:0,silentCalls:0,silentHits:0,samples:[]}}function cm(e){let t=e;if(!t)return null;if(t.__mdtsRuleProfile)return t.__mdtsRuleProfile;if(!t.__mdtsProfileRules)return null;let n=t.__mdtsProfileRules===!0?{}:t.__mdtsProfileRules,r={enabled:!0,fixture:n.fixture,mode:n.mode,startedAt:am(),records:Object.create(null)};return t.__mdtsRuleProfile=r,r}function lm(e,t,n,r,i,a){let o=cm(e);if(!o)return;let s=`${t}:${n}`,c=o.records[s]??(o.records[s]=sm(t,n));c.calls++,c.inclusiveMs+=r,r>c.maxMs&&(c.maxMs=r),c.samples.push(r),a?(c.silentCalls++,i&&c.silentHits++):(c.normalCalls++,i&&c.normalHits++),i&&c.hits++,o.completedAt=am()}function um(e){let t=cm(e);if(!t)return null;let n=Object.keys(t.records);for(let e=0;e<n.length;e++){let r=t.records[n[e]];r.medianMs=om(r.samples)}return t.completedAt=am(),t}var dm=class{rules=[];cache=null;namedCache=null;version=0;invalidateCache(){this.cache=null,this.namedCache=null,this.version++}push(e,t,n){let r=this.rules.findIndex(t=>t.name===e);r>=0&&this.rules.splice(r,1),this.rules.push({name:e,fn:t,alt:n?.alt||[],enabled:!0}),this.invalidateCache()}at(e,t,n){let r=this.rules.findIndex(t=>t.name===e);if(t===void 0){if(r<0)return;let e=this.rules[r];return Object.freeze({name:e.name,fn:e.fn,alt:e.alt?Object.freeze(e.alt.slice()):void 0,enabled:e.enabled})}if(r<0)throw Error(`Parser rule not found: ${e}`);this.rules[r].fn=t,n?.alt!==void 0&&(this.rules[r].alt=n.alt),this.invalidateCache()}before(e,t,n,r){let i=this.rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this.rules.findIndex(e=>e.name===t);a>=0&&this.rules.splice(a,1),this.rules.splice(i,0,{name:t,fn:n,alt:r?.alt||[],enabled:!0}),this.invalidateCache()}after(e,t,n,r){let i=this.rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this.rules.findIndex(e=>e.name===t);a>=0&&this.rules.splice(a,1),this.rules.splice(i+1,0,{name:t,fn:n,alt:r?.alt||[],enabled:!0}),this.invalidateCache()}enable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled||(this.rules[n].enabled=!0,i=!0)}return i&&this.invalidateCache(),r}disable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled&&(this.rules[n].enabled=!1,i=!0)}return i&&this.invalidateCache(),r}enableOnly(e){let t=new Set(e),n=!1;for(let e of this.rules){let r=t.has(e.name);e.enabled!==r&&(e.enabled=r,n=!0)}n&&this.invalidateCache()}getRules(e){let t=e||``;return this.cache||this.compileCache(),this.cache.get(t)??[]}getNamedRules(e){let t=e||``;return this.namedCache||this.compileCache(),this.namedCache.get(t)??[]}compileCache(){let e=new Set([``]);for(let t of this.rules)if(t.enabled&&t.alt)for(let n of t.alt)e.add(n);let t=new Map,n=new Map;for(let r of e){let e=[],i=[];for(let t of this.rules)t.enabled&&(r===``||t.alt?.includes(r))&&(e.push(t.fn),i.push({name:t.name,fn:t.fn}));t.set(r,e),n.set(r,i)}this.cache=t,this.namedCache=n}},fm=class{src;md;env;tokens;tokens_meta;pos;posMax;level;pending;pendingLevel;cache;delimiters;_prev_delimiters;backticks;backticksScanned;linkLevel;linkLabelNoCloseFrom;maxNesting;constructor(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=e.length,this.level=0,this.pending=``,this.pendingLevel=0,this.cache=[],this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0,this.linkLabelNoCloseFrom=-1,this.maxNesting=t.options.maxNesting}pushPending(){let e=new sd(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e}pushSimple(e,t){this.pending&&this.pushPending();let n=new sd(e,t,0);return n.level=this.level,this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(null),n}push(e,t,n){if(this.pending&&this.pushPending(),n===0)return this.pushSimple(e,t);let r=new sd(e,t,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r}scanDelims(e,t){let{src:n,posMax:r}=this,i=n.charCodeAt(e),a=e;for(;a<r&&n.charCodeAt(a)===i;)a++;let o=a-e,s=e>0?n.charCodeAt(e-1):32,c=a<r?n.charCodeAt(a):32,l=gd(s),u=gd(c),d=yd(s),f=yd(c),p=!u&&(!f||l||d),m=!l&&(!d||u||f);return{can_open:p&&(t||!m||d),can_close:m&&(t||!p||f),length:o}}};fm.prototype.Token=sd;var pm=/[\n!#$%&*+\-:<=>@[\]\\^_`{}~]/;function mm(e,t){switch(e.src.charCodeAt(e.pos)){case 10:return Xp(e,t);case 33:return zp(e,t);case 38:return yp(e,t);case 42:case 95:return up.tokenize(e,t);case 58:return e.md.options.linkify&&Jp(e,t);case 60:return $f(e,t)||Lp(e,t);case 91:return Hp(e,t);case 92:return Tp(e,t);case 96:return tp(e,t);case 126:return em.tokenize(e,t);default:return im(e,t)}}function hm(e){return!pm.test(e)}var gm=class{ruler;ruler2;cachedRulesVersion=-1;cachedRules=[];cachedRules2Version=-1;cachedRules2=[];defaultRulerVersion;defaultRuler2Version;constructor(){this.ruler=new dm,this.ruler2=new dm,this.ruler.push(`text`,im),this.ruler.push(`linkify`,Jp),this.ruler.push(`newline`,Xp),this.ruler.push(`escape`,Tp),this.ruler.push(`backticks`,tp),this.ruler.push(`strikethrough`,em.tokenize),this.ruler.push(`emphasis`,up.tokenize),this.ruler.push(`link`,Hp),this.ruler.push(`image`,zp),this.ruler.push(`autolink`,$f),this.ruler.push(`html_inline`,Lp),this.ruler.push(`entity`,yp),this.ruler2.push(`balance_pairs`,ip),this.ruler2.push(`strikethrough`,em.postProcess),this.ruler2.push(`emphasis`,up.postProcess),this.ruler2.push(`fragments_join`,Dp),this.defaultRulerVersion=this.ruler.version,this.defaultRuler2Version=this.ruler2.version}skipToken(e){let t=e.pos,n=this.getRules(),r=n.length,i=e.cache,a=i[t],o=!!e.env&&(Object.prototype.hasOwnProperty.call(e.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(e.env,`__mdtsProfileRules`));if(a!==void 0){e.pos=a;return}let s=!1;if(e.level<e.maxNesting){if(o){let n=this.ruler.getNamedRules(``);for(let i=0;i<r;i++){e.level++;let r=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();s=n[i].fn(e,!0);let a=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();if(lm(e.env,`inline`,n[i].name,a-r,!!s,!0),e.level--,s){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}}else if(this.isDefaultRuleset()){if(e.level++,s=mm(e,!0),e.level--,s&&t>=e.pos)throw Error(`inline rule didn't increment state.pos`)}else for(let i=0;i<r;i++)if(e.level++,s=n[i](e,!0),e.level--,s){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;s||e.pos++,i[t]=e.pos}tokenize(e){let t=this.getRules(),n=t.length,r=e.posMax;if(!(e.env&&(Object.prototype.hasOwnProperty.call(e.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(e.env,`__mdtsProfileRules`)))){let i=this.isDefaultRuleset();for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<e.maxNesting){if(i)o=mm(e,!1);else for(let r=0;r<n&&(o=t[r](e,!1),!o);r++);if(o&&a>=e.pos)throw Error(`inline rule didn't increment state.pos`)}if(o){if(e.pos>=r)break;continue}e.pending+=e.src.charAt(e.pos++)}e.pending&&e.pushPending();return}let i=this.ruler.getNamedRules(``);for(;e.pos<r;){let t=e.pos,a=!1;if(e.level<e.maxNesting)for(let r=0;r<n;r++){let n=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();a=i[r].fn(e,!1);let o=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();if(lm(e.env,`inline`,i[r].name,o-n,!!a,!1),a){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(a){if(e.pos>=r)break;continue}e.pending+=e.src.charAt(e.pos++)}e.pending&&e.pushPending()}isDefaultRuleset(){return this.ruler.version===this.defaultRulerVersion&&this.ruler2.version===this.defaultRuler2Version}parseSource(e,t,n,r){if(typeof e==`string`&&e.length>0&&this.isDefaultRuleset()&&hm(e)){let t=new sd(`text`,``,0);t.content=e,r.push(t);return}let i=new fm(e,t,n,r);this.tokenize(i);let a=this.getRules2(),o=a.length;if(!(i.env&&(Object.prototype.hasOwnProperty.call(i.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(i.env,`__mdtsProfileRules`)))){for(let e=0;e<o;e++)a[e](i,!1);return}let s=this.ruler2.getNamedRules(``);for(let e=0;e<o;e++){let t=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();s[e].fn(i,!1);let n=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();lm(i.env,`inline2`,s[e].name,n-t,!0,!1)}}parse(e,t,n,r){this.parseSource(e,t,n,r)}getRules(){return this.cachedRulesVersion!==this.ruler.version&&(this.cachedRules=this.ruler.getRules(``),this.cachedRulesVersion=this.ruler.version),this.cachedRules}getRules2(){return this.cachedRules2Version!==this.ruler2.version&&(this.cachedRules2=this.ruler2.getRules(``),this.cachedRules2Version=this.ruler2.version),this.cachedRules2}};function _m(e){let t=e.tokens,n=!!(e.md?.inline)?.isDefaultRuleset?.();for(let r=0,i=t.length;r<i;r++){let i=t[r];if(i.type===`inline`&&e.md){if(i.children||=[],n&&i.content.length>0&&hm(i.content)){let e=new sd(`text`,``,0);e.content=i.content,i.children.push(e);continue}e.md.inline.parse(i.content,e.md,e.env,i.children)}}}var vm=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,ym=/[0-9a-z]/i;function bm(e){return e.includes(`.`)||e.includes(`@`)||e.includes(`:`)}var xm=new WeakMap;function Sm(e){let t=e.re?.get_schema_search?.();if(!t)return!1;let n=xm.get(e);if(n&&n.schemaSearch===t)return n.safe;let r=e.__schemas__,i=!0;if(r){for(let e in r)if(e.charCodeAt(e.length-1)!==58){i=!1;break}}return xm.set(e,{schemaSearch:t,safe:i}),i}function Cm(e){return/^<a[>\s]/i.test(e)}function wm(e){return/^<\/a\s*>/i.test(e)}function Tm(e,t){if(t.schema||t.index!==0||!t.raw)return t;for(let n=1;n<t.raw.length;n++){let r=t.raw[n-1],i=t.raw[n];if(!vm.test(r)||!ym.test(i))continue;let a=t.raw.slice(n),o=e.match(a)?.[0];if(o&&o.index===0&&o.lastIndex===a.length)return{...o,index:t.index+n,lastIndex:t.index+n+o.lastIndex}}return t}function Em(e){let t=e.tokens;if(!e.md?.options?.linkify)return;let n=Sm(e.md.linkify),r=e=>!n||bm(e);for(let n=0;n<t.length;n++){let i=t[n];if(i.type!==`inline`||!r(i.content))continue;let a=i.children;a||(a=[],i.children=a);let o=0;for(let t=a.length-1;t>=0;t--){let n=a[t];if(n.type===`link_close`){for(t--;t>=0&&a[t].level!==n.level&&a[t].type!==`link_open`;)t--;continue}if(n.type===`html_inline`&&(Cm(n.content)&&o>0&&o--,wm(n.content)&&o++),o>0||n.type!==`text`||!r(n.content))continue;let i=n.content,s=(e.md.linkify.match(i)||[]).map(t=>Tm(e.md.linkify,t));if(s.length===0)continue;let c=[],l=n.level,u=0;s.length>0&&s[0].index===0&&t>0&&a[t-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t],r=e.md.normalizeLink(n.url);if(!e.md.validateLink(r))continue;let a=n.text;a=n.schema?n.schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:${a}`).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://${a}`).replace(/^http:\/\//,``);let o=n.index;if(o>u){let e=new sd(`text`,``,0);e.content=i.slice(u,o),e.level=l,c.push(e)}let d=new sd(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new sd(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new sd(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=n.lastIndex}if(u!==0){if(u<i.length){let e=new sd(`text`,``,0);e.content=i.slice(u),e.level=l,c.push(e)}a.splice(t,1,...c)}}}}var Dm=/\r\n?|\n/g,Om=/\0/g;function km(e){if(!e||typeof e.src!=`string`)return;let t=e.src,n=t.includes(`\r`),r=t.includes(`\0`);if(!n&&!r)return;let i=t;n&&(i=i.replace(Dm,`
|
|
20
|
-
`)),r&&(i=i.replace(Om,`�`)),e.src=i}var Am=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,jm=/\((?:c|tm|r)\)/i,Mm=/\((c|tm|r)\)/gi,Nm={c:`©`,r:`®`,tm:`™`};function Pm(e,t){return Nm[t.toLowerCase()]}function Fm(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(Mm,Pm)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function Im(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&Am.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function Lm(e){if(e.md?.options?.typographer)for(let t=e.tokens.length-1;t>=0;t--){let n=e.tokens[t];if(n.type!==`inline`)continue;let r=n.content||(Array.isArray(n.children)?n.children.map(e=>e.type===`text`?e.content:``).join(``):``);jm.test(r)&&Fm(n.children||[]),Am.test(r)&&Im(n.children||[])}}var Rm=class{rules=[];cache=null;namedCache=null;version=0;invalidateCache(){this.cache=null,this.namedCache=null,this.version++}push(e,t){let n=this.rules.findIndex(t=>t.name===e);n>=0&&this.rules.splice(n,1),this.rules.push({name:e,fn:t,enabled:!0}),this.invalidateCache()}at(e,t){let n=this.rules.findIndex(t=>t.name===e);if(n<0)throw Error(`Parser rule not found: ${e}`);this.rules[n].fn=t,this.invalidateCache()}before(e,t,n){let r=this.rules.findIndex(t=>t.name===e);if(r<0)throw Error(`Parser rule not found: ${e}`);let i=this.rules.findIndex(e=>e.name===t);i>=0&&this.rules.splice(i,1),this.rules.splice(r,0,{name:t,fn:n,enabled:!0}),this.invalidateCache()}after(e,t,n){let r=this.rules.findIndex(t=>t.name===e);if(r<0)throw Error(`Parser rule not found: ${e}`);let i=this.rules.findIndex(e=>e.name===t);i>=0&&this.rules.splice(i,1),this.rules.splice(r+1,0,{name:t,fn:n,enabled:!0}),this.invalidateCache()}enable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled||(this.rules[n].enabled=!0,i=!0)}return i&&this.invalidateCache(),r}disable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;for(let e of n){let n=this.rules.findIndex(t=>t.name===e);if(n<0){if(!t)throw Error(`Rules manager: invalid rule name ${e}`);continue}r.push(e),this.rules[n].enabled&&(this.rules[n].enabled=!1,i=!0)}return i&&this.invalidateCache(),r}enableOnly(e){let t=new Set(e),n=!1;for(let e of this.rules){let r=t.has(e.name);e.enabled!==r&&(e.enabled=r,n=!0)}n&&this.invalidateCache()}compileCache(){this.cache=this.rules.filter(e=>e.enabled).map(e=>e.fn),this.namedCache=this.rules.filter(e=>e.enabled).map(e=>({name:e.name,fn:e.fn}))}getRules(e=``){return this.cache||this.compileCache(),this.cache}getNamedRules(e=``){return this.namedCache||this.compileCache(),this.namedCache}},zm=/['"]/,Bm=/['"]/g,Vm=`’`;function Hm(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function Um(e,t){let n,r=[],i=t.md&&t.md.options&&t.md.options.quotes||`“”‘’`;for(let t=0;t<e.length;t++){let a=e[t],o=e[t].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,a.type!==`text`)continue;let s=a.content,c=0,l=s.length;OUTER:for(;c<l;){Bm.lastIndex=c;let u=Bm.exec(s);if(!u)break;let d=!0,f=!0;c=u.index+1;let p=u[0]===`'`,m=32;if(u.index-1>=0)m=s.charCodeAt(u.index-1);else for(n=t-1;n>=0&&e[n].type!==`softbreak`&&e[n].type!==`hardbreak`;n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(c<l)h=s.charCodeAt(c);else for(n=t+1;n<e.length&&e[n].type!==`softbreak`&&e[n].type!==`hardbreak`;n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=yd(m),_=yd(h),v=gd(m),y=gd(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&u[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&(a.content=Hm(a.content,u.index,Vm));continue}if(f)for(n=r.length-1;n>=0;n--){let d=r[n];if(r[n].level<o)break;if(d.single===p&&r[n].level===o){d=r[n];let o,f;p?(o=i[2]||`‘`,f=i[3]||`’`):(o=i[0]||`“`,f=i[1]||`”`),a.content=Hm(a.content,u.index,f),e[d.token].content=Hm(e[d.token].content,d.pos,o),c+=f.length-1,d.token===t&&(c+=o.length-1),s=a.content,l=s.length,r.length=n;continue OUTER}}d?r.push({token:t,pos:u.index,single:p,level:o}):f&&p&&(a.content=Hm(a.content,u.index,Vm))}}}function Wm(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--){let n=e.tokens[t];if(n.type!==`inline`)continue;let r=typeof n.content==`string`?n.content:(n.children||[]).map(e=>e.content||``).join(``);zm.test(r)&&n.children&&Um(n.children,e)}}function Gm(e){let t=e.tokens||[],n=t.length;for(let e=0;e<n;e++){let n=t[e];if(n.type!==`inline`||!Array.isArray(n.children))continue;let r=n.children,i=r.length;for(let e=0;e<i;e++)r[e].type===`text_special`&&(r[e].type=`text`);let a=0,o=0;for(;o<i;o++)r[o].type===`text`&&o+1<i&&r[o+1].type===`text`?r[o+1].content=r[o].content+r[o+1].content:(o!==a&&(r[a]=r[o]),a++);o!==a&&(r.length=a)}}var Km=/^(?:vbscript|javascript|file|data):/,qm=/^data:image\/(?:gif|png|jpeg|webp);/,Jm=[`http:`,`https:`,`mailto:`],Ym=/[^\0-\x7F]/,Xm=/xn--/,Zm=/%(?![0-9a-f]{2})|[^\w;/?:@&=+$,\-.!~*'()#%]/i,Qm=/%[0-9a-f]{2}/i;function $m(e){let t=e.trim().toLowerCase();return!Km.test(t)||qm.test(t)}function eh(e){let t=rd(e,!0);if(t.hostname&&(!t.protocol||Jm.includes(t.protocol))&&Ym.test(t.hostname))try{t.hostname=Mf.default.toASCII(t.hostname)}catch{}let n=Wu(t);return Zm.test(n)?Uu(n):n}function th(e){let t=rd(e,!0);if(t.hostname&&(!t.protocol||Jm.includes(t.protocol))&&(Ym.test(t.hostname)||Xm.test(t.hostname)))try{t.hostname=Mf.default.toUnicode(t.hostname)}catch{}let n=Wu(t);return Qm.test(n)?zu(n,`${zu.defaultChars}%`):n}function nh(e){switch(e){case 9:case 32:return!0}return!1}function rh(e,t,n,r){let i=e.src,a=e.bMarks,o=e.eMarks,s=e.tShift,c=e.sCount,l=e.bsCount,u=a[t]+s[t],d=o[t],f=e.lineMax;if(c[t]-e.blkIndent>=4||i.charCodeAt(u)!==62)return!1;if(r)return!0;let p=[],m=[],h=[],g=[],_=e.md.block.ruler.getRulesForState(e,`blockquote`),v=e.parentType;e.parentType=`blockquote`;let y=!1,b;for(b=t;b<n;b++){let t=c[b]<e.blkIndent;if(u=a[b]+s[b],d=o[b],u>=d)break;if(i.charCodeAt(u++)===62&&!t){let e=c[b]+1,t,n;i.charCodeAt(u)===32?(u++,e++,n=!1,t=!0):i.charCodeAt(u)===9?(t=!0,(l[b]+e)%4==3?(u++,e++,n=!1):n=!0):t=!1;let r=e;for(p.push(a[b]),a[b]=u;u<d;){let e=i.charCodeAt(u);if(nh(e))e===9?r+=4-(r+l[b]+ +!!n)%4:r++;else break;u++}y=u>=d,m.push(l[b]),l[b]=c[b]+1+ +!!t,h.push(c[b]),c[b]=r-e,g.push(s[b]),s[b]=u-a[b];continue}if(y)break;let r=!1;for(let t=0,i=_.length;t<i;t++)if(_[t](e,b,n,!0)){r=!0;break}if(r){e.lineMax=b,e.blkIndent!==0&&(p.push(a[b]),m.push(l[b]),g.push(s[b]),h.push(c[b]),c[b]-=e.blkIndent);break}p.push(a[b]),m.push(l[b]),g.push(s[b]),h.push(c[b]),c[b]=-1}let x=e.blkIndent;e.blkIndent=0;let S=e.push(`blockquote_open`,`blockquote`,1);S.markup=`>`;let C=[t,0];S.map=C,e.md.block.tokenize(e,t,b);let w=e.push(`blockquote_close`,`blockquote`,-1);w.markup=`>`,e.lineMax=f,e.parentType=v,C[1]=e.line;for(let e=0;e<g.length;e++)a[e+t]=p[e],s[e+t]=g[e],c[e+t]=h[e],l[e+t]=m[e];return e.blkIndent=x,!0}function ih(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=`${e.getLines(t,i,4+e.blkIndent,!1)}\n`,a.map=[t,e.line],!0}function ah(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.includes(String.fromCharCode(o)))return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}var oh=[``,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],sh=[``,`#`,`##`,`###`,`####`,`#####`,`######`];function ch(e){switch(e){case 9:case 32:return!0}return!1}function lh(e,t,n,r){let i=e.src,a=e.bMarks,o=e.tShift,s=e.eMarks,c=a[t]+o[t],l=s[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let u=i.charCodeAt(c);if(u!==35||c>=l)return!1;let d=1;for(u=i.charCodeAt(++c);u===35&&c<l&&d<=6;)d++,u=i.charCodeAt(++c);if(d>6||c<l&&!ch(u))return!1;if(r)return!0;l=e.skipSpacesBack(l,c);let f=e.skipCharsBack(l,35,c);f>c&&ch(i.charCodeAt(f-1))&&(l=f),e.line=t+1;let p=e.push(`heading_open`,oh[d],1);p.markup=sh[d],p.map=[t,e.line];let m=e.push(`inline`,``,0);m.content=i.slice(c,l).trim(),m.map=[t,e.line],m.children=[];let h=e.push(`heading_close`,oh[d],-1);return h.markup=sh[d],!0}function uh(e){switch(e){case 9:case 32:return!0}return!1}function dh(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!uh(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=String.fromCharCode(o).repeat(s),!0}var fh=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(${`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`).join(`|`)})(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(`${jp.source}\\s*$`),/^$/,!1]];function ph(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<fh.length&&!fh[s][0].test(o);s++);if(s===fh.length)return!1;if(r)return fh[s][2];let c=t+1;if(!fh[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent);c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),fh[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let l=e.push(`html_block`,``,0);return l.map=[t,c],l.content=e.getLines(t,c,e.blkIndent,!0),!0}function mh(e){switch(e){case 9:case 32:return!0}return!1}var hh={Pipe:1,ParagraphTerminator:2},gh=new Uint8Array(256);for(let e of[35,42,43,45,60,62,95,96,124,126,48,49,50,51,52,53,54,55,56,57])gh[e]=1;var _h=class{src;md;env;tokens;bMarks=[];eMarks=[];tShift=[];sCount=[];bsCount=[];lineFlags=[];blkIndent=0;line=0;lineMax=0;tight=!1;ddIndent=-1;listIndent=-1;parentType=`root`;level=0;constructor(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r;let i=this.src,a=i.length,o=this.bMarks,s=this.eMarks,c=this.tShift,l=this.sCount,u=this.bsCount,d=this.lineFlags,f=0,p=i.indexOf(`|`);for(;f<a;){let e=f;for(;e<a&&e-f<4&&i.charCodeAt(e)!==10;)e++;if(e-f===4&&e<a){let t=i.indexOf(`
|
|
21
|
-
`,e);e=t===-1?a:t}let t=0,n=0,r=f;for(;r<e;){let e=i.charCodeAt(r);if(e===32){t++,n++,r++;continue}if(e===9){t++,n+=4-n%4,r++;continue}break}let m=0;r<e&&(gh[i.charCodeAt(r)]===1&&(m|=hh.ParagraphTerminator),p<f&&(p=i.indexOf(`|`,f)),p!==-1&&p<e&&(m|=hh.Pipe|hh.ParagraphTerminator),p===-1&&(p=a)),o.push(f),s.push(e),c.push(t),l.push(n),u.push(0),d.push(m),f=e+1}o.push(a),s.push(a),c.push(0),l.push(0),u.push(0),d.push(0),this.lineMax=o.length-1}push(e,t,n){if(n===0){let n=new sd(e,t,0);return n.block=!0,n.level=this.level,this.tokens.push(n),n}let r=new sd(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){let t=this.bMarks,n=this.tShift,r=this.eMarks;for(let i=this.lineMax;e<i&&!(t[e]+n[e]<r[e]);e++);return e}skipSpaces(e){let t=this.src;for(let n=t.length;e<n;e++){let n=t.charCodeAt(e);if(n!==9&&n!==32)break}return e}skipSpacesBack(e,t){if(e<=t)return e;let n=this.src;for(;e>t;){let t=n.charCodeAt(--e);if(t!==9&&t!==32)return e+1}return e}skipChars(e,t){let n=this.src;for(let r=n.length;e<r&&n.charCodeAt(e)===t;e++);return e}skipCharsBack(e,t,n){if(e<=n)return e;let r=this.src;for(;e>n;)if(t!==r.charCodeAt(--e))return e+1;return e}getLines(e,t,n,r){if(e>=t)return``;if(e+1===t){let t=e,i=this.bMarks[t],a=i,o=r?this.eMarks[t]+1:this.eMarks[t],s=0,c=this.src,l=this.bsCount,u=this.tShift;for(;a<o&&s<n;){let e=c.charCodeAt(a);if(e===9||e===32)e===9?s+=4-(s+l[t])%4:s++;else if(a-i<u[t])s++;else break;a++}return s>n?` `.repeat(s-n)+c.slice(a,o):c.slice(a,o)}let i=Array(t-e),a=this.src,o=this.bMarks,s=this.eMarks,c=this.bsCount,l=this.tShift;for(let u=0,d=e;d<t;d++,u++){let e=0,f=o[d],p=f,m;for(m=d+1<t||r?s[d]+1:s[d];p<m&&e<n;){let t=a.charCodeAt(p);if(mh(t))t===9?e+=4-(e+c[d])%4:e++;else if(p-f<l[d])e++;else break;p++}e>n?i[u]=` `.repeat(e-n)+a.slice(p,m):i[u]=a.slice(p,m)}return i.join(``)}};_h.prototype.Token=sd;function vh(e,t,n){for(let r=t;r<n;r++)if(e.charCodeAt(r)===124)return!0;return!1}function yh(e){let t=e?.md?.block?.ruler;return t?t.version===t.__mdtsDefaultVersion:!1}function bh(e,t,n,r,i){if(e.lineFlags&&(e.lineFlags[t]&hh.ParagraphTerminator)===0||r>=i)return!1;let a=n.charCodeAt(r);switch(a){case 35:case 42:case 43:case 45:case 60:case 62:case 95:case 96:case 126:return!0}return a>=48&&a<=57||vh(n,r,i)}var xh=[``,`h1`,`h2`];function Sh(e,t,n){let r=e.md.block.ruler.getRulesForState(e,`paragraph`),i=e.src,a=e.bMarks,o=e.tShift,s=e.eMarks,c=e.sCount,l=e.blkIndent,u=yh(e);if(c[t]-l>=4)return!1;let d=e.parentType;e.parentType=`paragraph`;let f=0,p,m=t+1;for(;m<n;m++){let t=a[m]+o[m],d=s[m];if(t>=d)break;if(c[m]-l>3)continue;if(c[m]>=l&&(p=i.charCodeAt(t),p===45||p===61)){let e=t+1,n=e;for(;e<d&&i.charCodeAt(e)===p;)e++;for(n=e;e<d;){let t=i.charCodeAt(e);if(t!==9&&t!==32)break;e++}if(e>=d){f=p===61?1:2;break}if(n-t>1)continue}if(c[m]<0||u&&!bh(e,m,i,t,d))continue;let h=!1;for(let t=0,i=r.length;t<i;t++)if(r[t](e,m,n,!0)){h=!0;break}if(h)break}if(!f)return!1;let h;if(m===t+1){let e=a[t]+o[t],n=s[t];for(;n>e;){let e=i.charCodeAt(n-1);if(e!==9&&e!==32)break;n--}h=i.slice(e,n)}else h=e.getLines(t,m,l,!1).trim();e.line=m+1;let g=p===61?`=`:`-`,_=e.push(`heading_open`,xh[f],1);_.markup=g,_.map=[t,e.line];let v=e.push(`inline`,``,0);v.content=h,v.map=[t,e.line-1],v.children=[];let y=e.push(`heading_close`,xh[f],-1);return y.markup=g,e.parentType=d,!0}function Ch(e){switch(e){case 9:case 32:return!0}return!1}function wh(e,t){let n=e.eMarks,r=e.bMarks,i=e.tShift,a=e.src,o=n[t],s=r[t]+i[t],c=a.charCodeAt(s++);return c!==42&&c!==45&&c!==43||s<o&&!Ch(a.charCodeAt(s))?-1:s}function Th(e,t){let n=e.bMarks,r=e.tShift,i=e.eMarks,a=e.src,o=n[t]+r[t],s=i[t],c=o;if(c+1>=s)return-1;let l=a.charCodeAt(c++);if(l<48||l>57)return-1;for(;;){if(c>=s)return-1;if(l=a.charCodeAt(c++),l>=48&&l<=57){if(c-o>=10)return-1;continue}if(l===41||l===46)break;return-1}return c<s&&(l=a.charCodeAt(c),!Ch(l))?-1:c}function Eh(e,t,n){let r=e.bMarks,i=e.tShift,a=e.src,o=r[t]+i[t],s=0;for(let e=o;e<n-1;e++)s=s*10+a.charCodeAt(e)-48;return s}var Dh=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`];function Oh(e,t){let n=e.level+2,r=e.tokens;for(let e=t+2,i=r.length-2;e<i;e++){let t=r[e];if(t.level===n){if(t.type===`paragraph_open`){t.hidden=!0,r[e+2].hidden=!0,e+=2;continue}if(t.nesting===1){let t=1;for(;t>0&&++e<i;)t+=r[e].nesting}}}}function kh(e,t,n,r){let i,a,o=0,s=t,c=!0;if(e.sCount[s]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[s]-e.listIndent>=4&&e.sCount[s]<e.blkIndent)return!1;let l=!1;r&&e.parentType===`paragraph`&&e.sCount[s]>=e.blkIndent&&(l=!0);let u,d,f,p=e.src,m=e.bMarks,h=e.tShift,g=e.eMarks,_=e.sCount,v=e.bsCount,y=m[s]+h[s];if(y>=g[s])return!1;let b=p.charCodeAt(y);if(b>=48&&b<=57){if(f=Th(e,s),f<0||(u=!0,o=y,d=Eh(e,s,f),l&&d!==1))return!1}else if(b===42||b===45||b===43){if(f=wh(e,s),f<0)return!1;u=!1}else return!1;if(l&&e.skipSpaces(f)>=g[s])return!1;if(r)return!0;let x=p.charCodeAt(f-1),S=String.fromCharCode(x);if(u){let t=e.push(`ordered_list_open`,`ol`,1);d!==void 0&&d!==1&&(t.attrs=[[`start`,String(d)]])}else e.push(`bullet_list_open`,`ul`,1);let C=[s,0];e.tokens[e.tokens.length-1].map=C,e.tokens[e.tokens.length-1].markup=S;let w=!1,T=e.tokens.length-1,E=e.md.block.ruler.getRulesForState(e,`list`),D=e.parentType;for(e.parentType=`list`;s<n;){a=f,i=g[s];let t=_[s]+f-(m[s]+h[s]),r=t;for(;a<i;){let e=p.charCodeAt(a);if(e===9)r+=4-(r+v[s])%4;else if(e===32)r++;else break;a++}let l=a,d;d=l>=i?1:r-t,d>4&&(d=1);let y=t+d,b=e.push(`list_item_open`,`li`,1);b.markup=S;let C=[s,0];b.map=C,u&&(b.info=f-o-1==1?Dh[p.charCodeAt(o)-48]:p.slice(o,f-1));let T=e.tight,D=e.tShift[s],O=e.sCount[s],k=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=y,e.tight=!0,e.tShift[s]=l-m[s],e.sCount[s]=r,l>=i&&e.isEmpty(s+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,s,n,!0),(!e.tight||w)&&(c=!1),w=e.line-s>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=k,e.tShift[s]=D,e.sCount[s]=O,e.tight=T,e.push(`list_item_close`,`li`,-1).markup=S,s=e.line,C[1]=s,s>=n||e.sCount[s]<e.blkIndent||e.sCount[s]-e.blkIndent>=4)break;let A=!1;for(let t=0,r=E.length;t<r;t++)if(E[t](e,s,n,!0)){A=!0;break}if(A)break;if(u){if(f=Th(e,s),f<0)break;o=m[s]+h[s]}else if(f=wh(e,s),f<0)break;if(x!==p.charCodeAt(f-1))break}return u?e.push(`ordered_list_close`,`ol`,-1).markup=S:e.push(`bullet_list_close`,`ul`,-1).markup=S,C[1]=s,e.line=s,e.parentType=D,c&&Oh(e,T),!0}function Ah(e){return e===9||e===32}function jh(e,t,n){let r=e.md.block.ruler.getRulesForState(e,`paragraph`),i=e.parentType,a=e.src,o=e.bMarks,s=e.tShift,c=e.eMarks,l=e.sCount,u=e.blkIndent,d=yh(e),f=t+1;for(e.parentType=`paragraph`;f<n&&!e.isEmpty(f);f++){if(l[f]-u>3||l[f]<0)continue;if(i===`list`&&l[f]>=u){let e=o[f]+s[f],t=c[f];if(e<t){let n=a.charCodeAt(e);if(n===42||n===45||n===43){if(e+1>=t||Ah(a.charCodeAt(e+1)))break}else if(n>=48&&n<=57&&e+1<t){let n=e+1;for(;;){if(n>=t){n=-1;break}let r=a.charCodeAt(n++);if(r>=48&&r<=57){if(n-e>=10){n=-1;break}continue}if((r===41||r===46)&&(n>=t||Ah(a.charCodeAt(n))))break;n=-1;break}if(n>=0)break}}}let t=o[f]+s[f],p=c[f];if(d&&!bh(e,f,a,t,p))continue;let m=!1;for(let t=0,i=r.length;t<i;t++)if(r[t](e,f,n,!0)){m=!0;break}if(m)break}let p=e.getLines(t,f,u,!1).trim();e.line=f;let m=e.push(`paragraph_open`,`p`,1);m.map=[t,e.line];let h=e.push(`inline`,``,0);return h.content=p,h.map=[t,e.line],h.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}function Mh(e){switch(e){case 9:case 32:return!0}return!1}function Nh(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1,s=e.md.block.ruler.getRulesForState(e,`reference`);if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function c(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.parentType;e.parentType=`reference`;let i=!1;for(let r=0,a=s.length;r<a;r++)if(s[r](e,t,n,!0)){i=!0;break}if(e.parentType=r,i)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let l=e.src.slice(i,a+1);a=l.length;let u=-1;for(i=1;i<a;i++){let e=l.charCodeAt(i);if(e===91)return!1;if(e===93){u=i;break}if(e===10){let e=c(o);e!==null&&(l+=e,a=l.length,o++)}else if(e===92&&(i++,i<a&&l.charCodeAt(i)===10)){let e=c(o);e!==null&&(l+=e,a=l.length,o++)}}if(u<0||l.charCodeAt(u+1)!==58)return!1;for(i=u+2;i<a;i++){let e=l.charCodeAt(i);if(e===10){let e=c(o);e!==null&&(l+=e,a=l.length,o++)}else if(!Mh(e))break}let d=e.md.helpers.parseLinkDestination(l,i,a);if(!d.ok)return!1;let f=e.md.normalizeLink(d.str);if(!e.md.validateLink(f))return!1;i=d.pos;let p=i,m=o,h=i;for(;i<a;i++){let e=l.charCodeAt(i);if(e===10){let e=c(o);e!==null&&(l+=e,a=l.length,o++)}else if(!Mh(e))break}let g=e.md.helpers.parseLinkTitle(l,i,a);for(;g.can_continue;){let t=c(o);if(t===null)break;l+=t,i=a,a=l.length,o++,g=e.md.helpers.parseLinkTitle(l,i,a,g)}let _;for(i<a&&h!==i&&g.ok?(_=g.str,i=g.pos):(_=``,i=p,o=m);i<a&&Mh(l.charCodeAt(i));)i++;if(i<a&&l.charCodeAt(i)!==10&&_)for(_=``,i=p,o=m;i<a&&Mh(l.charCodeAt(i));)i++;if(i<a&&l.charCodeAt(i)!==10)return!1;let v=xd(l.slice(1,u));return v?r?!0:(e.env.references===void 0&&(e.env.references={}),e.env.references[v]===void 0&&(e.env.references[v]={title:_,href:f}),e.line=o,!0):!1}function Ph(e){switch(e){case 9:case 32:return!0}return!1}var Fh=65536;function Ih(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function Lh(e,t){if(e.lineFlags)return(e.lineFlags[t]&hh.Pipe)!==0;for(let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];n<r;n++)if(e.src.charCodeAt(n)===124)return!0;return!1}function Rh(e){if(!e.includes(`\\`))return e.split(`|`);let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function zh(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!Ph(s)||o===45&&Ph(s)||!Lh(e,t))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!Ph(t))return!1;a++}let c=Ih(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=Ih(e,t).trim(),e.sCount[t]-e.blkIndent>=4)return!1;l=Rh(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRulesForState(e,`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=Ih(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=Rh(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>Fh))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}var Bh=class{_rules=[];cache=null;namedCache=null;version=0;invalidateCache(){this.cache=null,this.namedCache=null,this.version++}push(e,t,n){this._rules.push({name:e,enabled:!0,fn:t,alt:n?.alt||[]}),this.invalidateCache()}before(e,t,n,r){let i=this._rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this._rules.findIndex(e=>e.name===t);a>=0&&this._rules.splice(a,1),this._rules.splice(i,0,{name:t,enabled:!0,fn:n,alt:r?.alt||[]}),this.invalidateCache()}after(e,t,n,r){let i=this._rules.findIndex(t=>t.name===e);if(i<0)throw Error(`Parser rule not found: ${e}`);let a=this._rules.findIndex(e=>e.name===t);a>=0&&this._rules.splice(a,1),this._rules.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:r?.alt||[]}),this.invalidateCache()}getRules(e){let t=e||``;return this.cache||this.compileCache(),this.cache[t]??[]}getNamedRules(e){let t=e||``;return this.namedCache||this.compileCache(),this.namedCache[t]??[]}getRulesForState(e,t){let n=e?.env;return n&&(Object.prototype.hasOwnProperty.call(n,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(n,`__mdtsProfileRules`))?this.getNamedRules(t).map(({name:e,fn:t})=>(n,r,i,a)=>{let o=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),s=t(n,r,i,a),c=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();return lm(n?.env,`block`,e,c-o,s,!!a),s}):this.getRules(t)}at(e,t,n){let r=this._rules.findIndex(t=>t.name===e);if(r===-1)throw Error(`Parser rule not found: ${e}`);this._rules[r].fn=t,n?.alt&&(this._rules[r].alt=n.alt),this.invalidateCache()}enable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;return n.forEach(e=>{let n=this._rules.findIndex(t=>t.name===e);if(n===-1){if(t)return;throw Error(`Rules manager: invalid rule name ${e}`)}r.push(e),this._rules[n].enabled||(this._rules[n].enabled=!0,i=!0)}),i&&this.invalidateCache(),r}disable(e,t){let n=Array.isArray(e)?e:[e],r=[],i=!1;return n.forEach(e=>{let n=this._rules.findIndex(t=>t.name===e);if(n===-1){if(t)return;throw Error(`Rules manager: invalid rule name ${e}`)}r.push(e),this._rules[n].enabled&&(this._rules[n].enabled=!1,i=!0)}),i&&this.invalidateCache(),r}enableOnly(e){let t=new Set(e),n=!1;for(let e of this._rules){let r=t.has(e.name);e.enabled!==r&&(e.enabled=r,n=!0)}n&&this.invalidateCache()}compileCache(){let e=new Set([``]);for(let t of this._rules)if(t.enabled)for(let n of t.alt)e.add(n);let t=Object.create(null),n=Object.create(null);for(let r of e){let e=[],i=[];for(let t of this._rules)t.enabled&&(r===``||t.alt.includes(r))&&(e.push(t.fn),i.push({name:t.name,fn:t.fn}));t[r]=e,n[r]=i}this.cache=t,this.namedCache=n}},Vh=[[`table`,zh,[`paragraph`,`reference`]],[`code`,ih],[`fence`,ah,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,rh,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,dh,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,kh,[`paragraph`,`reference`,`blockquote`]],[`reference`,Nh],[`html_block`,ph,[`paragraph`,`reference`,`blockquote`]],[`heading`,lh,[`paragraph`,`reference`,`blockquote`]],[`lheading`,Sh],[`paragraph`,jh]],Hh=class{ruler;cachedRulesVersion=-1;cachedRules=[];constructor(){this.ruler=new Bh;for(let e=0;e<Vh.length;e++)this.ruler.push(Vh[e][0],Vh[e][1],{alt:(Vh[e][2]||[]).slice()});this.ruler.__mdtsDefaultVersion=this.ruler.version}tokenize(e,t,n){let r=this.getRules(),i=r.length,a=e.md.options.maxNesting,o=e.bMarks,s=e.tShift,c=e.eMarks,l=e.sCount,u=t,d=!1;if(!(e.env&&(Object.prototype.hasOwnProperty.call(e.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(e.env,`__mdtsProfileRules`)))){for(;u<n;){for(;u<n&&o[u]+s[u]>=c[u];)u++;if(e.line=u,u>=n||l[u]<e.blkIndent)break;if(e.level>=a){e.line=n;break}let t=e.line,f=!1;for(let a=0;a<i;a++)if(f=r[a](e,u,n,!1),f){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!f)throw Error(`none of the block rules matched`);e.tight=!d,o[e.line-1]+s[e.line-1]>=c[e.line-1]&&(d=!0),u=e.line,u<n&&o[u]+s[u]>=c[u]&&(d=!0,u++,e.line=u)}return}let f=this.ruler.getNamedRules(``);for(;u<n;){for(;u<n&&o[u]+s[u]>=c[u];)u++;if(e.line=u,u>=n||l[u]<e.blkIndent)break;if(e.level>=a){e.line=n;break}let t=e.line,r=!1;for(let a=0;a<i;a++){let i=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();r=f[a].fn(e,u,n,!1);let o=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();if(lm(e.env,`block`,f[a].name,o-i,r,!1),r){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}}if(!r)throw Error(`none of the block rules matched`);e.tight=!d,o[e.line-1]+s[e.line-1]>=c[e.line-1]&&(d=!0),u=e.line,u<n&&o[u]+s[u]>=c[u]&&(d=!0,u++,e.line=u)}}parse(e,t,n,r){if(!e||e.length===0)return;let i=new _h(e,t,n,r);this.tokenize(i,i.line,i.lineMax)}getRules(){return this.cachedRulesVersion!==this.ruler.version&&(this.cachedRules=this.ruler.getRules(``),this.cachedRulesVersion=this.ruler.version),this.cachedRules}},Uh=class{src;env;tokens;inlineMode;md;constructor(e,t,n={}){this.src=typeof e==`string`?e||``:e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}};Uh.prototype.Token=sd;var Wh=[[`normalize`,km],[`block`,Yf],[`inline`,_m],[`linkify`,Em],[`replacements`,Lm],[`smartquotes`,Wm],[`text_join`,Gm]],Gh={html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,maxNesting:100},Kh={parseLinkLabel:Lf,parseLinkDestination:Nf,parseLinkTitle:zf};function qh(){return{...Gh}}function Jh(){return{...Kh}}var Yh=class{fallbackParser;lastState=null;block;inline;ruler;linkifyInstance=null;cachedCoreRulesVersion=-1;cachedCoreRules=[];cachedCoreNamedRulesVersion=-1;cachedCoreNamedRules=[];constructor(){this.block=new Hh,this.inline=new gm,this.ruler=new Rm;for(let e=0;e<Wh.length;e++){let[t,n]=Wh[e];this.ruler.push(t,n)}this.fallbackParser={block:this.block,inline:this.inline,core:this,options:qh(),helpers:Jh(),normalizeLink:eh,normalizeLinkText:th,validateLink:$m,linkify:null}}resolveParser(e){return e||(this.linkifyInstance||=new jf({fuzzyLink:!0}),this.fallbackParser.block!==this.block&&(this.fallbackParser.block=this.block),this.fallbackParser.inline!==this.inline&&(this.fallbackParser.inline=this.inline),this.fallbackParser.core=this,this.fallbackParser.linkify=this.linkifyInstance,this.fallbackParser)}createState(e,t={},n){return new Uh(e,this.resolveParser(n),t)}getCoreRules(){return this.cachedCoreRulesVersion!==this.ruler.version&&(this.cachedCoreRules=this.ruler.getRules(``),this.cachedCoreRulesVersion=this.ruler.version),this.cachedCoreRules}getCoreNamedRules(){return this.cachedCoreNamedRulesVersion!==this.ruler.version&&(this.cachedCoreNamedRules=this.ruler.getNamedRules(``),this.cachedCoreNamedRulesVersion=this.ruler.version),this.cachedCoreNamedRules}process(e,t){let n=!!e.env&&(Object.prototype.hasOwnProperty.call(e.env,`__mdtsRuleProfile`)||Object.prototype.hasOwnProperty.call(e.env,`__mdtsProfileRules`));if(!n&&!t){let t=this.getCoreRules();for(let n=0;n<t.length;n++)t[n](e);return}let r=this.getCoreNamedRules();for(let i=0;i<r.length;i++){let a=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();r[i].fn(e);let o=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now();n&&lm(e.env,`core`,r[i].name,o-a,!0,!1),t?.(r[i],e)}n&&um(e.env)}parseSource(e,t={},n){if(typeof e!=`string`&&qf(e))return this.parse(Jf(e),t,n);let r=this.createState(e,t,n);return this.process(r),this.lastState=r,r}parse(e,t={},n){if(typeof e!=`string`)throw TypeError(`Input data should be a String`);return this.parseSource(e,t,n)}getTokens(){return this.lastState?this.lastState.tokens:[]}},Xh=/[\n!#$%&*+\-:<=>@[\]\\^_`{}~]/;function Zh(e){return!Xh.test(e)}function Qh(e,t){let n=e.indexOf(`
|
|
22
|
-
`,t);return n===-1?e.length:n}function $h(e,t,n){for(let r=t;r<n;r++){let t=e.charCodeAt(r);if(t!==32&&t!==9)return!1}return!0}function eg(e,t,n){return t+2<n&&e.charCodeAt(t)===96&&e.charCodeAt(t+1)===96&&e.charCodeAt(t+2)===96}function tg(e,t,n){return t+1<n&&e.charCodeAt(t)===45&&e.charCodeAt(t+1)===32}function ng(e){if(e.length>3)return Zh(e);for(let t=0;t<e.length;t++)switch(e.charCodeAt(t)){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!1}return!0}var rg=[``,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],ig=[``,`#`,`##`,`###`,`####`,`#####`,`######`],ag=0,og=1,sg=2;function cg(e,t,n,r){let i=new sd(e,t,n);return i.level=r,i.block=!0,i}function lg(e,t,n){let r=cg(`inline`,``,0,n);r.map=[t,t+1],r.content=e;let i=new sd(`text`,``,0);return i.content=e,r.children=[i],r}function ug(e,t,n,r,i){let a=0,o=n;for(;o<r&&t.charCodeAt(o)===35&&a<6;)o++,a++;if(a===0||o>=r||t.charCodeAt(o)!==32)return!1;let s=o+1;for(;s<r&&t.charCodeAt(s)===32;)s++;let c=r;for(;c>s&&t.charCodeAt(c-1)===32;)c--;let l=c;for(;l>s&&t.charCodeAt(l-1)===35;)l--;if(l>s&&t.charCodeAt(l-1)===32)for(c=l-1;c>s&&t.charCodeAt(c-1)===32;)c--;let u=t.slice(s,c);if(!Zh(u))return!1;let d=rg[a],f=ig[a],p=cg(`heading_open`,d,1,0);p.map=[i,i+1],p.markup=f,e.push(p),e.push(lg(u,i,1));let m=cg(`heading_close`,d,-1,0);return m.markup=f,e.push(m),!0}function dg(e,t,n){let r=cg(`paragraph_open`,`p`,1,0);r.map=[n,n+1],e.push(r),e.push(lg(t,n,1)),e.push(cg(`paragraph_close`,`p`,-1,0))}function fg(e,t,n){let r=e.charCodeAt(n-1);return r===32||r===9?e.slice(t,n).trim():e.slice(t,n)}function pg(e,t){for(;t<e.length&&e.charCodeAt(t)===10;)t++;return t}function mg(e,t){let n=cg(`bullet_list_open`,`ul`,1,0);return n.map=[t,t],n.markup=`-`,e.push(n),n}function hg(e,t,n){let r=cg(`list_item_open`,`li`,1,1);r.map=[n,n+1],r.markup=`-`,e.push(r);let i=cg(`paragraph_open`,`p`,1,2);i.map=[n,n+1],i.hidden=!0,e.push(i),e.push(lg(t,n,3));let a=cg(`paragraph_close`,`p`,-1,2);a.hidden=!0,e.push(a);let o=cg(`list_item_close`,`li`,-1,1);return o.markup=`-`,e.push(o),r}function gg(e){let t=cg(`bullet_list_close`,`ul`,-1,0);t.markup=`-`,e.push(t)}function _g(e,t,n,r){if(!eg(e,t,n))return null;let i=e.slice(t+3,n);if(i.includes("`"))return null;let a=n<e.length?n+1:n,o=a,s=a,c=r+1;for(;s<e.length;){let t=Qh(e,s);if(eg(e,s,t)&&$h(e,s+3,t)){let n=cg(`fence`,`code`,0,0);return n.map=[r,c+1],n.markup="```",n.info=i,n.content=e.slice(a,o),{token:n,nextPos:t<e.length?t+1:t,nextLine:c+1}}s=t<e.length?t+1:t,o=s,c++}return null}function vg(e,t){if(e.length===0)return t&&(t.matched=!0),[];if(e.includes(`\r`)||e.includes(`\0`))return null;let n=[],r=e.length>=1e5?ag:sg,i=``,a=!1,o=!1,s=0,c=0;for(;s<e.length;){let l=Qh(e,s);if(s===l){s=l<e.length?l+1:l,c++;continue}let u=e.charCodeAt(s);if(u===32||u===9){if(!$h(e,s,l))return null;s=l<e.length?l+1:l,c++;continue}if(u===35){if(!ug(n,e,s,l,c))return null;t&&(t.blocks++,t.headings++);let r=l<e.length?l+1:l;s=pg(e,r),c+=1+s-r;continue}if(u===45){if(!tg(e,s,l))return null;let r=c,i=s,a=c,o=null,u=null;for(;i<e.length;){let t=Qh(e,i);if(!tg(e,i,t))break;let s=i+2,c=t===s+1?e[s]:e.slice(s,t);if(!ng(c))return null;o===null&&(o=mg(n,r)),u=hg(n,c,a),i=t<e.length?t+1:t,a++}if(o===null||u===null)return null;let d=i,f=a;for(;d<e.length;){if(e.charCodeAt(d)===10){d++,f++;continue}let t=Qh(e,d);if(!$h(e,d,t)){if(tg(e,d,t))return null;break}d=t<e.length?t+1:t,f++}o.map[1]=f,u.map[1]=f,gg(n),t&&(t.blocks++,t.lists++),s=d,c=f;continue}if(u===96){let r=_g(e,s,l,c);if(!r)return null;n.push(r.token),t&&(t.blocks++,t.fences++),s=pg(e,r.nextPos),c=r.nextLine+s-r.nextPos;continue}let d=fg(e,s,l),f;if(r===sg?(t&&t.paragraphCacheBypasses++,f=Zh(d)):r===og&&d===i?(t&&t.paragraphCacheHits++,f=a):(t&&t.paragraphCacheMisses++,f=Zh(d),r===ag?(o&&(r=d===i?og:sg),i=d,a=f,o=!0):r===og&&(i=d,a=f)),!f)return null;let p=l<e.length?l+1:l;if(p<e.length&&e.charCodeAt(p)!==10&&!$h(e,p,Qh(e,p)))return null;dg(n,d,c),t&&(t.blocks++,t.paragraphs++),s=pg(e,p),c+=1+s-p}return t&&(t.matched=!0),n}var yg=/[&<>"]/,bg=/[&<>"]/g,xg=/&/g,Sg=/[<>"]/g,Cg={"&":`&`,"<":`<`,">":`>`,'"':`"`};function wg(e){return Cg[e]||e}function Tg(e){if(e.length===0)return``;if(e.length<32)return yg.test(e)?e.replace(bg,wg):e;let t=e.includes(`&`),n=e.includes(`<`),r=e.includes(`>`),i=e.includes(`"`);return!t&&!n&&!r&&!i?e:t&&!n&&!r&&!i?e.replace(xg,`&`):t?e.replace(bg,wg):e.replace(Sg,wg)}var Eg=RegExp(`\\\\([!"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_\`{|}~])|&([a-z#][a-z0-9]{1,31});`,`gi`),Dg=/^#(?:x[a-f0-9]{1,8}|\d{1,8})$/i;function Og(e){return!e.includes(`\\`)&&!e.includes(`&`)?e:e.replace(Eg,(e,t,n)=>{if(t)return t;if(Dg.test(n)){let e=n[1].toLowerCase()===`x`?Number.parseInt(n.slice(2),16):Number.parseInt(n.slice(1),10);return Cd(e)?wd(e):`�`}let r=Pu(e);return r===e?e:r})}var kg=/[\n!#$%&*+\-:<=>@[\]\\^_`{}~]/,Ag=/[\n!"#$%&*+\-:<=>@[\]\\^_`{}~]/,jg=/"/g;function Mg(e,t){let n=e.indexOf(`
|
|
23
|
-
`,t);return n===-1?e.length:n}function Ng(e,t,n){for(let r=t;r<n;r++){let t=e.charCodeAt(r);if(t!==32&&t!==9)return!1}return!0}function Pg(e,t){for(;t<e.length&&e.charCodeAt(t)===10;)t++;return t}function Fg(e,t){return t>=e.length||e.charCodeAt(t)===10?!1:!Ng(e,t,Mg(e,t))}function Ig(e,t,n){return t+2<n&&e.charCodeAt(t)===96&&e.charCodeAt(t+1)===96&&e.charCodeAt(t+2)===96}function Lg(e,t,n){let r=e.charCodeAt(n-1);return r===32||r===9?e.slice(t,n).trim():e.slice(t,n)}function Rg(e){return Ag.test(e)?kg.test(e)?null:e.replace(jg,`"`):e}function zg(e,t,n){let r=0,i=t;for(;i<n&&e.charCodeAt(i)===35&&r<6;)i++,r++;if(r===0||i>=n||e.charCodeAt(i)!==32)return null;let a=i+1;for(;a<n&&e.charCodeAt(a)===32;)a++;let o=n;for(;o>a&&e.charCodeAt(o-1)===32;)o--;let s=o;for(;s>a&&e.charCodeAt(s-1)===35;)s--;if(s>a&&e.charCodeAt(s-1)===32)for(o=s-1;o>a&&e.charCodeAt(o-1)===32;)o--;let c=Rg(e.slice(a,o));return c===null?null:`<h${r}>${c}</h${r}>\n`}function Bg(e,t,n){return t+1<n&&e.charCodeAt(t)===45&&e.charCodeAt(t+1)===32}var Vg=new Uint8Array(256).fill(1);for(let e of[10,33,35,36,37,38,42,43,45,58,60,61,62,64,91,92,93,94,95,96,123,125,126])Vg[e]=0;Vg[34]=0;function Hg(e,t){let n=e.charCodeAt(t);return n===34?`<li>"</li>
|
|
24
|
-
`:n<256&&Vg[n]===0?null:`<li>${e[t]}</li>\n`}function Ug(e,t,n){let r=t+2;if(n===r+1)return Hg(e,r);let i=Rg(e.slice(t+2,n));return i===null?null:`<li>${i}</li>\n`}function Wg(e,t,n){for(;t<n;){let n=e.charCodeAt(t);if(n!==32&&n!==9)break;t++}for(;n>t;){let t=e.charCodeAt(n-1);if(t!==32&&t!==9)break;n--}let r=n;for(let i=t;i<n;i++){let t=e.charCodeAt(i);if(t===96)return null;if(t===32||t===9){r=i;break}}return e.slice(t,r)}function Gg(e,t,n,r,i){if(!Ig(e,t,n))return null;let a=Wg(e,t+3,n);if(a===null)return null;let o=n<e.length?n+1:n,s=o,c=o;for(;c<e.length;){let t=Mg(e,c);if(Ig(e,c,t)&&Ng(e,c+3,t)){let n=e.slice(o,s),c;return a===r.lang?(i&&i.fenceCacheHits++,c=r.open):(i&&i.fenceCacheMisses++,c=a?`<pre><code class="language-${Tg(a)}">`:`<pre><code>`,r.lang=a,r.open=c),{html:`${c}${Tg(n)}</code></pre>\n`,nextPos:t<e.length?t+1:t}}c=t<e.length?t+1:t,s=c}return null}function Kg(e,t){if(e.length===0)return t&&(t.matched=!0),``;if(e.includes(`\r`)||e.includes(`\0`))return null;let n=0,r=``,i=e.length>=25e4,a=[],o={lang:null,open:``},s=``,c=``,l=``,u=``;for(;n<e.length;){let d=Mg(e,n);if(n===d){n=d<e.length?d+1:d;continue}let f=e.charCodeAt(n);if(f===32||f===9){if(!Ng(e,n,d))return null;n=d<e.length?d+1:d;continue}if(f===35){let o=zg(e,n,d);if(o===null)return null;t&&(t.blocks++,t.headings++),i?a.push(o):r+=o,n=Pg(e,d<e.length?d+1:d);continue}if(f===45){let o=n;for(;o<e.length;){let t=Mg(e,o);if(!Bg(e,o,t))break;o=t<e.length?t+1:t}if(o===n)return null;let l=e.slice(n,o),u;if(l===s)t&&t.listCacheHits++,u=c;else{t&&t.listCacheMisses++;let r=n;for(u=`<ul>
|
|
25
|
-
`;r<o;){let t=Mg(e,r),n=Ug(e,r,t);if(n===null)return null;u+=n,r=t<e.length?t+1:t}u+=`</ul>
|
|
26
|
-
`,s=l,c=u}let d=Pg(e,o);for(;d<e.length;){if(e.charCodeAt(d)===10){d++;continue}let t=Mg(e,d);if(!Ng(e,d,t)){if(Bg(e,d,t))return null;break}d=t<e.length?t+1:t}t&&(t.blocks++,t.lists++),i?a.push(u):r+=u,n=d;continue}if(f===96){let s=Gg(e,n,d,o,t);if(!s)return null;t&&(t.blocks++,t.fences++),i?a.push(s.html):r+=s.html,n=Pg(e,s.nextPos);continue}let p=Lg(e,n,d),m;if(p===l)t&&t.paragraphCacheHits++,m=u;else{t&&t.paragraphCacheMisses++;let e=Rg(p);if(e===null)return null;m=`<p>${e}</p>\n`,l=p,u=m}let h=d<e.length?d+1:d;if(h<e.length&&e.charCodeAt(h)!==10&&Fg(e,h))return null;t&&(t.blocks++,t.paragraphs++),i?a.push(m):r+=m,n=Pg(e,h)}return t&&(t.matched=!0),i?a.join(``):r}function qg(e){return Kg(e)}function Jg(e,t){return Kg(e,t)}var Yg={maxChunkChars:1e4,maxChunkLines:200,fenceAware:!0,maxChunks:void 0,fallbackOnGlobalState:!0};function Xg(e,t,n={},r){mf(n);let i={...Yg,...r||{}},a=nf(t);if(i.fallbackOnGlobalState!==!1&&a)return _f(n,{count:1,fallback:!0,fallbackReason:a,globalStateDetected:a,maxChunkChars:i.maxChunkChars,maxChunkLines:i.maxChunkLines}),af(n,a,()=>e.core.parse(t,n,e).tokens);let o=Zg(t,i);if(i.maxChunks&&o.length>i.maxChunks&&(o=n_(o,i.maxChunks)),Qg(t,o))return _f(n,{count:1,fallback:!0,fallbackReason:`unsafe-chunk-boundary`,maxChunkChars:i.maxChunkChars,maxChunkLines:i.maxChunkLines}),af(n,a,()=>e.core.parse(t,n,e).tokens);let s=0,c=[];return _f(n,{count:o.length,maxChunkChars:i.maxChunkChars,maxChunkLines:i.maxChunkLines,globalStateDetected:a||void 0,globalStateFallbackDisabled:i.fallbackOnGlobalState===!1&&!!a}),af(n,a,()=>{for(let r=0;r<o.length;r++){let i=o[r],a=t.slice(i.start,i.end),l=e.core.parse(a,n,e).tokens;s!==0&&l.length&&e_(l,s),t_(c,l),s+=i.lineCount}return c})}function Zg(e,t,n=!0){let r=[],i=0,a=0,o=0,s=0,c=0,l=0,u=null;function d(e){e<=o||(r.push({start:o,end:e,lineCount:s}),o=e,i=0,a=0,s=0)}for(let n=0;n<e.length;){let r=e.indexOf(`
|
|
27
|
-
`,n),o=r;r===-1?(r=e.length,o=e.length):o=r+1;let f=r_(e,n,r);if(t.fenceAware){let t=n;for(;t<r;){let n=e.charCodeAt(t);if(n===32||n===9)t++;else break}let i=e[t];if(i==="`"||i===`~`){let n=t;for(;n<r&&e[n]===i;)n++;let a=n-t;a>=3&&(u?u.marker===i&&a>=u.length&&(u=null):u={marker:i,length:a})}}let p=o-n;i+=p,a+=1,s+=1,f?(c=0,l=0):(c+=1,l+=p);let m=f;if((i>=t.maxChunkChars||a>=t.maxChunkLines)&&!u){if(m)d(o);else{let e=Math.max(10,Math.floor(t.maxChunkLines*.5)),n=Math.max(t.maxChunkChars,8e3);(c>=e||l>=n)&&d(o)}}n=o}return n&&d(e.length),r}function Qg(e,t,n={rangesCoverWholeSource:!0}){let r=n.rangesCoverWholeSource?t.length-1:t.length;for(let n=0;n<r;n++)if(!$g(e,t[n].end))return!0;return!1}function $g(e,t){if(t<=0||t>e.length||e.charCodeAt(t-1)!==10)return!1;let n=t-2;for(;n>=0&&e.charCodeAt(n)!==10;)n--;for(let r=n+1;r<t-1;r++){let t=e.charCodeAt(r);if(t!==32&&t!==9&&t!==13)return!1}return!0}function e_(e,t){if(t===0)return;let n=[];for(let t=e.length-1;t>=0;t--)n.push(e[t]);for(;n.length;){let e=n.pop();if(e.map&&(e.map[0]+=t,e.map[1]+=t),e.children)for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}function t_(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function n_(e,t){if(e.length<=t)return e;let n=[],r=0;for(let i=0;i<t;i++){let a=t-i,o=e.length-r,s=Math.ceil(o/a),c=e.slice(r,r+s),l=0;for(let e=0;e<c.length;e++)l+=c[e].lineCount;n.push({start:c[0].start,end:c[c.length-1].end,lineCount:l}),r+=s}return n}function r_(e,t,n){for(let r=t;r<n;r++){let t=e.charCodeAt(r);if(t!==32&&t!==9&&t!==13)return!1}return!0}var i_=4e6,a_=8e4,o_=1e4,s_=200,c_=1e4,l_=200;function u_(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function d_(e,t){if(t===0)return;let n=[];for(let t=e.length-1;t>=0;t--)n.push(e[t]);for(;n.length;){let e=n.pop();if(e.map&&(e.map[0]+=t,e.map[1]+=t),e.children)for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}function f_(e){return e.length===0?0:zd(e)+(e.charCodeAt(e.length-1)===10?0:1)}function p_(e,t,n){for(let r=t;r<n;r++){let t=e.charCodeAt(r);if(t!==32&&t!==9&&t!==13)return!1}return!0}function m_(e,t){if(!t||e.length===0)return!1;let n=null;for(let t=0;t<e.length;){let r=e.indexOf(`
|
|
28
|
-
`,t);r===-1&&(r=e.length);let i=t;for(;i<r;){let t=e.charCodeAt(i);if(t===32||t===9)i++;else break}let a=e[i];if(a==="`"||a===`~`){let t=i;for(;t<r&&e[t]===a;)t++;let o=t-i;o>=3&&(n?n.marker===a&&o>=n.length&&(n=null):n={marker:a,length:o})}t=r===e.length?e.length:r+1}return n!==null}function h_(e,t){if(e.length===0||e.charCodeAt(e.length-1)!==10)return!1;let n=e.length-2;for(;n>=0&&e.charCodeAt(n)!==10;)n--;return p_(e,n+1,e.length-1)?!m_(e,t):!1}function g_(e,t,n,r={}){let i=r.mode??`full`,a=r.fenceAware??(i===`stream`?e.options.streamChunkFenceAware??!0:e.options.fullChunkFenceAware??!0);if(r.maxChunkChars!==void 0||r.maxChunkLines!==void 0||r.autoTune===!1){let t=r.maxChunkChars??(i===`stream`?e.options.streamChunkSizeChars??c_:e.options.fullChunkSizeChars??o_),n=r.maxChunkLines??(i===`stream`?e.options.streamChunkSizeLines??l_:e.options.fullChunkSizeLines??s_);return{maxChunkChars:t,maxChunkLines:n,holdBelowChars:t,holdBelowLines:n,fenceAware:a}}return i===`stream`?t<=5e3?{maxChunkChars:16e3,maxChunkLines:250,holdBelowChars:16e3,holdBelowLines:250,fenceAware:a}:t<=2e4?{maxChunkChars:16e3,maxChunkLines:200,holdBelowChars:16e3,holdBelowLines:200,fenceAware:a}:t<=5e4?{maxChunkChars:16e3,maxChunkLines:250,holdBelowChars:16e3,holdBelowLines:250,fenceAware:a}:t<=5e5?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:32e3,holdBelowLines:350,fenceAware:a}:{maxChunkChars:64e3,maxChunkLines:700,holdBelowChars:64e3,holdBelowLines:700,fenceAware:a}:t<=1e5&&n<=2500?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:1e5,holdBelowLines:2500,fenceAware:a}:t<=2e5?{maxChunkChars:2e4,maxChunkLines:150,holdBelowChars:2e4,holdBelowLines:150,fenceAware:a}:t<=5e5?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:32e3,holdBelowLines:350,fenceAware:a}:{maxChunkChars:64e3,maxChunkLines:700,holdBelowChars:64e3,holdBelowLines:700,fenceAware:a}}var __=class{md;options;pending=``;tokens=[];committedChars=0;committedLines=0;fedChunks=0;parsedChunks=0;globalStateEnv=null;markedGlobalStateReason=null;constructor(e,t={}){if(this.md=e,this.options={mode:`full`,autoTune:!0,retainTokens:!0,...t},this.options.retainTokens===!1&&!this.options.onChunkTokens)throw Error(`UnboundedBuffer with retainTokens=false requires onChunkTokens`)}feed(e){e&&(this.pending+=e,this.fedChunks+=1)}flushAvailable(e={}){if(!this.pending)return null;let t=this.resolveWindow(),n=f_(this.pending);if(this.pending.length<t.holdBelowChars&&n<t.holdBelowLines)return this.updateEnvDiagnostics(e,t,n),null;let r=Zg(this.pending,{maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,fenceAware:t.fenceAware,maxChunks:void 0},!1);if(!r.length||Qg(this.pending,r,{rangesCoverWholeSource:!1}))return this.updateEnvDiagnostics(e,t,n),null;let i=this.commitRanges(r,e);return this.pending=this.pending.slice(i),this.updateEnvDiagnostics(e,t,f_(this.pending)),this.tokens}flushIfBoundary(e={}){if(!this.pending)return null;let t=this.resolveWindow();if(!h_(this.pending,t.fenceAware))return this.updateEnvDiagnostics(e,t,f_(this.pending)),null;let n=Zg(this.pending,{maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,fenceAware:t.fenceAware,maxChunks:void 0},!0);if(!n.length)return this.updateEnvDiagnostics(e,t,f_(this.pending)),null;let r=Qg(this.pending,n,{rangesCoverWholeSource:!0})?[{start:0,end:this.pending.length,lineCount:f_(this.pending)}]:n;return this.commitRanges(r,e),this.pending=``,this.updateEnvDiagnostics(e,t,0),this.tokens}flushForce(e={}){if(!this.pending){this.prepareGlobalStateEnv(e,``);let t=this.resolveWindow();return this.updateEnvDiagnostics(e,t,0),this.tokens}let t=this.resolveWindow(),n=Zg(this.pending,{maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,fenceAware:t.fenceAware,maxChunks:void 0},!0);if(n.length){let t=Qg(this.pending,n,{rangesCoverWholeSource:!0})?[{start:0,end:this.pending.length,lineCount:f_(this.pending)}]:n;this.commitRanges(t,e),this.pending=``}return this.updateEnvDiagnostics(e,t,0),this.tokens}reset(){this.pending=``,this.tokens=[],this.committedChars=0,this.committedLines=0,this.fedChunks=0,this.parsedChunks=0,this.globalStateEnv=null,this.markedGlobalStateReason=null}peek(){return this.tokens}pendingText(){return this.pending}stats(){return{mode:this.options.mode??`full`,fedChunks:this.fedChunks,parsedChunks:this.parsedChunks,committedChars:this.committedChars,committedLines:this.committedLines,pendingChars:this.pending.length,pendingLines:f_(this.pending),retainedTokens:this.options.retainTokens!==!1}}resolveWindow(){let e=this.committedChars+this.pending.length,t=this.committedLines+f_(this.pending);return g_(this.md,e,t,this.options)}prepareGlobalStateEnv(e,t){if(this.globalStateEnv!==e&&(rf(e)&&cf(e),this.globalStateEnv=e,this.markedGlobalStateReason=null),this.markedGlobalStateReason)return;let n=nf(t);n&&(of(e,n),this.markedGlobalStateReason=n)}commitRanges(e,t){if(!e.length)return 0;this.prepareGlobalStateEnv(t,this.pending);let n=0;try{for(let r=0;r<e.length;r++){let i=e[r],a=this.pending.slice(i.start,i.end),o=this.md.core.parse(a,t,this.md).tokens,s=this.committedChars,c=this.committedLines;c!==0&&o.length&&d_(o,c),this.options.retainTokens!==!1&&u_(this.tokens,o),this.committedChars+=a.length,this.committedLines+=i.lineCount,this.parsedChunks+=1,this.options.onChunkTokens&&this.options.onChunkTokens(o,{chunkIndex:this.parsedChunks,chunkChars:a.length,chunkLines:i.lineCount,tokenCount:o.length,startOffset:s,endOffset:this.committedChars,startLine:c,endLine:this.committedLines}),n=i.end}return this.markedGlobalStateReason&&sf(t),n}catch(e){throw this.markedGlobalStateReason&&=(cf(t),this.globalStateEnv=null,null),e}}updateEnvDiagnostics(e,t,n){vf(e,{mode:this.options.mode??`full`,maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,committedChars:this.committedChars,committedLines:this.committedLines,pendingChars:this.pending.length,pendingLines:n,fedChunks:this.fedChunks,parsedChunks:this.parsedChunks,globalStateDetected:this.markedGlobalStateReason||void 0})}};function v_(e,t,n={},r={}){mf(n);let i=new __(e,{mode:`full`,...r});for(let e of t)i.feed(e),i.flushAvailable(n);return i.flushForce(n)}async function y_(e,t,n={},r={}){mf(n);let i=new __(e,{mode:`full`,...r});for await(let e of t)i.feed(e),i.flushAvailable(n);return i.flushForce(n)}function b_(e,t,n,r={},i={}){mf(r);let a=new __(e,{mode:`full`,...i,retainTokens:!1,onChunkTokens:n});for(let e of t)a.feed(e),a.flushAvailable(r);return a.flushForce(r),a.stats()}async function x_(e,t,n,r={},i={}){mf(r);let a=new __(e,{mode:`full`,...i,retainTokens:!1,onChunkTokens:n});for await(let e of t)a.feed(e),a.flushAvailable(r);return a.flushForce(r),a.stats()}function S_(e,t,n){if(e.options.autoUnbounded===!1)return!1;let r=e.options.autoUnboundedThresholdChars??i_,i=e.options.autoUnboundedThresholdLines??a_;return t>=r||n>=i}function C_(e,t,n){if(e.options.autoUnbounded===!1)return`no`;if(t>=(e.options.autoUnboundedThresholdChars??i_))return`yes`;let r=e.options.autoUnboundedThresholdLines??a_;return n===void 0?t<2*r-1?`no`:`need-lines`:n>=r?`yes`:`no`}function w_(e,t,n={},r={}){mf(n);let i=nf(t);if(rf(n)&&cf(n),r.fallbackOnGlobalState!==!1&&i)return vf(n,{mode:`full`,fallback:!0,fallbackReason:i,committedChars:t.length,committedLines:zd(t),pendingChars:0,pendingLines:0,fedChunks:1,parsedChunks:1,globalStateDetected:i}),af(n,i,()=>e.core.parse(t,n,e).tokens);let a=[],o=new __(e,{mode:`full`,...r,retainTokens:!1,onChunkTokens(e){u_(a,e)}});if(i&&of(n,i),o.feed(t),o.flushForce(n),i&&(sf(n),r.fallbackOnGlobalState===!1)){let e=ff(n)?.unbounded;e&&(e.globalStateDetected=i,e.globalStateFallbackDisabled=!0)}return a}var T_=(e,t,n)=>e<t?t:e>n?n:e;function E_(e){return e.experimental?{...e,...e.experimental}:e}var D_=[{max:5e3,strategy:`discrete`,maxChunkChars:32e3,maxChunkLines:150,maxChunks:8,notes:`<=5k`},{max:2e4,strategy:`discrete`,maxChunkChars:24e3,maxChunkLines:200,maxChunks:12,notes:`<=20k`},{max:1e5,strategy:`plain`,notes:`<=100k plain`},{max:2e5,strategy:`discrete`,maxChunkChars:2e4,maxChunkLines:150,maxChunks:12,notes:`<=200k`},{max:5e5,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:16,notes:`<=500k`},{max:5e6,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:16,notes:`<=5M`}],O_=[{max:5e3,strategy:`discrete`,maxChunkChars:16e3,maxChunkLines:250,maxChunks:8,notes:`<=5k`},{max:2e4,strategy:`discrete`,maxChunkChars:2e4,maxChunkLines:200,maxChunks:24,notes:`<=20k`},{max:1e5,strategy:`discrete`,maxChunkChars:2e4,maxChunkLines:200,maxChunks:24,notes:`<=100k`},{max:5e5,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:32,notes:`<=500k`},{max:5e6,strategy:`discrete`,maxChunkChars:64e3,maxChunkLines:700,maxChunks:32,notes:`<=5M`}];function k_(e,t){return{strategy:t.strategy,maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,maxChunks:t.maxChunks,fenceAware:e,notes:t.notes}}function A_(e,t=Math.max(0,e/40|0),n={}){let r=E_(n),i=r.fullChunkFenceAware??!0,a=r.fullChunkTargetChunks??8,o=r.fullChunkAdaptive!==!1;for(let t=0;t<D_.length;t++){let n=D_[t];if(e<=n.max){if(n.strategy!==`adaptive`)return k_(i,n);break}}return e>5e6?{strategy:`plain`,fenceAware:i,notes:`>5M plain`}:o?{strategy:`adaptive`,maxChunkChars:T_(Math.ceil(e/a),8e3,64e3),maxChunkLines:T_(Math.ceil(t/a),150,700),maxChunks:T_(Math.ceil(e/64e3),a,16),fenceAware:i,notes:`adaptive fallback`}:{strategy:`discrete`,maxChunkChars:r.fullChunkSizeChars??1e4,maxChunkLines:r.fullChunkSizeLines??200,fenceAware:i,maxChunks:r.fullChunkMaxChunks}}function j_(e,t=Math.max(0,e/40|0),n={}){let r=E_(n),i=r.streamChunkFenceAware??!0,a=r.streamChunkTargetChunks??8,o=r.streamChunkAdaptive!==!1;for(let t=0;t<O_.length;t++){let n=O_[t];if(e<=n.max){if(n.strategy!==`adaptive`)return k_(i,n);break}}return e>5e6?{strategy:`plain`,fenceAware:i,notes:`>5M plain`}:o?{strategy:`adaptive`,maxChunkChars:T_(Math.ceil(e/a),8e3,64e3),maxChunkLines:T_(Math.ceil(t/a),150,700),maxChunks:T_(Math.ceil(e/64e3),a,32),fenceAware:i,notes:`adaptive fallback`}:{strategy:`discrete`,maxChunkChars:r.streamChunkSizeChars??1e4,maxChunkLines:r.streamChunkSizeLines??200,maxChunks:r.streamChunkMaxChunks,fenceAware:i}}var M_={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`]},inline2:{rules:[`balance_pairs`,`emphasis`,`fragments_join`]}}},N_={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},P_={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`]},inline2:{rules:[`balance_pairs`,`fragments_join`]}}};function F_(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}function I_(e,t){if(F_(e))throw TypeError(`Renderer rule "${t}" returned a Promise. Use renderAsync() instead.`);return e}var L_=e=>F_(e)?e:Promise.resolve(e);function R_(e){switch(e){case`alt`:case`class`:case`href`:case`id`:case`lang`:case`rel`:case`src`:case`start`:case`style`:case`target`:case`title`:return e;default:return Tg(e)}}function z_(e){if(!e||e.length===0)return``;let t=e[0],n=` ${R_(t[0])}="${Tg(t[1])}"`;for(let t=1;t<e.length;t++){let r=e[t];n+=` ${R_(r[0])}="${Tg(r[1])}"`}return n}function B_(e){if(!e)return{langName:``,langAttrs:``};let t=0;for(;t<e.length;){let n=e.charCodeAt(t);if(n===32||n===9||n===10)break;t++}if(t>=e.length)return{langName:e,langAttrs:``};let n=t;for(;n<e.length;){let t=e.charCodeAt(n);if(t!==32&&t!==9&&t!==10)break;n++}return{langName:e.slice(0,t),langAttrs:n<e.length?e.slice(n):``}}function V_(e,t,n,r,i){if(t.indexOf(`<pre`)===0)return`${t}\n`;if(n){if(!e.attrs||e.attrs.length===0)return`<pre><code class="${Tg(`${i.langPrefix??`language-`}${r}`)}">${t}</code></pre>\n`;let n=e.attrIndex(`class`),a=e.attrs?e.attrs.slice():[],o=`${i.langPrefix??`language-`}${r}`;return n<0?a.push([`class`,o]):(a[n]=a[n].slice(),a[n][1]+=` ${o}`),`<pre><code${z_(a)}>${t}</code></pre>\n`}return`<pre><code${z_(e.attrs)}>${t}</code></pre>\n`}function H_(e){return!e.attrs||e.attrs.length===0?`<code>${Tg(e.content)}</code>`:`<code${z_(e.attrs)}>${Tg(e.content)}</code>`}function U_(e){let t=Tg(e.content);return e.attrs?`<pre${z_(e.attrs)}><code>${t}</code></pre>\n`:`<pre><code>${t}</code></pre>\n`}function W_(e,t){let n=e.attrs;if(!n||n.length===0)switch(e.type){case`paragraph_open`:return`${t}<p>`;case`heading_open`:return`<${e.tag}>`;case`td_open`:return`${t}<td>`;case`th_open`:return`${t}<th>`;default:return null}if(n.length===1&&n[0][0]===`style`){if(e.type===`td_open`)return`${t}<td style="${Tg(n[0][1])}">`;if(e.type===`th_open`)return`${t}<th style="${Tg(n[0][1])}">`}return null}function G_(e){let t=e.attrs;return!t||t.length===0?`<a>`:t.length===1?`<a ${R_(t[0][0])}="${Tg(t[0][1])}">`:t.length===2?`<a ${R_(t[0][0])}="${Tg(t[0][1])}" ${R_(t[1][0])}="${Tg(t[1][1])}">`:`<a${z_(t)}>`}function K_(e){switch(e.type){case`text`:case`text_special`:case`softbreak`:case`hardbreak`:case`html_inline`:case`code_inline`:case`image`:return!0;default:return!1}}function q_(e){switch(e.type){case`text`:case`text_special`:case`softbreak`:case`hardbreak`:case`html_inline`:case`code_inline`:return!0;default:return!1}}function J_(e,t){if(e.hidden)return``;let n=e.attrs,r=e.nesting,i=e.tag;if(!n||n.length===0)return r===0?t?`<${i} />`:`<${i}>`:r===-1?`</${i}>`:`<${i}>`;let a=(r===-1?`</`:`<`)+i+z_(n);return r===0&&t&&(a+=` /`),`${a}>`}var Y_={langPrefix:`language-`,xhtmlOut:!1,breaks:!1},X_=Object.prototype.hasOwnProperty,Z_={code_inline(e,t){return H_(e[t])},code_block(e,t){return U_(e[t])},fence(e,t,n,r,i){let a=e[t],o=a.info?Og(a.info).trim():``,{langName:s,langAttrs:c}=B_(o),l=n.highlight,u=Tg(a.content);if(!l)return V_(a,u,o,s,n);let d=l(a.content,s,c);return F_(d)?d.then(e=>V_(a,e||u,o,s,n)):V_(a,d||u,o,s,n)},image(e,t,n,r,i){let a=e[t],o=i.renderInlineAsText(a.children||[],n,r),s=a.attrIndex(`alt`);return s>=0&&a.attrs?a.attrs[s][1]=o:a.attrs?a.attrs.push([`alt`,o]):a.attrs=[[`alt`,o]],J_(a,n.xhtmlOut===!0)},hardbreak(e,t,n){return n.xhtmlOut?`<br />
|
|
29
|
-
`:`<br>
|
|
30
|
-
`},softbreak(e,t,n){return n.breaks?n.xhtmlOut?`<br />
|
|
31
|
-
`:`<br>
|
|
32
|
-
`:`
|
|
33
|
-
`},text(e,t){return Tg(e[t].content)},text_special(e,t){return Tg(e[t].content)},html_block(e,t){return e[t].content},html_inline(e,t){return e[t].content}};function Q_(e,t,n){let r=e.info?Og(e.info).trim():``,{langName:i,langAttrs:a}=B_(r),o=t.highlight,s=Tg(e.content);if(!o)return V_(e,s,r,i,t);let c=o(e.content,i,a);if(F_(c))throw TypeError(`Renderer rule "fence" returned a Promise. Use renderAsync() instead.`);return V_(e,c||s,r,i,t)}function $_(e,t,n,r){switch(e.type){case`text`:return t.text===Z_.text?e.content.length===0?``:Tg(e.content):null;case`text_special`:return t.text_special===Z_.text_special?e.content.length===0?``:Tg(e.content):null;case`softbreak`:return t.softbreak===Z_.softbreak?r:null;case`hardbreak`:return t.hardbreak===Z_.hardbreak?n:null;case`html_inline`:return t.html_inline===Z_.html_inline?e.content:null;case`code_inline`:return t.code_inline===Z_.code_inline?H_(e):null;default:return null}}function ev(e,t,n,r,i){let a=e[0];switch(a.type){case`text`:if(i.text===Z_.text)return a.content.length===0?``:Tg(a.content);break;case`text_special`:if(i.text_special===Z_.text_special)return a.content.length===0?``:Tg(a.content);break;case`softbreak`:if(i.softbreak===Z_.softbreak)return t.breaks?t.xhtmlOut?`<br />
|
|
34
|
-
`:`<br>
|
|
35
|
-
`:`
|
|
36
|
-
`;break;case`hardbreak`:if(i.hardbreak===Z_.hardbreak)return t.xhtmlOut?`<br />
|
|
37
|
-
`:`<br>
|
|
38
|
-
`;break;case`html_inline`:if(i.html_inline===Z_.html_inline)return a.content;break;case`code_inline`:if(i.code_inline===Z_.code_inline)return H_(a)}let o=i[a.type];if(!o)return J_(a,t.xhtmlOut===!0);let s=o(e,0,t,n,r);return typeof s==`string`?s:I_(s,a.type)}var tv=class{rules;baseOptions;normalizedBase;constructor(e={}){this.baseOptions={...e},this.normalizedBase=this.buildNormalizedBase(),this.rules={...Z_}}set(e){return this.baseOptions={...this.baseOptions,...e},this.normalizedBase=this.buildNormalizedBase(),this}render(e,t,n){if(!Array.isArray(e))throw TypeError(`render expects token array as first argument`);if(e.length===1)return this.renderSingleToken(e,e[0],t,n);let r=this.mergeOptions(t),i=n??{},a=this.rules,o=r.xhtmlOut===!0,s,c,l,u,d,f,p=``,m=``,h=!1,g=``;for(let t=0;t<e.length;t++){let n=e[t],_=n.type,v=t>0&&e[t-1].hidden?`
|
|
39
|
-
`:``;if(_===`list_item_open`&&(!n.attrs||n.attrs.length===0)&&t+3<e.length){let n=e[t+1],a=e[t+2],o=e[t+3];if(n.type===`paragraph_open`&&n.hidden&&a.type===`inline`&&o.type===`paragraph_close`&&o.hidden){g+=`${v}<li>${this.renderInlineTokens(a.children||[],r,i)}`,t+=3;continue}}if(t+2<e.length){let a=e[t+1],o=e[t+2];if(a.type===`inline`&&o.nesting===-1&&o.tag===n.tag&&!o.hidden){let e=W_(n,v);if(e!==null){g+=`${e+this.renderInlineTokens(a.children||[],r,i)}</${n.tag}>\n`,t+=2;continue}}}if(_===`inline`){let e=n.children||[];if(e.length===1){h||=(s=a.text,c=a.text_special,l=a.softbreak,u=a.hardbreak,d=a.html_inline,f=a.code_inline,p=r.xhtmlOut?`<br />
|
|
40
|
-
`:`<br>
|
|
41
|
-
`,m=r.breaks?p:`
|
|
42
|
-
`,!0);let t=e[0];switch(t.type){case`text`:if(s===Z_.text){g+=Tg(t.content);continue}break;case`text_special`:if(c===Z_.text_special){g+=Tg(t.content);continue}break;case`softbreak`:if(l===Z_.softbreak){g+=m;continue}break;case`hardbreak`:if(u===Z_.hardbreak){g+=p;continue}break;case`html_inline`:if(d===Z_.html_inline){g+=t.content;continue}break;case`code_inline`:if(f===Z_.code_inline){g+=H_(t);continue}}}g+=this.renderInlineTokens(e,r,i);continue}let y=a[_];if(!y){let i=n.attrs;if(!n.hidden){if(!i||i.length===0)switch(_){case`hr`:g+=o?`<hr />
|
|
43
|
-
`:`<hr>
|
|
44
|
-
`;continue;case`heading_open`:g+=`<${n.tag}>`;continue;case`heading_close`:g+=`</${n.tag}>\n`;continue;case`paragraph_open`:g+=`${v}<p>`;continue;case`paragraph_close`:g+=`</p>
|
|
45
|
-
`;continue;case`list_item_open`:{let n=e[t+1];g+=v+(n&&(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===`li`)?`<li>`:`<li>
|
|
46
|
-
`);continue}case`list_item_close`:g+=`</li>
|
|
47
|
-
`;continue;case`bullet_list_open`:g+=`${v}<ul>\n`;continue;case`bullet_list_close`:g+=`</ul>
|
|
48
|
-
`;continue;case`blockquote_open`:g+=v+(e[t+1]&&e[t+1].nesting===-1&&e[t+1].tag===`blockquote`?`<blockquote>`:`<blockquote>
|
|
49
|
-
`);continue;case`blockquote_close`:g+=`</blockquote>
|
|
50
|
-
`;continue;case`ordered_list_open`:g+=`${v}<ol>\n`;continue;case`ordered_list_close`:g+=`</ol>
|
|
51
|
-
`;continue;case`table_open`:g+=`${v}<table>\n`;continue;case`table_close`:g+=`</table>
|
|
52
|
-
`;continue;case`thead_open`:g+=`${v}<thead>\n`;continue;case`thead_close`:g+=`</thead>
|
|
53
|
-
`;continue;case`tbody_open`:g+=`${v}<tbody>\n`;continue;case`tbody_close`:g+=`</tbody>
|
|
54
|
-
`;continue;case`tr_open`:g+=`${v}<tr>\n`;continue;case`tr_close`:g+=`</tr>
|
|
55
|
-
`;continue;case`td_open`:g+=`${v}<td>`;continue;case`td_close`:g+=`</td>
|
|
56
|
-
`;continue;case`th_open`:g+=`${v}<th>`;continue;case`th_close`:g+=`</th>
|
|
57
|
-
`;continue}else if(i.length===1){let e=i[0];if(_===`ordered_list_open`&&e[0]===`start`){g+=`${v}<ol start="${Tg(e[1])}">\n`;continue}if(_===`td_open`&&e[0]===`style`){g+=`${v}<td style="${Tg(e[1])}">`;continue}if(_===`th_open`&&e[0]===`style`){g+=`${v}<th style="${Tg(e[1])}">`;continue}}}g+=this.renderToken(e,t,r);continue}if(_===`code_block`&&y===Z_.code_block){g+=U_(n);continue}if(_===`fence`&&y===Z_.fence){g+=Q_(n,r,this);continue}if(_===`html_block`&&y===Z_.html_block){g+=n.content;continue}let b=y(e,t,r,i,this);g+=typeof b==`string`?b:I_(b,n.type)}return g}async renderAsync(e,t,n){if(!Array.isArray(e))throw TypeError(`render expects token array as first argument`);let r=this.mergeOptions(t),i=n??{},a=this.rules,o=``;for(let t=0;t<e.length;t++){let n=e[t];if(n.type===`inline`){o+=await this.renderInlineTokensAsync(n.children||[],r,i);continue}let s=a[n.type];o+=s?await L_(s(e,t,r,i,this)):this.renderToken(e,t,r)}return o}renderInline(e,t,n){let r=this.mergeOptions(t),i=n??{};return this.renderInlineTokens(e,r,i)}async renderInlineAsync(e,t,n){let r=this.mergeOptions(t),i=n??{};return this.renderInlineTokensAsync(e,r,i)}renderInlineAsText(e,t,n){let r=this.mergeOptions(t),i=n??{};return this.renderInlineAsTextInternal(e,r,i)}renderAttrs(e){return z_(e.attrs)}renderToken(e,t,n){let r=e[t];if(r.hidden)return``;let i=r.block,a=r.nesting,o=r.tag,s=r.attrs,c=!1;if(i&&(c=!0,a===1&&t+1<e.length)){let n=e[t+1];(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===o)&&(c=!1)}let l=i&&a!==-1&&t>0&&e[t-1].hidden?`
|
|
58
|
-
`:``,u=c?`>
|
|
59
|
-
`:`>`;if(!s||s.length===0)return a===0?n.xhtmlOut?`${l}<${o} /${u}`:`${l}<${o}${u}`:a===-1?`${l}</${o}${u}`:`${l}<${o}${u}`;let d=l+(a===-1?`</`:`<`)+o+z_(s);return a===0&&n.xhtmlOut&&(d+=` /`),d+u}mergeOptions(e){let t=this.normalizedBase;if(!e||e.highlight===t.highlight&&e.langPrefix===t.langPrefix&&e.xhtmlOut===t.xhtmlOut&&e.breaks===t.breaks)return t;let n=null,r=()=>(n||={...t},n);if(X_.call(e,`highlight`)&&e.highlight!==t.highlight&&(r().highlight=e.highlight),X_.call(e,`langPrefix`)){let n=e.langPrefix;n!==t.langPrefix&&(r().langPrefix=n)}if(X_.call(e,`xhtmlOut`)){let n=e.xhtmlOut;n!==t.xhtmlOut&&(r().xhtmlOut=n)}if(X_.call(e,`breaks`)){let n=e.breaks;n!==t.breaks&&(r().breaks=n)}return n||t}buildNormalizedBase(){return Object.freeze({...Y_,...this.baseOptions})}renderSingleToken(e,t,n,r){let i=this.rules,a=t.type;if(a===`code_block`&&i.code_block===Z_.code_block)return U_(t);if(a===`html_block`&&i.html_block===Z_.html_block)return t.content;let o=this.mergeOptions(n),s=r??{};if(a===`inline`)return this.renderInlineTokens(t.children||[],o,s);let c=i[a];if(!c)return t.block?this.renderToken(e,0,o):J_(t,o.xhtmlOut===!0);if(a===`fence`&&c===Z_.fence)return Q_(t,o,this);let l=c(e,0,o,s,this);return typeof l==`string`?l:I_(l,a)}renderInlineTokens(e,t,n){if(!e||e.length===0)return``;let r=this.rules;if(e.length===1)return ev(e,t,n,this,r);let i=t.xhtmlOut===!0,a=i?`<br />
|
|
60
|
-
`:`<br>
|
|
61
|
-
`,o=t.breaks?a:`
|
|
62
|
-
`,s=r.text,c=r.text_special,l=r.softbreak,u=r.hardbreak,d=r.html_inline,f=r.code_inline,p=r.link_open,m=r.link_close,h=r.em_open,g=r.em_close,_=r.strong_open,v=r.strong_close,y=``;for(let b=0;b<e.length;b++){let x=e[b];if(x.type===`link_open`&&!p&&!m&&b+2<e.length){let t=e[b+1];if(e[b+2].type===`link_close`&&K_(t)){let n=$_(t,r,a,o);if(n!==null){let t=`${G_(x)+n}</a>`;if(l===Z_.softbreak&&b+3<e.length&&e[b+3].type===`softbreak`){y+=t+o,b+=3;continue}y+=t,b+=2;continue}}}if(x.type===`link_open`&&!p&&!m&&b+1<e.length&&e[b+1].type===`link_close`){y+=`${G_(x)}</a>`,b+=1;continue}if(x.type===`em_open`&&!h&&!g&&b+2<e.length){let t=e[b+1];if(e[b+2].type===`em_close`&&q_(t)){let e=$_(t,r,a,o);if(e!==null){y+=`<em>${e}</em>`,b+=2;continue}}}if(x.type===`strong_open`&&!_&&!v&&b+2<e.length){let t=e[b+1];if(e[b+2].type===`strong_close`&&q_(t)){let e=$_(t,r,a,o);if(e!==null){y+=`<strong>${e}</strong>`,b+=2;continue}}}switch(x.type){case`text`:if(s===Z_.text){let t=x.content.length===0?``:Tg(x.content);if(d===Z_.html_inline&&b+1<e.length&&e[b+1].type===`html_inline`){for(y+=t+e[++b].content;b+1<e.length&&e[b+1].type===`html_inline`;)y+=e[++b].content;continue}y+=t;continue}break;case`text_special`:if(c===Z_.text_special){x.content.length!==0&&(y+=Tg(x.content));continue}break;case`softbreak`:if(l===Z_.softbreak){y+=o;continue}break;case`hardbreak`:if(u===Z_.hardbreak){y+=a;continue}break;case`html_inline`:if(d===Z_.html_inline){for(y+=x.content;b+1<e.length&&e[b+1].type===`html_inline`;)y+=e[++b].content;continue}break;case`code_inline`:if(f===Z_.code_inline){y+=H_(x);continue}}let S=r[x.type];if(!S){y+=x.block?this.renderToken(e,b,t):J_(x,i);continue}let C=S(e,b,t,n,this);y+=typeof C==`string`?C:I_(C,x.type)}return y}async renderInlineTokensAsync(e,t,n){if(!e||e.length===0)return``;let r=this.rules,i=``;for(let a=0;a<e.length;a++){let o=r[e[a].type];i+=o?await L_(o(e,a,t,n,this)):this.renderToken(e,a,t)}return i}renderInlineAsTextInternal(e,t,n){if(!e||e.length===0)return``;let r=``;for(let i=0;i<e.length;i++){let a=e[i];switch(a.type){case`text`:case`text_special`:r+=a.content;break;case`image`:r+=this.renderInlineAsTextInternal(a.children||[],t,n);break;case`html_inline`:case`html_block`:r+=a.content;break;case`softbreak`:case`hardbreak`:r+=`
|
|
63
|
-
`}}return r}},nv=[],rv=4096;function iv(e){let t={...e};return Array.isArray(e.quotes)&&(t.quotes=[...e.quotes]),e.experimental&&(t.experimental={...e.experimental}),t}function av(e,t){let n=Object.keys(t);return Object.keys(e).length===n.length&&n.every(n=>{if(!Object.hasOwn(e,n))return!1;let r=e[n],i=t[n];if(Array.isArray(r)&&Array.isArray(i))return r.length===i.length&&r.every((e,t)=>Object.is(e,i[t]));if(n===`experimental`&&r&&i){let e=r,t=i,n=Object.keys(t);return Object.keys(e).length===n.length&&n.every(n=>Object.hasOwn(e,n)&&Object.is(e[n],t[n]))}return Object.is(r,i)})}function ov(e){return{options:iv(e.options),coreVersion:e.core.ruler.version,blockVersion:e.block.ruler.version,inlineVersion:e.inline.ruler.version,inline2Version:e.inline.ruler2.version}}function sv(e,t){return av(e.options,t.options)&&e.coreVersion===t.core.ruler.version&&e.blockVersion===t.block.ruler.version&&e.inlineVersion===t.inline.ruler.version&&e.inline2Version===t.inline.ruler2.version}function cv(e){let t=e.length,n=0;for(;n<=t;){let r=e.indexOf(`
|
|
64
|
-
`,n);r===-1&&(r=t);let i=r<t,a=n,o=0;for(;a<r;){let t=e.charCodeAt(a);if(t===32){if(o++,a++,o>=4)return!0;continue}if(t===9){if(o+=4-o%4,a++,o>=4)return!0;continue}break}if(a<r){let t=e.charCodeAt(a);switch(t){case 35:{let t=a;for(;t<r&&e.charCodeAt(t)===35;)t++;let n=t-a;if(n>0&&n<=6){if(t<r){let n=e.charCodeAt(t);if(n===32||n===9||n===13)return!0}else if(t===r&&i)return!0}break}case 62:{let t=a+1;if(t<r){let n=e.charCodeAt(t);if(n===32||n===9||n===13)return!0}else if(t===r&&i)return!0;break}case 45:case 42:case 43:{let t=a+1;if(t<r){let n=e.charCodeAt(t);if(n===32||n===9||n===13)return!0}else if(t===r&&i)return!0;break}case 96:case 126:{let n=a;for(;n<r&&e.charCodeAt(n)===t;)n++;if(n-a>=3)return!0;break}default:if(t>=48&&t<=57){let t=a+1;for(;t<r;){let n=e.charCodeAt(t);if(n<48||n>57)break;t++}if(t<r&&e.charCodeAt(t)===46){let n=t+1;if(n<r){let t=e.charCodeAt(n);if(t===32||t===9||t===13)return!0}else if(n===r&&i)return!0}}}}if(r===t)break;n=r+1}return!1}function lv(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n][0]!==t[n][0]||e[n][1]!==t[n][1])return!1;return!0}function uv(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!dv(e[n],t[n]))return!1;return!0}function dv(e,t){if(!e||!t||e.type!==t.type)return!1;let n=e.map,r=t.map;return!!n!=!!r||n&&r&&(n[0]!==r[0]||n[1]!==r[1])||e.tag!==t.tag||e.nesting!==t.nesting||e.markup!==t.markup||e.info!==t.info||e.block!==t.block||e.hidden!==t.hidden||!lv(e.attrs,t.attrs)||!uv(e.children,t.children)?!1:(e.content||``)===(t.content||``)}function fv(){return{total:0,cacheHits:0,appendHits:0,unboundedAppendHits:0,tailHits:0,fullParses:0,resets:0,chunkedParses:0,lastMode:`idle`}}var pv=class{core;anchorBlock=new Hh;cache=null;snapshots=new WeakSet;stats=fv();normalizeLineEndings=!0;tokenMapsTrusted=!0;allowUntrustedTailReuse=!1;MIN_SIZE_FOR_OPTIMIZATION=1e3;DEFAULT_SKIP_CACHE_CHARS=1e6;DEFAULT_SKIP_CACHE_LINES=1e5;IMPLICIT_STREAM_CHUNK_MIN_CHARS=16e4;MIN_LIST_LINES_FOR_MERGE=80;MIN_LIST_CHARS_FOR_MERGE=800;MIN_TABLE_LINES_FOR_MERGE=48;MIN_TABLE_CHARS_FOR_MERGE=1200;MIN_UNBOUNDED_APPEND_TOTAL_CHARS=5e5;MIN_UNBOUNDED_APPEND_CHARS=64e3;MIN_UNBOUNDED_APPEND_LINES=700;constructor(e){this.core=e}reset(){this.cache=null,this.stats.resets+=1,this.stats.lastMode=`reset`}resetStats(){let{resets:e}=this.stats;this.stats=fv(),this.stats.resets=e}snapshot(){let e=this.cache;if(!e)return null;let t=e.snapshotState??{cache:e};e.snapshotState=t;let n={state:t,get sourceLength(){return this.state.cache.src.length},get tokenCount(){return this.state.cache.tokens.length}};return this.snapshots.add(n),n}restore(e,t){if(!this.snapshots.has(e))throw TypeError(`Invalid stream snapshot`);let n=e.state.cache;return this.cache=n,sv(n.config,t)?n.tokens:this.parse(n.src,n.env,t)}append(e,t,n){let r=this.cache;if(!r)throw Error(`Stream append requires cached history; call stream.parse(fullSource) first`);return this.ensureBoundaryState(r),this.parse(r.src+e,t,n,e)}parse(e,t,n,r){let i=this.cache,a=i?.env,o=n.core.ruler.getNamedRules(``),s=o.findIndex(e=>e.fn===km),c=o.findIndex(e=>e.fn===Yf),l=o.find(e=>e.name===`normalize`);this.normalizeLineEndings=s>=0&&c>=0&&s<c;let u=t,d=!!i&&!sv(i.config,n),f=l&&l.fn!==km,p=l&&!this.normalizeLineEndings&&e.includes(`\r`),m=c<0||o.slice(0,c).some(e=>e.fn!==km);this.tokenMapsTrusted=!(c<0||o.slice(c+1).some(e=>e.fn!==_m&&e.fn!==Em&&e.fn!==Lm&&e.fn!==Wm&&e.fn!==Gm)),this.allowUntrustedTailReuse=this.tokenMapsTrusted||n.options?.streamTailLocalPostBlockRules===!0;let h=d||f||p||m?null:i;if(mf(u??i?.env??a),!h||u&&u!==h.env){let t=u??i?.env??a??{},o=!!n.__explicitStreamChunkFallbackSetting,s=typeof n.__canUseImplicitLargeInputStrategy!=`function`||n.__canUseImplicitLargeInputStrategy(),c=!!n.options?.streamChunkedFallback,l=!o&&s,d=c||l,f=n.options?.streamChunkAdaptive!==!1,p=n.options?.streamChunkTargetChunks??8,m=n.options?.streamChunkSizeChars,h=n.options?.streamChunkSizeLines,g=n.options?.streamChunkMaxChunks,_=!!n.__explicitStreamChunkConfig,v=n.options?.autoTuneChunks!==!1,y=n.options?.streamChunkFenceAware??!0,b=n.options?.streamLargeCachePolicy??`retain`,x=n.options?.streamSkipCacheAboveChars??this.DEFAULT_SKIP_CACHE_CHARS,S=n.options?.streamSkipCacheAboveLines??this.DEFAULT_SKIP_CACHE_LINES,C,w=!1;if(b===`skip`&&(w=e.length>=x,!w&&S!==void 0&&(C=zd(e),w=C>=S)),w&&r===void 0&&!i?.snapshotState){let r=this.parseFullDocument(e,t,n,C,!1);return this.cache=null,this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,gf(t,{area:`stream`,path:`stream-full`,reason:`skip-cache-large-one-shot`,unbounded:!!ff(t)?.unbounded}),r.tokens}if(d){let r=(e,t,n)=>e<t?t:e>n?n:e;C===void 0&&(C=zd(e));let i=v&&!_?j_(e.length,C,n.options):null,a=i?.maxChunkChars??(f?r(Math.ceil(e.length/p),8e3,64e3):m??1e4),o=i?.maxChunkLines??(f?r(Math.ceil(C/p),150,700):h??200),s=i?.maxChunks??(f?r(Math.ceil(e.length/64e3),p,32):g),u=e.length>0&&e.charCodeAt(e.length-1)===10,d=l&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&i?.strategy!==`plain`;if((c||d)&&(e.length>=a*2||C>=o*2)&&u){let r=Xg(n,e,t,{maxChunkChars:a,maxChunkLines:o,fenceAware:i?.fenceAware??y,maxChunks:s}),l=ff(t)?.chunk?.globalStateDetected??null,u=this.setCache({src:e,tokens:r,env:t,lineCount:C,lastSegment:void 0,globalStateReason:l},n);return this.updateCacheLineCount(u,C),this.recordChunkedParseResult(t,c?`explicit-initial-large-doc`:`default-initial-large-doc`),r}}let T=this.parseFullDocument(e,t,n,C);C=T.lineCount;let E=this.setCache({src:e,tokens:T.tokens,env:t,lineCount:C,lastSegment:void 0,globalStateReason:T.globalStateReason},n);return this.updateCacheLineCount(E,C),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,gf(t,{area:`stream`,path:`stream-full`,reason:`initial-parse`,unbounded:!!ff(t)?.unbounded}),T.tokens}if(e===h.src)return this.stats.total+=1,this.stats.cacheHits+=1,this.stats.lastMode=`cache`,gf(h.env,{area:`stream`,path:`stream-cache`,reason:`same-source`}),h.tokens;let g=r===void 0?e.startsWith(h.src)?e.slice(h.src.length):null:r,_=h.globalStateReason;_===void 0&&(_=nf(h.src),h.globalStateReason=_);let v=_?null:g===null?nf(e):this.detectGlobalStateForAppend(h,g),y=_||v;if(y){let t=u??h.env;cf(t);let r=this.parseFullDocument(e,t,n),i=r.tokens,a=r.lineCount,o=this.setCache({src:e,tokens:i,env:t,lineCount:a,lastSegment:void 0,globalStateReason:r.globalStateReason},n);return this.updateCacheLineCount(o,a),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,gf(t,{area:`stream`,path:`stream-full`,reason:`global-state:${y}`,unbounded:!!ff(t)?.unbounded}),i}let b=n.options?.streamOptimizationMinSize??this.MIN_SIZE_FOR_OPTIMIZATION;if(h.src.length<b&&e.length<b*1.5&&g===null){let t=u??h.env,r=this.parseFullDocument(e,t,n),i=r.tokens,a=r.lineCount,o=this.setCache({src:e,tokens:i,env:t,lineCount:a,lastSegment:void 0,globalStateReason:r.globalStateReason},n);return this.updateCacheLineCount(o,a),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,gf(t,{area:`stream`,path:`stream-full`,reason:`small-non-append`,unbounded:!!ff(t)?.unbounded}),i}let x=this.ensureLastSegment(h,r!==void 0),S=this.tokenMapsTrusted||this.allowUntrustedTailReuse&&(h.lastSegmentVerified===!0||!!(x&&this.hasVerifiedSegmentAnchor(h,x,n))),C=g!==null&&this.shouldPreferTailReparseForAppend(h,S)||!this.tokenMapsTrusted?null:this.getAppendedSegment(h,e,g);if(C){let t=h.lineCount??zd(h.src),r=3;C.length>5e3?r=8:C.length>1e3?r=6:C.length>200&&(r=4),r=Math.min(r,t);let i=null,a=n.options?.streamContextParseStrategy??`chars`,o=n.options?.streamContextParseMinChars??200,s=n.options?.streamContextParseMinLines??2,c,l=()=>(c===void 0&&(c=zd(C)),c),u=this.canDirectlyParseAppend(h),d=u&&this.shouldUseUnboundedAppend(e,h,C),f=!1;if(!u)switch(a){case`lines`:f=l()>=s;break;case`constructs`:if(C.length>=o){f=!0;break}if(cv(C)){f=!0;break}f=l()>=s;break;default:f=C.length>=o}if(r>0&&f){let e=this.getTailLines(h.src,r)+C;try{let a=this.core.parse(e,h.env,n).tokens,o=a.findIndex(e=>e.map&&typeof e.map[1]==`number`&&e.map[1]>r);if(o!==-1){let e=a.slice(o),n=t-r;n!==0&&this.shiftTokenLines(e,n),i={tokens:e}}}catch{i=null}}else i=null;if(!i){let e=t;if(d)i={tokens:w_(n,C,h.env,{mode:`stream`})},e>0&&this.shiftTokenLines(i.tokens,e);else{let t=this.core.parse(C,h.env,n);e>0&&this.shiftTokenLines(t.tokens,e),i=t}}let p=0;if(h.tokens.length>0&&i.tokens.length>0){let e=h.tokens[h.tokens.length-1],t=i.tokens[0];try{e.type===`inline`&&t.type===`inline`&&(t.children&&t.children.length>0&&(e.children||=[],this.appendTokens(e.children,t.children)),e.content=(e.content||``)+(t.content||``),p=1)}catch{p=0}}let m=h.tokens.length;if(i.tokens.length>p){let e=h.tokens,t=i.tokens,n=Math.min(e.length,t.length-p),r=0;for(let i=n;i>0;i--){let n=!0;for(let r=0;r<i;r++){let a=e[e.length-i+r],o=t[p+r];if(!dv(a,o)){n=!1;break}}if(n){r=i;break}}r>0&&(p+=r),t.length>p&&this.appendTokens(h.tokens,t,p)}if(h.boundary?this.updateBoundaryStateForAppend(h,C):this.updateFenceMarkerCacheForAppend(h,C),h.src=e,h.globalStateReason=null,h.lineCount=t+(c??l()),h.tokens.length>m){let n=this.getLastSegment(h.tokens,e,m,h.tokens.length,e.length-C.length,t);if(n){h.lastSegment=n;let t=e.length-C.length;h.lastSegmentSource=C.slice(Math.max(0,n.srcOffset-t))}else h.lastSegment=void 0,h.lastSegmentSource=void 0}else h.lastSegment=void 0,h.lastSegmentSource=void 0;return h.lastSegmentVerified=void 0,this.stats.total+=1,this.stats.appendHits+=1,d&&(this.stats.unboundedAppendHits=(this.stats.unboundedAppendHits||0)+1),this.stats.lastMode=`append`,gf(h.env,{area:`stream`,path:d?`stream-unbounded-append`:`stream-append`,reason:d?`large-delta`:`safe-append`,unbounded:d}),h.tokens}let w=u??h.env,T=S?this.tryTailSegmentReparse(e,h,w,n,x??void 0,g??void 0):this.allowUntrustedTailReuse?this.tryUntrustedParagraphTailReparse(e,h,w,n):null;if(T)return this.stats.total+=1,this.stats.tailHits+=1,this.stats.lastMode=`tail`,gf(w,{area:`stream`,path:`stream-tail`,reason:`tail-reparse`}),T;let E=!!n.__explicitStreamChunkFallbackSetting,D=typeof n.__canUseImplicitLargeInputStrategy!=`function`||n.__canUseImplicitLargeInputStrategy(),O=!!n.options?.streamChunkedFallback,k=!E&&!C&&D,A=O||k,j=n.options?.streamChunkAdaptive!==!1,ee=n.options?.streamChunkTargetChunks??8,te=n.options?.streamChunkSizeChars,M=n.options?.streamChunkSizeLines,N=n.options?.streamChunkMaxChunks,P=!!n.__explicitStreamChunkConfig,F=n.options?.autoTuneChunks!==!1,I=n.options?.streamChunkFenceAware??!0,L=C&&h.lineCount!==void 0?h.lineCount+zd(C):void 0;if(A){L===void 0&&(L=zd(e));let t=(e,t,n)=>e<t?t:e>n?n:e,r=F&&!P?j_(e.length,L,n.options):null,i=r?.maxChunkChars??(j?t(Math.ceil(e.length/ee),8e3,64e3):te??1e4),a=r?.maxChunkLines??(j?t(Math.ceil(L/ee),150,700):M??200),o=r?.maxChunks??(j?t(Math.ceil(e.length/64e3),ee,32):N),s=e.length>0&&e.charCodeAt(e.length-1)===10,c=k&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&r?.strategy!==`plain`;if((O||c)&&(e.length>=i*2||L>=a*2)&&s){let t=Xg(n,e,w,{maxChunkChars:i,maxChunkLines:a,fenceAware:r?.fenceAware??I,maxChunks:o}),s=ff(w)?.chunk?.globalStateDetected??null,c=this.setCache({src:e,tokens:t,env:w,lineCount:L,lastSegment:void 0,globalStateReason:s},n);return this.updateCacheLineCount(c,L),this.recordChunkedParseResult(w,O?`explicit-fallback-large-doc`:`default-fallback-large-doc`),t}}let ne=this.parseFullDocument(e,w,n,L),re=ne.tokens;L=ne.lineCount;let ie=this.setCache({src:e,tokens:re,env:w,lineCount:L,lastSegment:void 0,globalStateReason:ne.globalStateReason},n);return this.updateCacheLineCount(ie,L),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode=`full`,gf(w,{area:`stream`,path:`stream-full`,reason:`fallback-full`,unbounded:!!ff(w)?.unbounded}),re}recordChunkedParseResult(e,t){let n=ff(e)?.chunk,r=n?.fallback?String(n.fallbackReason||`global-state`):null;if(this.stats.total+=1,r){this.stats.fullParses+=1,this.stats.lastMode=`full`,gf(e,{area:`stream`,path:`stream-full`,reason:`global-state:${r}`,unbounded:!!ff(e)?.unbounded});return}this.stats.chunkedParses=(this.stats.chunkedParses||0)+1,this.stats.lastMode=`chunked`,gf(e,{area:`stream`,path:`stream-chunked`,chunked:!0,reason:t})}parseFullDocument(e,t,n,r,i=!0){rf(t)&&cf(t);let a=typeof n.__canUseImplicitLargeInputStrategy!=`function`||n.__canUseImplicitLargeInputStrategy()?C_(n,e.length,r):`no`;if(a===`yes`){let a=w_(n,e,t),o=ff(t)?.unbounded?.globalStateDetected??null;return gf(t,{area:`stream`,path:`stream-full`,reason:`auto-unbounded-char-threshold`,unbounded:!0}),{tokens:a,lineCount:r??(i?zd(e):0),globalStateReason:o}}let o=r;if(a===`need-lines`&&(o=zd(e),S_(n,e.length,o))){let r=w_(n,e,t),i=ff(t)?.unbounded?.globalStateDetected??null;return gf(t,{area:`stream`,path:`stream-full`,reason:`auto-unbounded-line-threshold`,unbounded:!0}),{tokens:r,lineCount:o,globalStateReason:i}}o===void 0&&(o=i?zd(e):0);let s=nf(e);return{tokens:af(t,s,()=>this.core.parse(e,t,n).tokens),lineCount:o,globalStateReason:s}}shouldUseUnboundedAppend(e,t,n){return!n||e.length<this.MIN_UNBOUNDED_APPEND_TOTAL_CHARS&&n.length<this.MIN_UNBOUNDED_APPEND_CHARS?!1:n.length>=this.MIN_UNBOUNDED_APPEND_CHARS||zd(n)>=this.MIN_UNBOUNDED_APPEND_LINES}getAppendedSegment(e,t,n){let r=e.src;if(n===null||n===void 0&&!t.startsWith(r)||(n===void 0?!r.endsWith(`
|
|
65
|
-
`):!this.ensureBoundaryState(e).endsWithNewline))return null;let i=n??t.slice(r.length);if(!i)return null;let a=i.length;if(i.charCodeAt(a-1)!==10)return null;let o=0,s=-1;for(let e=0;e<a&&!(i.charCodeAt(e)===10&&(s===-1&&(s=e),o++,o>=2));e++);if(o<2)return null;let c=(s===-1?i:i.slice(0,s)).trim();if(c.length===0)return null;if(/^[-=]+$/.test(c)){let t;if(n!==void 0)t=this.ensureBoundaryState(e).previousLineNonBlank;else{let e=r.slice(0,-1),n=e.lastIndexOf(`
|
|
66
|
-
`);t=e.slice(n+1).trim().length>0}if(t)return null}if(n!==void 0){let t=this.ensureLastSegment(e);if(t&&this.segmentHasFence(e,t)){let n=this.tokenMapsTrusted?this.ensureSegmentSourceOffset(e,t):0;if(this.endsInsideOpenFence(r,n))return null}}else{let t=this.tokenMapsTrusted?this.ensureLastSegment(e)?.srcOffset??0:0;if((this.tokenMapsTrusted||this.cacheHasFenceMarker(e))&&this.endsInsideOpenFence(r,t))return null}return this.mayContainReferenceDefinition(i)?null:i}tryTailSegmentReparse(e,t,n,r,i,a){let o=i??this.ensureLastSegment(t);if(!o)return null;let s=a!==void 0;if(s&&this.ensureSegmentSourceOffset(t,o),o.srcOffset<=0&&o.tokenStart<=0)return null;if(!s){let n=t.src.slice(0,o.srcOffset);if(!e.startsWith(n))return null}let c=s?t.lastSegmentSource??t.src.slice(o.srcOffset):t.src.slice(o.srcOffset),l=s?c+a:e.slice(o.srcOffset);if(l===c)return null;let u=s?a:e.startsWith(t.src)?e.slice(t.src.length):null,d=s&&this.tokenMapsTrusted?e:this.getNormalizedUpdatedSource(t,e,a);if(u){let i=this.tryContainerTailAppendMerge(e,t,n,r,o,u,d);if(i)return t.lastSegmentSource=s?l:void 0,i}if(this.mayContainReferenceDefinition(c)||this.mayContainReferenceDefinition(l))return null;try{let i=this.parseAtLineOffset(l,n,r,o.lineStart,d),a=i.state,c=this.getLastSegment(a.tokens,l,0,a.tokens.length,i.mapsShifted?0:void 0,i.mapsShifted?o.lineStart:void 0);return o.lineStart>0&&!i.mapsShifted&&this.shiftTokenLines(a.tokens,o.lineStart),u?s?this.updateBoundaryStateForAppend(t,u):this.updateFenceMarkerCacheForAppend(t,u):(t.boundary=void 0,t.hasFenceMarker=void 0),t.src=e,t.normalizedSrc=d,t.env=n,t.globalStateReason=null,(!s||!u)&&(t.globalStateCarry=void 0),t.tokens.length=o.tokenStart,this.appendTokens(t.tokens,a.tokens),t.lineCount=o.lineStart+zd(l),c?(t.lastSegment={tokenStart:o.tokenStart+c.tokenStart,tokenEnd:o.tokenStart+c.tokenEnd,lineStart:i.mapsShifted?c.lineStart:o.lineStart+c.lineStart,lineEnd:i.mapsShifted?c.lineEnd:o.lineStart+c.lineEnd,srcOffset:o.srcOffset+c.srcOffset},t.lastSegmentSource=s?l.slice(c.srcOffset):void 0):(t.lastSegment=null,t.lastSegmentSource=void 0),t.lastSegmentVerified=void 0,t.tokens}catch{return null}}tryUntrustedParagraphTailReparse(e,t,n,r){if(t.boundary?t.boundary.endsWithBlankLine:this.endsWithBlankLine(t.src))return null;let i=this.ensureLastSegment(t);if(!i||t.tokens[i.tokenStart]?.type!==`paragraph_open`)return null;let a=t.tokens.slice(i.tokenStart,i.tokenEnd).find(e=>e.type===`inline`);if(!a?.content)return null;let o=t.src.length;for(;o>0;){let e=t.src.charCodeAt(o-1);if(e!==10&&e!==13)break;o--}let s=t.src.lastIndexOf(a.content,o-a.content.length);return s<0||s+a.content.length!==o?null:this.tryTailSegmentReparse(e,t,n,r,{...i,lineStart:this.countSourceLineBreaks(t.src,s),srcOffset:s})}countSourceLineBreaks(e,t){let n=0;for(let r=0;r<t;r++){let t=e.charCodeAt(r);t===10?n++:this.normalizeLineEndings&&t===13&&(n++,e.charCodeAt(r+1)===10&&r++)}return n}hasVerifiedSegmentAnchor(e,t,n){t.srcOffset<0&&this.ensureSegmentSourceOffset(e,t);let r=e.lineCount??zd(e.src),i=this.getDocLineCount(e.src,r);if(!(t.lineStart>=0&&t.lineStart<=t.lineEnd&&t.lineEnd<=i&&t.srcOffset<e.src.length))return!1;let a=e.src.slice(t.srcOffset);try{let r=Object.create(n);Object.defineProperty(r,"block",{value:this.anchorBlock});let i=this.core.createState(a,{},r);this.normalizeLineEndings&&km(i),this.anchorBlock.parse(i.src,r,i.env,i.tokens);let o=this.getLastSegment(i.tokens,a);if(!o||o.tokenStart!==0)return!1;let s=typeof i.src==`string`?i.src:a,c=i.tokens[0]?.type,l=e.tokens[t.tokenStart]?.type,u=l===`table_open`&&c===`paragraph_open`&&/^\s*\|/.test(s)||l===`inline`&&c===`html_block`||l===`math_block`&&c===`paragraph_open`&&/^\s*\$\$\s*(?:\n|$)/.test(s);if(c!==l&&!u)return!1;let d=e.tokens.slice(t.tokenStart,t.tokenEnd).map(e=>e.content).filter(Boolean),f=0;for(let e of d){if(f=s.indexOf(e,f),f<0)return!1;f+=e.length}return!0}catch{return!1}}normalizeSource(e){return e.replace(/\r\n?/g,`
|
|
67
|
-
`).replace(/\0/g,`�`)}cacheHasFenceMarker(e){return e.hasFenceMarker===void 0&&(e.hasFenceMarker=e.src.includes("```")||e.src.includes(`~~~`)),e.hasFenceMarker}updateFenceMarkerCacheForAppend(e,t){if(this.cacheHasFenceMarker(e))return;let n=e.src.slice(-2)+t;e.hasFenceMarker=n.includes("```")||n.includes(`~~~`)}getNormalizedUpdatedSource(e,t,n){if(!this.normalizeLineEndings)return t;if(n===void 0&&!t.startsWith(e.src))return this.normalizeSource(t);let r=e.normalizedSrc??this.normalizeSource(e.src),i=n??t.slice(e.src.length),a=this.normalizeSource(i);return e.src.endsWith(`\r`)&&i.startsWith(`
|
|
68
|
-
`)&&(a=a.slice(1)),r+a}parseAtLineOffset(e,t,n,r,i){if(this.tokenMapsTrusted||r<=0)return{state:this.core.parse(e,t,n),mapsShifted:!1};let a=this.core.createState(e,t,n),o=!1;return this.core.process(a,(e,t)=>{!o&&e.fn===Yf&&(this.shiftTokenLines(t.tokens,r),i!==void 0&&(t.src=i),o=!0)}),{state:a,mapsShifted:o}}getTailLines(e,t){if(t<=0)return``;let n=t;for(let t=e.length-1;t>=0;t--)if(e.charCodeAt(t)===10&&(n--,n===0))return e.slice(t+1);return e}endsInsideOpenFence(e,t){let n=e.slice(t),r=n.length,i=null,a=0;for(;a<r;){let e=n.indexOf(`
|
|
69
|
-
`,a);if(this.normalizeLineEndings){let t=n.indexOf(`\r`,a);t>=0&&(e===-1||t<e)&&(e=t)}e===-1&&(e=r);let t=a,o=0;for(;t<e;){let e=n.charCodeAt(t);if(e===32){if(t++,o++,o>=4)break}else if(e===9){o=4;break}else break}if(o<4&&t<e){let r=n.charCodeAt(t);if(r===96||r===126){let a=t;for(;a<e&&n.charCodeAt(a)===r;)a++;let o=a-t;if(o>=3){if(!i){let t=r===96?n.indexOf("`",a):-1;t>=0&&t<e||(i={marker:r,length:o})}else if(i.marker===r&&o>=i.length){let t=a;for(;t<e;){let e=n.charCodeAt(t);if(e===32||e===9)t++;else break}t===e&&(i=null)}}}}if(e===r)break;a=e+(this.normalizeLineEndings&&n.charCodeAt(e)===13&&n.charCodeAt(e+1)===10?2:1)}return i!==null}peek(){return this.cache?.tokens??nv}hasCache(){return this.cache!==null}getStats(){return{...this.stats}}setCache(e,t){let n=this.cache?.snapshotState,r={...e,config:ov(t),snapshotState:n};return n&&(n.cache=r),this.cache=r,r}appendTokens(e,t,n=0,r=t.length){for(let i=n;i<r;i++)e.push(t[i])}updateCacheLineCount(e,t){e.lineCount=t??zd(e.src),e.lastSegment=void 0,e.lastSegmentVerified=void 0,e.normalizedSrc=void 0,e.globalStateCarry=e.src.slice(-4096),e.boundary=void 0,e.lastSegmentSource=void 0}detectGlobalStateForAppend(e,t){if(e.globalStateReason)return e.globalStateReason;let n=(e.globalStateCarry??e.src.slice(-4096))+t,r=nf(n);return e.globalStateCarry=n.length>rv?n.slice(n.length-rv):n,r&&(e.globalStateReason=r),r}ensureLastSegment(e,t=!1){return e.lastSegment===void 0&&(e.lastSegment=this.getLastSegment(e.tokens,e.src,0,e.tokens.length,void 0,void 0,t)),e.lastSegment}getLastSegment(e,t,n=0,r=e.length,i,a,o=!1){if(r<=n)return null;let s=1/0,c=-1,l=0;for(let u=r-1;u>=n;u--){let n=e[u];if(n.map&&(n.map[0]<s&&(s=n.map[0]),n.map[1]>c&&(c=n.map[1])),n.nesting<0){l+=-n.nesting;continue}if(n.nesting>0){if(l-=n.nesting,n.level===0&&l<=0){let e=Number.isFinite(s)?s:n.map?.[0]??0,l=c>=e?c:n.map?.[1]??e;return{tokenStart:u,tokenEnd:r,lineStart:e,lineEnd:l,srcOffset:o?-1:this.getLineStartOffset(t,e,i,a)}}continue}if(n.level===0&&l===0){let e=Number.isFinite(s)?s:n.map?.[0]??0,l=c>=e?c:n.map?.[1]??e;return{tokenStart:u,tokenEnd:r,lineStart:e,lineEnd:l,srcOffset:o?-1:this.getLineStartOffset(t,e,i,a)}}}return null}segmentHasFence(e,t){let n=Math.min(t.tokenEnd,e.tokens.length);for(let r=t.tokenStart;r<n;r++)if(e.tokens[r].type===`fence`)return!0;return!1}ensureSegmentSourceOffset(e,t){if(t.srcOffset<0){let n=e.lineCount;t.srcOffset=n!==void 0&&t.lineStart<=n&&t.lineEnd<=n+1?this.getLineStartOffsetFromEnd(e.src,t.lineStart,n):this.getLineStartOffset(e.src,t.lineStart)}return t.srcOffset}getLineStartOffsetFromEnd(e,t,n){if(t<=0)return 0;let r=n-t+1,i=e.length;for(;r>0;){if(i=e.lastIndexOf(`
|
|
70
|
-
`,i-1),i<0)return 0;r--}return i+1}getLineStartOffset(e,t,n,r){return n!==void 0&&r!==void 0&&t>=r?this.getLineStartOffsetFrom(e,n,t-r):this.getLineStartOffsetFrom(e,0,t)}getLineStartOffsetFrom(e,t,n){if(n<=0)return t;let r=n,i=t;for(;i<e.length;){let t=e.charCodeAt(i);if(t===10)i++,r--;else if(this.normalizeLineEndings&&t===13)i++,i<e.length&&e.charCodeAt(i)===10&&i++,r--;else{i++;continue}if(r===0)return i}return e.length}mayContainReferenceDefinition(e){return e.includes(`]:`)?/(?:^|\n)[ \t]{0,3}\[[^\]\n]+\]:/.test(e):!1}canDirectlyParseAppend(e){if(!this.tokenMapsTrusted||!(e.boundary?e.boundary.endsWithBlankLine:this.endsWithBlankLine(e.src)))return!1;let t=this.ensureLastSegment(e);if(!t)return!1;switch(e.tokens[t.tokenStart]?.type){case`paragraph_open`:case`heading_open`:case`fence`:case`code_block`:case`html_block`:case`hr`:case`table_open`:return!0;default:return!1}}tryContainerTailAppendMerge(e,t,n,r,i,a,o){if(!a||this.mayContainReferenceDefinition(a))return null;let s=t.tokens[i.tokenStart];switch(s?.type){case`bullet_list_open`:case`ordered_list_open`:return this.tryListTailAppendMerge(e,t,n,r,i,a,s,o);case`table_open`:return this.tryTableTailAppendMerge(e,t,n,r,i,a,s,o);default:return null}}tryListTailAppendMerge(e,t,n,r,i,a,o,s){if(t.src.length===0||!(t.boundary?t.boundary.endsWithNewline:t.src.charCodeAt(t.src.length-1)===10))return null;this.ensureSegmentSourceOffset(t,i);let c=i.lineEnd-i.lineStart,l=t.src.length-i.srcOffset;if(c<this.MIN_LIST_LINES_FOR_MERGE&&l<this.MIN_LIST_CHARS_FOR_MERGE)return null;let u=o.type===`bullet_list_open`?`bullet_list_close`:`ordered_list_close`,d=t.lineCount??zd(t.src),f,p=!1;try{let e=this.parseAtLineOffset(a,n,r,d,s);f=e.state.tokens,p=e.mapsShifted}catch{return null}if(!this.isSingleTopLevelContainer(f,o.type,u,o.markup))return null;let m=f.slice(1,-1);if(m.length===0)return null;d>0&&!p&&this.shiftTokenLines(m,d);let h=this.getListParagraphMode(t.tokens,i.tokenStart,t.tokens.length,o.level),g=this.getListParagraphMode(f,0,f.length,0);(h===`loose`||g===`loose`||(t.boundary?t.boundary.endsWithBlankLine:this.endsWithBlankLine(t.src))||(f[0]?.map?.[0]??0)-(p?d:0)>0)&&(this.setListParagraphVisibility(t.tokens,i.tokenStart,t.tokens.length,o.level,!1),this.setListParagraphVisibility(m,0,m.length,o.level,!1)),t.tokens.splice(t.tokens.length-1,0,...m),t.boundary?this.updateBoundaryStateForAppend(t,a):this.updateFenceMarkerCacheForAppend(t,a),t.src=e,t.normalizedSrc=s,t.env=n,t.globalStateReason=null;let _=d+zd(a);t.lineCount=_;let v=this.getCachedDocLineCount(t,_);return o.map&&(o.map[1]=v),t.lastSegment={tokenStart:i.tokenStart,tokenEnd:t.tokens.length,lineStart:i.lineStart,lineEnd:v,srcOffset:i.srcOffset},t.lastSegmentVerified=!0,t.tokens}tryTableTailAppendMerge(e,t,n,r,i,a,o,s){if(t.src.length===0||!(t.boundary?t.boundary.endsWithNewline:t.src.charCodeAt(t.src.length-1)===10)||/(?:^|\n)[ \t]*\n/.test(a))return null;this.ensureSegmentSourceOffset(t,i);let c=i.lineEnd-i.lineStart,l=t.src.length-i.srcOffset;if(c<this.MIN_TABLE_LINES_FOR_MERGE&&l<this.MIN_TABLE_CHARS_FOR_MERGE)return null;let u=this.getTableHeaderContext(t.src.slice(i.srcOffset));if(!u)return null;let d=`${u}${a}`,f=i.lineEnd-2,p,m=!1;try{let e=this.parseAtLineOffset(d,n,r,f,s);p=e.state.tokens,m=e.mapsShifted}catch{return null}if(!this.isSingleTopLevelContainer(p,`table_open`,`table_close`)||(p[0]?.map?.[1]??-1)!==this.getDocLineCount(d))return null;let h=this.getTableBodySection(p,0,p.length,0),g=this.getTableBodySection(t.tokens,i.tokenStart,t.tokens.length,o.level);if(!h||!g||h.tbodyOpenIndex<0||h.tbodyCloseIndex<0)return null;let _=g.tbodyOpenIndex>=0?p.slice(h.tbodyOpenIndex+1,h.tbodyCloseIndex):p.slice(h.tbodyOpenIndex,h.tbodyCloseIndex+1);if(_.length===0)return null;f!==0&&!m&&this.shiftTokenLines(_,f);let v=g.tbodyCloseIndex>=0?g.tbodyCloseIndex:g.tableCloseIndex,y=t.lineCount??zd(t.src);t.tokens.splice(v,0,..._),t.boundary?this.updateBoundaryStateForAppend(t,a):this.updateFenceMarkerCacheForAppend(t,a),t.src=e,t.normalizedSrc=s,t.env=n,t.globalStateReason=null;let b=y+zd(a);t.lineCount=b;let x=this.getCachedDocLineCount(t,b);if(o.map&&(o.map[1]=x),g.tbodyOpenIndex>=0){let e=t.tokens[g.tbodyOpenIndex];e?.map&&(e.map[1]=x)}return t.lastSegment={tokenStart:i.tokenStart,tokenEnd:t.tokens.length,lineStart:i.lineStart,lineEnd:x,srcOffset:i.srcOffset},t.lastSegmentVerified=!0,t.tokens}getTableHeaderContext(e){let t=e.indexOf(`
|
|
71
|
-
`);if(t<0)return null;let n=e.indexOf(`
|
|
72
|
-
`,t+1);return n<0?null:e.slice(0,n+1)}getTableBodySection(e,t,n,r){if(t<0||t>=n||e[t]?.type!==`table_open`)return null;let i=-1;for(let a=n-1;a>t;a--){let t=e[a];if(t.type===`table_close`&&t.level===r){i=a;break}}if(i<0)return null;let a=-1,o=-1;for(let n=t+1;n<i;n++){let t=e[n];if(t.type===`tbody_open`&&t.level===r+1){a=n;break}}if(a>=0){for(let t=i-1;t>a;t--){let n=e[t];if(n.type===`tbody_close`&&n.level===r+1){o=t;break}}if(o<0)return null}return{tableCloseIndex:i,tbodyOpenIndex:a,tbodyCloseIndex:o}}isSingleTopLevelContainer(e,t,n,r){if(e.length<2)return!1;let i=e[0],a=e[e.length-1];if(i.type!==t||a.type!==n||i.level!==0||a.level!==0||r!==void 0&&i.markup!==r)return!1;let o=0;for(let t=0;t<e.length;t++){let n=e[t];if(n.level===0&&t>0&&t<e.length-1&&o===0)return!1;(n.nesting>0||n.nesting<0)&&(o+=n.nesting)}return o===0}getListParagraphMode(e,t,n,r){let i=!1,a=!1,o=r+2;for(let r=t;r<n;r++){let t=e[r];if(t.type===`paragraph_open`&&t.level===o&&(t.hidden?i=!0:a=!0,i&&a))return`loose`}return a?`loose`:i?`tight`:`none`}setListParagraphVisibility(e,t,n,r,i){let a=r+2;for(let r=t;r<n;r++){let t=e[r];(t.type===`paragraph_open`||t.type===`paragraph_close`)&&t.level===a&&(t.hidden=i)}}shouldPreferTailReparseForAppend(e,t){let n=this.ensureLastSegment(e);if(!n)return!1;let r=e.tokens[n.tokenStart];if(!this.tokenMapsTrusted)return t;switch(r?.type){case`bullet_list_open`:case`ordered_list_open`:case`blockquote_open`:case`table_open`:return!0;case`paragraph_open`:case`code_block`:case`html_block`:return!(e.boundary?e.boundary.endsWithBlankLine:this.endsWithBlankLine(e.src));default:return r?.nesting===1}}endsWithBlankLine(e){let t=e.length;if(t<2||e.charCodeAt(t-1)!==10)return!1;let n=t-2;for(;n>=0;){let t=e.charCodeAt(n);if(t===32||t===9){n--;continue}return t===10}return!0}ensureBoundaryState(e){if(e.boundary)return e.boundary;let t=e.src,n=t.length,r=n>0&&t.charCodeAt(n-1)===10,i=r?n-1:n,a=i-1;for(;a>=0&&t.charCodeAt(a)!==10;)a--;let o=!1;for(let e=a+1;e<i;e++){let n=t.charCodeAt(e);if(n!==32&&n!==9){o=!0;break}}return e.boundary={currentLineNonBlank:!r&&o,previousLineNonBlank:r?o:!1,endsWithNewline:r,endsWithBlankLine:this.endsWithBlankLine(t)},e.boundary}updateBoundaryStateForAppend(e,t){let n=this.ensureBoundaryState(e),r=n.currentLineNonBlank,i=n.previousLineNonBlank;for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n===10?(i=r,r=!1):n!==32&&n!==9&&(r=!0)}n.currentLineNonBlank=r,n.previousLineNonBlank=i,n.endsWithNewline=t.length>0?t.charCodeAt(t.length-1)===10:n.endsWithNewline,n.endsWithBlankLine=e.src.length+t.length>=2&&n.endsWithNewline&&!i}getDocLineCount(e,t=zd(e)){return e.length===0?0:e.charCodeAt(e.length-1)===10?t:t+1}getCachedDocLineCount(e,t){return e.src.length===0?0:e.boundary?e.boundary.endsWithNewline?t:t+1:this.getDocLineCount(e.src,t)}shiftTokenLines(e,t){if(t===0)return;let n=null;for(let r=0;r<e.length;r++){let i=e[r];if(i.map&&(i.map[0]+=t,i.map[1]+=t),i.children){n??=[];for(let e=i.children.length-1;e>=0;e--)n.push(i.children[e]);for(;n.length>0;){let e=n.pop();if(e.map&&(e.map[0]+=t,e.map[1]+=t),e.children)for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}}}},mv={default:N_,zero:P_,commonmark:M_};function hv(e){return{core:e.core.ruler.version,block:e.block.ruler.version,inline:e.inline.ruler.version,inline2:e.inline.ruler2.version}}function gv(e,t){return e.core.ruler.version!==t.core||e.block.ruler.version!==t.block||e.inline.ruler.version!==t.inline||e.inline.ruler2.version!==t.inline2}function _v(e){return e.experimental?{...e,...e.experimental}:e}function vv(e,t){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0)return!0;let n=e.experimental;return!!n&&Object.prototype.hasOwnProperty.call(n,t)&&n[t]!==void 0}function yv(e,t,n){for(let r=0;r<n.length;r++){let i=n[r];if(vv(t,i)||vv(e,i))return!0}return!1}function bv(e,t,n){return vv(t,n)||vv(e,n)}function xv(e,t){let n=ff(e)?.chunk;if(n?.fallback){gf(e,{area:`parse`,path:`plain`,reason:`global-state:${n.fallbackReason||`unknown`}`});return}gf(e,{area:`parse`,path:`full-chunk`,chunked:!0,reason:t})}function Sv(){return typeof performance<`u`?performance.now():Date.now()}function Cv(e,t){let n={html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100,stream:!1,streamOptimizationMinSize:1e3,streamTailLocalPostBlockRules:!1,streamChunkedFallback:!1,streamChunkSizeChars:1e4,streamChunkSizeLines:200,streamChunkFenceAware:!0,streamChunkAdaptive:!0,streamChunkTargetChunks:8,streamChunkMaxChunks:void 0,streamLargeCachePolicy:`retain`,streamSkipCacheAboveChars:1e6,streamSkipCacheAboveLines:1e5,fullChunkedFallback:!1,fullChunkThresholdChars:2e4,fullChunkThresholdLines:400,fullChunkSizeChars:1e4,fullChunkSizeLines:200,fullChunkFenceAware:!0,fullChunkAdaptive:!0,fullChunkTargetChunks:8,fullChunkMaxChunks:void 0,autoTuneChunks:!0,autoUnbounded:!0,autoUnboundedThresholdChars:4e6,autoUnboundedThresholdLines:8e4},r=`default`,i;!t&&typeof e!=`string`?(i=e,r=`default`):typeof e==`string`&&(r=e,i=t);let a=mv[r];if(!a)throw Error(`Wrong \`markdown-it\` preset "${r}", check name`);if(a?.options&&(n={...n,...a.options}),i&&(n={...n,...i}),n=_v(n),typeof n.quotes==`string`){let e=n.quotes;e.length>=4?n.quotes=[e[0],e[1],e[2],e[3]]:n.quotes=[`“`,`”`,`‘`,`’`]}let o=yv(a?.options,i,[`fullChunkSizeChars`,`fullChunkSizeLines`,`fullChunkMaxChunks`]),s=yv(a?.options,i,[`streamChunkSizeChars`,`streamChunkSizeLines`,`streamChunkMaxChunks`]),c=bv(a?.options,i,`fullChunkedFallback`),l=bv(a?.options,i,`streamChunkedFallback`),u=!1,d=null,f=null,p=new Yh,m=null,h=()=>(m||=new tv(n),m),g=null,_=()=>(g||=new pv(p),g),v=null,y=()=>(v||=new jf({fuzzyLink:!0}),v),b=e=>!u&&!!d&&!gv(e,d),x=(e,t)=>r==="default"&&!u&&m===null&&f!==null&&e.parse===f&&b(e)&&!e.stream.enabled&&t<(e.options.autoUnboundedThresholdChars??4e6)&&e.options.html===!1&&e.options.xhtmlOut===!1&&e.options.breaks===!1&&e.options.langPrefix===`language-`&&e.options.linkify===!1&&e.options.typographer===!1&&e.options.highlight===null,S=(e,t)=>r==="default"&&!u&&b(e)&&!e.stream.enabled&&!e.options.fullChunkedFallback&&t<(e.options.autoUnboundedThresholdChars??4e6)&&e.options.html===!1&&e.options.linkify===!1&&e.options.typographer===!1,C={core:p,block:p.block,inline:p.inline,get linkify(){let e=y();return Object.defineProperty(this,"linkify",{value:e,writable:!0,configurable:!0}),e},get renderer(){let e=h();return Object.defineProperty(this,"renderer",{value:e,writable:!0,configurable:!0}),e},options:n,__explicitFullChunkConfig:o,__explicitStreamChunkConfig:s,__explicitFullChunkFallbackSetting:c,__explicitStreamChunkFallbackSetting:l,__canUseImplicitLargeInputStrategy(){return b(this)},set(e){let t=_v(e);return this.options={...this.options,...t},(vv(e,`fullChunkSizeChars`)||vv(e,`fullChunkSizeLines`)||vv(e,`fullChunkMaxChunks`))&&(o=!0,this.__explicitFullChunkConfig=!0),(vv(e,`streamChunkSizeChars`)||vv(e,`streamChunkSizeLines`)||vv(e,`streamChunkMaxChunks`))&&(s=!0,this.__explicitStreamChunkConfig=!0),vv(e,`fullChunkedFallback`)&&(c=!0,this.__explicitFullChunkFallbackSetting=!0),vv(e,`streamChunkedFallback`)&&(l=!0,this.__explicitStreamChunkFallbackSetting=!0),m&&m.set(t),typeof t.stream==`boolean`&&(this.stream.enabled=t.stream,g&&(g.reset(),g.resetStats())),this},configure(e){let t=typeof e==`string`?mv[e]:e;if(!t)throw Error("Wrong `markdown-it` preset, can't be empty");if(t.options&&this.set(t.options),t.components){let e=t.components;e.core?.rules&&this.core.ruler.enableOnly(e.core.rules),e.block?.rules&&this.block.ruler.enableOnly(e.block.rules),e.inline?.rules&&this.inline.ruler.enableOnly(e.inline.rules),e.inline2?.rules&&this.inline.ruler2.enableOnly(e.inline2.rules)}return this},enable(e,t){let n=Array.isArray(e)?e:[e],r=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],i=new Set;for(let e of r){if(!e)continue;let t=e.enable(n,!0);for(let e=0;e<t.length;e++)i.add(t[e])}if(!t){let e=n.filter(e=>!i.has(e));if(e.length)throw Error(`Rules manager: invalid rule name ${e.join(`, `)}`)}return this},disable(e,t){let n=Array.isArray(e)?e:[e],r=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],i=new Set;for(let e of r){if(!e)continue;let t=e.disable(n,!0);for(let e=0;e<t.length;e++)i.add(t[e])}if(!t){let e=n.filter(e=>!i.has(e));if(e.length)throw Error(`Rules manager: invalid rule name ${e.join(`, `)}`)}return this},use(e,...t){let n=typeof e==`function`?e:e&&typeof e.default==`function`?e.default:void 0;if(!n)throw TypeError(`MarkdownIt.use: plugin must be a function`);let r=[this,...t],i=e;return u=!0,n.apply(i,r),this},render(e,t){let n;if(x(this,e.length)){t!==void 0&&(mf(t),n=lf(`render`));let r=n?Sv():0,i=n?Jg(e,n):qg(e);if(n&&(n.attemptMs=Sv()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),hf(t,n)),i!==null)return t!==void 0&&gf(t,{area:`render`,path:`stock-fast`,reason:`stock-subset`}),i}let r=t??{},i=this.parse(e,r);return n&&hf(r,n),h().render(i,this.options,r)},async renderAsync(e,t){let n;if(x(this,e.length)){t!==void 0&&(mf(t),n=lf(`render`));let r=n?Sv():0,i=n?Jg(e,n):qg(e);if(n&&(n.attemptMs=Sv()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),hf(t,n)),i!==null)return t!==void 0&&gf(t,{area:`render`,path:`stock-fast`,reason:`stock-subset`}),i}let r=t??{},i=this.parse(e,r);return n&&hf(r,n),h().renderAsync(i,this.options,r)},renderIterable(e,t={}){let n=this.parseIterable(e,t);return h().render(n,this.options,t)},async renderAsyncIterable(e,t={}){let n=await this.parseAsyncIterable(e,t);return h().renderAsync(n,this.options,t)},renderInline(e,t={}){let n=this.parseInline(e,t);return h().render(n,this.options,t)},validateLink:$m,normalizeLink:eh,normalizeLinkText:th,utils:cd,helpers:{...Kf},parse(e,t){if(typeof e!=`string`)throw TypeError(`Input data should be a String`);if(t!==void 0&&mf(t),S(this,e.length)){let n=t===void 0?void 0:lf(`parse`),r=n?Sv():0,i=vg(e,n);if(n&&(n.attemptMs=Sv()-r,i===null&&(n.fallbackReason=`unsupported-stock-subset`),hf(t,n)),i!==null)return t!==void 0&&gf(t,{area:`parse`,path:`stock-fast`,reason:`stock-subset`}),i}let n=t??{},r;if(!this.stream.enabled&&!this.options.fullChunkedFallback&&b(this)){let i=C_(this,e.length);if(i===`yes`){let r=w_(this,e,n);return gf(t,{area:`parse`,path:`auto-unbounded`,unbounded:!0,reason:`char-threshold`}),r}i===`need-lines`&&(r=zd(e))}if(!this.stream.enabled){let i=e.length,a=this.options.autoTuneChunks!==!1,s=o,l=!c&&b(this),u=!!this.options.fullChunkedFallback,d=l&&i>=2e5,f;(u||d||r!==void 0)&&(f=r??zd(e));let p=(u||d)&&a&&!s?A_(i,f,this.options):null;if(u||d){let r=f??0;if(u?i>=(this.options.fullChunkThresholdChars??2e4)||r>=(this.options.fullChunkThresholdLines??400):d){if(p&&p.strategy!==`plain`){let r=Xg(this,e,n,{maxChunkChars:p.maxChunkChars,maxChunkLines:p.maxChunkLines,fenceAware:p.fenceAware,maxChunks:p.maxChunks});return t&&xv(t,u?`explicit-full-chunk`:`default-large-string`),r}if(u){let a=(e,t,n)=>e<t?t:e>n?n:e,o=this.options.fullChunkAdaptive!==!1,s=this.options.fullChunkTargetChunks??8,c=a(Math.ceil(i/s),8e3,64e3),l=a(Math.ceil(r/s),150,700),u=o?c:this.options.fullChunkSizeChars??1e4,d=o?l:this.options.fullChunkSizeLines??200,f=o?a(Math.ceil(i/64e3),s,32):this.options.fullChunkMaxChunks,p=Xg(this,e,n,{maxChunkChars:u,maxChunkLines:d,fenceAware:this.options.fullChunkFenceAware??!0,maxChunks:f});return t&&xv(t,`explicit-full-chunk`),p}}}if(r!==void 0&&b(this)&&S_(this,i,f??r)){let r=w_(this,e,n);return gf(t,{area:`parse`,path:`auto-unbounded`,unbounded:!0,reason:`line-threshold`}),r}}let i=nf(e);return gf(t,{area:`parse`,path:`plain`,reason:`default-plain`}),af(n,i,()=>p.parse(e,n,this).tokens)},parseIterable(e,t={}){return mf(t),v_(this,e,t)},parseAsyncIterable(e,t={}){return mf(t),y_(this,e,t)},parseIterableToSink(e,t,n={}){return mf(n),b_(this,e,t,n)},parseAsyncIterableToSink(e,t,n={}){return mf(n),x_(this,e,t,n)},parseInline(e,t={}){if(typeof e!=`string`)throw TypeError(`Input data should be a String`);mf(t),rf(t)&&cf(t);let n=p.createState(e,t,this);return n.inlineMode=!0,p.process(n),n.tokens}};if(C.stream={enabled:!!n.stream,parse(e,t){return C.stream.enabled?_().parse(e,t,C):C.parse(e,t??{})},append(e,t){if(!C.stream.enabled)throw Error(`Stream append requires stream mode`);return _().append(e,t,C)},snapshot(){return g?g.snapshot():null},restore(e){if(!C.stream.enabled)throw Error(`Stream restore requires stream mode`);return _().restore(e,C)},reset(){_().reset()},hasCache(){return g?.hasCache()??!1},peek(){return g?g.peek():[]},stats(){return g?g.getStats():{total:0,cacheHits:0,appendHits:0,unboundedAppendHits:0,tailHits:0,fullParses:0,resets:0,chunkedParses:0,lastMode:`idle`}},resetStats(){g&&g.resetStats()}},a?.components){let e=a.components;e.core?.rules&&C.core.ruler.enableOnly(e.core.rules),e.block?.rules&&C.block.ruler.enableOnly(e.block.rules),e.inline?.rules&&C.inline.ruler.enableOnly(e.inline.rules),e.inline2?.rules&&C.inline.ruler2.enableOnly(e.inline2.rules)}return d=hv(C),f=C.parse,C}var wv=Cv,Tv=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`],Ev=`a.abbr.b.bdi.bdo.button.cite.code.data.del.dfn.em.font.i.ins.kbd.label.mark.q.s.samp.small.span.strong.sub.sup.time.u.var`.split(`.`),Dv=`article.aside.blockquote.details.div.figcaption.figure.footer.header.h1.h2.h3.h4.h5.h6.li.main.nav.ol.p.pre.section.summary.table.tbody.td.th.thead.tr.ul`.split(`.`),Ov=[`svg`,`g`,`path`],kv=`address.audio.body.canvas.caption.colgroup.datalist.dd.dialog.dl.dt.fieldset.form.head.hgroup.html.iframe.legend.map.menu.meter.noscript.object.optgroup.option.output.picture.progress.rp.rt.ruby.script.select.style.template.textarea.tfoot.title.video`.split(`.`),Av=`onclick.onerror.onload.onmouseover.onmouseout.onmousedown.onmouseup.onkeydown.onkeyup.onfocus.onblur.onsubmit.onreset.onchange.onselect.ondblclick.ontouchstart.ontouchend.ontouchmove.ontouchcancel.onwheel.onscroll.oncopy.oncut.onpaste.oninput.oninvalid.onsearch.innerhtml.outerhtml.textcontent.innertext.srcdoc.ping`.split(`.`),jv=[`action`,`data`,`href`,`src`,`srcset`,`poster`,`xlink:href`,`formaction`],Mv=[`script`],Nv=[`pre`,`iframe`,`picture`,`script`,`style`,`table`,`tbody`,`td`,`tfoot`,`th`,`thead`,`textarea`,`tr`,`title`,`video`],Pv=new Set(Tv),Fv=new Set(Dv),Iv=new Set([...Tv,...Ev,...Dv,...Ov]);[...Iv,...kv];var Lv=new Set(Av),Rv=new Set(jv),zv=new Set(Mv),Bv=new Set(Nv);function Vv(e){let t=``;for(let n of e){let e=n.charCodeAt(0);e<=31||e>=127&&e<=159||/\s/u.test(n)||(t+=n)}return t}var Hv={amp:`&`,bsol:`\\`,colon:`:`,newline:`
|
|
73
|
-
`,sol:`/`,tab:` `};function Uv(e){return e.replace(/&(?:#(\d+)|#x([0-9a-f]+)|([a-z][a-z0-9]+));?/gi,(e,t,n,r)=>{let i=t??n;if(i){let e=Number.parseInt(i,t?10:16);try{return Number.isFinite(e)?String.fromCodePoint(e):``}catch{return``}}return Hv[String(r??``).toLowerCase()]??e})}var Wv=new Set([`http`,`https`,`mailto`,`tel`]),Gv=new Set([`javascript`,`vbscript`,`data`,`file`,`ftp`,`blob`,`filesystem`,`intent`,`chrome`,`chrome-extension`,`moz-extension`,`ms-browser-extension`,`view-source`]),Kv=new Set([`http`,`https`]);function qv(e){return e.match(/^([a-z][a-z0-9+.-]*):/i)?.[1]?.toLowerCase()??``}var Jv=/^https?:\/\//i;function Yv(e){if(!Jv.test(e))return!1;for(let t of e){let e=t.charCodeAt(0);if(t===`&`||e<=32||e>=127&&e<=159||e>127&&/\s/u.test(t))return!1}return!0}function Xv(e,t,n){if(!Zv(t,n)||!e.startsWith(`file:///`))return!1;let r=e.charAt(8);return r!==`/`&&r!==`\\`}function Zv(e,t){return e?(e===`a`||e===`area`)&&(!t||t===`href`||t===`xlink:href`):!t||t===`href`}function Qv(e,t){return t===`href`||t===`xlink:href`?Zv(e,t)?Wv:Kv:t===`src`||t===`srcset`||t===`poster`||t===`action`||t===`formaction`||t===`data`?Kv:Wv}function $v(e,t={}){if(Yv(e))return!1;let n=Vv(Uv(e)).toLowerCase(),r=String(t.tagName??``).toLowerCase(),i=String(t.attrName??``).toLowerCase();if(!n)return!1;if(n.startsWith(`data:`)){let e=/^data:image\/(?:png|gif|jpe?g|webp|avif|bmp);/i.test(n);return r===`img`&&i===`src`?!e:!0}if(/^[\\/]{2}/.test(n))return!0;if(n.startsWith(`/`)||n.startsWith(`./`)||n.startsWith(`../`)||n.startsWith(`#`)||n.startsWith(`?`))return!1;let a=qv(n);return a?a===`file`?!Xv(n,r,i):Zv(r,i)?Gv.has(a):!Qv(r,i).has(a):!1}function ey(e){let t=Uv(String(e??``)).trim();if(!t||t.startsWith(`#`)||t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`?`))return!1;let n=qv(Vv(t).toLowerCase());return n===`http`||n===`https`}function ty(e,t={}){let n=String(e??``).trim();return n?$v(n,t)?``:n:``}function ny(e){return ty(e,{tagName:`img`,attrName:`src`})}function ry(e,t,n){function r(e){return e.trim().split(` `,2)[0]===t}function i(e,n,r,i,a){return e[n].nesting===1&&e[n].attrJoin(`class`,t),a.renderToken(e,n,r,i,a)}n||={};let a=n.marker||`:`,o=a.charCodeAt(0),s=a.length,c=n.validate||r,l=n.render||i;function u(e,n,r,i){let l,u=!1,d=e.bMarks[n]+e.tShift[n],f=e.eMarks[n];if(o!==e.src.charCodeAt(d))return!1;for(l=d+1;l<=f&&a[(l-d)%s]===e.src[l];l++);let p=Math.floor((l-d)/s);if(p<3)return!1;l-=(l-d)%s;let m=e.src.slice(d,l),h=e.src.slice(l,f);if(!c(h,m))return!1;if(i)return!0;let g=n;for(;g++,!(g>=r||(d=e.bMarks[g]+e.tShift[g],f=e.eMarks[g],d<f&&e.sCount[g]<e.blkIndent));)if(o===e.src.charCodeAt(d)&&!(e.sCount[g]-e.blkIndent>=4)){for(l=d+1;l<=f&&a[(l-d)%s]===e.src[l];l++);if(!(Math.floor((l-d)/s)<p)&&(l-=(l-d)%s,l=e.skipSpaces(l),!(l<f))){u=!0;break}}let _=e.parentType,v=e.lineMax;e.parentType=`container`,e.lineMax=g;let y=e.push(`container_`+t+`_open`,`div`,1);y.markup=m,y.block=!0,y.info=h,y.map=[n,g],e.md.block.tokenize(e,n+1,g);let b=e.push(`container_`+t+`_close`,`div`,-1);return b.markup=e.src.slice(d,l),b.block=!0,e.parentType=_,e.lineMax=v,e.line=g+ +!!u,!0}e.block.ruler.before(`fence`,`container_`+t,u,{alt:[`paragraph`,`reference`,`blockquote`,`list`]}),e.renderer.rules[`container_`+t+`_open`]=l,e.renderer.rules[`container_`+t+`_close`]=l}function iy(e){let t=String(e??``).trim();if(!t.startsWith(`{`)||!t.endsWith(`}`))return null;let n=t.slice(1,-1).trim();if(!n)return{};if(n.includes(`{`)||n.includes(`[`)||n.includes(`]`))return null;let r=[],i=``,a=!1,o=!1;for(let e=0;e<n.length;e++){let t=n[e];if(t===`\\`){i+=t,e+1<n.length&&(i+=n[e+1],e++);continue}if(!o&&t===`'`){a=!a,i+=t;continue}if(!a&&t===`"`){o=!o,i+=t;continue}if(!a&&!o&&t===`,`){r.push(i.trim()),i=``;continue}i+=t}i.trim()&&r.push(i.trim());let s={};for(let e of r){if(!e)continue;let t=!1,n=!1,r=-1;for(let i=0;i<e.length;i++){let a=e[i];if(a===`\\`){i++;continue}if(!n&&a===`'`){t=!t;continue}if(!t&&a===`"`){n=!n;continue}if(!t&&!n&&a===`:`){r=i;break}}if(r===-1)return null;let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();if(!i)return null;let o=i;if(o.startsWith(`"`)&&o.endsWith(`"`)||o.startsWith(`'`)&&o.endsWith(`'`))try{o=JSON.parse(o.replace(/^'/,`"`).replace(/'$/,`"`))}catch{return null}if(!/^[_$A-Z][\w$-]*$/i.test(o))return null;let c;if(!a)c=``;else if(a.startsWith(`"`)&&a.endsWith(`"`)||a.startsWith(`'`)&&a.endsWith(`'`))try{c=JSON.parse(a.replace(/^'/,`"`).replace(/'$/,`"`))}catch{c=a}else c=/^-?\d+(?:\.\d+)?$/.test(a)?Number(a):a===`true`||a===`false`?a===`true`:a===`null`?null:a;s[o]=c}return s}function ay(e,t,n){for(let r of e){let e=r,i=e.map;if(Array.isArray(i)&&i.length>=2){let r=Number(i[0]),a=Number(i[1]);Number.isFinite(r)&&Number.isFinite(a)&&(e.map=[r+t,Math.min(a+t,n)])}Array.isArray(e.children)&&ay(e.children,t,n)}}function oy(e){[`admonition`,`info`,`warning`,`error`,`tip`,`danger`,`note`,`caution`].forEach(t=>{e.use(ry,t,{render(e,n){return e[n].nesting===1?`<div class="vmr-container vmr-container-${t}">`:`</div>
|
|
74
|
-
`}})}),e.block.ruler.before(`fence`,`vmr_container_fallback`,(e,t,n,r)=>{let i=e,a=i.bMarks[t]+i.tShift[t],o=i.eMarks[t],s=i.src.slice(a,o),c=s.match(/^:::\s*([^\s{]+)/);if(!c)return!1;let l=c[1];if(!l.trim())return!1;let u=s.slice(c[0].length).trim(),d,f,p=u.indexOf(`{`),m=p>=0?u.slice(p).trimStart():void 0;if(p===-1)d=u||void 0;else{if(d=u.slice(0,p).trim()||void 0,m?.startsWith(`{`)){let e=0,t=-1;for(let n=0;n<m.length;n++)if(m[n]===`{`?e++:m[n]===`}`&&e--,e===0){t=n+1;break}t>0&&(f=m.slice(0,t))}f||(d=u||void 0)}if(r)return!0;let h=!!i.env.__markstreamFinal,g=t+1,_=!1;for(;g<=n;){let e=i.bMarks[g]+i.tShift[g],t=i.eMarks[g];if(i.src.slice(e,t).trim()===`:::`){_=!0;break}g++}_||(g=n);let v=i.push(`vmr_container_open`,`div`,1);if(v.attrSet(`class`,`vmr-container vmr-container-${l}`),v.map=[t,_?g:n],v.meta={...v.meta??{},unclosed:!_&&!h},d&&v.attrSet(`data-args`,d),f)try{let e=JSON.parse(f);for(let[t,n]of Object.entries(e)){let e=typeof n==`object`&&!!n;v.attrSet(`data-${t}`,e?JSON.stringify(n):String(n))}}catch{let e=iy(f);if(e)for(let[t,n]of Object.entries(e)){let e=typeof n==`object`&&!!n;v.attrSet(`data-${t}`,e?JSON.stringify(n):String(n))}else v.attrSet(`data-attrs`,f)}let y=[];for(let e=t+1;e<g;e++){let t=i.bMarks[e]+i.tShift[e],n=i.eMarks[e];y.push(i.src.slice(t,n))}if(y.some(e=>e.trim().length>0)){let e=y.join(`
|
|
75
|
-
`);e.endsWith(`
|
|
76
|
-
`)||(e+=`
|
|
77
|
-
`),e.endsWith(`
|
|
78
|
-
|
|
79
|
-
`)||(e+=`
|
|
80
|
-
`);let n=i.tokens[i.tokens.length-1];n&&(n.raw=e);let r=[];i.md.block.parse(e,i.md,i.env,r),ay(r,t+1,t+1+y.length),i.tokens.push(...r)}let b=i.push(`vmr_container_close`,`div`,-1);return _||(b.hidden=!0,b.map=[n,n]),i.line=_?g+1:g,!0},{alt:[`paragraph`,`reference`,`blockquote`,`list`]})}function sy(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function cy(e,t=0){let n=!1,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t===`\\`){i++;continue}if(!r&&t===`'`){n=!n;continue}if(!n&&t===`"`){r=!r;continue}if(!n&&!r&&t===`>`)return i}return-1}function ly(e){let t=[],n=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,r;for(;(r=n.exec(e))!==null;){let e=r[1];if(!e)continue;let n=r[2]||r[3]||r[4]||``;t.push([e,n])}return t}var uy=/^[a-z][a-z0-9_-]*$/;function dy(e){return uy.test(String(e??``).trim().toLowerCase())}function fy(e){let t=String(e??``).trim();if(!t)return``;if(!t.startsWith(`<`))return dy(t)?t.toLowerCase():``;let n=1;for(;n<t.length&&/\s/.test(t[n]);)n++;if(t[n]===`/`)for(n++;n<t.length&&/\s/.test(t[n]);)n++;let r=n;for(;n<t.length&&/[\w-]/.test(t[n]);)n++;let i=t.slice(r,n).toLowerCase(),a=t[n]??``;return a&&!/[\s/>]/.test(a)?``:dy(i)?i:``}function py(e){if(!e||e.length===0)return[];let t=new Set,n=[];for(let r of e){let e=fy(r);e&&!t.has(e)&&(t.add(e),n.push(e))}return n}function my(e){return fy(e)}function hy(e,t){let n=String(e??``),r=fy(t);if(!r)return!1;let i=sy(r),a=n.match(new RegExp(String.raw`^\s*<\s*${i}(?:\s[^>]*)?(\s*\/)?>`,`i`));return a?a[1]?!0:new RegExp(String.raw`<\s*\/\s*${i}\s*>`,`i`).test(n):!1}function gy(e,t){let n=String(e??``),r=fy(t);if(!r)return n;let i=sy(r),a=new RegExp(String.raw`^\s*<\s*${i}(?:\s[^>]*)?>\s*`,`i`),o=new RegExp(String.raw`\s*<\s*\/\s*${i}\s*>\s*$`,`i`);return n.replace(a,``).replace(o,``)}var _y=Pv,vy=Iv,yy=new Set(Fv);yy.delete(`details`);var by=/<([A-Z][\w-]*)(?=[\s/>]|$)/gi,xy=/<\/\s*([A-Z][\w-]*)(?=[\s/>]|$)/gi,Sy=/^<\s*(?:\/\s*)?([A-Z][\w-]*)/i,Cy=/^<\s*([A-Z][\w:-]*)(?=[\s/>]|$)/i;function wy(e){return(e.match(Sy)?.[1]??``).toLowerCase()}function Ty(e){return/^\s*<\s*\//.test(e)}function Ey(e,t){return _y.has(t)||/\/\s*>\s*$/.test(e)}function Dy(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(!i||i.type!==`html_inline`)continue;let a=String(i.content??``),o=wy(a);if(o===t){if(Ty(a)){if(n===0)return r;n--;continue}Ey(a,o)||n++}}return-1}function Oy(e,t){let n=0;for(let r of e){if(!r||r.type!==`html_inline`)continue;let e=String(r.content??``),i=wy(e);if(i===t){if(Ty(e)){n>0&&n--;continue}Ey(e,i)||n++}}return n}function ky(e,t,n=0){let r=new RegExp(String.raw`<\s*(\/?)\s*${sy(t)}(?=[\s>/])[^>]*>`,`gi`);r.lastIndex=Math.max(0,n);let i=0,a;for(;(a=r.exec(e))!==null;){let e=a[0]??``,t=!!a[1],n=!t&&/\/\s*>$/.test(e);if(t){if(i===0)return{start:a.index,end:a.index+e.length};i--;continue}n||i++}return null}function Ay(e,t){let n=new RegExp(String.raw`<\s*(\/?)\s*${sy(t)}(?=[\s>/])[^>]*>`,`gi`),r=0,i;for(;(i=n.exec(e))!==null;){let e=i[0]??``,t=!!i[1],n=!t&&/\/\s*>$/.test(e);if(t){r>0&&r--;continue}n||r++}return r}function jy(e){let t=e;return String(t.raw??t.content??t.markup??``)}function My(e){let t=e;return t.meta||={},t.meta}function Ny(e,t,n){let r=My(e);r.markstreamCustomHtmlRaw=t,r.markstreamCustomHtmlInner=n}function Py(e,t){if(!t.size)return;let n=Array.from(t,e=>new RegExp(String.raw`<\s*${sy(e)}(?=[\s>/])`,`i`)),r=[],i=!1,a=e=>e?n.some(t=>t.test(e)):!1,o=e=>{if(e&&r.length)for(let t of r)t.raw+=e,t.inner+=e},s=()=>{r.length&&i&&(o(`
|
|
81
|
-
`),i=!1)},c=e=>{o(e)},l=e=>{for(let t=0;t<r.length;t++)r[t].raw+=e,t<r.length-1&&(r[t].inner+=e);let t=r.pop();Ny(t.token,t.raw,t.inner)},u=e=>{let t=r[r.length-1]?.tag;if(!t)return null;let n=new RegExp(String.raw`^\s*<\s*\/\s*${sy(t)}\s*>`,`i`);return e.match(n)?.[0]??null},d=e=>!!u(e),f=(e,n,i)=>{let a=i??(e.type===`html_inline`?wy(n):``);if(!(a&&t.has(a))){o(n);return}let s=Ty(n),c=!s&&Ey(n,a);if(s){if(!r.length||r[r.length-1].tag!==a){o(n);return}l(n);return}if(o(n),c){Ny(e,n,``);return}r.push({tag:a,token:e,raw:n,inner:``})};for(let n of e){if(n.type===`inline`&&Array.isArray(n.children)){let e=String(n.content??``);if(d(e)?i=!1:s(),!r.length&&!a(e)){i=!1;continue}let o=0,l=!0;for(let i of n.children){let n=jy(i),a=i.type===`html_inline`?wy(n):``,s=a&&t.has(a),u=n;if(l&&e&&n&&(r.length||s)){let t=e.indexOf(n,o);if(t!==-1)c(e.slice(o,t)),u=e.slice(t,t+n.length),o=t+n.length;else{if(r.length&&!s)continue;l=!1}}f(i,u,a)}l&&e&&o<e.length&&r.length&&c(e.slice(o)),i=r.length>0;continue}if(r.length&&typeof n.content==`string`){let e=jy(n),t=n.type===`html_block`?u(e):null;if(t){l(`${i?`
|
|
82
|
-
`:``}${t}`),i=r.length>0;continue}if(!n.content)continue;s(),o(n.content),i=!0}}for(let e of r)Ny(e.token,e.raw,e.inner)}function Fy(e){return/^\s*<\s*[!?]/.test(e)}function Iy(e){let t=new Set(vy);if(e&&Array.isArray(e))for(let n of e){let e=String(n??``).trim();if(!e)continue;let r=e.match(/^[<\s/]*([A-Z][\w-]*)/i);r&&t.add(r[1].toLowerCase())}return t}function Ly(e,t){if(t.has(e))return!0;for(let n of t)if(n.startsWith(e))return!0;return!1}function Ry(e,t){let n=null;for(let r of e.matchAll(by)){let i=r.index??-1;if(i<0)continue;let a=(r[1]??``).toLowerCase();Ly(a,t)&&cy(e.slice(i))===-1&&(!n||i<n.index)&&(n={index:i,tag:a,closing:!1})}for(let r of e.matchAll(xy)){let i=r.index??-1;if(i<0)continue;let a=(r[1]??``).toLowerCase();Ly(a,t)&&cy(e.slice(i))===-1&&(!n||i<n.index)&&(n={index:i,tag:a,closing:!0})}let r=/<\/\s*$/.exec(e);if(r&&typeof r.index==`number`){let t=r.index;!e.slice(t).includes(`>`)&&(!n||t<n.index)&&(n={index:t,tag:``,closing:!0})}let i=/<\s*$/.exec(e);if(i&&typeof i.index==`number`){let t=i.index,r=e.slice(t);!r.startsWith(`</`)&&!r.includes(`>`)&&(!n||t<n.index)&&(n={index:t,tag:``,closing:!1})}return n}function zy(e,t){let n=e;return Object.assign(Object.create(Object.getPrototypeOf(n)),n,{type:`text`,content:t,raw:t})}function By(e,t){if(!e.length)return{children:e};let n=[],r=null,i=null;function a(e,t){e&&(t?n.push(zy(t,e)):n.push({type:`text`,content:e,raw:e}))}function o(e,r){let i=0;for(;i<e.length;){let o=e.indexOf(`<`,i);if(o===-1){a(e.slice(i),r);break}a(e.slice(i,o),r);let s=e.slice(o),c=s.match(Sy);if(!c){a(`<`,r),i=o+1;continue}let l=cy(s);if(l===-1){a(`<`,r),i=o+1;continue}let u=s.slice(0,l+1),d=(c[1]??``).toLowerCase();t.has(d)?n.push({type:`html_inline`,tag:``,content:u,raw:u}):a(u,r),i=o+u.length}}function s(e,n){if(!e)return;let a=Ry(e,t);if(!a){o(e,n);return}let s=e.slice(0,a.index);s&&o(s,n),r={tag:a.tag,buffer:e.slice(a.index),closing:a.closing},i=r.buffer}for(let a of e){if(r){r.buffer+=jy(a),i=r.buffer;let e=cy(r.buffer);if(e===-1)continue;let t=r.buffer.slice(0,e+1),o=r.buffer.slice(e+1);n.push({type:`html_inline`,tag:``,content:t,raw:t}),r=null,i=null,o&&s(o);continue}if(a.type===`html_inline`){let e=jy(a),n=(e.match(Sy)?.[1]??``).toLowerCase();if(n&&t.has(n)&&cy(e)===-1){r={tag:n,buffer:e,closing:/^<\s*\//.test(e)},i=r.buffer;continue}}if(a.type===`text`){let e=String(a.content??``);if(!e.includes(`<`)){n.push(a);continue}s(e,a);continue}n.push(a)}return{children:n,pendingBuffer:i??void 0}}var Vy=[`a`,`span`,`strong`,`em`,`b`,`i`,`u`];function Hy(e,t={}){let n=new Set;if(t.customHtmlTags?.length)for(let e of t.customHtmlTags){let t=fy(e);t&&n.add(t)}let r=e=>{let t=e,r=new Set(n),i=Array.isArray(t.env?.__markstreamCustomHtmlTags)?t.env.__markstreamCustomHtmlTags:[];for(let e of i){let t=fy(String(e??``));t&&r.add(t)}let a=Iy(Array.from(r)),o=new Set(Vy);for(let e of r)o.add(e);return{autoCloseInlineTagSet:o,commonHtmlTags:a,customTagSet:r,shouldMergeHtmlBlockTag:e=>r.has(e)||!a.has(e)||yy.has(e)}},i=e=>{if(e.type===`html_block`)return String(e.content??``);if(e.type!==`inline`||!Array.isArray(e.children)||e.children.length!==1)return``;let t=e.children[0];return t?.type===`html_block`?String(e.content??t.content??``):``},a=(e,t)=>{e.type=`html_block`,e.content=t,e.raw=t,e.children=[]},o=e=>e.replace(/^(?:\r?\n)+/,``),s=e=>/^(?: {4}|\t)/.test(e),c=e=>e.replace(/^(?: {4}|\t)/gm,``),l=(e,t)=>{let n=o(e);if(!/\S/.test(n))return[];if(s(n))return[{type:`code_block`,content:c(n),raw:n}];let r=n.replace(/^[\t ]+/,``);if(!r)return[];if(r.startsWith(`<`))return[{type:`html_block`,content:r}];let i={type:`inline`,tag:``,nesting:0,content:r,children:[{type:`text`,content:r,raw:r}]};return t===`paragraph`?[{type:`paragraph_open`,tag:`p`,nesting:1},i,{type:`paragraph_close`,tag:`p`,nesting:-1}]:t===`text`?[{type:`text`,content:r,raw:r}]:[i]},u=(e,t,n)=>e[t-1]?.type===`paragraph_open`&&e[t+1]?.type===`paragraph_close`?`inline`:n,d=(e,t)=>{let n=o(t);return!/\S/.test(n)||e.type!==`inline`||!Array.isArray(e.children)?!1:(e.content=`${String(e.content??``)}${n}`,e.children.push({type:`text`,content:n,raw:n}),!0)};e.core.ruler.after(`inline`,`fix_html_inline_streaming`,e=>{let t=e.tokens??[],{commonHtmlTags:n,customTagSet:i}=r(e);for(let e of t){let t=e;if(t.type!==`inline`||!Array.isArray(t.children))continue;let r=String(t.content??``),i=t.children.length?t.children:r.includes(`<`)?[{type:`text`,content:r,raw:r}]:null;if(i)try{let e=By(i,n);if(t.children=e.children,e.pendingBuffer){let n=r.lastIndexOf(e.pendingBuffer);if(n!==-1){let e=r.slice(0,n);t.content=e,typeof t.raw==`string`&&(t.raw=e)}}}catch(e){console.error(`[applyFixHtmlInlineTokens] failed to fix streaming html inline`,e)}}Py(t,i)}),e.core.ruler.push(`fix_html_inline_tokens`,e=>{let t=e.tokens??[],{autoCloseInlineTagSet:n,customTagSet:o,shouldMergeHtmlBlockTag:s}=r(e),c=[];for(let e=0;e<t.length;e++){let n=t[e];if(c.length>0){let[r,i]=c[c.length-1];if(e!==i){if(n.type===`paragraph_open`||n.type===`paragraph_close`){t.splice(e,1),e--;continue}let a=String(n.content??n.raw??``);if(a){let n=t[i],o=`${String(n.content||``)}\n${a}`,s=cy(o),f=s===-1?null:ky(o,r,s+1);if(f){let r=o.slice(0,f.end),i=o.slice(f.end);n.content=r,n.loading=!1,t.splice(e,1),c.pop();let a=d(n,i)?[]:l(i,u(t,e,`paragraph`));a.length&&t.splice(e,0,...a),e--;continue}n.content=o,n.loading!==!1&&(n.loading=!0)}t.splice(e,1),e--;continue}}let r=i(n);if(r){if(Fy(r))continue;let i=(r.match(/<\s*(?:\/\s*)?([^\s>/]+)/)?.[1]??``).toLowerCase(),o=/^\s*<\s*\//.test(r);if(!i||!s(i))continue;if(a(n,r),!o)i&&!RegExp(`^\\s*<\\s*${i}\\b[^>]*\\/\\s*>`,`i`).test(r)&&Ay(r,i)>0&&c.push([i,e]);else if(c.length>0&&i&&c[c.length-1][0]===i){let[,n]=c[c.length-1],i=t[n];i.content=`${String(i.content||``)}\n${r}`,i.loading=!1,c.pop(),t.splice(e,1),e--}continue}if(c.length>0){if(n.type===`paragraph_open`||n.type===`paragraph_close`){t.splice(e,1),e--;continue}let r=n.content||``,i=RegExp(`<\\s*\\/\\s*${c[c.length-1][0]}\\s*>`,`i`).test(r);if(r){let[,e]=c[c.length-1],n=t[e];n.content=`${n.content||``}\n${r}`,n.loading!==!1&&(n.loading=!i)}i&&c.pop(),t.splice(e,1),e--}else continue}if(o.size>0){let e=new Map,n=new Map,r=t=>{let n=e.get(t);return n||(n=RegExp(`<\\s*${t}\\b`,`i`),e.set(t,n)),n},i=e=>{let t=n.get(e);return t||(t=RegExp(`<\\s*\\/\\s*${e}\\s*>`,`i`),n.set(e,t)),t},a=[];for(let e=0;e<t.length;e++){let n=t[e],s=String(n.content??``);if(a.length>0){let r=a[a.length-1],o=t[r.index],c=n.type===`html_block`?i(r.tag).exec(s):null;if(c){let n=c.index+c[0].length,i=s.slice(0,n),f=s.slice(n);o.content=`${String(o.content??``)}\n${i}`,Array.isArray(o.children)&&o.children.push({type:`html_inline`,content:`</${r.tag}>`,raw:`</${r.tag}>`}),a.pop();let p=d(o,f)?[]:l(f,u(t,e,`paragraph`));p.length?t.splice(e,1,...p):(t.splice(e,1),e--);continue}if(n.type!==`inline`)continue;let f=Array.isArray(n.children)?n.children:[],p=Dy(f,r.tag);if(p!==-1){let n=f.slice(0,p+1),r=f.slice(p+1),i=n.map(e=>String(e?.content??e?.raw??``)).join(``);if(o.content=`${String(o.content??``)}\n${i}`,Array.isArray(o.children)&&o.children.push(...n),r.length){let n=r.map(e=>String(e.content??e.raw??``)).join(``);if(n.trim()){let r=n.replace(/^\s+/,``);if(d(o,n))t.splice(e,1),e--;else if(r.startsWith(`<`))t.splice(e,1,{type:`html_block`,content:r});else{let r=l(n,u(t,e,`paragraph`));t.splice(e,1,...r)}}else t.splice(e,1),e--}else t.splice(e,1),e--;a.pop();continue}o.content=`${String(o.content??``)}\n${s}`,Array.isArray(o.children)&&o.children.push(...f),t.splice(e,1),e--;continue}if(n.type!==`inline`)continue;let c=Array.isArray(n.children)?n.children:[];for(let t of o)if((c.length?Oy(c,t):r(t).test(s)&&!i(t).test(s)?1:0)>0){a.push({tag:t,index:e});break}}}{let e=0;for(let n=0;n<t.length;n++){let r=t[n];if(r.type===`paragraph_open`){e++;continue}r.type===`paragraph_close`&&(e>0?e--:(t.splice(n,1),n--))}}for(let e=0;e<t.length;e++){let r=t[e];if(r.type===`html_block`){let n=(r.content?.match(/<([^\s>/]+)/)?.[1]??``).toLowerCase();if(n.startsWith(`!`)||n.startsWith(`?`)){r.loading=!1;continue}if(o.has(n)){let i=String(r.content??``),a=cy(i),o=a===-1?null:ky(i,n,a+1);r.loading=o?!1:r.loading===void 0||r.loading;let s=o?.start??-1,c=o?o.end-o.start:0;if(s!==-1){let o=i.slice(0,s+c),u=``;a!==-1&&a<s&&(u=i.slice(a+1,s)),r.children=[{type:n,content:u,raw:o,attrs:[],tag:n,loading:!1}],r.content=o,r.raw=o;let d=l(i.slice(s+c)||``,`text`);d.length&&t.splice(e+1,0,...d)}else r.children=[{type:n,content:``,raw:i,attrs:[],tag:n,loading:!0}];continue}if([`br`,`hr`,`img`,`input`,`link`,`meta`,`div`,`p`,`ul`,`li`].includes(n))continue;r.type=`inline`;let i=[],a=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,s;for(;(s=a.exec(r.content||``))!==null;){let e=s[1],t=s[2]||s[3]||s[4]||``;i.push([e,t])}let c=String(r.content??``),u=RegExp(`<\\/\\s*${n}\\s*>`,`i`).exec(c),d=u?u.index:-1,f=u?u[0].length:0;if(d!==-1){let i=c.slice(0,d+f),a=(c.slice(d+f)||``).replace(/^\s+/,``);r.children=[{type:`html_block`,content:i,tag:n,loading:!1}],r.content=i,r.raw=i,a&&t.splice(e+1,0,a.startsWith(`<`)?{type:`html_block`,content:a}:{type:`text`,content:a,raw:a})}else r.children=[{type:`html_block`,content:r.content,tag:n,loading:!0}];continue}if(!r||r.type!==`inline`)continue;if(r.children.length===2&&r.children[0].type===`html_inline`){let e=(r.children[0].content?.match(/<([^\s>/]+)/)?.[1]??``).toLowerCase(),t=r.children[1],i=String(t?.content??``).match(/^<\s*\/\s*([^\s>]+)/)?.[1]?.toLowerCase()??``;if(t?.type===`html_inline`&&i===e)continue;n.has(e)?(r.children[0].loading=!0,r.children[0].tag=e,r.children.push({type:`html_inline`,tag:e,loading:!0,content:`</${e}>`})):r.children=[{type:`html_block`,loading:!0,tag:e,content:String(r.children[0]?.content??``)+String(r.children[1]?.content??``)}];continue}if(r.children.length===3&&r.children[0].type===`html_inline`&&r.children[2].type===`html_inline`){let e=(r.children[0].content?.match(/<([^\s>/]+)/)?.[1]??``).toLowerCase();if(n.has(e))continue;r.children=[{type:`html_block`,loading:!1,tag:e,content:r.children.map(e=>e.content).join(``)}];continue}if(!r.content?.startsWith(`<`)||r.children?.length!==1)continue;let i=String(r.content),a=r,s=a.children[0];if(s?.type!==`html_inline`){/^<\s*(?:\/\s*)?[A-Z][\w:-]*\s*$/i.test(i)&&(a.children.length=0);continue}let c=String(s.content??i).match(Cy)?.[1]?.toLowerCase()??``;if(c){if(/\/\s*>\s*$/.test(i)||_y.has(c)){a.children=[{type:`html_inline`,content:i}];continue}a.children.length=0}}})}function Uy(e){let t=e.trim();return!t||/^&[a-z0-9#]+;/i.test(t)?!1:!!(/^(?:const|let|var|function|class|import|export|if|for|while|return|await|async|yield|try|catch|throw|new|typeof|instanceof|switch|case|break|continue|def|ruby|perl|print|echo|true|false|null|undefined|NaN|Infinity|this)\b/.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[\d+\])*\s*\(/i.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[[\d+\]])+/i.test(t)||/\w+\s*(?:===?|!==?|<=?|>=?|\+\+|--|&&|\|\||\?\.)/.test(t)||/^(?:!!|\+\+|--)\s*\w/.test(t)||/[\w$]+\s*(?:\+=|-=|\*=|\/=|%=|\*\*=|=)/.test(t)||/^(?:https?:\/\/|ftp:\/\/|file:\/\/|\/\/|www\.)/i.test(t)||/`[^`]*\$\{[^}]*\}[^`]*`/.test(t)||/<\/?[A-Z][a-zA-Z0-9]*/.test(t)||/<[a-z][a-z0-9]*\s[^>]+>/.test(t)||/^(["'`]).*\1\s*[;,]?$/.test(t)||/^\[[\s\S]*\]$/.test(t)||/^\{[\s\S]*\}$/.test(t)||/^\(\s*\)$/.test(t)||/[\w$]+(?:\s*[+\-*/%<>=!&|^~:]+\s*[\w$]+|\s*\.\s*[\w$]+)/.test(t)||/=>|->|::/.test(t)||/^@[\w.$]+$/.test(t)||/^(?:0x[0-9a-fA-F]+|0b[01]+|0o[0-7]+|\d+(?:\.\d*)?(?:px|em|rem|%|vh|vw|deg|s|ms)?)$/.test(t)||/^\$[\w$]+\s*[=:]/.test(t)||/\|\s*\w+|\w+\s*\|/.test(t)||/^(?:git|npm|yarn|pnpm|bun|pip|cargo|go|rust|python|node|java|mvn|gradle|docker|kubectl)\s+/.test(t)||/(?:console|window|document|Math|JSON|Date|Array|Object|String|Number|Boolean)\.[a-zA-Z]/.test(t)||/^(?:\/\/|#|\/\*|\*\/|<!--|-->)/.test(t)||/^(?:<<<|<<\s*['"]?\w+['"]?)/.test(t))}function Wy(e,t={}){t.enabled!==!1&&e.core.ruler.after(`inline`,`fix_indented_code_block`,e=>{let t=e.tokens??[];for(let e=0;e<t.length;e++){let n=t[e];if(n.type!==`code_block`)continue;let r=String(n.content??``).trim();if(!r)continue;let i=r.split(/\r?\n/).filter(e=>e.trim().length>0);if(i.length===1&&!Uy(i[0]??``)){let r=i[0]??``,a=n.level??0;t.splice(e,1,{type:`paragraph_open`,tag:`p`,nesting:1,level:a},{type:`inline`,tag:``,nesting:0,level:a,content:r,children:[{type:`text`,content:r,level:a+1,raw:r}],block:!0},{type:`paragraph_close`,tag:`p`,nesting:-1,level:a}),e+=2}}})}var Gy=Symbol(`markstream.parse-context`);function Ky(e){return!!(e&&e[Gy]===!0)}function qy(e={},t={}){return{...e,[Gy]:!0,customHtmlBlockCursor:0,disableStreamParse:!1,disableStructuredReuse:!1,insideStrong:!1,isFragment:!1,...t}}function Jy(e){return Ky(e)?e:qy(e)}function Yy(e,t=e,n={}){return qy(t,{runtime:e.runtime,markdownIt:e.markdownIt,...n})}var Xy=/\.([a-z0-9]{1,15})$/i,Zy=/[_()[\]{}<>]/u,Qy=/^(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/i,$y=/[?#@]/u,eb=/[\\/]/u,tb=/^[\p{L}\p{N}./\\-]+$/u,nb=/^[A-Za-z0-9-]{1,63}$/u,rb=/^xn--[a-z0-9-]{2,59}$/i,ib=/^(?:[A-Z]{1,6}|\d{1,8})$/u,ab=/^(?=.{1,12}$)[A-Z0-9]+(?:[-.][A-Z0-9]+)*$/iu,ob=/文件名\s*[::]?|附件\s*[::]?|路径\s*[::]?|路徑\s*[::]?|文件列表\s*[::]?|文档列表\s*[::]?|文檔列表\s*[::]?|\bfile\s*names?\b\s*[::]?|\battachments?\b\s*[::]?|\bpaths?\b\s*[::]?|\bfile\s+lists?\b\s*[::]?|\bdocument\s+lists?\b\s*[::]?/iu,sb=/文件名\s*[::]?|文件\s*[::]?|附件\s*[::]?|档案\s*[::]?|檔案\s*[::]?|文档\s*[::]?|文檔\s*[::]?|资料\s*[::]?|資料\s*[::]?|路径\s*[::]?|路徑\s*[::]?|\bfile\s*name\b\s*[::]?|\battachments?\b\s*[::]?|\bfiles?\b\s*[::]?|\bdocuments?\b\s*[::]?|\bdocs?\b\s*[::]?|\bpaths?\b\s*[::]?/iu,cb=/股票代码|股票代碼|证券代码|證券代碼|(?:代码|代碼|交易所|后缀|後綴|市场|市場)(?=$|[\s::/|,,、()()])|\btickers?\b|\bsymbols?\b|\bexchanges?\b/iu,lb=2e3,ub=16384,db=512*lb,fb={},pb=new Set([`ai`,`md`,`py`,`rs`,`sh`,`zip`]),mb=new Set([`as`,`bj`,`de`,`hk`,`l`,`ln`,`ny`,`pa`,`sh`,`ss`,`sz`,`t`,`us`]),hb=new Set([...mb,`at`,`ax`,`cn`,`co`,`it`,`jp`,`ks`,`mc`,`mx`,`nz`,`pl`,`sa`,`si`,`to`,`tw`]),gb=new Set([`com`,`dev`,`io`,`page`,`site`]),_b=new Set([`app`,`apk`,`dmg`,`exe`,`ipa`,`lock`,`log`,`markdown`,`webmanifest`]),vb=new Set(`7z.ai.astro.avi.bash.bz2.c.cjs.cpp.cs.csv.doc.docx.fish.flac.gif.go.gz.h.hpp.html.java.jpeg.jpg.js.json.jsx.kt.md.mdx.mjs.mov.mp3.mp4.pdf.php.png.ppt.pptx.ps1.py.rar.rb.rs.sh.sql.svg.swift.svelte.tar.tgz.toml.ts.tsx.txt.vue.wav.webp.xls.xlsx.xml.yaml.yml.zip.zsh`.split(`.`)),yb=new Map,bb=0;function xb(e,t){if(!e||e.length>ub)return t;for(yb.has(e)||(bb+=e.length),yb.set(e,t);yb.size>lb||bb>db;){let e=yb.keys().next().value;if(!e)break;yb.delete(e),bb-=e.length}return t}function Sb(e){return e?.filename===!0||e?.explicitFilename===!0||e?.marketTicker===!0}function Cb(e,t){let n={filename:e?.filename||t?.filename,explicitFilename:e?.explicitFilename||t?.explicitFilename,marketTicker:e?.marketTicker||t?.marketTicker};return Sb(n)?n:void 0}function wb(e,t){if(!Sb(t))return e;let n=Jy(e),r=n.linkifyDemotionContext;return{...n,linkifyDemotionContext:{filename:r?.filename||t?.filename,explicitFilename:r?.explicitFilename||t?.explicitFilename,marketTicker:r?.marketTicker||t?.marketTicker}}}function Tb(e){let t=Ib(e);return Sb(t)?t:void 0}function Eb(e){return e.replace(/^[\s>*_`[\]((【《"'“‘]+/u,``).replace(/[\s<*_`\]))】》"'.。;;,,、::!?!?]+$/u,``)}function Db(e,t){if(!Sb(t))return;let n=String(e??``).trim().split(/\s+/u).map(Eb).filter(Boolean);if(n.length===0)return;let r={};return t?.filename&&n.every(e=>Vb(e,{filename:!0,explicitFilename:t.explicitFilename}))&&(r.filename=!0),t?.explicitFilename&&r.filename&&(r.explicitFilename=!0),t?.marketTicker&&n.every(e=>Vb(e,{marketTicker:!0}))&&(r.marketTicker=!0),Sb(r)?r:void 0}function Ob(e,t=!1){let n=Jy(e).linkifyDemotionSeedContext;return{options(r){return t||r==null?wb(e,n):wb(e,Cb(Tb(r),Db(r,n)))},remember(e){let r=Tb(e);n=t?Cb(n,r):Cb(r,Db(e,n))},reset(){n=void 0},snapshot(){return n}}}function kb(e){return nb.test(e)&&!e.startsWith(`-`)&&!e.endsWith(`-`)}function Ab(e){let t=e.split(`.`);if(t.length<2)return!1;let n=t[t.length-1]?.toLowerCase()??``;return kb(n)||rb.test(n)?t.every(kb):!1}function jb(e){return Array.from(e).some(e=>e.charCodeAt(0)>127)}function Mb(e){return e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,``).split(/[/?#]/,1)[0]??``}function Nb(e){return e.split(`.`).some(e=>e.toLowerCase().startsWith(`xn--`))}function Pb(e,t,n){let r=Mb(t);return jb(e)&&Nb(r)&&String(n??``).toLowerCase().includes(r.toLowerCase())}function Fb(e){if(!e)return!1;if(e.includes(`文件`)||e.includes(`附件`)||e.includes(`路径`)||e.includes(`路徑`)||e.includes(`文档`)||e.includes(`文檔`)||e.includes(`档案`)||e.includes(`檔案`)||e.includes(`资料`)||e.includes(`資料`)||e.includes(`股票`)||e.includes(`证券`)||e.includes(`證券`)||e.includes(`代码`)||e.includes(`代碼`)||e.includes(`交易所`)||e.includes(`后缀`)||e.includes(`後綴`)||e.includes(`市场`)||e.includes(`市場`))return!0;let t=e.toLowerCase();return t.includes(`file`)||t.includes(`attachment`)||t.includes(`document`)||t.includes(`doc`)||t.includes(`path`)||t.includes(`ticker`)||t.includes(`symbol`)||t.includes(`exchange`)}function Ib(e){let t=String(e??``);return yb.get(t)||(Fb(t)?xb(t,{explicitFilename:ob.test(t),filename:sb.test(t),marketTicker:cb.test(t)}):xb(t,fb))}function Lb(e){return Ab(e.split(/[\\/]/)[0]??``)}function Rb(e){let t=e.replace(/[^a-z]/gi,``);return t.length>=2&&t===t.toUpperCase()}function zb(e){if(Zy.test(e)||!tb.test(e))return!0;if(eb.test(e))return!Lb(e);let t=e.replace(Xy,``);return jb(t)?!0:t.split(`.`).filter(Boolean).some(Rb)}function Bb(e,t,n){if(!(n?hb:mb).has(t))return!1;let r=e.slice(0,-(t.length+1));return r===``?e.startsWith(`.`):(n?ab:ib).test(r)}function Vb(e,t={}){if(!e||Qy.test(e)||$y.test(e))return!1;let n=e.match(Xy);if(!n)return!1;let r=String(n[1]??``).toLowerCase();return Bb(e,r,t.marketTicker===!0)?!0:vb.has(r)?!pb.has(r)||t.filename?!0:zb(e):!!(t.explicitFilename&&gb.has(r)||t.filename&&_b.has(r))}var Hb=new WeakMap,Ub=new WeakSet;function Wb(e,t){return Hb.set(e,t),e}function Gb(e){return Hb.get(e)}function Kb(e){Ub.add(e)}function qb(e){return e===void 0||Ub.has(e)}var Jb=[`!`];function Yb(e){return e===`linkify`||e===`autolink`?e:`recovery`}function Xb(e){return{type:`text`,content:e,raw:e}}function Zb(e,t){t===1?e.push({type:`em_open`,tag:`em`,nesting:1}):t===2?e.push({type:`strong_open`,tag:`strong`,nesting:1}):t===3&&(e.push({type:`strong_open`,tag:`strong`,nesting:1}),e.push({type:`em_open`,tag:`em`,nesting:1}))}function Qb(e,t){t===1?e.push({type:`em_close`,tag:`em`,nesting:-1}):t===2?e.push({type:`strong_close`,tag:`strong`,nesting:-1}):t===3&&(e.push({type:`em_close`,tag:`em`,nesting:-1}),e.push({type:`strong_close`,tag:`strong`,nesting:-1}))}function $b(e,t,n,r=`recovery`){let i=``;if(t.includes(`"`)){let e=t.split(`"`);t=e[0].trim(),i=e[1].trim()}return Wb({type:`link`,loading:n,href:t,title:i,text:e,children:[{type:`text`,content:e,raw:e}],raw:String(`[${e}](${t})`)},r)}function ex(e,t){if(e&&t&&(e.href=String(e.href??``)+t,e.text=String(e.text??``)+t,e.raw=String(`[${e.text}](${e.href})`),Array.isArray(e.children)&&e.children.length)){let n=e.children[e.children.length-1];n?.type===`text`?(n.content=String(n.content??``)+t,n.raw=String(n.raw??``)+t):e.children.push(Xb(t))}}function tx(e,t){let n=-1;for(let r of t){let t=e.indexOf(r);t!==-1&&(n===-1||t<n)&&(n=t)}return n}function nx(e){let t=e.attrs?.find(e=>e?.[0]===`href`)?.[1];return typeof t==`string`?t:``}function rx(e,t){if(!e)return;e.attrs=Array.isArray(e.attrs)?e.attrs:[];let n=e.attrs.findIndex(e=>e?.[0]===`href`);n>=0?e.attrs[n][1]=t:e.attrs.push([`href`,t])}function ix(e,t,n){let r=``;for(let i=t+1;i<n;i++){let t=e[i];if(t?.type!==`text`||typeof t.content!=`string`)return null;r+=t.content}return r||null}function ax(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===`(`)t++;else if(r===`)`){if(t===0)return n;t--}}return-1}function ox(e){e.core.ruler.after(`inline`,`fix_link_tokens`,e=>{let t=e.tokens??[];for(let e=0;e<t.length;e++){let n=t[e];if(n&&n.type===`inline`&&Array.isArray(n.children))try{n.children=sx(n.children,typeof n.content==`string`?n.content:void 0)}catch(e){console.error(`[applyFixLinkTokens] failed to fix inline children`,e)}}})}function sx(e,t){if(e.length<3)return e;let n=e.some(e=>e.type===`code_inline`),r=new Map,i=0;for(let t=0;t<e.length;t++){let n=e[t];if(n.type===`link_open`){let a=-1;for(let n=t+1;n<e.length;n++)if(e[n]?.type===`link_close`){a=n;break}if(a!==-1&&n.markup===`linkify`){r.set(n,i);let o=ix(e,t,a),s=i>0&&o?ax(o):-1;if(s!==-1&&o)for(let e of o.slice(s))e===`(`?i++:e===`)`&&i>0&&i--}a!==-1&&(t=a);continue}if(n.type===`text`&&typeof n.content==`string`)for(let e of n.content)e===`(`?i++:e===`)`&&i>0&&i--}let a=Ib(t);for(let i=0;i<=e.length-1;i++){i<0&&(i=0);let o=e[i];if(!o)break;if(o.type===`link_open`&&(o.markup===`linkify`||o.markup===`autolink`)){let s=-1;for(let t=i+1;t<e.length;t++)if(e[t]?.type===`link_close`){s=t;break}if(s!==-1){let c=ix(e,i,s),l=nx(o);if(!n&&o.markup===`linkify`&&c&&!Pb(c,l,t)&&Vb(c,a)){e.splice(i,s-i+1,Xb(c));continue}let u=tx(c??``,Jb);if(o.markup===`linkify`&&c?.includes(`)`)&&(r.get(o)??0)>0){let e=ax(c);e!==-1&&(u===-1||e<u)&&(u=e)}let d=tx(l,Jb),f=u;for(let t=i+1;t<s;t++){let n=e[t];if(n?.type!==`text`||typeof n.content!=`string`)continue;if(f>=n.content.length){f-=n.content.length;continue}if(f<0)break;let r=n.content[f],i=n.content.slice(0,f),a=n.content.slice(f);for(let n=t+1;n<s;n++){let t=e[n];t?.type===`text`&&typeof t.content==`string`&&(a+=t.content)}n.content=i,n.raw=i;let c=s-(t+1);c>0&&(e.splice(t+1,c),s=t+1);let u=l;if(r===`!`&&d!==-1)u=l.slice(0,d);else if(a){let e=encodeURI(a);if(e&&l.endsWith(e))u=l.slice(0,l.length-e.length);else{let e=r?encodeURI(r):``,t=e?l.indexOf(e):-1;t!==-1&&(u=l.slice(0,t))}}u!==l&&rx(o,u),a&&e.splice(s+1,0,Xb(a));break}}}if(!n){if(o?.type===`em_open`&&e[i-1]?.type===`text`&&e[i-1].content?.endsWith(`*`)){let t=e[i-1].content?.replace(/(\*+)$/,``)||``;e[i-1].content=t,o.type=`strong_open`,o.tag=`strong`,o.markup=`**`;for(let t=i+1;t<e.length;t++)if(e[t]?.type===`em_close`){e[t].type=`strong_close`,e[t].tag=`strong`,e[t].markup=`**`;break}}else if(o?.type===`text`&&o.content?.endsWith(`(`)&&e[i+1]?.type===`link_open`){let t=o.content.match(/\[([^\]]+)\]/);if(t){let n=o.content.slice(0,t.index),r=n.match(/(\*+)$/),a=Yb(e[i+1]?.markup),s=[];if(r){n=n.slice(0,r.index),n&&s.push(Xb(n));let o=t[1],c=r[1].length;Zb(s,c);let l=e[i+2]?.content||``;if(e[i+4]?.type===`text`&&!e[i+4].content?.startsWith(`)`)&&(l+=e[i+4]?.content||``,e[i+4].content=``),s.push($b(o,l,!e[i+4]?.content?.startsWith(`)`),a)),Qb(s,c),e[i+4]?.type===`text`){let t=e[i+4].content?.replace(/^\)\**/,``);t&&s.push(Xb(t)),e.splice(i,5,...s)}else e.splice(i,4,...s)}else{n&&s.push(Xb(n));let r=t[1],o=r.match(/^\*+/);if(o){let t=o[0].length;r=r.replace(/^\*+/,``).replace(/\*+$/,``);let n=e[i+2]?.content||``;if(e[i+4]?.type===`text`&&!e[i+4].content?.startsWith(`)`)&&(n+=e[i+4]?.content||``,e[i+4].content=``),Zb(s,t),s.push($b(r,n,!e[i+4]?.content?.startsWith(`)`),a)),Qb(s,t),e[i+4]?.type===`text`){let t=e[i+4].content?.replace(/^\)/,``);t&&s.push(Xb(t)),e.splice(i,5,...s)}else e.splice(i,4,...s);i===0?i=s.length-1:i-=s.length+1;continue}let c=e[i+2]?.content||``;if(e[i+4]?.type===`text`&&!e[i+4].content?.startsWith(`)`)&&(c+=e[i+4]?.content||``,e[i+4].content=``),s.push($b(r,c,!e[i+4]?.content?.startsWith(`)`),a)),e[i+4]?.type===`text`){let t=e[i+4].content?.replace(/^\)/,``);t&&s.push(Xb(t)),e.splice(i,5,...s)}else e.splice(i,4,...s)}i-=s.length+1;continue}}else if(o.type===`link_open`&&o.markup===`linkify`&&e[i-1]?.type===`text`&&e[i-1].content?.endsWith(`(`)){if(e[i-2]?.type===`link_close`){let t=[],n=e[i-3].content||``,r=o.attrs?.find(e=>e[0]===`href`)?.[1]||``;if(e[i+3]?.type===`text`){let a=(e[i+3]?.content??``).indexOf(`)`),o=a===-1;a===-1&&(r+=e[i+3]?.content?.slice(0,a)||``,e[i+3].content=``),t.push($b(n,r,o,`linkify`));let s=e[i+3].content?.replace(/^\)\**/,``);s&&t.push(Xb(s)),e.splice(i-4,8,...t)}else t.push(Wb({type:`link`,loading:!0,href:r,title:``,text:n,children:[{type:`text`,content:r,raw:r}],raw:String(`[${n}](${r})`)},`linkify`)),e.splice(i-4,7,...t);continue}if(e[i-1].content===`](`&&e[i-3]?.type===`text`&&e[i-3].content?.endsWith(`)`)){if(e[i-2]?.type===`strong_open`){let[t,n]=e[i-3].content?.split(`[**`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}else if(e[i-2]?.type===`em_open`){let[t,n]=e[i-3].content?.split(`[*`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}else{let[t,n]=e[i-3].content?.split(`[`)||[];e[i+1].content=n||``,e[i-3].content=t||``,e[i-1].content=``}}}if(o.type===`link_close`&&o.nesting===-1&&e[i-2]?.type===`link_open`&&e[i+1]?.type===`text`&&e[i-1]?.type===`text`){let t=e[i-1].content||``,n=e[i-2].attrs||[],r=n.find(e=>e[0]===`href`)?.[1]||``,a=n.find(e=>e[0]===`title`)?.[1]||``,s=3,c=2,l=(e[i-3]?.content||``).match(/^(\*+)$/),u=[];if(l){c+=1;let e=l[1].length;Zb(u,e)}if(o.markup!==`linkify`&&e[i+1].type===`text`&&e[i+1]?.content?.startsWith(`](`)){s+=1;for(let t=i+1;t<e.length;t++){let n=l?l[1].length:e[i-3].markup.length,r=e[t];if(n===1&&r.type===`em_close`||n===2&&r.type===`strong_close`||n===3&&(r.type===`em_close`||r.type===`strong_close`))break;s+=1}}let d=Wb({type:`link`,loading:!1,href:r,title:a,text:t,children:[{type:`text`,content:t,raw:t}],raw:String(`[${t}](${r})`)},o.markup?Yb(o.markup):`explicit`);if(u.push(d),l){let e=l[1].length;Qb(u,e)}e.splice(i-c,s,...u),i-=u.length+1;continue}if(o.content?.startsWith(`](`)&&e[i-1].markup?.includes(`*`)&&e[i-4]?.type===`text`&&e[i-4].content?.endsWith(`[`)){let t=e[i-1].markup.length,n=[],r=e[i-4].content.slice(0,e[i-4].content.length-t);r&&n.push(Xb(r)),Zb(n,t);let a=e[i-2].content||``,s=o.content.slice(2),c=!0;if(e[i+1]?.type===`text`){let t=(e[i+1]?.content??``).indexOf(`)`);c=t===-1,t===-1&&(s+=e[i+1]?.content?.slice(0,t)||``,e[i+1].content=``)}if(n.push($b(a,s,c)),Qb(n,t),e[i+1]?.type===`text`){let t=e[i+1].content?.replace(/^\)\**/,``);t&&n.push(Xb(t)),e.splice(i-4,8,...n)}else e[i+1]?.type===`link_open`?e.splice(i-4,10,...n):e.splice(i-4,7,...n);i-=n.length+1;continue}if(o.content?.startsWith(`](`)&&e[i-1].type===`strong_close`&&e[i-4]?.type===`text`&&e[i-4]?.content?.includes(`**[`)){let t=[],n=e[i-4].content.split(`**[`)[0];n&&t.push(Xb(n)),Zb(t,2);let r=e[i-2].content||``,a=o.content.slice(2),s=!0;if(e[i+1]?.type===`text`){let t=(e[i+1]?.content??``).indexOf(`)`);s=t===-1,t===-1&&(a+=e[i+1]?.content?.slice(0,t)||``,e[i+1].content=``)}if(t.push($b(r,a,s)),Qb(t,2),e[i+1]?.type===`text`){let n=e[i+1].content?.replace(/^\)\**/,``);n&&t.push(Xb(n)),e.splice(i-4,8,...t)}else e[i+1]?.type===`link_open`?e.splice(i-4,10,...t):e.splice(i-4,7,...t);i-=t.length+1;continue}if(o.type===`strong_close`&&e[i+1]?.type===`text`&&e[i+1].content?.includes(`](`)&&e[i-1].type===`text`&&/\[.*$/.test(e[i-1].content||``)){let t=[],[n,r]=e[i-1].content?.split(`[`)||[``,``];n&&t.push(Xb(n)),Zb(t,2);let[a,s]=e[i+1].content.split(`](`);a=r+a;let c=4;if(e[i+2]?.type===`link_open`){let t=e[i+2].attrs?.find(e=>e[0]===`href`)?.[1];e[i+5]?.type===`text`&&e[i+5].content===`.`?(s=(t||s)+e[i+5].content,e[i+5].content=``):s=t||s,c+=3}let l=!0;if(o.nesting===-1&&(a=a.replace(/\*+$/,``)),e[i+2]?.type===`text`){let t=(e[i+2]?.content??``).indexOf(`)`);l=t===-1,t===-1&&(s+=e[i+2]?.content?.slice(0,t)||``,e[i+2].content=``)}t.push($b(a,s,l)),Qb(t,2),e.splice(i-2,c,...t)}if(o.type===`text`&&/\*+\[[^\]]*$/.test(o.content||``)&&e[i+1]?.type===`strong_open`&&e[i+2]?.type===`text`&&e[i+2].content===`](`&&e[i+3]?.type===`link_open`&&e[i+5]?.type===`link_close`&&e[i+6]?.type===`text`&&e[i+6].content===`)`&&e[i+7]?.type===`strong_close`){let t=(o.content||``).match(/^(\*+)\[(.*)$/);if(t){let n=(t[2]||``)+t[1],r=e[i+3]?.attrs?.find(e=>e[0]===`href`)?.[1]||``;!r&&e[i+4]?.type===`text`&&(r=e[i+4].content||``);let a=[];Zb(a,2),a.push($b(n,r,!1)),Qb(a,2),e.splice(i,9,...a),i-=a.length-1;continue}}}}if(n)return e;for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n?.type!==`link`||r?.type!==`text`||typeof r.content!=`string`||!r.content.startsWith(`!`))continue;let i=String(n.href??``);if(String(n.text??``)!==i||!i.endsWith(`=`)&&!i.endsWith(`#`))continue;ex(n,`!`);let a=r.content.slice(1);a?(r.content=a,r.raw=a):e.splice(t+1,1)}return e}function cx(e){e.core.ruler.after(`inline`,`fix_list_item_tokens`,e=>{let t=e.tokens??[];for(let e=0;e<t.length;e++){let n=t[e];if(n&&n.type===`inline`&&Array.isArray(n.children))try{n.children=lx(n.children)}catch(e){console.error(`[applyFixListItem] failed to fix inline children`,e)}}})}function lx(e){let t=e[e.length-1],n=String(t?.content??``);return t?.type===`text`&&/^\s*\d+\.\s*$/.test(n)&&e[e.length-2]?.tag===`br`&&e.splice(e.length-1,1),e}function ux(e){e.core.ruler.after(`inline`,`fix_strong_tokens`,e=>{let t=e.tokens??[];for(let e=0;e<t.length;e++){let n=t[e];if(n&&n.type===`inline`&&Array.isArray(n.children))try{n.children=dx(n.children)}catch(e){console.error(`[applyFixStrongTokens] failed to fix inline children`,e)}}})}function dx(e){let t=0,n=new Set,r=new Set,i=0;for(let a=0;a<e.length;a++){let o=e[a],s=o.type;if(s===`strong_open`){t++;let r=String(o.markup??``),i=a-1;for(;i>=0&&e[i].type===`text`&&e[i].content===``;)i--;let s=e[i],c=a+1;for(;c<e.length&&e[c].type===`text`&&e[c].content===``;)c++;let l=e[c];r===`__`&&(s?.content?.endsWith(`_`)||l?.content?.startsWith(`_`)||l?.markup?.includes(`_`))&&(o.type=`text`,o.tag=``,o.content=r,o.raw=r,o.markup=``,o.attrs=null,o.map=null,o.info=``,o.meta=null,n.add(t))}else if(s===`strong_close`)n.has(t)&&o.markup===`__`&&(o.type=`text`,o.content=o.markup,o.raw=String(o.markup??``),o.tag=``,o.markup=``,o.attrs=null,o.map=null,o.info=``,o.meta=null),t--,t<0&&(t=0);else if(s===`em_open`){i++;let t=String(o.markup??``),n=a-1;for(;n>=0&&e[n].type===`text`&&e[n].content===``;)n--;let s=e[n],c=a+1;for(;c<e.length&&e[c].type===`text`&&e[c].content===``;)c++;let l=e[c];t===`_`&&(s?.content?.endsWith(`_`)||l?.content?.startsWith(`_`)||l?.markup?.includes(`_`))&&(o.type=`text`,o.tag=``,o.content=t,o.raw=t,o.markup=``,o.attrs=null,o.map=null,o.info=``,o.meta=null,r.add(i))}else s===`em_close`&&(r.has(i)&&o.markup===`_`&&(o.type=`text`,o.content=o.markup,o.raw=String(o.markup??``),o.tag=``,o.markup=``,o.attrs=null,o.map=null,o.info=``,o.meta=null),i--,i<0&&(i=0))}if(e.length<5)return e;let a=e.length-4,o=e[a],s=[...e],c=e[a+1],l=String(o.content??``);if(o.type===`link_open`&&e[a-1]?.type===`em_open`&&e[a-2]?.type===`text`&&e[a-2].content?.endsWith(`*`)){let t=String(e[a-2].content??``).slice(0,-1),n=[{type:`strong_open`,tag:`strong`,attrs:null,map:null,children:null,content:``,markup:`**`,info:``,meta:null,raw:``},e[a],e[a+1],e[a+2],{type:`strong_close`,tag:`strong`,attrs:null,map:null,children:null,content:``,markup:`**`,info:``,meta:null,raw:``}];t&&n.unshift({type:`text`,content:t,raw:t}),s.splice(a-2,6,...n)}else if(o.type===`text`&&l.endsWith(`*`)&&c.type===`em_open`){let t=e[a+2],n=t?.type===`text`?4:3,r=[{type:`strong_open`,tag:`strong`,attrs:null,map:null,children:null,content:``,markup:`**`,info:``,meta:null,raw:``},{type:`text`,content:t?.type===`text`?String(t.content??``):``,raw:t?.type===`text`?String(t.content??``):``},{type:`strong_close`,tag:`strong`,attrs:null,map:null,children:null,content:``,markup:`**`,info:``,meta:null,raw:``}],i=l.slice(0,-1);i&&r.unshift({type:`text`,content:i,raw:i}),s.splice(a,n,...r)}return s=fx(s),s}function fx(e){if(e.length<7)return e;let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=e[n+1],a=e[n+2],o=e[n+3],s=e[n+4],c=e[n+5],l=e[n+6];if(r?.type===`strong_open`&&i?.type===`text`&&a?.type===`strong_close`&&o?.type===`strong_open`&&s?.type===`math_inline`&&c?.type===`strong_close`&&l?.type===`text`){let e=String(l.content??``),a=e.indexOf(`**`);if(a!==-1){let o=e.slice(0,a),u=e.slice(a+2);t.push(r),t.push(i),t.push(s),o&&t.push({...l,type:`text`,content:o,raw:o}),t.push(c),u&&t.push({...l,type:`text`,content:u,raw:u}),n+=6;continue}}if(r?.type===`strong_open`&&i?.type===`text`&&a?.type===`strong_close`&&o?.type===`strong_open`&&s?.type===`math_inline`&&c?.type===`strong_close`){let a=px(e,n+6);if(a){t.push(r),t.push(i),t.push(s);for(let r=n+6;r<a.index;r++)t.push(e[r]);a.beforeClose&&t.push({...e[a.index],type:`text`,content:a.beforeClose,raw:a.beforeClose}),t.push(c),a.afterClose&&t.push({...e[a.index],type:`text`,content:a.afterClose,raw:a.afterClose}),n=a.index;continue}}t.push(r)}return t}function px(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.type===`strong_open`)return null;if(t?.type!==`text`)continue;let r=String(t.content??``),i=r.indexOf(`**`);if(i!==-1)return{index:n,beforeClose:r.slice(0,i),afterClose:r.slice(i+2)}}return null}function mx(e){e.core.ruler.after(`block`,`fix_table_tokens`,e=>{let t=e;try{let e=Ex(t.tokens??[],!!t.env?.__markstreamFinal,t.src??``);Array.isArray(e)&&(t.tokens=e)}catch(e){console.error(`[applyFixTableTokens] failed to fix table tokens`,e)}})}function hx(e){let t=Array.isArray(e)?[...e]:null,n=t?[t[0],t[0]+1]:null;return[{type:`table_open`,tag:`table`,attrs:null,map:t,children:null,content:``,markup:``,info:``,level:0,nesting:1,block:!0,loading:!0,meta:null},{type:`thead_open`,tag:`thead`,attrs:null,block:!0,level:1,map:n,nesting:1,children:null},{type:`tr_open`,tag:`tr`,attrs:null,block:!0,level:2,map:n,nesting:1,children:null}]}function gx(){return[{type:`tr_close`,tag:`tr`,attrs:null,block:!0,level:2,map:null,nesting:-1,children:null},{type:`thead_close`,tag:`thead`,attrs:null,block:!0,level:1,map:null,nesting:-1,children:null},{type:`table_close`,tag:`table`,attrs:null,map:null,children:null,content:``,markup:``,info:``,level:0,nesting:-1,block:!0,meta:null}]}function _x(e){return[{type:`th_open`,tag:`th`,attrs:null,block:!0,level:3,map:null,nesting:1,children:null},{type:`inline`,tag:``,children:null,content:e,level:4,attrs:null,map:null,nesting:0,block:!0},{type:`th_close`,tag:`th`,attrs:null,block:!0,level:3,map:null,nesting:-1,children:null}]}function vx(e,t){if(!e.startsWith(`|`)||e.includes(`
|
|
83
|
-
`)||t&&!e.endsWith(`|`))return null;let n=e.slice(1).split(`|`);return n.at(-1)===``&&n.pop(),n.length>0&&n.every(e=>e.trim().length>0)?n:null}function yx(e){return vx(e,!0)!==null}function bx(e){return/^:?-+:?$/.test(e.trim())}function xx(e){if(!e.startsWith(`|`))return!1;let t=e.slice(1).split(`|`);return t.at(-1)===``&&t.pop(),t.length>0&&t.every(bx)}function Sx(e){return/^(?:[::]-*|:?-+:?)?$/.test(e.trim())}function Cx(e){if(e===``)return!0;if(!e.startsWith(`|`))return!1;let t=e.slice(1).split(`|`),n=t.at(-1)??``;return t.slice(0,-1).every(bx)&&Sx(n)}function wx(e){return e===`|`||e===`|:`}function Tx(e){let t=vx(e,!0);return t!==null&&t.every(e=>!e.includes(`:`))}function Ex(e,t=!1,n=``){if(e.length<3)return e;let r=e.length-2,i=e[r];if(i.type!==`inline`)return e;let a=e[r-1]?.map,o=String(i.content??``),s=o.split(`
|
|
84
|
-
`)[0]??``,[c=``,l=``,...u]=o.split(`
|
|
85
|
-
`),d=!t&&!o.includes(`
|
|
86
|
-
`)&&/\r?\n$/.test(n)&&yx(o),f=null;if(!t&&(o.includes(`
|
|
87
|
-
`)&&u.length===0&&yx(c)&&Cx(l)||d)){let t=s.slice(1,-1).split(`|`).map(e=>e.trim()).flatMap(e=>_x(e)),n=[...hx(a),...t,...gx()];f=[...e],f.splice(r-1,3,...n)}else if(o.includes(`
|
|
88
|
-
`)&&u.length===0&&yx(c)&&xx(l)){let t=s.slice(1,-1).split(`|`).map(e=>e.trim()).flatMap(e=>_x(e)),n=[...hx(a),...t,...gx()];f=[...e],f.splice(r-1,3,...n)}else if(o.includes(`
|
|
89
|
-
`)&&u.length===0&&Tx(c)&&wx(l))return i.content=o.slice(0,-2),i.children.splice(2,1),e;return f??e}function Dx(e,t,n,r){let i=e.length;if(n===`$$`&&r===`$$`){let n=t;for(;n<i-1;){if(e[n]===`$`&&e[n+1]===`$`){let t=n-1,r=0;for(;t>=0&&e[t]===`\\`;)r++,t--;if(r%2==0)return n}n++}return-1}let a=n[n.length-1],o=r,s=0,c=t;for(;c<i;){if(e.slice(c,c+o.length)===o){let t=c-1,n=0;for(;t>=0&&e[t]===`\\`;)n++,t--;if(n%2==0){if(s===0)return c;s--,c+=o.length;continue}}let t=e[c];if(t===`\\`){c+=2;continue}t===a?s++:t===o[o.length-1]&&s>0&&s--,c++}return-1}var Ox=Dx,kx=[`boldsymbol`,`mathbb`,`mathcal`,`mathfrak`,`mathrm`,`mathit`,`mathsf`,`vec`,`hat`,`bar`,`tilde`,`overline`,`underline`,`mathscr`,`mathnormal`,`operatorname`,`mathbf*`].map(e=>e.replace(/[.*+?^${}()|[\\]"\]/g,`\\$&`)).join(`|`),Ax=/\\[a-z]+/i,jx=`(?:\\\\|\\u0008)`,Mx=new RegExp(String.raw`${jx}(?:${kx})\s*\{[^}]+\}`,`i`),Nx=new RegExp(String.raw`(?:${jx})?(?:${kx})\s*\{`,`i`),Px=/\\(?:text|frac|left|right|times)/,Fx=/(?:^|[^+])\+(?!\+)|[=\-*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/,Ix=/\b[A-Z]{2,}-[A-Z]{2,}\b/i,Lx=/[A-Z]+\s*\([^)]+\)/i,Rx=/^\(\s*[a-z](?:\s*,\s*[a-z])+\s*\)$/i,zx=/\b(?:sin|cos|tan|log|ln|exp|sqrt|frac|sum|lim|int|prod)\b/,Bx=/\b\d{4}\/\d{1,2}\/\d{1,2}(?:[ T]\d{1,2}:\d{2}(?::\d{2})?)?\b/,Vx={"\b":`\\b`,"\v":`\\v`,"\f":`\\f`};function Hx(e){let t=``;for(let n of e)t+=Vx[n]??n;return t}function Ux(e){if(!e)return!1;let t=Hx(e),n=t.trim();if(Bx.test(n)||n.includes(`**`))return!1;if(n.length>2e3)return!0;let r=Ax.test(t),i=Mx.test(t),a=Nx.test(t),o=Px.test(t),s=/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)_(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t)||/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)\^(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t),c=Fx.test(t)&&!Ix.test(t),l=Lx.test(t),u=Rx.test(n),d=zx.test(t),f=/^\([a-z]\)$/i.test(n)||/^(?:[a-z]|pi)$/i.test(n),p=/^(?:[A-Z][a-z]?(?:_\{?\d+\}?|\^\{?\d+\}?)?)+$/.test(n);return r||i||a||o||s||c||l||u||d||f||p}var Wx=`__markstreamMathPluginApplied`,Gx=80,Kx=2e4,qx=24096;function Jx(e){return!!e[Wx]}function Yx(e){e[Wx]=!0}var Xx=`ldots.cdots.quad.in.displaystyle.int_.lim.lim_.ce.pu.end.infty.perp.mid.operatorname.to.rightarrow.leftarrow.math.mathrm.mathit.mathbb.mathcal.mathfrak.implies.alpha.beta.gamma.delta.epsilon.lambda.sum.sum_.prod.sqrt.fbox.boxed.color.rule.edef.fcolorbox.hline.hdashline.cdot.times.pm.le.ge.neq.sin.cos.tan.log.ln.exp.frac.text.left.right`.split(`.`),Zx=[`cdot`,`mathbf{`,`partial`,`mu_{`],Qx=Xx.slice().sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\\]\\\]/g,`\\$&`)).join(`|`),$x=`[ \r\b\f\v]`,eS=RegExp(`([^\\\\])(${Zx.map(e=>e).join(`|`)})+`,`g`),tS=/span\{([^}]+)\}/,nS=/\\operatorname\{span\}\{((?:[^{}]|\{[^}]*\})+)\}/,rS=/(^|[^\\])\\\r?\n/g,iS=/(^|[^\\])\\$/g,aS=/[\p{L}\p{M}\p{N}\p{Pe}\p{Pf}'′″‴|‖]/u,oS=RegExp(`(${$x})|(${Qx})\\b`,`g`),sS=new Map,cS=new Map;function lS(e){if(!e)return oS;let t=[...e];t.sort((e,t)=>t.length-e.length);let n=t.join(``),r=sS.get(n);if(r)return r;let i=`(?:${t.map(e=>e.replace(/[.*+?^${}()|[\\]\\"\]/g,`\\$&`)).join(`|`)})`,a=RegExp(`(${$x})|(${i})\\b`,`g`);return sS.set(n,a),a}function uS(e,t){let n=e?[]:[...t??[]];e||n.sort((e,t)=>t.length-e.length);let r=e?`__default__`:n.join(``),i=cS.get(r);if(i)return i;let a=e?[kx,Qx].filter(Boolean).join(`|`):[n.map(e=>e.replace(/[.*+?^${}()|[\\]\\\]/g,`\\$&`)).join(`|`),kx].filter(Boolean).join(`|`),o=RegExp(`(^|[^\\\\\\w])(${a})\\s*\\{`,`g`);return cS.set(r,o),o}var dS={" ":`t`,"\r":`r`,"\b":`b`,"\f":`f`,"\v":`v`};function fS(e){let t=/(^|[^\\])(__|\*\*)/g,n=0;for(;t.exec(e)!==null;)n++;return n}function pS(e){return e.replace(/(^|[^\\])!+/gu,(e,t)=>{if(t&&aS.test(t))return e;let n=t?e.slice(t.length):e;return`${t}${`\\!`.repeat(n.length)}`})}function mS(e){let t=/(^|[^\\])(__|\*\*)/g,n,r=null;for(;(n=t.exec(e))!==null;)r={marker:n[2],index:n.index+(n[1]?.length??0)};return r}function hS(e,t){let n=t?.commands??Xx,r=t?.escapeExclamation??!0,i=t?.commands==null,a=lS(i?void 0:n),o=e.replace(a,(e,t,r,i,a)=>{if(t!==void 0&&dS[t]!==void 0)return`\\${dS[t]}`;if(r&&n.includes(r)){let t=a&&typeof i==`number`?a[i-1]:void 0;return t===`\\`||t&&/\w/.test(t)?e:`\\${r}`}return e});r&&(o=pS(o));let s=o,c=uS(i,i?void 0:n);return s=s.replace(c,(e,t,n)=>`${t}\\${n}{`),s=s.replace(tS,`span\\{$1\\}`).replace(nS,`\\operatorname{span}\\{$1\\}`),s=s.replace(rS,`$1\\\\
|
|
90
|
-
`),s=s.replace(iS,`$1\\\\`),s=s.replace(eS,`$1\\$2`),s}function gS(e){let t=e.trim();return!(!Ux(t)||/"[^"\n]{1,80}"\s*:\s*/.test(t)||!(/\\[a-z]+/i.test(t)||/[=+*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/.test(t)||/[_^]/.test(t))&&/\s-\s/.test(t))}var _S=new WeakMap;function vS(e){let t=_S.get(e);if(t)return t;let n=e.src,r=e.env?.__markstreamFinal!==!0,i=[];for(let e=0;e<n.length;e++){let t=n[e];(t===`$`||t===`\\`)&&i.push(e)}return t={codeSpanRanges:bS(n),imageRanges:SS(n,r),mathOpenerPositions:i},_S.set(e,t),t}function yS(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<t?n=i+1:r=i}return n<e.length}function bS(e){let t=[],n=0;for(;n<e.length;){if(e[n]!=="`"){n++;continue}let r=n,i=1;for(;r+i<e.length&&e[r+i]==="`";)i++;let a=r+i,o=-1;for(;a<e.length;){if(e[a]!=="`"){a++;continue}let t=1;for(;a+t<e.length&&e[a+t]==="`";)t++;if(t===i){o=a;break}a+=t}if(o!==-1){t.push([r,o+i]),n=o+i;continue}n=r+i}return t}function xS(e,t){for(let n of e)if(t>=n[0]&&t<n[1])return n;return null}function SS(e,t=!1){let n=[],r=0;for(;r<e.length-1;){if(e[r]===`!`&&e[r+1]===`[`){let i=r,a=r+2,o=1;for(;a<e.length&&o>0;){if(e[a]===`\\`&&a+1<e.length){a+=2;continue}e[a]===`[`?o++:e[a]===`]`&&o--,a++}if(o===0&&a<e.length&&e[a]===`(`){let o=a+1,s=1;for(;o<e.length&&s>0;){if(e[o]===`\\`&&o+1<e.length){o+=2;continue}e[o]===`(`?s++:e[o]===`)`&&s--,o++}if(s===0){n.push([i,o]),r=o;continue}if(t){n.push([i,e.length]),r=e.length;continue}}}r++}return n}function CS(e,t){let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function wS(e,t){let n=t;for(;n<e.length;){let t=e.indexOf(`$`,n);if(t===-1)return-1;if(CS(e,t)){n=t+1;continue}return t}return-1}function TS(e,t){let n=t;for(;n<e.length;){let t=wS(e,n);if(t===-1)return-1;if(t>0&&e[t-1]===`$`||t+1<e.length&&e[t+1]===`$`){n=t+1;continue}return t}return-1}function ES(e,t,n=0){let r=Math.max(0,n);for(;r<e.length;){let n=e.indexOf(t,r);if(n===-1)return-1;if(!CS(e,n))return n;r=n+Math.max(1,t.length)}return-1}function DS(e,t,n=0,r=e.length,i=[]){let a=0,o=Math.max(0,n),s=Math.min(e.length,Math.max(0,r));for(;o<s;){let n=e.indexOf(t,o);if(n===-1||n>=s)break;let r=xS(i,n);if(r){o=Math.max(n+Math.max(1,t.length),r[1]);continue}CS(e,n)||a++,o=n+Math.max(1,t.length)}return a}function OS(e,t,n){let r=AS(String(e??``));if(!r.endsWith(t))return-1;let i=r.length-t.length;if(i<=0||!AS(r.slice(0,i)).trim()||CS(r,i))return-1;let a=bS(r);if(xS(a,i))return-1;let o=DS(r,t,0,i,a);if(t===`$$`){if(o%2==1)return-1}else if(o>DS(r,n,0,i,a))return-1;return i}function kS(e){return e===` `||e===` `}function AS(e){let t=e.length;for(;t>0&&kS(e[t-1]);)t--;return e.slice(0,t)}function jS(e){let t=0;for(let n=0;n<e.length;n++)e[n]===`
|
|
91
|
-
`&&t++;return t}function MS(e){if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57}function NS(e){if(e.length<3)return!1;let t=e[0];if(t!==`-`&&t!==`*`&&t!==`_`&&t!==`=`)return!1;let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i===t){n++;continue}if(!kS(i))return!1}return n>=3}function PS(e){let t=e.trim();if(!t)return!1;let n=0;t[n]===`:`&&n++;let r=0;for(;t[n]===`-`;)r++,n++;return r<3?!1:(t[n]===`:`&&n++,n===t.length)}function FS(e){if(!e.includes(`|`))return!1;let t=e[0]===`|`?e.slice(1):e;return(t.endsWith(`|`)?t.slice(0,-1):t).split(`|`).every(PS)}function IS(e){let t=0;if(!MS(e[t]))return!1;for(;MS(e[t]);)t++;return e[t]!==`.`&&e[t]!==`)`?!1:kS(e[t+1])}function LS(e){let t=e.trimStart();if(!t||t.startsWith("```")||t.startsWith(`~~~`)||t.startsWith(`:::`)||t[0]===`>`||t[0]===`<`)return!0;if(t[0]===`#`){let e=0;for(;t[e]===`#`;)e++;if(e>=1&&e<=6&&kS(t[e]))return!0}return!!((t[0]===`-`||t[0]===`+`||t[0]===`*`)&&kS(t[1])||IS(t)||NS(t)||FS(t))}function RS(e,t){return e?t?`${e}\n${t}`:e:t}function zS(e){let t=String(e??``).trim();return t?Ux(t):!1}function BS(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return t.toString(36)}function VS(e,t){if(e.length<=qx)return{source:e,lineOffset:0};if(t){let n=e.length-qx,r=e.indexOf(`
|
|
92
|
-
`,n);r=r===-1?e.length:r+1;let i=t.lineOffset+jS(e.slice(t.windowStart,r));return t.lineOffset=i,t.windowStart=r,{source:e.slice(r),lineOffset:i}}let n=e.length-qx,r=e.indexOf(`
|
|
93
|
-
`,n);n=r===-1?e.length:r+1;let i=jS(e.slice(0,n));return{source:e.slice(n),lineOffset:i}}function HS(e,t){let n=String(e??``);if(!n||!n.includes(`$$`)&&!n.includes(`\\[`))return!1;let{source:r}=VS(n,t);if(!r)return!1;let i=r.split(/\r?\n/),a=Math.max(0,i.length-Gx-2),o=[[`$$`,`$$`],[`\\[`,`\\]`]];for(let e=a;e<i.length;e++){let t=AS(i[e]);if(t&&!LS(t)){for(let[e,n]of o)if(OS(t,e,n)!==-1)return!0}}return!1}function US(e,t){let n=String(e??``);if(!n||!n.includes(`$$`)&&!n.includes(`\\[`))return null;let{source:r,lineOffset:i}=VS(n,t);if(!r)return null;let a=r.split(/\r?\n/),o=Math.max(0,a.length-Gx-2),s=[[`$$`,`$$`],[`\\[`,`\\]`]];for(let e=o;e<a.length-1;e++){let t=AS(a[e]);for(let[n,r]of s){let o=OS(t,n,r);if(o===-1)continue;let s=``,c=!1;for(let t=e+1;t<a.length;t++){if(t-e>Gx){c=!0;break}let l=a[t],u=ES(l,r);if(u!==-1){let a=RS(s,l.slice(0,u));if(!zS(a)){c=!0;break}let d=l.slice(u+r.length),f=d.trim()?`suffix:${BS(d)}`:`nosuffix`;return[`closed`,n,i+e,o,i+t,u,BS(a),f].join(`:`)}if(LS(l)){c=!0;break}if(s=RS(s,l),s.length>Kx){c=!0;break}}if(!c&&zS(s))return[`pending`,n,i+e,o].join(`:`)}}return null}function WS(e,t){let n=String(e??``).trim();return!n||!/^\d[\d,.]*\s*[~~-]\s*$/.test(n)?!1:/\d/.test(String(t??``))}function GS(e){let t=String(e??``).trimStart(),n=t.match(/^\d+(?:,\d{3})*(?:\.\d+)?/);if(!n)return!1;let r=t.slice(n[0].length);return/^\s*(?:[+\-*/^_=<>]|\\[a-z]+)/i.test(r)?!1:r===``||/^[)\s,.!?;:]/.test(r)}function KS(e){let t=String(e??``).trim();return t?/^(?:\.{3,}|…+)$/.test(t):!1}function qS(e,t){Yx(e);let n=(e,t,n)=>{let r=String(t??``).replace(/^[\t ]+/,``).replace(/[\t ]+$/,``);if(!r)return;let i=e.push(`paragraph_open`,`p`,1);i.map=[n,n+1];let a=e.push(`inline`,``,0);a.content=r,a.map=[n,n+1],a.children=[],e.push(`paragraph_close`,`p`,-1)},r=(e,n)=>{let r=e,i=!!t?.strictDelimiters,a=!r?.env?.__markstreamFinal,o=(e,t)=>{let n=t;for(;n<e.length&&(e[n]===` `||e[n]===` `);)n++;if(n===t||!(e[n]===`
|
|
94
|
-
`||e[n]===`\r`&&e[n+1]===`
|
|
95
|
-
`))return t;let i=e.slice(t,n),a=r.push(`text`,``,0);return a.content=i,n};if(/^\*[^*]+/.test(r.src))return!1;let s=String(r.pending??``),c=Math.max(0,r.pos-s.length),l=vS(r);if(!yS(l.mathOpenerPositions,c))return!1;if(r.src[r.pos]===`$`){let e=r.pos+1;for(;r.src[e]===`$`;)e++;let t=e-r.pos,n=r.src[e];if(t>=3&&(!n||/\s/.test(n))){let t=r.push(`text`,``,0);return t.content=r.src.slice(r.pos,e),r.pos=e,!0}}let u=[[`$$`,`$$`],[`$`,`$`],[`\\(`,`\\)`]],d=c,f=c,p=c,m=r.src,{codeSpanRanges:h,imageRanges:g}=l;for(let[e,s]of u){let c=!1;e===`$$`&&d!==p&&(d=p);let l=-1,u=-1,_=0,v=n=>{if((n===`undefined`||n==null)&&(n=``),n===`\\`){r.pos+=n.length,d=r.pos;return}if(n===`\\)`||n===`\\(`){let e=r.push(`text_special`,``,0);e.content=n===`\\)`?`)`:`(`,e.markup=n,r.pos+=n.length,d=r.pos;return}if(!n)return;if(e===`$$`&&n.includes(`$`)){let e=0;for(;e<n.length;){let i=wS(n,e);if(i===-1){let t=n.slice(e);if(t){let e=r.push(`text`,``,0);e.content=t,r.pos+=t.length,d=r.pos}break}if(i>0&&n[i-1]===`$`||i+1<n.length&&n[i+1]===`$`){let t=n.slice(e,i+1);if(t){let e=r.push(`text`,``,0);e.content=t,r.pos+=t.length,d=r.pos}e=i+1;continue}let a=n.slice(e,i);if(a){let e=r.push(`text`,``,0);e.content=a,r.pos+=a.length,d=r.pos}let o=TS(n,i+1);if(o===-1){let e=n.slice(i),t=r.push(`text`,``,0);t.content=e,r.pos+=e.length,d=r.pos;break}let s=n.slice(i+1,o),c=s.includes("`"),l=!s||!s.trim(),u=n[o+1],f=WS(s,u),p=KS(s);if(!c&&!l&&!f&&!p){let n=r.push(`math_inline`,`math`,0);n.content=hS(s,t),n.markup=`$`,n.raw=`$${s}$`,n.loading=!1,r.pos+=o-i+1,d=r.pos,e=o+1;continue}let m=r.push(`text`,``,0);m.content=`$`,r.pos+=1,d=r.pos,e=i+1}return}let i=n.indexOf(`![`);if(i!==-1){if(i>0){let e=n.slice(0,i),t=r.push(`text`,``,0);t.content=e,r.pos+=e.length,d=r.pos}let e=n.slice(i).match(/^!\[([^\]]*)\]\(([^)]+)\)/);if(e){let[,t,a]=e,o=a.match(/^(\S+)(?:\s+"([^"]+)")?\s*$/),s=o?o[1]:a,c=o&&o[2]?o[2]:null,l=r.push(`image`,`img`,0);l.attrs=[[`src`,s],[`alt`,t]],c&&l.attrs.push([`title`,c]),l.content=t,l.children=[{type:`text`,content:t,tag:``}],r.pos+=e[0].length,d=r.pos;let u=n.slice(i+e[0].length);u&&v(u);return}let t=r.push(`text`,``,0);t.content=n,r.pos+=n.length,d=r.pos;return}let a=r.push(`text`,``,0);a.content=n,r.pos+=n.length,d=r.pos};for(;!(d>=m.length);){let p=m.indexOf(e,d);if(p===-1)break;if(CS(m,p)){d=p+Math.max(1,e.length);continue}let y=xS(h,p);if(y){d=y[1];continue}let b=xS(g,p);if(b){d=b[1];continue}if(p===l&&d===u){if(_++,_>2){d=p+Math.max(1,e.length);continue}}else _=0,l=p,u=d;if(e===`(`&&p>0){let t=p-1;for(;t>=0&&m[t]===` `;)t--;if(t>=0&&m[t]===`]`){d=p+e.length;continue}}if(e===`$`&&p>0&&m[p-1]===`$`){d=p+1;continue}if(e===`$`&&p<m.length-1&&m[p+1]===`$`){d=p+2;continue}let x=e===`$`?TS(m,p+e.length):Ox(m,p+e.length,e,s);if(x===-1){let o=m.slice(p+e.length);if(o.includes(e)){d=m.indexOf(e,p+e.length);continue}if(x===-1){let l=e===`$`&&GS(o);if(a&&!i&&!l&&Ux(o)&&!o.includes("`")){if(d=p+e.length,c=!0,!n){r.pending=``;let n=f?m.slice(f,d):m.slice(0,d),i=fS(n)%2==1;if(f)v(m.slice(f,d));else{let t=m.slice(0,d);t.endsWith(e)&&(t=t.slice(0,t.length-e.length)),v(t)}if(i){let i=mS(n)?.marker??`**`,a=r.push(`strong_open`,``,0);a.markup=i;let c=r.push(`math_inline`,`math`,0);c.content=hS(o,t),c.markup=e===`$$`?`$$`:e===`\\(`?`\\(\\)`:e===`$`?`$`:`()`,c.raw=`${e}${o}${s}`,c.loading=!0,a.content=o,r.push(`strong_close`,``,0)}else{let n=r.push(`math_inline`,`math`,0);n.content=hS(o,t),n.markup=e===`$$`?`$$`:e===`\\(`?`\\(\\)`:e===`$`?`$`:`()`,n.raw=`${e}${o}${s}`,n.loading=!0}r.pos=m.length}d=m.length,f=d}break}}let S=m.slice(p+e.length,x),C=S.includes("`"),w=!S||!S.trim(),T=e===`$`,E=m[x+s.length],D=T&&WS(S,E),O=T&&KS(S);if(i?C||w||D||O:C||w||D||O||!T&&!Ux(S)){d=x+s.length;let e=m.slice(r.pos,d);r.pending||(v(e),f=d);continue}if(c=!0,!n){let n=m.slice(r.pos-(r.pending??``).length,p),i=m.slice(0,d)?m.slice(f,p):n,a=fS(i)%2==1;p!==r.pos&&a&&(i=r.pending+m.slice(r.pos,p));let c=a?mS(i):null,l=c?.marker??`**`;if(r.pending!==i){if(r.pending=``,a){if(c){let e=i.slice(c.index+l.length);v(i.slice(0,c.index));let t=r.push(`strong_open`,``,0);t.markup=l;let n=r.push(`text`,``,0);n.content=e,r.push(`strong_close`,``,0)}else v(i)}else v(i)}if(a){let n=r.push(`strong_open`,``,0);n.markup=l;let i=r.push(`math_inline`,`math`,0);i.content=hS(S,t),i.markup=e===`$$`?`$$`:e===`\\(`?`\\(\\)`:e===`$`?`$`:`()`,i.raw=`${e}${S}${s}`,i.loading=!1;let a=m.slice(x+s.length).startsWith(l);return a&&r.push(`strong_close`,``,0),r.pos=o(m,x+s.length),d=r.pos,f=d,a||r.push(`strong_close`,``,0),!0}{let n=r.push(`math_inline`,`math`,0);n.content=hS(S,t),n.markup=e===`$$`?`$$`:e===`\\(`?`\\(\\)`:e===`$`?`$`:`()`,n.raw=`${e}${S}${s}`,n.loading=!1}}return d=o(m,x+s.length),f=d,r.pos=d,!0}if(c){if(n)r.pos=d;else{if(e===`$$`&&d<m.length&&m.slice(d).includes(`$`)){let e=d;for(;!(e>=m.length);){let n=wS(m,e);if(n===-1)break;if(n+1<m.length&&m[n+1]===`$`){e=n+2;continue}if(n>0&&m[n-1]===`$`){e=n+1;continue}let i=TS(m,n+1);if(i===-1)break;let a=m.slice(n+1,i),o=a.includes("`"),s=!a||!a.trim(),c=m[i+1],l=WS(a,c),u=KS(a);if(!o&&!s&&!l&&!u){let o=m.slice(d,n);o&&v(o);let s=r.push(`math_inline`,`math`,0);s.content=hS(a,t),s.markup=`$`,s.raw=`$${a}$`,s.loading=!1,d=i+1,e=i+1}else v(`$`),e=n+1}e<m.length&&v(m.slice(e))}else d<m.length&&v(m.slice(d));r.pos=m.length}return!0}}return!1},i=(e,r,i,a)=>{let o=e,s=!o?.env?.__markstreamFinal,c=t?.strictDelimiters,l=c?[[`\\[`,`\\]`],[`$$`,`$$`]]:[[`\\[`,`\\]`],[`[`,`]`],[`$$`,`$$`]],u=o.bMarks[r]+o.tShift[r],d=o.src.slice(u,o.eMarks[r]).trim(),f=!1,p=``,m=``,h=!1,g=``,_=!1;for(let[e,n]of l)if(d.startsWith(e)){if(e.includes(`[`)){let a=e===`\\[`?d.slice(e.length):``;if(e===`\\[`&&ES(a,n)===-1&&!/^\s*!\[/.test(a)&&!a.includes("`")&&Ux(a)){f=!0,p=e,m=n;break}if(t?.strictDelimiters){if(d.replace(`\\`,``)===`[`){if(r+1<i){f=!0,p=e,m=n;break}continue}}else if(d.replace(`\\`,``)===`[`){if(r+1<i){f=!0,p=e,m=n;break}continue}else{let t=o.tokens[o.tokens.length-1];if(t&&t.type===`list_item_open`&&t.mark===`-`&&d.slice(e.length,d.indexOf(`]`)).trim()===`x`)continue;if(d.replace(`\\`,``).startsWith(`[`)&&!d.includes(`](`)){let t=d.indexOf(`]`);if(d.slice(t).trim()!==`]`)continue;let r=d.slice(e.length,t);if(e===`[`?gS(r):Ux(r)){f=!0,p=e,m=n;break}continue}}}else{f=!0,p=e,m=n;break}}else if((e===`$$`||e===`\\[`)&&d.endsWith(e)&&r+1<i){let t=OS(d,e,n);if(t===-1)continue;g=AS(d.slice(0,t)),_=!0;let i=o.bMarks[r+1]+o.tShift[r+1];d=o.src.slice(i,o.eMarks[r+1]).trim(),h=!0,f=!0,p=e,m=n;break}if(!f)return!1;if(a&&!_)return!0;let v=d.indexOf(p),y=v+p.length,b=!c&&p===`[`?d.indexOf(`\\]`,y):-1,x=b>=0?`\\]`:m,S=b>=0?b:ES(d,m,y);if(!h&&S>p.length){let e=d.slice(v+p.length,S),t=o.push(`math_block`,`math`,0);t.content=hS(e),t.markup=p===`$$`?`$$`:p===`[`?`[]`:`\\[\\]`,t.map=[r,r+1],t.raw=`${p}${e}${x}`,t.block=!0,t.loading=!1,o.line=r+1;let i=d.slice(S+x.length);return i.trim()&&n(o,i,r),!0}let C=r,w=``,T=!1,E=``,D=r,O=h?d:d===p?``:d.slice(p.length),k=!c&&p===`\\[`?`]`:``,A=ES(O,m);if(A!==-1){let e=A;w=O.slice(0,e),E=O.slice(e+m.length),D=h?r+1:r,T=!0,C=D}else for(O&&!h&&(w=O),C=r+1;C<i;C++){let e=o.bMarks[C]+o.tShift[C],t=o.eMarks[C],n=o.src.slice(e,t),r=n.trim();if(!c&&p===`[`&&r===`\\]`){m=`\\]`,T=!0;break}if(k&&n.trim()===k){m=k,T=!0;break}if(r===m){T=!0;break}if(!c&&p===`[`&&n.includes(`\\]`)){T=!0;let e=n.indexOf(`\\]`);m=`\\]`;let t=n.slice(0,e);t&&(w+=(w?`
|
|
96
|
-
`:``)+t),E=n.slice(e+m.length),D=C;break}if(ES(n,m)!==-1){T=!0;let e=ES(n,m),t=n.slice(0,e);t&&(w+=(w?`
|
|
97
|
-
`:``)+t),E=n.slice(e+m.length),D=C;break}w+=(w?`
|
|
98
|
-
`:``)+n}if((!s||c)&&!T)return!1;let j=/^\s*!\[/.test(w);if(!(_?!j&&zS(w):p===`$$`?!j:p===`[`?gS(w):Ux(w)))return!1;if(a)return!0;g&&n(o,g,r);let ee=o.push(`math_block`,`math`,0);return ee.content=hS(w),ee.markup=p===`$$`?`$$`:p===`[`?`[]`:`\\[\\]`,ee.raw=`${p}${w}${w.startsWith(`
|
|
99
|
-
`)?`
|
|
100
|
-
`:``}${m}`,ee.map=[r,C+1],ee.block=!0,ee.loading=!T,o.line=C+1,E.trim()&&n(o,E,D),!0};e.inline.ruler.before(`escape`,`math`,r),e.block.ruler.before(`lheading`,`explicit_math_block`,(e,t,n,r)=>{let a=e,o=a.bMarks[t]+a.tShift[t],s=a.src.slice(o,a.eMarks[t]).trim();return!s.startsWith(`$$`)&&!s.startsWith(`\\[`)?!1:i(e,t,n,r)},{alt:[`paragraph`,`reference`,`blockquote`,`list`]}),e.block.ruler.before(`paragraph`,`math_block`,i,{alt:[`paragraph`,`reference`,`blockquote`,`list`]})}function JS(e){let t=e.renderer.rules.image||function(e,t,n,r,i){let a=e,o=i;return o.renderToken?o.renderToken(a,t,n):``};e.renderer.rules.image=(e,n,r,i,a)=>{let o=e;return o[n].attrSet?.(`loading`,`lazy`),t(o,n,r,i,a)},e.renderer.rules.fence=e.renderer.rules.fence||((t,n)=>{let r=t[n],i=String(r.info??``).trim();return`<pre class="${i?`language-${e.utils.escapeHtml(i.split(/\s+/g)[0])}`:``}"><code>${e.utils.escapeHtml(String(r.content??``))}</code></pre>`})}var YS=/^<a[>\s]/i,XS=/^<\/a\s*>/i;function ZS(e,t){if(e?.type!==`inline`)return!1;let n=e.children;if(!Array.isArray(n)||n.length===0)return t.test(String(e.content??``));let r=0;for(let e=n.length-1;e>=0;e--){let i=n[e];if(i?.type===`link_close`){for(e--;e>=0&&n[e]?.level!==i.level&&n[e]?.type!==`link_open`;)e--;continue}if(i?.type===`html_inline`){let e=String(i.content??``);YS.test(e)&&r>0&&r--,XS.test(e)&&r++}if(!(r>0)&&i?.type===`text`&&t.test(String(i.content??``)))return!0}return!1}function QS(e){let t=e.core?.ruler,n=t.getNamedRules?.().find(e=>e.name===`linkify`)?.fn;typeof n==`function`&&t.at(`linkify`,e=>{if(!e.md?.options?.linkify)return;let t=Array.isArray(e.tokens)?e.tokens:[],r=e.md.linkify;if(!r)return;let i=t.filter(e=>ZS(e,r));if(i.length)return n(Object.assign(Object.create(Object.getPrototypeOf(e)),e,{tokens:i}))})}function $S(e){let t=e.inline.ruler,n=t.getNamedRules?.(),r=n?.find(e=>e.name===`link`)?.fn,i=n?.find(e=>e.name===`image`)?.fn;if(typeof r!=`function`||typeof i!=`function`)return;let a=e.validateLink,o=e;o.__markstreamOriginalValidateLink=a,t.at(`link`,(...e)=>{let t=e[0].md,n=t?.validateLink===a?t.options?.validateLink:t?.validateLink;if(!t||typeof n!=`function`)return r(...e);let i=t.validateLink;t.validateLink=n;try{return r(...e)}finally{t.validateLink=i}}),t.at(`image`,(...e)=>{let t=e[0].md;if(!t)return i(...e);let n=t.validateLink;t.validateLink=a;try{return i(...e)}finally{t.validateLink=n}})}function eC(e={}){let t=e.markdownItOptions??{},n=typeof t.experimental==`object`&&t.experimental!==null?t.experimental:{},r=!Object.prototype.hasOwnProperty.call(t,`stream`)||!!t.stream,i=Object.prototype.hasOwnProperty.call(t,`validateLink`),a={stream:r,...n},o=new wv({html:!0,linkify:!0,typographer:!0,...t,experimental:a}),s=`streamTailLocalPostBlockRules`;if(!(Object.prototype.hasOwnProperty.call(t,s)||Object.prototype.hasOwnProperty.call(n,s))&&Object.prototype.hasOwnProperty.call(o.options,s)&&(o.options[s]=!0),!i){let e=e=>!$v(e,{tagName:`a`,attrName:`href`});Kb(e),o.set({validateLink:e})}return $S(o),QS(o),(e.enableMath??!0)&&qS(o,{...e.mathOptions??{}}),(e.enableContainers??!0)&&oy(o),e.enableFixIndentedCodeBlock!==!1&&Wy(o),ox(o),ux(o),cx(o),mx(o),JS(o),Hy(o,{customHtmlTags:e.customHtmlTags}),o}var tC=new Map;function nC(e,t){let n=t?`${e}:::${t}`:e,r=tC.get(n);if(!r&&(r=new RegExp(e,t),tC.set(n,r),tC.size>200)){let e=Array.from(tC.keys()).slice(0,50);for(let t of e)tC.delete(t)}return r.lastIndex=0,r}var rC=/\S/,iC=/^(?:<!doctype\s+html[^>]*>\s*)?<html(?:\s[^>]*)?>/i,aC=/<\/html>\s*$/i,oC=/^<\s*[!?]/,sC=/^([A-Z][\w:-]*)/i,cC=/\/\s*>$/;function lC(e){let t=e.search(rC);if(t===-1||e.charCodeAt(t)!==60)return null;let n=e.trim();if(!n)return null;let r=iC.test(n),i=aC.test(n);return!r||!i?null:[{type:`html_block`,tag:`html`,raw:e,content:e,loading:!1}]}function uC(e){let t=e.raw;if(typeof t==`string`)return t;let n=e.content;return typeof n==`string`?n:``}function dC(e,t){if(e.type!==`html_block`||!t)return!1;let n=String(e.raw??e.content??``);return nC(String.raw`^\s*<\s*\/\s*${sy(t)}\s*>\s*$`,`i`).test(n)}var fC=new Set([`iframe`,`script`,`style`,`textarea`,`title`]);function pC(e,t,n){if(!e||!t)return null;let r=t.toLowerCase(),i=t=>{if(e.startsWith(`<!--`,t)){let n=e.indexOf(`-->`,t+4);return{closing:!1,end:n===-1?e.length:n+3,selfClosing:!1,tag:``}}if(e.startsWith(`<![CDATA[`,t)){let n=e.indexOf(`]]>`,t+9);return{closing:!1,end:n===-1?e.length:n+3,selfClosing:!1,tag:``}}let n=cy(e,t);if(n===-1)return null;let r=n+1,i=e.slice(t,r);if(oC.test(i))return{closing:!1,end:r,selfClosing:!1,tag:``};let a=i.slice(1).trimStart(),o=a.startsWith(`/`);o&&(a=a.slice(1).trimStart());let s=a.match(sC);return s?.[1]?{closing:o,end:r,selfClosing:cC.test(i),tag:s[1].toLowerCase()}:{closing:!1,end:t+1,selfClosing:!1,tag:``}},a=(t,n)=>{let r=nC(String.raw`<\s*\/\s*${sy(t)}(?=\s|>)`,`gi`);r.lastIndex=n;let a=r.exec(e);if(!a||a.index==null)return null;let o=i(a.index);return o?{start:a.index,end:o.end}:null},o=-1,s=-1,c=Math.max(0,n);for(;c<e.length;){let t=e.indexOf(`<`,c);if(t===-1)return null;let n=i(t);if(!n)return null;if(!n.closing&&n.tag===r){o=t,s=n.end-1;break}if(!n.closing&&fC.has(n.tag)){c=a(n.tag,n.end)?.end??e.length;continue}c=n.end}if(o===-1||s===-1)return null;let l=e.slice(o,s+1);if(Pv.has(r)||cC.test(l))return{raw:l,start:o,end:s+1,closed:!0};if(fC.has(r)){let t=a(r,s+1);return t?{raw:e.slice(o,t.end),start:o,end:t.end,closeStart:t.start,closed:!0}:{raw:e.slice(o),start:o,end:e.length,closed:!1}}let u=1,d=s+1;for(;d<e.length;){let t=e.indexOf(`<`,d);if(t===-1)return{raw:e.slice(o),start:o,end:e.length,closed:!1};let n=i(t);if(!n)return null;if(n.closing&&n.tag===r){u--;let r=n.end;if(u===0)return{raw:e.slice(o,r),start:o,end:r,closeStart:t,closed:!0};d=r;continue}if(!n.closing&&n.tag===r){!n.selfClosing&&!Pv.has(n.tag)&&u++,d=n.end;continue}if(!n.closing&&fC.has(n.tag)){d=a(n.tag,n.end)?.end??e.length;continue}d=n.end}return{raw:e.slice(o),start:o,end:e.length,closed:!1}}function mC(e,t){if(!t)return 0;let n=0,r=0;for(;n<e.length&&r<t.length;){if(e[n]===t[r]){n++,r++;continue}if(e[n]===`\r`||e[n]===`
|
|
101
|
-
`){n++;continue}return-1}return r===t.length?n:-1}function hC(e,t,n){return n?e:`${e.replace(/<[^>]*$/,``)}\n</${t}>`}function gC(e){return e.replace(/\r\n/g,`
|
|
102
|
-
`).replace(/(^|\n)[ \t]{1,4}/g,`$1`)}function _C(e,t,n){return n?e.includes(n,t)?!0:gC(e.slice(Math.max(0,t))).includes(gC(n)):!1}function vC(e,t){let n=Math.max(0,t);for(;n<e.length&&(e[n]===` `||e[n]===` `);)n++;return e[n]===`\r`?(n++,e[n]===`
|
|
103
|
-
`&&n++,n):e[n]===`
|
|
104
|
-
`?n+1:t}function yC(e,t){let n=nC(String.raw`<\s*\/\s*${sy(t)}(?=\s|>)`,`gi`),r=-1,i;for(;(i=n.exec(e))!==null;)r=i.index;return r}var bC=/^\s*(?:<!--|<!|<\?)/,xC=/^\s*<([A-Z][\w:-]*)/i,SC=/\/\s*>$/,CC=/<[^>]*$/;function wC(e,t,n){let r=t.toLowerCase(),i=nC(String.raw`^<\s*${r}(?=\s|>|/)`,`i`),a=nC(String.raw`^<\s*\/\s*${r}(?=\s|>)`,`i`),o=0,s=Math.max(0,n);for(;s<e.length;){let t=e.indexOf(`<`,s);if(t===-1)return-1;let n=e.slice(t);if(a.test(n)){let e=cy(n);if(e===-1)return-1;if(o===0)return t+e+1;o--,s=t+e+1;continue}if(i.test(n)){let e=cy(n);if(e===-1)return-1;let r=n.slice(0,e+1);SC.test(r)||o++,s=t+e+1;continue}s=t+1}return-1}function TC(e){let t=String(e.content??``);if(bC.test(t))return{type:`html_block`,content:t,raw:t,tag:``,loading:!1};let n=(t.match(xC)?.[1]||``).toLowerCase();if(!n)return{type:`html_block`,content:t,raw:t,tag:``,loading:!1};let r=cy(t),i=r===-1?t:t.slice(0,r+1),a=r!==-1&&SC.test(i),o=Pv.has(n),s=ly(i),c=(r===-1?-1:wC(t,n,r+1))!==-1,l=!(o||a||c);return{type:`html_block`,content:l?`${t.replace(CC,``)}\n</${n}>`:t,raw:t,tag:n,attrs:s.length?s:void 0,loading:l}}function EC(e,t,n){let r=Ky(n)?n.sourceLineMapper:void 0;if(!r)return{startLine:e,endLine:t};let i=r(e),a=t>e?r(t-1).endLine:r(t).startLine;return{startLine:i.startLine,endLine:Math.max(i.startLine,a)}}function DC(e,t){let n=Math.max(0,Math.min(e.length,Math.trunc(t))),r=0;for(let t=0;t<n;t++)e[t]===`
|
|
105
|
-
`&&r++;return r}function OC(e,t,n){let r=Math.max(0,Math.min(e.length,Math.trunc(t))),i=Math.max(r,Math.min(e.length,Math.trunc(n))),a=DC(e,r),o=DC(e,i);return i>r&&e[i-1]!==`
|
|
106
|
-
`&&o++,{startLine:a,endLine:o}}function kC(e,t,n,r){let i=OC(e,t,n);return EC(i.startLine,i.endLine,r)}function AC(e,t){let n=e?.map;if(!Array.isArray(n)||n.length<2)return null;let r=Number(n[0]),i=Number(n[1]);return!Number.isFinite(r)||!Number.isFinite(i)?null:EC(r,i,t)}function jC(e,t,n){if(!n?.includeSourceMap)return e;let r=AC(t,n);if(!r)return e;if(e.sourceMap=r,e.type===`code_block`){let t=e;t.startLine=r.startLine,t.endLine=r.endLine}return e}function MC(e,t,n,r){if(!r?.includeSourceMap)return e;let i=t?.map;if(!Array.isArray(i)||i.length<2)return e;let a=Number(i[0]),o=Number(i[1]),s=Number(n);return!Number.isFinite(a)||!Number.isFinite(o)||!Number.isFinite(s)||(e.sourceMap=EC(a,Math.max(o,s),r)),e}function NC(e){let t=Object.assign(Object.create(Object.getPrototypeOf(e)),e);return Array.isArray(e.attrs)&&(t.attrs=e.attrs.map(e=>[...e])),Array.isArray(e.map)&&(t.map=[...e.map]),Array.isArray(e.children)&&(t.children=e.children.map(e=>NC(e))),t}function PC(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function FC(e,t,n){for(let r of Reflect.ownKeys(e)){let i=Object.getOwnPropertyDescriptor(e,r);if(!i||!(`value`in i))continue;let a=Object.getOwnPropertyDescriptor(t,r);(!a||`value`in a&&a.writable!==!1)&&(t[r]=IC(i.value,n))}}function IC(e,t=new WeakMap){if(!e||typeof e!=`object`)return e;let n=e,r=t.get(n);if(r)return r;if(Array.isArray(e)){let r=[];t.set(n,r);for(let n of e)r.push(IC(n,t));return r}if(e instanceof Map){let r=new Map;t.set(n,r);for(let[n,i]of e)r.set(IC(n,t),IC(i,t));return r}if(e instanceof Set){let r=new Set;t.set(n,r);for(let n of e)r.add(IC(n,t));return r}if(e instanceof Date){let r=new Date(e.getTime());return t.set(n,r),r}if(e instanceof RegExp){let r=new RegExp(e.source,e.flags);return r.lastIndex=e.lastIndex,t.set(n,r),r}if(typeof URL<`u`&&e instanceof URL){let r=new URL(e.href);return t.set(n,r),FC(n,r,t),r}if(typeof URLSearchParams<`u`&&e instanceof URLSearchParams){let r=new URLSearchParams(e.toString());return t.set(n,r),FC(n,r,t),r}if(e instanceof Error){let r,i=e.constructor;try{r=new i(e.message)}catch{r=Error(e.message)}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),t.set(n,r),FC(n,r,t),r}if(typeof Promise<`u`&&e instanceof Promise||typeof Node<`u`&&e instanceof Node)return t.set(n,e),e;if(!PC(e)){let r=Object.create(Object.getPrototypeOf(e));return t.set(n,r),FC(n,r,t),r}let i={};t.set(n,i);let a=e;for(let e of Object.keys(a))i[e]=IC(a[e],t);return i}function LC(e,t){for(let n=0;n<t.length;n++){let r=Object.getOwnPropertyDescriptor(e,t[n]);if(t[n]===`__proto__`||!r||!(`value`in r)||r.writable!==!0||r.configurable!==!0)return!1}return!0}function RC(e,t=!0){if(!t)return NC(e);let n=Reflect.ownKeys(e),r=Object.keys(e);if(n.length===r.length&&LC(e,r))try{return zC(e,r,t)}catch{return BC(e,t)}return BC(e,t)}function zC(e,t,n){let r=Object.getPrototypeOf(e),i={},a=new WeakMap,o=e.children,s=e.attrs,c=e.map,l=e;for(let e=0;e<t.length;e++){let r=t[e],u=l[r];if(r===`children`&&Array.isArray(o)){let e=Array(o.length);for(let t=0;t<o.length;t++)e[t]=RC(o[t],n);i[r]=e}else if(r===`attrs`&&Array.isArray(s)){let e=Array(s.length);for(let t=0;t<s.length;t++){let n=s[t];e[t]=[n[0],n[1]]}i[r]=e}else i[r]=r===`map`&&Array.isArray(c)?[c[0],c[1]]:n&&u&&typeof u==`object`?IC(u,a):u}return Object.setPrototypeOf(i,r),i}function BC(e,t=!0){let n=Object.create(Object.getPrototypeOf(e)),r=new WeakMap;for(let i of Reflect.ownKeys(e)){let a=Object.getOwnPropertyDescriptor(e,i);if(!a)continue;if(!(`value`in a)){Object.defineProperty(n,i,a);continue}let o=a.value,s=o;i===`attrs`&&Array.isArray(o)?s=o.map(e=>[...e]):i===`map`&&Array.isArray(o)?s=[...o]:i===`children`&&Array.isArray(o)?s=o.map(e=>RC(e,t)):t&&o&&typeof o==`object`&&(s=IC(o,r)),Object.defineProperty(n,i,{...a,value:s})}return n}function VC(e,t=!0){return e.map(e=>RC(e,t))}function HC(e,t){let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function UC(e){return e===` `||e===` `}function WC(e,t){return t===` `?e+1:e+4-e%4}function GC(e){let t=0,n=0;for(;t<e.length&&UC(e[t]);)n=WC(n,e[t]),t++;return{index:t,column:n}}function KC(e){let t=GC(e);return t.column>3?null:t}function qC(e){let t=KC(e);if(!t)return null;let n=t.index,r=e[n];if(r!=="`"&&r!==`~`)return null;let i=n;for(;i<e.length&&e[i]===r;)i++;let a=i-n;if(a<3)return null;let o=e.slice(i);return r==="`"&&o.includes("`")?null:{markerChar:r,markerLen:a,rest:o}}function JC(e){let t=KC(e);if(!t)return null;let n=e.slice(t.index),r=/^(?:[-+*]|\d{1,9}[.)])(?=[\t ]|$)/.exec(n)?.[0];if(!r)return null;let i=t.index+r.length,a=t.column+r.length;if(!UC(e[i]))return null;for(;i<e.length&&UC(e[i]);)a=WC(a,e[i]),i++;return{content:e.slice(i),contentIndent:a}}function YC(e){let t=e,n=!1;for(;;){let e=KC(t);if(!e)return n?t:null;let r=e.index;if(t[r]!==`>`)return n?t:null;n=!0,r++,(t[r]===` `||t[r]===` `)&&r++,t=t.slice(r)}}function XC(e){let t=qC(e);if(t)return{...t,inBlockquote:!1,inList:!1,listIndent:0};let n=YC(e),r=n==null?null:qC(n);if(r)return{...r,inBlockquote:!0,inList:!1,listIndent:0};let i=JC(e);if(!i)return null;let a=qC(i.content);return a==null?null:{...a,inBlockquote:!1,inList:!0,listIndent:i.contentIndent}}function ZC(e,t,n){let r=t;for(;r<e.length&&e[r]===n;)r++;return r-t}function QC(e,t,n){let r=t;for(;r<e.length;){let t=e.indexOf("`",r);if(t===-1)return-1;let i=ZC(e,t,"`");if(i===n)return t;r=t+i}return-1}var $C=[`$`,`\\[`],ew=/(^|\r?\n)[\t ]*:::[\t ]*(?:warning|info|note|tip|danger|caution|error)(?=[\t ]|\r?\n|$)[^\r\n]*(?:\r?\n[\t ]*)*$/;function tw(){return{fenceChar:``,fenceInBlockquote:!1,fenceInList:!1,fenceLen:0,fenceListIndent:0,inDollarMath:!1,inFence:!1,inMath:!1,listContentIndent:null,dollarMathOpenOffset:null,mathOpenOffset:null}}function nw(e){return{...e}}function rw(e,t,n,r=hw(t).state,i={lineOffset:0,windowStart:0}){e.tolerantMathBoundary={explicitBracketMath:r,source:t,key:n,pendingCandidate:n===null&&HS(t,i),scanWindow:i}}function iw(e){return e.endsWith(`$`)||e.endsWith(`\\`)}function aw(e){let t=Math.max(e.lastIndexOf(`
|
|
107
|
-
`)+1,0),n=e.slice(t).replace(/[\t ]+$/,``);return $C.some(e=>n.endsWith(e))}function ow(e,t){return t?!!(t.includes(`$$`)||t.includes(`\\[`)||e.endsWith(`$`)&&t[0]===`$`||e.endsWith(`\\`)&&t[0]===`[`||aw(e)&&/[\r\n]/.test(t)):!1}function sw(e,t){let n=!1,r=``,i=0,a=!1,o=!1,s=0,c=null,l=0;for(;l<t;){let u=e.indexOf(`
|
|
108
|
-
`,l),d=u===-1||u>=t?t:u,f=e.slice(l,d),p=f.endsWith(`\r`)?f.slice(0,-1):f,m=GC(p),h=JC(p);n&&a&&p.trim()&&YC(p)==null&&(n=!1,r=``,i=0,a=!1,o=!1,s=0),n&&o&&p.trim()&&m.column<s&&!h&&(n=!1,r=``,i=0,a=!1,o=!1,s=0),h?c=h.contentIndent:p.trim()&&c!=null&&m.column<c&&!n&&(c=null);let g=XC(p);if(g&&(n?g.markerChar===r&&g.markerLen>=i&&/^\s*$/.test(g.rest)&&(n=!1,r=``,i=0,a=!1,o=!1,s=0):(n=!0,r=g.markerChar,i=g.markerLen,a=g.inBlockquote,o=g.inList||c!=null&&!g.inBlockquote&&m.column>=c,s=g.listIndent||c||0)),u===-1||u>=t)break;l=u+1}return n}function cw(e,t){let n=e=>e===` `||e===` `,r=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},i=e=>{if(e[0]!==`<`)return null;let t=1;for(;t<e.length&&n(e[t]);)t++;let i=e[t]===`/`;if(i)for(t++;t<e.length&&n(e[t]);)t++;let a=t;for(;t<e.length&&r(e[t]);)t++;if(t===a)return null;let o=e.slice(a,t).toLowerCase();if(!Fv.has(o))return null;let s=e[t];if(s&&s!==` `&&s!==` `&&s!==`>`&&s!==`/`)return null;let c=cy(e);if(c===-1)return null;let l=c-1;for(;l>=0&&n(e[l]);)l--;return{closing:i,tag:o,selfClosing:!i&&e[l]===`/`,after:e.slice(c+1)}},a=(e,t)=>{let r=e.toLowerCase(),i=0;for(;i<r.length;){let e=r.indexOf(`</`,i);if(e===-1)return!1;for(i=e+2;i<r.length&&n(r[i]);)i++;if(r.startsWith(t,i)){let e=r[i+t.length];if(!e||e===` `||e===` `||e===`>`)return!0}}return!1},o=[],s=!1,c=!1,l=!1,u=0;for(;u<t;){let n=e.indexOf(`
|
|
109
|
-
`,u),r=n===-1||n>=t?t:n,d=e.slice(u,r),f=d.endsWith(`\r`)?d.slice(0,-1):d,p=KC(f);if(p){let e=f.slice(p.index);if(s)s=!e.includes(`-->`);else if(c)c=!e.includes(`>`);else if(l)l=!e.includes(`?>`);else if(e.startsWith(`<!--`))s=!e.includes(`-->`);else if(e.startsWith(`<?`))l=!e.includes(`?>`);else if(e.startsWith(`<!`))c=!e.includes(`>`);else{let t=i(e);if(t){if(t.closing){for(let e=o.length-1;e>=0;e--)if(o[e]===t.tag){o.length=e;break}}else t.selfClosing||a(t.after,t.tag)||o.push(t.tag)}}}if(n===-1||n>=t)break;u=n+1}return s||c||l||o.length>0}function lw(e,t,n){if(!n?.length)return!1;let r=new Set(py(n));if(!r.size)return!1;let i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},a=e=>e===` `||e===` `,o=e=>{if(e[0]!==`<`)return null;let t=1;for(;t<e.length&&a(e[t]);)t++;let n=e[t]===`/`;if(n)for(t++;t<e.length&&a(e[t]);)t++;let o=t;for(;t<e.length&&i(e[t]);)t++;if(t===o)return null;let s=e.slice(o,t).toLowerCase();if(!r.has(s))return null;let c=e[t];if(c&&c!==` `&&c!==` `&&c!==`>`&&c!==`/`)return null;let l=e.indexOf(`>`,t);if(l===-1)return null;let u=l-1;for(;u>=0&&a(e[u]);)u--;return{closing:n,tag:s,selfClosing:!n&&e[u]===`/`,after:e.slice(l+1)}},s=(e,t)=>{let n=e.toLowerCase(),r=0;for(;r<n.length;){let e=n.indexOf(`</`,r);if(e===-1)return!1;for(r=e+2;r<n.length&&a(n[r]);)r++;if(n.startsWith(t,r)){let e=n[r+t.length];if(!e||e===` `||e===` `||e===`>`)return!0}}return!1},c=[],l=0;for(;l<t;){let n=e.indexOf(`
|
|
110
|
-
`,l),r=n===-1||n>=t?t:n,i=e.slice(l,r),a=i.endsWith(`\r`)?i.slice(0,-1):i,u=KC(a);if(u){let e=o(a.slice(u.index));if(e){if(e.closing){for(let t=c.length-1;t>=0;t--)if(c[t]===e.tag){c.length=t;break}}else e.selfClosing||s(e.after,e.tag)||c.push(e.tag)}}if(n===-1||n>=t)break;l=n+1}return c.length>0}function uw(e,t){let n=ew.exec(e);if(!n)return null;let r=n[1]??``,i=n.index+r.length,a=e.indexOf(`
|
|
111
|
-
`,i),o=e.slice(i,a===-1?e.length:a);return!KC(o.endsWith(`\r`)?o.slice(0,-1):o)||sw(e,i)||cw(e,i)||lw(e,i,t)?null:`${e.slice(0,n.index)}${r}`}function dw(e){e.inFence=!1,e.fenceChar=``,e.fenceLen=0,e.fenceInBlockquote=!1,e.fenceInList=!1,e.fenceListIndent=0}function fw(e,t,n,r,i){let a=0,o=!1;for(;a<e.length;){let s=a;if(t.inMath){if(e.startsWith(`\\]`,a)&&!HC(e,s)){r!=null&&i&&n+a+2>r&&(o=!0),t.inMath=!1,t.mathOpenOffset=null,a+=2;continue}a++;continue}if(t.inDollarMath){if(e.startsWith(`$$`,a)&&!HC(e,s)){r!=null&&i&&n+a+2>r&&(o=!0),t.inDollarMath=!1,t.dollarMathOpenOffset=null,a+=2;continue}a++;continue}if(e[a]==="`"&&!HC(e,s)){let t=ZC(e,a,"`"),n=QC(e,a+t,t);if(n===-1)break;a=n+t;continue}if(e.startsWith(`\\[`,a)&&!HC(e,s)){t.inMath=!0,t.mathOpenOffset=n+a,a+=2;continue}if(e.startsWith(`$$`,a)&&!HC(e,s)){t.inDollarMath=!0,t.dollarMathOpenOffset=n+a,a+=2;continue}a++}return o}function pw(e,t,n=!0){let r=t.markdownIt;if(!Jx(r))return e;let i=n?t.pendingExplicitMathTail:void 0,a=i?.source===e?i.state:i&&t.sourceExtends(i.source,e)?gw(i.state,e.slice(i.source.length),i.source.length-i.state.lineBuffer.length).state:hw(e).state;n&&(t.pendingExplicitMathTail={source:e,state:a});let{context:o}=a,s=o.inMath?o.mathOpenOffset:o.inDollarMath?o.dollarMathOpenOffset:null;if(s==null)return e;let c=e.slice(s+2),l=e.lastIndexOf(`
|
|
112
|
-
`,s-1)+1;if(e.slice(l,s).trim()!==``&&!/^\r?\n/.test(c)||/^\s*!\[/.test(c))return e;let u=c.trim(),d=/^(?:[a-z]|pi)$/i.test(u);return Ux(c)&&!d?e:e.slice(0,s)}function mw(e,t,n,r,i){let a=GC(e),o=JC(e);if(t.inFence&&t.fenceInBlockquote&&e.trim()&&YC(e)==null&&dw(t),t.inFence&&t.fenceInList&&e.trim()&&a.column<t.fenceListIndent&&!o&&dw(t),o?t.listContentIndent=o.contentIndent:e.trim()&&t.listContentIndent!=null&&a.column<t.listContentIndent&&!t.inFence&&(t.listContentIndent=null),!t.inMath&&!t.inDollarMath){let o=XC(e);if(o)t.inFence?o.markerChar===t.fenceChar&&o.markerLen>=t.fenceLen&&/^\s*$/.test(o.rest)&&dw(t):(t.inFence=!0,t.fenceChar=o.markerChar,t.fenceLen=o.markerLen,t.fenceInBlockquote=o.inBlockquote,t.fenceInList=o.inList||t.listContentIndent!=null&&!o.inBlockquote&&a.column>=t.listContentIndent,t.fenceListIndent=o.listIndent||t.listContentIndent||0);else if(!t.inFence)return fw(e,t,n,r,i)}else return fw(e,t,n,r,i);return!1}function hw(e,t=tw(),n=null,r=!1,i=0){let a=nw(t),o=nw(t),s=``,c=!1,l=0;for(;l<e.length;){let t=e.indexOf(`
|
|
113
|
-
`,l),u=t!==-1,d=u&&t>l&&e[t-1]===`\r`?t-1:u?t:e.length,f=e.slice(l,d);mw(f,a,i+l,n,r)&&(c=!0),u?(o=nw(a),s=``):s=f,l=u?t+1:e.length}return{closedOpenMath:c,state:{committedContext:o,context:a,lineBuffer:s}}}function gw(e,t,n=0){return t&&!e.context.inMath&&!e.context.inDollarMath&&!e.context.inFence&&!e.committedContext.inFence&&!/[\\$`~\r\n]/.test(t)&&(!e.lineBuffer.endsWith(`\\`)||t[0]!==`[`&&t[0]!==`]`)?{closedOpenMath:!1,state:{committedContext:nw(e.committedContext),context:nw(e.context),lineBuffer:e.lineBuffer+t}}:hw(e.lineBuffer+t,e.committedContext,n+e.lineBuffer.length,e.context.inMath||e.context.inDollarMath,n)}function _w(e,t){let n=e.markdownIt;if(!Jx(n)||typeof n.stream?.reset!=`function`)return;let r=e.tolerantMathBoundary;if(r?.source===t)return;let i=r?e.sourceExtends(r.source,t):!1,a=i&&r?t.slice(r.source.length):``,o=i&&r?gw(r.explicitBracketMath,a,r.source.length-r.explicitBracketMath.lineBuffer.length):hw(t),s=o.state,c=i&&r?o.closedOpenMath:!1;if(r&&i&&r.key===null&&r.pendingCandidate===!1&&!c&&!ow(r.source,a)&&!iw(t)){r.source=t,r.explicitBracketMath=s;return}let l=i&&r?r.scanWindow:{lineOffset:0,windowStart:0},u=US(t,l);(r&&(r&&!i||r.key!==u||c)||!r&&u)&&e.resetStreamOnly(),rw(e,t,u,s,l)}function vw(e){let t=e.tolerantMathBoundary;return typeof t?.key==`string`&&t.key.startsWith(`pending:`)}function yw(e){let t=!1,n=``,r=0,i=!1,a=!1,o=!1,s=0,c=(e,s)=>{let c=XC(e);if(c){t?c.markerChar===n&&c.markerLen>=r&&/^\s*$/.test(c.rest)&&(t=!1,n=``,r=0):(t=!0,n=c.markerChar,r=c.markerLen);return}if(t)return;let l=0;for(;l<e.length;){if(i){e.startsWith(`$$`,l)&&!HC(e,l)?(i=!1,l+=2):l++;continue}if(a){e.startsWith(`\\]`,l)&&!HC(e,l)?(a=!1,l+=2):l++;continue}let t=e[l];if(t==="`"){let t=ZC(e,l,"`"),n=QC(e,l+t,t);if(n===-1)break;l=n+t;continue}if(t===`\\`){let t=e[l+1];t===`[`&&!HC(e,l)?(a=!0,l+=2):(t===`]`&&HC(e,l),l+=2);continue}if(t===`$`){if(e[l+1]===`$`&&!HC(e,l)){i=!0,o=!1,l+=2;continue}if(o){o=!1,l++;continue}let t=e[l+1];(t===void 0||t!==` `&&t!==` `&&!/\d/.test(t))&&(o=!0),l++;continue}l++}};return{scanTo:t=>{for(;s<t;){let n=e.indexOf(`
|
|
114
|
-
`,s),r=n===-1||n>=t?t:n,i=r>s&&e[r-1]===`\r`?r-1:r;if(c(e.slice(s,i),s),n===-1||n>=t){s=t;break}o=!1,s=n+1}},inMath:()=>i||a||o}}function bw(){return typeof performance<`u`?performance.now():Date.now()}function xw(e,t){let n=t.__markstreamFinal===!0?`final`:`streaming`,r=e.streamParseEnvs.get(n);r||(r={},e.streamParseEnvs.set(n,r));for(let e of Object.keys(r))Object.prototype.hasOwnProperty.call(t,e)||delete r[e];return Object.assign(r,t),r}function Sw(e,t){let n=e.markdownIt,r=n.stream,i=t.streamParse??`auto`;return t.disableStreamParse!==!0&&n.__markstreamHasCustomParserExtensions===!1&&(i===!0||i===`auto`&&t.final!==!0)&&r?.enabled===!0&&typeof r.parse==`function`}function Cw(e,t){let n=e.markdownIt,r=t.streamParse??`auto`,i=n.stream;return t.final===!0&&r===`auto`&&t.disableStreamParse!==!0&&n.__markstreamHasCustomParserExtensions===!1&&i?.enabled===!0&&typeof i.reset==`function`}function ww(e,t){return Cw(e,t)?(e.resetForFinalAutoParse(),!0):!1}function Tw(e){return typeof e.preTransformTokens==`function`||typeof e.postTransformTokens==`function`}function Ew(e,t){let n=e?.map,r=t?.map;return n===r?!0:!Array.isArray(n)||!Array.isArray(r)?!1:n.length===r.length&&n.every((e,t)=>e===r[t])}function Dw(e,t){return!!e&&!!t&&e.type===t.type&&e.tag===t.tag&&e.nesting===t.nesting&&e.markup===t.markup&&e.content===t.content&&Ew(e,t)}function Ow(e,t){return e[t]?.type===`paragraph_open`&&e[t+1]?.type===`inline`&&e[t+2]?.type===`paragraph_close`}function kw(e){for(let t=0;t+5<e.length;t++)if(Ow(e,t)&&Ow(e,t+3)&&Dw(e[t],e[t+3])&&Dw(e[t+1],e[t+4])&&Dw(e[t+2],e[t+5]))return!0;return!1}function Aw(e,t,n){return Jx(e)&&HS(t)&&kw(n)}function jw(e){return e.topLevelStreamParseMode}function Mw(e,t,n,r,i){let a=e.markdownIt;if(r.customHtmlTags?.length&&(n.__markstreamCustomHtmlTags=r.customHtmlTags),!Sw(e,r))return r.isFragment||(e.topLevelStreamParseMode=`sync`),a.parse(t,n);if(_w(e,t),vw(e))return e.topLevelStreamParseMode=`sync`,a.parse(t,n);e.markStreamParseStarted();let o=a.stream.parse(t,xw(e,n));if(Aw(a,t,o))return e.resetStreamOnly(),e.topLevelStreamParseMode=`sync`,a.parse(t,n);if(e.topLevelStreamParseMode=a.stream?.stats?.()?.lastMode??`stream`,!Tw(r))return o;if(!i?.recordTokenCloneMs)return VC(o,!0);let s=bw(),c=VC(o,!0);return i.recordTokenCloneMs(bw()-s),c}var Nw=new Set([`code_inline`,`em_close`,`em_open`,`emoji`,`hardbreak`,`html_block`,`html_inline`,`image`,`ins_close`,`ins_open`,`link`,`link_close`,`link_open`,`mark_close`,`mark_open`,`math_inline`,`s_close`,`s_open`,`softbreak`,`strong_close`,`strong_open`,`sub`,`sup`,`text`]),Pw=new Map([[`paragraph_open`,`paragraph_close`],[`heading_open`,`heading_close`],[`bullet_list_open`,`bullet_list_close`],[`ordered_list_open`,`ordered_list_close`],[`blockquote_open`,`blockquote_close`],[`table_open`,`table_close`]]),Fw=new Set([`code_block`,`fence`,`hr`,`html_block`,`inline`,`math_block`]);function Iw(e,t){return e.every(e=>{if(!Nw.has(e.type)||(e.type===`link`||e.type===`link_open`||e.type===`link_close`)&&!qb(t))return!1;if(e.type===`link`){let t=Gb(e);if(t!==`explicit`&&t!==`linkify`&&t!==`autolink`)return!1}if(e.type===`link_open`||e.type===`link_close`){let t=e.markup??``;if(t!==``&&t!==`linkify`&&t!==`autolink`)return!1}let n=e.children;return!Array.isArray(n)||Iw(n,t)})}function Lw(e){let t=Pw.get(e);if(t)return t;let n=/^container_(.+)_open$/.exec(e);return n?`container_${n[1]}_close`:void 0}function Rw(e,t,n=0){let r=[],i=!1,a=n;for(;a<e.length;){let n=e[a];if(!n||n.level!==0)return null;let o=Lw(n.type),s=a+1;if(o){if(n.nesting!==1)return null;for(;s<e.length;){let t=e[s];if(t.level===0){if(t.type!==o||t.nesting!==-1)return null;s++;break}s++}if(e[s-1]?.type!==o)return null;if(n.type===`paragraph_open`||n.type===`heading_open`){if(s!==a+3||e[a+1]?.type!==`inline`)return null}else i=!0}else if(Fw.has(n.type)){if(n.nesting!==0)return null;i=!0}else return null;for(let n=a;n<s;n++){let r=e[n];if(r.type!==`inline`)continue;let i=r.children;if(!Array.isArray(i)||!Iw(i,t))return null}r.push(a),a=s}return{mixed:i,starts:r}}function zw(e){return/\r?\n[\t ]*\r?\n[\t ]*$/.test(e)}function Bw(e){return e.reuseStableTopLevelNodes===!0&&e.final!==!0&&!e.preTransformTokens&&!e.postTransformTokens&&!e.postTransformNodes&&!e.customHtmlTags?.length&&e.includeSourceMap!==!0}function Vw(e,t){let n=e?.map,r=t?.map;return n===r?!0:!Array.isArray(n)||!Array.isArray(r)?!1:n.length===r.length&&n.every((e,t)=>e===r[t])}function Hw(e,t){let n=e?.attrs,r=t?.attrs;if(n===r)return!0;if(!Array.isArray(n)||!Array.isArray(r)||n.length!==r.length)return!1;for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(t[0]!==i[0]||t[1]!==i[1])return!1}return!0}function Uw(e,t){return!!e&&!!t&&e.type===t.type&&e.tag===t.tag&&e.nesting===t.nesting&&e.level===t.level&&e.markup===t.markup&&e.content===t.content&&e.info===t.info&&Vw(e,t)&&Hw(e,t)}function Ww(e,t,n,r,i,a,o,s=0,c){let l=r.starts;if(l.length===0||i.length!==l.length){e.structuredStream=void 0;return}let u=l.map((e,t)=>{let r=l[t+1]??n.length;return{firstToken:n[e],lastToken:n[r-1],tokenCount:r-e}}),d=r.mixed?Math.max(0,l.length-1):zw(t)?l.length:Math.max(0,l.length-1),f=d-s-1,p=f>=0?o?.[f]:c;e.structuredStream={groupBoundaries:u,groupStarts:l,tokenCount:n.length,tokens:n,mixed:r.mixed,source:t,nodes:i,linkifyDemotionContext:p,stableGroupCount:d,requireClosingStrong:a.requireClosingStrong,validateLink:a.validateLink}}function Gw(e,t,n,r){if(e.tokens===t)return!0;let i=n.length-1;for(let a=0;a<r;a++){let r=n[a],o=n[a+1]??t.length,s=e.groupBoundaries[a];if(!s||s.tokenCount!==o-r||(s.firstToken!==t[r]||s.lastToken!==t[o-1])&&(a>=i||!Uw(s.firstToken,t[r])||!Uw(s.lastToken,t[o-1])))return!1}return!0}function Kw(e,t,n,r,i){let a=r.disableStructuredReuse,o=Sw(e,r)&&Bw(r);if(r.isFragment||(e.structuredReuseTailStart=void 0),!o)return a||(e.structuredStream=void 0),i.processTokens(n,r);if(a)return i.processTokens(n,r);let s=e.structuredStream,c=jw(e),l=!!s&&(c===`append`||c===`tail`)&&s.tokenCount!==void 0&&s.tokenCount<=n.length&&n===s.tokens,u;if(l){let e=Rw(n,r.validateLink,s.tokenCount);u=e?{starts:s.groupStarts.concat(e.starts),mixed:s.mixed||e.mixed}:Rw(n,r.validateLink)}else u=Rw(n,r.validateLink);if(!u)return e.structuredStream=void 0,i.processTokens(n,r);let d=u.starts,f=s&&u.mixed?Math.min(s.stableGroupCount,Math.max(0,s.groupBoundaries.length-1)):s?.stableGroupCount??0;if(s&&f>0&&s.requireClosingStrong===r.requireClosingStrong&&s.validateLink===r.validateLink&&e.sourceExtends(s.source,t)&&d.length>=f&&(c===`append`||c===`tail`)&&Gw(s,n,d,f)){let a=d[f]??n.length,o={...r,linkifyDemotionSeedContext:s.linkifyDemotionContext},c=i.processTokens(n.slice(a),o),l=d.length-f;if(c.length===l){let a=s.nodes.slice(0,f).concat(c);return e.structuredReuseTailStart=f,i.recordReusedTopLevelNodes?.(f),Ww(e,t,n,u,a,r,o.linkifyDemotionResultContexts,f,s.linkifyDemotionContext),a}}let p=i.processTokens(n,r);return Ww(e,t,n,u,p,r,r.linkifyDemotionResultContexts),p}function qw(e){if(e.type!==`html_block`||String(e.tag??``).toLowerCase()!==`details`)return!1;let t=String(e.raw??e.content??``);return/^\s*<details\b/i.test(t)}function Jw(e){if(e.type!==`html_block`)return!1;let t=String(e.raw??e.content??``);return/^\s*<\/details\b/i.test(t)}function Yw(e,t){return Yy(e,{final:t,requireClosingStrong:e.requireClosingStrong,customHtmlTags:e.customHtmlTags,validateLink:e.validateLink},{disableStreamParse:!0,disableStructuredReuse:!0,isFragment:!0})}var Xw=new Set([`admonition`,`blockquote`,`code_block`,`definition_list`,`footnote`,`heading`,`list`,`math_block`,`table`,`thematic_break`]),Zw=/(?:^|\n)\s{0,3}(?:#{1,6}\s+\S|[-+*]\s+\S|\d+[.)]\s+\S|>\s*\S|`{3,}|~{3,}|(?:\*{3,}|-{3,}|_{3,})(?:\s|$)|\|.*\|)/m,Qw=/(?:^|\n)(?: {4}|\t)(?![ \t]*<)\S/m;function $w(e){return/\n\s*\n/.test(e)||Zw.test(e)||Qw.test(e)}function eT(e){if(e.length===0)return!1;if(e.some(e=>Xw.has(String(e?.type??``).toLowerCase()))||e.some(e=>{if(e?.type!==`html_block`)return!1;let t=e;return Array.isArray(t.children)&&t.children.length>0})||e.length>1)return!0;let[t]=e;return!!(t&&t.type===`paragraph`)}function tT(e){let t=[],n=0;for(;n<e.length;){for(;/\s/.test(e[n]??``);)n++;if(n>=e.length)break;let r=e.slice(n).match(/^<([A-Z][\w:-]*)/i);if(!r?.[1])return null;let i=pC(e,r[1],n);if(!i||i.start!==n)return null;t.push(i.raw),n=i.end}return t.length>1?t:null}function nT(e,t,n){return e.trim()?t.parseFragment(e,n):[]}function rT(e,t,n,r,i){let a=n.customHtmlTags?.join(`\0`)??``,o=n.runtime,s=i?o?.siblingHtmlChildren:void 0,c=s&&s.final===r&&s.customHtmlTags===a&&s.requireClosingStrong===n.requireClosingStrong&&s.validateLink===n.validateLink,l=e.map((e,r)=>c&&s.blocks[r]===e?s.children[r]:nT(e,t,n));return i&&o&&(o.siblingHtmlChildren={blocks:e,children:l,customHtmlTags:a,final:r,requireClosingStrong:n.requireClosingStrong,validateLink:n.validateLink}),l.flat()}function iT(e,t,n,r){return e.map(e=>{if(e?.type!==`html_block`)return e;let i=e,a=String(i.tag??``).toLowerCase();if(!a||a===`details`||Bv.has(a)||Array.isArray(i.children))return e;let o=String(e.raw??i.content??``);if(!o)return e;let s=cy(o);if(s===-1)return e;let c=pC(o,a,0),l=c?.closeStart??-1,u=c?.closed===!0&&l>=s+1,d=u?o.slice(s+1,l):o.slice(s+1);if(!d.trim()||!$w(d))return e;let f=Yw(n,r),p=u?null:tT(d),m=!n.isFragment&&typeof n.preTransformTokens!=`function`&&typeof n.postTransformTokens!=`function`&&typeof n.postTransformNodes!=`function`&&t.markdownIt.__markstreamHasCustomParserExtensions===!1&&qb(n.validateLink),h=p?rT(p,t,f,r,m):nT(d,t,f);return eT(h)&&(i.children=h),e})}function aT(e,t=0){for(let n=t;n<e.length;n++)if(e[n]?.type===`html_block`)return!0;return!1}function oT(e,t,n){let r=nT(e,t,n),i=r[0];return r.length===1&&i?.type===`paragraph`&&Array.isArray(i.children)?i.children:r}function sT(e,t,n){let r=TC({content:e}),i=cy(e),a=yC(e,`summary`);if(i!==-1&&a!==-1&&a>=i+1){let o=oT(e.slice(i+1,a),t,n);o.length>0&&(r.children=o)}return r.raw=e,r}function cT(e,t,n){let r=cy(e);if(r===-1)return[];let i=e.slice(r+1);if(!i.trim())return[];let a=pC(i,`summary`,0);if(!a)return nT(i,t,n);let o=i.slice(0,a.start),s=i.slice(a.end);return[...nT(o,t,n),sT(a.raw,t,n),...nT(s,t,n)]}function lT(e,t,n,r,i,a=0){let o=[],s=a;for(let a=0;a<e.length;a++){let c=e[a],l=uC(c),u=-1;if(l&&(u=t.indexOf(l,s),u!==-1&&(s=u+l.length)),!qw(c)){o.push(c);continue}let d=String(c.raw??uC(c)??``),f=u===-1?t.indexOf(d,Math.max(0,s-d.length)):u;if(f===-1){o.push(c);continue}let p=1,m=-1;for(let t=a+1;t<e.length;t++){let n=e[t];if(qw(n)){p++;continue}if(Jw(n)&&(p--,p===0)){m=t;break}}let h=pC(t,`details`,f),g=m===-1&&h?.closed===!0,_=g?(()=>{let e=yC(d,`details`);return e===-1?d:d.slice(0,e)})():d,v=m===-1?`</details>`:String(e[m].raw??uC(e[m])??`</details>`),y=g||m!==-1&&h?.closed===!0,b=v.replace(/[\t\r\n ]+$/,``),x=y?(()=>{let e=(h?.raw??``).lastIndexOf(b);return e===-1?t.length:f+e})():t.length,S=cy(d),C=S===-1?f+d.length:f+S+1,w=t.slice(C,x===-1?t.length:x),T=x+b.length,E=y?Math.max(x+v.length,vC(t,T)):t.length,D=y?t.slice(x,E):v,O=y?t.slice(f,E):t.slice(f),k=Bw(r)&&(r.runtime?.structuredReuseTailStart??0)>0?r.runtime?.detailsStitchCache:void 0,A=k?.get(c);if(A&&A.openRaw===d&&A.explicitClose===y&&A.closeSliceEnd===E&&A.middleSource===w){if(o.push(A.node),s=y?E:t.length,m===-1&&!g)break;m!==-1&&(a=m);continue}let[j]=lT(g?[]:m===-1?e.slice(a+1):e.slice(a+1,m),t,n,r,i,f+d.length),ee=cT(_,n,Yw(r,i)),te=j,M=j[0];if(!ee.some(e=>{let t=e;return t?.type===`html_block`&&String(t.tag??``).toLowerCase()===`summary`})){if(M?.type===`html_block`&&String(M.tag??``).toLowerCase()===`summary`&&!Array.isArray(M.children))te=[sT(String(M.raw??M.content??``),n,Yw(r,i)),...j.slice(1)];else if(S!==-1){let e=pC(t,`summary`,f+S+1);if(e&&e.closed){let a=t.slice(f+S+1,e.start);/^[\t \r\n]*$/.test(a)&&(ee=[sT(e.raw,n,Yw(r,i)),...ee])}}}let N=n.markdownIt.parse(w,{__markstreamFinal:i}),P=n.markdownIt.renderer.render(N,n.markdownIt.options,{__markstreamFinal:i}),F=S===-1?d:t.slice(f,f+S+1),I={...c,tag:`details`,attrs:ly(d.slice(0,S+1)),raw:O,content:`${F}${P}${D}`,children:[...ee,...te],loading:!i&&!y};if(r.includeSourceMap&&(I.sourceMap=kC(t,f,y?E:t.length,r)),k&&y&&k.set(c,{openRaw:d,explicitClose:y,closeSliceEnd:E,middleSource:w,node:I}),o.push(I),s=y?E:t.length,m===-1&&!g)break;m!==-1&&(a=m)}return[o,s]}function uT(e,t,n,r,i,a=0){if(!n)return e;let o=e.slice(),s=a;for(let e=0;e<o.length;e++){let a=o[e],c=uC(a),l=c?n.indexOf(c,s):-1;if(a?.type!==`html_block`){l!==-1&&(s=l+c.length);continue}let u=String(a.tag??``).toLowerCase();if(!u)continue;if(u===`details`){l!==-1&&(s=l+c.length);continue}let d=pC(n,u,l===-1?s:l);if(!d)continue;s=d.end;let f=String(a.content??c),p=String(a.raw??f),m=l+p.length;if(l!==-1&&d.end<m&&n.slice(l,m)===p){s=m,i?.includeSourceMap&&(a.sourceMap=kC(n,l,m,i));continue}let h=hC(d.raw,u,d.closed),g=!t&&!d.closed,_=f!==h||p!==d.raw||!!a.loading!==g,v=cy(d.raw),y=v===-1?``:d.raw.slice(0,v+1),b=y?ly(y):[];if(a.content=h,a.raw=d.raw,a.loading=g,a.attrs=b.length?b:void 0,i?.includeSourceMap&&(a.sourceMap=kC(n,d.start,d.end,i)),!_)continue;let x=mC(d.raw,p);x===-1&&(x=0);let S=e+1;for(;S<o.length;){if(d.closed&&dC(o[S],u)){o.splice(S,1);continue}let e=uC(o[S]);if(!e)break;let t=d.raw.indexOf(e,x);if(t===-1){if(_C(n,d.end,e))break;let t=r.getInternalNodeSourceRange(o[S]);if(!t)break;if(t.start>=d.start&&t.end<=d.end){o.splice(S,1);continue}break}x=t+e.length,o.splice(S,1)}}return o}function dT(e){let t=e.meta??{};return{type:`checkbox`,checked:t.checked===!0,raw:t.checked?`[x]`:`[ ]`}}function fT(e){let t=e,n=t.attrGet?t.attrGet(`checked`):void 0,r=n===``||n===`true`;return{type:`checkbox_input`,checked:r,raw:r?`[x]`:`[ ]`}}function pT(e){let t=String(e.content??``);return{type:`emoji`,name:t,markup:String(e.markup??``),raw:`:${t}:`}}function mT(e,t,n,r,i=!1){let a=``,o=t+1,s=1,c=[];for(;o<e.length;){if(e[o].type===n){if(s===1)break;s--}r&&e[o].type===r&&s++;let t=e[o];a+=String(i?e[o].content??t.text??``:e[o].content??``),c.push(e[o]),o++}return{content:a,innerTokens:c,nextIndex:o<e.length?o+1:e.length}}function hT(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=mT(e,t,`em_close`,void 0,!0);return i.push(...n(o,void 0,void 0,r)),{node:{type:`emphasis`,children:i,raw:`*${a}*`},nextIndex:s}}function gT(e){return nC(`(?:^|\\r\\n|\\n|\\r) {0,3}${e}+[ \\t]*$`)}var _T=[`diff `,`index `,`--- `,`+++ `,`@@ `],vT=/\r?\n/;function yT(e){let t=String(e??``);return t?_T.some(e=>e.startsWith(t)||t.startsWith(e)):!1}function bT(e,t,n,r){n.length>0&&e.push(...n),r.length>0&&t.push(...r),n.length=0,r.length=0}function xT(e,t){return!t&&e.startsWith(` `)&&!e.startsWith(` `)?` ${e}`:e}function ST(e,t){let n=[],r=[],i=[],a=[],o=e.split(vT),s=/\r?\n$/.test(e),c=o.some(e=>e.startsWith(`diff `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`@@ `)),l=e=>{let t=e;if(!_T.some(e=>t.startsWith(e))){if(t.startsWith(`-`)){let e=t.slice(1);i.push(xT(e,c))}else if(t.startsWith(`+`)){let e=t.slice(1);a.push(xT(e,c))}else{bT(n,r,i,a);let e=c&&t.startsWith(` `)?t.slice(1):t;n.push(e),r.push(e)}}},u=s?Math.max(0,o.length-1):o.length;for(let e=0;e<u;e++){let n=o[e]??``;(t||s||e!==u-1||!yT(n))&&l(n)}(t||i.length>0||a.length>0)&&bT(n,r,i,a);let d=n.join(`
|
|
115
|
-
`),f=r.join(`
|
|
116
|
-
`);return{original:t&&s&&d?`${d}\n`:d,updated:t&&s&&f?`${f}\n`:f}}function CT(e){let t=Array.isArray(e.map)&&e.map.length===2,n=e.meta??{},r=typeof n.closed==`boolean`?n.closed:void 0,i=r===!0||r!==!1&&t,a=String(e.info??``),o=a.startsWith(`diff`),s=o?(()=>{let e=a,t=e.indexOf(` `);return t===-1?``:String(e.slice(t+1)??``)})():a,c=String(e.content??``);if(!i&&e.markup){let t=e.markup[0],n=gT(t);n.test(c)&&(c=c.replace(n,``))}if(o){let{original:e,updated:n}=ST(c,i===!0);return{type:`code_block`,language:s,code:String(n??``),raw:String(c??``),diff:o,loading:r===!0?!1:r===!1||!t,originalCode:e,updatedCode:n}}return{type:`code_block`,language:s,code:String(c??``),raw:String(c??``),diff:o,loading:r===!0?!1:r===!1||!t}}function wT(e){let t=e.meta??{};return{type:`footnote_reference`,id:String(t.label??``),raw:`[^${String(t.label??``)}]`}}function TT(){return{type:`hardbreak`,raw:`\\
|
|
117
|
-
`}}function ET(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=mT(e,t,`mark_close`);return i.push(...n(o,void 0,void 0,r)),{node:{type:`highlight`,children:i,raw:`==${a}==`},nextIndex:s}}function DT(e){let t=e?.customHtmlTags;if(!Array.isArray(t)||t.length===0)return Iv;let n=new Set(Iv);for(let e of py(t))e&&n.add(e);return n}var OT=null,kT=new WeakMap;function AT(){return OT||={customTagSet:null,allowedTagSet:DT()},OT}function jT(e){let t=e.match(/^<\s*(?:\/\s*)?([\w-]+)/);return t?t[1].toLowerCase():``}function MT(e){return/^<\s*\//.test(e)}function NT(e,t){return/\/\s*>\s*$/.test(t)||Pv.has(e)}function PT(e){if(!e||e.length===0)return AT();let t=kT.get(e);if(t)return t;let n=e.map(fy).filter(Boolean);if(!n.length){let t=AT();return kT.set(e,t),t}let r={customTagSet:new Set(n),allowedTagSet:DT({customHtmlTags:e})};return kT.set(e,r),r}function FT(e){let t=e,n=t.raw??t.content??t.markup??``;return String(n??``)}function IT(e){let t=e.meta,n=t?.markstreamCustomHtmlRaw,r=t?.markstreamCustomHtmlInner;return typeof n==`string`&&typeof r==`string`?{raw:n,inner:r}:null}function LT(e,t){let n=t.toLowerCase();for(let t=e.length-1;t>=0;t--){let[r,i]=e[t];if(String(r).toLowerCase()===n)return i}}function RT(e,t,n){let r=e.slice();return LT(r,`href`)||r.push([`href`,t]),n!=null&&!LT(r,`title`)&&r.push([`title`,n]),r}function zT(e){return e.map(FT).join(``)}function BT(e){let t=[],n=e=>{let n=String(e??``);if(!n)return;let r=t[t.length-1];if(r?.type===`text`){r.content=`${r.content}${n}`,r.raw=`${r.raw}${n}`;return}t.push({type:`text`,content:n,raw:n})};for(let r of e)if(r){if(r.type===`reference`||r.type===`footnote_reference`){n(String(r.raw??``));continue}if(`children`in r&&Array.isArray(r.children)){t.push({...r,children:BT(r.children)});continue}t.push(r)}return t}function VT(e,t,n){let r=0;for(let i=t;i<e.length;i++){let t=e[i];if(t.type!==`html_inline`)continue;let a=String(t.content??``),o=jT(a),s=MT(a),c=NT(o,a);if(!s&&!c&&o===n){r++;continue}if(s&&o===n){if(r===0)return i;r--}}return-1}function HT(e,t,n){let r=[e[t]],i=[],a=t+1,o=!1,s=n?VT(e,t+1,n):-1;return s===-1?(i=e.slice(t+1),i.length&&r.push(...i),a=e.length):(i=e.slice(t+1,s),r.push(...i,e[s]),a=s+1,o=!0),{closed:o,html:zT(r),innerTokens:i,nextIndex:a}}function UT(e,t,n,r,i,a,o){let s=String(e.content??``),c=jT(s),{customTagSet:l,allowedTagSet:u}=PT(o?.customHtmlTags);if(!c)return[{type:`inline_code`,code:s,raw:s},n+1];if(!u.has(c)&&!HT(t,n,c).closed){let t=FT(e);return[{type:`text`,content:t,raw:t},n+1]}if(c===`br`)return[{type:`hardbreak`,raw:s},n+1];let d=MT(s),f=NT(c,s);if(d)return[{type:`html_inline`,tag:c,content:s,children:[],raw:s,loading:!1},n+1];if(c===`a`){let e=HT(t,n,c),l=ly(s),u=e.innerTokens,d=String(LT(l,`href`)??``),f=LT(l,`title`),p=f==null?null:String(f),m=RT(l,d,p),h=BT(u.length?r(u,i,a,o):[]),g=u.length?zT(u):d||``;return!h.length&&g&&h.push({type:`text`,content:g,raw:g}),[{type:`link`,href:d,title:p,text:g,attrs:m,children:h,loading:!e.closed,raw:e.html||s},e.nextIndex]}if(f)return[{type:l?.has(c)?c:`html_inline`,tag:c,content:s,children:[],raw:s,loading:!1},n+1];let p=HT(t,n,c);if(c===`p`||c===`div`)return[{type:`paragraph`,children:BT(p.innerTokens.length?r(p.innerTokens,i,a,o):[]),raw:p.html},p.nextIndex];let m=BT(p.innerTokens.length?r(p.innerTokens,i,a,o):[]),h=p.html||s,g=!p.closed,_=!1;if(!p.closed){let e=`</${c}>`;h.toLowerCase().includes(e.toLowerCase())||(h+=e),_=!0,g=!0}let v=[],y=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,b;for(;(b=y.exec(s))!==null;){let e=b[1],t=b[2]||b[3]||b[4]||``;v.push([e,t])}if(l?.has(c)){let t=IT(e);return[{type:c,tag:c,attrs:v,content:t?t.inner:p.innerTokens.length?zT(p.innerTokens):``,children:p.innerTokens.length?r(p.innerTokens,i,a,o):[],raw:t?.raw??h,loading:e.loading||g,autoClosed:_},p.nextIndex]}return[{type:`html_inline`,tag:c,attrs:v,content:h,children:m,raw:h,loading:g,autoClosed:_},p.nextIndex]}function WT(e){let t=String(e.content??``);return{type:`inline_code`,code:t,raw:t}}function GT(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=mT(e,t,`ins_close`);return i.push(...n(o,void 0,void 0,r)),{node:{type:`insert`,children:i,raw:`++${String(a)}++`},nextIndex:s}}function KT(e){if(e.type===`math_inline`){if(e.raw)return String(e.raw);let t=e.markup===`$$`?`$$`:`$`;return`${t}${String(e.content??``)}${t}`}return Array.isArray(e.children)&&e.children.length>0?e.children.map(e=>KT(e)).join(``):String(e.content??``)}function qT(e){return!e||!Array.isArray(e.children)||e.children.length===0?``:e.children.map(e=>KT(e)).join(``)}function JT(e,t=!1){let n=e.attrs??[],r=null;if((!n||n.length===0)&&Array.isArray(e.children))for(let t of e.children){let e=t.attrs;if(Array.isArray(e)&&e.length>0){n=e,r=t;break}}let i=String(n.find(e=>e[0]===`src`)?.[1]??``),a=n.find(e=>e[0]===`alt`)?.[1],o=qT(r??e),s=``;o?s=o:a!=null&&String(a).length>0?s=String(a):r?.content!=null&&String(r.content).length>0?s=String(r.content):Array.isArray(r?.children)&&r.children[0]?.content?s=String(r.children[0].content):Array.isArray(e.children)&&e.children[0]?.content?s=String(e.children[0].content):e.content!=null&&String(e.content).length>0&&(s=String(e.content));let c=n.find(e=>e[0]===`title`)?.[1]??null,l=c===null?null:String(c),u=String(e.content??``);return{type:`image`,src:i,alt:s,title:l,raw:u,loading:t}}function YT(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){let e=n?.[0];e&&t.push([String(e),String(n?.[1]??``)])}return t}function XT(e,t){let n=t.toLowerCase();for(let t=e.length-1;t>=0;t--){let[r,i]=e[t];if(String(r).toLowerCase()===n)return i}}function ZT(e,t,n){let r=e.slice();return XT(r,`href`)||r.push([`href`,t]),n!=null&&!XT(r,`title`)&&r.push([`title`,n]),r}function QT(e,t,n,r){let i=e[t],a=YT(i.attrs),o=String(XT(a,`href`)??``),s=XT(a,`title`),c=s==null?null:String(s),l=ZT(a,o,c),u=t+1,d=[],f=!0;for(;u<e.length&&e[u].type!==`link_close`;)d.push(e[u]),u++;e[u]?.type===`link_close`&&(f=!1);let p=d,m=d[d.length-1];if(Ky(r)&&r.insideStrong&&m?.type===`text`&&String(m.content??``).endsWith(`**`)&&!d.some(e=>e.type===`strong_open`)){let e=String(m.content??``),t=String(m.raw??e),n=NC(m);n.content=e.slice(0,-2),n.raw=t.replace(/\*\*$/,``),p=d.slice(),p[p.length-1]=n}let h=n(p,void 0,void 0,r),g=h.map(e=>{let t=e;return`content`in e?String(t.content??``):String(t.raw??``)}).join(``);return{node:{type:`link`,href:o,title:c,text:g,children:h,raw:String(`[${g}](${o}${c?` "${c}"`:``})`),loading:f,attrs:l},nextIndex:u<e.length?u+1:e.length}}var $T=/\\([\\()[\]`$|*_\-!])/g,eE=new Set([`\\`,`(`,`)`,`[`,`]`,"`",`$`,`|`,`*`,`_`,`-`,`!`]),tE=1,nE=2,rE=4,iE=8,aE=16,oE=32,sE=64,cE=128,lE=256,uE=512,dE=1024,fE=1982;function pE(e){let t=0;for(let n=0;n<e.length;n++)switch(e.charCodeAt(n)){case 33:t|=cE;break;case 36:t|=lE;break;case 40:t|=dE;break;case 42:t|=nE;break;case 91:t|=oE;break;case 92:t|=tE;break;case 93:t|=sE;break;case 95:t|=rE;break;case 96:t|=aE;break;case 124:t|=uE;break;case 126:t|=iE}return t}function mE(e){let t=``,n=0;for(;n<e.length;){if(e[n]!==`\\`){t+=e[n],n++;continue}let r=0;for(;n+r<e.length&&e[n+r]===`\\`;)r++;let i=e[n+r];if(t+=`\\`.repeat(Math.floor(r/2)),r%2==1){if(i&&eE.has(i)){t+=i,n+=r+1;continue}t+=`\\`}n+=r}return t}function hE(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r],a=e[r+1];if(i===`\\`&&a&&eE.has(a)){if(n===t)return r+1;n++,r++;continue}if(n===t)return r;n++}return-1}function gE(e,t,n){let r=hE(e,t);if(r===-1||n&&e[r]!==n)return!1;let i=0;for(let t=r-1;t>=0&&e[t]===`\\`;t--)i++;return i%2==1}function _E(e,t){if(!e||!t)return null;let n=e.match(/\[([^\]\n]+)\]\(([^)]*)$/);return n&&n[2]===t?n[1]:null}function vE(e,t){return String(e.markup??``).startsWith(t)}function yE(e,t,n=pE(e)){let r=e,i=String(t.content??``);return(n&tE)!==0&&r.endsWith(`\\`)&&!vE(t,`\\\\`)&&!i.endsWith(`\\\\`)&&(r=r.slice(0,-1)),(n&dE)!==0&&r.endsWith(`(`)&&!vE(t,`\\(`)&&!i.endsWith(`\\(`)&&(r=r.slice(0,-1)),(n&nE)!==0&&/\*+$/.test(r)&&!vE(t,`\\*`)&&!i.endsWith(`\\*`)&&(r=r.replace(/\*+$/,``)),r}function bE(e,t){if(!e)return;let n=String(e);if(n&&(n===t||n.replace($T,`$1`)===t))return n}function xE(e,t,n,r,i){let a=[],{content:o,innerTokens:s,nextIndex:c}=mT(e,t,`strong_close`,`strong_open`),l={...Jy(i),insideStrong:!0};return a.push(...n(s,bE(r,o),void 0,l)),{node:{type:`strong`,children:a,raw:`**${String(o)}**`},nextIndex:c}}var SE=/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,CE=/:\/\//;function wE(e){return e?SE.test(e)||CE.test(e):!1}function TE(e,t,n){if(!t)return;let r=e.parseInlineTokens([{...n,type:`text`,content:t,raw:t}],t,e.pPreToken,e.options);if(r.length===1&&r[0]?.type===`text`){let t=r[0];e.pushText(String(t.content??``),String(t.raw??t.content??``));return}for(let t of r)e.pushParsed(t)}function EE(e,t){return t.endsWith(`](`)?e.tokens[e.index+1]?.type===`link_open`&&e.tokens[e.index+1]?.markup===`linkify`&&e.tokens[e.index+2]?.type===`text`&&e.tokens[e.index+3]?.type===`link_close`&&e.tokens[e.index+4]?.type===`text`&&String(e.tokens[e.index+4]?.content??``).startsWith(`)`):!1}function DE(e,t){if(OE(e,t))return;if(zE(e)){let{node:t,nextIndex:n}=QT(e.tokens,e.index,e.parseInlineTokens,e.options),r=String(t.text||t.href||``);e.pushText(r,r),e.index=n;return}e.resetCurrentTextNode();let n=e.index,{node:r,nextIndex:i}=QT(e.tokens,e.index,e.parseInlineTokens,e.options);e.index=i;let a=r.text||r.href||``;if(t.markup===`linkify`&&!Pb(a,r.href,e.raw)&&Vb(a,e.options.linkifyDemotionContext)){e.pushText(a,a);return}let o=r.children.length===1&&r.children[0]?.type===`text`;if(r.loading&&e.raw&&r.text===r.href&&o){let t=_E(e.raw,r.href);t&&(r.text=t,r.children=[{type:`text`,content:t,raw:t}],r.raw=String(`[${t}](${r.href}${r.title?` "${r.title}"`:``})`))}if(e.options?.validateLink&&!e.options.validateLink(r.href)){e.pushText(r.text,r.text);return}let s=t.attrs?.find(([e])=>e===`href`)?.[1],c=String(s??``);if(e.raw&&c){let t=e.raw.indexOf(`](`);if(t!==-1){let n=e.raw.indexOf(`)`,t+2);n===-1?r.loading=!0:r.loading&&e.raw.slice(t+2,n).includes(c)&&(r.loading=!1)}}/^file:\/\/\/[a-z]:\//i.test(r.href)&&ME(e,r,n-1)||kE(e,r)||e.pushParsed(r)}function OE(e,t){if(t.markup!==`linkify`)return!1;let{node:n,nextIndex:r}=QT(e.tokens,e.index,e.parseInlineTokens,e.options);return jE(e,n,r)?(e.index=r,!0):!1}function kE(e,t){if(t.type!==`link`)return!1;let n=e.result[e.result.length-1];if(!n||n.type!==`text`)return!1;let r=String(n.content??``).match(/^([^[]*)\[([^\]\n]+)\]\($/);if(!r)return!1;let i=t,a=String(i.href??``),o=String(i.text??``),s=String(r[2]??``),c=a.replace(/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,``);if(!a||!(o===a||o===c||wE(o)))return!1;let l=String(r[1]??``);return l?(n.content=l,n.raw=l):e.result.pop(),e.pushParsed({...t,text:s,children:[{type:`text`,content:s,raw:s}],raw:String(`[${s}](${a}${i.title?` "${i.title}"`:``})`)}),!0}function AE(e,t){if(t.type!==`link`)return!1;let n=t,r=String(n.href??``);return r?jE(e,{href:r,title:n.title==null||n.title===``?null:String(n.title),loading:!!n.loading},e.index+1):!1}function jE(e,t,n){let r=e.result[e.result.length-1];if(r?.type!==`image`||r.src||!r.loading||!String(r.raw??``).endsWith(`](`))return!1;let i=e.tokens[n],a=String(i?.content??``);if(i?.type!==`text`||!a.startsWith(`)`))return!1;e.result.pop(),e.currentTextNode=null;let o=String(r.alt??``);e.pushParsed({type:`image`,src:t.href,alt:o,title:t.title,raw:String(``),loading:!!t.loading});let s=a.slice(1),c=NC(i);return c.content=s,c.raw=s,e.ensureWorkingTokens()[n]=c,!0}function ME(e,t,n=e.index-1){if(t.type!==`link`)return!1;let r=e.result[e.result.length-1],i=e.tokens[n];if(!r||r.type!==`text`||i?.type!==`text`)return!1;let a=String(r.content??``),o=String(i.content??``);if(!a.endsWith(`!`)||!o.endsWith(`!`)||vE(i,`\\!`))return!1;let s=a.slice(0,-1);s?(r.content=s,r.raw=s,e.currentTextNode=r):(e.result.pop(),e.currentTextNode=null);let c=t,l=String(c.text??c.children?.map(e=>String(e?.content??e?.raw??``)).join(``)??``),u=String(c.href??``),d=c.title==null||c.title===``?null:String(c.title);return e.pushParsed({type:`image`,src:u,alt:l,title:d,raw:String(``),loading:!!c.loading}),!0}function NE(e,t=``,n=null){let r=String(e.alt??e.raw??``);return{type:`link`,href:t,title:n,text:r,children:[e],raw:String(`[${r}](${t}${n?` "${n}"`:``})`),loading:!0}}function PE(e){let t=e.startsWith(`;return{type:`image`,src:``,alt:r===-1?n.replace(/\]$/,``):n.slice(0,r),title:null,raw:t,loading:!0}}function FE(e,t){let n=t.indexOf(`[![`);if(n===-1||typeof e.raw==`string`&&e.tokens.length===1&&gE(e.raw,n,`[`))return!1;let r=t.slice(0,n);r&&e.pushText(r,r);let i=PE(t.slice(n+1));return e.pushParsed(NE(i)),e.index++,!0}function IE(e,t){if(e.options?.final)return!1;let n=e.tokens[e.index-1];if(n?.type!==`text`||!String(n.content??``).endsWith(`[`)||vE(n,`\\[`))return!1;let r=e.result[e.result.length-1];if(r?.type===`text`&&r.content.endsWith(`[`)){let t=r.content.slice(0,-1);t?(r.content=t,r.raw=t,e.currentTextNode=r):(e.result.pop(),e.currentTextNode=null)}let i=JT(t);return e.pushParsed(NE(i)),e.index++,!0}function LE(e,t){if(t.type!==`link`)return!1;let n=t,r=String(n.raw??``),i=String(n.text??``);if(!r.startsWith(`[![`)&&!i.startsWith(`![`))return!1;let a=n.title==null||n.title===``?null:String(n.title),o={type:`image`,src:String(n.href??``),alt:i.replace(/^!\[/,``).replace(/\]$/,``),title:a,raw:r.startsWith(`[)return!1;let n=e.tokens[e.index-2];if(n?.type===`text`&&String(n.content??``).endsWith(`[`)&&vE(n,`\\[`))return!1;let r=e.result[e.result.length-1];if(r?.type!==`image`&&r?.type!==`link`)return!1;let i=r,a=r?.type===`link`&&Array.isArray(i.children)&&i.children.length===1&&i.children[0]?.type===`image`?e.result.pop():null,o=a?a.children[0]:e.result.pop();if(!o||o.type!==`image`)return!1;let s=e.tokens[e.index+1],c=String(a?.href??``),l=a?.title==null?null:String(a.title),u=!0;if(s?.type===`link_open`){let{node:t,nextIndex:n}=QT(e.tokens,e.index+1,e.parseInlineTokens,e.options);c=t.href,l=t.title,u=!0,e.index=n}else{if(c=t.slice(2),c.includes(`"`)){let e=c.split(`"`);c=String(e[0]??``).trim(),l=e[1]==null?null:String(e[1]).trim()}e.index++}let d=NE(o,c,l);return d.loading=u,e.pushParsed(d),!0}function zE(e){let t=e.tokens[e.index-3];return e.tokens[e.index-2]?.type===`image`&&e.tokens[e.index-1]?.type===`text`&&String(e.tokens[e.index-1].content??``)===`](`&&t?.type===`text`&&String(t.content??``).endsWith(`[`)&&vE(t,`\\[`)}function BE(e,t,n){let r=t.indexOf(`[`);if(r===-1)return!1;let i=t.slice(0,r),a=t.indexOf(`](`,r);if(a!==-1){let o=e.tokens[e.index+2],s=t.slice(r+1,a);if(s.includes(`[`)){let e=s.indexOf(`[`);i+=t.slice(0,r+e+1);let n=r+e+1;s=t.slice(n+1,a)}let c=e.tokens[e.index+1];if(t.endsWith(`](`)&&c?.type===`link_open`&&o){let t=e.tokens[e.index+4],r=4,a=!0;if(t?.type===`text`){let n=String(t.content??``);if(n.startsWith(`)`)){a=!1;let i=n.slice(1);if(i){let n=NC(t);n.content=i,n.raw=i,e.ensureWorkingTokens()[e.index+4]=n}else r++}else n===`.`&&r++}TE(e,i,n);let c=String(o.content??``);return e.options?.validateLink&&!e.options.validateLink(c)?e.pushText(s,s):e.pushParsed({type:`link`,href:c,title:null,text:s,children:[{type:`text`,content:s,raw:s}],loading:a}),e.index+=r,!0}let l=t.indexOf(`)`,a),u=l===-1?``:t.slice(a+2,l),d=l===-1,f=i.match(/\*+$/);if(f&&(i=i.replace(/\*+$/,``)),TE(e,i,n),f||=s.match(/^\*+/),!e.requireClosingStrong&&f){let t=f[0].length;s=s.replace(/^\*+/,``).replace(/\*+$/,``);let n=[];if(t===1?n.push({type:`em_open`,tag:`em`,nesting:1}):t===2?n.push({type:`strong_open`,tag:`strong`,nesting:1}):t===3&&(n.push({type:`strong_open`,tag:`strong`,nesting:1}),n.push({type:`em_open`,tag:`em`,nesting:1})),n.push({type:`link`,href:u,title:null,text:s,children:[{type:`text`,content:s,raw:s}],loading:d}),t===1){n.push({type:`em_close`,tag:`em`,nesting:-1});let{node:t}=hT(n,0,e.parseInlineTokens,e.options);e.pushParsed(t)}else if(t===2){n.push({type:`strong_close`,tag:`strong`,nesting:-1});let{node:t}=xE(n,0,e.parseInlineTokens,void 0,e.options);e.pushParsed(t)}else if(t===3){n.push({type:`em_close`,tag:`em`,nesting:-1}),n.push({type:`strong_close`,tag:`strong`,nesting:-1});let{node:t}=xE(n,0,e.parseInlineTokens,void 0,e.options);e.pushParsed(t)}else{let{node:t}=hT(n,0,e.parseInlineTokens,e.options);e.pushParsed(t)}}else e.options?.validateLink&&!e.options.validateLink(u)?e.pushText(s,s):e.pushParsed({type:`link`,href:u,title:null,text:s,children:[{type:`text`,content:s,raw:s}],loading:d});let p=l===-1?``:t.slice(l+1);return p&&(e.dispatchToken({type:`text`,content:p,raw:p}),e.index--),e.index++,!0}return!1}function VE(e,t){let n=t.indexOf(`![`);if(n===-1)return!1;let r=t.slice(0,n);return r&&!e.currentTextNode?e.currentTextNode={type:`text`,content:r,raw:r}:r&&e.currentTextNode&&(e.currentTextNode.content+=r),e.currentTextNode&&=(e.result.push(e.currentTextNode),null),e.pushParsed(PE(t.slice(n))),e.index++,!0}function HE(e,t){IE(e,t)||(e.resetCurrentTextNode(),e.pushParsed(JT(t)),e.index++)}function UE(e,t){let n=t;if(t.type===`link`&&n.href!=null&&e.options.validateLink&&!e.options.validateLink(String(n.href))){e.resetCurrentTextNode();let t=String(n.text??``);e.pushText(t,t),e.index++}else LE(e,t)||AE(e,t)||ME(e,t)||kE(e,t)||e.pushToken(t),e.index++}function WE(e){let t=e.content??``,n=e.raw===`$$`?`$${t}$`:e.raw||``;return{type:`math_inline`,content:t,loading:!!e.loading,raw:n,markup:e.markup}}function GE(e){return{type:`reference`,id:String(e.content??``),raw:String(e.markup??`[${e.content??``}]`)}}function KE(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=mT(e,t,`s_close`);return i.push(...n(o,void 0,void 0,r)),{node:{type:`strikethrough`,children:i,raw:`~~${a}~~`},nextIndex:s}}function qE(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=mT(e,t,`sub_close`);i.push(...n(o,void 0,void 0,r));let c=String(e[t].content??``),l=a||c;return{node:{type:`subscript`,children:i.length>0?i:[{type:`text`,content:l,raw:l}],raw:`~${l}~`},nextIndex:s}}function JE(e,t,n,r){let i=[],{content:a,innerTokens:o,nextIndex:s}=mT(e,t,`sup_close`);return i.push(...n(o,void 0,void 0,r)),{node:{type:`superscript`,children:i.length>0?i:[{type:`text`,content:a||String(e[t].content??``),raw:a||String(e[t].content??``)}],raw:`^${a||String(e[t].content??``)}^`},nextIndex:s}}var YE=/\s/u,XE=/[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/,ZE=/\p{P}/u,QE=/^[\x22\x27《「『【〔〖〘〚〈([{“‘﹁﹃﹙﹛﹝]$/u,$E=/^[\x22\x27》」』】〕〗〙〛〉)]}”’﹂﹄﹚﹜﹞]$/u;function eD(e){let t=0,n=0;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length&&e[n+1]===`*`){n+=2;continue}e[n]===`*`&&t++,n++}return t}function tD(e,t=0){if(!e)return-1;let n=0;for(let r=0;r<e.length;r++){let i=e[r],a=e[r+1];if(i===`\\`&&a&&eE.has(a)){if(a===`*`&&n>=t){n++,r++;continue}n++,r++;continue}if(i===`*`&&n>=t)return n;n++}return-1}function nD(e){return!!e&&YE.test(e)}function rD(e){return!!e&&(XE.test(e)||ZE.test(e))}function iD(e,t){return!!e&&!!t&&/^\p{Script=Han}$/u.test(t)&&QE.test(e)}function aD(e,t){return!!e&&!!t&&/^[\p{L}\p{N}]$/u.test(t)&&$E.test(e)}function oD(e,t){let n=t>0?e[t-1]:void 0,r=e[t+1];return!r||nD(r)?!1:!(rD(r)&&!iD(r,n)&&n&&!nD(n)&&!rD(n))}function sD(e,t){let n=t>0?e[t-1]:void 0,r=e[t+1];return!n||nD(n)?!1:!(rD(n)&&!aD(n,r)&&r&&!nD(r)&&!rD(r))}function cD(e,t,n=0){let r=n,i=!1;for(;r<t.length;){let n=e?tD(e,r):t.indexOf(`*`,r);if(n===-1)break;if(sD(t,n))return{index:n,sawInvalidClose:i};i=!0,r=n+1}return{index:-1,sawInvalidClose:i}}function lD(e,t){let n=t>0?e[t-1]:void 0,r=e[t+2];return!r||nD(r)?!1:!(rD(r)&&!iD(r,n)&&n&&!nD(n)&&!rD(n))}function uD(e,t){let n=t>0?e[t-1]:void 0,r=e[t+2];return!n||nD(n)?!1:!(rD(n)&&!aD(n,r)&&r&&!nD(r)&&!rD(r))}function dD(e,t=0){let n=t,r=!1;for(;n<e.length;){let t=e.indexOf(`**`,n);if(t===-1)break;if(uD(e,t))return{index:t,sawInvalidClose:r};r=!0,n=t+2}return{index:-1,sawInvalidClose:r}}var fD=/[\p{L}\p{N}]/u,pD=/^[\p{L}\p{N}]+$/u;function mD(e){return e?fD.test(e):!1}function hD(e){return e?pD.test(e):!1}function gD(e,t){let n=t;for(;n<e.length&&e[n]===`*`;)n++;let r=t>0?e[t-1]:void 0,i=n<e.length?e[n]:void 0;return{len:n-t,prev:r,next:i,intraword:mD(r)&&mD(i)}}function _D(e){let t=[];for(let n=0;n<e.length;){if(e[n]!==`*`){n++;continue}let r=gD(e,n),i=n+r.len;r.len>=2&&r.intraword&&t.push({start:n,end:i}),n=i}for(let n=0;n<t.length-1;n++){let r=t[n],i=t[n+1];if(!hD(e.slice(r.end,i.start)))return i.end}return-1}function vD(e){return!!e&&e.trim()===e&&/^[\p{L}\p{N}\s]+$/u.test(e)}function yD(e,t){let n=t;for(;n<e.length;){let t=e.indexOf(`***`,n);if(t===-1)return-1;let r=gD(e,t);if(r.len>=3)return t;n=t+r.len}return-1}function bD(e){let t=String(e.content??``);return{type:`text`,content:t,raw:t}}var xD=/[^~]*~{2,}[^~]+/,SD=/\*\*/,CD=/[[_*^~]/;function wD(e,t){return t===e.tokens[e.index]}function TD(e,t,n){let r=wD(e,n)&&e.tokens.length===1?e.raw:String(n.content??``),i=[],a=_D(t);if(a!==-1){e.pushText(t.slice(0,a),t.slice(0,a));let n=t.slice(a);return n&&(e.dispatchToken({type:`text`,content:n,raw:n}),e.index--),e.index++,!0}if(xD.test(t)){let e=t.indexOf(`~~`);e!==-1&&i.push({type:`strikethrough`,index:e})}if(SD.test(t)){let e=t.indexOf(`**`);e!==-1&&i.push({type:`strong`,index:e})}if(/[^*]*\*[^*]+/.test(t)){let e=r?tD(r,0):t.indexOf(`*`);if(r&&e===-1)return!1;e!==-1&&i.push({type:`emphasis`,index:e})}i.sort((e,t)=>e.index===t.index?e.type===t.type?0:e.type===`strong`?-1:+(t.type===`strong`):e.index-t.index);let o=i[0];if(!o)return!1;if(o.type===`strikethrough`){let n=o.index,r=n>-1?t.slice(0,n):``;if(r&&e.pushText(r,r),n===-1)return e.index++,!0;let i=t.indexOf(`~~`,n+2),a=i===-1?t.slice(n+2):t.slice(n+2,i),s=i===-1?``:t.slice(i+2),{node:c}=KE([{type:`s_open`,tag:`s`,content:``,markup:`~~`,info:``,meta:null},{type:`text`,tag:``,content:a,markup:``,info:``,meta:null},{type:`s_close`,tag:`s`,content:``,markup:`~~`,info:``,meta:null}],0,e.parseInlineTokens,e.options);return e.resetCurrentTextNode(),e.pushParsed(c),s&&(e.dispatchToken({type:`text`,content:s,raw:s}),e.index--),e.index++,!0}if(o.type===`strong`){let n=o.index,r=n>-1?t.slice(0,n):``;if(r&&e.pushText(r,r),n===-1)return e.index++,!0;if(e.raw&&n===0){let n=!1,r=0;for(;r<t.length&&t[r]===`*`;)r++;if(e.raw.startsWith(`\\*`)&&(n=!0),n){let n=0,i=0;for(;i<e.raw.length&&n<r;)if(e.raw[i]===`\\`&&i+1<e.raw.length&&e.raw[i+1]===`*`)n+=1,i+=2;else if(e.raw[i]===`*`)break;else i++;if(n>=2)return e.pushText(t,t),e.index++,!0}}if(e.raw&&(t.match(/\*/g)||[]).length>eD(e.raw))return e.pushText(t.slice(r.length),t.slice(r.length)),e.index++,!0;let i=gD(t,n);if(i.len>=3){let r=yD(t,n+i.len);if(r!==-1){let a=t.slice(n+i.len,r);if(vD(a)){let{node:n}=xE([{type:`strong_open`,tag:`strong`,content:``,markup:`**`,info:``,meta:null},{type:`em_open`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`text`,tag:``,content:a,markup:``,info:``,meta:null},{type:`em_close`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`strong_close`,tag:`strong`,content:``,markup:`**`,info:``,meta:null}],0,e.parseInlineTokens,e.raw,e.options);e.resetCurrentTextNode(),e.pushParsed(n);let i=t.slice(r+3);return i&&(e.dispatchToken({type:`text`,content:i,raw:i}),e.index--),e.index++,!0}}}if(!lD(t,n)){let r=t.slice(n,n+i.len);e.pushText(r,r);let a=t.slice(n+i.len);return a&&(e.dispatchToken({type:`text`,content:a,raw:a}),e.index--),e.index++,!0}let a=dD(t,n+2),s=``,c=``;if(a.index!==-1){s=t.slice(n+2,a.index),c=t.slice(a.index+2);let o=a.index,l=gD(t,o);if(i.intraword&&l.intraword&&!hD(s)||!s&&i.len>=4&&i.intraword)return e.pushText(t.slice(r.length),t.slice(r.length)),e.index++,!0}else{if(e.requireClosingStrong||a.sawInvalidClose||i.intraword)return e.pushText(t.slice(r.length),t.slice(r.length)),e.index++,!0;s=t.slice(n+2),c=``}if(!s&&/^\*+$/.test(c))return e.pushText(t,t),e.index++,!0;let{node:l}=xE([{type:`strong_open`,tag:`strong`,content:``,markup:`**`,info:``,meta:null},{type:`text`,tag:``,content:s,markup:``,info:``,meta:null},{type:`strong_close`,tag:`strong`,content:``,markup:`**`,info:``,meta:null}],0,e.parseInlineTokens,e.raw,e.options);return e.resetCurrentTextNode(),e.pushParsed(l),c&&(e.dispatchToken({type:`text`,content:c,raw:c}),e.index--),e.index++,!0}if(o.type===`emphasis`){let n=o.index;n===-1&&(n=0);let i=t.slice(0,n);if(i&&e.pushText(i,i),!oD(t,n)){e.pushText(t[n],t[n]);let r=t.slice(n+1);return r&&(e.dispatchToken({type:`text`,content:r,raw:r}),e.index--),e.index++,!0}let a=gD(t,n),s=cD(r,t,n+1),c=s.index,l=e.tokens[e.index+1];if(e.options?.final&&l?.type===`em_open`&&c!==-1&&t.slice(n+1,c).trim()!==t.slice(n+1,c)||c===-1&&(s.sawInvalidClose||e.options?.final||a.intraword||!mD(t[n+1])))return e.pushText(t.slice(n),t.slice(n)),e.index++,!0;let{node:u}=hT([{type:`em_open`,tag:`em`,content:``,markup:`*`,info:``,meta:null},{type:`text`,tag:``,content:c>-1?t.slice(n+1,c):t.slice(n+1),markup:``,info:``,meta:null},{type:`em_close`,tag:`em`,content:``,markup:`*`,info:``,meta:null}],0,e.parseInlineTokens,e.options);if(e.resetCurrentTextNode(),e.pushParsed(u),c!==-1&&c<t.length-1){let n=t.slice(c+1);n&&(e.dispatchToken({type:`text`,content:n,raw:n}),e.index--)}return e.index++,!0}return!1}function ED(e,t,n){if(!t.includes("`"))return!1;let r=(e=>{for(let t=0;t<e.length;t++){if(e[t]!=="`")continue;let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;if(n%2==0)return t}return-1})(t);if(r===-1)return!1;let i=1;for(let e=r+1;e<t.length&&t[e]==="`";e++)i++;let a="`".repeat(i),o=r+i,s=t.indexOf(a,o);if(s===-1){if(i===1){let i=t.slice(0,r),a=t.slice(r+1);return i&&(TD(e,i,n)?e.index--:e.pushText(i,i)),e.pushParsed({type:`inline_code`,code:a,raw:String(a)}),e.index++,!0}let a=t;for(let t=e.index+1;t<e.tokens.length;t++)a+=String((e.tokens[t].content??``)+(e.tokens[t].markup??``));return e.index=e.tokens.length-1,e.pushText(a,a),e.index++,!0}e.resetCurrentTextNode();let c=t.slice(0,r),l=t.slice(r+i,s),u=t.slice(s+i);return c&&(TD(e,c,n)?e.index--:e.pushText(c,c)),e.pushParsed({type:`inline_code`,code:l,raw:String(l??``)}),u&&(e.dispatchToken({type:`text`,content:u,raw:u}),e.index--),e.index++,!0}function DD(e,t){let n=e.options.markdownIt;if(!n||e.tokens.length<=1||!e.tokens.some(e=>e?.type===`math_inline`)||!CD.test(t))return null;let r=n.parseInline(t,{__markstreamFinal:!!e.options?.final});if(!Array.isArray(r)||r.length===0)return null;let i=(r.find(e=>e?.type===`inline`)?.children??[]).filter(e=>e?.type!==`text`||String(e.content??``)!==``);if(!i.length||!i.some(e=>e?.type!==`text`)||i.length===1&&i[0]?.type===`text`&&String(i[0].content??``)===t)return null;let a=e.parseInlineTokens(i,t,e.pPreToken,e.options);return a.length?a:null}function OD(e,t,n,r,i,a=pE(t)){let o=bD({...n,content:t});if(e.currentTextNode){e.currentTextNode.content+=e.options?.final?o.content:yE(o.content,n,a),e.currentTextNode.raw+=o.raw;return}let s=r?.tag===`br`&&e.tokens[e.index-2]?.content===`[`;i||(o.content=e.options?.final?o.content:yE(o.content,n,a)),e.currentTextNode=o,e.currentTextNode.center=s,e.result.push(e.currentTextNode)}function kD(e,t){let n=String(t.content??``),r=pE(n),i=(r&tE)!==0,a=wD(e,t)&&e.tokens.length===1&&i&&typeof e.raw==`string`?String(e.raw):``,o=a?mE(a):i?n.replace($T,`$1`):n,s=o===n?r:pE(o);if(t.content===`<`||o===`1`&&e.tokens[e.index-1]?.tag===`br`){e.index++;return}let c=(s&lE)===0?-1:o.indexOf(`$`);c!==-1&&c===o.lastIndexOf(`$`)&&o.endsWith(`$`)&&(o=o.slice(0,-1)),o.endsWith(`undefined`)&&!e.raw?.endsWith(`undefined`)&&(o=o.slice(0,-9));let l=e.result.length,u=``;for(let t=e.result.length-1;t>=0;t--){let n=e.result[t];if(n.type!==`text`)break;l=t,u=String(n.content??``)+u}l<e.result.length&&(o.startsWith(u)?(e.currentTextNode=null,e.result.length=l):e.currentTextNode=e.result[e.result.length-1]);let d=e.tokens[e.index+1];if((o==="`"||o===`|`||o===`$`)&&!vE(t,`\\${o}`)||/^\*+$/.test(o)&&!vE(t,`\\*`)){e.index++;return}if(!d&&e.options?.final!==!0&&(s&dE)!==0&&/[^\]]\s*\(\s*$/.test(o)&&(o=o.replace(/\(\s*$/,``)),!o){e.index++;return}if((s&160)==160&&FE(e,o)||(s&1088)==1088&&RE(e,o))return;if((s&fE)===0){OD(e,o,t,e.tokens[e.index-1],d,s),e.index++;return}if((s&oE)!==0&&AD(e,o))return;let f=e.tokens[e.index-1];if((s&oE)!==0&&o===`[`&&!d?.markup?.includes(`*`)&&!vE(t,`\\[`)||(s&sE)!==0&&o===`]`&&!f?.markup?.includes(`*`)&&!vE(t,`\\]`)){e.index++;return}if((s&aE)!==0&&ED(e,n,t)||(s&160)==160&&VE(e,o)||(s&oE)!==0&&(e.tokens[e.index+1]?.type!==`link_open`||EE(e,o))&&BE(e,o,t))return;let p=DD(e,n);if(p){e.resetCurrentTextNode();for(let t of p)e.pushParsed(t);e.index++;return}TD(e,o,t)||(OD(e,o,t,f,d,s),e.index++)}function AD(e,t){if(!(t?.startsWith(`[`)&&e.pPreToken?.type===`list_item_open`))return!1;let n=t.slice(1).match(/[^\s\]]/);if(n===null)return e.index++,!0;if(n&&/x/i.test(n[0])){let t=n[0]===`x`||n[0]===`X`;return e.pushParsed({type:`checkbox_input`,checked:t,raw:t?`[x]`:`[ ]`}),e.index++,!0}return!1}function jD(e,t){if(!e.currentTextNode||t.loading!==!0||t.markup!==`\\(\\)`)return;let n=e.tokens[e.index-1];n&&n.type===`text`&&vE(n,`\\(`)&&e.currentTextNode.content.endsWith(`(`)&&(e.currentTextNode.content=e.currentTextNode.content.slice(0,-1),e.currentTextNode.raw.endsWith(`(`)&&(e.currentTextNode.raw=e.currentTextNode.raw.slice(0,-1)),!e.currentTextNode.content&&e.result[e.result.length-1]===e.currentTextNode&&(e.result.pop(),e.currentTextNode=null))}function MD(e,t){switch(t.type){case`text`:kD(e,t);break;case`softbreak`:e.currentTextNode?(e.currentTextNode.content+=`
|
|
118
|
-
`,e.currentTextNode.raw+=`
|
|
119
|
-
`):(e.currentTextNode={type:`text`,content:`
|
|
120
|
-
`,raw:`
|
|
121
|
-
`},e.result.push(e.currentTextNode)),e.index++;break;case`code_inline`:e.pushParsed(WT(t)),e.index++;break;case`html_inline`:{let[n,r]=UT(t,e.tokens,e.index,e.parseInlineTokens,e.raw,e.pPreToken,e.options);e.pushParsed(n),e.index=r;break}case`link_open`:DE(e,t);break;case`image`:HE(e,t);break;case`strong_open`:{e.resetCurrentTextNode();let{node:n,nextIndex:r}=xE(e.tokens,e.index,e.parseInlineTokens,t.content,e.options);e.pushParsed(n),e.index=r;break}case`em_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=hT(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`s_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=KE(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`mark_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=ET(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`ins_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=GT(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`sub_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=qE(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`sup_open`:{e.resetCurrentTextNode();let{node:t,nextIndex:n}=JE(e.tokens,e.index,e.parseInlineTokens,e.options);e.pushParsed(t),e.index=n;break}case`sub`:e.resetCurrentTextNode(),e.pushParsed({type:`subscript`,children:[{type:`text`,content:String(t.content??``),raw:String(t.content??``)}],raw:`~${String(t.content??``)}~`}),e.index++;break;case`sup`:e.resetCurrentTextNode(),e.pushParsed({type:`superscript`,children:[{type:`text`,content:String(t.content??``),raw:String(t.content??``)}],raw:`^${String(t.content??``)}^`}),e.index++;break;case`emoji`:{e.resetCurrentTextNode();let n=e.tokens[e.index-1];n?.type===`text`&&/\|:-+/.test(String(n.content??``))?e.pushText(``,``):e.pushParsed(pT(t)),e.index++;break}case`checkbox`:e.resetCurrentTextNode(),e.pushParsed(dT(t)),e.index++;break;case`checkbox_input`:e.resetCurrentTextNode(),e.pushParsed(fT(t)),e.index++;break;case`footnote_ref`:e.resetCurrentTextNode(),e.pushParsed(wT(t)),e.index++;break;case`footnote_anchor`:{e.resetCurrentTextNode();let n=t.meta??{},r=String(n.label??t.content??``);e.pushParsed({type:`footnote_anchor`,id:r,raw:String(t.content??``)}),e.index++;break}case`hardbreak`:e.resetCurrentTextNode(),e.pushParsed(TT()),e.index++;break;case`fence`:e.resetCurrentTextNode(),e.pushParsed(CT(e.tokens[e.index])),e.index++;break;case`math_inline`:jD(e,t),e.resetCurrentTextNode(),!t.content&&t.markup===`$`&&e.tokens[e.index+1]?.type===`text`&&e.tokens[e.index+2]?.type===`math_inline`?(e.pushParsed(WE({...t,content:e.tokens[e.index+1].content})),e.index+=2):e.pushParsed(WE(t)),e.index++;break;case`reference`:ND(e,t);break;case`text_special`:e.pushText(String(t.content??``),String(t.content??``)),e.index++;break;default:UE(e,t)}}function ND(e,t){e.resetCurrentTextNode(),e.pushParsed(GE(t)),e.index++}var PD=/[!$(*[\\\]_`|~]/;function FD(e,t,n,r){if(!e||e.length===0)return[];if(e.length===1&&e[0].type===`text`){let t=e[0].content;if(typeof t==`string`&&t&&t!==`<`&&!t.endsWith(`undefined`)&&!PD.test(t))return[{type:`text`,content:t,raw:t,center:!1}]}let i=Jy(r),a=i.linkifyDemotionContext,o=Ib(t),s={filename:a?.filename||o.filename,explicitFilename:a?.explicitFilename||o.explicitFilename,marketTicker:a?.marketTicker||o.marketTicker};(s.filename||s.explicitFilename||s.marketTicker)&&(i={...i,linkifyDemotionContext:s}),r=i;let c=r?.requireClosingStrong,l=e,u={currentTextNode:null,index:0,options:i,parseInlineTokens:FD,pPreToken:n,raw:t,requireClosingStrong:c,result:[],tokens:e,dispatchToken:e=>MD(u,e),ensureWorkingTokens:d,pushParsed:p,pushText:h,pushToken:m,resetCurrentTextNode:f};function d(){return u.tokens===l&&(u.tokens=u.tokens.slice()),u.tokens}function f(){u.currentTextNode=null}function p(e){f(),u.result.push(e)}function m(e){f();let t=NC(e);u.result.push(t)}function h(e,t){u.currentTextNode?(u.currentTextNode.content+=e,u.currentTextNode.raw+=t??e):(u.currentTextNode={type:`text`,content:String(e??``),raw:String(t??e??``)},u.result.push(u.currentTextNode))}for(;u.index<u.tokens.length;){let e=u.tokens[u.index];MD(u,e)}return u.result}function ID(e){let t=new WeakSet,n=e=>{if(!e||typeof e!=`object`||t.has(e))return;if(t.add(e),Array.isArray(e)){for(let t of e)n(t);return}let r=e;r.type===`html_block`&&r.loading===!0&&(r.loading=!1);for(let e of Object.values(r))n(e)};n(e)}function LD(e,t){let n=t.postTransformNodes;if(typeof n!=`function`)return e;let r=n(e);return Array.isArray(r)?r:e}function RD(e){let t=String(e.content??``),n=t.replace(/[ \t\r\n]+$/g,``);if(n===t)return;e.content=n;let r=e.children;if(Array.isArray(r)&&r.length!==0)for(;r.length;){let e=r[r.length-1];if(!e){r.pop();continue}if(e.type===`softbreak`||e.type===`hardbreak`){r.pop();continue}if(e.type===`text`){let t=String(e.content??``),n=t.replace(/[ \t\r\n]+$/g,``);if(n===t)break;if(n){e.content=n;break}r.pop();continue}break}}function zD(e){let t=String(e.content??``),n=t.match(/\r?\n\s*\d+[.)]?\s*$/);if(!n||typeof n.index!=`number`)return;e.content=t.slice(0,n.index);let r=e.children;if(Array.isArray(r)&&r.length!==0)for(;r.length;){let e=r[r.length-1];if(!e){r.pop();continue}if(e.type===`softbreak`||e.type===`hardbreak`){r.pop();continue}if(e.type===`text`){let t=String(e.content??``);if(/^[ \t\r\n\d.)]*$/.test(t)){r.pop();continue}let n=t.replace(/[ \t\r\n\d.)]+$/g,``);n!==t&&(n?e.content=n:r.pop())}break}}function BD(e){let t=String(e.content??``);return/[ \t\r\n]+$/.test(t)||/\r?\n\s*\d+[.)]?\s*$/.test(t)}function VD(e,t,n,r){let i=e[t],a=[],o=Ob(n,!0),s=t+1;for(;s<e.length&&e[s].type!==`bullet_list_close`&&e[s].type!==`ordered_list_close`;)if(e[s].type===`list_item_open`){let t=[],i=s+1;for(;i<e.length&&e[i].type!==`list_item_close`;)if(e[i].type===`paragraph_open`){let a=e[i+1],s=BD(a)?NC(a):a,c=e[i-1];s!==a&&(zD(s),RD(s));let l=String(s.content??``),u={type:`paragraph`,children:r(s.children||[],l,c,o.options()),raw:l};n?.includeSourceMap&&jC(u,e[i],n),t.push(u),o.remember(l),i+=3}else if(e[i].type===`blockquote_open`){let[n,a]=YD(e,i,o.options(),r);t.push(n),o.remember(n.raw),i=a}else if(e[i].type===`bullet_list_open`||e[i].type===`ordered_list_open`){let[n,a]=VD(e,i,o.options(),r);t.push(n),o.remember(n.raw),i=a}else{let n=SO(e,i,o.options(),JD,r);n?(t.push(n[0]),o.remember(n[0].raw),i=n[1]):i+=1}let c={type:`list_item`,children:t,raw:t.map(e=>e.raw).join(``)};n?.includeSourceMap&&jC(c,e[s],n),a.push(c),s=i+1}else s+=1;let c={type:`list`,ordered:i.type===`ordered_list_open`,start:(()=>{if(i.attrs&&i.attrs.length){let e=i.attrs.find(e=>e[0]===`start`);if(e){let t=Number(e[1]);return Number.isFinite(t)&&t!==0?t:1}}})(),items:a,raw:a.map(e=>e.raw).join(`
|
|
122
|
-
`)};return n?.includeSourceMap&&jC(c,i,n),[c,s+1]}function HD(e,t,n,r,i){let a=String(n[1]??`note`),o=String(n[2]??a.charAt(0).toUpperCase()+a.slice(1)),s=[],c=Ob(r,!0),l=t+1;for(;l<e.length&&e[l].type!==`container_close`;)if(e[l].type===`paragraph_open`){let t=e[l+1];if(t){let n={type:`paragraph`,children:i(t.children||[],String(t.content??``),void 0,c.options()),raw:String(t.content??``)};r?.includeSourceMap&&jC(n,e[l],r),s.push(n),c.remember(n.raw)}l+=3}else if(e[l].type===`bullet_list_open`||e[l].type===`ordered_list_open`){let[t,n]=VD(e,l,c.options(),i);r?.includeSourceMap&&jC(t,e[l],r),s.push(t),c.remember(t.raw),l=n}else if(e[l].type===`blockquote_open`){let[t,n]=YD(e,l,c.options(),i);r?.includeSourceMap&&jC(t,e[l],r),s.push(t),c.remember(t.raw),l=n}else{let t=xO(e,l,c.options(),i);t?(s.push(t[0]),c.remember(t[0].raw),l=t[1]):l++}return[{type:`admonition`,kind:a,title:o,children:s,raw:`:::${a} ${o}\n${s.map(e=>e.raw).join(`
|
|
123
|
-
`)}\n:::`},l+1]}var UD=new Set([`warning`,`info`,`note`,`tip`,`danger`,`caution`]);function WD(e){let t=0;for(;t<e.length&&t<3&&e[t]===`:`;)t++;if(t===0||e[t]===`:`)return null;let n=e.slice(t).trimStart();if(!n)return null;let r=n.search(/\s/),i=(r===-1?n:n.slice(0,r)).toLowerCase();return UD.has(i)?{kind:i,title:r===-1?``:n.slice(r).trim()}:null}function GD(e,t,n,r){let i=e[t],a=`note`,o=``,s=i.type.match(/^container_(\w+)_open$/);if(s){a=s[1];let e=String(i.info??``).trim();if(e&&!e.startsWith(`:::`)&&e.toLowerCase().startsWith(a)){let t=e.slice(a.length).trim();t&&(o=t)}}else{let e=WD(String(i.info??``).trim());e&&(a=e.kind,o=e.title)}o||=a.charAt(0).toUpperCase()+a.slice(1);let c=[],l=Ob(n,!0),u=t+1,d=RegExp(`^container_${a}_close$`);for(;u<e.length&&e[u].type!==`container_close`&&!d.test(e[u].type);)if(e[u].type===`paragraph_open`){let t=e[u+1];if(t){let i=t.children||[],a=-1;for(let e=i.length-1;e>=0;e--){let t=i[e];if(t.type===`text`&&/:+/.test(t.content)){a=e;break}}let o={type:`paragraph`,children:r((a===-1?i:i.slice(0,a))||[],void 0,void 0,l.options()),raw:String(t.content??``).replace(/\n:+$/,``).replace(/\n\s*:::\s*$/,``)};n?.includeSourceMap&&jC(o,e[u],n),c.push(o),l.remember(o.raw)}u+=3}else if(e[u].type===`bullet_list_open`||e[u].type===`ordered_list_open`){let[t,i]=VD(e,u,l.options(),r);n?.includeSourceMap&&jC(t,e[u],n),c.push(t),l.remember(t.raw),u=i}else if(e[u].type===`blockquote_open`){let[t,i]=YD(e,u,l.options(),r);n?.includeSourceMap&&jC(t,e[u],n),c.push(t),l.remember(t.raw),u=i}else{let t=xO(e,u,l.options(),r);t?(c.push(t[0]),l.remember(t[0].raw),u=t[1]):u++}return[{type:`admonition`,kind:a,title:o,children:c,raw:`:::${a} ${o}\n${c.map(e=>e.raw).join(`
|
|
124
|
-
`)}\n:::`},u+1]}var KD=/^::: ?(warning|info|note|tip|danger|caution|error) ?(.*)$/;function qD(e,t,n,r){let i=e[t];if(i.type!==`container_open`)return null;let a=KD.exec(String(i.info??``));return a?HD(e,t,a,n,r):null}var JD={parseContainer:(e,t,n,r)=>GD(e,t,n,r),matchAdmonition:qD};function YD(e,t,n,r){let i=[],a=Ob(n,!0),o=t+1;for(;o<e.length&&e[o].type!==`blockquote_close`;){let t=e[o];switch(t.type){case`paragraph_open`:{let s=e[o+1],c={type:`paragraph`,children:r(s.children||[],String(s.content??``),void 0,a.options()),raw:String(s.content??``)};n?.includeSourceMap&&jC(c,t,n),i.push(c),a.remember(c.raw),o+=3;break}case`bullet_list_open`:case`ordered_list_open`:{let[t,n]=VD(e,o,a.options(),r);i.push(t),a.remember(t.raw),o=n;break}case`blockquote_open`:{let[t,n]=YD(e,o,a.options(),r);i.push(t),a.remember(t.raw),o=n;break}default:{let t=SO(e,o,a.options(),JD,r);t?(i.push(t[0]),a.remember(t[0].raw),o=t[1]):o++;break}}}let s={type:`blockquote`,children:i,raw:i.map(e=>e.raw).join(`
|
|
125
|
-
`)};return n?.includeSourceMap&&jC(s,e[t],n),[s,o+1]}function XD(e){if(e.info?.startsWith(`diff`))return CT(e);let t=String(e.content??``),n=t.match(/ type="application\/vnd\.ant\.([^"]+)"/),r=t;n?.[1]&&(r=t.replace(/<antArtifact[^>]*>/g,``).replace(/<\/antArtifact>/g,``));let i=Array.isArray(e.map)&&e.map.length===2;return{type:`code_block`,language:n?n[1]:String(e.info??``),code:r,raw:r,loading:!i}}function ZD(e,t,n,r){let i=[],a=t+1,o=[],s=[],c=Ob(n,!0);for(;a<e.length&&e[a].type!==`dl_close`;)if(e[a].type===`dt_open`){let t=e[a+1];o=r(t.children||[],void 0,void 0,c.options()),c.remember(o.map(e=>e.raw).join(``)),a+=3}else if(e[a].type===`dd_open`){let t=a+1;for(s=[];t<e.length&&e[t].type!==`dd_close`;)if(e[t].type===`paragraph_open`){let n=e[t+1];s.push({type:`paragraph`,children:r(n.children||[],String(n.content??``),void 0,c.options()),raw:String(n.content??``)}),c.remember(String(n.content??``)),t+=3}else t++;o.length>0&&(i.push({type:`definition_item`,term:o,definition:s,raw:`${o.map(e=>e.raw).join(``)}: ${s.map(e=>e.raw).join(`
|
|
126
|
-
`)}`}),o=[]),a=t+1}else a++;return[{type:`definition_list`,items:i,raw:i.map(e=>e.raw).join(`
|
|
127
|
-
`)},a+1]}function QD(e,t,n,r){let i=e[t].meta??{},a=String(i?.label??`0`),o=[],s=Ob(n,!0),c=t+1;for(;c<e.length&&e[c].type!==`footnote_close`;)if(e[c].type===`paragraph_open`){let t=e[c+1],n=t.children?[...t.children]:[];e[c+2].type===`footnote_anchor`&&n.push(e[c+2]);let i={type:`paragraph`,children:r(n,String(t.content??``),void 0,s.options()),raw:String(t.content??``)};o.push(i),s.remember(i.raw),c+=3}else c++;return[{type:`footnote`,id:a,children:o,raw:`[^${a}]: ${o.map(e=>e.raw).join(`
|
|
128
|
-
`)}`},c+1]}function $D(e,t,n,r){let i=e[t],a=i.attrs,o=Array.isArray(a)&&a.length?Object.fromEntries(a.filter(e=>Array.isArray(e)&&e.length>=1&&e[0]).map(([e,t])=>[String(e),t==null||t===``||String(t)])):void 0,s=String(i.tag?.substring(1)??`1`),c=Number.parseInt(s,10),l=e[t+1],u=String(l.content??``);return{type:`heading`,level:c,text:u,...o?{attrs:o}:{},children:r(l.children||[],u,void 0,n),raw:u}}function eO(e){let t=String(e.content??``),n=e.raw===`$$`?`$$${t}$$`:String(e.raw??``);return{type:`math_block`,content:t,loading:!!e.loading,raw:n,markup:e.markup}}function tO(e){if(!e)return`left`;for(let t of e){if(!t)continue;let[e,n]=t;if(!n)continue;let r=String(n).trim().toLowerCase();if(e===`style`){let e=/text-align\s*:\s*(left|right|center)/i.exec(r);if(e)return e[1].toLowerCase()}}return`left`}function nO(e){return e?.filename===!0||e?.explicitFilename===!0||e?.marketTicker===!0}function rO(e,t){let n={filename:e?.filename||t?.filename,explicitFilename:e?.explicitFilename||t?.explicitFilename,marketTicker:e?.marketTicker||t?.marketTicker};return nO(n)?n:void 0}function iO(e,t,n){let r=rO(Ib(t),n);if(!nO(r))return e;let i=Jy(e),a=i.linkifyDemotionContext;return{...i,linkifyDemotionContext:{filename:a?.filename||r?.filename,explicitFilename:a?.explicitFilename||r?.explicitFilename,marketTicker:a?.marketTicker||r?.marketTicker}}}function aO(e,t,n,r){let i=t+1,a=null,o=[],s=!1;for(;i<e.length&&e[i].type!==`table_close`;)if(e[i].type===`thead_open`)s=!0,i++;else if(e[i].type===`thead_close`)s=!1,i++;else if(e[i].type===`tbody_open`||e[i].type===`tbody_close`)i++;else if(e[i].type===`tr_open`){let t=[],c=i+1,l;for(;c<e.length&&e[c].type!==`tr_close`;)if(e[c].type===`th_open`||e[c].type===`td_open`){let i=e[c].type===`th_open`,o=e[c+1],u=String(o.content??``),d=tO(e[c].attrs),f=t.length,p=!i&&!s,m=p?a?.cells[f]?.raw:void 0;t.push({type:`table_cell`,header:i||s,children:r(o.children||[],u,void 0,iO(n,m,p?l:void 0)),raw:u,align:d}),p&&(l=rO(l,Ib(u))),c+=3}else c++;let u={type:`table_row`,cells:t,raw:t.map(e=>e.raw).join(`|`)};s?a=u:o.push(u),i=c+1}else i++;a||={type:`table_row`,cells:[],raw:``};let c=e[t].loading===!0;return[{type:`table`,header:a,rows:o,loading:c&&!n?.final&&o.length===0,raw:[a,...o].map(e=>e.raw).join(`
|
|
129
|
-
`)},i+1]}function oO(){return{type:`thematic_break`,raw:`---`}}var sO=null,cO=new WeakMap;function lO(){return sO||={allowedTagSet:DT(),customTagSet:null},sO}function uO(e){if(!e||e.length===0)return lO();let t=cO.get(e);if(t)return t;let n=e.map(fy).filter(Boolean);if(!n.length){let t=lO();return cO.set(e,t),t}let r={allowedTagSet:DT({customHtmlTags:e}),customTagSet:new Set(n)};return cO.set(e,r),r}function dO(e,t,n,r){let i=e[t],a=i.attrs,o=``,s={};if(a){for(let[e,t]of a)if(e===`class`){let e=t.match(/(?:\s|^)vmr-container-(\S+)/);e&&(o=e[1])}else if(e.startsWith(`data-`)){let n=e.slice(5);try{s[n]=JSON.parse(t)}catch{s[n]=t}}}let c=[],l=Ob(n,!0),u=t+1;for(;u<e.length&&e[u].type!==`vmr_container_close`;)if(e[u].type===`paragraph_open`){let t=e[u+1];if(t){let i={type:`paragraph`,children:r(t.children||[],void 0,void 0,l.options()),raw:String(t.content??``)};n?.includeSourceMap&&jC(i,e[u],n),c.push(i),l.remember(i.raw)}u+=3}else if(e[u].type===`bullet_list_open`||e[u].type===`ordered_list_open`){let[t,i]=VD(e,u,l.options(),r);n?.includeSourceMap&&jC(t,e[u],n),c.push(t),l.remember(t.raw),u=i}else if(e[u].type===`blockquote_open`){let[t,i]=YD(e,u,l.options(),r);n?.includeSourceMap&&jC(t,e[u],n),c.push(t),l.remember(t.raw),u=i}else{let t=xO(e,u,l.options(),r);t?(c.push(t[0]),l.remember(t[0].raw),u=t[1]):u++}let d=u<e.length&&e[u].type===`vmr_container_close`,f=d&&i.meta?.unclosed!==!0||!!n?.final,p=`::: ${o}`;return Object.keys(s).length>0&&(p+=` ${JSON.stringify(s)}`),p+=`
|
|
130
|
-
`,c.length>0&&(p+=i.raw??c.map(e=>e.raw).join(`
|
|
131
|
-
`),p+=`
|
|
132
|
-
`),p+=`:::`,[{type:`vmr_container`,name:o,loading:!f,attrs:Object.keys(s).length>0?s:void 0,children:c,raw:p},d?u+1:u]}function fO(e,t,n,r){if(n?.type.endsWith(`_close`)){let i=Array.isArray(n.map)?Number(n.map[1]):NaN;return Number.isFinite(i)||(i=Array.isArray(t.map)?Number(t.map[1])+1:NaN),MC(e,t,i,r)}return jC(e,t,r)}function pO(e){return e.replace(/^\r?\n/,``).replace(/\r?\n$/,``)}var mO=new Map;function hO(e){let t=mO.get(e);if(t)return t;let n=sy(e);return t={strip:RegExp(`[\\t ]*<\\s*\\/\\s*${n}[^>]*$`,`i`),search:RegExp(`<\\s*${n}(?=\\s|>|/)`,`gi`),openAny:RegExp(`<\\s*${n}(?=\\s|>|/)`,`gi`),closeAny:RegExp(`<\\s*\\/\\s*${n}(?=\\s|>)`,`gi`)},mO.set(e,t),t}function gO(e,t){if(!e||!t)return e;let n=hO(t).strip;return e.replace(n,``)}function _O(e,t,n){if(!e||!t)return null;let{openAny:r,closeAny:i}=hO(t.toLowerCase()),a=0,o=Math.max(0,n);for(;o<e.length;){let t=e.indexOf(`<`,o);if(t===-1)break;if(i.lastIndex=t,i.exec(e)?.index===t){let n=cy(e.slice(t));if(n===-1)return null;if(a===0)return{start:t,end:t+n+1};a--,o=t+n+1;continue}if(r.lastIndex=t,r.exec(e)?.index===t){let n=cy(e.slice(t));if(n===-1)return null;let r=e.slice(t,t+n+1);/\/\s*>$/.test(r)||a++,o=t+n+1;continue}o=t+1}return null}function vO(e,t,n){if(!e||!t)return null;let{search:r,openAny:i,closeAny:a}=hO(t.toLowerCase());r.lastIndex=Math.max(0,n||0);let o=r.exec(e);if(!o||o.index==null)return null;let s=o.index,c=e.slice(s),l=cy(c);if(l===-1)return null;let u=s+l;if(/\/\s*>\s*$/.test(c.slice(0,l+1))){let t=u+1;return{raw:e.slice(s,t),start:s,end:t}}let d=1,f=u+1,p=t=>(i.lastIndex=t,i.exec(e)?.index===t),m=t=>(a.lastIndex=t,a.exec(e)?.index===t);for(;f<e.length;){let t=e.indexOf(`<`,f);if(t===-1)return{raw:e.slice(s),start:s,end:e.length};if(m(t)){let n=e.indexOf(`>`,t);if(n===-1)return null;if(d--,d===0){let t=n+1;return{raw:e.slice(s,t),start:s,end:t}}f=n+1;continue}if(p(t)){let n=cy(e.slice(t));if(n===-1)return null;d++,f=t+n+1;continue}f=t+1}return{raw:e.slice(s),start:s,end:e.length}}function yO(e){return Number.isFinite(e)&&e>0?e:0}function bO(e,t){let n=yO(t);if(!e||n<=0)return 0;let r=0;for(let t=0;t<e.length;t++)if(e[t]===`
|
|
133
|
-
`&&(r++,r===n))return t+1;return e.length}function xO(e,t,n,r){let i=e[t],a=n?.includeSourceMap===!0;switch(i.type){case`heading_open`:{let o=$D(e,t,n,r);return a&&jC(o,i,n),[o,t+3]}case`code_block`:{let e=XD(i);return a&&jC(e,i,n),[e,t+1]}case`fence`:{let e=CT(i);return a&&jC(e,i,n),[e,t+1]}case`math_block`:{let e=eO(i);return a&&jC(e,i,n),[e,t+1]}case`html_block`:{let e=TC(i),r=e.tag?uO(n?.customHtmlTags):null;if(e.tag&&e.loading&&r&&!r.allowedTagSet.has(e.tag)){let e=String(i.content??``).replace(/\n+$/,``),r={type:`paragraph`,children:e?[{type:`text`,content:e,raw:e}]:[],raw:e};return a&&jC(r,i,n),[r,t+1]}if(e.tag&&r?.customTagSet?.has(e.tag)){let r=e.tag,o=Ky(n)?n:void 0,s=String(o?.sourceMarkdown??``),c=Number(o?.customHtmlBlockCursor??0),l=Number(i.map?.[0]??0),u=Array.isArray(i.map)?o?.sourceLineOffsets?.[l]??bO(s,l):0,d=vO(s,r,Math.max(yO(c),yO(u)));d&&o&&(o.customHtmlBlockCursor=d.end);let f=String(d?.raw??e.raw??``),p=cy(f),m=p===-1?f:f.slice(0,p+1),h=p!==-1&&/\/\s*>\s*$/.test(m),g=p===-1?null:_O(f,r,p+1),_=g?.start??-1,v=``;p!==-1&&(v=_!==-1&&p<_?f.slice(p+1,_):f.slice(p+1)),_===-1&&(v=gO(v,r));let y=[],b=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,x;for(;(x=b.exec(m))!==null;){let e=x[1];if(!e||e.toLowerCase()===r)continue;let t=x[2]||x[3]||x[4]||``;y.push([e,t])}let S=!n?.final&&!h&&g==null,C={type:r,tag:r,content:pO(v),raw:String(d?.raw??e.raw??f),loading:S,attrs:y.length?y:void 0};return a&&(d?C.sourceMap=kC(s,d.start,d.end,n):jC(C,i,n)),[C,t+1]}return a&&jC(e,i,n),[e,t+1]}case`table_open`:{let[o,s]=aO(e,t,n,r);return a&&jC(o,i,n),[o,s]}case`dl_open`:{let[o,s]=ZD(e,t,n,r);return a&&jC(o,i,n),[o,s]}case`footnote_open`:{let[o,s]=QD(e,t,n,r);return a&&jC(o,i,n),[o,s]}case`hr`:{let e=oO();return a&&jC(e,i,n),[e,t+1]}}return null}function SO(e,t,n,r,i){let a=xO(e,t,n,i);if(a)return a;let o=e[t],s=n?.includeSourceMap===!0;switch(o.type){case`container_warning_open`:case`container_info_open`:case`container_note_open`:case`container_tip_open`:case`container_danger_open`:case`container_caution_open`:case`container_error_open`:if(r?.parseContainer){let a=r.parseContainer(e,t,n,i);return s&&fO(a[0],o,e[a[1]-1],n),a}break;case`container_open`:if(r?.matchAdmonition){let a=r.matchAdmonition(e,t,n,i);if(a)return s&&fO(a[0],o,e[a[1]-1],n),a}break;case`vmr_container_open`:{let r=dO(e,t,n,i);return s&&fO(r[0],o,e[r[1]-1],n),r}}return null}function CO(){return{type:`hardbreak`,raw:`\\
|
|
134
|
-
`}}function wO(e,t,n,r){let i=e[t+1],a=String(i.content??``);return{type:`paragraph`,children:r(i.children||[],a,void 0,n),raw:a}}function TO(e,t,n){let r=t?.map,i=n.sourceMarkdown,a=n.runtime;if(!Array.isArray(r)||r.length<2||typeof i!=`string`||!a)return;let o=Number(r[0]),s=Number(r[1]);if(!Number.isFinite(o)||!Number.isFinite(s))return;let c=n.sourceLineOffsets;if(!c){c=[0];for(let e=0;e<i.length;e++)i[e]===`
|
|
135
|
-
`&&c.push(e+1);n.sourceLineOffsets=c}a.nodeSourceRanges.set(e,{start:c[Math.max(0,Math.trunc(o))]??i.length,end:c[Math.max(0,Math.trunc(s))]??i.length})}function EO(e,t){return t.nodeSourceRanges.get(e)}function DO(e){return e}var OO=new Map;function kO(e){let t=e?.customHtmlTags;if(!Array.isArray(t)||t.length===0)return null;let n=t.join(`\0`),r=OO.get(n);if(r)return r;let i=py(t),a=i.length?new Set(i):null;return a&&OO.set(n,a),a}function AO(e){let t=e.raw;if(typeof t==`string`)return t;let n=DO(e).content;return typeof n==`string`?n:e.type===`hardbreak`?`<br>`:``}function jO(e){return{type:`paragraph`,children:e,raw:e.map(AO).join(``)}}function MO(e,t){if(t.sourceMap)for(let n of e)n.sourceMap||=t.sourceMap}function NO(e,t){if(e.type!==`paragraph`)return null;let n=DO(e).children,r=Array.isArray(n)?n:[];if(r.length===0)return null;let i=kO(t);if(!i?.size)return null;let a=-1;for(let e=0;e<r.length;e++){let t=r[e];if(!i.has(String(t?.type??``).toLowerCase()))continue;let n=r.slice(0,e);if(String(DO(t).content??``).trim()&&n.some(e=>e?.type===`hardbreak`)){a=e;break}}if(a===-1)return null;let o=r.slice(0,a),s=r[a];if(!s)return null;let c=[];o.length&&c.push(jO(o)),c.push(s);let l=r.slice(a+1);return l.length&&c.push(jO(l)),c}function PO(e,t,n){if(!e||!Array.isArray(e))return[];let r=[],i=[],a=Ob(t),o=t?.includeSourceMap===!0,s=0;for(;s<e.length;){let c=SO(e,s,a.options(),JD,n);if(c){TO(c[0],e[s],t),r.push(c[0]),a.remember(c[0].raw),i.push(a.snapshot()),s=c[1];continue}let l=e[s];switch(l.type){case`paragraph_open`:{let i=String(e[s+1]?.content??``),c=wO(e,s,a.options(i),n);o&&jC(c,l,t);let u=NO(c,t);if(u){o&&MO(u,c);for(let e of u)TO(e,l,t);r.push(...u)}else TO(c,l,t),r.push(c);a.remember(c.raw),s+=3;break}case`bullet_list_open`:case`ordered_list_open`:{let[i,c]=VD(e,s,a.options(),n);o&&jC(i,l,t),TO(i,l,t),r.push(i),a.remember(i.raw),s=c;break}case`blockquote_open`:{let[i,c]=YD(e,s,a.options(),n);o&&jC(i,l,t),TO(i,l,t),r.push(i),a.remember(i.raw),s=c;break}case`footnote_anchor`:{let e=l.meta??{},n={type:`footnote_anchor`,id:String(e.label??l.content??``),raw:String(l.content??``)};o&&jC(n,l,t),TO(n,l,t),r.push(n),a.remember(String(l.content??``)),s++;break}case`hardbreak`:r.push(CO()),a.reset(),s++;break;case`text`:{let e=String(l.content??``),n={type:`paragraph`,raw:e,children:e?[{type:`text`,content:e,raw:e}]:[]};o&&jC(n,l,t),TO(n,l,t),r.push(n),a.remember(e),s++;break}case`inline`:{let e=String(l.content??``),i=n(l.children||[],e,void 0,a.options(e));if(i.length!==0){if(i.every(e=>e.type===`html_block`)){if(o)for(let e of i)jC(e,l,t);for(let e of i)TO(e,l,t);r.push(...i)}else{let n={type:`paragraph`,raw:e,children:i};o&&jC(n,l,t);let a=NO(n,t);if(a){o&&MO(a,n);for(let e of a)TO(e,l,t);r.push(...a)}else TO(n,l,t),r.push(n)}}a.remember(e)}s+=1;break;default:s+=1}let u=a.snapshot();for(;i.length<r.length;)i.push(u)}return t.linkifyDemotionResultContexts=i,r}function FO(e,t){let n=e.sourceLineOffsets;if(n?.source===t)return n.offsets;if(n&&t.length>n.source.length&&e.sourceExtends(n.source,t)){let e=n.offsets;for(let r=n.source.length;r<t.length;r++)t.charCodeAt(r)===10&&e.push(r+1);return n.source=t,e}let r=[0];for(let e=0;e<t.length;e++)t.charCodeAt(e)===10&&r.push(e+1);return e.sourceLineOffsets={source:t,offsets:r},r}var IO=new WeakMap,LO=new WeakSet,RO=new WeakSet;function zO(e,t){return e.customHtmlTags===t.customHtmlTags&&e.hasCustomParserExtensions===t.hasCustomParserExtensions&&e.includeSourceMap===t.includeSourceMap&&e.postTransformNodes===t.postTransformNodes&&e.postTransformTokens===t.postTransformTokens&&e.preTransformTokens===t.preTransformTokens&&e.requireClosingStrong===t.requireClosingStrong&&e.reuseStableTopLevelNodes===t.reuseStableTopLevelNodes&&e.streamParse===t.streamParse&&e.validateLink===t.validateLink}var BO=class{constructor(e){this.streamParseEnvs=new Map,this.htmlPassIdentityPreserving=!1,this.detailsStitchCache=new WeakMap,this.nodeSourceRanges=new WeakMap,this.finalized=!1,this.resettingStream=!1,this.streamStateActive=!1,this.streamResetInCurrentRootParse=!1,this.markdownIt=e}sourceExtends(e,t){return this.sourceRelationPrevious===e&&this.sourceRelationCurrent===t?!0:t.startsWith(e)?(this.sourceRelationPrevious=e,this.sourceRelationCurrent=t,!0):!1}beginRootParse(e,t){this.streamResetInCurrentRootParse=!1;let n=this.documentSource!==void 0&&e!==this.documentSource&&!this.sourceExtends(this.documentSource,e),r=this.semantics!==void 0&&!zO(this.semantics,t);(this.finalized||n||r)&&this.resetDocument(this.streamStateActive),this.finalized=!1,this.documentSource=e,this.semantics=t}finishRootParse(e){this.sourceRelationPrevious=void 0,this.sourceRelationCurrent=void 0,e&&(this.clearDocumentCaches(),this.documentSource=void 0,this.semantics=void 0,this.finalized=!0)}resetForFinalAutoParse(){this.streamResetInCurrentRootParse||this.resetStreamOnly(),this.clearDocumentCaches()}markStreamParseStarted(){this.streamStateActive=!0}resetDocument(e){e&&this.resetStreamOnly(),this.clearDocumentCaches(),this.documentSource=void 0,this.semantics=void 0,this.finalized=!1}resetStreamOnly(){let e=this.markdownIt.stream,t=e?.reset;if(e&&typeof t==`function`){this.resettingStream=!0;try{t.call(e),this.streamStateActive=!1,this.streamResetInCurrentRootParse=!0}finally{this.resettingStream=!1}}}isResettingStream(){return this.resettingStream}handleExternalStreamReset(){this.streamStateActive=!1,this.streamResetInCurrentRootParse=!0,this.clearDocumentCaches(),this.documentSource=void 0,this.semantics=void 0,this.finalized=!1}invalidateConfiguration(){this.resetDocument(!0)}dispose(){this.resetDocument(!0),IO.delete(this.markdownIt)}clearDocumentCaches(){this.safeMarkdown=void 0,this.tolerantMathBoundary=void 0,this.pendingExplicitMathTail=void 0,this.streamParseEnvs.clear(),this.topLevelStreamParseMode=void 0,this.structuredStream=void 0,this.htmlPassIdentityPreserving=!1,this.siblingHtmlChildren=void 0,this.detailsStitchCache=new WeakMap,this.nodeSourceRanges=new WeakMap,this.sourceLineOffsets=void 0,this.sourceRelationPrevious=void 0,this.sourceRelationCurrent=void 0}};function VO(e){let t=e,n=e;if(!LO.has(t)){LO.add(t);let r=e.use;e.use=function(...e){try{return n.__markstreamHasCustomParserExtensions=!0,Reflect.apply(r,this,e)}finally{IO.get(t)?.invalidateConfiguration()}};let i=e.set;e.set=function(...e){try{return Reflect.apply(i,this,e)}finally{IO.get(t)?.invalidateConfiguration()}}}let r=e.stream;if(!r||typeof r.reset!=`function`)return;let i=r;if(RO.has(i))return;RO.add(i);let a=r.reset;r.reset=function(...e){let n=IO.get(t);try{return Reflect.apply(a,this,e)}finally{n?.isResettingStream()||n?.handleExternalStreamReset()}}}function HO(e){let t=e,n=IO.get(t);return n||(n=new BO(e),IO.set(t,n)),VO(e),n}function UO(e,t){if(e===t)return;let n=e.split(/\r?\n/),r=t.split(/\r?\n/),i=[],a=0;for(let e=0;e<r.length;e++){let t=r[e]??``;if(n[a]===t){i[e]={startLine:a,endLine:a+1},a++;continue}let o=n[a]??``;if(t!==``&&o!==t&&o.startsWith(t)){let n=t,s=-1;for(let t=e+1;t<r.length;t++){if(n+=r[t]??``,n===o){s=t;break}if(!o.startsWith(n))break}if(s!==-1){for(let t=e;t<=s;t++)i[t]={startLine:a,endLine:a+1};a++,e=s;continue}i[e]={startLine:a,endLine:a+1};continue}let s=n[a]??``,c=-1;for(let e=a+1;e<n.length;e++){if(s+=`\\n${n[e]??``}`,s===t){c=e+1;break}if(!t.startsWith(s))break}if(c!==-1){i[e]={startLine:a,endLine:c},a=c;continue}let l=-1;if(t!==``){let e=Math.min(n.length,a+80);for(let r=a;r<e;r++)if(n[r]===t){l=r;break}}if(l!==-1){i[e]={startLine:l,endLine:l+1},a=l+1;continue}let u=Math.min(Math.max(0,n.length-1),Math.max(0,a-1));i[e]={startLine:u,endLine:u+1}}return e=>{let t=Number.isFinite(e)?Math.max(0,Math.trunc(e)):0;if(t<i.length)return i[t]??{startLine:0,endLine:0};let r=i[i.length-1]??{startLine:Math.max(0,n.length-1),endLine:n.length},a=Math.min(n.length,r.endLine+t-i.length);return{startLine:a,endLine:Math.min(n.length,a+1)}}}var WO=new Map;function GO(e){let t=WO.get(e);return t||(t=new RegExp(String.raw`(^[\t ]*<\s*\/\s*${e}\s*>[\t ]*)(\r?\n)(?![\t ]*\r?\n|$)`,`gim`),WO.size>=64&&WO.clear(),WO.set(e,t)),t}function KO(e){let t=e=>e===` `||e===` `||e===`
|
|
136
|
-
`||e===`\r`,n=e=>{if(!e||e[0]!==`<`||e.includes(`>`))return!1;let n=1;if(n<e.length&&t(e[n])||e.startsWith(`<!--`)||e.startsWith(`<?`)||e.startsWith(`<!`)||e[n]===`/`&&(n++,n<e.length&&t(e[n])))return!1;let r=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122},i=e=>{let t=e.charCodeAt(0);return t>=48&&t<=57},a=e=>e===`!`||r(e),o=e=>r(e)||i(e)||e===`:`||e===`-`,s=e=>r(e)||i(e)||e===`_`||e===`.`||e===`:`||e===`-`,c=s;if(n>=e.length||!a(e[n]))return!1;for(n++;n<e.length&&o(e[n]);)n++;for(;n<e.length;){for(;n<e.length&&t(e[n]);)n++;if(n>=e.length)return!0;if(e[n]===`/`){for(n++;n<e.length&&t(e[n]);)n++;return n>=e.length}if(!s(e[n]))return!1;for(n++;n<e.length&&c(e[n]);)n++;for(;n<e.length&&t(e[n]);)n++;if(n<e.length&&e[n]===`=`){for(n++;n<e.length&&t(e[n]);)n++;if(n>=e.length)return!0;let r=e[n];if(r===`"`||r===`'`){for(n++;n<e.length&&e[n]!==r;)n++;if(n>=e.length)return!0;n++}else{for(;n<e.length;){let r=e[n];if(t(r)||r===`<`||r===`>`||r===`"`||r===`'`||r==="`")break;n++}if(n>=e.length)return!0}}}return!0},r=String(e??``),i=r.lastIndexOf(`<`);if(i===-1)return r;if(i>0){let e=r[i-1],t=e===` `||e===` `||e===`
|
|
137
|
-
`||e===`\r`,n=r[i-2];if(!t&&(e!==`n`&&e!==`r`||n!==`\\`))return r}let a=r.slice(i);return a.includes(`>`)||a.length>1&&(a[1]===` `||a[1]===` `||a[1]===`
|
|
138
|
-
`||a[1]===`\r`)||!n(a)||sw(r,i)?r:r.slice(0,i)}function qO(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()).filter(Boolean));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},a=e=>{if(!e)return!1;if(e[0]===` `)return!0;let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===` `){if(t++,t>=4)return!0;continue}if(r===` `)return!0;break}return!1},o=e=>{let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`){r++;continue}if(!n&&i===`'`){t=!t;continue}if(!t&&i===`"`){n=!n;continue}if(!t&&!n&&i===`>`)return r}return-1},s=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;let n=e[t];if(n!=="`"&&n!==`~`)return null;let i=t;for(;i<e.length&&e[i]===n;)i++;let a=i-t;return a<3?null:{markerChar:n,markerLen:a,rest:e.slice(i)}},c=(t,s)=>{if(a(t))return-1;let c=t.replace(/^[ \t]+/,``);if(!c||c.startsWith(`>`)||c.startsWith(`|`)||/^(?:[*+-]|\d+[.)])[\t ]+/.test(c))return-1;let l=!1,u=0;for(;u<t.length;){let a=t[u];if(a!==`<`){r(a)||(l=!0),u++;continue}let c=o(t.slice(u));if(c===-1){l=!0,u++;continue}let d=t.slice(u,u+c+1),f=1;for(;f<d.length&&r(d[f]);)f++;if(f>=d.length){l=!0,u++;continue}let p=d[f];if(p===`!`||p===`?`){l=!0,u+=c+1;continue}if(p===`/`){l=!0,u+=c+1;continue}let m=f;for(;f<d.length&&i(d[f]);)f++;if(f===m){l=!0,u++;continue}let h=d.slice(m,f).toLowerCase(),g=d[f];if(g&&g!==` `&&g!==` `&&g!==`>`&&g!==`/`){l=!0,u++;continue}let _=new RegExp(String.raw`<\s*\/\s*${h}\s*>`,`i`),v=/\/\s*>$/.test(d),y=_.test(t.slice(u+c+1)),b=_.test(e.slice(s+u+c+1)),x=/[\r\n]/.test(e.slice(s+u+c+1));if(l&&n.has(h)&&!v&&!y&&(b||x))return u;l=!0,u+=c+1}return-1},l=!1,u=``,d=0,f=``,p=0;for(;p<e.length;){let t=e.indexOf(`
|
|
139
|
-
`,p),n=t!==-1,r=n&&t>p&&e[t-1]===`\r`,i=n?r?t-1:t:e.length,a=e.slice(p,i),o=n?r?`\r
|
|
140
|
-
`:`
|
|
141
|
-
`:``,m=s(a),h=a;if(!l&&!m){let e=c(a,p);if(e!==-1){let t=o||`
|
|
142
|
-
`;h=`${a.slice(0,e).replace(/[ \t]+$/,``)}${t}${t}${a.slice(e).replace(/^[ \t]+/,``)}`}}f+=h,f+=o,m&&(l?m.markerChar===u&&m.markerLen>=d&&/^\s*$/.test(m.rest)&&(l=!1,u=``,d=0):(l=!0,u=m.markerChar,d=m.markerLen)),p=n?t+1:e.length}return f}function JO(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`},a=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;return e.slice(t)},o=e=>{let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`){r++;continue}if(!n&&i===`'`){t=!t;continue}if(!t&&i===`"`){n=!n;continue}if(!t&&!n&&i===`>`)return r}return-1},s=(e,t,n)=>{let a=n.toLowerCase(),o=e.indexOf(`<`,t);for(;o!==-1;){let t=o+1;for(;t<e.length&&r(e[t]);)t++;if(t>=e.length||e[t]!==`/`){o=e.indexOf(`<`,o+1);continue}for(t++;t<e.length&&r(e[t]);)t++;if(t+a.length>e.length){o=e.indexOf(`<`,o+1);continue}let n=!0;for(let r=0;r<a.length;r++){let i=e[t+r];if((i>=`A`&&i<=`Z`?String.fromCharCode(i.charCodeAt(0)+32):i)!==a[r]){n=!1;break}}if(!n){o=e.indexOf(`<`,o+1);continue}let s=t+a.length;if(s<e.length&&i(e[s])){o=e.indexOf(`<`,o+1);continue}for(;s<e.length&&r(e[s]);)s++;if(s<e.length&&e[s]===`>`)return!0;o=e.indexOf(`<`,o+1)}return!1},c=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;if(t>=e.length||e[t]!==`<`)return e;for(t++;t<e.length&&r(e[t]);)t++;if(t>=e.length||e[t]===`/`)return e;let c=t;for(;t<e.length&&i(e[t]);)t++;if(t===c)return e;let l=e.slice(c,t).toLowerCase();if(!n.has(l))return e;let u=o(e.slice(t));if(u===-1)return e;let d=t+u;if(s(e,d+1,l))return e;let f=a(e.slice(d+1));return f?`${e.slice(0,d+1)}\n${f}`:e},l=``,u=0;for(;u<e.length;){let t=e.indexOf(`
|
|
143
|
-
`,u);if(t===-1){l+=c(e.slice(u));break}let n=t>u&&e[t-1]===`\r`,r=n?t-1:t,i=e.slice(u,r);l+=c(i),l+=n?`\r
|
|
144
|
-
`:`
|
|
145
|
-
`,u=t+1}return l}function YO(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{let t=0,n=!1,i=0;for(;t<e.length;){for(;t<e.length&&r(e[t]);)t++;if(t>=e.length||e[t]!==`>`)break;for(n=!0,t++;t<e.length&&r(e[t]);)t++;i=t}return n?{prefix:e.slice(0,i),content:e.slice(i)}:null},a=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;let n=e[t];if(n!=="`"&&n!==`~`)return null;let i=t;for(;i<e.length&&e[i]===n;)i++;let a=i-t;return a<3?null:{markerChar:n,markerLen:a,rest:e.slice(i)}},o=Array.from(n).map(e=>new RegExp(String.raw`(<\s*\/\s*${e}\s*>)${"(?=[\\t ]*(?:#{1,6}[\\t ]+|>|(?:[*+-]|\\d+[.)])[\\t ]+|(?:`{3,}|~{3,})|\\||\\$\\$|:{3,}|\\[\\^[^\\]]+\\]:|(?:-{3,}|\\*{3,}|_{3,})))"}`,`gi`)),s=!1,c=``,l=0,u=``,d=0;for(;d<e.length;){let t=e.indexOf(`
|
|
146
|
-
`,d),n=t!==-1,r=n&&t>d&&e[t-1]===`\r`,f=n?r?t-1:t:e.length,p=e.slice(d,f),m=n?r?`\r
|
|
147
|
-
`:`
|
|
148
|
-
`:``,h=i(p),g=h?.prefix??``,_=h?.content??p,v=a(_);v&&(s?v.markerChar===c&&v.markerLen>=l&&/^\s*$/.test(v.rest)&&(s=!1,c=``,l=0):(s=!0,c=v.markerChar,l=v.markerLen));let y=_;if(!s&&y.includes(`</`))for(let e of o)y=y.replace(e,(e,t,n,r)=>{if(r.replace(/^[\t ]+/,``).startsWith(`|`))return e;let i=r.slice(0,n).replace(/^[\t ]+/,``);if(i.length>0){let n=t.match(/^<\s*\/\s*([A-Z][\w:-]*)/i)?.[1]?.toLowerCase()??``,r=i.match(/^<\s*([A-Z][\w:-]*)/i)?.[1]?.toLowerCase()??``;if(!n||!r||n!==r)return e}return`${t}\n\n`});if(g){let e=g+y.split(`
|
|
149
|
-
`).join(`\n${g}`);u+=e}else u+=y;u+=m,d=n?t+1:e.length}return u}function XO(e,t){if(!e||!t.length)return e;let n=new Set(t.map(e=>String(e??``).toLowerCase()));if(!n.size)return e;let r=e=>e===` `||e===` `,i=e=>{if(!e)return!1;if(e[0]===` `)return!0;let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===` `){if(t++,t>=4)return!0;continue}if(r===` `)return!0;break}return!1},a=e=>{let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||e===`_`||e===`-`||e===`:`},o=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;return e.slice(t)},s=e=>{let t=0,n=!1,i=0;for(;t<e.length;){for(;t<e.length&&r(e[t]);)t++;if(t>=e.length||e[t]!==`>`)break;for(n=!0,t++;t<e.length&&r(e[t]);)t++;i=t}if(!n)return null;let a=e.slice(0,i);return{prefix:a,key:a.replace(/[ \t]+$/,``),content:e.slice(i)}},c=e=>o(e).startsWith(`<`),l=e=>{for(let t=0;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `)return!1}return!0},u=e=>{if(i(e))return``;let t=o(e);if(!t.startsWith(`<`))return``;let s=1;for(;s<t.length&&r(t[s]);)s++;if(s>=t.length||t[s]===`/`||t[s]===`!`||t[s]===`?`)return``;let c=s;for(;s<t.length&&a(t[s]);)s++;if(s===c)return``;let l=t.slice(c,s).toLowerCase();if(!n.has(l))return``;let u=t[s];return u&&u!==` `&&u!==` `&&u!==`>`&&u!==`/`?``:l},d=e=>{if(i(e))return null;let t=o(e);if(!t.startsWith(`<`))return null;let s=1;for(;s<t.length&&r(t[s]);)s++;if(s>=t.length)return null;let c=t[s]===`/`;if(c)for(s++;s<t.length&&r(t[s]);)s++;let l=t[s];if(!l||l===`!`||l===`?`)return null;let u=s;for(;s<t.length&&a(t[s]);)s++;if(s===u)return null;let d=t.slice(u,s).toLowerCase();if(!n.has(d))return null;let f=t[s];if(f&&f!==` `&&f!==` `&&f!==`>`&&f!==`/`)return null;if(c)return{type:`close`,name:d};if(/\/\s*>\s*$/.test(t))return{type:`open`,name:d,complete:!0};let p=t.indexOf(`>`,s);if(p!==-1){let e=t.slice(p+1);if(RegExp(`<\\s*\\/\\s*${d}\\s*>`,`i`).test(e))return{type:`open`,name:d,complete:!0}}return{type:`open`,name:d,complete:!1}},f=e=>{if(i(e))return null;let t=o(e).replace(/[ \t]+$/,``);if(!t.startsWith(`<`)||/^<\s*(?:!--|!doctype\b|\?)/i.test(t))return null;let n=t.match(/^<\s*([A-Z][\w:-]*)\b[^>]*\/\s*>\s*$/i);if(n?.[1])return n[1].toLowerCase();let r=t.match(/^<\s*([A-Z][\w:-]*)\b[^>]*>[\s\S]*<\s*\/\s*([A-Z][\w:-]*)\s*>\s*$/i);if(!r?.[1]||!r[2])return null;let a=r[1].toLowerCase();return a===r[2].toLowerCase()?a:null},p=!1,m=``,h=0,g=e=>{let t=0;for(;t<e.length&&r(e[t]);)t++;let n=e[t];if(n!=="`"&&n!==`~`)return null;let i=t;for(;i<e.length&&e[i]===n;)i++;let a=i-t;return a<3?null:{markerChar:n,markerLen:a,rest:e.slice(i)}},_=e=>g(e),v=e=>{let t=o(e);return t?i(e)?!0:/^(?:#{1,6}[ \t]+|>|[*+-][ \t]+|\d+[.)][ \t]+|`{3,}|~{3,}|\||\$\$|:{3,}|\[\^[^\]]+\]:|-{3,}|\*{3,}|_{3,})/.test(t):!1},y=(t,n,r)=>{let i=t,a=0;for(;i<e.length;){let t=e.indexOf(`
|
|
150
|
-
`,i),o=t!==-1,c=o&&t>i&&e[t-1]===`\r`,u=o?c?t-1:t:e.length,f=e.slice(i,u),p=s(f),m=p?.key??``;if(a>0&&n&&m!==n)break;let h=p?.content??f,g=d(h);if(g?.name===r){if(g.type===`open`)g.complete||a++;else if(a>0&&(a--,a===0))return!1}else if(a>0&&(l(h)||v(h)))return!0;if(o)i=t+1;else break}return!1},b=``,x=0,S=!0,C=!1,w=!1,T=`
|
|
151
|
-
`,E=[],D=``;for(;x<e.length;){let t=e.indexOf(`
|
|
152
|
-
`,x),n=t!==-1,r=n&&t>x&&e[t-1]===`\r`,i=n?r?t-1:t:e.length,a=e.slice(x,i),o=n?r?`\r
|
|
153
|
-
`:`
|
|
154
|
-
`:``,g=s(a),v=g?.key??``,O=g?.content??a,k=_(O);k&&(p?k.markerChar===m&&k.markerLen>=h&&/^\s*$/.test(k.rest)&&(p=!1,m=``,h=0):(p=!0,m=k.markerChar,h=k.markerLen));let A=E.length>0;if(!p&&!A){let e=u(O),t=!!e&&!S&&C&&w&&y(x,v,e);e&&!S&&(!C||t)&&(v&&D&&v===D?b+=`${v}${T}`:v||(b+=T))}if(b+=a,b+=o,o&&(T=o),!p){let e=d(O);if(e){if(e.type===`open`)e.complete||E.push(e.name);else for(let t=E.length-1;t>=0;t--)if(E[t]===e.name){E.length=t;break}}}let j=l(O);S=j,C=!j&&c(O),w=!j&&!!f(O),D=v,x=n?t+1:e.length}return b}function ZO(e,t,n){let r=e;if(t?.length&&r.includes(`<`)){let e=py(t);if(e.length&&(r=qO(r,e),r=JO(r,e),r=XO(r,e),r=YO(r,e),r.includes(`</`)))for(let t of e)r=r.replace(GO(t),`$1$2$2`)}return n||(r=KO(r)),r}var QO=1024,$O=16;function ek(e,t,n){let r=e.replace(/([^\\])\r(ight|ho)/g,`$1\\r$2`),i=yw(r);return r=r.replace(/([^\\])\r?\n(abla|eq|ot|exists)/g,(e,t,n,r)=>{i.scanTo(r+1);let a=i.inMath();return i.scanTo(r+e.length),a?`${t}\\n${n}`:e}),t||(r.endsWith(`- *`)&&(r=r.replace(/- \*$/,`- \\*`)),/(?:^|\n)\s*-\s*$/.test(r)?r=r.replace(/(?:^|\n)\s*-\s*$/,e=>e.startsWith(`
|
|
155
|
-
`)?`
|
|
156
|
-
`:``):/(?:^|\n)\s*--\s*$/.test(r)?r=r.replace(/(?:^|\n)\s*--\s*$/,e=>e.startsWith(`
|
|
157
|
-
`)?`
|
|
158
|
-
`:``):/(?:^|\n)\s*>\s*$/.test(r)?r=r.replace(/(?:^|\n)\s*>\s*$/,e=>e.startsWith(`
|
|
159
|
-
`)?`
|
|
160
|
-
`:``):/\n\s*[*+]\s*$/.test(r)?r=r.replace(/\n\s*[*+]\s*$/,`
|
|
161
|
-
`):/(?:^|\n)\s*\d+\s*$/.test(r)?/^\d+$/.test(r.trim())||(r=r.replace(/(?:^|\n)\s*\d+\s*$/,e=>e.startsWith(`
|
|
162
|
-
`)?`
|
|
163
|
-
`:``)):/(?:^|\n)\s*\d+[.)]\s+\*{1,3}\s*$/.test(r)?r=r.replace(/((?:^|\n)\s*\d+[.)]\s+)(\*{1,3})\s*$/,(e,t,n)=>`${t}${n.split(``).map(()=>`\\*`).join(``)}`):/(?:^|\n)\s*\d+[.)]\s*$/.test(r)?r=r.replace(/(?:^|\n)\s*\d+[.)]\s*$/,e=>e.startsWith(`
|
|
164
|
-
`)?`
|
|
165
|
-
`:``):/\n[[(]\n*$/.test(r)&&(r=r.replace(/(\n\[|\n\()+\n*$/g,`
|
|
166
|
-
`)),r=uw(r,n.customHtmlTags)??r),r=ZO(r,n.customHtmlTags,t),r}function tk(e,t,n,r){let i=`${n?`final`:`stream`}:${(r.customHtmlTags??[]).join(`,`)}`,a=r.isFragment?void 0:e.safeMarkdown,o;if(!n&&!r.customHtmlTags?.length&&a&&a.mode===i&&t.length>=a.source.length&&e.sourceExtends(a.source,t)){let e=Math.max(0,a.source.length-QO-$O),i=ek(t.slice(e),n,r),s=a.source.length-e;o=i.length>=s&&i.slice(0,s)===a.safeMarkdown.slice(-s)?a.safeMarkdown.slice(0,a.safeMarkdown.length-s)+i:ek(t,n,r)}else o=ek(t,n,r);return n||(o=pw(o,e,!r.isFragment)),r.isFragment||(e.safeMarkdown={source:t,safeMarkdown:o,mode:i}),o}function nk(){return typeof performance<`u`?performance.now():Date.now()}function rk(e,t,n){e&&(e[t]=(e[t]??0)+n)}function ik(e){return e.parserMetrics}function ak(e,t,n){return t&&rk(t,`parseMarkdownToStructureTotalMs`,nk()-n),e}function ok(e,t,n,r){return ak(LD(e,t),n,r)}function sk(e,t,n){if(!n)return PO(e,t,FD);rk(n,`processTokensInputTokens`,e.length);let r=nk(),i=PO(e,t,FD);return rk(n,`processTokensMs`,nk()-r),i}function ck(e,t){let n=e,r=typeof n.validateLink==`function`&&n.__markstreamOriginalValidateLink&&n.validateLink!==n.__markstreamOriginalValidateLink?n.validateLink:void 0;return t.validateLink??r??n.options?.validateLink??(typeof n.validateLink==`function`?n.validateLink:void 0)}function lk(e,t){let n=t.runtime,r=t.markdownIt,i={...t,customHtmlBlockCursor:0,sourceLineOffsets:void 0},a=ik(i),o=a?{recordTokenCloneMs:e=>rk(a,`tokenCloneMs`,e)}:void 0,s=a?nk():0,c=!!i.final,l=(e??``).toString();i.isFragment||ww(n,i);let u=tk(n,l,c,i);a&&rk(a,`safeMarkdownMs`,nk()-s);let d=lC(u);if(d){if(i.includeSourceMap){let e={...i,sourceLineMapper:UO(l,u)};d[0].sourceMap=kC(u,0,u.length,e)}let e=i.preTransformTokens,t=i.postTransformTokens;if(Sw(n,i)||typeof e==`function`||typeof t==`function`){let r=Mw(n,u,{__markstreamFinal:c},i,o),a=typeof e==`function`&&e(r)||r;typeof t==`function`&&t(a)}return ok(d,i,a,s)}let f=a?nk():0,p=Mw(n,u,{__markstreamFinal:c},i,o);if(a&&rk(a,`tokenizeMs`,nk()-f),!p||!Array.isArray(p))return ok([],i,a,s);let m=i.preTransformTokens,h=i.postTransformTokens,g=p;m&&typeof m==`function`&&(g=m(g)||g);let _={...i,sourceLineMapper:i.includeSourceMap===!0?UO(l,u):void 0,sourceMarkdown:u,sourceLineOffsets:FO(n,u),customHtmlBlockCursor:0},v=Kw(n,u,g,_,{processTokens:(e,t)=>sk(e,t,a),recordReusedTopLevelNodes:e=>rk(a,`processTokensReusedTopLevelNodes`,e)});if(h&&typeof h==`function`){let e=h(g);if(Array.isArray(e)){let t=e[0],n=t?.type;v=t&&typeof n==`string`?sk(e,{..._,customHtmlBlockCursor:0},a):e}}let y=n.structuredReuseTailStart,b=y&&y>0&&y<v.length?y:0;if(aT(v)){let e=a?nk():0,t={getInternalNodeSourceRange:e=>EO(e,n),markdownIt:r,parseFragment:(e,t)=>lk(e,t)},i=b>0&&n.htmlPassIdentityPreserving,o=i?EO(v[b],n)?.start:void 0,s=!1;for(let e=i?b:0;e<v.length;e++){let t=v[e];if(t.type===`html_block`&&String(t.tag??``).toLowerCase()===`details`){s=!0;break}}let l=i&&!s&&o!=null,d=l?v.slice(0,b):[],f=l?v.slice(b):v,p=l?o:0,m=uT(f,c,u,t,_,p),h=m.length===f.length&&m.every((e,t)=>e===f[t]);s&&(m=lT(m,u,t,_,c,p)[0]),m=iT(m,t,_,c),v=l?d.concat(m):m,n.htmlPassIdentityPreserving=!s&&h,a&&rk(a,`htmlBlockPassesMs`,nk()-e)}else n.htmlPassIdentityPreserving=!0;return c&&ID(v),v=LD(v,i),i.debug&&console.log(`Parsed Markdown Tree Structure:`,v),ak(v,a,s)}function uk(e,t,n={}){let r=(e??``).toString(),i=HO(t),a=ck(t,n),o=qy(n,{markdownIt:t,runtime:i,validateLink:a}),s=t;i.beginRootParse(r,{customHtmlTags:(n.customHtmlTags??[]).join(`\0`),hasCustomParserExtensions:s.__markstreamHasCustomParserExtensions===!0,includeSourceMap:n.includeSourceMap===!0,postTransformNodes:n.postTransformNodes,postTransformTokens:n.postTransformTokens,preTransformTokens:n.preTransformTokens,requireClosingStrong:n.requireClosingStrong,reuseStableTopLevelNodes:n.reuseStableTopLevelNodes===!0,streamParse:n.streamParse,validateLink:a});try{return lk(r,o)}finally{i.finishRootParse(n.final===!0)}}var dk=/\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g,fk=/\d/u,pk=/[,.!?;:,。;、!?:]/u,mk=/\d\p{Script=Han}{1,3}$/u;function hk(e){return e.pos>0&&e.pos+1<e.posMax&&fk.test(e.src[e.pos-1])&&fk.test(e.src[e.pos+1])}function gk(e,t,n,r,i,a={}){let o=e.charCodeAt(0);return(e,s)=>{let c=e,l=c.posMax,u=c.pos;if(c.src.charCodeAt(u)!==o||s||a.refuseDigitRange&&hk(c))return!1;c.pos=u+1;let d=!1;for(;c.pos<l;){if(c.src.charCodeAt(c.pos)===o){d=!0;break}c.md.inline.skipToken(c)}if(!d||u+1===c.pos)return c.pos=u,!1;let f=c.src.slice(u+1,c.pos);if(!f||f.match(/(^|[^\\])(\\\\)*\s/))return c.pos=u,!1;let p=c.src[c.pos+1],m=fk.test(f[0]),h=p!==void 0&&fk.test(p);if(m&&h&&(mk.test(c.src.slice(0,u))||pk.test(f)||fk.test(f[f.length-1])))return c.pos=u,!1;let g=c.push(n,i,1);g.markup=t;let _=c.push(`text`,``,0);_.content=f.replace(dk,`$1`);let v=c.push(r,i,-1);return v.markup=t,c.pos+=1,!0}}function _k(e){let t=gk(`~`,`~`,`sub_open`,`sub_close`,`sub`,{refuseDigitRange:!0});e.inline.ruler.after(`emphasis`,`sub`,t)}var vk=new Set([...zv,`base`,`button`,`datalist`,`dialog`,`embed`,`fieldset`,`form`,`iframe`,`input`,`legend`,`link`,`meta`,`object`,`optgroup`,`option`,`output`,`param`,`select`,`style`,`template`,`textarea`,`title`]),yk=new Set(`a.abbr.b.blockquote.br.caption.code.col.colgroup.dd.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.ins.kbd.li.mark.ol.p.picture.pre.s.small.source.span.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.ul`.split(`.`));function bk(e){return/^[^\s"'<>`=]+$/.test(e)&&!/^on/i.test(e)}function xk(e){return String(e??``).trim().toLowerCase()}function Sk(e,t=`safe`){let n=xk(e);return n?t===`escape`?!0:t===`trusted`?zv.has(n):!yk.has(n):!1}function Ck(e,t=`safe`){let n=xk(e);return n?t===`escape`?!0:t===`trusted`?zv.has(n):vk.has(n):!1}function wk(e,t){let n=e.split(`,`).map(e=>e.trim()).filter(Boolean);return n.length!==0&&n.some(e=>{let n=e.split(/\s+/,1)[0]??``;return!n||$v(n,{tagName:t,attrName:`srcset`})})}function Tk(e,t,n,r){return Lv.has(e)||n===`safe`&&e===`style`?!0:e===`srcset`?wk(t,r):!!(Rv.has(e)&&t&&$v(t,{tagName:r,attrName:e}))}function Ek(e,t){let n=t.toLowerCase();return Object.keys(e).find(e=>e.toLowerCase()===n)}function Dk(e,t,n,r=!1){if(t!==`safe`||xk(n)!==`a`)return e;let i=Ek(e,`href`);if(r&&(!i||!e[i])){let t=Ek(e,`target`),n=Ek(e,`rel`);return t&&delete e[t],n&&delete e[n],e}let a=Ek(e,`target`);if((a?String(e[a]).trim():``).toLowerCase()!==`_blank`)return e;let o=Ek(e,`rel`),s=new Set(String(o?e[o]:``).split(/\s+/).map(e=>e.trim()).filter(Boolean).filter(e=>e.toLowerCase()!==`opener`));return s.add(`noopener`),s.add(`noreferrer`),o&&o!==`rel`&&delete e[o],e.rel=Array.from(s).join(` `),e}function Ok(e,t=`safe`,n){let r={};for(let[i,a]of Object.entries(e)){let e=i.trim(),o=e.toLowerCase();e&&bk(e)&&(Tk(o,a,t,n)||(r[e]=a))}return Dk(r,t,n,!!Ek(e,`href`))}var kk=[/javascript:/i,/vbscript:/i,/data:text\/html/i,/expression\s*\(/i,/@import/i],Ak=`http://www.w3.org/2000/svg`,jk=new Set([`script`,`style`,`iframe`,`object`,`embed`,`link`,`meta`]),Mk=new Set([`svg`,`style`,`g`,`a`,`defs`,`marker`,`path`,`rect`,`circle`,`ellipse`,`line`,`polyline`,`polygon`,`text`,`tspan`,`title`,`desc`,`use`,`image`,`lineargradient`,`radialgradient`,`stop`,`clippath`,`mask`,`pattern`]),Nk=new Set([`href`,`xlink:href`,`src`,`srcdoc`,`action`,`data`,`formaction`,`poster`]),Pk=new Set([`clip-path`,`fill`,`filter`,`marker-end`,`marker-mid`,`marker-start`,`mask`,`stroke`]),Fk=new Set([`circle`,`ellipse`,`image`,`line`,`path`,`polygon`,`polyline`,`rect`,`text`,`tspan`,`use`]);function Ik(e){return(e.getAttribute(`href`)||e.getAttribute(`xlink:href`))?.startsWith(`#`)===!0}function Lk(e){return!!(e.getAttribute(`href`)||e.getAttribute(`xlink:href`)||e.getAttribute(`src`))}function Rk(e){let t=e.nodeName.toLowerCase();return t===`use`?Ik(e):t===`image`?Lk(e):t===`text`||t===`tspan`?!!e.textContent?.trim():Fk.has(t)}function zk(e){return e.replace(/(["'])\s*javascript:/gi,`$1#`).replace(/\bjavascript:/gi,`#`).replace(/(["'])\s*vbscript:/gi,`$1#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`)}function Bk(e,t,n){let r=e.toLowerCase(),i=t.toLowerCase(),a=String(n??``).trim();return a?(r===`use`||r===`marker`||r===`clippath`||r===`mask`)&&(i===`href`||i===`xlink:href`)?a.startsWith(`#`)?a:``:r===`a`&&(i===`href`||i===`xlink:href`)?$v(a,{tagName:`a`,attrName:`href`})?``:a:r===`image`&&(i===`href`||i===`xlink:href`||i===`src`)?$v(a,{tagName:`img`,attrName:`src`})?``:a:i===`href`||i===`xlink:href`?a.startsWith(`#`)?a:``:$v(a,{tagName:r,attrName:i})?``:a:``}function Vk(e,t){let n=t+4;for(;n<e.length&&/\s/.test(e[n]??``);)n++;let r=e[n];if(r===`"`||r===`'`){let t=n+1,i=e.indexOf(r,t);if(i===-1)return{next:e.length,url:``};for(n=i+1;n<e.length&&/\s/.test(e[n]??``);)n++;return{next:n<e.length&&e[n]===`)`?n+1:n,url:e.slice(t,i)}}let i=n;for(;n<e.length&&e[n]!==`)`;)n++;return{next:n<e.length?n+1:n,url:e.slice(i,n)}}function Hk(e){return e.replace(/\\([0-9a-f]{1,6}\s?|.)/gi,(e,t)=>{let n=t.trim();if(/^[0-9a-f]+$/i.test(n)){let e=Number.parseInt(n,16);try{return Number.isFinite(e)?String.fromCodePoint(e):``}catch{return``}}return String(t).trim()})}function Uk(e){let t=Hk(e),n=t.toLowerCase(),r=0;for(;r<n.length;){let e=n.indexOf(`url(`,r);if(e===-1)return!1;let i=Vk(t,e);if(r=Math.max(i.next,e+4),!i.url.trim().startsWith(`#`))return!0}return!1}function Wk(e){let t=Hk(e);return kk.some(e=>e.test(t))||Uk(t)}function Gk(e){if(e.tagName.toLowerCase()!==`a`||e.getAttribute(`target`)?.trim().toLowerCase()!==`_blank`)return;let t=new Set(String(e.getAttribute(`rel`)??``).split(/\s+/).map(e=>e.trim()).filter(Boolean).filter(e=>e.toLowerCase()!==`opener`));t.add(`noopener`),t.add(`noreferrer`),e.setAttribute(`rel`,Array.from(t).join(` `))}function Kk(e){let t=Number.parseFloat(String(e??``));return Number.isFinite(t)?t:0}function qk(e,t){if(e.nodeType===Node.TEXT_NODE){let n=e.textContent??``;n&&t.push(n);return}if(e.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=n.tagName.toLowerCase();if(!jk.has(r)){if(r===`br`){t.push(`
|
|
167
|
-
`);return}for(let e of Array.from(n.childNodes))qk(e,t)}}function Jk(e){for(let t of Array.from(e.querySelectorAll(`foreignObject`))){let n=[];qk(t,n);let r=n.join(``).split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(!r.length){t.remove();continue}let i=Kk(t.getAttribute(`width`)),a=Kk(t.getAttribute(`height`)),o=Kk(t.getAttribute(`x`)),s=Kk(t.getAttribute(`y`)),c=e.ownerDocument.createElementNS(Ak,`text`);c.setAttribute(`x`,String(o+i/2)),c.setAttribute(`y`,String(s+a/2)),c.setAttribute(`text-anchor`,`middle`),c.setAttribute(`dominant-baseline`,`central`);let l=t.querySelector(`.nodeLabel`);if(l?.getAttribute(`class`)&&c.setAttribute(`class`,l.getAttribute(`class`)),r.length===1)c.textContent=r[0];else{let t=-.6*(r.length-1);for(let[n,a]of r.entries()){let r=e.ownerDocument.createElementNS(Ak,`tspan`);r.setAttribute(`x`,String(o+i/2)),r.setAttribute(`dy`,n===0?`${t}em`:`1.2em`),r.textContent=a,c.appendChild(r)}}t.parentNode?.replaceChild(c,t)}}function Yk(e){Jk(e);let t=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of t){let t=e.tagName.toLowerCase();if(!Mk.has(t)){e.remove();continue}if(t===`style`&&Wk(e.textContent??``)){e.remove();continue}let n=Array.from(e.attributes);for(let r of n){let n=r.name.toLowerCase();if(/^on/i.test(n)){e.removeAttribute(r.name);continue}if(n===`style`&&r.value&&Wk(r.value)){e.removeAttribute(r.name);continue}if(n===`srcdoc`){e.removeAttribute(r.name);continue}if(Nk.has(n)&&r.value){let i=Bk(t,n,r.value);if(!i){e.removeAttribute(r.name);continue}i!==r.value&&e.setAttribute(r.name,i);continue}if(Pk.has(n)&&r.value&&Uk(r.value)){e.removeAttribute(r.name);continue}if(r.value){let t=zk(r.value);t!==r.value&&e.setAttribute(r.name,t)}}Gk(e)}}function Xk(e){if(typeof DOMParser>`u`||!e)return null;try{let t=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement;if(!t||t.nodeName.toLowerCase()!==`svg`)return null;let n=t;return Yk(n),$k(n)?null:n}catch{return null}}function Zk(e){return Xk(e)?.outerHTML??null}function Qk(e){return Zk(e)??``}function $k(e){let t=e.getAttribute(`viewBox`);if(t){let e=t.trim().split(/[\s,]+/);if(e.length===4){let t=Number.parseFloat(e[2]||``),n=Number.parseFloat(e[3]||``);if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return!0}}let n=[e,...Array.from(e.querySelectorAll(`*`))],r=!1;for(let e of n){Rk(e)&&(r=!0);for(let t of Array.from(e.attributes))if(/\bNaN\b/i.test(t.value)||t.name===`style`&&/max-width:\s*0(?:px)?/i.test(t.value))return!0}return!r}var eA=[];function tA(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function nA(e){return(String(e||`text`).trim().split(/\s+/)[0]||`text`).replace(/[^\w+.#:-]/g,`-`).replace(/-+/g,`-`)||`text`}function rA(e){return e.replace(/[^\w:.+-]/g,`-`).replace(/-+/g,`-`)}function iA(e=`editor-${Date.now()}`,t={}){let n=eC(t),r=n;r.__markstreamRegisteredPluginCount=eA.length,r.__markstreamHasCustomParserExtensions=!!(t.plugin?.length||t.apply?.length||eA.length);let i={"common.copy":`Copy`},a;if(typeof t.i18n==`function`)a=t.i18n;else if(t.i18n&&typeof t.i18n==`object`){let e=t.i18n;a=t=>e[t]??i[t]??t}else a=e=>i[e]??e;if(Array.isArray(t.plugin))for(let e of t.plugin){let t=e;if(Array.isArray(t)){let[e,...r]=t;typeof e==`function`&&n.use(e,...r)}else typeof t==`function`&&n.use(t)}if(Array.isArray(t.apply))for(let e of t.apply)try{e(n)}catch(e){console.error(`[getMarkdown] apply function threw an error`,e)}if(eA.length)for(let e of eA)if(Array.isArray(e)){let[t,...r]=e;typeof t==`function`&&n.use(t,...r)}else typeof e==`function`&&n.use(e);n.use(_k),n.use(hu),n.use(fu);let o=Fu,s=o.default??o;n.use(s),n.use(du),n.use(uu),n.core.ruler.after(`block`,`mark_fence_closed`,e=>{let t=e,n=t.src,r=!!t.env?.__markstreamFinal,i;for(let e of t.tokens){if(e.type!==`fence`||!e.map||!e.markup)continue;let t=e.map[0],a=e.map[1],o=e.markup,s=o[0],c=o.length,l=Math.max(0,a-1);i??=n.split(/\r?\n/);let u=i[l]??``,d=0;for(;d<u.length&&(u[d]===` `||u[d]===` `);)d++;let f=0;for(;d+f<u.length&&u[d+f]===s;)f++;let p=d+f;for(;p<u.length&&(u[p]===` `||u[p]===` `);)p++;let m=r?!0:a>t+1&&f>=c&&p===u.length,h=e;h.meta=h.meta??{},h.meta.unclosed=!m,h.meta.closed=!!m}}),n.renderer.rules.fence=(t,n)=>{let r=t[n],i=String(r.info??``).trim(),o=String(r.content??``),s=btoa(unescape(encodeURIComponent(o))),c=nA(i),l=tA(c),u=rA(`editor-${e}-${n}-${c}`),d=tA(a(`common.copy`));return`<div class="code-block" data-code="${s}" data-lang="${l}" id="${u}">
|
|
168
|
-
<div class="code-header">
|
|
169
|
-
<span class="code-lang">${tA(c.toUpperCase())}</span>
|
|
170
|
-
<button class="copy-button" data-code="${s}">${d}</button>
|
|
171
|
-
</div>
|
|
172
|
-
<div class="code-editor"></div>
|
|
173
|
-
</div>`};let c=/^\[(\d+)\]/,l=/^\[([^\]\n]+)\]/,u=e=>{if(!e.startsWith(`[`))return!1;let t=l.exec(e);if(!t)return e!==`[`&&!/^\[\d+$/.test(e);let n=String(t[1]??``);return!e.slice(t[0].length).startsWith(`(`)&&!/^\d+$/.test(n)};n.inline.ruler.before(`escape`,`reference`,(e,t)=>{let n=e;if(n.src[n.pos]!==`[`)return!1;let r=c.exec(n.src.slice(n.pos));if(!r)return!1;let i=n.src.slice(Math.max(0,n.pos-120),n.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(i))return!1;let a=n.src.slice(n.pos+r[0].length);if(a.startsWith(`](`)||a.startsWith(`(`)||u(a))return!1;if(!t){let e=r[1],t=n.push(`reference`,`span`,0);t.content=e,t.markup=r[0],t.raw=r[0]}return n.pos+=r[0].length,!0}),n.renderer.rules.reference=(e,t)=>{let n=String(e[t].content??``);return`<span class="reference-link" data-reference-id="${n}" role="button" tabindex="0" title="Click to view reference">${n}</span>`};let d=n.use.bind(n);return n.use=((...e)=>(r.__markstreamHasCustomParserExtensions=!0,d(...e))),n}var aA=/<\/?([A-Z][\w:-]*)(?:\s[^<>]*)?>/gi;function oA(e,t,n){let r=py(n),i=new Set(r);if(!t||i.size===0||!Array.isArray(e)||e.length===0)return Array.isArray(e)?e.slice():[];let a=sA(t,i);if(a.length===0)return e.slice();let o=0,s=e.map(e=>dA(e)),c=e=>{if(!e||typeof e!=`object`)return;let t=uA(e,i);if(t){let n=lA(a,t,()=>o,e=>o=e);n&&(e.tag=t,e.type=t,e.content=n.innerContent,e.raw=n.raw,typeof e.loading!=`boolean`&&(e.loading=n.loading))}for(let t of Object.values(e))if(Array.isArray(t))for(let e of t)e&&typeof e==`object`&&c(e)};for(let e of s)c(e);return s}function sA(e,t){let n=[],r=[],i;for(aA.lastIndex=0;(i=aA.exec(e))!==null;){let a=i[0],o=fy(i[1]);if(!o||!t.has(o))continue;if(!a.startsWith(`</`)){n.push({tag:o,start:i.index,openEnd:aA.lastIndex});continue}let s=cA(n,o);if(s<0)continue;let[c]=n.splice(s,1),l=i.index,u=aA.lastIndex;r.push({tag:o,start:c.start,end:u,innerContent:e.slice(c.openEnd,l),raw:e.slice(c.start,u),loading:!1})}for(let t of n)r.push({tag:t.tag,start:t.start,end:e.length,innerContent:e.slice(t.openEnd),raw:e.slice(t.start),loading:!0});return r.sort((e,t)=>e.start===t.start?t.end-e.end:e.start-t.start)}function cA(e,t){for(let n=e.length-1;n>=0;--n)if(e[n]?.tag===t)return n;return-1}function lA(e,t,n,r){let i=n();for(;i<e.length;){let n=e[i];if(i+=1,n.tag===t)return r(i),n}return r(i),null}function uA(e,t){let n=fy(e.tag);if(n&&t.has(n))return n;let r=fy(e.type);return r&&t.has(r)?r:``}function dA(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?e.map(e=>dA(e)):{...e};if(!Array.isArray(t))for(let[e,n]of Object.entries(t))Array.isArray(n)&&(t[e]=n.map(e=>dA(e)));return t}var fA=new Map,pA=new Set([`table`,`code_block`,`html_block`,`blockquote`,`list`,`list_item`,`definition_list`,`footnote`,`admonition`,`thematic_break`,`math_block`,`thinking`,`vmr_container`]);function mA(e,t={},n,r){let i=py([...e.customHtmlTags||[],...e.parseOptions?.customHtmlTags||[]]);return{customId:e.customId,isDark:e.isDark,indexKey:e.indexKey==null?void 0:String(e.indexKey),final:e.final,typewriter:e.typewriter,fade:e.fade,textStreamState:n,streamRenderVersion:r,showTooltips:e.showTooltips,codeBlockStream:e.codeBlockStream,renderCodeBlocksAsPre:e.renderCodeBlocksAsPre,allowHtml:e.allowHtml!==!1,htmlPolicy:e.htmlPolicy??`safe`,customHtmlTags:i,parseOptions:e.parseOptions,customMarkdownIt:e.customMarkdownIt,codeBlockOptions:e.codeBlockOptions,codeBlockProps:e.codeBlockProps,mermaidProps:e.mermaidProps,d2Props:e.d2Props,infographicProps:e.infographicProps,customComponents:e.customComponents,codeBlockThemes:{themes:e.themes,darkTheme:e.codeBlockDarkTheme,lightTheme:e.codeBlockLightTheme,minWidth:e.codeBlockMinWidth,maxWidth:e.codeBlockMaxWidth},events:t}}function hA(e){if(Array.isArray(e.nodes))return e.nodes;let t=_A(e.content);if(!t)return[];let n=py([...e.customHtmlTags||[],...e.parseOptions?.customHtmlTags||[]]),r=`${e.customId||`markstream-svelte`}::${n.join(`,`)}`,i=fA.get(r);i||(i=iA(r,{customHtmlTags:n}),fA.set(r,i));let a=e.customMarkdownIt?e.customMarkdownIt(i):i,o={...e.parseOptions??{}};return typeof e.final==`boolean`&&(o.final=e.final),n.length>0&&(o.customHtmlTags=n),oA(uk(t,a,o),t,n)}function gA(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`):[]}function _A(e){return typeof e==`string`?e:e==null?``:String(e)}function vA(e){return _A(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function yA(e){return vA(e).replace(/`/g,```)}function bA(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function xA(e){let t=Math.trunc(Number(e)||1);return Math.min(6,Math.max(1,t))}function SA(e){return String(String(e??``).split(/\s+/g)[0]??``).toLowerCase().replace(/[^\w-]/g,``)||`plaintext`}function CA(e){return SA(e?.language)}function wA(e){if(!e)return``;let t=(globalThis==null?void 0:globalThis.require)?.call(globalThis,`buffer`)?.Buffer;if(t?.from)return t.from(e,`utf8`).toString(`base64`);if(typeof TextEncoder<`u`&&typeof globalThis.btoa==`function`){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return globalThis.btoa(n)}return``}function TA(e){let t=[],n=[],r=()=>{n.length&&=(t.push({kind:`inline`,nodes:n.slice()}),0)};for(let i of e)pA.has(String(i?.type||``))?(r(),t.push({kind:`block`,node:i})):n.push(i);return r(),t}function EA(e,t,n){return Ok(e,t,n)}function DA(e){let t=[],n=0;for(;n<e.length;){if(e.startsWith(`<!--`,n)){let t=e.indexOf(`-->`,n);if(t!==-1){n=t+3;continue}break}let r=e.indexOf(`<`,n);if(r===-1){n<e.length&&t.push({type:`text`,content:e.slice(n)});break}if(r>n&&t.push({type:`text`,content:e.slice(n,r)}),e.startsWith(`![CDATA[`,r+1)){let i=e.indexOf(`]]>`,r);if(i!==-1){t.push({type:`text`,content:e.slice(r,i+3)}),n=i+3;continue}break}if(e.startsWith(`!`,r+1)){let t=e.indexOf(`>`,r);if(t!==-1){n=t+1;continue}break}let i=e.indexOf(`>`,r);if(i===-1)break;let a=e.slice(r+1,i).trim();if(!a){n=i+1;continue}let o=a.startsWith(`/`),s=a.endsWith(`/`);if(o){let e=a.slice(1).trim();t.push({type:`tag_close`,tagName:e}),n=i+1;continue}let c=a.indexOf(` `),l=``,u=``;c===-1?l=s?a.slice(0,-1).trim():a.trim():(l=a.slice(0,c).trim(),u=a.slice(c+1));let d={};if(u){let e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g,t;for(;(t=e.exec(u))!==null;){let e=t[1],n=t[2]??t[3]??t[4]??``;e&&!e.endsWith(`/`)&&(d[e]=n)}}t.push({type:s||Pv.has(l.toLowerCase())?`self_closing`:`tag_open`,tagName:l,attrs:d}),n=i+1}return t}function OA(e){return String(e??``).trim().toLowerCase()}function kA(e){let t=Object.entries(e);return t.length===0?``:t.map(([e,t])=>t===``?` ${e}`:` ${e}="${yA(t)}"`).join(``)}function AA(e){let t=String(e.tagName??``).trim();if(!t)return``;if(e.type===`tag_close`)return`</${vA(t)}>`;let n=Object.entries(e.attrs??{}).map(([e,t])=>t===``?` ${vA(e)}`:` ${vA(e)}="${yA(t)}"`).join(``);return e.type===`self_closing`?`<${vA(t)}${n} />`:`<${vA(t)}${n}>`}function jA(e,t=`safe`){if(!e)return``;if(t===`escape`)return vA(e);let n=DA(e),r=[],i=[],a=0;for(let e of n){if(e.type===`text`){a===0&&i.push(vA(e.content??``));continue}let n=OA(e.tagName);if(!n)continue;if(zv.has(n)||Ck(n,t)){e.type===`tag_open`?a+=1:e.type===`tag_close`&&a>0&&--a;continue}if(a>0)continue;if(t===`safe`&&Sk(n,t)){i.push(AA(e));continue}if(e.type===`self_closing`){i.push(`<${n}${kA(EA(e.attrs??{},t,n))}>`);continue}if(e.type===`tag_open`){i.push(`<${n}${kA(EA(e.attrs??{},t,n))}>`),Pv.has(n)||r.push(n);continue}let o=r.lastIndexOf(n);if(o===-1)continue;for(;r.length>o+1;){let e=r.pop();e&&i.push(`</${e}>`)}let s=r.pop();s&&i.push(`</${s}>`)}for(;r.length>0;){let e=r.pop();e&&i.push(`</${e}>`)}return i.join(``)}var MA=`markstream-svelte-html`,NA=`div`,PA=new Map,FA=new Set(`admonition.blockquote.checkbox.checkbox_input.code_block.definition_item.definition_list.emoji.emphasis.footnote.footnote_reference.footnote_anchor.hardbreak.heading.highlight.html_block.html_inline.image.inline_code.insert.link.list.list_item.math_block.math_inline.paragraph.reference.strikethrough.strong.subscript.superscript.table.table_cell.table_row.text.thematic_break`.split(`.`));function IA(e,t={}){return zA(e,LA(t))}function LA(e){let t=py(e.customHtmlTags),n=`${e.cacheKey||MA}::${t.join(`,`)}`,r=PA.get(n);return r||(r=iA(n,{customHtmlTags:t}),PA.set(n,r)),{markdown:r,options:{allowHtml:e.allowHtml!==!1,htmlPolicy:e.htmlPolicy??`safe`,customNodeTag:fy(e.customNodeTag)||NA,customNodeClass:e.customNodeClass}}}function RA(e,t){return(Array.isArray(e)?e:[]).map(e=>zA(e,t)).join(``)}function zA(e,t){if(!e||typeof e!=`object`)return``;switch(e.type){case`text`:return BA(e);case`paragraph`:return`<p>${RA(dj(e.children),t)}</p>`;case`strong`:return`<strong>${RA(dj(e.children),t)}</strong>`;case`emphasis`:return`<em>${RA(dj(e.children),t)}</em>`;case`strikethrough`:return`<del>${RA(dj(e.children),t)}</del>`;case`highlight`:return`<mark>${RA(dj(e.children),t)}</mark>`;case`insert`:return`<ins>${RA(dj(e.children),t)}</ins>`;case`subscript`:return`<sub>${RA(dj(e.children),t)}</sub>`;case`superscript`:return`<sup>${RA(dj(e.children),t)}</sup>`;case`inline_code`:return`<code>${hj(fj(e.code))}</code>`;case`hardbreak`:return`<br>`;case`link`:return VA(e,t);case`image`:return WA(e);case`list`:return GA(e,t);case`list_item`:return`<li>${RA(dj(e.children),t)}</li>`;case`blockquote`:return`<blockquote>${RA(dj(e.children),t)}</blockquote>`;case`heading`:return KA(e,t);case`code_block`:return qA(e);case`thematic_break`:return`<hr>`;case`table`:return JA(e,t);case`table_row`:return YA(e,t);case`table_cell`:return XA(e,t);case`definition_list`:return ZA(e,t);case`definition_item`:return QA(e,t);case`footnote`:return $A(e,t);case`footnote_reference`:return ej(e);case`footnote_anchor`:return tj(e);case`admonition`:return nj(e,t);case`checkbox`:case`checkbox_input`:return`<input type="checkbox" disabled${e.checked?` checked`:``}>`;case`emoji`:return hj(fj(e.raw||e.markup||e.content||e.name));case`math_inline`:return HA(e);case`math_block`:return UA(e);case`reference`:return`<span class="markstream-nested-reference">${hj(fj(e.id))}</span>`;case`html_inline`:case`html_block`:return rj(e,t);default:return ij(e,t)}}function BA(e){let t=fj(e.content),n=hj(t),r=!!e.center;return!r&&!t.includes(`
|
|
174
|
-
`)?n:`<span class="${r?`markstream-svelte-text-node markstream-svelte-text--centered`:`markstream-svelte-text-node`}">${n}</span>`}function VA(e,t){let n=fj(e.href),r=fj(e.title),i=dj(e.children).length>0?RA(dj(e.children),t):hj(fj(e.text||n)),a=r?` title="${gj(r)}"`:``,o=n&&!$v(n)?n:``;return`<a${o?` href="${gj(o)}"`:``}${a}${ey(o)?` target="_blank" rel="noreferrer noopener"`:``}>${i}</a>`}function HA(e){return`<span class="markstream-nested-math" data-display="inline"><span class="markstream-nested-math__source">${hj(fj(e.content||e.markup||e.raw))}</span><span class="markstream-nested-math__render" aria-hidden="true"></span></span>`}function UA(e){return`<div class="markstream-nested-math-block"><pre class="markstream-nested-math-block__source"><code>${hj(fj(e.content||e.markup||e.raw))}</code></pre><div class="markstream-nested-math-block__render" aria-hidden="true"></div></div>`}function WA(e){let t=ny(e.src);if(!t)return``;let n=fj(e.alt),r=fj(e.title),i=r?` title="${gj(r)}"`:``;return`<img src="${gj(t)}" alt="${gj(n)}"${i}>`}function GA(e,t){let n=e.ordered?`ol`:`ul`;return`<${n}${e.ordered&&Number.isFinite(e.start)?` start="${Number(e.start)}"`:``}>${RA(dj(e.items),t)}</${n}>`}function KA(e,t){let n=mj(e.level);return`<h${n}>${RA(dj(e.children),t)}</h${n}>`}function qA(e){let t=fj(e.language).trim(),n=pj(t),r=n?` class="language-${n}"`:``,i=!!e.diff,a=fj(e.code),o=e.loading===!0;return o&&!a.trim()?``:`<pre ${[`data-markstream-code-block="1"`,t?`data-markstream-language="${gj(t)}"`:``,o?`data-markstream-loading="1"`:``,i?`data-markstream-diff="1"`:``,i?`data-markstream-original="${gj(vj(fj(e.originalCode)))}"`:``,i?`data-markstream-updated="${gj(vj(fj(e.updatedCode)))}"`:``,o?`aria-busy="true"`:``].filter(Boolean).join(` `)}><code${r}>${hj(a)}</code></pre>`}function JA(e,t){let n=e.header?YA(e.header,t,!0):``,r=RA(dj(e.rows),t);return`<table>${n?`<thead>${n}</thead>`:``}${r?`<tbody>${r}</tbody>`:``}</table>`}function YA(e,t,n=!1){return`<tr>${dj(e.cells).map(e=>XA(e,t,n)).join(``)}</tr>`}function XA(e,t,n=!1){let r=n||e.header?`th`:`td`,i=fj(e.align);return`<${r}${i?` style="text-align:${gj(i)}"`:``}>${RA(dj(e.children),t)}</${r}>`}function ZA(e,t){return`<dl>${dj(e.items).map(e=>QA(e,t)).join(``)}</dl>`}function QA(e,t){return`<dt>${RA(dj(e.term),t)}</dt><dd>${RA(dj(e.definition),t)}</dd>`}function $A(e,t){let n=gj(fj(e.id));return`<div${n?` id="fnref--${n}"`:``} class="footnote-node markstream-nested-footnote"><div class="footnote-node__content">${RA(dj(e.children),t)}</div></div>`}function ej(e){let t=fj(e.id),n=hj(t),r=gj(t);return`<sup${r?` id="fnref-${r}"`:``} class="footnote-reference markstream-nested-footnote-ref"><span${r?` href="#fnref--${r}"`:``}${r?` title="查看脚注 ${r}"`:``} class="footnote-link cursor-pointer">[${n}]</span></sup>`}function tj(e){let t=gj(fj(e.id));return`<a class="footnote-anchor"${t?` href="#fnref-${t}"`:``}${t?` title="返回引用 ${t}"`:``} aria-label="${t?`返回引用 ${t}`:`返回引用`}">↩︎</a>`}function nj(e,t){let n=pj(fj(e.kind||`note`))||`note`;return`<div class="markstream-nested-admonition markstream-nested-admonition--${n}"><div class="markstream-nested-admonition__title">${hj(fj(e.title)||_j(n))}</div><div class="markstream-nested-admonition__content">${RA(dj(e.children),t)}</div></div>`}function rj(e,t){let n=fj(e.content)||fj(e.raw),r=fj(e.tag).trim().toLowerCase(),i=dj(e.children);return!t.options.allowHtml||t.options.htmlPolicy===`escape`||e.loading&&!e.autoClosed?hj(n):r&&i.length>0&&!Bv.has(r)&&!Sk(r,t.options.htmlPolicy)?`<${r}${lj(e.attrs,``,t.options.htmlPolicy,r)}>${RA(i,t)}</${r}>`:jA(n,t.options.htmlPolicy)}function ij(e,t){let n=fj(e.tag||e.type);if(!n||FA.has(n))return hj(fj(e.content||e.raw));let r=[`markstream-nested-custom`,`markstream-nested-custom--${pj(n)||`node`}`,sj(e,t.options.customNodeClass)].filter(Boolean).join(` `),i=lj(e.attrs,r,t.options.htmlPolicy),a=aj(e,t),o=t.options.customNodeTag;return`<${o}${i} data-markstream-custom-tag="${gj(n)}">${a}</${o}>`}function aj(e,t){let n=dj(e.children);if(n.length>0)return RA(n,t);let r=fj(e.content);return r?oj(r,t):hj(fj(e.raw))}function oj(e,t){return e?t.markdown.render(e):``}function sj(e,t){return t?cj(typeof t==`function`?t(e):t):``}function cj(e){return Array.isArray(e)?e.map(e=>cj(e)).filter(Boolean).join(` `):typeof e==`string`?e.trim():``}function lj(e,t=``,n=`safe`,r){let i=uj(e),a={},o=[t];for(let[e,t]of i){let n=String(e).trim();if(n){if(n.toLowerCase()===`class`){o.push(String(t));continue}a[n]=t===!0?``:String(t)}}let s=Object.entries(Ok(a,n,r)).map(([e,t])=>t===``?` ${e}`:` ${e}="${gj(String(t))}"`),c=o.map(e=>e.trim()).filter(Boolean).join(` `);return c&&s.unshift(` class="${gj(c)}"`),s.join(``)}function uj(e){if(!e)return[];if(Array.isArray(e)){if(e.length===0)return[];let t=e[0];return Array.isArray(t)?e.map(([e,t])=>[String(e),t]):e.map(e=>[String(e.name),e.value])}return Object.entries(e).map(([e,t])=>[e,t])}function dj(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`):[]}function fj(e){return typeof e==`string`?e:e==null?``:String(e)}function pj(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function mj(e){let t=Math.trunc(Number(e)||1);return Math.min(6,Math.max(1,t))}function hj(e){return fj(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function gj(e){return hj(e).replace(/`/g,```)}function _j(e){return e?`${e[0].toUpperCase()}${e.slice(1)}`:``}function vj(e){if(!e)return``;let t=(globalThis==null?void 0:globalThis.require)?.call(globalThis,`buffer`)?.Buffer;if(t?.from)return t.from(e,`utf8`).toString(`base64`);if(typeof TextEncoder<`u`&&typeof globalThis.btoa==`function`){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return globalThis.btoa(n)}return``}function yj(e,t){return IA(e,{cacheKey:t?.customId?`markstream-svelte-${t.customId}`:`markstream-svelte-node`,customHtmlTags:t?.customHtmlTags,allowHtml:t?.allowHtml!==!1,htmlPolicy:t?.htmlPolicy??`safe`})}function bj(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var xj=`__global__`,Sj=`__MARKSTREAM_SVELTE_CUSTOM_COMPONENTS_STORE__`,Cj=(()=>{let e=globalThis;if(e[Sj])return e[Sj];let t={scopedComponents:{},revision:0,listeners:new Set};return e[Sj]=t,t})();function wj(e){return Cj.listeners.add(e),()=>{Cj.listeners.delete(e)}}function Tj(e){let t=Cj.scopedComponents[xj]||{};if(!e)return t;let n=Cj.scopedComponents[e]||{};return!t||Object.keys(t).length===0?n:!n||Object.keys(n).length===0?t:{...t,...n}}var Ej=r(`<input class="checkbox-node" type="checkbox" disabled=""/>`);function Dj(e,t){i(t,!0);var n=Ej();le(n),H(e=>L(n,e),[()=>!!t.node?.checked]),y(e,n),x()}function Oj(e){return(e.split(`.`).pop()||e).replace(/[_-]/g,` `).replace(/([A-Z])/g,` $1`).replace(/\s+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}var kj={"common.copy":`Copy`,"common.copied":`Copied`,"common.decrease":`Decrease`,"common.reset":`Reset`,"common.increase":`Increase`,"common.expand":`Expand`,"common.collapse":`Collapse`,"common.preview":`Preview`,"common.source":`Source`,"common.export":`Export`,"common.open":`Open`,"common.close":`Close`,"common.zoomIn":`Zoom in`,"common.zoomOut":`Zoom out`,"common.resetZoom":`Reset zoom`,"artifacts.htmlPreviewTitle":`HTML Preview`,"artifacts.svgPreviewTitle":`SVG Preview`,"image.preview":`Preview image`,"image.loadError":`Image failed to load`,"image.loading":`Loading image...`};function Aj(){return{t(e){return kj[e]??Oj(e)}}}var jj=null,Mj=!1,Nj=null,Pj=!1;function Fj(e){let t=e,n=typeof t?.createCodeBlockRuntime==`function`||typeof t?.useMonaco==`function`?t:e?.default,r=n?.createCodeBlockRuntime??n?.useMonaco;return typeof r==`function`?{createCodeBlockRuntime:e=>r.call(n,e),preloadStreamDiffs:(n?.preloadStreamDiffs)?.bind(n)}:null}async function Ij(e){Pj||(Pj=!0,typeof e?.preloadStreamDiffs==`function`&&await e.preloadStreamDiffs())}async function Lj(){if(jj)return jj;if(Nj)return await Nj;if(Mj)return null;Nj=(async()=>{try{let e=Fj(await _e(()=>import(`../chunks/BEsyQXpe.js`),[],import.meta.url));return e?(jj=e,await Ij(jj),jj):null}catch{return Mj=!0,null}})();try{return await Nj}finally{Nj=null}}var Rj=null,zj=null,Bj=null,Vj=null,Hj=null,Uj=null;function Wj(){Vj&&=(clearTimeout(Vj),null),Hj&&=(clearTimeout(Hj),null)}function Gj(){return Rj||typeof document>`u`?Rj:(Rj=document.createElement(`div`),Rj.className=`ms-tooltip`,Rj.setAttribute(`role`,`tooltip`),Rj.dataset.visible=`false`,Rj.style.position=`fixed`,Rj.style.left=`0px`,Rj.style.top=`0px`,Rj.style.transform=`translate3d(0,0,0)`,document.body.appendChild(Rj),Rj)}function Kj(e){if(typeof e==`boolean`)return e;if(typeof document<`u`)try{if(document.documentElement.classList.contains(`dark`))return!0}catch{}if(typeof window<`u`&&typeof window.matchMedia==`function`)try{return window.matchMedia(`(prefers-color-scheme: dark)`).matches}catch{}return!1}async function qj(e){if(!Rj||!zj)return;let{x:t,y:n}=await ta(zj,Rj,{placement:e,middleware:[Ji(8),Xi(),Yi({padding:8})],strategy:`fixed`});Rj.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function Jj(e,t,n=`top`,r=!1,i,a){if(!e||typeof document>`u`||(Gj(),!Rj))return;Wj();let o=async()=>{if(Rj){zj=e,Rj.textContent=t,Rj.dataset.placement=n,Rj.dataset.dark=Kj(a)?`true`:`false`,Rj.dataset.visible=`false`,Uj=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Rj.id=Uj;try{e.setAttribute(`aria-describedby`,Uj)}catch{}await qj(n),Rj.dataset.visible=`true`,Bj?.(),Bj=qi(e,Rj,()=>{qj(n)})}};r?o():Vj=setTimeout(o,80)}function Yj(e=!1){if(!Rj)return;Wj();let t=()=>{if(Rj){if(Rj.dataset.visible=`false`,zj&&Uj)try{zj.removeAttribute(`aria-describedby`)}catch{}zj=null,Uj=null,Bj&&=(Bj(),null)}};e?t():Hj=setTimeout(t,120)}var Xj=`
|
|
175
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
176
|
-
<path d="M14 3h5a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5" />
|
|
177
|
-
<path d="M8 11l-3 3l3 3" />
|
|
178
|
-
<path d="M16 11l3 3l-3 3" />
|
|
179
|
-
<path d="M13 9l-2 10" />
|
|
180
|
-
</svg>`,Zj=`
|
|
181
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
182
|
-
<rect x="3" y="4" width="7" height="5" rx="1.5" />
|
|
183
|
-
<rect x="14" y="4" width="7" height="5" rx="1.5" />
|
|
184
|
-
<rect x="8.5" y="15" width="7" height="5" rx="1.5" />
|
|
185
|
-
<path d="M10 6.5h4" />
|
|
186
|
-
<path d="M12 9v2.5" />
|
|
187
|
-
<path d="M12 11.5l-3.5 3.5" />
|
|
188
|
-
<path d="M12 11.5l3.5 3.5" />
|
|
189
|
-
</svg>`,Qj=`
|
|
190
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
191
|
-
<path d="M8 7l-4 5l4 5" />
|
|
192
|
-
<path d="M16 7l4 5l-4 5" />
|
|
193
|
-
<path d="M14 4l-4 16" />
|
|
194
|
-
</svg>`,$j=`
|
|
195
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
196
|
-
<rect x="3" y="4" width="18" height="16" rx="2" />
|
|
197
|
-
<path d="M7 15V9l3 3l3-3v6" />
|
|
198
|
-
<path d="M16 9v6" />
|
|
199
|
-
<path d="M14 13l2 2l2-2" />
|
|
200
|
-
</svg>`,eM=`
|
|
201
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
202
|
-
<path d="M9 4c-2 0-3 1.5-3 3.5v2c0 1.1-.4 1.8-1.5 2.5C5.6 12.7 6 13.4 6 14.5v2C6 18.5 7 20 9 20" />
|
|
203
|
-
<path d="M15 4c2 0 3 1.5 3 3.5v2c0 1.1.4 1.8 1.5 2.5c-1.1.7-1.5 1.4-1.5 2.5v2c0 2-1 3.5-3 3.5" />
|
|
204
|
-
</svg>`,tM=`
|
|
205
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
206
|
-
<path d="M5 6h14" />
|
|
207
|
-
<path d="M12 6v12" />
|
|
208
|
-
<path d="M8 18h8" />
|
|
209
|
-
</svg>`,nM={"":``,cjs:`javascript`,"c++":`cpp`,"c#":`csharp`,d2lang:`d2`,golang:`go`,js:`javascript`,jsx:`jsx`,kt:`kotlin`,md:`markdown`,mjs:`javascript`,"objective-c":`objectivec`,"objective-c++":`objectivecpp`,plaintext:`plain`,rb:`ruby`,rs:`rust`,py:`python`,bash:`shell`,bat:`shell`,batch:`shell`,ps1:`powershell`,sh:`shell`,shellscript:`shell`,text:`plain`,ts:`typescript`,tsx:`tsx`,yml:`yaml`,zsh:`shell`},rM={"":`Text`,css:`CSS`,c:`C`,cpp:`C++`,csharp:`C#`,d2:`D2`,go:`Go`,html:`HTML`,java:`Java`,javascript:`JavaScript`,json:`JSON`,jsx:`JSX`,markdown:`Markdown`,mermaid:`Mermaid`,php:`PHP`,plain:`Text`,plaintext:`Text`,python:`Python`,ruby:`Ruby`,rust:`Rust`,shell:`Shell`,sql:`SQL`,svg:`SVG`,tsx:`TSX`,typescript:`TypeScript`,vue:`Vue`,yaml:`YAML`},iM={"":tM,html:Qj,javascript:Xj,json:eM,jsx:Xj,markdown:$j,mermaid:Zj,plain:tM,python:Xj,shell:Xj,svg:Qj,tsx:Xj,typescript:Xj},aM=Array.from(new Set([...Object.keys(nM),...Object.keys(rM),...Object.keys(iM),`bash`,`c`,`cpp`,`csharp`,`diff`,`go`,`java`,`php`,`ruby`,`rust`,`sql`,`yaml`,`zsh`]));function oM(e){if(!e)return``;let t=e.trim();if(!t)return``;let[n]=t.split(/\s+/),[r]=n.split(`:`);return r.toLowerCase()}function sM(e){let t=oM(e);return nM[t]??t}function cM(e){let t=sM(e);return!t||t===`plain`?`plaintext`:t===`shell`?`zsh`:t===`objectivec`?`objective-c`:t===`objectivecpp`?`objective-cpp`:t}function lM(e){let t=oM(e);return!t||aM.includes(t)?!1:aM.some(e=>e.startsWith(t))}function uM(e){return iM[sM(e)]||Xj}var dM=rM,fM=r(`<div><div class="html-preview-frame__header"><span> </span><button type="button">Close</button></div> <iframe class="html-preview-frame__iframe"></iframe></div>`);function pM(e,t){i(t,!0);let r=k(t,`code`,3,``),a=k(t,`title`,3,`Preview`),o=k(t,`isDark`,3,!1),s=k(t,`htmlPreviewAllowScripts`,3,!1),u=I(()=>t.htmlPreviewSandbox??(s()?`allow-scripts`:``));var d=fM();let f;var p=W(d),m=W(p),h=M(m,!0),g=z(m);n(p);var _=z(p,2);n(d),H(()=>{f=Y(d,1,`html-preview-frame`,null,f,{"is-dark":o()}),c(h,a()),B(_,`title`,a()),B(_,`srcdoc`,r()),B(_,`sandbox`,E(u))}),l(`click`,g,()=>t.onClose?.()),y(e,d),x()}T([`click`]);var mM=r(`<span class="markstream-pre__line-numbers" aria-hidden="true"><span class="markstream-pre__line-numbers-text"> </span></span>`),hM=r(`<pre data-markstream-pre="1"><!><code class="markstream-pre__code" translate="no"> </code></pre>`);function gM(e,t){i(t,!0);let r=k(t,`showLineNumbers`,3,!1),a=k(t,`enhanceable`,3,!0),o=k(t,`class`,3,void 0),s=k(t,`style`,3,void 0),l=I(()=>_A(t.node?.language).trim()),u=I(()=>bA(E(l))),d=I(()=>_A(t.node?.code)),f=I(()=>!!t.node?.diff),p=I(()=>t.node?.loading===!0),m=I(()=>E(p)?E(d):E(d).replace(/\r\n$|\n$|\r$/,``)),g=I(()=>r()===!0&&!E(f)),_=I(()=>w(E(m))),v=I(()=>T(E(_))),S=I(()=>E(g)?`--markstream-pre-line-number-width: ${Math.max(2,String(E(_)).length)}ch; --markstream-pre-diff-line-number-width: ${Math.max(2,String(E(_)).length)}ch; --markstream-code-padding-left: calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch));`:``),C=I(()=>[E(S),s()].filter(Boolean).join(` `));function w(e){let t=1;for(let n=0;n<e.length;n++)e[n]===`
|
|
210
|
-
`?t++:e[n]===`\r`&&(t++,e[n+1]===`
|
|
211
|
-
`&&n++);return e.length?t:1}function T(e){let t=``;for(let n=1;n<=e;n++)t+=`${t?`
|
|
212
|
-
`:``}${n}`;return t}var D=X(),O=q(D),A=e=>{var r=hM();let i;var s=W(r),d=e=>{var t=mM(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(v))),y(e,t)};h(s,e=>{E(g)&&e(d)});var _=z(s),x=M(_,!0);n(r),H((e,t,n)=>{B(r,`data-markstream-code-block`,a()?`1`:void 0),B(r,`data-markstream-language`,E(l)||void 0),B(r,`data-markstream-loading`,E(p)?`1`:void 0),B(r,`data-markstream-diff`,E(f)?`1`:void 0),B(r,`data-markstream-original`,e),B(r,`data-markstream-updated`,t),B(r,`data-markstream-line-numbers`,E(g)?`1`:void 0),B(r,`aria-busy`,E(p)?`true`:void 0),i=Y(r,1,n,null,i,{"markstream-pre--line-numbers":E(g)}),j(r,E(C)||void 0),c(x,E(m))},[()=>E(f)?wA(_A(t.node?.originalCode)):void 0,()=>E(f)?wA(_A(t.node?.updatedCode)):void 0,()=>b([E(u)?`language-${E(u)}`:``,o()].filter(Boolean).join(` `)||void 0)]),y(e,r)},ee=I(()=>!(E(p)&&!E(d).trim()));h(O,e=>{E(ee)&&e(A)}),y(e,D),x()}async function _M(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>`u`)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.opacity=`0`,t.style.pointerEvents=`none`,document.body.appendChild(t),t.select();try{return document.execCommand(`copy`),!0}catch{return!1}finally{t.remove()}}function vM(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=``}}function yM(e,t){if(!e||typeof document>`u`||typeof URL>`u`)return;let n=new Blob([e],{type:`image/svg+xml;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}function bM(e,t){return e==null||e===``?t??null:typeof e==`number`?`${e}px`:String(e)}var xM=w(`<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),SM=w(`<svg viewBox="0 0 24 24" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),CM=r(`<button type="button" class="code-action-btn"><!></button>`),wM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14"></path></svg></button> <button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8m0-5v5h5"></path></svg></button> <button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14m-7-7v14"></path></svg></button>`,1),TM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></g></svg></button>`),EM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg></button>`),DM=r(`<button type="button" class="code-action-btn"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),OM=r(`<div class="code-block-header"><div class="code-block-header__meta"><span class="code-block-language-icon" aria-hidden="true"></span> <span class="code-block-header__label"> </span></div> <div class="code-block-header__actions"><!> <!> <!> <!> <!></div></div>`),kM=r(`<div></div>`),AM=r(`<div><!> <div><!></div></div>`),jM=r(`<div data-markstream-code-block="1"><!> <!> <!></div>`);function MM(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`isDark`,3,void 0),o=k(t,`loading`,3,void 0),s=k(t,`stream`,3,void 0),u=k(t,`codeBlockOptions`,3,void 0),d=k(t,`theme`,3,void 0),p=k(t,`darkTheme`,3,void 0),m=k(t,`lightTheme`,3,void 0),g=k(t,`themes`,3,void 0),_=k(t,`minWidth`,3,void 0),b=k(t,`maxWidth`,3,void 0),S=k(t,`isShowPreview`,3,!0),C=k(t,`enableFontSizeControl`,3,!0),w=k(t,`showHeader`,3,!0),T=k(t,`showCopyButton`,3,!0),D=k(t,`showExpandButton`,3,!0),O=k(t,`showPreviewButton`,3,!0),A=k(t,`showCollapseButton`,3,!0),ee=k(t,`showFontSizeButtons`,3,!0),te=k(t,`showLineNumbers`,3,void 0),N=k(t,`htmlPreviewAllowScripts`,3,!1),P=k(t,`htmlPreviewSandbox`,3,void 0),{t:L}=Aj(),re=[`javascript`,`plaintext`,`shellscript`,`typescript`];function ie(e){let t=(e instanceof Error?e.message:String(e??``)).match(/Language `([^`]+)` is not included/)?.[1];return t&&lM(t)?t:``}function R(e){let t=ie(e);if(t){F(he,t,!0),F(me,!1),U(t);return}F(he,E(Ve),!0),F(me,!0)}function oe(e){let t=e.trim().split(/\s+/)[0]?.split(`:`)[0]?.toLowerCase()||``;return t.length>=3&&re.some(e=>e!==t&&e.startsWith(t))}function U(e){if(E(Pe))return;let t=()=>{if(F(Pe,null),E(xe)){if(E(Ve)!==e&&!lM(E(Ve))&&!oe(E(Ve))&&!E(dt)&&!E(pt)){F(he,``),Mt();return}F(Pe,setTimeout(t,50),!0)}};F(Pe,setTimeout(t,50),!0)}let le=V(null),G=V(null),K=V(null),fe=V(null),pe=V(!1),me=V(!1),he=V(``),ge=V(null),_e=V(null),ve=V(!1),ye=V(!1),be=V(null),xe=V(!1),Z=V(!1),Se=V(!1),Ce=V(!1),we=V(!1),Te=V(12),Ee=V(null),De=V(0),Oe=V(null),ke=V(J([])),Ae=V(null),je=V(null),Me=V(``),Ne,Pe=V(null),Fe=V(null),Ie=V(null),Le=V(``),Re=V(null),ze=V(null),Be=V(!1),Ve=I(()=>_A(t.node?.language).trim()),He=I(()=>sM(E(Ve))),Ue=I(()=>cM(E(He)||E(Ve)||`plaintext`)),We=I(()=>vt(t.node)),Ge=I(()=>!!t.node?.diff),Ke=I(()=>_A(t.node?.originalCode)),Q=I(()=>_A(t.node?.updatedCode)),qe=I(()=>t.node?.loading===!0),Je=I(()=>o()??E(qe)),Ye=I(()=>s()??r()?.codeBlockStream??!0),Xe=I(()=>a()??r()?.isDark??!1),Ze=I(()=>r()?.codeBlockThemes),Qe=I(()=>u()??r()?.codeBlockOptions),$e=I(()=>te()??E(Qe)?.disableLineNumbers!==!0),et=I(()=>{let e=E(Qe)?.parseDiffOptions;return{options:{...E(Qe)??{}},parseDiffOptions:e&&typeof e==`object`?{...e}:e,showLineNumbers:E($e)}}),tt=I(Ot),nt=I(Et),rt=I(()=>yt(E(Qe)?.fontSize)??12),it=I(()=>bM(_()??E(Ze)?.minWidth)),at=I(()=>bM(b()??E(Ze)?.maxWidth)),ot=I(()=>[E(it)?`min-width: ${E(it)}`:``,E(at)?`max-width: ${E(at)}`:``].filter(Boolean).join(`; `)),st=I(()=>uM(E(He)||E(Ve)||`plain`)),ct=I(()=>dM[E(He)]||(E(Ve)?E(Ve).toUpperCase():dM[``])),lt=I(()=>S()!==!1&&(E(He)===`html`||E(He)===`svg`)),ut=I(()=>E(He)===`svg`?L(`artifacts.svgPreviewTitle`):L(`artifacts.htmlPreviewTitle`)),dt=I(()=>E(Ye)===!1&&E(Je)),ft=I(()=>r()?.final===!1||E(Je)),pt=I(()=>E(Ye)!==!1&&E(ft)&&(lM(E(Ve))||oe(E(Ve)))),mt=I(()=>!(E(Je)&&!E(We).trim())),ht=I(()=>({...t.node,code:E(We),loading:E(Je)})),gt=I(wt),_t=I(()=>E(Ge)?`${E(Ue)}\0${E(Ke)}\0${E(Q)||E(We)}`:`${E(Ue)}\0${E(We)}`);de(()=>{E(me)&&E(he)&&E(Ve)!==E(he)&&lM(E(he))&&(F(me,!1),F(he,``))}),de(()=>{E(xe),E(Je),E(_t),E(dt),E(pt),E(xe)&&E(Je)===!1&&!E(dt)&&!E(pt)&&E(_t)!==E(Le)&&(F(Le,E(_t),!0),zt())}),de(()=>{E(xe),E(le),E(mt),E(Z),E(dt),E(pt),E(Ge),E(We),E(Ke),E(Q),E(Ue),E(nt),E(tt),E(Qe),E(et),E(Te),E(Se),E(xe)&&(Ne!==E(et)&&(Ne=E(et),F(Te,E(rt),!0),Vt()),Mt())}),ue(()=>{F(xe,!0),F(Te,E(rt),!0)}),ce(()=>{F(xe,!1),F(De,E(De)+1),E(Ee)&&clearTimeout(E(Ee)),E(Pe)&&clearTimeout(E(Pe)),E(Ie)&&clearTimeout(E(Ie)),qt(),Vt()});function vt(e){return e?.diff?_A(e?.updatedCode??e?.code):_A(e?.code)}function yt(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:void 0}function bt(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function xt(){return yt(E(Qe)?.lineHeight)??(E(Te)===12?18:Math.max(12,Math.round(E(Te)*1.5)))}function St(){let e=E(Qe)?.padding,t=E(Ge)?0:8,n=bt(e)??t;return{top:n,bottom:n}}function Ct(){return typeof E(Qe)?.fontFamily==`string`&&E(Qe).fontFamily.trim()?E(Qe).fontFamily.trim():`"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace`}function wt(){let e=St(),t=Ct(),n=yt(E(Qe)?.tabSize)??4,r=xt();return[`--markstream-code-font-family: ${t}`,`--vscode-editor-font-size: ${E(Te)}px`,`--vscode-editor-line-height: ${r}px`,`--markstream-code-padding-y: ${e.top}px`,`--markstream-pre-line-number-top: ${e.top}px`,`font-family: ${t}`,`font-size: ${E(Te)}px`,`line-height: ${r}px`,`padding-top: ${e.top}px`,`padding-right: var(--markstream-code-padding-x, 12px)`,`padding-bottom: ${e.bottom}px`,`padding-left: var(--markstream-code-padding-left, 52px)`,`tab-size: ${n}`,`max-height: ${$()}px`,`overflow: auto`,`white-space: ${E(Qe)?.overflow===`scroll`?`pre`:`pre-wrap`}`].join(`; `)}function Tt(e){return!!e&&typeof e==`object`&&typeof e.dark==`string`&&typeof e.light==`string`}function Et(){return typeof d()==`string`&&d()?d():Tt(d())?E(Xe)?d().dark:d().light:(E(Xe)?p():m())||(g()?E(Xe)?g()[0]:g()[1]:(E(Xe)?E(Ze)?.darkTheme:E(Ze)?.lightTheme)||(E(Ze)?.themes?E(Xe)?E(Ze).themes[0]:E(Ze).themes[1]:E(Xe)?`vitesse-dark`:`vitesse-light`))}function Dt(){return[p()??g()?.[0]??E(Ze)?.darkTheme??E(Ze)?.themes?.[0]??`vitesse-dark`,m()??g()?.[1]??E(Ze)?.lightTheme??E(Ze)?.themes?.[1]??`vitesse-light`]}function Ot(){let e={...E(Qe)??{}};for(let t of[`maxHeight`,`padding`,`tabSize`,`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`])delete e[t];let t=e.parseDiffOptions&&typeof e.parseDiffOptions==`object`?e.parseDiffOptions:{},n=E(Ge)?{diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,...e,parseDiffOptions:{context:2,...t}}:e,r=typeof n.unsafeCSS==`string`?n.unsafeCSS:``;return{overflow:`wrap`,...n,MAX_HEIGHT:E(Se)?900:E(Qe)?.maxHeight??500,fontFamily:Ct(),fontSize:E(Te),lineHeight:xt(),disableLineNumbers:!E($e),unsafeCSS:`[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }
|
|
213
|
-
${r}`.trim(),disableFileHeader:!0,stream:!1,themes:Dt(),themeType:E(Xe)?`dark`:`light`,onThemeChange(){Ut(),Wt()}}}function kt(){let e={...E(tt),theme:E(nt)};if(!E(K))return F(K,e,!0),E(K);for(let t of Object.keys(E(K)))t in e||delete E(K)[t];return Object.assign(E(K),e),E(K)}async function At(){if(E(G)||E(me)||typeof window>`u`)return;if(E(fe))return E(fe);let e=E(De),t=(async()=>{let t=await Lj();if(E(xe)&&E(De)===e){if(!t||typeof t.createCodeBlockRuntime!=`function`){F(me,!0);return}F(G,t.createCodeBlockRuntime(kt()),!0),await Promise.resolve(E(G).setTheme?.(E(nt))),E(xe)&&E(De)===e&&F(Me,E(nt),!0)}})().finally(()=>{E(fe)===t&&F(fe,null)});return F(fe,t,!0),t}function jt(){E(G)&&E(nt)&&E(nt)!==E(Me)&&(F(Me,E(nt),!0),Promise.resolve(E(G).setTheme?.(E(nt))).catch(e=>{typeof console<`u`&&console.warn(`[markstream-svelte] Failed to apply code-block theme:`,e)}))}async function Mt(){if(!E(xe)||!E(mt)||!E(le)||E(Z)||E(dt)||E(pt))return;let e=E(De);try{await At()}catch(t){E(xe)&&E(De)===e&&R(t);return}if(!E(xe)||E(De)!==e||E(me)||!E(G))return;kt();let t=E(Ge)?`diff`:`single`;if((!((t===`diff`?E(G).getDiffEditorView?.():E(G).getEditorView?.())&&Nt(t))||E(ge)!==t||E(_e)!==!1)&&(await Lt(t),!E(xe)||E(me)||!E(G)||!Nt(t)||E(ge)!==t))return;let n=E(De);try{E(Ge)&&typeof E(G).updateDiff==`function`?await Promise.resolve(E(G).updateDiff(E(Ke),E(Q)||E(We),E(Ue))):typeof E(G).updateCode==`function`&&(await Promise.resolve(E(G).updateCode(E(We),E(Ue))),Kt()),!E(pe)&&await It(t,E(De))&&(F(ve,!0),F(ye,!0),F(pe,!0)),jt(),Ht(),Wt()}catch(e){E(xe)&&E(De)===n&&R(e)}}function Nt(e){if(!E(le))return!1;let t=[`diffs-container`,`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`);return!!E(le).querySelector(t)}function Pt(){return E(le)?.querySelector([`diffs-container`,`[data-stream-diffs-state]`,`.stream-diffs-shell`].join(`,`))??null}function Ft(e,t=!1){if(!E(le)||!Nt(e))return!1;if(t){let e=window.getComputedStyle(E(le));if(e.display===`none`||e.visibility===`hidden`||Number.parseFloat(e.opacity||`1`)<=.01)return!1}let n=Pt();if(!n)return!1;let r=n.getBoundingClientRect();if(r.width<=0||r.height<=0)return!1;let i=window.getComputedStyle(n);return i.display!==`none`&&i.visibility!==`hidden`&&Number.parseFloat(i.opacity||`1`)>.01}async function It(e,t){await v();let n=Date.now()+1500,r=0;for(;Date.now()<n&&r<30;){if(r+=1,!E(xe)||!E(le)||E(De)!==t)return!1;if(Zt(!0),await Bt(),Ft(e))return Zt(!0),await Bt(),Ft(e)}return!!(E(xe)&&E(le)&&E(De)===t&&Ft(e))}async function Lt(e){if(!E(le)||!E(G)||E(be))return E(be);let t=E(G),n=ne(De);F(pe,!1);let r=(async()=>{try{if(Vt(!1),!E(xe)||!E(le)||E(De)!==n||E(G)!==t)return;if(E(le).replaceChildren(),F(Ae,null),F(je,null),F(_e,!1),e===`diff`&&typeof t.createDiffEditor==`function`){if(await t.createDiffEditor(E(le),E(Ke),E(Q)||E(We),E(Ue)),!E(xe)||E(De)!==n||E(G)!==t||(await Promise.resolve(t.updateDiff?.(E(Ke),E(Q)||E(We),E(Ue))),!E(xe)||E(De)!==n||E(G)!==t))return;F(ge,`diff`)}else{if(await t.createEditor(E(le),E(We),E(Ue)),!E(xe)||E(De)!==n||E(G)!==t||(await Promise.resolve(t.updateCode?.(E(We),E(Ue))),!E(xe)||E(De)!==n||E(G)!==t))return;F(ge,`single`)}if(Ht(),Yt(),jt(),!await It(e,n))return;F(ve,!0),F(ye,!0),F(pe,!0),Wt()}catch(e){E(xe)&&E(De)===n&&E(G)===t&&R(e)}})().finally(()=>{E(be)===r&&F(be,null)});return F(be,r,!0),r}function Rt(){return E(Fe)||F(Fe,(async()=>{if(await v(),await Bt(),E(be))try{await E(be)}catch{}if(!E(xe)||!E(mt)||!E(le)||E(Z)||E(dt)||E(pt)||(await At(),!E(xe)||E(me)||!E(G)))return;kt();let e=E(Ge)?`diff`:`single`;if((!Nt(e)||E(ge)!==e)&&await Lt(e),E(xe)&&!E(me)&&E(G)&&Nt(e)&&E(ge)===e){if(E(Ge)){await Promise.resolve(E(G).updateDiff?.(E(Ke),E(Q)||E(We),E(Ue))),E(G).refreshDiffPresentation?.(),Ht(),Wt();return}await Promise.resolve(E(G).updateCode?.(E(We),E(Ue))),Kt(140,!0),Ht(),Wt()}})().finally(()=>{F(Fe,null)}),!0),E(Fe)}function zt(){E(Ie)&&clearTimeout(E(Ie)),F(Ie,setTimeout(()=>{F(Ie,null),Rt()},80),!0)}function Bt(){return typeof window>`u`||typeof window.requestAnimationFrame!=`function`?Promise.resolve():new Promise(e=>window.requestAnimationFrame(()=>e()))}function Vt(e=!0){e&&(F(De,E(De)+1),F(be,null),F(fe,null)),Xt(),Gt();try{e?E(G)?.cleanupEditor?.():(E(G)?.safeClean||E(G)?.cleanupEditor)?.()}catch{}F(ge,null),F(_e,null),F(ve,!1),F(ye,!1),F(pe,!1),F(Ae,null),F(je,null),e&&(F(G,null),F(K,null),F(fe,null),F(Me,``))}function Ht(){(E(Ge)?E(G)?.getDiffEditorView?.():E(G)?.getEditorView?.())?.updateOptions?.({fontSize:E(Te)}),Ut(),Wt()}function Ut(){if(!E(le))return;let e=yt(E(Qe)?.tabSize)??4;E(le).style.setProperty(`--diffs-tab-size`,String(e)),typeof E(Qe)?.padding==`number`?E(le).style.setProperty(`--diffs-gap-block`,`${St().top}px`):E(le).style.removeProperty(`--diffs-gap-block`)}function $(){return E(Qe)?.maxHeight??500}function Wt(){typeof window>`u`||!E(le)||!E(pe)||(E(Oe)??F(Oe,window.requestAnimationFrame(()=>{F(Oe,null),window.requestAnimationFrame(()=>Zt())}),!0))}function Gt(){E(Oe)==null||typeof window>`u`||(window.cancelAnimationFrame(E(Oe)),F(Oe,null))}function Kt(e=140,t=!1){typeof window>`u`||(F(Be,E(Be)||t,!0),E(Re)&&clearTimeout(E(Re)),F(Re,setTimeout(()=>{F(Re,null),E(ze)??F(ze,window.requestAnimationFrame(()=>{let e=E(Be);F(Be,!1),F(ze,null),Jt(e)}),!0)},e),!0))}function qt(){E(Re)&&(clearTimeout(E(Re)),F(Re,null)),F(Be,!1),!(E(ze)==null||typeof window>`u`)&&(window.cancelAnimationFrame(E(ze)),F(ze,null))}function Jt(e=!1){try{let t=E(Ge)?E(G)?.getDiffEditorView?.()?.getModifiedEditor?.():E(G)?.getEditorView?.(),n=t?.getModel?.(),r=n?.forceTokenization;if(e&&!E(Ge)&&typeof n?.setValue==`function`){let e=Number(t?.getScrollTop?.()||0),r=Number(t?.getScrollLeft?.()||0),i=t?.getSelection?.();n.setValue(E(We)),i&&t?.setSelection?.(i),Number.isFinite(e)&&t?.setScrollTop?.(e),Number.isFinite(r)&&t?.setScrollLeft?.(r)}let i=Number(n?.getLineCount?.()||0);if(typeof r!=`function`||!Number.isFinite(i)||i<=0)return;for(let e=1;e<=i;e+=1)r.call(n,e);t?.render?.(!0)}catch{}}function Yt(){Xt();let e=(e,t)=>{try{let n=e?.[t];if(typeof n!=`function`)return;let r=n.call(e,()=>Wt());r&&E(ke).push(r)}catch{}};if(E(Ge)){let t=E(G)?.getDiffEditorView?.(),n=t?.getOriginalEditor?.(),r=t?.getModifiedEditor?.();try{let e=t?.onDidUpdateDiff?.(()=>Wt());e&&E(ke).push(e)}catch{}e(n,`onDidContentSizeChange`),e(r,`onDidContentSizeChange`),e(n,`onDidLayoutChange`),e(r,`onDidLayoutChange`);return}let t=E(G)?.getEditorView?.();e(t,`onDidContentSizeChange`),e(t,`onDidLayoutChange`)}function Xt(){for(let e of E(ke))try{typeof e==`function`?e():e?.dispose?.()}catch{}F(ke,[],!0)}function Zt(e=!1){if(!E(le)||!E(G)||!E(pe)&&!e||E(Z))return;let t=$(),n=E(Ge)?tn(E(le))??en():en();if(!n||n<=0)return;let r=Qt(),i=E(Se)||!Number.isFinite(t)?Math.ceil(n):Math.ceil(Math.min(n,t)),a=Math.max(r,i);E(le).style.height=`${a}px`,E(le).style.minHeight=`${a}px`,E(le).style.maxHeight=E(Se)||!Number.isFinite(t)?`none`:`${Math.ceil(t)}px`,E(le).style.overflow=E(Ge)?`hidden`:n>a?`auto`:`hidden`,$t(a)}function Qt(){if(!E(le)||typeof window>`u`)return 0;let e=[window.getComputedStyle(E(le).parentElement||E(le)).minHeight,window.getComputedStyle(E(le)).minHeight];for(let t of e){let e=Number.parseFloat(t);if(Number.isFinite(e)&&e>0)return Math.ceil(e)}return 0}function $t(e){let t=Math.max(0,E(le)?.clientWidth||0),n=Math.ceil(t),r=Math.ceil(e);if(E(Ae)!==n||E(je)!==r){F(Ae,n,!0),F(je,r,!0);try{E(Ge)?E(G)?.getDiffEditorView?.()?.layout?.(t>0?{width:n,height:r}:void 0):E(G)?.getEditorView?.()?.layout?.(t>0?{width:n,height:r}:void 0)}catch{}}}function en(){try{if(E(Ge)){let e=E(G)?.getDiffEditorView?.(),t=e?.getOriginalEditor?.(),n=e?.getModifiedEditor?.(),r=Number(t?.getContentHeight?.()||0),i=Number(n?.getContentHeight?.()||0),a=Math.max(r,i);if(a>0)return Math.ceil(a+1)}let e=E(G)?.getEditorView?.(),t=Number(e?.getContentHeight?.()||0);if(t>0)return Math.ceil(t)}catch{}return null}function tn(e){if(typeof window>`u`)return null;try{let t=e.getBoundingClientRect();if(t.height<=0)return null;let n=e.querySelector([`diffs-container`,`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`));if(!n)return null;let r=n.getBoundingClientRect().bottom-t.top;return r>0?Math.ceil(r+1):null}catch{return null}}async function nn(){await _M(E(We)),r()?.events?.onCopy?.(E(We)),F(Ce,!0),E(Ee)&&clearTimeout(E(Ee)),F(Ee,setTimeout(()=>{F(Ce,!1)},1e3),!0)}function rn(){C()&&(F(Te,Math.max(10,E(Te)-1),!0),Ht())}function an(){C()&&(F(Te,E(rt),!0),Ht())}function on(){C()&&(F(Te,Math.min(24,E(Te)+1),!0),Ht())}function sn(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||Jj(n,t,`top`,!1,void 0,E(Xe))}function cn(e){sn(e,E(Ce)?L(`common.copied`)||`Copied`:L(`common.copy`)||`Copy`)}var ln=X(),un=q(ln),dn=e=>{var t=jM();let r;var i=W(t),a=e=>{var t=OM(),r=W(t),i=W(r);ae(i,()=>E(st),!0),n(i);var a=z(i,2),o=M(a,!0);n(r);var s=z(r,2),u=W(s),d=e=>{var t=CM(),r=W(t),i=e=>{var t=xM();y(e,t)},a=e=>{var t=SM();y(e,t)};h(r,e=>{E(Ce)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(Ce)?L(`common.copied`):L(`common.copy`)]),f(`blur`,t,()=>Yj()),l(`click`,t,nn),f(`focus`,t,cn),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,cn),y(e,t)};h(u,e=>{T()&&e(d)});var p=z(u,2),m=e=>{var t=wM(),n=q(t),r=z(n,2),i=z(r,2);H((e,t,a)=>{B(n,`aria-label`,e),B(r,`aria-label`,t),B(i,`aria-label`,a)},[()=>L(`common.decrease`),()=>L(`common.reset`),()=>L(`common.increase`)]),f(`blur`,n,()=>Yj()),l(`click`,n,rn),f(`focus`,n,e=>sn(e,L(`common.decrease`)||`Decrease`)),f(`mouseleave`,n,()=>Yj()),f(`mouseenter`,n,e=>sn(e,L(`common.decrease`)||`Decrease`)),f(`blur`,r,()=>Yj()),l(`click`,r,an),f(`focus`,r,e=>sn(e,L(`common.reset`)||`Reset`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>sn(e,L(`common.reset`)||`Reset`)),f(`blur`,i,()=>Yj()),l(`click`,i,on),f(`focus`,i,e=>sn(e,L(`common.increase`)||`Increase`)),f(`mouseleave`,i,()=>Yj()),f(`mouseenter`,i,e=>sn(e,L(`common.increase`)||`Increase`)),y(e,t)};h(p,e=>{ee()&&C()&&e(m)});var g=z(p,2),_=e=>{var t=TM();H(e=>B(t,`aria-label`,e),[()=>L(`common.preview`)]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(we,!E(we))),f(`focus`,t,e=>sn(e,L(`common.preview`)||`Preview`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>sn(e,L(`common.preview`)||`Preview`)),y(e,t)};h(g,e=>{E(lt)&&O()&&e(_)});var v=z(g,2),b=e=>{var t=EM(),r=W(t),i=M(r);n(t),H(e=>{B(t,`aria-pressed`,E(Se)),B(t,`aria-label`,e),B(i,`d`,E(Se)?`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`)},[()=>E(Se)?L(`common.collapse`):L(`common.expand`)]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(Se,!E(Se))),f(`focus`,t,e=>sn(e,E(Se)?L(`common.collapse`)||`Collapse`:L(`common.expand`)||`Expand`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>sn(e,E(Se)?L(`common.collapse`)||`Collapse`:L(`common.expand`)||`Expand`)),y(e,t)};h(v,e=>{D()&&e(b)});var x=z(v,2),S=e=>{var t=DM(),r=W(t);let i;n(t),H(e=>{B(t,`aria-pressed`,E(Z)),B(t,`aria-label`,e),i=j(r,``,i,{rotate:E(Z)?`0deg`:`90deg`})},[()=>E(Z)?L(`common.expand`):L(`common.collapse`)]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(Z,!E(Z))),f(`focus`,t,e=>sn(e,E(Z)?L(`common.expand`)||`Expand`:L(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>sn(e,E(Z)?L(`common.expand`)||`Expand`:L(`common.collapse`)||`Collapse`)),y(e,t)};h(x,e=>{A()&&e(S)}),n(s),n(t),H(()=>c(o,E(Ge)?`Diff / ${E(ct)}`:E(ct))),y(e,t)};h(i,e=>{w()&&e(a)});var o=z(i,2),s=e=>{var t=AM();let r;var i=W(t),a=e=>{var t=kM();let n;se(t,e=>F(le,e),()=>E(le)),H(()=>n=Y(t,1,`code-editor-container`,null,n,{"is-hidden":!E(ve)})),y(e,t)};h(i,e=>{E(dt)||e(a)});var o=z(i,2);let s;gM(W(o),{class:`code-pre-fallback`,enhanceable:!1,get node(){return E(ht)},get showLineNumbers(){return E($e)},get style(){return E(gt)}}),n(o),n(t),H(()=>{r=Y(t,1,`code-block-body`,null,r,{"code-block-body--expanded":E(Se)}),s=Y(o,1,`code-editor-fallback-surface`,null,s,{"is-hidden":E(ye)})}),y(e,t)};h(o,e=>{E(Z)||e(s)});var u=z(o,2),d=e=>{pM(e,{get code(){return E(We)},get title(){return E(ut)},get isDark(){return E(Xe)},get htmlPreviewAllowScripts(){return N()},get htmlPreviewSandbox(){return P()},onClose:()=>F(we,!1)})};h(u,e=>{E(we)&&E(lt)&&e(d)}),n(t),H(()=>{r=Y(t,1,`code-block-container`,null,r,{"is-dark":E(Xe),"is-plain-text":E(Ue)===`plaintext`,"is-rendering":E(Je),"is-diff":E(Ge)}),B(t,`data-markstream-enhanced`,E(pe)&&!E(me)?`true`:`false`),j(t,E(ot))}),y(e,t)};h(un,e=>{E(mt)&&e(dn)}),y(e,ln),x()}T([`click`]);var NM=()=>_e(()=>import(`../chunks/Y--VMh3y.js`),[],import.meta.url),PM=null,FM=NM,IM=null;function LM(e){if(!e)return e;if(e.D2&&typeof e.D2==`function`)return e.D2;if(e.default&&e.default.D2&&typeof e.default.D2==`function`)return e.default.D2;let t=e.default??e;return typeof t==`function`?t:t?.D2&&typeof t.D2==`function`?t.D2:t}async function RM(){if(PM)return PM;if(IM)return await IM;let e=FM;if(!e)return null;IM=(async()=>{let t;try{t=await e()}catch(t){throw e===NM?Error(`Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.`):t}return t?(PM=LM(t),PM):null})();try{return await IM}finally{IM=null}}var zM=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],BM=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function VM(e){return e.replace(/["']\s*javascript:/gi,`#`).replace(/\bjavascript:/gi,`#`).replace(/["']\s*vbscript:/gi,`#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`)}function HM(e){if(!e)return``;let t=e.trim();return BM.test(t)?t:``}function UM(e){let t=new Set([`script`]),n=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of n){if(t.has(e.tagName.toLowerCase())){e.remove();continue}let n=Array.from(e.attributes);for(let t of n){let n=t.name;if(/^on/i.test(n)){e.removeAttribute(n);continue}if(n===`style`&&t.value&&zM.some(e=>e.test(t.value))){e.removeAttribute(n);continue}if((n===`href`||n===`xlink:href`)&&t.value){let r=HM(t.value);if(!r){e.removeAttribute(n);continue}r!==t.value&&e.setAttribute(n,r)}}}}function WM(e){if(typeof DOMParser>`u`||!e)return``;let t=VM(e),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)return``;let r=n;return UM(r),r.outerHTML}function GM(e){return e?typeof e==`string`?e:typeof e.svg==`string`?e.svg:typeof e.data==`string`?e.data:``:``}var KM=r(`<div class="d2-mode-toggle"><button type="button"> </button> <button type="button"> </button></div>`),qM=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),JM=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),YM=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon d2-action-btn"><!></button>`),XM=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon d2-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"></path></svg></button>`),ZM=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon d2-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),QM=r(`<div class="markstream-svelte-enhanced-block__header d2-block-header"><div class="d2-header-title"><span class="d2-label">D2</span></div> <div class="markstream-svelte-enhanced-block__actions d2-header-actions"><!> <!> <!> <!></div></div>`),$M=r(`<p class="d2-error"> </p>`),eN=r(`<div class="d2-source"><pre class="d2-code"><code> </code></pre> <!></div>`),tN=r(`<div class="d2-render"><div class="d2-svg"></div> <!></div>`),nN=r(`<div class="markstream-svelte-enhanced-block__body d2-block-body"><!></div>`),rN=r(`<div data-markstream-d2="1"><!> <!></div>`);function iN(t,r){i(r,!0);let a={N1:`#E5E7EB`,N2:`#CBD5E1`,N3:`#94A3B8`,N4:`#64748B`,N5:`#475569`,N6:`#334155`,N7:`#0B1220`,B1:`#60A5FA`,B2:`#3B82F6`,B3:`#2563EB`,B4:`#1D4ED8`,B5:`#1E40AF`,B6:`#111827`,AA2:`#22D3EE`,AA4:`#0EA5E9`,AA5:`#0284C7`,AB4:`#FBBF24`,AB5:`#F59E0B`},o=k(r,`context`,3,void 0),s=k(r,`maxHeight`,3,void 0),u=k(r,`loading`,3,void 0),d=k(r,`isDark`,3,void 0),p=k(r,`themeId`,3,void 0),m=k(r,`darkThemeId`,3,void 0),g=k(r,`showHeader`,3,!0),_=k(r,`showModeToggle`,3,!0),v=k(r,`showCopyButton`,3,!0),b=k(r,`showExportButton`,3,!0),S=k(r,`showCollapseButton`,3,!0),{t:C}=Aj(),w=V(!1),T=V(0),D=V(``),O=V(``),A=V(``),ee=V(``),te=V(!1),N=V(!1),P=V(!1),L=V(!1),re=V(!1),ie=V(!1),R=null,oe=I(()=>_A(r.node?.code)),se=I(()=>u()??r.node?.loading===!0),U=I(()=>d()??o()?.isDark??!1),le=I(()=>!(E(se)&&!E(oe).trim())),G=I(()=>E(ie)||!E(A)),K=I(()=>s()?`max-height: ${s()}; --ms-d2-render-max-height: ${s()}`:``);ue(()=>{F(w,!0),J(!0)}),de(()=>{E(w)&&(fe(),E(re),E(ie),e(()=>{J()}))}),ce(()=>{F(w,!1),F(T,E(T)+1),R&&clearTimeout(R)});async function J(e=!1){if(!E(w)||E(re)||E(ie)||!E(oe).trim())return;let t=fe();if(E(te)){(t!==E(O)||e)&&(F(N,!0),F(P,E(P)||e,!0));return}if(!e&&t===E(D)&&(E(A)||E(ee)))return;let n=ne(T);F(O,t,!0),F(D,t,!0),F(te,!0),F(ee,``);try{let e=await RM();if(!E(w)||n!==E(T))return;let t=pe(e);if(!t||typeof t.compile!=`function`||typeof t.render!=`function`)throw Error(`D2 renderer is not available.`);let r=await t.compile(E(oe)),i=r?.diagram??r,o=r?.renderOptions??r?.options??{},s={...o};s.themeID=E(U)&&m()!=null?m():p()??o.themeID,s.darkThemeID=null,s.darkThemeOverrides=null,E(U)&&(s.themeOverrides={...a,...o.themeOverrides||{}});let c=await t.render(i,s);if(!E(w)||n!==E(T))return;let l=WM(GM(c));if(!l)throw Error(`D2 rendered empty SVG.`);F(A,l.replace(`<svg`,`<svg class="markstream-d2-root-svg"`),!0)}catch(e){n===E(T)&&(F(A,``),F(ee,e instanceof Error?e.message:String(e),!0))}finally{if(n===E(T)&&(F(te,!1),F(O,``),E(N))){let e=E(P);F(N,!1),F(P,!1),J(e)}}}function fe(){return`${E(oe)}\n${E(U)}\n${p()}\n${m()}`}function pe(e){if(typeof e==`function`){let t=new e;if(t&&typeof t.compile==`function`)return t;if(typeof e.compile==`function`)return e}return e?.D2&&typeof e.D2==`function`?new e.D2:typeof e?.compile==`function`?e:null}async function me(){await _M(E(oe)),o()?.events?.onCopy?.(E(oe)),F(L,!0),R&&clearTimeout(R),R=setTimeout(()=>{F(L,!1)},1e3)}function he(){E(A)&&yM(E(A),`d2-diagram-${Date.now()}.svg`)}function ge(e){F(ie,e===`source`),E(ie)||J(!0)}function _e(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||Jj(n,t,`top`,!1,void 0,E(U))}function ve(e){_e(e,E(L)?C(`common.copied`)||`Copied`:C(`common.copy`)||`Copy`)}var ye=X(),be=q(ye),xe=e=>{var t=rN();let r;var i=W(t),a=e=>{var t=QM(),r=z(W(t),2),i=W(r),a=e=>{var t=KM(),r=W(t);let i;var a=M(r,!0),o=z(r,2);let s;var u=M(o,!0);n(t),H((e,t)=>{i=Y(r,1,`markstream-svelte-enhanced-block__action mode-btn d2-mode-btn`,null,i,{"is-active":!E(ie)}),c(a,e),s=Y(o,1,`markstream-svelte-enhanced-block__action mode-btn d2-mode-btn`,null,s,{"is-active":E(ie)}),c(u,t)},[()=>C(`common.preview`),()=>C(`common.source`)]),f(`blur`,r,()=>Yj()),l(`click`,r,()=>ge(`preview`)),f(`focus`,r,e=>_e(e,C(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>_e(e,C(`common.preview`)||`Preview`)),f(`blur`,o,()=>Yj()),l(`click`,o,()=>ge(`source`)),f(`focus`,o,e=>_e(e,C(`common.source`)||`Source`)),f(`mouseleave`,o,()=>Yj()),f(`mouseenter`,o,e=>_e(e,C(`common.source`)||`Source`)),y(e,t)};h(i,e=>{_()&&e(a)});var o=z(i,2),s=e=>{var t=YM(),r=W(t),i=e=>{var t=qM();y(e,t)},a=e=>{var t=JM();y(e,t)};h(r,e=>{E(L)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(L)?C(`common.copied`)||`Copied`:C(`common.copy`)||`Copy`]),f(`blur`,t,()=>Yj()),l(`click`,t,me),f(`focus`,t,ve),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,ve),y(e,t)};h(o,e=>{v()&&e(s)});var u=z(o,2),d=e=>{var t=XM();H(e=>B(t,`aria-label`,e),[()=>C(`common.export`)||`Export`]),f(`blur`,t,()=>Yj()),l(`click`,t,he),f(`focus`,t,e=>_e(e,C(`common.export`)||`Export`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>_e(e,C(`common.export`)||`Export`)),y(e,t)};h(u,e=>{b()&&E(A)&&e(d)});var p=z(u,2),m=e=>{var t=ZM(),r=W(t);let i;n(t),H(e=>{B(t,`aria-label`,e),B(t,`aria-pressed`,E(re)),i=j(r,``,i,{transform:E(re)?`rotate(0deg)`:`rotate(90deg)`})},[()=>E(re)?C(`common.expand`)||`Expand`:C(`common.collapse`)||`Collapse`]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(re,!E(re))),f(`focus`,t,e=>_e(e,E(re)?C(`common.expand`)||`Expand`:C(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>_e(e,E(re)?C(`common.expand`)||`Expand`:C(`common.collapse`)||`Collapse`)),y(e,t)};h(p,e=>{S()&&e(m)}),n(r),n(t),y(e,t)};h(i,e=>{g()&&e(a)});var o=z(i,2),s=e=>{var t=nN(),r=W(t),i=e=>{var t=eN(),r=W(t),i=W(r),a=M(i,!0);n(r);var o=z(r,2),s=e=>{var t=$M(),n=M(t,!0);H(()=>c(n,E(ee))),y(e,t)};h(o,e=>{E(ee)&&e(s)}),n(t),H(()=>c(a,E(oe))),y(e,t)},a=e=>{var t=tN(),r=W(t);ae(r,()=>E(A),!0),n(r);var i=z(r,2),a=e=>{var t=$M(),n=M(t,!0);H(()=>c(n,E(ee))),y(e,t)};h(i,e=>{E(ee)&&e(a)}),n(t),H(()=>j(t,E(K))),y(e,t)};h(r,e=>{E(G)?e(i):e(a,-1)}),n(t),y(e,t)};h(o,e=>{E(re)||e(s)}),n(t),H(()=>{r=Y(t,1,`markstream-svelte-enhanced-block markstream-svelte-enhanced-block--d2`,null,r,{dark:E(U),"is-rendering":E(te)||E(se)}),B(t,`data-markstream-mode`,E(G)?`fallback`:`preview`)}),y(e,t)};h(be,e=>{E(le)&&e(xe)}),y(t,ye),x()}T([`click`]);function aN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var oN=r(`<span class="emoji-node"> </span>`);function sN(e,t){i(t,!0);let n=I(()=>_A(t.node?.raw||t.node?.markup||t.node?.content||t.node?.name));var r=oN(),a=M(r,!0);H(()=>c(a,E(n))),y(e,r),x()}function cN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0),a=k(t,`tag`,3,`span`);var o=X(),c=q(o);s(c,a,!1,(e,i)=>{{let e=I(()=>gA(t.node?.children)),o=I(()=>String(r()??a())+`-`+a());mI(i,{get nodes(){return E(e)},get context(){return n()},get prefix(){return E(o)}})}}),y(e,o),x()}function lN(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`em`})}function uN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var dN=r(`<a class="footnote-anchor">↩︎</a>`);function fN(e,t){i(t,!0);let n=I(()=>_A(t.node?.id)),r=I(()=>E(n)?`#fnref-${E(n)}`:void 0);function a(e){e.preventDefault(),!(typeof document>`u`||!E(n))&&document.getElementById(`fnref-${E(n)}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}var o=dN();H(()=>{B(o,`href`,E(r)),B(o,`title`,E(n)?`返回引用 ${E(n)}`:void 0)}),l(`click`,o,a),y(e,o),x()}T([`click`]);var pN=r(`<div class="footnote-node"><div class="footnote-node__content"><!></div></div>`);function mN(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=I(()=>_A(t.node?.id)),s=I(()=>gA(t.node?.children)),c=I(()=>`footnote-${a()??(E(o)||`node`)}`);var l=pN(),u=W(l);mI(W(u),{get nodes(){return E(s)},get context(){return r()},get prefix(){return E(c)}}),n(u),n(l),H(()=>B(l,`id`,E(o)?`fnref--${E(o)}`:void 0)),y(e,l),x()}var hN=r(`<sup class="footnote-reference"><span> </span></sup>`);function gN(e,t){i(t,!0);let r=I(()=>_A(t.node?.id)),a=I(()=>E(r)?`#fnref--${E(r)}`:void 0),o=I(()=>E(a)?{href:E(a)}:{});function s(e){e.preventDefault(),!(typeof document>`u`||!E(r))&&document.querySelector(E(a)||``)?.scrollIntoView({behavior:`smooth`,block:`start`})}var u=hN(),d=W(u);P(d,()=>({...E(o),title:E(r)?`查看脚注 ${E(r)}`:void 0,class:`footnote-link cursor-pointer`}));var f=M(d);n(u),H(()=>{B(u,`id`,E(r)?`fnref-${E(r)}`:void 0),c(f,`[${E(r)??``}]`)}),l(`click`,u,s),y(e,u),x()}T([`click`]);var _N=r(`<br/>`);function vN(e){var t=_N();y(e,t)}function yN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0),a=I(()=>xA(t.node?.level)),o=I(()=>`h`+E(a));var c=X(),l=q(c);s(l,()=>E(o),!1,(e,i)=>{P(e,()=>({class:`heading-node heading-${E(a)??``}`}));{let e=I(()=>gA(t.node?.children)),a=I(()=>String(r()??`heading`)+`-heading`);mI(i,{get nodes(){return E(e)},get context(){return n()},get prefix(){return E(a)}})}}),y(e,c),x()}function bN(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`mark`})}function xN(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}function SN(e,t){i(t,!0);let n=I(()=>yj(t.node,t.context));var r=X(),a=q(r);ae(a,()=>E(n)),y(e,r),x()}var CN=r(`<img/>`),wN=r(`<span class="image-shimmer"></span>`),TN=r(`<span class="image-node__raw-text"> </span>`),EN=r(`<span class="image-placeholder"><!></span>`),DN=r(`<span class="image-error"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"></path></svg> <span> </span></span>`),ON=r(`<span class="image-node-container"><!></span>`);function kN(t,r){i(r,!0);let a=k(r,`fallbackSrc`,3,``),o=k(r,`lazy`,3,!1),s=k(r,`usePlaceholder`,3,!0),{t:l}=Aj();function u(e,t,n){return n||e?{src:e,stage:`primary`}:t?{src:t,stage:`fallback`}:{src:``,stage:`failed`}}let p=I(()=>ny(r.node?.src)),m=I(()=>ny(a())),g=I(()=>_A(r.node?.alt)),_=I(()=>_A(r.node?.title)),v=I(()=>_A(r.node?.raw)),b=I(()=>!!r.node?.loading),S=I(()=>!o()),C=e(()=>ny(r.node?.src)),w=e(()=>ny(a())),T=e(()=>!!r.node?.loading),D=u(C,w,T),O=V(J(C)),A=V(J(w)),j=V(J(T)),ee=V(J(D.src)),te=V(J(D.stage)),N=V(!1),P=V(D.stage===`failed`);re(()=>{if(E(p)!==E(O)||E(m)!==E(A)||E(b)!==E(j)){F(O,E(p),!0),F(A,E(m),!0),F(j,E(b),!0);let e=u(E(p),E(m),E(b));F(ee,e.src,!0),F(te,e.stage,!0),F(N,!1),F(P,e.stage===`failed`)}});function L(){if(E(te)===`primary`&&E(m)&&E(m)!==E(ee)){F(ee,E(m),!0),F(te,`fallback`),F(N,!1),F(P,!1);return}F(te,`failed`),F(P,!0),F(N,!1)}function ne(e){let t=e.currentTarget;if(t&&t.naturalWidth===0&&t.naturalHeight===0){L();return}F(N,!0),F(P,!1)}var ie=ON(),R=W(ie),ae=e=>{var t=CN();let n;H(e=>{n=Y(t,1,`image-node__img`,null,n,{"is-loaded":E(S)||E(N),"is-loading":!E(S)&&!E(N)}),B(t,`src`,E(ee)),B(t,`alt`,E(g)),B(t,`title`,E(_)||E(g)||void 0),B(t,`loading`,o()?`lazy`:void 0),B(t,`fetchpriority`,E(S)?`high`:void 0),B(t,`decoding`,E(S)?`sync`:`async`),B(t,`aria-label`,e)},[()=>E(g)||l(`image.preview`)]),f(`error`,t,L),f(`load`,t,ne),d(t),y(e,t)},oe=e=>{var t=EN(),r=W(t),i=e=>{var t=wN();y(e,t)},a=e=>{var t=TN(),n=M(t,!0);H(()=>c(n,E(v))),y(e,t)};h(r,e=>{s()?e(i):e(a,-1)}),n(t),y(e,t)},se=e=>{var t=DN(),r=z(W(t),2),i=M(r,!0);n(t),H(e=>c(i,e),[()=>l(`image.loadError`)]),y(e,t)};h(R,e=>{!E(b)&&!E(P)&&E(ee)?e(ae):E(P)?e(se,-1):e(oe,1)}),n(ie),y(t,ie),x()}var AN=null,jN=null;async function MN(){return jN||(AN||=_e(()=>import(`../chunks/C3mlWJXx.js`).then(e=>{let t=e&&e.default?e.default:e,n=t;return typeof t==`function`&&t.prototype&&t.prototype.render?n=t:e?.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),jN=n,n}),[],import.meta.url).catch(e=>(console.warn(`[markstream-svelte] Failed to load @antv/infographic`,e),null)),await AN)}function NN(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)&&t>0?t:null}function PN(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(e&&!e.startsWith(`%%`))return(e.match(/^([A-Z][\w-]*)\b/i)?.[1])?.toLowerCase()||``}return``}function FN(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`%%`)),n=Math.max(1,t.length),r=PN(e);return r===`gantt`?220+n*28:r===`sequencediagram`?180+n*26:r===`classdiagram`||r===`statediagram`||r===`erdiagram`?180+n*24:r===`flowchart`||r===`graph`?170+n*28:200+n*22}function IN(e){let t=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return t>=3?500:t>0?280+t*60:360}function LN(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function RN(e,t){return NN(e?getComputedStyle(e).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)??t}var zN=r(`<div class="infographic-mode-toggle"><button type="button"><span class="markstream-svelte-enhanced-block__action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></g></svg> <span> </span></span></button> <button type="button"><span class="markstream-svelte-enhanced-block__action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m16 18l6-6l-6-6M8 6l-6 6l6 6"></path></svg> <span> </span></span></button></div>`),BN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),VN=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),HN=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),UN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><!></button>`),WN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10l5 5l5-5"></path></g></svg></button>`),GN=r(`<button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"></path></svg></button>`),KN=r(`<div class="markstream-svelte-enhanced-block__header infographic-block-header"><div class="markstream-svelte-enhanced-block__title"><span class="markstream-svelte-enhanced-block__title-icon icon-slot action-icon" aria-hidden="true"></span> <span class="markstream-svelte-enhanced-block__title-text infographic-label">Infographic</span></div> <!> <div class="markstream-svelte-enhanced-block__actions infographic-header-actions"><!> <!> <!> <!></div></div>`),qN=r(`<div class="infographic-source"><pre class="infographic-source-code"><code> </code></pre></div>`),JN=r(`<div class="markstream-svelte-zoom-controls"><button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action infographic-action-btn infographic-zoom-reset"> </button></div>`),YN=r(`<pre class="infographic-source-code infographic-pending-source"><code> </code></pre>`),XN=r(`<p class="d2-error"> </p>`),ZN=r(`<!> <div class="infographic-render"><!> <div></div> <!></div>`,1),QN=r(`<div class="markstream-svelte-enhanced-block__body infographic-block-body"><!></div>`),$N=r(`<div><div class="mermaid-modal-overlay infographic-modal-overlay" role="dialog" aria-modal="true" tabindex="-1"><div class="mermaid-modal-panel infographic-modal-panel"><div class="mermaid-modal-controls"><button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="markstream-svelte-enhanced-block__action infographic-action-btn infographic-zoom-reset"> </button> <button type="button" class="markstream-svelte-enhanced-block__action markstream-svelte-enhanced-block__action--icon infographic-action-btn"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 6L6 18M6 6l12 12"></path></svg></button></div> <div class="mermaid-modal-body"><div class="mermaid-modal-content infographic-modal-content"></div></div></div></div></div>`),eP=r(`<div data-markstream-infographic="1"><!> <!> <!></div>`);function tP(t,r){i(r,!0);let a=k(r,`context`,3,void 0),o=k(r,`maxHeight`,3,`500px`),s=k(r,`estimatedPreviewHeightPx`,3,void 0),u=k(r,`loading`,3,void 0),d=k(r,`isDark`,3,void 0),p=k(r,`showHeader`,3,!0),m=k(r,`showModeToggle`,3,!0),g=k(r,`showCopyButton`,3,!0),_=k(r,`showCollapseButton`,3,!0),b=k(r,`showExportButton`,3,!0),S=k(r,`showFullscreenButton`,3,!0),C=k(r,`showZoomControls`,3,!0),{t:w}=Aj(),T=V(null),D=V(null),O=V(!1),A=V(0),ee=V(``),te=V(``),N=V(``),P=V(null),L=V(``),re=V(!1),ie=V(!1),R=V(!1),U=V(!1),le=V(!1),G=V(!1),K=V(!1),J=V(!1),fe=V(!1),me=V(!1),he=V(``),ge=V(1),_e=null,ve=I(()=>_A(r.node?.code)),ye=I(()=>typeof r.node?.loading!=`boolean`||!!r.node?.loading),be=I(()=>u()??E(ye)),xe=I(()=>a()?.final??E(be)===!1),Z=I(()=>E(be)!==!1||E(xe)===!1),Se=I(()=>d()??a()?.isDark??!1),Ce=I(()=>o()===`none`?null:NN(o())),we=I(()=>LN(NN(s())??IN(E(ve)),RN(E(D),360),E(Ce)??void 0)),Te=I(()=>[`min-height: ${E(we)}px`,o()&&o()!==`none`?`max-height: ${o()}`:``].filter(Boolean).join(`; `)),Ee=I(()=>`transform: scale(${E(ge)}); transform-origin: center center;`),De=I(()=>!(E(be)&&!E(ve).trim()));ue(()=>{F(O,!0),Oe(!0)}),de(()=>{E(O)&&(`${E(ve)}${E(Se)}${E(xe)}${E(Z)}`,E(J),E(fe),e(()=>{Oe()}))}),ce(()=>{F(O,!1),F(A,E(A)+1),Ae(),F(ee,``),_e&&clearTimeout(_e)});function Oe(e=!1){E(O)&&E(T)&&!E(J)&&!E(fe)&&E(ve).trim()&&(F(le,E(le)||e,!0),!E(U)&&(F(U,!0),v().then(()=>{F(U,!1);let e=E(le);return F(le,!1),ke(e)})))}async function ke(e=!1){if(!E(O)||!E(T)||E(J)||E(fe))return;if(!E(ve).trim()){Ae(),E(T)&&vM(E(T)),F(G,!1),F(L,``),F(ee,``),F(N,``);return}let t=E(ve),n=E(xe),r=`${t}\n${E(Se)}\n${n}\n${E(Z)}`;if(!e&&r===E(ee)&&E(G)||!e&&r===E(N))return;if(E(re)){(r!==E(te)||e)&&(F(ie,!0),F(R,E(R)||e,!0));return}let i=ne(A);F(te,r);let a=!E(Z);F(re,!0),a&&F(L,``);let o=null,s=null;try{let e=await MN();if(!E(O)||i!==E(A)||E(J)||E(fe)||!E(T))return;if(!e)throw Error(`Infographic renderer is not available.`);if(!(r===`${E(ve)}\n${E(Se)}\n${E(xe)}\n${E(Z)}`||!n&&E(be)&&E(ve).startsWith(t)))return;s=Array.from(E(T).childNodes),o=new e({container:E(T),width:`100%`,height:`100%`});let a=``,c=!1;if(o.on?.(`error`,e=>{a=(Array.isArray(e)?e:[e]).map(e=>e instanceof Error?e.message:typeof e==`string`?e:e&&typeof e==`object`&&`message`in e?String(e.message??``):String(e??``)).filter(Boolean).join(`; `)}),o.on?.(`rendered`,()=>{c=!0}),o.render(t),a)throw Error(a);let l=Array.from(E(T).childNodes),u=l.length>0&&(l.length!==s.length||l.some((e,t)=>e!==s?.[t]));if(!c&&!u)throw Error(`Infographic render returned empty output.`);E(P)?.destroy?.(),F(P,o,!0),o=null,F(G,!0),F(L,``),F(ee,r),F(N,``)}catch(e){if(i===E(A)){o?.destroy?.(),o=null,F(ee,``);let t=`${E(ve)}\n${E(Se)}\n${E(xe)}\n${E(Z)}`;a&&r===t?(F(N,``),Ae(),vM(E(T)),F(G,!1),F(L,e instanceof Error?e.message:String(e),!0)):(s&&E(T)&&E(T).replaceChildren(...s),r===t&&F(N,r))}}finally{if(o?.destroy?.(),i===E(A)&&(F(re,!1),F(te,``),E(ie))){let e=E(R);F(ie,!1),F(R,!1),Oe(e)}}}function Ae(){try{E(P)?.destroy?.()}catch{}F(P,null)}function je(){F(A,E(A)+1),Ae(),E(T)&&vM(E(T)),F(re,!1),F(ie,!1),F(R,!1),F(U,!1),F(le,!1),F(G,!1),F(L,``),F(te,``),F(ee,``),F(N,``)}async function Me(){await _M(E(ve)),a()?.events?.onCopy?.(E(ve)),F(K,!0),_e&&clearTimeout(_e),_e=setTimeout(()=>{F(K,!1)},1e3)}function Ne(){let e=E(T)?.querySelector(`svg`);return e?WM(e.outerHTML):``}function Pe(){let e=Ne();e&&yM(e,`infographic-${Date.now()}.svg`)}function Fe(){F(he,E(T)?.innerHTML||``,!0),E(he)&&F(me,!0)}async function Ie(e){let t=e===`source`;E(fe)!==t&&(F(fe,t),je(),E(fe)||(await v(),Oe(!0)))}async function Le(){F(J,!E(J)),je(),E(J)||(await v(),Oe(!0))}function Re(){F(ge,Math.min(3,Math.round((E(ge)+.1)*10)/10),!0)}function ze(){F(ge,Math.max(.5,Math.round((E(ge)-.1)*10)/10),!0)}function Be(e,t){let n=e.currentTarget;!n||n instanceof HTMLButtonElement&&n.disabled||Jj(n,t,`top`,!1,void 0,E(Se))}function Ve(e){Be(e,E(K)?w(`common.copied`)||`Copied`:w(`common.copy`)||`Copy`)}function He(e){return document.body.appendChild(e),{destroy(){e.remove()}}}function Ue(){F(me,!1)}function We(e){e.target===e.currentTarget&&Ue()}function Ge(e){e.key===`Escape`&&Ue()}var Ke=X(),Q=q(Ke),qe=e=>{var t=eP();let r;var i=W(t),a=e=>{var t=KN(),r=W(t),i=W(r);ae(i,()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true"><path fill="#5b8ff9" d="M5 4.25A2.25 2.25 0 0 1 7.25 2h2.5A2.25 2.25 0 0 1 12 4.25v2.5A2.25 2.25 0 0 1 9.75 9h-2.5A2.25 2.25 0 0 1 5 6.75z"/><path fill="#61d9a6" d="M12 17.25A2.25 2.25 0 0 1 14.25 15h2.5A2.25 2.25 0 0 1 19 17.25v2.5A2.25 2.25 0 0 1 16.75 22h-2.5A2.25 2.25 0 0 1 12 19.75z"/><path fill="#f6bd16" d="M12 4.25A2.25 2.25 0 0 1 14.25 2h2.5A2.25 2.25 0 0 1 19 4.25v2.5A2.25 2.25 0 0 1 16.75 9h-2.5A2.25 2.25 0 0 1 12 6.75z"/><path fill="#5ad8a6" d="M7.5 10.75h1.75a6.25 6.25 0 0 1 6.25 6.25v.25h-2V17a4.25 4.25 0 0 0-4.25-4.25H7.5z"/><path fill="#7262fd" d="M15.5 11.1l3.75 2.16v4.33l-3.75 2.16l-3.75-2.16v-4.33z"/></svg>`,!0),n(i),oe(2),n(r);var a=z(r,2),o=e=>{var t=zN(),r=W(t);let i;var a=W(r),o=z(W(a),2),s=M(o,!0);n(a),n(r);var u=z(r,2);let d;var p=W(u),m=z(W(p),2),h=M(m,!0);n(p),n(u),n(t),H((e,t)=>{i=Y(r,1,`markstream-svelte-enhanced-block__action mode-btn infographic-mode-btn`,null,i,{"is-active":!E(fe)}),c(s,e),d=Y(u,1,`markstream-svelte-enhanced-block__action mode-btn infographic-mode-btn`,null,d,{"is-active":E(fe)}),c(h,t)},[()=>w(`common.preview`),()=>w(`common.source`)]),f(`blur`,r,()=>Yj()),l(`click`,r,()=>Ie(`preview`)),f(`focus`,r,e=>Be(e,w(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>Be(e,w(`common.preview`)||`Preview`)),f(`blur`,u,()=>Yj()),l(`click`,u,()=>Ie(`source`)),f(`focus`,u,e=>Be(e,w(`common.source`)||`Source`)),f(`mouseleave`,u,()=>Yj()),f(`mouseenter`,u,e=>Be(e,w(`common.source`)||`Source`)),y(e,t)};h(a,e=>{m()&&e(o)});var s=z(a,2),u=W(s),d=e=>{var t=BN(),r=W(t);let i;n(t),H(e=>{B(t,`aria-label`,e),B(t,`aria-pressed`,E(J)),i=j(r,``,i,{transform:E(J)?`rotate(0deg)`:`rotate(90deg)`})},[()=>E(J)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`]),f(`blur`,t,()=>Yj()),l(`click`,t,Le),f(`focus`,t,e=>Be(e,E(J)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>Be(e,E(J)?w(`common.expand`)||`Expand`:w(`common.collapse`)||`Collapse`)),y(e,t)};h(u,e=>{_()&&e(d)});var p=z(u,2),v=e=>{var t=UN(),r=W(t),i=e=>{var t=VN();y(e,t)},a=e=>{var t=HN();y(e,t)};h(r,e=>{E(K)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(K)?w(`common.copied`)||`Copied`:w(`common.copy`)||`Copy`]),f(`blur`,t,()=>Yj()),l(`click`,t,Me),f(`focus`,t,Ve),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,Ve),y(e,t)};h(p,e=>{g()&&e(v)});var x=z(p,2),C=e=>{var t=WN();H(e=>{B(t,`aria-label`,e),t.disabled=!E(G)||E(fe)||E(J)},[()=>w(`common.export`)||`Export`]),f(`blur`,t,()=>Yj()),l(`click`,t,Pe),f(`focus`,t,e=>Be(e,w(`common.export`)||`Export`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>Be(e,w(`common.export`)||`Export`)),y(e,t)};h(x,e=>{b()&&e(C)});var T=z(x,2),D=e=>{var t=GN();H(e=>{B(t,`aria-label`,e),t.disabled=!E(G)||E(fe)||E(J)},[()=>w(`common.open`)||`Open`]),f(`blur`,t,()=>Yj()),l(`click`,t,Fe),f(`focus`,t,e=>Be(e,w(`common.open`)||`Open`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>Be(e,w(`common.open`)||`Open`)),y(e,t)};h(T,e=>{S()&&e(D)}),n(s),n(t),y(e,t)};h(i,e=>{p()&&e(a)});var o=z(i,2),s=e=>{var t=QN(),r=W(t),i=e=>{var t=qN(),r=W(t),i=W(r),a=M(i,!0);n(r),n(t),H(()=>c(a,E(ve))),y(e,t)},a=e=>{var t=ZN(),r=q(t),i=e=>{var t=JN(),r=W(t),i=z(r,2),a=z(i,2),o=M(a);n(t),H((e,t,n)=>{B(r,`aria-label`,e),B(i,`aria-label`,t),c(o,`${n??``}%`)},[()=>w(`common.zoomIn`)||`Zoom in`,()=>w(`common.zoomOut`)||`Zoom out`,()=>Math.round(E(ge)*100)]),f(`blur`,r,()=>Yj()),l(`click`,r,Re),f(`focus`,r,e=>Be(e,w(`common.zoomIn`)||`Zoom in`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>Be(e,w(`common.zoomIn`)||`Zoom in`)),f(`blur`,i,()=>Yj()),l(`click`,i,ze),f(`focus`,i,e=>Be(e,w(`common.zoomOut`)||`Zoom out`)),f(`mouseleave`,i,()=>Yj()),f(`mouseenter`,i,e=>Be(e,w(`common.zoomOut`)||`Zoom out`)),f(`blur`,a,()=>Yj()),l(`click`,a,()=>F(ge,1)),f(`focus`,a,e=>Be(e,w(`common.resetZoom`)||`Reset zoom`)),f(`mouseleave`,a,()=>Yj()),f(`mouseenter`,a,e=>Be(e,w(`common.resetZoom`)||`Reset zoom`)),y(e,t)};h(r,e=>{C()&&e(i)});var a=z(r,2),o=W(a),s=e=>{var t=YN(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(ve))),y(e,t)};h(o,e=>{!E(G)&&!E(L)&&e(s)});var u=z(o,2);se(u,e=>F(T,e),()=>E(T));var d=z(u,2),p=e=>{var t=XN(),n=M(t,!0);H(()=>c(n,E(L))),y(e,t)};h(d,e=>{E(L)&&e(p)}),n(a),H(()=>{j(a,E(Te)),j(u,E(Ee))}),y(e,t)};h(r,e=>{E(fe)?e(i):e(a,-1)}),n(t),y(e,t)};h(o,e=>{E(J)||e(s)});var u=z(o,2),d=e=>{var t=$N();let r;var i=W(t),a=W(i),o=W(a),s=W(o),u=z(s,2),d=z(u,2),f=M(d),p=z(d,2);n(o);var m=z(o,2),h=W(m);ae(h,()=>E(he),!0),n(h),n(m),n(a),n(i),n(t),pe(t,e=>He?.(e)),H((e,n,i,a,o)=>{r=Y(t,1,`markstream-svelte markstream-svelte-modal-root`,null,r,{dark:E(Se)}),B(s,`aria-label`,e),B(u,`aria-label`,n),B(d,`aria-label`,i),c(f,`${a??``}%`),B(p,`aria-label`,o),j(h,`transform: scale(${E(ge)});`)},[()=>w(`common.zoomIn`)||`Zoom in`,()=>w(`common.zoomOut`)||`Zoom out`,()=>w(`common.resetZoom`)||`Reset zoom`,()=>Math.round(E(ge)*100),()=>w(`common.close`)||`Close`]),l(`click`,i,We),l(`keydown`,i,Ge),l(`click`,s,Re),l(`click`,u,ze),l(`click`,d,()=>F(ge,1)),l(`click`,p,Ue),y(e,t)};h(u,e=>{E(me)&&e(d)}),n(t),se(t,e=>F(D,e),()=>E(D)),H(()=>{r=Y(t,1,`markstream-svelte-enhanced-block markstream-svelte-enhanced-block--infographic`,null,r,{dark:E(Se),"is-rendering":E(re)||E(be)}),B(t,`data-markstream-mode`,E(fe)?`source`:E(G)?`preview`:`fallback`)}),y(e,t)};h(Q,e=>{E(De)&&e(qe)}),y(t,Ke),x()}T([`click`,`keydown`]);function nP({nextContent:e,previousContent:t,typewriterEnabled:n}){return!n||e===t?{settledContent:e,streamedDelta:``,appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:``,appended:!1}}function rP(e,t,n=1){let r=Number(e);return Number.isFinite(r)?Math.max(n,r):t}function iP(e,t){let n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var aP=2048;function oP(){return typeof performance<`u`?performance.now():Date.now()}var sP=class{constructor(e={},t){this.source=``,this.visible=``,this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.fenceScanOffset=0,this.fenceLineStart=0,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.activeFenceMarker=``,this.activeFenceLength=0,this.blockedRevealEnd=0,this.atomicRevealRanges=[],this.atomicRevealRangeIndex=0,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=e=>this.destroyed?()=>{}:(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.enqueue=e=>{if(this.destroyed||!e)return;this.done&&=!1;let t=this.source.length>0,n=this.pendingChars<=0,r=this.isRevealBlocked();if(this.source+=e,this.scanAppendedSource(),n||r&&!this.isRevealBlocked()){let e=oP();this.startedAt=t&&this.hasStarted?e-this.normalizedStartDelayMs:e,this.lastTick=e,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(e={})=>{if(!this.destroyed){if(this.done=!0,this.releaseTrailingFenceCandidate(),e.flush??this.flushOnFinish){this.visible=this.source,this.discardConsumedAtomicRanges(),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.releaseTrailingFenceCandidate(),this.visible=this.source,this.discardConsumedAtomicRanges(),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(e=``,t)=>{if(this.destroyed)return;this.cancelLoop(),t?.prefixKnown||e.startsWith(this.source)?(this.source=e,this.scanAppendedSource()):(this.resetFenceScanner(),this.source=e,this.scanAppendedSource());let n=this.getRevealableEnd();this.visible=n>=this.source.length?this.source:this.source.slice(0,n),this.discardConsumedAtomicRanges(),this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit()},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;let e=oP();this.lastTick=e,this.startedAt||=e,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=e=>{if(this.rafId=0,this.destroyed||this.paused)return;if(!this.hasRevealableChars()){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(e-this.startedAt<this.normalizedStartDelayMs){this.rafId=requestAnimationFrame(this.tick);return}let t=this.pendingChars;if(this.burstInitialContent&&t>=this.burstRevealThresholdChars){let e=this.getRevealableEnd();this.visible.length<e&&(this.visible=e>=this.source.length?this.source:this.source.slice(0,e),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit()),this.ensureLoop();return}let n=1e3/Math.max(1,this.maxCommitFps),r=Math.min(100,Math.max(0,e-this.lastTick));if(r<n){this.rafId=requestAnimationFrame(this.tick);return}this.lastTick=e;let i=this.pendingChars,a=i>this.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,o=dP(i/Math.max(.001,a/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(o-this.currentCps)*.2,this.charBudget+=this.currentCps*(r/1e3),this.charBudget<1){this.ensureLoop();return}let s=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),c=this.takeNextRevealSlice(s);c.text&&(this.visible+=c.text,this.charBudget=Math.max(0,this.charBudget-c.graphemeCount),this.emit()),this.ensureLoop()};let{minCharsPerSecond:n=40,maxCharsPerSecond:r=1e3,targetLatencyMs:i=900,catchUpLatencyMs:a=350,catchUpThreshold:o=600,maxCommitFps:s=30,startDelayMs:c=80,maxCharsPerCommit:l=80,flushOnFinish:u=!1,burstInitialContent:d=!1,burstRevealThresholdChars:f=aP}=e;this.minCharsPerSecond=rP(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,rP(r,1e3,1)),this.normalizedTargetLatencyMs=rP(i,900,1),this.normalizedCatchUpLatencyMs=rP(a,350,1),this.normalizedCatchUpThreshold=iP(o,600),this.normalizedStartDelayMs=iP(c,80),this.maxCommitFps=Math.trunc(rP(s,30,1)),this.maxCharsPerCommit=Math.trunc(rP(l,80,1)),this.flushOnFinish=u,this.burstInitialContent=d===!0,this.burstRevealThresholdChars=Math.max(1,Math.trunc(rP(f,aP,1))),this.segmenter=lP(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}resetFenceScanner(){this.fenceScanOffset=0,this.fenceLineStart=0,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.activeFenceMarker=``,this.activeFenceLength=0,this.blockedRevealEnd=0,this.atomicRevealRanges.length=0,this.atomicRevealRangeIndex=0}scanAppendedSource(e=!1){for(;this.fenceScanOffset<this.source.length;){let t=this.source[this.fenceScanOffset];if(t===`\r`){if(this.fenceScanOffset+1>=this.source.length&&!e)break;if(this.source[this.fenceScanOffset+1]===`
|
|
214
|
-
`){let e=this.fenceScanOffset+2;this.completeFenceLine(e),this.fenceScanOffset=e;continue}}if(t===`
|
|
215
|
-
`){let e=this.fenceScanOffset+1;this.completeFenceLine(e),this.fenceScanOffset=e;continue}this.consumeFenceCharacter(t),this.fenceScanOffset++}this.updateFenceRevealBlock()}consumeFenceCharacter(e){if(this.fenceLineState!==`normal`){if(this.fenceLineState===`opening`){this.fenceMarker==="`"&&e==="`"&&(this.fenceLineState=`normal`);return}if(this.fenceLineState===`closing`){e!==` `&&e!==` `&&(this.fenceLineState=`normal`);return}if(!this.fenceMarker){if(e===` `&&this.fenceIndent<3){this.fenceIndent++;return}if(e==="`"||e===`~`){this.fenceMarker=e,this.fenceMarkerLength=1;return}this.fenceLineState=`normal`;return}if(e===this.fenceMarker){this.fenceMarkerLength++;return}if(this.activeFenceMarker){this.fenceLineState=this.fenceMarker===this.activeFenceMarker&&this.fenceMarkerLength>=this.activeFenceLength&&(e===` `||e===` `)?`closing`:`normal`;return}this.fenceLineState=this.fenceMarkerLength>=3?`opening`:`normal`}}completeFenceLine(e){let t=this.fenceLineState===`candidate`&&this.fenceMarkerLength>=3;!this.activeFenceMarker&&(this.fenceLineState===`opening`||t)?(this.atomicRevealRanges.push({start:this.fenceLineStart,end:e}),this.activeFenceMarker=this.fenceMarker,this.activeFenceLength=this.fenceMarkerLength):this.activeFenceMarker&&this.fenceMarker===this.activeFenceMarker&&this.fenceMarkerLength>=this.activeFenceLength&&(this.fenceLineState===`closing`||t)&&(this.activeFenceMarker=``,this.activeFenceLength=0),this.fenceLineStart=e,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.blockedRevealEnd=0}updateFenceRevealBlock(){this.blockedRevealEnd=!this.activeFenceMarker&&(this.fenceLineState===`opening`||this.fenceLineState===`candidate`&&(this.fenceIndent>0||this.fenceMarkerLength>0))?this.fenceLineStart+1:0}releaseTrailingFenceCandidate(){this.scanAppendedSource(!0),this.blockedRevealEnd&&=((this.fenceLineState===`opening`||this.fenceLineState===`candidate`&&this.fenceMarkerLength>=3)&&this.source.length>this.fenceLineStart&&this.atomicRevealRanges.push({start:this.fenceLineStart,end:this.source.length}),this.fenceLineState=`normal`,0)}isRevealBlocked(){return this.blockedRevealEnd!==0}getRevealableEnd(){return this.blockedRevealEnd?Math.min(this.source.length,this.blockedRevealEnd-1):this.source.length}hasRevealableChars(){return this.visible.length<this.getRevealableEnd()}takeNextRevealSlice(e){this.discardConsumedAtomicRanges();let t=this.getRevealableEnd();if(this.visible.length>=t)return{text:``,graphemeCount:0};let n=this.atomicRevealRanges[this.atomicRevealRangeIndex];if(n&&this.visible.length>=n.start&&this.visible.length<n.end)return uP(this.source,this.visible.length,n.end-this.visible.length,this.segmenter,Math.min(n.end,t));let r=n&&n.start>this.visible.length?Math.min(n.start,t):t;return uP(this.source,this.visible.length,e,this.segmenter,r)}discardConsumedAtomicRanges(){for(;this.atomicRevealRangeIndex<this.atomicRevealRanges.length&&this.atomicRevealRanges[this.atomicRevealRangeIndex].end<=this.visible.length;)this.atomicRevealRangeIndex++;this.atomicRevealRangeIndex>=64&&this.atomicRevealRangeIndex*2>=this.atomicRevealRanges.length&&(this.atomicRevealRanges.splice(0,this.atomicRevealRangeIndex),this.atomicRevealRangeIndex=0)}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||!this.hasRevealableChars())){if(typeof requestAnimationFrame!=`function`){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&=(typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(this.rafId),0)}emit(){if(!this.destroyed)for(let e of this.listeners)e()}};function cP(e={},t){let n=new sP(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function lP(){if(typeof Intl>`u`)return null;let e=Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null}function uP(e,t,n,r,i=e.length){let a=Math.min(e.length,Math.max(t,i));if(t>=a||n<=0)return{text:``,graphemeCount:0};if(!r){let r=t,i=0;for(;r<a&&i<n;){let t=e.charCodeAt(r),n=e.charCodeAt(r+1);r=Math.min(a,r+(t>=55296&&t<=56319&&n>=56320&&n<=57343?2:1)),i++}return{text:e.slice(t,r),graphemeCount:i}}let o=t,s=0,c=!0;for(;s<n&&o<a;){let t=e.codePointAt(o),n=t>65535?2:1;if(o+n>a||!pP(t)){c=!1;break}o+=n,s++}if(c&&o>t&&!(o<a&&e.charCodeAt(o-1)===13&&e.charCodeAt(o)===10)){let n=e.codePointAt(o),r=n!=null&&o+(n!=null&&n>65535?2:1)<=a&&pP(n);if(o>=a||r)return{text:e.slice(t,o),graphemeCount:s}}let l=a-t,u=Math.min(l,Math.max(64,n*2));for(;;){let i=u>=l,a=e.slice(t,t+u),o=0,s=0;for(let i of r.segment(a)){if(s>=n)return{text:e.slice(t,t+o),graphemeCount:s};o+=i.segment.length,s++}if(i)return{text:e.slice(t,t+o),graphemeCount:s};u=Math.min(l,u*2)}}function dP(e,t,n){return Math.min(n,Math.max(t,e))}function fP(e){return e>=11904&&e<=12329||e>=12336&&e<=12351||e>=12352&&e<=12440||e>=12443&&e<=12543||e>=12544&&e<=12799||e>=12800&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65103||e>=65280&&e<=65437||e>=65440&&e<=65519||e>=127488&&e<=127743||e>=131072&&e<=196607}function pP(e){return e<=127||fP(e)}var mP=r(`<span> </span>`),hP=r(`<code class="inline-code-node"> <!></code>`);function gP(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=``,s=``,l=`markstream-svelte-text__stream-delta--a`,u=I(()=>_A(t.node?.code??t.node?.content??t.node?.raw)),d=I(()=>`${String(r()?.customId??`global`)}:${String(r()?.streamRenderVersion??0)}:${String(a()??`inline-code`)}`),f=I(()=>r()?.fade!==!1),p=I(()=>{let e=r()?.textStreamState,t=E(d)===o?s:e?.get(E(d))??``,n=nP({nextContent:E(u),previousContent:t,typewriterEnabled:E(f)});return n.appended&&(l=l.endsWith(`--a`)?`markstream-svelte-text__stream-delta--b`:`markstream-svelte-text__stream-delta--a`),o=E(d),s=E(u),e?.set(E(d),E(u)),{stableCode:n.settledContent,deltaCode:n.streamedDelta,deltaClass:l}});var m=hP(),g=W(m),_=z(g),v=e=>{var t=mP(),n=M(t,!0);H(()=>{Y(t,1,`markstream-svelte-text__stream-delta text-node-stream-delta ${E(p).deltaClass??``}`),c(n,E(p).deltaCode)}),y(e,t)};h(_,e=>{E(p).deltaCode&&e(v)}),n(m),H(()=>c(g,`${E(p).stableCode??``} `)),y(e,m),x()}function _P(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`ins`})}var vP=r(`<span class="link-loading-indicator"></span>`),yP=r(`<a><span class="link-text-wrapper"><span class="link-text"><!></span><!></span></a>`);function bP(e,t){i(t,!0);let r=I(()=>Ok({href:_A(t.node?.href)},`safe`,`a`).href??``),a=I(()=>_A(t.node?.title||E(r))),o=I(()=>gA(t.node?.children)),s=I(()=>t.showTooltip??t.context?.showTooltips??!0),u=I(()=>E(r).startsWith(`#`)&&E(r).length>1),d=I(()=>ey(E(r)));function p(e){E(s)&&E(a)&&Jj(e.currentTarget,E(a),`top`,!1,void 0,t.context?.isDark)}function m(e){if(!E(u)||typeof document>`u`)return;e.preventDefault();let t=E(r).slice(1),n=g(t);(document.getElementById(t)||(n===t?null:document.getElementById(n)))?.scrollIntoView({behavior:`smooth`,block:`start`})}function g(e){try{return decodeURIComponent(e)}catch{return e}}var _=yP();let v;var b=W(_),S=W(b),w=W(S),T=e=>{{let n=I(()=>String(t.indexKey??`link`)+`-link`);mI(e,{get nodes(){return E(o)},get context(){return t.context},get prefix(){return E(n)}})}},D=e=>{var n=C();H(e=>c(n,e),[()=>_A(t.node?.text||E(r))]),y(e,n)};h(w,e=>{E(o).length?e(T):e(D,-1)}),n(S);var O=z(S),k=e=>{var t=vP();y(e,t)};h(O,e=>{t.node?.loading&&e(k)}),n(b),n(_),H(e=>{v=Y(_,1,`link-node`,null,v,{"link-loading":e}),B(_,`href`,E(r)||void 0),B(_,`title`,E(s)?void 0:E(a)),B(_,`target`,E(d)?`_blank`:void 0),B(_,`rel`,E(d)?`noreferrer noopener`:void 0)},[()=>!!t.node?.loading]),f(`blur`,_,()=>Yj()),l(`click`,_,m),f(`focus`,_,p),f(`mouseleave`,_,()=>Yj()),f(`mouseenter`,_,p),y(e,_),x()}T([`click`]);var xP=r(`<li><!></li>`);function SP(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0);var o=xP(),s=W(o);{let e=I(()=>gA(t.node?.children)),n=I(()=>String(a()??`li`)+`-li`);mI(s,{get nodes(){return E(e)},get context(){return r()},get prefix(){return E(n)}})}n(o),y(e,o),x()}var CP=r(`<ol><!></ol>`),wP=r(`<ul><!></ul>`);function TP(e,t){i(t,!0);let r=I(()=>!!t.node?.ordered),a=I(()=>Number(t.node?.start));I(()=>E(r)?`ol`:`ul`);var o=X(),s=q(o),c=e=>{var r=CP(),i=W(r);{let e=I(()=>gA(t.node?.items)),n=I(()=>String(t.indexKey??`list`)+`-list`);mI(i,{get nodes(){return E(e)},get context(){return t.context},get prefix(){return E(n)}})}n(r),H(e=>B(r,`start`,e),[()=>Number.isFinite(E(a))?E(a):void 0]),y(e,r)},l=e=>{var r=wP(),i=W(r);{let e=I(()=>gA(t.node?.items)),n=I(()=>String(t.indexKey??`list`)+`-list`);mI(i,{get nodes(){return E(e)},get context(){return t.context},get prefix(){return E(n)}})}n(r),y(e,r)};h(s,e=>{E(r)?e(c):e(l,-1)}),y(e,o),x()}var EP=null,DP=!1,OP=null,kP=MP;function AP(e){let t=e?.default??e;return t&&typeof t.renderToString==`function`?t:null}function jP(){try{return AP(globalThis?.katex)}catch{return null}}function MP(){return(async()=>{let e=jP();if(e)return e;let t=await _e(()=>import(`../chunks/DecrR9TK.js`),[],import.meta.url);try{await _e(()=>import(`../chunks/Dnkino9G.js`),[],import.meta.url)}catch{}return AP(t)})()}function NP(){return typeof kP==`function`}async function PP(){let e=jP();if(e)return EP=e,EP;if(EP)return EP;if(OP)return await OP;if(DP)return null;let t=kP;if(!t)return DP=!0,null;OP=(async()=>{try{let e=await t(),n=AP(e)??e;if(n)return EP=n,EP}catch{}return DP=!0,null})();try{return await OP}finally{OP=null}}function FP(e){return e?e.replace(/·/g,`⋅`).replace(/℃/g,`°C`):``}var IP=`WORKER_BUSY`,LP=null,RP=new Map,zP=new Map,BP=200,VP=new Set,HP=5;function UP(){if(RP.size>=HP||VP.size===0)return;let e=Array.from(VP);VP.clear();for(let t of e)try{t()}catch{}}function WP(e,t,n){if(zP.set(`${t?`d`:`i`}:${e}`,n),zP.size>BP){let e=zP.keys().next().value;e&&zP.delete(e)}}function GP(){return LP=Error(`[markstream-svelte:katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().`),LP.name=`WorkerInitError`,LP.code=`WORKER_INIT_ERROR`,null}async function KP(e,t=!0,n=2e3,r){let i=FP(e);if(!NP()){let e=Error(`KaTeX rendering disabled`);return e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,Promise.reject(e)}if(LP)return Promise.reject(LP);let a=`${t?`d`:`i`}:${i}`,o=zP.get(a);if(o)return o;let s=GP();if(!s)return Promise.reject(LP);if(RP.size>=HP){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=IP,e.busy=!0,e.inFlight=RP.size,e.max=HP,Promise.reject(e)}return new Promise((e,a)=>{if(r?.aborted){let e=Error(`Aborted`);e.name=`AbortError`,a(e);return}let o=Math.random().toString(36).slice(2),c=globalThis.setTimeout(()=>{RP.delete(o),UP();let e=Error(`Worker render timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,a(e)},n),l=()=>{globalThis.clearTimeout(c),RP.delete(o)&&UP();let e=Error(`Aborted`);e.name=`AbortError`,a(e)};r?.addEventListener(`abort`,l,{once:!0}),RP.set(o,{timeoutId:c,resolve:t=>{r?.removeEventListener(`abort`,l),e(t)},reject:e=>{r?.removeEventListener(`abort`,l),a(e)}}),s.postMessage({id:o,type:`render`,content:i,displayMode:t})})}function qP(e,t=!0,n){WP(FP(e),t,n)}function JP(e=2e3,t){return RP.size<HP?Promise.resolve():new Promise((n,r)=>{let i=!1,a=null,o=()=>{i||(i=!0,a&&clearTimeout(a),VP.delete(o),n())};if(VP.add(o),a=setTimeout(()=>{if(i)return;i=!0,VP.delete(o);let e=Error(`Wait for worker slot timed out`);e.name=`WorkerBusyTimeout`,e.code=`WORKER_BUSY_TIMEOUT`,r(e)},e),queueMicrotask(()=>UP()),t){let e=()=>{if(i)return;i=!0,a&&clearTimeout(a),VP.delete(o);let e=Error(`Aborted`);e.name=`AbortError`,r(e)};t.aborted?e():t.addEventListener(`abort`,e,{once:!0})}})}var YP={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1},XP=8;async function ZP(e,t=!0,n={}){if(!NP()){let e=Error(`KaTeX rendering disabled`);throw e.name=`KaTeXDisabled`,e.code=`KATEX_DISABLED`,e}let r=n.timeout??YP.timeout,i=n.waitTimeout??YP.waitTimeout,a=n.backoffMs??YP.backoffMs,o=n.maxRetries??YP.maxRetries,s=Number.isFinite(o)?Math.max(0,Math.min(Math.floor(o),XP)):YP.maxRetries,c=0;for(;;){if(n.signal?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}try{return await KP(e,t,r,n.signal)}catch(e){if(e?.code!==`WORKER_BUSY`||c>=s)throw e;c+=1,await JP(i,n.signal).catch(()=>{}),a>0&&await new Promise(e=>globalThis.setTimeout(e,a*c))}}}var QP=r(`<div class="math-block markstream-nested-math-block" data-markstream-katex-managed="1"><div></div></div>`);function $P(e,t){i(t,!0);let r=V(null),a=V(!0),o=!1,s=0,c=!1,l=I(()=>_A(t.node?.content||t.node?.markup||t.node?.raw)),u=I(()=>_A(t.node?.raw||E(l))),d=I(()=>t.node?.loading===!0);de(()=>{E(r)&&f(E(l),E(u),E(d))}),ce(()=>{o=!0,s+=1});async function f(e,t,n){let i=E(r);if(!i)return;let l=FP(e),u=++s;if(!l){i.textContent=``,F(a,!1);return}c||F(a,!0);let d=await p(l,n);o||u!==s||(d?(i.innerHTML=d,c=!0,F(a,!1)):n||(i.textContent=t||l,F(a,!1)))}async function p(e,t){try{return await ZP(e,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1})}catch(e){let t=e?.code||e?.name;if(!(t===`WORKER_INIT_ERROR`||e?.fallbackToRenderer)&&t!==`WORKER_BUSY`&&t!==`WORKER_TIMEOUT`)return null}let n=await PP();if(!n)return null;try{let r=n.renderToString(e,{throwOnError:t,displayMode:!0});return qP(e,!0,r),r}catch{return null}}var m=QP(),h=W(m);let g;se(h,e=>F(r,e),()=>E(r)),n(m),H(()=>g=Y(h,1,`markstream-nested-math-block__render`,null,g,{"math-rendering":E(a)})),y(e,m),x()}var eF=r(`<span class="math-inline__loading" role="status" aria-live="polite"><span class="math-inline__spinner" aria-hidden="true"></span> <span class="sr-only">Loading</span></span>`),tF=r(`<span class="math-inline-wrapper markstream-nested-math" data-display="inline" data-markstream-katex-managed="1"><span></span> <!></span>`);function nF(e,t){i(t,!0);let r=V(null),a=V(!0),o=!1,s=0,c=!1,l=I(()=>_A(t.node?.content||t.node?.markup||t.node?.raw)),u=I(()=>_A(t.node?.raw||E(l))),d=I(()=>t.node?.loading===!0),f=I(()=>String(t.node?.markup||``)===`$$`);de(()=>{E(r)&&p(E(l),E(u),E(d),E(f))}),ce(()=>{o=!0,s+=1});async function p(e,t,n,i){let l=E(r);if(!l)return;let u=FP(e),d=++s;if(!u){l.textContent=``,F(a,!1);return}c||F(a,!0);let f=await m(u,i,n);o||d!==s||(f?(l.innerHTML=f,c=!0,F(a,!1)):n||(l.textContent=t||u,F(a,!1)))}async function m(e,t,n){try{return await ZP(e,t,{timeout:1500,waitTimeout:0,maxRetries:0})}catch(e){let t=e?.code||e?.name;if(!(t===`WORKER_INIT_ERROR`||e?.fallbackToRenderer)&&t!==`WORKER_BUSY`&&t!==`WORKER_TIMEOUT`)return null}let r=await PP();if(!r)return null;try{let i=r.renderToString(e,{throwOnError:n,displayMode:t});return qP(e,t,i),i}catch{return null}}var g=tF(),_=W(g);let v;se(_,e=>F(r,e),()=>E(r));var b=z(_,2),S=e=>{var t=eF();y(e,t)};h(b,e=>{E(a)&&e(S)}),n(g),H(()=>v=Y(_,1,`math-inline`,null,v,{"math-inline--hidden":E(a)})),y(e,g),x()}var rF=()=>_e(()=>import(`../chunks/J36u8XLO.js`),[],import.meta.url),iF=`__MARKSTREAM_ANGULAR_MERMAID__`,aF=null,oF=!1,sF=null,cF=null,lF=rF;function uF(e){return`${String(e?.securityLevel??`strict`)}|htmlLabels:${e?.flowchart?.htmlLabels===!1?`0`:`1`}`}function dF(e){if(!e)return e;let t=e?.default??e;if(t&&(typeof t.render==`function`||typeof t.parse==`function`||typeof t.initialize==`function`))return t;if(t?.mermaidAPI&&(typeof t.mermaidAPI.render==`function`||typeof t.mermaidAPI.parse==`function`)){let e=t.mermaidAPI;return{...t,render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:n=>typeof t.initialize==`function`?t.initialize(n):e.initialize?e.initialize(n):void 0}}return e?.mermaid&&typeof e.mermaid.render==`function`?e.mermaid:t}function fF(e){if(e)try{let t=e?.initialize;e.initialize=n=>{let r={suppressErrorRendering:!0,...n||{}};if(typeof t==`function`)return t.call(e,r);if(e?.mermaidAPI&&typeof e.mermaidAPI.initialize==`function`)return e.mermaidAPI.initialize(r)}}catch{}}function pF(e,t){if(!e||!t)return;let n=uF(t);if(sF!==n)try{typeof e.initialize==`function`?e.initialize(t):e.mermaidAPI?.initialize&&e.mermaidAPI.initialize(t),sF=n}catch{}}function mF(){try{let e=globalThis;return dF(e?.[iF]??e?.mermaid)}catch{return null}}function hF(e){try{globalThis[iF]=e}catch{}}function gF(){return typeof lF==`function`}async function _F(e){if(aF)return pF(aF,e),aF;let t=mF();if(t)return fF(t),aF=t,hF(aF),pF(aF,e),aF;if(cF){let t=await cF;return t&&pF(t,e),t}if(oF)return null;let n=lF;if(!n)return oF=!0,null;cF=(async()=>{try{let e=dF(await n());return e?(fF(e),aF=e,hF(aF),aF):(oF=!0,null)}catch{return oF=!0,null}})();try{let t=await cF;return t&&pF(t,e),t}finally{cF=null}}var vF=null,yF=new Map,bF=5,xF=`WORKER_BUSY`,SF=`MERMAID_DISABLED`;function CF(){return vF=Error(`[markstream-svelte:mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().`),vF.name=`WorkerInitError`,vF.code=`WORKER_INIT_ERROR`,null}function wF(e,t,n=1400){if(!gF()){let e=Error(`Mermaid rendering disabled`);return e.name=`MermaidDisabled`,e.code=SF,Promise.reject(e)}if(vF)return Promise.reject(vF);let r=CF();if(!r)return Promise.reject(vF);if(yF.size>=bF){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=xF,e.inFlight=yF.size,e.max=bF,Promise.reject(e)}return new Promise((i,a)=>{let o=Math.random().toString(36).slice(2),s=!1,c=null,l=()=>{s||(s=!0,c!=null&&clearTimeout(c),yF.delete(o))};yF.set(o,{resolve:e=>{l(),i(e)},reject:e=>{l(),a(e)}});try{r.postMessage({id:o,action:e,payload:t})}catch(e){yF.delete(o),a(e);return}c=setTimeout(()=>{let e=Error(`Worker call timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,yF.get(o)?.reject(e)},n)})}async function TF(e,t,n=1400){return await wF(`canParse`,{code:e,theme:t},n)}async function EF(e,t,n=1400){return await wF(`findPrefix`,{code:e,theme:t},n)}var DF=r(`<div class="mermaid-toggle"><button type="button"><span class="mermaid-action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></g></svg> <span> </span></span></button> <button type="button"><span class="mermaid-action-content"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m16 18l6-6l-6-6M8 6l-6 6l6 6"></path></svg> <span> </span></span></button></div>`),OF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg viewBox="0 0 24 24" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m9 18l6-6l-6-6"></path></svg></button>`),kF=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6L9 17l-5-5"></path></svg>`),AF=w(`<svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></g></svg>`),jF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><!></button>`),MF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10l5 5l5-5"></path></g></svg></button>`),NF=r(`<button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"></path></svg></button>`),PF=r(`<div class="mermaid-header"><div class="mermaid-header__title"><span class="icon-slot action-icon" aria-hidden="true"></span> <span class="mermaid-title__text">Mermaid</span></div> <!> <div class="mermaid-actions"><!> <!> <!> <!></div></div>`),FF=r(`<pre class="mermaid-source"><code> </code></pre>`),IF=r(`<div class="markstream-svelte-zoom-controls"><button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-zoom-reset"> </button></div>`),LF=r(`<div class="mermaid-loading"><span class="mermaid-spinner"></span> </div>`),RF=r(`<div class="mermaid-error"> </div>`),zF=r(`<!> <div class="mermaid-preview markstream-svelte-mermaid"><!></div> <!>`,1),BF=r(`<div class="mermaid-body"><!></div>`),VF=r(`<div><div class="mermaid-modal-overlay" role="dialog" aria-modal="true" tabindex="-1"><div class="mermaid-modal-panel"><div class="mermaid-modal-controls"><button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M11 8v6m-3-3h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21l-4.35-4.35M8 11h6"></path></g></svg></button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-zoom-reset"> </button> <button type="button" class="mermaid-btn mermaid-action-btn mermaid-btn--icon"><svg aria-hidden="true" role="img" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 6L6 18M6 6l12 12"></path></svg></button></div> <div class="mermaid-modal-body"><div class="mermaid-modal-content markstream-svelte-mermaid"></div></div></div></div></div>`),HF=r(`<div data-markstream-mermaid="1"><!> <!> <!></div>`);function UF(t,r){i(r,!0);let a=k(r,`context`,3,void 0),o=k(r,`maxHeight`,3,`500px`),s=k(r,`estimatedPreviewHeightPx`,3,void 0),u=k(r,`loading`,3,void 0),d=k(r,`isDark`,3,void 0),p=k(r,`workerTimeoutMs`,3,1400),m=k(r,`parseTimeoutMs`,3,1800),g=k(r,`renderTimeoutMs`,3,2500),_=k(r,`fullRenderTimeoutMs`,3,4e3),b=k(r,`renderDebounceMs`,3,300),S=k(r,`showHeader`,3,!0),C=k(r,`showModeToggle`,3,!0),w=k(r,`showCopyButton`,3,!0),T=k(r,`showExportButton`,3,!0),D=k(r,`showFullscreenButton`,3,!0),O=k(r,`showCollapseButton`,3,!0),A=k(r,`showZoomControls`,3,!0),ee=k(r,`isStrict`,3,!0),te=k(r,`enableMermaidInteractions`,3,!1),{t:N}=Aj(),P=uM(`mermaid`),L=V(!1),re=V(0),ie=V(``),R=V(``),ce=V(``),U=V(``),le=V(J({})),G=V(``),K=V(!1),fe=V(!1),me=V(!1),he=V(!1),ge=V(!1),_e=V(!1),ve=V(1),ye=V(null),be=V(null),xe=V(null),Z=V(null),Se=V(null),Ce=null,we=I(()=>Re(_A(r.node?.code))),Te=I(()=>typeof r.node?.loading!=`boolean`||!!r.node?.loading),Ee=I(()=>u()??E(Te)),De=I(()=>d()??a()?.isDark??!1),Oe=I(()=>E(De)?`dark`:`light`),ke=I(()=>a()?.final??E(Ee)===!1),Ae=I(()=>E(Ee)!==!1||E(ke)===!1),je=I(()=>o()===`none`?null:NN(o())),Me=I(()=>LN(NN(s())??FN(E(we)),RN(E(ye),360),E(je)??void 0)),Ne=I(()=>[`min-height: ${E(Me)}px`,o()&&o()!==`none`?`max-height: ${o()}`:``,`transform: scale(${E(ve)})`].filter(Boolean).join(`; `)),Pe=I(()=>!(E(Ee)&&!E(we).trim())),Fe=I(()=>!(!E(U)||E(ge)));ue(()=>(F(L,!0),Le(!0),()=>{F(L,!1),F(re,E(re)+1),Ie(),E(Se)&&clearTimeout(E(Se))})),de(()=>{E(L)&&(Q(),E(ge),E(he),e(()=>Le()))}),de(()=>{E(L)&&E(_e)&&E(U)&&E(xe)&&te()&&e(()=>void v().then(()=>Je(E(xe))))});function Ie(){E(Z)&&(clearTimeout(E(Z)),F(Z,null))}function Le(e=!1){if(!E(L)||E(ge)||E(he))return;let t=Q();if(t===E(ie)&&E(K)||!e&&t===E(ie)&&(E(U)||E(G)||E(R)===t)||(e&&Ie(),E(Z)))return;let n=e||!E(Ae)?0:Math.max(0,b());F(Z,setTimeout(()=>{F(Z,null),Be(e)},n),!0)}function Re(e){return e.replace(/\]::([^:])/g,`]:::$1`).replace(/:::subgraphNode$/gm,`::subgraphNode`)}function ze(e,t){return e.trimStart().startsWith(`%%{`)?e:`%%{init: {"theme": "${t===`dark`?`dark`:`default`}"}}%%\n${e}`}async function Be(e=!1){if(!E(L)||E(ge)||E(he))return;if(!E(we).trim()){F(U,``),F(G,``),F(ce,``),F(R,``),F(fe,!1),F(le,{},!0);return}let t=Ke(E(we)),n=Q();if(n===E(ie)&&E(K)||!e&&n===E(ie)&&(E(U)||E(G)||E(R)===n))return;let r=ne(re);F(ie,n,!0),F(K,!0),E(Ae)||F(G,``);try{let e=await _F({startOnLoad:!1,securityLevel:ee()?`strict`:`loose`,suppressErrorRendering:!0,...ee()?{flowchart:{htmlLabels:!1}}:{}});if(!E(L)||r!==E(re))return;if(!e)throw Error(`Mermaid is not available.`);let i=E(we),a=!0;if(E(Ae)){if(E(fe)&&t===E(ce)&&E(U)){F(G,``);return}let o=await He(E(we),E(Oe),e);if(!E(L)||r!==E(re))return;if(o.fullOk)i=E(we);else if(o.prefixOk&&o.prefix&&!E(fe))i=o.prefix,a=!1;else{F(G,``),F(R,n,!0);let e=E(le)[E(Oe)];e&&F(U,e,!0);return}}else await Ve(E(we),E(Oe),e);let o=await qe(()=>Promise.resolve(e.render(`markstream-svelte-mermaid-${r}`,ze(i,E(Oe)))),a?_():g());if(!E(L)||r!==E(re))return;let s=Qk(typeof o==`string`?o:o?.svg);if(!s)throw Error(`Mermaid rendered empty SVG.`);F(U,s,!0),Ce=typeof o==`string`?null:o?.bindFunctions??null,F(G,``),F(R,``),a&&(F(fe,!0),F(ce,t,!0),E(le)[E(Oe)]=s),te()&&typeof o!=`string`&&(await v(),E(L)&&r===E(re)&&(Je(E(be)),E(_e)&&Je(E(xe))))}catch(e){r===E(re)&&(E(Ae)?(F(G,``),F(R,n,!0)):(F(U,``),F(G,e instanceof Error?e.message:String(e),!0)))}finally{r===E(re)&&F(K,!1)}}async function Ve(e,t,n){try{if(await TF(e,t,p()))return!0}catch{}let r=ze(e,t);return typeof n?.parse==`function`?(await qe(()=>Promise.resolve(n.parse(r)),m()),!0):(await qe(()=>Promise.resolve(n.render(`markstream-svelte-mermaid-parse-${E(re)}`,r)),m()),!0)}async function He(e,t,n){if(PN(e)===`gantt`){let r=Ge(e);if(!r.trim())return{fullOk:!1,prefixOk:!1};try{return await Ve(r,t,n),r===e?{fullOk:!0,prefixOk:!1}:{fullOk:!1,prefixOk:!0,prefix:r}}catch{return{fullOk:!1,prefixOk:!1}}}try{return await Ve(e,t,n),{fullOk:!0,prefixOk:!1}}catch{}let r=Ge(e);if(!r.trim()||r===e)return{fullOk:!1,prefixOk:!1};try{let n=await EF(e,t,p());n?.trim()&&(r=n)}catch{}try{return await Ve(r,t,n),{fullOk:!1,prefixOk:!0,prefix:r}}catch{return{fullOk:!1,prefixOk:!1}}}function Ue(e){let t=e.trim();return!t||t.startsWith(`%%`)||/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)?!1:t.includes(`:`)}function We(e){let t=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&t.length>0&&t.pop();t.length>0;){let e=t[t.length-1]?.trim();if(!e||e.startsWith(`%%`)){t.pop();continue}if(Ue(e))break;t.pop()}return t.some(Ue)?t.join(`
|
|
216
|
-
`):``}function Ge(e){if(PN(e)===`gantt`)return We(e);let t=e.split(`
|
|
217
|
-
`);for(;t.length>0;){let e=(t[t.length-1]||``).trimEnd();if(!e){t.pop();continue}if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}return t.join(`
|
|
218
|
-
`).trim()||``}function Ke(e){return e.replace(/\s+/g,``)}function Q(){return`${E(we)}\n${E(Oe)}\n${ee()}\n${te()}\n${E(ke)}\n${E(Ae)}`}function qe(e,t){return!t||t<=0?e():new Promise((n,r)=>{let i=setTimeout(()=>r(Error(`Operation timed out`)),t);e().then(e=>{clearTimeout(i),n(e)}).catch(e=>{clearTimeout(i),r(e)})})}function Je(e){if(te()&&e?.querySelector(`svg`))try{Ce?.(e)}catch{}}async function Ye(){await _M(E(we)),a()?.events?.onCopy?.(E(we)),F(me,!0),E(Se)&&clearTimeout(E(Se)),F(Se,setTimeout(()=>{F(me,!1)},1e3),!0)}function Xe(){E(U)&&yM(E(U),`mermaid-diagram-${Date.now()}.svg`)}function Ze(e){F(ge,e===`source`),E(ge)||Be()}function Qe(){F(ve,Math.min(3,Math.round((E(ve)+.1)*10)/10),!0)}function $e(){F(ve,Math.max(.5,Math.round((E(ve)-.1)*10)/10),!0)}function et(e,t,n=`top`){let r=e.currentTarget;!r||r instanceof HTMLButtonElement&&r.disabled||Jj(r,t,n,!1,void 0,E(De))}function tt(e){et(e,E(me)?N(`common.copied`)||`Copied`:N(`common.copy`)||`Copy`)}function nt(e){return document.body.appendChild(e),{destroy(){e.remove()}}}function rt(){F(_e,!1)}function it(e){e.target===e.currentTarget&&rt()}function at(e){e.key===`Escape`&&rt()}var ot=X(),st=q(ot),ct=e=>{var t=HF();let r;var i=W(t),a=e=>{var t=PF(),r=W(t),i=W(r);ae(i,()=>P,!0),n(i),oe(2),n(r);var a=z(r,2),o=e=>{var t=DF(),r=W(t);let i;var a=W(r),o=z(W(a),2),s=M(o,!0);n(a),n(r);var u=z(r,2);let d;var p=W(u),m=z(W(p),2),h=M(m,!0);n(p),n(u),n(t),H((e,t)=>{i=Y(r,1,`mermaid-toggle-btn`,null,i,{"mermaid-toggle-btn--active":!E(ge)}),c(s,e),d=Y(u,1,`mermaid-toggle-btn`,null,d,{"mermaid-toggle-btn--active":E(ge)}),c(h,t)},[()=>N(`common.preview`),()=>N(`common.source`)]),f(`blur`,r,()=>Yj()),l(`click`,r,()=>Ze(`preview`)),f(`focus`,r,e=>et(e,N(`common.preview`)||`Preview`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>et(e,N(`common.preview`)||`Preview`)),f(`blur`,u,()=>Yj()),l(`click`,u,()=>Ze(`source`)),f(`focus`,u,e=>et(e,N(`common.source`)||`Source`)),f(`mouseleave`,u,()=>Yj()),f(`mouseenter`,u,e=>et(e,N(`common.source`)||`Source`)),y(e,t)};h(a,e=>{C()&&e(o)});var s=z(a,2),u=W(s),d=e=>{var t=OF(),r=W(t);let i;n(t),H(e=>{B(t,`aria-pressed`,E(he)),B(t,`aria-label`,e),i=j(r,``,i,{rotate:E(he)?`0deg`:`90deg`})},[()=>E(he)?N(`common.expand`):N(`common.collapse`)]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(he,!E(he))),f(`focus`,t,e=>et(e,E(he)?N(`common.expand`)||`Expand`:N(`common.collapse`)||`Collapse`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>et(e,E(he)?N(`common.expand`)||`Expand`:N(`common.collapse`)||`Collapse`)),y(e,t)};h(u,e=>{O()&&e(d)});var p=z(u,2),m=e=>{var t=jF(),r=W(t),i=e=>{var t=kF();y(e,t)},a=e=>{var t=AF();y(e,t)};h(r,e=>{E(me)?e(i):e(a,-1)}),n(t),H(e=>B(t,`aria-label`,e),[()=>E(me)?N(`common.copied`):N(`common.copy`)]),f(`blur`,t,()=>Yj()),l(`click`,t,Ye),f(`focus`,t,tt),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,tt),y(e,t)};h(p,e=>{w()&&e(m)});var g=z(p,2),_=e=>{var t=MF();H(e=>{B(t,`aria-label`,e),t.disabled=!E(U)||E(ge)||E(he)},[()=>N(`common.export`)]),f(`blur`,t,()=>Yj()),l(`click`,t,Xe),f(`focus`,t,e=>et(e,N(`common.export`)||`Export`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>et(e,N(`common.export`)||`Export`)),y(e,t)};h(g,e=>{T()&&e(_)});var v=z(g,2),b=e=>{var t=NF();H(e=>{B(t,`aria-label`,e),t.disabled=!E(U)||E(ge)||E(he)},[()=>N(`common.open`)]),f(`blur`,t,()=>Yj()),l(`click`,t,()=>F(_e,!0)),f(`focus`,t,e=>et(e,N(`common.open`)||`Open`)),f(`mouseleave`,t,()=>Yj()),f(`mouseenter`,t,e=>et(e,N(`common.open`)||`Open`)),y(e,t)};h(v,e=>{D()&&e(b)}),n(s),n(t),y(e,t)};h(i,e=>{S()&&e(a)});var o=z(i,2),s=e=>{var t=BF(),r=W(t),i=e=>{var t=FF(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(we))),y(e,t)},a=e=>{var t=zF(),r=q(t),i=e=>{var t=IF(),r=W(t),i=z(r,2),a=z(i,2),o=M(a);n(t),H((e,t,n,s)=>{B(r,`aria-label`,e),B(i,`aria-label`,t),B(a,`aria-label`,n),c(o,`${s??``}%`)},[()=>N(`common.zoomIn`),()=>N(`common.zoomOut`),()=>N(`common.resetZoom`),()=>Math.round(E(ve)*100)]),f(`blur`,r,()=>Yj()),l(`click`,r,Qe),f(`focus`,r,e=>et(e,N(`common.zoomIn`)||`Zoom in`)),f(`mouseleave`,r,()=>Yj()),f(`mouseenter`,r,e=>et(e,N(`common.zoomIn`)||`Zoom in`)),f(`blur`,i,()=>Yj()),l(`click`,i,$e),f(`focus`,i,e=>et(e,N(`common.zoomOut`)||`Zoom out`)),f(`mouseleave`,i,()=>Yj()),f(`mouseenter`,i,e=>et(e,N(`common.zoomOut`)||`Zoom out`)),f(`blur`,a,()=>Yj()),l(`click`,a,()=>F(ve,1)),f(`focus`,a,e=>et(e,N(`common.resetZoom`)||`Reset zoom`)),f(`mouseleave`,a,()=>Yj()),f(`mouseenter`,a,e=>et(e,N(`common.resetZoom`)||`Reset zoom`)),y(e,t)};h(r,e=>{A()&&e(i)});var a=z(r,2),o=W(a),s=e=>{var t=X(),n=q(t);ae(n,()=>E(U)),y(e,t)},u=e=>{var t=FF(),r=W(t),i=M(r,!0);n(t),H(()=>c(i,E(we))),y(e,t)},d=e=>{var t=LF(),r=z(W(t));n(t),H(e=>c(r,` ${e??``}`),[()=>N(`common.preview`)]),y(e,t)};h(o,e=>{E(U)?e(s):E(G)?e(u,1):e(d,-1)}),n(a),se(a,e=>F(be,e),()=>E(be));var p=z(a,2),m=e=>{var t=RF(),n=M(t,!0);H(()=>c(n,E(G))),y(e,t)};h(p,e=>{E(G)&&e(m)}),H(()=>j(a,E(Ne))),y(e,t)};h(r,e=>{E(ge)?e(i):e(a,-1)}),n(t),y(e,t)};h(o,e=>{E(he)||e(s)});var u=z(o,2),d=e=>{var t=VF();let r;var i=W(t),a=W(i),o=W(a),s=W(o),u=z(s,2),d=z(u,2),f=M(d),p=z(d,2);n(o);var m=z(o,2),h=W(m);ae(h,()=>E(U),!0),n(h),se(h,e=>F(xe,e),()=>E(xe)),n(m),n(a),n(i),n(t),pe(t,e=>nt?.(e)),H((e,n,i,a,o)=>{r=Y(t,1,`markstream-svelte markstream-svelte-modal-root`,null,r,{dark:E(De)}),B(s,`aria-label`,e),B(u,`aria-label`,n),B(d,`aria-label`,i),c(f,`${a??``}%`),B(p,`aria-label`,o),j(h,`transform: scale(${E(ve)});`)},[()=>N(`common.zoomIn`),()=>N(`common.zoomOut`),()=>N(`common.resetZoom`),()=>Math.round(E(ve)*100),()=>N(`common.close`)]),l(`click`,i,it),l(`keydown`,i,at),l(`click`,s,Qe),l(`click`,u,$e),l(`click`,d,()=>F(ve,1)),l(`click`,p,rt),y(e,t)};h(u,e=>{E(_e)&&e(d)}),n(t),se(t,e=>F(ye,e),()=>E(ye)),H(()=>{r=Y(t,1,`mermaid-block`,null,r,{dark:E(De),"is-rendering":E(Ee)||E(K)}),B(t,`data-markstream-mode`,E(ge)?`source`:E(Fe)?`preview`:`fallback`)}),y(e,t)};h(st,e=>{E(Pe)&&e(ct)}),y(t,ot),x()}T([`click`,`keydown`]);var WF=r(`<p class="paragraph-node"><!></p>`);function GF(e,r){i(r,!0);let a=k(r,`context`,3,void 0),o=k(r,`indexKey`,3,void 0),s=I(()=>String(o()??`p`)),c=I(()=>TA(gA(r.node?.children)));var l=X(),u=q(l);t(u,19,()=>E(c),(e,t)=>E(s)+`-`+t,(e,t,r)=>{var i=X(),o=q(i),c=e=>{var i=WF(),o=W(i);{let e=I(()=>E(s)+`-`+E(r));mI(o,{get nodes(){return E(t).nodes},get context(){return a()},get prefix(){return E(e)}})}n(i),y(e,i)},l=e=>{{let n=I(()=>E(s)+`-`+E(r));pI(e,{get node(){return E(t).node},get context(){return a()},get indexKey(){return E(n)}})}};h(o,e=>{E(t).kind===`inline`?e(c):e(l,-1)}),y(e,i)}),y(e,l),x()}function KF(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}function qF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`del`})}function JF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`strong`})}function YF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`sub`})}function XF(e,t){let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0);cN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},tag:`sup`})}function ZF(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}var QF=r(`<span> </span>`),$F=r(`<span> <!></span>`);function eI(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0);k(t,`typewriter`,3,void 0);let o=``,s=``,l=`markstream-svelte-text__stream-delta--a`,u=I(()=>_A(t.node?.content??t.node?.raw)),d=I(()=>!!t.node?.center),f=I(()=>String(r()?.customId??`global`)+`:`+String(r()?.streamRenderVersion??0)+`:`+String(a()??`node`)),p=I(()=>r()?.fade!==!1),m=I(()=>{let e=r()?.textStreamState,t=E(f)===o?s:e?.get(E(f))??``,n=nP({nextContent:E(u),previousContent:t,typewriterEnabled:E(p)});return n.appended&&(l=l.endsWith(`--a`)?`markstream-svelte-text__stream-delta--b`:`markstream-svelte-text__stream-delta--a`),o=E(f),s=E(u),e?.set(E(f),E(u)),{stableContent:n.settledContent,deltaContent:n.streamedDelta,deltaClass:l}});var g=$F();let _;var v=W(g,!0),b=z(v),S=e=>{var t=QF(),n=M(t,!0);H(()=>{Y(t,1,`markstream-svelte-text__stream-delta text-node-stream-delta ${E(m).deltaClass??``}`),c(n,E(m).deltaContent)}),y(e,t)};h(b,e=>{E(m).deltaContent&&e(S)}),n(g),H(()=>{B(g,`data-typewriter`,r()?.typewriter===!0?`1`:void 0),_=Y(g,1,`markstream-svelte-text-node text-node`,null,_,{"markstream-svelte-text--centered":E(d)}),c(v,E(m).stableContent)}),y(e,g),x()}var tI=r(`<hr/>`);function nI(e){var t=tI();y(e,t)}function rI(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=I(()=>yj(t.node,n()));var a=X(),o=q(a);ae(o,()=>E(r)),y(e,a),x()}function iI(e,t){if(t?.renderCodeBlocksAsPre)return`pre`;let n=CA(e);return n===`d2`||n===`d2lang`?`d2`:n===`infographic`?`infographic`:n===`mermaid`?`mermaid`:`code`}function aI(e){return String(e?.tag||``).trim().toLowerCase()||my(e?.content)}function oI(e){let t=aI(e);return t?{...e,type:t,tag:t,content:gy(e?.content,t)}:e}function sI(e,t){let n=aI(e);return n?{...e,type:t,tag:n}:e}function cI(e,t){if(String(e?.type||``)!==`code_block`)return null;let n=iI(e,t);return n===`mermaid`?uI(t?.mermaidProps,FN(lI(e))):n===`d2`?t?.d2Props??null:n===`infographic`?uI(t?.infographicProps,IN(lI(e))):t?.codeBlockProps??null}function lI(e){return String(e?.code??``)}function uI(e,t){let n={...e||{}};return NN(n.estimatedPreviewHeightPx)??(n.estimatedPreviewHeightPx=LN(t,void 0,n.maxHeight===`none`?null:NN(n.maxHeight)??void 0)),n}function dI(e,t,n){let r=n??t?.customComponents??null,i=String(e?.type||``);if(i===`code_block`){let n=CA(e),i=n?r?.[n]:null;if(i)return i;let a=iI(e,t);if(a===`mermaid`&&r?.mermaid)return r.mermaid;if(a===`d2`&&r?.d2)return r.d2;if(a===`infographic`&&r?.infographic)return r.infographic;if(r?.code_block)return r.code_block}let a=r?.[i];if(a)return a;let o=aI(e);return o&&r?.[o]?r[o]:null}var fI=r(`<span hidden=""></span>`);function pI(e,t){i(t,!0);let n=k(t,`context`,3,void 0),r=k(t,`indexKey`,3,void 0),o=I(()=>String(t.node?.type||``)),s=I(()=>n()?.customComponents||Tj(n()?.customId)),c=I(()=>dI(t.node,n(),E(s))),l=I(()=>oI(t.node)),u=I(()=>cI(t.node,n())||{}),d=I(()=>iI(t.node,n())),f=I(()=>aI(t.node)),m=I(C),g=I(()=>sI(t.node,E(o))),_=I(()=>`${String(r()??`code-block`)}:${String(t.node?.language??``)}:${t.node?.diff?`diff`:`code`}`),v=I(()=>typeof n()?.codeBlockProps?.showLineNumbers==`boolean`?n().codeBlockProps.showLineNumbers:typeof n()?.codeBlockOptions?.disableLineNumbers==`boolean`&&!n().codeBlockOptions.disableLineNumbers),b=I(()=>n()?.codeBlockOptions?.overflow?`white-space: ${n().codeBlockOptions.overflow===`scroll`?`pre`:`pre-wrap`}`:void 0),S=I(()=>({type:`text`,content:String(t.node?.content??t.node?.raw??``),raw:String(t.node?.content??t.node?.raw??``)}));function C(){return E(o)!==`html_block`&&E(o)!==`html_inline`?!1:n()?.htmlPolicy===`escape`?!0:!E(f)||(n()?.customHtmlTags??[]).some(e=>String(e).toLowerCase()===E(f))||Iv.has(E(f))?!1:!hy(t.node?.content??t.node?.raw,E(f))}var w=X(),T=q(w),D=e=>{var t=X(),i=q(t);{let e=I(()=>n()?.customId),t=I(()=>n()?.isDark),o=I(()=>n()?.typewriter),s=I(()=>n()?.fade),d=I(()=>n()?.codeBlockOptions);a(i,()=>E(c),(i,a)=>{a(i,K({get node(){return E(l)},get context(){return n()},get ctx(){return n()},get customId(){return E(e)},get isDark(){return E(t)},get indexKey(){return r()},get typewriter(){return E(o)},get fade(){return E(s)}},()=>E(u),{get codeBlockOptions(){return E(d)}}))})}y(e,t)},O=e=>{{let i=I(()=>n()?.typewriter);eI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},get typewriter(){return E(i)}})}},A=e=>{GF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},j=e=>{yN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},ee=e=>{gI(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},te=e=>{TP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},M=e=>{SP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},N=e=>{ZF(e,{get node(){return t.node},get context(){return n()}})},P=e=>{aN(e,{get node(){return t.node},get context(){return n()}})},F=e=>{mN(e,{get node(){return t.node},get context(){return n()}})},L=e=>{gN(e,{get node(){return t.node}})},ne=e=>{fN(e,{get node(){return t.node}})},re=e=>{bj(e,{get node(){return t.node},get context(){return n()}})},ie=e=>{vN(e,{})},R=e=>{{let i=I(()=>typeof n()?.showTooltips==`boolean`?n()?.showTooltips:void 0);bP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()},get showTooltip(){return E(i)}})}},ae=e=>{kN(e,{get node(){return t.node}})},oe=e=>{gP(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},se=e=>{JF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},z=e=>{lN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},B=e=>{qF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},V=e=>{bN(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},ce=e=>{_P(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},H=e=>{YF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},U=e=>{XF(e,{get node(){return t.node},get context(){return n()},get indexKey(){return r()}})},W=e=>{Dj(e,{get node(){return t.node}})},le=e=>{sN(e,{get node(){return t.node}})},G=e=>{KF(e,{get node(){return t.node},get context(){return n()}})},ue=e=>{var t=X(),i=q(t),a=e=>{eI(e,{get node(){return E(S)},get context(){return n()},get indexKey(){return r()}})},o=e=>{xN(e,{get node(){return E(g)},get context(){return n()}})};h(i,e=>{E(m)?e(a):e(o,-1)}),y(e,t)},de=e=>{var t=X(),i=q(t),a=e=>{eI(e,{get node(){return E(S)},get context(){return n()},get indexKey(){return r()}})},o=e=>{SN(e,{get node(){return E(g)},get context(){return n()}})};h(i,e=>{E(m)?e(a):e(o,-1)}),y(e,t)},J=e=>{rI(e,{get node(){return t.node},get context(){return n()}})},fe=e=>{nI(e,{})},pe=e=>{nF(e,{get node(){return t.node}})},me=e=>{$P(e,{get node(){return t.node}})},Y=e=>{var r=X(),i=q(r),a=e=>{UF(e,K({get node(){return t.node},get context(){return n()}},()=>E(u)))},o=e=>{iN(e,K({get node(){return t.node},get context(){return n()}},()=>E(u)))},s=e=>{tP(e,K({get node(){return t.node},get context(){return n()}},()=>E(u)))},c=e=>{gM(e,{get node(){return t.node},get showLineNumbers(){return E(v)},get style(){return E(b)}})},l=e=>{var r=X(),i=q(r);p(i,()=>E(_),e=>{{let r=I(()=>n()?.codeBlockOptions);MM(e,K({get node(){return t.node},get context(){return n()}},()=>E(u),{get codeBlockOptions(){return E(r)}}))}}),y(e,r)};h(i,e=>{E(d)===`mermaid`?e(a):E(d)===`d2`?e(o,1):E(d)===`infographic`?e(s,2):E(d)===`pre`?e(c,3):e(l,-1)}),y(e,r)},he=e=>{var t=fI();y(e,t)},ge=e=>{uN(e,{get node(){return t.node},get context(){return n()}})};h(T,e=>{E(c)?e(D):E(o)===`text`||E(o)===`text_special`?e(O,1):E(o)===`paragraph`?e(A,2):E(o)===`heading`?e(j,3):E(o)===`blockquote`?e(ee,4):E(o)===`list`?e(te,5):E(o)===`list_item`?e(M,6):E(o)===`table`?e(N,7):E(o)===`definition_list`?e(P,8):E(o)===`footnote`?e(F,9):E(o)===`footnote_reference`?e(L,10):E(o)===`footnote_anchor`?e(ne,11):E(o)===`admonition`?e(re,12):E(o)===`hardbreak`?e(ie,13):E(o)===`link`?e(R,14):E(o)===`image`?e(ae,15):E(o)===`inline_code`?e(oe,16):E(o)===`strong`?e(se,17):E(o)===`emphasis`?e(z,18):E(o)===`strikethrough`?e(B,19):E(o)===`highlight`?e(V,20):E(o)===`insert`?e(ce,21):E(o)===`subscript`?e(H,22):E(o)===`superscript`?e(U,23):E(o)===`checkbox`||E(o)===`checkbox_input`?e(W,24):E(o)===`emoji`?e(le,25):E(o)===`reference`?e(G,26):E(o)===`html_block`?e(ue,27):E(o)===`html_inline`?e(de,28):E(o)===`vmr_container`?e(J,29):E(o)===`thematic_break`?e(fe,30):E(o)===`math_inline`?e(pe,31):E(o)===`math_block`?e(me,32):E(o)===`code_block`?e(Y,33):E(o)===`label_open`||E(o)===`label_close`?e(he,34):e(ge,-1)}),y(e,w),x()}function mI(e,n){let r=k(n,`nodes`,19,()=>[]),i=k(n,`context`,3,void 0),a=k(n,`prefix`,3,`child`);var o=X(),s=q(o);t(s,19,()=>r()||[],(e,t)=>a()+`-`+t,(e,t,n)=>{{let r=I(()=>a()+`-`+E(n));pI(e,{get node(){return E(t)},get context(){return i()},get indexKey(){return E(r)}})}}),y(e,o)}var hI=r(`<blockquote class="blockquote blockquote-node" dir="auto"><!></blockquote>`);function gI(e,t){i(t,!0);let r=k(t,`context`,3,void 0),a=k(t,`indexKey`,3,void 0),o=I(()=>_A(t.node?.cite));var s=hI(),c=W(s);{let e=I(()=>gA(t.node?.children)),n=I(()=>String(a()??`blockquote`)+`-blockquote`);mI(c,{get nodes(){return E(e)},get context(){return r()},get prefix(){return E(n)}})}n(s),H(()=>{B(s,`cite`,E(o)||void 0),s.dir=s.dir}),y(e,s),x()}var _I=0,vI=new WeakMap,yI={N1:`#E5E7EB`,N2:`#CBD5E1`,N3:`#94A3B8`,N4:`#64748B`,N5:`#475569`,N6:`#334155`,N7:`#0B1220`,B1:`#60A5FA`,B2:`#3B82F6`,B3:`#2563EB`,B4:`#1D4ED8`,B5:`#1E40AF`,B6:`#111827`,AA2:`#22D3EE`,AA4:`#0EA5E9`,AA5:`#0284C7`,AB4:`#FBBF24`,AB5:`#F59E0B`},bI={cjs:`javascript`,cts:`typescript`,d2lang:`plaintext`,js:`javascript`,jsonc:`json`,jsx:`javascript`,md:`markdown`,mjs:`javascript`,sh:`shell`,text:`plaintext`,ts:`typescript`,tsx:`typescript`,txt:`plaintext`,vue:`html`,yml:`yaml`};async function xI(e,t={}){SI(e);let n=[],r=!1,i=()=>!r&&t.isCancelled?.call(t)!==!0,a={dispose:()=>{var t;if(!r){r=!0;for(let e=n.length-1;e>=0;--e)try{(t=n[e])==null||t.call(n)}catch{}vI.get(e)===a&&vI.delete(e)}}};return vI.set(e,a),!i()||(await OI(e,i),!i())||(await AI(e,n,t,i),!i())||t.final!==!1&&(await II(e,n,t,i),!i()||(await LI(e,n,t,i),!i())||(t.renderCodeBlocksAsPre||await RI(e,n,t,i),!i()))||!i()||(XI(e,n),!i())||YI(e,n,t),a}function SI(e){e&&vI.get(e)?.dispose()}function CI(e,t){let n=e.querySelector(t);return{sourceElement:n,source:(n?.textContent||(n?``:e.textContent)||``).trim()}}function wI(e,t){return e.querySelector(t)}function TI(e,t){return!!(wI(e,t)||e).querySelector(`.katex, .katex-display`)}function EI(e,t,n,r={}){t?t.innerHTML=n:e.innerHTML=n,e.dataset.markstreamKatex=`1`,r.renderedClass&&e.classList.add(r.renderedClass)}function DI(e,t,n={}){t&&(t.innerHTML=``),delete e.dataset.markstreamKatex,delete e.dataset.markstreamKatexSource,n.renderedClass&&e.classList.remove(n.renderedClass)}async function OI(e,t){let n=Array.from(e.querySelectorAll(`.markstream-nested-math`));for(let e of n){if(!t())return;if(e.dataset.markstreamKatexManaged===`1`)continue;let{source:n}=CI(e,`.markstream-nested-math__source`),r=wI(e,`.markstream-nested-math__render`);if(!n){DI(e,r);continue}if(!(e.dataset.markstreamKatex===`1`&&e.dataset.markstreamKatexSource===n&&TI(e,`.markstream-nested-math__render`)))try{EI(e,r,await kI(n,e.dataset.display===`block`)),e.dataset.markstreamKatexSource=n}catch{DI(e,r)}}let r=Array.from(e.querySelectorAll(`.markstream-nested-math-block`));for(let e of r){if(!t())return;if(e.dataset.markstreamKatexManaged===`1`)continue;let{source:n}=CI(e,`.markstream-nested-math-block__source`),r=wI(e,`.markstream-nested-math-block__render`);if(!n){DI(e,r,{renderedClass:`markstream-nested-math-block--rendered`});continue}if(!(e.dataset.markstreamKatex===`1`&&e.dataset.markstreamKatexSource===n&&TI(e,`.markstream-nested-math-block__render`)))try{EI(e,r,await kI(n,!0),{renderedClass:`markstream-nested-math-block--rendered`}),e.dataset.markstreamKatexSource=n}catch{DI(e,r,{renderedClass:`markstream-nested-math-block--rendered`})}}}async function kI(e,t){let n=FP(e);try{return await ZP(n,t,{timeout:1500,waitTimeout:0,maxRetries:0})}catch(e){let t=e?.code||e?.name;if(!(t===`WORKER_INIT_ERROR`||e?.fallbackToRenderer)&&t!==`WORKER_BUSY`&&t!==`WORKER_TIMEOUT`)throw e}let r=await PP();if(!r)throw Error(`KaTeX renderer is not available.`);let i=r.renderToString(n,{displayMode:t,throwOnError:!1});return qP(n,t,i),i}async function AI(e,t,n,r){var i;let a=n.mermaidProps?.isStrict!==!1,o=await _F({startOnLoad:!1,securityLevel:a?`strict`:`loose`,suppressErrorRendering:!0,...a?{flowchart:{htmlLabels:!1}}:{}});if(!o||!r())return;let s=Array.from(e.querySelectorAll(`pre > code.language-mermaid`));for(let e of s){if(!r())return;let a=e.parentElement,s=(e.textContent||``).trim();if(!a||!s)continue;let c=a.cloneNode(!0),l=qI(`mermaid`,`Mermaid`,s,!0,n,{showHeader:n.mermaidProps?.showHeader!==!1});a.replaceWith(l.wrapper);try{let e=n.isDark?`dark`:`light`,a=s;if(n.final===!1)try{await MI(s,e,o,n)}catch(t){if(t?.name===`AbortError`)return;let i=await NI(s,e,n);if(!r())return;if(!i){l.wrapper.replaceWith(c);continue}a=i}let u=`markstream-svelte-mermaid-${++_I}`,d=await FI(()=>Promise.resolve(o.render(u,jI(a,e))),n.final===!1?Number(n.mermaidProps?.renderTimeoutMs??2500):Number(n.mermaidProps?.fullRenderTimeoutMs??4e3));if(!r())return;let f=typeof d==`string`?d:d?.svg;if(!f)continue;let p=Qk(f);if(!p)continue;if(l.body.innerHTML=p,l.body.classList.add(`markstream-svelte-mermaid`),l.wrapper.dataset.markstreamMermaid=`1`,n.mermaidProps?.enableMermaidInteractions===!0&&typeof d!=`string`)try{(i=d?.bindFunctions)==null||i.call(d,l.body)}catch{}t.push(()=>{l.wrapper.isConnected&&l.wrapper.replaceWith(c.cloneNode(!0))})}catch{l.wrapper.replaceWith(c)}}}function jI(e,t){return e.trimStart().startsWith(`%%{`)?e:`%%{init: {"theme": "${t===`dark`?`dark`:`default`}"}}%%\n${e}`}async function MI(e,t,n,r){let i=Number(r.mermaidProps?.workerTimeoutMs??1400),a=Number(r.mermaidProps?.parseTimeoutMs??1800);try{if(await TF(e,t,i))return!0}catch(e){if(e?.name===`AbortError`)throw e}let o=jI(e,t);if(typeof n?.parse==`function`)return await FI(()=>Promise.resolve(n.parse(o)),a),!0;let s=`markstream-svelte-mermaid-parse-${++_I}`;return await FI(()=>Promise.resolve(n.render(s,o)),a),!0}async function NI(e,t,n){let r=Number(n.mermaidProps?.workerTimeoutMs??1400);try{let n=await EF(e,t,r);if(n)return n}catch(e){if(e?.name===`AbortError`)throw e}return PI(e)}function PI(e){let t=e.split(`
|
|
219
|
-
`);for(;t.length>0;){let e=t[t.length-1].trimEnd();if(!e){t.pop();continue}if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}return t.join(`
|
|
220
|
-
`)}function FI(e,t){return!t||t<=0?e():new Promise((n,r)=>{let i=!1,a=globalThis.setTimeout(()=>{i||(i=!0,r(Error(`Operation timed out`)))},t);e().then(e=>{i||(i=!0,clearTimeout(a),n(e))}).catch(e=>{i||(i=!0,clearTimeout(a),r(e))})})}async function II(e,t,n,r){let i=Array.from(e.querySelectorAll(`pre[data-markstream-code-block="1"] > code.language-infographic`));if(!i.length)return;let a=await MN();if(a&&r())for(let e of i){if(!r())return;let i=e.parentElement,o=e.textContent||``;if(!i||!o.trim())continue;let s=i.cloneNode(!0),c=qI(`infographic`,`Infographic`,o,!0,n,{showHeader:n.infographicProps?.showHeader!==!1});c.body.style.minHeight=`320px`,c.body.style.height=`360px`,i.replaceWith(c.wrapper);try{let e=new a({container:c.body,width:`100%`,height:`100%`});e.render(o);let n=null;typeof window<`u`&&typeof window.requestAnimationFrame==`function`&&(n=window.requestAnimationFrame(()=>{let e=c.body.scrollHeight;e>0&&(c.body.style.height=`${Math.min(Math.max(e,260),720)}px`)})),t.push(()=>{var t;n!=null&&typeof window<`u`&&window.cancelAnimationFrame(n),(t=e.destroy)==null||t.call(e),c.wrapper.isConnected&&c.wrapper.replaceWith(s.cloneNode(!0))}),c.wrapper.dataset.markstreamInfographic=`1`}catch{c.wrapper.replaceWith(s)}}}async function LI(e,t,n,r){let i=await RM();if(!i||!r())return;let a=Array.from(e.querySelectorAll(`pre[data-markstream-code-block="1"] > code.language-d2, pre[data-markstream-code-block="1"] > code.language-d2lang`));for(let e of a){if(!r())return;let a=e.parentElement,o=e.textContent||``;if(!a||!o.trim())continue;let s=a.cloneNode(!0),c=qI(`d2`,`D2`,o,!0,n,{showHeader:n.d2Props?.showHeader!==!1});a.replaceWith(c.wrapper);try{let e=zI(i);if(!e||typeof e.compile!=`function`||typeof e.render!=`function`)throw TypeError(`D2 instance is missing compile/render methods.`);let a=await e.compile(o),l=a?.diagram??a,u=a?.renderOptions??a?.options??{},d=n.d2ThemeId??u.themeID,f=n.d2DarkThemeId??u.darkThemeID,p={...u};if(p.themeID=n.isDark&&f!=null?f:d,p.darkThemeID=null,p.darkThemeOverrides=null,n.isDark){let e=u.themeOverrides&&typeof u.themeOverrides==`object`?u.themeOverrides:null;p.themeOverrides={...yI,...e||{}}}let m=await e.render(l,p);if(!r())return;let h=WM(GM(m));if(!h)throw Error(`D2 render returned empty output.`);c.body.innerHTML=h,c.wrapper.dataset.markstreamD2=`1`,t.push(()=>{c.wrapper.isConnected&&c.wrapper.replaceWith(s.cloneNode(!0))})}catch{c.wrapper.replaceWith(s)}}}async function RI(e,t,n,r){let i=Array.from(e.querySelectorAll(`pre[data-markstream-code-block="1"]`)),a=n.codeBlockOptions?.overflow===`scroll`?`pre`:`pre-wrap`,o=n.codeBlockOptions?.maxHeight;for(let e of i){let t=e.querySelector(`code`);if(!t)continue;let n=BI(e,t).trim().toLowerCase();n!==`mermaid`&&n!==`infographic`&&n!==`d2`&&n!==`d2lang`&&(e.style.whiteSpace=a,typeof o==`number`&&(e.style.maxHeight=`${o}px`,e.style.overflow=`auto`))}let s=await Lj();if(s&&typeof s.createCodeBlockRuntime==`function`&&r())for(let e of i){if(!r())return;let i=e.querySelector(`code`);if(!i)continue;let a=BI(e,i),c=a.trim().toLowerCase();if(c===`mermaid`||c===`infographic`||c===`d2`||c===`d2lang`)continue;let l=i.textContent||``,u=e.dataset.markstreamDiff===`1`,d=KI(e.dataset.markstreamOriginal),f=KI(e.dataset.markstreamUpdated),p=VI(a),m=qI(`code`,u?`Diff / ${p}`:`Code / ${p}`,l,!1,n,{showHeader:n.codeBlockProps?.showHeader!==!1});m.body.classList.add(`markstream-svelte-enhanced-block__body--code`);let h=HI(u&&f||l,u);m.body.style.minHeight=`${typeof o==`number`?Math.min(h,o):h}px`,typeof o==`number`&&(m.body.style.maxHeight=`${o}px`,m.body.style.overflow=`auto`);let g=e.cloneNode(!0),_=null,v=!1,y=()=>{var e;if(!v){v=!0;try{(e=_?.cleanupEditor)==null||e.call(_)}catch{}m.wrapper.parentNode&&m.wrapper.replaceWith(g.cloneNode(!0))}};e.replaceWith(m.wrapper);let b={...n.codeBlockOptions??{}};for(let e of[`maxHeight`,`padding`,`tabSize`,`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`])delete b[e];let x=b.parseDiffOptions&&typeof b.parseDiffOptions==`object`?b.parseDiffOptions:{},S=u?{diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,...b,parseDiffOptions:{context:2,...x}}:b,C=n.codeBlockProps?.theme,w=[n.codeBlockProps?.darkTheme??n.codeBlockProps?.themes?.[0]??n.codeBlockDarkTheme??n.themes?.[0]??`vitesse-dark`,n.codeBlockProps?.lightTheme??n.codeBlockProps?.themes?.[1]??n.codeBlockLightTheme??n.themes?.[1]??`vitesse-light`],T=typeof C==`string`?C:C&&typeof C==`object`?n.isDark?C.dark:C.light:n.isDark?n.codeBlockProps?.darkTheme??n.codeBlockProps?.themes?.[0]??n.codeBlockDarkTheme??n.themes?.[0]??`vitesse-dark`:n.codeBlockProps?.lightTheme??n.codeBlockProps?.themes?.[1]??n.codeBlockLightTheme??n.themes?.[1]??`vitesse-light`,E=typeof S.unsafeCSS==`string`?S.unsafeCSS:``,D=n.codeBlockProps?.showLineNumbers??n.codeBlockOptions?.disableLineNumbers!==!0,O=()=>{m.body.style.setProperty(`--diffs-tab-size`,String(n.codeBlockOptions?.tabSize??4)),typeof n.codeBlockOptions?.padding==`number`?m.body.style.setProperty(`--diffs-gap-block`,`${n.codeBlockOptions.padding}px`):m.body.style.removeProperty(`--diffs-gap-block`)};O(),_=s.createCodeBlockRuntime({overflow:`wrap`,...S,themes:w,theme:T,themeType:n.isDark?`dark`:`light`,disableLineNumbers:!D,MAX_HEIGHT:n.codeBlockOptions?.maxHeight??500,fontSize:n.codeBlockOptions?.fontSize??13,lineHeight:n.codeBlockOptions?.lineHeight,fontFamily:n.codeBlockOptions?.fontFamily,unsafeCSS:`[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }
|
|
221
|
-
${E}`.trim(),disableFileHeader:!0,stream:!1,onThemeChange:O}),t.push(y);try{if(u&&typeof _.createDiffEditor==`function`?await _.createDiffEditor(m.body,d,f||l,p):await _.createEditor?.call(_,m.body,l,p),!r()){y();return}if(await _.setTheme?.call(_,T),!r()){y();return}if(await GI(),!r()){y();return}if(!UI(m.body,l))throw Error(`Code editor rendered no visible code content.`);m.wrapper.dataset.markstreamEnhanced=`1`,u&&(m.wrapper.dataset.markstreamEnhancedDiff=`1`)}catch{y()}}}function zI(e){if(typeof e==`function`){let t=new e;if(t&&typeof t.compile==`function`)return t;if(typeof e.compile==`function`)return e}return e?.D2&&typeof e.D2==`function`?new e.D2:typeof e?.compile==`function`?e:null}function BI(e,t){let n=e.dataset.markstreamLanguage?.trim();if(n)return n;let r=Array.from(t.classList).find(e=>e.startsWith(`language-`));return r?r.slice(9):`plaintext`}function VI(e){let t=e.trim().toLowerCase();return bI[t]||t||`plaintext`}function HI(e,t){let n=Math.max(1,e.split(`
|
|
222
|
-
`).length);return Math.min(520,(t?180:96)+n*(t?20:18))}function UI(e,t){let n=e.querySelector([`diffs-container`,`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`));if(!n)return!1;let r=n.getBoundingClientRect();if(r.width<=0||r.height<=0)return!1;let i=t.split(`
|
|
223
|
-
`).find(e=>e.trim())?.trim();if(!i)return!0;let a=WI(e.textContent||``),o=WI(i);return a.includes(o)}function WI(e){return e.replace(/\s+/g,``)}async function GI(){typeof window>`u`||typeof window.requestAnimationFrame!=`function`||await new Promise(e=>window.requestAnimationFrame(()=>e()))}function KI(e){if(!e)return``;let t=(globalThis==null?void 0:globalThis.require)?.call(globalThis,`buffer`)?.Buffer;if(t?.from)return t.from(e,`base64`).toString(`utf8`);if(typeof globalThis.atob==`function`&&typeof TextDecoder<`u`){let t=globalThis.atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));return new TextDecoder().decode(n)}return``}function qI(e,t,n,r,i,a={}){let o=document.createElement(`div`);if(o.className=`markstream-svelte-enhanced-block markstream-svelte-enhanced-block--${e}`,a.showHeader!==!1){let e=document.createElement(`div`);e.className=`markstream-svelte-enhanced-block__header`;let r=document.createElement(`span`);r.className=`markstream-svelte-enhanced-block__badge`,r.textContent=t,e.appendChild(r),e.appendChild(JI(n,i)),o.appendChild(e)}let s=document.createElement(`div`);if(s.className=`markstream-svelte-enhanced-block__body`,o.appendChild(s),r){let e=document.createElement(`details`);e.className=`markstream-svelte-enhanced-block__details`;let t=document.createElement(`summary`);t.textContent=`Source`,e.appendChild(t);let r=document.createElement(`pre`);r.className=`markstream-svelte-enhanced-block__source`;let i=document.createElement(`code`);i.textContent=n,r.appendChild(i),e.appendChild(r),o.appendChild(e)}return{wrapper:o,body:s}}function JI(e,t){let n=document.createElement(`div`);n.className=`markstream-svelte-enhanced-block__actions`;let r=document.createElement(`button`);return r.type=`button`,r.className=`markstream-svelte-enhanced-block__action`,r.textContent=`Copy`,t.showTooltips!==!1&&(r.title=`Copy source`),r.addEventListener(`click`,()=>{var n;ZI(e),(n=t.onCopy)==null||n.call(t,e)}),n.appendChild(r),n}function YI(e,t,n){if(n.showTooltips===!1)return;let r=Array.from(e.querySelectorAll(`[data-markstream-tooltip], [title]`));if(r.length!==0)for(let e of r){if(e.matches(`.footnote-link, .footnote-anchor`))continue;let r=e.getAttribute(`title`),i=(e.dataset.markstreamTooltip||r||``).trim();if(!i)continue;r!=null&&e.removeAttribute(`title`);let a=()=>Jj(e,i,`top`,!1,void 0,n.isDark),o=()=>Yj();e.addEventListener(`mouseenter`,a),e.addEventListener(`focus`,a),e.addEventListener(`mouseleave`,o),e.addEventListener(`blur`,o),t.push(()=>{let t=e.getAttribute(`aria-describedby`)!=null;e.removeEventListener(`mouseenter`,a),e.removeEventListener(`focus`,a),e.removeEventListener(`mouseleave`,o),e.removeEventListener(`blur`,o),t&&Yj(!0),r!=null&&e.getAttribute(`title`)==null&&e.setAttribute(`title`,r)})}}function XI(e,t){let n=Array.from(e.querySelectorAll(`.footnote-reference .footnote-link[href^="#"]`));for(let e of n){let n=t=>{let n=e.getAttribute(`href`);n&&(t.preventDefault(),document.getElementById(n.slice(1))?.scrollIntoView({behavior:`smooth`,block:`start`}))};e.addEventListener(`click`,n),t.push(()=>e.removeEventListener(`click`,n))}}async function ZI(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}}catch{}if(typeof document>`u`)return;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,`true`),t.style.position=`fixed`,t.style.opacity=`0`,t.style.pointerEvents=`none`,document.body.appendChild(t),t.select();try{document.execCommand(`copy`)}catch{}finally{t.remove()}}function QI(e={}){let t=typeof e==`function`?e():e,n=V(``),r=V(``),i=V(!1),a=V(0),o=V(!1),s=V(!1),c=cP(t),l=()=>{let e=c.getSnapshot();F(n,e.source,!0),F(r,e.visible,!0),F(i,e.done,!0),F(a,e.pendingChars,!0),F(o,e.caughtUp,!0),F(s,e.final,!0)},u=c.subscribe(l);return l(),ce(()=>{u(),c.destroy()}),{get source(){return E(n)},get visible(){return E(r)},get done(){return E(i)},get caughtUp(){return E(o)},get final(){return E(s)},get pendingChars(){return E(a)},enqueue:e=>c.enqueue(e),finish:e=>c.finish(e),flush:()=>c.flush(),reset:e=>c.reset(e),pause:()=>c.pause(),resume:()=>c.resume()}}var $I=`markstreamSmoothStreaming`,eL=r(`<div class="node-slot"><div><!></div></div>`),tL=r(`<span class="typewriter-cursor" aria-hidden="true"></span>`),nL=r(`<div><!> <!></div>`);function rL(e,r){i(r,!0);let a=k(r,`content`,3,``),o=k(r,`nodes`,3,null),s=k(r,`final`,3,void 0),c=k(r,`parseOptions`,3,void 0),u=k(r,`customMarkdownIt`,3,void 0),d=k(r,`debugPerformance`,3,!1),f=k(r,`customHtmlTags`,3,void 0),p=k(r,`htmlPolicy`,3,`safe`),m=k(r,`viewportPriority`,3,!0),g=k(r,`codeBlockStream`,3,!0),_=k(r,`codeBlockDarkTheme`,3,void 0),b=k(r,`codeBlockLightTheme`,3,void 0),S=k(r,`renderCodeBlocksAsPre`,3,!1),C=k(r,`codeBlockMinWidth`,3,void 0),w=k(r,`codeBlockMaxWidth`,3,void 0),T=k(r,`codeBlockOptions`,3,void 0),D=k(r,`codeBlockProps`,3,void 0),O=k(r,`mermaidProps`,3,void 0),A=k(r,`d2Props`,3,void 0),j=k(r,`infographicProps`,3,void 0),te=k(r,`customComponents`,3,void 0),M=k(r,`showTooltips`,3,!0),N=k(r,`themes`,3,void 0),P=k(r,`isDark`,3,!1),L=k(r,`customId`,3,void 0),ne=k(r,`indexKey`,3,void 0),ie=k(r,`typewriter`,3,!1),R=k(r,`fade`,3,!0),ae=k(r,`batchRendering`,3,!0),oe=k(r,`initialRenderBatchSize`,3,40),U=k(r,`renderBatchSize`,3,80),le=k(r,`renderBatchDelay`,3,16),G=k(r,`renderBatchBudgetMs`,3,6),K=k(r,`renderBatchIdleTimeoutMs`,3,120),q=k(r,`deferNodesUntilVisible`,3,!0),J=k(r,`maxLiveNodes`,3,320),fe=k(r,`liveNodeBuffer`,3,60),pe=k(r,`allowHtml`,3,!0),he=k(r,`smoothStreaming`,3,`auto`),X=k(r,`smoothStreamingOptions`,3,void 0),ge=k(r,`className`,3,``),_e=k(r,`onCopy`,3,void 0),ve=k(r,`onHandleArtifactClick`,3,void 0),ye=k(r,`onClick`,3,void 0),be=k(r,`onMouseover`,3,void 0),xe=k(r,`onMouseout`,3,void 0),Z=V(null),Se=V(0),Ce=V(0),we=V(void 0),Te=V(void 0),Ee=0,De=null,Oe=V(0),ke=null,Ae=null,je=null,Me=0,Ne=new Map,Pe=V(!1),Fe=QI(()=>X()),Ie=I(()=>he()===!0||E(Pe)),Le=I(()=>Array.isArray(o())),Re=ee($I),ze=I(()=>he()===!1||E(Le)||he()!==!0&&Re?.()?!1:he()===!0||ie()===!0||(J()??0)<=0),Be=I(()=>E(Ie)&&E(ze));me($I,()=>E(Be));let Ve=I(()=>E(Be)?Fe.visible:a()??``),He=I(()=>a()??``),Ue=I(()=>E(Le)||Fe.source===E(He)),We=I(()=>{let e=c()??{};return s()??e.final}),Ge=I(()=>E(Be)&&E(We)!=null?!!(E(We)&&E(Ue)&&Fe.caughtUp):E(We));ue(()=>{F(Pe,!0)}),de(()=>{let e=a()??``;if(E(Le)){Fe.reset(``);return}if(!E(Be)){Fe.reset(e),E(We)&&Fe.finish({flush:!0});return}let t=Fe.source;e?e===t||(e.startsWith(t)?Fe.enqueue(e.slice(t.length)):Fe.reset(e)):Fe.reset(``),E(We)&&Fe.finish()});let Ke=I(()=>({content:E(Ve),nodes:o(),final:E(Ge),parseOptions:c(),customMarkdownIt:u(),debugPerformance:d(),customHtmlTags:f(),htmlPolicy:p(),viewportPriority:m(),codeBlockStream:g(),codeBlockDarkTheme:_(),codeBlockLightTheme:b(),renderCodeBlocksAsPre:S(),codeBlockMinWidth:C(),codeBlockMaxWidth:w(),codeBlockOptions:T(),codeBlockProps:D(),mermaidProps:O(),d2Props:A(),infographicProps:j(),customComponents:te(),showTooltips:M(),themes:N(),isDark:P(),customId:L(),indexKey:ne(),typewriter:ie(),fade:R(),batchRendering:ae(),initialRenderBatchSize:oe(),renderBatchSize:U(),renderBatchDelay:le(),renderBatchBudgetMs:G(),renderBatchIdleTimeoutMs:K(),deferNodesUntilVisible:q(),maxLiveNodes:J(),liveNodeBuffer:fe(),allowHtml:pe(),smoothStreaming:he(),smoothStreamingOptions:X()}));re(()=>{(E(we)!==E(Ve)||E(Te)!==o())&&(F(Ce,E(Ce)+1),F(we,E(Ve),!0),F(Te,o()))});let Q=I(()=>{let e=d()&&typeof performance<`u`?performance.now():0,t=hA(E(Ke));return d()&&typeof console<`u`&&typeof performance<`u`&&console.info(`[markstream-svelte][perf] parse(sync)`,{ms:Math.round(performance.now()-e),nodes:t.length,contentLength:E(Ve)?.length??0}),t}),qe=I(()=>{E(Se);let e=Tj(L()),t=te()?{...e,...te()}:e;return mA({...E(Ke),customComponents:t},{onCopy:_e(),onHandleArtifactClick:ve()},Ne,E(Ce))});de(()=>{E(Q).length,ae(),oe(),U(),le(),G(),K(),E(Ge),E(Oe),Xe()});let Je=I(()=>E(Q).slice(0,Math.min(E(Oe),E(Q).length)));de(()=>{E(Z),E(Ge),E(Q),E(Je),P(),S(),T(),D(),_(),b(),N(),O(),A(),j(),M(),_e(),$e()}),ue(()=>wj(()=>{F(Se,E(Se)+1)})),ce(()=>{Ee+=1,Qe(),De?.dispose(),De=null,SI(E(Z)),ut()});function Ye(e,t){let n=Number(e);return Number.isFinite(n)&&n>0?Math.floor(n):t}function Xe(){let e=E(Q).length,t=Math.min(e,Ye(oe(),40));if(!(E(Ge)!==!1&&ae()!==!1&&e>t)){Qe(),E(Oe)!==e&&F(Oe,e,!0);return}(E(Oe)<=0||E(Oe)>e||E(Oe)<t)&&F(Oe,t,!0),Ze()}function Ze(){if(E(Oe)>=E(Q).length||ke||Ae!=null||je!=null)return;let e=++Me,t=Math.max(0,Number(le())||0),n=t=>{if(ke=null,Ae=null,je=null,e!==Me)return;let n=Ye(U(),80),r=Math.max(2,Ye(G(),6)),i=E(Oe);do if(i=Math.min(E(Q).length,i+n),!t||(typeof t.timeRemaining==`function`?t.timeRemaining():0)<=r*.5)break;while(i<E(Q).length);i!==E(Oe)&&F(Oe,i,!0)},r=typeof window<`u`?window.requestIdleCallback:void 0;if(r){je=r(n,{timeout:Math.max(0,Number(K())||120)});return}if(typeof window<`u`&&typeof window.requestAnimationFrame==`function`){Ae=window.requestAnimationFrame(()=>{Ae=null,t>0?ke=setTimeout(n,t):n()});return}ke=setTimeout(n,t)}function Qe(){Me+=1,ke&&=(clearTimeout(ke),null),Ae!=null&&typeof window<`u`&&(window.cancelAnimationFrame(Ae),Ae=null);let e=typeof window<`u`?window.cancelIdleCallback:void 0;je!=null&&(e?.(je),je=null)}async function $e(){if(!E(Z)||typeof window>`u`)return;let e=typeof E(Ge)==`boolean`?E(Ge):!et(E(Q));if(!e){Ee+=1,De?.dispose(),De=null;return}let t=++Ee;if(await v(),t!==Ee||!E(Z))return;De?.dispose();let n=await xI(E(Z),{final:e,isDark:P(),renderCodeBlocksAsPre:S(),codeBlockOptions:T(),codeBlockProps:D(),codeBlockDarkTheme:_(),codeBlockLightTheme:b(),themes:N(),mermaidProps:O(),d2Props:A(),infographicProps:j(),showTooltips:M(),onCopy:_e(),isCancelled:()=>t!==Ee});if(t!==Ee){n.dispose();return}De=n}function et(e){for(let t of e)if(t?.loading===!0||et(t?.children||[])||et(t?.items||[]))return!0;return!1}let tt=V(null),nt=V(!1),rt,it=0,at=new Set([`code_block`,`admonition`,`table`,`math_block`,`html_block`,`image`]);function ot(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return typeof t==`string`&&at.has(t)}function st(){let e=E(Q)[E(Q).length-1];return!ot(e)}function ct(e){if(!e||typeof e!=`object`)return 0;let t=e,n=t.raw??t.content??t.code;if(typeof n==`string`)return n.length;let r=t.children;if(Array.isArray(r))return r.reduce((e,t)=>e+ct(t),0);let i=t.items;return Array.isArray(i)?i.reduce((e,t)=>e+ct(t),0):0}function lt(){return o()?.length?o().reduce((e,t)=>e+ct(t),0):(a()??``).length}function ut(){rt&&=(clearTimeout(rt),void 0)}function dt(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){if(!(e.textContent??``).trim())return NodeFilter.FILTER_REJECT;let t=e.parentElement;return!t||t.closest(`.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),n=null,r=t.nextNode();for(;r;)n=r,r=t.nextNode();return n}function ft(){if(typeof window>`u`||!E(nt)||!E(Z)||!E(tt))return;let e=E(Z),t=E(tt),n=dt(e),r=e.getBoundingClientRect(),i=0,a=0,o=20;if(n?.textContent){let t=document.createRange(),s=n.textContent.length;t.setStart(n,Math.max(0,s-1)),t.setEnd(n,s);let c=typeof t.getClientRects==`function`?t.getClientRects():void 0,l=c?.[c.length-1]??n.parentElement?.getBoundingClientRect();l&&(i=l.right-r.left+e.scrollLeft,a=l.top-r.top+e.scrollTop,o=l.height||o),t.detach()}t.style.transform=`translate(${Math.max(0,i)}px, ${Math.max(0,a)}px)`,t.style.height=`${o}px`}de(()=>{if(E(Ve),o(),ie(),E(Q).length,E(Ge),typeof window>`u`||E(Le))return;if(E(Ge)){F(nt,!1),ut();return}let e=lt(),t=st();if(ie()===!1||!t||e<=it){(ie()===!1||!t)&&F(nt,!1),it=e;return}it=e,F(nt,!0),ut(),v().then(()=>{ft()}),rt=setTimeout(()=>{F(nt,!1)},3e3)}),de(()=>{E(nt)&&v().then(()=>{ft()})});function pt(e){e.target?.closest(`[data-node-index]`)&&be()?.(e)}function mt(e){e.target?.closest(`[data-node-index]`)&&xe()?.(e)}var ht=nL();let gt;var _t=W(ht);t(_t,19,()=>E(Je),(e,t)=>(ne()==null?`markdown-renderer`:String(ne()))+`-`+t,(e,t,r)=>{var i=eL(),a=W(i);let o;var s=W(a);{let e=I(()=>(ne()==null?`markdown-renderer`:String(ne()))+`-`+E(r));pI(s,{get node(){return E(t)},get context(){return E(qe)},get indexKey(){return E(e)}})}n(a),n(i),H((e,n)=>{B(i,`data-node-index`,E(r)),B(i,`data-node-type`,E(t)?.type),o=Y(a,1,`node-content`,null,o,{"fade-node":e,"typewriter-node":n}),B(a,`data-node-index`,E(r))},[()=>R()!==!1&&String(E(t)?.type||``)!==`code_block`,()=>R()!==!1&&String(E(t)?.type||``)!==`code_block`]),y(e,i)});var vt=z(_t,2),yt=e=>{var t=tL();se(t,e=>F(tt,e),()=>E(tt)),y(e,t)};h(vt,e=>{E(nt)&&e(yt)}),n(ht),se(ht,e=>F(Z,e),()=>E(Z)),H(()=>{gt=Y(ht,1,`markstream-svelte markdown-renderer ${ge()??``}`,null,gt,{dark:P()}),B(ht,`data-custom-id`,L())}),l(`click`,ht,function(...e){ye()?.apply(this,e)}),l(`mouseover`,ht,pt),l(`mouseout`,ht,mt),y(e,ht),x()}T([`click`,`mouseover`,`mouseout`]);var iL=r(`<button type="button"><span class="flex items-center gap-1 text-xs font-medium"> </span> <span class="mt-0.5 block text-[10px] leading-snug text-muted-foreground"> </span></button>`),aL=r(`<div class="flex h-full flex-col items-center justify-center gap-3 text-center"><p class="max-w-[280px] text-xs text-muted-foreground">Pick a way to work with your skill library:</p> <div class="w-full max-w-[300px] space-y-1.5"></div></div>`),oL=r(`<div class="flow-item flex h-6 items-center gap-2 text-xs uppercase tracking-wide text-muted-foreground"><span class="h-px flex-1 bg-border"></span> <span class="h-px flex-1 bg-border"></span></div>`),sL=r(`<span class="turn-pill"> </span>`),cL=r(`<div class="flow-item flex h-5 items-center gap-1.5"><!></div>`),lL=r(`<div class="flow-item flex h-6 items-center gap-2 text-xs text-muted-foreground" role="separator"><span class="h-px flex-1 bg-border"></span> <span class="rounded bg-muted px-1 text-[10px] uppercase">mode</span> <span class="h-px flex-1 bg-border"></span></div>`),uL=r(`<div class="flow-item px-1 text-[11px] text-muted-foreground"> </div>`),dL=r(`<div class="flow-item flex h-6 items-center gap-2 px-3 text-[10px] text-muted-foreground" role="note"><span class="h-px flex-1 bg-border"></span> <span class="rounded bg-muted px-1 text-[10px] uppercase">compact</span> <span class="truncate"> </span> <span class="h-px flex-1 bg-border"></span></div>`),fL=r(`<img alt="" class="h-16 w-16 rounded-xl border border-border object-cover"/>`),pL=r(`<div class="mb-1 flex flex-wrap justify-end gap-1"></div>`),mL=r(`<span class="flex items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[10px]"><!> <span class="max-w-40 truncate"> </span></span>`),hL=r(`<div class="bubble-user max-h-40 overflow-y-auto px-3.5 py-2 text-[13px] leading-5 whitespace-pre-wrap"> </div>`),gL=r(`<div class="flow-item group/msg ml-auto max-w-[85%]"><!> <!> <!> <div role="toolbar" aria-label="Message actions"><button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground" title="Copy" aria-label="Copy message"><!></button> <button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground" title="Edit & resend — resends as a new message, keeps history" aria-label="Edit and resend — resends as a new message, keeps history"><!></button> <button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50" title="Resend — keeps history" aria-label="Resend message — keeps history"><!></button></div></div>`),_L=r(`<div class="mt-1 max-h-48 overflow-y-auto rounded-md px-2 pb-1 text-[11px] leading-relaxed whitespace-pre-wrap text-muted-foreground"> </div>`),vL=r(`<div class="flow-item"><!> <!></div>`),yL=r(`<div class="flow-item group/msg max-w-full"><div class="ms-md msg-body max-w-full [&_a]:text-primary svelte-1fhja6f"><!></div> <div role="toolbar" aria-label="Message actions"><button type="button" class="flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground" title="Copy" aria-label="Copy message"><!></button></div></div>`),bL=r(`<div class="flow-item"><!></div>`),xL=r(`<div class="flow-item flex h-6 items-center" role="status"><span class="sweep rounded-md px-1 text-xs text-muted-foreground"> </span></div>`),SL=r(`<!> <!>`,1),CL=r(`<button type="button" class="absolute top-3 right-3 z-10 flex h-7 w-7 items-center justify-center rounded-full border border-border bg-popover text-muted-foreground shadow-md transition-colors hover:text-foreground" title="Back to bottom" aria-label="Back to bottom"><!></button>`),wL=r(`<div class="relative min-h-0 flex-1"><div class="h-full overflow-y-auto px-4 py-3"><!></div> <!></div>`);function TL(e,r){i(r,!0);let a=V(null),o=V(J({})),s=V(null),u=V(!1),d=0;de(()=>{ze.items.length,ze.status;let e=E(a);if(!e)return;let t=()=>{let t=d-e.scrollTop-e.clientHeight<160;d=e.scrollHeight,(t||e.scrollHeight-e.scrollTop-e.clientHeight<160)&&(e.scrollTop=e.scrollHeight),F(u,e.scrollHeight-e.scrollTop-e.clientHeight>200)};t();let n=new ResizeObserver(t);for(let t of e.children)n.observe(t);return()=>n.disconnect()});let p=V(0);de(()=>{if(ze.status!==`running`){F(p,0);return}let e=()=>{let e=ze.turnStartedAt?Date.parse(ze.turnStartedAt):NaN;F(p,Number.isFinite(e)?Math.max(0,(Date.now()-e)/1e3):0,!0)};e();let t=setInterval(e,1e3);return()=>clearInterval(t)});async function m(e,t){try{await navigator.clipboard.writeText(e),F(s,t,!0),setTimeout(()=>{E(s)===t&&F(s,null)},1e3)}catch{Mn(`Copy failed — clipboard unavailable.`)}}function g(e){De(e),document.querySelector(`aside[aria-label="Agent panel"] textarea`)?.focus()}function _(e){ze.sending||Le(e)}let v=I(()=>{for(let e=ze.items.length-1;e>=0;e--){let t=ze.items[e];if(t?.kind===`user`)return t.seq}return null}),b=I(()=>{for(let e=ze.items.length-1;e>=0;e--){let t=ze.items[e];if(t?.kind===`assistant`)return t.seq}return null});function S(e,t){let n=e.trim();if(n.length===0)return``;let r=n.split(`
|
|
224
|
-
`).filter(e=>e.trim().length>0);if(r.length===0)return``;let i=t?r[r.length-1]:r[0];return i.length>96?`${i.slice(0,96)}…`:i}function C(e){return _t.find(t=>t.id===e)?.label??e}function w(e){return[e.usage?`↑ ${Wl(e.usage.inputTokens)}`:``,e.usage?`↓ ${Wl(e.usage.outputTokens)}`:``,e.elapsedMs===void 0?``:Gl(e.elapsedMs)].filter(e=>e.length>0)}function T(e){F(o,{...E(o),[e]:!(E(o)[e]??!1)},!0)}function D(){let e=E(a);e&&(e.scrollTop=e.scrollHeight)}var O=wL(),k=W(O),A=W(k),j=e=>{var r=aL(),i=z(W(r),2);t(i,21,()=>_t,e=>e.id,(e,t)=>{var r=iL(),i=W(r),a=M(i,!0),o=z(i,2),s=M(o,!0);n(r),H(()=>{Y(r,1,`w-full rounded-md border p-2 text-left transition-colors ${ze.pendingMode===E(t).id?`border-primary/60 bg-primary/5`:`border-border hover:border-primary/50 hover:bg-primary/5`}`),B(r,`aria-pressed`,ze.pendingMode===E(t).id),r.disabled=ze.sending,c(a,E(t).label),c(s,E(t).description)}),l(`click`,r,()=>ze.pendingMode=E(t).id),y(e,r)}),n(i),n(r),y(e,r)},ee=e=>{var r=SL(),i=q(r);t(i,17,()=>ze.items,e=>e.seq,(e,r)=>{var i=X(),a=q(i),u=e=>{var t=oL(),i=z(W(t));oe(),n(t),H(()=>c(i,` ${E(r).label??`Turn`??``} `)),y(e,t)},d=e=>{var t=cL(),i=W(t),a=e=>{var t=sL(),n=M(t,!0);H(e=>c(n,e),[()=>w(E(r)).join(` · `)]),y(e,t)},o=I(()=>w(E(r)).length>0),s=e=>{var t=sL(),n=M(t,!0);H(()=>c(n,E(r).reason)),y(e,t)};h(i,e=>{E(o)?e(a):e(s,-1)}),n(t),H(()=>B(t,`title`,E(r).reason)),y(e,t)},f=e=>{var t=lL(),i=z(W(t),3);oe(),n(t),H((e,n,r)=>{B(t,`aria-label`,e),c(i,` ${n??``} → ${r??``} `)},[()=>`Mode switched from ${C(E(r).from)} to ${C(E(r).to)}`,()=>C(E(r).from),()=>C(E(r).to)]),y(e,t)},p=e=>{var t=uL(),n=M(t,!0);H(()=>c(n,E(r).text)),y(e,t)},x=e=>{var t=dL(),i=z(W(t),4),a=M(i,!0);oe(2),n(t),H(()=>c(a,E(r).text)),y(e,t)},D=e=>{var i=gL(),a=W(i),o=e=>{var i=pL();t(i,21,()=>E(r).images,ie,(e,t)=>{var n=fL();H(()=>B(n,`src`,E(t))),y(e,n)}),n(i),y(e,i)};h(a,e=>{E(r).images&&E(r).images.length>0&&e(o)});var u=z(a,2),d=e=>{var i=pL();t(i,21,()=>E(r).files,ie,(e,t)=>{var i=mL(),a=W(i),o=e=>{Uc(e,{class:`h-3 w-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`})},s=I(()=>E(r).imageChipNames?.includes(E(t))),l=e=>{Vc(e,{class:`h-3 w-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`})};h(a,e=>{E(s)?e(o):e(l,-1)});var u=z(a,2),d=M(u,!0);n(i),H(()=>c(d,E(t))),y(e,i)}),n(i),y(e,i)};h(u,e=>{E(r).files&&E(r).files.length>0&&e(d)});var f=z(u,2),p=e=>{var t=hL(),n=M(t,!0);H(()=>c(n,E(r).text)),y(e,t)};h(f,e=>{E(r).text.length>0&&e(p)});var b=z(f,2),x=W(b),S=W(x),C=e=>{Hs(e,{class:`h-3.5 w-3.5 text-primary`})},w=e=>{zc(e,{class:`h-3.5 w-3.5`})};h(S,e=>{E(s)===E(r).seq?e(C):e(w,-1)}),n(x);var T=z(x,2),D=W(T);Je(D,{class:`h-3.5 w-3.5`}),n(T);var O=z(T,2),k=W(O);Wn(k,{class:`h-3.5 w-3.5`}),n(O),n(b),n(i),H(()=>{Y(b,1,`mt-0.5 flex h-5 justify-end gap-0.5 transition-opacity ${E(r).seq===E(v)?`opacity-100`:`opacity-0 group-hover/msg:opacity-100 focus-within:opacity-100`}`),O.disabled=ze.sending}),l(`click`,x,()=>void m(E(r).text,E(r).seq)),l(`click`,T,()=>g(E(r).text)),l(`click`,O,()=>_(E(r).text)),y(e,i)},O=e=>{var t=vL(),i=W(t);{let e=I(()=>S(E(r).text,E(r).streaming)),t=I(()=>E(r).streaming?!0:E(o)[E(r).seq]??!1);sl(i,{get icon(){return Gn},title:`Thinking`,get summary(){return E(e)},get open(){return E(t)},get running(){return E(r).streaming},onToggle:()=>T(E(r).seq)})}var a=z(i,2),s=e=>{var t=_L(),n=M(t,!0);H(()=>c(n,E(r).text)),y(e,t)};h(a,e=>{(E(r).streaming||E(o)[E(r).seq])&&e(s)}),n(t),y(e,t)},k=e=>{var t=yL(),i=W(t),a=W(i);{let e=I(()=>!E(r).streaming);rL(a,{get content(){return E(r).text},htmlPolicy:`escape`,get final(){return E(e)}})}n(i);var o=z(i,2),c=W(o),u=W(c),d=e=>{Hs(e,{class:`h-3.5 w-3.5 text-primary`})},f=e=>{zc(e,{class:`h-3.5 w-3.5`})};h(u,e=>{E(s)===E(r).seq?e(d):e(f,-1)}),n(c),n(o),n(t),H(()=>Y(o,1,`mt-0.5 flex h-5 gap-0.5 transition-opacity ${E(r).seq===E(b)?`opacity-100`:`opacity-0 group-hover/msg:opacity-100 focus-within:opacity-100`}`)),l(`click`,c,()=>void m(E(r).text,E(r).seq)),y(e,t)},A=e=>{{let t=I(()=>E(r).phase===`calling`&&ze.status===`running`);Ul(e,{get toolName(){return E(r).toolName},get argsText(){return E(r).argsText},get result(){return E(r).result},get phase(){return E(r).phase},get running(){return E(t)},get startedAt(){return E(r).startedAt},get endedAt(){return E(r).endedAt}})}},j=e=>{var t=bL();el(W(t),{get seq(){return E(r).seq},get questions(){return E(r).questions},get resolved(){return E(r).resolved}}),n(t),y(e,t)};h(a,e=>{E(r).kind===`turn`?e(u):E(r).kind===`turn-end`?e(d,1):E(r).kind===`mode`?e(f,2):E(r).kind===`status`?e(p,3):E(r).kind===`note`?e(x,4):E(r).kind===`user`?e(D,5):E(r).kind===`reasoning`?e(O,6):E(r).kind===`assistant`?e(k,7):E(r).kind===`tool`?e(A,8):E(r).kind===`approval`&&e(j,9)}),y(e,i)});var a=z(i,2),u=e=>{var t=xL(),r=W(t),i=M(r);n(t),H(e=>c(i,`Working${e??``}`),[()=>E(p)>=15?` · ${Math.floor(E(p))}s`:``]),y(e,t)};h(a,e=>{ze.status===`running`&&e(u)}),y(e,r)};h(A,e=>{ze.sessionId?e(ee,-1):e(j)}),n(k),se(k,e=>F(a,e),()=>E(a));var te=z(k,2),N=e=>{var t=CL();Gc(W(t),{class:`h-3.5 w-3.5`}),n(t),l(`click`,t,D),y(e,t)};h(te,e=>{E(u)&&ze.sessionId&&e(N)}),n(O),f(`scroll`,k,e=>{let t=e.currentTarget;F(u,t.scrollHeight-t.scrollTop-t.clientHeight>200)}),y(e,O),x()}T([`click`]);var EL=r(`<li><span aria-hidden="true"></span> <span class="min-w-0 break-words"> </span></li>`),DL=r(`<ul class="mt-1 max-h-40 space-y-0.5 overflow-y-auto rounded-lg border border-border bg-card px-2 py-1.5 shadow-sm"></ul>`),OL=r(`<div class="mx-3 mb-1.5 shrink-0"><button type="button" class="disclosure-row disclosure-row-tall w-full rounded-lg border border-border bg-card px-2 shadow-sm" aria-label="Tasks"><span class="flex items-center justify-center text-muted-foreground" aria-hidden="true"><!></span> <span class="truncate text-left font-medium text-foreground">Tasks</span> <span class="text-center text-muted-foreground/70" aria-hidden="true">·</span> <span class="disclosure-summary tabular-nums"> </span> <!></button> <!></div>`);function kL(e,r){let i=V(!1),a=I(()=>{let e=0,t=0,n=0;for(let i of r.todos)i.status===`completed`?e+=1:i.status===`in_progress`?t+=1:n+=1;return{done:e,active:t,pending:n}});var o=OL(),s=W(o),u=W(s),d=W(u);Bn(d,{class:`h-3.5 w-3.5`}),n(u);var f=z(u,6),p=M(f),m=z(f,2);qn(m,{class:`disclosure-chevron h-3.5 w-3.5 shrink-0 text-muted-foreground`}),n(s);var g=z(s,2),_=e=>{var i=DL();t(i,21,()=>r.todos,ie,(e,t)=>{var r=EL(),i=W(r),a=z(i,2),o=M(a,!0);n(r),H(()=>{Y(r,1,`flex items-start gap-1.5 text-xs ${E(t).status===`completed`?`text-muted-foreground line-through`:``}`),Y(i,1,`mt-[3px] h-3 w-3 shrink-0 rounded-full border-2 ${E(t).status===`completed`?`border-primary bg-primary/20`:E(t).status===`in_progress`?`border-primary`:`border-muted-foreground/50`}`),c(o,E(t).content)}),y(e,r)}),n(i),y(e,i)};h(g,e=>{E(i)&&e(_)}),n(o),H(()=>{B(s,`data-open`,E(i)),B(s,`aria-expanded`,E(i)),c(p,`done ${E(a).done??``} · active ${E(a).active??``} · pending ${E(a).pending??``}`)}),l(`click`,s,()=>F(i,!E(i))),y(e,o)}T([`click`]);function AL(e){let t=0;for(let n of e)t=(t*31+n.charCodeAt(0))%360;return t}function jL(e){return`hsl(${AL(e)} 55% 45%)`}var ML=`sc-letter-avatar`;function NL(e){return e.includes(ML)}function PL(e,t){return e.iconSuppressed===!0?null:e.icon??t?.icon??null}function FL(e,t){return e.iconLetter!==void 0&&e.iconLetter.length>0?e.iconLetter:(t||e.provider).slice(0,1).toUpperCase()}function IL(e){return e.iconColor??jL(e.provider)}var LL={svg:`image/svg+xml`,png:`image/png`,webp:`image/webp`};function RL(e,t){let n=e.indexOf(`,`);return!e.startsWith(`data:`)||n<0?null:`data:${t};base64,${e.slice(n+1)}`}var zL=new Set([`$$slots`,`$$events`,`$$legacy`]);function BL(e,t){let n=U(t,zL),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M12 12v6`}],[`path`,{d:`m15 15-3-3-3 3`}]];ye(e,K({name:`file-up`},()=>n,{get iconNode(){return r}}))}var VL=new Set([`$$slots`,`$$events`,`$$legacy`]);function HL(e,t){let n=U(t,VL),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];ye(e,K({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var UL=new Set([`$$slots`,`$$events`,`$$legacy`]);function WL(e,t){let n=U(t,UL),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];ye(e,K({name:`square`},()=>n,{get iconNode(){return r}}))}var GL=new Set([`$$slots`,`$$events`,`$$legacy`]);function KL(e,t){let n=U(t,GL),r=[[`path`,{d:`m6 9 6 6 6-6`}]];ye(e,K({name:`chevron-down`},()=>n,{get iconNode(){return r}}))}var qL=new Set([`$$slots`,`$$events`,`$$legacy`,`open`]);function JL(e,t){i(t,!0);let n=k(t,`open`,15,!1),r=U(t,qL);var o=X(),s=q(o);a(s,()=>os,(e,t)=>{t(e,K(()=>r,{get open(){return n()},set open(e){n(e)}}))}),y(e,o),x()}var YL=new Set([`$$slots`,`$$events`,`$$legacy`]);function XL(e,t){let n=U(t,YL);var r=X(),i=q(r);a(i,()=>Lt,(e,t)=>{t(e,K(()=>n))}),y(e,r)}var ZL=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`sideOffset`,`align`,`portalProps`,`class`]);function QL(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=k(t,`sideOffset`,3,4),o=k(t,`align`,3,`start`),s=U(t,ZL);XL(e,K(()=>t.portalProps,{children:(e,i)=>{var c=X(),l=q(c);{let e=I(()=>Fn(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 w-(--bits-dropdown-menu-anchor-width) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden`,t.class));a(l,()=>ls,(t,i)=>{i(t,K({"data-slot":`dropdown-menu-content`,get sideOffset(){return r()},get align(){return o()},get class(){return E(e)}},()=>s,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,c)},$$slots:{default:!0}})),x()}var $L=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function eR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,$L);var o=X(),s=q(o);a(s,()=>$o,(e,t)=>{t(e,K({"data-slot":`dropdown-menu-group`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),y(e,o),x()}var tR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`,`variant`]);function nR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=k(t,`variant`,3,`default`),o=U(t,tR);var s=X(),c=q(s);{let e=I(()=>Fn(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed data-inset:pl-7.5 [&_svg:not([class*='size-'])]:size-3.5 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`,t.class));a(c,()=>Xo,(i,a)=>{a(i,K({"data-slot":`dropdown-menu-item`,get"data-inset"(){return t.inset},get"data-variant"(){return r()},get class(){return E(e)}},()=>o,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,s),x()}var rR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`,`children`]),iR=r(`<div><!></div>`);function aR(e,t){i(t,!0);let r=k(t,`ref`,15,null),a=U(t,rR);var o=iR();P(o,e=>({"data-slot":`dropdown-menu-label`,"data-inset":t.inset,class:e,...a}),[()=>Fn(`text-muted-foreground px-2 py-1.5 text-xs data-inset:pl-7.5 data-[inset]:pl-8`,t.class)]);var s=W(o);_(s,()=>t.children??R),n(o),se(o,e=>r(e),()=>r()),y(e,o),x()}var oR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`]);function sR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,oR);var o=X(),s=q(o);{let e=I(()=>Fn(`bg-border/50 -mx-1 my-1 h-px`,t.class));a(s,()=>as,(t,i)=>{i(t,K({"data-slot":`dropdown-menu-separator`,get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var cR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function lR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,cR);var o=X(),s=q(o);a(s,()=>fs,(e,t)=>{t(e,K({"data-slot":`dropdown-menu-trigger`},()=>r,{get ref(){return n()},set ref(e){n(e)}}))}),y(e,o),x()}var uR=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`inset`]);function dR(e,t){i(t,!0);let n=k(t,`ref`,15,null),r=U(t,uR);var o=X(),s=q(o);{let e=I(()=>Fn(`px-2 py-1.5 text-sm font-semibold data-[inset]:ps-8`,t.class));a(s,()=>ns,(i,a)=>{a(i,K({"data-slot":`dropdown-menu-group-heading`,get"data-inset"(){return t.inset},get class(){return E(e)}},()=>r,{get ref(){return n()},set ref(e){n(e)}}))})}y(e,o),x()}var fR=J({open:!1,section:`general`});function pR(e=`general`){fR.section=e,fR.open=!0}function mR(e){if(!e)return null;let{provider:t,model:n}=e.settings.model,r=e.settings.modelRoutes.find(e=>e.provider===t);return r?r.models.find(e=>e.id===n)?.contextWindow??null:null}var hR=r(`<div class="flex items-center justify-between"><span>Used</span> <span> </span></div> <div class="mt-0.5 flex items-center justify-between text-muted-foreground"><span>Last turn</span> <span class="tabular-nums"> </span></div> <div class="mt-0.5 flex items-center justify-between text-muted-foreground"><span>Capacity</span> <span class="tabular-nums"> </span></div>`,1),gR=r(`<div class="text-muted-foreground">No turns yet.</div>`),_R=r(`<div role="dialog" aria-label="Context usage details" class="absolute right-0 bottom-full z-20 mb-1.5 w-56 rounded-lg border border-border bg-popover p-2.5 text-xs shadow-md"><div class="mb-1.5 text-[11px] font-medium text-muted-foreground">Context</div> <!> <button type="button" class="mt-2 w-full rounded-md border border-border px-2 py-1 text-[11px] transition-colors hover:bg-muted disabled:opacity-50" title="Compact the conversation history (kernel /compact)">compact</button></div>`),vR=r(`<div class="relative"><button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50" aria-label="Context usage"><svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><circle cx="7" cy="7" r="5" fill="none" stroke-width="2.5" class="stroke-muted-foreground/40"></circle><circle cx="7" cy="7" r="5" fill="none" stroke-width="2.5" stroke-linecap="round" transform="rotate(-90 7 7)"></circle></svg></button> <!></div>`);function yR(e,t){i(t,!0);let r=V(!1),a=V(null),o=I(()=>ze.lastUsage),s=I(()=>mR(Q.view)),u=I(()=>E(s)??131072),d=I(()=>E(o)?Math.min(1,Math.max(0,E(o).inputTokens/E(u))):0),p=I(()=>Math.round(E(d)*100)),m=I(()=>E(p)>=75),g=2*Math.PI*5,_=I(()=>`${(E(d)*g).toFixed(2)} ${g.toFixed(2)}`),v=I(()=>E(o)?`${E(p)}% of context used · last turn ${Wl(E(o).inputTokens)} in / ${Wl(E(o).outputTokens)} out`:`No turns yet — context usage appears after the first turn`);function S(){ze.sending||ze.status===`running`||(F(r,!1),Le(`/compact`))}function C(e){E(r)&&E(a)!==null&&e.target instanceof Node&&!E(a).contains(e.target)&&F(r,!1)}var w=vR();f(`pointerdown`,A,C);var T=W(w),D=W(T),O=z(W(D));n(D),n(T);var k=z(T,2),j=e=>{var t=_R(),r=z(W(t),2),i=e=>{var t=hR(),r=q(t),i=z(W(r),2),a=M(i);n(r);var l=z(r,2),d=z(W(l),2),f=M(d);n(l);var h=z(l,2),g=z(W(h),2),_=M(g);n(h),H((e,t,n)=>{Y(i,1,`tabular-nums ${E(m)?`text-amber-600 dark:text-amber-400`:``}`),c(a,`${E(p)??``}%`),c(f,`↑ ${e??``} · ↓ ${t??``}`),c(_,`${n??``}${E(s)===null?` · assumed 128k`:``}`)},[()=>Wl(E(o).inputTokens),()=>Wl(E(o).outputTokens),()=>Wl(E(u))]),y(e,t)},a=e=>{var t=gR();y(e,t)};h(r,e=>{E(o)?e(i):e(a,-1)});var d=z(r,2);n(t),H(()=>d.disabled=ze.sending||ze.status===`running`||!ze.sessionId),l(`click`,d,S),y(e,t)};h(k,e=>{E(r)&&e(j)}),n(w),se(w,e=>F(a,e),()=>E(a)),H(()=>{B(T,`title`,E(v)),B(T,`aria-expanded`,E(r)),T.disabled=!ze.sessionId,Y(O,0,b(E(m)?`stroke-amber-500`:`stroke-primary`)),B(O,`stroke-dasharray`,E(_))}),l(`click`,T,()=>F(r,!E(r))),y(e,w),x()}T([`click`]);var bR=r(`<div class="px-2.5 pt-1 text-[10px] text-muted-foreground" data-menu-source="true"> </div>`),xR=r(`<li class="cursor-default px-2.5 py-1.5 text-[11px] text-muted-foreground"> </li>`),SR=r(`<span class="truncate text-muted-foreground"> </span>`),CR=r(`<li><button type="button"><span class="shrink-0 font-medium"> </span> <!></button></li>`),wR=r(`<ul class="absolute bottom-full left-3 z-20 mb-1.5 w-72 overflow-hidden rounded-lg border border-border bg-popover py-1 shadow-md"><!> <!></ul>`);function TR(e,r){i(r,!0);let a=V(null),o=V(0),s=I(()=>r.text.startsWith(r.trigger)?r.text.split(`
|
|
225
|
-
`,1)[0]??``:``),u=I(()=>E(s).length>0?r.entries.filter(e=>e.value.startsWith(E(s))):[]),d=I(()=>r.entries.length===0&&r.emptyMessage!==void 0),f=I(()=>E(s).length>0&&r.caretOnFirstLine&&E(a)!==r.text&&(E(u).length>0||E(d))),p=I(()=>Math.min(E(o),Math.max(0,E(u).length-1)));function m(e){e.preventDefault(),e.stopPropagation()}function g(e){if(!E(f))return!1;if(e.key===`Escape`)return m(e),F(a,r.text,!0),!0;if(E(u).length===0)return e.key===`Enter`&&(m(e),!0);if(e.key===`ArrowDown`)return m(e),F(o,(E(p)+1)%E(u).length),!0;if(e.key===`ArrowUp`)return m(e),F(o,(E(p)-1+E(u).length)%E(u).length),!0;if(e.key===`Enter`){m(e);let t=E(u)[E(p)];return t&&r.onSelect(t.value),!0}return!1}var _={handleKeydown:g},v=X(),b=q(v),S=e=>{var i=wR(),a=W(i),o=e=>{var t=bR(),n=M(t,!0);H(()=>c(n,r.sourceLabel)),y(e,t)};h(a,e=>{r.sourceLabel&&e(o)});var s=z(a,2),d=e=>{var t=xR(),n=M(t,!0);H(()=>c(n,r.emptyMessage)),y(e,t)},f=e=>{var i=X(),a=q(i);t(a,19,()=>E(u),e=>e.value,(e,t,i)=>{var a=CR(),o=W(a),s=W(o),u=M(s,!0),d=z(s,2),f=e=>{var n=SR(),r=M(n,!0);H(()=>c(r,E(t).description)),y(e,n)};h(d,e=>{E(t).description&&e(f)}),n(o),n(a),H(()=>{Y(o,1,`flex w-full cursor-pointer items-center gap-2 px-2.5 py-1.5 text-left text-[11px] ${E(i)===E(p)?`bg-accent text-accent-foreground`:`text-foreground`} hover:bg-accent/50`),B(o,`aria-current`,E(i)===E(p)?`true`:void 0),c(u,E(t).value)}),l(`click`,o,()=>r.onSelect(E(t).value)),y(e,a)}),y(e,i)};h(s,e=>{E(u).length===0?e(d):e(f,-1)}),n(i),H(()=>{B(i,`data-slot`,r.dataSlot),B(i,`aria-label`,r.menuLabel)}),y(e,i)};return h(b,e=>{E(f)&&e(S)}),y(e,v),x(_)}T([`click`]);var ER=[{command:`/compact`,description:`Summarize the transcript to reclaim context`}];function DR(e,t){i(t,!0);let n=ER.map(e=>({value:e.command,...e.description.length>0?{description:e.description}:{}})),r=V(null);function a(e){return E(r)?.handleKeydown(e)??!1}var o={handleKeydown:a};return se(TR(e,{trigger:`/`,get entries(){return n},get text(){return t.text},get caretOnFirstLine(){return t.caretOnFirstLine},menuLabel:`Slash commands`,dataSlot:`slash-menu`,get onSelect(){return t.onExecute}}),e=>F(r,e,!0),()=>E(r)),x(o)}function OR(e,t){i(t,!0);let n=I(()=>At.skills.map(e=>({value:`$${e.name}`,...e.description.length>0?{description:e.description}:{}}))),r=I(()=>At.target?`from provider: ${At.target.providerId}`:`Open a Workspace provider to load skills`),a=V(null);function o(e){return E(a)?.handleKeydown(e)??!1}var s={handleKeydown:o};return se(TR(e,{trigger:`$`,get entries(){return E(n)},get text(){return t.text},get caretOnFirstLine(){return t.caretOnFirstLine},menuLabel:`Skill references`,get sourceLabel(){return E(r)},dataSlot:`skill-menu`,emptyMessage:`No skills in the current workspace`,get onSelect(){return t.onInsert}}),e=>F(a,e,!0),()=>E(a)),x(s)}var kR=null;function AR(){if(kR!==null)return kR;let e=St();return e?(kR=e.agent.models.catalog({}).then(e=>Object.fromEntries(e.providers.map(e=>[e.provider,e.label]))).catch(()=>(kR=null,{})),kR):Promise.resolve({})}var jR=r(`<img class="h-full w-full object-cover"/>`),MR=r(`<div class="flex h-full w-full items-center justify-center bg-muted/40"><!></div>`),NR=r(`<div class="group relative h-14 w-14 overflow-hidden rounded-lg border border-border"><!> <button type="button" class="absolute top-0.5 right-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-background/80 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:text-destructive" aria-label="Remove attachment"><!></button></div>`),PR=r(`<span class="flex items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[10px]"> <button type="button" class="text-muted-foreground hover:text-destructive">×</button></span>`),FR=r(`<div class="flex flex-wrap gap-1.5 px-3 pt-3" aria-label="Pending attachments"><!> <!></div>`),IR=r(`<span class="truncate"> </span> <!>`,1),LR=r(`<span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center"><!></span> <span class="truncate"> </span>`,1),RR=r(`<!> <!>`,1),zR=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-primary"></span>`),BR=r(`<span class="truncate"> </span> <!> <!>`,1),VR=r(`<span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span> <span class="truncate"> </span>`,1),HR=r(`<!> <!> <!>`,1),UR=r(`<div class="relative mx-3 mb-3 flex shrink-0 flex-col rounded-[22px] border border-border bg-card shadow-sm"><!> <!> <!> <textarea class="msg-body max-h-40 w-full resize-none border-0 bg-transparent px-3.5 py-2.5 outline-none focus:outline-none focus-visible:ring-0 placeholder:text-muted-foreground disabled:opacity-50" aria-label="Message"></textarea> <div class="flex h-11 items-center gap-1 px-2.5"><!> <button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground disabled:opacity-50" title="Attach images (paste or pick, ≤4 MiB each)" aria-label="Attach images (paste or pick, ≤4 MiB each)"><!></button> <button type="button" class="relative flex h-8 w-8 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-1.5 after:content-[''] hover:bg-muted hover:text-foreground disabled:opacity-50" title="Attach files (text inlined, binary as refs, ≤512 KiB each)" aria-label="Attach files (text inlined, binary as refs, ≤512 KiB each)"><!></button> <div class="flex-1"></div> <!> <!> <button type="button"><!></button></div></div>`);function WR(e,r){i(r,!0);let o=V(null),s=V(null),u=V(null),d=V(!0);de(()=>{Z.text;let e=E(o);e&&(e.style.height=`auto`,e.style.height=`${Math.min(160,Math.max(44,e.scrollHeight))}px`)}),de(()=>{Z.text,F(d,p(),!0)});function p(){return!Z.text.slice(0,E(o)?.selectionStart??0).includes(`
|
|
226
|
-
`)}let m=I(()=>ze.status===`running`),g=I(()=>Z.text.trim().length>0||Z.images.length>0||Z.files.length>0),_=I(()=>Z.editing!==null),v=I(()=>E(_)?`Edit your message — sending will resend it as a new message`:`Message the agent…`),b=I(()=>E(m)&&!E(g)?`stop`:E(m)?`wait`:`send`),S=I(()=>ze.sessionId?ze.mode:ze.pendingMode),w=I(()=>_t.find(e=>e.id===E(S))?.label),T=I(()=>{let e=Q.view;if(!e)return null;let t=e.settings.model,n=!e.settings.modelRoutes.some(e=>e.provider===t.provider);return{label:`${t.provider} · ${t.model}`,effort:t.reasoningEffort,dangling:n}}),D=V(J({})),k=V(!1),A=V(!1);de(()=>{AR().then(e=>F(D,e,!0))});let ee=I(()=>{let e=Q.view;if(!e)return[];let t=e.settings.model;return e.settings.modelRoutes.map(e=>{let n=e.models.map(e=>e.id);t.provider===e.provider&&!n.includes(t.model)&&n.unshift(t.model);let r=E(D)[e.provider]??e.provider;return{provider:e.provider,label:r,letter:e.iconLetter??r.slice(0,1).toUpperCase(),color:e.iconColor??`hsl(${AL(e.provider)} 55% 45%)`,models:n}})});function te(e,t){let n=Q.view;return n!==null&&n.settings.model.provider===e&&n.settings.model.model===t}async function P(e,t){let n=Q.view?.settings.model.reasoningEffort,r=await xe({model:{provider:e,model:t,...n!==void 0&&n.length>0?{reasoningEffort:n}:{}}});if(r){if(r.outcome===`rejected`){Mn(`${r.code}: ${r.detail}`);return}if(r.outcome===`error`){Mn(r.message);return}Mn(`Active model → ${e} · ${t}`)}}function L(){let e=Z.text.trim();(e.length!==0||Z.images.length!==0||Z.files.length!==0)&&(ze.sending||Le(e,Z.images,Z.files))}let ne=V(!1);async function re(e){if(!E(ne)){F(ne,!0);try{let t=await Ue(e);if(t===null||t.paths.length===0)return;let n=t.paths.map(e=>({path:e,name:e.split(/[\\/]/).filter(Boolean).pop()??e}));e===`image`?(Se(n),Fe(n)):Ae(n)}finally{F(ne,!1)}}}function R(e){if(!ze.sessionId){ze.pendingMode=e;return}Ne(e)}function ae(e){ze.sending||(Z.text=``,Z.images=[],Z.files=[],Ve(),Le(e))}function ce(e){let t=E(o),n=Math.min(t?.selectionStart??Z.text.length,Z.text.length);Z.text=`${e} ${Z.text.slice(n)}`;let r=Math.min(e.length+1,Z.text.length);requestAnimationFrame(()=>{t?.setSelectionRange(r,r),F(d,p(),!0)})}function U(e){E(s)?.handleKeydown(e)||E(u)?.handleKeydown(e)||e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())}function le(){F(d,p(),!0)}function G(e){let t=[...e.clipboardData?.files??[]].filter(e=>e.type.startsWith(`image/`));t.length>0&&(e.preventDefault(),Ze(t))}var ue=UR(),K=W(ue);se(DR(K,{get text(){return Z.text},get caretOnFirstLine(){return E(d)},onExecute:ae}),e=>F(s,e,!0),()=>E(s));var fe=z(K,2);se(OR(fe,{get text(){return Z.text},get caretOnFirstLine(){return E(d)},onInsert:ce}),e=>F(u,e,!0),()=>E(u));var pe=z(fe,2),me=e=>{var r=FR(),i=W(r);t(i,17,()=>Z.images,ie,(e,t,r)=>{var i=NR(),a=W(i),o=e=>{var n=jR();H(()=>{B(n,`src`,E(t).preview),B(n,`alt`,E(t).name??`image`)}),y(e,n)},s=e=>{var r=MR();Uc(W(r),{class:`h-5 w-5 text-muted-foreground`,"aria-hidden":`true`}),n(r),H(()=>B(r,`title`,E(t).path??E(t).name??`image`)),y(e,r)};h(a,e=>{E(t).preview?e(o):e(s,-1)});var c=z(a,2),u=W(c);Ln(u,{class:`h-2.5 w-2.5`}),n(c),n(i),l(`click`,c,()=>Z.images=Z.images.filter((e,t)=>t!==r)),y(e,i)});var a=z(i,2);t(a,17,()=>Z.files,ie,(e,t,r)=>{var i=PR(),a=W(i),o=z(a);n(i),H(()=>{c(a,`📄 ${E(t).name??``} `),B(o,`aria-label`,`Remove file ${E(t).name??``}`)}),l(`click`,o,()=>Z.files=Z.files.filter((e,t)=>t!==r)),y(e,i)}),n(r),y(e,r)};h(pe,e=>{(Z.files.length>0||Z.images.length>0)&&e(me)});var he=z(pe,2);O(he),B(he,`rows`,1),B(he,`maxlength`,2e4),se(he,e=>F(o,e),()=>E(o));var ge=z(he,2),_e=W(ge);a(_e,()=>JL,(e,r)=>{r(e,{get open(){return E(A)},set open(e){F(A,e,!0)},children:(e,r)=>{var i=RR(),o=q(i);{let e=I(()=>E(m)?`Switch after the current turn ends`:ze.sessionId?`Switch this session's mode`:`Pick the mode for your next session`);a(o,()=>lR,(t,n)=>{n(t,{class:`flex h-7 max-w-[130px] items-center gap-1.5 rounded-full border border-border px-2.5 text-[11px] text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,get title(){return E(e)},"aria-label":`Session mode`,get disabled(){return E(m)},onkeydown:e=>{e.key===`Escape`&&E(A)&&(e.stopPropagation(),F(A,!1))},children:(e,t)=>{var n=IR(),r=q(n),i=M(r,!0);KL(z(r,2),{class:`h-3 w-3 shrink-0 opacity-60`,"aria-hidden":`true`}),H(()=>c(i,E(w)??`Mode`)),y(e,n)},$$slots:{default:!0}})})}var s=z(o,2),l=e=>{var r=X(),i=q(r);a(i,()=>QL,(e,r)=>{r(e,{align:`start`,class:`max-h-72 w-44 overflow-y-auto`,onkeydown:e=>{e.key===`Escape`&&(e.stopPropagation(),F(A,!1))},children:(e,r)=>{var i=X(),o=q(i);t(o,17,()=>_t,e=>e.id,(e,t)=>{var r=X(),i=q(r);{let e=I(()=>E(S)===E(t).id?`true`:void 0);a(i,()=>nR,(r,i)=>{i(r,{get"data-mode-active"(){return E(e)},class:`gap-1.5`,onclick:()=>R(E(t).id),children:(e,r)=>{var i=LR(),a=q(i),o=W(a),s=e=>{Hs(e,{class:`h-3 w-3`,"aria-hidden":`true`})};h(o,e=>{E(S)===E(t).id&&e(s)}),n(a);var l=z(a,2),u=M(l,!0);H(()=>c(u,E(t).label)),y(e,i)},$$slots:{default:!0}})})}y(e,r)}),y(e,i)},$$slots:{default:!0}})}),y(e,r)};h(s,e=>{E(A)&&e(l)}),y(e,i)},$$slots:{default:!0}})});var ve=z(_e,2);Uc(W(ve),{class:`h-4 w-4`}),n(ve);var ye=z(ve,2);BL(W(ye),{class:`h-4 w-4`}),n(ye);var be=z(ye,4),Ce=e=>{var r=X(),i=q(r);a(i,()=>JL,(e,r)=>{r(e,{get open(){return E(k)},set open(e){F(k,e,!0)},children:(e,r)=>{var i=RR(),o=q(i);{let e=I(()=>E(T).dangling?`border-amber-500/60 text-amber-600 dark:text-amber-400`:`border-border text-muted-foreground hover:text-foreground`),t=I(()=>E(m)?`Switch after the current turn ends`:`Switch the active model — route configuration lives in Settings → Model`);a(o,()=>lR,(n,r)=>{r(n,{get class(){return`flex h-7 max-w-[150px] items-center gap-1.5 rounded-full border px-2.5 text-[11px] transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 ${E(e)??``}`},get title(){return E(t)},"aria-label":`Switch active model`,get disabled(){return E(m)},onkeydown:e=>{e.key===`Escape`&&E(k)&&(e.stopPropagation(),F(k,!1))},children:(e,t)=>{var n=BR(),r=q(n),i=M(r,!0),a=z(r,2),o=e=>{var t=zR();H(()=>B(t,`title`,`Reasoning effort: ${E(T).effort}`)),y(e,t)};h(a,e=>{E(T).effort&&e(o)}),KL(z(a,2),{class:`h-3 w-3 shrink-0 opacity-60`,"aria-hidden":`true`}),H(()=>c(i,E(T).label)),y(e,n)},$$slots:{default:!0}})})}var s=z(o,2);a(s,()=>QL,(e,r)=>{r(e,{align:`end`,class:`max-h-72 w-56 overflow-y-auto`,onkeydown:e=>{e.key===`Escape`&&(e.stopPropagation(),F(k,!1))},children:(e,r)=>{var i=HR(),o=q(i),s=e=>{var t=RR(),n=q(t);a(n,()=>aR,(e,t)=>{t(e,{"data-dangling":`true`,class:`px-2 py-1.5 text-[10px] font-medium text-amber-600 dark:text-amber-400`,children:(e,t)=>{oe();var n=C();H(()=>c(n,`${E(T).label??``} — outside Routes`)),y(e,n)},$$slots:{default:!0}})});var r=z(n,2);a(r,()=>sR,(e,t)=>{t(e,{})}),y(e,t)};h(o,e=>{E(T).dangling&&e(s)});var l=z(o,2);t(l,17,()=>E(ee),e=>e.provider,(e,r)=>{var i=RR(),o=q(i);a(o,()=>eR,(e,i)=>{i(e,{children:(e,i)=>{var o=RR(),s=q(o);a(s,()=>dR,(e,t)=>{t(e,{class:`flex items-center gap-1.5 px-2 py-1 text-[10px] font-medium`,children:(e,t)=>{var n=VR(),i=q(n),a=M(i,!0),o=z(i,2),s=M(o,!0);H(()=>{j(i,`background: ${E(r).color??``}`),c(a,E(r).letter),c(s,E(r).label)}),y(e,n)},$$slots:{default:!0}})});var l=z(s,2);t(l,16,()=>E(r).models,e=>e,(e,t)=>{var i=X(),o=q(i);{let e=I(()=>te(E(r).provider,t)?`true`:void 0);a(o,()=>nR,(i,a)=>{a(i,{get"data-model-active"(){return E(e)},class:`gap-1.5`,onclick:()=>void P(E(r).provider,t),children:(e,i)=>{var a=LR(),o=q(a),s=W(o),l=e=>{Hs(e,{class:`h-3 w-3`,"aria-hidden":`true`})},u=I(()=>te(E(r).provider,t));h(s,e=>{E(u)&&e(l)}),n(o);var d=z(o,2),f=M(d,!0);H(()=>c(f,t)),y(e,a)},$$slots:{default:!0}})})}y(e,i)}),y(e,o)},$$slots:{default:!0}})});var s=z(o,2);a(s,()=>sR,(e,t)=>{t(e,{})}),y(e,i)});var u=z(l,2);a(u,()=>nR,(e,t)=>{t(e,{onclick:()=>pR(`model`),children:(e,t)=>{oe();var n=C(`Open settings →`);y(e,n)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,r)};h(be,e=>{E(T)&&e(Ce)});var we=z(be,2);yR(we,{});var Te=z(we,2),Ee=W(Te),De=e=>{WL(e,{class:`h-3 w-3`})},Oe=e=>{HL(e,{class:`h-4 w-4`})};h(Ee,e=>{E(b)===`stop`?e(De):e(Oe,-1)}),n(Te),n(ge),n(ue),H(()=>{B(he,`placeholder`,E(v)),Y(Te,1,`relative flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-full transition-colors after:absolute after:-inset-0.5 after:content-[''] ${E(b)===`stop`?`bg-destructive text-white hover:bg-destructive/90`:E(b)===`wait`?`bg-muted text-muted-foreground`:`bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50`}`),B(Te,`aria-label`,E(b)===`stop`?`Cancel current activity`:`Send message`),B(Te,`title`,E(b)===`stop`?`Cancel current activity`:E(b)===`wait`?`Wait for the current turn`:`Send (Enter)`),Te.disabled=E(b)!==`stop`&&(!E(g)||ze.sending)}),l(`keydown`,he,U),l(`keyup`,he,le),l(`click`,he,le),f(`select`,he,le),f(`paste`,he,G),N(he,()=>Z.text,e=>Z.text=e),l(`click`,ve,()=>void re(`image`)),l(`click`,ye,()=>void re(`file`)),l(`click`,Te,()=>E(b)===`stop`?void Pe():L()),y(e,ue),x()}T([`click`,`keydown`,`keyup`]);var GR=r(`<div class="border-t border-destructive/30 bg-destructive/8 px-3 py-1.5 text-xs text-destructive" role="alert"> </div>`),KR=r(`<div class="mx-3 mb-1.5 flex h-7 shrink-0 items-center justify-between gap-2 rounded-lg bg-amber-500/10 px-2.5 text-[11px] text-amber-700 dark:text-amber-400" role="status"><span class="truncate">Editing — resending keeps your full history (append-only)</span> <button type="button" class="shrink-0 rounded p-0.5 text-amber-700/80 hover:text-amber-700 dark:text-amber-400/80 dark:hover:text-amber-400" title="Cancel edit" aria-label="Cancel edit"><!></button></div>`),qR=r(`<aside aria-label="Agent panel"><div class="absolute inset-y-0 left-0 z-10 hidden w-1.5 cursor-col-resize touch-none select-none hover:bg-primary/30 min-[720px]:block" role="separator" aria-orientation="vertical" aria-label="Resize agent panel"></div> <!> <!> <!> <!> <!> <!></aside>`);function JR(e,t){i(t,!0),de(()=>{We.open&&Q.view===null&&!Q.loading&&Ke()}),de(()=>{if(We.seedPrompt){let e=We.seedPrompt;We.seedPrompt=null,Z.text.length===0&&(Z.text=e)}});let r=V(!1),a=0,o=0;function s(e){if(e.button!==0)return;F(r,!0),a=e.clientX,o=We.width;let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId),document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`}function u(){E(r)&&(F(r,!1),document.body.style.userSelect=``,document.body.style.cursor=``)}var d=qR();f(`keydown`,A,e=>{e.key===`Escape`&&We.open&&!document.querySelector(`[role='dialog']`)&&Xe(!1)}),f(`pointermove`,A,e=>{E(r)&&Qe(o+(a-e.clientX))}),f(`pointerup`,A,u),f(`pointercancel`,A,u);var p=W(d),m=z(p,2);Lc(m,{});var g=z(m,2);TL(g,{});var _=z(g,2),v=e=>{var t=GR(),n=M(t,!0);H(()=>c(n,ze.promptError??ze.error)),y(e,t)};h(_,e=>{(ze.promptError??ze.error)&&e(v)});var b=z(_,2),S=e=>{kL(e,{get todos(){return ze.todos}})};h(b,e=>{ze.sessionId&&ze.todos.length>0&&e(S)});var C=z(b,2),w=e=>{var t=KR(),r=z(W(t),2),i=W(r);Ln(i,{class:`h-3 w-3`}),n(r),n(t),l(`click`,r,()=>{Z.editing!==null&&(Z.text=``),Z.editing=null}),y(e,t)};h(C,e=>{Z.editing!==null&&e(w)}),WR(z(C,2),{}),n(d),H(()=>{Y(d,1,`relative flex h-full w-full flex-col bg-background min-[720px]:w-(--agent-panel-width) min-[720px]:overflow-hidden duration-150 ease-in-out ${E(r)?``:`min-[720px]:transition-[width,border-color] max-[720px]:transition-[transform,visibility]`} ${We.open?`border-l border-border`:`border-l-0 max-[720px]:translate-x-full max-[720px]:invisible`}`),j(d,`--agent-panel-width: ${(We.open?We.width:0)??``}px`)}),f(`dragover`,d,e=>e.preventDefault()),f(`drop`,d,function(...e){be?.apply(this,e)}),l(`pointerdown`,p,s),y(e,d),x()}T([`pointerdown`,`click`]);var YR=new Set([`$$slots`,`$$events`,`$$legacy`]);function XR(e,t){let n=U(t,YR),r=[[`path`,{d:`M14 17H5`}],[`path`,{d:`M19 7h-9`}],[`circle`,{cx:`17`,cy:`17`,r:`3`}],[`circle`,{cx:`7`,cy:`7`,r:`3`}]];ye(e,K({name:`settings-2`},()=>n,{get iconNode(){return r}}))}var ZR=new Set([`$$slots`,`$$events`,`$$legacy`]);function QR(e,t){let n=U(t,ZR),r=[[`path`,{d:`M12 20v2`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M17 20v2`}],[`path`,{d:`M17 2v2`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M2 17h2`}],[`path`,{d:`M2 7h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`M20 17h2`}],[`path`,{d:`M20 7h2`}],[`path`,{d:`M7 20v2`}],[`path`,{d:`M7 2v2`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`}]];ye(e,K({name:`cpu`},()=>n,{get iconNode(){return r}}))}var $R=new Set([`$$slots`,`$$events`,`$$legacy`]);function ez(e,t){let n=U(t,$R),r=[[`path`,{d:`M12 8V4H8`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`}],[`path`,{d:`M2 14h2`}],[`path`,{d:`M20 14h2`}],[`path`,{d:`M15 13v2`}],[`path`,{d:`M9 13v2`}]];ye(e,K({name:`bot`},()=>n,{get iconNode(){return r}}))}var tz=r(`<button><span class="flex items-center gap-1 font-medium"> </span> <span class="mt-0.5 block text-[10px] leading-snug text-muted-foreground"> </span></button>`),nz=r(`<button> </button>`),rz=r(`<section class="space-y-1.5" aria-label="Default mode"><span class="text-[11px] font-medium text-muted-foreground">Default mode</span> <div class="grid grid-cols-2 gap-1.5"></div></section> <section class="space-y-1.5" aria-label="Behavior"><span class="text-[11px] font-medium text-muted-foreground">Behavior</span> <div class="space-y-1"><span class="text-[10px] text-muted-foreground">LLM preset</span> <div class="flex gap-1.5"></div></div> <div class="space-y-1"><span class="text-[10px] text-muted-foreground">Approval policy</span> <div class="flex gap-1.5"></div></div></section>`,1),iz=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),az=r(`<div class="flex items-center justify-between gap-2 text-xs text-muted-foreground">Agent settings unavailable <!></div>`),oz=r(`<div class="text-xs text-destructive" role="alert"> </div>`),sz=r(`<div class="space-y-4"><div><h3 class="text-sm font-medium">Agent</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Defaults for new sessions; the panel header switches an existing session's mode.</p></div> <!> <!></div>`);function cz(e,r){i(r,!0);let a=V(null),o=[`deterministic`,`live`],s=[`ask`,`never`],u=I(()=>Q.view);async function d(e){let t=await xe(e);t&&(t.outcome===`rejected`?F(a,`${t.code}: ${t.detail}`):t.outcome===`error`?F(a,t.message,!0):F(a,null))}var f=sz(),p=z(W(f),2),m=e=>{var r=rz(),i=q(r),a=z(W(i),2);t(a,21,()=>_t,e=>e.id,(e,t)=>{var r=tz(),i=W(r),a=M(i,!0),o=z(i,2),s=M(o,!0);n(r),H(()=>{Y(r,1,`rounded-md border p-2 text-left transition-colors ${E(u).settings.defaultMode===E(t).id?`border-primary bg-primary/10`:`border-border hover:bg-muted`}`),B(r,`aria-pressed`,E(u).settings.defaultMode===E(t).id),r.disabled=Q.updating,c(a,E(t).label),c(s,E(t).description)}),l(`click`,r,()=>void d({defaultMode:E(t).id})),y(e,r)}),n(a),n(i);var f=z(i,2),p=z(W(f),2),m=z(W(p),2);t(m,20,()=>o,e=>e,(e,t)=>{var n=nz(),r=M(n,!0);H(()=>{Y(n,1,`flex-1 rounded-md border px-2 py-1 transition-colors ${E(u).settings.preset===t?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`),B(n,`aria-pressed`,E(u).settings.preset===t),n.disabled=Q.updating,c(r,t)}),l(`click`,n,()=>void d({preset:t})),y(e,n)}),n(m),n(p);var h=z(p,2),g=z(W(h),2);t(g,20,()=>s,e=>e,(e,t)=>{var n=nz(),r=M(n,!0);H(()=>{Y(n,1,`flex-1 rounded-md border px-2 py-1 transition-colors ${E(u).settings.permissions.approvalPolicy===t?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`),B(n,`aria-pressed`,E(u).settings.permissions.approvalPolicy===t),n.disabled=Q.updating,c(r,t)}),l(`click`,n,()=>void d({permissions:{approvalPolicy:t}})),y(e,n)}),n(g),n(h),n(f),y(e,r)},g=e=>{var t=iz();y(e,t)},_=e=>{var t=az(),r=z(W(t));An(r,{size:`sm`,class:`h-7 px-2.5 text-xs`,onclick:()=>void Ke(),children:(e,t)=>{oe();var n=C(`Retry`);y(e,n)},$$slots:{default:!0}}),n(t),y(e,t)};h(p,e=>{E(u)?e(m):Q.loading?e(g,1):e(_,-1)});var v=z(p,2),b=e=>{var t=oz(),n=M(t,!0);H(()=>c(n,E(a))),y(e,t)};h(v,e=>{E(a)&&e(b)}),n(f),y(e,f),x()}T([`click`]);var lz=new Set([`$$slots`,`$$events`,`$$legacy`]);function uz(e,t){let n=U(t,lz),r=[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`}],[`path`,{d:`m2 22 3-3`}],[`path`,{d:`M7.5 13.5 10 11`}],[`path`,{d:`M10.5 16.5 13 14`}],[`path`,{d:`m18 3-4 4h6l-4 4`}]];ye(e,K({name:`plug-zap`},()=>n,{get iconNode(){return r}}))}var dz=new Set([`$$slots`,`$$events`,`$$legacy`]);function fz(e,t){let n=U(t,dz),r=[[`path`,{d:`M12 22v-5`}],[`path`,{d:`M15 8V2`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`}],[`path`,{d:`M9 8V2`}]];ye(e,K({name:`plug`},()=>n,{get iconNode(){return r}}))}var pz=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),mz=r(`<p class="text-[10px] text-muted-foreground">The panel reconnects automatically; keep the daemon running via the tray or the <code class="rounded bg-muted px-1 font-mono">skill-creator start</code> command.</p>`),hz=r(`<div class="space-y-4"><div><h3 class="text-sm font-medium">General</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Shell-level state of this Skill Creator instance.</p></div> <section class="space-y-1.5" aria-label="Daemon connection"><span class="text-[11px] font-medium text-muted-foreground">Daemon connection</span> <div class="flex items-center gap-2 rounded-md border border-border bg-background/60 p-2.5"><!> <span> </span></div> <!></section></div>`);function gz(e,t){i(t,!0);let r=I(()=>{switch(wt.status){case`connected`:return`Connected`;case`connecting`:return`Connecting…`;case`disconnected`:return`Disconnected`;default:return`Idle`}});var a=hz(),o=z(W(a),2),s=z(W(o),2),l=W(s),u=e=>{uz(e,{class:`h-4 w-4 text-primary`})},d=e=>{{let t=I(()=>wt.status===`disconnected`?`text-destructive`:`text-muted-foreground`);fz(e,{get class(){return`h-4 w-4 ${E(t)??``}`}})}};h(l,e=>{wt.status===`connected`?e(u):e(d,-1)});var f=z(l,2),p=M(f,!0);n(s);var m=z(s,2),g=e=>{var t=pz(),n=M(t,!0);H(()=>c(n,wt.error)),y(e,t)},_=e=>{var t=mz();y(e,t)};h(m,e=>{wt.status===`disconnected`?e(g):e(_,-1)}),n(o),n(a),H(()=>{Y(f,1,`text-xs ${wt.status===`connected`?`text-primary`:wt.status===`disconnected`?`text-destructive`:`text-muted-foreground`}`),c(p,E(r))}),y(e,a),x()}var _z=new Set([`$$slots`,`$$events`,`$$legacy`]);function vz(e,t){let n=U(t,_z),r=[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`}],[`path`,{d:`m2 2 20 20`}]];ye(e,K({name:`eye-off`},()=>n,{get iconNode(){return r}}))}var yz=new Set([`$$slots`,`$$events`,`$$legacy`]);function bz(e,t){let n=U(t,yz),r=[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`}],[`path`,{d:`m15 5 4 4`}]];ye(e,K({name:`pencil`},()=>n,{get iconNode(){return r}}))}var xz=new Set([`$$slots`,`$$events`,`$$legacy`]);function Sz(e,t){let n=U(t,xz),r=[[`path`,{d:`M12 3v12`}],[`path`,{d:`m17 8-5-5-5 5`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}]];ye(e,K({name:`upload`},()=>n,{get iconNode(){return r}}))}var Cz=r(`<img alt=""/>`),wz=r(`<span class="flex h-5 w-5 items-center justify-center rounded text-[10px] font-semibold text-white" aria-hidden="true"> </span>`),Tz=r(`<span class="flex h-12 w-12 shrink-0 items-center justify-center rounded-md text-base font-semibold text-white" aria-hidden="true"> </span>`),Ez=r(`<button type="button"><span class="flex h-4 w-4 items-center justify-center rounded" aria-hidden="true"><img alt="" class="h-3.5 w-3.5 object-contain dark:invert"/></span></button>`),Dz=r(`<p class="text-[9px] text-muted-foreground">Duplicate catalog icons are merged; hover shows sharing providers.</p>`),Oz=r(`<div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground">Icon</span> <div class="grid grid-cols-7 place-items-center gap-1"><button type="button" title="No icon — letter avatar with the color below (suppresses the catalog icon)" aria-label="No icon (letter avatar)"><span class="flex h-4 w-4 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span></button> <!></div> <!></div>`),kz=r(`<button type="button" title="No icon — letter avatar with the color below" aria-label="No icon (letter avatar)"><span class="flex h-4 w-4 shrink-0 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span> No icon — use the letter avatar</button>`),Az=r(`<button type="button"><span class="h-4 w-4 rounded" aria-hidden="true"></span></button>`),jz=r(`<span class="text-[9px] text-destructive" role="alert">invalid hex</span>`),Mz=r(`<div class="space-y-1 border-t border-border pt-1.5"><span class="text-[10px] font-medium text-muted-foreground">Avatar color</span> <div class="flex flex-wrap items-center gap-1"><button type="button" title="Auto — deterministic hue from the route name" aria-label="Auto avatar color"><span class="flex h-4 w-4 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> </span></button> <!></div> <div class="flex items-center gap-1"><input aria-label="Avatar color hex" placeholder="#3b82f6"/> <!></div></div>`),Nz=r(`<div class="space-y-1 border-t border-border pt-1.5"><span class="text-[10px] font-medium text-muted-foreground">Letter</span> <div class="flex items-center gap-1.5"><input class="h-6 w-12 rounded border border-border bg-background px-1.5 text-center text-[11px] font-semibold uppercase outline-none focus:border-primary/60" aria-label="Avatar letter" maxlength="2"/> <button type="button" class="rounded px-1.5 py-0.5 text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground" title="Reset to the first letter of the display name">Reset</button></div></div>`),Pz=r(`<div class="absolute left-0 top-[calc(100%+4px)] z-30 w-[280px] space-y-2 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-md" role="dialog" aria-label="Route icon and avatar choices"><div class="flex items-center gap-2"><!> <div class="min-w-0"><p class="truncate text-xs font-medium"> </p> <p class="text-[10px] text-muted-foreground"> </p></div></div> <!> <div class="flex items-center justify-between gap-2 border-t border-border pt-1.5"><span class="text-[10px] text-muted-foreground">Custom image · ≤64 KiB</span> <button type="button" class="flex h-6 items-center gap-1 rounded px-1.5 text-[10px] hover:bg-muted"><!> Upload</button></div> <input type="file" accept=".svg,.png,.webp" class="hidden" aria-label="Upload custom icon"/> <!> <!></div>`),Fz=r(`<div class="relative shrink-0"><button type="button" aria-label="Change route icon"><!> <span class="absolute bottom-0 right-0 hidden bg-background p-px text-foreground group-hover:block" aria-hidden="true"><!></span></button> <!></div>`);function Iz(e,r){i(r,!0);let a=k(r,`icon`,3,null),o=k(r,`label`,3,``),s=k(r,`catalogIcons`,19,()=>[]),u=k(r,`disabled`,3,!1),d=[`#ef4444`,`#f59e0b`,`#10b981`,`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#f43f5e`,`#64748b`],p=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,m=V(!1),g=V(null),_=V(null),v=V(``),b=V(``),S=V(!1);de(()=>{F(v,r.letter,!0)});let C=I(()=>{let e=new Map;for(let t of s()){let n=e.get(t.icon);n?n.providers.push(t.provider):e.set(t.icon,{icon:t.icon,providers:[t.provider]})}let t=[...e.values()];return t.sort((e,t)=>+!e.providers.includes(r.provider)-!t.providers.includes(r.provider)||e.providers[0].localeCompare(t.providers[0])),t}),w=I(()=>s().some(e=>e.provider===r.provider));function T(e){u()||(r.onPick(e),F(m,!1))}function D(){if(r.onLetter===void 0||u())return;let e=E(v).trim();if(e.length===0||e===r.letter){F(v,r.letter,!0);return}r.onLetter(e.slice(0,2))}function O(){r.onLetter===void 0||u()||(r.onLetter(void 0),F(v,r.letter,!0))}function ee(){if(r.onColor===void 0||u())return;let e=E(b).trim();if(e.length===0){F(S,!1);return}if(!p.test(e)){F(S,!0);return}F(S,!1),F(b,``),r.onColor(e.toLowerCase())}function te(e){let t=e.currentTarget;if(!(t instanceof HTMLInputElement))return;let n=t.files?.[0];if(t.value=``,!n)return;let r=n.name.split(`.`).pop()?.toLowerCase()??``,i=LL[r]??``;if(i.length===0){Mn(`Unsupported icon type “${n.type||r||n.name}” — use .svg, .png or .webp.`);return}let a=new FileReader;a.onerror=()=>{Mn(`Could not read “${n.name}” — try another file.`)},a.onload=()=>{let e=typeof a.result==`string`?a.result:``;if(e.length===0){Mn(`Could not read “${n.name}” — try another file.`);return}let t=e.startsWith(`data:${i}`)?e:RL(e,i);if(t===null){Mn(`Could not read “${n.name}” as an image.`);return}if(t.length>65536){Mn(`Icon too large — pick an image under 64 KiB.`);return}T(t)},a.readAsDataURL(n)}var P=Fz();f(`keydown`,A,e=>{E(m)&&e.key===`Escape`&&F(m,!1)}),f(`pointerdown`,A,e=>{E(m)&&E(g)&&!E(g).contains(e.target)&&F(m,!1)});var L=W(P),ne=W(L),re=e=>{var t=Cz();H(e=>{B(t,`src`,a()),Y(t,1,`h-5 w-5 object-contain ${e??``}`)},[()=>NL(a())?``:`dark:invert`]),y(e,t)},ie=e=>{var t=wz(),n=M(t,!0);H(()=>{j(t,`background: ${r.color??``}`),c(n,r.letter)}),y(e,t)};h(ne,e=>{a()?e(re):e(ie,-1)});var R=z(ne,2);bz(W(R),{class:`h-2.5 w-2.5`}),n(R),n(L);var ae=z(L,2),ce=e=>{var i=Pz(),s=W(i),p=W(s),g=e=>{var t=Cz();H(e=>{B(t,`src`,a()),Y(t,1,`h-12 w-12 shrink-0 object-contain ${e??``}`)},[()=>NL(a())?``:`dark:invert`]),y(e,t)},x=e=>{var t=Tz(),n=M(t,!0);H(()=>{j(t,`background: ${r.color??``}`),c(n,r.letter)}),y(e,t)};h(p,e=>{a()?e(g):e(x,-1)});var k=z(p,2),A=W(k),P=M(A,!0),I=z(A,2),L=M(I,!0);n(k),n(s);var ne=z(s,2),re=e=>{var i=Oz(),o=z(W(i),2),s=W(o),u=W(s),d=M(u,!0);n(s);var f=z(s,2);t(f,17,()=>E(C),e=>e.icon,(e,t)=>{var i=Ez(),o=W(i),s=M(o);n(i),H((e,n)=>{Y(i,1,`flex h-6 w-6 items-center justify-center rounded ${a()===E(t).icon?`border border-primary/60 bg-primary/5`:`hover:bg-muted`}`),B(i,`title`,e),B(i,`aria-label`,`Use icon shared by ${n??``}`),j(o,`background: color-mix(in srgb, ${r.color??``} 18%, transparent)`),B(s,`src`,E(t).icon)},[()=>E(t).providers.join(`, `),()=>E(t).providers.length>1?E(t).providers.join(`, `):E(t).providers[0]]),l(`click`,i,()=>T(E(t).icon)),y(e,i)}),n(o);var p=z(o,2),g=e=>{var t=Dz();y(e,t)};h(p,e=>{E(w)&&e(g)}),n(i),H(e=>{Y(s,1,`flex h-6 w-6 items-center justify-center rounded border ${a()===null?`border-primary/50 bg-primary/5`:`border-border hover:bg-muted`}`),j(u,`background: ${r.color??``}`),c(d,e)},[()=>r.letter.slice(0,1)]),l(`click`,s,()=>{if(r.onSuppress!==void 0){r.onSuppress(),F(m,!1);return}T(void 0)}),y(e,i)},ie=e=>{var t=kz(),i=W(t),o=M(i,!0);oe(),n(t),H(e=>{Y(t,1,`flex w-full items-center gap-2 rounded px-1 py-0.5 text-[10px] transition-colors hover:bg-muted ${a()===null?`text-primary`:`text-muted-foreground`}`),j(i,`background: ${r.color??``}`),c(o,e)},[()=>r.letter.slice(0,1)]),l(`click`,t,()=>T(void 0)),y(e,t)};h(ne,e=>{E(C).length>0?e(re):e(ie,-1)});var R=z(ne,2),ae=z(W(R),2);Sz(W(ae),{class:`h-3 w-3`}),oe(),n(ae),n(R);var V=z(R,2);se(V,e=>F(_,e),()=>E(_));var ce=z(V,2),U=e=>{var i=Mz(),a=z(W(i),2),o=W(a),s=W(o),p=M(s,!0);n(o);var m=z(o,2);t(m,16,()=>d,e=>e,(e,t)=>{var n=Az(),i=M(n);H(e=>{Y(n,1,`flex h-6 w-6 items-center justify-center rounded border ${e??``}`),B(n,`title`,t),B(n,`aria-label`,`Avatar color ${t??``}`),j(i,`background: ${t??``}`)},[()=>r.color.toLowerCase()===t?`border-primary/60 bg-primary/5`:`border-border hover:bg-muted`]),l(`click`,n,()=>r.onColor?.(t)),y(e,n)}),n(a);var g=z(a,2),_=W(g);le(_);var v=z(_,2),x=e=>{var t=jz();y(e,t)};h(v,e=>{E(S)&&e(x)}),n(g),n(i),H((e,t,n)=>{Y(o,1,`flex h-6 w-6 items-center justify-center rounded border ${e??``}`),j(s,`background: ${t??``}`),c(p,n),Y(_,1,`h-6 w-24 rounded border bg-background px-1.5 font-mono text-[10px] outline-none focus:border-primary/60 ${E(S)?`border-destructive`:`border-border`}`),_.disabled=u()},[()=>r.color===jL(r.provider)?`border-primary/50 bg-primary/5`:`border-border hover:bg-muted`,()=>jL(r.provider),()=>r.letter.slice(0,1)]),l(`click`,o,()=>r.onColor?.(void 0)),f(`blur`,_,()=>ee()),l(`keydown`,_,e=>{e.key===`Enter`&&ee()}),N(_,()=>E(b),e=>F(b,e)),y(e,i)};h(ce,e=>{r.onColor!==void 0&&e(U)});var G=z(ce,2),ue=e=>{var t=Nz(),r=z(W(t),2),i=W(r);le(i);var a=z(i,2);n(r),n(t),H(()=>i.disabled=u()),f(`blur`,i,()=>D()),l(`keydown`,i,e=>{e.key===`Enter`&&D()}),N(i,()=>E(v),e=>F(v,e)),l(`click`,a,O),y(e,t)};h(G,e=>{r.onLetter!==void 0&&e(ue)}),n(i),H(e=>{c(P,o()||r.provider),c(L,e)},[()=>a()?NL(a())?`Legacy letter avatar`:`Icon override`:`Letter avatar`]),l(`click`,ae,()=>E(_)?.click()),l(`change`,V,te),y(e,i)};h(ae,e=>{E(m)&&e(ce)}),n(P),se(P,e=>F(g,e),()=>E(g)),H(()=>{Y(L,1,`group relative flex h-7 w-7 items-center justify-center overflow-hidden rounded-md border border-border bg-background transition-colors hover:border-primary/50 ${u()?`pointer-events-none opacity-50`:``}`),B(L,`aria-expanded`,E(m)),L.disabled=u()}),l(`click`,L,()=>F(m,!E(m))),y(e,P),x()}T([`click`,`change`,`keydown`]);var Lz=r(`<span class="flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[10px]"> <button type="button" class="rounded px-0.5 text-muted-foreground hover:text-destructive">×</button></span>`),Rz=r(`<span class="shrink-0 rounded bg-primary/10 px-1 text-[9px] text-primary">vision</span>`),zz=r(`<li><button role="option"><span class="min-w-0 flex-1 truncate"> <span class="text-muted-foreground"> </span></span> <!></button></li>`),Bz=r(`<ul class="absolute z-10 mt-1 max-h-44 w-full overflow-y-auto rounded-md border border-border bg-popover p-1 text-xs shadow-md" role="listbox" aria-label="Model suggestions"></ul>`),Vz=r(`<div class="relative"><div class="flex min-h-8 flex-wrap items-center gap-1 rounded-md border border-border bg-background px-1.5 py-1 text-xs focus-within:border-primary/60" role="group" aria-label="Model ids"><input class="order-last h-6 min-w-24 flex-1 bg-transparent text-xs outline-none"/> <!></div> <!></div>`);function Hz(e,r){i(r,!0);let a=k(r,`placeholder`,3,`Add model…`),o=k(r,`disabled`,3,!1),s=V(``),u=V(!1),d=V(0),p=I(()=>{let e=E(s).trim().toLowerCase(),t=r.candidates.filter(e=>!r.selected.includes(e.id));return e.length===0?t.slice(0,8):t.filter(t=>t.id.toLowerCase().includes(e)||(t.name??``).toLowerCase().includes(e)).slice(0,8)});function m(e){let t=e.trim();if(t.length===0||r.selected.includes(t)){F(s,``);return}r.onchange([...r.selected,t]),F(s,``),F(u,!1)}function g(e){r.onchange(r.selected.filter(t=>t!==e))}function _(e){if(e.key===`Escape`){F(u,!1);return}if(e.key===`ArrowDown`&&E(p).length>0){e.preventDefault(),F(u,!0),F(d,Math.min(E(d)+1,E(p).length-1),!0);return}if(e.key===`ArrowUp`&&E(p).length>0){e.preventDefault(),F(d,Math.max(E(d)-1,0),!0);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),E(u)&&E(p)[E(d)]&&E(s).trim().length>0?m(E(p)[E(d)].id):E(s).trim().length>0&&m(E(s));return}e.key===`Backspace`&&E(s).length===0&&r.selected.length>0&&r.onchange(r.selected.slice(0,-1))}var v=Vz(),b=W(v),S=W(b);le(S);var C=z(S,2);t(C,16,()=>r.selected,e=>e,(e,t)=>{var r=Lz(),i=W(r),a=z(i);n(r),H(()=>{c(i,`${t??``} `),B(a,`aria-label`,`Remove ${t??``}`),a.disabled=o()}),l(`click`,a,()=>g(t)),y(e,r)}),n(b);var w=z(b,2),T=e=>{var r=Bz();t(r,23,()=>E(p),e=>e.id,(e,t,r)=>{var i=zz(),a=W(i),o=W(a),s=W(o),u=z(s),p=M(u);n(o);var g=z(o,2),_=e=>{var t=Rz();y(e,t)};h(g,e=>{E(t).image&&e(_)}),n(a),n(i),H(()=>{Y(a,1,`flex w-full items-center gap-2 rounded px-1.5 py-1 text-left ${E(r)===E(d)?`bg-accent`:``} hover:bg-accent`),B(a,`aria-selected`,E(r)===E(d)),c(s,`${E(t).name??E(t).id??``} `),c(p,`(${E(t).id??``})`)}),l(`mousedown`,a,e=>e.preventDefault()),l(`click`,a,()=>m(E(t).id)),f(`focus`,a,()=>F(d,E(r),!0)),y(e,i)}),n(r),y(e,r)};h(w,e=>{E(u)&&E(p).length>0&&e(T)}),n(v),H(()=>{B(S,`placeholder`,a()),S.disabled=o()}),l(`keydown`,S,_),f(`focus`,S,()=>{F(u,!0),F(d,0)}),l(`input`,S,()=>{F(u,!0),F(d,0)}),f(`blur`,S,()=>setTimeout(()=>F(u,!1),120)),N(S,()=>E(s),e=>F(s,e)),y(e,v),x()}T([`keydown`,`input`,`click`,`mousedown`]);function Uz(e){return e.split(/[-_]+/).filter(e=>e.length>0).map(e=>/^[a-z]{1,3}$/.test(e)?e.toUpperCase():e.slice(0,1).toUpperCase()+e.slice(1)).join(` `)}function Wz(e){if(!Number.isSafeInteger(e)||e<=0)return String(e);if(e%1048576==0)return`${e/1048576}M`;if(e>=1024){let t=e/1024;return`${Number.isInteger(t)?t.toString():t.toFixed(1)}k`}return String(e)}function Gz(e){return e.includes(`/`)||e.includes(`@`)}function Kz(e){return{id:e.id,...e.name===void 0?{}:{name:e.name},image:e.image,...e.contextWindow===void 0?{}:{contextWindow:e.contextWindow},...e.supportsReasoningEffort===void 0?{}:{supportsReasoningEffort:e.supportsReasoningEffort},...e.inputTypes===void 0?{}:{inputTypes:[...e.inputTypes]},...e.maxOutputTokens===void 0?{}:{maxOutputTokens:e.maxOutputTokens},...e.effortTiers===void 0?{}:{effortTiers:[...e.effortTiers]}}}var qz=(e,t)=>e.id<t.id?-1:+(e.id>t.id);function Jz(e,t=``){let n=new Map,r=new Map;for(let i of e?.providers??[]){let e=i.provider===t;for(let t of i.models)if(e)n.has(t.id)||n.set(t.id,Kz(t)),r.delete(t.id);else if(!n.has(t.id)&&!r.has(t.id)){if(Gz(t.id))continue;r.set(t.id,Kz(t))}}return[...n.values()].sort(qz).concat([...r.values()].sort(qz))}var Yz=[`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Xz=[`low`,`high`,`max`],Zz=`Catalog marks this model as not supporting reasoning effort`;function Qz(e,t){if(t?.supportsReasoningEffort===!1)return{candidates:[],hint:Zz};let n=new Set(Yz);for(let e of t?.effortTiers??[]){let t=e.trim();t.length>0&&n.add(t)}for(let t of e)for(let e of t.efforts??[]){let t=e.trim();t.length>0&&n.add(t)}return{candidates:[...n].sort((e,t)=>e<t?-1:+(e>t)),hint:null}}function $z(e){return{id:e.id,...e.name===void 0?{}:{name:e.name},...e.contextWindow===void 0?{}:{contextWindow:e.contextWindow},...e.maxOutputTokens===void 0?{}:{maxOutputTokens:e.maxOutputTokens},inputTypes:e.inputTypes??(e.image?[`text`,`image`]:[`text`]),outputTypes:[`text`],efforts:[...Xz]}}var eB=r(`<span class="h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500" title="Unsaved changes" aria-label="Unsaved changes"></span>`),tB=r(`<span data-header-status="true"><!></span>`),nB=r(`<option> </option>`),rB=r(`<p class="text-[10px] text-muted-foreground" role="note"> </p>`),iB=r(`<p class="text-[10px] text-destructive" role="alert">Invalid token value — use numbers, or shorthand like 253k / 0.5M.</p>`),aB=r(`<button type="button"> </button>`),oB=r(`<div class="grid grid-cols-2 gap-1.5"><label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Model id</span> <!> <datalist></datalist></label> <label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Name</span> <!></label></div> <div class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">Efforts</span> <!> <!></div> <div class="grid grid-cols-2 gap-1.5"><label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Context window</span> <!></label> <label class="min-w-0 space-y-0.5"><span class="text-[10px] text-muted-foreground">Max output tokens</span> <!></label></div> <!> <div class="flex flex-wrap items-center justify-between gap-2"><div class="flex flex-wrap items-center gap-1"><span class="text-[10px] text-muted-foreground">Inputs:</span> <span class="rounded bg-primary px-1.5 py-0.5 text-[10px] font-medium text-primary-foreground" title="Text is always required" data-input-chip="text">text</span> <!></div> <div class="flex items-center gap-1"><span class="text-[10px] text-muted-foreground">Outputs:</span> <span class="rounded bg-primary px-1.5 py-0.5 text-[10px] font-medium text-primary-foreground" title="Text output is always required" data-output-chip="text">text</span> <button type="button" title="Image output (image-generation models)" data-output-chip="image">image</button></div></div> <div class="flex items-center justify-between gap-2 border-t border-border pt-1.5"><span data-form-status="true"><!></span> <span class="flex shrink-0 items-center gap-1.5"><!> <!></span></div>`,1),sB=r(`<div class="space-y-1.5 rounded-md border border-border p-2"><div class="flex items-center justify-between gap-2"><div class="flex min-w-0 flex-1 items-center gap-1.5"><!> <span class="min-w-0 truncate text-xs font-medium" data-header-name="true"> </span> <!></div> <div class="flex shrink-0 items-center"><button type="button" class="flex h-11 w-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button> <button type="button" class="flex h-11 w-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button> <button type="button" class="flex h-11 w-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-destructive disabled:pointer-events-none disabled:opacity-50" title="Remove model"><!></button></div></div> <!></div>`);function cB(e,r){i(r,!0);let a=k(r,`routeModels`,19,()=>[]),o=k(r,`provider`,3,``),s=k(r,`formKey`,3,``),u=k(r,`disabled`,3,!1),d=k(r,`dirty`,3,!1),f=k(r,`initialExpanded`,3,!1),p=I(()=>s().trim().length>0),m=[`image`,`video`,`pdf`],g=`model-id-candidates-${crypto.randomUUID()}`,_=V(J(r.model.id)),v=V(J(r.model.name??Uz(r.model.id))),b=V(J(r.model.contextWindow===void 0?``:Wz(r.model.contextWindow))),S=V(J(r.model.maxOutputTokens===void 0?``:Wz(r.model.maxOutputTokens))),w=V(!1),T=V(!1),D=V(J((r.model.outputTypes??[]).includes(`image`))),O=V(!1),A=V(!1),j=V(!1),ee=V(!1),te=V(!1),N=V(!1),P=V(null),L=V(J(r.model.id)),ne=V(``),re=V(J(f())),ie=I(()=>E(_).trim().length>0),R=I(()=>E(ie)&&!E(ee)&&!E(te)),ae=I(()=>new Set(r.model.inputTypes??[`text`])),se=I(()=>r.candidates.find(e=>e.id===E(_).trim())??null),ce=I(()=>Qz(a(),E(se))),U=I(()=>E(ne).trim()),le=I(()=>r.model.name??(r.model.id.length>0?Uz(r.model.id):`New model`)),G=I(()=>u()||!E(ie)||E(N)||r.api.length===0||r.baseURL.length===0||!E(p)&&!r.apiKeyConfigured&&E(U).length===0);de(()=>{r.onvalidity(E(R))});function ue(e){r.onchange({...r.model,...e})}function K(e){F(_,e,!0);let t=e.trim(),n=r.candidates.find(e=>e.id===t),i={id:t};n===void 0?(F(L,null),E(w)||(F(v,Uz(t),!0),r.model.name!==void 0&&(i.name=void 0)),!E(O)&&r.model.contextWindow!==void 0&&(F(b,``),i.contextWindow=void 0),!E(A)&&r.model.maxOutputTokens!==void 0&&(F(S,``),i.maxOutputTokens=void 0),!E(T)&&r.model.inputTypes!==void 0&&(i.inputTypes=void 0),!E(D)&&r.model.outputTypes!==void 0&&(i.outputTypes=void 0)):(t!==E(L)&&(F(w,!1),F(O,!1),F(A,!1),F(T,!1),F(D,!1),F(j,!1),F(L,t,!0)),E(w)||(F(v,n.name??Uz(n.id),!0),i.name=E(v)),E(O)||(n.contextWindow===void 0?r.model.contextWindow!==void 0&&(F(b,``),i.contextWindow=void 0):(F(b,Wz(n.contextWindow),!0),i.contextWindow=n.contextWindow)),E(A)||(n.maxOutputTokens===void 0?r.model.maxOutputTokens!==void 0&&(F(S,``),i.maxOutputTokens=void 0):(F(S,Wz(n.maxOutputTokens),!0),i.maxOutputTokens=n.maxOutputTokens)),E(T)||(i.inputTypes=n.inputTypes??(n.image?[`text`,`image`]:[`text`])),E(D)||(i.outputTypes=[`text`]),!E(j)&&r.model.efforts===void 0&&(i.efforts=[...Xz])),ue(i)}function fe(e){F(v,e,!0),F(w,!0),ue(e.trim().length>0?{name:e.trim()}:{name:void 0})}function pe(e){let t=E(e===`contextWindow`?b:S).trim(),n=t=>{F(e===`contextWindow`?ee:te,t,!0)};if(t.length===0){n(!1),ue(e===`contextWindow`?{contextWindow:void 0}:{maxOutputTokens:void 0});return}let r=vt(t);if(r===null){n(!0);return}n(!1),e===`contextWindow`?(F(b,Wz(r),!0),F(O,!0)):(F(S,Wz(r),!0),F(A,!0)),ue(e===`contextWindow`?{contextWindow:r}:{maxOutputTokens:r})}function me(e){F(T,!0);let t=new Set(E(ae));t.has(e)?t.delete(e):t.add(e),t.add(`text`),ue({inputTypes:[`text`,...m.filter(e=>t.has(e))]})}let he=I(()=>new Set(r.model.outputTypes??[`text`]));function X(e){F(D,!0);let t=new Set(E(he));t.has(e)?t.delete(e):t.add(e),t.add(`text`),ue({outputTypes:[`text`,`image`].filter(e=>t.has(e))})}async function ge(){if(E(N)||!E(ie)||!E(p)&&!r.apiKeyConfigured&&E(U).length===0)return;let e=E(p)?s().trim():r.apiKeyConfigured?null:E(U);F(N,!0),F(P,null);let t=await ke({api:r.api,baseURL:r.baseURL,modelId:E(_).trim(),...e===null?o().length>0?{provider:o()}:{}:{apiKey:e}});F(N,!1),t!==null&&F(P,t,!0)}var _e=sB(),ve=W(_e),ye=W(ve),be=W(ye),xe=e=>{var t=eB();y(e,t)};h(be,e=>{d()&&e(xe)});var Z=z(be,2),Se=M(Z,!0),Ce=z(Z,2),we=e=>{var t=tB(),r=W(t),i=e=>{var t=C(`testing…`);y(e,t)},a=e=>{var t=C();H(()=>c(t,`ok · ${E(P).latencyMs??``} ms`)),y(e,t)},o=e=>{var t=C();H(()=>c(t,`failed · ${E(P).detail??``}`)),y(e,t)};h(r,e=>{E(N)?e(i):E(P)?.outcome===`ok`?e(a,1):E(P)?.outcome===`failed`&&e(o,2)}),n(t),H(()=>Y(t,1,`min-w-0 shrink-0 truncate text-[10px] ${E(P)?.outcome===`ok`?`text-primary`:E(P)?.outcome===`failed`?`text-destructive`:`text-muted-foreground`}`)),y(e,t)};h(Ce,e=>{E(re)||e(we)}),n(ye);var Te=z(ye,2),Ee=W(Te);uz(W(Ee),{class:`h-4 w-4`,"aria-hidden":`true`}),n(Ee);var De=z(Ee,2);bz(W(De),{class:`h-4 w-4`,"aria-hidden":`true`}),n(De);var Oe=z(De,2),Ae=W(Oe);Cn(Ae,{class:`h-4 w-4`,"aria-hidden":`true`}),n(Oe),n(Te),n(ve);var je=z(ve,2),Me=e=>{var i=oB(),a=q(i),o=W(a),s=z(W(o),2);zn(s,{class:`h-8 font-mono text-xs`,"aria-label":`Model id`,placeholder:`glm-5.3-flash`,get list(){return g},get disabled(){return u()},oninput:e=>K(e.currentTarget.value),get value(){return E(_)},set value(e){F(_,e,!0)}});var d=z(s,2);t(d,21,()=>r.candidates.slice(0,200),e=>e.id,(e,t)=>{var n=nB(),r=M(n,!0),i={};H(()=>{c(r,E(t).name??``),i!==(i=E(t).id)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(d),n(o);var f=z(o,2),x=z(W(f),2);{let e=I(()=>Uz(E(_).trim()||r.model.id));zn(x,{class:`h-8 text-xs`,"aria-label":`Model name`,get placeholder(){return E(e)},get disabled(){return u()},oninput:e=>fe(e.currentTarget.value),get value(){return E(v)},set value(e){F(v,e,!0)}})}n(f),n(a);var w=z(a,2),T=z(W(w),2);{let e=I(()=>r.model.efforts??[]),t=I(()=>E(ce).candidates.map(e=>({id:e})));Hz(T,{get selected(){return E(e)},get candidates(){return E(t)},placeholder:`Add effort (e.g. low)…`,get disabled(){return u()},onchange:e=>{F(j,!0),ue(e.length>0?{efforts:e}:{efforts:void 0})}})}var D=z(T,2),O=e=>{var t=rB(),n=M(t,!0);H(()=>c(n,E(ce).hint)),y(e,t)};h(D,e=>{E(ce).hint!==null&&e(O)}),n(w);var k=z(w,2),A=W(k),L=z(W(A),2);{let e=I(()=>E(ee)?`border-destructive focus-visible:ring-destructive`:``);zn(L,{get class(){return`h-8 text-xs ${E(e)??``}`},"aria-label":`Context window (tokens)`,placeholder:`200k / 0.5M / 131072`,get disabled(){return u()},onblur:()=>pe(`contextWindow`),onkeydown:e=>{e.key===`Enter`&&pe(`contextWindow`)},get value(){return E(b)},set value(e){F(b,e,!0)}})}n(A);var re=z(A,2),ie=z(W(re),2);{let e=I(()=>E(te)?`border-destructive focus-visible:ring-destructive`:``);zn(ie,{get class(){return`h-8 text-xs ${E(e)??``}`},"aria-label":`Max output tokens`,placeholder:`32k / 131072`,get disabled(){return u()},onblur:()=>pe(`maxOutputTokens`),onkeydown:e=>{e.key===`Enter`&&pe(`maxOutputTokens`)},get value(){return E(S)},set value(e){F(S,e,!0)}})}n(re),n(k);var R=z(k,2),se=e=>{var t=iB();y(e,t)};h(R,e=>{(E(ee)||E(te))&&e(se)});var V=z(R,2),U=W(V),le=z(W(U),4);t(le,16,()=>m,e=>e,(e,t)=>{var n=aB(),r=M(n,!0);H((e,i)=>{Y(n,1,`rounded border px-1.5 py-0.5 text-[10px] transition-colors ${e??``}`),B(n,`aria-pressed`,i),n.disabled=u(),c(r,t)},[()=>E(ae).has(t)?`border-primary bg-primary text-primary-foreground`:`border-border bg-background text-muted-foreground hover:bg-muted`,()=>E(ae).has(t)]),l(`click`,n,()=>me(t)),y(e,n)}),n(U);var de=z(U,2),J=z(W(de),4);n(de),n(V);var _e=z(V,2),ve=W(_e),ye=W(ve),be=e=>{var t=C();H(()=>c(t,`ok · ${E(P).latencyMs??``} ms`)),y(e,t)},xe=e=>{var t=C();H(()=>c(t,`failed · ${E(P).detail??``}`)),y(e,t)},Z=e=>{var t=C(`Probing with the route key above (saved on add).`);y(e,t)},Se=e=>{var t=C(`No saved key for this route — paste one to test (never stored).`);y(e,t)},Ce=e=>{var t=C(`Probe this endpoint with a minimal request.`);y(e,t)};h(ye,e=>{E(P)?.outcome===`ok`?e(be):E(P)?.outcome===`failed`?e(xe,1):E(p)?e(Z,2):r.apiKeyConfigured?e(Ce,-1):e(Se,3)}),n(ve);var we=z(ve,2),Te=W(we),Ee=e=>{zn(e,{type:`password`,class:`h-6 w-44 font-mono text-[10px]`,"aria-label":`API key (test only)`,placeholder:`API key (test only)`,autocomplete:`off`,get disabled(){return u()},get value(){return E(ne)},set value(e){F(ne,e,!0)}})};h(Te,e=>{!r.apiKeyConfigured&&!E(p)&&e(Ee)});var De=z(Te,2);{let e=I(()=>E(p)?`Send a minimal probe with the route key above (saved on add)`:r.apiKeyConfigured?`Send a minimal probe request`:`Send a minimal probe with the pasted key (not saved)`);An(De,{size:`sm`,variant:`outline`,class:`h-6 shrink-0 px-2 text-[10px]`,get disabled(){return E(G)},get title(){return E(e)},onclick:()=>void ge(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(N)?`Testing…`:`Test connection`)),y(e,n)},$$slots:{default:!0}})}n(we),n(_e),H((e,t)=>{B(d,`id`,g),Y(J,1,`rounded border px-1.5 py-0.5 text-[10px] transition-colors ${e??``}`),B(J,`aria-pressed`,t),J.disabled=u(),Y(ve,1,`min-w-0 truncate text-[10px] ${E(P)?.outcome===`ok`?`text-primary`:E(P)?.outcome===`failed`?`text-destructive`:`text-muted-foreground`}`)},[()=>E(he).has(`image`)?`border-primary bg-primary text-primary-foreground`:`border-border bg-background text-muted-foreground hover:bg-muted`,()=>E(he).has(`image`)]),l(`click`,J,()=>X(`image`)),y(e,i)};h(je,e=>{E(re)&&e(Me)}),n(_e),H(()=>{B(_e,`aria-label`,`Model ${r.model.id??``}`),B(Z,`title`,r.model.id),c(Se,E(le)),B(Ee,`aria-label`,`Test connection for ${(r.model.id||`new model`)??``}`),B(Ee,`title`,E(p)?`Send a minimal probe with the route key (saved on add)`:r.apiKeyConfigured?`Send a minimal probe request`:`Expand and paste a key to test (not saved)`),Ee.disabled=E(G),B(De,`aria-label`,`Edit model ${(r.model.id||`new model`)??``}`),B(De,`title`,E(re)?`Collapse model form`:`Edit model fields`),De.disabled=u(),B(Oe,`aria-label`,`Remove model ${r.model.id??``}`),Oe.disabled=u()}),l(`click`,Ee,()=>void ge()),l(`click`,De,()=>F(re,!E(re))),l(`click`,Oe,()=>r.onremove()),y(e,_e),x()}T([`click`]);var lB=/^(.*)-(\d+)$/;function uB(e,t){let n=new Set(t.map(e=>e.provider));if(!n.has(e))return e;let r=1;for(let t of n){if(t===e)continue;let n=lB.exec(t);if(n===null||n[1]!==e)continue;let i=Number(n[2]);Number.isInteger(i)&&i>r&&(r=i)}return`${e}-${r+1}`}function dB(e){let t=lB.exec(e);if(t===null)return null;let n=Number(t[2]);return!Number.isInteger(n)||n<2?null:{base:t[1],n}}function fB(e,t){let n=dB(e.provider);if(n!==null){let e=t?.providers.find(e=>e.provider===n.base);if(e)return`${e.label} (${n.n-1})`}return t?.providers.find(t=>t.provider===e.provider)?.label??e.provider}var pB=`skill-creator.providerPresets.v1`,mB=ut({provider:dt().min(1),label:dt().min(1),api:dt().min(1).optional(),baseURL:dt().min(1),models:ct(dt().min(1)).min(1),icon:dt().min(1).optional(),iconLetter:dt().min(1).max(2).optional(),iconColor:dt().min(1).optional(),iconSuppressed:Ot().optional()}),hB=J({list:[]});function gB(){if(typeof localStorage>`u`)return[];let e=null;try{e=localStorage.getItem(pB)}catch{return[]}if(e===null)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=mB.safeParse(e);t.success&&n.push(t.data)}return n}function _B(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(pB,JSON.stringify(e))}catch{}}function vB(){return hB.list=gB(),hB.list}function yB(e){let t=hB.list.filter(t=>t.provider!==e);hB.list=t,_B(t)}var bB=r(`<p class="text-xs text-destructive" role="alert"> </p>`),xB=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),SB=r(`<p class="py-3 text-center text-[10px] text-muted-foreground"> </p>`),CB=r(`<img alt="" class="h-7 w-7 shrink-0 rounded-md bg-background object-contain p-0.5 dark:invert"/>`),wB=r(`<span class="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[11px] font-semibold text-white" aria-hidden="true"> </span>`),TB=r(`<div class="group relative"><button type="button" class="flex w-full items-center gap-2 rounded-md border border-border p-2 text-left transition-colors hover:border-primary/50 hover:bg-primary/5"><!> <span class="min-w-0 flex-1"><span class="block truncate text-xs font-medium"> </span> <span class="block truncate text-[10px] text-muted-foreground"> </span></span> <span class="mr-0.5 shrink-0 rounded bg-muted px-1 text-[9px] text-muted-foreground"> </span></button> <button type="button" class="absolute right-1 top-1 hidden rounded bg-popover/80 p-0.5 text-muted-foreground hover:text-destructive group-hover:block">×</button></div>`),EB=r(`<div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground">Your presets</span> <div class="grid grid-cols-1 gap-1.5 min-[520px]:grid-cols-2"></div></div>`),DB=r(`<span class="rounded bg-primary/10 px-1 text-[9px] text-primary"> </span>`),OB=r(`<button type="button" class="flex w-full items-center gap-2 rounded-md border border-border p-2 text-left transition-colors hover:border-primary/50 hover:bg-primary/5"><!> <span class="min-w-0 flex-1"><span class="block truncate text-xs font-medium"> </span> <span class="block truncate text-[10px] text-muted-foreground"> </span></span> <span class="mr-0.5 flex shrink-0 items-center gap-1"><!> <span class="rounded bg-muted px-1 text-[9px] text-muted-foreground"> </span></span></button>`),kB=r(`<p class="col-span-full py-3 text-center text-[10px] text-muted-foreground"> </p>`),AB=r(`<div class="max-h-[52vh] space-y-2 overflow-y-auto pr-1"><!> <div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground"> </span> <div class="grid grid-cols-1 gap-1.5 min-[520px]:grid-cols-2"><!> <!></div></div></div>`),jB=r(`<div class="space-y-2"><div class="flex items-center gap-2"><!> <!> <!></div> <!> <!></div>`),MB=r(`<p class="text-[10px] text-amber-700" role="alert"> </p>`),NB=r(`<p class="text-[10px] text-amber-700" role="alert">Custom route needs a name.</p>`),PB=r(`<p class="text-[10px] text-amber-700" role="alert">Custom route needs an http(s) base URL.</p>`),FB=r(`<option> </option>`),IB=r(`<p class="rounded-md border border-dashed p-2 text-center text-[10px] text-muted-foreground">No models yet — add one to enable the route.</p>`),LB=r(`<div class="space-y-3"><div class="flex items-center gap-2"><!> <label class="min-w-0 flex-1 space-y-0.5"><span class="text-[10px] text-muted-foreground">Route name</span> <!></label></div> <!> <label class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">Base URL</span> <!></label> <!> <label class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">API protocol</span> <select class="h-8 w-full rounded-md border border-border bg-background px-2 text-xs" aria-label="API protocol"></select></label> <div class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">API key</span> <div class="relative"><!> <button type="button" class="absolute right-1.5 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-2.5 after:content-[''] hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button></div></div> <div class="space-y-1.5"><div class="flex items-center justify-between"><span class="text-[10px] font-medium text-muted-foreground">Models</span> <!></div> <!> <div class="space-y-1.5"></div></div> <!> <div class="flex items-center justify-between border-t border-border pt-2"><!> <!></div></div>`);function RB(e,r){i(r,!0);let a=k(r,`seed`,3,null),o=`anthropic-messages`,s=V(J(r.initialMode)),u=V(``),d=V(J(a()?.provider??``)),f=V(void 0),p=V(void 0),m=V(void 0),g=V(void 0),_=V(``),v=V(``),b=V(!1),S=I(()=>E(v).trim()),w=V(o),T=V(J(a()?.models?a().models.map(e=>ge(e)):[])),O=V(J(a()?.models?a().models.map(()=>!0):[])),A=V(!1),ee=V(!1),te=V(null),N=I(()=>Q.view),P=I(()=>E(N)?.settings.modelRoutes??[]),L=I(()=>(r.catalog?.providers??[]).flatMap(e=>e.icon?[{provider:e.provider,icon:e.icon}]:[])),ne=I(()=>E(d).trim()),re=I(()=>Jz(r.catalog,dB(E(ne))?.base??E(ne))),R=I(()=>fB({provider:E(ne)},r.catalog)),ae=I(()=>FL({provider:E(ne),iconLetter:E(m)},E(R))),se=I(()=>E(p)??jL(E(ne)||`route`)),ce=I(()=>{if(E(g)===!0)return null;if(E(f)!==void 0)return E(f);let e=dB(E(ne))?.base??E(ne);return r.catalog?.providers.find(t=>t.provider===e)?.icon??null}),U=I(()=>[...E(P).flatMap(e=>e.models),...E(T)]),le=I(()=>E(ne).length>0&&E(P).some(e=>e.provider===E(ne))),G=I(()=>/^https?:\/\//.test(E(_).trim())),ue=I(()=>E(O).length===E(T).length&&E(O).every(e=>e)),K=I(()=>E(ne).length>0&&!E(le)&&E(G)&&E(T).length>0&&E(ue)&&!Q.updating),pe=I(()=>E(N)?.providers.some(e=>e.provider===E(ne)&&e.configured)??!1),me=I(()=>{let e=E(u).trim().toLowerCase(),t=r.catalog?.providers??[];return e.length===0?t:t.filter(t=>t.label.toLowerCase().includes(e)||t.provider.toLowerCase().includes(e)||t.baseURL.toLowerCase().includes(e))}),Y=I(()=>{let e=E(u).trim().toLowerCase();return e.length===0?hB.list:hB.list.filter(t=>t.label.toLowerCase().includes(e)||t.provider.toLowerCase().includes(e)||t.baseURL.toLowerCase().includes(e))});function he(e){return E(P).filter(t=>t.provider===e||dB(t.provider)?.base===e).length}function ge(e){let t=dB(a()?.provider??``)?.base??a()?.provider??``,n=r.catalog?.providers.find(e=>e.provider===t)?.models.find(t=>t.id===e);return n===void 0?{id:e,efforts:[...Xz]}:$z(n)}vB(),de(()=>{E(s)});function _e(){F(d,``),F(f,void 0),F(p,void 0),F(m,void 0),F(g,void 0),F(_,``),F(w,o),F(T,[],!0),F(O,[],!0),F(s,`form`),F(A,!1),F(ee,!1),F(te,null)}async function ve(e){let t=await xe({modelRoutes:[...E(P),e]});if(t){if(t.outcome===`rejected`){F(te,`${t.code}: ${t.detail}`);return}if(t.outcome===`error`){F(te,t.message,!0);return}r.onadded(e.provider)}}async function ye(e){Q.updating||await ve({provider:uB(e.provider,E(P)),baseURL:e.baseURL,api:e.api,models:[...e.models].sort((e,t)=>Number(t.image)-Number(e.image)).slice(0,4).map(e=>$z(e)),...e.icon?{icon:e.icon}:{}})}async function be(e){Q.updating||await ve({provider:uB(e.provider,E(P)),baseURL:e.baseURL,api:e.api??o,models:e.models.map(e=>({id:e,efforts:[...Xz]})),...e.icon?{icon:e.icon}:{},...e.iconColor?{iconColor:e.iconColor}:{},...e.iconLetter?{iconLetter:e.iconLetter}:{},...e.iconSuppressed?{iconSuppressed:!0}:{}})}function Z(e,t){F(T,E(T).map((n,r)=>r===e?t:n),!0)}function Se(e,t){E(O)[e]!==t&&F(O,E(O).map((n,r)=>r===e?t:n),!0)}function Ce(e){F(T,E(T).filter((t,n)=>n!==e),!0),F(O,E(O).filter((t,n)=>n!==e),!0)}function we(){F(T,[...E(T),{id:``,efforts:[...Xz]}],!0),F(O,[...E(O),!1],!0)}async function Te(){if(E(K)){if(E(S).length>0){let e=await je(E(ne),E(S));if(e==null||e.outcome===`rejected`){F(te,e==null?`Could not save the API key — connection unavailable. The route was not created.`:`${e.code}: ${e.detail}`,!0);return}}await ve({provider:E(ne),baseURL:E(_).trim(),api:E(w),models:E(T).map(e=>({...e})),...E(f)?{icon:E(f)}:{},...E(p)?{iconColor:E(p)}:{},...E(m)?{iconLetter:E(m)}:{},...E(g)?{iconSuppressed:!0}:{}})}}var Ee=X(),De=q(Ee),Oe=e=>{var i=jB(),a=W(i),o=W(a);zn(o,{class:`h-8 flex-1 text-xs`,"aria-label":`Search providers`,placeholder:`Search providers…`,ref:null,get value(){return E(u)},set value(e){F(u,e,!0)}});var s=z(o,2),d=e=>{An(e,{size:`sm`,variant:`ghost`,class:`h-8 shrink-0 px-2 text-[11px]`,onclick:()=>r.onclose?.(),children:(e,t)=>{oe();var n=C(`Cancel`);y(e,n)},$$slots:{default:!0}})};h(s,e=>{E(P).length===0&&r.onclose&&e(d)});var f=z(s,2);An(f,{size:`sm`,variant:`ghost`,class:`h-8 shrink-0 px-2 text-[11px]`,onclick:_e,children:(e,t)=>{oe();var n=C(`Start from scratch →`);y(e,n)},$$slots:{default:!0}}),n(a);var p=z(a,2),m=e=>{var t=bB(),n=M(t,!0);H(()=>c(n,E(te))),y(e,t)};h(p,e=>{E(te)&&e(m)});var g=z(p,2),_=e=>{var t=xB(),n=M(t,!0);H(()=>c(n,r.catalogError)),y(e,t)},v=e=>{var t=SB(),n=M(t,!0);H(()=>c(n,r.catalogLoading?`Loading catalog…`:`Catalog unavailable.`)),y(e,t)},b=e=>{var i=AB(),a=W(i),o=e=>{var r=EB(),i=z(W(r),2);t(i,21,()=>E(Y),e=>e.provider,(e,t)=>{var r=TB(),i=W(r),a=W(i),o=e=>{var n=CB();H(()=>B(n,`src`,E(t).icon)),y(e,n)},s=e=>{var n=wB(),r=M(n,!0);H((e,t)=>{j(n,`background: ${e??``}`),c(r,t)},[()=>E(t).iconColor??jL(E(t).provider),()=>FL({provider:E(t).provider,iconLetter:E(t).iconLetter},E(t).label)]),y(e,n)};h(a,e=>{E(t).icon?e(o):e(s,-1)});var u=z(a,2),d=W(u),f=M(d,!0),p=z(d,2),m=M(p,!0);n(u);var g=z(u,2),_=M(g,!0);n(i);var v=z(i,2);n(r),H(e=>{B(i,`title`,E(t).baseURL),i.disabled=Q.updating,c(f,E(t).label),c(m,e),B(g,`title`,`${E(t).models.length??``} saved models`),c(_,E(t).models.length),B(v,`aria-label`,`Delete preset ${E(t).label??``}`)},[()=>E(t).baseURL.replace(/^https?:\/\//,``)]),l(`click`,i,()=>void be(E(t))),l(`click`,v,()=>yB(E(t).provider)),y(e,r)}),n(i),n(r),y(e,r)};h(a,e=>{E(Y).length>0&&e(o)});var s=z(a,2),d=W(s),f=M(d),p=z(d,2),m=W(p);t(m,17,()=>E(me),e=>e.provider,(e,t)=>{let r=I(()=>he(E(t).provider)),i=I(()=>E(r)>0?`${E(t).baseURL} · ${E(t).api} · ${E(r)} copies added — click to add another`:`${E(t).baseURL} · ${E(t).api}`);var a=OB(),o=W(a),s=e=>{var n=CB();H(()=>B(n,`src`,E(t).icon)),y(e,n)},u=e=>{var n=wB(),r=M(n,!0);H((e,t)=>{j(n,`background: ${e??``}`),c(r,t)},[()=>jL(E(t).provider),()=>E(t).label.slice(0,1).toUpperCase()]),y(e,n)};h(o,e=>{E(t).icon?e(s):e(u,-1)});var d=z(o,2),f=W(d),p=M(f,!0),m=z(f,2),g=M(m,!0);n(d);var _=z(d,2),v=W(_),b=e=>{var t=DB(),n=M(t);H(()=>{B(t,`title`,`${E(r)??``} cop${E(r)===1?`y`:`ies`} of this provider already added — you can add another`),c(n,`Added ✓${E(r)>1?` ×${E(r)}`:``}`)}),y(e,t)};h(v,e=>{E(r)>0&&e(b)});var x=z(v,2),S=M(x,!0);n(_),n(a),H(e=>{B(a,`title`,E(i)),a.disabled=Q.updating,c(p,E(t).label),c(g,e),B(x,`title`,`${E(t).models.length??``} models in catalog`),c(S,E(t).models.length)},[()=>E(t).baseURL.replace(/^https?:\/\//,``)]),l(`click`,a,()=>void ye(E(t))),y(e,a)});var g=z(m,2),_=e=>{var t=kB(),n=M(t);H(()=>c(n,`No providers match “${E(u)??``}”.`)),y(e,t)};h(g,e=>{E(me).length===0&&e(_)}),n(p),n(s),n(i),H(()=>c(f,`Catalog (${r.catalog.providers.length??``} providers, from models.dev)`)),y(e,i)};h(g,e=>{r.catalogError?e(_):r.catalog===null?e(v,1):e(b,-1)}),n(i),y(e,i)},ke=e=>{var r=LB(),i=W(r),a=W(i);{let e=I(()=>E(ne)||`route`);Iz(a,{get icon(){return E(ce)},get letter(){return E(ae)},get color(){return E(se)},get provider(){return E(e)},get label(){return E(R)},get catalogIcons(){return E(L)},get disabled(){return Q.updating},onPick:e=>{F(f,e,!0),F(g,void 0)},onSuppress:()=>F(g,!0),onColor:e=>F(p,e,!0),onLetter:e=>F(m,e,!0)})}var o=z(a,2),u=z(W(o),2);zn(u,{class:`h-8 text-xs`,"aria-label":`Route name`,placeholder:`my-provider`,get disabled(){return Q.updating},onblur:()=>F(ee,!0),get value(){return E(d)},set value(e){F(d,e,!0)}}),n(o),n(i);var x=z(i,2),O=e=>{var t=MB(),n=M(t);H(()=>c(n,`Route “${E(ne)??``}” already exists.`)),y(e,t)},k=e=>{var t=NB();y(e,t)};h(x,e=>{E(le)?e(O):E(ee)&&E(ne).length===0&&e(k,1)});var j=z(x,2),N=z(W(j),2);zn(N,{class:`h-8 font-mono text-xs`,"aria-label":`Base URL`,placeholder:`https://api.example.com/v1`,get disabled(){return Q.updating},onblur:()=>F(A,!0),get value(){return E(_)},set value(e){F(_,e,!0)}}),n(j);var P=z(j,2),V=e=>{var t=PB();y(e,t)};h(P,e=>{E(A)&&!E(G)&&e(V)});var ue=z(P,2),de=z(W(ue),2);t(de,20,()=>Ct,e=>e,(e,t)=>{var n=FB(),r=M(n,!0),i={};H(()=>{c(r,t),i!==(i=t)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(de),fe(de),n(ue);var q=z(ue,2),J=z(W(q),2),me=W(J);{let e=I(()=>E(b)?`text`:`password`),t=I(()=>E(pe)?`stored — this key overrides for add & test`:`API key`);zn(me,{class:`h-8 pr-9 text-xs`,get type(){return E(e)},autocomplete:`off`,"aria-label":`API key`,get placeholder(){return E(t)},get disabled(){return Q.updating},get value(){return E(v)},set value(e){F(v,e,!0)}})}var Y=z(me,2),he=W(Y),X=e=>{vz(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})},ge=e=>{Jn(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})};h(he,e=>{E(b)?e(X):e(ge,-1)}),n(Y),n(J),n(q);var _e=z(q,2),ve=W(_e),ye=z(W(ve),2);An(ye,{size:`sm`,variant:`ghost`,class:`h-6 px-2 text-[11px]`,get disabled(){return Q.updating},onclick:we,children:(e,t)=>{oe();var n=C(`+ Add model`);y(e,n)},$$slots:{default:!0}}),n(ve);var be=z(ve,2),xe=e=>{var t=IB();y(e,t)};h(be,e=>{E(T).length===0&&e(xe)});var Ee=z(be,2);t(Ee,21,()=>E(T),ie,(e,t,n)=>{{let r=I(()=>E(_).trim()),i=I(()=>E(t).id===``);cB(e,{get model(){return E(t)},get candidates(){return E(re)},get routeModels(){return E(U)},get api(){return E(w)},get baseURL(){return E(r)},get provider(){return E(ne)},get apiKeyConfigured(){return E(pe)},get formKey(){return E(S)},get disabled(){return Q.updating},get initialExpanded(){return E(i)},onchange:e=>Z(n,e),onremove:()=>Ce(n),onvalidity:e=>Se(n,e)})}}),n(Ee),n(_e);var De=z(_e,2),Oe=e=>{var t=bB(),n=M(t,!0);H(()=>c(n,E(te))),y(e,t)};h(De,e=>{E(te)&&e(Oe)});var ke=z(De,2),Ae=W(ke);An(Ae,{size:`sm`,variant:`ghost`,class:`h-7 px-2 text-xs`,onclick:()=>F(s,`pick`),children:(e,t)=>{oe();var n=C(`Back`);y(e,n)},$$slots:{default:!0}});var je=z(Ae,2);{let e=I(()=>!E(K));An(je,{size:`sm`,class:`h-7 px-2.5 text-xs`,get disabled(){return E(e)},onclick:()=>void Te(),children:(e,t)=>{oe();var n=C(`Create route`);y(e,n)},$$slots:{default:!0}})}n(ke),n(r),H(()=>{de.disabled=Q.updating,B(Y,`aria-label`,E(b)?`Hide API key`:`Show API key`),B(Y,`aria-pressed`,E(b)),B(Y,`title`,E(b)?`Hide API key`:`Show API key`),Y.disabled=Q.updating}),D(de,()=>E(w),e=>F(w,e)),l(`mousedown`,Y,e=>e.preventDefault()),l(`click`,Y,()=>F(b,!E(b))),y(e,r)};h(De,e=>{E(s)===`pick`?e(Oe):e(ke,-1)}),y(e,Ee),x()}T([`click`,`mousedown`]);var zB=r(`<option> </option>`),BB=r(`<p class="text-[11px] font-medium text-primary"> </p>`),VB=r(`<span class="text-[10px] text-amber-700">A route needs at least one model id.</span>`),HB=r(`<div><!></div>`),UB=r(`<p class="text-xs text-destructive" role="alert"> </p>`),WB=r(`<div class="space-y-3"><div class="flex items-start gap-2"><!> <div class="flex min-w-0 flex-1 items-center justify-between gap-2.5" data-route-titlebar="true"><div class="min-w-0"><p class="truncate text-sm font-semibold"> </p> <p class="mt-0.5 truncate text-[10px] text-muted-foreground"> </p></div> <div class="flex shrink-0 items-center gap-2.5"><button type="button" class="relative flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors after:absolute after:-inset-2 after:content-[''] hover:bg-destructive/10 hover:text-destructive disabled:pointer-events-none disabled:opacity-50" aria-label="Remove route" title="Remove route"><!></button> <!></div></div></div> <section class="space-y-1.5 rounded-md border border-border p-2" aria-label="Endpoint"><span class="text-[11px] font-medium text-muted-foreground">Endpoint</span> <div class="flex gap-1.5"><!></div> <label class="block space-y-0.5"><span class="text-[10px] text-muted-foreground">API protocol</span> <select class="h-8 w-full rounded-md border border-border bg-background px-2 text-xs" aria-label="API protocol"></select></label></section> <section class="space-y-1.5 rounded-md border border-border p-2" aria-label="Credential"><!> <div class="flex gap-1.5"><div class="relative min-w-0 flex-1"><!> <button type="button" class="absolute right-1.5 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded text-muted-foreground transition-colors after:absolute after:-inset-2.5 after:content-[''] hover:text-foreground disabled:pointer-events-none disabled:opacity-50"><!></button></div> <!></div> <span class="text-[10px] text-muted-foreground">Stored locally (0600), shown as typed (password-masked), applies on blur/Enter.</span></section> <section class="space-y-1.5" aria-label="Models"><div class="flex items-center justify-between"><span class="text-[11px] font-medium text-muted-foreground">Models</span> <div class="flex items-center gap-1.5"><!> <!></div></div> <div class="space-y-1.5"></div></section> <!></div>`);function GB(e,r){i(r,!0);let a=k(r,`autoFocusCredential`,3,!1),o=`anthropic-messages`,s=I(()=>Q.view),u=I(()=>E(s)?.settings.modelRoutes??[]),d=I(()=>E(u).flatMap(e=>e.models.map(e=>({id:e.id,efforts:e.efforts})))),f=I(()=>r.catalog?.providers.find(e=>e.provider===r.route.provider)),p=I(()=>(r.catalog?.providers??[]).flatMap(e=>e.icon?[{provider:e.provider,icon:e.icon}]:[])),m=I(()=>Jz(r.catalog,dB(r.route.provider)?.base??r.route.provider)),g=I(()=>PL(r.route,E(f))),_=I(()=>fB(r.route,r.catalog)),b=I(()=>FL(r.route,E(_))),S=I(()=>IL(r.route)),w=I(()=>E(s)?.providers.some(e=>e.provider===r.route.provider&&e.configured)??!1),T=V(J(r.route.baseURL)),O=V(J(r.route.api??E(f)?.api??o)),A=V(J(r.route.models.map(e=>({...e})))),j=V(J(r.route.models.map(()=>!0))),ee=I(()=>E(s)?.providers.find(e=>e.provider===r.route.provider)?.apiKey??null),te=V(J(E(ee)??``)),N=V(!1),P=V(J(a())),L=V(null),ne=V(null),re=V(!1),R=null,ae=[],ce=I(()=>E(T).trim()!==r.route.baseURL||E(O)!==(r.route.api??E(f)?.api??o)),U=I(()=>JSON.stringify(E(A))!==JSON.stringify(r.route.models)),le=I(()=>E(j).every(e=>e)),G=I(()=>!(E(ce)||E(U))||!E(le)||E(A).length===0||Q.updating);de(()=>{a()&&E(L)!==null&&(E(L).focus(),r.onCredentialFocused?.())}),de(()=>()=>{R!==null&&clearTimeout(R)});async function ue(e){if(E(s)===null)return!1;let t=await xe({modelRoutes:E(u).map(t=>t.provider===r.route.provider?e:t)});return t?t.outcome===`rejected`?(F(ne,`${t.code}: ${t.detail}`),!1):t.outcome===`error`?(F(ne,t.message,!0),!1):(F(ne,null),!0):!1}async function K(e){await ue({...r.route,...e})}async function q(){let e=E(T).trim();if(!/^https?:\/\//.test(e)){F(ne,`Custom route needs an http(s) base URL.`);return}await ue({...r.route,baseURL:e,api:E(O),models:E(A).map(e=>({...e}))})&&(F(re,!0),R!==null&&clearTimeout(R),R=setTimeout(()=>F(re,!1),1500))}function pe(e,t){F(A,E(A).map((n,r)=>r===e?t:n),!0)}function me(e,t){E(j)[e]!==t&&F(j,E(j).map((n,r)=>r===e?t:n),!0)}function Y(e){F(A,E(A).filter((t,n)=>n!==e),!0),F(j,E(j).filter((t,n)=>n!==e),!0)}function he(e){let t=E(A)[e],n=r.route.models[e];return t===void 0||n===void 0||JSON.stringify(t)!==JSON.stringify(n)}async function X(){F(A,[...E(A),{id:``,efforts:[...Xz]}],!0),F(j,[...E(j),!1],!0),await v(),ae[ae.length-1]?.scrollIntoView({block:`nearest`,behavior:`smooth`})}async function ge(){let e=E(te).trim();if(e.length===0)return;let t=await je(r.route.provider,e);if(t){if(t.outcome===`rejected`){F(ne,`${t.code}: ${t.detail}`);return}F(ne,null),F(P,!1)}}async function _e(){await Ye(r.route.provider),F(te,``)}var ve=WB(),ye=W(ve),be=W(ye);Iz(be,{get icon(){return E(g)},get letter(){return E(b)},get color(){return E(S)},get provider(){return r.route.provider},get label(){return E(_)},get catalogIcons(){return E(p)},get disabled(){return Q.updating},onPick:e=>void K({icon:e,iconSuppressed:!1}),onSuppress:()=>void K({icon:void 0,iconSuppressed:!0}),onColor:e=>void K({iconColor:e}),onLetter:e=>void K({iconLetter:e})});var Z=z(be,2),Se=W(Z),Ce=W(Se),we=M(Ce,!0),Te=z(Ce,2),Ee=M(Te);n(Se);var De=z(Se,2),Oe=W(De),ke=W(Oe);Cn(ke,{class:`h-4 w-4`,"aria-hidden":`true`}),n(Oe);var Ae=z(Oe,2);An(Ae,{size:`sm`,class:`relative h-9 px-3 text-xs after:absolute after:-top-1 after:-bottom-1 after:left-0 after:right-0 after:content-['']`,"data-route-save":`true`,get disabled(){return E(G)},onclick:()=>void q(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(re)?`Saved ✓`:`Save`)),y(e,n)},$$slots:{default:!0}}),n(De),n(Z),n(ye);var Me=z(ye,2),Ne=z(W(Me),2),Pe=W(Ne);zn(Pe,{class:`h-8 flex-1 font-mono text-xs`,"aria-label":`Base URL`,placeholder:`https://api.example.com/v1`,get disabled(){return Q.updating},get value(){return E(T)},set value(e){F(T,e,!0)}}),n(Ne);var Fe=z(Ne,2),Ie=z(W(Fe),2);t(Ie,20,()=>Ct,e=>e,(e,t)=>{var n=zB(),r=M(n,!0),i={};H(()=>{c(r,t),i!==(i=t)&&(n.value=(n.__value=i)??``)}),y(e,n)}),n(Ie),fe(Ie),n(Fe),n(Me);var Le=z(Me,2),Re=W(Le),ze=e=>{var t=BB(),n=M(t);H(()=>c(n,`Route “${r.route.provider??``}” added — paste its API key to finish connecting.`)),y(e,t)};h(Re,e=>{E(P)&&e(ze)});var Be=z(Re,2),Ve=W(Be),He=W(Ve);{let e=I(()=>E(N)?`text`:`password`);zn(He,{class:`h-8 pr-9 font-mono text-xs`,get type(){return E(e)},autocomplete:`off`,"aria-label":`API key`,placeholder:`API key`,get disabled(){return Q.updating},onblur:()=>void ge(),onkeydown:e=>{e.key===`Enter`&&(e.preventDefault(),ge())},get ref(){return E(L)},set ref(e){F(L,e,!0)},get value(){return E(te)},set value(e){F(te,e,!0)}})}var Ue=z(He,2),We=W(Ue),Ge=e=>{vz(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})},Ke=e=>{Jn(e,{class:`h-3.5 w-3.5`,"aria-hidden":`true`})};h(We,e=>{E(N)?e(Ge):e(Ke,-1)}),n(Ue),n(Ve);var qe=z(Ve,2),Je=e=>{An(e,{size:`sm`,variant:`outline`,class:`relative h-9 px-2.5 text-xs after:absolute after:-top-1 after:-bottom-1 after:left-0 after:right-0 after:content-['']`,get disabled(){return Q.updating},onclick:()=>void _e(),children:(e,t)=>{oe();var n=C(`Clear`);y(e,n)},$$slots:{default:!0}})};h(qe,e=>{E(w)&&e(Je)}),n(Be),oe(2),n(Le);var Xe=z(Le,2),Ze=W(Xe),Qe=z(W(Ze),2),$e=W(Qe),et=e=>{var t=VB();y(e,t)};h($e,e=>{E(A).length===0&&e(et)});var tt=z($e,2);An(tt,{size:`sm`,variant:`ghost`,class:`h-6 px-2 text-[11px]`,get disabled(){return Q.updating},onclick:()=>void X(),children:(e,t)=>{oe();var n=C(`+ Add model`);y(e,n)},$$slots:{default:!0}}),n(Qe),n(Ze);var nt=z(Ze,2);t(nt,21,()=>E(A),ie,(e,t,i)=>{var a=HB(),o=W(a);{let e=I(()=>E(T).trim()),n=I(()=>he(i)),a=I(()=>E(t).id===``);cB(o,{get model(){return E(t)},get candidates(){return E(m)},get routeModels(){return E(d)},get api(){return E(O)},get baseURL(){return E(e)},get provider(){return r.route.provider},get apiKeyConfigured(){return E(w)},get disabled(){return Q.updating},get dirty(){return E(n)},get initialExpanded(){return E(a)},onchange:e=>pe(i,e),onremove:()=>Y(i),onvalidity:e=>me(i,e)})}n(a),se(a,(e,t)=>ae[t]=e,e=>ae?.[e],()=>[i]),y(e,a)}),n(nt),n(Xe);var rt=z(Xe,2),it=e=>{var t=UB(),n=M(t,!0);H(()=>c(n,E(ne))),y(e,t)};h(rt,e=>{E(ne)&&e(it)}),n(ve),H(e=>{B(Ce,`title`,`${E(_)??``} (${r.route.provider??``}) — route name keys the credential mapping; duplicate this route to rename it.`),c(we,E(_)),B(Te,`title`,r.route.baseURL),c(Ee,`${r.route.provider??``} · ${e??``} · ${r.route.models.length??``}
|
|
227
|
-
${r.route.models.length===1?`model`:`models`}`),Oe.disabled=Q.updating,Ie.disabled=Q.updating,B(Ue,`aria-label`,E(N)?`Hide API key`:`Show API key`),B(Ue,`aria-pressed`,E(N)),B(Ue,`title`,E(N)?`Hide API key`:`Show API key`),Ue.disabled=Q.updating},[()=>r.route.baseURL.replace(/^https?:\/\//,``)]),l(`click`,Oe,()=>r.onremove?.()),D(Ie,()=>E(O),e=>F(O,e)),l(`mousedown`,Ue,e=>e.preventDefault()),l(`click`,Ue,()=>F(N,!E(N))),y(e,ve),x()}T([`click`,`mousedown`]);var KB=r(`<button type="button" class="mt-0.5 shrink-0 rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] text-amber-700 transition-colors hover:bg-amber-500/25">active outside tabs</button>`),qB=r(`<p class="text-[10px] text-amber-700"> </p>`),JB=r(`<span class="absolute -right-1 -top-0.5 h-1 w-1 rounded-full bg-amber-500" title="API key missing"></span>`),YB=r(`<span class="relative inline-flex shrink-0"><span class="flex h-4 w-4 items-center justify-center rounded" aria-hidden="true"><img alt=""/></span> <!></span>`),XB=r(`<span class="relative inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-[8px] font-semibold text-white" aria-hidden="true"> <!></span>`),ZB=r(`<span class="rounded bg-primary/10 px-1 py-px text-[9px] font-medium leading-tight text-primary" title="Active model's route">active</span>`),QB=r(`<button type="button" role="tab"><!> <span class="max-w-[120px] truncate"> </span> <!></button>`),$B=r(`<span class="pointer-events-none absolute inset-y-0 left-0 w-2 bg-gradient-to-r from-background to-transparent" aria-hidden="true"></span>`),eV=r(`<span class="pointer-events-none absolute inset-y-0 right-0 w-2 bg-gradient-to-l from-background to-transparent" aria-hidden="true"></span>`),tV=r(`<div class="flex flex-col items-center gap-2.5 rounded-md border border-dashed p-6 text-center"><p class="text-xs font-medium">Add your first model route</p> <p class="max-w-[320px] text-[10px] leading-snug text-muted-foreground">Pick a provider from the catalog (models.dev mirror) with its models, or point at any
|
|
228
|
-
custom OpenAI/Anthropic-compatible endpoint.</p> <div class="mt-1 flex gap-2"><!> <!></div></div>`),nV=r(`<div class="flex items-stretch gap-1 border-b border-border"><div class="relative min-w-0 flex-1"><div class="tab-scroll flex h-9 items-stretch overflow-x-auto svelte-1bhnjqt" role="tablist" aria-label="Model routes"></div> <!> <!></div> <button type="button">+ New</button></div> <div class="min-h-0 flex-1 overflow-y-auto pr-0.5"><!></div>`,1),rV=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),iV=r(`<div class="text-xs text-muted-foreground">Model settings unavailable</div>`),aV=r(`<div class="text-xs text-destructive" role="alert"> </div>`),oV=r(`<div class="flex h-full min-h-0 flex-col space-y-3"><div class="flex items-start justify-between gap-2"><div><h3 class="text-sm font-medium">Model</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Changes apply immediately to your agent sessions — no restart needed.</p></div> <!></div> <!> <!> <!> <!></div> <!>`,1);function sV(e,r){i(r,!0);let a=V(null),o=V(!1),s=V(`pick`),u=V(null),d=V(0),m=V(null),g=V(null),_=V(!1),b=V(!1),S=V(null),w=V(null),T=V(null),D=V(!1),O=Et(mt),k=I(()=>Q.view),A=I(()=>E(k)?.settings.modelRoutes??[]),ee=I(()=>E(A).find(e=>e.provider===E(a))),te=I(()=>E(k)!==null&&!E(A).some(e=>e.provider===E(k).settings.model.provider));de(()=>{E(o)||(E(a)!==null&&!E(A).some(e=>e.provider===E(a))&&F(a,null),E(a)===null&&E(A).length>0&&F(a,E(A)[0].provider,!0))}),de(()=>{E(w)===null&&E(T)===null&&!E(D)&&N()});async function N(){let e=O.issue();F(D,!0);try{let t=St();if(!t){F(T,`daemon not connected`);return}let n=await t.agent.models.catalog({});if(!e.isCurrent())return;F(w,n,!0),F(T,null)}catch(t){if(!e.isCurrent())return;F(T,t instanceof Error?t.message:String(t),!0)}finally{e.isCurrent()&&F(D,!1)}}async function P(e){let t=await xe(e);return t?t.outcome===`rejected`?(F(S,`${t.code}: ${t.detail}`),!1):t.outcome===`error`?(F(S,t.message,!0),!1):(F(S,null),!0):!1}function L(e,t=null){F(u,t,!0),F(s,e,!0),F(d,E(d)+1),F(o,!0),F(a,null)}async function ne(e){F(o,!1),F(a,e,!0),F(m,e,!0),await v(),le[e]?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})}function re(){E(k)&&L(`form`,{provider:E(k).settings.model.provider,models:[E(k).settings.model.model]})}function ie(e){e&&(F(g,e,!0),F(_,!0))}async function R(){let e=E(g);if(e===null)return;F(b,!0);let t=await P({modelRoutes:E(A).filter(t=>t.provider!==e)});F(b,!1),t&&(F(_,!1),F(g,null))}let ae=V(null),ce=V(!1),U=V(!1),le=J({});function G(){let e=E(ae);if(!e){F(ce,!1),F(U,!1);return}F(ce,e.scrollLeft>0),F(U,e.scrollLeft+e.clientWidth<e.scrollWidth-1)}de(()=>{let e=E(ae);if(!e)return;let t=t=>{Math.abs(t.deltaY)<=Math.abs(t.deltaX)||(e.scrollLeft+=t.deltaY,t.preventDefault())};e.addEventListener(`wheel`,t,{passive:!1});let n=new ResizeObserver(()=>G());return n.observe(e),G(),()=>{e.removeEventListener(`wheel`,t),n.disconnect()}}),de(()=>{E(A).length,E(w),G()});function ue(e,t){if(E(A).length!==0){if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let n=(t+(e.key===`ArrowLeft`?-1:1)+E(A).length)%E(A).length;le[E(A)[n].provider]?.focus()}else e.key===`Delete`&&(e.preventDefault(),ie(E(A)[t]?.provider))}}var K=oV(),fe=q(K),pe=W(fe),me=z(W(pe),2),he=e=>{var t=KB();H(()=>B(t,`title`,`The active model (${E(k).settings.model.provider??``}) rides an env-provided route with no tab — click to add it as a route.`)),l(`click`,t,re),y(e,t)};h(me,e=>{E(te)&&E(k)&&e(he)}),n(pe);var ge=z(pe,2),_e=e=>{var t=qB(),n=M(t);H(()=>c(n,`${E(k).settings.model.provider??``} · ${E(k).settings.model.model??``} (outside Routes) — env-provided; add
|
|
229
|
-
it as a route to manage it here.`)),y(e,t)};h(ge,e=>{E(te)&&E(k)&&e(_e)});var ve=z(ge,2),ye=e=>{var r=nV(),i=q(r),g=W(i),_=W(g);t(_,23,()=>E(A),e=>e.provider,(e,t,r)=>{let i=I(()=>E(w)?.providers.find(e=>e.provider===E(t).provider)),s=I(()=>PL(E(t),E(i))),u=I(()=>fB(E(t),E(w))),d=I(()=>FL(E(t),E(u))),f=I(()=>E(k).providers.some(e=>e.provider===E(t).provider&&e.configured)),p=I(()=>E(k).settings.model.provider===E(t).provider);var m=QB(),g=W(m),_=e=>{var r=YB(),i=W(r),a=M(i),o=z(i,2),c=e=>{var t=JB();y(e,t)};h(o,e=>{E(f)||e(c)}),n(r),H((e,t)=>{j(i,`background: color-mix(in srgb, ${e??``} 18%, transparent)`),B(a,`src`,E(s)),Y(a,1,`h-3.5 w-3.5 object-contain ${t??``}`)},[()=>IL(E(t)),()=>NL(E(s))?``:`dark:invert`]),y(e,r)},v=e=>{var r=XB(),i=W(r),a=z(i),o=e=>{var t=JB();y(e,t)};h(a,e=>{E(f)||e(o)}),n(r),H(e=>{j(r,`background: ${e??``}`),c(i,`${E(d)??``} `)},[()=>IL(E(t))]),y(e,r)};h(g,e=>{E(s)?e(_):e(v,-1)});var b=z(g,2),x=M(b,!0),S=z(b,2),C=e=>{var t=ZB();y(e,t)};h(S,e=>{E(p)&&e(C)}),n(m),se(m,(e,t)=>le[t.provider]=e,e=>le?.[e.provider],()=>[E(t)]),H(()=>{B(m,`aria-selected`,!E(o)&&E(a)===E(t).provider),Y(m,1,`relative flex h-9 shrink-0 items-center gap-1.5 px-2 text-xs font-medium transition-colors hover:bg-muted/50 ${!E(o)&&E(a)===E(t).provider?`text-foreground`:`text-muted-foreground hover:text-foreground`}`),B(m,`title`,`${E(u)??``} (${E(t).provider??``})${E(p)?` · active route`:``}`),c(x,E(u))}),l(`click`,m,()=>{F(a,E(t).provider,!0),F(o,!1)}),l(`keydown`,m,e=>ue(e,E(r))),y(e,m)}),n(_),se(_,e=>F(ae,e),()=>E(ae));var v=z(_,2),b=e=>{var t=$B();y(e,t)};h(v,e=>{E(ce)&&e(b)});var x=z(v,2),S=e=>{var t=eV();y(e,t)};h(x,e=>{E(U)&&e(S)}),n(g);var O=z(g,2);n(i);var te=z(i,2),N=W(te),P=e=>{var t=X(),n=q(t);p(n,()=>E(d),e=>{RB(e,{get catalog(){return E(w)},get catalogError(){return E(T)},get catalogLoading(){return E(D)},get initialMode(){return E(s)},get seed(){return E(u)},onadded:ne,onclose:()=>F(o,!1)})}),y(e,t)},re=e=>{var t=X(),n=q(t);p(n,()=>E(ee).provider,e=>{{let t=I(()=>E(m)===E(ee).provider);GB(e,{get route(){return E(ee)},get catalog(){return E(w)},get autoFocusCredential(){return E(t)},onCredentialFocused:()=>F(m,null),onremove:()=>ie(E(ee)?.provider)})}}),y(e,t)},R=e=>{var t=tV(),r=z(W(t),4),i=W(r);An(i,{size:`sm`,variant:`outline`,class:`h-8 px-3 text-xs`,onclick:()=>L(`pick`),children:(e,t)=>{oe();var n=C(`Browse providers`);y(e,n)},$$slots:{default:!0}});var a=z(i,2);An(a,{size:`sm`,class:`h-8 px-3 text-xs`,onclick:()=>L(`form`),children:(e,t)=>{oe();var n=C(`Custom endpoint`);y(e,n)},$$slots:{default:!0}}),n(r),n(t),y(e,t)};h(N,e=>{E(o)?e(P):E(ee)?e(re,1):e(R,-1)}),n(te),H(()=>Y(O,1,`h-7 shrink-0 self-center rounded px-2 text-[11px] font-medium transition-colors ${E(o)?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`}`)),f(`scroll`,_,G),l(`click`,O,()=>E(A).length===0?L(`form`):L(`pick`)),y(e,r)},be=e=>{var t=rV();y(e,t)},Z=e=>{var t=iV();y(e,t)};h(ve,e=>{E(k)?e(ye):Q.loading?e(be,1):e(Z,-1)});var Se=z(ve,2),Ce=e=>{var t=aV(),n=M(t,!0);H(()=>c(n,Q.error)),y(e,t)};h(Se,e=>{Q.error&&e(Ce)});var we=z(Se,2),Te=e=>{var t=aV(),n=M(t,!0);H(()=>c(n,E(S))),y(e,t)};h(we,e=>{E(S)&&e(Te)}),n(fe);var Ee=z(fe,2);{let e=I(()=>E(g)??``);_n(Ee,{title:`Remove route`,get description(){return`Remove the “${E(e)??``}” route? Its stored key is kept; if it held the active model, that reference is left outside Routes.`},get busy(){return E(b)},onConfirm:()=>void R(),get open(){return E(_)},set open(e){F(_,e,!0)}})}y(e,K),x()}T([`click`,`keydown`]);var cV=r(`<p class="text-[10px] text-destructive" role="alert"> </p>`),lV=r(`<p class="text-[10px] text-primary" role="status"> </p>`),uV=r(`<div class="text-xs text-muted-foreground">Loading…</div>`),dV=r(`<div class="flex items-center justify-between gap-2 text-xs text-muted-foreground"><span class="text-destructive" role="alert"> </span> <!></div>`),fV=r(`<p class="rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground">No sessions yet. Sessions you start from the agent panel are listed here and can be reviewed
|
|
230
|
-
or removed individually.</p>`),pV=r(`<span class="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground" title="Kernel/steward session without a product transcript — managed by the kernel, not deletable here">kernel-only</span>`),mV=r(`<li class="flex items-center gap-2 rounded-md border border-border bg-background/60 px-2.5 py-1.5"><span class="min-w-0 flex-1 truncate text-xs"> </span> <span class="shrink-0 text-[10px] tabular-nums text-muted-foreground"> </span> <span class="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground"> </span> <span> </span> <!> <!></li>`),hV=r(`<div class="space-y-1"><span class="text-[10px] font-medium text-muted-foreground"> </span> <ul class="space-y-1"></ul></div>`),gV=r(`<div class="text-xs text-destructive" role="alert"> </div>`),_V=r(`<div class="space-y-4"><div><h3 class="text-sm font-medium">Sessions</h3> <p class="mt-0.5 text-[11px] text-muted-foreground">Manage agent panel sessions and transcript retention.</p></div> <section class="space-y-1.5" aria-label="Cleanup policy"><span class="text-[11px] font-medium text-muted-foreground">Cleanup policy</span> <div class="flex items-end gap-1.5"><label class="flex-1 space-y-1"><span class="block text-[10px] text-muted-foreground">Delete transcripts older than (days)</span> <!></label> <!></div> <p class="text-[10px] text-muted-foreground">Sessions older than this are cleaned automatically when the daemon starts (default 30 days).
|
|
231
|
-
Kernel-side session logs are not touched.</p> <!></section> <section class="space-y-1.5" aria-label="Session list"><div class="flex items-center justify-between"><span class="text-[11px] font-medium text-muted-foreground">Session list</span> <!></div> <!> <!></section> <!></div> <!>`,1);function vV(e,r){i(r,!0);let a=V(30),o=V(!1),s=V(!1),l=V(null),u=V(null),d=V(null),f=V(!1),p=V(!1),g=V(null),_=V(!1),v=!1;de(()=>{v||(v=!0,Ie())}),de(()=>{let e=Q.view?.settings.session.sessionCleanupDays;e!==void 0&&!E(o)&&F(a,e,!0)});let b=I(()=>{let e=[...Me.sessions].sort((e,t)=>e.createdAt<t.createdAt?1:-1),t=new Map;for(let n of e){let e=S(n.createdAt),r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t.entries()]});function S(e){let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown date`:`${String(t.getFullYear()).padStart(4,`0`)}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function w(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function T(e){return _t.find(t=>t.id===e)?.label??e}function D(){let e=Number(E(a));return!Number.isInteger(e)||e<1||e>365?null:e}async function O(){let e=D();if(e===null){F(l,`Retention must be a whole number of days between 1 and 365.`);return}F(l,null),F(s,!0);try{let t=await xe({session:{sessionCleanupDays:e}});if(!t)return;t.outcome===`rejected`?F(u,`${t.code}: ${t.detail}`):t.outcome===`error`?F(u,t.message,!0):(F(u,null),F(o,!1))}finally{F(s,!1)}}async function k(){let e=D();if(e===null){F(l,`Retention must be a whole number of days between 1 and 365.`);return}F(l,null),F(f,!0),F(d,null);try{let t=await He({beforeDays:e});if(!t)return;if(`error`in t){F(u,t.error,!0);return}F(u,null),F(d,`Deleted ${t.deleted} session${t.deleted===1?``:`s`} · kept ${t.kept}`)}finally{F(f,!1)}}function A(e){F(g,e,!0),F(p,!0)}async function j(){let e=E(g);if(e){F(_,!0);try{let t=await He({sessionIds:[e.sessionId]});if(!t)return;if(`error`in t){F(u,t.error,!0);return}F(u,null),t.deleted===0&&F(u,`Session ${e.sessionId} was not removed (running or already gone).`),F(p,!1)}finally{F(_,!1)}}}var ee=_V(),te=q(ee),N=z(W(te),2),P=z(W(N),2),L=W(P),ne=z(W(L),2);zn(ne,{type:`number`,min:1,max:365,step:1,oninput:()=>F(o,!0),get disabled(){return E(s)},"aria-label":`Session retention days`,get value(){return E(a)},set value(e){F(a,e,!0)}}),n(L);var re=z(L,2);{let e=I(()=>E(s)||!E(o)||D()===null);An(re,{size:`sm`,class:`h-8 px-2.5 text-xs`,get disabled(){return E(e)},onclick:()=>void O(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(s)?`Saving…`:`Save`)),y(e,n)},$$slots:{default:!0}})}n(P);var ie=z(P,4),R=e=>{var t=cV(),n=M(t,!0);H(()=>c(n,E(l))),y(e,t)};h(ie,e=>{E(l)&&e(R)}),n(N);var ae=z(N,2),se=W(ae),ce=z(W(se),2);{let e=I(()=>E(f)||D()===null);An(ce,{size:`sm`,variant:`outline`,class:`h-7 px-2.5 text-xs`,get disabled(){return E(e)},onclick:()=>void k(),children:(e,t)=>{oe();var n=C();H(()=>c(n,E(f)?`Cleaning…`:`Clean now`)),y(e,n)},$$slots:{default:!0}})}n(se);var U=z(se,2),le=e=>{var t=lV(),n=M(t,!0);H(()=>c(n,E(d))),y(e,t)};h(U,e=>{E(d)&&e(le)});var G=z(U,2),ue=e=>{var t=uV();y(e,t)},K=e=>{var t=dV(),r=W(t),i=M(r,!0),a=z(r,2);An(a,{size:`sm`,class:`h-7 px-2.5 text-xs`,onclick:()=>void Ie(),children:(e,t)=>{oe();var n=C(`Retry`);y(e,n)},$$slots:{default:!0}}),n(t),H(()=>c(i,Me.error)),y(e,t)},J=e=>{var t=fV();y(e,t)},fe=e=>{var r=X(),i=q(r);t(i,17,()=>E(b),([e,t])=>e,(e,r)=>{var i=I(()=>m(E(r),2));let a=()=>E(i)[0],o=()=>E(i)[1];var s=hV(),l=W(s),u=M(l,!0),d=z(l,2);t(d,21,o,e=>e.sessionId,(e,t)=>{var r=mV(),i=W(r),a=M(i,!0),o=z(i,2),s=M(o,!0),l=z(o,2),u=M(l,!0),d=z(l,2),f=M(d,!0),p=z(d,2),m=e=>{var t=pV();y(e,t)};h(p,e=>{E(t).hasTranscript===!1&&e(m)});var g=z(p,2);{let e=I(()=>E(t).title||E(t).sessionId),n=I(()=>E(t).status===`running`?`Running sessions cannot be deleted`:E(t).hasTranscript===!1?`Kernel-only session — nothing to clean in the product layer`:`Delete session`),r=I(()=>E(t).status===`running`||E(t).hasTranscript===!1||E(_));An(g,{size:`icon`,variant:`ghost`,class:`h-6 w-6 shrink-0`,get"aria-label"(){return`Delete session ${E(e)??``}`},get title(){return E(n)},get disabled(){return E(r)},onclick:()=>A(E(t)),children:(e,t)=>{Cn(e,{class:`h-3.5 w-3.5`})},$$slots:{default:!0}})}n(r),H((e,n)=>{B(i,`title`,E(t).title||E(t).sessionId),c(a,E(t).title||`Untitled session`),c(s,e),c(u,n),Y(d,1,`shrink-0 text-[10px] ${E(t).status===`running`?`text-primary`:`text-muted-foreground`}`),c(f,E(t).status)},[()=>w(E(t).createdAt),()=>T(E(t).mode)]),y(e,r)}),n(d),n(s),H(()=>c(u,a())),y(e,s)}),y(e,r)};h(G,e=>{Me.loading&&!Me.loaded?e(ue):Me.error?e(K,1):E(b).length===0?e(J,2):e(fe,-1)}),n(ae);var pe=z(ae,2),me=e=>{var t=gV(),n=M(t,!0);H(()=>c(n,E(u))),y(e,t)};h(pe,e=>{E(u)&&e(me)}),n(te);var he=z(te,2);{let e=I(()=>E(g)?.title||(E(g)?.sessionId??``));_n(he,{title:`Delete session`,get description(){return`Delete the transcript of “${E(e)??``}”? This cannot be undone.`},get busy(){return E(_)},onConfirm:()=>void j(),get open(){return E(p)},set open(e){F(p,e,!0)}})}y(e,ee),x()}var yV=r(`<button><!> </button>`),bV=r(`<div class="flex h-full min-h-0 flex-col -m-4 p-4"><!></div>`),xV=r(`<div class="flex min-h-0 flex-col border-r border-border bg-muted/30"><!> <nav class="flex flex-col gap-0.5 p-2" aria-label="Settings sections"></nav></div> <div class="min-w-0 overflow-y-auto p-4"><!></div>`,1);function SV(e,r){i(r,!0);let o=[{id:`general`,label:`General`,icon:XR},{id:`model`,label:`Model`,icon:QR},{id:`agent`,label:`Agent`,icon:ez},{id:`sessions`,label:`Sessions`,icon:Kn}],s=V(!1);de(()=>{fR.open=E(s)}),de(()=>{fR.open&&F(s,!0)}),de(()=>{E(s)&&Ke()});var u=X(),d=q(u);a(d,()=>Sn,(e,r)=>{r(e,{get open(){return E(s)},set open(e){F(s,e,!0)},children:(e,r)=>{var i=X(),s=q(i);a(s,()=>fn,(e,r)=>{r(e,{class:`grid h-[min(560px,85vh)] grid-cols-[176px_1fr] gap-0 overflow-hidden p-0 sm:max-w-3xl`,children:(e,r)=>{var i=xV(),s=q(i),u=W(s);a(u,()=>vn,(e,t)=>{t(e,{class:`px-3 pt-2.5 pb-2 text-xs font-medium text-foreground`,children:(e,t)=>{oe();var n=C(`Settings`);y(e,n)},$$slots:{default:!0}})});var d=z(u,2);t(d,21,()=>o,e=>e.id,(e,t)=>{let r=I(()=>E(t).icon);var i=yV(),o=W(i);a(o,()=>E(r),(e,t)=>{t(e,{class:`h-3.5 w-3.5`})});var s=z(o);n(i),H(()=>{Y(i,1,`flex h-8 items-center gap-2 rounded-md px-2 text-xs transition-colors ${fR.section===E(t).id?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`}`),B(i,`aria-current`,fR.section===E(t).id?`true`:void 0),c(s,` ${E(t).label??``}`)}),l(`click`,i,()=>fR.section=E(t).id),y(e,i)}),n(d),n(s);var f=z(s,2),p=W(f),m=e=>{gz(e,{})},g=e=>{var t=bV();sV(W(t),{}),n(t),y(e,t)},_=e=>{vV(e,{})},v=e=>{cz(e,{})};h(p,e=>{fR.section===`general`?e(m):fR.section===`model`?e(g,1):fR.section===`sessions`?e(_,2):e(v,-1)}),n(f),y(e,i)},$$slots:{default:!0}})}),y(e,i)},$$slots:{default:!0}})}),y(e,u),x()}T([`click`]);var CV=r(`<link rel="icon" href="/icons/monochrome-mini.png" type="image/png"/> <link rel="apple-touch-icon" href="/icons/monochrome-mini.png"/>`,1),wV=r(`<span class="px-1 text-xs font-medium text-muted-foreground">Skill Creator</span>`),TV=r(`<button class="no-drag flex h-6 w-8 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground max-[720px]:h-11 max-[720px]:w-11" aria-label="Open command palette" aria-keyshortcuts="Meta+K" title="Command palette (Cmd+K)"><!></button> <button class="no-drag flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground max-[720px]:h-11 max-[720px]:w-11" aria-label="Reload app" title="Reload"><!></button> <button aria-label="Toggle agent panel" title="Agent panel"><!></button>`,1),EV=r(`<div class="flex min-h-8 items-center border-y border-destructive/30 bg-destructive/8 px-3 text-xs text-destructive" role="status"> </div>`),DV=r(`<button><!></button>`),OV=r(`<div class="relative flex h-screen w-screen flex-col overflow-hidden bg-background text-foreground"><!> <!> <div class="flex min-h-0 flex-1"><nav class="flex w-14 shrink-0 flex-col items-center gap-1 border-r border-border bg-muted/30 py-3"><!> <div class="my-1 h-px w-8 bg-border"></div> <button class="flex h-10 w-10 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground" title="Import workspace" aria-label="Import workspace"><!></button> <button title="Settings" aria-label="Settings"><!></button></nav> <main class="min-w-0 flex-1 overflow-hidden"><!> <!></main> <div><!></div></div></div>`),kV=r(`<!> <!> <!> <!> <!>`,1);function AV(e,r){i(r,!0),ue(()=>(gt(),ve.url.pathname===`/`&&ge(`/workspaces`,{replaceState:!0}),rt({navigate(e,t){t===`REPLACE`?ge(e,{replaceState:!0,keepFocus:!0,noScroll:!0}):ge(e)}}),xt(),yt));let o=I(()=>ve.url.pathname);de(()=>{E(o).startsWith(`/creator`)?Dc(Ec):Dc(Tc)});let s=I(()=>wt.status===`connected`);de(()=>{E(s)&&Mt()});let u=I(()=>et.list()),d=I(()=>nt(ve.url.pathname)?.app??null);function f(e){ge(`/${e}`)}var p=kV();S(`12qhfyh`,e=>{var t=CV();oe(2),y(e,t)});var m=q(p);Cc(m,{children:(e,i)=>{var o=OV(),s=W(o);nr(s,{variant:`main`,left:e=>{var t=wV();y(e,t)},right:e=>{var t=TV(),r=q(t);kc(W(r),{class:`h-3.5 w-3.5`}),n(r);var i=z(r,2),a=W(i);Wn(a,{class:`h-3.5 w-3.5`}),n(i);var o=z(i,2),s=W(o);Be(s,{class:`h-3.5 w-3.5`}),n(o),H(()=>{Y(o,1,`no-drag flex h-6 w-6 items-center justify-center rounded transition-colors ${We.open?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground`} max-[720px]:h-11 max-[720px]:w-11`),B(o,`aria-pressed`,We.open)}),l(`pointerdown`,r,e=>e.stopPropagation()),l(`click`,r,()=>globalThis.dispatchEvent(new KeyboardEvent(`keydown`,{key:`k`,metaKey:!0}))),l(`pointerdown`,i,e=>e.stopPropagation()),l(`click`,i,()=>globalThis.location.reload()),l(`pointerdown`,o,e=>e.stopPropagation()),l(`click`,o,()=>Xe(!We.open)),y(e,t)},$$slots:{left:!0,right:!0}});var p=z(s,2),m=e=>{var t=EV(),n=M(t,!0);H(()=>c(n,wt.error)),y(e,t)};h(p,e=>{wt.status===`disconnected`&&e(m)});var g=z(p,2),v=W(g),b=W(v);t(b,17,()=>E(u),e=>e.id,(e,t)=>{let r=I(()=>E(t).icon);var i=DV(),o=W(i);a(o,()=>E(r),(e,t)=>{t(e,{class:`h-5 w-5`})}),n(i),H(()=>{Y(i,1,`flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-muted ${E(d)===E(t).id?`bg-primary/10 text-primary`:`text-muted-foreground`}`),B(i,`title`,E(t).name),B(i,`aria-label`,E(t).name),B(i,`aria-current`,E(d)===E(t).id?`page`:void 0)}),l(`click`,i,()=>f(E(t).id)),y(e,i)});var x=z(b,4),S=W(x);Te(S,{class:`h-5 w-5`}),n(x);var C=z(x,2);jc(W(C),{class:`h-5 w-5`}),n(C),n(v);var w=z(v,2),T=W(w);at(T,{});var D=z(T,2);_(D,()=>r.children??R),n(w);var O=z(w,2);JR(W(O),{}),n(O),n(g),n(o),H(()=>{Y(C,1,`mt-auto flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-muted ${fR.open?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground`}`),B(C,`aria-pressed`,fR.open),Y(O,1,`agent-panel-layer shrink-0 max-[720px]:absolute max-[720px]:inset-0 max-[720px]:z-40 ${We.open?``:`pointer-events-none`}`)}),l(`click`,x,()=>Ce()),l(`click`,C,()=>pR()),y(e,o)},$$slots:{default:!0}});var g=z(m,2);As(g,{});var v=z(g,2);SV(v,{});var b=z(v,2);_c(b,{}),xc(z(b,2),{}),y(e,p),x()}T([`pointerdown`,`click`]);export{AV as component,Yn as universal};
|