agent-afk 5.222.1 → 5.222.2

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.
@@ -342,7 +342,7 @@ Error generating stack: `+u.message+`
342
342
  .block-interactivity-`.concat(t,` {pointer-events: none;}
343
343
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
344
344
  `)},Dw=0,Wr=[];function Ow(t){var l=k.useRef([]),i=k.useRef([0,0]),a=k.useRef(),o=k.useState(Dw++)[0],c=k.useState(yx)[0],s=k.useRef(t);k.useEffect(function(){s.current=t},[t]),k.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var A=tw([t.lockRef.current],(t.shards||[]).map(my),!0).filter(Boolean);return A.forEach(function(j){return j.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),A.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var d=k.useCallback(function(A,j){if("touches"in A&&A.touches.length===2||A.type==="wheel"&&A.ctrlKey)return!s.current.allowPinchZoom;var N=lo(A),R=i.current,L="deltaX"in A?A.deltaX:R[0]-N[0],W="deltaY"in A?A.deltaY:R[1]-N[1],ee,D=A.target,X=Math.abs(L)>Math.abs(W)?"h":"v";if("touches"in A&&X==="h"&&D.type==="range")return!1;var V=window.getSelection(),ae=V&&V.anchorNode,H=ae?ae===D||ae.contains(D):!1;if(H)return!1;var re=dy(X,D);if(!re)return!0;if(re?ee=X:(ee=X==="v"?"h":"v",re=dy(X,D)),!re)return!1;if(!a.current&&"changedTouches"in A&&(L||W)&&(a.current=ee),!ee)return!0;var P=a.current||ee;return zw(P,j,A,P==="h"?L:W)},[]),m=k.useCallback(function(A){var j=A;if(!(!Wr.length||Wr[Wr.length-1]!==c)){var N="deltaY"in j?hy(j):lo(j),R=l.current.filter(function(ee){return ee.name===j.type&&(ee.target===j.target||j.target===ee.shadowParent)&&Mw(ee.delta,N)})[0];if(R&&R.should){j.cancelable&&j.preventDefault();return}if(!R){var L=(s.current.shards||[]).map(my).filter(Boolean).filter(function(ee){return ee.contains(j.target)}),W=L.length>0?d(j,L[0]):!s.current.noIsolation;W&&j.cancelable&&j.preventDefault()}}},[]),p=k.useCallback(function(A,j,N,R){var L={name:A,delta:j,target:N,should:R,shadowParent:Rw(N)};l.current.push(L),setTimeout(function(){l.current=l.current.filter(function(W){return W!==L})},1)},[]),b=k.useCallback(function(A){i.current=lo(A),a.current=void 0},[]),g=k.useCallback(function(A){p(A.type,hy(A),A.target,d(A,t.lockRef.current))},[]),v=k.useCallback(function(A){p(A.type,lo(A),A.target,d(A,t.lockRef.current))},[]);k.useEffect(function(){return Wr.push(c),t.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:v}),document.addEventListener("wheel",m,Jr),document.addEventListener("touchmove",m,Jr),document.addEventListener("touchstart",b,Jr),function(){Wr=Wr.filter(function(A){return A!==c}),document.removeEventListener("wheel",m,Jr),document.removeEventListener("touchmove",m,Jr),document.removeEventListener("touchstart",b,Jr)}},[]);var S=t.removeScrollBar,E=t.inert;return k.createElement(k.Fragment,null,E?k.createElement(c,{styles:_w(o)}):null,S?k.createElement(ww,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Rw(t){for(var l=null;t!==null;)t instanceof ShadowRoot&&(l=t.host,t=t.host),t=t.parentNode;return l}const Lw=cw(gx,Ow);var Sx=k.forwardRef(function(t,l){return k.createElement(Co,Mn({},t,{ref:l,sideCar:Lw}))});Sx.classNames=Co.classNames;var Uw=function(t){if(typeof document>"u")return null;var l=Array.isArray(t)?t[0]:t;return l.ownerDocument.body},ei=new WeakMap,ro=new WeakMap,io={},sf=0,kx=function(t){return t&&(t.host||kx(t.parentNode))},Bw=function(t,l){return l.map(function(i){if(t.contains(i))return i;var a=kx(i);return a&&t.contains(a)?a:(console.error("aria-hidden",i,"in not contained inside",t,". Doing nothing"),null)}).filter(function(i){return!!i})},Hw=function(t,l,i,a){var o=Bw(l,Array.isArray(t)?t:[t]);io[i]||(io[i]=new WeakMap);var c=io[i],s=[],d=new Set,m=new Set(o),p=function(g){!g||d.has(g)||(d.add(g),p(g.parentNode))};o.forEach(p);var b=function(g){!g||m.has(g)||Array.prototype.forEach.call(g.children,function(v){if(d.has(v))b(v);else try{var S=v.getAttribute(a),E=S!==null&&S!=="false",A=(ei.get(v)||0)+1,j=(c.get(v)||0)+1;ei.set(v,A),c.set(v,j),s.push(v),A===1&&E&&ro.set(v,!0),j===1&&v.setAttribute(i,"true"),E||v.setAttribute(a,"true")}catch(N){console.error("aria-hidden: cannot operate on ",v,N)}})};return b(l),d.clear(),sf++,function(){s.forEach(function(g){var v=ei.get(g)-1,S=c.get(g)-1;ei.set(g,v),c.set(g,S),v||(ro.has(g)||g.removeAttribute(a),ro.delete(g)),S||g.removeAttribute(i)}),sf--,sf||(ei=new WeakMap,ei=new WeakMap,ro=new WeakMap,io={})}},qw=function(t,l,i){i===void 0&&(i="data-aria-hidden");var a=Array.from(Array.isArray(t)?t:[t]),o=Uw(t);return o?(a.push.apply(a,Array.from(o.querySelectorAll("[aria-live], script"))),Hw(a,o,i,"aria-hidden")):function(){return null}},Iw=Object.defineProperty,nl=(t,l)=>Iw(t,"name",{value:l,configurable:!0}),wd="Dialog",[wx,h5]=Ib(wd),[Vw,or]=wx(wd),Yw=nl(t=>{const{__scopeDialog:l,children:i,open:a,defaultOpen:o,onOpenChange:c,modal:s=!0}=t,d=k.useRef(null),m=k.useRef(null),[p,b]=Gb({prop:a,defaultProp:o??!1,onChange:c,caller:wd}),[g,v]=k.useState(0),[S,E]=k.useState(0);return y.jsx(Vw,{scope:l,triggerRef:d,contentRef:m,contentId:_n(),titleId:_n(),descriptionId:_n(),titlePresent:g>0,descriptionPresent:S>0,setTitleCount:v,setDescriptionCount:E,open:p,onOpenChange:b,onOpenToggle:k.useCallback(()=>b(A=>!A),[b]),modal:s,children:i})},"Dialog"),Ex="DialogPortal",[Gw,Cx]=wx(Ex,{forceMount:void 0}),Fw=nl(t=>{const{__scopeDialog:l,forceMount:i,children:a,container:o}=t,c=or(Ex,l);return y.jsx(Gw,{scope:l,forceMount:i,children:k.Children.map(a,s=>y.jsx(vd,{present:i||c.open,children:y.jsx($2,{asChild:!0,container:o,children:s})}))})},"DialogPortal"),Xf="DialogOverlay",Xw=k.forwardRef(nl(function(l,i){const a=Cx(Xf,l.__scopeDialog),{forceMount:o=a.forceMount,...c}=l,s=or(Xf,l.__scopeDialog);return s.modal?y.jsx(vd,{present:o||s.open,children:y.jsx(Zw,{...c,ref:i})}):null},"DialogOverlay")),Qw=yd("DialogOverlay.RemoveScroll"),Zw=k.forwardRef(nl(function(l,i){const{__scopeDialog:a,...o}=l,c=or(Xf,a),s=tx(),d=mi(i,s);return y.jsx(Sx,{as:Qw,allowPinchZoom:!0,shards:[c.contentRef],children:y.jsx(pn.div,{"data-state":Ed(c.open),...o,ref:d,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),Ea="DialogContent",Kw=k.forwardRef(nl(function(l,i){const a=Cx(Ea,l.__scopeDialog),{forceMount:o=a.forceMount,...c}=l,s=or(Ea,l.__scopeDialog);return y.jsx(vd,{present:o||s.open,children:s.modal?y.jsx(Pw,{...c,ref:i}):y.jsx($w,{...c,ref:i})})},"DialogContent")),Pw=k.forwardRef(nl(function(l,i){const a=or(Ea,l.__scopeDialog),o=k.useRef(null),c=mi(i,a.contentRef,o);return k.useEffect(()=>{const s=o.current;if(s)return qw(s)},[]),y.jsx(Tx,{...l,ref:c,trapFocus:a.open,disableOutsidePointerEvents:a.open,onCloseAutoFocus:nr(l.onCloseAutoFocus,s=>{var d;s.preventDefault(),(d=a.triggerRef.current)==null||d.focus()}),onPointerDownOutside:nr(l.onPointerDownOutside,s=>{const d=s.detail.originalEvent,m=d.button===0&&d.ctrlKey===!0;(d.button===2||m)&&s.preventDefault()}),onFocusOutside:nr(l.onFocusOutside,s=>s.preventDefault())})},"DialogContentModal")),$w=k.forwardRef(nl(function(l,i){const a=or(Ea,l.__scopeDialog),o=k.useRef(!1),c=k.useRef(!1);return y.jsx(Tx,{...l,ref:i,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var d,m;(d=l.onCloseAutoFocus)==null||d.call(l,s),s.defaultPrevented||(o.current||(m=a.triggerRef.current)==null||m.focus(),s.preventDefault()),o.current=!1,c.current=!1},onInteractOutside:s=>{var p,b;(p=l.onInteractOutside)==null||p.call(l,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const d=s.target;((b=a.triggerRef.current)==null?void 0:b.contains(d))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&c.current&&s.preventDefault()}})},"DialogContentNonModal")),Tx=k.forwardRef(nl(function(l,i){const{__scopeDialog:a,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:s,...d}=l,m=or(Ea,a);return kd(),y.jsx(y.Fragment,{children:y.jsx(Z2,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:c,onUnmountAutoFocus:s,children:y.jsx(F2,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionPresent?m.descriptionId:void 0,"aria-labelledby":m.titlePresent?m.titleId:void 0,"data-state":Ed(m.open),...d,ref:i,deferPointerDownOutside:!0,onDismiss:()=>m.onOpenChange(!1)})})})},"DialogContentImpl"));function Ed(t){return t?"open":"closed"}nl(Ed,"getState");var da='[cmdk-group=""]',cf='[cmdk-group-items=""]',Jw='[cmdk-group-heading=""]',Ax='[cmdk-item=""]',py=`${Ax}:not([aria-disabled="true"])`,Qf="cmdk-item-select",ii="data-value",Ww=(t,l,i)=>g2(t,l,i),Nx=k.createContext(void 0),ja=()=>k.useContext(Nx),jx=k.createContext(void 0),Cd=()=>k.useContext(jx),zx=k.createContext(void 0),Mx=k.forwardRef((t,l)=>{let i=ai(()=>{var M,C;return{search:"",value:(C=(M=t.value)!=null?M:t.defaultValue)!=null?C:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=ai(()=>new Set),o=ai(()=>new Map),c=ai(()=>new Map),s=ai(()=>new Set),d=_x(t),{label:m,children:p,value:b,onValueChange:g,filter:v,shouldFilter:S,loop:E,disablePointerSelection:A=!1,vimBindings:j=!0,...N}=t,R=_n(),L=_n(),W=_n(),ee=k.useRef(null),D=cE();ir(()=>{if(b!==void 0){let M=b.trim();i.current.value=M,X.emit()}},[b]),ir(()=>{D(6,be)},[]);let X=k.useMemo(()=>({subscribe:M=>(s.current.add(M),()=>s.current.delete(M)),snapshot:()=>i.current,setState:(M,C,te)=>{var $,le,he,Ae;if(!Object.is(i.current[M],C)){if(i.current[M]=C,M==="search")P(),H(),D(1,re);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let pe=document.getElementById(W);pe?pe.focus():($=document.getElementById(R))==null||$.focus()}if(D(7,()=>{var pe;i.current.selectedItemId=(pe=ue())==null?void 0:pe.id,X.emit()}),te||D(5,be),((le=d.current)==null?void 0:le.value)!==void 0){let pe=C??"";(Ae=(he=d.current).onValueChange)==null||Ae.call(he,pe);return}}X.emit()}},emit:()=>{s.current.forEach(M=>M())}}),[]),V=k.useMemo(()=>({value:(M,C,te)=>{var $;C!==(($=c.current.get(M))==null?void 0:$.value)&&(c.current.set(M,{value:C,keywords:te}),i.current.filtered.items.set(M,ae(C,te)),D(2,()=>{H(),X.emit()}))},item:(M,C)=>(a.current.add(M),C&&(o.current.has(C)?o.current.get(C).add(M):o.current.set(C,new Set([M]))),D(3,()=>{P(),H(),i.current.value||re(),X.emit()}),()=>{c.current.delete(M),a.current.delete(M),i.current.filtered.items.delete(M);let te=ue();D(4,()=>{P(),(te==null?void 0:te.getAttribute("id"))===M&&re(),X.emit()})}),group:M=>(o.current.has(M)||o.current.set(M,new Set),()=>{c.current.delete(M),o.current.delete(M)}),filter:()=>d.current.shouldFilter,label:m||t["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:R,inputId:W,labelId:L,listInnerRef:ee}),[]);function ae(M,C){var te,$;let le=($=(te=d.current)==null?void 0:te.filter)!=null?$:Ww;return M?le(M,i.current.search,C):0}function H(){if(!i.current.search||d.current.shouldFilter===!1)return;let M=i.current.filtered.items,C=[];i.current.filtered.groups.forEach($=>{let le=o.current.get($),he=0;le.forEach(Ae=>{let pe=M.get(Ae);he=Math.max(pe,he)}),C.push([$,he])});let te=ee.current;ne().sort(($,le)=>{var he,Ae;let pe=$.getAttribute("id"),at=le.getAttribute("id");return((he=M.get(at))!=null?he:0)-((Ae=M.get(pe))!=null?Ae:0)}).forEach($=>{let le=$.closest(cf);le?le.appendChild($.parentElement===le?$:$.closest(`${cf} > *`)):te.appendChild($.parentElement===te?$:$.closest(`${cf} > *`))}),C.sort(($,le)=>le[1]-$[1]).forEach($=>{var le;let he=(le=ee.current)==null?void 0:le.querySelector(`${da}[${ii}="${encodeURIComponent($[0])}"]`);he==null||he.parentElement.appendChild(he)})}function re(){let M=ne().find(te=>te.getAttribute("aria-disabled")!=="true"),C=M==null?void 0:M.getAttribute(ii);X.setState("value",C||void 0)}function P(){var M,C,te,$;if(!i.current.search||d.current.shouldFilter===!1){i.current.filtered.count=a.current.size;return}i.current.filtered.groups=new Set;let le=0;for(let he of a.current){let Ae=(C=(M=c.current.get(he))==null?void 0:M.value)!=null?C:"",pe=($=(te=c.current.get(he))==null?void 0:te.keywords)!=null?$:[],at=ae(Ae,pe);i.current.filtered.items.set(he,at),at>0&&le++}for(let[he,Ae]of o.current)for(let pe of Ae)if(i.current.filtered.items.get(pe)>0){i.current.filtered.groups.add(he);break}i.current.filtered.count=le}function be(){var M,C,te;let $=ue();$&&(((M=$.parentElement)==null?void 0:M.firstChild)===$&&((te=(C=$.closest(da))==null?void 0:C.querySelector(Jw))==null||te.scrollIntoView({block:"nearest"})),$.scrollIntoView({block:"nearest"}))}function ue(){var M;return(M=ee.current)==null?void 0:M.querySelector(`${Ax}[aria-selected="true"]`)}function ne(){var M;return Array.from(((M=ee.current)==null?void 0:M.querySelectorAll(py))||[])}function B(M){let C=ne()[M];C&&X.setState("value",C.getAttribute(ii))}function Q(M){var C;let te=ue(),$=ne(),le=$.findIndex(Ae=>Ae===te),he=$[le+M];(C=d.current)!=null&&C.loop&&(he=le+M<0?$[$.length-1]:le+M===$.length?$[0]:$[le+M]),he&&X.setState("value",he.getAttribute(ii))}function ce(M){let C=ue(),te=C==null?void 0:C.closest(da),$;for(;te&&!$;)te=M>0?oE(te,da):sE(te,da),$=te==null?void 0:te.querySelector(py);$?X.setState("value",$.getAttribute(ii)):Q(M)}let we=()=>B(ne().length-1),T=M=>{M.preventDefault(),M.metaKey?we():M.altKey?ce(1):Q(1)},_=M=>{M.preventDefault(),M.metaKey?B(0):M.altKey?ce(-1):Q(-1)};return k.createElement(pn.div,{ref:l,tabIndex:-1,...N,"cmdk-root":"",onKeyDown:M=>{var C;(C=N.onKeyDown)==null||C.call(N,M);let te=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||te))switch(M.key){case"n":case"j":{j&&M.ctrlKey&&T(M);break}case"ArrowDown":{T(M);break}case"p":case"k":{j&&M.ctrlKey&&_(M);break}case"ArrowUp":{_(M);break}case"Home":{M.preventDefault(),B(0);break}case"End":{M.preventDefault(),we();break}case"Enter":{M.preventDefault();let $=ue();if($){let le=new Event(Qf);$.dispatchEvent(le)}}}}},k.createElement("label",{"cmdk-label":"",htmlFor:V.inputId,id:V.labelId,style:dE},m),To(t,M=>k.createElement(jx.Provider,{value:X},k.createElement(Nx.Provider,{value:V},M))))}),eE=k.forwardRef((t,l)=>{var i,a;let o=_n(),c=k.useRef(null),s=k.useContext(zx),d=ja(),m=_x(t),p=(a=(i=m.current)==null?void 0:i.forceMount)!=null?a:s==null?void 0:s.forceMount;ir(()=>{if(!p)return d.item(o,s==null?void 0:s.id)},[p]);let b=Dx(o,c,[t.value,t.children,c],t.keywords),g=Cd(),v=_l(D=>D.value&&D.value===b.current),S=_l(D=>p||d.filter()===!1?!0:D.search?D.filtered.items.get(o)>0:!0);k.useEffect(()=>{let D=c.current;if(!(!D||t.disabled))return D.addEventListener(Qf,E),()=>D.removeEventListener(Qf,E)},[S,t.onSelect,t.disabled]);function E(){var D,X;A(),(X=(D=m.current).onSelect)==null||X.call(D,b.current)}function A(){g.setState("value",b.current,!0)}if(!S)return null;let{disabled:j,value:N,onSelect:R,forceMount:L,keywords:W,...ee}=t;return k.createElement(pn.div,{ref:rr(c,l),...ee,id:o,"cmdk-item":"",role:"option","aria-disabled":!!j,"aria-selected":!!v,"data-disabled":!!j,"data-selected":!!v,onPointerMove:j||d.getDisablePointerSelection()?void 0:A,onClick:j?void 0:E},t.children)}),tE=k.forwardRef((t,l)=>{let{heading:i,children:a,forceMount:o,...c}=t,s=_n(),d=k.useRef(null),m=k.useRef(null),p=_n(),b=ja(),g=_l(S=>o||b.filter()===!1?!0:S.search?S.filtered.groups.has(s):!0);ir(()=>b.group(s),[]),Dx(s,d,[t.value,t.heading,m]);let v=k.useMemo(()=>({id:s,forceMount:o}),[o]);return k.createElement(pn.div,{ref:rr(d,l),...c,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},i&&k.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:p},i),To(t,S=>k.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?p:void 0},k.createElement(zx.Provider,{value:v},S))))}),nE=k.forwardRef((t,l)=>{let{alwaysRender:i,...a}=t,o=k.useRef(null),c=_l(s=>!s.search);return!i&&!c?null:k.createElement(pn.div,{ref:rr(o,l),...a,"cmdk-separator":"",role:"separator"})}),lE=k.forwardRef((t,l)=>{let{onValueChange:i,...a}=t,o=t.value!=null,c=Cd(),s=_l(p=>p.search),d=_l(p=>p.selectedItemId),m=ja();return k.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),k.createElement(pn.input,{ref:l,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":d,id:m.inputId,type:"text",value:o?t.value:s,onChange:p=>{o||c.setState("search",p.target.value),i==null||i(p.target.value)}})}),rE=k.forwardRef((t,l)=>{let{children:i,label:a="Suggestions",...o}=t,c=k.useRef(null),s=k.useRef(null),d=_l(p=>p.selectedItemId),m=ja();return k.useEffect(()=>{if(s.current&&c.current){let p=s.current,b=c.current,g,v=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let S=p.offsetHeight;b.style.setProperty("--cmdk-list-height",S.toFixed(1)+"px")})});return v.observe(p),()=>{cancelAnimationFrame(g),v.unobserve(p)}}},[]),k.createElement(pn.div,{ref:rr(c,l),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":a,id:m.listId},To(t,p=>k.createElement("div",{ref:rr(s,m.listInnerRef),"cmdk-list-sizer":""},p)))}),iE=k.forwardRef((t,l)=>{let{open:i,onOpenChange:a,overlayClassName:o,contentClassName:c,container:s,...d}=t;return k.createElement(Yw,{open:i,onOpenChange:a},k.createElement(Fw,{container:s},k.createElement(Xw,{"cmdk-overlay":"",className:o}),k.createElement(Kw,{"aria-label":t.label,"cmdk-dialog":"",className:c},k.createElement(Mx,{ref:l,...d}))))}),aE=k.forwardRef((t,l)=>_l(i=>i.filtered.count===0)?k.createElement(pn.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),uE=k.forwardRef((t,l)=>{let{progress:i,children:a,label:o="Loading...",...c}=t;return k.createElement(pn.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},To(t,s=>k.createElement("div",{"aria-hidden":!0},s)))}),ti=Object.assign(Mx,{List:rE,Item:eE,Input:lE,Group:tE,Separator:nE,Dialog:iE,Empty:aE,Loading:uE});function oE(t,l){let i=t.nextElementSibling;for(;i;){if(i.matches(l))return i;i=i.nextElementSibling}}function sE(t,l){let i=t.previousElementSibling;for(;i;){if(i.matches(l))return i;i=i.previousElementSibling}}function _x(t){let l=k.useRef(t);return ir(()=>{l.current=t}),l}var ir=typeof window>"u"?k.useEffect:k.useLayoutEffect;function ai(t){let l=k.useRef();return l.current===void 0&&(l.current=t()),l}function _l(t){let l=Cd(),i=()=>t(l.snapshot());return k.useSyncExternalStore(l.subscribe,i,i)}function Dx(t,l,i,a=[]){let o=k.useRef(),c=ja();return ir(()=>{var s;let d=(()=>{var p;for(let b of i){if(typeof b=="string")return b.trim();if(typeof b=="object"&&"current"in b)return b.current?(p=b.current.textContent)==null?void 0:p.trim():o.current}})(),m=a.map(p=>p.trim());c.value(t,d,m),(s=l.current)==null||s.setAttribute(ii,d),o.current=d}),o}var cE=()=>{let[t,l]=k.useState(),i=ai(()=>new Map);return ir(()=>{i.current.forEach(a=>a()),i.current=new Map},[t]),(a,o)=>{i.current.set(a,o),l({})}};function fE(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function To({asChild:t,children:l},i){return t&&k.isValidElement(l)?k.cloneElement(fE(l),{ref:l.ref},i(l.props.children)):i(l)}var dE={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const hE=[{label:"Sessions",icon:QS,value:"sessions"},{label:"Memory",icon:cd,value:"memory"},{label:"Schedules",icon:US,value:"schedules"},{label:"Jobs",icon:LS,value:"jobs"},{label:"Settings",icon:xb,value:"settings"}];function mE({onNavigate:t}){const[l,i]=k.useState(!1);k.useEffect(()=>{const o=c=>{(c.metaKey||c.ctrlKey)&&c.key==="k"&&(c.preventDefault(),i(s=>!s))};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[]);const a=o=>{i(!1),t(o)};return l?y.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",onClick:()=>i(!1),children:[y.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm","aria-hidden":!0}),y.jsx("div",{className:se("relative z-10 w-full max-w-lg rounded-xl border border-border","bg-popover text-popover-foreground shadow-2xl","overflow-hidden"),onClick:o=>o.stopPropagation(),children:y.jsxs(ti,{children:[y.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-4 py-3",children:[y.jsxs("svg",{className:"h-4 w-4 shrink-0 text-muted-foreground",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[y.jsx("circle",{cx:"11",cy:"11",r:"8"}),y.jsx("path",{d:"m21 21-4.35-4.35"})]}),y.jsx(ti.Input,{autoFocus:!0,placeholder:"Search commands…",className:se("flex-1 bg-transparent text-sm outline-none","placeholder:text-muted-foreground")}),y.jsx("kbd",{className:"hidden rounded border border-border px-1.5 py-0.5 text-xs text-muted-foreground sm:inline-block",children:"ESC"})]}),y.jsxs(ti.List,{className:"max-h-64 overflow-y-auto py-2",children:[y.jsx(ti.Empty,{className:"py-6 text-center text-sm text-muted-foreground",children:"No results found."}),y.jsx(ti.Group,{heading:"Navigation",className:"px-2",children:hE.map(({label:o,icon:c,value:s})=>y.jsxs(ti.Item,{value:s,onSelect:()=>a(s),className:se("flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-sm","text-popover-foreground transition-colors","data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground"),children:[y.jsx(c,{className:"h-4 w-4 text-muted-foreground"}),o]},s))})]})]})})]}):null}const pE={1:"sessions",2:"memory",3:"schedules",4:"jobs"};function gE({onNavigate:t}){return k.useEffect(()=>{function l(i){if(!(i.metaKey||i.ctrlKey))return;const a=pE[i.key];a&&(i.preventDefault(),t(a))}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t]),null}const gy=200;function Ox({text:t,isStreaming:l=!1}){const[i,a]=k.useState(!1),o=t.length>gy,c=o&&!i?t.slice(0,gy)+"…":t;return y.jsxs("details",{className:"group rounded-md border border-border/30 bg-muted/20",children:[y.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 px-3 py-2 text-xs text-muted-foreground select-none hover:text-foreground",children:[y.jsx(cd,{className:["h-3.5 w-3.5 shrink-0 text-brand/60",l?"animate-pulse":""].filter(Boolean).join(" ")}),y.jsx("span",{className:"font-medium",children:"Thinking"}),t.length>0&&y.jsxs("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums",children:[t.length.toLocaleString()," chars"]}),l&&y.jsx("span",{className:"ml-0.5 flex items-center gap-px",children:[0,150,300].map(s=>y.jsx("span",{className:"inline-block h-1 w-1 rounded-full bg-muted-foreground/50 animate-shimmer-pulse",style:{animationDelay:`${s}ms`}},s))})]}),y.jsxs("div",{className:"border-t border-border/30 px-3 py-2",children:[y.jsx("p",{className:"whitespace-pre-wrap break-words text-xs italic leading-relaxed text-muted-foreground/70",children:c}),o&&y.jsx("button",{type:"button",onClick:s=>{s.preventDefault(),a(d=>!d)},className:"mt-1.5 text-[10px] text-brand/60 hover:text-brand/80 transition-colors",children:i?"Show less":"Show more"})]})]})}function yE({open:t,children:l}){return y.jsx("div",{className:se("grid transition-[grid-template-rows] duration-200 ease-out",t?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:y.jsx("div",{className:"min-h-0 overflow-hidden",children:l})})}function bE({diff:t}){const l=t.split(`
