@nextclaw/ui 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/assets/{ChannelsList-CkCpHSto.js → ChannelsList-Bga6n85j.js} +1 -1
- package/dist/assets/ChatPage-B-Yk3kkv.js +32 -0
- package/dist/assets/{DocBrowser-B5Aqiz6W.js → DocBrowser-dv57PRp5.js} +1 -1
- package/dist/assets/{MarketplacePage-BIi0bBdW.js → MarketplacePage-j6p73Hjo.js} +1 -1
- package/dist/assets/{ModelConfig-BTFiEAxQ.js → ModelConfig-BiKSDp5h.js} +1 -1
- package/dist/assets/{ProvidersList-cdk1d-G_.js → ProvidersList-B7ZfRUkD.js} +1 -1
- package/dist/assets/{RuntimeConfig-CFqFsXmR.js → RuntimeConfig-Bpt9UNb6.js} +1 -1
- package/dist/assets/{SecretsConfig-CIKasCek.js → SecretsConfig-Ds00G-_O.js} +2 -2
- package/dist/assets/{SessionsConfig-mnCLFtbo.js → SessionsConfig-Mjet4opU.js} +1 -1
- package/dist/assets/{card-C1BUfR85.js → card-C7JJ5BGA.js} +1 -1
- package/dist/assets/index-BiJ2xs5X.css +1 -0
- package/dist/assets/{index-Dxas8MJ9.js → index-Cb9xiqC5.js} +2 -2
- package/dist/assets/{label-CwWfYbuj.js → label-DHJKdaUl.js} +1 -1
- package/dist/assets/{logos-DDyjHSEU.js → logos-fPO_amyL.js} +1 -1
- package/dist/assets/{page-layout-DKTRKcHL.js → page-layout-CF0JQsWW.js} +1 -1
- package/dist/assets/{switch-Bi3yeYiC.js → switch-C1hgy-fE.js} +1 -1
- package/dist/assets/{tabs-custom-HZFNZrc0.js → tabs-custom-OyoLf5ZM.js} +1 -1
- package/dist/assets/useConfig-D_G46zbo.js +6 -0
- package/dist/assets/{useConfirmDialog-DwD21HlD.js → useConfirmDialog-_0u6i3cI.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/api/config.ts +77 -12
- package/src/api/types.ts +24 -0
- package/src/components/chat/ChatConversationPanel.tsx +5 -20
- package/src/components/chat/ChatPage.tsx +49 -8
- package/src/components/chat/useChatStreamController.ts +192 -115
- package/src/hooks/useConfig.ts +29 -0
- package/src/hooks/useWebSocket.ts +21 -0
- package/dist/assets/ChatPage-DM4XNsrW.js +0 -32
- package/dist/assets/index-P4YzN9iS.css +0 -1
- package/dist/assets/useConfig-CgzVQTZl.js +0 -6
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import{r as P,j as d,X as Dl,Y as Sn,A as Cn,B as vn,N as un,Z as Ll,q as Ol,s as zl,u as Fl,_ as Jr,a0 as _l,a1 as Zr,a2 as En,a3 as Ml,a4 as Bl,a5 as ql,a6 as $l,a7 as Hl,a8 as Ul,a9 as Vl,aa as Kl,ab as ei,ac as ti,ad as tt,ae as ni,af as ri,ag as Wl,ah as Ql,ai as Xl,aj as Yl,ak as Gl,al as Jl,am as Zl,an as es,ao as ts,ap as ns,aq as rs,g as is,ar as ls,as as ss,m as as,at as os,au as Wn,av as us,M as cs,aw as ii,ax as fs,ay as hs,az as ps,w as ds,aA as ms,aB as gs}from"./vendor-Ylg6Wdt_.js";import{I as Nn,d as xs,e as ys,f as bs,g as ks,s as ws,h as Ss,u as Cs,a as vs,i as Es,j as Ns,k as As,l as Is}from"./useConfig-CgzVQTZl.js";import{T as Qn,a as Xn,b as Yn,c as Gn,u as Ts,M as js}from"./MarketplacePage-BIi0bBdW.js";import{P as li,u as si}from"./useConfirmDialog-DwD21HlD.js";import{B as Se,P as Ps,a as Rs}from"./page-layout-DKTRKcHL.js";import{u as ai,f as Ds,t as A,T as Jn,L as Zn,c as re,g as Pt,S as Et,a as Nt,d as At,e as Ue,b as oi}from"./index-Dxas8MJ9.js";import{b as Ls,n as Os,e as zs,a as Fs,c as _s}from"./chat-message-pw9oafI4.js";import{C as Ms,a as Bs}from"./card-C1BUfR85.js";import{b as qs,c as $s}from"./provider-models-y4mUDcGF.js";import"./tabs-custom-HZFNZrc0.js";function Hs(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=n-864e5,i=n-7*864e5,s=[],l=[],a=[],u=[];for(const f of e){const c=new Date(f.updatedAt).getTime();c>=n?s.push(f):c>=r?l.push(f):c>=i?a.push(f):u.push(f)}const o=[];return s.length>0&&o.push({label:A("chatSidebarToday"),sessions:s}),l.length>0&&o.push({label:A("chatSidebarYesterday"),sessions:l}),a.length>0&&o.push({label:A("chatSidebarPrevious7Days"),sessions:a}),u.length>0&&o.push({label:A("chatSidebarOlder"),sessions:u}),o}const Us=[{target:"/cron",label:()=>A("chatSidebarScheduledTasks"),icon:Cn},{target:"/skills",label:()=>A("chatSidebarSkills"),icon:vn}];function Vs(e){var o,f;const{language:t,setLanguage:n}=ai(),{theme:r,setTheme:i}=Ds(),s=A(((o=Jn.find(c=>c.value===r))==null?void 0:o.labelKey)??"themeWarm"),l=((f=Zn.find(c=>c.value===t))==null?void 0:f.label)??t,a=P.useMemo(()=>Hs(e.sessions),[e.sessions]),u=c=>{t!==c&&(n(c),window.location.reload())};return d.jsxs("aside",{className:"w-[280px] shrink-0 flex flex-col h-full bg-secondary border-r border-gray-200/60",children:[d.jsx("div",{className:"px-5 pt-5 pb-3",children:d.jsxs("div",{className:"flex items-center gap-2.5",children:[d.jsx("div",{className:"h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center",children:d.jsx("img",{src:"/logo.svg",alt:"NextClaw",className:"h-full w-full object-contain"})}),d.jsx("span",{className:"text-[15px] font-semibold text-gray-800 tracking-[-0.01em]",children:"NextClaw"})]})}),d.jsx("div",{className:"px-4 pb-3",children:d.jsxs(Se,{variant:"primary",className:"w-full rounded-xl",onClick:e.onCreateSession,children:[d.jsx(Dl,{className:"h-4 w-4 mr-2"}),A("chatSidebarNewTask")]})}),d.jsx("div",{className:"px-4 pb-3",children:d.jsxs("div",{className:"relative",children:[d.jsx(Sn,{className:"h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400"}),d.jsx(Nn,{value:e.query,onChange:c=>e.onQueryChange(c.target.value),placeholder:A("chatSidebarSearchPlaceholder"),className:"pl-8 h-9 rounded-lg text-xs"})]})}),d.jsx("div",{className:"px-3 pb-2",children:d.jsx("ul",{className:"space-y-0.5",children:Us.map(c=>{const h=c.icon;return d.jsx("li",{children:d.jsx(un,{to:c.target,className:({isActive:p})=>re("group w-full flex items-center gap-3 px-3 py-2 rounded-xl text-[13px] font-medium transition-all duration-150",p?"bg-gray-200 text-gray-900 font-semibold shadow-sm":"text-gray-600 hover:bg-gray-200/60 hover:text-gray-900"),children:({isActive:p})=>d.jsxs(d.Fragment,{children:[d.jsx(h,{className:re("h-4 w-4 transition-colors",p?"text-gray-900":"text-gray-500 group-hover:text-gray-800")}),d.jsx("span",{children:c.label()})]})})},c.target)})})}),d.jsx("div",{className:"mx-4 border-t border-gray-200/60"}),d.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar px-3 py-2",children:e.isLoading?d.jsx("div",{className:"text-xs text-gray-500 p-3",children:A("sessionsLoading")}):a.length===0?d.jsxs("div",{className:"p-4 text-center",children:[d.jsx(Ll,{className:"h-6 w-6 mx-auto mb-2 text-gray-300"}),d.jsx("div",{className:"text-xs text-gray-500",children:A("sessionsEmpty")})]}):d.jsx("div",{className:"space-y-3",children:a.map(c=>d.jsxs("div",{children:[d.jsx("div",{className:"px-2 py-1 text-[11px] font-medium text-gray-400 uppercase tracking-wider",children:c.label}),d.jsx("div",{className:"space-y-0.5",children:c.sessions.map(h=>{const p=e.selectedSessionKey===h.key;return d.jsxs("button",{onClick:()=>e.onSelectSession(h.key),className:re("w-full rounded-xl px-3 py-2 text-left transition-all text-[13px]",p?"bg-gray-200 text-gray-900 font-semibold shadow-sm":"text-gray-700 hover:bg-gray-200/60 hover:text-gray-900"),children:[d.jsx("div",{className:"truncate font-medium",children:e.sessionTitle(h)}),d.jsxs("div",{className:"mt-0.5 text-[11px] text-gray-400 truncate",children:[h.messageCount," · ",Pt(h.updatedAt)]})]},h.key)})})]},c.label))})}),d.jsxs("div",{className:"px-3 py-3 border-t border-gray-200/60 space-y-0.5",children:[d.jsx(un,{to:"/settings",className:({isActive:c})=>re("group w-full flex items-center gap-2.5 px-3 py-2 rounded-xl text-[13px] font-medium transition-all duration-150",c?"bg-gray-200 text-gray-900 font-semibold shadow-sm":"text-gray-600 hover:bg-gray-200/60 hover:text-gray-900"),children:({isActive:c})=>d.jsxs(d.Fragment,{children:[d.jsx(Ol,{className:re("h-4 w-4 transition-colors",c?"text-gray-900":"text-gray-500 group-hover:text-gray-800")}),d.jsx("span",{children:A("settings")})]})}),d.jsxs(Et,{value:r,onValueChange:c=>i(c),children:[d.jsxs(Nt,{className:"w-full h-auto rounded-xl border-0 bg-transparent shadow-none px-3 py-2 text-[13px] font-medium text-gray-600 hover:bg-gray-200/60 focus:ring-0",children:[d.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[d.jsx(zl,{className:"h-4 w-4 text-gray-400"}),d.jsx("span",{children:A("theme")})]}),d.jsx("span",{className:"ml-auto text-[11px] text-gray-500",children:s})]}),d.jsx(At,{children:Jn.map(c=>d.jsx(Ue,{value:c.value,className:"text-xs",children:A(c.labelKey)},c.value))})]}),d.jsxs(Et,{value:t,onValueChange:c=>u(c),children:[d.jsxs(Nt,{className:"w-full h-auto rounded-xl border-0 bg-transparent shadow-none px-3 py-2 text-[13px] font-medium text-gray-600 hover:bg-gray-200/60 focus:ring-0",children:[d.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[d.jsx(Fl,{className:"h-4 w-4 text-gray-400"}),d.jsx("span",{children:A("language")})]}),d.jsx("span",{className:"ml-auto text-[11px] text-gray-500",children:l})]}),d.jsx(At,{children:Zn.map(c=>d.jsx(Ue,{value:c.value,className:"text-xs",children:c.label},c.value))})]})]})]})}function Ks(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Ws=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Qs=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xs={};function er(e,t){return(Xs.jsx?Qs:Ws).test(e)}const Ys=/[ \t\n\f\r]/g;function Gs(e){return typeof e=="object"?e.type==="text"?tr(e.value):!1:tr(e)}function tr(e){return e.replace(Ys,"")===""}class ot{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ot.prototype.normal={};ot.prototype.property={};ot.prototype.space=void 0;function ui(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new ot(n,r,t)}function cn(e){return e.toLowerCase()}class he{constructor(t,n){this.attribute=n,this.property=t}}he.prototype.attribute="";he.prototype.booleanish=!1;he.prototype.boolean=!1;he.prototype.commaOrSpaceSeparated=!1;he.prototype.commaSeparated=!1;he.prototype.defined=!1;he.prototype.mustUseProperty=!1;he.prototype.number=!1;he.prototype.overloadedBoolean=!1;he.prototype.property="";he.prototype.spaceSeparated=!1;he.prototype.space=void 0;let Js=0;const U=Me(),ee=Me(),fn=Me(),I=Me(),Y=Me(),Ve=Me(),de=Me();function Me(){return 2**++Js}const hn=Object.freeze(Object.defineProperty({__proto__:null,boolean:U,booleanish:ee,commaOrSpaceSeparated:de,commaSeparated:Ve,number:I,overloadedBoolean:fn,spaceSeparated:Y},Symbol.toStringTag,{value:"Module"})),Ht=Object.keys(hn);class An extends he{constructor(t,n,r,i){let s=-1;if(super(t,n),nr(this,"space",i),typeof r=="number")for(;++s<Ht.length;){const l=Ht[s];nr(this,Ht[s],(r&hn[l])===hn[l])}}}An.prototype.defined=!0;function nr(e,t,n){n&&(e[t]=n)}function Qe(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new An(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[cn(r)]=r,n[cn(s.attribute)]=r}return new ot(t,n,e.space)}const ci=Qe({properties:{ariaActiveDescendant:null,ariaAtomic:ee,ariaAutoComplete:null,ariaBusy:ee,ariaChecked:ee,ariaColCount:I,ariaColIndex:I,ariaColSpan:I,ariaControls:Y,ariaCurrent:null,ariaDescribedBy:Y,ariaDetails:null,ariaDisabled:ee,ariaDropEffect:Y,ariaErrorMessage:null,ariaExpanded:ee,ariaFlowTo:Y,ariaGrabbed:ee,ariaHasPopup:null,ariaHidden:ee,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Y,ariaLevel:I,ariaLive:null,ariaModal:ee,ariaMultiLine:ee,ariaMultiSelectable:ee,ariaOrientation:null,ariaOwns:Y,ariaPlaceholder:null,ariaPosInSet:I,ariaPressed:ee,ariaReadOnly:ee,ariaRelevant:null,ariaRequired:ee,ariaRoleDescription:Y,ariaRowCount:I,ariaRowIndex:I,ariaRowSpan:I,ariaSelected:ee,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 fi(e,t){return t in e?e[t]:t}function hi(e,t){return fi(e,t.toLowerCase())}const Zs=Qe({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ve,acceptCharset:Y,accessKey:Y,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:Y,autoFocus:U,autoPlay:U,blocking:Y,capture:null,charSet:null,checked:U,cite:null,className:Y,cols:I,colSpan:null,content:null,contentEditable:ee,controls:U,controlsList:Y,coords:I|Ve,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:fn,draggable:ee,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:Y,height:I,hidden:fn,high:I,href:null,hrefLang:null,htmlFor:Y,httpEquiv:Y,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:Y,itemRef:Y,itemScope:U,itemType:Y,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:I,manifest:null,max:null,maxLength:I,media:null,method:null,min:null,minLength:I,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,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:U,optimum:I,pattern:null,ping:Y,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:Y,required:U,reversed:U,rows:I,rowSpan:I,sandbox:Y,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:I,sizes:null,slot:null,span:I,spellCheck:ee,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:U,useMap:null,value:ee,width:I,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Y,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:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:I,leftMargin:I,link:null,longDesc:null,lowSrc:null,marginHeight:I,marginWidth:I,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:I,rules:null,scheme:null,scrolling:ee,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:U,disableRemotePlayback:U,prefix:null,property:null,results:I,security:null,unselectable:null},space:"html",transform:hi}),ea=Qe({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:de,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:Y,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:I,diffuseConstant:I,direction:null,display:null,dur:null,divisor:I,dominantBaseline:null,download:U,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:Ve,g2:Ve,glyphName:Ve,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:de,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:Y,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:I,pointsAtY:I,pointsAtZ:I,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:de,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:de,rev:de,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:de,requiredFeatures:de,requiredFonts:de,requiredFormats:de,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:de,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:de,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:de,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:fi}),pi=Qe({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()}}),di=Qe({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hi}),mi=Qe({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),ta={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"},na=/[A-Z]/g,rr=/-[a-z]/g,ra=/^data[-\w.:]+$/i;function ia(e,t){const n=cn(t);let r=t,i=he;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ra.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(rr,sa);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!rr.test(s)){let l=s.replace(na,la);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=An}return new i(r,t)}function la(e){return"-"+e.toLowerCase()}function sa(e){return e.charAt(1).toUpperCase()}const aa=ui([ci,Zs,pi,di,mi],"html"),In=ui([ci,ea,pi,di,mi],"svg");function oa(e){return e.join(" ").trim()}var qe={},Ut,ir;function ua(){if(ir)return Ut;ir=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,a=/^\s+|\s+$/g,u=`
|
|
2
|
-
`,o="/",f="*",c="",h="comment",p="declaration";function x(S,b){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];b=b||{};var E=1,v=1;function R(F){var j=F.match(t);j&&(E+=j.length);var V=F.lastIndexOf(u);v=~V?F.length-V:v+F.length}function D(){var F={line:E,column:v};return function(j){return j.position=new k(F),q(),j}}function k(F){this.start=F,this.end={line:E,column:v},this.source=b.source}k.prototype.content=S;function z(F){var j=new Error(b.source+":"+E+":"+v+": "+F);if(j.reason=F,j.filename=b.source,j.line=E,j.column=v,j.source=S,!b.silent)throw j}function M(F){var j=F.exec(S);if(j){var V=j[0];return R(V),S=S.slice(V.length),j}}function q(){M(n)}function w(F){var j;for(F=F||[];j=L();)j!==!1&&F.push(j);return F}function L(){var F=D();if(!(o!=S.charAt(0)||f!=S.charAt(1))){for(var j=2;c!=S.charAt(j)&&(f!=S.charAt(j)||o!=S.charAt(j+1));)++j;if(j+=2,c===S.charAt(j-1))return z("End of comment missing");var V=S.slice(2,j-2);return v+=2,R(V),S=S.slice(j),v+=2,F({type:h,comment:V})}}function N(){var F=D(),j=M(r);if(j){if(L(),!M(i))return z("property missing ':'");var V=M(s),Q=F({type:p,property:y(j[0].replace(e,c)),value:V?y(V[0].replace(e,c)):c});return M(l),Q}}function B(){var F=[];w(F);for(var j;j=N();)j!==!1&&(F.push(j),w(F));return F}return q(),B()}function y(S){return S?S.replace(a,c):c}return Ut=x,Ut}var lr;function ca(){if(lr)return qe;lr=1;var e=qe&&qe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(qe,"__esModule",{value:!0}),qe.default=n;const t=e(ua());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const l=(0,t.default)(r),a=typeof i=="function";return l.forEach(u=>{if(u.type!=="declaration")return;const{property:o,value:f}=u;a?i(o,f,u):f&&(s=s||{},s[o]=f)}),s}return qe}var Ge={},sr;function fa(){if(sr)return Ge;sr=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(o){return!o||n.test(o)||e.test(o)},l=function(o,f){return f.toUpperCase()},a=function(o,f){return"".concat(f,"-")},u=function(o,f){return f===void 0&&(f={}),s(o)?o:(o=o.toLowerCase(),f.reactCompat?o=o.replace(i,a):o=o.replace(r,a),o.replace(t,l))};return Ge.camelCase=u,Ge}var Je,ar;function ha(){if(ar)return Je;ar=1;var e=Je&&Je.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(ca()),n=fa();function r(i,s){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(a,u){a&&u&&(l[(0,n.camelCase)(a,s)]=u)}),l}return r.default=r,Je=r,Je}var pa=ha();const da=Jr(pa),gi=xi("end"),Tn=xi("start");function xi(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 yi(e){const t=Tn(e),n=gi(e);if(t&&n)return{start:t,end:n}}function nt(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?or(e.position):"start"in e||"end"in e?or(e):"line"in e||"column"in e?pn(e):""}function pn(e){return ur(e&&e.line)+":"+ur(e&&e.column)}function or(e){return pn(e&&e.start)+"-"+pn(e&&e.end)}function ur(e){return e&&typeof e=="number"?e:1}class se extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},l=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(l=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=nt(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=l&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}se.prototype.file="";se.prototype.name="";se.prototype.reason="";se.prototype.message="";se.prototype.stack="";se.prototype.column=void 0;se.prototype.line=void 0;se.prototype.ancestors=void 0;se.prototype.cause=void 0;se.prototype.fatal=void 0;se.prototype.place=void 0;se.prototype.ruleId=void 0;se.prototype.source=void 0;const jn={}.hasOwnProperty,ma=new Map,ga=/[A-Z]/g,xa=new Set(["table","tbody","thead","tfoot","tr"]),ya=new Set(["td","th"]),bi="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ba(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=Aa(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=Na(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"?In:aa,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=ki(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function ki(e,t,n){if(t.type==="element")return ka(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return wa(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ca(e,t,n);if(t.type==="mdxjsEsm")return Sa(e,t);if(t.type==="root")return va(e,t,n);if(t.type==="text")return Ea(e,t)}function ka(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=In,e.schema=i),e.ancestors.push(t);const s=Si(e,t.tagName,!1),l=Ia(e,t);let a=Rn(e,t);return xa.has(t.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!Gs(u):!0})),wi(e,l,s,t),Pn(l,a),e.ancestors.pop(),e.schema=r,e.create(t,s,l,n)}function wa(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)}lt(e,t.position)}function Sa(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);lt(e,t.position)}function Ca(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=In,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:Si(e,t.name,!0),l=Ta(e,t),a=Rn(e,t);return wi(e,l,s,t),Pn(l,a),e.ancestors.pop(),e.schema=r,e.create(t,s,l,n)}function va(e,t,n){const r={};return Pn(r,Rn(e,t)),e.create(t,e.Fragment,r,n)}function Ea(e,t){return t.value}function wi(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Pn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Na(e,t,n){return r;function r(i,s,l,a){const o=Array.isArray(l.children)?n:t;return a?o(s,l,a):o(s,l)}}function Aa(e,t){return n;function n(r,i,s,l){const a=Array.isArray(s.children),u=Tn(r);return t(i,s,l,a,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Ia(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&jn.call(t.properties,i)){const s=ja(e,i,t.properties[i]);if(s){const[l,a]=s;e.tableCellAlignToStyle&&l==="align"&&typeof a=="string"&&ya.has(t.tagName)?r=a:n[l]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Ta(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const l=s.expression;l.type;const a=l.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else lt(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else lt(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Rn(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:ma;for(;++r<t.children.length;){const s=t.children[r];let l;if(e.passKeys){const u=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(u){const o=i.get(u)||0;l=u+"-"+o,i.set(u,o+1)}}const a=ki(e,s,l);a!==void 0&&n.push(a)}return n}function ja(e,t,n){const r=ia(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ks(n):oa(n)),r.property==="style"){let i=typeof n=="object"?n:Pa(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Ra(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?ta[r.property]||r.property:r.attribute,n]}}function Pa(e,t){try{return da(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new se("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=bi+"#cannot-parse-style-attribute",i}}function Si(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,l;for(;++s<i.length;){const a=er(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};l=l?{type:"MemberExpression",object:l,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=l}else r=er(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return jn.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);lt(e)}function lt(e,t){const n=new se("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=bi+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Ra(e){const t={};let n;for(n in e)jn.call(e,n)&&(t[Da(n)]=e[n]);return t}function Da(e){let t=e.replace(ga,La);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function La(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"]},Oa={};function Dn(e,t){const n=Oa,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ci(e,r,i)}function Ci(e,t,n){if(za(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 cr(e.children,t,n)}return Array.isArray(e)?cr(e,t,n):""}function cr(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Ci(e[i],t,n);return r.join("")}function za(e){return!!(e&&typeof e=="object")}const fr=document.createElement("i");function Ln(e){const t="&"+e+";";fr.innerHTML=t;const n=fr.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function me(e,t,n,r){const i=e.length;let s=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);s<r.length;)l=r.slice(s,s+1e4),l.unshift(t,0),e.splice(...l),s+=1e4,t+=1e4}function xe(e,t){return e.length>0?(me(e,e.length,0,t),e):t}const hr={}.hasOwnProperty;function vi(e){const t={};let n=-1;for(;++n<e.length;)Fa(t,e[n]);return t}function Fa(e,t){let n;for(n in t){const i=(hr.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let l;if(s)for(l in s){hr.call(i,l)||(i[l]=[]);const a=s[l];_a(i[l],Array.isArray(a)?a:a?[a]:[])}}}function _a(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);me(e,0,0,r)}function Ei(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 ye(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ue=Pe(/[A-Za-z]/),le=Pe(/[\dA-Za-z]/),Ma=Pe(/[#-'*+\--9=?A-Z^-~]/);function It(e){return e!==null&&(e<32||e===127)}const dn=Pe(/\d/),Ba=Pe(/[\dA-Fa-f]/),qa=Pe(/[!-/:-@[-`{-~]/);function _(e){return e!==null&&e<-2}function X(e){return e!==null&&(e<0||e===32)}function K(e){return e===-2||e===-1||e===32}const Rt=Pe(new RegExp("\\p{P}|\\p{S}","u")),_e=Pe(/\s/);function Pe(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Xe(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let l="";if(s===37&&le(e.charCodeAt(n+1))&&le(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(l=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(l=String.fromCharCode(s,a),i=1):l="�"}else l=String.fromCharCode(s);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 s=0;return l;function l(u){return K(u)?(e.enter(n),a(u)):t(u)}function a(u){return K(u)&&s++<i?(e.consume(u),a):(e.exit(n),t(u))}}const $a={tokenize:Ha};function Ha(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),W(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,l(a)}function l(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return _(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),l)}}const Ua={tokenize:Va},pr={tokenize:Ka};function Va(e){const t=this,n=[];let r=0,i,s,l;return a;function a(v){if(r<n.length){const R=n[r];return t.containerState=R[1],e.attempt(R[0].continuation,u,o)(v)}return o(v)}function u(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&E();const R=t.events.length;let D=R,k;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){k=t.events[D][1].end;break}b(r);let z=R;for(;z<t.events.length;)t.events[z][1].end={...k},z++;return me(t.events,D+1,0,t.events.slice(R)),t.events.length=z,o(v)}return a(v)}function o(v){if(r===n.length){if(!i)return h(v);if(i.currentConstruct&&i.currentConstruct.concrete)return x(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(pr,f,c)(v)}function f(v){return i&&E(),b(r),h(v)}function c(v){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,x(v)}function h(v){return t.containerState={},e.attempt(pr,p,x)(v)}function p(v){return r++,n.push([t.currentConstruct,t.containerState]),h(v)}function x(v){if(v===null){i&&E(),b(0),e.consume(v);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),y(v)}function y(v){if(v===null){S(e.exit("chunkFlow"),!0),b(0),e.consume(v);return}return _(v)?(e.consume(v),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(v),y)}function S(v,R){const D=t.sliceStream(v);if(R&&D.push(null),v.previous=s,s&&(s.next=v),s=v,i.defineSkip(v.start),i.write(D),t.parser.lazy[v.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<l&&(!i.events[k][1].end||i.events[k][1].end.offset>l))return;const z=t.events.length;let M=z,q,w;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(q){w=t.events[M][1].end;break}q=!0}for(b(r),k=z;k<t.events.length;)t.events[k][1].end={...w},k++;me(t.events,M+1,0,t.events.slice(z)),t.events.length=k}}function b(v){let R=n.length;for(;R-- >v;){const D=n[R];t.containerState=D[1],D[0].exit.call(t,e)}n.length=v}function E(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ka(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 Ke(e){if(e===null||X(e)||_e(e))return 1;if(Rt(e))return 2}function Dt(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const mn={name:"attention",resolveAll:Wa,tokenize:Qa};function Wa(e,t){let n=-1,r,i,s,l,a,u,o,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;u=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};dr(c,-u),dr(h,u),l={type:u>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},s={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...l.start},end:{...a.end}},e[r][1].end={...l.start},e[n][1].start={...a.end},o=[],e[r][1].end.offset-e[r][1].start.offset&&(o=xe(o,[["enter",e[r][1],t],["exit",e[r][1],t]])),o=xe(o,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",s,t]]),o=xe(o,Dt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),o=xe(o,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,o=xe(o,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,me(e,r-1,n-r+3,o),n=r+o.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Qa(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ke(r);let s;return l;function l(u){return s=u,e.enter("attentionSequence"),a(u)}function a(u){if(u===s)return e.consume(u),a;const o=e.exit("attentionSequence"),f=Ke(u),c=!f||f===2&&i||n.includes(u),h=!i||i===2&&f||n.includes(r);return o._open=!!(s===42?c:c&&(i||!h)),o._close=!!(s===42?h:h&&(f||!c)),t(u)}}function dr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Xa={name:"autolink",tokenize:Ya};function Ya(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"),s}function s(p){return ue(p)?(e.consume(p),l):p===64?n(p):o(p)}function l(p){return p===43||p===45||p===46||le(p)?(r=1,a(p)):o(p)}function a(p){return p===58?(e.consume(p),r=0,u):(p===43||p===45||p===46||le(p))&&r++<32?(e.consume(p),a):(r=0,o(p))}function u(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||It(p)?n(p):(e.consume(p),u)}function o(p){return p===64?(e.consume(p),f):Ma(p)?(e.consume(p),o):n(p)}function f(p){return le(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||le(p))&&r++<63){const x=p===45?h:c;return e.consume(p),x}return n(p)}}const ut={partial:!0,tokenize:Ga};function Ga(e,t,n){return r;function r(s){return K(s)?W(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||_(s)?t(s):n(s)}}const Ni={continuation:{tokenize:Za},exit:eo,name:"blockQuote",tokenize:Ja};function Ja(e,t,n){const r=this;return i;function i(l){if(l===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),s}return n(l)}function s(l){return K(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function Za(e,t,n){const r=this;return i;function i(l){return K(l)?W(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return e.attempt(Ni,t,n)(l)}}function eo(e){e.exit("blockQuote")}const Ai={name:"characterEscape",tokenize:to};function to(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return qa(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Ii={name:"characterReference",tokenize:no};function no(e,t,n){const r=this;let i=0,s,l;return a;function a(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),u}function u(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),o):(e.enter("characterReferenceValue"),s=31,l=le,f(c))}function o(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,l=Ba,f):(e.enter("characterReferenceValue"),s=7,l=dn,f(c))}function f(c){if(c===59&&i){const h=e.exit("characterReferenceValue");return l===le&&!Ln(r.sliceSerialize(h))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(c)&&i++<s?(e.consume(c),f):n(c)}}const mr={partial:!0,tokenize:io},gr={concrete:!0,name:"codeFenced",tokenize:ro};function ro(e,t,n){const r=this,i={partial:!0,tokenize:D};let s=0,l=0,a;return u;function u(k){return o(k)}function o(k){const z=r.events[r.events.length-1];return s=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(k)}function f(k){return k===a?(l++,e.consume(k),f):l<3?n(k):(e.exit("codeFencedFenceSequence"),K(k)?W(e,c,"whitespace")(k):c(k))}function c(k){return k===null||_(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(mr,y,R)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(k))}function h(k){return k===null||_(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(k)):K(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),W(e,p,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),h)}function p(k){return k===null||_(k)?c(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===null||_(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(k)):k===96&&k===a?n(k):(e.consume(k),x)}function y(k){return e.attempt(i,R,S)(k)}function S(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),b}function b(k){return s>0&&K(k)?W(e,E,"linePrefix",s+1)(k):E(k)}function E(k){return k===null||_(k)?e.check(mr,y,R)(k):(e.enter("codeFlowValue"),v(k))}function v(k){return k===null||_(k)?(e.exit("codeFlowValue"),E(k)):(e.consume(k),v)}function R(k){return e.exit("codeFenced"),t(k)}function D(k,z,M){let q=0;return w;function w(j){return k.enter("lineEnding"),k.consume(j),k.exit("lineEnding"),L}function L(j){return k.enter("codeFencedFence"),K(j)?W(k,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):N(j)}function N(j){return j===a?(k.enter("codeFencedFenceSequence"),B(j)):M(j)}function B(j){return j===a?(q++,k.consume(j),B):q>=l?(k.exit("codeFencedFenceSequence"),K(j)?W(k,F,"whitespace")(j):F(j)):M(j)}function F(j){return j===null||_(j)?(k.exit("codeFencedFence"),z(j)):M(j)}}}function io(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"),s)}function s(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Kt={name:"codeIndented",tokenize:so},lo={partial:!0,tokenize:ao};function so(e,t,n){const r=this;return i;function i(o){return e.enter("codeIndented"),W(e,s,"linePrefix",5)(o)}function s(o){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?l(o):n(o)}function l(o){return o===null?u(o):_(o)?e.attempt(lo,l,u)(o):(e.enter("codeFlowValue"),a(o))}function a(o){return o===null||_(o)?(e.exit("codeFlowValue"),l(o)):(e.consume(o),a)}function u(o){return e.exit("codeIndented"),t(o)}}function ao(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,s,"linePrefix",5)(l)}function s(l){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(l):_(l)?i(l):n(l)}}const oo={name:"codeText",previous:co,resolve:uo,tokenize:fo};function uo(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 co(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function fo(e,t,n){let r=0,i,s;return l;function l(c){return e.enter("codeText"),e.enter("codeTextSequence"),a(c)}function a(c){return c===96?(e.consume(c),r++,a):(e.exit("codeTextSequence"),u(c))}function u(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),u):c===96?(s=e.enter("codeTextSequence"),i=0,f(c)):_(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):(e.enter("codeTextData"),o(c))}function o(c){return c===null||c===32||c===96||_(c)?(e.exit("codeTextData"),u(c)):(e.consume(c),o)}function f(c){return c===96?(e.consume(c),i++,f):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(s.type="codeTextData",o(c))}}class ho{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 s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ze(this.left,r),s.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),Ze(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ze(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);Ze(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ze(this.left,n.reverse())}}}function Ze(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 Ti(e){const t={};let n=-1,r,i,s,l,a,u,o;const f=new ho(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"&&(u=r[1]._tokenizer.events,s=0,s<u.length&&u[s][1].type==="lineEndingBlank"&&(s+=2),s<u.length&&u[s][1].type==="content"))for(;++s<u.length&&u[s][1].type!=="content";)u[s][1].type==="chunkText"&&(u[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,po(f,n)),n=t[n],o=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(l=f.get(s),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(f.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=s);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...f.get(i)[1].start},a=f.slice(i,n),a.unshift(r),f.splice(i,n-i+1,a))}}return me(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!o}function po(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const a=l.events,u=[],o={};let f,c,h=-1,p=n,x=0,y=0;const S=[y];for(;p;){for(;e.get(++i)[1]!==p;);s.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<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(y=h+1,S.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(l.events=[],p?(p._tokenizer=void 0,p.previous=void 0):S.pop(),h=S.length;h--;){const b=a.slice(S[h],S[h+1]),E=s.pop();u.push([E,E+b.length-1]),e.splice(E,2,b)}for(u.reverse(),h=-1;++h<u.length;)o[x+u[h][0]]=x+u[h][1],x+=u[h][1]-u[h][0]-1;return o}const mo={resolve:xo,tokenize:yo},go={partial:!0,tokenize:bo};function xo(e){return Ti(e),e}function yo(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):_(a)?e.check(go,l,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function l(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function bo(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,s,"linePrefix")}function s(l){if(l===null||_(l))return n(l);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function ji(e,t,n,r,i,s,l,a,u){const o=u||Number.POSITIVE_INFINITY;let f=0;return c;function c(b){return b===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(b),e.exit(s),h):b===null||b===32||b===41||It(b)?n(b):(e.enter(r),e.enter(l),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(b))}function h(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(a),h(b)):b===null||b===60||_(b)?n(b):(e.consume(b),b===92?x:p)}function x(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function y(b){return!f&&(b===null||b===41||X(b))?(e.exit("chunkString"),e.exit(a),e.exit(l),e.exit(r),t(b)):f<o&&b===40?(e.consume(b),f++,y):b===41?(e.consume(b),f--,y):b===null||b===32||b===40||It(b)?n(b):(e.consume(b),b===92?S:y)}function S(b){return b===40||b===41||b===92?(e.consume(b),y):y(b)}}function Pi(e,t,n,r,i,s){const l=this;let a=0,u;return o;function o(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(s),f}function f(p){return a>999||p===null||p===91||p===93&&!u||p===94&&!a&&"_hiddenFootnoteSupport"in l.parser.constructs?n(p):p===93?(e.exit(s),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)||a++>999?(e.exit("chunkString"),f(p)):(e.consume(p),u||(u=!K(p)),p===92?h:c)}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,c):c(p)}}function Ri(e,t,n,r,i,s){let l;return a;function a(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,u):n(h)}function u(h){return h===l?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(s),o(h))}function o(h){return h===l?(e.exit(s),u(l)):h===null?n(h):_(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),W(e,o,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===l||h===null||_(h)?(e.exit("chunkString"),o(h)):(e.consume(h),h===92?c:f)}function c(h){return h===l||h===92?(e.consume(h),f):f(h)}}function rt(e,t){let n;return r;function r(i){return _(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):K(i)?W(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const ko={name:"definition",tokenize:So},wo={partial:!0,tokenize:Co};function So(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),l(p)}function l(p){return Pi.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=ye(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):n(p)}function u(p){return X(p)?rt(e,o)(p):o(p)}function o(p){return ji(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function f(p){return e.attempt(wo,c,c)(p)}function c(p){return K(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 Co(e,t,n){return r;function r(a){return X(a)?rt(e,i)(a):n(a)}function i(a){return Ri(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return K(a)?W(e,l,"whitespace")(a):l(a)}function l(a){return a===null||_(a)?t(a):n(a)}}const vo={name:"hardBreakEscape",tokenize:Eo};function Eo(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return _(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const No={name:"headingAtx",resolve:Ao,tokenize:Io};function Ao(e,t){let n=e.length-2,r=3,i,s;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},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},me(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Io(e,t,n){let r=0;return i;function i(f){return e.enter("atxHeading"),s(f)}function s(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"),a(f)):n(f)}function a(f){return f===35?(e.enter("atxHeadingSequence"),u(f)):f===null||_(f)?(e.exit("atxHeading"),t(f)):K(f)?W(e,a,"whitespace")(f):(e.enter("atxHeadingText"),o(f))}function u(f){return f===35?(e.consume(f),u):(e.exit("atxHeadingSequence"),a(f))}function o(f){return f===null||f===35||X(f)?(e.exit("atxHeadingText"),a(f)):(e.consume(f),o)}}const To=["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"],xr=["pre","script","style","textarea"],jo={concrete:!0,name:"htmlFlow",resolveTo:Do,tokenize:Lo},Po={partial:!0,tokenize:zo},Ro={partial:!0,tokenize:Oo};function Do(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 Lo(e,t,n){const r=this;let i,s,l,a,u;return o;function o(g){return f(g)}function f(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),h):g===47?(e.consume(g),s=!0,y):g===63?(e.consume(g),i=3,r.interrupt?t:m):ue(g)?(e.consume(g),l=String.fromCharCode(g),S):n(g)}function h(g){return g===45?(e.consume(g),i=2,p):g===91?(e.consume(g),i=5,a=0,x):ue(g)?(e.consume(g),i=4,r.interrupt?t:m):n(g)}function p(g){return g===45?(e.consume(g),r.interrupt?t:m):n(g)}function x(g){const oe="CDATA[";return g===oe.charCodeAt(a++)?(e.consume(g),a===oe.length?r.interrupt?t:N:x):n(g)}function y(g){return ue(g)?(e.consume(g),l=String.fromCharCode(g),S):n(g)}function S(g){if(g===null||g===47||g===62||X(g)){const oe=g===47,be=l.toLowerCase();return!oe&&!s&&xr.includes(be)?(i=1,r.interrupt?t(g):N(g)):To.includes(l.toLowerCase())?(i=6,oe?(e.consume(g),b):r.interrupt?t(g):N(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(g):s?E(g):v(g))}return g===45||le(g)?(e.consume(g),l+=String.fromCharCode(g),S):n(g)}function b(g){return g===62?(e.consume(g),r.interrupt?t:N):n(g)}function E(g){return K(g)?(e.consume(g),E):w(g)}function v(g){return g===47?(e.consume(g),w):g===58||g===95||ue(g)?(e.consume(g),R):K(g)?(e.consume(g),v):w(g)}function R(g){return g===45||g===46||g===58||g===95||le(g)?(e.consume(g),R):D(g)}function D(g){return g===61?(e.consume(g),k):K(g)?(e.consume(g),D):v(g)}function k(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),u=g,z):K(g)?(e.consume(g),k):M(g)}function z(g){return g===u?(e.consume(g),u=null,q):g===null||_(g)?n(g):(e.consume(g),z)}function M(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||X(g)?D(g):(e.consume(g),M)}function q(g){return g===47||g===62||K(g)?v(g):n(g)}function w(g){return g===62?(e.consume(g),L):n(g)}function L(g){return g===null||_(g)?N(g):K(g)?(e.consume(g),L):n(g)}function N(g){return g===45&&i===2?(e.consume(g),V):g===60&&i===1?(e.consume(g),Q):g===62&&i===4?(e.consume(g),ae):g===63&&i===3?(e.consume(g),m):g===93&&i===5?(e.consume(g),ce):_(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Po,ge,B)(g)):g===null||_(g)?(e.exit("htmlFlowData"),B(g)):(e.consume(g),N)}function B(g){return e.check(Ro,F,ge)(g)}function F(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),j}function j(g){return g===null||_(g)?B(g):(e.enter("htmlFlowData"),N(g))}function V(g){return g===45?(e.consume(g),m):N(g)}function Q(g){return g===47?(e.consume(g),l="",pe):N(g)}function pe(g){if(g===62){const oe=l.toLowerCase();return xr.includes(oe)?(e.consume(g),ae):N(g)}return ue(g)&&l.length<8?(e.consume(g),l+=String.fromCharCode(g),pe):N(g)}function ce(g){return g===93?(e.consume(g),m):N(g)}function m(g){return g===62?(e.consume(g),ae):g===45&&i===2?(e.consume(g),m):N(g)}function ae(g){return g===null||_(g)?(e.exit("htmlFlowData"),ge(g)):(e.consume(g),ae)}function ge(g){return e.exit("htmlFlow"),t(g)}}function Oo(e,t,n){const r=this;return i;function i(l){return _(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):n(l)}function s(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function zo(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(ut,t,n)}}const Fo={name:"htmlText",tokenize:_o};function _o(e,t,n){const r=this;let i,s,l;return a;function a(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),u}function u(m){return m===33?(e.consume(m),o):m===47?(e.consume(m),D):m===63?(e.consume(m),v):ue(m)?(e.consume(m),M):n(m)}function o(m){return m===45?(e.consume(m),f):m===91?(e.consume(m),s=0,x):ue(m)?(e.consume(m),E):n(m)}function f(m){return m===45?(e.consume(m),p):n(m)}function c(m){return m===null?n(m):m===45?(e.consume(m),h):_(m)?(l=c,Q(m)):(e.consume(m),c)}function h(m){return m===45?(e.consume(m),p):c(m)}function p(m){return m===62?V(m):m===45?h(m):c(m)}function x(m){const ae="CDATA[";return m===ae.charCodeAt(s++)?(e.consume(m),s===ae.length?y:x):n(m)}function y(m){return m===null?n(m):m===93?(e.consume(m),S):_(m)?(l=y,Q(m)):(e.consume(m),y)}function S(m){return m===93?(e.consume(m),b):y(m)}function b(m){return m===62?V(m):m===93?(e.consume(m),b):y(m)}function E(m){return m===null||m===62?V(m):_(m)?(l=E,Q(m)):(e.consume(m),E)}function v(m){return m===null?n(m):m===63?(e.consume(m),R):_(m)?(l=v,Q(m)):(e.consume(m),v)}function R(m){return m===62?V(m):v(m)}function D(m){return ue(m)?(e.consume(m),k):n(m)}function k(m){return m===45||le(m)?(e.consume(m),k):z(m)}function z(m){return _(m)?(l=z,Q(m)):K(m)?(e.consume(m),z):V(m)}function M(m){return m===45||le(m)?(e.consume(m),M):m===47||m===62||X(m)?q(m):n(m)}function q(m){return m===47?(e.consume(m),V):m===58||m===95||ue(m)?(e.consume(m),w):_(m)?(l=q,Q(m)):K(m)?(e.consume(m),q):V(m)}function w(m){return m===45||m===46||m===58||m===95||le(m)?(e.consume(m),w):L(m)}function L(m){return m===61?(e.consume(m),N):_(m)?(l=L,Q(m)):K(m)?(e.consume(m),L):q(m)}function N(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,B):_(m)?(l=N,Q(m)):K(m)?(e.consume(m),N):(e.consume(m),F)}function B(m){return m===i?(e.consume(m),i=void 0,j):m===null?n(m):_(m)?(l=B,Q(m)):(e.consume(m),B)}function F(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||X(m)?q(m):(e.consume(m),F)}function j(m){return m===47||m===62||X(m)?q(m):n(m)}function V(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function Q(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),pe}function pe(m){return K(m)?W(e,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):ce(m)}function ce(m){return e.enter("htmlTextData"),l(m)}}const On={name:"labelEnd",resolveAll:$o,resolveTo:Ho,tokenize:Uo},Mo={tokenize:Vo},Bo={tokenize:Ko},qo={tokenize:Wo};function $o(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&&me(e,0,e.length,n),e}function Ho(e,t){let n=e.length,r=0,i,s,l,a;for(;n--;)if(i=e[n][1],s){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&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const u={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},o={type:"label",start:{...e[s][1].start},end:{...e[l][1].end}},f={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[l-2][1].start}};return a=[["enter",u,t],["enter",o,t]],a=xe(a,e.slice(s+1,s+r+3)),a=xe(a,[["enter",f,t]]),a=xe(a,Dt(t.parser.constructs.insideSpan.null,e.slice(s+r+4,l-3),t)),a=xe(a,[["exit",f,t],e[l-2],e[l-1],["exit",o,t]]),a=xe(a,e.slice(l+1)),a=xe(a,[["exit",u,t]]),me(e,s,e.length,a),e}function Uo(e,t,n){const r=this;let i=r.events.length,s,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(h){return s?s._inactive?c(h):(l=r.parser.defined.includes(ye(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),u):n(h)}function u(h){return h===40?e.attempt(Mo,f,l?f:c)(h):h===91?e.attempt(Bo,f,l?o:c)(h):l?f(h):c(h)}function o(h){return e.attempt(qo,f,c)(h)}function f(h){return t(h)}function c(h){return s._balanced=!0,n(h)}}function Vo(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)?rt(e,s)(c):s(c)}function s(c){return c===41?f(c):ji(e,l,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function l(c){return X(c)?rt(e,u)(c):f(c)}function a(c){return n(c)}function u(c){return c===34||c===39||c===40?Ri(e,o,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):f(c)}function o(c){return X(c)?rt(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 Ko(e,t,n){const r=this;return i;function i(a){return Pi.call(r,e,s,l,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(ye(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function l(a){return n(a)}}function Wo(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const Qo={name:"labelStartImage",resolveAll:On.resolveAll,tokenize:Xo};function Xo(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),l):n(a)}function l(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Yo={name:"labelStartLink",resolveAll:On.resolveAll,tokenize:Go};function Go(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"),s}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Wt={name:"lineEnding",tokenize:Jo};function Jo(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),W(e,t,"linePrefix")}}const vt={name:"thematicBreak",tokenize:Zo};function Zo(e,t,n){let r=0,i;return s;function s(o){return e.enter("thematicBreak"),l(o)}function l(o){return i=o,a(o)}function a(o){return o===i?(e.enter("thematicBreakSequence"),u(o)):r>=3&&(o===null||_(o))?(e.exit("thematicBreak"),t(o)):n(o)}function u(o){return o===i?(e.consume(o),r++,u):(e.exit("thematicBreakSequence"),K(o)?W(e,a,"whitespace")(o):a(o))}}const fe={continuation:{tokenize:ru},exit:lu,name:"list",tokenize:nu},eu={partial:!0,tokenize:su},tu={partial:!0,tokenize:iu};function nu(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return a;function a(p){const x=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:dn(p)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(vt,n,o)(p):o(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return n(p)}function u(p){return dn(p)&&++l<10?(e.consume(p),u):(!r.interrupt||l<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),o(p)):n(p)}function o(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(ut,r.interrupt?n:f,e.attempt(eu,h,c))}function f(p){return r.containerState.initialBlankLine=!0,s++,h(p)}function c(p){return K(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function ru(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ut,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,W(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!K(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(tu,t,l)(a))}function l(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,W(e,e.attempt(fe,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function iu(e,t,n){const r=this;return W(e,i,"listItemIndent",r.containerState.size+1);function i(s){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(s):n(s)}}function lu(e){e.exit(this.containerState.type)}function su(e,t,n){const r=this;return W(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const l=r.events[r.events.length-1];return!K(s)&&l&&l[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const yr={name:"setextUnderline",resolveTo:au,tokenize:ou};function au(e,t){let n=e.length,r,i,s;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),!s&&e[n][1].type==="definition"&&(s=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",l,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function ou(e,t,n){const r=this;let i;return s;function s(o){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=o,l(o)):n(o)}function l(o){return e.enter("setextHeadingLineSequence"),a(o)}function a(o){return o===i?(e.consume(o),a):(e.exit("setextHeadingLineSequence"),K(o)?W(e,u,"lineSuffix")(o):u(o))}function u(o){return o===null||_(o)?(e.exit("setextHeadingLine"),t(o)):n(o)}}const uu={tokenize:cu};function cu(e){const t=this,n=e.attempt(ut,r,e.attempt(this.parser.constructs.flowInitial,i,W(e,e.attempt(this.parser.constructs.flow,i,e.attempt(mo,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const fu={resolveAll:Li()},hu=Di("string"),pu=Di("text");function Di(e){return{resolveAll:Li(e==="text"?du:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,l,a);return l;function l(f){return o(f)?s(f):a(f)}function a(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),u}function u(f){return o(f)?(n.exit("data"),s(f)):(n.consume(f),u)}function o(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 Li(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function du(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 s=i.length,l=-1,a=0,u;for(;s--;){const o=i[s];if(typeof o=="string"){for(l=o.length;o.charCodeAt(l-1)===32;)a++,l--;if(l)break;l=-1}else if(o===-2)u=!0,a++;else if(o!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const o={type:n===e.length||u||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?l:r.start._bufferIndex+l,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...o.start},r.start.offset===r.end.offset?Object.assign(r,o):(e.splice(n,0,["enter",o,t],["exit",o,t]),n+=2)}n++}return e}const mu={42:fe,43:fe,45:fe,48:fe,49:fe,50:fe,51:fe,52:fe,53:fe,54:fe,55:fe,56:fe,57:fe,62:Ni},gu={91:ko},xu={[-2]:Kt,[-1]:Kt,32:Kt},yu={35:No,42:vt,45:[yr,vt],60:jo,61:yr,95:vt,96:gr,126:gr},bu={38:Ii,92:Ai},ku={[-5]:Wt,[-4]:Wt,[-3]:Wt,33:Qo,38:Ii,42:mn,60:[Xa,Fo],91:Yo,92:[vo,Ai],93:On,95:mn,96:oo},wu={null:[mn,fu]},Su={null:[42,95]},Cu={null:[]},vu=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Su,contentInitial:gu,disable:Cu,document:mu,flow:yu,flowInitial:xu,insideSpan:wu,string:bu,text:ku},Symbol.toStringTag,{value:"Module"}));function Eu(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={},s=[];let l=[],a=[];const u={attempt:z(D),check:z(k),consume:E,enter:v,exit:R,interrupt:z(k,{interrupt:!0})},o={code:null,containerState:{},defineSkip:y,events:[],now:x,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:c};let f=t.tokenize.call(o,u);return t.resolveAll&&s.push(t),o;function c(L){return l=xe(l,L),S(),l[l.length-1]!==null?[]:(M(t,0),o.events=Dt(s,o.events,o),o.events)}function h(L,N){return Au(p(L),N)}function p(L){return Nu(l,L)}function x(){const{_bufferIndex:L,_index:N,line:B,column:F,offset:j}=r;return{_bufferIndex:L,_index:N,line:B,column:F,offset:j}}function y(L){i[L.line]=L.column,w()}function S(){let L;for(;r._index<l.length;){const N=l[r._index];if(typeof N=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<N.length;)b(N.charCodeAt(r._bufferIndex));else b(N)}}function b(L){f=f(L)}function E(L){_(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,w()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),o.previous=L}function v(L,N){const B=N||{};return B.type=L,B.start=x(),o.events.push(["enter",B,o]),a.push(B),B}function R(L){const N=a.pop();return N.end=x(),o.events.push(["exit",N,o]),N}function D(L,N){M(L,N.from)}function k(L,N){N.restore()}function z(L,N){return B;function B(F,j,V){let Q,pe,ce,m;return Array.isArray(F)?ge(F):"tokenize"in F?ge([F]):ae(F);function ae(te){return De;function De(ke){const Ne=ke!==null&&te[ke],Ae=ke!==null&&te.null,Le=[...Array.isArray(Ne)?Ne:Ne?[Ne]:[],...Array.isArray(Ae)?Ae:Ae?[Ae]:[]];return ge(Le)(ke)}}function ge(te){return Q=te,pe=0,te.length===0?V:g(te[pe])}function g(te){return De;function De(ke){return m=q(),ce=te,te.partial||(o.currentConstruct=te),te.name&&o.parser.constructs.disable.null.includes(te.name)?be():te.tokenize.call(N?Object.assign(Object.create(o),N):o,u,oe,be)(ke)}}function oe(te){return L(ce,m),j}function be(te){return m.restore(),++pe<Q.length?g(Q[pe]):V}}}function M(L,N){L.resolveAll&&!s.includes(L)&&s.push(L),L.resolve&&me(o.events,N,o.events.length-N,L.resolve(o.events.slice(N),o)),L.resolveTo&&(o.events=L.resolveTo(o.events,o))}function q(){const L=x(),N=o.previous,B=o.currentConstruct,F=o.events.length,j=Array.from(a);return{from:F,restore:V};function V(){r=L,o.previous=N,o.currentConstruct=B,o.events.length=F,a=j,w()}}function w(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Nu(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,s)];else{if(l=e.slice(n,i),r>-1){const a=l[0];typeof a=="string"?l[0]=a.slice(r):l.shift()}s>0&&l.push(e[i].slice(0,s))}return l}function Au(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let l;if(typeof s=="string")l=s;else switch(s){case-5:{l="\r";break}case-4:{l=`
|
|
3
|
-
`;break}case-3:{l=`\r
|
|
4
|
-
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(s)}i=s===-2,r.push(l)}return r.join("")}function Iu(e){const r={constructs:vi([vu,...(e||{}).extensions||[]]),content:i($a),defined:[],document:i(Ua),flow:i(uu),lazy:{},string:i(hu),text:i(pu)};return r;function i(s){return l;function l(a){return Eu(r,s,a)}}}function Tu(e){for(;!Ti(e););return e}const br=/[\0\t\n\r]/g;function ju(){let e=1,t="",n=!0,r;return i;function i(s,l,a){const u=[];let o,f,c,h,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(l||void 0).decode(s)),c=0,t="",n&&(s.charCodeAt(0)===65279&&c++,n=void 0);c<s.length;){if(br.lastIndex=c,o=br.exec(s),h=o&&o.index!==void 0?o.index:s.length,p=s.charCodeAt(h),!o){t=s.slice(c);break}if(p===10&&c===h&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),c<h&&(u.push(s.slice(c,h)),e+=h-c),p){case 0:{u.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,u.push(-2);e++<f;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}c=h+1}return a&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const Pu=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ru(e){return e.replace(Pu,Du)}function Du(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return Ei(n.slice(s?2:1),s?16:10)}return Ln(n)||e}const Oi={}.hasOwnProperty;function Lu(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Ou(n)(Tu(Iu(n).document().write(ju()(e,t,!0))))}function Ou(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(gt),autolinkProtocol:q,autolinkEmail:q,atxHeading:s(dt),blockQuote:s(Ae),characterEscape:q,characterReference:q,codeFenced:s(Le),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(Le,l),codeText:s(_t,l),codeTextData:q,data:q,codeFlowValue:q,definition:s(Oe),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(pt),hardBreakEscape:s(Ye),hardBreakTrailing:s(Ye),htmlFlow:s(mt,l),htmlFlowData:q,htmlText:s(mt,l),htmlTextData:q,image:s(Mt),label:l,link:s(gt),listItem:s(Bt),listItemValue:h,listOrdered:s(xt,c),listUnordered:s(xt),paragraph:s(qt),reference:g,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(dt),strong:s($t),thematicBreak:s(bt)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:Ne,autolinkProtocol:ke,blockQuote:u(),characterEscapeValue:w,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:te,characterReference:De,codeFenced:u(S),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:x,codeFlowValue:w,codeIndented:u(b),codeText:u(j),codeTextData:w,data:w,definition:u(),definitionDestinationString:R,definitionLabelString:E,definitionTitleString:v,emphasis:u(),hardBreakEscape:u(N),hardBreakTrailing:u(N),htmlFlow:u(B),htmlFlowData:w,htmlText:u(F),htmlTextData:w,image:u(Q),label:ce,labelText:pe,lineEnding:L,link:u(V),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:oe,resourceDestinationString:m,resourceTitleString:ae,resource:ge,setextHeading:u(M),setextHeadingLineSequence:z,setextHeadingText:k,strong:u(),thematicBreak:u()}};zi(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(C){let T={type:"root",children:[]};const $={stack:[T],tokenStack:[],config:t,enter:a,exit:o,buffer:l,resume:f,data:n},O=[];let H=-1;for(;++H<C.length;)if(C[H][1].type==="listOrdered"||C[H][1].type==="listUnordered")if(C[H][0]==="enter")O.push(H);else{const G=O.pop();H=i(C,G,H)}for(H=-1;++H<C.length;){const G=t[C[H][0]];Oi.call(G,C[H][1].type)&&G[C[H][1].type].call(Object.assign({sliceSerialize:C[H][2].sliceSerialize},$),C[H][1])}if($.tokenStack.length>0){const G=$.tokenStack[$.tokenStack.length-1];(G[1]||kr).call($,void 0,G[0])}for(T.position={start:Te(C.length>0?C[0][1].start:{line:1,column:1,offset:0}),end:Te(C.length>0?C[C.length-2][1].end:{line:1,column:1,offset:0})},H=-1;++H<t.transforms.length;)T=t.transforms[H](T)||T;return T}function i(C,T,$){let O=T-1,H=-1,G=!1,Z,J,ie,Ie;for(;++O<=$;){const ne=C[O];switch(ne[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ne[0]==="enter"?H++:H--,Ie=void 0;break}case"lineEndingBlank":{ne[0]==="enter"&&(Z&&!Ie&&!H&&!ie&&(ie=O),Ie=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ie=void 0}if(!H&&ne[0]==="enter"&&ne[1].type==="listItemPrefix"||H===-1&&ne[0]==="exit"&&(ne[1].type==="listUnordered"||ne[1].type==="listOrdered")){if(Z){let Be=O;for(J=void 0;Be--;){const ve=C[Be];if(ve[1].type==="lineEnding"||ve[1].type==="lineEndingBlank"){if(ve[0]==="exit")continue;J&&(C[J][1].type="lineEndingBlank",G=!0),ve[1].type="lineEnding",J=Be}else if(!(ve[1].type==="linePrefix"||ve[1].type==="blockQuotePrefix"||ve[1].type==="blockQuotePrefixWhitespace"||ve[1].type==="blockQuoteMarker"||ve[1].type==="listItemIndent"))break}ie&&(!J||ie<J)&&(Z._spread=!0),Z.end=Object.assign({},J?C[J][1].start:ne[1].end),C.splice(J||O,0,["exit",Z,ne[2]]),O++,$++}if(ne[1].type==="listItemPrefix"){const Be={type:"listItem",_spread:!1,start:Object.assign({},ne[1].start),end:void 0};Z=Be,C.splice(O,0,["enter",Be,ne[2]]),O++,$++,ie=void 0,Ie=!0}}}return C[T][1]._spread=G,$}function s(C,T){return $;function $(O){a.call(this,C(O),O),T&&T.call(this,O)}}function l(){this.stack.push({type:"fragment",children:[]})}function a(C,T,$){this.stack[this.stack.length-1].children.push(C),this.stack.push(C),this.tokenStack.push([T,$||void 0]),C.position={start:Te(T.start),end:void 0}}function u(C){return T;function T($){C&&C.call(this,$),o.call(this,$)}}function o(C,T){const $=this.stack.pop(),O=this.tokenStack.pop();if(O)O[0].type!==C.type&&(T?T.call(this,C,O[0]):(O[1]||kr).call(this,C,O[0]));else throw new Error("Cannot close `"+C.type+"` ("+nt({start:C.start,end:C.end})+"): it’s not open");$.position.end=Te(C.end)}function f(){return Dn(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function h(C){if(this.data.expectingFirstListItemValue){const T=this.stack[this.stack.length-2];T.start=Number.parseInt(this.sliceSerialize(C),10),this.data.expectingFirstListItemValue=void 0}}function p(){const C=this.resume(),T=this.stack[this.stack.length-1];T.lang=C}function x(){const C=this.resume(),T=this.stack[this.stack.length-1];T.meta=C}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const C=this.resume(),T=this.stack[this.stack.length-1];T.value=C.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const C=this.resume(),T=this.stack[this.stack.length-1];T.value=C.replace(/(\r?\n|\r)$/g,"")}function E(C){const T=this.resume(),$=this.stack[this.stack.length-1];$.label=T,$.identifier=ye(this.sliceSerialize(C)).toLowerCase()}function v(){const C=this.resume(),T=this.stack[this.stack.length-1];T.title=C}function R(){const C=this.resume(),T=this.stack[this.stack.length-1];T.url=C}function D(C){const T=this.stack[this.stack.length-1];if(!T.depth){const $=this.sliceSerialize(C).length;T.depth=$}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function z(C){const T=this.stack[this.stack.length-1];T.depth=this.sliceSerialize(C).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function q(C){const $=this.stack[this.stack.length-1].children;let O=$[$.length-1];(!O||O.type!=="text")&&(O=yt(),O.position={start:Te(C.start),end:void 0},$.push(O)),this.stack.push(O)}function w(C){const T=this.stack.pop();T.value+=this.sliceSerialize(C),T.position.end=Te(C.end)}function L(C){const T=this.stack[this.stack.length-1];if(this.data.atHardBreak){const $=T.children[T.children.length-1];$.position.end=Te(C.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(T.type)&&(q.call(this,C),w.call(this,C))}function N(){this.data.atHardBreak=!0}function B(){const C=this.resume(),T=this.stack[this.stack.length-1];T.value=C}function F(){const C=this.resume(),T=this.stack[this.stack.length-1];T.value=C}function j(){const C=this.resume(),T=this.stack[this.stack.length-1];T.value=C}function V(){const C=this.stack[this.stack.length-1];if(this.data.inReference){const T=this.data.referenceType||"shortcut";C.type+="Reference",C.referenceType=T,delete C.url,delete C.title}else delete C.identifier,delete C.label;this.data.referenceType=void 0}function Q(){const C=this.stack[this.stack.length-1];if(this.data.inReference){const T=this.data.referenceType||"shortcut";C.type+="Reference",C.referenceType=T,delete C.url,delete C.title}else delete C.identifier,delete C.label;this.data.referenceType=void 0}function pe(C){const T=this.sliceSerialize(C),$=this.stack[this.stack.length-2];$.label=Ru(T),$.identifier=ye(T).toLowerCase()}function ce(){const C=this.stack[this.stack.length-1],T=this.resume(),$=this.stack[this.stack.length-1];if(this.data.inReference=!0,$.type==="link"){const O=C.children;$.children=O}else $.alt=T}function m(){const C=this.resume(),T=this.stack[this.stack.length-1];T.url=C}function ae(){const C=this.resume(),T=this.stack[this.stack.length-1];T.title=C}function ge(){this.data.inReference=void 0}function g(){this.data.referenceType="collapsed"}function oe(C){const T=this.resume(),$=this.stack[this.stack.length-1];$.label=T,$.identifier=ye(this.sliceSerialize(C)).toLowerCase(),this.data.referenceType="full"}function be(C){this.data.characterReferenceType=C.type}function te(C){const T=this.sliceSerialize(C),$=this.data.characterReferenceType;let O;$?(O=Ei(T,$==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):O=Ln(T);const H=this.stack[this.stack.length-1];H.value+=O}function De(C){const T=this.stack.pop();T.position.end=Te(C.end)}function ke(C){w.call(this,C);const T=this.stack[this.stack.length-1];T.url=this.sliceSerialize(C)}function Ne(C){w.call(this,C);const T=this.stack[this.stack.length-1];T.url="mailto:"+this.sliceSerialize(C)}function Ae(){return{type:"blockquote",children:[]}}function Le(){return{type:"code",lang:null,meta:null,value:""}}function _t(){return{type:"inlineCode",value:""}}function Oe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pt(){return{type:"emphasis",children:[]}}function dt(){return{type:"heading",depth:0,children:[]}}function Ye(){return{type:"break"}}function mt(){return{type:"html",value:""}}function Mt(){return{type:"image",title:null,url:"",alt:null}}function gt(){return{type:"link",title:null,url:"",children:[]}}function xt(C){return{type:"list",ordered:C.type==="listOrdered",start:null,spread:C._spread,children:[]}}function Bt(C){return{type:"listItem",spread:C._spread,checked:null,children:[]}}function qt(){return{type:"paragraph",children:[]}}function $t(){return{type:"strong",children:[]}}function yt(){return{type:"text",value:""}}function bt(){return{type:"thematicBreak"}}}function Te(e){return{line:e.line,column:e.column,offset:e.offset}}function zi(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?zi(e,r):zu(e,r)}}function zu(e,t){let n;for(n in t)if(Oi.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 kr(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+nt({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+nt({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+nt({start:t.start,end:t.end})+") is still open")}function Fu(e){const t=this;t.parser=n;function n(r){return Lu(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function _u(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 Mu(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
5
|
-
`}]}function Bu(e,t){const n=t.value?t.value+`
|
|
6
|
-
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function qu(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $u(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Hu(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Xe(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let l,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=s+1,a+=1,e.footnoteCounts.set(r,a);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,u);const o={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,o),e.applyData(t,o)}function Uu(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 Vu(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Fi(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),s=i[0];s&&s.type==="text"?s.value="["+s.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 Ku(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Fi(e,t);const i={src:Xe(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function Wu(e,t){const n={src:Xe(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 Qu(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 Xu(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Fi(e,t);const i={href:Xe(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Yu(e,t){const n={href:Xe(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 Gu(e,t,n){const r=e.all(t),i=n?Ju(n):_i(t),s={},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:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const f=r[a];(i||a!==0||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
|
|
7
|
-
`}),f.type==="element"&&f.tagName==="p"&&!i?l.push(...f.children):l.push(f)}const u=r[r.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&l.push({type:"text",value:`
|
|
8
|
-
`});const o={type:"element",tagName:"li",properties:s,children:l};return e.patch(t,o),e.applyData(t,o)}function Ju(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=_i(n[r])}return t}function _i(e){const t=e.spread;return t??e.children.length>1}function Zu(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 s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function ec(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tc(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function nc(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rc(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)},a=Tn(t.children[1]),u=gi(t.children[t.children.length-1]);a&&u&&(l.position={start:a,end:u}),i.push(l)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function ic(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,a=l?l.length:t.children.length;let u=-1;const o=[];for(;++u<a;){const c=t.children[u],h={},p=l?l[u]:void 0;p&&(h.align=p);let x={type:"element",tagName:s,properties:h,children:[]};c&&(x.children=e.all(c),e.patch(c,x),x=e.applyData(c,x)),o.push(x)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(o,!0)};return e.patch(t,f),e.applyData(t,f)}function lc(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const wr=9,Sr=32;function sc(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(Cr(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Cr(t.slice(i),i>0,!1)),s.join("")}function Cr(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===wr||s===Sr;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===wr||s===Sr;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function ac(e,t){const n={type:"text",value:sc(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function oc(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const uc={blockquote:_u,break:Mu,code:Bu,delete:qu,emphasis:$u,footnoteReference:Hu,heading:Uu,html:Vu,imageReference:Ku,image:Wu,inlineCode:Qu,linkReference:Xu,link:Yu,listItem:Gu,list:Zu,paragraph:ec,root:tc,strong:nc,table:rc,tableCell:lc,tableRow:ic,text:ac,thematicBreak:oc,toml:kt,yaml:kt,definition:kt,footnoteDefinition:kt};function kt(){}const Mi=-1,Lt=0,it=1,Tt=2,zn=3,Fn=4,_n=5,Mn=6,Bi=7,qi=8,vr=typeof self=="object"?self:globalThis,cc=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,l]=t[i];switch(s){case Lt:case Mi:return n(l,i);case it:{const a=n([],i);for(const u of l)a.push(r(u));return a}case Tt:{const a=n({},i);for(const[u,o]of l)a[r(u)]=r(o);return a}case zn:return n(new Date(l),i);case Fn:{const{source:a,flags:u}=l;return n(new RegExp(a,u),i)}case _n:{const a=n(new Map,i);for(const[u,o]of l)a.set(r(u),r(o));return a}case Mn:{const a=n(new Set,i);for(const u of l)a.add(r(u));return a}case Bi:{const{name:a,message:u}=l;return n(new vr[a](u),i)}case qi: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:a}=new Uint8Array(l);return n(new DataView(a),l)}}return n(new vr[s](l),i)};return r},Er=e=>cc(new Map,e)(0),$e="",{toString:fc}={},{keys:hc}=Object,et=e=>{const t=typeof e;if(t!=="object"||!e)return[Lt,t];const n=fc.call(e).slice(8,-1);switch(n){case"Array":return[it,$e];case"Object":return[Tt,$e];case"Date":return[zn,$e];case"RegExp":return[Fn,$e];case"Map":return[_n,$e];case"Set":return[Mn,$e];case"DataView":return[it,n]}return n.includes("Array")?[it,n]:n.includes("Error")?[Bi,n]:[Tt,n]},wt=([e,t])=>e===Lt&&(t==="function"||t==="symbol"),pc=(e,t,n,r)=>{const i=(l,a)=>{const u=r.push(l)-1;return n.set(a,u),u},s=l=>{if(n.has(l))return n.get(l);let[a,u]=et(l);switch(a){case Lt:{let f=l;switch(u){case"bigint":a=qi,f=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);f=null;break;case"undefined":return i([Mi],l)}return i([a,f],l)}case it:{if(u){let h=l;return u==="DataView"?h=new Uint8Array(l.buffer):u==="ArrayBuffer"&&(h=new Uint8Array(l)),i([u,[...h]],l)}const f=[],c=i([a,f],l);for(const h of l)f.push(s(h));return c}case Tt:{if(u)switch(u){case"BigInt":return i([u,l.toString()],l);case"Boolean":case"Number":case"String":return i([u,l.valueOf()],l)}if(t&&"toJSON"in l)return s(l.toJSON());const f=[],c=i([a,f],l);for(const h of hc(l))(e||!wt(et(l[h])))&&f.push([s(h),s(l[h])]);return c}case zn:return i([a,l.toISOString()],l);case Fn:{const{source:f,flags:c}=l;return i([a,{source:f,flags:c}],l)}case _n:{const f=[],c=i([a,f],l);for(const[h,p]of l)(e||!(wt(et(h))||wt(et(p))))&&f.push([s(h),s(p)]);return c}case Mn:{const f=[],c=i([a,f],l);for(const h of l)(e||!wt(et(h)))&&f.push(s(h));return c}}const{message:o}=l;return i([a,{name:u,message:o}],l)};return s},Nr=(e,{json:t,lossy:n}={})=>{const r=[];return pc(!(t||n),!!t,new Map,r)(e),r},st=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Er(Nr(e,t)):structuredClone(e):(e,t)=>Er(Nr(e,t));function dc(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 mc(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function gc(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||dc,r=e.options.footnoteBackLabel||mc,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let u=-1;for(;++u<e.footnoteOrder.length;){const o=e.footnoteById.get(e.footnoteOrder[u]);if(!o)continue;const f=e.all(o),c=String(o.identifier).toUpperCase(),h=Xe(c.toLowerCase());let p=0;const x=[],y=e.footnoteCounts.get(c);for(;y!==void 0&&++p<=y;){x.length>0&&x.push({type:"text",value:" "});let E=typeof n=="string"?n:n(u,p);typeof E=="string"&&(E={type:"text",value:E}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,p),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const S=f[f.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const E=S.children[S.children.length-1];E&&E.type==="text"?E.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...x)}else f.push(...x);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(f,!0)};e.patch(o,b),a.push(b)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...st(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
9
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
10
|
-
`}]}}const Ot=(function(e){if(e==null)return kc;if(typeof e=="function")return zt(e);if(typeof e=="object")return Array.isArray(e)?xc(e):yc(e);if(typeof e=="string")return bc(e);throw new Error("Expected function, string, or object as test")});function xc(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ot(e[n]);return zt(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function yc(e){const t=e;return zt(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function bc(e){return zt(t);function t(n){return n&&n.type===e}}function zt(e){return t;function t(n,r,i){return!!(wc(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function kc(){return!0}function wc(e){return e!==null&&typeof e=="object"&&"type"in e}const $i=[],Sc=!0,gn=!1,Cc="skip";function Hi(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Ot(i),l=r?-1:1;a(e,void 0,[])();function a(u,o,f){const c=u&&typeof u=="object"?u:{};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 ("+(u.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=$i,x,y,S;if((!t||s(u,o,f[f.length-1]||void 0))&&(p=vc(n(u,f)),p[0]===gn))return p;if("children"in u&&u.children){const b=u;if(b.children&&p[0]!==Cc)for(y=(r?b.children.length:-1)+l,S=f.concat(b);y>-1&&y<b.children.length;){const E=b.children[y];if(x=a(E,y,S)(),x[0]===gn)return x;y=typeof x[1]=="number"?x[1]:y+l}}return p}}}function vc(e){return Array.isArray(e)?e:typeof e=="number"?[Sc,e]:e==null?$i:[e]}function Bn(e,t,n,r){let i,s,l;typeof t=="function"&&typeof n!="function"?(s=void 0,l=t,i=n):(s=t,l=n,i=r),Hi(e,s,a,i);function a(u,o){const f=o[o.length-1],c=f?f.children.indexOf(u):void 0;return l(u,c,f)}}const xn={}.hasOwnProperty,Ec={};function Nc(e,t){const n=t||Ec,r=new Map,i=new Map,s=new Map,l={...uc,...n.handlers},a={all:o,applyData:Ic,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:l,one:u,options:n,patch:Ac,wrap:jc};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)}}),a;function u(f,c){const h=f.type,p=a.handlers[h];if(xn.call(a.handlers,h)&&p)return p(a,f,c);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in f){const{children:y,...S}=f,b=st(S);return b.children=a.all(f),b}return st(f)}return(a.options.unknownHandler||Tc)(a,f,c)}function o(f){const c=[];if("children"in f){const h=f.children;let p=-1;for(;++p<h.length;){const x=a.one(h[p],f);if(x){if(p&&h[p-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=Ar(x.value)),!Array.isArray(x)&&x.type==="element")){const y=x.children[0];y&&y.type==="text"&&(y.value=Ar(y.value))}Array.isArray(x)?c.push(...x):c.push(x)}}}return c}}function Ac(e,t){e.position&&(t.position=yi(e))}function Ic(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=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"&&s&&Object.assign(n.properties,st(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function Tc(e,t){const n=t.data||{},r="value"in t&&!(xn.call(n,"hProperties")||xn.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 jc(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
11
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
12
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
13
|
-
`}),n}function Ar(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ir(e,t){const n=Nc(e,t),r=n.one(e,void 0),i=gc(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
14
|
-
`},i),s}function Pc(e,t){return e&&"run"in e?async function(n,r){const i=Ir(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ir(n,{file:r,...e||t})}}function Tr(e){if(e)throw e}var Qt,jr;function Rc(){if(jr)return Qt;jr=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(o){return typeof Array.isArray=="function"?Array.isArray(o):t.call(o)==="[object Array]"},s=function(o){if(!o||t.call(o)!=="[object Object]")return!1;var f=e.call(o,"constructor"),c=o.constructor&&o.constructor.prototype&&e.call(o.constructor.prototype,"isPrototypeOf");if(o.constructor&&!f&&!c)return!1;var h;for(h in o);return typeof h>"u"||e.call(o,h)},l=function(o,f){n&&f.name==="__proto__"?n(o,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):o[f.name]=f.newValue},a=function(o,f){if(f==="__proto__")if(e.call(o,f)){if(r)return r(o,f).value}else return;return o[f]};return Qt=function u(){var o,f,c,h,p,x,y=arguments[0],S=1,b=arguments.length,E=!1;for(typeof y=="boolean"&&(E=y,y=arguments[1]||{},S=2),(y==null||typeof y!="object"&&typeof y!="function")&&(y={});S<b;++S)if(o=arguments[S],o!=null)for(f in o)c=a(y,f),h=a(o,f),y!==h&&(E&&h&&(s(h)||(p=i(h)))?(p?(p=!1,x=c&&i(c)?c:[]):x=c&&s(c)?c:{},l(y,{name:f,newValue:u(E,x,h)})):typeof h<"u"&&l(y,{name:f,newValue:h}));return y},Qt}var Dc=Rc();const Xt=Jr(Dc);function yn(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 Lc(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);a(null,...i);function a(u,...o){const f=e[++s];let c=-1;if(u){l(u);return}for(;++c<i.length;)(o[c]===null||o[c]===void 0)&&(o[c]=i[c]);i=o,f?Oc(f,a)(...o):l(null,...o)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Oc(e,t){let n;return r;function r(...l){const a=e.length>l.length;let u;a&&l.push(i);try{u=e.apply(this,l)}catch(o){const f=o;if(a&&n)throw f;return i(f)}a||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(l,...a){n||(n=!0,t(l,...a))}function s(l){i(null,l)}}const we={basename:zc,dirname:Fc,extname:_c,join:Mc,sep:"/"};function zc(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ct(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else l<0&&(s=!0,l=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function Fc(e){if(ct(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 _c(e){ct(e);let t=e.length,n=-1,r=0,i=-1,s=0,l;for(;t--;){const a=e.codePointAt(t);if(a===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),a===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Mc(...e){let t=-1,n;for(;++t<e.length;)ct(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Bc(n)}function Bc(e){ct(e);const t=e.codePointAt(0)===47;let n=qc(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function qc(e,t){let n="",r=0,i=-1,s=0,l=-1,a,u;for(;++l<=e.length;){if(l<e.length)a=e.codePointAt(l);else{if(a===47)break;a=47}if(a===47){if(!(i===l-1||s===1))if(i!==l-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=l,s=0;continue}}else if(n.length>0){n="",r=0,i=l,s=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,s=0}else a===46&&s>-1?s++:s=-1}return n}function ct(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const $c={cwd:Hc};function Hc(){return"/"}function bn(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Uc(e){if(typeof e=="string")e=new URL(e);else if(!bn(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 Vc(e)}function Vc(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 Ui{constructor(t){let n;t?bn(t)?n={path:t}:typeof t=="string"||Kc(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":$c.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Yt.length;){const s=Yt[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Yt.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?we.basename(this.path):void 0}set basename(t){Jt(t,"basename"),Gt(t,"basename"),this.path=we.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?we.dirname(this.path):void 0}set dirname(t){Pr(this.basename,"dirname"),this.path=we.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?we.extname(this.path):void 0}set extname(t){if(Gt(t,"extname"),Pr(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=we.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){bn(t)&&(t=Uc(t)),Jt(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?we.basename(this.path,this.extname):void 0}set stem(t){Jt(t,"stem"),Gt(t,"stem"),this.path=we.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 se(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 Gt(e,t){if(e&&e.includes(we.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+we.sep+"`")}function Jt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Pr(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Kc(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Wc=(function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),Qc={}.hasOwnProperty;class qn extends Wc{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=Lc()}copy(){const t=new qn;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Xt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(tn("data",this.frozen),this.namespace[t]=n,this):Qc.call(this.namespace,t)&&this.namespace[t]||void 0:t?(tn("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=St(t),r=this.parser||this.Parser;return Zt("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Zt("process",this.parser||this.Parser),en("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,l){const a=St(t),u=r.parse(a);r.run(u,a,function(f,c,h){if(f||!c||!h)return o(f);const p=c,x=r.stringify(p,h);Gc(x)?h.value=x:h.result=x,o(f,h)});function o(f,c){f||!c?l(f):s?s(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Zt("processSync",this.parser||this.Parser),en("processSync",this.compiler||this.Compiler),this.process(t,i),Dr("processSync","process",n),r;function i(s,l){n=!0,Tr(s),r=l}}run(t,n,r){Rr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(l,a){const u=St(n);i.run(t,u,o);function o(f,c,h){const p=c||t;f?a(f):l?l(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),Dr("runSync","run",r),i;function s(l,a){Tr(l),i=a,r=!0}}stringify(t,n){this.freeze();const r=St(n),i=this.compiler||this.Compiler;return en("stringify",i),Rr(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(tn("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(o){if(typeof o=="function")u(o,[]);else if(typeof o=="object")if(Array.isArray(o)){const[f,...c]=o;u(f,c)}else l(o);else throw new TypeError("Expected usable value, not `"+o+"`")}function l(o){if(!("plugins"in o)&&!("settings"in o))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");a(o.plugins),o.settings&&(i.settings=Xt(!0,i.settings,o.settings))}function a(o){let f=-1;if(o!=null)if(Array.isArray(o))for(;++f<o.length;){const c=o[f];s(c)}else throw new TypeError("Expected a list of plugins, not `"+o+"`")}function u(o,f){let c=-1,h=-1;for(;++c<r.length;)if(r[c][0]===o){h=c;break}if(h===-1)r.push([o,...f]);else if(f.length>0){let[p,...x]=f;const y=r[h][1];yn(y)&&yn(p)&&(p=Xt(!0,y,p)),r[h]=[o,p,...x]}}}}const Xc=new qn().freeze();function Zt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function en(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function tn(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 Rr(e){if(!yn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Dr(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function St(e){return Yc(e)?e:new Ui(e)}function Yc(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Gc(e){return typeof e=="string"||Jc(e)}function Jc(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Zc="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Lr=[],Or={allowDangerousHtml:!0},ef=/^(https?|ircs?|mailto|xmpp)$/i,tf=[{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 nf(e){const t=rf(e),n=lf(e);return sf(t.runSync(t.parse(n),n),e)}function rf(e){const t=e.rehypePlugins||Lr,n=e.remarkPlugins||Lr,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Or}:Or;return Xc().use(Fu).use(n).use(Pc,r).use(t)}function lf(e){const t=e.children||"",n=new Ui;return typeof t=="string"&&(n.value=t),n}function sf(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,l=t.skipHtml,a=t.unwrapDisallowed,u=t.urlTransform||af;for(const f of tf)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+Zc+f.id,void 0);return Bn(e,o),ba(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function o(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 x=f.properties[p],y=Vt[p];(y===null||y.includes(f.tagName))&&(f.properties[p]=u(String(x||""),p,f))}}if(f.type==="element"){let p=n?!n.includes(f.tagName):s?s.includes(f.tagName):!1;if(!p&&r&&typeof c=="number"&&(p=!r(f,c,h)),p&&h&&typeof c=="number")return a&&f.children?h.children.splice(c,1,...f.children):h.children.splice(c,1),c}}}function af(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||ef.test(e.slice(0,t))?e:""}const ze=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],zr={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...ze,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...ze],h2:[["className","sr-only"]],img:[...ze,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...ze,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...ze],table:[...ze],ul:[...ze,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},je={}.hasOwnProperty;function of(e,t){let n={type:"root",children:[]};const r={schema:t?{...zr,...t}:zr,stack:[]},i=Vi(r,e);return i&&(Array.isArray(i)?i.length===1?n=i[0]:n.children=i:n=i),n}function Vi(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return uf(e,n);case"doctype":return cf(e,n);case"element":return ff(e,n);case"root":return hf(e,n);case"text":return pf(e,n)}}}function uf(e,t){if(e.schema.allowComments){const n=typeof t.value=="string"?t.value:"",r=n.indexOf("-->"),s={type:"comment",value:r<0?n:n.slice(0,r)};return ft(s,t),s}}function cf(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return ft(n,t),n}}function ff(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const r=Ki(e,t.children),i=df(e,t.properties);e.stack.pop();let s=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(s=!0,e.schema.ancestors&&je.call(e.schema.ancestors,n))){const a=e.schema.ancestors[n];let u=-1;for(s=!1;++u<a.length;)e.stack.includes(a[u])&&(s=!0)}if(!s)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;const l={type:"element",tagName:n,properties:i,children:r};return ft(l,t),l}function hf(e,t){const r={type:"root",children:Ki(e,t.children)};return ft(r,t),r}function pf(e,t){const r={type:"text",value:typeof t.value=="string"?t.value:""};return ft(r,t),r}function Ki(e,t){const n=[];if(Array.isArray(t)){const r=t;let i=-1;for(;++i<r.length;){const s=Vi(e,r[i]);s&&(Array.isArray(s)?n.push(...s):n.push(s))}}return n}function df(e,t){const n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,s=r&&je.call(r,n)?r[n]:void 0,l=r&&je.call(r,"*")?r["*"]:void 0,a=t&&typeof t=="object"?t:{},u={};let o;for(o in a)if(je.call(a,o)){const f=a[o];let c=Fr(e,_r(s,o),o,f);c==null&&(c=Fr(e,_r(l,o),o,f)),c!=null&&(u[o]=c)}if(i&&je.call(i,n)){const f=i[n];for(o in f)je.call(f,o)&&!je.call(u,o)&&(u[o]=f[o])}return u}function Fr(e,t,n,r){return t?Array.isArray(r)?mf(e,t,n,r):Wi(e,t,n,r):void 0}function mf(e,t,n,r){let i=-1;const s=[];for(;++i<r.length;){const l=Wi(e,t,n,r[i]);(typeof l=="number"||typeof l=="string")&&s.push(l)}return s}function Wi(e,t,n,r){if(!(typeof r!="boolean"&&typeof r!="number"&&typeof r!="string")&&gf(e,n,r)){if(typeof t=="object"&&t.length>1){let i=!1,s=0;for(;++s<t.length;){const l=t[s];if(l&&typeof l=="object"&&"flags"in l){if(l.test(String(r))){i=!0;break}}else if(l===r){i=!0;break}}if(!i)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function gf(e,t,n){const r=e.schema.protocols&&je.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;const i=String(n),s=i.indexOf(":"),l=i.indexOf("?"),a=i.indexOf("#"),u=i.indexOf("/");if(s<0||u>-1&&s>u||l>-1&&s>l||a>-1&&s>a)return!0;let o=-1;for(;++o<r.length;){const f=r[o];if(s===f.length&&i.slice(0,f.length)===f)return!0}return!1}function ft(e,t){const n=yi(t);t.data&&(e.data=st(t.data)),n&&(e.position=n)}function _r(e,t){let n,r=-1;if(e)for(;++r<e.length;){const i=e[r],s=typeof i=="string"?i:i[0];if(s===t)return i;s==="data*"&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return n}function xf(e){return function(t){return of(t,e)}}function Mr(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 yf(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function bf(e,t,n){const i=Ot((n||{}).ignore||[]),s=kf(t);let l=-1;for(;++l<s.length;)Hi(e,"text",a);function a(o,f){let c=-1,h;for(;++c<f.length;){const p=f[c],x=h?h.children:void 0;if(i(p,x?x.indexOf(p):void 0,h))return;h=p}if(h)return u(o,f)}function u(o,f){const c=f[f.length-1],h=s[l][0],p=s[l][1];let x=0;const S=c.children.indexOf(o);let b=!1,E=[];h.lastIndex=0;let v=h.exec(o.value);for(;v;){const R=v.index,D={index:v.index,input:v.input,stack:[...f,o]};let k=p(...v,D);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?h.lastIndex=R+1:(x!==R&&E.push({type:"text",value:o.value.slice(x,R)}),Array.isArray(k)?E.push(...k):k&&E.push(k),x=R+v[0].length,b=!0),!h.global)break;v=h.exec(o.value)}return b?(x<o.value.length&&E.push({type:"text",value:o.value.slice(x)}),c.children.splice(S,1,...E)):E=[o],S+E.length}}function kf(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([wf(i[0]),Sf(i[1])])}return t}function wf(e){return typeof e=="string"?new RegExp(yf(e),"g"):e}function Sf(e){return typeof e=="function"?e:function(){return e}}const nn="phrasing",rn=["autolink","link","image","label"];function Cf(){return{transforms:[jf],enter:{literalAutolink:Ef,literalAutolinkEmail:ln,literalAutolinkHttp:ln,literalAutolinkWww:ln},exit:{literalAutolink:Tf,literalAutolinkEmail:If,literalAutolinkHttp:Nf,literalAutolinkWww:Af}}}function vf(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:nn,notInConstruct:rn},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:nn,notInConstruct:rn},{character:":",before:"[ps]",after:"\\/",inConstruct:nn,notInConstruct:rn}]}}function Ef(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ln(e){this.config.enter.autolinkProtocol.call(this,e)}function Nf(e){this.config.exit.autolinkProtocol.call(this,e)}function Af(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 If(e){this.config.exit.autolinkEmail.call(this,e)}function Tf(e){this.exit(e)}function jf(e){bf(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Pf],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Rf]],{ignore:["link","linkReference"]})}function Pf(e,t,n,r,i){let s="";if(!Qi(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!Df(n)))return!1;const l=Lf(n+r);if(!l[0])return!1;const a={type:"link",title:null,url:s+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[a,{type:"text",value:l[1]}]:a}function Rf(e,t,n,r){return!Qi(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Df(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 Lf(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=Mr(e,"(");let s=Mr(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Qi(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||_e(n)||Rt(n))&&(!t||n!==47)}Xi.peek=Hf;function Of(){this.buffer()}function zf(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Ff(){this.buffer()}function _f(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Mf(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ye(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Bf(e){this.exit(e)}function qf(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ye(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $f(e){this.exit(e)}function Hf(){return"["}function Xi(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const l=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),l(),s+=i.move("]"),s}function Uf(){return{enter:{gfmFootnoteCallString:Of,gfmFootnoteCall:zf,gfmFootnoteDefinitionLabelString:Ff,gfmFootnoteDefinition:_f},exit:{gfmFootnoteCallString:Mf,gfmFootnoteCall:Bf,gfmFootnoteDefinitionLabelString:qf,gfmFootnoteDefinition:$f}}}function Vf(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Xi},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,l){const a=s.createTracker(l);let u=a.move("[^");const o=s.enter("footnoteDefinition"),f=s.enter("label");return u+=a.move(s.safe(s.associationId(r),{before:u,after:"]"})),f(),u+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),u+=a.move((t?`
|
|
15
|
-
`:" ")+s.indentLines(s.containerFlow(r,a.current()),t?Yi:Kf))),o(),u}}function Kf(e,t,n){return t===0?e:Yi(e,t,n)}function Yi(e,t,n){return(n?"":" ")+e}const Wf=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Gi.peek=Jf;function Qf(){return{canContainEols:["delete"],enter:{strikethrough:Yf},exit:{strikethrough:Gf}}}function Xf(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Wf}],handlers:{delete:Gi}}}function Yf(e){this.enter({type:"delete",children:[]},e)}function Gf(e){this.exit(e)}function Gi(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let l=i.move("~~");return l+=n.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),s(),l}function Jf(){return"~"}function Zf(e){return e.length}function eh(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Zf,s=[],l=[],a=[],u=[];let o=0,f=-1;for(;++f<e.length;){const y=[],S=[];let b=-1;for(e[f].length>o&&(o=e[f].length);++b<e[f].length;){const E=th(e[f][b]);if(n.alignDelimiters!==!1){const v=i(E);S[b]=v,(u[b]===void 0||v>u[b])&&(u[b]=v)}y.push(E)}l[f]=y,a[f]=S}let c=-1;if(typeof r=="object"&&"length"in r)for(;++c<o;)s[c]=Br(r[c]);else{const y=Br(r);for(;++c<o;)s[c]=y}c=-1;const h=[],p=[];for(;++c<o;){const y=s[c];let S="",b="";y===99?(S=":",b=":"):y===108?S=":":y===114&&(b=":");let E=n.alignDelimiters===!1?1:Math.max(1,u[c]-S.length-b.length);const v=S+"-".repeat(E)+b;n.alignDelimiters!==!1&&(E=S.length+E+b.length,E>u[c]&&(u[c]=E),p[c]=E),h[c]=v}l.splice(1,0,h),a.splice(1,0,p),f=-1;const x=[];for(;++f<l.length;){const y=l[f],S=a[f];c=-1;const b=[];for(;++c<o;){const E=y[c]||"";let v="",R="";if(n.alignDelimiters!==!1){const D=u[c]-(S[c]||0),k=s[c];k===114?v=" ".repeat(D):k===99?D%2?(v=" ".repeat(D/2+.5),R=" ".repeat(D/2-.5)):(v=" ".repeat(D/2),R=v):R=" ".repeat(D)}n.delimiterStart!==!1&&!c&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||c)&&b.push(" "),n.alignDelimiters!==!1&&b.push(v),b.push(E),n.alignDelimiters!==!1&&b.push(R),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||c!==o-1)&&b.push("|")}x.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return x.join(`
|
|
16
|
-
`)}function th(e){return e==null?"":String(e)}function Br(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 nh(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const l=n.indentLines(n.containerFlow(e,s.current()),rh);return i(),l}function rh(e,t,n){return">"+(n?"":" ")+e}function ih(e,t){return qr(e,t.inConstruct,!0)&&!qr(e,t.notInConstruct,!1)}function qr(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===`
|
|
17
|
-
`&&ih(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
18
|
-
`}function lh(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>l&&(l=s):s=1,i=r+t.length,r=n.indexOf(t,i);return l}function sh(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 ah(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 oh(e,t,n,r){const i=ah(n),s=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(sh(e,n)){const c=n.enter("codeIndented"),h=n.indentLines(s,uh);return c(),h}const a=n.createTracker(r),u=i.repeat(Math.max(lh(s,i)+1,3)),o=n.enter("codeFenced");let f=a.move(u);if(e.lang){const c=n.enter(`codeFencedLang${l}`);f+=a.move(n.safe(e.lang,{before:f,after:" ",encode:["`"],...a.current()})),c()}if(e.lang&&e.meta){const c=n.enter(`codeFencedMeta${l}`);f+=a.move(" "),f+=a.move(n.safe(e.meta,{before:f,after:`
|
|
19
|
-
`,encode:["`"],...a.current()})),c()}return f+=a.move(`
|
|
20
|
-
`),s&&(f+=a.move(s+`
|
|
21
|
-
`)),f+=a.move(u),o(),f}function uh(e,t,n){return(n?"":" ")+e}function $n(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 ch(e,t,n,r){const i=$n(n),s=i==='"'?"Quote":"Apostrophe",l=n.enter("definition");let a=n.enter("label");const u=n.createTracker(r);let o=u.move("[");return o+=u.move(n.safe(n.associationId(e),{before:o,after:"]",...u.current()})),o+=u.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),o+=u.move("<"),o+=u.move(n.safe(e.url,{before:o,after:">",...u.current()})),o+=u.move(">")):(a=n.enter("destinationRaw"),o+=u.move(n.safe(e.url,{before:o,after:e.title?" ":`
|
|
22
|
-
`,...u.current()}))),a(),e.title&&(a=n.enter(`title${s}`),o+=u.move(" "+i),o+=u.move(n.safe(e.title,{before:o,after:i,...u.current()})),o+=u.move(i),a()),l(),o}function fh(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 at(e){return"&#x"+e.toString(16).toUpperCase()+";"}function jt(e,t,n){const r=Ke(e),i=Ke(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}}Ji.peek=hh;function Ji(e,t,n,r){const i=fh(n),s=n.enter("emphasis"),l=n.createTracker(r),a=l.move(i);let u=l.move(n.containerPhrasing(e,{after:i,before:a,...l.current()}));const o=u.charCodeAt(0),f=jt(r.before.charCodeAt(r.before.length-1),o,i);f.inside&&(u=at(o)+u.slice(1));const c=u.charCodeAt(u.length-1),h=jt(r.after.charCodeAt(0),c,i);h.inside&&(u=u.slice(0,-1)+at(c));const p=l.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:f.outside},a+u+p}function hh(e,t,n){return n.options.emphasis||"*"}function ph(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,gn}),!!((!e.depth||e.depth<3)&&Dn(e)&&(t.options.setext||n))}function dh(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(ph(e,n)){const f=n.enter("headingSetext"),c=n.enter("phrasing"),h=n.containerPhrasing(e,{...s.current(),before:`
|
|
23
|
-
`,after:`
|
|
24
|
-
`});return c(),f(),h+`
|
|
25
|
-
`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
|
|
26
|
-
`))+1))}const l="#".repeat(i),a=n.enter("headingAtx"),u=n.enter("phrasing");s.move(l+" ");let o=n.containerPhrasing(e,{before:"# ",after:`
|
|
27
|
-
`,...s.current()});return/^[\t ]/.test(o)&&(o=at(o.charCodeAt(0))+o.slice(1)),o=o?l+" "+o:l,n.options.closeAtx&&(o+=" "+l),u(),a(),o}Zi.peek=mh;function Zi(e){return e.value||""}function mh(){return"<"}el.peek=gh;function el(e,t,n,r){const i=$n(n),s=i==='"'?"Quote":"Apostrophe",l=n.enter("image");let a=n.enter("label");const u=n.createTracker(r);let o=u.move("![");return o+=u.move(n.safe(e.alt,{before:o,after:"]",...u.current()})),o+=u.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),o+=u.move("<"),o+=u.move(n.safe(e.url,{before:o,after:">",...u.current()})),o+=u.move(">")):(a=n.enter("destinationRaw"),o+=u.move(n.safe(e.url,{before:o,after:e.title?" ":")",...u.current()}))),a(),e.title&&(a=n.enter(`title${s}`),o+=u.move(" "+i),o+=u.move(n.safe(e.title,{before:o,after:i,...u.current()})),o+=u.move(i),a()),o+=u.move(")"),l(),o}function gh(){return"!"}tl.peek=xh;function tl(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let l=n.enter("label");const a=n.createTracker(r);let u=a.move("![");const o=n.safe(e.alt,{before:u,after:"]",...a.current()});u+=a.move(o+"]["),l();const f=n.stack;n.stack=[],l=n.enter("reference");const c=n.safe(n.associationId(e),{before:u,after:"]",...a.current()});return l(),n.stack=f,s(),i==="full"||!o||o!==c?u+=a.move(c+"]"):i==="shortcut"?u=u.slice(0,-1):u+=a.move("]"),u}function xh(){return"!"}nl.peek=yh;function nl(e,t,n){let r=e.value||"",i="`",s=-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+" ");++s<n.unsafe.length;){const l=n.unsafe[s],a=n.compilePattern(l);let u;if(l.atBreak)for(;u=a.exec(r);){let o=u.index;r.charCodeAt(o)===10&&r.charCodeAt(o-1)===13&&o--,r=r.slice(0,o)+" "+r.slice(u.index+1)}}return i+r+i}function yh(){return"`"}function rl(e,t){const n=Dn(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))}il.peek=bh;function il(e,t,n,r){const i=$n(n),s=i==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let a,u;if(rl(e,n)){const f=n.stack;n.stack=[],a=n.enter("autolink");let c=l.move("<");return c+=l.move(n.containerPhrasing(e,{before:c,after:">",...l.current()})),c+=l.move(">"),a(),n.stack=f,c}a=n.enter("link"),u=n.enter("label");let o=l.move("[");return o+=l.move(n.containerPhrasing(e,{before:o,after:"](",...l.current()})),o+=l.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),o+=l.move("<"),o+=l.move(n.safe(e.url,{before:o,after:">",...l.current()})),o+=l.move(">")):(u=n.enter("destinationRaw"),o+=l.move(n.safe(e.url,{before:o,after:e.title?" ":")",...l.current()}))),u(),e.title&&(u=n.enter(`title${s}`),o+=l.move(" "+i),o+=l.move(n.safe(e.title,{before:o,after:i,...l.current()})),o+=l.move(i),u()),o+=l.move(")"),a(),o}function bh(e,t,n){return rl(e,n)?"<":"["}ll.peek=kh;function ll(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let l=n.enter("label");const a=n.createTracker(r);let u=a.move("[");const o=n.containerPhrasing(e,{before:u,after:"]",...a.current()});u+=a.move(o+"]["),l();const f=n.stack;n.stack=[],l=n.enter("reference");const c=n.safe(n.associationId(e),{before:u,after:"]",...a.current()});return l(),n.stack=f,s(),i==="full"||!o||o!==c?u+=a.move(c+"]"):i==="shortcut"?u=u.slice(0,-1):u+=a.move("]"),u}function kh(){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 wh(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 Sh(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 sl(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 Ch(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let l=e.ordered?Sh(n):Hn(n);const a=e.ordered?l==="."?")":".":wh(n);let u=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&&(u=!0),sl(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"){u=!0;break}}}}u&&(l=a),n.bulletCurrent=l;const o=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=s,i(),o}function vh(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 Eh(e,t,n,r){const i=vh(n);let s=n.bulletCurrent||Hn(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let l=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(l-s.length)),a.shift(l);const u=n.enter("listItem"),o=n.indentLines(n.containerFlow(e,a.current()),f);return u(),o;function f(c,h,p){return h?(p?"":" ".repeat(l))+c:(p?s:s+" ".repeat(l-s.length))+c}}function Nh(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),l=n.containerPhrasing(e,r);return s(),i(),l}const Ah=Ot(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Ih(e,t,n,r){return(e.children.some(function(l){return Ah(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Th(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}al.peek=jh;function al(e,t,n,r){const i=Th(n),s=n.enter("strong"),l=n.createTracker(r),a=l.move(i+i);let u=l.move(n.containerPhrasing(e,{after:i,before:a,...l.current()}));const o=u.charCodeAt(0),f=jt(r.before.charCodeAt(r.before.length-1),o,i);f.inside&&(u=at(o)+u.slice(1));const c=u.charCodeAt(u.length-1),h=jt(r.after.charCodeAt(0),c,i);h.inside&&(u=u.slice(0,-1)+at(c));const p=l.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:f.outside},a+u+p}function jh(e,t,n){return n.options.strong||"*"}function Ph(e,t,n,r){return n.safe(e.value,r)}function Rh(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 Dh(e,t,n){const r=(sl(n)+(n.options.ruleSpaces?" ":"")).repeat(Rh(n));return n.options.ruleSpaces?r.slice(0,-1):r}const ol={blockquote:nh,break:$r,code:oh,definition:ch,emphasis:Ji,hardBreak:$r,heading:dh,html:Zi,image:el,imageReference:tl,inlineCode:nl,link:il,linkReference:ll,list:Ch,listItem:Eh,paragraph:Nh,root:Ih,strong:al,text:Ph,thematicBreak:Dh};function Lh(){return{enter:{table:Oh,tableData:Hr,tableHeader:Hr,tableRow:Fh},exit:{codeText:_h,table:zh,tableData:sn,tableHeader:sn,tableRow:sn}}}function Oh(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 zh(e){this.exit(e),this.data.inTable=void 0}function Fh(e){this.enter({type:"tableRow",children:[]},e)}function sn(e){this.exit(e)}function Hr(e){this.enter({type:"tableCell",children:[]},e)}function _h(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Mh));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Mh(e,t){return t==="|"?t:e}function Bh(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
28
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:l,tableCell:u,tableRow:a}};function l(p,x,y,S){return o(f(p,y,S),p.align)}function a(p,x,y,S){const b=c(p,y,S),E=o([b]);return E.slice(0,E.indexOf(`
|
|
29
|
-
`))}function u(p,x,y,S){const b=y.enter("tableCell"),E=y.enter("phrasing"),v=y.containerPhrasing(p,{...S,before:s,after:s});return E(),b(),v}function o(p,x){return eh(p,{align:x,alignDelimiters:r,padding:n,stringLength:i})}function f(p,x,y){const S=p.children;let b=-1;const E=[],v=x.enter("table");for(;++b<S.length;)E[b]=c(S[b],x,y);return v(),E}function c(p,x,y){const S=p.children;let b=-1;const E=[],v=x.enter("tableRow");for(;++b<S.length;)E[b]=u(S[b],p,x,y);return v(),E}function h(p,x,y){let S=ol.inlineCode(p,x,y);return y.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function qh(){return{exit:{taskListCheckValueChecked:Ur,taskListCheckValueUnchecked:Ur,paragraph:Hh}}}function $h(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Uh}}}function Ur(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Hh(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 s=-1,l;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){l=a;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 Uh(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(l);let u=ol.listItem(e,t,n,{...r,...a.current()});return s&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,o)),u;function o(f){return f+l}}function Vh(){return[Cf(),Uf(),Qf(),Lh(),qh()]}function Kh(e){return{extensions:[vf(),Vf(e),Xf(),Bh(e),$h()]}}const Wh={tokenize:Zh,partial:!0},ul={tokenize:ep,partial:!0},cl={tokenize:tp,partial:!0},fl={tokenize:np,partial:!0},Qh={tokenize:rp,partial:!0},hl={name:"wwwAutolink",tokenize:Gh,previous:dl},pl={name:"protocolAutolink",tokenize:Jh,previous:ml},Ee={name:"emailAutolink",tokenize:Yh,previous:gl},Ce={};function Xh(){return{text:Ce}}let Fe=48;for(;Fe<123;)Ce[Fe]=Ee,Fe++,Fe===58?Fe=65:Fe===91&&(Fe=97);Ce[43]=Ee;Ce[45]=Ee;Ce[46]=Ee;Ce[95]=Ee;Ce[72]=[Ee,pl];Ce[104]=[Ee,pl];Ce[87]=[Ee,hl];Ce[119]=[Ee,hl];function Yh(e,t,n){const r=this;let i,s;return l;function l(c){return!kn(c)||!gl.call(r,r.previous)||Un(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(c))}function a(c){return kn(c)?(e.consume(c),a):c===64?(e.consume(c),u):n(c)}function u(c){return c===46?e.check(Qh,f,o)(c):c===45||c===95||le(c)?(s=!0,e.consume(c),u):f(c)}function o(c){return e.consume(c),i=!0,u}function f(c){return s&&i&&ue(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function Gh(e,t,n){const r=this;return i;function i(l){return l!==87&&l!==119||!dl.call(r,r.previous)||Un(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Wh,e.attempt(ul,e.attempt(cl,s),n),n)(l))}function s(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function Jh(e,t,n){const r=this;let i="",s=!1;return l;function l(c){return(c===72||c===104)&&ml.call(r,r.previous)&&!Un(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),a):n(c)}function a(c){if(ue(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),a;if(c===58){const h=i.toLowerCase();if(h==="http"||h==="https")return e.consume(c),u}return n(c)}function u(c){return c===47?(e.consume(c),s?o:(s=!0,u)):n(c)}function o(c){return c===null||It(c)||X(c)||_e(c)||Rt(c)?n(c):e.attempt(ul,e.attempt(cl,f),n)(c)}function f(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function Zh(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),s):n(l)}function s(l){return l===null?n(l):t(l)}}function ep(e,t,n){let r,i,s;return l;function l(o){return o===46||o===95?e.check(fl,u,a)(o):o===null||X(o)||_e(o)||o!==45&&Rt(o)?u(o):(s=!0,e.consume(o),l)}function a(o){return o===95?r=!0:(i=r,r=void 0),e.consume(o),l}function u(o){return i||r||!s?n(o):t(o)}}function tp(e,t){let n=0,r=0;return i;function i(l){return l===40?(n++,e.consume(l),i):l===41&&r<n?s(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(fl,t,s)(l):l===null||X(l)||_e(l)?t(l):(e.consume(l),i)}function s(l){return l===41&&r++,e.consume(l),i}}function np(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),s):a===93?(e.consume(a),i):a===60||a===null||X(a)||_e(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||X(a)||_e(a)?t(a):r(a)}function s(a){return ue(a)?l(a):n(a)}function l(a){return a===59?(e.consume(a),r):ue(a)?(e.consume(a),l):n(a)}}function rp(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return le(s)?n(s):t(s)}}function dl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||X(e)}function ml(e){return!ue(e)}function gl(e){return!(e===47||kn(e))}function kn(e){return e===43||e===45||e===46||e===95||le(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 ip={tokenize:hp,partial:!0};function lp(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:up,continuation:{tokenize:cp},exit:fp}},text:{91:{name:"gfmFootnoteCall",tokenize:op},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:sp,resolveTo:ap}}}}function sp(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const u=r.events[i][1];if(u.type==="labelImage"){l=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return a;function a(u){if(!l||!l._balanced)return n(u);const o=ye(r.sliceSerialize({start:l.end,end:r.now()}));return o.codePointAt(0)!==94||!s.includes(o.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function ap(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 s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function op(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,l;return a;function a(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),u}function u(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",o)}function o(c){if(s>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(ye(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return X(c)||(l=!0),s++,e.consume(c),c===92?f:o}function f(c){return c===91||c===92||c===93?(e.consume(c),s++,o):o(c)}}function up(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,l=0,a;return u;function u(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),o}function o(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):n(x)}function f(x){if(l>999||x===93&&!a||x===null||x===91||X(x))return n(x);if(x===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return s=ye(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return X(x)||(a=!0),l++,e.consume(x),x===92?c:f}function c(x){return x===91||x===92||x===93?(e.consume(x),l++,f):f(x)}function h(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),i.includes(s)||i.push(s),W(e,p,"gfmFootnoteDefinitionWhitespace")):n(x)}function p(x){return t(x)}}function cp(e,t,n){return e.check(ut,t,e.attempt(ip,t,n))}function fp(e){e.exit("gfmFootnoteDefinition")}function hp(e,t,n){const r=this;return W(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(s):n(s)}}function pp(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,a){let u=-1;for(;++u<l.length;)if(l[u][0]==="enter"&&l[u][1].type==="strikethroughSequenceTemporary"&&l[u][1]._close){let o=u;for(;o--;)if(l[o][0]==="exit"&&l[o][1].type==="strikethroughSequenceTemporary"&&l[o][1]._open&&l[u][1].end.offset-l[u][1].start.offset===l[o][1].end.offset-l[o][1].start.offset){l[u][1].type="strikethroughSequence",l[o][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},l[o][1].start),end:Object.assign({},l[u][1].end)},c={type:"strikethroughText",start:Object.assign({},l[o][1].end),end:Object.assign({},l[u][1].start)},h=[["enter",f,a],["enter",l[o][1],a],["exit",l[o][1],a],["enter",c,a]],p=a.parser.constructs.insideSpan.null;p&&me(h,h.length,0,Dt(p,l.slice(o+1,u),a)),me(h,h.length,0,[["exit",c,a],["enter",l[u][1],a],["exit",l[u][1],a],["exit",f,a]]),me(l,o-1,u-o+3,h),u=o+h.length-2;break}}for(u=-1;++u<l.length;)l[u][1].type==="strikethroughSequenceTemporary"&&(l[u][1].type="data");return l}function s(l,a,u){const o=this.previous,f=this.events;let c=0;return h;function h(x){return o===126&&f[f.length-1][1].type!=="characterEscape"?u(x):(l.enter("strikethroughSequenceTemporary"),p(x))}function p(x){const y=Ke(o);if(x===126)return c>1?u(x):(l.consume(x),c++,p);if(c<2&&!n)return u(x);const S=l.exit("strikethroughSequenceTemporary"),b=Ke(x);return S._open=!b||b===2&&!!y,S._close=!y||y===2&&!!b,a(x)}}}class dp{constructor(){this.map=[]}add(t,n,r){mp(this,t,n,r)}consume(t){if(this.map.sort(function(s,l){return s[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 s of i)t.push(s);i=r.pop()}this.map.length=0}}function mp(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 gp(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 s=r.length-1;r[s]=r[s]==="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 xp(){return{flow:{null:{name:"table",tokenize:yp,resolveAll:bp}}}}function yp(e,t,n){const r=this;let i=0,s=0,l;return a;function a(w){let L=r.events.length-1;for(;L>-1;){const F=r.events[L][1].type;if(F==="lineEnding"||F==="linePrefix")L--;else break}const N=L>-1?r.events[L][1].type:null,B=N==="tableHead"||N==="tableRow"?k:u;return B===k&&r.parser.lazy[r.now().line]?n(w):B(w)}function u(w){return e.enter("tableHead"),e.enter("tableRow"),o(w)}function o(w){return w===124||(l=!0,s+=1),f(w)}function f(w){return w===null?n(w):_(w)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),p):n(w):K(w)?W(e,f,"whitespace")(w):(s+=1,l&&(l=!1,i+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),l=!0,f):(e.enter("data"),c(w)))}function c(w){return w===null||w===124||X(w)?(e.exit("data"),f(w)):(e.consume(w),w===92?h:c)}function h(w){return w===92||w===124?(e.consume(w),c):c(w)}function p(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(e.enter("tableDelimiterRow"),l=!1,K(w)?W(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):x(w))}function x(w){return w===45||w===58?S(w):w===124?(l=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),y):D(w)}function y(w){return K(w)?W(e,S,"whitespace")(w):S(w)}function S(w){return w===58?(s+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(s+=1,b(w)):w===null||_(w)?R(w):D(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),E(w)):D(w)}function E(w){return w===45?(e.consume(w),E):w===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(w))}function v(w){return K(w)?W(e,R,"whitespace")(w):R(w)}function R(w){return w===124?x(w):w===null||_(w)?!l||i!==s?D(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):D(w)}function D(w){return n(w)}function k(w){return e.enter("tableRow"),z(w)}function z(w){return w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),z):w===null||_(w)?(e.exit("tableRow"),t(w)):K(w)?W(e,z,"whitespace")(w):(e.enter("data"),M(w))}function M(w){return w===null||w===124||X(w)?(e.exit("data"),z(w)):(e.consume(w),w===92?q:M)}function q(w){return w===92||w===124?(e.consume(w),M):M(w)}}function bp(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],l=[0,0,0,0],a=!1,u=0,o,f,c;const h=new dp;for(;++n<e.length;){const p=e[n],x=p[1];p[0]==="enter"?x.type==="tableHead"?(a=!1,u!==0&&(Vr(h,t,u,o,f),f=void 0,u=0),o={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},h.add(n,0,[["enter",o,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,c=void 0,s=[0,0,0,0],l=[0,n+1,0,0],a&&(a=!1,f={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},h.add(n,0,[["enter",f,t]])),i=x.type==="tableDelimiterRow"?2:f?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(s[1]!==0&&(l[0]=l[1],c=Ct(h,t,s,i,void 0,c),s=[0,0,0,0]),l[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(l[0]=l[1],c=Ct(h,t,s,i,void 0,c)),s=l,l=[s[1],n,0,0])):x.type==="tableHead"?(a=!0,u=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(u=n,s[1]!==0?(l[0]=l[1],c=Ct(h,t,s,i,n,c)):l[1]!==0&&(c=Ct(h,t,l,i,n,c)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(l[3]=n)}for(u!==0&&Vr(h,t,u,o,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=gp(t.events,n))}return e}function Ct(e,t,n,r,i,s){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},He(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const u=He(t.events,n[1]);if(s={type:l,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const o=He(t.events,n[2]),f=He(t.events,n[3]),c={type:a,start:Object.assign({},o),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 x=n[2]+1,y=n[3]-n[2]-1;e.add(x,y,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(s.end=Object.assign({},He(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Vr(e,t,n,r,i){const s=[],l=He(t.events,n);i&&(i.end=Object.assign({},l),s.push(["exit",i,t])),r.end=Object.assign({},l),s.push(["exit",r,t]),e.add(n+1,0,s)}function He(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const kp={name:"tasklistCheck",tokenize:Sp};function wp(){return{text:{91:kp}}}function Sp(e,t,n){const r=this;return i;function i(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),s)}function s(u){return X(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),l):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),l):n(u)}function l(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(u)}function a(u){return _(u)?t(u):K(u)?e.check({tokenize:Cp},t,n)(u):n(u)}}function Cp(e,t,n){return W(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function vp(e){return vi([Xh(),lp(),pp(e),xp(),wp()])}const Ep={};function Np(e){const t=this,n=e||Ep,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(vp(n)),s.push(Vh()),l.push(Kh(n))}const Kr=14e4,Wr=220;function Ap(e){return e.length<=Kr?e:`${e.slice(0,Kr)}
|
|
30
|
-
|
|
31
|
-
…`}function Ip(e){return e==="user"?A("chatRoleUser"):e==="assistant"?A("chatRoleAssistant"):e==="tool"?A("chatRoleTool"):e==="system"?A("chatRoleSystem"):A("chatRoleMessage")}function Tp(e){const t=e.toLowerCase();return t.includes("exec")||t.includes("shell")||t.includes("command")?d.jsx(Ml,{className:"h-3.5 w-3.5"}):t.includes("search")?d.jsx(Sn,{className:"h-3.5 w-3.5"}):t.includes("fetch")||t.includes("http")||t.includes("web")?d.jsx(Bl,{className:"h-3.5 w-3.5"}):t.includes("read")||t.includes("file")?d.jsx(ql,{className:"h-3.5 w-3.5"}):t.includes("message")||t.includes("send")?d.jsx($l,{className:"h-3.5 w-3.5"}):t.includes("cron")||t.includes("schedule")?d.jsx(Hl,{className:"h-3.5 w-3.5"}):d.jsx(En,{className:"h-3.5 w-3.5"})}function an({role:e}){return e==="user"?d.jsx("div",{className:"h-8 w-8 rounded-full bg-primary text-white flex items-center justify-center shadow-sm",children:d.jsx(_l,{className:"h-4 w-4"})}):e==="assistant"?d.jsx("div",{className:"h-8 w-8 rounded-full bg-slate-900 text-white flex items-center justify-center shadow-sm",children:d.jsx(Zr,{className:"h-4 w-4"})}):d.jsx("div",{className:"h-8 w-8 rounded-full bg-amber-100 text-amber-700 flex items-center justify-center shadow-sm",children:d.jsx(En,{className:"h-4 w-4"})})}function xl({text:e,role:t}){const n=t==="user";return d.jsx("div",{className:re("chat-markdown",n?"chat-markdown-user":"chat-markdown-assistant"),children:d.jsx(nf,{remarkPlugins:[Np],rehypePlugins:[xf],components:{a:({...r})=>d.jsx("a",{...r,target:"_blank",rel:"noreferrer noopener"})},children:Ap(e)})})}function Vn({card:e}){var l;const t=e.kind==="call"?A("chatToolCall"):A("chatToolResult"),n=((l=e.text)==null?void 0:l.trim())??"",r=n.length>Wr||n.includes(`
|
|
32
|
-
`),i=r?`${n.slice(0,Wr)}…`:n,s=e.kind==="result"||e.hasResult;return d.jsxs("div",{className:"rounded-xl border border-amber-200/80 bg-amber-50/60 px-3 py-2.5",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-amber-800 font-semibold",children:[Tp(e.name),d.jsx("span",{children:t}),typeof e._workflowStep=="number"&&d.jsxs("span",{className:"rounded-md bg-amber-100 px-1.5 py-0.5 text-[10px] text-amber-700",children:["#",e._workflowStep+1]}),d.jsx("span",{className:"font-mono text-[11px] text-amber-900/80",children:e.name})]}),e.detail&&d.jsx("div",{className:"mt-1 text-[11px] text-amber-800/90 font-mono break-words",children:e.detail}),s&&d.jsx("div",{className:"mt-2",children:n?r?d.jsxs("details",{className:"group",children:[d.jsx("summary",{className:"cursor-pointer text-[11px] text-amber-700",children:A("chatToolOutput")}),d.jsx("pre",{className:"mt-2 rounded-lg border border-amber-200 bg-amber-100/40 p-2 text-[11px] whitespace-pre-wrap break-words text-amber-900",children:n})]}):d.jsx("pre",{className:"rounded-lg border border-amber-200 bg-amber-100/40 p-2 text-[11px] whitespace-pre-wrap break-words text-amber-900",children:i}):d.jsx("div",{className:"text-[11px] text-amber-700/80",children:A("chatToolNoOutput")})})]})}function yl({cards:e}){const t=e.map(n=>n.name.trim()).filter(n=>n.length>0).join(" → ");return d.jsxs("details",{className:"rounded-xl border border-amber-200/80 bg-amber-50/50 p-3",children:[d.jsx("summary",{className:"cursor-pointer list-none",children:d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-amber-800 font-semibold",children:[d.jsx(En,{className:"h-3.5 w-3.5"}),d.jsx("span",{children:A("chatToolWorkflow")}),d.jsx("span",{className:"font-mono text-[11px] text-amber-900/90",children:t||"tool"}),d.jsx("span",{className:"rounded-md bg-amber-100 px-1.5 py-0.5 text-[10px] text-amber-700",children:e.length}),d.jsx("span",{className:"text-[11px] font-normal text-amber-700/90",children:A("chatToolWorkflowDetails")})]})}),d.jsx("div",{className:"mt-3 space-y-2",children:e.map((n,r)=>d.jsx(Vn,{card:{...n,_workflowStep:r}},`${n.kind}-${n.callId??n.name}-${r}`))})]})}function bl({reasoning:e,isUser:t}){return d.jsxs("details",{className:"mt-3",children:[d.jsx("summary",{className:re("cursor-pointer text-xs",t?"text-primary-100":"text-gray-500"),children:A("chatReasoning")}),d.jsx("pre",{className:re("mt-2 text-[11px] whitespace-pre-wrap break-words rounded-lg p-2",t?"bg-primary-700/60":"bg-gray-100"),children:e})]})}function jp({message:e}){const t=Os(e),n=zs(e.content).trim(),r=typeof e.reasoning_content=="string"?e.reasoning_content.trim():"",i=Fs(e),s=t==="user",l=!!n&&!(t==="tool"&&i.length>0);return d.jsxs("div",{className:re("rounded-2xl border px-4 py-3 shadow-sm",s?"bg-primary text-white border-primary":t==="assistant"?"bg-white text-gray-900 border-gray-200":"bg-orange-50/70 text-gray-900 border-orange-200/80"),children:[l&&d.jsx(xl,{text:n,role:t}),r&&d.jsx(bl,{reasoning:r,isUser:s}),i.length>0&&d.jsx("div",{className:re("space-y-2",(l||r)&&"mt-3"),children:i.length>1?d.jsx(yl,{cards:i}):i.map((a,u)=>d.jsx(Vn,{card:{...a}},`${a.kind}-${a.name}-${a.callId??u}`))})]})}function Pp({item:e}){const t=[];let n=0;for(;n<e.segments.length;){const r=e.segments[n];if(!r){n+=1;continue}if(r.kind==="assistant_message"){const l=!!r.text,a=!!r.reasoning;(l||a)&&t.push(d.jsxs("div",{children:[l&&d.jsx(xl,{text:r.text,role:"assistant"}),a&&d.jsx(bl,{reasoning:r.reasoning,isUser:!1})]},`${r.key}-${n}`)),n+=1;continue}const i=[];let s=n;for(;s<e.segments.length;){const l=e.segments[s];if(!l||l.kind!=="tool_card")break;i.push(l.card),s+=1}i.length>1?t.push(d.jsx(yl,{cards:i},`workflow-${r.key}-${n}`)):i.length===1&&t.push(d.jsx(Vn,{card:i[0]},`${r.key}-${n}`)),n=s}return d.jsx("div",{className:"rounded-2xl border px-4 py-3 shadow-sm bg-white text-gray-900 border-gray-200",children:d.jsx("div",{className:"space-y-3",children:t})})}function Rp({events:e,isSending:t,className:n}){const r=P.useMemo(()=>Ls(e),[e]);return d.jsxs("div",{className:re("space-y-5",n),children:[r.map(i=>{const s=i.kind==="assistant_turn"?"assistant":i.role,l=s==="user";return d.jsxs("div",{className:re("flex gap-3",l?"justify-end":"justify-start"),children:[!l&&d.jsx(an,{role:s}),d.jsxs("div",{className:re("max-w-[92%] min-w-[280px] space-y-2",l&&"flex flex-col items-end"),children:[i.kind==="assistant_turn"?d.jsx(Pp,{item:i}):d.jsx(jp,{message:i.message}),d.jsxs("div",{className:re("text-[11px] px-1",l?"text-primary-300":"text-gray-400"),children:[Ip(s)," · ",Pt(i.timestamp)]})]}),l&&d.jsx(an,{role:s})]},i.key)}),t&&d.jsxs("div",{className:"flex gap-3 justify-start",children:[d.jsx(an,{role:"assistant"}),d.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white px-4 py-3 text-sm text-gray-500 shadow-sm",children:A("chatTyping")})]})]})}var Ft="Popover",[kl]=Ql(Ft,[ri]),ht=ri(),[Dp,Re]=kl(Ft),wl=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:l=!1}=e,a=ht(t),u=P.useRef(null),[o,f]=P.useState(!1),[c,h]=Ul({prop:r,defaultProp:i??!1,onChange:s,caller:Ft});return d.jsx(Vl,{...a,children:d.jsx(Dp,{scope:t,contentId:Kl(),triggerRef:u,open:c,onOpenChange:h,onOpenToggle:P.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:o,onCustomAnchorAdd:P.useCallback(()=>f(!0),[]),onCustomAnchorRemove:P.useCallback(()=>f(!1),[]),modal:l,children:n})})};wl.displayName=Ft;var Sl="PopoverAnchor",Lp=P.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Re(Sl,n),s=ht(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:a}=i;return P.useEffect(()=>(l(),()=>a()),[l,a]),d.jsx(ni,{...s,...r,ref:t})});Lp.displayName=Sl;var Cl="PopoverTrigger",vl=P.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Re(Cl,n),s=ht(n),l=ei(t,i.triggerRef),a=d.jsx(ti.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Tl(i.open),...r,ref:l,onClick:tt(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:d.jsx(ni,{asChild:!0,...s,children:a})});vl.displayName=Cl;var Kn="PopoverPortal",[Op,zp]=kl(Kn,{forceMount:void 0}),El=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=Re(Kn,t);return d.jsx(Op,{scope:t,forceMount:n,children:d.jsx(li,{present:n||s.open,children:d.jsx(Wl,{asChild:!0,container:i,children:r})})})};El.displayName=Kn;var We="PopoverContent",Nl=P.forwardRef((e,t)=>{const n=zp(We,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=Re(We,e.__scopePopover);return d.jsx(li,{present:r||s.open,children:s.modal?d.jsx(_p,{...i,ref:t}):d.jsx(Mp,{...i,ref:t})})});Nl.displayName=We;var Fp=Gl("PopoverContent.RemoveScroll"),_p=P.forwardRef((e,t)=>{const n=Re(We,e.__scopePopover),r=P.useRef(null),i=ei(t,r),s=P.useRef(!1);return P.useEffect(()=>{const l=r.current;if(l)return Xl(l)},[]),d.jsx(Yl,{as:Fp,allowPinchZoom:!0,children:d.jsx(Al,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tt(e.onCloseAutoFocus,l=>{var a;l.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:tt(e.onPointerDownOutside,l=>{const a=l.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0,o=a.button===2||u;s.current=o},{checkForDefaultPrevented:!1}),onFocusOutside:tt(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),Mp=P.forwardRef((e,t)=>{const n=Re(We,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return d.jsx(Al,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var l,a;(l=e.onCloseAutoFocus)==null||l.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var u,o;(u=e.onInteractOutside)==null||u.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=s.target;((o=n.triggerRef.current)==null?void 0:o.contains(l))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),Al=P.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:a,onPointerDownOutside:u,onFocusOutside:o,onInteractOutside:f,...c}=e,h=Re(We,n),p=ht(n);return Jl(),d.jsx(Zl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:d.jsx(es,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:a,onPointerDownOutside:u,onFocusOutside:o,onDismiss:()=>h.onOpenChange(!1),children:d.jsx(ts,{"data-state":Tl(h.open),role:"dialog",id:h.contentId,...p,...c,ref:t,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Il="PopoverClose",Bp=P.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Re(Il,n);return d.jsx(ti.button,{type:"button",...r,ref:t,onClick:tt(e.onClick,()=>i.onOpenChange(!1))})});Bp.displayName=Il;var qp="PopoverArrow",$p=P.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ht(n);return d.jsx(ns,{...i,...r,ref:t})});$p.displayName=qp;function Tl(e){return e?"open":"closed"}var Hp=wl,Up=vl,Vp=El,jl=Nl;const Kp=Hp,Wp=Up,Pl=P.forwardRef(({className:e,sideOffset:t=8,align:n="start",...r},i)=>d.jsx(Vp,{children:d.jsx(jl,{ref:i,sideOffset:t,align:n,className:re("z-[var(--z-popover,50)] w-72 overflow-hidden rounded-2xl border border-gray-200/50 bg-white p-4 shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));Pl.displayName=jl.displayName;function Qp({records:e,isLoading:t=!1,selectedSkills:n,onSelectedSkillsChange:r}){const{language:i}=ai(),[s,l]=P.useState(""),a=P.useMemo(()=>new Set(n),[n]),u=n.length,o=P.useMemo(()=>{const c=s.trim().toLowerCase();return c?e.filter(h=>[h.label,h.spec,h.description,h.descriptionZh].filter(x=>typeof x=="string"&&x.trim().length>0).join(" ").toLowerCase().includes(c)):e},[s,e]),f=c=>{var p;const h=(p=c.spec)==null?void 0:p.trim();if(h){if(a.has(h)){r(n.filter(x=>x!==h));return}r([...n,h])}};return d.jsxs(Kp,{children:[d.jsx(Wp,{asChild:!0,children:d.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-gray-600 hover:bg-gray-100 hover:text-gray-900 transition-colors",children:[d.jsx(vn,{className:"h-4 w-4"}),d.jsx("span",{children:A("chatSkillsPickerTitle")}),u>0&&d.jsx("span",{className:"ml-0.5 min-w-[18px] h-[18px] flex items-center justify-center rounded-full bg-primary/10 text-primary text-[10px] font-semibold",children:u})]})}),d.jsxs(Pl,{side:"top",align:"start",className:"w-[360px] p-0",children:[d.jsxs("div",{className:"space-y-2 border-b border-gray-100 px-4 py-3",children:[d.jsx("div",{className:"text-sm font-semibold text-gray-900",children:A("chatSkillsPickerTitle")}),d.jsxs("div",{className:"relative",children:[d.jsx(Sn,{className:"pointer-events-none absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400"}),d.jsx(Nn,{value:s,onChange:c=>l(c.target.value),placeholder:A("chatSkillsPickerSearchPlaceholder"),className:"h-8 rounded-lg pl-8 text-xs"})]})]}),d.jsx("div",{className:"max-h-[320px] overflow-y-auto custom-scrollbar",children:t?d.jsx("div",{className:"p-4 text-xs text-gray-500",children:A("sessionsLoading")}):o.length===0?d.jsx("div",{className:"p-4 text-xs text-gray-500 text-center",children:A("chatSkillsPickerEmpty")}):d.jsx("div",{className:"py-1",children:o.map(c=>{var h,p;return d.jsxs("button",{type:"button",onClick:()=>f(c),className:"flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-gray-50",children:[d.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500",children:d.jsx(rs,{className:"h-4 w-4"})}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("span",{className:"truncate text-sm text-gray-900",children:c.label||c.spec}),c.origin==="builtin"&&d.jsx("span",{className:"shrink-0 text-[10px] bg-primary/10 text-primary px-1.5 py-0.5 rounded-full font-medium",children:A("chatSkillsPickerOfficial")})]}),d.jsx("div",{className:"mt-0.5 truncate text-xs text-gray-500",children:((h=i==="zh"?c.descriptionZh:c.description)==null?void 0:h.trim())||((p=c.description)==null?void 0:p.trim())||A("chatSkillsPickerNoDescription")})]}),d.jsx("div",{className:"ml-3 shrink-0",children:d.jsx("span",{className:a.has(c.spec)?"inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-white":"inline-flex h-5 w-5 items-center justify-center rounded-full border border-gray-300 bg-white",children:a.has(c.spec)&&d.jsx(is,{className:"h-3 w-3"})})})]},c.spec)})})}),d.jsx("div",{className:"px-4 py-2.5 border-t border-gray-100",children:d.jsxs(un,{to:"/marketplace/skills",className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary hover:text-primary/80 transition-colors",children:[A("chatSkillsPickerManage"),d.jsx(ls,{className:"h-3 w-3"})]})})]})]})}function Xp({draft:e,onDraftChange:t,onSend:n,onStop:r,onGoToProviders:i,canStopGeneration:s,stopDisabledReason:l=null,sendError:a=null,isSending:u,queuedCount:o,modelOptions:f,selectedModel:c,onSelectedModelChange:h,skillRecords:p,isSkillsLoading:x=!1,selectedSkills:y,onSelectedSkillsChange:S}){const b=f.length>0,E=!b&&!u,v=f.find(k=>k.value===c),R=l==="__preparing__"?A("chatStopPreparing"):(l==null?void 0:l.trim())||A("chatStopUnavailable"),D=y.map(k=>{const z=p.find(M=>M.spec===k);return{spec:k,label:(z==null?void 0:z.label)||k}});return d.jsx("div",{className:"border-t border-gray-200/80 bg-white p-4",children:d.jsx("div",{className:"mx-auto w-full max-w-[min(1120px,100%)]",children:d.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-card overflow-hidden",children:[d.jsx("textarea",{value:e,onChange:k=>t(k.target.value),disabled:E,onKeyDown:k=>{if(k.key==="Escape"&&u&&s){k.preventDefault(),r();return}k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),n())},placeholder:b?A("chatInputPlaceholder"):A("chatModelNoOptions"),className:"w-full min-h-[68px] max-h-[220px] resize-y bg-transparent outline-none text-sm px-4 py-3 text-gray-800 placeholder:text-gray-400"}),!b&&d.jsx("div",{className:"px-4 pb-2",children:d.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-1.5 text-xs text-amber-800",children:[d.jsx("span",{children:A("chatModelNoOptions")}),d.jsx("button",{type:"button",onClick:i,className:"font-semibold text-amber-900 underline-offset-2 hover:underline",children:A("chatGoConfigureProvider")})]})}),D.length>0&&d.jsx("div",{className:"px-4 pb-2",children:d.jsx("div",{className:"flex flex-wrap items-center gap-2",children:D.map(k=>d.jsxs("button",{type:"button",onClick:()=>S(y.filter(z=>z!==k.spec)),className:"inline-flex max-w-[200px] items-center gap-1.5 rounded-full bg-primary/10 px-2.5 py-1 text-xs font-medium text-primary",children:[d.jsx("span",{className:"truncate",children:k.label}),d.jsx(ss,{className:"h-3 w-3 shrink-0"})]},k.spec))})}),d.jsxs("div",{className:"flex items-center justify-between px-3 pb-3",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(Qp,{records:p,isLoading:x,selectedSkills:y,onSelectedSkillsChange:S}),d.jsxs(Et,{value:b?c:void 0,onValueChange:h,disabled:!b,children:[d.jsx(Nt,{className:"h-8 w-auto min-w-[220px] rounded-lg border-0 bg-transparent shadow-none text-xs font-medium text-gray-600 hover:bg-gray-100 focus:ring-0 px-3",children:v?d.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-left",children:[d.jsx(as,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),d.jsxs("span",{className:"truncate text-xs font-semibold text-gray-700",children:[v.providerLabel,"/",v.modelLabel]})]}):d.jsx(oi,{placeholder:A("chatSelectModel")})}),d.jsxs(At,{className:"w-[320px]",children:[f.length===0&&d.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:A("chatModelNoOptions")}),f.map(k=>d.jsx(Ue,{value:k.value,className:"py-2",children:d.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[d.jsx("span",{className:"truncate text-xs font-semibold text-gray-800",children:k.modelLabel}),d.jsx("span",{className:"truncate text-[11px] text-gray-500",children:k.providerLabel})]})},k.value))]})]}),d.jsx(Qn,{children:d.jsxs(Xn,{children:[d.jsx(Yn,{asChild:!0,children:d.jsx("button",{type:"button",disabled:!0,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-gray-400 cursor-not-allowed",children:d.jsx(os,{className:"h-4 w-4"})})}),d.jsx(Gn,{side:"top",children:d.jsx("p",{className:"text-xs",children:A("chatInputAttachComingSoon")})})]})})]}),d.jsxs("div",{className:"flex flex-col items-end gap-1",children:[(a==null?void 0:a.trim())&&d.jsx("div",{className:"max-w-[420px] text-right text-[11px] text-red-600",children:a}),d.jsxs("div",{className:"flex items-center gap-2",children:[u&&o>0&&d.jsxs("span",{className:"text-[11px] text-gray-400",children:[A("chatQueuedHintPrefix")," ",o," ",A("chatQueuedHintSuffix")]}),u?s?d.jsxs(Se,{size:"sm",variant:"destructive",className:"rounded-lg",onClick:()=>void r(),children:[d.jsx(Wn,{className:"h-3.5 w-3.5 mr-1.5"}),A("chatStop")]}):d.jsx(Qn,{children:d.jsxs(Xn,{children:[d.jsx(Yn,{asChild:!0,children:d.jsx("span",{children:d.jsxs(Se,{size:"sm",className:"rounded-lg",disabled:!0,children:[d.jsx(Wn,{className:"h-3.5 w-3.5 mr-1.5"}),A("chatStop")]})})}),d.jsx(Gn,{side:"top",children:d.jsx("p",{className:"text-xs",children:R})})]})}):d.jsxs(Se,{size:"sm",className:"rounded-lg",onClick:()=>void n(),disabled:e.trim().length===0||!b,children:[d.jsx(us,{className:"h-3.5 w-3.5 mr-1.5"}),A("chatSend")]})]})]})]})]})})})}const Yp=[{icon:cs,titleKey:"chatWelcomeCapability1Title",descKey:"chatWelcomeCapability1Desc"},{icon:vn,titleKey:"chatWelcomeCapability2Title",descKey:"chatWelcomeCapability2Desc"},{icon:Cn,titleKey:"chatWelcomeCapability3Title",descKey:"chatWelcomeCapability3Desc"}];function Gp({onCreateSession:e}){return d.jsx("div",{className:"h-full flex items-center justify-center p-8",children:d.jsxs("div",{className:"max-w-lg w-full text-center",children:[d.jsx("div",{className:"mx-auto mb-6 h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center",children:d.jsx(Zr,{className:"h-8 w-8 text-primary"})}),d.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:A("chatWelcomeTitle")}),d.jsx("p",{className:"text-sm text-gray-500 mb-8",children:A("chatWelcomeSubtitle")}),d.jsx("div",{className:"grid grid-cols-3 gap-3",children:Yp.map(t=>{const n=t.icon;return d.jsxs("button",{onClick:e,className:"rounded-2xl border border-gray-200 bg-white p-4 text-left shadow-card hover:shadow-card-hover transition-shadow cursor-pointer",children:[d.jsx("div",{className:"h-9 w-9 rounded-xl bg-primary/8 flex items-center justify-center mb-3",children:d.jsx(n,{className:"h-4.5 w-4.5 text-primary"})}),d.jsx("div",{className:"text-sm font-semibold text-gray-900 mb-1",children:A(t.titleKey)}),d.jsx("div",{className:"text-[11px] text-gray-500 leading-relaxed",children:A(t.descKey)})]},t.titleKey)})})]})})}function Jp({modelOptions:e,selectedModel:t,onSelectedModelChange:n,onGoToProviders:r,skillRecords:i,isSkillsLoading:s=!1,selectedSkills:l,onSelectedSkillsChange:a,selectedSessionKey:u,sessionDisplayName:o,canDeleteSession:f,isDeletePending:c,onDeleteSession:h,onCreateSession:p,threadRef:x,onThreadScroll:y,isHistoryLoading:S,mergedEvents:b,isSending:E,isAwaitingAssistantOutput:v,streamingAssistantText:R,draft:D,onDraftChange:k,onSend:z,onStop:M,canStopGeneration:q,stopDisabledReason:w,sendError:L,queuedCount:N}){const B=!u&&b.length===0,F=e.length>0,j=S&&b.length===0&&!E&&!v&&!R.trim(),V=!F&&!u&&b.length===0&&!j&&!E;return d.jsxs("section",{className:"flex-1 min-h-0 flex flex-col overflow-hidden bg-gradient-to-b from-gray-50/60 to-white",children:[u&&d.jsxs("div",{className:"px-5 py-3 border-b border-gray-200/60 bg-white/80 backdrop-blur-sm flex items-center justify-between shrink-0",children:[d.jsx("div",{className:"min-w-0 flex-1",children:d.jsx("span",{className:"text-sm font-medium text-gray-700 truncate",children:o||u})}),d.jsx(Se,{variant:"ghost",size:"icon",className:"rounded-lg shrink-0 text-gray-400 hover:text-destructive",onClick:h,disabled:!f||c,children:d.jsx(ii,{className:"h-4 w-4"})})]}),!F&&!B&&d.jsxs("div",{className:"px-5 py-2.5 border-b border-amber-200/70 bg-amber-50/70 flex items-center justify-between gap-3 shrink-0",children:[d.jsx("span",{className:"text-xs text-amber-800",children:A("chatModelNoOptions")}),d.jsx("button",{type:"button",onClick:r,className:"text-xs font-semibold text-amber-900 underline-offset-2 hover:underline",children:A("chatGoConfigureProvider")})]}),d.jsx("div",{ref:x,onScroll:y,className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar",children:B?V?d.jsx("div",{className:"h-full flex items-center justify-center p-8",children:d.jsxs("div",{className:"w-full max-w-xl rounded-2xl border border-amber-200 bg-amber-50/70 p-6 text-center",children:[d.jsx("h2",{className:"text-lg font-semibold text-amber-900",children:A("chatProviderSetupTitle")}),d.jsx("p",{className:"mt-2 text-sm text-amber-800",children:A("chatProviderSetupDescription")}),d.jsx(Se,{className:"mt-4",onClick:r,children:A("chatGoConfigureProvider")})]})}):d.jsx(Gp,{onCreateSession:p}):j?d.jsx("div",{className:"h-full"}):b.length===0?d.jsx("div",{className:"px-5 py-5 text-sm text-gray-500",children:A("chatNoMessages")}):d.jsx("div",{className:"mx-auto w-full max-w-[min(1120px,100%)] px-6 py-5",children:d.jsx(Rp,{events:b,isSending:E&&v})})}),d.jsx(Xp,{draft:D,onDraftChange:k,onSend:z,onStop:M,onGoToProviders:r,canStopGeneration:q,stopDisabledReason:w,sendError:L,isSending:E,queuedCount:N,modelOptions:e,selectedModel:t,onSelectedModelChange:n,skillRecords:i,isSkillsLoading:s,selectedSkills:l,onSelectedSkillsChange:a})]})}function Qr(e){return Pt(e??void 0)}function Zp(e){return typeof e!="number"||!Number.isFinite(e)?"-":Pt(new Date(e))}function ed(e){if(typeof e!="number"||!Number.isFinite(e))return"-";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}function td(e){const t=e.schedule;return t.kind==="cron"?t.expr?`cron ${t.expr}`:"cron":t.kind==="every"?`every ${ed(t.everyMs)}`:t.kind==="at"?`at ${Zp(t.atMs)}`:"-"}function nd(e){if(!e.payload.deliver)return"-";const t=e.payload.channel??"-",n=e.payload.to??"-";return`${t}:${n}`}function rd(e,t){const n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.channel??"",e.payload.to??""].join(" ").toLowerCase().includes(n):!0}function id(e,t){return t==="all"?!0:t==="enabled"?e.enabled:!e.enabled}function ld(){var x;const[e,t]=P.useState(""),[n,r]=P.useState("all"),i=xs({all:!0}),s=ys(),l=bs(),a=ks(),{confirm:u,ConfirmDialog:o}=si(),f=P.useMemo(()=>{var S;return(((S=i.data)==null?void 0:S.jobs)??[]).filter(b=>rd(b,e)).filter(b=>id(b,n))},[i.data,e,n]),c=async y=>{await u({title:`${A("cronDeleteConfirm")}?`,description:y.name?`${y.name} (${y.id})`:y.id,variant:"destructive",confirmLabel:A("delete")})&&s.mutate({id:y.id})},h=async y=>{const S=!y.enabled;await u({title:S?`${A("cronEnableConfirm")}?`:`${A("cronDisableConfirm")}?`,description:y.name?`${y.name} (${y.id})`:y.id,variant:S?"default":"destructive",confirmLabel:S?A("cronEnable"):A("cronDisable")})&&l.mutate({id:y.id,enabled:S})},p=async y=>{const S=!y.enabled;await u({title:S?`${A("cronRunForceConfirm")}?`:`${A("cronRunConfirm")}?`,description:y.name?`${y.name} (${y.id})`:y.id,confirmLabel:A("cronRunNow")})&&a.mutate({id:y.id,force:S})};return d.jsxs(Ps,{fullHeight:!0,children:[d.jsx(Rs,{title:A("cronPageTitle"),description:A("cronPageDescription"),actions:d.jsx(Se,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100",onClick:()=>i.refetch(),children:d.jsx(fs,{className:re("h-4 w-4",i.isFetching&&"animate-spin")})})}),d.jsx("div",{className:"mb-6",children:d.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[d.jsxs("div",{className:"relative flex-1 min-w-[240px]",children:[d.jsx(Nn,{value:e,onChange:y=>t(y.target.value),placeholder:A("cronSearchPlaceholder"),className:"pl-9"}),d.jsx(Cn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"})]}),d.jsx("div",{className:"min-w-[180px]",children:d.jsxs(Et,{value:n,onValueChange:y=>r(y),children:[d.jsx(Nt,{className:"w-full",children:d.jsx(oi,{placeholder:A("cronStatusLabel")})}),d.jsxs(At,{children:[d.jsx(Ue,{value:"all",children:A("cronStatusAll")}),d.jsx(Ue,{value:"enabled",children:A("cronStatusEnabled")}),d.jsx(Ue,{value:"disabled",children:A("cronStatusDisabled")})]})]})}),d.jsxs("div",{className:"text-xs text-gray-500 ml-auto",children:[A("cronTotalLabel"),": ",((x=i.data)==null?void 0:x.total)??0," / ",f.length]})]})}),d.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:i.isLoading?d.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:A("cronLoading")}):f.length===0?d.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:A("cronEmpty")}):d.jsx("div",{className:"space-y-4",children:f.map(y=>d.jsx(Ms,{className:"border border-gray-200",children:d.jsx(Bs,{className:"pt-5 pb-5",children:d.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[d.jsxs("div",{className:"min-w-[220px] flex-1",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-sm font-semibold text-gray-900",children:y.name||y.id}),d.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500",children:y.id}),d.jsx("span",{className:re("text-[10px] font-semibold px-2 py-0.5 rounded-full",y.enabled?"bg-emerald-50 text-emerald-700":"bg-gray-100 text-gray-500"),children:y.enabled?A("enabled"):A("disabled")}),y.deleteAfterRun&&d.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-amber-50 text-amber-700",children:A("cronOneShot")})]}),d.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[A("cronScheduleLabel"),": ",td(y)]}),d.jsx("div",{className:"mt-2 text-sm text-gray-700 whitespace-pre-wrap break-words",children:y.payload.message}),d.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[A("cronDeliverTo"),": ",nd(y)]})]}),d.jsxs("div",{className:"min-w-[220px] text-xs text-gray-500 space-y-2",children:[d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium text-gray-700",children:[A("cronNextRun"),":"]})," ",Qr(y.state.nextRunAt)]}),d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium text-gray-700",children:[A("cronLastRun"),":"]})," ",Qr(y.state.lastRunAt)]}),d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium text-gray-700",children:[A("cronLastStatus"),":"]})," ",y.state.lastStatus??"-"]}),y.state.lastError&&d.jsx("div",{className:"text-[11px] text-red-500 break-words",children:y.state.lastError})]}),d.jsxs("div",{className:"flex items-start gap-2 flex-wrap justify-end",children:[d.jsxs(Se,{variant:"subtle",size:"sm",onClick:()=>p(y),className:"gap-1",children:[d.jsx(hs,{className:"h-3.5 w-3.5"}),A("cronRunNow")]}),d.jsxs(Se,{variant:y.enabled?"outline":"primary",size:"sm",onClick:()=>h(y),className:"gap-1",children:[d.jsx(ps,{className:"h-3.5 w-3.5"}),y.enabled?A("cronDisable"):A("cronEnable")]}),d.jsxs(Se,{variant:"destructive",size:"sm",onClick:()=>c(y),className:"gap-1",children:[d.jsx(ii,{className:"h-3.5 w-3.5"}),A("delete")]})]})]})})},y.id))})}),d.jsx(o,{})]})}function sd(e){if(e instanceof Error){const n=e.message.trim();if(n)return n}return String(e??"").trim()||"Failed to send message"}function Rl(e){e.setIsSending(!1),e.setOptimisticUserEvent(null),e.setStreamingSessionEvents([]),e.setStreamingAssistantText(""),e.setStreamingAssistantTimestamp(null),e.setIsAwaitingAssistantOutput(!1),e.setCanStopCurrentRun(!1),e.setStopDisabledReason(null),e.setLastSendError(null)}function ad(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const r=n.trim();r&&t.add(r)}return[...t]}function od(e){if(e instanceof DOMException&&e.name==="AbortError")return!0;if(e instanceof Error){if(e.name==="AbortError")return!0;const t=e.message.toLowerCase();if(t.includes("aborted")||t.includes("abort"))return!0}return!1}function on(e,t="message.assistant.local"){const n=new Date().toISOString();return{seq:Date.now(),type:t,timestamp:n,message:{role:"assistant",content:e,timestamp:n}}}async function Xr(e){await e.refetchSessions();const t=e.selectedSessionKeyRef.current;(!t||t===e.currentSessionKey||e.resultSessionKey&&t===e.resultSessionKey)&&await e.refetchHistory()}async function ud(e){const{item:t,runId:n,runIdRef:r,activeRunRef:i,nextOptimisticUserSeq:s,selectedSessionKeyRef:l,setSelectedSessionKey:a,setDraft:u,refetchSessions:o,refetchHistory:f,restoreDraftOnError:c,setters:h}=e,p=new AbortController;i.current={localRunId:n,sessionKey:t.sessionKey,agentId:t.agentId,requestAbortController:p,backendStopSupported:!!t.stopSupported,...t.stopReason?{backendStopReason:t.stopReason}:{}},h.setStreamingSessionEvents([]),h.setStreamingAssistantText(""),h.setStreamingAssistantTimestamp(null),h.setOptimisticUserEvent({seq:s,type:"message.user.optimistic",timestamp:new Date().toISOString(),message:{role:"user",content:t.message,timestamp:new Date().toISOString()}}),h.setIsSending(!0),h.setIsAwaitingAssistantOutput(!0),h.setCanStopCurrentRun(!1),h.setStopDisabledReason(t.stopSupported?"__preparing__":t.stopReason??null),h.setLastSendError(null);let x="";try{let y=!1;const S=new Date().toISOString();h.setStreamingAssistantTimestamp(S);const b=ad(t.requestedSkills),E=await Ss({message:t.message,sessionKey:t.sessionKey,agentId:t.agentId,...t.model?{model:t.model}:{},...b.length>0?{metadata:{requested_skills:b}}:{},channel:"ui",chatId:"web-ui"},{signal:p.signal,onReady:R=>{var k;if(n!==r.current)return;const D=i.current;if(D&&D.localRunId===n){D.backendRunId=((k=R.runId)==null?void 0:k.trim())||void 0,typeof R.stopSupported=="boolean"&&(D.backendStopSupported=R.stopSupported),typeof R.stopReason=="string"&&R.stopReason.trim().length>0&&(D.backendStopReason=R.stopReason.trim());const z=!!(D.backendStopSupported&&D.backendRunId);h.setCanStopCurrentRun(z),h.setStopDisabledReason(z?null:D.backendStopReason??(D.backendStopSupported?"__preparing__":null))}R.sessionKey&&a(z=>z===R.sessionKey?z:R.sessionKey)},onDelta:R=>{n===r.current&&(x+=R.delta,h.setStreamingAssistantText(x),h.setIsAwaitingAssistantOutput(!1))},onSessionEvent:R=>{var D,k;n===r.current&&(((D=R.data.message)==null?void 0:D.role)==="user"&&h.setOptimisticUserEvent(null),h.setStreamingSessionEvents(z=>{const M=[...z],q=M.findIndex(w=>w.seq===R.data.seq);return q>=0?M[q]=R.data:M.push(R.data),M}),((k=R.data.message)==null?void 0:k.role)==="assistant"&&(y=!0,x="",h.setStreamingAssistantText(""),h.setIsAwaitingAssistantOutput(!1)))}});if(n!==r.current)return;h.setOptimisticUserEvent(null),E.sessionKey!==t.sessionKey&&a(E.sessionKey);const v=y?"":x.trim();await Xr({selectedSessionKeyRef:l,currentSessionKey:t.sessionKey,resultSessionKey:E.sessionKey,refetchSessions:o,refetchHistory:f}),h.setStreamingSessionEvents(v?[on(v)]:[]),h.setStreamingAssistantText(""),h.setStreamingAssistantTimestamp(null),h.setIsAwaitingAssistantOutput(!1),h.setIsSending(!1),h.setCanStopCurrentRun(!1),h.setStopDisabledReason(null),h.setLastSendError(null),i.current=null}catch(y){if(n!==r.current)return;const S=p.signal.aborted||od(y);if(r.current+=1,S){const E=x.trim();h.setOptimisticUserEvent(null),h.setStreamingAssistantText(""),h.setStreamingAssistantTimestamp(null),h.setIsSending(!1),h.setIsAwaitingAssistantOutput(!1),h.setCanStopCurrentRun(!1),h.setStopDisabledReason(null),h.setLastSendError(null),i.current=null,await Xr({selectedSessionKeyRef:l,currentSessionKey:t.sessionKey,refetchSessions:o,refetchHistory:f}),h.setStreamingSessionEvents(E?[on(E)]:[]);return}Rl(h);const b=sd(y);h.setLastSendError(b),h.setStreamingSessionEvents([on(b,"message.assistant.error.local")]),i.current=null,c&&u(E=>E.trim().length===0?t.message:E)}}function cd(e){const[t,n]=P.useState(null),[r,i]=P.useState([]),[s,l]=P.useState(""),[a,u]=P.useState(null),[o,f]=P.useState(!1),[c,h]=P.useState(!1),[p,x]=P.useState([]),[y,S]=P.useState(!1),[b,E]=P.useState(null),[v,R]=P.useState(null),D=P.useRef(0),k=P.useRef(0),z=P.useRef(null),M=P.useCallback(()=>{var N;D.current+=1,x([]),(N=z.current)==null||N.requestAbortController.abort(),z.current=null,Rl({setOptimisticUserEvent:n,setStreamingSessionEvents:i,setStreamingAssistantText:l,setStreamingAssistantTimestamp:u,setIsSending:f,setIsAwaitingAssistantOutput:h,setCanStopCurrentRun:S,setStopDisabledReason:E,setLastSendError:R})},[]);P.useEffect(()=>()=>{var N;D.current+=1,(N=z.current)==null||N.requestAbortController.abort(),z.current=null},[]);const q=P.useCallback(async(N,B)=>{R(null),D.current+=1,await ud({item:N,runId:D.current,runIdRef:D,activeRunRef:z,nextOptimisticUserSeq:e.nextOptimisticUserSeq,selectedSessionKeyRef:e.selectedSessionKeyRef,setSelectedSessionKey:e.setSelectedSessionKey,setDraft:e.setDraft,refetchSessions:e.refetchSessions,refetchHistory:e.refetchHistory,restoreDraftOnError:B==null?void 0:B.restoreDraftOnError,setters:{setOptimisticUserEvent:n,setStreamingSessionEvents:i,setStreamingAssistantText:l,setStreamingAssistantTimestamp:u,setIsSending:f,setIsAwaitingAssistantOutput:h,setCanStopCurrentRun:S,setStopDisabledReason:E,setLastSendError:R}})},[e]);P.useEffect(()=>{if(o||p.length===0)return;const[N,...B]=p;x(B),q(N,{restoreDraftOnError:!0})},[o,p,q]);const w=P.useCallback(async N=>{R(null),k.current+=1;const B={id:k.current,message:N.message,sessionKey:N.sessionKey,agentId:N.agentId,...N.model?{model:N.model}:{},...N.requestedSkills&&N.requestedSkills.length>0?{requestedSkills:N.requestedSkills}:{},...typeof N.stopSupported=="boolean"?{stopSupported:N.stopSupported}:{},...N.stopReason?{stopReason:N.stopReason}:{}};if(o){x(F=>[...F,B]);return}await q(B,{restoreDraftOnError:N.restoreDraftOnError})},[o,q]),L=P.useCallback(async()=>{const N=z.current;if(N&&N.backendStopSupported){if(S(!1),x([]),N.backendRunId)try{await ws({runId:N.backendRunId,sessionKey:N.sessionKey,agentId:N.agentId})}catch{}N.requestAbortController.abort()}},[]);return{optimisticUserEvent:t,streamingSessionEvents:r,streamingAssistantText:s,streamingAssistantTimestamp:a,isSending:o,isAwaitingAssistantOutput:c,queuedCount:p.length,canStopCurrentRun:y,stopDisabledReason:b,lastSendError:v,sendMessage:w,stopCurrentRun:L,resetStreamState:M}}const wn="sid_";function fd(e){var r;const t=/^agent:([^:]+):/i.exec(e.trim());if(!t)return null;const n=(r=t[1])==null?void 0:r.trim();return n||null}function hd(e){const t=Math.random().toString(36).slice(2,8);return`agent:${e}:ui:direct:web-${Date.now().toString(36)}${t}`}function pd(e){const t=new TextEncoder().encode(e);let n="";for(const i of t)n+=String.fromCharCode(i);const r=btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"");return`${wn}${r}`}function dd(e){if(!e.startsWith(wn))return null;const t=e.slice(wn.length).replace(/-/g,"+").replace(/_/g,"/"),n=t.length%4===0?"":"=".repeat(4-t.length%4);try{const r=atob(t+n),i=Uint8Array.from(r,s=>s.charCodeAt(0));return new TextDecoder().decode(i)}catch{return null}}function md(e){if(!e)return null;const t=dd(e);if(t)return t;try{return decodeURIComponent(e)}catch{return e}}function Yr(e){return`/chat/${pd(e)}`}function Gr(e){if(e.label&&e.label.trim())return e.label.trim();const t=e.key.split(":");return t[t.length-1]||e.key}function gd(e){const{view:t,routeSessionKey:n,selectedSessionKey:r,selectedAgentId:i,setSelectedSessionKey:s,setSelectedAgentId:l,selectedSessionKeyRef:a,isUserScrollingRef:u,resetStreamState:o}=e;P.useEffect(()=>{if(t==="chat"){if(n){r!==n&&s(n);return}r!==null&&(s(null),o())}},[o,n,r,s,t]),P.useEffect(()=>{const f=r?fd(r):null;f&&i!==f&&l(f)},[i,r,l]),P.useEffect(()=>{a.current=r,u.current=!1},[u,r,a])}function xd(e){const{threadRef:t,isUserScrollingRef:n,mergedEvents:r,isSending:i}=e,s=P.useCallback(()=>{const a=t.current;return a?a.scrollHeight-a.scrollTop-a.clientHeight<50:!0},[t]),l=P.useCallback(()=>{s()?n.current=!1:n.current=!0},[s,n]);return P.useEffect(()=>{const a=t.current;!a||n.current||(a.scrollTop=a.scrollHeight)},[i,n,r,t]),{handleScroll:l}}function yd({view:e,sidebarProps:t,conversationProps:n,confirmDialog:r}){return d.jsxs("div",{className:"h-full flex",children:[d.jsx(Vs,{...t}),e==="chat"?d.jsx(Jp,{...n}):d.jsx("section",{className:"flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white",children:d.jsx("div",{className:"h-full overflow-auto custom-scrollbar",children:d.jsx("div",{className:"mx-auto w-full max-w-[min(1120px,100%)] px-6 py-5",children:e==="cron"?d.jsx(ld,{}):d.jsx(js,{forcedType:"skills"})})})}),r]})}function Td({view:e}){var yt,bt,C,T,$;const[t,n]=P.useState(""),[r,i]=P.useState(""),[s,l]=P.useState(null),[a,u]=P.useState("main"),[o,f]=P.useState(""),[c,h]=P.useState([]),{confirm:p,ConfirmDialog:x}=si(),y=ds(),S=ms(),{sessionId:b}=gs(),E=P.useRef(null),v=P.useRef(!1),R=P.useRef(s),D=P.useMemo(()=>md(b),[b]),k=Cs(),z=vs(),M=Es({q:t.trim()||void 0,limit:120,activeMinutes:0}),q=Ts("skill"),w=Ns({sessionKey:s,agentId:a}),L=As(s,300),N=Is(),B=P.useMemo(()=>{const O=qs({meta:z.data,config:k.data,onlyConfigured:!0}),H=new Set,G=[];for(const Z of O)for(const J of Z.models){const ie=$s(Z.prefix,J);!ie||H.has(ie)||(H.add(ie),G.push({value:ie,modelLabel:J,providerLabel:Z.displayName}))}return G.sort((Z,J)=>{const ie=Z.providerLabel.localeCompare(J.providerLabel);return ie!==0?ie:Z.modelLabel.localeCompare(J.modelLabel)})},[z.data,k.data]),F=P.useMemo(()=>{var O;return((O=M.data)==null?void 0:O.sessions)??[]},[(yt=M.data)==null?void 0:yt.sessions]),j=P.useMemo(()=>{var O;return((O=q.data)==null?void 0:O.records)??[]},[(bt=q.data)==null?void 0:bt.records]),V=P.useMemo(()=>F.find(O=>O.key===s)??null,[s,F]);P.useEffect(()=>{if(B.length===0){f("");return}f(O=>{var Z,J,ie,Ie;if(B.some(ne=>ne.value===O))return O;const H=(Z=V==null?void 0:V.preferredModel)==null?void 0:Z.trim();if(H&&B.some(ne=>ne.value===H))return H;const G=(ie=(J=k.data)==null?void 0:J.agents.defaults.model)==null?void 0:ie.trim();return G&&B.some(ne=>ne.value===G)?G:((Ie=B[0])==null?void 0:Ie.value)??""})},[(C=k.data)==null?void 0:C.agents.defaults.model,B,V==null?void 0:V.preferredModel]);const Q=L.data,pe=(Q==null?void 0:Q.messages)??[],ce=Q!=null&&Q.events&&Q.events.length>0?Q.events:_s(pe),m=P.useMemo(()=>ce.reduce((O,H)=>Number.isFinite(H.seq)?Math.max(O,H.seq):O,0)+1,[ce]),{optimisticUserEvent:ae,streamingSessionEvents:ge,streamingAssistantText:g,streamingAssistantTimestamp:oe,isSending:be,isAwaitingAssistantOutput:te,queuedCount:De,canStopCurrentRun:ke,stopDisabledReason:Ne,lastSendError:Ae,sendMessage:Le,stopCurrentRun:_t,resetStreamState:Oe}=cd({nextOptimisticUserSeq:m,selectedSessionKeyRef:R,setSelectedSessionKey:l,setDraft:i,refetchSessions:M.refetch,refetchHistory:L.refetch}),pt=P.useMemo(()=>{const O=[...ce];if(ae&&O.push(ae),O.push(...ge),g.trim()){const H=O.reduce((G,Z)=>{const J=Number.isFinite(Z.seq)?Z.seq:0;return J>G?J:G},0);O.push({seq:H+1,type:"stream.assistant_delta",timestamp:oe??new Date().toISOString(),message:{role:"assistant",content:g,timestamp:oe??new Date().toISOString()}})}return O},[ce,ae,g,oe,ge]);gd({view:e,routeSessionKey:D,selectedSessionKey:s,selectedAgentId:a,setSelectedSessionKey:l,setSelectedAgentId:u,selectedSessionKeyRef:R,isUserScrollingRef:v,resetStreamState:Oe});const{handleScroll:dt}=xd({threadRef:E,isUserScrollingRef:v,mergedEvents:pt,isSending:be}),Ye=P.useCallback(()=>{Oe(),l(null),y.pathname!=="/chat"&&S("/chat")},[y.pathname,S,Oe]),mt=P.useCallback(()=>{y.pathname!=="/providers"&&S("/providers")},[y.pathname,S]),Mt=P.useCallback(async()=>{!s||!await p({title:A("chatDeleteSessionConfirm"),variant:"destructive",confirmLabel:A("delete")})||N.mutate({key:s},{onSuccess:async()=>{Oe(),l(null),S("/chat",{replace:!0}),await M.refetch()}})},[p,N,S,Oe,s,M]),gt=P.useCallback(async()=>{var Z,J;const O=r.trim();if(!O)return;const H=c,G=s??hd(a);s||S(Yr(G),{replace:!0}),i(""),h([]),await Le({message:O,sessionKey:G,agentId:a,model:o||void 0,stopSupported:((Z=w.data)==null?void 0:Z.stopSupported)??!1,stopReason:(J=w.data)==null?void 0:J.stopReason,requestedSkills:H,restoreDraftOnError:!0})},[(T=w.data)==null?void 0:T.stopReason,($=w.data)==null?void 0:$.stopSupported,r,a,o,S,s,c,Le]),xt=V?Gr(V):void 0,Bt=P.useCallback(O=>{const H=Yr(O);y.pathname!==H&&S(H)},[y.pathname,S]),qt={sessions:F,selectedSessionKey:s,onSelectSession:Bt,onCreateSession:Ye,sessionTitle:Gr,isLoading:M.isLoading,query:t,onQueryChange:n},$t={modelOptions:B,selectedModel:o,onSelectedModelChange:f,onGoToProviders:mt,skillRecords:j,isSkillsLoading:q.isLoading,selectedSkills:c,onSelectedSkillsChange:h,selectedSessionKey:s,sessionDisplayName:xt,canDeleteSession:!!V,isDeletePending:N.isPending,onDeleteSession:()=>{Mt()},onCreateSession:Ye,threadRef:E,onThreadScroll:dt,isHistoryLoading:L.isLoading,mergedEvents:pt,isSending:be,isAwaitingAssistantOutput:te,streamingAssistantText:g,draft:r,onDraftChange:i,onSend:gt,onStop:()=>{_t()},canStopGeneration:ke,stopDisabledReason:Ne,sendError:Ae,queuedCount:De};return d.jsx(yd,{view:e,sidebarProps:qt,conversationProps:$t,confirmDialog:d.jsx(x,{})})}export{Td as ChatPage};
|