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