345
- `);return y.jsx("div",{className:"overflow-x-auto rounded bg-secondary font-mono text-xs leading-5",children:y.jsx("table",{className:"w-full border-collapse",children:y.jsx("tbody",{children:l.map((i,a)=>{const o=i.startsWith("+")&&!i.startsWith("+++"),c=i.startsWith("-")&&!i.startsWith("---"),s=i.startsWith("@@"),d=i.startsWith("+++")||i.startsWith("---");return y.jsxs("tr",{className:se(o&&"bg-status-running/15 text-status-running",c&&"bg-status-failed/15 text-status-failed",s&&"bg-muted text-muted-foreground",d&&"text-muted-foreground",!o&&!c&&!s&&!d&&"text-foreground"),children:[y.jsx("td",{className:"select-none px-2 py-0 text-right text-muted-foreground/50 tabular-nums",children:a+1}),y.jsx("td",{className:"w-full whitespace-pre px-2 py-0",children:i||" "})]},a)})})})})}const xE={read_file:{Icon:li,colorClass:"text-cat-read"},glob:{Icon:li,colorClass:"text-cat-read"},grep:{Icon:li,colorClass:"text-cat-read"},list_directory:{Icon:li,colorClass:"text-cat-read"},json_query:{Icon:li,colorClass:"text-cat-read"},write_file:{Icon:mo,colorClass:"text-cat-write"},edit_file:{Icon:mo,colorClass:"text-cat-write"},patch_apply:{Icon:mo,colorClass:"text-cat-write"},bash:{Icon:Df,colorClass:"text-cat-shell"},test_run:{Icon:Df,colorClass:"text-cat-shell"},agent:{Icon:po,colorClass:"text-cat-agent"},compose:{Icon:po,colorClass:"text-cat-agent"},skill:{Icon:po,colorClass:"text-cat-agent"},browser_open:{Icon:oi,colorClass:"text-cat-browser"},browser_act:{Icon:oi,colorClass:"text-cat-browser"},browser_observe:{Icon:oi,colorClass:"text-cat-browser"},browser_screenshot:{Icon:oi,colorClass:"text-cat-browser"},web_scrape:{Icon:_f,colorClass:"text-cat-web"},web_request:{Icon:_f,colorClass:"text-cat-web"},memory_search:{Icon:$u,colorClass:"text-cat-mcp"},memory_update:{Icon:$u,colorClass:"text-cat-mcp"},state_get:{Icon:$u,colorClass:"text-cat-mcp"},state_put:{Icon:$u,colorClass:"text-cat-mcp"}};function vE(t){return xE[t]??{Icon:Sb,colorClass:"text-cat-other"}}function SE({status:t}){return t==="running"?y.jsx(KS,{className:"h-3.5 w-3.5 shrink-0 animate-spin-slow text-status-blocked","aria-label":"running"}):t==="ok"?y.jsx(qS,{className:"h-3.5 w-3.5 shrink-0 text-status-running","aria-label":"ok"}):y.jsx(gb,{className:"h-3.5 w-3.5 shrink-0 text-status-failed","aria-label":"error"})}function kE({ms:t,live:l}){const i=t!==void 0?`${(t/1e3).toFixed(1)}s`:l!==void 0?`...${l}s`:null;return i===null?null:y.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:i})}function wE({name:t,inputPreview:l,status:i,output:a,outputUnavailable:o,diff:c,durationMs:s}){const[d,m]=k.useState(!1),[p,b]=k.useState(!1),[g,v]=k.useState(0),S=k.useRef(null);k.useEffect(()=>(i==="running"&&s===void 0?S.current=setInterval(()=>{v(R=>R+1)},1e3):S.current!==null&&(clearInterval(S.current),S.current=null),()=>{S.current!==null&&clearInterval(S.current)}),[i,s]);const{Icon:E,colorClass:A}=vE(t),j=c||o||a&&a.trim().length>0,N=l.trim();return y.jsxs("div",{className:se("rounded-md border bg-card text-sm",i==="error"?"border-status-failed/40":"border-border"),children:[y.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[y.jsx(E,{className:se("h-3.5 w-3.5 shrink-0",A)}),y.jsx("span",{className:"font-mono text-xs font-medium text-foreground",children:t}),y.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[y.jsx(kE,{ms:s,live:i==="running"?g:void 0}),y.jsx(SE,{status:i})]})]}),N.length>0&&y.jsx("button",{type:"button",onClick:()=>b(R=>!R),className:"w-full border-t border-border/50 px-3 py-1.5 text-left","aria-expanded":p,children:y.jsx("p",{className:se("font-mono text-[11px] text-muted-foreground",!p&&"line-clamp-2"),children:N})}),j&&y.jsxs("div",{className:"border-t border-border/50",children:[y.jsxs("button",{type:"button",onClick:()=>m(R=>!R),className:"flex w-full cursor-pointer items-center gap-1 px-3 py-1.5 text-[11px] text-muted-foreground select-none hover:text-foreground","aria-expanded":d,children:[y.jsx(Eo,{className:se("h-3 w-3 shrink-0 transition-transform duration-150",d&&"rotate-90")}),"Output"]}),y.jsx(yE,{open:d,children:y.jsxs("div",{className:"px-3 pb-2 pt-1",children:[o&&y.jsx("p",{className:"text-[11px] italic text-muted-foreground",children:"Output not available (replayed session)"}),c&&y.jsx(bE,{diff:c}),!c&&a&&y.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap font-mono text-[11px] text-foreground",children:a})]})})]})]})}function EE(t){if(t<1e3)return`${t}ms`;const l=t/1e3;return l<60?`${l.toFixed(1)}s`:`${Math.floor(l/60)}m ${Math.floor(l%60)}s`}function CE(t){return t<.001?"<$0.001":`$${t.toFixed(3)}`}function TE({status:t}){const l="h-3.5 w-3.5 shrink-0";switch(t){case"started":return y.jsx(tk,{className:se(l,"animate-pulse text-status-blocked"),"aria-label":"running"});case"succeeded":case"completed":return y.jsx(HS,{className:se(l,"text-status-running"),"aria-label":"succeeded"});case"failed":return y.jsx(VS,{className:se(l,"text-status-failed"),"aria-label":"failed"});case"cancelled":return y.jsx(vb,{className:se(l,"text-muted-foreground"),"aria-label":"cancelled"});default:return y.jsx(IS,{className:se(l,"text-muted-foreground"),"aria-label":"unknown"})}}function AE(t){switch(t){case"succeeded":case"completed":return"text-status-running";case"failed":return"text-status-failed";case"started":return"text-status-blocked";default:return"text-muted-foreground"}}function NE({node:t,isExpanded:l,onToggle:i,isChild:a}){const{item:o}=t,c=t.children.length>0;return y.jsxs("div",{className:se("flex items-start gap-2 px-3 py-2",c&&"cursor-pointer select-none",a&&"py-1.5"),onClick:c?i:void 0,role:c?"button":void 0,tabIndex:c?0:void 0,onKeyDown:c?s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),i())}:void 0,"aria-expanded":c?l:void 0,children:[c?y.jsx(Eo,{className:se("mt-0.5 h-3 w-3 shrink-0 text-muted-foreground transition-transform",l&&"rotate-90")}):y.jsx("span",{className:"h-3 w-3 shrink-0"}),y.jsx("span",{className:"mt-0.5",children:y.jsx(TE,{status:o.status})}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[y.jsx("span",{className:"text-xs font-medium text-foreground",children:o.agentType??o.label}),o.model&&y.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:o.model}),o.durationMs!==void 0&&y.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:EE(o.durationMs)}),o.totalCostUsd!==void 0&&y.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:CE(o.totalCostUsd)}),y.jsx("span",{className:se("ml-auto font-mono text-[10px] capitalize",AE(o.status)),children:o.status})]}),o.promptHead&&y.jsxs("p",{className:"mt-0.5 line-clamp-1 text-[11px] italic text-muted-foreground",children:["“",o.promptHead,"”"]})]})]})}function Rx({node:t,isChild:l=!1}){const[i,a]=k.useState(!0),o=t.children.length>0;return y.jsxs("div",{children:[y.jsx(NE,{node:t,isExpanded:i,onToggle:()=>a(c=>!c),isChild:l}),o&&i&&y.jsx("div",{className:"ml-6 border-l border-border/50 pl-3",children:t.children.map((c,s)=>y.jsx("div",{className:se(s<t.children.length-1&&"border-b border-border/30"),children:y.jsx(Rx,{node:c,isChild:!0})},c.item.subagentId))})]})}function jE({roots:t,className:l}){return t.length===0?null:y.jsx("div",{className:se("rounded-md border border-border bg-card",l),children:t.map((i,a)=>y.jsx("div",{className:se(a<t.length-1&&"border-b border-border/50"),children:y.jsx(Rx,{node:i})},i.item.subagentId))})}function ff(){return y.jsx("span",{className:"text-muted-foreground/40","aria-hidden":!0,children:"·"})}function ao({label:t,value:l}){return y.jsxs("span",{className:"flex items-baseline gap-1",children:[y.jsx("span",{className:"text-[10px] text-muted-foreground",children:t}),y.jsx("span",{className:"font-mono text-xs text-foreground",children:l})]})}function zE(t){if(t<1e3)return`${t}ms`;const l=t/1e3;if(l<60)return`${l.toFixed(1)}s`;const i=Math.floor(l/60),a=Math.round(l%60);return`${i}m ${a}s`}function ME(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Lx({totals:t,className:l}){if(!t)return y.jsx("div",{className:se("flex items-center gap-2 text-xs text-muted-foreground",l),children:y.jsx("span",{className:"text-[10px] italic",children:"No metrics yet"})});const i=(t.inputTokens??0)+(t.outputTokens??0)+(t.cacheReadTokens??0);return y.jsxs("div",{className:se("flex flex-wrap items-center gap-2",l),children:[y.jsx(ao,{label:"turns",value:String(t.turns)}),y.jsx(ff,{}),y.jsx(ao,{label:"cost",value:`$${t.costUsd.toFixed(4)}`}),i>0&&y.jsxs(y.Fragment,{children:[y.jsx(ff,{}),y.jsx(ao,{label:"tokens",value:ME(i)})]}),y.jsx(ff,{}),y.jsx(ao,{label:"duration",value:zE(t.durationMs)})]})}function _E(t){const l=new Map,i=[];for(const o of t){if(o.kind!=="subagent"||l.get(o.subagentId))continue;const s={item:o,children:[]};if(l.set(o.subagentId,s),o.parentId){const d=l.get(o.parentId);d?d.children.push(s):i.push(s)}else i.push(s)}const a=[];for(const o of i){const c=o.item.parentId?l.get(o.item.parentId):void 0;c?c.children.push(o):a.push(o)}return a}const DE=new Set(["read_file","glob","grep","list_directory","json_query","read_witness","search_witness","get_facet","clipboard_read"]),OE=new Set(["write_file","edit_file","patch_apply","clipboard_write","procedure_write"]),RE=new Set(["bash","test_run","wait_for"]),LE=new Set(["agent","send_message_to_agent","cancel_background_job"]),UE=new Set(["skill"]),BE=new Set(["compose"]),HE=new Set(["web_scrape","web_request"]),qE=new Set(["browser_open","browser_act","browser_observe","browser_screenshot","browser_close"]),IE=new Set(["memory_search","memory_update","state_get","state_put","state_cas","state_delete","state_query","workspace_publish","workspace_query"]);function VE(t){return DE.has(t)?"read":OE.has(t)?"write":RE.has(t)?"shell":LE.has(t)?"agent":UE.has(t)?"skill":BE.has(t)?"dag":HE.has(t)?"web":qE.has(t)?"browser":IE.has(t)?"other":t.startsWith("mcp__")?"mcp":"other"}function Ux(t){if(t<1e3)return"<1s";const l=t/1e3;if(l<60)return`${l.toFixed(1)}s`;const i=Math.floor(l/60),a=Math.floor(l%60);return`${i}m ${a}s`}function Bx(t){return t<.001?"<$0.001":`$${t.toFixed(3)}`}function YE(t){return t==="error"?"error":t==="ok"?"ok":"running"}function GE(t){return t==="succeeded"?"ok":t==="failed"?"error":t==="cancelled"?"cancelled":"running"}function FE(t){const l=YE(t.status);return{id:t.id,kind:"tool",label:t.name,category:VE(t.name),status:l,preview:t.inputPreview,durationMs:t.durationMs,children:[],isActive:l==="running",sourceId:t.toolUseId}}function XE(t){const l=GE(t.status);return{id:t.id,kind:"agent",label:t.label,category:"agent",status:l,preview:t.promptHead,durationMs:t.durationMs,costUsd:t.totalCostUsd,model:t.model,agentType:t.agentType,turnCount:t.turnCount,children:[],isActive:l==="running",sourceId:t.subagentId}}function QE(t){const l=[],i=[],a=new Map;for(let g=0;g<t.length;g++){const v=t[g];v!==void 0&&(v.kind==="tool"&&(l.push(v),a.set(v.id,g)),v.kind==="subagent"&&(i.push(v),a.set(v.id,g)))}const o=new Map;for(const g of l)g.toolUseId&&o.set(g.toolUseId,g);const c=new Map,s=new Map,d=new Set;for(const g of l)c.set(g.id,FE(g));for(const g of i)s.set(g.subagentId,XE(g));const m=[],p=[];for(const g of i){const v=s.get(g.subagentId);if(v){if(g.parentToolUseId){const S=o.get(g.parentToolUseId);if(S){const E=c.get(S.id);if(E){E.kind="agent",E.children.push(v),d.add(S.id);continue}}p.push(v);continue}if(g.parentId){const S=s.get(g.parentId);if(S){S.children.push(v);continue}p.push(v);continue}m.push(v)}}const b=[];for(const g of p){const v=i.find(E=>E.subagentId===g.sourceId);if(!v){m.push(g);continue}let S=!1;if(v.parentToolUseId){const E=o.get(v.parentToolUseId);if(E){const A=c.get(E.id);A&&(A.kind="agent",A.children.push(g),d.add(E.id),S=!0)}}if(!S&&v.parentId){const E=s.get(v.parentId);E&&(E.children.push(g),S=!0)}S||b.push(g)}for(const g of b)m.push(g);for(const g of l)if(!d.has(g.id)){const v=c.get(g.id);v&&m.push(v)}return m.sort((g,v)=>(a.get(g.id)??0)-(a.get(v.id)??0)),m}const ZE={read:li,write:mo,shell:Df,agent:po,skill:ak,dag:$S,mcp:nk,web:_f,browser:oi,plan:ZS,other:Sb},KE={read:"text-cat-read",write:"text-cat-write",shell:"text-cat-shell",agent:"text-cat-agent",skill:"text-cat-skill",dag:"text-cat-dag",mcp:"text-cat-mcp",web:"text-cat-web",browser:"text-cat-browser",plan:"text-cat-plan",other:"text-cat-other"};function Hx(t){let l=0;for(const i of t.children)i.kind==="tool"&&l++,l+=Hx(i);return l}function qx(t){let l=t.durationMs??0;for(const i of t.children)l+=qx(i);return l}function PE({category:t,status:l}){const i=ZE[t],a=KE[t];return y.jsx(i,{className:se("h-3.5 w-3.5 shrink-0",a,l==="running"&&"animate-shimmer-pulse",l==="error"&&"text-status-failed",l==="cancelled"&&"opacity-50"),"aria-hidden":!0})}function df({node:t}){if(t.status==="running"||t.children.length===0)return null;if(t.status==="error")return y.jsx("div",{className:"mt-0.5 pl-5 text-[11px] text-status-failed",children:"Failed"});if(t.status==="cancelled")return y.jsx("div",{className:"mt-0.5 pl-5 text-[11px] text-muted-foreground",children:"Cancelled"});const l=Hx(t),i=t.durationMs??qx(t),a=t.costUsd,o=[];return l>0&&o.push(`${l} tool${l!==1?"s":""}`),i>0&&o.push(Ux(i)),a!=null&&a>0&&o.push(Bx(a)),y.jsxs("div",{className:"mt-0.5 pl-5 text-[11px] text-muted-foreground",children:["Done",o.length>0?` (${o.join(" · ")})`:""]})}function Ix({node:t,depth:l=0,isLast:i=!1}){const a=t.kind==="agent"&&t.children.length>0,[o,c]=k.useState(t.isActive),s=t.children.length>0,d=t.kind==="agent",m=o?dd:Eo;return y.jsxs("div",{className:se("relative",l>0&&"pl-3"),children:[y.jsxs("div",{className:se("flex items-center gap-1.5 py-0.5 group",a&&"cursor-pointer select-none"),onClick:a?()=>c(p=>!p):void 0,role:a?"button":void 0,"aria-expanded":a?o:void 0,children:[a?y.jsx(m,{className:"h-3 w-3 shrink-0 text-muted-foreground/50"}):y.jsx("span",{className:"h-3 w-3 shrink-0","aria-hidden":!0}),y.jsx(PE,{category:t.category,status:t.status}),y.jsx("span",{className:se("text-[12px] font-mono leading-none",t.status==="cancelled"&&"opacity-50",t.status==="error"&&"text-status-failed",t.status==="running"&&"text-foreground",t.status==="ok"&&"text-foreground/80"),children:t.label}),d&&t.model&&y.jsx("span",{className:"bg-secondary rounded px-1 py-0.5 text-[10px] font-mono text-muted-foreground",children:t.model}),d&&t.agentType&&y.jsx("span",{className:"bg-secondary rounded px-1 py-0.5 text-[10px] font-mono text-muted-foreground",children:t.agentType}),d&&t.turnCount!=null&&t.turnCount>0&&y.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:[t.turnCount," turn",t.turnCount!==1?"s":""]}),t.durationMs!=null&&t.durationMs>0&&y.jsx("span",{className:"text-[10px] font-mono text-muted-foreground tabular-nums",children:Ux(t.durationMs)}),d&&t.costUsd!=null&&t.costUsd>0&&y.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:Bx(t.costUsd)})]}),d&&t.preview&&y.jsx("div",{className:"pl-5 text-[11px] italic text-muted-foreground/60 line-clamp-1 leading-tight",children:t.preview}),d&&!o&&s&&y.jsx(df,{node:t}),s&&o&&y.jsxs("div",{className:se("relative mt-0.5 ml-[22px]","border-l-2 border-spine"),children:[t.children.map((p,b)=>{const g=b===t.children.length-1;return y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:se("absolute left-0 top-[10px] h-0 w-3","border-t-2 border-spine",g&&"last-child-clip"),"aria-hidden":!0}),g&&y.jsx("div",{className:"absolute left-[-2px] top-[10px] bottom-0 w-[2px] bg-background","aria-hidden":!0}),y.jsx("div",{className:"pl-3",children:y.jsx(Ix,{node:p,depth:l+1,isLast:g})})]},p.id)}),d&&t.status!=="running"&&y.jsx(df,{node:t})]}),d&&(!s||!o)&&t.status!=="running"&&(s?null:y.jsx(df,{node:t}))]})}function $E({nodes:t,className:l}){return y.jsxs("div",{className:se("relative pl-3 border-l-2 border-spine/40",l),children:[y.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-widest text-muted-foreground/40 select-none",children:"Execution"}),t.length===0?y.jsx("div",{className:"text-[11px] text-muted-foreground/30 italic py-1",children:"No activity yet"}):y.jsx("div",{className:"flex flex-col gap-0.5",children:t.map((i,a)=>y.jsx(Ix,{node:i,depth:0,isLast:a===t.length-1},i.id))})]})}const JE=new Set(["tool","subagent","notice"]),WE=new Set(["user","assistant","thinking","error","bg_job"]);function eC(t){const l=[];let i=0;for(;i<t.length;){const a=t[i];if(a===void 0){i++;continue}if(WE.has(a.kind)){l.push({kind:"text",item:a}),i++;continue}const o=[];for(;i<t.length;){const c=t[i];if(c===void 0||!JE.has(c.kind))break;o.push(c),i++}if(o.length>0){const c=QE(o);l.push({kind:"execution",items:o,id:o[0].id,spineNodes:c})}}return l}function tC({slots:t,renderTextItem:l}){return y.jsx(y.Fragment,{children:t.map((i,a)=>i.kind==="text"?l(i.item,a):y.jsx("div",{className:"py-2 px-1",children:y.jsx($E,{nodes:i.spineNodes})},i.id))})}function nC(t){return k.useMemo(()=>eC(t),[t])}function lC(t,l){const i=l||{};return(t[t.length-1]===""?[...t,""]:t).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const rC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aC={};function yy(t,l){return(aC.jsx?iC:rC).test(t)}const uC=/[ \t\n\f\r]/g;function oC(t){return typeof t=="object"?t.type==="text"?by(t.value):!1:by(t)}function by(t){return t.replace(uC,"")===""}class za{constructor(l,i,a){this.normal=i,this.property=l,a&&(this.space=a)}}za.prototype.normal={};za.prototype.property={};za.prototype.space=void 0;function Vx(t,l){const i={},a={};for(const o of t)Object.assign(i,o.property),Object.assign(a,o.normal);return new za(i,a,l)}function Zf(t){return t.toLowerCase()}class Gt{constructor(l,i){this.attribute=i,this.property=l}}Gt.prototype.attribute="";Gt.prototype.booleanish=!1;Gt.prototype.boolean=!1;Gt.prototype.commaOrSpaceSeparated=!1;Gt.prototype.commaSeparated=!1;Gt.prototype.defined=!1;Gt.prototype.mustUseProperty=!1;Gt.prototype.number=!1;Gt.prototype.overloadedBoolean=!1;Gt.prototype.property="";Gt.prototype.spaceSeparated=!1;Gt.prototype.space=void 0;let sC=0;const Ee=sr(),ft=sr(),Kf=sr(),ie=sr(),Pe=sr(),lr=sr(),Wt=sr();function sr(){return 2**++sC}const Pf=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ee,booleanish:ft,commaOrSpaceSeparated:Wt,commaSeparated:lr,number:ie,overloadedBoolean:Kf,spaceSeparated:Pe},Symbol.toStringTag,{value:"Module"})),hf=Object.keys(Pf);class Td extends Gt{constructor(l,i,a,o){let c=-1;if(super(l,i),xy(this,"space",o),typeof a=="number")for(;++c<hf.length;){const s=hf[c];xy(this,hf[c],(a&Pf[s])===Pf[s])}}}Td.prototype.defined=!0;function xy(t,l,i){i&&(t[l]=i)}function pi(t){const l={},i={};for(const[a,o]of Object.entries(t.properties)){const c=new Td(a,t.transform(t.attributes||{},a),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(a)&&(c.mustUseProperty=!0),l[a]=c,i[Zf(a)]=a,i[Zf(c.attribute)]=a}return new za(l,i,t.space)}const Yx=pi({properties:{ariaActiveDescendant:null,ariaAtomic:ft,ariaAutoComplete:null,ariaBusy:ft,ariaChecked:ft,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,ariaControls:Pe,ariaCurrent:null,ariaDescribedBy:Pe,ariaDetails:null,ariaDisabled:ft,ariaDropEffect:Pe,ariaErrorMessage:null,ariaExpanded:ft,ariaFlowTo:Pe,ariaGrabbed:ft,ariaHasPopup:null,ariaHidden:ft,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Pe,ariaLevel:ie,ariaLive:null,ariaModal:ft,ariaMultiLine:ft,ariaMultiSelectable:ft,ariaOrientation:null,ariaOwns:Pe,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:ft,ariaReadOnly:ft,ariaRelevant:null,ariaRequired:ft,ariaRoleDescription:Pe,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:ft,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function Gx(t,l){return l in t?t[l]:l}function Fx(t,l){return Gx(t,l.toLowerCase())}const cC=pi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:lr,acceptCharset:Pe,accessKey:Pe,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alpha:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:Pe,autoFocus:Ee,autoPlay:Ee,blocking:Pe,capture:null,charSet:null,checked:Ee,cite:null,className:Pe,closedBy:null,colorSpace:null,cols:ie,colSpan:ie,command:null,commandFor:null,content:null,contentEditable:ft,controls:Ee,controlsList:Pe,coords:ie|lr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:Kf,draggable:ft,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:Pe,height:ie,hidden:Kf,high:ie,href:null,hrefLang:null,htmlFor:Pe,httpEquiv:Pe,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:Pe,itemRef:Pe,itemScope:Ee,itemType:Pe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,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:Ee,optimum:ie,pattern:null,ping:Pe,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:Pe,required:Ee,reversed:Ee,rows:ie,rowSpan:ie,sandbox:Pe,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootCustomElementRegistry:Ee,shadowRootDelegatesFocus:Ee,shadowRootMode:null,shadowRootSerializable:Ee,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:ft,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:Ee,useMap:null,value:ft,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Pe,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:ft,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ee,disablePictureInPicture:Ee,disableRemotePlayback:Ee,exportParts:lr,part:Pe,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:Fx}),fC=pi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Wt,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,className:Pe,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:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:Ee,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,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:lr,g2:lr,glyphName:lr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:Wt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ie,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:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Pe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wt,rev:Wt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wt,requiredFeatures:Wt,requiredFonts:Wt,requiredFormats:Wt,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:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:Wt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Wt,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Wt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Gx}),Xx=pi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,l){return"xlink:"+l.slice(5).toLowerCase()}}),Qx=pi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fx}),Zx=pi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),dC={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"},hC=/[A-Z]/g,vy=/-[a-z]/g,mC=/^data[-\w.:]+$/i;function pC(t,l){const i=Zf(l);let a=l,o=Gt;if(i in t.normal)return t.property[t.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&mC.test(l)){if(l.charAt(4)==="-"){const c=l.slice(5).replace(vy,yC);a="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=l.slice(4);if(!vy.test(c)){let s=c.replace(hC,gC);s.charAt(0)!=="-"&&(s="-"+s),l="data"+s}}o=Td}return new o(a,l)}function gC(t){return"-"+t.toLowerCase()}function yC(t){return t.charAt(1).toUpperCase()}const bC=Vx([Yx,cC,Xx,Qx,Zx],"html"),Ad=Vx([Yx,fC,Xx,Qx,Zx],"svg");function xC(t){return t.join(" ").trim()}var ni={},mf,Sy;function vC(){if(Sy)return mf;Sy=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,d=/^\s+|\s+$/g,m=`
345
+ `);return y.jsx("div",{className:"overflow-x-auto rounded bg-secondary font-mono text-xs leading-5",children:y.jsx("table",{className:"w-full border-collapse",children:y.jsx("tbody",{children:l.map((i,a)=>{const o=i.startsWith("+")&&!i.startsWith("+++"),c=i.startsWith("-")&&!i.startsWith("---"),s=i.startsWith("@@"),d=i.startsWith("+++")||i.startsWith("---");return y.jsxs("tr",{className:se(o&&"bg-status-running/15 text-status-running",c&&"bg-status-failed/15 text-status-failed",s&&"bg-muted text-muted-foreground",d&&"text-muted-foreground",!o&&!c&&!s&&!d&&"text-foreground"),children:[y.jsx("td",{className:"select-none px-2 py-0 text-right text-muted-foreground/50 tabular-nums",children:a+1}),y.jsx("td",{className:"w-full whitespace-pre px-2 py-0",children:i||" "})]},a)})})})})}const xE={read_file:{Icon:li,colorClass:"text-cat-read"},glob:{Icon:li,colorClass:"text-cat-read"},grep:{Icon:li,colorClass:"text-cat-read"},list_directory:{Icon:li,colorClass:"text-cat-read"},json_query:{Icon:li,colorClass:"text-cat-read"},write_file:{Icon:mo,colorClass:"text-cat-write"},edit_file:{Icon:mo,colorClass:"text-cat-write"},patch_apply:{Icon:mo,colorClass:"text-cat-write"},bash:{Icon:Df,colorClass:"text-cat-shell"},test_run:{Icon:Df,colorClass:"text-cat-shell"},agent:{Icon:po,colorClass:"text-cat-agent"},compose:{Icon:po,colorClass:"text-cat-agent"},skill:{Icon:po,colorClass:"text-cat-agent"},browser_open:{Icon:oi,colorClass:"text-cat-browser"},browser_act:{Icon:oi,colorClass:"text-cat-browser"},browser_observe:{Icon:oi,colorClass:"text-cat-browser"},browser_screenshot:{Icon:oi,colorClass:"text-cat-browser"},web_scrape:{Icon:_f,colorClass:"text-cat-web"},web_request:{Icon:_f,colorClass:"text-cat-web"},memory_search:{Icon:$u,colorClass:"text-cat-mcp"},memory_update:{Icon:$u,colorClass:"text-cat-mcp"},state_get:{Icon:$u,colorClass:"text-cat-mcp"},state_put:{Icon:$u,colorClass:"text-cat-mcp"}};function vE(t){return xE[t]??{Icon:Sb,colorClass:"text-cat-other"}}function SE({status:t}){return t==="running"?y.jsx(KS,{className:"h-3.5 w-3.5 shrink-0 animate-spin-slow text-status-blocked","aria-label":"running"}):t==="ok"?y.jsx(qS,{className:"h-3.5 w-3.5 shrink-0 text-status-running","aria-label":"ok"}):y.jsx(gb,{className:"h-3.5 w-3.5 shrink-0 text-status-failed","aria-label":"error"})}function kE({ms:t,live:l}){const i=t!==void 0?`${(t/1e3).toFixed(1)}s`:l!==void 0?`...${l}s`:null;return i===null?null:y.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:i})}function wE({name:t,inputPreview:l,status:i,output:a,outputUnavailable:o,diff:c,durationMs:s}){const[d,m]=k.useState(!1),[p,b]=k.useState(!1),[g,v]=k.useState(0),S=k.useRef(null);k.useEffect(()=>(i==="running"&&s===void 0?S.current=setInterval(()=>{v(R=>R+1)},1e3):S.current!==null&&(clearInterval(S.current),S.current=null),()=>{S.current!==null&&clearInterval(S.current)}),[i,s]);const{Icon:E,colorClass:A}=vE(t),j=c||o||a&&a.trim().length>0,N=l.trim();return y.jsxs("div",{className:se("rounded-md border bg-card text-sm",i==="error"?"border-status-failed/40":"border-border"),children:[y.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[y.jsx(E,{className:se("h-3.5 w-3.5 shrink-0",A)}),y.jsx("span",{className:"font-mono text-xs font-medium text-foreground",children:t}),y.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[y.jsx(kE,{ms:s,live:i==="running"?g:void 0}),y.jsx(SE,{status:i})]})]}),N.length>0&&y.jsx("button",{type:"button",onClick:()=>b(R=>!R),className:"w-full border-t border-border/50 px-3 py-1.5 text-left","aria-expanded":p,children:y.jsx("p",{className:se("font-mono text-[11px] text-muted-foreground",!p&&"line-clamp-2"),children:N})}),j&&y.jsxs("div",{className:"border-t border-border/50",children:[y.jsxs("button",{type:"button",onClick:()=>m(R=>!R),className:"flex w-full cursor-pointer items-center gap-1 px-3 py-1.5 text-[11px] text-muted-foreground select-none hover:text-foreground","aria-expanded":d,children:[y.jsx(Eo,{className:se("h-3 w-3 shrink-0 transition-transform duration-150",d&&"rotate-90")}),"Output"]}),y.jsx(yE,{open:d,children:y.jsxs("div",{className:"px-3 pb-2 pt-1",children:[o&&y.jsx("p",{className:"text-[11px] italic text-muted-foreground",children:"Output not available (replayed session)"}),c&&y.jsx(bE,{diff:c}),!c&&a&&y.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap font-mono text-[11px] text-foreground",children:a})]})})]})]})}function EE(t){if(t<1e3)return`${t}ms`;const l=t/1e3;return l<60?`${l.toFixed(1)}s`:`${Math.floor(l/60)}m ${Math.floor(l%60)}s`}function CE(t){return t<.001?"<$0.001":`$${t.toFixed(3)}`}function TE({status:t}){const l="h-3.5 w-3.5 shrink-0";switch(t){case"started":return y.jsx(tk,{className:se(l,"animate-pulse text-status-blocked"),"aria-label":"running"});case"succeeded":case"completed":return y.jsx(HS,{className:se(l,"text-status-running"),"aria-label":"succeeded"});case"failed":return y.jsx(VS,{className:se(l,"text-status-failed"),"aria-label":"failed"});case"cancelled":return y.jsx(vb,{className:se(l,"text-muted-foreground"),"aria-label":"cancelled"});default:return y.jsx(IS,{className:se(l,"text-muted-foreground"),"aria-label":"unknown"})}}function AE(t){switch(t){case"succeeded":case"completed":return"text-status-running";case"failed":return"text-status-failed";case"started":return"text-status-blocked";default:return"text-muted-foreground"}}function NE({node:t,isExpanded:l,onToggle:i,isChild:a}){const{item:o}=t,c=t.children.length>0;return y.jsxs("div",{className:se("flex items-start gap-2 px-3 py-2",c&&"cursor-pointer select-none",a&&"py-1.5"),onClick:c?i:void 0,role:c?"button":void 0,tabIndex:c?0:void 0,onKeyDown:c?s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),i())}:void 0,"aria-expanded":c?l:void 0,children:[c?y.jsx(Eo,{className:se("mt-0.5 h-3 w-3 shrink-0 text-muted-foreground transition-transform",l&&"rotate-90")}):y.jsx("span",{className:"h-3 w-3 shrink-0"}),y.jsx("span",{className:"mt-0.5",children:y.jsx(TE,{status:o.status})}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[y.jsx("span",{className:"text-xs font-medium text-foreground",children:o.agentType??o.label}),o.model&&y.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:o.model}),o.durationMs!==void 0&&y.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:EE(o.durationMs)}),o.totalCostUsd!==void 0&&y.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:CE(o.totalCostUsd)}),y.jsx("span",{className:se("ml-auto font-mono text-[10px] capitalize",AE(o.status)),children:o.status})]}),o.promptHead&&y.jsxs("p",{className:"mt-0.5 line-clamp-1 text-[11px] italic text-muted-foreground",children:["“",o.promptHead,"”"]})]})]})}function Rx({node:t,isChild:l=!1}){const[i,a]=k.useState(!0),o=t.children.length>0;return y.jsxs("div",{children:[y.jsx(NE,{node:t,isExpanded:i,onToggle:()=>a(c=>!c),isChild:l}),o&&i&&y.jsx("div",{className:"ml-6 border-l border-border/50 pl-3",children:t.children.map((c,s)=>y.jsx("div",{className:se(s<t.children.length-1&&"border-b border-border/30"),children:y.jsx(Rx,{node:c,isChild:!0})},c.item.subagentId))})]})}function jE({roots:t,className:l}){return t.length===0?null:y.jsx("div",{className:se("rounded-md border border-border bg-card",l),children:t.map((i,a)=>y.jsx("div",{className:se(a<t.length-1&&"border-b border-border/50"),children:y.jsx(Rx,{node:i})},i.item.subagentId))})}function ff(){return y.jsx("span",{className:"text-muted-foreground/40","aria-hidden":!0,children:"·"})}function ao({label:t,value:l}){return y.jsxs("span",{className:"flex items-baseline gap-1",children:[y.jsx("span",{className:"text-[10px] text-muted-foreground",children:t}),y.jsx("span",{className:"font-mono text-xs text-foreground",children:l})]})}function zE(t){if(t<1e3)return`${t}ms`;const l=t/1e3;if(l<60)return`${l.toFixed(1)}s`;const i=Math.floor(l/60),a=Math.round(l%60);return`${i}m ${a}s`}function ME(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Lx({totals:t,className:l}){if(!t)return y.jsx("div",{className:se("flex items-center gap-2 text-xs text-muted-foreground",l),children:y.jsx("span",{className:"text-[10px] italic",children:"No metrics yet"})});const i=(t.inputTokens??0)+(t.outputTokens??0)+(t.cacheReadTokens??0);return y.jsxs("div",{className:se("flex flex-wrap items-center gap-2",l),children:[y.jsx(ao,{label:"turns",value:String(t.turns)}),y.jsx(ff,{}),y.jsx(ao,{label:"cost",value:`$${t.costUsd.toFixed(4)}`}),i>0&&y.jsxs(y.Fragment,{children:[y.jsx(ff,{}),y.jsx(ao,{label:"tokens",value:ME(i)})]}),y.jsx(ff,{}),y.jsx(ao,{label:"duration",value:zE(t.durationMs)})]})}function _E(t){const l=new Map,i=[];for(const o of t){if(o.kind!=="subagent"||l.get(o.subagentId))continue;const s={item:o,children:[]};if(l.set(o.subagentId,s),o.parentId){const d=l.get(o.parentId);d?d.children.push(s):i.push(s)}else i.push(s)}const a=[];for(const o of i){const c=o.item.parentId?l.get(o.item.parentId):void 0;c?c.children.push(o):a.push(o)}return a}const DE=new Set(["read_file","glob","grep","list_directory","json_query","read_witness","search_witness","get_facet","clipboard_read"]),OE=new Set(["write_file","edit_file","patch_apply","clipboard_write","procedure_write"]),RE=new Set(["bash","test_run","wait_for"]),LE=new Set(["agent","send_message_to_agent","cancel_background_job"]),UE=new Set(["skill"]),BE=new Set(["compose"]),HE=new Set(["web_scrape","web_request"]),qE=new Set(["browser_open","browser_act","browser_observe","browser_screenshot","browser_close"]),IE=new Set(["memory_search","memory_update","state_get","state_put","state_cas","state_delete","state_query","workspace_publish","workspace_query"]);function VE(t){return DE.has(t)?"read":OE.has(t)?"write":RE.has(t)?"shell":LE.has(t)?"agent":UE.has(t)?"skill":BE.has(t)?"dag":HE.has(t)?"web":qE.has(t)?"browser":IE.has(t)?"other":t.startsWith("mcp__")?"mcp":"other"}function Ux(t){if(t<1e3)return"<1s";const l=t/1e3;if(l<60)return`${l.toFixed(1)}s`;const i=Math.floor(l/60),a=Math.floor(l%60);return`${i}m ${a}s`}function Bx(t){return t<.001?"<$0.001":`$${t.toFixed(3)}`}function YE(t){return t==="error"?"error":t==="ok"?"ok":"running"}function GE(t){return t==="succeeded"?"ok":t==="failed"?"error":t==="cancelled"?"cancelled":"running"}function FE(t,l){const i=YE(t.status);return{id:t.id,kind:"tool",label:t.name,category:VE(t.name),status:i,preview:t.inputPreview,durationMs:t.durationMs,children:[],isActive:i==="running",sourceId:t.toolUseId,seq:l}}function XE(t,l){const i=GE(t.status);return{id:t.id,kind:"agent",label:t.label,category:"agent",status:i,preview:t.promptHead,durationMs:t.durationMs,costUsd:t.totalCostUsd,model:t.model,agentType:t.agentType,turnCount:t.turnCount,children:[],isActive:i==="running",sourceId:t.subagentId,seq:l}}function QE(t){const l=[],i=[],a=new Map;for(let g=0;g<t.length;g++){const v=t[g];v!==void 0&&(v.kind==="tool"&&(l.push(v),a.set(v.id,g)),v.kind==="subagent"&&(i.push(v),a.set(v.id,g)))}const o=new Map;for(const g of l)g.toolUseId&&o.set(g.toolUseId,g);const c=new Map,s=new Map,d=new Set;for(const g of l)c.set(g.id,FE(g,a.get(g.id)??0));for(const g of i)s.set(g.subagentId,XE(g,a.get(g.id)??0));const m=[],p=[];for(const g of i){const v=s.get(g.subagentId);if(v){if(g.parentToolUseId){const S=o.get(g.parentToolUseId);if(S){const E=c.get(S.id);if(E){E.kind="agent",E.children.push(v),d.add(S.id);continue}}p.push(v);continue}if(g.parentId){const S=s.get(g.parentId);if(S){S.children.push(v);continue}p.push(v);continue}m.push(v)}}const b=[];for(const g of p){const v=i.find(E=>E.subagentId===g.sourceId);if(!v){m.push(g);continue}let S=!1;if(v.parentToolUseId){const E=o.get(v.parentToolUseId);if(E){const A=c.get(E.id);A&&(A.kind="agent",A.children.push(g),d.add(E.id),S=!0)}}if(!S&&v.parentId){const E=s.get(v.parentId);E&&(E.children.push(g),S=!0)}S||b.push(g)}for(const g of b)m.push(g);for(const g of l)if(!d.has(g.id)){const v=c.get(g.id);v&&m.push(v)}return m.sort((g,v)=>g.seq-v.seq),m}const ZE={read:li,write:mo,shell:Df,agent:po,skill:ak,dag:$S,mcp:nk,web:_f,browser:oi,plan:ZS,other:Sb},KE={read:"text-cat-read",write:"text-cat-write",shell:"text-cat-shell",agent:"text-cat-agent",skill:"text-cat-skill",dag:"text-cat-dag",mcp:"text-cat-mcp",web:"text-cat-web",browser:"text-cat-browser",plan:"text-cat-plan",other:"text-cat-other"};function Hx(t){let l=0;for(const i of t.children)i.kind==="tool"&&l++,l+=Hx(i);return l}function qx(t){let l=t.durationMs??0;for(const i of t.children)l+=qx(i);return l}function PE({category:t,status:l}){const i=ZE[t],a=KE[t];return y.jsx(i,{className:se("h-3.5 w-3.5 shrink-0",a,l==="running"&&"animate-shimmer-pulse",l==="error"&&"text-status-failed",l==="cancelled"&&"opacity-50"),"aria-hidden":!0})}function df({node:t}){if(t.status==="running"||t.children.length===0)return null;if(t.status==="error")return y.jsx("div",{className:"mt-0.5 pl-5 text-[11px] text-status-failed",children:"Failed"});if(t.status==="cancelled")return y.jsx("div",{className:"mt-0.5 pl-5 text-[11px] text-muted-foreground",children:"Cancelled"});const l=Hx(t),i=t.durationMs??qx(t),a=t.costUsd,o=[];return l>0&&o.push(`${l} tool${l!==1?"s":""}`),i>0&&o.push(Ux(i)),a!=null&&a>0&&o.push(Bx(a)),y.jsxs("div",{className:"mt-0.5 pl-5 text-[11px] text-muted-foreground",children:["Done",o.length>0?` (${o.join(" · ")})`:""]})}function Ix({node:t,depth:l=0,isLast:i=!1}){const a=t.kind==="agent"&&t.children.length>0,[o,c]=k.useState(t.isActive),s=t.children.length>0,d=t.kind==="agent",m=o?dd:Eo;return y.jsxs("div",{className:se("relative",l>0&&"pl-3"),children:[y.jsxs("div",{className:se("flex items-center gap-1.5 py-0.5 group",a&&"cursor-pointer select-none"),onClick:a?()=>c(p=>!p):void 0,role:a?"button":void 0,"aria-expanded":a?o:void 0,children:[a?y.jsx(m,{className:"h-3 w-3 shrink-0 text-muted-foreground/50"}):y.jsx("span",{className:"h-3 w-3 shrink-0","aria-hidden":!0}),y.jsx(PE,{category:t.category,status:t.status}),y.jsx("span",{className:se("text-[12px] font-mono leading-none",t.status==="cancelled"&&"opacity-50",t.status==="error"&&"text-status-failed",t.status==="running"&&"text-foreground",t.status==="ok"&&"text-foreground/80"),children:t.label}),d&&t.model&&y.jsx("span",{className:"bg-secondary rounded px-1 py-0.5 text-[10px] font-mono text-muted-foreground",children:t.model}),d&&t.agentType&&y.jsx("span",{className:"bg-secondary rounded px-1 py-0.5 text-[10px] font-mono text-muted-foreground",children:t.agentType}),d&&t.turnCount!=null&&t.turnCount>0&&y.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:[t.turnCount," turn",t.turnCount!==1?"s":""]}),t.durationMs!=null&&t.durationMs>0&&y.jsx("span",{className:"text-[10px] font-mono text-muted-foreground tabular-nums",children:Ux(t.durationMs)}),d&&t.costUsd!=null&&t.costUsd>0&&y.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:Bx(t.costUsd)})]}),d&&t.preview&&y.jsx("div",{className:"pl-5 text-[11px] italic text-muted-foreground/60 line-clamp-1 leading-tight",children:t.preview}),d&&!o&&s&&y.jsx(df,{node:t}),s&&o&&y.jsxs("div",{className:se("relative mt-0.5 ml-[22px]","border-l-2 border-spine"),children:[t.children.map((p,b)=>{const g=b===t.children.length-1;return y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:se("absolute left-0 top-[10px] h-0 w-3","border-t-2 border-spine",g&&"last-child-clip"),"aria-hidden":!0}),g&&y.jsx("div",{className:"absolute left-[-2px] top-[10px] bottom-0 w-[2px] bg-background","aria-hidden":!0}),y.jsx("div",{className:"pl-3",children:y.jsx(Ix,{node:p,depth:l+1,isLast:g})})]},p.id)}),d&&t.status!=="running"&&y.jsx(df,{node:t})]}),d&&(!s||!o)&&t.status!=="running"&&(s?null:y.jsx(df,{node:t}))]})}function $E({nodes:t,className:l}){return y.jsxs("div",{className:se("relative pl-3 border-l-2 border-spine/40",l),children:[y.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-widest text-muted-foreground/40 select-none",children:"Execution"}),t.length===0?y.jsx("div",{className:"text-[11px] text-muted-foreground/30 italic py-1",children:"No activity yet"}):y.jsx("div",{className:"flex flex-col gap-0.5",children:t.map((i,a)=>y.jsx(Ix,{node:i,depth:0,isLast:a===t.length-1},i.id))})]})}const JE=new Set(["tool","subagent","notice"]),WE=new Set(["user","assistant","thinking","error","bg_job"]);function eC(t){const l=[];let i=0;for(;i<t.length;){const a=t[i];if(a===void 0){i++;continue}if(WE.has(a.kind)){l.push({kind:"text",item:a}),i++;continue}const o=[];for(;i<t.length;){const c=t[i];if(c===void 0||!JE.has(c.kind))break;o.push(c),i++}if(o.length>0){const c=QE(o);l.push({kind:"execution",items:o,id:o[0].id,spineNodes:c})}}return l}function tC({slots:t,renderTextItem:l}){return y.jsx(y.Fragment,{children:t.map((i,a)=>i.kind==="text"?l(i.item,a):y.jsx("div",{className:"py-2 px-1",children:y.jsx($E,{nodes:i.spineNodes})},i.id))})}function nC(t){return k.useMemo(()=>eC(t),[t])}function lC(t,l){const i=l||{};return(t[t.length-1]===""?[...t,""]:t).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const rC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aC={};function yy(t,l){return(aC.jsx?iC:rC).test(t)}const uC=/[ \t\n\f\r]/g;function oC(t){return typeof t=="object"?t.type==="text"?by(t.value):!1:by(t)}function by(t){return t.replace(uC,"")===""}class za{constructor(l,i,a){this.normal=i,this.property=l,a&&(this.space=a)}}za.prototype.normal={};za.prototype.property={};za.prototype.space=void 0;function Vx(t,l){const i={},a={};for(const o of t)Object.assign(i,o.property),Object.assign(a,o.normal);return new za(i,a,l)}function Zf(t){return t.toLowerCase()}class Gt{constructor(l,i){this.attribute=i,this.property=l}}Gt.prototype.attribute="";Gt.prototype.booleanish=!1;Gt.prototype.boolean=!1;Gt.prototype.commaOrSpaceSeparated=!1;Gt.prototype.commaSeparated=!1;Gt.prototype.defined=!1;Gt.prototype.mustUseProperty=!1;Gt.prototype.number=!1;Gt.prototype.overloadedBoolean=!1;Gt.prototype.property="";Gt.prototype.spaceSeparated=!1;Gt.prototype.space=void 0;let sC=0;const Ee=sr(),ft=sr(),Kf=sr(),ie=sr(),Pe=sr(),lr=sr(),Wt=sr();function sr(){return 2**++sC}const Pf=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ee,booleanish:ft,commaOrSpaceSeparated:Wt,commaSeparated:lr,number:ie,overloadedBoolean:Kf,spaceSeparated:Pe},Symbol.toStringTag,{value:"Module"})),hf=Object.keys(Pf);class Td extends Gt{constructor(l,i,a,o){let c=-1;if(super(l,i),xy(this,"space",o),typeof a=="number")for(;++c<hf.length;){const s=hf[c];xy(this,hf[c],(a&Pf[s])===Pf[s])}}}Td.prototype.defined=!0;function xy(t,l,i){i&&(t[l]=i)}function pi(t){const l={},i={};for(const[a,o]of Object.entries(t.properties)){const c=new Td(a,t.transform(t.attributes||{},a),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(a)&&(c.mustUseProperty=!0),l[a]=c,i[Zf(a)]=a,i[Zf(c.attribute)]=a}return new za(l,i,t.space)}const Yx=pi({properties:{ariaActiveDescendant:null,ariaAtomic:ft,ariaAutoComplete:null,ariaBusy:ft,ariaChecked:ft,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,ariaControls:Pe,ariaCurrent:null,ariaDescribedBy:Pe,ariaDetails:null,ariaDisabled:ft,ariaDropEffect:Pe,ariaErrorMessage:null,ariaExpanded:ft,ariaFlowTo:Pe,ariaGrabbed:ft,ariaHasPopup:null,ariaHidden:ft,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Pe,ariaLevel:ie,ariaLive:null,ariaModal:ft,ariaMultiLine:ft,ariaMultiSelectable:ft,ariaOrientation:null,ariaOwns:Pe,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:ft,ariaReadOnly:ft,ariaRelevant:null,ariaRequired:ft,ariaRoleDescription:Pe,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:ft,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function Gx(t,l){return l in t?t[l]:l}function Fx(t,l){return Gx(t,l.toLowerCase())}const cC=pi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:lr,acceptCharset:Pe,accessKey:Pe,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alpha:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:Pe,autoFocus:Ee,autoPlay:Ee,blocking:Pe,capture:null,charSet:null,checked:Ee,cite:null,className:Pe,closedBy:null,colorSpace:null,cols:ie,colSpan:ie,command:null,commandFor:null,content:null,contentEditable:ft,controls:Ee,controlsList:Pe,coords:ie|lr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:Kf,draggable:ft,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:Pe,height:ie,hidden:Kf,high:ie,href:null,hrefLang:null,htmlFor:Pe,httpEquiv:Pe,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:Pe,itemRef:Pe,itemScope:Ee,itemType:Pe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,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:Ee,optimum:ie,pattern:null,ping:Pe,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:Pe,required:Ee,reversed:Ee,rows:ie,rowSpan:ie,sandbox:Pe,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootCustomElementRegistry:Ee,shadowRootDelegatesFocus:Ee,shadowRootMode:null,shadowRootSerializable:Ee,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:ft,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:Ee,useMap:null,value:ft,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Pe,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:ft,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ee,disablePictureInPicture:Ee,disableRemotePlayback:Ee,exportParts:lr,part:Pe,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:Fx}),fC=pi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Wt,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,className:Pe,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:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:Ee,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,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:lr,g2:lr,glyphName:lr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:Wt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ie,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:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Pe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wt,rev:Wt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wt,requiredFeatures:Wt,requiredFonts:Wt,requiredFormats:Wt,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:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:Wt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Wt,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Wt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Gx}),Xx=pi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,l){return"xlink:"+l.slice(5).toLowerCase()}}),Qx=pi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fx}),Zx=pi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),dC={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"},hC=/[A-Z]/g,vy=/-[a-z]/g,mC=/^data[-\w.:]+$/i;function pC(t,l){const i=Zf(l);let a=l,o=Gt;if(i in t.normal)return t.property[t.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&mC.test(l)){if(l.charAt(4)==="-"){const c=l.slice(5).replace(vy,yC);a="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=l.slice(4);if(!vy.test(c)){let s=c.replace(hC,gC);s.charAt(0)!=="-"&&(s="-"+s),l="data"+s}}o=Td}return new o(a,l)}function gC(t){return"-"+t.toLowerCase()}function yC(t){return t.charAt(1).toUpperCase()}const bC=Vx([Yx,cC,Xx,Qx,Zx],"html"),Ad=Vx([Yx,fC,Xx,Qx,Zx],"svg");function xC(t){return t.join(" ").trim()}var ni={},mf,Sy;function vC(){if(Sy)return mf;Sy=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,d=/^\s+|\s+$/g,m=`
346
346
  `,p="/",b="*",g="",v="comment",S="declaration";function E(j,N){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];N=N||{};var R=1,L=1;function W(ue){var ne=ue.match(l);ne&&(R+=ne.length);var B=ue.lastIndexOf(m);L=~B?ue.length-B:L+ue.length}function ee(){var ue={line:R,column:L};return function(ne){return ne.position=new D(ue),ae(),ne}}function D(ue){this.start=ue,this.end={line:R,column:L},this.source=N.source}D.prototype.content=j;function X(ue){var ne=new Error(N.source+":"+R+":"+L+": "+ue);if(ne.reason=ue,ne.filename=N.source,ne.line=R,ne.column=L,ne.source=j,!N.silent)throw ne}function V(ue){var ne=ue.exec(j);if(ne){var B=ne[0];return W(B),j=j.slice(B.length),ne}}function ae(){V(i)}function H(ue){var ne;for(ue=ue||[];ne=re();)ne!==!1&&ue.push(ne);return ue}function re(){var ue=ee();if(!(p!=j.charAt(0)||b!=j.charAt(1))){for(var ne=2;g!=j.charAt(ne)&&(b!=j.charAt(ne)||p!=j.charAt(ne+1));)++ne;if(ne+=2,g===j.charAt(ne-1))return X("End of comment missing");var B=j.slice(2,ne-2);return L+=2,W(B),j=j.slice(ne),L+=2,ue({type:v,comment:B})}}function P(){var ue=ee(),ne=V(a);if(ne){if(re(),!V(o))return X("property missing ':'");var B=V(c),Q=ue({type:S,property:A(ne[0].replace(t,g)),value:B?A(B[0].replace(t,g)):g});return V(s),Q}}function be(){var ue=[];H(ue);for(var ne;ne=P();)ne!==!1&&(ue.push(ne),H(ue));return ue}return ae(),be()}function A(j){return j?j.replace(d,g):g}return mf=E,mf}var ky;function SC(){if(ky)return ni;ky=1;var t=ni&&ni.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(ni,"__esModule",{value:!0}),ni.default=i;const l=t(vC());function i(a,o){let c=null;if(!a||typeof a!="string")return c;const s=(0,l.default)(a),d=typeof o=="function";return s.forEach(m=>{if(m.type!=="declaration")return;const{property:p,value:b}=m;d?o(p,b,m):b&&(c=c||{},c[p]=b)}),c}return ni}var ha={},wy;function kC(){if(wy)return ha;wy=1,Object.defineProperty(ha,"__esModule",{value:!0}),ha.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,i=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=function(p){return!p||i.test(p)||t.test(p)},s=function(p,b){return b.toUpperCase()},d=function(p,b){return"".concat(b,"-")},m=function(p,b){return b===void 0&&(b={}),c(p)?p:(p=p.toLowerCase(),b.reactCompat?p=p.replace(o,d):p=p.replace(a,d),p.replace(l,s))};return ha.camelCase=m,ha}var ma,Ey;function wC(){if(Ey)return ma;Ey=1;var t=ma&&ma.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},l=t(SC()),i=kC();function a(o,c){var s={};return!o||typeof o!="string"||(0,l.default)(o,function(d,m){d&&m&&(s[(0,i.camelCase)(d,c)]=m)}),s}return a.default=a,ma=a,ma}var EC=wC();const CC=od(EC),Kx=Px("end"),Nd=Px("start");function Px(t){return l;function l(i){const a=i&&i.position&&i.position[t]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function TC(t){const l=Nd(t),i=Kx(t);if(l&&i)return{start:l,end:i}}function Sa(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Cy(t.position):"start"in t||"end"in t?Cy(t):"line"in t||"column"in t?$f(t):""}function $f(t){return Ty(t&&t.line)+":"+Ty(t&&t.column)}function Cy(t){return $f(t&&t.start)+"-"+$f(t&&t.end)}function Ty(t){return t&&typeof t=="number"?t:1}class Tt extends Error{constructor(l,i,a){super(),typeof i=="string"&&(a=i,i=void 0);let o="",c={},s=!1;if(i&&("line"in i&&"column"in i?c={place:i}:"start"in i&&"end"in i?c={place:i}:"type"in i?c={ancestors:[i],place:i.position}:c={...i}),typeof l=="string"?o=l:!c.cause&&l&&(s=!0,o=l.message,c.cause=l),!c.ruleId&&!c.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?c.ruleId=a:(c.source=a.slice(0,m),c.ruleId=a.slice(m+1))}if(!c.place&&c.ancestors&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=d?d.line:void 0,this.name=Sa(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=s&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Tt.prototype.file="";Tt.prototype.name="";Tt.prototype.reason="";Tt.prototype.message="";Tt.prototype.stack="";Tt.prototype.column=void 0;Tt.prototype.line=void 0;Tt.prototype.ancestors=void 0;Tt.prototype.cause=void 0;Tt.prototype.fatal=void 0;Tt.prototype.place=void 0;Tt.prototype.ruleId=void 0;Tt.prototype.source=void 0;const jd={}.hasOwnProperty,AC=new Map,NC=/[A-Z]/g,jC=new Set(["table","tbody","thead","tfoot","tr"]),zC=new Set(["td","th"]),$x="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function MC(t,l){if(!l||l.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=l.filePath||void 0;let a;if(l.development){if(typeof l.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=HC(i,l.jsxDEV)}else{if(typeof l.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof l.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=BC(i,l.jsx,l.jsxs)}const o={Fragment:l.Fragment,ancestors:[],components:l.components||{},create:a,elementAttributeNameCase:l.elementAttributeNameCase||"react",evaluater:l.createEvaluater?l.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:l.ignoreInvalidStyle||!1,passKeys:l.passKeys!==!1,passNode:l.passNode||!1,schema:l.space==="svg"?Ad:bC,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},c=Jx(o,t,void 0);return c&&typeof c!="string"?c:o.create(t,o.Fragment,{children:c||void 0},void 0)}function Jx(t,l,i){if(l.type==="element")return _C(t,l,i);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return DC(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return RC(t,l,i);if(l.type==="mdxjsEsm")return OC(t,l);if(l.type==="root")return LC(t,l,i);if(l.type==="text")return UC(t,l)}function _C(t,l,i){const a=t.schema;let o=a;l.tagName.toLowerCase()==="svg"&&a.space==="html"&&(o=Ad,t.schema=o),t.ancestors.push(l);const c=e0(t,l.tagName,!1),s=qC(t,l);let d=Md(t,l);return jC.has(l.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!oC(m):!0})),Wx(t,s,c,l),zd(s,d),t.ancestors.pop(),t.schema=a,t.create(l,c,s,i)}function DC(t,l){if(l.data&&l.data.estree&&t.evaluater){const a=l.data.estree.body[0];return a.type,t.evaluater.evaluateExpression(a.expression)}Ca(t,l.position)}function OC(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);Ca(t,l.position)}function RC(t,l,i){const a=t.schema;let o=a;l.name==="svg"&&a.space==="html"&&(o=Ad,t.schema=o),t.ancestors.push(l);const c=l.name===null?t.Fragment:e0(t,l.name,!0),s=IC(t,l),d=Md(t,l);return Wx(t,s,c,l),zd(s,d),t.ancestors.pop(),t.schema=a,t.create(l,c,s,i)}function LC(t,l,i){const a={};return zd(a,Md(t,l)),t.create(l,t.Fragment,a,i)}function UC(t,l){return l.value}function Wx(t,l,i,a){typeof i!="string"&&i!==t.Fragment&&t.passNode&&(l.node=a)}function zd(t,l){if(l.length>0){const i=l.length>1?l:l[0];i&&(t.children=i)}}function BC(t,l,i){return a;function a(o,c,s,d){const p=Array.isArray(s.children)?i:l;return d?p(c,s,d):p(c,s)}}function HC(t,l){return i;function i(a,o,c,s){const d=Array.isArray(c.children),m=Nd(a);return l(o,c,s,d,{columnNumber:m?m.column-1:void 0,fileName:t,lineNumber:m?m.line:void 0},void 0)}}function qC(t,l){const i={};let a,o;for(o in l.properties)if(o!=="children"&&jd.call(l.properties,o)){const c=VC(t,o,l.properties[o]);if(c){const[s,d]=c;t.tableCellAlignToStyle&&s==="align"&&typeof d=="string"&&zC.has(l.tagName)?a=d:i[s]=d}}if(a){const c=i.style||(i.style={});c[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return i}function IC(t,l){const i={};for(const a of l.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&t.evaluater){const c=a.data.estree.body[0];c.type;const s=c.expression;s.type;const d=s.properties[0];d.type,Object.assign(i,t.evaluater.evaluateExpression(d.argument))}else Ca(t,l.position);else{const o=a.name;let c;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&t.evaluater){const d=a.value.data.estree.body[0];d.type,c=t.evaluater.evaluateExpression(d.expression)}else Ca(t,l.position);else c=a.value===null?!0:a.value;i[o]=c}return i}function Md(t,l){const i=[];let a=-1;const o=t.passKeys?new Map:AC;for(;++a<l.children.length;){const c=l.children[a];let s;if(t.passKeys){const m=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(m){const p=o.get(m)||0;s=m+"-"+p,o.set(m,p+1)}}const d=Jx(t,c,s);d!==void 0&&i.push(d)}return i}function VC(t,l,i){const a=pC(t.schema,l);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=a.commaSeparated?lC(i):xC(i)),a.property==="style"){let o=typeof i=="object"?i:YC(t,String(i));return t.stylePropertyNameCase==="css"&&(o=GC(o)),["style",o]}return[t.elementAttributeNameCase==="react"&&a.space?dC[a.property]||a.property:a.attribute,i]}}function YC(t,l){try{return CC(l,{reactCompat:!0})}catch(i){if(t.ignoreInvalidStyle)return{};const a=i,o=new Tt("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=t.filePath||void 0,o.url=$x+"#cannot-parse-style-attribute",o}}function e0(t,l,i){let a;if(!i)a={type:"Literal",value:l};else if(l.includes(".")){const o=l.split(".");let c=-1,s;for(;++c<o.length;){const d=yy(o[c])?{type:"Identifier",name:o[c]}:{type:"Literal",value:o[c]};s=s?{type:"MemberExpression",object:s,property:d,computed:!!(c&&d.type==="Literal"),optional:!1}:d}a=s}else a=yy(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(a.type==="Literal"){const o=a.value;return jd.call(t.components,o)?t.components[o]:o}if(t.evaluater)return t.evaluater.evaluateExpression(a);Ca(t)}function Ca(t,l){const i=new Tt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=$x+"#cannot-handle-mdx-estrees-without-createevaluater",i}function GC(t){const l={};let i;for(i in t)jd.call(t,i)&&(l[FC(i)]=t[i]);return l}function FC(t){let l=t.replace(NC,XC);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function XC(t){return"-"+t.toLowerCase()}const pf={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"]},QC={};function _d(t,l){const i=QC,a=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,o=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return t0(t,a,o)}function t0(t,l,i){if(ZC(t)){if("value"in t)return t.type==="html"&&!i?"":t.value;if(l&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Ay(t.children,l,i)}return Array.isArray(t)?Ay(t,l,i):""}function Ay(t,l,i){const a=[];let o=-1;for(;++o<t.length;)a[o]=t0(t[o],l,i);return a.join("")}function ZC(t){return!!(t&&typeof t=="object")}const Ny=document.createElement("i");function Dd(t){const l="&"+t+";";Ny.innerHTML=l;const i=Ny.textContent;return i.charCodeAt(i.length-1)===59&&t!=="semi"||i===l?!1:i}function en(t,l,i,a){const o=t.length;let c=0,s;if(l<0?l=-l>o?0:o+l:l=l>o?o:l,i=i>0?i:0,a.length<1e4)s=Array.from(a),s.unshift(l,i),t.splice(...s);else for(i&&t.splice(l,i);c<a.length;)s=a.slice(c,c+1e4),s.unshift(l,0),t.splice(...s),c+=1e4,l+=1e4}function hn(t,l){return t.length>0?(en(t,t.length,0,l),t):l}const jy={}.hasOwnProperty;function n0(t){const l={};let i=-1;for(;++i<t.length;)KC(l,t[i]);return l}function KC(t,l){let i;for(i in l){const o=(jy.call(t,i)?t[i]:void 0)||(t[i]={}),c=l[i];let s;if(c)for(s in c){jy.call(o,s)||(o[s]=[]);const d=c[s];PC(o[s],Array.isArray(d)?d:d?[d]:[])}}}function PC(t,l){let i=-1;const a=[];for(;++i<l.length;)(l[i].add==="after"?t:a).push(l[i]);en(t,0,0,a)}function l0(t,l){const i=Number.parseInt(t,l);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Sn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zt=Ol(/[A-Za-z]/),Ct=Ol(/[\dA-Za-z]/),$C=Ol(/[#-'*+\--9=?A-Z^-~]/);function vo(t){return t!==null&&(t<32||t===127)}const Jf=Ol(/\d/),JC=Ol(/[\dA-Fa-f]/),WC=Ol(/[!-/:-@[-`{-~]/);function xe(t){return t!==null&&t<-2}function $e(t){return t!==null&&(t<0||t===32)}function De(t){return t===-2||t===-1||t===32}const Ao=Ol(new RegExp("\\p{P}|\\p{S}","u")),ar=Ol(/\s/);function Ol(t){return l;function l(i){return i!==null&&i>-1&&t.test(String.fromCharCode(i))}}function gi(t){const l=[];let i=-1,a=0,o=0;for(;++i<t.length;){const c=t.charCodeAt(i);let s="";if(c===37&&Ct(t.charCodeAt(i+1))&&Ct(t.charCodeAt(i+2)))o=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(s=String.fromCharCode(c));else if(c>55295&&c<57344){const d=t.charCodeAt(i+1);c<56320&&d>56319&&d<57344?(s=String.fromCharCode(c,d),o=1):s="�"}else s=String.fromCharCode(c);s&&(l.push(t.slice(a,i),encodeURIComponent(s)),a=i+o+1,s=""),o&&(i+=o,o=0)}return l.join("")+t.slice(a)}function Ue(t,l,i,a){const o=a?a-1:Number.POSITIVE_INFINITY;let c=0;return s;function s(m){return De(m)?(t.enter(i),d(m)):l(m)}function d(m){return De(m)&&c++<o?(t.consume(m),d):(t.exit(i),l(m))}}const eT={tokenize:tT};function tT(t){const l=t.attempt(this.parser.constructs.contentInitial,a,o);let i;return l;function a(d){if(d===null){t.consume(d);return}return t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),Ue(t,l,"linePrefix")}function o(d){return t.enter("paragraph"),c(d)}function c(d){const m=t.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=m),i=m,s(d)}function s(d){if(d===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(d);return}return xe(d)?(t.consume(d),t.exit("chunkText"),c):(t.consume(d),s)}}const nT={tokenize:lT},zy={tokenize:rT};function lT(t){const l=this,i=[];let a=0,o,c,s;return d;function d(L){if(a<i.length){const W=i[a];return l.containerState=W[1],t.attempt(W[0].continuation,m,p)(L)}return p(L)}function m(L){if(a++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,o&&R();const W=l.events.length;let ee=W,D;for(;ee--;)if(l.events[ee][0]==="exit"&&l.events[ee][1].type==="chunkFlow"){D=l.events[ee][1].end;break}N(a);let X=W;for(;X<l.events.length;)l.events[X][1].end={...D},X++;return en(l.events,ee+1,0,l.events.slice(W)),l.events.length=X,p(L)}return d(L)}function p(L){if(a===i.length){if(!o)return v(L);if(o.currentConstruct&&o.currentConstruct.concrete)return E(L);l.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(zy,b,g)(L)}function b(L){return o&&R(),N(a),v(L)}function g(L){return l.parser.lazy[l.now().line]=a!==i.length,s=l.now().offset,E(L)}function v(L){return l.containerState={},t.attempt(zy,S,E)(L)}function S(L){return a++,i.push([l.currentConstruct,l.containerState]),v(L)}function E(L){if(L===null){o&&R(),N(0),t.consume(L);return}return o=o||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),A(L)}function A(L){if(L===null){j(t.exit("chunkFlow"),!0),N(0),t.consume(L);return}return xe(L)?(t.consume(L),j(t.exit("chunkFlow")),a=0,l.interrupt=void 0,d):(t.consume(L),A)}function j(L,W){const ee=l.sliceStream(L);if(W&&ee.push(null),L.previous=c,c&&(c.next=L),c=L,o.defineSkip(L.start),o.write(ee),l.parser.lazy[L.start.line]){let D=o.events.length;for(;D--;)if(o.events[D][1].start.offset<s&&(!o.events[D][1].end||o.events[D][1].end.offset>s))return;const X=l.events.length;let V=X,ae,H;for(;V--;)if(l.events[V][0]==="exit"&&l.events[V][1].type==="chunkFlow"){if(ae){H=l.events[V][1].end;break}ae=!0}for(N(a),D=X;D<l.events.length;)l.events[D][1].end={...H},D++;en(l.events,V+1,0,l.events.slice(X)),l.events.length=D}}function N(L){let W=i.length;for(;W-- >L;){const ee=i[W];l.containerState=ee[1],ee[0].exit.call(l,t)}i.length=L}function R(){o.write([null]),c=void 0,o=void 0,l.containerState._closeFlow=void 0}}function rT(t,l,i){return Ue(t,t.attempt(this.parser.constructs.document,l,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function di(t){if(t===null||$e(t)||ar(t))return 1;if(Ao(t))return 2}function No(t,l,i){const a=[];let o=-1;for(;++o<t.length;){const c=t[o].resolveAll;c&&!a.includes(c)&&(l=c(l,i),a.push(c))}return l}const Wf={name:"attention",resolveAll:iT,tokenize:aT};function iT(t,l){let i=-1,a,o,c,s,d,m,p,b;for(;++i<t.length;)if(t[i][0]==="enter"&&t[i][1].type==="attentionSequence"&&t[i][1]._close){for(a=i;a--;)if(t[a][0]==="exit"&&t[a][1].type==="attentionSequence"&&t[a][1]._open&&l.sliceSerialize(t[a][1]).charCodeAt(0)===l.sliceSerialize(t[i][1]).charCodeAt(0)){if((t[a][1]._close||t[i][1]._open)&&(t[i][1].end.offset-t[i][1].start.offset)%3&&!((t[a][1].end.offset-t[a][1].start.offset+t[i][1].end.offset-t[i][1].start.offset)%3))continue;m=t[a][1].end.offset-t[a][1].start.offset>1&&t[i][1].end.offset-t[i][1].start.offset>1?2:1;const g={...t[a][1].end},v={...t[i][1].start};My(g,-m),My(v,m),s={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...t[a][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...t[i][1].start},end:v},c={type:m>1?"strongText":"emphasisText",start:{...t[a][1].end},end:{...t[i][1].start}},o={type:m>1?"strong":"emphasis",start:{...s.start},end:{...d.end}},t[a][1].end={...s.start},t[i][1].start={...d.end},p=[],t[a][1].end.offset-t[a][1].start.offset&&(p=hn(p,[["enter",t[a][1],l],["exit",t[a][1],l]])),p=hn(p,[["enter",o,l],["enter",s,l],["exit",s,l],["enter",c,l]]),p=hn(p,No(l.parser.constructs.insideSpan.null,t.slice(a+1,i),l)),p=hn(p,[["exit",c,l],["enter",d,l],["exit",d,l],["exit",o,l]]),t[i][1].end.offset-t[i][1].start.offset?(b=2,p=hn(p,[["enter",t[i][1],l],["exit",t[i][1],l]])):b=0,en(t,a-1,i-a+3,p),i=a+p.length-b-2;break}}for(i=-1;++i<t.length;)t[i][1].type==="attentionSequence"&&(t[i][1].type="data");return t}function aT(t,l){const i=this.parser.constructs.attentionMarkers.null,a=this.previous,o=di(a);let c;return s;function s(m){return c=m,t.enter("attentionSequence"),d(m)}function d(m){if(m===c)return t.consume(m),d;const p=t.exit("attentionSequence"),b=di(m),g=!b||b===2&&o||i.includes(m),v=!o||o===2&&b||i.includes(a);return p._open=!!(c===42?g:g&&(o||!v)),p._close=!!(c===42?v:v&&(b||!g)),l(m)}}function My(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const uT={name:"autolink",tokenize:oT};function oT(t,l,i){let a=0;return o;function o(S){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(S),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),c}function c(S){return zt(S)?(t.consume(S),s):S===64?i(S):p(S)}function s(S){return S===43||S===45||S===46||Ct(S)?(a=1,d(S)):p(S)}function d(S){return S===58?(t.consume(S),a=0,m):(S===43||S===45||S===46||Ct(S))&&a++<32?(t.consume(S),d):(a=0,p(S))}function m(S){return S===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(S),t.exit("autolinkMarker"),t.exit("autolink"),l):S===null||S===32||S===60||vo(S)?i(S):(t.consume(S),m)}function p(S){return S===64?(t.consume(S),b):$C(S)?(t.consume(S),p):i(S)}function b(S){return Ct(S)?g(S):i(S)}function g(S){return S===46?(t.consume(S),a=0,b):S===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(S),t.exit("autolinkMarker"),t.exit("autolink"),l):v(S)}function v(S){if((S===45||Ct(S))&&a++<63){const E=S===45?v:g;return t.consume(S),E}return i(S)}}const Ma={partial:!0,tokenize:sT};function sT(t,l,i){return a;function a(c){return De(c)?Ue(t,o,"linePrefix")(c):o(c)}function o(c){return c===null||xe(c)?l(c):i(c)}}const r0={continuation:{tokenize:fT},exit:dT,name:"blockQuote",tokenize:cT};function cT(t,l,i){const a=this;return o;function o(s){if(s===62){const d=a.containerState;return d.open||(t.enter("blockQuote",{_container:!0}),d.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),c}return i(s)}function c(s){return De(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),l):(t.exit("blockQuotePrefix"),l(s))}}function fT(t,l,i){const a=this;return o;function o(s){return De(s)?Ue(t,c,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):c(s)}function c(s){return t.attempt(r0,l,i)(s)}}function dT(t){t.exit("blockQuote")}const i0={name:"characterEscape",tokenize:hT};function hT(t,l,i){return a;function a(c){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(c),t.exit("escapeMarker"),o}function o(c){return WC(c)?(t.enter("characterEscapeValue"),t.consume(c),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):i(c)}}const a0={name:"characterReference",tokenize:mT};function mT(t,l,i){const a=this;let o=0,c,s;return d;function d(g){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),m}function m(g){return g===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(g),t.exit("characterReferenceMarkerNumeric"),p):(t.enter("characterReferenceValue"),c=31,s=Ct,b(g))}function p(g){return g===88||g===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(g),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),c=6,s=JC,b):(t.enter("characterReferenceValue"),c=7,s=Jf,b(g))}function b(g){if(g===59&&o){const v=t.exit("characterReferenceValue");return s===Ct&&!Dd(a.sliceSerialize(v))?i(g):(t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return s(g)&&o++<c?(t.consume(g),b):i(g)}}const _y={partial:!0,tokenize:gT},Dy={concrete:!0,name:"codeFenced",tokenize:pT};function pT(t,l,i){const a=this,o={partial:!0,tokenize:ee};let c=0,s=0,d;return m;function m(D){return p(D)}function p(D){const X=a.events[a.events.length-1];return c=X&&X[1].type==="linePrefix"?X[2].sliceSerialize(X[1],!0).length:0,d=D,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),b(D)}function b(D){return D===d?(s++,t.consume(D),b):s<3?i(D):(t.exit("codeFencedFenceSequence"),De(D)?Ue(t,g,"whitespace")(D):g(D))}function g(D){return D===null||xe(D)?(t.exit("codeFencedFence"),a.interrupt?l(D):t.check(_y,A,W)(D)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),v(D))}function v(D){return D===null||xe(D)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),g(D)):De(D)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ue(t,S,"whitespace")(D)):D===96&&D===d?i(D):(t.consume(D),v)}function S(D){return D===null||xe(D)?g(D):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),E(D))}function E(D){return D===null||xe(D)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),g(D)):D===96&&D===d?i(D):(t.consume(D),E)}function A(D){return t.attempt(o,W,j)(D)}function j(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),N}function N(D){return c>0&&De(D)?Ue(t,R,"linePrefix",c+1)(D):R(D)}function R(D){return D===null||xe(D)?t.check(_y,A,W)(D):(t.enter("codeFlowValue"),L(D))}function L(D){return D===null||xe(D)?(t.exit("codeFlowValue"),R(D)):(t.consume(D),L)}function W(D){return t.exit("codeFenced"),l(D)}function ee(D,X,V){let ae=0;return H;function H(ne){return D.enter("lineEnding"),D.consume(ne),D.exit("lineEnding"),re}function re(ne){return D.enter("codeFencedFence"),De(ne)?Ue(D,P,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ne):P(ne)}function P(ne){return ne===d?(D.enter("codeFencedFenceSequence"),be(ne)):V(ne)}function be(ne){return ne===d?(ae++,D.consume(ne),be):ae>=s?(D.exit("codeFencedFenceSequence"),De(ne)?Ue(D,ue,"whitespace")(ne):ue(ne)):V(ne)}function ue(ne){return ne===null||xe(ne)?(D.exit("codeFencedFence"),X(ne)):V(ne)}}}function gT(t,l,i){const a=this;return o;function o(s){return s===null?i(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),c)}function c(s){return a.parser.lazy[a.now().line]?i(s):l(s)}}const gf={name:"codeIndented",tokenize:bT},yT={partial:!0,tokenize:xT};function bT(t,l,i){const a=this;return o;function o(p){return t.enter("codeIndented"),Ue(t,c,"linePrefix",5)(p)}function c(p){const b=a.events[a.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?s(p):i(p)}function s(p){return p===null?m(p):xe(p)?t.attempt(yT,s,m)(p):(t.enter("codeFlowValue"),d(p))}function d(p){return p===null||xe(p)?(t.exit("codeFlowValue"),s(p)):(t.consume(p),d)}function m(p){return t.exit("codeIndented"),l(p)}}function xT(t,l,i){const a=this;return o;function o(s){return a.parser.lazy[a.now().line]?i(s):xe(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):Ue(t,c,"linePrefix",5)(s)}function c(s){const d=a.events[a.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?l(s):xe(s)?o(s):i(s)}}const vT={name:"codeText",previous:kT,resolve:ST,tokenize:wT};function ST(t){let l=t.length-4,i=3,a,o;if((t[i][1].type==="lineEnding"||t[i][1].type==="space")&&(t[l][1].type==="lineEnding"||t[l][1].type==="space")){for(a=i;++a<l;)if(t[a][1].type==="codeTextData"){t[i][1].type="codeTextPadding",t[l][1].type="codeTextPadding",i+=2,l-=2;break}}for(a=i-1,l++;++a<=l;)o===void 0?a!==l&&t[a][1].type!=="lineEnding"&&(o=a):(a===l||t[a][1].type==="lineEnding")&&(t[o][1].type="codeTextData",a!==o+2&&(t[o][1].end=t[a-1][1].end,t.splice(o+2,a-o-2),l-=a-o-2,a=o+2),o=void 0);return t}function kT(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wT(t,l,i){let a=0,o,c;return s;function s(g){return t.enter("codeText"),t.enter("codeTextSequence"),d(g)}function d(g){return g===96?(t.consume(g),a++,d):(t.exit("codeTextSequence"),m(g))}function m(g){return g===null?i(g):g===32?(t.enter("space"),t.consume(g),t.exit("space"),m):g===96?(c=t.enter("codeTextSequence"),o=0,b(g)):xe(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),m):(t.enter("codeTextData"),p(g))}function p(g){return g===null||g===32||g===96||xe(g)?(t.exit("codeTextData"),m(g)):(t.consume(g),p)}function b(g){return g===96?(t.consume(g),o++,b):o===a?(t.exit("codeTextSequence"),t.exit("codeText"),l(g)):(c.type="codeTextData",p(g))}}class ET{constructor(l){this.left=l?[...l]:[],this.right=[]}get(l){if(l<0||l>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+l+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return l<this.left.length?this.left[l]:this.right[this.right.length-l+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(l,i){const a=i??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(l,a):l>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-l+this.left.length).reverse():this.left.slice(l).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(l,i,a){const o=i||0;this.setCursor(Math.trunc(l));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return a&&pa(this.left,a),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(l){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(l)}pushMany(l){this.setCursor(Number.POSITIVE_INFINITY),pa(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),pa(this.right,l.reverse())}setCursor(l){if(!(l===this.left.length||l>this.left.length&&this.right.length===0||l<0&&this.left.length===0))if(l<this.left.length){const i=this.left.splice(l,Number.POSITIVE_INFINITY);pa(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);pa(this.left,i.reverse())}}}function pa(t,l){let i=0;if(l.length<1e4)t.push(...l);else for(;i<l.length;)t.push(...l.slice(i,i+1e4)),i+=1e4}function u0(t){const l={};let i=-1,a,o,c,s,d,m,p;const b=new ET(t);for(;++i<b.length;){for(;i in l;)i=l[i];if(a=b.get(i),i&&a[1].type==="chunkFlow"&&b.get(i-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,c=0,c<m.length&&m[c][1].type==="lineEndingBlank"&&(c+=2),c<m.length&&m[c][1].type==="content"))for(;++c<m.length&&m[c][1].type!=="content";)m[c][1].type==="chunkText"&&(m[c][1]._isInFirstContentOfListItem=!0,c++);if(a[0]==="enter")a[1].contentType&&(Object.assign(l,CT(b,i)),i=l[i],p=!0);else if(a[1]._container){for(c=i,o=void 0;c--;)if(s=b.get(c),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(b.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=c);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;o&&(a[1].end={...b.get(o)[1].start},d=b.slice(o,i),d.unshift(a),b.splice(o,i-o+1,d))}}return en(t,0,Number.POSITIVE_INFINITY,b.slice(0)),!p}function CT(t,l){const i=t.get(l)[1],a=t.get(l)[2];let o=l-1;const c=[];let s=i._tokenizer;s||(s=a.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const d=s.events,m=[],p={};let b,g,v=-1,S=i,E=0,A=0;const j=[A];for(;S;){for(;t.get(++o)[1]!==S;);c.push(o),S._tokenizer||(b=a.sliceStream(S),S.next||b.push(null),g&&s.defineSkip(S.start),S._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(b),S._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),g=S,S=S.next}for(S=i;++v<d.length;)d[v][0]==="exit"&&d[v-1][0]==="enter"&&d[v][1].type===d[v-1][1].type&&d[v][1].start.line!==d[v][1].end.line&&(A=v+1,j.push(A),S._tokenizer=void 0,S.previous=void 0,S=S.next);for(s.events=[],S?(S._tokenizer=void 0,S.previous=void 0):j.pop(),v=j.length;v--;){const N=d.slice(j[v],j[v+1]),R=c.pop();m.push([R,R+N.length-1]),t.splice(R,2,N)}for(m.reverse(),v=-1;++v<m.length;)p[E+m[v][0]]=E+m[v][1],E+=m[v][1]-m[v][0]-1;return p}const TT={resolve:NT,tokenize:jT},AT={partial:!0,tokenize:zT};function NT(t){return u0(t),t}function jT(t,l){let i;return a;function a(d){return t.enter("content"),i=t.enter("chunkContent",{contentType:"content"}),o(d)}function o(d){return d===null?c(d):xe(d)?t.check(AT,s,c)(d):(t.consume(d),o)}function c(d){return t.exit("chunkContent"),t.exit("content"),l(d)}function s(d){return t.consume(d),t.exit("chunkContent"),i.next=t.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,o}}function zT(t,l,i){const a=this;return o;function o(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),Ue(t,c,"linePrefix")}function c(s){if(s===null||xe(s))return i(s);const d=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?l(s):t.interrupt(a.parser.constructs.flow,i,l)(s)}}function o0(t,l,i,a,o,c,s,d,m){const p=m||Number.POSITIVE_INFINITY;let b=0;return g;function g(N){return N===60?(t.enter(a),t.enter(o),t.enter(c),t.consume(N),t.exit(c),v):N===null||N===32||N===41||vo(N)?i(N):(t.enter(a),t.enter(s),t.enter(d),t.enter("chunkString",{contentType:"string"}),A(N))}function v(N){return N===62?(t.enter(c),t.consume(N),t.exit(c),t.exit(o),t.exit(a),l):(t.enter(d),t.enter("chunkString",{contentType:"string"}),S(N))}function S(N){return N===62?(t.exit("chunkString"),t.exit(d),v(N)):N===null||N===60||xe(N)?i(N):(t.consume(N),N===92?E:S)}function E(N){return N===60||N===62||N===92?(t.consume(N),S):S(N)}function A(N){return!b&&(N===null||N===41||$e(N))?(t.exit("chunkString"),t.exit(d),t.exit(s),t.exit(a),l(N)):b<p&&N===40?(t.consume(N),b++,A):N===41?(t.consume(N),b--,A):N===null||N===32||N===40||vo(N)?i(N):(t.consume(N),N===92?j:A)}function j(N){return N===40||N===41||N===92?(t.consume(N),A):A(N)}}function s0(t,l,i,a,o,c){const s=this;let d=0,m;return p;function p(S){return t.enter(a),t.enter(o),t.consume(S),t.exit(o),t.enter(c),b}function b(S){return d>999||S===null||S===91||S===93&&!m||S===94&&!d&&"_hiddenFootnoteSupport"in s.parser.constructs?i(S):S===93?(t.exit(c),t.enter(o),t.consume(S),t.exit(o),t.exit(a),l):xe(S)?(t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),b):(t.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||S===91||S===93||xe(S)||d++>999?(t.exit("chunkString"),b(S)):(t.consume(S),m||(m=!De(S)),S===92?v:g)}function v(S){return S===91||S===92||S===93?(t.consume(S),d++,g):g(S)}}function c0(t,l,i,a,o,c){let s;return d;function d(v){return v===34||v===39||v===40?(t.enter(a),t.enter(o),t.consume(v),t.exit(o),s=v===40?41:v,m):i(v)}function m(v){return v===s?(t.enter(o),t.consume(v),t.exit(o),t.exit(a),l):(t.enter(c),p(v))}function p(v){return v===s?(t.exit(c),m(s)):v===null?i(v):xe(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),Ue(t,p,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),b(v))}function b(v){return v===s||v===null||xe(v)?(t.exit("chunkString"),p(v)):(t.consume(v),v===92?g:b)}function g(v){return v===s||v===92?(t.consume(v),b):b(v)}}function ka(t,l){let i;return a;function a(o){return xe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i=!0,a):De(o)?Ue(t,a,i?"linePrefix":"lineSuffix")(o):l(o)}}const MT={name:"definition",tokenize:DT},_T={partial:!0,tokenize:OT};function DT(t,l,i){const a=this;let o;return c;function c(S){return t.enter("definition"),s(S)}function s(S){return s0.call(a,t,d,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(S)}function d(S){return o=Sn(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),S===58?(t.enter("definitionMarker"),t.consume(S),t.exit("definitionMarker"),m):i(S)}function m(S){return $e(S)?ka(t,p)(S):p(S)}function p(S){return o0(t,b,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(S)}function b(S){return t.attempt(_T,g,g)(S)}function g(S){return De(S)?Ue(t,v,"whitespace")(S):v(S)}function v(S){return S===null||xe(S)?(t.exit("definition"),a.parser.defined.push(o),l(S)):i(S)}}function OT(t,l,i){return a;function a(d){return $e(d)?ka(t,o)(d):i(d)}function o(d){return c0(t,c,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return De(d)?Ue(t,s,"whitespace")(d):s(d)}function s(d){return d===null||xe(d)?l(d):i(d)}}const RT={name:"hardBreakEscape",tokenize:LT};function LT(t,l,i){return a;function a(c){return t.enter("hardBreakEscape"),t.consume(c),o}function o(c){return xe(c)?(t.exit("hardBreakEscape"),l(c)):i(c)}}const UT={name:"headingAtx",resolve:BT,tokenize:HT};function BT(t,l){let i=t.length-2,a=3,o,c;return t[a][1].type==="whitespace"&&(a+=2),i-2>a&&t[i][1].type==="whitespace"&&(i-=2),t[i][1].type==="atxHeadingSequence"&&(a===i-1||i-4>a&&t[i-2][1].type==="whitespace")&&(i-=a+1===i?2:4),i>a&&(o={type:"atxHeadingText",start:t[a][1].start,end:t[i][1].end},c={type:"chunkText",start:t[a][1].start,end:t[i][1].end,contentType:"text"},en(t,a,i-a+1,[["enter",o,l],["enter",c,l],["exit",c,l],["exit",o,l]])),t}function HT(t,l,i){let a=0;return o;function o(b){return t.enter("atxHeading"),c(b)}function c(b){return t.enter("atxHeadingSequence"),s(b)}function s(b){return b===35&&a++<6?(t.consume(b),s):b===null||$e(b)?(t.exit("atxHeadingSequence"),d(b)):i(b)}function d(b){return b===35?(t.enter("atxHeadingSequence"),m(b)):b===null||xe(b)?(t.exit("atxHeading"),l(b)):De(b)?Ue(t,d,"whitespace")(b):(t.enter("atxHeadingText"),p(b))}function m(b){return b===35?(t.consume(b),m):(t.exit("atxHeadingSequence"),d(b))}function p(b){return b===null||b===35||$e(b)?(t.exit("atxHeadingText"),d(b)):(t.consume(b),p)}}const qT=["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"],Oy=["pre","script","style","textarea"],IT={concrete:!0,name:"htmlFlow",resolveTo:GT,tokenize:FT},VT={partial:!0,tokenize:QT},YT={partial:!0,tokenize:XT};function GT(t){let l=t.length;for(;l--&&!(t[l][0]==="enter"&&t[l][1].type==="htmlFlow"););return l>1&&t[l-2][1].type==="linePrefix"&&(t[l][1].start=t[l-2][1].start,t[l+1][1].start=t[l-2][1].start,t.splice(l-2,2)),t}function FT(t,l,i){const a=this;let o,c,s,d,m;return p;function p(C){return b(C)}function b(C){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(C),g}function g(C){return C===33?(t.consume(C),v):C===47?(t.consume(C),c=!0,A):C===63?(t.consume(C),o=3,a.interrupt?l:T):zt(C)?(t.consume(C),s=String.fromCharCode(C),j):i(C)}function v(C){return C===45?(t.consume(C),o=2,S):C===91?(t.consume(C),o=5,d=0,E):zt(C)?(t.consume(C),o=4,a.interrupt?l:T):i(C)}function S(C){return C===45?(t.consume(C),a.interrupt?l:T):i(C)}function E(C){const te="CDATA[";return C===te.charCodeAt(d++)?(t.consume(C),d===te.length?a.interrupt?l:P:E):i(C)}function A(C){return zt(C)?(t.consume(C),s=String.fromCharCode(C),j):i(C)}function j(C){if(C===null||C===47||C===62||$e(C)){const te=C===47,$=s.toLowerCase();return!te&&!c&&Oy.includes($)?(o=1,a.interrupt?l(C):P(C)):qT.includes(s.toLowerCase())?(o=6,te?(t.consume(C),N):a.interrupt?l(C):P(C)):(o=7,a.interrupt&&!a.parser.lazy[a.now().line]?i(C):c?R(C):L(C))}return C===45||Ct(C)?(t.consume(C),s+=String.fromCharCode(C),j):i(C)}function N(C){return C===62?(t.consume(C),a.interrupt?l:P):i(C)}function R(C){return De(C)?(t.consume(C),R):H(C)}function L(C){return C===47?(t.consume(C),H):C===58||C===95||zt(C)?(t.consume(C),W):De(C)?(t.consume(C),L):H(C)}function W(C){return C===45||C===46||C===58||C===95||Ct(C)?(t.consume(C),W):ee(C)}function ee(C){return C===61?(t.consume(C),D):De(C)?(t.consume(C),ee):L(C)}function D(C){return C===null||C===60||C===61||C===62||C===96?i(C):C===34||C===39?(t.consume(C),m=C,X):De(C)?(t.consume(C),D):V(C)}function X(C){return C===m?(t.consume(C),m=null,ae):C===null||xe(C)?i(C):(t.consume(C),X)}function V(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||$e(C)?ee(C):(t.consume(C),V)}function ae(C){return C===47||C===62||De(C)?L(C):i(C)}function H(C){return C===62?(t.consume(C),re):i(C)}function re(C){return C===null||xe(C)?P(C):De(C)?(t.consume(C),re):i(C)}function P(C){return C===45&&o===2?(t.consume(C),B):C===60&&o===1?(t.consume(C),Q):C===62&&o===4?(t.consume(C),_):C===63&&o===3?(t.consume(C),T):C===93&&o===5?(t.consume(C),we):xe(C)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(VT,M,be)(C)):C===null||xe(C)?(t.exit("htmlFlowData"),be(C)):(t.consume(C),P)}function be(C){return t.check(YT,ue,M)(C)}function ue(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),ne}function ne(C){return C===null||xe(C)?be(C):(t.enter("htmlFlowData"),P(C))}function B(C){return C===45?(t.consume(C),T):P(C)}function Q(C){return C===47?(t.consume(C),s="",ce):P(C)}function ce(C){if(C===62){const te=s.toLowerCase();return Oy.includes(te)?(t.consume(C),_):P(C)}return zt(C)&&s.length<8?(t.consume(C),s+=String.fromCharCode(C),ce):P(C)}function we(C){return C===93?(t.consume(C),T):P(C)}function T(C){return C===62?(t.consume(C),_):C===45&&o===2?(t.consume(C),T):P(C)}function _(C){return C===null||xe(C)?(t.exit("htmlFlowData"),M(C)):(t.consume(C),_)}function M(C){return t.exit("htmlFlow"),l(C)}}function XT(t,l,i){const a=this;return o;function o(s){return xe(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),c):i(s)}function c(s){return a.parser.lazy[a.now().line]?i(s):l(s)}}function QT(t,l,i){return a;function a(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Ma,l,i)}}const ZT={name:"htmlText",tokenize:KT};function KT(t,l,i){const a=this;let o,c,s;return d;function d(T){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(T),m}function m(T){return T===33?(t.consume(T),p):T===47?(t.consume(T),ee):T===63?(t.consume(T),L):zt(T)?(t.consume(T),V):i(T)}function p(T){return T===45?(t.consume(T),b):T===91?(t.consume(T),c=0,E):zt(T)?(t.consume(T),R):i(T)}function b(T){return T===45?(t.consume(T),S):i(T)}function g(T){return T===null?i(T):T===45?(t.consume(T),v):xe(T)?(s=g,Q(T)):(t.consume(T),g)}function v(T){return T===45?(t.consume(T),S):g(T)}function S(T){return T===62?B(T):T===45?v(T):g(T)}function E(T){const _="CDATA[";return T===_.charCodeAt(c++)?(t.consume(T),c===_.length?A:E):i(T)}function A(T){return T===null?i(T):T===93?(t.consume(T),j):xe(T)?(s=A,Q(T)):(t.consume(T),A)}function j(T){return T===93?(t.consume(T),N):A(T)}function N(T){return T===62?B(T):T===93?(t.consume(T),N):A(T)}function R(T){return T===null||T===62?B(T):xe(T)?(s=R,Q(T)):(t.consume(T),R)}function L(T){return T===null?i(T):T===63?(t.consume(T),W):xe(T)?(s=L,Q(T)):(t.consume(T),L)}function W(T){return T===62?B(T):L(T)}function ee(T){return zt(T)?(t.consume(T),D):i(T)}function D(T){return T===45||Ct(T)?(t.consume(T),D):X(T)}function X(T){return xe(T)?(s=X,Q(T)):De(T)?(t.consume(T),X):B(T)}function V(T){return T===45||Ct(T)?(t.consume(T),V):T===47||T===62||$e(T)?ae(T):i(T)}function ae(T){return T===47?(t.consume(T),B):T===58||T===95||zt(T)?(t.consume(T),H):xe(T)?(s=ae,Q(T)):De(T)?(t.consume(T),ae):B(T)}function H(T){return T===45||T===46||T===58||T===95||Ct(T)?(t.consume(T),H):re(T)}function re(T){return T===61?(t.consume(T),P):xe(T)?(s=re,Q(T)):De(T)?(t.consume(T),re):ae(T)}function P(T){return T===null||T===60||T===61||T===62||T===96?i(T):T===34||T===39?(t.consume(T),o=T,be):xe(T)?(s=P,Q(T)):De(T)?(t.consume(T),P):(t.consume(T),ue)}function be(T){return T===o?(t.consume(T),o=void 0,ne):T===null?i(T):xe(T)?(s=be,Q(T)):(t.consume(T),be)}function ue(T){return T===null||T===34||T===39||T===60||T===61||T===96?i(T):T===47||T===62||$e(T)?ae(T):(t.consume(T),ue)}function ne(T){return T===47||T===62||$e(T)?ae(T):i(T)}function B(T){return T===62?(t.consume(T),t.exit("htmlTextData"),t.exit("htmlText"),l):i(T)}function Q(T){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),ce}function ce(T){return De(T)?Ue(t,we,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):we(T)}function we(T){return t.enter("htmlTextData"),s(T)}}const Od={name:"labelEnd",resolveAll:WT,resolveTo:e3,tokenize:t3},PT={tokenize:n3},$T={tokenize:l3},JT={tokenize:r3};function WT(t){let l=-1;const i=[];for(;++l<t.length;){const a=t[l][1];if(i.push(t[l]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const o=a.type==="labelImage"?4:2;a.type="data",l+=o}}return t.length!==i.length&&en(t,0,t.length,i),t}function e3(t,l){let i=t.length,a=0,o,c,s,d;for(;i--;)if(o=t[i][1],c){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;t[i][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(s){if(t[i][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(c=i,o.type!=="labelLink")){a=2;break}}else o.type==="labelEnd"&&(s=i);const m={type:t[c][1].type==="labelLink"?"link":"image",start:{...t[c][1].start},end:{...t[t.length-1][1].end}},p={type:"label",start:{...t[c][1].start},end:{...t[s][1].end}},b={type:"labelText",start:{...t[c+a+2][1].end},end:{...t[s-2][1].start}};return d=[["enter",m,l],["enter",p,l]],d=hn(d,t.slice(c+1,c+a+3)),d=hn(d,[["enter",b,l]]),d=hn(d,No(l.parser.constructs.insideSpan.null,t.slice(c+a+4,s-3),l)),d=hn(d,[["exit",b,l],t[s-2],t[s-1],["exit",p,l]]),d=hn(d,t.slice(s+1)),d=hn(d,[["exit",m,l]]),en(t,c,t.length,d),t}function t3(t,l,i){const a=this;let o=a.events.length,c,s;for(;o--;)if((a.events[o][1].type==="labelImage"||a.events[o][1].type==="labelLink")&&!a.events[o][1]._balanced){c=a.events[o][1];break}return d;function d(v){return c?c._inactive?g(v):(s=a.parser.defined.includes(Sn(a.sliceSerialize({start:c.end,end:a.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(v),t.exit("labelMarker"),t.exit("labelEnd"),m):i(v)}function m(v){return v===40?t.attempt(PT,b,s?b:g)(v):v===91?t.attempt($T,b,s?p:g)(v):s?b(v):g(v)}function p(v){return t.attempt(JT,b,g)(v)}function b(v){return l(v)}function g(v){return c._balanced=!0,i(v)}}function n3(t,l,i){return a;function a(g){return t.enter("resource"),t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),o}function o(g){return $e(g)?ka(t,c)(g):c(g)}function c(g){return g===41?b(g):o0(t,s,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function s(g){return $e(g)?ka(t,m)(g):b(g)}function d(g){return i(g)}function m(g){return g===34||g===39||g===40?c0(t,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):b(g)}function p(g){return $e(g)?ka(t,b)(g):b(g)}function b(g){return g===41?(t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),t.exit("resource"),l):i(g)}}function l3(t,l,i){const a=this;return o;function o(d){return s0.call(a,t,c,s,"reference","referenceMarker","referenceString")(d)}function c(d){return a.parser.defined.includes(Sn(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?l(d):i(d)}function s(d){return i(d)}}function r3(t,l,i){return a;function a(c){return t.enter("reference"),t.enter("referenceMarker"),t.consume(c),t.exit("referenceMarker"),o}function o(c){return c===93?(t.enter("referenceMarker"),t.consume(c),t.exit("referenceMarker"),t.exit("reference"),l):i(c)}}const i3={name:"labelStartImage",resolveAll:Od.resolveAll,tokenize:a3};function a3(t,l,i){const a=this;return o;function o(d){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(d),t.exit("labelImageMarker"),c}function c(d){return d===91?(t.enter("labelMarker"),t.consume(d),t.exit("labelMarker"),t.exit("labelImage"),s):i(d)}function s(d){return d===94&&"_hiddenFootnoteSupport"in a.parser.constructs?i(d):l(d)}}const u3={name:"labelStartLink",resolveAll:Od.resolveAll,tokenize:o3};function o3(t,l,i){const a=this;return o;function o(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),c}function c(s){return s===94&&"_hiddenFootnoteSupport"in a.parser.constructs?i(s):l(s)}}const yf={name:"lineEnding",tokenize:s3};function s3(t,l){return i;function i(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Ue(t,l,"linePrefix")}}const bo={name:"thematicBreak",tokenize:c3};function c3(t,l,i){let a=0,o;return c;function c(p){return t.enter("thematicBreak"),s(p)}function s(p){return o=p,d(p)}function d(p){return p===o?(t.enter("thematicBreakSequence"),m(p)):a>=3&&(p===null||xe(p))?(t.exit("thematicBreak"),l(p)):i(p)}function m(p){return p===o?(t.consume(p),a++,m):(t.exit("thematicBreakSequence"),De(p)?Ue(t,d,"whitespace")(p):d(p))}}const Yt={continuation:{tokenize:m3},exit:g3,name:"list",tokenize:h3},f3={partial:!0,tokenize:y3},d3={partial:!0,tokenize:p3};function h3(t,l,i){const a=this,o=a.events[a.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return d;function d(S){const E=a.containerState.type||(S===42||S===43||S===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!a.containerState.marker||S===a.containerState.marker:Jf(S)){if(a.containerState.type||(a.containerState.type=E,t.enter(E,{_container:!0})),E==="listUnordered")return t.enter("listItemPrefix"),S===42||S===45?t.check(bo,i,p)(S):p(S);if(!a.interrupt||S===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),m(S)}return i(S)}function m(S){return Jf(S)&&++s<10?(t.consume(S),m):(!a.interrupt||s<2)&&(a.containerState.marker?S===a.containerState.marker:S===41||S===46)?(t.exit("listItemValue"),p(S)):i(S)}function p(S){return t.enter("listItemMarker"),t.consume(S),t.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||S,t.check(Ma,a.interrupt?i:b,t.attempt(f3,v,g))}function b(S){return a.containerState.initialBlankLine=!0,c++,v(S)}function g(S){return De(S)?(t.enter("listItemPrefixWhitespace"),t.consume(S),t.exit("listItemPrefixWhitespace"),v):i(S)}function v(S){return a.containerState.size=c+a.sliceSerialize(t.exit("listItemPrefix"),!0).length,l(S)}}function m3(t,l,i){const a=this;return a.containerState._closeFlow=void 0,t.check(Ma,o,c);function o(d){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,Ue(t,l,"listItemIndent",a.containerState.size+1)(d)}function c(d){return a.containerState.furtherBlankLines||!De(d)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,s(d)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,t.attempt(d3,l,s)(d))}function s(d){return a.containerState._closeFlow=!0,a.interrupt=void 0,Ue(t,t.attempt(Yt,l,i),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function p3(t,l,i){const a=this;return Ue(t,o,"listItemIndent",a.containerState.size+1);function o(c){const s=a.events[a.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===a.containerState.size?l(c):i(c)}}function g3(t){t.exit(this.containerState.type)}function y3(t,l,i){const a=this;return Ue(t,o,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const s=a.events[a.events.length-1];return!De(c)&&s&&s[1].type==="listItemPrefixWhitespace"?l(c):i(c)}}const Ry={name:"setextUnderline",resolveTo:b3,tokenize:x3};function b3(t,l){let i=t.length,a,o,c;for(;i--;)if(t[i][0]==="enter"){if(t[i][1].type==="content"){a=i;break}t[i][1].type==="paragraph"&&(o=i)}else t[i][1].type==="content"&&t.splice(i,1),!c&&t[i][1].type==="definition"&&(c=i);const s={type:"setextHeading",start:{...t[a][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",c?(t.splice(o,0,["enter",s,l]),t.splice(c+1,0,["exit",t[a][1],l]),t[a][1].end={...t[c][1].end}):t[a][1]=s,t.push(["exit",s,l]),t}function x3(t,l,i){const a=this;let o;return c;function c(p){let b=a.events.length,g;for(;b--;)if(a.events[b][1].type!=="lineEnding"&&a.events[b][1].type!=="linePrefix"&&a.events[b][1].type!=="content"){g=a.events[b][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||g)?(t.enter("setextHeadingLine"),o=p,s(p)):i(p)}function s(p){return t.enter("setextHeadingLineSequence"),d(p)}function d(p){return p===o?(t.consume(p),d):(t.exit("setextHeadingLineSequence"),De(p)?Ue(t,m,"lineSuffix")(p):m(p))}function m(p){return p===null||xe(p)?(t.exit("setextHeadingLine"),l(p)):i(p)}}const v3={tokenize:S3};function S3(t){const l=this,i=t.attempt(Ma,a,t.attempt(this.parser.constructs.flowInitial,o,Ue(t,t.attempt(this.parser.constructs.flow,o,t.attempt(TT,o)),"linePrefix")));return i;function a(c){if(c===null){t.consume(c);return}return t.enter("lineEndingBlank"),t.consume(c),t.exit("lineEndingBlank"),l.currentConstruct=void 0,i}function o(c){if(c===null){t.consume(c);return}return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),l.currentConstruct=void 0,i}}const k3={resolveAll:d0()},w3=f0("string"),E3=f0("text");function f0(t){return{resolveAll:d0(t==="text"?C3:void 0),tokenize:l};function l(i){const a=this,o=this.parser.constructs[t],c=i.attempt(o,s,d);return s;function s(b){return p(b)?c(b):d(b)}function d(b){if(b===null){i.consume(b);return}return i.enter("data"),i.consume(b),m}function m(b){return p(b)?(i.exit("data"),c(b)):(i.consume(b),m)}function p(b){if(b===null)return!0;const g=o[b];let v=-1;if(g)for(;++v<g.length;){const S=g[v];if(!S.previous||S.previous.call(a,a.previous))return!0}return!1}}}function d0(t){return l;function l(i,a){let o=-1,c;for(;++o<=i.length;)c===void 0?i[o]&&i[o][1].type==="data"&&(c=o,o++):(!i[o]||i[o][1].type!=="data")&&(o!==c+2&&(i[c][1].end=i[o-1][1].end,i.splice(c+2,o-c-2),o=c+2),c=void 0);return t?t(i,a):i}}function C3(t,l){let i=0;for(;++i<=t.length;)if((i===t.length||t[i][1].type==="lineEnding")&&t[i-1][1].type==="data"){const a=t[i-1][1],o=l.sliceStream(a);let c=o.length,s=-1,d=0,m;for(;c--;){const p=o[c];if(typeof p=="string"){for(s=p.length;p.charCodeAt(s-1)===32;)d++,s--;if(s)break;s=-1}else if(p===-2)m=!0,d++;else if(p!==-1){c++;break}}if(l._contentTypeTextTrailing&&i===t.length&&(d=0),d){const p={type:i===t.length||m||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?s:a.start._bufferIndex+s,_index:a.start._index+c,line:a.end.line,column:a.end.column-d,offset:a.end.offset-d},end:{...a.end}};a.end={...p.start},a.start.offset===a.end.offset?Object.assign(a,p):(t.splice(i,0,["enter",p,l],["exit",p,l]),i+=2)}i++}return t}const T3={42:Yt,43:Yt,45:Yt,48:Yt,49:Yt,50:Yt,51:Yt,52:Yt,53:Yt,54:Yt,55:Yt,56:Yt,57:Yt,62:r0},A3={91:MT},N3={[-2]:gf,[-1]:gf,32:gf},j3={35:UT,42:bo,45:[Ry,bo],60:IT,61:Ry,95:bo,96:Dy,126:Dy},z3={38:a0,92:i0},M3={[-5]:yf,[-4]:yf,[-3]:yf,33:i3,38:a0,42:Wf,60:[uT,ZT],91:u3,92:[RT,i0],93:Od,95:Wf,96:vT},_3={null:[Wf,k3]},D3={null:[42,95]},O3={null:[]},R3=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:D3,contentInitial:A3,disable:O3,document:T3,flow:j3,flowInitial:N3,insideSpan:_3,string:z3,text:M3},Symbol.toStringTag,{value:"Module"}));function L3(t,l,i){let a={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const o={},c=[];let s=[],d=[];const m={attempt:X(ee),check:X(D),consume:R,enter:L,exit:W,interrupt:X(D,{interrupt:!0})},p={code:null,containerState:{},defineSkip:A,events:[],now:E,parser:t,previous:null,sliceSerialize:v,sliceStream:S,write:g};let b=l.tokenize.call(p,m);return l.resolveAll&&c.push(l),p;function g(re){return s=hn(s,re),j(),s[s.length-1]!==null?[]:(V(l,0),p.events=No(c,p.events,p),p.events)}function v(re,P){return B3(S(re),P)}function S(re){return U3(s,re)}function E(){const{_bufferIndex:re,_index:P,line:be,column:ue,offset:ne}=a;return{_bufferIndex:re,_index:P,line:be,column:ue,offset:ne}}function A(re){o[re.line]=re.column,H()}function j(){let re;for(;a._index<s.length;){const P=s[a._index];if(typeof P=="string")for(re=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===re&&a._bufferIndex<P.length;)N(P.charCodeAt(a._bufferIndex));else N(P)}}function N(re){b=b(re)}function R(re){xe(re)?(a.line++,a.column=1,a.offset+=re===-3?2:1,H()):re!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===s[a._index].length&&(a._bufferIndex=-1,a._index++)),p.previous=re}function L(re,P){const be=P||{};return be.type=re,be.start=E(),p.events.push(["enter",be,p]),d.push(be),be}function W(re){const P=d.pop();return P.end=E(),p.events.push(["exit",P,p]),P}function ee(re,P){V(re,P.from)}function D(re,P){P.restore()}function X(re,P){return be;function be(ue,ne,B){let Q,ce,we,T;return Array.isArray(ue)?M(ue):"tokenize"in ue?M([ue]):_(ue);function _(le){return he;function he(Ae){const pe=Ae!==null&&le[Ae],at=Ae!==null&&le.null,_t=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(at)?at:at?[at]:[]];return M(_t)(Ae)}}function M(le){return Q=le,ce=0,le.length===0?B:C(le[ce])}function C(le){return he;function he(Ae){return T=ae(),we=le,le.partial||(p.currentConstruct=le),le.name&&p.parser.constructs.disable.null.includes(le.name)?$():le.tokenize.call(P?Object.assign(Object.create(p),P):p,m,te,$)(Ae)}}function te(le){return re(we,T),ne}function $(le){return T.restore(),++ce<Q.length?C(Q[ce]):B}}}function V(re,P){re.resolveAll&&!c.includes(re)&&c.push(re),re.resolve&&en(p.events,P,p.events.length-P,re.resolve(p.events.slice(P),p)),re.resolveTo&&(p.events=re.resolveTo(p.events,p))}function ae(){const re=E(),P=p.previous,be=p.currentConstruct,ue=p.events.length,ne=Array.from(d);return{from:ue,restore:B};function B(){a=re,p.previous=P,p.currentConstruct=be,p.events.length=ue,d=ne,H()}}function H(){a.line in o&&a.column<2&&(a.column=o[a.line],a.offset+=o[a.line]-1)}}function U3(t,l){const i=l.start._index,a=l.start._bufferIndex,o=l.end._index,c=l.end._bufferIndex;let s;if(i===o)s=[t[i].slice(a,c)];else{if(s=t.slice(i,o),a>-1){const d=s[0];typeof d=="string"?s[0]=d.slice(a):s.shift()}c>0&&s.push(t[o].slice(0,c))}return s}function B3(t,l){let i=-1;const a=[];let o;for(;++i<t.length;){const c=t[i];let s;if(typeof c=="string")s=c;else switch(c){case-5:{s="\r";break}case-4:{s=`
347
347
  `;break}case-3:{s=`\r
348
348
  `;break}case-2:{s=l?" ":" ";break}case-1:{if(!l&&o)continue;s=" ";break}default:s=String.fromCharCode(c)}o=c===-2,a.push(s)}return a.join("")}function H3(t){const a={constructs:n0([R3,...(t||{}).extensions||[]]),content:o(eT),defined:[],document:o(nT),flow:o(v3),lazy:{},string:o(w3),text:o(E3)};return a;function o(c){return s;function s(d){return L3(a,c,d)}}}function q3(t){for(;!u0(t););return t}const Ly=/[\0\t\n\r]/g;function I3(){let t=1,l="",i=!0,a;return o;function o(c,s,d){const m=[];let p,b,g,v,S;for(c=l+(typeof c=="string"?c.toString():new TextDecoder(s||void 0).decode(c)),g=0,l="",i&&(c.charCodeAt(0)===65279&&g++,i=void 0);g<c.length;){if(Ly.lastIndex=g,p=Ly.exec(c),v=p&&p.index!==void 0?p.index:c.length,S=c.charCodeAt(v),!p){l=c.slice(g);break}if(S===10&&g===v&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<v&&(m.push(c.slice(g,v)),t+=v-g),S){case 0:{m.push(65533),t++;break}case 9:{for(b=Math.ceil(t/4)*4,m.push(-2);t++<b;)m.push(-1);break}case 10:{m.push(-4),t=1;break}default:a=!0,t=1}g=v+1}return d&&(a&&m.push(-5),l&&m.push(l),m.push(null)),m}}const V3=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Y3(t){return t.replace(V3,G3)}function G3(t,l,i){if(l)return l;if(i.charCodeAt(0)===35){const o=i.charCodeAt(1),c=o===120||o===88;return l0(i.slice(c?2:1),c?16:10)}return Dd(i)||t}const h0={}.hasOwnProperty;function F3(t,l,i){return l&&typeof l=="object"&&(i=l,l=void 0),X3(i)(q3(H3(i).document().write(I3()(t,l,!0))))}function X3(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(dr),autolinkProtocol:ae,autolinkEmail:ae,atxHeading:c(cr),blockQuote:c(at),characterEscape:ae,characterReference:ae,codeFenced:c(_t),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:c(_t,s),codeText:c(wn,s),codeTextData:ae,data:ae,codeFlowValue:ae,definition:c(rl),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:c(Dt),hardBreakEscape:c(fr),hardBreakTrailing:c(fr),htmlFlow:c(Da,s),htmlFlowData:ae,htmlText:c(Da,s),htmlTextData:ae,image:c(Oa),label:s,link:c(dr),listItem:c(yi),listItemValue:v,listOrdered:c(hr,g),listUnordered:c(hr),paragraph:c(Do),reference:C,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:c(cr),strong:c(Oo),thematicBreak:c(Ro)},exit:{atxHeading:m(),atxHeadingSequence:ee,autolink:m(),autolinkEmail:pe,autolinkProtocol:Ae,blockQuote:m(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:$,characterReferenceMarkerNumeric:$,characterReferenceValue:le,characterReference:he,codeFenced:m(j),codeFencedFence:A,codeFencedFenceInfo:S,codeFencedFenceMeta:E,codeFlowValue:H,codeIndented:m(N),codeText:m(ne),codeTextData:H,data:H,definition:m(),definitionDestinationString:W,definitionLabelString:R,definitionTitleString:L,emphasis:m(),hardBreakEscape:m(P),hardBreakTrailing:m(P),htmlFlow:m(be),htmlFlowData:H,htmlText:m(ue),htmlTextData:H,image:m(Q),label:we,labelText:ce,lineEnding:re,link:m(B),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:te,resourceDestinationString:T,resourceTitleString:_,resource:M,setextHeading:m(V),setextHeadingLineSequence:X,setextHeadingText:D,strong:m(),thematicBreak:m()}};m0(l,(t||{}).mdastExtensions||[]);const i={};return a;function a(Z){let oe={type:"root",children:[]};const Se={stack:[oe],tokenStack:[],config:l,enter:d,exit:p,buffer:s,resume:b,data:i},ze=[];let Ie=-1;for(;++Ie<Z.length;)if(Z[Ie][1].type==="listOrdered"||Z[Ie][1].type==="listUnordered")if(Z[Ie][0]==="enter")ze.push(Ie);else{const Ft=ze.pop();Ie=o(Z,Ft,Ie)}for(Ie=-1;++Ie<Z.length;){const Ft=l[Z[Ie][0]];h0.call(Ft,Z[Ie][1].type)&&Ft[Z[Ie][1].type].call(Object.assign({sliceSerialize:Z[Ie][2].sliceSerialize},Se),Z[Ie][1])}if(Se.tokenStack.length>0){const Ft=Se.tokenStack[Se.tokenStack.length-1];(Ft[1]||Uy).call(Se,void 0,Ft[0])}for(oe.position={start:Ml(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:Ml(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Ie=-1;++Ie<l.transforms.length;)oe=l.transforms[Ie](oe)||oe;return oe}function o(Z,oe,Se){let ze=oe-1,Ie=-1,Ft=!1,On,Nt,dt,Ot;for(;++ze<=Se;){const Ze=Z[ze];switch(Ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ze[0]==="enter"?Ie++:Ie--,Ot=void 0;break}case"lineEndingBlank":{Ze[0]==="enter"&&(On&&!Ot&&!Ie&&!dt&&(dt=ze),Ot=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ot=void 0}if(!Ie&&Ze[0]==="enter"&&Ze[1].type==="listItemPrefix"||Ie===-1&&Ze[0]==="exit"&&(Ze[1].type==="listUnordered"||Ze[1].type==="listOrdered")){if(On){let il=ze;for(Nt=void 0;il--;){const gn=Z[il];if(gn[1].type==="lineEnding"||gn[1].type==="lineEndingBlank"){if(gn[0]==="exit")continue;Nt&&(Z[Nt][1].type="lineEndingBlank",Ft=!0),gn[1].type="lineEnding",Nt=il}else if(!(gn[1].type==="linePrefix"||gn[1].type==="blockQuotePrefix"||gn[1].type==="blockQuotePrefixWhitespace"||gn[1].type==="blockQuoteMarker"||gn[1].type==="listItemIndent"))break}dt&&(!Nt||dt<Nt)&&(On._spread=!0),On.end=Object.assign({},Nt?Z[Nt][1].start:Ze[1].end),Z.splice(Nt||ze,0,["exit",On,Ze[2]]),ze++,Se++}if(Ze[1].type==="listItemPrefix"){const il={type:"listItem",_spread:!1,start:Object.assign({},Ze[1].start),end:void 0};On=il,Z.splice(ze,0,["enter",il,Ze[2]]),ze++,Se++,dt=void 0,Ot=!0}}}return Z[oe][1]._spread=Ft,Se}function c(Z,oe){return Se;function Se(ze){d.call(this,Z(ze),ze),oe&&oe.call(this,ze)}}function s(){this.stack.push({type:"fragment",children:[]})}function d(Z,oe,Se){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([oe,Se||void 0]),Z.position={start:Ml(oe.start),end:void 0}}function m(Z){return oe;function oe(Se){Z&&Z.call(this,Se),p.call(this,Se)}}function p(Z,oe){const Se=this.stack.pop(),ze=this.tokenStack.pop();if(ze)ze[0].type!==Z.type&&(oe?oe.call(this,Z,ze[0]):(ze[1]||Uy).call(this,Z,ze[0]));else throw new Error("Cannot close `"+Z.type+"` ("+Sa({start:Z.start,end:Z.end})+"): it’s not open");Se.position.end=Ml(Z.end)}function b(){return _d(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function v(Z){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function S(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Z}function E(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Z}function A(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function N(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/(\r?\n|\r)$/g,"")}function R(Z){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.label=oe,Se.identifier=Sn(this.sliceSerialize(Z)).toLowerCase()}function L(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function W(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function ee(Z){const oe=this.stack[this.stack.length-1];if(!oe.depth){const Se=this.sliceSerialize(Z).length;oe.depth=Se}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function X(Z){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function V(){this.data.setextHeadingSlurpLineEnding=void 0}function ae(Z){const Se=this.stack[this.stack.length-1].children;let ze=Se[Se.length-1];(!ze||ze.type!=="text")&&(ze=At(),ze.position={start:Ml(Z.start),end:void 0},Se.push(ze)),this.stack.push(ze)}function H(Z){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Z),oe.position.end=Ml(Z.end)}function re(Z){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=oe.children[oe.children.length-1];Se.position.end=Ml(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(oe.type)&&(ae.call(this,Z),H.call(this,Z))}function P(){this.data.atHardBreak=!0}function be(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function ue(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function ne(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function B(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function Q(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function ce(Z){const oe=this.sliceSerialize(Z),Se=this.stack[this.stack.length-2];Se.label=Y3(oe),Se.identifier=Sn(oe).toLowerCase()}function we(){const Z=this.stack[this.stack.length-1],oe=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const ze=Z.children;Se.children=ze}else Se.alt=oe}function T(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function _(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function M(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function te(Z){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.label=oe,Se.identifier=Sn(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function $(Z){this.data.characterReferenceType=Z.type}function le(Z){const oe=this.sliceSerialize(Z),Se=this.data.characterReferenceType;let ze;Se?(ze=l0(oe,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ze=Dd(oe);const Ie=this.stack[this.stack.length-1];Ie.value+=ze}function he(Z){const oe=this.stack.pop();oe.position.end=Ml(Z.end)}function Ae(Z){H.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Z)}function pe(Z){H.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Z)}function at(){return{type:"blockquote",children:[]}}function _t(){return{type:"code",lang:null,meta:null,value:""}}function wn(){return{type:"inlineCode",value:""}}function rl(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Dt(){return{type:"emphasis",children:[]}}function cr(){return{type:"heading",depth:0,children:[]}}function fr(){return{type:"break"}}function Da(){return{type:"html",value:""}}function Oa(){return{type:"image",title:null,url:"",alt:null}}function dr(){return{type:"link",title:null,url:"",children:[]}}function hr(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function yi(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Do(){return{type:"paragraph",children:[]}}function Oo(){return{type:"strong",children:[]}}function At(){return{type:"text",value:""}}function Ro(){return{type:"thematicBreak"}}}function Ml(t){return{line:t.line,column:t.column,offset:t.offset}}function m0(t,l){let i=-1;for(;++i<l.length;){const a=l[i];Array.isArray(a)?m0(t,a):Q3(t,a)}}function Q3(t,l){let i;for(i in l)if(h0.call(l,i))switch(i){case"canContainEols":{const a=l[i];a&&t[i].push(...a);break}case"transforms":{const a=l[i];a&&t[i].push(...a);break}case"enter":case"exit":{const a=l[i];a&&Object.assign(t[i],a);break}}}function Uy(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+Sa({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+Sa({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+Sa({start:l.start,end:l.end})+") is still open")}function Z3(t){const l=this;l.parser=i;function i(a){return F3(a,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function K3(t,l){const i={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(l),!0)};return t.patch(l,i),t.applyData(l,i)}function P3(t,l){const i={type:"element",tagName:"br",properties:{},children:[]};return t.patch(l,i),[t.applyData(l,i),{type:"text",value:`
@@ -370,7 +370,7 @@ Error generating stack: `+u.message+`
370
370
  `))+1))}const s="#".repeat(o),d=i.enter("headingAtx"),m=i.enter("phrasing");c.move(s+" ");let p=i.containerPhrasing(t,{before:"# ",after:`
371
371
  `,...c.current()});return/^[\t ]/.test(p)&&(p=Ta(p.charCodeAt(0))+p.slice(1)),p=p?s+" "+p:s,i.options.closeAtx&&(p+=" "+s),m(),d(),p}j0.peek=yj;function j0(t){return t.value||""}function yj(){return"<"}z0.peek=bj;function z0(t,l,i,a){const o=Id(i),c=o==='"'?"Quote":"Apostrophe",s=i.enter("image");let d=i.enter("label");const m=i.createTracker(a);let p=m.move("![");return p+=m.move(i.safe(t.alt,{before:p,after:"]",...m.current()})),p+=m.move("]("),d(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(d=i.enter("destinationLiteral"),p+=m.move("<"),p+=m.move(i.safe(t.url,{before:p,after:">",...m.current()})),p+=m.move(">")):(d=i.enter("destinationRaw"),p+=m.move(i.safe(t.url,{before:p,after:t.title?" ":")",...m.current()}))),d(),t.title&&(d=i.enter(`title${c}`),p+=m.move(" "+o),p+=m.move(i.safe(t.title,{before:p,after:o,...m.current()})),p+=m.move(o),d()),p+=m.move(")"),s(),p}function bj(){return"!"}M0.peek=xj;function M0(t,l,i,a){const o=t.referenceType,c=i.enter("imageReference");let s=i.enter("label");const d=i.createTracker(a);let m=d.move("![");const p=i.safe(t.alt,{before:m,after:"]",...d.current()});m+=d.move(p+"]["),s();const b=i.stack;i.stack=[],s=i.enter("reference");const g=i.safe(i.associationId(t),{before:m,after:"]",...d.current()});return s(),i.stack=b,c(),o==="full"||!p||p!==g?m+=d.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function xj(){return"!"}_0.peek=vj;function _0(t,l,i){let a=t.value||"",o="`",c=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(a);)o+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++c<i.unsafe.length;){const s=i.unsafe[c],d=i.compilePattern(s);let m;if(s.atBreak)for(;m=d.exec(a);){let p=m.index;a.charCodeAt(p)===10&&a.charCodeAt(p-1)===13&&p--,a=a.slice(0,p)+" "+a.slice(m.index+1)}}return o+a+o}function vj(){return"`"}function D0(t,l){const i=_d(t);return!!(!l.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(i===t.url||"mailto:"+i===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}O0.peek=Sj;function O0(t,l,i,a){const o=Id(i),c=o==='"'?"Quote":"Apostrophe",s=i.createTracker(a);let d,m;if(D0(t,i)){const b=i.stack;i.stack=[],d=i.enter("autolink");let g=s.move("<");return g+=s.move(i.containerPhrasing(t,{before:g,after:">",...s.current()})),g+=s.move(">"),d(),i.stack=b,g}d=i.enter("link"),m=i.enter("label");let p=s.move("[");return p+=s.move(i.containerPhrasing(t,{before:p,after:"](",...s.current()})),p+=s.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=i.enter("destinationLiteral"),p+=s.move("<"),p+=s.move(i.safe(t.url,{before:p,after:">",...s.current()})),p+=s.move(">")):(m=i.enter("destinationRaw"),p+=s.move(i.safe(t.url,{before:p,after:t.title?" ":")",...s.current()}))),m(),t.title&&(m=i.enter(`title${c}`),p+=s.move(" "+o),p+=s.move(i.safe(t.title,{before:p,after:o,...s.current()})),p+=s.move(o),m()),p+=s.move(")"),d(),p}function Sj(t,l,i){return D0(t,i)?"<":"["}R0.peek=kj;function R0(t,l,i,a){const o=t.referenceType,c=i.enter("linkReference");let s=i.enter("label");const d=i.createTracker(a);let m=d.move("[");const p=i.containerPhrasing(t,{before:m,after:"]",...d.current()});m+=d.move(p+"]["),s();const b=i.stack;i.stack=[],s=i.enter("reference");const g=i.safe(i.associationId(t),{before:m,after:"]",...d.current()});return s(),i.stack=b,c(),o==="full"||!p||p!==g?m+=d.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function kj(){return"["}function Vd(t){const l=t.options.bullet||"*";if(l!=="*"&&l!=="+"&&l!=="-")throw new Error("Cannot serialize items with `"+l+"` for `options.bullet`, expected `*`, `+`, or `-`");return l}function wj(t){const l=Vd(t),i=t.options.bulletOther;if(!i)return l==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===l)throw new Error("Expected `bullet` (`"+l+"`) and `bulletOther` (`"+i+"`) to be different");return i}function Ej(t){const l=t.options.bulletOrdered||".";if(l!=="."&&l!==")")throw new Error("Cannot serialize items with `"+l+"` for `options.bulletOrdered`, expected `.` or `)`");return l}function L0(t){const l=t.options.rule||"*";if(l!=="*"&&l!=="-"&&l!=="_")throw new Error("Cannot serialize rules with `"+l+"` for `options.rule`, expected `*`, `-`, or `_`");return l}function Cj(t,l,i,a){const o=i.enter("list"),c=i.bulletCurrent;let s=t.ordered?Ej(i):Vd(i);const d=t.ordered?s==="."?")":".":wj(i);let m=l&&i.bulletLastUsed?s===i.bulletLastUsed:!1;if(!t.ordered){const b=t.children?t.children[0]:void 0;if((s==="*"||s==="-")&&b&&(!b.children||!b.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(m=!0),L0(i)===s&&b){let g=-1;for(;++g<t.children.length;){const v=t.children[g];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(s=d),i.bulletCurrent=s;const p=i.containerFlow(t,a);return i.bulletLastUsed=s,i.bulletCurrent=c,o(),p}function Tj(t){const l=t.options.listItemIndent||"one";if(l!=="tab"&&l!=="one"&&l!=="mixed")throw new Error("Cannot serialize items with `"+l+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return l}function Aj(t,l,i,a){const o=Tj(i);let c=i.bulletCurrent||Vd(i);l&&l.type==="list"&&l.ordered&&(c=(typeof l.start=="number"&&l.start>-1?l.start:1)+(i.options.incrementListMarker===!1?0:l.children.indexOf(t))+c);let s=c.length+1;(o==="tab"||o==="mixed"&&(l&&l.type==="list"&&l.spread||t.spread))&&(s=Math.ceil(s/4)*4);const d=i.createTracker(a);d.move(c+" ".repeat(s-c.length)),d.shift(s);const m=i.enter("listItem"),p=i.indentLines(i.containerFlow(t,d.current()),b);return m(),p;function b(g,v,S){return v?(S?"":" ".repeat(s))+g:(S?c:c+" ".repeat(s-c.length))+g}}function Nj(t,l,i,a){const o=i.enter("paragraph"),c=i.enter("phrasing"),s=i.containerPhrasing(t,a);return c(),o(),s}const jj=zo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function zj(t,l,i,a){return(t.children.some(function(s){return jj(s)})?i.containerPhrasing:i.containerFlow).call(i,t,a)}function Mj(t){const l=t.options.strong||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize strong with `"+l+"` for `options.strong`, expected `*`, or `_`");return l}U0.peek=_j;function U0(t,l,i,a){const o=Mj(i),c=i.enter("strong"),s=i.createTracker(a),d=s.move(o+o);let m=s.move(i.containerPhrasing(t,{after:o,before:d,...s.current()}));const p=m.charCodeAt(0),b=wo(a.before.charCodeAt(a.before.length-1),p,o);b.inside&&(m=Ta(p)+m.slice(1));const g=m.charCodeAt(m.length-1),v=wo(a.after.charCodeAt(0),g,o);v.inside&&(m=m.slice(0,-1)+Ta(g));const S=s.move(o+o);return c(),i.attentionEncodeSurroundingInfo={after:v.outside,before:b.outside},d+m+S}function _j(t,l,i){return i.options.strong||"*"}function Dj(t,l,i,a){return i.safe(t.value,a)}function Oj(t){const l=t.options.ruleRepetition||3;if(l<3)throw new Error("Cannot serialize rules with repetition `"+l+"` for `options.ruleRepetition`, expected `3` or more");return l}function Rj(t,l,i){const a=(L0(i)+(i.options.ruleSpaces?" ":"")).repeat(Oj(i));return i.options.ruleSpaces?a.slice(0,-1):a}const B0={blockquote:rj,break:nb,code:cj,definition:dj,emphasis:N0,hardBreak:nb,heading:gj,html:j0,image:z0,imageReference:M0,inlineCode:_0,link:O0,linkReference:R0,list:Cj,listItem:Aj,paragraph:Nj,root:zj,strong:U0,text:Dj,thematicBreak:Rj};function Lj(){return{enter:{table:Uj,tableData:lb,tableHeader:lb,tableRow:Hj},exit:{codeText:qj,table:Bj,tableData:jf,tableHeader:jf,tableRow:jf}}}function Uj(t){const l=t._align;this.enter({type:"table",align:l.map(function(i){return i==="none"?null:i}),children:[]},t),this.data.inTable=!0}function Bj(t){this.exit(t),this.data.inTable=void 0}function Hj(t){this.enter({type:"tableRow",children:[]},t)}function jf(t){this.exit(t)}function lb(t){this.enter({type:"tableCell",children:[]},t)}function qj(t){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,Ij));const i=this.stack[this.stack.length-1];i.type,i.value=l,this.exit(t)}function Ij(t,l){return l==="|"?l:t}function Vj(t){const l=t||{},i=l.tableCellPadding,a=l.tablePipeAlign,o=l.stringLength,c=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
372
372
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:s,tableCell:m,tableRow:d}};function s(S,E,A,j){return p(b(S,A,j),S.align)}function d(S,E,A,j){const N=g(S,A,j),R=p([N]);return R.slice(0,R.indexOf(`
373
- `))}function m(S,E,A,j){const N=A.enter("tableCell"),R=A.enter("phrasing"),L=A.containerPhrasing(S,{...j,before:c,after:c});return R(),N(),L}function p(S,E){return nj(S,{align:E,alignDelimiters:a,padding:i,stringLength:o})}function b(S,E,A){const j=S.children;let N=-1;const R=[],L=E.enter("table");for(;++N<j.length;)R[N]=g(j[N],E,A);return L(),R}function g(S,E,A){const j=S.children;let N=-1;const R=[],L=E.enter("tableRow");for(;++N<j.length;)R[N]=m(j[N],S,E,A);return L(),R}function v(S,E,A){let j=B0.inlineCode(S,E,A);return A.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function Yj(){return{exit:{taskListCheckValueChecked:rb,taskListCheckValueUnchecked:rb,paragraph:Fj}}}function Gj(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Xj}}}function rb(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function Fj(t){const l=this.stack[this.stack.length-2];if(l&&l.type==="listItem"&&typeof l.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const a=i.children[0];if(a&&a.type==="text"){const o=l.children;let c=-1,s;for(;++c<o.length;){const d=o[c];if(d.type==="paragraph"){s=d;break}}s===i&&(a.value=a.value.slice(1),a.value.length===0?i.children.shift():i.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,i.position.start=Object.assign({},a.position.start)))}}this.exit(t)}function Xj(t,l,i,a){const o=t.children[0],c=typeof t.checked=="boolean"&&o&&o.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",d=i.createTracker(a);c&&d.move(s);let m=B0.listItem(t,l,i,{...a,...d.current()});return c&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),m;function p(b){return b+s}}function Qj(){return[CN(),XN(),PN(),Lj(),Yj()]}function Zj(t){return{extensions:[TN(),QN(t),$N(),Vj(t),Gj()]}}const Kj={tokenize:t4,partial:!0},H0={tokenize:n4,partial:!0},q0={tokenize:l4,partial:!0},I0={tokenize:r4,partial:!0},Pj={tokenize:i4,partial:!0},V0={name:"wwwAutolink",tokenize:Wj,previous:G0},Y0={name:"protocolAutolink",tokenize:e4,previous:F0},ll={name:"emailAutolink",tokenize:Jj,previous:X0},Dn={};function $j(){return{text:Dn}}let er=48;for(;er<123;)Dn[er]=ll,er++,er===58?er=65:er===91&&(er=97);Dn[43]=ll;Dn[45]=ll;Dn[46]=ll;Dn[95]=ll;Dn[72]=[ll,Y0];Dn[104]=[ll,Y0];Dn[87]=[ll,V0];Dn[119]=[ll,V0];function Jj(t,l,i){const a=this;let o,c;return s;function s(g){return!rd(g)||!X0.call(a,a.previous)||Yd(a.events)?i(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),d(g))}function d(g){return rd(g)?(t.consume(g),d):g===64?(t.consume(g),m):i(g)}function m(g){return g===46?t.check(Pj,b,p)(g):g===45||g===95||Ct(g)?(c=!0,t.consume(g),m):b(g)}function p(g){return t.consume(g),o=!0,m}function b(g){return c&&o&&zt(a.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(g)):i(g)}}function Wj(t,l,i){const a=this;return o;function o(s){return s!==87&&s!==119||!G0.call(a,a.previous)||Yd(a.events)?i(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Kj,t.attempt(H0,t.attempt(q0,c),i),i)(s))}function c(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(s)}}function e4(t,l,i){const a=this;let o="",c=!1;return s;function s(g){return(g===72||g===104)&&F0.call(a,a.previous)&&!Yd(a.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),t.consume(g),d):i(g)}function d(g){if(zt(g)&&o.length<5)return o+=String.fromCodePoint(g),t.consume(g),d;if(g===58){const v=o.toLowerCase();if(v==="http"||v==="https")return t.consume(g),m}return i(g)}function m(g){return g===47?(t.consume(g),c?p:(c=!0,m)):i(g)}function p(g){return g===null||vo(g)||$e(g)||ar(g)||Ao(g)?i(g):t.attempt(H0,t.attempt(q0,b),i)(g)}function b(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(g)}}function t4(t,l,i){let a=0;return o;function o(s){return(s===87||s===119)&&a<3?(a++,t.consume(s),o):s===46&&a===3?(t.consume(s),c):i(s)}function c(s){return s===null?i(s):l(s)}}function n4(t,l,i){let a,o,c;return s;function s(p){return p===46||p===95?t.check(I0,m,d)(p):p===null||$e(p)||ar(p)||p!==45&&Ao(p)?m(p):(c=!0,t.consume(p),s)}function d(p){return p===95?a=!0:(o=a,a=void 0),t.consume(p),s}function m(p){return o||a||!c?i(p):l(p)}}function l4(t,l){let i=0,a=0;return o;function o(s){return s===40?(i++,t.consume(s),o):s===41&&a<i?c(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?t.check(I0,l,c)(s):s===null||$e(s)||ar(s)?l(s):(t.consume(s),o)}function c(s){return s===41&&a++,t.consume(s),o}}function r4(t,l,i){return a;function a(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(t.consume(d),a):d===38?(t.consume(d),c):d===93?(t.consume(d),o):d===60||d===null||$e(d)||ar(d)?l(d):i(d)}function o(d){return d===null||d===40||d===91||$e(d)||ar(d)?l(d):a(d)}function c(d){return zt(d)?s(d):i(d)}function s(d){return d===59?(t.consume(d),a):zt(d)?(t.consume(d),s):i(d)}}function i4(t,l,i){return a;function a(c){return t.consume(c),o}function o(c){return Ct(c)?i(c):l(c)}}function G0(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||$e(t)}function F0(t){return!zt(t)}function X0(t){return!(t===47||rd(t))}function rd(t){return t===43||t===45||t===46||t===95||Ct(t)}function Yd(t){let l=t.length,i=!1;for(;l--;){const a=t[l][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){i=!0;break}if(a._gfmAutolinkLiteralWalkedInto){i=!1;break}}return t.length>0&&!i&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const a4={tokenize:m4,partial:!0};function u4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:f4,continuation:{tokenize:d4},exit:h4}},text:{91:{name:"gfmFootnoteCall",tokenize:c4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:o4,resolveTo:s4}}}}function o4(t,l,i){const a=this;let o=a.events.length;const c=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let s;for(;o--;){const m=a.events[o][1];if(m.type==="labelImage"){s=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return d;function d(m){if(!s||!s._balanced)return i(m);const p=Sn(a.sliceSerialize({start:s.end,end:a.now()}));return p.codePointAt(0)!==94||!c.includes(p.slice(1))?i(m):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),l(m))}}function s4(t,l){let i=t.length;for(;i--;)if(t[i][1].type==="labelImage"&&t[i][0]==="enter"){t[i][1];break}t[i+1][1].type="data",t[i+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},t[i+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[i+3][1].end),end:Object.assign({},t[i+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[t[i+1],t[i+2],["enter",a,l],t[i+3],t[i+4],["enter",o,l],["exit",o,l],["enter",c,l],["enter",s,l],["exit",s,l],["exit",c,l],t[t.length-2],t[t.length-1],["exit",a,l]];return t.splice(i,t.length-i+1,...d),t}function c4(t,l,i){const a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c=0,s;return d;function d(g){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?i(g):(t.enter("gfmFootnoteCallMarker"),t.consume(g),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",p)}function p(g){if(c>999||g===93&&!s||g===null||g===91||$e(g))return i(g);if(g===93){t.exit("chunkString");const v=t.exit("gfmFootnoteCallString");return o.includes(Sn(a.sliceSerialize(v)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):i(g)}return $e(g)||(s=!0),c++,t.consume(g),g===92?b:p}function b(g){return g===91||g===92||g===93?(t.consume(g),c++,p):p(g)}}function f4(t,l,i){const a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c,s=0,d;return m;function m(E){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",b):i(E)}function b(E){if(s>999||E===93&&!d||E===null||E===91||$e(E))return i(E);if(E===93){t.exit("chunkString");const A=t.exit("gfmFootnoteDefinitionLabelString");return c=Sn(a.sliceSerialize(A)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),v}return $e(E)||(d=!0),s++,t.consume(E),E===92?g:b}function g(E){return E===91||E===92||E===93?(t.consume(E),s++,b):b(E)}function v(E){return E===58?(t.enter("definitionMarker"),t.consume(E),t.exit("definitionMarker"),o.includes(c)||o.push(c),Ue(t,S,"gfmFootnoteDefinitionWhitespace")):i(E)}function S(E){return l(E)}}function d4(t,l,i){return t.check(Ma,l,t.attempt(a4,l,i))}function h4(t){t.exit("gfmFootnoteDefinition")}function m4(t,l,i){const a=this;return Ue(t,o,"gfmFootnoteDefinitionIndent",5);function o(c){const s=a.events[a.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?l(c):i(c)}}function p4(t){let i=(t||{}).singleTilde;const a={name:"strikethrough",tokenize:c,resolveAll:o};return i==null&&(i=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function o(s,d){let m=-1;for(;++m<s.length;)if(s[m][0]==="enter"&&s[m][1].type==="strikethroughSequenceTemporary"&&s[m][1]._close){let p=m;for(;p--;)if(s[p][0]==="exit"&&s[p][1].type==="strikethroughSequenceTemporary"&&s[p][1]._open&&s[m][1].end.offset-s[m][1].start.offset===s[p][1].end.offset-s[p][1].start.offset){s[m][1].type="strikethroughSequence",s[p][1].type="strikethroughSequence";const b={type:"strikethrough",start:Object.assign({},s[p][1].start),end:Object.assign({},s[m][1].end)},g={type:"strikethroughText",start:Object.assign({},s[p][1].end),end:Object.assign({},s[m][1].start)},v=[["enter",b,d],["enter",s[p][1],d],["exit",s[p][1],d],["enter",g,d]],S=d.parser.constructs.insideSpan.null;S&&en(v,v.length,0,No(S,s.slice(p+1,m),d)),en(v,v.length,0,[["exit",g,d],["enter",s[m][1],d],["exit",s[m][1],d],["exit",b,d]]),en(s,p-1,m-p+3,v),m=p+v.length-2;break}}for(m=-1;++m<s.length;)s[m][1].type==="strikethroughSequenceTemporary"&&(s[m][1].type="data");return s}function c(s,d,m){const p=this.previous,b=this.events;let g=0;return v;function v(E){return p===126&&b[b.length-1][1].type!=="characterEscape"?m(E):(s.enter("strikethroughSequenceTemporary"),S(E))}function S(E){const A=di(p);if(E===126)return g>1?m(E):(s.consume(E),g++,S);if(g<2&&!i)return m(E);const j=s.exit("strikethroughSequenceTemporary"),N=di(E);return j._open=!N||N===2&&!!A,j._close=!A||A===2&&!!N,d(E)}}}class g4{constructor(){this.map=[]}add(l,i,a){y4(this,l,i,a)}consume(l){if(this.map.sort(function(c,s){return c[0]-s[0]}),this.map.length===0)return;let i=this.map.length;const a=[];for(;i>0;)i-=1,a.push(l.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),l.length=this.map[i][0];a.push(l.slice()),l.length=0;let o=a.pop();for(;o;){for(const c of o)l.push(c);o=a.pop()}this.map.length=0}}function y4(t,l,i,a){let o=0;if(!(i===0&&a.length===0)){for(;o<t.map.length;){if(t.map[o][0]===l){t.map[o][1]+=i,t.map[o][2].push(...a);return}o+=1}t.map.push([l,i,a])}}function b4(t,l){let i=!1;const a=[];for(;l<t.length;){const o=t[l];if(i){if(o[0]==="enter")o[1].type==="tableContent"&&a.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const c=a.length-1;a[c]=a[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(i=!0);l+=1}return a}function x4(){return{flow:{null:{name:"table",tokenize:v4,resolveAll:S4}}}}function v4(t,l,i){const a=this;let o=0,c=0,s;return d;function d(H){let re=a.events.length-1;for(;re>-1;){const ue=a.events[re][1].type;if(ue==="lineEnding"||ue==="linePrefix")re--;else break}const P=re>-1?a.events[re][1].type:null,be=P==="tableHead"||P==="tableRow"?D:m;return be===D&&a.parser.lazy[a.now().line]?i(H):be(H)}function m(H){return t.enter("tableHead"),t.enter("tableRow"),p(H)}function p(H){return H===124||(s=!0,c+=1),b(H)}function b(H){return H===null?i(H):xe(H)?c>1?(c=0,a.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),S):i(H):De(H)?Ue(t,b,"whitespace")(H):(c+=1,s&&(s=!1,o+=1),H===124?(t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),s=!0,b):(t.enter("data"),g(H)))}function g(H){return H===null||H===124||$e(H)?(t.exit("data"),b(H)):(t.consume(H),H===92?v:g)}function v(H){return H===92||H===124?(t.consume(H),g):g(H)}function S(H){return a.interrupt=!1,a.parser.lazy[a.now().line]?i(H):(t.enter("tableDelimiterRow"),s=!1,De(H)?Ue(t,E,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):E(H))}function E(H){return H===45||H===58?j(H):H===124?(s=!0,t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),A):ee(H)}function A(H){return De(H)?Ue(t,j,"whitespace")(H):j(H)}function j(H){return H===58?(c+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(H),t.exit("tableDelimiterMarker"),N):H===45?(c+=1,N(H)):H===null||xe(H)?W(H):ee(H)}function N(H){return H===45?(t.enter("tableDelimiterFiller"),R(H)):ee(H)}function R(H){return H===45?(t.consume(H),R):H===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(H),t.exit("tableDelimiterMarker"),L):(t.exit("tableDelimiterFiller"),L(H))}function L(H){return De(H)?Ue(t,W,"whitespace")(H):W(H)}function W(H){return H===124?E(H):H===null||xe(H)?!s||o!==c?ee(H):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(H)):ee(H)}function ee(H){return i(H)}function D(H){return t.enter("tableRow"),X(H)}function X(H){return H===124?(t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),X):H===null||xe(H)?(t.exit("tableRow"),l(H)):De(H)?Ue(t,X,"whitespace")(H):(t.enter("data"),V(H))}function V(H){return H===null||H===124||$e(H)?(t.exit("data"),X(H)):(t.consume(H),H===92?ae:V)}function ae(H){return H===92||H===124?(t.consume(H),V):V(H)}}function S4(t,l){let i=-1,a=!0,o=0,c=[0,0,0,0],s=[0,0,0,0],d=!1,m=0,p,b,g;const v=new g4;for(;++i<t.length;){const S=t[i],E=S[1];S[0]==="enter"?E.type==="tableHead"?(d=!1,m!==0&&(ib(v,l,m,p,b),b=void 0,m=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(i,0,[["enter",p,l]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(a=!0,g=void 0,c=[0,0,0,0],s=[0,i+1,0,0],d&&(d=!1,b={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(i,0,[["enter",b,l]])),o=E.type==="tableDelimiterRow"?2:b?3:1):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(a=!1,s[2]===0&&(c[1]!==0&&(s[0]=s[1],g=co(v,l,c,o,void 0,g),c=[0,0,0,0]),s[2]=i)):E.type==="tableCellDivider"&&(a?a=!1:(c[1]!==0&&(s[0]=s[1],g=co(v,l,c,o,void 0,g)),c=s,s=[c[1],i,0,0])):E.type==="tableHead"?(d=!0,m=i):E.type==="tableRow"||E.type==="tableDelimiterRow"?(m=i,c[1]!==0?(s[0]=s[1],g=co(v,l,c,o,i,g)):s[1]!==0&&(g=co(v,l,s,o,i,g)),o=0):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(s[3]=i)}for(m!==0&&ib(v,l,m,p,b),v.consume(l.events),i=-1;++i<l.events.length;){const S=l.events[i];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=b4(l.events,i))}return t}function co(t,l,i,a,o,c){const s=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",d="tableContent";i[0]!==0&&(c.end=Object.assign({},ui(l.events,i[0])),t.add(i[0],0,[["exit",c,l]]));const m=ui(l.events,i[1]);if(c={type:s,start:Object.assign({},m),end:Object.assign({},m)},t.add(i[1],0,[["enter",c,l]]),i[2]!==0){const p=ui(l.events,i[2]),b=ui(l.events,i[3]),g={type:d,start:Object.assign({},p),end:Object.assign({},b)};if(t.add(i[2],0,[["enter",g,l]]),a!==2){const v=l.events[i[2]],S=l.events[i[3]];if(v[1].end=Object.assign({},S[1].end),v[1].type="chunkText",v[1].contentType="text",i[3]>i[2]+1){const E=i[2]+1,A=i[3]-i[2]-1;t.add(E,A,[])}}t.add(i[3]+1,0,[["exit",g,l]])}return o!==void 0&&(c.end=Object.assign({},ui(l.events,o)),t.add(o,0,[["exit",c,l]]),c=void 0),c}function ib(t,l,i,a,o){const c=[],s=ui(l.events,i);o&&(o.end=Object.assign({},s),c.push(["exit",o,l])),a.end=Object.assign({},s),c.push(["exit",a,l]),t.add(i+1,0,c)}function ui(t,l){const i=t[l],a=i[0]==="enter"?"start":"end";return i[1][a]}const k4={name:"tasklistCheck",tokenize:E4};function w4(){return{text:{91:k4}}}function E4(t,l,i){const a=this;return o;function o(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?i(m):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(m),t.exit("taskListCheckMarker"),c)}function c(m){return $e(m)?(t.enter("taskListCheckValueUnchecked"),t.consume(m),t.exit("taskListCheckValueUnchecked"),s):m===88||m===120?(t.enter("taskListCheckValueChecked"),t.consume(m),t.exit("taskListCheckValueChecked"),s):i(m)}function s(m){return m===93?(t.enter("taskListCheckMarker"),t.consume(m),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),d):i(m)}function d(m){return xe(m)?l(m):De(m)?t.check({tokenize:C4},l,i)(m):i(m)}}function C4(t,l,i){return Ue(t,a,"whitespace");function a(o){return o===null?i(o):l(o)}}function T4(t){return n0([$j(),u4(),p4(t),x4(),w4()])}const A4={};function N4(t){const l=this,i=t||A4,a=l.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),c=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),s=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(T4(i)),c.push(Qj()),s.push(Zj(i))}const j4="modulepreload",z4=function(t){return"/"+t},ab={},Q0=function(l,i,a){let o=Promise.resolve();if(i&&i.length>0){let s=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));o=s(i.map(p=>{if(p=z4(p),p in ab)return;ab[p]=!0;const b=p.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const v=document.createElement("link");if(v.rel=b?"stylesheet":j4,b||(v.as="script"),v.crossOrigin="",v.href=p,m&&v.setAttribute("nonce",m),document.head.appendChild(v),b)return new Promise((S,E)=>{v.addEventListener("load",S),v.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(s){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=s,window.dispatchEvent(d),!d.defaultPrevented)throw s}return o.then(s=>{for(const d of s||[])d.status==="rejected"&&c(d.reason);return l().catch(c)})};let zf=null;const ub=new Map;function Z0(){return zf||(zf=Q0(async()=>{const{createHighlighter:t}=await import("./index-CMdRmKqT.js");return{createHighlighter:t}},[]).then(({createHighlighter:t})=>t({themes:["github-dark"],langs:["plaintext"]}))),zf}function M4(t){const l=ub.get(t);if(l)return l;const i=Q0(()=>import("./index-CMdRmKqT.js"),[]).then(async({bundledLanguages:a,isSpecialLang:o})=>{if(o(t))return;const c=a[t];if(!c)throw new Error(`unknown lang: ${t}`);const s=await Z0();s.getLoadedLanguages().includes(t)||await s.loadLanguage(c)});return ub.set(t,i),i}function _4({code:t,language:l}){const[i,a]=k.useState(null),[o,c]=k.useState(!1),s=k.useRef(null);k.useEffect(()=>{let m=!1;async function p(){const b=await Z0();if(m)return;let g="plaintext";l&&(b.getLoadedLanguages().includes(l)?g=l:(M4(l).then(()=>{m||a(null)}).catch(()=>{}),g="plaintext"));try{const v=b.codeToHtml(t,{lang:g,theme:"github-dark"});m||a(v)}catch{}}return a(null),p().catch(()=>{}),()=>{m=!0}},[t,l]),k.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]);const d=k.useCallback(()=>{navigator.clipboard.writeText(t).then(()=>{c(!0),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>c(!1),2e3)}).catch(()=>{})},[t]);return y.jsxs("div",{className:"relative group rounded-md bg-secondary overflow-hidden mb-2",children:[l&&y.jsx("div",{className:"text-[10px] text-muted-foreground px-3 pt-1.5 select-none",children:l}),y.jsx("button",{onClick:d,"aria-label":"Copy code",className:"absolute top-1.5 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity rounded p-1 text-muted-foreground hover:text-foreground hover:bg-white/10",children:o?y.jsx(fd,{size:13,strokeWidth:2.5}):y.jsx(yb,{size:13,strokeWidth:2})}),i!==null?y.jsx("div",{className:"overflow-x-auto text-xs leading-5 [&>pre]:p-3 [&>pre]:m-0 [&>pre]:bg-transparent! [&>pre]:font-mono",dangerouslySetInnerHTML:{__html:i}}):y.jsx("pre",{className:"overflow-x-auto p-3 font-mono text-xs leading-5 text-foreground",children:y.jsx("code",{children:t})})]})}const D4={h1:({children:t})=>y.jsx("h1",{className:"mb-3 text-xl font-bold",children:t}),h2:({children:t})=>y.jsx("h2",{className:"mb-2 text-lg font-semibold",children:t}),h3:({children:t})=>y.jsx("h3",{className:"mb-1.5 text-base font-semibold",children:t}),p:({children:t})=>y.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed",children:t}),ul:({children:t})=>y.jsx("ul",{className:"mb-2 ml-4 list-disc space-y-0.5",children:t}),ol:({children:t})=>y.jsx("ol",{className:"mb-2 ml-4 list-decimal space-y-0.5",children:t}),li:({children:t})=>y.jsx("li",{className:"text-sm",children:t}),blockquote:({children:t})=>y.jsx("blockquote",{className:"mb-2 border-l-2 border-brand/50 pl-3 italic text-muted-foreground",children:t}),a:({href:t,children:l})=>t&&/^(https?:\/\/|\/(?!\/)|#)/i.test(t)?y.jsx("a",{href:t,className:"text-brand underline underline-offset-2 hover:text-brand/80",target:"_blank",rel:"noopener noreferrer",children:l}):y.jsx("span",{className:"text-muted-foreground",children:l}),strong:({children:t})=>y.jsx("strong",{className:"font-semibold text-foreground",children:t}),em:({children:t})=>y.jsx("em",{className:"italic text-muted-foreground",children:t}),hr:()=>y.jsx("hr",{className:"my-3 border-border"}),table:({children:t})=>y.jsx("div",{className:"mb-2 overflow-x-auto rounded border border-border",children:y.jsx("table",{className:"w-full text-sm",children:t})}),thead:({children:t})=>y.jsx("thead",{className:"bg-secondary text-secondary-foreground",children:t}),th:({children:t})=>y.jsx("th",{className:"px-3 py-1.5 text-left font-medium",children:t}),td:({children:t})=>y.jsx("td",{className:"border-t border-border px-3 py-1.5",children:t}),code:({children:t,className:l})=>{var a;return((a=/language-(\w+)/.exec(l??""))==null?void 0:a[1])?y.jsx("code",{className:se("text-xs",l),children:t}):y.jsx("code",{className:"rounded bg-secondary px-1 py-0.5 font-mono text-[11px] text-foreground",children:t})},pre:({children:t})=>{var o,c,s;const l=t,i=(c=/language-(\w+)/.exec(((o=l==null?void 0:l.props)==null?void 0:o.className)??""))==null?void 0:c[1],a=String(((s=l==null?void 0:l.props)==null?void 0:s.children)??"").replace(/\n$/,"");return y.jsx(_4,{code:a,language:i})}};function K0({text:t,className:l}){return y.jsx("div",{className:se("text-sm text-foreground",l),children:y.jsx(pN,{remarkPlugins:[N4],components:D4,children:t})})}function O4(){return y.jsx("span",{className:"streaming-cursor","aria-hidden":"true"})}const R4=/^[ \t]*(`{3,}|~{4,})/;function L4(t,l){if(l>=t.length)return l;const i=t.lastIndexOf(`
373
+ `))}function m(S,E,A,j){const N=A.enter("tableCell"),R=A.enter("phrasing"),L=A.containerPhrasing(S,{...j,before:c,after:c});return R(),N(),L}function p(S,E){return nj(S,{align:E,alignDelimiters:a,padding:i,stringLength:o})}function b(S,E,A){const j=S.children;let N=-1;const R=[],L=E.enter("table");for(;++N<j.length;)R[N]=g(j[N],E,A);return L(),R}function g(S,E,A){const j=S.children;let N=-1;const R=[],L=E.enter("tableRow");for(;++N<j.length;)R[N]=m(j[N],S,E,A);return L(),R}function v(S,E,A){let j=B0.inlineCode(S,E,A);return A.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function Yj(){return{exit:{taskListCheckValueChecked:rb,taskListCheckValueUnchecked:rb,paragraph:Fj}}}function Gj(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Xj}}}function rb(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function Fj(t){const l=this.stack[this.stack.length-2];if(l&&l.type==="listItem"&&typeof l.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const a=i.children[0];if(a&&a.type==="text"){const o=l.children;let c=-1,s;for(;++c<o.length;){const d=o[c];if(d.type==="paragraph"){s=d;break}}s===i&&(a.value=a.value.slice(1),a.value.length===0?i.children.shift():i.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,i.position.start=Object.assign({},a.position.start)))}}this.exit(t)}function Xj(t,l,i,a){const o=t.children[0],c=typeof t.checked=="boolean"&&o&&o.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",d=i.createTracker(a);c&&d.move(s);let m=B0.listItem(t,l,i,{...a,...d.current()});return c&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),m;function p(b){return b+s}}function Qj(){return[CN(),XN(),PN(),Lj(),Yj()]}function Zj(t){return{extensions:[TN(),QN(t),$N(),Vj(t),Gj()]}}const Kj={tokenize:t4,partial:!0},H0={tokenize:n4,partial:!0},q0={tokenize:l4,partial:!0},I0={tokenize:r4,partial:!0},Pj={tokenize:i4,partial:!0},V0={name:"wwwAutolink",tokenize:Wj,previous:G0},Y0={name:"protocolAutolink",tokenize:e4,previous:F0},ll={name:"emailAutolink",tokenize:Jj,previous:X0},Dn={};function $j(){return{text:Dn}}let er=48;for(;er<123;)Dn[er]=ll,er++,er===58?er=65:er===91&&(er=97);Dn[43]=ll;Dn[45]=ll;Dn[46]=ll;Dn[95]=ll;Dn[72]=[ll,Y0];Dn[104]=[ll,Y0];Dn[87]=[ll,V0];Dn[119]=[ll,V0];function Jj(t,l,i){const a=this;let o,c;return s;function s(g){return!rd(g)||!X0.call(a,a.previous)||Yd(a.events)?i(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),d(g))}function d(g){return rd(g)?(t.consume(g),d):g===64?(t.consume(g),m):i(g)}function m(g){return g===46?t.check(Pj,b,p)(g):g===45||g===95||Ct(g)?(c=!0,t.consume(g),m):b(g)}function p(g){return t.consume(g),o=!0,m}function b(g){return c&&o&&zt(a.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(g)):i(g)}}function Wj(t,l,i){const a=this;return o;function o(s){return s!==87&&s!==119||!G0.call(a,a.previous)||Yd(a.events)?i(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Kj,t.attempt(H0,t.attempt(q0,c),i),i)(s))}function c(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(s)}}function e4(t,l,i){const a=this;let o="",c=!1;return s;function s(g){return(g===72||g===104)&&F0.call(a,a.previous)&&!Yd(a.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),t.consume(g),d):i(g)}function d(g){if(zt(g)&&o.length<5)return o+=String.fromCodePoint(g),t.consume(g),d;if(g===58){const v=o.toLowerCase();if(v==="http"||v==="https")return t.consume(g),m}return i(g)}function m(g){return g===47?(t.consume(g),c?p:(c=!0,m)):i(g)}function p(g){return g===null||vo(g)||$e(g)||ar(g)||Ao(g)?i(g):t.attempt(H0,t.attempt(q0,b),i)(g)}function b(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(g)}}function t4(t,l,i){let a=0;return o;function o(s){return(s===87||s===119)&&a<3?(a++,t.consume(s),o):s===46&&a===3?(t.consume(s),c):i(s)}function c(s){return s===null?i(s):l(s)}}function n4(t,l,i){let a,o,c;return s;function s(p){return p===46||p===95?t.check(I0,m,d)(p):p===null||$e(p)||ar(p)||p!==45&&Ao(p)?m(p):(c=!0,t.consume(p),s)}function d(p){return p===95?a=!0:(o=a,a=void 0),t.consume(p),s}function m(p){return o||a||!c?i(p):l(p)}}function l4(t,l){let i=0,a=0;return o;function o(s){return s===40?(i++,t.consume(s),o):s===41&&a<i?c(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?t.check(I0,l,c)(s):s===null||$e(s)||ar(s)?l(s):(t.consume(s),o)}function c(s){return s===41&&a++,t.consume(s),o}}function r4(t,l,i){return a;function a(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(t.consume(d),a):d===38?(t.consume(d),c):d===93?(t.consume(d),o):d===60||d===null||$e(d)||ar(d)?l(d):i(d)}function o(d){return d===null||d===40||d===91||$e(d)||ar(d)?l(d):a(d)}function c(d){return zt(d)?s(d):i(d)}function s(d){return d===59?(t.consume(d),a):zt(d)?(t.consume(d),s):i(d)}}function i4(t,l,i){return a;function a(c){return t.consume(c),o}function o(c){return Ct(c)?i(c):l(c)}}function G0(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||$e(t)}function F0(t){return!zt(t)}function X0(t){return!(t===47||rd(t))}function rd(t){return t===43||t===45||t===46||t===95||Ct(t)}function Yd(t){let l=t.length,i=!1;for(;l--;){const a=t[l][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){i=!0;break}if(a._gfmAutolinkLiteralWalkedInto){i=!1;break}}return t.length>0&&!i&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const a4={tokenize:m4,partial:!0};function u4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:f4,continuation:{tokenize:d4},exit:h4}},text:{91:{name:"gfmFootnoteCall",tokenize:c4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:o4,resolveTo:s4}}}}function o4(t,l,i){const a=this;let o=a.events.length;const c=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let s;for(;o--;){const m=a.events[o][1];if(m.type==="labelImage"){s=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return d;function d(m){if(!s||!s._balanced)return i(m);const p=Sn(a.sliceSerialize({start:s.end,end:a.now()}));return p.codePointAt(0)!==94||!c.includes(p.slice(1))?i(m):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),l(m))}}function s4(t,l){let i=t.length;for(;i--;)if(t[i][1].type==="labelImage"&&t[i][0]==="enter"){t[i][1];break}t[i+1][1].type="data",t[i+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},t[i+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[i+3][1].end),end:Object.assign({},t[i+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[t[i+1],t[i+2],["enter",a,l],t[i+3],t[i+4],["enter",o,l],["exit",o,l],["enter",c,l],["enter",s,l],["exit",s,l],["exit",c,l],t[t.length-2],t[t.length-1],["exit",a,l]];return t.splice(i,t.length-i+1,...d),t}function c4(t,l,i){const a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c=0,s;return d;function d(g){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?i(g):(t.enter("gfmFootnoteCallMarker"),t.consume(g),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",p)}function p(g){if(c>999||g===93&&!s||g===null||g===91||$e(g))return i(g);if(g===93){t.exit("chunkString");const v=t.exit("gfmFootnoteCallString");return o.includes(Sn(a.sliceSerialize(v)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):i(g)}return $e(g)||(s=!0),c++,t.consume(g),g===92?b:p}function b(g){return g===91||g===92||g===93?(t.consume(g),c++,p):p(g)}}function f4(t,l,i){const a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c,s=0,d;return m;function m(E){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",b):i(E)}function b(E){if(s>999||E===93&&!d||E===null||E===91||$e(E))return i(E);if(E===93){t.exit("chunkString");const A=t.exit("gfmFootnoteDefinitionLabelString");return c=Sn(a.sliceSerialize(A)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),v}return $e(E)||(d=!0),s++,t.consume(E),E===92?g:b}function g(E){return E===91||E===92||E===93?(t.consume(E),s++,b):b(E)}function v(E){return E===58?(t.enter("definitionMarker"),t.consume(E),t.exit("definitionMarker"),o.includes(c)||o.push(c),Ue(t,S,"gfmFootnoteDefinitionWhitespace")):i(E)}function S(E){return l(E)}}function d4(t,l,i){return t.check(Ma,l,t.attempt(a4,l,i))}function h4(t){t.exit("gfmFootnoteDefinition")}function m4(t,l,i){const a=this;return Ue(t,o,"gfmFootnoteDefinitionIndent",5);function o(c){const s=a.events[a.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?l(c):i(c)}}function p4(t){let i=(t||{}).singleTilde;const a={name:"strikethrough",tokenize:c,resolveAll:o};return i==null&&(i=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function o(s,d){let m=-1;for(;++m<s.length;)if(s[m][0]==="enter"&&s[m][1].type==="strikethroughSequenceTemporary"&&s[m][1]._close){let p=m;for(;p--;)if(s[p][0]==="exit"&&s[p][1].type==="strikethroughSequenceTemporary"&&s[p][1]._open&&s[m][1].end.offset-s[m][1].start.offset===s[p][1].end.offset-s[p][1].start.offset){s[m][1].type="strikethroughSequence",s[p][1].type="strikethroughSequence";const b={type:"strikethrough",start:Object.assign({},s[p][1].start),end:Object.assign({},s[m][1].end)},g={type:"strikethroughText",start:Object.assign({},s[p][1].end),end:Object.assign({},s[m][1].start)},v=[["enter",b,d],["enter",s[p][1],d],["exit",s[p][1],d],["enter",g,d]],S=d.parser.constructs.insideSpan.null;S&&en(v,v.length,0,No(S,s.slice(p+1,m),d)),en(v,v.length,0,[["exit",g,d],["enter",s[m][1],d],["exit",s[m][1],d],["exit",b,d]]),en(s,p-1,m-p+3,v),m=p+v.length-2;break}}for(m=-1;++m<s.length;)s[m][1].type==="strikethroughSequenceTemporary"&&(s[m][1].type="data");return s}function c(s,d,m){const p=this.previous,b=this.events;let g=0;return v;function v(E){return p===126&&b[b.length-1][1].type!=="characterEscape"?m(E):(s.enter("strikethroughSequenceTemporary"),S(E))}function S(E){const A=di(p);if(E===126)return g>1?m(E):(s.consume(E),g++,S);if(g<2&&!i)return m(E);const j=s.exit("strikethroughSequenceTemporary"),N=di(E);return j._open=!N||N===2&&!!A,j._close=!A||A===2&&!!N,d(E)}}}class g4{constructor(){this.map=[]}add(l,i,a){y4(this,l,i,a)}consume(l){if(this.map.sort(function(c,s){return c[0]-s[0]}),this.map.length===0)return;let i=this.map.length;const a=[];for(;i>0;)i-=1,a.push(l.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),l.length=this.map[i][0];a.push(l.slice()),l.length=0;let o=a.pop();for(;o;){for(const c of o)l.push(c);o=a.pop()}this.map.length=0}}function y4(t,l,i,a){let o=0;if(!(i===0&&a.length===0)){for(;o<t.map.length;){if(t.map[o][0]===l){t.map[o][1]+=i,t.map[o][2].push(...a);return}o+=1}t.map.push([l,i,a])}}function b4(t,l){let i=!1;const a=[];for(;l<t.length;){const o=t[l];if(i){if(o[0]==="enter")o[1].type==="tableContent"&&a.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const c=a.length-1;a[c]=a[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(i=!0);l+=1}return a}function x4(){return{flow:{null:{name:"table",tokenize:v4,resolveAll:S4}}}}function v4(t,l,i){const a=this;let o=0,c=0,s;return d;function d(H){let re=a.events.length-1;for(;re>-1;){const ue=a.events[re][1].type;if(ue==="lineEnding"||ue==="linePrefix")re--;else break}const P=re>-1?a.events[re][1].type:null,be=P==="tableHead"||P==="tableRow"?D:m;return be===D&&a.parser.lazy[a.now().line]?i(H):be(H)}function m(H){return t.enter("tableHead"),t.enter("tableRow"),p(H)}function p(H){return H===124||(s=!0,c+=1),b(H)}function b(H){return H===null?i(H):xe(H)?c>1?(c=0,a.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),S):i(H):De(H)?Ue(t,b,"whitespace")(H):(c+=1,s&&(s=!1,o+=1),H===124?(t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),s=!0,b):(t.enter("data"),g(H)))}function g(H){return H===null||H===124||$e(H)?(t.exit("data"),b(H)):(t.consume(H),H===92?v:g)}function v(H){return H===92||H===124?(t.consume(H),g):g(H)}function S(H){return a.interrupt=!1,a.parser.lazy[a.now().line]?i(H):(t.enter("tableDelimiterRow"),s=!1,De(H)?Ue(t,E,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):E(H))}function E(H){return H===45||H===58?j(H):H===124?(s=!0,t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),A):ee(H)}function A(H){return De(H)?Ue(t,j,"whitespace")(H):j(H)}function j(H){return H===58?(c+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(H),t.exit("tableDelimiterMarker"),N):H===45?(c+=1,N(H)):H===null||xe(H)?W(H):ee(H)}function N(H){return H===45?(t.enter("tableDelimiterFiller"),R(H)):ee(H)}function R(H){return H===45?(t.consume(H),R):H===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(H),t.exit("tableDelimiterMarker"),L):(t.exit("tableDelimiterFiller"),L(H))}function L(H){return De(H)?Ue(t,W,"whitespace")(H):W(H)}function W(H){return H===124?E(H):H===null||xe(H)?!s||o!==c?ee(H):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(H)):ee(H)}function ee(H){return i(H)}function D(H){return t.enter("tableRow"),X(H)}function X(H){return H===124?(t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),X):H===null||xe(H)?(t.exit("tableRow"),l(H)):De(H)?Ue(t,X,"whitespace")(H):(t.enter("data"),V(H))}function V(H){return H===null||H===124||$e(H)?(t.exit("data"),X(H)):(t.consume(H),H===92?ae:V)}function ae(H){return H===92||H===124?(t.consume(H),V):V(H)}}function S4(t,l){let i=-1,a=!0,o=0,c=[0,0,0,0],s=[0,0,0,0],d=!1,m=0,p,b,g;const v=new g4;for(;++i<t.length;){const S=t[i],E=S[1];S[0]==="enter"?E.type==="tableHead"?(d=!1,m!==0&&(ib(v,l,m,p,b),b=void 0,m=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(i,0,[["enter",p,l]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(a=!0,g=void 0,c=[0,0,0,0],s=[0,i+1,0,0],d&&(d=!1,b={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(i,0,[["enter",b,l]])),o=E.type==="tableDelimiterRow"?2:b?3:1):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(a=!1,s[2]===0&&(c[1]!==0&&(s[0]=s[1],g=co(v,l,c,o,void 0,g),c=[0,0,0,0]),s[2]=i)):E.type==="tableCellDivider"&&(a?a=!1:(c[1]!==0&&(s[0]=s[1],g=co(v,l,c,o,void 0,g)),c=s,s=[c[1],i,0,0])):E.type==="tableHead"?(d=!0,m=i):E.type==="tableRow"||E.type==="tableDelimiterRow"?(m=i,c[1]!==0?(s[0]=s[1],g=co(v,l,c,o,i,g)):s[1]!==0&&(g=co(v,l,s,o,i,g)),o=0):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(s[3]=i)}for(m!==0&&ib(v,l,m,p,b),v.consume(l.events),i=-1;++i<l.events.length;){const S=l.events[i];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=b4(l.events,i))}return t}function co(t,l,i,a,o,c){const s=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",d="tableContent";i[0]!==0&&(c.end=Object.assign({},ui(l.events,i[0])),t.add(i[0],0,[["exit",c,l]]));const m=ui(l.events,i[1]);if(c={type:s,start:Object.assign({},m),end:Object.assign({},m)},t.add(i[1],0,[["enter",c,l]]),i[2]!==0){const p=ui(l.events,i[2]),b=ui(l.events,i[3]),g={type:d,start:Object.assign({},p),end:Object.assign({},b)};if(t.add(i[2],0,[["enter",g,l]]),a!==2){const v=l.events[i[2]],S=l.events[i[3]];if(v[1].end=Object.assign({},S[1].end),v[1].type="chunkText",v[1].contentType="text",i[3]>i[2]+1){const E=i[2]+1,A=i[3]-i[2]-1;t.add(E,A,[])}}t.add(i[3]+1,0,[["exit",g,l]])}return o!==void 0&&(c.end=Object.assign({},ui(l.events,o)),t.add(o,0,[["exit",c,l]]),c=void 0),c}function ib(t,l,i,a,o){const c=[],s=ui(l.events,i);o&&(o.end=Object.assign({},s),c.push(["exit",o,l])),a.end=Object.assign({},s),c.push(["exit",a,l]),t.add(i+1,0,c)}function ui(t,l){const i=t[l],a=i[0]==="enter"?"start":"end";return i[1][a]}const k4={name:"tasklistCheck",tokenize:E4};function w4(){return{text:{91:k4}}}function E4(t,l,i){const a=this;return o;function o(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?i(m):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(m),t.exit("taskListCheckMarker"),c)}function c(m){return $e(m)?(t.enter("taskListCheckValueUnchecked"),t.consume(m),t.exit("taskListCheckValueUnchecked"),s):m===88||m===120?(t.enter("taskListCheckValueChecked"),t.consume(m),t.exit("taskListCheckValueChecked"),s):i(m)}function s(m){return m===93?(t.enter("taskListCheckMarker"),t.consume(m),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),d):i(m)}function d(m){return xe(m)?l(m):De(m)?t.check({tokenize:C4},l,i)(m):i(m)}}function C4(t,l,i){return Ue(t,a,"whitespace");function a(o){return o===null?i(o):l(o)}}function T4(t){return n0([$j(),u4(),p4(t),x4(),w4()])}const A4={};function N4(t){const l=this,i=t||A4,a=l.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),c=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),s=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(T4(i)),c.push(Qj()),s.push(Zj(i))}const j4="modulepreload",z4=function(t){return"/"+t},ab={},Q0=function(l,i,a){let o=Promise.resolve();if(i&&i.length>0){let s=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));o=s(i.map(p=>{if(p=z4(p),p in ab)return;ab[p]=!0;const b=p.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const v=document.createElement("link");if(v.rel=b?"stylesheet":j4,b||(v.as="script"),v.crossOrigin="",v.href=p,m&&v.setAttribute("nonce",m),document.head.appendChild(v),b)return new Promise((S,E)=>{v.addEventListener("load",S),v.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(s){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=s,window.dispatchEvent(d),!d.defaultPrevented)throw s}return o.then(s=>{for(const d of s||[])d.status==="rejected"&&c(d.reason);return l().catch(c)})};let zf=null;const ub=new Map;function Z0(){return zf||(zf=Q0(async()=>{const{createHighlighter:t}=await import("./index-DpEHdhDh.js");return{createHighlighter:t}},[]).then(({createHighlighter:t})=>t({themes:["github-dark"],langs:["plaintext"]}))),zf}function M4(t){const l=ub.get(t);if(l)return l;const i=Q0(()=>import("./index-DpEHdhDh.js"),[]).then(async({bundledLanguages:a,isSpecialLang:o})=>{if(o(t))return;const c=a[t];if(!c)throw new Error(`unknown lang: ${t}`);const s=await Z0();s.getLoadedLanguages().includes(t)||await s.loadLanguage(c)});return ub.set(t,i),i}function _4({code:t,language:l}){const[i,a]=k.useState(null),[o,c]=k.useState(!1),s=k.useRef(null);k.useEffect(()=>{let m=!1;async function p(){const b=await Z0();if(m)return;let g="plaintext";l&&(b.getLoadedLanguages().includes(l)?g=l:(M4(l).then(()=>{m||a(null)}).catch(()=>{}),g="plaintext"));try{const v=b.codeToHtml(t,{lang:g,theme:"github-dark"});m||a(v)}catch{}}return a(null),p().catch(()=>{}),()=>{m=!0}},[t,l]),k.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]);const d=k.useCallback(()=>{navigator.clipboard.writeText(t).then(()=>{c(!0),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>c(!1),2e3)}).catch(()=>{})},[t]);return y.jsxs("div",{className:"relative group rounded-md bg-secondary overflow-hidden mb-2",children:[l&&y.jsx("div",{className:"text-[10px] text-muted-foreground px-3 pt-1.5 select-none",children:l}),y.jsx("button",{onClick:d,"aria-label":"Copy code",className:"absolute top-1.5 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity rounded p-1 text-muted-foreground hover:text-foreground hover:bg-white/10",children:o?y.jsx(fd,{size:13,strokeWidth:2.5}):y.jsx(yb,{size:13,strokeWidth:2})}),i!==null?y.jsx("div",{className:"overflow-x-auto text-xs leading-5 [&>pre]:p-3 [&>pre]:m-0 [&>pre]:bg-transparent! [&>pre]:font-mono",dangerouslySetInnerHTML:{__html:i}}):y.jsx("pre",{className:"overflow-x-auto p-3 font-mono text-xs leading-5 text-foreground",children:y.jsx("code",{children:t})})]})}const D4={h1:({children:t})=>y.jsx("h1",{className:"mb-3 text-xl font-bold",children:t}),h2:({children:t})=>y.jsx("h2",{className:"mb-2 text-lg font-semibold",children:t}),h3:({children:t})=>y.jsx("h3",{className:"mb-1.5 text-base font-semibold",children:t}),p:({children:t})=>y.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed",children:t}),ul:({children:t})=>y.jsx("ul",{className:"mb-2 ml-4 list-disc space-y-0.5",children:t}),ol:({children:t})=>y.jsx("ol",{className:"mb-2 ml-4 list-decimal space-y-0.5",children:t}),li:({children:t})=>y.jsx("li",{className:"text-sm",children:t}),blockquote:({children:t})=>y.jsx("blockquote",{className:"mb-2 border-l-2 border-brand/50 pl-3 italic text-muted-foreground",children:t}),a:({href:t,children:l})=>t&&/^(https?:\/\/|\/(?!\/)|#)/i.test(t)?y.jsx("a",{href:t,className:"text-brand underline underline-offset-2 hover:text-brand/80",target:"_blank",rel:"noopener noreferrer",children:l}):y.jsx("span",{className:"text-muted-foreground",children:l}),strong:({children:t})=>y.jsx("strong",{className:"font-semibold text-foreground",children:t}),em:({children:t})=>y.jsx("em",{className:"italic text-muted-foreground",children:t}),hr:()=>y.jsx("hr",{className:"my-3 border-border"}),table:({children:t})=>y.jsx("div",{className:"mb-2 overflow-x-auto rounded border border-border",children:y.jsx("table",{className:"w-full text-sm",children:t})}),thead:({children:t})=>y.jsx("thead",{className:"bg-secondary text-secondary-foreground",children:t}),th:({children:t})=>y.jsx("th",{className:"px-3 py-1.5 text-left font-medium",children:t}),td:({children:t})=>y.jsx("td",{className:"border-t border-border px-3 py-1.5",children:t}),code:({children:t,className:l})=>{var a;return((a=/language-(\w+)/.exec(l??""))==null?void 0:a[1])?y.jsx("code",{className:se("text-xs",l),children:t}):y.jsx("code",{className:"rounded bg-secondary px-1 py-0.5 font-mono text-[11px] text-foreground",children:t})},pre:({children:t})=>{var o,c,s;const l=t,i=(c=/language-(\w+)/.exec(((o=l==null?void 0:l.props)==null?void 0:o.className)??""))==null?void 0:c[1],a=String(((s=l==null?void 0:l.props)==null?void 0:s.children)??"").replace(/\n$/,"");return y.jsx(_4,{code:a,language:i})}};function K0({text:t,className:l}){return y.jsx("div",{className:se("text-sm text-foreground",l),children:y.jsx(pN,{remarkPlugins:[N4],components:D4,children:t})})}function O4(){return y.jsx("span",{className:"streaming-cursor","aria-hidden":"true"})}const R4=/^[ \t]*(`{3,}|~{4,})/;function L4(t,l){if(l>=t.length)return l;const i=t.lastIndexOf(`
374
374
  `,l-1)+1,a=t.slice(i,l);if(R4.test(a)){const o=t.indexOf(`
375
375
  `,l);return o===-1?t.length:o+1}return l}function U4({text:t,isStreaming:l,speed:i=80,onComplete:a}){const o=k.useRef(0),[c,s]=k.useState(0),d=k.useRef(null),m=k.useRef(null),p=k.useRef(!1),b=k.useRef(a);k.useEffect(()=>{b.current=a},[a]);const g=k.useRef(i);k.useEffect(()=>{g.current=i});const v=!l&&o.current===0&&t.length>0,S=k.useCallback(()=>{if(d.current!==null)return;function N(R){var H;const L=m.current??R,W=R-L;m.current=R;const ee=g.current/1e3,D=Math.max(1,Math.floor(ee*W)),X=o.current,V=t.length;if(X<V){const re=Math.min(X+D,V),P=L4(t,re);o.current=P,s(P)}if(o.current>=t.length&&!l){d.current=null,m.current=null,p.current||(p.current=!0,(H=b.current)==null||H.call(b));return}d.current=requestAnimationFrame(N)}d.current=requestAnimationFrame(N)},[t,l]);k.useEffect(()=>{var N;if(v){o.current=t.length,s(t.length),p.current||(p.current=!0,(N=b.current)==null||N.call(b));return}return(o.current<t.length||l)&&S(),()=>{d.current!==null&&(cancelAnimationFrame(d.current),d.current=null)}},[t,l,v]);const E=v?t.length:c,A=t.slice(0,E),j=E<t.length||l;return y.jsxs("span",{className:"streaming-text-root",children:[y.jsx(K0,{text:A}),j&&y.jsx(O4,{})]})}function P0({kind:t,text:l,className:i}){const[a,o]=k.useState(!1),c=k.useRef(null);k.useEffect(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);function s(){navigator.clipboard.writeText(l).then(()=>{o(!0),c.current!==null&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),2e3)}).catch(()=>{})}return y.jsx("div",{className:se("absolute top-1 right-1","opacity-0 group-hover:opacity-100 transition-opacity duration-150",i),children:y.jsx("div",{className:"flex items-center gap-0.5 rounded-md border border-border bg-card px-1 py-0.5 shadow-sm",children:t==="assistant"&&y.jsx(B4,{onClick:s,title:a?"Copied!":"Copy",children:a?y.jsx(fd,{className:"h-3.5 w-3.5 text-status-running"}):y.jsx(yb,{className:"h-3.5 w-3.5"})})})})}function B4({onClick:t,title:l,children:i}){return y.jsx("button",{type:"button",onClick:t,title:l,className:"h-6 w-6 rounded flex items-center justify-center hover:bg-secondary text-muted-foreground hover:text-foreground transition-colors",children:i})}function $0({text:t}){return y.jsxs("div",{className:"group relative flex flex-col items-end gap-1",children:[y.jsx("span",{className:"text-[11px] font-medium uppercase tracking-widest text-muted-foreground/50",children:"You"}),y.jsx("p",{className:"max-w-2xl text-sm leading-relaxed text-foreground whitespace-pre-wrap text-right",children:t}),y.jsx(P0,{kind:"user",text:t})]})}function J0({text:t,isStreaming:l=!1}){return y.jsxs("div",{className:"group relative flex flex-col gap-1",children:[y.jsx("span",{className:"text-[11px] font-medium uppercase tracking-widest text-brand/60",children:"Agent"}),y.jsx("div",{className:"max-w-3xl",children:l?y.jsx(U4,{text:t,isStreaming:!0}):y.jsx(K0,{text:t})}),y.jsx(P0,{kind:"assistant",text:t})]})}function W0({message:t}){return y.jsxs("div",{className:"flex items-start gap-2.5 rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-3",children:[y.jsx(gb,{className:"mt-0.5 h-4 w-4 shrink-0 text-status-failed"}),y.jsx("p",{className:"text-sm leading-relaxed text-status-failed",children:t})]})}function ev({text:t}){return y.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[y.jsx(bb,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),y.jsx("p",{className:"text-xs text-muted-foreground",children:t})]})}function tv({item:t}){return y.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-1.5",children:[y.jsx("span",{className:"text-[10px] text-muted-foreground",children:"BG"}),y.jsx("span",{className:"text-xs text-foreground",children:t.label}),y.jsx("span",{className:se("ml-auto font-mono text-[10px] capitalize",t.status==="completed"?"text-status-running":"",t.status==="failed"?"text-status-failed":"",t.status==="running"?"text-status-blocked":""),children:t.status})]})}function H4(t){const l=[];let i=0;for(;i<t.length;){const a=t[i];if(a===void 0){i++;continue}if(a.kind!=="subagent"){l.push({kind:"item",item:a}),i++;continue}const o=[];for(;i<t.length;){const c=t[i];if(c===void 0||c.kind!=="subagent")break;o.push(c),i++}l.push({kind:"subagent-group",items:o,id:o[0].id})}return l}function q4(t,l=!1){switch(t.kind){case"user":return y.jsx($0,{text:t.text});case"assistant":return y.jsx(J0,{text:t.text,isStreaming:l});case"thinking":return y.jsx(Ox,{text:t.text});case"tool":return y.jsx(wE,{...t});case"error":return y.jsx(W0,{message:t.message});case"notice":return y.jsx(ev,{text:t.text});case"bg_job":return y.jsx(tv,{item:t});case"subagent":return null}}function I4(t,l=!1){switch(t.kind){case"user":return y.jsx($0,{text:t.text});case"assistant":return y.jsx(J0,{text:t.text,isStreaming:l});case"thinking":return y.jsx(Ox,{text:t.text});case"error":return y.jsx(W0,{message:t.message});case"notice":return y.jsx(ev,{text:t.text});case"bg_job":return y.jsx(tv,{item:t});default:return null}}function V4({items:t,totals:l,spineMode:i=!0,turnActive:a=!1}){const o=k.useMemo(()=>H4(t),[t]),c=nC(t),s=k.useMemo(()=>{var m;for(let p=t.length-1;p>=0;p--)if(((m=t[p])==null?void 0:m.kind)==="assistant")return t[p].id;return null},[t]),d=k.useCallback((m,p)=>{const b=m.kind==="user"&&p>0,g=a&&m.id===s;return y.jsxs("div",{children:[b&&y.jsx("div",{className:"my-6 border-t border-border/40","aria-hidden":"true"}),y.jsx("div",{className:"py-2 px-1",children:I4(m,g)})]},m.id)},[a,s]);return y.jsxs("div",{className:"flex flex-col gap-0 max-w-4xl mx-auto w-full",children:[l&&y.jsx(Lx,{totals:l,className:"sticky top-0 z-10 mb-4 rounded-md border border-border bg-card px-3 py-1.5"}),t.length===0?y.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:"No transcript items yet."}):i?y.jsx(tC,{slots:c,renderTextItem:d}):o.map((m,p)=>{if(m.kind==="item"){const{item:g}=m,v=g.kind==="user"&&p>0,S=a&&g.id===s;return y.jsxs("div",{children:[v&&y.jsx("div",{className:"my-6 border-t border-border/40","aria-hidden":"true"}),y.jsx("div",{className:"py-2 px-1",children:q4(g,S)})]},g.id)}const b=_E(m.items);return y.jsx("div",{className:"py-2 px-1",children:y.jsx(jE,{roots:b})},m.id)})]})}const id="afk_web_token",Y4="__AFK_WEB_TOKEN__";let xa=null;function G4(){xa=null;try{sessionStorage.removeItem(id)}catch{}}function nv(){if(xa)return xa;const t=document.querySelector('meta[name="afk-token"]'),l=t==null?void 0:t.content;if(l&&l!==Y4){xa=l;try{sessionStorage.setItem(id,l)}catch{}return F4(),l}try{const i=sessionStorage.getItem(id);if(i)return xa=i,i}catch{}return""}function F4(){const t=new URL(window.location.href);(t.searchParams.has("token")||t.searchParams.has("k"))&&(t.searchParams.delete("token"),t.searchParams.delete("k"),window.history.replaceState({},"",t.toString()))}async function lt(t,l={}){const i=nv(),a=new Headers(l.headers);i&&a.set("Authorization",`Bearer ${i}`),l.body&&!a.has("Content-Type")&&a.set("Content-Type","application/json");const o=await fetch(t,{...l,headers:a});if(!o.ok){o.status===401&&G4();const c=await o.text().catch(()=>o.statusText);throw new X4(o.status,c)}return o.json()}class X4 extends Error{constructor(l,i){super(`API ${l}: ${i}`),this.status=l,this.name="ApiError"}}const Q4={preference:"Preference",convention:"Convention",decision:"Decision",learning:"Learning"};function Z4({type:t}){return y.jsx("span",{className:se("inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium",t==="fact"?"bg-blue-500/15 text-blue-400":"bg-violet-500/15 text-violet-400"),children:t})}function K4({category:t}){return t?y.jsx("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium bg-zinc-700 text-zinc-300",children:Q4[t]??t}):null}function P4({result:t}){const l=t.content.length>200?t.content.slice(0,200)+"…":t.content,i=t.created_at?new Date(t.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null;return y.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900 p-3 space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.jsx(Z4,{type:t.type}),y.jsx(K4,{category:t.category}),i&&y.jsx("span",{className:"text-xs text-zinc-500 ml-auto",children:i})]}),y.jsx("p",{className:"text-sm text-zinc-300 leading-relaxed whitespace-pre-wrap break-words",children:l})]})}function $4({pct:t,truncated:l}){const i=Math.min(t,100),a=t>=100?"bg-red-500":t>=80?"bg-amber-400":"bg-accent";return y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"flex-1 h-2 rounded-full bg-zinc-800 overflow-hidden",children:y.jsx("div",{className:se("h-full rounded-full transition-all",a),style:{width:`${i}%`}})}),l&&y.jsx("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium bg-amber-400/15 text-amber-400",children:"Truncated"})]})}function J4({hot:t}){if(!t)return null;const{content:l,usage:i}=t;return y.jsxs("section",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"HOT Memory"}),y.jsxs("span",{className:"text-xs text-zinc-500",children:[i.tokens.toLocaleString()," / ",i.maxTokens.toLocaleString()," tokens"]})]}),y.jsx($4,{pct:i.pct,truncated:i.truncated}),l?y.jsx("pre",{className:"rounded-md border border-zinc-800 bg-zinc-950 p-3 text-xs text-zinc-300 font-mono overflow-x-auto whitespace-pre-wrap max-h-48",children:l}):y.jsx("p",{className:"text-xs text-zinc-500 italic",children:"No hot memory loaded."})]})}const W4=[{value:"",label:"All Categories"},{value:"preference",label:"Preference"},{value:"convention",label:"Convention"},{value:"decision",label:"Decision"},{value:"learning",label:"Learning"}];function ez(){const[t,l]=k.useState(null),[i,a]=k.useState(""),[o,c]=k.useState(""),[s,d]=k.useState(null),[m,p]=k.useState(!1),[b,g]=k.useState(null);k.useEffect(()=>{lt("/api/memory/hot").then(l).catch(()=>{})},[]);const v=k.useCallback(async S=>{S.preventDefault(),p(!0),g(null);try{const E=new URLSearchParams({q:i,limit:"20"});o&&E.set("category",o);const A=await lt(`/api/memory/search?${E.toString()}`);d(A.results)}catch(E){g(E instanceof Error?E.message:"Search failed")}finally{p(!1)}},[i,o]);return y.jsxs("div",{className:"flex flex-col gap-6 p-4",children:[y.jsx(J4,{hot:t}),y.jsxs("section",{className:"space-y-3",children:[y.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"Search Memory"}),y.jsxs("form",{onSubmit:v,className:"flex gap-2 flex-wrap",children:[y.jsx("input",{type:"text",value:i,onChange:S=>a(S.target.value),placeholder:"FTS5 query…",className:"flex-1 min-w-0 rounded-md border border-zinc-700 bg-zinc-900 px-3 py-1.5 text-sm text-zinc-100 placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-accent"}),y.jsx("select",{value:o,onChange:S=>c(S.target.value),className:"rounded-md border border-zinc-700 bg-zinc-900 px-2 py-1.5 text-sm text-zinc-100 focus:outline-none focus:ring-1 focus:ring-accent",children:W4.map(S=>y.jsx("option",{value:S.value,children:S.label},S.value))}),y.jsx("button",{type:"submit",disabled:m,className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white disabled:opacity-50 hover:opacity-90 transition-opacity",children:m?"Searching…":"Search"})]}),b&&y.jsx("p",{className:"text-xs text-red-400",children:b}),s!==null&&y.jsx("div",{className:"space-y-2",children:s.length===0?y.jsx("p",{className:"text-sm text-zinc-500 italic text-center py-6",children:"No results found."}):s.map(S=>y.jsx(P4,{result:S},`${S.type}-${S.created_at}-${S.content.slice(0,32)}`))})]})]})}const tz={success:{label:"Success",className:"bg-status-done/20 text-status-done border-status-done/30"},error:{label:"Error",className:"bg-status-failed/20 text-status-failed border-status-failed/30"},skipped:{label:"Skipped",className:"bg-muted text-muted-foreground border-border"}};function nz(t){if(t<1e3)return`${t}ms`;const l=Math.floor(t/1e3);return l<60?`${l}s`:`${Math.floor(l/60)}m ${l%60}s`}function lz(t){return new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function rz({schedule:t,onClose:l}){const[i,a]=k.useState([]),[o,c]=k.useState(!0),[s,d]=k.useState(null);return k.useEffect(()=>{let m=!1;return c(!0),d(null),lt(`/api/schedules/${t.id}/history`).then(p=>{m||a(p.history)}).catch(p=>{m||d(p instanceof Error?p.message:"Failed to load history")}).finally(()=>{m||c(!1)}),()=>{m=!0}},[t.id]),k.useEffect(()=>{const m=p=>{p.key==="Escape"&&l()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[l]),y.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:m=>{m.target===m.currentTarget&&l()},children:y.jsxs("div",{className:"flex max-h-[80vh] w-full max-w-lg flex-col rounded-xl border border-border bg-card shadow-xl",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-border px-5 py-4",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-sm font-semibold",children:t.name}),y.jsx("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:t.cron})]}),y.jsx("button",{onClick:l,className:"flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":"Close",children:"✕"})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-3",children:[o&&y.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading history…"}),s&&y.jsx("p",{className:"py-8 text-center text-sm text-status-failed",children:s}),!o&&!s&&i.length===0&&y.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No runs recorded yet."}),!o&&!s&&i.length>0&&y.jsx("ul",{className:"space-y-2",children:i.map((m,p)=>{const b=tz[m.status];return y.jsxs("li",{className:"flex items-start gap-3 rounded-lg border border-border bg-background/50 px-4 py-3",children:[y.jsx("span",{className:se("mt-0.5 shrink-0 rounded-full border px-2 py-0.5 text-xs font-medium",b.className),children:b.label}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y.jsx("span",{className:"text-xs text-muted-foreground",children:lz(m.triggeredAt)}),y.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:nz(m.durationMs)})]}),m.errorMessage&&y.jsx("p",{className:"mt-1 truncate font-mono text-xs text-status-failed",children:m.errorMessage})]})]},`${m.taskId}-${m.triggeredAt}-${p}`)})})]})]})})}function iz({status:t}){return t?y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:se("size-2 rounded-full",t.running?"animate-pulse bg-status-done":"bg-status-failed")}),y.jsx("span",{className:"text-sm text-muted-foreground",children:t.running?`Running${t.tasks!=null?` (${t.tasks} task${t.tasks!==1?"s":""})`:""}`:"Stopped"})]}):null}function lv({checked:t,onChange:l,disabled:i}){return y.jsx("button",{role:"switch","aria-checked":t,onClick:a=>{a.stopPropagation(),l()},disabled:i,className:se("relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent","transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",t?"bg-brand":"bg-muted"),children:y.jsx("span",{className:se("block size-4 rounded-full bg-white shadow transition-transform",t?"translate-x-4":"translate-x-0")})})}function az({schedule:t,onToggle:l,onDelete:i,onShowHistory:a}){const[o,c]=k.useState(!1),[s,d]=k.useState(!1),m=async()=>{c(!0),await l(t.id).finally(()=>c(!1))},p=async g=>{g.stopPropagation(),window.confirm(`Delete schedule "${t.name}"? This cannot be undone.`)&&(d(!0),await i(t.id).finally(()=>d(!1)))},b=t.trigger==="both"?"cron + session start":t.trigger??"cron";return y.jsxs("div",{className:se("group flex cursor-pointer flex-col gap-3 rounded-xl border border-border bg-card p-4","transition-colors hover:border-brand/40 hover:bg-accent/30",!t.enabled&&"opacity-60"),onClick:()=>a(t),children:[y.jsxs("div",{className:"flex items-start justify-between gap-3",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"truncate text-sm font-semibold",children:t.name}),y.jsx("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:t.cron})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.jsx(lv,{checked:t.enabled,onChange:()=>{m()},disabled:o}),y.jsx("button",{onClick:p,disabled:s,"aria-label":`Delete schedule ${t.name}`,className:se("flex size-7 items-center justify-center rounded-md text-muted-foreground","opacity-0 transition-opacity group-hover:opacity-100","hover:bg-destructive/20 hover:text-status-failed","disabled:cursor-not-allowed disabled:opacity-40"),children:"🗑"})]})]}),y.jsx("code",{className:"block truncate rounded-md bg-secondary px-3 py-2 font-mono text-xs text-secondary-foreground",children:t.command}),y.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[y.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 capitalize",children:b}),t.notifyOn&&t.notifyOn!=="never"&&y.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5",children:["notify: ",t.notifyOn]}),y.jsx("span",{className:"ml-auto",children:"Click for history"})]})]})}const uz={name:"",command:"",cron:"",trigger:"cron",notifyOn:"failure",enabled:!0};function oz({onCreated:t,onCancel:l}){const[i,a]=k.useState(uz),[o,c]=k.useState(!1),[s,d]=k.useState(null),m=async g=>{if(g.preventDefault(),d(null),!i.name.trim()){d("Name is required.");return}if(!i.command.trim()){d("Command is required.");return}if(!i.cron.trim()){d("Cron expression is required.");return}c(!0);try{const v=await lt("/api/schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});t(v.schedule,v.syncNote)}catch(v){d(v instanceof Error?v.message:"Failed to create schedule.")}finally{c(!1)}},p=(g,v)=>y.jsxs("div",{className:"flex flex-col gap-1",children:[y.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:g}),v]}),b=se("h-8 rounded-md border border-border bg-card px-3 text-sm","placeholder:text-muted-foreground/50","focus:outline-none focus:ring-2 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50");return y.jsxs("form",{onSubmit:g=>{m(g)},className:"flex flex-col gap-4 rounded-xl border border-brand/40 bg-card p-4",children:[y.jsx("p",{className:"text-sm font-semibold",children:"New Schedule"}),y.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[p("Name *",y.jsx("input",{type:"text",className:b,placeholder:"e.g. Nightly cleanup",value:i.name,onChange:g=>a(v=>({...v,name:g.target.value})),required:!0,disabled:o})),p("Cron expression *",y.jsx("input",{type:"text",className:se(b,"font-mono"),placeholder:"0 2 * * *",value:i.cron,onChange:g=>a(v=>({...v,cron:g.target.value})),required:!0,disabled:o}))]}),p("Command *",y.jsx("input",{type:"text",className:se(b,"font-mono"),placeholder:"/my-skill --auto",value:i.command,onChange:g=>a(v=>({...v,command:g.target.value})),required:!0,disabled:o})),y.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[p("Trigger",y.jsxs("select",{className:b,value:i.trigger,onChange:g=>a(v=>({...v,trigger:g.target.value})),disabled:o,children:[y.jsx("option",{value:"cron",children:"cron"}),y.jsx("option",{value:"sessionstart",children:"session start"}),y.jsx("option",{value:"both",children:"both"})]})),p("Notify on",y.jsxs("select",{className:b,value:i.notifyOn,onChange:g=>a(v=>({...v,notifyOn:g.target.value})),disabled:o,children:[y.jsx("option",{value:"failure",children:"failure"}),y.jsx("option",{value:"always",children:"always"}),y.jsx("option",{value:"never",children:"never"})]})),y.jsxs("div",{className:"flex flex-col gap-1",children:[y.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Enabled"}),y.jsx("div",{className:"flex h-8 items-center",children:y.jsx(lv,{checked:i.enabled,onChange:()=>a(g=>({...g,enabled:!g.enabled})),disabled:o})})]})]}),s&&y.jsx("p",{className:"rounded-md border border-status-failed/30 bg-status-failed/10 px-3 py-2 text-xs text-status-failed",children:s}),y.jsxs("div",{className:"flex items-center justify-end gap-2",children:[y.jsx("button",{type:"button",onClick:l,disabled:o,className:se("h-8 rounded-md px-3 text-sm text-muted-foreground","hover:bg-accent hover:text-foreground","disabled:cursor-not-allowed disabled:opacity-50"),children:"Cancel"}),y.jsx("button",{type:"submit",disabled:o,className:se("h-8 rounded-md bg-brand px-4 text-sm font-medium text-white","hover:bg-brand/90","disabled:cursor-not-allowed disabled:opacity-50"),children:o?"Creating…":"Create"})]})]})}function sz(){const[t,l]=k.useState([]),[i,a]=k.useState(null),[o,c]=k.useState(!0),[s,d]=k.useState(null),[m,p]=k.useState(null),[b,g]=k.useState(!1),[v,S]=k.useState(null);k.useEffect(()=>{let N=!1;return c(!0),d(null),Promise.all([lt("/api/schedules"),lt("/api/daemon/status")]).then(([R,L])=>{N||(l(R.schedules),a(L))}).catch(R=>{N||d(R instanceof Error?R.message:"Failed to load schedules")}).finally(()=>{N||c(!1)}),()=>{N=!0}},[]);const E=k.useCallback(async N=>{const R=await lt(`/api/schedules/${N}/toggle`,{method:"POST"});l(L=>L.map(W=>W.id===N?{...W,enabled:R.enabled}:W)),R.syncNote&&(S(R.syncNote),setTimeout(()=>S(null),8e3))},[]),A=k.useCallback(async N=>{await lt(`/api/schedules/${N}`,{method:"DELETE"}),l(R=>R.filter(L=>L.id!==N))},[]),j=k.useCallback((N,R)=>{l(L=>[...L,N]),g(!1),R&&(S(R),setTimeout(()=>S(null),8e3))},[]);return o?y.jsx("div",{className:"flex flex-1 items-center justify-center",children:y.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading schedules…"})}):y.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-4",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("h1",{className:"text-base font-semibold",children:"Schedules"}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx(iz,{status:i}),y.jsx("button",{onClick:()=>g(N=>!N),className:se("h-7 rounded-md px-3 text-xs font-medium",b?"bg-muted text-muted-foreground hover:bg-muted/80":"bg-brand text-white hover:bg-brand/90"),children:b?"Cancel":"+ New Schedule"})]})]}),b&&y.jsx(oz,{onCreated:j,onCancel:()=>g(!1)}),v&&y.jsx("p",{className:"rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-4 py-3 text-sm text-yellow-700 dark:text-yellow-400",children:v}),s&&y.jsx("p",{className:"rounded-lg border border-status-failed/30 bg-status-failed/10 px-4 py-3 text-sm text-status-failed",children:s}),!s&&t.length===0&&!b&&y.jsx("p",{className:"mt-8 text-center text-sm text-muted-foreground",children:"No schedules configured."}),y.jsx("div",{className:"grid gap-3",children:t.map(N=>y.jsx(az,{schedule:N,onToggle:E,onDelete:A,onShowHistory:p},N.id))}),m&&y.jsx(rz,{schedule:m,onClose:()=>p(null)})]})}function cz(t,l){const i=(l??Date.now())-t;if(i<1e3)return`${i}ms`;const a=Math.floor(i/1e3);if(a<60)return`${a}s`;const o=Math.floor(a/60);return o<60?`${o}m ${a%60}s`:`${Math.floor(o/60)}h ${o%60}m`}function fz(t){const l=Math.floor((Date.now()-t)/1e3);if(l<60)return`${l}s ago`;const i=Math.floor(l/60);if(i<60)return`${i}m ago`;const a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function dz(t){const l=t.lastIndexOf("/");return l!==-1?t.slice(l+1):t}const hz={running:"bg-green-500/20 text-green-400 border border-green-500/30",completed:"bg-blue-500/20 text-blue-400 border border-blue-500/30",failed:"bg-red-500/20 text-red-400 border border-red-500/30",cancelled:"bg-neutral-500/20 text-neutral-400 border border-neutral-500/30"};function fo(t){return t.status!=="running"}function mz({status:t}){return y.jsxs("span",{className:se("inline-flex items-center gap-1.5 rounded px-1.5 py-0.5 text-xs font-medium",hz[t]),children:[t==="running"&&y.jsx("span",{className:"size-1.5 rounded-full bg-green-400 animate-pulse"}),t]})}function ob({job:t,now:l,onCancel:i}){const[a,o]=k.useState(!1),[c,s]=k.useState(!1),[d,m]=k.useState(null),p=cz(t.startedAt,t.status==="running"?l:t.endedAt),b=fz(t.startedAt),g=a?dd:Eo,v=async S=>{S.stopPropagation(),m(null),s(!0);try{await i(t.jobId)}catch(E){m(E instanceof Error?E.message:String(E))}finally{s(!1)}};return y.jsxs("div",{className:"rounded-lg border border-neutral-800 bg-neutral-900 overflow-hidden",children:[y.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),o(E=>!E))},className:"w-full text-left px-4 py-3 flex flex-col gap-2 hover:bg-neutral-800/50 transition-colors cursor-pointer",children:[y.jsxs("div",{className:"flex items-start justify-between gap-2",children:[y.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[y.jsx(g,{className:"size-3.5 shrink-0 text-neutral-500"}),y.jsx("span",{className:"text-sm font-medium text-neutral-100 truncate",children:t.label||t.jobId})]}),y.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[y.jsx(mz,{status:t.status}),t.status==="running"&&y.jsxs("button",{type:"button",onClick:v,disabled:c,"aria-label":`Cancel job ${t.jobId}`,className:se("flex items-center gap-1 rounded px-1.5 py-0.5 text-xs","text-neutral-500 hover:text-red-400 hover:bg-red-500/10","disabled:opacity-40 transition-colors"),children:[y.jsx(hd,{className:"size-3"}),c?"Cancelling…":"Cancel"]})]})]}),y.jsxs("div",{className:"flex items-center gap-3 text-xs text-neutral-500 pl-5",children:[y.jsx("span",{className:"font-mono bg-neutral-800 rounded px-1.5 py-0.5 text-neutral-300",children:dz(t.model)}),y.jsx("span",{children:p}),y.jsx("span",{children:b})]}),(t.status==="failed"||t.status==="cancelled")&&t.stopReason&&y.jsxs("div",{className:"pl-5 text-xs text-neutral-500",children:[y.jsx("span",{className:"text-neutral-600",children:"reason:"})," ",y.jsx("span",{className:"font-mono text-neutral-400 line-clamp-2",title:t.stopReason,children:t.stopReason})]}),d&&y.jsx("p",{className:"pl-5 text-xs text-red-400",title:d,children:d.length>200?d.slice(0,200)+"…":d})]}),a&&y.jsxs("div",{className:"border-t border-neutral-800 px-4 py-3 bg-neutral-950 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-xs",children:[y.jsx(vn,{label:"Job ID",value:t.jobId,mono:!0}),y.jsx(vn,{label:"Subagent ID",value:t.subagentId,mono:!0}),y.jsx(vn,{label:"Model",value:t.model,mono:!0}),y.jsx(vn,{label:"Status",value:t.status}),y.jsx(vn,{label:"Started",value:new Date(t.startedAt).toLocaleString()}),t.endedAt!==void 0&&y.jsx(vn,{label:"Ended",value:new Date(t.endedAt).toLocaleString()}),y.jsx(vn,{label:"Duration",value:p}),t.parentSessionId&&y.jsx(vn,{label:"Parent session",value:t.parentSessionId,mono:!0}),t.stopReason&&y.jsx(vn,{label:"Stop reason",value:t.stopReason.length>200?t.stopReason.slice(0,200)+"…":t.stopReason,mono:!0}),y.jsx(vn,{label:"Prompt hash",value:t.promptHash,mono:!0}),y.jsx(vn,{label:"Schema version",value:String(t.schemaVersion)})]})]})}function vn({label:t,value:l,mono:i=!1}){return y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-neutral-600 whitespace-nowrap",children:t}),y.jsx("span",{className:se("text-neutral-300 break-all",i&&"font-mono"),children:l})]})}function sb({label:t,count:l}){return y.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-neutral-500 uppercase tracking-wider",children:[y.jsx("span",{children:t}),y.jsx("span",{className:"rounded-full bg-neutral-800 px-1.5 py-0.5 text-neutral-400 normal-case",children:l})]})}function pz(){const[t,l]=k.useState([]),[i,a]=k.useState(!0),[o,c]=k.useState(null),[s,d]=k.useState(()=>Date.now()),m=k.useRef(null),p=k.useCallback((E=!1)=>{E||a(!0),c(null),lt("/api/bg-jobs").then(({jobs:A})=>l([...A].sort((j,N)=>N.startedAt-j.startedAt))).catch(A=>c(A instanceof Error?A.message:String(A))).finally(()=>{E||a(!1)})},[]);k.useEffect(()=>{p()},[p]),k.useEffect(()=>{const E=t.some(A=>!fo(A));return E&&!m.current&&(m.current=setInterval(()=>p(!0),5e3)),!E&&m.current&&(clearInterval(m.current),m.current=null),()=>{m.current&&(clearInterval(m.current),m.current=null)}},[t,p]),k.useEffect(()=>{if(!t.some(j=>!fo(j)))return;const A=setInterval(()=>d(Date.now()),1e3);return()=>clearInterval(A)},[t]);const b=k.useCallback(async E=>{await lt(`/api/bg-jobs/${encodeURIComponent(E)}/cancel`,{method:"POST"}),l(A=>A.map(j=>j.jobId===E?{...j,status:"cancelled"}:j))},[]),g=t.filter(E=>E.status==="running"),v=t.filter(E=>fo(E)),S=t.some(E=>!fo(E));return y.jsxs("div",{className:"flex flex-col gap-4",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-neutral-200",children:[y.jsx(pb,{className:"size-4 text-neutral-400"}),"Background Jobs",S&&y.jsx("span",{className:"text-xs font-normal text-neutral-500",children:"(auto-refreshing)"})]}),y.jsxs("button",{onClick:()=>p(),disabled:i,className:"flex items-center gap-1.5 rounded px-2 py-1 text-xs text-neutral-400 hover:text-neutral-200 hover:bg-neutral-800 disabled:opacity-50 transition-colors",children:[y.jsx(rk,{className:se("size-3",i&&"animate-spin")}),"Refresh"]})]}),o&&y.jsx("p",{className:"rounded border border-red-900/40 bg-red-950/30 px-3 py-2 text-xs text-red-400",children:o}),!i&&t.length===0&&!o&&y.jsx("p",{className:"text-sm text-neutral-500 text-center py-8",children:"No background jobs"}),g.length>0&&y.jsxs("div",{className:"flex flex-col gap-2",children:[y.jsx(sb,{label:"Running",count:g.length}),g.map(E=>y.jsx(ob,{job:E,now:s,onCancel:b},E.jobId))]}),v.length>0&&y.jsxs("div",{className:"flex flex-col gap-2",children:[y.jsx(sb,{label:"Settled",count:v.length}),v.map(E=>y.jsx(ob,{job:E,now:s,onCancel:b},E.jobId))]})]})}function ya({icon:t,title:l,children:i}){return y.jsxs("section",{className:"space-y-3",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(t,{className:"size-4 text-muted-foreground"}),y.jsx("h2",{className:"text-sm font-semibold",children:l})]}),y.jsx("div",{className:"rounded-xl border border-border bg-card",children:i})]})}function Vt({label:t,value:l,mono:i=!1,last:a=!1}){return y.jsxs("div",{className:se("flex items-center justify-between gap-4 px-4 py-2.5",!a&&"border-b border-border"),children:[y.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:t}),y.jsx("span",{className:se("min-w-0 truncate text-right text-xs",i?"font-mono text-zinc-300":"text-zinc-200"),children:l})]})}function gz({model:t,last:l}){return y.jsxs("div",{className:se("flex items-center justify-between gap-4 px-4 py-2.5",!l&&"border-b border-border"),children:[y.jsx("span",{className:"text-xs text-zinc-200",children:t.label}),y.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:t.id})]})}const cb=[{keys:"⌘K",description:"Open command palette"},{keys:"⌘1",description:"Go to Sessions"},{keys:"⌘2",description:"Go to Memory"},{keys:"⌘3",description:"Go to Schedules"},{keys:"⌘4",description:"Go to Background Jobs"}];function yz({keys:t,description:l,last:i}){return y.jsxs("div",{className:se("flex items-center justify-between gap-4 px-4 py-2.5",!i&&"border-b border-border"),children:[y.jsx("span",{className:"text-xs text-zinc-200",children:l}),y.jsx("kbd",{className:"rounded border border-border bg-secondary px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:t})]})}function bz({status:t}){return t?y.jsxs("span",{className:"flex items-center gap-1.5",children:[y.jsx("span",{className:se("size-1.5 rounded-full",t.running?"animate-pulse bg-status-done":"bg-status-failed")}),y.jsx("span",{className:se("text-xs",t.running?"text-zinc-200":"text-muted-foreground"),children:t.running?`Running${t.tasks!=null?` · ${t.tasks} task${t.tasks!==1?"s":""}`:""}`:"Stopped"})]}):y.jsx("span",{className:"text-xs text-muted-foreground",children:"–"})}function xz(){var o;const[t,l]=k.useState({config:null,models:null,daemon:null,configError:null,modelsError:null,daemonError:null});k.useEffect(()=>{let c=!1;const s=d=>d instanceof Error?d.message:"Failed to load";return Promise.all([lt("/api/config").then(d=>({ok:!0,config:d}),d=>({ok:!1,error:s(d)})),lt("/api/models").then(d=>({ok:!0,models:d.models}),d=>({ok:!1,error:s(d)})),lt("/api/daemon/status").then(d=>({ok:!0,daemon:d}),d=>({ok:!1,error:s(d)}))]).then(([d,m,p])=>{c||l({config:d.ok?d.config:null,configError:d.ok?null:d.error,models:m.ok?m.models:null,modelsError:m.ok?null:m.error,daemon:p.ok?p.daemon:null,daemonError:p.ok?null:p.error})}).catch(()=>{}),()=>{c=!0}},[]);const i=t.config,a=y.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"});return y.jsxs("div",{className:"flex flex-1 flex-col gap-6 overflow-y-auto p-4",children:[y.jsxs(ya,{icon:bb,title:"About",children:[y.jsx(Vt,{label:"AFK version",value:i?i.version:a,mono:!0}),y.jsx(Vt,{label:"Node.js",value:i?i.nodeVersion:a,mono:!0}),y.jsx(Vt,{label:"App",value:"AFK Dashboard",last:!0})]}),y.jsxs(ya,{icon:YS,title:"Model",children:[y.jsx(Vt,{label:"Default model",value:i?i.model:a,mono:!0}),t.modelsError?y.jsx("div",{className:"px-4 py-3 text-xs text-status-failed",children:t.modelsError}):t.models===null?y.jsx(Vt,{label:"Available tiers",value:a,last:!0}):t.models.length===0?y.jsx(Vt,{label:"Available tiers",value:"None listed",last:!0}):t.models.map((c,s)=>{var d;return y.jsx(gz,{model:c,last:s===(((d=t.models)==null?void 0:d.length)??0)-1},c.id)})]}),y.jsxs(ya,{icon:FS,title:"Paths",children:[y.jsx(Vt,{label:"AFK home",value:i?i.afkHome:a,mono:!0}),y.jsx(Vt,{label:"State dir",value:i?i.stateDir:a,mono:!0}),y.jsx(Vt,{label:"Config dir",value:i?i.configDir:a,mono:!0,last:!0})]}),y.jsxs(ya,{icon:oi,title:"Web Server",children:[y.jsx(Vt,{label:"Host",value:i?i.webHost:a,mono:!0}),y.jsx(Vt,{label:"Port",value:i?String(i.webPort):a,mono:!0}),y.jsx(Vt,{label:"Daemon",value:y.jsx(bz,{status:t.daemon})}),!t.daemonError&&y.jsx(Vt,{label:"Tasks scheduled",value:((o=t.daemon)==null?void 0:o.tasks)!=null?String(t.daemon.tasks):"–",last:!0}),t.daemonError&&y.jsx(Vt,{label:"Daemon error",value:t.daemonError,last:!0})]}),y.jsx(ya,{icon:XS,title:"Keyboard Shortcuts",children:cb.map((c,s)=>y.jsx(yz,{keys:c.keys,description:c.description,last:s===cb.length-1},c.keys))})]})}function ad(t){return t.startsWith("/")?t.slice(1):t}function rv(t){return`/${ad(t)}`}function iv(t,l){return ad(t).startsWith(ad(l))}function vz({query:t,commands:l,onSelect:i,visible:a}){const[o,c]=k.useState(0),s=k.useRef(null),d=l.filter(m=>iv(m.name,t)).slice(0,8);return k.useEffect(()=>{c(0)},[t]),k.useEffect(()=>{var p;const m=(p=s.current)==null?void 0:p.children[o];m==null||m.scrollIntoView({block:"nearest"})},[o]),!a||d.length===0?null:y.jsx("ul",{ref:s,role:"listbox","aria-label":"Slash commands",className:se("absolute bottom-full left-0 mb-1 w-full max-h-56 overflow-y-auto","rounded-lg border border-border bg-popover shadow-lg z-50","text-sm"),children:d.map((m,p)=>y.jsxs("li",{role:"option","aria-selected":p===o,className:se("flex items-baseline gap-2 px-3 py-2 cursor-pointer select-none",p===o?"bg-accent text-accent-foreground":"hover:bg-accent/50"),onMouseEnter:()=>c(p),onMouseDown:b=>{b.preventDefault(),i(m.name)},children:[y.jsx("span",{className:"font-mono font-semibold shrink-0",children:rv(m.name)}),y.jsx("span",{className:"text-muted-foreground truncate",children:m.summary})]},m.name))})}function Sz(t,l,i,a,o,c,s){return!l||i===0?!1:t.key==="ArrowDown"?(o((a+1)%i),!0):t.key==="ArrowUp"?(o((a-1+i)%i),!0):t.key==="Enter"?(c(a),!0):t.key==="Escape"?(s(),!0):!1}function kz(t){const l=t.trim();return l?l.startsWith("/")||l.startsWith("./")||l.startsWith("~/")||/^[\w.]/.test(l):!1}function wz({onInsert:t}){const[l,i]=k.useState(!1),[a,o]=k.useState(""),[c,s]=k.useState(!1),d=k.useRef(null),m=k.useRef(null),p=k.useRef(null),b=k.useCallback(()=>{i(!1),s(!1),o("")},[]),g=k.useCallback(()=>{var S;const v=a.trim();if(!kz(v)){s(!0),(S=d.current)==null||S.focus();return}t(`@${v}`),b()},[a,t,b]);return k.useEffect(()=>{l&&requestAnimationFrame(()=>{var v;return(v=d.current)==null?void 0:v.focus()})},[l]),k.useEffect(()=>{if(!l)return;function v(S){const E=S.target;m.current&&!m.current.contains(E)&&p.current&&!p.current.contains(E)&&b()}return document.addEventListener("click",v,{capture:!0}),()=>document.removeEventListener("click",v,{capture:!0})},[l,b]),y.jsxs("div",{className:"relative",children:[y.jsx("button",{ref:p,type:"button",onClick:()=>l?b():i(!0),"aria-label":"Insert file reference","aria-expanded":l,className:se("flex h-8 w-8 items-center justify-center rounded-md text-sm","transition-colors hover:bg-accent hover:text-accent-foreground",l&&"bg-accent text-accent-foreground"),title:"Insert @file reference",children:y.jsx(GS,{className:"h-4 w-4"})}),l&&y.jsxs("div",{ref:m,role:"dialog","aria-label":"Insert file path",className:se("absolute bottom-full left-0 mb-2 w-72 rounded-lg border","bg-popover p-3 shadow-lg animate-fade-in"),children:[y.jsxs("p",{className:"mb-2 text-xs text-muted-foreground",children:["Type a file path. ",y.jsx("code",{className:"text-[10px]",children:"@~/file.ts"})," or"," ",y.jsx("code",{className:"text-[10px]",children:"@src/file.ts"})]}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("input",{ref:d,type:"text",value:a,onChange:v=>{o(v.target.value),s(!1)},onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),g()),v.key==="Escape"&&b()},placeholder:"src/foo.ts or ~/file.ts",autoComplete:"off",spellCheck:!1,className:se("flex-1 rounded-md border bg-secondary px-2 py-1 text-sm","placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",c&&"border-destructive")}),y.jsx("button",{type:"button",onClick:g,className:se("rounded-md bg-primary px-3 py-1 text-sm font-medium","text-primary-foreground hover:bg-primary/90"),children:"Add"})]}),c&&y.jsx("p",{className:"mt-1 text-xs text-destructive",children:"Enter a valid file path."})]})]})}const Ez=[{id:"sonnet",label:"Sonnet"},{id:"haiku",label:"Haiku"},{id:"opus",label:"Opus"}],Cz="sonnet";function Tz({onSelect:t,current:l,className:i}){const[a,o]=k.useState(Ez),c=k.useRef(!1);k.useEffect(()=>{let m=!1;return lt("/api/models").then(p=>{!m&&p.models.length>0&&o(p.models)}).catch(()=>{}),()=>{m=!0}},[]);const s=l??Cz;k.useEffect(()=>{c.current||(c.current=!0,t(s))},[t,s]);const d=k.useCallback(m=>{t(m.target.value)},[t]);return y.jsxs("div",{className:se("relative inline-flex items-center",i),children:[y.jsx("select",{value:s,onChange:d,"aria-label":"Model",className:se("appearance-none rounded-md border bg-secondary pl-2 pr-7 py-1","text-xs font-medium text-secondary-foreground","cursor-pointer focus:outline-none focus:ring-1 focus:ring-ring"),children:a.map(m=>y.jsx("option",{value:m.id,children:m.label},m.id))}),y.jsx(dd,{className:"pointer-events-none absolute right-1.5 h-3 w-3 text-muted-foreground"})]})}function Az({queue:t}){const{entries:l,moveItemUp:i,moveItemDown:a,removeItem:o,editItem:c}=t;return l.length===0?null:y.jsxs("div",{className:"flex flex-col gap-1 border-b border-border/50 px-3 py-2",children:[y.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:["Queued (",l.length,")"]}),l.map((s,d)=>y.jsx(Nz,{text:s.text,isFirst:d===0,isLast:d===l.length-1,onMoveUp:()=>i(d),onMoveDown:()=>a(d),onRemove:()=>o(d),onEdit:m=>c(d,m)},s.id))]})}function Nz({text:t,isFirst:l,isLast:i,onMoveUp:a,onMoveDown:o,onRemove:c,onEdit:s}){const[d,m]=k.useState(!1),[p,b]=k.useState(t),g=k.useRef(null);k.useEffect(()=>{var A;d&&((A=g.current)==null||A.focus())},[d]);const v=k.useCallback(()=>{b(t),m(!0)},[t]),S=k.useCallback(()=>{const A=p.trim();A&&A!==t&&s(A),m(!1)},[p,t,s]),E=k.useCallback(()=>{m(!1),b(t)},[t]);return y.jsxs("div",{className:se("group flex items-center gap-1.5 rounded-md border border-border/50","bg-secondary/50 px-2 py-1 text-sm animate-fade-in"),children:[d?y.jsx("input",{ref:g,type:"text",value:p,onChange:A=>b(A.target.value),onKeyDown:A=>{A.key==="Enter"&&S(),A.key==="Escape"&&E()},onBlur:S,className:se("min-w-0 flex-1 bg-transparent text-sm","focus:outline-none")}):y.jsx("span",{className:"min-w-0 flex-1 truncate text-foreground/80",children:t}),y.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-60 group-hover:opacity-100",children:[d?y.jsx(ba,{label:"Confirm edit",onClick:S,children:y.jsx(fd,{className:"h-3 w-3"})}):y.jsx(ba,{label:"Edit",onClick:v,children:y.jsx(ek,{className:"h-3 w-3"})}),y.jsx(ba,{label:"Move up",onClick:a,disabled:l,children:y.jsx(RS,{className:"h-3 w-3"})}),y.jsx(ba,{label:"Move down",onClick:o,disabled:i,children:y.jsx(mb,{className:"h-3 w-3"})}),y.jsx(ba,{label:"Remove",onClick:c,destructive:!0,children:y.jsx(hd,{className:"h-3 w-3"})})]})]})}function ba({label:t,onClick:l,disabled:i,destructive:a,children:o}){return y.jsx("button",{type:"button",onClick:l,disabled:i,"aria-label":t,title:t,className:se("flex h-5 w-5 items-center justify-center rounded","transition-colors",i?"cursor-not-allowed opacity-30":a?"hover:bg-destructive/20 hover:text-destructive":"hover:bg-accent hover:text-accent-foreground"),children:o})}let va=null;function jz(){va=null}async function zz(){return va||(va=(await lt("/api/commands")).commands,va)}function Mz(t){return t.startsWith("/")&&t.indexOf(" ")===-1?t.slice(1):null}function _z({sessionId:t,sessionMode:l,isBusy:i,queue:a,onModelSelect:o,currentModel:c}){const[s,d]=k.useState(""),[m,p]=k.useState(!1),[b,g]=k.useState([]),[v,S]=k.useState(0),E=k.useRef(null),A=l==="readonly",j=Mz(s),N=j!==null&&b.length>0,R=N?b.filter(V=>iv(V.name,j)).slice(0,8):[];k.useEffect(()=>{const V=()=>{document.visibilityState==="visible"&&jz()};return document.addEventListener("visibilitychange",V),()=>document.removeEventListener("visibilitychange",V)},[]),k.useEffect(()=>{const V=E.current;if(!V)return;V.style.height="auto";const H=(parseInt(getComputedStyle(V).lineHeight)||20)*5;V.style.height=`${Math.min(V.scrollHeight,H)}px`},[s]),k.useEffect(()=>{j!==null&&zz().then(g).catch(()=>{})},[j]);const L=k.useCallback(async()=>{const V=s.trim();if(!(!V||m||A)){p(!0);try{await lt(`/api/sessions/${t}/prompt`,{method:"POST",body:JSON.stringify({text:V})}),d("")}catch{}finally{p(!1)}}},[s,m,A,t]),W=k.useCallback(async()=>{try{await lt(`/api/sessions/${t}/interrupt`,{method:"POST"})}catch{}},[t]),ee=k.useCallback(V=>{var ae;d(`${rv(V)} `),S(0),(ae=E.current)==null||ae.focus()},[]),D=k.useCallback(V=>{if(Sz(V,N,R.length,v,S,H=>{const re=R[H];re&&ee(re.name)},()=>d(H=>H))){V.preventDefault();return}if(V.key==="Enter"&&!V.shiftKey)if(V.preventDefault(),i&&a){const H=s.trim();H&&(a.enqueue(H),d(""))}else L()},[N,R,v,ee,L,i,s,a]),X=k.useCallback(V=>{const ae=E.current;if(!ae){d(B=>B+" "+V+" ");return}const H=ae.selectionStart??ae.value.length,re=ae.selectionEnd??H,P=ae.value.slice(0,H),be=ae.value.slice(re),ue=P.length>0&&!/\s$/.test(P)?" ":"",ne=P+ue+V+" "+be;d(ne),requestAnimationFrame(()=>{const B=H+ue.length+V.length+1;ae.setSelectionRange(B,B),ae.focus()})},[]);return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"pointer-events-none h-8 bg-gradient-to-t from-background/80 to-transparent"}),y.jsxs("div",{className:se("relative flex flex-col gap-2","border-t border-border/50 px-4 py-3","backdrop-blur-xl bg-background/80","shadow-[0_-4px_16px_-4px_rgba(0,0,0,0.1)]",A&&"opacity-50"),children:[a&&y.jsx(Az,{queue:a}),y.jsx(vz,{query:j??"",commands:b,onSelect:ee,visible:N}),y.jsxs("div",{className:"flex items-end gap-2",children:[y.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[y.jsx(wz,{onInsert:X}),o&&y.jsx(Tz,{onSelect:o,current:c})]}),y.jsx("textarea",{ref:E,rows:1,value:s,disabled:A||m,onChange:V=>d(V.target.value),onKeyDown:D,placeholder:A?"Read-only session":"Send a message… (/ for commands)",className:se("flex-1 resize-none rounded-xl border border-input bg-background","px-3 py-2 text-sm leading-5 shadow-sm","placeholder:text-muted-foreground","focus:outline-none focus:ring-2 focus:ring-ring","disabled:cursor-not-allowed")}),i?y.jsx("button",{onClick:()=>void W(),title:"Stop",className:"shrink-0 flex items-center justify-center h-9 w-9 rounded-lg bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors",children:y.jsx(vb,{className:"h-4 w-4 fill-current"})}):y.jsx("button",{onClick:()=>void L(),disabled:!s.trim()||m||A,title:"Send",className:se("shrink-0 flex items-center justify-center h-9 w-9 rounded-lg","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors","disabled:opacity-40 disabled:cursor-not-allowed"),children:y.jsx(ik,{className:"h-4 w-4"})})]})]})]})}async function Dz(t){await lt("/api/approve",{method:"POST",body:JSON.stringify(t)})}function Oz({approval:t,onAnswered:l}){const{id:i,request:a}=t,[o,c]=k.useState(typeof a.questionDefault=="string"?a.questionDefault:""),[s,d]=k.useState(!1),[m,p]=k.useState(null),b=async(v,S)=>{d(!0),p(null);try{await Dz({requestId:i,response:{action:v,content:S}}),l()}catch{p("Failed to submit — try again")}finally{d(!1)}},g=a.type??"confirm";return y.jsxs("div",{className:se("rounded-lg border-2 border-yellow-500/60 bg-yellow-500/5 p-3 text-sm","flex flex-col gap-2"),children:[y.jsxs("div",{className:"flex items-start gap-2",children:[y.jsx(uk,{className:"h-4 w-4 text-yellow-500 mt-0.5 shrink-0"}),y.jsxs("div",{className:"flex-1 min-w-0",children:[a.title&&y.jsx("p",{className:"font-semibold text-foreground",children:a.title}),a.message&&y.jsx("p",{className:"text-muted-foreground",children:a.message}),a.description&&y.jsx("p",{className:"text-muted-foreground/80 text-xs mt-0.5",children:a.description})]}),y.jsx("button",{onClick:()=>void b("decline"),disabled:s,className:"shrink-0 text-muted-foreground hover:text-foreground",title:"Dismiss",children:y.jsx(hd,{className:"h-4 w-4"})})]}),g==="text"&&y.jsxs("div",{className:"flex gap-2",children:[y.jsx("input",{type:"text",value:o,onChange:v=>c(v.target.value),disabled:s,className:se("flex-1 rounded border border-input bg-background px-2 py-1 text-sm","focus:outline-none focus:ring-1 focus:ring-ring")}),y.jsx(ho,{onClick:()=>void b("accept",{text:o}),disabled:s,label:"Submit",variant:"primary"})]}),g==="confirm"&&y.jsxs("div",{className:"flex gap-2 justify-end",children:[y.jsx(ho,{onClick:()=>void b("decline"),disabled:s,label:"No",variant:"ghost"}),y.jsx(ho,{onClick:()=>void b("accept"),disabled:s,label:"Yes",variant:"primary"})]}),(g==="choice"||g==="multi_choice")&&y.jsx("div",{className:"flex flex-wrap gap-1.5",children:(a.choices??[]).map(v=>y.jsx(ho,{onClick:()=>void b("accept",{choice:v}),disabled:s,label:v,variant:"outline"},v))}),m&&y.jsx("p",{className:"text-xs text-red-400",children:m})]})}function ho({onClick:t,disabled:l,label:i,variant:a}){return y.jsx("button",{onClick:t,disabled:l,className:se("rounded px-3 py-1 text-xs font-medium transition-colors disabled:opacity-50",a==="primary"&&"bg-primary text-primary-foreground hover:bg-primary/90",a==="ghost"&&"text-muted-foreground hover:text-foreground hover:bg-accent",a==="outline"&&"border border-border hover:bg-accent"),children:i})}function Rz({approvals:t,onDismiss:l}){const[i,a]=k.useState(new Set),o=t.filter(s=>!i.has(s.id));if(o.length===0)return null;const c=s=>{a(d=>new Set([...d,s])),l==null||l()};return y.jsx("div",{className:"flex flex-col gap-2",children:o.map(s=>y.jsx(Oz,{approval:s,onAnswered:()=>c(s.id)},s.id))})}function Lz({open:t,onClose:l,children:i}){return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:se("fixed inset-0 z-40 bg-black/50 transition-opacity duration-200 md:hidden",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:l,"aria-hidden":"true"}),y.jsx("div",{className:se("fixed inset-y-0 left-0 z-50 w-64 bg-sidebar transition-transform duration-200 ease-in-out md:hidden",t?"translate-x-0":"-translate-x-full"),role:"dialog","aria-modal":"true",children:i})]})}function Uz({onClick:t,className:l}){return y.jsx("button",{onClick:t,className:se("inline-flex items-center justify-center rounded-md p-2 text-muted-foreground hover:bg-muted hover:text-foreground md:hidden",l),"aria-label":"Open sidebar",children:y.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}const Bz=k.createContext(null),Hz={success:"bg-green-600 text-white",error:"bg-red-600 text-white",info:"bg-muted text-muted-foreground border border-border"};function qz({children:t}){const[l,i]=k.useState([]),a=k.useRef(0),o=k.useCallback((c,s="info")=>{const d=++a.current;i(m=>[...m.slice(-2),{id:d,message:c,type:s}]),setTimeout(()=>{i(m=>m.filter(p=>p.id!==d))},3e3)},[]);return y.jsxs(Bz.Provider,{value:{toast:o},children:[t,y.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 pointer-events-none","aria-live":"polite","aria-label":"Notifications",children:l.map(c=>y.jsx("div",{className:se("pointer-events-auto max-w-sm rounded-lg px-4 py-3 text-sm shadow-lg animate-slide-in-right",Hz[c.type]),children:c.message},c.id))})]})}const Iz=1e4;function Vz(){const[t,l]=k.useState([]),[i,a]=k.useState(!0),[o,c]=k.useState(null),s=k.useRef(void 0),d=k.useCallback(async()=>{try{const m=await lt("/api/sessions");l(Yz(m.sessions)),c(null)}catch(m){c(m instanceof Error?m.message:"Failed to fetch sessions")}finally{a(!1)}},[]);return k.useEffect(()=>(d(),s.current=setInterval(()=>void d(),Iz),()=>clearInterval(s.current)),[d]),{sessions:t,loading:i,error:o,refresh:d}}function Yz(t){return[...t].sort((l,i)=>{const a=fb(l)?1:0,o=fb(i)?1:0;if(a!==o)return o-a;const c=l.updatedAt?new Date(l.updatedAt).getTime():0;return(i.updatedAt?new Date(i.updatedAt).getTime():0)-c})}function fb(t){return t.mode==="live"||t.alive===!0}const Gz=1e3;function Fz(){const[t,l]=k.useState([]),i=k.useRef(void 0),a=k.useCallback(async()=>{try{const c=await lt("/api/pending");l(c.pending)}catch{}},[]);k.useEffect(()=>(a(),i.current=setInterval(()=>void a(),Gz),()=>clearInterval(i.current)),[a]);const o=new Set(t.map(c=>c.sessionId).filter(c=>!!c));return{approvals:t,pendingSessionIds:o}}const Xz=15e3,Qz=500;function Zz(t){const i=t.replace(/\r\n/g,`
376
376
  `).split(`