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