@clawos-dev/clawd 0.2.666 → 0.2.667
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs
CHANGED
|
@@ -74817,7 +74817,7 @@ function computeMethodAccess(args) {
|
|
|
74817
74817
|
}
|
|
74818
74818
|
|
|
74819
74819
|
// src/version.ts
|
|
74820
|
-
var version = "0.2.
|
|
74820
|
+
var version = "0.2.667".length > 0 ? "0.2.667" : "dev";
|
|
74821
74821
|
|
|
74822
74822
|
// src/cli-probe/probe.ts
|
|
74823
74823
|
var fs86 = __toESM(require("fs"), 1);
|
|
@@ -516,7 +516,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
516
516
|
`)},NW=0,la=[];function RW(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(NW++)[0],s=g.useState(O4)[0],o=g.useRef(e);g.useEffect(function(){o.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=ZU([e.lockRef.current],(e.shards||[]).map(sk),!0).filter(Boolean);return v.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,w){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var x=zd(v),_=n.current,b="deltaX"in v?v.deltaX:_[0]-x[0],S="deltaY"in v?v.deltaY:_[1]-x[1],C,k=v.target,T=Math.abs(b)>Math.abs(S)?"h":"v";if("touches"in v&&T==="h"&&k.type==="range")return!1;var I=window.getSelection(),j=I&&I.anchorNode,R=j?j===k||j.contains(k):!1;if(R)return!1;var D=rk(T,k);if(!D)return!0;if(D?C=T:(C=T==="v"?"h":"v",D=rk(T,k)),!D)return!1;if(!r.current&&"changedTouches"in v&&(b||S)&&(r.current=C),!C)return!0;var P=r.current||C;return EW(P,w,v,P==="h"?b:S)},[]),l=g.useCallback(function(v){var w=v;if(!(!la.length||la[la.length-1]!==s)){var x="deltaY"in w?ik(w):zd(w),_=t.current.filter(function(C){return C.name===w.type&&(C.target===w.target||w.target===C.shadowParent)&&IW(C.delta,x)})[0];if(_&&_.should){w.cancelable&&w.preventDefault();return}if(!_){var b=(o.current.shards||[]).map(sk).filter(Boolean).filter(function(C){return C.contains(w.target)}),S=b.length>0?a(w,b[0]):!o.current.noIsolation;S&&w.cancelable&&w.preventDefault()}}},[]),c=g.useCallback(function(v,w,x,_){var b={name:v,delta:w,target:x,should:_,shadowParent:PW(x)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(S){return S!==b})},1)},[]),u=g.useCallback(function(v){n.current=zd(v),r.current=void 0},[]),d=g.useCallback(function(v){c(v.type,ik(v),v.target,a(v,e.lockRef.current))},[]),f=g.useCallback(function(v){c(v.type,zd(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return la.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,aa),document.addEventListener("touchmove",l,aa),document.addEventListener("touchstart",u,aa),function(){la=la.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,aa),document.removeEventListener("touchmove",l,aa),document.removeEventListener("touchstart",u,aa)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(s,{styles:TW(i)}):null,p?g.createElement(yW,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function PW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const AW=oW(D4,RW);var Wy=g.forwardRef(function(e,t){return g.createElement(Wp,ci({},e,{ref:t,sideCar:AW}))});Wy.classNames=Wp.classNames;var Vv=["Enter"," "],MW=["ArrowDown","PageUp","Home"],F4=["ArrowUp","PageDown","End"],LW=[...MW,...F4],jW={ltr:[...Vv,"ArrowRight"],rtl:[...Vv,"ArrowLeft"]},DW={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Fu="Menu",[mu,OW,BW]=X5(Fu),[Go,H4]=Ko(Fu,[BW,Up,I4]),Hu=Up(),U4=I4(),[W4,Js]=Go(Fu),[zW,Uu]=Go(Fu),q4=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=Hu(t),[l,c]=g.useState(null),u=g.useRef(!1),d=_i(s),f=Z5(i);return g.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),h.jsx(Hy,{...a,children:h.jsx(W4,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:h.jsx(zW,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};q4.displayName=Fu;var $W="MenuAnchor",qy=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Hu(n);return h.jsx(S4,{...i,...r,ref:t})});qy.displayName=$W;var Vy="MenuPortal",[FW,V4]=Go(Vy,{forceMount:void 0}),K4=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Js(Vy,t);return h.jsx(FW,{scope:t,forceMount:n,children:h.jsx(ns,{present:n||s.open,children:h.jsx(Uy,{asChild:!0,container:i,children:r})})})};K4.displayName=Vy;var Tr="MenuContent",[HW,Ky]=Go(Tr),G4=g.forwardRef((e,t)=>{const n=V4(Tr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Js(Tr,e.__scopeMenu),o=Uu(Tr,e.__scopeMenu);return h.jsx(mu.Provider,{scope:e.__scopeMenu,children:h.jsx(ns,{present:r||s.open,children:h.jsx(mu.Slot,{scope:e.__scopeMenu,children:o.modal?h.jsx(UW,{...i,ref:t}):h.jsx(WW,{...i,ref:t})})})})}),UW=g.forwardRef((e,t)=>{const n=Js(Tr,e.__scopeMenu),r=g.useRef(null),i=Qt(t,r);return g.useEffect(()=>{const s=r.current;if(s)return M4(s)},[]),h.jsx(Gy,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Le(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),WW=g.forwardRef((e,t)=>{const n=Js(Tr,e.__scopeMenu);return h.jsx(Gy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),qW=fu("MenuContent.ScrollLock"),Gy=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...v}=e,w=Js(Tr,n),x=Uu(Tr,n),_=Hu(n),b=U4(n),S=OW(n),[C,k]=g.useState(null),T=g.useRef(null),I=Qt(t,T,w.onContentChange),j=g.useRef(0),R=g.useRef(""),D=g.useRef(0),P=g.useRef(null),A=g.useRef("right"),M=g.useRef(0),L=m?Wy:g.Fragment,$=m?{as:qW,allowPinchZoom:!0}:void 0,F=B=>{var me,Ie;const E=R.current+B,U=S().filter(ue=>!ue.disabled),q=document.activeElement,O=(me=U.find(ue=>ue.ref.current===q))==null?void 0:me.textValue,te=U.map(ue=>ue.textValue),se=rq(te,E,O),G=(Ie=U.find(ue=>ue.textValue===se))==null?void 0:Ie.ref.current;(function ue(Ae){R.current=Ae,window.clearTimeout(j.current),Ae!==""&&(j.current=window.setTimeout(()=>ue(""),1e3))})(E),G&&setTimeout(()=>G.focus())};g.useEffect(()=>()=>window.clearTimeout(j.current),[]),e4();const z=g.useCallback(B=>{var U,q;return A.current===((U=P.current)==null?void 0:U.side)&&sq(B,(q=P.current)==null?void 0:q.area)},[]);return h.jsx(HW,{scope:n,searchRef:R,onItemEnter:g.useCallback(B=>{z(B)&&B.preventDefault()},[z]),onItemLeave:g.useCallback(B=>{var E;z(B)||((E=T.current)==null||E.focus(),k(null))},[z]),onTriggerLeave:g.useCallback(B=>{z(B)&&B.preventDefault()},[z]),pointerGraceTimerRef:D,onPointerGraceIntentChange:g.useCallback(B=>{P.current=B},[]),children:h.jsx(L,{...$,children:h.jsx(My,{asChild:!0,trapped:i,onMountAutoFocus:Le(s,B=>{var E;B.preventDefault(),(E=T.current)==null||E.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:h.jsx(Bp,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:h.jsx(VU,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:k,onEntryFocus:Le(l,B=>{x.isUsingKeyboardRef.current||B.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(k4,{role:"menu","aria-orientation":"vertical","data-state":d3(w.open),"data-radix-menu-content":"",dir:x.dir,..._,...v,ref:I,style:{outline:"none",...v.style},onKeyDown:Le(v.onKeyDown,B=>{const U=B.target.closest("[data-radix-menu-content]")===B.currentTarget,q=B.ctrlKey||B.altKey||B.metaKey,O=B.key.length===1;U&&(B.key==="Tab"&&B.preventDefault(),!q&&O&&F(B.key));const te=T.current;if(B.target!==te||!LW.includes(B.key))return;B.preventDefault();const G=S().filter(me=>!me.disabled).map(me=>me.ref.current);F4.includes(B.key)&&G.reverse(),tq(G)}),onBlur:Le(e.onBlur,B=>{B.currentTarget.contains(B.target)||(window.clearTimeout(j.current),R.current="")}),onPointerMove:Le(e.onPointerMove,gu(B=>{const E=B.target,U=M.current!==B.clientX;if(B.currentTarget.contains(E)&&U){const q=B.clientX>M.current?"right":"left";A.current=q,M.current=B.clientX}}))})})})})})})});G4.displayName=Tr;var VW="MenuGroup",Yy=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{role:"group",...r,ref:t})});Yy.displayName=VW;var KW="MenuLabel",Y4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{...r,ref:t})});Y4.displayName=KW;var Mf="MenuItem",ok="menu.itemSelect",qp=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=g.useRef(null),o=Uu(Mf,e.__scopeMenu),a=Ky(Mf,e.__scopeMenu),l=Qt(t,s),c=g.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(ok,{bubbles:!0,cancelable:!0});d.addEventListener(ok,p=>r==null?void 0:r(p),{once:!0}),Y5(d,f),f.defaultPrevented?c.current=!1:o.onClose()}};return h.jsx(X4,{...i,ref:l,disabled:n,onClick:Le(e.onClick,u),onPointerDown:d=>{var f;(f=e.onPointerDown)==null||f.call(e,d),c.current=!0},onPointerUp:Le(e.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:Le(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||Vv.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});qp.displayName=Mf;var X4=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=Ky(Mf,n),a=U4(n),l=g.useRef(null),c=Qt(t,l),[u,d]=g.useState(!1),[f,p]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[s.children]),h.jsx(mu.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:h.jsx(KU,{asChild:!0,...a,focusable:!r,children:h.jsx(Mt.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:Le(e.onPointerMove,gu(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Le(e.onPointerLeave,gu(m=>o.onItemLeave(m))),onFocus:Le(e.onFocus,()=>d(!0)),onBlur:Le(e.onBlur,()=>d(!1))})})})}),GW="MenuCheckboxItem",Z4=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return h.jsx(n3,{scope:e.__scopeMenu,checked:n,children:h.jsx(qp,{role:"menuitemcheckbox","aria-checked":Lf(n)?"mixed":n,...i,ref:t,"data-state":Qy(n),onSelect:Le(i.onSelect,()=>r==null?void 0:r(Lf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Z4.displayName=GW;var Q4="MenuRadioGroup",[YW,XW]=Go(Q4,{value:void 0,onValueChange:()=>{}}),J4=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=_i(r);return h.jsx(YW,{scope:e.__scopeMenu,value:n,onValueChange:s,children:h.jsx(Yy,{...i,ref:t})})});J4.displayName=Q4;var e3="MenuRadioItem",t3=g.forwardRef((e,t)=>{const{value:n,...r}=e,i=XW(e3,e.__scopeMenu),s=n===i.value;return h.jsx(n3,{scope:e.__scopeMenu,checked:s,children:h.jsx(qp,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":Qy(s),onSelect:Le(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});t3.displayName=e3;var Xy="MenuItemIndicator",[n3,ZW]=Go(Xy,{checked:!1}),r3=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=ZW(Xy,n);return h.jsx(ns,{present:r||Lf(s.checked)||s.checked===!0,children:h.jsx(Mt.span,{...i,ref:t,"data-state":Qy(s.checked)})})});r3.displayName=Xy;var QW="MenuSeparator",i3=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});i3.displayName=QW;var JW="MenuArrow",s3=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Hu(n);return h.jsx(C4,{...i,...r,ref:t})});s3.displayName=JW;var Zy="MenuSub",[eq,o3]=Go(Zy),a3=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=Js(Zy,t),o=Hu(t),[a,l]=g.useState(null),[c,u]=g.useState(null),d=_i(i);return g.useEffect(()=>(s.open===!1&&d(!1),()=>d(!1)),[s.open,d]),h.jsx(Hy,{...o,children:h.jsx(W4,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:h.jsx(eq,{scope:t,contentId:Fi(),triggerId:Fi(),trigger:a,onTriggerChange:l,children:n})})})};a3.displayName=Zy;var mc="MenuSubTrigger",l3=g.forwardRef((e,t)=>{const n=Js(mc,e.__scopeMenu),r=Uu(mc,e.__scopeMenu),i=o3(mc,e.__scopeMenu),s=Ky(mc,e.__scopeMenu),o=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),h.jsx(qy,{asChild:!0,...c,children:h.jsx(X4,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":d3(n.open),...e,ref:Ou(t,i.onTriggerChange),onClick:d=>{var f;(f=e.onClick)==null||f.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Le(e.onPointerMove,gu(d=>{s.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Le(e.onPointerLeave,gu(d=>{var p,m;u();const f=(p=n.content)==null?void 0:p.getBoundingClientRect();if(f){const v=(m=n.content)==null?void 0:m.dataset.side,w=v==="right",x=w?-5:5,_=f[w?"left":"right"],b=f[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+x,y:d.clientY},{x:_,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:_,y:f.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Le(e.onKeyDown,d=>{var p;const f=s.searchRef.current!=="";e.disabled||f&&d.key===" "||jW[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});l3.displayName=mc;var c3="MenuSubContent",u3=g.forwardRef((e,t)=>{const n=V4(Tr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Js(Tr,e.__scopeMenu),o=Uu(Tr,e.__scopeMenu),a=o3(c3,e.__scopeMenu),l=g.useRef(null),c=Qt(t,l);return h.jsx(mu.Provider,{scope:e.__scopeMenu,children:h.jsx(ns,{present:r||s.open,children:h.jsx(mu.Slot,{scope:e.__scopeMenu,children:h.jsx(Gy,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;o.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Le(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Le(e.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Le(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),f=DW[o.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});u3.displayName=c3;function d3(e){return e?"open":"closed"}function Lf(e){return e==="indeterminate"}function Qy(e){return Lf(e)?"indeterminate":e?"checked":"unchecked"}function tq(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function nq(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function rq(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=nq(e,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function iq(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(i=!i)}return i}function sq(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return iq(n,t)}function gu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oq=q4,aq=qy,lq=K4,cq=G4,uq=Yy,dq=Y4,hq=qp,fq=Z4,pq=J4,mq=t3,gq=r3,vq=i3,xq=s3,yq=a3,_q=l3,bq=u3,Vp="DropdownMenu",[wq]=Ko(Vp,[H4]),Tn=H4(),[Sq,h3]=wq(Vp),f3=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=Tn(t),c=g.useRef(null),[u,d]=Bu({prop:i,defaultProp:s??!1,onChange:o,caller:Vp});return h.jsx(Sq,{scope:t,triggerId:Fi(),triggerRef:c,contentId:Fi(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:h.jsx(oq,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};f3.displayName=Vp;var p3="DropdownMenuTrigger",m3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,s=h3(p3,n),o=Tn(n);return h.jsx(aq,{asChild:!0,...o,children:h.jsx(Mt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:Ou(t,s.triggerRef),onPointerDown:Le(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Le(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});m3.displayName=p3;var kq="DropdownMenuPortal",g3=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Tn(t);return h.jsx(lq,{...r,...n})};g3.displayName=kq;var v3="DropdownMenuContent",x3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=h3(v3,n),s=Tn(n),o=g.useRef(!1);return h.jsx(cq,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:t,onCloseAutoFocus:Le(e.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Le(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!i.modal||u)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});x3.displayName=v3;var Cq="DropdownMenuGroup",Eq=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(uq,{...i,...r,ref:t})});Eq.displayName=Cq;var Iq="DropdownMenuLabel",y3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(dq,{...i,...r,ref:t})});y3.displayName=Iq;var Tq="DropdownMenuItem",_3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(hq,{...i,...r,ref:t})});_3.displayName=Tq;var Nq="DropdownMenuCheckboxItem",b3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(fq,{...i,...r,ref:t})});b3.displayName=Nq;var Rq="DropdownMenuRadioGroup",Pq=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(pq,{...i,...r,ref:t})});Pq.displayName=Rq;var Aq="DropdownMenuRadioItem",Mq=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(mq,{...i,...r,ref:t})});Mq.displayName=Aq;var Lq="DropdownMenuItemIndicator",w3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(gq,{...i,...r,ref:t})});w3.displayName=Lq;var jq="DropdownMenuSeparator",S3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(vq,{...i,...r,ref:t})});S3.displayName=jq;var Dq="DropdownMenuArrow",Oq=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(xq,{...i,...r,ref:t})});Oq.displayName=Dq;var Bq=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,o=Tn(t),[a,l]=Bu({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return h.jsx(yq,{...o,open:a,onOpenChange:l,children:n})},zq="DropdownMenuSubTrigger",k3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(_q,{...i,...r,ref:t})});k3.displayName=zq;var $q="DropdownMenuSubContent",C3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(bq,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});C3.displayName=$q;var Fq=f3,Hq=m3,E3=g3,I3=x3,T3=y3,N3=_3,R3=b3,Uq=w3,P3=S3,Wq=Bq,A3=k3,M3=C3;const L3=Fq,j3=Hq,Jy=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(E3,{children:h.jsx(I3,{ref:r,sideOffset:t,className:re("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...n})}));Jy.displayName=I3.displayName;const qq=Wq,D3=g.forwardRef(({className:e,...t},n)=>h.jsx(A3,{ref:n,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100 data-[state=open]:bg-bg-200","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));D3.displayName=A3.displayName;const O3=g.forwardRef(({className:e,...t},n)=>h.jsx(E3,{children:h.jsx(M3,{ref:n,className:re("z-50 min-w-[6rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...t})}));O3.displayName=M3.displayName;const mo=g.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(N3,{ref:r,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));mo.displayName=N3.displayName;const Vq=g.forwardRef(({className:e,children:t,checked:n,...r},i)=>h.jsxs(R3,{ref:i,checked:n,className:re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-7 pr-2 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Uq,{children:h.jsx(Du,{className:"h-3.5 w-3.5"})})}),t]}));Vq.displayName=R3.displayName;const e_=g.forwardRef(({className:e,...t},n)=>h.jsx(P3,{ref:n,className:re("-mx-1 my-1 h-px bg-border",e),...t}));e_.displayName=P3.displayName;const B3=g.forwardRef(({className:e,...t},n)=>h.jsx(T3,{ref:n,className:re("px-2 py-1.5 text-xs font-semibold text-text-400",e),...t}));B3.displayName=T3.displayName;function Kq({tool:e,className:t}){const n=$F(e);return h.jsx("span",{"data-testid":n?`session-icon-${e}`:"session-icon-default","aria-label":n?Py(e):"未知引擎",className:re("w-3.5 h-3.5 shrink-0 inline-flex items-center justify-center",Op(e),t),children:h.jsx(Dp,{tool:e,className:"w-full h-full"})})}function Gq({sessionId:e,hasUnread:t,running:n=!1,awaitingUser:r=!1,style:i}){return r?h.jsx(u$,{"data-testid":`awaiting-dot-${e}`,style:i,className:"w-3 h-3 text-warning shrink-0 animate-pulse",strokeWidth:2.25,"aria-label":"awaiting user"}):t?h.jsx("span",{"data-testid":`unread-dot-${e}`,style:i,className:"w-2 h-2 rounded-full bg-error shrink-0","aria-label":"unread"}):n?h.jsx("span",{"data-testid":`running-dot-${e}`,style:i,className:"w-2 h-2 rounded-full bg-success shrink-0 animate-pulse","aria-label":"running"}):null}function z3(e){return e.compositionActive||!!e.nativeIsComposing||e.keyCode===229}function $3(e){return e.key==="Enter"&&!e.shiftKey&&!z3(e)}function Wu(e,t){const n=g.useRef(!1),r=g.useCallback(()=>{n.current=!0},[]),i=g.useCallback(()=>{setTimeout(()=>{n.current=!1},0)},[]);return{onKeyDown:g.useCallback(o=>{const a=o.nativeEvent;if($3({key:o.key,shiftKey:o.shiftKey,compositionActive:n.current,nativeIsComposing:a.isComposing,keyCode:a.keyCode})){o.preventDefault(),e();return}t&&o.key==="Escape"&&(o.preventDefault(),t())},[e,t]),onCompositionStart:r,onCompositionEnd:i}}function Yq({open:e,initialLabel:t,placeholder:n,onSubmit:r,onCancel:i,title:s="Edit session",fieldLabel:o="Label",testId:a="session-edit-dialog",requireNonEmpty:l=!1}){const[c,u]=g.useState(t);g.useEffect(()=>{e&&u(t)},[e,t]);const d=c.trim(),f=l&&d==="",p=()=>{f||r({label:d})},m=Wu(p,i);return e?wl.createPortal(h.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-bg-0/40 backdrop-blur-[2px]",onClick:i,"data-testid":`${a}-overlay`,children:h.jsxs("div",{"data-testid":a,className:"w-[420px] max-w-[calc(100vw-32px)] rounded-2xl border border-text-100/[0.12] flex flex-col gap-4 p-5",style:{backgroundColor:"var(--bg-0)",boxShadow:"0 12px 40px rgba(0,0,0,0.04)"},onClick:v=>v.stopPropagation(),children:[h.jsx("div",{className:"text-[15px] font-semibold text-text-100",children:s}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-[12px] font-semibold text-text-200 mb-1",children:o}),h.jsx("input",{autoFocus:!0,type:"text",value:c,onChange:v=>u(v.target.value),...m,placeholder:n,"data-testid":`${a}-label`,className:"w-full px-3 py-2 text-[13px] bg-bg-50 border border-bg-300 rounded-lg focus:outline-none focus:border-text-300 transition-colors"})]}),h.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[h.jsx("button",{type:"button",onClick:i,className:"px-4 py-1.5 text-[12px] text-text-300 rounded-lg hover:bg-text-100/5 transition-colors cursor-pointer",children:"Cancel"}),h.jsx("button",{type:"button",onClick:p,disabled:f,"data-testid":`${a}-save`,className:"px-4 py-1.5 text-[12px] font-medium text-bg-0 rounded-lg bg-text-100 hover:bg-text-200 transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-40",children:"Save"})]})]})}),document.body):null}var Xq=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Zq="VisuallyHidden",F3=g.forwardRef((e,t)=>h.jsx(Mt.span,{...e,ref:t,style:{...Xq,...e.style}}));F3.displayName=Zq;var Qq=F3,[Kp]=Ko("Tooltip",[Up]),Gp=Up(),H3="TooltipProvider",Jq=700,Kv="tooltip.open",[eV,t_]=Kp(H3),U3=e=>{const{__scopeTooltip:t,delayDuration:n=Jq,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=g.useRef(!0),a=g.useRef(!1),l=g.useRef(0);return g.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),h.jsx(eV,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:g.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})};U3.displayName=H3;var vu="Tooltip",[tV,Yp]=Kp(vu),W3=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=t_(vu,e.__scopeTooltip),c=Gp(t),[u,d]=g.useState(null),f=Fi(),p=g.useRef(0),m=o??l.disableHoverableContent,v=a??l.delayDuration,w=g.useRef(!1),[x,_]=Bu({prop:r,defaultProp:i??!1,onChange:T=>{T?(l.onOpen(),document.dispatchEvent(new CustomEvent(Kv))):l.onClose(),s==null||s(T)},caller:vu}),b=g.useMemo(()=>x?w.current?"delayed-open":"instant-open":"closed",[x]),S=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w.current=!1,_(!0)},[_]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),k=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{w.current=!0,_(!0),p.current=0},v)},[v,_]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),h.jsx(Hy,{...c,children:h.jsx(tV,{scope:t,contentId:f,open:x,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayedRef.current?k():S()},[l.isOpenDelayedRef,k,S]),onTriggerLeave:g.useCallback(()=>{m?C():(window.clearTimeout(p.current),p.current=0)},[C,m]),onOpen:S,onClose:C,disableHoverableContent:m,children:n})})};W3.displayName=vu;var Gv="TooltipTrigger",q3=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Yp(Gv,n),s=t_(Gv,n),o=Gp(n),a=g.useRef(null),l=Qt(t,a,i.onTriggerChange),c=g.useRef(!1),u=g.useRef(!1),d=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),h.jsx(S4,{asChild:!0,...o,children:h.jsx(Mt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Le(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Le(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Le(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Le(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Le(e.onBlur,i.onClose),onClick:Le(e.onClick,i.onClose)})})});q3.displayName=Gv;var nV="TooltipPortal",[oue,rV]=Kp(nV,{forceMount:void 0}),al="TooltipContent",V3=g.forwardRef((e,t)=>{const n=rV(al,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=Yp(al,e.__scopeTooltip);return h.jsx(ns,{present:r||o.open,children:o.disableHoverableContent?h.jsx(K3,{side:i,...s,ref:t}):h.jsx(iV,{side:i,...s,ref:t})})}),iV=g.forwardRef((e,t)=>{const n=Yp(al,e.__scopeTooltip),r=t_(al,e.__scopeTooltip),i=g.useRef(null),s=Qt(t,i),[o,a]=g.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:d}=r,f=g.useCallback(()=>{a(null),d(!1)},[d]),p=g.useCallback((m,v)=>{const w=m.currentTarget,x={x:m.clientX,y:m.clientY},_=cV(x,w.getBoundingClientRect()),b=uV(x,_),S=dV(v.getBoundingClientRect()),C=fV([...b,...S]);a(C),d(!0)},[d]);return g.useEffect(()=>()=>f(),[f]),g.useEffect(()=>{if(l&&u){const m=w=>p(w,u),v=w=>p(w,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",v)}}},[l,u,p,f]),g.useEffect(()=>{if(o){const m=v=>{const w=v.target,x={x:v.clientX,y:v.clientY},_=(l==null?void 0:l.contains(w))||(u==null?void 0:u.contains(w)),b=!hV(x,o);_?f():b&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,f]),h.jsx(K3,{...e,ref:s})}),[sV,oV]=Kp(vu,{isInside:!1}),aV=XF("TooltipContent"),K3=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,l=Yp(al,n),c=Gp(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(Kv,u),()=>document.removeEventListener(Kv,u)),[u]),g.useEffect(()=>{if(l.trigger){const d=f=>{const p=f.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),h.jsx(Bp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:h.jsxs(k4,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[h.jsx(aV,{children:r}),h.jsx(sV,{scope:n,isInside:!0,children:h.jsx(Qq,{id:l.contentId,role:"tooltip",children:i||r})})]})})});V3.displayName=al;var G3="TooltipArrow",lV=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Gp(n);return oV(G3,n).isInside?null:h.jsx(C4,{...i,...r,ref:t})});lV.displayName=G3;function cV(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function uV(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function dV(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function hV(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(i=!i)}return i}function fV(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),pV(t)}function pV(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var mV=U3,gV=W3,vV=q3,Y3=V3;const xu=mV,qu=gV,Vu=vV,Al=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(Y3,{ref:r,sideOffset:t,className:re("z-50 overflow-hidden rounded-sm border border-border bg-bg-0 px-2 py-1 text-xs text-text-300 shadow-md",e),...n}));Al.displayName=Y3.displayName;const xV={held:!1,indexBySessionId:new Map},yV=g.createContext(xV);function _V(){return g.useContext(yV)}const bV=Array.from({length:9},(e,t)=>({id:`switch-session-${t+1}`,combo:{key:String(t+1),mod:!0},label:`切换到第 ${t+1} 个会话`,group:"会话",desktopOnly:!0,hiddenInList:!0})),wV=[{id:"new-session",combo:{key:"n",mod:!0},label:"新建任务",description:"打开快捷新建弹窗",group:"通用",desktopOnly:!0},{id:"open-search",combo:{key:"k",mod:!0},label:"全局搜索",description:"搜会话内容 / persona / 联系人",group:"通用",desktopOnly:!0},{id:"search-tab-prev",combo:{key:"ArrowLeft",mod:!0},label:"搜索:上一组",description:"搜索浮层里切到左边那个 tab(会话 / persona / 联系人)",group:"通用"},{id:"search-tab-next",combo:{key:"ArrowRight",mod:!0},label:"搜索:下一组",description:"搜索浮层里切到右边那个 tab",group:"通用"},...bV,{id:"archive-session",combo:{key:"Backspace",mod:!0,shift:!0},label:"归档当前会话",description:"归档当前聊天区的会话,Enter 确认 / Esc 取消",group:"会话",desktopOnly:!0},{id:"tab-prev",combo:{key:"ArrowLeft",mod:!0,shift:!0},label:"上一个标签页",description:"连按快速移动,停下或松开修饰键后切换",group:"标签页"},{id:"tab-next",combo:{key:"ArrowRight",mod:!0,shift:!0},label:"下一个标签页",description:"连按快速移动,停下或松开修饰键后切换",group:"标签页"},{id:"toggle-hive",combo:{key:"h",mod:!0,shift:!0},label:"Hive 看板",description:"全屏看所有 agent 在干什么;Esc 或点任意行退出",group:"通用"},{id:"send-message",combo:{key:"Enter"},label:"发送消息",description:"在输入框中发送当前内容",group:"输入",displayOnly:!0},{id:"newline",combo:{key:"Enter",shift:!0},label:"换行",description:"在输入框中插入换行",group:"输入",displayOnly:!0},{id:"interrupt",combo:{key:"Escape"},label:"打断回复",description:"打断当前回复;2 秒内按两次停止任务",group:"输入",displayOnly:!0}];wV.filter(e=>!e.displayOnly);function SV(){return/Mac|iP(hone|od|ad)/.test(navigator.platform)}const kV=10,CV=20,EV=16,ak=20,lk=60,IV=4;function $d({testId:e,label:t,children:n}){return h.jsxs(qu,{children:[h.jsx(Vu,{asChild:!0,children:h.jsx("span",{"data-testid":e,role:"img","aria-label":t,tabIndex:0,className:"inline-flex shrink-0",children:n})}),h.jsx(Al,{side:"bottom",children:t})]})}function TV({session:e,active:t,hasUnread:n,running:r=!1,awaitingUser:i=!1,onSelect:s,onEdit:o,onDelete:a,onPin:l,onArchive:c,quickAction:u,depth:d=0,chevron:f,showCopyResume:p=!0,contactDisplayName:m,ownerPrincipalId:v,creatorDisplayName:w,dispatchedFromSessionTitle:x}){const[_,b]=g.useState(!1),S=_V(),C=S.held?S.indexBySessionId.get(e.sessionId):void 0,k=!!e.pinnedAt,T=d===0,I=d===0&&!!c,j=kV+d*CV;let R=null;u==="pin"&&T&&l?R={icon:k?h.jsx(kS,{className:"w-4 h-4"}):h.jsx(CS,{className:"w-4 h-4"}),label:k?"取消置顶":"置顶",run:()=>l(e.sessionId,!k)}:u==="archive"&&I&&c?R={icon:h.jsx(bS,{className:"w-4 h-4"}),label:"归档",run:()=>c(e.sessionId,!0)}:u==="rename"&&o&&(R={icon:h.jsx(Ov,{className:"w-4 h-4"}),label:"重命名",run:()=>b(!0)});const D=g.useCallback(async()=>{const $=K5(e);if($)try{await navigator.clipboard.writeText($)}catch{}},[e]),P=Ay(e),A=e.originOwnerPrincipalId,M=A?`@${m??`…${A.slice(-8)}`}`:null,L=!!(e.ownerPersonaId&&v&&e.creatorPrincipalId&&e.creatorPrincipalId!==v&&!e.larkChatId&&!e.shiftFiredFromSessionId&&!e.dispatchedFromSessionId);return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":`session-item-${e.sessionId}`,onClick:s,style:{paddingLeft:j,display:"grid",gridTemplateColumns:f?`${EV}px ${ak}px 1fr auto ${lk}px`:`${ak}px 1fr auto ${lk}px`,gridTemplateAreas:f?'"chev icon name dot time"':'"icon name dot time"',columnGap:`${IV}px`,alignItems:"center"},className:re("group relative rounded-lg cursor-pointer transition-all duration-150 pr-2.5 py-1.5",t?"bg-accent-dim":"hover:bg-sidebar-hover-bg"),children:[t?h.jsx("span",{"aria-hidden":"true",className:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-7 rounded-r-full bg-accent"}):null,h.jsx("div",{style:{gridArea:"chev"},className:"flex items-center justify-center",children:f??null}),h.jsx("div",{style:{gridArea:"icon"},className:"flex items-center justify-center",children:h.jsx(Kq,{tool:e.tool})}),h.jsxs("div",{style:{gridArea:"name"},className:"flex items-center gap-1 min-w-0",children:[h.jsxs(xu,{delayDuration:200,skipDelayDuration:100,children:[e.dispatchedFromSessionId?h.jsx($d,{testId:`dispatched-icon-${e.sessionId}`,label:`来自【${x??"另一会话"}】dispatch`,children:h.jsx(M$,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,e.shiftFiredFromSessionId?h.jsx($d,{testId:`shift-fired-icon-${e.sessionId}`,label:"定时任务",children:h.jsx(t$,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,e.larkChatId?h.jsx($d,{testId:`lark-chat-icon-${e.sessionId}`,label:e.larkChatType==="p2p"?"来自飞书DM":"来自飞书群",children:h.jsx(l7,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,L?h.jsx($d,{testId:`guest-created-icon-${e.sessionId}`,label:w?`${w}创建`:"其他人创建",children:h.jsx(U7,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null]}),h.jsx("span",{"data-testid":`session-title-${e.sessionId}`,className:re("text-[13px] truncate min-w-0","group-hover:whitespace-normal group-hover:overflow-visible group-hover:break-words",t?"text-text-100 font-medium":"text-text-200"),children:P}),M?h.jsx("span",{"data-testid":`session-mirror-chip-${e.sessionId}`,title:`在 ${M.replace(/^@/,"")} 的设备上`,className:"shrink-0 inline-flex items-center px-1.5 py-0 rounded text-[10px] bg-accent-dim/40 text-accent border border-accent/20 max-w-[120px] truncate",children:M}):null]}),h.jsx(Gq,{sessionId:e.sessionId,hasUnread:n,running:r,awaitingUser:i,style:{gridArea:"dot"}}),C!=null?h.jsx("span",{style:{gridArea:"time"},"data-testid":`session-quick-switch-badge-${e.sessionId}`,className:"text-right shrink-0 transition-opacity duration-150 group-hover:opacity-0",children:h.jsx("span",{className:"inline-flex items-center justify-center h-[18px] px-1.5 rounded-[5px] border border-border bg-bg-200/70 text-[11px] text-text-200 font-medium leading-none",children:SV()?`⌘${C}`:`Ctrl+${C}`})}):h.jsx("span",{style:{gridArea:"time"},className:re("text-[11px] text-text-400/70 text-right shrink-0","transition-opacity duration-150 group-hover:opacity-0"),children:e.updatedAt?FF(e.updatedAt):""}),o||a||l||c?h.jsxs("div",{className:"absolute right-2 top-[3px] flex items-center opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 transition-opacity",children:[R?h.jsx(xu,{delayDuration:200,skipDelayDuration:100,children:h.jsxs(qu,{children:[h.jsx(Vu,{asChild:!0,children:h.jsx("button",{type:"button",onClick:$=>{$.stopPropagation(),R.run()},className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:text-text-100 hover:bg-text-100/5 transition-colors cursor-pointer","aria-label":R.label,"data-testid":`quick-action-${u}-${e.sessionId}`,children:R.icon})}),h.jsx(Al,{side:"bottom",children:R.label})]})}):null,h.jsxs(L3,{modal:!1,children:[h.jsx(j3,{asChild:!0,children:h.jsx("button",{type:"button",onClick:$=>$.stopPropagation(),className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:text-text-100 hover:bg-text-100/5 transition-colors cursor-pointer","aria-label":"session actions","data-testid":`session-menu-${e.sessionId}`,children:h.jsx(w5,{className:"w-4 h-4"})})}),h.jsxs(Jy,{align:"end",onClick:$=>$.stopPropagation(),children:[l&&T&&h.jsxs(mo,{onSelect:()=>l(e.sessionId,!k),"data-testid":`session-${k?"unpin":"pin"}-${e.sessionId}`,children:[k?h.jsx(kS,{className:"w-3 h-3 mr-2 text-text-400"}):h.jsx(CS,{className:"w-3 h-3 mr-2 text-text-400"}),k?"Unpin":"Pin"]}),I&&c&&h.jsxs(mo,{onSelect:()=>c(e.sessionId,!0),"data-testid":`session-archive-${e.sessionId}`,children:[h.jsx(bS,{className:"w-3 h-3 mr-2 text-text-400"}),"Archive"]}),o&&h.jsxs(mo,{onSelect:()=>b(!0),"data-testid":`session-rename-${e.sessionId}`,children:[h.jsx(Ov,{className:"w-3 h-3 mr-2 text-text-400"}),"Rename"]}),p&&e.toolSessionId?h.jsxs(mo,{onSelect:()=>void D(),"data-testid":`session-copy-resume-${e.sessionId}`,children:[h.jsx(Cy,{className:"w-3 h-3 mr-2 text-text-400"}),"Copy Resume Command"]}):null,(l||o||p&&e.toolSessionId)&&a&&h.jsx(e_,{}),a&&h.jsxs(mo,{onSelect:()=>void a(e.sessionId),className:"text-destructive focus:text-destructive focus:bg-destructive/10","data-testid":`session-delete-${e.sessionId}`,children:[h.jsx(Ty,{className:"w-3 h-3 mr-2"}),"Delete"]})]})]})]}):null]}),o?h.jsx(Yq,{open:_,initialLabel:e.label??"",placeholder:e.cwd.split("/").pop()||"",onSubmit:$=>{o(e.sessionId,$),b(!1)},onCancel:()=>b(!1)}):null]})}function n_({node:e,depth:t=0,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,getContactDisplayName:f,showCopyResume:p,ownerPrincipalId:m,getCreatorDisplayName:v,getSessionDisplayName:w,parentSession:x}){const _=e.children.length>0,{isCollapsed:b,toggle:S}=Gz(),C=!b(e.session.sessionId),k=g.useCallback(I=>{I.stopPropagation(),S(e.session.sessionId)},[S,e.session.sessionId]),T=_?h.jsx("button",{type:"button",onClick:k,"data-testid":`session-chevron-${e.session.sessionId}`,"aria-label":C?"collapse":"expand","aria-expanded":C,className:"shrink-0 flex items-center justify-center w-4 h-4 text-text-400 hover:text-text-100 cursor-pointer",children:C?h.jsx(Qn,{className:"w-3 h-3"}):h.jsx(zn,{className:"w-3 h-3"})}):null;return h.jsxs("div",{"data-testid":`session-tree-node-${e.session.sessionId}`,children:[h.jsx(TV,{session:e.session,active:n===e.session.sessionId,hasUnread:(r==null?void 0:r.has(e.session.sessionId))??!1,running:(i==null?void 0:i.has(e.session.sessionId))??!1,awaitingUser:(s==null?void 0:s.has(e.session.sessionId))??!1,onSelect:()=>o(e.session.sessionId),onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,showCopyResume:p,ownerPrincipalId:m,creatorDisplayName:e.session.creatorPrincipalId?v==null?void 0:v(e.session.creatorPrincipalId):void 0,dispatchedFromSessionTitle:e.session.dispatchedFromSessionId?(w==null?void 0:w(e.session.dispatchedFromSessionId))??((x==null?void 0:x.sessionId)===e.session.dispatchedFromSessionId?Ay(x):void 0):void 0,depth:t,chevron:T,contactDisplayName:e.session.originOwnerPrincipalId?f==null?void 0:f(e.session.originOwnerPrincipalId):void 0}),_&&C?h.jsx("div",{"data-testid":`session-tree-children-${e.session.sessionId}`,children:e.children.map(I=>h.jsx(n_,{node:I,depth:t+1,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,getContactDisplayName:f,showCopyResume:p,ownerPrincipalId:m,getCreatorDisplayName:v,getSessionDisplayName:w,parentSession:e.session},I.session.sessionId))}):null]})}function NV(e){return e.forkedFromSessionId??e.dispatchedFromSessionId??e.shiftFiredFromSessionId}function r_(e,t){return e.updatedAt<t.updatedAt?1:e.updatedAt>t.updatedAt?-1:0}function X3(e){e=e.filter(s=>!s.ephemeral&&s.deployId===void 0&&s.testReleaseId===void 0);const t=new Map;for(const s of e)t.set(s.sessionId,s);const n=new Map,r=[];for(const s of e){const o=NV(s);if(o&&t.has(o)){const a=n.get(o)??[];a.push(s),n.set(o,a)}else r.push(s)}const i=s=>{const a=[...n.get(s.sessionId)??[]].sort(r_);return{session:s,children:a.map(i)}};return[...r].sort(RV).map(i)}function Z3(e){return[...e].sort((t,n)=>r_(t.session,n.session))}function RV(e,t){const n=typeof e.pinnedAt=="number",r=typeof t.pinnedAt=="number";if(n&&r){const i=typeof e.pinSortOrder=="number",s=typeof t.pinSortOrder=="number";return i&&s?e.pinSortOrder-t.pinSortOrder:i?-1:s?1:t.pinnedAt-e.pinnedAt}return n?-1:r?1:r_(e,t)}function PV(e){return e.label?e.label:e.aiLabel?e.aiLabel:e.cwd.split("/").filter(Boolean).pop()??""}function ck(e,t){const n=t.trim().toLowerCase();return n===""?!0:e.toLowerCase().includes(n)}const AV={isCollapsed:()=>!1,toggle:()=>{},prune:()=>{}};function MV({personas:e,activePersonaId:t,onSelectPersona:n,onCreateSession:r,sessions:i,activeSessionId:s,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,isPersonaExpanded:p,onTogglePersonaExpanded:m,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,searchQuery:b}){const[S,C]=g.useState(null),[k,T]=g.useState(()=>new Set),I=p??(L=>k.has(L)),j=g.useCallback(L=>{if(m){m(L);return}T($=>{const F=new Set($);return F.has(L)?F.delete(L):F.add(L),F})},[m]),R=g.useMemo(()=>i==null?void 0:i.filter(L=>!L.ephemeral),[i]),D=g.useMemo(()=>new Map((R??[]).map(L=>[L.sessionId,Ay(L)])),[R]),P=g.useCallback(L=>f==null?void 0:f.get(L),[f]),A=g.useCallback(L=>D.get(L),[D]);if(e.length===0)return h.jsx(LV,{});const M=(b??"").trim();return M?h.jsx(Sy.Provider,{value:AV,children:h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(L=>{const $=R?R.filter(E=>E.ownerPersonaId===L.personaId).sort((E,U)=>U.updatedAt>E.updatedAt?1:-1):[],F=ck(L.label,M),z=$.filter(E=>ck(PV(E),M));if(!F&&z.length===0)return null;const B=F?$:z;return h.jsx(uk,{persona:L,active:L.personaId===t,editing:!1,onSelectPersona:n,onSubmitCreateSession:()=>{},onCancelCreateSession:()=>{},personaSessions:B,collapsed:!1,onToggleCollapsed:()=>{},activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,getCreatorDisplayName:P,getSessionDisplayName:A},L.personaId)})})}):h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(L=>{const $=R?R.filter(F=>F.ownerPersonaId===L.personaId).sort((F,z)=>z.updatedAt>F.updatedAt?1:-1):[];return h.jsx(uk,{persona:L,active:L.personaId===t,editing:L.personaId===S,onSelectPersona:n,onStartCreateSession:r?()=>C(L.personaId):void 0,onSubmitCreateSession:F=>{C(null),r==null||r(L.personaId,F)},onCancelCreateSession:()=>C(null),personaSessions:$,collapsed:!I(L.personaId),onToggleCollapsed:()=>j(L.personaId),activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,getCreatorDisplayName:P,getSessionDisplayName:A},L.personaId)})})}function LV(){return h.jsx("div",{className:"px-3 py-3 text-[11px] leading-relaxed text-text-400",children:"还没有 persona。点上方 Personas 标题右侧 + 创建第一个。"})}function uk({persona:e,active:t,editing:n,onSelectPersona:r,onStartCreateSession:i,onSubmitCreateSession:s,onCancelCreateSession:o,personaSessions:a,collapsed:l,onToggleCollapsed:c,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,treatSessionsAsRoots:b,ownerPrincipalId:S,creatorDisplayNameByOwnerId:C,getCreatorDisplayName:k,getSessionDisplayName:T}){const I=a.length>0,j=!l,R=g.useMemo(()=>{const A=[],M=new Map;for(const L of a){const $=L.creatorPrincipalId;if(L.larkChatId!=null||!$||S&&$===S){A.push(L);continue}const F=$,z=(C==null?void 0:C.get(F))??`…${F.slice(-8)}`,B=M.get(F);B?B.sessions.push(L):M.set(F,{groupKey:F,displayName:z,sessions:[L]})}return{self:A,byPeer:[...M.values()]}},[a,S,C]),D=R.byPeer.length>0,P=g.useMemo(()=>j&&!D?Z3(X3(a)):[],[j,D,a]);return h.jsxs("div",{"data-testid":`persona-node-${e.personaId}`,children:[h.jsxs("div",{className:re("group flex items-center gap-1 px-2 py-1.5 cursor-pointer",t?"bg-accent-dim text-text-100":"hover:bg-bg-200 text-text-200"),onClick:()=>r==null?void 0:r(e.personaId),role:"button",tabIndex:0,children:[I?h.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),c()},"aria-label":j?"collapse":"expand","aria-expanded":j,"data-testid":`persona-chevron-${e.personaId}`,className:"flex h-4 w-4 shrink-0 items-center justify-center text-text-400 hover:text-text-100",children:j?h.jsx(Qn,{className:"h-3 w-3"}):h.jsx(zn,{className:"h-3 w-3"})}):h.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),h.jsx(Dp,{tool:e.tool,className:re("h-3.5 w-3.5 shrink-0",Op(e.tool))}),h.jsx("span",{className:"flex-1 truncate text-[13px]",children:e.label}),I?h.jsx("span",{className:"shrink-0 text-[10px] text-text-400 tabular-nums","aria-label":`${a.length} sessions`,children:a.length}):null,i?h.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),i()},"aria-label":"新建会话",title:"新建会话","data-testid":`persona-create-session-${e.personaId}`,className:"flex h-5 w-5 shrink-0 items-center justify-center rounded text-text-400 opacity-0 hover:bg-text-100/10 hover:text-text-100 focus-visible:opacity-100 group-hover:opacity-100",children:h.jsx(b7,{className:"h-3.5 w-3.5"})}):null]}),n?h.jsx(jV,{personaId:e.personaId,tool:e.tool,onSubmit:s,onCancel:o}):null,I&&j?h.jsx("div",{"data-testid":`persona-sessions-${e.personaId}`,children:D?h.jsxs(h.Fragment,{children:[R.self.length>0&&h.jsx(dk,{groupKey:`${e.personaId}-self`,label:"我自己",testId:`persona-sessions-${e.personaId}-self`,sessions:R.self,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:T}),R.byPeer.map(A=>h.jsx(dk,{groupKey:`${e.personaId}-peer-${A.groupKey}`,label:A.displayName,testId:`persona-sessions-${e.personaId}-peer-${A.groupKey}`,sessions:A.sessions,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:T},`${e.personaId}-peer-${A.groupKey}`))]}):P.map(A=>h.jsx(n_,{node:A,depth:b?0:1,activeId:u,unreadIds:p,runningIds:f,awaitingIds:d,onSelect:M=>m==null?void 0:m(M),onDelete:v,onEdit:w,onPin:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:T},A.session.sessionId))}):null]})}function dk({label:e,testId:t,sessions:n,activeSessionId:r,awaitingIds:i,runningIds:s,unreadIds:o,onSelectSession:a,onDeleteSession:l,onEditSession:c,onPinSession:u,showCopyResume:d,ownerPrincipalId:f,getCreatorDisplayName:p,getSessionDisplayName:m}){const[v,w]=g.useState(!1),x=!v,_=g.useMemo(()=>x?Z3(X3(n)):[],[x,n]);return h.jsxs("div",{"data-testid":t,children:[h.jsxs("button",{type:"button",onClick:()=>w(b=>!b),"aria-label":x?"collapse":"expand","aria-expanded":x,"data-testid":`${t}-chevron`,className:"flex items-center gap-1 w-full pl-7 pr-2 py-0.5 text-[11px] text-text-400 hover:text-text-200 transition-colors",children:[x?h.jsx(Qn,{className:"h-3 w-3"}):h.jsx(zn,{className:"h-3 w-3"}),h.jsx(N5,{className:"h-3 w-3","aria-hidden":!0}),h.jsx("span",{className:"truncate",children:e}),h.jsx("span",{className:"ml-auto tabular-nums",children:n.length})]}),x&&h.jsx("div",{children:_.map(b=>h.jsx(n_,{node:b,depth:2,activeId:r,unreadIds:o,runningIds:s,awaitingIds:i,onSelect:S=>a==null?void 0:a(S),onDelete:l,onEdit:c,onPin:u,showCopyResume:d,ownerPrincipalId:f,getCreatorDisplayName:p,getSessionDisplayName:m},b.session.sessionId))})]})}function jV({personaId:e,tool:t,onSubmit:n,onCancel:r}){const[i,s]=g.useState(""),o=g.useRef(null),a=i.trim(),l=a.length>0;g.useEffect(()=>{var d;(d=o.current)==null||d.focus()},[]);const c=g.useCallback(()=>{l&&n(a)},[l,a,n]),u=Wu(c,r);return h.jsxs("div",{className:"flex items-center gap-1.5 pl-9 pr-2 py-1","data-testid":`persona-new-session-row-${e}`,children:[h.jsx(Dp,{tool:t,className:re("h-3 w-3 shrink-0",Op(t))}),h.jsx("input",{ref:o,type:"text",value:i,onChange:d=>s(d.target.value),...u,onBlur:r,placeholder:"session label...","data-testid":`persona-new-session-input-${e}`,className:"flex-1 min-w-0 bg-bg-100 border border-text-100/15 rounded px-1.5 py-0.5 text-[12px] text-text-100 placeholder:text-text-400 focus:outline-none focus:border-text-100/40"}),h.jsx("button",{type:"button",onMouseDown:d=>{d.preventDefault(),c()},disabled:!l,"aria-label":"确认",title:"确认(Enter)","data-testid":`persona-new-session-confirm-${e}`,className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-text-300 hover:bg-text-100/10 hover:text-text-100 disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-text-300",children:h.jsx(Du,{className:"h-3 w-3"})}),h.jsx("button",{type:"button",onMouseDown:d=>{d.preventDefault(),r()},"aria-label":"取消",title:"取消(Esc)","data-testid":`persona-new-session-cancel-${e}`,className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-text-300 hover:bg-text-100/10 hover:text-text-100",children:h.jsx(Xr,{className:"h-3 w-3"})})]})}function DV(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function OV(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),r=parseFloat(n.fontSize);return t*r}function BV(e){return e/100*window.innerHeight}function zV(e){return e/100*window.innerWidth}function $V(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function gc({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,s]=$V(n);switch(s){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=OV(t,i);break}case"em":{r=DV(t,i);break}case"vh":{r=BV(i);break}case"vw":{r=zV(i);break}}return r}function Ln(e){return parseFloat(e.toFixed(3))}function ll({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function Yv(e){const{panels:t}=e,n=ll({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:s}=r;let o=0;if(s.collapsedSize!==void 0){const u=gc({groupSize:n,panelElement:i,styleProp:s.collapsedSize});o=Ln(u/n*100)}let a;if(s.defaultSize!==void 0){const u=gc({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=Ln(u/n*100)}let l=0;if(s.minSize!==void 0){const u=gc({groupSize:n,panelElement:i,styleProp:s.minSize});l=Ln(u/n*100)}let c=100;if(s.maxSize!==void 0){const u=gc({groupSize:n,panelElement:i,styleProp:s.maxSize});c=Ln(u/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:o,collapsible:s.collapsible===!0,defaultSize:a,disabled:s.disabled,minSize:l,maxSize:c,panelId:r.id}})}function ct(e,t="Assertion error"){if(!e)throw Error(t)}function Xv(e,t){return Array.from(t).sort(e==="horizontal"?FV:HV)}function FV(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function HV(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Q3(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function J3(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function UV({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,s=Number.MAX_VALUE;for(const o of t){const{x:a,y:l}=J3(r,o),c=e==="horizontal"?a:l;c<s&&(s=c,i=o)}return ct(i,"No rect found"),i}let Fd;function WV(){return Fd===void 0&&(typeof matchMedia=="function"?Fd=!!matchMedia("(pointer:coarse)").matches:Fd=!1),Fd}function eR(e){const{element:t,orientation:n,panels:r,separators:i}=e,s=Xv(n,Array.from(t.children).filter(Q3).map(m=>({element:m}))).map(({element:m})=>m),o=[];let a=!1,l=!1,c=-1,u=-1,d=0,f,p=[];{let m=-1;for(const v of s)v.hasAttribute("data-panel")&&(m++,v.hasAttribute("data-disabled")||(d++,c===-1&&(c=m),u=m))}if(d>1){let m=-1;for(const v of s)if(v.hasAttribute("data-panel")){m++;const w=r.find(x=>x.element===v);if(w){if(f){const x=f.element.getBoundingClientRect(),_=v.getBoundingClientRect();let b;if(l){const S=n==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),C=n==="horizontal"?new DOMRect(_.left,_.top,0,_.height):new DOMRect(_.left,_.top,_.width,0);switch(p.length){case 0:{b=[S,C];break}case 1:{const k=p[0],T=UV({orientation:n,rects:[x,_],targetRect:k.element.getBoundingClientRect()});b=[k,T===x?C:S];break}default:{b=p;break}}}else p.length?b=p:b=[n==="horizontal"?new DOMRect(x.right,_.top,_.left-x.right,_.height):new DOMRect(_.left,x.bottom,_.width,_.top-x.bottom)];for(const S of b){let C="width"in S?S:S.element.getBoundingClientRect();const k=WV()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(C.width<k){const I=k-C.width;C=new DOMRect(C.x-I/2,C.y,C.width+I,C.height)}if(C.height<k){const I=k-C.height;C=new DOMRect(C.x,C.y-I/2,C.width,C.height+I)}const T=m<=c||m>u;!a&&!T&&o.push({group:e,groupSize:ll({group:e}),panels:[f,w],separator:"width"in S?void 0:S,rect:C}),a=!1}}l=!1,f=w,p=[]}}else if(v.hasAttribute("data-separator")){v.ariaDisabled!==null&&(a=!0);const w=i.find(x=>x.element===v);w?p.push(w):(f=void 0,p=[])}else l=!0}return o}var ks;class tR{constructor(){ib(this,ks,{})}addListener(t,n){const r=Ul(this,ks)[t];return r===void 0?Ul(this,ks)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=Ul(this,ks)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,s=null;const o=Array.from(r);for(let a=0;a<o.length;a++){const l=o[a];try{l.call(null,n)}catch(c){s===null&&(i=!0,s=c)}}if(i)throw s}}removeAllListeners(){sb(this,ks,{})}removeListener(t,n){const r=Ul(this,ks)[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}ks=new WeakMap;let Ua={cursorFlags:0,state:"inactive"};const i_=new tR;function jo(){return Ua}function qV(e){return i_.addListener("change",e)}function VV(e){const t=Ua,n={...Ua};n.cursorFlags=e,Ua=n,i_.emit("change",{prev:t,next:n})}function Wa(e){const t=Ua;Ua=e,i_.emit("change",{prev:t,next:e})}const KV=e=>e,ug=()=>{},nR=1,rR=2,iR=4,sR=8,hk=3,fk=12;let Hd;function pk(){return Hd===void 0&&(Hd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Hd=!0)),Hd}function GV({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(!(r===0&&i===0)){switch(n){case"active":{if(e&&pk()){const s=(e&nR)!==0,o=(e&rR)!==0,a=(e&iR)!==0,l=(e&sR)!==0;if(s)return a?"se-resize":l?"ne-resize":"e-resize";if(o)return a?"sw-resize":l?"nw-resize":"w-resize";if(a)return"s-resize";if(l)return"n-resize"}break}}return pk()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}const mk=new WeakMap;function s_(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=mk.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const r=jo();switch(r.state){case"active":case"hover":{const i=GV({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(o=>o.group),state:r.state}),s=`*, *:hover {cursor: ${i} !important; }`;if(t===s)return;t=s,i?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}mk.set(e,{prevStyle:t,styleSheet:n})}let di=new Map;const oR=new tR;function YV(e){di=new Map(di),di.delete(e)}function gk(e,t){for(const[n]of di)if(n.id===e)return n}function Bs(e,t){for(const[n,r]of di)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Yo(){return di}function o_(e,t){return oR.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Zi(e,t,n){const r=di.get(e);di=new Map(di),di.set(e,t),oR.emit("groupChange",{group:e,isUserInteraction:(n==null?void 0:n.isUserInteraction)===!0,prev:r,next:t})}function aR(e){const t=jo();let n=!1;switch(t.state){case"active":Wa({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(s_(e),n=!0,t.hitRegions.forEach(r=>{const i=Bs(r.group.id,!0);Zi(r.group,i,{isUserInteraction:!0})}))}return n}function vk(e){e.defaultPrevented||aR(e.currentTarget)}function XV(e,t,n){let r,i={x:1/0,y:1/0};for(const s of t){const o=J3(n,s.rect);switch(e){case"horizontal":{o.x<=i.x&&(r=s,i=o);break}case"vertical":{o.y<=i.y&&(r=s,i=o);break}}}return r?{distance:i,hitRegion:r}:void 0}function ZV(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function QV(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:_k(e),b:_k(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();ct(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:yk(xk(n.a)),b:yk(xk(n.b))};if(i.a===i.b){const s=r.childNodes,o={a:n.a.at(-1),b:n.b.at(-1)};let a=s.length;for(;a--;){const l=s[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(i.a-i.b)}const JV=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function eK(e){const t=getComputedStyle(lR(e)??e).display;return t==="flex"||t==="inline-flex"}function tK(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||eK(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||JV.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function xk(e){let t=e.length;for(;t--;){const n=e[t];if(ct(n,"Missing node"),tK(n))return n}return null}function yk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _k(e){const t=[];for(;e;)t.push(e),e=lR(e);return t}function lR(e){const{parentNode:t}=e;return ZV(t)?t.host:t}function nK(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function rK({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Q3(n)||n.contains(e)||e.contains(n))return!0;if(QV(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(nK(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function a_(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const s=eR(i),o=XV(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=0&&o.distance.y<=0&&rK({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function iK(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function kn(e,t,n=0){return Math.abs(Ln(e)-Ln(t))<=n}function ai(e,t){return kn(e,t)?0:e>t?1:-1}function Pa({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:i=0,collapsible:s,disabled:o,maxSize:a=100,minSize:l=0}=t;if(o&&!e)return n;if(ai(r,l)<0)if(s){const c=(i+l)/2;ai(r,c)<0?r=i:r=l}else r=l;return r=Math.min(a,r),r=Ln(r),r}function yu({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:s}){if(kn(e,0))return t;const o=s==="imperative-api",a=Object.values(t),l=Object.values(i),c=[...a],[u,d]=r;ct(u!=null,"Invalid first pivot index"),ct(d!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const v=e<0?d:u,w=n[v];ct(w,`Panel constraints not found for index ${v}`);const{collapsedSize:x=0,collapsible:_,minSize:b=0}=w;if(_){const S=a[v];if(ct(S!=null,`Previous layout not found for panel index ${v}`),kn(S,x)){const C=b-S;ai(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}{const v=e<0?u:d,w=n[v];ct(w,`No panel constraints found for index ${v}`);const{collapsedSize:x=0,collapsible:_,minSize:b=0}=w;if(_){const S=a[v];if(ct(S!=null,`Previous layout not found for panel index ${v}`),kn(S,b)){const C=S-x;ai(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}break}default:{const v=e<0?d:u,w=n[v];ct(w,`Panel constraints not found for index ${v}`);const x=a[v],{collapsible:_,collapsedSize:b,minSize:S}=w;if(_&&ai(x,S)<0)if(e>0){const C=S-b,k=C/2,T=x+e;ai(T,S)<0&&(e=ai(e,k)<=0?0:C)}else{const C=S-b,k=100-C/2,T=x-e;ai(T,S)<0&&(e=ai(100+e,k)>0?0:-C)}break}}{const v=e<0?1:-1;let w=e<0?d:u,x=0;for(;;){const b=a[w];ct(b!=null,`Previous layout not found for panel index ${w}`);const S=Pa({overrideDisabledPanels:o,panelConstraints:n[w],prevSize:b,size:100})-b;if(x+=S,w+=v,w<0||w>=n.length)break}const _=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-_:_}{let v=e<0?u:d;for(;v>=0&&v<n.length;){const w=Math.abs(e)-Math.abs(f),x=a[v];ct(x!=null,`Previous layout not found for panel index ${v}`);const _=x-w,b=Pa({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:x,size:_});if(!kn(x,b)&&(f+=x-b,c[v]=b,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if(iK(l,c))return i;{const v=e<0?d:u,w=a[v];ct(w!=null,`Previous layout not found for panel index ${v}`);const x=w+f,_=Pa({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:w,size:x});if(c[v]=_,!kn(_,x)){let b=x-_,S=e<0?d:u;for(;S>=0&&S<n.length;){const C=c[S];ct(C!=null,`Previous layout not found for panel index ${S}`);const k=C+b,T=Pa({overrideDisabledPanels:o,panelConstraints:n[S],prevSize:C,size:k});if(kn(C,T)||(b-=T-C,c[S]=T),kn(b,0))break;e>0?S--:S++}}}const p=Object.values(c).reduce((v,w)=>w+v,0);if(!kn(p,100,.1))return i;const m=Object.keys(i);return c.reduce((v,w,x)=>(v[m[x]]=w,v),{})}function Do(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||ai(e[n],t[n])!==0)return!1;return!0}function Oo({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],i=r.reduce((a,l)=>a+l,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(a=>`${a}%`).join(", ")}`);if(!kn(i,100)&&r.length>0)for(let a=0;a<t.length;a++){const l=r[a];ct(l!=null,`No layout data found for index ${a}`);const c=100/i*l;r[a]=c}let s=0;for(let a=0;a<t.length;a++){const l=n[a];ct(l!=null,`No layout data found for index ${a}`);const c=r[a];ct(c!=null,`No layout data found for index ${a}`);const u=Pa({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});c!=u&&(s+=c-u,r[a]=u)}if(!kn(s,0))for(let a=0;a<t.length;a++){const l=r[a];ct(l!=null,`No layout data found for index ${a}`);const c=l+s,u=Pa({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});if(l!==u&&(s-=u-l,r[a]=u,kn(s,0)))break}const o=Object.keys(e);return r.reduce((a,l,c)=>(a[o[c]]=l,a),{})}function cR({groupId:e,panelId:t}){const n=()=>{const l=Yo();for(const[c,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:p,separatorToPanels:m}]of l)if(c.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:c,groupSize:p,layout:f,separatorToPanels:m};throw Error(`Group ${e} not found`)},r=()=>{const l=n().derivedPanelConstraints.find(c=>c.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const l=n().group.panels.find(c=>c.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const l=n().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:l,panels:c,prevLayout:u,derivedPanelConstraints:d})=>{const f=s(),p=c.findIndex(w=>w.id===t),m=p===0,v=p===c.length-1;if(v&&l<f&&(m||c.slice(0,p).every((w,x)=>{const _=d[x];return(_==null?void 0:_.collapsible)&&kn(_.collapsedSize,u[_.panelId])}))){const w=c.slice(0,p).reduce((x,_)=>x+u[_.id],0);return{...u,[t]:Ln(100-w)}}return yu({delta:v?f-l:l-f,initialLayout:u,panelConstraints:d,pivotIndices:v?[p-1,p]:[p,p+1],prevLayout:u,trigger:"imperative-api"})},a=l=>{const c=s();if(l===c)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:p,layout:m,separatorToPanels:v}=n(),w=o({nextSize:l,panels:f.panels,prevLayout:m,derivedPanelConstraints:d}),x=Oo({layout:w,panelConstraints:d});Do(m,x)||Zi(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:p,layout:x,separatorToPanels:v})};return{collapse:()=>{const{collapsible:l,collapsedSize:c}=r(),{mutableValues:u}=i(),d=s();l&&d!==c&&(u.expandToSize=d,a(c))},expand:()=>{const{collapsible:l,collapsedSize:c,minSize:u}=r(),{mutableValues:d}=i(),f=s();if(l&&f===c){let p=d.expandToSize??u;p===0&&(p=1),a(p)}},getSize:()=>{const{group:l}=n(),c=s(),{element:u}=i(),d=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:c,inPixels:d}},isCollapsed:()=>{const{collapsible:l,collapsedSize:c}=r(),u=s();return l&&kn(c,u)},resize:l=>{const{group:c}=n(),{element:u}=i(),d=ll({group:c}),f=gc({groupSize:d,panelElement:u,styleProp:l}),p=Ln(f/d*100);a(p)}}}function bk(e){if(e.defaultPrevented)return;const t=Yo();a_(e,t).forEach(n=>{if(n.separator&&!n.separator.disableDoubleClick){const r=n.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(r){const i=r.panelConstraints.defaultSize,s=cR({groupId:n.group.id,panelId:r.id});s&&i!==void 0&&(s.resize(i),e.preventDefault())}}})}function Ih(e){const t=Yo();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function uR({groupId:e}){const t=()=>{const n=Yo();for(const[r,i]of n)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:s,groupSize:o,layout:a,separatorToPanels:l}=t(),c=Oo({layout:n,panelConstraints:i});return r?a:(Do(a,c)||Zi(s,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:o,layout:c,separatorToPanels:l}),c)}}}function oo(e,t){const n=Ih(e),r=Bs(n.id,!0),i=n.separators.find(u=>u.element===e);ct(i,"Matching separator not found");const s=r.separatorToPanels.get(i);ct(s,"Matching panels not found");const o=s.map(u=>n.panels.indexOf(u)),a=uR({groupId:n.id}).getLayout(),l=yu({delta:t,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:a,trigger:"keyboard"}),c=Oo({layout:l,panelConstraints:r.derivedPanelConstraints});Do(a,c)||Zi(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function wk(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Ih(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&oo(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&oo(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&oo(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&oo(t,-5);break}case"End":{e.preventDefault(),oo(t,100);break}case"Enter":{e.preventDefault();const r=Ih(t),i=Bs(r.id,!0),{derivedPanelConstraints:s,layout:o,separatorToPanels:a}=i,l=r.separators.find(f=>f.element===t);ct(l,"Matching separator not found");const c=a.get(l);ct(c,"Matching panels not found");const u=c[0],d=s.find(f=>f.panelId===u.id);if(ct(d,"Panel metadata not found"),d.collapsible){const f=o[u.id],p=d.collapsedSize===f?r.mutableState.expandedPanelSizes[u.id]??d.minSize:d.collapsedSize;oo(t,p-f)}break}case"F6":{e.preventDefault();const r=Ih(t).separators.map(o=>o.element),i=Array.from(r).findIndex(o=>o===e.currentTarget);ct(i!==null,"Index not found");const s=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[s].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),oo(t,-100);break}}}function Sk(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Yo(),n=a_(e,t),r=new Map;let i=!1;n.forEach(s=>{s.separator&&(i||(i=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));const o=t.get(s.group);o&&r.set(s.group,o.layout)}),Wa({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function dR({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:s,prevCursorFlags:o}){let a=0;n.forEach(c=>{const{group:u,groupSize:d}=c,{orientation:f,panels:p}=u,{disableCursor:m}=u.mutableState;let v=0;s?f==="horizontal"?v=(t.clientX-s.x)/d*100:v=(t.clientY-s.y)/d*100:f==="horizontal"?v=t.clientX<0?-100:100:v=t.clientY<0?-100:100;const w=r.get(u),x=i.get(u);if(!w||!x)return;const{defaultLayoutDeferred:_,derivedPanelConstraints:b,groupSize:S,layout:C,separatorToPanels:k}=x;if(b&&C&&k){const T=yu({delta:v,initialLayout:w,panelConstraints:b,pivotIndices:c.panels.map(I=>p.indexOf(I)),prevLayout:C,trigger:"mouse-or-touch"});if(Do(T,C)){if(v!==0&&!m)switch(f){case"horizontal":{a|=v<0?nR:rR;break}case"vertical":{a|=v<0?iR:sR;break}}}else Zi(c.group,{defaultLayoutDeferred:_,derivedPanelConstraints:b,groupSize:S,layout:T,separatorToPanels:k})}});let l=0;t.movementX===0?l|=o&hk:l|=a&hk,t.movementY===0?l|=o&fk:l|=a&fk,VV(l),s_(e)}function kk(e){const t=Yo(),n=jo();switch(n.state){case"active":dR({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Ck(e){var r,i;if(e.defaultPrevented)return;const t=jo(),n=Yo();switch(t.state){case"active":{if(e.buttons===0){Wa({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{const o=Bs(s.group.id,!0);Zi(s.group,o,{isUserInteraction:!0})});return}for(const s of t.hitRegions)if(s.separator){const{element:o}=s.separator;(r=o.hasPointerCapture)!=null&&r.call(o,e.pointerId)||((i=o.setPointerCapture)==null||i.call(o,e.pointerId))}dR({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=a_(e,n);s.length===0?t.state!=="inactive"&&Wa({cursorFlags:0,state:"inactive"}):Wa({cursorFlags:0,hitRegions:s,state:"hover"}),s_(e.currentTarget);break}}}function Ek(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(jo().state){case"hover":Wa({cursorFlags:0,state:"inactive"})}}function Ik(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||aR(e.currentTarget)&&e.preventDefault()}function Tk(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const o=Ln(s.defaultSize);n+=o,r[s.panelId]=o}else r[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=Ln((100-n)/i);for(const o of e)o.defaultSize===void 0&&(r[o.panelId]=s)}return r}function sK(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const i=ll({group:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,a={asPercentage:Ln(s/i*100),inPixels:s};r.mutableValues.prevSize=a,r.onResize(a,r.id,o)}function oK(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function aK({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,s=0,o=!1;const a=new Map,l=[];for(const d of e.panels){const f=r[d.id]??0;switch(d.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{o=!0;const p=f/100*n,m=Ln(p/t*100);a.set(d.id,m),i+=m;break}case"preserve-relative-size":default:{l.push(d.id),s+=f;break}}}if(!o||l.length===0)return r;const c=100-i,u={...r};if(a.forEach((d,f)=>{u[f]=d}),s>0)for(const d of l){const f=r[d]??0;u[d]=Ln(f/s*c)}else{const d=Ln(c/l.length);for(const f of l)u[f]=d}return u}function lK(e,t){const n=e.map(i=>i.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!r.includes(i))return!1;return!0}const ca=new Map;function cK(e){let t=!0;ct(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,s=new n(m=>{for(const v of m){const{borderBoxSize:w,target:x}=v;if(x===e.element){if(t){const _=ll({group:e});if(_===0)return;const b=Bs(e.id);if(!b)return;const S=Yv(e),C=b.defaultLayoutDeferred?Tk(S):b.layout,k=aK({group:e,nextGroupSize:_,prevGroupSize:b.groupSize,prevLayout:C}),T=Oo({layout:k,panelConstraints:S});if(!b.defaultLayoutDeferred&&Do(b.layout,T)&&oK(b.derivedPanelConstraints,S)&&b.groupSize===_)return;Zi(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:_,layout:T,separatorToPanels:b.separatorToPanels})}}else sK(e,x,w)}});s.observe(e.element),e.panels.forEach(m=>{ct(!r.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.onResize&&s.observe(m.element)});const o=ll({group:e}),a=Yv(e),l=e.panels.map(({id:m})=>m).join(",");let c=e.mutableState.defaultLayout;c&&(lK(e.panels,c)||(c=void 0));const u=e.mutableState.layouts[l]??c??Tk(a),d=Oo({layout:u,panelConstraints:a}),f=e.element.ownerDocument;ca.set(f,(ca.get(f)??0)+1);const p=new Map;return eR(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),Zi(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:a,groupSize:o,layout:d,separatorToPanels:p}),e.separators.forEach(m=>{ct(!i.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),i.add(m.id),m.element.addEventListener("keydown",wk)}),ca.get(f)===1&&(f.addEventListener("contextmenu",vk,!0),f.addEventListener("dblclick",bk,!0),f.addEventListener("pointerdown",Sk,!0),f.addEventListener("pointerleave",kk),f.addEventListener("pointermove",Ck),f.addEventListener("pointerout",Ek),f.addEventListener("pointerup",Ik,!0)),function(){t=!1,ca.set(f,Math.max(0,(ca.get(f)??0)-1)),YV(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",wk)}),ca.get(f)||(f.removeEventListener("contextmenu",vk,!0),f.removeEventListener("dblclick",bk,!0),f.removeEventListener("pointerdown",Sk,!0),f.removeEventListener("pointerleave",kk),f.removeEventListener("pointermove",Ck),f.removeEventListener("pointerout",Ek),f.removeEventListener("pointerup",Ik,!0)),s.disconnect()}}function uK(){const[e,t]=g.useState({}),n=g.useCallback(()=>t({}),[]);return[e,n]}function l_(e){const t=g.useId();return`${e??t}`}const Xo=typeof window<"u"?g.useLayoutEffect:g.useEffect;function jc(e){const t=g.useRef(e);return Xo(()=>{t.current=e},[e]),g.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function c_(...e){return jc(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function u_(e){const t=g.useRef({...e});return Xo(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const hR=g.createContext(null);function dK(e,t){const n=g.useRef({getLayout:()=>({}),setLayout:KV});g.useImperativeHandle(t,()=>n.current,[]),Xo(()=>{Object.assign(n.current,uR({groupId:e}))})}function d_({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:s,groupRef:o,id:a,onLayoutChange:l,onLayoutChanged:c,orientation:u="horizontal",resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){const m=g.useRef({onLayoutChange:{},onLayoutChanged:{}}),v=jc(D=>{Do(m.current.onLayoutChange,D)||(m.current.onLayoutChange=D,l==null||l(D))}),w=jc((D,P)=>{Do(m.current.onLayoutChanged,D)||(m.current.onLayoutChanged=D,c==null||c(D,{isUserInteraction:P}))}),x=l_(a),_=g.useRef(null),[b,S]=uK(),C=g.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),k=c_(_,s);dK(x,o);const T=jc((D,P)=>{const A=jo(),M=gk(D),L=Bs(D);if(L){let $=!1;switch(A.state){case"active":{$=A.hitRegions.some(F=>F.group===M);break}}return{flexGrow:L.layout[P]??1,pointerEvents:$?"none":void 0}}if(n!=null&&n[P])return{flexGrow:n==null?void 0:n[P]}}),I=u_({defaultLayout:n,disableCursor:r}),j=g.useMemo(()=>({get disableCursor(){return!!I.disableCursor},getPanelStyles:T,id:x,orientation:u,registerPanel:D=>{const P=C.current;return P.panels=Xv(u,[...P.panels,D]),S(),()=>{P.panels=P.panels.filter(A=>A!==D),S()}},registerSeparator:D=>{const P=C.current;return P.separators=Xv(u,[...P.separators,D]),S(),()=>{P.separators=P.separators.filter(A=>A!==D),S()}},updatePanelProps:(D,{disabled:P})=>{const A=C.current.panels.find($=>$.id===D);A&&(A.panelConstraints.disabled=P);const M=gk(x),L=Bs(x);M&&L&&Zi(M,{...L,derivedPanelConstraints:Yv(M)})},updateSeparatorProps:(D,{disabled:P,disableDoubleClick:A})=>{const M=C.current.separators.find(L=>L.id===D);M&&(M.disabled=P,M.disableDoubleClick=A)}}),[T,x,S,u,I]),R=g.useRef(null);return Xo(()=>{const D=_.current;if(D===null)return;const P=C.current;let A;if(I.defaultLayout!==void 0&&Object.keys(I.defaultLayout).length===P.panels.length){A={};for(const E of P.panels){const U=I.defaultLayout[E.id];U!==void 0&&(A[E.id]=U)}}const M={disabled:!!i,element:D,id:x,mutableState:{defaultLayout:A,disableCursor:!!I.disableCursor,expandedPanelSizes:C.current.lastExpandedPanelSizes,layouts:C.current.layouts},orientation:u,panels:P.panels,resizeTargetMinimumSize:P.resizeTargetMinimumSize,separators:P.separators};R.current=M;const L=cK(M),{defaultLayoutDeferred:$,derivedPanelConstraints:F,layout:z}=Bs(M.id,!0);!$&&F.length>0&&(v(z),w(z,!1));const B=o_(x,E=>{const{defaultLayoutDeferred:U,derivedPanelConstraints:q,layout:O}=E.next;if(U||q.length===0)return;const te=M.panels.map(({id:G})=>G).join(",");M.mutableState.layouts[te]=O,q.forEach(G=>{if(G.collapsible){const{layout:me}=E.prev??{};if(me){const Ie=kn(G.collapsedSize,O[G.panelId]),ue=kn(G.collapsedSize,me[G.panelId]);Ie&&!ue&&(M.mutableState.expandedPanelSizes[G.panelId]=me[G.panelId])}}});const se=jo().state!=="active";v(O),se&&w(O,E.isUserInteraction)});return()=>{R.current=null,L(),B()}},[i,x,w,v,u,b,I]),g.useEffect(()=>{const D=R.current;D&&(D.mutableState.defaultLayout=n,D.mutableState.disableCursor=!!r)}),h.jsx(hR.Provider,{value:j,children:h.jsx("div",{...p,className:t,"data-group":!0,"data-testid":x,id:x,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:e})})}d_.displayName="Group";function h_(){const e=g.useContext(hR);return ct(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function hK(e,t){const{id:n}=h_(),r=g.useRef({collapse:ug,expand:ug,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ug});g.useImperativeHandle(t,()=>r.current,[]),Xo(()=>{Object.assign(r.current,cR({groupId:n,panelId:e}))})}function jf({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:s,elementRef:o,groupResizeBehavior:a="preserve-relative-size",id:l,maxSize:c="100%",minSize:u="0%",onResize:d,panelRef:f,style:p,...m}){const v=!!l,w=l_(l),x=u_({disabled:s}),_=g.useRef(null),b=c_(_,o),{getPanelStyles:S,id:C,orientation:k,registerPanel:T,updatePanelProps:I}=h_(),j=d!==null,R=jc((M,L,$)=>{d==null||d(M,l,$)});Xo(()=>{const M=_.current;if(M!==null){const L={element:M,id:w,idIsStable:v,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?R:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:i,disabled:x.disabled,maxSize:c,minSize:u}};return T(L)}},[a,n,r,i,j,w,v,c,u,R,T,x]),g.useEffect(()=>{I(w,{disabled:s})},[s,w,I]),hK(w,f);const D=()=>{const M=S(C,w);if(M)return JSON.stringify(M)},P=g.useSyncExternalStore(M=>o_(C,M),D,D);let A;return P?A=JSON.parse(P):i!==void 0?A={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:A={flexGrow:1},h.jsx("div",{...m,"data-disabled":s||void 0,"data-panel":!0,"data-testid":w,id:w,ref:b,style:{...fK,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...A},children:h.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:k==="horizontal"?"pan-y":"pan-x"},children:e})})}jf.displayName="Panel";const fK={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function pK({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,s;const o=e[n],a=t.find(l=>l.panelId===n);if(a){const l=a.maxSize,c=a.collapsible?a.collapsedSize:a.minSize,u=[r,r+1];s=Oo({layout:yu({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Oo({layout:yu({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:o}}function fR({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:s,style:o,...a}){const l=l_(s),c=u_({disabled:n,disableDoubleClick:r}),[u,d]=g.useState({}),[f,p]=g.useState("inactive"),[m,v]=g.useState(!1),w=g.useRef(null),x=c_(w,i),{disableCursor:_,id:b,orientation:S,registerSeparator:C,updateSeparatorProps:k}=h_(),T=S==="horizontal"?"vertical":"horizontal";Xo(()=>{const R=w.current;if(R!==null){const D={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:R,id:l},P=C(D),A=qV(L=>{p(L.next.state!=="inactive"&&L.next.hitRegions.some($=>$.separator===D)?L.next.state:"inactive")}),M=o_(b,L=>{const{derivedPanelConstraints:$,layout:F,separatorToPanels:z}=L.next,B=z.get(D);if(B){const E=B[0],U=B.indexOf(E);d(pK({layout:F,panelConstraints:$,panelId:E.id,panelIndex:U}))}});return()=>{A(),M(),P()}}},[b,l,C,c]),g.useEffect(()=>{k(l,{disabled:n,disableDoubleClick:r})},[n,r,l,k]);let I;n&&!_&&(I="not-allowed");let j;if(n)j="disabled";else switch(f){case"active":{j="active";break}default:m?j="focus":j=f}return h.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":T,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":j,"data-testid":l,id:l,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:x,role:"separator",style:{flexBasis:"auto",cursor:I,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}fR.displayName="Separator";function mK(e){if(!e)return;const t=e.contextUsage,n=e.contextWindowSize;if(!t||!n||n<=0)return;const r=t.inputTokens+(t.cacheReadTokens??0)+(t.cacheCreateTokens??0);if(!(r<=0))return Math.round(r/n*100)}function pR(e,t){const n=Zs(),r=e?`session/${e}`:"",i=Gi(r)??hu,s=g.useCallback(d=>{!e||!r||n.setData(r,f=>p5(f??hu,d,e))},[n,r,e]),o=g.useCallback(()=>{e&&s({type:"session:change",sessionId:e})},[s,e]),a=g.useCallback(d=>{e&&s({type:"permission:clear",sessionId:e,requestId:d})},[s,e]),l=g.useCallback(d=>{e&&s({type:"permission:request",sessionId:e,requestId:d.requestId,tool:d.tool,input:d.input,...d.toolUseId?{toolUseId:d.toolUseId}:{}})},[s,e]),c=g.useCallback(d=>{e&&s({type:"session:question:clear",sessionId:e,toolUseId:d})},[s,e]),u=g.useCallback((d,f)=>{e&&s({type:"session:question:submitted",sessionId:e,toolUseId:d,answers:f})},[s,e]);return{...i,reset:o,clearPermission:a,restorePermission:l,clearQuestion:c,markQuestionSubmitted:u}}function gK(e){return e.kind!=="user-text"?!1:e.meta===void 0||e.meta==="slash-command"||Mp(e.meta)}function vK(e,t={}){let n=0;if(t.implicitCloseOnUserText){for(const r of e)gK(r)&&n++;return n}for(const r of e)r.kind==="turn-end"&&n++;return n}const xK=g.createContext(null);function mR(){return g.useContext(xK)}const yK=50;function _K({api:e,sessionId:t,focused:n=!0,toolSessionId:r,initialTurns:i,implicitCloseOnUserText:s,pageSize:o=yK,enabled:a=!0,refreshVersion:l=0}){const c=mR(),[u,d]=g.useState({messages:[],total:0,loading:!1,error:null}),f=g.useRef(r),p=g.useRef(n),m=g.useRef(null),v=g.useRef(l),w=g.useRef(0),x=g.useRef(!0);return g.useEffect(()=>(x.current=!0,()=>{x.current=!1}),[]),g.useEffect(()=>{const _=f.current;f.current=r;const b=n&&!p.current;if(p.current=n,!a){m.current!==null&&(m.current=null,++w.current,d({messages:[],total:0,loading:!1,error:null}));return}const S=m.current!==t,C=v.current!==l;v.current=l;const k=typeof _=="string"&&_!==r,T=b&&u.error!==null;if(_!==r&&(c==null||c.push({level:"info",msg:"chatflow.history.identity",sessionId:t,meta:{previousToolSessionId:_??null,toolSessionId:r??null,willReload:S||k}})),!S&&!k&&!T&&!C)return;if((S||k)&&d({messages:[],total:0,loading:!1,error:null}),!t){m.current=null;return}m.current=t;const I=++w.current;c==null||c.push({level:"info",msg:"chatflow.history.read.start",sessionId:t,meta:{toolSessionId:r??null,initialTurns:i??null,pageSize:i===void 0?null:o,readSeq:I}}),d(j=>({...j,loading:!0,error:null})),(async()=>{var M;let j=[],R=!1,D,P=i===void 0?{}:{limit:o},A=Number.POSITIVE_INFINITY;for(;;){let L;try{L=await e.historyRead({sessionId:t,...P})}catch(q){if(I!==w.current||!x.current)return;const O=q.message??"history load failed";c==null||c.push({level:"warn",msg:"chatflow.history.read.error",sessionId:t,meta:{readSeq:I,shown:R,errorCode:q&&typeof q=="object"&&"code"in q?String(q.code):null}}),d(te=>({...te,loading:!1,error:O}));return}if(I!==w.current||!x.current)return;c==null||c.push({level:"info",msg:"chatflow.history.read.result",sessionId:t,meta:{readSeq:I,pageMessages:((M=L.messages)==null?void 0:M.length)??0,total:L.total??0,offset:L.offset??null}}),D&&L.snapshotId&&D!==L.snapshotId&&(j=[],R=!1,A=Number.POSITIVE_INFINITY,d({messages:[],total:0,loading:!0,error:null})),D=L.snapshotId,j=[...L.messages??[],...j];const $=L.total??0,F=typeof L.offset=="number"?L.offset:0,z=F>=A,B=F<=0||z;A=F;const E=i!==void 0&&vK(j,{implicitCloseOnUserText:s})>=i;if(R?d({messages:j,total:$,loading:!1,error:null}):(B||E)&&(R=!0,d({messages:j,total:$,loading:!1,error:null})),B)return;const U=Math.max(0,F-o);P={offset:U,limit:F-U,...D?{snapshotId:D}:{}}}})()},[e,t,r,n,o,i,a,l,c]),u}const bK=["TaskCreate","TaskUpdate","TaskList","TaskGet"];function wK(e){return bK.includes(e)}function gR(e){return e==="in_progress"||e==="completed"?e:"pending"}function SK(e,t){if(!t||typeof t!="object")return e;const n=t,r=typeof n.subject=="string"&&n.subject?n.subject:typeof n.content=="string"&&n.content?n.content:null;if(!r)return e;const i=typeof n.activeForm=="string"?n.activeForm:void 0,s=typeof n.description=="string"?n.description:void 0;return[...e,{id:String(e.length+1),content:r,status:gR(n.status),activeForm:i,description:s}]}function kK(e,t){if(!t||typeof t!="object")return e;const n=t,r=typeof n.taskId=="string"&&n.taskId?n.taskId:typeof n.id=="string"&&n.id?n.id:null;if(!r)return e;const i=e.findIndex(a=>a.id===r);if(i<0)return e;const s=[...e],o={...s[i]};return"status"in n&&(o.status=gR(n.status)),typeof n.subject=="string"&&(o.content=n.subject),typeof n.content=="string"&&(o.content=n.content),typeof n.activeForm=="string"&&(o.activeForm=n.activeForm),typeof n.description=="string"&&(o.description=n.description),s[i]=o,s}function CK(e){let t=[],n=-1;for(let r=0;r<e.length;r++){const i=e[r];if(i.kind==="task-event")switch(n=r,i.name){case"TaskCreate":t=SK(t,i.input);break;case"TaskUpdate":t=kK(t,i.input);break}}return{tasks:t,lastEventIndex:n}}function EK(e){return e==="TodoWrite"}function IK(e){if(!e||typeof e!="object")return null;const t=e;if(!Array.isArray(t.todos))return null;const n=[];for(const r of t.todos){if(!r||typeof r!="object")continue;const i=r,s=typeof i.content=="string"?i.content:"";if(!s)continue;const o=i.status==="in_progress"||i.status==="completed"?i.status:"pending",a=typeof i.activeForm=="string"?i.activeForm:void 0;n.push({content:s,status:o,activeForm:a})}return n}function Th(e,t,n){var o;const r=[],i=new Map;for(let a=0;a<e.length;a++){const l=e[a],c=typeof l.seq=="number"?l.seq:a;switch(l.kind){case"session_init":r.push({kind:"session-init",seq:c,toolSessionId:l.toolSessionId});break;case"text":Nk(r,c,"assistant-text",l.text,l.partialId,l.uuid);break;case"thinking":Nk(r,c,"assistant-thinking",l.text,l.partialId);break;case"user_text":{l.meta==="task-notification"?r.push({kind:"agent-notification",seq:c,text:l.text,taskId:l.taskId,parentToolUseId:l.parentToolUseId}):l.meta?r.push({kind:"user-meta",seq:c,metaKind:l.meta,text:l.text}):r.push({kind:"user-text",seq:c,text:l.text,uuid:l.uuid,...l.sender&&(l.sender.principal!=="owner"||s5.test(l.text))?{senderDisplayName:l.sender.displayName}:{},senderPrincipal:((o=l.sender)==null?void 0:o.principal)==="guest"?"guest":"owner"});break}case"tool_call":vR(r,c,l.toolUseId,l.tool,l.input,l.toolKind);break;case"tool_result":{const u=i.get(l.toolUseId);if(u!==void 0){if(l.askQuestionAnswers){const f=r[u];f.submittedAnswers=l.askQuestionAnswers}i.delete(l.toolUseId);break}const d={kind:"tool-result",seq:c,toolUseId:l.toolUseId,output:l.output,error:l.error};l.toolResultExtra&&(d.toolResultExtra=l.toolResultExtra),r.push(d);break}case"attachment_memories":r.push({kind:"memory-callout",seq:c,memories:l.memories});break;case"permission_request":{if(!t||l.requestId!==t)break;r.push({kind:"permission-inline",seq:c,requestId:l.requestId,tool:l.tool,input:l.input});break}case"ask_user_question":i.set(l.toolUseId,r.length),r.push({kind:"question-card",seq:c,toolUseId:l.toolUseId,questions:l.questions});break;case"turn_end":{const u={kind:"turn-end",seq:c};l.durationMs!==void 0&&(u.durationMs=l.durationMs),l.reason!==void 0&&(u.reason=l.reason),l.turnId!==void 0&&(u.turnId=l.turnId),r.push(u);break}case"subagent_progress":{const u={kind:"agent-progress",seq:c,toolUseId:l.toolUseId,agentId:l.agentId,status:l.status};l.description&&(u.description=l.description),l.lastToolName&&(u.lastToolName=l.lastToolName),l.prompt&&(u.prompt=l.prompt),l.stats&&(u.stats=l.stats),r.push(u);break}case"error":r.push({kind:"error",seq:c,message:l.message});break}}const s=new Map(e.flatMap((a,l)=>a.turnId?[[a.seq??l,a.turnId]]:[]));for(const a of r){const l=s.get(a.seq);l&&(a.turnId=l)}return r}function vR(e,t,n,r,i,s){if(EK(r)){const o=IK(i);if(o){e.push({kind:"todo-checklist",seq:t,toolUseId:n,todos:o});return}}if(r==="Agent"){const o=i??{},a=typeof o.description=="string"&&o.description?o.description:typeof o.subagent_type=="string"&&o.subagent_type?o.subagent_type:"Subagent";e.push({kind:"agent-call",seq:t,toolUseId:n,description:a,input:i});return}if(wK(r)){e.push({kind:"task-event",seq:t,toolUseId:n,name:r,input:i});return}e.push({kind:"tool-call",seq:t,toolUseId:n,tool:r,toolKind:s,input:i})}function Nk(e,t,n,r,i,s){let o=-1;for(let c=e.length-1;c>=0;c--)if(e[c].kind===n){o=c;break}const a=o>=0?e[o]:null;if(i){if(a&&a.partialId===i){const u=n==="assistant-text"?{kind:n,seq:a.seq,text:a.text+r,partialId:i,...s?{uuid:s}:{}}:{kind:n,seq:a.seq,text:a.text+r,partialId:i};e[o]=u;return}const c=n==="assistant-text"?{kind:n,seq:t,text:r,partialId:i,...s?{uuid:s}:{}}:{kind:n,seq:t,text:r,partialId:i};e.push(c);return}if(a&&a.partialId){const c=n==="assistant-text"?{kind:n,seq:a.seq,text:r,...s?{uuid:s}:{}}:{kind:n,seq:a.seq,text:r};e[o]=c;return}const l=n==="assistant-text"?{kind:n,seq:t,text:r,...s?{uuid:s}:{}}:{kind:n,seq:t,text:r};e.push(l)}const TK="AskUserQuestion";function f_(e,t=0,n){var o;const r=[],i=new Map;let s=t;for(const a of e){const l=s++,c=a.toolUseId??`hist-${l}`;switch(a.kind){case"user-text":if(a.meta==="task-notification")r.push({kind:"agent-notification",seq:l,text:a.text??"",taskId:a.taskId,parentToolUseId:a.parentToolUseId});else if(a.meta)r.push({kind:"user-meta",seq:l,metaKind:a.meta,text:a.text??""});else{const u=s5.exec(a.text??""),d=(o=q9.exec(a.text??""))==null?void 0:o[1],f=(u==null?void 0:u[2])??d,p=(u==null?void 0:u[1])==="guest"||d?"guest":"owner";r.push({kind:"user-text",seq:l,text:a.text??"",uuid:a.uuid,...f?{senderDisplayName:f}:{},senderPrincipal:p})}break;case"assistant-text":r.push({kind:"assistant-text",seq:l,text:a.text??"",uuid:a.uuid});break;case"tool_call":{if(a.tool===TK){const u=a.input??{},d=Array.isArray(u.questions)?u.questions:[];i.set(c,r.length),r.push({kind:"question-card",seq:l,toolUseId:c,questions:d});break}vR(r,l,c,a.tool??"",a.input,n);break}case"tool_result":{const u=i.get(c);if(u!==void 0){if(a.askQuestionAnswers){const f=r[u];f.submittedAnswers=a.askQuestionAnswers}i.delete(c);break}const d={kind:"tool-result",seq:l,toolUseId:c,output:a.output};a.error!==void 0&&(d.error=a.error),a.toolResultExtra&&(d.toolResultExtra=a.toolResultExtra),r.push(d);break}case"attachment_memories":a.memories&&a.memories.length>0&&r.push({kind:"memory-callout",seq:l,memories:a.memories});break;case"summary":break;case"turn-end":{const u={kind:"turn-end",seq:l};typeof a.durationMs=="number"&&(u.durationMs=a.durationMs),typeof a.turnId=="string"&&(u.turnId=a.turnId),r.push(u);break}}}return r}const NK=5e5;function RK(e){const t=NK-e.length;return e.map(n=>({...n,seq:n.seq+t}))}const _r=e=>typeof e=="string"?e:"",Rk=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];function PK(e){var s;if(e.type==="userMessage"){const a=(Array.isArray(e.content)?e.content:[]).map(c=>c.type==="text"?_r(c.text):c.type==="image"?`})`:c.type==="localImage"?`[图片](${_r(c.path)})`:"").filter(Boolean).join(`
|
|
517
517
|
`),l=V9(a);return f_([{kind:"user-text",text:a,uuid:e.id,...l?{meta:l==="task"?"dispatch-task":"dispatch-result"}:{}}],0,"codex")}if(e.type==="agentMessage")return[{kind:"assistant-text",seq:0,text:_r(e.text),uuid:e.id}];if(e.type==="reasoning")return[{kind:"assistant-thinking",seq:0,text:[...Rk(e.summary),...Rk(e.content)].join(`
|
|
518
518
|
`)}];if(e.type==="plan")return[{kind:"assistant-text",seq:0,text:_r(e.text),uuid:e.id}];if(e.type==="hookPrompt"||e.type==="contextCompaction")return[];if(e.type==="subAgentActivity"){const o=_r(e.agentThreadId);return e.kind==="started"?Th([{kind:"tool_call",tool:"Agent",toolKind:"codex",toolUseId:`codex-agent-${o}`,input:{agentId:o,description:_r(e.agentPath)}}]):e.kind==="completed"||e.kind==="interrupted"?Th([{kind:"tool_result",toolUseId:`codex-agent-${o}`,output:e.kind==="completed"?"已完成":"已中断"}]):[]}const t=e.type==="mcpToolCall"?`${_r(e.server)}.${_r(e.tool)}`:e.type==="dynamicToolCall"?_r(e.tool):e.type,n=e.type==="commandExecution"?{command:e.command,cwd:e.cwd}:e.type==="fileChange"?{changes:e.changes}:e.arguments??e,r=e.type==="commandExecution"?e.aggregatedOutput:e.type==="fileChange"?(Array.isArray(e.changes)?e.changes:[]).map(o=>_r(o.diff)).join(`
|
|
519
|
-
`):e.result??e.contentItems??e.output??e,i=e.status==="failed"||e.status==="declined"||e.success===!1?_r((s=e.error)==null?void 0:s.message)||"执行失败":e.type==="commandExecution"&&typeof e.exitCode=="number"&&e.exitCode!==0?`exit ${e.exitCode}`:void 0;return Th([{kind:"tool_call",tool:t,toolKind:"codex",toolUseId:e.id,input:n},{kind:"tool_result",toolUseId:e.id,output:r,...i?{error:i}:{}}])}function AK(e,t,n){const r=new Set,s=(t===void 0?e.items:[...e.items.filter(a=>a.type==="userMessage"&&!t.some(l=>l.id===a.id)),...t,...e.items.filter(a=>a.type!=="userMessage"&&!t.some(l=>l.id===a.id))]).flatMap(a=>r.has(a.id)?[]:(r.add(a.id),PK(a)));let o=!1;for(const a of s)a.kind==="user-text"&&(o&&(a.continuesTurn=!0),o=!0);return e.error&&s.push({kind:"error",seq:0,message:e.error.message}),s.push({kind:"turn-end",seq:0,turnId:e.id,...e.durationMs!==null?{durationMs:e.durationMs}:{},reason:e.status==="interrupted"?"interrupted":"completed"}),s.map((a,l)=>({...a,seq:n+l}))}function MK(e,t){const n=new Map,r=[];let i=[];for(const c of e)c.kind==="turn-end"&&c.turnId?(n.set(c.turnId,{order:n.size,body:i,end:c}),r.push(c.turnId),i=[]):i.push(c);r.push(i);const s=[];let o=-1;const a=c=>{const u=new Set(c.flatMap(_=>_.turnId?[_.turnId]:[])),d=c.at(-1),f=(d==null?void 0:d.kind)==="turn-end"&&d.turnId?n.get(d.turnId):void 0;if(f&&(d==null?void 0:d.kind)==="turn-end"&&u.size>1){f.end={...f.end,...d,seq:f.end.seq,reason:d.reason??"completed"},o=Math.max(o,f.order),a(c.slice(0,-1));return}const p=u.size===1?[...u][0]:void 0,m=p?n.get(p):void 0;if(!p||!m){s.push(...c);return}const v=o<0?c.some(_=>_.kind==="session-init"):m.order>o,w=c.some(_=>_.kind!=="turn-end"&&_.turnId===p);let x=0;for(const _ of c){if(_.kind==="turn-end"){m.end={...m.end,..._,seq:m.end.seq,reason:_.reason??"completed"},o=Math.max(o,m.order);continue}if(_.kind==="session-init")continue;const b=_.kind==="user-text"||_.kind==="user-meta";b||(x=Math.max(x,m.body.findIndex(I=>I.kind==="user-text"||I.kind==="user-meta")+1));const S=m.body.findIndex((I,j)=>j>=x&&LK(I,_)),C=m.body[S],k=C&&"uuid"in C&&C.uuid&&"uuid"in _&&C.uuid===_.uuid,T=_.turnId===p||k||v&&w;if(b&&(S<0||!T)){s.push(_);continue}if(S>=0){const I=m.body[S];m.body[S]={...I,..._,..."text"in I&&"text"in _&&I.text.length>_.text.length?{text:I.text}:{}},x=S+1}else m.body.splice(x++,0,_)}};let l=[];for(const c of t)l.push(c),c.kind==="turn-end"&&(a(l),l=[]);return a(l),[...r.flatMap(c=>{if(typeof c!="string")return c;const u=n.get(c);return[...u.body,u.end]}),...s]}function LK(e,t){if(e.kind!==t.kind)return!1;const n="uuid"in t&&t.uuid||"partialId"in t&&t.partialId;return"uuid"in e&&e.uuid&&n?e.uuid===n:"toolUseId"in e&&"toolUseId"in t?e.toolUseId===t.toolUseId:"text"in e&&"text"in t?e.text===t.text:!1}const Ud=()=>({turns:[],details:{},nextCursor:null,loading:!1,loadingOlder:!1,error:null});function dg(e,t){if(e.view!==t||!Array.isArray(e.data))throw new Error("历史分页需要更新对端 daemon;未退回全量加载")}function jK(e){const{api:t,sessionId:n,toolSessionId:r,forkedFromSessionId:i,initialTurnStarted:s=!1,enabled:o,focused:a=!0,refreshVersion:l=0}=e,c=`${o}:${n}:${r??""}`,u=g.useRef(c);u.current=c;const d=g.useRef(0),f=g.useRef(!0),[p,m]=g.useState(Ud),v=g.useRef(p);v.current=p;const w=g.useRef(!1),x=g.useRef(new Set),_=g.useRef(),b=g.useRef({sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:!!r});g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const S=g.useCallback(async()=>{if(!o||!r)return;_.current={identity:c,version:l,api:t};const j=++d.current,R=c;w.current=!1,x.current.clear(),m(D=>({...D,loading:!0,loadingOlder:!1,error:null}));try{const D=await t.historyPage({sessionId:n,view:"turns",limit:10});if(dg(D,"turns"),!f.current||d.current!==j||u.current!==R||D.view!=="turns")return;m({...Ud(),turns:[...D.data].reverse(),snapshotId:D.snapshotId,nextCursor:D.nextCursor})}catch(D){if(!f.current||d.current!==j||u.current!==R)return;m(P=>({...P,loading:!1,error:D.message}))}},[t,c,o,r,n,l]);g.useEffect(()=>{const j=b.current,R=j.sessionId===n&&j.enabled,D=!!r||R&&j.hasAssignedThread;if(b.current={sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:D},!o||!r){d.current++,_.current=void 0,m(Ud());return}if(!a)return;const P=!!i&&!j.hasAssignedThread;if(R&&j.focused&&!j.toolSessionId&&s&&!P&&j.refreshVersion===l&&j.api===t){_.current={identity:c,version:l,api:t,deferred:!0};return}const A=_.current,M=R&&!j.focused&&((A==null?void 0:A.deferred)||v.current.error!==null);(A==null?void 0:A.identity)===c&&A.version===l&&A.api===t&&!M||(((A==null?void 0:A.identity)!==c||A.api!==t)&&m(Ud()),_.current={identity:c,version:l,api:t},S())},[t,c,n,o,r,i,s,a,l,S]);const C=g.useCallback(async()=>{const j=v.current;if(!o||j.loading||w.current||!j.nextCursor||!j.snapshotId)return;const R=d.current,D=c;w.current=!0,m(P=>({...P,loadingOlder:!0,error:null}));try{const P=await t.historyPage({sessionId:n,view:"turns",limit:10,cursor:j.nextCursor,snapshotId:j.snapshotId});if(dg(P,"turns"),!f.current||R!==d.current||D!==u.current||P.view!=="turns")return;if(P.snapshotId!==j.snapshotId||P.nextCursor===j.nextCursor)throw new Error("历史分页快照或游标失效,请刷新历史");m(A=>{const M=new Set(A.turns.map(L=>L.id));return{...A,turns:[...P.data.filter(L=>!M.has(L.id)).reverse(),...A.turns],nextCursor:P.nextCursor,loadingOlder:!1}})}catch(P){f.current&&R===d.current&&D===u.current&&m(A=>({...A,loadingOlder:!1,error:P.message}))}finally{R===d.current&&(w.current=!1)}},[t,o,c,n]),k=g.useCallback(async(j,R=!1)=>{const D=v.current,P=D.details[j];if(!o||D.loading||!D.snapshotId||x.current.has(j)||P&&!P.error&&!R||R&&!(P!=null&&P.nextCursor))return;const A=d.current,M=c;x.current.add(j);const L=P??{items:[],loading:!1,error:null,nextCursor:null};m($=>({...$,details:{...$.details,[j]:{...L,loading:!0,error:null}}}));try{const $=await t.historyPage({sessionId:n,view:"items",turnId:j,limit:50,snapshotId:D.snapshotId,...P!=null&&P.nextCursor?{cursor:P.nextCursor}:{}});if(dg($,"items"),!f.current||A!==d.current||M!==u.current||$.view!=="items")return;if($.snapshotId!==D.snapshotId||P!=null&&P.nextCursor&&$.nextCursor===P.nextCursor)throw new Error("轮次详情快照或游标失效,请刷新历史");if($.data.some(B=>B.turnId!==j))throw new Error("轮次详情身份不匹配");const F=new Set(L.items.map(B=>B.id)),z=[...L.items,...$.data.map(B=>B.item).filter(B=>!F.has(B.id))];m(B=>({...B,details:{...B.details,[j]:{items:z,loading:!1,error:null,nextCursor:$.nextCursor}}}))}catch($){f.current&&A===d.current&&M===u.current&&m(F=>({...F,details:{...F.details,[j]:{...L,loading:!1,error:$.message}}}))}finally{A===d.current&&x.current.delete(j)}},[t,o,c,n]),T=g.useMemo(()=>p.turns.flatMap((j,R)=>{var D;return AK(j,(D=p.details[j.id])==null?void 0:D.items,(R-p.turns.length)*1e6)}),[p.turns,p.details]),I=g.useMemo(()=>T.map(j=>({kind:j.kind,..."text"in j?{text:j.text}:{},..."uuid"in j?{uuid:j.uuid}:{}})),[T]);return{...p,lines:T,messages:I,total:p.turns.length,loadOlder:C,loadDetails:k,refresh:S}}const DK=/<command-name>([\s\S]*?)<\/command-name>/i,OK=/<command-message>([\s\S]*?)<\/command-message>/i,BK=/<command-args>([\s\S]*?)<\/command-args>/i,zK=/<(local-command-[a-z]+|command-(?:stdout|stderr))>[\s\S]*?<\/\1>/gi;function Xp(e){if(!e)return{commandName:null,commandMessage:null,commandArgs:null,body:""};const t=e.match(DK),n=e.match(OK),r=e.match(BK);let i=e;return t&&(i=i.replace(t[0],"")),n&&(i=i.replace(n[0],"")),r&&(i=i.replace(r[0],"")),i=i.replace(zK,""),i=i.trim(),{commandName:t?t[1].trim():null,commandMessage:n?n[1].trim():null,commandArgs:r?r[1].trim():null,body:i}}function Pk(e){const t=Xp(e);return t.commandName?t.commandArgs?`${t.commandName} ${t.commandArgs}`:t.commandName:e}function Ak(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Mp(e.metaKind)}function $K(e,t){const n=t.find(Ak);if(!n)return e;const r=Pk(n.text);for(let s=e.length-1;s>=0;s--){const o=e[s];if(Ak(o)&&Pk(o.text)===r)return e.slice(0,s)}const i=e[e.length-1];return i!==void 0&&i.kind!=="turn-end"?[...e,{kind:"turn-end",seq:i.seq+1}]:e}function FK(e){return e==="running"||e==="observing"}function xR(e){return e==="running"||e==="running-idle"||e==="observing"}const HK=1e6,UK=5;function yR(e,t=!0){const n=mR(),r=es(),i=g.useMemo(()=>new wy(r),[r]),s=Gi("sessions"),o=g.useMemo(()=>s==null?void 0:s.find(ie=>ie.sessionId===e),[s,e]),a=o==null?void 0:o.toolSessionId,l=o==null?void 0:o.tool,[c,u]=g.useState(0),[d,f]=g.useState(null),p=Zs(),m=g.useRef(p);m.current=p;const[v,w]=g.useState(null),x=g.useRef(null),_=g.useRef(null);g.useEffect(()=>(f(null),w(null),_.current=null,r.on("session:control",ie=>{const We=ie;if(!((We==null?void 0:We.sessionId)!==e||We.kind!==l9))if(We.synchronized===!0){const Ce=m.current.read(`session/${e}`);Ce!=null&&Ce.events.length&&w({first:Ce.events[0],count:Ce.events.length,historyBefore:x.current}),f(null),u($e=>$e+1)}else f("断线期间的部分内容未显示,完整内容已保存在云端")})),[r,e]);const b=g.useCallback(()=>{const ie=m.current.read(`session/${e}`),We=(ie==null?void 0:ie.events)??[];let Ce=We.length;for(;Ce>0&&We[Ce-1].kind!=="turn_end";)Ce--;Ce>0&&w({first:We[0],count:Ce,historyBefore:x.current}),_.current={historyBefore:x.current},u($e=>$e+1)},[e]),S=pR(e),{events:C,pendingPermissions:k,queued:T,status:I,clearPermission:j,restorePermission:R}=S,D=yz(),P=l==="codex",A=_K({api:i,sessionId:e,focused:t,toolSessionId:a,enabled:D!==void 0&&!P,refreshVersion:c,initialTurns:D==="owner"?void 0:UK,implicitCloseOnUserText:l==="codex"}),M=jK({api:i,sessionId:e,focused:t,toolSessionId:a,forkedFromSessionId:o==null?void 0:o.forkedFromSessionId,initialTurnStarted:C.some(ie=>ie.kind==="user_text"),enabled:D!==void 0&&P,refreshVersion:c}),L=P?M:A,$=g.useMemo(()=>({details:M.details,turnIds:new Set(M.turns.map(ie=>ie.id)),loadDetails:M.loadDetails}),[M.details,M.turns,M.loadDetails]);x.current=L.messages,g.useEffect(()=>{const ie=_.current;!ie||L.loading||L.messages===ie.historyBefore||(_.current=null,f(null))},[L.messages,L.loading]);const F=g.useMemo(()=>L.messages.filter(ie=>!ie.isSidechain),[L.messages]),z=g.useMemo(()=>{const ie=v;return!ie||L.messages===ie.historyBefore||L.loading||C[0]!==ie.first||C.length<ie.count?C:C.slice(ie.count)},[C,v,L.messages,L.loading]),B=g.useMemo(()=>P?M.lines:RK(f_(F,0,l)),[F,l,P,M.lines]),E=k[0]??null,U=g.useMemo(()=>Th(z,(E==null?void 0:E.requestId)??null),[z,E==null?void 0:E.requestId]),q=g.useMemo(()=>P?B:$K(B,U),[B,U,P]),O=g.useMemo(()=>U.map((ie,We)=>({...ie,seq:HK+We})),[U]),te=g.useMemo(()=>P?MK(q,O):[...q,...O],[q,O,P]),se=g.useRef(L.messages);g.useEffect(()=>{se.current!==L.messages&&(se.current=L.messages,!L.loading&&(n==null||n.push({level:"info",msg:"chatflow.history.display",sessionId:e,meta:{historyMessages:L.messages.length,mainChainMessages:F.length,historyLines:q.length,panelLines:te.length,total:L.total,error:L.error!==null}})))},[L.messages,L.loading,L.total,L.error,F.length,q.length,te.length,n,e]);const G=xR(I),me=FK(I),Ie=(o==null?void 0:o.resolvedModel)??(o==null?void 0:o.model),ue=g.useMemo(()=>({sessionLabel:(o==null?void 0:o.label)||(o==null?void 0:o.aiLabel)||(o==null?void 0:o.larkChatName)||(o==null?void 0:o.larkChatId)||e,sessionId:e,...o!=null&&o.larkChatId?{larkChatName:o.larkChatName??o.larkChatId,larkChatType:o.larkChatType??"group"}:{},...Ie?{model:Ie}:{},...(()=>{const ie=o==null?void 0:o.gitBranch;return ie?{gitBranch:ie}:{}})(),...(()=>{const ie=mK(o);return ie!==void 0?{contextPct:ie}:{}})(),...o!=null&&o.cwd?{cwd:o.cwd}:{},...(()=>{const ie=o==null?void 0:o.permissionMode;return ie?{permissionMode:ie}:{}})(),procAlive:G,streamInProgress:me,pinnedAt:(o==null?void 0:o.pinnedAt)??null}),[o,e,Ie,G,me]),Ae=g.useMemo(()=>r.isOpen?I==="error"?{kind:"error",message:"session error"}:{kind:"ready"}:{kind:"closed"},[r.isOpen,I]),Oe=g.useCallback(async(ie,We)=>{await i.sessionSend(e,ie,We)},[i,e]),je=g.useCallback(async ie=>{await i.sessionDequeue(e,ie)},[i,e]),ge=g.useCallback(async()=>(await i.sessionInterrupt(e)).queued??[],[i,e]),Ze=g.useCallback(async ie=>{if(!(o!=null&&o.cwd)||!a)throw new Error("fork requires sessionFile with cwd + toolSessionId");await i.sessionFork({cwd:o.cwd,toolSessionId:a,messageUuid:ie})},[i,o==null?void 0:o.cwd,a]),dt=g.useCallback(async ie=>{await i.sessionRewind({sessionId:e,userMessageId:ie,dryRun:!1})},[i,e]),nt=g.useCallback(async ie=>{await i.sessionUpdate(e,{model:ie})},[i,e]),vt=g.useCallback(async()=>{await i.sessionNew(e)},[i,e]),jt=g.useCallback(async(ie,We)=>{const Ce=k.find($e=>$e.requestId===ie);Ce&&j(ie);try{await i.permissionRespond({sessionId:e,permissionRequestId:ie,allow:We==="allow"})}catch($e){throw!(($e==null?void 0:$e.message)??"").startsWith("PERMISSION_REQUEST_STALE")&&Ce&&R(Ce),$e}},[i,e,k,j,R]);return g.useMemo(()=>({lines:te,connState:Ae,meta:ue,historyLoading:L.loading,historyError:L.error,...P?{codexHistory:$,historyHasMore:M.nextCursor!==null,historyLoaded:M.snapshotId!==void 0,historyLoadingOlder:M.loadingOlder,loadOlderHistory:M.loadOlder,refreshHistory:M.refresh}:{},historySyncError:d,pendingPermissions:k,queued:T,sendText:Oe,dequeue:je,interrupt:ge,fork:Ze,rewind:dt,switchModel:nt,clearSession:vt,respondPermission:jt,reloadFromCloud:b}),[te,Ae,ue,L.loading,L.error,P,$,M.nextCursor,M.snapshotId,M.loadingOlder,M.loadOlder,M.refresh,d,k,T,Oe,je,ge,Ze,dt,nt,vt,jt,b])}const WK={codex:"on-request",claude:"bypassPermissions",pi:"never"};function qK(e){const t={cwd:e.cwd,permissionMode:e.sourcePermissionMode??WK[e.sourceTool??"claude"]??"bypassPermissions",forkedFromSessionId:e.sourceSessionId};return e.sourceOwnerPersonaId&&(t.ownerPersonaId=e.sourceOwnerPersonaId),e.sourceTool&&(t.tool=e.sourceTool),e.sourceModel&&(t.model=e.sourceModel),e.sourceEffort&&(t.effort=e.sourceEffort),e.sourceProjectPath&&(t.projectPath=e.sourceProjectPath),t}async function VK(e,t,n,r={}){if(!t.toolSessionId)return null;const i=await e.sessionCreate({...qK({cwd:t.cwd,sourceSessionId:t.sessionId,sourcePermissionMode:t.permissionMode,sourceOwnerPersonaId:t.ownerPersonaId,sourceTool:t.tool,sourceModel:t.model,sourceEffort:t.effort,sourceProjectPath:t.projectPath}),...r.ephemeral?{ephemeral:!0}:{}});try{const{forkedToolSessionId:s}=await e.sessionFork({cwd:t.cwd,toolSessionId:t.toolSessionId,...t.tool==="codex"?{sourceSessionId:t.sessionId,turnId:n}:{messageUuid:n},targetCwd:i.cwd});await e.sessionResume(i.sessionId,s)}catch(s){throw e.sessionDelete(i.sessionId).catch(o=>De("quick-ask","fork rollback failed",o)),s}return i}async function KK(e,t,n){return VK(e,t,n,{ephemeral:!0})}function Wd(e){return e!=null&&e.ephemeral!==!1}async function GK(e,t){return t.stillEphemeral?(await e.sessionUpdate(t.sessionId,{ephemeral:!1}),!0):!1}function YK(e){try{const t=new URL(e);return t.protocol==="ws:"?t.protocol="http:":t.protocol==="wss:"&&(t.protocol="https:"),`${t.protocol}//${t.host}`}catch{return e}}function XK(e,t){try{const n=new URL(e),r=new URL(t);return n.protocol=r.protocol,n.host=r.host,n.toString()}catch{return e}}async function p_(e,t,n,r,i){const s=await e.attachmentSignUrl({sessionId:n,relPath:r,...i!==void 0?{ttlSeconds:i}:{}});return XK(s.url,YK(t.url))}async function Mk(e,t,n,r,i=60,s){const o=window.open("about:blank","_blank");try{s&&await s();const a=await p_(e,t,n,r,i);o?o.location.href=a:window.open(a,"_blank")}catch(a){throw o&&o.close(),a}}async function ZK(e){var t;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.setAttribute("readonly",""),document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}const QK=300;function JK(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function eG(e,t){const n=Y1(),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>{let a=!1;return(async()=>{try{const l=await n.kv.get(e);if(a)return;const c=JK(l);typeof c=="number"&&Number.isFinite(c)&&c>0?i(c):i(t)}catch{a||i(t)}})(),()=>{a=!0}},[n,e,t]);const o=g.useCallback(a=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,n.kv.set(e,a).catch(()=>{})},QK)},[n,e]);return g.useEffect(()=>()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),{initialSize:r??t,setSize:o,loading:r===null}}function tG(){return{quickAsk:null,mds:[],active:null}}function nG(e,t){return{...e,quickAsk:{sessionId:t.sessionId,ephemeral:!0},active:"quick-ask"}}function rG(e,t){const n=e.mds.includes(t);return{...e,mds:n?e.mds:[...e.mds,t],active:{kind:"md",relPath:t}}}function iG(e){if(!e.quickAsk)return e;const t=e.active==="quick-ask",n=e.mds[0],r=t?n?{kind:"md",relPath:n}:null:e.active;return{...e,quickAsk:null,active:r}}function sG(e){return e.quickAsk?{...e,quickAsk:{...e.quickAsk,ephemeral:!1}}:e}function oG(e,t){const n=e.mds.indexOf(t);if(n<0)return e;const r=e.mds.filter(l=>l!==t);if(!(e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===t))return{...e,mds:r};const s=r[n],o=n>0?r[n-1]:void 0;let a=null;return s?a={kind:"md",relPath:s}:o?a={kind:"md",relPath:o}:e.quickAsk&&(a="quick-ask"),{...e,mds:r,active:a}}function aG(e,t){return{...e,active:t}}function lG(e,t){return e===null||t===null||e==="quick-ask"||t==="quick-ask"?e===t:e.relPath===t.relPath}function _R(e){return e.quickAsk!==null||e.mds.length>0}function cG(e,t,n,r=!0){const i=g.useRef({sid:null,tsid:void 0});g.useEffect(()=>{const s=i.current;i.current={sid:t,tsid:n},!(!r||!n||s.sid===t&&(s.tsid===void 0||s.tsid===null)&&typeof n=="string")&&e.sessionObserve({sessionId:t,toolSessionId:n}).catch(()=>{})},[e,t,n,r])}function uG(e,t,n){const r=g.useRef(e),i=g.useRef(t),s=g.useRef(n);s.current=n,g.useEffect(()=>{const o=r.current,a=i.current;r.current=e,i.current=t;const l=o!==e,c=typeof a=="string"&&t==null;!l&&!c||s.current()},[e,t])}const dG=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function hG(e){const t=new Map,n=new Map,r=new Map;for(const i of e)if(i.kind==="tool_call"&&i.tool==="CronCreate"){const s=i.input;if(!s||typeof s.cron!="string"||typeof s.prompt!="string")continue;const o=i.ts;t.set(i.toolUseId,{cron:s.cron,prompt:s.prompt,recurring:s.recurring!==!1,ts:typeof o=="string"?o:"",toolUseId:i.toolUseId})}else if(i.kind==="tool_call"&&i.tool==="CronDelete"){const s=i.input;if(!s||typeof s.id!="string")continue;n.set(i.toolUseId,s.id)}else if(i.kind==="tool_result"){const s=t.get(i.toolUseId);if(s){if(t.delete(i.toolUseId),i.error||typeof i.output!="string")continue;const a=i.output.match(dG);if(!a)continue;r.set(a[1],{id:a[1],cron:s.cron,prompt:s.prompt,recurring:s.recurring,humanSchedule:a[2],createdAt:s.ts,toolUseId:s.toolUseId});continue}const o=n.get(i.toolUseId);o!==void 0&&(n.delete(i.toolUseId),i.error||r.delete(o))}return Array.from(r.values()).sort((i,s)=>i.createdAt.localeCompare(s.createdAt))}function bR(e){var n;if(e.error)return!1;if(e.pending)return!0;if(e.notifications.length>0)return!1;const t=(n=e.progress)==null?void 0:n.status;return t==="running"?!0:t==="started"?fG(e.input):!1}function fG(e){return!e||typeof e!="object"?!1:e.run_in_background===!0}function pG(e){return e.filter(t=>t.kind==="merged-agent"&&bR(t))}function wR(e){var d;const{tasks:t,lastEventIndex:n}=CK(e);let r=-1;for(let f=e.length-1;f>=0;f--)if(e[f].kind==="todo-checklist"){r=f;break}const i=[],s=new Map,o=new Map,a=new Map,l=new Map,c=new Map,u=(f,p)=>{var _,b,S,C,k,T;const m=i[f],v=c.get(f),w=v!==void 0&&v!==p.toolUseId;if(!w&&(((_=m.progress)==null?void 0:_.status)==="completed"||((b=m.progress)==null?void 0:b.status)==="failed"))return;if(c.set(f,p.toolUseId),l.set(p.agentId,f),w&&(m.pending=!0,(S=m.toolResultExtra)!=null&&S.stats)){const{stats:I,...j}=m.toolResultExtra;m.toolResultExtra=j}const x={agentId:p.agentId,status:p.status};p.description?x.description=p.description:(C=m.progress)!=null&&C.description&&(x.description=m.progress.description),p.lastToolName?x.lastToolName=p.lastToolName:!w&&((k=m.progress)!=null&&k.lastToolName)&&(x.lastToolName=m.progress.lastToolName),p.stats?x.stats=p.stats:!w&&((T=m.progress)!=null&&T.stats)&&(x.stats=m.progress.stats),m.progress=x,(p.status==="completed"||p.status==="failed")&&(m.pending=!1)};for(let f=0;f<e.length;f++){const p=e[f];switch(p.kind){case"tool-call":{const m={kind:"merged-tool",seq:p.seq,tool:p.tool,toolKind:p.toolKind,toolUseId:p.toolUseId,input:p.input,pending:!0};s.set(p.toolUseId,i.length),i.push(m);break}case"tool-result":{const m=s.get(p.toolUseId);if(m!==void 0){const w=i[m];w.output=p.output,w.error=p.error,w.pending=!1,s.delete(p.toolUseId);break}const v=o.get(p.toolUseId);if(v!==void 0){const w=i[v];w.output=p.output,w.error=p.error,w.pending=!1,p.toolResultExtra&&(w.toolResultExtra=p.toolResultExtra),(d=p.toolResultExtra)!=null&&d.agentId&&(l.set(p.toolResultExtra.agentId,v),c.set(v,p.toolUseId));break}break}case"agent-call":{const m={kind:"merged-agent",seq:p.seq,toolUseId:p.toolUseId,description:p.description,input:p.input,pending:!0,notifications:[]},v=i.length;o.set(p.toolUseId,v),i.push(m);const w=a.get(p.toolUseId);w&&(u(v,w),a.delete(p.toolUseId));break}case"agent-progress":{const m=o.get(p.toolUseId)??l.get(p.agentId);if(m!==void 0){u(m,p);break}const v=a.get(p.toolUseId);if((v==null?void 0:v.status)==="completed"||(v==null?void 0:v.status)==="failed")break;a.set(p.toolUseId,p);break}case"agent-notification":{const m=(p.parentToolUseId?o.get(p.parentToolUseId):void 0)??(p.taskId?l.get(p.taskId):void 0);if(m!==void 0){i[m].notifications.push({text:p.text,taskId:p.taskId});break}i.push({kind:"agent-notification",seq:p.seq,text:p.text,taskId:p.taskId,parentToolUseId:p.parentToolUseId});break}case"todo-checklist":{f===r&&p.todos.length>0&&i.push({kind:"todo-checklist",seq:p.seq,toolUseId:p.toolUseId,todos:p.todos});break}case"task-event":{f===n&&t.length>0&&i.push({kind:"plan-card",seq:p.seq,tasks:t});break}default:i.push(p)}}return i}const mG=new Set(["permission-inline","question-card"]);function gG(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Mp(e.metaKind)}function vG(e){return e.kind==="user-text"&&e.continuesTurn===!0}function xG(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(yG(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,!0);continue}if(gG(s)&&(r===null||!vG(s))){i(void 0,!0),r={query:s,body:[]};continue}r===null?r={body:[s]}:r.body.push(s)}return i(void 0,t.closeTrailing===!0),n}function yG(e,t,n){const{query:r,body:i}=e,s=_G(i,t,n),o=bG(i,s),a=SG(i,o),l=r??i[0]??t,c={kind:"turn",seq:l?l.seq:0,status:s,process:a,tail:o};return t!=null&&t.turnId&&(c.turnId=t.turnId),r&&(c.query=r),(t==null?void 0:t.durationMs)!==void 0&&(c.durationMs=t.durationMs),c}function _G(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=Zv(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function bG(e,t){if(t==="running"){const r=[];for(let i=e.length-1;i>=0&&mG.has(e[i].kind);i--)r.unshift(e[i]);return r}const n=t==="error"?Zv(e,r=>r.kind==="error"):Zv(e,r=>r.kind==="assistant-text");return n>=0?[e[n]]:[]}const wG=new Set(["assistant-thinking","user-meta"]);function SG(e,t){const n=new Set(t),r=[];let i=null;const s=()=>{i&&(r.push({kind:"tool-group",seq:i[0].seq,items:i}),i=null)};for(const o of e){if(n.has(o)){s();continue}if(o.kind==="merged-tool"){i?i.push(o):i=[o];continue}if(wG.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function Zv(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const kG={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function CG(e){if(!e||typeof e!="object")return"";const t=e,n=t.command??t.file_path??t.path??t.pattern??t.query??t.url??t.description;if(typeof n=="string")return n;for(const r of Object.values(t))if(typeof r=="string"&&r)return r;return""}function SR(e){const t=kG[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=CG(e.input);return r?`${n} ${r}`:n}function EG({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?Qn:zn,s=n?(t==null?void 0:t(e))??null:null;return h.jsxs("div",{className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,"data-testid":"tool-call-group-row",className:re("flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] hover:text-text-200",e.error?"text-destructive/80":"text-text-400"),children:[e.pending?h.jsx(hr,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(i,{className:"w-3.5 h-3.5 shrink-0 opacity-60"}),h.jsx("span",{className:"truncate min-w-0",children:SR(e)})]}),n?h.jsx("div",{"data-testid":"tool-call-group-row-detail",className:"pl-5 py-1 min-w-0 space-y-1.5 text-[12px] text-text-300",children:s!==null?s:h.jsxs(h.Fragment,{children:[h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono",children:JSON.stringify(e.input,null,2)}),e.output!==void 0?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-text-400",children:typeof e.output=="string"?e.output:JSON.stringify(e.output,null,2)}):null,e.error?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-destructive",children:e.error}):null]})}):null]})}function IG({items:e,renderItemDetail:t}){const[n,r]=g.useState(!1);if(e.length===0)return null;const i=e.some(l=>l.pending),s=i?[...e].reverse().find(l=>l.pending):e[e.length-1],o=!i&&e.length>1?` 等 ${e.length} 项`:"",a=n?Qn:zn;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(l=>!l),"aria-expanded":n,"data-testid":"tool-call-group-header",className:"flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] text-text-400 hover:text-text-200",children:[i&&!n?h.jsx(hr,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"}),n?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:i?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:re("truncate min-w-0",i&&"text-text-300"),children:[SR(s),o]})]}),n?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(l=>h.jsx(EG,{item:l,renderItemDetail:t},l.toolUseId))}):null]})}function TG(e){const t=Math.round(e/1e3);if(t<60)return`${t}秒`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}分${r}秒`:`${n}分钟`}function NG(e,t){const n=t!==void 0?`耗时 ${TG(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function RG({status:e="done",durationMs:t,defaultExpanded:n=!1,onExpandedChange:r,children:i}){const[s,o]=g.useState(n),a=s?Qn:zn;return h.jsxs("div",{"data-testid":"turn-process-block",className:"min-w-0 max-w-full border-t border-border pt-2",children:[h.jsxs("button",{type:"button",onClick:()=>{const l=!s;o(l),r==null||r(l)},"aria-expanded":s,"data-testid":"turn-process-block-header",className:re("flex w-full items-center gap-1 text-left cursor-pointer min-w-0 py-0.5 text-[13px]",e!=="done"?"text-destructive/80 hover:text-destructive":"text-text-400 hover:text-text-200"),children:[h.jsx("span",{className:"truncate min-w-0",children:NG(e,t)}),h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"})]}),s?h.jsx("div",{"data-testid":"turn-process-body",className:"mt-2 flex flex-col gap-2 border-l-2 border-border pl-3",children:i}):null]})}const PG=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,AG=/<builder-preview\b[^>]*\/>/gi,MG=/<(clawd-dispatch-task|clawd-dispatch-result)\b[^>]*>([\s\S]*?)<\/\1>/gi,LG=/<\/?(brief|detail|files)>/gi;function kR(e){return e?e.replace(MG,(t,n,r)=>Q9(r.replace(LG,"")).trim()).replace(PG,"").replace(AG,"").trim():""}const jG=kR;function DG(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const OG=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,BG=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zG={};function Lk(e,t){return(zG.jsx?BG:OG).test(e)}const $G=/[ \t\n\f\r]/g;function FG(e){return typeof e=="object"?e.type==="text"?jk(e.value):!1:jk(e)}function jk(e){return e.replace($G,"")===""}class Ku{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ku.prototype.normal={};Ku.prototype.property={};Ku.prototype.space=void 0;function CR(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ku(n,r,t)}function Qv(e){return e.toLowerCase()}class Jn{constructor(t,n){this.attribute=n,this.property=t}}Jn.prototype.attribute="";Jn.prototype.booleanish=!1;Jn.prototype.boolean=!1;Jn.prototype.commaOrSpaceSeparated=!1;Jn.prototype.commaSeparated=!1;Jn.prototype.defined=!1;Jn.prototype.mustUseProperty=!1;Jn.prototype.number=!1;Jn.prototype.overloadedBoolean=!1;Jn.prototype.property="";Jn.prototype.spaceSeparated=!1;Jn.prototype.space=void 0;let HG=0;const Be=Zo(),zt=Zo(),Jv=Zo(),J=Zo(),ht=Zo(),qa=Zo(),rr=Zo();function Zo(){return 2**++HG}const ex=Object.freeze(Object.defineProperty({__proto__:null,boolean:Be,booleanish:zt,commaOrSpaceSeparated:rr,commaSeparated:qa,number:J,overloadedBoolean:Jv,spaceSeparated:ht},Symbol.toStringTag,{value:"Module"})),hg=Object.keys(ex);class m_ extends Jn{constructor(t,n,r,i){let s=-1;if(super(t,n),Dk(this,"space",i),typeof r=="number")for(;++s<hg.length;){const o=hg[s];Dk(this,hg[s],(r&ex[o])===ex[o])}}}m_.prototype.defined=!0;function Dk(e,t,n){n&&(e[t]=n)}function Ml(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new m_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Qv(r)]=r,n[Qv(s.attribute)]=r}return new Ku(t,n,e.space)}const ER=Ml({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:ht,ariaCurrent:null,ariaDescribedBy:ht,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:ht,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:ht,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ht,ariaLevel:J,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:ht,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:ht,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:zt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function IR(e,t){return t in e?e[t]:t}function TR(e,t){return IR(e,t.toLowerCase())}const UG=Ml({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qa,acceptCharset:ht,accessKey:ht,action:null,allow:null,allowFullScreen:Be,allowPaymentRequest:Be,allowUserMedia:Be,alt:null,as:null,async:Be,autoCapitalize:null,autoComplete:ht,autoFocus:Be,autoPlay:Be,blocking:ht,capture:null,charSet:null,checked:Be,cite:null,className:ht,cols:J,colSpan:null,content:null,contentEditable:zt,controls:Be,controlsList:ht,coords:J|qa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Be,defer:Be,dir:null,dirName:null,disabled:Be,download:Jv,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Be,formTarget:null,headers:ht,height:J,hidden:Jv,high:J,href:null,hrefLang:null,htmlFor:ht,httpEquiv:ht,id:null,imageSizes:null,imageSrcSet:null,inert:Be,inputMode:null,integrity:null,is:null,isMap:Be,itemId:null,itemProp:ht,itemRef:ht,itemScope:Be,itemType:ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Be,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:Be,muted:Be,name:null,nonce:null,noModule:Be,noValidate:Be,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:Be,optimum:J,pattern:null,ping:ht,placeholder:null,playsInline:Be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Be,referrerPolicy:null,rel:ht,required:Be,reversed:Be,rows:J,rowSpan:J,sandbox:ht,scope:null,scoped:Be,seamless:Be,selected:Be,shadowRootClonable:Be,shadowRootDelegatesFocus:Be,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:Be,useMap:null,value:zt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ht,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Be,declare:Be,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:Be,noHref:Be,noShade:Be,noWrap:Be,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Be,disableRemotePlayback:Be,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:TR}),WG=Ml({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:rr,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:ht,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:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:Be,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,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:qa,g2:qa,glyphName:qa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:rr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,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:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:rr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:rr,rev:rr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:rr,requiredFeatures:rr,requiredFonts:rr,requiredFormats:rr,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:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:rr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:rr,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:rr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:IR}),NR=Ml({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),RR=Ml({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:TR}),PR=Ml({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),qG={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"},VG=/[A-Z]/g,Ok=/-[a-z]/g,KG=/^data[-\w.:]+$/i;function GG(e,t){const n=Qv(t);let r=t,i=Jn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&KG.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ok,XG);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ok.test(s)){let o=s.replace(VG,YG);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=m_}return new i(r,t)}function YG(e){return"-"+e.toLowerCase()}function XG(e){return e.charAt(1).toUpperCase()}const ZG=CR([ER,UG,NR,RR,PR],"html"),g_=CR([ER,WG,NR,RR,PR],"svg");function QG(e){return e.join(" ").trim()}var v_={},Bk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,JG=/\n/g,eY=/^\s*/,tY=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,nY=/^:\s*/,rY=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,iY=/^[;\s]*/,sY=/^\s+|\s+$/g,oY=`
|
|
519
|
+
`):e.result??e.contentItems??e.output??e,i=e.status==="failed"||e.status==="declined"||e.success===!1?_r((s=e.error)==null?void 0:s.message)||"执行失败":e.type==="commandExecution"&&typeof e.exitCode=="number"&&e.exitCode!==0?`exit ${e.exitCode}`:void 0;return Th([{kind:"tool_call",tool:t,toolKind:"codex",toolUseId:e.id,input:n},{kind:"tool_result",toolUseId:e.id,output:r,...i?{error:i}:{}}])}function AK(e,t,n){const r=new Set,s=(t===void 0?e.items:[...e.items.filter(a=>a.type==="userMessage"&&!t.some(l=>l.id===a.id)),...t,...e.items.filter(a=>a.type!=="userMessage"&&!t.some(l=>l.id===a.id))]).flatMap(a=>r.has(a.id)?[]:(r.add(a.id),PK(a)));let o=!1;for(const a of s)a.kind==="user-text"&&(o&&(a.continuesTurn=!0),o=!0);return e.error&&s.push({kind:"error",seq:0,message:e.error.message}),s.push({kind:"turn-end",seq:0,turnId:e.id,...e.durationMs!==null?{durationMs:e.durationMs}:{},reason:e.status==="interrupted"?"interrupted":"completed"}),s.map((a,l)=>({...a,seq:n+l}))}function MK(e,t){const n=new Map,r=[];let i=[];for(const c of e)c.kind==="turn-end"&&c.turnId?(n.set(c.turnId,{order:n.size,body:i,end:c}),r.push(c.turnId),i=[]):i.push(c);r.push(i);const s=[];let o=-1;const a=c=>{const u=new Set(c.flatMap(_=>_.turnId?[_.turnId]:[])),d=c.at(-1),f=(d==null?void 0:d.kind)==="turn-end"&&d.turnId?n.get(d.turnId):void 0;if(f&&(d==null?void 0:d.kind)==="turn-end"&&u.size>1){f.end={...f.end,...d,seq:f.end.seq,reason:d.reason??"completed"},o=Math.max(o,f.order),a(c.slice(0,-1));return}const p=u.size===1?[...u][0]:void 0,m=p?n.get(p):void 0;if(!p||!m){s.push(...c);return}const v=o<0?c.some(_=>_.kind==="session-init"):m.order>o,w=c.some(_=>_.kind!=="turn-end"&&_.turnId===p);let x=0;for(const _ of c){if(_.kind==="turn-end"){m.end={...m.end,..._,seq:m.end.seq,reason:_.reason??"completed"},o=Math.max(o,m.order);continue}if(_.kind==="session-init")continue;const b=_.kind==="user-text"||_.kind==="user-meta";b||(x=Math.max(x,m.body.findIndex(I=>I.kind==="user-text"||I.kind==="user-meta")+1));const S=m.body.findIndex((I,j)=>j>=x&&LK(I,_)),C=m.body[S],k=C&&"uuid"in C&&C.uuid&&"uuid"in _&&C.uuid===_.uuid,T=_.turnId===p||k||v&&w;if(b&&(S<0||!T)){s.push(_);continue}if(S>=0){const I=m.body[S];m.body[S]={...I,..._,..."text"in I&&"text"in _&&I.text.length>_.text.length?{text:I.text}:{}},x=S+1}else m.body.splice(x++,0,_)}};let l=[];for(const c of t)l.push(c),c.kind==="turn-end"&&(a(l),l=[]);return a(l),[...r.flatMap(c=>{if(typeof c!="string")return c;const u=n.get(c);return[...u.body,u.end]}),...s]}function LK(e,t){if(e.kind!==t.kind)return!1;const n="partialId"in t&&t.partialId;if("uuid"in e&&e.uuid){if(n)return e.uuid===n;if("uuid"in t&&e.uuid===t.uuid)return!0}return"toolUseId"in e&&"toolUseId"in t?e.toolUseId===t.toolUseId:"text"in e&&"text"in t?e.text===t.text:!1}const Ud=()=>({turns:[],details:{},nextCursor:null,loading:!1,loadingOlder:!1,error:null});function dg(e,t){if(e.view!==t||!Array.isArray(e.data))throw new Error("历史分页需要更新对端 daemon;未退回全量加载")}function jK(e){const{api:t,sessionId:n,toolSessionId:r,forkedFromSessionId:i,initialTurnStarted:s=!1,enabled:o,focused:a=!0,refreshVersion:l=0}=e,c=`${o}:${n}:${r??""}`,u=g.useRef(c);u.current=c;const d=g.useRef(0),f=g.useRef(!0),[p,m]=g.useState(Ud),v=g.useRef(p);v.current=p;const w=g.useRef(!1),x=g.useRef(new Set),_=g.useRef(),b=g.useRef({sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:!!r});g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const S=g.useCallback(async()=>{if(!o||!r)return;_.current={identity:c,version:l,api:t};const j=++d.current,R=c;w.current=!1,x.current.clear(),m(D=>({...D,loading:!0,loadingOlder:!1,error:null}));try{const D=await t.historyPage({sessionId:n,view:"turns",limit:10});if(dg(D,"turns"),!f.current||d.current!==j||u.current!==R||D.view!=="turns")return;m({...Ud(),turns:[...D.data].reverse(),snapshotId:D.snapshotId,nextCursor:D.nextCursor})}catch(D){if(!f.current||d.current!==j||u.current!==R)return;m(P=>({...P,loading:!1,error:D.message}))}},[t,c,o,r,n,l]);g.useEffect(()=>{const j=b.current,R=j.sessionId===n&&j.enabled,D=!!r||R&&j.hasAssignedThread;if(b.current={sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:D},!o||!r){d.current++,_.current=void 0,m(Ud());return}if(!a)return;const P=!!i&&!j.hasAssignedThread;if(R&&j.focused&&!j.toolSessionId&&s&&!P&&j.refreshVersion===l&&j.api===t){_.current={identity:c,version:l,api:t,deferred:!0};return}const A=_.current,M=R&&!j.focused&&((A==null?void 0:A.deferred)||v.current.error!==null);(A==null?void 0:A.identity)===c&&A.version===l&&A.api===t&&!M||(((A==null?void 0:A.identity)!==c||A.api!==t)&&m(Ud()),_.current={identity:c,version:l,api:t},S())},[t,c,n,o,r,i,s,a,l,S]);const C=g.useCallback(async()=>{const j=v.current;if(!o||j.loading||w.current||!j.nextCursor||!j.snapshotId)return;const R=d.current,D=c;w.current=!0,m(P=>({...P,loadingOlder:!0,error:null}));try{const P=await t.historyPage({sessionId:n,view:"turns",limit:10,cursor:j.nextCursor,snapshotId:j.snapshotId});if(dg(P,"turns"),!f.current||R!==d.current||D!==u.current||P.view!=="turns")return;if(P.snapshotId!==j.snapshotId||P.nextCursor===j.nextCursor)throw new Error("历史分页快照或游标失效,请刷新历史");m(A=>{const M=new Set(A.turns.map(L=>L.id));return{...A,turns:[...P.data.filter(L=>!M.has(L.id)).reverse(),...A.turns],nextCursor:P.nextCursor,loadingOlder:!1}})}catch(P){f.current&&R===d.current&&D===u.current&&m(A=>({...A,loadingOlder:!1,error:P.message}))}finally{R===d.current&&(w.current=!1)}},[t,o,c,n]),k=g.useCallback(async(j,R=!1)=>{const D=v.current,P=D.details[j];if(!o||D.loading||!D.snapshotId||x.current.has(j)||P&&!P.error&&!R||R&&!(P!=null&&P.nextCursor))return;const A=d.current,M=c;x.current.add(j);const L=P??{items:[],loading:!1,error:null,nextCursor:null};m($=>({...$,details:{...$.details,[j]:{...L,loading:!0,error:null}}}));try{const $=await t.historyPage({sessionId:n,view:"items",turnId:j,limit:50,snapshotId:D.snapshotId,...P!=null&&P.nextCursor?{cursor:P.nextCursor}:{}});if(dg($,"items"),!f.current||A!==d.current||M!==u.current||$.view!=="items")return;if($.snapshotId!==D.snapshotId||P!=null&&P.nextCursor&&$.nextCursor===P.nextCursor)throw new Error("轮次详情快照或游标失效,请刷新历史");if($.data.some(B=>B.turnId!==j))throw new Error("轮次详情身份不匹配");const F=new Set(L.items.map(B=>B.id)),z=[...L.items,...$.data.map(B=>B.item).filter(B=>!F.has(B.id))];m(B=>({...B,details:{...B.details,[j]:{items:z,loading:!1,error:null,nextCursor:$.nextCursor}}}))}catch($){f.current&&A===d.current&&M===u.current&&m(F=>({...F,details:{...F.details,[j]:{...L,loading:!1,error:$.message}}}))}finally{A===d.current&&x.current.delete(j)}},[t,o,c,n]),T=g.useMemo(()=>p.turns.flatMap((j,R)=>{var D;return AK(j,(D=p.details[j.id])==null?void 0:D.items,(R-p.turns.length)*1e6)}),[p.turns,p.details]),I=g.useMemo(()=>T.map(j=>({kind:j.kind,..."text"in j?{text:j.text}:{},..."uuid"in j?{uuid:j.uuid}:{}})),[T]);return{...p,lines:T,messages:I,total:p.turns.length,loadOlder:C,loadDetails:k,refresh:S}}const DK=/<command-name>([\s\S]*?)<\/command-name>/i,OK=/<command-message>([\s\S]*?)<\/command-message>/i,BK=/<command-args>([\s\S]*?)<\/command-args>/i,zK=/<(local-command-[a-z]+|command-(?:stdout|stderr))>[\s\S]*?<\/\1>/gi;function Xp(e){if(!e)return{commandName:null,commandMessage:null,commandArgs:null,body:""};const t=e.match(DK),n=e.match(OK),r=e.match(BK);let i=e;return t&&(i=i.replace(t[0],"")),n&&(i=i.replace(n[0],"")),r&&(i=i.replace(r[0],"")),i=i.replace(zK,""),i=i.trim(),{commandName:t?t[1].trim():null,commandMessage:n?n[1].trim():null,commandArgs:r?r[1].trim():null,body:i}}function Pk(e){const t=Xp(e);return t.commandName?t.commandArgs?`${t.commandName} ${t.commandArgs}`:t.commandName:e}function Ak(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Mp(e.metaKind)}function $K(e,t){const n=t.find(Ak);if(!n)return e;const r=Pk(n.text);for(let s=e.length-1;s>=0;s--){const o=e[s];if(Ak(o)&&Pk(o.text)===r)return e.slice(0,s)}const i=e[e.length-1];return i!==void 0&&i.kind!=="turn-end"?[...e,{kind:"turn-end",seq:i.seq+1}]:e}function FK(e){return e==="running"||e==="observing"}function xR(e){return e==="running"||e==="running-idle"||e==="observing"}const HK=1e6,UK=5;function yR(e,t=!0){const n=mR(),r=es(),i=g.useMemo(()=>new wy(r),[r]),s=Gi("sessions"),o=g.useMemo(()=>s==null?void 0:s.find(ie=>ie.sessionId===e),[s,e]),a=o==null?void 0:o.toolSessionId,l=o==null?void 0:o.tool,[c,u]=g.useState(0),[d,f]=g.useState(null),p=Zs(),m=g.useRef(p);m.current=p;const[v,w]=g.useState(null),x=g.useRef(null),_=g.useRef(null);g.useEffect(()=>(f(null),w(null),_.current=null,r.on("session:control",ie=>{const We=ie;if(!((We==null?void 0:We.sessionId)!==e||We.kind!==l9))if(We.synchronized===!0){const Ce=m.current.read(`session/${e}`);Ce!=null&&Ce.events.length&&w({first:Ce.events[0],count:Ce.events.length,historyBefore:x.current}),f(null),u($e=>$e+1)}else f("断线期间的部分内容未显示,完整内容已保存在云端")})),[r,e]);const b=g.useCallback(()=>{const ie=m.current.read(`session/${e}`),We=(ie==null?void 0:ie.events)??[];let Ce=We.length;for(;Ce>0&&We[Ce-1].kind!=="turn_end";)Ce--;Ce>0&&w({first:We[0],count:Ce,historyBefore:x.current}),_.current={historyBefore:x.current},u($e=>$e+1)},[e]),S=pR(e),{events:C,pendingPermissions:k,queued:T,status:I,clearPermission:j,restorePermission:R}=S,D=yz(),P=l==="codex",A=_K({api:i,sessionId:e,focused:t,toolSessionId:a,enabled:D!==void 0&&!P,refreshVersion:c,initialTurns:D==="owner"?void 0:UK,implicitCloseOnUserText:l==="codex"}),M=jK({api:i,sessionId:e,focused:t,toolSessionId:a,forkedFromSessionId:o==null?void 0:o.forkedFromSessionId,initialTurnStarted:C.some(ie=>ie.kind==="user_text"),enabled:D!==void 0&&P,refreshVersion:c}),L=P?M:A,$=g.useMemo(()=>({details:M.details,turnIds:new Set(M.turns.map(ie=>ie.id)),loadDetails:M.loadDetails}),[M.details,M.turns,M.loadDetails]);x.current=L.messages,g.useEffect(()=>{const ie=_.current;!ie||L.loading||L.messages===ie.historyBefore||(_.current=null,f(null))},[L.messages,L.loading]);const F=g.useMemo(()=>L.messages.filter(ie=>!ie.isSidechain),[L.messages]),z=g.useMemo(()=>{const ie=v;return!ie||L.messages===ie.historyBefore||L.loading||C[0]!==ie.first||C.length<ie.count?C:C.slice(ie.count)},[C,v,L.messages,L.loading]),B=g.useMemo(()=>P?M.lines:RK(f_(F,0,l)),[F,l,P,M.lines]),E=k[0]??null,U=g.useMemo(()=>Th(z,(E==null?void 0:E.requestId)??null),[z,E==null?void 0:E.requestId]),q=g.useMemo(()=>P?B:$K(B,U),[B,U,P]),O=g.useMemo(()=>U.map((ie,We)=>({...ie,seq:HK+We})),[U]),te=g.useMemo(()=>P?MK(q,O):[...q,...O],[q,O,P]),se=g.useRef(L.messages);g.useEffect(()=>{se.current!==L.messages&&(se.current=L.messages,!L.loading&&(n==null||n.push({level:"info",msg:"chatflow.history.display",sessionId:e,meta:{historyMessages:L.messages.length,mainChainMessages:F.length,historyLines:q.length,panelLines:te.length,total:L.total,error:L.error!==null}})))},[L.messages,L.loading,L.total,L.error,F.length,q.length,te.length,n,e]);const G=xR(I),me=FK(I),Ie=(o==null?void 0:o.resolvedModel)??(o==null?void 0:o.model),ue=g.useMemo(()=>({sessionLabel:(o==null?void 0:o.label)||(o==null?void 0:o.aiLabel)||(o==null?void 0:o.larkChatName)||(o==null?void 0:o.larkChatId)||e,sessionId:e,...o!=null&&o.larkChatId?{larkChatName:o.larkChatName??o.larkChatId,larkChatType:o.larkChatType??"group"}:{},...Ie?{model:Ie}:{},...(()=>{const ie=o==null?void 0:o.gitBranch;return ie?{gitBranch:ie}:{}})(),...(()=>{const ie=mK(o);return ie!==void 0?{contextPct:ie}:{}})(),...o!=null&&o.cwd?{cwd:o.cwd}:{},...(()=>{const ie=o==null?void 0:o.permissionMode;return ie?{permissionMode:ie}:{}})(),procAlive:G,streamInProgress:me,pinnedAt:(o==null?void 0:o.pinnedAt)??null}),[o,e,Ie,G,me]),Ae=g.useMemo(()=>r.isOpen?I==="error"?{kind:"error",message:"session error"}:{kind:"ready"}:{kind:"closed"},[r.isOpen,I]),Oe=g.useCallback(async(ie,We)=>{await i.sessionSend(e,ie,We)},[i,e]),je=g.useCallback(async ie=>{await i.sessionDequeue(e,ie)},[i,e]),ge=g.useCallback(async()=>(await i.sessionInterrupt(e)).queued??[],[i,e]),Ze=g.useCallback(async ie=>{if(!(o!=null&&o.cwd)||!a)throw new Error("fork requires sessionFile with cwd + toolSessionId");await i.sessionFork({cwd:o.cwd,toolSessionId:a,messageUuid:ie})},[i,o==null?void 0:o.cwd,a]),dt=g.useCallback(async ie=>{await i.sessionRewind({sessionId:e,userMessageId:ie,dryRun:!1})},[i,e]),nt=g.useCallback(async ie=>{await i.sessionUpdate(e,{model:ie})},[i,e]),vt=g.useCallback(async()=>{await i.sessionNew(e)},[i,e]),jt=g.useCallback(async(ie,We)=>{const Ce=k.find($e=>$e.requestId===ie);Ce&&j(ie);try{await i.permissionRespond({sessionId:e,permissionRequestId:ie,allow:We==="allow"})}catch($e){throw!(($e==null?void 0:$e.message)??"").startsWith("PERMISSION_REQUEST_STALE")&&Ce&&R(Ce),$e}},[i,e,k,j,R]);return g.useMemo(()=>({lines:te,connState:Ae,meta:ue,historyLoading:L.loading,historyError:L.error,...P?{codexHistory:$,historyHasMore:M.nextCursor!==null,historyLoaded:M.snapshotId!==void 0,historyLoadingOlder:M.loadingOlder,loadOlderHistory:M.loadOlder,refreshHistory:M.refresh}:{},historySyncError:d,pendingPermissions:k,queued:T,sendText:Oe,dequeue:je,interrupt:ge,fork:Ze,rewind:dt,switchModel:nt,clearSession:vt,respondPermission:jt,reloadFromCloud:b}),[te,Ae,ue,L.loading,L.error,P,$,M.nextCursor,M.snapshotId,M.loadingOlder,M.loadOlder,M.refresh,d,k,T,Oe,je,ge,Ze,dt,nt,vt,jt,b])}const WK={codex:"on-request",claude:"bypassPermissions",pi:"never"};function qK(e){const t={cwd:e.cwd,permissionMode:e.sourcePermissionMode??WK[e.sourceTool??"claude"]??"bypassPermissions",forkedFromSessionId:e.sourceSessionId};return e.sourceOwnerPersonaId&&(t.ownerPersonaId=e.sourceOwnerPersonaId),e.sourceTool&&(t.tool=e.sourceTool),e.sourceModel&&(t.model=e.sourceModel),e.sourceEffort&&(t.effort=e.sourceEffort),e.sourceProjectPath&&(t.projectPath=e.sourceProjectPath),t}async function VK(e,t,n,r={}){if(!t.toolSessionId)return null;const i=await e.sessionCreate({...qK({cwd:t.cwd,sourceSessionId:t.sessionId,sourcePermissionMode:t.permissionMode,sourceOwnerPersonaId:t.ownerPersonaId,sourceTool:t.tool,sourceModel:t.model,sourceEffort:t.effort,sourceProjectPath:t.projectPath}),...r.ephemeral?{ephemeral:!0}:{}});try{const{forkedToolSessionId:s}=await e.sessionFork({cwd:t.cwd,toolSessionId:t.toolSessionId,...t.tool==="codex"?{sourceSessionId:t.sessionId,turnId:n}:{messageUuid:n},targetCwd:i.cwd});await e.sessionResume(i.sessionId,s)}catch(s){throw e.sessionDelete(i.sessionId).catch(o=>De("quick-ask","fork rollback failed",o)),s}return i}async function KK(e,t,n){return VK(e,t,n,{ephemeral:!0})}function Wd(e){return e!=null&&e.ephemeral!==!1}async function GK(e,t){return t.stillEphemeral?(await e.sessionUpdate(t.sessionId,{ephemeral:!1}),!0):!1}function YK(e){try{const t=new URL(e);return t.protocol==="ws:"?t.protocol="http:":t.protocol==="wss:"&&(t.protocol="https:"),`${t.protocol}//${t.host}`}catch{return e}}function XK(e,t){try{const n=new URL(e),r=new URL(t);return n.protocol=r.protocol,n.host=r.host,n.toString()}catch{return e}}async function p_(e,t,n,r,i){const s=await e.attachmentSignUrl({sessionId:n,relPath:r,...i!==void 0?{ttlSeconds:i}:{}});return XK(s.url,YK(t.url))}async function Mk(e,t,n,r,i=60,s){const o=window.open("about:blank","_blank");try{s&&await s();const a=await p_(e,t,n,r,i);o?o.location.href=a:window.open(a,"_blank")}catch(a){throw o&&o.close(),a}}async function ZK(e){var t;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.setAttribute("readonly",""),document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}const QK=300;function JK(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function eG(e,t){const n=Y1(),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>{let a=!1;return(async()=>{try{const l=await n.kv.get(e);if(a)return;const c=JK(l);typeof c=="number"&&Number.isFinite(c)&&c>0?i(c):i(t)}catch{a||i(t)}})(),()=>{a=!0}},[n,e,t]);const o=g.useCallback(a=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,n.kv.set(e,a).catch(()=>{})},QK)},[n,e]);return g.useEffect(()=>()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),{initialSize:r??t,setSize:o,loading:r===null}}function tG(){return{quickAsk:null,mds:[],active:null}}function nG(e,t){return{...e,quickAsk:{sessionId:t.sessionId,ephemeral:!0},active:"quick-ask"}}function rG(e,t){const n=e.mds.includes(t);return{...e,mds:n?e.mds:[...e.mds,t],active:{kind:"md",relPath:t}}}function iG(e){if(!e.quickAsk)return e;const t=e.active==="quick-ask",n=e.mds[0],r=t?n?{kind:"md",relPath:n}:null:e.active;return{...e,quickAsk:null,active:r}}function sG(e){return e.quickAsk?{...e,quickAsk:{...e.quickAsk,ephemeral:!1}}:e}function oG(e,t){const n=e.mds.indexOf(t);if(n<0)return e;const r=e.mds.filter(l=>l!==t);if(!(e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===t))return{...e,mds:r};const s=r[n],o=n>0?r[n-1]:void 0;let a=null;return s?a={kind:"md",relPath:s}:o?a={kind:"md",relPath:o}:e.quickAsk&&(a="quick-ask"),{...e,mds:r,active:a}}function aG(e,t){return{...e,active:t}}function lG(e,t){return e===null||t===null||e==="quick-ask"||t==="quick-ask"?e===t:e.relPath===t.relPath}function _R(e){return e.quickAsk!==null||e.mds.length>0}function cG(e,t,n,r=!0){const i=g.useRef({sid:null,tsid:void 0});g.useEffect(()=>{const s=i.current;i.current={sid:t,tsid:n},!(!r||!n||s.sid===t&&(s.tsid===void 0||s.tsid===null)&&typeof n=="string")&&e.sessionObserve({sessionId:t,toolSessionId:n}).catch(()=>{})},[e,t,n,r])}function uG(e,t,n){const r=g.useRef(e),i=g.useRef(t),s=g.useRef(n);s.current=n,g.useEffect(()=>{const o=r.current,a=i.current;r.current=e,i.current=t;const l=o!==e,c=typeof a=="string"&&t==null;!l&&!c||s.current()},[e,t])}const dG=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function hG(e){const t=new Map,n=new Map,r=new Map;for(const i of e)if(i.kind==="tool_call"&&i.tool==="CronCreate"){const s=i.input;if(!s||typeof s.cron!="string"||typeof s.prompt!="string")continue;const o=i.ts;t.set(i.toolUseId,{cron:s.cron,prompt:s.prompt,recurring:s.recurring!==!1,ts:typeof o=="string"?o:"",toolUseId:i.toolUseId})}else if(i.kind==="tool_call"&&i.tool==="CronDelete"){const s=i.input;if(!s||typeof s.id!="string")continue;n.set(i.toolUseId,s.id)}else if(i.kind==="tool_result"){const s=t.get(i.toolUseId);if(s){if(t.delete(i.toolUseId),i.error||typeof i.output!="string")continue;const a=i.output.match(dG);if(!a)continue;r.set(a[1],{id:a[1],cron:s.cron,prompt:s.prompt,recurring:s.recurring,humanSchedule:a[2],createdAt:s.ts,toolUseId:s.toolUseId});continue}const o=n.get(i.toolUseId);o!==void 0&&(n.delete(i.toolUseId),i.error||r.delete(o))}return Array.from(r.values()).sort((i,s)=>i.createdAt.localeCompare(s.createdAt))}function bR(e){var n;if(e.error)return!1;if(e.pending)return!0;if(e.notifications.length>0)return!1;const t=(n=e.progress)==null?void 0:n.status;return t==="running"?!0:t==="started"?fG(e.input):!1}function fG(e){return!e||typeof e!="object"?!1:e.run_in_background===!0}function pG(e){return e.filter(t=>t.kind==="merged-agent"&&bR(t))}function wR(e){var d;const{tasks:t,lastEventIndex:n}=CK(e);let r=-1;for(let f=e.length-1;f>=0;f--)if(e[f].kind==="todo-checklist"){r=f;break}const i=[],s=new Map,o=new Map,a=new Map,l=new Map,c=new Map,u=(f,p)=>{var _,b,S,C,k,T;const m=i[f],v=c.get(f),w=v!==void 0&&v!==p.toolUseId;if(!w&&(((_=m.progress)==null?void 0:_.status)==="completed"||((b=m.progress)==null?void 0:b.status)==="failed"))return;if(c.set(f,p.toolUseId),l.set(p.agentId,f),w&&(m.pending=!0,(S=m.toolResultExtra)!=null&&S.stats)){const{stats:I,...j}=m.toolResultExtra;m.toolResultExtra=j}const x={agentId:p.agentId,status:p.status};p.description?x.description=p.description:(C=m.progress)!=null&&C.description&&(x.description=m.progress.description),p.lastToolName?x.lastToolName=p.lastToolName:!w&&((k=m.progress)!=null&&k.lastToolName)&&(x.lastToolName=m.progress.lastToolName),p.stats?x.stats=p.stats:!w&&((T=m.progress)!=null&&T.stats)&&(x.stats=m.progress.stats),m.progress=x,(p.status==="completed"||p.status==="failed")&&(m.pending=!1)};for(let f=0;f<e.length;f++){const p=e[f];switch(p.kind){case"tool-call":{const m={kind:"merged-tool",seq:p.seq,tool:p.tool,toolKind:p.toolKind,toolUseId:p.toolUseId,input:p.input,pending:!0};s.set(p.toolUseId,i.length),i.push(m);break}case"tool-result":{const m=s.get(p.toolUseId);if(m!==void 0){const w=i[m];w.output=p.output,w.error=p.error,w.pending=!1,s.delete(p.toolUseId);break}const v=o.get(p.toolUseId);if(v!==void 0){const w=i[v];w.output=p.output,w.error=p.error,w.pending=!1,p.toolResultExtra&&(w.toolResultExtra=p.toolResultExtra),(d=p.toolResultExtra)!=null&&d.agentId&&(l.set(p.toolResultExtra.agentId,v),c.set(v,p.toolUseId));break}break}case"agent-call":{const m={kind:"merged-agent",seq:p.seq,toolUseId:p.toolUseId,description:p.description,input:p.input,pending:!0,notifications:[]},v=i.length;o.set(p.toolUseId,v),i.push(m);const w=a.get(p.toolUseId);w&&(u(v,w),a.delete(p.toolUseId));break}case"agent-progress":{const m=o.get(p.toolUseId)??l.get(p.agentId);if(m!==void 0){u(m,p);break}const v=a.get(p.toolUseId);if((v==null?void 0:v.status)==="completed"||(v==null?void 0:v.status)==="failed")break;a.set(p.toolUseId,p);break}case"agent-notification":{const m=(p.parentToolUseId?o.get(p.parentToolUseId):void 0)??(p.taskId?l.get(p.taskId):void 0);if(m!==void 0){i[m].notifications.push({text:p.text,taskId:p.taskId});break}i.push({kind:"agent-notification",seq:p.seq,text:p.text,taskId:p.taskId,parentToolUseId:p.parentToolUseId});break}case"todo-checklist":{f===r&&p.todos.length>0&&i.push({kind:"todo-checklist",seq:p.seq,toolUseId:p.toolUseId,todos:p.todos});break}case"task-event":{f===n&&t.length>0&&i.push({kind:"plan-card",seq:p.seq,tasks:t});break}default:i.push(p)}}return i}const mG=new Set(["permission-inline","question-card"]);function gG(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Mp(e.metaKind)}function vG(e){return e.kind==="user-text"&&e.continuesTurn===!0}function xG(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(yG(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,!0);continue}if(gG(s)&&(r===null||!vG(s))){i(void 0,!0),r={query:s,body:[]};continue}r===null?r={body:[s]}:r.body.push(s)}return i(void 0,t.closeTrailing===!0),n}function yG(e,t,n){const{query:r,body:i}=e,s=_G(i,t,n),o=bG(i,s),a=SG(i,o),l=r??i[0]??t,c={kind:"turn",seq:l?l.seq:0,status:s,process:a,tail:o};return t!=null&&t.turnId&&(c.turnId=t.turnId),r&&(c.query=r),(t==null?void 0:t.durationMs)!==void 0&&(c.durationMs=t.durationMs),c}function _G(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=Zv(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function bG(e,t){if(t==="running"){const r=[];for(let i=e.length-1;i>=0&&mG.has(e[i].kind);i--)r.unshift(e[i]);return r}const n=t==="error"?Zv(e,r=>r.kind==="error"):Zv(e,r=>r.kind==="assistant-text");return n>=0?[e[n]]:[]}const wG=new Set(["assistant-thinking","user-meta"]);function SG(e,t){const n=new Set(t),r=[];let i=null;const s=()=>{i&&(r.push({kind:"tool-group",seq:i[0].seq,items:i}),i=null)};for(const o of e){if(n.has(o)){s();continue}if(o.kind==="merged-tool"){i?i.push(o):i=[o];continue}if(wG.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function Zv(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const kG={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function CG(e){if(!e||typeof e!="object")return"";const t=e,n=t.command??t.file_path??t.path??t.pattern??t.query??t.url??t.description;if(typeof n=="string")return n;for(const r of Object.values(t))if(typeof r=="string"&&r)return r;return""}function SR(e){const t=kG[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=CG(e.input);return r?`${n} ${r}`:n}function EG({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?Qn:zn,s=n?(t==null?void 0:t(e))??null:null;return h.jsxs("div",{className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,"data-testid":"tool-call-group-row",className:re("flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] hover:text-text-200",e.error?"text-destructive/80":"text-text-400"),children:[e.pending?h.jsx(hr,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(i,{className:"w-3.5 h-3.5 shrink-0 opacity-60"}),h.jsx("span",{className:"truncate min-w-0",children:SR(e)})]}),n?h.jsx("div",{"data-testid":"tool-call-group-row-detail",className:"pl-5 py-1 min-w-0 space-y-1.5 text-[12px] text-text-300",children:s!==null?s:h.jsxs(h.Fragment,{children:[h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono",children:JSON.stringify(e.input,null,2)}),e.output!==void 0?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-text-400",children:typeof e.output=="string"?e.output:JSON.stringify(e.output,null,2)}):null,e.error?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-destructive",children:e.error}):null]})}):null]})}function IG({items:e,renderItemDetail:t}){const[n,r]=g.useState(!1);if(e.length===0)return null;const i=e.some(l=>l.pending),s=i?[...e].reverse().find(l=>l.pending):e[e.length-1],o=!i&&e.length>1?` 等 ${e.length} 项`:"",a=n?Qn:zn;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(l=>!l),"aria-expanded":n,"data-testid":"tool-call-group-header",className:"flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] text-text-400 hover:text-text-200",children:[i&&!n?h.jsx(hr,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"}),n?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:i?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:re("truncate min-w-0",i&&"text-text-300"),children:[SR(s),o]})]}),n?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(l=>h.jsx(EG,{item:l,renderItemDetail:t},l.toolUseId))}):null]})}function TG(e){const t=Math.round(e/1e3);if(t<60)return`${t}秒`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}分${r}秒`:`${n}分钟`}function NG(e,t){const n=t!==void 0?`耗时 ${TG(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function RG({status:e="done",durationMs:t,defaultExpanded:n=!1,onExpandedChange:r,children:i}){const[s,o]=g.useState(n),a=s?Qn:zn;return h.jsxs("div",{"data-testid":"turn-process-block",className:"min-w-0 max-w-full border-t border-border pt-2",children:[h.jsxs("button",{type:"button",onClick:()=>{const l=!s;o(l),r==null||r(l)},"aria-expanded":s,"data-testid":"turn-process-block-header",className:re("flex w-full items-center gap-1 text-left cursor-pointer min-w-0 py-0.5 text-[13px]",e!=="done"?"text-destructive/80 hover:text-destructive":"text-text-400 hover:text-text-200"),children:[h.jsx("span",{className:"truncate min-w-0",children:NG(e,t)}),h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"})]}),s?h.jsx("div",{"data-testid":"turn-process-body",className:"mt-2 flex flex-col gap-2 border-l-2 border-border pl-3",children:i}):null]})}const PG=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,AG=/<builder-preview\b[^>]*\/>/gi,MG=/<(clawd-dispatch-task|clawd-dispatch-result)\b[^>]*>([\s\S]*?)<\/\1>/gi,LG=/<\/?(brief|detail|files)>/gi;function kR(e){return e?e.replace(MG,(t,n,r)=>Q9(r.replace(LG,"")).trim()).replace(PG,"").replace(AG,"").trim():""}const jG=kR;function DG(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const OG=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,BG=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zG={};function Lk(e,t){return(zG.jsx?BG:OG).test(e)}const $G=/[ \t\n\f\r]/g;function FG(e){return typeof e=="object"?e.type==="text"?jk(e.value):!1:jk(e)}function jk(e){return e.replace($G,"")===""}class Ku{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ku.prototype.normal={};Ku.prototype.property={};Ku.prototype.space=void 0;function CR(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ku(n,r,t)}function Qv(e){return e.toLowerCase()}class Jn{constructor(t,n){this.attribute=n,this.property=t}}Jn.prototype.attribute="";Jn.prototype.booleanish=!1;Jn.prototype.boolean=!1;Jn.prototype.commaOrSpaceSeparated=!1;Jn.prototype.commaSeparated=!1;Jn.prototype.defined=!1;Jn.prototype.mustUseProperty=!1;Jn.prototype.number=!1;Jn.prototype.overloadedBoolean=!1;Jn.prototype.property="";Jn.prototype.spaceSeparated=!1;Jn.prototype.space=void 0;let HG=0;const Be=Zo(),zt=Zo(),Jv=Zo(),J=Zo(),ht=Zo(),qa=Zo(),rr=Zo();function Zo(){return 2**++HG}const ex=Object.freeze(Object.defineProperty({__proto__:null,boolean:Be,booleanish:zt,commaOrSpaceSeparated:rr,commaSeparated:qa,number:J,overloadedBoolean:Jv,spaceSeparated:ht},Symbol.toStringTag,{value:"Module"})),hg=Object.keys(ex);class m_ extends Jn{constructor(t,n,r,i){let s=-1;if(super(t,n),Dk(this,"space",i),typeof r=="number")for(;++s<hg.length;){const o=hg[s];Dk(this,hg[s],(r&ex[o])===ex[o])}}}m_.prototype.defined=!0;function Dk(e,t,n){n&&(e[t]=n)}function Ml(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new m_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Qv(r)]=r,n[Qv(s.attribute)]=r}return new Ku(t,n,e.space)}const ER=Ml({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:ht,ariaCurrent:null,ariaDescribedBy:ht,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:ht,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:ht,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ht,ariaLevel:J,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:ht,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:ht,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:zt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function IR(e,t){return t in e?e[t]:t}function TR(e,t){return IR(e,t.toLowerCase())}const UG=Ml({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qa,acceptCharset:ht,accessKey:ht,action:null,allow:null,allowFullScreen:Be,allowPaymentRequest:Be,allowUserMedia:Be,alt:null,as:null,async:Be,autoCapitalize:null,autoComplete:ht,autoFocus:Be,autoPlay:Be,blocking:ht,capture:null,charSet:null,checked:Be,cite:null,className:ht,cols:J,colSpan:null,content:null,contentEditable:zt,controls:Be,controlsList:ht,coords:J|qa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Be,defer:Be,dir:null,dirName:null,disabled:Be,download:Jv,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Be,formTarget:null,headers:ht,height:J,hidden:Jv,high:J,href:null,hrefLang:null,htmlFor:ht,httpEquiv:ht,id:null,imageSizes:null,imageSrcSet:null,inert:Be,inputMode:null,integrity:null,is:null,isMap:Be,itemId:null,itemProp:ht,itemRef:ht,itemScope:Be,itemType:ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Be,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:Be,muted:Be,name:null,nonce:null,noModule:Be,noValidate:Be,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:Be,optimum:J,pattern:null,ping:ht,placeholder:null,playsInline:Be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Be,referrerPolicy:null,rel:ht,required:Be,reversed:Be,rows:J,rowSpan:J,sandbox:ht,scope:null,scoped:Be,seamless:Be,selected:Be,shadowRootClonable:Be,shadowRootDelegatesFocus:Be,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:Be,useMap:null,value:zt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ht,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Be,declare:Be,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:Be,noHref:Be,noShade:Be,noWrap:Be,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Be,disableRemotePlayback:Be,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:TR}),WG=Ml({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:rr,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:ht,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:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:Be,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,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:qa,g2:qa,glyphName:qa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:rr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,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:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:rr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:rr,rev:rr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:rr,requiredFeatures:rr,requiredFonts:rr,requiredFormats:rr,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:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:rr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:rr,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:rr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:IR}),NR=Ml({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),RR=Ml({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:TR}),PR=Ml({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),qG={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"},VG=/[A-Z]/g,Ok=/-[a-z]/g,KG=/^data[-\w.:]+$/i;function GG(e,t){const n=Qv(t);let r=t,i=Jn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&KG.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ok,XG);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ok.test(s)){let o=s.replace(VG,YG);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=m_}return new i(r,t)}function YG(e){return"-"+e.toLowerCase()}function XG(e){return e.charAt(1).toUpperCase()}const ZG=CR([ER,UG,NR,RR,PR],"html"),g_=CR([ER,WG,NR,RR,PR],"svg");function QG(e){return e.join(" ").trim()}var v_={},Bk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,JG=/\n/g,eY=/^\s*/,tY=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,nY=/^:\s*/,rY=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,iY=/^[;\s]*/,sY=/^\s+|\s+$/g,oY=`
|
|
520
520
|
`,zk="/",$k="*",go="",aY="comment",lY="declaration";function cY(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(m){var v=m.match(JG);v&&(n+=v.length);var w=m.lastIndexOf(oY);r=~w?m.length-w:r+m.length}function s(){var m={line:n,column:r};return function(v){return v.position=new o(m),c(),v}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(m){var v=new Error(t.source+":"+n+":"+r+": "+m);if(v.reason=m,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function l(m){var v=m.exec(e);if(v){var w=v[0];return i(w),e=e.slice(w.length),v}}function c(){l(eY)}function u(m){var v;for(m=m||[];v=d();)v!==!1&&m.push(v);return m}function d(){var m=s();if(!(zk!=e.charAt(0)||$k!=e.charAt(1))){for(var v=2;go!=e.charAt(v)&&($k!=e.charAt(v)||zk!=e.charAt(v+1));)++v;if(v+=2,go===e.charAt(v-1))return a("End of comment missing");var w=e.slice(2,v-2);return r+=2,i(w),e=e.slice(v),r+=2,m({type:aY,comment:w})}}function f(){var m=s(),v=l(tY);if(v){if(d(),!l(nY))return a("property missing ':'");var w=l(rY),x=m({type:lY,property:Fk(v[0].replace(Bk,go)),value:w?Fk(w[0].replace(Bk,go)):go});return l(iY),x}}function p(){var m=[];u(m);for(var v;v=f();)v!==!1&&(m.push(v),u(m));return m}return c(),p()}function Fk(e){return e?e.replace(sY,go):go}var uY=cY,dY=Bh&&Bh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(v_,"__esModule",{value:!0});v_.default=fY;const hY=dY(uY);function fY(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,hY.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var Zp={};Object.defineProperty(Zp,"__esModule",{value:!0});Zp.camelCase=void 0;var pY=/^--[a-zA-Z0-9_-]+$/,mY=/-([a-z])/g,gY=/^[^-]+$/,vY=/^-(webkit|moz|ms|o|khtml)-/,xY=/^-(ms)-/,yY=function(e){return!e||gY.test(e)||pY.test(e)},_Y=function(e,t){return t.toUpperCase()},Hk=function(e,t){return"".concat(t,"-")},bY=function(e,t){return t===void 0&&(t={}),yY(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(xY,Hk):e=e.replace(vY,Hk),e.replace(mY,_Y))};Zp.camelCase=bY;var wY=Bh&&Bh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},SY=wY(v_),kY=Zp;function tx(e,t){var n={};return!e||typeof e!="string"||(0,SY.default)(e,function(r,i){r&&i&&(n[(0,kY.camelCase)(r,t)]=i)}),n}tx.default=tx;var CY=tx;const EY=Iu(CY),AR=MR("end"),x_=MR("start");function MR(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function IY(e){const t=x_(e),n=AR(e);if(t&&n)return{start:t,end:n}}function Dc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Uk(e.position):"start"in e||"end"in e?Uk(e):"line"in e||"column"in e?nx(e):""}function nx(e){return Wk(e&&e.line)+":"+Wk(e&&e.column)}function Uk(e){return nx(e&&e.start)+"-"+nx(e&&e.end)}function Wk(e){return e&&typeof e=="number"?e:1}class Nn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Dc(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Nn.prototype.file="";Nn.prototype.name="";Nn.prototype.reason="";Nn.prototype.message="";Nn.prototype.stack="";Nn.prototype.column=void 0;Nn.prototype.line=void 0;Nn.prototype.ancestors=void 0;Nn.prototype.cause=void 0;Nn.prototype.fatal=void 0;Nn.prototype.place=void 0;Nn.prototype.ruleId=void 0;Nn.prototype.source=void 0;const y_={}.hasOwnProperty,TY=new Map,NY=/[A-Z]/g,RY=new Set(["table","tbody","thead","tfoot","tr"]),PY=new Set(["td","th"]),LR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function AY(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=$Y(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=zY(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?g_:ZG,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=jR(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function jR(e,t,n){if(t.type==="element")return MY(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return LY(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return DY(e,t,n);if(t.type==="mdxjsEsm")return jY(e,t);if(t.type==="root")return OY(e,t,n);if(t.type==="text")return BY(e,t)}function MY(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=g_,e.schema=i),e.ancestors.push(t);const s=OR(e,t.tagName,!1),o=FY(e,t);let a=b_(e,t);return RY.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!FG(l):!0})),DR(e,o,s,t),__(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function LY(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}_u(e,t.position)}function jY(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_u(e,t.position)}function DY(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=g_,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:OR(e,t.name,!0),o=HY(e,t),a=b_(e,t);return DR(e,o,s,t),__(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function OY(e,t,n){const r={};return __(r,b_(e,t)),e.create(t,e.Fragment,r,n)}function BY(e,t){return t.value}function DR(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function __(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function zY(e,t,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:t;return a?c(s,o,a):c(s,o)}}function $Y(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=x_(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function FY(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&y_.call(t.properties,i)){const s=UY(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&PY.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function HY(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else _u(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else _u(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function b_(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:TY;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=jR(e,s,o);a!==void 0&&n.push(a)}return n}function UY(e,t,n){const r=GG(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?DG(n):QG(n)),r.property==="style"){let i=typeof n=="object"?n:WY(e,String(n));return e.stylePropertyNameCase==="css"&&(i=qY(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?qG[r.property]||r.property:r.attribute,n]}}function WY(e,t){try{return EY(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Nn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=LR+"#cannot-parse-style-attribute",i}}function OR(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=Lk(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=Lk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return y_.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);_u(e)}function _u(e,t){const n=new Nn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=LR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function qY(e){const t={};let n;for(n in e)y_.call(e,n)&&(t[VY(n)]=e[n]);return t}function VY(e){let t=e.replace(NY,KY);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function KY(e){return"-"+e.toLowerCase()}const fg={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"]},GY={};function w_(e,t){const n=GY,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return BR(e,r,i)}function BR(e,t,n){if(YY(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return qk(e.children,t,n)}return Array.isArray(e)?qk(e,t,n):""}function qk(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=BR(e[i],t,n);return r.join("")}function YY(e){return!!(e&&typeof e=="object")}const Vk=document.createElement("i");function S_(e){const t="&"+e+";";Vk.innerHTML=t;const n=Vk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yn(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function gn(e,t){return e.length>0?(yn(e,e.length,0,t),e):t}const Kk={}.hasOwnProperty;function zR(e){const t={};let n=-1;for(;++n<e.length;)XY(t,e[n]);return t}function XY(e,t){let n;for(n in t){const i=(Kk.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){Kk.call(i,o)||(i[o]=[]);const a=s[o];ZY(i[o],Array.isArray(a)?a:a?[a]:[])}}}function ZY(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);yn(e,0,0,r)}function $R(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Vr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Mn=eo(/[A-Za-z]/),En=eo(/[\dA-Za-z]/),QY=eo(/[#-'*+\--9=?A-Z^-~]/);function Df(e){return e!==null&&(e<32||e===127)}const rx=eo(/\d/),JY=eo(/[\dA-Fa-f]/),eX=eo(/[!-/:-@[-`{-~]/);function ke(e){return e!==null&&e<-2}function ut(e){return e!==null&&(e<0||e===32)}function Ge(e){return e===-2||e===-1||e===32}const Qp=eo(new RegExp("\\p{P}|\\p{S}","u")),Bo=eo(/\s/);function eo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ll(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&En(e.charCodeAt(n+1))&&En(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Qe(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ge(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ge(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const tX={tokenize:nX};function nX(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Qe(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return ke(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const rX={tokenize:iX},Gk={tokenize:sX};function iX(e){const t=this,n=[];let r=0,i,s,o;return a;function a(b){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,c)(b)}return c(b)}function l(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&_();const S=t.events.length;let C=S,k;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){k=t.events[C][1].end;break}x(r);let T=S;for(;T<t.events.length;)t.events[T][1].end={...k},T++;return yn(t.events,C+1,0,t.events.slice(S)),t.events.length=T,c(b)}return a(b)}function c(b){if(r===n.length){if(!i)return f(b);if(i.currentConstruct&&i.currentConstruct.concrete)return m(b);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Gk,u,d)(b)}function u(b){return i&&_(),x(r),f(b)}function d(b){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(b)}function f(b){return t.containerState={},e.attempt(Gk,p,m)(b)}function p(b){return r++,n.push([t.currentConstruct,t.containerState]),f(b)}function m(b){if(b===null){i&&_(),x(0),e.consume(b);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),v(b)}function v(b){if(b===null){w(e.exit("chunkFlow"),!0),x(0),e.consume(b);return}return ke(b)?(e.consume(b),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(b),v)}function w(b,S){const C=t.sliceStream(b);if(S&&C.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(C),t.parser.lazy[b.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const T=t.events.length;let I=T,j,R;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(j){R=t.events[I][1].end;break}j=!0}for(x(r),k=T;k<t.events.length;)t.events[k][1].end={...R},k++;yn(t.events,I+1,0,t.events.slice(T)),t.events.length=k}}function x(b){let S=n.length;for(;S-- >b;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=b}function _(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function sX(e,t,n){return Qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function cl(e){if(e===null||ut(e)||Bo(e))return 1;if(Qp(e))return 2}function jl(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const ix={name:"attention",resolveAll:oX,tokenize:aX};function oX(e,t){let n=-1,r,i,s,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};Yk(d,-l),Yk(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=gn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=gn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=gn(c,jl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=gn(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=gn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,yn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function aX(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=cl(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const c=e.exit("attentionSequence"),u=cl(l),d=!u||u===2&&i||n.includes(l),f=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?d:d&&(i||!f)),c._close=!!(s===42?f:f&&(u||!d)),t(l)}}function Yk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const lX={name:"autolink",tokenize:cX};function cX(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return Mn(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||En(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||En(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Df(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):QY(p)?(e.consume(p),c):n(p)}function u(p){return En(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||En(p))&&r++<63){const m=p===45?f:d;return e.consume(p),m}return n(p)}}const Gu={partial:!0,tokenize:uX};function uX(e,t,n){return r;function r(s){return Ge(s)?Qe(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||ke(s)?t(s):n(s)}}const FR={continuation:{tokenize:hX},exit:fX,name:"blockQuote",tokenize:dX};function dX(e,t,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Ge(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function hX(e,t,n){const r=this;return i;function i(o){return Ge(o)?Qe(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(FR,t,n)(o)}}function fX(e){e.exit("blockQuote")}const HR={name:"characterEscape",tokenize:pX};function pX(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return eX(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const UR={name:"characterReference",tokenize:mX};function mX(e,t,n){const r=this;let i=0,s,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=En,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=JY,u):(e.enter("characterReferenceValue"),s=7,o=rx,u(d))}function u(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return o===En&&!S_(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&i++<s?(e.consume(d),u):n(d)}}const Xk={partial:!0,tokenize:vX},Zk={concrete:!0,name:"codeFenced",tokenize:gX};function gX(e,t,n){const r=this,i={partial:!0,tokenize:C};let s=0,o=0,a;return l;function l(k){return c(k)}function c(k){const T=r.events[r.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===a?(o++,e.consume(k),u):o<3?n(k):(e.exit("codeFencedFenceSequence"),Ge(k)?Qe(e,d,"whitespace")(k):d(k))}function d(k){return k===null||ke(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Xk,v,S)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||ke(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):Ge(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Qe(e,p,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),f)}function p(k){return k===null||ke(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||ke(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===a?n(k):(e.consume(k),m)}function v(k){return e.attempt(i,S,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),x}function x(k){return s>0&&Ge(k)?Qe(e,_,"linePrefix",s+1)(k):_(k)}function _(k){return k===null||ke(k)?e.check(Xk,v,S)(k):(e.enter("codeFlowValue"),b(k))}function b(k){return k===null||ke(k)?(e.exit("codeFlowValue"),_(k)):(e.consume(k),b)}function S(k){return e.exit("codeFenced"),t(k)}function C(k,T,I){let j=0;return R;function R(L){return k.enter("lineEnding"),k.consume(L),k.exit("lineEnding"),D}function D(L){return k.enter("codeFencedFence"),Ge(L)?Qe(k,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):P(L)}function P(L){return L===a?(k.enter("codeFencedFenceSequence"),A(L)):I(L)}function A(L){return L===a?(j++,k.consume(L),A):j>=o?(k.exit("codeFencedFenceSequence"),Ge(L)?Qe(k,M,"whitespace")(L):M(L)):I(L)}function M(L){return L===null||ke(L)?(k.exit("codeFencedFence"),T(L)):I(L)}}}function vX(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const pg={name:"codeIndented",tokenize:yX},xX={partial:!0,tokenize:_X};function yX(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Qe(e,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):ke(c)?e.attempt(xX,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||ke(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function _X(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):ke(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Qe(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):ke(o)?i(o):n(o)}}const bX={name:"codeText",previous:SX,resolve:wX,tokenize:kX};function wX(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function SX(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function kX(e,t,n){let r=0,i,s;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(s=e.enter("codeTextSequence"),i=0,u(d)):ke(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||ke(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",c(d))}}class CX{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&tc(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),tc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),tc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);tc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);tc(this.left,n.reverse())}}}function tc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function WR(e){const t={};let n=-1,r,i,s,o,a,l,c;const u=new CX(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,EX(u,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return yn(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function EX(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,f=-1,p=n,m=0,v=0;const w=[v];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(v=f+1,w.push(v),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):w.pop(),f=w.length;f--;){const x=a.slice(w[f],w[f+1]),_=s.pop();l.push([_,_+x.length-1]),e.splice(_,2,x)}for(l.reverse(),f=-1;++f<l.length;)c[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return c}const IX={resolve:NX,tokenize:RX},TX={partial:!0,tokenize:PX};function NX(e){return WR(e),e}function RX(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):ke(a)?e.check(TX,o,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function PX(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Qe(e,s,"linePrefix")}function s(o){if(o===null||ke(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function qR(e,t,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return x===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(x),e.exit(s),f):x===null||x===32||x===41||Df(x)?n(x):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(x))}function f(x){return x===62?(e.enter(s),e.consume(x),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(a),f(x)):x===null||x===60||ke(x)?n(x):(e.consume(x),x===92?m:p)}function m(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function v(x){return!u&&(x===null||x===41||ut(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(x)):u<c&&x===40?(e.consume(x),u++,v):x===41?(e.consume(x),u--,v):x===null||x===32||x===40||Df(x)?n(x):(e.consume(x),x===92?w:v)}function w(x){return x===40||x===41||x===92?(e.consume(x),v):v(x)}}function VR(e,t,n,r,i,s){const o=this;let a=0,l;return c;function c(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(s),u}function u(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):ke(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||ke(p)||a++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!Ge(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function KR(e,t,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),l(o)):f===null?n(f):ke(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Qe(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||ke(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(e.consume(f),u):u(f)}}function Oc(e,t){let n;return r;function r(i){return ke(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ge(i)?Qe(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const AX={name:"definition",tokenize:LX},MX={partial:!0,tokenize:jX};function LX(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return VR.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Vr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ut(p)?Oc(e,c)(p):c(p)}function c(p){return qR(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(MX,d,d)(p)}function d(p){return Ge(p)?Qe(e,f,"whitespace")(p):f(p)}function f(p){return p===null||ke(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function jX(e,t,n){return r;function r(a){return ut(a)?Oc(e,i)(a):n(a)}function i(a){return KR(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ge(a)?Qe(e,o,"whitespace")(a):o(a)}function o(a){return a===null||ke(a)?t(a):n(a)}}const DX={name:"hardBreakEscape",tokenize:OX};function OX(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return ke(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const BX={name:"headingAtx",resolve:zX,tokenize:$X};function zX(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},yn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function $X(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),s(u)}function s(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||ut(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||ke(u)?(e.exit("atxHeading"),t(u)):Ge(u)?Qe(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||ut(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const FX=["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"],Qk=["pre","script","style","textarea"],HX={concrete:!0,name:"htmlFlow",resolveTo:qX,tokenize:VX},UX={partial:!0,tokenize:GX},WX={partial:!0,tokenize:KX};function qX(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function VX(e,t,n){const r=this;let i,s,o,a,l;return c;function c(O){return u(O)}function u(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),d}function d(O){return O===33?(e.consume(O),f):O===47?(e.consume(O),s=!0,v):O===63?(e.consume(O),i=3,r.interrupt?t:E):Mn(O)?(e.consume(O),o=String.fromCharCode(O),w):n(O)}function f(O){return O===45?(e.consume(O),i=2,p):O===91?(e.consume(O),i=5,a=0,m):Mn(O)?(e.consume(O),i=4,r.interrupt?t:E):n(O)}function p(O){return O===45?(e.consume(O),r.interrupt?t:E):n(O)}function m(O){const te="CDATA[";return O===te.charCodeAt(a++)?(e.consume(O),a===te.length?r.interrupt?t:P:m):n(O)}function v(O){return Mn(O)?(e.consume(O),o=String.fromCharCode(O),w):n(O)}function w(O){if(O===null||O===47||O===62||ut(O)){const te=O===47,se=o.toLowerCase();return!te&&!s&&Qk.includes(se)?(i=1,r.interrupt?t(O):P(O)):FX.includes(o.toLowerCase())?(i=6,te?(e.consume(O),x):r.interrupt?t(O):P(O)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):s?_(O):b(O))}return O===45||En(O)?(e.consume(O),o+=String.fromCharCode(O),w):n(O)}function x(O){return O===62?(e.consume(O),r.interrupt?t:P):n(O)}function _(O){return Ge(O)?(e.consume(O),_):R(O)}function b(O){return O===47?(e.consume(O),R):O===58||O===95||Mn(O)?(e.consume(O),S):Ge(O)?(e.consume(O),b):R(O)}function S(O){return O===45||O===46||O===58||O===95||En(O)?(e.consume(O),S):C(O)}function C(O){return O===61?(e.consume(O),k):Ge(O)?(e.consume(O),C):b(O)}function k(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),l=O,T):Ge(O)?(e.consume(O),k):I(O)}function T(O){return O===l?(e.consume(O),l=null,j):O===null||ke(O)?n(O):(e.consume(O),T)}function I(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||ut(O)?C(O):(e.consume(O),I)}function j(O){return O===47||O===62||Ge(O)?b(O):n(O)}function R(O){return O===62?(e.consume(O),D):n(O)}function D(O){return O===null||ke(O)?P(O):Ge(O)?(e.consume(O),D):n(O)}function P(O){return O===45&&i===2?(e.consume(O),$):O===60&&i===1?(e.consume(O),F):O===62&&i===4?(e.consume(O),U):O===63&&i===3?(e.consume(O),E):O===93&&i===5?(e.consume(O),B):ke(O)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(UX,q,A)(O)):O===null||ke(O)?(e.exit("htmlFlowData"),A(O)):(e.consume(O),P)}function A(O){return e.check(WX,M,q)(O)}function M(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),L}function L(O){return O===null||ke(O)?A(O):(e.enter("htmlFlowData"),P(O))}function $(O){return O===45?(e.consume(O),E):P(O)}function F(O){return O===47?(e.consume(O),o="",z):P(O)}function z(O){if(O===62){const te=o.toLowerCase();return Qk.includes(te)?(e.consume(O),U):P(O)}return Mn(O)&&o.length<8?(e.consume(O),o+=String.fromCharCode(O),z):P(O)}function B(O){return O===93?(e.consume(O),E):P(O)}function E(O){return O===62?(e.consume(O),U):O===45&&i===2?(e.consume(O),E):P(O)}function U(O){return O===null||ke(O)?(e.exit("htmlFlowData"),q(O)):(e.consume(O),U)}function q(O){return e.exit("htmlFlow"),t(O)}}function KX(e,t,n){const r=this;return i;function i(o){return ke(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function GX(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Gu,t,n)}}const YX={name:"htmlText",tokenize:XX};function XX(e,t,n){const r=this;let i,s,o;return a;function a(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),l}function l(E){return E===33?(e.consume(E),c):E===47?(e.consume(E),C):E===63?(e.consume(E),b):Mn(E)?(e.consume(E),I):n(E)}function c(E){return E===45?(e.consume(E),u):E===91?(e.consume(E),s=0,m):Mn(E)?(e.consume(E),_):n(E)}function u(E){return E===45?(e.consume(E),p):n(E)}function d(E){return E===null?n(E):E===45?(e.consume(E),f):ke(E)?(o=d,F(E)):(e.consume(E),d)}function f(E){return E===45?(e.consume(E),p):d(E)}function p(E){return E===62?$(E):E===45?f(E):d(E)}function m(E){const U="CDATA[";return E===U.charCodeAt(s++)?(e.consume(E),s===U.length?v:m):n(E)}function v(E){return E===null?n(E):E===93?(e.consume(E),w):ke(E)?(o=v,F(E)):(e.consume(E),v)}function w(E){return E===93?(e.consume(E),x):v(E)}function x(E){return E===62?$(E):E===93?(e.consume(E),x):v(E)}function _(E){return E===null||E===62?$(E):ke(E)?(o=_,F(E)):(e.consume(E),_)}function b(E){return E===null?n(E):E===63?(e.consume(E),S):ke(E)?(o=b,F(E)):(e.consume(E),b)}function S(E){return E===62?$(E):b(E)}function C(E){return Mn(E)?(e.consume(E),k):n(E)}function k(E){return E===45||En(E)?(e.consume(E),k):T(E)}function T(E){return ke(E)?(o=T,F(E)):Ge(E)?(e.consume(E),T):$(E)}function I(E){return E===45||En(E)?(e.consume(E),I):E===47||E===62||ut(E)?j(E):n(E)}function j(E){return E===47?(e.consume(E),$):E===58||E===95||Mn(E)?(e.consume(E),R):ke(E)?(o=j,F(E)):Ge(E)?(e.consume(E),j):$(E)}function R(E){return E===45||E===46||E===58||E===95||En(E)?(e.consume(E),R):D(E)}function D(E){return E===61?(e.consume(E),P):ke(E)?(o=D,F(E)):Ge(E)?(e.consume(E),D):j(E)}function P(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),i=E,A):ke(E)?(o=P,F(E)):Ge(E)?(e.consume(E),P):(e.consume(E),M)}function A(E){return E===i?(e.consume(E),i=void 0,L):E===null?n(E):ke(E)?(o=A,F(E)):(e.consume(E),A)}function M(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||ut(E)?j(E):(e.consume(E),M)}function L(E){return E===47||E===62||ut(E)?j(E):n(E)}function $(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function F(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),z}function z(E){return Ge(E)?Qe(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):B(E)}function B(E){return e.enter("htmlTextData"),o(E)}}const k_={name:"labelEnd",resolveAll:eZ,resolveTo:tZ,tokenize:nZ},ZX={tokenize:rZ},QX={tokenize:iZ},JX={tokenize:sZ};function eZ(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&yn(e,0,e.length,n),e}function tZ(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=gn(a,e.slice(s+1,s+r+3)),a=gn(a,[["enter",u,t]]),a=gn(a,jl(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=gn(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=gn(a,e.slice(o+1)),a=gn(a,[["exit",l,t]]),yn(e,s,e.length,a),e}function nZ(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(f){return s?s._inactive?d(f):(o=r.parser.defined.includes(Vr(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(ZX,u,o?u:d)(f):f===91?e.attempt(QX,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(JX,u,d)(f)}function u(f){return t(f)}function d(f){return s._balanced=!0,n(f)}}function rZ(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return ut(d)?Oc(e,s)(d):s(d)}function s(d){return d===41?u(d):qR(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ut(d)?Oc(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?KR(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ut(d)?Oc(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function iZ(e,t,n){const r=this;return i;function i(a){return VR.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Vr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function sZ(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const oZ={name:"labelStartImage",resolveAll:k_.resolveAll,tokenize:aZ};function aZ(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const lZ={name:"labelStartLink",resolveAll:k_.resolveAll,tokenize:cZ};function cZ(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const mg={name:"lineEnding",tokenize:uZ};function uZ(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Qe(e,t,"linePrefix")}}const Nh={name:"thematicBreak",tokenize:dZ};function dZ(e,t,n){let r=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||ke(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ge(c)?Qe(e,a,"whitespace")(c):a(c))}}const qn={continuation:{tokenize:mZ},exit:vZ,name:"list",tokenize:pZ},hZ={partial:!0,tokenize:xZ},fZ={partial:!0,tokenize:gZ};function pZ(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:rx(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Nh,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return rx(p)&&++o<10?(e.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Gu,r.interrupt?n:u,e.attempt(hZ,f,d))}function u(p){return r.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return Ge(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function mZ(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Gu,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Qe(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Ge(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(fZ,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Qe(e,e.attempt(qn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function gZ(e,t,n){const r=this;return Qe(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function vZ(e){e.exit(this.containerState.type)}function xZ(e,t,n){const r=this;return Qe(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ge(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Jk={name:"setextUnderline",resolveTo:yZ,tokenize:_Z};function yZ(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function _Z(e,t,n){const r=this;let i;return s;function s(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Ge(c)?Qe(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||ke(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const bZ={tokenize:wZ};function wZ(e){const t=this,n=e.attempt(Gu,r,e.attempt(this.parser.constructs.flowInitial,i,Qe(e,e.attempt(this.parser.constructs.flow,i,e.attempt(IX,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const SZ={resolveAll:YR()},kZ=GR("string"),CZ=GR("text");function GR(e){return{resolveAll:YR(e==="text"?EZ:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function YR(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function EZ(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const IZ={42:qn,43:qn,45:qn,48:qn,49:qn,50:qn,51:qn,52:qn,53:qn,54:qn,55:qn,56:qn,57:qn,62:FR},TZ={91:AX},NZ={[-2]:pg,[-1]:pg,32:pg},RZ={35:BX,42:Nh,45:[Jk,Nh],60:HX,61:Jk,95:Nh,96:Zk,126:Zk},PZ={38:UR,92:HR},AZ={[-5]:mg,[-4]:mg,[-3]:mg,33:oZ,38:UR,42:ix,60:[lX,YX],91:lZ,92:[DX,HR],93:k_,95:ix,96:bX},MZ={null:[ix,SZ]},LZ={null:[42,95]},jZ={null:[]},DZ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:LZ,contentInitial:TZ,disable:jZ,document:IZ,flow:RZ,flowInitial:NZ,insideSpan:MZ,string:PZ,text:AZ},Symbol.toStringTag,{value:"Module"}));function OZ(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:T(C),check:T(k),consume:_,enter:b,exit:S,interrupt:T(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:v,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function d(D){return o=gn(o,D),w(),o[o.length-1]!==null?[]:(I(t,0),c.events=jl(s,c.events,c),c.events)}function f(D,P){return zZ(p(D),P)}function p(D){return BZ(o,D)}function m(){const{_bufferIndex:D,_index:P,line:A,column:M,offset:L}=r;return{_bufferIndex:D,_index:P,line:A,column:M,offset:L}}function v(D){i[D.line]=D.column,R()}function w(){let D;for(;r._index<o.length;){const P=o[r._index];if(typeof P=="string")for(D=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===D&&r._bufferIndex<P.length;)x(P.charCodeAt(r._bufferIndex));else x(P)}}function x(D){u=u(D)}function _(D){ke(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,R()):D!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=D}function b(D,P){const A=P||{};return A.type=D,A.start=m(),c.events.push(["enter",A,c]),a.push(A),A}function S(D){const P=a.pop();return P.end=m(),c.events.push(["exit",P,c]),P}function C(D,P){I(D,P.from)}function k(D,P){P.restore()}function T(D,P){return A;function A(M,L,$){let F,z,B,E;return Array.isArray(M)?q(M):"tokenize"in M?q([M]):U(M);function U(G){return me;function me(Ie){const ue=Ie!==null&&G[Ie],Ae=Ie!==null&&G.null,Oe=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(Ae)?Ae:Ae?[Ae]:[]];return q(Oe)(Ie)}}function q(G){return F=G,z=0,G.length===0?$:O(G[z])}function O(G){return me;function me(Ie){return E=j(),B=G,G.partial||(c.currentConstruct=G),G.name&&c.parser.constructs.disable.null.includes(G.name)?se():G.tokenize.call(P?Object.assign(Object.create(c),P):c,l,te,se)(Ie)}}function te(G){return D(B,E),L}function se(G){return E.restore(),++z<F.length?O(F[z]):$}}}function I(D,P){D.resolveAll&&!s.includes(D)&&s.push(D),D.resolve&&yn(c.events,P,c.events.length-P,D.resolve(c.events.slice(P),c)),D.resolveTo&&(c.events=D.resolveTo(c.events,c))}function j(){const D=m(),P=c.previous,A=c.currentConstruct,M=c.events.length,L=Array.from(a);return{from:M,restore:$};function $(){r=D,c.previous=P,c.currentConstruct=A,c.events.length=M,a=L,R()}}function R(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function BZ(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function zZ(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
521
521
|
`;break}case-3:{o=`\r
|
|
522
522
|
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function $Z(e){const r={constructs:zR([DZ,...(e||{}).extensions||[]]),content:i(tX),defined:[],document:i(rX),flow:i(bZ),lazy:{},string:i(kZ),text:i(CZ)};return r;function i(s){return o;function o(a){return OZ(r,s,a)}}}function FZ(e){for(;!WR(e););return e}const eC=/[\0\t\n\r]/g;function HZ(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,d,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(eC.lastIndex=d,c=eC.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(d);break}if(p===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(s.slice(d,f)),e+=f-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const UZ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function WZ(e){return e.replace(UZ,qZ)}function qZ(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return $R(n.slice(s?2:1),s?16:10)}return S_(n)||e}const XR={}.hasOwnProperty;function VZ(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),KZ(n)(FZ($Z(n).document().write(HZ()(e,t,!0))))}function KZ(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ie),autolinkProtocol:j,autolinkEmail:j,atxHeading:s(dt),blockQuote:s(Ae),characterEscape:j,characterReference:j,codeFenced:s(Oe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Oe,o),codeText:s(je,o),codeTextData:j,data:j,codeFlowValue:j,definition:s(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Ze),hardBreakEscape:s(nt),hardBreakTrailing:s(nt),htmlFlow:s(vt,o),htmlFlowData:j,htmlText:s(vt,o),htmlTextData:j,image:s(jt),label:o,link:s(ie),listItem:s(Ce),listItemValue:f,listOrdered:s(We,d),listUnordered:s(We),paragraph:s($e),reference:O,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(dt),strong:s(_t),thematicBreak:s(Rn)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:ue,autolinkProtocol:Ie,blockQuote:l(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:G,characterReference:me,codeFenced:l(w),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:R,codeIndented:l(x),codeText:l(L),codeTextData:R,data:R,definition:l(),definitionDestinationString:S,definitionLabelString:_,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(P),hardBreakTrailing:l(P),htmlFlow:l(A),htmlFlowData:R,htmlText:l(M),htmlTextData:R,image:l(F),label:B,labelText:z,lineEnding:D,link:l($),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:te,resourceDestinationString:E,resourceTitleString:U,resource:q,setextHeading:l(I),setextHeadingLineSequence:T,setextHeadingText:k,strong:l(),thematicBreak:l()}};ZR(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let ee={type:"root",children:[]};const we={stack:[ee],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},Me=[];let qe=-1;for(;++qe<W.length;)if(W[qe][1].type==="listOrdered"||W[qe][1].type==="listUnordered")if(W[qe][0]==="enter")Me.push(qe);else{const Tt=Me.pop();qe=i(W,Tt,qe)}for(qe=-1;++qe<W.length;){const Tt=t[W[qe][0]];XR.call(Tt,W[qe][1].type)&&Tt[W[qe][1].type].call(Object.assign({sliceSerialize:W[qe][2].sliceSerialize},we),W[qe][1])}if(we.tokenStack.length>0){const Tt=we.tokenStack[we.tokenStack.length-1];(Tt[1]||tC).call(we,void 0,Tt[0])}for(ee.position={start:hs(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:hs(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<t.transforms.length;)ee=t.transforms[qe](ee)||ee;return ee}function i(W,ee,we){let Me=ee-1,qe=-1,Tt=!1,en,tn,nn,ae;for(;++Me<=we;){const Se=W[Me];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?qe++:qe--,ae=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(en&&!ae&&!qe&&!nn&&(nn=Me),ae=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ae=void 0}if(!qe&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||qe===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(en){let rt=Me;for(tn=void 0;rt--;){const bt=W[rt];if(bt[1].type==="lineEnding"||bt[1].type==="lineEndingBlank"){if(bt[0]==="exit")continue;tn&&(W[tn][1].type="lineEndingBlank",Tt=!0),bt[1].type="lineEnding",tn=rt}else if(!(bt[1].type==="linePrefix"||bt[1].type==="blockQuotePrefix"||bt[1].type==="blockQuotePrefixWhitespace"||bt[1].type==="blockQuoteMarker"||bt[1].type==="listItemIndent"))break}nn&&(!tn||nn<tn)&&(en._spread=!0),en.end=Object.assign({},tn?W[tn][1].start:Se[1].end),W.splice(tn||Me,0,["exit",en,Se[2]]),Me++,we++}if(Se[1].type==="listItemPrefix"){const rt={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};en=rt,W.splice(Me,0,["enter",rt,Se[2]]),Me++,we++,nn=void 0,ae=!0}}}return W[ee][1]._spread=Tt,we}function s(W,ee){return we;function we(Me){a.call(this,W(Me),Me),ee&&ee.call(this,Me)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(W,ee,we){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([ee,we||void 0]),W.position={start:hs(ee.start),end:void 0}}function l(W){return ee;function ee(we){W&&W.call(this,we),c.call(this,we)}}function c(W,ee){const we=this.stack.pop(),Me=this.tokenStack.pop();if(Me)Me[0].type!==W.type&&(ee?ee.call(this,W,Me[0]):(Me[1]||tC).call(this,W,Me[0]));else throw new Error("Cannot close `"+W.type+"` ("+Dc({start:W.start,end:W.end})+"): it’s not open");we.position.end=hs(W.end)}function u(){return w_(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(W){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function p(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=W}function m(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=W}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/(\r?\n|\r)$/g,"")}function _(W){const ee=this.resume(),we=this.stack[this.stack.length-1];we.label=ee,we.identifier=Vr(this.sliceSerialize(W)).toLowerCase()}function b(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function S(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function C(W){const ee=this.stack[this.stack.length-1];if(!ee.depth){const we=this.sliceSerialize(W).length;ee.depth=we}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function T(W){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function j(W){const we=this.stack[this.stack.length-1].children;let Me=we[we.length-1];(!Me||Me.type!=="text")&&(Me=hn(),Me.position={start:hs(W.start),end:void 0},we.push(Me)),this.stack.push(Me)}function R(W){const ee=this.stack.pop();ee.value+=this.sliceSerialize(W),ee.position.end=hs(W.end)}function D(W){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const we=ee.children[ee.children.length-1];we.position.end=hs(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&(j.call(this,W),R.call(this,W))}function P(){this.data.atHardBreak=!0}function A(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function M(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function L(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function $(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function F(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function z(W){const ee=this.sliceSerialize(W),we=this.stack[this.stack.length-2];we.label=WZ(ee),we.identifier=Vr(ee).toLowerCase()}function B(){const W=this.stack[this.stack.length-1],ee=this.resume(),we=this.stack[this.stack.length-1];if(this.data.inReference=!0,we.type==="link"){const Me=W.children;we.children=Me}else we.alt=ee}function E(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function U(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function q(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function te(W){const ee=this.resume(),we=this.stack[this.stack.length-1];we.label=ee,we.identifier=Vr(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function se(W){this.data.characterReferenceType=W.type}function G(W){const ee=this.sliceSerialize(W),we=this.data.characterReferenceType;let Me;we?(Me=$R(ee,we==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Me=S_(ee);const qe=this.stack[this.stack.length-1];qe.value+=Me}function me(W){const ee=this.stack.pop();ee.position.end=hs(W.end)}function Ie(W){R.call(this,W);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(W)}function ue(W){R.call(this,W);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(W)}function Ae(){return{type:"blockquote",children:[]}}function Oe(){return{type:"code",lang:null,meta:null,value:""}}function je(){return{type:"inlineCode",value:""}}function ge(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ze(){return{type:"emphasis",children:[]}}function dt(){return{type:"heading",depth:0,children:[]}}function nt(){return{type:"break"}}function vt(){return{type:"html",value:""}}function jt(){return{type:"image",title:null,url:"",alt:null}}function ie(){return{type:"link",title:null,url:"",children:[]}}function We(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Ce(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function $e(){return{type:"paragraph",children:[]}}function _t(){return{type:"strong",children:[]}}function hn(){return{type:"text",value:""}}function Rn(){return{type:"thematicBreak"}}}function hs(e){return{line:e.line,column:e.column,offset:e.offset}}function ZR(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ZR(e,r):GZ(e,r)}}function GZ(e,t){let n;for(n in t)if(XR.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function tC(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Dc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Dc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Dc({start:t.start,end:t.end})+") is still open")}function YZ(e){const t=this;t.parser=n;function n(r){return VZ(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function XZ(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function ZZ(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
package/dist/share-ui/guest.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Clawd 分享</title>
|
|
7
|
-
<script type="module" crossorigin src="/share-ui/assets/guest-
|
|
7
|
+
<script type="module" crossorigin src="/share-ui/assets/guest-ep-uzh2e.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/share-ui/assets/guest-CZG8PmZ5.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body style="margin: 0">
|