@clawos-dev/clawd 0.2.350 → 0.2.351
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
|
@@ -60227,7 +60227,7 @@ function computeMethodAccess(args) {
|
|
|
60227
60227
|
}
|
|
60228
60228
|
|
|
60229
60229
|
// src/version.ts
|
|
60230
|
-
var version = "0.2.
|
|
60230
|
+
var version = "0.2.351".length > 0 ? "0.2.351" : "dev";
|
|
60231
60231
|
|
|
60232
60232
|
// src/cli-probe/probe.ts
|
|
60233
60233
|
var fs59 = __toESM(require("fs"), 1);
|
|
@@ -472,7 +472,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
472
472
|
`)},nS=function(){var e=parseInt(document.body.getAttribute(Ca)||"0",10);return isFinite(e)?e:0},e7=function(){g.useEffect(function(){return document.body.setAttribute(Ca,(nS()+1).toString()),function(){var e=nS()-1;e<=0?document.body.removeAttribute(Ca):document.body.setAttribute(Ca,e.toString())}},[])},t7=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;e7();var s=g.useMemo(function(){return Q9(i)},[i]);return g.createElement(Z9,{styles:J9(s,!t,i,n?"":"!important")})},p0=!1;if(typeof window<"u")try{var gd=Object.defineProperty({},"passive",{get:function(){return p0=!0,!0}});window.addEventListener("test",gd,gd),window.removeEventListener("test",gd,gd)}catch{p0=!1}var qo=p0?{passive:!1}:!1,n7=function(e){return e.tagName==="TEXTAREA"},ZP=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!n7(e)&&n[t]==="visible")},r7=function(e){return ZP(e,"overflowY")},i7=function(e){return ZP(e,"overflowX")},rS=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=JP(e,r);if(i){var s=eI(e,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},s7=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},o7=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},JP=function(e,t){return e==="v"?r7(t):i7(t)},eI=function(e,t){return e==="v"?s7(t):o7(t)},a7=function(e,t){return e==="h"&&t==="rtl"?-1:1},l7=function(e,t,n,r,i){var s=a7(e,window.getComputedStyle(t).direction),o=s*r,a=n.target,l=t.contains(a),c=!1,u=o>0,d=0,f=0;do{if(!a)break;var p=eI(e,a),m=p[0],v=p[1],b=p[2],_=v-b-s*m;(m||_)&&JP(e,a)&&(d+=_,f+=m);var x=a.parentNode;a=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},vd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},iS=function(e){return[e.deltaX,e.deltaY]},sS=function(e){return e&&"current"in e?e.current:e},c7=function(e,t){return e[0]===t[0]&&e[1]===t[1]},u7=function(e){return`
|
|
473
473
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
474
474
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
475
|
-
`)},d7=0,Ko=[];function h7(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(d7++)[0],s=g.useState(QP)[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=A9([e.lockRef.current],(e.shards||[]).map(sS),!0).filter(Boolean);return v.forEach(function(b){return b.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,b){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var _=vd(v),x=n.current,y="deltaX"in v?v.deltaX:x[0]-_[0],w="deltaY"in v?v.deltaY:x[1]-_[1],k,C=v.target,N=Math.abs(y)>Math.abs(w)?"h":"v";if("touches"in v&&N==="h"&&C.type==="range")return!1;var T=window.getSelection(),B=T&&T.anchorNode,P=B?B===C||B.contains(C):!1;if(P)return!1;var A=rS(N,C);if(!A)return!0;if(A?k=N:(k=N==="v"?"h":"v",A=rS(N,C)),!A)return!1;if(!r.current&&"changedTouches"in v&&(y||w)&&(r.current=k),!k)return!0;var I=r.current||k;return l7(I,b,v,I==="h"?y:w)},[]),l=g.useCallback(function(v){var b=v;if(!(!Ko.length||Ko[Ko.length-1]!==s)){var _="deltaY"in b?iS(b):vd(b),x=t.current.filter(function(k){return k.name===b.type&&(k.target===b.target||b.target===k.shadowParent)&&c7(k.delta,_)})[0];if(x&&x.should){b.cancelable&&b.preventDefault();return}if(!x){var y=(o.current.shards||[]).map(sS).filter(Boolean).filter(function(k){return k.contains(b.target)}),w=y.length>0?a(b,y[0]):!o.current.noIsolation;w&&b.cancelable&&b.preventDefault()}}},[]),c=g.useCallback(function(v,b,_,x){var y={name:v,delta:b,target:_,should:x,shadowParent:f7(_)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(w){return w!==y})},1)},[]),u=g.useCallback(function(v){n.current=vd(v),r.current=void 0},[]),d=g.useCallback(function(v){c(v.type,iS(v),v.target,a(v,e.lockRef.current))},[]),f=g.useCallback(function(v){c(v.type,vd(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return Ko.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,qo),document.addEventListener("touchmove",l,qo),document.addEventListener("touchstart",u,qo),function(){Ko=Ko.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,qo),document.removeEventListener("touchmove",l,qo),document.removeEventListener("touchstart",u,qo)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(s,{styles:u7(i)}):null,p?g.createElement(t7,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function f7(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const p7=H9(XP,h7);var Zx=g.forwardRef(function(e,t){return g.createElement(up,Gr({},e,{ref:t,sideCar:p7}))});Zx.classNames=up.classNames;var m0=["Enter"," "],m7=["ArrowDown","PageUp","Home"],tI=["ArrowUp","PageDown","End"],g7=[...m7,...tI],v7={ltr:[...m0,"ArrowRight"],rtl:[...m0,"ArrowLeft"]},_7={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bu="Menu",[Xc,x7,y7]=uP(bu),[Lo,nI]=Ao(bu,[y7,cp,FP]),wu=cp(),rI=FP(),[iI,Ds]=Lo(bu),[b7,Su]=Lo(bu),sI=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=wu(t),[l,c]=g.useState(null),u=g.useRef(!1),d=oi(s),f=dP(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(Xx,{...a,children:h.jsx(iI,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:h.jsx(b7,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};sI.displayName=bu;var w7="MenuAnchor",Jx=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=wu(n);return h.jsx(OP,{...i,...r,ref:t})});Jx.displayName=w7;var ey="MenuPortal",[S7,oI]=Lo(ey,{forceMount:void 0}),aI=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Ds(ey,t);return h.jsx(S7,{scope:t,forceMount:n,children:h.jsx($i,{present:n||s.open,children:h.jsx(Qx,{asChild:!0,container:i,children:r})})})};aI.displayName=ey;var gr="MenuContent",[k7,ty]=Lo(gr),lI=g.forwardRef((e,t)=>{const n=oI(gr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Ds(gr,e.__scopeMenu),o=Su(gr,e.__scopeMenu);return h.jsx(Xc.Provider,{scope:e.__scopeMenu,children:h.jsx($i,{present:r||s.open,children:h.jsx(Xc.Slot,{scope:e.__scopeMenu,children:o.modal?h.jsx(C7,{...i,ref:t}):h.jsx(E7,{...i,ref:t})})})})}),C7=g.forwardRef((e,t)=>{const n=Ds(gr,e.__scopeMenu),r=g.useRef(null),i=qt(t,r);return g.useEffect(()=>{const s=r.current;if(s)return KP(s)},[]),h.jsx(ny,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Pe(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),E7=g.forwardRef((e,t)=>{const n=Ds(gr,e.__scopeMenu);return h.jsx(ny,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),N7=Gc("MenuContent.ScrollLock"),ny=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,b=Ds(gr,n),_=Su(gr,n),x=wu(n),y=rI(n),w=x7(n),[k,C]=g.useState(null),N=g.useRef(null),T=qt(t,N,b.onContentChange),B=g.useRef(0),P=g.useRef(""),A=g.useRef(0),I=g.useRef(null),R=g.useRef("right"),j=g.useRef(0),z=m?Zx:g.Fragment,$=m?{as:N7,allowPinchZoom:!0}:void 0,F=O=>{var ye,Fe;const E=P.current+O,H=w().filter(ue=>!ue.disabled),V=document.activeElement,L=(ye=H.find(ue=>ue.ref.current===V))==null?void 0:ye.textValue,ne=H.map(ue=>ue.textValue),ae=z7(ne,E,L),G=(Fe=H.find(ue=>ue.textValue===ae))==null?void 0:Fe.ref.current;(function ue(Ie){P.current=Ie,window.clearTimeout(B.current),Ie!==""&&(B.current=window.setTimeout(()=>ue(""),1e3))})(E),G&&setTimeout(()=>G.focus())};g.useEffect(()=>()=>window.clearTimeout(B.current),[]),pP();const D=g.useCallback(O=>{var H,V;return R.current===((H=I.current)==null?void 0:H.side)&&F7(O,(V=I.current)==null?void 0:V.area)},[]);return h.jsx(k7,{scope:n,searchRef:P,onItemEnter:g.useCallback(O=>{D(O)&&O.preventDefault()},[D]),onItemLeave:g.useCallback(O=>{var E;D(O)||((E=N.current)==null||E.focus(),C(null))},[D]),onTriggerLeave:g.useCallback(O=>{D(O)&&O.preventDefault()},[D]),pointerGraceTimerRef:A,onPointerGraceIntentChange:g.useCallback(O=>{I.current=O},[]),children:h.jsx(z,{...$,children:h.jsx(Fx,{asChild:!0,trapped:i,onMountAutoFocus:Pe(s,O=>{var E;O.preventDefault(),(E=N.current)==null||E.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:h.jsx(ip,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:h.jsx(T9,{asChild:!0,...y,dir:_.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:C,onEntryFocus:Pe(l,O=>{_.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(BP,{role:"menu","aria-orientation":"vertical","data-state":CI(b.open),"data-radix-menu-content":"",dir:_.dir,...x,...v,ref:T,style:{outline:"none",...v.style},onKeyDown:Pe(v.onKeyDown,O=>{const H=O.target.closest("[data-radix-menu-content]")===O.currentTarget,V=O.ctrlKey||O.altKey||O.metaKey,L=O.key.length===1;H&&(O.key==="Tab"&&O.preventDefault(),!V&&L&&F(O.key));const ne=N.current;if(O.target!==ne||!g7.includes(O.key))return;O.preventDefault();const G=w().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);tI.includes(O.key)&&G.reverse(),O7(G)}),onBlur:Pe(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(B.current),P.current="")}),onPointerMove:Pe(e.onPointerMove,Qc(O=>{const E=O.target,H=j.current!==O.clientX;if(O.currentTarget.contains(E)&&H){const V=O.clientX>j.current?"right":"left";R.current=V,j.current=O.clientX}}))})})})})})})});lI.displayName=gr;var T7="MenuGroup",ry=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Et.div,{role:"group",...r,ref:t})});ry.displayName=T7;var P7="MenuLabel",cI=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Et.div,{...r,ref:t})});cI.displayName=P7;var Jh="MenuItem",oS="menu.itemSelect",dp=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=g.useRef(null),o=Su(Jh,e.__scopeMenu),a=ty(Jh,e.__scopeMenu),l=qt(t,s),c=g.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(oS,{bubbles:!0,cancelable:!0});d.addEventListener(oS,p=>r==null?void 0:r(p),{once:!0}),cP(d,f),f.defaultPrevented?c.current=!1:o.onClose()}};return h.jsx(uI,{...i,ref:l,disabled:n,onClick:Pe(e.onClick,u),onPointerDown:d=>{var f;(f=e.onPointerDown)==null||f.call(e,d),c.current=!0},onPointerUp:Pe(e.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:Pe(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||m0.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});dp.displayName=Jh;var uI=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=ty(Jh,n),a=rI(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(Xc.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:h.jsx(P9,{asChild:!0,...a,focusable:!r,children:h.jsx(Et.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:Pe(e.onPointerMove,Qc(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Pe(e.onPointerLeave,Qc(m=>o.onItemLeave(m))),onFocus:Pe(e.onFocus,()=>d(!0)),onBlur:Pe(e.onBlur,()=>d(!1))})})})}),I7="MenuCheckboxItem",dI=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return h.jsx(gI,{scope:e.__scopeMenu,checked:n,children:h.jsx(dp,{role:"menuitemcheckbox","aria-checked":ef(n)?"mixed":n,...i,ref:t,"data-state":oy(n),onSelect:Pe(i.onSelect,()=>r==null?void 0:r(ef(n)?!0:!n),{checkForDefaultPrevented:!1})})})});dI.displayName=I7;var hI="MenuRadioGroup",[R7,M7]=Lo(hI,{value:void 0,onValueChange:()=>{}}),fI=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=oi(r);return h.jsx(R7,{scope:e.__scopeMenu,value:n,onValueChange:s,children:h.jsx(ry,{...i,ref:t})})});fI.displayName=hI;var pI="MenuRadioItem",mI=g.forwardRef((e,t)=>{const{value:n,...r}=e,i=M7(pI,e.__scopeMenu),s=n===i.value;return h.jsx(gI,{scope:e.__scopeMenu,checked:s,children:h.jsx(dp,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":oy(s),onSelect:Pe(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});mI.displayName=pI;var iy="MenuItemIndicator",[gI,A7]=Lo(iy,{checked:!1}),vI=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=A7(iy,n);return h.jsx($i,{present:r||ef(s.checked)||s.checked===!0,children:h.jsx(Et.span,{...i,ref:t,"data-state":oy(s.checked)})})});vI.displayName=iy;var L7="MenuSeparator",_I=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Et.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});_I.displayName=L7;var j7="MenuArrow",xI=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=wu(n);return h.jsx(zP,{...i,...r,ref:t})});xI.displayName=j7;var sy="MenuSub",[D7,yI]=Lo(sy),bI=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=Ds(sy,t),o=wu(t),[a,l]=g.useState(null),[c,u]=g.useState(null),d=oi(i);return g.useEffect(()=>(s.open===!1&&d(!1),()=>d(!1)),[s.open,d]),h.jsx(Xx,{...o,children:h.jsx(iI,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:h.jsx(D7,{scope:t,contentId:Ti(),triggerId:Ti(),trigger:a,onTriggerChange:l,children:n})})})};bI.displayName=sy;var Gl="MenuSubTrigger",wI=g.forwardRef((e,t)=>{const n=Ds(Gl,e.__scopeMenu),r=Su(Gl,e.__scopeMenu),i=yI(Gl,e.__scopeMenu),s=ty(Gl,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(Jx,{asChild:!0,...c,children:h.jsx(uI,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":CI(n.open),...e,ref:vu(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:Pe(e.onPointerMove,Qc(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:Pe(e.onPointerLeave,Qc(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,b=v==="right",_=b?-5:5,x=f[b?"left":"right"],y=f[b?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+_,y:d.clientY},{x,y:f.top},{x:y,y:f.top},{x:y,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:Pe(e.onKeyDown,d=>{var p;const f=s.searchRef.current!=="";e.disabled||f&&d.key===" "||v7[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});wI.displayName=Gl;var SI="MenuSubContent",kI=g.forwardRef((e,t)=>{const n=oI(gr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Ds(gr,e.__scopeMenu),o=Su(gr,e.__scopeMenu),a=yI(SI,e.__scopeMenu),l=g.useRef(null),c=qt(t,l);return h.jsx(Xc.Provider,{scope:e.__scopeMenu,children:h.jsx($i,{present:r||s.open,children:h.jsx(Xc.Slot,{scope:e.__scopeMenu,children:h.jsx(ny,{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:Pe(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Pe(e.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Pe(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),f=_7[o.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});kI.displayName=SI;function CI(e){return e?"open":"closed"}function ef(e){return e==="indeterminate"}function oy(e){return ef(e)?"indeterminate":e?"checked":"unchecked"}function O7(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function B7(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function z7(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=B7(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 $7(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 F7(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return $7(n,t)}function Qc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var H7=sI,U7=Jx,W7=aI,V7=lI,q7=ry,K7=cI,G7=dp,Y7=dI,X7=fI,Q7=mI,Z7=vI,J7=_I,eH=xI,tH=bI,nH=wI,rH=kI,hp="DropdownMenu",[iH]=Ao(hp,[nI]),wn=nI(),[sH,EI]=iH(hp),NI=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=wn(t),c=g.useRef(null),[u,d]=_u({prop:i,defaultProp:s??!1,onChange:o,caller:hp});return h.jsx(sH,{scope:t,triggerId:Ti(),triggerRef:c,contentId:Ti(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:h.jsx(H7,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};NI.displayName=hp;var TI="DropdownMenuTrigger",PI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,s=EI(TI,n),o=wn(n);return h.jsx(U7,{asChild:!0,...o,children:h.jsx(Et.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:vu(t,s.triggerRef),onPointerDown:Pe(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Pe(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});PI.displayName=TI;var oH="DropdownMenuPortal",II=e=>{const{__scopeDropdownMenu:t,...n}=e,r=wn(t);return h.jsx(W7,{...r,...n})};II.displayName=oH;var RI="DropdownMenuContent",MI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=EI(RI,n),s=wn(n),o=g.useRef(!1);return h.jsx(V7,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:t,onCloseAutoFocus:Pe(e.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Pe(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)"}})});MI.displayName=RI;var aH="DropdownMenuGroup",lH=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(q7,{...i,...r,ref:t})});lH.displayName=aH;var cH="DropdownMenuLabel",AI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(K7,{...i,...r,ref:t})});AI.displayName=cH;var uH="DropdownMenuItem",LI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(G7,{...i,...r,ref:t})});LI.displayName=uH;var dH="DropdownMenuCheckboxItem",jI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(Y7,{...i,...r,ref:t})});jI.displayName=dH;var hH="DropdownMenuRadioGroup",fH=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(X7,{...i,...r,ref:t})});fH.displayName=hH;var pH="DropdownMenuRadioItem",mH=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(Q7,{...i,...r,ref:t})});mH.displayName=pH;var gH="DropdownMenuItemIndicator",DI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(Z7,{...i,...r,ref:t})});DI.displayName=gH;var vH="DropdownMenuSeparator",OI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(J7,{...i,...r,ref:t})});OI.displayName=vH;var _H="DropdownMenuArrow",xH=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(eH,{...i,...r,ref:t})});xH.displayName=_H;var yH=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,o=wn(t),[a,l]=_u({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return h.jsx(tH,{...o,open:a,onOpenChange:l,children:n})},bH="DropdownMenuSubTrigger",BI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(nH,{...i,...r,ref:t})});BI.displayName=bH;var wH="DropdownMenuSubContent",zI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(rH,{...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)"}})});zI.displayName=wH;var SH=NI,kH=PI,$I=II,FI=MI,HI=AI,UI=LI,WI=jI,CH=DI,VI=OI,EH=yH,qI=BI,KI=zI;const ay=SH,ly=kH,fp=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx($I,{children:h.jsx(FI,{ref:r,sideOffset:t,className:fe("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...n})}));fp.displayName=FI.displayName;const NH=EH,GI=g.forwardRef(({className:e,...t},n)=>h.jsx(qI,{ref:n,className:fe("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}));GI.displayName=qI.displayName;const YI=g.forwardRef(({className:e,...t},n)=>h.jsx($I,{children:h.jsx(KI,{ref:n,className:fe("z-50 min-w-[6rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...t})}));YI.displayName=KI.displayName;const yi=g.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(UI,{ref:r,className:fe("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}));yi.displayName=UI.displayName;const TH=g.forwardRef(({className:e,children:t,checked:n,...r},i)=>h.jsxs(WI,{ref:i,checked:n,className:fe("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(CH,{children:h.jsx(ul,{className:"h-3.5 w-3.5"})})}),t]}));TH.displayName=WI.displayName;const XI=g.forwardRef(({className:e,...t},n)=>h.jsx(VI,{ref:n,className:fe("-mx-1 my-1 h-px bg-border",e),...t}));XI.displayName=VI.displayName;const PH=g.forwardRef(({className:e,...t},n)=>h.jsx(HI,{ref:n,className:fe("px-2 py-1.5 text-xs font-semibold text-text-400",e),...t}));PH.displayName=HI.displayName;function IH({tool:e,className:t}){const n=w8(e);return h.jsx("span",{"data-testid":n?`session-icon-${e}`:"session-icon-default","aria-label":n?$x(e):"未知引擎",className:fe("w-3.5 h-3.5 shrink-0 inline-flex items-center justify-center",rp(e),t),children:h.jsx(np,{tool:e,className:"w-full h-full"})})}function QI(e){return e.compositionActive||!!e.nativeIsComposing||e.keyCode===229}function ZI(e){return e.key==="Enter"&&!e.shiftKey&&!QI(e)}function ku(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(ZI({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 RH({open:e,initialLabel:t,placeholder:n,onSubmit:r,onCancel:i}){const[s,o]=g.useState(t);g.useEffect(()=>{e&&o(t)},[e,t]);const a=ku(()=>r({label:s.trim()}),i);return e?el.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":"session-edit-dialog-overlay",children:h.jsxs("div",{"data-testid":"session-edit-dialog",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:l=>l.stopPropagation(),children:[h.jsx("div",{className:"text-[15px] font-semibold text-text-100",children:"Edit session"}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-[12px] font-semibold text-text-200 mb-1",children:"Label"}),h.jsx("input",{autoFocus:!0,type:"text",value:s,onChange:l=>o(l.target.value),...a,placeholder:n,"data-testid":"session-edit-dialog-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:()=>r({label:s.trim()}),"data-testid":"session-edit-dialog-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",children:"Save"})]})]})}),document.body):null}var MH=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"}),AH="VisuallyHidden",JI=g.forwardRef((e,t)=>h.jsx(Et.span,{...e,ref:t,style:{...MH,...e.style}}));JI.displayName=AH;var LH=JI,[pp]=Ao("Tooltip",[cp]),mp=cp(),eR="TooltipProvider",jH=700,g0="tooltip.open",[DH,cy]=pp(eR),tR=e=>{const{__scopeTooltip:t,delayDuration:n=jH,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(DH,{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})};tR.displayName=eR;var Zc="Tooltip",[OH,gp]=pp(Zc),nR=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=cy(Zc,e.__scopeTooltip),c=mp(t),[u,d]=g.useState(null),f=Ti(),p=g.useRef(0),m=o??l.disableHoverableContent,v=a??l.delayDuration,b=g.useRef(!1),[_,x]=_u({prop:r,defaultProp:i??!1,onChange:N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(g0))):l.onClose(),s==null||s(N)},caller:Zc}),y=g.useMemo(()=>_?b.current?"delayed-open":"instant-open":"closed",[_]),w=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,x(!0)},[x]),k=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x(!1)},[x]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,x(!0),p.current=0},v)},[v,x]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),h.jsx(Xx,{...c,children:h.jsx(OH,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayedRef.current?C():w()},[l.isOpenDelayedRef,C,w]),onTriggerLeave:g.useCallback(()=>{m?k():(window.clearTimeout(p.current),p.current=0)},[k,m]),onOpen:w,onClose:k,disableHoverableContent:m,children:n})})};nR.displayName=Zc;var v0="TooltipTrigger",rR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=gp(v0,n),s=cy(v0,n),o=mp(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(OP,{asChild:!0,...o,children:h.jsx(Et.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Pe(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Pe(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Pe(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Pe(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Pe(e.onBlur,i.onClose),onClick:Pe(e.onClick,i.onClose)})})});rR.displayName=v0;var BH="TooltipPortal",[$se,zH]=pp(BH,{forceMount:void 0}),Ha="TooltipContent",iR=g.forwardRef((e,t)=>{const n=zH(Ha,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=gp(Ha,e.__scopeTooltip);return h.jsx($i,{present:r||o.open,children:o.disableHoverableContent?h.jsx(sR,{side:i,...s,ref:t}):h.jsx($H,{side:i,...s,ref:t})})}),$H=g.forwardRef((e,t)=>{const n=gp(Ha,e.__scopeTooltip),r=cy(Ha,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 b=m.currentTarget,_={x:m.clientX,y:m.clientY},x=VH(_,b.getBoundingClientRect()),y=qH(_,x),w=KH(v.getBoundingClientRect()),k=YH([...y,...w]);a(k),d(!0)},[d]);return g.useEffect(()=>()=>f(),[f]),g.useEffect(()=>{if(l&&u){const m=b=>p(b,u),v=b=>p(b,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 b=v.target,_={x:v.clientX,y:v.clientY},x=(l==null?void 0:l.contains(b))||(u==null?void 0:u.contains(b)),y=!GH(_,o);x?f():y&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,f]),h.jsx(sR,{...e,ref:s})}),[FH,HH]=pp(Zc,{isInside:!1}),UH=M8("TooltipContent"),sR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,l=gp(Ha,n),c=mp(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(g0,u),()=>document.removeEventListener(g0,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(ip,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:h.jsxs(BP,{"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(UH,{children:r}),h.jsx(FH,{scope:n,isInside:!0,children:h.jsx(LH,{id:l.contentId,role:"tooltip",children:i||r})})]})})});iR.displayName=Ha;var oR="TooltipArrow",WH=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=mp(n);return HH(oR,n).isInside?null:h.jsx(zP,{...i,...r,ref:t})});WH.displayName=oR;function VH(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 qH(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 KH(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 GH(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 YH(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),XH(t)}function XH(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 QH=tR,ZH=nR,JH=rR,aR=iR;const uy=QH,dy=ZH,hy=JH,vp=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(aR,{ref:r,sideOffset:t,className:fe("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}));vp.displayName=aR.displayName;const eU={held:!1,indexBySessionId:new Map},tU=g.createContext(eU);function nU(){return g.useContext(tU)}const rU=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})),iU=[{id:"new-session",combo:{key:"n",mod:!0},label:"新建任务",description:"打开快捷新建弹窗",group:"通用",desktopOnly:!0},...rU,{id:"archive-session",combo:{key:"a",mod:!0,shift:!0},label:"归档当前会话",description:"归档当前聊天区正在查看的会话",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:"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}];iU.filter(e=>!e.displayOnly);function sU(){return/Mac|iP(hone|od|ad)/.test(navigator.platform)}const oU=10,aU=20,lU=16,cU=20,uU=60,dU=4;function hU({session:e,active:t,hasUnread:n,running:r=!1,awaitingUser:i=!1,onSelect:s,onEdit:o,onDelete:a,onPin:l,onArchive:c,archiveShortcut:u=!1,depth:d=0,chevron:f,showCopyResume:p=!0,contactDisplayName:m}){const[v,b]=g.useState(!1),_=nU(),x=_.held?_.indexBySessionId.get(e.sessionId):void 0,y=!!e.pinnedAt,w=d===0,k=d===0&&!!c,C=oU+d*aU,N=g.useCallback(async()=>{const A=aP(e);if(A)try{await navigator.clipboard.writeText(A)}catch{}},[e]),T=e.appBuilderProject?`[app] ${e.appBuilderProject}`:e.label||e.aiLabel||e.larkChatName||e.larkChatId||e.cwd.split("/").filter(Boolean).pop()||e.sessionId.slice(0,8),B=e.originOwnerPrincipalId,P=B?`@${m??`…${B.slice(-8)}`}`:null;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":`session-item-${e.sessionId}`,onClick:s,style:{paddingLeft:C,display:"grid",gridTemplateColumns:`${lU}px ${cU}px 1fr auto ${uU}px`,gridTemplateAreas:'"chev icon name dot time"',columnGap:`${dU}px`,alignItems:"center"},className:fe("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(IH,{tool:e.tool})}),h.jsxs("div",{style:{gridArea:"name"},className:"flex items-center gap-1 min-w-0",children:[e.dispatchedFromSessionId?h.jsx(yz,{"data-testid":`dispatched-icon-${e.sessionId}`,className:"w-3 h-3 text-accent shrink-0",strokeWidth:2.25,"aria-label":"dispatched from another session",children:h.jsx("title",{children:"由另一个 session dispatch 派生"})}):null,e.shiftFiredFromSessionId?h.jsx(GB,{"data-testid":`shift-fired-icon-${e.sessionId}`,className:"w-3 h-3 text-accent shrink-0",strokeWidth:2.25,"aria-label":"fired by clawd-shift scheduler",children:h.jsx("title",{children:"由 shift 排班到点 fire 派生"})}):null,e.larkChatId?h.jsx(qz,{"data-testid":`lark-chat-icon-${e.sessionId}`,className:"w-3 h-3 text-accent shrink-0",strokeWidth:2.25,"aria-label":"driven by feishu chat",children:h.jsx("title",{children:e.larkChatType==="p2p"?"飞书私聊会话(对方消息驱动)":"飞书群会话(群成员 @ bot 驱动)"})}):null,h.jsx("span",{"data-testid":`session-title-${e.sessionId}`,className:fe("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:T}),P?h.jsx("span",{"data-testid":`session-mirror-chip-${e.sessionId}`,title:`在 ${P.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:P}):null]}),i?h.jsx(tz,{"data-testid":`awaiting-dot-${e.sessionId}`,style:{gridArea:"dot"},className:"w-3 h-3 text-warning shrink-0 animate-pulse",strokeWidth:2.25,"aria-label":"awaiting user"}):n?h.jsx("span",{"data-testid":`unread-dot-${e.sessionId}`,style:{gridArea:"dot"},className:"w-2 h-2 rounded-full bg-error shrink-0","aria-label":"unread"}):r?h.jsx("span",{"data-testid":`running-dot-${e.sessionId}`,style:{gridArea:"dot"},className:"w-2 h-2 rounded-full bg-success shrink-0 animate-pulse","aria-label":"running"}):null,x!=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:sU()?`⌘${x}`:`Ctrl+${x}`})}):h.jsx("span",{style:{gridArea:"time"},className:fe("text-[11px] text-text-400/70 text-right shrink-0","transition-opacity duration-150 group-hover:opacity-0"),children:e.updatedAt?S8(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:[u&&k&&c?h.jsx(uy,{delayDuration:200,skipDelayDuration:100,children:h.jsxs(dy,{children:[h.jsx(hy,{asChild:!0,children:h.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),c(e.sessionId,!0)},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":"archive session","data-testid":`archive-shortcut-${e.sessionId}`,children:h.jsx(Nw,{className:"w-4 h-4"})})}),h.jsx(vp,{side:"bottom",children:"归档"})]})}):null,h.jsxs(ay,{modal:!1,children:[h.jsx(ly,{asChild:!0,children:h.jsx("button",{type:"button",onClick:A=>A.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(OT,{className:"w-4 h-4"})})}),h.jsxs(fp,{align:"end",onClick:A=>A.stopPropagation(),children:[l&&w&&h.jsxs(yi,{onSelect:()=>l(e.sessionId,!y),"data-testid":`session-${y?"unpin":"pin"}-${e.sessionId}`,children:[y?h.jsx(t$,{className:"w-3 h-3 mr-2 text-text-400"}):h.jsx(r$,{className:"w-3 h-3 mr-2 text-text-400"}),y?"Unpin":"Pin"]}),k&&c&&h.jsxs(yi,{onSelect:()=>c(e.sessionId,!0),"data-testid":`session-archive-${e.sessionId}`,children:[h.jsx(Nw,{className:"w-3 h-3 mr-2 text-text-400"}),"Archive"]}),o&&h.jsxs(yi,{onSelect:()=>b(!0),"data-testid":`session-rename-${e.sessionId}`,children:[h.jsx($T,{className:"w-3 h-3 mr-2 text-text-400"}),"Rename"]}),p&&e.toolSessionId?h.jsxs(yi,{onSelect:()=>void N(),"data-testid":`session-copy-resume-${e.sessionId}`,children:[h.jsx(tp,{className:"w-3 h-3 mr-2 text-text-400"}),"Copy Resume Command"]}):null,(l||o||p&&e.toolSessionId)&&a&&h.jsx(XI,{}),a&&h.jsxs(yi,{onSelect:()=>void a(e.sessionId),className:"text-destructive focus:text-destructive focus:bg-destructive/10","data-testid":`session-delete-${e.sessionId}`,children:[h.jsx(Ox,{className:"w-3 h-3 mr-2"}),"Delete"]})]})]})]}):null]}),o?h.jsx(RH,{open:v,initialLabel:e.label??"",placeholder:e.cwd.split("/").pop()||"",onSubmit:A=>{o(e.sessionId,A),b(!1)},onCancel:()=>b(!1)}):null]})}function fy({node:e,depth:t=0,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,archiveShortcut:d,getContactDisplayName:f,showCopyResume:p}){const m=e.children.length>0,{isCollapsed:v,toggle:b}=FB(),_=!v(e.session.sessionId),x=g.useCallback(w=>{w.stopPropagation(),b(e.session.sessionId)},[b,e.session.sessionId]),y=m?h.jsx("button",{type:"button",onClick:x,"data-testid":`session-chevron-${e.session.sessionId}`,"aria-label":_?"collapse":"expand","aria-expanded":_,className:"shrink-0 flex items-center justify-center w-4 h-4 text-text-400 hover:text-text-100 cursor-pointer",children:_?h.jsx(ir,{className:"w-3 h-3"}):h.jsx(Un,{className:"w-3 h-3"})}):null;return h.jsxs("div",{"data-testid":`session-tree-node-${e.session.sessionId}`,children:[h.jsx(hU,{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,archiveShortcut:d,showCopyResume:p,depth:t,chevron:y,contactDisplayName:e.session.originOwnerPrincipalId?f==null?void 0:f(e.session.originOwnerPrincipalId):void 0}),m&&_?h.jsx("div",{"data-testid":`session-tree-children-${e.session.sessionId}`,children:e.children.map(w=>h.jsx(fy,{node:w,depth:t+1,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,archiveShortcut:d,getContactDisplayName:f,showCopyResume:p},w.session.sessionId))}):null]})}function fU(e){return e.forkedFromSessionId??e.dispatchedFromSessionId??e.shiftFiredFromSessionId}function lR(e){e=e.filter(s=>!s.ephemeral);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=fU(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((l,c)=>l.createdAt<c.createdAt?-1:l.createdAt>c.createdAt?1:0);return{session:s,children:a.map(i)}};return[...r].sort(pU).map(i)}function cR(e){return[...e].sort((t,n)=>t.session.updatedAt<n.session.updatedAt?1:t.session.updatedAt>n.session.updatedAt?-1:0)}function pU(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||e.updatedAt<t.updatedAt?1:e.updatedAt>t.updatedAt?-1:0}function mU(e){return e.appBuilderProject?`[app] ${e.appBuilderProject}`:e.label?e.label:e.aiLabel?e.aiLabel:e.cwd.split("/").filter(Boolean).pop()??""}function aS(e,t){const n=t.trim().toLowerCase();return n===""?!0:e.toLowerCase().includes(n)}const gU={isCollapsed:()=>!1,toggle:()=>{},prune:()=>{}};function vU({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:b,showCopyResume:_,treatSessionsAsRoots:x,searchQuery:y}){const[w,k]=g.useState(null),[C,N]=g.useState(()=>new Set),T=p??(I=>C.has(I)),B=g.useCallback(I=>{if(m){m(I);return}N(R=>{const j=new Set(R);return j.has(I)?j.delete(I):j.add(I),j})},[m]),P=g.useMemo(()=>i==null?void 0:i.filter(I=>!I.ephemeral),[i]);if(e.length===0)return h.jsx(_U,{});const A=(y??"").trim();return A?h.jsx(Lx.Provider,{value:gU,children:h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(I=>{const R=P?P.filter(F=>F.ownerPersonaId===I.personaId).sort((F,D)=>D.updatedAt>F.updatedAt?1:-1):[],j=aS(I.label,A),z=R.filter(F=>aS(mU(F),A));if(!j&&z.length===0)return null;const $=j?R:z;return h.jsx(lS,{persona:I,active:I.personaId===t,editing:!1,onSelectPersona:n,onSubmitCreateSession:()=>{},onCancelCreateSession:()=>{},personaSessions:$,collapsed:!1,onToggleCollapsed:()=>{},activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:b,showCopyResume:_,treatSessionsAsRoots:x,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f},I.personaId)})})}):h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(I=>{const R=P?P.filter(j=>j.ownerPersonaId===I.personaId).sort((j,z)=>z.updatedAt>j.updatedAt?1:-1):[];return h.jsx(lS,{persona:I,active:I.personaId===t,editing:I.personaId===w,onSelectPersona:n,onStartCreateSession:r?()=>k(I.personaId):void 0,onSubmitCreateSession:j=>{k(null),r==null||r(I.personaId,j)},onCancelCreateSession:()=>k(null),personaSessions:R,collapsed:!T(I.personaId),onToggleCollapsed:()=>B(I.personaId),activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:b,showCopyResume:_,treatSessionsAsRoots:x,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f},I.personaId)})})}function _U(){return h.jsx("div",{className:"px-3 py-3 text-[11px] leading-relaxed text-text-400",children:"还没有 persona。点上方 Personas 标题右侧 + 创建第一个。"})}function lS({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:b,onPinSession:_,showCopyResume:x,treatSessionsAsRoots:y,ownerPrincipalId:w,creatorDisplayNameByOwnerId:k}){const C=a.length>0,N=!l,T=g.useMemo(()=>{const A=[],I=new Map;for(const R of a){const j=R.creatorPrincipalId;if(R.larkChatId!=null||!j||w&&j===w){A.push(R);continue}const z=j,$=(k==null?void 0:k.get(z))??`…${z.slice(-8)}`,F=I.get(z);F?F.sessions.push(R):I.set(z,{groupKey:z,displayName:$,sessions:[R]})}return{self:A,byPeer:[...I.values()]}},[a,w,k]),B=T.byPeer.length>0,P=g.useMemo(()=>N&&!B?cR(lR(a)):[],[N,B,a]);return h.jsxs("div",{"data-testid":`persona-node-${e.personaId}`,children:[h.jsxs("div",{className:fe("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:[C?h.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),c()},"aria-label":N?"collapse":"expand","aria-expanded":N,"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:N?h.jsx(ir,{className:"h-3 w-3"}):h.jsx(Un,{className:"h-3 w-3"})}):h.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),h.jsx(np,{tool:e.tool,className:fe("h-3.5 w-3.5 shrink-0",rp(e.tool))}),h.jsx("span",{className:"flex-1 truncate text-[13px]",children:e.label}),C?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(a$,{className:"h-3.5 w-3.5"})}):null]}),n?h.jsx(xU,{personaId:e.personaId,tool:e.tool,onSubmit:s,onCancel:o}):null,C&&N?h.jsx("div",{"data-testid":`persona-sessions-${e.personaId}`,children:B?h.jsxs(h.Fragment,{children:[T.self.length>0&&h.jsx(cS,{groupKey:`${e.personaId}-self`,label:"我自己",testId:`persona-sessions-${e.personaId}-self`,sessions:T.self,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:b,onPinSession:_,showCopyResume:x}),T.byPeer.map(A=>h.jsx(cS,{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:b,onPinSession:_,showCopyResume:x},`${e.personaId}-peer-${A.groupKey}`))]}):P.map(A=>h.jsx(fy,{node:A,depth:y?0:1,activeId:u,unreadIds:p,runningIds:f,awaitingIds:d,onSelect:I=>m==null?void 0:m(I),onDelete:v,onEdit:b,onPin:_,showCopyResume:x},A.session.sessionId))}):null]})}function cS({label:e,testId:t,sessions:n,activeSessionId:r,awaitingIds:i,runningIds:s,unreadIds:o,onSelectSession:a,onDeleteSession:l,onEditSession:c,onPinSession:u,showCopyResume:d}){const[f,p]=g.useState(!1),m=!f,v=g.useMemo(()=>m?cR(lR(n)):[],[m,n]);return h.jsxs("div",{"data-testid":t,children:[h.jsxs("button",{type:"button",onClick:()=>p(b=>!b),"aria-label":m?"collapse":"expand","aria-expanded":m,"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:[m?h.jsx(ir,{className:"h-3 w-3"}):h.jsx(Un,{className:"h-3 w-3"}),h.jsx(UT,{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})]}),m&&h.jsx("div",{children:v.map(b=>h.jsx(fy,{node:b,depth:2,activeId:r,unreadIds:o,runningIds:s,awaitingIds:i,onSelect:_=>a==null?void 0:a(_),onDelete:l,onEdit:c,onPin:u,showCopyResume:d},b.session.sessionId))})]})}function xU({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=ku(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(np,{tool:t,className:fe("h-3 w-3 shrink-0",rp(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(ul,{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(Dr,{className:"h-3 w-3"})})]})}function yU(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function bU(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),r=parseFloat(n.fontSize);return t*r}function wU(e){return e/100*window.innerHeight}function SU(e){return e/100*window.innerWidth}function kU(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 Yl({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,s]=kU(n);switch(s){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=bU(t,i);break}case"em":{r=yU(t,i);break}case"vh":{r=wU(i);break}case"vw":{r=SU(i);break}}return r}function Nn(e){return parseFloat(e.toFixed(3))}function Ua({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 _0(e){const{panels:t}=e,n=Ua({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=Yl({groupSize:n,panelElement:i,styleProp:s.collapsedSize});o=Nn(u/n*100)}let a;if(s.defaultSize!==void 0){const u=Yl({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=Nn(u/n*100)}let l=0;if(s.minSize!==void 0){const u=Yl({groupSize:n,panelElement:i,styleProp:s.minSize});l=Nn(u/n*100)}let c=100;if(s.maxSize!==void 0){const u=Yl({groupSize:n,panelElement:i,styleProp:s.maxSize});c=Nn(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 rt(e,t="Assertion error"){if(!e)throw Error(t)}function x0(e,t){return Array.from(t).sort(e==="horizontal"?CU:EU)}function CU(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function EU(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function uR(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function dR(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 NU({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}=dR(r,o),c=e==="horizontal"?a:l;c<s&&(s=c,i=o)}return rt(i,"No rect found"),i}let _d;function TU(){return _d===void 0&&(typeof matchMedia=="function"?_d=!!matchMedia("(pointer:coarse)").matches:_d=!1),_d}function hR(e){const{element:t,orientation:n,panels:r,separators:i}=e,s=x0(n,Array.from(t.children).filter(uR).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 b=r.find(_=>_.element===v);if(b){if(f){const _=f.element.getBoundingClientRect(),x=v.getBoundingClientRect();let y;if(l){const w=n==="horizontal"?new DOMRect(_.right,_.top,0,_.height):new DOMRect(_.left,_.bottom,_.width,0),k=n==="horizontal"?new DOMRect(x.left,x.top,0,x.height):new DOMRect(x.left,x.top,x.width,0);switch(p.length){case 0:{y=[w,k];break}case 1:{const C=p[0],N=NU({orientation:n,rects:[_,x],targetRect:C.element.getBoundingClientRect()});y=[C,N===_?k:w];break}default:{y=p;break}}}else p.length?y=p:y=[n==="horizontal"?new DOMRect(_.right,x.top,x.left-_.right,x.height):new DOMRect(x.left,_.bottom,x.width,x.top-_.bottom)];for(const w of y){let k="width"in w?w:w.element.getBoundingClientRect();const C=TU()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(k.width<C){const T=C-k.width;k=new DOMRect(k.x-T/2,k.y,k.width+T,k.height)}if(k.height<C){const T=C-k.height;k=new DOMRect(k.x,k.y-T/2,k.width,k.height+T)}const N=m<=c||m>u;!a&&!N&&o.push({group:e,groupSize:Ua({group:e}),panels:[f,b],separator:"width"in w?void 0:w,rect:k}),a=!1}}l=!1,f=b,p=[]}}else if(v.hasAttribute("data-separator")){v.ariaDisabled!==null&&(a=!0);const b=i.find(_=>_.element===v);b?p.push(b):(f=void 0,p=[])}else l=!0}return o}var cs;class fR{constructor(){m1(this,cs,{})}addListener(t,n){const r=wl(this,cs)[t];return r===void 0?wl(this,cs)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=wl(this,cs)[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(){g1(this,cs,{})}removeListener(t,n){const r=wl(this,cs)[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}cs=new WeakMap;let Ea={cursorFlags:0,state:"inactive"};const py=new fR;function xo(){return Ea}function PU(e){return py.addListener("change",e)}function IU(e){const t=Ea,n={...Ea};n.cursorFlags=e,Ea=n,py.emit("change",{prev:t,next:n})}function Na(e){const t=Ea;Ea=e,py.emit("change",{prev:t,next:e})}const RU=e=>e,Om=()=>{},pR=1,mR=2,gR=4,vR=8,uS=3,dS=12;let xd;function hS(){return xd===void 0&&(xd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(xd=!0)),xd}function MU({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&&hS()){const s=(e&pR)!==0,o=(e&mR)!==0,a=(e&gR)!==0,l=(e&vR)!==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 hS()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}const fS=new WeakMap;function my(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=fS.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=xo();switch(r.state){case"active":case"hover":{const i=MU({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}}fS.set(e,{prevStyle:t,styleSheet:n})}let Xr=new Map;const _R=new fR;function AU(e){Xr=new Map(Xr),Xr.delete(e)}function pS(e,t){for(const[n]of Xr)if(n.id===e)return n}function Ss(e,t){for(const[n,r]of Xr)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function jo(){return Xr}function gy(e,t){return _R.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Di(e,t,n){const r=Xr.get(e);Xr=new Map(Xr),Xr.set(e,t),_R.emit("groupChange",{group:e,isUserInteraction:(n==null?void 0:n.isUserInteraction)===!0,prev:r,next:t})}function xR(e){const t=xo();let n=!1;switch(t.state){case"active":Na({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(my(e),n=!0,t.hitRegions.forEach(r=>{const i=Ss(r.group.id,!0);Di(r.group,i,{isUserInteraction:!0})}))}return n}function mS(e){e.defaultPrevented||xR(e.currentTarget)}function LU(e,t,n){let r,i={x:1/0,y:1/0};for(const s of t){const o=dR(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 jU(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function DU(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:_S(e),b:_S(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();rt(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:vS(gS(n.a)),b:vS(gS(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 OU=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function BU(e){const t=getComputedStyle(yR(e)??e).display;return t==="flex"||t==="inline-flex"}function zU(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||BU(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"||OU.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function gS(e){let t=e.length;for(;t--;){const n=e[t];if(rt(n,"Missing node"),zU(n))return n}return null}function vS(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _S(e){const t=[];for(;e;)t.push(e),e=yR(e);return t}function yR(e){const{parentNode:t}=e;return jU(t)?t.host:t}function $U(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 FU({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!uR(n)||n.contains(e)||e.contains(n))return!0;if(DU(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if($U(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function vy(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const s=hR(i),o=LU(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=0&&o.distance.y<=0&&FU({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function HU(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 _n(e,t,n=0){return Math.abs(Nn(e)-Nn(t))<=n}function qr(e,t){return _n(e,t)?0:e>t?1:-1}function ma({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(qr(r,l)<0)if(s){const c=(i+l)/2;qr(r,c)<0?r=i:r=l}else r=l;return r=Math.min(a,r),r=Nn(r),r}function Jc({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:s}){if(_n(e,0))return t;const o=s==="imperative-api",a=Object.values(t),l=Object.values(i),c=[...a],[u,d]=r;rt(u!=null,"Invalid first pivot index"),rt(d!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const v=e<0?d:u,b=n[v];rt(b,`Panel constraints not found for index ${v}`);const{collapsedSize:_=0,collapsible:x,minSize:y=0}=b;if(x){const w=a[v];if(rt(w!=null,`Previous layout not found for panel index ${v}`),_n(w,_)){const k=y-w;qr(k,Math.abs(e))>0&&(e=e<0?0-k:k)}}}{const v=e<0?u:d,b=n[v];rt(b,`No panel constraints found for index ${v}`);const{collapsedSize:_=0,collapsible:x,minSize:y=0}=b;if(x){const w=a[v];if(rt(w!=null,`Previous layout not found for panel index ${v}`),_n(w,y)){const k=w-_;qr(k,Math.abs(e))>0&&(e=e<0?0-k:k)}}}break}default:{const v=e<0?d:u,b=n[v];rt(b,`Panel constraints not found for index ${v}`);const _=a[v],{collapsible:x,collapsedSize:y,minSize:w}=b;if(x&&qr(_,w)<0)if(e>0){const k=w-y,C=k/2,N=_+e;qr(N,w)<0&&(e=qr(e,C)<=0?0:k)}else{const k=w-y,C=100-k/2,N=_-e;qr(N,w)<0&&(e=qr(100+e,C)>0?0:-k)}break}}{const v=e<0?1:-1;let b=e<0?d:u,_=0;for(;;){const y=a[b];rt(y!=null,`Previous layout not found for panel index ${b}`);const w=ma({overrideDisabledPanels:o,panelConstraints:n[b],prevSize:y,size:100})-y;if(_+=w,b+=v,b<0||b>=n.length)break}const x=Math.min(Math.abs(e),Math.abs(_));e=e<0?0-x:x}{let v=e<0?u:d;for(;v>=0&&v<n.length;){const b=Math.abs(e)-Math.abs(f),_=a[v];rt(_!=null,`Previous layout not found for panel index ${v}`);const x=_-b,y=ma({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:_,size:x});if(!_n(_,y)&&(f+=_-y,c[v]=y,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if(HU(l,c))return i;{const v=e<0?d:u,b=a[v];rt(b!=null,`Previous layout not found for panel index ${v}`);const _=b+f,x=ma({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:b,size:_});if(c[v]=x,!_n(x,_)){let y=_-x,w=e<0?d:u;for(;w>=0&&w<n.length;){const k=c[w];rt(k!=null,`Previous layout not found for panel index ${w}`);const C=k+y,N=ma({overrideDisabledPanels:o,panelConstraints:n[w],prevSize:k,size:C});if(_n(k,N)||(y-=N-k,c[w]=N),_n(y,0))break;e>0?w--:w++}}}const p=Object.values(c).reduce((v,b)=>b+v,0);if(!_n(p,100,.1))return i;const m=Object.keys(i);return c.reduce((v,b,_)=>(v[m[_]]=b,v),{})}function yo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||qr(e[n],t[n])!==0)return!1;return!0}function bo({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(!_n(i,100)&&r.length>0)for(let a=0;a<t.length;a++){const l=r[a];rt(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];rt(l!=null,`No layout data found for index ${a}`);const c=r[a];rt(c!=null,`No layout data found for index ${a}`);const u=ma({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});c!=u&&(s+=c-u,r[a]=u)}if(!_n(s,0))for(let a=0;a<t.length;a++){const l=r[a];rt(l!=null,`No layout data found for index ${a}`);const c=l+s,u=ma({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});if(l!==u&&(s-=u-l,r[a]=u,_n(s,0)))break}const o=Object.keys(e);return r.reduce((a,l,c)=>(a[o[c]]=l,a),{})}function bR({groupId:e,panelId:t}){const n=()=>{const l=jo();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(b=>b.id===t),m=p===0,v=p===c.length-1;if(v&&l<f&&(m||c.slice(0,p).every((b,_)=>{const x=d[_];return(x==null?void 0:x.collapsible)&&_n(x.collapsedSize,u[x.panelId])}))){const b=c.slice(0,p).reduce((_,x)=>_+u[x.id],0);return{...u,[t]:Nn(100-b)}}return Jc({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(),b=o({nextSize:l,panels:f.panels,prevLayout:m,derivedPanelConstraints:d}),_=bo({layout:b,panelConstraints:d});yo(m,_)||Di(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:p,layout:_,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&&_n(c,u)},resize:l=>{const{group:c}=n(),{element:u}=i(),d=Ua({group:c}),f=Yl({groupSize:d,panelElement:u,styleProp:l}),p=Nn(f/d*100);a(p)}}}function xS(e){if(e.defaultPrevented)return;const t=jo();vy(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=bR({groupId:n.group.id,panelId:r.id});s&&i!==void 0&&(s.resize(i),e.preventDefault())}}})}function eh(e){const t=jo();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 wR({groupId:e}){const t=()=>{const n=jo();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=bo({layout:n,panelConstraints:i});return r?a:(yo(a,c)||Di(s,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:o,layout:c,separatorToPanels:l}),c)}}}function Us(e,t){const n=eh(e),r=Ss(n.id,!0),i=n.separators.find(u=>u.element===e);rt(i,"Matching separator not found");const s=r.separatorToPanels.get(i);rt(s,"Matching panels not found");const o=s.map(u=>n.panels.indexOf(u)),a=wR({groupId:n.id}).getLayout(),l=Jc({delta:t,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:a,trigger:"keyboard"}),c=bo({layout:l,panelConstraints:r.derivedPanelConstraints});yo(a,c)||Di(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function yS(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=eh(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Us(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Us(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Us(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Us(t,-5);break}case"End":{e.preventDefault(),Us(t,100);break}case"Enter":{e.preventDefault();const r=eh(t),i=Ss(r.id,!0),{derivedPanelConstraints:s,layout:o,separatorToPanels:a}=i,l=r.separators.find(f=>f.element===t);rt(l,"Matching separator not found");const c=a.get(l);rt(c,"Matching panels not found");const u=c[0],d=s.find(f=>f.panelId===u.id);if(rt(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;Us(t,p-f)}break}case"F6":{e.preventDefault();const r=eh(t).separators.map(o=>o.element),i=Array.from(r).findIndex(o=>o===e.currentTarget);rt(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(),Us(t,-100);break}}}function bS(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=jo(),n=vy(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)}),Na({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function SR({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 b=r.get(u),_=i.get(u);if(!b||!_)return;const{defaultLayoutDeferred:x,derivedPanelConstraints:y,groupSize:w,layout:k,separatorToPanels:C}=_;if(y&&k&&C){const N=Jc({delta:v,initialLayout:b,panelConstraints:y,pivotIndices:c.panels.map(T=>p.indexOf(T)),prevLayout:k,trigger:"mouse-or-touch"});if(yo(N,k)){if(v!==0&&!m)switch(f){case"horizontal":{a|=v<0?pR:mR;break}case"vertical":{a|=v<0?gR:vR;break}}}else Di(c.group,{defaultLayoutDeferred:x,derivedPanelConstraints:y,groupSize:w,layout:N,separatorToPanels:C})}});let l=0;t.movementX===0?l|=o&uS:l|=a&uS,t.movementY===0?l|=o&dS:l|=a&dS,IU(l),my(e)}function wS(e){const t=jo(),n=xo();switch(n.state){case"active":SR({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function SS(e){var r,i;if(e.defaultPrevented)return;const t=xo(),n=jo();switch(t.state){case"active":{if(e.buttons===0){Na({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{const o=Ss(s.group.id,!0);Di(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))}SR({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=vy(e,n);s.length===0?t.state!=="inactive"&&Na({cursorFlags:0,state:"inactive"}):Na({cursorFlags:0,hitRegions:s,state:"hover"}),my(e.currentTarget);break}}}function kS(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(xo().state){case"hover":Na({cursorFlags:0,state:"inactive"})}}function CS(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||xR(e.currentTarget)&&e.preventDefault()}function ES(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const o=Nn(s.defaultSize);n+=o,r[s.panelId]=o}else r[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=Nn((100-n)/i);for(const o of e)o.defaultSize===void 0&&(r[o.panelId]=s)}return r}function UU(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const i=Ua({group:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,a={asPercentage:Nn(s/i*100),inPixels:s};r.mutableValues.prevSize=a,r.onResize(a,r.id,o)}function WU(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 VU({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=Nn(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]=Nn(f/s*c)}else{const d=Nn(c/l.length);for(const f of l)u[f]=d}return u}function qU(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 Go=new Map;function KU(e){let t=!0;rt(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:b,target:_}=v;if(_===e.element){if(t){const x=Ua({group:e});if(x===0)return;const y=Ss(e.id);if(!y)return;const w=_0(e),k=y.defaultLayoutDeferred?ES(w):y.layout,C=VU({group:e,nextGroupSize:x,prevGroupSize:y.groupSize,prevLayout:k}),N=bo({layout:C,panelConstraints:w});if(!y.defaultLayoutDeferred&&yo(y.layout,N)&&WU(y.derivedPanelConstraints,w)&&y.groupSize===x)return;Di(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:w,groupSize:x,layout:N,separatorToPanels:y.separatorToPanels})}}else UU(e,_,b)}});s.observe(e.element),e.panels.forEach(m=>{rt(!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=Ua({group:e}),a=_0(e),l=e.panels.map(({id:m})=>m).join(",");let c=e.mutableState.defaultLayout;c&&(qU(e.panels,c)||(c=void 0));const u=e.mutableState.layouts[l]??c??ES(a),d=bo({layout:u,panelConstraints:a}),f=e.element.ownerDocument;Go.set(f,(Go.get(f)??0)+1);const p=new Map;return hR(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),Di(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:a,groupSize:o,layout:d,separatorToPanels:p}),e.separators.forEach(m=>{rt(!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",yS)}),Go.get(f)===1&&(f.addEventListener("contextmenu",mS,!0),f.addEventListener("dblclick",xS,!0),f.addEventListener("pointerdown",bS,!0),f.addEventListener("pointerleave",wS),f.addEventListener("pointermove",SS),f.addEventListener("pointerout",kS),f.addEventListener("pointerup",CS,!0)),function(){t=!1,Go.set(f,Math.max(0,(Go.get(f)??0)-1)),AU(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",yS)}),Go.get(f)||(f.removeEventListener("contextmenu",mS,!0),f.removeEventListener("dblclick",xS,!0),f.removeEventListener("pointerdown",bS,!0),f.removeEventListener("pointerleave",wS),f.removeEventListener("pointermove",SS),f.removeEventListener("pointerout",kS),f.removeEventListener("pointerup",CS,!0)),s.disconnect()}}function GU(){const[e,t]=g.useState({}),n=g.useCallback(()=>t({}),[]);return[e,n]}function _y(e){const t=g.useId();return`${e??t}`}const Do=typeof window<"u"?g.useLayoutEffect:g.useEffect;function mc(e){const t=g.useRef(e);return Do(()=>{t.current=e},[e]),g.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function xy(...e){return mc(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function yy(e){const t=g.useRef({...e});return Do(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const kR=g.createContext(null);function YU(e,t){const n=g.useRef({getLayout:()=>({}),setLayout:RU});g.useImperativeHandle(t,()=>n.current,[]),Do(()=>{Object.assign(n.current,wR({groupId:e}))})}function by({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=mc(A=>{yo(m.current.onLayoutChange,A)||(m.current.onLayoutChange=A,l==null||l(A))}),b=mc((A,I)=>{yo(m.current.onLayoutChanged,A)||(m.current.onLayoutChanged=A,c==null||c(A,{isUserInteraction:I}))}),_=_y(a),x=g.useRef(null),[y,w]=GU(),k=g.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),C=xy(x,s);YU(_,o);const N=mc((A,I)=>{const R=xo(),j=pS(A),z=Ss(A);if(z){let $=!1;switch(R.state){case"active":{$=R.hitRegions.some(F=>F.group===j);break}}return{flexGrow:z.layout[I]??1,pointerEvents:$?"none":void 0}}if(n!=null&&n[I])return{flexGrow:n==null?void 0:n[I]}}),T=yy({defaultLayout:n,disableCursor:r}),B=g.useMemo(()=>({get disableCursor(){return!!T.disableCursor},getPanelStyles:N,id:_,orientation:u,registerPanel:A=>{const I=k.current;return I.panels=x0(u,[...I.panels,A]),w(),()=>{I.panels=I.panels.filter(R=>R!==A),w()}},registerSeparator:A=>{const I=k.current;return I.separators=x0(u,[...I.separators,A]),w(),()=>{I.separators=I.separators.filter(R=>R!==A),w()}},updatePanelProps:(A,{disabled:I})=>{const R=k.current.panels.find($=>$.id===A);R&&(R.panelConstraints.disabled=I);const j=pS(_),z=Ss(_);j&&z&&Di(j,{...z,derivedPanelConstraints:_0(j)})},updateSeparatorProps:(A,{disabled:I,disableDoubleClick:R})=>{const j=k.current.separators.find(z=>z.id===A);j&&(j.disabled=I,j.disableDoubleClick=R)}}),[N,_,w,u,T]),P=g.useRef(null);return Do(()=>{const A=x.current;if(A===null)return;const I=k.current;let R;if(T.defaultLayout!==void 0&&Object.keys(T.defaultLayout).length===I.panels.length){R={};for(const E of I.panels){const H=T.defaultLayout[E.id];H!==void 0&&(R[E.id]=H)}}const j={disabled:!!i,element:A,id:_,mutableState:{defaultLayout:R,disableCursor:!!T.disableCursor,expandedPanelSizes:k.current.lastExpandedPanelSizes,layouts:k.current.layouts},orientation:u,panels:I.panels,resizeTargetMinimumSize:I.resizeTargetMinimumSize,separators:I.separators};P.current=j;const z=KU(j),{defaultLayoutDeferred:$,derivedPanelConstraints:F,layout:D}=Ss(j.id,!0);!$&&F.length>0&&(v(D),b(D,!1));const O=gy(_,E=>{const{defaultLayoutDeferred:H,derivedPanelConstraints:V,layout:L}=E.next;if(H||V.length===0)return;const ne=j.panels.map(({id:G})=>G).join(",");j.mutableState.layouts[ne]=L,V.forEach(G=>{if(G.collapsible){const{layout:ye}=E.prev??{};if(ye){const Fe=_n(G.collapsedSize,L[G.panelId]),ue=_n(G.collapsedSize,ye[G.panelId]);Fe&&!ue&&(j.mutableState.expandedPanelSizes[G.panelId]=ye[G.panelId])}}});const ae=xo().state!=="active";v(L),ae&&b(L,E.isUserInteraction)});return()=>{P.current=null,z(),O()}},[i,_,b,v,u,y,T]),g.useEffect(()=>{const A=P.current;A&&(A.mutableState.defaultLayout=n,A.mutableState.disableCursor=!!r)}),h.jsx(kR.Provider,{value:B,children:h.jsx("div",{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:C,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})})}by.displayName="Group";function wy(){const e=g.useContext(kR);return rt(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function XU(e,t){const{id:n}=wy(),r=g.useRef({collapse:Om,expand:Om,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Om});g.useImperativeHandle(t,()=>r.current,[]),Do(()=>{Object.assign(r.current,bR({groupId:n,panelId:e}))})}function tf({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,b=_y(l),_=yy({disabled:s}),x=g.useRef(null),y=xy(x,o),{getPanelStyles:w,id:k,orientation:C,registerPanel:N,updatePanelProps:T}=wy(),B=d!==null,P=mc((j,z,$)=>{d==null||d(j,l,$)});Do(()=>{const j=x.current;if(j!==null){const z={element:j,id:b,idIsStable:v,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:B?P:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:c,minSize:u}};return N(z)}},[a,n,r,i,B,b,v,c,u,P,N,_]),g.useEffect(()=>{T(b,{disabled:s})},[s,b,T]),XU(b,f);const A=()=>{const j=w(k,b);if(j)return JSON.stringify(j)},I=g.useSyncExternalStore(j=>gy(k,j),A,A);let R;return I?R=JSON.parse(I):i!==void 0?R={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:R={flexGrow:1},h.jsx("div",{...m,"data-disabled":s||void 0,"data-panel":!0,"data-testid":b,id:b,ref:y,style:{...QU,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...R},children:h.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:C==="horizontal"?"pan-y":"pan-x"},children:e})})}tf.displayName="Panel";const QU={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function ZU({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=bo({layout:Jc({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=bo({layout:Jc({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:o}}function CR({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:s,style:o,...a}){const l=_y(s),c=yy({disabled:n,disableDoubleClick:r}),[u,d]=g.useState({}),[f,p]=g.useState("inactive"),[m,v]=g.useState(!1),b=g.useRef(null),_=xy(b,i),{disableCursor:x,id:y,orientation:w,registerSeparator:k,updateSeparatorProps:C}=wy(),N=w==="horizontal"?"vertical":"horizontal";Do(()=>{const P=b.current;if(P!==null){const A={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:P,id:l},I=k(A),R=PU(z=>{p(z.next.state!=="inactive"&&z.next.hitRegions.some($=>$.separator===A)?z.next.state:"inactive")}),j=gy(y,z=>{const{derivedPanelConstraints:$,layout:F,separatorToPanels:D}=z.next,O=D.get(A);if(O){const E=O[0],H=O.indexOf(E);d(ZU({layout:F,panelConstraints:$,panelId:E.id,panelIndex:H}))}});return()=>{R(),j(),I()}}},[y,l,k,c]),g.useEffect(()=>{C(l,{disabled:n,disableDoubleClick:r})},[n,r,l,C]);let T;n&&!x&&(T="not-allowed");let B;if(n)B="disabled";else switch(f){case"active":{B="active";break}default:m?B="focus":B=f}return h.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":N,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":B,"data-testid":l,id:l,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:_,role:"separator",style:{flexBasis:"auto",cursor:T,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}CR.displayName="Separator";function JU(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 eW(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 tW=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function nW(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(tW);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))}const rW=["TaskCreate","TaskUpdate","TaskList","TaskGet"];function iW(e){return rW.includes(e)}function ER(e){return e==="in_progress"||e==="completed"?e:"pending"}function sW(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:ER(n.status),activeForm:i,description:s}]}function oW(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=ER(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 aW(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=sW(t,i.input);break;case"TaskUpdate":t=oW(t,i.input);break}}return{tasks:t,lastEventIndex:n}}function lW(e){const{tasks:t,lastEventIndex:n}=aW(e);let r=-1;for(let c=e.length-1;c>=0;c--)if(e[c].kind==="todo-checklist"){r=c;break}const i=[],s=new Map,o=new Map,a=new Map,l=(c,u)=>{var f,p,m;const d={agentId:u.agentId,status:u.status};u.description?d.description=u.description:(f=c.progress)!=null&&f.description&&(d.description=c.progress.description),u.lastToolName?d.lastToolName=u.lastToolName:(p=c.progress)!=null&&p.lastToolName&&(d.lastToolName=c.progress.lastToolName),u.stats?d.stats=u.stats:(m=c.progress)!=null&&m.stats&&(d.stats=c.progress.stats),c.progress=d};for(let c=0;c<e.length;c++){const u=e[c];switch(u.kind){case"tool-call":{const d={kind:"merged-tool",seq:u.seq,tool:u.tool,toolKind:u.toolKind,toolUseId:u.toolUseId,input:u.input,pending:!0};s.set(u.toolUseId,i.length),i.push(d);break}case"tool-result":{const d=s.get(u.toolUseId);if(d!==void 0){const p=i[d];p.output=u.output,p.error=u.error,p.pending=!1,s.delete(u.toolUseId);break}const f=o.get(u.toolUseId);if(f!==void 0){const p=i[f];p.output=u.output,p.error=u.error,p.pending=!1,u.toolResultExtra&&(p.toolResultExtra=u.toolResultExtra);break}break}case"agent-call":{const d={kind:"merged-agent",seq:u.seq,toolUseId:u.toolUseId,description:u.description,input:u.input,pending:!0,notifications:[]};o.set(u.toolUseId,i.length),i.push(d);const f=a.get(u.toolUseId);f&&(l(d,f),a.delete(u.toolUseId));break}case"agent-progress":{const d=o.get(u.toolUseId);if(d!==void 0){l(i[d],u);break}a.set(u.toolUseId,u);break}case"agent-notification":{const d=u.parentToolUseId;if(d){const f=o.get(d);if(f!==void 0){i[f].notifications.push({text:u.text,taskId:u.taskId});break}}i.push({kind:"agent-notification",seq:u.seq,text:u.text,taskId:u.taskId,parentToolUseId:u.parentToolUseId});break}case"todo-checklist":{c===r&&u.todos.length>0&&i.push({kind:"todo-checklist",seq:u.seq,toolUseId:u.toolUseId,todos:u.todos});break}case"task-event":{c===n&&t.length>0&&i.push({kind:"plan-card",seq:u.seq,tasks:t});break}default:i.push(u)}}return i}const cW=new Set(["permission-inline","question-card"]);function uW(e){return e.kind==="user-text"?!0:e.kind==="user-meta"&&e.metaKind==="slash-command"}function dW(e){return e.kind==="user-text"&&e.continuesTurn===!0}function hW(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(fW(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,!0);continue}if(uW(s)&&(r===null||!dW(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 fW(e,t,n){const{query:r,body:i}=e,s=pW(i,t,n),o=mW(i,s),a=vW(i,o),l=r??i[0]??t,c={kind:"turn",seq:l?l.seq:0,status:s,process:a,tail:o};return r&&(c.query=r),(t==null?void 0:t.durationMs)!==void 0&&(c.durationMs=t.durationMs),c}function pW(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=y0(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function mW(e,t){if(t==="running"){const i=[];for(let s=e.length-1;s>=0&&cW.has(e[s].kind);s--)i.unshift(e[s]);return i}const n=[];e.forEach((i,s)=>{i.kind==="merged-agent"&&i.pending&&n.push(s)});const r=t==="error"?y0(e,i=>i.kind==="error"):y0(e,i=>i.kind==="assistant-text");return r>=0&&n.push(r),n.sort((i,s)=>i-s).map(i=>e[i])}const gW=new Set(["assistant-thinking","user-meta"]);function vW(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(gW.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function y0(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const _W={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function xW(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 NR(e){const t=_W[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=xW(e.input);return r?`${n} ${r}`:n}function yW({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?ir:Un,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:fe("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(In,{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:NR(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 bW({items:e,defaultExpanded:t=!1,renderItemDetail:n}){const[r,i]=g.useState(t);if(e.length===0)return null;const s=e.some(c=>c.pending),o=s?[...e].reverse().find(c=>c.pending):e[e.length-1],a=!s&&e.length>1?` 等 ${e.length} 项`:"",l=r?ir:Un;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>i(c=>!c),"aria-expanded":r,"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:[s&&!r?h.jsx(In,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(l,{className:"w-3.5 h-3.5 shrink-0"}),r?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:s?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:fe("truncate min-w-0",s&&"text-text-300"),children:[NR(o),a]})]}),r?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(c=>h.jsx(yW,{item:c,renderItemDetail:n},c.toolUseId))}):null]})}function wW(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 SW(e,t){const n=t!==void 0?`耗时 ${wW(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function kW({status:e="done",durationMs:t,defaultExpanded:n=!1,children:r}){const[i,s]=g.useState(n),o=i?ir:Un;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:()=>s(a=>!a),"aria-expanded":i,"data-testid":"turn-process-block-header",className:fe("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:SW(e,t)}),h.jsx(o,{className:"w-3.5 h-3.5 shrink-0"})]}),i?h.jsx("div",{"data-testid":"turn-process-body",className:"mt-2 flex flex-col gap-2 border-l-2 border-border pl-3",children:r}):null]})}const CW=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,EW=/<builder-preview\b[^>]*\/>/gi;function TR(e){return e?e.replace(CW,"").replace(EW,"").trim():""}const NW=TR;function TW(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const PW=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,IW=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,RW={};function NS(e,t){return(RW.jsx?IW:PW).test(e)}const MW=/[ \t\n\f\r]/g;function AW(e){return typeof e=="object"?e.type==="text"?TS(e.value):!1:TS(e)}function TS(e){return e.replace(MW,"")===""}class Cu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Cu.prototype.normal={};Cu.prototype.property={};Cu.prototype.space=void 0;function PR(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Cu(n,r,t)}function b0(e){return e.toLowerCase()}class Wn{constructor(t,n){this.attribute=n,this.property=t}}Wn.prototype.attribute="";Wn.prototype.booleanish=!1;Wn.prototype.boolean=!1;Wn.prototype.commaOrSpaceSeparated=!1;Wn.prototype.commaSeparated=!1;Wn.prototype.defined=!1;Wn.prototype.mustUseProperty=!1;Wn.prototype.number=!1;Wn.prototype.overloadedBoolean=!1;Wn.prototype.property="";Wn.prototype.spaceSeparated=!1;Wn.prototype.space=void 0;let LW=0;const Me=Oo(),At=Oo(),w0=Oo(),Q=Oo(),at=Oo(),Ta=Oo(),Gn=Oo();function Oo(){return 2**++LW}const S0=Object.freeze(Object.defineProperty({__proto__:null,boolean:Me,booleanish:At,commaOrSpaceSeparated:Gn,commaSeparated:Ta,number:Q,overloadedBoolean:w0,spaceSeparated:at},Symbol.toStringTag,{value:"Module"})),Bm=Object.keys(S0);class Sy extends Wn{constructor(t,n,r,i){let s=-1;if(super(t,n),PS(this,"space",i),typeof r=="number")for(;++s<Bm.length;){const o=Bm[s];PS(this,Bm[s],(r&S0[o])===S0[o])}}}Sy.prototype.defined=!0;function PS(e,t,n){n&&(e[t]=n)}function fl(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Sy(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[b0(r)]=r,n[b0(s.attribute)]=r}return new Cu(t,n,e.space)}const IR=fl({properties:{ariaActiveDescendant:null,ariaAtomic:At,ariaAutoComplete:null,ariaBusy:At,ariaChecked:At,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:at,ariaCurrent:null,ariaDescribedBy:at,ariaDetails:null,ariaDisabled:At,ariaDropEffect:at,ariaErrorMessage:null,ariaExpanded:At,ariaFlowTo:at,ariaGrabbed:At,ariaHasPopup:null,ariaHidden:At,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:at,ariaLevel:Q,ariaLive:null,ariaModal:At,ariaMultiLine:At,ariaMultiSelectable:At,ariaOrientation:null,ariaOwns:at,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:At,ariaReadOnly:At,ariaRelevant:null,ariaRequired:At,ariaRoleDescription:at,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:At,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function RR(e,t){return t in e?e[t]:t}function MR(e,t){return RR(e,t.toLowerCase())}const jW=fl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ta,acceptCharset:at,accessKey:at,action:null,allow:null,allowFullScreen:Me,allowPaymentRequest:Me,allowUserMedia:Me,alt:null,as:null,async:Me,autoCapitalize:null,autoComplete:at,autoFocus:Me,autoPlay:Me,blocking:at,capture:null,charSet:null,checked:Me,cite:null,className:at,cols:Q,colSpan:null,content:null,contentEditable:At,controls:Me,controlsList:at,coords:Q|Ta,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Me,defer:Me,dir:null,dirName:null,disabled:Me,download:w0,draggable:At,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Me,formTarget:null,headers:at,height:Q,hidden:w0,high:Q,href:null,hrefLang:null,htmlFor:at,httpEquiv:at,id:null,imageSizes:null,imageSrcSet:null,inert:Me,inputMode:null,integrity:null,is:null,isMap:Me,itemId:null,itemProp:at,itemRef:at,itemScope:Me,itemType:at,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Me,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:Me,muted:Me,name:null,nonce:null,noModule:Me,noValidate:Me,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:Me,optimum:Q,pattern:null,ping:at,placeholder:null,playsInline:Me,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Me,referrerPolicy:null,rel:at,required:Me,reversed:Me,rows:Q,rowSpan:Q,sandbox:at,scope:null,scoped:Me,seamless:Me,selected:Me,shadowRootClonable:Me,shadowRootDelegatesFocus:Me,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:At,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:Me,useMap:null,value:At,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:at,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Me,declare:Me,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:Me,noHref:Me,noShade:Me,noWrap:Me,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:At,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Me,disableRemotePlayback:Me,prefix:null,property:null,results:Q,security:null,unselectable:null},space:"html",transform:MR}),DW=fl({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:Gn,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:at,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:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:Me,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,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:Ta,g2:Ta,glyphName:Ta,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:Gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,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:Q,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:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:at,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,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:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:Gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gn,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:RR}),AR=fl({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()}}),LR=fl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:MR}),jR=fl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),OW={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"},BW=/[A-Z]/g,IS=/-[a-z]/g,zW=/^data[-\w.:]+$/i;function $W(e,t){const n=b0(t);let r=t,i=Wn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&zW.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(IS,HW);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!IS.test(s)){let o=s.replace(BW,FW);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Sy}return new i(r,t)}function FW(e){return"-"+e.toLowerCase()}function HW(e){return e.charAt(1).toUpperCase()}const UW=PR([IR,jW,AR,LR,jR],"html"),ky=PR([IR,DW,AR,LR,jR],"svg");function WW(e){return e.join(" ").trim()}var Cy={},RS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,VW=/\n/g,qW=/^\s*/,KW=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,GW=/^:\s*/,YW=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,XW=/^[;\s]*/,QW=/^\s+|\s+$/g,ZW=`
|
|
475
|
+
`)},d7=0,Ko=[];function h7(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(d7++)[0],s=g.useState(QP)[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=A9([e.lockRef.current],(e.shards||[]).map(sS),!0).filter(Boolean);return v.forEach(function(b){return b.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,b){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var _=vd(v),x=n.current,y="deltaX"in v?v.deltaX:x[0]-_[0],w="deltaY"in v?v.deltaY:x[1]-_[1],k,C=v.target,N=Math.abs(y)>Math.abs(w)?"h":"v";if("touches"in v&&N==="h"&&C.type==="range")return!1;var T=window.getSelection(),B=T&&T.anchorNode,P=B?B===C||B.contains(C):!1;if(P)return!1;var A=rS(N,C);if(!A)return!0;if(A?k=N:(k=N==="v"?"h":"v",A=rS(N,C)),!A)return!1;if(!r.current&&"changedTouches"in v&&(y||w)&&(r.current=k),!k)return!0;var I=r.current||k;return l7(I,b,v,I==="h"?y:w)},[]),l=g.useCallback(function(v){var b=v;if(!(!Ko.length||Ko[Ko.length-1]!==s)){var _="deltaY"in b?iS(b):vd(b),x=t.current.filter(function(k){return k.name===b.type&&(k.target===b.target||b.target===k.shadowParent)&&c7(k.delta,_)})[0];if(x&&x.should){b.cancelable&&b.preventDefault();return}if(!x){var y=(o.current.shards||[]).map(sS).filter(Boolean).filter(function(k){return k.contains(b.target)}),w=y.length>0?a(b,y[0]):!o.current.noIsolation;w&&b.cancelable&&b.preventDefault()}}},[]),c=g.useCallback(function(v,b,_,x){var y={name:v,delta:b,target:_,should:x,shadowParent:f7(_)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(w){return w!==y})},1)},[]),u=g.useCallback(function(v){n.current=vd(v),r.current=void 0},[]),d=g.useCallback(function(v){c(v.type,iS(v),v.target,a(v,e.lockRef.current))},[]),f=g.useCallback(function(v){c(v.type,vd(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return Ko.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,qo),document.addEventListener("touchmove",l,qo),document.addEventListener("touchstart",u,qo),function(){Ko=Ko.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,qo),document.removeEventListener("touchmove",l,qo),document.removeEventListener("touchstart",u,qo)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(s,{styles:u7(i)}):null,p?g.createElement(t7,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function f7(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const p7=H9(XP,h7);var Zx=g.forwardRef(function(e,t){return g.createElement(up,Gr({},e,{ref:t,sideCar:p7}))});Zx.classNames=up.classNames;var m0=["Enter"," "],m7=["ArrowDown","PageUp","Home"],tI=["ArrowUp","PageDown","End"],g7=[...m7,...tI],v7={ltr:[...m0,"ArrowRight"],rtl:[...m0,"ArrowLeft"]},_7={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bu="Menu",[Xc,x7,y7]=uP(bu),[Lo,nI]=Ao(bu,[y7,cp,FP]),wu=cp(),rI=FP(),[iI,Ds]=Lo(bu),[b7,Su]=Lo(bu),sI=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=wu(t),[l,c]=g.useState(null),u=g.useRef(!1),d=oi(s),f=dP(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(Xx,{...a,children:h.jsx(iI,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:h.jsx(b7,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};sI.displayName=bu;var w7="MenuAnchor",Jx=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=wu(n);return h.jsx(OP,{...i,...r,ref:t})});Jx.displayName=w7;var ey="MenuPortal",[S7,oI]=Lo(ey,{forceMount:void 0}),aI=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Ds(ey,t);return h.jsx(S7,{scope:t,forceMount:n,children:h.jsx($i,{present:n||s.open,children:h.jsx(Qx,{asChild:!0,container:i,children:r})})})};aI.displayName=ey;var gr="MenuContent",[k7,ty]=Lo(gr),lI=g.forwardRef((e,t)=>{const n=oI(gr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Ds(gr,e.__scopeMenu),o=Su(gr,e.__scopeMenu);return h.jsx(Xc.Provider,{scope:e.__scopeMenu,children:h.jsx($i,{present:r||s.open,children:h.jsx(Xc.Slot,{scope:e.__scopeMenu,children:o.modal?h.jsx(C7,{...i,ref:t}):h.jsx(E7,{...i,ref:t})})})})}),C7=g.forwardRef((e,t)=>{const n=Ds(gr,e.__scopeMenu),r=g.useRef(null),i=qt(t,r);return g.useEffect(()=>{const s=r.current;if(s)return KP(s)},[]),h.jsx(ny,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Pe(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),E7=g.forwardRef((e,t)=>{const n=Ds(gr,e.__scopeMenu);return h.jsx(ny,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),N7=Gc("MenuContent.ScrollLock"),ny=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,b=Ds(gr,n),_=Su(gr,n),x=wu(n),y=rI(n),w=x7(n),[k,C]=g.useState(null),N=g.useRef(null),T=qt(t,N,b.onContentChange),B=g.useRef(0),P=g.useRef(""),A=g.useRef(0),I=g.useRef(null),R=g.useRef("right"),j=g.useRef(0),z=m?Zx:g.Fragment,$=m?{as:N7,allowPinchZoom:!0}:void 0,F=O=>{var ye,Fe;const E=P.current+O,H=w().filter(ue=>!ue.disabled),V=document.activeElement,L=(ye=H.find(ue=>ue.ref.current===V))==null?void 0:ye.textValue,ne=H.map(ue=>ue.textValue),ae=z7(ne,E,L),G=(Fe=H.find(ue=>ue.textValue===ae))==null?void 0:Fe.ref.current;(function ue(Ie){P.current=Ie,window.clearTimeout(B.current),Ie!==""&&(B.current=window.setTimeout(()=>ue(""),1e3))})(E),G&&setTimeout(()=>G.focus())};g.useEffect(()=>()=>window.clearTimeout(B.current),[]),pP();const D=g.useCallback(O=>{var H,V;return R.current===((H=I.current)==null?void 0:H.side)&&F7(O,(V=I.current)==null?void 0:V.area)},[]);return h.jsx(k7,{scope:n,searchRef:P,onItemEnter:g.useCallback(O=>{D(O)&&O.preventDefault()},[D]),onItemLeave:g.useCallback(O=>{var E;D(O)||((E=N.current)==null||E.focus(),C(null))},[D]),onTriggerLeave:g.useCallback(O=>{D(O)&&O.preventDefault()},[D]),pointerGraceTimerRef:A,onPointerGraceIntentChange:g.useCallback(O=>{I.current=O},[]),children:h.jsx(z,{...$,children:h.jsx(Fx,{asChild:!0,trapped:i,onMountAutoFocus:Pe(s,O=>{var E;O.preventDefault(),(E=N.current)==null||E.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:h.jsx(ip,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:h.jsx(T9,{asChild:!0,...y,dir:_.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:C,onEntryFocus:Pe(l,O=>{_.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(BP,{role:"menu","aria-orientation":"vertical","data-state":CI(b.open),"data-radix-menu-content":"",dir:_.dir,...x,...v,ref:T,style:{outline:"none",...v.style},onKeyDown:Pe(v.onKeyDown,O=>{const H=O.target.closest("[data-radix-menu-content]")===O.currentTarget,V=O.ctrlKey||O.altKey||O.metaKey,L=O.key.length===1;H&&(O.key==="Tab"&&O.preventDefault(),!V&&L&&F(O.key));const ne=N.current;if(O.target!==ne||!g7.includes(O.key))return;O.preventDefault();const G=w().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);tI.includes(O.key)&&G.reverse(),O7(G)}),onBlur:Pe(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(B.current),P.current="")}),onPointerMove:Pe(e.onPointerMove,Qc(O=>{const E=O.target,H=j.current!==O.clientX;if(O.currentTarget.contains(E)&&H){const V=O.clientX>j.current?"right":"left";R.current=V,j.current=O.clientX}}))})})})})})})});lI.displayName=gr;var T7="MenuGroup",ry=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Et.div,{role:"group",...r,ref:t})});ry.displayName=T7;var P7="MenuLabel",cI=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Et.div,{...r,ref:t})});cI.displayName=P7;var Jh="MenuItem",oS="menu.itemSelect",dp=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=g.useRef(null),o=Su(Jh,e.__scopeMenu),a=ty(Jh,e.__scopeMenu),l=qt(t,s),c=g.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(oS,{bubbles:!0,cancelable:!0});d.addEventListener(oS,p=>r==null?void 0:r(p),{once:!0}),cP(d,f),f.defaultPrevented?c.current=!1:o.onClose()}};return h.jsx(uI,{...i,ref:l,disabled:n,onClick:Pe(e.onClick,u),onPointerDown:d=>{var f;(f=e.onPointerDown)==null||f.call(e,d),c.current=!0},onPointerUp:Pe(e.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:Pe(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||m0.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});dp.displayName=Jh;var uI=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=ty(Jh,n),a=rI(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(Xc.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:h.jsx(P9,{asChild:!0,...a,focusable:!r,children:h.jsx(Et.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:Pe(e.onPointerMove,Qc(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Pe(e.onPointerLeave,Qc(m=>o.onItemLeave(m))),onFocus:Pe(e.onFocus,()=>d(!0)),onBlur:Pe(e.onBlur,()=>d(!1))})})})}),I7="MenuCheckboxItem",dI=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return h.jsx(gI,{scope:e.__scopeMenu,checked:n,children:h.jsx(dp,{role:"menuitemcheckbox","aria-checked":ef(n)?"mixed":n,...i,ref:t,"data-state":oy(n),onSelect:Pe(i.onSelect,()=>r==null?void 0:r(ef(n)?!0:!n),{checkForDefaultPrevented:!1})})})});dI.displayName=I7;var hI="MenuRadioGroup",[R7,M7]=Lo(hI,{value:void 0,onValueChange:()=>{}}),fI=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=oi(r);return h.jsx(R7,{scope:e.__scopeMenu,value:n,onValueChange:s,children:h.jsx(ry,{...i,ref:t})})});fI.displayName=hI;var pI="MenuRadioItem",mI=g.forwardRef((e,t)=>{const{value:n,...r}=e,i=M7(pI,e.__scopeMenu),s=n===i.value;return h.jsx(gI,{scope:e.__scopeMenu,checked:s,children:h.jsx(dp,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":oy(s),onSelect:Pe(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});mI.displayName=pI;var iy="MenuItemIndicator",[gI,A7]=Lo(iy,{checked:!1}),vI=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=A7(iy,n);return h.jsx($i,{present:r||ef(s.checked)||s.checked===!0,children:h.jsx(Et.span,{...i,ref:t,"data-state":oy(s.checked)})})});vI.displayName=iy;var L7="MenuSeparator",_I=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Et.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});_I.displayName=L7;var j7="MenuArrow",xI=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=wu(n);return h.jsx(zP,{...i,...r,ref:t})});xI.displayName=j7;var sy="MenuSub",[D7,yI]=Lo(sy),bI=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=Ds(sy,t),o=wu(t),[a,l]=g.useState(null),[c,u]=g.useState(null),d=oi(i);return g.useEffect(()=>(s.open===!1&&d(!1),()=>d(!1)),[s.open,d]),h.jsx(Xx,{...o,children:h.jsx(iI,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:h.jsx(D7,{scope:t,contentId:Ti(),triggerId:Ti(),trigger:a,onTriggerChange:l,children:n})})})};bI.displayName=sy;var Gl="MenuSubTrigger",wI=g.forwardRef((e,t)=>{const n=Ds(Gl,e.__scopeMenu),r=Su(Gl,e.__scopeMenu),i=yI(Gl,e.__scopeMenu),s=ty(Gl,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(Jx,{asChild:!0,...c,children:h.jsx(uI,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":CI(n.open),...e,ref:vu(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:Pe(e.onPointerMove,Qc(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:Pe(e.onPointerLeave,Qc(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,b=v==="right",_=b?-5:5,x=f[b?"left":"right"],y=f[b?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+_,y:d.clientY},{x,y:f.top},{x:y,y:f.top},{x:y,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:Pe(e.onKeyDown,d=>{var p;const f=s.searchRef.current!=="";e.disabled||f&&d.key===" "||v7[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});wI.displayName=Gl;var SI="MenuSubContent",kI=g.forwardRef((e,t)=>{const n=oI(gr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Ds(gr,e.__scopeMenu),o=Su(gr,e.__scopeMenu),a=yI(SI,e.__scopeMenu),l=g.useRef(null),c=qt(t,l);return h.jsx(Xc.Provider,{scope:e.__scopeMenu,children:h.jsx($i,{present:r||s.open,children:h.jsx(Xc.Slot,{scope:e.__scopeMenu,children:h.jsx(ny,{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:Pe(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Pe(e.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Pe(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),f=_7[o.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});kI.displayName=SI;function CI(e){return e?"open":"closed"}function ef(e){return e==="indeterminate"}function oy(e){return ef(e)?"indeterminate":e?"checked":"unchecked"}function O7(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function B7(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function z7(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=B7(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 $7(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 F7(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return $7(n,t)}function Qc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var H7=sI,U7=Jx,W7=aI,V7=lI,q7=ry,K7=cI,G7=dp,Y7=dI,X7=fI,Q7=mI,Z7=vI,J7=_I,eH=xI,tH=bI,nH=wI,rH=kI,hp="DropdownMenu",[iH]=Ao(hp,[nI]),wn=nI(),[sH,EI]=iH(hp),NI=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=wn(t),c=g.useRef(null),[u,d]=_u({prop:i,defaultProp:s??!1,onChange:o,caller:hp});return h.jsx(sH,{scope:t,triggerId:Ti(),triggerRef:c,contentId:Ti(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:h.jsx(H7,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};NI.displayName=hp;var TI="DropdownMenuTrigger",PI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,s=EI(TI,n),o=wn(n);return h.jsx(U7,{asChild:!0,...o,children:h.jsx(Et.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:vu(t,s.triggerRef),onPointerDown:Pe(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Pe(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});PI.displayName=TI;var oH="DropdownMenuPortal",II=e=>{const{__scopeDropdownMenu:t,...n}=e,r=wn(t);return h.jsx(W7,{...r,...n})};II.displayName=oH;var RI="DropdownMenuContent",MI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=EI(RI,n),s=wn(n),o=g.useRef(!1);return h.jsx(V7,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:t,onCloseAutoFocus:Pe(e.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Pe(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)"}})});MI.displayName=RI;var aH="DropdownMenuGroup",lH=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(q7,{...i,...r,ref:t})});lH.displayName=aH;var cH="DropdownMenuLabel",AI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(K7,{...i,...r,ref:t})});AI.displayName=cH;var uH="DropdownMenuItem",LI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(G7,{...i,...r,ref:t})});LI.displayName=uH;var dH="DropdownMenuCheckboxItem",jI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(Y7,{...i,...r,ref:t})});jI.displayName=dH;var hH="DropdownMenuRadioGroup",fH=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(X7,{...i,...r,ref:t})});fH.displayName=hH;var pH="DropdownMenuRadioItem",mH=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(Q7,{...i,...r,ref:t})});mH.displayName=pH;var gH="DropdownMenuItemIndicator",DI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(Z7,{...i,...r,ref:t})});DI.displayName=gH;var vH="DropdownMenuSeparator",OI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(J7,{...i,...r,ref:t})});OI.displayName=vH;var _H="DropdownMenuArrow",xH=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(eH,{...i,...r,ref:t})});xH.displayName=_H;var yH=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,o=wn(t),[a,l]=_u({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return h.jsx(tH,{...o,open:a,onOpenChange:l,children:n})},bH="DropdownMenuSubTrigger",BI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(nH,{...i,...r,ref:t})});BI.displayName=bH;var wH="DropdownMenuSubContent",zI=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=wn(n);return h.jsx(rH,{...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)"}})});zI.displayName=wH;var SH=NI,kH=PI,$I=II,FI=MI,HI=AI,UI=LI,WI=jI,CH=DI,VI=OI,EH=yH,qI=BI,KI=zI;const ay=SH,ly=kH,fp=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx($I,{children:h.jsx(FI,{ref:r,sideOffset:t,className:fe("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...n})}));fp.displayName=FI.displayName;const NH=EH,GI=g.forwardRef(({className:e,...t},n)=>h.jsx(qI,{ref:n,className:fe("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}));GI.displayName=qI.displayName;const YI=g.forwardRef(({className:e,...t},n)=>h.jsx($I,{children:h.jsx(KI,{ref:n,className:fe("z-50 min-w-[6rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...t})}));YI.displayName=KI.displayName;const yi=g.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(UI,{ref:r,className:fe("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}));yi.displayName=UI.displayName;const TH=g.forwardRef(({className:e,children:t,checked:n,...r},i)=>h.jsxs(WI,{ref:i,checked:n,className:fe("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(CH,{children:h.jsx(ul,{className:"h-3.5 w-3.5"})})}),t]}));TH.displayName=WI.displayName;const XI=g.forwardRef(({className:e,...t},n)=>h.jsx(VI,{ref:n,className:fe("-mx-1 my-1 h-px bg-border",e),...t}));XI.displayName=VI.displayName;const PH=g.forwardRef(({className:e,...t},n)=>h.jsx(HI,{ref:n,className:fe("px-2 py-1.5 text-xs font-semibold text-text-400",e),...t}));PH.displayName=HI.displayName;function IH({tool:e,className:t}){const n=w8(e);return h.jsx("span",{"data-testid":n?`session-icon-${e}`:"session-icon-default","aria-label":n?$x(e):"未知引擎",className:fe("w-3.5 h-3.5 shrink-0 inline-flex items-center justify-center",rp(e),t),children:h.jsx(np,{tool:e,className:"w-full h-full"})})}function QI(e){return e.compositionActive||!!e.nativeIsComposing||e.keyCode===229}function ZI(e){return e.key==="Enter"&&!e.shiftKey&&!QI(e)}function ku(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(ZI({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 RH({open:e,initialLabel:t,placeholder:n,onSubmit:r,onCancel:i}){const[s,o]=g.useState(t);g.useEffect(()=>{e&&o(t)},[e,t]);const a=ku(()=>r({label:s.trim()}),i);return e?el.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":"session-edit-dialog-overlay",children:h.jsxs("div",{"data-testid":"session-edit-dialog",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:l=>l.stopPropagation(),children:[h.jsx("div",{className:"text-[15px] font-semibold text-text-100",children:"Edit session"}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-[12px] font-semibold text-text-200 mb-1",children:"Label"}),h.jsx("input",{autoFocus:!0,type:"text",value:s,onChange:l=>o(l.target.value),...a,placeholder:n,"data-testid":"session-edit-dialog-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:()=>r({label:s.trim()}),"data-testid":"session-edit-dialog-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",children:"Save"})]})]})}),document.body):null}var MH=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"}),AH="VisuallyHidden",JI=g.forwardRef((e,t)=>h.jsx(Et.span,{...e,ref:t,style:{...MH,...e.style}}));JI.displayName=AH;var LH=JI,[pp]=Ao("Tooltip",[cp]),mp=cp(),eR="TooltipProvider",jH=700,g0="tooltip.open",[DH,cy]=pp(eR),tR=e=>{const{__scopeTooltip:t,delayDuration:n=jH,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(DH,{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})};tR.displayName=eR;var Zc="Tooltip",[OH,gp]=pp(Zc),nR=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=cy(Zc,e.__scopeTooltip),c=mp(t),[u,d]=g.useState(null),f=Ti(),p=g.useRef(0),m=o??l.disableHoverableContent,v=a??l.delayDuration,b=g.useRef(!1),[_,x]=_u({prop:r,defaultProp:i??!1,onChange:N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(g0))):l.onClose(),s==null||s(N)},caller:Zc}),y=g.useMemo(()=>_?b.current?"delayed-open":"instant-open":"closed",[_]),w=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,x(!0)},[x]),k=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x(!1)},[x]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,x(!0),p.current=0},v)},[v,x]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),h.jsx(Xx,{...c,children:h.jsx(OH,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayedRef.current?C():w()},[l.isOpenDelayedRef,C,w]),onTriggerLeave:g.useCallback(()=>{m?k():(window.clearTimeout(p.current),p.current=0)},[k,m]),onOpen:w,onClose:k,disableHoverableContent:m,children:n})})};nR.displayName=Zc;var v0="TooltipTrigger",rR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=gp(v0,n),s=cy(v0,n),o=mp(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(OP,{asChild:!0,...o,children:h.jsx(Et.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Pe(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Pe(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Pe(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Pe(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Pe(e.onBlur,i.onClose),onClick:Pe(e.onClick,i.onClose)})})});rR.displayName=v0;var BH="TooltipPortal",[$se,zH]=pp(BH,{forceMount:void 0}),Ha="TooltipContent",iR=g.forwardRef((e,t)=>{const n=zH(Ha,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=gp(Ha,e.__scopeTooltip);return h.jsx($i,{present:r||o.open,children:o.disableHoverableContent?h.jsx(sR,{side:i,...s,ref:t}):h.jsx($H,{side:i,...s,ref:t})})}),$H=g.forwardRef((e,t)=>{const n=gp(Ha,e.__scopeTooltip),r=cy(Ha,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 b=m.currentTarget,_={x:m.clientX,y:m.clientY},x=VH(_,b.getBoundingClientRect()),y=qH(_,x),w=KH(v.getBoundingClientRect()),k=YH([...y,...w]);a(k),d(!0)},[d]);return g.useEffect(()=>()=>f(),[f]),g.useEffect(()=>{if(l&&u){const m=b=>p(b,u),v=b=>p(b,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 b=v.target,_={x:v.clientX,y:v.clientY},x=(l==null?void 0:l.contains(b))||(u==null?void 0:u.contains(b)),y=!GH(_,o);x?f():y&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,f]),h.jsx(sR,{...e,ref:s})}),[FH,HH]=pp(Zc,{isInside:!1}),UH=M8("TooltipContent"),sR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,l=gp(Ha,n),c=mp(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(g0,u),()=>document.removeEventListener(g0,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(ip,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:h.jsxs(BP,{"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(UH,{children:r}),h.jsx(FH,{scope:n,isInside:!0,children:h.jsx(LH,{id:l.contentId,role:"tooltip",children:i||r})})]})})});iR.displayName=Ha;var oR="TooltipArrow",WH=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=mp(n);return HH(oR,n).isInside?null:h.jsx(zP,{...i,...r,ref:t})});WH.displayName=oR;function VH(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 qH(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 KH(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 GH(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 YH(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),XH(t)}function XH(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 QH=tR,ZH=nR,JH=rR,aR=iR;const uy=QH,dy=ZH,hy=JH,vp=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(aR,{ref:r,sideOffset:t,className:fe("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}));vp.displayName=aR.displayName;const eU={held:!1,indexBySessionId:new Map},tU=g.createContext(eU);function nU(){return g.useContext(tU)}const rU=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})),iU=[{id:"new-session",combo:{key:"n",mod:!0},label:"新建任务",description:"打开快捷新建弹窗",group:"通用",desktopOnly:!0},...rU,{id:"archive-session",combo:{key:"a",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:"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}];iU.filter(e=>!e.displayOnly);function sU(){return/Mac|iP(hone|od|ad)/.test(navigator.platform)}const oU=10,aU=20,lU=16,cU=20,uU=60,dU=4;function hU({session:e,active:t,hasUnread:n,running:r=!1,awaitingUser:i=!1,onSelect:s,onEdit:o,onDelete:a,onPin:l,onArchive:c,archiveShortcut:u=!1,depth:d=0,chevron:f,showCopyResume:p=!0,contactDisplayName:m}){const[v,b]=g.useState(!1),_=nU(),x=_.held?_.indexBySessionId.get(e.sessionId):void 0,y=!!e.pinnedAt,w=d===0,k=d===0&&!!c,C=oU+d*aU,N=g.useCallback(async()=>{const A=aP(e);if(A)try{await navigator.clipboard.writeText(A)}catch{}},[e]),T=e.appBuilderProject?`[app] ${e.appBuilderProject}`:e.label||e.aiLabel||e.larkChatName||e.larkChatId||e.cwd.split("/").filter(Boolean).pop()||e.sessionId.slice(0,8),B=e.originOwnerPrincipalId,P=B?`@${m??`…${B.slice(-8)}`}`:null;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":`session-item-${e.sessionId}`,onClick:s,style:{paddingLeft:C,display:"grid",gridTemplateColumns:`${lU}px ${cU}px 1fr auto ${uU}px`,gridTemplateAreas:'"chev icon name dot time"',columnGap:`${dU}px`,alignItems:"center"},className:fe("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(IH,{tool:e.tool})}),h.jsxs("div",{style:{gridArea:"name"},className:"flex items-center gap-1 min-w-0",children:[e.dispatchedFromSessionId?h.jsx(yz,{"data-testid":`dispatched-icon-${e.sessionId}`,className:"w-3 h-3 text-accent shrink-0",strokeWidth:2.25,"aria-label":"dispatched from another session",children:h.jsx("title",{children:"由另一个 session dispatch 派生"})}):null,e.shiftFiredFromSessionId?h.jsx(GB,{"data-testid":`shift-fired-icon-${e.sessionId}`,className:"w-3 h-3 text-accent shrink-0",strokeWidth:2.25,"aria-label":"fired by clawd-shift scheduler",children:h.jsx("title",{children:"由 shift 排班到点 fire 派生"})}):null,e.larkChatId?h.jsx(qz,{"data-testid":`lark-chat-icon-${e.sessionId}`,className:"w-3 h-3 text-accent shrink-0",strokeWidth:2.25,"aria-label":"driven by feishu chat",children:h.jsx("title",{children:e.larkChatType==="p2p"?"飞书私聊会话(对方消息驱动)":"飞书群会话(群成员 @ bot 驱动)"})}):null,h.jsx("span",{"data-testid":`session-title-${e.sessionId}`,className:fe("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:T}),P?h.jsx("span",{"data-testid":`session-mirror-chip-${e.sessionId}`,title:`在 ${P.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:P}):null]}),i?h.jsx(tz,{"data-testid":`awaiting-dot-${e.sessionId}`,style:{gridArea:"dot"},className:"w-3 h-3 text-warning shrink-0 animate-pulse",strokeWidth:2.25,"aria-label":"awaiting user"}):n?h.jsx("span",{"data-testid":`unread-dot-${e.sessionId}`,style:{gridArea:"dot"},className:"w-2 h-2 rounded-full bg-error shrink-0","aria-label":"unread"}):r?h.jsx("span",{"data-testid":`running-dot-${e.sessionId}`,style:{gridArea:"dot"},className:"w-2 h-2 rounded-full bg-success shrink-0 animate-pulse","aria-label":"running"}):null,x!=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:sU()?`⌘${x}`:`Ctrl+${x}`})}):h.jsx("span",{style:{gridArea:"time"},className:fe("text-[11px] text-text-400/70 text-right shrink-0","transition-opacity duration-150 group-hover:opacity-0"),children:e.updatedAt?S8(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:[u&&k&&c?h.jsx(uy,{delayDuration:200,skipDelayDuration:100,children:h.jsxs(dy,{children:[h.jsx(hy,{asChild:!0,children:h.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),c(e.sessionId,!0)},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":"archive session","data-testid":`archive-shortcut-${e.sessionId}`,children:h.jsx(Nw,{className:"w-4 h-4"})})}),h.jsx(vp,{side:"bottom",children:"归档"})]})}):null,h.jsxs(ay,{modal:!1,children:[h.jsx(ly,{asChild:!0,children:h.jsx("button",{type:"button",onClick:A=>A.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(OT,{className:"w-4 h-4"})})}),h.jsxs(fp,{align:"end",onClick:A=>A.stopPropagation(),children:[l&&w&&h.jsxs(yi,{onSelect:()=>l(e.sessionId,!y),"data-testid":`session-${y?"unpin":"pin"}-${e.sessionId}`,children:[y?h.jsx(t$,{className:"w-3 h-3 mr-2 text-text-400"}):h.jsx(r$,{className:"w-3 h-3 mr-2 text-text-400"}),y?"Unpin":"Pin"]}),k&&c&&h.jsxs(yi,{onSelect:()=>c(e.sessionId,!0),"data-testid":`session-archive-${e.sessionId}`,children:[h.jsx(Nw,{className:"w-3 h-3 mr-2 text-text-400"}),"Archive"]}),o&&h.jsxs(yi,{onSelect:()=>b(!0),"data-testid":`session-rename-${e.sessionId}`,children:[h.jsx($T,{className:"w-3 h-3 mr-2 text-text-400"}),"Rename"]}),p&&e.toolSessionId?h.jsxs(yi,{onSelect:()=>void N(),"data-testid":`session-copy-resume-${e.sessionId}`,children:[h.jsx(tp,{className:"w-3 h-3 mr-2 text-text-400"}),"Copy Resume Command"]}):null,(l||o||p&&e.toolSessionId)&&a&&h.jsx(XI,{}),a&&h.jsxs(yi,{onSelect:()=>void a(e.sessionId),className:"text-destructive focus:text-destructive focus:bg-destructive/10","data-testid":`session-delete-${e.sessionId}`,children:[h.jsx(Ox,{className:"w-3 h-3 mr-2"}),"Delete"]})]})]})]}):null]}),o?h.jsx(RH,{open:v,initialLabel:e.label??"",placeholder:e.cwd.split("/").pop()||"",onSubmit:A=>{o(e.sessionId,A),b(!1)},onCancel:()=>b(!1)}):null]})}function fy({node:e,depth:t=0,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,archiveShortcut:d,getContactDisplayName:f,showCopyResume:p}){const m=e.children.length>0,{isCollapsed:v,toggle:b}=FB(),_=!v(e.session.sessionId),x=g.useCallback(w=>{w.stopPropagation(),b(e.session.sessionId)},[b,e.session.sessionId]),y=m?h.jsx("button",{type:"button",onClick:x,"data-testid":`session-chevron-${e.session.sessionId}`,"aria-label":_?"collapse":"expand","aria-expanded":_,className:"shrink-0 flex items-center justify-center w-4 h-4 text-text-400 hover:text-text-100 cursor-pointer",children:_?h.jsx(ir,{className:"w-3 h-3"}):h.jsx(Un,{className:"w-3 h-3"})}):null;return h.jsxs("div",{"data-testid":`session-tree-node-${e.session.sessionId}`,children:[h.jsx(hU,{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,archiveShortcut:d,showCopyResume:p,depth:t,chevron:y,contactDisplayName:e.session.originOwnerPrincipalId?f==null?void 0:f(e.session.originOwnerPrincipalId):void 0}),m&&_?h.jsx("div",{"data-testid":`session-tree-children-${e.session.sessionId}`,children:e.children.map(w=>h.jsx(fy,{node:w,depth:t+1,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,archiveShortcut:d,getContactDisplayName:f,showCopyResume:p},w.session.sessionId))}):null]})}function fU(e){return e.forkedFromSessionId??e.dispatchedFromSessionId??e.shiftFiredFromSessionId}function lR(e){e=e.filter(s=>!s.ephemeral);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=fU(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((l,c)=>l.createdAt<c.createdAt?-1:l.createdAt>c.createdAt?1:0);return{session:s,children:a.map(i)}};return[...r].sort(pU).map(i)}function cR(e){return[...e].sort((t,n)=>t.session.updatedAt<n.session.updatedAt?1:t.session.updatedAt>n.session.updatedAt?-1:0)}function pU(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||e.updatedAt<t.updatedAt?1:e.updatedAt>t.updatedAt?-1:0}function mU(e){return e.appBuilderProject?`[app] ${e.appBuilderProject}`:e.label?e.label:e.aiLabel?e.aiLabel:e.cwd.split("/").filter(Boolean).pop()??""}function aS(e,t){const n=t.trim().toLowerCase();return n===""?!0:e.toLowerCase().includes(n)}const gU={isCollapsed:()=>!1,toggle:()=>{},prune:()=>{}};function vU({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:b,showCopyResume:_,treatSessionsAsRoots:x,searchQuery:y}){const[w,k]=g.useState(null),[C,N]=g.useState(()=>new Set),T=p??(I=>C.has(I)),B=g.useCallback(I=>{if(m){m(I);return}N(R=>{const j=new Set(R);return j.has(I)?j.delete(I):j.add(I),j})},[m]),P=g.useMemo(()=>i==null?void 0:i.filter(I=>!I.ephemeral),[i]);if(e.length===0)return h.jsx(_U,{});const A=(y??"").trim();return A?h.jsx(Lx.Provider,{value:gU,children:h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(I=>{const R=P?P.filter(F=>F.ownerPersonaId===I.personaId).sort((F,D)=>D.updatedAt>F.updatedAt?1:-1):[],j=aS(I.label,A),z=R.filter(F=>aS(mU(F),A));if(!j&&z.length===0)return null;const $=j?R:z;return h.jsx(lS,{persona:I,active:I.personaId===t,editing:!1,onSelectPersona:n,onSubmitCreateSession:()=>{},onCancelCreateSession:()=>{},personaSessions:$,collapsed:!1,onToggleCollapsed:()=>{},activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:b,showCopyResume:_,treatSessionsAsRoots:x,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f},I.personaId)})})}):h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(I=>{const R=P?P.filter(j=>j.ownerPersonaId===I.personaId).sort((j,z)=>z.updatedAt>j.updatedAt?1:-1):[];return h.jsx(lS,{persona:I,active:I.personaId===t,editing:I.personaId===w,onSelectPersona:n,onStartCreateSession:r?()=>k(I.personaId):void 0,onSubmitCreateSession:j=>{k(null),r==null||r(I.personaId,j)},onCancelCreateSession:()=>k(null),personaSessions:R,collapsed:!T(I.personaId),onToggleCollapsed:()=>B(I.personaId),activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:b,showCopyResume:_,treatSessionsAsRoots:x,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f},I.personaId)})})}function _U(){return h.jsx("div",{className:"px-3 py-3 text-[11px] leading-relaxed text-text-400",children:"还没有 persona。点上方 Personas 标题右侧 + 创建第一个。"})}function lS({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:b,onPinSession:_,showCopyResume:x,treatSessionsAsRoots:y,ownerPrincipalId:w,creatorDisplayNameByOwnerId:k}){const C=a.length>0,N=!l,T=g.useMemo(()=>{const A=[],I=new Map;for(const R of a){const j=R.creatorPrincipalId;if(R.larkChatId!=null||!j||w&&j===w){A.push(R);continue}const z=j,$=(k==null?void 0:k.get(z))??`…${z.slice(-8)}`,F=I.get(z);F?F.sessions.push(R):I.set(z,{groupKey:z,displayName:$,sessions:[R]})}return{self:A,byPeer:[...I.values()]}},[a,w,k]),B=T.byPeer.length>0,P=g.useMemo(()=>N&&!B?cR(lR(a)):[],[N,B,a]);return h.jsxs("div",{"data-testid":`persona-node-${e.personaId}`,children:[h.jsxs("div",{className:fe("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:[C?h.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),c()},"aria-label":N?"collapse":"expand","aria-expanded":N,"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:N?h.jsx(ir,{className:"h-3 w-3"}):h.jsx(Un,{className:"h-3 w-3"})}):h.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),h.jsx(np,{tool:e.tool,className:fe("h-3.5 w-3.5 shrink-0",rp(e.tool))}),h.jsx("span",{className:"flex-1 truncate text-[13px]",children:e.label}),C?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(a$,{className:"h-3.5 w-3.5"})}):null]}),n?h.jsx(xU,{personaId:e.personaId,tool:e.tool,onSubmit:s,onCancel:o}):null,C&&N?h.jsx("div",{"data-testid":`persona-sessions-${e.personaId}`,children:B?h.jsxs(h.Fragment,{children:[T.self.length>0&&h.jsx(cS,{groupKey:`${e.personaId}-self`,label:"我自己",testId:`persona-sessions-${e.personaId}-self`,sessions:T.self,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:b,onPinSession:_,showCopyResume:x}),T.byPeer.map(A=>h.jsx(cS,{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:b,onPinSession:_,showCopyResume:x},`${e.personaId}-peer-${A.groupKey}`))]}):P.map(A=>h.jsx(fy,{node:A,depth:y?0:1,activeId:u,unreadIds:p,runningIds:f,awaitingIds:d,onSelect:I=>m==null?void 0:m(I),onDelete:v,onEdit:b,onPin:_,showCopyResume:x},A.session.sessionId))}):null]})}function cS({label:e,testId:t,sessions:n,activeSessionId:r,awaitingIds:i,runningIds:s,unreadIds:o,onSelectSession:a,onDeleteSession:l,onEditSession:c,onPinSession:u,showCopyResume:d}){const[f,p]=g.useState(!1),m=!f,v=g.useMemo(()=>m?cR(lR(n)):[],[m,n]);return h.jsxs("div",{"data-testid":t,children:[h.jsxs("button",{type:"button",onClick:()=>p(b=>!b),"aria-label":m?"collapse":"expand","aria-expanded":m,"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:[m?h.jsx(ir,{className:"h-3 w-3"}):h.jsx(Un,{className:"h-3 w-3"}),h.jsx(UT,{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})]}),m&&h.jsx("div",{children:v.map(b=>h.jsx(fy,{node:b,depth:2,activeId:r,unreadIds:o,runningIds:s,awaitingIds:i,onSelect:_=>a==null?void 0:a(_),onDelete:l,onEdit:c,onPin:u,showCopyResume:d},b.session.sessionId))})]})}function xU({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=ku(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(np,{tool:t,className:fe("h-3 w-3 shrink-0",rp(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(ul,{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(Dr,{className:"h-3 w-3"})})]})}function yU(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function bU(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),r=parseFloat(n.fontSize);return t*r}function wU(e){return e/100*window.innerHeight}function SU(e){return e/100*window.innerWidth}function kU(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 Yl({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,s]=kU(n);switch(s){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=bU(t,i);break}case"em":{r=yU(t,i);break}case"vh":{r=wU(i);break}case"vw":{r=SU(i);break}}return r}function Nn(e){return parseFloat(e.toFixed(3))}function Ua({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 _0(e){const{panels:t}=e,n=Ua({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=Yl({groupSize:n,panelElement:i,styleProp:s.collapsedSize});o=Nn(u/n*100)}let a;if(s.defaultSize!==void 0){const u=Yl({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=Nn(u/n*100)}let l=0;if(s.minSize!==void 0){const u=Yl({groupSize:n,panelElement:i,styleProp:s.minSize});l=Nn(u/n*100)}let c=100;if(s.maxSize!==void 0){const u=Yl({groupSize:n,panelElement:i,styleProp:s.maxSize});c=Nn(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 rt(e,t="Assertion error"){if(!e)throw Error(t)}function x0(e,t){return Array.from(t).sort(e==="horizontal"?CU:EU)}function CU(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function EU(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function uR(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function dR(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 NU({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}=dR(r,o),c=e==="horizontal"?a:l;c<s&&(s=c,i=o)}return rt(i,"No rect found"),i}let _d;function TU(){return _d===void 0&&(typeof matchMedia=="function"?_d=!!matchMedia("(pointer:coarse)").matches:_d=!1),_d}function hR(e){const{element:t,orientation:n,panels:r,separators:i}=e,s=x0(n,Array.from(t.children).filter(uR).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 b=r.find(_=>_.element===v);if(b){if(f){const _=f.element.getBoundingClientRect(),x=v.getBoundingClientRect();let y;if(l){const w=n==="horizontal"?new DOMRect(_.right,_.top,0,_.height):new DOMRect(_.left,_.bottom,_.width,0),k=n==="horizontal"?new DOMRect(x.left,x.top,0,x.height):new DOMRect(x.left,x.top,x.width,0);switch(p.length){case 0:{y=[w,k];break}case 1:{const C=p[0],N=NU({orientation:n,rects:[_,x],targetRect:C.element.getBoundingClientRect()});y=[C,N===_?k:w];break}default:{y=p;break}}}else p.length?y=p:y=[n==="horizontal"?new DOMRect(_.right,x.top,x.left-_.right,x.height):new DOMRect(x.left,_.bottom,x.width,x.top-_.bottom)];for(const w of y){let k="width"in w?w:w.element.getBoundingClientRect();const C=TU()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(k.width<C){const T=C-k.width;k=new DOMRect(k.x-T/2,k.y,k.width+T,k.height)}if(k.height<C){const T=C-k.height;k=new DOMRect(k.x,k.y-T/2,k.width,k.height+T)}const N=m<=c||m>u;!a&&!N&&o.push({group:e,groupSize:Ua({group:e}),panels:[f,b],separator:"width"in w?void 0:w,rect:k}),a=!1}}l=!1,f=b,p=[]}}else if(v.hasAttribute("data-separator")){v.ariaDisabled!==null&&(a=!0);const b=i.find(_=>_.element===v);b?p.push(b):(f=void 0,p=[])}else l=!0}return o}var cs;class fR{constructor(){m1(this,cs,{})}addListener(t,n){const r=wl(this,cs)[t];return r===void 0?wl(this,cs)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=wl(this,cs)[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(){g1(this,cs,{})}removeListener(t,n){const r=wl(this,cs)[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}cs=new WeakMap;let Ea={cursorFlags:0,state:"inactive"};const py=new fR;function xo(){return Ea}function PU(e){return py.addListener("change",e)}function IU(e){const t=Ea,n={...Ea};n.cursorFlags=e,Ea=n,py.emit("change",{prev:t,next:n})}function Na(e){const t=Ea;Ea=e,py.emit("change",{prev:t,next:e})}const RU=e=>e,Om=()=>{},pR=1,mR=2,gR=4,vR=8,uS=3,dS=12;let xd;function hS(){return xd===void 0&&(xd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(xd=!0)),xd}function MU({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&&hS()){const s=(e&pR)!==0,o=(e&mR)!==0,a=(e&gR)!==0,l=(e&vR)!==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 hS()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}const fS=new WeakMap;function my(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=fS.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=xo();switch(r.state){case"active":case"hover":{const i=MU({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}}fS.set(e,{prevStyle:t,styleSheet:n})}let Xr=new Map;const _R=new fR;function AU(e){Xr=new Map(Xr),Xr.delete(e)}function pS(e,t){for(const[n]of Xr)if(n.id===e)return n}function Ss(e,t){for(const[n,r]of Xr)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function jo(){return Xr}function gy(e,t){return _R.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Di(e,t,n){const r=Xr.get(e);Xr=new Map(Xr),Xr.set(e,t),_R.emit("groupChange",{group:e,isUserInteraction:(n==null?void 0:n.isUserInteraction)===!0,prev:r,next:t})}function xR(e){const t=xo();let n=!1;switch(t.state){case"active":Na({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(my(e),n=!0,t.hitRegions.forEach(r=>{const i=Ss(r.group.id,!0);Di(r.group,i,{isUserInteraction:!0})}))}return n}function mS(e){e.defaultPrevented||xR(e.currentTarget)}function LU(e,t,n){let r,i={x:1/0,y:1/0};for(const s of t){const o=dR(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 jU(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function DU(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:_S(e),b:_S(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();rt(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:vS(gS(n.a)),b:vS(gS(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 OU=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function BU(e){const t=getComputedStyle(yR(e)??e).display;return t==="flex"||t==="inline-flex"}function zU(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||BU(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"||OU.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function gS(e){let t=e.length;for(;t--;){const n=e[t];if(rt(n,"Missing node"),zU(n))return n}return null}function vS(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _S(e){const t=[];for(;e;)t.push(e),e=yR(e);return t}function yR(e){const{parentNode:t}=e;return jU(t)?t.host:t}function $U(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 FU({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!uR(n)||n.contains(e)||e.contains(n))return!0;if(DU(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if($U(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function vy(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const s=hR(i),o=LU(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=0&&o.distance.y<=0&&FU({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function HU(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 _n(e,t,n=0){return Math.abs(Nn(e)-Nn(t))<=n}function qr(e,t){return _n(e,t)?0:e>t?1:-1}function ma({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(qr(r,l)<0)if(s){const c=(i+l)/2;qr(r,c)<0?r=i:r=l}else r=l;return r=Math.min(a,r),r=Nn(r),r}function Jc({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:s}){if(_n(e,0))return t;const o=s==="imperative-api",a=Object.values(t),l=Object.values(i),c=[...a],[u,d]=r;rt(u!=null,"Invalid first pivot index"),rt(d!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const v=e<0?d:u,b=n[v];rt(b,`Panel constraints not found for index ${v}`);const{collapsedSize:_=0,collapsible:x,minSize:y=0}=b;if(x){const w=a[v];if(rt(w!=null,`Previous layout not found for panel index ${v}`),_n(w,_)){const k=y-w;qr(k,Math.abs(e))>0&&(e=e<0?0-k:k)}}}{const v=e<0?u:d,b=n[v];rt(b,`No panel constraints found for index ${v}`);const{collapsedSize:_=0,collapsible:x,minSize:y=0}=b;if(x){const w=a[v];if(rt(w!=null,`Previous layout not found for panel index ${v}`),_n(w,y)){const k=w-_;qr(k,Math.abs(e))>0&&(e=e<0?0-k:k)}}}break}default:{const v=e<0?d:u,b=n[v];rt(b,`Panel constraints not found for index ${v}`);const _=a[v],{collapsible:x,collapsedSize:y,minSize:w}=b;if(x&&qr(_,w)<0)if(e>0){const k=w-y,C=k/2,N=_+e;qr(N,w)<0&&(e=qr(e,C)<=0?0:k)}else{const k=w-y,C=100-k/2,N=_-e;qr(N,w)<0&&(e=qr(100+e,C)>0?0:-k)}break}}{const v=e<0?1:-1;let b=e<0?d:u,_=0;for(;;){const y=a[b];rt(y!=null,`Previous layout not found for panel index ${b}`);const w=ma({overrideDisabledPanels:o,panelConstraints:n[b],prevSize:y,size:100})-y;if(_+=w,b+=v,b<0||b>=n.length)break}const x=Math.min(Math.abs(e),Math.abs(_));e=e<0?0-x:x}{let v=e<0?u:d;for(;v>=0&&v<n.length;){const b=Math.abs(e)-Math.abs(f),_=a[v];rt(_!=null,`Previous layout not found for panel index ${v}`);const x=_-b,y=ma({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:_,size:x});if(!_n(_,y)&&(f+=_-y,c[v]=y,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if(HU(l,c))return i;{const v=e<0?d:u,b=a[v];rt(b!=null,`Previous layout not found for panel index ${v}`);const _=b+f,x=ma({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:b,size:_});if(c[v]=x,!_n(x,_)){let y=_-x,w=e<0?d:u;for(;w>=0&&w<n.length;){const k=c[w];rt(k!=null,`Previous layout not found for panel index ${w}`);const C=k+y,N=ma({overrideDisabledPanels:o,panelConstraints:n[w],prevSize:k,size:C});if(_n(k,N)||(y-=N-k,c[w]=N),_n(y,0))break;e>0?w--:w++}}}const p=Object.values(c).reduce((v,b)=>b+v,0);if(!_n(p,100,.1))return i;const m=Object.keys(i);return c.reduce((v,b,_)=>(v[m[_]]=b,v),{})}function yo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||qr(e[n],t[n])!==0)return!1;return!0}function bo({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(!_n(i,100)&&r.length>0)for(let a=0;a<t.length;a++){const l=r[a];rt(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];rt(l!=null,`No layout data found for index ${a}`);const c=r[a];rt(c!=null,`No layout data found for index ${a}`);const u=ma({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});c!=u&&(s+=c-u,r[a]=u)}if(!_n(s,0))for(let a=0;a<t.length;a++){const l=r[a];rt(l!=null,`No layout data found for index ${a}`);const c=l+s,u=ma({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});if(l!==u&&(s-=u-l,r[a]=u,_n(s,0)))break}const o=Object.keys(e);return r.reduce((a,l,c)=>(a[o[c]]=l,a),{})}function bR({groupId:e,panelId:t}){const n=()=>{const l=jo();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(b=>b.id===t),m=p===0,v=p===c.length-1;if(v&&l<f&&(m||c.slice(0,p).every((b,_)=>{const x=d[_];return(x==null?void 0:x.collapsible)&&_n(x.collapsedSize,u[x.panelId])}))){const b=c.slice(0,p).reduce((_,x)=>_+u[x.id],0);return{...u,[t]:Nn(100-b)}}return Jc({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(),b=o({nextSize:l,panels:f.panels,prevLayout:m,derivedPanelConstraints:d}),_=bo({layout:b,panelConstraints:d});yo(m,_)||Di(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:p,layout:_,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&&_n(c,u)},resize:l=>{const{group:c}=n(),{element:u}=i(),d=Ua({group:c}),f=Yl({groupSize:d,panelElement:u,styleProp:l}),p=Nn(f/d*100);a(p)}}}function xS(e){if(e.defaultPrevented)return;const t=jo();vy(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=bR({groupId:n.group.id,panelId:r.id});s&&i!==void 0&&(s.resize(i),e.preventDefault())}}})}function eh(e){const t=jo();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 wR({groupId:e}){const t=()=>{const n=jo();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=bo({layout:n,panelConstraints:i});return r?a:(yo(a,c)||Di(s,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:o,layout:c,separatorToPanels:l}),c)}}}function Us(e,t){const n=eh(e),r=Ss(n.id,!0),i=n.separators.find(u=>u.element===e);rt(i,"Matching separator not found");const s=r.separatorToPanels.get(i);rt(s,"Matching panels not found");const o=s.map(u=>n.panels.indexOf(u)),a=wR({groupId:n.id}).getLayout(),l=Jc({delta:t,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:a,trigger:"keyboard"}),c=bo({layout:l,panelConstraints:r.derivedPanelConstraints});yo(a,c)||Di(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function yS(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=eh(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Us(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Us(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Us(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Us(t,-5);break}case"End":{e.preventDefault(),Us(t,100);break}case"Enter":{e.preventDefault();const r=eh(t),i=Ss(r.id,!0),{derivedPanelConstraints:s,layout:o,separatorToPanels:a}=i,l=r.separators.find(f=>f.element===t);rt(l,"Matching separator not found");const c=a.get(l);rt(c,"Matching panels not found");const u=c[0],d=s.find(f=>f.panelId===u.id);if(rt(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;Us(t,p-f)}break}case"F6":{e.preventDefault();const r=eh(t).separators.map(o=>o.element),i=Array.from(r).findIndex(o=>o===e.currentTarget);rt(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(),Us(t,-100);break}}}function bS(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=jo(),n=vy(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)}),Na({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function SR({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 b=r.get(u),_=i.get(u);if(!b||!_)return;const{defaultLayoutDeferred:x,derivedPanelConstraints:y,groupSize:w,layout:k,separatorToPanels:C}=_;if(y&&k&&C){const N=Jc({delta:v,initialLayout:b,panelConstraints:y,pivotIndices:c.panels.map(T=>p.indexOf(T)),prevLayout:k,trigger:"mouse-or-touch"});if(yo(N,k)){if(v!==0&&!m)switch(f){case"horizontal":{a|=v<0?pR:mR;break}case"vertical":{a|=v<0?gR:vR;break}}}else Di(c.group,{defaultLayoutDeferred:x,derivedPanelConstraints:y,groupSize:w,layout:N,separatorToPanels:C})}});let l=0;t.movementX===0?l|=o&uS:l|=a&uS,t.movementY===0?l|=o&dS:l|=a&dS,IU(l),my(e)}function wS(e){const t=jo(),n=xo();switch(n.state){case"active":SR({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function SS(e){var r,i;if(e.defaultPrevented)return;const t=xo(),n=jo();switch(t.state){case"active":{if(e.buttons===0){Na({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{const o=Ss(s.group.id,!0);Di(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))}SR({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=vy(e,n);s.length===0?t.state!=="inactive"&&Na({cursorFlags:0,state:"inactive"}):Na({cursorFlags:0,hitRegions:s,state:"hover"}),my(e.currentTarget);break}}}function kS(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(xo().state){case"hover":Na({cursorFlags:0,state:"inactive"})}}function CS(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||xR(e.currentTarget)&&e.preventDefault()}function ES(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const o=Nn(s.defaultSize);n+=o,r[s.panelId]=o}else r[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=Nn((100-n)/i);for(const o of e)o.defaultSize===void 0&&(r[o.panelId]=s)}return r}function UU(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const i=Ua({group:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,a={asPercentage:Nn(s/i*100),inPixels:s};r.mutableValues.prevSize=a,r.onResize(a,r.id,o)}function WU(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 VU({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=Nn(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]=Nn(f/s*c)}else{const d=Nn(c/l.length);for(const f of l)u[f]=d}return u}function qU(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 Go=new Map;function KU(e){let t=!0;rt(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:b,target:_}=v;if(_===e.element){if(t){const x=Ua({group:e});if(x===0)return;const y=Ss(e.id);if(!y)return;const w=_0(e),k=y.defaultLayoutDeferred?ES(w):y.layout,C=VU({group:e,nextGroupSize:x,prevGroupSize:y.groupSize,prevLayout:k}),N=bo({layout:C,panelConstraints:w});if(!y.defaultLayoutDeferred&&yo(y.layout,N)&&WU(y.derivedPanelConstraints,w)&&y.groupSize===x)return;Di(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:w,groupSize:x,layout:N,separatorToPanels:y.separatorToPanels})}}else UU(e,_,b)}});s.observe(e.element),e.panels.forEach(m=>{rt(!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=Ua({group:e}),a=_0(e),l=e.panels.map(({id:m})=>m).join(",");let c=e.mutableState.defaultLayout;c&&(qU(e.panels,c)||(c=void 0));const u=e.mutableState.layouts[l]??c??ES(a),d=bo({layout:u,panelConstraints:a}),f=e.element.ownerDocument;Go.set(f,(Go.get(f)??0)+1);const p=new Map;return hR(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),Di(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:a,groupSize:o,layout:d,separatorToPanels:p}),e.separators.forEach(m=>{rt(!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",yS)}),Go.get(f)===1&&(f.addEventListener("contextmenu",mS,!0),f.addEventListener("dblclick",xS,!0),f.addEventListener("pointerdown",bS,!0),f.addEventListener("pointerleave",wS),f.addEventListener("pointermove",SS),f.addEventListener("pointerout",kS),f.addEventListener("pointerup",CS,!0)),function(){t=!1,Go.set(f,Math.max(0,(Go.get(f)??0)-1)),AU(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",yS)}),Go.get(f)||(f.removeEventListener("contextmenu",mS,!0),f.removeEventListener("dblclick",xS,!0),f.removeEventListener("pointerdown",bS,!0),f.removeEventListener("pointerleave",wS),f.removeEventListener("pointermove",SS),f.removeEventListener("pointerout",kS),f.removeEventListener("pointerup",CS,!0)),s.disconnect()}}function GU(){const[e,t]=g.useState({}),n=g.useCallback(()=>t({}),[]);return[e,n]}function _y(e){const t=g.useId();return`${e??t}`}const Do=typeof window<"u"?g.useLayoutEffect:g.useEffect;function mc(e){const t=g.useRef(e);return Do(()=>{t.current=e},[e]),g.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function xy(...e){return mc(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function yy(e){const t=g.useRef({...e});return Do(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const kR=g.createContext(null);function YU(e,t){const n=g.useRef({getLayout:()=>({}),setLayout:RU});g.useImperativeHandle(t,()=>n.current,[]),Do(()=>{Object.assign(n.current,wR({groupId:e}))})}function by({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=mc(A=>{yo(m.current.onLayoutChange,A)||(m.current.onLayoutChange=A,l==null||l(A))}),b=mc((A,I)=>{yo(m.current.onLayoutChanged,A)||(m.current.onLayoutChanged=A,c==null||c(A,{isUserInteraction:I}))}),_=_y(a),x=g.useRef(null),[y,w]=GU(),k=g.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),C=xy(x,s);YU(_,o);const N=mc((A,I)=>{const R=xo(),j=pS(A),z=Ss(A);if(z){let $=!1;switch(R.state){case"active":{$=R.hitRegions.some(F=>F.group===j);break}}return{flexGrow:z.layout[I]??1,pointerEvents:$?"none":void 0}}if(n!=null&&n[I])return{flexGrow:n==null?void 0:n[I]}}),T=yy({defaultLayout:n,disableCursor:r}),B=g.useMemo(()=>({get disableCursor(){return!!T.disableCursor},getPanelStyles:N,id:_,orientation:u,registerPanel:A=>{const I=k.current;return I.panels=x0(u,[...I.panels,A]),w(),()=>{I.panels=I.panels.filter(R=>R!==A),w()}},registerSeparator:A=>{const I=k.current;return I.separators=x0(u,[...I.separators,A]),w(),()=>{I.separators=I.separators.filter(R=>R!==A),w()}},updatePanelProps:(A,{disabled:I})=>{const R=k.current.panels.find($=>$.id===A);R&&(R.panelConstraints.disabled=I);const j=pS(_),z=Ss(_);j&&z&&Di(j,{...z,derivedPanelConstraints:_0(j)})},updateSeparatorProps:(A,{disabled:I,disableDoubleClick:R})=>{const j=k.current.separators.find(z=>z.id===A);j&&(j.disabled=I,j.disableDoubleClick=R)}}),[N,_,w,u,T]),P=g.useRef(null);return Do(()=>{const A=x.current;if(A===null)return;const I=k.current;let R;if(T.defaultLayout!==void 0&&Object.keys(T.defaultLayout).length===I.panels.length){R={};for(const E of I.panels){const H=T.defaultLayout[E.id];H!==void 0&&(R[E.id]=H)}}const j={disabled:!!i,element:A,id:_,mutableState:{defaultLayout:R,disableCursor:!!T.disableCursor,expandedPanelSizes:k.current.lastExpandedPanelSizes,layouts:k.current.layouts},orientation:u,panels:I.panels,resizeTargetMinimumSize:I.resizeTargetMinimumSize,separators:I.separators};P.current=j;const z=KU(j),{defaultLayoutDeferred:$,derivedPanelConstraints:F,layout:D}=Ss(j.id,!0);!$&&F.length>0&&(v(D),b(D,!1));const O=gy(_,E=>{const{defaultLayoutDeferred:H,derivedPanelConstraints:V,layout:L}=E.next;if(H||V.length===0)return;const ne=j.panels.map(({id:G})=>G).join(",");j.mutableState.layouts[ne]=L,V.forEach(G=>{if(G.collapsible){const{layout:ye}=E.prev??{};if(ye){const Fe=_n(G.collapsedSize,L[G.panelId]),ue=_n(G.collapsedSize,ye[G.panelId]);Fe&&!ue&&(j.mutableState.expandedPanelSizes[G.panelId]=ye[G.panelId])}}});const ae=xo().state!=="active";v(L),ae&&b(L,E.isUserInteraction)});return()=>{P.current=null,z(),O()}},[i,_,b,v,u,y,T]),g.useEffect(()=>{const A=P.current;A&&(A.mutableState.defaultLayout=n,A.mutableState.disableCursor=!!r)}),h.jsx(kR.Provider,{value:B,children:h.jsx("div",{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:C,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})})}by.displayName="Group";function wy(){const e=g.useContext(kR);return rt(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function XU(e,t){const{id:n}=wy(),r=g.useRef({collapse:Om,expand:Om,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Om});g.useImperativeHandle(t,()=>r.current,[]),Do(()=>{Object.assign(r.current,bR({groupId:n,panelId:e}))})}function tf({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,b=_y(l),_=yy({disabled:s}),x=g.useRef(null),y=xy(x,o),{getPanelStyles:w,id:k,orientation:C,registerPanel:N,updatePanelProps:T}=wy(),B=d!==null,P=mc((j,z,$)=>{d==null||d(j,l,$)});Do(()=>{const j=x.current;if(j!==null){const z={element:j,id:b,idIsStable:v,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:B?P:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:c,minSize:u}};return N(z)}},[a,n,r,i,B,b,v,c,u,P,N,_]),g.useEffect(()=>{T(b,{disabled:s})},[s,b,T]),XU(b,f);const A=()=>{const j=w(k,b);if(j)return JSON.stringify(j)},I=g.useSyncExternalStore(j=>gy(k,j),A,A);let R;return I?R=JSON.parse(I):i!==void 0?R={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:R={flexGrow:1},h.jsx("div",{...m,"data-disabled":s||void 0,"data-panel":!0,"data-testid":b,id:b,ref:y,style:{...QU,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...R},children:h.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:C==="horizontal"?"pan-y":"pan-x"},children:e})})}tf.displayName="Panel";const QU={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function ZU({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=bo({layout:Jc({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=bo({layout:Jc({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:o}}function CR({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:s,style:o,...a}){const l=_y(s),c=yy({disabled:n,disableDoubleClick:r}),[u,d]=g.useState({}),[f,p]=g.useState("inactive"),[m,v]=g.useState(!1),b=g.useRef(null),_=xy(b,i),{disableCursor:x,id:y,orientation:w,registerSeparator:k,updateSeparatorProps:C}=wy(),N=w==="horizontal"?"vertical":"horizontal";Do(()=>{const P=b.current;if(P!==null){const A={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:P,id:l},I=k(A),R=PU(z=>{p(z.next.state!=="inactive"&&z.next.hitRegions.some($=>$.separator===A)?z.next.state:"inactive")}),j=gy(y,z=>{const{derivedPanelConstraints:$,layout:F,separatorToPanels:D}=z.next,O=D.get(A);if(O){const E=O[0],H=O.indexOf(E);d(ZU({layout:F,panelConstraints:$,panelId:E.id,panelIndex:H}))}});return()=>{R(),j(),I()}}},[y,l,k,c]),g.useEffect(()=>{C(l,{disabled:n,disableDoubleClick:r})},[n,r,l,C]);let T;n&&!x&&(T="not-allowed");let B;if(n)B="disabled";else switch(f){case"active":{B="active";break}default:m?B="focus":B=f}return h.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":N,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":B,"data-testid":l,id:l,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:_,role:"separator",style:{flexBasis:"auto",cursor:T,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}CR.displayName="Separator";function JU(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 eW(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 tW=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function nW(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(tW);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))}const rW=["TaskCreate","TaskUpdate","TaskList","TaskGet"];function iW(e){return rW.includes(e)}function ER(e){return e==="in_progress"||e==="completed"?e:"pending"}function sW(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:ER(n.status),activeForm:i,description:s}]}function oW(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=ER(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 aW(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=sW(t,i.input);break;case"TaskUpdate":t=oW(t,i.input);break}}return{tasks:t,lastEventIndex:n}}function lW(e){const{tasks:t,lastEventIndex:n}=aW(e);let r=-1;for(let c=e.length-1;c>=0;c--)if(e[c].kind==="todo-checklist"){r=c;break}const i=[],s=new Map,o=new Map,a=new Map,l=(c,u)=>{var f,p,m;const d={agentId:u.agentId,status:u.status};u.description?d.description=u.description:(f=c.progress)!=null&&f.description&&(d.description=c.progress.description),u.lastToolName?d.lastToolName=u.lastToolName:(p=c.progress)!=null&&p.lastToolName&&(d.lastToolName=c.progress.lastToolName),u.stats?d.stats=u.stats:(m=c.progress)!=null&&m.stats&&(d.stats=c.progress.stats),c.progress=d};for(let c=0;c<e.length;c++){const u=e[c];switch(u.kind){case"tool-call":{const d={kind:"merged-tool",seq:u.seq,tool:u.tool,toolKind:u.toolKind,toolUseId:u.toolUseId,input:u.input,pending:!0};s.set(u.toolUseId,i.length),i.push(d);break}case"tool-result":{const d=s.get(u.toolUseId);if(d!==void 0){const p=i[d];p.output=u.output,p.error=u.error,p.pending=!1,s.delete(u.toolUseId);break}const f=o.get(u.toolUseId);if(f!==void 0){const p=i[f];p.output=u.output,p.error=u.error,p.pending=!1,u.toolResultExtra&&(p.toolResultExtra=u.toolResultExtra);break}break}case"agent-call":{const d={kind:"merged-agent",seq:u.seq,toolUseId:u.toolUseId,description:u.description,input:u.input,pending:!0,notifications:[]};o.set(u.toolUseId,i.length),i.push(d);const f=a.get(u.toolUseId);f&&(l(d,f),a.delete(u.toolUseId));break}case"agent-progress":{const d=o.get(u.toolUseId);if(d!==void 0){l(i[d],u);break}a.set(u.toolUseId,u);break}case"agent-notification":{const d=u.parentToolUseId;if(d){const f=o.get(d);if(f!==void 0){i[f].notifications.push({text:u.text,taskId:u.taskId});break}}i.push({kind:"agent-notification",seq:u.seq,text:u.text,taskId:u.taskId,parentToolUseId:u.parentToolUseId});break}case"todo-checklist":{c===r&&u.todos.length>0&&i.push({kind:"todo-checklist",seq:u.seq,toolUseId:u.toolUseId,todos:u.todos});break}case"task-event":{c===n&&t.length>0&&i.push({kind:"plan-card",seq:u.seq,tasks:t});break}default:i.push(u)}}return i}const cW=new Set(["permission-inline","question-card"]);function uW(e){return e.kind==="user-text"?!0:e.kind==="user-meta"&&e.metaKind==="slash-command"}function dW(e){return e.kind==="user-text"&&e.continuesTurn===!0}function hW(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(fW(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,!0);continue}if(uW(s)&&(r===null||!dW(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 fW(e,t,n){const{query:r,body:i}=e,s=pW(i,t,n),o=mW(i,s),a=vW(i,o),l=r??i[0]??t,c={kind:"turn",seq:l?l.seq:0,status:s,process:a,tail:o};return r&&(c.query=r),(t==null?void 0:t.durationMs)!==void 0&&(c.durationMs=t.durationMs),c}function pW(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=y0(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function mW(e,t){if(t==="running"){const i=[];for(let s=e.length-1;s>=0&&cW.has(e[s].kind);s--)i.unshift(e[s]);return i}const n=[];e.forEach((i,s)=>{i.kind==="merged-agent"&&i.pending&&n.push(s)});const r=t==="error"?y0(e,i=>i.kind==="error"):y0(e,i=>i.kind==="assistant-text");return r>=0&&n.push(r),n.sort((i,s)=>i-s).map(i=>e[i])}const gW=new Set(["assistant-thinking","user-meta"]);function vW(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(gW.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function y0(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const _W={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function xW(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 NR(e){const t=_W[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=xW(e.input);return r?`${n} ${r}`:n}function yW({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?ir:Un,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:fe("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(In,{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:NR(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 bW({items:e,defaultExpanded:t=!1,renderItemDetail:n}){const[r,i]=g.useState(t);if(e.length===0)return null;const s=e.some(c=>c.pending),o=s?[...e].reverse().find(c=>c.pending):e[e.length-1],a=!s&&e.length>1?` 等 ${e.length} 项`:"",l=r?ir:Un;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>i(c=>!c),"aria-expanded":r,"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:[s&&!r?h.jsx(In,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(l,{className:"w-3.5 h-3.5 shrink-0"}),r?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:s?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:fe("truncate min-w-0",s&&"text-text-300"),children:[NR(o),a]})]}),r?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(c=>h.jsx(yW,{item:c,renderItemDetail:n},c.toolUseId))}):null]})}function wW(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 SW(e,t){const n=t!==void 0?`耗时 ${wW(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function kW({status:e="done",durationMs:t,defaultExpanded:n=!1,children:r}){const[i,s]=g.useState(n),o=i?ir:Un;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:()=>s(a=>!a),"aria-expanded":i,"data-testid":"turn-process-block-header",className:fe("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:SW(e,t)}),h.jsx(o,{className:"w-3.5 h-3.5 shrink-0"})]}),i?h.jsx("div",{"data-testid":"turn-process-body",className:"mt-2 flex flex-col gap-2 border-l-2 border-border pl-3",children:r}):null]})}const CW=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,EW=/<builder-preview\b[^>]*\/>/gi;function TR(e){return e?e.replace(CW,"").replace(EW,"").trim():""}const NW=TR;function TW(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const PW=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,IW=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,RW={};function NS(e,t){return(RW.jsx?IW:PW).test(e)}const MW=/[ \t\n\f\r]/g;function AW(e){return typeof e=="object"?e.type==="text"?TS(e.value):!1:TS(e)}function TS(e){return e.replace(MW,"")===""}class Cu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Cu.prototype.normal={};Cu.prototype.property={};Cu.prototype.space=void 0;function PR(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Cu(n,r,t)}function b0(e){return e.toLowerCase()}class Wn{constructor(t,n){this.attribute=n,this.property=t}}Wn.prototype.attribute="";Wn.prototype.booleanish=!1;Wn.prototype.boolean=!1;Wn.prototype.commaOrSpaceSeparated=!1;Wn.prototype.commaSeparated=!1;Wn.prototype.defined=!1;Wn.prototype.mustUseProperty=!1;Wn.prototype.number=!1;Wn.prototype.overloadedBoolean=!1;Wn.prototype.property="";Wn.prototype.spaceSeparated=!1;Wn.prototype.space=void 0;let LW=0;const Me=Oo(),At=Oo(),w0=Oo(),Q=Oo(),at=Oo(),Ta=Oo(),Gn=Oo();function Oo(){return 2**++LW}const S0=Object.freeze(Object.defineProperty({__proto__:null,boolean:Me,booleanish:At,commaOrSpaceSeparated:Gn,commaSeparated:Ta,number:Q,overloadedBoolean:w0,spaceSeparated:at},Symbol.toStringTag,{value:"Module"})),Bm=Object.keys(S0);class Sy extends Wn{constructor(t,n,r,i){let s=-1;if(super(t,n),PS(this,"space",i),typeof r=="number")for(;++s<Bm.length;){const o=Bm[s];PS(this,Bm[s],(r&S0[o])===S0[o])}}}Sy.prototype.defined=!0;function PS(e,t,n){n&&(e[t]=n)}function fl(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Sy(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[b0(r)]=r,n[b0(s.attribute)]=r}return new Cu(t,n,e.space)}const IR=fl({properties:{ariaActiveDescendant:null,ariaAtomic:At,ariaAutoComplete:null,ariaBusy:At,ariaChecked:At,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:at,ariaCurrent:null,ariaDescribedBy:at,ariaDetails:null,ariaDisabled:At,ariaDropEffect:at,ariaErrorMessage:null,ariaExpanded:At,ariaFlowTo:at,ariaGrabbed:At,ariaHasPopup:null,ariaHidden:At,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:at,ariaLevel:Q,ariaLive:null,ariaModal:At,ariaMultiLine:At,ariaMultiSelectable:At,ariaOrientation:null,ariaOwns:at,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:At,ariaReadOnly:At,ariaRelevant:null,ariaRequired:At,ariaRoleDescription:at,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:At,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function RR(e,t){return t in e?e[t]:t}function MR(e,t){return RR(e,t.toLowerCase())}const jW=fl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ta,acceptCharset:at,accessKey:at,action:null,allow:null,allowFullScreen:Me,allowPaymentRequest:Me,allowUserMedia:Me,alt:null,as:null,async:Me,autoCapitalize:null,autoComplete:at,autoFocus:Me,autoPlay:Me,blocking:at,capture:null,charSet:null,checked:Me,cite:null,className:at,cols:Q,colSpan:null,content:null,contentEditable:At,controls:Me,controlsList:at,coords:Q|Ta,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Me,defer:Me,dir:null,dirName:null,disabled:Me,download:w0,draggable:At,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Me,formTarget:null,headers:at,height:Q,hidden:w0,high:Q,href:null,hrefLang:null,htmlFor:at,httpEquiv:at,id:null,imageSizes:null,imageSrcSet:null,inert:Me,inputMode:null,integrity:null,is:null,isMap:Me,itemId:null,itemProp:at,itemRef:at,itemScope:Me,itemType:at,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Me,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:Me,muted:Me,name:null,nonce:null,noModule:Me,noValidate:Me,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:Me,optimum:Q,pattern:null,ping:at,placeholder:null,playsInline:Me,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Me,referrerPolicy:null,rel:at,required:Me,reversed:Me,rows:Q,rowSpan:Q,sandbox:at,scope:null,scoped:Me,seamless:Me,selected:Me,shadowRootClonable:Me,shadowRootDelegatesFocus:Me,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:At,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:Me,useMap:null,value:At,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:at,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Me,declare:Me,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:Me,noHref:Me,noShade:Me,noWrap:Me,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:At,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Me,disableRemotePlayback:Me,prefix:null,property:null,results:Q,security:null,unselectable:null},space:"html",transform:MR}),DW=fl({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:Gn,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:at,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:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:Me,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,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:Ta,g2:Ta,glyphName:Ta,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:Gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,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:Q,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:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:at,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,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:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:Gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gn,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:RR}),AR=fl({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()}}),LR=fl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:MR}),jR=fl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),OW={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"},BW=/[A-Z]/g,IS=/-[a-z]/g,zW=/^data[-\w.:]+$/i;function $W(e,t){const n=b0(t);let r=t,i=Wn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&zW.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(IS,HW);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!IS.test(s)){let o=s.replace(BW,FW);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Sy}return new i(r,t)}function FW(e){return"-"+e.toLowerCase()}function HW(e){return e.charAt(1).toUpperCase()}const UW=PR([IR,jW,AR,LR,jR],"html"),ky=PR([IR,DW,AR,LR,jR],"svg");function WW(e){return e.join(" ").trim()}var Cy={},RS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,VW=/\n/g,qW=/^\s*/,KW=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,GW=/^:\s*/,YW=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,XW=/^[;\s]*/,QW=/^\s+|\s+$/g,ZW=`
|
|
476
476
|
`,MS="/",AS="*",Qs="",JW="comment",eV="declaration";function tV(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(VW);v&&(n+=v.length);var b=m.lastIndexOf(ZW);r=~b?m.length-b: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 b=v[0];return i(b),e=e.slice(b.length),v}}function c(){l(qW)}function u(m){var v;for(m=m||[];v=d();)v!==!1&&m.push(v);return m}function d(){var m=s();if(!(MS!=e.charAt(0)||AS!=e.charAt(1))){for(var v=2;Qs!=e.charAt(v)&&(AS!=e.charAt(v)||MS!=e.charAt(v+1));)++v;if(v+=2,Qs===e.charAt(v-1))return a("End of comment missing");var b=e.slice(2,v-2);return r+=2,i(b),e=e.slice(v),r+=2,m({type:JW,comment:b})}}function f(){var m=s(),v=l(KW);if(v){if(d(),!l(GW))return a("property missing ':'");var b=l(YW),_=m({type:eV,property:LS(v[0].replace(RS,Qs)),value:b?LS(b[0].replace(RS,Qs)):Qs});return l(XW),_}}function p(){var m=[];u(m);for(var v;v=f();)v!==!1&&(m.push(v),u(m));return m}return c(),p()}function LS(e){return e?e.replace(QW,Qs):Qs}var nV=tV,rV=ch&&ch.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Cy,"__esModule",{value:!0});Cy.default=sV;const iV=rV(nV);function sV(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,iV.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 _p={};Object.defineProperty(_p,"__esModule",{value:!0});_p.camelCase=void 0;var oV=/^--[a-zA-Z0-9_-]+$/,aV=/-([a-z])/g,lV=/^[^-]+$/,cV=/^-(webkit|moz|ms|o|khtml)-/,uV=/^-(ms)-/,dV=function(e){return!e||lV.test(e)||oV.test(e)},hV=function(e,t){return t.toUpperCase()},jS=function(e,t){return"".concat(t,"-")},fV=function(e,t){return t===void 0&&(t={}),dV(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(uV,jS):e=e.replace(cV,jS),e.replace(aV,hV))};_p.camelCase=fV;var pV=ch&&ch.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},mV=pV(Cy),gV=_p;function k0(e,t){var n={};return!e||typeof e!="string"||(0,mV.default)(e,function(r,i){r&&i&&(n[(0,gV.camelCase)(r,t)]=i)}),n}k0.default=k0;var vV=k0;const _V=lu(vV),DR=OR("end"),Ey=OR("start");function OR(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 xV(e){const t=Ey(e),n=DR(e);if(t&&n)return{start:t,end:n}}function gc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?DS(e.position):"start"in e||"end"in e?DS(e):"line"in e||"column"in e?C0(e):""}function C0(e){return OS(e&&e.line)+":"+OS(e&&e.column)}function DS(e){return C0(e&&e.start)+"-"+C0(e&&e.end)}function OS(e){return e&&typeof e=="number"?e:1}class Sn 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=gc(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}}Sn.prototype.file="";Sn.prototype.name="";Sn.prototype.reason="";Sn.prototype.message="";Sn.prototype.stack="";Sn.prototype.column=void 0;Sn.prototype.line=void 0;Sn.prototype.ancestors=void 0;Sn.prototype.cause=void 0;Sn.prototype.fatal=void 0;Sn.prototype.place=void 0;Sn.prototype.ruleId=void 0;Sn.prototype.source=void 0;const Ny={}.hasOwnProperty,yV=new Map,bV=/[A-Z]/g,wV=new Set(["table","tbody","thead","tfoot","tr"]),SV=new Set(["td","th"]),BR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function kV(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=MV(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=RV(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"?ky:UW,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=zR(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function zR(e,t,n){if(t.type==="element")return CV(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return EV(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return TV(e,t,n);if(t.type==="mdxjsEsm")return NV(e,t);if(t.type==="root")return PV(e,t,n);if(t.type==="text")return IV(e,t)}function CV(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=ky,e.schema=i),e.ancestors.push(t);const s=FR(e,t.tagName,!1),o=AV(e,t);let a=Py(e,t);return wV.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!AW(l):!0})),$R(e,o,s,t),Ty(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function EV(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)}eu(e,t.position)}function NV(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);eu(e,t.position)}function TV(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=ky,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:FR(e,t.name,!0),o=LV(e,t),a=Py(e,t);return $R(e,o,s,t),Ty(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function PV(e,t,n){const r={};return Ty(r,Py(e,t)),e.create(t,e.Fragment,r,n)}function IV(e,t){return t.value}function $R(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ty(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function RV(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 MV(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=Ey(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 AV(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Ny.call(t.properties,i)){const s=jV(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&SV.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 LV(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 eu(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 eu(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Py(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:yV;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=zR(e,s,o);a!==void 0&&n.push(a)}return n}function jV(e,t,n){const r=$W(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?TW(n):WW(n)),r.property==="style"){let i=typeof n=="object"?n:DV(e,String(n));return e.stylePropertyNameCase==="css"&&(i=OV(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?OW[r.property]||r.property:r.attribute,n]}}function DV(e,t){try{return _V(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Sn("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=BR+"#cannot-parse-style-attribute",i}}function FR(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=NS(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=NS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Ny.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);eu(e)}function eu(e,t){const n=new Sn("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=BR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function OV(e){const t={};let n;for(n in e)Ny.call(e,n)&&(t[BV(n)]=e[n]);return t}function BV(e){let t=e.replace(bV,zV);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function zV(e){return"-"+e.toLowerCase()}const zm={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"]},$V={};function Iy(e,t){const n=$V,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return HR(e,r,i)}function HR(e,t,n){if(FV(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 BS(e.children,t,n)}return Array.isArray(e)?BS(e,t,n):""}function BS(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=HR(e[i],t,n);return r.join("")}function FV(e){return!!(e&&typeof e=="object")}const zS=document.createElement("i");function Ry(e){const t="&"+e+";";zS.innerHTML=t;const n=zS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function er(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 fr(e,t){return e.length>0?(er(e,e.length,0,t),e):t}const $S={}.hasOwnProperty;function UR(e){const t={};let n=-1;for(;++n<e.length;)HV(t,e[n]);return t}function HV(e,t){let n;for(n in t){const i=($S.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){$S.call(i,o)||(i[o]=[]);const a=s[o];UV(i[o],Array.isArray(a)?a:a?[a]:[])}}}function UV(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);er(e,0,0,r)}function WR(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 Mr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const En=Os(/[A-Za-z]/),yn=Os(/[\dA-Za-z]/),WV=Os(/[#-'*+\--9=?A-Z^-~]/);function nf(e){return e!==null&&(e<32||e===127)}const E0=Os(/\d/),VV=Os(/[\dA-Fa-f]/),qV=Os(/[!-/:-@[-`{-~]/);function be(e){return e!==null&&e<-2}function ot(e){return e!==null&&(e<0||e===32)}function Ue(e){return e===-2||e===-1||e===32}const xp=Os(new RegExp("\\p{P}|\\p{S}","u")),wo=Os(/\s/);function Os(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pl(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&yn(e.charCodeAt(n+1))&&yn(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 Ge(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ue(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ue(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const KV={tokenize:GV};function GV(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"),Ge(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 be(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const YV={tokenize:XV},FS={tokenize:QV};function XV(e){const t=this,n=[];let r=0,i,s,o;return a;function a(y){if(r<n.length){const w=n[r];return t.containerState=w[1],e.attempt(w[0].continuation,l,c)(y)}return c(y)}function l(y){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&x();const w=t.events.length;let k=w,C;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){C=t.events[k][1].end;break}_(r);let N=w;for(;N<t.events.length;)t.events[N][1].end={...C},N++;return er(t.events,k+1,0,t.events.slice(w)),t.events.length=N,c(y)}return a(y)}function c(y){if(r===n.length){if(!i)return f(y);if(i.currentConstruct&&i.currentConstruct.concrete)return m(y);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(FS,u,d)(y)}function u(y){return i&&x(),_(r),f(y)}function d(y){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(y)}function f(y){return t.containerState={},e.attempt(FS,p,m)(y)}function p(y){return r++,n.push([t.currentConstruct,t.containerState]),f(y)}function m(y){if(y===null){i&&x(),_(0),e.consume(y);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),v(y)}function v(y){if(y===null){b(e.exit("chunkFlow"),!0),_(0),e.consume(y);return}return be(y)?(e.consume(y),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(y),v)}function b(y,w){const k=t.sliceStream(y);if(w&&k.push(null),y.previous=s,s&&(s.next=y),s=y,i.defineSkip(y.start),i.write(k),t.parser.lazy[y.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;const N=t.events.length;let T=N,B,P;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(B){P=t.events[T][1].end;break}B=!0}for(_(r),C=N;C<t.events.length;)t.events[C][1].end={...P},C++;er(t.events,T+1,0,t.events.slice(N)),t.events.length=C}}function _(y){let w=n.length;for(;w-- >y;){const k=n[w];t.containerState=k[1],k[0].exit.call(t,e)}n.length=y}function x(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function QV(e,t,n){return Ge(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Wa(e){if(e===null||ot(e)||wo(e))return 1;if(xp(e))return 2}function yp(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 N0={name:"attention",resolveAll:ZV,tokenize:JV};function ZV(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};HS(d,-l),HS(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=fr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=fr(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=fr(c,yp(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=fr(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=fr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,er(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 JV(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Wa(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=Wa(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 HS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const eq={name:"autolink",tokenize:tq};function tq(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 En(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||yn(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||yn(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||nf(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):WV(p)?(e.consume(p),c):n(p)}function u(p){return yn(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||yn(p))&&r++<63){const m=p===45?f:d;return e.consume(p),m}return n(p)}}const Eu={partial:!0,tokenize:nq};function nq(e,t,n){return r;function r(s){return Ue(s)?Ge(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||be(s)?t(s):n(s)}}const VR={continuation:{tokenize:iq},exit:sq,name:"blockQuote",tokenize:rq};function rq(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 Ue(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function iq(e,t,n){const r=this;return i;function i(o){return Ue(o)?Ge(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(VR,t,n)(o)}}function sq(e){e.exit("blockQuote")}const qR={name:"characterEscape",tokenize:oq};function oq(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 qV(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const KR={name:"characterReference",tokenize:aq};function aq(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=yn,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=VV,u):(e.enter("characterReferenceValue"),s=7,o=E0,u(d))}function u(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return o===yn&&!Ry(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 US={partial:!0,tokenize:cq},WS={concrete:!0,name:"codeFenced",tokenize:lq};function lq(e,t,n){const r=this,i={partial:!0,tokenize:k};let s=0,o=0,a;return l;function l(C){return c(C)}function c(C){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(C)}function u(C){return C===a?(o++,e.consume(C),u):o<3?n(C):(e.exit("codeFencedFenceSequence"),Ue(C)?Ge(e,d,"whitespace")(C):d(C))}function d(C){return C===null||be(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(US,v,w)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||be(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(C)):Ue(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ge(e,p,"whitespace")(C)):C===96&&C===a?n(C):(e.consume(C),f)}function p(C){return C===null||be(C)?d(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||be(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(C)):C===96&&C===a?n(C):(e.consume(C),m)}function v(C){return e.attempt(i,w,b)(C)}function b(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),_}function _(C){return s>0&&Ue(C)?Ge(e,x,"linePrefix",s+1)(C):x(C)}function x(C){return C===null||be(C)?e.check(US,v,w)(C):(e.enter("codeFlowValue"),y(C))}function y(C){return C===null||be(C)?(e.exit("codeFlowValue"),x(C)):(e.consume(C),y)}function w(C){return e.exit("codeFenced"),t(C)}function k(C,N,T){let B=0;return P;function P(z){return C.enter("lineEnding"),C.consume(z),C.exit("lineEnding"),A}function A(z){return C.enter("codeFencedFence"),Ue(z)?Ge(C,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):I(z)}function I(z){return z===a?(C.enter("codeFencedFenceSequence"),R(z)):T(z)}function R(z){return z===a?(B++,C.consume(z),R):B>=o?(C.exit("codeFencedFenceSequence"),Ue(z)?Ge(C,j,"whitespace")(z):j(z)):T(z)}function j(z){return z===null||be(z)?(C.exit("codeFencedFence"),N(z)):T(z)}}}function cq(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 $m={name:"codeIndented",tokenize:dq},uq={partial:!0,tokenize:hq};function dq(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Ge(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):be(c)?e.attempt(uq,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||be(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function hq(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):be(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ge(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):be(o)?i(o):n(o)}}const fq={name:"codeText",previous:mq,resolve:pq,tokenize:gq};function pq(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 mq(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function gq(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)):be(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||be(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 vq{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&&Ll(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),Ll(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ll(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);Ll(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ll(this.left,n.reverse())}}}function Ll(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 GR(e){const t={};let n=-1,r,i,s,o,a,l,c;const u=new vq(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,_q(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 er(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function _q(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 b=[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,b.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):b.pop(),f=b.length;f--;){const _=a.slice(b[f],b[f+1]),x=s.pop();l.push([x,x+_.length-1]),e.splice(x,2,_)}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 xq={resolve:bq,tokenize:wq},yq={partial:!0,tokenize:Sq};function bq(e){return GR(e),e}function wq(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):be(a)?e.check(yq,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 Sq(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ge(e,s,"linePrefix")}function s(o){if(o===null||be(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 YR(e,t,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(_){return _===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(_),e.exit(s),f):_===null||_===32||_===41||nf(_)?n(_):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(_))}function f(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===62?(e.exit("chunkString"),e.exit(a),f(_)):_===null||_===60||be(_)?n(_):(e.consume(_),_===92?m:p)}function m(_){return _===60||_===62||_===92?(e.consume(_),p):p(_)}function v(_){return!u&&(_===null||_===41||ot(_))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(_)):u<c&&_===40?(e.consume(_),u++,v):_===41?(e.consume(_),u--,v):_===null||_===32||_===40||nf(_)?n(_):(e.consume(_),_===92?b:v)}function b(_){return _===40||_===41||_===92?(e.consume(_),v):v(_)}}function XR(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):be(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||be(p)||a++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!Ue(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function QR(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):be(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ge(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||be(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 vc(e,t){let n;return r;function r(i){return be(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ue(i)?Ge(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const kq={name:"definition",tokenize:Eq},Cq={partial:!0,tokenize:Nq};function Eq(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return XR.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Mr(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 ot(p)?vc(e,c)(p):c(p)}function c(p){return YR(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(Cq,d,d)(p)}function d(p){return Ue(p)?Ge(e,f,"whitespace")(p):f(p)}function f(p){return p===null||be(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function Nq(e,t,n){return r;function r(a){return ot(a)?vc(e,i)(a):n(a)}function i(a){return QR(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ue(a)?Ge(e,o,"whitespace")(a):o(a)}function o(a){return a===null||be(a)?t(a):n(a)}}const Tq={name:"hardBreakEscape",tokenize:Pq};function Pq(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return be(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const Iq={name:"headingAtx",resolve:Rq,tokenize:Mq};function Rq(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"},er(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Mq(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||ot(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||be(u)?(e.exit("atxHeading"),t(u)):Ue(u)?Ge(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||ot(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const Aq=["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"],VS=["pre","script","style","textarea"],Lq={concrete:!0,name:"htmlFlow",resolveTo:Oq,tokenize:Bq},jq={partial:!0,tokenize:$q},Dq={partial:!0,tokenize:zq};function Oq(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 Bq(e,t,n){const r=this;let i,s,o,a,l;return c;function c(L){return u(L)}function u(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),f):L===47?(e.consume(L),s=!0,v):L===63?(e.consume(L),i=3,r.interrupt?t:E):En(L)?(e.consume(L),o=String.fromCharCode(L),b):n(L)}function f(L){return L===45?(e.consume(L),i=2,p):L===91?(e.consume(L),i=5,a=0,m):En(L)?(e.consume(L),i=4,r.interrupt?t:E):n(L)}function p(L){return L===45?(e.consume(L),r.interrupt?t:E):n(L)}function m(L){const ne="CDATA[";return L===ne.charCodeAt(a++)?(e.consume(L),a===ne.length?r.interrupt?t:I:m):n(L)}function v(L){return En(L)?(e.consume(L),o=String.fromCharCode(L),b):n(L)}function b(L){if(L===null||L===47||L===62||ot(L)){const ne=L===47,ae=o.toLowerCase();return!ne&&!s&&VS.includes(ae)?(i=1,r.interrupt?t(L):I(L)):Aq.includes(o.toLowerCase())?(i=6,ne?(e.consume(L),_):r.interrupt?t(L):I(L)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):s?x(L):y(L))}return L===45||yn(L)?(e.consume(L),o+=String.fromCharCode(L),b):n(L)}function _(L){return L===62?(e.consume(L),r.interrupt?t:I):n(L)}function x(L){return Ue(L)?(e.consume(L),x):P(L)}function y(L){return L===47?(e.consume(L),P):L===58||L===95||En(L)?(e.consume(L),w):Ue(L)?(e.consume(L),y):P(L)}function w(L){return L===45||L===46||L===58||L===95||yn(L)?(e.consume(L),w):k(L)}function k(L){return L===61?(e.consume(L),C):Ue(L)?(e.consume(L),k):y(L)}function C(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),l=L,N):Ue(L)?(e.consume(L),C):T(L)}function N(L){return L===l?(e.consume(L),l=null,B):L===null||be(L)?n(L):(e.consume(L),N)}function T(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||ot(L)?k(L):(e.consume(L),T)}function B(L){return L===47||L===62||Ue(L)?y(L):n(L)}function P(L){return L===62?(e.consume(L),A):n(L)}function A(L){return L===null||be(L)?I(L):Ue(L)?(e.consume(L),A):n(L)}function I(L){return L===45&&i===2?(e.consume(L),$):L===60&&i===1?(e.consume(L),F):L===62&&i===4?(e.consume(L),H):L===63&&i===3?(e.consume(L),E):L===93&&i===5?(e.consume(L),O):be(L)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(jq,V,R)(L)):L===null||be(L)?(e.exit("htmlFlowData"),R(L)):(e.consume(L),I)}function R(L){return e.check(Dq,j,V)(L)}function j(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),z}function z(L){return L===null||be(L)?R(L):(e.enter("htmlFlowData"),I(L))}function $(L){return L===45?(e.consume(L),E):I(L)}function F(L){return L===47?(e.consume(L),o="",D):I(L)}function D(L){if(L===62){const ne=o.toLowerCase();return VS.includes(ne)?(e.consume(L),H):I(L)}return En(L)&&o.length<8?(e.consume(L),o+=String.fromCharCode(L),D):I(L)}function O(L){return L===93?(e.consume(L),E):I(L)}function E(L){return L===62?(e.consume(L),H):L===45&&i===2?(e.consume(L),E):I(L)}function H(L){return L===null||be(L)?(e.exit("htmlFlowData"),V(L)):(e.consume(L),H)}function V(L){return e.exit("htmlFlow"),t(L)}}function zq(e,t,n){const r=this;return i;function i(o){return be(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 $q(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Eu,t,n)}}const Fq={name:"htmlText",tokenize:Hq};function Hq(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),k):E===63?(e.consume(E),y):En(E)?(e.consume(E),T):n(E)}function c(E){return E===45?(e.consume(E),u):E===91?(e.consume(E),s=0,m):En(E)?(e.consume(E),x):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):be(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 H="CDATA[";return E===H.charCodeAt(s++)?(e.consume(E),s===H.length?v:m):n(E)}function v(E){return E===null?n(E):E===93?(e.consume(E),b):be(E)?(o=v,F(E)):(e.consume(E),v)}function b(E){return E===93?(e.consume(E),_):v(E)}function _(E){return E===62?$(E):E===93?(e.consume(E),_):v(E)}function x(E){return E===null||E===62?$(E):be(E)?(o=x,F(E)):(e.consume(E),x)}function y(E){return E===null?n(E):E===63?(e.consume(E),w):be(E)?(o=y,F(E)):(e.consume(E),y)}function w(E){return E===62?$(E):y(E)}function k(E){return En(E)?(e.consume(E),C):n(E)}function C(E){return E===45||yn(E)?(e.consume(E),C):N(E)}function N(E){return be(E)?(o=N,F(E)):Ue(E)?(e.consume(E),N):$(E)}function T(E){return E===45||yn(E)?(e.consume(E),T):E===47||E===62||ot(E)?B(E):n(E)}function B(E){return E===47?(e.consume(E),$):E===58||E===95||En(E)?(e.consume(E),P):be(E)?(o=B,F(E)):Ue(E)?(e.consume(E),B):$(E)}function P(E){return E===45||E===46||E===58||E===95||yn(E)?(e.consume(E),P):A(E)}function A(E){return E===61?(e.consume(E),I):be(E)?(o=A,F(E)):Ue(E)?(e.consume(E),A):B(E)}function I(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),i=E,R):be(E)?(o=I,F(E)):Ue(E)?(e.consume(E),I):(e.consume(E),j)}function R(E){return E===i?(e.consume(E),i=void 0,z):E===null?n(E):be(E)?(o=R,F(E)):(e.consume(E),R)}function j(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||ot(E)?B(E):(e.consume(E),j)}function z(E){return E===47||E===62||ot(E)?B(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"),D}function D(E){return Ue(E)?Ge(e,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):O(E)}function O(E){return e.enter("htmlTextData"),o(E)}}const My={name:"labelEnd",resolveAll:qq,resolveTo:Kq,tokenize:Gq},Uq={tokenize:Yq},Wq={tokenize:Xq},Vq={tokenize:Qq};function qq(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&&er(e,0,e.length,n),e}function Kq(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=fr(a,e.slice(s+1,s+r+3)),a=fr(a,[["enter",u,t]]),a=fr(a,yp(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=fr(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=fr(a,e.slice(o+1)),a=fr(a,[["exit",l,t]]),er(e,s,e.length,a),e}function Gq(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(Mr(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(Uq,u,o?u:d)(f):f===91?e.attempt(Wq,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(Vq,u,d)(f)}function u(f){return t(f)}function d(f){return s._balanced=!0,n(f)}}function Yq(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 ot(d)?vc(e,s)(d):s(d)}function s(d){return d===41?u(d):YR(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ot(d)?vc(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?QR(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ot(d)?vc(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 Xq(e,t,n){const r=this;return i;function i(a){return XR.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Mr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function Qq(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 Zq={name:"labelStartImage",resolveAll:My.resolveAll,tokenize:Jq};function Jq(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 eK={name:"labelStartLink",resolveAll:My.resolveAll,tokenize:tK};function tK(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 Fm={name:"lineEnding",tokenize:nK};function nK(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ge(e,t,"linePrefix")}}const th={name:"thematicBreak",tokenize:rK};function rK(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||be(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ue(c)?Ge(e,a,"whitespace")(c):a(c))}}const On={continuation:{tokenize:aK},exit:cK,name:"list",tokenize:oK},iK={partial:!0,tokenize:uK},sK={partial:!0,tokenize:lK};function oK(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:E0(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(th,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 E0(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(Eu,r.interrupt?n:u,e.attempt(iK,f,d))}function u(p){return r.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return Ue(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 aK(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Eu,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ge(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Ue(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(sK,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ge(e,e.attempt(On,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function lK(e,t,n){const r=this;return Ge(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 cK(e){e.exit(this.containerState.type)}function uK(e,t,n){const r=this;return Ge(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!Ue(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const qS={name:"setextUnderline",resolveTo:dK,tokenize:hK};function dK(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 hK(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"),Ue(c)?Ge(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||be(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const fK={tokenize:pK};function pK(e){const t=this,n=e.attempt(Eu,r,e.attempt(this.parser.constructs.flowInitial,i,Ge(e,e.attempt(this.parser.constructs.flow,i,e.attempt(xq,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 mK={resolveAll:JR()},gK=ZR("string"),vK=ZR("text");function ZR(e){return{resolveAll:JR(e==="text"?_K: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 JR(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 _K(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 xK={42:On,43:On,45:On,48:On,49:On,50:On,51:On,52:On,53:On,54:On,55:On,56:On,57:On,62:VR},yK={91:kq},bK={[-2]:$m,[-1]:$m,32:$m},wK={35:Iq,42:th,45:[qS,th],60:Lq,61:qS,95:th,96:WS,126:WS},SK={38:KR,92:qR},kK={[-5]:Fm,[-4]:Fm,[-3]:Fm,33:Zq,38:KR,42:N0,60:[eq,Fq],91:eK,92:[Tq,qR],93:My,95:N0,96:fq},CK={null:[N0,mK]},EK={null:[42,95]},NK={null:[]},TK=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:EK,contentInitial:yK,disable:NK,document:xK,flow:wK,flowInitial:bK,insideSpan:CK,string:SK,text:kK},Symbol.toStringTag,{value:"Module"}));function PK(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:N(k),check:N(C),consume:x,enter:y,exit:w,interrupt:N(C,{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(A){return o=fr(o,A),b(),o[o.length-1]!==null?[]:(T(t,0),c.events=yp(s,c.events,c),c.events)}function f(A,I){return RK(p(A),I)}function p(A){return IK(o,A)}function m(){const{_bufferIndex:A,_index:I,line:R,column:j,offset:z}=r;return{_bufferIndex:A,_index:I,line:R,column:j,offset:z}}function v(A){i[A.line]=A.column,P()}function b(){let A;for(;r._index<o.length;){const I=o[r._index];if(typeof I=="string")for(A=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===A&&r._bufferIndex<I.length;)_(I.charCodeAt(r._bufferIndex));else _(I)}}function _(A){u=u(A)}function x(A){be(A)?(r.line++,r.column=1,r.offset+=A===-3?2:1,P()):A!==-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=A}function y(A,I){const R=I||{};return R.type=A,R.start=m(),c.events.push(["enter",R,c]),a.push(R),R}function w(A){const I=a.pop();return I.end=m(),c.events.push(["exit",I,c]),I}function k(A,I){T(A,I.from)}function C(A,I){I.restore()}function N(A,I){return R;function R(j,z,$){let F,D,O,E;return Array.isArray(j)?V(j):"tokenize"in j?V([j]):H(j);function H(G){return ye;function ye(Fe){const ue=Fe!==null&&G[Fe],Ie=Fe!==null&&G.null,Re=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return V(Re)(Fe)}}function V(G){return F=G,D=0,G.length===0?$:L(G[D])}function L(G){return ye;function ye(Fe){return E=B(),O=G,G.partial||(c.currentConstruct=G),G.name&&c.parser.constructs.disable.null.includes(G.name)?ae():G.tokenize.call(I?Object.assign(Object.create(c),I):c,l,ne,ae)(Fe)}}function ne(G){return A(O,E),z}function ae(G){return E.restore(),++D<F.length?L(F[D]):$}}}function T(A,I){A.resolveAll&&!s.includes(A)&&s.push(A),A.resolve&&er(c.events,I,c.events.length-I,A.resolve(c.events.slice(I),c)),A.resolveTo&&(c.events=A.resolveTo(c.events,c))}function B(){const A=m(),I=c.previous,R=c.currentConstruct,j=c.events.length,z=Array.from(a);return{from:j,restore:$};function $(){r=A,c.previous=I,c.currentConstruct=R,c.events.length=j,a=z,P()}}function P(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function IK(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 RK(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=`
|
|
477
477
|
`;break}case-3:{o=`\r
|
|
478
478
|
`;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 MK(e){const r={constructs:UR([TK,...(e||{}).extensions||[]]),content:i(KV),defined:[],document:i(YV),flow:i(fK),lazy:{},string:i(gK),text:i(vK)};return r;function i(s){return o;function o(a){return PK(r,s,a)}}}function AK(e){for(;!GR(e););return e}const KS=/[\0\t\n\r]/g;function LK(){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(KS.lastIndex=d,c=KS.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 jK=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function DK(e){return e.replace(jK,OK)}function OK(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return WR(n.slice(s?2:1),s?16:10)}return Ry(n)||e}const eM={}.hasOwnProperty;function BK(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),zK(n)(AK(MK(n).document().write(LK()(e,t,!0))))}function zK(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Mt),autolinkProtocol:B,autolinkEmail:B,atxHeading:s(fn),blockQuote:s(Ie),characterEscape:B,characterReference:B,codeFenced:s(Re),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Re,o),codeText:s(Ke,o),codeTextData:B,data:B,codeFlowValue:B,definition:s(ve),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(ze),hardBreakEscape:s(it),hardBreakTrailing:s(it),htmlFlow:s(Rt,o),htmlFlowData:B,htmlText:s(Rt,o),htmlTextData:B,image:s(Gt),label:o,link:s(Mt),listItem:s(Qe),listItemValue:f,listOrdered:s(bt,d),listUnordered:s(bt),paragraph:s(st),reference:L,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(fn),strong:s(wt),thematicBreak:s(on)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:ue,autolinkProtocol:Fe,blockQuote:l(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:G,characterReference:ye,codeFenced:l(b),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:P,codeIndented:l(_),codeText:l(z),codeTextData:P,data:P,definition:l(),definitionDestinationString:w,definitionLabelString:x,definitionTitleString:y,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(R),htmlFlowData:P,htmlText:l(j),htmlTextData:P,image:l(F),label:O,labelText:D,lineEnding:A,link:l($),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ne,resourceDestinationString:E,resourceTitleString:H,resource:V,setextHeading:l(T),setextHeadingLineSequence:N,setextHeadingText:C,strong:l(),thematicBreak:l()}};tM(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(U){let Z={type:"root",children:[]};const _e={stack:[Z],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},ke=[];let He=-1;for(;++He<U.length;)if(U[He][1].type==="listOrdered"||U[He][1].type==="listUnordered")if(U[He][0]==="enter")ke.push(He);else{const Tt=ke.pop();He=i(U,Tt,He)}for(He=-1;++He<U.length;){const Tt=t[U[He][0]];eM.call(Tt,U[He][1].type)&&Tt[U[He][1].type].call(Object.assign({sliceSerialize:U[He][2].sliceSerialize},_e),U[He][1])}if(_e.tokenStack.length>0){const Tt=_e.tokenStack[_e.tokenStack.length-1];(Tt[1]||GS).call(_e,void 0,Tt[0])}for(Z.position={start:Qi(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Qi(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},He=-1;++He<t.transforms.length;)Z=t.transforms[He](Z)||Z;return Z}function i(U,Z,_e){let ke=Z-1,He=-1,Tt=!1,Yt,Xt,se,q;for(;++ke<=_e;){const we=U[ke];switch(we[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{we[0]==="enter"?He++:He--,q=void 0;break}case"lineEndingBlank":{we[0]==="enter"&&(Yt&&!q&&!He&&!se&&(se=ke),q=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:q=void 0}if(!He&&we[0]==="enter"&&we[1].type==="listItemPrefix"||He===-1&&we[0]==="exit"&&(we[1].type==="listUnordered"||we[1].type==="listOrdered")){if(Yt){let ht=ke;for(Xt=void 0;ht--;){const an=U[ht];if(an[1].type==="lineEnding"||an[1].type==="lineEndingBlank"){if(an[0]==="exit")continue;Xt&&(U[Xt][1].type="lineEndingBlank",Tt=!0),an[1].type="lineEnding",Xt=ht}else if(!(an[1].type==="linePrefix"||an[1].type==="blockQuotePrefix"||an[1].type==="blockQuotePrefixWhitespace"||an[1].type==="blockQuoteMarker"||an[1].type==="listItemIndent"))break}se&&(!Xt||se<Xt)&&(Yt._spread=!0),Yt.end=Object.assign({},Xt?U[Xt][1].start:we[1].end),U.splice(Xt||ke,0,["exit",Yt,we[2]]),ke++,_e++}if(we[1].type==="listItemPrefix"){const ht={type:"listItem",_spread:!1,start:Object.assign({},we[1].start),end:void 0};Yt=ht,U.splice(ke,0,["enter",ht,we[2]]),ke++,_e++,se=void 0,q=!0}}}return U[Z][1]._spread=Tt,_e}function s(U,Z){return _e;function _e(ke){a.call(this,U(ke),ke),Z&&Z.call(this,ke)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(U,Z,_e){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([Z,_e||void 0]),U.position={start:Qi(Z.start),end:void 0}}function l(U){return Z;function Z(_e){U&&U.call(this,_e),c.call(this,_e)}}function c(U,Z){const _e=this.stack.pop(),ke=this.tokenStack.pop();if(ke)ke[0].type!==U.type&&(Z?Z.call(this,U,ke[0]):(ke[1]||GS).call(this,U,ke[0]));else throw new Error("Cannot close `"+U.type+"` ("+gc({start:U.start,end:U.end})+"): it’s not open");_e.position.end=Qi(U.end)}function u(){return Iy(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(U){if(this.data.expectingFirstListItemValue){const Z=this.stack[this.stack.length-2];Z.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function p(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.lang=U}function m(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.meta=U}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.value=U.replace(/(\r?\n|\r)$/g,"")}function x(U){const Z=this.resume(),_e=this.stack[this.stack.length-1];_e.label=Z,_e.identifier=Mr(this.sliceSerialize(U)).toLowerCase()}function y(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.title=U}function w(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.url=U}function k(U){const Z=this.stack[this.stack.length-1];if(!Z.depth){const _e=this.sliceSerialize(U).length;Z.depth=_e}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function N(U){const Z=this.stack[this.stack.length-1];Z.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function B(U){const _e=this.stack[this.stack.length-1].children;let ke=_e[_e.length-1];(!ke||ke.type!=="text")&&(ke=pn(),ke.position={start:Qi(U.start),end:void 0},_e.push(ke)),this.stack.push(ke)}function P(U){const Z=this.stack.pop();Z.value+=this.sliceSerialize(U),Z.position.end=Qi(U.end)}function A(U){const Z=this.stack[this.stack.length-1];if(this.data.atHardBreak){const _e=Z.children[Z.children.length-1];_e.position.end=Qi(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Z.type)&&(B.call(this,U),P.call(this,U))}function I(){this.data.atHardBreak=!0}function R(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.value=U}function j(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.value=U}function z(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.value=U}function $(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=Z,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function F(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const Z=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=Z,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function D(U){const Z=this.sliceSerialize(U),_e=this.stack[this.stack.length-2];_e.label=DK(Z),_e.identifier=Mr(Z).toLowerCase()}function O(){const U=this.stack[this.stack.length-1],Z=this.resume(),_e=this.stack[this.stack.length-1];if(this.data.inReference=!0,_e.type==="link"){const ke=U.children;_e.children=ke}else _e.alt=Z}function E(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.url=U}function H(){const U=this.resume(),Z=this.stack[this.stack.length-1];Z.title=U}function V(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function ne(U){const Z=this.resume(),_e=this.stack[this.stack.length-1];_e.label=Z,_e.identifier=Mr(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function ae(U){this.data.characterReferenceType=U.type}function G(U){const Z=this.sliceSerialize(U),_e=this.data.characterReferenceType;let ke;_e?(ke=WR(Z,_e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ke=Ry(Z);const He=this.stack[this.stack.length-1];He.value+=ke}function ye(U){const Z=this.stack.pop();Z.position.end=Qi(U.end)}function Fe(U){P.call(this,U);const Z=this.stack[this.stack.length-1];Z.url=this.sliceSerialize(U)}function ue(U){P.call(this,U);const Z=this.stack[this.stack.length-1];Z.url="mailto:"+this.sliceSerialize(U)}function Ie(){return{type:"blockquote",children:[]}}function Re(){return{type:"code",lang:null,meta:null,value:""}}function Ke(){return{type:"inlineCode",value:""}}function ve(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ze(){return{type:"emphasis",children:[]}}function fn(){return{type:"heading",depth:0,children:[]}}function it(){return{type:"break"}}function Rt(){return{type:"html",value:""}}function Gt(){return{type:"image",title:null,url:"",alt:null}}function Mt(){return{type:"link",title:null,url:"",children:[]}}function bt(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function Qe(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function st(){return{type:"paragraph",children:[]}}function wt(){return{type:"strong",children:[]}}function pn(){return{type:"text",value:""}}function on(){return{type:"thematicBreak"}}}function Qi(e){return{line:e.line,column:e.column,offset:e.offset}}function tM(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?tM(e,r):$K(e,r)}}function $K(e,t){let n;for(n in t)if(eM.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 GS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+gc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+gc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+gc({start:t.start,end:t.end})+") is still open")}function FK(e){const t=this;t.parser=n;function n(r){return BK(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function HK(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 UK(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-DzxzIoVO.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/share-ui/assets/guest-Dd5QCK4c.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body style="margin: 0">
|