import{f as Lt,g as Yr,j as d,r as B,u as et,c as sn,b as fl}from"./query-Bw69rE6b.js";import{L as an,b as pl}from"./react-CQKYBN-P.js";import{P as hl}from"./PageHeader-qtVByY5c.js";import{d as vn,g as dl,M as En,c as J,C as un,b as Ce,k as Jr,u as qe,r as ml,j as Xr,S as Gr,O as gl,Q as xl,I as yl,J as Tt,a as Zr,U as kl,e as Ct,V as Yn,Y as bl}from"./index-CoUu6FiM.js";import{C as Pt,a as wl,b as cn}from"./Card-nuKO-lKR.js";import{A as Sl}from"./AlertDialog-IkMNJ6QG.js";/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],fn=vn("circle-stop",Cl);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vl=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],El=vn("send",vl);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Al=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],jl=vn("wrench",Al);function Nl(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Il=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ll=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Tl={};function Jn(e,t){return(Tl.jsx?Ll:Il).test(e)}const Pl=/[ \t\n\f\r]/g;function _l(e){return typeof e=="object"?e.type==="text"?Xn(e.value):!1:Xn(e)}function Xn(e){return e.replace(Pl,"")===""}class ht{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ht.prototype.normal={};ht.prototype.property={};ht.prototype.space=void 0;function ei(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new ht(n,r,t)}function pn(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 Dl=0;const M=We(),te=We(),hn=We(),I=We(),G=We(),Ze=We(),xe=We();function We(){return 2**++Dl}const dn=Object.freeze(Object.defineProperty({__proto__:null,boolean:M,booleanish:te,commaOrSpaceSeparated:xe,commaSeparated:Ze,number:I,overloadedBoolean:hn,spaceSeparated:G},Symbol.toStringTag,{value:"Module"})),Ut=Object.keys(dn);class An extends de{constructor(t,n,r,i){let o=-1;if(super(t,n),Gn(this,"space",i),typeof r=="number")for(;++o<Ut.length;){const l=Ut[o];Gn(this,Ut[o],(r&dn[l])===dn[l])}}}An.prototype.defined=!0;function Gn(e,t,n){n&&(e[t]=n)}function nt(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new An(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[pn(r)]=r,n[pn(o.attribute)]=r}return new ht(t,n,e.space)}const ti=nt({properties:{ariaActiveDescendant:null,ariaAtomic:te,ariaAutoComplete:null,ariaBusy:te,ariaChecked:te,ariaColCount:I,ariaColIndex:I,ariaColSpan:I,ariaControls:G,ariaCurrent:null,ariaDescribedBy:G,ariaDetails:null,ariaDisabled:te,ariaDropEffect:G,ariaErrorMessage:null,ariaExpanded:te,ariaFlowTo:G,ariaGrabbed:te,ariaHasPopup:null,ariaHidden:te,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:G,ariaLevel:I,ariaLive:null,ariaModal:te,ariaMultiLine:te,ariaMultiSelectable:te,ariaOrientation:null,ariaOwns:G,ariaPlaceholder:null,ariaPosInSet:I,ariaPressed:te,ariaReadOnly:te,ariaRelevant:null,ariaRequired:te,ariaRoleDescription:G,ariaRowCount:I,ariaRowIndex:I,ariaRowSpan:I,ariaSelected:te,ariaSetSize:I,ariaSort:null,ariaValueMax:I,ariaValueMin:I,ariaValueNow:I,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ni(e,t){return t in e?e[t]:t}function ri(e,t){return ni(e,t.toLowerCase())}const zl=nt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ze,acceptCharset:G,accessKey:G,action:null,allow:null,allowFullScreen:M,allowPaymentRequest:M,allowUserMedia:M,alt:null,as:null,async:M,autoCapitalize:null,autoComplete:G,autoFocus:M,autoPlay:M,blocking:G,capture:null,charSet:null,checked:M,cite:null,className:G,cols:I,colSpan:null,content:null,contentEditable:te,controls:M,controlsList:G,coords:I|Ze,crossOrigin:null,data:null,dateTime:null,decoding:null,default:M,defer:M,dir:null,dirName:null,disabled:M,download:hn,draggable:te,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:M,formTarget:null,headers:G,height:I,hidden:hn,high:I,href:null,hrefLang:null,htmlFor:G,httpEquiv:G,id:null,imageSizes:null,imageSrcSet:null,inert:M,inputMode:null,integrity:null,is:null,isMap:M,itemId:null,itemProp:G,itemRef:G,itemScope:M,itemType:G,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:M,low:I,manifest:null,max:null,maxLength:I,media:null,method:null,min:null,minLength:I,multiple:M,muted:M,name:null,nonce:null,noModule:M,noValidate:M,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:M,optimum:I,pattern:null,ping:G,placeholder:null,playsInline:M,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:M,referrerPolicy:null,rel:G,required:M,reversed:M,rows:I,rowSpan:I,sandbox:G,scope:null,scoped:M,seamless:M,selected:M,shadowRootClonable:M,shadowRootDelegatesFocus:M,shadowRootMode:null,shape:null,size:I,sizes:null,slot:null,span:I,spellCheck:te,src:null,srcDoc:null,srcLang:null,srcSet:null,start:I,step:null,style:null,tabIndex:I,target:null,title:null,translate:null,type:null,typeMustMatch:M,useMap:null,value:te,width:I,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:G,axis:null,background:null,bgColor:null,border:I,borderColor:null,bottomMargin:I,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:M,declare:M,event:null,face:null,frame:null,frameBorder:null,hSpace:I,leftMargin:I,link:null,longDesc:null,lowSrc:null,marginHeight:I,marginWidth:I,noResize:M,noHref:M,noShade:M,noWrap:M,object:null,profile:null,prompt:null,rev:null,rightMargin:I,rules:null,scheme:null,scrolling:te,standby:null,summary:null,text:null,topMargin:I,valueType:null,version:null,vAlign:null,vLink:null,vSpace:I,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:M,disableRemotePlayback:M,prefix:null,property:null,results:I,security:null,unselectable:null},space:"html",transform:ri}),Fl=nt({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:xe,accentHeight:I,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:I,amplitude:I,arabicForm:null,ascent:I,attributeName:null,attributeType:null,azimuth:I,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:I,by:null,calcMode:null,capHeight:I,className:G,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:I,diffuseConstant:I,direction:null,display:null,dur:null,divisor:I,dominantBaseline:null,download:M,dx:null,dy:null,edgeMode:null,editable:null,elevation:I,enableBackground:null,end:null,event:null,exponent:I,externalResourcesRequired:null,fill:null,fillOpacity:I,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ze,g2:Ze,glyphName:Ze,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:I,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:I,horizOriginX:I,horizOriginY:I,id:null,ideographic:I,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:I,k:I,k1:I,k2:I,k3:I,k4:I,kernelMatrix:xe,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:I,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:I,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:I,overlineThickness:I,paintOrder:null,panose1:null,path:null,pathLength:I,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:G,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:I,pointsAtY:I,pointsAtZ:I,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:xe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:xe,rev:xe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:xe,requiredFeatures:xe,requiredFonts:xe,requiredFormats:xe,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:I,specularExponent:I,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:I,strikethroughThickness:I,string:null,stroke:null,strokeDashArray:xe,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:I,strokeOpacity:I,strokeWidth:null,style:null,surfaceScale:I,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:xe,tabIndex:I,tableValues:null,target:null,targetX:I,targetY:I,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:xe,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:I,underlineThickness:I,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:I,values:null,vAlphabetic:I,vMathematical:I,vectorEffect:null,vHanging:I,vIdeographic:I,version:null,vertAdvY:I,vertOriginX:I,vertOriginY:I,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:I,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ni}),ii=nt({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()}}),li=nt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ri}),oi=nt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Rl={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"},Ol=/[A-Z]/g,Zn=/-[a-z]/g,Ml=/^data[-\w.:]+$/i;function Bl(e,t){const n=pn(t);let r=t,i=de;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Ml.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Zn,ql);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Zn.test(o)){let l=o.replace(Ol,$l);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=An}return new i(r,t)}function $l(e){return"-"+e.toLowerCase()}function ql(e){return e.charAt(1).toUpperCase()}const Hl=ei([ti,zl,ii,li,oi],"html"),jn=ei([ti,Fl,ii,li,oi],"svg");function Ul(e){return e.join(" ").trim()}var Nn={},er=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Vl=/\n/g,Wl=/^\s*/,Ql=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Kl=/^:\s*/,Yl=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Jl=/^[;\s]*/,Xl=/^\s+|\s+$/g,Gl=`
`,tr="/",nr="*",Ue="",Zl="comment",eo="declaration";function to(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 i(m){var k=m.match(Vl);k&&(n+=k.length);var C=m.lastIndexOf(Gl);r=~C?m.length-C:r+m.length}function o(){var m={line:n,column:r};return function(k){return k.position=new l(m),u(),k}}function l(m){this.start=m,this.end={line:n,column:r},this.source=t.source}l.prototype.content=e;function s(m){var k=new Error(t.source+":"+n+":"+r+": "+m);if(k.reason=m,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function a(m){var k=m.exec(e);if(k){var C=k[0];return i(C),e=e.slice(C.length),k}}function u(){a(Wl)}function f(m){var k;for(m=m||[];k=c();)k!==!1&&m.push(k);return m}function c(){var m=o();if(!(tr!=e.charAt(0)||nr!=e.charAt(1))){for(var k=2;Ue!=e.charAt(k)&&(nr!=e.charAt(k)||tr!=e.charAt(k+1));)++k;if(k+=2,Ue===e.charAt(k-1))return s("End of comment missing");var C=e.slice(2,k-2);return r+=2,i(C),e=e.slice(k),r+=2,m({type:Zl,comment:C})}}function h(){var m=o(),k=a(Ql);if(k){if(c(),!a(Kl))return s("property missing ':'");var C=a(Yl),y=m({type:eo,property:rr(k[0].replace(er,Ue)),value:C?rr(C[0].replace(er,Ue)):Ue});return a(Jl),y}}function p(){var m=[];f(m);for(var k;k=h();)k!==!1&&(m.push(k),f(m));return m}return u(),p()}function rr(e){return e?e.replace(Xl,Ue):Ue}var no=to,ro=Lt&&Lt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.default=lo;const io=ro(no);function lo(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,io.default)(e),i=typeof t=="function";return r.forEach(o=>{if(o.type!=="declaration")return;const{property:l,value:s}=o;i?t(l,s,o):s&&(n=n||{},n[l]=s)}),n}var Rt={};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.camelCase=void 0;var oo=/^--[a-zA-Z0-9_-]+$/,so=/-([a-z])/g,ao=/^[^-]+$/,uo=/^-(webkit|moz|ms|o|khtml)-/,co=/^-(ms)-/,fo=function(e){return!e||ao.test(e)||oo.test(e)},po=function(e,t){return t.toUpperCase()},ir=function(e,t){return"".concat(t,"-")},ho=function(e,t){return t===void 0&&(t={}),fo(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(co,ir):e=e.replace(uo,ir),e.replace(so,po))};Rt.camelCase=ho;var mo=Lt&&Lt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},go=mo(Nn),xo=Rt;function mn(e,t){var n={};return!e||typeof e!="string"||(0,go.default)(e,function(r,i){r&&i&&(n[(0,xo.camelCase)(r,t)]=i)}),n}mn.default=mn;var yo=mn;const ko=Yr(yo),si=ai("end"),In=ai("start");function ai(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 bo(e){const t=In(e),n=si(e);if(t&&n)return{start:t,end:n}}function at(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?lr(e.position):"start"in e||"end"in e?lr(e):"line"in e||"column"in e?gn(e):""}function gn(e){return or(e&&e.line)+":"+or(e&&e.column)}function lr(e){return gn(e&&e.start)+"-"+gn(e&&e.end)}function or(e){return e&&typeof e=="number"?e:1}class ae extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},l=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(l=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const a=r.indexOf(":");a===-1?o.ruleId=r:(o.source=r.slice(0,a),o.ruleId=r.slice(a+1))}if(!o.place&&o.ancestors&&o.ancestors){const a=o.ancestors[o.ancestors.length-1];a&&(o.place=a.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=at(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ae.prototype.file="";ae.prototype.name="";ae.prototype.reason="";ae.prototype.message="";ae.prototype.stack="";ae.prototype.column=void 0;ae.prototype.line=void 0;ae.prototype.ancestors=void 0;ae.prototype.cause=void 0;ae.prototype.fatal=void 0;ae.prototype.place=void 0;ae.prototype.ruleId=void 0;ae.prototype.source=void 0;const Ln={}.hasOwnProperty,wo=new Map,So=/[A-Z]/g,Co=new Set(["table","tbody","thead","tfoot","tr"]),vo=new Set(["td","th"]),ui="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Eo(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=_o(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=Po(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?jn:Hl,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=ci(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function ci(e,t,n){if(t.type==="element")return Ao(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return jo(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Io(e,t,n);if(t.type==="mdxjsEsm")return No(e,t);if(t.type==="root")return Lo(e,t,n);if(t.type==="text")return To(e,t)}function Ao(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=jn,e.schema=i),e.ancestors.push(t);const o=pi(e,t.tagName,!1),l=Do(e,t);let s=Pn(e,t);return Co.has(t.tagName)&&(s=s.filter(function(a){return typeof a=="string"?!_l(a):!0})),fi(e,l,o,t),Tn(l,s),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function jo(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)}ft(e,t.position)}function No(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ft(e,t.position)}function Io(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=jn,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:pi(e,t.name,!0),l=zo(e,t),s=Pn(e,t);return fi(e,l,o,t),Tn(l,s),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function Lo(e,t,n){const r={};return Tn(r,Pn(e,t)),e.create(t,e.Fragment,r,n)}function To(e,t){return t.value}function fi(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Tn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Po(e,t,n){return r;function r(i,o,l,s){const u=Array.isArray(l.children)?n:t;return s?u(o,l,s):u(o,l)}}function _o(e,t){return n;function n(r,i,o,l){const s=Array.isArray(o.children),a=In(r);return t(i,o,l,s,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function Do(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Ln.call(t.properties,i)){const o=Fo(e,i,t.properties[i]);if(o){const[l,s]=o;e.tableCellAlignToStyle&&l==="align"&&typeof s=="string"&&vo.has(t.tagName)?r=s:n[l]=s}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function zo(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const l=o.expression;l.type;const s=l.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else ft(e,t.position);else{const i=r.name;let o;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,o=e.evaluater.evaluateExpression(s.expression)}else ft(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function Pn(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:wo;for(;++r<t.children.length;){const o=t.children[r];let l;if(e.passKeys){const a=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(a){const u=i.get(a)||0;l=a+"-"+u,i.set(a,u+1)}}const s=ci(e,o,l);s!==void 0&&n.push(s)}return n}function Fo(e,t,n){const r=Bl(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Nl(n):Ul(n)),r.property==="style"){let i=typeof n=="object"?n:Ro(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Oo(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Rl[r.property]||r.property:r.attribute,n]}}function Ro(e,t){try{return ko(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new ae("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=ui+"#cannot-parse-style-attribute",i}}function pi(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,l;for(;++o<i.length;){const s=Jn(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};l=l?{type:"MemberExpression",object:l,property:s,computed:!!(o&&s.type==="Literal"),optional:!1}:s}r=l}else r=Jn(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Ln.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ft(e)}function ft(e,t){const n=new ae("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=ui+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Oo(e){const t={};let n;for(n in e)Ln.call(e,n)&&(t[Mo(n)]=e[n]);return t}function Mo(e){let t=e.replace(So,Bo);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Bo(e){return"-"+e.toLowerCase()}const Vt={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"]},$o={};function _n(e,t){const n=$o,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return hi(e,r,i)}function hi(e,t,n){if(qo(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 sr(e.children,t,n)}return Array.isArray(e)?sr(e,t,n):""}function sr(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=hi(e[i],t,n);return r.join("")}function qo(e){return!!(e&&typeof e=="object")}const ar=document.createElement("i");function Dn(e){const t="&"+e+";";ar.innerHTML=t;const n=ar.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ye(e,t,n,r){const i=e.length;let o=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);o<r.length;)l=r.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function be(e,t){return e.length>0?(ye(e,e.length,0,t),e):t}const ur={}.hasOwnProperty;function di(e){const t={};let n=-1;for(;++n<e.length;)Ho(t,e[n]);return t}function Ho(e,t){let n;for(n in t){const i=(ur.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){ur.call(i,l)||(i[l]=[]);const s=o[l];Uo(i[l],Array.isArray(s)?s:s?[s]:[])}}}function Uo(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ye(e,0,0,r)}function mi(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 ve(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ce=_e(/[A-Za-z]/),se=_e(/[\dA-Za-z]/),Vo=_e(/[#-'*+\--9=?A-Z^-~]/);function _t(e){return e!==null&&(e<32||e===127)}const xn=_e(/\d/),Wo=_e(/[\dA-Fa-f]/),Qo=_e(/[!-/:-@[-`{-~]/);function _(e){return e!==null&&e<-2}function X(e){return e!==null&&(e<0||e===32)}function U(e){return e===-2||e===-1||e===32}const Ot=_e(/\p{P}|\p{S}/u),Ve=_e(/\s/);function _e(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function rt(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&se(e.charCodeAt(n+1))&&se(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const s=e.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(l=String.fromCharCode(o,s),i=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function W(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(a){return U(a)?(e.enter(n),s(a)):t(a)}function s(a){return U(a)&&o++<i?(e.consume(a),s):(e.exit(n),t(a))}}const Ko={tokenize:Yo};function Yo(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),W(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),o(s)}function o(s){const a=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=a),n=a,l(s)}function l(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return _(s)?(e.consume(s),e.exit("chunkText"),o):(e.consume(s),l)}}const Jo={tokenize:Xo},cr={tokenize:Go};function Xo(e){const t=this,n=[];let r=0,i,o,l;return s;function s(E){if(r<n.length){const P=n[r];return t.containerState=P[1],e.attempt(P[0].continuation,a,u)(E)}return u(E)}function a(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const P=t.events.length;let O=P,S;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){S=t.events[O][1].end;break}y(r);let R=P;for(;R<t.events.length;)t.events[R][1].end={...S},R++;return ye(t.events,O+1,0,t.events.slice(P)),t.events.length=R,u(E)}return s(E)}function u(E){if(r===n.length){if(!i)return h(E);if(i.currentConstruct&&i.currentConstruct.concrete)return m(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(cr,f,c)(E)}function f(E){return i&&v(),y(r),h(E)}function c(E){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,m(E)}function h(E){return t.containerState={},e.attempt(cr,p,m)(E)}function p(E){return r++,n.push([t.currentConstruct,t.containerState]),h(E)}function m(E){if(E===null){i&&v(),y(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),k(E)}function k(E){if(E===null){C(e.exit("chunkFlow"),!0),y(0),e.consume(E);return}return _(E)?(e.consume(E),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(E),k)}function C(E,P){const O=t.sliceStream(E);if(P&&O.push(null),E.previous=o,o&&(o.next=E),o=E,i.defineSkip(E.start),i.write(O),t.parser.lazy[E.start.line]){let S=i.events.length;for(;S--;)if(i.events[S][1].start.offset<l&&(!i.events[S][1].end||i.events[S][1].end.offset>l))return;const R=t.events.length;let Q=R,q,b;for(;Q--;)if(t.events[Q][0]==="exit"&&t.events[Q][1].type==="chunkFlow"){if(q){b=t.events[Q][1].end;break}q=!0}for(y(r),S=R;S<t.events.length;)t.events[S][1].end={...b},S++;ye(t.events,Q+1,0,t.events.slice(R)),t.events.length=S}}function y(E){let P=n.length;for(;P-- >E;){const O=n[P];t.containerState=O[1],O[0].exit.call(t,e)}n.length=E}function v(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Go(e,t,n){return W(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function tt(e){if(e===null||X(e)||Ve(e))return 1;if(Ot(e))return 2}function Mt(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const yn={name:"attention",resolveAll:Zo,tokenize:es};function Zo(e,t){let n=-1,r,i,o,l,s,a,u,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;a=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},h={...e[n][1].start};fr(c,-a),fr(h,a),l={type:a>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},s={type:a>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},o={type:a>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:a>1?"strong":"emphasis",start:{...l.start},end:{...s.end}},e[r][1].end={...l.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=be(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=be(u,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",o,t]]),u=be(u,Mt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=be(u,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,u=be(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,ye(e,r-1,n-r+3,u),n=r+u.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function es(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=tt(r);let o;return l;function l(a){return o=a,e.enter("attentionSequence"),s(a)}function s(a){if(a===o)return e.consume(a),s;const u=e.exit("attentionSequence"),f=tt(a),c=!f||f===2&&i||n.includes(a),h=!i||i===2&&f||n.includes(r);return u._open=!!(o===42?c:c&&(i||!h)),u._close=!!(o===42?h:h&&(f||!c)),t(a)}}function fr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const ts={name:"autolink",tokenize:ns};function ns(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return ce(p)?(e.consume(p),l):p===64?n(p):u(p)}function l(p){return p===43||p===45||p===46||se(p)?(r=1,s(p)):u(p)}function s(p){return p===58?(e.consume(p),r=0,a):(p===43||p===45||p===46||se(p))&&r++<32?(e.consume(p),s):(r=0,u(p))}function a(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||_t(p)?n(p):(e.consume(p),a)}function u(p){return p===64?(e.consume(p),f):Vo(p)?(e.consume(p),u):n(p)}function f(p){return se(p)?c(p):n(p)}function c(p){return p===46?(e.consume(p),r=0,f):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||se(p))&&r++<63){const m=p===45?h:c;return e.consume(p),m}return n(p)}}const dt={partial:!0,tokenize:rs};function rs(e,t,n){return r;function r(o){return U(o)?W(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||_(o)?t(o):n(o)}}const gi={continuation:{tokenize:ls},exit:os,name:"blockQuote",tokenize:is};function is(e,t,n){const r=this;return i;function i(l){if(l===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return n(l)}function o(l){return U(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function ls(e,t,n){const r=this;return i;function i(l){return U(l)?W(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(gi,t,n)(l)}}function os(e){e.exit("blockQuote")}const xi={name:"characterEscape",tokenize:ss};function ss(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return Qo(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const yi={name:"characterReference",tokenize:as};function as(e,t,n){const r=this;let i=0,o,l;return s;function s(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),a}function a(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),o=31,l=se,f(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=Wo,f):(e.enter("characterReferenceValue"),o=7,l=xn,f(c))}function f(c){if(c===59&&i){const h=e.exit("characterReferenceValue");return l===se&&!Dn(r.sliceSerialize(h))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(c)&&i++<o?(e.consume(c),f):n(c)}}const pr={partial:!0,tokenize:cs},hr={concrete:!0,name:"codeFenced",tokenize:us};function us(e,t,n){const r=this,i={partial:!0,tokenize:O};let o=0,l=0,s;return a;function a(S){return u(S)}function u(S){const R=r.events[r.events.length-1];return o=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,s=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(S)}function f(S){return S===s?(l++,e.consume(S),f):l<3?n(S):(e.exit("codeFencedFenceSequence"),U(S)?W(e,c,"whitespace")(S):c(S))}function c(S){return S===null||_(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(pr,k,P)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(S))}function h(S){return S===null||_(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(S)):U(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),W(e,p,"whitespace")(S)):S===96&&S===s?n(S):(e.consume(S),h)}function p(S){return S===null||_(S)?c(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||_(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(S)):S===96&&S===s?n(S):(e.consume(S),m)}function k(S){return e.attempt(i,P,C)(S)}function C(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),y}function y(S){return o>0&&U(S)?W(e,v,"linePrefix",o+1)(S):v(S)}function v(S){return S===null||_(S)?e.check(pr,k,P)(S):(e.enter("codeFlowValue"),E(S))}function E(S){return S===null||_(S)?(e.exit("codeFlowValue"),v(S)):(e.consume(S),E)}function P(S){return e.exit("codeFenced"),t(S)}function O(S,R,Q){let q=0;return b;function b($){return S.enter("lineEnding"),S.consume($),S.exit("lineEnding"),j}function j($){return S.enter("codeFencedFence"),U($)?W(S,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):N($)}function N($){return $===s?(S.enter("codeFencedFenceSequence"),D($)):Q($)}function D($){return $===s?(q++,S.consume($),D):q>=l?(S.exit("codeFencedFenceSequence"),U($)?W(S,V,"whitespace")($):V($)):Q($)}function V($){return $===null||_($)?(S.exit("codeFencedFence"),R($)):Q($)}}}function cs(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Wt={name:"codeIndented",tokenize:ps},fs={partial:!0,tokenize:hs};function ps(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),W(e,o,"linePrefix",5)(u)}function o(u){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?l(u):n(u)}function l(u){return u===null?a(u):_(u)?e.attempt(fs,l,a)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||_(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),s)}function a(u){return e.exit("codeIndented"),t(u)}}function hs(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):_(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):W(e,o,"linePrefix",5)(l)}function o(l){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(l):_(l)?i(l):n(l)}}const ds={name:"codeText",previous:gs,resolve:ms,tokenize:xs};function ms(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function gs(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function xs(e,t,n){let r=0,i,o;return l;function l(c){return e.enter("codeText"),e.enter("codeTextSequence"),s(c)}function s(c){return c===96?(e.consume(c),r++,s):(e.exit("codeTextSequence"),a(c))}function a(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),a):c===96?(o=e.enter("codeTextSequence"),i=0,f(c)):_(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||_(c)?(e.exit("codeTextData"),a(c)):(e.consume(c),u)}function f(c){return c===96?(e.consume(c),i++,f):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(o.type="codeTextData",u(c))}}class ys{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&ot(this.left,r),o.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 ki(e){const t={};let n=-1,r,i,o,l,s,a,u;const f=new ys(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(a=r[1]._tokenizer.events,o=0,o<a.length&&a[o][1].type==="lineEndingBlank"&&(o+=2),o<a.length&&a[o][1].type==="content"))for(;++o<a.length&&a[o][1].type!=="content";)a[o][1].type==="chunkText"&&(a[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,ks(f,n)),n=t[n],u=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(l=f.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(f.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...f.get(i)[1].start},s=f.slice(i,n),s.unshift(r),f.splice(i,n-i+1,s))}}return ye(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!u}function ks(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const s=l.events,a=[],u={};let f,c,h=-1,p=n,m=0,k=0;const C=[k];for(;p;){for(;e.get(++i)[1]!==p;);o.push(i),p._tokenizer||(f=r.sliceStream(p),p.next||f.push(null),c&&l.defineSkip(p.start),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(f),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),c=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&&(k=h+1,C.push(k),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(l.events=[],p?(p._tokenizer=void 0,p.previous=void 0):C.pop(),h=C.length;h--;){const y=s.slice(C[h],C[h+1]),v=o.pop();a.push([v,v+y.length-1]),e.splice(v,2,y)}for(a.reverse(),h=-1;++h<a.length;)u[m+a[h][0]]=m+a[h][1],m+=a[h][1]-a[h][0]-1;return u}const bs={resolve:Ss,tokenize:Cs},ws={partial:!0,tokenize:vs};function Ss(e){return ki(e),e}function Cs(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?o(s):_(s)?e.check(ws,l,o)(s):(e.consume(s),i)}function o(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function l(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function vs(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),W(e,o,"linePrefix")}function o(l){if(l===null||_(l))return n(l);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(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function bi(e,t,n,r,i,o,l,s,a){const u=a||Number.POSITIVE_INFINITY;let f=0;return c;function c(y){return y===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(y),e.exit(o),h):y===null||y===32||y===41||_t(y)?n(y):(e.enter(r),e.enter(l),e.enter(s),e.enter("chunkString",{contentType:"string"}),k(y))}function h(y){return y===62?(e.enter(o),e.consume(y),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(s),h(y)):y===null||y===60||_(y)?n(y):(e.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function k(y){return!f&&(y===null||y===41||X(y))?(e.exit("chunkString"),e.exit(s),e.exit(l),e.exit(r),t(y)):f<u&&y===40?(e.consume(y),f++,k):y===41?(e.consume(y),f--,k):y===null||y===32||y===40||_t(y)?n(y):(e.consume(y),y===92?C:k)}function C(y){return y===40||y===41||y===92?(e.consume(y),k):k(y)}}function wi(e,t,n,r,i,o){const l=this;let s=0,a;return u;function u(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(o),f}function f(p){return s>999||p===null||p===91||p===93&&!a||p===94&&!s&&"_hiddenFootnoteSupport"in l.parser.constructs?n(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):_(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===null||p===91||p===93||_(p)||s++>999?(e.exit("chunkString"),f(p)):(e.consume(p),a||(a=!U(p)),p===92?h:c)}function h(p){return p===91||p===92||p===93?(e.consume(p),s++,c):c(p)}}function Si(e,t,n,r,i,o){let l;return s;function s(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),l=h===40?41:h,a):n(h)}function a(h){return h===l?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(o),u(h))}function u(h){return h===l?(e.exit(o),a(l)):h===null?n(h):_(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),W(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===l||h===null||_(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?c:f)}function c(h){return h===l||h===92?(e.consume(h),f):f(h)}}function ut(e,t){let n;return r;function r(i){return _(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):U(i)?W(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Es={name:"definition",tokenize:js},As={partial:!0,tokenize:Ns};function js(e,t,n){const r=this;let i;return o;function o(p){return e.enter("definition"),l(p)}function l(p){return wi.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),a):n(p)}function a(p){return X(p)?ut(e,u)(p):u(p)}function u(p){return bi(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function f(p){return e.attempt(As,c,c)(p)}function c(p){return U(p)?W(e,h,"whitespace")(p):h(p)}function h(p){return p===null||_(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function Ns(e,t,n){return r;function r(s){return X(s)?ut(e,i)(s):n(s)}function i(s){return Si(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return U(s)?W(e,l,"whitespace")(s):l(s)}function l(s){return s===null||_(s)?t(s):n(s)}}const Is={name:"hardBreakEscape",tokenize:Ls};function Ls(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return _(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const Ts={name:"headingAtx",resolve:Ps,tokenize:_s};function Ps(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ye(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function _s(e,t,n){let r=0;return i;function i(f){return e.enter("atxHeading"),o(f)}function o(f){return e.enter("atxHeadingSequence"),l(f)}function l(f){return f===35&&r++<6?(e.consume(f),l):f===null||X(f)?(e.exit("atxHeadingSequence"),s(f)):n(f)}function s(f){return f===35?(e.enter("atxHeadingSequence"),a(f)):f===null||_(f)?(e.exit("atxHeading"),t(f)):U(f)?W(e,s,"whitespace")(f):(e.enter("atxHeadingText"),u(f))}function a(f){return f===35?(e.consume(f),a):(e.exit("atxHeadingSequence"),s(f))}function u(f){return f===null||f===35||X(f)?(e.exit("atxHeadingText"),s(f)):(e.consume(f),u)}}const Ds=["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"],dr=["pre","script","style","textarea"],zs={concrete:!0,name:"htmlFlow",resolveTo:Os,tokenize:Ms},Fs={partial:!0,tokenize:$s},Rs={partial:!0,tokenize:Bs};function Os(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 Ms(e,t,n){const r=this;let i,o,l,s,a;return u;function u(x){return f(x)}function f(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),c}function c(x){return x===33?(e.consume(x),h):x===47?(e.consume(x),o=!0,k):x===63?(e.consume(x),i=3,r.interrupt?t:g):ce(x)?(e.consume(x),l=String.fromCharCode(x),C):n(x)}function h(x){return x===45?(e.consume(x),i=2,p):x===91?(e.consume(x),i=5,s=0,m):ce(x)?(e.consume(x),i=4,r.interrupt?t:g):n(x)}function p(x){return x===45?(e.consume(x),r.interrupt?t:g):n(x)}function m(x){const ge="CDATA[";return x===ge.charCodeAt(s++)?(e.consume(x),s===ge.length?r.interrupt?t:N:m):n(x)}function k(x){return ce(x)?(e.consume(x),l=String.fromCharCode(x),C):n(x)}function C(x){if(x===null||x===47||x===62||X(x)){const ge=x===47,Se=l.toLowerCase();return!ge&&!o&&dr.includes(Se)?(i=1,r.interrupt?t(x):N(x)):Ds.includes(l.toLowerCase())?(i=6,ge?(e.consume(x),y):r.interrupt?t(x):N(x)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):o?v(x):E(x))}return x===45||se(x)?(e.consume(x),l+=String.fromCharCode(x),C):n(x)}function y(x){return x===62?(e.consume(x),r.interrupt?t:N):n(x)}function v(x){return U(x)?(e.consume(x),v):b(x)}function E(x){return x===47?(e.consume(x),b):x===58||x===95||ce(x)?(e.consume(x),P):U(x)?(e.consume(x),E):b(x)}function P(x){return x===45||x===46||x===58||x===95||se(x)?(e.consume(x),P):O(x)}function O(x){return x===61?(e.consume(x),S):U(x)?(e.consume(x),O):E(x)}function S(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),a=x,R):U(x)?(e.consume(x),S):Q(x)}function R(x){return x===a?(e.consume(x),a=null,q):x===null||_(x)?n(x):(e.consume(x),R)}function Q(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||X(x)?O(x):(e.consume(x),Q)}function q(x){return x===47||x===62||U(x)?E(x):n(x)}function b(x){return x===62?(e.consume(x),j):n(x)}function j(x){return x===null||_(x)?N(x):U(x)?(e.consume(x),j):n(x)}function N(x){return x===45&&i===2?(e.consume(x),ie):x===60&&i===1?(e.consume(x),Z):x===62&&i===4?(e.consume(x),ue):x===63&&i===3?(e.consume(x),g):x===93&&i===5?(e.consume(x),me):_(x)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Fs,we,D)(x)):x===null||_(x)?(e.exit("htmlFlowData"),D(x)):(e.consume(x),N)}function D(x){return e.check(Rs,V,we)(x)}function V(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),$}function $(x){return x===null||_(x)?D(x):(e.enter("htmlFlowData"),N(x))}function ie(x){return x===45?(e.consume(x),g):N(x)}function Z(x){return x===47?(e.consume(x),l="",ne):N(x)}function ne(x){if(x===62){const ge=l.toLowerCase();return dr.includes(ge)?(e.consume(x),ue):N(x)}return ce(x)&&l.length<8?(e.consume(x),l+=String.fromCharCode(x),ne):N(x)}function me(x){return x===93?(e.consume(x),g):N(x)}function g(x){return x===62?(e.consume(x),ue):x===45&&i===2?(e.consume(x),g):N(x)}function ue(x){return x===null||_(x)?(e.exit("htmlFlowData"),we(x)):(e.consume(x),ue)}function we(x){return e.exit("htmlFlow"),t(x)}}function Bs(e,t,n){const r=this;return i;function i(l){return _(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):n(l)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function $s(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(dt,t,n)}}const qs={name:"htmlText",tokenize:Hs};function Hs(e,t,n){const r=this;let i,o,l;return s;function s(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),a}function a(g){return g===33?(e.consume(g),u):g===47?(e.consume(g),O):g===63?(e.consume(g),E):ce(g)?(e.consume(g),Q):n(g)}function u(g){return g===45?(e.consume(g),f):g===91?(e.consume(g),o=0,m):ce(g)?(e.consume(g),v):n(g)}function f(g){return g===45?(e.consume(g),p):n(g)}function c(g){return g===null?n(g):g===45?(e.consume(g),h):_(g)?(l=c,Z(g)):(e.consume(g),c)}function h(g){return g===45?(e.consume(g),p):c(g)}function p(g){return g===62?ie(g):g===45?h(g):c(g)}function m(g){const ue="CDATA[";return g===ue.charCodeAt(o++)?(e.consume(g),o===ue.length?k:m):n(g)}function k(g){return g===null?n(g):g===93?(e.consume(g),C):_(g)?(l=k,Z(g)):(e.consume(g),k)}function C(g){return g===93?(e.consume(g),y):k(g)}function y(g){return g===62?ie(g):g===93?(e.consume(g),y):k(g)}function v(g){return g===null||g===62?ie(g):_(g)?(l=v,Z(g)):(e.consume(g),v)}function E(g){return g===null?n(g):g===63?(e.consume(g),P):_(g)?(l=E,Z(g)):(e.consume(g),E)}function P(g){return g===62?ie(g):E(g)}function O(g){return ce(g)?(e.consume(g),S):n(g)}function S(g){return g===45||se(g)?(e.consume(g),S):R(g)}function R(g){return _(g)?(l=R,Z(g)):U(g)?(e.consume(g),R):ie(g)}function Q(g){return g===45||se(g)?(e.consume(g),Q):g===47||g===62||X(g)?q(g):n(g)}function q(g){return g===47?(e.consume(g),ie):g===58||g===95||ce(g)?(e.consume(g),b):_(g)?(l=q,Z(g)):U(g)?(e.consume(g),q):ie(g)}function b(g){return g===45||g===46||g===58||g===95||se(g)?(e.consume(g),b):j(g)}function j(g){return g===61?(e.consume(g),N):_(g)?(l=j,Z(g)):U(g)?(e.consume(g),j):q(g)}function N(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),i=g,D):_(g)?(l=N,Z(g)):U(g)?(e.consume(g),N):(e.consume(g),V)}function D(g){return g===i?(e.consume(g),i=void 0,$):g===null?n(g):_(g)?(l=D,Z(g)):(e.consume(g),D)}function V(g){return g===null||g===34||g===39||g===60||g===61||g===96?n(g):g===47||g===62||X(g)?q(g):(e.consume(g),V)}function $(g){return g===47||g===62||X(g)?q(g):n(g)}function ie(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),t):n(g)}function Z(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),ne}function ne(g){return U(g)?W(e,me,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):me(g)}function me(g){return e.enter("htmlTextData"),l(g)}}const zn={name:"labelEnd",resolveAll:Qs,resolveTo:Ks,tokenize:Ys},Us={tokenize:Js},Vs={tokenize:Xs},Ws={tokenize:Gs};function Qs(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&ye(e,0,e.length,n),e}function Ks(e,t){let n=e.length,r=0,i,o,l,s;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const a={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},f={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[l-2][1].start}};return s=[["enter",a,t],["enter",u,t]],s=be(s,e.slice(o+1,o+r+3)),s=be(s,[["enter",f,t]]),s=be(s,Mt(t.parser.constructs.insideSpan.null,e.slice(o+r+4,l-3),t)),s=be(s,[["exit",f,t],e[l-2],e[l-1],["exit",u,t]]),s=be(s,e.slice(l+1)),s=be(s,[["exit",a,t]]),ye(e,o,e.length,s),e}function Ys(e,t,n){const r=this;let i=r.events.length,o,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return s;function s(h){return o?o._inactive?c(h):(l=r.parser.defined.includes(ve(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),a):n(h)}function a(h){return h===40?e.attempt(Us,f,l?f:c)(h):h===91?e.attempt(Vs,f,l?u:c)(h):l?f(h):c(h)}function u(h){return e.attempt(Ws,f,c)(h)}function f(h){return t(h)}function c(h){return o._balanced=!0,n(h)}}function Js(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return X(c)?ut(e,o)(c):o(c)}function o(c){return c===41?f(c):bi(e,l,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function l(c){return X(c)?ut(e,a)(c):f(c)}function s(c){return n(c)}function a(c){return c===34||c===39||c===40?Si(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):f(c)}function u(c){return X(c)?ut(e,f)(c):f(c)}function f(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function Xs(e,t,n){const r=this;return i;function i(s){return wi.call(r,e,o,l,"reference","referenceMarker","referenceString")(s)}function o(s){return r.parser.defined.includes(ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function l(s){return n(s)}}function Gs(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const Zs={name:"labelStartImage",resolveAll:zn.resolveAll,tokenize:ea};function ea(e,t,n){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),o}function o(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),l):n(s)}function l(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const ta={name:"labelStartLink",resolveAll:zn.resolveAll,tokenize:na};function na(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Qt={name:"lineEnding",tokenize:ra};function ra(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),W(e,t,"linePrefix")}}const Nt={name:"thematicBreak",tokenize:ia};function ia(e,t,n){let r=0,i;return o;function o(u){return e.enter("thematicBreak"),l(u)}function l(u){return i=u,s(u)}function s(u){return u===i?(e.enter("thematicBreakSequence"),a(u)):r>=3&&(u===null||_(u))?(e.exit("thematicBreak"),t(u)):n(u)}function a(u){return u===i?(e.consume(u),r++,a):(e.exit("thematicBreakSequence"),U(u)?W(e,s,"whitespace")(u):s(u))}}const he={continuation:{tokenize:aa},exit:ca,name:"list",tokenize:sa},la={partial:!0,tokenize:fa},oa={partial:!0,tokenize:ua};function sa(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return s;function s(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:xn(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Nt,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(p)}return n(p)}function a(p){return xn(p)&&++l<10?(e.consume(p),a):(!r.interrupt||l<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(dt,r.interrupt?n:f,e.attempt(la,h,c))}function f(p){return r.containerState.initialBlankLine=!0,o++,h(p)}function c(p){return U(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function aa(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(dt,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,W(e,t,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!U(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(oa,t,l)(s))}function l(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,W(e,e.attempt(he,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function ua(e,t,n){const r=this;return W(e,i,"listItemIndent",r.containerState.size+1);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(o):n(o)}}function ca(e){e.exit(this.containerState.type)}function fa(e,t,n){const r=this;return W(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=r.events[r.events.length-1];return!U(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const mr={name:"setextUnderline",resolveTo:pa,tokenize:ha};function pa(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",l,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function ha(e,t,n){const r=this;let i;return o;function o(u){let f=r.events.length,c;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){c=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,l(u)):n(u)}function l(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),U(u)?W(e,a,"lineSuffix")(u):a(u))}function a(u){return u===null||_(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const da={tokenize:ma};function ma(e){const t=this,n=e.attempt(dt,r,e.attempt(this.parser.constructs.flowInitial,i,W(e,e.attempt(this.parser.constructs.flow,i,e.attempt(bs,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ga={resolveAll:vi()},xa=Ci("string"),ya=Ci("text");function Ci(e){return{resolveAll:vi(e==="text"?ka:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,l,s);return l;function l(f){return u(f)?o(f):s(f)}function s(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),a}function a(f){return u(f)?(n.exit("data"),o(f)):(n.consume(f),a)}function u(f){if(f===null)return!0;const c=i[f];let h=-1;if(c)for(;++h<c.length;){const p=c[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function vi(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function ka(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,l=-1,s=0,a;for(;o--;){const u=i[o];if(typeof u=="string"){for(l=u.length;u.charCodeAt(l-1)===32;)s++,l--;if(l)break;l=-1}else if(u===-2)a=!0,s++;else if(u!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||a||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:r.start._bufferIndex+l,_index:r.start._index+o,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const ba={42:he,43:he,45:he,48:he,49:he,50:he,51:he,52:he,53:he,54:he,55:he,56:he,57:he,62:gi},wa={91:Es},Sa={[-2]:Wt,[-1]:Wt,32:Wt},Ca={35:Ts,42:Nt,45:[mr,Nt],60:zs,61:mr,95:Nt,96:hr,126:hr},va={38:yi,92:xi},Ea={[-5]:Qt,[-4]:Qt,[-3]:Qt,33:Zs,38:yi,42:yn,60:[ts,qs],91:ta,92:[Is,xi],93:zn,95:yn,96:ds},Aa={null:[yn,ga]},ja={null:[42,95]},Na={null:[]},Ia=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ja,contentInitial:wa,disable:Na,document:ba,flow:Ca,flowInitial:Sa,insideSpan:Aa,string:va,text:Ea},Symbol.toStringTag,{value:"Module"}));function La(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let l=[],s=[];const a={attempt:R(O),check:R(S),consume:v,enter:E,exit:P,interrupt:R(S,{interrupt:!0})},u={code:null,containerState:{},defineSkip:k,events:[],now:m,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:c};let f=t.tokenize.call(u,a);return t.resolveAll&&o.push(t),u;function c(j){return l=be(l,j),C(),l[l.length-1]!==null?[]:(Q(t,0),u.events=Mt(o,u.events,u),u.events)}function h(j,N){return Pa(p(j),N)}function p(j){return Ta(l,j)}function m(){const{_bufferIndex:j,_index:N,line:D,column:V,offset:$}=r;return{_bufferIndex:j,_index:N,line:D,column:V,offset:$}}function k(j){i[j.line]=j.column,b()}function C(){let j;for(;r._index<l.length;){const N=l[r._index];if(typeof N=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<N.length;)y(N.charCodeAt(r._bufferIndex));else y(N)}}function y(j){f=f(j)}function v(j){_(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,b()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=j}function E(j,N){const D=N||{};return D.type=j,D.start=m(),u.events.push(["enter",D,u]),s.push(D),D}function P(j){const N=s.pop();return N.end=m(),u.events.push(["exit",N,u]),N}function O(j,N){Q(j,N.from)}function S(j,N){N.restore()}function R(j,N){return D;function D(V,$,ie){let Z,ne,me,g;return Array.isArray(V)?we(V):"tokenize"in V?we([V]):ue(V);function ue(re){return Te;function Te(le){const je=le!==null&&re[le],Ne=le!==null&&re.null,De=[...Array.isArray(je)?je:je?[je]:[],...Array.isArray(Ne)?Ne:Ne?[Ne]:[]];return we(De)(le)}}function we(re){return Z=re,ne=0,re.length===0?ie:x(re[ne])}function x(re){return Te;function Te(le){return g=q(),me=re,re.partial||(u.currentConstruct=re),re.name&&u.parser.constructs.disable.null.includes(re.name)?Se():re.tokenize.call(N?Object.assign(Object.create(u),N):u,a,ge,Se)(le)}}function ge(re){return j(me,g),$}function Se(re){return g.restore(),++ne<Z.length?x(Z[ne]):ie}}}function Q(j,N){j.resolveAll&&!o.includes(j)&&o.push(j),j.resolve&&ye(u.events,N,u.events.length-N,j.resolve(u.events.slice(N),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function q(){const j=m(),N=u.previous,D=u.currentConstruct,V=u.events.length,$=Array.from(s);return{from:V,restore:ie};function ie(){r=j,u.previous=N,u.currentConstruct=D,u.events.length=V,s=$,b()}}function b(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ta(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,o)];else{if(l=e.slice(n,i),r>-1){const s=l[0];typeof s=="string"?l[0]=s.slice(r):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function Pa(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
`;break}case-3:{l=`\r
`;break}case-2:{l=t?" ":"	";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(o)}i=o===-2,r.push(l)}return r.join("")}function _a(e){const r={constructs:di([Ia,...(e||{}).extensions||[]]),content:i(Ko),defined:[],document:i(Jo),flow:i(da),lazy:{},string:i(xa),text:i(ya)};return r;function i(o){return l;function l(s){return La(r,o,s)}}}function Da(e){for(;!ki(e););return e}const gr=/[\0\t\n\r]/g;function za(){let e=1,t="",n=!0,r;return i;function i(o,l,s){const a=[];let u,f,c,h,p;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),c=0,t="",n&&(o.charCodeAt(0)===65279&&c++,n=void 0);c<o.length;){if(gr.lastIndex=c,u=gr.exec(o),h=u&&u.index!==void 0?u.index:o.length,p=o.charCodeAt(h),!u){t=o.slice(c);break}if(p===10&&c===h&&r)a.push(-3),r=void 0;else switch(r&&(a.push(-5),r=void 0),c<h&&(a.push(o.slice(c,h)),e+=h-c),p){case 0:{a.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,a.push(-2);e++<f;)a.push(-1);break}case 10:{a.push(-4),e=1;break}default:r=!0,e=1}c=h+1}return s&&(r&&a.push(-5),t&&a.push(t),a.push(null)),a}}const Fa=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ra(e){return e.replace(Fa,Oa)}function Oa(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return mi(n.slice(o?2:1),o?16:10)}return Dn(n)||e}const Ei={}.hasOwnProperty;function Ma(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Ba(n)(Da(_a(n).document().write(za()(e,t,!0))))}function Ba(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(yt),autolinkProtocol:q,autolinkEmail:q,atxHeading:o(it),blockQuote:o(Ne),characterEscape:q,characterReference:q,codeFenced:o(De),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(De,l),codeText:o(gt,l),codeTextData:q,data:q,codeFlowValue:q,definition:o(Vn),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(Qe),hardBreakEscape:o(Ke),hardBreakTrailing:o(Ke),htmlFlow:o(lt,l),htmlFlowData:q,htmlText:o(lt,l),htmlTextData:q,image:o(xt),label:l,link:o(yt),listItem:o(Ye),listItemValue:h,listOrdered:o(ze,c),listUnordered:o(ze),paragraph:o(Je),reference:x,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(it),strong:o(Fe),thematicBreak:o(Ht)},exit:{atxHeading:a(),atxHeadingSequence:O,autolink:a(),autolinkEmail:je,autolinkProtocol:le,blockQuote:a(),characterEscapeValue:b,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:re,characterReference:Te,codeFenced:a(C),codeFencedFence:k,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:b,codeIndented:a(y),codeText:a($),codeTextData:b,data:b,definition:a(),definitionDestinationString:P,definitionLabelString:v,definitionTitleString:E,emphasis:a(),hardBreakEscape:a(N),hardBreakTrailing:a(N),htmlFlow:a(D),htmlFlowData:b,htmlText:a(V),htmlTextData:b,image:a(Z),label:me,labelText:ne,lineEnding:j,link:a(ie),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:ge,resourceDestinationString:g,resourceTitleString:ue,resource:we,setextHeading:a(Q),setextHeadingLineSequence:R,setextHeadingText:S,strong:a(),thematicBreak:a()}};Ai(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(w){let L={type:"root",children:[]};const z={stack:[L],tokenStack:[],config:t,enter:s,exit:u,buffer:l,resume:f,data:n},H=[];let K=-1;for(;++K<w.length;)if(w[K][1].type==="listOrdered"||w[K][1].type==="listUnordered")if(w[K][0]==="enter")H.push(K);else{const fe=H.pop();K=i(w,fe,K)}for(K=-1;++K<w.length;){const fe=t[w[K][0]];Ei.call(fe,w[K][1].type)&&fe[w[K][1].type].call(Object.assign({sliceSerialize:w[K][2].sliceSerialize},z),w[K][1])}if(z.tokenStack.length>0){const fe=z.tokenStack[z.tokenStack.length-1];(fe[1]||xr).call(z,void 0,fe[0])}for(L.position={start:Pe(w.length>0?w[0][1].start:{line:1,column:1,offset:0}),end:Pe(w.length>0?w[w.length-2][1].end:{line:1,column:1,offset:0})},K=-1;++K<t.transforms.length;)L=t.transforms[K](L)||L;return L}function i(w,L,z){let H=L-1,K=-1,fe=!1,Ie,ke,Oe,Me;for(;++H<=z;){const A=w[H];switch(A[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{A[0]==="enter"?K++:K--,Me=void 0;break}case"lineEndingBlank":{A[0]==="enter"&&(Ie&&!Me&&!K&&!Oe&&(Oe=H),Me=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Me=void 0}if(!K&&A[0]==="enter"&&A[1].type==="listItemPrefix"||K===-1&&A[0]==="exit"&&(A[1].type==="listUnordered"||A[1].type==="listOrdered")){if(Ie){let Y=H;for(ke=void 0;Y--;){const F=w[Y];if(F[1].type==="lineEnding"||F[1].type==="lineEndingBlank"){if(F[0]==="exit")continue;ke&&(w[ke][1].type="lineEndingBlank",fe=!0),F[1].type="lineEnding",ke=Y}else if(!(F[1].type==="linePrefix"||F[1].type==="blockQuotePrefix"||F[1].type==="blockQuotePrefixWhitespace"||F[1].type==="blockQuoteMarker"||F[1].type==="listItemIndent"))break}Oe&&(!ke||Oe<ke)&&(Ie._spread=!0),Ie.end=Object.assign({},ke?w[ke][1].start:A[1].end),w.splice(ke||H,0,["exit",Ie,A[2]]),H++,z++}if(A[1].type==="listItemPrefix"){const Y={type:"listItem",_spread:!1,start:Object.assign({},A[1].start),end:void 0};Ie=Y,w.splice(H,0,["enter",Y,A[2]]),H++,z++,Oe=void 0,Me=!0}}}return w[L][1]._spread=fe,z}function o(w,L){return z;function z(H){s.call(this,w(H),H),L&&L.call(this,H)}}function l(){this.stack.push({type:"fragment",children:[]})}function s(w,L,z){this.stack[this.stack.length-1].children.push(w),this.stack.push(w),this.tokenStack.push([L,z||void 0]),w.position={start:Pe(L.start),end:void 0}}function a(w){return L;function L(z){w&&w.call(this,z),u.call(this,z)}}function u(w,L){const z=this.stack.pop(),H=this.tokenStack.pop();if(H)H[0].type!==w.type&&(L?L.call(this,w,H[0]):(H[1]||xr).call(this,w,H[0]));else throw new Error("Cannot close `"+w.type+"` ("+at({start:w.start,end:w.end})+"): it’s not open");z.position.end=Pe(w.end)}function f(){return _n(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function h(w){if(this.data.expectingFirstListItemValue){const L=this.stack[this.stack.length-2];L.start=Number.parseInt(this.sliceSerialize(w),10),this.data.expectingFirstListItemValue=void 0}}function p(){const w=this.resume(),L=this.stack[this.stack.length-1];L.lang=w}function m(){const w=this.resume(),L=this.stack[this.stack.length-1];L.meta=w}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const w=this.resume(),L=this.stack[this.stack.length-1];L.value=w.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const w=this.resume(),L=this.stack[this.stack.length-1];L.value=w.replace(/(\r?\n|\r)$/g,"")}function v(w){const L=this.resume(),z=this.stack[this.stack.length-1];z.label=L,z.identifier=ve(this.sliceSerialize(w)).toLowerCase()}function E(){const w=this.resume(),L=this.stack[this.stack.length-1];L.title=w}function P(){const w=this.resume(),L=this.stack[this.stack.length-1];L.url=w}function O(w){const L=this.stack[this.stack.length-1];if(!L.depth){const z=this.sliceSerialize(w).length;L.depth=z}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function R(w){const L=this.stack[this.stack.length-1];L.depth=this.sliceSerialize(w).codePointAt(0)===61?1:2}function Q(){this.data.setextHeadingSlurpLineEnding=void 0}function q(w){const z=this.stack[this.stack.length-1].children;let H=z[z.length-1];(!H||H.type!=="text")&&(H=Re(),H.position={start:Pe(w.start),end:void 0},z.push(H)),this.stack.push(H)}function b(w){const L=this.stack.pop();L.value+=this.sliceSerialize(w),L.position.end=Pe(w.end)}function j(w){const L=this.stack[this.stack.length-1];if(this.data.atHardBreak){const z=L.children[L.children.length-1];z.position.end=Pe(w.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(L.type)&&(q.call(this,w),b.call(this,w))}function N(){this.data.atHardBreak=!0}function D(){const w=this.resume(),L=this.stack[this.stack.length-1];L.value=w}function V(){const w=this.resume(),L=this.stack[this.stack.length-1];L.value=w}function $(){const w=this.resume(),L=this.stack[this.stack.length-1];L.value=w}function ie(){const w=this.stack[this.stack.length-1];if(this.data.inReference){const L=this.data.referenceType||"shortcut";w.type+="Reference",w.referenceType=L,delete w.url,delete w.title}else delete w.identifier,delete w.label;this.data.referenceType=void 0}function Z(){const w=this.stack[this.stack.length-1];if(this.data.inReference){const L=this.data.referenceType||"shortcut";w.type+="Reference",w.referenceType=L,delete w.url,delete w.title}else delete w.identifier,delete w.label;this.data.referenceType=void 0}function ne(w){const L=this.sliceSerialize(w),z=this.stack[this.stack.length-2];z.label=Ra(L),z.identifier=ve(L).toLowerCase()}function me(){const w=this.stack[this.stack.length-1],L=this.resume(),z=this.stack[this.stack.length-1];if(this.data.inReference=!0,z.type==="link"){const H=w.children;z.children=H}else z.alt=L}function g(){const w=this.resume(),L=this.stack[this.stack.length-1];L.url=w}function ue(){const w=this.resume(),L=this.stack[this.stack.length-1];L.title=w}function we(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function ge(w){const L=this.resume(),z=this.stack[this.stack.length-1];z.label=L,z.identifier=ve(this.sliceSerialize(w)).toLowerCase(),this.data.referenceType="full"}function Se(w){this.data.characterReferenceType=w.type}function re(w){const L=this.sliceSerialize(w),z=this.data.characterReferenceType;let H;z?(H=mi(L,z==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):H=Dn(L);const K=this.stack[this.stack.length-1];K.value+=H}function Te(w){const L=this.stack.pop();L.position.end=Pe(w.end)}function le(w){b.call(this,w);const L=this.stack[this.stack.length-1];L.url=this.sliceSerialize(w)}function je(w){b.call(this,w);const L=this.stack[this.stack.length-1];L.url="mailto:"+this.sliceSerialize(w)}function Ne(){return{type:"blockquote",children:[]}}function De(){return{type:"code",lang:null,meta:null,value:""}}function gt(){return{type:"inlineCode",value:""}}function Vn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Qe(){return{type:"emphasis",children:[]}}function it(){return{type:"heading",depth:0,children:[]}}function Ke(){return{type:"break"}}function lt(){return{type:"html",value:""}}function xt(){return{type:"image",title:null,url:"",alt:null}}function yt(){return{type:"link",title:null,url:"",children:[]}}function ze(w){return{type:"list",ordered:w.type==="listOrdered",start:null,spread:w._spread,children:[]}}function Ye(w){return{type:"listItem",spread:w._spread,checked:null,children:[]}}function Je(){return{type:"paragraph",children:[]}}function Fe(){return{type:"strong",children:[]}}function Re(){return{type:"text",value:""}}function Ht(){return{type:"thematicBreak"}}}function Pe(e){return{line:e.line,column:e.column,offset:e.offset}}function Ai(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Ai(e,r):$a(e,r)}}function $a(e,t){let n;for(n in t)if(Ei.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function xr(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+at({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+at({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+at({start:t.start,end:t.end})+") is still open")}function qa(e){const t=this;t.parser=n;function n(r){return Ma(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Ha(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 Ua(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function Va(e,t){const n=t.value?t.value+`
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function Wa(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Qa(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ka(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=rt(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let l,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=o+1,s+=1,e.footnoteCounts.set(r,s);const a={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,a);const u={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,u),e.applyData(t,u)}function Ya(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 Ja(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ji(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function Xa(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ji(e,t);const i={src:rt(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function Ga(e,t){const n={src:rt(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 Za(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 eu(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ji(e,t);const i={href:rt(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function tu(e,t){const n={href:rt(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 nu(e,t,n){const r=e.all(t),i=n?ru(n):Ni(t),o={},l=[];if(typeof t.checked=="boolean"){const f=r[0];let c;f&&f.type==="element"&&f.tagName==="p"?c=f:(c={type:"element",tagName:"p",properties:{},children:[]},r.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let s=-1;for(;++s<r.length;){const f=r[s];(i||s!==0||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
`}),f.type==="element"&&f.tagName==="p"&&!i?l.push(...f.children):l.push(f)}const a=r[r.length-1];a&&(i||a.type!=="element"||a.tagName!=="p")&&l.push({type:"text",value:`
`});const u={type:"element",tagName:"li",properties:o,children:l};return e.patch(t,u),e.applyData(t,u)}function ru(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Ni(n[r])}return t}function Ni(e){const t=e.spread;return t??e.children.length>1}function iu(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function lu(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ou(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function su(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function au(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=In(t.children[1]),a=si(t.children[t.children.length-1]);s&&a&&(l.position={start:s,end:a}),i.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function uu(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,s=l?l.length:t.children.length;let a=-1;const u=[];for(;++a<s;){const c=t.children[a],h={},p=l?l[a]:void 0;p&&(h.align=p);let m={type:"element",tagName:o,properties:h,children:[]};c&&(m.children=e.all(c),e.patch(c,m),m=e.applyData(c,m)),u.push(m)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,f),e.applyData(t,f)}function cu(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const yr=9,kr=32;function fu(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(br(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(br(t.slice(i),i>0,!1)),o.join("")}function br(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===yr||o===kr;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===yr||o===kr;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function pu(e,t){const n={type:"text",value:fu(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function hu(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const du={blockquote:Ha,break:Ua,code:Va,delete:Wa,emphasis:Qa,footnoteReference:Ka,heading:Ya,html:Ja,imageReference:Xa,image:Ga,inlineCode:Za,linkReference:eu,link:tu,listItem:nu,list:iu,paragraph:lu,root:ou,strong:su,table:au,tableCell:cu,tableRow:uu,text:pu,thematicBreak:hu,toml:vt,yaml:vt,definition:vt,footnoteDefinition:vt};function vt(){}const Ii=-1,Bt=0,ct=1,Dt=2,Fn=3,Rn=4,On=5,Mn=6,Li=7,Ti=8,wr=typeof self=="object"?self:globalThis,mu=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,l]=t[i];switch(o){case Bt:case Ii:return n(l,i);case ct:{const s=n([],i);for(const a of l)s.push(r(a));return s}case Dt:{const s=n({},i);for(const[a,u]of l)s[r(a)]=r(u);return s}case Fn:return n(new Date(l),i);case Rn:{const{source:s,flags:a}=l;return n(new RegExp(s,a),i)}case On:{const s=n(new Map,i);for(const[a,u]of l)s.set(r(a),r(u));return s}case Mn:{const s=n(new Set,i);for(const a of l)s.add(r(a));return s}case Li:{const{name:s,message:a}=l;return n(new wr[s](a),i)}case Ti:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:s}=new Uint8Array(l);return n(new DataView(s),l)}}return n(new wr[o](l),i)};return r},Sr=e=>mu(new Map,e)(0),Xe="",{toString:gu}={},{keys:xu}=Object,st=e=>{const t=typeof e;if(t!=="object"||!e)return[Bt,t];const n=gu.call(e).slice(8,-1);switch(n){case"Array":return[ct,Xe];case"Object":return[Dt,Xe];case"Date":return[Fn,Xe];case"RegExp":return[Rn,Xe];case"Map":return[On,Xe];case"Set":return[Mn,Xe];case"DataView":return[ct,n]}return n.includes("Array")?[ct,n]:n.includes("Error")?[Li,n]:[Dt,n]},Et=([e,t])=>e===Bt&&(t==="function"||t==="symbol"),yu=(e,t,n,r)=>{const i=(l,s)=>{const a=r.push(l)-1;return n.set(s,a),a},o=l=>{if(n.has(l))return n.get(l);let[s,a]=st(l);switch(s){case Bt:{let f=l;switch(a){case"bigint":s=Ti,f=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);f=null;break;case"undefined":return i([Ii],l)}return i([s,f],l)}case ct:{if(a){let h=l;return a==="DataView"?h=new Uint8Array(l.buffer):a==="ArrayBuffer"&&(h=new Uint8Array(l)),i([a,[...h]],l)}const f=[],c=i([s,f],l);for(const h of l)f.push(o(h));return c}case Dt:{if(a)switch(a){case"BigInt":return i([a,l.toString()],l);case"Boolean":case"Number":case"String":return i([a,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const f=[],c=i([s,f],l);for(const h of xu(l))(e||!Et(st(l[h])))&&f.push([o(h),o(l[h])]);return c}case Fn:return i([s,l.toISOString()],l);case Rn:{const{source:f,flags:c}=l;return i([s,{source:f,flags:c}],l)}case On:{const f=[],c=i([s,f],l);for(const[h,p]of l)(e||!(Et(st(h))||Et(st(p))))&&f.push([o(h),o(p)]);return c}case Mn:{const f=[],c=i([s,f],l);for(const h of l)(e||!Et(st(h)))&&f.push(o(h));return c}}const{message:u}=l;return i([s,{name:a,message:u}],l)};return o},Cr=(e,{json:t,lossy:n}={})=>{const r=[];return yu(!(t||n),!!t,new Map,r)(e),r},zt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Sr(Cr(e,t)):structuredClone(e):(e,t)=>Sr(Cr(e,t));function ku(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 bu(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function wu(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ku,r=e.options.footnoteBackLabel||bu,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let a=-1;for(;++a<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[a]);if(!u)continue;const f=e.all(u),c=String(u.identifier).toUpperCase(),h=rt(c.toLowerCase());let p=0;const m=[],k=e.footnoteCounts.get(c);for(;k!==void 0&&++p<=k;){m.length>0&&m.push({type:"text",value:" "});let v=typeof n=="string"?n:n(a,p);typeof v=="string"&&(v={type:"text",value:v}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(a,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const C=f[f.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const v=C.children[C.children.length-1];v&&v.type==="text"?v.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...m)}else f.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(f,!0)};e.patch(u,y),s.push(y)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...zt(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:`
`}]}}const $t=function(e){if(e==null)return Eu;if(typeof e=="function")return qt(e);if(typeof e=="object")return Array.isArray(e)?Su(e):Cu(e);if(typeof e=="string")return vu(e);throw new Error("Expected function, string, or object as test")};function Su(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=$t(e[n]);return qt(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function Cu(e){const t=e;return qt(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function vu(e){return qt(t);function t(n){return n&&n.type===e}}function qt(e){return t;function t(n,r,i){return!!(Au(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Eu(){return!0}function Au(e){return e!==null&&typeof e=="object"&&"type"in e}const Pi=[],ju=!0,kn=!1,Nu="skip";function _i(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=$t(i),l=r?-1:1;s(e,void 0,[])();function s(a,u,f){const c=a&&typeof a=="object"?a:{};if(typeof c.type=="string"){const p=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(a.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=Pi,m,k,C;if((!t||o(a,u,f[f.length-1]||void 0))&&(p=Iu(n(a,f)),p[0]===kn))return p;if("children"in a&&a.children){const y=a;if(y.children&&p[0]!==Nu)for(k=(r?y.children.length:-1)+l,C=f.concat(y);k>-1&&k<y.children.length;){const v=y.children[k];if(m=s(v,k,C)(),m[0]===kn)return m;k=typeof m[1]=="number"?m[1]:k+l}}return p}}}function Iu(e){return Array.isArray(e)?e:typeof e=="number"?[ju,e]:e==null?Pi:[e]}function Bn(e,t,n,r){let i,o,l;typeof t=="function"&&typeof n!="function"?(o=void 0,l=t,i=n):(o=t,l=n,i=r),_i(e,o,s,i);function s(a,u){const f=u[u.length-1],c=f?f.children.indexOf(a):void 0;return l(a,c,f)}}const bn={}.hasOwnProperty,Lu={};function Tu(e,t){const n=t||Lu,r=new Map,i=new Map,o=new Map,l={...du,...n.handlers},s={all:u,applyData:_u,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:l,one:a,options:n,patch:Pu,wrap:zu};return Bn(e,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const c=f.type==="definition"?r:i,h=String(f.identifier).toUpperCase();c.has(h)||c.set(h,f)}}),s;function a(f,c){const h=f.type,p=s.handlers[h];if(bn.call(s.handlers,h)&&p)return p(s,f,c);if(s.options.passThrough&&s.options.passThrough.includes(h)){if("children"in f){const{children:k,...C}=f,y=zt(C);return y.children=s.all(f),y}return zt(f)}return(s.options.unknownHandler||Du)(s,f,c)}function u(f){const c=[];if("children"in f){const h=f.children;let p=-1;for(;++p<h.length;){const m=s.one(h[p],f);if(m){if(p&&h[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=vr(m.value)),!Array.isArray(m)&&m.type==="element")){const k=m.children[0];k&&k.type==="text"&&(k.value=vr(k.value))}Array.isArray(m)?c.push(...m):c.push(m)}}}return c}}function Pu(e,t){e.position&&(t.position=bo(e))}function _u(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&o&&Object.assign(n.properties,zt(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function Du(e,t){const n=t.data||{},r="value"in t&&!(bn.call(n,"hProperties")||bn.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 zu(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
`});++r<e.length;)r&&n.push({type:"text",value:`
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function vr(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Er(e,t){const n=Tu(e,t),r=n.one(e,void 0),i=wu(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
`},i),o}function Fu(e,t){return e&&"run"in e?async function(n,r){const i=Er(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Er(n,{file:r,...e||t})}}function Ar(e){if(e)throw e}var It=Object.prototype.hasOwnProperty,Di=Object.prototype.toString,jr=Object.defineProperty,Nr=Object.getOwnPropertyDescriptor,Ir=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Di.call(t)==="[object Array]"},Lr=function(t){if(!t||Di.call(t)!=="[object Object]")return!1;var n=It.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&It.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||It.call(t,i)},Tr=function(t,n){jr&&n.name==="__proto__"?jr(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Pr=function(t,n){if(n==="__proto__")if(It.call(t,n)){if(Nr)return Nr(t,n).value}else return;return t[n]},Ru=function e(){var t,n,r,i,o,l,s=arguments[0],a=1,u=arguments.length,f=!1;for(typeof s=="boolean"&&(f=s,s=arguments[1]||{},a=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});a<u;++a)if(t=arguments[a],t!=null)for(n in t)r=Pr(s,n),i=Pr(t,n),s!==i&&(f&&i&&(Lr(i)||(o=Ir(i)))?(o?(o=!1,l=r&&Ir(r)?r:[]):l=r&&Lr(r)?r:{},Tr(s,{name:n,newValue:e(f,l,i)})):typeof i<"u"&&Tr(s,{name:n,newValue:i}));return s};const Kt=Yr(Ru);function wn(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 Ou(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);s(null,...i);function s(a,...u){const f=e[++o];let c=-1;if(a){l(a);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,f?Mu(f,s)(...u):l(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Mu(e,t){let n;return r;function r(...l){const s=e.length>l.length;let a;s&&l.push(i);try{a=e.apply(this,l)}catch(u){const f=u;if(s&&n)throw f;return i(f)}s||(a&&a.then&&typeof a.then=="function"?a.then(o,i):a instanceof Error?i(a):o(a))}function i(l,...s){n||(n=!0,t(l,...s))}function o(l){i(null,l)}}const Ee={basename:Bu,dirname:$u,extname:qu,join:Hu,sep:"/"};function Bu(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');mt(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else l<0&&(o=!0,l=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function $u(e){if(mt(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 qu(e){mt(e);let t=e.length,n=-1,r=0,i=-1,o=0,l;for(;t--;){const s=e.codePointAt(t);if(s===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),s===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Hu(...e){let t=-1,n;for(;++t<e.length;)mt(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Uu(n)}function Uu(e){mt(e);const t=e.codePointAt(0)===47;let n=Vu(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Vu(e,t){let n="",r=0,i=-1,o=0,l=-1,s,a;for(;++l<=e.length;){if(l<e.length)s=e.codePointAt(l);else{if(s===47)break;s=47}if(s===47){if(!(i===l-1||o===1))if(i!==l-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(a=n.lastIndexOf("/"),a!==n.length-1){a<0?(n="",r=0):(n=n.slice(0,a),r=n.length-1-n.lastIndexOf("/")),i=l,o=0;continue}}else if(n.length>0){n="",r=0,i=l,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,o=0}else s===46&&o>-1?o++:o=-1}return n}function mt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Wu={cwd:Qu};function Qu(){return"/"}function Sn(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ku(e){if(typeof e=="string")e=new URL(e);else if(!Sn(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 Yu(e)}function Yu(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Yt=["history","path","basename","stem","extname","dirname"];class zi{constructor(t){let n;t?Sn(t)?n={path:t}:typeof t=="string"||Ju(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Wu.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Yt.length;){const o=Yt[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)Yt.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ee.basename(this.path):void 0}set basename(t){Xt(t,"basename"),Jt(t,"basename"),this.path=Ee.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ee.dirname(this.path):void 0}set dirname(t){_r(this.basename,"dirname"),this.path=Ee.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ee.extname(this.path):void 0}set extname(t){if(Jt(t,"extname"),_r(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=Ee.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Sn(t)&&(t=Ku(t)),Xt(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ee.basename(this.path,this.extname):void 0}set stem(t){Xt(t,"stem"),Jt(t,"stem"),this.path=Ee.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new ae(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Jt(e,t){if(e&&e.includes(Ee.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ee.sep+"`")}function Xt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function _r(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Ju(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Xu=function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},Gu={}.hasOwnProperty;class $n extends Xu{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=Ou()}copy(){const t=new $n;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Kt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(en("data",this.frozen),this.namespace[t]=n,this):Gu.call(this.namespace,t)&&this.namespace[t]||void 0:t?(en("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=At(t),r=this.parser||this.Parser;return Gt("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Gt("process",this.parser||this.Parser),Zt("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,l){const s=At(t),a=r.parse(s);r.run(a,s,function(f,c,h){if(f||!c||!h)return u(f);const p=c,m=r.stringify(p,h);tc(m)?h.value=m:h.result=m,u(f,h)});function u(f,c){f||!c?l(f):o?o(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Gt("processSync",this.parser||this.Parser),Zt("processSync",this.compiler||this.Compiler),this.process(t,i),zr("processSync","process",n),r;function i(o,l){n=!0,Ar(o),r=l}}run(t,n,r){Dr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(l,s){const a=At(n);i.run(t,a,u);function u(f,c,h){const p=c||t;f?s(f):l?l(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),zr("runSync","run",r),i;function o(l,s){Ar(l),i=s,r=!0}}stringify(t,n){this.freeze();const r=At(n),i=this.compiler||this.Compiler;return Zt("stringify",i),Dr(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(en("use",this.frozen),t!=null)if(typeof t=="function")a(t,n);else if(typeof t=="object")Array.isArray(t)?s(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(u){if(typeof u=="function")a(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[f,...c]=u;a(f,c)}else l(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function l(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&&(i.settings=Kt(!0,i.settings,u.settings))}function s(u){let f=-1;if(u!=null)if(Array.isArray(u))for(;++f<u.length;){const c=u[f];o(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function a(u,f){let c=-1,h=-1;for(;++c<r.length;)if(r[c][0]===u){h=c;break}if(h===-1)r.push([u,...f]);else if(f.length>0){let[p,...m]=f;const k=r[h][1];wn(k)&&wn(p)&&(p=Kt(!0,k,p)),r[h]=[u,p,...m]}}}}const Zu=new $n().freeze();function Gt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Zt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function en(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 Dr(e){if(!wn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function zr(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function At(e){return ec(e)?e:new zi(e)}function ec(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function tc(e){return typeof e=="string"||nc(e)}function nc(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const rc="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Fr=[],Rr={allowDangerousHtml:!0},ic=/^(https?|ircs?|mailto|xmpp)$/i,lc=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function oc(e){const t=sc(e),n=ac(e);return uc(t.runSync(t.parse(n),n),e)}function sc(e){const t=e.rehypePlugins||Fr,n=e.remarkPlugins||Fr,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Rr}:Rr;return Zu().use(qa).use(n).use(Fu,r).use(t)}function ac(e){const t=e.children||"",n=new zi;return typeof t=="string"&&(n.value=t),n}function uc(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,l=t.skipHtml,s=t.unwrapDisallowed,a=t.urlTransform||cc;for(const f of lc)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+rc+f.id,void 0);return Bn(e,u),Eo(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function u(f,c,h){if(f.type==="raw"&&h&&typeof c=="number")return l?h.children.splice(c,1):h.children[c]={type:"text",value:f.value},c;if(f.type==="element"){let p;for(p in Vt)if(Object.hasOwn(Vt,p)&&Object.hasOwn(f.properties,p)){const m=f.properties[p],k=Vt[p];(k===null||k.includes(f.tagName))&&(f.properties[p]=a(String(m||""),p,f))}}if(f.type==="element"){let p=n?!n.includes(f.tagName):o?o.includes(f.tagName):!1;if(!p&&r&&typeof c=="number"&&(p=!r(f,c,h)),p&&h&&typeof c=="number")return s&&f.children?h.children.splice(c,1,...f.children):h.children.splice(c,1),c}}}function cc(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||ic.test(e.slice(0,t))?e:""}function Or(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function fc(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function pc(e,t,n){const i=$t((n||{}).ignore||[]),o=hc(t);let l=-1;for(;++l<o.length;)_i(e,"text",s);function s(u,f){let c=-1,h;for(;++c<f.length;){const p=f[c],m=h?h.children:void 0;if(i(p,m?m.indexOf(p):void 0,h))return;h=p}if(h)return a(u,f)}function a(u,f){const c=f[f.length-1],h=o[l][0],p=o[l][1];let m=0;const C=c.children.indexOf(u);let y=!1,v=[];h.lastIndex=0;let E=h.exec(u.value);for(;E;){const P=E.index,O={index:E.index,input:E.input,stack:[...f,u]};let S=p(...E,O);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?h.lastIndex=P+1:(m!==P&&v.push({type:"text",value:u.value.slice(m,P)}),Array.isArray(S)?v.push(...S):S&&v.push(S),m=P+E[0].length,y=!0),!h.global)break;E=h.exec(u.value)}return y?(m<u.value.length&&v.push({type:"text",value:u.value.slice(m)}),c.children.splice(C,1,...v)):v=[u],C+v.length}}function hc(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([dc(i[0]),mc(i[1])])}return t}function dc(e){return typeof e=="string"?new RegExp(fc(e),"g"):e}function mc(e){return typeof e=="function"?e:function(){return e}}const tn="phrasing",nn=["autolink","link","image","label"];function gc(){return{transforms:[Cc],enter:{literalAutolink:yc,literalAutolinkEmail:rn,literalAutolinkHttp:rn,literalAutolinkWww:rn},exit:{literalAutolink:Sc,literalAutolinkEmail:wc,literalAutolinkHttp:kc,literalAutolinkWww:bc}}}function xc(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:tn,notInConstruct:nn},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:tn,notInConstruct:nn},{character:":",before:"[ps]",after:"\\/",inConstruct:tn,notInConstruct:nn}]}}function yc(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function rn(e){this.config.enter.autolinkProtocol.call(this,e)}function kc(e){this.config.exit.autolinkProtocol.call(this,e)}function bc(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 wc(e){this.config.exit.autolinkEmail.call(this,e)}function Sc(e){this.exit(e)}function Cc(e){pc(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,vc],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Ec]],{ignore:["link","linkReference"]})}function vc(e,t,n,r,i){let o="";if(!Fi(i)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!Ac(n)))return!1;const l=jc(n+r);if(!l[0])return!1;const s={type:"link",title:null,url:o+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[s,{type:"text",value:l[1]}]:s}function Ec(e,t,n,r){return!Fi(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Ac(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function jc(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=Or(e,"(");let o=Or(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function Fi(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ve(n)||Ot(n))&&(!t||n!==47)}Ri.peek=Fc;function Nc(){this.buffer()}function Ic(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Lc(){this.buffer()}function Tc(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Pc(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ve(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _c(e){this.exit(e)}function Dc(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ve(this.sliceSerialize(e)).toLowerCase(),n.label=t}function zc(e){this.exit(e)}function Fc(){return"["}function Ri(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const l=n.enter("footnoteReference"),s=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),s(),l(),o+=i.move("]"),o}function Rc(){return{enter:{gfmFootnoteCallString:Nc,gfmFootnoteCall:Ic,gfmFootnoteDefinitionLabelString:Lc,gfmFootnoteDefinition:Tc},exit:{gfmFootnoteCallString:Pc,gfmFootnoteCall:_c,gfmFootnoteDefinitionLabelString:Dc,gfmFootnoteDefinition:zc}}}function Oc(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ri},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,l){const s=o.createTracker(l);let a=s.move("[^");const u=o.enter("footnoteDefinition"),f=o.enter("label");return a+=s.move(o.safe(o.associationId(r),{before:a,after:"]"})),f(),a+=s.move("]:"),r.children&&r.children.length>0&&(s.shift(4),a+=s.move((t?`
`:" ")+o.indentLines(o.containerFlow(r,s.current()),t?Oi:Mc))),u(),a}}function Mc(e,t,n){return t===0?e:Oi(e,t,n)}function Oi(e,t,n){return(n?"":"    ")+e}const Bc=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Mi.peek=Vc;function $c(){return{canContainEols:["delete"],enter:{strikethrough:Hc},exit:{strikethrough:Uc}}}function qc(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Bc}],handlers:{delete:Mi}}}function Hc(e){this.enter({type:"delete",children:[]},e)}function Uc(e){this.exit(e)}function Mi(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let l=i.move("~~");return l+=n.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),o(),l}function Vc(){return"~"}function Wc(e){return e.length}function Qc(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Wc,o=[],l=[],s=[],a=[];let u=0,f=-1;for(;++f<e.length;){const k=[],C=[];let y=-1;for(e[f].length>u&&(u=e[f].length);++y<e[f].length;){const v=Kc(e[f][y]);if(n.alignDelimiters!==!1){const E=i(v);C[y]=E,(a[y]===void 0||E>a[y])&&(a[y]=E)}k.push(v)}l[f]=k,s[f]=C}let c=-1;if(typeof r=="object"&&"length"in r)for(;++c<u;)o[c]=Mr(r[c]);else{const k=Mr(r);for(;++c<u;)o[c]=k}c=-1;const h=[],p=[];for(;++c<u;){const k=o[c];let C="",y="";k===99?(C=":",y=":"):k===108?C=":":k===114&&(y=":");let v=n.alignDelimiters===!1?1:Math.max(1,a[c]-C.length-y.length);const E=C+"-".repeat(v)+y;n.alignDelimiters!==!1&&(v=C.length+v+y.length,v>a[c]&&(a[c]=v),p[c]=v),h[c]=E}l.splice(1,0,h),s.splice(1,0,p),f=-1;const m=[];for(;++f<l.length;){const k=l[f],C=s[f];c=-1;const y=[];for(;++c<u;){const v=k[c]||"";let E="",P="";if(n.alignDelimiters!==!1){const O=a[c]-(C[c]||0),S=o[c];S===114?E=" ".repeat(O):S===99?O%2?(E=" ".repeat(O/2+.5),P=" ".repeat(O/2-.5)):(E=" ".repeat(O/2),P=E):P=" ".repeat(O)}n.delimiterStart!==!1&&!c&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||c)&&y.push(" "),n.alignDelimiters!==!1&&y.push(E),y.push(v),n.alignDelimiters!==!1&&y.push(P),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||c!==u-1)&&y.push("|")}m.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return m.join(`
`)}function Kc(e){return e==null?"":String(e)}function Mr(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}function Yc(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),Jc);return i(),l}function Jc(e,t,n){return">"+(n?"":" ")+e}function Xc(e,t){return Br(e,t.inConstruct,!0)&&!Br(e,t.notInConstruct,!1)}function Br(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 $r(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
`&&Xc(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function Gc(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>l&&(l=o):o=1,i=r+t.length,r=n.indexOf(t,i);return l}function Zc(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function ef(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 tf(e,t,n,r){const i=ef(n),o=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(Zc(e,n)){const c=n.enter("codeIndented"),h=n.indentLines(o,nf);return c(),h}const s=n.createTracker(r),a=i.repeat(Math.max(Gc(o,i)+1,3)),u=n.enter("codeFenced");let f=s.move(a);if(e.lang){const c=n.enter(`codeFencedLang${l}`);f+=s.move(n.safe(e.lang,{before:f,after:" ",encode:["`"],...s.current()})),c()}if(e.lang&&e.meta){const c=n.enter(`codeFencedMeta${l}`);f+=s.move(" "),f+=s.move(n.safe(e.meta,{before:f,after:`
`,encode:["`"],...s.current()})),c()}return f+=s.move(`
`),o&&(f+=s.move(o+`
`)),f+=s.move(a),u(),f}function nf(e,t,n){return(n?"":"    ")+e}function qn(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 rf(e,t,n,r){const i=qn(n),o=i==='"'?"Quote":"Apostrophe",l=n.enter("definition");let s=n.enter("label");const a=n.createTracker(r);let u=a.move("[");return u+=a.move(n.safe(n.associationId(e),{before:u,after:"]",...a.current()})),u+=a.move("]: "),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(s=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":`
`,...a.current()}))),s(),e.title&&(s=n.enter(`title${o}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),s()),l(),u}function lf(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 pt(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ft(e,t,n){const r=tt(e),i=tt(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Bi.peek=of;function Bi(e,t,n,r){const i=lf(n),o=n.enter("emphasis"),l=n.createTracker(r),s=l.move(i);let a=l.move(n.containerPhrasing(e,{after:i,before:s,...l.current()}));const u=a.charCodeAt(0),f=Ft(r.before.charCodeAt(r.before.length-1),u,i);f.inside&&(a=pt(u)+a.slice(1));const c=a.charCodeAt(a.length-1),h=Ft(r.after.charCodeAt(0),c,i);h.inside&&(a=a.slice(0,-1)+pt(c));const p=l.move(i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:f.outside},s+a+p}function of(e,t,n){return n.options.emphasis||"*"}function sf(e,t){let n=!1;return Bn(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,kn}),!!((!e.depth||e.depth<3)&&_n(e)&&(t.options.setext||n))}function af(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(sf(e,n)){const f=n.enter("headingSetext"),c=n.enter("phrasing"),h=n.containerPhrasing(e,{...o.current(),before:`
`,after:`
`});return c(),f(),h+`
`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
`))+1))}const l="#".repeat(i),s=n.enter("headingAtx"),a=n.enter("phrasing");o.move(l+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
`,...o.current()});return/^[\t ]/.test(u)&&(u=pt(u.charCodeAt(0))+u.slice(1)),u=u?l+" "+u:l,n.options.closeAtx&&(u+=" "+l),a(),s(),u}$i.peek=uf;function $i(e){return e.value||""}function uf(){return"<"}qi.peek=cf;function qi(e,t,n,r){const i=qn(n),o=i==='"'?"Quote":"Apostrophe",l=n.enter("image");let s=n.enter("label");const a=n.createTracker(r);let u=a.move("![");return u+=a.move(n.safe(e.alt,{before:u,after:"]",...a.current()})),u+=a.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(s=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),s(),e.title&&(s=n.enter(`title${o}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),s()),u+=a.move(")"),l(),u}function cf(){return"!"}Hi.peek=ff;function Hi(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let l=n.enter("label");const s=n.createTracker(r);let a=s.move("![");const u=n.safe(e.alt,{before:a,after:"]",...s.current()});a+=s.move(u+"]["),l();const f=n.stack;n.stack=[],l=n.enter("reference");const c=n.safe(n.associationId(e),{before:a,after:"]",...s.current()});return l(),n.stack=f,o(),i==="full"||!u||u!==c?a+=s.move(c+"]"):i==="shortcut"?a=a.slice(0,-1):a+=s.move("]"),a}function ff(){return"!"}Ui.peek=pf;function Ui(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const l=n.unsafe[o],s=n.compilePattern(l);let a;if(l.atBreak)for(;a=s.exec(r);){let u=a.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(a.index+1)}}return i+r+i}function pf(){return"`"}function Vi(e,t){const n=_n(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))}Wi.peek=hf;function Wi(e,t,n,r){const i=qn(n),o=i==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let s,a;if(Vi(e,n)){const f=n.stack;n.stack=[],s=n.enter("autolink");let c=l.move("<");return c+=l.move(n.containerPhrasing(e,{before:c,after:">",...l.current()})),c+=l.move(">"),s(),n.stack=f,c}s=n.enter("link"),a=n.enter("label");let u=l.move("[");return u+=l.move(n.containerPhrasing(e,{before:u,after:"](",...l.current()})),u+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),u+=l.move(")"),s(),u}function hf(e,t,n){return Vi(e,n)?"<":"["}Qi.peek=df;function Qi(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let l=n.enter("label");const s=n.createTracker(r);let a=s.move("[");const u=n.containerPhrasing(e,{before:a,after:"]",...s.current()});a+=s.move(u+"]["),l();const f=n.stack;n.stack=[],l=n.enter("reference");const c=n.safe(n.associationId(e),{before:a,after:"]",...s.current()});return l(),n.stack=f,o(),i==="full"||!u||u!==c?a+=s.move(c+"]"):i==="shortcut"?a=a.slice(0,-1):a+=s.move("]"),a}function df(){return"["}function Hn(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 mf(e){const t=Hn(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 gf(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 Ki(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 xf(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?gf(n):Hn(n);const s=e.ordered?l==="."?")":".":mf(n);let a=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const f=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&f&&(!f.children||!f.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&&(a=!0),Ki(n)===l&&f){let c=-1;for(;++c<e.children.length;){const h=e.children[c];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(l=s),n.bulletCurrent=l;const u=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=o,i(),u}function yf(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 kf(e,t,n,r){const i=yf(n);let o=n.bulletCurrent||Hn(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const s=n.createTracker(r);s.move(o+" ".repeat(l-o.length)),s.shift(l);const a=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,s.current()),f);return a(),u;function f(c,h,p){return h?(p?"":" ".repeat(l))+c:(p?o:o+" ".repeat(l-o.length))+c}}function bf(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),i(),l}const wf=$t(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Sf(e,t,n,r){return(e.children.some(function(l){return wf(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Cf(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Yi.peek=vf;function Yi(e,t,n,r){const i=Cf(n),o=n.enter("strong"),l=n.createTracker(r),s=l.move(i+i);let a=l.move(n.containerPhrasing(e,{after:i,before:s,...l.current()}));const u=a.charCodeAt(0),f=Ft(r.before.charCodeAt(r.before.length-1),u,i);f.inside&&(a=pt(u)+a.slice(1));const c=a.charCodeAt(a.length-1),h=Ft(r.after.charCodeAt(0),c,i);h.inside&&(a=a.slice(0,-1)+pt(c));const p=l.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:f.outside},s+a+p}function vf(e,t,n){return n.options.strong||"*"}function Ef(e,t,n,r){return n.safe(e.value,r)}function Af(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 jf(e,t,n){const r=(Ki(n)+(n.options.ruleSpaces?" ":"")).repeat(Af(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Ji={blockquote:Yc,break:$r,code:tf,definition:rf,emphasis:Bi,hardBreak:$r,heading:af,html:$i,image:qi,imageReference:Hi,inlineCode:Ui,link:Wi,linkReference:Qi,list:xf,listItem:kf,paragraph:bf,root:Sf,strong:Yi,text:Ef,thematicBreak:jf};function Nf(){return{enter:{table:If,tableData:qr,tableHeader:qr,tableRow:Tf},exit:{codeText:Pf,table:Lf,tableData:ln,tableHeader:ln,tableRow:ln}}}function If(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Lf(e){this.exit(e),this.data.inTable=void 0}function Tf(e){this.enter({type:"tableRow",children:[]},e)}function ln(e){this.exit(e)}function qr(e){this.enter({type:"tableCell",children:[]},e)}function Pf(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,_f));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function _f(e,t){return t==="|"?t:e}function Df(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:l,tableCell:a,tableRow:s}};function l(p,m,k,C){return u(f(p,k,C),p.align)}function s(p,m,k,C){const y=c(p,k,C),v=u([y]);return v.slice(0,v.indexOf(`
`))}function a(p,m,k,C){const y=k.enter("tableCell"),v=k.enter("phrasing"),E=k.containerPhrasing(p,{...C,before:o,after:o});return v(),y(),E}function u(p,m){return Qc(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function f(p,m,k){const C=p.children;let y=-1;const v=[],E=m.enter("table");for(;++y<C.length;)v[y]=c(C[y],m,k);return E(),v}function c(p,m,k){const C=p.children;let y=-1;const v=[],E=m.enter("tableRow");for(;++y<C.length;)v[y]=a(C[y],p,m,k);return E(),v}function h(p,m,k){let C=Ji.inlineCode(p,m,k);return k.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function zf(){return{exit:{taskListCheckValueChecked:Hr,taskListCheckValueUnchecked:Hr,paragraph:Rf}}}function Ff(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Of}}}function Hr(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Rf(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 i=t.children;let o=-1,l;for(;++o<i.length;){const s=i[o];if(s.type==="paragraph"){l=s;break}}l===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=Object.assign({},r.position.start)))}}this.exit(e)}function Of(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);o&&s.move(l);let a=Ji.listItem(e,t,n,{...r,...s.current()});return o&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),a;function u(f){return f+l}}function Mf(){return[gc(),Rc(),$c(),Nf(),zf()]}function Bf(e){return{extensions:[xc(),Oc(e),qc(),Df(e),Ff()]}}const $f={tokenize:Qf,partial:!0},Xi={tokenize:Kf,partial:!0},Gi={tokenize:Yf,partial:!0},Zi={tokenize:Jf,partial:!0},qf={tokenize:Xf,partial:!0},el={name:"wwwAutolink",tokenize:Vf,previous:nl},tl={name:"protocolAutolink",tokenize:Wf,previous:rl},Le={name:"emailAutolink",tokenize:Uf,previous:il},Ae={};function Hf(){return{text:Ae}}let He=48;for(;He<123;)Ae[He]=Le,He++,He===58?He=65:He===91&&(He=97);Ae[43]=Le;Ae[45]=Le;Ae[46]=Le;Ae[95]=Le;Ae[72]=[Le,tl];Ae[104]=[Le,tl];Ae[87]=[Le,el];Ae[119]=[Le,el];function Uf(e,t,n){const r=this;let i,o;return l;function l(c){return!Cn(c)||!il.call(r,r.previous)||Un(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(c))}function s(c){return Cn(c)?(e.consume(c),s):c===64?(e.consume(c),a):n(c)}function a(c){return c===46?e.check(qf,f,u)(c):c===45||c===95||se(c)?(o=!0,e.consume(c),a):f(c)}function u(c){return e.consume(c),i=!0,a}function f(c){return o&&i&&ce(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function Vf(e,t,n){const r=this;return i;function i(l){return l!==87&&l!==119||!nl.call(r,r.previous)||Un(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($f,e.attempt(Xi,e.attempt(Gi,o),n),n)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function Wf(e,t,n){const r=this;let i="",o=!1;return l;function l(c){return(c===72||c===104)&&rl.call(r,r.previous)&&!Un(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),s):n(c)}function s(c){if(ce(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),s;if(c===58){const h=i.toLowerCase();if(h==="http"||h==="https")return e.consume(c),a}return n(c)}function a(c){return c===47?(e.consume(c),o?u:(o=!0,a)):n(c)}function u(c){return c===null||_t(c)||X(c)||Ve(c)||Ot(c)?n(c):e.attempt(Xi,e.attempt(Gi,f),n)(c)}function f(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function Qf(e,t,n){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),o):n(l)}function o(l){return l===null?n(l):t(l)}}function Kf(e,t,n){let r,i,o;return l;function l(u){return u===46||u===95?e.check(Zi,a,s)(u):u===null||X(u)||Ve(u)||u!==45&&Ot(u)?a(u):(o=!0,e.consume(u),l)}function s(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),l}function a(u){return i||r||!o?n(u):t(u)}}function Yf(e,t){let n=0,r=0;return i;function i(l){return l===40?(n++,e.consume(l),i):l===41&&r<n?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(Zi,t,o)(l):l===null||X(l)||Ve(l)?t(l):(e.consume(l),i)}function o(l){return l===41&&r++,e.consume(l),i}}function Jf(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),o):s===93?(e.consume(s),i):s===60||s===null||X(s)||Ve(s)?t(s):n(s)}function i(s){return s===null||s===40||s===91||X(s)||Ve(s)?t(s):r(s)}function o(s){return ce(s)?l(s):n(s)}function l(s){return s===59?(e.consume(s),r):ce(s)?(e.consume(s),l):n(s)}}function Xf(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return se(o)?n(o):t(o)}}function nl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||X(e)}function rl(e){return!ce(e)}function il(e){return!(e===47||Cn(e))}function Cn(e){return e===43||e===45||e===46||e===95||se(e)}function Un(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 Gf={tokenize:op,partial:!0};function Zf(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:rp,continuation:{tokenize:ip},exit:lp}},text:{91:{name:"gfmFootnoteCall",tokenize:np},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ep,resolveTo:tp}}}}function ep(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const a=r.events[i][1];if(a.type==="labelImage"){l=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return s;function s(a){if(!l||!l._balanced)return n(a);const u=ve(r.sliceSerialize({start:l.end,end:r.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?n(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function tp(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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function np(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return s;function s(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),a}function a(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(o>999||c===93&&!l||c===null||c===91||X(c))return n(c);if(c===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(ve(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return X(c)||(l=!0),o++,e.consume(c),c===92?f:u}function f(c){return c===91||c===92||c===93?(e.consume(c),o++,u):u(c)}}function rp(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,l=0,s;return a;function a(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):n(m)}function f(m){if(l>999||m===93&&!s||m===null||m===91||X(m))return n(m);if(m===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=ve(r.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return X(m)||(s=!0),l++,e.consume(m),m===92?c:f}function c(m){return m===91||m===92||m===93?(e.consume(m),l++,f):f(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(o)||i.push(o),W(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function ip(e,t,n){return e.check(dt,t,e.attempt(Gf,t,n))}function lp(e){e.exit("gfmFootnoteDefinition")}function op(e,t,n){const r=this;return W(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):n(o)}}function sp(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,s){let a=-1;for(;++a<l.length;)if(l[a][0]==="enter"&&l[a][1].type==="strikethroughSequenceTemporary"&&l[a][1]._close){let u=a;for(;u--;)if(l[u][0]==="exit"&&l[u][1].type==="strikethroughSequenceTemporary"&&l[u][1]._open&&l[a][1].end.offset-l[a][1].start.offset===l[u][1].end.offset-l[u][1].start.offset){l[a][1].type="strikethroughSequence",l[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},l[u][1].start),end:Object.assign({},l[a][1].end)},c={type:"strikethroughText",start:Object.assign({},l[u][1].end),end:Object.assign({},l[a][1].start)},h=[["enter",f,s],["enter",l[u][1],s],["exit",l[u][1],s],["enter",c,s]],p=s.parser.constructs.insideSpan.null;p&&ye(h,h.length,0,Mt(p,l.slice(u+1,a),s)),ye(h,h.length,0,[["exit",c,s],["enter",l[a][1],s],["exit",l[a][1],s],["exit",f,s]]),ye(l,u-1,a-u+3,h),a=u+h.length-2;break}}for(a=-1;++a<l.length;)l[a][1].type==="strikethroughSequenceTemporary"&&(l[a][1].type="data");return l}function o(l,s,a){const u=this.previous,f=this.events;let c=0;return h;function h(m){return u===126&&f[f.length-1][1].type!=="characterEscape"?a(m):(l.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const k=tt(u);if(m===126)return c>1?a(m):(l.consume(m),c++,p);if(c<2&&!n)return a(m);const C=l.exit("strikethroughSequenceTemporary"),y=tt(m);return C._open=!y||y===2&&!!k,C._close=!k||k===2&&!!y,s(m)}}}class ap{constructor(){this.map=[]}add(t,n,r){up(this,t,n,r)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[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 i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function up(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function cp(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function fp(){return{flow:{null:{name:"table",tokenize:pp,resolveAll:hp}}}}function pp(e,t,n){const r=this;let i=0,o=0,l;return s;function s(b){let j=r.events.length-1;for(;j>-1;){const V=r.events[j][1].type;if(V==="lineEnding"||V==="linePrefix")j--;else break}const N=j>-1?r.events[j][1].type:null,D=N==="tableHead"||N==="tableRow"?S:a;return D===S&&r.parser.lazy[r.now().line]?n(b):D(b)}function a(b){return e.enter("tableHead"),e.enter("tableRow"),u(b)}function u(b){return b===124||(l=!0,o+=1),f(b)}function f(b){return b===null?n(b):_(b)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),p):n(b):U(b)?W(e,f,"whitespace")(b):(o+=1,l&&(l=!1,i+=1),b===124?(e.enter("tableCellDivider"),e.consume(b),e.exit("tableCellDivider"),l=!0,f):(e.enter("data"),c(b)))}function c(b){return b===null||b===124||X(b)?(e.exit("data"),f(b)):(e.consume(b),b===92?h:c)}function h(b){return b===92||b===124?(e.consume(b),c):c(b)}function p(b){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(b):(e.enter("tableDelimiterRow"),l=!1,U(b)?W(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):m(b))}function m(b){return b===45||b===58?C(b):b===124?(l=!0,e.enter("tableCellDivider"),e.consume(b),e.exit("tableCellDivider"),k):O(b)}function k(b){return U(b)?W(e,C,"whitespace")(b):C(b)}function C(b){return b===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(b),e.exit("tableDelimiterMarker"),y):b===45?(o+=1,y(b)):b===null||_(b)?P(b):O(b)}function y(b){return b===45?(e.enter("tableDelimiterFiller"),v(b)):O(b)}function v(b){return b===45?(e.consume(b),v):b===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(b),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(b))}function E(b){return U(b)?W(e,P,"whitespace")(b):P(b)}function P(b){return b===124?m(b):b===null||_(b)?!l||i!==o?O(b):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(b)):O(b)}function O(b){return n(b)}function S(b){return e.enter("tableRow"),R(b)}function R(b){return b===124?(e.enter("tableCellDivider"),e.consume(b),e.exit("tableCellDivider"),R):b===null||_(b)?(e.exit("tableRow"),t(b)):U(b)?W(e,R,"whitespace")(b):(e.enter("data"),Q(b))}function Q(b){return b===null||b===124||X(b)?(e.exit("data"),R(b)):(e.consume(b),b===92?q:Q)}function q(b){return b===92||b===124?(e.consume(b),Q):Q(b)}}function hp(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],l=[0,0,0,0],s=!1,a=0,u,f,c;const h=new ap;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(s=!1,a!==0&&(Ur(h,t,a,u,f),f=void 0,a=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,c=void 0,o=[0,0,0,0],l=[0,n+1,0,0],s&&(s=!1,f={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",f,t]])),i=m.type==="tableDelimiterRow"?2:f?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],c=jt(h,t,o,i,void 0,c),o=[0,0,0,0]),l[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],c=jt(h,t,o,i,void 0,c)),o=l,l=[o[1],n,0,0])):m.type==="tableHead"?(s=!0,a=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(a=n,o[1]!==0?(l[0]=l[1],c=jt(h,t,o,i,n,c)):l[1]!==0&&(c=jt(h,t,l,i,n,c)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(l[3]=n)}for(a!==0&&Ur(h,t,a,u,f),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=cp(t.events,n))}return e}function jt(e,t,n,r,i,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(o.end=Object.assign({},Ge(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const a=Ge(t.events,n[1]);if(o={type:l,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const u=Ge(t.events,n[2]),f=Ge(t.events,n[3]),c={type:s,start:Object.assign({},u),end:Object.assign({},f)};if(e.add(n[2],0,[["enter",c,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 m=n[2]+1,k=n[3]-n[2]-1;e.add(m,k,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(o.end=Object.assign({},Ge(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Ur(e,t,n,r,i){const o=[],l=Ge(t.events,n);i&&(i.end=Object.assign({},l),o.push(["exit",i,t])),r.end=Object.assign({},l),o.push(["exit",r,t]),e.add(n+1,0,o)}function Ge(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const dp={name:"tasklistCheck",tokenize:gp};function mp(){return{text:{91:dp}}}function gp(e,t,n){const r=this;return i;function i(a){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),o)}function o(a){return X(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),l):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),l):n(a)}function l(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(a)}function s(a){return _(a)?t(a):U(a)?e.check({tokenize:xp},t,n)(a):n(a)}}function xp(e,t,n){return W(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function yp(e){return di([Hf(),Zf(),sp(e),fp(),mp()])}const kp={};function bp(e){const t=this,n=e||kp,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(yp(n)),o.push(Mf()),l.push(Bf(n))}function wp({scope:e,onChange:t,focus:n,disabled:r}){const[i,o]=B.useState(!1),l=B.useRef(null),s=et({queryKey:["db-profiles","list"],queryFn:()=>Ce("/api/profiles/db"),staleTime:3e4}),a=et({queryKey:["doc-profiles","list-for-scope"],queryFn:()=>Ce("/api/profiles/docs"),staleTime:3e4});B.useEffect(()=>{if(!i)return;function v(P){l.current&&(l.current.contains(P.target)||o(!1))}function E(P){P.key==="Escape"&&o(!1)}return document.addEventListener("mousedown",v),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",E)}},[i]);const u=s.data?.profiles??[],f=e===null,c=a.data?.profiles??[],h=f?u.map(v=>v.name):e,p=new Set(h),m=c.filter(v=>{const E=v.linked_db_profiles??[];return E.length===0?!0:E.some(P=>p.has(P))}).map(v=>v.name),k=f?`All profiles${u.length?` (${u.length})`:""}`:e.length===0?"No profiles selected":e.length===1?e[0]:`${e.length} profiles`;function C(v){if(f){t([v]);return}if(e.includes(v)){const E=e.filter(P=>P!==v);t(E.length===0?null:E);return}t([...e,v])}function y(){t(null)}return d.jsxs("div",{className:"relative",ref:l,children:[d.jsxs("button",{type:"button",disabled:r,onClick:()=>o(v=>!v),title:"Pick which DB profiles this chat queries","aria-haspopup":"listbox","aria-expanded":i,className:J("flex h-7 items-center gap-1.5 rounded-md border px-2 text-[11px] font-medium transition-colors duration-fast",r?"cursor-default border-surface-border bg-transparent text-ink-dim":f?"border-border bg-surface text-ink-muted hover:border-accent/40 hover:text-ink":"border-accent/30 bg-accent-soft text-accent-ink hover:bg-accent-soft/80"),children:[d.jsx(dl,{size:12,className:"opacity-70"}),d.jsx("span",{className:"font-mono uppercase tracking-wider opacity-70 text-[9px]",children:"Scope"}),d.jsx("span",{className:"max-w-[10rem] truncate",children:k}),d.jsx(En,{size:12,className:"opacity-70"})]}),i&&d.jsxs("div",{className:"absolute bottom-full right-0 z-30 mb-1 w-72 overflow-hidden rounded-md border border-border bg-surface-raised shadow-md animate-fade-in",children:[d.jsxs("button",{type:"button",onClick:y,className:J("flex w-full items-center justify-between border-b border-border px-3 py-2 text-left text-xs hover:bg-surface-subtle",f&&"bg-accent-soft/40 text-accent-ink"),children:[d.jsx("span",{className:"font-medium",children:"All profiles"}),f&&d.jsx(un,{size:12,className:"text-accent"})]}),s.isLoading?d.jsx("div",{className:"px-3 py-3 text-xs text-ink-dim",children:"Loading profiles…"}):s.error?d.jsx("div",{className:"px-3 py-3 text-xs text-critical",children:s.error.message}):u.length===0?d.jsx("div",{className:"px-3 py-3 text-xs text-ink-dim",children:"No DB profiles configured. Add one under Settings."}):d.jsx("ul",{className:"max-h-72 overflow-y-auto py-1",role:"listbox","aria-multiselectable":!0,children:u.map(v=>{const E=!f&&e.includes(v.name);return d.jsx("li",{children:d.jsxs("button",{type:"button",role:"option","aria-selected":E,onClick:()=>C(v.name),className:J("flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left text-xs hover:bg-surface-subtle",E&&"bg-accent-soft/40"),children:[d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block truncate font-mono text-ink",children:v.name}),v.backend&&d.jsx("span",{className:"block truncate text-[10.5px] text-ink-dim",children:v.backend})]}),E&&d.jsx(un,{size:12,className:"text-accent"})]})},v.name)})}),m.length>0&&d.jsxs("div",{className:"border-t border-border bg-surface-subtle/40 px-3 py-1.5 text-[10.5px] text-ink-dim",children:[d.jsx("span",{children:"Docs in scope:"})," ",m.map((v,E)=>d.jsxs("span",{children:[E>0&&d.jsx("span",{className:"opacity-50",children:" · "}),d.jsx("span",{className:"font-mono text-ink-muted",children:v})]},v))]}),n&&d.jsxs("div",{className:"border-t border-border bg-surface-subtle/40 px-3 py-1.5 text-[10.5px] text-ink-dim",children:["Focus: ",d.jsx("span",{className:"font-mono text-ink-muted",children:n}),d.jsx("span",{className:"ml-1 opacity-70",children:"(auto-detected)"})]})]})]})}function Sp({docProfiles:e,codeProfiles:t,lineageArtifacts:n,anchoredPagesCount:r,docOverride:i,codeOverride:o,lineageOverride:l,pagesEnabled:s,onDocChange:a,onCodeChange:u,onLineageChange:f,onPagesChange:c,disabled:h}){const[p,m]=B.useState(null);function k(y){m(v=>v===y?null:y)}function C(){m(null)}return d.jsxs("div",{className:"grid w-full grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[d.jsx(on,{label:"Docs",items:e.map(y=>({name:y.name,count:y.indexedChunks})),mode:i,autoCount:e.length,emptyHint:"No doc profiles configured.",open:p==="docs",onToggleOpen:()=>k("docs"),onClose:C,onChange:a,countSuffix:"chunks",disabled:h}),d.jsx(on,{label:"Code",items:t.map(y=>({name:y.name,count:y.indexedSnippets})),mode:o,autoCount:t.length,emptyHint:"No code profiles configured.",open:p==="code",onToggleOpen:()=>k("code"),onClose:C,onChange:u,countSuffix:"snippets",disabled:h}),d.jsx(on,{label:"Lineage",items:n.map(y=>({name:y.name,count:0})),mode:l,autoCount:n.length,emptyHint:"No lineage canvases linked to this scope.",open:p==="lineage",onToggleOpen:()=>k("lineage"),onClose:C,onChange:f,countSuffix:"",disabled:h,useCheckboxLabels:!0}),d.jsx(Cp,{anchoredPagesCount:r,enabled:s,open:p==="pages",onToggleOpen:()=>k("pages"),onClose:C,onChange:c,disabled:h})]})}function on({label:e,items:t,mode:n,autoCount:r,emptyHint:i,open:o,onToggleOpen:l,onClose:s,onChange:a,countSuffix:u,disabled:f,useCheckboxLabels:c}){const h=B.useRef(null);B.useEffect(()=>{if(!o)return;function C(v){h.current&&(h.current.contains(v.target)||s())}function y(v){v.key==="Escape"&&s()}return document.addEventListener("mousedown",C),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",y)}},[o,s]);const p=vp(e,n,r),m=n!==null;function k(C){if(n===null){a([C]);return}if(n.includes(C)){a(n.filter(y=>y!==C));return}a([...n,C])}return d.jsxs("div",{className:"relative",ref:h,children:[d.jsxs("button",{type:"button",disabled:f,onClick:l,"aria-haspopup":"dialog","aria-expanded":o,className:J("flex h-7 w-full items-center gap-1.5 rounded-md border px-2 text-[11px] font-medium transition-colors duration-fast",f?"cursor-default border-surface-border bg-transparent text-ink-dim":m?"border-accent/30 bg-accent-soft text-accent-ink hover:bg-accent-soft/80":"border-border bg-surface text-ink-muted hover:border-accent/40 hover:text-ink"),children:[d.jsx(Jr,{size:12,className:"opacity-70"}),d.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:p}),d.jsx(En,{size:12,className:"opacity-70"})]}),o&&d.jsx("div",{className:"absolute bottom-full left-0 z-30 mb-1 w-72 overflow-hidden rounded-md border border-border bg-surface-raised shadow-md animate-fade-in",children:d.jsxs("div",{className:"px-3 py-2",children:[d.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[d.jsx("span",{className:"text-[10.5px] font-medium uppercase tracking-wider text-ink-dim",children:e}),d.jsxs("div",{className:"flex gap-1 text-[10.5px]",children:[d.jsxs("button",{type:"button",onClick:()=>a(null),className:J("rounded px-1.5 py-0.5",n===null?"bg-accent-soft/60 text-accent-ink":"text-ink-dim hover:bg-surface-subtle hover:text-ink"),children:["Auto (",r,")"]}),d.jsx("button",{type:"button",onClick:()=>a([]),className:J("rounded px-1.5 py-0.5",n!==null&&n.length===0?"bg-warning-soft text-warning":"text-ink-dim hover:bg-surface-subtle hover:text-ink"),children:"Off"})]})]}),t.length===0?d.jsx("p",{className:"text-[10.5px] text-ink-dim",children:i}):d.jsx("ul",{role:"listbox","aria-multiselectable":!0,className:"space-y-0.5",children:t.map(C=>{const y=n!==null&&n.includes(C.name);return c?d.jsx("li",{children:d.jsxs("label",{className:J("flex w-full items-center gap-2 rounded px-2 py-1 text-xs hover:bg-surface-subtle",y&&"bg-accent-soft/40"),children:[d.jsx("input",{type:"checkbox",checked:y,onChange:()=>k(C.name),className:"h-3 w-3 accent-accent"}),d.jsx("span",{className:"min-w-0 flex-1",children:d.jsx("span",{className:"block truncate font-mono text-ink",children:C.name})})]})},C.name):d.jsx("li",{children:d.jsxs("button",{type:"button",role:"option","aria-selected":y,onClick:()=>k(C.name),className:J("flex w-full items-center justify-between gap-2 rounded px-2 py-1 text-left text-xs hover:bg-surface-subtle",y&&"bg-accent-soft/40"),children:[d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block truncate font-mono text-ink",children:C.name}),C.count>0&&u&&d.jsxs("span",{className:"block truncate text-[10px] text-ink-dim",children:[C.count," ",u]})]}),y&&d.jsx(un,{size:12,className:"text-accent"})]})},C.name)})})]})})]})}function Cp({anchoredPagesCount:e,enabled:t,open:n,onToggleOpen:r,onClose:i,onChange:o,disabled:l}){const s=B.useRef(null);B.useEffect(()=>{if(!n)return;function f(h){s.current&&(s.current.contains(h.target)||i())}function c(h){h.key==="Escape"&&i()}return document.addEventListener("mousedown",f),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",c)}},[n,i]);const a=Ep(t,e),u=t!==null;return d.jsxs("div",{className:"relative",ref:s,children:[d.jsxs("button",{type:"button",disabled:l,onClick:r,"aria-haspopup":"dialog","aria-expanded":n,className:J("flex h-7 w-full items-center gap-1.5 rounded-md border px-2 text-[11px] font-medium transition-colors duration-fast",l?"cursor-default border-surface-border bg-transparent text-ink-dim":u?"border-accent/30 bg-accent-soft text-accent-ink hover:bg-accent-soft/80":"border-border bg-surface text-ink-muted hover:border-accent/40 hover:text-ink"),children:[d.jsx(Jr,{size:12,className:"opacity-70"}),d.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:a}),d.jsx(En,{size:12,className:"opacity-70"})]}),n&&d.jsx("div",{className:"absolute bottom-full left-0 z-30 mb-1 w-64 overflow-hidden rounded-md border border-border bg-surface-raised shadow-md animate-fade-in",children:d.jsxs("div",{className:"px-3 py-2",children:[d.jsx("div",{className:"mb-1.5 flex items-center justify-between",children:d.jsx("span",{className:"text-[10.5px] font-medium uppercase tracking-wider text-ink-dim",children:"Pages"})}),d.jsx("p",{className:"mb-2 text-[10.5px] text-ink-dim",children:e>0?`${e} anchored to this scope.`:"No pages anchored to this scope."}),d.jsxs("div",{className:"flex gap-1 text-[11px]",children:[d.jsx("button",{type:"button",onClick:()=>o(null),className:J("flex-1 rounded px-2 py-1",t===null?"bg-accent-soft/60 text-accent-ink":"text-ink-dim hover:bg-surface-subtle hover:text-ink"),children:"Auto"}),d.jsx("button",{type:"button",onClick:()=>o(!0),className:J("flex-1 rounded px-2 py-1",t===!0?"bg-accent-soft/60 text-accent-ink":"text-ink-dim hover:bg-surface-subtle hover:text-ink"),children:"On"}),d.jsx("button",{type:"button",onClick:()=>o(!1),className:J("flex-1 rounded px-2 py-1",t===!1?"bg-warning-soft text-warning":"text-ink-dim hover:bg-surface-subtle hover:text-ink"),children:"Off"})]})]})})]})}function vp(e,t,n){return t===null?`${e}: Auto (${n})`:t.length===0?`${e}: Off`:`${e}: ${t.length}`}function Ep(e,t){return e===null?`Pages: Auto (${t})`:e===!1?"Pages: Off":"Pages: On"}function ll(e){if(Array.isArray(e.line_range)&&e.line_range.length===2){const[t,n]=e.line_range;if(Number.isFinite(t)&&t>0)return Number.isFinite(n)&&n>0&&n!==t?`${e.source}:${t}-${n}`:`${e.source}:${t}`}return typeof e.chunk_idx=="number"&&e.chunk_idx>0?`${e.source}:${e.chunk_idx}`:e.source}function Ap({selectedSessionId:e,seedTurns:t,seedToken:n,seedSubmit:r,loadingSession:i=!1,onSeedSubmitConsumed:o,onSessionAssigned:l,onResumeStale:s}){const[a,u]=B.useState([]),[f,c]=B.useState(""),[h,p]=B.useState(null),[m,k]=B.useState(null),[C,y]=B.useState(0),[v,E]=B.useState(!1),[P,O]=B.useState(null),[S,R]=B.useState(null),[Q,q]=B.useState(null),b=B.useRef(null),j=B.useRef(null),N=P!=null?String(P):"_new_",D=qe(A=>A.askScopeBySession),V=qe(A=>A.setAskScope),$=qe(A=>A.clearAskScope),ie=qe(A=>A.setAskActiveJob),Z=qe(A=>A.clearAskActiveJob),ne=N in D?D[N]:null,[me,g]=B.useState([]),[ue,we]=B.useState([]),[x,ge]=B.useState(null),[Se,re]=B.useState(null),Te="amx.ask.allowLiveRefresh",[le,je]=B.useState(()=>{try{return localStorage.getItem(Te)==="1"}catch{return!1}});B.useEffect(()=>{try{localStorage.setItem(Te,le?"1":"0")}catch{}},[le]);const Ne=et({queryKey:["context"],queryFn:()=>Zr.context(),staleTime:0}),De=Ne.data?.active_llm_profile??null,gt=Ne.data?.llm_model??null,Qe=et({queryKey:["ask","context","for-sources-picker",ne??"_session_default_"],queryFn:()=>{const A=ne&&ne.length>0?`?scope_profiles=${ne.map(encodeURIComponent).join(",")}`:"";return Ce(`/api/ask/context${A}`)},retry:!1,staleTime:1e4}).data??null;B.useEffect(()=>{if(!h||m==null)return;const A=window.setInterval(()=>y(Y=>Y+1),200);return()=>window.clearInterval(A)},[h,m]),B.useEffect(()=>{O(e),u(t??[]),p(null),k(null),R(null),q(null),e!=null&&$("_new_");const A=e!=null?String(e):"_new_",Y=qe.getState().askActiveJobBySession[A];if(Y){let F=!1;const ee=()=>qe.getState().askActiveJobBySession[A]===Y;return(async()=>{try{const oe=await Ce(`/api/ask/${Y}`);if(F||!ee())return;if(oe.status==="running"||oe.status==="queued"){p(Y);let pe=NaN;try{const Be=localStorage.getItem(`amx.ask.jobStartedAt.${Y}`);Be&&(pe=Number(Be))}catch{pe=NaN}k(Number.isFinite(pe)?pe:Date.now())}else Z(A),s?.()}catch{if(F||!ee())return;Z(A),s?.()}})(),()=>{F=!0}}},[n]);const{events:it,closed:Ke,error:lt,exhausted:xt,reconnect:yt}=ml({path:h?`/api/ask/${h}/events`:"",enabled:!!h}),{thinking:ze,streamingAnswer:Ye,finalAnswer:Je,toolCalls:Fe,activity:Re,llmRound:Ht,finalMeta:w,finalCitations:L,jobFailure:z,wasCancelled:H}=B.useMemo(()=>{const A=[],Y=[],F=[];let ee=null,oe=[],pe=null,Be={},Wn=[],Qn=null,Kn=!1;for(const T of it)if(T.type==="thinking.delta"&&typeof T.text=="string")A.push(T.text);else if(T.type==="answer.delta"&&typeof T.text=="string")oe.push(T.text);else if(T.type==="llm.round.started"||T.type==="llm.round.heartbeat"||T.type==="llm.round.finished"){const $e=T.type==="llm.round.finished"?"finished":"active";ee={round:typeof T.round=="number"?T.round:0,phase:String(T.phase||""),elapsedMs:typeof T.elapsed_ms=="number"?T.elapsed_ms:0,status:$e}}else if(T.type==="tool.started"){const $e=String(T.name||""),kt=String(T.arguments||""),bt=String(T.source_hint||"unknown");F.push({key:`act_${F.length}_${$e}`,name:$e,arguments:kt,phase:"pending",sourceHint:bt,scopeProfiles:Array.isArray(T.scope_profiles)?T.scope_profiles:void 0})}else if(T.type==="tool.call"){oe=[];const $e=String(T.name||""),kt=String(T.arguments||""),bt=typeof T.elapsed_ms=="number"?T.elapsed_ms:typeof T.latency_ms=="number"?T.latency_ms:void 0,ol=typeof T.source=="string"?T.source:void 0,sl=T.needs_live_refresh===!0,al=T.blocked_arguments&&typeof T.blocked_arguments=="object"?T.blocked_arguments:void 0,ul=typeof T.blocked_reason=="string"?T.blocked_reason:void 0,cl=typeof T.blocked_user_action=="string"?T.blocked_user_action:void 0;for(let wt=F.length-1;wt>=0;wt-=1){const St=F[wt];if(St.phase==="pending"&&St.name===$e&&St.arguments===kt){F[wt]={...St,phase:"done",source:ol,elapsedMs:bt,needsLiveRefresh:sl,blockedArguments:al,blockedReason:ul,blockedUserAction:cl};break}}Y.push({name:$e,arguments:kt,result_preview:String(T.result_preview||""),latency_ms:typeof T.latency_ms=="number"?T.latency_ms:bt,citations:Array.isArray(T.citations)?T.citations:void 0})}else T.type==="answer.final"&&typeof T.answer=="string"?(pe=T.answer,Be={scopeProfiles:Array.isArray(T.scope_profiles)?T.scope_profiles:void 0,focusProfile:typeof T.focus_profile=="string"?T.focus_profile:null,totalLatencyMs:typeof T.total_latency_ms=="number"?T.total_latency_ms:void 0},Array.isArray(T.citations)&&(Wn=T.citations)):T.type==="job.failed"?Qn={message:String(T.error||"Ask failed."),hint:typeof T.hint=="string"?T.hint:void 0}:T.type==="job.cancelled"&&(Kn=!0);return{thinking:A.join(""),streamingAnswer:oe.join(""),finalAnswer:pe,toolCalls:Y,activity:F,llmRound:ee,finalMeta:Be,finalCitations:Wn,jobFailure:Qn,wasCancelled:Kn}},[it]);B.useEffect(()=>{if(Ke){if(Je!=null){const A=Re.find(F=>F.needsLiveRefresh),Y=A?.name??"";u(F=>{const ee=F[F.length-1];if(ee?.role==="assistant"&&ee.content===Je)return F;let oe="";for(let pe=F.length-1;pe>=0;pe-=1)if(F[pe].role==="user"){oe=F[pe].content;break}return[...F,{role:"assistant",content:Je,toolCalls:Fe,scopeProfiles:w.scopeProfiles,focusProfile:w.focusProfile??null,totalLatencyMs:w.totalLatencyMs,citations:L.length>0?L:void 0,needsLiveRefresh:A&&oe?{question:oe,blockedTool:Y}:void 0}]}),p(null),k(null),E(!1),Z(N);return}if(z){R(z.message),q(z.hint??null),p(null),k(null),E(!1),Z(N);return}H||v?u(A=>{const Y=A[A.length-1];return Y?.role==="assistant"&&Y.cancelled?A:[...A,{role:"assistant",content:"",cancelled:!0}]}):(R("The ask stream ended without a final answer. Try again, or check Settings → LLM if this keeps happening."),q("configure-llm")),p(null),k(null),E(!1),Z(N)}},[Ke,Je,z,Fe,w,L,N,Z,v,H]);async function K(A){const Y=(A||"").trim();if(!(!Y||h)){R(null),q(null),u(F=>[...F,{role:"user",content:Y}]),c("");try{const F={question:Y,session_id:P??void 0};ne!==null&&(F.scope_profiles=ne),me!==null&&(F.doc_profiles=me),ue!==null&&(F.code_profiles=ue),x!==null&&(F.lineage_profiles=x),Se!==null&&(F.pages_enabled=Se),F.allow_live_refresh=le;const ee=await Ce("/api/ask",{method:"POST",body:JSON.stringify(F)});if(ee.session_id!=null&&P==null&&N==="_new_"&&"_new_"in D){const Be=D._new_;V(String(ee.session_id),Be),$("_new_")}O(ee.session_id),p(ee.job_id);const oe=Date.now();k(oe);try{localStorage.setItem(`amx.ask.jobStartedAt.${ee.job_id}`,String(oe))}catch{}const pe=ee.session_id!=null?String(ee.session_id):N;ie(pe,ee.job_id),l?.(ee.session_id)}catch(F){let ee="Ask failed.",oe=null;F instanceof xl?(ee=F.detail||F.message||ee,oe=F.hint??null):F instanceof Error&&(ee=F.message),R(ee),q(oe)}}}async function fe(A){A.preventDefault(),await K(f)}B.useEffect(()=>{r&&(h||(K(r),o?.()))},[r,n]);const Ie=Xr(),ke=sn({mutationFn:({id:A,scope:Y})=>Ce(`/api/ask/sessions/${A}`,{method:"PATCH",body:JSON.stringify({scope_profiles:Y})}),onError:A=>Ie.push({title:"Couldn't save scope",description:A.message,tone:"error"})});function Oe(A){V(N,A),P!=null&&ke.mutate({id:P,scope:A})}async function Me(){if(h){E(!0);try{await Ce(`/api/ask/${h}/cancel`,{method:"POST"})}catch{}}}return B.useLayoutEffect(()=>{const A=j.current;A&&(A.scrollTop=A.scrollHeight)},[a,ze,Ye,Fe.length,h,v]),d.jsxs("div",{className:"flex h-[calc(100vh-12rem)] min-h-[28rem] min-w-0 flex-col gap-4",children:[d.jsxs("div",{ref:j,className:"flex-1 min-w-0 space-y-4 overflow-y-auto overflow-x-hidden rounded-xl border border-surface-border bg-surface-raised p-4",children:[a.length===0&&!h&&(i?d.jsxs("div",{className:"space-y-3 px-1 pt-2",children:[[0,1,2].map(A=>d.jsx("div",{className:J("flex",A%2===0?"justify-end":"justify-start"),children:d.jsx("div",{className:"h-10 w-2/3 animate-pulse rounded-2xl bg-surface-subtle/60"})},A)),d.jsx("p",{className:"pt-1 text-center text-[11px] uppercase tracking-wider text-ink-dim",children:"Loading session…"})]}):d.jsxs("div",{className:"flex h-full min-h-[40vh] flex-col items-center justify-center text-center text-ink-dim",children:[d.jsx(Gr,{size:28,className:"mb-3 opacity-60"}),d.jsx("p",{className:"font-medium text-ink-muted",children:"Ask anything about your metadata."}),d.jsx("p",{className:"mt-1 max-w-md text-xs",children:"Try “which tables don't have comments?”, “what columns store email addresses?”, or “show me the latest run on sales.orders”."})]})),a.map((A,Y)=>A.role==="assistant"&&A.cancelled?d.jsx("div",{className:"flex justify-start",children:d.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-warning/30 bg-warning-soft/30 px-2.5 py-0.5 text-[11px] font-medium text-warning",children:[d.jsx(fn,{size:11})," Cancelled"]})},Y):d.jsxs(Vr,{role:A.role,children:[A.role==="assistant"?d.jsx(Wr,{text:A.content}):A.content,A.toolCalls&&A.toolCalls.length>0&&d.jsx(Qr,{calls:A.toolCalls}),A.role==="assistant"&&A.citations&&A.citations.length>0&&d.jsx(Kr,{citations:A.citations}),A.role==="assistant"&&A.needsLiveRefresh&&d.jsxs("button",{type:"button",onClick:()=>{je(!0),K(A.needsLiveRefresh.question)},disabled:!!h,className:J("mt-2 inline-flex items-center gap-1.5 rounded-full","border border-warning/40 bg-warning-soft/30 px-3 py-1","text-xs font-medium text-warning hover:bg-warning-soft/50","transition-colors",!!h&&"cursor-not-allowed opacity-50"),title:A.needsLiveRefresh.blockedTool?`Re-run with Live refresh — calls ${A.needsLiveRefresh.blockedTool}`:"Re-run this question with Live refresh enabled",children:[d.jsx("span",{"aria-hidden":!0,children:"⚡"}),"Enable Live refresh & retry"]}),A.role==="assistant"&&(A.scopeProfiles?.length||A.totalLatencyMs!=null)&&d.jsx(Tp,{scopeProfiles:A.scopeProfiles,focusProfile:A.focusProfile??null,totalLatencyMs:A.totalLatencyMs})]},Y)),h&&d.jsxs(Vr,{role:"assistant",pulsing:!v,children:[v&&d.jsxs("div",{className:"mb-1.5 inline-flex items-center gap-1.5 rounded-full bg-warning-soft/40 px-2 py-0.5 text-[11px] font-medium text-warning",children:[d.jsx(fn,{size:11})," Cancelling…"]}),!v&&d.jsx(Np,{jobStartedAt:m,tick:C,hasThinking:!!ze,hasActivity:Re.length>0,pendingActivity:Re.some(A=>A.phase==="pending"),hasStreamingAnswer:!!Ye,llmModel:gt??De??null,llmRound:Ht}),Re.length>0&&d.jsx(Ip,{rows:Re}),ze&&!v?d.jsx(jp,{text:ze}):null,Ye&&d.jsx(Wr,{text:Ye}),Fe.length>0&&d.jsx(Qr,{calls:Fe,live:!0}),L.length>0&&d.jsx(Kr,{citations:L})]}),S&&d.jsx(Lp,{message:S,hint:Q,onDismiss:()=>{R(null),q(null)}})]}),d.jsxs(Pt,{className:"p-3",children:[d.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[d.jsx(Sp,{docProfiles:(Qe?.doc_profiles??[]).map(A=>({name:A.name,indexedChunks:A.indexed_chunks})),codeProfiles:(Qe?.code_profiles??[]).map(A=>({name:A.name,indexedSnippets:A.indexed_snippets})),lineageArtifacts:(Qe?.lineage_artifacts??[]).map(A=>({name:A.name})),anchoredPagesCount:Qe?.anchored_pages?.count??0,docOverride:me,codeOverride:ue,lineageOverride:x,pagesEnabled:Se,onDocChange:g,onCodeChange:we,onLineageChange:ge,onPagesChange:re,disabled:!!h}),d.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[d.jsxs("button",{type:"button",onClick:()=>je(A=>!A),disabled:!!h,"aria-pressed":le,title:le?"Live refresh ON — this question may read the live DB.":"Live refresh OFF — answers come from cached catalog metadata only.",className:J("inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors",le?"border-accent/60 bg-accent/15 text-accent hover:bg-accent/25":"border-border bg-surface-raised text-ink-dim hover:bg-surface-raised/80",!!h&&"cursor-not-allowed opacity-60"),children:[d.jsx("span",{"aria-hidden":!0,className:J("inline-block h-1.5 w-1.5 rounded-full",le?"bg-accent":"bg-ink-dim/60")}),d.jsxs("span",{children:["Live refresh: ",le?"on":"off"]})]}),d.jsx(gl,{kind:"llm",label:"LLM",variant:"pill",placement:"top",activeName:De,tooltip:gt??void 0}),d.jsxs("div",{className:"relative",children:[d.jsx(wp,{scope:ne,onChange:Oe,disabled:!!h}),ke.isPending&&d.jsx("span",{"aria-label":"Saving scope",className:"pointer-events-none absolute -right-1 -top-1 inline-block h-2 w-2 animate-pulse rounded-full bg-accent"})]})]})]}),h&&lt&&!Ke&&d.jsxs("div",{role:"status",className:J("flex items-center gap-2 rounded-md border px-3 py-2 text-xs",xt?"border-critical/40 bg-critical-soft text-critical":"border-warning/40 bg-warning-soft text-warning"),children:[d.jsx("span",{className:"flex-1 truncate",children:lt}),xt&&d.jsx("button",{type:"button",onClick:yt,className:"rounded border border-critical/40 px-2 py-0.5 text-[11px] font-medium text-critical hover:bg-critical/10",children:"Reconnect"})]}),d.jsxs("form",{onSubmit:fe,className:"flex items-end gap-2",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx("textarea",{ref:b,className:"min-h-[44px] w-full resize-none rounded-md border border-border bg-surface-raised px-3 py-2 pr-16 text-sm text-ink placeholder:text-ink-dim focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20",placeholder:h?"Waiting for answer…":"Ask AMX…",value:f,disabled:!!h,onChange:A=>c(A.target.value),onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),fe(A))},rows:1}),!h&&d.jsxs("span",{className:"pointer-events-none absolute bottom-1.5 right-2 inline-flex items-center gap-1 text-[10px] text-ink-dim","aria-hidden":"true",children:[d.jsx("kbd",{className:"inline-flex h-4 min-w-[1rem] items-center justify-center rounded border border-border bg-surface-subtle px-1 font-mono text-[10px] text-ink-muted",children:"↵"}),"send"]})]}),h?d.jsx("button",{type:"button",onClick:Me,className:"inline-flex h-10 items-center gap-1.5 rounded-md bg-critical/10 px-3 text-sm font-medium text-critical hover:bg-critical/20",children:"Cancel"}):d.jsxs("button",{type:"submit",disabled:!f.trim(),className:"inline-flex h-10 items-center gap-1.5 rounded-md bg-accent px-4 text-sm font-medium text-accent-soft transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",children:[d.jsx(El,{size:14}),"Ask"]})]})]})]})}function Vr({role:e,children:t,pulsing:n}){return d.jsx("div",{className:J("flex",e==="user"?"justify-end":"justify-start"),children:d.jsx("div",{className:J("break-words rounded-2xl px-4 py-2.5 text-sm shadow-sm",e==="user"?"max-w-2xl bg-accent text-accent-soft":"min-w-0 max-w-[min(56rem,calc(100%-1rem))] bg-surface-subtle text-ink",n&&"animate-pulse"),children:typeof t=="string"?d.jsx("p",{className:"whitespace-pre-wrap leading-relaxed",children:t}):t})})}function Wr({text:e}){return d.jsx("div",{className:"markdown-body text-sm leading-relaxed",children:d.jsx(oc,{remarkPlugins:[bp],components:{p:({children:t})=>d.jsx("p",{className:"mb-2 last:mb-0",children:t}),ul:({children:t})=>d.jsx("ul",{className:"mb-2 ml-5 list-disc space-y-0.5 last:mb-0",children:t}),ol:({children:t})=>d.jsx("ol",{className:"mb-2 ml-5 list-decimal space-y-0.5 last:mb-0",children:t}),li:({children:t})=>d.jsx("li",{className:"leading-relaxed",children:t}),h1:({children:t})=>d.jsx("h1",{className:"mb-2 mt-3 text-base font-semibold first:mt-0",children:t}),h2:({children:t})=>d.jsx("h2",{className:"mb-2 mt-3 text-sm font-semibold first:mt-0",children:t}),h3:({children:t})=>d.jsx("h3",{className:"mb-1.5 mt-2 text-sm font-semibold first:mt-0",children:t}),strong:({children:t})=>d.jsx("strong",{className:"font-semibold text-ink",children:t}),em:({children:t})=>d.jsx("em",{className:"italic",children:t}),code:({children:t,className:n})=>n?.startsWith("language-")?d.jsx("code",{className:J("font-mono text-[12px]",n),children:t}):d.jsx("code",{className:"rounded bg-surface-subtle px-1 py-0.5 font-mono text-[12px] text-ink",children:t}),pre:({children:t})=>d.jsx("pre",{className:"mb-2 overflow-x-auto rounded-md bg-surface-subtle p-3 text-[12px] last:mb-0",children:t}),a:({href:t,children:n})=>d.jsx("a",{href:t,target:"_blank",rel:"noreferrer noopener",className:"text-accent underline underline-offset-2 hover:opacity-80",children:n}),blockquote:({children:t})=>d.jsx("blockquote",{className:"mb-2 border-l-2 border-accent/50 pl-3 italic text-ink-muted last:mb-0",children:t}),hr:()=>d.jsx("hr",{className:"my-3 border-surface-border"}),table:({children:t})=>d.jsx("div",{className:"mb-2 overflow-x-auto last:mb-0",children:d.jsx("table",{className:"min-w-full border-collapse text-[12px]",children:t})}),thead:({children:t})=>d.jsx("thead",{className:"bg-surface-subtle text-left",children:t}),tbody:({children:t})=>d.jsx("tbody",{className:"divide-y divide-surface-border",children:t}),tr:({children:t})=>d.jsx("tr",{children:t}),th:({children:t})=>d.jsx("th",{className:"border border-surface-border px-2 py-1 font-semibold",children:t}),td:({children:t})=>d.jsx("td",{className:"border border-surface-border px-2 py-1 align-top",children:t})},children:e})})}function jp({text:e}){const t=B.useRef(null);return B.useLayoutEffect(()=>{const n=t.current;n&&(n.scrollTop=n.scrollHeight)},[e]),d.jsxs("div",{className:"space-y-1",children:[d.jsxs("div",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wider text-ink-dim",children:["Thinking",d.jsx(yl,{text:"The model's reasoning preview — not the final answer, just its thought steps."})]}),d.jsx("div",{ref:t,className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words text-sm text-ink-muted",children:e})]})}function Np({jobStartedAt:e,tick:t,hasThinking:n,hasActivity:r,pendingActivity:i,hasStreamingAnswer:o,llmModel:l,llmRound:s}){const a=e!=null?Math.max(0,(Date.now()-e)/1e3):0,u=a>=10?`${a.toFixed(0)}s`:`${a.toFixed(1)}s`,f=s&&s.status==="active";let c;if(o)c="Writing answer";else if(i)c="Running tool";else if(r&&!f)c="Picking next step";else if(f){const h=s.phase==="picking-tools"?"picking tools":s.phase==="synthesising"?"synthesising answer":s.phase||"thinking";c=`${l?l.split("/").slice(-1)[0]:"LLM"} round ${s.round||"?"} — ${h}`}else n?c="Reasoning":c=l?`Talking to ${l}`:"Talking to LLM";return d.jsxs("div",{"aria-live":"polite",className:"mb-2 flex items-center gap-2 text-xs text-ink-muted",children:[d.jsx("span",{"aria-hidden":!0,className:"inline-block h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-accent"}),d.jsxs("span",{className:"font-medium text-ink",children:[c,"…"]}),d.jsx("span",{className:"ml-auto font-mono text-ink-dim",children:u})]})}function Ip({rows:e}){return e.length===0?null:d.jsx("div",{"aria-live":"polite","aria-atomic":"false",className:"mb-2 flex flex-col gap-1.5 rounded-lg border border-surface-border bg-surface-subtle/40 p-2",children:e.map(t=>{const n=t.phase==="pending",r=t.source,i=r==="live"||r==="live_cache"||r==="mixed"||n&&t.sourceHint==="live",o=r==="blocked_cache_only",l=o?"Blocked":n?i?"Live query":"Reading cache":i?"Live query":"Cache hit",s=o?"bg-critical":n?i?"bg-warning":"bg-accent":i?"bg-warning":"bg-success",a=typeof t.elapsedMs=="number"?t.elapsedMs>=1e3?`${(t.elapsedMs/1e3).toFixed(1)} s`:`${t.elapsedMs} ms`:null;return d.jsxs("div",{className:"flex items-start gap-2 text-xs text-ink-muted",children:[d.jsx("span",{"aria-hidden":!0,className:J("mt-1.5 inline-block h-1.5 w-1.5 shrink-0 rounded-full",s,n&&"animate-pulse")}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[d.jsxs("span",{className:J("font-medium",o?"text-critical":n?"text-ink":i?"text-warning":"text-success"),children:[n?"⟳":o?"⨯":"✓"," ",l]}),d.jsx("span",{className:"font-mono text-ink-muted",children:t.name}),t.scopeProfiles&&t.scopeProfiles.length>0&&d.jsxs("span",{className:"text-ink-dim",children:["on ",t.scopeProfiles.join(", ")]}),a&&d.jsx("span",{className:"ml-auto text-ink-dim",children:a})]}),t.arguments&&t.arguments!=="{}"&&d.jsx("pre",{className:"mt-0.5 max-w-full overflow-x-hidden whitespace-pre-wrap break-all text-[10px] text-ink-dim",children:t.arguments})]})]},t.key)})})}function Qr({calls:e,live:t}){return d.jsxs("details",{className:J("mt-3",t&&""),open:t,children:[d.jsxs("summary",{className:"flex cursor-pointer items-center gap-1.5 text-[11px] font-medium uppercase tracking-wider text-ink-dim",children:[d.jsx(jl,{size:12})," ",e.length," tool call",e.length===1?"":"s"]}),d.jsx("ul",{className:"mt-2 space-y-1 text-xs",children:e.map((n,r)=>{const i=n,o=i.name==="search_docs"||i.name==="search_code",l=Array.isArray(i.citations)?i.citations:[];return o&&l.length>0?d.jsxs("li",{className:"rounded-md bg-surface px-2 py-1 text-[11px] text-ink-muted",children:[d.jsxs("div",{className:"font-mono",children:[d.jsx("span",{className:"text-accent",children:i.name}),"(",d.jsx("span",{className:"text-ink-dim",children:i.arguments}),") →"," ",l.length," hit",l.length===1?"":"s"]}),d.jsx("ul",{className:"mt-1 space-y-0.5 pl-3 font-mono text-[10.5px] text-ink-dim",children:l.map((s,a)=>{const u=ll(s);return d.jsxs("li",{children:["• ",d.jsx("span",{className:"text-ink-muted",children:u})," ",d.jsxs("span",{className:"opacity-70",children:["— score ",s.score.toFixed(2)]})]},`${s.source}-${s.chunk_idx}-${a}`)})})]},r):d.jsxs("li",{className:"rounded-md bg-surface px-2 py-1 font-mono text-[11px] text-ink-muted",children:[d.jsx("span",{className:"text-accent",children:i.name}),"(",d.jsx("span",{className:"text-ink-dim",children:i.arguments}),") → ",i.result_preview]},r)})})]})}function Lp({message:e,hint:t,onDismiss:n}){const r=t==="configure-llm";return d.jsxs("div",{role:"alert",className:J("flex flex-col gap-2 rounded-md border px-3 py-2.5 text-xs",r?"border-warning/40 bg-warning-soft/40 text-warning-ink":"border-critical/30 bg-critical/5 text-critical"),children:[d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx(Tt,{size:14,className:J("mt-0.5 flex-none",r?"text-warning":"text-critical"),"aria-hidden":"true"}),d.jsx("div",{className:"min-w-0 flex-1",children:r?d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"font-semibold text-ink",children:"Couldn't reach the LLM."}),d.jsx("p",{className:"mt-0.5 text-ink-muted",children:"Check your provider settings — most likely an unset API key, a wrong model id, or a network block."}),d.jsx("p",{className:"mt-1 text-ink-dim/80",children:d.jsx("span",{className:"font-mono text-[10px]",children:e})})]}):d.jsx("p",{className:"text-ink",children:e})}),d.jsx("button",{type:"button",onClick:n,"aria-label":"Dismiss",className:"ml-2 flex-none text-ink-dim hover:text-ink",children:"×"})]}),r&&d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(an,{to:"/settings?tab=llm",className:"inline-flex h-7 items-center gap-1.5 rounded-md bg-accent px-3 text-[11px] font-medium text-accent-soft transition hover:opacity-90",children:[d.jsx(Tt,{size:12}),"Open LLM settings"]}),d.jsx(an,{to:"/system",className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-border px-3 text-[11px] text-ink-muted hover:border-accent/40 hover:text-ink",children:"Run doctor"})]})]})}function Tp({scopeProfiles:e,focusProfile:t,totalLatencyMs:n}){const r=[];if(e&&e.length&&r.push(`${e.length} profile${e.length===1?"":"s"}`),typeof n=="number"&&n>0){const i=n/1e3;r.push(`${i.toFixed(i<10?1:0)}s`)}return t&&r.push(`focus: ${t}`),r.length===0?null:d.jsx("div",{className:"mt-2 text-[10.5px] italic text-ink-dim",children:r.join(" · ")})}function Kr({citations:e}){return e.length===0?null:d.jsxs("div",{className:"mt-2 space-y-1 rounded-md border border-border bg-surface-subtle/20 px-2.5 py-1.5 text-xs text-ink-muted",children:[d.jsx("div",{className:"text-[10px] uppercase tracking-wider text-ink-dim",children:"Sources"}),e.map((t,n)=>{const r=ll(t);return d.jsxs("div",{children:[d.jsxs("div",{className:"font-mono",children:[d.jsx("span",{className:"text-ink",children:r}),d.jsxs("span",{className:"ml-2 text-ink-dim",children:["score ",t.score.toFixed(2)]})]}),t.snippet&&d.jsxs("div",{className:"ml-3 mt-0.5 italic text-ink-dim line-clamp-2",children:["“",t.snippet,"…”"]})]},`${t.source}-${t.chunk_idx}-${n}`)})]})}function Pp(e){const t=[];for(const n of e)if(n.role==="user"&&n.question)t.push({role:"user",content:n.question});else if(n.role==="assistant"){if(n.intent==="cancelled"){t.push({role:"assistant",content:"",cancelled:!0});continue}n.answer_summary&&t.push({role:"assistant",content:n.answer_summary})}return t}function Bp(){const e=fl(),t=pl(),[n,r]=B.useState(null),[i,o]=B.useState(null),[l,s]=B.useState(0),[a,u]=B.useState(null),[f,c]=B.useState(null),[h,p]=B.useState(null),[m,k]=B.useState(null);B.useEffect(()=>{const j=t.state?.seedPrompt;j&&(r(null),o([]),u(j),s(N=>N+1),c(null),window.history.replaceState({},""))},[t.state]);const C=et({queryKey:["context"],queryFn:()=>Zr.context()}),y=!!(C.data?.llm_provider&&C.data?.llm_model&&C.data?.active_llm_profile),v=et({queryKey:["ask-sessions"],queryFn:()=>Ce("/api/ask/sessions"),retry:!1,staleTime:0});async function E(j){c(null),p(j),r(j),o([]),s(N=>N+1);try{const N=await Ce(`/api/ask/sessions/${j}`);o(Pp(N.turns??[])),s(D=>D+1)}catch(N){c(N instanceof Error?N.message:"Failed to load session.")}finally{p(null)}}function P(){r(null),o([]),s(j=>j+1),c(null)}function O(j){j!=null&&j!==n&&r(j),e.invalidateQueries({queryKey:["ask-sessions"]})}const S=Xr(),R=sn({mutationFn:j=>Ce(`/api/ask/sessions/${j}`,{method:"DELETE"}),onMutate:async j=>{await e.cancelQueries({queryKey:["ask-sessions"]});const N=e.getQueryData(["ask-sessions"]);return N&&e.setQueryData(["ask-sessions"],{...N,sessions:N.sessions.filter(D=>D.id!==j)}),{snapshot:N}},onSuccess:(j,N)=>{n===N&&(r(null),o([]),s(D=>D+1)),S.push({title:"Session deleted",tone:"info",duration:2200})},onError:(j,N,D)=>{D?.snapshot&&e.setQueryData(["ask-sessions"],D.snapshot),S.push({title:"Could not delete session",description:j.message,tone:"error"})},onSettled:()=>{e.invalidateQueries({queryKey:["ask-sessions"]})},meta:{silentError:!0}}),Q=m==null?null:v.data?.sessions.find(j=>j.id===m)??null,q=sn({mutationFn:j=>Ce(`/api/ask/sessions/${j}/end`,{method:"POST"}),onMutate:async j=>{await e.cancelQueries({queryKey:["ask-sessions"]});const N=e.getQueryData(["ask-sessions"]);if(N){const D=Math.floor(Date.now()/1e3);e.setQueryData(["ask-sessions"],{...N,sessions:N.sessions.map(V=>V.id===j?{...V,ended_at:V.ended_at??D}:V)})}return{snapshot:N}},onSuccess:()=>{S.push({title:"Session ended",tone:"info",duration:2200})},onError:(j,N,D)=>{D?.snapshot&&e.setQueryData(["ask-sessions"],D.snapshot),S.push({title:"Could not end session",description:j.message,tone:"error"})},onSettled:()=>{e.invalidateQueries({queryKey:["ask-sessions"]})},meta:{silentError:!0}}),b=n==null&&(i==null||i.length===0);return d.jsxs(d.Fragment,{children:[d.jsx(hl,{title:"Ask",breadcrumbs:[{label:"Ask"}]}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-[18rem_minmax(0,1fr)] [&>*]:min-w-0",children:[d.jsxs(Pt,{children:[d.jsx(wl,{title:"Sessions",actions:d.jsxs("button",{type:"button",onClick:P,disabled:b,"aria-disabled":b,title:b?"You're already on a new session":"Start a fresh session",className:J("inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium transition-colors duration-fast",b?"cursor-default border-transparent bg-transparent text-ink-dim/60":"border-border bg-surface text-ink-muted hover:border-accent/40 hover:text-ink"),children:[d.jsx(kl,{size:12})," New"]})}),d.jsxs(cn,{className:"max-h-[60vh] overflow-y-auto p-0",children:[v.isLoading?d.jsx("ul",{className:"divide-y divide-border",children:Array.from({length:4}).map((j,N)=>d.jsxs("li",{className:"px-4 py-3 space-y-1.5",children:[d.jsx(Ct,{className:"h-3 w-2/3"}),d.jsx(Ct,{className:"h-3 w-full"})]},N))}):v.data?.sessions?.length?d.jsx("ul",{className:"divide-y divide-surface-border",children:v.data.sessions.map(j=>{const N=j.id===n,D=j.id===h,V=j.ended_at==null;return d.jsxs("li",{"aria-current":N?"true":void 0,className:J("group flex items-stretch transition hover:bg-surface-subtle/60",N&&"bg-surface-subtle",V&&"border-l-2 border-positive",N&&"border-l-2 border-accent"),children:[d.jsxs("button",{type:"button",onClick:()=>E(j.id),disabled:D,className:J("flex-1 px-4 py-3 text-left text-sm focus:outline-none",D&&"opacity-60"),children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsx("span",{className:"truncate font-medium",children:j.title||`Session #${j.id}`}),d.jsxs("span",{className:"font-mono text-[10px] text-ink-dim",children:["#",j.id]})]}),j.first_question&&d.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-ink-muted",children:j.first_question})]}),V&&d.jsx(Yn,{content:"End session — next /ask starts a new one",children:d.jsx("button",{type:"button",onClick:$=>{$.stopPropagation(),q.mutate(j.id)},disabled:q.isPending,"aria-label":"End session",className:"px-2 text-ink-dim opacity-0 transition-colors duration-fast hover:bg-warning-soft hover:text-warning group-hover:opacity-100 disabled:opacity-50",children:d.jsx(fn,{size:14})})}),d.jsx(Yn,{content:"Delete session permanently",children:d.jsx("button",{type:"button",onClick:$=>{$.stopPropagation(),k(j.id)},disabled:R.isPending,"aria-label":"Delete session",className:"px-2 text-ink-dim opacity-0 transition-colors duration-fast hover:bg-critical/10 hover:text-critical group-hover:opacity-100 disabled:opacity-50",children:d.jsx(bl,{size:14})})})]},j.id)})}):d.jsxs("div",{className:"flex flex-col items-center px-5 py-10 text-center text-ink-dim",children:[d.jsx(Gr,{size:20,className:"mb-2 opacity-60"}),d.jsx("p",{className:"text-sm",children:"No sessions yet."}),d.jsx("p",{className:"mt-1 text-xs text-ink-dim",children:"Ask a question to start your first one."})]}),f&&d.jsx("div",{className:"border-t border-surface-border px-4 py-2 text-[11px] text-critical",children:f})]})]}),C.isLoading?d.jsx(Pt,{children:d.jsxs(cn,{className:"space-y-2 px-6 py-8",children:[d.jsx(Ct,{className:"h-3 w-1/3"}),d.jsx(Ct,{className:"h-3 w-2/3"})]})}):y?d.jsx(Ap,{selectedSessionId:n,seedTurns:i,seedToken:l,seedSubmit:a,loadingSession:h===n&&n!=null,onSeedSubmitConsumed:()=>u(null),onSessionAssigned:O,onResumeStale:()=>{n!=null?E(n):e.invalidateQueries({queryKey:["ask-sessions"]})}}):d.jsx(_p,{title:"Configure an LLM before asking",description:C.data?.llm_provider?"The active LLM profile has no model selected — Studio needs both a provider and a model to answer.":"No LLM profile is active yet. Add one in Settings → LLM and Studio will route questions through it."})]}),d.jsx(Sl,{open:m!==null,onClose:()=>{R.isPending||k(null)},onConfirm:()=>{if(m!=null){const j=m;R.mutate(j,{onSettled:()=>k(N=>N===j?null:N)})}},title:Q?`Delete '${Q.title||`Session #${Q.id}`}'?`:"Delete session?",description:"Drops every turn under this session from the local history database. Run logs and apply rows the session produced stay intact — only the chat record is removed.",confirmLabel:"Delete",loading:R.isPending})]})}function _p({title:e,description:t}){return d.jsx(Pt,{children:d.jsx(cn,{className:"px-6 py-8",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(Tt,{size:18,className:"mt-0.5 flex-none text-warning"}),d.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[d.jsx("p",{className:"text-sm font-semibold text-ink",children:e}),d.jsx("p",{className:"text-sm text-ink-muted",children:t}),d.jsxs(an,{to:"/settings?tab=llm",className:"mt-2 inline-flex h-8 items-center gap-1.5 rounded-md bg-accent px-3 text-xs font-medium text-accent-soft transition hover:opacity-90",children:[d.jsx(Tt,{size:12}),"Open LLM settings"]})]})]})})})}export{Bp as default};
