@clawos-dev/clawd 0.2.383 → 0.2.384
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.
|
@@ -92,7 +92,7 @@ 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 rw=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 LD={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},jD={motionBase:!0,motionUnit:!0},DD={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},eN=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=rw(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=JT(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=rw(l,["theme"]);let d=u;c&&(d=eN(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function tN(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Ze.useContext(QT),s=`${MD}-${t||""}`,o=n||XT,[a,l,c]=wj(o,[Hc,e],{salt:s,override:r,getComputedToken:eN,formatToken:JT,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:LD,ignore:jD,preserve:DD}});return[o,c,t?l:"",a,i]}const OD=()=>({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"}}),BD=e=>({[`.${e}`]:Object.assign(Object.assign({},OD()),{[`.${e} .${e}-icon`]:{display:"block"}})}),zD=(e,t)=>{const[n,r]=tN();return Xj({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>BD(e))},$D=Object.assign({},Ja),{useId:iw}=$D,FD=()=>"",HD=typeof iw>"u"?FD:iw;function UD(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},$h),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:$h.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=HD();return xT(()=>{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!XL(c,d,!0)}))}var WD=["children"],nN=g.createContext({});function VD(e){var t=e.children,n=Pv(e,WD);return g.createElement(nN.Provider,{value:n},t)}var qD=function(e){bT(n,e);var t=ST(n);function n(){return rl(this,n),t.apply(this,arguments)}return il(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function KD(e){var t=g.useReducer(function(a){return a+1},0),n=Je(t,2),r=n[1],i=g.useRef(e),s=Zv(function(){return i.current}),o=Zv(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var ns="none",sd="appear",od="enter",ad="leave",sw="none",Nr="prepare",ma="start",ga="active",Ax="end",rN="prepared";function ow(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 GD(e,t){var n={animationend:ow("Animation","AnimationEnd"),transitionend:ow("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var YD=GD(zi(),typeof window<"u"?window:{}),iN={};if(zi()){var XD=document.createElement("div");iN=XD.style}var ld={};function sN(e){if(ld[e])return ld[e];var t=YD[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 iN)return ld[e]=t[s],ld[e]}return""}var oN=sN("animationend"),aN=sN("transitionend"),lN=!!(oN&&aN),aw=oN||"animationend",lw=aN||"transitionend";function cw(e,t){if(!e)return null;if(Ct(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const QD=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(lw,e),i.removeEventListener(aw,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(lw,e),i.addEventListener(aw,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var cN=zi()?g.useLayoutEffect:g.useEffect;const ZD=function(){var e=g.useRef(null);function t(){Nv.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=Nv(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 JD=[Nr,ma,ga,Ax],eO=[Nr,rN],uN=!1,tO=!0;function dN(e){return e===ga||e===Ax}const nO=function(e,t,n){var r=Jv(sw),i=Je(r,2),s=i[0],o=i[1],a=ZD(),l=Je(a,2),c=l[0],u=l[1];function d(){o(Nr,!0)}var f=t?eO:JD;return cN(function(){if(s!==sw&&s!==Ax){var p=f.indexOf(s),m=f[p+1],v=n(s);v===uN?o(m,!0):m&&c(function(b){function _(){b.isCanceled()||o(m,!0)}v===!0?_():Promise.resolve(v).then(_)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function rO(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,b=r.onEnterStart,_=r.onLeaveStart,x=r.onAppearActive,y=r.onEnterActive,S=r.onLeaveActive,C=r.onAppearEnd,k=r.onEnterEnd,T=r.onLeaveEnd,N=r.onVisibleChanged,z=Jv(),I=Je(z,2),M=I[0],A=I[1],R=KD(ns),j=Je(R,2),D=j[0],$=j[1],F=Jv(null),O=Je(F,2),B=O[0],E=O[1],H=D(),V=g.useRef(!1),L=g.useRef(null);function ne(){return n()}var le=g.useRef(!1);function G(){$(ns),E(null,!0)}var be=Zv(function(Qe){var st=D();if(st!==ns){var wt=ne();if(!(Qe&&!Qe.deadline&&Qe.target!==wt)){var pn=le.current,on;st===sd&&pn?on=C==null?void 0:C(wt,Qe):st===od&&pn?on=k==null?void 0:k(wt,Qe):st===ad&&pn&&(on=T==null?void 0:T(wt,Qe)),pn&&on!==!1&&G()}}}),He=QD(be),de=Je(He,1),Pe=de[0],Re=function(st){switch(st){case sd:return Ce(Ce(Ce({},Nr,f),ma,v),ga,x);case od:return Ce(Ce(Ce({},Nr,p),ma,b),ga,y);case ad:return Ce(Ce(Ce({},Nr,m),ma,_),ga,S);default:return{}}},Ke=g.useMemo(function(){return Re(H)},[H]),_e=nO(H,!e,function(Qe){if(Qe===Nr){var st=Ke[Nr];return st?st(ne()):uN}if(it in Ke){var wt;E(((wt=Ke[it])===null||wt===void 0?void 0:wt.call(Ke,ne(),null))||null)}return it===ga&&H!==ns&&(Pe(ne()),u>0&&(clearTimeout(L.current),L.current=setTimeout(function(){be({deadline:!0})},u))),it===rN&&G(),tO}),$e=Je(_e,2),fn=$e[0],it=$e[1],Rt=dN(it);le.current=Rt;var Gt=g.useRef(null);cN(function(){if(!(V.current&&Gt.current===t)){A(t);var Qe=V.current;V.current=!0;var st;!Qe&&t&&a&&(st=sd),Qe&&t&&s&&(st=od),(Qe&&!t&&c||!Qe&&d&&!t&&c)&&(st=ad);var wt=Re(st);st&&(e||wt[Nr])?($(st),fn()):$(ns),Gt.current=t}},[t]),g.useEffect(function(){(H===sd&&!a||H===od&&!s||H===ad&&!c)&&$(ns)},[a,s,c]),g.useEffect(function(){return function(){V.current=!1,clearTimeout(L.current)}},[]);var Mt=g.useRef(!1);g.useEffect(function(){M&&(Mt.current=!0),M!==void 0&&H===ns&&((Mt.current||M)&&(N==null||N(M)),Mt.current=!0)},[M,H]);var bt=B;return Ke[Nr]&&it===ma&&(bt=Fe({transition:"none"},bt)),[H,it,bt,M??t]}function iO(e){var t=e;Ct(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(nN),b=v.motion,_=n(i,b),x=g.useRef(),y=g.useRef();function S(){try{return x.current instanceof HTMLElement?x.current:AL(y.current)}catch{return null}}var C=rO(_,a,S,i),k=Je(C,4),T=k[0],N=k[1],z=k[2],I=k[3],M=g.useRef(I);I&&(M.current=!0);var A=g.useCallback(function(O){x.current=O,OL(s,O)},[s]),R,j=Fe(Fe({},m),{},{visible:a});if(!d)R=null;else if(T===ns)I?R=d(Fe({},j),A):!c&&M.current&&p?R=d(Fe(Fe({},j),{},{className:p}),A):u||!c&&!p?R=d(Fe(Fe({},j),{},{style:{display:"none"}}),A):R=null;else{var D;N===Nr?D="prepare":dN(N)?D="active":N===ma&&(D="start");var $=cw(f,"".concat(T,"-").concat(D));R=d(Fe(Fe({},j),{},{className:bL(cw(f,T),Ce(Ce({},$,$&&D),f,typeof f=="string")),style:z}),A)}if(g.isValidElement(R)&&BL(R)){var F=zL(R);F||(R=g.cloneElement(R,{ref:A}))}return g.createElement(qD,{ref:y},R)});return r.displayName="CSSMotion",r}const sO=iO(lN);var e0="add",t0="keep",n0="remove",Em="removed";function oO(e){var t;return e&&Ct(e)==="object"&&"key"in e?t=e:t={key:e},Fe(Fe({},t),{},{key:String(t.key)})}function r0(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(oO)}function aO(){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=r0(e),o=r0(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 Fe(Fe({},p),{},{status:e0})})),r=d),n.push(Fe(Fe({},f),{},{status:t0})),r+=1,u=!0;break}}u||n.push(Fe(Fe({},c),{},{status:n0}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return Fe(Fe({},c),{},{status:e0})})));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!==n0}),n.forEach(function(u){u.key===c&&(u.status=t0)})}),n}var lO=["component","children","onVisibleChanged","onAllRemoved"],cO=["status"],uO=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function dO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sO,n=function(r){bT(s,r);var i=ST(s);function s(){var o;rl(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)),Ce(Ev(o),"state",{keyEntities:[]}),Ce(Ev(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:Fe(Fe({},p),{},{status:Em})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==Em}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return il(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=Pv(c,lO),m=u||g.Fragment,v={};return uO.forEach(function(b){v[b]=p[b],delete p[b]}),delete p.keys,g.createElement(m,p,l.map(function(b,_){var x=b.status,y=Pv(b,cO),S=x===e0||x===t0;return g.createElement(t,Oh({},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(Fe(Fe({},C),{},{index:_}),k)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=r0(c),f=aO(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(v){var b=v.key;return p.key===b});return!(m&&m.status===Em&&p.status===n0)})}}}]),s}(g.Component);return Ce(n,"defaultProps",{component:"div"}),n}dO(lN);const uw=g.createContext(!0);function hO(e){const t=g.useContext(uw),{children:n}=e,[,r]=tN(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(uw.Provider,{value:i},g.createElement(VD,{motion:i},n)):n}const fO=()=>null;var pO=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 mO=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let hN;function gO(){return hN||Xv}function vO(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const _O=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(hN=t),r&&vO(r)&&ED(gO(),r)},xO=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:b,parentContext:_,iconPrefixCls:x,theme:y,componentDisabled:S,segmented:C,statistic:k,spin:T,calendar:N,carousel:z,cascader:I,collapse:M,typography:A,checkbox:R,descriptions:j,divider:D,drawer:$,skeleton:F,steps:O,image:B,layout:E,list:H,mentions:V,modal:L,progress:ne,result:le,slider:G,breadcrumb:be,menu:He,pagination:de,input:Pe,textArea:Re,empty:Ke,badge:_e,radio:$e,rate:fn,switch:it,transfer:Rt,avatar:Gt,message:Mt,tag:bt,table:Qe,card:st,tabs:wt,timeline:pn,timePicker:on,upload:U,notification:Z,tree:xe,colorPicker:ke,datePicker:Ue,rangePicker:Nt,flex:Yt,wave:Xt,dropdown:oe,warning:K,tour:Se,tooltip:ht,popover:an,popconfirm:xl,floatButton:yl,floatButtonGroup:Fo,variant:Up,inputNumber:Du,treeSelect:Ou}=e,Bu=g.useCallback((ae,he)=>{const{prefixCls:De}=e;if(he)return he;const $t=De||_.getPrefixCls("");return ae?`${$t}-${ae}`:$t},[_.getPrefixCls,e.prefixCls]),Hs=x||_.iconPrefixCls||ZT,Vi=n||_.csp;zD(Hs,Vi);const bl=UD(y,_.theme,{prefixCls:Bu("")}),qi={csp:Vi,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||b,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:v,getPrefixCls:Bu,iconPrefixCls:Hs,theme:bl,segmented:C,statistic:k,spin:T,calendar:N,carousel:z,cascader:I,collapse:M,typography:A,checkbox:R,descriptions:j,divider:D,drawer:$,skeleton:F,steps:O,image:B,input:Pe,textArea:Re,layout:E,list:H,mentions:V,modal:L,progress:ne,result:le,slider:G,breadcrumb:be,menu:He,pagination:de,empty:Ke,badge:_e,radio:$e,rate:fn,switch:it,transfer:Rt,avatar:Gt,message:Mt,tag:bt,table:Qe,card:st,tabs:wt,timeline:pn,timePicker:on,upload:U,notification:Z,tree:xe,colorPicker:ke,datePicker:Ue,rangePicker:Nt,flex:Yt,wave:Xt,dropdown:oe,warning:K,tour:Se,tooltip:ht,popover:an,popconfirm:xl,floatButton:yl,floatButtonGroup:Fo,variant:Up,inputNumber:Du,treeSelect:Ou},Ki=Object.assign({},_);Object.keys(qi).forEach(ae=>{qi[ae]!==void 0&&(Ki[ae]=qi[ae])}),mO.forEach(ae=>{const he=e[ae];he&&(Ki[ae]=he)}),typeof r<"u"&&(Ki.button=Object.assign({autoInsertSpace:r},Ki.button));const Gi=xT(()=>Ki,Ki,(ae,he)=>{const De=Object.keys(ae),$t=Object.keys(he);return De.length!==$t.length||De.some(Us=>ae[Us]!==he[Us])}),{layer:Ho}=g.useContext(Qf),Uo=g.useMemo(()=>({prefixCls:Hs,csp:Vi,layer:Ho?"antd":void 0}),[Hs,Vi,Ho]);let zt=g.createElement(g.Fragment,null,g.createElement(fO,{dropdownMatchSelectWidth:p}),t);const wl=g.useMemo(()=>{var ae,he,De,$t;return iD(((ae=ep.Form)===null||ae===void 0?void 0:ae.defaultValidateMessages)||{},((De=(he=Gi.locale)===null||he===void 0?void 0:he.Form)===null||De===void 0?void 0:De.defaultValidateMessages)||{},(($t=Gi.form)===null||$t===void 0?void 0:$t.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[Gi,o==null?void 0:o.validateMessages]);Object.keys(wl).length>0&&(zt=g.createElement(oD.Provider,{value:wl},zt)),a&&(zt=g.createElement(cD,{locale:a,_ANT_MARK__:lD},zt)),zt=g.createElement(eD.Provider,{value:Uo},zt),l&&(zt=g.createElement(ND,{size:l},zt)),zt=g.createElement(hO,null,zt);const te=g.useMemo(()=>{const ae=bl||{},{algorithm:he,token:De,components:$t,cssVar:Us}=ae,z5=pO(ae,["algorithm","token","components","cssVar"]),v1=he&&(!Array.isArray(he)||he.length>0)?Mv(he):XT,Wp={};Object.entries($t||{}).forEach(([$5,F5])=>{const pi=Object.assign({},F5);"algorithm"in pi&&(pi.algorithm===!0?pi.theme=v1:(Array.isArray(pi.algorithm)||typeof pi.algorithm=="function")&&(pi.theme=Mv(pi.algorithm)),delete pi.algorithm),Wp[$5]=pi});const _1=Object.assign(Object.assign({},Hc),De);return Object.assign(Object.assign({},z5),{theme:v1,token:_1,components:Wp,override:Object.assign({override:_1},Wp),cssVar:Us})},[bl]);return y&&(zt=g.createElement(QT.Provider,{value:te},zt)),Gi.warning&&(zt=g.createElement(sD.Provider,{value:Gi.warning},zt)),S!==void 0&&(zt=g.createElement(TD,{disabled:S},zt)),g.createElement(tp.Provider,{value:Gi},zt)},ol=e=>{const t=g.useContext(tp),n=g.useContext(qT);return g.createElement(xO,Object.assign({parentContext:t,legacyLocale:n},e))};ol.ConfigContext=tp;ol.SizeContext=Uc;ol.config=_O;ol.useConfig=ID;Object.defineProperty(ol,"SizeContext",{get:()=>Uc});const lr=(e,t)=>new _t(e).setA(t).toRgbString(),qo=(e,t)=>new _t(e).lighten(t).toHexString(),yO=e=>{const t=$a(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]}},bO=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:lr(r,.85),colorTextSecondary:lr(r,.65),colorTextTertiary:lr(r,.45),colorTextQuaternary:lr(r,.25),colorFill:lr(r,.18),colorFillSecondary:lr(r,.12),colorFillTertiary:lr(r,.08),colorFillQuaternary:lr(r,.04),colorBgSolid:lr(r,.95),colorBgSolidHover:lr(r,1),colorBgSolidActive:lr(r,.9),colorBgElevated:qo(n,12),colorBgContainer:qo(n,8),colorBgLayout:qo(n,0),colorBgSpotlight:qo(n,26),colorBgBlur:lr(r,.04),colorBorder:qo(n,26),colorBorderSecondary:qo(n,19)}},wO=(e,t)=>{const n=Object.keys(Rx).map(s=>{const o=$a(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??Mx(e),i=YT(e,{generateColorPalettes:yO,generateNeutralColorPalettes:bO});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},dw={defaultSeed:$h.token,defaultAlgorithm:Mx,darkAlgorithm:wO};function hw({children:e}){const t=Sx(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(ol,{theme:{algorithm:n.mode==="dark"?dw.darkAlgorithm:dw.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var Ye;(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})(Ye||(Ye={}));var fw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(fw||(fw={}));const ue=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),os=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}},Y=Ye.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 Li 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 Li))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ye.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()}}Li.create=e=>new Li(e);const i0=(e,t)=>{let n;switch(e.code){case Y.invalid_type:e.received===ue.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Y.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ye.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ye.joinValues(e.keys,", ")}`;break;case Y.invalid_union:n="Invalid input";break;case Y.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ye.joinValues(e.options)}`;break;case Y.invalid_enum_value:n=`Invalid enum value. Expected ${Ye.joinValues(e.options)}, received '${e.received}'`;break;case Y.invalid_arguments:n="Invalid function arguments";break;case Y.invalid_return_type:n="Invalid function return type";break;case Y.invalid_date:n="Invalid date";break;case Y.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}"`:Ye.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Y.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 Y.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 Y.custom:n="Invalid input";break;case Y.invalid_intersection_types:n="Intersection results could not be merged";break;case Y.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Y.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ye.assertNever(e)}return{message:n}};let SO=i0;function kO(){return SO}const CO=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 re(e,t){const n=kO(),r=CO({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===i0?void 0:i0].filter(i=>!!i)});e.common.issues.push(r)}class In{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 Te;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 In.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 Te;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 Te=Object.freeze({status:"aborted"}),Gl=e=>({status:"dirty",value:e}),Sr=e=>({status:"valid",value:e}),pw=e=>e.status==="aborted",mw=e=>e.status==="dirty",Fa=e=>e.status==="valid",Fh=e=>typeof Promise<"u"&&e instanceof Promise;var ve;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ve||(ve={}));class si{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 gw=(e,t)=>{if(Fa(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 Li(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 qe{get description(){return this._def.description}_getType(t){return os(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:os(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new In,ctx:{common:t.parent.common,data:t.data,parsedType:os(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Fh(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:os(t)},i=this._parseSync({data:t,path:r.path,parent:r});return gw(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:os(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return Fa(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=>Fa(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:os(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Fh(i)?i:Promise.resolve(i));return gw(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:Y.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 _o({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 Ni.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ti.create(this)}promise(){return Kh.create(this,this._def)}or(t){return Uh.create([this,t],this._def)}and(t){return Wh.create(this,t,this._def)}transform(t){return new _o({...Le(this._def),schema:this,typeName:Ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Gh({...Le(this._def),innerType:this,defaultValue:n,typeName:Ne.ZodDefault})}brand(){return new gN({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 jx.create(this,t)}readonly(){return Xh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const EO=/^c[^\s-]{8,}$/i,TO=/^[0-9a-z]+$/,NO=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IO=/^[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,PO=/^[a-z0-9_-]{21}$/i,RO=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,MO=/^[-+]?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)?)??$/,AO=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,LO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Tm;const jO=/^(?:(?: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])$/,DO=/^(?:(?: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])$/,OO=/^(([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]))$/,BO=/^(([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])$/,zO=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$O=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fN="((\\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])))",FO=new RegExp(`^${fN}$`);function pN(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 HO(e){return new RegExp(`^${pN(e)}$`)}function UO(e){let t=`${fN}T${pN(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 WO(e,t){return!!((t==="v4"||!t)&&jO.test(e)||(t==="v6"||!t)&&OO.test(e))}function VO(e,t){if(!RO.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 qO(e,t){return!!((t==="v4"||!t)&&DO.test(e)||(t==="v6"||!t)&&BO.test(e))}class ki extends qe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){const s=this._getOrReturnCtx(t);return re(s,{code:Y.invalid_type,expected:ue.string,received:s.parsedType}),Te}const r=new In;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:Y.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),re(i,{code:Y.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?re(i,{code:Y.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&re(i,{code:Y.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")AO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"email",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Tm||(Tm=new RegExp(LO,"u")),Tm.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"emoji",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")IO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"uuid",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")PO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"nanoid",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")EO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cuid",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")TO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cuid2",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")NO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"ulid",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),re(i,{validation:"url",code:Y.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),re(i,{validation:"regex",code:Y.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),re(i,{code:Y.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),re(i,{code:Y.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),re(i,{code:Y.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?UO(s).test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:Y.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?FO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:Y.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?HO(s).test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:Y.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?MO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"duration",code:Y.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?WO(t.data,s.version)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"ip",code:Y.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?VO(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"jwt",code:Y.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?qO(t.data,s.version)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cidr",code:Y.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?zO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"base64",code:Y.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?$O.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"base64url",code:Y.invalid_string,message:s.message}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:Y.invalid_string,...ve.errToObj(r)})}_addCheck(t){return new ki({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ve.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ve.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ve.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ve.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ve.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ve.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ve.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ve.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ve.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ve.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ve.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ve.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ve.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,...ve.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,...ve.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ve.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ve.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ve.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ve.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ve.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ve.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ve.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ve.errToObj(n)})}nonempty(t){return this.min(1,ve.errToObj(t))}trim(){return new ki({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ki({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ki({...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}}ki.create=e=>new ki({checks:[],typeName:Ne.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Le(e)});function KO(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 Ha extends qe{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)!==ue.number){const s=this._getOrReturnCtx(t);return re(s,{code:Y.invalid_type,expected:ue.number,received:s.parsedType}),Te}let r;const i=new In;for(const s of this._def.checks)s.kind==="int"?Ye.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),re(r,{code:Y.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),re(r,{code:Y.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),re(r,{code:Y.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?KO(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),re(r,{code:Y.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),re(r,{code:Y.not_finite,message:s.message}),i.dirty()):Ye.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ve.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ve.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ve.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ve.toString(n))}setLimit(t,n,r,i){return new Ha({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ve.toString(i)}]})}_addCheck(t){return new Ha({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ve.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ve.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ve.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ve.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ve.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ve.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ve.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ve.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ve.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"&&Ye.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)}}Ha.create=e=>new Ha({checks:[],typeName:Ne.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class Wc extends qe{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)!==ue.bigint)return this._getInvalidInput(t);let r;const i=new In;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),re(r,{code:Y.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),re(r,{code:Y.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),re(r,{code:Y.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Ye.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return re(n,{code:Y.invalid_type,expected:ue.bigint,received:n.parsedType}),Te}gte(t,n){return this.setLimit("min",t,!0,ve.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ve.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ve.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ve.toString(n))}setLimit(t,n,r,i){return new Wc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ve.toString(i)}]})}_addCheck(t){return new Wc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ve.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ve.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ve.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ve.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ve.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}}Wc.create=e=>new Wc({checks:[],typeName:Ne.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Le(e)});class s0 extends qe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.boolean,received:r.parsedType}),Te}return Sr(t.data)}}s0.create=e=>new s0({typeName:Ne.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class Hh extends qe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){const s=this._getOrReturnCtx(t);return re(s,{code:Y.invalid_type,expected:ue.date,received:s.parsedType}),Te}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return re(s,{code:Y.invalid_date}),Te}const r=new In;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:Y.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),re(i,{code:Y.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Hh({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ve.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ve.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}}Hh.create=e=>new Hh({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ne.ZodDate,...Le(e)});class vw extends qe{_parse(t){if(this._getType(t)!==ue.symbol){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.symbol,received:r.parsedType}),Te}return Sr(t.data)}}vw.create=e=>new vw({typeName:Ne.ZodSymbol,...Le(e)});class o0 extends qe{_parse(t){if(this._getType(t)!==ue.undefined){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.undefined,received:r.parsedType}),Te}return Sr(t.data)}}o0.create=e=>new o0({typeName:Ne.ZodUndefined,...Le(e)});class a0 extends qe{_parse(t){if(this._getType(t)!==ue.null){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.null,received:r.parsedType}),Te}return Sr(t.data)}}a0.create=e=>new a0({typeName:Ne.ZodNull,...Le(e)});class _w extends qe{constructor(){super(...arguments),this._any=!0}_parse(t){return Sr(t.data)}}_w.create=e=>new _w({typeName:Ne.ZodAny,...Le(e)});class l0 extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sr(t.data)}}l0.create=e=>new l0({typeName:Ne.ZodUnknown,...Le(e)});class Is extends qe{_parse(t){const n=this._getOrReturnCtx(t);return re(n,{code:Y.invalid_type,expected:ue.never,received:n.parsedType}),Te}}Is.create=e=>new Is({typeName:Ne.ZodNever,...Le(e)});class xw extends qe{_parse(t){if(this._getType(t)!==ue.undefined){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.void,received:r.parsedType}),Te}return Sr(t.data)}}xw.create=e=>new xw({typeName:Ne.ZodVoid,...Le(e)});class ti extends qe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==ue.array)return re(n,{code:Y.invalid_type,expected:ue.array,received:n.parsedType}),Te;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(re(n,{code:o?Y.too_big:Y.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&&(re(n,{code:Y.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&&(re(n,{code:Y.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 si(n,o,n.path,a)))).then(o=>In.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new si(n,o,n.path,a)));return In.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ti({...this._def,minLength:{value:t,message:ve.toString(n)}})}max(t,n){return new ti({...this._def,maxLength:{value:t,message:ve.toString(n)}})}length(t,n){return new ti({...this._def,exactLength:{value:t,message:ve.toString(n)}})}nonempty(t){return this.min(1,t)}}ti.create=(e,t)=>new ti({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ne.ZodArray,...Le(t)});function ta(e){if(e instanceof jt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ni.create(ta(r))}return new jt({...e._def,shape:()=>t})}else return e instanceof ti?new ti({...e._def,type:ta(e.element)}):e instanceof Ni?Ni.create(ta(e.unwrap())):e instanceof xo?xo.create(ta(e.unwrap())):e instanceof go?go.create(e.items.map(t=>ta(t))):e}class jt extends qe{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=Ye.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ue.object){const c=this._getOrReturnCtx(t);return re(c,{code:Y.invalid_type,expected:ue.object,received:c.parsedType}),Te}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Is&&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 si(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Is){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&&(re(i,{code:Y.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 si(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=>In.mergeObjectSync(r,c)):In.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ve.errToObj,new jt({...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:ve.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new jt({...this._def,unknownKeys:"strip"})}passthrough(){return new jt({...this._def,unknownKeys:"passthrough"})}extend(t){return new jt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new jt({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 jt({...this._def,catchall:t})}pick(t){const n={};for(const r of Ye.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new jt({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Ye.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new jt({...this._def,shape:()=>n})}deepPartial(){return ta(this)}partial(t){const n={};for(const r of Ye.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new jt({...this._def,shape:()=>n})}required(t){const n={};for(const r of Ye.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ni;)s=s._def.innerType;n[r]=s}return new jt({...this._def,shape:()=>n})}keyof(){return mN(Ye.objectKeys(this.shape))}}jt.create=(e,t)=>new jt({shape:()=>e,unknownKeys:"strip",catchall:Is.create(),typeName:Ne.ZodObject,...Le(t)});jt.strictCreate=(e,t)=>new jt({shape:()=>e,unknownKeys:"strict",catchall:Is.create(),typeName:Ne.ZodObject,...Le(t)});jt.lazycreate=(e,t)=>new jt({shape:e,unknownKeys:"strip",catchall:Is.create(),typeName:Ne.ZodObject,...Le(t)});class Uh extends qe{_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 Li(a.ctx.common.issues));return re(n,{code:Y.invalid_union,unionErrors:o}),Te}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 Li(l));return re(n,{code:Y.invalid_union,unionErrors:a}),Te}}get options(){return this._def.options}}Uh.create=(e,t)=>new Uh({options:e,typeName:Ne.ZodUnion,...Le(t)});const _i=e=>e instanceof u0?_i(e.schema):e instanceof _o?_i(e.innerType()):e instanceof qh?[e.value]:e instanceof vo?e.options:e instanceof d0?Ye.objectValues(e.enum):e instanceof Gh?_i(e._def.innerType):e instanceof o0?[void 0]:e instanceof a0?[null]:e instanceof Ni?[void 0,..._i(e.unwrap())]:e instanceof xo?[null,..._i(e.unwrap())]:e instanceof gN||e instanceof Xh?_i(e.unwrap()):e instanceof Yh?_i(e._def.innerType):[];class Lx extends qe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.object)return re(n,{code:Y.invalid_type,expected:ue.object,received:n.parsedType}),Te;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}):(re(n,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Te)}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=_i(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 Lx({typeName:Ne.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Le(r)})}}function c0(e,t){const n=os(e),r=os(t);if(e===t)return{valid:!0,data:e};if(n===ue.object&&r===ue.object){const i=Ye.objectKeys(t),s=Ye.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=c0(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===ue.array&&r===ue.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=c0(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===ue.date&&r===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Wh extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(pw(s)||pw(o))return Te;const a=c0(s.value,o.value);return a.valid?((mw(s)||mw(o))&&n.dirty(),{status:n.value,value:a.data}):(re(r,{code:Y.invalid_intersection_types}),Te)};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}))}}Wh.create=(e,t,n)=>new Wh({left:e,right:t,typeName:Ne.ZodIntersection,...Le(n)});class go extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.array)return re(r,{code:Y.invalid_type,expected:ue.array,received:r.parsedType}),Te;if(r.data.length<this._def.items.length)return re(r,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Te;!this._def.rest&&r.data.length>this._def.items.length&&(re(r,{code:Y.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 si(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>In.mergeArray(n,o)):In.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new go({...this._def,rest:t})}}go.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new go({items:e,typeName:Ne.ZodTuple,rest:null,...Le(t)})};class Vh extends qe{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!==ue.object)return re(r,{code:Y.invalid_type,expected:ue.object,received:r.parsedType}),Te;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new si(r,a,r.path,a)),value:o._parse(new si(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?In.mergeObjectAsync(n,i):In.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof qe?new Vh({keyType:t,valueType:n,typeName:Ne.ZodRecord,...Le(r)}):new Vh({keyType:ki.create(),valueType:t,typeName:Ne.ZodRecord,...Le(n)})}}class yw extends qe{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!==ue.map)return re(r,{code:Y.invalid_type,expected:ue.map,received:r.parsedType}),Te;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new si(r,a,r.path,[c,"key"])),value:s._parse(new si(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 Te;(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 Te;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}yw.create=(e,t,n)=>new yw({valueType:t,keyType:e,typeName:Ne.ZodMap,...Le(n)});class Vc extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.set)return re(r,{code:Y.invalid_type,expected:ue.set,received:r.parsedType}),Te;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(re(r,{code:Y.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&&(re(r,{code:Y.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 Te;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 si(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new Vc({...this._def,minSize:{value:t,message:ve.toString(n)}})}max(t,n){return new Vc({...this._def,maxSize:{value:t,message:ve.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Vc.create=(e,t)=>new Vc({valueType:e,minSize:null,maxSize:null,typeName:Ne.ZodSet,...Le(t)});class u0 extends qe{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})}}u0.create=(e,t)=>new u0({getter:e,typeName:Ne.ZodLazy,...Le(t)});class qh extends qe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return re(n,{received:n.data,code:Y.invalid_literal,expected:this._def.value}),Te}return{status:"valid",value:t.data}}get value(){return this._def.value}}qh.create=(e,t)=>new qh({value:e,typeName:Ne.ZodLiteral,...Le(t)});function mN(e,t){return new vo({values:e,typeName:Ne.ZodEnum,...Le(t)})}class vo extends qe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return re(n,{expected:Ye.joinValues(r),received:n.parsedType,code:Y.invalid_type}),Te}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 re(n,{received:n.data,code:Y.invalid_enum_value,options:r}),Te}return Sr(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 vo.create(t,{...this._def,...n})}exclude(t,n=this._def){return vo.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}vo.create=mN;class d0 extends qe{_parse(t){const n=Ye.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ue.string&&r.parsedType!==ue.number){const i=Ye.objectValues(n);return re(r,{expected:Ye.joinValues(i),received:r.parsedType,code:Y.invalid_type}),Te}if(this._cache||(this._cache=new Set(Ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Ye.objectValues(n);return re(r,{received:r.data,code:Y.invalid_enum_value,options:i}),Te}return Sr(t.data)}get enum(){return this._def.values}}d0.create=(e,t)=>new d0({values:e,typeName:Ne.ZodNativeEnum,...Le(t)});class Kh extends qe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.promise&&n.common.async===!1)return re(n,{code:Y.invalid_type,expected:ue.promise,received:n.parsedType}),Te;const r=n.parsedType===ue.promise?n.data:Promise.resolve(n.data);return Sr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Kh.create=(e,t)=>new Kh({type:e,typeName:Ne.ZodPromise,...Le(t)});class _o extends qe{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=>{re(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 Te;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Te:l.status==="dirty"||n.value==="dirty"?Gl(l.value):l});{if(n.value==="aborted")return Te;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Te:a.status==="dirty"||n.value==="dirty"?Gl(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"?Te:(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"?Te:(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(!Fa(o))return Te;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=>Fa(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):Te);Ye.assertNever(i)}}_o.create=(e,t,n)=>new _o({schema:e,typeName:Ne.ZodEffects,effect:t,...Le(n)});_o.createWithPreprocess=(e,t,n)=>new _o({schema:t,effect:{type:"preprocess",transform:e},typeName:Ne.ZodEffects,...Le(n)});class Ni extends qe{_parse(t){return this._getType(t)===ue.undefined?Sr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ni.create=(e,t)=>new Ni({innerType:e,typeName:Ne.ZodOptional,...Le(t)});class xo extends qe{_parse(t){return this._getType(t)===ue.null?Sr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}xo.create=(e,t)=>new xo({innerType:e,typeName:Ne.ZodNullable,...Le(t)});class Gh extends qe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ue.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Gh.create=(e,t)=>new Gh({innerType:e,typeName:Ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Le(t)});class Yh extends qe{_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 Fh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Li(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Li(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 bw extends qe{_parse(t){if(this._getType(t)!==ue.nan){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.nan,received:r.parsedType}),Te}return{status:"valid",value:t.data}}}bw.create=e=>new bw({typeName:Ne.ZodNaN,...Le(e)});class gN extends qe{_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 jx extends qe{_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"?Te:s.status==="dirty"?(n.dirty(),Gl(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"?Te: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 jx({in:t,out:n,typeName:Ne.ZodPipeline})}}class Xh extends qe{_parse(t){const n=this._def.innerType._parse(t),r=i=>(Fa(i)&&(i.value=Object.freeze(i.value)),i);return Fh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Xh.create=(e,t)=>new Xh({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 w=ki.create,q=Ha.create,ye=s0.create,ks=l0.create;Is.create;const ie=ti.create,P=jt.create;Uh.create;const ci=Lx.create;Wh.create;go.create;const Ds=Vh.create,J=qh.create,je=vo.create;Kh.create;Ni.create;xo.create;new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");const GO=["owner"],YO=["agent","owner","user-upload"],vN=P({id:w().min(1),relPath:w().min(1),from:je(YO),label:w().optional(),size:q().int().nonnegative(),mime:w().min(1),addedAt:q().int().nonnegative(),lastEditedAt:q().int().nonnegative().optional(),stale:ye().optional()});P({sessionId:w().min(1),relPath:w().min(1),ttlSeconds:q().int().positive().nullable().optional(),view:je(["raw","md-rendered"]).optional()});P({url:w().min(1),expiresAt:q().int().nonnegative().nullable()});P({sessionId:w().min(1),relPath:w().min(1),label:w().optional(),origin:J("agent").optional()});P({entry:vN});P({sessionId:w().min(1),relPath:w().min(1)});P({removed:J(!0)});P({sessionId:w().min(1)});P({entries:ie(vN)});P({attachmentId:w().min(1),url:w().min(1),relPath:w().min(1),sizeBytes:q().int().nonnegative(),mimeType:w().min(1)});const XO=ci("type",[P({type:J("persona"),id:w().min(1)}).strict(),P({type:J("chat"),id:w().min(1)}).strict(),P({type:J("*")}).strict()]),QO=je(["read","send","admin"]),Dx=P({resource:XO,actions:ie(QO).min(1)}).strict(),ZO=P({id:w().min(1),secretHash:w().regex(/^[a-f0-9]{64}$/),displayName:w(),grants:ie(Dx),issuedAt:q().int().nonnegative(),expiresAt:q().int().positive().optional(),maxUses:q().int().positive().optional(),usedCount:q().int().nonnegative(),peerOwnerId:w().min(1).optional(),firstUsedByPeerAt:q().int().positive().optional(),peerDisplayName:w().optional()}).strict(),JO=ZO.omit({secretHash:!0});P({type:J("whoami:ok"),owner:P({id:w(),kind:je(["owner","guest"]),displayName:w(),ownerId:w(),provider:w()}).strict(),capability:JO,grantedPersonas:ie(P({id:w().min(1),displayName:w()}).strict())}).strict();P({selfUrl:w().min(1)});P({type:J("contact:handshake:ok"),owner:P({id:w(),ownerId:w(),provider:w(),displayName:w()}),grants:ie(Dx)});P({deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();P({type:J("contact:setRemoteAccess:ok"),deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();P({type:J("contact:remote-access-updated"),deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();const e6=P({deviceId:w().min(1),ownerId:w().min(1),provider:w().min(1),displayName:w(),remoteUrl:w().min(1),connectToken:w(),grants:ie(Dx),addedAt:q().int().nonnegative(),pinnedAt:q().int().nullable().default(null),remoteAccessAllowed:ye().default(!1)}).strict(),_N=e6;P({deviceId:w().min(1)}).strict();P({type:J("contact:remove:ok"),deviceId:w().min(1)}).strict();P({type:J("contact:list:ok"),contacts:ie(_N)}).strict();P({type:J("contact:added"),contact:_N}).strict();P({type:J("contact:removed"),deviceId:w().min(1)}).strict();P({deviceId:w().min(1),pinned:ye()}).strict();P({type:J("contact:pin:ok"),deviceId:w().min(1),pinnedAt:q().int().nullable()}).strict();P({type:J("contact:pinned"),deviceId:w().min(1),pinnedAt:q().int().nullable()}).strict();const t6=P({deviceId:w().min(1),name:w().min(1),url:w().min(1)});P({type:J("device:list:ok"),devices:ie(t6)});P({deviceId:w().min(1),url:w().min(1).optional(),name:w().optional()});P({type:J("device:connect:ok"),deviceId:w(),name:w(),url:w()});const xN=P({ownerId:w().min(1),provider:w().min(1),displayName:w().min(1),avatarUrl:w().optional(),unionId:w().optional()});P({type:J("auth:login:start:ok"),authUrl:w().min(1),state:w().min(1)});P({type:J("auth:getIdentity:ok"),identity:xN.nullable(),deviceId:w().min(1),ttcTokenExpiresAt:q().nullable().optional()});P({type:J("auth:logout:ok")});P({type:J("auth:login:done"),identity:xN});P({type:J("auth:login:failed"),reason:w()});const Ox=ci("kind",[P({kind:J("success"),text:w(),filePaths:ie(w()).optional()}),P({kind:J("failure"),reason:w()})]);P({targetPersona:w().min(1).optional(),dispatchId:w().min(1).optional(),prompt:w(),targetDeviceId:w().min(1).optional(),model:w().min(1).optional(),sessionLabel:w().min(1).max(60).optional(),meta:Ds(ks()).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)"});P({dispatchId:w().min(1),outcome:Ox});const n6=["running","completed","failed"],Bx=je(n6),r6=P({dispatchId:w().min(1),sourceSessionId:w().min(1),sourcePersonaId:w().min(1).optional(),targetPersonaId:w().min(1),workerSessionId:w().min(1).optional(),taskText:w(),status:Bx,outcome:Ox.optional(),meta:Ds(ks()).optional(),createdAt:w().min(1),completedAt:w().min(1).optional(),deliveredAt:w().min(1).optional()});P({sourceSessionId:w().min(1).optional()});P({records:ie(r6)});P({dispatchId:w().min(1)});P({type:J("personaDispatch:get:ok"),status:Bx,outcome:Ox.optional()});const i6=/^[a-z0-9][a-z0-9-]*$/;je(["stopped","starting","running","crashed","invalid"]);const s6=new Set(["localhost","127.0.0.1"]);function o6(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&s6.has(t.hostname))}const cd=P({id:w().regex(i6),name:w().min(1),version:w().min(1),apiVersion:J("1"),runtime:P({startCommand:w().min(1)}).passthrough().optional(),entry:P({url:w().url().refine(o6,{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:Y.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:Y.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),a6=ci("kind",[P({kind:J("local"),port:q().int().min(1).max(65535)}),P({kind:J("hosted"),url:w().url()})]);ci("state",[P({extId:w(),manifest:cd,state:J("stopped")}),P({extId:w(),manifest:cd,state:J("starting")}),P({extId:w(),manifest:cd,state:J("running"),target:a6}),P({extId:w(),manifest:cd,state:J("crashed")}),P({extId:w(),manifest:ks().nullable(),state:J("invalid"),invalidReason:w().min(1)})]);P({snapshotHash:w().min(1),version:w().min(1),publishedAt:q()});const l6=ci("kind",[P({kind:J("p2p-tunnel"),ownerPrincipalId:w().min(1),extId:w().min(1)})]);ci("kind",[P({kind:J("p2p-tunnel"),ownerPrincipalId:w().min(1),extId:w().min(1),snapshotHash:w().min(1)})]);P({extId:w().min(1),name:w().min(1),version:w().min(1),contentHash:w().min(1),publishedAt:q()});const c6=ci("kind",[P({kind:J("clean")}),P({kind:J("ready-new-version"),fromVersion:w().min(1),toVersion:w().min(1)}),P({kind:J("error-same-hash"),version:w().min(1)}),P({kind:J("error-version-not-bumped"),localVersion:w().min(1),publishedVersion:w().min(1)}),P({kind:J("error-version-regression"),localVersion:w().min(1),publishedVersion:w().min(1)})]);P({localManifest:P({name:w().min(1),version:w().min(1),contentHash:w().min(1)}),publishState:ci("kind",[P({kind:J("unpublished")}),P({kind:J("published"),version:w().min(1),contentHash:w().min(1),publishedAt:q()})]),check:c6});P({extId:w().min(1),newVersion:w().min(1).nullish()});P({extId:w().min(1)});P({extId:w().min(1),snapshotHash:w().min(1)});P({channelRef:l6,snapshotHash:w().min(1),zipBase64:w().min(1)});P({id:w().min(1),peerDeviceId:w().min(1),senderDeviceId:w().min(1),text:w().min(1),createdAt:q().int().nonnegative(),readBy:Ds(w().min(1),q().int().positive()).default({}),origin:P({kind:J("persona"),personaId:w().min(1)}).optional()}).strict();P({peerDeviceId:w().min(1).optional(),id:w().min(1),text:w().min(1),createdAt:q().int().nonnegative(),origin:P({kind:J("persona"),personaId:w().min(1)}).optional()}).strict();P({peerDeviceId:w().min(1),sinceCreatedAt:q().int().nonnegative().optional()}).strict();P({peerDeviceId:w().min(1),upToCreatedAt:q().int().nonnegative()}).strict();P({peerDeviceId:w().min(1).optional(),text:w().min(1)});P({peerDeviceId:w().min(1).optional(),command:w().min(1),timeoutMs:q().int().positive().optional()}).strict();P({type:J("peerExec:run:ok"),stdout:w(),stderr:w(),exitCode:q().int().nullable(),timedOut:ye(),stdoutTruncated:ye(),stderrTruncated:ye()}).strict();const yN=ci("kind",[P({kind:J("at"),at:w().min(1)}),P({kind:J("every"),everyMs:q().int().positive(),anchorMs:q().int().nonnegative().optional()}),P({kind:J("cron"),expr:w().min(1),tz:w().min(1).optional()})]),mu=w().trim().min(1);P({personaId:mu,name:w().min(1),schedule:yN,prompt:w().min(1),targetPersona:w().min(1).optional(),timeoutMs:q().int().positive().optional()});P({personaId:mu,onlyMine:ye().optional()});P({personaId:mu,shiftId:w().min(1)});const u6=P({name:w().min(1).optional(),schedule:yN.optional(),prompt:w().min(1).optional(),targetPersona:w().min(1).optional(),timeoutMs:q().int().positive().optional(),enabled:ye().optional()});P({personaId:mu,shiftId:w().min(1),patch:u6});P({personaId:mu,shiftId:w().min(1),limit:q().int().positive().optional()});const bN=P({id:w().min(1),name:w().min(1),memberPersonaIds:ie(w().min(1)),memberContactDeviceIds:ie(w().min(1)),createdAt:w().min(1),updatedAt:w().min(1)}),wN=w().trim().min(1);P({name:wN,memberPersonaIds:ie(w().min(1)).default([]),memberContactDeviceIds:ie(w().min(1)).default([])});P({channelId:w().min(1),name:wN.optional(),memberPersonaIds:ie(w().min(1)).optional(),memberContactDeviceIds:ie(w().min(1)).optional()});P({channelId:w().min(1)});P({channels:ie(bN)});P({channel:bN});P({ok:J(!0),removedTopics:q().int().min(0)});const $n=w().trim().min(1),d6=["planning","running","done","archived"],h6=je(d6),f6=P({at:w().min(1),actor:w().min(1),action:w().min(1),target:w().optional(),reason:w().min(1),artifacts:ie($n).optional()}),p6=P({rejectCount:q().int().min(0),accepted:ye().default(!1)}),zx=P({id:w().min(1),channelId:w().min(1),title:w(),masterSessionId:w().min(1),goal:w(),boundaries:w(),acceptanceCriteria:ie(w()),activity:ie(f6),lineMeta:Ds(p6),state:h6,createdAt:w().min(1),updatedAt:w().min(1)}),m6=P({lineId:w().min(1),dispatchId:w().min(1),workerSessionId:w().optional(),assignee:w().min(1),focus:w(),status:Bx,acceptance:ie(w()),rejectCount:q().int().min(0),accepted:ye()});P({channelId:w().min(1)});P({topicId:w().min(1).optional(),sessionId:w().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});P({channelId:w().min(1),title:$n.optional()});P({topicId:w().min(1),title:$n.optional(),goal:$n,boundaries:w(),acceptanceCriteria:ie($n).min(1)});P({topicId:w().min(1),action:$n,target:$n.optional(),reason:$n,artifacts:ie($n).optional()});P({topicId:w().min(1),lineId:$n,reason:$n});P({topicId:w().min(1),lineId:$n,reason:$n,artifacts:ie($n).optional()});P({topicId:w().min(1),state:je(["done","archived"])});const g6=zx.extend({lineCount:q().int().min(0)});P({topics:ie(g6)});P({topic:zx,lines:ie(m6)});P({topicId:w().min(1),masterSessionId:w().min(1)});P({rejectCount:q().int().min(1),needsOwnerAttention:ye()});P({acceptedLines:q().int().min(1),totalLines:q().int().min(1),allAccepted:ye()});P({topic:zx});P({dispatchId:w().min(1)});P({digest:w(),truncated:ye()});const v6=["ask","allow","deny"],SN=je(v6),_6=P({id:w().min(1),desc:w().min(1),action:SN});P({rules:ie(_6)});P({ruleId:w().min(1)});P({action:SN,desc:w(),source:w().min(1)});const x6=["created","review-requested"],kN=/^[A-Za-z0-9._-]+$/,al=w().min(1).regex(kN),ll=w().min(1).regex(kN),gu=q().int().positive();P({role:je(x6)});P({owner:al,repo:ll,number:gu});P({owner:al,repo:ll,number:gu,expectedHeadSha:w().min(1)});P({owner:al,repo:ll,number:gu,body:w().min(1)});P({owner:al,repo:ll,number:gu,ready:ye()});P({owner:al,repo:ll});P({owner:al,repo:ll,number:gu,reviewers:ie(w().min(1)).min(1)});P({personaId:w().min(1)});const y6=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],b6=je(y6);P({personaId:w().min(1),appId:w().min(1),appSecret:w().min(1),botName:w().min(1).optional()});const w6=P({chatId:w().min(1),chatName:w().optional(),lastActiveAt:q().int().optional()}),S6=P({state:je(["unbound","provisioning","bound","broken"]),appId:w().optional(),botName:w().optional(),brokenReason:w().optional(),qrUrl:w().optional(),errorReason:b6.optional(),groups:ie(w6)});S6.extend({personaId:w().min(1)});P({});P({onboardingCompletedAt:q()});P({});P({tools:ie(P({id:je(["claude","codex"]),available:ye(),version:w().optional(),path:w().optional()}))});P({});const k6=P({tool:je(["claude","codex"]),cwd:w(),toolSessionId:w(),label:w().optional(),createdAt:w(),updatedAt:w(),turns:q()});P({candidates:ie(k6)});P({});P({registered:ye()});const C6=P({personaId:w(),label:w(),model:w().optional(),effort:w().optional(),public:ye(),iconKey:w().optional(),tool:w().optional(),createdAt:q(),updatedAt:q()}).strict(),E6=P({name:w().min(1),description:w().optional()}),T6=P({id:w().min(1)}),N6=P({permissions:P({defaultMode:w().optional(),allow:ie(w()).optional(),deny:ie(w()).optional()}).optional(),sandbox:P({enabled:ye().optional(),autoAllowBashIfSandboxed:ye().optional(),allowUnsandboxedCommands:ye().optional(),excludedCommands:ie(w()).optional(),filesystem:P({denyRead:ie(w()).optional(),allowRead:ie(w()).optional(),denyWrite:ie(w()).optional(),allowWrite:ie(w()).optional()}).optional(),network:P({allowedDomains:ie(w()).optional(),allowLocalBinding:ye().optional()}).optional()}).optional()});C6.extend({personality:w().optional(),skills:ie(E6).optional(),plugins:ie(T6).optional(),sandboxSettings:N6.nullable().optional()});P({slug:w().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:w().min(1),personality:w(),model:w().optional(),effort:w().optional(),tool:w().optional(),public:ye().optional(),iconKey:w().optional()}).strict();P({personaId:w().min(1)});P({personaId:w().min(1),patch:P({label:w().min(1).optional(),model:w().optional(),effort:w().optional(),tool:w().optional(),personality:w().optional(),public:ye().optional(),iconKey:w().nullable().optional()}).strict()}).strict();P({writableRoots:ie(w()).optional(),denyRead:ie(w()).optional(),network:ye().optional()}).strict();const CN=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","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","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","appBuilder:project-updated","appBuilder:publish-progress","appBuilder:publish-failed","larkBot:state"],EN=["idle","running","running-idle","stopped","error","observing"],I6=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools"],P6=["builtin","global","project","plugin"],R6=["builtin","global","project","policy","plugin"],TN=je(["owner","guest"]);P({id:w().min(1),kind:TN,displayName:w(),feishuUnionId:w().optional()}).strict();const M6=P({did:w().min(1),displayName:w(),feishuUnionId:w().optional(),principal:TN}).strict(),A6=je(EN),L6=P({input_tokens:q().int().nonnegative().optional(),cache_read_input_tokens:q().int().nonnegative().optional(),cache_creation_input_tokens:q().int().nonnegative().optional(),output_tokens:q().int().nonnegative().optional()}),j6=P({inputTokens:q().int().nonnegative(),outputTokens:q().int().nonnegative(),cacheReadTokens:q().int().nonnegative().optional(),cacheCreateTokens:q().int().nonnegative().optional()}),NN={gitBranch:w().optional(),resolvedModel:w().optional(),resolvedEffort:w().optional(),contextUsage:j6.optional(),contextWindowSize:q().int().positive().optional(),aiLabel:w().optional()},D6=P(NN),IN=P({value:w(),label:w(),description:w().optional()}),O6=P({id:w().min(1),label:w().min(1),description:w().optional(),contextWindowSize:q().int().positive(),default:ye().optional(),efforts:ie(IN).optional(),defaultEffort:w().optional()}),B6=P({id:w().min(1),label:w().min(1),description:w().optional()}),z6=P({name:w().min(1),type:je(["string","select","toggle"]),label:w().min(1),description:w().optional(),options:ie(IN).optional(),default:ks().optional(),scope:je(["core","tool-specific"])});P({tool:w().min(1)});const $6=P({rewind:ye(),subagents:ye(),tui:ye(),observe:ye(),fileSharing:ye(),fork:ye()});P({tool:w().min(1),toolSessionIdLabel:w().optional(),models:ie(O6),permissionModes:ie(B6),configSchema:ie(z6),features:$6});const F6=P({tool:w().min(1),pattern:w().min(1),createdAt:w().min(1).optional()});P({sessionId:w().min(1),cwd:w().min(1),tool:J("claude").or(w().min(1)).default("claude"),toolSessionId:w().optional(),label:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),...NN,aiLabelGeneratedAt:w().optional(),permissionRules:ie(F6).optional(),pinnedAt:q().int().nonnegative().nullable().optional(),archivedAt:q().int().nonnegative().nullable().optional(),pinSortOrder:q().int().nullable().optional(),unreadAt:w().min(1).nullable().optional(),iconKey:w().optional(),forkedFromSessionId:w().min(1).optional(),ephemeral:ye().optional(),ownerPersonaId:w().min(1).optional(),projectPath:w().min(1).optional(),appBuilderProject:w().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),chatId:w().min(1).optional(),creatorPrincipalId:w().min(1).optional(),creatorDisplayName:w().min(1).optional(),creatorFeishuUnionId:w().min(1).optional(),originOwnerPrincipalId:w().min(1).optional(),originOwnerPersonaId:w().min(1).optional(),dispatchedFromSessionId:w().min(1).optional(),shiftFiredFromSessionId:w().min(1).optional(),larkChatId:w().min(1).optional(),larkChatName:w().min(1).optional(),larkChatType:je(["p2p","group"]).optional(),createdAt:w().min(1),updatedAt:w().min(1)});const jn={seq:q().int().nonnegative().optional(),ts:w().optional(),uuid:w().optional()},H6=je(I6),U6=P({readCount:q().int().nonnegative().optional(),searchCount:q().int().nonnegative().optional(),bashCount:q().int().nonnegative().optional(),editFileCount:q().int().nonnegative().optional(),linesAdded:q().int().nonnegative().optional(),linesRemoved:q().int().nonnegative().optional(),otherToolCount:q().int().nonnegative().optional()}),W6=P({oldStart:q().int().nonnegative(),oldLines:q().int().nonnegative(),newStart:q().int().nonnegative(),newLines:q().int().nonnegative(),lines:ie(w())}),V6=P({agentId:w().optional(),agentType:w().optional(),status:w().optional(),prompt:w().optional(),filePath:w().optional(),structuredPatch:ie(W6).optional(),stats:P({durationMs:q().int().nonnegative().optional(),tokens:q().int().nonnegative().optional(),toolUseCount:q().int().nonnegative().optional(),toolStats:U6.optional(),usage:L6.optional()}).optional()}),q6=P({path:w(),content:w(),mtimeMs:q().optional()}),K6=P({label:w().min(1),description:w().optional()}),PN=P({question:w().min(1),multiSelect:ye(),options:ie(K6).min(1)}),G6=["completed","interrupted"];ci("kind",[P({...jn,kind:J("session_init"),toolSessionId:w().optional()}),P({...jn,kind:J("thinking"),text:w(),partialId:w().optional()}),P({...jn,kind:J("text"),text:w(),partialId:w().optional()}),P({...jn,kind:J("user_text"),text:w(),meta:H6.optional(),taskId:w().optional(),parentToolUseId:w().optional(),sender:M6.optional()}),P({...jn,kind:J("tool_call"),toolUseId:w(),tool:w(),toolKind:w().optional(),input:ks()}),P({...jn,kind:J("tool_result"),toolUseId:w(),output:ks().optional(),error:w().optional(),toolResultExtra:V6.optional(),sourceToolAssistantUUID:w().optional(),askQuestionAnswers:Ds(w(),w()).optional()}),P({...jn,kind:J("attachment_memories"),memories:ie(q6)}),P({...jn,kind:J("permission_request"),requestId:w(),tool:w(),input:ks(),toolUseId:w().optional()}),P({...jn,kind:J("ask_user_question"),toolUseId:w(),questions:ie(PN)}),P({...jn,kind:J("turn_end"),durationMs:q().int().nonnegative().optional(),reason:je(G6).optional()}),P({...jn,kind:J("subagent_progress"),toolUseId:w(),agentId:w(),status:je(["started","running","completed","failed"]),description:w().optional(),lastToolName:w().optional(),prompt:w().optional(),stats:P({durationMs:q().int().nonnegative().optional(),tokens:q().int().nonnegative().optional(),toolUseCount:q().int().nonnegative().optional()}).optional()}),P({...jn,kind:J("error"),message:w()}),P({...jn,kind:J("meta_update"),patch:D6}),P({...jn,kind:J("meta-text"),text:w(),metaSource:je(["cc","owner"]).optional()})]);P({cwd:w().min(1).optional(),tool:w().optional(),label:w().optional(),aiLabel:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),iconKey:w().optional(),forkedFromSessionId:w().min(1).optional(),ephemeral:ye().optional(),ownerPersonaId:w().min(1).optional(),projectPath:w().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});P({path:w().min(1),name:w().min(1),createdAt:w().datetime(),pinnedAt:q().optional()});P({path:w().min(1),pinnedAt:q().nullable()});P({path:w().min(1)});P({path:w().min(1).optional(),name:w().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});P({cwd:w().min(1),tool:w().min(1),toolSessionId:w().min(1),label:w().optional(),aiLabel:w().optional(),iconKey:w().optional(),createdAt:w().datetime(),updatedAt:w().datetime(),ownerPersonaId:w().min(1).optional()});P({originOnly:ye().optional(),ownerPersonaId:w().min(1).optional(),limit:q().int().positive().optional(),offset:q().int().nonnegative().optional()});P({sessionId:w().min(1)});P({sessionId:w().min(1),patch:P({label:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),cwd:w().optional(),iconKey:w().optional(),ephemeral:J(!1).optional()})});P({sessionId:w().min(1),text:w()});P({sessionId:w().min(1),userMessageId:w().min(1),dryRun:ye().optional()});P({canRewind:ye(),error:w().optional(),filesChanged:ie(w()).optional(),insertions:q().int().nonnegative().optional(),deletions:q().int().nonnegative().optional()});P({sessionId:w().min(1),userMessageId:w().min(1)});const Y6=P({oldStart:q().int().nonnegative(),oldLines:q().int().nonnegative(),newStart:q().int().nonnegative(),newLines:q().int().nonnegative(),lines:ie(w())}),X6=P({filePath:w().min(1),hunks:ie(Y6),insertions:q().int().nonnegative(),deletions:q().int().nonnegative(),status:je(["modified","added","deleted"]).optional()});P({canRewind:ye(),error:w().optional(),files:ie(X6),totalInsertions:q().int().nonnegative(),totalDeletions:q().int().nonnegative()});P({userMessageIds:ie(w())});P({sessionId:w().min(1),toolSessionId:w().min(1)});P({cwd:w().min(1),toolSessionId:w().min(1),messageUuid:w().min(1),targetCwd:w().min(1).optional()});P({forkedToolSessionId:w().min(1),forkedFilePath:w().min(1)});P({sessionId:w().min(1),toolSessionId:w().min(1),jsonlPath:w().optional()});P({sessionId:w().min(1),afterSeq:q().int().min(-1)});P({sessionId:w().min(1),permissionRequestId:w().min(1),allow:ye(),permanent:ye().optional(),pattern:w().optional()});P({projectPath:w().min(1)});P({sessionId:w().min(1),limit:q().int().positive().max(5e3).optional(),offset:q().int().nonnegative().optional(),slim:ye().optional()});P({cwd:w().min(1),toolSessionId:w().min(1)});P({cwd:w().min(1),toolSessionId:w().min(1),subagentId:w().min(1)});P({cwd:w().min(1).optional(),path:w().optional(),showHidden:ye().optional()});P({cwd:w().min(1),path:w().min(1)});P({cwd:w().min(1),tool:w().optional()});P({name:w().min(1),source:je(P6),path:w().optional(),description:w().optional(),plugin:w().optional()});const Q6=P({name:w().min(1),source:je(R6),path:w().optional(),description:w().optional(),whenToUse:w().optional(),plugin:w().optional()});P({cwd:w().min(1),tool:w().optional()});P({agents:ie(Q6)});P({sessionId:w().optional()});P({sessionId:w().min(1).optional()});P({sessionId:w().min(1),pinned:ye()});P({sessionId:w().min(1),archived:ye()});P({type:J("peerSession:upsert:ok")});P({sessionId:w().min(1)});P({type:J("peerSession:remove:ok")});P({orderedIds:ie(w().min(1)).min(1)});P({cwd:w().min(1)});P({isGitRoot:ye(),gitRoot:w().nullable()});P({cwd:w().min(1)});P({branch:w().nullable()});P({cwd:w().min(1)});P({branches:ie(w()),head:w().nullable()});P({}).optional();const Z6=P({cwd:w().min(1),updatedAt:w().min(1)});P({dirs:ie(Z6)});P({type:J("session:question"),sessionId:w().min(1),toolUseId:w().min(1),requestId:w().min(1),questions:ie(PN).min(1)});P({type:J("session:question:cleared"),sessionId:w().min(1),toolUseId:w().min(1),answers:Ds(w(),w()).optional()});P({sessionId:w().min(1),toolUseId:w().min(1),answers:Ds(w(),w())});P({ok:J(!0)});P({sessionId:w().min(1),toolUseId:w().min(1)});P({ok:J(!0)});const RN=P({name:w().min(1),version:w().min(1),instanceId:w().min(1),deviceLabel:w().transform(e=>e.trim().slice(0,64)).optional()});P({type:J("auth"),token:w().min(1),scheme:J("bearer").optional(),clientInfo:RN.optional()});P({type:J("auth:ok"),version:w().min(1).optional(),protocolVersion:q().int().nonnegative().optional()});const J6=P({clientId:w().min(1),connectedAt:q().int().nonnegative(),self:ye(),clientInfo:RN.optional()});P({type:J("device:connections:ok"),connections:ie(J6)});P({type:J("tunnel:ready"),url:w().min(1),subdomain:w().min(1)});P({type:J("tunnel:exited"),code:q().int().nullable(),subdomain:w().nullable(),url:w().nullable()});P({type:J("tunnel:unavailable"),reason:w().min(1),failedAt:w().min(1)});const eB=P({sessionId:w().min(1),status:A6,freshSpawn:ye(),pendingPermissionRequestIds:ie(w().min(1)),pendingQuestionToolUseIds:ie(w().min(1))});P({type:J("info"),version:w(),protocolVersion:q(),hostname:w(),os:w(),tools:ie(P({id:w(),available:ye()})),runningSessions:ie(eB),tokenRole:je(GO).optional(),isLoopback:ye().optional(),httpBaseUrl:w().optional(),httpToken:w().optional(),daemonSource:je(["ota","packaged"]).optional(),globalCliVersion:w().nullable().optional()});const tB=6173,nB=6272,cl=/^[a-z][a-z0-9-]{0,39}$/,vu=P({name:w().regex(cl,{message:"kebab-case, 小写字母开头,只允许小写字母 / 数字 / -,最长 40 字符"}),port:q().int().min(tB).max(nB),createdAt:w().datetime(),devCommand:w().min(1),prodUrl:w().url().optional(),readyPattern:w().optional(),publishJob:P({jobId:w().min(1),stage:je(["build","deploy","verify"]),startedAt:q().int().nonnegative()}).optional()}),rB=["install-pending","installing","starting-dev-server","running","stopped","failed"],MN=je(rB),$x=vu.extend({isRunning:ye(),boundSessionId:w().nullable(),stage:MN.optional(),stageReason:w().optional(),publishJob:P({jobId:w().min(1),stage:je(["build","deploy","verify"]),startedAt:q().int().nonnegative(),status:je(["in-flight","interrupted"])}).optional()});P({}).strict();P({projects:ie($x)}).strict();P({sessionId:w().min(1)}).strict();P({project:$x.nullable()}).strict();P({sessionId:w().min(1),name:w().min(1)}).strict();P({project:vu}).strict();P({name:w()}).strict();P({}).strict();P({name:w(),newPort:q().int()}).strict();P({project:vu}).strict();P({name:w().regex(cl),url:w().url()}).strict();P({project:vu}).strict();P({sessionId:w().min(1),force:ye().optional()}).strict();P({project:vu}).strict();const iB=["installing","failed"];P({sessionId:w().min(1),stage:je(iB),reason:w().optional()}).strict();P({ok:J(!0)}).strict();P({sessionId:w().min(1)}).strict();P({ok:J(!0)}).strict();P({type:J("appBuilder:project-updated"),project:$x,stage:MN,stageReason:w().optional()}).strict();P({name:w().regex(cl)});P({jobId:w().min(1),status:je(["started","already-publishing"])}).strict();P({name:w().regex(cl)});P({ok:J(!0)}).strict();P({type:J("appBuilder:publish-progress"),name:w().regex(cl),jobId:w().min(1),stage:je(["build","deploy","verify"]),status:je(["started","completed"])}).strict();P({type:J("appBuilder:publish-failed"),name:w().regex(cl),jobId:w().min(1),stage:je(["build","deploy","verify","unknown"]),errorSummary:w()}).strict();P({});P({method:w().min(1).optional()});const sB=["allowed","conditional","denied"],oB=je(sB),aB=P({name:w().min(1),status:oB,description:w().min(1),args:ie(P({name:w(),required:ye()})).nullable(),argsSchema:Ds(ks()).optional(),reason:w().optional()});P({type:J("meta:methods"),methods:ie(aB)});const ww=1,lB=["daemon","main","renderer"],cB=je(lB),uB=["debug","info","warn","error"],dB=je(uB);P({ts:q().int(),source:cB,level:dB,msg:w(),ownerPrincipalId:w(),deviceId:w(),appVersion:w(),daemonVersion:w().optional(),os:w(),meta_json:w().optional(),sessionId:w().optional()});P({v:J(1),visitorId:w().min(1),displayName:w(),provider:w(),iat:q(),exp:q()});const hB=P({visitorId:w(),displayName:w(),avatarUrl:w().optional(),provider:w(),firstSeen:q(),lastSeen:q()});P({visitors:ie(hB)});const fB=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,pB=new Set(["localhost","127.0.0.1","0.0.0.0","::1"]);let mi=null;function mB(){if(mi!==null)return mi;if(typeof window>"u")return mi=!1,!1;if(pB.has(window.location.hostname)||window.location.protocol==="file:")return mi=!0,!0;if(new URLSearchParams(window.location.search).get("debug")==="1"){mi=!0;try{sessionStorage.setItem("debug","1")}catch{}}else try{mi=sessionStorage.getItem("debug")==="1"}catch{mi=!1}return mi}function Ae(e,...t){mB()&&console.log(`[${e}][${new Date().toISOString()}]`,...t)}function ud(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 gB=e=>{const t=[1e3,2e3,4e3,8e3,16e3,3e4];return t[Math.min(e,t.length-1)]},vB=new Set(["auth:ok","pong","error"]),Sw=new Set(CN.filter(e=>!vB.has(e)));let _B=0;const kw=()=>`r${++_B}`;function xB(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??gB;let u=null,d=!1,f=0,p=null,m=null,v=null,b=null,_=!1,x="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(V=>{try{V(E)}catch{}})},T=B=>{x!==B&&(x=B,k("status",B))},N=(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),b&&(clearTimeout(b),b=null)},I=()=>{v&&clearTimeout(v),v=setTimeout(()=>{try{u==null||u.close(4e3,"pong watchdog")}catch{}},a)},M=()=>{m&&clearInterval(m),m=setInterval(()=>{(u==null?void 0:u.readyState)===1&&u.send(JSON.stringify({type:"ping",requestId:kw()}))},o),I()},A=B=>{for(const[,E]of y)clearTimeout(E.timer),E.reject(new Error(B));y.clear()},R=[],j=()=>{if(R.length===0)return;const B=R.splice(0);for(const E of B)(u==null?void 0:u.readyState)===1&&!_?E.doSend():(clearTimeout(E.timer),E.reject(new Error("NOT_CONNECTED")))},D=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);B<0||(k("daemon:reconnecting",{attempt:f+1,nextDelayMs:B,scheduledAt:Date.now()}),p&&clearTimeout(p),p=setTimeout(()=>{f+=1,O()},B))},F=B=>{I();const E=String(B.type??"");if(E==="auth:ok"){Ae("daemon-client","auth:ok received → connected",{url:t}),b&&(clearTimeout(b),b=null),_=!1,f=0,T("connected"),k("daemon:connected",{url:t}),M(),j();return}if(E==="pong")return;if(E==="ready"){const V=Number(B.protocolVersion??-1);V!==ww&&k("daemon:version-mismatch",{daemonProtocol:V,supportedProtocol:ww}),k("ready",B);return}const H=B.requestId;if(typeof H=="string"&&y.has(H)){const V=y.get(H);if(y.delete(H),clearTimeout(V.timer),E==="error"){const L=String(B.code??"ERR"),ne=String(B.message??"unknown");V.reject(new Error(`${L}: ${ne}`))}else Sw.has(E)&&k(E,B),V.resolve(B);return}Sw.has(E)&&k(E,B)},O=()=>{p&&(clearTimeout(p),p=null),Ae("daemon-client","connect →",{url:t,token:ud(n),attempt:f}),T("connecting");let B;try{B=new WebSocket(t)}catch(E){T("disconnected"),k("daemon:disconnected",{reason:(E==null?void 0:E.message)??"ws constructor failed"}),$();return}u=B,_=!!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:ud(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)),b=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,T("connected"),k("daemon:connected",{url:t}),M(),j()},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:_,manualStop:d}),z(),A(`connection closed: ${H}`),u=null,E.code===4401?T("revoked"):T("disconnected"),k("daemon:disconnected",{reason:H}),E.code===1008||E.code===4401){D(`connection closed: ${H}`);return}d?D(`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,O()},stop(){d=!0,p&&(clearTimeout(p),p=null),z();try{u==null||u.close(1e3,"shutdown")}catch{}u=null,A("shutdown"),D("shutdown"),T("disconnected")},switchProfile(B){Ae("daemon-client","switchProfile →",{url:B.url,token:ud(B.authToken)},"prev:",{url:t,token:ud(n)}),t=B.url,n=B.authToken,B.selfIdentity!==void 0&&(r=B.selfIdentity),f=0,d=!0,p&&(clearTimeout(p),p=null),z(),A("switch profile"),D("switch profile");try{u==null||u.close(1e3,"switch profile")}catch{}u=null,d=!1,O()},request(B,E){return new Promise((H,V)=>{const L=kw(),ne=setTimeout(()=>{y.delete(L);const G=R.findIndex(be=>be.timer===ne);G>=0&&R.splice(G,1),V(new Error(`request timeout: ${B}`))},s),le=()=>{y.set(L,{resolve:G=>H(G),reject:V,timer:ne}),u.send(JSON.stringify({...E,type:B,requestId:L}))};(u==null?void 0:u.readyState)===1&&!_?le():d||u==null&&p==null?(clearTimeout(ne),V(new Error("NOT_CONNECTED"))):R.push({doSend:le,reject:V,timer:ne})})},on:N,get isOpen(){return(u==null?void 0:u.readyState)===1&&!_},get url(){return t},getStatus(){return x}}}function yB(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 bB(e){return e?{id:e.id,mode:e.mode,url:e.url,token:yB(e.token),name:e.name}:null}function dd(e){return e?Array.isArray(e)?e.map(bB):{_notArray:typeof e,_value:e}:null}function Cw(e){return e==null?null:typeof e=="object"&&"value"in e?e.value:e}const wB="ws://127.0.0.1:18790",Ew="daemon:profiles",Tw="daemon:active-profile-id";function SB(){return Math.random().toString(36).slice(2,10)}function kB(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 CB(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 AN(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 →",dd(t.profiles),"active:",t.activeId),await e.kv.set(Ew,t.profiles),await e.kv.set(Tw,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(Ew);c=Cw(d)}catch{c=null}let u=null;try{const d=await e.kv.get(Tw);u=Cw(d)??null}catch{u=null}if(Ae("profile-store","ensureLoaded read kv →","profiles:",dd(c),"activeId:",u),Array.isArray(c)&&c.length>0){const d=c.filter(CB),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",dd(d),"active:",f);return}t={profiles:[{id:"default",name:"本机",mode:"localhost",url:wB}],activeId:"default"},Ae("profile-store","ensureLoaded → fallback synthesized default (NO token)",dd(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 b;await a();let c=l.url,u=l.token;if(c&&c.includes("#")){const _=kB(c);c=_.url,!u&&_.token&&(u=_.token)}const d=l.id?t.profiles.find(_=>_.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??SB(),m={id:p,name:((b=l.name)==null?void 0:b.trim())||(d==null?void 0:d.name)||(l.mode==="remote"?"远程":"本机"),mode:l.mode,url:c.trim(),token:f};return t={profiles:[...t.profiles.filter(_=>_.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 Nw="clawd.client-instance-id";let EB={name:"clawd-web",version:"unknown"};function TB(){let e=null;try{e=localStorage.getItem(Nw),e||(e=crypto.randomUUID(),localStorage.setItem(Nw,e))}catch{e=e??crypto.randomUUID()}return{...EB,instanceId:e}}function Iw(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 LN=g.createContext(null);function NB({host:e,children:t}){const[n,r]=g.useState(null),i=g.useMemo(()=>async()=>{const s=AN(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:Iw(a.token)}),{client:xB({url:a.url,authToken:a.token,clientInfo:TB()}),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:Iw(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(LN.Provider,{value:n,children:t}):null}function ui(){const e=g.useContext(LN);if(!e)throw new Error("useDaemonClient must be used inside <DaemonProvider>");return e.client}function IB(){const e=ui(),[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 PB(){const e=ui(),[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 jN=g.createContext(null);function RB({cache:e,children:t}){return g.createElement(jN.Provider,{value:e},t)}function Mo(){const e=g.useContext(jN);if(!e)throw new Error("useCache must be used inside <CacheProvider>");return e}function oi(e){const t=Mo(),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 DN={actionsLevel:"none",httpBaseUrl:null,httpToken:null},ON=g.createContext(DN);function np(){return g.useContext(ON)}function MB(e){return e!=null&&e.httpBaseUrl?{actionsLevel:e.tokenRole==="owner"?"owner":"none",httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken??null}:DN}function AB(){const e=oi("daemon-info");return g.useMemo(()=>MB(e),[e])}function LB({children:e}){const t=AB();return Ze.createElement(ON.Provider,{value:t},e)}function jB(e,t,n){if(!e.httpBaseUrl)return null;const r=encodeURIComponent(n);return`${e.httpBaseUrl}/session/${encodeURIComponent(t.sessionId)}/files?path=${r}`}function DB(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 OB(){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 BB(e){return{request:(t,n)=>e.request(t,n),onFrame(t){const n=[];for(const r of CN)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 BN(e){const t=(e??"claude")==="claude";return{rewind:t,subagents:t,tui:t,observe:t,fileSharing:t,fork:t}}const zB=e=>({tool:e,models:[{id:"",label:"未指定",contextWindowSize:2e5,default:!0}],permissionModes:[{id:"",label:"未指定"}],configSchema:[],features:BN(e)});function $B(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,()=>zB(r))}},o=e.onConnect(()=>{s()});return s(),()=>{i=!0,o()}}}}function FB(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:{}};function Nm(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 zN(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=Nm(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:events":{if(!r||t.sessionId!==r)return e;const i=t.events.map(o=>o.event),s=i.reduce((o,a)=>Nm(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)=>Nm(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 HB="session/";function UB(e){return{sid:e.slice(HB.length)}}const WB=new Set(EN);function $N(e){return WB.has(e)}function Pw(e){return $N(e)?e:"idle"}function VB(e,t){return{start(n){const{sid:r}=UB(n);let i=!1,s=-1;const o=f=>{t(n,p=>zN(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??[],b=m.latestSeq??-1;if(f==="baseline")o({type:"session:events",sessionId:r,events:v,latestSeq:b}),s=b;else{const _=m.bufferStartSeq??0,x=b<p||_>p+1;o({type:x?"session:events":"session:events:append",sessionId:r,events:v,latestSeq:b}),s=Math.max(s,b)}}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:Pw(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(!$N(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==="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:Pw(v.status)}))})}),d=e.onConnect(()=>{c()});return e.isConnected&&c(),()=>{i=!0,u(),d(),e.request("session:unsubscribe",{sessionId:r}).catch(()=>{})}}}}const qB=new Set(["tunnel:ready","tunnel:exited","tunnel:unavailable"]);function KB(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=>{qB.has(a)&&i()});return i(),()=>{r=!0,s(),o()}}}}function GB(){return{start(){return()=>{}}}}function YB(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 XB(e){const t=BB(e),n=OB();let r=null;const i=(o,a)=>{r==null||r.setData(o,a)};n.register(/^capabilities\//,$B(t,i)),n.register(/^sessions$/,FB(t,i)),n.register(/^session\//,VB(t,i)),n.register(/^personas$/,YB(t,i)),n.register(/^persona-detail\//,GB()),n.register(/^daemon-info$/,KB(t,i));const s=DB({onFirstObserver:o=>{o&&n.activate(o)},onLastObserver:o=>{o&&n.deactivate(o)}});return r=s,{cache:s,channel:t}}class Fx{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){return this.client.request("session:send",{sessionId:t,text: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})}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")}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)}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 QB(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 ZB(e){const t=Mo(),n=oi(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 ul(){const e=ui();return g.useMemo(()=>new Fx(e),[e])}function FN(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 HN(){const e=Mo(),t=ul(),n=oi("personas")??[],r=g.useMemo(()=>n.map(s=>FN(s)),[n]),i=g.useCallback(async()=>{const s=await t.personaList();e.setData("personas",()=>s.personas??[])},[t,e]);return{personas:r,raw:n,loaded:oi("personas")!==void 0,refresh:i}}function UN(e){const{raw:t}=HN(),n=Mo(),r=ul(),i=e?t.find(a=>a.personaId===e)??null:null,s=i?FN(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 JB(e){const t=ul(),n=Mo(),r=e?`persona-detail/${e}`:"",i=oi(r),s=g.useCallback(async()=>{const o={personality:"",skills:[],plugins:[],sandboxSettings:null};if(!e)return o;const a=await t.personaGet(e);let l;if("persona"in a&&a.persona===null)l=o;else{const c=a;l={personality:c.personality??"",skills:c.skills??[],plugins:c.plugins??[],sandboxSettings:c.sandboxSettings??null}}return n.setData(r,()=>l),l},[t,n,e,r]);return g.useEffect(()=>{e&&s()},[e,s]),{personality:(i==null?void 0:i.personality)??"",skills:(i==null?void 0:i.skills)??[],plugins:(i==null?void 0:i.plugins)??[],sandboxSettings:(i==null?void 0:i.sandboxSettings)??null,loaded:i!==void 0,refresh:s}}function WN(){const e=Mo(),t=ul();return g.useCallback(async()=>{const n=await t.personaList();e.setData("personas",()=>n.personas??[])},[e,t])}function ez(){const e=ul(),t=WN();return g.useCallback(async(n,r)=>{const i=await e.personaUpdate(n,r);return await t(),i},[e,t])}function tz(){const e=ul(),t=WN();return g.useCallback(async n=>{await e.personaDelete(n),await t()},[e,t])}const Rw="clawd:sidebar:tree-collapsed";function nz(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function rz(e){const t=nz(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 iz(){const e=Sx(),[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(Rw);if(l)return;n(rz(c))}catch{}})(),()=>{l=!0}},[e]);const i=g.useCallback(l=>{e.kv.set(Rw,[...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 Hx=g.createContext(null);function sz(){const e=g.useContext(Hx);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 rw=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 LD={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},jD={motionBase:!0,motionUnit:!0},DD={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},eN=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=rw(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=JT(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=rw(l,["theme"]);let d=u;c&&(d=eN(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function tN(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Ze.useContext(QT),s=`${MD}-${t||""}`,o=n||XT,[a,l,c]=wj(o,[Hc,e],{salt:s,override:r,getComputedToken:eN,formatToken:JT,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:LD,ignore:jD,preserve:DD}});return[o,c,t?l:"",a,i]}const OD=()=>({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"}}),BD=e=>({[`.${e}`]:Object.assign(Object.assign({},OD()),{[`.${e} .${e}-icon`]:{display:"block"}})}),zD=(e,t)=>{const[n,r]=tN();return Xj({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>BD(e))},$D=Object.assign({},Ja),{useId:iw}=$D,FD=()=>"",HD=typeof iw>"u"?FD:iw;function UD(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},$h),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:$h.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=HD();return xT(()=>{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!XL(c,d,!0)}))}var WD=["children"],nN=g.createContext({});function VD(e){var t=e.children,n=Pv(e,WD);return g.createElement(nN.Provider,{value:n},t)}var qD=function(e){bT(n,e);var t=ST(n);function n(){return rl(this,n),t.apply(this,arguments)}return il(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function KD(e){var t=g.useReducer(function(a){return a+1},0),n=Je(t,2),r=n[1],i=g.useRef(e),s=Zv(function(){return i.current}),o=Zv(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var ns="none",sd="appear",od="enter",ad="leave",sw="none",Nr="prepare",ma="start",ga="active",Ax="end",rN="prepared";function ow(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 GD(e,t){var n={animationend:ow("Animation","AnimationEnd"),transitionend:ow("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var YD=GD(zi(),typeof window<"u"?window:{}),iN={};if(zi()){var XD=document.createElement("div");iN=XD.style}var ld={};function sN(e){if(ld[e])return ld[e];var t=YD[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 iN)return ld[e]=t[s],ld[e]}return""}var oN=sN("animationend"),aN=sN("transitionend"),lN=!!(oN&&aN),aw=oN||"animationend",lw=aN||"transitionend";function cw(e,t){if(!e)return null;if(Ct(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const QD=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(lw,e),i.removeEventListener(aw,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(lw,e),i.addEventListener(aw,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var cN=zi()?g.useLayoutEffect:g.useEffect;const ZD=function(){var e=g.useRef(null);function t(){Nv.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=Nv(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 JD=[Nr,ma,ga,Ax],eO=[Nr,rN],uN=!1,tO=!0;function dN(e){return e===ga||e===Ax}const nO=function(e,t,n){var r=Jv(sw),i=Je(r,2),s=i[0],o=i[1],a=ZD(),l=Je(a,2),c=l[0],u=l[1];function d(){o(Nr,!0)}var f=t?eO:JD;return cN(function(){if(s!==sw&&s!==Ax){var p=f.indexOf(s),m=f[p+1],v=n(s);v===uN?o(m,!0):m&&c(function(b){function _(){b.isCanceled()||o(m,!0)}v===!0?_():Promise.resolve(v).then(_)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function rO(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,b=r.onEnterStart,_=r.onLeaveStart,x=r.onAppearActive,y=r.onEnterActive,S=r.onLeaveActive,C=r.onAppearEnd,k=r.onEnterEnd,T=r.onLeaveEnd,N=r.onVisibleChanged,z=Jv(),I=Je(z,2),M=I[0],A=I[1],R=KD(ns),j=Je(R,2),D=j[0],$=j[1],F=Jv(null),O=Je(F,2),B=O[0],E=O[1],H=D(),V=g.useRef(!1),L=g.useRef(null);function ne(){return n()}var le=g.useRef(!1);function G(){$(ns),E(null,!0)}var be=Zv(function(Qe){var st=D();if(st!==ns){var wt=ne();if(!(Qe&&!Qe.deadline&&Qe.target!==wt)){var pn=le.current,on;st===sd&&pn?on=C==null?void 0:C(wt,Qe):st===od&&pn?on=k==null?void 0:k(wt,Qe):st===ad&&pn&&(on=T==null?void 0:T(wt,Qe)),pn&&on!==!1&&G()}}}),He=QD(be),de=Je(He,1),Pe=de[0],Re=function(st){switch(st){case sd:return Ce(Ce(Ce({},Nr,f),ma,v),ga,x);case od:return Ce(Ce(Ce({},Nr,p),ma,b),ga,y);case ad:return Ce(Ce(Ce({},Nr,m),ma,_),ga,S);default:return{}}},Ke=g.useMemo(function(){return Re(H)},[H]),_e=nO(H,!e,function(Qe){if(Qe===Nr){var st=Ke[Nr];return st?st(ne()):uN}if(it in Ke){var wt;E(((wt=Ke[it])===null||wt===void 0?void 0:wt.call(Ke,ne(),null))||null)}return it===ga&&H!==ns&&(Pe(ne()),u>0&&(clearTimeout(L.current),L.current=setTimeout(function(){be({deadline:!0})},u))),it===rN&&G(),tO}),$e=Je(_e,2),fn=$e[0],it=$e[1],Rt=dN(it);le.current=Rt;var Gt=g.useRef(null);cN(function(){if(!(V.current&&Gt.current===t)){A(t);var Qe=V.current;V.current=!0;var st;!Qe&&t&&a&&(st=sd),Qe&&t&&s&&(st=od),(Qe&&!t&&c||!Qe&&d&&!t&&c)&&(st=ad);var wt=Re(st);st&&(e||wt[Nr])?($(st),fn()):$(ns),Gt.current=t}},[t]),g.useEffect(function(){(H===sd&&!a||H===od&&!s||H===ad&&!c)&&$(ns)},[a,s,c]),g.useEffect(function(){return function(){V.current=!1,clearTimeout(L.current)}},[]);var Mt=g.useRef(!1);g.useEffect(function(){M&&(Mt.current=!0),M!==void 0&&H===ns&&((Mt.current||M)&&(N==null||N(M)),Mt.current=!0)},[M,H]);var bt=B;return Ke[Nr]&&it===ma&&(bt=Fe({transition:"none"},bt)),[H,it,bt,M??t]}function iO(e){var t=e;Ct(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(nN),b=v.motion,_=n(i,b),x=g.useRef(),y=g.useRef();function S(){try{return x.current instanceof HTMLElement?x.current:AL(y.current)}catch{return null}}var C=rO(_,a,S,i),k=Je(C,4),T=k[0],N=k[1],z=k[2],I=k[3],M=g.useRef(I);I&&(M.current=!0);var A=g.useCallback(function(O){x.current=O,OL(s,O)},[s]),R,j=Fe(Fe({},m),{},{visible:a});if(!d)R=null;else if(T===ns)I?R=d(Fe({},j),A):!c&&M.current&&p?R=d(Fe(Fe({},j),{},{className:p}),A):u||!c&&!p?R=d(Fe(Fe({},j),{},{style:{display:"none"}}),A):R=null;else{var D;N===Nr?D="prepare":dN(N)?D="active":N===ma&&(D="start");var $=cw(f,"".concat(T,"-").concat(D));R=d(Fe(Fe({},j),{},{className:bL(cw(f,T),Ce(Ce({},$,$&&D),f,typeof f=="string")),style:z}),A)}if(g.isValidElement(R)&&BL(R)){var F=zL(R);F||(R=g.cloneElement(R,{ref:A}))}return g.createElement(qD,{ref:y},R)});return r.displayName="CSSMotion",r}const sO=iO(lN);var e0="add",t0="keep",n0="remove",Em="removed";function oO(e){var t;return e&&Ct(e)==="object"&&"key"in e?t=e:t={key:e},Fe(Fe({},t),{},{key:String(t.key)})}function r0(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(oO)}function aO(){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=r0(e),o=r0(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 Fe(Fe({},p),{},{status:e0})})),r=d),n.push(Fe(Fe({},f),{},{status:t0})),r+=1,u=!0;break}}u||n.push(Fe(Fe({},c),{},{status:n0}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return Fe(Fe({},c),{},{status:e0})})));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!==n0}),n.forEach(function(u){u.key===c&&(u.status=t0)})}),n}var lO=["component","children","onVisibleChanged","onAllRemoved"],cO=["status"],uO=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function dO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sO,n=function(r){bT(s,r);var i=ST(s);function s(){var o;rl(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)),Ce(Ev(o),"state",{keyEntities:[]}),Ce(Ev(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:Fe(Fe({},p),{},{status:Em})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==Em}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return il(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=Pv(c,lO),m=u||g.Fragment,v={};return uO.forEach(function(b){v[b]=p[b],delete p[b]}),delete p.keys,g.createElement(m,p,l.map(function(b,_){var x=b.status,y=Pv(b,cO),S=x===e0||x===t0;return g.createElement(t,Oh({},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(Fe(Fe({},C),{},{index:_}),k)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=r0(c),f=aO(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(v){var b=v.key;return p.key===b});return!(m&&m.status===Em&&p.status===n0)})}}}]),s}(g.Component);return Ce(n,"defaultProps",{component:"div"}),n}dO(lN);const uw=g.createContext(!0);function hO(e){const t=g.useContext(uw),{children:n}=e,[,r]=tN(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(uw.Provider,{value:i},g.createElement(VD,{motion:i},n)):n}const fO=()=>null;var pO=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 mO=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let hN;function gO(){return hN||Xv}function vO(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const _O=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(hN=t),r&&vO(r)&&ED(gO(),r)},xO=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:b,parentContext:_,iconPrefixCls:x,theme:y,componentDisabled:S,segmented:C,statistic:k,spin:T,calendar:N,carousel:z,cascader:I,collapse:M,typography:A,checkbox:R,descriptions:j,divider:D,drawer:$,skeleton:F,steps:O,image:B,layout:E,list:H,mentions:V,modal:L,progress:ne,result:le,slider:G,breadcrumb:be,menu:He,pagination:de,input:Pe,textArea:Re,empty:Ke,badge:_e,radio:$e,rate:fn,switch:it,transfer:Rt,avatar:Gt,message:Mt,tag:bt,table:Qe,card:st,tabs:wt,timeline:pn,timePicker:on,upload:U,notification:Z,tree:xe,colorPicker:ke,datePicker:Ue,rangePicker:Nt,flex:Yt,wave:Xt,dropdown:oe,warning:K,tour:Se,tooltip:ht,popover:an,popconfirm:xl,floatButton:yl,floatButtonGroup:Fo,variant:Up,inputNumber:Du,treeSelect:Ou}=e,Bu=g.useCallback((ae,he)=>{const{prefixCls:De}=e;if(he)return he;const $t=De||_.getPrefixCls("");return ae?`${$t}-${ae}`:$t},[_.getPrefixCls,e.prefixCls]),Hs=x||_.iconPrefixCls||ZT,Vi=n||_.csp;zD(Hs,Vi);const bl=UD(y,_.theme,{prefixCls:Bu("")}),qi={csp:Vi,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||b,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:v,getPrefixCls:Bu,iconPrefixCls:Hs,theme:bl,segmented:C,statistic:k,spin:T,calendar:N,carousel:z,cascader:I,collapse:M,typography:A,checkbox:R,descriptions:j,divider:D,drawer:$,skeleton:F,steps:O,image:B,input:Pe,textArea:Re,layout:E,list:H,mentions:V,modal:L,progress:ne,result:le,slider:G,breadcrumb:be,menu:He,pagination:de,empty:Ke,badge:_e,radio:$e,rate:fn,switch:it,transfer:Rt,avatar:Gt,message:Mt,tag:bt,table:Qe,card:st,tabs:wt,timeline:pn,timePicker:on,upload:U,notification:Z,tree:xe,colorPicker:ke,datePicker:Ue,rangePicker:Nt,flex:Yt,wave:Xt,dropdown:oe,warning:K,tour:Se,tooltip:ht,popover:an,popconfirm:xl,floatButton:yl,floatButtonGroup:Fo,variant:Up,inputNumber:Du,treeSelect:Ou},Ki=Object.assign({},_);Object.keys(qi).forEach(ae=>{qi[ae]!==void 0&&(Ki[ae]=qi[ae])}),mO.forEach(ae=>{const he=e[ae];he&&(Ki[ae]=he)}),typeof r<"u"&&(Ki.button=Object.assign({autoInsertSpace:r},Ki.button));const Gi=xT(()=>Ki,Ki,(ae,he)=>{const De=Object.keys(ae),$t=Object.keys(he);return De.length!==$t.length||De.some(Us=>ae[Us]!==he[Us])}),{layer:Ho}=g.useContext(Qf),Uo=g.useMemo(()=>({prefixCls:Hs,csp:Vi,layer:Ho?"antd":void 0}),[Hs,Vi,Ho]);let zt=g.createElement(g.Fragment,null,g.createElement(fO,{dropdownMatchSelectWidth:p}),t);const wl=g.useMemo(()=>{var ae,he,De,$t;return iD(((ae=ep.Form)===null||ae===void 0?void 0:ae.defaultValidateMessages)||{},((De=(he=Gi.locale)===null||he===void 0?void 0:he.Form)===null||De===void 0?void 0:De.defaultValidateMessages)||{},(($t=Gi.form)===null||$t===void 0?void 0:$t.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[Gi,o==null?void 0:o.validateMessages]);Object.keys(wl).length>0&&(zt=g.createElement(oD.Provider,{value:wl},zt)),a&&(zt=g.createElement(cD,{locale:a,_ANT_MARK__:lD},zt)),zt=g.createElement(eD.Provider,{value:Uo},zt),l&&(zt=g.createElement(ND,{size:l},zt)),zt=g.createElement(hO,null,zt);const te=g.useMemo(()=>{const ae=bl||{},{algorithm:he,token:De,components:$t,cssVar:Us}=ae,z5=pO(ae,["algorithm","token","components","cssVar"]),v1=he&&(!Array.isArray(he)||he.length>0)?Mv(he):XT,Wp={};Object.entries($t||{}).forEach(([$5,F5])=>{const pi=Object.assign({},F5);"algorithm"in pi&&(pi.algorithm===!0?pi.theme=v1:(Array.isArray(pi.algorithm)||typeof pi.algorithm=="function")&&(pi.theme=Mv(pi.algorithm)),delete pi.algorithm),Wp[$5]=pi});const _1=Object.assign(Object.assign({},Hc),De);return Object.assign(Object.assign({},z5),{theme:v1,token:_1,components:Wp,override:Object.assign({override:_1},Wp),cssVar:Us})},[bl]);return y&&(zt=g.createElement(QT.Provider,{value:te},zt)),Gi.warning&&(zt=g.createElement(sD.Provider,{value:Gi.warning},zt)),S!==void 0&&(zt=g.createElement(TD,{disabled:S},zt)),g.createElement(tp.Provider,{value:Gi},zt)},ol=e=>{const t=g.useContext(tp),n=g.useContext(qT);return g.createElement(xO,Object.assign({parentContext:t,legacyLocale:n},e))};ol.ConfigContext=tp;ol.SizeContext=Uc;ol.config=_O;ol.useConfig=ID;Object.defineProperty(ol,"SizeContext",{get:()=>Uc});const lr=(e,t)=>new _t(e).setA(t).toRgbString(),qo=(e,t)=>new _t(e).lighten(t).toHexString(),yO=e=>{const t=$a(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]}},bO=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:lr(r,.85),colorTextSecondary:lr(r,.65),colorTextTertiary:lr(r,.45),colorTextQuaternary:lr(r,.25),colorFill:lr(r,.18),colorFillSecondary:lr(r,.12),colorFillTertiary:lr(r,.08),colorFillQuaternary:lr(r,.04),colorBgSolid:lr(r,.95),colorBgSolidHover:lr(r,1),colorBgSolidActive:lr(r,.9),colorBgElevated:qo(n,12),colorBgContainer:qo(n,8),colorBgLayout:qo(n,0),colorBgSpotlight:qo(n,26),colorBgBlur:lr(r,.04),colorBorder:qo(n,26),colorBorderSecondary:qo(n,19)}},wO=(e,t)=>{const n=Object.keys(Rx).map(s=>{const o=$a(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??Mx(e),i=YT(e,{generateColorPalettes:yO,generateNeutralColorPalettes:bO});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},dw={defaultSeed:$h.token,defaultAlgorithm:Mx,darkAlgorithm:wO};function hw({children:e}){const t=Sx(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(ol,{theme:{algorithm:n.mode==="dark"?dw.darkAlgorithm:dw.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var Ye;(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})(Ye||(Ye={}));var fw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(fw||(fw={}));const ue=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),os=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}},Y=Ye.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 Li 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 Li))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ye.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()}}Li.create=e=>new Li(e);const i0=(e,t)=>{let n;switch(e.code){case Y.invalid_type:e.received===ue.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Y.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ye.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ye.joinValues(e.keys,", ")}`;break;case Y.invalid_union:n="Invalid input";break;case Y.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ye.joinValues(e.options)}`;break;case Y.invalid_enum_value:n=`Invalid enum value. Expected ${Ye.joinValues(e.options)}, received '${e.received}'`;break;case Y.invalid_arguments:n="Invalid function arguments";break;case Y.invalid_return_type:n="Invalid function return type";break;case Y.invalid_date:n="Invalid date";break;case Y.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}"`:Ye.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Y.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 Y.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 Y.custom:n="Invalid input";break;case Y.invalid_intersection_types:n="Intersection results could not be merged";break;case Y.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Y.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ye.assertNever(e)}return{message:n}};let SO=i0;function kO(){return SO}const CO=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 re(e,t){const n=kO(),r=CO({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===i0?void 0:i0].filter(i=>!!i)});e.common.issues.push(r)}class In{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 Te;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 In.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 Te;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 Te=Object.freeze({status:"aborted"}),Gl=e=>({status:"dirty",value:e}),Sr=e=>({status:"valid",value:e}),pw=e=>e.status==="aborted",mw=e=>e.status==="dirty",Fa=e=>e.status==="valid",Fh=e=>typeof Promise<"u"&&e instanceof Promise;var ve;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ve||(ve={}));class si{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 gw=(e,t)=>{if(Fa(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 Li(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 qe{get description(){return this._def.description}_getType(t){return os(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:os(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new In,ctx:{common:t.parent.common,data:t.data,parsedType:os(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Fh(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:os(t)},i=this._parseSync({data:t,path:r.path,parent:r});return gw(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:os(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return Fa(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=>Fa(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:os(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Fh(i)?i:Promise.resolve(i));return gw(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:Y.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 _o({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 Ni.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ti.create(this)}promise(){return Kh.create(this,this._def)}or(t){return Uh.create([this,t],this._def)}and(t){return Wh.create(this,t,this._def)}transform(t){return new _o({...Le(this._def),schema:this,typeName:Ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Gh({...Le(this._def),innerType:this,defaultValue:n,typeName:Ne.ZodDefault})}brand(){return new gN({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 jx.create(this,t)}readonly(){return Xh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const EO=/^c[^\s-]{8,}$/i,TO=/^[0-9a-z]+$/,NO=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IO=/^[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,PO=/^[a-z0-9_-]{21}$/i,RO=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,MO=/^[-+]?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)?)??$/,AO=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,LO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Tm;const jO=/^(?:(?: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])$/,DO=/^(?:(?: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])$/,OO=/^(([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]))$/,BO=/^(([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])$/,zO=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$O=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fN="((\\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])))",FO=new RegExp(`^${fN}$`);function pN(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 HO(e){return new RegExp(`^${pN(e)}$`)}function UO(e){let t=`${fN}T${pN(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 WO(e,t){return!!((t==="v4"||!t)&&jO.test(e)||(t==="v6"||!t)&&OO.test(e))}function VO(e,t){if(!RO.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 qO(e,t){return!!((t==="v4"||!t)&&DO.test(e)||(t==="v6"||!t)&&BO.test(e))}class ki extends qe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){const s=this._getOrReturnCtx(t);return re(s,{code:Y.invalid_type,expected:ue.string,received:s.parsedType}),Te}const r=new In;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:Y.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),re(i,{code:Y.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?re(i,{code:Y.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&re(i,{code:Y.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")AO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"email",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Tm||(Tm=new RegExp(LO,"u")),Tm.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"emoji",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")IO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"uuid",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")PO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"nanoid",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")EO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cuid",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")TO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cuid2",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")NO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"ulid",code:Y.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),re(i,{validation:"url",code:Y.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),re(i,{validation:"regex",code:Y.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),re(i,{code:Y.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),re(i,{code:Y.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),re(i,{code:Y.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?UO(s).test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:Y.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?FO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:Y.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?HO(s).test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:Y.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?MO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"duration",code:Y.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?WO(t.data,s.version)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"ip",code:Y.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?VO(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"jwt",code:Y.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?qO(t.data,s.version)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cidr",code:Y.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?zO.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"base64",code:Y.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?$O.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"base64url",code:Y.invalid_string,message:s.message}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:Y.invalid_string,...ve.errToObj(r)})}_addCheck(t){return new ki({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ve.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ve.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ve.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ve.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ve.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ve.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ve.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ve.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ve.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ve.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ve.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ve.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ve.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,...ve.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,...ve.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ve.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ve.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ve.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ve.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ve.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ve.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ve.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ve.errToObj(n)})}nonempty(t){return this.min(1,ve.errToObj(t))}trim(){return new ki({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ki({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ki({...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}}ki.create=e=>new ki({checks:[],typeName:Ne.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Le(e)});function KO(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 Ha extends qe{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)!==ue.number){const s=this._getOrReturnCtx(t);return re(s,{code:Y.invalid_type,expected:ue.number,received:s.parsedType}),Te}let r;const i=new In;for(const s of this._def.checks)s.kind==="int"?Ye.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),re(r,{code:Y.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),re(r,{code:Y.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),re(r,{code:Y.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?KO(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),re(r,{code:Y.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),re(r,{code:Y.not_finite,message:s.message}),i.dirty()):Ye.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ve.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ve.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ve.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ve.toString(n))}setLimit(t,n,r,i){return new Ha({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ve.toString(i)}]})}_addCheck(t){return new Ha({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ve.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ve.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ve.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ve.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ve.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ve.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ve.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ve.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ve.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"&&Ye.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)}}Ha.create=e=>new Ha({checks:[],typeName:Ne.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class Wc extends qe{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)!==ue.bigint)return this._getInvalidInput(t);let r;const i=new In;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),re(r,{code:Y.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),re(r,{code:Y.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),re(r,{code:Y.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Ye.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return re(n,{code:Y.invalid_type,expected:ue.bigint,received:n.parsedType}),Te}gte(t,n){return this.setLimit("min",t,!0,ve.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ve.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ve.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ve.toString(n))}setLimit(t,n,r,i){return new Wc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ve.toString(i)}]})}_addCheck(t){return new Wc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ve.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ve.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ve.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ve.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ve.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}}Wc.create=e=>new Wc({checks:[],typeName:Ne.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Le(e)});class s0 extends qe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.boolean,received:r.parsedType}),Te}return Sr(t.data)}}s0.create=e=>new s0({typeName:Ne.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class Hh extends qe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){const s=this._getOrReturnCtx(t);return re(s,{code:Y.invalid_type,expected:ue.date,received:s.parsedType}),Te}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return re(s,{code:Y.invalid_date}),Te}const r=new In;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:Y.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),re(i,{code:Y.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Hh({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ve.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ve.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}}Hh.create=e=>new Hh({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ne.ZodDate,...Le(e)});class vw extends qe{_parse(t){if(this._getType(t)!==ue.symbol){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.symbol,received:r.parsedType}),Te}return Sr(t.data)}}vw.create=e=>new vw({typeName:Ne.ZodSymbol,...Le(e)});class o0 extends qe{_parse(t){if(this._getType(t)!==ue.undefined){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.undefined,received:r.parsedType}),Te}return Sr(t.data)}}o0.create=e=>new o0({typeName:Ne.ZodUndefined,...Le(e)});class a0 extends qe{_parse(t){if(this._getType(t)!==ue.null){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.null,received:r.parsedType}),Te}return Sr(t.data)}}a0.create=e=>new a0({typeName:Ne.ZodNull,...Le(e)});class _w extends qe{constructor(){super(...arguments),this._any=!0}_parse(t){return Sr(t.data)}}_w.create=e=>new _w({typeName:Ne.ZodAny,...Le(e)});class l0 extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sr(t.data)}}l0.create=e=>new l0({typeName:Ne.ZodUnknown,...Le(e)});class Is extends qe{_parse(t){const n=this._getOrReturnCtx(t);return re(n,{code:Y.invalid_type,expected:ue.never,received:n.parsedType}),Te}}Is.create=e=>new Is({typeName:Ne.ZodNever,...Le(e)});class xw extends qe{_parse(t){if(this._getType(t)!==ue.undefined){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.void,received:r.parsedType}),Te}return Sr(t.data)}}xw.create=e=>new xw({typeName:Ne.ZodVoid,...Le(e)});class ti extends qe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==ue.array)return re(n,{code:Y.invalid_type,expected:ue.array,received:n.parsedType}),Te;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(re(n,{code:o?Y.too_big:Y.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&&(re(n,{code:Y.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&&(re(n,{code:Y.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 si(n,o,n.path,a)))).then(o=>In.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new si(n,o,n.path,a)));return In.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ti({...this._def,minLength:{value:t,message:ve.toString(n)}})}max(t,n){return new ti({...this._def,maxLength:{value:t,message:ve.toString(n)}})}length(t,n){return new ti({...this._def,exactLength:{value:t,message:ve.toString(n)}})}nonempty(t){return this.min(1,t)}}ti.create=(e,t)=>new ti({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ne.ZodArray,...Le(t)});function ta(e){if(e instanceof jt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ni.create(ta(r))}return new jt({...e._def,shape:()=>t})}else return e instanceof ti?new ti({...e._def,type:ta(e.element)}):e instanceof Ni?Ni.create(ta(e.unwrap())):e instanceof xo?xo.create(ta(e.unwrap())):e instanceof go?go.create(e.items.map(t=>ta(t))):e}class jt extends qe{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=Ye.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ue.object){const c=this._getOrReturnCtx(t);return re(c,{code:Y.invalid_type,expected:ue.object,received:c.parsedType}),Te}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Is&&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 si(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Is){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&&(re(i,{code:Y.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 si(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=>In.mergeObjectSync(r,c)):In.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ve.errToObj,new jt({...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:ve.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new jt({...this._def,unknownKeys:"strip"})}passthrough(){return new jt({...this._def,unknownKeys:"passthrough"})}extend(t){return new jt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new jt({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 jt({...this._def,catchall:t})}pick(t){const n={};for(const r of Ye.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new jt({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Ye.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new jt({...this._def,shape:()=>n})}deepPartial(){return ta(this)}partial(t){const n={};for(const r of Ye.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new jt({...this._def,shape:()=>n})}required(t){const n={};for(const r of Ye.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ni;)s=s._def.innerType;n[r]=s}return new jt({...this._def,shape:()=>n})}keyof(){return mN(Ye.objectKeys(this.shape))}}jt.create=(e,t)=>new jt({shape:()=>e,unknownKeys:"strip",catchall:Is.create(),typeName:Ne.ZodObject,...Le(t)});jt.strictCreate=(e,t)=>new jt({shape:()=>e,unknownKeys:"strict",catchall:Is.create(),typeName:Ne.ZodObject,...Le(t)});jt.lazycreate=(e,t)=>new jt({shape:e,unknownKeys:"strip",catchall:Is.create(),typeName:Ne.ZodObject,...Le(t)});class Uh extends qe{_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 Li(a.ctx.common.issues));return re(n,{code:Y.invalid_union,unionErrors:o}),Te}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 Li(l));return re(n,{code:Y.invalid_union,unionErrors:a}),Te}}get options(){return this._def.options}}Uh.create=(e,t)=>new Uh({options:e,typeName:Ne.ZodUnion,...Le(t)});const _i=e=>e instanceof u0?_i(e.schema):e instanceof _o?_i(e.innerType()):e instanceof qh?[e.value]:e instanceof vo?e.options:e instanceof d0?Ye.objectValues(e.enum):e instanceof Gh?_i(e._def.innerType):e instanceof o0?[void 0]:e instanceof a0?[null]:e instanceof Ni?[void 0,..._i(e.unwrap())]:e instanceof xo?[null,..._i(e.unwrap())]:e instanceof gN||e instanceof Xh?_i(e.unwrap()):e instanceof Yh?_i(e._def.innerType):[];class Lx extends qe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.object)return re(n,{code:Y.invalid_type,expected:ue.object,received:n.parsedType}),Te;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}):(re(n,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Te)}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=_i(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 Lx({typeName:Ne.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Le(r)})}}function c0(e,t){const n=os(e),r=os(t);if(e===t)return{valid:!0,data:e};if(n===ue.object&&r===ue.object){const i=Ye.objectKeys(t),s=Ye.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=c0(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===ue.array&&r===ue.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=c0(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===ue.date&&r===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Wh extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(pw(s)||pw(o))return Te;const a=c0(s.value,o.value);return a.valid?((mw(s)||mw(o))&&n.dirty(),{status:n.value,value:a.data}):(re(r,{code:Y.invalid_intersection_types}),Te)};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}))}}Wh.create=(e,t,n)=>new Wh({left:e,right:t,typeName:Ne.ZodIntersection,...Le(n)});class go extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.array)return re(r,{code:Y.invalid_type,expected:ue.array,received:r.parsedType}),Te;if(r.data.length<this._def.items.length)return re(r,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Te;!this._def.rest&&r.data.length>this._def.items.length&&(re(r,{code:Y.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 si(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>In.mergeArray(n,o)):In.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new go({...this._def,rest:t})}}go.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new go({items:e,typeName:Ne.ZodTuple,rest:null,...Le(t)})};class Vh extends qe{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!==ue.object)return re(r,{code:Y.invalid_type,expected:ue.object,received:r.parsedType}),Te;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new si(r,a,r.path,a)),value:o._parse(new si(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?In.mergeObjectAsync(n,i):In.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof qe?new Vh({keyType:t,valueType:n,typeName:Ne.ZodRecord,...Le(r)}):new Vh({keyType:ki.create(),valueType:t,typeName:Ne.ZodRecord,...Le(n)})}}class yw extends qe{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!==ue.map)return re(r,{code:Y.invalid_type,expected:ue.map,received:r.parsedType}),Te;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new si(r,a,r.path,[c,"key"])),value:s._parse(new si(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 Te;(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 Te;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}yw.create=(e,t,n)=>new yw({valueType:t,keyType:e,typeName:Ne.ZodMap,...Le(n)});class Vc extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.set)return re(r,{code:Y.invalid_type,expected:ue.set,received:r.parsedType}),Te;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(re(r,{code:Y.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&&(re(r,{code:Y.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 Te;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 si(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new Vc({...this._def,minSize:{value:t,message:ve.toString(n)}})}max(t,n){return new Vc({...this._def,maxSize:{value:t,message:ve.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Vc.create=(e,t)=>new Vc({valueType:e,minSize:null,maxSize:null,typeName:Ne.ZodSet,...Le(t)});class u0 extends qe{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})}}u0.create=(e,t)=>new u0({getter:e,typeName:Ne.ZodLazy,...Le(t)});class qh extends qe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return re(n,{received:n.data,code:Y.invalid_literal,expected:this._def.value}),Te}return{status:"valid",value:t.data}}get value(){return this._def.value}}qh.create=(e,t)=>new qh({value:e,typeName:Ne.ZodLiteral,...Le(t)});function mN(e,t){return new vo({values:e,typeName:Ne.ZodEnum,...Le(t)})}class vo extends qe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return re(n,{expected:Ye.joinValues(r),received:n.parsedType,code:Y.invalid_type}),Te}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 re(n,{received:n.data,code:Y.invalid_enum_value,options:r}),Te}return Sr(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 vo.create(t,{...this._def,...n})}exclude(t,n=this._def){return vo.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}vo.create=mN;class d0 extends qe{_parse(t){const n=Ye.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ue.string&&r.parsedType!==ue.number){const i=Ye.objectValues(n);return re(r,{expected:Ye.joinValues(i),received:r.parsedType,code:Y.invalid_type}),Te}if(this._cache||(this._cache=new Set(Ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Ye.objectValues(n);return re(r,{received:r.data,code:Y.invalid_enum_value,options:i}),Te}return Sr(t.data)}get enum(){return this._def.values}}d0.create=(e,t)=>new d0({values:e,typeName:Ne.ZodNativeEnum,...Le(t)});class Kh extends qe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.promise&&n.common.async===!1)return re(n,{code:Y.invalid_type,expected:ue.promise,received:n.parsedType}),Te;const r=n.parsedType===ue.promise?n.data:Promise.resolve(n.data);return Sr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Kh.create=(e,t)=>new Kh({type:e,typeName:Ne.ZodPromise,...Le(t)});class _o extends qe{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=>{re(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 Te;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Te:l.status==="dirty"||n.value==="dirty"?Gl(l.value):l});{if(n.value==="aborted")return Te;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Te:a.status==="dirty"||n.value==="dirty"?Gl(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"?Te:(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"?Te:(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(!Fa(o))return Te;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=>Fa(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):Te);Ye.assertNever(i)}}_o.create=(e,t,n)=>new _o({schema:e,typeName:Ne.ZodEffects,effect:t,...Le(n)});_o.createWithPreprocess=(e,t,n)=>new _o({schema:t,effect:{type:"preprocess",transform:e},typeName:Ne.ZodEffects,...Le(n)});class Ni extends qe{_parse(t){return this._getType(t)===ue.undefined?Sr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ni.create=(e,t)=>new Ni({innerType:e,typeName:Ne.ZodOptional,...Le(t)});class xo extends qe{_parse(t){return this._getType(t)===ue.null?Sr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}xo.create=(e,t)=>new xo({innerType:e,typeName:Ne.ZodNullable,...Le(t)});class Gh extends qe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ue.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Gh.create=(e,t)=>new Gh({innerType:e,typeName:Ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Le(t)});class Yh extends qe{_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 Fh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Li(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Li(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 bw extends qe{_parse(t){if(this._getType(t)!==ue.nan){const r=this._getOrReturnCtx(t);return re(r,{code:Y.invalid_type,expected:ue.nan,received:r.parsedType}),Te}return{status:"valid",value:t.data}}}bw.create=e=>new bw({typeName:Ne.ZodNaN,...Le(e)});class gN extends qe{_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 jx extends qe{_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"?Te:s.status==="dirty"?(n.dirty(),Gl(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"?Te: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 jx({in:t,out:n,typeName:Ne.ZodPipeline})}}class Xh extends qe{_parse(t){const n=this._def.innerType._parse(t),r=i=>(Fa(i)&&(i.value=Object.freeze(i.value)),i);return Fh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Xh.create=(e,t)=>new Xh({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 w=ki.create,q=Ha.create,ye=s0.create,ks=l0.create;Is.create;const ie=ti.create,P=jt.create;Uh.create;const ci=Lx.create;Wh.create;go.create;const Ds=Vh.create,J=qh.create,je=vo.create;Kh.create;Ni.create;xo.create;new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");const GO=["owner"],YO=["agent","owner","user-upload"],vN=P({id:w().min(1),relPath:w().min(1),from:je(YO),label:w().optional(),size:q().int().nonnegative(),mime:w().min(1),addedAt:q().int().nonnegative(),lastEditedAt:q().int().nonnegative().optional(),stale:ye().optional()});P({sessionId:w().min(1),relPath:w().min(1),ttlSeconds:q().int().positive().nullable().optional(),view:je(["raw","md-rendered"]).optional()});P({url:w().min(1),expiresAt:q().int().nonnegative().nullable()});P({sessionId:w().min(1),relPath:w().min(1),label:w().optional(),origin:J("agent").optional()});P({entry:vN});P({sessionId:w().min(1),relPath:w().min(1)});P({removed:J(!0)});P({sessionId:w().min(1)});P({entries:ie(vN)});P({attachmentId:w().min(1),url:w().min(1),relPath:w().min(1),sizeBytes:q().int().nonnegative(),mimeType:w().min(1)});const XO=ci("type",[P({type:J("persona"),id:w().min(1)}).strict(),P({type:J("chat"),id:w().min(1)}).strict(),P({type:J("*")}).strict()]),QO=je(["read","send","admin"]),Dx=P({resource:XO,actions:ie(QO).min(1)}).strict(),ZO=P({id:w().min(1),secretHash:w().regex(/^[a-f0-9]{64}$/),displayName:w(),grants:ie(Dx),issuedAt:q().int().nonnegative(),expiresAt:q().int().positive().optional(),maxUses:q().int().positive().optional(),usedCount:q().int().nonnegative(),peerOwnerId:w().min(1).optional(),firstUsedByPeerAt:q().int().positive().optional(),peerDisplayName:w().optional()}).strict(),JO=ZO.omit({secretHash:!0});P({type:J("whoami:ok"),owner:P({id:w(),kind:je(["owner","guest"]),displayName:w(),ownerId:w(),provider:w()}).strict(),capability:JO,grantedPersonas:ie(P({id:w().min(1),displayName:w()}).strict())}).strict();P({selfUrl:w().min(1)});P({type:J("contact:handshake:ok"),owner:P({id:w(),ownerId:w(),provider:w(),displayName:w()}),grants:ie(Dx)});P({deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();P({type:J("contact:setRemoteAccess:ok"),deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();P({type:J("contact:remote-access-updated"),deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();const e6=P({deviceId:w().min(1),ownerId:w().min(1),provider:w().min(1),displayName:w(),remoteUrl:w().min(1),connectToken:w(),grants:ie(Dx),addedAt:q().int().nonnegative(),pinnedAt:q().int().nullable().default(null),remoteAccessAllowed:ye().default(!1)}).strict(),_N=e6;P({deviceId:w().min(1)}).strict();P({type:J("contact:remove:ok"),deviceId:w().min(1)}).strict();P({type:J("contact:list:ok"),contacts:ie(_N)}).strict();P({type:J("contact:added"),contact:_N}).strict();P({type:J("contact:removed"),deviceId:w().min(1)}).strict();P({deviceId:w().min(1),pinned:ye()}).strict();P({type:J("contact:pin:ok"),deviceId:w().min(1),pinnedAt:q().int().nullable()}).strict();P({type:J("contact:pinned"),deviceId:w().min(1),pinnedAt:q().int().nullable()}).strict();const t6=P({deviceId:w().min(1),name:w().min(1),url:w().min(1)});P({type:J("device:list:ok"),devices:ie(t6)});P({deviceId:w().min(1),url:w().min(1).optional(),name:w().optional()});P({type:J("device:connect:ok"),deviceId:w(),name:w(),url:w()});const xN=P({ownerId:w().min(1),provider:w().min(1),displayName:w().min(1),avatarUrl:w().optional(),unionId:w().optional()});P({type:J("auth:login:start:ok"),authUrl:w().min(1),state:w().min(1)});P({type:J("auth:getIdentity:ok"),identity:xN.nullable(),deviceId:w().min(1),ttcTokenExpiresAt:q().nullable().optional()});P({type:J("auth:logout:ok")});P({type:J("auth:login:done"),identity:xN});P({type:J("auth:login:failed"),reason:w()});const Ox=ci("kind",[P({kind:J("success"),text:w(),filePaths:ie(w()).optional()}),P({kind:J("failure"),reason:w()})]);P({targetPersona:w().min(1).optional(),dispatchId:w().min(1).optional(),prompt:w(),targetDeviceId:w().min(1).optional(),model:w().min(1).optional(),tool:w().min(1).optional(),sessionLabel:w().min(1).max(60).optional(),meta:Ds(ks()).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"});P({dispatchId:w().min(1),outcome:Ox});const n6=["running","completed","failed"],Bx=je(n6),r6=P({dispatchId:w().min(1),sourceSessionId:w().min(1),sourcePersonaId:w().min(1).optional(),targetPersonaId:w().min(1),workerSessionId:w().min(1).optional(),taskText:w(),status:Bx,outcome:Ox.optional(),meta:Ds(ks()).optional(),createdAt:w().min(1),completedAt:w().min(1).optional(),deliveredAt:w().min(1).optional()});P({sourceSessionId:w().min(1).optional()});P({records:ie(r6)});P({dispatchId:w().min(1)});P({type:J("personaDispatch:get:ok"),status:Bx,outcome:Ox.optional()});const i6=/^[a-z0-9][a-z0-9-]*$/;je(["stopped","starting","running","crashed","invalid"]);const s6=new Set(["localhost","127.0.0.1"]);function o6(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&s6.has(t.hostname))}const cd=P({id:w().regex(i6),name:w().min(1),version:w().min(1),apiVersion:J("1"),runtime:P({startCommand:w().min(1)}).passthrough().optional(),entry:P({url:w().url().refine(o6,{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:Y.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:Y.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),a6=ci("kind",[P({kind:J("local"),port:q().int().min(1).max(65535)}),P({kind:J("hosted"),url:w().url()})]);ci("state",[P({extId:w(),manifest:cd,state:J("stopped")}),P({extId:w(),manifest:cd,state:J("starting")}),P({extId:w(),manifest:cd,state:J("running"),target:a6}),P({extId:w(),manifest:cd,state:J("crashed")}),P({extId:w(),manifest:ks().nullable(),state:J("invalid"),invalidReason:w().min(1)})]);P({snapshotHash:w().min(1),version:w().min(1),publishedAt:q()});const l6=ci("kind",[P({kind:J("p2p-tunnel"),ownerPrincipalId:w().min(1),extId:w().min(1)})]);ci("kind",[P({kind:J("p2p-tunnel"),ownerPrincipalId:w().min(1),extId:w().min(1),snapshotHash:w().min(1)})]);P({extId:w().min(1),name:w().min(1),version:w().min(1),contentHash:w().min(1),publishedAt:q()});const c6=ci("kind",[P({kind:J("clean")}),P({kind:J("ready-new-version"),fromVersion:w().min(1),toVersion:w().min(1)}),P({kind:J("error-same-hash"),version:w().min(1)}),P({kind:J("error-version-not-bumped"),localVersion:w().min(1),publishedVersion:w().min(1)}),P({kind:J("error-version-regression"),localVersion:w().min(1),publishedVersion:w().min(1)})]);P({localManifest:P({name:w().min(1),version:w().min(1),contentHash:w().min(1)}),publishState:ci("kind",[P({kind:J("unpublished")}),P({kind:J("published"),version:w().min(1),contentHash:w().min(1),publishedAt:q()})]),check:c6});P({extId:w().min(1),newVersion:w().min(1).nullish()});P({extId:w().min(1)});P({extId:w().min(1),snapshotHash:w().min(1)});P({channelRef:l6,snapshotHash:w().min(1),zipBase64:w().min(1)});P({id:w().min(1),peerDeviceId:w().min(1),senderDeviceId:w().min(1),text:w().min(1),createdAt:q().int().nonnegative(),readBy:Ds(w().min(1),q().int().positive()).default({}),origin:P({kind:J("persona"),personaId:w().min(1)}).optional()}).strict();P({peerDeviceId:w().min(1).optional(),id:w().min(1),text:w().min(1),createdAt:q().int().nonnegative(),origin:P({kind:J("persona"),personaId:w().min(1)}).optional()}).strict();P({peerDeviceId:w().min(1),sinceCreatedAt:q().int().nonnegative().optional()}).strict();P({peerDeviceId:w().min(1),upToCreatedAt:q().int().nonnegative()}).strict();P({peerDeviceId:w().min(1).optional(),text:w().min(1)});P({peerDeviceId:w().min(1).optional(),command:w().min(1),timeoutMs:q().int().positive().optional()}).strict();P({type:J("peerExec:run:ok"),stdout:w(),stderr:w(),exitCode:q().int().nullable(),timedOut:ye(),stdoutTruncated:ye(),stderrTruncated:ye()}).strict();const yN=ci("kind",[P({kind:J("at"),at:w().min(1)}),P({kind:J("every"),everyMs:q().int().positive(),anchorMs:q().int().nonnegative().optional()}),P({kind:J("cron"),expr:w().min(1),tz:w().min(1).optional()})]),mu=w().trim().min(1);P({personaId:mu,name:w().min(1),schedule:yN,prompt:w().min(1),targetPersona:w().min(1).optional(),timeoutMs:q().int().positive().optional()});P({personaId:mu,onlyMine:ye().optional()});P({personaId:mu,shiftId:w().min(1)});const u6=P({name:w().min(1).optional(),schedule:yN.optional(),prompt:w().min(1).optional(),targetPersona:w().min(1).optional(),timeoutMs:q().int().positive().optional(),enabled:ye().optional()});P({personaId:mu,shiftId:w().min(1),patch:u6});P({personaId:mu,shiftId:w().min(1),limit:q().int().positive().optional()});const bN=P({id:w().min(1),name:w().min(1),memberPersonaIds:ie(w().min(1)),memberContactDeviceIds:ie(w().min(1)),createdAt:w().min(1),updatedAt:w().min(1)}),wN=w().trim().min(1);P({name:wN,memberPersonaIds:ie(w().min(1)).default([]),memberContactDeviceIds:ie(w().min(1)).default([])});P({channelId:w().min(1),name:wN.optional(),memberPersonaIds:ie(w().min(1)).optional(),memberContactDeviceIds:ie(w().min(1)).optional()});P({channelId:w().min(1)});P({channels:ie(bN)});P({channel:bN});P({ok:J(!0),removedTopics:q().int().min(0)});const $n=w().trim().min(1),d6=["planning","running","done","archived"],h6=je(d6),f6=P({at:w().min(1),actor:w().min(1),action:w().min(1),target:w().optional(),reason:w().min(1),artifacts:ie($n).optional()}),p6=P({rejectCount:q().int().min(0),accepted:ye().default(!1)}),zx=P({id:w().min(1),channelId:w().min(1),title:w(),masterSessionId:w().min(1),goal:w(),boundaries:w(),acceptanceCriteria:ie(w()),activity:ie(f6),lineMeta:Ds(p6),state:h6,createdAt:w().min(1),updatedAt:w().min(1)}),m6=P({lineId:w().min(1),dispatchId:w().min(1),workerSessionId:w().optional(),assignee:w().min(1),focus:w(),status:Bx,acceptance:ie(w()),rejectCount:q().int().min(0),accepted:ye()});P({channelId:w().min(1)});P({topicId:w().min(1).optional(),sessionId:w().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});P({channelId:w().min(1),title:$n.optional()});P({topicId:w().min(1),title:$n.optional(),goal:$n,boundaries:w(),acceptanceCriteria:ie($n).min(1)});P({topicId:w().min(1),action:$n,target:$n.optional(),reason:$n,artifacts:ie($n).optional()});P({topicId:w().min(1),lineId:$n,reason:$n});P({topicId:w().min(1),lineId:$n,reason:$n,artifacts:ie($n).optional()});P({topicId:w().min(1),state:je(["done","archived"])});const g6=zx.extend({lineCount:q().int().min(0)});P({topics:ie(g6)});P({topic:zx,lines:ie(m6)});P({topicId:w().min(1),masterSessionId:w().min(1)});P({rejectCount:q().int().min(1),needsOwnerAttention:ye()});P({acceptedLines:q().int().min(1),totalLines:q().int().min(1),allAccepted:ye()});P({topic:zx});P({dispatchId:w().min(1)});P({digest:w(),truncated:ye()});const v6=["ask","allow","deny"],SN=je(v6),_6=P({id:w().min(1),desc:w().min(1),action:SN});P({rules:ie(_6)});P({ruleId:w().min(1)});P({action:SN,desc:w(),source:w().min(1)});const x6=["created","review-requested"],kN=/^[A-Za-z0-9._-]+$/,al=w().min(1).regex(kN),ll=w().min(1).regex(kN),gu=q().int().positive();P({role:je(x6)});P({owner:al,repo:ll,number:gu});P({owner:al,repo:ll,number:gu,expectedHeadSha:w().min(1)});P({owner:al,repo:ll,number:gu,body:w().min(1)});P({owner:al,repo:ll,number:gu,ready:ye()});P({owner:al,repo:ll});P({owner:al,repo:ll,number:gu,reviewers:ie(w().min(1)).min(1)});P({personaId:w().min(1)});const y6=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],b6=je(y6);P({personaId:w().min(1),appId:w().min(1),appSecret:w().min(1),botName:w().min(1).optional()});const w6=P({chatId:w().min(1),chatName:w().optional(),lastActiveAt:q().int().optional()}),S6=P({state:je(["unbound","provisioning","bound","broken"]),appId:w().optional(),botName:w().optional(),brokenReason:w().optional(),qrUrl:w().optional(),errorReason:b6.optional(),groups:ie(w6)});S6.extend({personaId:w().min(1)});P({});P({onboardingCompletedAt:q()});P({});P({tools:ie(P({id:je(["claude","codex"]),available:ye(),version:w().optional(),path:w().optional()}))});P({});const k6=P({tool:je(["claude","codex"]),cwd:w(),toolSessionId:w(),label:w().optional(),createdAt:w(),updatedAt:w(),turns:q()});P({candidates:ie(k6)});P({});P({registered:ye()});const C6=P({personaId:w(),label:w(),model:w().optional(),effort:w().optional(),public:ye(),iconKey:w().optional(),tool:w().optional(),createdAt:q(),updatedAt:q()}).strict(),E6=P({name:w().min(1),description:w().optional()}),T6=P({id:w().min(1)}),N6=P({permissions:P({defaultMode:w().optional(),allow:ie(w()).optional(),deny:ie(w()).optional()}).optional(),sandbox:P({enabled:ye().optional(),autoAllowBashIfSandboxed:ye().optional(),allowUnsandboxedCommands:ye().optional(),excludedCommands:ie(w()).optional(),filesystem:P({denyRead:ie(w()).optional(),allowRead:ie(w()).optional(),denyWrite:ie(w()).optional(),allowWrite:ie(w()).optional()}).optional(),network:P({allowedDomains:ie(w()).optional(),allowLocalBinding:ye().optional()}).optional()}).optional()});C6.extend({personality:w().optional(),skills:ie(E6).optional(),plugins:ie(T6).optional(),sandboxSettings:N6.nullable().optional()});P({slug:w().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:w().min(1),personality:w(),model:w().optional(),effort:w().optional(),tool:w().optional(),public:ye().optional(),iconKey:w().optional()}).strict();P({personaId:w().min(1)});P({personaId:w().min(1),patch:P({label:w().min(1).optional(),model:w().optional(),effort:w().optional(),tool:w().optional(),personality:w().optional(),public:ye().optional(),iconKey:w().nullable().optional()}).strict()}).strict();P({writableRoots:ie(w()).optional(),denyRead:ie(w()).optional(),network:ye().optional()}).strict();const CN=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","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","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","appBuilder:project-updated","appBuilder:publish-progress","appBuilder:publish-failed","larkBot:state"],EN=["idle","running","running-idle","stopped","error","observing"],I6=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools"],P6=["builtin","global","project","plugin"],R6=["builtin","global","project","policy","plugin"],TN=je(["owner","guest"]);P({id:w().min(1),kind:TN,displayName:w(),feishuUnionId:w().optional()}).strict();const M6=P({did:w().min(1),displayName:w(),feishuUnionId:w().optional(),principal:TN}).strict(),A6=je(EN),L6=P({input_tokens:q().int().nonnegative().optional(),cache_read_input_tokens:q().int().nonnegative().optional(),cache_creation_input_tokens:q().int().nonnegative().optional(),output_tokens:q().int().nonnegative().optional()}),j6=P({inputTokens:q().int().nonnegative(),outputTokens:q().int().nonnegative(),cacheReadTokens:q().int().nonnegative().optional(),cacheCreateTokens:q().int().nonnegative().optional()}),NN={gitBranch:w().optional(),resolvedModel:w().optional(),resolvedEffort:w().optional(),contextUsage:j6.optional(),contextWindowSize:q().int().positive().optional(),aiLabel:w().optional()},D6=P(NN),IN=P({value:w(),label:w(),description:w().optional()}),O6=P({id:w().min(1),label:w().min(1),description:w().optional(),contextWindowSize:q().int().positive(),default:ye().optional(),efforts:ie(IN).optional(),defaultEffort:w().optional()}),B6=P({id:w().min(1),label:w().min(1),description:w().optional()}),z6=P({name:w().min(1),type:je(["string","select","toggle"]),label:w().min(1),description:w().optional(),options:ie(IN).optional(),default:ks().optional(),scope:je(["core","tool-specific"])});P({tool:w().min(1)});const $6=P({rewind:ye(),subagents:ye(),tui:ye(),observe:ye(),fileSharing:ye(),fork:ye()});P({tool:w().min(1),toolSessionIdLabel:w().optional(),models:ie(O6),permissionModes:ie(B6),configSchema:ie(z6),features:$6});const F6=P({tool:w().min(1),pattern:w().min(1),createdAt:w().min(1).optional()});P({sessionId:w().min(1),cwd:w().min(1),tool:J("claude").or(w().min(1)).default("claude"),toolSessionId:w().optional(),label:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),...NN,aiLabelGeneratedAt:w().optional(),permissionRules:ie(F6).optional(),pinnedAt:q().int().nonnegative().nullable().optional(),archivedAt:q().int().nonnegative().nullable().optional(),pinSortOrder:q().int().nullable().optional(),unreadAt:w().min(1).nullable().optional(),iconKey:w().optional(),forkedFromSessionId:w().min(1).optional(),ephemeral:ye().optional(),ownerPersonaId:w().min(1).optional(),projectPath:w().min(1).optional(),appBuilderProject:w().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),chatId:w().min(1).optional(),creatorPrincipalId:w().min(1).optional(),creatorDisplayName:w().min(1).optional(),creatorFeishuUnionId:w().min(1).optional(),originOwnerPrincipalId:w().min(1).optional(),originOwnerPersonaId:w().min(1).optional(),dispatchedFromSessionId:w().min(1).optional(),shiftFiredFromSessionId:w().min(1).optional(),larkChatId:w().min(1).optional(),larkChatName:w().min(1).optional(),larkChatType:je(["p2p","group"]).optional(),createdAt:w().min(1),updatedAt:w().min(1)});const jn={seq:q().int().nonnegative().optional(),ts:w().optional(),uuid:w().optional()},H6=je(I6),U6=P({readCount:q().int().nonnegative().optional(),searchCount:q().int().nonnegative().optional(),bashCount:q().int().nonnegative().optional(),editFileCount:q().int().nonnegative().optional(),linesAdded:q().int().nonnegative().optional(),linesRemoved:q().int().nonnegative().optional(),otherToolCount:q().int().nonnegative().optional()}),W6=P({oldStart:q().int().nonnegative(),oldLines:q().int().nonnegative(),newStart:q().int().nonnegative(),newLines:q().int().nonnegative(),lines:ie(w())}),V6=P({agentId:w().optional(),agentType:w().optional(),status:w().optional(),prompt:w().optional(),filePath:w().optional(),structuredPatch:ie(W6).optional(),stats:P({durationMs:q().int().nonnegative().optional(),tokens:q().int().nonnegative().optional(),toolUseCount:q().int().nonnegative().optional(),toolStats:U6.optional(),usage:L6.optional()}).optional()}),q6=P({path:w(),content:w(),mtimeMs:q().optional()}),K6=P({label:w().min(1),description:w().optional()}),PN=P({question:w().min(1),multiSelect:ye(),options:ie(K6).min(1)}),G6=["completed","interrupted"];ci("kind",[P({...jn,kind:J("session_init"),toolSessionId:w().optional()}),P({...jn,kind:J("thinking"),text:w(),partialId:w().optional()}),P({...jn,kind:J("text"),text:w(),partialId:w().optional()}),P({...jn,kind:J("user_text"),text:w(),meta:H6.optional(),taskId:w().optional(),parentToolUseId:w().optional(),sender:M6.optional()}),P({...jn,kind:J("tool_call"),toolUseId:w(),tool:w(),toolKind:w().optional(),input:ks()}),P({...jn,kind:J("tool_result"),toolUseId:w(),output:ks().optional(),error:w().optional(),toolResultExtra:V6.optional(),sourceToolAssistantUUID:w().optional(),askQuestionAnswers:Ds(w(),w()).optional()}),P({...jn,kind:J("attachment_memories"),memories:ie(q6)}),P({...jn,kind:J("permission_request"),requestId:w(),tool:w(),input:ks(),toolUseId:w().optional()}),P({...jn,kind:J("ask_user_question"),toolUseId:w(),questions:ie(PN)}),P({...jn,kind:J("turn_end"),durationMs:q().int().nonnegative().optional(),reason:je(G6).optional()}),P({...jn,kind:J("subagent_progress"),toolUseId:w(),agentId:w(),status:je(["started","running","completed","failed"]),description:w().optional(),lastToolName:w().optional(),prompt:w().optional(),stats:P({durationMs:q().int().nonnegative().optional(),tokens:q().int().nonnegative().optional(),toolUseCount:q().int().nonnegative().optional()}).optional()}),P({...jn,kind:J("error"),message:w()}),P({...jn,kind:J("meta_update"),patch:D6}),P({...jn,kind:J("meta-text"),text:w(),metaSource:je(["cc","owner"]).optional()})]);P({cwd:w().min(1).optional(),tool:w().optional(),label:w().optional(),aiLabel:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),iconKey:w().optional(),forkedFromSessionId:w().min(1).optional(),ephemeral:ye().optional(),ownerPersonaId:w().min(1).optional(),projectPath:w().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});P({path:w().min(1),name:w().min(1),createdAt:w().datetime(),pinnedAt:q().optional()});P({path:w().min(1),pinnedAt:q().nullable()});P({path:w().min(1)});P({path:w().min(1).optional(),name:w().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});P({cwd:w().min(1),tool:w().min(1),toolSessionId:w().min(1),label:w().optional(),aiLabel:w().optional(),iconKey:w().optional(),createdAt:w().datetime(),updatedAt:w().datetime(),ownerPersonaId:w().min(1).optional()});P({originOnly:ye().optional(),ownerPersonaId:w().min(1).optional(),limit:q().int().positive().optional(),offset:q().int().nonnegative().optional()});P({sessionId:w().min(1)});P({sessionId:w().min(1),patch:P({label:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),cwd:w().optional(),iconKey:w().optional(),ephemeral:J(!1).optional()})});P({sessionId:w().min(1),text:w()});P({sessionId:w().min(1),userMessageId:w().min(1),dryRun:ye().optional()});P({canRewind:ye(),error:w().optional(),filesChanged:ie(w()).optional(),insertions:q().int().nonnegative().optional(),deletions:q().int().nonnegative().optional()});P({sessionId:w().min(1),userMessageId:w().min(1)});const Y6=P({oldStart:q().int().nonnegative(),oldLines:q().int().nonnegative(),newStart:q().int().nonnegative(),newLines:q().int().nonnegative(),lines:ie(w())}),X6=P({filePath:w().min(1),hunks:ie(Y6),insertions:q().int().nonnegative(),deletions:q().int().nonnegative(),status:je(["modified","added","deleted"]).optional()});P({canRewind:ye(),error:w().optional(),files:ie(X6),totalInsertions:q().int().nonnegative(),totalDeletions:q().int().nonnegative()});P({userMessageIds:ie(w())});P({sessionId:w().min(1),toolSessionId:w().min(1)});P({cwd:w().min(1),toolSessionId:w().min(1),messageUuid:w().min(1),targetCwd:w().min(1).optional()});P({forkedToolSessionId:w().min(1),forkedFilePath:w().min(1)});P({sessionId:w().min(1),toolSessionId:w().min(1),jsonlPath:w().optional()});P({sessionId:w().min(1),afterSeq:q().int().min(-1)});P({sessionId:w().min(1),permissionRequestId:w().min(1),allow:ye(),permanent:ye().optional(),pattern:w().optional()});P({projectPath:w().min(1)});P({sessionId:w().min(1),limit:q().int().positive().max(5e3).optional(),offset:q().int().nonnegative().optional(),slim:ye().optional()});P({cwd:w().min(1),toolSessionId:w().min(1)});P({cwd:w().min(1),toolSessionId:w().min(1),subagentId:w().min(1)});P({cwd:w().min(1).optional(),path:w().optional(),showHidden:ye().optional()});P({cwd:w().min(1),path:w().min(1)});P({cwd:w().min(1),tool:w().optional()});P({name:w().min(1),source:je(P6),path:w().optional(),description:w().optional(),plugin:w().optional()});const Q6=P({name:w().min(1),source:je(R6),path:w().optional(),description:w().optional(),whenToUse:w().optional(),plugin:w().optional()});P({cwd:w().min(1),tool:w().optional()});P({agents:ie(Q6)});P({sessionId:w().optional()});P({sessionId:w().min(1).optional()});P({sessionId:w().min(1),pinned:ye()});P({sessionId:w().min(1),archived:ye()});P({type:J("peerSession:upsert:ok")});P({sessionId:w().min(1)});P({type:J("peerSession:remove:ok")});P({orderedIds:ie(w().min(1)).min(1)});P({cwd:w().min(1)});P({isGitRoot:ye(),gitRoot:w().nullable()});P({cwd:w().min(1)});P({branch:w().nullable()});P({cwd:w().min(1)});P({branches:ie(w()),head:w().nullable()});P({}).optional();const Z6=P({cwd:w().min(1),updatedAt:w().min(1)});P({dirs:ie(Z6)});P({type:J("session:question"),sessionId:w().min(1),toolUseId:w().min(1),requestId:w().min(1),questions:ie(PN).min(1)});P({type:J("session:question:cleared"),sessionId:w().min(1),toolUseId:w().min(1),answers:Ds(w(),w()).optional()});P({sessionId:w().min(1),toolUseId:w().min(1),answers:Ds(w(),w())});P({ok:J(!0)});P({sessionId:w().min(1),toolUseId:w().min(1)});P({ok:J(!0)});const RN=P({name:w().min(1),version:w().min(1),instanceId:w().min(1),deviceLabel:w().transform(e=>e.trim().slice(0,64)).optional()});P({type:J("auth"),token:w().min(1),scheme:J("bearer").optional(),clientInfo:RN.optional()});P({type:J("auth:ok"),version:w().min(1).optional(),protocolVersion:q().int().nonnegative().optional()});const J6=P({clientId:w().min(1),connectedAt:q().int().nonnegative(),self:ye(),clientInfo:RN.optional()});P({type:J("device:connections:ok"),connections:ie(J6)});P({type:J("tunnel:ready"),url:w().min(1),subdomain:w().min(1)});P({type:J("tunnel:exited"),code:q().int().nullable(),subdomain:w().nullable(),url:w().nullable()});P({type:J("tunnel:unavailable"),reason:w().min(1),failedAt:w().min(1)});const eB=P({sessionId:w().min(1),status:A6,freshSpawn:ye(),pendingPermissionRequestIds:ie(w().min(1)),pendingQuestionToolUseIds:ie(w().min(1))});P({type:J("info"),version:w(),protocolVersion:q(),hostname:w(),os:w(),tools:ie(P({id:w(),available:ye()})),runningSessions:ie(eB),tokenRole:je(GO).optional(),isLoopback:ye().optional(),httpBaseUrl:w().optional(),httpToken:w().optional(),daemonSource:je(["ota","packaged"]).optional(),globalCliVersion:w().nullable().optional()});const tB=6173,nB=6272,cl=/^[a-z][a-z0-9-]{0,39}$/,vu=P({name:w().regex(cl,{message:"kebab-case, 小写字母开头,只允许小写字母 / 数字 / -,最长 40 字符"}),port:q().int().min(tB).max(nB),createdAt:w().datetime(),devCommand:w().min(1),prodUrl:w().url().optional(),readyPattern:w().optional(),publishJob:P({jobId:w().min(1),stage:je(["build","deploy","verify"]),startedAt:q().int().nonnegative()}).optional()}),rB=["install-pending","installing","starting-dev-server","running","stopped","failed"],MN=je(rB),$x=vu.extend({isRunning:ye(),boundSessionId:w().nullable(),stage:MN.optional(),stageReason:w().optional(),publishJob:P({jobId:w().min(1),stage:je(["build","deploy","verify"]),startedAt:q().int().nonnegative(),status:je(["in-flight","interrupted"])}).optional()});P({}).strict();P({projects:ie($x)}).strict();P({sessionId:w().min(1)}).strict();P({project:$x.nullable()}).strict();P({sessionId:w().min(1),name:w().min(1)}).strict();P({project:vu}).strict();P({name:w()}).strict();P({}).strict();P({name:w(),newPort:q().int()}).strict();P({project:vu}).strict();P({name:w().regex(cl),url:w().url()}).strict();P({project:vu}).strict();P({sessionId:w().min(1),force:ye().optional()}).strict();P({project:vu}).strict();const iB=["installing","failed"];P({sessionId:w().min(1),stage:je(iB),reason:w().optional()}).strict();P({ok:J(!0)}).strict();P({sessionId:w().min(1)}).strict();P({ok:J(!0)}).strict();P({type:J("appBuilder:project-updated"),project:$x,stage:MN,stageReason:w().optional()}).strict();P({name:w().regex(cl)});P({jobId:w().min(1),status:je(["started","already-publishing"])}).strict();P({name:w().regex(cl)});P({ok:J(!0)}).strict();P({type:J("appBuilder:publish-progress"),name:w().regex(cl),jobId:w().min(1),stage:je(["build","deploy","verify"]),status:je(["started","completed"])}).strict();P({type:J("appBuilder:publish-failed"),name:w().regex(cl),jobId:w().min(1),stage:je(["build","deploy","verify","unknown"]),errorSummary:w()}).strict();P({});P({method:w().min(1).optional()});const sB=["allowed","conditional","denied"],oB=je(sB),aB=P({name:w().min(1),status:oB,description:w().min(1),args:ie(P({name:w(),required:ye()})).nullable(),argsSchema:Ds(ks()).optional(),reason:w().optional()});P({type:J("meta:methods"),methods:ie(aB)});const ww=1,lB=["daemon","main","renderer"],cB=je(lB),uB=["debug","info","warn","error"],dB=je(uB);P({ts:q().int(),source:cB,level:dB,msg:w(),ownerPrincipalId:w(),deviceId:w(),appVersion:w(),daemonVersion:w().optional(),os:w(),meta_json:w().optional(),sessionId:w().optional()});P({v:J(1),visitorId:w().min(1),displayName:w(),provider:w(),iat:q(),exp:q()});const hB=P({visitorId:w(),displayName:w(),avatarUrl:w().optional(),provider:w(),firstSeen:q(),lastSeen:q()});P({visitors:ie(hB)});const fB=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,pB=new Set(["localhost","127.0.0.1","0.0.0.0","::1"]);let mi=null;function mB(){if(mi!==null)return mi;if(typeof window>"u")return mi=!1,!1;if(pB.has(window.location.hostname)||window.location.protocol==="file:")return mi=!0,!0;if(new URLSearchParams(window.location.search).get("debug")==="1"){mi=!0;try{sessionStorage.setItem("debug","1")}catch{}}else try{mi=sessionStorage.getItem("debug")==="1"}catch{mi=!1}return mi}function Ae(e,...t){mB()&&console.log(`[${e}][${new Date().toISOString()}]`,...t)}function ud(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 gB=e=>{const t=[1e3,2e3,4e3,8e3,16e3,3e4];return t[Math.min(e,t.length-1)]},vB=new Set(["auth:ok","pong","error"]),Sw=new Set(CN.filter(e=>!vB.has(e)));let _B=0;const kw=()=>`r${++_B}`;function xB(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??gB;let u=null,d=!1,f=0,p=null,m=null,v=null,b=null,_=!1,x="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(V=>{try{V(E)}catch{}})},T=B=>{x!==B&&(x=B,k("status",B))},N=(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),b&&(clearTimeout(b),b=null)},I=()=>{v&&clearTimeout(v),v=setTimeout(()=>{try{u==null||u.close(4e3,"pong watchdog")}catch{}},a)},M=()=>{m&&clearInterval(m),m=setInterval(()=>{(u==null?void 0:u.readyState)===1&&u.send(JSON.stringify({type:"ping",requestId:kw()}))},o),I()},A=B=>{for(const[,E]of y)clearTimeout(E.timer),E.reject(new Error(B));y.clear()},R=[],j=()=>{if(R.length===0)return;const B=R.splice(0);for(const E of B)(u==null?void 0:u.readyState)===1&&!_?E.doSend():(clearTimeout(E.timer),E.reject(new Error("NOT_CONNECTED")))},D=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);B<0||(k("daemon:reconnecting",{attempt:f+1,nextDelayMs:B,scheduledAt:Date.now()}),p&&clearTimeout(p),p=setTimeout(()=>{f+=1,O()},B))},F=B=>{I();const E=String(B.type??"");if(E==="auth:ok"){Ae("daemon-client","auth:ok received → connected",{url:t}),b&&(clearTimeout(b),b=null),_=!1,f=0,T("connected"),k("daemon:connected",{url:t}),M(),j();return}if(E==="pong")return;if(E==="ready"){const V=Number(B.protocolVersion??-1);V!==ww&&k("daemon:version-mismatch",{daemonProtocol:V,supportedProtocol:ww}),k("ready",B);return}const H=B.requestId;if(typeof H=="string"&&y.has(H)){const V=y.get(H);if(y.delete(H),clearTimeout(V.timer),E==="error"){const L=String(B.code??"ERR"),ne=String(B.message??"unknown");V.reject(new Error(`${L}: ${ne}`))}else Sw.has(E)&&k(E,B),V.resolve(B);return}Sw.has(E)&&k(E,B)},O=()=>{p&&(clearTimeout(p),p=null),Ae("daemon-client","connect →",{url:t,token:ud(n),attempt:f}),T("connecting");let B;try{B=new WebSocket(t)}catch(E){T("disconnected"),k("daemon:disconnected",{reason:(E==null?void 0:E.message)??"ws constructor failed"}),$();return}u=B,_=!!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:ud(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)),b=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,T("connected"),k("daemon:connected",{url:t}),M(),j()},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:_,manualStop:d}),z(),A(`connection closed: ${H}`),u=null,E.code===4401?T("revoked"):T("disconnected"),k("daemon:disconnected",{reason:H}),E.code===1008||E.code===4401){D(`connection closed: ${H}`);return}d?D(`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,O()},stop(){d=!0,p&&(clearTimeout(p),p=null),z();try{u==null||u.close(1e3,"shutdown")}catch{}u=null,A("shutdown"),D("shutdown"),T("disconnected")},switchProfile(B){Ae("daemon-client","switchProfile →",{url:B.url,token:ud(B.authToken)},"prev:",{url:t,token:ud(n)}),t=B.url,n=B.authToken,B.selfIdentity!==void 0&&(r=B.selfIdentity),f=0,d=!0,p&&(clearTimeout(p),p=null),z(),A("switch profile"),D("switch profile");try{u==null||u.close(1e3,"switch profile")}catch{}u=null,d=!1,O()},request(B,E){return new Promise((H,V)=>{const L=kw(),ne=setTimeout(()=>{y.delete(L);const G=R.findIndex(be=>be.timer===ne);G>=0&&R.splice(G,1),V(new Error(`request timeout: ${B}`))},s),le=()=>{y.set(L,{resolve:G=>H(G),reject:V,timer:ne}),u.send(JSON.stringify({...E,type:B,requestId:L}))};(u==null?void 0:u.readyState)===1&&!_?le():d||u==null&&p==null?(clearTimeout(ne),V(new Error("NOT_CONNECTED"))):R.push({doSend:le,reject:V,timer:ne})})},on:N,get isOpen(){return(u==null?void 0:u.readyState)===1&&!_},get url(){return t},getStatus(){return x}}}function yB(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 bB(e){return e?{id:e.id,mode:e.mode,url:e.url,token:yB(e.token),name:e.name}:null}function dd(e){return e?Array.isArray(e)?e.map(bB):{_notArray:typeof e,_value:e}:null}function Cw(e){return e==null?null:typeof e=="object"&&"value"in e?e.value:e}const wB="ws://127.0.0.1:18790",Ew="daemon:profiles",Tw="daemon:active-profile-id";function SB(){return Math.random().toString(36).slice(2,10)}function kB(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 CB(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 AN(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 →",dd(t.profiles),"active:",t.activeId),await e.kv.set(Ew,t.profiles),await e.kv.set(Tw,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(Ew);c=Cw(d)}catch{c=null}let u=null;try{const d=await e.kv.get(Tw);u=Cw(d)??null}catch{u=null}if(Ae("profile-store","ensureLoaded read kv →","profiles:",dd(c),"activeId:",u),Array.isArray(c)&&c.length>0){const d=c.filter(CB),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",dd(d),"active:",f);return}t={profiles:[{id:"default",name:"本机",mode:"localhost",url:wB}],activeId:"default"},Ae("profile-store","ensureLoaded → fallback synthesized default (NO token)",dd(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 b;await a();let c=l.url,u=l.token;if(c&&c.includes("#")){const _=kB(c);c=_.url,!u&&_.token&&(u=_.token)}const d=l.id?t.profiles.find(_=>_.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??SB(),m={id:p,name:((b=l.name)==null?void 0:b.trim())||(d==null?void 0:d.name)||(l.mode==="remote"?"远程":"本机"),mode:l.mode,url:c.trim(),token:f};return t={profiles:[...t.profiles.filter(_=>_.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 Nw="clawd.client-instance-id";let EB={name:"clawd-web",version:"unknown"};function TB(){let e=null;try{e=localStorage.getItem(Nw),e||(e=crypto.randomUUID(),localStorage.setItem(Nw,e))}catch{e=e??crypto.randomUUID()}return{...EB,instanceId:e}}function Iw(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 LN=g.createContext(null);function NB({host:e,children:t}){const[n,r]=g.useState(null),i=g.useMemo(()=>async()=>{const s=AN(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:Iw(a.token)}),{client:xB({url:a.url,authToken:a.token,clientInfo:TB()}),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:Iw(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(LN.Provider,{value:n,children:t}):null}function ui(){const e=g.useContext(LN);if(!e)throw new Error("useDaemonClient must be used inside <DaemonProvider>");return e.client}function IB(){const e=ui(),[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 PB(){const e=ui(),[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 jN=g.createContext(null);function RB({cache:e,children:t}){return g.createElement(jN.Provider,{value:e},t)}function Mo(){const e=g.useContext(jN);if(!e)throw new Error("useCache must be used inside <CacheProvider>");return e}function oi(e){const t=Mo(),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 DN={actionsLevel:"none",httpBaseUrl:null,httpToken:null},ON=g.createContext(DN);function np(){return g.useContext(ON)}function MB(e){return e!=null&&e.httpBaseUrl?{actionsLevel:e.tokenRole==="owner"?"owner":"none",httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken??null}:DN}function AB(){const e=oi("daemon-info");return g.useMemo(()=>MB(e),[e])}function LB({children:e}){const t=AB();return Ze.createElement(ON.Provider,{value:t},e)}function jB(e,t,n){if(!e.httpBaseUrl)return null;const r=encodeURIComponent(n);return`${e.httpBaseUrl}/session/${encodeURIComponent(t.sessionId)}/files?path=${r}`}function DB(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 OB(){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 BB(e){return{request:(t,n)=>e.request(t,n),onFrame(t){const n=[];for(const r of CN)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 BN(e){const t=(e??"claude")==="claude";return{rewind:t,subagents:t,tui:t,observe:t,fileSharing:t,fork:t}}const zB=e=>({tool:e,models:[{id:"",label:"未指定",contextWindowSize:2e5,default:!0}],permissionModes:[{id:"",label:"未指定"}],configSchema:[],features:BN(e)});function $B(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,()=>zB(r))}},o=e.onConnect(()=>{s()});return s(),()=>{i=!0,o()}}}}function FB(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:{}};function Nm(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 zN(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=Nm(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:events":{if(!r||t.sessionId!==r)return e;const i=t.events.map(o=>o.event),s=i.reduce((o,a)=>Nm(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)=>Nm(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 HB="session/";function UB(e){return{sid:e.slice(HB.length)}}const WB=new Set(EN);function $N(e){return WB.has(e)}function Pw(e){return $N(e)?e:"idle"}function VB(e,t){return{start(n){const{sid:r}=UB(n);let i=!1,s=-1;const o=f=>{t(n,p=>zN(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??[],b=m.latestSeq??-1;if(f==="baseline")o({type:"session:events",sessionId:r,events:v,latestSeq:b}),s=b;else{const _=m.bufferStartSeq??0,x=b<p||_>p+1;o({type:x?"session:events":"session:events:append",sessionId:r,events:v,latestSeq:b}),s=Math.max(s,b)}}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:Pw(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(!$N(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==="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:Pw(v.status)}))})}),d=e.onConnect(()=>{c()});return e.isConnected&&c(),()=>{i=!0,u(),d(),e.request("session:unsubscribe",{sessionId:r}).catch(()=>{})}}}}const qB=new Set(["tunnel:ready","tunnel:exited","tunnel:unavailable"]);function KB(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=>{qB.has(a)&&i()});return i(),()=>{r=!0,s(),o()}}}}function GB(){return{start(){return()=>{}}}}function YB(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 XB(e){const t=BB(e),n=OB();let r=null;const i=(o,a)=>{r==null||r.setData(o,a)};n.register(/^capabilities\//,$B(t,i)),n.register(/^sessions$/,FB(t,i)),n.register(/^session\//,VB(t,i)),n.register(/^personas$/,YB(t,i)),n.register(/^persona-detail\//,GB()),n.register(/^daemon-info$/,KB(t,i));const s=DB({onFirstObserver:o=>{o&&n.activate(o)},onLastObserver:o=>{o&&n.deactivate(o)}});return r=s,{cache:s,channel:t}}class Fx{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){return this.client.request("session:send",{sessionId:t,text: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})}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")}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)}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 QB(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 ZB(e){const t=Mo(),n=oi(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 ul(){const e=ui();return g.useMemo(()=>new Fx(e),[e])}function FN(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 HN(){const e=Mo(),t=ul(),n=oi("personas")??[],r=g.useMemo(()=>n.map(s=>FN(s)),[n]),i=g.useCallback(async()=>{const s=await t.personaList();e.setData("personas",()=>s.personas??[])},[t,e]);return{personas:r,raw:n,loaded:oi("personas")!==void 0,refresh:i}}function UN(e){const{raw:t}=HN(),n=Mo(),r=ul(),i=e?t.find(a=>a.personaId===e)??null:null,s=i?FN(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 JB(e){const t=ul(),n=Mo(),r=e?`persona-detail/${e}`:"",i=oi(r),s=g.useCallback(async()=>{const o={personality:"",skills:[],plugins:[],sandboxSettings:null};if(!e)return o;const a=await t.personaGet(e);let l;if("persona"in a&&a.persona===null)l=o;else{const c=a;l={personality:c.personality??"",skills:c.skills??[],plugins:c.plugins??[],sandboxSettings:c.sandboxSettings??null}}return n.setData(r,()=>l),l},[t,n,e,r]);return g.useEffect(()=>{e&&s()},[e,s]),{personality:(i==null?void 0:i.personality)??"",skills:(i==null?void 0:i.skills)??[],plugins:(i==null?void 0:i.plugins)??[],sandboxSettings:(i==null?void 0:i.sandboxSettings)??null,loaded:i!==void 0,refresh:s}}function WN(){const e=Mo(),t=ul();return g.useCallback(async()=>{const n=await t.personaList();e.setData("personas",()=>n.personas??[])},[e,t])}function ez(){const e=ul(),t=WN();return g.useCallback(async(n,r)=>{const i=await e.personaUpdate(n,r);return await t(),i},[e,t])}function tz(){const e=ul(),t=WN();return g.useCallback(async n=>{await e.personaDelete(n),await t()},[e,t])}const Rw="clawd:sidebar:tree-collapsed";function nz(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function rz(e){const t=nz(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 iz(){const e=Sx(),[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(Rw);if(l)return;n(rz(c))}catch{}})(),()=>{l=!0}},[e]);const i=g.useCallback(l=>{e.kv.set(Rw,[...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 Hx=g.createContext(null);function sz(){const e=g.useContext(Hx);if(!e)throw new Error("SessionTreeCollapsedContext.Provider missing — wrap SessionTreeNode tree with <SessionTreeCollapsedContext.Provider value={useSessionTreeCollapsed()}>");return e}/**
|
|
96
96
|
* @license lucide-react v0.577.0 - ISC
|
|
97
97
|
*
|
|
98
98
|
* This source code is licensed under the ISC license.
|