@qodalis/console 0.0.0-stage → 1.0.0-beta.33

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.
@@ -0,0 +1,32 @@
1
+ import{i as Mi,j as c,d as Na,r as D,k as Ea,o as Aa,u as H,l as Di,m as _e,n as Ia,p as Un,a as se,M as Hn,q as Ee,E as me,t as Pa,v as Li,w as Ue,x as Ta,y as zi,z as Ma,B as Da,D as Fi,F as La,b as He,f as ye,G as za,H as qn,I as Fa,J as Ri,A as Ra,K as Oa,L as _a,N as kn,O as Ba,Q as Ae,R as $a,T as Ua,U as Ha,P as qa,V as Va,W as Wa,X as Ga,Y as Ya,Z as Ka}from"./index-DNbEWPIs.js";import{B as te}from"./Badge-DXfBhPf0.js";import{u as _t,M as Pe,g as Oi,s as _i,P as Bt,F as Tt,i as Qa,N as Vn,p as Bi,a as Z,b as Wn,c as Xa,S as Gn,d as Yn,e as Ja,f as Za,h as es,V as ts,j as $i,k as $t,l as Kn,o as yn,m as ns,n as rs,q as is,r as Qn,t as ls,R as as,v as ss,w as wn,x as os,y as us,z as cs,A as ds,D as fs,B as ps,C as hs,E as Ui,G as ms,H as xt,I as gs,J as xs,K as bs,L as ks,O as vn,Q as Hi,T as ys,U as ws,W as vs}from"./DependencyParts-BI02t_lf.js";import{B as Xn}from"./ButtonGroup-cc0CHohH.js";import{P as Ir,p as Ss,c as js,a as Cs,D as qi}from"./paging-CCKbuXJo.js";import{C as It}from"./commandInfo-B8tZOPKW.js";import{i as Ns,e as Es,f as As,v as Is,d as Ps,C as Ts}from"./ConfigInput-Di-TZY52.js";const Pr="px-3 py-1.5 text-xs bg-control hover:bg-control-hover text-text rounded-lg transition-colors disabled:opacity-40";function Vi({page:e,pageSize:t,total:n,onPage:r,onPageSize:l}){const{t:a,formatNumber:i}=Mi();if(n<=Ir[0])return null;const s=js(e,n,t),o=Cs(n,t),{from:u,to:d}=Ss(s,t,n);return c.jsxs("nav",{"aria-label":a("pagination"),className:"flex flex-wrap items-center justify-between gap-3 mt-3 text-xs text-subtle",children:[c.jsxs("label",{className:"flex items-center gap-2",children:[a("rowsPerPage"),c.jsx(Na,{options:Ir.map(f=>({value:String(f),label:i(f)})),value:String(t),onChange:f=>l(Number(f)),width:"auto"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"tabular-nums",children:a("pageRange",{from:i(u),to:i(d),total:i(n)})}),c.jsx("button",{onClick:()=>r(s-1),disabled:s===0,className:Pr,children:a("previousPage")}),c.jsx("span",{className:"tabular-nums",children:a("pageOf",{page:i(s+1),pages:i(o)})}),c.jsx("button",{onClick:()=>r(s+1),disabled:s>=o-1,className:Pr,children:a("nextPage")})]})]})}const Xe=8;function Ms({content:e,children:t,className:n="",openDelay:r=200,longPress:l=450}){const a=D.useId(),[i,s]=D.useState(!1),[o,u]=D.useState(null),[d,f]=D.useState(null),h=D.useRef(null),p=D.useRef(void 0),g=D.useRef(!1),b=()=>clearTimeout(p.current),w=D.useCallback(()=>{clearTimeout(p.current),s(!1),u(null)},[]);D.useEffect(()=>()=>clearTimeout(p.current),[]),D.useEffect(()=>{if(!i)return;const y=N=>{N.key==="Escape"&&w()},v=N=>{d!=null&&d.contains(N.target)||w()};return document.addEventListener("keydown",y),document.addEventListener("touchstart",v),()=>{document.removeEventListener("keydown",y),document.removeEventListener("touchstart",v)}},[i,w,d]);const m=D.useCallback(()=>{if(!d||!h.current)return;const y=d.getBoundingClientRect(),v=h.current.getBoundingClientRect(),N=Math.min(Math.max(Xe,y.left+y.width/2-v.width/2),Math.max(Xe,window.innerWidth-v.width-Xe)),E=y.top-v.height-Xe,S=E>=Xe?E:y.bottom+Xe;u(A=>A&&A.left===N&&A.top===S?A:{left:N,top:S})},[d]);return D.useLayoutEffect(()=>{if(!i)return;m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m);const y=typeof ResizeObserver=="function"&&h.current?new ResizeObserver(m):null;return y&&h.current&&y.observe(h.current),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m),y==null||y.disconnect()}},[i,m]),c.jsxs(c.Fragment,{children:[c.jsx("span",{ref:f,className:`inline-flex ${n}`,onPointerEnter:y=>{y.pointerType!=="touch"&&(b(),p.current=setTimeout(()=>s(!0),r))},onPointerLeave:y=>{y.pointerType!=="touch"&&w()},onFocus:()=>{b(),s(!0)},onBlur:w,onTouchStart:()=>{g.current=!1,b(),p.current=setTimeout(()=>{g.current=!0,s(!0)},l)},onTouchMove:b,onTouchEnd:b,onClickCapture:y=>{g.current&&(g.current=!1,y.preventDefault(),y.stopPropagation())},children:t(i?a:void 0)}),i&&Ea.createPortal(c.jsx("div",{ref:h,id:a,role:"tooltip",style:o?{left:o.left,top:o.top}:{left:0,top:0,visibility:"hidden"},className:"fixed z-50 max-w-[min(20rem,calc(100vw-1rem))] px-3 py-2 rounded-lg border border-border bg-popover text-text text-xs shadow-xl pointer-events-none",children:e()}),Aa())]})}const qe="flex items-center flex-wrap gap-x-2 gap-y-1 min-w-0",Ds="flex items-center flex-wrap gap-x-2 gap-y-1 mt-1 text-xs text-subtle",Ve="flex items-center flex-wrap gap-2",Ie="shrink-0 inline-flex items-center leading-none text-[10px] text-subtle font-mono bg-control px-1.5 py-1 rounded";function Ut({installed:e,updateAvailable:t,latest:n}){const{t:r}=H();return e?e.source==="code"?c.jsxs(c.Fragment,{children:[c.jsx("span",{"data-testid":"added-in-code",title:r("marketplace.addedInCodeHint"),className:"inline-flex shrink-0",children:c.jsx(te,{variant:"info",children:e.version?r("marketplace.addedInCodeVersion",{version:e.version}):r("marketplace.addedInCode")})}),t&&n&&c.jsx("span",{"data-testid":"newer-in-code",className:"inline-flex max-w-full",children:c.jsx(te,{variant:"warning",children:r("marketplace.newerInCode",{version:n})})})]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"inline-flex shrink-0",children:c.jsx(te,{variant:"info",children:r("marketplace.installedVersion",{version:e.version??""})})}),t&&c.jsx("span",{className:"inline-flex shrink-0",children:c.jsx(te,{variant:"warning",children:r("marketplace.updateAvailable")})})]}):null}function et({count:e,label:t}){return c.jsx(Di,{label:t,className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:Array.from({length:e},(n,r)=>c.jsxs("div",{className:"bg-surface border border-border rounded-xl p-4 flex items-start gap-3",children:[c.jsx(_e,{className:"w-8 h-8 rounded-lg shrink-0"}),c.jsxs("div",{className:"flex-1 space-y-2",children:[c.jsx(_e,{className:"h-3.5 w-1/2"}),c.jsx(_e,{className:"h-2.5 w-1/3"}),c.jsx(_e,{className:"h-3 w-full"})]})]},r))})}function Tr(e,t=e.default){return{key:e.key,label:e.label||e.key,description:e.description??"",type:e.type,value:t,default:e.default,source:"default",mutable:!0,requiresRestart:!1,sensitive:!1,...e.validation?{validation:e.validation}:{}}}function Ls(e,t){if(!t||!(e.key in t))return e.default;const n=t[e.key];return Is(e,n)?e.default:n}function zs(e,t){const n={},r={};for(const l of e){const a=t[l.key];if(!a||!Ns(l,a))continue;const i=Es(l,a);"problem"in i?r[l.key]=i.problem:n[l.key]=i.value}return{changes:n,problems:r}}function Fs(e,t,n){return e!==void 0&&t!==void 0?{key:"marketplace.ruleRange",params:{min:n(e),max:n(t)}}:e!==void 0?{key:"marketplace.ruleMin",params:{min:n(e)}}:t!==void 0?{key:"marketplace.ruleMax",params:{max:n(t)}}:null}function Rs(e,t){var a;const n=e.validation??{},r=[];n.required&&r.push(t("marketplace.ruleRequired"));const l=Fs(n.min,n.max,e.type==="duration"?As:i=>i);if(l){const i=t(l.key,l.params);e.type==="string"||e.type==="url"?r.push(t("marketplace.ruleLength",{range:i})):e.type==="string[]"?r.push(t("marketplace.ruleItems",{range:i})):r.push(i)}return(a=n.options)!=null&&a.length&&r.push(t("marketplace.ruleOneOf",{options:n.options.join(", ")})),n.pattern&&r.push(t("marketplace.rulePattern",{pattern:n.pattern})),r}function Os(e,t){return e.hasConfig===!0?!0:t===null?e.hasConfig===void 0:!!(t!=null&&t.has(e.id))}function _s(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Bs=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$s=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Us={};function Mr(e,t){return(Us.jsx?$s:Bs).test(e)}const Hs=/[ \t\n\f\r]/g;function qs(e){return typeof e=="object"?e.type==="text"?Dr(e.value):!1:Dr(e)}function Dr(e){return e.replace(Hs,"")===""}class kt{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}kt.prototype.normal={};kt.prototype.property={};kt.prototype.space=void 0;function Wi(e,t){const n={},r={};for(const l of e)Object.assign(n,l.property),Object.assign(r,l.normal);return new kt(n,r,t)}function Sn(e){return e.toLowerCase()}class de{constructor(t,n){this.attribute=n,this.property=t}}de.prototype.attribute="";de.prototype.booleanish=!1;de.prototype.boolean=!1;de.prototype.commaOrSpaceSeparated=!1;de.prototype.commaSeparated=!1;de.prototype.defined=!1;de.prototype.mustUseProperty=!1;de.prototype.number=!1;de.prototype.overloadedBoolean=!1;de.prototype.property="";de.prototype.spaceSeparated=!1;de.prototype.space=void 0;let Vs=0;const _=We(),ee=We(),jn=We(),P=We(),Y=We(),Be=We(),pe=We();function We(){return 2**++Vs}const Cn=Object.freeze(Object.defineProperty({__proto__:null,boolean:_,booleanish:ee,commaOrSpaceSeparated:pe,commaSeparated:Be,number:P,overloadedBoolean:jn,spaceSeparated:Y},Symbol.toStringTag,{value:"Module"})),tn=Object.keys(Cn);class Jn extends de{constructor(t,n,r,l){let a=-1;if(super(t,n),Lr(this,"space",l),typeof r=="number")for(;++a<tn.length;){const i=tn[a];Lr(this,tn[a],(r&Cn[i])===Cn[i])}}}Jn.prototype.defined=!0;function Lr(e,t,n){n&&(e[t]=n)}function tt(e){const t={},n={};for(const[r,l]of Object.entries(e.properties)){const a=new Jn(r,e.transform(e.attributes||{},r),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Sn(r)]=r,n[Sn(a.attribute)]=r}return new kt(t,n,e.space)}const Gi=tt({properties:{ariaActiveDescendant:null,ariaAtomic:ee,ariaAutoComplete:null,ariaBusy:ee,ariaChecked:ee,ariaColCount:P,ariaColIndex:P,ariaColSpan:P,ariaControls:Y,ariaCurrent:null,ariaDescribedBy:Y,ariaDetails:null,ariaDisabled:ee,ariaDropEffect:Y,ariaErrorMessage:null,ariaExpanded:ee,ariaFlowTo:Y,ariaGrabbed:ee,ariaHasPopup:null,ariaHidden:ee,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Y,ariaLevel:P,ariaLive:null,ariaModal:ee,ariaMultiLine:ee,ariaMultiSelectable:ee,ariaOrientation:null,ariaOwns:Y,ariaPlaceholder:null,ariaPosInSet:P,ariaPressed:ee,ariaReadOnly:ee,ariaRelevant:null,ariaRequired:ee,ariaRoleDescription:Y,ariaRowCount:P,ariaRowIndex:P,ariaRowSpan:P,ariaSelected:ee,ariaSetSize:P,ariaSort:null,ariaValueMax:P,ariaValueMin:P,ariaValueNow:P,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Yi(e,t){return t in e?e[t]:t}function Ki(e,t){return Yi(e,t.toLowerCase())}const Ws=tt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Be,acceptCharset:Y,accessKey:Y,action:null,allow:null,allowFullScreen:_,allowPaymentRequest:_,allowUserMedia:_,alpha:_,alt:null,as:null,async:_,autoCapitalize:null,autoComplete:Y,autoFocus:_,autoPlay:_,blocking:Y,capture:null,charSet:null,checked:_,cite:null,className:Y,closedBy:null,colorSpace:null,cols:P,colSpan:P,command:null,commandFor:null,content:null,contentEditable:ee,controls:_,controlsList:Y,coords:P|Be,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_,defer:_,dir:null,dirName:null,disabled:_,download:jn,draggable:ee,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_,formTarget:null,headers:Y,height:P,hidden:jn,high:P,href:null,hrefLang:null,htmlFor:Y,httpEquiv:Y,id:null,imageSizes:null,imageSrcSet:null,inert:_,inputMode:null,integrity:null,is:null,isMap:_,itemId:null,itemProp:Y,itemRef:Y,itemScope:_,itemType:Y,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_,low:P,manifest:null,max:null,maxLength:P,media:null,method:null,min:null,minLength:P,multiple:_,muted:_,name:null,nonce:null,noModule:_,noValidate:_,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_,optimum:P,pattern:null,ping:Y,placeholder:null,playsInline:_,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_,referrerPolicy:null,rel:Y,required:_,reversed:_,rows:P,rowSpan:P,sandbox:Y,scope:null,scoped:_,seamless:_,selected:_,shadowRootClonable:_,shadowRootCustomElementRegistry:_,shadowRootDelegatesFocus:_,shadowRootMode:null,shadowRootSerializable:_,shape:null,size:P,sizes:null,slot:null,span:P,spellCheck:ee,src:null,srcDoc:null,srcLang:null,srcSet:null,start:P,step:null,style:null,tabIndex:P,target:null,title:null,translate:null,type:null,typeMustMatch:_,useMap:null,value:ee,width:P,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Y,axis:null,background:null,bgColor:null,border:P,borderColor:null,bottomMargin:P,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_,declare:_,event:null,face:null,frame:null,frameBorder:null,hSpace:P,leftMargin:P,link:null,longDesc:null,lowSrc:null,marginHeight:P,marginWidth:P,noResize:_,noHref:_,noShade:_,noWrap:_,object:null,profile:null,prompt:null,rev:null,rightMargin:P,rules:null,scheme:null,scrolling:ee,standby:null,summary:null,text:null,topMargin:P,valueType:null,version:null,vAlign:null,vLink:null,vSpace:P,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:_,disablePictureInPicture:_,disableRemotePlayback:_,exportParts:Be,part:Y,prefix:null,property:null,results:P,security:null,unselectable:null},space:"html",transform:Ki}),Gs=tt({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:pe,accentHeight:P,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:P,amplitude:P,arabicForm:null,ascent:P,attributeName:null,attributeType:null,azimuth:P,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:P,by:null,calcMode:null,capHeight:P,className:Y,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:P,diffuseConstant:P,direction:null,display:null,dur:null,divisor:P,dominantBaseline:null,download:_,dx:null,dy:null,edgeMode:null,editable:null,elevation:P,enableBackground:null,end:null,event:null,exponent:P,externalResourcesRequired:null,fill:null,fillOpacity:P,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Be,g2:Be,glyphName:Be,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:P,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:P,horizOriginX:P,horizOriginY:P,id:null,ideographic:P,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:P,k:P,k1:P,k2:P,k3:P,k4:P,kernelMatrix:pe,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:P,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:P,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:P,overlineThickness:P,paintOrder:null,panose1:null,path:null,pathLength:P,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Y,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:P,pointsAtY:P,pointsAtZ:P,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pe,rev:pe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pe,requiredFeatures:pe,requiredFonts:pe,requiredFormats:pe,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:P,specularExponent:P,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:P,strikethroughThickness:P,string:null,stroke:null,strokeDashArray:pe,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:P,strokeOpacity:P,strokeWidth:null,style:null,surfaceScale:P,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pe,tabIndex:P,tableValues:null,target:null,targetX:P,targetY:P,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pe,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:P,underlineThickness:P,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:P,values:null,vAlphabetic:P,vMathematical:P,vectorEffect:null,vHanging:P,vIdeographic:P,version:null,vertAdvY:P,vertOriginX:P,vertOriginY:P,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:P,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Yi}),Qi=tt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Xi=tt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ki}),Ji=tt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Ys={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Ks=/[A-Z]/g,zr=/-[a-z]/g,Qs=/^data[-\w.:]+$/i;function Xs(e,t){const n=Sn(t);let r=t,l=de;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Qs.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(zr,Zs);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!zr.test(a)){let i=a.replace(Ks,Js);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}l=Jn}return new l(r,t)}function Js(e){return"-"+e.toLowerCase()}function Zs(e){return e.charAt(1).toUpperCase()}const eo=Wi([Gi,Ws,Qi,Xi,Ji],"html"),Zn=Wi([Gi,Gs,Qi,Xi,Ji],"svg");function to(e){return e.join(" ").trim()}var Fr=/\/\*(?:[^*]|\*(?!\/))*\*\//g,no=/\n/g,ro=/^\s*/,io=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,lo=/^:\s*/,ao=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,so=/^[;\s]*/,oo=`
2
+ `,Rr="/",Or="*",st="",uo="comment",co="declaration";function fo(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function l(g){var b=g.match(no);b&&(n+=b.length);var w=g.lastIndexOf(oo);r=~w?g.length-w:r+g.length}function a(){var g={line:n,column:r};return function(b){return b.position=new i(g),u(),b}}function i(g){this.start=g,this.end={line:n,column:r},this.source=t.source}i.prototype.content=e;function s(g){var b=new Error(t.source+":"+n+":"+r+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function o(g){var b=g.exec(e);if(b){var w=b[0];return l(w),e=e.slice(w.length),b}}function u(){o(ro)}function d(g){for(var b;b=f();)g.push(b);return g}function f(){var g=a();if(!(Rr!=e.charAt(0)||Or!=e.charAt(1))){for(var b=2;st!=e.charAt(b)&&(Or!=e.charAt(b)||Rr!=e.charAt(b+1));)++b;if(b+=2,st===e.charAt(b-1))return s("End of comment missing");var w=e.slice(2,b-2);return r+=2,l(w),e=e.slice(b),r+=2,g({type:uo,comment:w})}}function h(){var g=a(),b=o(io);if(b){if(f(),!o(lo))return s("property missing ':'");var w=o(ao),m=g({type:co,property:b[0].replace(Fr,st).trim(),value:w?w[0].replace(Fr,st).trim():st});return o(so),m}}function p(){var g=[];d(g);for(var b;b=h();)g.push(b),d(g);return g}return u(),p()}function po(e,t){let n=null;if(!e||typeof e!="string")return n;const r=fo(e),l=typeof t=="function";return r.forEach(a=>{if(a.type!=="declaration")return;const{property:i,value:s}=a;l?t(i,s,a):s&&(n=n??{},n[i]=s)}),n}const Zi=el("end"),er=el("start");function el(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ho(e){const t=er(e),n=Zi(e);if(t&&n)return{start:t,end:n}}function dt(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?_r(e.position):"start"in e||"end"in e?_r(e):"line"in e||"column"in e?Nn(e):""}function Nn(e){return Br(e&&e.line)+":"+Br(e&&e.column)}function _r(e){return Nn(e&&e.start)+"-"+Nn(e&&e.end)}function Br(e){return e&&typeof e=="number"?e:1}class Ht extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let l="",a={},i=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?l=t:!a.cause&&t&&(i=!0,l=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const o=r.indexOf(":");o===-1?a.ruleId=r:(a.source=r.slice(0,o),a.ruleId=r.slice(o+1))}if(!a.place&&a.ancestors){const o=a.ancestors[a.ancestors.length-1];o&&(a.place=o.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=s?s.line:void 0,this.name=dt(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=i&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Object.defineProperties(Ht.prototype,{file:{configurable:!0,enumerable:!0,value:"",writable:!0},name:{configurable:!0,enumerable:!0,value:"",writable:!0},reason:{configurable:!0,enumerable:!0,value:"",writable:!0},message:{configurable:!0,enumerable:!0,value:"",writable:!0},stack:{configurable:!0,enumerable:!0,value:"",writable:!0},column:{configurable:!0,enumerable:!0,writable:!0},line:{configurable:!0,enumerable:!0,writable:!0},ancestors:{configurable:!0,enumerable:!0,writable:!0},cause:{configurable:!0,enumerable:!0,writable:!0},fatal:{configurable:!0,enumerable:!0,writable:!0},place:{configurable:!0,enumerable:!0,writable:!0},ruleId:{configurable:!0,enumerable:!0,writable:!0},source:{configurable:!0,enumerable:!0,writable:!0}});const tr={}.hasOwnProperty,mo=new Map,go=/[A-Z]/g,xo=/-([a-z])/g,bo=new Set(["table","tbody","thead","tfoot","tr"]),ko=new Set(["td","th"]),tl="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function yo(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Ao(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Eo(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Zn:eo,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=nl(l,e,void 0);return a&&typeof a!="string"?a:l.create(e,l.Fragment,{children:a||void 0},void 0)}function nl(e,t,n){if(t.type==="element")return wo(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return vo(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return jo(e,t,n);if(t.type==="mdxjsEsm")return So(e,t);if(t.type==="root")return Co(e,t,n);if(t.type==="text")return No(e,t)}function wo(e,t,n){const r=e.schema;let l=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(l=Zn,e.schema=l),e.ancestors.push(t);const a=il(e,t.tagName,!1),i=Io(e,t);let s=rr(e,t);return bo.has(t.tagName)&&(s=s.filter(function(o){return typeof o=="string"?!qs(o):!0})),rl(e,i,a,t),nr(i,s),e.ancestors.pop(),e.schema=r,e.create(t,a,i,n)}function vo(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}bt(e,t.position)}function So(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);bt(e,t.position)}function jo(e,t,n){const r=e.schema;let l=r;t.name==="svg"&&r.space==="html"&&(l=Zn,e.schema=l),e.ancestors.push(t);const a=t.name===null?e.Fragment:il(e,t.name,!0),i=Po(e,t),s=rr(e,t);return rl(e,i,a,t),nr(i,s),e.ancestors.pop(),e.schema=r,e.create(t,a,i,n)}function Co(e,t,n){const r={};return nr(r,rr(e,t)),e.create(t,e.Fragment,r,n)}function No(e,t){return t.value}function rl(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function nr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Eo(e,t,n){return r;function r(l,a,i,s){const u=Array.isArray(i.children)?n:t;return s?u(a,i,s):u(a,i)}}function Ao(e,t){return n;function n(r,l,a,i){const s=Array.isArray(a.children),o=er(r);return t(l,a,i,s,{columnNumber:o?o.column-1:void 0,fileName:e,lineNumber:o?o.line:void 0},void 0)}}function Io(e,t){const n={};let r,l;for(l in t.properties)if(l!=="children"&&tr.call(t.properties,l)){const a=To(e,l,t.properties[l]);if(a){const[i,s]=a;e.tableCellAlignToStyle&&i==="align"&&typeof s=="string"&&ko.has(t.tagName)?r=s:n[i]=s}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Po(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const i=a.expression;i.type;const s=i.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else bt(e,t.position);else{const{name:l}=r;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,a=e.evaluater.evaluateExpression(s.expression)}else bt(e,t.position);else a=r.value===null?!0:r.value;n[l]=a}return n}function rr(e,t){const n=[];let r=-1;const l=e.passKeys?new Map:mo;for(;++r<t.children.length;){const a=t.children[r];let i;if(e.passKeys){const o=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(o){const u=l.get(o)||0;i=o+"-"+u,l.set(o,u+1)}}const s=nl(e,a,i);s!==void 0&&n.push(s)}return n}function To(e,t,n){if(n==null||typeof n=="number"&&Number.isNaN(n))return;const r=Xs(e.schema,t);return Array.isArray(n)&&(n=r.commaSeparated?_s(n):to(n)),r.property==="style"?["style",typeof n=="object"?e.stylePropertyNameCase==="dom"?n:Do(n):Mo(e,String(n))]:[e.elementAttributeNameCase==="react"&&r.space?Ys[r.property]||r.property:r.attribute,n]}function Mo(e,t){const n={};try{po(t,function(r,l){if(r&&l){let a=r;a.slice(0,2)!=="--"&&(a=a.toLowerCase(),e.stylePropertyNameCase==="dom"&&(a.slice(0,4)==="-ms-"&&(a=a.slice(1)),a=a.replace(xo,Fo))),n[a]=l}})}catch(r){if(e.ignoreInvalidStyle)return{};const l=r,a=new Ht("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=tl+"#cannot-parse-style-attribute",a}return n}function il(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let a=-1,i;for(;++a<l.length;){const s=Mr(l[a])?{type:"Identifier",name:l[a]}:{type:"Literal",value:l[a]};i=i?{type:"MemberExpression",object:i,property:s,computed:!!(a&&s.type==="Literal"),optional:!1}:s}r=i}else r=Mr(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const l=r.value;return tr.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(r);bt(e)}function bt(e,t){const n=new Ht("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=tl+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Do(e){const t={};let n;for(n in e)tr.call(e,n)&&(t[Lo(n)]=e[n]);return t}function Lo(e){if(e.slice(0,2)==="--")return e;let t=e.replace(go,zo);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function zo(e){return"-"+e.toLowerCase()}function Fo(e,t){return t.toUpperCase()}const nn={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Ro={};function qt(e,t){const n=Ro,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,l=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ll(e,r,l)}function ll(e,t,n){if(Oo(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return $r(e.children,t,n)}return Array.isArray(e)?$r(e,t,n):""}function $r(e,t,n){const r=[];let l=-1;for(;++l<e.length;)r[l]=ll(e[l],t,n);return r.join("")}function Oo(e){return!!(e&&typeof e=="object")}const Ur=document.createElement("i");function ir(e){const t="&"+e+";";Ur.innerHTML=t;const n=Ur.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function xe(e,t,n,r){const l=e.length;let a=0,i;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);a<r.length;)i=r.slice(a,a+1e4),i.unshift(t,0),e.splice(...i),a+=1e4,t+=1e4}function he(e,t){return e.length>0?(xe(e,e.length,0,t),e):t}const Hr={}.hasOwnProperty;function al(e){const t={};let n=-1;for(;++n<e.length;)_o(t,e[n]);return t}function _o(e,t){let n;for(n in t){const l=(Hr.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let i;if(a)for(i in a){Hr.call(l,i)||(l[i]=[]);const s=a[i];Bo(l[i],Array.isArray(s)?s:s?[s]:[])}}}function Bo(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);xe(e,0,0,r)}function sl(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function be(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ie=Fe(/[A-Za-z]/),le=Fe(/[\dA-Za-z]/),$o=Fe(/[#-'*+\--9=?A-Z^-~]/);function Mt(e){return e!==null&&(e<32||e===127)}const En=Fe(/\d/),Uo=Fe(/[\dA-Fa-f]/),ol=Fe(/[!-/:-@[-`{-~]/);function F(e){return e!==null&&e<-2}function K(e){return e!==null&&(e<0||e===32)}function U(e){return e===-2||e===-1||e===32}const yt=Fe(new RegExp("\\p{P}|\\p{S}","u")),$e=Fe(/\s/);function Fe(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function nt(e){const t=[];let n=-1,r=0,l=0;for(;++n<e.length;){const a=e.charCodeAt(n);let i="";if(a===37&&le(e.charCodeAt(n+1))&&le(e.charCodeAt(n+2)))l=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(i=String.fromCharCode(a));else if(a>55295&&a<57344){const s=e.charCodeAt(n+1);a<56320&&s>56319&&s<57344?(i=String.fromCharCode(a,s),l=1):i="�"}else i=String.fromCharCode(a);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+l+1,i=""),l&&(n+=l,l=0)}return t.join("")+e.slice(r)}function V(e,t,n,r){const l=r?r-1:1/0;let a=0;return i;function i(o){return U(o)?(e.enter(n),s(o)):t(o)}function s(o){return U(o)&&a++<l?(e.consume(o),s):(e.exit(n),t(o))}}function ul(e,t,n,r,l,a){let i=0;return s;function s(d){return U(d)?(e.enter(r),o(d)):u(d)}function o(d){return U(d)&&i<a?(e.consume(d),i++,o):(e.exit(r),u(d))}function u(d){return i>=l?t(d):n(d)}}const Ho={tokenize:qo};function qo(e){const t=e.attempt(this.parser.constructs.contentInitial,r,l);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),V(e,t,"linePrefix")}function l(s){return e.enter("paragraph"),a(s)}function a(s){const o=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=o),n=o,i(s)}function i(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return F(s)?(e.consume(s),e.exit("chunkText"),a):(e.consume(s),i)}}let Dt=class{constructor(){this.index=new Map,this.map=[]}add(t,n,r){qr(this,t,n,r,!1)}addBefore(t,n,r){qr(this,t,n,r,!0)}consume(t){if(this.map.sort(function(a,i){return a[0]-i[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let l=r.pop();for(;l;){for(const a of l)t.push(a);l=r.pop()}this.map.length=0,this.index.clear()}};function qr(e,t,n,r,l){if(n===0&&r.length===0)return;const a=e.index.get(t);if(a){a[1]+=n,l?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}const i=[t,n,r];e.map.push(i),e.index.set(t,i)}const Vo={tokenize:Wo},Vr={tokenize:Go};function Wo(e){const t=this,n=[];let r=0,l,a,i;return s;function s(v){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,o,u)(v)}return u(v)}function o(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&y();const N=t.events.length;let E=N,S;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){S=t.events[E][1].end;break}m(r);let A=N;for(;A<t.events.length;)t.events[A][1].end={...S},A++;const L=new Dt;return L.add(E+1,0,t.events.slice(N)),L.add(N,A-N,[]),L.consume(t.events),u(v)}return s(v)}function u(v){if(r===n.length){if(!l)return h(v);if(l.currentConstruct&&l.currentConstruct.concrete)return g(v);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Vr,d,f)(v)}function d(v){return l&&y(),m(r),h(v)}function f(v){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,g(v)}function h(v){return t.containerState={},e.attempt(Vr,p,g)(v)}function p(v){return r++,n.push([t.currentConstruct,t.containerState]),h(v)}function g(v){if(v===null){l&&y(),m(0),e.consume(v);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:a}),b(v)}function b(v){if(v===null){w(e.exit("chunkFlow"),!0),m(0),e.consume(v);return}return F(v)?(e.consume(v),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(v),b)}function w(v,N){const E=t.sliceStream(v);if(N&&E.push(null),v.previous=a,a&&(a.next=v),a=v,l.defineSkip(v.start),l.write(E),t.parser.lazy[v.start.line]){let S=l.events.length;for(;S--;)if(l.events[S][1].start.offset<i&&(!l.events[S][1].end||l.events[S][1].end.offset>i))return;const A=t.events.length;let L=A,O,j;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(O){j=t.events[L][1].end;break}O=!0}for(m(r),S=A;S<t.events.length;)t.events[S][1].end={...j},S++;const I=new Dt;I.add(L+1,0,t.events.slice(A)),I.add(A,S-A,[]),I.consume(t.events)}}function m(v){let N=n.length;for(;N-- >v;){const E=n[N];t.containerState=E[1],E[0].exit.call(t,e)}n.length=v}function y(){l.write([null]),a=void 0,l=void 0,t.containerState._closeFlow=void 0}}function Go(e,t,n){return V(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ze(e){if(e===null||K(e)||$e(e))return 1;if(yt(e))return 2}function Vt(e,t,n){const r=[];let l=-1;for(;++l<e.length;){const a=e[l].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const An={name:"attention",resolveAll:Yo,tokenize:Ko};function Yo(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){let l=n;for(;l--;)if(e[l][0]==="exit"&&e[l][1].type==="attentionSequence"&&e[l][1]._open&&t.sliceSerialize(e[l][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[l][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[l][1].end.offset-e[l][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const a=e[l][1].end.offset-e[l][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,i={...e[l][1].end},s={...e[n][1].start};Wr(i,-a),Wr(s,a);const o={type:a>1?"strongSequence":"emphasisSequence",start:i,end:{...e[l][1].end}},u={type:a>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:s},d={type:a>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[n][1].start}},f={type:a>1?"strong":"emphasis",start:{...o.start},end:{...u.end}};e[l][1].end={...o.start},e[n][1].start={...u.end},r=[],e[l][1].end.offset-e[l][1].start.offset&&(r=he(r,[["enter",e[l][1],t],["exit",e[l][1],t]])),r=he(r,[["enter",f,t],["enter",o,t],["exit",o,t],["enter",d,t]]),r=he(r,Vt(t.parser.constructs.insideSpan.null,e.slice(l+1,n),t)),r=he(r,[["exit",d,t],["enter",u,t],["exit",u,t],["exit",f,t]]);let h=0;e[n][1].end.offset-e[n][1].start.offset&&(h=2,r=he(r,[["enter",e[n][1],t],["exit",e[n][1],t]])),xe(e,l-1,n-l+3,r),n=l+r.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Ko(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,l=ze(r);let a;return i;function i(o){return a=o,e.enter("attentionSequence"),s(o)}function s(o){if(o===a)return e.consume(o),s;const u=e.exit("attentionSequence"),d=ze(o),f=!d||d===2&&l||n.includes(o)&&o!==42&&o!==95,h=!l||l===2&&d||n.includes(r)&&r!==42&&r!==95;return u._open=!!(a===42?f:f&&(l||!h)),u._close=!!(a===42?h:h&&(d||!f)),t(o)}}function Wr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Qo={name:"autolink",tokenize:Xo};function Xo(e,t,n){let r=0;return l;function l(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return ie(p)?(e.consume(p),i):p===64?n(p):u(p)}function i(p){return p===43||p===45||p===46||le(p)?(r=1,s(p)):u(p)}function s(p){return p===58?(e.consume(p),r=0,o):(p===43||p===45||p===46||le(p))&&r++<32?(e.consume(p),s):(r=0,u(p))}function o(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Mt(p)?n(p):(e.consume(p),o)}function u(p){return p===64?(e.consume(p),d):$o(p)?(e.consume(p),u):n(p)}function d(p){return le(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||le(p))&&r++<63){const g=p===45?h:f;return e.consume(p),g}return n(p)}}const wt={partial:!0,tokenize:Jo};function Jo(e,t,n){return r;function r(a){return U(a)?V(e,l,"linePrefix")(a):l(a)}function l(a){return a===null||F(a)?t(a):n(a)}}const cl={continuation:{tokenize:eu},exit:tu,name:"blockQuote",tokenize:Zo};function Zo(e,t,n){const r=this;return l;function l(i){if(i===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),a}return n(i)}function a(i){return U(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function eu(e,t,n){const r=this;return l;function l(i){return U(i)?V(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):a(i)}function a(i){return e.attempt(cl,t,n)(i)}}function tu(e){e.exit("blockQuote")}const dl={name:"characterEscape",tokenize:nu};function nu(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),l}function l(a){return ol(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const fl={name:"characterReference",tokenize:ru};function ru(e,t,n){const r=this;let l=0,a,i;return s;function s(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),o}function o(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),a=31,i=le,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,i=Uo,d):(e.enter("characterReferenceValue"),a=7,i=En,d(f))}function d(f){if(f===59&&l){const h=e.exit("characterReferenceValue");return i===le&&!ir(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(f)&&l++<a?(e.consume(f),d):n(f)}}const In={partial:!0,tokenize:iu};function iu(e,t,n){const r=this;return l;function l(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),a)}function a(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const Gr={concrete:!0,name:"codeFenced",tokenize:lu};function lu(e,t,n){const r=this,l={partial:!0,tokenize:E};let a=0,i=0,s;return o;function o(S){return u(S)}function u(S){const A=r.events[r.events.length-1];return a=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,s=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(S)}function d(S){return S===s?(i++,e.consume(S),d):i<3?n(S):(e.exit("codeFencedFenceSequence"),U(S)?V(e,f,"whitespace")(S):f(S))}function f(S){return S===null||F(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(In,b,N)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(S))}function h(S){return S===null||F(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(S)):U(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),V(e,p,"whitespace")(S)):S===96&&S===s?n(S):(e.consume(S),h)}function p(S){return S===null||F(S)?f(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||F(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(S)):S===96&&S===s?n(S):(e.consume(S),g)}function b(S){return e.attempt(l,N,w)(S)}function w(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),m}function m(S){return a>0&&U(S)?V(e,y,"linePrefix",a+1)(S):y(S)}function y(S){return S===null||F(S)?e.check(In,b,N)(S):(e.enter("codeFlowValue"),v(S))}function v(S){return S===null||F(S)?(e.exit("codeFlowValue"),y(S)):(e.consume(S),v)}function N(S){return e.exit("codeFenced"),t(S)}function E(S,A,L){let O=0;return j;function j(R){return S.enter("lineEnding"),S.consume(R),S.exit("lineEnding"),I}function I(R){return S.enter("codeFencedFence"),U(R)?V(S,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):z(R)}function z(R){return R===s?(S.enter("codeFencedFenceSequence"),q(R)):L(R)}function q(R){return R===s?(O++,S.consume(R),q):O>=i?(S.exit("codeFencedFenceSequence"),U(R)?V(S,M,"whitespace")(R):M(R)):L(R)}function M(R){return R===null||F(R)?(S.exit("codeFencedFence"),A(R)):L(R)}}}const rn={name:"codeIndented",tokenize:su},au={partial:!0,tokenize:ou};function su(e,t,n){return r;function r(s){return e.enter("codeIndented"),ul(e,l,n,"linePrefix",4,4)(s)}function l(s){return s===null?i(s):F(s)?e.attempt(au,l,i)(s):(e.enter("codeFlowValue"),a(s))}function a(s){return s===null||F(s)?(e.exit("codeFlowValue"),l(s)):(e.consume(s),a)}function i(s){return e.exit("codeIndented"),t(s)}}function ou(e,t,n){const r=this;return l;function l(i){return r.parser.lazy[r.now().line]?n(i):F(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),l):ul(e,t,a,"linePrefix",4,4)(i)}function a(i){return F(i)?l(i):n(i)}}const uu={name:"codeText",previous:du,resolve:cu,tokenize:fu};function cu(e){let t=e.length-4,n=3,r,l;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)l===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(l=r):(r===t||e[r][1].type==="lineEnding")&&(e[l][1].type="codeTextData",r!==l+2&&(e[l][1].end=e[r-1][1].end,e.splice(l+2,r-l-2),t-=r-l-2,r=l+2),l=void 0);return e}function du(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function fu(e,t,n){let r=0,l,a;return i;function i(f){return e.enter("codeText"),e.enter("codeTextSequence"),s(f)}function s(f){return f===96?(e.consume(f),r++,s):(e.exit("codeTextSequence"),o(f))}function o(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),o):f===96?(a=e.enter("codeTextSequence"),l=0,d(f)):F(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),o):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||F(f)?(e.exit("codeTextData"),o(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),l++,d):l===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(a.type="codeTextData",u(f))}}class pu{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const l=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return r&&ot(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ot(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ot(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ot(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ot(this.left,n.reverse())}}}function ot(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function pl(e){const t={};let n=-1,r,l,a,i,s,o,u;const d=new pu(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(o=r[1]._tokenizer.events,a=0,a<o.length&&o[a][1].type==="lineEndingBlank"&&(a+=2),a<o.length&&o[a][1].type==="content"))for(;++a<o.length&&o[a][1].type!=="content";)o[a][1].type==="chunkText"&&(o[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,hu(d,n)),n=t[n],u=!0);else if(r[1]._container){for(a=n,l=void 0;a--;)if(i=d.get(a),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(l&&(d.get(l)[1].type="lineEndingBlank"),i[1].type="lineEnding",l=a);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;l&&(r[1].end={...d.get(l)[1].start},s=d.slice(l,n),s.unshift(r),d.splice(l,n-l+1,s))}}return xe(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function hu(e,t){const n=e.get(t)[1],r=e.get(t)[2];let l=t-1;const a=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const s=i.events,o=[],u={};let d,f,h=-1,p=n,g=0,b=0;const w=[b];for(;p;){for(;e.get(++l)[1]!==p;);a.push(l),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&i.defineSkip(p.start),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<s.length;)s[h][0]==="exit"&&s[h-1][0]==="enter"&&s[h][1].type===s[h-1][1].type&&s[h][1].start.line!==s[h][1].end.line&&(b=h+1,w.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(i.events=[],p?(p._tokenizer=void 0,p.previous=void 0):w.pop(),h=w.length;h--;){const m=s.slice(w[h],w[h+1]),y=a.pop();o.push([y,y+m.length-1]),e.splice(y,2,m)}for(o.reverse(),h=-1;++h<o.length;)u[g+o[h][0]]=g+o[h][1],g+=o[h][1]-o[h][0]-1;return u}const mu={resolve:xu,tokenize:bu},gu={partial:!0,tokenize:ku};function xu(e){return pl(e),e}function bu(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),l(s)}function l(s){return s===null?a(s):F(s)?e.check(gu,i,a)(s):(e.consume(s),l)}function a(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function i(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,l}}function ku(e,t,n){const r=this;return l;function l(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),V(e,a,"linePrefix")}function a(i){if(i===null||F(i))return n(i);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function hl(e,t,n,r,l,a,i,s,o){const u=o||Number.POSITIVE_INFINITY;let d=0;return f;function f(m){return m===60?(e.enter(r),e.enter(l),e.enter(a),e.consume(m),e.exit(a),h):m===null||m===32||m===41||Mt(m)?n(m):(e.enter(r),e.enter(i),e.enter(s),e.enter("chunkString",{contentType:"string"}),b(m))}function h(m){return m===62?(e.enter(a),e.consume(m),e.exit(a),e.exit(l),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===62?(e.exit("chunkString"),e.exit(s),h(m)):m===null||m===60||F(m)?n(m):(e.consume(m),m===92?g:p)}function g(m){return m===60||m===62||m===92?(e.consume(m),p):p(m)}function b(m){return!d&&(m===null||m===41||K(m))?(e.exit("chunkString"),e.exit(s),e.exit(i),e.exit(r),t(m)):d<u&&m===40?(e.consume(m),d++,b):m===41?(e.consume(m),d--,b):m===null||m===32||m===40||Mt(m)?n(m):(e.consume(m),m===92?w:b)}function w(m){return m===40||m===41||m===92?(e.consume(m),b):b(m)}}function ml(e,t,n,r,l,a){const i=this;let s=0,o;return u;function u(p){return e.enter(r),e.enter(l),e.consume(p),e.exit(l),e.enter(a),d}function d(p){return s>999||p===null||p===91||p===93&&!o||p===94&&!s&&"_hiddenFootnoteSupport"in i.parser.constructs?n(p):p===93?(e.exit(a),e.enter(l),e.consume(p),e.exit(l),e.exit(r),t):F(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||F(p)||s++>999?(e.exit("chunkString"),d(p)):(e.consume(p),o||(o=!U(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),s++,f):f(p)}}function gl(e,t,n,r,l,a){let i;return s;function s(h){return h===34||h===39||h===40?(e.enter(r),e.enter(l),e.consume(h),e.exit(l),i=h===40?41:h,o):n(h)}function o(h){return h===i?(e.enter(l),e.consume(h),e.exit(l),e.exit(r),t):(e.enter(a),u(h))}function u(h){return h===i?(e.exit(a),o(i)):h===null?n(h):F(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),V(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===i||h===null||F(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===i||h===92?(e.consume(h),d):d(h)}}function ft(e,t){let n;return r;function r(l){return F(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,r):U(l)?V(e,r,n?"linePrefix":"lineSuffix")(l):t(l)}}const yu={name:"definition",tokenize:vu},wu={partial:!0,tokenize:Su};function vu(e,t,n){const r=this;let l;return a;function a(p){return e.enter("definition"),i(p)}function i(p){return ml.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return l=be(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),o):n(p)}function o(p){return K(p)?ft(e,u)(p):u(p)}function u(p){return hl(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(wu,f,f)(p)}function f(p){return U(p)?V(e,h,"whitespace")(p):h(p)}function h(p){return p===null||F(p)?(e.exit("definition"),r.parser.defined.push(l),t(p)):n(p)}}function Su(e,t,n){return r;function r(s){return K(s)?ft(e,l)(s):n(s)}function l(s){return gl(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return U(s)?V(e,i,"whitespace")(s):i(s)}function i(s){return s===null||F(s)?t(s):n(s)}}const ju={name:"hardBreakEscape",tokenize:Cu};function Cu(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),l}function l(a){return F(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const Nu={name:"headingAtx",resolve:Eu,tokenize:Au};function Eu(e,t){let n=e.length-2,r=3;if(e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r){const l={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"};xe(e,r,n-r+1,[["enter",l,t],["enter",a,t],["exit",a,t],["exit",l,t]])}return e}function Au(e,t,n){let r=0;return l;function l(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),i(d)}function i(d){return d===35&&r++<6?(e.consume(d),i):d===null||K(d)?(e.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(e.enter("atxHeadingSequence"),o(d)):d===null||F(d)?(e.exit("atxHeading"),t(d)):U(d)?V(e,s,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function o(d){return d===35?(e.consume(d),o):(e.exit("atxHeadingSequence"),s(d))}function u(d){return d===null||d===35||K(d)?(e.exit("atxHeadingText"),s(d)):(e.consume(d),u)}}const xl=["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"],Pn=["pre","script","style","textarea"],Iu={concrete:!0,name:"htmlFlow",resolveTo:Tu,tokenize:Mu},Pu={partial:!0,tokenize:Du};function Tu(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Mu(e,t,n){const r=this;let l,a,i,s,o;return u;function u(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),f}function f(k){return k===33?(e.consume(k),h):k===47?(e.consume(k),a=!0,b):k===63?(e.consume(k),l=3,r.interrupt?t:x):ie(k)?(e.consume(k),i=String.fromCharCode(k),w):n(k)}function h(k){return k===45?(e.consume(k),l=2,p):k===91?(e.consume(k),l=5,s=0,g):ie(k)?(e.consume(k),l=4,r.interrupt?t:x):n(k)}function p(k){return k===45?(e.consume(k),r.interrupt?t:x):n(k)}function g(k){const ge="CDATA[";return k===ge.charCodeAt(s++)?(e.consume(k),s===ge.length?r.interrupt?t:z:g):n(k)}function b(k){return ie(k)?(e.consume(k),i=String.fromCharCode(k),w):n(k)}function w(k){if(k===null||k===47||k===62||K(k)){const ge=k===47,Ge=i.toLowerCase();return!ge&&!a&&Pn.includes(Ge)?(l=1,r.interrupt?t(k):z(k)):xl.includes(i.toLowerCase())?(l=6,ge?(e.consume(k),m):r.interrupt?t(k):z(k)):(l=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):a?y(k):v(k))}return k===45||le(k)?(e.consume(k),i+=String.fromCharCode(k),w):n(k)}function m(k){return k===62?(e.consume(k),r.interrupt?t:z):n(k)}function y(k){return U(k)?(e.consume(k),y):j(k)}function v(k){return k===47?(e.consume(k),j):k===58||k===95||ie(k)?(e.consume(k),N):U(k)?(e.consume(k),v):j(k)}function N(k){return k===45||k===46||k===58||k===95||le(k)?(e.consume(k),N):E(k)}function E(k){return k===61?(e.consume(k),S):U(k)?(e.consume(k),E):v(k)}function S(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),o=k,A):U(k)?(e.consume(k),S):L(k)}function A(k){return k===o?(e.consume(k),o=null,O):k===null||F(k)?n(k):(e.consume(k),A)}function L(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||K(k)?E(k):(e.consume(k),L)}function O(k){return k===47||k===62||U(k)?v(k):n(k)}function j(k){return k===62?(e.consume(k),I):n(k)}function I(k){return k===null||F(k)?z(k):U(k)?(e.consume(k),I):n(k)}function z(k){return k===45&&l===2?(e.consume(k),W):k===60&&l===1?(e.consume(k),G):k===62&&l===4?(e.consume(k),Q):k===63&&l===3?(e.consume(k),x):k===93&&l===5?(e.consume(k),ae):F(k)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(Pu,ne,q)(k)):k===null||F(k)?(e.exit("htmlFlowData"),q(k)):(e.consume(k),z)}function q(k){return e.check(In,M,ne)(k)}function M(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),R}function R(k){return k===null||F(k)?q(k):(e.enter("htmlFlowData"),z(k))}function W(k){return k===45?(e.consume(k),x):z(k)}function G(k){return k===47?(e.consume(k),i="",J):z(k)}function J(k){if(k===62){const ge=i.toLowerCase();return Pn.includes(ge)?(e.consume(k),Q):z(k)}return ie(k)&&i.length<8?(e.consume(k),i+=String.fromCharCode(k),J):z(k)}function ae(k){return k===93?(e.consume(k),x):z(k)}function x(k){return k===62?(e.consume(k),Q):k===45&&l===2?(e.consume(k),x):z(k)}function Q(k){return k===null||F(k)?(e.exit("htmlFlowData"),ne(k)):(e.consume(k),Q)}function ne(k){return e.exit("htmlFlow"),t(k)}}function Du(e,t,n){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(wt,t,n)}}const Lu={name:"htmlText",tokenize:zu};function zu(e,t,n){const r=this;let l,a,i;return s;function s(x){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(x),o}function o(x){return x===33?(e.consume(x),u):x===47?(e.consume(x),E):x===63?(e.consume(x),v):ie(x)?(e.consume(x),L):n(x)}function u(x){return x===45?(e.consume(x),d):x===91?(e.consume(x),a=0,g):ie(x)?(e.consume(x),y):n(x)}function d(x){return x===45?(e.consume(x),p):n(x)}function f(x){return x===null?n(x):x===45?(e.consume(x),h):F(x)?(i=f,G(x)):(e.consume(x),f)}function h(x){return x===45?(e.consume(x),p):f(x)}function p(x){return x===62?W(x):x===45?h(x):f(x)}function g(x){const Q="CDATA[";return x===Q.charCodeAt(a++)?(e.consume(x),a===Q.length?b:g):n(x)}function b(x){return x===null?n(x):x===93?(e.consume(x),w):F(x)?(i=b,G(x)):(e.consume(x),b)}function w(x){return x===93?(e.consume(x),m):b(x)}function m(x){return x===62?W(x):x===93?(e.consume(x),m):b(x)}function y(x){return x===null||x===62?W(x):F(x)?(i=y,G(x)):(e.consume(x),y)}function v(x){return x===null?n(x):x===63?(e.consume(x),N):F(x)?(i=v,G(x)):(e.consume(x),v)}function N(x){return x===62?W(x):v(x)}function E(x){return ie(x)?(e.consume(x),S):n(x)}function S(x){return x===45||le(x)?(e.consume(x),S):A(x)}function A(x){return F(x)?(i=A,G(x)):U(x)?(e.consume(x),A):W(x)}function L(x){return x===45||le(x)?(e.consume(x),L):x===47||x===62||K(x)?O(x):n(x)}function O(x){return x===47?(e.consume(x),W):x===58||x===95||ie(x)?(e.consume(x),j):F(x)?(i=O,G(x)):U(x)?(e.consume(x),O):W(x)}function j(x){return x===45||x===46||x===58||x===95||le(x)?(e.consume(x),j):I(x)}function I(x){return x===61?(e.consume(x),z):F(x)?(i=I,G(x)):U(x)?(e.consume(x),I):O(x)}function z(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),l=x,q):F(x)?(i=z,G(x)):U(x)?(e.consume(x),z):(e.consume(x),M)}function q(x){return x===l?(e.consume(x),l=void 0,R):x===null?n(x):F(x)?(i=q,G(x)):(e.consume(x),q)}function M(x){return x===null||x===34||x===39||x===60||x===61||x===96?n(x):x===47||x===62||K(x)?O(x):(e.consume(x),M)}function R(x){return x===47||x===62||K(x)?O(x):n(x)}function W(x){return x===62?(e.consume(x),e.exit("htmlTextData"),e.exit("htmlText"),t):n(x)}function G(x){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),J}function J(x){return U(x)?V(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):ae(x)}function ae(x){return e.enter("htmlTextData"),i(x)}}const lr={name:"labelEnd",resolveAll:_u,resolveTo:Bu,tokenize:$u},Fu={tokenize:Uu},Ru={tokenize:Hu},Ou={tokenize:qu};function _u(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const l=r.type==="labelImage"?4:2;r.type="data",t+=l}}return e.length!==n.length&&xe(e,0,e.length,n),e}function Bu(e,t){let n=e.length,r=0,l,a,i;for(;n--;){const d=e[n][1];if(l){if(d.type==="link"||d.type==="labelLink"&&d._inactive)break;e[n][0]==="enter"&&d.type==="labelLink"&&(d._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(d.type==="labelImage"||d.type==="labelLink")&&!d._balanced&&(l=n,d.type!=="labelLink")){r=2;break}}else d.type==="labelEnd"&&(a=n)}const s={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},o={type:"label",start:{...e[l][1].start},end:{...e[a][1].end}},u={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[a-2][1].start}};return i=[["enter",s,t],["enter",o,t]],i=he(i,e.slice(l+1,l+r+3)),i=he(i,[["enter",u,t]]),i=he(i,Vt(t.parser.constructs.insideSpan.null,e.slice(l+r+4,a-3),t)),i=he(i,[["exit",u,t],e[a-2],e[a-1],["exit",o,t]]),i=he(i,e.slice(a+1)),i=he(i,[["exit",s,t]]),xe(e,l,e.length,i),e}function $u(e,t,n){const r=this,l=r._labelStarts;let a,i;if(l){for(;l.length>0&&l[l.length-1]._balanced;)l.pop();a=l[l.length-1]}return s;function s(h){return a?a._inactive?f(h):(i=r.parser.defined.includes(be(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),o):n(h)}function o(h){return h===40?e.attempt(Fu,d,i?d:f)(h):h===91?e.attempt(Ru,d,i?u:f)(h):i?d(h):f(h)}function u(h){return e.attempt(Ou,d,f)(h)}function d(h){return l.pop(),t(h)}function f(h){return a._balanced=!0,n(h)}}function Uu(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),l}function l(f){return K(f)?ft(e,a)(f):a(f)}function a(f){return f===41?d(f):hl(e,i,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function i(f){return K(f)?ft(e,o)(f):d(f)}function s(f){return n(f)}function o(f){return f===34||f===39||f===40?gl(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return K(f)?ft(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function Hu(e,t,n){const r=this;return l;function l(s){return ml.call(r,e,a,i,"reference","referenceMarker","referenceString")(s)}function a(s){return r.parser.defined.includes(be(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function i(s){return n(s)}}function qu(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),l}function l(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const Vu={name:"labelStartImage",resolveAll:lr.resolveAll,tokenize:Wu};function Wu(e,t,n){const r=this;let l;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),l=e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(l),t(o))}}const Gu={name:"labelStartLink",resolveAll:lr.resolveAll,tokenize:Yu};function Yu(e,t,n){const r=this;let l;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),l=e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(l),t(s))}}const ln={name:"lineEnding",tokenize:Ku};function Ku(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),V(e,t,"linePrefix")}}const Pt={name:"thematicBreak",tokenize:Qu};function Qu(e,t,n){let r=0,l;return a;function a(u){return e.enter("thematicBreak"),i(u)}function i(u){return l=u,s(u)}function s(u){return u===l?(e.enter("thematicBreakSequence"),o(u)):r>=3&&(u===null||F(u))?(e.exit("thematicBreak"),t(u)):n(u)}function o(u){return u===l?(e.consume(u),r++,o):(e.exit("thematicBreakSequence"),U(u)?V(e,s,"whitespace")(u):s(u))}}const ce={continuation:{tokenize:ec},exit:nc,name:"list",tokenize:Zu},Xu={partial:!0,tokenize:rc},Ju={partial:!0,tokenize:tc};function Zu(e,t,n){const r=this,l=r.events[r.events.length-1];let a=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,i=0;return s;function s(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:En(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Pt,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),o(p)}return n(p)}function o(p){return En(p)&&++i<10?(e.consume(p),o):(!r.interrupt||i<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(wt,r.interrupt?n:d,e.attempt(Xu,h,f))}function d(p){return r.containerState.initialBlankLine=!0,a++,h(p)}function f(p){return U(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function ec(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(wt,l,a);function l(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,V(e,t,"listItemIndent",r.containerState.size+1)(s)}function a(s){return r.containerState.furtherBlankLines||!U(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ju,t,i)(s))}function i(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,V(e,e.attempt(ce,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function tc(e,t,n){const r=this;return V(e,l,"listItemIndent",r.containerState.size+1);function l(a){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(a):n(a)}}function nc(e){e.exit(this.containerState.type)}function rc(e,t,n){const r=this;return V(e,l,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(a){const i=r.events[r.events.length-1];return!U(a)&&i&&i[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Yr={name:"setextUnderline",resolveTo:ic,tokenize:lc};function ic(e,t){const n=new Dt;let r=e.length,l,a,i;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(a=r)}else e[r][1].type==="content"&&n.add(r,1,[]),!i&&e[r][1].type==="definition"&&(i=r);const s={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(n.add(a,0,[["enter",s,t]]),n.add(i+1,0,[["exit",e[l][1],t]]),e[l][1].end={...e[i][1].end}):e[l][1]=s,n.add(e.length,0,[["exit",s,t]]),n.consume(e),e}function lc(e,t,n){const r=this;let l;return a;function a(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),l=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===l?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),U(u)?V(e,o,"lineSuffix")(u):o(u))}function o(u){return u===null||F(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ac={tokenize:sc};function sc(e){const t=this,n=e.attempt(wt,r,e.attempt(this.parser.constructs.flowInitial,l,V(e,e.attempt(this.parser.constructs.flow,l,e.attempt(mu,l)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const oc={resolveAll:kl()},uc=bl("string"),cc=bl("text");function bl(e){return{resolveAll:kl(e==="text"?dc:void 0),tokenize:t};function t(n){const r=this,l=this.parser.constructs[e],a=n.attempt(l,i,s);return i;function i(d){return u(d)?a(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),o}function o(d){return u(d)?(n.exit("data"),a(d)):(n.consume(d),o)}function u(d){if(d===null)return!0;const f=l[d];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function kl(e){return t;function t(n,r){let l=-1,a;for(;++l<=n.length;)a===void 0?n[l]&&n[l][1].type==="data"&&(a=l,l++):(!n[l]||n[l][1].type!=="data")&&(l!==a+2&&(n[a][1].end=n[l-1][1].end,n.splice(a+2,l-a-2),l=a+2),a=void 0);return e?e(n,r):n}}function dc(e,t){const n=new Dt;let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const l=e[r-1][1],a=t.sliceStream(l);let i=a.length,s=-1,o=0,u;for(;i--;){const d=a[i];if(typeof d=="string"){for(s=d.length;d.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(d===-2)u=!0,o++;else if(d!==-1){i++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(o=0),o){const d={type:r===e.length||u||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:l.start._bufferIndex+s,_index:l.start._index+i,line:l.end.line,column:l.end.column-o,offset:l.end.offset-o},end:{...l.end}};l.end={...d.start},l.start.offset===l.end.offset?Object.assign(l,d):n.add(r,0,[["enter",d,t],["exit",d,t]])}r++}return n.consume(e),e}const fc={42:ce,43:ce,45:ce,48:ce,49:ce,50:ce,51:ce,52:ce,53:ce,54:ce,55:ce,56:ce,57:ce,62:cl},pc={91:yu},hc={[-2]:rn,[-1]:rn,32:rn},mc={35:Nu,42:Pt,45:[Yr,Pt],60:Iu,61:Yr,95:Pt,96:Gr,126:Gr},gc={38:fl,92:dl},xc={[-5]:ln,[-4]:ln,[-3]:ln,33:Vu,38:fl,42:An,60:[Qo,Lu],91:Gu,92:[ju,dl],93:lr,95:An,96:uu},bc={null:[An,oc]},kc={null:[42,95]},yc={null:[]},wc=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kc,contentInitial:pc,disable:yc,document:fc,flow:mc,flowInitial:hc,insideSpan:bc,string:gc,text:xc},Symbol.toStringTag,{value:"Module"}));function vc(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const l={},a=[];let i=[],s=[];const o={attempt:A(E),check:A(S),consume:y,enter:v,exit:N,interrupt:A(S,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:g,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:f};let d=t.tokenize.call(u,o);return t.resolveAll&&a.push(t),u;function f(I){return i=he(i,I),w(),i[i.length-1]!==null?[]:(L(t,0),u.events=Vt(a,u.events,u),u.events)}function h(I,z){return jc(p(I),z)}function p(I){return Sc(i,I)}function g(){const{_bufferIndex:I,_index:z,line:q,column:M,offset:R}=r;return{_bufferIndex:I,_index:z,line:q,column:M,offset:R}}function b(I){l[I.line]=I.column,j()}function w(){for(;r._index<i.length;){const I=i[r._index];if(typeof I=="string"){const z=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<I.length;)m(I.charCodeAt(r._bufferIndex))}else m(I)}}function m(I){d=d(I)}function y(I){F(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,j()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=I}function v(I,z){const q=z||{};return q.type=I,q.start=g(),u.events.push(["enter",q,u]),s.push(q),q}function N(I){const z=s.pop();return z.end=g(),u.events.push(["exit",z,u]),z}function E(I,z){L(I,z.from)}function S(I,z){z.restore()}function A(I,z){return q;function q(M,R,W){let G,J,ae,x;return Array.isArray(M)?ne(M):"tokenize"in M?ne([M]):Q(M);function Q(re){return rt;function rt(Me){const Ye=Me!==null&&re[Me],Ke=Me!==null&&re.null,Zt=[...Array.isArray(Ye)?Ye:Ye?[Ye]:[],...Array.isArray(Ke)?Ke:Ke?[Ke]:[]];return ne(Zt)(Me)}}function ne(re){return G=re,J=0,re.length===0?W:k(re[J])}function k(re){return rt;function rt(Me){return x=O(),ae=re,re.partial||(u.currentConstruct=re),re.name&&u.parser.constructs.disable.null.includes(re.name)?Ge():re.tokenize.call(z?Object.assign(Object.create(u),z):u,o,ge,Ge)(Me)}}function ge(re){return I(ae,x),R}function Ge(re){return x.restore(),++J<G.length?k(G[J]):W}}}function L(I,z){I.resolveAll&&!a.includes(I)&&a.push(I),I.resolve&&xe(u.events,z,u.events.length-z,I.resolve(u.events.slice(z),u)),I.resolveTo&&(u.events=I.resolveTo(u.events,u))}function O(){const I=g(),z=u.previous,q=u.currentConstruct,M=u.events.length,R=Array.from(s);return{from:M,restore:W};function W(){r=I,u.previous=z,u.currentConstruct=q,u.events.length=M,s=R,j()}}function j(){r.line in l&&r.column<2&&(r.column=l[r.line],r.offset+=l[r.line]-1)}}function Sc(e,t){const n=t.start._index,r=t.start._bufferIndex,l=t.end._index,a=t.end._bufferIndex;let i;if(n===l)i=[e[n].slice(r,a)];else{if(i=e.slice(n,l),r>-1){const s=i[0];typeof s=="string"?i[0]=s.slice(r):i.shift()}a>0&&i.push(e[l].slice(0,a))}return i}function jc(e,t){let n=-1;const r=[];let l;for(;++n<e.length;){const a=e[n];let i;if(typeof a=="string")i=a;else switch(a){case-5:{i="\r";break}case-4:{i=`
3
+ `;break}case-3:{i=`\r
4
+ `;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&l)continue;i=" ";break}default:i=String.fromCharCode(a)}l=a===-2,r.push(i)}return r.join("")}function Cc(e){const r={constructs:al([wc,...(e||{}).extensions||[]]),content:l(Ho),defined:[],document:l(Vo),flow:l(ac),lazy:{},string:l(uc),text:l(cc)};return r;function l(a){return i;function i(s){return vc(r,a,s)}}}function Nc(e){for(;!pl(e););return e}const Kr=/[\0\t\n\r]/g;function Ec(){let e=1,t="",n=!0,r;return l;function l(a,i,s){a=t+(typeof a=="string"?a.toString():new TextDecoder(i||void 0).decode(a));const o=[];let u=0;for(t="",n&&(a.charCodeAt(0)===65279&&u++,n=void 0);u<a.length;){Kr.lastIndex=u;const d=Kr.exec(a),f=d&&d.index!==void 0?d.index:a.length,h=a.charCodeAt(f);if(!d){t=a.slice(u);break}if(h===10&&u===f&&r)o.push(-3),r=void 0;else switch(r&&(o.push(-5),r=void 0),u<f&&(o.push(a.slice(u,f)),e+=f-u),h){case 0:{o.push(65533),e++;break}case 9:{const p=Math.ceil(e/4)*4;for(o.push(-2);e++<p;)o.push(-1);break}case 10:{o.push(-4),e=1;break}default:r=!0,e=1}u=f+1}return s&&(r&&o.push(-5),t&&o.push(t),o.push(null)),o}}const Ac=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ic(e){return e.replace(Ac,Pc)}function Pc(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const l=n.charCodeAt(1),a=l===120||l===88;return sl(n.slice(a?2:1),a?16:10)}return ir(n)||e}const yl={}.hasOwnProperty;function Tc(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Mc(n)(Nc(Cc(n).document().write(Ec()(e,t,!0))))}function Mc(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Nr),autolinkProtocol:j,autolinkEmail:j,atxHeading:i(Sr),blockQuote:i(Zt),characterEscape:j,characterReference:j,codeFenced:i(vr),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(vr,s),codeText:i(xa,s),codeTextData:j,data:j,codeFlowValue:j,definition:i(ba),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ka),hardBreakEscape:i(jr),hardBreakTrailing:i(jr),htmlFlow:i(Cr,s),htmlFlowData:j,htmlText:i(Cr,s),htmlTextData:j,image:i(ya),label:s,link:i(Nr),listItem:i(wa),listItemValue:p,listOrdered:i(Er,h),listUnordered:i(Er),paragraph:i(va),reference:ge,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(Sr),strong:i(Sa),thematicBreak:i(Ca)},exit:{atxHeading:u(),atxHeadingSequence:S,autolink:u(),autolinkEmail:Ke,autolinkProtocol:Ye,blockQuote:u(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:rt,characterReference:Me,codeFenced:u(m),codeFencedFence:w,codeFencedFenceInfo:g,codeFencedFenceMeta:b,codeFlowValue:I,codeIndented:u(y),codeText:u(W),codeTextData:I,data:I,definition:u(),definitionDestinationString:E,definitionLabelString:v,definitionTitleString:N,emphasis:u(),hardBreakEscape:u(q),hardBreakTrailing:u(q),htmlFlow:u(M),htmlFlowData:I,htmlText:u(R),htmlTextData:I,image:u(J),label:x,labelText:ae,lineEnding:z,link:u(G),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:Ge,resourceDestinationString:Q,resourceTitleString:ne,resource:k,setextHeading:u(O),setextHeadingLineSequence:L,setextHeadingText:A,strong:u(),thematicBreak:u()}};wl(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(C){let T={type:"root",children:[],position:void 0};const B={stack:[T],tokenStack:[],config:t,enter:o,exit:d,buffer:s,resume:f,data:n},$=[],oe=[];let X=-1;for(;++X<C.length;)if(oe.push(C[X]),C[X][1].type==="listOrdered"||C[X][1].type==="listUnordered")if(C[X][0]==="enter")$.push(oe.length-1);else{const ue=$.pop();a(oe,ue)}for(C=oe,X=-1;++X<C.length;){const ue=t[C[X][0]];C[X][0]==="enter"&&t.beforeEnter.length>0&&l(t.beforeEnter,{...B,sliceSerialize:C[X][2].sliceSerialize},C[X][1]),yl.call(ue,C[X][1].type)&&ue[C[X][1].type].call({...B,sliceSerialize:C[X][2].sliceSerialize},C[X][1]),C[X][0]==="exit"&&t.afterExit.length>0&&l(t.afterExit,{...B,sliceSerialize:C[X][2].sliceSerialize},C[X][1])}if(B.tokenStack.length>0){const ue=B.tokenStack[B.tokenStack.length-1];(ue[1]||Qr).call(B,void 0,ue[0])}for(T.position={start:De(C.length>0?C[0][1].start:{line:1,column:1,offset:0}),end:De(C.length>0?C[C.length-2][1].end:{line:1,column:1,offset:0})},X=-1;++X<t.transforms.length;)T=t.transforms[X](T)||T;return T}function l(C,T,B){let $=-1;for(;++$<C.length;)C[$].call(T,B)}function a(C,T){const B=C.length-1;let $=T-1,oe=-1,X=!1,ue,we,it,lt;const at=[];for(;++$<=B;){const fe=C[$];switch(fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{fe[0]==="enter"?oe++:oe--,lt=void 0;break}case"lineEndingBlank":{fe[0]==="enter"&&(ue&&!lt&&!oe&&!it&&(it=$),lt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:lt=void 0}if(!oe&&fe[0]==="enter"&&fe[1].type==="listItemPrefix"||oe===-1&&fe[0]==="exit"&&(fe[1].type==="listUnordered"||fe[1].type==="listOrdered")){if(ue){let Qe=$;for(we=void 0;Qe--;){const Ne=C[Qe];if(Ne[1].type==="lineEnding"||Ne[1].type==="lineEndingBlank"){if(Ne[0]==="exit")continue;we&&(C[we][1].type="lineEndingBlank",X=!0),Ne[1].type="lineEnding",we=Qe}else if(!(Ne[1].type==="linePrefix"||Ne[1].type==="blockQuotePrefix"||Ne[1].type==="blockQuotePrefixWhitespace"||Ne[1].type==="blockQuoteMarker"||Ne[1].type==="listItemIndent"))break}it&&(!we||it<we)&&(ue._spread=!0),ue.end=Object.assign({},we?C[we][1].start:fe[1].end),at.push({at:we||$,event:["exit",ue,fe[2]]})}if(fe[1].type==="listItemPrefix"){const Qe={type:"listItem",_spread:!1,start:Object.assign({},fe[1].start),end:void 0};ue=Qe,at.push({at:$,event:["enter",Qe,fe[2]]}),it=void 0,lt=!0}}}const Ar=C.splice(T);let en=0;for($=-1;++$<Ar.length;){for(;en<at.length&&at[en].at===T+$;)C.push(at[en++].event);C.push(Ar[$])}C[T][1]._spread=X}function i(C,T){return B;function B($){o.call(this,C($),$),T&&T.call(this,$)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(C,T,B){this.stack[this.stack.length-1].children.push(C),this.stack.push(C),this.tokenStack.push([T,B||void 0]),C.position={start:De(T.start),end:void 0}}function u(C){return T;function T(B){C&&C.call(this,B),d.call(this,B)}}function d(C,T){const B=this.stack.pop(),$=this.tokenStack.pop();if(!$)throw new Error("Cannot close `"+C.type+"` ("+dt({start:C.start,end:C.end})+"): it’s not open");$[0].type!==C.type&&(T?T.call(this,C,$[0]):($[1]||Qr).call(this,C,$[0])),B.position.end=De(C.end)}function f(){return qt(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(C){if(this.data.expectingFirstListItemValue){const T=this.stack[this.stack.length-2];T.start=Number.parseInt(this.sliceSerialize(C),10),this.data.expectingFirstListItemValue=void 0}}function g(){const C=this.resume(),T=this.stack[this.stack.length-1];T.lang=C}function b(){const C=this.resume(),T=this.stack[this.stack.length-1];T.meta=C}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function m(){const C=this.resume(),T=this.stack[this.stack.length-1];T.value=C.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const C=this.resume(),T=this.stack[this.stack.length-1];T.value=C.replace(/(\r?\n|\r)$/g,"")}function v(C){const T=this.resume(),B=this.stack[this.stack.length-1];B.label=T,B.identifier=be(this.sliceSerialize(C)).toLowerCase()}function N(){const C=this.resume(),T=this.stack[this.stack.length-1];T.title=C}function E(){const C=this.resume(),T=this.stack[this.stack.length-1];T.url=C}function S(C){const T=this.stack[this.stack.length-1];if(!T.depth){const B=this.sliceSerialize(C).length;T.depth=B}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function L(C){const T=this.stack[this.stack.length-1];T.depth=this.sliceSerialize(C).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function j(C){const B=this.stack[this.stack.length-1].children;let $=B[B.length-1];(!$||$.type!=="text")&&($=ja(),$.position={start:De(C.start),end:void 0},B.push($)),this.stack.push($)}function I(C){const T=this.stack.pop();T.value+=this.sliceSerialize(C),T.position.end=De(C.end)}function z(C){const T=this.stack[this.stack.length-1];if(this.data.atHardBreak){const B=T.children[T.children.length-1];B.position.end=De(C.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(T.type)&&(j.call(this,C),I.call(this,C))}function q(){this.data.atHardBreak=!0}function M(){const C=this.resume(),T=this.stack[this.stack.length-1];T.value=C}function R(){const C=this.resume(),T=this.stack[this.stack.length-1];T.value=C}function W(){const C=this.resume(),T=this.stack[this.stack.length-1];T.value=C}function G(){const C=this.stack[this.stack.length-1];if(this.data.inReference){const T=this.data.referenceType||"shortcut";C.type+="Reference",C.referenceType=T,delete C.url,delete C.title}else delete C.identifier,delete C.label;this.data.referenceType=void 0}function J(){const C=this.stack[this.stack.length-1];if(this.data.inReference){const T=this.data.referenceType||"shortcut";C.type+="Reference",C.referenceType=T,delete C.url,delete C.title}else delete C.identifier,delete C.label;this.data.referenceType=void 0}function ae(C){const T=this.sliceSerialize(C),B=this.stack[this.stack.length-2];B.label=Ic(T),B.identifier=be(T).toLowerCase()}function x(){const C=this.stack[this.stack.length-1],T=this.resume(),B=this.stack[this.stack.length-1];if(this.data.inReference=!0,B.type==="link"){const $=C.children;B.children=$}else B.alt=T}function Q(){const C=this.resume(),T=this.stack[this.stack.length-1];T.url=C}function ne(){const C=this.resume(),T=this.stack[this.stack.length-1];T.title=C}function k(){this.data.inReference=void 0}function ge(){this.data.referenceType="collapsed"}function Ge(C){const T=this.resume(),B=this.stack[this.stack.length-1];B.label=T,B.identifier=be(this.sliceSerialize(C)).toLowerCase(),this.data.referenceType="full"}function re(C){this.data.characterReferenceType=C.type}function rt(C){const T=this.sliceSerialize(C),B=this.data.characterReferenceType;let $;B?($=sl(T,B==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):$=ir(T);const oe=this.stack[this.stack.length-1];oe.value+=$}function Me(C){const T=this.stack.pop();T.position.end=De(C.end)}function Ye(C){I.call(this,C);const T=this.stack[this.stack.length-1];T.url=this.sliceSerialize(C)}function Ke(C){I.call(this,C);const T=this.stack[this.stack.length-1];T.url="mailto:"+this.sliceSerialize(C)}function Zt(){return{type:"blockquote",children:[],position:void 0}}function vr(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function xa(){return{type:"inlineCode",value:"",position:void 0}}function ba(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function ka(){return{type:"emphasis",children:[],position:void 0}}function Sr(){return{type:"heading",depth:0,children:[],position:void 0}}function jr(){return{type:"break",position:void 0}}function Cr(){return{type:"html",value:"",position:void 0}}function ya(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function Nr(){return{type:"link",title:null,url:"",children:[],position:void 0}}function Er(C){return{type:"list",ordered:C.type==="listOrdered",start:null,spread:C._spread,children:[],position:void 0}}function wa(C){return{type:"listItem",spread:C._spread,checked:null,children:[],position:void 0}}function va(){return{type:"paragraph",children:[],position:void 0}}function Sa(){return{type:"strong",children:[],position:void 0}}function ja(){return{type:"text",value:"",position:void 0}}function Ca(){return{type:"thematicBreak",position:void 0}}}function De(e){return{line:e.line,column:e.column,offset:e.offset}}function wl(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?wl(e,r):Dc(e,r)}}function Dc(e,t){let n;for(n in t)if(yl.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"afterExit":case"beforeEnter":{const r=t[n];r&&e[n].push(r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Qr(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+dt({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+dt({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+dt({start:t.start,end:t.end})+") is still open")}function Lc(e){const t=this;t.parser=n;function n(r){return Tc(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function zc(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Fc(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
5
+ `}]}function Rc(e,t){const n=t.value?t.value+`
6
+ `:"",r={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(r.className=["language-"+l[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function Oc(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _c(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Bc(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),l=nt(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let i,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=a+1,s+=1,e.footnoteCounts.set(r,s);const o={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+l,id:n+"fnref-"+l+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,o);const u={type:"element",tagName:"sup",properties:{},children:[o]};return e.patch(t,u),e.applyData(t,u)}function $c(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Uc(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function vl(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const l=e.all(t),a=l[0];a&&a.type==="text"?a.value="["+a.value:l.unshift({type:"text",value:"["});const i=l[l.length-1];return i&&i.type==="text"?i.value+=r:l.push({type:"text",value:r}),l}function Hc(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return vl(e,t);const l={src:nt(r.url||"")};t.alt!==null&&t.alt!==void 0&&(l.alt=t.alt),r.title!==null&&r.title!==void 0&&(l.title=r.title);const a={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,a),e.applyData(t,a)}function qc(e,t){const n={src:nt(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Vc(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Wc(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return vl(e,t);const l={href:nt(r.url||"")};r.title!==null&&r.title!==void 0&&(l.title=r.title);const a={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Gc(e,t){const n={href:nt(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Yc(e,t,n){const r=e.all(t),l=n?Kc(n):Sl(t),a={},i=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<r.length;){const d=r[s];(l||s!==0||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
7
+ `}),d.type==="element"&&d.tagName==="p"&&!l?i.push(...d.children):i.push(d)}const o=r[r.length-1];o&&(l||o.type!=="element"||o.tagName!=="p")&&i.push({type:"text",value:`
8
+ `});const u={type:"element",tagName:"li",properties:a,children:i};return e.patch(t,u),e.applyData(t,u)}function Kc(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const{children:n}=e;let r=-1;for(;!t&&++r<n.length;)t=Sl(n[r])}return t}function Sl(e){const{spread:t}=e;return t??e.children.length>1}function Qc(e,t){const n={},r=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++l<r.length;){const i=r[l];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Xc(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Jc(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Zc(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ed(e,t){const n=e.all(t),r=n.shift(),l=[];if(r){const i={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],i),l.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=er(t.children[1]),o=Zi(t.children[t.children.length-1]);s&&o&&(i.position={start:s,end:o}),l.push(i)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,a),e.applyData(t,a)}function td(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,s=i?i.length:t.children.length;let o=-1;const u=[];for(;++o<s;){const f=t.children[o],h={},p=i?i[o]:void 0;p&&(h.align=p);let g={type:"element",tagName:a,properties:h,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function nd(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Xr=9,Jr=32;function rd(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),l=0;const a=[];for(;r;)a.push(Zr(t.slice(l,r.index),l>0,!0),r[0]),l=r.index+r[0].length,r=n.exec(t);return a.push(Zr(t.slice(l),l>0,!1)),a.join("")}function Zr(e,t,n){let r=0,l=e.length;if(t){let a=e.codePointAt(r);for(;a===Xr||a===Jr;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(l-1);for(;a===Xr||a===Jr;)l--,a=e.codePointAt(l-1)}return l>r?e.slice(r,l):""}function id(e,t){const n={type:"text",value:rd(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ld(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const ad={blockquote:zc,break:Fc,code:Rc,delete:Oc,emphasis:_c,footnoteReference:Bc,heading:$c,html:Uc,imageReference:Hc,image:qc,inlineCode:Vc,linkReference:Wc,link:Gc,listItem:Yc,list:Qc,paragraph:Xc,root:Jc,strong:Zc,table:ed,tableCell:nd,tableRow:td,text:id,thematicBreak:ld,toml:St,yaml:St,definition:St,footnoteDefinition:St};function St(){}const jl=-1,Wt=0,pt=1,Lt=2,ar=3,sr=4,or=5,ur=6,Cl=7,Nl=8,{defineProperty:sd}=Object,El=typeof self=="object"?self:globalThis,ei=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new El[e](t)},od=(e,t)=>{const n=(l,a)=>(e.set(a,l),l),r=l=>{if(e.has(l))return e.get(l);const[a,i]=t[l];switch(a){case Wt:case jl:return n(i,l);case pt:{const s=n([],l);for(const o of i)s.push(r(o));return s}case Lt:{const s=n({},l);for(const[o,u]of i){const d=r(o),f=r(u);d==="__proto__"?sd(s,d,{value:f,configurable:!0,enumerable:!0,writable:!0}):s[d]=f}return s}case ar:return n(new Date(i),l);case sr:{const{source:s,flags:o}=i;return n(new RegExp(s,o),l)}case or:{const s=n(new Map,l);for(const[o,u]of i)s.set(r(o),r(u));return s}case ur:{const s=n(new Set,l);for(const o of i)s.add(r(o));return s}case Cl:{const{name:s,message:o}=i;return n(typeof El[s]=="function"?ei(s,o):new Error(o),l)}case Nl:return n(BigInt(i),l);case"BigInt":return n(Object(BigInt(i)),l);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:s}=new Uint8Array(i);return n(new DataView(s),i)}case"-0":return-0}return n(ei(a,i),l)};return r},ti=e=>od(new Map,e)(0),Oe="",{toString:ud}={},{keys:cd,is:dd}=Object,ut=e=>{const t=typeof e;if(t!=="object"||!e)return[Wt,t];const n=ud.call(e).slice(8,-1);switch(n){case"Array":return[pt,Oe];case"Object":return[Lt,Oe];case"Date":return[ar,Oe];case"RegExp":return[sr,Oe];case"Map":return[or,Oe];case"Set":return[ur,Oe];case"DataView":return[pt,n]}return n.includes("Array")?[pt,n]:e instanceof Error?[Cl,e.name||"Error"]:[Lt,n]},jt=([e,t])=>e===Wt&&(t==="function"||t==="symbol"),fd=(e,t,n,r)=>{const l=(i,s)=>{const o=r.push(i)-1;return n.set(s,o),o},a=i=>{if(n.has(i))return n.get(i);let[s,o]=ut(i);switch(s){case Wt:{let d=i;switch(o){case"bigint":s=Nl,d=i.toString();break;case"number":if(!i&&dd(i,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+o);d=null;break;case"undefined":return l([jl],i)}return l([s,d],i)}case pt:{if(o){let h=i;return o==="DataView"?h=new Uint8Array(i.buffer):o==="ArrayBuffer"&&(h=new Uint8Array(i)),l([o,[...h]],i)}const d=[],f=l([s,d],i);for(const h of i)d.push(a(h));return f}case Lt:{if(o)switch(o){case"BigInt":return l([o,i.toString()],i);case"Boolean":case"Number":case"String":return l([o,i.valueOf()],i)}if(t&&"toJSON"in i)return a(i.toJSON());const d=[],f=l([s,d],i);for(const h of cd(i))(e||!jt(ut(i[h])))&&d.push([a(h),a(i[h])]);return f}case ar:return l([s,isNaN(i.getTime())?Oe:i.toISOString()],i);case sr:{const{source:d,flags:f}=i;return l([s,{source:d,flags:f}],i)}case or:{const d=[],f=l([s,d],i);for(const[h,p]of i)(e||!(jt(ut(h))||jt(ut(p))))&&d.push([a(h),a(p)]);return f}case ur:{const d=[],f=l([s,d],i);for(const h of i)(e||!jt(ut(h)))&&d.push(a(h));return f}}const{message:u}=i;return l([s,{name:o,message:u}],i)};return a},ni=(e,{json:t,lossy:n}={})=>{const r=[];return fd(!(t||n),!!t,new Map,r)(e),r},zt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ti(ni(e,t)):structuredClone(e):(e,t)=>ti(ni(e,t));function pd(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function hd(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function md(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||pd,r=e.options.footnoteBackLabel||hd,l=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],o=[];let u=-1;for(;++u<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[u]);d&&(s[u]=e.all(d))}for(u=-1;++u<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[u]);if(!d)continue;const f=s[u],h=String(d.identifier).toUpperCase(),p=nt(h.toLowerCase());let g=0;const b=[],w=e.footnoteCounts.get(h);for(;w!==void 0&&++g<=w;){b.length>0&&b.push({type:"text",value:" "});let v=typeof n=="string"?n:n(u,g);typeof v=="string"&&(v={type:"text",value:v}),b.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(g>1?"-"+g:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,g),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const m=f[f.length-1];if(m&&m.type==="element"&&m.tagName==="p"){const v=m.children[m.children.length-1];v&&v.type==="text"?v.value+=" ":m.children.push({type:"text",value:" "}),m.children.push(...b)}else f.push(...b);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(f,!0)};e.patch(d,y),o.push(y)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...zt(i),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
9
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
10
+ `}]}}const Gt=(function(e){if(e==null)return kd;if(typeof e=="function")return Yt(e);if(typeof e=="object")return Array.isArray(e)?gd(e):xd(e);if(typeof e=="string")return bd(e);throw new Error("Expected function, string, or object as test")});function gd(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Gt(e[n]);return Yt(r);function r(...l){let a=-1;for(;++a<t.length;)if(t[a].apply(this,l))return!0;return!1}}function xd(e){const t=e;return Yt(n);function n(r){const l=r;let a;for(a in e)if(l[a]!==t[a])return!1;return!0}}function bd(e){return Yt(t);function t(n){return n&&n.type===e}}function Yt(e){return t;function t(n,r,l){return!!(yd(n)&&e.call(this,n,typeof r=="number"?r:void 0,l||void 0))}}function kd(){return!0}function yd(e){return e!==null&&typeof e=="object"&&"type"in e}const Al=[],wd=!0,ht=!1,Tn="skip";function Mn(e,t,n,r){if(!e||typeof e!="object")throw new Error("Unexpected value `"+e+"` for `tree`, expected node");let l=!0,a,i,s,o;if(typeof n=="function"||n&&typeof n=="object"?(a=t,i=n,r&&(l=!1)):(i=t,n&&(l=!1)),typeof i=="function")s=i;else if(i&&typeof i=="object"){if(!(i.enter===null||i.enter===void 0))if(typeof i.enter=="function")s=i.enter;else throw new Error("Unexpected value `"+i.enter+"` for `visitors.enter`, expected optional visitor");if(typeof i.exit=="function")o=i.exit;else throw new Error("Unexpected value `"+i.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw new Error("Unexpected value `"+i+"` for `enter` or `visitors`, expected visitor or object with visitors");const u=Gt(a),d=l?1:-1;f(e,void 0,[])();function f(h,p,g){const b=h&&typeof h=="object"?h:{};if(typeof b.type=="string"){const m=typeof b.tagName=="string"?b.tagName:typeof b.name=="string"?b.name:void 0;Object.defineProperty(w,"name",{value:"node ("+(h.type+(m?"<"+m+">":""))+")"})}return w;function w(){const m=!a||u(h,p,g[g.length-1]||void 0);let y=Al;if(s&&m&&(y=ri(s(h,g,p)),y[0]===ht))return y;if("children"in h&&h.children){const v=h;if(v.children&&y[0]!==Tn){let N=(l?-1:v.children.length)+d;const E=[...g,v];for(;N>-1&&N<v.children.length;){const S=v.children[N],A=f(S,N,E)();if(A[0]===ht)return A;N=typeof A[1]=="number"?A[1]:N+d}}}if(o&&m){const v=ri(o(h,g,p));if(v[0]===Tn)throw new Error("Unexpected value `"+v[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(v[0]===ht||typeof v[1]=="number")return v}return y}}}function ri(e){return Array.isArray(e)?e:typeof e=="number"?[wd,e]:e==null?Al:[e]}function Kt(e,t,n,r){let l,a,i;a=t,i=n,typeof a=="function"?Mn(e,l,Dn(a),i):Mn(e,l,vd(a),i)}function vd(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?Dn(e.enter):e.enter,exit:typeof e.exit=="function"?Dn(e.exit):e.exit}}function Dn(e){return t;function t(n,r,l){return e(n,l,r[r.length-1])}}const Ln={}.hasOwnProperty,Sd={};function jd(e,t){const n=t||Sd,r=new Map,l=new Map,a=new Map,i={...ad,...n.handlers},s={all:u,applyData:Nd,definitionById:r,footnoteById:l,footnoteCounts:a,footnoteOrder:[],handlers:i,one:o,options:n,patch:Cd,wrap:Ad};return Kt(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=String(d.identifier).toUpperCase();d.type==="definition"?r.has(f)||r.set(f,d):l.has(f)||l.set(f,d)}}),s;function o(d,f){const{type:h}=d,p=s.handlers[h];if(Ln.call(s.handlers,h)&&p)return p(s,d,f);if(s.options.passThrough&&s.options.passThrough.includes(h)){if("children"in d){const{children:b,...w}=d;return{...zt(w),children:s.all(d)}}return zt(d)}return(s.options.unknownHandler||Ed)(s,d,f)}function u(d){const f=[];if("children"in d){const h=d.children;let p=-1;for(;++p<h.length;){const g=s.one(h[p],d);if(g){if(p&&h[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=ii(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=ii(b.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function Cd(e,t){e.position&&(t.position=ho(e))}function Nd(e,t){let n=t;if(e&&e.data){const{hChildren:r,hName:l,hProperties:a}=e.data;if(typeof l=="string")if(n.type==="element")n.tagName=l;else{const i="children"in n?n.children:[n];n={type:"element",tagName:l,properties:{},children:i}}n.type==="element"&&a&&Object.assign(n.properties,zt(a)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function Ed(e,t){const n=t.data||{},r="value"in t&&!(Ln.call(n,"hProperties")||Ln.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Ad(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
11
+ `});++r<e.length;)r&&n.push({type:"text",value:`
12
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
13
+ `}),n}function ii(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function li(e,t){const n=jd(e,t),r=n.one(e,void 0),l=md(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return l&&a.children.push({type:"text",value:`
14
+ `},l),a}function Id(e,t){return e&&"run"in e?async function(n,r){const l=li(n,{file:r,...t});await e.run(l,r)}:function(n,r){return li(n,{file:r,...e||t})}}function ai(e){if(e)throw e}var an,si;function Pd(){if(si)return an;si=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,l=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},a=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!f)return!1;var h;for(h in u);return typeof h>"u"||e.call(u,h)},i=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},s=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return an=function o(){var u,d,f,h,p,g,b=arguments[0],w=1,m=arguments.length,y=!1;for(typeof b=="boolean"&&(y=b,b=arguments[1]||{},w=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});w<m;++w)if(u=arguments[w],u!=null)for(d in u)f=s(b,d),h=s(u,d),b!==h&&(y&&h&&(a(h)||(p=l(h)))?(p?(p=!1,g=f&&l(f)?f:[]):g=f&&a(f)?f:{},i(b,{name:d,newValue:o(y,g,h)})):typeof h<"u"&&i(b,{name:d,newValue:h}));return b},an}var Td=Pd();const sn=Ia(Td);function zn(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Md(){const e=[],t={run:n,use:r};return t;function n(...l){let a=-1;const i=l.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);s(null,...l);function s(o,...u){const d=e[++a];let f=-1;if(o){i(o);return}for(;++f<l.length;)(u[f]===null||u[f]===void 0)&&(u[f]=l[f]);l=u,d?Dd(d,s)(...u):i(null,...u)}}function r(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function Dd(e,t){let n;return r;function r(...i){const s=e.length>i.length;let o;s&&i.push(l);try{o=e.apply(this,i)}catch(u){const d=u;if(s&&n)throw d;return l(d)}s||(o&&o.then&&typeof o.then=="function"?o.then(a,l):o instanceof Error?l(o):a(o))}function l(i,...s){n||(n=!0,t(i,...s))}function a(i){l(null,i)}}const ve={basename:Ld,dirname:zd,extname:Fd,join:Rd,sep:"/"};function Ld(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');vt(e);let n=0,r=-1,l=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(a){n=l+1;break}}else r<0&&(a=!0,r=l+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,s=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(a){n=l+1;break}}else i<0&&(a=!0,i=l+1),s>-1&&(e.codePointAt(l)===t.codePointAt(s--)?s<0&&(r=l):(s=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function zd(e){if(vt(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Fd(e){vt(e);let t=e.length,n=-1,r=0,l=-1,a=0,i;for(;t--;){const s=e.codePointAt(t);if(s===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),s===46?l<0?l=t:a!==1&&(a=1):l>-1&&(a=-1)}return l<0||n<0||a===0||a===1&&l===n-1&&l===r+1?"":e.slice(l,n)}function Rd(...e){let t=-1,n;for(;++t<e.length;)vt(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Od(n)}function Od(e){vt(e);const t=e.codePointAt(0)===47;let n=_d(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function _d(e,t){let n="",r=0,l=-1,a=0,i=-1,s,o;for(;++i<=e.length;){if(i<e.length)s=e.codePointAt(i);else{if(s===47)break;s=47}if(s===47){if(!(l===i-1||a===1))if(l!==i-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(o=n.lastIndexOf("/"),o!==n.length-1){o<0?(n="",r=0):(n=n.slice(0,o),r=n.length-1-n.lastIndexOf("/")),l=i,a=0;continue}}else if(n.length>0){n="",r=0,l=i,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(l+1,i):n=e.slice(l+1,i),r=i-l-1;l=i,a=0}else s===46&&a>-1?a++:a=-1}return n}function vt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Bd={cwd:$d};function $d(){return"/"}function Fn(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ud(e){if(typeof e=="string")e=new URL(e);else if(!Fn(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Hd(e)}function Hd(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(t)}const on=["history","path","basename","stem","extname","dirname"];class Il{constructor(t){let n;t?Fn(t)?n={path:t}:typeof t=="string"||qd(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Bd.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<on.length;){const a=on[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let l;for(l in n)on.includes(l)||(this[l]=n[l])}get basename(){return typeof this.path=="string"?ve.basename(this.path):void 0}set basename(t){cn(t,"basename"),un(t,"basename"),this.path=ve.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ve.dirname(this.path):void 0}set dirname(t){oi(this.basename,"dirname"),this.path=ve.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ve.extname(this.path):void 0}set extname(t){if(un(t,"extname"),oi(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ve.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Fn(t)&&(t=Ud(t)),cn(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ve.basename(this.path,this.extname):void 0}set stem(t){cn(t,"stem"),un(t,"stem"),this.path=ve.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const l=this.message(t,n,r);throw l.fatal=!0,l}info(t,n,r){const l=this.message(t,n,r);return l.fatal=void 0,l}message(t,n,r){const l=new Ht(t,n,r);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function un(e,t){if(e&&e.includes(ve.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ve.sep+"`")}function cn(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function oi(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function qd(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vd=(function(e){const r=this.constructor.prototype,l=r[e],a=function(){return l.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),Wd={}.hasOwnProperty;class cr extends Vd{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Md()}copy(){const t=new cr;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(sn(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(pn("data",this.frozen),this.namespace[t]=n,this):Wd.call(this.namespace,t)&&this.namespace[t]||void 0:t?(pn("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const l=n.call(t,...r);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Ct(t),r=this.parser||this.Parser;return dn("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),dn("process",this.parser||this.Parser),fn("process",this.compiler||this.Compiler),n?l(void 0,n):new Promise(l);function l(a,i){const s=Ct(t),o=r.parse(s);r.run(o,s,function(d,f,h){if(d||!f||!h)return u(d);const p=f,g=r.stringify(p,h);Kd(g)?h.value=g:h.result=g,u(d,h)});function u(d,f){d||!f?i(d):a?a(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),dn("processSync",this.parser||this.Parser),fn("processSync",this.compiler||this.Compiler),this.process(t,l),ci("processSync","process",n),r;function l(a,i){n=!0,ai(a),r=i}}run(t,n,r){ui(t),this.freeze();const l=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(i,s){const o=Ct(n);l.run(t,o,u);function u(d,f,h){const p=f||t;d?s(d):i?i(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,l;return this.run(t,n,a),ci("runSync","run",r),l;function a(i,s){ai(i),l=s,r=!0}}stringify(t,n){this.freeze();const r=Ct(n),l=this.compiler||this.Compiler;return fn("stringify",l),ui(t),l(t,r)}use(t,...n){const r=this.attachers,l=this.namespace;if(pn("use",this.frozen),t!=null)if(typeof t=="function")o(t,n);else if(typeof t=="object")Array.isArray(t)?s(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(u){if(typeof u=="function")o(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;o(d,f)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(u.plugins),u.settings&&(l.settings=sn(!0,l.settings,u.settings))}function s(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];a(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function o(u,d){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...g]=d;const b=r[h][1];zn(b)&&zn(p)&&(p=sn(!0,b,p)),r[h]=[u,p,...g]}}}}const Gd=new cr().freeze();function dn(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function fn(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function pn(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ui(e){if(!zn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ci(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ct(e){return Yd(e)?e:new Il(e)}function Yd(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Kd(e){return typeof e=="string"||Qd(e)}function Qd(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Xd="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",di=[],fi={allowDangerousHtml:!0},Jd=/^(https?|ircs?|mailto|xmpp)$/i,Zd=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function ef(e){const t=tf(e),n=nf(e);return rf(t.runSync(t.parse(n),n),e)}function tf(e){const t=e.rehypePlugins||di,n=e.remarkPlugins||di,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fi}:fi;return Gd().use(Lc).use(n).use(Id,r).use(t)}function nf(e){const t=e.children||"",n=new Il;return typeof t=="string"&&(n.value=t),n}function rf(e,t){const n=t.allowedElements,r=t.allowElement,l=t.components,a=t.disallowedElements,i=t.skipHtml,s=t.unwrapDisallowed,o=t.urlTransform||lf;for(const d of Zd)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Xd+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Kt(e,u),yo(e,{Fragment:c.Fragment,components:l,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return i?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in nn)if(Object.hasOwn(nn,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],b=nn[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=o(String(g||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):a?a.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return s&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function lf(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||n!==-1&&t>n||r!==-1&&t>r||Jd.test(e.slice(0,t))?e:""}function pi(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,l=n.indexOf(t);for(;l!==-1;)r++,l=n.indexOf(t,l+t.length);return r}function af(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function sf(e,t,n){const l=Gt((n||{}).ignore||[]),a=of(t);let i=-1;for(;++i<a.length;)Mn(e,s);function s(u,d,f){if(u.type==="text"&&typeof f=="number")return o(u,d,f);if(l(u,f,d[d.length-1]))return Tn}function o(u,d,f){const h=d[d.length-1],p=a[i][0],g=a[i][1];let b=0,w=!1,m=[];p.lastIndex=0;let y=p.exec(u.value);for(;y;){const N=y.index,E={index:y.index,input:y.input,stack:[...d,u]};let S=g(...y,E);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1)p.lastIndex=N+1;else{if(b!==N&&v({type:"text",value:u.value.slice(b,N)}),Array.isArray(S))for(const A of S)v(A);else S&&v(S);b=N+y[0].length,w=!0}if(!p.global)break;y=p.exec(u.value)}return w?(b<u.value.length&&v({type:"text",value:u.value.slice(b)}),h.children.splice(f,1,...m)):m=[u],f+m.length;function v(N){const E=m[m.length-1];E&&E.type==="text"&&N.type==="text"?E.value+=N.value:m.push(N)}}}function of(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=[],n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const l=n[r];t.push([uf(l[0]),cf(l[1])])}return t}function uf(e){return typeof e=="string"?new RegExp(af(e),"g"):e}function cf(e){return typeof e=="function"?e:function(){return e}}const hn="phrasing",mn=["autolink","link","image","label"];function df(){return{transforms:[bf],enter:{literalAutolink:pf,literalAutolinkEmail:gn,literalAutolinkHttp:gn,literalAutolinkWww:gn},exit:{literalAutolink:xf,literalAutolinkEmail:gf,literalAutolinkHttp:hf,literalAutolinkWww:mf}}}function ff(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:hn,notInConstruct:mn},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:hn,notInConstruct:mn},{character:":",before:"[ps]",after:"\\/",inConstruct:hn,notInConstruct:mn}]}}function pf(e){this.enter({type:"link",title:null,url:"",children:[],position:void 0},e)}function gn(e){this.config.enter.autolinkProtocol.call(this,e)}function hf(e){this.config.exit.autolinkProtocol.call(this,e)}function mf(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function gf(e){this.config.exit.autolinkEmail.call(this,e)}function xf(e){this.exit(e)}function bf(e){sf(e,[[new RegExp("(?<![\\da-z])(https?:\\/\\/|www(?=\\.))([\\w-]*\\.[\\w\\-.]*)([^\\t\\n\\r ]*)","gi"),kf],[new RegExp("(?<![\\w+\\-.@])xmpp:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)(\\/(?:[\\w\\-/]|\\.(?=[\\dA-Za-z]))*)?","g"),vf],[new RegExp("(?<![\\w+\\-.@])mailto:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),wf],[new RegExp("(?<![\\w+\\-.]|(?:^|[^\\d@A-Za-z])(?:mailto|xmpp):)([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),yf]],{ignore:["link","linkReference"]})}function kf(e,t,n,r,l){if(!Cf(l))return!1;let a="";if(/^w/i.test(t)&&(n=t+n,t="",a="http://"),yt(n.charCodeAt(0))||!Sf(n))return!1;const i=jf(n+r),s={type:"link",title:null,url:a+t+i[0],children:[{type:"text",value:t+i[0],position:void 0}],position:void 0};return i[1]?[s,{type:"text",value:i[1],position:void 0}]:s}function yf(e,t,n){return/[\d\-_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n,position:void 0}],position:void 0}}function wf(e,t,n){if(/[\d\-_]$/.test(n))return!1;const r="mailto:"+t+"@"+n;return{type:"link",title:null,url:r,children:[{type:"text",value:r,position:void 0}],position:void 0}}function vf(e,t,n,r,l){if(/[\d\-_]$/.test(n)||r&&(!/[A-Za-z]$/.test(r)||l.input.charAt(l.index+e.length)==="@"))return!1;const a="xmpp:"+t+"@"+n+(r||"");return{type:"link",title:null,url:a,children:[{type:"text",value:a,position:void 0}],position:void 0}}function Sf(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[\dA-Za-z]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[\dA-Za-z]/.test(t[t.length-2])))}function jf(e){let t=e.length;for(;t>0;){const i=e.charCodeAt(t-1);if(i===33||i===34||i===38||i===39||i===41||i===44||i===46||i===58||i===59||i===60||i===62||i===63||i===93||i===125)t--;else break}if(t===e.length)return[e,void 0];let n=e.slice(t);e=e.slice(0,t);let r=n.indexOf(")");const l=pi(e,"(");let a=pi(e,")");for(;r!==-1&&l>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function Cf(e){const t=e.input.charCodeAt(e.index-1);return e.index===0||$e(t)||yt(t)}Pl.peek=Lf;function Nf(){this.buffer()}function Ef(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Af(){this.buffer()}function If(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Pf(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=be(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Tf(e){this.exit(e)}function Mf(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=be(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Df(e){this.exit(e)}function Lf(){return"["}function Pl(e,t,n,r){const l=n.createTracker(r);let a=l.move("[^");const i=n.enter("footnoteReference"),s=n.enter("reference");return a+=l.move(n.safe(n.associationId(e),{after:"]",before:a})),s(),i(),a+=l.move("]"),a}function zf(){return{enter:{gfmFootnoteCallString:Nf,gfmFootnoteCall:Ef,gfmFootnoteDefinitionLabelString:Af,gfmFootnoteDefinition:If},exit:{gfmFootnoteCallString:Pf,gfmFootnoteCall:Tf,gfmFootnoteDefinitionLabelString:Mf,gfmFootnoteDefinition:Df}}}function Ff(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Pl},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,l,a,i){const s=a.createTracker(i);let o=s.move("[^");const u=a.enter("footnoteDefinition"),d=a.enter("label");return o+=s.move(a.safe(a.associationId(r),{before:o,after:"]"})),d(),o+=s.move("]:"),r.children&&r.children.length>0&&(s.shift(4),o+=s.move((t?`
15
+ `:" ")+a.indentLines(a.containerFlow(r,s.current()),t?Tl:Rf))),u(),o}}function Rf(e,t,n){return t===0?e:Tl(e,t,n)}function Tl(e,t,n){return(n?"":" ")+e}const Of=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];dr.attention=Hf;dr.peek=qf;function _f(){return{canContainEols:["delete"],enter:{strikethrough:$f},exit:{strikethrough:Uf}}}function Bf(){return{handlers:{delete:dr},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Of}]}}function $f(e){this.enter({type:"delete",children:[],position:void 0},e)}function Uf(e){this.exit(e)}function dr(e,t,n,r){const l=n.createTracker(r),a=n.stack.includes("strikethrough")?"~":"~~",i=n.enter("strikethrough");let s=l.move(a);return s+=n.containerPhrasing(e,{...l.current(),before:s,after:"~"}),s+=l.move(a),i(),s}function Hf(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function qf(){return"~"}function Vf(e){return e.length}function Wf(e,t){const n=t||{},r=(n.align||[]).concat(),l=n.stringLength||Vf,a=[],i=[],s=[],o=[];let u=0,d=-1;for(;++d<e.length;){const b=[],w=[];let m=-1;for(e[d].length>u&&(u=e[d].length);++m<e[d].length;){const y=Gf(e[d][m]);if(n.alignDelimiters!==!1){const v=l(y);w[m]=v,(o[m]===void 0||v>o[m])&&(o[m]=v)}b.push(y)}i[d]=b,s[d]=w}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)a[f]=hi(r[f]);else{const b=hi(r);for(;++f<u;)a[f]=b}f=-1;const h=[],p=[];for(;++f<u;){const b=a[f];let w="",m="";b===99?(w=":",m=":"):b===108?w=":":b===114&&(m=":");let y=n.alignDelimiters===!1?1:Math.max(1,o[f]-w.length-m.length);const v=w+"-".repeat(y)+m;n.alignDelimiters!==!1&&(y=w.length+y+m.length,y>o[f]&&(o[f]=y),p[f]=y),h[f]=v}i.splice(1,0,h),s.splice(1,0,p),d=-1;const g=[];for(;++d<i.length;){const b=i[d],w=s[d],m=n.fillRows===!1?Math.max(1,i[d===1?0:d].length):u;f=-1;const y=[];for(;++f<m;){const v=b[f]||"";let N="",E="";if(n.alignDelimiters!==!1){const S=o[f]-(w[f]||0),A=a[f];if(A===114)N=" ".repeat(S);else if(A===99){const L=S/2;S%2?(N=" ".repeat(L+.5),E=" ".repeat(L-.5)):(N=" ".repeat(L),E=N)}else E=" ".repeat(S)}n.delimiterStart!==!1&&!f&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||f)&&y.push(" "),n.alignDelimiters!==!1&&y.push(N),y.push(v),n.alignDelimiters!==!1&&y.push(E),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||f!==m-1)&&y.push("|")}g.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return g.join(`
16
+ `)}function Gf(e){return e==null?"":String(e)}function hi(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const Yf=Gt(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Kf(e,t,n,r){const l=n.enter("blockquote"),a=n.createTracker(r);a.move("> "),a.shift(2);const i=n.indentLines(n.containerFlow(e,a.current()),Qf);return l(),i}function Qf(e,t,n){return">"+(n?"":" ")+e}function Xf(e,t){return mi(e,t.inConstruct,!0)&&!mi(e,t.notInConstruct,!1)}function mi(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function gi(e,t,n,r){let l=-1;for(;++l<n.unsafe.length;){const a=n.unsafe[l];if(a.character===`
17
+ `&&!a.before&&!a.after&&Xf(n.stack,a))return/[\t ]/.test(r.before)?"":" "}return`\\
18
+ `}function Jf(e,t){const n=String(e);let r=n.indexOf(t),l=r,a=0,i=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===l?++a>i&&(i=a):a=1,l=r+t.length,r=n.indexOf(t,l);return i}function Zf(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function ep(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function tp(e,t,n,r){const l=ep(n),a=e.value||"";if(Zf(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(a,np);return f(),h}const i=n.createTracker(r),s=l.repeat(Math.max(Jf(a,l)+1,3)),o=n.enter("codeFenced"),u=l==="`"?"GraveAccent":"Tilde";let d=i.move(s);if(e.lang){const f=n.enter(`codeFencedLang${u}`);d+=i.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...i.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${u}`);d+=i.move(" "),d+=i.move(n.safe(e.meta,{before:d,after:`
19
+ `,encode:["`"],...i.current()})),f()}return d+=i.move(`
20
+ `),a&&(d+=i.move(a+`
21
+ `)),d+=i.move(s),o(),d}function np(e,t,n){return(n?"":" ")+e}function fr(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function rp(e,t,n,r){const l=fr(n),a=l==='"'?"Quote":"Apostrophe",i=n.enter("definition");let s=n.enter("label");const o=n.createTracker(r);let u=o.move("[");return u+=o.move(n.safe(n.associationId(e),{before:u,after:"]",...o.current()})),u+=o.move("]: "),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(s=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":`
22
+ `,...o.current()}))),s(),e.title&&(s=n.enter(`title${a}`),u+=o.move(" "+l),u+=o.move(n.safe(e.title,{before:u,after:l,...o.current()})),u+=o.move(l),s()),i(),u}function ip(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ft(e){const t=e.codePointAt(0);return t===void 0?"":String.fromCodePoint(t)}function Ze(e){const t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function Ml(e){return"&#x"+e.toString(16).toUpperCase()+";"}function xi(e,t,n){const r=ze(e),l=ze(t);return r===void 0?l===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function lp(e){if(e.charCodeAt(0)!==60)return;const t=e.charCodeAt(1);if(t===33){const s=e.charCodeAt(2);return s===45?2:s===91?5:ie(s)?4:void 0}if(t===63)return 3;const n=t===47,r=n?2:1;let l=r,a=e.charCodeAt(l);if(!ie(a))return;for(;a===45||le(a);)a=e.charCodeAt(++l);const i=e.slice(r,l).toLowerCase();return!n&&a!==47&&Pn.includes(i)?1:xl.includes(i)?6:7}const Dl=new Map([["*",!1],["_",!0]]);function ap(e,t,n){const r=new Set;for(const a of e){const i=n.get(a);if(i&&a.attention&&t.some(s=>s.attention===a.attention))for(const s of i.tokens)r.add(s.attention)}const l=[];for(const a of e)a.attention&&r.delete(a.attention)&&l.push(a.attention);return l.reverse(),l}function Ll(e,t,n){const r=[],l=new Map,a=new Map;let i=0;for(;i<e.length;){if(!e[i].attention){i++;continue}const s=e[i].value.charAt(0),o=Dl.get(s);let u=i+1;for(;u<e.length&&e[u].attention&&e[u].value.charAt(0)===s;)u++;const d=i?e[i-1].value:t,f=ze(d.charCodeAt(d.length-1)),h=ze((u<e.length?e[u].value:n).charCodeAt(0)),p=!h||h===2&&!!f,g=!f||f===2&&!!h,b={tokens:e.slice(i,u),markers:[],start:0,end:0,open:o?p&&(!!f||!g):p,close:o?g&&(!!h||!p):g,split:o!==void 0};for(const w of b.tokens){l.set(w,[...b.tokens]),a.set(w,b);let m=w.value.length;for(;m--;)b.markers.push(w)}b.end=b.markers.length,r.push(b),i=u}for(op(r,l),i=-1;++i<e.length;){const s=l.get(e[i]);if(s)return{attention:ap(e,s,a),index:i}}}function Nt(e,t){const n=e[t?0:e.length-1];if(!n||n.attention)return;const r=t?Ft(n.value):Ze(n.value),l=Ml(r.codePointAt(0));if(t)n.value=l+n.value.slice(r.length);else{let a=n.value.slice(0,n.value.length-r.length),i=0;for(;a.charCodeAt(a.length-1-i)===92;)i++;i%2&&(a+="\\"),n.value=a+l}}function sp(e,t,n,r,l){for(const a of n.attention){const i=t.get(a)||a.sequences[0];for(const s of a.sequences){if(s===i)continue;const o=new Map(t);o.set(a,s);const u=Qt(e,o,r,l),d=Ll(u,r,l);if(!d||d.index>n.index)return{chosen:o,mistake:d,tokens:u}}}}function op(e,t){const n=new Map;for(const r of e){const l=r.tokens[0].value.charAt(0);let a=n.get(l);a||(a=[],n.set(l,a));let i=r.close?a.length:0;for(;i--&&r.start<r.end;){const s=a[i],o=s.end-s.start,u=r.end-r.start;if(r.split?(s.close||r.open)&&u%3&&!((o+u)%3):o!==s.markers.length||o!==u)continue;const d=r.split?o>1&&u>1?2:1:u,f=s.markers.slice(s.end-d,s.end),h=r.markers.slice(r.start,r.start+d),p=f[0],g=h[0];if(p===f[d-1]&&p.value.length===d&&g===h[d-1]&&g.value.length===d&&p.attention===g.attention)t.delete(p),t.delete(g);else{const b=[...new Set([...f,...h])];for(const w of b){const m=t.get(w);m&&m.push(...b)}}s.end-=d,r.start+=d,s.start===s.end&&a.splice(i,1),i=a.length}r.open&&r.start<r.end&&a.push(r)}}function up(e,t,n){if(t.length===0)throw new Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(n.length===0)throw new Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(const l of n)if(!Number.isSafeInteger(l)||l<1)throw new Error("Cannot serialize `"+e+"` as attention with `"+l+"` as size, expected positive integer");const r=[];for(const l of t){if(l.length!==1)throw new Error("Cannot serialize `"+e+"` as attention with `"+l+"` as marker, expected a single ascii character");if(!ol(l.charCodeAt(0)))throw new Error("Cannot serialize `"+e+"` as attention with `"+l+"` as marker, expected ascii punctuation");for(const a of n)r.push(l.repeat(a))}return r}function cp(e,t,n){const r=t.indexStack,l=e.children||[],a=[];let i=-1,s=n.before;r.push(-1);let o=t.createTracker(n);for(;++i<l.length;){const u=l[i];let d;if(r[r.length-1]=i,i+1<l.length){let p=t.handle.handlers[l[i+1].type];p&&p.peek&&(p=p.peek),d=p?Ft(p(l[i+1],e,t,{before:"",after:"",...o.current()})):""}else d=n.after;const f=a[a.length-1];typeof f=="string"&&(s==="\r"||s===`
23
+ `)&&u.type==="html"&&lp(u.value)!==7&&(a[a.length-1]=f.replace(/(\r?\n|\r)$/," "),s=" ",o=t.createTracker(n),o.move(Xt(a,n.before,n.after)));const h=t.handle.handlers[u.type];if(h&&h.attention){const p=pr(u,h.attention,t,o);if(!p)continue;a.push(p),s=Ze(p.sequences[0])}else{const p=t.handle(u,e,t,{...o.current(),after:d,before:s});if(!p)continue;o.move(p),a.push(p),s=Ze(p)}}return r.pop(),a}function pr(e,t,n,r){const{construct:l,markers:a,sizes:i}=t(e,n),s=up(e.type,a,i),o=s[0],u=n.enter(l),d=n.createTracker(r.current());d.move(o);const f=cp(e,n,{...d.current(),before:o,after:o});if(u(),f.length!==0)return r.move(o),r.move(Xt(f,o,o)),r.move(o),{children:f,sequences:s}}function bi(e,t,n,r){let l=Qt(e,t,n,r),a=Ll(l,n,r);for(;a;){const i=sp(e,t,a,n,r);if(!i)return;t=i.chosen,l=i.tokens,a=i.mistake}return l}function zl(e,t,n,r){let l=n,a=-1;for(;++a<e.length;){const i=e[a];if(typeof i=="string"){l="";continue}const s=a===e.length-1?r:"",o=i.sequences.find(function(u){const d=u.charAt(0);return d!==l.charAt(0)&&d!==s.charAt(0)||e.length===1&&Dl.has(d)&&u.length>n.length})||i.sequences[0];o!==i.sequences[0]&&t.set(i,o),zl(i.children,t,o,o),l=o}}function Qt(e,t,n,r){const l=[];let a,i=Ze(n),s=-1;for(;++s<e.length;){const o=e[s];if(typeof o=="string"){const v={value:o,attention:void 0};a&&a===Ft(o)&&Nt([v],!0),a=void 0,l.push(v),v.value&&(i=Ze(v.value));continue}const u=t.get(o)||o.sequences[0],d=u.charAt(0),f=e[s+1],h=i,p=Ft(f===void 0?r:typeof f=="string"?f:t.get(f)||f.sequences[0]),g=Qt(o.children,t,u,u),b=g[0].value,w=xi(h.charCodeAt(h.length-1),b.charCodeAt(0),d);w.inside&&Nt(g,!0);const m=Ze(g[g.length-1].value),y=xi(p.charCodeAt(0),m.charCodeAt(m.length-1),d);y.inside&&Nt(g,!1),w.outside&&h!==`
24
+ `&&h!=="\r"&&Nt(l,!1),y.outside&&(a=p),l.push({value:u,attention:o},...g,{value:u,attention:o}),i=u.charAt(u.length-1)}return l}function Xt(e,t,n){const r=new Map;zl(e,r,t,n);const l=(r.size>0?bi(e,r,t,n):void 0)||bi(e,new Map,t,n)||Qt(e,new Map,t,n);let a="";for(const i of l)a+=i.value;return a}hr.attention=Fl;hr.peek=dp;function hr(e,t,n,r){const l=n.enter("phrasing"),a=pr(e,Fl,n,n.createTracker(r)),i=a?Xt([a],r.before,r.after):"";return l(),i}function Fl(e,t){return{construct:"emphasis",markers:ip(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function dp(e,t,n){return n.options.emphasis||"*"}function fp(e,t){let n=!1;return Kt(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ht}),!!((!e.depth||e.depth<3)&&qt(e)&&(t.options.setext||n))}function pp(e,t,n,r){const l=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(fp(e,n)){const f=n.enter("headingSetext"),h=n.enter("phrasing"),p=n.containerPhrasing(e,{...a.current(),before:`
25
+ `,after:`
26
+ `});return h(),f(),p+`
27
+ `+(l===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
28
+ `))+1))}const i="#".repeat(l),s=n.enter("headingAtx"),o=n.enter("phrasing");a.move(i+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
29
+ `,...a.current()});const d=u.charCodeAt(0);return(d===9||d===32)&&(u=Ml(d)+u.slice(1)),u=u?i+" "+u:i,n.options.closeAtx&&(u+=" "+i),o(),s(),u}Rl.peek=hp;function Rl(e){return e.value||""}function hp(){return"<"}Ol.peek=mp;function Ol(e,t,n,r){const l=fr(n),a=l==='"'?"Quote":"Apostrophe",i=n.enter("image");let s=n.enter("label");const o=n.createTracker(r);let u=o.move("![");return u+=o.move(n.safe(e.alt,{before:u,after:"]",...o.current()})),u+=o.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(s=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),s(),e.title&&(s=n.enter(`title${a}`),u+=o.move(" "+l),u+=o.move(n.safe(e.title,{before:u,after:l,...o.current()})),u+=o.move(l),s()),u+=o.move(")"),i(),u}function mp(){return"!"}_l.peek=gp;function _l(e,t,n,r){const l=e.referenceType,a=n.enter("imageReference");let i=n.enter("label");const s=n.createTracker(r);let o=s.move("![");const u=n.safe(e.alt,{before:o,after:"]",...s.current()});o+=s.move(u+"]["),i();const d=n.stack;n.stack=d.filter(function(h){return h!=="phrasing"}),i=n.enter("reference");const f=n.safe(n.associationId(e),{before:o,after:"]",...s.current()});return i(),n.stack=d,a(),l==="full"||!u||u!==f?o+=s.move(f+"]"):l==="shortcut"?o=o.slice(0,-1):o+=s.move("]"),o}function gp(){return"!"}Bl.peek=xp;function Bl(e,t,n){let r=e.value||"",l="`",a=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(r);)l+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const i=n.unsafe[a],s=n.compilePattern(i);if(!i.atBreak)continue;let o;for(;o=s.exec(r);){let u=o.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(o.index+1)}}return l+r+l}function xp(){return"`"}function $l(e,t){const n=qt(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Ul.peek=bp;function Ul(e,t,n,r){const l=fr(n),a=l==='"'?"Quote":"Apostrophe",i=n.createTracker(r);if($l(e,n)){const g=n.stack;n.stack=g.filter(function(m){return m!=="phrasing"});const b=n.enter("autolink");let w=i.move("<");return w+=i.move(n.containerPhrasing(e,{before:w,after:">",...i.current()})),w+=i.move(">"),b(),n.stack=g,w}const s=n.enter("link");let o=n.enter("label"),u=i.move("[");const d=n.containerPhrasing(e,{before:u,after:"](",...i.current()});u+=i.move(d),o(),u+=i.move("](");const f=/[\0- \u007F]/.test(e.url),h=r.before.charAt(r.before.length-1);let p=e.title||void 0;if(!p&&!f&&(h===`
30
+ `||h==="\r")){let g=0;for(;g<d.length&&d.charCodeAt(g)!==93;)g+=d.charCodeAt(g)===92?2:1;d.charCodeAt(g+1)===58&&(p="")}return!e.url&&typeof p=="string"||f?(o=n.enter("destinationLiteral"),u+=i.move("<"),u+=i.move(n.safe(e.url,{before:u,after:">",...i.current()})),u+=i.move(">")):(o=n.enter("destinationRaw"),u+=i.move(n.safe(e.url,{before:u,after:typeof p=="string"?" ":")",...i.current()}))),o(),typeof p=="string"&&(o=n.enter(`title${a}`),u+=i.move(" "+l),u+=i.move(n.safe(p,{before:u,after:l,...i.current()})),u+=i.move(l),o()),u+=i.move(")"),s(),u}function bp(e,t,n){return $l(e,n)?"<":"["}Hl.peek=kp;function Hl(e,t,n,r){const l=e.referenceType,a=n.enter("linkReference");let i=n.enter("label");const s=n.createTracker(r);let o=s.move("[");const u=n.containerPhrasing(e,{before:o,after:"]",...s.current()});o+=s.move(u+"]["),i();const d=n.stack;n.stack=d.filter(function(h){return h!=="phrasing"}),i=n.enter("reference");const f=n.safe(n.associationId(e),{before:o,after:"]",...s.current()});return i(),n.stack=d,a(),l==="full"||!u||u!==f?o+=s.move(f+"]"):l==="shortcut"?o=o.slice(0,-1):o+=s.move("]"),o}function kp(){return"["}function mr(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function yp(e){const t=mr(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function wp(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ql(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function vp(e,t,n,r){const l=n.enter("list"),a=n.bulletCurrent;let i=e.ordered?wp(n):mr(n);const s=e.ordered?i==="."?")":".":yp(n);let o=t&&n.bulletLastUsed?i===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((i==="*"||i==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(o=!0),ql(n)===i&&d){let f=-1;for(;++f<e.children.length;){const h=e.children[f];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){o=!0;break}}}}o&&(i=s),n.bulletCurrent=i;const u=n.containerFlow(e,r);return n.bulletLastUsed=i,n.bulletCurrent=a,l(),u}function Sp(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function jp(e,t,n,r){const l=Sp(n);let a=n.bulletCurrent||mr(n);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let i=a.length+1;(l==="tab"||l==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(i=Math.ceil(i/4)*4);const s=n.createTracker(r);s.move(a+" ".repeat(i-a.length)),s.shift(i);const o=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,s.current()),d);return o(),u;function d(f,h,p){return h?(p?"":" ".repeat(i))+f:(p?a:a+" ".repeat(i-a.length))+f}}function Cp(e,t,n,r){const l=n.enter("paragraph"),a=n.enter("phrasing"),i=n.containerPhrasing(e,r);return a(),l(),i}function Np(e,t,n,r){if(!e.children.some(function(s){return Yf(s)}))return n.containerFlow(e,r);const a=n.enter("phrasing"),i=n.containerPhrasing(e,r);return a(),i}function Ep(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}gr.attention=Vl;gr.peek=Ap;function gr(e,t,n,r){const l=n.enter("phrasing"),a=pr(e,Vl,n,n.createTracker(r)),i=a?Xt([a],r.before,r.after):"";return l(),i}function Vl(e,t){return{construct:"strong",markers:Ep(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function Ap(e,t,n){return n.options.strong||"*"}function Ip(e,t,n,r){const l=t?t.children:[],a=n.indexStack[n.indexStack.length-1];return n.safe(e.value,{...r,afterNode:l[a+1],beforeNode:l[a-1]})}function Pp(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Tp(e,t,n){const r=(ql(n)+(n.options.ruleSpaces?" ":"")).repeat(Pp(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Rn={blockquote:Kf,break:gi,code:tp,definition:rp,emphasis:hr,hardBreak:gi,heading:pp,html:Rl,image:Ol,imageReference:_l,inlineCode:Bl,link:Ul,linkReference:Hl,list:vp,listItem:jp,paragraph:Cp,root:Np,strong:gr,text:Ip,thematicBreak:Tp};function Mp(){return{enter:{table:Dp,tableData:ki,tableHeader:ki,tableRow:zp},exit:{codeText:Fp,table:Lp,tableData:xn,tableHeader:xn,tableRow:xn}}}function Dp(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[],position:void 0},e),this.data.inTable=!0}function Lp(e){this.exit(e),this.data.inTable=void 0}function zp(e){this.enter({type:"tableRow",children:[],position:void 0},e)}function xn(e){this.exit(e)}function ki(e){this.enter({type:"tableCell",children:[],position:void 0},e)}function Fp(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Rp));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Rp(e,t){return t==="|"?t:e}function Op(e){const t=e||{},{tableCellPadding:n,tablePipeAlign:r,stringLength:l}=t,a=n?" ":"|";return{handlers:{inlineCode:h,table:i,tableCell:o,tableRow:s},join:[_p],unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
31
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}]};function i(p,g,b,w){const m=d(p,b,w),y=m[0];if(y){let v=p.align?p.align.length:0,N=-1;if(!v)for(;++N<m.length;)m[N].length>v&&(v=m[N].length);for(;y.length<v;)y.push("")}return u(m,p.align)}function s(p,g,b,w){const m=f(p,b,w),y=u([m]);return y.slice(0,y.indexOf(`
32
+ `))}function o(p,g,b,w){const m=b.enter("tableCell"),y=b.enter("phrasing"),v=b.containerPhrasing(p,{...w,before:a,after:a});return y(),m(),v}function u(p,g){return Wf(p,{align:g,alignDelimiters:r,fillRows:!1,padding:n,stringLength:l})}function d(p,g,b){const{children:w}=p;let m=-1;const y=[],v=g.enter("table");for(;++m<w.length;)y[m]=f(w[m],g,b);return v(),y}function f(p,g,b){const{children:w}=p;let m=-1;const y=[],v=g.enter("tableRow");for(;++m<w.length;)y[m]=o(w[m],p,g,b);return v(),y}function h(p,g,b){const w=Rn.inlineCode(p,g,b);if(!b.stack.includes("tableCell"))return w;const m=[];let y=0,v=w.indexOf("|");for(;v!==-1;){let N=v;for(;N>y&&w.charCodeAt(N-1)===92;)N--;m.push(w.slice(y,v)),(v-N)%2===0&&m.push("\\"),y=v,v=w.indexOf("|",v+1)}return m.push(w.slice(y)),m.join("")}}function _p(e,t,n,r){if(e.type==="table"&&n.type==="listItem"&&n.spread===!1&&(t.type==="definition"||t.type==="heading"&&Bp(t,r)||t.type==="paragraph"||t.type==="table"))return 1}function Bp(e,t){let n=!1;return Kt(e,function(r){if(r.type==="break"||"value"in r&&/\r?\n|\r/.test(r.value))return n=!0,ht}),!!((!e.depth||e.depth<3)&&qt(e)&&(t.options.setext||n))}function $p(){return{exit:{taskListCheckValueChecked:yi,taskListCheckValueUnchecked:yi,paragraph:Hp}}}function Up(){return{handlers:{paragraph:qp},join:[Vp]}}function yi(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Hp(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const l=t.children;let a=-1,i;for(;++a<l.length;){const s=l[a];if(s.type==="paragraph"){i=s;break}}i===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start={...r.position.start}))}}this.exit(e)}function qp(e,t,n,r){if(!t||t.type!=="listItem"||Wl(t)!==e)return Rn.paragraph(e,t,n,r);const l="["+(t.checked?"x":" ")+"] ",a=n.createTracker(r);a.move(l);const i=Rn.paragraph(e.children.length>0?e:{type:"paragraph",children:[{type:"text",value:" "}]},t,n,{...r,...a.current()});return l+i}function Vp(e,t,n){if(!(e.type==="definition"&&n.type==="listItem"))return;const r=Wl(n);if(r&&n.children.indexOf(e)<n.children.indexOf(r))return 0}function Wl(e){if(typeof e.checked=="boolean")for(const t of e.children){if(t.type==="paragraph")return t;if(t.type!=="definition")return}}function Wp(){return[df(),zf(),_f(),Mp(),$p()]}function Gp(e){return{extensions:[ff(),Ff(e),Bf(),Op(e),Up()]}}const Yp={tokenize:eh,partial:!0},Gl={tokenize:th,partial:!0},Yl={tokenize:nh,partial:!0},Kl={tokenize:rh,partial:!0},Kp={tokenize:ih,partial:!0},Ql={name:"wwwAutolink",tokenize:Jp,previous:Jl},Xl={name:"protocolAutolink",tokenize:Zp,previous:Zl},Te={name:"emailAutolink",tokenize:Xp,previous:ea},Ce={};function Qp(){return{text:Ce}}let Re=48;for(;Re<123;)Ce[Re]=Te,Re++,Re===58?Re=65:Re===91&&(Re=97);Ce[43]=Te;Ce[45]=Te;Ce[46]=Te;Ce[95]=Te;Ce[72]=[Te,Xl];Ce[104]=[Te,Xl];Ce[87]=[Te,Ql];Ce[119]=[Te,Ql];function Xp(e,t,n){const r=this;let l,a;return i;function i(f){return!On(f)||!ea.call(r,r.previous)||xr(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(f))}function s(f){return On(f)?(e.consume(f),s):f===64?(e.consume(f),o):n(f)}function o(f){return f===46?e.check(Kp,d,u)(f):f===45||f===95||le(f)?(a=!0,e.consume(f),o):d(f)}function u(f){return e.consume(f),l=!0,o}function d(f){return a&&l&&ie(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function Jp(e,t,n){const r=this;return l;function l(i){return i!==87&&i!==119||!Jl.call(r,r.previous)||xr(r.events)?n(i):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Yp,e.attempt(Gl,e.attempt(Yl,a),n),n)(i))}function a(i){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(i)}}function Zp(e,t,n){const r=this;let l="",a=!1;return i;function i(f){return(f===72||f===104)&&Zl.call(r,r.previous)&&!xr(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(f),e.consume(f),s):n(f)}function s(f){if(ie(f)&&l.length<5)return l+=String.fromCodePoint(f),e.consume(f),s;if(f===58){const h=l.toLowerCase();if(h==="http"||h==="https")return e.consume(f),o}return n(f)}function o(f){return f===47?(e.consume(f),a?u:(a=!0,o)):n(f)}function u(f){return f===null||Mt(f)||K(f)||$e(f)||yt(f)?n(f):e.attempt(Gl,e.attempt(Yl,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function eh(e,t,n){let r=0;return l;function l(i){return(i===87||i===119)&&r<3?(r++,e.consume(i),l):i===46&&r===3?(e.consume(i),a):n(i)}function a(i){return i===null?n(i):t(i)}}function th(e,t,n){let r,l,a;return i;function i(u){return u===46||u===95?e.check(Kl,o,s)(u):u===null||K(u)||$e(u)||u!==45&&yt(u)?o(u):(a=!0,e.consume(u),i)}function s(u){return u===95?r=!0:(l=r,r=void 0),e.consume(u),i}function o(u){return l||r||!a?n(u):t(u)}}function nh(e,t){let n=0,r=0;return l;function l(i){return i===40?(n++,e.consume(i),l):i===41&&r<n?a(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?e.check(Kl,t,a)(i):i===null||K(i)||$e(i)?t(i):(e.consume(i),l)}function a(i){return i===41&&r++,e.consume(i),l}}function rh(e,t,n){return r;function r(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(e.consume(s),r):s===38?(e.consume(s),a):s===93?(e.consume(s),l):s===60||s===null||K(s)||$e(s)?t(s):n(s)}function l(s){return s===null||s===40||s===91||K(s)||$e(s)?t(s):r(s)}function a(s){return ie(s)?i(s):n(s)}function i(s){return s===59?(e.consume(s),r):ie(s)?(e.consume(s),i):n(s)}}function ih(e,t,n){return r;function r(a){return e.consume(a),l}function l(a){return le(a)?n(a):t(a)}}function Jl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||K(e)}function Zl(e){return!ie(e)}function ea(e){return!(e===47||On(e))}function On(e){return e===43||e===45||e===46||e===95||le(e)}function xr(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const lh={tokenize:ph,partial:!0};function ah(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ch,continuation:{tokenize:dh},exit:fh}},text:{91:{name:"gfmFootnoteCall",tokenize:uh},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:sh,resolveTo:oh}}}}function sh(e,t,n){const r=this;let l=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i;for(;l--;){const o=r.events[l][1];if(o.type==="labelImage"){i=o;break}if(o.type==="gfmFootnoteCall"||o.type==="labelLink"||o.type==="label"||o.type==="image"||o.type==="link")break}return s;function s(o){if(!i||!i._balanced)return n(o);const u=be(r.sliceSerialize({start:i.end,end:r.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?n(o):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),t(o))}}function oh(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",l,t],["exit",l,t],["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function uh(e,t,n){const r=this,l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,i;return s;function s(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),o}function o(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(a>999||f===93&&!i||f===null||f===91||K(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return l.includes(be(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return K(f)||(i=!0),a++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),a++,u):u(f)}}function ch(e,t,n){const r=this,l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,i=0,s;return o;function o(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(i>999||g===93&&!s||g===null||g===91||K(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return a=be(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return K(g)||(s=!0),i++,e.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(e.consume(g),i++,d):d(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),l.includes(a)||l.push(a),V(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function dh(e,t,n){return e.check(wt,t,e.attempt(lh,t,n))}function fh(e){e.exit("gfmFootnoteDefinition")}function ph(e,t,n){const r=this;return V(e,l,"gfmFootnoteDefinitionIndent",5);function l(a){const i=r.events[r.events.length-1];return i&&i[1].type==="gfmFootnoteDefinitionIndent"&&i[2].sliceSerialize(i[1],!0).length===4?t(a):n(a)}}function hh(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:l};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function l(i,s){let o=-1;for(;++o<i.length;)if(i[o][0]==="enter"&&i[o][1].type==="strikethroughSequenceTemporary"&&i[o][1]._close){let u=o;for(;u--;)if(i[u][0]==="exit"&&i[u][1].type==="strikethroughSequenceTemporary"&&i[u][1]._open&&i[o][1].end.offset-i[o][1].start.offset===i[u][1].end.offset-i[u][1].start.offset){i[o][1].type="strikethroughSequence",i[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},i[u][1].start),end:Object.assign({},i[o][1].end)},f={type:"strikethroughText",start:Object.assign({},i[u][1].end),end:Object.assign({},i[o][1].start)},h=[["enter",d,s],["enter",i[u][1],s],["exit",i[u][1],s],["enter",f,s]],p=s.parser.constructs.insideSpan.null;p&&xe(h,h.length,0,Vt(p,i.slice(u+1,o),s)),xe(h,h.length,0,[["exit",f,s],["enter",i[o][1],s],["exit",i[o][1],s],["exit",d,s]]),xe(i,u-1,o-u+3,h),o=u+h.length-2;break}}for(o=-1;++o<i.length;)i[o][1].type==="strikethroughSequenceTemporary"&&(i[o][1].type="data");return i}function a(i,s,o){const u=this.previous,d=this.events;let f=0;return h;function h(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?o(g):(i.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const b=ze(u);if(g===126)return f>1?o(g):(i.consume(g),f++,p);if(f<2&&!n)return o(g);const w=i.exit("strikethroughSequenceTemporary"),m=ze(g);return w._open=!m||m===2&&!!b,w._close=!b||b===2&&!!m,s(g)}}}class mh{constructor(){this.map=[],this.index=new Map}add(t,n,r){gh(this,t,n,r)}consume(t){if(this.map.sort(function(a,i){return a[0]-i[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let l=r.pop();for(;l;){for(const a of l)t.push(a);l=r.pop()}this.map.length=0,this.index.clear()}}function gh(e,t,n,r){if(n===0&&r.length===0)return;const l=e.index.get(t);if(l){l[1]+=n,l[2].push(...r);return}const a=[t,n,r];e.map.push(a),e.index.set(t,a)}function xh(e,t){let n=!1;const r=[];for(;t<e.length;){const l=e[t];if(n){if(l[0]==="enter")l[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function bh(){return{flow:{null:{name:"table",tokenize:kh,resolveAll:yh}}}}function kh(e,t,n){const r=this;let l=0,a=0,i;return s;function s(j){let I=r.events.length-1;for(;I>-1;){const{type:M}=r.events[I][1];if(M==="lineEnding"||M==="linePrefix")I--;else break}const z=I>-1?r.events[I][1].type:null,q=z==="tableHead"||z==="tableRow"?S:o;return q===S&&r.parser.lazy[r.now().line]?n(j):q(j)}function o(j){return e.enter("tableHead"),e.enter("tableRow"),u(j)}function u(j){return j===124||(i=!0,a+=1),d(j)}function d(j){return j===null?n(j):F(j)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),p):n(j):U(j)?V(e,d,"whitespace")(j):(a+=1,i&&(i=!1,l+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),i=!0,d):(e.enter("data"),f(j)))}function f(j){return j===null||j===124||K(j)?(e.exit("data"),d(j)):(e.consume(j),j===92?h:f)}function h(j){return j===92||j===124?(e.consume(j),f):f(j)}function p(j){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(j):(e.enter("tableDelimiterRow"),i=!1,U(j)?V(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):g(j))}function g(j){return j===45||j===58?w(j):j===124?(i=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),b):E(j)}function b(j){return U(j)?V(e,w,"whitespace")(j):w(j)}function w(j){return j===58?(a+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),m):j===45?(a+=1,m(j)):j===null||F(j)?N(j):E(j)}function m(j){return j===45?(e.enter("tableDelimiterFiller"),y(j)):E(j)}function y(j){return j===45?(e.consume(j),y):j===58?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(j))}function v(j){return U(j)?V(e,N,"whitespace")(j):N(j)}function N(j){return j===124?g(j):j===null||F(j)?!i||l!==a?E(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):E(j)}function E(j){return n(j)}function S(j){return e.enter("tableRow"),A(j)}function A(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),A):j===null||F(j)?(e.exit("tableRow"),t(j)):U(j)?V(e,A,"whitespace")(j):(e.enter("data"),L(j))}function L(j){return j===null||j===124||K(j)?(e.exit("data"),A(j)):(e.consume(j),j===92?O:L)}function O(j){return j===92||j===124?(e.consume(j),L):L(j)}}function yh(e,t){let n=-1,r=!0,l=0,a=[0,0,0,0],i=[0,0,0,0],s=!1,o=0,u,d,f;const h=new mh;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(s=!1,o!==0&&(wi(h,t,o,u,d),d=void 0,o=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,f=void 0,a=[0,0,0,0],i=[0,n+1,0,0],s&&(s=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",d,t]])),l=g.type==="tableDelimiterRow"?2:d?3:1):l&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,i[2]===0&&(a[1]!==0&&(i[0]=i[1],f=Et(h,t,a,l,void 0,f),a=[0,0,0,0]),i[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(i[0]=i[1],f=Et(h,t,a,l,void 0,f)),a=i,i=[a[1],n,0,0])):g.type==="tableHead"?(s=!0,o=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(o=n,a[1]!==0?(i[0]=i[1],f=Et(h,t,a,l,n,f)):i[1]!==0&&(f=Et(h,t,i,l,n,f)),l=0):l&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(i[3]=n)}for(o!==0&&wi(h,t,o,u,d),h.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=xh(t.events,n))}return e}function Et(e,t,n,r,l,a){const i=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(a.end=Object.assign({},Je(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const o=Je(t.events,n[1]);if(a={type:i,start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const u=Je(t.events,n[2]),d=Je(t.events,n[3]),f={type:s,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const h=t.events[n[2]],p=t.events[n[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,b=n[3]-n[2]-1;e.add(g,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return l!==void 0&&(a.end=Object.assign({},Je(t.events,l)),e.add(l,0,[["exit",a,t]]),a=void 0),a}function wi(e,t,n,r,l){const a=[],i=Je(t.events,n);l&&(l.end=Object.assign({},i),a.push(["exit",l,t])),r.end=Object.assign({},i),a.push(["exit",r,t]),e.add(n+1,0,a)}function Je(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const wh={name:"tasklistCheck",tokenize:Sh};function vh(){return{text:{91:wh}}}function Sh(e,t,n){const r=this;return l;function l(o){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(o):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(o),e.exit("taskListCheckMarker"),a)}function a(o){return K(o)?(e.enter("taskListCheckValueUnchecked"),e.consume(o),e.exit("taskListCheckValueUnchecked"),i):o===88||o===120?(e.enter("taskListCheckValueChecked"),e.consume(o),e.exit("taskListCheckValueChecked"),i):n(o)}function i(o){return o===93?(e.enter("taskListCheckMarker"),e.consume(o),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(o)}function s(o){return F(o)?t(o):U(o)?e.check({tokenize:jh},t,n)(o):n(o)}}function jh(e,t,n){return V(e,r,"whitespace");function r(l){return l===null?n(l):t(l)}}function Ch(e){return al([Qp(),ah(),hh(e),bh(),vh()])}const Nh={};function Eh(e){const t=this,n=e||Nh,r=t.data(),l=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),i=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);l.push(Ch(n)),a.push(Wp()),i.push(Gp(n))}const Ah=[Eh];function vi(e){return typeof e=="string"&&/^https?:\/\//i.test(e)}const Ih={a:({href:e,title:t,children:n})=>vi(e)?c.jsx("a",{href:e,title:t,target:"_blank",rel:"noopener noreferrer nofollow",children:n}):c.jsx("span",{children:n}),img:({src:e,alt:t})=>vi(e)?c.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer nofollow",children:t||e}):c.jsx("span",{children:t}),table:({children:e})=>c.jsx("div",{className:"qcli-readme-table",children:c.jsx("table",{children:e})})};function ta({text:e,format:t}){const n=!t||t==="markdown";return c.jsx("div",{"data-testid":"readme",className:"bg-control/40 border border-border rounded-lg p-3 max-h-[28rem] overflow-y-auto text-xs text-text",children:n?c.jsx("div",{className:"qcli-readme",children:c.jsx(ef,{skipHtml:!0,remarkPlugins:Ah,components:Ih,children:e})}):c.jsx("pre",{className:"whitespace-pre-wrap break-words font-sans",children:e})})}const bn="font-mono text-[11px] text-muted bg-control border border-border/75 px-1.5 py-0.5 rounded";function je({title:e,children:t}){return c.jsxs("section",{className:"space-y-1.5",children:[c.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-subtle",children:e}),t]})}const Le="px-2 py-1.5 align-top";function na({entries:e}){const{t}=H();return e.length===0?c.jsx("p",{className:"text-xs text-subtle",children:t("marketplace.noSettings")}):c.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{className:"bg-control/40 text-left text-subtle",children:c.jsxs("tr",{children:[c.jsx("th",{scope:"col",className:`${Le} font-medium`,children:t("marketplace.colKey")}),c.jsx("th",{scope:"col",className:`${Le} font-medium`,children:t("marketplace.colType")}),c.jsx("th",{scope:"col",className:`${Le} font-medium`,children:t("marketplace.colDefault")}),c.jsx("th",{scope:"col",className:`${Le} font-medium`,children:t("marketplace.colRule")})]})}),c.jsx("tbody",{className:"divide-y divide-border/50",children:e.map(n=>{const r=Rs(n,t);return c.jsxs("tr",{"data-setting":n.key,children:[c.jsxs("th",{scope:"row",className:`${Le} text-left font-normal`,children:[c.jsx("div",{className:"font-mono text-text break-all",children:n.key}),n.label&&n.label!==n.key&&c.jsx("div",{className:"text-subtle",children:n.label}),n.description&&c.jsx("div",{className:"text-subtle",children:n.description})]}),c.jsx("td",{className:`${Le} font-mono text-muted whitespace-nowrap`,children:n.type}),c.jsx("td",{className:`${Le} font-mono text-text break-all`,children:Ps(n.default)}),c.jsx("td",{className:`${Le} text-muted`,children:r.length?r.join(" · "):"—"})]},n.key)})})]})})}function Ph({plugin:e,onClose:t}){const{t:n,formatNumber:r}=H(),l=_t(),a=D.useCallback(()=>Un(e.name),[e.name]),{data:i,loading:s,error:o,refetch:u}=se(a,[a]),d=(i==null?void 0:i.versions.find(f=>f.version===i.latest))??(i==null?void 0:i.versions[0]);return c.jsx(Hn,{open:!0,onClose:t,size:"lg",title:e.title,description:e.name,children:c.jsxs("div",{className:"space-y-4 text-sm",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(Pe,{icon:e.icon,names:[e.name]}),c.jsxs("div",{className:"min-w-0 space-y-1",children:[c.jsx(Jt,{plugin:e}),c.jsx("p",{className:"text-muted",children:e.description}),(i??e).installed&&c.jsx("div",{className:Ve,"data-testid":"install-state",children:c.jsx(Ut,{installed:(i??e).installed,updateAvailable:(i??e).updateAvailable,latest:(i??e).latest})})]})]}),s&&!i&&c.jsx(Ee,{label:n("marketplace.loadingDetails")}),o&&c.jsx(me,{title:n("marketplace.detailsFailed"),error:l(new Error(o)),onRetry:u,compact:!0}),i&&c.jsxs(c.Fragment,{children:[c.jsx(je,{title:n("marketplace.versions"),children:c.jsx(It,{items:i.versions.map(f=>({label:`v${f.version}`,key:f.version,title:f.deprecated})),max:6,title:n("marketplace.versionsOf",{title:e.title}),label:n("marketplace.versions"),chipClassName:bn,empty:n("marketplace.none")})}),c.jsx(je,{title:d?n("marketplace.filesOf",{version:d.version}):n("marketplace.files"),children:c.jsx(It,{items:((d==null?void 0:d.files)??[]).map(f=>({label:f.size===void 0?f.path:`${f.path} · ${Pa(f.size,r)}`,key:f.path,title:f.integrity})),max:4,title:d?n("marketplace.filesOf",{version:d.version}):n("marketplace.files"),label:n("marketplace.files"),chipClassName:bn,empty:n("marketplace.none")})}),c.jsx(je,{title:n("marketplace.settings"),children:c.jsx(na,{entries:Li(i)})}),c.jsx(je,{title:n("marketplace.serverPackages"),children:c.jsx(It,{items:i.serverPackages.map(f=>({label:f.platform?`${f.platform}: ${f.name}`:f.name,key:`${f.platform}:${f.name}`})),max:3,title:n("marketplace.serverPackages"),label:n("marketplace.serverPackages"),chipClassName:bn,empty:n("marketplace.none")})}),c.jsx(je,{title:n("marketplace.readme"),children:i.readme.trim()?c.jsx(ta,{text:i.readme.trim()}):c.jsx("p",{className:"text-xs text-subtle",children:n("marketplace.noReadme")})})]})]})})}function Jt({plugin:e}){const{t}=H();return c.jsxs("div",{className:Ds,children:[c.jsx("span",{children:t("marketplace.byPublisher",{publisher:e.publisher.name||"—"})}),e.publisher.verified?c.jsx("span",{className:"inline-flex shrink-0",children:c.jsxs(te,{variant:"success",children:["✓ ",t("marketplace.verified")]})}):c.jsx("span",{className:"sr-only",children:t("marketplace.unverified")})]})}function _n(e){return(e==null?void 0:e.source)==="code"}function ra(e){return(e==null?void 0:e.source)==="marketplace"}function Th(e,t,n,r){return r==="yes"&&!e.installed||r==="no"&&e.installed?!1:n==="all"?!0:n==="this"?!!e.platform:!!e.platforms[n]||n===t&&!!e.platform}function Mh(e){return(e.includes("/")?e.slice(e.indexOf("/")+1):e).replace(/^(qodalis-)?cli-server-plugin-/i,"").replace(/^Qodalis\.Cli\.Plugin\./,"").toLowerCase()}async function Dh(e,t,n){const r={kind:"code",packages:t.length>0?t:[{platform:"",name:e}]};if(!n)return r;try{const l=await Oi();if(!l||!l.enabled||l.install==="off")return r;const a=Mh(e),i=await _i({query:a,pageSize:50}),s=i.items.find(o=>{var u;return((u=o.platform)==null?void 0:u.package)===e})??i.items.find(o=>o.name===a&&!!o.platform);return s&&s.allowed&&!s.installed?{kind:"installable",plugin:s}:r}catch{return r}}async function Lh(e,t){const[n,r]=await Promise.allSettled([Un(t),e==="update"?Ta(t):Promise.resolve(null)]);if(n.status==="rejected")return null;const l=Li(n.value);if(l.length===0)return[];if(e==="install")return l.map(i=>Tr(i));if(r.status==="rejected"||!r.value)return null;const a=r.value.values;return l.map(i=>Tr(i,Ls(i,a)))}function zh({action:e,target:t,busy:n,serverErrors:r,failure:l,onCancel:a,onConfirm:i}){const{t:s}=H(),o=Mi().t,u=t.title||t.name,d=D.useId(),f=D.useCallback(()=>Lh(e,t.name),[e,t.name]),{data:h,loading:p}=se(f,[f]),[g,b]=D.useState({}),[w,m]=D.useState({errors:r,keys:new Set}),y=w.errors===r?w.keys:new Set,v=D.useMemo(()=>h??[],[h]),N=Ue().hasPermission(Bt),E=e==="install"&&t.requires&&!t.requires.installed?t.requires.serverPackage:null,S=D.useCallback(async()=>{if(!E)return null;const x=await Un(t.name).catch(()=>null);return Dh(E,(x==null?void 0:x.serverPackages)??[],N)},[E,t.name,N]),{data:A,loading:L}=se(S,[S]),[O,j]=D.useState(!0),I=(A==null?void 0:A.kind)==="installable"&&O?{name:A.plugin.name,title:A.plugin.title||A.plugin.name}:void 0,{changes:z,problems:q}=D.useMemo(()=>zs(v,g),[v,g]),M=Object.keys(q).length>0,R=x=>{const Q=q[x];return Q?s(Q.key,Q.params):y.has(x)?void 0:r[x]},W=Object.entries(r).filter(([x])=>!v.some(Q=>Q.key===x));function G(x,Q){b(ne=>{const k={...ne};return Q?k[x]=Q:delete k[x],k}),m(ne=>({errors:r,keys:new Set(ne.errors===r?ne.keys:[]).add(x)}))}const J=s(e==="install"?"marketplace.install":"marketplace.update"),ae=e==="install"?s("marketplace.confirmInstallMessage",{title:u,publisher:t.publisher||"—"}):t.publisher?s("marketplace.confirmUpdateMessage",{publisher:t.publisher}):s("marketplace.confirmUpdatePlain");return c.jsx(Hn,{open:!0,onClose:()=>{n||a()},closeOnBackdrop:!n,size:v.length>0?"lg":"sm",title:e==="install"?s("marketplace.confirmInstall",{title:u}):s("marketplace.confirmUpdate",{title:u}),actions:c.jsxs(c.Fragment,{children:[M&&c.jsx("p",{id:d,className:"mr-auto text-xs text-error",children:s("marketplace.settingsInvalid")}),c.jsx("button",{type:"button",onClick:a,disabled:n,className:"px-3 py-1.5 text-sm rounded-lg bg-control hover:bg-control-hover text-text disabled:opacity-50",children:o("confirmCancel")}),c.jsxs("button",{type:"button",onClick:()=>i(z,I),disabled:n||p||M||!!E&&L,"aria-describedby":M?d:void 0,className:"px-3 py-1.5 text-sm rounded-lg bg-primary text-on-primary hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5",children:[n&&c.jsx(Ee,{}),J]})]}),children:c.jsxs("div",{className:"space-y-4 text-sm",children:[l&&!n&&c.jsx(Tt,{title:l.title,message:l.message}),c.jsx("p",{className:"text-muted",children:ae}),E&&c.jsxs("div",{role:"note","data-testid":"server-plugin-needed",className:"rounded-lg border border-warning/40 bg-warning/[0.06] px-3 py-2 space-y-2 text-xs",children:[c.jsx("p",{className:"text-warning",children:s("marketplace.serverPluginNeeded",{title:u,package:E})}),(A==null?void 0:A.kind)==="installable"&&c.jsxs("label",{className:"flex items-start gap-2 text-text",children:[c.jsx("input",{type:"checkbox",checked:O,disabled:n,onChange:x=>j(x.target.checked),className:"mt-0.5"}),c.jsx("span",{children:s("marketplace.alsoInstallServer",{title:A.plugin.title||A.plugin.name})})]}),(A==null?void 0:A.kind)==="code"&&c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-muted",children:s("marketplace.serverPluginFromCode")}),c.jsx("ul",{className:"font-mono text-[11px] text-text break-all",children:A.packages.map(x=>c.jsx("li",{children:x.platform?`${x.platform}: ${x.name}`:x.name},`${x.platform}:${x.name}`))}),c.jsx("p",{className:"text-subtle",children:s("marketplace.installPageAnyway")})]})]}),p&&c.jsx(Ee,{label:s("marketplace.loadingSettings")}),!p&&h===null&&c.jsx("p",{role:"note",className:"rounded-lg border border-border bg-control/40 px-3 py-2 text-xs text-muted",children:s("marketplace.settingsFailed")}),W.length>0&&c.jsx(me,{compact:!0,title:s("marketplace.settingsRejected",{message:W.map(([x,Q])=>`${x}: ${Q}`).join("; ")})}),v.length>0&&c.jsxs("section",{"aria-labelledby":`${d}-settings`,className:"space-y-2",children:[c.jsxs("div",{children:[c.jsx("h3",{id:`${d}-settings`,className:"text-xs font-semibold uppercase tracking-wide text-subtle",children:s("marketplace.settings")}),c.jsx("p",{className:"text-xs text-subtle",children:s(e==="install"?"marketplace.settingsInstallHint":"marketplace.settingsUpdateHint")})]}),c.jsx("div",{className:"divide-y divide-border/50 rounded-lg border border-border",children:v.map(x=>{const Q=`${d}-${x.key}`,ne=R(x.key);return c.jsxs("div",{"data-setting":x.key,className:"px-3 py-2.5 flex flex-col md:flex-row md:items-start gap-2 md:gap-4",children:[c.jsxs("div",{className:"md:w-52 shrink-0 min-w-0",children:[c.jsx("label",{htmlFor:Q,className:"block text-sm text-text break-words",children:x.label}),x.label!==x.key&&c.jsx("div",{className:"text-[11px] font-mono text-subtle break-all",children:x.key}),x.description&&c.jsx("div",{className:"text-[11px] text-subtle mt-0.5",children:x.description})]}),c.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[c.jsx(Ts,{id:Q,entry:x,edit:g[x.key],onEdit:k=>G(x.key,k),disabled:n,error:ne}),ne&&c.jsx("div",{role:"alert",className:"text-xs text-error",children:ne})]})]},x.key)})})]})]})})}const Fh={install:"marketplace.installFailed",update:"marketplace.updateFailed",remove:"marketplace.removeFailed"},Rh={install:"marketplace.installing",update:"marketplace.updating",remove:"marketplace.removing"},Si={install:"marketplace.didInstall",update:"marketplace.didUpdate",remove:"marketplace.didRemove"};function br(e){const{t}=H(),{reload:n}=Ue(),{confirm:r,dialog:l}=zi(),a=_t(),[i,s]=D.useState(null),[o,u]=D.useState(null),[d,f]=D.useState(null),[h,p]=D.useState(null),g=D.useCallback(async(m,y,v={},N)=>{const E=y.title||y.name;u(null),f(null),s({name:y.name,action:m,title:E});try{if(m==="remove")await Ma(y.name),f(t(Si[m],{title:E}));else{const L=(await(m==="install"?Da:Fi)(y.name,{config:v})).configDropped??[];if(f(L.length>0?t("marketplace.didUpdateDropped",{title:E,keys:L.join(", ")}):t(Si[m],{title:E})),m==="install"&&N)try{await Qa(N.name),f(t("marketplace.didInstallWithServer",{title:E,server:N.title}))}catch(O){u({title:t("marketplace.serverInstallFailed",{title:E,server:N.title}),message:a(O)})}}p(null),n(),e()}catch(S){const A={title:t(Fh[m],{title:E}),message:a(S)};m==="remove"?u(A):S instanceof La?p({action:m,target:y,errors:S.errors}):p({action:m,target:y,errors:{},failure:A})}finally{s(null)}},[t,a,n,e]),b=D.useCallback(async(m,y)=>{if(m!=="remove"){p({action:m,target:y,errors:{}});return}const v=y.title||y.name;await r({title:t("marketplace.confirmRemove",{title:v}),message:t("marketplace.confirmRemoveMessage"),confirmLabel:t("marketplace.remove"),tone:"danger"})&&await g(m,y)},[r,t,g]),w=c.jsxs(c.Fragment,{children:[l,h&&c.jsx(zh,{action:h.action,target:h.target,busy:i!==null,serverErrors:h.errors,failure:h.failure,onCancel:()=>p(null),onConfirm:(m,y)=>void g(h.action,h.target,m,y)},`${h.action}:${h.target.name}`),i&&c.jsxs("div",{role:"status",className:"flex items-center gap-2 text-xs text-muted",children:[c.jsx(Ee,{}),t(Rh[i.action],{title:i.title})]}),o&&c.jsx(Tt,{title:o.title,message:o.message}),d&&c.jsx(Vn,{message:d,onDismiss:()=>f(null)})]});return{run:b,busy:i,status:w}}function ia(){const[,e]=He();return(t,n)=>e(r=>{const l=new URLSearchParams(r);return n===null?l.delete(t):l.set(t,n),l},{replace:!0})}function la(){const{t:e}=H(),[t]=He(),n=Wn(t),r=ia(),l=[{key:"any",label:e("marketplace.filterAll")},{key:"yes",label:e("marketplace.filterInstalled")},{key:"no",label:e("marketplace.filterNotInstalled")}];return c.jsx(Xn,{label:e("marketplace.filterInstalledLabel"),items:l.map(a=>({key:a.key,label:a.label,pressed:n===a.key,tone:n===a.key?"primary":"default",onClick:()=>r("installed",a.key==="any"?null:a.key)}))})}function Oh({platform:e}){const{t}=H(),[n]=He(),r=Bi(n),l=ia(),a=[{key:"this",label:e?t("serverMarketplace.filterThisServerPlatform",{platform:Z(e)}):t("serverMarketplace.filterThisServer")},{key:"all",label:t("serverMarketplace.filterAllPlatforms")},{key:"node",label:Z("node")},{key:"python",label:Z("python")},{key:"dotnet",label:Z("dotnet")}];return c.jsx(Xn,{label:t("serverMarketplace.filterPlatformLabel"),items:a.map(i=>({key:i.key,label:i.label,pressed:r===i.key,tone:r===i.key?"primary":"default",onClick:()=>l("platform",i.key==="this"?null:i.key)}))})}function _h({plugin:e,platform:t}){const{t:n}=H();return c.jsx("ul",{"aria-label":n("serverMarketplace.platforms"),className:"flex flex-wrap items-center gap-1.5",children:Gn.map(r=>{const l=!!e.platforms[r]||r===t&&!!e.platform,a=r===t,i=Z(r),s=a?n(l?"serverMarketplace.platformThisServer":"serverMarketplace.platformThisServerMissing",{platform:i}):n(l?"serverMarketplace.platformAvailable":"serverMarketplace.platformMissing",{platform:i}),o=a?l?"border-primary bg-primary/15 text-heading font-semibold":"border-error/40 bg-error/10 text-error line-through":l?"border-border bg-control text-text":"border-border/50 text-subtle line-through opacity-60";return c.jsx("li",{"data-platform":r,"data-available":l,"aria-current":a?"true":void 0,"aria-label":s,title:s,className:`px-1.5 py-0.5 rounded border text-[11px] ${o}`,children:i},r)})})}function aa({plugin:e,marketplaceUrl:t}){const{t:n}=H(),r=Xa(e,t);return c.jsxs("div",{role:"note","data-testid":"setup-note",className:"rounded-lg border border-warning/30 bg-warning/[0.06] px-3 py-2 text-xs space-y-0.5",children:[c.jsxs("div",{className:"font-medium text-warning",children:["⚙ ",n("serverMarketplace.needsSetup")]}),c.jsx("p",{className:"text-muted",children:e.autoInstallReason||n("serverMarketplace.needsSetupHint")}),r&&c.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline",children:[n("serverMarketplace.setupGuide")," ↗"]})]})}const Bh="font-mono text-[11px] text-muted bg-control border border-border/75 px-1.5 py-0.5 rounded";function $h({platform:e,command:t}){const{t:n}=H(),[r,l]=D.useState(!1);D.useEffect(()=>{if(!r)return;const i=setTimeout(()=>l(!1),1500);return()=>clearTimeout(i)},[r]);async function a(){try{await navigator.clipboard.writeText(t),l(!0)}catch{}}return c.jsxs("li",{className:"flex items-center gap-2","data-platform":e,children:[c.jsx("span",{className:"w-14 shrink-0 text-xs text-subtle",children:Z(e)}),c.jsx("code",{className:"flex-1 min-w-0 truncate font-mono text-xs text-text bg-control/60 border border-border rounded px-2 py-1",title:t,children:t}),c.jsx("button",{type:"button",onClick:()=>void a(),"aria-label":n("serverMarketplace.copyCommand",{platform:Z(e)}),className:"shrink-0 px-2 py-1 text-xs rounded-md bg-control hover:bg-control-hover text-text",children:n(r?"serverMarketplace.copied":"serverMarketplace.copy")})]})}function Uh({selected:e,available:t,platform:n,onSelect:r}){const{t:l}=H();return c.jsx("div",{role:"tablist","aria-label":l("serverMarketplace.platformSwitch"),className:"flex flex-wrap items-center gap-1.5",children:Gn.map(a=>{const i=t.includes(a),s=Z(a),o=i?a===n?l("serverMarketplace.platformTabThisServer",{platform:s}):s:l("serverMarketplace.platformTabMissing",{platform:s}),u=a===e,d=u?"border-primary bg-primary/15 text-heading font-semibold":i?"border-border bg-control text-text hover:bg-control-hover":"border-border/50 text-subtle line-through opacity-60 cursor-not-allowed";return c.jsx("button",{type:"button",role:"tab","data-platform":a,"aria-selected":u,"aria-controls":u?"platform-panel":void 0,"aria-disabled":!i||void 0,disabled:!i,title:o,onClick:()=>r(a),className:`px-2.5 py-1 rounded-md border text-xs inline-flex items-center gap-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 ${d}`,children:o},a)})})}function Hh({versions:e}){const{t}=H(),[n,r]=D.useState(null);if(!e.some(es))return null;const l=e.find(a=>a.version===n)??e[0];return c.jsx(je,{title:t("dependencies.sectionTitle"),children:c.jsxs("div",{className:"space-y-2",children:[e.length>1&&c.jsxs("label",{className:"flex items-center gap-2 text-xs text-subtle",children:[t("dependencies.ofVersion"),c.jsx("select",{value:l.version,onChange:a=>r(a.target.value),className:"px-2 py-1 text-xs bg-control border border-border rounded-md text-text font-mono focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",children:e.map(a=>c.jsxs("option",{value:a.version,children:["v",a.version]},a.version))})]}),c.jsx(ts,{version:l})]})})}function qh({plugin:e,platform:t,initialPlatform:n,marketplaceUrl:r,onClose:l}){var N,E,S,A,L;const{t:a}=H(),i=Yn(t),s=D.useCallback(()=>Ja(e.name),[e.name]),{data:o,loading:u,error:d,refetch:f}=se(s,[s]),h=o??e,p=Gn.filter(O=>h.platforms[O]),[g,b]=D.useState(n??null),w=g&&p.includes(g)?g:t&&p.includes(t)?t:p[0]??null,m=o&&w?o.versions.filter(O=>O.platform===w):[],y=w?o==null?void 0:o.platforms[w]:void 0,v=o?(N=y==null?void 0:y.readme)!=null&&N.trim()?{text:y.readme.trim(),format:y.readmeFormat}:o.readme.trim()?{text:o.readme.trim()}:o.description.trim()?{text:o.description.trim(),format:"text"}:null:null;return c.jsx(Hn,{open:!0,onClose:l,size:"lg",title:e.title,description:e.name,children:c.jsxs("div",{className:"space-y-4 text-sm",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(Pe,{icon:e.icon,names:[e.name]}),c.jsxs("div",{className:"min-w-0 space-y-1",children:[c.jsx(Jt,{plugin:e}),c.jsx("p",{className:"text-muted",children:e.description}),h.installed&&c.jsx("div",{className:Ve,"data-testid":"install-state",children:c.jsx(Ut,{installed:h.installed,updateAvailable:h.updateAvailable,latest:((E=h.platform)==null?void 0:E.latest)??null})})]})]}),!h.autoInstall&&!_n(h.installed)&&c.jsx(aa,{plugin:h,marketplaceUrl:r}),u&&!o&&c.jsx(Ee,{label:a("marketplace.loadingDetails")}),d&&c.jsx(me,{title:a("marketplace.detailsFailed"),error:i(new Error(d)),onRetry:f,compact:!0}),o&&c.jsxs(c.Fragment,{children:[p.length===0?c.jsx("p",{className:"text-xs text-subtle",children:a("marketplace.none")}):c.jsxs(c.Fragment,{children:[c.jsx(Uh,{selected:w,available:p,platform:t,onSelect:b}),w&&c.jsxs("div",{id:"platform-panel",role:"tabpanel","aria-label":Z(w),className:"space-y-4",children:[t&&c.jsx("p",{"data-testid":"platform-note",className:`text-xs ${w===t?"text-info":"text-subtle"}`,children:w===t?a("serverMarketplace.platformWouldInstall",{platform:Z(t)}):p.includes(t)?a("serverMarketplace.platformReference",{platform:Z(t),own:Z(t)}):a("serverMarketplace.errUnavailable",{platform:Z(t)})}),c.jsxs(je,{title:a("serverMarketplace.versionsOf",{platform:Z(w)}),children:[c.jsx("div",{className:"font-mono text-xs text-subtle break-all mb-1","data-testid":"platform-package",children:(S=o.platforms[w])==null?void 0:S.package}),c.jsx(It,{items:m.length>0?m.map(O=>({label:`v${O.version}`,key:O.version,title:O.serverRange?a("serverMarketplace.needsServer",{range:O.serverRange}):void 0})):(A=o.platforms[w])!=null&&A.latest?[{label:`v${(L=o.platforms[w])==null?void 0:L.latest}`,key:"latest"}]:[],max:5,title:a("serverMarketplace.versionsOf",{platform:Z(w)}),label:a("serverMarketplace.versionsOf",{platform:Z(w)}),chipClassName:Bh,empty:a("marketplace.none")})]}),c.jsx(Hh,{versions:m},w),c.jsx(je,{title:a("serverMarketplace.installCommand"),children:c.jsx("ul",{className:"space-y-1.5",children:c.jsx($h,{platform:w,command:o.platforms[w].install||Za(w,o.platforms[w].package)})})})]})]}),o.config&&c.jsx(je,{title:a("marketplace.settings"),children:c.jsx(na,{entries:o.config.entries})}),c.jsx(je,{title:w?a("serverMarketplace.readmeOf",{platform:Z(w)}):a("marketplace.readme"),children:v?c.jsx(ta,{text:v.text,format:v.format}):c.jsx("p",{className:"text-xs text-subtle",children:a("marketplace.noReadme")})})]})]})})}const kr="px-3 py-1.5 text-xs rounded-lg transition-colors inline-flex items-center gap-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",ji=`${kr} bg-primary text-on-primary hover:bg-primary/90`,Vh=`${kr} bg-control hover:bg-control-hover text-text`,Wh=`${kr} bg-control text-error hover:bg-error/10`;function Gh({plugin:e,info:t,viewing:n,canInstall:r,busy:l,working:a,onAction:i,onDetails:s}){const{t:o}=H(),u=ns(),d=yn(t,e),f=e.platform,h=e.installed,p=ra(h),g=e.allowed?void 0:u(e.blockedReason??"install disabled",d);return c.jsxs("article",{"aria-label":e.title,className:"bg-surface border border-border rounded-xl p-4 flex flex-col gap-3",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(Pe,{icon:e.icon,names:[e.name]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:qe,children:[c.jsx("h3",{className:"font-semibold text-heading text-sm truncate min-w-0",children:e.title}),(f==null?void 0:f.latest)&&c.jsxs("span",{className:Ie,children:["v",f.latest]})]}),c.jsx(Jt,{plugin:e}),n?e.platforms[n]&&c.jsx("div",{className:"text-[11px] text-subtle font-mono mt-0.5 truncate",title:e.platforms[n].package,children:e.platforms[n].package}):f&&c.jsx("div",{className:"text-[11px] text-subtle font-mono mt-0.5 truncate",title:f.package,children:f.package}),c.jsx("p",{className:"text-xs text-muted mt-1 line-clamp-2",children:e.description||o("plugins.noDescription")})]})]}),c.jsx(_h,{plugin:e,platform:d}),n&&c.jsx("p",{role:"note","data-testid":"other-platform",className:"text-xs text-muted",children:o("serverMarketplace.otherPlatformNote",{platform:Z(n),own:Z(d)||o("serverMarketplace.thisServer")})}),c.jsxs("div",{className:Ve,children:[n&&c.jsx(te,{variant:"neutral",children:o("serverMarketplace.notInstallableHere")}),c.jsx(Ut,{installed:h,updateAvailable:e.updateAvailable,latest:(f==null?void 0:f.latest)??null}),!f&&!n&&c.jsx(te,{variant:"neutral",children:o("serverMarketplace.notAvailable",{platform:Z(d)||o("serverMarketplace.thisServer")})}),f&&!f.compatible&&!_n(h)&&c.jsx(te,{variant:"error",children:o("serverMarketplace.incompatible",{reason:f.reason??o("serverMarketplace.incompatibleUnknown")})})]}),f&&!n&&!e.autoInstall&&!_n(h)&&c.jsx(aa,{plugin:e,marketplaceUrl:t.marketplaceUrl}),c.jsxs("div",{className:"mt-auto flex flex-wrap items-center gap-2",children:[c.jsx("button",{type:"button",onClick:s,className:Vh,"aria-label":o("marketplace.detailsOf",{title:e.title}),children:o("marketplace.details")}),r&&!n&&!h&&c.jsx(ke,{label:o("marketplace.install"),className:ji,blocked:g,busy:l==="install",disabled:a,onClick:()=>i("install")}),r&&!n&&p&&e.updateAvailable&&c.jsx(ke,{label:o("marketplace.update"),className:ji,blocked:g,busy:l==="update",disabled:a,onClick:()=>i("update")}),r&&!n&&p&&c.jsx(ke,{label:o("marketplace.remove"),className:Wh,busy:l==="remove",disabled:a,onClick:()=>i("remove")})]})]})}function Yh({info:e}){const{t}=H(),{hasPermission:n}=Ue(),r=Yn(e.platform),l=n(Bt),[a]=He(),[i,s]=D.useState(()=>a.get("q")??""),[o,u]=D.useState(()=>a.get("q")??""),[d,f]=D.useState(0),[h,p]=D.useState(qi),[g,b]=D.useState(null),w=Bi(a),m=Wn(a),y=w!=="this"&&w!=="all"&&w!==e.platform?w:null;D.useEffect(()=>{if(i===o)return;const M=setTimeout(()=>{u(i),f(0)},$i);return()=>clearTimeout(M)},[i,o]);const v=D.useCallback(()=>_i({query:o,page:d+1,pageSize:h}),[o,d,h]),{data:N,loading:E,error:S,refetch:A,refresh:L}=se(v,[v]);$t(L);const{run:O,busy:j,status:I}=Kn(L),z=Z(e.platform)||t("serverMarketplace.thisServer"),q=N?N.items.filter(M=>Th(M,e.platform,w,m)):[];return c.jsxs("div",{className:"space-y-4",children:[e.enabled?e.install==="off"&&c.jsx("div",{role:"note",className:"rounded-lg border border-border bg-control/40 px-3 py-2 text-xs text-muted",children:t("marketplace.installOff")}):c.jsx("div",{role:"note",className:"rounded-lg border border-border bg-control/40 px-3 py-2 text-xs text-muted",children:t("serverMarketplace.disabled")}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx("input",{type:"search",placeholder:t("serverMarketplace.search"),"aria-label":t("serverMarketplace.search"),value:i,onChange:M=>s(M.target.value),className:"w-full sm:w-auto sm:flex-1 sm:min-w-[16rem] max-w-sm px-3 py-2 text-sm bg-control border border-border rounded-lg text-text placeholder-subtle focus:outline-none focus:border-primary/50"}),c.jsx(Oh,{platform:e.platform}),c.jsx(la,{})]}),I,E&&!N&&c.jsx(et,{count:6,label:t("serverMarketplace.loading")}),S&&c.jsx(me,{title:t("serverMarketplace.loadFailed"),error:r(new Error(S)),onRetry:A}),!S&&N&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:[q.map(M=>c.jsx(Gh,{plugin:M,info:e,viewing:y,canInstall:l,busy:(j==null?void 0:j.name)===M.name?j.action:null,working:j!==null,onAction:R=>{var W,G,J;return void O(R,{name:M.name,title:M.title,package:((W=M.platform)==null?void 0:W.package)??M.name,publisher:M.publisher,version:R==="remove"?(G=M.platform)==null?void 0:G.installed:(J=M.platform)==null?void 0:J.latest,platform:yn(e,M)})},onDetails:()=>b(M)},M.name)),N.items.length===0&&c.jsx(ye,{className:"col-span-full bg-surface border border-border rounded-xl",message:o.trim()?t("serverMarketplace.noMatches",{query:o.trim()}):t("serverMarketplace.empty",{platform:z})}),N.items.length>0&&q.length===0&&c.jsx(ye,{className:"col-span-full bg-surface border border-border rounded-xl",message:t("marketplace.filterNoMatches")})]}),c.jsx(Vi,{page:d,pageSize:h,total:N.total,onPage:f,onPageSize:M=>{p(M),f(0)}})]}),g&&c.jsx(qh,{plugin:g,platform:yn(e,g),initialPlatform:y,marketplaceUrl:e.marketplaceUrl,onClose:()=>b(null)})]})}function Kh(){const{t:e}=H(),t=se(Oi,[]),n=Yn();return t.loading&&!t.data?c.jsx(et,{count:6,label:e("serverMarketplace.loading")}):t.error?c.jsx(me,{title:e("serverMarketplace.loadFailed"),error:n(new Error(t.error)),onRetry:t.refetch}):t.data?c.jsx(Yh,{info:t.data}):c.jsx(ye,{className:"bg-surface border border-border rounded-xl",message:e("serverMarketplace.unavailable"),detail:e("serverMarketplace.unavailableHint")})}const yr="px-3 py-1.5 text-xs rounded-lg transition-colors inline-flex items-center gap-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",Ci=`${yr} bg-primary text-on-primary hover:bg-primary/90`,Qh=`${yr} bg-control hover:bg-control-hover text-text`,Xh=`${yr} bg-control text-error hover:bg-error/10`,Jh="opacity-50 cursor-not-allowed";function ke({label:e,className:t,onClick:n,blocked:r,busy:l,disabled:a}){return r?c.jsx(Ms,{content:()=>r,children:i=>c.jsx("button",{type:"button","aria-disabled":"true","aria-describedby":i,className:`${t} ${Jh}`,children:e})}):c.jsxs("button",{type:"button",onClick:n,disabled:a||l,className:`${t} disabled:opacity-50`,children:[l&&c.jsx(Ee,{}),e]})}function Zh({plugin:e,canInstall:t,busy:n,working:r,onAction:l,onDetails:a}){const{t:i}=H(),s=ls(),o=e.allowed?void 0:s(e.blockedReason??"install disabled"),u=e.installed,d=ra(u);return c.jsxs("article",{"aria-label":e.title,className:"bg-surface border border-border rounded-xl p-4 flex flex-col gap-3",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(Pe,{icon:e.icon,names:[e.name]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:qe,children:[c.jsx("h3",{className:"font-semibold text-heading text-sm truncate min-w-0",children:e.title}),e.latest&&c.jsxs("span",{className:Ie,children:["v",e.latest]})]}),c.jsx(Jt,{plugin:e}),c.jsx("p",{className:"text-xs text-muted mt-1 line-clamp-2",children:e.description||i("plugins.noDescription")})]})]}),c.jsxs("div",{className:Ve,children:[c.jsx(Ut,{installed:u,updateAvailable:e.updateAvailable,latest:e.latest}),e.requires&&!e.requires.installed&&c.jsxs(te,{variant:"warning",children:["⚠ ",i("marketplace.needsServerPlugin",{name:e.requires.serverPackage})]})]}),c.jsxs("div",{className:"mt-auto flex flex-wrap items-center gap-2",children:[c.jsx("button",{type:"button",onClick:a,className:Qh,"aria-label":i("marketplace.detailsOf",{title:e.title}),children:i("marketplace.details")}),t&&!u&&c.jsx(ke,{label:i("marketplace.install"),className:Ci,blocked:o,busy:n==="install",disabled:r,onClick:()=>l("install")}),t&&d&&e.updateAvailable&&c.jsx(ke,{label:i("marketplace.update"),className:Ci,blocked:o,busy:n==="update",disabled:r,onClick:()=>l("update")}),t&&d&&c.jsx(ke,{label:i("marketplace.remove"),className:Xh,busy:n==="remove",disabled:r,onClick:()=>l("remove")})]})]})}function em({info:e}){const{t}=H(),{hasPermission:n}=Ue(),r=_t(),l=qn(n),[a,i]=D.useState(""),[s,o]=D.useState(""),[u,d]=D.useState(0),[f,h]=D.useState(qi),[p,g]=D.useState(null),[b]=He(),w=Wn(b);D.useEffect(()=>{if(a===s)return;const I=setTimeout(()=>{o(a),d(0)},$i);return()=>clearTimeout(I)},[a,s]);const m=D.useCallback(()=>Fa({query:s,page:u+1,pageSize:f}),[s,u,f]),{data:y,loading:v,error:N,refetch:E,refresh:S}=se(m,[m]);Qn(S);const{run:A,busy:L,status:O}=br(S),j=((y==null?void 0:y.items)??[]).filter(I=>w==="any"||w==="yes"==!!I.installed);return c.jsxs("div",{className:"space-y-4",children:[e.install==="off"&&c.jsx("div",{role:"note",className:"rounded-lg border border-border bg-control/40 px-3 py-2 text-xs text-muted",children:t("marketplace.installOff")}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx("input",{type:"search",placeholder:t("marketplace.search"),"aria-label":t("marketplace.search"),value:a,onChange:I=>i(I.target.value),className:"w-full sm:w-auto sm:flex-1 sm:min-w-[16rem] max-w-sm px-3 py-2 text-sm bg-control border border-border rounded-lg text-text placeholder-subtle focus:outline-none focus:border-primary/50"}),c.jsx(la,{})]}),O,v&&!y&&c.jsx(et,{count:6,label:t("marketplace.loading")}),N&&c.jsx(me,{title:t("marketplace.loadFailed"),error:r(new Error(N)),onRetry:E}),!N&&y&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:[j.map(I=>c.jsx(Zh,{plugin:I,canInstall:l,busy:(L==null?void 0:L.name)===I.name?L.action:null,working:L!==null,onAction:z=>void A(z,{name:I.name,title:I.title,publisher:I.publisher.name,requires:I.requires}),onDetails:()=>g(I)},I.name)),y.items.length===0&&c.jsx(ye,{className:"col-span-full bg-surface border border-border rounded-xl",message:s.trim()?t("marketplace.noMatches",{query:s.trim()}):t("marketplace.empty")}),y.items.length>0&&j.length===0&&c.jsx(ye,{className:"col-span-full bg-surface border border-border rounded-xl",message:t("marketplace.filterNoMatches")})]}),c.jsx(Vi,{page:u,pageSize:f,total:y.total,onPage:d,onPageSize:I=>{h(I),d(0)}})]}),p&&c.jsx(Ph,{plugin:p,onClose:()=>g(null)})]})}function tm({info:e}){const{t}=H(),n=_t();return e.loading&&!e.data?c.jsx(et,{count:6,label:t("marketplace.loading")}):e.error?c.jsx(me,{title:t("marketplace.loadFailed"),error:n(new Error(e.error)),onRetry:e.refetch}):e.data?c.jsx(em,{info:e.data}):c.jsx(ye,{className:"bg-surface border border-border rounded-xl",message:t("marketplace.unavailable"),detail:t("marketplace.unavailableHint")})}const nm=[{id:"console",label:"serverMarketplace.kindConsole"},{id:"server",label:"serverMarketplace.kindServer"}];function rm(){var s;const{t:e}=H(),[t,n]=He(),r=rs(t),l=se(za,[]),a=is((s=l.data)==null?void 0:s.marketplaceUrl,r),i=o=>n(u=>{const d=new URLSearchParams(u);return o==="console"?d.delete("kind"):d.set("kind",o),d},{replace:!0});return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[c.jsx(Xn,{label:e("serverMarketplace.kindSwitch"),items:nm.map(o=>({key:o.id,label:e(o.label),pressed:r===o.id,tone:r===o.id?"primary":"default",onClick:()=>i(o.id)}))}),a&&c.jsxs("a",{href:a.href,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-accent hover:underline",children:[e("serverMarketplace.browseSite",{host:a.host})," ↗"]})]}),r==="server"?c.jsx(Kh,{}):c.jsx(tm,{info:l})]})}const sa="/api/v1/qcli/updates",im="updates:read",Bn=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Se=e=>typeof e=="string"&&e?e:null,lm=["console","server","core"],am=["marketplace","code","npm"];function Ni(e){if(!Bn(e)||typeof e.name!="string"||!e.name)return null;const t=Oa(e.kind)?"console":lm.includes(e.kind)?e.kind:null;if(!t)return null;const n={};if(Bn(e.install))for(const[r,l]of Object.entries(e.install))typeof l=="string"&&l&&(n[r]=l);return{kind:t,name:e.name,package:Se(e.package)??e.name,title:Se(e.title)??e.name,icon:Se(e.icon),current:Se(e.current),latest:Se(e.latest),source:am.includes(e.source)?e.source:"code",updateAvailable:e.updateAvailable!==!1,canUpdate:e.canUpdate===!0,...Se(e.reason)?{reason:Se(e.reason)}:{},install:n}}function oa(e){var r;if(!Bn(e)||!("consolePlugins"in e||"dashboardPlugins"in e||"serverPlugins"in e||"checkedAt"in e))return null;const t=l=>Array.isArray(l)?l.map(Ni).filter(a=>a!==null):[],n={checkedAt:Se(e.checkedAt),checking:e.checking===!0,...Se(e.error)?{error:Se(e.error)}:{},server:Ni(e.server),consolePlugins:t(e.consolePlugins??e.dashboardPlugins),serverPlugins:t(e.serverPlugins),codePlugins:t(e.codePlugins),count:0};return n.count=typeof e.count=="number"&&e.count>=0?e.count:n.consolePlugins.length+n.serverPlugins.length+n.codePlugins.length+((r=n.server)!=null&&r.updateAvailable?1:0),n}async function sm(){try{return oa(await Ri(sa))}catch(e){if(e instanceof Ra&&[403,404,405].includes(e.status))return null;throw e}}async function om(){return oa(await Ri(`${sa}/check`,{method:"POST"}))}const ua="px-3 py-1.5 text-xs rounded-lg transition-colors inline-flex items-center gap-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 disabled:opacity-50",Ei=`${ua} bg-primary text-on-primary hover:bg-primary-hover`,ca=`${ua} bg-control hover:bg-control-hover text-text`;function um(e){return e?[...e.consolePlugins,...e.serverPlugins].filter(t=>t.canUpdate):[]}function $n({title:e,hint:t,actions:n}){return c.jsxs("div",{className:"flex flex-wrap items-end gap-3 mb-3",children:[c.jsxs("div",{className:"flex-1 min-w-[12rem]",children:[c.jsx("h3",{className:"text-sm font-semibold text-heading",children:e}),t&&c.jsx("p",{className:"text-xs text-subtle",children:t})]}),n]})}function da({platform:e,command:t}){const{t:n}=H(),[r,l]=D.useState(!1),a=Z(e)||e;return c.jsxs("div",{className:"flex items-stretch gap-2 min-w-0",children:[c.jsx("span",{className:"w-14 shrink-0 self-center text-[11px] text-subtle",children:a}),c.jsx("code",{className:"flex-1 min-w-0 px-2 py-1.5 rounded-md bg-control text-[11px] font-mono text-text break-all",children:t}),c.jsx("button",{type:"button","aria-label":n("updates.copyCommand",{platform:a}),onClick:()=>{var i;(i=navigator.clipboard)==null||i.writeText(t).then(()=>{l(!0),setTimeout(()=>l(!1),1500)},()=>{})},className:`${ca} shrink-0`,children:n(r?"updates.copied":"updates.copy")})]})}function cm({item:e}){const{t}=H();return c.jsx("span",{className:Ie,"data-testid":"update-versions",children:t("updates.versions",{current:e.current??t("updates.unknownVersion"),latest:e.latest??t("updates.unknownVersion")})})}function Ai({item:e,children:t}){const{t:n}=H();return c.jsxs("article",{"aria-label":e.title,"data-testid":"update-card",className:"bg-surface border border-border rounded-xl p-4 flex flex-col gap-3",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(Pe,{icon:e.icon,names:[e.package,e.name]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:qe,children:[c.jsx("span",{className:"font-semibold text-heading text-sm truncate min-w-0",children:e.title}),c.jsx(cm,{item:e})]}),c.jsx("div",{className:"text-[11px] text-subtle font-mono mt-0.5 truncate",title:e.package,children:e.package})]})]}),c.jsxs("div",{className:Ve,children:[c.jsx(te,{variant:"neutral",children:e.kind==="console"?n("updates.kindConsole"):n("updates.kindServer")}),c.jsx(te,{variant:"warning",children:n("updates.updateAvailable")})]}),t]})}function dm({server:e}){const{t}=H();return c.jsxs("section",{children:[c.jsx($n,{title:t("updates.serverTitle"),hint:t("updates.serverHint")}),c.jsxs("div",{className:"bg-surface border border-border rounded-xl p-4 space-y-3","data-testid":"server-update",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"font-mono text-xs text-text",children:e.package}),c.jsx("span",{className:Ie,children:t("updates.running",{version:e.current??t("updates.unknownVersion")})}),e.latest&&c.jsx("span",{className:Ie,children:t("updates.newest",{version:e.latest})}),e.updateAvailable?c.jsx(te,{variant:"warning",children:t("updates.updateAvailable")}):e.latest?c.jsx(te,{variant:"success",dot:!0,children:t("updates.serverUpToDate")}):null]}),!e.latest&&c.jsx("p",{className:"text-xs text-subtle",children:t("updates.serverUnknown")}),e.updateAvailable&&Object.entries(e.install).map(([n,r])=>c.jsx(da,{platform:n,command:r},n))]})]})}function fm({updates:e}){const{t,formatRelative:n,formatDate:r}=H(),{hasPermission:l,reload:a}=Ue(),{confirm:i,dialog:s}=zi(),o=br(e.refresh),u=Kn(e.refresh);Qn(e.refresh),$t(e.refresh);const[d,f]=D.useState(!1),[h,p]=D.useState(null),[g,b]=D.useState(null),[w,m]=D.useState(null),[y,v]=D.useState(null),N=qn(l),E=l(Bt),S=l(im)||E,A=e.data&&g&&(g.checkedAt??"")>=(e.data.checkedAt??"")?g:e.data,L=M=>M.canUpdate&&(M.kind==="console"?N:E),O=um(A).filter(L);async function j(){f(!0),p(null);try{b(await om()),e.refresh()}catch(M){p(kn(M))}finally{f(!1)}}async function I(){if(!await i({title:t("updates.confirmUpdateAll",{count:O.length}),message:c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{children:t("updates.confirmUpdateAllMessage")}),c.jsx("ul",{className:"list-disc pl-5 text-xs space-y-0.5",children:O.map(J=>c.jsxs("li",{children:[c.jsx("span",{className:"text-text",children:J.title})," ",c.jsxs("span",{className:"font-mono text-subtle",children:[J.current," → ",J.latest]})]},`${J.kind}:${J.name}`))})]}),confirmLabel:t("updates.updateAll"),tone:"danger"}))return;v(null);const R=[];let W=0,G=!1;for(const[J,ae]of O.entries()){m({done:J+1,total:O.length});try{if(ae.kind==="console")await Fi(ae.name);else{const x=await ss(ae.name);G||(G=x.restartRequired)}W++}catch(x){R.push(t("updates.updateAllFailed",{title:ae.title,message:kn(x)}))}}m(null),v({updated:W,restart:G,failures:R}),a(),e.refresh()}if(e.loading&&!e.data)return c.jsx(_a,{items:3,label:t("updates.tab"),className:"bg-surface border border-border rounded-xl p-4"});if(e.error&&!e.data)return c.jsx(me,{title:t("updates.loadFailed"),error:e.error,onRetry:e.refetch});if(!A)return c.jsx(ye,{className:"bg-surface border border-border rounded-xl",message:t("updates.unavailable")});const z=[...A.consolePlugins,...A.serverPlugins],q=d||A.checking;return c.jsxs("div",{className:"space-y-8","data-testid":"updates-tab",children:[s,c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx("p",{className:"flex-1 min-w-[12rem] text-xs text-muted","data-testid":"last-checked",children:A.checkedAt?c.jsx("time",{dateTime:A.checkedAt,title:r(A.checkedAt),children:t("updates.lastChecked",{time:n(A.checkedAt)})}):t("updates.neverChecked")}),S&&c.jsxs("button",{type:"button",onClick:()=>void j(),disabled:q,className:ca,children:[q&&c.jsx(Ee,{}),t(q?"updates.checking":"updates.checkNow")]})]}),h&&c.jsx(Tt,{title:t("updates.checkFailed",{message:h}),message:""}),A.error&&c.jsx("div",{role:"status",className:"rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",children:t("updates.partial",{message:A.error})}),A.count===0&&c.jsx(ye,{className:"bg-surface border border-border rounded-xl",message:A.checkedAt?c.jsxs("span",{className:"text-heading",children:[c.jsx("span",{"aria-hidden":!0,className:"text-success",children:"✓ "}),t("updates.upToDate")]}):t("updates.notChecked"),detail:A.checkedAt?t("updates.upToDateHint"):t("updates.notCheckedHint")}),z.length>0&&c.jsxs("section",{children:[c.jsx($n,{title:t("updates.marketplaceTitle"),hint:t("updates.marketplaceHint"),actions:O.length>1?c.jsxs("button",{type:"button",onClick:()=>void I(),disabled:w!==null,className:Ei,children:[w&&c.jsx(Ee,{}),t("updates.updateAll")]}):void 0}),c.jsxs("div",{className:"space-y-3 mb-3",children:[o.status,u.status,w&&c.jsxs("div",{role:"status",className:"flex items-center gap-2 text-xs text-muted",children:[c.jsx(Ee,{}),t("updates.updatingAll",{done:w.done,total:w.total})]}),y&&y.failures.map(M=>c.jsx(Tt,{title:M,message:""},M)),y&&y.updated>0&&(y.restart?c.jsx(as,{message:t("updates.didUpdateAll",{count:y.updated}),onDismiss:()=>v(null)}):c.jsx(Vn,{message:t("updates.didUpdateAll",{count:y.updated}),onDismiss:()=>v(null)}))]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:z.map(M=>{var G;const R=M.kind==="console"?o:u,W=R.busy!==null||w!==null;return c.jsxs(Ai,{item:M,children:[!M.canUpdate&&M.reason&&c.jsx("p",{className:"text-xs text-warning",children:t("updates.blocked",{reason:M.reason})}),L(M)&&c.jsx("div",{className:"flex flex-wrap gap-2",children:c.jsx(ke,{label:t("marketplace.update"),className:Ei,busy:((G=R.busy)==null?void 0:G.name)===M.name,disabled:W,onClick:()=>void(M.kind==="console"?o.run("update",{name:M.name,title:M.title}):u.run("update",{name:M.name,title:M.title,package:M.package,version:M.latest}))})})]},`${M.kind}:${M.name}`)})})]}),A.codePlugins.length>0&&c.jsxs("section",{children:[c.jsx($n,{title:t("updates.codeTitle"),hint:t("updates.codeHint")}),c.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:A.codePlugins.map(M=>c.jsx(Ai,{item:M,children:c.jsx("div",{className:"space-y-1.5",children:Object.entries(M.install).map(([R,W])=>c.jsx(da,{platform:R,command:W},R))})},`${M.kind}:${M.name}`))})]}),A.server&&c.jsx(dm,{server:A.server})]})}const mt=176,gt=46,Ii=64,Pi=14,At=8;function pm(e){var w;const t=new Map(e.nodes.map(m=>[m.id,m])),n=e.edges.filter(m=>m.from!==m.to&&t.has(m.from)&&t.has(m.to)),r=new Set(n.flatMap(m=>[m.from,m.to])),l=new Map;for(const m of n)l.set(m.from,[...l.get(m.from)??[],m.to]);const a=new Map,i=new Set,s=m=>{const y=a.get(m);if(y!==void 0)return y;if(i.has(m))return 0;i.add(m);const v=l.get(m)??[],N=v.length===0?0:1+Math.max(...v.map(s));return i.delete(m),a.set(m,N),N},o=[...r].sort();o.forEach(s);const u=[];for(const m of o)(u[w=a.get(m)]??(u[w]=[])).push(m);const d=new Map;u.forEach((m,y)=>{if(y>0){const v=N=>{const E=(l.get(N)??[]).map(S=>d.get(S)).filter(S=>S!==void 0);return E.length?E.reduce((S,A)=>S+A,0)/E.length:Number.MAX_SAFE_INTEGER};m.sort((N,E)=>v(N)-v(E)||N.localeCompare(E))}m.forEach((v,N)=>d.set(v,N))});const f=Math.max(0,...u.map(m=>(m==null?void 0:m.length)??0)),h=gt+Pi,p=[];u.forEach((m,y)=>{const v=(f-m.length)*h/2;m.forEach((N,E)=>p.push({node:t.get(N),layer:y,row:E,x:At+y*(mt+Ii),y:At+v+E*h}))});const g=new Map(p.map(m=>[m.node.id,m])),b=n.map(m=>{const y=g.get(m.from),v=g.get(m.to),N=y.x,E=y.y+gt/2,S=v.x+mt,A=v.y+gt/2,L=Math.max(24,Math.abs(N-S)/2);return{edge:m,path:`M ${N} ${E} C ${N-L} ${E}, ${S+L} ${A}, ${S} ${A}`}});return{nodes:p,edges:b,width:u.length?At*2+u.length*mt+(u.length-1)*Ii:0,height:f?At*2+f*h-Pi:0,unrelated:e.nodes.filter(m=>!r.has(m.id)).length}}const fa={ok:{box:"fill-success/10 stroke-success/60",dot:"fill-success"},waiting:{box:"fill-warning/10 stroke-warning/70",dot:"fill-warning"},broken:{box:"fill-error/10 stroke-error/70",dot:"fill-error"},absent:{box:"fill-surface stroke-subtle [stroke-dasharray:4_3]",dot:"fill-subtle"},other:{box:"fill-surface stroke-border",dot:"fill-subtle"}},pa={requires:void 0,optional:"6 4",capability:"2 3"},Ti=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e;function hm(e,t){if(e.status==="missing")return ms(e.id);if(e.package&&(t!=null&&t.some(r=>r.id===e.package)))return xt(e.package);const n=Ui(t,e.id);return n.installed?n.path:e.package?xt(e.package):n.path}function mm(){const{t:e}=H(),t=[["ok",e("dependencies.legendLoaded")],["waiting",e("dependencies.legendWaiting")],["broken",e("dependencies.legendBroken")],["absent",e("dependencies.legendAbsent")],["other",e("dependencies.legendOther")]],n=[["requires",e("dependencies.kindRequires")],["optional",e("dependencies.kindOptional")],["capability",e("dependencies.kindCapability")]];return c.jsxs("ul",{"aria-label":e("dependencies.legend"),className:"flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[11px] text-muted",children:[t.map(([r,l])=>c.jsxs("li",{className:"inline-flex items-center gap-1.5",children:[c.jsx("svg",{"aria-hidden":!0,width:"14",height:"10",children:c.jsx("rect",{x:"0.5",y:"0.5",width:"13",height:"9",rx:"2",className:fa[r].box})}),l]},r)),n.map(([r,l])=>c.jsxs("li",{className:"inline-flex items-center gap-1.5",children:[c.jsx("svg",{"aria-hidden":!0,width:"22",height:"6",children:c.jsx("line",{x1:"0",y1:"3",x2:"22",y2:"3",strokeWidth:"1.5",strokeDasharray:pa[r],className:"stroke-muted"})}),l]},r))]})}function gm({nodes:e,edges:t,packages:n}){const{t:r}=H(),l=Ba(),a=us(),i=D.useMemo(()=>pm({nodes:e,edges:t}),[e,t]),s=D.useMemo(()=>new Set(e.filter(b=>b.status==="missing"&&t.some(w=>w.to===b.id)&&t.filter(w=>w.to===b.id).every(w=>w.kind==="optional")).map(b=>b.id)),[e,t]),{setElement:o,update:u,overflowing:d,moreLeft:f,moreRight:h}=xm();function p(b){l(hm(b,n))}function g(b,w){b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),p(w))}return c.jsxs("div",{className:"relative",children:[d&&c.jsxs("p",{"data-testid":"graph-scroll-hint",className:"mb-1.5 text-[11px] text-subtle",children:["↔ ",r("dependencies.scrollHint")]}),c.jsx("div",{ref:o,onScroll:u,"data-testid":"graph-scroller",className:"overflow-x-auto overscroll-x-contain",children:c.jsx("div",{className:"w-max pr-4",children:c.jsxs("svg",{role:"group","aria-label":r("dependencies.graphLabel"),width:i.width,height:i.height,viewBox:`0 0 ${i.width} ${i.height}`,className:"block",children:[c.jsxs("defs",{children:[c.jsx("marker",{id:"dep-arrow",viewBox:"0 0 8 8",refX:"7",refY:"4",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:c.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-muted"})}),c.jsx("marker",{id:"dep-arrow-bad",viewBox:"0 0 8 8",refX:"7",refY:"4",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:c.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-error"})})]}),c.jsx("g",{"aria-hidden":!0,children:i.edges.map(({edge:b,path:w})=>{const m=cs(b.kind,b.status);return c.jsx("path",{"data-testid":"graph-edge","data-status":b.status,d:w,fill:"none",strokeWidth:m?1.75:1.25,strokeDasharray:pa[b.kind],markerEnd:`url(#${m?"dep-arrow-bad":"dep-arrow"})`,className:m?"stroke-error/80":"stroke-muted/70"},`${b.from}>${b.to}:${b.kind}:${b.capability??""}`)})}),i.nodes.map(({node:b,x:w,y:m})=>{const y=s.has(b.id)?"absent":b.status,v=fa[hs(y)],N=a(y),E=y==="absent"?r("dependencies.nodeAbsent",{id:b.id}):b.status==="missing"?r("dependencies.nodeMissing",{id:b.id}):r("dependencies.nodeLabel",{id:b.id,status:N,version:b.version?` ${b.version}`:""});return c.jsxs("g",{role:"link",tabIndex:0,"aria-label":E,"data-testid":"graph-node","data-node":b.id,"data-status":y,onClick:()=>p(b),onKeyDown:S=>g(S,b),transform:`translate(${w} ${m})`,className:"group cursor-pointer focus:outline-none",children:[c.jsx("title",{children:E}),c.jsx("rect",{width:mt,height:gt,rx:"8",strokeWidth:"1.25",className:`${v.box} transition-colors group-hover:stroke-primary`}),c.jsx("rect",{x:"-3",y:"-3",width:mt+6,height:gt+6,rx:"10",fill:"none",strokeWidth:"2",className:"stroke-primary opacity-0 group-focus-visible:opacity-100"}),c.jsx("circle",{cx:"13",cy:"16",r:"3.5",className:v.dot}),c.jsx("text",{x:"23",y:"20",className:"fill-heading text-[12px] font-semibold font-mono",children:Ti(b.id,19)}),c.jsx("text",{x:"12",y:"36",className:"fill-subtle text-[10px]",children:Ti([b.version?`v${b.version}`:"",N].filter(Boolean).join(" · "),28)})]},b.id)})]})})}),h&&c.jsx("div",{"aria-hidden":!0,"data-testid":"graph-fade-right",className:"pointer-events-none absolute inset-y-0 right-0 w-10 bg-gradient-to-l from-surface to-transparent"}),f&&c.jsx("div",{"aria-hidden":!0,"data-testid":"graph-fade-left",className:"pointer-events-none absolute inset-y-0 left-0 w-10 bg-gradient-to-r from-surface to-transparent"})]})}function xm(){const[e,t]=D.useState(null),[n,r]=D.useState({overflowing:!1,moreLeft:!1,moreRight:!1}),l=D.useCallback(()=>{if(!e)return;const a=e.scrollWidth>e.clientWidth+1,i={overflowing:a,moreLeft:a&&e.scrollLeft>1,moreRight:a&&e.scrollLeft+e.clientWidth<e.scrollWidth-1};r(s=>s.overflowing===i.overflowing&&s.moreLeft===i.moreLeft&&s.moreRight===i.moreRight?s:i)},[e]);return D.useEffect(()=>{const a=requestAnimationFrame(l);return window.addEventListener("resize",l),()=>{cancelAnimationFrame(a),window.removeEventListener("resize",l)}},[l]),{setElement:t,update:l,...n}}function bm({edges:e,packages:t}){const{t:n}=H(),r=ds(),l=[...e].sort((i,s)=>i.from.localeCompare(s.from)||i.to.localeCompare(s.to)),a=i=>{const{path:s}=Ui(t,i);return c.jsx(Ae,{to:s,className:"font-mono text-accent hover:underline break-all rounded focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",children:i})};return c.jsxs("section",{children:[c.jsx("h3",{className:"text-sm font-semibold text-heading mb-2",children:n("dependencies.listTitle")}),c.jsx("ul",{className:"bg-surface border border-border rounded-xl divide-y divide-border text-xs","data-testid":"edge-list",children:l.map(i=>c.jsxs("li",{"data-status":i.status,className:"px-3 sm:px-4 py-2 flex items-start gap-3",children:[c.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[a(i.from),c.jsx("span",{className:"text-subtle",children:n(fs[i.kind]).toLowerCase()}),i.kind==="capability"&&i.capability&&c.jsx("span",{className:"font-mono text-text",children:i.capability}),i.kind==="capability"&&i.capability&&c.jsx("span",{className:"text-subtle",children:n("dependencies.providedByLabel")}),a(i.to),i.kind!=="capability"&&c.jsx("span",{className:"font-mono text-muted",children:r(i.range)}),i.order==="before"&&c.jsx("span",{className:"text-subtle",children:n("dependencies.loadsBefore")}),i.version&&c.jsx("span",{className:"text-subtle",children:n("dependencies.found",{version:i.version})})]}),i.message&&c.jsx("p",{className:"text-[11px] text-muted",children:i.message})]}),c.jsx("span",{"data-testid":"edge-status",className:"shrink-0",children:c.jsx(ps,{status:i.status,kind:i.kind})})]},`${i.from}>${i.to}:${i.kind}:${i.capability??""}`))})]})}function km({round:e,packages:t}){const{t:n}=H(),r=se(os,[e]);if($t(r.refresh),wn(r.refresh),r.loading&&!r.data)return c.jsxs(Di,{label:n("dependencies.loading"),className:"space-y-4",children:[c.jsx(_e,{className:"h-3.5 w-48"}),c.jsx("div",{className:"bg-surface border border-border rounded-xl p-3 flex gap-10 overflow-hidden",children:[3,2,1].map((u,d)=>c.jsx("div",{className:"flex flex-col justify-center gap-3 shrink-0",children:Array.from({length:u},(f,h)=>c.jsx(_e,{className:"h-11 w-40 rounded-lg"},h))},d))}),c.jsx("div",{className:"bg-surface border border-border rounded-xl divide-y divide-border",children:[0,1,2].map(u=>c.jsx("div",{className:"px-4 py-3",children:c.jsx(_e,{className:"h-3 w-2/3"})},u))})]});if(r.error)return c.jsx(me,{title:n("dependencies.loadFailed"),error:r.error,onRetry:r.refetch});if(!r.data)return c.jsx(ye,{className:"bg-surface border border-border rounded-xl",message:n("dependencies.unsupported"),detail:n("dependencies.unsupportedHint")});const{nodes:l,edges:a}=r.data;if(a.length===0)return c.jsx(ye,{className:"bg-surface border border-border rounded-xl",message:n("dependencies.empty"),detail:n("dependencies.emptyHint")});const i=new Set(a.map(u=>u.from)).size,s=a.filter(u=>u.status!=="ok"&&u.kind!=="optional").length,o=l.length-new Set(a.flatMap(u=>[u.from,u.to])).size;return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("section",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-semibold text-heading",children:n("dependencies.graphTitle")}),c.jsx("p",{className:"text-xs text-subtle",children:n("dependencies.graphHint")})]}),c.jsxs("p",{"data-testid":"graph-summary",className:"text-xs text-muted",children:[n("dependencies.summaryPlugins",{count:i})," · ",c.jsx("span",{className:s>0?"text-error font-medium":"",children:n("dependencies.summaryProblems",{count:s})}),o>0&&c.jsxs(c.Fragment,{children:[" · ",n("dependencies.summaryUnrelated",{count:o})]})]}),c.jsx(mm,{}),c.jsx("div",{className:"bg-surface border border-border rounded-xl p-2 sm:p-3",children:c.jsx(gm,{nodes:l,edges:a,packages:t})})]}),c.jsx(bm,{edges:a,packages:t})]})}const ha="block h-full bg-surface border rounded-xl transition-colors hover:border-primary/50 hover:bg-control/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60";function ym({plugin:e,onToggle:t}){var a;const n=e.processorCount??((a=e.processors)==null?void 0:a.length)??0,{t:r,formatNumber:l}=H();return c.jsxs("div",{className:`relative ${e.enabled?"":"opacity-60 hover:opacity-80"}`,children:[c.jsxs(Ae,{to:xt(e.id),className:`${ha} p-4 ${e.enabled?"border-border":"border-border/50"}`,children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsx(Pe,{icon:e.icon,names:[e.id,e.name]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:qe,children:[c.jsx("span",{className:"font-semibold text-heading text-sm truncate min-w-0",children:e.name||e.id}),c.jsxs("span",{className:Ie,children:["v",e.version]})]}),c.jsx("p",{className:"text-xs text-muted mt-1 line-clamp-2",children:e.description||r("plugins.noDescription")})]}),c.jsx("div",{className:"shrink-0",children:c.jsx(te,{variant:e.enabled?"success":"neutral",dot:!0,children:e.enabled?r("common.enabled"):r("common.disabled")})})]}),c.jsxs("div",{className:"text-[11px] text-subtle mt-3 pr-12",children:[c.jsx("span",{className:"text-text font-medium",children:l(n)})," ",r("plugins.processorUnit",{count:n})]})]}),c.jsx(ys,{enabled:e.enabled,onToggle:()=>t(e.id),className:"absolute bottom-4 right-4"})]})}function wm({plugin:e,onChanged:t}){const{t:n}=H(),r=e.status==="needs-configuration",l=e.status==="needs-dependencies",a=e.name||e.id;return c.jsxs("article",{"aria-label":a,className:"flex flex-col h-full",children:[c.jsxs(Ae,{to:xt(e.id),className:`${ha} border-border p-4 flex items-start gap-3 ${r||l||e.settings?"rounded-b-none":""}`,children:[c.jsx(Pe,{icon:e.icon,names:[e.id,e.name]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:qe,children:[c.jsx("span",{className:"font-semibold text-heading text-sm truncate min-w-0",children:a}),e.version&&c.jsxs("span",{className:Ie,children:["v",e.version]})]}),c.jsx("div",{className:"text-[11px] text-subtle font-mono mt-0.5 truncate",title:e.id,children:e.id}),c.jsx("p",{className:"text-xs text-muted mt-1 line-clamp-2",children:e.description||n("plugins.noDescription")})]})]}),r&&c.jsx(vm,{title:a,missing:e.missing,settingsPath:vn({name:e.id,settings:e.settings}),className:"border border-t-0 border-border rounded-b-xl bg-surface px-4 pb-3 pt-2"}),l&&c.jsx(Hi,{title:a,dependencies:e.dependencies,onChanged:t,className:"border border-t-0 border-border rounded-b-xl bg-surface px-4 pb-3 pt-2"}),!r&&!l&&e.settings&&c.jsx("div",{className:"border border-t-0 border-border rounded-b-xl bg-surface px-4 pb-3 pt-2",children:c.jsx(Ae,{to:vn({name:e.id,settings:e.settings}),className:ga,"aria-label":n("serverMarketplace.configureOf",{title:a}),children:n("serverMarketplace.configure")})})]})}function vm({title:e,missing:t,settingsPath:n,className:r=""}){const{t:l}=H();return c.jsxs("div",{"data-testid":"needs-configuration",className:`space-y-2 ${r}`,children:[c.jsx(te,{variant:"warning",dot:!0,children:l("serverMarketplace.statusNeedsConfiguration")}),c.jsx("p",{className:"text-xs text-warning",children:l("serverMarketplace.needsConfigurationHint")}),t&&t.length>0&&c.jsx("p",{className:"text-[11px] text-muted font-mono break-all",children:l("serverMarketplace.missingSettings",{keys:t.join(", ")})}),c.jsx(Ae,{to:n,className:Rt,"aria-label":l("serverMarketplace.configureOf",{title:e}),children:l("serverMarketplace.configure")})]})}function Sm({plugin:e,hasSettings:t,canInstall:n,busy:r,working:l,onAction:a}){const{t:i}=H(),s=e.title||e.name;return c.jsxs("article",{"aria-label":s,className:"bg-surface border border-border rounded-xl p-4 flex flex-col gap-3",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(Pe,{icon:e.icon,names:[e.id,e.name]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:qe,children:[e.id?c.jsx(Ae,{to:Ya(e.id),className:"font-semibold text-heading text-sm truncate min-w-0 hover:underline",children:s}):c.jsx("span",{className:"font-semibold text-heading text-sm truncate min-w-0",children:s}),e.version&&c.jsxs("span",{className:Ie,children:["v",e.version]})]}),c.jsx("div",{className:"text-[11px] text-subtle font-mono mt-0.5 truncate",title:e.name,children:e.name}),e.installedBy&&c.jsx("div",{className:"text-[11px] text-subtle mt-0.5",children:i("marketplace.installedBy",{user:e.installedBy})})]})]}),c.jsxs("div",{className:Ve,children:[c.jsx(te,{variant:"info",children:i("marketplace.badge")}),e.updateAvailable&&c.jsx(te,{variant:"warning",children:i("marketplace.updateAvailable")})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t&&e.id?c.jsx(Ae,{to:Ka(e.id),className:ga,"aria-label":i("serverMarketplace.configureOf",{title:s}),children:i("serverMarketplace.configure")}):c.jsx("span",{"data-testid":"no-settings",className:"text-xs text-subtle",children:i("marketplace.noSettings")}),n&&e.updateAvailable&&c.jsx(ke,{label:i("marketplace.update"),className:Rt,busy:r==="update",disabled:l,onClick:()=>a("update")}),n&&c.jsx(ke,{label:i("marketplace.remove"),className:ma,busy:r==="remove",disabled:l,onClick:()=>a("remove")})]})]})}const wr="px-3 py-1.5 text-xs rounded-lg transition-colors inline-flex items-center gap-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",Rt=`${wr} bg-primary text-on-primary hover:bg-primary/90`,ma=`${wr} bg-control text-error hover:bg-error/10`,ga=`${wr} bg-control hover:bg-control-hover text-text`;async function jm(){try{const e=(await Wa()).find(t=>Ga(t.id));return new Set((e==null?void 0:e.sections.map(t=>t.id))??[])}catch{return null}}function Cm({installed:e}){var u;const{t}=H(),n=qn(Ue().hasPermission),{run:r,busy:l,status:a}=br(e.refresh),i=!!((u=e.data)!=null&&u.length),s=D.useCallback(()=>i?jm():Promise.resolve(new Set),[i,e.data]),o=se(s,[s]);return!i&&!l?c.jsx(c.Fragment,{children:a}):c.jsxs("section",{className:"space-y-3",children:[c.jsx(Ot,{title:t("marketplace.installedTitle"),hint:t("marketplace.installedHint")}),a,c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:(e.data??[]).map(d=>c.jsx(Sm,{plugin:d,hasSettings:Os(d,o.data),canInstall:n,busy:(l==null?void 0:l.name)===d.name?l.action:null,working:l!==null,onAction:f=>void r(f,{name:d.name,title:d.title})},d.name))})]})}const Nm={loaded:{key:"serverMarketplace.statusLoaded",variant:"success"},pending:{key:"serverMarketplace.statusPending",variant:"warning"},failed:{key:"serverMarketplace.statusFailed",variant:"error"},skipped:{key:"serverMarketplace.statusSkipped",variant:"neutral"},removed:{key:"serverMarketplace.statusRemoved",variant:"neutral"},"needs-configuration":{key:"serverMarketplace.statusNeedsConfiguration",variant:"warning"},"needs-dependencies":{key:"dependencies.statusNeedsDependencies",variant:"warning"}};function Em({plugin:e,canInstall:t,busy:n,working:r,onAction:l,onChanged:a}){const{t:i}=H(),s=e.title||e.name,o=Nm[e.status],u=e.status==="removed";return c.jsxs("article",{"aria-label":s,className:"bg-surface border border-border rounded-xl p-4 flex flex-col gap-3",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(Pe,{icon:e.icon,names:[e.package,e.name]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:qe,children:[e.status==="loaded"||e.status==="needs-dependencies"?c.jsx(Ae,{to:xt(e.package),className:"font-semibold text-heading text-sm truncate min-w-0 hover:underline",children:s}):c.jsx("span",{className:"font-semibold text-heading text-sm truncate min-w-0",children:s}),e.version&&c.jsxs("span",{className:Ie,children:["v",e.version]})]}),c.jsx("div",{className:"text-[11px] text-subtle font-mono mt-0.5 truncate",title:e.package,children:e.package}),e.loadedVersion&&e.loadedVersion!==e.version&&c.jsx("div",{className:"text-[11px] text-subtle mt-0.5",children:i("serverMarketplace.runningVersion",{version:e.loadedVersion})}),e.installedBy&&c.jsx("div",{className:"text-[11px] text-subtle mt-0.5",children:i("marketplace.installedBy",{user:e.installedBy})}),c.jsx(vs,{plugin:e})]})]}),c.jsxs("div",{className:Ve,children:[c.jsx(te,{variant:"info",children:i("marketplace.badge")}),c.jsx("span",{"data-testid":"load-status",children:c.jsx(te,{variant:o.variant,dot:!0,children:i(o.key)})}),e.updateAvailable&&!u&&c.jsx(te,{variant:"warning",children:i("marketplace.updateAvailable")})]}),e.error&&(e.status==="failed"||e.status==="skipped")&&c.jsxs("div",{role:"alert",className:"rounded-lg border border-error/30 bg-error/[0.06] px-3 py-2 text-xs",children:[c.jsx("div",{className:"font-medium text-error",children:i("serverMarketplace.loadError")}),c.jsx("pre",{className:"mt-0.5 whitespace-pre-wrap break-words font-mono text-[11px] text-text",children:e.error})]}),e.status==="needs-configuration"&&c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-xs text-warning",children:i("serverMarketplace.needsConfigurationHint")}),e.missing&&e.missing.length>0&&c.jsx("p",{className:"text-[11px] text-muted font-mono break-all",children:i("serverMarketplace.missingSettings",{keys:e.missing.join(", ")})})]}),e.status==="needs-dependencies"&&c.jsx(Hi,{title:s,dependencies:e.dependencies,onChanged:a,badge:!1}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.status==="needs-configuration"&&c.jsx(Ae,{to:vn(e),className:Rt,"aria-label":i("serverMarketplace.configureOf",{title:s}),children:i("serverMarketplace.configure")}),t&&e.updateAvailable&&!u&&c.jsx(ke,{label:i("marketplace.update"),className:Rt,busy:n==="update",disabled:r,onClick:()=>l("update")}),t&&!u&&c.jsx(ke,{label:i("marketplace.remove"),className:ma,busy:n==="remove",disabled:r,onClick:()=>l("remove")})]})]})}function Am({installed:e}){var i;const{t}=H(),n=Ue().hasPermission(Bt),{run:r,busy:l,status:a}=Kn(e.refresh);return e.error?c.jsx(me,{title:t("serverMarketplace.loadFailed"),error:e.error,onRetry:e.refetch,compact:!0}):!((i=e.data)!=null&&i.length)&&!l?c.jsx(c.Fragment,{children:a}):c.jsxs("section",{className:"space-y-3",children:[c.jsx(Ot,{title:t("serverMarketplace.installedTitle"),hint:t("serverMarketplace.installedHint")}),a,c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:(e.data??[]).map(s=>c.jsx(Em,{plugin:s,canInstall:n,busy:(l==null?void 0:l.name)===s.name?l.action:null,working:l!==null,onAction:o=>void r(o,{name:s.name,title:s.title,package:s.package,version:s.version}),onChanged:e.refresh},s.name))})]})}function Ot({title:e,hint:t}){return c.jsxs("div",{className:"mb-3",children:[c.jsx("h3",{className:"text-sm font-semibold text-heading",children:e}),c.jsx("p",{className:"text-xs text-subtle",children:t})]})}function Im({modules:e,installed:t,round:n}){var w;const{data:r,loading:l,error:a,refetch:i,refresh:s}=e,o=se(Va,[n]);Qn(o.refresh);const u=se(ks,[n]);$t(u.refresh),wn(u.refresh),wn(t.refresh);const d=new Set((u.data??[]).map(m=>m.package)),f=((w=t.data)==null?void 0:w.filter(m=>m.source!=="marketplace"&&!d.has(m.id)))??null,{t:h}=H(),[p,g]=D.useState(null);async function b(m){var y;g(null);try{await ws(m)}catch(v){const N=((y=r==null?void 0:r.find(E=>E.id===m))==null?void 0:y.name)||m;g(h("plugins.toggleFailed",{name:N,message:kn(v)}))}s()}return c.jsxs("div",{className:"space-y-8",children:[c.jsx(Cm,{installed:o}),c.jsx(Am,{installed:u}),t.loading&&!t.data&&c.jsx(et,{count:3}),f&&f.length>0&&c.jsxs("section",{children:[c.jsx(Ot,{title:h("plugins.serverPlugins"),hint:h("plugins.serverPluginsHint")}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:f.map(m=>c.jsx(wm,{plugin:m,onChanged:t.refresh},m.id))})]}),c.jsxs("section",{children:[t.data&&t.data.length>0&&c.jsx(Ot,{title:h("plugins.commandModules"),hint:h("plugins.commandModulesHint")}),l&&!r&&c.jsx(et,{count:6,label:h("plugins.loadingPlugins")}),a&&c.jsx(me,{error:a,onRetry:i}),p&&c.jsx(me,{error:p,title:h("plugins.manager"),compact:!0,className:"mb-4"}),!a&&r&&c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:[r.map(m=>c.jsx(ym,{plugin:m,onToggle:b},m.id)),r.length===0&&c.jsx(ye,{className:"col-span-full bg-surface border border-border rounded-xl",message:t.data&&t.data.length>0?h("plugins.noModules"):h("plugins.noPlugins")})]})]})]})}const ct=[{id:"installed",label:"marketplace.tabInstalled"},{id:"marketplace",label:"marketplace.tabMarketplace"},{id:"updates",label:"updates.tab"},{id:"dependencies",label:"dependencies.tab"}];function Om(){var y,v,N;const{t:e}=H(),[t,n]=D.useState(0),r=se(xs,[t]),l=se(bs,[t]),[a,i]=He(),s=gs(a),u=(y=$a().state)==null?void 0:y.removedPage,[d,f]=D.useState(null),h=se(sm,[t]),p=((v=h.data)==null?void 0:v.count)??0,g=(N=Ua())==null?void 0:N.subscribe,b=h.refresh;D.useEffect(()=>g==null?void 0:g(Ha,E=>{typeof E.key=="string"&&E.key.startsWith("update:")&&b()}),[g,b]);const w=D.useCallback(E=>i(S=>{const A=new URLSearchParams(S);return E==="installed"?(A.delete("tab"),A.delete("kind")):(A.set("tab",E),E!=="marketplace"&&A.delete("kind")),A},{replace:!0}),[i]);function m(E){var L;if(E.key!=="ArrowLeft"&&E.key!=="ArrowRight")return;E.preventDefault();const S=E.key==="ArrowRight"?1:ct.length-1,A=ct[(ct.findIndex(O=>O.id===s)+S)%ct.length].id;w(A),(L=document.getElementById(`plugins-tab-${A}`))==null||L.focus()}return c.jsxs("div",{children:[c.jsx(qa,{title:e("nav.plugins"),subtitle:l.data?e("plugins.subtitle",{count:l.data.length}):r.data?e("plugins.subtitle",{count:r.data.length}):e("plugins.manager"),actions:c.jsx("button",{onClick:()=>n(E=>E+1),className:"px-3 py-1.5 text-xs bg-control hover:bg-control-hover text-text rounded-lg transition-colors",children:e("common.refresh")})}),c.jsxs("div",{className:"p-4 sm:p-6 space-y-6",children:[u&&d!==u&&c.jsx(Vn,{message:e("marketplace.pageRemoved",{title:u}),onDismiss:()=>f(u)}),c.jsx("div",{role:"tablist","aria-label":e("marketplace.tabs"),className:"flex gap-1 border-b border-border overflow-x-auto overscroll-x-contain",onKeyDown:m,children:ct.map(E=>c.jsxs("button",{id:`plugins-tab-${E.id}`,type:"button",role:"tab","aria-selected":s===E.id,"aria-controls":`plugins-panel-${E.id}`,tabIndex:s===E.id?0:-1,onClick:()=>w(E.id),className:`-mb-px shrink-0 whitespace-nowrap inline-flex items-center px-3 py-2 text-sm border-b-2 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 ${s===E.id?"border-primary text-heading font-medium":"border-transparent text-muted hover:text-text"}`,children:[e(E.label),E.id==="updates"&&p>0&&c.jsx("span",{"data-testid":"updates-tab-badge","aria-label":e("updates.tabCount",{count:p}),className:"ml-1.5 inline-flex min-w-[1.25rem] h-5 px-1.5 items-center justify-center rounded-full bg-warning/15 text-warning text-[11px] font-semibold",children:p})]},E.id))}),c.jsxs("div",{role:"tabpanel",id:`plugins-panel-${s}`,"aria-labelledby":`plugins-tab-${s}`,children:[s==="installed"&&c.jsx(Im,{modules:r,installed:l,round:t}),s==="marketplace"&&c.jsx(rm,{},t),s==="updates"&&c.jsx(fm,{updates:h}),s==="dependencies"&&c.jsx(km,{round:t,packages:l.data})]})]})]})}export{Om as default};