@clawos-dev/clawd 0.2.446 → 0.2.448
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 +40 -5
- package/dist/deploy-kit/scripts/ensure-credentials.sh +79 -0
- package/dist/deploy-kit/scripts/ensure-credentials.spec.ts +204 -0
- package/dist/deploy-kit/scripts/publish.sh +3 -16
- package/dist/deploy-kit/scripts/remove-extension.sh +4 -5
- package/dist/dispatch/mcp-server.cjs +13 -1
- package/dist/persona-defaults/persona-app-builder/CLAUDE.md +10 -6
- package/dist/persona-defaults/persona-app-builder/extension-kit/contract/s.yaml.tmpl +3 -1
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/contract/s.yaml.tmpl +3 -1
- package/dist/share-md-viewer-error.html +1 -1
- package/dist/share-md-viewer.html +1 -1
- package/dist/share-ui/assets/{guest-DgGpoVf5.css → guest-7QsWRy9Q.css} +1 -1
- package/dist/share-ui/assets/{guest-ChNRpL1J.js → guest-CilettnR.js} +3 -3
- package/dist/share-ui/guest.html +2 -2
- package/package.json +1 -1
|
@@ -92,8 +92,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
92
92
|
0 -6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
93
93
|
0 -3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
94
94
|
0 -9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
95
|
-
`,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var uw=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const cO={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},uO={motionBase:!0,motionUnit:!0},dO={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},mT=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=uw(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=pT(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=uw(l,["theme"]);let d=u;c&&(d=mT(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function gT(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Ze.useContext(hT),s=`${aO}-${t||""}`,o=n||dT,[a,l,c]=QL(o,[Kc,e],{salt:s,override:r,getComputedToken:mT,formatToken:pT,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:cO,ignore:uO,preserve:dO}});return[o,c,t?l:"",a,i]}const hO=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),fO=e=>({[`.${e}`]:Object.assign(Object.assign({},hO()),{[`.${e} .${e}-icon`]:{display:"block"}})}),pO=(e,t)=>{const[n,r]=gT();return CD({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>fO(e))},mO=Object.assign({},ol),{useId:dw}=mO,gO=()=>"",vO=typeof dw>"u"?gO:dw;function xO(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},Fh),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:Fh.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=vO();return jN(()=>{var a,l;if(!e)return t;const c=Object.assign({},s.components);Object.keys(e.components||{}).forEach(f=>{c[f]=Object.assign(Object.assign({},c[f]),e.components[f])});const u=`css-var-${o.replace(/:/g,"")}`,d=((a=i.cssVar)!==null&&a!==void 0?a:s.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof s.cssVar=="object"?s.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((l=i.cssVar)===null||l===void 0?void 0:l.key)||u});return Object.assign(Object.assign(Object.assign({},s),i),{token:Object.assign(Object.assign({},s.token),i.token),components:c,cssVar:d})},[i,s],(a,l)=>a.some((c,u)=>{const d=l[u];return!CL(c,d,!0)}))}var _O=["children"],vT=g.createContext({});function yO(e){var t=e.children,n=jv(e,_O);return g.createElement(vT.Provider,{value:n},t)}var bO=function(e){DN(n,e);var t=BN(n);function n(){return ul(this,n),t.apply(this,arguments)}return dl(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function wO(e){var t=g.useReducer(function(a){return a+1},0),n=et(t,2),r=n[1],i=g.useRef(e),s=n0(function(){return i.current}),o=n0(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var ds="none",od="appear",ad="enter",ld="leave",hw="none",Lr="prepare",ya="start",ba="active",z_="end",xT="prepared";function fw(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}function SO(e,t){var n={animationend:fw("Animation","AnimationEnd"),transitionend:fw("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var kO=SO(Xi(),typeof window<"u"?window:{}),_T={};if(Xi()){var CO=document.createElement("div");_T=CO.style}var cd={};function yT(e){if(cd[e])return cd[e];var t=kO[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var s=n[i];if(Object.prototype.hasOwnProperty.call(t,s)&&s in _T)return cd[e]=t[s],cd[e]}return""}var bT=yT("animationend"),wT=yT("transitionend"),ST=!!(bT&&wT),pw=bT||"animationend",mw=wT||"transitionend";function gw(e,t){if(!e)return null;if(Rt(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const EO=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(mw,e),i.removeEventListener(pw,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(mw,e),i.addEventListener(pw,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var kT=Xi()?g.useLayoutEffect:g.useEffect;const NO=function(){var e=g.useRef(null);function t(){Mv.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=Mv(function(){i<=1?r({isCanceled:function(){return s!==e.current}}):n(r,i-1)});e.current=s}return g.useEffect(function(){return function(){t()}},[]),[n,t]};var TO=[Lr,ya,ba,z_],IO=[Lr,xT],CT=!1,PO=!0;function ET(e){return e===ba||e===z_}const RO=function(e,t,n){var r=r0(hw),i=et(r,2),s=i[0],o=i[1],a=NO(),l=et(a,2),c=l[0],u=l[1];function d(){o(Lr,!0)}var f=t?IO:TO;return kT(function(){if(s!==hw&&s!==z_){var p=f.indexOf(s),m=f[p+1],v=n(s);v===CT?o(m,!0):m&&c(function(w){function x(){w.isCanceled()||o(m,!0)}v===!0?x():Promise.resolve(v).then(x)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function MO(e,t,n,r){var i=r.motionEnter,s=i===void 0?!0:i,o=r.motionAppear,a=o===void 0?!0:o,l=r.motionLeave,c=l===void 0?!0:l,u=r.motionDeadline,d=r.motionLeaveImmediately,f=r.onAppearPrepare,p=r.onEnterPrepare,m=r.onLeavePrepare,v=r.onAppearStart,w=r.onEnterStart,x=r.onLeaveStart,_=r.onAppearActive,y=r.onEnterActive,S=r.onLeaveActive,C=r.onAppearEnd,k=r.onEnterEnd,N=r.onLeaveEnd,T=r.onVisibleChanged,z=r0(),P=et(z,2),O=P[0],M=P[1],R=wO(ds),A=et(R,2),L=A[0],$=A[1],F=r0(null),D=et(F,2),B=D[0],E=D[1],H=L(),q=g.useRef(!1),j=g.useRef(null);function ne(){return n()}var ie=g.useRef(!1);function K(){$(ds),E(null,!0)}var _e=n0(function(Qe){var ot=L();if(ot!==ds){var _t=ne();if(!(Qe&&!Qe.deadline&&Qe.target!==_t)){var vn=ie.current,cn;ot===od&&vn?cn=C==null?void 0:C(_t,Qe):ot===ad&&vn?cn=k==null?void 0:k(_t,Qe):ot===ld&&vn&&(cn=N==null?void 0:N(_t,Qe)),vn&&cn!==!1&&K()}}}),Re=EO(_e),ce=et(Re,1),Me=ce[0],$e=function(ot){switch(ot){case od:return ke(ke(ke({},Lr,f),ya,v),ba,_);case ad:return ke(ke(ke({},Lr,p),ya,w),ba,y);case ld:return ke(ke(ke({},Lr,m),ya,x),ba,S);default:return{}}},Fe=g.useMemo(function(){return $e(H)},[H]),be=RO(H,!e,function(Qe){if(Qe===Lr){var ot=Fe[Lr];return ot?ot(ne()):CT}if(qe in Fe){var _t;E(((_t=Fe[qe])===null||_t===void 0?void 0:_t.call(Fe,ne(),null))||null)}return qe===ba&&H!==ds&&(Me(ne()),u>0&&(clearTimeout(j.current),j.current=setTimeout(function(){_e({deadline:!0})},u))),qe===xT&&K(),PO}),rt=et(be,2),pt=rt[0],qe=rt[1],Et=ET(qe);ie.current=Et;var Zt=g.useRef(null);kT(function(){if(!(q.current&&Zt.current===t)){M(t);var Qe=q.current;q.current=!0;var ot;!Qe&&t&&a&&(ot=od),Qe&&t&&s&&(ot=ad),(Qe&&!t&&c||!Qe&&d&&!t&&c)&&(ot=ld);var _t=$e(ot);ot&&(e||_t[Lr])?($(ot),pt()):$(ds),Zt.current=t}},[t]),g.useEffect(function(){(H===od&&!a||H===ad&&!s||H===ld&&!c)&&$(ds)},[a,s,c]),g.useEffect(function(){return function(){q.current=!1,clearTimeout(j.current)}},[]);var mt=g.useRef(!1);g.useEffect(function(){O&&(mt.current=!0),O!==void 0&&H===ds&&((mt.current||O)&&(T==null||T(O)),mt.current=!0)},[O,H]);var xt=B;return Fe[Lr]&&qe===ya&&(xt=He({transition:"none"},xt)),[H,qe,xt,O??t]}function AO(e){var t=e;Rt(e)==="object"&&(t=e.transitionSupport);function n(i,s){return!!(i.motionName&&t&&s!==!1)}var r=g.forwardRef(function(i,s){var o=i.visible,a=o===void 0?!0:o,l=i.removeOnLeave,c=l===void 0?!0:l,u=i.forceRender,d=i.children,f=i.motionName,p=i.leavedClassName,m=i.eventProps,v=g.useContext(vT),w=v.motion,x=n(i,w),_=g.useRef(),y=g.useRef();function S(){try{return _.current instanceof HTMLElement?_.current:lL(y.current)}catch{return null}}var C=MO(x,a,S,i),k=et(C,4),N=k[0],T=k[1],z=k[2],P=k[3],O=g.useRef(P);P&&(O.current=!0);var M=g.useCallback(function(D){_.current=D,hL(s,D)},[s]),R,A=He(He({},m),{},{visible:a});if(!d)R=null;else if(N===ds)P?R=d(He({},A),M):!c&&O.current&&p?R=d(He(He({},A),{},{className:p}),M):u||!c&&!p?R=d(He(He({},A),{},{style:{display:"none"}}),M):R=null;else{var L;T===Lr?L="prepare":ET(T)?L="active":T===ya&&(L="start");var $=gw(f,"".concat(N,"-").concat(L));R=d(He(He({},A),{},{className:Yj(gw(f,N),ke(ke({},$,$&&L),f,typeof f=="string")),style:z}),M)}if(g.isValidElement(R)&&fL(R)){var F=pL(R);F||(R=g.cloneElement(R,{ref:M}))}return g.createElement(bO,{ref:y},R)});return r.displayName="CSSMotion",r}const jO=AO(ST);var i0="add",s0="keep",o0="remove",Im="removed";function LO(e){var t;return e&&Rt(e)==="object"&&"key"in e?t=e:t={key:e},He(He({},t),{},{key:String(t.key)})}function a0(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(LO)}function DO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=t.length,s=a0(e),o=a0(t);s.forEach(function(c){for(var u=!1,d=r;d<i;d+=1){var f=o[d];if(f.key===c.key){r<d&&(n=n.concat(o.slice(r,d).map(function(p){return He(He({},p),{},{status:i0})})),r=d),n.push(He(He({},f),{},{status:s0})),r+=1,u=!0;break}}u||n.push(He(He({},c),{},{status:o0}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return He(He({},c),{},{status:i0})})));var a={};n.forEach(function(c){var u=c.key;a[u]=(a[u]||0)+1});var l=Object.keys(a).filter(function(c){return a[c]>1});return l.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==o0}),n.forEach(function(u){u.key===c&&(u.status=s0)})}),n}var OO=["component","children","onVisibleChanged","onAllRemoved"],BO=["status"],zO=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function $O(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jO,n=function(r){DN(s,r);var i=BN(s);function s(){var o;ul(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=i.call.apply(i,[this].concat(l)),ke(Pv(o),"state",{keyEntities:[]}),ke(Pv(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:He(He({},p),{},{status:Im})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==Im}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return dl(s,[{key:"render",value:function(){var a=this,l=this.state.keyEntities,c=this.props,u=c.component,d=c.children,f=c.onVisibleChanged;c.onAllRemoved;var p=jv(c,OO),m=u||g.Fragment,v={};return zO.forEach(function(w){v[w]=p[w],delete p[w]}),delete p.keys,g.createElement(m,p,l.map(function(w,x){var _=w.status,y=jv(w,BO),S=_===i0||_===s0;return g.createElement(t,Bh({},v,{key:y.key,visible:S,eventProps:y,onVisibleChanged:function(k){f==null||f(k,{key:y.key}),k||a.removeKey(y.key)}}),function(C,k){return d(He(He({},C),{},{index:x}),k)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=a0(c),f=DO(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(v){var w=v.key;return p.key===w});return!(m&&m.status===Im&&p.status===o0)})}}}]),s}(g.Component);return ke(n,"defaultProps",{component:"div"}),n}$O(ST);const vw=g.createContext(!0);function FO(e){const t=g.useContext(vw),{children:n}=e,[,r]=gT(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(vw.Provider,{value:i},g.createElement(yO,{motion:i},n)):n}const HO=()=>null;var UO=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const WO=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let NT;function VO(){return NT||e0}function qO(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const KO=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(NT=t),r&&qO(r)&&tO(VO(),r)},GO=e=>{const{children:t,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:s,form:o,locale:a,componentSize:l,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:v,legacyLocale:w,parentContext:x,iconPrefixCls:_,theme:y,componentDisabled:S,segmented:C,statistic:k,spin:N,calendar:T,carousel:z,cascader:P,collapse:O,typography:M,checkbox:R,descriptions:A,divider:L,drawer:$,skeleton:F,steps:D,image:B,layout:E,list:H,mentions:q,modal:j,progress:ne,result:ie,slider:K,breadcrumb:_e,menu:Re,pagination:ce,input:Me,textArea:$e,empty:Fe,badge:be,radio:rt,rate:pt,switch:qe,transfer:Et,avatar:Zt,message:mt,tag:xt,table:Qe,card:ot,tabs:_t,timeline:vn,timePicker:cn,upload:U,notification:J,tree:ve,colorPicker:Te,datePicker:De,rangePicker:Nt,flex:un,wave:Wt,dropdown:Jt,warning:le,tour:we,tooltip:ut,popover:jt,popconfirm:Ir,floatButton:oe,floatButtonGroup:Je,variant:dn,inputNumber:ns,treeSelect:El}=e,Xs=g.useCallback((Tt,G)=>{const{prefixCls:ge}=e;if(G)return G;const ye=ge||x.getPrefixCls("");return Tt?`${ye}-${Tt}`:ye},[x.getPrefixCls,e.prefixCls]),wi=_||x.iconPrefixCls||fT,Ko=n||x.csp;pO(wi,Ko);const Go=xO(y,x.theme,{prefixCls:Xs("")}),Ys={csp:Ko,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||w,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:v,getPrefixCls:Xs,iconPrefixCls:wi,theme:Go,segmented:C,statistic:k,spin:N,calendar:T,carousel:z,cascader:P,collapse:O,typography:M,checkbox:R,descriptions:A,divider:L,drawer:$,skeleton:F,steps:D,image:B,input:Me,textArea:$e,layout:E,list:H,mentions:q,modal:j,progress:ne,result:ie,slider:K,breadcrumb:_e,menu:Re,pagination:ce,empty:Fe,badge:be,radio:rt,rate:pt,switch:qe,transfer:Et,avatar:Zt,message:mt,tag:xt,table:Qe,card:ot,tabs:_t,timeline:vn,timePicker:cn,upload:U,notification:J,tree:ve,colorPicker:Te,datePicker:De,rangePicker:Nt,flex:un,wave:Wt,dropdown:Jt,warning:le,tour:we,tooltip:ut,popover:jt,popconfirm:Ir,floatButton:oe,floatButtonGroup:Je,variant:dn,inputNumber:ns,treeSelect:El},rs=Object.assign({},x);Object.keys(Ys).forEach(Tt=>{Ys[Tt]!==void 0&&(rs[Tt]=Ys[Tt])}),WO.forEach(Tt=>{const G=e[Tt];G&&(rs[Tt]=G)}),typeof r<"u"&&(rs.button=Object.assign({autoInsertSpace:r},rs.button));const Pr=jN(()=>rs,rs,(Tt,G)=>{const ge=Object.keys(Tt),ye=Object.keys(G);return ge.length!==ye.length||ge.some(Ge=>Tt[Ge]!==G[Ge])}),{layer:zu}=g.useContext(Zf),Vp=g.useMemo(()=>({prefixCls:wi,csp:Ko,layer:zu?"antd":void 0}),[wi,Ko,zu]);let Lt=g.createElement(g.Fragment,null,g.createElement(HO,{dropdownMatchSelectWidth:p}),t);const Qs=g.useMemo(()=>{var Tt,G,ge,ye;return AD(((Tt=tp.Form)===null||Tt===void 0?void 0:Tt.defaultValidateMessages)||{},((ge=(G=Pr.locale)===null||G===void 0?void 0:G.Form)===null||ge===void 0?void 0:ge.defaultValidateMessages)||{},((ye=Pr.form)===null||ye===void 0?void 0:ye.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[Pr,o==null?void 0:o.validateMessages]);Object.keys(Qs).length>0&&(Lt=g.createElement(LD.Provider,{value:Qs},Lt)),a&&(Lt=g.createElement(BD,{locale:a,_ANT_MARK__:OD},Lt)),Lt=g.createElement(ID.Provider,{value:Vp},Lt),l&&(Lt=g.createElement(rO,{size:l},Lt)),Lt=g.createElement(FO,null,Lt);const qp=g.useMemo(()=>{const Tt=Go||{},{algorithm:G,token:ge,components:ye,cssVar:Ge}=Tt,Vr=UO(Tt,["algorithm","token","components","cssVar"]),Nl=G&&(!Array.isArray(G)||G.length>0)?Dv(G):dT,Kp={};Object.entries(ye||{}).forEach(([m4,g4])=>{const Si=Object.assign({},g4);"algorithm"in Si&&(Si.algorithm===!0?Si.theme=Nl:(Array.isArray(Si.algorithm)||typeof Si.algorithm=="function")&&(Si.theme=Dv(Si.algorithm)),delete Si.algorithm),Kp[m4]=Si});const C1=Object.assign(Object.assign({},Kc),ge);return Object.assign(Object.assign({},Vr),{theme:Nl,token:C1,components:Kp,override:Object.assign({override:C1},Kp),cssVar:Ge})},[Go]);return y&&(Lt=g.createElement(hT.Provider,{value:qp},Lt)),Pr.warning&&(Lt=g.createElement(jD.Provider,{value:Pr.warning},Lt)),S!==void 0&&(Lt=g.createElement(nO,{disabled:S},Lt)),g.createElement(np.Provider,{value:Pr},Lt)},fl=e=>{const t=g.useContext(np),n=g.useContext(aT);return g.createElement(GO,Object.assign({parentContext:t,legacyLocale:n},e))};fl.ConfigContext=np;fl.SizeContext=Gc;fl.config=KO;fl.useConfig=iO;Object.defineProperty(fl,"SizeContext",{get:()=>Gc});const dr=(e,t)=>new St(e).setA(t).toRgbString(),Qo=(e,t)=>new St(e).lighten(t).toHexString(),XO=e=>{const t=Va(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},YO=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:dr(r,.85),colorTextSecondary:dr(r,.65),colorTextTertiary:dr(r,.45),colorTextQuaternary:dr(r,.25),colorFill:dr(r,.18),colorFillSecondary:dr(r,.12),colorFillTertiary:dr(r,.08),colorFillQuaternary:dr(r,.04),colorBgSolid:dr(r,.95),colorBgSolidHover:dr(r,1),colorBgSolidActive:dr(r,.9),colorBgElevated:Qo(n,12),colorBgContainer:Qo(n,8),colorBgLayout:Qo(n,0),colorBgSpotlight:Qo(n,26),colorBgBlur:dr(r,.04),colorBorder:Qo(n,26),colorBorderSecondary:Qo(n,19)}},QO=(e,t)=>{const n=Object.keys(O_).map(s=>{const o=Va(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??B_(e),i=uT(e,{generateColorPalettes:XO,generateNeutralColorPalettes:YO});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},xw={defaultSeed:Fh.token,defaultAlgorithm:B_,darkAlgorithm:QO};function _w({children:e}){const t=I_(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(fl,{theme:{algorithm:n.mode==="dark"?xw.darkAlgorithm:xw.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var Xe;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Xe||(Xe={}));var yw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(yw||(yw={}));const de=Xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ms=e=>{switch(typeof e){case"undefined":return de.undefined;case"string":return de.string;case"number":return Number.isNaN(e)?de.nan:de.number;case"boolean":return de.boolean;case"function":return de.function;case"bigint":return de.bigint;case"symbol":return de.symbol;case"object":return Array.isArray(e)?de.array:e===null?de.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?de.promise:typeof Map<"u"&&e instanceof Map?de.map:typeof Set<"u"&&e instanceof Set?de.set:typeof Date<"u"&&e instanceof Date?de.date:de.object;default:return de.unknown}},X=Xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Wi extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(t){if(!(t instanceof Wi))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Wi.create=e=>new Wi(e);const l0=(e,t)=>{let n;switch(e.code){case X.invalid_type:e.received===de.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Xe.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xe.joinValues(e.keys,", ")}`;break;case X.invalid_union:n="Invalid input";break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xe.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${Xe.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n="Invalid function arguments";break;case X.invalid_return_type:n="Invalid function return type";break;case X.invalid_date:n="Invalid date";break;case X.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Xe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case X.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case X.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case X.custom:n="Invalid input";break;case X.invalid_intersection_types:n="Intersection results could not be merged";break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n="Number must be finite";break;default:n=t.defaultError,Xe.assertNever(e)}return{message:n}};let ZO=l0;function JO(){return ZO}const e6=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function se(e,t){const n=JO(),r=e6({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===l0?void 0:l0].filter(i=>!!i)});e.common.issues.push(r)}class An{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Ee;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return An.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Ee;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const Ee=Object.freeze({status:"aborted"}),Jl=e=>({status:"dirty",value:e}),Er=e=>({status:"valid",value:e}),bw=e=>e.status==="aborted",ww=e=>e.status==="dirty",qa=e=>e.status==="valid",Hh=e=>typeof Promise<"u"&&e instanceof Promise;var me;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(me||(me={}));class hi{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Sw=(e,t)=>{if(qa(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Wi(e.common.issues);return this._error=n,this._error}}};function Le(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class Ve{get description(){return this._def.description}_getType(t){return ms(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ms(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new An,ctx:{common:t.parent.common,data:t.data,parsedType:ms(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Hh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ms(t)},i=this._parseSync({data:t,path:r.path,parent:r});return Sw(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ms(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return qa(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>qa(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ms(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Hh(i)?i:Promise.resolve(i));return Sw(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:X.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Eo({schema:this,typeName:Ne.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Oi.create(this,this._def)}nullable(){return No.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return li.create(this)}promise(){return Gh.create(this,this._def)}or(t){return Wh.create([this,t],this._def)}and(t){return Vh.create(this,t,this._def)}transform(t){return new Eo({...Le(this._def),schema:this,typeName:Ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Xh({...Le(this._def),innerType:this,defaultValue:n,typeName:Ne.ZodDefault})}brand(){return new RT({typeName:Ne.ZodBranded,type:this,...Le(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Yh({...Le(this._def),innerType:this,catchValue:n,typeName:Ne.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return F_.create(this,t)}readonly(){return Qh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const t6=/^c[^\s-]{8,}$/i,n6=/^[0-9a-z]+$/,r6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,i6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,s6=/^[a-z0-9_-]{21}$/i,o6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,a6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,l6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,c6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Pm;const u6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,d6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,h6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,f6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,p6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,m6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,TT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",g6=new RegExp(`^${TT}$`);function IT(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function v6(e){return new RegExp(`^${IT(e)}$`)}function x6(e){let t=`${TT}T${IT(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function _6(e,t){return!!((t==="v4"||!t)&&u6.test(e)||(t==="v6"||!t)&&h6.test(e))}function y6(e,t){if(!o6.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function b6(e,t){return!!((t==="v4"||!t)&&d6.test(e)||(t==="v6"||!t)&&f6.test(e))}class Ai extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==de.string){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.string,received:s.parsedType}),Ee}const r=new An;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?se(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&se(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")l6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"email",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Pm||(Pm=new RegExp(c6,"u")),Pm.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"emoji",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")i6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"uuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")s6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"nanoid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")t6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")n6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid2",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")r6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ulid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),se(i,{validation:"url",code:X.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"regex",code:X.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?x6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?g6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?v6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?a6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"duration",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?_6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ip",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?y6(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"jwt",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?b6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cidr",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?p6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?m6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64url",code:X.invalid_string,message:s.message}),r.dirty()):Xe.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:X.invalid_string,...me.errToObj(r)})}_addCheck(t){return new Ai({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...me.errToObj(t)})}url(t){return this._addCheck({kind:"url",...me.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...me.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...me.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...me.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...me.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...me.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...me.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...me.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...me.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...me.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...me.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...me.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...me.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...me.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...me.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...me.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...me.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...me.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...me.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...me.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...me.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...me.errToObj(n)})}nonempty(t){return this.min(1,me.errToObj(t))}trim(){return new Ai({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ai({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ai({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ai.create=e=>new Ai({checks:[],typeName:Ne.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Le(e)});function w6(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class Ka extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==de.number){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.number,received:s.parsedType}),Ee}let r;const i=new An;for(const s of this._def.checks)s.kind==="int"?Xe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:X.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?w6(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_finite,message:s.message}),i.dirty()):Xe.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Ka({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Ka({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:me.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:me.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Xe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ka.create=e=>new Ka({checks:[],typeName:Ne.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class Xc extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==de.bigint)return this._getInvalidInput(t);let r;const i=new An;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Xe.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:de.bigint,received:n.parsedType}),Ee}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Xc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Xc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Xc.create=e=>new Xc({checks:[],typeName:Ne.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Le(e)});class c0 extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==de.boolean){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.boolean,received:r.parsedType}),Ee}return Er(t.data)}}c0.create=e=>new c0({typeName:Ne.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class Uh extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==de.date){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.date,received:s.parsedType}),Ee}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_date}),Ee}const r=new An;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Xe.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Uh({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:me.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:me.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Uh.create=e=>new Uh({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ne.ZodDate,...Le(e)});class kw extends Ve{_parse(t){if(this._getType(t)!==de.symbol){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.symbol,received:r.parsedType}),Ee}return Er(t.data)}}kw.create=e=>new kw({typeName:Ne.ZodSymbol,...Le(e)});class u0 extends Ve{_parse(t){if(this._getType(t)!==de.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.undefined,received:r.parsedType}),Ee}return Er(t.data)}}u0.create=e=>new u0({typeName:Ne.ZodUndefined,...Le(e)});class d0 extends Ve{_parse(t){if(this._getType(t)!==de.null){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.null,received:r.parsedType}),Ee}return Er(t.data)}}d0.create=e=>new d0({typeName:Ne.ZodNull,...Le(e)});class Cw extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return Er(t.data)}}Cw.create=e=>new Cw({typeName:Ne.ZodAny,...Le(e)});class h0 extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Er(t.data)}}h0.create=e=>new h0({typeName:Ne.ZodUnknown,...Le(e)});class Os extends Ve{_parse(t){const n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:de.never,received:n.parsedType}),Ee}}Os.create=e=>new Os({typeName:Ne.ZodNever,...Le(e)});class Ew extends Ve{_parse(t){if(this._getType(t)!==de.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.void,received:r.parsedType}),Ee}return Er(t.data)}}Ew.create=e=>new Ew({typeName:Ne.ZodVoid,...Le(e)});class li extends Ve{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==de.array)return se(n,{code:X.invalid_type,expected:de.array,received:n.parsedType}),Ee;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(se(n,{code:o?X.too_big:X.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(se(n,{code:X.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(se(n,{code:X.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new hi(n,o,n.path,a)))).then(o=>An.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new hi(n,o,n.path,a)));return An.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new li({...this._def,minLength:{value:t,message:me.toString(n)}})}max(t,n){return new li({...this._def,maxLength:{value:t,message:me.toString(n)}})}length(t,n){return new li({...this._def,exactLength:{value:t,message:me.toString(n)}})}nonempty(t){return this.min(1,t)}}li.create=(e,t)=>new li({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ne.ZodArray,...Le(t)});function oa(e){if(e instanceof $t){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Oi.create(oa(r))}return new $t({...e._def,shape:()=>t})}else return e instanceof li?new li({...e._def,type:oa(e.element)}):e instanceof Oi?Oi.create(oa(e.unwrap())):e instanceof No?No.create(oa(e.unwrap())):e instanceof ko?ko.create(e.items.map(t=>oa(t))):e}class $t extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Xe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==de.object){const c=this._getOrReturnCtx(t);return se(c,{code:X.invalid_type,expected:de.object,received:c.parsedType}),Ee}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Os&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new hi(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Os){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(se(i,{code:X.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new hi(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>An.mergeObjectSync(r,c)):An.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return me.errToObj,new $t({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:me.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new $t({...this._def,unknownKeys:"strip"})}passthrough(){return new $t({...this._def,unknownKeys:"passthrough"})}extend(t){return new $t({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new $t({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ne.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new $t({...this._def,catchall:t})}pick(t){const n={};for(const r of Xe.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Xe.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}deepPartial(){return oa(this)}partial(t){const n={};for(const r of Xe.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new $t({...this._def,shape:()=>n})}required(t){const n={};for(const r of Xe.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Oi;)s=s._def.innerType;n[r]=s}return new $t({...this._def,shape:()=>n})}keyof(){return PT(Xe.objectKeys(this.shape))}}$t.create=(e,t)=>new $t({shape:()=>e,unknownKeys:"strip",catchall:Os.create(),typeName:Ne.ZodObject,...Le(t)});$t.strictCreate=(e,t)=>new $t({shape:()=>e,unknownKeys:"strict",catchall:Os.create(),typeName:Ne.ZodObject,...Le(t)});$t.lazycreate=(e,t)=>new $t({shape:e,unknownKeys:"strip",catchall:Os.create(),typeName:Ne.ZodObject,...Le(t)});class Wh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Wi(a.ctx.common.issues));return se(n,{code:X.invalid_union,unionErrors:o}),Ee}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new Wi(l));return se(n,{code:X.invalid_union,unionErrors:a}),Ee}}get options(){return this._def.options}}Wh.create=(e,t)=>new Wh({options:e,typeName:Ne.ZodUnion,...Le(t)});const Ni=e=>e instanceof p0?Ni(e.schema):e instanceof Eo?Ni(e.innerType()):e instanceof Kh?[e.value]:e instanceof Co?e.options:e instanceof m0?Xe.objectValues(e.enum):e instanceof Xh?Ni(e._def.innerType):e instanceof u0?[void 0]:e instanceof d0?[null]:e instanceof Oi?[void 0,...Ni(e.unwrap())]:e instanceof No?[null,...Ni(e.unwrap())]:e instanceof RT||e instanceof Qh?Ni(e.unwrap()):e instanceof Yh?Ni(e._def.innerType):[];class $_ extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==de.object)return se(n,{code:X.invalid_type,expected:de.object,received:n.parsedType}),Ee;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(se(n,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const o=Ni(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new $_({typeName:Ne.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Le(r)})}}function f0(e,t){const n=ms(e),r=ms(t);if(e===t)return{valid:!0,data:e};if(n===de.object&&r===de.object){const i=Xe.objectKeys(t),s=Xe.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=f0(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===de.array&&r===de.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=f0(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===de.date&&r===de.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Vh extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(bw(s)||bw(o))return Ee;const a=f0(s.value,o.value);return a.valid?((ww(s)||ww(o))&&n.dirty(),{status:n.value,value:a.data}):(se(r,{code:X.invalid_intersection_types}),Ee)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Vh.create=(e,t,n)=>new Vh({left:e,right:t,typeName:Ne.ZodIntersection,...Le(n)});class ko extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.array)return se(r,{code:X.invalid_type,expected:de.array,received:r.parsedType}),Ee;if(r.data.length<this._def.items.length)return se(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&r.data.length>this._def.items.length&&(se(r,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new hi(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>An.mergeArray(n,o)):An.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new ko({...this._def,rest:t})}}ko.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ko({items:e,typeName:Ne.ZodTuple,rest:null,...Le(t)})};class qh extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.object)return se(r,{code:X.invalid_type,expected:de.object,received:r.parsedType}),Ee;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new hi(r,a,r.path,a)),value:o._parse(new hi(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?An.mergeObjectAsync(n,i):An.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ve?new qh({keyType:t,valueType:n,typeName:Ne.ZodRecord,...Le(r)}):new qh({keyType:Ai.create(),valueType:t,typeName:Ne.ZodRecord,...Le(n)})}}class Nw extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.map)return se(r,{code:X.invalid_type,expected:de.map,received:r.parsedType}),Ee;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new hi(r,a,r.path,[c,"key"])),value:s._parse(new hi(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Nw.create=(e,t,n)=>new Nw({valueType:t,keyType:e,typeName:Ne.ZodMap,...Le(n)});class Yc extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.set)return se(r,{code:X.invalid_type,expected:de.set,received:r.parsedType}),Ee;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(se(r,{code:X.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(se(r,{code:X.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ee;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new hi(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new Yc({...this._def,minSize:{value:t,message:me.toString(n)}})}max(t,n){return new Yc({...this._def,maxSize:{value:t,message:me.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Yc.create=(e,t)=>new Yc({valueType:e,minSize:null,maxSize:null,typeName:Ne.ZodSet,...Le(t)});class p0 extends Ve{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}p0.create=(e,t)=>new p0({getter:e,typeName:Ne.ZodLazy,...Le(t)});class Kh extends Ve{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return se(n,{received:n.data,code:X.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:t.data}}get value(){return this._def.value}}Kh.create=(e,t)=>new Kh({value:e,typeName:Ne.ZodLiteral,...Le(t)});function PT(e,t){return new Co({values:e,typeName:Ne.ZodEnum,...Le(t)})}class Co extends Ve{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{expected:Xe.joinValues(r),received:n.parsedType,code:X.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{received:n.data,code:X.invalid_enum_value,options:r}),Ee}return Er(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Co.create(t,{...this._def,...n})}exclude(t,n=this._def){return Co.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Co.create=PT;class m0 extends Ve{_parse(t){const n=Xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==de.string&&r.parsedType!==de.number){const i=Xe.objectValues(n);return se(r,{expected:Xe.joinValues(i),received:r.parsedType,code:X.invalid_type}),Ee}if(this._cache||(this._cache=new Set(Xe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Xe.objectValues(n);return se(r,{received:r.data,code:X.invalid_enum_value,options:i}),Ee}return Er(t.data)}get enum(){return this._def.values}}m0.create=(e,t)=>new m0({values:e,typeName:Ne.ZodNativeEnum,...Le(t)});class Gh extends Ve{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==de.promise&&n.common.async===!1)return se(n,{code:X.invalid_type,expected:de.promise,received:n.parsedType}),Ee;const r=n.parsedType===de.promise?n.data:Promise.resolve(n.data);return Er(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Gh.create=(e,t)=>new Gh({type:e,typeName:Ne.ZodPromise,...Le(t)});class Eo extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{se(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Ee;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ee:l.status==="dirty"||n.value==="dirty"?Jl(l.value):l});{if(n.value==="aborted")return Ee;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Ee:a.status==="dirty"||n.value==="dirty"?Jl(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!qa(o))return Ee;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>qa(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):Ee);Xe.assertNever(i)}}Eo.create=(e,t,n)=>new Eo({schema:e,typeName:Ne.ZodEffects,effect:t,...Le(n)});Eo.createWithPreprocess=(e,t,n)=>new Eo({schema:t,effect:{type:"preprocess",transform:e},typeName:Ne.ZodEffects,...Le(n)});class Oi extends Ve{_parse(t){return this._getType(t)===de.undefined?Er(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Oi.create=(e,t)=>new Oi({innerType:e,typeName:Ne.ZodOptional,...Le(t)});class No extends Ve{_parse(t){return this._getType(t)===de.null?Er(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}No.create=(e,t)=>new No({innerType:e,typeName:Ne.ZodNullable,...Le(t)});class Xh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===de.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Xh.create=(e,t)=>new Xh({innerType:e,typeName:Ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Le(t)});class Yh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Hh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Wi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Yh.create=(e,t)=>new Yh({innerType:e,typeName:Ne.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Le(t)});class Tw extends Ve{_parse(t){if(this._getType(t)!==de.nan){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.nan,received:r.parsedType}),Ee}return{status:"valid",value:t.data}}}Tw.create=e=>new Tw({typeName:Ne.ZodNaN,...Le(e)});class RT extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class F_ extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),Jl(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ee:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new F_({in:t,out:n,typeName:Ne.ZodPipeline})}}class Qh extends Ve{_parse(t){const n=this._def.innerType._parse(t),r=i=>(qa(i)&&(i.value=Object.freeze(i.value)),i);return Hh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Qh.create=(e,t)=>new Qh({innerType:e,typeName:Ne.ZodReadonly,...Le(t)});var Ne;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ne||(Ne={}));const b=Ai.create,W=Ka.create,xe=c0.create,Bi=h0.create;Os.create;const ee=li.create,I=$t.create;Wh.create;const vi=$_.create;Vh.create;ko.create;const Nr=qh.create,Z=Kh.create,Pe=Co.create;Gh.create;Oi.create;No.create;new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");const S6=["owner"],k6=["agent","owner","user-upload"],MT=I({id:b().min(1),relPath:b().min(1),from:Pe(k6),label:b().optional(),size:W().int().nonnegative(),mime:b().min(1),addedAt:W().int().nonnegative(),lastEditedAt:W().int().nonnegative().optional(),stale:xe().optional()});I({sessionId:b().min(1),relPath:b().min(1),ttlSeconds:W().int().positive().nullable().optional(),view:Pe(["raw","md-rendered"]).optional()});I({url:b().min(1),expiresAt:W().int().nonnegative().nullable()});I({sessionId:b().min(1),relPath:b().min(1),label:b().optional(),origin:Z("agent").optional()});I({entry:MT});I({sessionId:b().min(1),relPath:b().min(1)});I({removed:Z(!0)});I({sessionId:b().min(1)});I({entries:ee(MT)});I({attachmentId:b().min(1),url:b().min(1),relPath:b().min(1),sizeBytes:W().int().nonnegative(),mimeType:b().min(1)});const C6=vi("type",[I({type:Z("persona"),id:b().min(1)}).strict(),I({type:Z("chat"),id:b().min(1)}).strict(),I({type:Z("*")}).strict()]),E6=Pe(["read","send","admin"]),H_=I({resource:C6,actions:ee(E6).min(1)}).strict(),N6=I({id:b().min(1),secretHash:b().regex(/^[a-f0-9]{64}$/),displayName:b(),grants:ee(H_),issuedAt:W().int().nonnegative(),expiresAt:W().int().positive().optional(),maxUses:W().int().positive().optional(),usedCount:W().int().nonnegative(),peerOwnerId:b().min(1).optional(),firstUsedByPeerAt:W().int().positive().optional(),peerDisplayName:b().optional()}).strict(),T6=N6.omit({secretHash:!0});I({type:Z("whoami:ok"),owner:I({id:b(),kind:Pe(["owner","guest"]),displayName:b(),ownerId:b(),provider:b()}).strict(),capability:T6,grantedPersonas:ee(I({id:b().min(1),displayName:b()}).strict())}).strict();I({selfUrl:b().min(1)});I({type:Z("contact:handshake:ok"),owner:I({id:b(),ownerId:b(),provider:b(),displayName:b()}),grants:ee(H_)});const I6=I({name:b().min(1),from:b().optional(),version:b().optional(),min:b().optional()}),P6=I({name:b().min(1),env:ee(b().min(1)).min(1)}),R6=I({name:b().min(1)}),AT={clis:ee(I6),secrets:ee(P6),assets:ee(R6)};I(AT);const jT=I({version:Z(1),...AT}).strict(),M6=I({target:b().min(1),reason:b().min(1),file:b().min(1),quote:b().min(1)}),LT=Pe(["deployer","user"]),A6=Pe(["scanning","scanFailed","draft","ready","trialing","failed","deployed"]),j6=I({errorText:b().min(1),raw:b().optional(),suggest:b().optional()}).strict(),DT=I({deployId:b().min(1),personaId:b().min(1),status:A6,scanSessionId:b().optional(),manifest:jT.optional(),evidence:ee(M6).optional(),smokeTask:b().optional(),notes:ee(b()).default([]),fulfillment:Nr(b(),LT).default({}),gaps:ee(j6).default([]),error:b().optional(),createdAt:W(),updatedAt:W()}).strict();I({personaId:b().min(1)}).strict();I({deployId:b().min(1)}).strict();I({deployId:b().min(1),patch:I({fulfillment:Nr(b(),LT).optional(),smokeTask:b().min(1).optional(),manifest:jT.optional()}).strict()}).strict();I({deployId:b().min(1),name:b().min(1),values:Nr(b(),b())}).strict();I({deployId:b().min(1),kind:Pe(["cli","secret","asset"]),item:Nr(b(),Bi()),evidence:I({reason:b().min(1),file:b().min(1),quote:b().min(1)})}).strict();I({deployId:b().min(1),smokeTask:b().min(1),notes:ee(b()).default([])}).strict();const L6=I({name:b(),filled:W(),total:W()}).strict();I({receipt:DT,secretStatus:ee(L6)}).strict();I({receipts:ee(DT)}).strict();I({deviceId:b().min(1),remoteAccessAllowed:xe()}).strict();I({type:Z("contact:setRemoteAccess:ok"),deviceId:b().min(1),remoteAccessAllowed:xe()}).strict();I({type:Z("contact:remote-access-updated"),deviceId:b().min(1),remoteAccessAllowed:xe()}).strict();const D6=I({deviceId:b().min(1),ownerId:b().min(1),provider:b().min(1),displayName:b(),remoteUrl:b().min(1),connectToken:b(),grants:ee(H_),addedAt:W().int().nonnegative(),pinnedAt:W().int().nullable().default(null),remoteAccessAllowed:xe().default(!1),note:b().default("")}).strict(),OT=D6;I({deviceId:b().min(1)}).strict();I({type:Z("contact:remove:ok"),deviceId:b().min(1)}).strict();I({type:Z("contact:list:ok"),contacts:ee(OT)}).strict();I({type:Z("contact:added"),contact:OT}).strict();I({type:Z("contact:removed"),deviceId:b().min(1)}).strict();I({deviceId:b().min(1),pinned:xe()}).strict();I({deviceId:b().min(1),note:b()}).strict();I({type:Z("contact:setNote:ok"),deviceId:b().min(1),note:b()}).strict();I({type:Z("contact:pin:ok"),deviceId:b().min(1),pinnedAt:W().int().nullable()}).strict();I({type:Z("contact:pinned"),deviceId:b().min(1),pinnedAt:W().int().nullable()}).strict();const O6=I({deviceId:b().min(1),name:b().min(1),url:b().min(1)});I({type:Z("device:list:ok"),devices:ee(O6)});I({deviceId:b().min(1),url:b().min(1).optional(),name:b().optional()});I({type:Z("device:connect:ok"),deviceId:b(),name:b(),url:b()});const BT=I({ownerId:b().min(1),provider:b().min(1),displayName:b().min(1),avatarUrl:b().optional(),unionId:b().optional()});I({type:Z("auth:login:start:ok"),authUrl:b().min(1),state:b().min(1)});I({type:Z("auth:getIdentity:ok"),identity:BT.nullable(),deviceId:b().min(1),ttcTokenExpiresAt:W().nullable().optional()});I({type:Z("auth:logout:ok")});I({type:Z("auth:login:done"),identity:BT});I({type:Z("auth:login:failed"),reason:b()});const U_=vi("kind",[I({kind:Z("success"),text:b(),brief:b().optional(),filePaths:ee(b()).optional()}),I({kind:Z("failure"),reason:b(),brief:b().optional()})]);I({targetPersona:b().min(1).optional(),dispatchId:b().min(1).optional(),prompt:b(),brief:b().optional(),targetDeviceId:b().min(1).optional(),model:b().min(1).optional(),tool:b().min(1).optional(),sessionLabel:b().min(1).max(60).optional(),meta:Nr(Bi()).optional()}).refine(e=>e.targetPersona!==void 0||e.dispatchId!==void 0,{message:"either targetPersona (new dispatch) or dispatchId (follow-up) is required"}).refine(e=>!(e.dispatchId!==void 0&&e.targetDeviceId!==void 0),{message:"cross-device dispatch cannot be continued (dispatchId + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.tool!==void 0&&e.targetDeviceId!==void 0),{message:"engine override is not supported for cross-device dispatch (tool + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.dispatchId!==void 0&&(e.tool!==void 0||e.model!==void 0)),{message:"a follow-up dispatch cannot change engine or model (dispatchId excludes tool / model); start a new dispatch instead"});I({dispatchId:b().min(1),outcome:U_});const B6=["running","completed","failed"],W_=Pe(B6),z6=I({dispatchId:b().min(1),sourceSessionId:b().min(1),sourcePersonaId:b().min(1).optional(),targetPersonaId:b().min(1),workerSessionId:b().min(1).optional(),taskText:b(),taskBrief:b().optional(),round:W().int().positive().optional(),status:W_,outcome:U_.optional(),meta:Nr(Bi()).optional(),createdAt:b().min(1),completedAt:b().min(1).optional(),deliveredAt:b().min(1).optional()});I({sourceSessionId:b().min(1).optional()});I({records:ee(z6)});I({dispatchId:b().min(1)});I({type:Z("personaDispatch:get:ok"),status:W_,outcome:U_.optional()});const $6=/^[a-z0-9][a-z0-9-]*$/;Pe(["stopped","starting","running","crashed","invalid"]);const F6=new Set(["localhost","127.0.0.1"]);function H6(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&F6.has(t.hostname))}const ud=I({id:b().regex($6),name:b().min(1),version:b().min(1),apiVersion:Z("1"),runtime:I({startCommand:b().min(1)}).passthrough().optional(),entry:I({url:b().url().refine(H6,{message:"INVALID_URL_SCHEME: only https or http://localhost is allowed"})}).strict().optional()}).passthrough().superRefine((e,t)=>{var i;const n=!!e.runtime,r=!!((i=e.entry)!=null&&i.url);n&&r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),U6=vi("kind",[I({kind:Z("local"),port:W().int().min(1).max(65535)}),I({kind:Z("hosted"),url:b().url()})]);vi("state",[I({extId:b(),manifest:ud,state:Z("stopped")}),I({extId:b(),manifest:ud,state:Z("starting")}),I({extId:b(),manifest:ud,state:Z("running"),target:U6}),I({extId:b(),manifest:ud,state:Z("crashed")}),I({extId:b(),manifest:Bi().nullable(),state:Z("invalid"),invalidReason:b().min(1)})]);I({snapshotHash:b().min(1),version:b().min(1),publishedAt:W()});const W6=vi("kind",[I({kind:Z("p2p-tunnel"),ownerPrincipalId:b().min(1),extId:b().min(1)})]);vi("kind",[I({kind:Z("p2p-tunnel"),ownerPrincipalId:b().min(1),extId:b().min(1),snapshotHash:b().min(1)})]);I({extId:b().min(1),name:b().min(1),version:b().min(1),contentHash:b().min(1),publishedAt:W()});const V6=vi("kind",[I({kind:Z("clean")}),I({kind:Z("ready-new-version"),fromVersion:b().min(1),toVersion:b().min(1)}),I({kind:Z("error-same-hash"),version:b().min(1)}),I({kind:Z("error-version-not-bumped"),localVersion:b().min(1),publishedVersion:b().min(1)}),I({kind:Z("error-version-regression"),localVersion:b().min(1),publishedVersion:b().min(1)})]);I({localManifest:I({name:b().min(1),version:b().min(1),contentHash:b().min(1)}),publishState:vi("kind",[I({kind:Z("unpublished")}),I({kind:Z("published"),version:b().min(1),contentHash:b().min(1),publishedAt:W()})]),check:V6});I({extId:b().min(1),newVersion:b().min(1).nullish()});I({extId:b().min(1)});I({extId:b().min(1),snapshotHash:b().min(1)});I({channelRef:W6,snapshotHash:b().min(1),zipBase64:b().min(1)});I({id:b().min(1),peerDeviceId:b().min(1),senderDeviceId:b().min(1),text:b().min(1),createdAt:W().int().nonnegative(),readBy:Nr(b().min(1),W().int().positive()).default({}),origin:I({kind:Z("persona"),personaId:b().min(1)}).optional()}).strict();I({peerDeviceId:b().min(1).optional(),id:b().min(1),text:b().min(1),createdAt:W().int().nonnegative(),origin:I({kind:Z("persona"),personaId:b().min(1)}).optional()}).strict();I({peerDeviceId:b().min(1),sinceCreatedAt:W().int().nonnegative().optional()}).strict();I({peerDeviceId:b().min(1),upToCreatedAt:W().int().nonnegative()}).strict();I({peerDeviceId:b().min(1).optional(),text:b().min(1)});I({peerDeviceId:b().min(1).optional(),command:b().min(1),timeoutMs:W().int().positive().optional()}).strict();I({type:Z("peerExec:run:ok"),stdout:b(),stderr:b(),exitCode:W().int().nullable(),timedOut:xe(),stdoutTruncated:xe(),stderrTruncated:xe()}).strict();const zT=vi("kind",[I({kind:Z("at"),at:b().min(1)}),I({kind:Z("every"),everyMs:W().int().positive(),anchorMs:W().int().nonnegative().optional()}),I({kind:Z("cron"),expr:b().min(1),tz:b().min(1).optional()})]),xu=b().trim().min(1);I({personaId:xu,name:b().min(1),schedule:zT,prompt:b().min(1),targetPersona:b().min(1).optional(),timeoutMs:W().int().positive().optional()});I({personaId:xu,onlyMine:xe().optional()});I({personaId:xu,shiftId:b().min(1)});const q6=I({name:b().min(1).optional(),schedule:zT.optional(),prompt:b().min(1).optional(),targetPersona:b().min(1).optional(),timeoutMs:W().int().positive().optional(),enabled:xe().optional()});I({personaId:xu,shiftId:b().min(1),patch:q6});I({personaId:xu,shiftId:b().min(1),limit:W().int().positive().optional()});const K6="persona-master",V_=I({personaId:b().min(1),deviceId:b().min(1).optional()}),$T=I({id:b().min(1),name:b().min(1),memberPersonas:ee(V_),memberContactDeviceIds:ee(b().min(1)),createdAt:b().min(1),updatedAt:b().min(1)}),FT=b().trim().min(1);I({name:FT,memberPersonas:ee(V_).default([]),memberContactDeviceIds:ee(b().min(1)).default([])});I({channelId:b().min(1),name:FT.optional(),memberPersonas:ee(V_).optional(),memberContactDeviceIds:ee(b().min(1)).optional()});I({channelId:b().min(1)});I({channels:ee($T)});I({channel:$T});I({ok:Z(!0),removedTopics:W().int().min(0)});const Sn=b().trim().min(1),G6=["planning","running","done"],X6=Pe(G6),Y6=I({at:b().min(1),actor:b().min(1),action:b().min(1),target:b().optional(),reason:b().min(1),artifacts:ee(Sn).optional()}),Q6=I({rejectCount:W().int().min(0),accepted:xe().default(!1),ordinal:W().int().min(1).optional(),overrideCount:W().int().min(0).optional()}),q_=I({id:b().min(1),channelId:b().min(1),title:b(),masterSessionId:b().min(1),goal:b(),boundaries:b(),acceptanceCriteria:ee(b()),activity:ee(Y6),lineMeta:Nr(Q6),nextLineOrdinal:W().int().min(1).optional(),state:X6,createdAt:b().min(1),updatedAt:b().min(1)}),Z6=I({lineId:b().min(1),dispatchId:b().min(1),workerSessionId:b().optional(),assignee:b().min(1),focus:b(),status:W_,acceptance:ee(b()),rejectCount:W().int().min(0),accepted:xe(),ordinal:W().int().min(1).nullable()});I({channelId:b().min(1)});I({topicId:b().min(1).optional(),sessionId:b().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});I({channelId:b().min(1),title:Sn.optional()});I({topicId:b().min(1),title:Sn.optional(),goal:Sn,boundaries:b(),acceptanceCriteria:ee(Sn).min(1)});I({topicId:b().min(1),action:Sn,target:Sn.optional(),reason:Sn,artifacts:ee(Sn).optional()});I({topicId:b().min(1),lineId:Sn,reason:Sn});I({topicId:b().min(1),lineId:Sn,reason:Sn,artifacts:ee(Sn).optional(),watcherVerdict:Pe(["pass","fail"]),overrideReason:Sn.optional()}).refine(e=>e.watcherVerdict!=="fail"||!!e.overrideReason,{message:"watcherVerdict=fail 时必须给 overrideReason(推翻 watcher 的理由)",path:["overrideReason"]});I({topicId:b().min(1),state:Pe(["done"])});I({topicId:b().min(1),title:Sn});I({topicId:b().min(1)});const J6=q_.extend({lineCount:W().int().min(0)});I({topics:ee(J6)});I({topic:q_,lines:ee(Z6)});I({topicId:b().min(1),masterSessionId:b().min(1)});I({rejectCount:W().int().min(1),needsOwnerAttention:xe()});I({acceptedLines:W().int().min(1),totalLines:W().int().min(1),allAccepted:xe(),overrides:W().int().min(0),needsOwnerAttention:xe()});I({topic:q_});I({ok:Z(!0),removedMasterSessionId:b().min(1).nullable(),removedWorkerSessionIds:ee(b().min(1))});const eB=["ask","allow","deny"],HT=Pe(eB),tB=I({id:b().min(1),desc:b().min(1),action:HT});I({rules:ee(tB)});I({ruleId:b().min(1)});I({action:HT,desc:b(),source:b().min(1)});const nB=["created","review-requested"],UT=/^[A-Za-z0-9._-]+$/,pl=b().min(1).regex(UT),ml=b().min(1).regex(UT),_u=W().int().positive();I({role:Pe(nB)});I({owner:pl,repo:ml,number:_u});I({owner:pl,repo:ml,number:_u,expectedHeadSha:b().min(1)});I({owner:pl,repo:ml,number:_u,body:b().min(1)});I({owner:pl,repo:ml,number:_u,ready:xe()});I({owner:pl,repo:ml});I({owner:pl,repo:ml,number:_u,reviewers:ee(b().min(1)).min(1)});I({personaId:b().min(1)});I({personaId:b().min(1)});const rB=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],iB=Pe(rB);I({personaId:b().min(1),appId:b().min(1),appSecret:b().min(1),botName:b().min(1).optional()});const sB=I({chatId:b().min(1),chatName:b().optional(),lastActiveAt:W().int().optional()}),oB=I({state:Pe(["unbound","provisioning","bound","broken"]),appId:b().optional(),botName:b().optional(),brokenReason:b().optional(),qrUrl:b().optional(),errorReason:iB.optional(),groups:ee(sB),needsUpgrade:xe().optional(),upgradeQrUrl:b().optional()});oB.extend({personaId:b().min(1)});I({});I({onboardingCompletedAt:W()});I({});I({tools:ee(I({id:Pe(["claude","codex"]),available:xe(),version:b().optional(),path:b().optional()}))});I({});const aB=I({tool:Pe(["claude","codex"]),cwd:b(),toolSessionId:b(),label:b().optional(),createdAt:b(),updatedAt:b(),turns:W()});I({candidates:ee(aB)});I({});I({registered:xe()});const lB=I({personaId:b(),label:b(),model:b().optional(),effort:b().optional(),public:xe(),iconKey:b().optional(),tool:b().optional(),createdAt:W(),updatedAt:W()}).strict(),cB=I({name:b().min(1),description:b().optional()}),uB=I({id:b().min(1)}),WT=I({writableRoots:ee(b()).optional(),denyRead:ee(b()).optional(),network:xe().optional()}).strict(),dB=I({permissions:I({defaultMode:b().optional(),allow:ee(b()).optional(),deny:ee(b()).optional()}).optional(),sandbox:I({enabled:xe().optional(),autoAllowBashIfSandboxed:xe().optional(),allowUnsandboxedCommands:xe().optional(),excludedCommands:ee(b()).optional(),filesystem:I({denyRead:ee(b()).optional(),allowRead:ee(b()).optional(),denyWrite:ee(b()).optional(),allowWrite:ee(b()).optional()}).optional(),network:I({allowedDomains:ee(b()).optional(),allowLocalBinding:xe().optional()}).optional()}).optional()});lB.extend({personality:b().optional(),personalityLocal:b().optional(),personalityManaged:xe().optional(),skills:ee(cB).optional(),plugins:ee(uB).optional(),sandboxSettings:dB.nullable().optional(),codexSandbox:WT.nullable().optional()});I({slug:b().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:b().min(1),personality:b(),model:b().optional(),effort:b().optional(),tool:b().optional(),public:xe().optional(),iconKey:b().optional()}).strict();I({personaId:b().min(1)});I({personaId:b().min(1),patch:I({label:b().min(1).optional(),model:b().optional(),effort:b().optional(),tool:b().optional(),personality:b().optional(),personalityLocal:b().optional(),public:xe().optional(),iconKey:b().nullable().optional(),codexSandbox:WT.optional()}).strict()}).strict();const VT=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","session:queue","permission:request","session:question","session:question:cleared","pong","error","subscribed","unsubscribed","auth:ok","tunnel:ready","tunnel:exited","tunnel:unavailable","session:control","session:pty","contact:added","contact:pinned","contact:removed","contact:remote-access-updated","contact:note-updated","org-mesh:progress","channel:changed","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","appBuilder:project-updated","appBuilder:publish-progress","appBuilder:publish-failed","larkBot:state"],qT=["idle","running","running-idle","stopped","error","observing"],hB=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools","dispatch-task","dispatch-result"];function rp(e){return e==="dispatch-task"||e==="dispatch-result"}const fB=["builtin","global","project","plugin"],pB=["builtin","global","project","policy","plugin"],KT=Pe(["owner","guest"]);I({id:b().min(1),kind:KT,displayName:b(),feishuUnionId:b().optional()}).strict();const mB=I({did:b().min(1),displayName:b(),feishuUnionId:b().optional(),principal:KT}).strict(),gB=Pe(qT),vB=I({inputTokens:W().int().nonnegative(),outputTokens:W().int().nonnegative(),cacheReadTokens:W().int().nonnegative().optional(),cacheCreateTokens:W().int().nonnegative().optional()}),GT={gitBranch:b().optional(),resolvedModel:b().optional(),resolvedEffort:b().optional(),contextUsage:vB.optional(),contextWindowSize:W().int().positive().optional(),aiLabel:b().optional()},xB=I(GT),XT=I({value:b(),label:b(),description:b().optional()}),_B=I({id:b().min(1),label:b().min(1),description:b().optional(),contextWindowSize:W().int().positive(),default:xe().optional(),efforts:ee(XT).optional(),defaultEffort:b().optional()}),yB=I({id:b().min(1),label:b().min(1),description:b().optional()}),bB=I({name:b().min(1),type:Pe(["string","select","toggle"]),label:b().min(1),description:b().optional(),options:ee(XT).optional(),default:Bi().optional(),scope:Pe(["core","tool-specific"])});I({tool:b().min(1)});const wB=I({rewind:xe(),subagents:xe(),tui:xe(),observe:xe(),fileSharing:xe(),fork:xe()});I({tool:b().min(1),toolSessionIdLabel:b().optional(),models:ee(_B),permissionModes:ee(yB),configSchema:ee(bB),features:wB});const SB=I({tool:b().min(1),pattern:b().min(1),createdAt:b().min(1).optional()});I({sessionId:b().min(1),cwd:b().min(1),tool:Z("claude").or(b().min(1)).default("claude"),toolSessionId:b().optional(),label:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),...GT,aiLabelGeneratedAt:b().optional(),permissionRules:ee(SB).optional(),pinnedAt:W().int().nonnegative().nullable().optional(),archivedAt:W().int().nonnegative().nullable().optional(),pinSortOrder:W().int().nullable().optional(),unreadAt:b().min(1).nullable().optional(),iconKey:b().optional(),forkedFromSessionId:b().min(1).optional(),ephemeral:xe().optional(),ownerPersonaId:b().min(1).optional(),projectPath:b().min(1).optional(),appBuilderProject:b().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),chatId:b().min(1).optional(),creatorPrincipalId:b().min(1).optional(),creatorDisplayName:b().min(1).optional(),creatorFeishuUnionId:b().min(1).optional(),originOwnerPrincipalId:b().min(1).optional(),originOwnerPersonaId:b().min(1).optional(),dispatchedFromSessionId:b().min(1).optional(),shiftFiredFromSessionId:b().min(1).optional(),larkChatId:b().min(1).optional(),larkChatName:b().min(1).optional(),larkChatType:Pe(["p2p","group"]).optional(),createdAt:b().min(1),updatedAt:b().min(1)});const $n={seq:W().int().nonnegative().optional(),ts:b().optional(),uuid:b().optional()},kB=Pe(hB),CB=I({readCount:W().int().nonnegative().optional(),searchCount:W().int().nonnegative().optional(),bashCount:W().int().nonnegative().optional(),editFileCount:W().int().nonnegative().optional(),linesAdded:W().int().nonnegative().optional(),linesRemoved:W().int().nonnegative().optional(),otherToolCount:W().int().nonnegative().optional()}),EB=I({oldStart:W().int().nonnegative(),oldLines:W().int().nonnegative(),newStart:W().int().nonnegative(),newLines:W().int().nonnegative(),lines:ee(b())}),NB=I({agentId:b().optional(),agentType:b().optional(),status:b().optional(),prompt:b().optional(),filePath:b().optional(),structuredPatch:ee(EB).optional(),stats:I({durationMs:W().int().nonnegative().optional(),tokens:W().int().nonnegative().optional(),toolUseCount:W().int().nonnegative().optional(),toolStats:CB.optional()}).optional()}),TB=I({path:b(),content:b(),mtimeMs:W().optional()}),IB=I({label:b().min(1),description:b().optional()}),YT=I({question:b().min(1),multiSelect:xe(),options:ee(IB).min(1)}),PB=["completed","interrupted"];vi("kind",[I({...$n,kind:Z("session_init"),toolSessionId:b().optional()}),I({...$n,kind:Z("thinking"),text:b(),partialId:b().optional()}),I({...$n,kind:Z("text"),text:b(),partialId:b().optional()}),I({...$n,kind:Z("user_text"),text:b(),meta:kB.optional(),taskId:b().optional(),parentToolUseId:b().optional(),sender:mB.optional()}),I({...$n,kind:Z("tool_call"),toolUseId:b(),tool:b(),toolKind:b().optional(),input:Bi()}),I({...$n,kind:Z("tool_result"),toolUseId:b(),output:Bi().optional(),error:b().optional(),toolResultExtra:NB.optional(),sourceToolAssistantUUID:b().optional(),askQuestionAnswers:Nr(b(),b()).optional()}),I({...$n,kind:Z("attachment_memories"),memories:ee(TB)}),I({...$n,kind:Z("permission_request"),requestId:b(),tool:b(),input:Bi(),toolUseId:b().optional()}),I({...$n,kind:Z("ask_user_question"),toolUseId:b(),questions:ee(YT)}),I({...$n,kind:Z("turn_end"),durationMs:W().int().nonnegative().optional(),reason:Pe(PB).optional()}),I({...$n,kind:Z("subagent_progress"),toolUseId:b(),agentId:b(),status:Pe(["started","running","completed","failed"]),description:b().optional(),lastToolName:b().optional(),prompt:b().optional(),stats:I({durationMs:W().int().nonnegative().optional(),tokens:W().int().nonnegative().optional(),toolUseCount:W().int().nonnegative().optional()}).optional()}),I({...$n,kind:Z("error"),message:b()}),I({...$n,kind:Z("meta_update"),patch:xB}),I({...$n,kind:Z("meta-text"),text:b(),metaSource:Pe(["cc","owner"]).optional()})]);I({cwd:b().min(1).optional(),tool:b().optional(),label:b().optional(),aiLabel:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),iconKey:b().optional(),forkedFromSessionId:b().min(1).optional(),ephemeral:xe().optional(),ownerPersonaId:b().min(1).optional(),projectPath:b().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});I({path:b().min(1),name:b().min(1),createdAt:b().datetime(),pinnedAt:W().optional()});I({path:b().min(1),pinnedAt:W().nullable()});I({path:b().min(1)});I({path:b().min(1).optional(),name:b().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});I({cwd:b().min(1),tool:b().min(1),toolSessionId:b().min(1),label:b().optional(),aiLabel:b().optional(),iconKey:b().optional(),createdAt:b().datetime(),updatedAt:b().datetime(),ownerPersonaId:b().min(1).optional()});I({originOnly:xe().optional(),ownerPersonaId:b().min(1).optional(),limit:W().int().positive().optional(),offset:W().int().nonnegative().optional()});I({sessionId:b().min(1)});I({sessionId:b().min(1),patch:I({label:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),cwd:b().optional(),iconKey:b().optional(),ephemeral:Z(!1).optional()})});I({id:b().min(1),text:b(),queuedAt:W(),senderDisplayName:b().optional()});I({sessionId:b().min(1),text:b(),queueWhileRunning:xe().optional()});I({sessionId:b().min(1),id:b().min(1).optional()});I({sessionId:b().min(1),userMessageId:b().min(1),dryRun:xe().optional()});I({canRewind:xe(),error:b().optional(),filesChanged:ee(b()).optional(),insertions:W().int().nonnegative().optional(),deletions:W().int().nonnegative().optional()});I({sessionId:b().min(1),userMessageId:b().min(1)});const RB=I({oldStart:W().int().nonnegative(),oldLines:W().int().nonnegative(),newStart:W().int().nonnegative(),newLines:W().int().nonnegative(),lines:ee(b())}),MB=I({filePath:b().min(1),hunks:ee(RB),insertions:W().int().nonnegative(),deletions:W().int().nonnegative(),status:Pe(["modified","added","deleted"]).optional()});I({canRewind:xe(),error:b().optional(),files:ee(MB),totalInsertions:W().int().nonnegative(),totalDeletions:W().int().nonnegative()});I({userMessageIds:ee(b())});I({sessionId:b().min(1),toolSessionId:b().min(1)});I({cwd:b().min(1),toolSessionId:b().min(1),messageUuid:b().min(1),targetCwd:b().min(1).optional()});I({forkedToolSessionId:b().min(1),forkedFilePath:b().min(1)});I({sessionId:b().min(1),toolSessionId:b().min(1),jsonlPath:b().optional()});I({sessionId:b().min(1),afterSeq:W().int().min(-1)});I({sessionId:b().min(1),permissionRequestId:b().min(1),allow:xe(),permanent:xe().optional(),pattern:b().optional()});I({projectPath:b().min(1)});I({sessionId:b().min(1),limit:W().int().positive().max(5e3).optional(),offset:W().int().nonnegative().optional(),slim:xe().optional()});I({cwd:b().min(1),toolSessionId:b().min(1)});I({cwd:b().min(1),toolSessionId:b().min(1),subagentId:b().min(1)});I({cwd:b().min(1).optional(),path:b().optional(),showHidden:xe().optional()});I({cwd:b().min(1),path:b().min(1)});I({cwd:b().min(1),tool:b().optional()});I({name:b().min(1),source:Pe(fB),path:b().optional(),description:b().optional(),plugin:b().optional()});const AB=I({name:b().min(1),source:Pe(pB),path:b().optional(),description:b().optional(),whenToUse:b().optional(),plugin:b().optional()});I({cwd:b().min(1),tool:b().optional()});I({agents:ee(AB)});I({sessionId:b().optional()});I({sessionId:b().min(1).optional()});I({sessionId:b().min(1),pinned:xe()});I({sessionId:b().min(1),archived:xe()});I({query:b().min(1),sessionIds:ee(b().min(1)),limit:W().int().positive().max(50).optional()});const jB=I({sessionId:b().min(1),snippet:b()});I({type:Z("session:searchContent"),matches:ee(jB)});I({type:Z("peerSession:upsert:ok")});I({sessionId:b().min(1)});I({type:Z("peerSession:remove:ok")});I({orderedIds:ee(b().min(1)).min(1)});I({cwd:b().min(1)});I({isGitRoot:xe(),gitRoot:b().nullable()});I({cwd:b().min(1)});I({branch:b().nullable()});I({cwd:b().min(1)});I({branches:ee(b()),head:b().nullable()});const LB=I({cwd:b().min(1),updatedAt:b().min(1)});I({dirs:ee(LB)});I({type:Z("session:question"),sessionId:b().min(1),toolUseId:b().min(1),requestId:b().min(1),questions:ee(YT).min(1)});I({type:Z("session:question:cleared"),sessionId:b().min(1),toolUseId:b().min(1),answers:Nr(b(),b()).optional()});I({sessionId:b().min(1),toolUseId:b().min(1),answers:Nr(b(),b())});I({ok:Z(!0)});I({sessionId:b().min(1),toolUseId:b().min(1)});I({ok:Z(!0)});const QT=I({name:b().min(1),version:b().min(1),instanceId:b().min(1),deviceLabel:b().transform(e=>e.trim().slice(0,64)).optional()});I({type:Z("auth"),token:b().min(1),scheme:Z("bearer").optional(),clientInfo:QT.optional()});I({type:Z("auth:ok"),version:b().min(1).optional(),protocolVersion:W().int().nonnegative().optional()});const DB=I({clientId:b().min(1),connectedAt:W().int().nonnegative(),self:xe(),clientInfo:QT.optional()});I({type:Z("device:connections:ok"),connections:ee(DB)});I({type:Z("tunnel:ready"),url:b().min(1),subdomain:b().min(1)});I({type:Z("tunnel:exited"),code:W().int().nullable(),subdomain:b().nullable(),url:b().nullable()});I({type:Z("tunnel:unavailable"),reason:b().min(1),failedAt:b().min(1)});const OB=I({sessionId:b().min(1),status:gB,freshSpawn:xe(),pendingPermissionRequestIds:ee(b().min(1)),pendingQuestionToolUseIds:ee(b().min(1))});I({type:Z("info"),version:b(),protocolVersion:W(),hostname:b(),os:b(),tools:ee(I({id:b(),available:xe()})),runningSessions:ee(OB),tokenRole:Pe(S6).optional(),isLoopback:xe().optional(),httpBaseUrl:b().optional(),httpToken:b().optional(),daemonSource:Pe(["ota","packaged"]).optional(),globalCliVersion:b().nullable().optional()});const BB=6173,zB=6272,gl=/^[a-z][a-z0-9-]{0,39}$/,yu=I({name:b().regex(gl,{message:"kebab-case, 小写字母开头,只允许小写字母 / 数字 / -,最长 40 字符"}),port:W().int().min(BB).max(zB),createdAt:b().datetime(),devCommand:b().min(1),prodUrl:b().url().optional(),readyPattern:b().optional(),publishJob:I({jobId:b().min(1),stage:Pe(["build","deploy","verify"]),startedAt:W().int().nonnegative()}).optional()}),$B=["install-pending","installing","starting-dev-server","running","stopped","failed"],ZT=Pe($B),K_=yu.extend({isRunning:xe(),boundSessionId:b().nullable(),stage:ZT.optional(),stageReason:b().optional(),publishJob:I({jobId:b().min(1),stage:Pe(["build","deploy","verify"]),startedAt:W().int().nonnegative(),status:Pe(["in-flight","interrupted"])}).optional()});I({}).strict();I({projects:ee(K_)}).strict();I({sessionId:b().min(1)}).strict();I({project:K_.nullable()}).strict();I({sessionId:b().min(1),name:b().min(1)}).strict();I({project:yu}).strict();I({name:b()}).strict();I({}).strict();I({name:b(),newPort:W().int()}).strict();I({project:yu}).strict();I({name:b().regex(gl),url:b().url()}).strict();I({project:yu}).strict();I({sessionId:b().min(1),force:xe().optional()}).strict();I({project:yu}).strict();const FB=["installing","failed"];I({sessionId:b().min(1),stage:Pe(FB),reason:b().optional()}).strict();I({ok:Z(!0)}).strict();I({sessionId:b().min(1)}).strict();I({ok:Z(!0)}).strict();I({type:Z("appBuilder:project-updated"),project:K_,stage:ZT,stageReason:b().optional()}).strict();I({name:b().regex(gl)});I({jobId:b().min(1),status:Pe(["started","already-publishing"])}).strict();I({name:b().regex(gl)});I({ok:Z(!0)}).strict();I({type:Z("appBuilder:publish-progress"),name:b().regex(gl),jobId:b().min(1),stage:Pe(["build","deploy","verify"]),status:Pe(["started","completed"])}).strict();I({type:Z("appBuilder:publish-failed"),name:b().regex(gl),jobId:b().min(1),stage:Pe(["build","deploy","verify","unknown"]),errorSummary:b()}).strict();I({});I({method:b().min(1).optional()});const HB=["allowed","conditional","denied"],UB=Pe(HB),WB=I({name:b().min(1),status:UB,description:b().min(1),args:ee(I({name:b(),required:xe()})).nullable(),argsSchema:Nr(Bi()).optional(),reason:b().optional()});I({type:Z("meta:methods"),methods:ee(WB)});const Iw=1,VB=["daemon","main","renderer"],qB=Pe(VB),KB=["debug","info","warn","error"],GB=Pe(KB);I({ts:W().int(),source:qB,level:GB,msg:b(),ownerPrincipalId:b(),deviceId:b(),appVersion:b(),daemonVersion:b().optional(),os:b(),meta_json:b().optional(),sessionId:b().optional()});I({v:Z(1),visitorId:b().min(1),displayName:b(),provider:b(),iat:W(),exp:W()});const XB=I({visitorId:b(),displayName:b(),avatarUrl:b().optional(),provider:b(),firstSeen:W(),lastSeen:W()});I({visitors:ee(XB)});const YB=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,JT=/<system-reminder>此消息来自 (owner|guest):(.+?)<\/system-reminder>\s*$/,QB="clawd-dispatch-task",ZB="clawd-dispatch-result",Pw=120;function JB(e){if(!e)return[];const t=[];for(const n of["task","result"]){const r=n==="task"?QB:ZB,i=new RegExp(`<${r}\\b([^>]*)>([\\s\\S]*?)</${r}>`,"gi");for(let s=i.exec(e);s!==null;s=i.exec(e))t.push({at:s.index,block:ez(n,s[1]??"",s[2]??"")})}return t.sort((n,r)=>n.at-r.at).map(n=>n.block)}function ez(e,t,n){var c;const r=az(t),i=g0(oz(Rm(n,"detail")??n)),s=(c=Rm(n,"brief"))==null?void 0:c.trim(),o=s&&s.length>0?g0(s):tz(i),a=r.round!==void 0?Number.parseInt(r.round,10):void 0,l=r.status;return{kind:e,dispatchId:r["dispatch-id"]??"",...r.from?{from:r.from}:{},...e==="task"&&a!==void 0&&Number.isFinite(a)?{round:a}:{},...e==="result"&&(l==="success"||l==="failure")?{status:l}:{},brief:o,briefIsDerived:!(s&&s.length>0),detail:i,filePaths:sz(Rm(n,"files"))}}function tz(e){const t=e.split(/\n\s*\n/).map(r=>r.trim()).find(r=>r.length>0);if(!t)return"";const n=t.replace(/\s+/g," ");return n.length>Pw?`${n.slice(0,Pw)}…`:n}const nz="clawd-dispatch-task|clawd-dispatch-result|brief|detail|files",rz=new RegExp(`<\\\\(\\\\*)(/?)(${nz})\\b`,"g");function iz(e){return g0(e)}function g0(e){return e.replace(rz,"<$1$2$3")}function Rm(e,t){const n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`,"i").exec(e);return n?n[1]??"":null}function sz(e){return e?e.split(`
|
|
96
|
-
`).map(t=>t.trim()).filter(t=>t.startsWith("- ")).map(t=>t.slice(2).trim()).filter(t=>t.length>0):[]}function oz(e){return e.replace(/^\n/,"").replace(/\n$/,"")}function az(e){const t={},n=/([a-z-]+)="([^"]*)"/gi;for(let r=n.exec(e);r!==null;r=n.exec(e))t[r[1]]=lz(r[2]??"");return t}function lz(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}const cz=new Set(["localhost","127.0.0.1","0.0.0.0","::1"]);let ki=null;function uz(){if(ki!==null)return ki;if(typeof window>"u")return ki=!1,!1;if(cz.has(window.location.hostname)||window.location.protocol==="file:")return ki=!0,!0;if(new URLSearchParams(window.location.search).get("debug")==="1"){ki=!0;try{sessionStorage.setItem("debug","1")}catch{}}else try{ki=sessionStorage.getItem("debug")==="1"}catch{ki=!1}return ki}function Ae(e,...t){uz()&&console.log(`[${e}][${new Date().toISOString()}]`,...t)}function dd(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const dz=e=>{const t=[1e3,2e3,4e3,8e3,16e3,3e4];return t[Math.min(e,t.length-1)]},hz=new Set(["auth:ok","pong","error"]),Rw=new Set(VT.filter(e=>!hz.has(e)));let fz=0;const Mw=()=>`r${++fz}`;function pz(e){let t=e.url,n=e.authToken,r=e.selfIdentity;const i=e.clientInfo,s=e.requestTimeoutMs??3e4,o=e.pingIntervalMs??3e4,a=e.watchdogMs??6e4,l=e.authTimeoutMs??1e4,c=e.backoffMs??dz;let u=null,d=!1,f=0,p=null,m=null,v=null,w=null,x=!1,_="disconnected";const y=new Map,S=new Map;let C=null;const k=(B,E)=>{var H;B==="ready"&&(C=E),(H=S.get(B))==null||H.forEach(q=>{try{q(E)}catch{}})},N=B=>{_!==B&&(_=B,k("status",B))},T=(B,E)=>{const H=S.get(B)??new Set;if(H.add(E),S.set(B,H),B==="ready"&&C!==null)try{E(C)}catch{}return()=>H.delete(E)},z=()=>{m&&(clearInterval(m),m=null),v&&(clearTimeout(v),v=null),w&&(clearTimeout(w),w=null)},P=()=>{v&&clearTimeout(v),v=setTimeout(()=>{try{u==null||u.close(4e3,"pong watchdog")}catch{}},a)},O=()=>{m&&clearInterval(m),m=setInterval(()=>{(u==null?void 0:u.readyState)===1&&u.send(JSON.stringify({type:"ping",requestId:Mw()}))},o),P()},M=B=>{for(const[,E]of y)clearTimeout(E.timer),E.reject(new Error(B));y.clear()},R=[],A=()=>{if(R.length===0)return;const B=R.splice(0);for(const E of B)(u==null?void 0:u.readyState)===1&&!x?E.doSend():(clearTimeout(E.timer),E.reject(new Error("NOT_CONNECTED")))},L=B=>{if(R.length===0)return;const E=R.splice(0);for(const H of E)clearTimeout(H.timer),H.reject(new Error(B))},$=()=>{if(d)return;const B=c(f);if(B<0){L("connection closed: not reconnecting");return}k("daemon:reconnecting",{attempt:f+1,nextDelayMs:B,scheduledAt:Date.now()}),p&&clearTimeout(p),p=setTimeout(()=>{f+=1,D()},B)},F=B=>{P();const E=String(B.type??"");if(E==="auth:ok"){Ae("daemon-client","auth:ok received → connected",{url:t}),w&&(clearTimeout(w),w=null),x=!1,f=0,N("connected"),k("daemon:connected",{url:t}),O(),A();return}if(E==="pong")return;if(E==="ready"){const q=Number(B.protocolVersion??-1);q!==Iw&&k("daemon:version-mismatch",{daemonProtocol:q,supportedProtocol:Iw}),k("ready",B);return}const H=B.requestId;if(typeof H=="string"&&y.has(H)){const q=y.get(H);if(y.delete(H),clearTimeout(q.timer),E==="error"){const j=String(B.code??"ERR"),ne=String(B.message??"unknown");q.reject(new Error(`${j}: ${ne}`))}else Rw.has(E)&&k(E,B),q.resolve(B);return}Rw.has(E)&&k(E,B)},D=()=>{p&&(clearTimeout(p),p=null),Ae("daemon-client","connect →",{url:t,token:dd(n),attempt:f}),N("connecting");let B;try{B=new WebSocket(t)}catch(E){N("disconnected"),k("daemon:disconnected",{reason:(E==null?void 0:E.message)??"ws constructor failed"}),$();return}u=B,x=!!n,B.onopen=()=>{if(B!==u){Ae("daemon-client","onopen → stale (replaced before opened), ignore");return}if(n){Ae("daemon-client","onopen → send auth frame",{token:dd(n)});const E={type:"auth",token:n};r!=null&&r.principalId&&(E.selfPrincipalId=r.principalId),r!=null&&r.displayName&&(E.selfDisplayName=r.displayName),i&&(E.clientInfo=i),B.send(JSON.stringify(E)),w=setTimeout(()=>{try{B.close(4001,"auth handshake timeout")}catch{}},l)}else Ae("daemon-client","onopen → no token, treat as connected (daemon authMode=none)"),f=0,N("connected"),k("daemon:connected",{url:t}),O(),A()},B.onclose=E=>{if(B!==u){Ae("daemon-client","onclose → stale, ignore",{code:E.code,reason:E.reason});return}const H=E.reason||(E.code===1008?"auth failed":`close ${E.code}`);if(Ae("daemon-client","onclose →",{code:E.code,reason:H,awaitingAuth:x,manualStop:d}),z(),M(`connection closed: ${H}`),u=null,E.code===4401?N("revoked"):N("disconnected"),k("daemon:disconnected",{reason:H}),E.code===1008||E.code===4401){L(`connection closed: ${H}`);return}d?L(`connection closed: ${H}`):$()},B.onerror=()=>{},B.onmessage=E=>{if(B!==u)return;let H;try{H=JSON.parse(String(E.data))}catch{return}F(H)}};return{start(){d=!1,f=0,D()},stop(){d=!0,p&&(clearTimeout(p),p=null),z();try{u==null||u.close(1e3,"shutdown")}catch{}u=null,M("shutdown"),L("shutdown"),N("disconnected")},switchProfile(B){Ae("daemon-client","switchProfile →",{url:B.url,token:dd(B.authToken)},"prev:",{url:t,token:dd(n)}),t=B.url,n=B.authToken,B.selfIdentity!==void 0&&(r=B.selfIdentity),f=0,d=!0,p&&(clearTimeout(p),p=null),z(),M("switch profile"),L("switch profile");try{u==null||u.close(1e3,"switch profile")}catch{}u=null,d=!1,D()},request(B,E){return new Promise((H,q)=>{const j=Mw(),ne=setTimeout(()=>{y.delete(j);const K=R.findIndex(_e=>_e.timer===ne);K>=0&&R.splice(K,1),q(new Error(`request timeout: ${B}`))},s),ie=()=>{y.set(j,{resolve:K=>H(K),reject:q,timer:ne}),u.send(JSON.stringify({...E,type:B,requestId:j}))};(u==null?void 0:u.readyState)===1&&!x?ie():d||u==null&&p==null?(clearTimeout(ne),q(new Error("NOT_CONNECTED"))):R.push({doSend:ie,reject:q,timer:ne})})},on:T,get isOpen(){return(u==null?void 0:u.readyState)===1&&!x},get url(){return t},getStatus(){return _}}}function mz(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}function gz(e){return e?{id:e.id,mode:e.mode,url:e.url,token:mz(e.token),name:e.name}:null}function hd(e){return e?Array.isArray(e)?e.map(gz):{_notArray:typeof e,_value:e}:null}function Aw(e){return e==null?null:typeof e=="object"&&"value"in e?e.value:e}const vz="ws://127.0.0.1:18790",jw="daemon:profiles",Lw="daemon:active-profile-id";function xz(){return Math.random().toString(36).slice(2,10)}function _z(e){const t=e.trim(),n=t.indexOf("#");if(n<0)return{url:t};const r=t.slice(0,n),i=new URLSearchParams(t.slice(n+1)).get("token")??void 0;return{url:r,token:i}}function yz(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.name=="string"&&(t.mode==="localhost"||t.mode==="remote")&&typeof t.url=="string"&&(t.token===void 0||typeof t.token=="string")}function eI(e){let t={profiles:[],activeId:null},n=!1,r=null;const i=new Set,s=()=>{for(const l of i)l(t)},o=async()=>{Ae("profile-store","persist →",hd(t.profiles),"active:",t.activeId),await e.kv.set(jw,t.profiles),await e.kv.set(Lw,t.activeId)},a=async()=>{if(!n){if(r){await r;return}r=(async()=>{var l;try{let c=null;try{const d=await e.kv.get(jw);c=Aw(d)}catch{c=null}let u=null;try{const d=await e.kv.get(Lw);u=Aw(d)??null}catch{u=null}if(Ae("profile-store","ensureLoaded read kv →","profiles:",hd(c),"activeId:",u),Array.isArray(c)&&c.length>0){const d=c.filter(yz),f=u&&d.some(p=>p.id===u)?u:((l=d[0])==null?void 0:l.id)??null;t={profiles:d,activeId:f},n=!0,Ae("profile-store","ensureLoaded → use kv profiles",hd(d),"active:",f);return}t={profiles:[{id:"default",name:"本机",mode:"localhost",url:vz}],activeId:"default"},Ae("profile-store","ensureLoaded → fallback synthesized default (NO token)",hd(t.profiles)),n=!0,await o()}finally{r=null}})(),await r}};return{async load(){return await a(),s(),t},async snapshot(){return await a(),t},async upsert(l){var w;await a();let c=l.url,u=l.token;if(c&&c.includes("#")){const x=_z(c);c=x.url,!u&&x.token&&(u=x.token)}const d=l.id?t.profiles.find(x=>x.id===l.id):void 0,f=u!=null&&u.trim()?u.trim():d==null?void 0:d.token;if(l.mode==="remote"&&!f)throw new Error("remote mode requires token");const p=l.id??xz(),m={id:p,name:((w=l.name)==null?void 0:w.trim())||(d==null?void 0:d.name)||(l.mode==="remote"?"远程":"本机"),mode:l.mode,url:c.trim(),token:f};return t={profiles:[...t.profiles.filter(x=>x.id!==p),m],activeId:p},await o(),s(),m},async delete(l){var d;await a();const c=t.profiles.filter(f=>f.id!==l);let u=t.activeId;u===l&&(u=((d=c[0])==null?void 0:d.id)??null),t={profiles:c,activeId:u},await o(),s()},async activate(l){await a(),t.profiles.some(c=>c.id===l)&&(t={...t,activeId:l},await o(),s())},subscribe(l){return i.add(l),()=>i.delete(l)},getActive(){return n?t.profiles.find(l=>l.id===t.activeId)??null:null}}}const Dw="clawd.client-instance-id";let bz={name:"clawd-web",version:"unknown"};function wz(){let e=null;try{e=localStorage.getItem(Dw),e||(e=crypto.randomUUID(),localStorage.setItem(Dw,e))}catch{e=e??crypto.randomUUID()}return{...bz,instanceId:e}}function Ow(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const tI=g.createContext(null);function Sz({host:e,children:t}){const[n,r]=g.useState(null),i=g.useMemo(()=>async()=>{const s=eI(e),o=await s.load(),a=o.profiles.find(c=>c.id===o.activeId)??o.profiles[0];if(!a)throw new Error("DaemonProvider: profile store has no profiles after load");return Ae("daemon-context","bootstrap → createDaemonClient",{id:a.id,url:a.url,token:Ow(a.token)}),{client:pz({url:a.url,authToken:a.token,clientInfo:wz()}),store:s}},[e]);return g.useEffect(()=>{let s=!0,o=null,a=null;return i().then(l=>{s&&(l.client.start(),o=l,r(l),a=l.store.subscribe(()=>{const c=l.store.getActive();if(!c){Ae("daemon-context","subscribe → no active profile, skip switchProfile");return}Ae("daemon-context","subscribe → switchProfile",{id:c.id,url:c.url,token:Ow(c.token)}),l.client.switchProfile({url:c.url,authToken:c.token})}))}),()=>{s=!1,a==null||a(),o==null||o.client.stop()}},[i]),n?h.jsx(tI.Provider,{value:n,children:t}):null}function xi(){const e=g.useContext(tI);if(!e)throw new Error("useDaemonClient must be used inside <DaemonProvider>");return e.client}function kz(){const e=xi(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i.mode,o=s==="tui"?"tui":"sdk";Ae("daemon-context","useDaemonMode ready.mode =",{rawMode:s,resolved:o}),n(o)}),[e]),t}function Cz(){const e=xi(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i;s.version!==void 0&&n(s.principalKind==="guest"?"guest":"owner")}),[e]),t}const nI=g.createContext(null);function Ez({cache:e,children:t}){return g.createElement(nI.Provider,{value:e},t)}function zo(){const e=g.useContext(nI);if(!e)throw new Error("useCache must be used inside <CacheProvider>");return e}function fi(e){const t=zo(),n=g.useCallback(i=>t.observe(e,()=>i()),[t,e]),r=g.useCallback(()=>t.read(e),[t,e]);return g.useSyncExternalStore(n,r,r)}const rI={actionsLevel:"none",httpBaseUrl:null,httpToken:null},iI=g.createContext(rI);function ip(){return g.useContext(iI)}function Nz(e){return e!=null&&e.httpBaseUrl?{actionsLevel:e.tokenRole==="owner"?"owner":"none",httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken??null}:rI}function Tz(){const e=fi("daemon-info");return g.useMemo(()=>Nz(e),[e])}function Iz({children:e}){const t=Tz();return Ze.createElement(iI.Provider,{value:t},e)}function Pz(e,t,n){if(!e.httpBaseUrl)return null;const r=encodeURIComponent(n);return`${e.httpBaseUrl}/session/${encodeURIComponent(t.sessionId)}/files?path=${r}`}function Rz(e){const t=new Map;return{observe(n,r){let i=t.get(n);i||(i={data:void 0,hasData:!1,listeners:new Set},t.set(n,i));const s=l=>r(l);i.listeners.add(s);const o=i.listeners.size===1;s(i.hasData?i.data:void 0),o&&e.onFirstObserver(n);let a=!1;return()=>{if(a)return;a=!0;const l=t.get(n);l&&(l.listeners.delete(s),l.listeners.size===0&&(t.delete(n),e.onLastObserver(n)))}},read(n){const r=t.get(n);return r!=null&&r.hasData?r.data:void 0},setData(n,r){const i=t.get(n);if(!i)return;const s=i.hasData?i.data:void 0,o=r(s);i.data=o,i.hasData=!0;for(const a of i.listeners)a(o)}}}function Mz(){const e=[],t=new Map,n=r=>{for(const i of e)if(i.pattern.test(r))return i.source;return null};return{register(r,i){e.push({pattern:r,source:i})},activate(r){if(t.has(r))return;const i=n(r);if(!i)throw new Error(`no source registered for key: ${r}`);t.set(r,i.start(r))},deactivate(r){const i=t.get(r);i&&(t.delete(r),i())}}}function Az(e){return{request:(t,n)=>e.request(t,n),onFrame(t){const n=[];for(const r of VT)n.push(e.on(r,i=>t(r,i)));return()=>{for(const r of n)r()}},onConnect(t){return e.on("daemon:connected",()=>t())},get isConnected(){return e.isOpen}}}function sI(e){const t=(e??"claude")==="claude";return{rewind:t,subagents:t,tui:t,observe:t,fileSharing:t,fork:t}}const jz=e=>({tool:e,models:[{id:"",label:"未指定",contextWindowSize:2e5,default:!0}],permissionModes:[{id:"",label:"未指定"}],configSchema:[],features:sI(e)});function Lz(e,t){return{start(n){const r=n.replace(/^capabilities\//,"");let i=!1;const s=async()=>{try{const a=await e.request("capabilities:get",{tool:r});if(i)return;t(n,()=>a)}catch{if(i)return;t(n,()=>jz(r))}},o=e.onConnect(()=>{s()});return s(),()=>{i=!0,o()}}}}function Dz(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("session:list",void 0);if(r)return;t(n,()=>a.sessions??[])}catch{}},s=e.onFrame((a,l)=>{if(a==="session:info"){const c=l;if(c.chatId!==void 0)return;t(n,u=>[c,...(u??[]).filter(d=>d.sessionId!==c.sessionId)])}else if(a==="session:deleted"){const c=l;t(n,u=>(u??[]).filter(d=>d.sessionId!==c.sessionId))}}),o=e.onConnect(()=>{i()});return i(),()=>{r=!0,s(),o()}}}}const Qc={sessionId:null,events:[],lastSeq:-1,pendingPermissions:[],status:"idle",pendingQuestions:{},queued:[]};function Mm(e,t){const n=t;if(n.kind==="permission_request"&&typeof n.requestId=="string"){if(e.some(i=>i.requestId===n.requestId))return e;const r={requestId:n.requestId,tool:typeof n.tool=="string"?n.tool:"",input:n.input,...typeof n.toolUseId=="string"&&n.toolUseId?{toolUseId:n.toolUseId}:{}};return[...e,r]}if(n.kind==="tool_result"&&typeof n.toolUseId=="string"&&n.toolUseId){const r=e.findIndex(i=>i.toolUseId===n.toolUseId);if(r>=0)return e.filter((i,s)=>s!==r)}return e}function oI(e,t,n){const r=n===void 0?e.sessionId:n;switch(t.type){case"session:change":return{...Qc,sessionId:t.sessionId};case"session:event":{if(!r||t.sessionId!==r)return e;const i=typeof t.event.seq=="number"?t.event.seq:-1,s=[...e.events,t.event],o=i>e.lastSeq?i:e.lastSeq,a=Mm(e.pendingPermissions,t.event);return{...e,events:s,lastSeq:o,pendingPermissions:a}}case"session:status":return!r||t.sessionId!==r?e:{...e,status:t.status};case"session:queue":return!r||t.sessionId!==r?e:{...e,queued:t.items};case"session:events":{if(!r||t.sessionId!==r)return e;const i=t.events.map(o=>o.event),s=i.reduce((o,a)=>Mm(o,a),[]);return{...e,sessionId:t.sessionId,events:i,lastSeq:t.latestSeq,pendingPermissions:s}}case"session:events:append":{if(!r||t.sessionId!==r)return e;const i=new Set;for(const c of e.events){const u=c.seq;typeof u=="number"&&i.add(u)}const s=[];for(const c of t.events)typeof c.seq=="number"&&(i.has(c.seq)||s.push(c.event));const o=t.latestSeq>e.lastSeq?t.latestSeq:e.lastSeq;if(s.length===0)return o===e.lastSeq?e:{...e,lastSeq:o};const a=[...e.events,...s].sort((c,u)=>{const d=c.seq??-1,f=u.seq??-1;return d-f}),l=s.reduce((c,u)=>Mm(c,u),e.pendingPermissions);return{...e,events:a,lastSeq:o,pendingPermissions:l}}case"permission:request":{if(!r||t.sessionId!==r||e.pendingPermissions.some(s=>s.requestId===t.requestId))return e;const i={requestId:t.requestId,tool:t.tool,input:t.input,...t.toolUseId?{toolUseId:t.toolUseId}:{}};return{...e,pendingPermissions:[...e.pendingPermissions,i]}}case"permission:clear":{if(!r||r!==t.sessionId)return e;const i=t.requestId,s=e.pendingPermissions.findIndex(c=>c.requestId===i),o=s>=0?e.pendingPermissions.filter((c,u)=>u!==s):e.pendingPermissions;if(e.events.length===0)return o===e.pendingPermissions?e:{...e,pendingPermissions:o};const a=e.events.length-1,l=e.events[a];return l.kind==="permission_request"&&l.requestId===i?{...e,pendingPermissions:o,events:e.events.slice(0,a)}:o===e.pendingPermissions?e:{...e,pendingPermissions:o}}case"session:question":return!r||t.sessionId!==r?e:{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{toolUseId:t.toolUseId,requestId:t.requestId,questions:t.questions}}};case"session:question:clear":{if(!r||t.sessionId!==r||!(t.toolUseId in e.pendingQuestions))return e;const{[t.toolUseId]:i,...s}=e.pendingQuestions;return{...e,pendingQuestions:s}}case"session:question:submitted":{if(!r||t.sessionId!==r)return e;const i=e.pendingQuestions[t.toolUseId];return i?{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{...i,submittedAnswers:t.answers}}}:e}case"session:rewound":return!r||t.sessionId!==r?e:{...e,pendingPermissions:[],status:"idle"};case"ready":{if(!r)return e;const i=t.runningSessions.find(o=>o.sessionId===r);if(i!=null&&i.freshSpawn)return{...Qc,sessionId:r};const s=(i==null?void 0:i.status)??"idle";return s===e.status?e:{...e,status:s}}case"daemon:disconnected":return{...e,pendingPermissions:[]};default:return e}}const Oz="session/";function Bz(e){return{sid:e.slice(Oz.length)}}const zz=new Set(qT);function aI(e){return zz.has(e)}function Bw(e){return aI(e)?e:"idle"}function $z(e,t){return{start(n){const{sid:r}=Bz(n);let i=!1,s=-1;const o=f=>{t(n,p=>oI(p??Qc,f,r))},a=async f=>{const p=f==="baseline"?-1:s;try{const m=await e.request("session:events",{sessionId:r,afterSeq:p});if(i)return;const v=m.events??[],w=m.latestSeq??-1;if(f==="baseline")o({type:"session:events",sessionId:r,events:v,latestSeq:w}),s=w;else{const x=m.bufferStartSeq??0,_=w<p||x>p+1;o({type:_?"session:events":"session:events:append",sessionId:r,events:v,latestSeq:w}),s=Math.max(s,w)}}catch{}},l=async()=>{try{const f=await e.request("info");if(i)return;o({type:"ready",runningSessions:(f.runningSessions??[]).map(p=>({sessionId:p.sessionId,freshSpawn:p.freshSpawn,status:Bw(p.status)}))})}catch{}},c=async()=>{try{await e.request("session:subscribe",{sessionId:r})}catch{}i||(await a(s<0?"baseline":"delta"),!i&&await l())},u=e.onFrame((f,p)=>{if(!i)if(f==="session:event"){const m=p;if(m.sessionId!==r)return;const v=m.event.seq;Ae("session-events","push session:event",{sid:r,kind:m.event.kind,seq:v,lastSeqBefore:s}),o({type:"session:event",sessionId:m.sessionId,event:m.event}),typeof v=="number"&&v>s&&(s=v)}else if(f==="session:status"){const m=p;if(m.sessionId!==r)return;if(!aI(m.status)){Ae("session-events","push session:status drop",{sid:r,status:m.status});return}Ae("session-events","push session:status",{sid:r,status:m.status}),o({type:"session:status",sessionId:m.sessionId,status:m.status})}else if(f==="session:cleared"){if(p.sessionId!==r)return;Ae("session-events","push session:cleared",{sid:r}),o({type:"session:change",sessionId:r}),s=-1}else if(f==="session:queue"){const m=p;if(m.sessionId!==r)return;Ae("session-events","push session:queue",{sid:r,count:m.items.length}),o({type:"session:queue",sessionId:m.sessionId,items:m.items})}else if(f==="permission:request"){const m=p;if(m.sessionId!==r)return;o({type:"permission:request",sessionId:m.sessionId,requestId:m.requestId,tool:m.tool,input:m.input,...typeof m.toolUseId=="string"&&m.toolUseId?{toolUseId:m.toolUseId}:{}})}else if(f==="session:question"){const m=p;if(m.sessionId!==r)return;o({type:"session:question",sessionId:m.sessionId,toolUseId:m.toolUseId,requestId:m.requestId,questions:m.questions})}else if(f==="session:question:cleared"){const m=p;if(m.sessionId!==r)return;m.answers&&Object.keys(m.answers).length>0?o({type:"session:question:submitted",sessionId:m.sessionId,toolUseId:m.toolUseId,answers:m.answers}):o({type:"session:question:clear",sessionId:m.sessionId,toolUseId:m.toolUseId})}else if(f==="session:rewound"){const m=p;if(m.sessionId!==r)return;o({type:"session:rewound",sessionId:m.sessionId,userMessageId:m.userMessageId})}else f==="ready"&&o({type:"ready",runningSessions:(p.runningSessions??[]).map(v=>({sessionId:v.sessionId,freshSpawn:v.freshSpawn,status:Bw(v.status)}))})}),d=e.onConnect(()=>{c()});return e.isConnected&&c(),()=>{i=!0,u(),d(),e.request("session:unsubscribe",{sessionId:r}).catch(()=>{})}}}}const Fz=new Set(["tunnel:ready","tunnel:exited","tunnel:unavailable"]);function Hz(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("info",void 0);if(r)return;t(n,()=>a)}catch{}},s=e.onConnect(()=>{i()}),o=e.onFrame(a=>{Fz.has(a)&&i()});return i(),()=>{r=!0,s(),o()}}}}function Uz(){return{start(){return()=>{}}}}function Wz(e,t){return{start(n){let r=!1;const i=async()=>{try{const o=await e.request("persona:list",{});if(r)return;t(n,()=>o.personas??[])}catch{}},s=e.onConnect(()=>{i()});return i(),()=>{r=!0,s()}}}}function Vz(e){const t=Az(e),n=Mz();let r=null;const i=(o,a)=>{r==null||r.setData(o,a)};n.register(/^capabilities\//,Lz(t,i)),n.register(/^sessions$/,Dz(t,i)),n.register(/^session\//,$z(t,i)),n.register(/^personas$/,Wz(t,i)),n.register(/^persona-detail\//,Uz()),n.register(/^daemon-info$/,Hz(t,i));const s=Rz({onFirstObserver:o=>{o&&n.activate(o)},onLastObserver:o=>{o&&n.deactivate(o)}});return r=s,{cache:s,channel:t}}class G_{constructor(t){this.client=t}info(){return this.client.request("info")}attachmentSignUrl(t){return this.client.request("attachment.signUrl",t)}attachmentGroupAdd(t,n,r){return this.client.request("attachment.groupAdd",{sessionId:t,relPath:n,...r?{label:r}:{}})}attachmentGroupRemove(t,n){return this.client.request("attachment.groupRemove",{sessionId:t,relPath:n})}attachmentGroupList(t){return this.client.request("attachment.groupList",{sessionId:t})}sessionCreate(t){return this.client.request("session:create",t)}projectList(){return this.client.request("project:list")}projectCreate(t){return this.client.request("project:create",{...t.path?{path:t.path}:{},...t.name?{name:t.name}:{}})}projectPatch(t){return this.client.request("project:patch",t)}projectReveal(t){return this.client.request("project:reveal",{path:t})}appBuilderListProjects(){return this.client.request("appBuilder:listProjects",{})}appBuilderGetProject(t){return this.client.request("appBuilder:getProject",{sessionId:t})}appBuilderUpdateProjectPort(t,n){return this.client.request("appBuilder:updateProjectPort",{name:t,newPort:n})}appBuilderStartDevServer(t,n){return this.client.request("appBuilder:startDevServer",{sessionId:t,...n!=null&&n.force?{force:!0}:{}})}appBuilderStopDevServer(t){return this.client.request("appBuilder:stopDevServer",{sessionId:t})}appBuilderPublish(t){return this.client.request("appBuilder:publish",{name:t})}appBuilderDismissPublishJob(t){return this.client.request("appBuilder:dismissPublishJob",{name:t})}sessionList(){return this.client.request("session:list")}sessionGet(t){return this.client.request("session:get",{sessionId:t})}sessionUpdate(t,n){return this.client.request("session:update",{sessionId:t,patch:n})}sessionDelete(t){return this.client.request("session:delete",{sessionId:t})}sessionSend(t,n,r){return this.client.request("session:send",{sessionId:t,text:n,...r!=null&&r.queueWhileRunning?{queueWhileRunning:!0}:{}})}sessionDequeue(t,n){return this.client.request("session:dequeue",{sessionId:t,...n?{id:n}:{}})}sessionStop(t){return this.client.request("session:stop",{sessionId:t})}sessionInterrupt(t){return this.client.request("session:interrupt",{sessionId:t})}sessionRewind(t){return this.client.request("session:rewind",t)}sessionRewindableMessageIds(t){return this.client.request("session:rewindable-message-ids",{sessionId:t})}sessionRewindDiff(t){return this.client.request("session:rewind-diff",t)}sessionNew(t){return this.client.request("session:new",{sessionId:t})}sessionFork(t){return this.client.request("session:fork",t)}sessionResume(t,n){return this.client.request("session:resume",{sessionId:t,toolSessionId:n})}sessionObserve(t){return this.client.request("session:observe",t)}sessionEvents(t,n){return this.client.request("session:events",{sessionId:t,afterSeq:n})}sessionSubscribe(t){return this.client.request("session:subscribe",{sessionId:t})}sessionUnsubscribe(t){return this.client.request("session:unsubscribe",{sessionId:t})}pinSession(t,n){return this.client.request("session:pin",{sessionId:t,pinned:n})}searchSessionContent(t){return this.client.request("session:searchContent",t)}archiveSession(t,n){return this.client.request("session:archive",{sessionId:t,archived:n})}markSessionRead(t){return this.client.request("session:markRead",{sessionId:t})}reorderPins(t){return this.client.request("session:reorderPins",{orderedIds:t})}peerSessionUpsert(t){return this.client.request("peerSession:upsert",t)}peerSessionRemove(t){return this.client.request("peerSession:remove",{sessionId:t})}permissionRespond(t){return this.client.request("permission:respond",t)}answerQuestion(t){return this.client.request("session:answerQuestion",t)}cancelQuestion(t){return this.client.request("session:cancelQuestion",t)}historyProjects(){return this.client.request("history:projects")}historyList(t){return this.client.request("history:list",{projectPath:t})}historyRead(t){return this.client.request("history:read",t)}historySubagents(t){return this.client.request("history:subagents",t)}historySubagentRead(t){return this.client.request("history:subagent-read",t)}listRecentDirs(){return this.client.request("history:recentDirs",{})}getGitRoot(t){return this.client.request("git:root",{cwd:t})}getGitBranch(t){return this.client.request("git:branch",{cwd:t})}listGitBranches(t){return this.client.request("git:branches",{cwd:t})}personaCreate(t){return this.client.request("persona:create",t)}personaList(){return this.client.request("persona:list",{})}personaGet(t){return this.client.request("persona:get",{personaId:t})}personaUpdate(t,n){return this.client.request("persona:update",{personaId:t,patch:n})}personaDelete(t){return this.client.request("persona:delete",{personaId:t})}larkBotBindManual(t,n,r){return this.client.request("larkBot:bindManual",{personaId:t,appId:n,appSecret:r})}larkBotUnbind(t){return this.client.request("larkBot:unbind",{personaId:t})}larkBotStatus(t){return this.client.request("larkBot:status",{personaId:t})}toolsProbe(){return this.client.request("tools:probe",{})}sessionExternalScan(){return this.client.request("session:externalScan",{})}sessionImportExternal(t){return this.client.request("session:importExternal",t)}onboardingComplete(){return this.client.request("onboarding:complete",{})}onboardingIosInterest(){return this.client.request("onboarding:iosInterest",{})}visitorList(){return this.client.request("visitor:list",{})}workspaceList(t={}){return this.client.request("workspace:list",t)}workspaceRead(t){return this.client.request("workspace:read",t)}skillsList(t,n){return this.client.request("skills:list",{cwd:t,...n?{tool:n}:{}})}agentsList(t,n){return this.client.request("agents:list",{cwd:t,...n?{tool:n}:{}})}capabilitiesGet(t="claude"){return this.client.request("capabilities:get",{tool:t})}shiftList(){return this.client.request("shift:list")}deployStart(t){return this.client.request("deploy:start",{personaId:t})}deployGet(t){return this.client.request("deploy:get",{deployId:t})}deployList(){return this.client.request("deploy:list")}deployPatch(t,n){return this.client.request("deploy:patch",{deployId:t,patch:n})}deployPutSecret(t,n,r){return this.client.request("deploy:putSecret",{deployId:t,name:n,values:r})}deployRemove(t){return this.client.request("deploy:remove",{deployId:t})}channelList(){return this.client.request("channel:list")}channelCreate(t){return this.client.request("channel:create",t)}channelUpdate(t){return this.client.request("channel:update",t)}channelDelete(t){return this.client.request("channel:delete",t)}topicList(t){return this.client.request("topic:list",t)}topicGet(t){return this.client.request("topic:get",t)}topicCreate(t){return this.client.request("topic:create",t)}topicClose(t){return this.client.request("topic:close",t)}topicRename(t){return this.client.request("topic:rename",t)}topicDelete(t){return this.client.request("topic:delete",t)}githubStatus(){return this.client.request("github:status")}githubPrList(t){return this.client.request("github:prList",{role:t})}githubPrDetail(t){return this.client.request("github:prDetail",{...t})}githubPrMerge(t){return this.client.request("github:prMerge",{...t})}githubPrComment(t){return this.client.request("github:prComment",{...t})}githubPrSetReady(t){return this.client.request("github:prSetReady",{...t})}githubCollaborators(t){return this.client.request("github:collaborators",{...t})}githubPrRequestReviewers(t){return this.client.request("github:prRequestReviewers",{...t})}}function qz(e){const[t,n]=g.useState(e.isOpen?{kind:"connected",url:""}:{kind:"connecting"});return g.useEffect(()=>{const r=e.on("ready",l=>{const c=l;n(u=>({kind:"connected",url:u.kind==="connected"?u.url:"",mode:u.kind==="connected"?u.mode:void 0,daemonVersion:c.version,protocolVersion:c.protocolVersion,daemonSource:c.daemonSource,globalCliVersion:c.globalCliVersion,onboardingCompletedAt:c.onboardingCompletedAt}))}),i=e.on("daemon:connected",l=>{const c=l;n(u=>({kind:"connected",url:c.url,mode:c.mode,daemonVersion:u.kind==="connected"?u.daemonVersion:void 0,protocolVersion:u.kind==="connected"?u.protocolVersion:void 0,daemonSource:u.kind==="connected"?u.daemonSource:void 0,globalCliVersion:u.kind==="connected"?u.globalCliVersion:void 0,onboardingCompletedAt:u.kind==="connected"?u.onboardingCompletedAt:void 0}))}),s=e.on("daemon:disconnected",l=>{const c=(l==null?void 0:l.reason)??"";/auth failed|auth timeout|auth required|auth handshake timeout/i.test(c)?n({kind:"auth-failed",reason:c}):n({kind:"disconnected",reason:c})}),o=e.on("daemon:reconnecting",l=>{const c=l;n({kind:"reconnecting",attempt:c.attempt,nextDelayMs:c.nextDelayMs,scheduledAt:c.scheduledAt??Date.now()})}),a=e.on("daemon:version-mismatch",l=>{const c=l;n({kind:"version-mismatch",daemonProtocol:c.daemonProtocol,supportedProtocol:c.supportedProtocol})});return()=>{r(),i(),s(),o(),a()}},[e]),t}function Kz(e){const t=zo(),n=fi(e.kind==="connected"?"sessions":""),r=g.useCallback(async()=>{t.setData("sessions",i=>i??[])},[t]);return{sessions:n??[],loading:!1,loaded:n!==void 0,error:null,refresh:r}}function vl(){const e=xi();return g.useMemo(()=>new G_(e),[e])}function lI(e){return{personaId:e.personaId,label:e.label,model:e.model,effort:e.effort,tool:e.tool,public:e.public,createdAt:e.createdAt,updatedAt:e.updatedAt}}function cI(){const e=zo(),t=vl(),n=fi("personas")??[],r=g.useMemo(()=>n.map(s=>lI(s)),[n]),i=g.useCallback(async()=>{const s=await t.personaList();e.setData("personas",()=>s.personas??[])},[t,e]);return{personas:r,raw:n,loaded:fi("personas")!==void 0,refresh:i}}function uI(e){const{raw:t}=cI(),n=zo(),r=vl(),i=e?t.find(a=>a.personaId===e)??null:null,s=i?lI(i):null,o=g.useCallback(async()=>{if(!e)return;const a=await r.personaList();n.setData("personas",()=>a.personas??[])},[e,r,n]);return{persona:s,raw:i,loaded:!!s,refresh:o}}function Gz(e){const t=vl(),n=zo(),r=e?`persona-detail/${e}`:"",i=fi(r),s=g.useCallback(async()=>{const o={personality:"",personalityLocal:"",personalityManaged:!1,skills:[],plugins:[],sandboxSettings:null,codexSandbox:null};if(!e)return o;let a=null;try{a=await t.personaGet(e)}catch(c){Ae("personas","personaGet failed → empty detail",{personaId:e,err:c}),a=null}const l=a?{personality:a.personality??"",personalityLocal:a.personalityLocal??"",personalityManaged:a.personalityManaged??!1,skills:a.skills??[],plugins:a.plugins??[],sandboxSettings:a.sandboxSettings??null,codexSandbox:a.codexSandbox??null}:o;return n.setData(r,()=>l),l},[t,n,e,r]);return g.useEffect(()=>{e&&s()},[e,s]),{personality:(i==null?void 0:i.personality)??"",personalityLocal:(i==null?void 0:i.personalityLocal)??"",personalityManaged:(i==null?void 0:i.personalityManaged)??!1,skills:(i==null?void 0:i.skills)??[],plugins:(i==null?void 0:i.plugins)??[],sandboxSettings:(i==null?void 0:i.sandboxSettings)??null,codexSandbox:(i==null?void 0:i.codexSandbox)??null,loaded:i!==void 0,refresh:s}}function dI(){const e=zo(),t=vl();return g.useCallback(async()=>{const n=await t.personaList();e.setData("personas",()=>n.personas??[])},[e,t])}function Xz(){const e=vl(),t=dI();return g.useCallback(async(n,r)=>{const i=await e.personaUpdate(n,r);return await t(),i},[e,t])}function Yz(){const e=vl(),t=dI();return g.useCallback(async n=>{await e.personaDelete(n),await t()},[e,t])}const zw="clawd:sidebar:tree-collapsed";function Qz(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function Zz(e){const t=Qz(e);if(!Array.isArray(t))return new Set;const n=new Set;for(const r of t)typeof r=="string"&&n.add(r);return n}function Jz(){const e=I_(),[t,n]=g.useState(()=>new Set),r=g.useRef(t);r.current=t,g.useEffect(()=>{let l=!1;return(async()=>{try{const c=await e.kv.get(zw);if(l)return;n(Zz(c))}catch{}})(),()=>{l=!0}},[e]);const i=g.useCallback(l=>{e.kv.set(zw,[...l]).catch(()=>{})},[e]),s=g.useCallback(l=>r.current.has(l),[]),o=g.useCallback(l=>{n(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),i(u),u})},[i]),a=g.useCallback(l=>{n(c=>{let u=!1;const d=new Set;for(const f of c)l.has(f)?d.add(f):u=!0;return u?(i(d),d):c})},[i]);return{isCollapsed:s,toggle:o,prune:a}}const X_=g.createContext(null);function e$(){const e=g.useContext(X_);if(!e)throw new Error("SessionTreeCollapsedContext.Provider missing — wrap SessionTreeNode tree with <SessionTreeCollapsedContext.Provider value={useSessionTreeCollapsed()}>");return e}/**
|
|
95
|
+
`,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var uw=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const cO={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},uO={motionBase:!0,motionUnit:!0},dO={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},mT=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=uw(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=pT(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=uw(l,["theme"]);let d=u;c&&(d=mT(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function gT(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Ze.useContext(hT),s=`${aO}-${t||""}`,o=n||dT,[a,l,c]=QL(o,[Kc,e],{salt:s,override:r,getComputedToken:mT,formatToken:pT,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:cO,ignore:uO,preserve:dO}});return[o,c,t?l:"",a,i]}const hO=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),fO=e=>({[`.${e}`]:Object.assign(Object.assign({},hO()),{[`.${e} .${e}-icon`]:{display:"block"}})}),pO=(e,t)=>{const[n,r]=gT();return CD({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>fO(e))},mO=Object.assign({},ol),{useId:dw}=mO,gO=()=>"",vO=typeof dw>"u"?gO:dw;function xO(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},Fh),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:Fh.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=vO();return jN(()=>{var a,l;if(!e)return t;const c=Object.assign({},s.components);Object.keys(e.components||{}).forEach(f=>{c[f]=Object.assign(Object.assign({},c[f]),e.components[f])});const u=`css-var-${o.replace(/:/g,"")}`,d=((a=i.cssVar)!==null&&a!==void 0?a:s.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof s.cssVar=="object"?s.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((l=i.cssVar)===null||l===void 0?void 0:l.key)||u});return Object.assign(Object.assign(Object.assign({},s),i),{token:Object.assign(Object.assign({},s.token),i.token),components:c,cssVar:d})},[i,s],(a,l)=>a.some((c,u)=>{const d=l[u];return!CL(c,d,!0)}))}var _O=["children"],vT=g.createContext({});function yO(e){var t=e.children,n=jv(e,_O);return g.createElement(vT.Provider,{value:n},t)}var bO=function(e){DN(n,e);var t=BN(n);function n(){return ul(this,n),t.apply(this,arguments)}return dl(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function wO(e){var t=g.useReducer(function(a){return a+1},0),n=et(t,2),r=n[1],i=g.useRef(e),s=n0(function(){return i.current}),o=n0(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var ds="none",od="appear",ad="enter",ld="leave",hw="none",Lr="prepare",ya="start",ba="active",z_="end",xT="prepared";function fw(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}function SO(e,t){var n={animationend:fw("Animation","AnimationEnd"),transitionend:fw("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var kO=SO(Xi(),typeof window<"u"?window:{}),_T={};if(Xi()){var CO=document.createElement("div");_T=CO.style}var cd={};function yT(e){if(cd[e])return cd[e];var t=kO[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var s=n[i];if(Object.prototype.hasOwnProperty.call(t,s)&&s in _T)return cd[e]=t[s],cd[e]}return""}var bT=yT("animationend"),wT=yT("transitionend"),ST=!!(bT&&wT),pw=bT||"animationend",mw=wT||"transitionend";function gw(e,t){if(!e)return null;if(Rt(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const EO=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(mw,e),i.removeEventListener(pw,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(mw,e),i.addEventListener(pw,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var kT=Xi()?g.useLayoutEffect:g.useEffect;const NO=function(){var e=g.useRef(null);function t(){Mv.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=Mv(function(){i<=1?r({isCanceled:function(){return s!==e.current}}):n(r,i-1)});e.current=s}return g.useEffect(function(){return function(){t()}},[]),[n,t]};var TO=[Lr,ya,ba,z_],IO=[Lr,xT],CT=!1,PO=!0;function ET(e){return e===ba||e===z_}const RO=function(e,t,n){var r=r0(hw),i=et(r,2),s=i[0],o=i[1],a=NO(),l=et(a,2),c=l[0],u=l[1];function d(){o(Lr,!0)}var f=t?IO:TO;return kT(function(){if(s!==hw&&s!==z_){var p=f.indexOf(s),m=f[p+1],v=n(s);v===CT?o(m,!0):m&&c(function(w){function x(){w.isCanceled()||o(m,!0)}v===!0?x():Promise.resolve(v).then(x)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function MO(e,t,n,r){var i=r.motionEnter,s=i===void 0?!0:i,o=r.motionAppear,a=o===void 0?!0:o,l=r.motionLeave,c=l===void 0?!0:l,u=r.motionDeadline,d=r.motionLeaveImmediately,f=r.onAppearPrepare,p=r.onEnterPrepare,m=r.onLeavePrepare,v=r.onAppearStart,w=r.onEnterStart,x=r.onLeaveStart,_=r.onAppearActive,y=r.onEnterActive,S=r.onLeaveActive,C=r.onAppearEnd,k=r.onEnterEnd,N=r.onLeaveEnd,T=r.onVisibleChanged,z=r0(),P=et(z,2),O=P[0],M=P[1],R=wO(ds),A=et(R,2),L=A[0],$=A[1],F=r0(null),D=et(F,2),B=D[0],E=D[1],H=L(),q=g.useRef(!1),j=g.useRef(null);function ne(){return n()}var ie=g.useRef(!1);function K(){$(ds),E(null,!0)}var _e=n0(function(Qe){var ot=L();if(ot!==ds){var _t=ne();if(!(Qe&&!Qe.deadline&&Qe.target!==_t)){var vn=ie.current,cn;ot===od&&vn?cn=C==null?void 0:C(_t,Qe):ot===ad&&vn?cn=k==null?void 0:k(_t,Qe):ot===ld&&vn&&(cn=N==null?void 0:N(_t,Qe)),vn&&cn!==!1&&K()}}}),Re=EO(_e),ce=et(Re,1),Me=ce[0],$e=function(ot){switch(ot){case od:return ke(ke(ke({},Lr,f),ya,v),ba,_);case ad:return ke(ke(ke({},Lr,p),ya,w),ba,y);case ld:return ke(ke(ke({},Lr,m),ya,x),ba,S);default:return{}}},Fe=g.useMemo(function(){return $e(H)},[H]),be=RO(H,!e,function(Qe){if(Qe===Lr){var ot=Fe[Lr];return ot?ot(ne()):CT}if(qe in Fe){var _t;E(((_t=Fe[qe])===null||_t===void 0?void 0:_t.call(Fe,ne(),null))||null)}return qe===ba&&H!==ds&&(Me(ne()),u>0&&(clearTimeout(j.current),j.current=setTimeout(function(){_e({deadline:!0})},u))),qe===xT&&K(),PO}),rt=et(be,2),pt=rt[0],qe=rt[1],Et=ET(qe);ie.current=Et;var Zt=g.useRef(null);kT(function(){if(!(q.current&&Zt.current===t)){M(t);var Qe=q.current;q.current=!0;var ot;!Qe&&t&&a&&(ot=od),Qe&&t&&s&&(ot=ad),(Qe&&!t&&c||!Qe&&d&&!t&&c)&&(ot=ld);var _t=$e(ot);ot&&(e||_t[Lr])?($(ot),pt()):$(ds),Zt.current=t}},[t]),g.useEffect(function(){(H===od&&!a||H===ad&&!s||H===ld&&!c)&&$(ds)},[a,s,c]),g.useEffect(function(){return function(){q.current=!1,clearTimeout(j.current)}},[]);var mt=g.useRef(!1);g.useEffect(function(){O&&(mt.current=!0),O!==void 0&&H===ds&&((mt.current||O)&&(T==null||T(O)),mt.current=!0)},[O,H]);var xt=B;return Fe[Lr]&&qe===ya&&(xt=He({transition:"none"},xt)),[H,qe,xt,O??t]}function AO(e){var t=e;Rt(e)==="object"&&(t=e.transitionSupport);function n(i,s){return!!(i.motionName&&t&&s!==!1)}var r=g.forwardRef(function(i,s){var o=i.visible,a=o===void 0?!0:o,l=i.removeOnLeave,c=l===void 0?!0:l,u=i.forceRender,d=i.children,f=i.motionName,p=i.leavedClassName,m=i.eventProps,v=g.useContext(vT),w=v.motion,x=n(i,w),_=g.useRef(),y=g.useRef();function S(){try{return _.current instanceof HTMLElement?_.current:lL(y.current)}catch{return null}}var C=MO(x,a,S,i),k=et(C,4),N=k[0],T=k[1],z=k[2],P=k[3],O=g.useRef(P);P&&(O.current=!0);var M=g.useCallback(function(D){_.current=D,hL(s,D)},[s]),R,A=He(He({},m),{},{visible:a});if(!d)R=null;else if(N===ds)P?R=d(He({},A),M):!c&&O.current&&p?R=d(He(He({},A),{},{className:p}),M):u||!c&&!p?R=d(He(He({},A),{},{style:{display:"none"}}),M):R=null;else{var L;T===Lr?L="prepare":ET(T)?L="active":T===ya&&(L="start");var $=gw(f,"".concat(N,"-").concat(L));R=d(He(He({},A),{},{className:Yj(gw(f,N),ke(ke({},$,$&&L),f,typeof f=="string")),style:z}),M)}if(g.isValidElement(R)&&fL(R)){var F=pL(R);F||(R=g.cloneElement(R,{ref:M}))}return g.createElement(bO,{ref:y},R)});return r.displayName="CSSMotion",r}const jO=AO(ST);var i0="add",s0="keep",o0="remove",Im="removed";function LO(e){var t;return e&&Rt(e)==="object"&&"key"in e?t=e:t={key:e},He(He({},t),{},{key:String(t.key)})}function a0(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(LO)}function DO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=t.length,s=a0(e),o=a0(t);s.forEach(function(c){for(var u=!1,d=r;d<i;d+=1){var f=o[d];if(f.key===c.key){r<d&&(n=n.concat(o.slice(r,d).map(function(p){return He(He({},p),{},{status:i0})})),r=d),n.push(He(He({},f),{},{status:s0})),r+=1,u=!0;break}}u||n.push(He(He({},c),{},{status:o0}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return He(He({},c),{},{status:i0})})));var a={};n.forEach(function(c){var u=c.key;a[u]=(a[u]||0)+1});var l=Object.keys(a).filter(function(c){return a[c]>1});return l.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==o0}),n.forEach(function(u){u.key===c&&(u.status=s0)})}),n}var OO=["component","children","onVisibleChanged","onAllRemoved"],BO=["status"],zO=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function $O(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jO,n=function(r){DN(s,r);var i=BN(s);function s(){var o;ul(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=i.call.apply(i,[this].concat(l)),ke(Pv(o),"state",{keyEntities:[]}),ke(Pv(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:He(He({},p),{},{status:Im})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==Im}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return dl(s,[{key:"render",value:function(){var a=this,l=this.state.keyEntities,c=this.props,u=c.component,d=c.children,f=c.onVisibleChanged;c.onAllRemoved;var p=jv(c,OO),m=u||g.Fragment,v={};return zO.forEach(function(w){v[w]=p[w],delete p[w]}),delete p.keys,g.createElement(m,p,l.map(function(w,x){var _=w.status,y=jv(w,BO),S=_===i0||_===s0;return g.createElement(t,Bh({},v,{key:y.key,visible:S,eventProps:y,onVisibleChanged:function(k){f==null||f(k,{key:y.key}),k||a.removeKey(y.key)}}),function(C,k){return d(He(He({},C),{},{index:x}),k)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=a0(c),f=DO(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(v){var w=v.key;return p.key===w});return!(m&&m.status===Im&&p.status===o0)})}}}]),s}(g.Component);return ke(n,"defaultProps",{component:"div"}),n}$O(ST);const vw=g.createContext(!0);function FO(e){const t=g.useContext(vw),{children:n}=e,[,r]=gT(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(vw.Provider,{value:i},g.createElement(yO,{motion:i},n)):n}const HO=()=>null;var UO=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const WO=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let NT;function VO(){return NT||e0}function qO(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const KO=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(NT=t),r&&qO(r)&&tO(VO(),r)},GO=e=>{const{children:t,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:s,form:o,locale:a,componentSize:l,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:v,legacyLocale:w,parentContext:x,iconPrefixCls:_,theme:y,componentDisabled:S,segmented:C,statistic:k,spin:N,calendar:T,carousel:z,cascader:P,collapse:O,typography:M,checkbox:R,descriptions:A,divider:L,drawer:$,skeleton:F,steps:D,image:B,layout:E,list:H,mentions:q,modal:j,progress:ne,result:ie,slider:K,breadcrumb:_e,menu:Re,pagination:ce,input:Me,textArea:$e,empty:Fe,badge:be,radio:rt,rate:pt,switch:qe,transfer:Et,avatar:Zt,message:mt,tag:xt,table:Qe,card:ot,tabs:_t,timeline:vn,timePicker:cn,upload:U,notification:J,tree:ve,colorPicker:Te,datePicker:De,rangePicker:Nt,flex:un,wave:Wt,dropdown:Jt,warning:le,tour:we,tooltip:ut,popover:jt,popconfirm:Ir,floatButton:oe,floatButtonGroup:Je,variant:dn,inputNumber:ns,treeSelect:El}=e,Xs=g.useCallback((Tt,G)=>{const{prefixCls:ge}=e;if(G)return G;const ye=ge||x.getPrefixCls("");return Tt?`${ye}-${Tt}`:ye},[x.getPrefixCls,e.prefixCls]),wi=_||x.iconPrefixCls||fT,Ko=n||x.csp;pO(wi,Ko);const Go=xO(y,x.theme,{prefixCls:Xs("")}),Ys={csp:Ko,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||w,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:v,getPrefixCls:Xs,iconPrefixCls:wi,theme:Go,segmented:C,statistic:k,spin:N,calendar:T,carousel:z,cascader:P,collapse:O,typography:M,checkbox:R,descriptions:A,divider:L,drawer:$,skeleton:F,steps:D,image:B,input:Me,textArea:$e,layout:E,list:H,mentions:q,modal:j,progress:ne,result:ie,slider:K,breadcrumb:_e,menu:Re,pagination:ce,empty:Fe,badge:be,radio:rt,rate:pt,switch:qe,transfer:Et,avatar:Zt,message:mt,tag:xt,table:Qe,card:ot,tabs:_t,timeline:vn,timePicker:cn,upload:U,notification:J,tree:ve,colorPicker:Te,datePicker:De,rangePicker:Nt,flex:un,wave:Wt,dropdown:Jt,warning:le,tour:we,tooltip:ut,popover:jt,popconfirm:Ir,floatButton:oe,floatButtonGroup:Je,variant:dn,inputNumber:ns,treeSelect:El},rs=Object.assign({},x);Object.keys(Ys).forEach(Tt=>{Ys[Tt]!==void 0&&(rs[Tt]=Ys[Tt])}),WO.forEach(Tt=>{const G=e[Tt];G&&(rs[Tt]=G)}),typeof r<"u"&&(rs.button=Object.assign({autoInsertSpace:r},rs.button));const Pr=jN(()=>rs,rs,(Tt,G)=>{const ge=Object.keys(Tt),ye=Object.keys(G);return ge.length!==ye.length||ge.some(Ge=>Tt[Ge]!==G[Ge])}),{layer:zu}=g.useContext(Zf),Vp=g.useMemo(()=>({prefixCls:wi,csp:Ko,layer:zu?"antd":void 0}),[wi,Ko,zu]);let Lt=g.createElement(g.Fragment,null,g.createElement(HO,{dropdownMatchSelectWidth:p}),t);const Qs=g.useMemo(()=>{var Tt,G,ge,ye;return AD(((Tt=tp.Form)===null||Tt===void 0?void 0:Tt.defaultValidateMessages)||{},((ge=(G=Pr.locale)===null||G===void 0?void 0:G.Form)===null||ge===void 0?void 0:ge.defaultValidateMessages)||{},((ye=Pr.form)===null||ye===void 0?void 0:ye.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[Pr,o==null?void 0:o.validateMessages]);Object.keys(Qs).length>0&&(Lt=g.createElement(LD.Provider,{value:Qs},Lt)),a&&(Lt=g.createElement(BD,{locale:a,_ANT_MARK__:OD},Lt)),Lt=g.createElement(ID.Provider,{value:Vp},Lt),l&&(Lt=g.createElement(rO,{size:l},Lt)),Lt=g.createElement(FO,null,Lt);const qp=g.useMemo(()=>{const Tt=Go||{},{algorithm:G,token:ge,components:ye,cssVar:Ge}=Tt,Vr=UO(Tt,["algorithm","token","components","cssVar"]),Nl=G&&(!Array.isArray(G)||G.length>0)?Dv(G):dT,Kp={};Object.entries(ye||{}).forEach(([m4,g4])=>{const Si=Object.assign({},g4);"algorithm"in Si&&(Si.algorithm===!0?Si.theme=Nl:(Array.isArray(Si.algorithm)||typeof Si.algorithm=="function")&&(Si.theme=Dv(Si.algorithm)),delete Si.algorithm),Kp[m4]=Si});const C1=Object.assign(Object.assign({},Kc),ge);return Object.assign(Object.assign({},Vr),{theme:Nl,token:C1,components:Kp,override:Object.assign({override:C1},Kp),cssVar:Ge})},[Go]);return y&&(Lt=g.createElement(hT.Provider,{value:qp},Lt)),Pr.warning&&(Lt=g.createElement(jD.Provider,{value:Pr.warning},Lt)),S!==void 0&&(Lt=g.createElement(nO,{disabled:S},Lt)),g.createElement(np.Provider,{value:Pr},Lt)},fl=e=>{const t=g.useContext(np),n=g.useContext(aT);return g.createElement(GO,Object.assign({parentContext:t,legacyLocale:n},e))};fl.ConfigContext=np;fl.SizeContext=Gc;fl.config=KO;fl.useConfig=iO;Object.defineProperty(fl,"SizeContext",{get:()=>Gc});const dr=(e,t)=>new St(e).setA(t).toRgbString(),Qo=(e,t)=>new St(e).lighten(t).toHexString(),XO=e=>{const t=Va(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},YO=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:dr(r,.85),colorTextSecondary:dr(r,.65),colorTextTertiary:dr(r,.45),colorTextQuaternary:dr(r,.25),colorFill:dr(r,.18),colorFillSecondary:dr(r,.12),colorFillTertiary:dr(r,.08),colorFillQuaternary:dr(r,.04),colorBgSolid:dr(r,.95),colorBgSolidHover:dr(r,1),colorBgSolidActive:dr(r,.9),colorBgElevated:Qo(n,12),colorBgContainer:Qo(n,8),colorBgLayout:Qo(n,0),colorBgSpotlight:Qo(n,26),colorBgBlur:dr(r,.04),colorBorder:Qo(n,26),colorBorderSecondary:Qo(n,19)}},QO=(e,t)=>{const n=Object.keys(O_).map(s=>{const o=Va(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??B_(e),i=uT(e,{generateColorPalettes:XO,generateNeutralColorPalettes:YO});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},xw={defaultSeed:Fh.token,defaultAlgorithm:B_,darkAlgorithm:QO};function _w({children:e}){const t=I_(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(fl,{theme:{algorithm:n.mode==="dark"?xw.darkAlgorithm:xw.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var Xe;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Xe||(Xe={}));var yw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(yw||(yw={}));const de=Xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ms=e=>{switch(typeof e){case"undefined":return de.undefined;case"string":return de.string;case"number":return Number.isNaN(e)?de.nan:de.number;case"boolean":return de.boolean;case"function":return de.function;case"bigint":return de.bigint;case"symbol":return de.symbol;case"object":return Array.isArray(e)?de.array:e===null?de.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?de.promise:typeof Map<"u"&&e instanceof Map?de.map:typeof Set<"u"&&e instanceof Set?de.set:typeof Date<"u"&&e instanceof Date?de.date:de.object;default:return de.unknown}},X=Xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Wi extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(t){if(!(t instanceof Wi))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Wi.create=e=>new Wi(e);const l0=(e,t)=>{let n;switch(e.code){case X.invalid_type:e.received===de.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Xe.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xe.joinValues(e.keys,", ")}`;break;case X.invalid_union:n="Invalid input";break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xe.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${Xe.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n="Invalid function arguments";break;case X.invalid_return_type:n="Invalid function return type";break;case X.invalid_date:n="Invalid date";break;case X.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Xe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case X.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case X.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case X.custom:n="Invalid input";break;case X.invalid_intersection_types:n="Intersection results could not be merged";break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n="Number must be finite";break;default:n=t.defaultError,Xe.assertNever(e)}return{message:n}};let ZO=l0;function JO(){return ZO}const e6=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function se(e,t){const n=JO(),r=e6({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===l0?void 0:l0].filter(i=>!!i)});e.common.issues.push(r)}class An{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Ee;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return An.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Ee;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const Ee=Object.freeze({status:"aborted"}),Jl=e=>({status:"dirty",value:e}),Er=e=>({status:"valid",value:e}),bw=e=>e.status==="aborted",ww=e=>e.status==="dirty",qa=e=>e.status==="valid",Hh=e=>typeof Promise<"u"&&e instanceof Promise;var me;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(me||(me={}));class hi{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Sw=(e,t)=>{if(qa(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Wi(e.common.issues);return this._error=n,this._error}}};function Le(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class Ve{get description(){return this._def.description}_getType(t){return ms(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ms(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new An,ctx:{common:t.parent.common,data:t.data,parsedType:ms(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Hh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ms(t)},i=this._parseSync({data:t,path:r.path,parent:r});return Sw(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ms(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return qa(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>qa(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ms(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Hh(i)?i:Promise.resolve(i));return Sw(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:X.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Eo({schema:this,typeName:Ne.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Oi.create(this,this._def)}nullable(){return No.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return li.create(this)}promise(){return Gh.create(this,this._def)}or(t){return Wh.create([this,t],this._def)}and(t){return Vh.create(this,t,this._def)}transform(t){return new Eo({...Le(this._def),schema:this,typeName:Ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Xh({...Le(this._def),innerType:this,defaultValue:n,typeName:Ne.ZodDefault})}brand(){return new RT({typeName:Ne.ZodBranded,type:this,...Le(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Yh({...Le(this._def),innerType:this,catchValue:n,typeName:Ne.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return F_.create(this,t)}readonly(){return Qh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const t6=/^c[^\s-]{8,}$/i,n6=/^[0-9a-z]+$/,r6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,i6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,s6=/^[a-z0-9_-]{21}$/i,o6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,a6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,l6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,c6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Pm;const u6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,d6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,h6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,f6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,p6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,m6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,TT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",g6=new RegExp(`^${TT}$`);function IT(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function v6(e){return new RegExp(`^${IT(e)}$`)}function x6(e){let t=`${TT}T${IT(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function _6(e,t){return!!((t==="v4"||!t)&&u6.test(e)||(t==="v6"||!t)&&h6.test(e))}function y6(e,t){if(!o6.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function b6(e,t){return!!((t==="v4"||!t)&&d6.test(e)||(t==="v6"||!t)&&f6.test(e))}class Ai extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==de.string){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.string,received:s.parsedType}),Ee}const r=new An;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?se(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&se(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")l6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"email",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Pm||(Pm=new RegExp(c6,"u")),Pm.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"emoji",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")i6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"uuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")s6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"nanoid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")t6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")n6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid2",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")r6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ulid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),se(i,{validation:"url",code:X.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"regex",code:X.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?x6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?g6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?v6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?a6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"duration",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?_6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ip",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?y6(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"jwt",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?b6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cidr",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?p6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?m6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64url",code:X.invalid_string,message:s.message}),r.dirty()):Xe.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:X.invalid_string,...me.errToObj(r)})}_addCheck(t){return new Ai({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...me.errToObj(t)})}url(t){return this._addCheck({kind:"url",...me.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...me.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...me.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...me.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...me.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...me.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...me.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...me.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...me.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...me.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...me.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...me.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...me.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...me.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...me.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...me.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...me.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...me.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...me.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...me.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...me.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...me.errToObj(n)})}nonempty(t){return this.min(1,me.errToObj(t))}trim(){return new Ai({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ai({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ai({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ai.create=e=>new Ai({checks:[],typeName:Ne.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Le(e)});function w6(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class Ka extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==de.number){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.number,received:s.parsedType}),Ee}let r;const i=new An;for(const s of this._def.checks)s.kind==="int"?Xe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:X.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?w6(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_finite,message:s.message}),i.dirty()):Xe.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Ka({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Ka({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:me.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:me.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Xe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ka.create=e=>new Ka({checks:[],typeName:Ne.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class Xc extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==de.bigint)return this._getInvalidInput(t);let r;const i=new An;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Xe.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:de.bigint,received:n.parsedType}),Ee}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Xc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Xc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Xc.create=e=>new Xc({checks:[],typeName:Ne.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Le(e)});class c0 extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==de.boolean){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.boolean,received:r.parsedType}),Ee}return Er(t.data)}}c0.create=e=>new c0({typeName:Ne.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class Uh extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==de.date){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.date,received:s.parsedType}),Ee}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_date}),Ee}const r=new An;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Xe.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Uh({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:me.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:me.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Uh.create=e=>new Uh({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ne.ZodDate,...Le(e)});class kw extends Ve{_parse(t){if(this._getType(t)!==de.symbol){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.symbol,received:r.parsedType}),Ee}return Er(t.data)}}kw.create=e=>new kw({typeName:Ne.ZodSymbol,...Le(e)});class u0 extends Ve{_parse(t){if(this._getType(t)!==de.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.undefined,received:r.parsedType}),Ee}return Er(t.data)}}u0.create=e=>new u0({typeName:Ne.ZodUndefined,...Le(e)});class d0 extends Ve{_parse(t){if(this._getType(t)!==de.null){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.null,received:r.parsedType}),Ee}return Er(t.data)}}d0.create=e=>new d0({typeName:Ne.ZodNull,...Le(e)});class Cw extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return Er(t.data)}}Cw.create=e=>new Cw({typeName:Ne.ZodAny,...Le(e)});class h0 extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Er(t.data)}}h0.create=e=>new h0({typeName:Ne.ZodUnknown,...Le(e)});class Os extends Ve{_parse(t){const n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:de.never,received:n.parsedType}),Ee}}Os.create=e=>new Os({typeName:Ne.ZodNever,...Le(e)});class Ew extends Ve{_parse(t){if(this._getType(t)!==de.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.void,received:r.parsedType}),Ee}return Er(t.data)}}Ew.create=e=>new Ew({typeName:Ne.ZodVoid,...Le(e)});class li extends Ve{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==de.array)return se(n,{code:X.invalid_type,expected:de.array,received:n.parsedType}),Ee;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(se(n,{code:o?X.too_big:X.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(se(n,{code:X.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(se(n,{code:X.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new hi(n,o,n.path,a)))).then(o=>An.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new hi(n,o,n.path,a)));return An.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new li({...this._def,minLength:{value:t,message:me.toString(n)}})}max(t,n){return new li({...this._def,maxLength:{value:t,message:me.toString(n)}})}length(t,n){return new li({...this._def,exactLength:{value:t,message:me.toString(n)}})}nonempty(t){return this.min(1,t)}}li.create=(e,t)=>new li({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ne.ZodArray,...Le(t)});function oa(e){if(e instanceof $t){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Oi.create(oa(r))}return new $t({...e._def,shape:()=>t})}else return e instanceof li?new li({...e._def,type:oa(e.element)}):e instanceof Oi?Oi.create(oa(e.unwrap())):e instanceof No?No.create(oa(e.unwrap())):e instanceof ko?ko.create(e.items.map(t=>oa(t))):e}class $t extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Xe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==de.object){const c=this._getOrReturnCtx(t);return se(c,{code:X.invalid_type,expected:de.object,received:c.parsedType}),Ee}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Os&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new hi(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Os){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(se(i,{code:X.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new hi(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>An.mergeObjectSync(r,c)):An.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return me.errToObj,new $t({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:me.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new $t({...this._def,unknownKeys:"strip"})}passthrough(){return new $t({...this._def,unknownKeys:"passthrough"})}extend(t){return new $t({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new $t({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ne.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new $t({...this._def,catchall:t})}pick(t){const n={};for(const r of Xe.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Xe.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}deepPartial(){return oa(this)}partial(t){const n={};for(const r of Xe.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new $t({...this._def,shape:()=>n})}required(t){const n={};for(const r of Xe.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Oi;)s=s._def.innerType;n[r]=s}return new $t({...this._def,shape:()=>n})}keyof(){return PT(Xe.objectKeys(this.shape))}}$t.create=(e,t)=>new $t({shape:()=>e,unknownKeys:"strip",catchall:Os.create(),typeName:Ne.ZodObject,...Le(t)});$t.strictCreate=(e,t)=>new $t({shape:()=>e,unknownKeys:"strict",catchall:Os.create(),typeName:Ne.ZodObject,...Le(t)});$t.lazycreate=(e,t)=>new $t({shape:e,unknownKeys:"strip",catchall:Os.create(),typeName:Ne.ZodObject,...Le(t)});class Wh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Wi(a.ctx.common.issues));return se(n,{code:X.invalid_union,unionErrors:o}),Ee}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new Wi(l));return se(n,{code:X.invalid_union,unionErrors:a}),Ee}}get options(){return this._def.options}}Wh.create=(e,t)=>new Wh({options:e,typeName:Ne.ZodUnion,...Le(t)});const Ni=e=>e instanceof p0?Ni(e.schema):e instanceof Eo?Ni(e.innerType()):e instanceof Kh?[e.value]:e instanceof Co?e.options:e instanceof m0?Xe.objectValues(e.enum):e instanceof Xh?Ni(e._def.innerType):e instanceof u0?[void 0]:e instanceof d0?[null]:e instanceof Oi?[void 0,...Ni(e.unwrap())]:e instanceof No?[null,...Ni(e.unwrap())]:e instanceof RT||e instanceof Qh?Ni(e.unwrap()):e instanceof Yh?Ni(e._def.innerType):[];class $_ extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==de.object)return se(n,{code:X.invalid_type,expected:de.object,received:n.parsedType}),Ee;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(se(n,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const o=Ni(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new $_({typeName:Ne.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Le(r)})}}function f0(e,t){const n=ms(e),r=ms(t);if(e===t)return{valid:!0,data:e};if(n===de.object&&r===de.object){const i=Xe.objectKeys(t),s=Xe.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=f0(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===de.array&&r===de.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=f0(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===de.date&&r===de.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Vh extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(bw(s)||bw(o))return Ee;const a=f0(s.value,o.value);return a.valid?((ww(s)||ww(o))&&n.dirty(),{status:n.value,value:a.data}):(se(r,{code:X.invalid_intersection_types}),Ee)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Vh.create=(e,t,n)=>new Vh({left:e,right:t,typeName:Ne.ZodIntersection,...Le(n)});class ko extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.array)return se(r,{code:X.invalid_type,expected:de.array,received:r.parsedType}),Ee;if(r.data.length<this._def.items.length)return se(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&r.data.length>this._def.items.length&&(se(r,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new hi(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>An.mergeArray(n,o)):An.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new ko({...this._def,rest:t})}}ko.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ko({items:e,typeName:Ne.ZodTuple,rest:null,...Le(t)})};class qh extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.object)return se(r,{code:X.invalid_type,expected:de.object,received:r.parsedType}),Ee;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new hi(r,a,r.path,a)),value:o._parse(new hi(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?An.mergeObjectAsync(n,i):An.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ve?new qh({keyType:t,valueType:n,typeName:Ne.ZodRecord,...Le(r)}):new qh({keyType:Ai.create(),valueType:t,typeName:Ne.ZodRecord,...Le(n)})}}class Nw extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.map)return se(r,{code:X.invalid_type,expected:de.map,received:r.parsedType}),Ee;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new hi(r,a,r.path,[c,"key"])),value:s._parse(new hi(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Nw.create=(e,t,n)=>new Nw({valueType:t,keyType:e,typeName:Ne.ZodMap,...Le(n)});class Yc extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.set)return se(r,{code:X.invalid_type,expected:de.set,received:r.parsedType}),Ee;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(se(r,{code:X.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(se(r,{code:X.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ee;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new hi(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new Yc({...this._def,minSize:{value:t,message:me.toString(n)}})}max(t,n){return new Yc({...this._def,maxSize:{value:t,message:me.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Yc.create=(e,t)=>new Yc({valueType:e,minSize:null,maxSize:null,typeName:Ne.ZodSet,...Le(t)});class p0 extends Ve{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}p0.create=(e,t)=>new p0({getter:e,typeName:Ne.ZodLazy,...Le(t)});class Kh extends Ve{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return se(n,{received:n.data,code:X.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:t.data}}get value(){return this._def.value}}Kh.create=(e,t)=>new Kh({value:e,typeName:Ne.ZodLiteral,...Le(t)});function PT(e,t){return new Co({values:e,typeName:Ne.ZodEnum,...Le(t)})}class Co extends Ve{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{expected:Xe.joinValues(r),received:n.parsedType,code:X.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{received:n.data,code:X.invalid_enum_value,options:r}),Ee}return Er(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Co.create(t,{...this._def,...n})}exclude(t,n=this._def){return Co.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Co.create=PT;class m0 extends Ve{_parse(t){const n=Xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==de.string&&r.parsedType!==de.number){const i=Xe.objectValues(n);return se(r,{expected:Xe.joinValues(i),received:r.parsedType,code:X.invalid_type}),Ee}if(this._cache||(this._cache=new Set(Xe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Xe.objectValues(n);return se(r,{received:r.data,code:X.invalid_enum_value,options:i}),Ee}return Er(t.data)}get enum(){return this._def.values}}m0.create=(e,t)=>new m0({values:e,typeName:Ne.ZodNativeEnum,...Le(t)});class Gh extends Ve{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==de.promise&&n.common.async===!1)return se(n,{code:X.invalid_type,expected:de.promise,received:n.parsedType}),Ee;const r=n.parsedType===de.promise?n.data:Promise.resolve(n.data);return Er(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Gh.create=(e,t)=>new Gh({type:e,typeName:Ne.ZodPromise,...Le(t)});class Eo extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{se(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Ee;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ee:l.status==="dirty"||n.value==="dirty"?Jl(l.value):l});{if(n.value==="aborted")return Ee;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Ee:a.status==="dirty"||n.value==="dirty"?Jl(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!qa(o))return Ee;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>qa(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):Ee);Xe.assertNever(i)}}Eo.create=(e,t,n)=>new Eo({schema:e,typeName:Ne.ZodEffects,effect:t,...Le(n)});Eo.createWithPreprocess=(e,t,n)=>new Eo({schema:t,effect:{type:"preprocess",transform:e},typeName:Ne.ZodEffects,...Le(n)});class Oi extends Ve{_parse(t){return this._getType(t)===de.undefined?Er(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Oi.create=(e,t)=>new Oi({innerType:e,typeName:Ne.ZodOptional,...Le(t)});class No extends Ve{_parse(t){return this._getType(t)===de.null?Er(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}No.create=(e,t)=>new No({innerType:e,typeName:Ne.ZodNullable,...Le(t)});class Xh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===de.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Xh.create=(e,t)=>new Xh({innerType:e,typeName:Ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Le(t)});class Yh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Hh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Wi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Yh.create=(e,t)=>new Yh({innerType:e,typeName:Ne.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Le(t)});class Tw extends Ve{_parse(t){if(this._getType(t)!==de.nan){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.nan,received:r.parsedType}),Ee}return{status:"valid",value:t.data}}}Tw.create=e=>new Tw({typeName:Ne.ZodNaN,...Le(e)});class RT extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class F_ extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),Jl(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ee:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new F_({in:t,out:n,typeName:Ne.ZodPipeline})}}class Qh extends Ve{_parse(t){const n=this._def.innerType._parse(t),r=i=>(qa(i)&&(i.value=Object.freeze(i.value)),i);return Hh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Qh.create=(e,t)=>new Qh({innerType:e,typeName:Ne.ZodReadonly,...Le(t)});var Ne;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ne||(Ne={}));const b=Ai.create,W=Ka.create,xe=c0.create,Bi=h0.create;Os.create;const ee=li.create,I=$t.create;Wh.create;const vi=$_.create;Vh.create;ko.create;const Nr=qh.create,Z=Kh.create,Pe=Co.create;Gh.create;Oi.create;No.create;new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");const S6=["owner"],k6=["agent","owner","user-upload"],MT=I({id:b().min(1),relPath:b().min(1),from:Pe(k6),label:b().optional(),size:W().int().nonnegative(),mime:b().min(1),addedAt:W().int().nonnegative(),lastEditedAt:W().int().nonnegative().optional(),stale:xe().optional()});I({sessionId:b().min(1),relPath:b().min(1),ttlSeconds:W().int().positive().nullable().optional(),view:Pe(["raw","md-rendered"]).optional()});I({url:b().min(1),expiresAt:W().int().nonnegative().nullable()});I({sessionId:b().min(1),relPath:b().min(1),label:b().optional(),origin:Z("agent").optional()});I({entry:MT});I({sessionId:b().min(1),relPath:b().min(1)});I({removed:Z(!0)});I({sessionId:b().min(1)});I({entries:ee(MT)});I({attachmentId:b().min(1),url:b().min(1),relPath:b().min(1),sizeBytes:W().int().nonnegative(),mimeType:b().min(1)});const C6=vi("type",[I({type:Z("persona"),id:b().min(1)}).strict(),I({type:Z("chat"),id:b().min(1)}).strict(),I({type:Z("*")}).strict()]),E6=Pe(["read","send","admin"]),H_=I({resource:C6,actions:ee(E6).min(1)}).strict(),N6=I({id:b().min(1),secretHash:b().regex(/^[a-f0-9]{64}$/),displayName:b(),grants:ee(H_),issuedAt:W().int().nonnegative(),expiresAt:W().int().positive().optional(),maxUses:W().int().positive().optional(),usedCount:W().int().nonnegative(),peerOwnerId:b().min(1).optional(),firstUsedByPeerAt:W().int().positive().optional(),peerDisplayName:b().optional()}).strict(),T6=N6.omit({secretHash:!0});I({type:Z("whoami:ok"),owner:I({id:b(),kind:Pe(["owner","guest"]),displayName:b(),ownerId:b(),provider:b()}).strict(),capability:T6,grantedPersonas:ee(I({id:b().min(1),displayName:b()}).strict())}).strict();I({selfUrl:b().min(1)});I({type:Z("contact:handshake:ok"),owner:I({id:b(),ownerId:b(),provider:b(),displayName:b()}),grants:ee(H_)});const I6=I({name:b().min(1),from:b().optional(),version:b().optional(),min:b().optional()}),P6=I({name:b().min(1),env:ee(b().min(1)).min(1)}),R6=I({name:b().min(1)}),AT={clis:ee(I6),secrets:ee(P6),assets:ee(R6)};I(AT);const jT=I({version:Z(1),...AT}).strict(),M6=I({target:b().min(1),reason:b().min(1),file:b().min(1),quote:b().min(1)}),LT=Pe(["deployer","user"]),A6=Pe(["scanning","scanFailed","draft","ready","trialing","failed","deployed"]),j6=I({errorText:b().min(1),raw:b().optional(),suggest:b().optional()}).strict(),DT=I({deployId:b().min(1),personaId:b().min(1),status:A6,scanSessionId:b().optional(),manifest:jT.optional(),evidence:ee(M6).optional(),smokeTask:b().optional(),notes:ee(b()).default([]),fulfillment:Nr(b(),LT).default({}),gaps:ee(j6).default([]),error:b().optional(),createdAt:W(),updatedAt:W()}).strict();I({personaId:b().min(1)}).strict();I({deployId:b().min(1)}).strict();I({deployId:b().min(1),patch:I({fulfillment:Nr(b(),LT).optional(),smokeTask:b().min(1).optional(),manifest:jT.optional()}).strict()}).strict();I({deployId:b().min(1),name:b().min(1),values:Nr(b(),b())}).strict();I({deployId:b().min(1),kind:Pe(["cli","secret","asset"]),item:Nr(b(),Bi()),evidence:I({reason:b().min(1),file:b().min(1),quote:b().min(1)})}).strict();I({deployId:b().min(1),smokeTask:b().min(1),notes:ee(b()).default([])}).strict();const L6=I({name:b(),filled:W(),total:W()}).strict();I({receipt:DT,secretStatus:ee(L6)}).strict();I({receipts:ee(DT)}).strict();I({deviceId:b().min(1),remoteAccessAllowed:xe()}).strict();I({type:Z("contact:setRemoteAccess:ok"),deviceId:b().min(1),remoteAccessAllowed:xe()}).strict();I({type:Z("contact:remote-access-updated"),deviceId:b().min(1),remoteAccessAllowed:xe()}).strict();const D6=I({deviceId:b().min(1),ownerId:b().min(1),provider:b().min(1),displayName:b(),remoteUrl:b().min(1),connectToken:b(),grants:ee(H_),addedAt:W().int().nonnegative(),pinnedAt:W().int().nullable().default(null),remoteAccessAllowed:xe().default(!1),note:b().default("")}).strict(),OT=D6;I({deviceId:b().min(1)}).strict();I({type:Z("contact:remove:ok"),deviceId:b().min(1)}).strict();I({type:Z("contact:list:ok"),contacts:ee(OT)}).strict();I({type:Z("contact:added"),contact:OT}).strict();I({type:Z("contact:removed"),deviceId:b().min(1)}).strict();I({deviceId:b().min(1),pinned:xe()}).strict();I({deviceId:b().min(1),note:b()}).strict();I({type:Z("contact:setNote:ok"),deviceId:b().min(1),note:b()}).strict();I({type:Z("contact:pin:ok"),deviceId:b().min(1),pinnedAt:W().int().nullable()}).strict();I({type:Z("contact:pinned"),deviceId:b().min(1),pinnedAt:W().int().nullable()}).strict();const O6=I({deviceId:b().min(1),name:b().min(1),url:b().min(1)});I({type:Z("device:list:ok"),devices:ee(O6)});I({deviceId:b().min(1),url:b().min(1).optional(),name:b().optional()});I({type:Z("device:connect:ok"),deviceId:b(),name:b(),url:b()});const BT=I({ownerId:b().min(1),provider:b().min(1),displayName:b().min(1),avatarUrl:b().optional(),unionId:b().optional()});I({type:Z("auth:login:start:ok"),authUrl:b().min(1),state:b().min(1)});I({type:Z("auth:getIdentity:ok"),identity:BT.nullable(),deviceId:b().min(1),ttcTokenExpiresAt:W().nullable().optional()});I({type:Z("auth:logout:ok")});I({type:Z("auth:login:done"),identity:BT});I({type:Z("auth:login:failed"),reason:b()});const U_=vi("kind",[I({kind:Z("success"),text:b(),brief:b().optional(),filePaths:ee(b()).optional()}),I({kind:Z("failure"),reason:b(),brief:b().optional()})]);I({targetPersona:b().min(1).optional(),dispatchId:b().min(1).optional(),prompt:b(),brief:b().optional(),targetDeviceId:b().min(1).optional(),model:b().min(1).optional(),tool:b().min(1).optional(),sessionLabel:b().min(1).max(60).optional(),meta:Nr(Bi()).optional()}).refine(e=>e.targetPersona!==void 0||e.dispatchId!==void 0,{message:"either targetPersona (new dispatch) or dispatchId (follow-up) is required"}).refine(e=>!(e.dispatchId!==void 0&&e.targetDeviceId!==void 0),{message:"cross-device dispatch cannot be continued (dispatchId + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.tool!==void 0&&e.targetDeviceId!==void 0),{message:"engine override is not supported for cross-device dispatch (tool + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.dispatchId!==void 0&&(e.tool!==void 0||e.model!==void 0)),{message:"a follow-up dispatch cannot change engine or model (dispatchId excludes tool / model); start a new dispatch instead"});I({dispatchId:b().min(1),outcome:U_});const B6=["running","completed","failed"],W_=Pe(B6),z6=I({dispatchId:b().min(1),sourceSessionId:b().min(1),sourcePersonaId:b().min(1).optional(),targetPersonaId:b().min(1),workerSessionId:b().min(1).optional(),taskText:b(),taskBrief:b().optional(),round:W().int().positive().optional(),status:W_,outcome:U_.optional(),meta:Nr(Bi()).optional(),createdAt:b().min(1),completedAt:b().min(1).optional(),deliveredAt:b().min(1).optional()});I({sourceSessionId:b().min(1).optional()});I({records:ee(z6)});I({dispatchId:b().min(1)});I({type:Z("personaDispatch:get:ok"),status:W_,outcome:U_.optional()});const $6=/^[a-z0-9][a-z0-9-]*$/;Pe(["stopped","starting","running","crashed","invalid"]);const F6=new Set(["localhost","127.0.0.1"]);function H6(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&F6.has(t.hostname))}const ud=I({id:b().regex($6),name:b().min(1),version:b().min(1),apiVersion:Z("1"),runtime:I({startCommand:b().min(1)}).passthrough().optional(),entry:I({url:b().url().refine(H6,{message:"INVALID_URL_SCHEME: only https or http://localhost is allowed"})}).strict().optional()}).passthrough().superRefine((e,t)=>{var i;const n=!!e.runtime,r=!!((i=e.entry)!=null&&i.url);n&&r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),U6=vi("kind",[I({kind:Z("local"),port:W().int().min(1).max(65535)}),I({kind:Z("hosted"),url:b().url()})]);vi("state",[I({extId:b(),manifest:ud,state:Z("stopped")}),I({extId:b(),manifest:ud,state:Z("starting")}),I({extId:b(),manifest:ud,state:Z("running"),target:U6}),I({extId:b(),manifest:ud,state:Z("crashed")}),I({extId:b(),manifest:Bi().nullable(),state:Z("invalid"),invalidReason:b().min(1)})]);I({snapshotHash:b().min(1),version:b().min(1),publishedAt:W()});const W6=vi("kind",[I({kind:Z("p2p-tunnel"),ownerPrincipalId:b().min(1),extId:b().min(1)})]);vi("kind",[I({kind:Z("p2p-tunnel"),ownerPrincipalId:b().min(1),extId:b().min(1),snapshotHash:b().min(1)})]);I({extId:b().min(1),name:b().min(1),version:b().min(1),contentHash:b().min(1),publishedAt:W()});const V6=vi("kind",[I({kind:Z("clean")}),I({kind:Z("ready-new-version"),fromVersion:b().min(1),toVersion:b().min(1)}),I({kind:Z("error-same-hash"),version:b().min(1)}),I({kind:Z("error-version-not-bumped"),localVersion:b().min(1),publishedVersion:b().min(1)}),I({kind:Z("error-version-regression"),localVersion:b().min(1),publishedVersion:b().min(1)})]);I({localManifest:I({name:b().min(1),version:b().min(1),contentHash:b().min(1)}),publishState:vi("kind",[I({kind:Z("unpublished")}),I({kind:Z("published"),version:b().min(1),contentHash:b().min(1),publishedAt:W()})]),check:V6});I({extId:b().min(1),newVersion:b().min(1).nullish()});I({extId:b().min(1)});I({extId:b().min(1),snapshotHash:b().min(1)});I({channelRef:W6,snapshotHash:b().min(1),zipBase64:b().min(1)});I({id:b().min(1),peerDeviceId:b().min(1),senderDeviceId:b().min(1),text:b().min(1),createdAt:W().int().nonnegative(),readBy:Nr(b().min(1),W().int().positive()).default({}),origin:I({kind:Z("persona"),personaId:b().min(1)}).optional()}).strict();I({peerDeviceId:b().min(1).optional(),id:b().min(1),text:b().min(1),createdAt:W().int().nonnegative(),origin:I({kind:Z("persona"),personaId:b().min(1)}).optional()}).strict();I({peerDeviceId:b().min(1),sinceCreatedAt:W().int().nonnegative().optional()}).strict();I({peerDeviceId:b().min(1),upToCreatedAt:W().int().nonnegative()}).strict();I({peerDeviceId:b().min(1).optional(),text:b().min(1)});I({peerDeviceId:b().min(1).optional(),command:b().min(1),timeoutMs:W().int().positive().optional()}).strict();I({type:Z("peerExec:run:ok"),stdout:b(),stderr:b(),exitCode:W().int().nullable(),timedOut:xe(),stdoutTruncated:xe(),stderrTruncated:xe()}).strict();const zT=vi("kind",[I({kind:Z("at"),at:b().min(1)}),I({kind:Z("every"),everyMs:W().int().positive(),anchorMs:W().int().nonnegative().optional()}),I({kind:Z("cron"),expr:b().min(1),tz:b().min(1).optional()})]),xu=b().trim().min(1);I({personaId:xu,name:b().min(1),schedule:zT,prompt:b().min(1),targetPersona:b().min(1).optional(),timeoutMs:W().int().positive().optional()});I({personaId:xu,onlyMine:xe().optional()});I({personaId:xu,shiftId:b().min(1)});const q6=I({name:b().min(1).optional(),schedule:zT.optional(),prompt:b().min(1).optional(),targetPersona:b().min(1).optional(),timeoutMs:W().int().positive().optional(),enabled:xe().optional()});I({personaId:xu,shiftId:b().min(1),patch:q6});I({personaId:xu,shiftId:b().min(1),limit:W().int().positive().optional()});const K6="persona-master",V_=I({personaId:b().min(1),deviceId:b().min(1).optional()}),$T=I({id:b().min(1),name:b().min(1),memberPersonas:ee(V_),memberContactDeviceIds:ee(b().min(1)),createdAt:b().min(1),updatedAt:b().min(1)}),FT=b().trim().min(1);I({name:FT,memberPersonas:ee(V_).default([]),memberContactDeviceIds:ee(b().min(1)).default([])});I({channelId:b().min(1),name:FT.optional(),memberPersonas:ee(V_).optional(),memberContactDeviceIds:ee(b().min(1)).optional()});I({channelId:b().min(1)});I({channels:ee($T)});I({channel:$T});I({ok:Z(!0),removedTopics:W().int().min(0)});const Sn=b().trim().min(1),G6=["planning","running","done"],X6=Pe(G6),Y6=I({at:b().min(1),actor:b().min(1),action:b().min(1),target:b().optional(),reason:b().min(1),artifacts:ee(Sn).optional()}),Q6=I({rejectCount:W().int().min(0),accepted:xe().default(!1),ordinal:W().int().min(1).optional(),overrideCount:W().int().min(0).optional()}),q_=I({id:b().min(1),channelId:b().min(1),title:b(),masterSessionId:b().min(1),goal:b(),boundaries:b(),acceptanceCriteria:ee(b()),activity:ee(Y6),lineMeta:Nr(Q6),nextLineOrdinal:W().int().min(1).optional(),state:X6,createdAt:b().min(1),updatedAt:b().min(1)}),Z6=I({lineId:b().min(1),dispatchId:b().min(1),workerSessionId:b().optional(),assignee:b().min(1),focus:b(),status:W_,acceptance:ee(b()),rejectCount:W().int().min(0),accepted:xe(),ordinal:W().int().min(1).nullable()});I({channelId:b().min(1)});I({topicId:b().min(1).optional(),sessionId:b().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});I({channelId:b().min(1),title:Sn.optional()});I({topicId:b().min(1),title:Sn.optional(),goal:Sn,boundaries:b(),acceptanceCriteria:ee(Sn).min(1)});I({topicId:b().min(1),action:Sn,target:Sn.optional(),reason:Sn,artifacts:ee(Sn).optional()});I({topicId:b().min(1),lineId:Sn,reason:Sn});I({topicId:b().min(1),lineId:Sn,reason:Sn,artifacts:ee(Sn).optional(),watcherVerdict:Pe(["pass","fail"]),overrideReason:Sn.optional()}).refine(e=>e.watcherVerdict!=="fail"||!!e.overrideReason,{message:"watcherVerdict=fail 时必须给 overrideReason(推翻 watcher 的理由)",path:["overrideReason"]});I({topicId:b().min(1),state:Pe(["done"])});I({topicId:b().min(1),title:Sn});I({topicId:b().min(1)});const J6=q_.extend({lineCount:W().int().min(0)});I({topics:ee(J6)});I({topic:q_,lines:ee(Z6)});I({topicId:b().min(1),masterSessionId:b().min(1)});I({rejectCount:W().int().min(1),needsOwnerAttention:xe()});I({acceptedLines:W().int().min(1),totalLines:W().int().min(1),allAccepted:xe(),overrides:W().int().min(0),needsOwnerAttention:xe()});I({topic:q_});I({ok:Z(!0),removedMasterSessionId:b().min(1).nullable(),removedWorkerSessionIds:ee(b().min(1))});const eB=["ask","allow","deny"],HT=Pe(eB),tB=I({id:b().min(1),desc:b().min(1),action:HT});I({rules:ee(tB)});I({ruleId:b().min(1)});I({action:HT,desc:b(),source:b().min(1)});const nB=["created","review-requested"],UT=/^[A-Za-z0-9._-]+$/,pl=b().min(1).regex(UT),ml=b().min(1).regex(UT),_u=W().int().positive();I({role:Pe(nB)});I({owner:pl,repo:ml,number:_u});I({owner:pl,repo:ml,number:_u,expectedHeadSha:b().min(1)});I({owner:pl,repo:ml,number:_u,body:b().min(1)});I({owner:pl,repo:ml,number:_u,ready:xe()});I({owner:pl,repo:ml});I({owner:pl,repo:ml,number:_u,reviewers:ee(b().min(1)).min(1)});I({personaId:b().min(1)});I({personaId:b().min(1)});const rB=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],iB=Pe(rB);I({personaId:b().min(1),appId:b().min(1),appSecret:b().min(1),botName:b().min(1).optional()});const sB=I({chatId:b().min(1),chatName:b().optional(),lastActiveAt:W().int().optional()}),oB=I({state:Pe(["unbound","provisioning","bound","broken"]),appId:b().optional(),botName:b().optional(),brokenReason:b().optional(),qrUrl:b().optional(),errorReason:iB.optional(),groups:ee(sB),needsUpgrade:xe().optional(),upgradeQrUrl:b().optional()});oB.extend({personaId:b().min(1)});I({});I({onboardingCompletedAt:W()});I({});I({tools:ee(I({id:Pe(["claude","codex"]),available:xe(),version:b().optional(),path:b().optional()}))});I({});const aB=I({tool:Pe(["claude","codex"]),cwd:b(),toolSessionId:b(),label:b().optional(),createdAt:b(),updatedAt:b(),turns:W()});I({candidates:ee(aB)});I({});I({registered:xe()});const lB=I({personaId:b(),label:b(),model:b().optional(),effort:b().optional(),public:xe(),iconKey:b().optional(),tool:b().optional(),createdAt:W(),updatedAt:W()}).strict(),cB=I({name:b().min(1),description:b().optional()}),uB=I({id:b().min(1)}),WT=I({writableRoots:ee(b()).optional(),denyRead:ee(b()).optional(),network:xe().optional()}).strict(),dB=I({permissions:I({defaultMode:b().optional(),allow:ee(b()).optional(),deny:ee(b()).optional()}).optional(),sandbox:I({enabled:xe().optional(),autoAllowBashIfSandboxed:xe().optional(),allowUnsandboxedCommands:xe().optional(),excludedCommands:ee(b()).optional(),filesystem:I({denyRead:ee(b()).optional(),allowRead:ee(b()).optional(),denyWrite:ee(b()).optional(),allowWrite:ee(b()).optional()}).optional(),network:I({allowedDomains:ee(b()).optional(),allowLocalBinding:xe().optional()}).optional()}).optional()});lB.extend({personality:b().optional(),personalityLocal:b().optional(),personalityManaged:xe().optional(),skills:ee(cB).optional(),plugins:ee(uB).optional(),sandboxSettings:dB.nullable().optional(),codexSandbox:WT.nullable().optional()});I({slug:b().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:b().min(1),personality:b(),model:b().optional(),effort:b().optional(),tool:b().optional(),public:xe().optional(),iconKey:b().optional()}).strict();I({personaId:b().min(1)});I({personaId:b().min(1),patch:I({label:b().min(1).optional(),model:b().optional(),effort:b().optional(),tool:b().optional(),personality:b().optional(),personalityLocal:b().optional(),public:xe().optional(),iconKey:b().nullable().optional(),codexSandbox:WT.optional()}).strict()}).strict();const VT=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","session:queue","permission:request","session:question","session:question:cleared","pong","error","subscribed","unsubscribed","auth:ok","tunnel:ready","tunnel:exited","tunnel:unavailable","session:control","session:pty","contact:added","contact:pinned","contact:removed","contact:remote-access-updated","contact:note-updated","org-mesh:progress","channel:changed","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","appBuilder:project-updated","appBuilder:publish-progress","appBuilder:publish-failed","larkBot:state"],qT=["idle","running","running-idle","stopped","error","observing"],hB=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools","dispatch-task","dispatch-result"];function rp(e){return e==="dispatch-task"||e==="dispatch-result"}const fB=["builtin","global","project","plugin"],pB=["builtin","global","project","policy","plugin"],KT=Pe(["owner","guest"]);I({id:b().min(1),kind:KT,displayName:b(),feishuUnionId:b().optional()}).strict();const mB=I({did:b().min(1),displayName:b(),feishuUnionId:b().optional(),principal:KT}).strict(),gB=Pe(qT),vB=I({inputTokens:W().int().nonnegative(),outputTokens:W().int().nonnegative(),cacheReadTokens:W().int().nonnegative().optional(),cacheCreateTokens:W().int().nonnegative().optional()}),GT={gitBranch:b().optional(),resolvedModel:b().optional(),resolvedEffort:b().optional(),contextUsage:vB.optional(),contextWindowSize:W().int().positive().optional(),aiLabel:b().optional()},xB=I(GT),XT=I({value:b(),label:b(),description:b().optional()}),_B=I({id:b().min(1),label:b().min(1),description:b().optional(),contextWindowSize:W().int().positive(),default:xe().optional(),efforts:ee(XT).optional(),defaultEffort:b().optional()}),yB=I({id:b().min(1),label:b().min(1),description:b().optional()}),bB=I({name:b().min(1),type:Pe(["string","select","toggle"]),label:b().min(1),description:b().optional(),options:ee(XT).optional(),default:Bi().optional(),scope:Pe(["core","tool-specific"])});I({tool:b().min(1)});const wB=I({rewind:xe(),subagents:xe(),tui:xe(),observe:xe(),fileSharing:xe(),fork:xe()});I({tool:b().min(1),toolSessionIdLabel:b().optional(),models:ee(_B),permissionModes:ee(yB),configSchema:ee(bB),features:wB});const SB=I({tool:b().min(1),pattern:b().min(1),createdAt:b().min(1).optional()});I({sessionId:b().min(1),cwd:b().min(1),tool:Z("claude").or(b().min(1)).default("claude"),toolSessionId:b().optional(),label:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),...GT,aiLabelGeneratedAt:b().optional(),permissionRules:ee(SB).optional(),pinnedAt:W().int().nonnegative().nullable().optional(),archivedAt:W().int().nonnegative().nullable().optional(),pinSortOrder:W().int().nullable().optional(),unreadAt:b().min(1).nullable().optional(),iconKey:b().optional(),forkedFromSessionId:b().min(1).optional(),ephemeral:xe().optional(),deployId:b().min(1).optional(),ownerPersonaId:b().min(1).optional(),projectPath:b().min(1).optional(),appBuilderProject:b().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),chatId:b().min(1).optional(),creatorPrincipalId:b().min(1).optional(),creatorDisplayName:b().min(1).optional(),creatorFeishuUnionId:b().min(1).optional(),originOwnerPrincipalId:b().min(1).optional(),originOwnerPersonaId:b().min(1).optional(),dispatchedFromSessionId:b().min(1).optional(),shiftFiredFromSessionId:b().min(1).optional(),larkChatId:b().min(1).optional(),larkChatName:b().min(1).optional(),larkChatType:Pe(["p2p","group"]).optional(),createdAt:b().min(1),updatedAt:b().min(1)});const $n={seq:W().int().nonnegative().optional(),ts:b().optional(),uuid:b().optional()},kB=Pe(hB),CB=I({readCount:W().int().nonnegative().optional(),searchCount:W().int().nonnegative().optional(),bashCount:W().int().nonnegative().optional(),editFileCount:W().int().nonnegative().optional(),linesAdded:W().int().nonnegative().optional(),linesRemoved:W().int().nonnegative().optional(),otherToolCount:W().int().nonnegative().optional()}),EB=I({oldStart:W().int().nonnegative(),oldLines:W().int().nonnegative(),newStart:W().int().nonnegative(),newLines:W().int().nonnegative(),lines:ee(b())}),NB=I({agentId:b().optional(),agentType:b().optional(),status:b().optional(),prompt:b().optional(),filePath:b().optional(),structuredPatch:ee(EB).optional(),stats:I({durationMs:W().int().nonnegative().optional(),tokens:W().int().nonnegative().optional(),toolUseCount:W().int().nonnegative().optional(),toolStats:CB.optional()}).optional()}),TB=I({path:b(),content:b(),mtimeMs:W().optional()}),IB=I({label:b().min(1),description:b().optional()}),YT=I({question:b().min(1),multiSelect:xe(),options:ee(IB).min(1)}),PB=["completed","interrupted"];vi("kind",[I({...$n,kind:Z("session_init"),toolSessionId:b().optional()}),I({...$n,kind:Z("thinking"),text:b(),partialId:b().optional()}),I({...$n,kind:Z("text"),text:b(),partialId:b().optional()}),I({...$n,kind:Z("user_text"),text:b(),meta:kB.optional(),taskId:b().optional(),parentToolUseId:b().optional(),sender:mB.optional()}),I({...$n,kind:Z("tool_call"),toolUseId:b(),tool:b(),toolKind:b().optional(),input:Bi()}),I({...$n,kind:Z("tool_result"),toolUseId:b(),output:Bi().optional(),error:b().optional(),toolResultExtra:NB.optional(),sourceToolAssistantUUID:b().optional(),askQuestionAnswers:Nr(b(),b()).optional()}),I({...$n,kind:Z("attachment_memories"),memories:ee(TB)}),I({...$n,kind:Z("permission_request"),requestId:b(),tool:b(),input:Bi(),toolUseId:b().optional()}),I({...$n,kind:Z("ask_user_question"),toolUseId:b(),questions:ee(YT)}),I({...$n,kind:Z("turn_end"),durationMs:W().int().nonnegative().optional(),reason:Pe(PB).optional()}),I({...$n,kind:Z("subagent_progress"),toolUseId:b(),agentId:b(),status:Pe(["started","running","completed","failed"]),description:b().optional(),lastToolName:b().optional(),prompt:b().optional(),stats:I({durationMs:W().int().nonnegative().optional(),tokens:W().int().nonnegative().optional(),toolUseCount:W().int().nonnegative().optional()}).optional()}),I({...$n,kind:Z("error"),message:b()}),I({...$n,kind:Z("meta_update"),patch:xB}),I({...$n,kind:Z("meta-text"),text:b(),metaSource:Pe(["cc","owner"]).optional()})]);I({cwd:b().min(1).optional(),tool:b().optional(),label:b().optional(),aiLabel:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),iconKey:b().optional(),forkedFromSessionId:b().min(1).optional(),ephemeral:xe().optional(),ownerPersonaId:b().min(1).optional(),projectPath:b().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});I({path:b().min(1),name:b().min(1),createdAt:b().datetime(),pinnedAt:W().optional()});I({path:b().min(1),pinnedAt:W().nullable()});I({path:b().min(1)});I({path:b().min(1).optional(),name:b().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});I({cwd:b().min(1),tool:b().min(1),toolSessionId:b().min(1),label:b().optional(),aiLabel:b().optional(),iconKey:b().optional(),createdAt:b().datetime(),updatedAt:b().datetime(),ownerPersonaId:b().min(1).optional()});I({originOnly:xe().optional(),ownerPersonaId:b().min(1).optional(),limit:W().int().positive().optional(),offset:W().int().nonnegative().optional()});I({sessionId:b().min(1)});I({sessionId:b().min(1),patch:I({label:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),cwd:b().optional(),iconKey:b().optional(),ephemeral:Z(!1).optional()})});I({id:b().min(1),text:b(),queuedAt:W(),senderDisplayName:b().optional()});I({sessionId:b().min(1),text:b(),queueWhileRunning:xe().optional()});I({sessionId:b().min(1),id:b().min(1).optional()});I({sessionId:b().min(1),userMessageId:b().min(1),dryRun:xe().optional()});I({canRewind:xe(),error:b().optional(),filesChanged:ee(b()).optional(),insertions:W().int().nonnegative().optional(),deletions:W().int().nonnegative().optional()});I({sessionId:b().min(1),userMessageId:b().min(1)});const RB=I({oldStart:W().int().nonnegative(),oldLines:W().int().nonnegative(),newStart:W().int().nonnegative(),newLines:W().int().nonnegative(),lines:ee(b())}),MB=I({filePath:b().min(1),hunks:ee(RB),insertions:W().int().nonnegative(),deletions:W().int().nonnegative(),status:Pe(["modified","added","deleted"]).optional()});I({canRewind:xe(),error:b().optional(),files:ee(MB),totalInsertions:W().int().nonnegative(),totalDeletions:W().int().nonnegative()});I({userMessageIds:ee(b())});I({sessionId:b().min(1),toolSessionId:b().min(1)});I({cwd:b().min(1),toolSessionId:b().min(1),messageUuid:b().min(1),targetCwd:b().min(1).optional()});I({forkedToolSessionId:b().min(1),forkedFilePath:b().min(1)});I({sessionId:b().min(1),toolSessionId:b().min(1),jsonlPath:b().optional()});I({sessionId:b().min(1),afterSeq:W().int().min(-1)});I({sessionId:b().min(1),permissionRequestId:b().min(1),allow:xe(),permanent:xe().optional(),pattern:b().optional()});I({projectPath:b().min(1)});I({sessionId:b().min(1),limit:W().int().positive().max(5e3).optional(),offset:W().int().nonnegative().optional(),slim:xe().optional()});I({cwd:b().min(1),toolSessionId:b().min(1)});I({cwd:b().min(1),toolSessionId:b().min(1),subagentId:b().min(1)});I({cwd:b().min(1).optional(),path:b().optional(),showHidden:xe().optional()});I({cwd:b().min(1),path:b().min(1)});I({cwd:b().min(1),tool:b().optional()});I({name:b().min(1),source:Pe(fB),path:b().optional(),description:b().optional(),plugin:b().optional()});const AB=I({name:b().min(1),source:Pe(pB),path:b().optional(),description:b().optional(),whenToUse:b().optional(),plugin:b().optional()});I({cwd:b().min(1),tool:b().optional()});I({agents:ee(AB)});I({sessionId:b().optional()});I({sessionId:b().min(1).optional()});I({sessionId:b().min(1),pinned:xe()});I({sessionId:b().min(1),archived:xe()});I({query:b().min(1),sessionIds:ee(b().min(1)),limit:W().int().positive().max(50).optional()});const jB=I({sessionId:b().min(1),snippet:b()});I({type:Z("session:searchContent"),matches:ee(jB)});I({type:Z("peerSession:upsert:ok")});I({sessionId:b().min(1)});I({type:Z("peerSession:remove:ok")});I({orderedIds:ee(b().min(1)).min(1)});I({cwd:b().min(1)});I({isGitRoot:xe(),gitRoot:b().nullable()});I({cwd:b().min(1)});I({branch:b().nullable()});I({cwd:b().min(1)});I({branches:ee(b()),head:b().nullable()});const LB=I({cwd:b().min(1),updatedAt:b().min(1)});I({dirs:ee(LB)});I({type:Z("session:question"),sessionId:b().min(1),toolUseId:b().min(1),requestId:b().min(1),questions:ee(YT).min(1)});I({type:Z("session:question:cleared"),sessionId:b().min(1),toolUseId:b().min(1),answers:Nr(b(),b()).optional()});I({sessionId:b().min(1),toolUseId:b().min(1),answers:Nr(b(),b())});I({ok:Z(!0)});I({sessionId:b().min(1),toolUseId:b().min(1)});I({ok:Z(!0)});const QT=I({name:b().min(1),version:b().min(1),instanceId:b().min(1),deviceLabel:b().transform(e=>e.trim().slice(0,64)).optional()});I({type:Z("auth"),token:b().min(1),scheme:Z("bearer").optional(),clientInfo:QT.optional()});I({type:Z("auth:ok"),version:b().min(1).optional(),protocolVersion:W().int().nonnegative().optional()});const DB=I({clientId:b().min(1),connectedAt:W().int().nonnegative(),self:xe(),clientInfo:QT.optional()});I({type:Z("device:connections:ok"),connections:ee(DB)});I({type:Z("tunnel:ready"),url:b().min(1),subdomain:b().min(1)});I({type:Z("tunnel:exited"),code:W().int().nullable(),subdomain:b().nullable(),url:b().nullable()});I({type:Z("tunnel:unavailable"),reason:b().min(1),failedAt:b().min(1)});const OB=I({sessionId:b().min(1),status:gB,freshSpawn:xe(),pendingPermissionRequestIds:ee(b().min(1)),pendingQuestionToolUseIds:ee(b().min(1))});I({type:Z("info"),version:b(),protocolVersion:W(),hostname:b(),os:b(),tools:ee(I({id:b(),available:xe()})),runningSessions:ee(OB),tokenRole:Pe(S6).optional(),isLoopback:xe().optional(),httpBaseUrl:b().optional(),httpToken:b().optional(),daemonSource:Pe(["ota","packaged"]).optional(),globalCliVersion:b().nullable().optional()});const BB=6173,zB=6272,gl=/^[a-z][a-z0-9-]{0,39}$/,yu=I({name:b().regex(gl,{message:"kebab-case, 小写字母开头,只允许小写字母 / 数字 / -,最长 40 字符"}),port:W().int().min(BB).max(zB),createdAt:b().datetime(),devCommand:b().min(1),prodUrl:b().url().optional(),readyPattern:b().optional(),publishJob:I({jobId:b().min(1),stage:Pe(["build","deploy","verify"]),startedAt:W().int().nonnegative()}).optional()}),$B=["install-pending","installing","starting-dev-server","running","stopped","failed"],ZT=Pe($B),K_=yu.extend({isRunning:xe(),boundSessionId:b().nullable(),stage:ZT.optional(),stageReason:b().optional(),publishJob:I({jobId:b().min(1),stage:Pe(["build","deploy","verify"]),startedAt:W().int().nonnegative(),status:Pe(["in-flight","interrupted"])}).optional()});I({}).strict();I({projects:ee(K_)}).strict();I({sessionId:b().min(1)}).strict();I({project:K_.nullable()}).strict();I({sessionId:b().min(1),name:b().min(1)}).strict();I({project:yu}).strict();I({name:b()}).strict();I({}).strict();I({name:b(),newPort:W().int()}).strict();I({project:yu}).strict();I({name:b().regex(gl),url:b().url()}).strict();I({project:yu}).strict();I({sessionId:b().min(1),force:xe().optional()}).strict();I({project:yu}).strict();const FB=["installing","failed"];I({sessionId:b().min(1),stage:Pe(FB),reason:b().optional()}).strict();I({ok:Z(!0)}).strict();I({sessionId:b().min(1)}).strict();I({ok:Z(!0)}).strict();I({type:Z("appBuilder:project-updated"),project:K_,stage:ZT,stageReason:b().optional()}).strict();I({name:b().regex(gl)});I({jobId:b().min(1),status:Pe(["started","already-publishing"])}).strict();I({name:b().regex(gl)});I({ok:Z(!0)}).strict();I({type:Z("appBuilder:publish-progress"),name:b().regex(gl),jobId:b().min(1),stage:Pe(["build","deploy","verify"]),status:Pe(["started","completed"])}).strict();I({type:Z("appBuilder:publish-failed"),name:b().regex(gl),jobId:b().min(1),stage:Pe(["build","deploy","verify","unknown"]),errorSummary:b()}).strict();I({});I({method:b().min(1).optional()});const HB=["allowed","conditional","denied"],UB=Pe(HB),WB=I({name:b().min(1),status:UB,description:b().min(1),args:ee(I({name:b(),required:xe()})).nullable(),argsSchema:Nr(Bi()).optional(),reason:b().optional()});I({type:Z("meta:methods"),methods:ee(WB)});const Iw=1,VB=["daemon","main","renderer"],qB=Pe(VB),KB=["debug","info","warn","error"],GB=Pe(KB);I({ts:W().int(),source:qB,level:GB,msg:b(),ownerPrincipalId:b(),deviceId:b(),appVersion:b(),daemonVersion:b().optional(),os:b(),meta_json:b().optional(),sessionId:b().optional()});I({v:Z(1),visitorId:b().min(1),displayName:b(),provider:b(),iat:W(),exp:W()});const XB=I({visitorId:b(),displayName:b(),avatarUrl:b().optional(),provider:b(),firstSeen:W(),lastSeen:W()});I({visitors:ee(XB)});const YB=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,JT=/<system-reminder>此消息来自 (owner|guest):(.+?)<\/system-reminder>\s*$/,QB="clawd-dispatch-task",ZB="clawd-dispatch-result",Pw=120;function JB(e){if(!e)return[];const t=[];for(const n of["task","result"]){const r=n==="task"?QB:ZB,i=new RegExp(`<${r}\\b([^>]*)>([\\s\\S]*?)</${r}>`,"gi");for(let s=i.exec(e);s!==null;s=i.exec(e))t.push({at:s.index,block:ez(n,s[1]??"",s[2]??"")})}return t.sort((n,r)=>n.at-r.at).map(n=>n.block)}function ez(e,t,n){var c;const r=az(t),i=g0(oz(Rm(n,"detail")??n)),s=(c=Rm(n,"brief"))==null?void 0:c.trim(),o=s&&s.length>0?g0(s):tz(i),a=r.round!==void 0?Number.parseInt(r.round,10):void 0,l=r.status;return{kind:e,dispatchId:r["dispatch-id"]??"",...r.from?{from:r.from}:{},...e==="task"&&a!==void 0&&Number.isFinite(a)?{round:a}:{},...e==="result"&&(l==="success"||l==="failure")?{status:l}:{},brief:o,briefIsDerived:!(s&&s.length>0),detail:i,filePaths:sz(Rm(n,"files"))}}function tz(e){const t=e.split(/\n\s*\n/).map(r=>r.trim()).find(r=>r.length>0);if(!t)return"";const n=t.replace(/\s+/g," ");return n.length>Pw?`${n.slice(0,Pw)}…`:n}const nz="clawd-dispatch-task|clawd-dispatch-result|brief|detail|files",rz=new RegExp(`<\\\\(\\\\*)(/?)(${nz})\\b`,"g");function iz(e){return g0(e)}function g0(e){return e.replace(rz,"<$1$2$3")}function Rm(e,t){const n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`,"i").exec(e);return n?n[1]??"":null}function sz(e){return e?e.split(`
|
|
96
|
+
`).map(t=>t.trim()).filter(t=>t.startsWith("- ")).map(t=>t.slice(2).trim()).filter(t=>t.length>0):[]}function oz(e){return e.replace(/^\n/,"").replace(/\n$/,"")}function az(e){const t={},n=/([a-z-]+)="([^"]*)"/gi;for(let r=n.exec(e);r!==null;r=n.exec(e))t[r[1]]=lz(r[2]??"");return t}function lz(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}const cz=new Set(["localhost","127.0.0.1","0.0.0.0","::1"]);let ki=null;function uz(){if(ki!==null)return ki;if(typeof window>"u")return ki=!1,!1;if(cz.has(window.location.hostname)||window.location.protocol==="file:")return ki=!0,!0;if(new URLSearchParams(window.location.search).get("debug")==="1"){ki=!0;try{sessionStorage.setItem("debug","1")}catch{}}else try{ki=sessionStorage.getItem("debug")==="1"}catch{ki=!1}return ki}function Ae(e,...t){uz()&&console.log(`[${e}][${new Date().toISOString()}]`,...t)}function dd(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const dz=e=>{const t=[1e3,2e3,4e3,8e3,16e3,3e4];return t[Math.min(e,t.length-1)]},hz=new Set(["auth:ok","pong","error"]),Rw=new Set(VT.filter(e=>!hz.has(e)));let fz=0;const Mw=()=>`r${++fz}`;function pz(e){let t=e.url,n=e.authToken,r=e.selfIdentity;const i=e.clientInfo,s=e.requestTimeoutMs??3e4,o=e.pingIntervalMs??3e4,a=e.watchdogMs??6e4,l=e.authTimeoutMs??1e4,c=e.backoffMs??dz;let u=null,d=!1,f=0,p=null,m=null,v=null,w=null,x=!1,_="disconnected";const y=new Map,S=new Map;let C=null;const k=(B,E)=>{var H;B==="ready"&&(C=E),(H=S.get(B))==null||H.forEach(q=>{try{q(E)}catch{}})},N=B=>{_!==B&&(_=B,k("status",B))},T=(B,E)=>{const H=S.get(B)??new Set;if(H.add(E),S.set(B,H),B==="ready"&&C!==null)try{E(C)}catch{}return()=>H.delete(E)},z=()=>{m&&(clearInterval(m),m=null),v&&(clearTimeout(v),v=null),w&&(clearTimeout(w),w=null)},P=()=>{v&&clearTimeout(v),v=setTimeout(()=>{try{u==null||u.close(4e3,"pong watchdog")}catch{}},a)},O=()=>{m&&clearInterval(m),m=setInterval(()=>{(u==null?void 0:u.readyState)===1&&u.send(JSON.stringify({type:"ping",requestId:Mw()}))},o),P()},M=B=>{for(const[,E]of y)clearTimeout(E.timer),E.reject(new Error(B));y.clear()},R=[],A=()=>{if(R.length===0)return;const B=R.splice(0);for(const E of B)(u==null?void 0:u.readyState)===1&&!x?E.doSend():(clearTimeout(E.timer),E.reject(new Error("NOT_CONNECTED")))},L=B=>{if(R.length===0)return;const E=R.splice(0);for(const H of E)clearTimeout(H.timer),H.reject(new Error(B))},$=()=>{if(d)return;const B=c(f);if(B<0){L("connection closed: not reconnecting");return}k("daemon:reconnecting",{attempt:f+1,nextDelayMs:B,scheduledAt:Date.now()}),p&&clearTimeout(p),p=setTimeout(()=>{f+=1,D()},B)},F=B=>{P();const E=String(B.type??"");if(E==="auth:ok"){Ae("daemon-client","auth:ok received → connected",{url:t}),w&&(clearTimeout(w),w=null),x=!1,f=0,N("connected"),k("daemon:connected",{url:t}),O(),A();return}if(E==="pong")return;if(E==="ready"){const q=Number(B.protocolVersion??-1);q!==Iw&&k("daemon:version-mismatch",{daemonProtocol:q,supportedProtocol:Iw}),k("ready",B);return}const H=B.requestId;if(typeof H=="string"&&y.has(H)){const q=y.get(H);if(y.delete(H),clearTimeout(q.timer),E==="error"){const j=String(B.code??"ERR"),ne=String(B.message??"unknown");q.reject(new Error(`${j}: ${ne}`))}else Rw.has(E)&&k(E,B),q.resolve(B);return}Rw.has(E)&&k(E,B)},D=()=>{p&&(clearTimeout(p),p=null),Ae("daemon-client","connect →",{url:t,token:dd(n),attempt:f}),N("connecting");let B;try{B=new WebSocket(t)}catch(E){N("disconnected"),k("daemon:disconnected",{reason:(E==null?void 0:E.message)??"ws constructor failed"}),$();return}u=B,x=!!n,B.onopen=()=>{if(B!==u){Ae("daemon-client","onopen → stale (replaced before opened), ignore");return}if(n){Ae("daemon-client","onopen → send auth frame",{token:dd(n)});const E={type:"auth",token:n};r!=null&&r.principalId&&(E.selfPrincipalId=r.principalId),r!=null&&r.displayName&&(E.selfDisplayName=r.displayName),i&&(E.clientInfo=i),B.send(JSON.stringify(E)),w=setTimeout(()=>{try{B.close(4001,"auth handshake timeout")}catch{}},l)}else Ae("daemon-client","onopen → no token, treat as connected (daemon authMode=none)"),f=0,N("connected"),k("daemon:connected",{url:t}),O(),A()},B.onclose=E=>{if(B!==u){Ae("daemon-client","onclose → stale, ignore",{code:E.code,reason:E.reason});return}const H=E.reason||(E.code===1008?"auth failed":`close ${E.code}`);if(Ae("daemon-client","onclose →",{code:E.code,reason:H,awaitingAuth:x,manualStop:d}),z(),M(`connection closed: ${H}`),u=null,E.code===4401?N("revoked"):N("disconnected"),k("daemon:disconnected",{reason:H}),E.code===1008||E.code===4401){L(`connection closed: ${H}`);return}d?L(`connection closed: ${H}`):$()},B.onerror=()=>{},B.onmessage=E=>{if(B!==u)return;let H;try{H=JSON.parse(String(E.data))}catch{return}F(H)}};return{start(){d=!1,f=0,D()},stop(){d=!0,p&&(clearTimeout(p),p=null),z();try{u==null||u.close(1e3,"shutdown")}catch{}u=null,M("shutdown"),L("shutdown"),N("disconnected")},switchProfile(B){Ae("daemon-client","switchProfile →",{url:B.url,token:dd(B.authToken)},"prev:",{url:t,token:dd(n)}),t=B.url,n=B.authToken,B.selfIdentity!==void 0&&(r=B.selfIdentity),f=0,d=!0,p&&(clearTimeout(p),p=null),z(),M("switch profile"),L("switch profile");try{u==null||u.close(1e3,"switch profile")}catch{}u=null,d=!1,D()},request(B,E){return new Promise((H,q)=>{const j=Mw(),ne=setTimeout(()=>{y.delete(j);const K=R.findIndex(_e=>_e.timer===ne);K>=0&&R.splice(K,1),q(new Error(`request timeout: ${B}`))},s),ie=()=>{y.set(j,{resolve:K=>H(K),reject:q,timer:ne}),u.send(JSON.stringify({...E,type:B,requestId:j}))};(u==null?void 0:u.readyState)===1&&!x?ie():d||u==null&&p==null?(clearTimeout(ne),q(new Error("NOT_CONNECTED"))):R.push({doSend:ie,reject:q,timer:ne})})},on:T,get isOpen(){return(u==null?void 0:u.readyState)===1&&!x},get url(){return t},getStatus(){return _}}}function mz(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}function gz(e){return e?{id:e.id,mode:e.mode,url:e.url,token:mz(e.token),name:e.name}:null}function hd(e){return e?Array.isArray(e)?e.map(gz):{_notArray:typeof e,_value:e}:null}function Aw(e){return e==null?null:typeof e=="object"&&"value"in e?e.value:e}const vz="ws://127.0.0.1:18790",jw="daemon:profiles",Lw="daemon:active-profile-id";function xz(){return Math.random().toString(36).slice(2,10)}function _z(e){const t=e.trim(),n=t.indexOf("#");if(n<0)return{url:t};const r=t.slice(0,n),i=new URLSearchParams(t.slice(n+1)).get("token")??void 0;return{url:r,token:i}}function yz(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.name=="string"&&(t.mode==="localhost"||t.mode==="remote")&&typeof t.url=="string"&&(t.token===void 0||typeof t.token=="string")}function eI(e){let t={profiles:[],activeId:null},n=!1,r=null;const i=new Set,s=()=>{for(const l of i)l(t)},o=async()=>{Ae("profile-store","persist →",hd(t.profiles),"active:",t.activeId),await e.kv.set(jw,t.profiles),await e.kv.set(Lw,t.activeId)},a=async()=>{if(!n){if(r){await r;return}r=(async()=>{var l;try{let c=null;try{const d=await e.kv.get(jw);c=Aw(d)}catch{c=null}let u=null;try{const d=await e.kv.get(Lw);u=Aw(d)??null}catch{u=null}if(Ae("profile-store","ensureLoaded read kv →","profiles:",hd(c),"activeId:",u),Array.isArray(c)&&c.length>0){const d=c.filter(yz),f=u&&d.some(p=>p.id===u)?u:((l=d[0])==null?void 0:l.id)??null;t={profiles:d,activeId:f},n=!0,Ae("profile-store","ensureLoaded → use kv profiles",hd(d),"active:",f);return}t={profiles:[{id:"default",name:"本机",mode:"localhost",url:vz}],activeId:"default"},Ae("profile-store","ensureLoaded → fallback synthesized default (NO token)",hd(t.profiles)),n=!0,await o()}finally{r=null}})(),await r}};return{async load(){return await a(),s(),t},async snapshot(){return await a(),t},async upsert(l){var w;await a();let c=l.url,u=l.token;if(c&&c.includes("#")){const x=_z(c);c=x.url,!u&&x.token&&(u=x.token)}const d=l.id?t.profiles.find(x=>x.id===l.id):void 0,f=u!=null&&u.trim()?u.trim():d==null?void 0:d.token;if(l.mode==="remote"&&!f)throw new Error("remote mode requires token");const p=l.id??xz(),m={id:p,name:((w=l.name)==null?void 0:w.trim())||(d==null?void 0:d.name)||(l.mode==="remote"?"远程":"本机"),mode:l.mode,url:c.trim(),token:f};return t={profiles:[...t.profiles.filter(x=>x.id!==p),m],activeId:p},await o(),s(),m},async delete(l){var d;await a();const c=t.profiles.filter(f=>f.id!==l);let u=t.activeId;u===l&&(u=((d=c[0])==null?void 0:d.id)??null),t={profiles:c,activeId:u},await o(),s()},async activate(l){await a(),t.profiles.some(c=>c.id===l)&&(t={...t,activeId:l},await o(),s())},subscribe(l){return i.add(l),()=>i.delete(l)},getActive(){return n?t.profiles.find(l=>l.id===t.activeId)??null:null}}}const Dw="clawd.client-instance-id";let bz={name:"clawd-web",version:"unknown"};function wz(){let e=null;try{e=localStorage.getItem(Dw),e||(e=crypto.randomUUID(),localStorage.setItem(Dw,e))}catch{e=e??crypto.randomUUID()}return{...bz,instanceId:e}}function Ow(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const tI=g.createContext(null);function Sz({host:e,children:t}){const[n,r]=g.useState(null),i=g.useMemo(()=>async()=>{const s=eI(e),o=await s.load(),a=o.profiles.find(c=>c.id===o.activeId)??o.profiles[0];if(!a)throw new Error("DaemonProvider: profile store has no profiles after load");return Ae("daemon-context","bootstrap → createDaemonClient",{id:a.id,url:a.url,token:Ow(a.token)}),{client:pz({url:a.url,authToken:a.token,clientInfo:wz()}),store:s}},[e]);return g.useEffect(()=>{let s=!0,o=null,a=null;return i().then(l=>{s&&(l.client.start(),o=l,r(l),a=l.store.subscribe(()=>{const c=l.store.getActive();if(!c){Ae("daemon-context","subscribe → no active profile, skip switchProfile");return}Ae("daemon-context","subscribe → switchProfile",{id:c.id,url:c.url,token:Ow(c.token)}),l.client.switchProfile({url:c.url,authToken:c.token})}))}),()=>{s=!1,a==null||a(),o==null||o.client.stop()}},[i]),n?h.jsx(tI.Provider,{value:n,children:t}):null}function xi(){const e=g.useContext(tI);if(!e)throw new Error("useDaemonClient must be used inside <DaemonProvider>");return e.client}function kz(){const e=xi(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i.mode,o=s==="tui"?"tui":"sdk";Ae("daemon-context","useDaemonMode ready.mode =",{rawMode:s,resolved:o}),n(o)}),[e]),t}function Cz(){const e=xi(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i;s.version!==void 0&&n(s.principalKind==="guest"?"guest":"owner")}),[e]),t}const nI=g.createContext(null);function Ez({cache:e,children:t}){return g.createElement(nI.Provider,{value:e},t)}function zo(){const e=g.useContext(nI);if(!e)throw new Error("useCache must be used inside <CacheProvider>");return e}function fi(e){const t=zo(),n=g.useCallback(i=>t.observe(e,()=>i()),[t,e]),r=g.useCallback(()=>t.read(e),[t,e]);return g.useSyncExternalStore(n,r,r)}const rI={actionsLevel:"none",httpBaseUrl:null,httpToken:null},iI=g.createContext(rI);function ip(){return g.useContext(iI)}function Nz(e){return e!=null&&e.httpBaseUrl?{actionsLevel:e.tokenRole==="owner"?"owner":"none",httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken??null}:rI}function Tz(){const e=fi("daemon-info");return g.useMemo(()=>Nz(e),[e])}function Iz({children:e}){const t=Tz();return Ze.createElement(iI.Provider,{value:t},e)}function Pz(e,t,n){if(!e.httpBaseUrl)return null;const r=encodeURIComponent(n);return`${e.httpBaseUrl}/session/${encodeURIComponent(t.sessionId)}/files?path=${r}`}function Rz(e){const t=new Map;return{observe(n,r){let i=t.get(n);i||(i={data:void 0,hasData:!1,listeners:new Set},t.set(n,i));const s=l=>r(l);i.listeners.add(s);const o=i.listeners.size===1;s(i.hasData?i.data:void 0),o&&e.onFirstObserver(n);let a=!1;return()=>{if(a)return;a=!0;const l=t.get(n);l&&(l.listeners.delete(s),l.listeners.size===0&&(t.delete(n),e.onLastObserver(n)))}},read(n){const r=t.get(n);return r!=null&&r.hasData?r.data:void 0},setData(n,r){const i=t.get(n);if(!i)return;const s=i.hasData?i.data:void 0,o=r(s);i.data=o,i.hasData=!0;for(const a of i.listeners)a(o)}}}function Mz(){const e=[],t=new Map,n=r=>{for(const i of e)if(i.pattern.test(r))return i.source;return null};return{register(r,i){e.push({pattern:r,source:i})},activate(r){if(t.has(r))return;const i=n(r);if(!i)throw new Error(`no source registered for key: ${r}`);t.set(r,i.start(r))},deactivate(r){const i=t.get(r);i&&(t.delete(r),i())}}}function Az(e){return{request:(t,n)=>e.request(t,n),onFrame(t){const n=[];for(const r of VT)n.push(e.on(r,i=>t(r,i)));return()=>{for(const r of n)r()}},onConnect(t){return e.on("daemon:connected",()=>t())},get isConnected(){return e.isOpen}}}function sI(e){const t=(e??"claude")==="claude";return{rewind:t,subagents:t,tui:t,observe:t,fileSharing:t,fork:t}}const jz=e=>({tool:e,models:[{id:"",label:"未指定",contextWindowSize:2e5,default:!0}],permissionModes:[{id:"",label:"未指定"}],configSchema:[],features:sI(e)});function Lz(e,t){return{start(n){const r=n.replace(/^capabilities\//,"");let i=!1;const s=async()=>{try{const a=await e.request("capabilities:get",{tool:r});if(i)return;t(n,()=>a)}catch{if(i)return;t(n,()=>jz(r))}},o=e.onConnect(()=>{s()});return s(),()=>{i=!0,o()}}}}function Dz(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("session:list",void 0);if(r)return;t(n,()=>a.sessions??[])}catch{}},s=e.onFrame((a,l)=>{if(a==="session:info"){const c=l;if(c.chatId!==void 0)return;t(n,u=>[c,...(u??[]).filter(d=>d.sessionId!==c.sessionId)])}else if(a==="session:deleted"){const c=l;t(n,u=>(u??[]).filter(d=>d.sessionId!==c.sessionId))}}),o=e.onConnect(()=>{i()});return i(),()=>{r=!0,s(),o()}}}}const Qc={sessionId:null,events:[],lastSeq:-1,pendingPermissions:[],status:"idle",pendingQuestions:{},queued:[]};function Mm(e,t){const n=t;if(n.kind==="permission_request"&&typeof n.requestId=="string"){if(e.some(i=>i.requestId===n.requestId))return e;const r={requestId:n.requestId,tool:typeof n.tool=="string"?n.tool:"",input:n.input,...typeof n.toolUseId=="string"&&n.toolUseId?{toolUseId:n.toolUseId}:{}};return[...e,r]}if(n.kind==="tool_result"&&typeof n.toolUseId=="string"&&n.toolUseId){const r=e.findIndex(i=>i.toolUseId===n.toolUseId);if(r>=0)return e.filter((i,s)=>s!==r)}return e}function oI(e,t,n){const r=n===void 0?e.sessionId:n;switch(t.type){case"session:change":return{...Qc,sessionId:t.sessionId};case"session:event":{if(!r||t.sessionId!==r)return e;const i=typeof t.event.seq=="number"?t.event.seq:-1,s=[...e.events,t.event],o=i>e.lastSeq?i:e.lastSeq,a=Mm(e.pendingPermissions,t.event);return{...e,events:s,lastSeq:o,pendingPermissions:a}}case"session:status":return!r||t.sessionId!==r?e:{...e,status:t.status};case"session:queue":return!r||t.sessionId!==r?e:{...e,queued:t.items};case"session:events":{if(!r||t.sessionId!==r)return e;const i=t.events.map(o=>o.event),s=i.reduce((o,a)=>Mm(o,a),[]);return{...e,sessionId:t.sessionId,events:i,lastSeq:t.latestSeq,pendingPermissions:s}}case"session:events:append":{if(!r||t.sessionId!==r)return e;const i=new Set;for(const c of e.events){const u=c.seq;typeof u=="number"&&i.add(u)}const s=[];for(const c of t.events)typeof c.seq=="number"&&(i.has(c.seq)||s.push(c.event));const o=t.latestSeq>e.lastSeq?t.latestSeq:e.lastSeq;if(s.length===0)return o===e.lastSeq?e:{...e,lastSeq:o};const a=[...e.events,...s].sort((c,u)=>{const d=c.seq??-1,f=u.seq??-1;return d-f}),l=s.reduce((c,u)=>Mm(c,u),e.pendingPermissions);return{...e,events:a,lastSeq:o,pendingPermissions:l}}case"permission:request":{if(!r||t.sessionId!==r||e.pendingPermissions.some(s=>s.requestId===t.requestId))return e;const i={requestId:t.requestId,tool:t.tool,input:t.input,...t.toolUseId?{toolUseId:t.toolUseId}:{}};return{...e,pendingPermissions:[...e.pendingPermissions,i]}}case"permission:clear":{if(!r||r!==t.sessionId)return e;const i=t.requestId,s=e.pendingPermissions.findIndex(c=>c.requestId===i),o=s>=0?e.pendingPermissions.filter((c,u)=>u!==s):e.pendingPermissions;if(e.events.length===0)return o===e.pendingPermissions?e:{...e,pendingPermissions:o};const a=e.events.length-1,l=e.events[a];return l.kind==="permission_request"&&l.requestId===i?{...e,pendingPermissions:o,events:e.events.slice(0,a)}:o===e.pendingPermissions?e:{...e,pendingPermissions:o}}case"session:question":return!r||t.sessionId!==r?e:{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{toolUseId:t.toolUseId,requestId:t.requestId,questions:t.questions}}};case"session:question:clear":{if(!r||t.sessionId!==r||!(t.toolUseId in e.pendingQuestions))return e;const{[t.toolUseId]:i,...s}=e.pendingQuestions;return{...e,pendingQuestions:s}}case"session:question:submitted":{if(!r||t.sessionId!==r)return e;const i=e.pendingQuestions[t.toolUseId];return i?{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{...i,submittedAnswers:t.answers}}}:e}case"session:rewound":return!r||t.sessionId!==r?e:{...e,pendingPermissions:[],status:"idle"};case"ready":{if(!r)return e;const i=t.runningSessions.find(o=>o.sessionId===r);if(i!=null&&i.freshSpawn)return{...Qc,sessionId:r};const s=(i==null?void 0:i.status)??"idle";return s===e.status?e:{...e,status:s}}case"daemon:disconnected":return{...e,pendingPermissions:[]};default:return e}}const Oz="session/";function Bz(e){return{sid:e.slice(Oz.length)}}const zz=new Set(qT);function aI(e){return zz.has(e)}function Bw(e){return aI(e)?e:"idle"}function $z(e,t){return{start(n){const{sid:r}=Bz(n);let i=!1,s=-1;const o=f=>{t(n,p=>oI(p??Qc,f,r))},a=async f=>{const p=f==="baseline"?-1:s;try{const m=await e.request("session:events",{sessionId:r,afterSeq:p});if(i)return;const v=m.events??[],w=m.latestSeq??-1;if(f==="baseline")o({type:"session:events",sessionId:r,events:v,latestSeq:w}),s=w;else{const x=m.bufferStartSeq??0,_=w<p||x>p+1;o({type:_?"session:events":"session:events:append",sessionId:r,events:v,latestSeq:w}),s=Math.max(s,w)}}catch{}},l=async()=>{try{const f=await e.request("info");if(i)return;o({type:"ready",runningSessions:(f.runningSessions??[]).map(p=>({sessionId:p.sessionId,freshSpawn:p.freshSpawn,status:Bw(p.status)}))})}catch{}},c=async()=>{try{await e.request("session:subscribe",{sessionId:r})}catch{}i||(await a(s<0?"baseline":"delta"),!i&&await l())},u=e.onFrame((f,p)=>{if(!i)if(f==="session:event"){const m=p;if(m.sessionId!==r)return;const v=m.event.seq;Ae("session-events","push session:event",{sid:r,kind:m.event.kind,seq:v,lastSeqBefore:s}),o({type:"session:event",sessionId:m.sessionId,event:m.event}),typeof v=="number"&&v>s&&(s=v)}else if(f==="session:status"){const m=p;if(m.sessionId!==r)return;if(!aI(m.status)){Ae("session-events","push session:status drop",{sid:r,status:m.status});return}Ae("session-events","push session:status",{sid:r,status:m.status}),o({type:"session:status",sessionId:m.sessionId,status:m.status})}else if(f==="session:cleared"){if(p.sessionId!==r)return;Ae("session-events","push session:cleared",{sid:r}),o({type:"session:change",sessionId:r}),s=-1}else if(f==="session:queue"){const m=p;if(m.sessionId!==r)return;Ae("session-events","push session:queue",{sid:r,count:m.items.length}),o({type:"session:queue",sessionId:m.sessionId,items:m.items})}else if(f==="permission:request"){const m=p;if(m.sessionId!==r)return;o({type:"permission:request",sessionId:m.sessionId,requestId:m.requestId,tool:m.tool,input:m.input,...typeof m.toolUseId=="string"&&m.toolUseId?{toolUseId:m.toolUseId}:{}})}else if(f==="session:question"){const m=p;if(m.sessionId!==r)return;o({type:"session:question",sessionId:m.sessionId,toolUseId:m.toolUseId,requestId:m.requestId,questions:m.questions})}else if(f==="session:question:cleared"){const m=p;if(m.sessionId!==r)return;m.answers&&Object.keys(m.answers).length>0?o({type:"session:question:submitted",sessionId:m.sessionId,toolUseId:m.toolUseId,answers:m.answers}):o({type:"session:question:clear",sessionId:m.sessionId,toolUseId:m.toolUseId})}else if(f==="session:rewound"){const m=p;if(m.sessionId!==r)return;o({type:"session:rewound",sessionId:m.sessionId,userMessageId:m.userMessageId})}else f==="ready"&&o({type:"ready",runningSessions:(p.runningSessions??[]).map(v=>({sessionId:v.sessionId,freshSpawn:v.freshSpawn,status:Bw(v.status)}))})}),d=e.onConnect(()=>{c()});return e.isConnected&&c(),()=>{i=!0,u(),d(),e.request("session:unsubscribe",{sessionId:r}).catch(()=>{})}}}}const Fz=new Set(["tunnel:ready","tunnel:exited","tunnel:unavailable"]);function Hz(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("info",void 0);if(r)return;t(n,()=>a)}catch{}},s=e.onConnect(()=>{i()}),o=e.onFrame(a=>{Fz.has(a)&&i()});return i(),()=>{r=!0,s(),o()}}}}function Uz(){return{start(){return()=>{}}}}function Wz(e,t){return{start(n){let r=!1;const i=async()=>{try{const o=await e.request("persona:list",{});if(r)return;t(n,()=>o.personas??[])}catch{}},s=e.onConnect(()=>{i()});return i(),()=>{r=!0,s()}}}}function Vz(e){const t=Az(e),n=Mz();let r=null;const i=(o,a)=>{r==null||r.setData(o,a)};n.register(/^capabilities\//,Lz(t,i)),n.register(/^sessions$/,Dz(t,i)),n.register(/^session\//,$z(t,i)),n.register(/^personas$/,Wz(t,i)),n.register(/^persona-detail\//,Uz()),n.register(/^daemon-info$/,Hz(t,i));const s=Rz({onFirstObserver:o=>{o&&n.activate(o)},onLastObserver:o=>{o&&n.deactivate(o)}});return r=s,{cache:s,channel:t}}class G_{constructor(t){this.client=t}info(){return this.client.request("info")}attachmentSignUrl(t){return this.client.request("attachment.signUrl",t)}attachmentGroupAdd(t,n,r){return this.client.request("attachment.groupAdd",{sessionId:t,relPath:n,...r?{label:r}:{}})}attachmentGroupRemove(t,n){return this.client.request("attachment.groupRemove",{sessionId:t,relPath:n})}attachmentGroupList(t){return this.client.request("attachment.groupList",{sessionId:t})}sessionCreate(t){return this.client.request("session:create",t)}projectList(){return this.client.request("project:list")}projectCreate(t){return this.client.request("project:create",{...t.path?{path:t.path}:{},...t.name?{name:t.name}:{}})}projectPatch(t){return this.client.request("project:patch",t)}projectReveal(t){return this.client.request("project:reveal",{path:t})}appBuilderListProjects(){return this.client.request("appBuilder:listProjects",{})}appBuilderGetProject(t){return this.client.request("appBuilder:getProject",{sessionId:t})}appBuilderUpdateProjectPort(t,n){return this.client.request("appBuilder:updateProjectPort",{name:t,newPort:n})}appBuilderStartDevServer(t,n){return this.client.request("appBuilder:startDevServer",{sessionId:t,...n!=null&&n.force?{force:!0}:{}})}appBuilderStopDevServer(t){return this.client.request("appBuilder:stopDevServer",{sessionId:t})}appBuilderPublish(t){return this.client.request("appBuilder:publish",{name:t})}appBuilderDismissPublishJob(t){return this.client.request("appBuilder:dismissPublishJob",{name:t})}sessionList(){return this.client.request("session:list")}sessionGet(t){return this.client.request("session:get",{sessionId:t})}sessionUpdate(t,n){return this.client.request("session:update",{sessionId:t,patch:n})}sessionDelete(t){return this.client.request("session:delete",{sessionId:t})}sessionSend(t,n,r){return this.client.request("session:send",{sessionId:t,text:n,...r!=null&&r.queueWhileRunning?{queueWhileRunning:!0}:{}})}sessionDequeue(t,n){return this.client.request("session:dequeue",{sessionId:t,...n?{id:n}:{}})}sessionStop(t){return this.client.request("session:stop",{sessionId:t})}sessionInterrupt(t){return this.client.request("session:interrupt",{sessionId:t})}sessionRewind(t){return this.client.request("session:rewind",t)}sessionRewindableMessageIds(t){return this.client.request("session:rewindable-message-ids",{sessionId:t})}sessionRewindDiff(t){return this.client.request("session:rewind-diff",t)}sessionNew(t){return this.client.request("session:new",{sessionId:t})}sessionFork(t){return this.client.request("session:fork",t)}sessionResume(t,n){return this.client.request("session:resume",{sessionId:t,toolSessionId:n})}sessionObserve(t){return this.client.request("session:observe",t)}sessionEvents(t,n){return this.client.request("session:events",{sessionId:t,afterSeq:n})}sessionSubscribe(t){return this.client.request("session:subscribe",{sessionId:t})}sessionUnsubscribe(t){return this.client.request("session:unsubscribe",{sessionId:t})}pinSession(t,n){return this.client.request("session:pin",{sessionId:t,pinned:n})}searchSessionContent(t){return this.client.request("session:searchContent",t)}archiveSession(t,n){return this.client.request("session:archive",{sessionId:t,archived:n})}markSessionRead(t){return this.client.request("session:markRead",{sessionId:t})}reorderPins(t){return this.client.request("session:reorderPins",{orderedIds:t})}peerSessionUpsert(t){return this.client.request("peerSession:upsert",t)}peerSessionRemove(t){return this.client.request("peerSession:remove",{sessionId:t})}permissionRespond(t){return this.client.request("permission:respond",t)}answerQuestion(t){return this.client.request("session:answerQuestion",t)}cancelQuestion(t){return this.client.request("session:cancelQuestion",t)}historyProjects(){return this.client.request("history:projects")}historyList(t){return this.client.request("history:list",{projectPath:t})}historyRead(t){return this.client.request("history:read",t)}historySubagents(t){return this.client.request("history:subagents",t)}historySubagentRead(t){return this.client.request("history:subagent-read",t)}listRecentDirs(){return this.client.request("history:recentDirs",{})}getGitRoot(t){return this.client.request("git:root",{cwd:t})}getGitBranch(t){return this.client.request("git:branch",{cwd:t})}listGitBranches(t){return this.client.request("git:branches",{cwd:t})}personaCreate(t){return this.client.request("persona:create",t)}personaList(){return this.client.request("persona:list",{})}personaGet(t){return this.client.request("persona:get",{personaId:t})}personaUpdate(t,n){return this.client.request("persona:update",{personaId:t,patch:n})}personaDelete(t){return this.client.request("persona:delete",{personaId:t})}larkBotBindManual(t,n,r){return this.client.request("larkBot:bindManual",{personaId:t,appId:n,appSecret:r})}larkBotUnbind(t){return this.client.request("larkBot:unbind",{personaId:t})}larkBotStatus(t){return this.client.request("larkBot:status",{personaId:t})}toolsProbe(){return this.client.request("tools:probe",{})}sessionExternalScan(){return this.client.request("session:externalScan",{})}sessionImportExternal(t){return this.client.request("session:importExternal",t)}onboardingComplete(){return this.client.request("onboarding:complete",{})}onboardingIosInterest(){return this.client.request("onboarding:iosInterest",{})}visitorList(){return this.client.request("visitor:list",{})}workspaceList(t={}){return this.client.request("workspace:list",t)}workspaceRead(t){return this.client.request("workspace:read",t)}skillsList(t,n){return this.client.request("skills:list",{cwd:t,...n?{tool:n}:{}})}agentsList(t,n){return this.client.request("agents:list",{cwd:t,...n?{tool:n}:{}})}capabilitiesGet(t="claude"){return this.client.request("capabilities:get",{tool:t})}shiftList(){return this.client.request("shift:list")}deployStart(t){return this.client.request("deploy:start",{personaId:t})}deployGet(t){return this.client.request("deploy:get",{deployId:t})}deployRescan(t){return this.client.request("deploy:rescan",{deployId:t})}deployList(){return this.client.request("deploy:list")}deployPatch(t,n){return this.client.request("deploy:patch",{deployId:t,patch:n})}deployPutSecret(t,n,r){return this.client.request("deploy:putSecret",{deployId:t,name:n,values:r})}deployRemove(t){return this.client.request("deploy:remove",{deployId:t})}channelList(){return this.client.request("channel:list")}channelCreate(t){return this.client.request("channel:create",t)}channelUpdate(t){return this.client.request("channel:update",t)}channelDelete(t){return this.client.request("channel:delete",t)}topicList(t){return this.client.request("topic:list",t)}topicGet(t){return this.client.request("topic:get",t)}topicCreate(t){return this.client.request("topic:create",t)}topicClose(t){return this.client.request("topic:close",t)}topicRename(t){return this.client.request("topic:rename",t)}topicDelete(t){return this.client.request("topic:delete",t)}githubStatus(){return this.client.request("github:status")}githubPrList(t){return this.client.request("github:prList",{role:t})}githubPrDetail(t){return this.client.request("github:prDetail",{...t})}githubPrMerge(t){return this.client.request("github:prMerge",{...t})}githubPrComment(t){return this.client.request("github:prComment",{...t})}githubPrSetReady(t){return this.client.request("github:prSetReady",{...t})}githubCollaborators(t){return this.client.request("github:collaborators",{...t})}githubPrRequestReviewers(t){return this.client.request("github:prRequestReviewers",{...t})}}function qz(e){const[t,n]=g.useState(e.isOpen?{kind:"connected",url:""}:{kind:"connecting"});return g.useEffect(()=>{const r=e.on("ready",l=>{const c=l;n(u=>({kind:"connected",url:u.kind==="connected"?u.url:"",mode:u.kind==="connected"?u.mode:void 0,daemonVersion:c.version,protocolVersion:c.protocolVersion,daemonSource:c.daemonSource,globalCliVersion:c.globalCliVersion,onboardingCompletedAt:c.onboardingCompletedAt}))}),i=e.on("daemon:connected",l=>{const c=l;n(u=>({kind:"connected",url:c.url,mode:c.mode,daemonVersion:u.kind==="connected"?u.daemonVersion:void 0,protocolVersion:u.kind==="connected"?u.protocolVersion:void 0,daemonSource:u.kind==="connected"?u.daemonSource:void 0,globalCliVersion:u.kind==="connected"?u.globalCliVersion:void 0,onboardingCompletedAt:u.kind==="connected"?u.onboardingCompletedAt:void 0}))}),s=e.on("daemon:disconnected",l=>{const c=(l==null?void 0:l.reason)??"";/auth failed|auth timeout|auth required|auth handshake timeout/i.test(c)?n({kind:"auth-failed",reason:c}):n({kind:"disconnected",reason:c})}),o=e.on("daemon:reconnecting",l=>{const c=l;n({kind:"reconnecting",attempt:c.attempt,nextDelayMs:c.nextDelayMs,scheduledAt:c.scheduledAt??Date.now()})}),a=e.on("daemon:version-mismatch",l=>{const c=l;n({kind:"version-mismatch",daemonProtocol:c.daemonProtocol,supportedProtocol:c.supportedProtocol})});return()=>{r(),i(),s(),o(),a()}},[e]),t}function Kz(e){const t=zo(),n=fi(e.kind==="connected"?"sessions":""),r=g.useCallback(async()=>{t.setData("sessions",i=>i??[])},[t]);return{sessions:n??[],loading:!1,loaded:n!==void 0,error:null,refresh:r}}function vl(){const e=xi();return g.useMemo(()=>new G_(e),[e])}function lI(e){return{personaId:e.personaId,label:e.label,model:e.model,effort:e.effort,tool:e.tool,public:e.public,createdAt:e.createdAt,updatedAt:e.updatedAt}}function cI(){const e=zo(),t=vl(),n=fi("personas")??[],r=g.useMemo(()=>n.map(s=>lI(s)),[n]),i=g.useCallback(async()=>{const s=await t.personaList();e.setData("personas",()=>s.personas??[])},[t,e]);return{personas:r,raw:n,loaded:fi("personas")!==void 0,refresh:i}}function uI(e){const{raw:t}=cI(),n=zo(),r=vl(),i=e?t.find(a=>a.personaId===e)??null:null,s=i?lI(i):null,o=g.useCallback(async()=>{if(!e)return;const a=await r.personaList();n.setData("personas",()=>a.personas??[])},[e,r,n]);return{persona:s,raw:i,loaded:!!s,refresh:o}}function Gz(e){const t=vl(),n=zo(),r=e?`persona-detail/${e}`:"",i=fi(r),s=g.useCallback(async()=>{const o={personality:"",personalityLocal:"",personalityManaged:!1,skills:[],plugins:[],sandboxSettings:null,codexSandbox:null};if(!e)return o;let a=null;try{a=await t.personaGet(e)}catch(c){Ae("personas","personaGet failed → empty detail",{personaId:e,err:c}),a=null}const l=a?{personality:a.personality??"",personalityLocal:a.personalityLocal??"",personalityManaged:a.personalityManaged??!1,skills:a.skills??[],plugins:a.plugins??[],sandboxSettings:a.sandboxSettings??null,codexSandbox:a.codexSandbox??null}:o;return n.setData(r,()=>l),l},[t,n,e,r]);return g.useEffect(()=>{e&&s()},[e,s]),{personality:(i==null?void 0:i.personality)??"",personalityLocal:(i==null?void 0:i.personalityLocal)??"",personalityManaged:(i==null?void 0:i.personalityManaged)??!1,skills:(i==null?void 0:i.skills)??[],plugins:(i==null?void 0:i.plugins)??[],sandboxSettings:(i==null?void 0:i.sandboxSettings)??null,codexSandbox:(i==null?void 0:i.codexSandbox)??null,loaded:i!==void 0,refresh:s}}function dI(){const e=zo(),t=vl();return g.useCallback(async()=>{const n=await t.personaList();e.setData("personas",()=>n.personas??[])},[e,t])}function Xz(){const e=vl(),t=dI();return g.useCallback(async(n,r)=>{const i=await e.personaUpdate(n,r);return await t(),i},[e,t])}function Yz(){const e=vl(),t=dI();return g.useCallback(async n=>{await e.personaDelete(n),await t()},[e,t])}const zw="clawd:sidebar:tree-collapsed";function Qz(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function Zz(e){const t=Qz(e);if(!Array.isArray(t))return new Set;const n=new Set;for(const r of t)typeof r=="string"&&n.add(r);return n}function Jz(){const e=I_(),[t,n]=g.useState(()=>new Set),r=g.useRef(t);r.current=t,g.useEffect(()=>{let l=!1;return(async()=>{try{const c=await e.kv.get(zw);if(l)return;n(Zz(c))}catch{}})(),()=>{l=!0}},[e]);const i=g.useCallback(l=>{e.kv.set(zw,[...l]).catch(()=>{})},[e]),s=g.useCallback(l=>r.current.has(l),[]),o=g.useCallback(l=>{n(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),i(u),u})},[i]),a=g.useCallback(l=>{n(c=>{let u=!1;const d=new Set;for(const f of c)l.has(f)?d.add(f):u=!0;return u?(i(d),d):c})},[i]);return{isCollapsed:s,toggle:o,prune:a}}const X_=g.createContext(null);function e$(){const e=g.useContext(X_);if(!e)throw new Error("SessionTreeCollapsedContext.Provider missing — wrap SessionTreeNode tree with <SessionTreeCollapsedContext.Provider value={useSessionTreeCollapsed()}>");return e}/**
|
|
97
97
|
* @license lucide-react v0.577.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
@@ -503,7 +503,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
503
503
|
`)},xS=function(){var e=parseInt(document.body.getAttribute(Ma)||"0",10);return isFinite(e)?e:0},yH=function(){g.useEffect(function(){return document.body.setAttribute(Ma,(xS()+1).toString()),function(){var e=xS()-1;e<=0?document.body.removeAttribute(Ma):document.body.setAttribute(Ma,e.toString())}},[])},bH=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;yH();var s=g.useMemo(function(){return vH(i)},[i]);return g.createElement(xH,{styles:_H(s,!t,i,n?"":"!important")})},C0=!1;if(typeof window<"u")try{var _d=Object.defineProperty({},"passive",{get:function(){return C0=!0,!0}});window.addEventListener("test",_d,_d),window.removeEventListener("test",_d,_d)}catch{C0=!1}var Jo=C0?{passive:!1}:!1,wH=function(e){return e.tagName==="TEXTAREA"},RP=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!wH(e)&&n[t]==="visible")},SH=function(e){return RP(e,"overflowY")},kH=function(e){return RP(e,"overflowX")},_S=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=MP(e,r);if(i){var s=AP(e,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},CH=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},EH=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},MP=function(e,t){return e==="v"?SH(t):kH(t)},AP=function(e,t){return e==="v"?CH(t):EH(t)},NH=function(e,t){return e==="h"&&t==="rtl"?-1:1},TH=function(e,t,n,r,i){var s=NH(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=AP(e,a),m=p[0],v=p[1],w=p[2],x=v-w-s*m;(m||x)&&MP(e,a)&&(d+=x,f+=m);var _=a.parentNode;a=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}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},yd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},yS=function(e){return[e.deltaX,e.deltaY]},bS=function(e){return e&&"current"in e?e.current:e},IH=function(e,t){return e[0]===t[0]&&e[1]===t[1]},PH=function(e){return`
|
|
504
504
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
505
505
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
506
|
-
`)},RH=0,ea=[];function MH(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(RH++)[0],s=g.useState(PP)[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=J7([e.lockRef.current],(e.shards||[]).map(bS),!0).filter(Boolean);return v.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,w){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var x=yd(v),_=n.current,y="deltaX"in v?v.deltaX:_[0]-x[0],S="deltaY"in v?v.deltaY:_[1]-x[1],C,k=v.target,N=Math.abs(y)>Math.abs(S)?"h":"v";if("touches"in v&&N==="h"&&k.type==="range")return!1;var T=window.getSelection(),z=T&&T.anchorNode,P=z?z===k||z.contains(k):!1;if(P)return!1;var O=_S(N,k);if(!O)return!0;if(O?C=N:(C=N==="v"?"h":"v",O=_S(N,k)),!O)return!1;if(!r.current&&"changedTouches"in v&&(y||S)&&(r.current=C),!C)return!0;var M=r.current||C;return TH(M,w,v,M==="h"?y:S)},[]),l=g.useCallback(function(v){var w=v;if(!(!ea.length||ea[ea.length-1]!==s)){var x="deltaY"in w?yS(w):yd(w),_=t.current.filter(function(C){return C.name===w.type&&(C.target===w.target||w.target===C.shadowParent)&&IH(C.delta,x)})[0];if(_&&_.should){w.cancelable&&w.preventDefault();return}if(!_){var y=(o.current.shards||[]).map(bS).filter(Boolean).filter(function(C){return C.contains(w.target)}),S=y.length>0?a(w,y[0]):!o.current.noIsolation;S&&w.cancelable&&w.preventDefault()}}},[]),c=g.useCallback(function(v,w,x,_){var y={name:v,delta:w,target:x,should:_,shadowParent:AH(x)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(S){return S!==y})},1)},[]),u=g.useCallback(function(v){n.current=yd(v),r.current=void 0},[]),d=g.useCallback(function(v){c(v.type,yS(v),v.target,a(v,e.lockRef.current))},[]),f=g.useCallback(function(v){c(v.type,yd(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return ea.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Jo),document.addEventListener("touchmove",l,Jo),document.addEventListener("touchstart",u,Jo),function(){ea=ea.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,Jo),document.removeEventListener("touchmove",l,Jo),document.removeEventListener("touchstart",u,Jo)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(s,{styles:PH(i)}):null,p?g.createElement(bH,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function AH(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const jH=lH(IP,MH);var py=g.forwardRef(function(e,t){return g.createElement(gp,ni({},e,{ref:t,sideCar:jH}))});py.classNames=gp.classNames;var E0=["Enter"," "],LH=["ArrowDown","PageUp","Home"],jP=["ArrowUp","PageDown","End"],DH=[...LH,...jP],OH={ltr:[...E0,"ArrowRight"],rtl:[...E0,"ArrowLeft"]},BH={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cu="Menu",[nu,zH,$H]=UI(Cu),[Ho,LP]=Fo(Cu,[$H,mp,yP]),Eu=mp(),DP=yP(),[OP,qs]=Ho(Cu),[FH,Nu]=Ho(Cu),BP=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=Eu(t),[l,c]=g.useState(null),u=g.useRef(!1),d=mi(s),f=WI(i);return g.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),h.jsx(hy,{...a,children:h.jsx(OP,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:h.jsx(FH,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};BP.displayName=Cu;var HH="MenuAnchor",my=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Eu(n);return h.jsx(gP,{...i,...r,ref:t})});my.displayName=HH;var gy="MenuPortal",[UH,zP]=Ho(gy,{forceMount:void 0}),$P=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=qs(gy,t);return h.jsx(UH,{scope:t,forceMount:n,children:h.jsx(Zi,{present:n||s.open,children:h.jsx(fy,{asChild:!0,container:i,children:r})})})};$P.displayName=gy;var yr="MenuContent",[WH,vy]=Ho(yr),FP=g.forwardRef((e,t)=>{const n=zP(yr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=qs(yr,e.__scopeMenu),o=Nu(yr,e.__scopeMenu);return h.jsx(nu.Provider,{scope:e.__scopeMenu,children:h.jsx(Zi,{present:r||s.open,children:h.jsx(nu.Slot,{scope:e.__scopeMenu,children:o.modal?h.jsx(VH,{...i,ref:t}):h.jsx(qH,{...i,ref:t})})})})}),VH=g.forwardRef((e,t)=>{const n=qs(yr,e.__scopeMenu),r=g.useRef(null),i=Yt(t,r);return g.useEffect(()=>{const s=r.current;if(s)return EP(s)},[]),h.jsx(xy,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ie(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),qH=g.forwardRef((e,t)=>{const n=qs(yr,e.__scopeMenu);return h.jsx(xy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),KH=eu("MenuContent.ScrollLock"),xy=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...v}=e,w=qs(yr,n),x=Nu(yr,n),_=Eu(n),y=DP(n),S=zH(n),[C,k]=g.useState(null),N=g.useRef(null),T=Yt(t,N,w.onContentChange),z=g.useRef(0),P=g.useRef(""),O=g.useRef(0),M=g.useRef(null),R=g.useRef("right"),A=g.useRef(0),L=m?py:g.Fragment,$=m?{as:KH,allowPinchZoom:!0}:void 0,F=B=>{var _e,Re;const E=P.current+B,H=S().filter(ce=>!ce.disabled),q=document.activeElement,j=(_e=H.find(ce=>ce.ref.current===q))==null?void 0:_e.textValue,ne=H.map(ce=>ce.textValue),ie=sU(ne,E,j),K=(Re=H.find(ce=>ce.textValue===ie))==null?void 0:Re.ref.current;(function ce(Me){P.current=Me,window.clearTimeout(z.current),Me!==""&&(z.current=window.setTimeout(()=>ce(""),1e3))})(E),K&&setTimeout(()=>K.focus())};g.useEffect(()=>()=>window.clearTimeout(z.current),[]),KI();const D=g.useCallback(B=>{var H,q;return R.current===((H=M.current)==null?void 0:H.side)&&aU(B,(q=M.current)==null?void 0:q.area)},[]);return h.jsx(WH,{scope:n,searchRef:P,onItemEnter:g.useCallback(B=>{D(B)&&B.preventDefault()},[D]),onItemLeave:g.useCallback(B=>{var E;D(B)||((E=N.current)==null||E.focus(),k(null))},[D]),onTriggerLeave:g.useCallback(B=>{D(B)&&B.preventDefault()},[D]),pointerGraceTimerRef:O,onPointerGraceIntentChange:g.useCallback(B=>{M.current=B},[]),children:h.jsx(L,{...$,children:h.jsx(ry,{asChild:!0,trapped:i,onMountAutoFocus:Ie(s,B=>{var E;B.preventDefault(),(E=N.current)==null||E.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:h.jsx(up,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:h.jsx(G7,{asChild:!0,...y,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:k,onEntryFocus:Ie(l,B=>{x.isUsingKeyboardRef.current||B.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(vP,{role:"menu","aria-orientation":"vertical","data-state":iR(w.open),"data-radix-menu-content":"",dir:x.dir,..._,...v,ref:T,style:{outline:"none",...v.style},onKeyDown:Ie(v.onKeyDown,B=>{const H=B.target.closest("[data-radix-menu-content]")===B.currentTarget,q=B.ctrlKey||B.altKey||B.metaKey,j=B.key.length===1;H&&(B.key==="Tab"&&B.preventDefault(),!q&&j&&F(B.key));const ne=N.current;if(B.target!==ne||!DH.includes(B.key))return;B.preventDefault();const K=S().filter(_e=>!_e.disabled).map(_e=>_e.ref.current);jP.includes(B.key)&&K.reverse(),rU(K)}),onBlur:Ie(e.onBlur,B=>{B.currentTarget.contains(B.target)||(window.clearTimeout(z.current),P.current="")}),onPointerMove:Ie(e.onPointerMove,ru(B=>{const E=B.target,H=A.current!==B.clientX;if(B.currentTarget.contains(E)&&H){const q=B.clientX>A.current?"right":"left";R.current=q,A.current=B.clientX}}))})})})})})})});FP.displayName=yr;var GH="MenuGroup",_y=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{role:"group",...r,ref:t})});_y.displayName=GH;var XH="MenuLabel",HP=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{...r,ref:t})});HP.displayName=XH;var rf="MenuItem",wS="menu.itemSelect",vp=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=g.useRef(null),o=Nu(rf,e.__scopeMenu),a=vy(rf,e.__scopeMenu),l=Yt(t,s),c=g.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(wS,{bubbles:!0,cancelable:!0});d.addEventListener(wS,p=>r==null?void 0:r(p),{once:!0}),HI(d,f),f.defaultPrevented?c.current=!1:o.onClose()}};return h.jsx(UP,{...i,ref:l,disabled:n,onClick:Ie(e.onClick,u),onPointerDown:d=>{var f;(f=e.onPointerDown)==null||f.call(e,d),c.current=!0},onPointerUp:Ie(e.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:Ie(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||E0.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});vp.displayName=rf;var UP=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=vy(rf,n),a=DP(n),l=g.useRef(null),c=Yt(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(nu.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:h.jsx(X7,{asChild:!0,...a,focusable:!r,children:h.jsx(Mt.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:Ie(e.onPointerMove,ru(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ie(e.onPointerLeave,ru(m=>o.onItemLeave(m))),onFocus:Ie(e.onFocus,()=>d(!0)),onBlur:Ie(e.onBlur,()=>d(!1))})})})}),YH="MenuCheckboxItem",WP=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return h.jsx(XP,{scope:e.__scopeMenu,checked:n,children:h.jsx(vp,{role:"menuitemcheckbox","aria-checked":sf(n)?"mixed":n,...i,ref:t,"data-state":wy(n),onSelect:Ie(i.onSelect,()=>r==null?void 0:r(sf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});WP.displayName=YH;var VP="MenuRadioGroup",[QH,ZH]=Ho(VP,{value:void 0,onValueChange:()=>{}}),qP=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=mi(r);return h.jsx(QH,{scope:e.__scopeMenu,value:n,onValueChange:s,children:h.jsx(_y,{...i,ref:t})})});qP.displayName=VP;var KP="MenuRadioItem",GP=g.forwardRef((e,t)=>{const{value:n,...r}=e,i=ZH(KP,e.__scopeMenu),s=n===i.value;return h.jsx(XP,{scope:e.__scopeMenu,checked:s,children:h.jsx(vp,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":wy(s),onSelect:Ie(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});GP.displayName=KP;var yy="MenuItemIndicator",[XP,JH]=Ho(yy,{checked:!1}),YP=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=JH(yy,n);return h.jsx(Zi,{present:r||sf(s.checked)||s.checked===!0,children:h.jsx(Mt.span,{...i,ref:t,"data-state":wy(s.checked)})})});YP.displayName=yy;var eU="MenuSeparator",QP=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});QP.displayName=eU;var tU="MenuArrow",ZP=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Eu(n);return h.jsx(xP,{...i,...r,ref:t})});ZP.displayName=tU;var by="MenuSub",[nU,JP]=Ho(by),eR=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=qs(by,t),o=Eu(t),[a,l]=g.useState(null),[c,u]=g.useState(null),d=mi(i);return g.useEffect(()=>(s.open===!1&&d(!1),()=>d(!1)),[s.open,d]),h.jsx(hy,{...o,children:h.jsx(OP,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:h.jsx(nU,{scope:t,contentId:zi(),triggerId:zi(),trigger:a,onTriggerChange:l,children:n})})})};eR.displayName=by;var ec="MenuSubTrigger",tR=g.forwardRef((e,t)=>{const n=qs(ec,e.__scopeMenu),r=Nu(ec,e.__scopeMenu),i=JP(ec,e.__scopeMenu),s=vy(ec,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(my,{asChild:!0,...c,children:h.jsx(UP,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":iR(n.open),...e,ref:bu(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:Ie(e.onPointerMove,ru(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:Ie(e.onPointerLeave,ru(d=>{var p,m;u();const f=(p=n.content)==null?void 0:p.getBoundingClientRect();if(f){const v=(m=n.content)==null?void 0:m.dataset.side,w=v==="right",x=w?-5:5,_=f[w?"left":"right"],y=f[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+x,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:Ie(e.onKeyDown,d=>{var p;const f=s.searchRef.current!=="";e.disabled||f&&d.key===" "||OH[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});tR.displayName=ec;var nR="MenuSubContent",rR=g.forwardRef((e,t)=>{const n=zP(yr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=qs(yr,e.__scopeMenu),o=Nu(yr,e.__scopeMenu),a=JP(nR,e.__scopeMenu),l=g.useRef(null),c=Yt(t,l);return h.jsx(nu.Provider,{scope:e.__scopeMenu,children:h.jsx(Zi,{present:r||s.open,children:h.jsx(nu.Slot,{scope:e.__scopeMenu,children:h.jsx(xy,{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:Ie(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ie(e.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Ie(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),f=BH[o.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});rR.displayName=nR;function iR(e){return e?"open":"closed"}function sf(e){return e==="indeterminate"}function wy(e){return sf(e)?"indeterminate":e?"checked":"unchecked"}function rU(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function iU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function sU(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=iU(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 oU(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 aU(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return oU(n,t)}function ru(e){return t=>t.pointerType==="mouse"?e(t):void 0}var lU=BP,cU=my,uU=$P,dU=FP,hU=_y,fU=HP,pU=vp,mU=WP,gU=qP,vU=GP,xU=YP,_U=QP,yU=ZP,bU=eR,wU=tR,SU=rR,xp="DropdownMenu",[kU]=Fo(xp,[LP]),En=LP(),[CU,sR]=kU(xp),oR=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=En(t),c=g.useRef(null),[u,d]=wu({prop:i,defaultProp:s??!1,onChange:o,caller:xp});return h.jsx(CU,{scope:t,triggerId:zi(),triggerRef:c,contentId:zi(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:h.jsx(lU,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};oR.displayName=xp;var aR="DropdownMenuTrigger",lR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,s=sR(aR,n),o=En(n);return h.jsx(cU,{asChild:!0,...o,children:h.jsx(Mt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:bu(t,s.triggerRef),onPointerDown:Ie(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Ie(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});lR.displayName=aR;var EU="DropdownMenuPortal",cR=e=>{const{__scopeDropdownMenu:t,...n}=e,r=En(t);return h.jsx(uU,{...r,...n})};cR.displayName=EU;var uR="DropdownMenuContent",dR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=sR(uR,n),s=En(n),o=g.useRef(!1);return h.jsx(dU,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:t,onCloseAutoFocus:Ie(e.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Ie(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)"}})});dR.displayName=uR;var NU="DropdownMenuGroup",TU=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(hU,{...i,...r,ref:t})});TU.displayName=NU;var IU="DropdownMenuLabel",hR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(fU,{...i,...r,ref:t})});hR.displayName=IU;var PU="DropdownMenuItem",fR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(pU,{...i,...r,ref:t})});fR.displayName=PU;var RU="DropdownMenuCheckboxItem",pR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(mU,{...i,...r,ref:t})});pR.displayName=RU;var MU="DropdownMenuRadioGroup",AU=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(gU,{...i,...r,ref:t})});AU.displayName=MU;var jU="DropdownMenuRadioItem",LU=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(vU,{...i,...r,ref:t})});LU.displayName=jU;var DU="DropdownMenuItemIndicator",mR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(xU,{...i,...r,ref:t})});mR.displayName=DU;var OU="DropdownMenuSeparator",gR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(_U,{...i,...r,ref:t})});gR.displayName=OU;var BU="DropdownMenuArrow",zU=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(yU,{...i,...r,ref:t})});zU.displayName=BU;var $U=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,o=En(t),[a,l]=wu({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return h.jsx(bU,{...o,open:a,onOpenChange:l,children:n})},FU="DropdownMenuSubTrigger",vR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(wU,{...i,...r,ref:t})});vR.displayName=FU;var HU="DropdownMenuSubContent",xR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(SU,{...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)"}})});xR.displayName=HU;var UU=oR,WU=lR,_R=cR,yR=dR,bR=hR,wR=fR,SR=pR,VU=mR,kR=gR,qU=$U,CR=vR,ER=xR;const Sy=UU,ky=WU,_p=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(_R,{children:h.jsx(yR,{ref:r,sideOffset:t,className:re("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...n})}));_p.displayName=yR.displayName;const KU=qU,NR=g.forwardRef(({className:e,...t},n)=>h.jsx(CR,{ref:n,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100 data-[state=open]:bg-bg-200","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));NR.displayName=CR.displayName;const TR=g.forwardRef(({className:e,...t},n)=>h.jsx(_R,{children:h.jsx(ER,{ref:n,className:re("z-50 min-w-[6rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...t})}));TR.displayName=ER.displayName;const Pi=g.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(wR,{ref:r,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Pi.displayName=wR.displayName;const GU=g.forwardRef(({className:e,children:t,checked:n,...r},i)=>h.jsxs(SR,{ref:i,checked:n,className:re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-7 pr-2 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(VU,{children:h.jsx(xl,{className:"h-3.5 w-3.5"})})}),t]}));GU.displayName=SR.displayName;const IR=g.forwardRef(({className:e,...t},n)=>h.jsx(kR,{ref:n,className:re("-mx-1 my-1 h-px bg-border",e),...t}));IR.displayName=kR.displayName;const XU=g.forwardRef(({className:e,...t},n)=>h.jsx(bR,{ref:n,className:re("px-2 py-1.5 text-xs font-semibold text-text-400",e),...t}));XU.displayName=bR.displayName;function YU({tool:e,className:t}){const n=HF(e);return h.jsx("span",{"data-testid":n?`session-icon-${e}`:"session-icon-default","aria-label":n?ty(e):"未知引擎",className:re("w-3.5 h-3.5 shrink-0 inline-flex items-center justify-center",cp(e),t),children:h.jsx(lp,{tool:e,className:"w-full h-full"})})}function QU({sessionId:e,hasUnread:t,running:n=!1,awaitingUser:r=!1,style:i}){return r?h.jsx(p$,{"data-testid":`awaiting-dot-${e}`,style:i,className:"w-3 h-3 text-warning shrink-0 animate-pulse",strokeWidth:2.25,"aria-label":"awaiting user"}):t?h.jsx("span",{"data-testid":`unread-dot-${e}`,style:i,className:"w-2 h-2 rounded-full bg-error shrink-0","aria-label":"unread"}):n?h.jsx("span",{"data-testid":`running-dot-${e}`,style:i,className:"w-2 h-2 rounded-full bg-success shrink-0 animate-pulse","aria-label":"running"}):null}function PR(e){return e.compositionActive||!!e.nativeIsComposing||e.keyCode===229}function RR(e){return e.key==="Enter"&&!e.shiftKey&&!PR(e)}function Tu(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(RR({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 ZU({open:e,initialLabel:t,placeholder:n,onSubmit:r,onCancel:i,title:s="Edit session",fieldLabel:o="Label",testId:a="session-edit-dialog",requireNonEmpty:l=!1}){const[c,u]=g.useState(t);g.useEffect(()=>{e&&u(t)},[e,t]);const d=c.trim(),f=l&&d==="",p=()=>{f||r({label:d})},m=Tu(p,i);return e?cl.createPortal(h.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-bg-0/40 backdrop-blur-[2px]",onClick:i,"data-testid":`${a}-overlay`,children:h.jsxs("div",{"data-testid":a,className:"w-[420px] max-w-[calc(100vw-32px)] rounded-2xl border border-text-100/[0.12] flex flex-col gap-4 p-5",style:{backgroundColor:"var(--bg-0)",boxShadow:"0 12px 40px rgba(0,0,0,0.04)"},onClick:v=>v.stopPropagation(),children:[h.jsx("div",{className:"text-[15px] font-semibold text-text-100",children:s}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-[12px] font-semibold text-text-200 mb-1",children:o}),h.jsx("input",{autoFocus:!0,type:"text",value:c,onChange:v=>u(v.target.value),...m,placeholder:n,"data-testid":`${a}-label`,className:"w-full px-3 py-2 text-[13px] bg-bg-50 border border-bg-300 rounded-lg focus:outline-none focus:border-text-300 transition-colors"})]}),h.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[h.jsx("button",{type:"button",onClick:i,className:"px-4 py-1.5 text-[12px] text-text-300 rounded-lg hover:bg-text-100/5 transition-colors cursor-pointer",children:"Cancel"}),h.jsx("button",{type:"button",onClick:p,disabled:f,"data-testid":`${a}-save`,className:"px-4 py-1.5 text-[12px] font-medium text-bg-0 rounded-lg bg-text-100 hover:bg-text-200 transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-40",children:"Save"})]})]})}),document.body):null}var JU=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"}),eW="VisuallyHidden",MR=g.forwardRef((e,t)=>h.jsx(Mt.span,{...e,ref:t,style:{...JU,...e.style}}));MR.displayName=eW;var tW=MR,[yp]=Fo("Tooltip",[mp]),bp=mp(),AR="TooltipProvider",nW=700,N0="tooltip.open",[rW,Cy]=yp(AR),jR=e=>{const{__scopeTooltip:t,delayDuration:n=nW,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(rW,{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})};jR.displayName=AR;var iu="Tooltip",[iW,wp]=yp(iu),LR=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=Cy(iu,e.__scopeTooltip),c=bp(t),[u,d]=g.useState(null),f=zi(),p=g.useRef(0),m=o??l.disableHoverableContent,v=a??l.delayDuration,w=g.useRef(!1),[x,_]=wu({prop:r,defaultProp:i??!1,onChange:N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(N0))):l.onClose(),s==null||s(N)},caller:iu}),y=g.useMemo(()=>x?w.current?"delayed-open":"instant-open":"closed",[x]),S=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w.current=!1,_(!0)},[_]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),k=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{w.current=!0,_(!0),p.current=0},v)},[v,_]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),h.jsx(hy,{...c,children:h.jsx(iW,{scope:t,contentId:f,open:x,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayedRef.current?k():S()},[l.isOpenDelayedRef,k,S]),onTriggerLeave:g.useCallback(()=>{m?C():(window.clearTimeout(p.current),p.current=0)},[C,m]),onOpen:S,onClose:C,disableHoverableContent:m,children:n})})};LR.displayName=iu;var T0="TooltipTrigger",DR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=wp(T0,n),s=Cy(T0,n),o=bp(n),a=g.useRef(null),l=Yt(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(gP,{asChild:!0,...o,children:h.jsx(Mt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Ie(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ie(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Ie(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Ie(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ie(e.onBlur,i.onClose),onClick:Ie(e.onClick,i.onClose)})})});DR.displayName=T0;var sW="TooltipPortal",[vae,oW]=yp(sW,{forceMount:void 0}),Xa="TooltipContent",OR=g.forwardRef((e,t)=>{const n=oW(Xa,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=wp(Xa,e.__scopeTooltip);return h.jsx(Zi,{present:r||o.open,children:o.disableHoverableContent?h.jsx(BR,{side:i,...s,ref:t}):h.jsx(aW,{side:i,...s,ref:t})})}),aW=g.forwardRef((e,t)=>{const n=wp(Xa,e.__scopeTooltip),r=Cy(Xa,e.__scopeTooltip),i=g.useRef(null),s=Yt(t,i),[o,a]=g.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:d}=r,f=g.useCallback(()=>{a(null),d(!1)},[d]),p=g.useCallback((m,v)=>{const w=m.currentTarget,x={x:m.clientX,y:m.clientY},_=hW(x,w.getBoundingClientRect()),y=fW(x,_),S=pW(v.getBoundingClientRect()),C=gW([...y,...S]);a(C),d(!0)},[d]);return g.useEffect(()=>()=>f(),[f]),g.useEffect(()=>{if(l&&u){const m=w=>p(w,u),v=w=>p(w,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",v)}}},[l,u,p,f]),g.useEffect(()=>{if(o){const m=v=>{const w=v.target,x={x:v.clientX,y:v.clientY},_=(l==null?void 0:l.contains(w))||(u==null?void 0:u.contains(w)),y=!mW(x,o);_?f():y&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,f]),h.jsx(BR,{...e,ref:s})}),[lW,cW]=yp(iu,{isInside:!1}),uW=ZF("TooltipContent"),BR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,l=wp(Xa,n),c=bp(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(N0,u),()=>document.removeEventListener(N0,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(up,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:h.jsxs(vP,{"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(uW,{children:r}),h.jsx(lW,{scope:n,isInside:!0,children:h.jsx(tW,{id:l.contentId,role:"tooltip",children:i||r})})]})})});OR.displayName=Xa;var zR="TooltipArrow",dW=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=bp(n);return cW(zR,n).isInside?null:h.jsx(xP,{...i,...r,ref:t})});dW.displayName=zR;function hW(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 fW(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 pW(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 mW(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 gW(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),vW(t)}function vW(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 xW=jR,_W=LR,yW=DR,$R=OR;const of=xW,Sp=_W,kp=yW,Iu=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx($R,{ref:r,sideOffset:t,className:re("z-50 overflow-hidden rounded-sm border border-border bg-bg-0 px-2 py-1 text-xs text-text-300 shadow-md",e),...n}));Iu.displayName=$R.displayName;const bW={held:!1,indexBySessionId:new Map},wW=g.createContext(bW);function SW(){return g.useContext(wW)}const kW=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})),CW=[{id:"new-session",combo:{key:"n",mod:!0},label:"新建任务",description:"打开快捷新建弹窗",group:"通用",desktopOnly:!0},{id:"open-search",combo:{key:"k",mod:!0},label:"全局搜索",description:"搜会话内容 / persona / 联系人",group:"通用",desktopOnly:!0},{id:"search-tab-prev",combo:{key:"ArrowLeft",mod:!0},label:"搜索:上一组",description:"搜索浮层里切到左边那个 tab(会话 / persona / 联系人)",group:"通用"},{id:"search-tab-next",combo:{key:"ArrowRight",mod:!0},label:"搜索:下一组",description:"搜索浮层里切到右边那个 tab",group:"通用"},...kW,{id:"archive-session",combo:{key:"Backspace",mod:!0,shift:!0},label:"归档当前会话",description:"归档当前聊天区的会话,Enter 确认 / Esc 取消",group:"会话",desktopOnly:!0},{id:"tab-prev",combo:{key:"ArrowLeft",mod:!0,shift:!0},label:"上一个标签页",description:"连按快速移动,停下或松开修饰键后切换",group:"标签页"},{id:"tab-next",combo:{key:"ArrowRight",mod:!0,shift:!0},label:"下一个标签页",description:"连按快速移动,停下或松开修饰键后切换",group:"标签页"},{id:"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}];CW.filter(e=>!e.displayOnly);function EW(){return/Mac|iP(hone|od|ad)/.test(navigator.platform)}const NW=10,TW=20,IW=16,SS=20,kS=60,PW=4;function bd({testId:e,label:t,children:n}){return h.jsxs(Sp,{children:[h.jsx(kp,{asChild:!0,children:h.jsx("span",{"data-testid":e,role:"img","aria-label":t,tabIndex:0,className:"inline-flex shrink-0",children:n})}),h.jsx(Iu,{side:"bottom",children:t})]})}function RW({session:e,active:t,hasUnread:n,running:r=!1,awaitingUser:i=!1,onSelect:s,onEdit:o,onDelete:a,onPin:l,onArchive:c,quickAction:u,depth:d=0,chevron:f,showCopyResume:p=!0,contactDisplayName:m,ownerPrincipalId:v,creatorDisplayName:w,dispatchedFromSessionTitle:x}){const[_,y]=g.useState(!1),S=SW(),C=S.held?S.indexBySessionId.get(e.sessionId):void 0,k=!!e.pinnedAt,N=d===0,T=d===0&&!!c,z=NW+d*TW;let P=null;u==="pin"&&N&&l?P={icon:k?h.jsx(Uw,{className:"w-4 h-4"}):h.jsx(Ww,{className:"w-4 h-4"}),label:k?"取消置顶":"置顶",run:()=>l(e.sessionId,!k)}:u==="archive"&&T&&c?P={icon:h.jsx(Fw,{className:"w-4 h-4"}),label:"归档",run:()=>c(e.sessionId,!0)}:u==="rename"&&o&&(P={icon:h.jsx(v0,{className:"w-4 h-4"}),label:"重命名",run:()=>y(!0)});const O=g.useCallback(async()=>{const $=$I(e);if($)try{await navigator.clipboard.writeText($)}catch{}},[e]),M=ny(e),R=e.originOwnerPrincipalId,A=R?`@${m??`…${R.slice(-8)}`}`:null,L=!!(e.ownerPersonaId&&v&&e.creatorPrincipalId&&e.creatorPrincipalId!==v&&!e.larkChatId&&!e.shiftFiredFromSessionId&&!e.dispatchedFromSessionId);return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":`session-item-${e.sessionId}`,onClick:s,style:{paddingLeft:z,display:"grid",gridTemplateColumns:f?`${IW}px ${SS}px 1fr auto ${kS}px`:`${SS}px 1fr auto ${kS}px`,gridTemplateAreas:f?'"chev icon name dot time"':'"icon name dot time"',columnGap:`${PW}px`,alignItems:"center"},className:re("group relative rounded-lg cursor-pointer transition-all duration-150 pr-2.5 py-1.5",t?"bg-accent-dim":"hover:bg-sidebar-hover-bg"),children:[t?h.jsx("span",{"aria-hidden":"true",className:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-7 rounded-r-full bg-accent"}):null,h.jsx("div",{style:{gridArea:"chev"},className:"flex items-center justify-center",children:f??null}),h.jsx("div",{style:{gridArea:"icon"},className:"flex items-center justify-center",children:h.jsx(YU,{tool:e.tool})}),h.jsxs("div",{style:{gridArea:"name"},className:"flex items-center gap-1 min-w-0",children:[h.jsxs(of,{delayDuration:200,skipDelayDuration:100,children:[e.dispatchedFromSessionId?h.jsx(bd,{testId:`dispatched-icon-${e.sessionId}`,label:`来自【${x??"另一会话"}】dispatch`,children:h.jsx(j$,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,e.shiftFiredFromSessionId?h.jsx(bd,{testId:`shift-fired-icon-${e.sessionId}`,label:"定时任务",children:h.jsx(a$,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,e.larkChatId?h.jsx(bd,{testId:`lark-chat-icon-${e.sessionId}`,label:e.larkChatType==="p2p"?"来自飞书DM":"来自飞书群",children:h.jsx(a8,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,L?h.jsx(bd,{testId:`guest-created-icon-${e.sessionId}`,label:w?`${w}创建`:"其他人创建",children:h.jsx(W8,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null]}),h.jsx("span",{"data-testid":`session-title-${e.sessionId}`,className:re("text-[13px] truncate min-w-0","group-hover:whitespace-normal group-hover:overflow-visible group-hover:break-words",t?"text-text-100 font-medium":"text-text-200"),children:M}),A?h.jsx("span",{"data-testid":`session-mirror-chip-${e.sessionId}`,title:`在 ${A.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:A}):null]}),h.jsx(QU,{sessionId:e.sessionId,hasUnread:n,running:r,awaitingUser:i,style:{gridArea:"dot"}}),C!=null?h.jsx("span",{style:{gridArea:"time"},"data-testid":`session-quick-switch-badge-${e.sessionId}`,className:"text-right shrink-0 transition-opacity duration-150 group-hover:opacity-0",children:h.jsx("span",{className:"inline-flex items-center justify-center h-[18px] px-1.5 rounded-[5px] border border-border bg-bg-200/70 text-[11px] text-text-200 font-medium leading-none",children:EW()?`⌘${C}`:`Ctrl+${C}`})}):h.jsx("span",{style:{gridArea:"time"},className:re("text-[11px] text-text-400/70 text-right shrink-0","transition-opacity duration-150 group-hover:opacity-0"),children:e.updatedAt?UF(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:[P?h.jsx(of,{delayDuration:200,skipDelayDuration:100,children:h.jsxs(Sp,{children:[h.jsx(kp,{asChild:!0,children:h.jsx("button",{type:"button",onClick:$=>{$.stopPropagation(),P.run()},className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:text-text-100 hover:bg-text-100/5 transition-colors cursor-pointer","aria-label":P.label,"data-testid":`quick-action-${u}-${e.sessionId}`,children:P.icon})}),h.jsx(Iu,{side:"bottom",children:P.label})]})}):null,h.jsxs(Sy,{modal:!1,children:[h.jsx(ky,{asChild:!0,children:h.jsx("button",{type:"button",onClick:$=>$.stopPropagation(),className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:text-text-100 hover:bg-text-100/5 transition-colors cursor-pointer","aria-label":"session actions","data-testid":`session-menu-${e.sessionId}`,children:h.jsx(mI,{className:"w-4 h-4"})})}),h.jsxs(_p,{align:"end",onClick:$=>$.stopPropagation(),children:[l&&N&&h.jsxs(Pi,{onSelect:()=>l(e.sessionId,!k),"data-testid":`session-${k?"unpin":"pin"}-${e.sessionId}`,children:[k?h.jsx(Uw,{className:"w-3 h-3 mr-2 text-text-400"}):h.jsx(Ww,{className:"w-3 h-3 mr-2 text-text-400"}),k?"Unpin":"Pin"]}),T&&c&&h.jsxs(Pi,{onSelect:()=>c(e.sessionId,!0),"data-testid":`session-archive-${e.sessionId}`,children:[h.jsx(Fw,{className:"w-3 h-3 mr-2 text-text-400"}),"Archive"]}),o&&h.jsxs(Pi,{onSelect:()=>y(!0),"data-testid":`session-rename-${e.sessionId}`,children:[h.jsx(v0,{className:"w-3 h-3 mr-2 text-text-400"}),"Rename"]}),p&&e.toolSessionId?h.jsxs(Pi,{onSelect:()=>void O(),"data-testid":`session-copy-resume-${e.sessionId}`,children:[h.jsx(ap,{className:"w-3 h-3 mr-2 text-text-400"}),"Copy Resume Command"]}):null,(l||o||p&&e.toolSessionId)&&a&&h.jsx(IR,{}),a&&h.jsxs(Pi,{onSelect:()=>void a(e.sessionId),className:"text-destructive focus:text-destructive focus:bg-destructive/10","data-testid":`session-delete-${e.sessionId}`,children:[h.jsx(Z_,{className:"w-3 h-3 mr-2"}),"Delete"]})]})]})]}):null]}),o?h.jsx(ZU,{open:_,initialLabel:e.label??"",placeholder:e.cwd.split("/").pop()||"",onSubmit:$=>{o(e.sessionId,$),y(!1)},onCancel:()=>y(!1)}):null]})}function Ey({node:e,depth:t=0,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,getContactDisplayName:f,showCopyResume:p,ownerPrincipalId:m,getCreatorDisplayName:v,getSessionDisplayName:w,parentSession:x}){const _=e.children.length>0,{isCollapsed:y,toggle:S}=e$(),C=!y(e.session.sessionId),k=g.useCallback(T=>{T.stopPropagation(),S(e.session.sessionId)},[S,e.session.sessionId]),N=_?h.jsx("button",{type:"button",onClick:k,"data-testid":`session-chevron-${e.session.sessionId}`,"aria-label":C?"collapse":"expand","aria-expanded":C,className:"shrink-0 flex items-center justify-center w-4 h-4 text-text-400 hover:text-text-100 cursor-pointer",children:C?h.jsx(Gn,{className:"w-3 h-3"}):h.jsx(On,{className:"w-3 h-3"})}):null;return h.jsxs("div",{"data-testid":`session-tree-node-${e.session.sessionId}`,children:[h.jsx(RW,{session:e.session,active:n===e.session.sessionId,hasUnread:(r==null?void 0:r.has(e.session.sessionId))??!1,running:(i==null?void 0:i.has(e.session.sessionId))??!1,awaitingUser:(s==null?void 0:s.has(e.session.sessionId))??!1,onSelect:()=>o(e.session.sessionId),onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,showCopyResume:p,ownerPrincipalId:m,creatorDisplayName:e.session.creatorPrincipalId?v==null?void 0:v(e.session.creatorPrincipalId):void 0,dispatchedFromSessionTitle:e.session.dispatchedFromSessionId?(w==null?void 0:w(e.session.dispatchedFromSessionId))??((x==null?void 0:x.sessionId)===e.session.dispatchedFromSessionId?ny(x):void 0):void 0,depth:t,chevron:N,contactDisplayName:e.session.originOwnerPrincipalId?f==null?void 0:f(e.session.originOwnerPrincipalId):void 0}),_&&C?h.jsx("div",{"data-testid":`session-tree-children-${e.session.sessionId}`,children:e.children.map(T=>h.jsx(Ey,{node:T,depth:t+1,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,getContactDisplayName:f,showCopyResume:p,ownerPrincipalId:m,getCreatorDisplayName:v,getSessionDisplayName:w,parentSession:e.session},T.session.sessionId))}):null]})}function MW(e){return e.forkedFromSessionId??e.dispatchedFromSessionId??e.shiftFiredFromSessionId}function FR(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=MW(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(AW).map(i)}function HR(e){return[...e].sort((t,n)=>t.session.updatedAt<n.session.updatedAt?1:t.session.updatedAt>n.session.updatedAt?-1:0)}function AW(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 jW(e){return e.appBuilderProject?`[app] ${e.appBuilderProject}`:e.label?e.label:e.aiLabel?e.aiLabel:e.cwd.split("/").filter(Boolean).pop()??""}function CS(e,t){const n=t.trim().toLowerCase();return n===""?!0:e.toLowerCase().includes(n)}const LW={isCollapsed:()=>!1,toggle:()=>{},prune:()=>{}};function DW({personas:e,activePersonaId:t,onSelectPersona:n,onCreateSession:r,sessions:i,activeSessionId:s,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,isPersonaExpanded:p,onTogglePersonaExpanded:m,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,searchQuery:y}){const[S,C]=g.useState(null),[k,N]=g.useState(()=>new Set),T=p??(L=>k.has(L)),z=g.useCallback(L=>{if(m){m(L);return}N($=>{const F=new Set($);return F.has(L)?F.delete(L):F.add(L),F})},[m]),P=g.useMemo(()=>i==null?void 0:i.filter(L=>!L.ephemeral),[i]),O=g.useMemo(()=>new Map((P??[]).map(L=>[L.sessionId,ny(L)])),[P]),M=g.useCallback(L=>f==null?void 0:f.get(L),[f]),R=g.useCallback(L=>O.get(L),[O]);if(e.length===0)return h.jsx(OW,{});const A=(y??"").trim();return A?h.jsx(X_.Provider,{value:LW,children:h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(L=>{const $=P?P.filter(E=>E.ownerPersonaId===L.personaId).sort((E,H)=>H.updatedAt>E.updatedAt?1:-1):[],F=CS(L.label,A),D=$.filter(E=>CS(jW(E),A));if(!F&&D.length===0)return null;const B=F?$:D;return h.jsx(ES,{persona:L,active:L.personaId===t,editing:!1,onSelectPersona:n,onSubmitCreateSession:()=>{},onCancelCreateSession:()=>{},personaSessions:B,collapsed:!1,onToggleCollapsed:()=>{},activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,getCreatorDisplayName:M,getSessionDisplayName:R},L.personaId)})})}):h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(L=>{const $=P?P.filter(F=>F.ownerPersonaId===L.personaId).sort((F,D)=>D.updatedAt>F.updatedAt?1:-1):[];return h.jsx(ES,{persona:L,active:L.personaId===t,editing:L.personaId===S,onSelectPersona:n,onStartCreateSession:r?()=>C(L.personaId):void 0,onSubmitCreateSession:F=>{C(null),r==null||r(L.personaId,F)},onCancelCreateSession:()=>C(null),personaSessions:$,collapsed:!T(L.personaId),onToggleCollapsed:()=>z(L.personaId),activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,getCreatorDisplayName:M,getSessionDisplayName:R},L.personaId)})})}function OW(){return h.jsx("div",{className:"px-3 py-3 text-[11px] leading-relaxed text-text-400",children:"还没有 persona。点上方 Personas 标题右侧 + 创建第一个。"})}function ES({persona:e,active:t,editing:n,onSelectPersona:r,onStartCreateSession:i,onSubmitCreateSession:s,onCancelCreateSession:o,personaSessions:a,collapsed:l,onToggleCollapsed:c,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,treatSessionsAsRoots:y,ownerPrincipalId:S,creatorDisplayNameByOwnerId:C,getCreatorDisplayName:k,getSessionDisplayName:N}){const T=a.length>0,z=!l,P=g.useMemo(()=>{const R=[],A=new Map;for(const L of a){const $=L.creatorPrincipalId;if(L.larkChatId!=null||!$||S&&$===S){R.push(L);continue}const F=$,D=(C==null?void 0:C.get(F))??`…${F.slice(-8)}`,B=A.get(F);B?B.sessions.push(L):A.set(F,{groupKey:F,displayName:D,sessions:[L]})}return{self:R,byPeer:[...A.values()]}},[a,S,C]),O=P.byPeer.length>0,M=g.useMemo(()=>z&&!O?HR(FR(a)):[],[z,O,a]);return h.jsxs("div",{"data-testid":`persona-node-${e.personaId}`,children:[h.jsxs("div",{className:re("group flex items-center gap-1 px-2 py-1.5 cursor-pointer",t?"bg-accent-dim text-text-100":"hover:bg-bg-200 text-text-200"),onClick:()=>r==null?void 0:r(e.personaId),role:"button",tabIndex:0,children:[T?h.jsx("button",{type:"button",onClick:R=>{R.stopPropagation(),c()},"aria-label":z?"collapse":"expand","aria-expanded":z,"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:z?h.jsx(Gn,{className:"h-3 w-3"}):h.jsx(On,{className:"h-3 w-3"})}):h.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),h.jsx(lp,{tool:e.tool,className:re("h-3.5 w-3.5 shrink-0",cp(e.tool))}),h.jsx("span",{className:"flex-1 truncate text-[13px]",children:e.label}),T?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:R=>{R.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(y8,{className:"h-3.5 w-3.5"})}):null]}),n?h.jsx(BW,{personaId:e.personaId,tool:e.tool,onSubmit:s,onCancel:o}):null,T&&z?h.jsx("div",{"data-testid":`persona-sessions-${e.personaId}`,children:O?h.jsxs(h.Fragment,{children:[P.self.length>0&&h.jsx(NS,{groupKey:`${e.personaId}-self`,label:"我自己",testId:`persona-sessions-${e.personaId}-self`,sessions:P.self,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:N}),P.byPeer.map(R=>h.jsx(NS,{groupKey:`${e.personaId}-peer-${R.groupKey}`,label:R.displayName,testId:`persona-sessions-${e.personaId}-peer-${R.groupKey}`,sessions:R.sessions,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:N},`${e.personaId}-peer-${R.groupKey}`))]}):M.map(R=>h.jsx(Ey,{node:R,depth:y?0:1,activeId:u,unreadIds:p,runningIds:f,awaitingIds:d,onSelect:A=>m==null?void 0:m(A),onDelete:v,onEdit:w,onPin:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:N},R.session.sessionId))}):null]})}function NS({label:e,testId:t,sessions:n,activeSessionId:r,awaitingIds:i,runningIds:s,unreadIds:o,onSelectSession:a,onDeleteSession:l,onEditSession:c,onPinSession:u,showCopyResume:d,ownerPrincipalId:f,getCreatorDisplayName:p,getSessionDisplayName:m}){const[v,w]=g.useState(!1),x=!v,_=g.useMemo(()=>x?HR(FR(n)):[],[x,n]);return h.jsxs("div",{"data-testid":t,children:[h.jsxs("button",{type:"button",onClick:()=>w(y=>!y),"aria-label":x?"collapse":"expand","aria-expanded":x,"data-testid":`${t}-chevron`,className:"flex items-center gap-1 w-full pl-7 pr-2 py-0.5 text-[11px] text-text-400 hover:text-text-200 transition-colors",children:[x?h.jsx(Gn,{className:"h-3 w-3"}):h.jsx(On,{className:"h-3 w-3"}),h.jsx(wI,{className:"h-3 w-3","aria-hidden":!0}),h.jsx("span",{className:"truncate",children:e}),h.jsx("span",{className:"ml-auto tabular-nums",children:n.length})]}),x&&h.jsx("div",{children:_.map(y=>h.jsx(Ey,{node:y,depth:2,activeId:r,unreadIds:o,runningIds:s,awaitingIds:i,onSelect:S=>a==null?void 0:a(S),onDelete:l,onEdit:c,onPin:u,showCopyResume:d,ownerPrincipalId:f,getCreatorDisplayName:p,getSessionDisplayName:m},y.session.sessionId))})]})}function BW({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=Tu(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(lp,{tool:t,className:re("h-3 w-3 shrink-0",cp(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(xl,{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(Tr,{className:"h-3 w-3"})})]})}function zW(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function $W(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),r=parseFloat(n.fontSize);return t*r}function FW(e){return e/100*window.innerHeight}function HW(e){return e/100*window.innerWidth}function UW(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 tc({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,s]=UW(n);switch(s){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=$W(t,i);break}case"em":{r=zW(t,i);break}case"vh":{r=FW(i);break}case"vw":{r=HW(i);break}}return r}function Rn(e){return parseFloat(e.toFixed(3))}function Ya({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 I0(e){const{panels:t}=e,n=Ya({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=tc({groupSize:n,panelElement:i,styleProp:s.collapsedSize});o=Rn(u/n*100)}let a;if(s.defaultSize!==void 0){const u=tc({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=Rn(u/n*100)}let l=0;if(s.minSize!==void 0){const u=tc({groupSize:n,panelElement:i,styleProp:s.minSize});l=Rn(u/n*100)}let c=100;if(s.maxSize!==void 0){const u=tc({groupSize:n,panelElement:i,styleProp:s.maxSize});c=Rn(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 st(e,t="Assertion error"){if(!e)throw Error(t)}function P0(e,t){return Array.from(t).sort(e==="horizontal"?WW:VW)}function WW(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function VW(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 WR(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 qW({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}=WR(r,o),c=e==="horizontal"?a:l;c<s&&(s=c,i=o)}return st(i,"No rect found"),i}let wd;function KW(){return wd===void 0&&(typeof matchMedia=="function"?wd=!!matchMedia("(pointer:coarse)").matches:wd=!1),wd}function VR(e){const{element:t,orientation:n,panels:r,separators:i}=e,s=P0(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 w=r.find(x=>x.element===v);if(w){if(f){const x=f.element.getBoundingClientRect(),_=v.getBoundingClientRect();let y;if(l){const S=n==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),C=n==="horizontal"?new DOMRect(_.left,_.top,0,_.height):new DOMRect(_.left,_.top,_.width,0);switch(p.length){case 0:{y=[S,C];break}case 1:{const k=p[0],N=qW({orientation:n,rects:[x,_],targetRect:k.element.getBoundingClientRect()});y=[k,N===x?C:S];break}default:{y=p;break}}}else p.length?y=p:y=[n==="horizontal"?new DOMRect(x.right,_.top,_.left-x.right,_.height):new DOMRect(_.left,x.bottom,_.width,_.top-x.bottom)];for(const S of y){let C="width"in S?S:S.element.getBoundingClientRect();const k=KW()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(C.width<k){const T=k-C.width;C=new DOMRect(C.x-T/2,C.y,C.width+T,C.height)}if(C.height<k){const T=k-C.height;C=new DOMRect(C.x,C.y-T/2,C.width,C.height+T)}const N=m<=c||m>u;!a&&!N&&o.push({group:e,groupSize:Ya({group:e}),panels:[f,w],separator:"width"in S?void 0:S,rect:C}),a=!1}}l=!1,f=w,p=[]}}else if(v.hasAttribute("data-separator")){v.ariaDisabled!==null&&(a=!0);const w=i.find(x=>x.element===v);w?p.push(w):(f=void 0,p=[])}else l=!0}return o}var _s;class qR{constructor(){T1(this,_s,{})}addListener(t,n){const r=Tl(this,_s)[t];return r===void 0?Tl(this,_s)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=Tl(this,_s)[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(){I1(this,_s,{})}removeListener(t,n){const r=Tl(this,_s)[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}_s=new WeakMap;let Aa={cursorFlags:0,state:"inactive"};const Ny=new qR;function Io(){return Aa}function GW(e){return Ny.addListener("change",e)}function XW(e){const t=Aa,n={...Aa};n.cursorFlags=e,Aa=n,Ny.emit("change",{prev:t,next:n})}function ja(e){const t=Aa;Aa=e,Ny.emit("change",{prev:t,next:e})}const YW=e=>e,qm=()=>{},KR=1,GR=2,XR=4,YR=8,TS=3,IS=12;let Sd;function PS(){return Sd===void 0&&(Sd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Sd=!0)),Sd}function QW({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&&PS()){const s=(e&KR)!==0,o=(e&GR)!==0,a=(e&XR)!==0,l=(e&YR)!==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 PS()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}const RS=new WeakMap;function Ty(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=RS.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=Io();switch(r.state){case"active":case"hover":{const i=QW({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}}RS.set(e,{prevStyle:t,styleSheet:n})}let ii=new Map;const QR=new qR;function ZW(e){ii=new Map(ii),ii.delete(e)}function MS(e,t){for(const[n]of ii)if(n.id===e)return n}function As(e,t){for(const[n,r]of ii)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Uo(){return ii}function Iy(e,t){return QR.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Ki(e,t,n){const r=ii.get(e);ii=new Map(ii),ii.set(e,t),QR.emit("groupChange",{group:e,isUserInteraction:(n==null?void 0:n.isUserInteraction)===!0,prev:r,next:t})}function ZR(e){const t=Io();let n=!1;switch(t.state){case"active":ja({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Ty(e),n=!0,t.hitRegions.forEach(r=>{const i=As(r.group.id,!0);Ki(r.group,i,{isUserInteraction:!0})}))}return n}function AS(e){e.defaultPrevented||ZR(e.currentTarget)}function JW(e,t,n){let r,i={x:1/0,y:1/0};for(const s of t){const o=WR(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 eV(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function tV(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:DS(e),b:DS(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();st(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:LS(jS(n.a)),b:LS(jS(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 nV=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function rV(e){const t=getComputedStyle(JR(e)??e).display;return t==="flex"||t==="inline-flex"}function iV(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||rV(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"||nV.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function jS(e){let t=e.length;for(;t--;){const n=e[t];if(st(n,"Missing node"),iV(n))return n}return null}function LS(e){return e&&Number(getComputedStyle(e).zIndex)||0}function DS(e){const t=[];for(;e;)t.push(e),e=JR(e);return t}function JR(e){const{parentNode:t}=e;return eV(t)?t.host:t}function sV(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 oV({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!UR(n)||n.contains(e)||e.contains(n))return!0;if(tV(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(sV(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Py(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const s=VR(i),o=JW(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=0&&o.distance.y<=0&&oV({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function aV(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 bn(e,t,n=0){return Math.abs(Rn(e)-Rn(t))<=n}function ei(e,t){return bn(e,t)?0:e>t?1:-1}function wa({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(ei(r,l)<0)if(s){const c=(i+l)/2;ei(r,c)<0?r=i:r=l}else r=l;return r=Math.min(a,r),r=Rn(r),r}function su({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:s}){if(bn(e,0))return t;const o=s==="imperative-api",a=Object.values(t),l=Object.values(i),c=[...a],[u,d]=r;st(u!=null,"Invalid first pivot index"),st(d!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const v=e<0?d:u,w=n[v];st(w,`Panel constraints not found for index ${v}`);const{collapsedSize:x=0,collapsible:_,minSize:y=0}=w;if(_){const S=a[v];if(st(S!=null,`Previous layout not found for panel index ${v}`),bn(S,x)){const C=y-S;ei(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}{const v=e<0?u:d,w=n[v];st(w,`No panel constraints found for index ${v}`);const{collapsedSize:x=0,collapsible:_,minSize:y=0}=w;if(_){const S=a[v];if(st(S!=null,`Previous layout not found for panel index ${v}`),bn(S,y)){const C=S-x;ei(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}break}default:{const v=e<0?d:u,w=n[v];st(w,`Panel constraints not found for index ${v}`);const x=a[v],{collapsible:_,collapsedSize:y,minSize:S}=w;if(_&&ei(x,S)<0)if(e>0){const C=S-y,k=C/2,N=x+e;ei(N,S)<0&&(e=ei(e,k)<=0?0:C)}else{const C=S-y,k=100-C/2,N=x-e;ei(N,S)<0&&(e=ei(100+e,k)>0?0:-C)}break}}{const v=e<0?1:-1;let w=e<0?d:u,x=0;for(;;){const y=a[w];st(y!=null,`Previous layout not found for panel index ${w}`);const S=wa({overrideDisabledPanels:o,panelConstraints:n[w],prevSize:y,size:100})-y;if(x+=S,w+=v,w<0||w>=n.length)break}const _=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-_:_}{let v=e<0?u:d;for(;v>=0&&v<n.length;){const w=Math.abs(e)-Math.abs(f),x=a[v];st(x!=null,`Previous layout not found for panel index ${v}`);const _=x-w,y=wa({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:x,size:_});if(!bn(x,y)&&(f+=x-y,c[v]=y,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if(aV(l,c))return i;{const v=e<0?d:u,w=a[v];st(w!=null,`Previous layout not found for panel index ${v}`);const x=w+f,_=wa({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:w,size:x});if(c[v]=_,!bn(_,x)){let y=x-_,S=e<0?d:u;for(;S>=0&&S<n.length;){const C=c[S];st(C!=null,`Previous layout not found for panel index ${S}`);const k=C+y,N=wa({overrideDisabledPanels:o,panelConstraints:n[S],prevSize:C,size:k});if(bn(C,N)||(y-=N-C,c[S]=N),bn(y,0))break;e>0?S--:S++}}}const p=Object.values(c).reduce((v,w)=>w+v,0);if(!bn(p,100,.1))return i;const m=Object.keys(i);return c.reduce((v,w,x)=>(v[m[x]]=w,v),{})}function Po(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||ei(e[n],t[n])!==0)return!1;return!0}function Ro({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(!bn(i,100)&&r.length>0)for(let a=0;a<t.length;a++){const l=r[a];st(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];st(l!=null,`No layout data found for index ${a}`);const c=r[a];st(c!=null,`No layout data found for index ${a}`);const u=wa({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});c!=u&&(s+=c-u,r[a]=u)}if(!bn(s,0))for(let a=0;a<t.length;a++){const l=r[a];st(l!=null,`No layout data found for index ${a}`);const c=l+s,u=wa({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});if(l!==u&&(s-=u-l,r[a]=u,bn(s,0)))break}const o=Object.keys(e);return r.reduce((a,l,c)=>(a[o[c]]=l,a),{})}function e5({groupId:e,panelId:t}){const n=()=>{const l=Uo();for(const[c,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:p,separatorToPanels:m}]of l)if(c.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:c,groupSize:p,layout:f,separatorToPanels:m};throw Error(`Group ${e} not found`)},r=()=>{const l=n().derivedPanelConstraints.find(c=>c.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const l=n().group.panels.find(c=>c.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const l=n().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:l,panels:c,prevLayout:u,derivedPanelConstraints:d})=>{const f=s(),p=c.findIndex(w=>w.id===t),m=p===0,v=p===c.length-1;if(v&&l<f&&(m||c.slice(0,p).every((w,x)=>{const _=d[x];return(_==null?void 0:_.collapsible)&&bn(_.collapsedSize,u[_.panelId])}))){const w=c.slice(0,p).reduce((x,_)=>x+u[_.id],0);return{...u,[t]:Rn(100-w)}}return su({delta:v?f-l:l-f,initialLayout:u,panelConstraints:d,pivotIndices:v?[p-1,p]:[p,p+1],prevLayout:u,trigger:"imperative-api"})},a=l=>{const c=s();if(l===c)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:p,layout:m,separatorToPanels:v}=n(),w=o({nextSize:l,panels:f.panels,prevLayout:m,derivedPanelConstraints:d}),x=Ro({layout:w,panelConstraints:d});Po(m,x)||Ki(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:p,layout:x,separatorToPanels:v})};return{collapse:()=>{const{collapsible:l,collapsedSize:c}=r(),{mutableValues:u}=i(),d=s();l&&d!==c&&(u.expandToSize=d,a(c))},expand:()=>{const{collapsible:l,collapsedSize:c,minSize:u}=r(),{mutableValues:d}=i(),f=s();if(l&&f===c){let p=d.expandToSize??u;p===0&&(p=1),a(p)}},getSize:()=>{const{group:l}=n(),c=s(),{element:u}=i(),d=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:c,inPixels:d}},isCollapsed:()=>{const{collapsible:l,collapsedSize:c}=r(),u=s();return l&&bn(c,u)},resize:l=>{const{group:c}=n(),{element:u}=i(),d=Ya({group:c}),f=tc({groupSize:d,panelElement:u,styleProp:l}),p=Rn(f/d*100);a(p)}}}function OS(e){if(e.defaultPrevented)return;const t=Uo();Py(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=e5({groupId:n.group.id,panelId:r.id});s&&i!==void 0&&(s.resize(i),e.preventDefault())}}})}function ih(e){const t=Uo();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 t5({groupId:e}){const t=()=>{const n=Uo();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=Ro({layout:n,panelConstraints:i});return r?a:(Po(a,c)||Ki(s,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:o,layout:c,separatorToPanels:l}),c)}}}function eo(e,t){const n=ih(e),r=As(n.id,!0),i=n.separators.find(u=>u.element===e);st(i,"Matching separator not found");const s=r.separatorToPanels.get(i);st(s,"Matching panels not found");const o=s.map(u=>n.panels.indexOf(u)),a=t5({groupId:n.id}).getLayout(),l=su({delta:t,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:a,trigger:"keyboard"}),c=Ro({layout:l,panelConstraints:r.derivedPanelConstraints});Po(a,c)||Ki(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function BS(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=ih(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&eo(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&eo(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&eo(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&eo(t,-5);break}case"End":{e.preventDefault(),eo(t,100);break}case"Enter":{e.preventDefault();const r=ih(t),i=As(r.id,!0),{derivedPanelConstraints:s,layout:o,separatorToPanels:a}=i,l=r.separators.find(f=>f.element===t);st(l,"Matching separator not found");const c=a.get(l);st(c,"Matching panels not found");const u=c[0],d=s.find(f=>f.panelId===u.id);if(st(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;eo(t,p-f)}break}case"F6":{e.preventDefault();const r=ih(t).separators.map(o=>o.element),i=Array.from(r).findIndex(o=>o===e.currentTarget);st(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(),eo(t,-100);break}}}function zS(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Uo(),n=Py(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)}),ja({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function n5({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:s,prevCursorFlags:o}){let a=0;n.forEach(c=>{const{group:u,groupSize:d}=c,{orientation:f,panels:p}=u,{disableCursor:m}=u.mutableState;let v=0;s?f==="horizontal"?v=(t.clientX-s.x)/d*100:v=(t.clientY-s.y)/d*100:f==="horizontal"?v=t.clientX<0?-100:100:v=t.clientY<0?-100:100;const w=r.get(u),x=i.get(u);if(!w||!x)return;const{defaultLayoutDeferred:_,derivedPanelConstraints:y,groupSize:S,layout:C,separatorToPanels:k}=x;if(y&&C&&k){const N=su({delta:v,initialLayout:w,panelConstraints:y,pivotIndices:c.panels.map(T=>p.indexOf(T)),prevLayout:C,trigger:"mouse-or-touch"});if(Po(N,C)){if(v!==0&&!m)switch(f){case"horizontal":{a|=v<0?KR:GR;break}case"vertical":{a|=v<0?XR:YR;break}}}else Ki(c.group,{defaultLayoutDeferred:_,derivedPanelConstraints:y,groupSize:S,layout:N,separatorToPanels:k})}});let l=0;t.movementX===0?l|=o&TS:l|=a&TS,t.movementY===0?l|=o&IS:l|=a&IS,XW(l),Ty(e)}function $S(e){const t=Uo(),n=Io();switch(n.state){case"active":n5({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function FS(e){var r,i;if(e.defaultPrevented)return;const t=Io(),n=Uo();switch(t.state){case"active":{if(e.buttons===0){ja({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{const o=As(s.group.id,!0);Ki(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))}n5({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=Py(e,n);s.length===0?t.state!=="inactive"&&ja({cursorFlags:0,state:"inactive"}):ja({cursorFlags:0,hitRegions:s,state:"hover"}),Ty(e.currentTarget);break}}}function HS(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Io().state){case"hover":ja({cursorFlags:0,state:"inactive"})}}function US(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||ZR(e.currentTarget)&&e.preventDefault()}function WS(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const o=Rn(s.defaultSize);n+=o,r[s.panelId]=o}else r[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=Rn((100-n)/i);for(const o of e)o.defaultSize===void 0&&(r[o.panelId]=s)}return r}function lV(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const i=Ya({group:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,a={asPercentage:Rn(s/i*100),inPixels:s};r.mutableValues.prevSize=a,r.onResize(a,r.id,o)}function cV(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 uV({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=Rn(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]=Rn(f/s*c)}else{const d=Rn(c/l.length);for(const f of l)u[f]=d}return u}function dV(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 ta=new Map;function hV(e){let t=!0;st(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,s=new n(m=>{for(const v of m){const{borderBoxSize:w,target:x}=v;if(x===e.element){if(t){const _=Ya({group:e});if(_===0)return;const y=As(e.id);if(!y)return;const S=I0(e),C=y.defaultLayoutDeferred?WS(S):y.layout,k=uV({group:e,nextGroupSize:_,prevGroupSize:y.groupSize,prevLayout:C}),N=Ro({layout:k,panelConstraints:S});if(!y.defaultLayoutDeferred&&Po(y.layout,N)&&cV(y.derivedPanelConstraints,S)&&y.groupSize===_)return;Ki(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:_,layout:N,separatorToPanels:y.separatorToPanels})}}else lV(e,x,w)}});s.observe(e.element),e.panels.forEach(m=>{st(!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=Ya({group:e}),a=I0(e),l=e.panels.map(({id:m})=>m).join(",");let c=e.mutableState.defaultLayout;c&&(dV(e.panels,c)||(c=void 0));const u=e.mutableState.layouts[l]??c??WS(a),d=Ro({layout:u,panelConstraints:a}),f=e.element.ownerDocument;ta.set(f,(ta.get(f)??0)+1);const p=new Map;return VR(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),Ki(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:a,groupSize:o,layout:d,separatorToPanels:p}),e.separators.forEach(m=>{st(!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",BS)}),ta.get(f)===1&&(f.addEventListener("contextmenu",AS,!0),f.addEventListener("dblclick",OS,!0),f.addEventListener("pointerdown",zS,!0),f.addEventListener("pointerleave",$S),f.addEventListener("pointermove",FS),f.addEventListener("pointerout",HS),f.addEventListener("pointerup",US,!0)),function(){t=!1,ta.set(f,Math.max(0,(ta.get(f)??0)-1)),ZW(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",BS)}),ta.get(f)||(f.removeEventListener("contextmenu",AS,!0),f.removeEventListener("dblclick",OS,!0),f.removeEventListener("pointerdown",zS,!0),f.removeEventListener("pointerleave",$S),f.removeEventListener("pointermove",FS),f.removeEventListener("pointerout",HS),f.removeEventListener("pointerup",US,!0)),s.disconnect()}}function fV(){const[e,t]=g.useState({}),n=g.useCallback(()=>t({}),[]);return[e,n]}function Ry(e){const t=g.useId();return`${e??t}`}const Wo=typeof window<"u"?g.useLayoutEffect:g.useEffect;function bc(e){const t=g.useRef(e);return Wo(()=>{t.current=e},[e]),g.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function My(...e){return bc(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Ay(e){const t=g.useRef({...e});return Wo(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const r5=g.createContext(null);function pV(e,t){const n=g.useRef({getLayout:()=>({}),setLayout:YW});g.useImperativeHandle(t,()=>n.current,[]),Wo(()=>{Object.assign(n.current,t5({groupId:e}))})}function jy({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=bc(O=>{Po(m.current.onLayoutChange,O)||(m.current.onLayoutChange=O,l==null||l(O))}),w=bc((O,M)=>{Po(m.current.onLayoutChanged,O)||(m.current.onLayoutChanged=O,c==null||c(O,{isUserInteraction:M}))}),x=Ry(a),_=g.useRef(null),[y,S]=fV(),C=g.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),k=My(_,s);pV(x,o);const N=bc((O,M)=>{const R=Io(),A=MS(O),L=As(O);if(L){let $=!1;switch(R.state){case"active":{$=R.hitRegions.some(F=>F.group===A);break}}return{flexGrow:L.layout[M]??1,pointerEvents:$?"none":void 0}}if(n!=null&&n[M])return{flexGrow:n==null?void 0:n[M]}}),T=Ay({defaultLayout:n,disableCursor:r}),z=g.useMemo(()=>({get disableCursor(){return!!T.disableCursor},getPanelStyles:N,id:x,orientation:u,registerPanel:O=>{const M=C.current;return M.panels=P0(u,[...M.panels,O]),S(),()=>{M.panels=M.panels.filter(R=>R!==O),S()}},registerSeparator:O=>{const M=C.current;return M.separators=P0(u,[...M.separators,O]),S(),()=>{M.separators=M.separators.filter(R=>R!==O),S()}},updatePanelProps:(O,{disabled:M})=>{const R=C.current.panels.find($=>$.id===O);R&&(R.panelConstraints.disabled=M);const A=MS(x),L=As(x);A&&L&&Ki(A,{...L,derivedPanelConstraints:I0(A)})},updateSeparatorProps:(O,{disabled:M,disableDoubleClick:R})=>{const A=C.current.separators.find(L=>L.id===O);A&&(A.disabled=M,A.disableDoubleClick=R)}}),[N,x,S,u,T]),P=g.useRef(null);return Wo(()=>{const O=_.current;if(O===null)return;const M=C.current;let R;if(T.defaultLayout!==void 0&&Object.keys(T.defaultLayout).length===M.panels.length){R={};for(const E of M.panels){const H=T.defaultLayout[E.id];H!==void 0&&(R[E.id]=H)}}const A={disabled:!!i,element:O,id:x,mutableState:{defaultLayout:R,disableCursor:!!T.disableCursor,expandedPanelSizes:C.current.lastExpandedPanelSizes,layouts:C.current.layouts},orientation:u,panels:M.panels,resizeTargetMinimumSize:M.resizeTargetMinimumSize,separators:M.separators};P.current=A;const L=hV(A),{defaultLayoutDeferred:$,derivedPanelConstraints:F,layout:D}=As(A.id,!0);!$&&F.length>0&&(v(D),w(D,!1));const B=Iy(x,E=>{const{defaultLayoutDeferred:H,derivedPanelConstraints:q,layout:j}=E.next;if(H||q.length===0)return;const ne=A.panels.map(({id:K})=>K).join(",");A.mutableState.layouts[ne]=j,q.forEach(K=>{if(K.collapsible){const{layout:_e}=E.prev??{};if(_e){const Re=bn(K.collapsedSize,j[K.panelId]),ce=bn(K.collapsedSize,_e[K.panelId]);Re&&!ce&&(A.mutableState.expandedPanelSizes[K.panelId]=_e[K.panelId])}}});const ie=Io().state!=="active";v(j),ie&&w(j,E.isUserInteraction)});return()=>{P.current=null,L(),B()}},[i,x,w,v,u,y,T]),g.useEffect(()=>{const O=P.current;O&&(O.mutableState.defaultLayout=n,O.mutableState.disableCursor=!!r)}),h.jsx(r5.Provider,{value:z,children:h.jsx("div",{...p,className:t,"data-group":!0,"data-testid":x,id:x,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:e})})}jy.displayName="Group";function Ly(){const e=g.useContext(r5);return st(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function mV(e,t){const{id:n}=Ly(),r=g.useRef({collapse:qm,expand:qm,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:qm});g.useImperativeHandle(t,()=>r.current,[]),Wo(()=>{Object.assign(r.current,e5({groupId:n,panelId:e}))})}function af({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:s,elementRef:o,groupResizeBehavior:a="preserve-relative-size",id:l,maxSize:c="100%",minSize:u="0%",onResize:d,panelRef:f,style:p,...m}){const v=!!l,w=Ry(l),x=Ay({disabled:s}),_=g.useRef(null),y=My(_,o),{getPanelStyles:S,id:C,orientation:k,registerPanel:N,updatePanelProps:T}=Ly(),z=d!==null,P=bc((A,L,$)=>{d==null||d(A,l,$)});Wo(()=>{const A=_.current;if(A!==null){const L={element:A,id:w,idIsStable:v,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:z?P:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:i,disabled:x.disabled,maxSize:c,minSize:u}};return N(L)}},[a,n,r,i,z,w,v,c,u,P,N,x]),g.useEffect(()=>{T(w,{disabled:s})},[s,w,T]),mV(w,f);const O=()=>{const A=S(C,w);if(A)return JSON.stringify(A)},M=g.useSyncExternalStore(A=>Iy(C,A),O,O);let R;return M?R=JSON.parse(M):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":w,id:w,ref:y,style:{...gV,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:k==="horizontal"?"pan-y":"pan-x"},children:e})})}af.displayName="Panel";const gV={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function vV({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=Ro({layout:su({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Ro({layout:su({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:o}}function i5({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:s,style:o,...a}){const l=Ry(s),c=Ay({disabled:n,disableDoubleClick:r}),[u,d]=g.useState({}),[f,p]=g.useState("inactive"),[m,v]=g.useState(!1),w=g.useRef(null),x=My(w,i),{disableCursor:_,id:y,orientation:S,registerSeparator:C,updateSeparatorProps:k}=Ly(),N=S==="horizontal"?"vertical":"horizontal";Wo(()=>{const P=w.current;if(P!==null){const O={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:P,id:l},M=C(O),R=GW(L=>{p(L.next.state!=="inactive"&&L.next.hitRegions.some($=>$.separator===O)?L.next.state:"inactive")}),A=Iy(y,L=>{const{derivedPanelConstraints:$,layout:F,separatorToPanels:D}=L.next,B=D.get(O);if(B){const E=B[0],H=B.indexOf(E);d(vV({layout:F,panelConstraints:$,panelId:E.id,panelIndex:H}))}});return()=>{R(),A(),M()}}},[y,l,C,c]),g.useEffect(()=>{k(l,{disabled:n,disableDoubleClick:r})},[n,r,l,k]);let T;n&&!_&&(T="not-allowed");let z;if(n)z="disabled";else switch(f){case"active":{z="active";break}default:m?z="focus":z=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":z,"data-testid":l,id:l,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:x,role:"separator",style:{flexBasis:"auto",cursor:T,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}i5.displayName="Separator";function xV(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 _V(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 yV=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function bV(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(yV);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 wV=["TaskCreate","TaskUpdate","TaskList","TaskGet"];function SV(e){return wV.includes(e)}function s5(e){return e==="in_progress"||e==="completed"?e:"pending"}function kV(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:s5(n.status),activeForm:i,description:s}]}function CV(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=s5(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 EV(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=kV(t,i.input);break;case"TaskUpdate":t=CV(t,i.input);break}}return{tasks:t,lastEventIndex:n}}function o5(e){var n;if(e.error)return!1;if(e.pending)return!0;if(e.notifications.length>0)return!1;const t=(n=e.progress)==null?void 0:n.status;return t==="running"?!0:t==="started"?NV(e.input):!1}function NV(e){return!e||typeof e!="object"?!1:e.run_in_background===!0}function TV(e){return e.filter(t=>t.kind==="merged-agent"&&o5(t))}function a5(e){const{tasks:t,lastEventIndex:n}=EV(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,v,w;if(((f=c.progress)==null?void 0:f.status)==="completed"||((p=c.progress)==null?void 0:p.status)==="failed")return;const d={agentId:u.agentId,status:u.status};u.description?d.description=u.description:(m=c.progress)!=null&&m.description&&(d.description=c.progress.description),u.lastToolName?d.lastToolName=u.lastToolName:(v=c.progress)!=null&&v.lastToolName&&(d.lastToolName=c.progress.lastToolName),u.stats?d.stats=u.stats:(w=c.progress)!=null&&w.stats&&(d.stats=c.progress.stats),c.progress=d,(u.status==="completed"||u.status==="failed")&&(c.pending=!1)};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}const f=a.get(u.toolUseId);if((f==null?void 0:f.status)==="completed"||(f==null?void 0:f.status)==="failed")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 IV=new Set(["permission-inline","question-card"]);function PV(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||rp(e.metaKind)}function RV(e){return e.kind==="user-text"&&e.continuesTurn===!0}function MV(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(AV(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,!0);continue}if(PV(s)&&(r===null||!RV(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 AV(e,t,n){const{query:r,body:i}=e,s=jV(i,t,n),o=LV(i,s),a=OV(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 jV(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=R0(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function LV(e,t){if(t==="running"){const r=[];for(let i=e.length-1;i>=0&&IV.has(e[i].kind);i--)r.unshift(e[i]);return r}const n=t==="error"?R0(e,r=>r.kind==="error"):R0(e,r=>r.kind==="assistant-text");return n>=0?[e[n]]:[]}const DV=new Set(["assistant-thinking","user-meta"]);function OV(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(DV.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function R0(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const BV={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function zV(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 l5(e){const t=BV[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=zV(e.input);return r?`${n} ${r}`:n}function $V({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?Gn:On,s=n?(t==null?void 0:t(e))??null:null;return h.jsxs("div",{className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,"data-testid":"tool-call-group-row",className:re("flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] hover:text-text-200",e.error?"text-destructive/80":"text-text-400"),children:[e.pending?h.jsx(jn,{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:l5(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 FV({items:e,renderItemDetail:t}){const[n,r]=g.useState(!1);if(e.length===0)return null;const i=e.some(l=>l.pending),s=i?[...e].reverse().find(l=>l.pending):e[e.length-1],o=!i&&e.length>1?` 等 ${e.length} 项`:"",a=n?Gn:On;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(l=>!l),"aria-expanded":n,"data-testid":"tool-call-group-header",className:"flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] text-text-400 hover:text-text-200",children:[i&&!n?h.jsx(jn,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"}),n?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:i?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:re("truncate min-w-0",i&&"text-text-300"),children:[l5(s),o]})]}),n?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(l=>h.jsx($V,{item:l,renderItemDetail:t},l.toolUseId))}):null]})}function HV(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 UV(e,t){const n=t!==void 0?`耗时 ${HV(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function WV({status:e="done",durationMs:t,defaultExpanded:n=!1,children:r}){const[i,s]=g.useState(n),o=i?Gn:On;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:re("flex w-full items-center gap-1 text-left cursor-pointer min-w-0 py-0.5 text-[13px]",e!=="done"?"text-destructive/80 hover:text-destructive":"text-text-400 hover:text-text-200"),children:[h.jsx("span",{className:"truncate min-w-0",children:UV(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 VV=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,qV=/<builder-preview\b[^>]*\/>/gi,KV=/<(clawd-dispatch-task|clawd-dispatch-result)\b[^>]*>([\s\S]*?)<\/\1>/gi,GV=/<\/?(brief|detail|files)>/gi;function c5(e){return e?e.replace(KV,(t,n,r)=>iz(r.replace(GV,"")).trim()).replace(VV,"").replace(qV,"").trim():""}const XV=c5;function YV(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const QV=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ZV=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,JV={};function VS(e,t){return(JV.jsx?ZV:QV).test(e)}const eq=/[ \t\n\f\r]/g;function tq(e){return typeof e=="object"?e.type==="text"?qS(e.value):!1:qS(e)}function qS(e){return e.replace(eq,"")===""}class Pu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Pu.prototype.normal={};Pu.prototype.property={};Pu.prototype.space=void 0;function u5(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Pu(n,r,t)}function M0(e){return e.toLowerCase()}class Xn{constructor(t,n){this.attribute=n,this.property=t}}Xn.prototype.attribute="";Xn.prototype.booleanish=!1;Xn.prototype.boolean=!1;Xn.prototype.commaOrSpaceSeparated=!1;Xn.prototype.commaSeparated=!1;Xn.prototype.defined=!1;Xn.prototype.mustUseProperty=!1;Xn.prototype.number=!1;Xn.prototype.overloadedBoolean=!1;Xn.prototype.property="";Xn.prototype.spaceSeparated=!1;Xn.prototype.space=void 0;let nq=0;const je=Vo(),Bt=Vo(),A0=Vo(),Q=Vo(),lt=Vo(),La=Vo(),Jn=Vo();function Vo(){return 2**++nq}const j0=Object.freeze(Object.defineProperty({__proto__:null,boolean:je,booleanish:Bt,commaOrSpaceSeparated:Jn,commaSeparated:La,number:Q,overloadedBoolean:A0,spaceSeparated:lt},Symbol.toStringTag,{value:"Module"})),Km=Object.keys(j0);class Dy extends Xn{constructor(t,n,r,i){let s=-1;if(super(t,n),KS(this,"space",i),typeof r=="number")for(;++s<Km.length;){const o=Km[s];KS(this,Km[s],(r&j0[o])===j0[o])}}}Dy.prototype.defined=!0;function KS(e,t,n){n&&(e[t]=n)}function bl(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Dy(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[M0(r)]=r,n[M0(s.attribute)]=r}return new Pu(t,n,e.space)}const d5=bl({properties:{ariaActiveDescendant:null,ariaAtomic:Bt,ariaAutoComplete:null,ariaBusy:Bt,ariaChecked:Bt,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:lt,ariaCurrent:null,ariaDescribedBy:lt,ariaDetails:null,ariaDisabled:Bt,ariaDropEffect:lt,ariaErrorMessage:null,ariaExpanded:Bt,ariaFlowTo:lt,ariaGrabbed:Bt,ariaHasPopup:null,ariaHidden:Bt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:lt,ariaLevel:Q,ariaLive:null,ariaModal:Bt,ariaMultiLine:Bt,ariaMultiSelectable:Bt,ariaOrientation:null,ariaOwns:lt,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:Bt,ariaReadOnly:Bt,ariaRelevant:null,ariaRequired:Bt,ariaRoleDescription:lt,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:Bt,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 h5(e,t){return t in e?e[t]:t}function f5(e,t){return h5(e,t.toLowerCase())}const rq=bl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:La,acceptCharset:lt,accessKey:lt,action:null,allow:null,allowFullScreen:je,allowPaymentRequest:je,allowUserMedia:je,alt:null,as:null,async:je,autoCapitalize:null,autoComplete:lt,autoFocus:je,autoPlay:je,blocking:lt,capture:null,charSet:null,checked:je,cite:null,className:lt,cols:Q,colSpan:null,content:null,contentEditable:Bt,controls:je,controlsList:lt,coords:Q|La,crossOrigin:null,data:null,dateTime:null,decoding:null,default:je,defer:je,dir:null,dirName:null,disabled:je,download:A0,draggable:Bt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:je,formTarget:null,headers:lt,height:Q,hidden:A0,high:Q,href:null,hrefLang:null,htmlFor:lt,httpEquiv:lt,id:null,imageSizes:null,imageSrcSet:null,inert:je,inputMode:null,integrity:null,is:null,isMap:je,itemId:null,itemProp:lt,itemRef:lt,itemScope:je,itemType:lt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:je,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:je,muted:je,name:null,nonce:null,noModule:je,noValidate:je,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:je,optimum:Q,pattern:null,ping:lt,placeholder:null,playsInline:je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:je,referrerPolicy:null,rel:lt,required:je,reversed:je,rows:Q,rowSpan:Q,sandbox:lt,scope:null,scoped:je,seamless:je,selected:je,shadowRootClonable:je,shadowRootDelegatesFocus:je,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:Bt,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:je,useMap:null,value:Bt,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:lt,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:je,declare:je,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:je,noHref:je,noShade:je,noWrap:je,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:Bt,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:je,disableRemotePlayback:je,prefix:null,property:null,results:Q,security:null,unselectable:null},space:"html",transform:f5}),iq=bl({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:Jn,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:lt,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:je,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:La,g2:La,glyphName:La,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:Jn,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:lt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Jn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Jn,rev:Jn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Jn,requiredFeatures:Jn,requiredFonts:Jn,requiredFormats:Jn,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:Jn,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:Jn,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:Jn,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:h5}),p5=bl({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()}}),m5=bl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:f5}),g5=bl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),sq={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"},oq=/[A-Z]/g,GS=/-[a-z]/g,aq=/^data[-\w.:]+$/i;function lq(e,t){const n=M0(t);let r=t,i=Xn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&aq.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(GS,uq);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!GS.test(s)){let o=s.replace(oq,cq);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Dy}return new i(r,t)}function cq(e){return"-"+e.toLowerCase()}function uq(e){return e.charAt(1).toUpperCase()}const dq=u5([d5,rq,p5,m5,g5],"html"),Oy=u5([d5,iq,p5,m5,g5],"svg");function hq(e){return e.join(" ").trim()}var By={},XS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,fq=/\n/g,pq=/^\s*/,mq=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,gq=/^:\s*/,vq=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,xq=/^[;\s]*/,_q=/^\s+|\s+$/g,yq=`
|
|
506
|
+
`)},RH=0,ea=[];function MH(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(RH++)[0],s=g.useState(PP)[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=J7([e.lockRef.current],(e.shards||[]).map(bS),!0).filter(Boolean);return v.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,w){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var x=yd(v),_=n.current,y="deltaX"in v?v.deltaX:_[0]-x[0],S="deltaY"in v?v.deltaY:_[1]-x[1],C,k=v.target,N=Math.abs(y)>Math.abs(S)?"h":"v";if("touches"in v&&N==="h"&&k.type==="range")return!1;var T=window.getSelection(),z=T&&T.anchorNode,P=z?z===k||z.contains(k):!1;if(P)return!1;var O=_S(N,k);if(!O)return!0;if(O?C=N:(C=N==="v"?"h":"v",O=_S(N,k)),!O)return!1;if(!r.current&&"changedTouches"in v&&(y||S)&&(r.current=C),!C)return!0;var M=r.current||C;return TH(M,w,v,M==="h"?y:S)},[]),l=g.useCallback(function(v){var w=v;if(!(!ea.length||ea[ea.length-1]!==s)){var x="deltaY"in w?yS(w):yd(w),_=t.current.filter(function(C){return C.name===w.type&&(C.target===w.target||w.target===C.shadowParent)&&IH(C.delta,x)})[0];if(_&&_.should){w.cancelable&&w.preventDefault();return}if(!_){var y=(o.current.shards||[]).map(bS).filter(Boolean).filter(function(C){return C.contains(w.target)}),S=y.length>0?a(w,y[0]):!o.current.noIsolation;S&&w.cancelable&&w.preventDefault()}}},[]),c=g.useCallback(function(v,w,x,_){var y={name:v,delta:w,target:x,should:_,shadowParent:AH(x)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(S){return S!==y})},1)},[]),u=g.useCallback(function(v){n.current=yd(v),r.current=void 0},[]),d=g.useCallback(function(v){c(v.type,yS(v),v.target,a(v,e.lockRef.current))},[]),f=g.useCallback(function(v){c(v.type,yd(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return ea.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Jo),document.addEventListener("touchmove",l,Jo),document.addEventListener("touchstart",u,Jo),function(){ea=ea.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,Jo),document.removeEventListener("touchmove",l,Jo),document.removeEventListener("touchstart",u,Jo)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(s,{styles:PH(i)}):null,p?g.createElement(bH,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function AH(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const jH=lH(IP,MH);var py=g.forwardRef(function(e,t){return g.createElement(gp,ni({},e,{ref:t,sideCar:jH}))});py.classNames=gp.classNames;var E0=["Enter"," "],LH=["ArrowDown","PageUp","Home"],jP=["ArrowUp","PageDown","End"],DH=[...LH,...jP],OH={ltr:[...E0,"ArrowRight"],rtl:[...E0,"ArrowLeft"]},BH={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cu="Menu",[nu,zH,$H]=UI(Cu),[Ho,LP]=Fo(Cu,[$H,mp,yP]),Eu=mp(),DP=yP(),[OP,qs]=Ho(Cu),[FH,Nu]=Ho(Cu),BP=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=Eu(t),[l,c]=g.useState(null),u=g.useRef(!1),d=mi(s),f=WI(i);return g.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),h.jsx(hy,{...a,children:h.jsx(OP,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:h.jsx(FH,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};BP.displayName=Cu;var HH="MenuAnchor",my=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Eu(n);return h.jsx(gP,{...i,...r,ref:t})});my.displayName=HH;var gy="MenuPortal",[UH,zP]=Ho(gy,{forceMount:void 0}),$P=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=qs(gy,t);return h.jsx(UH,{scope:t,forceMount:n,children:h.jsx(Zi,{present:n||s.open,children:h.jsx(fy,{asChild:!0,container:i,children:r})})})};$P.displayName=gy;var yr="MenuContent",[WH,vy]=Ho(yr),FP=g.forwardRef((e,t)=>{const n=zP(yr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=qs(yr,e.__scopeMenu),o=Nu(yr,e.__scopeMenu);return h.jsx(nu.Provider,{scope:e.__scopeMenu,children:h.jsx(Zi,{present:r||s.open,children:h.jsx(nu.Slot,{scope:e.__scopeMenu,children:o.modal?h.jsx(VH,{...i,ref:t}):h.jsx(qH,{...i,ref:t})})})})}),VH=g.forwardRef((e,t)=>{const n=qs(yr,e.__scopeMenu),r=g.useRef(null),i=Yt(t,r);return g.useEffect(()=>{const s=r.current;if(s)return EP(s)},[]),h.jsx(xy,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ie(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),qH=g.forwardRef((e,t)=>{const n=qs(yr,e.__scopeMenu);return h.jsx(xy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),KH=eu("MenuContent.ScrollLock"),xy=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...v}=e,w=qs(yr,n),x=Nu(yr,n),_=Eu(n),y=DP(n),S=zH(n),[C,k]=g.useState(null),N=g.useRef(null),T=Yt(t,N,w.onContentChange),z=g.useRef(0),P=g.useRef(""),O=g.useRef(0),M=g.useRef(null),R=g.useRef("right"),A=g.useRef(0),L=m?py:g.Fragment,$=m?{as:KH,allowPinchZoom:!0}:void 0,F=B=>{var _e,Re;const E=P.current+B,H=S().filter(ce=>!ce.disabled),q=document.activeElement,j=(_e=H.find(ce=>ce.ref.current===q))==null?void 0:_e.textValue,ne=H.map(ce=>ce.textValue),ie=sU(ne,E,j),K=(Re=H.find(ce=>ce.textValue===ie))==null?void 0:Re.ref.current;(function ce(Me){P.current=Me,window.clearTimeout(z.current),Me!==""&&(z.current=window.setTimeout(()=>ce(""),1e3))})(E),K&&setTimeout(()=>K.focus())};g.useEffect(()=>()=>window.clearTimeout(z.current),[]),KI();const D=g.useCallback(B=>{var H,q;return R.current===((H=M.current)==null?void 0:H.side)&&aU(B,(q=M.current)==null?void 0:q.area)},[]);return h.jsx(WH,{scope:n,searchRef:P,onItemEnter:g.useCallback(B=>{D(B)&&B.preventDefault()},[D]),onItemLeave:g.useCallback(B=>{var E;D(B)||((E=N.current)==null||E.focus(),k(null))},[D]),onTriggerLeave:g.useCallback(B=>{D(B)&&B.preventDefault()},[D]),pointerGraceTimerRef:O,onPointerGraceIntentChange:g.useCallback(B=>{M.current=B},[]),children:h.jsx(L,{...$,children:h.jsx(ry,{asChild:!0,trapped:i,onMountAutoFocus:Ie(s,B=>{var E;B.preventDefault(),(E=N.current)==null||E.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:h.jsx(up,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:h.jsx(G7,{asChild:!0,...y,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:k,onEntryFocus:Ie(l,B=>{x.isUsingKeyboardRef.current||B.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(vP,{role:"menu","aria-orientation":"vertical","data-state":iR(w.open),"data-radix-menu-content":"",dir:x.dir,..._,...v,ref:T,style:{outline:"none",...v.style},onKeyDown:Ie(v.onKeyDown,B=>{const H=B.target.closest("[data-radix-menu-content]")===B.currentTarget,q=B.ctrlKey||B.altKey||B.metaKey,j=B.key.length===1;H&&(B.key==="Tab"&&B.preventDefault(),!q&&j&&F(B.key));const ne=N.current;if(B.target!==ne||!DH.includes(B.key))return;B.preventDefault();const K=S().filter(_e=>!_e.disabled).map(_e=>_e.ref.current);jP.includes(B.key)&&K.reverse(),rU(K)}),onBlur:Ie(e.onBlur,B=>{B.currentTarget.contains(B.target)||(window.clearTimeout(z.current),P.current="")}),onPointerMove:Ie(e.onPointerMove,ru(B=>{const E=B.target,H=A.current!==B.clientX;if(B.currentTarget.contains(E)&&H){const q=B.clientX>A.current?"right":"left";R.current=q,A.current=B.clientX}}))})})})})})})});FP.displayName=yr;var GH="MenuGroup",_y=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{role:"group",...r,ref:t})});_y.displayName=GH;var XH="MenuLabel",HP=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{...r,ref:t})});HP.displayName=XH;var rf="MenuItem",wS="menu.itemSelect",vp=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=g.useRef(null),o=Nu(rf,e.__scopeMenu),a=vy(rf,e.__scopeMenu),l=Yt(t,s),c=g.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(wS,{bubbles:!0,cancelable:!0});d.addEventListener(wS,p=>r==null?void 0:r(p),{once:!0}),HI(d,f),f.defaultPrevented?c.current=!1:o.onClose()}};return h.jsx(UP,{...i,ref:l,disabled:n,onClick:Ie(e.onClick,u),onPointerDown:d=>{var f;(f=e.onPointerDown)==null||f.call(e,d),c.current=!0},onPointerUp:Ie(e.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:Ie(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||E0.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});vp.displayName=rf;var UP=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=vy(rf,n),a=DP(n),l=g.useRef(null),c=Yt(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(nu.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:h.jsx(X7,{asChild:!0,...a,focusable:!r,children:h.jsx(Mt.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:Ie(e.onPointerMove,ru(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ie(e.onPointerLeave,ru(m=>o.onItemLeave(m))),onFocus:Ie(e.onFocus,()=>d(!0)),onBlur:Ie(e.onBlur,()=>d(!1))})})})}),YH="MenuCheckboxItem",WP=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return h.jsx(XP,{scope:e.__scopeMenu,checked:n,children:h.jsx(vp,{role:"menuitemcheckbox","aria-checked":sf(n)?"mixed":n,...i,ref:t,"data-state":wy(n),onSelect:Ie(i.onSelect,()=>r==null?void 0:r(sf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});WP.displayName=YH;var VP="MenuRadioGroup",[QH,ZH]=Ho(VP,{value:void 0,onValueChange:()=>{}}),qP=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=mi(r);return h.jsx(QH,{scope:e.__scopeMenu,value:n,onValueChange:s,children:h.jsx(_y,{...i,ref:t})})});qP.displayName=VP;var KP="MenuRadioItem",GP=g.forwardRef((e,t)=>{const{value:n,...r}=e,i=ZH(KP,e.__scopeMenu),s=n===i.value;return h.jsx(XP,{scope:e.__scopeMenu,checked:s,children:h.jsx(vp,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":wy(s),onSelect:Ie(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});GP.displayName=KP;var yy="MenuItemIndicator",[XP,JH]=Ho(yy,{checked:!1}),YP=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=JH(yy,n);return h.jsx(Zi,{present:r||sf(s.checked)||s.checked===!0,children:h.jsx(Mt.span,{...i,ref:t,"data-state":wy(s.checked)})})});YP.displayName=yy;var eU="MenuSeparator",QP=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});QP.displayName=eU;var tU="MenuArrow",ZP=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Eu(n);return h.jsx(xP,{...i,...r,ref:t})});ZP.displayName=tU;var by="MenuSub",[nU,JP]=Ho(by),eR=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=qs(by,t),o=Eu(t),[a,l]=g.useState(null),[c,u]=g.useState(null),d=mi(i);return g.useEffect(()=>(s.open===!1&&d(!1),()=>d(!1)),[s.open,d]),h.jsx(hy,{...o,children:h.jsx(OP,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:h.jsx(nU,{scope:t,contentId:zi(),triggerId:zi(),trigger:a,onTriggerChange:l,children:n})})})};eR.displayName=by;var ec="MenuSubTrigger",tR=g.forwardRef((e,t)=>{const n=qs(ec,e.__scopeMenu),r=Nu(ec,e.__scopeMenu),i=JP(ec,e.__scopeMenu),s=vy(ec,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(my,{asChild:!0,...c,children:h.jsx(UP,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":iR(n.open),...e,ref:bu(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:Ie(e.onPointerMove,ru(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:Ie(e.onPointerLeave,ru(d=>{var p,m;u();const f=(p=n.content)==null?void 0:p.getBoundingClientRect();if(f){const v=(m=n.content)==null?void 0:m.dataset.side,w=v==="right",x=w?-5:5,_=f[w?"left":"right"],y=f[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+x,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:Ie(e.onKeyDown,d=>{var p;const f=s.searchRef.current!=="";e.disabled||f&&d.key===" "||OH[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});tR.displayName=ec;var nR="MenuSubContent",rR=g.forwardRef((e,t)=>{const n=zP(yr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=qs(yr,e.__scopeMenu),o=Nu(yr,e.__scopeMenu),a=JP(nR,e.__scopeMenu),l=g.useRef(null),c=Yt(t,l);return h.jsx(nu.Provider,{scope:e.__scopeMenu,children:h.jsx(Zi,{present:r||s.open,children:h.jsx(nu.Slot,{scope:e.__scopeMenu,children:h.jsx(xy,{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:Ie(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ie(e.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Ie(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),f=BH[o.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});rR.displayName=nR;function iR(e){return e?"open":"closed"}function sf(e){return e==="indeterminate"}function wy(e){return sf(e)?"indeterminate":e?"checked":"unchecked"}function rU(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function iU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function sU(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=iU(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 oU(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 aU(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return oU(n,t)}function ru(e){return t=>t.pointerType==="mouse"?e(t):void 0}var lU=BP,cU=my,uU=$P,dU=FP,hU=_y,fU=HP,pU=vp,mU=WP,gU=qP,vU=GP,xU=YP,_U=QP,yU=ZP,bU=eR,wU=tR,SU=rR,xp="DropdownMenu",[kU]=Fo(xp,[LP]),En=LP(),[CU,sR]=kU(xp),oR=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=En(t),c=g.useRef(null),[u,d]=wu({prop:i,defaultProp:s??!1,onChange:o,caller:xp});return h.jsx(CU,{scope:t,triggerId:zi(),triggerRef:c,contentId:zi(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:h.jsx(lU,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};oR.displayName=xp;var aR="DropdownMenuTrigger",lR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,s=sR(aR,n),o=En(n);return h.jsx(cU,{asChild:!0,...o,children:h.jsx(Mt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:bu(t,s.triggerRef),onPointerDown:Ie(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Ie(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});lR.displayName=aR;var EU="DropdownMenuPortal",cR=e=>{const{__scopeDropdownMenu:t,...n}=e,r=En(t);return h.jsx(uU,{...r,...n})};cR.displayName=EU;var uR="DropdownMenuContent",dR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=sR(uR,n),s=En(n),o=g.useRef(!1);return h.jsx(dU,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:t,onCloseAutoFocus:Ie(e.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Ie(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)"}})});dR.displayName=uR;var NU="DropdownMenuGroup",TU=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(hU,{...i,...r,ref:t})});TU.displayName=NU;var IU="DropdownMenuLabel",hR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(fU,{...i,...r,ref:t})});hR.displayName=IU;var PU="DropdownMenuItem",fR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(pU,{...i,...r,ref:t})});fR.displayName=PU;var RU="DropdownMenuCheckboxItem",pR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(mU,{...i,...r,ref:t})});pR.displayName=RU;var MU="DropdownMenuRadioGroup",AU=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(gU,{...i,...r,ref:t})});AU.displayName=MU;var jU="DropdownMenuRadioItem",LU=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(vU,{...i,...r,ref:t})});LU.displayName=jU;var DU="DropdownMenuItemIndicator",mR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(xU,{...i,...r,ref:t})});mR.displayName=DU;var OU="DropdownMenuSeparator",gR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(_U,{...i,...r,ref:t})});gR.displayName=OU;var BU="DropdownMenuArrow",zU=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(yU,{...i,...r,ref:t})});zU.displayName=BU;var $U=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,o=En(t),[a,l]=wu({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return h.jsx(bU,{...o,open:a,onOpenChange:l,children:n})},FU="DropdownMenuSubTrigger",vR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(wU,{...i,...r,ref:t})});vR.displayName=FU;var HU="DropdownMenuSubContent",xR=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=En(n);return h.jsx(SU,{...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)"}})});xR.displayName=HU;var UU=oR,WU=lR,_R=cR,yR=dR,bR=hR,wR=fR,SR=pR,VU=mR,kR=gR,qU=$U,CR=vR,ER=xR;const Sy=UU,ky=WU,_p=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(_R,{children:h.jsx(yR,{ref:r,sideOffset:t,className:re("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...n})}));_p.displayName=yR.displayName;const KU=qU,NR=g.forwardRef(({className:e,...t},n)=>h.jsx(CR,{ref:n,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100 data-[state=open]:bg-bg-200","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));NR.displayName=CR.displayName;const TR=g.forwardRef(({className:e,...t},n)=>h.jsx(_R,{children:h.jsx(ER,{ref:n,className:re("z-50 min-w-[6rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...t})}));TR.displayName=ER.displayName;const Pi=g.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(wR,{ref:r,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Pi.displayName=wR.displayName;const GU=g.forwardRef(({className:e,children:t,checked:n,...r},i)=>h.jsxs(SR,{ref:i,checked:n,className:re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-7 pr-2 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(VU,{children:h.jsx(xl,{className:"h-3.5 w-3.5"})})}),t]}));GU.displayName=SR.displayName;const IR=g.forwardRef(({className:e,...t},n)=>h.jsx(kR,{ref:n,className:re("-mx-1 my-1 h-px bg-border",e),...t}));IR.displayName=kR.displayName;const XU=g.forwardRef(({className:e,...t},n)=>h.jsx(bR,{ref:n,className:re("px-2 py-1.5 text-xs font-semibold text-text-400",e),...t}));XU.displayName=bR.displayName;function YU({tool:e,className:t}){const n=HF(e);return h.jsx("span",{"data-testid":n?`session-icon-${e}`:"session-icon-default","aria-label":n?ty(e):"未知引擎",className:re("w-3.5 h-3.5 shrink-0 inline-flex items-center justify-center",cp(e),t),children:h.jsx(lp,{tool:e,className:"w-full h-full"})})}function QU({sessionId:e,hasUnread:t,running:n=!1,awaitingUser:r=!1,style:i}){return r?h.jsx(p$,{"data-testid":`awaiting-dot-${e}`,style:i,className:"w-3 h-3 text-warning shrink-0 animate-pulse",strokeWidth:2.25,"aria-label":"awaiting user"}):t?h.jsx("span",{"data-testid":`unread-dot-${e}`,style:i,className:"w-2 h-2 rounded-full bg-error shrink-0","aria-label":"unread"}):n?h.jsx("span",{"data-testid":`running-dot-${e}`,style:i,className:"w-2 h-2 rounded-full bg-success shrink-0 animate-pulse","aria-label":"running"}):null}function PR(e){return e.compositionActive||!!e.nativeIsComposing||e.keyCode===229}function RR(e){return e.key==="Enter"&&!e.shiftKey&&!PR(e)}function Tu(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(RR({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 ZU({open:e,initialLabel:t,placeholder:n,onSubmit:r,onCancel:i,title:s="Edit session",fieldLabel:o="Label",testId:a="session-edit-dialog",requireNonEmpty:l=!1}){const[c,u]=g.useState(t);g.useEffect(()=>{e&&u(t)},[e,t]);const d=c.trim(),f=l&&d==="",p=()=>{f||r({label:d})},m=Tu(p,i);return e?cl.createPortal(h.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-bg-0/40 backdrop-blur-[2px]",onClick:i,"data-testid":`${a}-overlay`,children:h.jsxs("div",{"data-testid":a,className:"w-[420px] max-w-[calc(100vw-32px)] rounded-2xl border border-text-100/[0.12] flex flex-col gap-4 p-5",style:{backgroundColor:"var(--bg-0)",boxShadow:"0 12px 40px rgba(0,0,0,0.04)"},onClick:v=>v.stopPropagation(),children:[h.jsx("div",{className:"text-[15px] font-semibold text-text-100",children:s}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-[12px] font-semibold text-text-200 mb-1",children:o}),h.jsx("input",{autoFocus:!0,type:"text",value:c,onChange:v=>u(v.target.value),...m,placeholder:n,"data-testid":`${a}-label`,className:"w-full px-3 py-2 text-[13px] bg-bg-50 border border-bg-300 rounded-lg focus:outline-none focus:border-text-300 transition-colors"})]}),h.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[h.jsx("button",{type:"button",onClick:i,className:"px-4 py-1.5 text-[12px] text-text-300 rounded-lg hover:bg-text-100/5 transition-colors cursor-pointer",children:"Cancel"}),h.jsx("button",{type:"button",onClick:p,disabled:f,"data-testid":`${a}-save`,className:"px-4 py-1.5 text-[12px] font-medium text-bg-0 rounded-lg bg-text-100 hover:bg-text-200 transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-40",children:"Save"})]})]})}),document.body):null}var JU=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"}),eW="VisuallyHidden",MR=g.forwardRef((e,t)=>h.jsx(Mt.span,{...e,ref:t,style:{...JU,...e.style}}));MR.displayName=eW;var tW=MR,[yp]=Fo("Tooltip",[mp]),bp=mp(),AR="TooltipProvider",nW=700,N0="tooltip.open",[rW,Cy]=yp(AR),jR=e=>{const{__scopeTooltip:t,delayDuration:n=nW,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(rW,{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})};jR.displayName=AR;var iu="Tooltip",[iW,wp]=yp(iu),LR=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=Cy(iu,e.__scopeTooltip),c=bp(t),[u,d]=g.useState(null),f=zi(),p=g.useRef(0),m=o??l.disableHoverableContent,v=a??l.delayDuration,w=g.useRef(!1),[x,_]=wu({prop:r,defaultProp:i??!1,onChange:N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(N0))):l.onClose(),s==null||s(N)},caller:iu}),y=g.useMemo(()=>x?w.current?"delayed-open":"instant-open":"closed",[x]),S=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w.current=!1,_(!0)},[_]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),k=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{w.current=!0,_(!0),p.current=0},v)},[v,_]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),h.jsx(hy,{...c,children:h.jsx(iW,{scope:t,contentId:f,open:x,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayedRef.current?k():S()},[l.isOpenDelayedRef,k,S]),onTriggerLeave:g.useCallback(()=>{m?C():(window.clearTimeout(p.current),p.current=0)},[C,m]),onOpen:S,onClose:C,disableHoverableContent:m,children:n})})};LR.displayName=iu;var T0="TooltipTrigger",DR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=wp(T0,n),s=Cy(T0,n),o=bp(n),a=g.useRef(null),l=Yt(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(gP,{asChild:!0,...o,children:h.jsx(Mt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Ie(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ie(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Ie(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Ie(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ie(e.onBlur,i.onClose),onClick:Ie(e.onClick,i.onClose)})})});DR.displayName=T0;var sW="TooltipPortal",[vae,oW]=yp(sW,{forceMount:void 0}),Xa="TooltipContent",OR=g.forwardRef((e,t)=>{const n=oW(Xa,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=wp(Xa,e.__scopeTooltip);return h.jsx(Zi,{present:r||o.open,children:o.disableHoverableContent?h.jsx(BR,{side:i,...s,ref:t}):h.jsx(aW,{side:i,...s,ref:t})})}),aW=g.forwardRef((e,t)=>{const n=wp(Xa,e.__scopeTooltip),r=Cy(Xa,e.__scopeTooltip),i=g.useRef(null),s=Yt(t,i),[o,a]=g.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:d}=r,f=g.useCallback(()=>{a(null),d(!1)},[d]),p=g.useCallback((m,v)=>{const w=m.currentTarget,x={x:m.clientX,y:m.clientY},_=hW(x,w.getBoundingClientRect()),y=fW(x,_),S=pW(v.getBoundingClientRect()),C=gW([...y,...S]);a(C),d(!0)},[d]);return g.useEffect(()=>()=>f(),[f]),g.useEffect(()=>{if(l&&u){const m=w=>p(w,u),v=w=>p(w,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",v)}}},[l,u,p,f]),g.useEffect(()=>{if(o){const m=v=>{const w=v.target,x={x:v.clientX,y:v.clientY},_=(l==null?void 0:l.contains(w))||(u==null?void 0:u.contains(w)),y=!mW(x,o);_?f():y&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,f]),h.jsx(BR,{...e,ref:s})}),[lW,cW]=yp(iu,{isInside:!1}),uW=ZF("TooltipContent"),BR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,l=wp(Xa,n),c=bp(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(N0,u),()=>document.removeEventListener(N0,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(up,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:h.jsxs(vP,{"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(uW,{children:r}),h.jsx(lW,{scope:n,isInside:!0,children:h.jsx(tW,{id:l.contentId,role:"tooltip",children:i||r})})]})})});OR.displayName=Xa;var zR="TooltipArrow",dW=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=bp(n);return cW(zR,n).isInside?null:h.jsx(xP,{...i,...r,ref:t})});dW.displayName=zR;function hW(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 fW(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 pW(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 mW(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 gW(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),vW(t)}function vW(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 xW=jR,_W=LR,yW=DR,$R=OR;const of=xW,Sp=_W,kp=yW,Iu=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx($R,{ref:r,sideOffset:t,className:re("z-50 overflow-hidden rounded-sm border border-border bg-bg-0 px-2 py-1 text-xs text-text-300 shadow-md",e),...n}));Iu.displayName=$R.displayName;const bW={held:!1,indexBySessionId:new Map},wW=g.createContext(bW);function SW(){return g.useContext(wW)}const kW=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})),CW=[{id:"new-session",combo:{key:"n",mod:!0},label:"新建任务",description:"打开快捷新建弹窗",group:"通用",desktopOnly:!0},{id:"open-search",combo:{key:"k",mod:!0},label:"全局搜索",description:"搜会话内容 / persona / 联系人",group:"通用",desktopOnly:!0},{id:"search-tab-prev",combo:{key:"ArrowLeft",mod:!0},label:"搜索:上一组",description:"搜索浮层里切到左边那个 tab(会话 / persona / 联系人)",group:"通用"},{id:"search-tab-next",combo:{key:"ArrowRight",mod:!0},label:"搜索:下一组",description:"搜索浮层里切到右边那个 tab",group:"通用"},...kW,{id:"archive-session",combo:{key:"Backspace",mod:!0,shift:!0},label:"归档当前会话",description:"归档当前聊天区的会话,Enter 确认 / Esc 取消",group:"会话",desktopOnly:!0},{id:"tab-prev",combo:{key:"ArrowLeft",mod:!0,shift:!0},label:"上一个标签页",description:"连按快速移动,停下或松开修饰键后切换",group:"标签页"},{id:"tab-next",combo:{key:"ArrowRight",mod:!0,shift:!0},label:"下一个标签页",description:"连按快速移动,停下或松开修饰键后切换",group:"标签页"},{id:"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}];CW.filter(e=>!e.displayOnly);function EW(){return/Mac|iP(hone|od|ad)/.test(navigator.platform)}const NW=10,TW=20,IW=16,SS=20,kS=60,PW=4;function bd({testId:e,label:t,children:n}){return h.jsxs(Sp,{children:[h.jsx(kp,{asChild:!0,children:h.jsx("span",{"data-testid":e,role:"img","aria-label":t,tabIndex:0,className:"inline-flex shrink-0",children:n})}),h.jsx(Iu,{side:"bottom",children:t})]})}function RW({session:e,active:t,hasUnread:n,running:r=!1,awaitingUser:i=!1,onSelect:s,onEdit:o,onDelete:a,onPin:l,onArchive:c,quickAction:u,depth:d=0,chevron:f,showCopyResume:p=!0,contactDisplayName:m,ownerPrincipalId:v,creatorDisplayName:w,dispatchedFromSessionTitle:x}){const[_,y]=g.useState(!1),S=SW(),C=S.held?S.indexBySessionId.get(e.sessionId):void 0,k=!!e.pinnedAt,N=d===0,T=d===0&&!!c,z=NW+d*TW;let P=null;u==="pin"&&N&&l?P={icon:k?h.jsx(Uw,{className:"w-4 h-4"}):h.jsx(Ww,{className:"w-4 h-4"}),label:k?"取消置顶":"置顶",run:()=>l(e.sessionId,!k)}:u==="archive"&&T&&c?P={icon:h.jsx(Fw,{className:"w-4 h-4"}),label:"归档",run:()=>c(e.sessionId,!0)}:u==="rename"&&o&&(P={icon:h.jsx(v0,{className:"w-4 h-4"}),label:"重命名",run:()=>y(!0)});const O=g.useCallback(async()=>{const $=$I(e);if($)try{await navigator.clipboard.writeText($)}catch{}},[e]),M=ny(e),R=e.originOwnerPrincipalId,A=R?`@${m??`…${R.slice(-8)}`}`:null,L=!!(e.ownerPersonaId&&v&&e.creatorPrincipalId&&e.creatorPrincipalId!==v&&!e.larkChatId&&!e.shiftFiredFromSessionId&&!e.dispatchedFromSessionId);return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":`session-item-${e.sessionId}`,onClick:s,style:{paddingLeft:z,display:"grid",gridTemplateColumns:f?`${IW}px ${SS}px 1fr auto ${kS}px`:`${SS}px 1fr auto ${kS}px`,gridTemplateAreas:f?'"chev icon name dot time"':'"icon name dot time"',columnGap:`${PW}px`,alignItems:"center"},className:re("group relative rounded-lg cursor-pointer transition-all duration-150 pr-2.5 py-1.5",t?"bg-accent-dim":"hover:bg-sidebar-hover-bg"),children:[t?h.jsx("span",{"aria-hidden":"true",className:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-7 rounded-r-full bg-accent"}):null,h.jsx("div",{style:{gridArea:"chev"},className:"flex items-center justify-center",children:f??null}),h.jsx("div",{style:{gridArea:"icon"},className:"flex items-center justify-center",children:h.jsx(YU,{tool:e.tool})}),h.jsxs("div",{style:{gridArea:"name"},className:"flex items-center gap-1 min-w-0",children:[h.jsxs(of,{delayDuration:200,skipDelayDuration:100,children:[e.dispatchedFromSessionId?h.jsx(bd,{testId:`dispatched-icon-${e.sessionId}`,label:`来自【${x??"另一会话"}】dispatch`,children:h.jsx(j$,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,e.shiftFiredFromSessionId?h.jsx(bd,{testId:`shift-fired-icon-${e.sessionId}`,label:"定时任务",children:h.jsx(a$,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,e.larkChatId?h.jsx(bd,{testId:`lark-chat-icon-${e.sessionId}`,label:e.larkChatType==="p2p"?"来自飞书DM":"来自飞书群",children:h.jsx(a8,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,L?h.jsx(bd,{testId:`guest-created-icon-${e.sessionId}`,label:w?`${w}创建`:"其他人创建",children:h.jsx(W8,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null]}),h.jsx("span",{"data-testid":`session-title-${e.sessionId}`,className:re("text-[13px] truncate min-w-0","group-hover:whitespace-normal group-hover:overflow-visible group-hover:break-words",t?"text-text-100 font-medium":"text-text-200"),children:M}),A?h.jsx("span",{"data-testid":`session-mirror-chip-${e.sessionId}`,title:`在 ${A.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:A}):null]}),h.jsx(QU,{sessionId:e.sessionId,hasUnread:n,running:r,awaitingUser:i,style:{gridArea:"dot"}}),C!=null?h.jsx("span",{style:{gridArea:"time"},"data-testid":`session-quick-switch-badge-${e.sessionId}`,className:"text-right shrink-0 transition-opacity duration-150 group-hover:opacity-0",children:h.jsx("span",{className:"inline-flex items-center justify-center h-[18px] px-1.5 rounded-[5px] border border-border bg-bg-200/70 text-[11px] text-text-200 font-medium leading-none",children:EW()?`⌘${C}`:`Ctrl+${C}`})}):h.jsx("span",{style:{gridArea:"time"},className:re("text-[11px] text-text-400/70 text-right shrink-0","transition-opacity duration-150 group-hover:opacity-0"),children:e.updatedAt?UF(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:[P?h.jsx(of,{delayDuration:200,skipDelayDuration:100,children:h.jsxs(Sp,{children:[h.jsx(kp,{asChild:!0,children:h.jsx("button",{type:"button",onClick:$=>{$.stopPropagation(),P.run()},className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:text-text-100 hover:bg-text-100/5 transition-colors cursor-pointer","aria-label":P.label,"data-testid":`quick-action-${u}-${e.sessionId}`,children:P.icon})}),h.jsx(Iu,{side:"bottom",children:P.label})]})}):null,h.jsxs(Sy,{modal:!1,children:[h.jsx(ky,{asChild:!0,children:h.jsx("button",{type:"button",onClick:$=>$.stopPropagation(),className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:text-text-100 hover:bg-text-100/5 transition-colors cursor-pointer","aria-label":"session actions","data-testid":`session-menu-${e.sessionId}`,children:h.jsx(mI,{className:"w-4 h-4"})})}),h.jsxs(_p,{align:"end",onClick:$=>$.stopPropagation(),children:[l&&N&&h.jsxs(Pi,{onSelect:()=>l(e.sessionId,!k),"data-testid":`session-${k?"unpin":"pin"}-${e.sessionId}`,children:[k?h.jsx(Uw,{className:"w-3 h-3 mr-2 text-text-400"}):h.jsx(Ww,{className:"w-3 h-3 mr-2 text-text-400"}),k?"Unpin":"Pin"]}),T&&c&&h.jsxs(Pi,{onSelect:()=>c(e.sessionId,!0),"data-testid":`session-archive-${e.sessionId}`,children:[h.jsx(Fw,{className:"w-3 h-3 mr-2 text-text-400"}),"Archive"]}),o&&h.jsxs(Pi,{onSelect:()=>y(!0),"data-testid":`session-rename-${e.sessionId}`,children:[h.jsx(v0,{className:"w-3 h-3 mr-2 text-text-400"}),"Rename"]}),p&&e.toolSessionId?h.jsxs(Pi,{onSelect:()=>void O(),"data-testid":`session-copy-resume-${e.sessionId}`,children:[h.jsx(ap,{className:"w-3 h-3 mr-2 text-text-400"}),"Copy Resume Command"]}):null,(l||o||p&&e.toolSessionId)&&a&&h.jsx(IR,{}),a&&h.jsxs(Pi,{onSelect:()=>void a(e.sessionId),className:"text-destructive focus:text-destructive focus:bg-destructive/10","data-testid":`session-delete-${e.sessionId}`,children:[h.jsx(Z_,{className:"w-3 h-3 mr-2"}),"Delete"]})]})]})]}):null]}),o?h.jsx(ZU,{open:_,initialLabel:e.label??"",placeholder:e.cwd.split("/").pop()||"",onSubmit:$=>{o(e.sessionId,$),y(!1)},onCancel:()=>y(!1)}):null]})}function Ey({node:e,depth:t=0,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,getContactDisplayName:f,showCopyResume:p,ownerPrincipalId:m,getCreatorDisplayName:v,getSessionDisplayName:w,parentSession:x}){const _=e.children.length>0,{isCollapsed:y,toggle:S}=e$(),C=!y(e.session.sessionId),k=g.useCallback(T=>{T.stopPropagation(),S(e.session.sessionId)},[S,e.session.sessionId]),N=_?h.jsx("button",{type:"button",onClick:k,"data-testid":`session-chevron-${e.session.sessionId}`,"aria-label":C?"collapse":"expand","aria-expanded":C,className:"shrink-0 flex items-center justify-center w-4 h-4 text-text-400 hover:text-text-100 cursor-pointer",children:C?h.jsx(Gn,{className:"w-3 h-3"}):h.jsx(On,{className:"w-3 h-3"})}):null;return h.jsxs("div",{"data-testid":`session-tree-node-${e.session.sessionId}`,children:[h.jsx(RW,{session:e.session,active:n===e.session.sessionId,hasUnread:(r==null?void 0:r.has(e.session.sessionId))??!1,running:(i==null?void 0:i.has(e.session.sessionId))??!1,awaitingUser:(s==null?void 0:s.has(e.session.sessionId))??!1,onSelect:()=>o(e.session.sessionId),onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,showCopyResume:p,ownerPrincipalId:m,creatorDisplayName:e.session.creatorPrincipalId?v==null?void 0:v(e.session.creatorPrincipalId):void 0,dispatchedFromSessionTitle:e.session.dispatchedFromSessionId?(w==null?void 0:w(e.session.dispatchedFromSessionId))??((x==null?void 0:x.sessionId)===e.session.dispatchedFromSessionId?ny(x):void 0):void 0,depth:t,chevron:N,contactDisplayName:e.session.originOwnerPrincipalId?f==null?void 0:f(e.session.originOwnerPrincipalId):void 0}),_&&C?h.jsx("div",{"data-testid":`session-tree-children-${e.session.sessionId}`,children:e.children.map(T=>h.jsx(Ey,{node:T,depth:t+1,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,getContactDisplayName:f,showCopyResume:p,ownerPrincipalId:m,getCreatorDisplayName:v,getSessionDisplayName:w,parentSession:e.session},T.session.sessionId))}):null]})}function MW(e){return e.forkedFromSessionId??e.dispatchedFromSessionId??e.shiftFiredFromSessionId}function FR(e){e=e.filter(s=>!s.ephemeral&&s.deployId===void 0);const t=new Map;for(const s of e)t.set(s.sessionId,s);const n=new Map,r=[];for(const s of e){const o=MW(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(AW).map(i)}function HR(e){return[...e].sort((t,n)=>t.session.updatedAt<n.session.updatedAt?1:t.session.updatedAt>n.session.updatedAt?-1:0)}function AW(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 jW(e){return e.appBuilderProject?`[app] ${e.appBuilderProject}`:e.label?e.label:e.aiLabel?e.aiLabel:e.cwd.split("/").filter(Boolean).pop()??""}function CS(e,t){const n=t.trim().toLowerCase();return n===""?!0:e.toLowerCase().includes(n)}const LW={isCollapsed:()=>!1,toggle:()=>{},prune:()=>{}};function DW({personas:e,activePersonaId:t,onSelectPersona:n,onCreateSession:r,sessions:i,activeSessionId:s,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,isPersonaExpanded:p,onTogglePersonaExpanded:m,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,searchQuery:y}){const[S,C]=g.useState(null),[k,N]=g.useState(()=>new Set),T=p??(L=>k.has(L)),z=g.useCallback(L=>{if(m){m(L);return}N($=>{const F=new Set($);return F.has(L)?F.delete(L):F.add(L),F})},[m]),P=g.useMemo(()=>i==null?void 0:i.filter(L=>!L.ephemeral),[i]),O=g.useMemo(()=>new Map((P??[]).map(L=>[L.sessionId,ny(L)])),[P]),M=g.useCallback(L=>f==null?void 0:f.get(L),[f]),R=g.useCallback(L=>O.get(L),[O]);if(e.length===0)return h.jsx(OW,{});const A=(y??"").trim();return A?h.jsx(X_.Provider,{value:LW,children:h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(L=>{const $=P?P.filter(E=>E.ownerPersonaId===L.personaId).sort((E,H)=>H.updatedAt>E.updatedAt?1:-1):[],F=CS(L.label,A),D=$.filter(E=>CS(jW(E),A));if(!F&&D.length===0)return null;const B=F?$:D;return h.jsx(ES,{persona:L,active:L.personaId===t,editing:!1,onSelectPersona:n,onSubmitCreateSession:()=>{},onCancelCreateSession:()=>{},personaSessions:B,collapsed:!1,onToggleCollapsed:()=>{},activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,getCreatorDisplayName:M,getSessionDisplayName:R},L.personaId)})})}):h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(L=>{const $=P?P.filter(F=>F.ownerPersonaId===L.personaId).sort((F,D)=>D.updatedAt>F.updatedAt?1:-1):[];return h.jsx(ES,{persona:L,active:L.personaId===t,editing:L.personaId===S,onSelectPersona:n,onStartCreateSession:r?()=>C(L.personaId):void 0,onSubmitCreateSession:F=>{C(null),r==null||r(L.personaId,F)},onCancelCreateSession:()=>C(null),personaSessions:$,collapsed:!T(L.personaId),onToggleCollapsed:()=>z(L.personaId),activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,getCreatorDisplayName:M,getSessionDisplayName:R},L.personaId)})})}function OW(){return h.jsx("div",{className:"px-3 py-3 text-[11px] leading-relaxed text-text-400",children:"还没有 persona。点上方 Personas 标题右侧 + 创建第一个。"})}function ES({persona:e,active:t,editing:n,onSelectPersona:r,onStartCreateSession:i,onSubmitCreateSession:s,onCancelCreateSession:o,personaSessions:a,collapsed:l,onToggleCollapsed:c,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,treatSessionsAsRoots:y,ownerPrincipalId:S,creatorDisplayNameByOwnerId:C,getCreatorDisplayName:k,getSessionDisplayName:N}){const T=a.length>0,z=!l,P=g.useMemo(()=>{const R=[],A=new Map;for(const L of a){const $=L.creatorPrincipalId;if(L.larkChatId!=null||!$||S&&$===S){R.push(L);continue}const F=$,D=(C==null?void 0:C.get(F))??`…${F.slice(-8)}`,B=A.get(F);B?B.sessions.push(L):A.set(F,{groupKey:F,displayName:D,sessions:[L]})}return{self:R,byPeer:[...A.values()]}},[a,S,C]),O=P.byPeer.length>0,M=g.useMemo(()=>z&&!O?HR(FR(a)):[],[z,O,a]);return h.jsxs("div",{"data-testid":`persona-node-${e.personaId}`,children:[h.jsxs("div",{className:re("group flex items-center gap-1 px-2 py-1.5 cursor-pointer",t?"bg-accent-dim text-text-100":"hover:bg-bg-200 text-text-200"),onClick:()=>r==null?void 0:r(e.personaId),role:"button",tabIndex:0,children:[T?h.jsx("button",{type:"button",onClick:R=>{R.stopPropagation(),c()},"aria-label":z?"collapse":"expand","aria-expanded":z,"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:z?h.jsx(Gn,{className:"h-3 w-3"}):h.jsx(On,{className:"h-3 w-3"})}):h.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),h.jsx(lp,{tool:e.tool,className:re("h-3.5 w-3.5 shrink-0",cp(e.tool))}),h.jsx("span",{className:"flex-1 truncate text-[13px]",children:e.label}),T?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:R=>{R.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(y8,{className:"h-3.5 w-3.5"})}):null]}),n?h.jsx(BW,{personaId:e.personaId,tool:e.tool,onSubmit:s,onCancel:o}):null,T&&z?h.jsx("div",{"data-testid":`persona-sessions-${e.personaId}`,children:O?h.jsxs(h.Fragment,{children:[P.self.length>0&&h.jsx(NS,{groupKey:`${e.personaId}-self`,label:"我自己",testId:`persona-sessions-${e.personaId}-self`,sessions:P.self,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:N}),P.byPeer.map(R=>h.jsx(NS,{groupKey:`${e.personaId}-peer-${R.groupKey}`,label:R.displayName,testId:`persona-sessions-${e.personaId}-peer-${R.groupKey}`,sessions:R.sessions,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:N},`${e.personaId}-peer-${R.groupKey}`))]}):M.map(R=>h.jsx(Ey,{node:R,depth:y?0:1,activeId:u,unreadIds:p,runningIds:f,awaitingIds:d,onSelect:A=>m==null?void 0:m(A),onDelete:v,onEdit:w,onPin:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:N},R.session.sessionId))}):null]})}function NS({label:e,testId:t,sessions:n,activeSessionId:r,awaitingIds:i,runningIds:s,unreadIds:o,onSelectSession:a,onDeleteSession:l,onEditSession:c,onPinSession:u,showCopyResume:d,ownerPrincipalId:f,getCreatorDisplayName:p,getSessionDisplayName:m}){const[v,w]=g.useState(!1),x=!v,_=g.useMemo(()=>x?HR(FR(n)):[],[x,n]);return h.jsxs("div",{"data-testid":t,children:[h.jsxs("button",{type:"button",onClick:()=>w(y=>!y),"aria-label":x?"collapse":"expand","aria-expanded":x,"data-testid":`${t}-chevron`,className:"flex items-center gap-1 w-full pl-7 pr-2 py-0.5 text-[11px] text-text-400 hover:text-text-200 transition-colors",children:[x?h.jsx(Gn,{className:"h-3 w-3"}):h.jsx(On,{className:"h-3 w-3"}),h.jsx(wI,{className:"h-3 w-3","aria-hidden":!0}),h.jsx("span",{className:"truncate",children:e}),h.jsx("span",{className:"ml-auto tabular-nums",children:n.length})]}),x&&h.jsx("div",{children:_.map(y=>h.jsx(Ey,{node:y,depth:2,activeId:r,unreadIds:o,runningIds:s,awaitingIds:i,onSelect:S=>a==null?void 0:a(S),onDelete:l,onEdit:c,onPin:u,showCopyResume:d,ownerPrincipalId:f,getCreatorDisplayName:p,getSessionDisplayName:m},y.session.sessionId))})]})}function BW({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=Tu(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(lp,{tool:t,className:re("h-3 w-3 shrink-0",cp(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(xl,{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(Tr,{className:"h-3 w-3"})})]})}function zW(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function $W(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),r=parseFloat(n.fontSize);return t*r}function FW(e){return e/100*window.innerHeight}function HW(e){return e/100*window.innerWidth}function UW(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 tc({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,s]=UW(n);switch(s){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=$W(t,i);break}case"em":{r=zW(t,i);break}case"vh":{r=FW(i);break}case"vw":{r=HW(i);break}}return r}function Rn(e){return parseFloat(e.toFixed(3))}function Ya({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 I0(e){const{panels:t}=e,n=Ya({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=tc({groupSize:n,panelElement:i,styleProp:s.collapsedSize});o=Rn(u/n*100)}let a;if(s.defaultSize!==void 0){const u=tc({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=Rn(u/n*100)}let l=0;if(s.minSize!==void 0){const u=tc({groupSize:n,panelElement:i,styleProp:s.minSize});l=Rn(u/n*100)}let c=100;if(s.maxSize!==void 0){const u=tc({groupSize:n,panelElement:i,styleProp:s.maxSize});c=Rn(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 st(e,t="Assertion error"){if(!e)throw Error(t)}function P0(e,t){return Array.from(t).sort(e==="horizontal"?WW:VW)}function WW(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function VW(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 WR(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 qW({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}=WR(r,o),c=e==="horizontal"?a:l;c<s&&(s=c,i=o)}return st(i,"No rect found"),i}let wd;function KW(){return wd===void 0&&(typeof matchMedia=="function"?wd=!!matchMedia("(pointer:coarse)").matches:wd=!1),wd}function VR(e){const{element:t,orientation:n,panels:r,separators:i}=e,s=P0(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 w=r.find(x=>x.element===v);if(w){if(f){const x=f.element.getBoundingClientRect(),_=v.getBoundingClientRect();let y;if(l){const S=n==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),C=n==="horizontal"?new DOMRect(_.left,_.top,0,_.height):new DOMRect(_.left,_.top,_.width,0);switch(p.length){case 0:{y=[S,C];break}case 1:{const k=p[0],N=qW({orientation:n,rects:[x,_],targetRect:k.element.getBoundingClientRect()});y=[k,N===x?C:S];break}default:{y=p;break}}}else p.length?y=p:y=[n==="horizontal"?new DOMRect(x.right,_.top,_.left-x.right,_.height):new DOMRect(_.left,x.bottom,_.width,_.top-x.bottom)];for(const S of y){let C="width"in S?S:S.element.getBoundingClientRect();const k=KW()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(C.width<k){const T=k-C.width;C=new DOMRect(C.x-T/2,C.y,C.width+T,C.height)}if(C.height<k){const T=k-C.height;C=new DOMRect(C.x,C.y-T/2,C.width,C.height+T)}const N=m<=c||m>u;!a&&!N&&o.push({group:e,groupSize:Ya({group:e}),panels:[f,w],separator:"width"in S?void 0:S,rect:C}),a=!1}}l=!1,f=w,p=[]}}else if(v.hasAttribute("data-separator")){v.ariaDisabled!==null&&(a=!0);const w=i.find(x=>x.element===v);w?p.push(w):(f=void 0,p=[])}else l=!0}return o}var _s;class qR{constructor(){T1(this,_s,{})}addListener(t,n){const r=Tl(this,_s)[t];return r===void 0?Tl(this,_s)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=Tl(this,_s)[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(){I1(this,_s,{})}removeListener(t,n){const r=Tl(this,_s)[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}_s=new WeakMap;let Aa={cursorFlags:0,state:"inactive"};const Ny=new qR;function Io(){return Aa}function GW(e){return Ny.addListener("change",e)}function XW(e){const t=Aa,n={...Aa};n.cursorFlags=e,Aa=n,Ny.emit("change",{prev:t,next:n})}function ja(e){const t=Aa;Aa=e,Ny.emit("change",{prev:t,next:e})}const YW=e=>e,qm=()=>{},KR=1,GR=2,XR=4,YR=8,TS=3,IS=12;let Sd;function PS(){return Sd===void 0&&(Sd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Sd=!0)),Sd}function QW({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&&PS()){const s=(e&KR)!==0,o=(e&GR)!==0,a=(e&XR)!==0,l=(e&YR)!==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 PS()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}const RS=new WeakMap;function Ty(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=RS.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=Io();switch(r.state){case"active":case"hover":{const i=QW({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}}RS.set(e,{prevStyle:t,styleSheet:n})}let ii=new Map;const QR=new qR;function ZW(e){ii=new Map(ii),ii.delete(e)}function MS(e,t){for(const[n]of ii)if(n.id===e)return n}function As(e,t){for(const[n,r]of ii)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Uo(){return ii}function Iy(e,t){return QR.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Ki(e,t,n){const r=ii.get(e);ii=new Map(ii),ii.set(e,t),QR.emit("groupChange",{group:e,isUserInteraction:(n==null?void 0:n.isUserInteraction)===!0,prev:r,next:t})}function ZR(e){const t=Io();let n=!1;switch(t.state){case"active":ja({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Ty(e),n=!0,t.hitRegions.forEach(r=>{const i=As(r.group.id,!0);Ki(r.group,i,{isUserInteraction:!0})}))}return n}function AS(e){e.defaultPrevented||ZR(e.currentTarget)}function JW(e,t,n){let r,i={x:1/0,y:1/0};for(const s of t){const o=WR(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 eV(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function tV(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:DS(e),b:DS(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();st(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:LS(jS(n.a)),b:LS(jS(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 nV=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function rV(e){const t=getComputedStyle(JR(e)??e).display;return t==="flex"||t==="inline-flex"}function iV(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||rV(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"||nV.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function jS(e){let t=e.length;for(;t--;){const n=e[t];if(st(n,"Missing node"),iV(n))return n}return null}function LS(e){return e&&Number(getComputedStyle(e).zIndex)||0}function DS(e){const t=[];for(;e;)t.push(e),e=JR(e);return t}function JR(e){const{parentNode:t}=e;return eV(t)?t.host:t}function sV(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 oV({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!UR(n)||n.contains(e)||e.contains(n))return!0;if(tV(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(sV(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Py(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const s=VR(i),o=JW(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=0&&o.distance.y<=0&&oV({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function aV(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 bn(e,t,n=0){return Math.abs(Rn(e)-Rn(t))<=n}function ei(e,t){return bn(e,t)?0:e>t?1:-1}function wa({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(ei(r,l)<0)if(s){const c=(i+l)/2;ei(r,c)<0?r=i:r=l}else r=l;return r=Math.min(a,r),r=Rn(r),r}function su({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:s}){if(bn(e,0))return t;const o=s==="imperative-api",a=Object.values(t),l=Object.values(i),c=[...a],[u,d]=r;st(u!=null,"Invalid first pivot index"),st(d!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const v=e<0?d:u,w=n[v];st(w,`Panel constraints not found for index ${v}`);const{collapsedSize:x=0,collapsible:_,minSize:y=0}=w;if(_){const S=a[v];if(st(S!=null,`Previous layout not found for panel index ${v}`),bn(S,x)){const C=y-S;ei(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}{const v=e<0?u:d,w=n[v];st(w,`No panel constraints found for index ${v}`);const{collapsedSize:x=0,collapsible:_,minSize:y=0}=w;if(_){const S=a[v];if(st(S!=null,`Previous layout not found for panel index ${v}`),bn(S,y)){const C=S-x;ei(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}break}default:{const v=e<0?d:u,w=n[v];st(w,`Panel constraints not found for index ${v}`);const x=a[v],{collapsible:_,collapsedSize:y,minSize:S}=w;if(_&&ei(x,S)<0)if(e>0){const C=S-y,k=C/2,N=x+e;ei(N,S)<0&&(e=ei(e,k)<=0?0:C)}else{const C=S-y,k=100-C/2,N=x-e;ei(N,S)<0&&(e=ei(100+e,k)>0?0:-C)}break}}{const v=e<0?1:-1;let w=e<0?d:u,x=0;for(;;){const y=a[w];st(y!=null,`Previous layout not found for panel index ${w}`);const S=wa({overrideDisabledPanels:o,panelConstraints:n[w],prevSize:y,size:100})-y;if(x+=S,w+=v,w<0||w>=n.length)break}const _=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-_:_}{let v=e<0?u:d;for(;v>=0&&v<n.length;){const w=Math.abs(e)-Math.abs(f),x=a[v];st(x!=null,`Previous layout not found for panel index ${v}`);const _=x-w,y=wa({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:x,size:_});if(!bn(x,y)&&(f+=x-y,c[v]=y,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if(aV(l,c))return i;{const v=e<0?d:u,w=a[v];st(w!=null,`Previous layout not found for panel index ${v}`);const x=w+f,_=wa({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:w,size:x});if(c[v]=_,!bn(_,x)){let y=x-_,S=e<0?d:u;for(;S>=0&&S<n.length;){const C=c[S];st(C!=null,`Previous layout not found for panel index ${S}`);const k=C+y,N=wa({overrideDisabledPanels:o,panelConstraints:n[S],prevSize:C,size:k});if(bn(C,N)||(y-=N-C,c[S]=N),bn(y,0))break;e>0?S--:S++}}}const p=Object.values(c).reduce((v,w)=>w+v,0);if(!bn(p,100,.1))return i;const m=Object.keys(i);return c.reduce((v,w,x)=>(v[m[x]]=w,v),{})}function Po(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||ei(e[n],t[n])!==0)return!1;return!0}function Ro({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(!bn(i,100)&&r.length>0)for(let a=0;a<t.length;a++){const l=r[a];st(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];st(l!=null,`No layout data found for index ${a}`);const c=r[a];st(c!=null,`No layout data found for index ${a}`);const u=wa({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});c!=u&&(s+=c-u,r[a]=u)}if(!bn(s,0))for(let a=0;a<t.length;a++){const l=r[a];st(l!=null,`No layout data found for index ${a}`);const c=l+s,u=wa({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});if(l!==u&&(s-=u-l,r[a]=u,bn(s,0)))break}const o=Object.keys(e);return r.reduce((a,l,c)=>(a[o[c]]=l,a),{})}function e5({groupId:e,panelId:t}){const n=()=>{const l=Uo();for(const[c,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:p,separatorToPanels:m}]of l)if(c.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:c,groupSize:p,layout:f,separatorToPanels:m};throw Error(`Group ${e} not found`)},r=()=>{const l=n().derivedPanelConstraints.find(c=>c.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const l=n().group.panels.find(c=>c.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const l=n().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:l,panels:c,prevLayout:u,derivedPanelConstraints:d})=>{const f=s(),p=c.findIndex(w=>w.id===t),m=p===0,v=p===c.length-1;if(v&&l<f&&(m||c.slice(0,p).every((w,x)=>{const _=d[x];return(_==null?void 0:_.collapsible)&&bn(_.collapsedSize,u[_.panelId])}))){const w=c.slice(0,p).reduce((x,_)=>x+u[_.id],0);return{...u,[t]:Rn(100-w)}}return su({delta:v?f-l:l-f,initialLayout:u,panelConstraints:d,pivotIndices:v?[p-1,p]:[p,p+1],prevLayout:u,trigger:"imperative-api"})},a=l=>{const c=s();if(l===c)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:p,layout:m,separatorToPanels:v}=n(),w=o({nextSize:l,panels:f.panels,prevLayout:m,derivedPanelConstraints:d}),x=Ro({layout:w,panelConstraints:d});Po(m,x)||Ki(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:p,layout:x,separatorToPanels:v})};return{collapse:()=>{const{collapsible:l,collapsedSize:c}=r(),{mutableValues:u}=i(),d=s();l&&d!==c&&(u.expandToSize=d,a(c))},expand:()=>{const{collapsible:l,collapsedSize:c,minSize:u}=r(),{mutableValues:d}=i(),f=s();if(l&&f===c){let p=d.expandToSize??u;p===0&&(p=1),a(p)}},getSize:()=>{const{group:l}=n(),c=s(),{element:u}=i(),d=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:c,inPixels:d}},isCollapsed:()=>{const{collapsible:l,collapsedSize:c}=r(),u=s();return l&&bn(c,u)},resize:l=>{const{group:c}=n(),{element:u}=i(),d=Ya({group:c}),f=tc({groupSize:d,panelElement:u,styleProp:l}),p=Rn(f/d*100);a(p)}}}function OS(e){if(e.defaultPrevented)return;const t=Uo();Py(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=e5({groupId:n.group.id,panelId:r.id});s&&i!==void 0&&(s.resize(i),e.preventDefault())}}})}function ih(e){const t=Uo();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 t5({groupId:e}){const t=()=>{const n=Uo();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=Ro({layout:n,panelConstraints:i});return r?a:(Po(a,c)||Ki(s,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:o,layout:c,separatorToPanels:l}),c)}}}function eo(e,t){const n=ih(e),r=As(n.id,!0),i=n.separators.find(u=>u.element===e);st(i,"Matching separator not found");const s=r.separatorToPanels.get(i);st(s,"Matching panels not found");const o=s.map(u=>n.panels.indexOf(u)),a=t5({groupId:n.id}).getLayout(),l=su({delta:t,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:a,trigger:"keyboard"}),c=Ro({layout:l,panelConstraints:r.derivedPanelConstraints});Po(a,c)||Ki(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function BS(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=ih(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&eo(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&eo(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&eo(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&eo(t,-5);break}case"End":{e.preventDefault(),eo(t,100);break}case"Enter":{e.preventDefault();const r=ih(t),i=As(r.id,!0),{derivedPanelConstraints:s,layout:o,separatorToPanels:a}=i,l=r.separators.find(f=>f.element===t);st(l,"Matching separator not found");const c=a.get(l);st(c,"Matching panels not found");const u=c[0],d=s.find(f=>f.panelId===u.id);if(st(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;eo(t,p-f)}break}case"F6":{e.preventDefault();const r=ih(t).separators.map(o=>o.element),i=Array.from(r).findIndex(o=>o===e.currentTarget);st(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(),eo(t,-100);break}}}function zS(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Uo(),n=Py(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)}),ja({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function n5({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:s,prevCursorFlags:o}){let a=0;n.forEach(c=>{const{group:u,groupSize:d}=c,{orientation:f,panels:p}=u,{disableCursor:m}=u.mutableState;let v=0;s?f==="horizontal"?v=(t.clientX-s.x)/d*100:v=(t.clientY-s.y)/d*100:f==="horizontal"?v=t.clientX<0?-100:100:v=t.clientY<0?-100:100;const w=r.get(u),x=i.get(u);if(!w||!x)return;const{defaultLayoutDeferred:_,derivedPanelConstraints:y,groupSize:S,layout:C,separatorToPanels:k}=x;if(y&&C&&k){const N=su({delta:v,initialLayout:w,panelConstraints:y,pivotIndices:c.panels.map(T=>p.indexOf(T)),prevLayout:C,trigger:"mouse-or-touch"});if(Po(N,C)){if(v!==0&&!m)switch(f){case"horizontal":{a|=v<0?KR:GR;break}case"vertical":{a|=v<0?XR:YR;break}}}else Ki(c.group,{defaultLayoutDeferred:_,derivedPanelConstraints:y,groupSize:S,layout:N,separatorToPanels:k})}});let l=0;t.movementX===0?l|=o&TS:l|=a&TS,t.movementY===0?l|=o&IS:l|=a&IS,XW(l),Ty(e)}function $S(e){const t=Uo(),n=Io();switch(n.state){case"active":n5({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function FS(e){var r,i;if(e.defaultPrevented)return;const t=Io(),n=Uo();switch(t.state){case"active":{if(e.buttons===0){ja({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{const o=As(s.group.id,!0);Ki(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))}n5({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=Py(e,n);s.length===0?t.state!=="inactive"&&ja({cursorFlags:0,state:"inactive"}):ja({cursorFlags:0,hitRegions:s,state:"hover"}),Ty(e.currentTarget);break}}}function HS(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Io().state){case"hover":ja({cursorFlags:0,state:"inactive"})}}function US(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||ZR(e.currentTarget)&&e.preventDefault()}function WS(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const o=Rn(s.defaultSize);n+=o,r[s.panelId]=o}else r[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=Rn((100-n)/i);for(const o of e)o.defaultSize===void 0&&(r[o.panelId]=s)}return r}function lV(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const i=Ya({group:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,a={asPercentage:Rn(s/i*100),inPixels:s};r.mutableValues.prevSize=a,r.onResize(a,r.id,o)}function cV(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 uV({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=Rn(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]=Rn(f/s*c)}else{const d=Rn(c/l.length);for(const f of l)u[f]=d}return u}function dV(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 ta=new Map;function hV(e){let t=!0;st(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,s=new n(m=>{for(const v of m){const{borderBoxSize:w,target:x}=v;if(x===e.element){if(t){const _=Ya({group:e});if(_===0)return;const y=As(e.id);if(!y)return;const S=I0(e),C=y.defaultLayoutDeferred?WS(S):y.layout,k=uV({group:e,nextGroupSize:_,prevGroupSize:y.groupSize,prevLayout:C}),N=Ro({layout:k,panelConstraints:S});if(!y.defaultLayoutDeferred&&Po(y.layout,N)&&cV(y.derivedPanelConstraints,S)&&y.groupSize===_)return;Ki(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:_,layout:N,separatorToPanels:y.separatorToPanels})}}else lV(e,x,w)}});s.observe(e.element),e.panels.forEach(m=>{st(!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=Ya({group:e}),a=I0(e),l=e.panels.map(({id:m})=>m).join(",");let c=e.mutableState.defaultLayout;c&&(dV(e.panels,c)||(c=void 0));const u=e.mutableState.layouts[l]??c??WS(a),d=Ro({layout:u,panelConstraints:a}),f=e.element.ownerDocument;ta.set(f,(ta.get(f)??0)+1);const p=new Map;return VR(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),Ki(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:a,groupSize:o,layout:d,separatorToPanels:p}),e.separators.forEach(m=>{st(!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",BS)}),ta.get(f)===1&&(f.addEventListener("contextmenu",AS,!0),f.addEventListener("dblclick",OS,!0),f.addEventListener("pointerdown",zS,!0),f.addEventListener("pointerleave",$S),f.addEventListener("pointermove",FS),f.addEventListener("pointerout",HS),f.addEventListener("pointerup",US,!0)),function(){t=!1,ta.set(f,Math.max(0,(ta.get(f)??0)-1)),ZW(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",BS)}),ta.get(f)||(f.removeEventListener("contextmenu",AS,!0),f.removeEventListener("dblclick",OS,!0),f.removeEventListener("pointerdown",zS,!0),f.removeEventListener("pointerleave",$S),f.removeEventListener("pointermove",FS),f.removeEventListener("pointerout",HS),f.removeEventListener("pointerup",US,!0)),s.disconnect()}}function fV(){const[e,t]=g.useState({}),n=g.useCallback(()=>t({}),[]);return[e,n]}function Ry(e){const t=g.useId();return`${e??t}`}const Wo=typeof window<"u"?g.useLayoutEffect:g.useEffect;function bc(e){const t=g.useRef(e);return Wo(()=>{t.current=e},[e]),g.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function My(...e){return bc(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Ay(e){const t=g.useRef({...e});return Wo(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const r5=g.createContext(null);function pV(e,t){const n=g.useRef({getLayout:()=>({}),setLayout:YW});g.useImperativeHandle(t,()=>n.current,[]),Wo(()=>{Object.assign(n.current,t5({groupId:e}))})}function jy({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=bc(O=>{Po(m.current.onLayoutChange,O)||(m.current.onLayoutChange=O,l==null||l(O))}),w=bc((O,M)=>{Po(m.current.onLayoutChanged,O)||(m.current.onLayoutChanged=O,c==null||c(O,{isUserInteraction:M}))}),x=Ry(a),_=g.useRef(null),[y,S]=fV(),C=g.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),k=My(_,s);pV(x,o);const N=bc((O,M)=>{const R=Io(),A=MS(O),L=As(O);if(L){let $=!1;switch(R.state){case"active":{$=R.hitRegions.some(F=>F.group===A);break}}return{flexGrow:L.layout[M]??1,pointerEvents:$?"none":void 0}}if(n!=null&&n[M])return{flexGrow:n==null?void 0:n[M]}}),T=Ay({defaultLayout:n,disableCursor:r}),z=g.useMemo(()=>({get disableCursor(){return!!T.disableCursor},getPanelStyles:N,id:x,orientation:u,registerPanel:O=>{const M=C.current;return M.panels=P0(u,[...M.panels,O]),S(),()=>{M.panels=M.panels.filter(R=>R!==O),S()}},registerSeparator:O=>{const M=C.current;return M.separators=P0(u,[...M.separators,O]),S(),()=>{M.separators=M.separators.filter(R=>R!==O),S()}},updatePanelProps:(O,{disabled:M})=>{const R=C.current.panels.find($=>$.id===O);R&&(R.panelConstraints.disabled=M);const A=MS(x),L=As(x);A&&L&&Ki(A,{...L,derivedPanelConstraints:I0(A)})},updateSeparatorProps:(O,{disabled:M,disableDoubleClick:R})=>{const A=C.current.separators.find(L=>L.id===O);A&&(A.disabled=M,A.disableDoubleClick=R)}}),[N,x,S,u,T]),P=g.useRef(null);return Wo(()=>{const O=_.current;if(O===null)return;const M=C.current;let R;if(T.defaultLayout!==void 0&&Object.keys(T.defaultLayout).length===M.panels.length){R={};for(const E of M.panels){const H=T.defaultLayout[E.id];H!==void 0&&(R[E.id]=H)}}const A={disabled:!!i,element:O,id:x,mutableState:{defaultLayout:R,disableCursor:!!T.disableCursor,expandedPanelSizes:C.current.lastExpandedPanelSizes,layouts:C.current.layouts},orientation:u,panels:M.panels,resizeTargetMinimumSize:M.resizeTargetMinimumSize,separators:M.separators};P.current=A;const L=hV(A),{defaultLayoutDeferred:$,derivedPanelConstraints:F,layout:D}=As(A.id,!0);!$&&F.length>0&&(v(D),w(D,!1));const B=Iy(x,E=>{const{defaultLayoutDeferred:H,derivedPanelConstraints:q,layout:j}=E.next;if(H||q.length===0)return;const ne=A.panels.map(({id:K})=>K).join(",");A.mutableState.layouts[ne]=j,q.forEach(K=>{if(K.collapsible){const{layout:_e}=E.prev??{};if(_e){const Re=bn(K.collapsedSize,j[K.panelId]),ce=bn(K.collapsedSize,_e[K.panelId]);Re&&!ce&&(A.mutableState.expandedPanelSizes[K.panelId]=_e[K.panelId])}}});const ie=Io().state!=="active";v(j),ie&&w(j,E.isUserInteraction)});return()=>{P.current=null,L(),B()}},[i,x,w,v,u,y,T]),g.useEffect(()=>{const O=P.current;O&&(O.mutableState.defaultLayout=n,O.mutableState.disableCursor=!!r)}),h.jsx(r5.Provider,{value:z,children:h.jsx("div",{...p,className:t,"data-group":!0,"data-testid":x,id:x,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:e})})}jy.displayName="Group";function Ly(){const e=g.useContext(r5);return st(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function mV(e,t){const{id:n}=Ly(),r=g.useRef({collapse:qm,expand:qm,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:qm});g.useImperativeHandle(t,()=>r.current,[]),Wo(()=>{Object.assign(r.current,e5({groupId:n,panelId:e}))})}function af({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:s,elementRef:o,groupResizeBehavior:a="preserve-relative-size",id:l,maxSize:c="100%",minSize:u="0%",onResize:d,panelRef:f,style:p,...m}){const v=!!l,w=Ry(l),x=Ay({disabled:s}),_=g.useRef(null),y=My(_,o),{getPanelStyles:S,id:C,orientation:k,registerPanel:N,updatePanelProps:T}=Ly(),z=d!==null,P=bc((A,L,$)=>{d==null||d(A,l,$)});Wo(()=>{const A=_.current;if(A!==null){const L={element:A,id:w,idIsStable:v,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:z?P:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:i,disabled:x.disabled,maxSize:c,minSize:u}};return N(L)}},[a,n,r,i,z,w,v,c,u,P,N,x]),g.useEffect(()=>{T(w,{disabled:s})},[s,w,T]),mV(w,f);const O=()=>{const A=S(C,w);if(A)return JSON.stringify(A)},M=g.useSyncExternalStore(A=>Iy(C,A),O,O);let R;return M?R=JSON.parse(M):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":w,id:w,ref:y,style:{...gV,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:k==="horizontal"?"pan-y":"pan-x"},children:e})})}af.displayName="Panel";const gV={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function vV({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=Ro({layout:su({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Ro({layout:su({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:o}}function i5({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:s,style:o,...a}){const l=Ry(s),c=Ay({disabled:n,disableDoubleClick:r}),[u,d]=g.useState({}),[f,p]=g.useState("inactive"),[m,v]=g.useState(!1),w=g.useRef(null),x=My(w,i),{disableCursor:_,id:y,orientation:S,registerSeparator:C,updateSeparatorProps:k}=Ly(),N=S==="horizontal"?"vertical":"horizontal";Wo(()=>{const P=w.current;if(P!==null){const O={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:P,id:l},M=C(O),R=GW(L=>{p(L.next.state!=="inactive"&&L.next.hitRegions.some($=>$.separator===O)?L.next.state:"inactive")}),A=Iy(y,L=>{const{derivedPanelConstraints:$,layout:F,separatorToPanels:D}=L.next,B=D.get(O);if(B){const E=B[0],H=B.indexOf(E);d(vV({layout:F,panelConstraints:$,panelId:E.id,panelIndex:H}))}});return()=>{R(),A(),M()}}},[y,l,C,c]),g.useEffect(()=>{k(l,{disabled:n,disableDoubleClick:r})},[n,r,l,k]);let T;n&&!_&&(T="not-allowed");let z;if(n)z="disabled";else switch(f){case"active":{z="active";break}default:m?z="focus":z=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":z,"data-testid":l,id:l,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:x,role:"separator",style:{flexBasis:"auto",cursor:T,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}i5.displayName="Separator";function xV(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 _V(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 yV=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function bV(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(yV);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 wV=["TaskCreate","TaskUpdate","TaskList","TaskGet"];function SV(e){return wV.includes(e)}function s5(e){return e==="in_progress"||e==="completed"?e:"pending"}function kV(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:s5(n.status),activeForm:i,description:s}]}function CV(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=s5(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 EV(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=kV(t,i.input);break;case"TaskUpdate":t=CV(t,i.input);break}}return{tasks:t,lastEventIndex:n}}function o5(e){var n;if(e.error)return!1;if(e.pending)return!0;if(e.notifications.length>0)return!1;const t=(n=e.progress)==null?void 0:n.status;return t==="running"?!0:t==="started"?NV(e.input):!1}function NV(e){return!e||typeof e!="object"?!1:e.run_in_background===!0}function TV(e){return e.filter(t=>t.kind==="merged-agent"&&o5(t))}function a5(e){const{tasks:t,lastEventIndex:n}=EV(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,v,w;if(((f=c.progress)==null?void 0:f.status)==="completed"||((p=c.progress)==null?void 0:p.status)==="failed")return;const d={agentId:u.agentId,status:u.status};u.description?d.description=u.description:(m=c.progress)!=null&&m.description&&(d.description=c.progress.description),u.lastToolName?d.lastToolName=u.lastToolName:(v=c.progress)!=null&&v.lastToolName&&(d.lastToolName=c.progress.lastToolName),u.stats?d.stats=u.stats:(w=c.progress)!=null&&w.stats&&(d.stats=c.progress.stats),c.progress=d,(u.status==="completed"||u.status==="failed")&&(c.pending=!1)};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}const f=a.get(u.toolUseId);if((f==null?void 0:f.status)==="completed"||(f==null?void 0:f.status)==="failed")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 IV=new Set(["permission-inline","question-card"]);function PV(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||rp(e.metaKind)}function RV(e){return e.kind==="user-text"&&e.continuesTurn===!0}function MV(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(AV(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,!0);continue}if(PV(s)&&(r===null||!RV(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 AV(e,t,n){const{query:r,body:i}=e,s=jV(i,t,n),o=LV(i,s),a=OV(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 jV(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=R0(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function LV(e,t){if(t==="running"){const r=[];for(let i=e.length-1;i>=0&&IV.has(e[i].kind);i--)r.unshift(e[i]);return r}const n=t==="error"?R0(e,r=>r.kind==="error"):R0(e,r=>r.kind==="assistant-text");return n>=0?[e[n]]:[]}const DV=new Set(["assistant-thinking","user-meta"]);function OV(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(DV.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function R0(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const BV={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function zV(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 l5(e){const t=BV[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=zV(e.input);return r?`${n} ${r}`:n}function $V({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?Gn:On,s=n?(t==null?void 0:t(e))??null:null;return h.jsxs("div",{className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,"data-testid":"tool-call-group-row",className:re("flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] hover:text-text-200",e.error?"text-destructive/80":"text-text-400"),children:[e.pending?h.jsx(jn,{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:l5(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 FV({items:e,renderItemDetail:t}){const[n,r]=g.useState(!1);if(e.length===0)return null;const i=e.some(l=>l.pending),s=i?[...e].reverse().find(l=>l.pending):e[e.length-1],o=!i&&e.length>1?` 等 ${e.length} 项`:"",a=n?Gn:On;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(l=>!l),"aria-expanded":n,"data-testid":"tool-call-group-header",className:"flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] text-text-400 hover:text-text-200",children:[i&&!n?h.jsx(jn,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"}),n?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:i?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:re("truncate min-w-0",i&&"text-text-300"),children:[l5(s),o]})]}),n?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(l=>h.jsx($V,{item:l,renderItemDetail:t},l.toolUseId))}):null]})}function HV(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 UV(e,t){const n=t!==void 0?`耗时 ${HV(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function WV({status:e="done",durationMs:t,defaultExpanded:n=!1,children:r}){const[i,s]=g.useState(n),o=i?Gn:On;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:re("flex w-full items-center gap-1 text-left cursor-pointer min-w-0 py-0.5 text-[13px]",e!=="done"?"text-destructive/80 hover:text-destructive":"text-text-400 hover:text-text-200"),children:[h.jsx("span",{className:"truncate min-w-0",children:UV(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 VV=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,qV=/<builder-preview\b[^>]*\/>/gi,KV=/<(clawd-dispatch-task|clawd-dispatch-result)\b[^>]*>([\s\S]*?)<\/\1>/gi,GV=/<\/?(brief|detail|files)>/gi;function c5(e){return e?e.replace(KV,(t,n,r)=>iz(r.replace(GV,"")).trim()).replace(VV,"").replace(qV,"").trim():""}const XV=c5;function YV(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const QV=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ZV=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,JV={};function VS(e,t){return(JV.jsx?ZV:QV).test(e)}const eq=/[ \t\n\f\r]/g;function tq(e){return typeof e=="object"?e.type==="text"?qS(e.value):!1:qS(e)}function qS(e){return e.replace(eq,"")===""}class Pu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Pu.prototype.normal={};Pu.prototype.property={};Pu.prototype.space=void 0;function u5(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Pu(n,r,t)}function M0(e){return e.toLowerCase()}class Xn{constructor(t,n){this.attribute=n,this.property=t}}Xn.prototype.attribute="";Xn.prototype.booleanish=!1;Xn.prototype.boolean=!1;Xn.prototype.commaOrSpaceSeparated=!1;Xn.prototype.commaSeparated=!1;Xn.prototype.defined=!1;Xn.prototype.mustUseProperty=!1;Xn.prototype.number=!1;Xn.prototype.overloadedBoolean=!1;Xn.prototype.property="";Xn.prototype.spaceSeparated=!1;Xn.prototype.space=void 0;let nq=0;const je=Vo(),Bt=Vo(),A0=Vo(),Q=Vo(),lt=Vo(),La=Vo(),Jn=Vo();function Vo(){return 2**++nq}const j0=Object.freeze(Object.defineProperty({__proto__:null,boolean:je,booleanish:Bt,commaOrSpaceSeparated:Jn,commaSeparated:La,number:Q,overloadedBoolean:A0,spaceSeparated:lt},Symbol.toStringTag,{value:"Module"})),Km=Object.keys(j0);class Dy extends Xn{constructor(t,n,r,i){let s=-1;if(super(t,n),KS(this,"space",i),typeof r=="number")for(;++s<Km.length;){const o=Km[s];KS(this,Km[s],(r&j0[o])===j0[o])}}}Dy.prototype.defined=!0;function KS(e,t,n){n&&(e[t]=n)}function bl(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Dy(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[M0(r)]=r,n[M0(s.attribute)]=r}return new Pu(t,n,e.space)}const d5=bl({properties:{ariaActiveDescendant:null,ariaAtomic:Bt,ariaAutoComplete:null,ariaBusy:Bt,ariaChecked:Bt,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:lt,ariaCurrent:null,ariaDescribedBy:lt,ariaDetails:null,ariaDisabled:Bt,ariaDropEffect:lt,ariaErrorMessage:null,ariaExpanded:Bt,ariaFlowTo:lt,ariaGrabbed:Bt,ariaHasPopup:null,ariaHidden:Bt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:lt,ariaLevel:Q,ariaLive:null,ariaModal:Bt,ariaMultiLine:Bt,ariaMultiSelectable:Bt,ariaOrientation:null,ariaOwns:lt,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:Bt,ariaReadOnly:Bt,ariaRelevant:null,ariaRequired:Bt,ariaRoleDescription:lt,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:Bt,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 h5(e,t){return t in e?e[t]:t}function f5(e,t){return h5(e,t.toLowerCase())}const rq=bl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:La,acceptCharset:lt,accessKey:lt,action:null,allow:null,allowFullScreen:je,allowPaymentRequest:je,allowUserMedia:je,alt:null,as:null,async:je,autoCapitalize:null,autoComplete:lt,autoFocus:je,autoPlay:je,blocking:lt,capture:null,charSet:null,checked:je,cite:null,className:lt,cols:Q,colSpan:null,content:null,contentEditable:Bt,controls:je,controlsList:lt,coords:Q|La,crossOrigin:null,data:null,dateTime:null,decoding:null,default:je,defer:je,dir:null,dirName:null,disabled:je,download:A0,draggable:Bt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:je,formTarget:null,headers:lt,height:Q,hidden:A0,high:Q,href:null,hrefLang:null,htmlFor:lt,httpEquiv:lt,id:null,imageSizes:null,imageSrcSet:null,inert:je,inputMode:null,integrity:null,is:null,isMap:je,itemId:null,itemProp:lt,itemRef:lt,itemScope:je,itemType:lt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:je,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:je,muted:je,name:null,nonce:null,noModule:je,noValidate:je,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:je,optimum:Q,pattern:null,ping:lt,placeholder:null,playsInline:je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:je,referrerPolicy:null,rel:lt,required:je,reversed:je,rows:Q,rowSpan:Q,sandbox:lt,scope:null,scoped:je,seamless:je,selected:je,shadowRootClonable:je,shadowRootDelegatesFocus:je,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:Bt,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:je,useMap:null,value:Bt,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:lt,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:je,declare:je,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:je,noHref:je,noShade:je,noWrap:je,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:Bt,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:je,disableRemotePlayback:je,prefix:null,property:null,results:Q,security:null,unselectable:null},space:"html",transform:f5}),iq=bl({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:Jn,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:lt,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:je,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:La,g2:La,glyphName:La,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:Jn,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:lt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Jn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Jn,rev:Jn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Jn,requiredFeatures:Jn,requiredFonts:Jn,requiredFormats:Jn,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:Jn,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:Jn,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:Jn,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:h5}),p5=bl({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()}}),m5=bl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:f5}),g5=bl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),sq={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"},oq=/[A-Z]/g,GS=/-[a-z]/g,aq=/^data[-\w.:]+$/i;function lq(e,t){const n=M0(t);let r=t,i=Xn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&aq.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(GS,uq);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!GS.test(s)){let o=s.replace(oq,cq);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Dy}return new i(r,t)}function cq(e){return"-"+e.toLowerCase()}function uq(e){return e.charAt(1).toUpperCase()}const dq=u5([d5,rq,p5,m5,g5],"html"),Oy=u5([d5,iq,p5,m5,g5],"svg");function hq(e){return e.join(" ").trim()}var By={},XS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,fq=/\n/g,pq=/^\s*/,mq=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,gq=/^:\s*/,vq=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,xq=/^[;\s]*/,_q=/^\s+|\s+$/g,yq=`
|
|
507
507
|
`,YS="/",QS="*",lo="",bq="comment",wq="declaration";function Sq(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(fq);v&&(n+=v.length);var w=m.lastIndexOf(yq);r=~w?m.length-w:r+m.length}function s(){var m={line:n,column:r};return function(v){return v.position=new o(m),c(),v}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(m){var v=new Error(t.source+":"+n+":"+r+": "+m);if(v.reason=m,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function l(m){var v=m.exec(e);if(v){var w=v[0];return i(w),e=e.slice(w.length),v}}function c(){l(pq)}function u(m){var v;for(m=m||[];v=d();)v!==!1&&m.push(v);return m}function d(){var m=s();if(!(YS!=e.charAt(0)||QS!=e.charAt(1))){for(var v=2;lo!=e.charAt(v)&&(QS!=e.charAt(v)||YS!=e.charAt(v+1));)++v;if(v+=2,lo===e.charAt(v-1))return a("End of comment missing");var w=e.slice(2,v-2);return r+=2,i(w),e=e.slice(v),r+=2,m({type:bq,comment:w})}}function f(){var m=s(),v=l(mq);if(v){if(d(),!l(gq))return a("property missing ':'");var w=l(vq),x=m({type:wq,property:ZS(v[0].replace(XS,lo)),value:w?ZS(w[0].replace(XS,lo)):lo});return l(xq),x}}function p(){var m=[];u(m);for(var v;v=f();)v!==!1&&(m.push(v),u(m));return m}return c(),p()}function ZS(e){return e?e.replace(_q,lo):lo}var kq=Sq,Cq=fh&&fh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(By,"__esModule",{value:!0});By.default=Nq;const Eq=Cq(kq);function Nq(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,Eq.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 Cp={};Object.defineProperty(Cp,"__esModule",{value:!0});Cp.camelCase=void 0;var Tq=/^--[a-zA-Z0-9_-]+$/,Iq=/-([a-z])/g,Pq=/^[^-]+$/,Rq=/^-(webkit|moz|ms|o|khtml)-/,Mq=/^-(ms)-/,Aq=function(e){return!e||Pq.test(e)||Tq.test(e)},jq=function(e,t){return t.toUpperCase()},JS=function(e,t){return"".concat(t,"-")},Lq=function(e,t){return t===void 0&&(t={}),Aq(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Mq,JS):e=e.replace(Rq,JS),e.replace(Iq,jq))};Cp.camelCase=Lq;var Dq=fh&&fh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Oq=Dq(By),Bq=Cp;function L0(e,t){var n={};return!e||typeof e!="string"||(0,Oq.default)(e,function(r,i){r&&i&&(n[(0,Bq.camelCase)(r,t)]=i)}),n}L0.default=L0;var zq=L0;const $q=hu(zq),v5=x5("end"),zy=x5("start");function x5(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 Fq(e){const t=zy(e),n=v5(e);if(t&&n)return{start:t,end:n}}function wc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ek(e.position):"start"in e||"end"in e?ek(e):"line"in e||"column"in e?D0(e):""}function D0(e){return tk(e&&e.line)+":"+tk(e&&e.column)}function ek(e){return D0(e&&e.start)+"-"+D0(e&&e.end)}function tk(e){return e&&typeof e=="number"?e:1}class Nn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=wc(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Nn.prototype.file="";Nn.prototype.name="";Nn.prototype.reason="";Nn.prototype.message="";Nn.prototype.stack="";Nn.prototype.column=void 0;Nn.prototype.line=void 0;Nn.prototype.ancestors=void 0;Nn.prototype.cause=void 0;Nn.prototype.fatal=void 0;Nn.prototype.place=void 0;Nn.prototype.ruleId=void 0;Nn.prototype.source=void 0;const $y={}.hasOwnProperty,Hq=new Map,Uq=/[A-Z]/g,Wq=new Set(["table","tbody","thead","tfoot","tr"]),Vq=new Set(["td","th"]),_5="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function qq(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=eK(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=Jq(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"?Oy:dq,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=y5(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function y5(e,t,n){if(t.type==="element")return Kq(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Gq(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Yq(e,t,n);if(t.type==="mdxjsEsm")return Xq(e,t);if(t.type==="root")return Qq(e,t,n);if(t.type==="text")return Zq(e,t)}function Kq(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Oy,e.schema=i),e.ancestors.push(t);const s=w5(e,t.tagName,!1),o=tK(e,t);let a=Hy(e,t);return Wq.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!tq(l):!0})),b5(e,o,s,t),Fy(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Gq(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)}ou(e,t.position)}function Xq(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ou(e,t.position)}function Yq(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Oy,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:w5(e,t.name,!0),o=nK(e,t),a=Hy(e,t);return b5(e,o,s,t),Fy(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Qq(e,t,n){const r={};return Fy(r,Hy(e,t)),e.create(t,e.Fragment,r,n)}function Zq(e,t){return t.value}function b5(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Fy(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Jq(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 eK(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=zy(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 tK(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&$y.call(t.properties,i)){const s=rK(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Vq.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 nK(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 ou(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 ou(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Hy(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Hq;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=y5(e,s,o);a!==void 0&&n.push(a)}return n}function rK(e,t,n){const r=lq(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?YV(n):hq(n)),r.property==="style"){let i=typeof n=="object"?n:iK(e,String(n));return e.stylePropertyNameCase==="css"&&(i=sK(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?sq[r.property]||r.property:r.attribute,n]}}function iK(e,t){try{return $q(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Nn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=_5+"#cannot-parse-style-attribute",i}}function w5(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=VS(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=VS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return $y.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ou(e)}function ou(e,t){const n=new Nn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=_5+"#cannot-handle-mdx-estrees-without-createevaluater",n}function sK(e){const t={};let n;for(n in e)$y.call(e,n)&&(t[oK(n)]=e[n]);return t}function oK(e){let t=e.replace(Uq,aK);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function aK(e){return"-"+e.toLowerCase()}const Gm={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"]},lK={};function Uy(e,t){const n=lK,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return S5(e,r,i)}function S5(e,t,n){if(cK(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 nk(e.children,t,n)}return Array.isArray(e)?nk(e,t,n):""}function nk(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=S5(e[i],t,n);return r.join("")}function cK(e){return!!(e&&typeof e=="object")}const rk=document.createElement("i");function Wy(e){const t="&"+e+";";rk.innerHTML=t;const n=rk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function sr(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 vr(e,t){return e.length>0?(sr(e,e.length,0,t),e):t}const ik={}.hasOwnProperty;function k5(e){const t={};let n=-1;for(;++n<e.length;)uK(t,e[n]);return t}function uK(e,t){let n;for(n in t){const i=(ik.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){ik.call(i,o)||(i[o]=[]);const a=s[o];dK(i[o],Array.isArray(a)?a:a?[a]:[])}}}function dK(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);sr(e,0,0,r)}function C5(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 $r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pn=Ks(/[A-Za-z]/),kn=Ks(/[\dA-Za-z]/),hK=Ks(/[#-'*+\--9=?A-Z^-~]/);function lf(e){return e!==null&&(e<32||e===127)}const O0=Ks(/\d/),fK=Ks(/[\dA-Fa-f]/),pK=Ks(/[!-/:-@[-`{-~]/);function Se(e){return e!==null&&e<-2}function at(e){return e!==null&&(e<0||e===32)}function Ue(e){return e===-2||e===-1||e===32}const Ep=Ks(new RegExp("\\p{P}|\\p{S}","u")),Mo=Ks(/\s/);function Ks(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function wl(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&kn(e.charCodeAt(n+1))&&kn(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 Ke(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 mK={tokenize:gK};function gK(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"),Ke(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 Se(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const vK={tokenize:xK},sk={tokenize:_K};function xK(e){const t=this,n=[];let r=0,i,s,o;return a;function a(y){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,c)(y)}return c(y)}function l(y){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&_();const S=t.events.length;let C=S,k;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){k=t.events[C][1].end;break}x(r);let N=S;for(;N<t.events.length;)t.events[N][1].end={...k},N++;return sr(t.events,C+1,0,t.events.slice(S)),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(sk,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(sk,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){w(e.exit("chunkFlow"),!0),x(0),e.consume(y);return}return Se(y)?(e.consume(y),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(y),v)}function w(y,S){const C=t.sliceStream(y);if(S&&C.push(null),y.previous=s,s&&(s.next=y),s=y,i.defineSkip(y.start),i.write(C),t.parser.lazy[y.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const N=t.events.length;let T=N,z,P;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(z){P=t.events[T][1].end;break}z=!0}for(x(r),k=N;k<t.events.length;)t.events[k][1].end={...P},k++;sr(t.events,T+1,0,t.events.slice(N)),t.events.length=k}}function x(y){let S=n.length;for(;S-- >y;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=y}function _(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function _K(e,t,n){return Ke(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qa(e){if(e===null||at(e)||Mo(e))return 1;if(Ep(e))return 2}function Np(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 B0={name:"attention",resolveAll:yK,tokenize:bK};function yK(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};ok(d,-l),ok(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=vr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=vr(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=vr(c,Np(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=vr(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=vr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,sr(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 bK(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Qa(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=Qa(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 ok(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const wK={name:"autolink",tokenize:SK};function SK(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 Pn(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||kn(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||kn(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||lf(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):hK(p)?(e.consume(p),c):n(p)}function u(p){return kn(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||kn(p))&&r++<63){const m=p===45?f:d;return e.consume(p),m}return n(p)}}const Ru={partial:!0,tokenize:kK};function kK(e,t,n){return r;function r(s){return Ue(s)?Ke(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Se(s)?t(s):n(s)}}const E5={continuation:{tokenize:EK},exit:NK,name:"blockQuote",tokenize:CK};function CK(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 EK(e,t,n){const r=this;return i;function i(o){return Ue(o)?Ke(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(E5,t,n)(o)}}function NK(e){e.exit("blockQuote")}const N5={name:"characterEscape",tokenize:TK};function TK(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 pK(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const T5={name:"characterReference",tokenize:IK};function IK(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=kn,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=fK,u):(e.enter("characterReferenceValue"),s=7,o=O0,u(d))}function u(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return o===kn&&!Wy(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 ak={partial:!0,tokenize:RK},lk={concrete:!0,name:"codeFenced",tokenize:PK};function PK(e,t,n){const r=this,i={partial:!0,tokenize:C};let s=0,o=0,a;return l;function l(k){return c(k)}function c(k){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===a?(o++,e.consume(k),u):o<3?n(k):(e.exit("codeFencedFenceSequence"),Ue(k)?Ke(e,d,"whitespace")(k):d(k))}function d(k){return k===null||Se(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(ak,v,S)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||Se(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):Ue(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ke(e,p,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),f)}function p(k){return k===null||Se(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||Se(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===a?n(k):(e.consume(k),m)}function v(k){return e.attempt(i,S,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),x}function x(k){return s>0&&Ue(k)?Ke(e,_,"linePrefix",s+1)(k):_(k)}function _(k){return k===null||Se(k)?e.check(ak,v,S)(k):(e.enter("codeFlowValue"),y(k))}function y(k){return k===null||Se(k)?(e.exit("codeFlowValue"),_(k)):(e.consume(k),y)}function S(k){return e.exit("codeFenced"),t(k)}function C(k,N,T){let z=0;return P;function P(L){return k.enter("lineEnding"),k.consume(L),k.exit("lineEnding"),O}function O(L){return k.enter("codeFencedFence"),Ue(L)?Ke(k,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):M(L)}function M(L){return L===a?(k.enter("codeFencedFenceSequence"),R(L)):T(L)}function R(L){return L===a?(z++,k.consume(L),R):z>=o?(k.exit("codeFencedFenceSequence"),Ue(L)?Ke(k,A,"whitespace")(L):A(L)):T(L)}function A(L){return L===null||Se(L)?(k.exit("codeFencedFence"),N(L)):T(L)}}}function RK(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 Xm={name:"codeIndented",tokenize:AK},MK={partial:!0,tokenize:jK};function AK(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Ke(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):Se(c)?e.attempt(MK,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||Se(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function jK(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Se(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ke(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):Se(o)?i(o):n(o)}}const LK={name:"codeText",previous:OK,resolve:DK,tokenize:BK};function DK(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 OK(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function BK(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)):Se(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||Se(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 zK{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&&$l(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),$l(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),$l(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);$l(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);$l(this.left,n.reverse())}}}function $l(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 I5(e){const t={};let n=-1,r,i,s,o,a,l,c;const u=new zK(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,$K(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 sr(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function $K(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,f=-1,p=n,m=0,v=0;const w=[v];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(v=f+1,w.push(v),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):w.pop(),f=w.length;f--;){const x=a.slice(w[f],w[f+1]),_=s.pop();l.push([_,_+x.length-1]),e.splice(_,2,x)}for(l.reverse(),f=-1;++f<l.length;)c[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return c}const FK={resolve:UK,tokenize:WK},HK={partial:!0,tokenize:VK};function UK(e){return I5(e),e}function WK(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):Se(a)?e.check(HK,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 VK(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ke(e,s,"linePrefix")}function s(o){if(o===null||Se(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 P5(e,t,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return x===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(x),e.exit(s),f):x===null||x===32||x===41||lf(x)?n(x):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(x))}function f(x){return x===62?(e.enter(s),e.consume(x),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(a),f(x)):x===null||x===60||Se(x)?n(x):(e.consume(x),x===92?m:p)}function m(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function v(x){return!u&&(x===null||x===41||at(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(x)):u<c&&x===40?(e.consume(x),u++,v):x===41?(e.consume(x),u--,v):x===null||x===32||x===40||lf(x)?n(x):(e.consume(x),x===92?w:v)}function w(x){return x===40||x===41||x===92?(e.consume(x),v):v(x)}}function R5(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):Se(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||Se(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 M5(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):Se(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ke(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||Se(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 Sc(e,t){let n;return r;function r(i){return Se(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ue(i)?Ke(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const qK={name:"definition",tokenize:GK},KK={partial:!0,tokenize:XK};function GK(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return R5.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=$r(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 at(p)?Sc(e,c)(p):c(p)}function c(p){return P5(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(KK,d,d)(p)}function d(p){return Ue(p)?Ke(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Se(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function XK(e,t,n){return r;function r(a){return at(a)?Sc(e,i)(a):n(a)}function i(a){return M5(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ue(a)?Ke(e,o,"whitespace")(a):o(a)}function o(a){return a===null||Se(a)?t(a):n(a)}}const YK={name:"hardBreakEscape",tokenize:QK};function QK(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Se(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const ZK={name:"headingAtx",resolve:JK,tokenize:eG};function JK(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"},sr(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function eG(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||at(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||Se(u)?(e.exit("atxHeading"),t(u)):Ue(u)?Ke(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||at(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const tG=["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"],ck=["pre","script","style","textarea"],nG={concrete:!0,name:"htmlFlow",resolveTo:sG,tokenize:oG},rG={partial:!0,tokenize:lG},iG={partial:!0,tokenize:aG};function sG(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 oG(e,t,n){const r=this;let i,s,o,a,l;return c;function c(j){return u(j)}function u(j){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(j),d}function d(j){return j===33?(e.consume(j),f):j===47?(e.consume(j),s=!0,v):j===63?(e.consume(j),i=3,r.interrupt?t:E):Pn(j)?(e.consume(j),o=String.fromCharCode(j),w):n(j)}function f(j){return j===45?(e.consume(j),i=2,p):j===91?(e.consume(j),i=5,a=0,m):Pn(j)?(e.consume(j),i=4,r.interrupt?t:E):n(j)}function p(j){return j===45?(e.consume(j),r.interrupt?t:E):n(j)}function m(j){const ne="CDATA[";return j===ne.charCodeAt(a++)?(e.consume(j),a===ne.length?r.interrupt?t:M:m):n(j)}function v(j){return Pn(j)?(e.consume(j),o=String.fromCharCode(j),w):n(j)}function w(j){if(j===null||j===47||j===62||at(j)){const ne=j===47,ie=o.toLowerCase();return!ne&&!s&&ck.includes(ie)?(i=1,r.interrupt?t(j):M(j)):tG.includes(o.toLowerCase())?(i=6,ne?(e.consume(j),x):r.interrupt?t(j):M(j)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(j):s?_(j):y(j))}return j===45||kn(j)?(e.consume(j),o+=String.fromCharCode(j),w):n(j)}function x(j){return j===62?(e.consume(j),r.interrupt?t:M):n(j)}function _(j){return Ue(j)?(e.consume(j),_):P(j)}function y(j){return j===47?(e.consume(j),P):j===58||j===95||Pn(j)?(e.consume(j),S):Ue(j)?(e.consume(j),y):P(j)}function S(j){return j===45||j===46||j===58||j===95||kn(j)?(e.consume(j),S):C(j)}function C(j){return j===61?(e.consume(j),k):Ue(j)?(e.consume(j),C):y(j)}function k(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(e.consume(j),l=j,N):Ue(j)?(e.consume(j),k):T(j)}function N(j){return j===l?(e.consume(j),l=null,z):j===null||Se(j)?n(j):(e.consume(j),N)}function T(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||at(j)?C(j):(e.consume(j),T)}function z(j){return j===47||j===62||Ue(j)?y(j):n(j)}function P(j){return j===62?(e.consume(j),O):n(j)}function O(j){return j===null||Se(j)?M(j):Ue(j)?(e.consume(j),O):n(j)}function M(j){return j===45&&i===2?(e.consume(j),$):j===60&&i===1?(e.consume(j),F):j===62&&i===4?(e.consume(j),H):j===63&&i===3?(e.consume(j),E):j===93&&i===5?(e.consume(j),B):Se(j)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(rG,q,R)(j)):j===null||Se(j)?(e.exit("htmlFlowData"),R(j)):(e.consume(j),M)}function R(j){return e.check(iG,A,q)(j)}function A(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),L}function L(j){return j===null||Se(j)?R(j):(e.enter("htmlFlowData"),M(j))}function $(j){return j===45?(e.consume(j),E):M(j)}function F(j){return j===47?(e.consume(j),o="",D):M(j)}function D(j){if(j===62){const ne=o.toLowerCase();return ck.includes(ne)?(e.consume(j),H):M(j)}return Pn(j)&&o.length<8?(e.consume(j),o+=String.fromCharCode(j),D):M(j)}function B(j){return j===93?(e.consume(j),E):M(j)}function E(j){return j===62?(e.consume(j),H):j===45&&i===2?(e.consume(j),E):M(j)}function H(j){return j===null||Se(j)?(e.exit("htmlFlowData"),q(j)):(e.consume(j),H)}function q(j){return e.exit("htmlFlow"),t(j)}}function aG(e,t,n){const r=this;return i;function i(o){return Se(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 lG(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ru,t,n)}}const cG={name:"htmlText",tokenize:uG};function uG(e,t,n){const r=this;let i,s,o;return a;function a(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),l}function l(E){return E===33?(e.consume(E),c):E===47?(e.consume(E),C):E===63?(e.consume(E),y):Pn(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):Pn(E)?(e.consume(E),_):n(E)}function u(E){return E===45?(e.consume(E),p):n(E)}function d(E){return E===null?n(E):E===45?(e.consume(E),f):Se(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),w):Se(E)?(o=v,F(E)):(e.consume(E),v)}function w(E){return E===93?(e.consume(E),x):v(E)}function x(E){return E===62?$(E):E===93?(e.consume(E),x):v(E)}function _(E){return E===null||E===62?$(E):Se(E)?(o=_,F(E)):(e.consume(E),_)}function y(E){return E===null?n(E):E===63?(e.consume(E),S):Se(E)?(o=y,F(E)):(e.consume(E),y)}function S(E){return E===62?$(E):y(E)}function C(E){return Pn(E)?(e.consume(E),k):n(E)}function k(E){return E===45||kn(E)?(e.consume(E),k):N(E)}function N(E){return Se(E)?(o=N,F(E)):Ue(E)?(e.consume(E),N):$(E)}function T(E){return E===45||kn(E)?(e.consume(E),T):E===47||E===62||at(E)?z(E):n(E)}function z(E){return E===47?(e.consume(E),$):E===58||E===95||Pn(E)?(e.consume(E),P):Se(E)?(o=z,F(E)):Ue(E)?(e.consume(E),z):$(E)}function P(E){return E===45||E===46||E===58||E===95||kn(E)?(e.consume(E),P):O(E)}function O(E){return E===61?(e.consume(E),M):Se(E)?(o=O,F(E)):Ue(E)?(e.consume(E),O):z(E)}function M(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),i=E,R):Se(E)?(o=M,F(E)):Ue(E)?(e.consume(E),M):(e.consume(E),A)}function R(E){return E===i?(e.consume(E),i=void 0,L):E===null?n(E):Se(E)?(o=R,F(E)):(e.consume(E),R)}function A(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||at(E)?z(E):(e.consume(E),A)}function L(E){return E===47||E===62||at(E)?z(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)?Ke(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):B(E)}function B(E){return e.enter("htmlTextData"),o(E)}}const Vy={name:"labelEnd",resolveAll:pG,resolveTo:mG,tokenize:gG},dG={tokenize:vG},hG={tokenize:xG},fG={tokenize:_G};function pG(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&&sr(e,0,e.length,n),e}function mG(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=vr(a,e.slice(s+1,s+r+3)),a=vr(a,[["enter",u,t]]),a=vr(a,Np(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=vr(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=vr(a,e.slice(o+1)),a=vr(a,[["exit",l,t]]),sr(e,s,e.length,a),e}function gG(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($r(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(dG,u,o?u:d)(f):f===91?e.attempt(hG,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(fG,u,d)(f)}function u(f){return t(f)}function d(f){return s._balanced=!0,n(f)}}function vG(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 at(d)?Sc(e,s)(d):s(d)}function s(d){return d===41?u(d):P5(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return at(d)?Sc(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?M5(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return at(d)?Sc(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 xG(e,t,n){const r=this;return i;function i(a){return R5.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes($r(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function _G(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 yG={name:"labelStartImage",resolveAll:Vy.resolveAll,tokenize:bG};function bG(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 wG={name:"labelStartLink",resolveAll:Vy.resolveAll,tokenize:SG};function SG(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 Ym={name:"lineEnding",tokenize:kG};function kG(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ke(e,t,"linePrefix")}}const sh={name:"thematicBreak",tokenize:CG};function CG(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||Se(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ue(c)?Ke(e,a,"whitespace")(c):a(c))}}const Hn={continuation:{tokenize:IG},exit:RG,name:"list",tokenize:TG},EG={partial:!0,tokenize:MG},NG={partial:!0,tokenize:PG};function TG(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:O0(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(sh,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 O0(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(Ru,r.interrupt?n:u,e.attempt(EG,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 IG(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ru,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ke(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(NG,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ke(e,e.attempt(Hn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function PG(e,t,n){const r=this;return Ke(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 RG(e){e.exit(this.containerState.type)}function MG(e,t,n){const r=this;return Ke(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 uk={name:"setextUnderline",resolveTo:AG,tokenize:jG};function AG(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 jG(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)?Ke(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Se(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const LG={tokenize:DG};function DG(e){const t=this,n=e.attempt(Ru,r,e.attempt(this.parser.constructs.flowInitial,i,Ke(e,e.attempt(this.parser.constructs.flow,i,e.attempt(FK,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 OG={resolveAll:j5()},BG=A5("string"),zG=A5("text");function A5(e){return{resolveAll:j5(e==="text"?$G: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 j5(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 $G(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 FG={42:Hn,43:Hn,45:Hn,48:Hn,49:Hn,50:Hn,51:Hn,52:Hn,53:Hn,54:Hn,55:Hn,56:Hn,57:Hn,62:E5},HG={91:qK},UG={[-2]:Xm,[-1]:Xm,32:Xm},WG={35:ZK,42:sh,45:[uk,sh],60:nG,61:uk,95:sh,96:lk,126:lk},VG={38:T5,92:N5},qG={[-5]:Ym,[-4]:Ym,[-3]:Ym,33:yG,38:T5,42:B0,60:[wK,cG],91:wG,92:[YK,N5],93:Vy,95:B0,96:LK},KG={null:[B0,OG]},GG={null:[42,95]},XG={null:[]},YG=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:GG,contentInitial:HG,disable:XG,document:FG,flow:WG,flowInitial:UG,insideSpan:KG,string:VG,text:qG},Symbol.toStringTag,{value:"Module"}));function QG(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(C),check:N(k),consume:_,enter:y,exit:S,interrupt:N(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:v,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function d(O){return o=vr(o,O),w(),o[o.length-1]!==null?[]:(T(t,0),c.events=Np(s,c.events,c),c.events)}function f(O,M){return JG(p(O),M)}function p(O){return ZG(o,O)}function m(){const{_bufferIndex:O,_index:M,line:R,column:A,offset:L}=r;return{_bufferIndex:O,_index:M,line:R,column:A,offset:L}}function v(O){i[O.line]=O.column,P()}function w(){let O;for(;r._index<o.length;){const M=o[r._index];if(typeof M=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<M.length;)x(M.charCodeAt(r._bufferIndex));else x(M)}}function x(O){u=u(O)}function _(O){Se(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,P()):O!==-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=O}function y(O,M){const R=M||{};return R.type=O,R.start=m(),c.events.push(["enter",R,c]),a.push(R),R}function S(O){const M=a.pop();return M.end=m(),c.events.push(["exit",M,c]),M}function C(O,M){T(O,M.from)}function k(O,M){M.restore()}function N(O,M){return R;function R(A,L,$){let F,D,B,E;return Array.isArray(A)?q(A):"tokenize"in A?q([A]):H(A);function H(K){return _e;function _e(Re){const ce=Re!==null&&K[Re],Me=Re!==null&&K.null,$e=[...Array.isArray(ce)?ce:ce?[ce]:[],...Array.isArray(Me)?Me:Me?[Me]:[]];return q($e)(Re)}}function q(K){return F=K,D=0,K.length===0?$:j(K[D])}function j(K){return _e;function _e(Re){return E=z(),B=K,K.partial||(c.currentConstruct=K),K.name&&c.parser.constructs.disable.null.includes(K.name)?ie():K.tokenize.call(M?Object.assign(Object.create(c),M):c,l,ne,ie)(Re)}}function ne(K){return O(B,E),L}function ie(K){return E.restore(),++D<F.length?j(F[D]):$}}}function T(O,M){O.resolveAll&&!s.includes(O)&&s.push(O),O.resolve&&sr(c.events,M,c.events.length-M,O.resolve(c.events.slice(M),c)),O.resolveTo&&(c.events=O.resolveTo(c.events,c))}function z(){const O=m(),M=c.previous,R=c.currentConstruct,A=c.events.length,L=Array.from(a);return{from:A,restore:$};function $(){r=O,c.previous=M,c.currentConstruct=R,c.events.length=A,a=L,P()}}function P(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ZG(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 JG(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=`
|
|
508
508
|
`;break}case-3:{o=`\r
|
|
509
509
|
`;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 eX(e){const r={constructs:k5([YG,...(e||{}).extensions||[]]),content:i(mK),defined:[],document:i(vK),flow:i(LG),lazy:{},string:i(BG),text:i(zG)};return r;function i(s){return o;function o(a){return QG(r,s,a)}}}function tX(e){for(;!I5(e););return e}const dk=/[\0\t\n\r]/g;function nX(){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(dk.lastIndex=d,c=dk.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 rX=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function iX(e){return e.replace(rX,sX)}function sX(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return C5(n.slice(s?2:1),s?16:10)}return Wy(n)||e}const L5={}.hasOwnProperty;function oX(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),aX(n)(tX(eX(n).document().write(nX()(e,t,!0))))}function aX(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(mt),autolinkProtocol:z,autolinkEmail:z,atxHeading:s(pt),blockQuote:s(Me),characterEscape:z,characterReference:z,codeFenced:s($e),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s($e,o),codeText:s(Fe,o),codeTextData:z,data:z,codeFlowValue:z,definition:s(be),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(rt),hardBreakEscape:s(qe),hardBreakTrailing:s(qe),htmlFlow:s(Et,o),htmlFlowData:z,htmlText:s(Et,o),htmlTextData:z,image:s(Zt),label:o,link:s(mt),listItem:s(Qe),listItemValue:f,listOrdered:s(xt,d),listUnordered:s(xt),paragraph:s(ot),reference:j,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(pt),strong:s(_t),thematicBreak:s(cn)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:ce,autolinkProtocol:Re,blockQuote:l(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:K,characterReference:_e,codeFenced:l(w),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:P,codeIndented:l(x),codeText:l(L),codeTextData:P,data:P,definition:l(),definitionDestinationString:S,definitionLabelString:_,definitionTitleString:y,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l(R),htmlFlowData:P,htmlText:l(A),htmlTextData:P,image:l(F),label:B,labelText:D,lineEnding:O,link:l($),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ne,resourceDestinationString:E,resourceTitleString:H,resource:q,setextHeading:l(T),setextHeadingLineSequence:N,setextHeadingText:k,strong:l(),thematicBreak:l()}};D5(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(U){let J={type:"root",children:[]};const ve={stack:[J],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},Te=[];let De=-1;for(;++De<U.length;)if(U[De][1].type==="listOrdered"||U[De][1].type==="listUnordered")if(U[De][0]==="enter")Te.push(De);else{const Nt=Te.pop();De=i(U,Nt,De)}for(De=-1;++De<U.length;){const Nt=t[U[De][0]];L5.call(Nt,U[De][1].type)&&Nt[U[De][1].type].call(Object.assign({sliceSerialize:U[De][2].sliceSerialize},ve),U[De][1])}if(ve.tokenStack.length>0){const Nt=ve.tokenStack[ve.tokenStack.length-1];(Nt[1]||hk).call(ve,void 0,Nt[0])}for(J.position={start:as(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:as(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},De=-1;++De<t.transforms.length;)J=t.transforms[De](J)||J;return J}function i(U,J,ve){let Te=J-1,De=-1,Nt=!1,un,Wt,Jt,le;for(;++Te<=ve;){const we=U[Te];switch(we[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{we[0]==="enter"?De++:De--,le=void 0;break}case"lineEndingBlank":{we[0]==="enter"&&(un&&!le&&!De&&!Jt&&(Jt=Te),le=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:le=void 0}if(!De&&we[0]==="enter"&&we[1].type==="listItemPrefix"||De===-1&&we[0]==="exit"&&(we[1].type==="listUnordered"||we[1].type==="listOrdered")){if(un){let ut=Te;for(Wt=void 0;ut--;){const jt=U[ut];if(jt[1].type==="lineEnding"||jt[1].type==="lineEndingBlank"){if(jt[0]==="exit")continue;Wt&&(U[Wt][1].type="lineEndingBlank",Nt=!0),jt[1].type="lineEnding",Wt=ut}else if(!(jt[1].type==="linePrefix"||jt[1].type==="blockQuotePrefix"||jt[1].type==="blockQuotePrefixWhitespace"||jt[1].type==="blockQuoteMarker"||jt[1].type==="listItemIndent"))break}Jt&&(!Wt||Jt<Wt)&&(un._spread=!0),un.end=Object.assign({},Wt?U[Wt][1].start:we[1].end),U.splice(Wt||Te,0,["exit",un,we[2]]),Te++,ve++}if(we[1].type==="listItemPrefix"){const ut={type:"listItem",_spread:!1,start:Object.assign({},we[1].start),end:void 0};un=ut,U.splice(Te,0,["enter",ut,we[2]]),Te++,ve++,Jt=void 0,le=!0}}}return U[J][1]._spread=Nt,ve}function s(U,J){return ve;function ve(Te){a.call(this,U(Te),Te),J&&J.call(this,Te)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(U,J,ve){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([J,ve||void 0]),U.position={start:as(J.start),end:void 0}}function l(U){return J;function J(ve){U&&U.call(this,ve),c.call(this,ve)}}function c(U,J){const ve=this.stack.pop(),Te=this.tokenStack.pop();if(Te)Te[0].type!==U.type&&(J?J.call(this,U,Te[0]):(Te[1]||hk).call(this,U,Te[0]));else throw new Error("Cannot close `"+U.type+"` ("+wc({start:U.start,end:U.end})+"): it’s not open");ve.position.end=as(U.end)}function u(){return Uy(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(U){if(this.data.expectingFirstListItemValue){const J=this.stack[this.stack.length-2];J.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function p(){const U=this.resume(),J=this.stack[this.stack.length-1];J.lang=U}function m(){const U=this.resume(),J=this.stack[this.stack.length-1];J.meta=U}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const U=this.resume(),J=this.stack[this.stack.length-1];J.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const U=this.resume(),J=this.stack[this.stack.length-1];J.value=U.replace(/(\r?\n|\r)$/g,"")}function _(U){const J=this.resume(),ve=this.stack[this.stack.length-1];ve.label=J,ve.identifier=$r(this.sliceSerialize(U)).toLowerCase()}function y(){const U=this.resume(),J=this.stack[this.stack.length-1];J.title=U}function S(){const U=this.resume(),J=this.stack[this.stack.length-1];J.url=U}function C(U){const J=this.stack[this.stack.length-1];if(!J.depth){const ve=this.sliceSerialize(U).length;J.depth=ve}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function N(U){const J=this.stack[this.stack.length-1];J.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function z(U){const ve=this.stack[this.stack.length-1].children;let Te=ve[ve.length-1];(!Te||Te.type!=="text")&&(Te=vn(),Te.position={start:as(U.start),end:void 0},ve.push(Te)),this.stack.push(Te)}function P(U){const J=this.stack.pop();J.value+=this.sliceSerialize(U),J.position.end=as(U.end)}function O(U){const J=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=J.children[J.children.length-1];ve.position.end=as(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(J.type)&&(z.call(this,U),P.call(this,U))}function M(){this.data.atHardBreak=!0}function R(){const U=this.resume(),J=this.stack[this.stack.length-1];J.value=U}function A(){const U=this.resume(),J=this.stack[this.stack.length-1];J.value=U}function L(){const U=this.resume(),J=this.stack[this.stack.length-1];J.value=U}function $(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const J=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=J,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 J=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=J,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function D(U){const J=this.sliceSerialize(U),ve=this.stack[this.stack.length-2];ve.label=iX(J),ve.identifier=$r(J).toLowerCase()}function B(){const U=this.stack[this.stack.length-1],J=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const Te=U.children;ve.children=Te}else ve.alt=J}function E(){const U=this.resume(),J=this.stack[this.stack.length-1];J.url=U}function H(){const U=this.resume(),J=this.stack[this.stack.length-1];J.title=U}function q(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function ne(U){const J=this.resume(),ve=this.stack[this.stack.length-1];ve.label=J,ve.identifier=$r(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function ie(U){this.data.characterReferenceType=U.type}function K(U){const J=this.sliceSerialize(U),ve=this.data.characterReferenceType;let Te;ve?(Te=C5(J,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Te=Wy(J);const De=this.stack[this.stack.length-1];De.value+=Te}function _e(U){const J=this.stack.pop();J.position.end=as(U.end)}function Re(U){P.call(this,U);const J=this.stack[this.stack.length-1];J.url=this.sliceSerialize(U)}function ce(U){P.call(this,U);const J=this.stack[this.stack.length-1];J.url="mailto:"+this.sliceSerialize(U)}function Me(){return{type:"blockquote",children:[]}}function $e(){return{type:"code",lang:null,meta:null,value:""}}function Fe(){return{type:"inlineCode",value:""}}function be(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function rt(){return{type:"emphasis",children:[]}}function pt(){return{type:"heading",depth:0,children:[]}}function qe(){return{type:"break"}}function Et(){return{type:"html",value:""}}function Zt(){return{type:"image",title:null,url:"",alt:null}}function mt(){return{type:"link",title:null,url:"",children:[]}}function xt(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 ot(){return{type:"paragraph",children:[]}}function _t(){return{type:"strong",children:[]}}function vn(){return{type:"text",value:""}}function cn(){return{type:"thematicBreak"}}}function as(e){return{line:e.line,column:e.column,offset:e.offset}}function D5(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?D5(e,r):lX(e,r)}}function lX(e,t){let n;for(n in t)if(L5.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 hk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+wc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+wc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+wc({start:t.start,end:t.end})+") is still open")}function cX(e){const t=this;t.parser=n;function n(r){return oX(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function uX(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 dX(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|