@openscout/scout 0.2.62 → 0.2.63

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.
@@ -1,140 +0,0 @@
1
- function A2(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const o in a)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(a,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>a[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function TN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ip={exports:{}},Pl={};var Cw;function M2(){if(Cw)return Pl;Cw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var f in o)f!=="key"&&(l[f]=o[f])}else l=o;return o=l.ref,{$$typeof:e,type:a,key:u,ref:o!==void 0?o:null,props:l}}return Pl.Fragment=t,Pl.jsx=n,Pl.jsxs=n,Pl}var Tw;function R2(){return Tw||(Tw=1,ip.exports=M2()),ip.exports}var i=R2(),op={exports:{}},Ze={};var Aw;function _2(){if(Aw)return Ze;Aw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function w(O){return O===null||typeof O!="object"?null:(O=b&&O[b]||O["@@iterator"],typeof O=="function"?O:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,C={};function k(O,Z,W){this.props=O,this.context=Z,this.refs=C,this.updater=W||j}k.prototype.isReactComponent={},k.prototype.setState=function(O,Z){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,Z,"setState")},k.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function E(){}E.prototype=k.prototype;function S(O,Z,W){this.props=O,this.context=Z,this.refs=C,this.updater=W||j}var R=S.prototype=new E;R.constructor=S,N(R,k.prototype),R.isPureReactComponent=!0;var A=Array.isArray;function M(){}var D={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function F(O,Z,W){var Q=W.ref;return{$$typeof:e,type:O,key:Z,ref:Q!==void 0?Q:null,props:W}}function P(O,Z){return F(O.type,Z,O.props)}function _(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function z(O){var Z={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(W){return Z[W]})}var B=/\/+/g;function V(O,Z){return typeof O=="object"&&O!==null&&O.key!=null?z(""+O.key):Z.toString(36)}function K(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(M,M):(O.status="pending",O.then(function(Z){O.status==="pending"&&(O.status="fulfilled",O.value=Z)},function(Z){O.status==="pending"&&(O.status="rejected",O.reason=Z)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function L(O,Z,W,Q,ce){var ae=typeof O;(ae==="undefined"||ae==="boolean")&&(O=null);var ge=!1;if(O===null)ge=!0;else switch(ae){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(O.$$typeof){case e:case t:ge=!0;break;case p:return ge=O._init,L(ge(O._payload),Z,W,Q,ce)}}if(ge)return ce=ce(O),ge=Q===""?"."+V(O,0):Q,A(ce)?(W="",ge!=null&&(W=ge.replace(B,"$&/")+"/"),L(ce,Z,W,"",function(Oe){return Oe})):ce!=null&&(_(ce)&&(ce=P(ce,W+(ce.key==null||O&&O.key===ce.key?"":(""+ce.key).replace(B,"$&/")+"/")+ge)),Z.push(ce)),1;ge=0;var ye=Q===""?".":Q+":";if(A(O))for(var be=0;be<O.length;be++)Q=O[be],ae=ye+V(Q,be),ge+=L(Q,Z,W,ae,ce);else if(be=w(O),typeof be=="function")for(O=be.call(O),be=0;!(Q=O.next()).done;)Q=Q.value,ae=ye+V(Q,be++),ge+=L(Q,Z,W,ae,ce);else if(ae==="object"){if(typeof O.then=="function")return L(K(O),Z,W,Q,ce);throw Z=String(O),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return ge}function H(O,Z,W){if(O==null)return O;var Q=[],ce=0;return L(O,Q,"","",function(ae){return Z.call(W,ae,ce++)}),Q}function $(O){if(O._status===-1){var Z=O._result;Z=Z(),Z.then(function(W){(O._status===0||O._status===-1)&&(O._status=1,O._result=W)},function(W){(O._status===0||O._status===-1)&&(O._status=2,O._result=W)}),O._status===-1&&(O._status=0,O._result=Z)}if(O._status===1)return O._result.default;throw O._result}var G=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},X={map:H,forEach:function(O,Z,W){H(O,function(){Z.apply(this,arguments)},W)},count:function(O){var Z=0;return H(O,function(){Z++}),Z},toArray:function(O){return H(O,function(Z){return Z})||[]},only:function(O){if(!_(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Ze.Activity=y,Ze.Children=X,Ze.Component=k,Ze.Fragment=n,Ze.Profiler=o,Ze.PureComponent=S,Ze.StrictMode=a,Ze.Suspense=m,Ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ze.__COMPILER_RUNTIME={__proto__:null,c:function(O){return D.H.useMemoCache(O)}},Ze.cache=function(O){return function(){return O.apply(null,arguments)}},Ze.cacheSignal=function(){return null},Ze.cloneElement=function(O,Z,W){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var Q=N({},O.props),ce=O.key;if(Z!=null)for(ae in Z.key!==void 0&&(ce=""+Z.key),Z)!U.call(Z,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&Z.ref===void 0||(Q[ae]=Z[ae]);var ae=arguments.length-2;if(ae===1)Q.children=W;else if(1<ae){for(var ge=Array(ae),ye=0;ye<ae;ye++)ge[ye]=arguments[ye+2];Q.children=ge}return F(O.type,ce,Q)},Ze.createContext=function(O){return O={$$typeof:u,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:l,_context:O},O},Ze.createElement=function(O,Z,W){var Q,ce={},ae=null;if(Z!=null)for(Q in Z.key!==void 0&&(ae=""+Z.key),Z)U.call(Z,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(ce[Q]=Z[Q]);var ge=arguments.length-2;if(ge===1)ce.children=W;else if(1<ge){for(var ye=Array(ge),be=0;be<ge;be++)ye[be]=arguments[be+2];ce.children=ye}if(O&&O.defaultProps)for(Q in ge=O.defaultProps,ge)ce[Q]===void 0&&(ce[Q]=ge[Q]);return F(O,ae,ce)},Ze.createRef=function(){return{current:null}},Ze.forwardRef=function(O){return{$$typeof:f,render:O}},Ze.isValidElement=_,Ze.lazy=function(O){return{$$typeof:p,_payload:{_status:-1,_result:O},_init:$}},Ze.memo=function(O,Z){return{$$typeof:h,type:O,compare:Z===void 0?null:Z}},Ze.startTransition=function(O){var Z=D.T,W={};D.T=W;try{var Q=O(),ce=D.S;ce!==null&&ce(W,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(M,G)}catch(ae){G(ae)}finally{Z!==null&&W.types!==null&&(Z.types=W.types),D.T=Z}},Ze.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ze.use=function(O){return D.H.use(O)},Ze.useActionState=function(O,Z,W){return D.H.useActionState(O,Z,W)},Ze.useCallback=function(O,Z){return D.H.useCallback(O,Z)},Ze.useContext=function(O){return D.H.useContext(O)},Ze.useDebugValue=function(){},Ze.useDeferredValue=function(O,Z){return D.H.useDeferredValue(O,Z)},Ze.useEffect=function(O,Z){return D.H.useEffect(O,Z)},Ze.useEffectEvent=function(O){return D.H.useEffectEvent(O)},Ze.useId=function(){return D.H.useId()},Ze.useImperativeHandle=function(O,Z,W){return D.H.useImperativeHandle(O,Z,W)},Ze.useInsertionEffect=function(O,Z){return D.H.useInsertionEffect(O,Z)},Ze.useLayoutEffect=function(O,Z){return D.H.useLayoutEffect(O,Z)},Ze.useMemo=function(O,Z){return D.H.useMemo(O,Z)},Ze.useOptimistic=function(O,Z){return D.H.useOptimistic(O,Z)},Ze.useReducer=function(O,Z,W){return D.H.useReducer(O,Z,W)},Ze.useRef=function(O){return D.H.useRef(O)},Ze.useState=function(O){return D.H.useState(O)},Ze.useSyncExternalStore=function(O,Z,W){return D.H.useSyncExternalStore(O,Z,W)},Ze.useTransition=function(){return D.H.useTransition()},Ze.version="19.2.3",Ze}var Mw;function Ec(){return Mw||(Mw=1,op.exports=_2()),op.exports}var v=Ec();const xo=TN(v),AN=A2({__proto__:null,default:xo},[v]);var lp={exports:{}},Ll={},cp={exports:{}},up={};var Rw;function O2(){return Rw||(Rw=1,(function(e){function t(L,H){var $=L.length;L.push(H);e:for(;0<$;){var G=$-1>>>1,X=L[G];if(0<o(X,H))L[G]=H,L[$]=X,$=G;else break e}}function n(L){return L.length===0?null:L[0]}function a(L){if(L.length===0)return null;var H=L[0],$=L.pop();if($!==H){L[0]=$;e:for(var G=0,X=L.length,O=X>>>1;G<O;){var Z=2*(G+1)-1,W=L[Z],Q=Z+1,ce=L[Q];if(0>o(W,$))Q<X&&0>o(ce,W)?(L[G]=ce,L[Q]=$,G=Q):(L[G]=W,L[Z]=$,G=Z);else if(Q<X&&0>o(ce,$))L[G]=ce,L[Q]=$,G=Q;else break e}}return H}function o(L,H){var $=L.sortIndex-H.sortIndex;return $!==0?$:L.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var m=[],h=[],p=1,y=null,b=3,w=!1,j=!1,N=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function R(L){for(var H=n(h);H!==null;){if(H.callback===null)a(h);else if(H.startTime<=L)a(h),H.sortIndex=H.expirationTime,t(m,H);else break;H=n(h)}}function A(L){if(N=!1,R(L),!j)if(n(m)!==null)j=!0,M||(M=!0,z());else{var H=n(h);H!==null&&K(A,H.startTime-L)}}var M=!1,D=-1,U=5,F=-1;function P(){return C?!0:!(e.unstable_now()-F<U)}function _(){if(C=!1,M){var L=e.unstable_now();F=L;var H=!0;try{e:{j=!1,N&&(N=!1,E(D),D=-1),w=!0;var $=b;try{t:{for(R(L),y=n(m);y!==null&&!(y.expirationTime>L&&P());){var G=y.callback;if(typeof G=="function"){y.callback=null,b=y.priorityLevel;var X=G(y.expirationTime<=L);if(L=e.unstable_now(),typeof X=="function"){y.callback=X,R(L),H=!0;break t}y===n(m)&&a(m),R(L)}else a(m);y=n(m)}if(y!==null)H=!0;else{var O=n(h);O!==null&&K(A,O.startTime-L),H=!1}}break e}finally{y=null,b=$,w=!1}H=void 0}}finally{H?z():M=!1}}}var z;if(typeof S=="function")z=function(){S(_)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,V=B.port2;B.port1.onmessage=_,z=function(){V.postMessage(null)}}else z=function(){k(_,0)};function K(L,H){D=k(function(){L(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(L){switch(b){case 1:case 2:case 3:var H=3;break;default:H=b}var $=b;b=H;try{return L()}finally{b=$}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(L,H){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var $=b;b=L;try{return H()}finally{b=$}},e.unstable_scheduleCallback=function(L,H,$){var G=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?G+$:G):$=G,L){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=$+X,L={id:p++,callback:H,priorityLevel:L,startTime:$,expirationTime:X,sortIndex:-1},$>G?(L.sortIndex=$,t(h,L),n(m)===null&&L===n(h)&&(N?(E(D),D=-1):N=!0,K(A,$-G))):(L.sortIndex=X,t(m,L),j||w||(j=!0,M||(M=!0,z()))),L},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(L){var H=b;return function(){var $=b;b=H;try{return L.apply(this,arguments)}finally{b=$}}}})(up)),up}var _w;function I2(){return _w||(_w=1,cp.exports=O2()),cp.exports}var dp={exports:{}},Mn={};var Ow;function D2(){if(Ow)return Mn;Ow=1;var e=Ec();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(m,h,p){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:m,containerInfo:h,implementation:p}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Mn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Mn.createPortal=function(m,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(m,h,null,p)},Mn.flushSync=function(m){var h=u.T,p=a.p;try{if(u.T=null,a.p=2,m)return m()}finally{u.T=h,a.p=p,a.d.f()}},Mn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(m,h))},Mn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Mn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var p=h.as,y=f(p,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:w}):p==="script"&&a.d.X(m,{crossOrigin:y,integrity:b,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Mn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=f(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(m)},Mn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,y=f(p,h.crossOrigin);a.d.L(m,p,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Mn.preloadModule=function(m,h){if(typeof m=="string")if(h){var p=f(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Mn.requestFormReset=function(m){a.d.r(m)},Mn.unstable_batchedUpdates=function(m,h){return m(h)},Mn.useFormState=function(m,h,p){return u.H.useFormState(m,h,p)},Mn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Mn.version="19.2.3",Mn}var Iw;function MN(){if(Iw)return dp.exports;Iw=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),dp.exports=D2(),dp.exports}var Dw;function z2(){if(Dw)return Ll;Dw=1;var e=I2(),t=Ec(),n=MN();function a(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)r+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function l(s){var r=s,c=s;if(s.alternate)for(;r.return;)r=r.return;else{s=r;do r=s,(r.flags&4098)!==0&&(c=r.return),s=r.return;while(s)}return r.tag===3?c:null}function u(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function f(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function m(s){if(l(s)!==s)throw Error(a(188))}function h(s){var r=s.alternate;if(!r){if(r=l(s),r===null)throw Error(a(188));return r!==s?null:s}for(var c=s,d=r;;){var g=c.return;if(g===null)break;var x=g.alternate;if(x===null){if(d=g.return,d!==null){c=d;continue}break}if(g.child===x.child){for(x=g.child;x;){if(x===c)return m(g),s;if(x===d)return m(g),r;x=x.sibling}throw Error(a(188))}if(c.return!==d.return)c=g,d=x;else{for(var T=!1,I=g.child;I;){if(I===c){T=!0,c=g,d=x;break}if(I===d){T=!0,d=g,c=x;break}I=I.sibling}if(!T){for(I=x.child;I;){if(I===c){T=!0,c=x,d=g;break}if(I===d){T=!0,d=x,c=g;break}I=I.sibling}if(!T)throw Error(a(189))}}if(c.alternate!==d)throw Error(a(190))}if(c.tag!==3)throw Error(a(188));return c.stateNode.current===c?s:r}function p(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=p(s),r!==null)return r;s=s.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),S=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),_=Symbol.iterator;function z(s){return s===null||typeof s!="object"?null:(s=_&&s[_]||s["@@iterator"],typeof s=="function"?s:null)}var B=Symbol.for("react.client.reference");function V(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===B?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case N:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case A:return"Suspense";case M:return"SuspenseList";case F:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case j:return"Portal";case S:return s.displayName||"Context";case E:return(s._context.displayName||"Context")+".Consumer";case R:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case D:return r=s.displayName||null,r!==null?r:V(s.type)||"Memo";case U:r=s._payload,s=s._init;try{return V(s(r))}catch{}}return null}var K=Array.isArray,L=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},G=[],X=-1;function O(s){return{current:s}}function Z(s){0>X||(s.current=G[X],G[X]=null,X--)}function W(s,r){X++,G[X]=s.current,s.current=r}var Q=O(null),ce=O(null),ae=O(null),ge=O(null);function ye(s,r){switch(W(ae,r),W(ce,s),W(Q,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?Kb(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=Kb(r),s=Xb(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Z(Q),W(Q,s)}function be(){Z(Q),Z(ce),Z(ae)}function Oe(s){s.memoizedState!==null&&W(ge,s);var r=Q.current,c=Xb(r,s.type);r!==c&&(W(ce,s),W(Q,c))}function fe(s){ce.current===s&&(Z(Q),Z(ce)),ge.current===s&&(Z(ge),Ol._currentValue=$)}var xe,we;function ze(s){if(xe===void 0)try{throw Error()}catch(c){var r=c.stack.trim().match(/\n( *(at )?)/);xe=r&&r[1]||"",we=-1<c.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+xe+s+we}var Me=!1;function je(s,r){if(!s||Me)return"";Me=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(r){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(re){var se=re}Reflect.construct(s,[],de)}else{try{de.call()}catch(re){se=re}s.call(de.prototype)}}else{try{throw Error()}catch(re){se=re}(de=s())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(re){if(re&&se&&typeof re.stack=="string")return[re.stack,se.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=d.DetermineComponentFrameRoot(),T=x[0],I=x[1];if(T&&I){var q=T.split(`
4
- `),ne=I.split(`
5
- `);for(g=d=0;d<q.length&&!q[d].includes("DetermineComponentFrameRoot");)d++;for(;g<ne.length&&!ne[g].includes("DetermineComponentFrameRoot");)g++;if(d===q.length||g===ne.length)for(d=q.length-1,g=ne.length-1;1<=d&&0<=g&&q[d]!==ne[g];)g--;for(;1<=d&&0<=g;d--,g--)if(q[d]!==ne[g]){if(d!==1||g!==1)do if(d--,g--,0>g||q[d]!==ne[g]){var ie=`
6
- `+q[d].replace(" at new "," at ");return s.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",s.displayName)),ie}while(1<=d&&0<=g);break}}}finally{Me=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?ze(c):""}function Ne(s,r){switch(s.tag){case 26:case 27:case 5:return ze(s.type);case 16:return ze("Lazy");case 13:return s.child!==r&&r!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return je(s.type,!1);case 11:return je(s.type.render,!1);case 1:return je(s.type,!0);case 31:return ze("Activity");default:return""}}function We(s){try{var r="",c=null;do r+=Ne(s,c),c=s,s=s.return;while(s);return r}catch(d){return`
7
- Error generating stack: `+d.message+`
8
- `+d.stack}}var Be=Object.prototype.hasOwnProperty,He=e.unstable_scheduleCallback,le=e.unstable_cancelCallback,he=e.unstable_shouldYield,pe=e.unstable_requestPaint,ke=e.unstable_now,Ee=e.unstable_getCurrentPriorityLevel,Je=e.unstable_ImmediatePriority,et=e.unstable_UserBlockingPriority,Ye=e.unstable_NormalPriority,Bt=e.unstable_LowPriority,Et=e.unstable_IdlePriority,hn=e.log,mn=e.unstable_setDisableYieldValue,on=null,Ie=null;function tt(s){if(typeof hn=="function"&&mn(s),Ie&&typeof Ie.setStrictMode=="function")try{Ie.setStrictMode(on,s)}catch{}}var ut=Math.clz32?Math.clz32:yn,xt=Math.log,Pt=Math.LN2;function yn(s){return s>>>=0,s===0?32:31-(xt(s)/Pt|0)|0}var Kt=256,pn=262144,ln=4194304;function xn(s){var r=s&42;if(r!==0)return r;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function As(s,r,c){var d=s.pendingLanes;if(d===0)return 0;var g=0,x=s.suspendedLanes,T=s.pingedLanes;s=s.warmLanes;var I=d&134217727;return I!==0?(d=I&~x,d!==0?g=xn(d):(T&=I,T!==0?g=xn(T):c||(c=I&~s,c!==0&&(g=xn(c))))):(I=d&~x,I!==0?g=xn(I):T!==0?g=xn(T):c||(c=d&~s,c!==0&&(g=xn(c)))),g===0?0:r!==0&&r!==g&&(r&x)===0&&(x=g&-g,c=r&-r,x>=c||x===32&&(c&4194048)!==0)?r:g}function ee(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function me(s,r){switch(s){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ve(){var s=ln;return ln<<=1,(ln&62914560)===0&&(ln=4194304),s}function Ve(s){for(var r=[],c=0;31>c;c++)r.push(s);return r}function Le(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function dt(s,r,c,d,g,x){var T=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var I=s.entanglements,q=s.expirationTimes,ne=s.hiddenUpdates;for(c=T&~c;0<c;){var ie=31-ut(c),de=1<<ie;I[ie]=0,q[ie]=-1;var se=ne[ie];if(se!==null)for(ne[ie]=null,ie=0;ie<se.length;ie++){var re=se[ie];re!==null&&(re.lane&=-536870913)}c&=~de}d!==0&&Lt(s,d,0),x!==0&&g===0&&s.tag!==0&&(s.suspendedLanes|=x&~(T&~r))}function Lt(s,r,c){s.pendingLanes|=r,s.suspendedLanes&=~r;var d=31-ut(r);s.entangledLanes|=r,s.entanglements[d]=s.entanglements[d]|1073741824|c&261930}function Zt(s,r){var c=s.entangledLanes|=r;for(s=s.entanglements;c;){var d=31-ut(c),g=1<<d;g&r|s[d]&r&&(s[d]|=r),c&=~g}}function bn(s,r){var c=r&-r;return c=(c&42)!==0?1:qt(c),(c&(s.suspendedLanes|r))!==0?0:c}function qt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Ms(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function cn(){var s=H.p;return s!==0?s:(s=window.event,s===void 0?32:bw(s.type))}function Pc(s,r){var c=H.p;try{return H.p=s,r()}finally{H.p=c}}var Ia=Math.random().toString(36).slice(2),wn="__reactFiber$"+Ia,Bn="__reactProps$"+Ia,bi="__reactContainer$"+Ia,Xf="__reactEvents$"+Ia,yM="__reactListeners$"+Ia,xM="__reactHandles$"+Ia,Py="__reactResources$"+Ia,Yo="__reactMarker$"+Ia;function Jf(s){delete s[wn],delete s[Bn],delete s[Xf],delete s[yM],delete s[xM]}function wi(s){var r=s[wn];if(r)return r;for(var c=s.parentNode;c;){if(r=c[bi]||c[wn]){if(c=r.alternate,r.child!==null||c!==null&&c.child!==null)for(s=aw(s);s!==null;){if(c=s[wn])return c;s=aw(s)}return r}s=c,c=s.parentNode}return null}function ji(s){if(s=s[wn]||s[bi]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function Go(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(a(33))}function Si(s){var r=s[Py];return r||(r=s[Py]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function gn(s){s[Yo]=!0}var Ly=new Set,$y={};function Rr(s,r){Ni(s,r),Ni(s+"Capture",r)}function Ni(s,r){for($y[s]=r,s=0;s<r.length;s++)Ly.add(r[s])}var bM=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Uy={},By={};function wM(s){return Be.call(By,s)?!0:Be.call(Uy,s)?!1:bM.test(s)?By[s]=!0:(Uy[s]=!0,!1)}function Lc(s,r,c){if(wM(r))if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var d=r.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,""+c)}}function $c(s,r,c){if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,""+c)}}function oa(s,r,c,d){if(d===null)s.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(r,c,""+d)}}function ds(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Vy(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function jM(s,r,c){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var g=d.get,x=d.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return g.call(this)},set:function(T){c=""+T,x.call(this,T)}}),Object.defineProperty(s,r,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(T){c=""+T},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function Qf(s){if(!s._valueTracker){var r=Vy(s)?"checked":"value";s._valueTracker=jM(s,r,""+s[r])}}function Hy(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var c=r.getValue(),d="";return s&&(d=Vy(s)?s.checked?"true":"false":s.value),s=d,s!==c?(r.setValue(s),!0):!1}function Uc(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var SM=/[\n"\\]/g;function fs(s){return s.replace(SM,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function eh(s,r,c,d,g,x,T,I){s.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?s.type=T:s.removeAttribute("type"),r!=null?T==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+ds(r)):s.value!==""+ds(r)&&(s.value=""+ds(r)):T!=="submit"&&T!=="reset"||s.removeAttribute("value"),r!=null?th(s,T,ds(r)):c!=null?th(s,T,ds(c)):d!=null&&s.removeAttribute("value"),g==null&&x!=null&&(s.defaultChecked=!!x),g!=null&&(s.checked=g&&typeof g!="function"&&typeof g!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?s.name=""+ds(I):s.removeAttribute("name")}function Fy(s,r,c,d,g,x,T,I){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),r!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||r!=null)){Qf(s);return}c=c!=null?""+ds(c):"",r=r!=null?""+ds(r):c,I||r===s.value||(s.value=r),s.defaultValue=r}d=d??g,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=I?s.checked:!!d,s.defaultChecked=!!d,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(s.name=T),Qf(s)}function th(s,r,c){r==="number"&&Uc(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function ki(s,r,c,d){if(s=s.options,r){r={};for(var g=0;g<c.length;g++)r["$"+c[g]]=!0;for(c=0;c<s.length;c++)g=r.hasOwnProperty("$"+s[c].value),s[c].selected!==g&&(s[c].selected=g),g&&d&&(s[c].defaultSelected=!0)}else{for(c=""+ds(c),r=null,g=0;g<s.length;g++){if(s[g].value===c){s[g].selected=!0,d&&(s[g].defaultSelected=!0);return}r!==null||s[g].disabled||(r=s[g])}r!==null&&(r.selected=!0)}}function Zy(s,r,c){if(r!=null&&(r=""+ds(r),r!==s.value&&(s.value=r),c==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=c!=null?""+ds(c):""}function qy(s,r,c,d){if(r==null){if(d!=null){if(c!=null)throw Error(a(92));if(K(d)){if(1<d.length)throw Error(a(93));d=d[0]}c=d}c==null&&(c=""),r=c}c=ds(r),s.defaultValue=c,d=s.textContent,d===c&&d!==""&&d!==null&&(s.value=d),Qf(s)}function Ei(s,r){if(r){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=r;return}}s.textContent=r}var NM=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Wy(s,r,c){var d=r.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":d?s.setProperty(r,c):typeof c!="number"||c===0||NM.has(r)?r==="float"?s.cssFloat=c:s[r]=(""+c).trim():s[r]=c+"px"}function Yy(s,r,c){if(r!=null&&typeof r!="object")throw Error(a(62));if(s=s.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||r!=null&&r.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="");for(var g in r)d=r[g],r.hasOwnProperty(g)&&c[g]!==d&&Wy(s,g,d)}else for(var x in r)r.hasOwnProperty(x)&&Wy(s,x,r[x])}function nh(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var kM=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),EM=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Bc(s){return EM.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function la(){}var sh=null;function ah(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Ci=null,Ti=null;function Gy(s){var r=ji(s);if(r&&(s=r.stateNode)){var c=s[Bn]||null;e:switch(s=r.stateNode,r.type){case"input":if(eh(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),r=c.name,c.type==="radio"&&r!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+fs(""+r)+'"][type="radio"]'),r=0;r<c.length;r++){var d=c[r];if(d!==s&&d.form===s.form){var g=d[Bn]||null;if(!g)throw Error(a(90));eh(d,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(r=0;r<c.length;r++)d=c[r],d.form===s.form&&Hy(d)}break e;case"textarea":Zy(s,c.value,c.defaultValue);break e;case"select":r=c.value,r!=null&&ki(s,!!c.multiple,r,!1)}}}var rh=!1;function Ky(s,r,c){if(rh)return s(r,c);rh=!0;try{var d=s(r);return d}finally{if(rh=!1,(Ci!==null||Ti!==null)&&(Tu(),Ci&&(r=Ci,s=Ti,Ti=Ci=null,Gy(r),s)))for(r=0;r<s.length;r++)Gy(s[r])}}function Ko(s,r){var c=s.stateNode;if(c===null)return null;var d=c[Bn]||null;if(d===null)return null;c=d[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(a(231,r,typeof c));return c}var ca=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ih=!1;if(ca)try{var Xo={};Object.defineProperty(Xo,"passive",{get:function(){ih=!0}}),window.addEventListener("test",Xo,Xo),window.removeEventListener("test",Xo,Xo)}catch{ih=!1}var Da=null,oh=null,Vc=null;function Xy(){if(Vc)return Vc;var s,r=oh,c=r.length,d,g="value"in Da?Da.value:Da.textContent,x=g.length;for(s=0;s<c&&r[s]===g[s];s++);var T=c-s;for(d=1;d<=T&&r[c-d]===g[x-d];d++);return Vc=g.slice(s,1<d?1-d:void 0)}function Hc(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function Fc(){return!0}function Jy(){return!1}function Vn(s){function r(c,d,g,x,T){this._reactName=c,this._targetInst=g,this.type=d,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var I in s)s.hasOwnProperty(I)&&(c=s[I],this[I]=c?c(x):x[I]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Fc:Jy,this.isPropagationStopped=Jy,this}return y(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Fc)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Fc)},persist:function(){},isPersistent:Fc}),r}var _r={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zc=Vn(_r),Jo=y({},_r,{view:0,detail:0}),CM=Vn(Jo),lh,ch,Qo,qc=y({},Jo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dh,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Qo&&(Qo&&s.type==="mousemove"?(lh=s.screenX-Qo.screenX,ch=s.screenY-Qo.screenY):ch=lh=0,Qo=s),lh)},movementY:function(s){return"movementY"in s?s.movementY:ch}}),Qy=Vn(qc),TM=y({},qc,{dataTransfer:0}),AM=Vn(TM),MM=y({},Jo,{relatedTarget:0}),uh=Vn(MM),RM=y({},_r,{animationName:0,elapsedTime:0,pseudoElement:0}),_M=Vn(RM),OM=y({},_r,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),IM=Vn(OM),DM=y({},_r,{data:0}),e0=Vn(DM),zM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},PM={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},LM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $M(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=LM[s])?!!r[s]:!1}function dh(){return $M}var UM=y({},Jo,{key:function(s){if(s.key){var r=zM[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=Hc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?PM[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dh,charCode:function(s){return s.type==="keypress"?Hc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Hc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),BM=Vn(UM),VM=y({},qc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),t0=Vn(VM),HM=y({},Jo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dh}),FM=Vn(HM),ZM=y({},_r,{propertyName:0,elapsedTime:0,pseudoElement:0}),qM=Vn(ZM),WM=y({},qc,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),YM=Vn(WM),GM=y({},_r,{newState:0,oldState:0}),KM=Vn(GM),XM=[9,13,27,32],fh=ca&&"CompositionEvent"in window,el=null;ca&&"documentMode"in document&&(el=document.documentMode);var JM=ca&&"TextEvent"in window&&!el,n0=ca&&(!fh||el&&8<el&&11>=el),s0=" ",a0=!1;function r0(s,r){switch(s){case"keyup":return XM.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function i0(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Ai=!1;function QM(s,r){switch(s){case"compositionend":return i0(r);case"keypress":return r.which!==32?null:(a0=!0,s0);case"textInput":return s=r.data,s===s0&&a0?null:s;default:return null}}function eR(s,r){if(Ai)return s==="compositionend"||!fh&&r0(s,r)?(s=Xy(),Vc=oh=Da=null,Ai=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return n0&&r.locale!=="ko"?null:r.data;default:return null}}var tR={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function o0(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!tR[s.type]:r==="textarea"}function l0(s,r,c,d){Ci?Ti?Ti.push(d):Ti=[d]:Ci=d,r=Du(r,"onChange"),0<r.length&&(c=new Zc("onChange","change",null,c,d),s.push({event:c,listeners:r}))}var tl=null,nl=null;function nR(s){Fb(s,0)}function Wc(s){var r=Go(s);if(Hy(r))return s}function c0(s,r){if(s==="change")return r}var u0=!1;if(ca){var hh;if(ca){var mh="oninput"in document;if(!mh){var d0=document.createElement("div");d0.setAttribute("oninput","return;"),mh=typeof d0.oninput=="function"}hh=mh}else hh=!1;u0=hh&&(!document.documentMode||9<document.documentMode)}function f0(){tl&&(tl.detachEvent("onpropertychange",h0),nl=tl=null)}function h0(s){if(s.propertyName==="value"&&Wc(nl)){var r=[];l0(r,nl,s,ah(s)),Ky(nR,r)}}function sR(s,r,c){s==="focusin"?(f0(),tl=r,nl=c,tl.attachEvent("onpropertychange",h0)):s==="focusout"&&f0()}function aR(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Wc(nl)}function rR(s,r){if(s==="click")return Wc(r)}function iR(s,r){if(s==="input"||s==="change")return Wc(r)}function oR(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var es=typeof Object.is=="function"?Object.is:oR;function sl(s,r){if(es(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var c=Object.keys(s),d=Object.keys(r);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var g=c[d];if(!Be.call(r,g)||!es(s[g],r[g]))return!1}return!0}function m0(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function p0(s,r){var c=m0(s);s=0;for(var d;c;){if(c.nodeType===3){if(d=s+c.textContent.length,s<=r&&d>=r)return{node:c,offset:r-s};s=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=m0(c)}}function g0(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?g0(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function v0(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=Uc(s.document);r instanceof s.HTMLIFrameElement;){try{var c=typeof r.contentWindow.location.href=="string"}catch{c=!1}if(c)s=r.contentWindow;else break;r=Uc(s.document)}return r}function ph(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r&&(r==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||r==="textarea"||s.contentEditable==="true")}var lR=ca&&"documentMode"in document&&11>=document.documentMode,Mi=null,gh=null,al=null,vh=!1;function y0(s,r,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;vh||Mi==null||Mi!==Uc(d)||(d=Mi,"selectionStart"in d&&ph(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),al&&sl(al,d)||(al=d,d=Du(gh,"onSelect"),0<d.length&&(r=new Zc("onSelect","select",null,r,c),s.push({event:r,listeners:d}),r.target=Mi)))}function Or(s,r){var c={};return c[s.toLowerCase()]=r.toLowerCase(),c["Webkit"+s]="webkit"+r,c["Moz"+s]="moz"+r,c}var Ri={animationend:Or("Animation","AnimationEnd"),animationiteration:Or("Animation","AnimationIteration"),animationstart:Or("Animation","AnimationStart"),transitionrun:Or("Transition","TransitionRun"),transitionstart:Or("Transition","TransitionStart"),transitioncancel:Or("Transition","TransitionCancel"),transitionend:Or("Transition","TransitionEnd")},yh={},x0={};ca&&(x0=document.createElement("div").style,"AnimationEvent"in window||(delete Ri.animationend.animation,delete Ri.animationiteration.animation,delete Ri.animationstart.animation),"TransitionEvent"in window||delete Ri.transitionend.transition);function Ir(s){if(yh[s])return yh[s];if(!Ri[s])return s;var r=Ri[s],c;for(c in r)if(r.hasOwnProperty(c)&&c in x0)return yh[s]=r[c];return s}var b0=Ir("animationend"),w0=Ir("animationiteration"),j0=Ir("animationstart"),cR=Ir("transitionrun"),uR=Ir("transitionstart"),dR=Ir("transitioncancel"),S0=Ir("transitionend"),N0=new Map,xh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");xh.push("scrollEnd");function Rs(s,r){N0.set(s,r),Rr(r,[s])}var Yc=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},hs=[],_i=0,bh=0;function Gc(){for(var s=_i,r=bh=_i=0;r<s;){var c=hs[r];hs[r++]=null;var d=hs[r];hs[r++]=null;var g=hs[r];hs[r++]=null;var x=hs[r];if(hs[r++]=null,d!==null&&g!==null){var T=d.pending;T===null?g.next=g:(g.next=T.next,T.next=g),d.pending=g}x!==0&&k0(c,g,x)}}function Kc(s,r,c,d){hs[_i++]=s,hs[_i++]=r,hs[_i++]=c,hs[_i++]=d,bh|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function wh(s,r,c,d){return Kc(s,r,c,d),Xc(s)}function Dr(s,r){return Kc(s,null,null,r),Xc(s)}function k0(s,r,c){s.lanes|=c;var d=s.alternate;d!==null&&(d.lanes|=c);for(var g=!1,x=s.return;x!==null;)x.childLanes|=c,d=x.alternate,d!==null&&(d.childLanes|=c),x.tag===22&&(s=x.stateNode,s===null||s._visibility&1||(g=!0)),s=x,x=x.return;return s.tag===3?(x=s.stateNode,g&&r!==null&&(g=31-ut(c),s=x.hiddenUpdates,d=s[g],d===null?s[g]=[r]:d.push(r),r.lane=c|536870912),x):null}function Xc(s){if(50<El)throw El=0,Mm=null,Error(a(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var Oi={};function fR(s,r,c,d){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ts(s,r,c,d){return new fR(s,r,c,d)}function jh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ua(s,r){var c=s.alternate;return c===null?(c=ts(s.tag,r,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=r,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,r=s.dependencies,c.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function E0(s,r){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,r=c.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function Jc(s,r,c,d,g,x){var T=0;if(d=s,typeof s=="function")jh(s)&&(T=1);else if(typeof s=="string")T=v2(s,c,Q.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case F:return s=ts(31,c,r,g),s.elementType=F,s.lanes=x,s;case N:return zr(c.children,g,x,r);case C:T=8,g|=24;break;case k:return s=ts(12,c,r,g|2),s.elementType=k,s.lanes=x,s;case A:return s=ts(13,c,r,g),s.elementType=A,s.lanes=x,s;case M:return s=ts(19,c,r,g),s.elementType=M,s.lanes=x,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case S:T=10;break e;case E:T=9;break e;case R:T=11;break e;case D:T=14;break e;case U:T=16,d=null;break e}T=29,c=Error(a(130,s===null?"null":typeof s,"")),d=null}return r=ts(T,c,r,g),r.elementType=s,r.type=d,r.lanes=x,r}function zr(s,r,c,d){return s=ts(7,s,d,r),s.lanes=c,s}function Sh(s,r,c){return s=ts(6,s,null,r),s.lanes=c,s}function C0(s){var r=ts(18,null,null,0);return r.stateNode=s,r}function Nh(s,r,c){return r=ts(4,s.children!==null?s.children:[],s.key,r),r.lanes=c,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var T0=new WeakMap;function ms(s,r){if(typeof s=="object"&&s!==null){var c=T0.get(s);return c!==void 0?c:(r={value:s,source:r,stack:We(r)},T0.set(s,r),r)}return{value:s,source:r,stack:We(r)}}var Ii=[],Di=0,Qc=null,rl=0,ps=[],gs=0,za=null,Hs=1,Fs="";function da(s,r){Ii[Di++]=rl,Ii[Di++]=Qc,Qc=s,rl=r}function A0(s,r,c){ps[gs++]=Hs,ps[gs++]=Fs,ps[gs++]=za,za=s;var d=Hs;s=Fs;var g=32-ut(d)-1;d&=~(1<<g),c+=1;var x=32-ut(r)+g;if(30<x){var T=g-g%5;x=(d&(1<<T)-1).toString(32),d>>=T,g-=T,Hs=1<<32-ut(r)+g|c<<g|d,Fs=x+s}else Hs=1<<x|c<<g|d,Fs=s}function kh(s){s.return!==null&&(da(s,1),A0(s,1,0))}function Eh(s){for(;s===Qc;)Qc=Ii[--Di],Ii[Di]=null,rl=Ii[--Di],Ii[Di]=null;for(;s===za;)za=ps[--gs],ps[gs]=null,Fs=ps[--gs],ps[gs]=null,Hs=ps[--gs],ps[gs]=null}function M0(s,r){ps[gs++]=Hs,ps[gs++]=Fs,ps[gs++]=za,Hs=r.id,Fs=r.overflow,za=s}var jn=null,At=null,ot=!1,Pa=null,vs=!1,Ch=Error(a(519));function La(s){var r=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw il(ms(r,s)),Ch}function R0(s){var r=s.stateNode,c=s.type,d=s.memoizedProps;switch(r[wn]=s,r[Bn]=d,c){case"dialog":st("cancel",r),st("close",r);break;case"iframe":case"object":case"embed":st("load",r);break;case"video":case"audio":for(c=0;c<Tl.length;c++)st(Tl[c],r);break;case"source":st("error",r);break;case"img":case"image":case"link":st("error",r),st("load",r);break;case"details":st("toggle",r);break;case"input":st("invalid",r),Fy(r,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":st("invalid",r);break;case"textarea":st("invalid",r),qy(r,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||r.textContent===""+c||d.suppressHydrationWarning===!0||Yb(r.textContent,c)?(d.popover!=null&&(st("beforetoggle",r),st("toggle",r)),d.onScroll!=null&&st("scroll",r),d.onScrollEnd!=null&&st("scrollend",r),d.onClick!=null&&(r.onclick=la),r=!0):r=!1,r||La(s,!0)}function _0(s){for(jn=s.return;jn;)switch(jn.tag){case 5:case 31:case 13:vs=!1;return;case 27:case 3:vs=!0;return;default:jn=jn.return}}function zi(s){if(s!==jn)return!1;if(!ot)return _0(s),ot=!0,!1;var r=s.tag,c;if((c=r!==3&&r!==27)&&((c=r===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Zm(s.type,s.memoizedProps)),c=!c),c&&At&&La(s),_0(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));At=sw(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));At=sw(s)}else r===27?(r=At,Ja(s.type)?(s=Km,Km=null,At=s):At=r):At=jn?xs(s.stateNode.nextSibling):null;return!0}function Pr(){At=jn=null,ot=!1}function Th(){var s=Pa;return s!==null&&(qn===null?qn=s:qn.push.apply(qn,s),Pa=null),s}function il(s){Pa===null?Pa=[s]:Pa.push(s)}var Ah=O(null),Lr=null,fa=null;function $a(s,r,c){W(Ah,r._currentValue),r._currentValue=c}function ha(s){s._currentValue=Ah.current,Z(Ah)}function Mh(s,r,c){for(;s!==null;){var d=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,d!==null&&(d.childLanes|=r)):d!==null&&(d.childLanes&r)!==r&&(d.childLanes|=r),s===c)break;s=s.return}}function Rh(s,r,c,d){var g=s.child;for(g!==null&&(g.return=s);g!==null;){var x=g.dependencies;if(x!==null){var T=g.child;x=x.firstContext;e:for(;x!==null;){var I=x;x=g;for(var q=0;q<r.length;q++)if(I.context===r[q]){x.lanes|=c,I=x.alternate,I!==null&&(I.lanes|=c),Mh(x.return,c,s),d||(T=null);break e}x=I.next}}else if(g.tag===18){if(T=g.return,T===null)throw Error(a(341));T.lanes|=c,x=T.alternate,x!==null&&(x.lanes|=c),Mh(T,c,s),T=null}else T=g.child;if(T!==null)T.return=g;else for(T=g;T!==null;){if(T===s){T=null;break}if(g=T.sibling,g!==null){g.return=T.return,T=g;break}T=T.return}g=T}}function Pi(s,r,c,d){s=null;for(var g=r,x=!1;g!==null;){if(!x){if((g.flags&524288)!==0)x=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var T=g.alternate;if(T===null)throw Error(a(387));if(T=T.memoizedProps,T!==null){var I=g.type;es(g.pendingProps.value,T.value)||(s!==null?s.push(I):s=[I])}}else if(g===ge.current){if(T=g.alternate,T===null)throw Error(a(387));T.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(s!==null?s.push(Ol):s=[Ol])}g=g.return}s!==null&&Rh(r,s,c,d),r.flags|=262144}function eu(s){for(s=s.firstContext;s!==null;){if(!es(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function $r(s){Lr=s,fa=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Sn(s){return O0(Lr,s)}function tu(s,r){return Lr===null&&$r(s),O0(s,r)}function O0(s,r){var c=r._currentValue;if(r={context:r,memoizedValue:c,next:null},fa===null){if(s===null)throw Error(a(308));fa=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else fa=fa.next=r;return c}var hR=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(c,d){s.push(d)}};this.abort=function(){r.aborted=!0,s.forEach(function(c){return c()})}},mR=e.unstable_scheduleCallback,pR=e.unstable_NormalPriority,en={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _h(){return{controller:new hR,data:new Map,refCount:0}}function ol(s){s.refCount--,s.refCount===0&&mR(pR,function(){s.controller.abort()})}var ll=null,Oh=0,Li=0,$i=null;function gR(s,r){if(ll===null){var c=ll=[];Oh=0,Li=zm(),$i={status:"pending",value:void 0,then:function(d){c.push(d)}}}return Oh++,r.then(I0,I0),r}function I0(){if(--Oh===0&&ll!==null){$i!==null&&($i.status="fulfilled");var s=ll;ll=null,Li=0,$i=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function vR(s,r){var c=[],d={status:"pending",value:null,reason:null,then:function(g){c.push(g)}};return s.then(function(){d.status="fulfilled",d.value=r;for(var g=0;g<c.length;g++)(0,c[g])(r)},function(g){for(d.status="rejected",d.reason=g,g=0;g<c.length;g++)(0,c[g])(void 0)}),d}var D0=L.S;L.S=function(s,r){yb=ke(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&gR(s,r),D0!==null&&D0(s,r)};var Ur=O(null);function Ih(){var s=Ur.current;return s!==null?s:Nt.pooledCache}function nu(s,r){r===null?W(Ur,Ur.current):W(Ur,r.pool)}function z0(){var s=Ih();return s===null?null:{parent:en._currentValue,pool:s}}var Ui=Error(a(460)),Dh=Error(a(474)),su=Error(a(542)),au={then:function(){}};function P0(s){return s=s.status,s==="fulfilled"||s==="rejected"}function L0(s,r,c){switch(c=s[c],c===void 0?s.push(r):c!==r&&(r.then(la,la),r=c),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,U0(s),s;default:if(typeof r.status=="string")r.then(la,la);else{if(s=Nt,s!==null&&100<s.shellSuspendCounter)throw Error(a(482));s=r,s.status="pending",s.then(function(d){if(r.status==="pending"){var g=r;g.status="fulfilled",g.value=d}},function(d){if(r.status==="pending"){var g=r;g.status="rejected",g.reason=d}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,U0(s),s}throw Vr=r,Ui}}function Br(s){try{var r=s._init;return r(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Vr=c,Ui):c}}var Vr=null;function $0(){if(Vr===null)throw Error(a(459));var s=Vr;return Vr=null,s}function U0(s){if(s===Ui||s===su)throw Error(a(483))}var Bi=null,cl=0;function ru(s){var r=cl;return cl+=1,Bi===null&&(Bi=[]),L0(Bi,s,r)}function ul(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function iu(s,r){throw r.$$typeof===b?Error(a(525)):(s=Object.prototype.toString.call(r),Error(a(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function B0(s){function r(J,Y){if(s){var te=J.deletions;te===null?(J.deletions=[Y],J.flags|=16):te.push(Y)}}function c(J,Y){if(!s)return null;for(;Y!==null;)r(J,Y),Y=Y.sibling;return null}function d(J){for(var Y=new Map;J!==null;)J.key!==null?Y.set(J.key,J):Y.set(J.index,J),J=J.sibling;return Y}function g(J,Y){return J=ua(J,Y),J.index=0,J.sibling=null,J}function x(J,Y,te){return J.index=te,s?(te=J.alternate,te!==null?(te=te.index,te<Y?(J.flags|=67108866,Y):te):(J.flags|=67108866,Y)):(J.flags|=1048576,Y)}function T(J){return s&&J.alternate===null&&(J.flags|=67108866),J}function I(J,Y,te,ue){return Y===null||Y.tag!==6?(Y=Sh(te,J.mode,ue),Y.return=J,Y):(Y=g(Y,te),Y.return=J,Y)}function q(J,Y,te,ue){var De=te.type;return De===N?ie(J,Y,te.props.children,ue,te.key):Y!==null&&(Y.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===U&&Br(De)===Y.type)?(Y=g(Y,te.props),ul(Y,te),Y.return=J,Y):(Y=Jc(te.type,te.key,te.props,null,J.mode,ue),ul(Y,te),Y.return=J,Y)}function ne(J,Y,te,ue){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==te.containerInfo||Y.stateNode.implementation!==te.implementation?(Y=Nh(te,J.mode,ue),Y.return=J,Y):(Y=g(Y,te.children||[]),Y.return=J,Y)}function ie(J,Y,te,ue,De){return Y===null||Y.tag!==7?(Y=zr(te,J.mode,ue,De),Y.return=J,Y):(Y=g(Y,te),Y.return=J,Y)}function de(J,Y,te){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=Sh(""+Y,J.mode,te),Y.return=J,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case w:return te=Jc(Y.type,Y.key,Y.props,null,J.mode,te),ul(te,Y),te.return=J,te;case j:return Y=Nh(Y,J.mode,te),Y.return=J,Y;case U:return Y=Br(Y),de(J,Y,te)}if(K(Y)||z(Y))return Y=zr(Y,J.mode,te,null),Y.return=J,Y;if(typeof Y.then=="function")return de(J,ru(Y),te);if(Y.$$typeof===S)return de(J,tu(J,Y),te);iu(J,Y)}return null}function se(J,Y,te,ue){var De=Y!==null?Y.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return De!==null?null:I(J,Y,""+te,ue);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case w:return te.key===De?q(J,Y,te,ue):null;case j:return te.key===De?ne(J,Y,te,ue):null;case U:return te=Br(te),se(J,Y,te,ue)}if(K(te)||z(te))return De!==null?null:ie(J,Y,te,ue,null);if(typeof te.then=="function")return se(J,Y,ru(te),ue);if(te.$$typeof===S)return se(J,Y,tu(J,te),ue);iu(J,te)}return null}function re(J,Y,te,ue,De){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return J=J.get(te)||null,I(Y,J,""+ue,De);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case w:return J=J.get(ue.key===null?te:ue.key)||null,q(Y,J,ue,De);case j:return J=J.get(ue.key===null?te:ue.key)||null,ne(Y,J,ue,De);case U:return ue=Br(ue),re(J,Y,te,ue,De)}if(K(ue)||z(ue))return J=J.get(te)||null,ie(Y,J,ue,De,null);if(typeof ue.then=="function")return re(J,Y,te,ru(ue),De);if(ue.$$typeof===S)return re(J,Y,te,tu(Y,ue),De);iu(Y,ue)}return null}function Te(J,Y,te,ue){for(var De=null,ht=null,Re=Y,Xe=Y=0,it=null;Re!==null&&Xe<te.length;Xe++){Re.index>Xe?(it=Re,Re=null):it=Re.sibling;var mt=se(J,Re,te[Xe],ue);if(mt===null){Re===null&&(Re=it);break}s&&Re&&mt.alternate===null&&r(J,Re),Y=x(mt,Y,Xe),ht===null?De=mt:ht.sibling=mt,ht=mt,Re=it}if(Xe===te.length)return c(J,Re),ot&&da(J,Xe),De;if(Re===null){for(;Xe<te.length;Xe++)Re=de(J,te[Xe],ue),Re!==null&&(Y=x(Re,Y,Xe),ht===null?De=Re:ht.sibling=Re,ht=Re);return ot&&da(J,Xe),De}for(Re=d(Re);Xe<te.length;Xe++)it=re(Re,J,Xe,te[Xe],ue),it!==null&&(s&&it.alternate!==null&&Re.delete(it.key===null?Xe:it.key),Y=x(it,Y,Xe),ht===null?De=it:ht.sibling=it,ht=it);return s&&Re.forEach(function(sr){return r(J,sr)}),ot&&da(J,Xe),De}function $e(J,Y,te,ue){if(te==null)throw Error(a(151));for(var De=null,ht=null,Re=Y,Xe=Y=0,it=null,mt=te.next();Re!==null&&!mt.done;Xe++,mt=te.next()){Re.index>Xe?(it=Re,Re=null):it=Re.sibling;var sr=se(J,Re,mt.value,ue);if(sr===null){Re===null&&(Re=it);break}s&&Re&&sr.alternate===null&&r(J,Re),Y=x(sr,Y,Xe),ht===null?De=sr:ht.sibling=sr,ht=sr,Re=it}if(mt.done)return c(J,Re),ot&&da(J,Xe),De;if(Re===null){for(;!mt.done;Xe++,mt=te.next())mt=de(J,mt.value,ue),mt!==null&&(Y=x(mt,Y,Xe),ht===null?De=mt:ht.sibling=mt,ht=mt);return ot&&da(J,Xe),De}for(Re=d(Re);!mt.done;Xe++,mt=te.next())mt=re(Re,J,Xe,mt.value,ue),mt!==null&&(s&&mt.alternate!==null&&Re.delete(mt.key===null?Xe:mt.key),Y=x(mt,Y,Xe),ht===null?De=mt:ht.sibling=mt,ht=mt);return s&&Re.forEach(function(T2){return r(J,T2)}),ot&&da(J,Xe),De}function jt(J,Y,te,ue){if(typeof te=="object"&&te!==null&&te.type===N&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case w:e:{for(var De=te.key;Y!==null;){if(Y.key===De){if(De=te.type,De===N){if(Y.tag===7){c(J,Y.sibling),ue=g(Y,te.props.children),ue.return=J,J=ue;break e}}else if(Y.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===U&&Br(De)===Y.type){c(J,Y.sibling),ue=g(Y,te.props),ul(ue,te),ue.return=J,J=ue;break e}c(J,Y);break}else r(J,Y);Y=Y.sibling}te.type===N?(ue=zr(te.props.children,J.mode,ue,te.key),ue.return=J,J=ue):(ue=Jc(te.type,te.key,te.props,null,J.mode,ue),ul(ue,te),ue.return=J,J=ue)}return T(J);case j:e:{for(De=te.key;Y!==null;){if(Y.key===De)if(Y.tag===4&&Y.stateNode.containerInfo===te.containerInfo&&Y.stateNode.implementation===te.implementation){c(J,Y.sibling),ue=g(Y,te.children||[]),ue.return=J,J=ue;break e}else{c(J,Y);break}else r(J,Y);Y=Y.sibling}ue=Nh(te,J.mode,ue),ue.return=J,J=ue}return T(J);case U:return te=Br(te),jt(J,Y,te,ue)}if(K(te))return Te(J,Y,te,ue);if(z(te)){if(De=z(te),typeof De!="function")throw Error(a(150));return te=De.call(te),$e(J,Y,te,ue)}if(typeof te.then=="function")return jt(J,Y,ru(te),ue);if(te.$$typeof===S)return jt(J,Y,tu(J,te),ue);iu(J,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,Y!==null&&Y.tag===6?(c(J,Y.sibling),ue=g(Y,te),ue.return=J,J=ue):(c(J,Y),ue=Sh(te,J.mode,ue),ue.return=J,J=ue),T(J)):c(J,Y)}return function(J,Y,te,ue){try{cl=0;var De=jt(J,Y,te,ue);return Bi=null,De}catch(Re){if(Re===Ui||Re===su)throw Re;var ht=ts(29,Re,null,J.mode);return ht.lanes=ue,ht.return=J,ht}}}var Hr=B0(!0),V0=B0(!1),Ua=!1;function zh(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ph(s,r){s=s.updateQueue,r.updateQueue===s&&(r.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Ba(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Va(s,r,c){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(pt&2)!==0){var g=d.pending;return g===null?r.next=r:(r.next=g.next,g.next=r),d.pending=r,r=Xc(s),k0(s,null,c),r}return Kc(s,d,r,c),Xc(s)}function dl(s,r,c){if(r=r.updateQueue,r!==null&&(r=r.shared,(c&4194048)!==0)){var d=r.lanes;d&=s.pendingLanes,c|=d,r.lanes=c,Zt(s,c)}}function Lh(s,r){var c=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var g=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var T={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?g=x=T:x=x.next=T,c=c.next}while(c!==null);x===null?g=x=r:x=x.next=r}else g=x=r;c={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=r:s.next=r,c.lastBaseUpdate=r}var $h=!1;function fl(){if($h){var s=$i;if(s!==null)throw s}}function hl(s,r,c,d){$h=!1;var g=s.updateQueue;Ua=!1;var x=g.firstBaseUpdate,T=g.lastBaseUpdate,I=g.shared.pending;if(I!==null){g.shared.pending=null;var q=I,ne=q.next;q.next=null,T===null?x=ne:T.next=ne,T=q;var ie=s.alternate;ie!==null&&(ie=ie.updateQueue,I=ie.lastBaseUpdate,I!==T&&(I===null?ie.firstBaseUpdate=ne:I.next=ne,ie.lastBaseUpdate=q))}if(x!==null){var de=g.baseState;T=0,ie=ne=q=null,I=x;do{var se=I.lane&-536870913,re=se!==I.lane;if(re?(rt&se)===se:(d&se)===se){se!==0&&se===Li&&($h=!0),ie!==null&&(ie=ie.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Te=s,$e=I;se=r;var jt=c;switch($e.tag){case 1:if(Te=$e.payload,typeof Te=="function"){de=Te.call(jt,de,se);break e}de=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=$e.payload,se=typeof Te=="function"?Te.call(jt,de,se):Te,se==null)break e;de=y({},de,se);break e;case 2:Ua=!0}}se=I.callback,se!==null&&(s.flags|=64,re&&(s.flags|=8192),re=g.callbacks,re===null?g.callbacks=[se]:re.push(se))}else re={lane:se,tag:I.tag,payload:I.payload,callback:I.callback,next:null},ie===null?(ne=ie=re,q=de):ie=ie.next=re,T|=se;if(I=I.next,I===null){if(I=g.shared.pending,I===null)break;re=I,I=re.next,re.next=null,g.lastBaseUpdate=re,g.shared.pending=null}}while(!0);ie===null&&(q=de),g.baseState=q,g.firstBaseUpdate=ne,g.lastBaseUpdate=ie,x===null&&(g.shared.lanes=0),Wa|=T,s.lanes=T,s.memoizedState=de}}function H0(s,r){if(typeof s!="function")throw Error(a(191,s));s.call(r)}function F0(s,r){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)H0(c[s],r)}var Vi=O(null),ou=O(0);function Z0(s,r){s=ja,W(ou,s),W(Vi,r),ja=s|r.baseLanes}function Uh(){W(ou,ja),W(Vi,Vi.current)}function Bh(){ja=ou.current,Z(Vi),Z(ou)}var ns=O(null),ys=null;function Ha(s){var r=s.alternate;W(Xt,Xt.current&1),W(ns,s),ys===null&&(r===null||Vi.current!==null||r.memoizedState!==null)&&(ys=s)}function Vh(s){W(Xt,Xt.current),W(ns,s),ys===null&&(ys=s)}function q0(s){s.tag===22?(W(Xt,Xt.current),W(ns,s),ys===null&&(ys=s)):Fa()}function Fa(){W(Xt,Xt.current),W(ns,ns.current)}function ss(s){Z(ns),ys===s&&(ys=null),Z(Xt)}var Xt=O(0);function lu(s){for(var r=s;r!==null;){if(r.tag===13){var c=r.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Ym(c)||Gm(c)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var ma=0,Ke=null,bt=null,tn=null,cu=!1,Hi=!1,Fr=!1,uu=0,ml=0,Fi=null,yR=0;function Wt(){throw Error(a(321))}function Hh(s,r){if(r===null)return!1;for(var c=0;c<r.length&&c<s.length;c++)if(!es(s[c],r[c]))return!1;return!0}function Fh(s,r,c,d,g,x){return ma=x,Ke=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,L.H=s===null||s.memoizedState===null?Ax:rm,Fr=!1,x=c(d,g),Fr=!1,Hi&&(x=Y0(r,c,d,g)),W0(s),x}function W0(s){L.H=vl;var r=bt!==null&&bt.next!==null;if(ma=0,tn=bt=Ke=null,cu=!1,ml=0,Fi=null,r)throw Error(a(300));s===null||nn||(s=s.dependencies,s!==null&&eu(s)&&(nn=!0))}function Y0(s,r,c,d){Ke=s;var g=0;do{if(Hi&&(Fi=null),ml=0,Hi=!1,25<=g)throw Error(a(301));if(g+=1,tn=bt=null,s.updateQueue!=null){var x=s.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}L.H=Mx,x=r(c,d)}while(Hi);return x}function xR(){var s=L.H,r=s.useState()[0];return r=typeof r.then=="function"?pl(r):r,s=s.useState()[0],(bt!==null?bt.memoizedState:null)!==s&&(Ke.flags|=1024),r}function Zh(){var s=uu!==0;return uu=0,s}function qh(s,r,c){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~c}function Wh(s){if(cu){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}cu=!1}ma=0,tn=bt=Ke=null,Hi=!1,ml=uu=0,Fi=null}function On(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tn===null?Ke.memoizedState=tn=s:tn=tn.next=s,tn}function Jt(){if(bt===null){var s=Ke.alternate;s=s!==null?s.memoizedState:null}else s=bt.next;var r=tn===null?Ke.memoizedState:tn.next;if(r!==null)tn=r,bt=s;else{if(s===null)throw Ke.alternate===null?Error(a(467)):Error(a(310));bt=s,s={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},tn===null?Ke.memoizedState=tn=s:tn=tn.next=s}return tn}function du(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pl(s){var r=ml;return ml+=1,Fi===null&&(Fi=[]),s=L0(Fi,s,r),r=Ke,(tn===null?r.memoizedState:tn.next)===null&&(r=r.alternate,L.H=r===null||r.memoizedState===null?Ax:rm),s}function fu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return pl(s);if(s.$$typeof===S)return Sn(s)}throw Error(a(438,String(s)))}function Yh(s){var r=null,c=Ke.updateQueue;if(c!==null&&(r=c.memoCache),r==null){var d=Ke.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(r={data:d.data.map(function(g){return g.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),c===null&&(c=du(),Ke.updateQueue=c),c.memoCache=r,c=r.data[r.index],c===void 0)for(c=r.data[r.index]=Array(s),d=0;d<s;d++)c[d]=P;return r.index++,c}function pa(s,r){return typeof r=="function"?r(s):r}function hu(s){var r=Jt();return Gh(r,bt,s)}function Gh(s,r,c){var d=s.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=c;var g=s.baseQueue,x=d.pending;if(x!==null){if(g!==null){var T=g.next;g.next=x.next,x.next=T}r.baseQueue=g=x,d.pending=null}if(x=s.baseState,g===null)s.memoizedState=x;else{r=g.next;var I=T=null,q=null,ne=r,ie=!1;do{var de=ne.lane&-536870913;if(de!==ne.lane?(rt&de)===de:(ma&de)===de){var se=ne.revertLane;if(se===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),de===Li&&(ie=!0);else if((ma&se)===se){ne=ne.next,se===Li&&(ie=!0);continue}else de={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},q===null?(I=q=de,T=x):q=q.next=de,Ke.lanes|=se,Wa|=se;de=ne.action,Fr&&c(x,de),x=ne.hasEagerState?ne.eagerState:c(x,de)}else se={lane:de,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},q===null?(I=q=se,T=x):q=q.next=se,Ke.lanes|=de,Wa|=de;ne=ne.next}while(ne!==null&&ne!==r);if(q===null?T=x:q.next=I,!es(x,s.memoizedState)&&(nn=!0,ie&&(c=$i,c!==null)))throw c;s.memoizedState=x,s.baseState=T,s.baseQueue=q,d.lastRenderedState=x}return g===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Kh(s){var r=Jt(),c=r.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=s;var d=c.dispatch,g=c.pending,x=r.memoizedState;if(g!==null){c.pending=null;var T=g=g.next;do x=s(x,T.action),T=T.next;while(T!==g);es(x,r.memoizedState)||(nn=!0),r.memoizedState=x,r.baseQueue===null&&(r.baseState=x),c.lastRenderedState=x}return[x,d]}function G0(s,r,c){var d=Ke,g=Jt(),x=ot;if(x){if(c===void 0)throw Error(a(407));c=c()}else c=r();var T=!es((bt||g).memoizedState,c);if(T&&(g.memoizedState=c,nn=!0),g=g.queue,Qh(J0.bind(null,d,g,s),[s]),g.getSnapshot!==r||T||tn!==null&&tn.memoizedState.tag&1){if(d.flags|=2048,Zi(9,{destroy:void 0},X0.bind(null,d,g,c,r),null),Nt===null)throw Error(a(349));x||(ma&127)!==0||K0(d,r,c)}return c}function K0(s,r,c){s.flags|=16384,s={getSnapshot:r,value:c},r=Ke.updateQueue,r===null?(r=du(),Ke.updateQueue=r,r.stores=[s]):(c=r.stores,c===null?r.stores=[s]:c.push(s))}function X0(s,r,c,d){r.value=c,r.getSnapshot=d,Q0(r)&&ex(s)}function J0(s,r,c){return c(function(){Q0(r)&&ex(s)})}function Q0(s){var r=s.getSnapshot;s=s.value;try{var c=r();return!es(s,c)}catch{return!0}}function ex(s){var r=Dr(s,2);r!==null&&Wn(r,s,2)}function Xh(s){var r=On();if(typeof s=="function"){var c=s;if(s=c(),Fr){tt(!0);try{c()}finally{tt(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pa,lastRenderedState:s},r}function tx(s,r,c,d){return s.baseState=c,Gh(s,bt,typeof d=="function"?d:pa)}function bR(s,r,c,d,g){if(gu(s))throw Error(a(485));if(s=r.action,s!==null){var x={payload:g,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){x.listeners.push(T)}};L.T!==null?c(!0):x.isTransition=!1,d(x),c=r.pending,c===null?(x.next=r.pending=x,nx(r,x)):(x.next=c.next,r.pending=c.next=x)}}function nx(s,r){var c=r.action,d=r.payload,g=s.state;if(r.isTransition){var x=L.T,T={};L.T=T;try{var I=c(g,d),q=L.S;q!==null&&q(T,I),sx(s,r,I)}catch(ne){Jh(s,r,ne)}finally{x!==null&&T.types!==null&&(x.types=T.types),L.T=x}}else try{x=c(g,d),sx(s,r,x)}catch(ne){Jh(s,r,ne)}}function sx(s,r,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){ax(s,r,d)},function(d){return Jh(s,r,d)}):ax(s,r,c)}function ax(s,r,c){r.status="fulfilled",r.value=c,rx(r),s.state=c,r=s.pending,r!==null&&(c=r.next,c===r?s.pending=null:(c=c.next,r.next=c,nx(s,c)))}function Jh(s,r,c){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do r.status="rejected",r.reason=c,rx(r),r=r.next;while(r!==d)}s.action=null}function rx(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function ix(s,r){return r}function ox(s,r){if(ot){var c=Nt.formState;if(c!==null){e:{var d=Ke;if(ot){if(At){t:{for(var g=At,x=vs;g.nodeType!==8;){if(!x){g=null;break t}if(g=xs(g.nextSibling),g===null){g=null;break t}}x=g.data,g=x==="F!"||x==="F"?g:null}if(g){At=xs(g.nextSibling),d=g.data==="F!";break e}}La(d)}d=!1}d&&(r=c[0])}}return c=On(),c.memoizedState=c.baseState=r,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ix,lastRenderedState:r},c.queue=d,c=Ex.bind(null,Ke,d),d.dispatch=c,d=Xh(!1),x=am.bind(null,Ke,!1,d.queue),d=On(),g={state:r,dispatch:null,action:s,pending:null},d.queue=g,c=bR.bind(null,Ke,g,x,c),g.dispatch=c,d.memoizedState=s,[r,c,!1]}function lx(s){var r=Jt();return cx(r,bt,s)}function cx(s,r,c){if(r=Gh(s,r,ix)[0],s=hu(pa)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var d=pl(r)}catch(T){throw T===Ui?su:T}else d=r;r=Jt();var g=r.queue,x=g.dispatch;return c!==r.memoizedState&&(Ke.flags|=2048,Zi(9,{destroy:void 0},wR.bind(null,g,c),null)),[d,x,s]}function wR(s,r){s.action=r}function ux(s){var r=Jt(),c=bt;if(c!==null)return cx(r,c,s);Jt(),r=r.memoizedState,c=Jt();var d=c.queue.dispatch;return c.memoizedState=s,[r,d,!1]}function Zi(s,r,c,d){return s={tag:s,create:c,deps:d,inst:r,next:null},r=Ke.updateQueue,r===null&&(r=du(),Ke.updateQueue=r),c=r.lastEffect,c===null?r.lastEffect=s.next=s:(d=c.next,c.next=s,s.next=d,r.lastEffect=s),s}function dx(){return Jt().memoizedState}function mu(s,r,c,d){var g=On();Ke.flags|=s,g.memoizedState=Zi(1|r,{destroy:void 0},c,d===void 0?null:d)}function pu(s,r,c,d){var g=Jt();d=d===void 0?null:d;var x=g.memoizedState.inst;bt!==null&&d!==null&&Hh(d,bt.memoizedState.deps)?g.memoizedState=Zi(r,x,c,d):(Ke.flags|=s,g.memoizedState=Zi(1|r,x,c,d))}function fx(s,r){mu(8390656,8,s,r)}function Qh(s,r){pu(2048,8,s,r)}function jR(s){Ke.flags|=4;var r=Ke.updateQueue;if(r===null)r=du(),Ke.updateQueue=r,r.events=[s];else{var c=r.events;c===null?r.events=[s]:c.push(s)}}function hx(s){var r=Jt().memoizedState;return jR({ref:r,nextImpl:s}),function(){if((pt&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}function mx(s,r){return pu(4,2,s,r)}function px(s,r){return pu(4,4,s,r)}function gx(s,r){if(typeof r=="function"){s=s();var c=r(s);return function(){typeof c=="function"?c():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function vx(s,r,c){c=c!=null?c.concat([s]):null,pu(4,4,gx.bind(null,r,s),c)}function em(){}function yx(s,r){var c=Jt();r=r===void 0?null:r;var d=c.memoizedState;return r!==null&&Hh(r,d[1])?d[0]:(c.memoizedState=[s,r],s)}function xx(s,r){var c=Jt();r=r===void 0?null:r;var d=c.memoizedState;if(r!==null&&Hh(r,d[1]))return d[0];if(d=s(),Fr){tt(!0);try{s()}finally{tt(!1)}}return c.memoizedState=[d,r],d}function tm(s,r,c){return c===void 0||(ma&1073741824)!==0&&(rt&261930)===0?s.memoizedState=r:(s.memoizedState=c,s=bb(),Ke.lanes|=s,Wa|=s,c)}function bx(s,r,c,d){return es(c,r)?c:Vi.current!==null?(s=tm(s,c,d),es(s,r)||(nn=!0),s):(ma&42)===0||(ma&1073741824)!==0&&(rt&261930)===0?(nn=!0,s.memoizedState=c):(s=bb(),Ke.lanes|=s,Wa|=s,r)}function wx(s,r,c,d,g){var x=H.p;H.p=x!==0&&8>x?x:8;var T=L.T,I={};L.T=I,am(s,!1,r,c);try{var q=g(),ne=L.S;if(ne!==null&&ne(I,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var ie=vR(q,d);gl(s,r,ie,is(s))}else gl(s,r,d,is(s))}catch(de){gl(s,r,{then:function(){},status:"rejected",reason:de},is())}finally{H.p=x,T!==null&&I.types!==null&&(T.types=I.types),L.T=T}}function SR(){}function nm(s,r,c,d){if(s.tag!==5)throw Error(a(476));var g=jx(s).queue;wx(s,g,r,$,c===null?SR:function(){return Sx(s),c(d)})}function jx(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pa,lastRenderedState:$},next:null};var c={};return r.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pa,lastRenderedState:c},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function Sx(s){var r=jx(s);r.next===null&&(r=s.alternate.memoizedState),gl(s,r.next.queue,{},is())}function sm(){return Sn(Ol)}function Nx(){return Jt().memoizedState}function kx(){return Jt().memoizedState}function NR(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var c=is();s=Ba(c);var d=Va(r,s,c);d!==null&&(Wn(d,r,c),dl(d,r,c)),r={cache:_h()},s.payload=r;return}r=r.return}}function kR(s,r,c){var d=is();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},gu(s)?Cx(r,c):(c=wh(s,r,c,d),c!==null&&(Wn(c,s,d),Tx(c,r,d)))}function Ex(s,r,c){var d=is();gl(s,r,c,d)}function gl(s,r,c,d){var g={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(gu(s))Cx(r,g);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=r.lastRenderedReducer,x!==null))try{var T=r.lastRenderedState,I=x(T,c);if(g.hasEagerState=!0,g.eagerState=I,es(I,T))return Kc(s,r,g,0),Nt===null&&Gc(),!1}catch{}if(c=wh(s,r,g,d),c!==null)return Wn(c,s,d),Tx(c,r,d),!0}return!1}function am(s,r,c,d){if(d={lane:2,revertLane:zm(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},gu(s)){if(r)throw Error(a(479))}else r=wh(s,c,d,2),r!==null&&Wn(r,s,2)}function gu(s){var r=s.alternate;return s===Ke||r!==null&&r===Ke}function Cx(s,r){Hi=cu=!0;var c=s.pending;c===null?r.next=r:(r.next=c.next,c.next=r),s.pending=r}function Tx(s,r,c){if((c&4194048)!==0){var d=r.lanes;d&=s.pendingLanes,c|=d,r.lanes=c,Zt(s,c)}}var vl={readContext:Sn,use:fu,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};vl.useEffectEvent=Wt;var Ax={readContext:Sn,use:fu,useCallback:function(s,r){return On().memoizedState=[s,r===void 0?null:r],s},useContext:Sn,useEffect:fx,useImperativeHandle:function(s,r,c){c=c!=null?c.concat([s]):null,mu(4194308,4,gx.bind(null,r,s),c)},useLayoutEffect:function(s,r){return mu(4194308,4,s,r)},useInsertionEffect:function(s,r){mu(4,2,s,r)},useMemo:function(s,r){var c=On();r=r===void 0?null:r;var d=s();if(Fr){tt(!0);try{s()}finally{tt(!1)}}return c.memoizedState=[d,r],d},useReducer:function(s,r,c){var d=On();if(c!==void 0){var g=c(r);if(Fr){tt(!0);try{c(r)}finally{tt(!1)}}}else g=r;return d.memoizedState=d.baseState=g,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:g},d.queue=s,s=s.dispatch=kR.bind(null,Ke,s),[d.memoizedState,s]},useRef:function(s){var r=On();return s={current:s},r.memoizedState=s},useState:function(s){s=Xh(s);var r=s.queue,c=Ex.bind(null,Ke,r);return r.dispatch=c,[s.memoizedState,c]},useDebugValue:em,useDeferredValue:function(s,r){var c=On();return tm(c,s,r)},useTransition:function(){var s=Xh(!1);return s=wx.bind(null,Ke,s.queue,!0,!1),On().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,c){var d=Ke,g=On();if(ot){if(c===void 0)throw Error(a(407));c=c()}else{if(c=r(),Nt===null)throw Error(a(349));(rt&127)!==0||K0(d,r,c)}g.memoizedState=c;var x={value:c,getSnapshot:r};return g.queue=x,fx(J0.bind(null,d,x,s),[s]),d.flags|=2048,Zi(9,{destroy:void 0},X0.bind(null,d,x,c,r),null),c},useId:function(){var s=On(),r=Nt.identifierPrefix;if(ot){var c=Fs,d=Hs;c=(d&~(1<<32-ut(d)-1)).toString(32)+c,r="_"+r+"R_"+c,c=uu++,0<c&&(r+="H"+c.toString(32)),r+="_"}else c=yR++,r="_"+r+"r_"+c.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:sm,useFormState:ox,useActionState:ox,useOptimistic:function(s){var r=On();r.memoizedState=r.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=c,r=am.bind(null,Ke,!0,c),c.dispatch=r,[s,r]},useMemoCache:Yh,useCacheRefresh:function(){return On().memoizedState=NR.bind(null,Ke)},useEffectEvent:function(s){var r=On(),c={impl:s};return r.memoizedState=c,function(){if((pt&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},rm={readContext:Sn,use:fu,useCallback:yx,useContext:Sn,useEffect:Qh,useImperativeHandle:vx,useInsertionEffect:mx,useLayoutEffect:px,useMemo:xx,useReducer:hu,useRef:dx,useState:function(){return hu(pa)},useDebugValue:em,useDeferredValue:function(s,r){var c=Jt();return bx(c,bt.memoizedState,s,r)},useTransition:function(){var s=hu(pa)[0],r=Jt().memoizedState;return[typeof s=="boolean"?s:pl(s),r]},useSyncExternalStore:G0,useId:Nx,useHostTransitionStatus:sm,useFormState:lx,useActionState:lx,useOptimistic:function(s,r){var c=Jt();return tx(c,bt,s,r)},useMemoCache:Yh,useCacheRefresh:kx};rm.useEffectEvent=hx;var Mx={readContext:Sn,use:fu,useCallback:yx,useContext:Sn,useEffect:Qh,useImperativeHandle:vx,useInsertionEffect:mx,useLayoutEffect:px,useMemo:xx,useReducer:Kh,useRef:dx,useState:function(){return Kh(pa)},useDebugValue:em,useDeferredValue:function(s,r){var c=Jt();return bt===null?tm(c,s,r):bx(c,bt.memoizedState,s,r)},useTransition:function(){var s=Kh(pa)[0],r=Jt().memoizedState;return[typeof s=="boolean"?s:pl(s),r]},useSyncExternalStore:G0,useId:Nx,useHostTransitionStatus:sm,useFormState:ux,useActionState:ux,useOptimistic:function(s,r){var c=Jt();return bt!==null?tx(c,bt,s,r):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:Yh,useCacheRefresh:kx};Mx.useEffectEvent=hx;function im(s,r,c,d){r=s.memoizedState,c=c(d,r),c=c==null?r:y({},r,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var om={enqueueSetState:function(s,r,c){s=s._reactInternals;var d=is(),g=Ba(d);g.payload=r,c!=null&&(g.callback=c),r=Va(s,g,d),r!==null&&(Wn(r,s,d),dl(r,s,d))},enqueueReplaceState:function(s,r,c){s=s._reactInternals;var d=is(),g=Ba(d);g.tag=1,g.payload=r,c!=null&&(g.callback=c),r=Va(s,g,d),r!==null&&(Wn(r,s,d),dl(r,s,d))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var c=is(),d=Ba(c);d.tag=2,r!=null&&(d.callback=r),r=Va(s,d,c),r!==null&&(Wn(r,s,c),dl(r,s,c))}};function Rx(s,r,c,d,g,x,T){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,x,T):r.prototype&&r.prototype.isPureReactComponent?!sl(c,d)||!sl(g,x):!0}function _x(s,r,c,d){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(c,d),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(c,d),r.state!==s&&om.enqueueReplaceState(r,r.state,null)}function Zr(s,r){var c=r;if("ref"in r){c={};for(var d in r)d!=="ref"&&(c[d]=r[d])}if(s=s.defaultProps){c===r&&(c=y({},c));for(var g in s)c[g]===void 0&&(c[g]=s[g])}return c}function Ox(s){Yc(s)}function Ix(s){console.error(s)}function Dx(s){Yc(s)}function vu(s,r){try{var c=s.onUncaughtError;c(r.value,{componentStack:r.stack})}catch(d){setTimeout(function(){throw d})}}function zx(s,r,c){try{var d=s.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function lm(s,r,c){return c=Ba(c),c.tag=3,c.payload={element:null},c.callback=function(){vu(s,r)},c}function Px(s){return s=Ba(s),s.tag=3,s}function Lx(s,r,c,d){var g=c.type.getDerivedStateFromError;if(typeof g=="function"){var x=d.value;s.payload=function(){return g(x)},s.callback=function(){zx(r,c,d)}}var T=c.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(s.callback=function(){zx(r,c,d),typeof g!="function"&&(Ya===null?Ya=new Set([this]):Ya.add(this));var I=d.stack;this.componentDidCatch(d.value,{componentStack:I!==null?I:""})})}function ER(s,r,c,d,g){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(r=c.alternate,r!==null&&Pi(r,c,g,!0),c=ns.current,c!==null){switch(c.tag){case 31:case 13:return ys===null?Au():c.alternate===null&&Yt===0&&(Yt=3),c.flags&=-257,c.flags|=65536,c.lanes=g,d===au?c.flags|=16384:(r=c.updateQueue,r===null?c.updateQueue=new Set([d]):r.add(d),Om(s,d,g)),!1;case 22:return c.flags|=65536,d===au?c.flags|=16384:(r=c.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=r):(c=r.retryQueue,c===null?r.retryQueue=new Set([d]):c.add(d)),Om(s,d,g)),!1}throw Error(a(435,c.tag))}return Om(s,d,g),Au(),!1}if(ot)return r=ns.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=g,d!==Ch&&(s=Error(a(422),{cause:d}),il(ms(s,c)))):(d!==Ch&&(r=Error(a(423),{cause:d}),il(ms(r,c))),s=s.current.alternate,s.flags|=65536,g&=-g,s.lanes|=g,d=ms(d,c),g=lm(s.stateNode,d,g),Lh(s,g),Yt!==4&&(Yt=2)),!1;var x=Error(a(520),{cause:d});if(x=ms(x,c),kl===null?kl=[x]:kl.push(x),Yt!==4&&(Yt=2),r===null)return!0;d=ms(d,c),c=r;do{switch(c.tag){case 3:return c.flags|=65536,s=g&-g,c.lanes|=s,s=lm(c.stateNode,d,s),Lh(c,s),!1;case 1:if(r=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Ya===null||!Ya.has(x))))return c.flags|=65536,g&=-g,c.lanes|=g,g=Px(g),Lx(g,s,c,d),Lh(c,g),!1}c=c.return}while(c!==null);return!1}var cm=Error(a(461)),nn=!1;function Nn(s,r,c,d){r.child=s===null?V0(r,null,c,d):Hr(r,s.child,c,d)}function $x(s,r,c,d,g){c=c.render;var x=r.ref;if("ref"in d){var T={};for(var I in d)I!=="ref"&&(T[I]=d[I])}else T=d;return $r(r),d=Fh(s,r,c,T,x,g),I=Zh(),s!==null&&!nn?(qh(s,r,g),ga(s,r,g)):(ot&&I&&kh(r),r.flags|=1,Nn(s,r,d,g),r.child)}function Ux(s,r,c,d,g){if(s===null){var x=c.type;return typeof x=="function"&&!jh(x)&&x.defaultProps===void 0&&c.compare===null?(r.tag=15,r.type=x,Bx(s,r,x,d,g)):(s=Jc(c.type,null,d,r,r.mode,g),s.ref=r.ref,s.return=r,r.child=s)}if(x=s.child,!vm(s,g)){var T=x.memoizedProps;if(c=c.compare,c=c!==null?c:sl,c(T,d)&&s.ref===r.ref)return ga(s,r,g)}return r.flags|=1,s=ua(x,d),s.ref=r.ref,s.return=r,r.child=s}function Bx(s,r,c,d,g){if(s!==null){var x=s.memoizedProps;if(sl(x,d)&&s.ref===r.ref)if(nn=!1,r.pendingProps=d=x,vm(s,g))(s.flags&131072)!==0&&(nn=!0);else return r.lanes=s.lanes,ga(s,r,g)}return um(s,r,c,d,g)}function Vx(s,r,c,d){var g=d.children,x=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((r.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,s!==null){for(d=r.child=s.child,g=0;d!==null;)g=g|d.lanes|d.childLanes,d=d.sibling;d=g&~x}else d=0,r.child=null;return Hx(s,r,x,c,d)}if((c&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&nu(r,x!==null?x.cachePool:null),x!==null?Z0(r,x):Uh(),q0(r);else return d=r.lanes=536870912,Hx(s,r,x!==null?x.baseLanes|c:c,c,d)}else x!==null?(nu(r,x.cachePool),Z0(r,x),Fa(),r.memoizedState=null):(s!==null&&nu(r,null),Uh(),Fa());return Nn(s,r,g,c),r.child}function yl(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Hx(s,r,c,d,g){var x=Ih();return x=x===null?null:{parent:en._currentValue,pool:x},r.memoizedState={baseLanes:c,cachePool:x},s!==null&&nu(r,null),Uh(),q0(r),s!==null&&Pi(s,r,d,!0),r.childLanes=g,null}function yu(s,r){return r=bu({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function Fx(s,r,c){return Hr(r,s.child,null,c),s=yu(r,r.pendingProps),s.flags|=2,ss(r),r.memoizedState=null,s}function CR(s,r,c){var d=r.pendingProps,g=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(ot){if(d.mode==="hidden")return s=yu(r,d),r.lanes=536870912,yl(null,s);if(Vh(r),(s=At)?(s=nw(s,vs),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:za!==null?{id:Hs,overflow:Fs}:null,retryLane:536870912,hydrationErrors:null},c=C0(s),c.return=r,r.child=c,jn=r,At=null)):s=null,s===null)throw La(r);return r.lanes=536870912,null}return yu(r,d)}var x=s.memoizedState;if(x!==null){var T=x.dehydrated;if(Vh(r),g)if(r.flags&256)r.flags&=-257,r=Fx(s,r,c);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(a(558));else if(nn||Pi(s,r,c,!1),g=(c&s.childLanes)!==0,nn||g){if(d=Nt,d!==null&&(T=bn(d,c),T!==0&&T!==x.retryLane))throw x.retryLane=T,Dr(s,T),Wn(d,s,T),cm;Au(),r=Fx(s,r,c)}else s=x.treeContext,At=xs(T.nextSibling),jn=r,ot=!0,Pa=null,vs=!1,s!==null&&M0(r,s),r=yu(r,d),r.flags|=4096;return r}return s=ua(s.child,{mode:d.mode,children:d.children}),s.ref=r.ref,r.child=s,s.return=r,s}function xu(s,r){var c=r.ref;if(c===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(a(284));(s===null||s.ref!==c)&&(r.flags|=4194816)}}function um(s,r,c,d,g){return $r(r),c=Fh(s,r,c,d,void 0,g),d=Zh(),s!==null&&!nn?(qh(s,r,g),ga(s,r,g)):(ot&&d&&kh(r),r.flags|=1,Nn(s,r,c,g),r.child)}function Zx(s,r,c,d,g,x){return $r(r),r.updateQueue=null,c=Y0(r,d,c,g),W0(s),d=Zh(),s!==null&&!nn?(qh(s,r,x),ga(s,r,x)):(ot&&d&&kh(r),r.flags|=1,Nn(s,r,c,x),r.child)}function qx(s,r,c,d,g){if($r(r),r.stateNode===null){var x=Oi,T=c.contextType;typeof T=="object"&&T!==null&&(x=Sn(T)),x=new c(d,x),r.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=om,r.stateNode=x,x._reactInternals=r,x=r.stateNode,x.props=d,x.state=r.memoizedState,x.refs={},zh(r),T=c.contextType,x.context=typeof T=="object"&&T!==null?Sn(T):Oi,x.state=r.memoizedState,T=c.getDerivedStateFromProps,typeof T=="function"&&(im(r,c,T,d),x.state=r.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(T=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),T!==x.state&&om.enqueueReplaceState(x,x.state,null),hl(r,d,x,g),fl(),x.state=r.memoizedState),typeof x.componentDidMount=="function"&&(r.flags|=4194308),d=!0}else if(s===null){x=r.stateNode;var I=r.memoizedProps,q=Zr(c,I);x.props=q;var ne=x.context,ie=c.contextType;T=Oi,typeof ie=="object"&&ie!==null&&(T=Sn(ie));var de=c.getDerivedStateFromProps;ie=typeof de=="function"||typeof x.getSnapshotBeforeUpdate=="function",I=r.pendingProps!==I,ie||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(I||ne!==T)&&_x(r,x,d,T),Ua=!1;var se=r.memoizedState;x.state=se,hl(r,d,x,g),fl(),ne=r.memoizedState,I||se!==ne||Ua?(typeof de=="function"&&(im(r,c,de,d),ne=r.memoizedState),(q=Ua||Rx(r,c,q,d,se,ne,T))?(ie||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(r.flags|=4194308)):(typeof x.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=d,r.memoizedState=ne),x.props=d,x.state=ne,x.context=T,d=q):(typeof x.componentDidMount=="function"&&(r.flags|=4194308),d=!1)}else{x=r.stateNode,Ph(s,r),T=r.memoizedProps,ie=Zr(c,T),x.props=ie,de=r.pendingProps,se=x.context,ne=c.contextType,q=Oi,typeof ne=="object"&&ne!==null&&(q=Sn(ne)),I=c.getDerivedStateFromProps,(ne=typeof I=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==de||se!==q)&&_x(r,x,d,q),Ua=!1,se=r.memoizedState,x.state=se,hl(r,d,x,g),fl();var re=r.memoizedState;T!==de||se!==re||Ua||s!==null&&s.dependencies!==null&&eu(s.dependencies)?(typeof I=="function"&&(im(r,c,I,d),re=r.memoizedState),(ie=Ua||Rx(r,c,ie,d,se,re,q)||s!==null&&s.dependencies!==null&&eu(s.dependencies))?(ne||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,re,q),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,re,q)),typeof x.componentDidUpdate=="function"&&(r.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof x.componentDidUpdate!="function"||T===s.memoizedProps&&se===s.memoizedState||(r.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===s.memoizedProps&&se===s.memoizedState||(r.flags|=1024),r.memoizedProps=d,r.memoizedState=re),x.props=d,x.state=re,x.context=q,d=ie):(typeof x.componentDidUpdate!="function"||T===s.memoizedProps&&se===s.memoizedState||(r.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===s.memoizedProps&&se===s.memoizedState||(r.flags|=1024),d=!1)}return x=d,xu(s,r),d=(r.flags&128)!==0,x||d?(x=r.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:x.render(),r.flags|=1,s!==null&&d?(r.child=Hr(r,s.child,null,g),r.child=Hr(r,null,c,g)):Nn(s,r,c,g),r.memoizedState=x.state,s=r.child):s=ga(s,r,g),s}function Wx(s,r,c,d){return Pr(),r.flags|=256,Nn(s,r,c,d),r.child}var dm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fm(s){return{baseLanes:s,cachePool:z0()}}function hm(s,r,c){return s=s!==null?s.childLanes&~c:0,r&&(s|=rs),s}function Yx(s,r,c){var d=r.pendingProps,g=!1,x=(r.flags&128)!==0,T;if((T=x)||(T=s!==null&&s.memoizedState===null?!1:(Xt.current&2)!==0),T&&(g=!0,r.flags&=-129),T=(r.flags&32)!==0,r.flags&=-33,s===null){if(ot){if(g?Ha(r):Fa(),(s=At)?(s=nw(s,vs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:za!==null?{id:Hs,overflow:Fs}:null,retryLane:536870912,hydrationErrors:null},c=C0(s),c.return=r,r.child=c,jn=r,At=null)):s=null,s===null)throw La(r);return Gm(s)?r.lanes=32:r.lanes=536870912,null}var I=d.children;return d=d.fallback,g?(Fa(),g=r.mode,I=bu({mode:"hidden",children:I},g),d=zr(d,g,c,null),I.return=r,d.return=r,I.sibling=d,r.child=I,d=r.child,d.memoizedState=fm(c),d.childLanes=hm(s,T,c),r.memoizedState=dm,yl(null,d)):(Ha(r),mm(r,I))}var q=s.memoizedState;if(q!==null&&(I=q.dehydrated,I!==null)){if(x)r.flags&256?(Ha(r),r.flags&=-257,r=pm(s,r,c)):r.memoizedState!==null?(Fa(),r.child=s.child,r.flags|=128,r=null):(Fa(),I=d.fallback,g=r.mode,d=bu({mode:"visible",children:d.children},g),I=zr(I,g,c,null),I.flags|=2,d.return=r,I.return=r,d.sibling=I,r.child=d,Hr(r,s.child,null,c),d=r.child,d.memoizedState=fm(c),d.childLanes=hm(s,T,c),r.memoizedState=dm,r=yl(null,d));else if(Ha(r),Gm(I)){if(T=I.nextSibling&&I.nextSibling.dataset,T)var ne=T.dgst;T=ne,d=Error(a(419)),d.stack="",d.digest=T,il({value:d,source:null,stack:null}),r=pm(s,r,c)}else if(nn||Pi(s,r,c,!1),T=(c&s.childLanes)!==0,nn||T){if(T=Nt,T!==null&&(d=bn(T,c),d!==0&&d!==q.retryLane))throw q.retryLane=d,Dr(s,d),Wn(T,s,d),cm;Ym(I)||Au(),r=pm(s,r,c)}else Ym(I)?(r.flags|=192,r.child=s.child,r=null):(s=q.treeContext,At=xs(I.nextSibling),jn=r,ot=!0,Pa=null,vs=!1,s!==null&&M0(r,s),r=mm(r,d.children),r.flags|=4096);return r}return g?(Fa(),I=d.fallback,g=r.mode,q=s.child,ne=q.sibling,d=ua(q,{mode:"hidden",children:d.children}),d.subtreeFlags=q.subtreeFlags&65011712,ne!==null?I=ua(ne,I):(I=zr(I,g,c,null),I.flags|=2),I.return=r,d.return=r,d.sibling=I,r.child=d,yl(null,d),d=r.child,I=s.child.memoizedState,I===null?I=fm(c):(g=I.cachePool,g!==null?(q=en._currentValue,g=g.parent!==q?{parent:q,pool:q}:g):g=z0(),I={baseLanes:I.baseLanes|c,cachePool:g}),d.memoizedState=I,d.childLanes=hm(s,T,c),r.memoizedState=dm,yl(s.child,d)):(Ha(r),c=s.child,s=c.sibling,c=ua(c,{mode:"visible",children:d.children}),c.return=r,c.sibling=null,s!==null&&(T=r.deletions,T===null?(r.deletions=[s],r.flags|=16):T.push(s)),r.child=c,r.memoizedState=null,c)}function mm(s,r){return r=bu({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function bu(s,r){return s=ts(22,s,null,r),s.lanes=0,s}function pm(s,r,c){return Hr(r,s.child,null,c),s=mm(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function Gx(s,r,c){s.lanes|=r;var d=s.alternate;d!==null&&(d.lanes|=r),Mh(s.return,r,c)}function gm(s,r,c,d,g,x){var T=s.memoizedState;T===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:g,treeForkCount:x}:(T.isBackwards=r,T.rendering=null,T.renderingStartTime=0,T.last=d,T.tail=c,T.tailMode=g,T.treeForkCount=x)}function Kx(s,r,c){var d=r.pendingProps,g=d.revealOrder,x=d.tail;d=d.children;var T=Xt.current,I=(T&2)!==0;if(I?(T=T&1|2,r.flags|=128):T&=1,W(Xt,T),Nn(s,r,d,c),d=ot?rl:0,!I&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Gx(s,c,r);else if(s.tag===19)Gx(s,c,r);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(g){case"forwards":for(c=r.child,g=null;c!==null;)s=c.alternate,s!==null&&lu(s)===null&&(g=c),c=c.sibling;c=g,c===null?(g=r.child,r.child=null):(g=c.sibling,c.sibling=null),gm(r,!1,g,c,x,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,g=r.child,r.child=null;g!==null;){if(s=g.alternate,s!==null&&lu(s)===null){r.child=g;break}s=g.sibling,g.sibling=c,c=g,g=s}gm(r,!0,c,null,x,d);break;case"together":gm(r,!1,null,null,void 0,d);break;default:r.memoizedState=null}return r.child}function ga(s,r,c){if(s!==null&&(r.dependencies=s.dependencies),Wa|=r.lanes,(c&r.childLanes)===0)if(s!==null){if(Pi(s,r,c,!1),(c&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(a(153));if(r.child!==null){for(s=r.child,c=ua(s,s.pendingProps),r.child=c,c.return=r;s.sibling!==null;)s=s.sibling,c=c.sibling=ua(s,s.pendingProps),c.return=r;c.sibling=null}return r.child}function vm(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&eu(s)))}function TR(s,r,c){switch(r.tag){case 3:ye(r,r.stateNode.containerInfo),$a(r,en,s.memoizedState.cache),Pr();break;case 27:case 5:Oe(r);break;case 4:ye(r,r.stateNode.containerInfo);break;case 10:$a(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Vh(r),null;break;case 13:var d=r.memoizedState;if(d!==null)return d.dehydrated!==null?(Ha(r),r.flags|=128,null):(c&r.child.childLanes)!==0?Yx(s,r,c):(Ha(r),s=ga(s,r,c),s!==null?s.sibling:null);Ha(r);break;case 19:var g=(s.flags&128)!==0;if(d=(c&r.childLanes)!==0,d||(Pi(s,r,c,!1),d=(c&r.childLanes)!==0),g){if(d)return Kx(s,r,c);r.flags|=128}if(g=r.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),W(Xt,Xt.current),d)break;return null;case 22:return r.lanes=0,Vx(s,r,c,r.pendingProps);case 24:$a(r,en,s.memoizedState.cache)}return ga(s,r,c)}function Xx(s,r,c){if(s!==null)if(s.memoizedProps!==r.pendingProps)nn=!0;else{if(!vm(s,c)&&(r.flags&128)===0)return nn=!1,TR(s,r,c);nn=(s.flags&131072)!==0}else nn=!1,ot&&(r.flags&1048576)!==0&&A0(r,rl,r.index);switch(r.lanes=0,r.tag){case 16:e:{var d=r.pendingProps;if(s=Br(r.elementType),r.type=s,typeof s=="function")jh(s)?(d=Zr(s,d),r.tag=1,r=qx(null,r,s,d,c)):(r.tag=0,r=um(null,r,s,d,c));else{if(s!=null){var g=s.$$typeof;if(g===R){r.tag=11,r=$x(null,r,s,d,c);break e}else if(g===D){r.tag=14,r=Ux(null,r,s,d,c);break e}}throw r=V(s)||s,Error(a(306,r,""))}}return r;case 0:return um(s,r,r.type,r.pendingProps,c);case 1:return d=r.type,g=Zr(d,r.pendingProps),qx(s,r,d,g,c);case 3:e:{if(ye(r,r.stateNode.containerInfo),s===null)throw Error(a(387));d=r.pendingProps;var x=r.memoizedState;g=x.element,Ph(s,r),hl(r,d,null,c);var T=r.memoizedState;if(d=T.cache,$a(r,en,d),d!==x.cache&&Rh(r,[en],c,!0),fl(),d=T.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:T.cache},r.updateQueue.baseState=x,r.memoizedState=x,r.flags&256){r=Wx(s,r,d,c);break e}else if(d!==g){g=ms(Error(a(424)),r),il(g),r=Wx(s,r,d,c);break e}else for(s=r.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,At=xs(s.firstChild),jn=r,ot=!0,Pa=null,vs=!0,c=V0(r,null,d,c),r.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Pr(),d===g){r=ga(s,r,c);break e}Nn(s,r,d,c)}r=r.child}return r;case 26:return xu(s,r),s===null?(c=lw(r.type,null,r.pendingProps,null))?r.memoizedState=c:ot||(c=r.type,s=r.pendingProps,d=zu(ae.current).createElement(c),d[wn]=r,d[Bn]=s,kn(d,c,s),gn(d),r.stateNode=d):r.memoizedState=lw(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return Oe(r),s===null&&ot&&(d=r.stateNode=rw(r.type,r.pendingProps,ae.current),jn=r,vs=!0,g=At,Ja(r.type)?(Km=g,At=xs(d.firstChild)):At=g),Nn(s,r,r.pendingProps.children,c),xu(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&&ot&&((g=d=At)&&(d=a2(d,r.type,r.pendingProps,vs),d!==null?(r.stateNode=d,jn=r,At=xs(d.firstChild),vs=!1,g=!0):g=!1),g||La(r)),Oe(r),g=r.type,x=r.pendingProps,T=s!==null?s.memoizedProps:null,d=x.children,Zm(g,x)?d=null:T!==null&&Zm(g,T)&&(r.flags|=32),r.memoizedState!==null&&(g=Fh(s,r,xR,null,null,c),Ol._currentValue=g),xu(s,r),Nn(s,r,d,c),r.child;case 6:return s===null&&ot&&((s=c=At)&&(c=r2(c,r.pendingProps,vs),c!==null?(r.stateNode=c,jn=r,At=null,s=!0):s=!1),s||La(r)),null;case 13:return Yx(s,r,c);case 4:return ye(r,r.stateNode.containerInfo),d=r.pendingProps,s===null?r.child=Hr(r,null,d,c):Nn(s,r,d,c),r.child;case 11:return $x(s,r,r.type,r.pendingProps,c);case 7:return Nn(s,r,r.pendingProps,c),r.child;case 8:return Nn(s,r,r.pendingProps.children,c),r.child;case 12:return Nn(s,r,r.pendingProps.children,c),r.child;case 10:return d=r.pendingProps,$a(r,r.type,d.value),Nn(s,r,d.children,c),r.child;case 9:return g=r.type._context,d=r.pendingProps.children,$r(r),g=Sn(g),d=d(g),r.flags|=1,Nn(s,r,d,c),r.child;case 14:return Ux(s,r,r.type,r.pendingProps,c);case 15:return Bx(s,r,r.type,r.pendingProps,c);case 19:return Kx(s,r,c);case 31:return CR(s,r,c);case 22:return Vx(s,r,c,r.pendingProps);case 24:return $r(r),d=Sn(en),s===null?(g=Ih(),g===null&&(g=Nt,x=_h(),g.pooledCache=x,x.refCount++,x!==null&&(g.pooledCacheLanes|=c),g=x),r.memoizedState={parent:d,cache:g},zh(r),$a(r,en,g)):((s.lanes&c)!==0&&(Ph(s,r),hl(r,null,null,c),fl()),g=s.memoizedState,x=r.memoizedState,g.parent!==d?(g={parent:d,cache:d},r.memoizedState=g,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=g),$a(r,en,d)):(d=x.cache,$a(r,en,d),d!==g.cache&&Rh(r,[en],c,!0))),Nn(s,r,r.pendingProps.children,c),r.child;case 29:throw r.pendingProps}throw Error(a(156,r.tag))}function va(s){s.flags|=4}function ym(s,r,c,d,g){if((r=(s.mode&32)!==0)&&(r=!1),r){if(s.flags|=16777216,(g&335544128)===g)if(s.stateNode.complete)s.flags|=8192;else if(Nb())s.flags|=8192;else throw Vr=au,Dh}else s.flags&=-16777217}function Jx(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!hw(r))if(Nb())s.flags|=8192;else throw Vr=au,Dh}function wu(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?ve():536870912,s.lanes|=r,Gi|=r)}function xl(s,r){if(!ot)switch(s.tailMode){case"hidden":r=s.tail;for(var c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Mt(s){var r=s.alternate!==null&&s.alternate.child===s.child,c=0,d=0;if(r)for(var g=s.child;g!==null;)c|=g.lanes|g.childLanes,d|=g.subtreeFlags&65011712,d|=g.flags&65011712,g.return=s,g=g.sibling;else for(g=s.child;g!==null;)c|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=s,g=g.sibling;return s.subtreeFlags|=d,s.childLanes=c,r}function AR(s,r,c){var d=r.pendingProps;switch(Eh(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(r),null;case 1:return Mt(r),null;case 3:return c=r.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),r.memoizedState.cache!==d&&(r.flags|=2048),ha(en),be(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(zi(r)?va(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Th())),Mt(r),null;case 26:var g=r.type,x=r.memoizedState;return s===null?(va(r),x!==null?(Mt(r),Jx(r,x)):(Mt(r),ym(r,g,null,d,c))):x?x!==s.memoizedState?(va(r),Mt(r),Jx(r,x)):(Mt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==d&&va(r),Mt(r),ym(r,g,s,d,c)),null;case 27:if(fe(r),c=ae.current,g=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&va(r);else{if(!d){if(r.stateNode===null)throw Error(a(166));return Mt(r),null}s=Q.current,zi(r)?R0(r):(s=rw(g,d,c),r.stateNode=s,va(r))}return Mt(r),null;case 5:if(fe(r),g=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&va(r);else{if(!d){if(r.stateNode===null)throw Error(a(166));return Mt(r),null}if(x=Q.current,zi(r))R0(r);else{var T=zu(ae.current);switch(x){case 1:x=T.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:x=T.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":x=T.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":x=T.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":x=T.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof d.is=="string"?T.createElement("select",{is:d.is}):T.createElement("select"),d.multiple?x.multiple=!0:d.size&&(x.size=d.size);break;default:x=typeof d.is=="string"?T.createElement(g,{is:d.is}):T.createElement(g)}}x[wn]=r,x[Bn]=d;e:for(T=r.child;T!==null;){if(T.tag===5||T.tag===6)x.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===r)break e;for(;T.sibling===null;){if(T.return===null||T.return===r)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}r.stateNode=x;e:switch(kn(x,g,d),g){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&va(r)}}return Mt(r),ym(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,c),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==d&&va(r);else{if(typeof d!="string"&&r.stateNode===null)throw Error(a(166));if(s=ae.current,zi(r)){if(s=r.stateNode,c=r.memoizedProps,d=null,g=jn,g!==null)switch(g.tag){case 27:case 5:d=g.memoizedProps}s[wn]=r,s=!!(s.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||Yb(s.nodeValue,c)),s||La(r,!0)}else s=zu(s).createTextNode(d),s[wn]=r,r.stateNode=s}return Mt(r),null;case 31:if(c=r.memoizedState,s===null||s.memoizedState!==null){if(d=zi(r),c!==null){if(s===null){if(!d)throw Error(a(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(557));s[wn]=r}else Pr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Mt(r),s=!1}else c=Th(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return r.flags&256?(ss(r),r):(ss(r),null);if((r.flags&128)!==0)throw Error(a(558))}return Mt(r),null;case 13:if(d=r.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(g=zi(r),d!==null&&d.dehydrated!==null){if(s===null){if(!g)throw Error(a(318));if(g=r.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(a(317));g[wn]=r}else Pr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Mt(r),g=!1}else g=Th(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=g),g=!0;if(!g)return r.flags&256?(ss(r),r):(ss(r),null)}return ss(r),(r.flags&128)!==0?(r.lanes=c,r):(c=d!==null,s=s!==null&&s.memoizedState!==null,c&&(d=r.child,g=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(g=d.alternate.memoizedState.cachePool.pool),x=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),x!==g&&(d.flags|=2048)),c!==s&&c&&(r.child.flags|=8192),wu(r,r.updateQueue),Mt(r),null);case 4:return be(),s===null&&Um(r.stateNode.containerInfo),Mt(r),null;case 10:return ha(r.type),Mt(r),null;case 19:if(Z(Xt),d=r.memoizedState,d===null)return Mt(r),null;if(g=(r.flags&128)!==0,x=d.rendering,x===null)if(g)xl(d,!1);else{if(Yt!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(x=lu(s),x!==null){for(r.flags|=128,xl(d,!1),s=x.updateQueue,r.updateQueue=s,wu(r,s),r.subtreeFlags=0,s=c,c=r.child;c!==null;)E0(c,s),c=c.sibling;return W(Xt,Xt.current&1|2),ot&&da(r,d.treeForkCount),r.child}s=s.sibling}d.tail!==null&&ke()>Eu&&(r.flags|=128,g=!0,xl(d,!1),r.lanes=4194304)}else{if(!g)if(s=lu(x),s!==null){if(r.flags|=128,g=!0,s=s.updateQueue,r.updateQueue=s,wu(r,s),xl(d,!0),d.tail===null&&d.tailMode==="hidden"&&!x.alternate&&!ot)return Mt(r),null}else 2*ke()-d.renderingStartTime>Eu&&c!==536870912&&(r.flags|=128,g=!0,xl(d,!1),r.lanes=4194304);d.isBackwards?(x.sibling=r.child,r.child=x):(s=d.last,s!==null?s.sibling=x:r.child=x,d.last=x)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=ke(),s.sibling=null,c=Xt.current,W(Xt,g?c&1|2:c&1),ot&&da(r,d.treeForkCount),s):(Mt(r),null);case 22:case 23:return ss(r),Bh(),d=r.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(r.flags|=8192):d&&(r.flags|=8192),d?(c&536870912)!==0&&(r.flags&128)===0&&(Mt(r),r.subtreeFlags&6&&(r.flags|=8192)):Mt(r),c=r.updateQueue,c!==null&&wu(r,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==c&&(r.flags|=2048),s!==null&&Z(Ur),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),ha(en),Mt(r),null;case 25:return null;case 30:return null}throw Error(a(156,r.tag))}function MR(s,r){switch(Eh(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return ha(en),be(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return fe(r),null;case 31:if(r.memoizedState!==null){if(ss(r),r.alternate===null)throw Error(a(340));Pr()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(ss(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(a(340));Pr()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return Z(Xt),null;case 4:return be(),null;case 10:return ha(r.type),null;case 22:case 23:return ss(r),Bh(),s!==null&&Z(Ur),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return ha(en),null;case 25:return null;default:return null}}function Qx(s,r){switch(Eh(r),r.tag){case 3:ha(en),be();break;case 26:case 27:case 5:fe(r);break;case 4:be();break;case 31:r.memoizedState!==null&&ss(r);break;case 13:ss(r);break;case 19:Z(Xt);break;case 10:ha(r.type);break;case 22:case 23:ss(r),Bh(),s!==null&&Z(Ur);break;case 24:ha(en)}}function bl(s,r){try{var c=r.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var g=d.next;c=g;do{if((c.tag&s)===s){d=void 0;var x=c.create,T=c.inst;d=x(),T.destroy=d}c=c.next}while(c!==g)}}catch(I){vt(r,r.return,I)}}function Za(s,r,c){try{var d=r.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var x=g.next;d=x;do{if((d.tag&s)===s){var T=d.inst,I=T.destroy;if(I!==void 0){T.destroy=void 0,g=r;var q=c,ne=I;try{ne()}catch(ie){vt(g,q,ie)}}}d=d.next}while(d!==x)}}catch(ie){vt(r,r.return,ie)}}function eb(s){var r=s.updateQueue;if(r!==null){var c=s.stateNode;try{F0(r,c)}catch(d){vt(s,s.return,d)}}}function tb(s,r,c){c.props=Zr(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(d){vt(s,r,d)}}function wl(s,r){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof c=="function"?s.refCleanup=c(d):c.current=d}}catch(g){vt(s,r,g)}}function Zs(s,r){var c=s.ref,d=s.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(g){vt(s,r,g)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(g){vt(s,r,g)}else c.current=null}function nb(s){var r=s.type,c=s.memoizedProps,d=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(g){vt(s,s.return,g)}}function xm(s,r,c){try{var d=s.stateNode;JR(d,s.type,c,r),d[Bn]=r}catch(g){vt(s,s.return,g)}}function sb(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ja(s.type)||s.tag===4}function bm(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||sb(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ja(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function wm(s,r,c){var d=s.tag;if(d===5||d===6)s=s.stateNode,r?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,r):(r=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,r.appendChild(s),c=c._reactRootContainer,c!=null||r.onclick!==null||(r.onclick=la));else if(d!==4&&(d===27&&Ja(s.type)&&(c=s.stateNode,r=null),s=s.child,s!==null))for(wm(s,r,c),s=s.sibling;s!==null;)wm(s,r,c),s=s.sibling}function ju(s,r,c){var d=s.tag;if(d===5||d===6)s=s.stateNode,r?c.insertBefore(s,r):c.appendChild(s);else if(d!==4&&(d===27&&Ja(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(ju(s,r,c),s=s.sibling;s!==null;)ju(s,r,c),s=s.sibling}function ab(s){var r=s.stateNode,c=s.memoizedProps;try{for(var d=s.type,g=r.attributes;g.length;)r.removeAttributeNode(g[0]);kn(r,d,c),r[wn]=s,r[Bn]=c}catch(x){vt(s,s.return,x)}}var ya=!1,sn=!1,jm=!1,rb=typeof WeakSet=="function"?WeakSet:Set,vn=null;function RR(s,r){if(s=s.containerInfo,Hm=Hu,s=v0(s),ph(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var g=d.anchorOffset,x=d.focusNode;d=d.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var T=0,I=-1,q=-1,ne=0,ie=0,de=s,se=null;t:for(;;){for(var re;de!==c||g!==0&&de.nodeType!==3||(I=T+g),de!==x||d!==0&&de.nodeType!==3||(q=T+d),de.nodeType===3&&(T+=de.nodeValue.length),(re=de.firstChild)!==null;)se=de,de=re;for(;;){if(de===s)break t;if(se===c&&++ne===g&&(I=T),se===x&&++ie===d&&(q=T),(re=de.nextSibling)!==null)break;de=se,se=de.parentNode}de=re}c=I===-1||q===-1?null:{start:I,end:q}}else c=null}c=c||{start:0,end:0}}else c=null;for(Fm={focusedElem:s,selectionRange:c},Hu=!1,vn=r;vn!==null;)if(r=vn,s=r.child,(r.subtreeFlags&1028)!==0&&s!==null)s.return=r,vn=s;else for(;vn!==null;){switch(r=vn,x=r.alternate,s=r.flags,r.tag){case 0:if((s&4)!==0&&(s=r.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)g=s[c],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&x!==null){s=void 0,c=r,g=x.memoizedProps,x=x.memoizedState,d=c.stateNode;try{var Te=Zr(c.type,g);s=d.getSnapshotBeforeUpdate(Te,x),d.__reactInternalSnapshotBeforeUpdate=s}catch($e){vt(c,c.return,$e)}}break;case 3:if((s&1024)!==0){if(s=r.stateNode.containerInfo,c=s.nodeType,c===9)Wm(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Wm(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(a(163))}if(s=r.sibling,s!==null){s.return=r.return,vn=s;break}vn=r.return}}function ib(s,r,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:ba(s,c),d&4&&bl(5,c);break;case 1:if(ba(s,c),d&4)if(s=c.stateNode,r===null)try{s.componentDidMount()}catch(T){vt(c,c.return,T)}else{var g=Zr(c.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(g,r,s.__reactInternalSnapshotBeforeUpdate)}catch(T){vt(c,c.return,T)}}d&64&&eb(c),d&512&&wl(c,c.return);break;case 3:if(ba(s,c),d&64&&(s=c.updateQueue,s!==null)){if(r=null,c.child!==null)switch(c.child.tag){case 27:case 5:r=c.child.stateNode;break;case 1:r=c.child.stateNode}try{F0(s,r)}catch(T){vt(c,c.return,T)}}break;case 27:r===null&&d&4&&ab(c);case 26:case 5:ba(s,c),r===null&&d&4&&nb(c),d&512&&wl(c,c.return);break;case 12:ba(s,c);break;case 31:ba(s,c),d&4&&cb(s,c);break;case 13:ba(s,c),d&4&&ub(s,c),d&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=UR.bind(null,c),i2(s,c))));break;case 22:if(d=c.memoizedState!==null||ya,!d){r=r!==null&&r.memoizedState!==null||sn,g=ya;var x=sn;ya=d,(sn=r)&&!x?wa(s,c,(c.subtreeFlags&8772)!==0):ba(s,c),ya=g,sn=x}break;case 30:break;default:ba(s,c)}}function ob(s){var r=s.alternate;r!==null&&(s.alternate=null,ob(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&Jf(r)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var $t=null,Hn=!1;function xa(s,r,c){for(c=c.child;c!==null;)lb(s,r,c),c=c.sibling}function lb(s,r,c){if(Ie&&typeof Ie.onCommitFiberUnmount=="function")try{Ie.onCommitFiberUnmount(on,c)}catch{}switch(c.tag){case 26:sn||Zs(c,r),xa(s,r,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:sn||Zs(c,r);var d=$t,g=Hn;Ja(c.type)&&($t=c.stateNode,Hn=!1),xa(s,r,c),Ml(c.stateNode),$t=d,Hn=g;break;case 5:sn||Zs(c,r);case 6:if(d=$t,g=Hn,$t=null,xa(s,r,c),$t=d,Hn=g,$t!==null)if(Hn)try{($t.nodeType===9?$t.body:$t.nodeName==="HTML"?$t.ownerDocument.body:$t).removeChild(c.stateNode)}catch(x){vt(c,r,x)}else try{$t.removeChild(c.stateNode)}catch(x){vt(c,r,x)}break;case 18:$t!==null&&(Hn?(s=$t,ew(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),so(s)):ew($t,c.stateNode));break;case 4:d=$t,g=Hn,$t=c.stateNode.containerInfo,Hn=!0,xa(s,r,c),$t=d,Hn=g;break;case 0:case 11:case 14:case 15:Za(2,c,r),sn||Za(4,c,r),xa(s,r,c);break;case 1:sn||(Zs(c,r),d=c.stateNode,typeof d.componentWillUnmount=="function"&&tb(c,r,d)),xa(s,r,c);break;case 21:xa(s,r,c);break;case 22:sn=(d=sn)||c.memoizedState!==null,xa(s,r,c),sn=d;break;default:xa(s,r,c)}}function cb(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{so(s)}catch(c){vt(r,r.return,c)}}}function ub(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{so(s)}catch(c){vt(r,r.return,c)}}function _R(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new rb),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new rb),r;default:throw Error(a(435,s.tag))}}function Su(s,r){var c=_R(s);r.forEach(function(d){if(!c.has(d)){c.add(d);var g=BR.bind(null,s,d);d.then(g,g)}})}function Fn(s,r){var c=r.deletions;if(c!==null)for(var d=0;d<c.length;d++){var g=c[d],x=s,T=r,I=T;e:for(;I!==null;){switch(I.tag){case 27:if(Ja(I.type)){$t=I.stateNode,Hn=!1;break e}break;case 5:$t=I.stateNode,Hn=!1;break e;case 3:case 4:$t=I.stateNode.containerInfo,Hn=!0;break e}I=I.return}if($t===null)throw Error(a(160));lb(x,T,g),$t=null,Hn=!1,x=g.alternate,x!==null&&(x.return=null),g.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)db(r,s),r=r.sibling}var _s=null;function db(s,r){var c=s.alternate,d=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Fn(r,s),Zn(s),d&4&&(Za(3,s,s.return),bl(3,s),Za(5,s,s.return));break;case 1:Fn(r,s),Zn(s),d&512&&(sn||c===null||Zs(c,c.return)),d&64&&ya&&(s=s.updateQueue,s!==null&&(d=s.callbacks,d!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var g=_s;if(Fn(r,s),Zn(s),d&512&&(sn||c===null||Zs(c,c.return)),d&4){var x=c!==null?c.memoizedState:null;if(d=s.memoizedState,c===null)if(d===null)if(s.stateNode===null){e:{d=s.type,c=s.memoizedProps,g=g.ownerDocument||g;t:switch(d){case"title":x=g.getElementsByTagName("title")[0],(!x||x[Yo]||x[wn]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=g.createElement(d),g.head.insertBefore(x,g.querySelector("head > title"))),kn(x,d,c),x[wn]=s,gn(x),d=x;break e;case"link":var T=dw("link","href",g).get(d+(c.href||""));if(T){for(var I=0;I<T.length;I++)if(x=T[I],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){T.splice(I,1);break t}}x=g.createElement(d),kn(x,d,c),g.head.appendChild(x);break;case"meta":if(T=dw("meta","content",g).get(d+(c.content||""))){for(I=0;I<T.length;I++)if(x=T[I],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){T.splice(I,1);break t}}x=g.createElement(d),kn(x,d,c),g.head.appendChild(x);break;default:throw Error(a(468,d))}x[wn]=s,gn(x),d=x}s.stateNode=d}else fw(g,s.type,s.stateNode);else s.stateNode=uw(g,d,s.memoizedProps);else x!==d?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,d===null?fw(g,s.type,s.stateNode):uw(g,d,s.memoizedProps)):d===null&&s.stateNode!==null&&xm(s,s.memoizedProps,c.memoizedProps)}break;case 27:Fn(r,s),Zn(s),d&512&&(sn||c===null||Zs(c,c.return)),c!==null&&d&4&&xm(s,s.memoizedProps,c.memoizedProps);break;case 5:if(Fn(r,s),Zn(s),d&512&&(sn||c===null||Zs(c,c.return)),s.flags&32){g=s.stateNode;try{Ei(g,"")}catch(Te){vt(s,s.return,Te)}}d&4&&s.stateNode!=null&&(g=s.memoizedProps,xm(s,g,c!==null?c.memoizedProps:g)),d&1024&&(jm=!0);break;case 6:if(Fn(r,s),Zn(s),d&4){if(s.stateNode===null)throw Error(a(162));d=s.memoizedProps,c=s.stateNode;try{c.nodeValue=d}catch(Te){vt(s,s.return,Te)}}break;case 3:if($u=null,g=_s,_s=Pu(r.containerInfo),Fn(r,s),_s=g,Zn(s),d&4&&c!==null&&c.memoizedState.isDehydrated)try{so(r.containerInfo)}catch(Te){vt(s,s.return,Te)}jm&&(jm=!1,fb(s));break;case 4:d=_s,_s=Pu(s.stateNode.containerInfo),Fn(r,s),Zn(s),_s=d;break;case 12:Fn(r,s),Zn(s);break;case 31:Fn(r,s),Zn(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Su(s,d)));break;case 13:Fn(r,s),Zn(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(ku=ke()),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Su(s,d)));break;case 22:g=s.memoizedState!==null;var q=c!==null&&c.memoizedState!==null,ne=ya,ie=sn;if(ya=ne||g,sn=ie||q,Fn(r,s),sn=ie,ya=ne,Zn(s),d&8192)e:for(r=s.stateNode,r._visibility=g?r._visibility&-2:r._visibility|1,g&&(c===null||q||ya||sn||qr(s)),c=null,r=s;;){if(r.tag===5||r.tag===26){if(c===null){q=c=r;try{if(x=q.stateNode,g)T=x.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{I=q.stateNode;var de=q.memoizedProps.style,se=de!=null&&de.hasOwnProperty("display")?de.display:null;I.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Te){vt(q,q.return,Te)}}}else if(r.tag===6){if(c===null){q=r;try{q.stateNode.nodeValue=g?"":q.memoizedProps}catch(Te){vt(q,q.return,Te)}}}else if(r.tag===18){if(c===null){q=r;try{var re=q.stateNode;g?tw(re,!0):tw(q.stateNode,!1)}catch(Te){vt(q,q.return,Te)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===s)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;c===r&&(c=null),r=r.return}c===r&&(c=null),r.sibling.return=r.return,r=r.sibling}d&4&&(d=s.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,Su(s,c))));break;case 19:Fn(r,s),Zn(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Su(s,d)));break;case 30:break;case 21:break;default:Fn(r,s),Zn(s)}}function Zn(s){var r=s.flags;if(r&2){try{for(var c,d=s.return;d!==null;){if(sb(d)){c=d;break}d=d.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var g=c.stateNode,x=bm(s);ju(s,x,g);break;case 5:var T=c.stateNode;c.flags&32&&(Ei(T,""),c.flags&=-33);var I=bm(s);ju(s,I,T);break;case 3:case 4:var q=c.stateNode.containerInfo,ne=bm(s);wm(s,ne,q);break;default:throw Error(a(161))}}catch(ie){vt(s,s.return,ie)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function fb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;fb(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),s=s.sibling}}function ba(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)ib(s,r.alternate,r),r=r.sibling}function qr(s){for(s=s.child;s!==null;){var r=s;switch(r.tag){case 0:case 11:case 14:case 15:Za(4,r,r.return),qr(r);break;case 1:Zs(r,r.return);var c=r.stateNode;typeof c.componentWillUnmount=="function"&&tb(r,r.return,c),qr(r);break;case 27:Ml(r.stateNode);case 26:case 5:Zs(r,r.return),qr(r);break;case 22:r.memoizedState===null&&qr(r);break;case 30:qr(r);break;default:qr(r)}s=s.sibling}}function wa(s,r,c){for(c=c&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var d=r.alternate,g=s,x=r,T=x.flags;switch(x.tag){case 0:case 11:case 15:wa(g,x,c),bl(4,x);break;case 1:if(wa(g,x,c),d=x,g=d.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(ne){vt(d,d.return,ne)}if(d=x,g=d.updateQueue,g!==null){var I=d.stateNode;try{var q=g.shared.hiddenCallbacks;if(q!==null)for(g.shared.hiddenCallbacks=null,g=0;g<q.length;g++)H0(q[g],I)}catch(ne){vt(d,d.return,ne)}}c&&T&64&&eb(x),wl(x,x.return);break;case 27:ab(x);case 26:case 5:wa(g,x,c),c&&d===null&&T&4&&nb(x),wl(x,x.return);break;case 12:wa(g,x,c);break;case 31:wa(g,x,c),c&&T&4&&cb(g,x);break;case 13:wa(g,x,c),c&&T&4&&ub(g,x);break;case 22:x.memoizedState===null&&wa(g,x,c),wl(x,x.return);break;case 30:break;default:wa(g,x,c)}r=r.sibling}}function Sm(s,r){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&ol(c))}function Nm(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&ol(s))}function Os(s,r,c,d){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)hb(s,r,c,d),r=r.sibling}function hb(s,r,c,d){var g=r.flags;switch(r.tag){case 0:case 11:case 15:Os(s,r,c,d),g&2048&&bl(9,r);break;case 1:Os(s,r,c,d);break;case 3:Os(s,r,c,d),g&2048&&(s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&ol(s)));break;case 12:if(g&2048){Os(s,r,c,d),s=r.stateNode;try{var x=r.memoizedProps,T=x.id,I=x.onPostCommit;typeof I=="function"&&I(T,r.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(q){vt(r,r.return,q)}}else Os(s,r,c,d);break;case 31:Os(s,r,c,d);break;case 13:Os(s,r,c,d);break;case 23:break;case 22:x=r.stateNode,T=r.alternate,r.memoizedState!==null?x._visibility&2?Os(s,r,c,d):jl(s,r):x._visibility&2?Os(s,r,c,d):(x._visibility|=2,qi(s,r,c,d,(r.subtreeFlags&10256)!==0||!1)),g&2048&&Sm(T,r);break;case 24:Os(s,r,c,d),g&2048&&Nm(r.alternate,r);break;default:Os(s,r,c,d)}}function qi(s,r,c,d,g){for(g=g&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var x=s,T=r,I=c,q=d,ne=T.flags;switch(T.tag){case 0:case 11:case 15:qi(x,T,I,q,g),bl(8,T);break;case 23:break;case 22:var ie=T.stateNode;T.memoizedState!==null?ie._visibility&2?qi(x,T,I,q,g):jl(x,T):(ie._visibility|=2,qi(x,T,I,q,g)),g&&ne&2048&&Sm(T.alternate,T);break;case 24:qi(x,T,I,q,g),g&&ne&2048&&Nm(T.alternate,T);break;default:qi(x,T,I,q,g)}r=r.sibling}}function jl(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var c=s,d=r,g=d.flags;switch(d.tag){case 22:jl(c,d),g&2048&&Sm(d.alternate,d);break;case 24:jl(c,d),g&2048&&Nm(d.alternate,d);break;default:jl(c,d)}r=r.sibling}}var Sl=8192;function Wi(s,r,c){if(s.subtreeFlags&Sl)for(s=s.child;s!==null;)mb(s,r,c),s=s.sibling}function mb(s,r,c){switch(s.tag){case 26:Wi(s,r,c),s.flags&Sl&&s.memoizedState!==null&&y2(c,_s,s.memoizedState,s.memoizedProps);break;case 5:Wi(s,r,c);break;case 3:case 4:var d=_s;_s=Pu(s.stateNode.containerInfo),Wi(s,r,c),_s=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Sl,Sl=16777216,Wi(s,r,c),Sl=d):Wi(s,r,c));break;default:Wi(s,r,c)}}function pb(s){var r=s.alternate;if(r!==null&&(s=r.child,s!==null)){r.child=null;do r=s.sibling,s.sibling=null,s=r;while(s!==null)}}function Nl(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var d=r[c];vn=d,vb(d,s)}pb(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)gb(s),s=s.sibling}function gb(s){switch(s.tag){case 0:case 11:case 15:Nl(s),s.flags&2048&&Za(9,s,s.return);break;case 3:Nl(s);break;case 12:Nl(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,Nu(s)):Nl(s);break;default:Nl(s)}}function Nu(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var d=r[c];vn=d,vb(d,s)}pb(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Za(8,r,r.return),Nu(r);break;case 22:c=r.stateNode,c._visibility&2&&(c._visibility&=-3,Nu(r));break;default:Nu(r)}s=s.sibling}}function vb(s,r){for(;vn!==null;){var c=vn;switch(c.tag){case 0:case 11:case 15:Za(8,c,r);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:ol(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,vn=d;else e:for(c=s;vn!==null;){d=vn;var g=d.sibling,x=d.return;if(ob(d),d===c){vn=null;break e}if(g!==null){g.return=x,vn=g;break e}vn=x}}}var OR={getCacheForType:function(s){var r=Sn(en),c=r.data.get(s);return c===void 0&&(c=s(),r.data.set(s,c)),c},cacheSignal:function(){return Sn(en).controller.signal}},IR=typeof WeakMap=="function"?WeakMap:Map,pt=0,Nt=null,nt=null,rt=0,gt=0,as=null,qa=!1,Yi=!1,km=!1,ja=0,Yt=0,Wa=0,Wr=0,Em=0,rs=0,Gi=0,kl=null,qn=null,Cm=!1,ku=0,yb=0,Eu=1/0,Cu=null,Ya=null,un=0,Ga=null,Ki=null,Sa=0,Tm=0,Am=null,xb=null,El=0,Mm=null;function is(){return(pt&2)!==0&&rt!==0?rt&-rt:L.T!==null?zm():cn()}function bb(){if(rs===0)if((rt&536870912)===0||ot){var s=pn;pn<<=1,(pn&3932160)===0&&(pn=262144),rs=s}else rs=536870912;return s=ns.current,s!==null&&(s.flags|=32),rs}function Wn(s,r,c){(s===Nt&&(gt===2||gt===9)||s.cancelPendingCommit!==null)&&(Xi(s,0),Ka(s,rt,rs,!1)),Le(s,c),((pt&2)===0||s!==Nt)&&(s===Nt&&((pt&2)===0&&(Wr|=c),Yt===4&&Ka(s,rt,rs,!1)),qs(s))}function wb(s,r,c){if((pt&6)!==0)throw Error(a(327));var d=!c&&(r&127)===0&&(r&s.expiredLanes)===0||ee(s,r),g=d?PR(s,r):_m(s,r,!0),x=d;do{if(g===0){Yi&&!d&&Ka(s,r,0,!1);break}else{if(c=s.current.alternate,x&&!DR(c)){g=_m(s,r,!1),x=!1;continue}if(g===2){if(x=r,s.errorRecoveryDisabledLanes&x)var T=0;else T=s.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){r=T;e:{var I=s;g=kl;var q=I.current.memoizedState.isDehydrated;if(q&&(Xi(I,T).flags|=256),T=_m(I,T,!1),T!==2){if(km&&!q){I.errorRecoveryDisabledLanes|=x,Wr|=x,g=4;break e}x=qn,qn=g,x!==null&&(qn===null?qn=x:qn.push.apply(qn,x))}g=T}if(x=!1,g!==2)continue}}if(g===1){Xi(s,0),Ka(s,r,0,!0);break}e:{switch(d=s,x=g,x){case 0:case 1:throw Error(a(345));case 4:if((r&4194048)!==r)break;case 6:Ka(d,r,rs,!qa);break e;case 2:qn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((r&62914560)===r&&(g=ku+300-ke(),10<g)){if(Ka(d,r,rs,!qa),As(d,0,!0)!==0)break e;Sa=r,d.timeoutHandle=Jb(jb.bind(null,d,c,qn,Cu,Cm,r,rs,Wr,Gi,qa,x,"Throttled",-0,0),g);break e}jb(d,c,qn,Cu,Cm,r,rs,Wr,Gi,qa,x,null,-0,0)}}break}while(!0);qs(s)}function jb(s,r,c,d,g,x,T,I,q,ne,ie,de,se,re){if(s.timeoutHandle=-1,de=r.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:la},mb(r,x,de);var Te=(x&62914560)===x?ku-ke():(x&4194048)===x?yb-ke():0;if(Te=x2(de,Te),Te!==null){Sa=x,s.cancelPendingCommit=Te(Mb.bind(null,s,r,x,c,d,g,T,I,q,ie,de,null,se,re)),Ka(s,x,T,!ne);return}}Mb(s,r,x,c,d,g,T,I,q)}function DR(s){for(var r=s;;){var c=r.tag;if((c===0||c===11||c===15)&&r.flags&16384&&(c=r.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var g=c[d],x=g.getSnapshot;g=g.value;try{if(!es(x(),g))return!1}catch{return!1}}if(c=r.child,r.subtreeFlags&16384&&c!==null)c.return=r,r=c;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Ka(s,r,c,d){r&=~Em,r&=~Wr,s.suspendedLanes|=r,s.pingedLanes&=~r,d&&(s.warmLanes|=r),d=s.expirationTimes;for(var g=r;0<g;){var x=31-ut(g),T=1<<x;d[x]=-1,g&=~T}c!==0&&Lt(s,c,r)}function Tu(){return(pt&6)===0?(Cl(0),!1):!0}function Rm(){if(nt!==null){if(gt===0)var s=nt.return;else s=nt,fa=Lr=null,Wh(s),Bi=null,cl=0,s=nt;for(;s!==null;)Qx(s.alternate,s),s=s.return;nt=null}}function Xi(s,r){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,t2(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Sa=0,Rm(),Nt=s,nt=c=ua(s.current,null),rt=r,gt=0,as=null,qa=!1,Yi=ee(s,r),km=!1,Gi=rs=Em=Wr=Wa=Yt=0,qn=kl=null,Cm=!1,(r&8)!==0&&(r|=r&32);var d=s.entangledLanes;if(d!==0)for(s=s.entanglements,d&=r;0<d;){var g=31-ut(d),x=1<<g;r|=s[g],d&=~x}return ja=r,Gc(),c}function Sb(s,r){Ke=null,L.H=vl,r===Ui||r===su?(r=$0(),gt=3):r===Dh?(r=$0(),gt=4):gt=r===cm?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,as=r,nt===null&&(Yt=1,vu(s,ms(r,s.current)))}function Nb(){var s=ns.current;return s===null?!0:(rt&4194048)===rt?ys===null:(rt&62914560)===rt||(rt&536870912)!==0?s===ys:!1}function kb(){var s=L.H;return L.H=vl,s===null?vl:s}function Eb(){var s=L.A;return L.A=OR,s}function Au(){Yt=4,qa||(rt&4194048)!==rt&&ns.current!==null||(Yi=!0),(Wa&134217727)===0&&(Wr&134217727)===0||Nt===null||Ka(Nt,rt,rs,!1)}function _m(s,r,c){var d=pt;pt|=2;var g=kb(),x=Eb();(Nt!==s||rt!==r)&&(Cu=null,Xi(s,r)),r=!1;var T=Yt;e:do try{if(gt!==0&&nt!==null){var I=nt,q=as;switch(gt){case 8:Rm(),T=6;break e;case 3:case 2:case 9:case 6:ns.current===null&&(r=!0);var ne=gt;if(gt=0,as=null,Ji(s,I,q,ne),c&&Yi){T=0;break e}break;default:ne=gt,gt=0,as=null,Ji(s,I,q,ne)}}zR(),T=Yt;break}catch(ie){Sb(s,ie)}while(!0);return r&&s.shellSuspendCounter++,fa=Lr=null,pt=d,L.H=g,L.A=x,nt===null&&(Nt=null,rt=0,Gc()),T}function zR(){for(;nt!==null;)Cb(nt)}function PR(s,r){var c=pt;pt|=2;var d=kb(),g=Eb();Nt!==s||rt!==r?(Cu=null,Eu=ke()+500,Xi(s,r)):Yi=ee(s,r);e:do try{if(gt!==0&&nt!==null){r=nt;var x=as;t:switch(gt){case 1:gt=0,as=null,Ji(s,r,x,1);break;case 2:case 9:if(P0(x)){gt=0,as=null,Tb(r);break}r=function(){gt!==2&&gt!==9||Nt!==s||(gt=7),qs(s)},x.then(r,r);break e;case 3:gt=7;break e;case 4:gt=5;break e;case 7:P0(x)?(gt=0,as=null,Tb(r)):(gt=0,as=null,Ji(s,r,x,7));break;case 5:var T=null;switch(nt.tag){case 26:T=nt.memoizedState;case 5:case 27:var I=nt;if(T?hw(T):I.stateNode.complete){gt=0,as=null;var q=I.sibling;if(q!==null)nt=q;else{var ne=I.return;ne!==null?(nt=ne,Mu(ne)):nt=null}break t}}gt=0,as=null,Ji(s,r,x,5);break;case 6:gt=0,as=null,Ji(s,r,x,6);break;case 8:Rm(),Yt=6;break e;default:throw Error(a(462))}}LR();break}catch(ie){Sb(s,ie)}while(!0);return fa=Lr=null,L.H=d,L.A=g,pt=c,nt!==null?0:(Nt=null,rt=0,Gc(),Yt)}function LR(){for(;nt!==null&&!he();)Cb(nt)}function Cb(s){var r=Xx(s.alternate,s,ja);s.memoizedProps=s.pendingProps,r===null?Mu(s):nt=r}function Tb(s){var r=s,c=r.alternate;switch(r.tag){case 15:case 0:r=Zx(c,r,r.pendingProps,r.type,void 0,rt);break;case 11:r=Zx(c,r,r.pendingProps,r.type.render,r.ref,rt);break;case 5:Wh(r);default:Qx(c,r),r=nt=E0(r,ja),r=Xx(c,r,ja)}s.memoizedProps=s.pendingProps,r===null?Mu(s):nt=r}function Ji(s,r,c,d){fa=Lr=null,Wh(r),Bi=null,cl=0;var g=r.return;try{if(ER(s,g,r,c,rt)){Yt=1,vu(s,ms(c,s.current)),nt=null;return}}catch(x){if(g!==null)throw nt=g,x;Yt=1,vu(s,ms(c,s.current)),nt=null;return}r.flags&32768?(ot||d===1?s=!0:Yi||(rt&536870912)!==0?s=!1:(qa=s=!0,(d===2||d===9||d===3||d===6)&&(d=ns.current,d!==null&&d.tag===13&&(d.flags|=16384))),Ab(r,s)):Mu(r)}function Mu(s){var r=s;do{if((r.flags&32768)!==0){Ab(r,qa);return}s=r.return;var c=AR(r.alternate,r,ja);if(c!==null){nt=c;return}if(r=r.sibling,r!==null){nt=r;return}nt=r=s}while(r!==null);Yt===0&&(Yt=5)}function Ab(s,r){do{var c=MR(s.alternate,s);if(c!==null){c.flags&=32767,nt=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!r&&(s=s.sibling,s!==null)){nt=s;return}nt=s=c}while(s!==null);Yt=6,nt=null}function Mb(s,r,c,d,g,x,T,I,q){s.cancelPendingCommit=null;do Ru();while(un!==0);if((pt&6)!==0)throw Error(a(327));if(r!==null){if(r===s.current)throw Error(a(177));if(x=r.lanes|r.childLanes,x|=bh,dt(s,c,x,T,I,q),s===Nt&&(nt=Nt=null,rt=0),Ki=r,Ga=s,Sa=c,Tm=x,Am=g,xb=d,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,VR(Ye,function(){return Db(),null})):(s.callbackNode=null,s.callbackPriority=0),d=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||d){d=L.T,L.T=null,g=H.p,H.p=2,T=pt,pt|=4;try{RR(s,r,c)}finally{pt=T,H.p=g,L.T=d}}un=1,Rb(),_b(),Ob()}}function Rb(){if(un===1){un=0;var s=Ga,r=Ki,c=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||c){c=L.T,L.T=null;var d=H.p;H.p=2;var g=pt;pt|=4;try{db(r,s);var x=Fm,T=v0(s.containerInfo),I=x.focusedElem,q=x.selectionRange;if(T!==I&&I&&I.ownerDocument&&g0(I.ownerDocument.documentElement,I)){if(q!==null&&ph(I)){var ne=q.start,ie=q.end;if(ie===void 0&&(ie=ne),"selectionStart"in I)I.selectionStart=ne,I.selectionEnd=Math.min(ie,I.value.length);else{var de=I.ownerDocument||document,se=de&&de.defaultView||window;if(se.getSelection){var re=se.getSelection(),Te=I.textContent.length,$e=Math.min(q.start,Te),jt=q.end===void 0?$e:Math.min(q.end,Te);!re.extend&&$e>jt&&(T=jt,jt=$e,$e=T);var J=p0(I,$e),Y=p0(I,jt);if(J&&Y&&(re.rangeCount!==1||re.anchorNode!==J.node||re.anchorOffset!==J.offset||re.focusNode!==Y.node||re.focusOffset!==Y.offset)){var te=de.createRange();te.setStart(J.node,J.offset),re.removeAllRanges(),$e>jt?(re.addRange(te),re.extend(Y.node,Y.offset)):(te.setEnd(Y.node,Y.offset),re.addRange(te))}}}}for(de=[],re=I;re=re.parentNode;)re.nodeType===1&&de.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;I<de.length;I++){var ue=de[I];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}Hu=!!Hm,Fm=Hm=null}finally{pt=g,H.p=d,L.T=c}}s.current=r,un=2}}function _b(){if(un===2){un=0;var s=Ga,r=Ki,c=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||c){c=L.T,L.T=null;var d=H.p;H.p=2;var g=pt;pt|=4;try{ib(s,r.alternate,r)}finally{pt=g,H.p=d,L.T=c}}un=3}}function Ob(){if(un===4||un===3){un=0,pe();var s=Ga,r=Ki,c=Sa,d=xb;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?un=5:(un=0,Ki=Ga=null,Ib(s,s.pendingLanes));var g=s.pendingLanes;if(g===0&&(Ya=null),Ms(c),r=r.stateNode,Ie&&typeof Ie.onCommitFiberRoot=="function")try{Ie.onCommitFiberRoot(on,r,void 0,(r.current.flags&128)===128)}catch{}if(d!==null){r=L.T,g=H.p,H.p=2,L.T=null;try{for(var x=s.onRecoverableError,T=0;T<d.length;T++){var I=d[T];x(I.value,{componentStack:I.stack})}}finally{L.T=r,H.p=g}}(Sa&3)!==0&&Ru(),qs(s),g=s.pendingLanes,(c&261930)!==0&&(g&42)!==0?s===Mm?El++:(El=0,Mm=s):El=0,Cl(0)}}function Ib(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,ol(r)))}function Ru(){return Rb(),_b(),Ob(),Db()}function Db(){if(un!==5)return!1;var s=Ga,r=Tm;Tm=0;var c=Ms(Sa),d=L.T,g=H.p;try{H.p=32>c?32:c,L.T=null,c=Am,Am=null;var x=Ga,T=Sa;if(un=0,Ki=Ga=null,Sa=0,(pt&6)!==0)throw Error(a(331));var I=pt;if(pt|=4,gb(x.current),hb(x,x.current,T,c),pt=I,Cl(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot=="function")try{Ie.onPostCommitFiberRoot(on,x)}catch{}return!0}finally{H.p=g,L.T=d,Ib(s,r)}}function zb(s,r,c){r=ms(c,r),r=lm(s.stateNode,r,2),s=Va(s,r,2),s!==null&&(Le(s,2),qs(s))}function vt(s,r,c){if(s.tag===3)zb(s,s,c);else for(;r!==null;){if(r.tag===3){zb(r,s,c);break}else if(r.tag===1){var d=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ya===null||!Ya.has(d))){s=ms(c,s),c=Px(2),d=Va(r,c,2),d!==null&&(Lx(c,d,r,s),Le(d,2),qs(d));break}}r=r.return}}function Om(s,r,c){var d=s.pingCache;if(d===null){d=s.pingCache=new IR;var g=new Set;d.set(r,g)}else g=d.get(r),g===void 0&&(g=new Set,d.set(r,g));g.has(c)||(km=!0,g.add(c),s=$R.bind(null,s,r,c),r.then(s,s))}function $R(s,r,c){var d=s.pingCache;d!==null&&d.delete(r),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Nt===s&&(rt&c)===c&&(Yt===4||Yt===3&&(rt&62914560)===rt&&300>ke()-ku?(pt&2)===0&&Xi(s,0):Em|=c,Gi===rt&&(Gi=0)),qs(s)}function Pb(s,r){r===0&&(r=ve()),s=Dr(s,r),s!==null&&(Le(s,r),qs(s))}function UR(s){var r=s.memoizedState,c=0;r!==null&&(c=r.retryLane),Pb(s,c)}function BR(s,r){var c=0;switch(s.tag){case 31:case 13:var d=s.stateNode,g=s.memoizedState;g!==null&&(c=g.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(r),Pb(s,c)}function VR(s,r){return He(s,r)}var _u=null,Qi=null,Im=!1,Ou=!1,Dm=!1,Xa=0;function qs(s){s!==Qi&&s.next===null&&(Qi===null?_u=Qi=s:Qi=Qi.next=s),Ou=!0,Im||(Im=!0,FR())}function Cl(s,r){if(!Dm&&Ou){Dm=!0;do for(var c=!1,d=_u;d!==null;){if(s!==0){var g=d.pendingLanes;if(g===0)var x=0;else{var T=d.suspendedLanes,I=d.pingedLanes;x=(1<<31-ut(42|s)+1)-1,x&=g&~(T&~I),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,Bb(d,x))}else x=rt,x=As(d,d===Nt?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||ee(d,x)||(c=!0,Bb(d,x));d=d.next}while(c);Dm=!1}}function HR(){Lb()}function Lb(){Ou=Im=!1;var s=0;Xa!==0&&e2()&&(s=Xa);for(var r=ke(),c=null,d=_u;d!==null;){var g=d.next,x=$b(d,r);x===0?(d.next=null,c===null?_u=g:c.next=g,g===null&&(Qi=c)):(c=d,(s!==0||(x&3)!==0)&&(Ou=!0)),d=g}un!==0&&un!==5||Cl(s),Xa!==0&&(Xa=0)}function $b(s,r){for(var c=s.suspendedLanes,d=s.pingedLanes,g=s.expirationTimes,x=s.pendingLanes&-62914561;0<x;){var T=31-ut(x),I=1<<T,q=g[T];q===-1?((I&c)===0||(I&d)!==0)&&(g[T]=me(I,r)):q<=r&&(s.expiredLanes|=I),x&=~I}if(r=Nt,c=rt,c=As(s,s===r?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,c===0||s===r&&(gt===2||gt===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&le(d),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||ee(s,c)){if(r=c&-c,r===s.callbackPriority)return r;switch(d!==null&&le(d),Ms(c)){case 2:case 8:c=et;break;case 32:c=Ye;break;case 268435456:c=Et;break;default:c=Ye}return d=Ub.bind(null,s),c=He(c,d),s.callbackPriority=r,s.callbackNode=c,r}return d!==null&&d!==null&&le(d),s.callbackPriority=2,s.callbackNode=null,2}function Ub(s,r){if(un!==0&&un!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(Ru()&&s.callbackNode!==c)return null;var d=rt;return d=As(s,s===Nt?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(wb(s,d,r),$b(s,ke()),s.callbackNode!=null&&s.callbackNode===c?Ub.bind(null,s):null)}function Bb(s,r){if(Ru())return null;wb(s,r,!0)}function FR(){n2(function(){(pt&6)!==0?He(Je,HR):Lb()})}function zm(){if(Xa===0){var s=Li;s===0&&(s=Kt,Kt<<=1,(Kt&261888)===0&&(Kt=256)),Xa=s}return Xa}function Vb(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Bc(""+s)}function Hb(s,r){var c=r.ownerDocument.createElement("input");return c.name=r.name,c.value=r.value,s.id&&c.setAttribute("form",s.id),r.parentNode.insertBefore(c,r),s=new FormData(s),c.parentNode.removeChild(c),s}function ZR(s,r,c,d,g){if(r==="submit"&&c&&c.stateNode===g){var x=Vb((g[Bn]||null).action),T=d.submitter;T&&(r=(r=T[Bn]||null)?Vb(r.formAction):T.getAttribute("formAction"),r!==null&&(x=r,T=null));var I=new Zc("action","action",null,d,g);s.push({event:I,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Xa!==0){var q=T?Hb(g,T):new FormData(g);nm(c,{pending:!0,data:q,method:g.method,action:x},null,q)}}else typeof x=="function"&&(I.preventDefault(),q=T?Hb(g,T):new FormData(g),nm(c,{pending:!0,data:q,method:g.method,action:x},x,q))},currentTarget:g}]})}}for(var Pm=0;Pm<xh.length;Pm++){var Lm=xh[Pm],qR=Lm.toLowerCase(),WR=Lm[0].toUpperCase()+Lm.slice(1);Rs(qR,"on"+WR)}Rs(b0,"onAnimationEnd"),Rs(w0,"onAnimationIteration"),Rs(j0,"onAnimationStart"),Rs("dblclick","onDoubleClick"),Rs("focusin","onFocus"),Rs("focusout","onBlur"),Rs(cR,"onTransitionRun"),Rs(uR,"onTransitionStart"),Rs(dR,"onTransitionCancel"),Rs(S0,"onTransitionEnd"),Ni("onMouseEnter",["mouseout","mouseover"]),Ni("onMouseLeave",["mouseout","mouseover"]),Ni("onPointerEnter",["pointerout","pointerover"]),Ni("onPointerLeave",["pointerout","pointerover"]),Rr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Rr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Rr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Rr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Rr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Rr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),YR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tl));function Fb(s,r){r=(r&4)!==0;for(var c=0;c<s.length;c++){var d=s[c],g=d.event;d=d.listeners;e:{var x=void 0;if(r)for(var T=d.length-1;0<=T;T--){var I=d[T],q=I.instance,ne=I.currentTarget;if(I=I.listener,q!==x&&g.isPropagationStopped())break e;x=I,g.currentTarget=ne;try{x(g)}catch(ie){Yc(ie)}g.currentTarget=null,x=q}else for(T=0;T<d.length;T++){if(I=d[T],q=I.instance,ne=I.currentTarget,I=I.listener,q!==x&&g.isPropagationStopped())break e;x=I,g.currentTarget=ne;try{x(g)}catch(ie){Yc(ie)}g.currentTarget=null,x=q}}}}function st(s,r){var c=r[Xf];c===void 0&&(c=r[Xf]=new Set);var d=s+"__bubble";c.has(d)||(Zb(r,s,2,!1),c.add(d))}function $m(s,r,c){var d=0;r&&(d|=4),Zb(c,s,d,r)}var Iu="_reactListening"+Math.random().toString(36).slice(2);function Um(s){if(!s[Iu]){s[Iu]=!0,Ly.forEach(function(c){c!=="selectionchange"&&(YR.has(c)||$m(c,!1,s),$m(c,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[Iu]||(r[Iu]=!0,$m("selectionchange",!1,r))}}function Zb(s,r,c,d){switch(bw(r)){case 2:var g=j2;break;case 8:g=S2;break;default:g=tp}c=g.bind(null,r,c,s),g=void 0,!ih||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(g=!0),d?g!==void 0?s.addEventListener(r,c,{capture:!0,passive:g}):s.addEventListener(r,c,!0):g!==void 0?s.addEventListener(r,c,{passive:g}):s.addEventListener(r,c,!1)}function Bm(s,r,c,d,g){var x=d;if((r&1)===0&&(r&2)===0&&d!==null)e:for(;;){if(d===null)return;var T=d.tag;if(T===3||T===4){var I=d.stateNode.containerInfo;if(I===g)break;if(T===4)for(T=d.return;T!==null;){var q=T.tag;if((q===3||q===4)&&T.stateNode.containerInfo===g)return;T=T.return}for(;I!==null;){if(T=wi(I),T===null)return;if(q=T.tag,q===5||q===6||q===26||q===27){d=x=T;continue e}I=I.parentNode}}d=d.return}Ky(function(){var ne=x,ie=ah(c),de=[];e:{var se=N0.get(s);if(se!==void 0){var re=Zc,Te=s;switch(s){case"keypress":if(Hc(c)===0)break e;case"keydown":case"keyup":re=BM;break;case"focusin":Te="focus",re=uh;break;case"focusout":Te="blur",re=uh;break;case"beforeblur":case"afterblur":re=uh;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=Qy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=AM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=FM;break;case b0:case w0:case j0:re=_M;break;case S0:re=qM;break;case"scroll":case"scrollend":re=CM;break;case"wheel":re=YM;break;case"copy":case"cut":case"paste":re=IM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=t0;break;case"toggle":case"beforetoggle":re=KM}var $e=(r&4)!==0,jt=!$e&&(s==="scroll"||s==="scrollend"),J=$e?se!==null?se+"Capture":null:se;$e=[];for(var Y=ne,te;Y!==null;){var ue=Y;if(te=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||te===null||J===null||(ue=Ko(Y,J),ue!=null&&$e.push(Al(Y,ue,te))),jt)break;Y=Y.return}0<$e.length&&(se=new re(se,Te,null,c,ie),de.push({event:se,listeners:$e}))}}if((r&7)===0){e:{if(se=s==="mouseover"||s==="pointerover",re=s==="mouseout"||s==="pointerout",se&&c!==sh&&(Te=c.relatedTarget||c.fromElement)&&(wi(Te)||Te[bi]))break e;if((re||se)&&(se=ie.window===ie?ie:(se=ie.ownerDocument)?se.defaultView||se.parentWindow:window,re?(Te=c.relatedTarget||c.toElement,re=ne,Te=Te?wi(Te):null,Te!==null&&(jt=l(Te),$e=Te.tag,Te!==jt||$e!==5&&$e!==27&&$e!==6)&&(Te=null)):(re=null,Te=ne),re!==Te)){if($e=Qy,ue="onMouseLeave",J="onMouseEnter",Y="mouse",(s==="pointerout"||s==="pointerover")&&($e=t0,ue="onPointerLeave",J="onPointerEnter",Y="pointer"),jt=re==null?se:Go(re),te=Te==null?se:Go(Te),se=new $e(ue,Y+"leave",re,c,ie),se.target=jt,se.relatedTarget=te,ue=null,wi(ie)===ne&&($e=new $e(J,Y+"enter",Te,c,ie),$e.target=te,$e.relatedTarget=jt,ue=$e),jt=ue,re&&Te)t:{for($e=GR,J=re,Y=Te,te=0,ue=J;ue;ue=$e(ue))te++;ue=0;for(var De=Y;De;De=$e(De))ue++;for(;0<te-ue;)J=$e(J),te--;for(;0<ue-te;)Y=$e(Y),ue--;for(;te--;){if(J===Y||Y!==null&&J===Y.alternate){$e=J;break t}J=$e(J),Y=$e(Y)}$e=null}else $e=null;re!==null&&qb(de,se,re,$e,!1),Te!==null&&jt!==null&&qb(de,jt,Te,$e,!0)}}e:{if(se=ne?Go(ne):window,re=se.nodeName&&se.nodeName.toLowerCase(),re==="select"||re==="input"&&se.type==="file")var ht=c0;else if(o0(se))if(u0)ht=iR;else{ht=aR;var Re=sR}else re=se.nodeName,!re||re.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ne&&nh(ne.elementType)&&(ht=c0):ht=rR;if(ht&&(ht=ht(s,ne))){l0(de,ht,c,ie);break e}Re&&Re(s,se,ne),s==="focusout"&&ne&&se.type==="number"&&ne.memoizedProps.value!=null&&th(se,"number",se.value)}switch(Re=ne?Go(ne):window,s){case"focusin":(o0(Re)||Re.contentEditable==="true")&&(Mi=Re,gh=ne,al=null);break;case"focusout":al=gh=Mi=null;break;case"mousedown":vh=!0;break;case"contextmenu":case"mouseup":case"dragend":vh=!1,y0(de,c,ie);break;case"selectionchange":if(lR)break;case"keydown":case"keyup":y0(de,c,ie)}var Xe;if(fh)e:{switch(s){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else Ai?r0(s,c)&&(it="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(it="onCompositionStart");it&&(n0&&c.locale!=="ko"&&(Ai||it!=="onCompositionStart"?it==="onCompositionEnd"&&Ai&&(Xe=Xy()):(Da=ie,oh="value"in Da?Da.value:Da.textContent,Ai=!0)),Re=Du(ne,it),0<Re.length&&(it=new e0(it,s,null,c,ie),de.push({event:it,listeners:Re}),Xe?it.data=Xe:(Xe=i0(c),Xe!==null&&(it.data=Xe)))),(Xe=JM?QM(s,c):eR(s,c))&&(it=Du(ne,"onBeforeInput"),0<it.length&&(Re=new e0("onBeforeInput","beforeinput",null,c,ie),de.push({event:Re,listeners:it}),Re.data=Xe)),ZR(de,s,ne,c,ie)}Fb(de,r)})}function Al(s,r,c){return{instance:s,listener:r,currentTarget:c}}function Du(s,r){for(var c=r+"Capture",d=[];s!==null;){var g=s,x=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||x===null||(g=Ko(s,c),g!=null&&d.unshift(Al(s,g,x)),g=Ko(s,r),g!=null&&d.push(Al(s,g,x))),s.tag===3)return d;s=s.return}return[]}function GR(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function qb(s,r,c,d,g){for(var x=r._reactName,T=[];c!==null&&c!==d;){var I=c,q=I.alternate,ne=I.stateNode;if(I=I.tag,q!==null&&q===d)break;I!==5&&I!==26&&I!==27||ne===null||(q=ne,g?(ne=Ko(c,x),ne!=null&&T.unshift(Al(c,ne,q))):g||(ne=Ko(c,x),ne!=null&&T.push(Al(c,ne,q)))),c=c.return}T.length!==0&&s.push({event:r,listeners:T})}var KR=/\r\n?/g,XR=/\u0000|\uFFFD/g;function Wb(s){return(typeof s=="string"?s:""+s).replace(KR,`
9
- `).replace(XR,"")}function Yb(s,r){return r=Wb(r),Wb(s)===r}function wt(s,r,c,d,g,x){switch(c){case"children":typeof d=="string"?r==="body"||r==="textarea"&&d===""||Ei(s,d):(typeof d=="number"||typeof d=="bigint")&&r!=="body"&&Ei(s,""+d);break;case"className":$c(s,"class",d);break;case"tabIndex":$c(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":$c(s,c,d);break;case"style":Yy(s,d,x);break;case"data":if(r!=="object"){$c(s,"data",d);break}case"src":case"href":if(d===""&&(r!=="a"||c!=="href")){s.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=Bc(""+d),s.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(c==="formAction"?(r!=="input"&&wt(s,r,"name",g.name,g,null),wt(s,r,"formEncType",g.formEncType,g,null),wt(s,r,"formMethod",g.formMethod,g,null),wt(s,r,"formTarget",g.formTarget,g,null)):(wt(s,r,"encType",g.encType,g,null),wt(s,r,"method",g.method,g,null),wt(s,r,"target",g.target,g,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=Bc(""+d),s.setAttribute(c,d);break;case"onClick":d!=null&&(s.onclick=la);break;case"onScroll":d!=null&&st("scroll",s);break;case"onScrollEnd":d!=null&&st("scrollend",s);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(c=d.__html,c!=null){if(g.children!=null)throw Error(a(60));s.innerHTML=c}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){s.removeAttribute("xlink:href");break}c=Bc(""+d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,""+d):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":d===!0?s.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,d):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(c,d):s.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(c):s.setAttribute(c,d);break;case"popover":st("beforetoggle",s),st("toggle",s),Lc(s,"popover",d);break;case"xlinkActuate":oa(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":oa(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":oa(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":oa(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":oa(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":oa(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":oa(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":oa(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":oa(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Lc(s,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=kM.get(c)||c,Lc(s,c,d))}}function Vm(s,r,c,d,g,x){switch(c){case"style":Yy(s,d,x);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(c=d.__html,c!=null){if(g.children!=null)throw Error(a(60));s.innerHTML=c}}break;case"children":typeof d=="string"?Ei(s,d):(typeof d=="number"||typeof d=="bigint")&&Ei(s,""+d);break;case"onScroll":d!=null&&st("scroll",s);break;case"onScrollEnd":d!=null&&st("scrollend",s);break;case"onClick":d!=null&&(s.onclick=la);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$y.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(g=c.endsWith("Capture"),r=c.slice(2,g?c.length-7:void 0),x=s[Bn]||null,x=x!=null?x[c]:null,typeof x=="function"&&s.removeEventListener(r,x,g),typeof d=="function")){typeof x!="function"&&x!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(r,d,g);break e}c in s?s[c]=d:d===!0?s.setAttribute(c,""):Lc(s,c,d)}}}function kn(s,r,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",s),st("load",s);var d=!1,g=!1,x;for(x in c)if(c.hasOwnProperty(x)){var T=c[x];if(T!=null)switch(x){case"src":d=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,r));default:wt(s,r,x,T,c,null)}}g&&wt(s,r,"srcSet",c.srcSet,c,null),d&&wt(s,r,"src",c.src,c,null);return;case"input":st("invalid",s);var I=x=T=g=null,q=null,ne=null;for(d in c)if(c.hasOwnProperty(d)){var ie=c[d];if(ie!=null)switch(d){case"name":g=ie;break;case"type":T=ie;break;case"checked":q=ie;break;case"defaultChecked":ne=ie;break;case"value":x=ie;break;case"defaultValue":I=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(a(137,r));break;default:wt(s,r,d,ie,c,null)}}Fy(s,x,I,q,ne,T,g,!1);return;case"select":st("invalid",s),d=T=x=null;for(g in c)if(c.hasOwnProperty(g)&&(I=c[g],I!=null))switch(g){case"value":x=I;break;case"defaultValue":T=I;break;case"multiple":d=I;default:wt(s,r,g,I,c,null)}r=x,c=T,s.multiple=!!d,r!=null?ki(s,!!d,r,!1):c!=null&&ki(s,!!d,c,!0);return;case"textarea":st("invalid",s),x=g=d=null;for(T in c)if(c.hasOwnProperty(T)&&(I=c[T],I!=null))switch(T){case"value":d=I;break;case"defaultValue":g=I;break;case"children":x=I;break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(a(91));break;default:wt(s,r,T,I,c,null)}qy(s,d,g,x);return;case"option":for(q in c)c.hasOwnProperty(q)&&(d=c[q],d!=null)&&(q==="selected"?s.selected=d&&typeof d!="function"&&typeof d!="symbol":wt(s,r,q,d,c,null));return;case"dialog":st("beforetoggle",s),st("toggle",s),st("cancel",s),st("close",s);break;case"iframe":case"object":st("load",s);break;case"video":case"audio":for(d=0;d<Tl.length;d++)st(Tl[d],s);break;case"image":st("error",s),st("load",s);break;case"details":st("toggle",s);break;case"embed":case"source":case"link":st("error",s),st("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in c)if(c.hasOwnProperty(ne)&&(d=c[ne],d!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,r));default:wt(s,r,ne,d,c,null)}return;default:if(nh(r)){for(ie in c)c.hasOwnProperty(ie)&&(d=c[ie],d!==void 0&&Vm(s,r,ie,d,c,void 0));return}}for(I in c)c.hasOwnProperty(I)&&(d=c[I],d!=null&&wt(s,r,I,d,c,null))}function JR(s,r,c,d){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,x=null,T=null,I=null,q=null,ne=null,ie=null;for(re in c){var de=c[re];if(c.hasOwnProperty(re)&&de!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":q=de;default:d.hasOwnProperty(re)||wt(s,r,re,null,d,de)}}for(var se in d){var re=d[se];if(de=c[se],d.hasOwnProperty(se)&&(re!=null||de!=null))switch(se){case"type":x=re;break;case"name":g=re;break;case"checked":ne=re;break;case"defaultChecked":ie=re;break;case"value":T=re;break;case"defaultValue":I=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(a(137,r));break;default:re!==de&&wt(s,r,se,re,d,de)}}eh(s,T,I,q,ne,ie,x,g);return;case"select":re=T=I=se=null;for(x in c)if(q=c[x],c.hasOwnProperty(x)&&q!=null)switch(x){case"value":break;case"multiple":re=q;default:d.hasOwnProperty(x)||wt(s,r,x,null,d,q)}for(g in d)if(x=d[g],q=c[g],d.hasOwnProperty(g)&&(x!=null||q!=null))switch(g){case"value":se=x;break;case"defaultValue":I=x;break;case"multiple":T=x;default:x!==q&&wt(s,r,g,x,d,q)}r=I,c=T,d=re,se!=null?ki(s,!!c,se,!1):!!d!=!!c&&(r!=null?ki(s,!!c,r,!0):ki(s,!!c,c?[]:"",!1));return;case"textarea":re=se=null;for(I in c)if(g=c[I],c.hasOwnProperty(I)&&g!=null&&!d.hasOwnProperty(I))switch(I){case"value":break;case"children":break;default:wt(s,r,I,null,d,g)}for(T in d)if(g=d[T],x=c[T],d.hasOwnProperty(T)&&(g!=null||x!=null))switch(T){case"value":se=g;break;case"defaultValue":re=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(a(91));break;default:g!==x&&wt(s,r,T,g,d,x)}Zy(s,se,re);return;case"option":for(var Te in c)se=c[Te],c.hasOwnProperty(Te)&&se!=null&&!d.hasOwnProperty(Te)&&(Te==="selected"?s.selected=!1:wt(s,r,Te,null,d,se));for(q in d)se=d[q],re=c[q],d.hasOwnProperty(q)&&se!==re&&(se!=null||re!=null)&&(q==="selected"?s.selected=se&&typeof se!="function"&&typeof se!="symbol":wt(s,r,q,se,d,re));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var $e in c)se=c[$e],c.hasOwnProperty($e)&&se!=null&&!d.hasOwnProperty($e)&&wt(s,r,$e,null,d,se);for(ne in d)if(se=d[ne],re=c[ne],d.hasOwnProperty(ne)&&se!==re&&(se!=null||re!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,r));break;default:wt(s,r,ne,se,d,re)}return;default:if(nh(r)){for(var jt in c)se=c[jt],c.hasOwnProperty(jt)&&se!==void 0&&!d.hasOwnProperty(jt)&&Vm(s,r,jt,void 0,d,se);for(ie in d)se=d[ie],re=c[ie],!d.hasOwnProperty(ie)||se===re||se===void 0&&re===void 0||Vm(s,r,ie,se,d,re);return}}for(var J in c)se=c[J],c.hasOwnProperty(J)&&se!=null&&!d.hasOwnProperty(J)&&wt(s,r,J,null,d,se);for(de in d)se=d[de],re=c[de],!d.hasOwnProperty(de)||se===re||se==null&&re==null||wt(s,r,de,se,d,re)}function Gb(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function QR(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var g=c[d],x=g.transferSize,T=g.initiatorType,I=g.duration;if(x&&I&&Gb(T)){for(T=0,I=g.responseEnd,d+=1;d<c.length;d++){var q=c[d],ne=q.startTime;if(ne>I)break;var ie=q.transferSize,de=q.initiatorType;ie&&Gb(de)&&(q=q.responseEnd,T+=ie*(q<I?1:(I-ne)/(q-ne)))}if(--d,r+=8*(x+T)/(g.duration/1e3),s++,10<s)break}}if(0<s)return r/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Hm=null,Fm=null;function zu(s){return s.nodeType===9?s:s.ownerDocument}function Kb(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Xb(s,r){if(s===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&r==="foreignObject"?0:s}function Zm(s,r){return s==="textarea"||s==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var qm=null;function e2(){var s=window.event;return s&&s.type==="popstate"?s===qm?!1:(qm=s,!0):(qm=null,!1)}var Jb=typeof setTimeout=="function"?setTimeout:void 0,t2=typeof clearTimeout=="function"?clearTimeout:void 0,Qb=typeof Promise=="function"?Promise:void 0,n2=typeof queueMicrotask=="function"?queueMicrotask:typeof Qb<"u"?function(s){return Qb.resolve(null).then(s).catch(s2)}:Jb;function s2(s){setTimeout(function(){throw s})}function Ja(s){return s==="head"}function ew(s,r){var c=r,d=0;do{var g=c.nextSibling;if(s.removeChild(c),g&&g.nodeType===8)if(c=g.data,c==="/$"||c==="/&"){if(d===0){s.removeChild(g),so(r);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Ml(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Ml(c);for(var x=c.firstChild;x;){var T=x.nextSibling,I=x.nodeName;x[Yo]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=T}}else c==="body"&&Ml(s.ownerDocument.body);c=g}while(c);so(r)}function tw(s,r){var c=s;s=0;do{var d=c.nextSibling;if(c.nodeType===1?r?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(r?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=d}while(c)}function Wm(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var c=r;switch(r=r.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Wm(c),Jf(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function a2(s,r,c,d){for(;s.nodeType===1;){var g=c;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[Yo])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(x=s.getAttribute("rel"),x==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(x!==g.rel||s.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||s.getAttribute("title")!==(g.title==null?null:g.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(x=s.getAttribute("src"),(x!==(g.src==null?null:g.src)||s.getAttribute("type")!==(g.type==null?null:g.type)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&x&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var x=g.name==null?null:""+g.name;if(g.type==="hidden"&&s.getAttribute("name")===x)return s}else return s;if(s=xs(s.nextSibling),s===null)break}return null}function r2(s,r,c){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=xs(s.nextSibling),s===null))return null;return s}function nw(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=xs(s.nextSibling),s===null))return null;return s}function Ym(s){return s.data==="$?"||s.data==="$~"}function Gm(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function i2(s,r){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||c.readyState!=="loading")r();else{var d=function(){r(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function xs(s){for(;s!=null;s=s.nextSibling){var r=s.nodeType;if(r===1||r===3)break;if(r===8){if(r=s.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return s}var Km=null;function sw(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(r===0)return xs(s.nextSibling);r--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||r++}s=s.nextSibling}return null}function aw(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(r===0)return s;r--}else c!=="/$"&&c!=="/&"||r++}s=s.previousSibling}return null}function rw(s,r,c){switch(r=zu(c),s){case"html":if(s=r.documentElement,!s)throw Error(a(452));return s;case"head":if(s=r.head,!s)throw Error(a(453));return s;case"body":if(s=r.body,!s)throw Error(a(454));return s;default:throw Error(a(451))}}function Ml(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);Jf(s)}var bs=new Map,iw=new Set;function Pu(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Na=H.d;H.d={f:o2,r:l2,D:c2,C:u2,L:d2,m:f2,X:m2,S:h2,M:p2};function o2(){var s=Na.f(),r=Tu();return s||r}function l2(s){var r=ji(s);r!==null&&r.tag===5&&r.type==="form"?Sx(r):Na.r(s)}var eo=typeof document>"u"?null:document;function ow(s,r,c){var d=eo;if(d&&typeof r=="string"&&r){var g=fs(r);g='link[rel="'+s+'"][href="'+g+'"]',typeof c=="string"&&(g+='[crossorigin="'+c+'"]'),iw.has(g)||(iw.add(g),s={rel:s,crossOrigin:c,href:r},d.querySelector(g)===null&&(r=d.createElement("link"),kn(r,"link",s),gn(r),d.head.appendChild(r)))}}function c2(s){Na.D(s),ow("dns-prefetch",s,null)}function u2(s,r){Na.C(s,r),ow("preconnect",s,r)}function d2(s,r,c){Na.L(s,r,c);var d=eo;if(d&&s&&r){var g='link[rel="preload"][as="'+fs(r)+'"]';r==="image"&&c&&c.imageSrcSet?(g+='[imagesrcset="'+fs(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(g+='[imagesizes="'+fs(c.imageSizes)+'"]')):g+='[href="'+fs(s)+'"]';var x=g;switch(r){case"style":x=to(s);break;case"script":x=no(s)}bs.has(x)||(s=y({rel:"preload",href:r==="image"&&c&&c.imageSrcSet?void 0:s,as:r},c),bs.set(x,s),d.querySelector(g)!==null||r==="style"&&d.querySelector(Rl(x))||r==="script"&&d.querySelector(_l(x))||(r=d.createElement("link"),kn(r,"link",s),gn(r),d.head.appendChild(r)))}}function f2(s,r){Na.m(s,r);var c=eo;if(c&&s){var d=r&&typeof r.as=="string"?r.as:"script",g='link[rel="modulepreload"][as="'+fs(d)+'"][href="'+fs(s)+'"]',x=g;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=no(s)}if(!bs.has(x)&&(s=y({rel:"modulepreload",href:s},r),bs.set(x,s),c.querySelector(g)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(_l(x)))return}d=c.createElement("link"),kn(d,"link",s),gn(d),c.head.appendChild(d)}}}function h2(s,r,c){Na.S(s,r,c);var d=eo;if(d&&s){var g=Si(d).hoistableStyles,x=to(s);r=r||"default";var T=g.get(x);if(!T){var I={loading:0,preload:null};if(T=d.querySelector(Rl(x)))I.loading=5;else{s=y({rel:"stylesheet",href:s,"data-precedence":r},c),(c=bs.get(x))&&Xm(s,c);var q=T=d.createElement("link");gn(q),kn(q,"link",s),q._p=new Promise(function(ne,ie){q.onload=ne,q.onerror=ie}),q.addEventListener("load",function(){I.loading|=1}),q.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Lu(T,r,d)}T={type:"stylesheet",instance:T,count:1,state:I},g.set(x,T)}}}function m2(s,r){Na.X(s,r);var c=eo;if(c&&s){var d=Si(c).hoistableScripts,g=no(s),x=d.get(g);x||(x=c.querySelector(_l(g)),x||(s=y({src:s,async:!0},r),(r=bs.get(g))&&Jm(s,r),x=c.createElement("script"),gn(x),kn(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(g,x))}}function p2(s,r){Na.M(s,r);var c=eo;if(c&&s){var d=Si(c).hoistableScripts,g=no(s),x=d.get(g);x||(x=c.querySelector(_l(g)),x||(s=y({src:s,async:!0,type:"module"},r),(r=bs.get(g))&&Jm(s,r),x=c.createElement("script"),gn(x),kn(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(g,x))}}function lw(s,r,c,d){var g=(g=ae.current)?Pu(g):null;if(!g)throw Error(a(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(r=to(c.href),c=Si(g).hoistableStyles,d=c.get(r),d||(d={type:"style",instance:null,count:0,state:null},c.set(r,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=to(c.href);var x=Si(g).hoistableStyles,T=x.get(s);if(T||(g=g.ownerDocument||g,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,T),(x=g.querySelector(Rl(s)))&&!x._p&&(T.instance=x,T.state.loading=5),bs.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},bs.set(s,c),x||g2(g,s,c,T.state))),r&&d===null)throw Error(a(528,""));return T}if(r&&d!==null)throw Error(a(529,""));return null;case"script":return r=c.async,c=c.src,typeof c=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=no(c),c=Si(g).hoistableScripts,d=c.get(r),d||(d={type:"script",instance:null,count:0,state:null},c.set(r,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,s))}}function to(s){return'href="'+fs(s)+'"'}function Rl(s){return'link[rel="stylesheet"]['+s+"]"}function cw(s){return y({},s,{"data-precedence":s.precedence,precedence:null})}function g2(s,r,c,d){s.querySelector('link[rel="preload"][as="style"]['+r+"]")?d.loading=1:(r=s.createElement("link"),d.preload=r,r.addEventListener("load",function(){return d.loading|=1}),r.addEventListener("error",function(){return d.loading|=2}),kn(r,"link",c),gn(r),s.head.appendChild(r))}function no(s){return'[src="'+fs(s)+'"]'}function _l(s){return"script[async]"+s}function uw(s,r,c){if(r.count++,r.instance===null)switch(r.type){case"style":var d=s.querySelector('style[data-href~="'+fs(c.href)+'"]');if(d)return r.instance=d,gn(d),d;var g=y({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),gn(d),kn(d,"style",g),Lu(d,c.precedence,s),r.instance=d;case"stylesheet":g=to(c.href);var x=s.querySelector(Rl(g));if(x)return r.state.loading|=4,r.instance=x,gn(x),x;d=cw(c),(g=bs.get(g))&&Xm(d,g),x=(s.ownerDocument||s).createElement("link"),gn(x);var T=x;return T._p=new Promise(function(I,q){T.onload=I,T.onerror=q}),kn(x,"link",d),r.state.loading|=4,Lu(x,c.precedence,s),r.instance=x;case"script":return x=no(c.src),(g=s.querySelector(_l(x)))?(r.instance=g,gn(g),g):(d=c,(g=bs.get(x))&&(d=y({},c),Jm(d,g)),s=s.ownerDocument||s,g=s.createElement("script"),gn(g),kn(g,"link",d),s.head.appendChild(g),r.instance=g);case"void":return null;default:throw Error(a(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(d=r.instance,r.state.loading|=4,Lu(d,c.precedence,s));return r.instance}function Lu(s,r,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=d.length?d[d.length-1]:null,x=g,T=0;T<d.length;T++){var I=d[T];if(I.dataset.precedence===r)x=I;else if(x!==g)break}x?x.parentNode.insertBefore(s,x.nextSibling):(r=c.nodeType===9?c.head:c,r.insertBefore(s,r.firstChild))}function Xm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function Jm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var $u=null;function dw(s,r,c){if($u===null){var d=new Map,g=$u=new Map;g.set(c,d)}else g=$u,d=g.get(c),d||(d=new Map,g.set(c,d));if(d.has(s))return d;for(d.set(s,null),c=c.getElementsByTagName(s),g=0;g<c.length;g++){var x=c[g];if(!(x[Yo]||x[wn]||s==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var T=x.getAttribute(r)||"";T=s+T;var I=d.get(T);I?I.push(x):d.set(T,[x])}}return d}function fw(s,r,c){s=s.ownerDocument||s,s.head.insertBefore(c,r==="title"?s.querySelector("head > title"):null)}function v2(s,r,c){if(c===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(s=r.disabled,typeof r.precedence=="string"&&s==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function hw(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function y2(s,r,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var g=to(d.href),x=r.querySelector(Rl(g));if(x){r=x._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=Uu.bind(s),r.then(s,s)),c.state.loading|=4,c.instance=x,gn(x);return}x=r.ownerDocument||r,d=cw(d),(g=bs.get(g))&&Xm(d,g),x=x.createElement("link"),gn(x);var T=x;T._p=new Promise(function(I,q){T.onload=I,T.onerror=q}),kn(x,"link",d),c.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,r),(r=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=Uu.bind(s),r.addEventListener("load",c),r.addEventListener("error",c))}}var Qm=0;function x2(s,r){return s.stylesheets&&s.count===0&&Vu(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var d=setTimeout(function(){if(s.stylesheets&&Vu(s,s.stylesheets),s.unsuspend){var x=s.unsuspend;s.unsuspend=null,x()}},6e4+r);0<s.imgBytes&&Qm===0&&(Qm=62500*QR());var g=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Vu(s,s.stylesheets),s.unsuspend)){var x=s.unsuspend;s.unsuspend=null,x()}},(s.imgBytes>Qm?50:800)+r);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(g)}}:null}function Uu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Vu(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Bu=null;function Vu(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Bu=new Map,r.forEach(b2,s),Bu=null,Uu.call(s))}function b2(s,r){if(!(r.state.loading&4)){var c=Bu.get(s);if(c)var d=c.get(null);else{c=new Map,Bu.set(s,c);for(var g=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<g.length;x++){var T=g[x];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(c.set(T.dataset.precedence,T),d=T)}d&&c.set(null,d)}g=r.instance,T=g.getAttribute("data-precedence"),x=c.get(T)||d,x===d&&c.set(null,g),c.set(T,g),this.count++,d=Uu.bind(this),g.addEventListener("load",d),g.addEventListener("error",d),x?x.parentNode.insertBefore(g,x.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(g,s.firstChild)),r.state.loading|=4}}var Ol={$$typeof:S,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function w2(s,r,c,d,g,x,T,I,q){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ve(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ve(0),this.hiddenUpdates=Ve(null),this.identifierPrefix=d,this.onUncaughtError=g,this.onCaughtError=x,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function mw(s,r,c,d,g,x,T,I,q,ne,ie,de){return s=new w2(s,r,c,T,q,ne,ie,de,I),r=1,x===!0&&(r|=24),x=ts(3,null,null,r),s.current=x,x.stateNode=s,r=_h(),r.refCount++,s.pooledCache=r,r.refCount++,x.memoizedState={element:d,isDehydrated:c,cache:r},zh(x),s}function pw(s){return s?(s=Oi,s):Oi}function gw(s,r,c,d,g,x){g=pw(g),d.context===null?d.context=g:d.pendingContext=g,d=Ba(r),d.payload={element:c},x=x===void 0?null:x,x!==null&&(d.callback=x),c=Va(s,d,r),c!==null&&(Wn(c,s,r),dl(c,s,r))}function vw(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<r?c:r}}function ep(s,r){vw(s,r),(s=s.alternate)&&vw(s,r)}function yw(s){if(s.tag===13||s.tag===31){var r=Dr(s,67108864);r!==null&&Wn(r,s,67108864),ep(s,67108864)}}function xw(s){if(s.tag===13||s.tag===31){var r=is();r=qt(r);var c=Dr(s,r);c!==null&&Wn(c,s,r),ep(s,r)}}var Hu=!0;function j2(s,r,c,d){var g=L.T;L.T=null;var x=H.p;try{H.p=2,tp(s,r,c,d)}finally{H.p=x,L.T=g}}function S2(s,r,c,d){var g=L.T;L.T=null;var x=H.p;try{H.p=8,tp(s,r,c,d)}finally{H.p=x,L.T=g}}function tp(s,r,c,d){if(Hu){var g=np(d);if(g===null)Bm(s,r,d,Fu,c),ww(s,d);else if(k2(g,s,r,c,d))d.stopPropagation();else if(ww(s,d),r&4&&-1<N2.indexOf(s)){for(;g!==null;){var x=ji(g);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var T=xn(x.pendingLanes);if(T!==0){var I=x;for(I.pendingLanes|=2,I.entangledLanes|=2;T;){var q=1<<31-ut(T);I.entanglements[1]|=q,T&=~q}qs(x),(pt&6)===0&&(Eu=ke()+500,Cl(0))}}break;case 31:case 13:I=Dr(x,2),I!==null&&Wn(I,x,2),Tu(),ep(x,2)}if(x=np(d),x===null&&Bm(s,r,d,Fu,c),x===g)break;g=x}g!==null&&d.stopPropagation()}else Bm(s,r,d,null,c)}}function np(s){return s=ah(s),sp(s)}var Fu=null;function sp(s){if(Fu=null,s=wi(s),s!==null){var r=l(s);if(r===null)s=null;else{var c=r.tag;if(c===13){if(s=u(r),s!==null)return s;s=null}else if(c===31){if(s=f(r),s!==null)return s;s=null}else if(c===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return Fu=s,null}function bw(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ee()){case Je:return 2;case et:return 8;case Ye:case Bt:return 32;case Et:return 268435456;default:return 32}default:return 32}}var ap=!1,Qa=null,er=null,tr=null,Il=new Map,Dl=new Map,nr=[],N2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ww(s,r){switch(s){case"focusin":case"focusout":Qa=null;break;case"dragenter":case"dragleave":er=null;break;case"mouseover":case"mouseout":tr=null;break;case"pointerover":case"pointerout":Il.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dl.delete(r.pointerId)}}function zl(s,r,c,d,g,x){return s===null||s.nativeEvent!==x?(s={blockedOn:r,domEventName:c,eventSystemFlags:d,nativeEvent:x,targetContainers:[g]},r!==null&&(r=ji(r),r!==null&&yw(r)),s):(s.eventSystemFlags|=d,r=s.targetContainers,g!==null&&r.indexOf(g)===-1&&r.push(g),s)}function k2(s,r,c,d,g){switch(r){case"focusin":return Qa=zl(Qa,s,r,c,d,g),!0;case"dragenter":return er=zl(er,s,r,c,d,g),!0;case"mouseover":return tr=zl(tr,s,r,c,d,g),!0;case"pointerover":var x=g.pointerId;return Il.set(x,zl(Il.get(x)||null,s,r,c,d,g)),!0;case"gotpointercapture":return x=g.pointerId,Dl.set(x,zl(Dl.get(x)||null,s,r,c,d,g)),!0}return!1}function jw(s){var r=wi(s.target);if(r!==null){var c=l(r);if(c!==null){if(r=c.tag,r===13){if(r=u(c),r!==null){s.blockedOn=r,Pc(s.priority,function(){xw(c)});return}}else if(r===31){if(r=f(c),r!==null){s.blockedOn=r,Pc(s.priority,function(){xw(c)});return}}else if(r===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Zu(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var c=np(s.nativeEvent);if(c===null){c=s.nativeEvent;var d=new c.constructor(c.type,c);sh=d,c.target.dispatchEvent(d),sh=null}else return r=ji(c),r!==null&&yw(r),s.blockedOn=c,!1;r.shift()}return!0}function Sw(s,r,c){Zu(s)&&c.delete(r)}function E2(){ap=!1,Qa!==null&&Zu(Qa)&&(Qa=null),er!==null&&Zu(er)&&(er=null),tr!==null&&Zu(tr)&&(tr=null),Il.forEach(Sw),Dl.forEach(Sw)}function qu(s,r){s.blockedOn===r&&(s.blockedOn=null,ap||(ap=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,E2)))}var Wu=null;function Nw(s){Wu!==s&&(Wu=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Wu===s&&(Wu=null);for(var r=0;r<s.length;r+=3){var c=s[r],d=s[r+1],g=s[r+2];if(typeof d!="function"){if(sp(d||c)===null)continue;break}var x=ji(c);x!==null&&(s.splice(r,3),r-=3,nm(x,{pending:!0,data:g,method:c.method,action:d},d,g))}}))}function so(s){function r(q){return qu(q,s)}Qa!==null&&qu(Qa,s),er!==null&&qu(er,s),tr!==null&&qu(tr,s),Il.forEach(r),Dl.forEach(r);for(var c=0;c<nr.length;c++){var d=nr[c];d.blockedOn===s&&(d.blockedOn=null)}for(;0<nr.length&&(c=nr[0],c.blockedOn===null);)jw(c),c.blockedOn===null&&nr.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var g=c[d],x=c[d+1],T=g[Bn]||null;if(typeof x=="function")T||Nw(c);else if(T){var I=null;if(x&&x.hasAttribute("formAction")){if(g=x,T=x[Bn]||null)I=T.formAction;else if(sp(g)!==null)continue}else I=T.action;typeof I=="function"?c[d+1]=I:(c.splice(d,3),d-=3),Nw(c)}}}function kw(){function s(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(T){return g=T})},focusReset:"manual",scroll:"manual"})}function r(){g!==null&&(g(),g=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,g=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),g!==null&&(g(),g=null)}}}function rp(s){this._internalRoot=s}Yu.prototype.render=rp.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(a(409));var c=r.current,d=is();gw(c,d,s,r,null,null)},Yu.prototype.unmount=rp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;gw(s.current,2,null,s,null,null),Tu(),r[bi]=null}};function Yu(s){this._internalRoot=s}Yu.prototype.unstable_scheduleHydration=function(s){if(s){var r=cn();s={blockedOn:null,target:s,priority:r};for(var c=0;c<nr.length&&r!==0&&r<nr[c].priority;c++);nr.splice(c,0,s),c===0&&jw(s)}};var Ew=t.version;if(Ew!=="19.2.3")throw Error(a(527,Ew,"19.2.3"));H.findDOMNode=function(s){var r=s._reactInternals;if(r===void 0)throw typeof s.render=="function"?Error(a(188)):(s=Object.keys(s).join(","),Error(a(268,s)));return s=h(r),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var C2={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Gu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gu.isDisabled&&Gu.supportsFiber)try{on=Gu.inject(C2),Ie=Gu}catch{}}return Ll.createRoot=function(s,r){if(!o(s))throw Error(a(299));var c=!1,d="",g=Ox,x=Ix,T=Dx;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(g=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(T=r.onRecoverableError)),r=mw(s,1,!1,null,null,c,d,null,g,x,T,kw),s[bi]=r.current,Um(s),new rp(r)},Ll.hydrateRoot=function(s,r,c){if(!o(s))throw Error(a(299));var d=!1,g="",x=Ox,T=Ix,I=Dx,q=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(T=c.onCaughtError),c.onRecoverableError!==void 0&&(I=c.onRecoverableError),c.formState!==void 0&&(q=c.formState)),r=mw(s,1,!0,r,c??null,d,g,q,x,T,I,kw),r.context=pw(null),c=r.current,d=is(),d=qt(d),g=Ba(d),g.callback=null,Va(c,g,d),c=d,r.current.lanes=c,Le(r,c),qs(r),s[bi]=r.current,Um(s),new Yu(r)},Ll.version="19.2.3",Ll}var zw;function P2(){if(zw)return lp.exports;zw=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),lp.exports=z2(),lp.exports}var L2=P2();const RN=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim();const $2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const U2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase());const Pw=e=>{const t=U2(e);return t.charAt(0).toUpperCase()+t.slice(1)};var B2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const V2=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const H2=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:o="",children:l,iconNode:u,...f},m)=>v.createElement("svg",{ref:m,...B2,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:RN("lucide",o),...!l&&!V2(f)&&{"aria-hidden":"true"},...f},[...u.map(([h,p])=>v.createElement(h,p)),...Array.isArray(l)?l:[l]]));const Un=(e,t)=>{const n=v.forwardRef(({className:a,...o},l)=>v.createElement(H2,{ref:l,iconNode:t,className:RN(`lucide-${$2(Pw(e))}`,`lucide-${e}`,a),...o}));return n.displayName=Pw(e),n};const F2=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Z2=Un("bot",F2);const q2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],W2=Un("chevron-down",q2);const Y2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],G2=Un("chevron-right",Y2);const K2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]],_N=Un("compass",K2);const X2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Lw=Un("loader-circle",X2);const J2=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],Q2=Un("map",J2);const e_=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]],t_=Un("mic-off",e_);const n_=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],s_=Un("mic",n_);const a_=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],r_=Un("radio",a_);const i_=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],o_=Un("search",i_);const l_=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],c_=Un("sliders-horizontal",l_);const u_=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],d_=Un("sparkles",u_);const f_=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],h_=Un("terminal",f_);const m_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],p_=Un("volume-2",m_);const g_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],v_=Un("volume-x",g_);function y_(e){try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch{}}function x_(e,t){try{localStorage.setItem(e,JSON.stringify(t)),window.dispatchEvent(new CustomEvent("hudson:saved",{detail:{key:e}}))}catch{}}const b_=()=>()=>{},w_=()=>!0,j_=()=>!1;function S_(){return v.useSyncExternalStore(b_,w_,j_)}function Ca(e,t){const n=S_(),[a,o]=v.useState(t),l=v.useRef(!1);if(n&&!l.current){l.current=!0;const u=y_(e);u!==void 0&&o(u)}return v.useEffect(()=>{n&&x_(e,a)},[e,a,n]),[a,o]}var ON="vercel.ai.error",N_=Symbol.for(ON),$w,Uw,sa=class IN extends(Uw=Error,$w=N_,Uw){constructor({name:t,message:n,cause:a}){super(n),this[$w]=!0,this.name=t,this.cause=a}static isInstance(t){return IN.hasMarker(t,ON)}static hasMarker(t,n){const a=Symbol.for(n);return t!=null&&typeof t=="object"&&a in t&&typeof t[a]=="boolean"&&t[a]===!0}};function DN(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var zN="AI_InvalidArgumentError",PN=`vercel.ai.error.${zN}`,k_=Symbol.for(PN),Bw,Vw,E_=class extends(Vw=sa,Bw=k_,Vw){constructor({message:e,cause:t,argument:n}){super({name:zN,message:e,cause:t}),this[Bw]=!0,this.argument=n}static isInstance(e){return sa.hasMarker(e,PN)}},LN="AI_JSONParseError",$N=`vercel.ai.error.${LN}`,C_=Symbol.for($N),Hw,Fw,Zw=class extends(Fw=sa,Hw=C_,Fw){constructor({text:e,cause:t}){super({name:LN,message:`JSON parsing failed: Text: ${e}.
10
- Error message: ${DN(t)}`,cause:t}),this[Hw]=!0,this.text=e}static isInstance(e){return sa.hasMarker(e,$N)}},UN="AI_TypeValidationError",BN=`vercel.ai.error.${UN}`,T_=Symbol.for(BN),qw,Ww,Oo=class gg extends(Ww=sa,qw=T_,Ww){constructor({value:t,cause:n,context:a}){let o="Type validation failed";if(a?.field&&(o+=` for ${a.field}`),a?.entityName||a?.entityId){o+=" (";const l=[];a.entityName&&l.push(a.entityName),a.entityId&&l.push(`id: "${a.entityId}"`),o+=l.join(", "),o+=")"}super({name:UN,message:`${o}: Value: ${JSON.stringify(t)}.
11
- Error message: ${DN(n)}`,cause:n}),this[qw]=!0,this.value=t,this.context=a}static isInstance(t){return sa.hasMarker(t,BN)}static wrap({value:t,cause:n,context:a}){var o,l,u;return gg.isInstance(n)&&n.value===t&&((o=n.context)==null?void 0:o.field)===a?.field&&((l=n.context)==null?void 0:l.entityName)===a?.entityName&&((u=n.context)==null?void 0:u.entityId)===a?.entityId?n:new gg({value:t,cause:n,context:a})}};function oe(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:u,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const h=u.prototype,p=Object.keys(h);for(let y=0;y<p.length;y++){const b=p[y];b in f||(f[b]=h[b].bind(f))}}const o=n?.Parent??Object;class l extends o{}Object.defineProperty(l,"name",{value:e});function u(f){var m;const h=n?.Parent?new l:this;a(h,f),(m=h._zod).deferred??(m.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(u,"init",{value:a}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>n?.Parent&&f instanceof n.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class To extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class VN extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const HN={};function xr(e){return HN}function FN(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,o])=>t.indexOf(+a)===-1).map(([a,o])=>o)}function vg(e,t){return typeof t=="bigint"?t.toString():t}function Ef(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function bv(e){return e==null}function wv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function A_(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let o=(a.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m?.[1]&&(o=Number.parseInt(m[1]))}const l=n>o?n:o,u=Number.parseInt(e.toFixed(l).replace(".","")),f=Number.parseInt(t.toFixed(l).replace(".",""));return u%f/10**l}const Yw=Symbol("evaluating");function lt(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==Yw)return a===void 0&&(a=Yw,a=n()),a},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function vi(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Sr(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function Gw(e){return JSON.stringify(e)}function M_(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ZN="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function dc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const R_=Ef(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Io(e){if(dc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(dc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function qN(e){return Io(e)?{...e}:Array.isArray(e)?[...e]:e}const __=new Set(["string","number","symbol"]);function Do(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nr(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(a._zod.parent=e),a}function _e(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function O_(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const I_={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function D_(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=Sr(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=n.shape[f])}return vi(this,"shape",u),u},checks:[]});return Nr(e,l)}function z_(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=Sr(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return vi(this,"shape",u),u},checks:[]});return Nr(e,l)}function P_(e,t){if(!Io(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const l=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Sr(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return vi(this,"shape",l),l}});return Nr(e,o)}function L_(e,t){if(!Io(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Sr(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return vi(this,"shape",a),a}});return Nr(e,n)}function $_(e,t){const n=Sr(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return vi(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return Nr(e,n)}function U_(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=Sr(t._zod.def,{get shape(){const f=t._zod.def.shape,m={...f};if(n)for(const h in n){if(!(h in f))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(m[h]=e?new e({type:"optional",innerType:f[h]}):f[h])}else for(const h in f)m[h]=e?new e({type:"optional",innerType:f[h]}):f[h];return vi(this,"shape",m),m},checks:[]});return Nr(t,u)}function B_(e,t,n){const a=Sr(t._zod.def,{get shape(){const o=t._zod.def.shape,l={...o};if(n)for(const u in n){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(l[u]=new e({type:"nonoptional",innerType:o[u]}))}else for(const u in o)l[u]=new e({type:"nonoptional",innerType:o[u]});return vi(this,"shape",l),l}});return Nr(t,a)}function bo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function wo(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function Ku(e){return typeof e=="string"?e:e?.message}function br(e,t,n){const a={...e,path:e.path??[]};if(!e.message){const o=Ku(e.inst?._zod.def?.error?.(e))??Ku(t?.error?.(e))??Ku(n.customError?.(e))??Ku(n.localeError?.(e))??"Invalid input";a.message=o}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function jv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function fc(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const WN=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vg,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},YN=oe("$ZodError",WN),GN=oe("$ZodError",WN,{Parent:Error});function V_(e,t=n=>n.message){const n={},a=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):a.push(t(o));return{formErrors:a,fieldErrors:n}}function H_(e,t=n=>n.message){const n={_errors:[]},a=o=>{for(const l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>a({issues:u}));else if(l.code==="invalid_key")a({issues:l.issues});else if(l.code==="invalid_element")a({issues:l.issues});else if(l.path.length===0)n._errors.push(t(l));else{let u=n,f=0;for(;f<l.path.length;){const m=l.path[f];f===l.path.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(t(l))):u[m]=u[m]||{_errors:[]},u=u[m],f++}}};return a(e),n}const Sv=e=>(t,n,a,o)=>{const l=a?Object.assign(a,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},l);if(u instanceof Promise)throw new To;if(u.issues.length){const f=new(o?.Err??e)(u.issues.map(m=>br(m,l,xr())));throw ZN(f,o?.callee),f}return u.value},Nv=e=>async(t,n,a,o)=>{const l=a?Object.assign(a,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new(o?.Err??e)(u.issues.map(m=>br(m,l,xr())));throw ZN(f,o?.callee),f}return u.value},Cf=e=>(t,n,a)=>{const o=a?{...a,async:!1}:{async:!1},l=t._zod.run({value:n,issues:[]},o);if(l instanceof Promise)throw new To;return l.issues.length?{success:!1,error:new(e??YN)(l.issues.map(u=>br(u,o,xr())))}:{success:!0,data:l.value}},F_=Cf(GN),Tf=e=>async(t,n,a)=>{const o=a?Object.assign(a,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},o);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>br(u,o,xr())))}:{success:!0,data:l.value}},Z_=Tf(GN),q_=e=>(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Sv(e)(t,n,o)},W_=e=>(t,n,a)=>Sv(e)(t,n,a),Y_=e=>async(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Nv(e)(t,n,o)},G_=e=>async(t,n,a)=>Nv(e)(t,n,a),K_=e=>(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Cf(e)(t,n,o)},X_=e=>(t,n,a)=>Cf(e)(t,n,a),J_=e=>async(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Tf(e)(t,n,o)},Q_=e=>async(t,n,a)=>Tf(e)(t,n,a),eO=/^[cC][^\s-]{8,}$/,tO=/^[0-9a-z]+$/,nO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,sO=/^[0-9a-vA-V]{20}$/,aO=/^[A-Za-z0-9]{27}$/,rO=/^[a-zA-Z0-9_-]{21}$/,iO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,oO=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Kw=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,lO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function uO(){return new RegExp(cO,"u")}const 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])$/,fO=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,hO=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,mO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pO=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,KN=/^[A-Za-z0-9_-]*$/,gO=/^\+[1-9]\d{6,14}$/,XN="(?:(?:\\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])))",vO=new RegExp(`^${XN}$`);function JN(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function yO(e){return new RegExp(`^${JN(e)}$`)}function xO(e){const t=JN({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${XN}T(?:${a})$`)}const bO=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},wO=/^-?\d+$/,QN=/^-?\d+(?:\.\d+)?$/,jO=/^(?:true|false)$/i,SO=/^null$/i,NO=/^[^A-Z]*$/,kO=/^[^a-z]*$/,Qn=oe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ek={number:"number",bigint:"bigint",object:"date"},tk=oe("$ZodCheckLessThan",(e,t)=>{Qn.init(e,t);const n=ek[typeof t.value];e._zod.onattach.push(a=>{const o=a._zod.bag,l=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<l&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nk=oe("$ZodCheckGreaterThan",(e,t)=>{Qn.init(e,t);const n=ek[typeof t.value];e._zod.onattach.push(a=>{const o=a._zod.bag,l=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),EO=oe("$ZodCheckMultipleOf",(e,t)=>{Qn.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):A_(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),CO=oe("$ZodCheckNumberFormat",(e,t)=>{Qn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),a=n?"int":"number",[o,l]=I_[t.format];e._zod.onattach.push(u=>{const f=u._zod.bag;f.format=t.format,f.minimum=o,f.maximum=l,n&&(f.pattern=wO)}),e._zod.check=u=>{const f=u.value;if(n){if(!Number.isInteger(f)){u.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?u.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):u.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}f<o&&u.issues.push({origin:"number",input:f,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),f>l&&u.issues.push({origin:"number",input:f,code:"too_big",maximum:l,inclusive:!0,inst:e,continue:!t.abort})}}),TO=oe("$ZodCheckMaxLength",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const o=a.value;return!bv(o)&&o.length!==void 0}),e._zod.onattach.push(a=>{const o=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const o=a.value;if(o.length<=t.maximum)return;const u=jv(o);a.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),AO=oe("$ZodCheckMinLength",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const o=a.value;return!bv(o)&&o.length!==void 0}),e._zod.onattach.push(a=>{const o=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const o=a.value;if(o.length>=t.minimum)return;const u=jv(o);a.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),MO=oe("$ZodCheckLengthEquals",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const o=a.value;return!bv(o)&&o.length!==void 0}),e._zod.onattach.push(a=>{const o=a._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=a=>{const o=a.value,l=o.length;if(l===t.length)return;const u=jv(o),f=l>t.length;a.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),Af=oe("$ZodCheckStringFormat",(e,t)=>{var n,a;Qn.init(e,t),e._zod.onattach.push(o=>{const l=o._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),RO=oe("$ZodCheckRegex",(e,t)=>{Af.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_O=oe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=NO),Af.init(e,t)}),OO=oe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=kO),Af.init(e,t)}),IO=oe("$ZodCheckIncludes",(e,t)=>{Qn.init(e,t);const n=Do(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(o=>{const l=o._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(a)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),DO=oe("$ZodCheckStartsWith",(e,t)=>{Qn.init(e,t);const n=new RegExp(`^${Do(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const o=a._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),zO=oe("$ZodCheckEndsWith",(e,t)=>{Qn.init(e,t);const n=new RegExp(`.*${Do(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const o=a._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),PO=oe("$ZodCheckOverwrite",(e,t)=>{Qn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class LO{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
12
- `).filter(u=>u),o=Math.min(...a.map(u=>u.length-u.trimStart().length)),l=a.map(u=>u.slice(o)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(l=>` ${l}`)];return new t(...n,o.join(`
13
- `))}}const $O={major:4,minor:3,patch:6},Dt=oe("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$O;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const o of a)for(const l of o._zod.onattach)l(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(u,f,m)=>{let h=bo(u),p;for(const y of f){if(y._zod.def.when){if(!y._zod.def.when(u))continue}else if(h)continue;const b=u.issues.length,w=y._zod.check(u);if(w instanceof Promise&&m?.async===!1)throw new To;if(p||w instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await w,u.issues.length!==b&&(h||(h=bo(u,b)))});else{if(u.issues.length===b)continue;h||(h=bo(u,b))}}return p?p.then(()=>u):u},l=(u,f,m)=>{if(bo(u))return u.aborted=!0,u;const h=o(f,a,m);if(h instanceof Promise){if(m.async===!1)throw new To;return h.then(p=>e._zod.parse(p,m))}return e._zod.parse(h,m)};e._zod.run=(u,f)=>{if(f.skipChecks)return e._zod.parse(u,f);if(f.direction==="backward"){const h=e._zod.parse({value:u.value,issues:[]},{...f,skipChecks:!0});return h instanceof Promise?h.then(p=>l(p,u,f)):l(h,u,f)}const m=e._zod.parse(u,f);if(m instanceof Promise){if(f.async===!1)throw new To;return m.then(h=>o(h,a,f))}return o(m,a,f)}}lt(e,"~standard",()=>({validate:o=>{try{const l=F_(e,o);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return Z_(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),kv=oe("$ZodString",(e,t)=>{Dt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??bO(e._zod.bag),e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ut=oe("$ZodStringFormat",(e,t)=>{Af.init(e,t),kv.init(e,t)}),UO=oe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=oO),Ut.init(e,t)}),BO=oe("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Kw(a))}else t.pattern??(t.pattern=Kw());Ut.init(e,t)}),VO=oe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=lO),Ut.init(e,t)}),HO=oe("$ZodURL",(e,t)=>{Ut.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),o=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),FO=oe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=uO()),Ut.init(e,t)}),ZO=oe("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=rO),Ut.init(e,t)}),qO=oe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=eO),Ut.init(e,t)}),WO=oe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tO),Ut.init(e,t)}),YO=oe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nO),Ut.init(e,t)}),GO=oe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=sO),Ut.init(e,t)}),KO=oe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=aO),Ut.init(e,t)}),XO=oe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=xO(t)),Ut.init(e,t)}),JO=oe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=vO),Ut.init(e,t)}),QO=oe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=yO(t)),Ut.init(e,t)}),eI=oe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=iO),Ut.init(e,t)}),tI=oe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dO),Ut.init(e,t),e._zod.bag.format="ipv4"}),nI=oe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=fO),Ut.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),sI=oe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=hO),Ut.init(e,t)}),aI=oe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=mO),Ut.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[o,l]=a;if(!l)throw new Error;const u=Number(l);if(`${u}`!==l)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function sk(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const rI=oe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=pO),Ut.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{sk(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function iI(e){if(!KN.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return sk(n)}const oI=oe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=KN),Ut.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{iI(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),lI=oe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=gO),Ut.init(e,t)});function cI(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const o=JSON.parse(atob(a));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const uI=oe("$ZodJWT",(e,t)=>{Ut.init(e,t),e._zod.check=n=>{cI(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ak=oe("$ZodNumber",(e,t)=>{Dt.init(e,t),e._zod.pattern=e._zod.bag.pattern??QN,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const l=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...l?{received:l}:{}}),n}}),dI=oe("$ZodNumberFormat",(e,t)=>{CO.init(e,t),ak.init(e,t)}),fI=oe("$ZodBoolean",(e,t)=>{Dt.init(e,t),e._zod.pattern=jO,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),hI=oe("$ZodNull",(e,t)=>{Dt.init(e,t),e._zod.pattern=SO,e._zod.values=new Set([null]),e._zod.parse=(n,a)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),mI=oe("$ZodUnknown",(e,t)=>{Dt.init(e,t),e._zod.parse=n=>n}),pI=oe("$ZodNever",(e,t)=>{Dt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Xw(e,t,n){e.issues.length&&t.issues.push(...wo(n,e.issues)),t.value[n]=e.value}const gI=oe("$ZodArray",(e,t)=>{Dt.init(e,t),e._zod.parse=(n,a)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const l=[];for(let u=0;u<o.length;u++){const f=o[u],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?l.push(m.then(h=>Xw(h,n,u))):Xw(m,n,u)}return l.length?Promise.all(l).then(()=>n):n}});function Fd(e,t,n,a,o){if(e.issues.length){if(o&&!(n in a))return;t.issues.push(...wo(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function rk(e){const t=Object.keys(e.shape);for(const a of t)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=O_(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ik(e,t,n,a,o,l){const u=[],f=o.keySet,m=o.catchall._zod,h=m.def.type,p=m.optout==="optional";for(const y in t){if(f.has(y))continue;if(h==="never"){u.push(y);continue}const b=m.run({value:t[y],issues:[]},a);b instanceof Promise?e.push(b.then(w=>Fd(w,n,y,t,p))):Fd(b,n,y,t,p)}return u.length&&n.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:l}),e.length?Promise.all(e).then(()=>n):n}const vI=oe("$ZodObject",(e,t)=>{if(Dt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=Ef(()=>rk(t));lt(e._zod,"propValues",()=>{const f=t.shape,m={};for(const h in f){const p=f[h]._zod;if(p.values){m[h]??(m[h]=new Set);for(const y of p.values)m[h].add(y)}}return m});const o=dc,l=t.catchall;let u;e._zod.parse=(f,m)=>{u??(u=a.value);const h=f.value;if(!o(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;f.value={};const p=[],y=u.shape;for(const b of u.keys){const w=y[b],j=w._zod.optout==="optional",N=w._zod.run({value:h[b],issues:[]},m);N instanceof Promise?p.push(N.then(C=>Fd(C,f,b,h,j))):Fd(N,f,b,h,j)}return l?ik(p,h,f,m,a.value,e):p.length?Promise.all(p).then(()=>f):f}}),yI=oe("$ZodObjectJIT",(e,t)=>{vI.init(e,t);const n=e._zod.parse,a=Ef(()=>rk(t)),o=b=>{const w=new LO(["shape","payload","ctx"]),j=a.value,N=S=>{const R=Gw(S);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};w.write("const input = payload.value;");const C=Object.create(null);let k=0;for(const S of j.keys)C[S]=`key_${k++}`;w.write("const newResult = {};");for(const S of j.keys){const R=C[S],A=Gw(S),D=b[S]?._zod?.optout==="optional";w.write(`const ${R} = ${N(S)};`),D?w.write(`
14
- if (${R}.issues.length) {
15
- if (${A} in input) {
16
- payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
17
- ...iss,
18
- path: iss.path ? [${A}, ...iss.path] : [${A}]
19
- })));
20
- }
21
- }
22
-
23
- if (${R}.value === undefined) {
24
- if (${A} in input) {
25
- newResult[${A}] = undefined;
26
- }
27
- } else {
28
- newResult[${A}] = ${R}.value;
29
- }
30
-
31
- `):w.write(`
32
- if (${R}.issues.length) {
33
- payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
34
- ...iss,
35
- path: iss.path ? [${A}, ...iss.path] : [${A}]
36
- })));
37
- }
38
-
39
- if (${R}.value === undefined) {
40
- if (${A} in input) {
41
- newResult[${A}] = undefined;
42
- }
43
- } else {
44
- newResult[${A}] = ${R}.value;
45
- }
46
-
47
- `)}w.write("payload.value = newResult;"),w.write("return payload;");const E=w.compile();return(S,R)=>E(b,S,R)};let l;const u=dc,f=!HN.jitless,h=f&&R_.value,p=t.catchall;let y;e._zod.parse=(b,w)=>{y??(y=a.value);const j=b.value;return u(j)?f&&h&&w?.async===!1&&w.jitless!==!0?(l||(l=o(t.shape)),b=l(b,w),p?ik([],j,b,w,y,e):b):n(b,w):(b.issues.push({expected:"object",code:"invalid_type",input:j,inst:e}),b)}});function Jw(e,t,n,a){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const o=e.filter(l=>!bo(l));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(l=>l.issues.map(u=>br(u,a,xr())))}),t)}const ok=oe("$ZodUnion",(e,t)=>{Dt.init(e,t),lt(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),lt(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),lt(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),lt(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${o.map(l=>wv(l.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(o,l)=>{if(n)return a(o,l);let u=!1;const f=[];for(const m of t.options){const h=m._zod.run({value:o.value,issues:[]},l);if(h instanceof Promise)f.push(h),u=!0;else{if(h.issues.length===0)return h;f.push(h)}}return u?Promise.all(f).then(m=>Jw(m,o,e,l)):Jw(f,o,e,l)}}),xI=oe("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ok.init(e,t);const n=e._zod.parse;lt(e._zod,"propValues",()=>{const o={};for(const l of t.options){const u=l._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(l)}"`);for(const[f,m]of Object.entries(u)){o[f]||(o[f]=new Set);for(const h of m)o[f].add(h)}}return o});const a=Ef(()=>{const o=t.options,l=new Map;for(const u of o){const f=u._zod.propValues?.[t.discriminator];if(!f||f.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const m of f){if(l.has(m))throw new Error(`Duplicate discriminator value "${String(m)}"`);l.set(m,u)}}return l});e._zod.parse=(o,l)=>{const u=o.value;if(!dc(u))return o.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),o;const f=a.value.get(u?.[t.discriminator]);return f?f._zod.run(o,l):t.unionFallback?n(o,l):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:u,path:[t.discriminator],inst:e}),o)}}),bI=oe("$ZodIntersection",(e,t)=>{Dt.init(e,t),e._zod.parse=(n,a)=>{const o=n.value,l=t.left._zod.run({value:o,issues:[]},a),u=t.right._zod.run({value:o,issues:[]},a);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([m,h])=>Qw(n,m,h)):Qw(n,l,u)}});function yg(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Io(e)&&Io(t)){const n=Object.keys(t),a=Object.keys(e).filter(l=>n.indexOf(l)!==-1),o={...e,...t};for(const l of a){const u=yg(e[l],t[l]);if(!u.valid)return{valid:!1,mergeErrorPath:[l,...u.mergeErrorPath]};o[l]=u.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const o=e[a],l=t[a],u=yg(o,l);if(!u.valid)return{valid:!1,mergeErrorPath:[a,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Qw(e,t,n){const a=new Map;let o;for(const f of t.issues)if(f.code==="unrecognized_keys"){o??(o=f);for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(f);const l=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(l.length&&o&&e.issues.push({...o,keys:l}),bo(e))return e;const u=yg(t.value,n.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const wI=oe("$ZodRecord",(e,t)=>{Dt.init(e,t),e._zod.parse=(n,a)=>{const o=n.value;if(!Io(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const l=[],u=t.keyType._zod.values;if(u){n.value={};const f=new Set;for(const h of u)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){f.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:o[h],issues:[]},a);p instanceof Promise?l.push(p.then(y=>{y.issues.length&&n.issues.push(...wo(h,y.issues)),n.value[h]=y.value})):(p.issues.length&&n.issues.push(...wo(h,p.issues)),n.value[h]=p.value)}let m;for(const h in o)f.has(h)||(m=m??[],m.push(h));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:m})}else{n.value={};for(const f of Reflect.ownKeys(o)){if(f==="__proto__")continue;let m=t.keyType._zod.run({value:f,issues:[]},a);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&QN.test(f)&&m.issues.length){const y=t.keyType._zod.run({value:Number(f),issues:[]},a);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");y.issues.length===0&&(m=y)}if(m.issues.length){t.mode==="loose"?n.value[f]=o[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(y=>br(y,a,xr())),input:f,path:[f],inst:e});continue}const p=t.valueType._zod.run({value:o[f],issues:[]},a);p instanceof Promise?l.push(p.then(y=>{y.issues.length&&n.issues.push(...wo(f,y.issues)),n.value[m.value]=y.value})):(p.issues.length&&n.issues.push(...wo(f,p.issues)),n.value[m.value]=p.value)}}return l.length?Promise.all(l).then(()=>n):n}}),jI=oe("$ZodEnum",(e,t)=>{Dt.init(e,t);const n=FN(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(o=>__.has(typeof o)).map(o=>typeof o=="string"?Do(o):o.toString()).join("|")})$`),e._zod.parse=(o,l)=>{const u=o.value;return a.has(u)||o.issues.push({code:"invalid_value",values:n,input:u,inst:e}),o}}),SI=oe("$ZodLiteral",(e,t)=>{if(Dt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?Do(a):a?Do(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,o)=>{const l=a.value;return n.has(l)||a.issues.push({code:"invalid_value",values:t.values,input:l,inst:e}),a}}),NI=oe("$ZodTransform",(e,t)=>{Dt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new VN(e.constructor.name);const o=t.transform(n.value,n);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(n.value=u,n));if(o instanceof Promise)throw new To;return n.value=o,n}});function e1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const lk=oe("$ZodOptional",(e,t)=>{Dt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",lt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),lt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${wv(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(l=>e1(l,n.value)):e1(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),kI=oe("$ZodExactOptional",(e,t)=>{lk.init(e,t),lt(e._zod,"values",()=>t.innerType._zod.values),lt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),EI=oe("$ZodNullable",(e,t)=>{Dt.init(e,t),lt(e._zod,"optin",()=>t.innerType._zod.optin),lt(e._zod,"optout",()=>t.innerType._zod.optout),lt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${wv(n.source)}|null)$`):void 0}),lt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),CI=oe("$ZodDefault",(e,t)=>{Dt.init(e,t),e._zod.optin="optional",lt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(l=>t1(l,t)):t1(o,t)}});function t1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const TI=oe("$ZodPrefault",(e,t)=>{Dt.init(e,t),e._zod.optin="optional",lt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(a.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),AI=oe("$ZodNonOptional",(e,t)=>{Dt.init(e,t),lt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(l=>n1(l,e)):n1(o,e)}});function n1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const MI=oe("$ZodCatch",(e,t)=>{Dt.init(e,t),lt(e._zod,"optin",()=>t.innerType._zod.optin),lt(e._zod,"optout",()=>t.innerType._zod.optout),lt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(l=>(n.value=l.value,l.issues.length&&(n.value=t.catchValue({...n,error:{issues:l.issues.map(u=>br(u,a,xr()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(l=>br(l,a,xr()))},input:n.value}),n.issues=[]),n)}}),RI=oe("$ZodPipe",(e,t)=>{Dt.init(e,t),lt(e._zod,"values",()=>t.in._zod.values),lt(e._zod,"optin",()=>t.in._zod.optin),lt(e._zod,"optout",()=>t.out._zod.optout),lt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const l=t.out._zod.run(n,a);return l instanceof Promise?l.then(u=>Xu(u,t.in,a)):Xu(l,t.in,a)}const o=t.in._zod.run(n,a);return o instanceof Promise?o.then(l=>Xu(l,t.out,a)):Xu(o,t.out,a)}});function Xu(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const _I=oe("$ZodReadonly",(e,t)=>{Dt.init(e,t),lt(e._zod,"propValues",()=>t.innerType._zod.propValues),lt(e._zod,"values",()=>t.innerType._zod.values),lt(e._zod,"optin",()=>t.innerType?._zod?.optin),lt(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(s1):s1(o)}});function s1(e){return e.value=Object.freeze(e.value),e}const OI=oe("$ZodLazy",(e,t)=>{Dt.init(e,t),lt(e._zod,"innerType",()=>t.getter()),lt(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),lt(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),lt(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),lt(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,a)=>e._zod.innerType._zod.run(n,a)}),II=oe("$ZodCustom",(e,t)=>{Qn.init(e,t),Dt.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,o=t.fn(a);if(o instanceof Promise)return o.then(l=>a1(l,n,a,e));a1(o,n,a,e)}});function a1(e,t,n,a){if(!e){const o={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(o.params=a._zod.def.params),t.issues.push(fc(o))}}var r1;class DI{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const a=n[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};delete a.id;const o={...a,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function zI(){return new DI}(r1=globalThis).__zod_globalRegistry??(r1.__zod_globalRegistry=zI());const Zl=globalThis.__zod_globalRegistry;function PI(e,t){return new e({type:"string",..._e(t)})}function LI(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._e(t)})}function i1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._e(t)})}function $I(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._e(t)})}function UI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._e(t)})}function BI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._e(t)})}function VI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._e(t)})}function HI(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._e(t)})}function FI(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._e(t)})}function ZI(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._e(t)})}function qI(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._e(t)})}function WI(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._e(t)})}function YI(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._e(t)})}function GI(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._e(t)})}function KI(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._e(t)})}function XI(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._e(t)})}function JI(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._e(t)})}function QI(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._e(t)})}function e5(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._e(t)})}function t5(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._e(t)})}function n5(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._e(t)})}function s5(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._e(t)})}function a5(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._e(t)})}function r5(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._e(t)})}function i5(e,t){return new e({type:"string",format:"date",check:"string_format",..._e(t)})}function o5(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._e(t)})}function l5(e,t){return new e({type:"string",format:"duration",check:"string_format",..._e(t)})}function c5(e,t){return new e({type:"number",checks:[],..._e(t)})}function u5(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._e(t)})}function d5(e,t){return new e({type:"boolean",..._e(t)})}function f5(e,t){return new e({type:"null",..._e(t)})}function h5(e){return new e({type:"unknown"})}function m5(e,t){return new e({type:"never",..._e(t)})}function o1(e,t){return new tk({check:"less_than",..._e(t),value:e,inclusive:!1})}function fp(e,t){return new tk({check:"less_than",..._e(t),value:e,inclusive:!0})}function l1(e,t){return new nk({check:"greater_than",..._e(t),value:e,inclusive:!1})}function hp(e,t){return new nk({check:"greater_than",..._e(t),value:e,inclusive:!0})}function c1(e,t){return new EO({check:"multiple_of",..._e(t),value:e})}function ck(e,t){return new TO({check:"max_length",..._e(t),maximum:e})}function Zd(e,t){return new AO({check:"min_length",..._e(t),minimum:e})}function uk(e,t){return new MO({check:"length_equals",..._e(t),length:e})}function p5(e,t){return new RO({check:"string_format",format:"regex",..._e(t),pattern:e})}function g5(e){return new _O({check:"string_format",format:"lowercase",..._e(e)})}function v5(e){return new OO({check:"string_format",format:"uppercase",..._e(e)})}function y5(e,t){return new IO({check:"string_format",format:"includes",..._e(t),includes:e})}function x5(e,t){return new DO({check:"string_format",format:"starts_with",..._e(t),prefix:e})}function b5(e,t){return new zO({check:"string_format",format:"ends_with",..._e(t),suffix:e})}function Uo(e){return new PO({check:"overwrite",tx:e})}function w5(e){return Uo(t=>t.normalize(e))}function j5(){return Uo(e=>e.trim())}function S5(){return Uo(e=>e.toLowerCase())}function N5(){return Uo(e=>e.toUpperCase())}function k5(){return Uo(e=>M_(e))}function E5(e,t,n){return new e({type:"array",element:t,..._e(n)})}function C5(e,t,n){const a=_e(n);return a.abort??(a.abort=!0),new e({type:"custom",check:"custom",fn:t,...a})}function T5(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._e(n)})}function A5(e){const t=M5(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(fc(a,n.value,t._zod.def));else{const o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(fc(o))}},e(n.value,n)));return t}function M5(e,t){const n=new Qn({check:"custom",..._e(t)});return n._zod.check=e,n}function qd(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Zl,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Tt(e,t,n={path:[],schemaPath:[]}){var a;const o=e._zod.def,l=t.seen.get(e);if(l)return l.count++,n.schemaPath.includes(e)&&(l.cycle=n.path),l.schema;const u={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,u);const f=e._zod.toJSONSchema?.();if(f)u.schema=f;else{const p={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,p);else{const b=u.schema,w=t.processors[o.type];if(!w)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);w(e,t,b,p)}const y=e._zod.parent;y&&(u.ref||(u.ref=y),Tt(y,t,p),t.seen.get(y).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(u.schema,m),t.io==="input"&&Dn(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((a=u.schema).default??(a.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function Wd(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const u of e.seen.entries()){const f=e.metadataRegistry.get(u[0])?.id;if(f){const m=a.get(f);if(m&&m!==u[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(f,u[0])}}const o=u=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=e.external.registry.get(u[0])?.id,b=e.external.uri??(j=>j);if(y)return{ref:b(y)};const w=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=w,{defId:w,ref:`${b("__shared")}#/${f}/${w}`}}if(u[1]===n)return{ref:"#"};const h=`#/${f}/`,p=u[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:h+p}},l=u=>{if(u[1].schema.$ref)return;const f=u[1],{ref:m,defId:h}=o(u);f.def={...f.schema},h&&(f.defId=h);const p=f.schema;for(const y in p)delete p[y];p.$ref=m};if(e.cycles==="throw")for(const u of e.seen.entries()){const f=u[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
48
-
49
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const f=u[1];if(t===u[0]){l(u);continue}if(e.external){const h=e.external.registry.get(u[0])?.id;if(t!==u[0]&&h){l(u);continue}}if(e.metadataRegistry.get(u[0])?.id){l(u);continue}if(f.cycle){l(u);continue}if(f.count>1&&e.reused==="ref"){l(u);continue}}}function Yd(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=u=>{const f=e.seen.get(u);if(f.ref===null)return;const m=f.def??f.schema,h={...m},p=f.ref;if(f.ref=null,p){a(p);const b=e.seen.get(p),w=b.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(w)):Object.assign(m,w),Object.assign(m,h),u._zod.parent===p)for(const N in m)N==="$ref"||N==="allOf"||N in h||delete m[N];if(w.$ref&&b.def)for(const N in m)N==="$ref"||N==="allOf"||N in b.def&&JSON.stringify(m[N])===JSON.stringify(b.def[N])&&delete m[N]}const y=u._zod.parent;if(y&&y!==p){a(y);const b=e.seen.get(y);if(b?.schema.$ref&&(m.$ref=b.schema.$ref,b.def))for(const w in m)w==="$ref"||w==="allOf"||w in b.def&&JSON.stringify(m[w])===JSON.stringify(b.def[w])&&delete m[w]}e.override({zodSchema:u,jsonSchema:m,path:f.path??[]})};for(const u of[...e.seen.entries()].reverse())a(u[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}Object.assign(o,n.def??n.schema);const l=e.external?.defs??{};for(const u of e.seen.entries()){const f=u[1];f.def&&f.defId&&(l[f.defId]=f.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?o.$defs=l:o.definitions=l);try{const u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Gd(t,"input",e.processors),output:Gd(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Dn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return Dn(a.element,n);if(a.type==="set")return Dn(a.valueType,n);if(a.type==="lazy")return Dn(a.getter(),n);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return Dn(a.innerType,n);if(a.type==="intersection")return Dn(a.left,n)||Dn(a.right,n);if(a.type==="record"||a.type==="map")return Dn(a.keyType,n)||Dn(a.valueType,n);if(a.type==="pipe")return Dn(a.in,n)||Dn(a.out,n);if(a.type==="object"){for(const o in a.shape)if(Dn(a.shape[o],n))return!0;return!1}if(a.type==="union"){for(const o of a.options)if(Dn(o,n))return!0;return!1}if(a.type==="tuple"){for(const o of a.items)if(Dn(o,n))return!0;return!!(a.rest&&Dn(a.rest,n))}return!1}const R5=(e,t={})=>n=>{const a=qd({...n,processors:t});return Tt(e,a),Wd(a,e),Yd(a,e)},Gd=(e,t,n={})=>a=>{const{libraryOptions:o,target:l}=a??{},u=qd({...o??{},target:l,io:t,processors:n});return Tt(e,u),Wd(u,e),Yd(u,e)},_5={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dk=(e,t,n,a)=>{const o=n;o.type="string";const{minimum:l,maximum:u,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof l=="number"&&(o.minLength=l),typeof u=="number"&&(o.maxLength=u),f&&(o.format=_5[f]??f,o.format===""&&delete o.format,f==="time"&&delete o.format),h&&(o.contentEncoding=h),m&&m.size>0){const p=[...m];p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(y=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))])}},fk=(e,t,n,a)=>{const o=n,{minimum:l,maximum:u,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof f=="string"&&f.includes("int")?o.type="integer":o.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=p,o.exclusiveMinimum=!0):o.exclusiveMinimum=p),typeof l=="number"&&(o.minimum=l,typeof p=="number"&&t.target!=="draft-04"&&(p>=l?delete o.minimum:delete o.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=h,o.exclusiveMaximum=!0):o.exclusiveMaximum=h),typeof u=="number"&&(o.maximum=u,typeof h=="number"&&t.target!=="draft-04"&&(h<=u?delete o.maximum:delete o.exclusiveMaximum)),typeof m=="number"&&(o.multipleOf=m)},hk=(e,t,n,a)=>{n.type="boolean"},O5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},I5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},mk=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},D5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},z5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},pk=(e,t,n,a)=>{n.not={}},P5=(e,t,n,a)=>{},gk=(e,t,n,a)=>{},L5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},vk=(e,t,n,a)=>{const o=e._zod.def,l=FN(o.entries);l.every(u=>typeof u=="number")&&(n.type="number"),l.every(u=>typeof u=="string")&&(n.type="string"),n.enum=l},yk=(e,t,n,a)=>{const o=e._zod.def,l=[];for(const u of o.values)if(u===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof u=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");l.push(Number(u))}else l.push(u);if(l.length!==0)if(l.length===1){const u=l[0];n.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[u]:n.const=u}else l.every(u=>typeof u=="number")&&(n.type="number"),l.every(u=>typeof u=="string")&&(n.type="string"),l.every(u=>typeof u=="boolean")&&(n.type="boolean"),l.every(u=>u===null)&&(n.type="null"),n.enum=l},$5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},U5=(e,t,n,a)=>{const o=n,l=e._zod.pattern;if(!l)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=l.source},B5=(e,t,n,a)=>{const o=n,l={type:"string",format:"binary",contentEncoding:"binary"},{minimum:u,maximum:f,mime:m}=e._zod.bag;u!==void 0&&(l.minLength=u),f!==void 0&&(l.maxLength=f),m?m.length===1?(l.contentMediaType=m[0],Object.assign(o,l)):(Object.assign(o,l),o.anyOf=m.map(h=>({contentMediaType:h}))):Object.assign(o,l)},V5=(e,t,n,a)=>{n.type="boolean"},xk=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},H5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},bk=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},F5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Z5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},wk=(e,t,n,a)=>{const o=n,l=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof f=="number"&&(o.maxItems=f),o.type="array",o.items=Tt(l.element,t,{...a,path:[...a.path,"items"]})},jk=(e,t,n,a)=>{const o=n,l=e._zod.def;o.type="object",o.properties={};const u=l.shape;for(const h in u)o.properties[h]=Tt(u[h],t,{...a,path:[...a.path,"properties",h]});const f=new Set(Object.keys(u)),m=new Set([...f].filter(h=>{const p=l.shape[h]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));m.size>0&&(o.required=Array.from(m)),l.catchall?._zod.def.type==="never"?o.additionalProperties=!1:l.catchall?l.catchall&&(o.additionalProperties=Tt(l.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Sk=(e,t,n,a)=>{const o=e._zod.def,l=o.inclusive===!1,u=o.options.map((f,m)=>Tt(f,t,{...a,path:[...a.path,l?"oneOf":"anyOf",m]}));l?n.oneOf=u:n.anyOf=u},Nk=(e,t,n,a)=>{const o=e._zod.def,l=Tt(o.left,t,{...a,path:[...a.path,"allOf",0]}),u=Tt(o.right,t,{...a,path:[...a.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(l)?l.allOf:[l],...f(u)?u.allOf:[u]];n.allOf=m},q5=(e,t,n,a)=>{const o=n,l=e._zod.def;o.type="array";const u=t.target==="draft-2020-12"?"prefixItems":"items",f=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",m=l.items.map((b,w)=>Tt(b,t,{...a,path:[...a.path,u,w]})),h=l.rest?Tt(l.rest,t,{...a,path:[...a.path,f,...t.target==="openapi-3.0"?[l.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=m,h&&(o.items=h)):t.target==="openapi-3.0"?(o.items={anyOf:m},h&&o.items.anyOf.push(h),o.minItems=m.length,h||(o.maxItems=m.length)):(o.items=m,h&&(o.additionalItems=h));const{minimum:p,maximum:y}=e._zod.bag;typeof p=="number"&&(o.minItems=p),typeof y=="number"&&(o.maxItems=y)},kk=(e,t,n,a)=>{const o=n,l=e._zod.def;o.type="object";const u=l.keyType,m=u._zod.bag?.patterns;if(l.mode==="loose"&&m&&m.size>0){const p=Tt(l.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});o.patternProperties={};for(const y of m)o.patternProperties[y.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Tt(l.keyType,t,{...a,path:[...a.path,"propertyNames"]})),o.additionalProperties=Tt(l.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const h=u._zod.values;if(h){const p=[...h].filter(y=>typeof y=="string"||typeof y=="number");p.length>0&&(o.required=p)}},Ek=(e,t,n,a)=>{const o=e._zod.def,l=Tt(o.innerType,t,a),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,n.nullable=!0):n.anyOf=[l,{type:"null"}]},Ck=(e,t,n,a)=>{const o=e._zod.def;Tt(o.innerType,t,a);const l=t.seen.get(e);l.ref=o.innerType},Tk=(e,t,n,a)=>{const o=e._zod.def;Tt(o.innerType,t,a);const l=t.seen.get(e);l.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Ak=(e,t,n,a)=>{const o=e._zod.def;Tt(o.innerType,t,a);const l=t.seen.get(e);l.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Mk=(e,t,n,a)=>{const o=e._zod.def;Tt(o.innerType,t,a);const l=t.seen.get(e);l.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=u},Rk=(e,t,n,a)=>{const o=e._zod.def,l=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Tt(l,t,a);const u=t.seen.get(e);u.ref=l},_k=(e,t,n,a)=>{const o=e._zod.def;Tt(o.innerType,t,a);const l=t.seen.get(e);l.ref=o.innerType,n.readOnly=!0},W5=(e,t,n,a)=>{const o=e._zod.def;Tt(o.innerType,t,a);const l=t.seen.get(e);l.ref=o.innerType},Ev=(e,t,n,a)=>{const o=e._zod.def;Tt(o.innerType,t,a);const l=t.seen.get(e);l.ref=o.innerType},Ok=(e,t,n,a)=>{const o=e._zod.innerType;Tt(o,t,a);const l=t.seen.get(e);l.ref=o},u1={string:dk,number:fk,boolean:hk,bigint:O5,symbol:I5,null:mk,undefined:D5,void:z5,never:pk,any:P5,unknown:gk,date:L5,enum:vk,literal:yk,nan:$5,template_literal:U5,file:B5,success:V5,custom:xk,function:H5,transform:bk,map:F5,set:Z5,array:wk,object:jk,union:Sk,intersection:Nk,tuple:q5,record:kk,nullable:Ek,nonoptional:Ck,default:Tk,prefault:Ak,catch:Mk,pipe:Rk,readonly:_k,promise:W5,optional:Ev,lazy:Ok};function Y5(e,t){if("_idmap"in e){const a=e,o=qd({...t,processors:u1}),l={};for(const m of a._idmap.entries()){const[h,p]=m;Tt(p,o)}const u={},f={registry:a,uri:t?.uri,defs:l};o.external=f;for(const m of a._idmap.entries()){const[h,p]=m;Wd(o,p),u[h]=Yd(o,p)}if(Object.keys(l).length>0){const m=o.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[m]:l}}return{schemas:u}}const n=qd({...t,processors:u1});return Tt(e,n),Wd(n,e),Yd(n,e)}const G5=oe("ZodISODateTime",(e,t)=>{XO.init(e,t),Ht.init(e,t)});function K5(e){return r5(G5,e)}const X5=oe("ZodISODate",(e,t)=>{JO.init(e,t),Ht.init(e,t)});function J5(e){return i5(X5,e)}const Q5=oe("ZodISOTime",(e,t)=>{QO.init(e,t),Ht.init(e,t)});function eD(e){return o5(Q5,e)}const tD=oe("ZodISODuration",(e,t)=>{eI.init(e,t),Ht.init(e,t)});function nD(e){return l5(tD,e)}const sD=(e,t)=>{YN.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>H_(e,n)},flatten:{value:n=>V_(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,vg,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,vg,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ts=oe("ZodError",sD,{Parent:Error}),aD=Sv(Ts),rD=Nv(Ts),iD=Cf(Ts),Ik=Tf(Ts),oD=q_(Ts),lD=W_(Ts),cD=Y_(Ts),uD=G_(Ts),dD=K_(Ts),fD=X_(Ts),hD=J_(Ts),mD=Q_(Ts),zt=oe("ZodType",(e,t)=>(Dt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Gd(e,"input"),output:Gd(e,"output")}}),e.toJSONSchema=R5(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Sr(t,{checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(n,a)=>Nr(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>aD(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>iD(e,n,a),e.parseAsync=async(n,a)=>rD(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>Ik(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>oD(e,n,a),e.decode=(n,a)=>lD(e,n,a),e.encodeAsync=async(n,a)=>cD(e,n,a),e.decodeAsync=async(n,a)=>uD(e,n,a),e.safeEncode=(n,a)=>dD(e,n,a),e.safeDecode=(n,a)=>fD(e,n,a),e.safeEncodeAsync=async(n,a)=>hD(e,n,a),e.safeDecodeAsync=async(n,a)=>mD(e,n,a),e.refine=(n,a)=>e.check(uz(n,a)),e.superRefine=n=>e.check(dz(n)),e.overwrite=n=>e.check(Uo(n)),e.optional=()=>h1(e),e.exactOptional=()=>KD(e),e.nullable=()=>m1(e),e.nullish=()=>h1(m1(e)),e.nonoptional=n=>nz(e,n),e.array=()=>Bo(e),e.or=n=>$n([e,n]),e.and=n=>FD(e,n),e.transform=n=>p1(e,YD(n)),e.default=n=>QD(e,n),e.prefault=n=>tz(e,n),e.catch=n=>az(e,n),e.pipe=n=>p1(e,n),e.readonly=()=>oz(e),e.describe=n=>{const a=e.clone();return Zl.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){return Zl.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Zl.get(e);const a=e.clone();return Zl.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Dk=oe("_ZodString",(e,t)=>{kv.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(a,o,l)=>dk(e,a,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(p5(...a)),e.includes=(...a)=>e.check(y5(...a)),e.startsWith=(...a)=>e.check(x5(...a)),e.endsWith=(...a)=>e.check(b5(...a)),e.min=(...a)=>e.check(Zd(...a)),e.max=(...a)=>e.check(ck(...a)),e.length=(...a)=>e.check(uk(...a)),e.nonempty=(...a)=>e.check(Zd(1,...a)),e.lowercase=a=>e.check(g5(a)),e.uppercase=a=>e.check(v5(a)),e.trim=()=>e.check(j5()),e.normalize=(...a)=>e.check(w5(...a)),e.toLowerCase=()=>e.check(S5()),e.toUpperCase=()=>e.check(N5()),e.slugify=()=>e.check(k5())}),pD=oe("ZodString",(e,t)=>{kv.init(e,t),Dk.init(e,t),e.email=n=>e.check(LI(gD,n)),e.url=n=>e.check(HI(vD,n)),e.jwt=n=>e.check(a5(_D,n)),e.emoji=n=>e.check(FI(yD,n)),e.guid=n=>e.check(i1(d1,n)),e.uuid=n=>e.check($I(Ju,n)),e.uuidv4=n=>e.check(UI(Ju,n)),e.uuidv6=n=>e.check(BI(Ju,n)),e.uuidv7=n=>e.check(VI(Ju,n)),e.nanoid=n=>e.check(ZI(xD,n)),e.guid=n=>e.check(i1(d1,n)),e.cuid=n=>e.check(qI(bD,n)),e.cuid2=n=>e.check(WI(wD,n)),e.ulid=n=>e.check(YI(jD,n)),e.base64=n=>e.check(t5(AD,n)),e.base64url=n=>e.check(n5(MD,n)),e.xid=n=>e.check(GI(SD,n)),e.ksuid=n=>e.check(KI(ND,n)),e.ipv4=n=>e.check(XI(kD,n)),e.ipv6=n=>e.check(JI(ED,n)),e.cidrv4=n=>e.check(QI(CD,n)),e.cidrv6=n=>e.check(e5(TD,n)),e.e164=n=>e.check(s5(RD,n)),e.datetime=n=>e.check(K5(n)),e.date=n=>e.check(J5(n)),e.time=n=>e.check(eD(n)),e.duration=n=>e.check(nD(n))});function Se(e){return PI(pD,e)}const Ht=oe("ZodStringFormat",(e,t)=>{Ut.init(e,t),Dk.init(e,t)}),gD=oe("ZodEmail",(e,t)=>{VO.init(e,t),Ht.init(e,t)}),d1=oe("ZodGUID",(e,t)=>{UO.init(e,t),Ht.init(e,t)}),Ju=oe("ZodUUID",(e,t)=>{BO.init(e,t),Ht.init(e,t)}),vD=oe("ZodURL",(e,t)=>{HO.init(e,t),Ht.init(e,t)}),yD=oe("ZodEmoji",(e,t)=>{FO.init(e,t),Ht.init(e,t)}),xD=oe("ZodNanoID",(e,t)=>{ZO.init(e,t),Ht.init(e,t)}),bD=oe("ZodCUID",(e,t)=>{qO.init(e,t),Ht.init(e,t)}),wD=oe("ZodCUID2",(e,t)=>{WO.init(e,t),Ht.init(e,t)}),jD=oe("ZodULID",(e,t)=>{YO.init(e,t),Ht.init(e,t)}),SD=oe("ZodXID",(e,t)=>{GO.init(e,t),Ht.init(e,t)}),ND=oe("ZodKSUID",(e,t)=>{KO.init(e,t),Ht.init(e,t)}),kD=oe("ZodIPv4",(e,t)=>{tI.init(e,t),Ht.init(e,t)}),ED=oe("ZodIPv6",(e,t)=>{nI.init(e,t),Ht.init(e,t)}),CD=oe("ZodCIDRv4",(e,t)=>{sI.init(e,t),Ht.init(e,t)}),TD=oe("ZodCIDRv6",(e,t)=>{aI.init(e,t),Ht.init(e,t)}),AD=oe("ZodBase64",(e,t)=>{rI.init(e,t),Ht.init(e,t)}),MD=oe("ZodBase64URL",(e,t)=>{oI.init(e,t),Ht.init(e,t)}),RD=oe("ZodE164",(e,t)=>{lI.init(e,t),Ht.init(e,t)}),_D=oe("ZodJWT",(e,t)=>{uI.init(e,t),Ht.init(e,t)}),zk=oe("ZodNumber",(e,t)=>{ak.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(a,o,l)=>fk(e,a,o),e.gt=(a,o)=>e.check(l1(a,o)),e.gte=(a,o)=>e.check(hp(a,o)),e.min=(a,o)=>e.check(hp(a,o)),e.lt=(a,o)=>e.check(o1(a,o)),e.lte=(a,o)=>e.check(fp(a,o)),e.max=(a,o)=>e.check(fp(a,o)),e.int=a=>e.check(f1(a)),e.safe=a=>e.check(f1(a)),e.positive=a=>e.check(l1(0,a)),e.nonnegative=a=>e.check(hp(0,a)),e.negative=a=>e.check(o1(0,a)),e.nonpositive=a=>e.check(fp(0,a)),e.multipleOf=(a,o)=>e.check(c1(a,o)),e.step=(a,o)=>e.check(c1(a,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function OD(e){return c5(zk,e)}const ID=oe("ZodNumberFormat",(e,t)=>{dI.init(e,t),zk.init(e,t)});function f1(e){return u5(ID,e)}const DD=oe("ZodBoolean",(e,t)=>{fI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>hk(e,n,a)});function zn(e){return d5(DD,e)}const zD=oe("ZodNull",(e,t)=>{hI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>mk(e,n,a)});function PD(e){return f5(zD,e)}const LD=oe("ZodUnknown",(e,t)=>{mI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>gk()});function Ks(){return h5(LD)}const $D=oe("ZodNever",(e,t)=>{pI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>pk(e,n,a)});function Pk(e){return m5($D,e)}const UD=oe("ZodArray",(e,t)=>{gI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>wk(e,n,a,o),e.element=t.element,e.min=(n,a)=>e.check(Zd(n,a)),e.nonempty=n=>e.check(Zd(1,n)),e.max=(n,a)=>e.check(ck(n,a)),e.length=(n,a)=>e.check(uk(n,a)),e.unwrap=()=>e.element});function Bo(e,t){return E5(UD,e,t)}const Lk=oe("ZodObject",(e,t)=>{yI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>jk(e,n,a,o),lt(e,"shape",()=>t.shape),e.keyof=()=>Uk(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ks()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ks()}),e.strict=()=>e.clone({...e._zod.def,catchall:Pk()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>P_(e,n),e.safeExtend=n=>L_(e,n),e.merge=n=>$_(e,n),e.pick=n=>D_(e,n),e.omit=n=>z_(e,n),e.partial=(...n)=>U_(Bk,e,n[0]),e.required=(...n)=>B_(Vk,e,n[0])});function kt(e,t){const n={type:"object",shape:e??{},..._e(t)};return new Lk(n)}function Rt(e,t){return new Lk({type:"object",shape:e,catchall:Pk(),..._e(t)})}const $k=oe("ZodUnion",(e,t)=>{ok.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Sk(e,n,a,o),e.options=t.options});function $n(e,t){return new $k({type:"union",options:e,..._e(t)})}const BD=oe("ZodDiscriminatedUnion",(e,t)=>{$k.init(e,t),xI.init(e,t)});function VD(e,t,n){return new BD({type:"union",options:t,discriminator:e,..._e(n)})}const HD=oe("ZodIntersection",(e,t)=>{bI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Nk(e,n,a,o)});function FD(e,t){return new HD({type:"intersection",left:e,right:t})}const ZD=oe("ZodRecord",(e,t)=>{wI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>kk(e,n,a,o),e.keyType=t.keyType,e.valueType=t.valueType});function hc(e,t,n){return new ZD({type:"record",keyType:e,valueType:t,..._e(n)})}const xg=oe("ZodEnum",(e,t)=>{jI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(a,o,l)=>vk(e,a,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,o)=>{const l={};for(const u of a)if(n.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new xg({...t,checks:[],..._e(o),entries:l})},e.exclude=(a,o)=>{const l={...t.entries};for(const u of a)if(n.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new xg({...t,checks:[],..._e(o),entries:l})}});function Uk(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new xg({type:"enum",entries:n,..._e(t)})}const qD=oe("ZodLiteral",(e,t)=>{SI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>yk(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ue(e,t){return new qD({type:"literal",values:Array.isArray(e)?e:[e],..._e(t)})}const WD=oe("ZodTransform",(e,t)=>{NI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>bk(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new VN(e.constructor.name);n.addIssue=l=>{if(typeof l=="string")n.issues.push(fc(l,n.value,t));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),n.issues.push(fc(u))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(l=>(n.value=l,n)):(n.value=o,n)}});function YD(e){return new WD({type:"transform",transform:e})}const Bk=oe("ZodOptional",(e,t)=>{lk.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Ev(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function h1(e){return new Bk({type:"optional",innerType:e})}const GD=oe("ZodExactOptional",(e,t)=>{kI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Ev(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function KD(e){return new GD({type:"optional",innerType:e})}const XD=oe("ZodNullable",(e,t)=>{EI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Ek(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function m1(e){return new XD({type:"nullable",innerType:e})}const JD=oe("ZodDefault",(e,t)=>{CI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Tk(e,n,a,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function QD(e,t){return new JD({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():qN(t)}})}const ez=oe("ZodPrefault",(e,t)=>{TI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Ak(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function tz(e,t){return new ez({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():qN(t)}})}const Vk=oe("ZodNonOptional",(e,t)=>{AI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Ck(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function nz(e,t){return new Vk({type:"nonoptional",innerType:e,..._e(t)})}const sz=oe("ZodCatch",(e,t)=>{MI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Mk(e,n,a,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function az(e,t){return new sz({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const rz=oe("ZodPipe",(e,t)=>{RI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Rk(e,n,a,o),e.in=t.in,e.out=t.out});function p1(e,t){return new rz({type:"pipe",in:e,out:t})}const iz=oe("ZodReadonly",(e,t)=>{_I.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>_k(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function oz(e){return new iz({type:"readonly",innerType:e})}const lz=oe("ZodLazy",(e,t)=>{OI.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Ok(e,n,a,o),e.unwrap=()=>e._zod.def.getter()});function cz(e){return new lz({type:"lazy",getter:e})}const Cv=oe("ZodCustom",(e,t)=>{II.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>xk(e,n)});function Hk(e,t){return C5(Cv,e??(()=>!0),t)}function uz(e,t={}){return T5(Cv,e,t)}function dz(e){return A5(e)}function Kd(e,t={}){const n=new Cv({type:"custom",check:"custom",fn:a=>a instanceof e,abort:!0,..._e(t)});return n._zod.bag.Class=e,n._zod.check=a=>{a.value instanceof e||a.issues.push({code:"invalid_type",expected:e.name,input:a.value,inst:n,path:[...n._zod.def.path??[]]})},n}var mc;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const l={};for(const u of o)l[u]=u;return l},e.getValidEnumValues=o=>{const l=e.objectKeys(o).filter(f=>typeof o[o[f]]!="number"),u={};for(const f of l)u[f]=o[f];return e.objectValues(u)},e.objectValues=o=>e.objectKeys(o).map(function(l){return o[l]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const l=[];for(const u in o)Object.prototype.hasOwnProperty.call(o,u)&&l.push(u);return l},e.find=(o,l)=>{for(const u of o)if(l(u))return u},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function a(o,l=" | "){return o.map(u=>typeof u=="string"?`'${u}'`:u).join(l)}e.joinValues=a,e.jsonStringifyReplacer=(o,l)=>typeof l=="bigint"?l.toString():l})(mc||(mc={}));var g1;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(g1||(g1={}));mc.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);mc.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 Xd extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};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(l){return l.message},a={_errors:[]},o=l=>{for(const u of l.issues)if(u.code==="invalid_union")u.unionErrors.map(o);else if(u.code==="invalid_return_type")o(u.returnTypeError);else if(u.code==="invalid_arguments")o(u.argumentsError);else if(u.path.length===0)a._errors.push(n(u));else{let f=a,m=0;for(;m<u.path.length;){const h=u.path[m];m===u.path.length-1?(f[h]=f[h]||{_errors:[]},f[h]._errors.push(n(u))):f[h]=f[h]||{_errors:[]},f=f[h],m++}}};return o(this),a}static assert(t){if(!(t instanceof Xd))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,mc.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n=Object.create(null),a=[];for(const o of this.issues)if(o.path.length>0){const l=o.path[0];n[l]=n[l]||[],n[l].push(t(o))}else a.push(t(o));return{formErrors:a,fieldErrors:n}}get formErrors(){return this.flatten()}}Xd.create=e=>new Xd(e);var v1;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(v1||(v1={}));var Ge;(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"})(Ge||(Ge={}));class y1 extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}const x1=10,fz=13,Yr=32;function mp(e){}function hz(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=mp,onError:n=mp,onRetry:a=mp,onComment:o}=e;let l="",u=!0,f,m="",h=0,p;function y(E){if(u){u=!1,b(E);return}const S=l===""?E:l+E;l=w(S)}function b(E){E.charCodeAt(0)===239&&E.charCodeAt(1)===187&&E.charCodeAt(2)===191&&(E=E.slice(3));const S=l===""?E:l+E;l=w(S)}function w(E){let S=0;if(E.indexOf("\r")===-1){let R=E.indexOf(`
50
- `,S);for(;R!==-1;){if(S===R){h>0&&t({id:f,event:p,data:m}),f=void 0,m="",h=0,p=void 0,S=R+1,R=E.indexOf(`
51
- `,S);continue}const A=E.charCodeAt(S);if(b1(E,S,A)){const M=E.charCodeAt(S+5)===Yr?S+6:S+5,D=E.slice(M,R);if(h===0&&E.charCodeAt(R+1)===x1){t({id:f,event:p,data:D}),f=void 0,m="",p=void 0,S=R+2,R=E.indexOf(`
52
- `,S);continue}m=h===0?D:`${m}
53
- ${D}`,h++}else w1(E,S,A)?p=E.slice(E.charCodeAt(S+6)===Yr?S+7:S+6,R)||void 0:j(E,S,R);S=R+1,R=E.indexOf(`
54
- `,S)}return E.slice(S)}for(;S<E.length;){const R=E.indexOf("\r",S),A=E.indexOf(`
55
- `,S);let M=-1;if(R!==-1&&A!==-1?M=R<A?R:A:R!==-1?R===E.length-1?M=-1:M=R:A!==-1&&(M=A),M===-1)break;j(E,S,M),S=M+1,E.charCodeAt(S-1)===fz&&E.charCodeAt(S)===x1&&S++}return E.slice(S)}function j(E,S,R){if(S===R){C();return}const A=E.charCodeAt(S);if(b1(E,S,A)){const _=E.charCodeAt(S+5)===Yr?S+6:S+5,z=E.slice(_,R);m=h===0?z:`${m}
56
- ${z}`,h++;return}if(w1(E,S,A)){p=E.slice(E.charCodeAt(S+6)===Yr?S+7:S+6,R)||void 0;return}if(A===105&&E.charCodeAt(S+1)===100&&E.charCodeAt(S+2)===58){const _=E.slice(E.charCodeAt(S+3)===Yr?S+4:S+3,R);f=_.includes("\0")?void 0:_;return}if(A===58){if(o){const _=E.slice(S,R);o(_.slice(E.charCodeAt(S+1)===Yr?2:1))}return}const M=E.slice(S,R),D=M.indexOf(":");if(D===-1){N(M,"",M);return}const U=M.slice(0,D),F=M.charCodeAt(D+1)===Yr?2:1,P=M.slice(D+F);N(U,P,M)}function N(E,S,R){switch(E){case"event":p=S||void 0;break;case"data":m=h===0?S:`${m}
57
- ${S}`,h++;break;case"id":f=S.includes("\0")?void 0:S;break;case"retry":/^\d+$/.test(S)?a(parseInt(S,10)):n(new y1(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:R}));break;default:n(new y1(`Unknown field "${E.length>20?`${E.slice(0,20)}…`:E}"`,{type:"unknown-field",field:E,value:S,line:R}));break}}function C(){h>0&&t({id:f,event:p,data:m}),f=void 0,m="",h=0,p=void 0}function k(E={}){l&&E.consume&&j(l,0,l.length),u=!0,f=void 0,m="",h=0,p=void 0,l=""}return{feed:y,reset:k}}function b1(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function w1(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class mz extends TransformStream{constructor({onError:t,onRetry:n,onComment:a}={}){let o;super({start(l){o=hz({onEvent:u=>{l.enqueue(u)},onError(u){t==="terminate"?l.error(u):typeof t=="function"&&t(u)},onRetry:n,onComment:a})},transform(l){o.feed(l)}})}}var Cc=({prefix:e,size:t=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:a="-"}={})=>{const o=()=>{const l=n.length,u=new Array(t);for(let f=0;f<t;f++)u[f]=n[Math.random()*l|0];return u.join("")};if(e==null)return o;if(n.includes(a))throw new E_({argument:"separator",message:`The separator "${a}" must not be part of the alphabet "${n}".`});return()=>`${e}${a}${o()}`},pz=Cc();function ao(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((n,a)=>{t[a.toLowerCase()]=n});else{Array.isArray(e)||(e=Object.entries(e));for(const[n,a]of e)a!=null&&(t[n.toLowerCase()]=a)}return t}var gz=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,vz=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function j1(e){const t=JSON.parse(e);return t===null||typeof t!="object"||gz.test(e)===!1&&vz.test(e)===!1?t:yz(t)}function yz(e){let t=[e];for(;t.length;){const n=t;t=[];for(const a of n){if(Object.prototype.hasOwnProperty.call(a,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(a,"constructor")&&a.constructor!==null&&typeof a.constructor=="object"&&Object.prototype.hasOwnProperty.call(a.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const o in a){const l=a[o];l&&typeof l=="object"&&t.push(l)}}}return e}function xz(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return j1(e)}try{return j1(e)}finally{Error.stackTraceLimit=t}}function Tv(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:n}=e;if(n!=null)for(const a of Object.keys(n))n[a]=Gr(n[a])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(Gr):Gr(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(Gr)),e.allOf!=null&&(e.allOf=e.allOf.map(Gr)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(Gr));const{definitions:t}=e;if(t!=null)for(const n of Object.keys(t))t[n]=Gr(t[n]);return e}function Gr(e){return typeof e=="boolean"?e:Tv(e)}var bz=Symbol("Let zodToJsonSchema decide on which parser to use"),S1={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},wz=e=>typeof e=="string"?{...S1,name:e}:{...S1,...e};function cs(){return{}}function jz(e,t){var n,a,o;const l={type:"array"};return(n=e.type)!=null&&n._def&&((o=(a=e.type)==null?void 0:a._def)==null?void 0:o.typeName)!==Ge.ZodAny&&(l.items=yt(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(l.minItems=e.minLength.value),e.maxLength&&(l.maxItems=e.maxLength.value),e.exactLength&&(l.minItems=e.exactLength.value,l.maxItems=e.exactLength.value),l}function Sz(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function Nz(){return{type:"boolean"}}function Fk(e,t){return yt(e.type._def,t)}var kz=(e,t)=>yt(e.innerType._def,t);function Zk(e,t,n){const a=n??t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((o,l)=>Zk(e,t,o))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Ez(e)}}var Ez=e=>{const t={type:"integer",format:"unix-time"};for(const n of e.checks)switch(n.kind){case"min":t.minimum=n.value;break;case"max":t.maximum=n.value;break}return t};function Cz(e,t){return{...yt(e.innerType._def,t),default:e.defaultValue()}}function Tz(e,t){return t.effectStrategy==="input"?yt(e.schema._def,t):cs()}function Az(e){return{type:"string",enum:Array.from(e.values)}}var Mz=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Rz(e,t){const n=[yt(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),yt(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),a=[];return n.forEach(o=>{if(Mz(o))a.push(...o.allOf);else{let l=o;if("additionalProperties"in o&&o.additionalProperties===!1){const{additionalProperties:u,...f}=o;l=f}a.push(l)}}),a.length?{allOf:a}:void 0}function _z(e){const t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var pp=void 0,Is={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(pp===void 0&&(pp=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),pp),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function qk(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,a.value):a.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,a.value):a.value;break;case"email":switch(t.emailStrategy){case"format:email":Ds(n,"email",a.message,t);break;case"format:idn-email":Ds(n,"idn-email",a.message,t);break;case"pattern:zod":In(n,Is.email,a.message,t);break}break;case"url":Ds(n,"uri",a.message,t);break;case"uuid":Ds(n,"uuid",a.message,t);break;case"regex":In(n,a.regex,a.message,t);break;case"cuid":In(n,Is.cuid,a.message,t);break;case"cuid2":In(n,Is.cuid2,a.message,t);break;case"startsWith":In(n,RegExp(`^${gp(a.value,t)}`),a.message,t);break;case"endsWith":In(n,RegExp(`${gp(a.value,t)}$`),a.message,t);break;case"datetime":Ds(n,"date-time",a.message,t);break;case"date":Ds(n,"date",a.message,t);break;case"time":Ds(n,"time",a.message,t);break;case"duration":Ds(n,"duration",a.message,t);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,a.value):a.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,a.value):a.value;break;case"includes":{In(n,RegExp(gp(a.value,t)),a.message,t);break}case"ip":{a.version!=="v6"&&Ds(n,"ipv4",a.message,t),a.version!=="v4"&&Ds(n,"ipv6",a.message,t);break}case"base64url":In(n,Is.base64url,a.message,t);break;case"jwt":In(n,Is.jwt,a.message,t);break;case"cidr":{a.version!=="v6"&&In(n,Is.ipv4Cidr,a.message,t),a.version!=="v4"&&In(n,Is.ipv6Cidr,a.message,t);break}case"emoji":In(n,Is.emoji(),a.message,t);break;case"ulid":{In(n,Is.ulid,a.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Ds(n,"binary",a.message,t);break}case"contentEncoding:base64":{n.contentEncoding="base64";break}case"pattern:zod":{In(n,Is.base64,a.message,t);break}}break}case"nanoid":In(n,Is.nanoid,a.message,t)}return n}function gp(e,t){return t.patternStrategy==="escape"?Iz(e):e}var Oz=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Iz(e){let t="";for(let n=0;n<e.length;n++)Oz.has(e[n])||(t+="\\"),t+=e[n];return t}function Ds(e,t,n,a){var o;e.format||(o=e.anyOf)!=null&&o.some(l=>l.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&a.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function In(e,t,n,a){var o;e.pattern||(o=e.allOf)!=null&&o.some(l=>l.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:N1(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=N1(t,a)}function N1(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=a.i?e.source.toLowerCase():e.source;let l="",u=!1,f=!1,m=!1;for(let h=0;h<o.length;h++){if(u){l+=o[h],u=!1;continue}if(a.i){if(f){if(o[h].match(/[a-z]/)){m?(l+=o[h],l+=`${o[h-2]}-${o[h]}`.toUpperCase(),m=!1):o[h+1]==="-"&&((n=o[h+2])!=null&&n.match(/[a-z]/))?(l+=o[h],m=!0):l+=`${o[h]}${o[h].toUpperCase()}`;continue}}else if(o[h].match(/[a-z]/)){l+=`[${o[h]}${o[h].toUpperCase()}]`;continue}}if(a.m){if(o[h]==="^"){l+=`(^|(?<=[\r
58
- ]))`;continue}else if(o[h]==="$"){l+=`($|(?=[\r
59
- ]))`;continue}}if(a.s&&o[h]==="."){l+=f?`${o[h]}\r
60
- `:`[${o[h]}\r
61
- ]`;continue}l+=o[h],o[h]==="\\"?u=!0:f&&o[h]==="]"?f=!1:!f&&o[h]==="["&&(f=!0)}try{new RegExp(l)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return l}function Wk(e,t){var n,a,o,l,u,f;const m={type:"object",additionalProperties:(n=yt(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((a=e.keyType)==null?void 0:a._def.typeName)===Ge.ZodString&&((o=e.keyType._def.checks)!=null&&o.length)){const{type:h,...p}=qk(e.keyType._def,t);return{...m,propertyNames:p}}else{if(((l=e.keyType)==null?void 0:l._def.typeName)===Ge.ZodEnum)return{...m,propertyNames:{enum:e.keyType._def.values}};if(((u=e.keyType)==null?void 0:u._def.typeName)===Ge.ZodBranded&&e.keyType._def.type._def.typeName===Ge.ZodString&&((f=e.keyType._def.type._def.checks)!=null&&f.length)){const{type:h,...p}=Fk(e.keyType._def,t);return{...m,propertyNames:p}}}return m}function Dz(e,t){if(t.mapStrategy==="record")return Wk(e,t);const n=yt(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||cs(),a=yt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||cs();return{type:"array",maxItems:125,items:{type:"array",items:[n,a],minItems:2,maxItems:2}}}function zz(e){const t=e.values,a=Object.keys(e.values).filter(l=>typeof t[t[l]]!="number").map(l=>t[l]),o=Array.from(new Set(a.map(l=>typeof l)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:a}}function Pz(){return{not:cs()}}function Lz(){return{type:"null"}}var bg={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function $z(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(a=>a._def.typeName in bg&&(!a._def.checks||!a._def.checks.length))){const a=n.reduce((o,l)=>{const u=bg[l._def.typeName];return u&&!o.includes(u)?[...o,u]:o},[]);return{type:a.length>1?a:a[0]}}else if(n.every(a=>a._def.typeName==="ZodLiteral"&&!a.description)){const a=n.reduce((o,l)=>{const u=typeof l._def.value;switch(u){case"string":case"number":case"boolean":return[...o,u];case"bigint":return[...o,"integer"];case"object":if(l._def.value===null)return[...o,"null"];default:return o}},[]);if(a.length===n.length){const o=a.filter((l,u,f)=>f.indexOf(l)===u);return{type:o.length>1?o:o[0],enum:n.reduce((l,u)=>l.includes(u._def.value)?l:[...l,u._def.value],[])}}}else if(n.every(a=>a._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((a,o)=>[...a,...o._def.values.filter(l=>!a.includes(l))],[])};return Uz(e,t)}var Uz=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((a,o)=>yt(a._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(a=>!!a&&(!t.strictUnions||typeof a=="object"&&Object.keys(a).length>0));return n.length?{anyOf:n}:void 0};function Bz(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[bg[e.innerType._def.typeName],"null"]};const n=yt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function Vz(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function Hz(e,t){const n={type:"object",properties:{}},a=[],o=e.shape();for(const u in o){let f=o[u];if(f===void 0||f._def===void 0)continue;const m=Zz(f),h=yt(f._def,{...t,currentPath:[...t.currentPath,"properties",u],propertyPath:[...t.currentPath,"properties",u]});h!==void 0&&(n.properties[u]=h,m||a.push(u))}a.length&&(n.required=a);const l=Fz(e,t);return l!==void 0&&(n.additionalProperties=l),n}function Fz(e,t){if(e.catchall._def.typeName!=="ZodNever")return yt(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Zz(e){try{return e.isOptional()}catch{return!0}}var qz=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return yt(e.innerType._def,t);const a=yt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:cs()},a]}:cs()},Wz=(e,t)=>{if(t.pipeStrategy==="input")return yt(e.in._def,t);if(t.pipeStrategy==="output")return yt(e.out._def,t);const n=yt(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),a=yt(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,a].filter(o=>o!==void 0)}};function Yz(e,t){return yt(e.type._def,t)}function Gz(e,t){const a={type:"array",uniqueItems:!0,items:yt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(a.minItems=e.minSize.value),e.maxSize&&(a.maxItems=e.maxSize.value),a}function Kz(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,a)=>yt(n._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((n,a)=>a===void 0?n:[...n,a],[]),additionalItems:yt(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,a)=>yt(n._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((n,a)=>a===void 0?n:[...n,a],[])}}function Xz(){return{not:cs()}}function Jz(){return cs()}var Qz=(e,t)=>yt(e.innerType._def,t),e4=(e,t,n)=>{switch(t){case Ge.ZodString:return qk(e,n);case Ge.ZodNumber:return Vz(e);case Ge.ZodObject:return Hz(e,n);case Ge.ZodBigInt:return Sz(e);case Ge.ZodBoolean:return Nz();case Ge.ZodDate:return Zk(e,n);case Ge.ZodUndefined:return Xz();case Ge.ZodNull:return Lz();case Ge.ZodArray:return jz(e,n);case Ge.ZodUnion:case Ge.ZodDiscriminatedUnion:return $z(e,n);case Ge.ZodIntersection:return Rz(e,n);case Ge.ZodTuple:return Kz(e,n);case Ge.ZodRecord:return Wk(e,n);case Ge.ZodLiteral:return _z(e);case Ge.ZodEnum:return Az(e);case Ge.ZodNativeEnum:return zz(e);case Ge.ZodNullable:return Bz(e,n);case Ge.ZodOptional:return qz(e,n);case Ge.ZodMap:return Dz(e,n);case Ge.ZodSet:return Gz(e,n);case Ge.ZodLazy:return()=>e.getter()._def;case Ge.ZodPromise:return Yz(e,n);case Ge.ZodNaN:case Ge.ZodNever:return Pz();case Ge.ZodEffects:return Tz(e,n);case Ge.ZodAny:return cs();case Ge.ZodUnknown:return Jz();case Ge.ZodDefault:return Cz(e,n);case Ge.ZodBranded:return Fk(e,n);case Ge.ZodReadonly:return Qz(e,n);case Ge.ZodCatch:return kz(e,n);case Ge.ZodPipeline:return Wz(e,n);case Ge.ZodFunction:case Ge.ZodVoid:case Ge.ZodSymbol:return;default:return(a=>{})()}},t4=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function yt(e,t,n=!1){var a;const o=t.seen.get(e);if(t.override){const m=(a=t.override)==null?void 0:a.call(t,e,t,o,n);if(m!==bz)return m}if(o&&!n){const m=n4(o,t);if(m!==void 0)return m}const l={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,l);const u=e4(e,e.typeName,t),f=typeof u=="function"?yt(u(),t):u;if(f&&s4(e,t,f),t.postProcess){const m=t.postProcess(f,e,t);return l.jsonSchema=f,m}return l.jsonSchema=f,f}var n4=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:t4(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,a)=>t.currentPath[a]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),cs()):t.$refStrategy==="seen"?cs():void 0}},s4=(e,t,n)=>(e.description&&(n.description=e.description),n),a4=e=>{const t=wz(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([a,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,a],jsonSchema:void 0}]))}},r4=(e,t)=>{var n;const a=a4(t);let o=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((h,[p,y])=>{var b;return{...h,[p]:(b=yt(y._def,{...a,currentPath:[...a.basePath,a.definitionPath,p]},!0))!=null?b:cs()}},{}):void 0;const l=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,u=(n=yt(e._def,l===void 0?a:{...a,currentPath:[...a.basePath,a.definitionPath,l]},!1))!=null?n:cs(),f=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;f!==void 0&&(u.title=f);const m=l===void 0?o?{...u,[a.definitionPath]:o}:u:{$ref:[...a.$refStrategy==="relative"?[]:a.basePath,a.definitionPath,l].join("/"),[a.definitionPath]:{...o,[l]:u}};return m.$schema="http://json-schema.org/draft-07/schema#",m},wg=Symbol.for("vercel.ai.schema");function i4(e){let t;return()=>(t==null&&(t=e()),t)}function Mf(e,{validate:t}={}){return{[wg]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function o4(e){return typeof e=="object"&&e!==null&&wg in e&&e[wg]===!0&&"jsonSchema"in e&&"validate"in e}function Av(e){return e==null?Mf({properties:{},additionalProperties:!1}):o4(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?Yk(e):l4(e):e()}function l4(e){return Mf(()=>Tv(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{const n=await e["~standard"].validate(t);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new Oo({value:t,cause:n.issues})}}})}function c4(e,t){var n;const a=(n=void 0)!=null?n:!1;return Mf(()=>r4(e,{$refStrategy:a?"root":"none"}),{validate:async o=>{const l=await e.safeParseAsync(o);return l.success?{success:!0,value:l.data}:{success:!1,error:l.error}}})}function u4(e,t){var n;const a=(n=void 0)!=null?n:!1;return Mf(()=>Tv(Y5(e,{target:"draft-7",io:"input",reused:a?"ref":"inline"})),{validate:async o=>{const l=await Ik(e,o);return l.success?{success:!0,value:l.data}:{success:!1,error:l.error}}})}function d4(e){return"_zod"in e}function Yk(e,t){return d4(e)?u4(e):c4(e)}async function k1({value:e,schema:t,context:n}){const a=await pc({value:e,schema:t,context:n});if(!a.success)throw Oo.wrap({value:e,cause:a.error,context:n});return a.value}async function pc({value:e,schema:t,context:n}){const a=Av(t);try{if(a.validate==null)return{success:!0,value:e,rawValue:e};const o=await a.validate(e);return o.success?{success:!0,value:o.value,rawValue:e}:{success:!1,error:Oo.wrap({value:e,cause:o.error,context:n}),rawValue:e}}catch(o){return{success:!1,error:Oo.wrap({value:e,cause:o,context:n}),rawValue:e}}}async function di({text:e,schema:t}){try{const n=xz(e);return t==null?{success:!0,value:n,rawValue:n}:await pc({value:n,schema:t})}catch(n){return{success:!1,error:Zw.isInstance(n)?n:new Zw({text:e,cause:n}),rawValue:void 0}}}function f4({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new mz).pipeThrough(new TransformStream({async transform({data:n},a){n!=="[DONE]"&&a.enqueue(await di({text:n,schema:t}))}}))}async function cr(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var h4=Object.defineProperty,m4=(e,t)=>{for(var n in t)h4(e,n,{get:t[n],enumerable:!0})},Gk="AI_NoObjectGeneratedError",Kk=`vercel.ai.error.${Gk}`,p4=Symbol.for(Kk),Xk,pr=class extends sa{constructor({message:e="No object generated.",cause:t,text:n,response:a,usage:o,finishReason:l}){super({name:Gk,message:e,cause:t}),this[Xk]=!0,this.text=n,this.response=a,this.usage=o,this.finishReason=l}static isInstance(e){return sa.hasMarker(e,Kk)}};Xk=p4;var Jk="AI_UIMessageStreamError",Qk=`vercel.ai.error.${Jk}`,g4=Symbol.for(Qk),eE,ro=class extends sa{constructor({chunkType:e,chunkId:t,message:n}){super({name:Jk,message:n}),this[eE]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return sa.hasMarker(e,Qk)}};eE=g4;var tE=$n([Se(),Kd(Uint8Array),Kd(ArrayBuffer),Hk(e=>{var t,n;return(n=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?n:!1},{message:"Must be a Buffer"})]),gc=cz(()=>$n([PD(),Se(),OD(),zn(),hc(Se(),gc.optional()),Bo(gc)])),at=hc(Se(),hc(Se(),gc.optional())),nE=kt({type:Ue("text"),text:Se(),providerOptions:at.optional()}),v4=kt({type:Ue("image"),image:$n([tE,Kd(URL)]),mediaType:Se().optional(),providerOptions:at.optional()}),sE=kt({type:Ue("file"),data:$n([tE,Kd(URL)]),filename:Se().optional(),mediaType:Se(),providerOptions:at.optional()}),y4=kt({type:Ue("reasoning"),text:Se(),providerOptions:at.optional()}),x4=kt({type:Ue("tool-call"),toolCallId:Se(),toolName:Se(),input:Ks(),providerOptions:at.optional(),providerExecuted:zn().optional()}),b4=VD("type",[kt({type:Ue("text"),value:Se(),providerOptions:at.optional()}),kt({type:Ue("json"),value:gc,providerOptions:at.optional()}),kt({type:Ue("execution-denied"),reason:Se().optional(),providerOptions:at.optional()}),kt({type:Ue("error-text"),value:Se(),providerOptions:at.optional()}),kt({type:Ue("error-json"),value:gc,providerOptions:at.optional()}),kt({type:Ue("content"),value:Bo($n([kt({type:Ue("text"),text:Se(),providerOptions:at.optional()}),kt({type:Ue("media"),data:Se(),mediaType:Se()}),kt({type:Ue("file-data"),data:Se(),mediaType:Se(),filename:Se().optional(),providerOptions:at.optional()}),kt({type:Ue("file-url"),url:Se(),providerOptions:at.optional()}),kt({type:Ue("file-id"),fileId:$n([Se(),hc(Se(),Se())]),providerOptions:at.optional()}),kt({type:Ue("image-data"),data:Se(),mediaType:Se(),providerOptions:at.optional()}),kt({type:Ue("image-url"),url:Se(),providerOptions:at.optional()}),kt({type:Ue("image-file-id"),fileId:$n([Se(),hc(Se(),Se())]),providerOptions:at.optional()}),kt({type:Ue("custom"),providerOptions:at.optional()})]))})]),aE=kt({type:Ue("tool-result"),toolCallId:Se(),toolName:Se(),output:b4,providerOptions:at.optional()}),w4=kt({type:Ue("tool-approval-request"),approvalId:Se(),toolCallId:Se()}),j4=kt({type:Ue("tool-approval-response"),approvalId:Se(),approved:zn(),reason:Se().optional()}),S4=kt({role:Ue("system"),content:Se(),providerOptions:at.optional()}),N4=kt({role:Ue("user"),content:$n([Se(),Bo($n([nE,v4,sE]))]),providerOptions:at.optional()}),k4=kt({role:Ue("assistant"),content:$n([Se(),Bo($n([nE,sE,y4,x4,aE,w4]))]),providerOptions:at.optional()}),E4=kt({role:Ue("tool"),content:Bo($n([aE,j4])),providerOptions:at.optional()});$n([S4,N4,k4,E4]);function rE(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const n={...e};for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const o=t[a];if(o===void 0)continue;const l=a in e?e[a]:void 0,u=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp),f=l!=null&&typeof l=="object"&&!Array.isArray(l)&&!(l instanceof Date)&&!(l instanceof RegExp);u&&f?n[a]=rE(l,o):n[a]=o}return n}var C4={};m4(C4,{array:()=>R4,choice:()=>_4,json:()=>O4,object:()=>M4,text:()=>A4});function T4(e){const t=["ROOT"];let n=-1,a=null;function o(m,h,p){switch(m){case'"':{n=h,t.pop(),t.push(p),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=h,a=h,t.pop(),t.push(p),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(p),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=h,t.pop(),t.push(p),t.push("INSIDE_NUMBER");break}case"{":{n=h,t.pop(),t.push(p),t.push("INSIDE_OBJECT_START");break}case"[":{n=h,t.pop(),t.push(p),t.push("INSIDE_ARRAY_START");break}}}function l(m,h){switch(m){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=h,t.pop();break}}}function u(m,h){switch(m){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=h,t.pop();break}}}for(let m=0;m<e.length;m++){const h=e[m];switch(t[t.length-1]){case"ROOT":o(h,m,"FINISH");break;case"INSIDE_OBJECT_START":{switch(h){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{n=m,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{h==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{h==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{h===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(h,m,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{l(h,m);break}case"INSIDE_STRING":{switch(h){case'"':{t.pop(),n=m;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:n=m}break}case"INSIDE_ARRAY_START":{h==="]"?(n=m,t.pop()):(n=m,o(h,m,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(h){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=m,t.pop();break}default:{n=m;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(h,m,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),n=m;break}case"INSIDE_NUMBER":{switch(h){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=m;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,m),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,m);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,m);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,m);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const y=e.substring(a,m+1);!"false".startsWith(y)&&!"true".startsWith(y)&&!"null".startsWith(y)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?l(h,m):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,m)):n=m;break}}}let f=e.slice(0,n+1);for(let m=t.length-1;m>=0;m--)switch(t[m]){case"INSIDE_STRING":{f+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{f+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{f+="]";break}case"INSIDE_LITERAL":{const p=e.substring(a,e.length);"true".startsWith(p)?f+="true".slice(p.length):"false".startsWith(p)?f+="false".slice(p.length):"null".startsWith(p)&&(f+="null".slice(p.length))}}return f}async function Tc(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await di({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await di({text:T4(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var A4=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),M4=({schema:e,name:t,description:n})=>{const a=Av(e);return{name:"object",responseFormat:cr(a.jsonSchema).then(o=>({type:"json",schema:o,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:o},l){const u=await di({text:o});if(!u.success)throw new pr({message:"No object generated: could not parse the response.",cause:u.error,text:o,response:l.response,usage:l.usage,finishReason:l.finishReason});const f=await pc({value:u.value,schema:a});if(!f.success)throw new pr({message:"No object generated: response did not match schema.",cause:f.error,text:o,response:l.response,usage:l.usage,finishReason:l.finishReason});return f.value},async parsePartialOutput({text:o}){const l=await Tc(o);switch(l.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:l.value}}},createElementStreamTransform(){}}},R4=({element:e,name:t,description:n})=>{const a=Av(e);return{name:"array",responseFormat:cr(a.jsonSchema).then(o=>{const{$schema:l,...u}=o;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:u}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:o},l){const u=await di({text:o});if(!u.success)throw new pr({message:"No object generated: could not parse the response.",cause:u.error,text:o,response:l.response,usage:l.usage,finishReason:l.finishReason});const f=u.value;if(f==null||typeof f!="object"||!("elements"in f)||!Array.isArray(f.elements))throw new pr({message:"No object generated: response did not match schema.",cause:new Oo({value:f,cause:"response must be an object with an elements array"}),text:o,response:l.response,usage:l.usage,finishReason:l.finishReason});for(const m of f.elements){const h=await pc({value:m,schema:a});if(!h.success)throw new pr({message:"No object generated: response did not match schema.",cause:h.error,text:o,response:l.response,usage:l.usage,finishReason:l.finishReason})}return f.elements},async parsePartialOutput({text:o}){const l=await Tc(o);switch(l.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const u=l.value;if(u==null||typeof u!="object"||!("elements"in u)||!Array.isArray(u.elements))return;const f=l.state==="repaired-parse"&&u.elements.length>0?u.elements.slice(0,-1):u.elements,m=[];for(const h of f){const p=await pc({value:h,schema:a});p.success&&m.push(p.value)}return{partial:m}}}},createElementStreamTransform(){let o=0;return new TransformStream({transform({partialOutput:l},u){if(l!=null)for(;o<l.length;o++)u.enqueue(l[o])}})}}},_4=({options:e,name:t,description:n})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:a},o){const l=await di({text:a});if(!l.success)throw new pr({message:"No object generated: could not parse the response.",cause:l.error,text:a,response:o.response,usage:o.usage,finishReason:o.finishReason});const u=l.value;if(u==null||typeof u!="object"||!("result"in u)||typeof u.result!="string"||!e.includes(u.result))throw new pr({message:"No object generated: response did not match schema.",cause:new Oo({value:u,cause:"response must be an object that contains a choice value."}),text:a,response:o.response,usage:o.usage,finishReason:o.finishReason});return u.result},async parsePartialOutput({text:a}){const o=await Tc(a);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const l=o.value;if(l==null||typeof l!="object"||!("result"in l)||typeof l.result!="string")return;const u=e.filter(f=>f.startsWith(l.result));return o.state==="successful-parse"?u.includes(l.result)?{partial:l.result}:void 0:u.length===1?{partial:u[0]}:void 0}}},createElementStreamTransform(){}}),O4=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:n},a){const o=await di({text:n});if(!o.success)throw new pr({message:"No object generated: could not parse the response.",cause:o.error,text:n,response:a.response,usage:a.usage,finishReason:a.finishReason});return o.value},async parsePartialOutput({text:n}){const a=await Tc(n);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return a.value===void 0?void 0:{partial:a.value}}},createElementStreamTransform(){}});Cc({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
62
-
63
- `)},flush(e){e.enqueue(`data: [DONE]
64
-
65
- `)}})}});var I4=i4(()=>Yk($n([Rt({type:Ue("text-start"),id:Se(),providerMetadata:at.optional()}),Rt({type:Ue("text-delta"),id:Se(),delta:Se(),providerMetadata:at.optional()}),Rt({type:Ue("text-end"),id:Se(),providerMetadata:at.optional()}),Rt({type:Ue("error"),errorText:Se()}),Rt({type:Ue("tool-input-start"),toolCallId:Se(),toolName:Se(),providerExecuted:zn().optional(),providerMetadata:at.optional(),dynamic:zn().optional(),title:Se().optional()}),Rt({type:Ue("tool-input-delta"),toolCallId:Se(),inputTextDelta:Se()}),Rt({type:Ue("tool-input-available"),toolCallId:Se(),toolName:Se(),input:Ks(),providerExecuted:zn().optional(),providerMetadata:at.optional(),dynamic:zn().optional(),title:Se().optional()}),Rt({type:Ue("tool-input-error"),toolCallId:Se(),toolName:Se(),input:Ks(),providerExecuted:zn().optional(),providerMetadata:at.optional(),dynamic:zn().optional(),errorText:Se(),title:Se().optional()}),Rt({type:Ue("tool-approval-request"),approvalId:Se(),toolCallId:Se()}),Rt({type:Ue("tool-output-available"),toolCallId:Se(),output:Ks(),providerExecuted:zn().optional(),providerMetadata:at.optional(),dynamic:zn().optional(),preliminary:zn().optional()}),Rt({type:Ue("tool-output-error"),toolCallId:Se(),errorText:Se(),providerExecuted:zn().optional(),providerMetadata:at.optional(),dynamic:zn().optional()}),Rt({type:Ue("tool-output-denied"),toolCallId:Se()}),Rt({type:Ue("reasoning-start"),id:Se(),providerMetadata:at.optional()}),Rt({type:Ue("reasoning-delta"),id:Se(),delta:Se(),providerMetadata:at.optional()}),Rt({type:Ue("reasoning-end"),id:Se(),providerMetadata:at.optional()}),Rt({type:Ue("source-url"),sourceId:Se(),url:Se(),title:Se().optional(),providerMetadata:at.optional()}),Rt({type:Ue("source-document"),sourceId:Se(),mediaType:Se(),title:Se(),filename:Se().optional(),providerMetadata:at.optional()}),Rt({type:Ue("file"),url:Se(),mediaType:Se(),providerMetadata:at.optional()}),Rt({type:Hk(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:Se().optional(),data:Ks(),transient:zn().optional()}),Rt({type:Ue("start-step")}),Rt({type:Ue("finish-step")}),Rt({type:Ue("start"),messageId:Se().optional(),messageMetadata:Ks().optional()}),Rt({type:Ue("finish"),finishReason:Uk(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:Ks().optional()}),Rt({type:Ue("abort"),reason:Se().optional()}),Rt({type:Ue("message-metadata"),messageMetadata:Ks()})])));function D4(e){return e.type.startsWith("data-")}function jg(e){return e.type.startsWith("tool-")}function iE(e){return e.type==="dynamic-tool"}function fi(e){return jg(e)||iE(e)}function Sg(e){return e.type.split("-").slice(1).join("-")}function oE(e){return iE(e)?e.toolName:Sg(e)}function z4({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function P4({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:a,onError:o,onToolCall:l,onData:u}){return e.pipeThrough(new TransformStream({async transform(f,m){await a(async({state:h,write:p})=>{var y,b,w,j;function N(S){const A=h.message.parts.filter(fi).find(M=>M.toolCallId===S);if(A==null)throw new ro({chunkType:"tool-invocation",chunkId:S,message:`No tool invocation found for tool call ID "${S}".`});return A}function C(S){var R;const A=h.message.parts.find(U=>jg(U)&&U.toolCallId===S.toolCallId),M=S,D=A;if(A!=null){A.state=S.state,D.input=M.input,D.output=M.output,D.errorText=M.errorText,D.rawInput=M.rawInput,D.preliminary=M.preliminary,S.title!==void 0&&(D.title=S.title),D.providerExecuted=(R=M.providerExecuted)!=null?R:A.providerExecuted;const U=M.providerMetadata;if(U!=null)if(S.state==="output-available"||S.state==="output-error"){const F=A;F.resultProviderMetadata=U}else A.callProviderMetadata=U}else h.message.parts.push({type:`tool-${S.toolName}`,toolCallId:S.toolCallId,state:S.state,title:S.title,input:M.input,output:M.output,rawInput:M.rawInput,errorText:M.errorText,providerExecuted:M.providerExecuted,preliminary:M.preliminary,...M.providerMetadata!=null&&(S.state==="output-available"||S.state==="output-error")?{resultProviderMetadata:M.providerMetadata}:{},...M.providerMetadata!=null&&!(S.state==="output-available"||S.state==="output-error")?{callProviderMetadata:M.providerMetadata}:{}})}function k(S){var R,A;const M=h.message.parts.find(F=>F.type==="dynamic-tool"&&F.toolCallId===S.toolCallId),D=S,U=M;if(M!=null){M.state=S.state,U.toolName=S.toolName,U.input=D.input,U.output=D.output,U.errorText=D.errorText,U.rawInput=(R=D.rawInput)!=null?R:U.rawInput,U.preliminary=D.preliminary,S.title!==void 0&&(U.title=S.title),U.providerExecuted=(A=D.providerExecuted)!=null?A:M.providerExecuted;const F=D.providerMetadata;if(F!=null)if(S.state==="output-available"||S.state==="output-error"){const P=M;P.resultProviderMetadata=F}else M.callProviderMetadata=F}else h.message.parts.push({type:"dynamic-tool",toolName:S.toolName,toolCallId:S.toolCallId,state:S.state,input:D.input,output:D.output,errorText:D.errorText,preliminary:D.preliminary,providerExecuted:D.providerExecuted,title:S.title,...D.providerMetadata!=null&&(S.state==="output-available"||S.state==="output-error")?{resultProviderMetadata:D.providerMetadata}:{},...D.providerMetadata!=null&&!(S.state==="output-available"||S.state==="output-error")?{callProviderMetadata:D.providerMetadata}:{}})}async function E(S){if(S!=null){const R=h.message.metadata!=null?rE(h.message.metadata,S):S;t!=null&&await k1({value:R,schema:t,context:{field:"message.metadata",entityId:h.message.id}}),h.message.metadata=R}}switch(f.type){case"text-start":{const S={type:"text",text:"",providerMetadata:f.providerMetadata,state:"streaming"};h.activeTextParts[f.id]=S,h.message.parts.push(S),p();break}case"text-delta":{const S=h.activeTextParts[f.id];if(S==null)throw new ro({chunkType:"text-delta",chunkId:f.id,message:`Received text-delta for missing text part with ID "${f.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});S.text+=f.delta,S.providerMetadata=(y=f.providerMetadata)!=null?y:S.providerMetadata,p();break}case"text-end":{const S=h.activeTextParts[f.id];if(S==null)throw new ro({chunkType:"text-end",chunkId:f.id,message:`Received text-end for missing text part with ID "${f.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});S.state="done",S.providerMetadata=(b=f.providerMetadata)!=null?b:S.providerMetadata,delete h.activeTextParts[f.id],p();break}case"reasoning-start":{const S={type:"reasoning",text:"",providerMetadata:f.providerMetadata,state:"streaming"};h.activeReasoningParts[f.id]=S,h.message.parts.push(S),p();break}case"reasoning-delta":{const S=h.activeReasoningParts[f.id];if(S==null)throw new ro({chunkType:"reasoning-delta",chunkId:f.id,message:`Received reasoning-delta for missing reasoning part with ID "${f.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});S.text+=f.delta,S.providerMetadata=(w=f.providerMetadata)!=null?w:S.providerMetadata,p();break}case"reasoning-end":{const S=h.activeReasoningParts[f.id];if(S==null)throw new ro({chunkType:"reasoning-end",chunkId:f.id,message:`Received reasoning-end for missing reasoning part with ID "${f.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});S.providerMetadata=(j=f.providerMetadata)!=null?j:S.providerMetadata,S.state="done",delete h.activeReasoningParts[f.id],p();break}case"file":{h.message.parts.push({type:"file",mediaType:f.mediaType,url:f.url,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}}),p();break}case"source-url":{h.message.parts.push({type:"source-url",sourceId:f.sourceId,url:f.url,title:f.title,providerMetadata:f.providerMetadata}),p();break}case"source-document":{h.message.parts.push({type:"source-document",sourceId:f.sourceId,mediaType:f.mediaType,title:f.title,filename:f.filename,providerMetadata:f.providerMetadata}),p();break}case"tool-input-start":{const S=h.message.parts.filter(jg);h.partialToolCalls[f.toolCallId]={text:"",toolName:f.toolName,index:S.length,dynamic:f.dynamic,title:f.title},f.dynamic?k({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-streaming",input:void 0,providerExecuted:f.providerExecuted,title:f.title,providerMetadata:f.providerMetadata}):C({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-streaming",input:void 0,providerExecuted:f.providerExecuted,title:f.title,providerMetadata:f.providerMetadata}),p();break}case"tool-input-delta":{const S=h.partialToolCalls[f.toolCallId];if(S==null)throw new ro({chunkType:"tool-input-delta",chunkId:f.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${f.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});S.text+=f.inputTextDelta;const{value:R}=await Tc(S.text);S.dynamic?k({toolCallId:f.toolCallId,toolName:S.toolName,state:"input-streaming",input:R,title:S.title}):C({toolCallId:f.toolCallId,toolName:S.toolName,state:"input-streaming",input:R,title:S.title}),p();break}case"tool-input-available":{f.dynamic?k({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-available",input:f.input,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:f.title}):C({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-available",input:f.input,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:f.title}),p(),l&&!f.providerExecuted&&await l({toolCall:f});break}case"tool-input-error":{const S=h.message.parts.filter(fi).find(A=>A.toolCallId===f.toolCallId);(S!=null?S.type==="dynamic-tool":!!f.dynamic)?k({toolCallId:f.toolCallId,toolName:f.toolName,state:"output-error",input:f.input,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata}):C({toolCallId:f.toolCallId,toolName:f.toolName,state:"output-error",input:void 0,rawInput:f.input,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata}),p();break}case"tool-approval-request":{const S=N(f.toolCallId);S.state="approval-requested",S.approval={id:f.approvalId},p();break}case"tool-output-denied":{const S=N(f.toolCallId);S.state="output-denied",p();break}case"tool-output-available":{const S=N(f.toolCallId);S.type==="dynamic-tool"?k({toolCallId:f.toolCallId,toolName:S.toolName,state:"output-available",input:S.input,output:f.output,preliminary:f.preliminary,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:S.title}):C({toolCallId:f.toolCallId,toolName:Sg(S),state:"output-available",input:S.input,output:f.output,providerExecuted:f.providerExecuted,preliminary:f.preliminary,providerMetadata:f.providerMetadata,title:S.title}),p();break}case"tool-output-error":{const S=N(f.toolCallId);S.type==="dynamic-tool"?k({toolCallId:f.toolCallId,toolName:S.toolName,state:"output-error",input:S.input,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:S.title}):C({toolCallId:f.toolCallId,toolName:Sg(S),state:"output-error",input:S.input,rawInput:S.rawInput,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:S.title}),p();break}case"start-step":{h.message.parts.push({type:"step-start"});break}case"finish-step":{h.activeTextParts={},h.activeReasoningParts={};break}case"start":{f.messageId!=null&&(h.message.id=f.messageId),await E(f.messageMetadata),(f.messageId!=null||f.messageMetadata!=null)&&p();break}case"finish":{f.finishReason!=null&&(h.finishReason=f.finishReason),await E(f.messageMetadata),f.messageMetadata!=null&&p();break}case"message-metadata":{await E(f.messageMetadata),f.messageMetadata!=null&&p();break}case"error":{o?.(new Error(f.errorText));break}default:if(D4(f)){if(n?.[f.type]!=null){const A=h.message.parts.findIndex(D=>"id"in D&&"data"in D&&D.id===f.id&&D.type===f.type),M=A>=0?A:h.message.parts.length;await k1({value:f.data,schema:n[f.type],context:{field:`message.parts[${M}].data`,entityName:f.type,entityId:f.id}})}const S=f;if(S.transient){u?.(S);break}const R=S.id!=null?h.message.parts.find(A=>S.type===A.type&&S.id===A.id):void 0;R!=null?R.data=S.data:h.message.parts.push(S),u?.(S),p()}}m.enqueue(f)})}}))}async function L4({stream:e,onError:t}){const n=e.getReader();try{for(;;){const{done:a}=await n.read();if(a)break}}catch(a){t?.(a)}finally{n.releaseLock()}}Cc({prefix:"aitxt",size:24});Cc({prefix:"aiobj",size:24});var $4=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(a){n(a)}}),this.processQueue()})}};Cc({prefix:"aiobj",size:24});async function U4(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{const{name:n,type:a}=t,o=await new Promise((l,u)=>{const f=new FileReader;f.onload=m=>{var h;l((h=m.target)==null?void 0:h.result)},f.onerror=m=>u(m),f.readAsDataURL(t)});return{type:"file",mediaType:a,filename:n,url:o}}))}var B4=class{constructor({api:e="/api/chat",credentials:t,headers:n,body:a,fetch:o,prepareSendMessagesRequest:l,prepareReconnectToStreamRequest:u}){this.api=e,this.credentials=t,this.headers=n,this.body=a,this.fetch=o,this.prepareSendMessagesRequest=l,this.prepareReconnectToStreamRequest=u}async sendMessages({abortSignal:e,...t}){var n,a,o,l,u;const f=await cr(this.body),m=await cr(this.headers),h=await cr(this.credentials),p={...ao(m),...ao(t.headers)},y=await((n=this.prepareSendMessagesRequest)==null?void 0:n.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...f,...t.body},headers:p,credentials:h,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),b=(a=y?.api)!=null?a:this.api,w=y?.headers!==void 0?ao(y.headers):p,j=y?.body!==void 0?y.body:{...f,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},N=(o=y?.credentials)!=null?o:h,k=await((l=this.fetch)!=null?l:globalThis.fetch)(b,{method:"POST",headers:{"Content-Type":"application/json",...w},body:JSON.stringify(j),credentials:N,signal:e});if(!k.ok)throw new Error((u=await k.text())!=null?u:"Failed to fetch the chat response.");if(!k.body)throw new Error("The response body is empty.");return this.processResponseStream(k.body)}async reconnectToStream(e){var t,n,a,o,l;const u=await cr(this.body),f=await cr(this.headers),m=await cr(this.credentials),h={...ao(f),...ao(e.headers)},p=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...u,...e.body},headers:h,credentials:m,requestMetadata:e.metadata})),y=(n=p?.api)!=null?n:`${this.api}/${e.chatId}/stream`,b=p?.headers!==void 0?ao(p.headers):h,w=(a=p?.credentials)!=null?a:m,N=await((o=this.fetch)!=null?o:globalThis.fetch)(y,{method:"GET",headers:b,credentials:w});if(N.status===204)return null;if(!N.ok)throw new Error((l=await N.text())!=null?l:"Failed to fetch the chat response.");if(!N.body)throw new Error("The response body is empty.");return this.processResponseStream(N.body)}},lE=class extends B4{constructor(e={}){super(e)}processResponseStream(e){return f4({stream:e,schema:I4}).pipeThrough(new TransformStream({async transform(t,n){if(!t.success)throw t.error;n.enqueue(t.value)}}))}},V4=class{constructor({generateId:e=pz,id:t=e(),transport:n=new lE,messageMetadataSchema:a,dataPartSchemas:o,state:l,onError:u,onToolCall:f,onFinish:m,onData:h,sendAutomaticallyWhen:p}){this.activeResponse=void 0,this.jobExecutor=new $4,this.sendMessage=async(y,b)=>{var w,j,N,C;if(y==null){await this.makeRequest({trigger:"submit-message",messageId:(w=this.lastMessage)==null?void 0:w.id,...b});return}let k;if("text"in y||"files"in y?k={parts:[...Array.isArray(y.files)?y.files:await U4(y.files),..."text"in y&&y.text!=null?[{type:"text",text:y.text}]:[]]}:k=y,y.messageId!=null){const E=this.state.messages.findIndex(S=>S.id===y.messageId);if(E===-1)throw new Error(`message with id ${y.messageId} not found`);if(this.state.messages[E].role!=="user")throw new Error(`message with id ${y.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,E+1),this.state.replaceMessage(E,{...k,id:y.messageId,role:(j=k.role)!=null?j:"user",metadata:y.metadata})}else this.state.pushMessage({...k,id:(N=k.id)!=null?N:this.generateId(),role:(C=k.role)!=null?C:"user",metadata:y.metadata});await this.makeRequest({trigger:"submit-message",messageId:y.messageId,...b})},this.regenerate=async({messageId:y,...b}={})=>{const w=y==null?this.state.messages.length-1:this.state.messages.findIndex(j=>j.id===y);if(w===-1)throw new Error(`message ${y} not found`);this.state.messages=this.state.messages.slice(0,this.messages[w].role==="assistant"?w:w+1),await this.makeRequest({trigger:"regenerate-message",messageId:y,...b})},this.resumeStream=async(y={})=>{await this.makeRequest({trigger:"resume-stream",...y})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:y,approved:b,reason:w,options:j})=>this.jobExecutor.run(async()=>{const N=this.state.messages,C=N[N.length-1],k=E=>fi(E)&&E.state==="approval-requested"&&E.approval.id===y?{...E,state:"approval-responded",approval:{id:y,approved:b,reason:w}}:E;this.state.replaceMessage(N.length-1,{...C,parts:C.parts.map(k)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(k)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(E=>{var S;E&&this.makeRequest({trigger:"submit-message",messageId:(S=this.lastMessage)==null?void 0:S.id,...j})})}),this.addToolOutput=async({state:y="output-available",toolCallId:b,output:w,errorText:j,options:N})=>this.jobExecutor.run(async()=>{const C=this.state.messages,k=C[C.length-1],E=S=>fi(S)&&S.toolCallId===b?{...S,state:y,output:w,errorText:j}:S;this.state.replaceMessage(C.length-1,{...k,parts:k.parts.map(E)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(E)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(S=>{var R;S&&this.makeRequest({trigger:"submit-message",messageId:(R=this.lastMessage)==null?void 0:R.id,...N})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var y;this.status!=="streaming"&&this.status!=="submitted"||(y=this.activeResponse)!=null&&y.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=a,this.dataPartSchemas=o,this.state=l,this.onError=u,this.onToolCall=f,this.onFinish=m,this.onData=h,this.sendAutomaticallyWhen=p}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:n,body:a,messageId:o}){var l,u,f;let m;if(e==="resume-stream")try{const w=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:a});if(w==null)return;m=w}catch(w){this.onError&&w instanceof Error&&this.onError(w),this.setStatus({status:"error",error:w});return}this.setStatus({status:"submitted",error:void 0});const h=this.lastMessage;let p=!1,y=!1,b=!1;try{const w={state:z4({lastMessage:this.state.snapshot(h),messageId:this.generateId()}),abortController:new AbortController};w.abortController.signal.addEventListener("abort",()=>{p=!0}),this.activeResponse=w;let j;e==="resume-stream"?j=m:j=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:w.abortController.signal,metadata:t,headers:n,body:a,trigger:e,messageId:o});const N=C=>this.jobExecutor.run(()=>C({state:w.state,write:()=>{var k;this.setStatus({status:"streaming"}),w.state.message.id===((k=this.lastMessage)==null?void 0:k.id)?this.state.replaceMessage(this.state.messages.length-1,w.state.message):this.state.pushMessage(w.state.message)}}));await L4({stream:P4({stream:j,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:N,onError:C=>{throw C}}),onError:C=>{throw C}}),this.setStatus({status:"ready"})}catch(w){if(p||w.name==="AbortError")return p=!0,this.setStatus({status:"ready"}),null;b=!0,w instanceof TypeError&&(w.message.toLowerCase().includes("fetch")||w.message.toLowerCase().includes("network"))&&(y=!0),this.onError&&w instanceof Error&&this.onError(w),this.setStatus({status:"error",error:w})}finally{try{(u=this.onFinish)==null||u.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:p,isDisconnect:y,isError:b,finishReason:(l=this.activeResponse)==null?void 0:l.state.finishReason})}catch(w){console.error(w)}this.activeResponse=void 0}!b&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,metadata:t,headers:n,body:a})}},vp,E1;function H4(){if(E1)return vp;E1=1;function e(t,n){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let a,o=0;return function(...u){clearTimeout(a);const f=Date.now(),m=f-o,h=n-m;h<=0?(o=f,t.apply(this,u)):a=setTimeout(()=>{o=Date.now(),t.apply(this,u)},h)}}return vp=e,vp}var F4=H4();const Z4=TN(F4);var cE=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},_t=(e,t,n)=>(cE(e,t,"read from private field"),n?n.call(e):t.get(e)),Ys=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},or=(e,t,n,a)=>(cE(e,t,"write to private field"),t.set(e,n),n);function q4(e,t){return t!=null?Z4(e,t):e}var ws,Cd,Td,ql,Wl,Yl,mo,Ng,kg,W4=class{constructor(e=[]){Ys(this,ws,void 0),Ys(this,Cd,"ready"),Ys(this,Td,void 0),Ys(this,ql,new Set),Ys(this,Wl,new Set),Ys(this,Yl,new Set),this.pushMessage=t=>{or(this,ws,_t(this,ws).concat(t)),_t(this,mo).call(this)},this.popMessage=()=>{or(this,ws,_t(this,ws).slice(0,-1)),_t(this,mo).call(this)},this.replaceMessage=(t,n)=>{or(this,ws,[..._t(this,ws).slice(0,t),this.snapshot(n),..._t(this,ws).slice(t+1)]),_t(this,mo).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,n)=>{const a=n?q4(t,n):t;return _t(this,ql).add(a),()=>{_t(this,ql).delete(a)}},this["~registerStatusCallback"]=t=>(_t(this,Wl).add(t),()=>{_t(this,Wl).delete(t)}),this["~registerErrorCallback"]=t=>(_t(this,Yl).add(t),()=>{_t(this,Yl).delete(t)}),Ys(this,mo,()=>{_t(this,ql).forEach(t=>t())}),Ys(this,Ng,()=>{_t(this,Wl).forEach(t=>t())}),Ys(this,kg,()=>{_t(this,Yl).forEach(t=>t())}),or(this,ws,e)}get status(){return _t(this,Cd)}set status(e){or(this,Cd,e),_t(this,Ng).call(this)}get error(){return _t(this,Td)}set error(e){or(this,Td,e),_t(this,kg).call(this)}get messages(){return _t(this,ws)}set messages(e){or(this,ws,[...e]),_t(this,mo).call(this)}};ws=new WeakMap;Cd=new WeakMap;Td=new WeakMap;ql=new WeakMap;Wl=new WeakMap;Yl=new WeakMap;mo=new WeakMap;Ng=new WeakMap;kg=new WeakMap;var po,C1=class extends V4{constructor({messages:e,...t}){const n=new W4(e);super({...t,state:n}),Ys(this,po,void 0),this["~registerMessagesCallback"]=(a,o)=>_t(this,po)["~registerMessagesCallback"](a,o),this["~registerStatusCallback"]=a=>_t(this,po)["~registerStatusCallback"](a),this["~registerErrorCallback"]=a=>_t(this,po)["~registerErrorCallback"](a),or(this,po,n)}};po=new WeakMap;function Y4({experimental_throttle:e,resume:t=!1,...n}={}){const a=v.useRef("chat"in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});"chat"in n||(a.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});const o={...n,onToolCall:b=>{var w,j;return(j=(w=a.current).onToolCall)==null?void 0:j.call(w,b)},onData:b=>{var w,j;return(j=(w=a.current).onData)==null?void 0:j.call(w,b)},onFinish:b=>{var w,j;return(j=(w=a.current).onFinish)==null?void 0:j.call(w,b)},onError:b=>{var w,j;return(j=(w=a.current).onError)==null?void 0:j.call(w,b)},sendAutomaticallyWhen:b=>{var w,j,N;return(N=(j=(w=a.current).sendAutomaticallyWhen)==null?void 0:j.call(w,b))!=null?N:!1}},l=v.useRef("chat"in n?n.chat:new C1(o));("chat"in n&&n.chat!==l.current||"id"in n&&l.current.id!==n.id)&&(l.current="chat"in n?n.chat:new C1(o));const f=v.useCallback(b=>l.current["~registerMessagesCallback"](b,e),[e,l.current.id]),m=v.useSyncExternalStore(f,()=>l.current.messages,()=>l.current.messages),h=v.useSyncExternalStore(l.current["~registerStatusCallback"],()=>l.current.status,()=>l.current.status),p=v.useSyncExternalStore(l.current["~registerErrorCallback"],()=>l.current.error,()=>l.current.error),y=v.useCallback(b=>{typeof b=="function"&&(b=b(l.current.messages)),l.current.messages=b},[l]);return v.useEffect(()=>{t&&l.current.resumeStream()},[t,l]),{id:l.current.id,messages:m,setMessages:y,sendMessage:l.current.sendMessage,regenerate:l.current.regenerate,clearError:l.current.clearError,stop:l.current.stop,error:p,resumeStream:l.current.resumeStream,status:h,addToolResult:l.current.addToolOutput,addToolOutput:l.current.addToolOutput,addToolApprovalResponse:l.current.addToolApprovalResponse}}function G4(e){const t={};for(const n of e.attachmentsRef.current??[])if(e.activeAttachmentsRef.current.has(n.label)){const a=n.content();a!==null&&(t[n.label.toLowerCase()]=a)}return{toolset:e.toolsetRef.current,context:{...e.contextRef.current,...t},mode:e.modeRef.current,sessionId:e.sessionIdRef.current,provider:e.providerRef.current,model:e.modelRef.current}}function K4(e,t){e.current?.(t)}function X4(e,t){e.current?.(t)}function J4(e){const t=new Set;for(const n of e??[])if(n.role==="assistant")for(const a of n.parts??[])a&&fi(a)&&t.add(a.toolCallId);return t}function Q4({toolset:e,chatId:t,initialMessages:n,context:a,onToolCall:o,mode:l,attachments:u,provider:f,model:m,sessionId:h,onSessionIdChange:p,onFinish:y,onError:b}){const w=v.useRef(o),j=v.useRef(y),N=v.useRef(b),C=v.useRef(h??crypto.randomUUID()),[k,E]=v.useState(new Set),S=v.useCallback($=>{E(G=>{const X=new Set(G);return X.has($)?X.delete($):X.add($),X})},[]),[R]=Ca("hudson.settings",{}),A=l??R.aiMode??"api",M=v.useRef(k),D=v.useRef(u),U=v.useRef(a),F=v.useRef(e),P=v.useRef(A),_=v.useRef(f),z=v.useRef(m);v.useEffect(()=>{w.current=o},[o]),v.useEffect(()=>{j.current=y},[y]),v.useEffect(()=>{N.current=b},[b]),v.useEffect(()=>{h&&h!==C.current&&(C.current=h)},[h]),v.useEffect(()=>{p?.(C.current)},[p]),v.useEffect(()=>{M.current=k},[k]),v.useEffect(()=>{D.current=u},[u]),v.useEffect(()=>{U.current=a},[a]),v.useEffect(()=>{F.current=e},[e]),v.useEffect(()=>{P.current=A},[A]),v.useEffect(()=>{_.current=f},[f]),v.useEffect(()=>{z.current=m},[m]);const B=v.useMemo(()=>new lE({api:"/api/ai/chat",body:()=>G4({activeAttachmentsRef:M,attachmentsRef:D,contextRef:U,toolsetRef:F,modeRef:P,sessionIdRef:C,providerRef:_,modelRef:z})}),[]),V=Y4({id:t,messages:n,transport:B,onFinish:$=>K4(j,$),onError:$=>X4(N,$)}),K=v.useRef(J4(n)),L=v.useCallback(()=>{const $=crypto.randomUUID();C.current=$,p?.($),K.current.clear(),V.setMessages([])},[V,p]),{messages:H}=V;return v.useEffect(()=>{if(w.current){for(const $ of H)if($.role==="assistant"){for(const G of $.parts??[])if(G&&fi(G)){if("state"in G&&G.state==="input-streaming")continue;const X=G.toolCallId;if(!K.current.has(X)){K.current.add(X);const O=oE(G);w.current?.(O,G.input??{})}}}}},[H]),{messages:H,sendMessage:V.sendMessage,stop:V.stop,status:V.status,setMessages:V.setMessages,clearChat:L,error:V.error,mode:A,attachments:u??[],activeAttachments:k,toggleAttachment:S}}function e3({app:e,commands:t,state:n,provider:a,model:o,onFinish:l}){const u=v.useMemo(()=>(e.intents??[]).map(h=>({commandId:h.commandId,title:h.title,description:h.description,category:h.category,keywords:h.keywords,shortcut:h.shortcut,dangerous:h.dangerous,params:h.params?.map(p=>({name:p.name,description:p.description,type:p.type,optional:p.optional,enum:p.enum}))})),[e.intents]),f=v.useMemo(()=>({appId:e.id,appName:e.name,appDescription:e.description,intents:u,state:n}),[e.id,e.name,e.description,u,n]),m=v.useCallback(h=>{const p=t.find(y=>y.id===h);if(!p){console.warn(`[useAssistant] no command for id "${h}"`);return}p.action()},[t]);return Q4({toolset:"intents",context:f,provider:a,model:o,onFinish:l,onToolCall:(h,p)=>{if(h!=="dispatch")return;const y=p.commandId;typeof y=="string"&&m(y)}})}function Mv(e={}){const{url:t="ws://localhost:3600",healthUrl:n,systemPrompt:a,cwd:o,workspaceFiles:l,autoConnect:u=!1,sessionKey:f,orphanTTL:m,backend:h,tmuxSession:p,agent:y,provider:b,model:w}=e,j=f?`hudson.relay.${f}`:null,N=()=>{if(!j)return null;try{return localStorage.getItem(j)}catch{return null}},C=xe=>{if(j)try{xe?localStorage.setItem(j,xe):localStorage.removeItem(j)}catch{}},[k,E]=v.useState("disconnected"),[S,R]=v.useState(null),[A,M]=v.useState(null),[D,U]=v.useState(null),[F,P]=v.useState(o||"~"),_=v.useRef(null),z=v.useRef(null),B=v.useRef({cols:80,rows:24}),V=v.useRef(!1),K=v.useRef(""),L=v.useRef(0),H=v.useRef(F);H.current=F;const $=v.useRef(N()),G=v.useRef(null),X=512*1024,O=v.useCallback(xe=>{if(xe){if(G.current){G.current(xe);return}K.current+=xe,K.current.length>X&&(K.current=K.current.slice(-X))}},[]),Z=v.useCallback(xe=>{const we=_.current;we&&we.readyState===WebSocket.OPEN&&we.send(JSON.stringify(xe))},[]),W=v.useCallback(()=>{L.current+=1,z.current&&(clearTimeout(z.current),z.current=null);const xe=_.current;xe&&(xe.close(),_.current=null),V.current=!1,E("disconnected")},[]),Q=v.useCallback(()=>{const xe=H.current;return{type:"session:init",cols:B.current.cols,rows:B.current.rows,...a?{systemPrompt:a}:{},...xe?{cwd:xe}:{},...l?{workspaceFiles:l}:{},...m?{orphanTTL:m}:{},...h?{backend:h}:{},...p?{tmuxSession:p}:{},...y?{agent:y}:{},...b?{provider:b}:{},...w?{model:w}:{}}},[a,l,m,h,p,y,b,w]),ce=v.useCallback(()=>{V.current||(V.current=!0,$.current?Z({type:"session:reconnect",sessionId:$.current,cols:B.current.cols,rows:B.current.rows}):Z(Q()))},[Z,Q]),ae=v.useCallback(async()=>{const xe=L.current+1;L.current=xe,_.current&&(_.current.close(),_.current=null),V.current=!1,E("connecting"),M(null),U(null);const we=n||`${t.replace(/^ws(s?):\/\//,"http$1://")}/health`;try{await fetch(we,{signal:AbortSignal.timeout(2e3)})}catch{if(L.current!==xe)return;E("error"),M("Relay service is not running");return}if(L.current!==xe)return;_.current&&(_.current.close(),_.current=null);const ze=new WebSocket(t);_.current=ze;const Me=()=>L.current===xe&&_.current===ze;ze.onopen=()=>{if(!Me()){ze.close();return}ce()},ze.onmessage=je=>{if(Me())try{const Ne=JSON.parse(je.data);switch(Ne.type){case"session:ready":$.current=Ne.sessionId,C(Ne.sessionId),R(Ne.sessionId),E("connected"),M(null),U(null);break;case"session:expired":{$.current=null,C(null),V.current=!1,O("\x1B[2J\x1B[H"),Z(Q()),V.current=!0;break}case"session:error":E("error"),M(Ne.error||"Session failed to start");break;case"terminal:data":Ne.data&&O(Ne.data);break;case"session:exit":$.current=null,C(null),R(null),U(Ne.exitCode??null),Ne.exitCode!==0?(E("error"),M(Ne.reason||`Process exited with code ${Ne.exitCode}`)):E("disconnected");break;case"session:detached":$.current=null,C(null),R(null);break}}catch{}},ze.onclose=()=>{Me()&&(_.current=null,V.current=!1,E(je=>je==="error"?je:"disconnected"))},ze.onerror=()=>{Me()&&(E("error"),M("Could not connect to relay"))}},[t,n,ce,Z,a,l]),ge=v.useCallback(xe=>{Z({type:"terminal:input",data:xe})},[Z]),ye=v.useCallback(xe=>{Z({type:"terminal:input",data:xe+"\r"})},[Z]),be=v.useCallback((xe,we)=>{B.current={cols:xe,rows:we},V.current&&Z({type:"terminal:resize",cols:xe,rows:we})},[Z]),Oe=v.useCallback(xe=>{G.current=xe,!(!xe||K.current.length===0)&&(xe(K.current),K.current="")},[]);v.useEffect(()=>(u&&ae(),()=>{W()}),[]);const fe=v.useCallback(()=>{W(),$.current=null,R(null),C(null),M(null),U(null),setTimeout(()=>ae(),200)},[W,ae]);return{status:k,sessionId:S,error:A,exitCode:D,cwd:F,setCwd:P,onData:Oe,sendInput:ge,sendLine:ye,resize:be,connect:ae,disconnect:W,restart:fe}}const uE=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim();const t3=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const n3=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase());const T1=e=>{const t=n3(e);return t.charAt(0).toUpperCase()+t.slice(1)};var s3={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const a3=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const r3=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:o="",children:l,iconNode:u,...f},m)=>v.createElement("svg",{ref:m,...s3,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:uE("lucide",o),...!l&&!a3(f)&&{"aria-hidden":"true"},...f},[...u.map(([h,p])=>v.createElement(h,p)),...Array.isArray(l)?l:[l]]));const Ft=(e,t)=>{const n=v.forwardRef(({className:a,...o},l)=>v.createElement(r3,{ref:l,iconNode:t,className:uE(`lucide-${t3(T1(e))}`,`lucide-${e}`,a),...o}));return n.displayName=T1(e),n};const i3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],o3=Ft("circle-alert",i3);const l3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],c3=Ft("clock",l3);const u3=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],d3=Ft("corner-down-left",u3);const f3=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],A1=Ft("loader-circle",f3);const h3=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],m3=Ft("map",h3);const p3=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],dE=Ft("maximize-2",p3);const g3=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],v3=Ft("mic",g3);const y3=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],x3=Ft("minimize-2",y3);const b3=[["path",{d:"M5 12h14",key:"1ays0h"}]],w3=Ft("minus",b3);const j3=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],S3=Ft("panel-left-close",j3);const N3=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],k3=Ft("panel-left-open",N3);const E3=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],C3=Ft("panel-right-close",E3);const T3=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],A3=Ft("panel-right-open",T3);const M3=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],R3=Ft("paperclip",M3);const _3=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],O3=Ft("plus",_3);const I3=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Rv=Ft("search",I3);const D3=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],z3=Ft("sparkles",D3);const P3=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],fE=Ft("square",P3);const L3=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],$3=Ft("terminal",L3);const U3=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],B3=Ft("trash-2",U3);const V3=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],H3=Ft("volume-2",V3);const F3=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Z3=Ft("volume-x",F3);const q3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],hE=Ft("x",q3);function W3({chat:e,placeholder:t="Ask AI...",inputExtras:n,inputStatus:a,inputValue:o,onInputChange:l}){const{messages:u,sendMessage:f,stop:m,status:h,clearChat:p,error:y,attachments:b,activeAttachments:w,toggleAttachment:j}=e,[N,C]=v.useState(""),k=o!==void 0,E=k?o:N,S=P=>{k?l?.(P):C(P)},R=v.useRef(null),A=v.useRef(null),M=h==="streaming"||h==="submitted",D=b.length>0;v.useEffect(()=>{const P=R.current;P&&(P.scrollTop=P.scrollHeight)},[u]),v.useEffect(()=>{A.current?.focus()},[]);const U=P=>{P.preventDefault();const _=E.trim();!_||M||(S(""),f({text:_}))},F=P=>{P.stopPropagation(),P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),U(P))};return i.jsxs("div",{className:"flex flex-col h-full font-mono text-[12px]",children:[i.jsxs("div",{ref:R,className:"flex-1 overflow-y-auto frame-scrollbar p-3 space-y-3",children:[u.length===0&&i.jsx("div",{className:"text-neutral-500 text-center py-8 select-none",children:t}),u.map(P=>i.jsx("div",{className:`flex ${P.role==="user"?"justify-end":"justify-start"}`,children:i.jsx("div",{className:`max-w-[85%] rounded-lg px-3 py-2 whitespace-pre-wrap break-words leading-relaxed ${P.role==="user"?"bg-emerald-500/10 text-emerald-100 border border-emerald-500/20":"bg-neutral-800/50 text-neutral-200 border border-neutral-700/50"}`,children:(P.parts??[]).map((_,z)=>{if(!_)return null;if(_.type==="text")return i.jsx("span",{children:_.text},z);if(fi(_)){const B=oE(_),V=Object.entries(_.input??{}).map(([K,L])=>`${K}: ${JSON.stringify(L)}`).join(", ");return i.jsxs("div",{className:"text-[11px] text-cyan-400/70 mt-1 font-mono",children:[i.jsx("span",{className:"text-neutral-500",children:"↳ "}),B,"(",V,")"]},z)}return null})})},P.id)),M&&u[u.length-1]?.role!=="assistant"&&i.jsx("div",{className:"flex justify-start",children:i.jsx("div",{className:"bg-neutral-800/50 border border-neutral-700/50 rounded-lg px-3 py-2 text-neutral-400",children:i.jsx("span",{className:"animate-pulse",children:"..."})})})]}),y&&i.jsxs("div",{className:"px-3 py-2 bg-red-900/20 border-t border-red-500/30 text-red-400 text-[11px] flex items-center gap-2",children:[i.jsx(o3,{size:12}),i.jsx("span",{className:"truncate",children:y.message||"An error occurred"})]}),i.jsxs("div",{className:"px-3 py-2.5 border-t border-neutral-700/50 bg-neutral-900/50",children:[D&&i.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[i.jsx(R3,{size:11,className:"text-neutral-500 shrink-0"}),b.map(P=>{const _=w.has(P.label);return i.jsx("button",{type:"button",onClick:()=>j(P.label),className:`text-[10px] px-2 py-0.5 rounded-full border transition-colors ${_?"bg-cyan-500/15 text-cyan-300 border-cyan-500/40":"text-neutral-500 border-neutral-700 hover:text-neutral-300 hover:border-neutral-600"}`,children:P.label},P.label)}),w.size>0&&i.jsx("span",{className:"text-[10px] text-neutral-600 ml-1",children:"attached"})]}),i.jsxs("form",{onSubmit:U,className:"flex items-center gap-2 rounded-lg border border-neutral-700 bg-neutral-800/60 px-3 py-2 focus-within:border-emerald-500/40 transition-colors",children:[u.length>0&&i.jsx("button",{type:"button",onClick:()=>p(),className:"p-1 rounded text-neutral-500 hover:text-neutral-300 hover:bg-neutral-700 transition-colors",title:"Clear",children:i.jsx(B3,{size:12})}),i.jsx("input",{ref:A,type:"text",value:E,onChange:P=>S(P.target.value),onKeyDown:F,placeholder:t,className:"flex-1 bg-transparent outline-none text-neutral-100 placeholder:text-neutral-500 caret-emerald-400",disabled:M}),M?i.jsx("button",{type:"button",onClick:()=>m(),className:"p-1.5 rounded text-amber-400 hover:bg-amber-900/20 transition-colors",title:"Stop",children:i.jsx(fE,{size:12})}):i.jsx("button",{type:"submit",disabled:!E.trim(),className:"text-[11px] px-2 py-1 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/30 hover:bg-emerald-500/20 disabled:opacity-30 disabled:cursor-default transition-colors",children:"Send"})]})]})]})}const Y3="modulepreload",G3=function(e){return"/"+e},M1={},Ad=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let m=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=u?.nonce||u?.getAttribute("nonce");o=m(n.map(h=>{if(h=G3(h),h in M1)return;M1[h]=!0;const p=h.endsWith(".css"),y=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const b=document.createElement("link");if(b.rel=p?"stylesheet":Y3,p||(b.as="script"),b.crossOrigin="",b.href=h,f&&b.setAttribute("nonce",f),document.head.appendChild(b),p)return new Promise((w,j)=>{b.addEventListener("load",w),b.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return o.then(u=>{for(const f of u||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})},K3={titleBarInset:0,dragRegionProps:{},onInteractiveMouseDown:void 0,isSSR:!0,apiBaseUrl:"",serviceApiUrl:""},X3=v.createContext(K3);function Rf(){return v.useContext(X3)}const J3={background:"#1a1a1a",foreground:"#abb2bf",cursor:"#528bff",cursorAccent:"#1a1a1a",selectionBackground:"#3e4451",selectionForeground:"#abb2bf",black:"#1a1a1a",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"},Q3=`
66
- .xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
67
- .xterm.focus, .xterm:focus { outline: none; }
68
- .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
69
- .xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; }
70
- .xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
71
- .xterm .composition-view.active { display: block; }
72
- .xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
73
- .xterm .xterm-screen { position: relative; }
74
- .xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
75
- .xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
76
- .xterm.enable-mouse-events { cursor: default; }
77
- .xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
78
- .xterm.column-select.focus { cursor: crosshair; }
79
- .xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
80
- .xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
81
- .xterm .xterm-accessibility-tree { font-family: monospace; user-select: text; white-space: pre; }
82
- .xterm .xterm-accessibility-tree > div { transform-origin: left; width: fit-content; }
83
- .xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
84
- .xterm-dim { opacity: 1 !important; }
85
- .xterm-underline-1 { text-decoration: underline; }
86
- .xterm-underline-2 { text-decoration: double underline; }
87
- .xterm-underline-3 { text-decoration: wavy underline; }
88
- .xterm-underline-4 { text-decoration: dotted underline; }
89
- .xterm-underline-5 { text-decoration: dashed underline; }
90
- .xterm-overline { text-decoration: overline; }
91
- .xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
92
- .xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
93
- .xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
94
- .xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
95
- .xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
96
- .xterm-strikethrough { text-decoration: line-through; }
97
- .xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
98
- .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
99
- .xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
100
- .xterm-decoration-top { z-index: 2; position: relative; }
101
- .xterm .xterm-scrollable-element > .scrollbar { cursor: default; }
102
- .xterm .xterm-scrollable-element > .scrollbar > .scra { cursor: pointer; font-size: 11px !important; }
103
- .xterm .xterm-scrollable-element > .visible { opacity: 1; background: rgba(0,0,0,0); transition: opacity 100ms linear; z-index: 11; }
104
- .xterm .xterm-scrollable-element > .invisible { opacity: 0; pointer-events: none; }
105
- .xterm .xterm-scrollable-element > .invisible.fade { transition: opacity 800ms linear; }
106
- .xterm .xterm-scrollable-element > .shadow { position: absolute; display: none; }
107
- .xterm .xterm-scrollable-element > .shadow.top { display: block; top: 0; left: 3px; height: 3px; width: 100%; }
108
- .xterm .xterm-scrollable-element > .shadow.left { display: block; top: 3px; left: 0; height: 100%; width: 3px; }
109
- `;function eP(){if(typeof document>"u"||document.querySelector("[data-xterm-css]"))return;const e=document.createElement("style");e.setAttribute("data-xterm-css",""),e.textContent=Q3,document.head.appendChild(e)}function tP(e){return new Promise((t,n)=>{const a=new FileReader;a.onload=()=>{const o=a.result;t(o.split(",")[1])},a.onerror=n,a.readAsDataURL(e)})}function _v({relay:e,fontSize:t=12,fontFamily:n="'JetBrains Mono', 'Hack Nerd Font', monospace",configItems:a,onOpenSettings:o,onStartService:l,quiet:u=!1}){const{status:f,error:m,exitCode:h,cwd:p,setCwd:y,sendInput:b,resize:w,onData:j,connect:N,disconnect:C}=e,[k,E]=v.useState(!1),{apiBaseUrl:S}=Rf(),R=v.useRef(null),A=v.useRef(null),M=v.useRef(null),D=v.useRef(null),[U,F]=v.useState(!1),[P,_]=v.useState(!1),z=v.useRef(0);v.useEffect(()=>{const W=R.current;if(!W)return;const Q=ce=>{ce.key===" "&&!ce.metaKey&&!ce.ctrlKey&&!ce.altKey&&ce.stopPropagation()};return W.addEventListener("keydown",Q),()=>W.removeEventListener("keydown",Q)},[]);const B=`${S}/api/relay/upload`,V=v.useCallback(async W=>{try{const Q=await tP(W),ce=await fetch(B,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:W.name,data:Q})}),{path:ae}=await ce.json();return ae||null}catch(Q){return console.error("File upload failed:",Q),null}},[B]);v.useEffect(()=>{const W=R.current;if(!W)return;const Q=async ce=>{if(!ce.clipboardData)return;const ae=Array.from(ce.clipboardData.items).filter(ge=>ge.type.startsWith("image/"));if(ae.length!==0){ce.preventDefault(),ce.stopPropagation();for(const ge of ae){const ye=ge.getAsFile();if(!ye)continue;const be=await V(ye);be&&b(be)}}};return W.addEventListener("paste",Q),()=>W.removeEventListener("paste",Q)},[b,V]);const K=v.useCallback(W=>{W.preventDefault(),W.dataTransfer.dropEffect="copy"},[]),L=v.useCallback(W=>{W.preventDefault(),z.current++,W.dataTransfer.types.includes("Files")&&_(!0)},[]),H=v.useCallback(W=>{W.preventDefault(),z.current--,z.current===0&&_(!1)},[]),$=v.useCallback(async W=>{W.preventDefault(),z.current=0,_(!1);const Q=Array.from(W.dataTransfer.files).filter(ce=>ce.type.startsWith("image/"));if(Q.length!==0)for(const ce of Q){const ae=await V(ce);ae&&b(ae)}},[b,V]);v.useEffect(()=>{let W=!1,Q=null;async function ce(){const[{Terminal:ae},{FitAddon:ge},ye]=await Promise.all([Ad(()=>import("./xterm-B-qIQCd3.js"),[]),Ad(()=>import("./addon-fit-DX4qG4td.js"),[]),Ad(()=>import("./addon-webgl-DCtw1yLn.js"),[]).catch(()=>null)]);if(eP(),W||!A.current)return;Q=new ae({fontSize:t,fontFamily:n,theme:J3,cursorBlink:!0,cursorStyle:"bar",allowTransparency:!0,scrollback:5e3,convertEol:!1,allowProposedApi:!0});const be=new ge;if(Q.loadAddon(be),Q.open(A.current),ye)try{const Oe=new ye.WebglAddon;Oe.onContextLoss(()=>{Oe.dispose()}),Q.loadAddon(Oe)}catch{}try{be.fit()}catch{}M.current=Q,D.current=be,w(Q.cols,Q.rows),Q.onData(Oe=>{b(Oe)}),F(!0)}return ce(),()=>{W=!0,Q&&(Q.dispose(),M.current=null,D.current=null)}},[]),v.useEffect(()=>{const W=M.current;if(W){W.options.fontSize=t,W.options.fontFamily=n;try{D.current?.fit()}catch{}}},[t,n]),v.useEffect(()=>{if(U)return j(W=>{M.current?.write(W)}),()=>{j(null)}},[U,j]),v.useEffect(()=>{const W=A.current;if(!W||!U)return;const Q=new ResizeObserver(()=>{const ce=D.current,ae=M.current;if(!(!ce||!ae))try{ce.fit(),w(ae.cols,ae.rows)}catch{}});return Q.observe(W),()=>Q.disconnect()},[U,w]),v.useEffect(()=>{f==="connected"&&M.current&&M.current.focus()},[f]);const G=v.useCallback(()=>{f==="connected"&&M.current&&M.current.focus()},[f]),X=f==="error"&&m==="Relay service is not running",O=v.useCallback(async()=>{if(l){E(!0);try{await l()&&setTimeout(()=>N(),500)}finally{E(!1)}}},[l,N]);let Z=null;return X?Z=i.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:i.jsx("span",{className:"text-amber-400 text-[14px]",children:"!"})}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[12px] text-neutral-300 font-medium mb-1",children:"Relay service not running"}),i.jsx("div",{className:"text-[11px] text-neutral-500 leading-relaxed",children:l?"Start the relay service to open a terminal session.":"Start the relay service from the Workspace Manager."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[l&&i.jsx("button",{type:"button",onClick:O,disabled:k,className:"text-[11px] px-4 py-1.5 rounded-full border border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10 transition-colors font-medium disabled:opacity-50",children:k?"Starting...":"Start Service"}),i.jsx("button",{type:"button",onClick:()=>N(),className:"text-[11px] px-3 py-1.5 rounded-full border border-neutral-700 text-neutral-400 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Retry"}),o&&i.jsx("button",{type:"button",onClick:o,className:"text-[11px] px-3 py-1.5 rounded-full border border-neutral-700 text-neutral-400 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Settings"})]})]}):f==="error"&&m?Z=i.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-md text-center px-4",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/10 flex items-center justify-center",children:i.jsx("span",{className:"text-red-400 text-sm",children:"!"})}),i.jsx("span",{className:"text-red-400 text-[12px] font-medium",children:"Session failed"}),i.jsx("code",{className:"text-[11px] text-neutral-400 bg-neutral-800/80 px-3 py-2 rounded-md whitespace-pre-wrap leading-relaxed max-h-32 overflow-y-auto w-full text-left",children:m}),h!==null&&h!==0&&i.jsxs("span",{className:"text-[10px] text-neutral-600",children:["Exit code ",h]}),i.jsx("button",{type:"button",onClick:()=>N(),className:"text-[11px] px-3 py-1 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors",children:"Retry"})]}):f==="disconnected"&&!u?Z=i.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-neutral-800 border border-neutral-700 flex items-center justify-center",children:i.jsx("span",{className:"text-neutral-500 text-[14px]",children:"▷"})}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[12px] text-neutral-300 font-medium mb-1",children:"Terminal relay disconnected"}),i.jsx("div",{className:"text-[11px] text-neutral-500 leading-relaxed",children:"Set working directory and connect."})]}),i.jsxs("form",{className:"w-full",onSubmit:W=>{W.preventDefault(),N()},children:[i.jsx("label",{className:"text-[10px] font-mono text-neutral-500 uppercase tracking-wider mb-1 block text-left",children:"Working Directory"}),i.jsx("input",{type:"text",value:p,onChange:W=>y(W.target.value),placeholder:"~/dev/my-project",className:"w-full bg-neutral-800/80 border border-neutral-700/50 rounded px-3 py-1.5 text-[11px] font-mono text-neutral-200 placeholder:text-neutral-600 outline-none focus:border-cyan-500/40 transition-colors",spellCheck:!1,autoComplete:"off"})]}),a&&a.length>0&&i.jsx("div",{className:"w-full grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[10px] font-mono bg-neutral-800/60 border border-neutral-700/40 rounded-md px-3 py-2",children:a.map(W=>i.jsxs("div",{className:"contents",children:[i.jsx("span",{className:"text-neutral-500",children:W.label}),i.jsx("span",{className:"text-neutral-400 truncate text-left",children:W.value})]},W.label))}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>N(),className:"text-[11px] px-4 py-1.5 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors font-medium",children:"Connect"}),o&&i.jsx("button",{type:"button",onClick:o,className:"text-[11px] px-3 py-1.5 rounded-full border border-neutral-700 text-neutral-400 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Settings"})]})]}):f==="connecting"&&!u&&(Z=i.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[i.jsx("div",{className:"w-6 h-6 border-2 border-neutral-600 border-t-cyan-400 rounded-full animate-spin"}),i.jsx("span",{className:"text-[12px] text-neutral-400",children:"Connecting to relay..."}),i.jsx("button",{type:"button",onClick:()=>{C()},className:"text-[10px] px-3 py-1 rounded-full border border-neutral-700 text-neutral-500 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Cancel"})]})),i.jsxs("div",{ref:R,className:"relative flex flex-col h-full overflow-hidden",onClick:G,onDragOver:K,onDragEnter:L,onDragLeave:H,onDrop:$,children:[Z&&i.jsx("div",{className:"flex items-center justify-center h-full font-mono text-[12px] absolute inset-0 z-10 bg-neutral-900/90",children:Z}),P&&i.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-cyan-500/10 border-2 border-dashed border-cyan-500/50 rounded pointer-events-none",children:i.jsx("span",{className:"text-cyan-400 font-mono text-sm",children:"Drop image to get path"})}),i.jsx("div",{ref:A,className:"flex-1 min-h-0 min-w-0 overflow-hidden",style:{visibility:Z?"hidden":"visible",padding:"4px 8px"}})]})}function nP({app:e,commands:t,state:n,relayUrl:a="ws://localhost:3600",cwd:o,agent:l="pi",provider:u,model:f,backend:m="pty",tmuxSession:h,workspaceFiles:p,onOpenSettings:y,onStartService:b,voiceKit:w}){const[j,N]=Ca(`assistant.${e.id}.mode`,"relay"),[C,k]=v.useState(""),[E,S]=Ca(`assistant.${e.id}.voice.speakReplies`,w?.settings.speakReplies??!1),{serviceApiUrl:R}=Rf(),A=v.useMemo(()=>aP(e),[e]),M=Mv({url:a,systemPrompt:A,cwd:o,workspaceFiles:p,sessionKey:`assistant-${e.id}`,backend:m,tmuxSession:h,agent:l,provider:l==="pi"?u:void 0,model:l==="pi"?f:void 0}),D=v.useCallback(async()=>{if(b)return b();try{return(await(await fetch(`${R}/api/services/execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceId:"relay",action:"start",triggeredBy:"assistant"})})).json()).success===!0}catch{return!1}},[b,R]),U=v.useMemo(()=>{const $=[{label:"Relay",value:a},{label:"Agent",value:l}];return o&&$.push({label:"CWD",value:o}),l==="pi"&&f&&$.push({label:"Model",value:f}),$},[a,l,o,f]),[F,P]=v.useState("text"),_=e3({app:e,commands:t,state:n,provider:u,model:f,onFinish:({message:$,isAbort:G,isDisconnect:X,isError:O})=>{!w||!E||G||X||O||$.role==="assistant"&&w.speakReply($,{surface:"hudson-assistant",appId:e.id,source:F})}}),z=v.useCallback($=>{if(!w)return;const G=[C.trim(),$].filter(Boolean).join(" ");w.settings.autoSend&&_.status!=="streaming"&&_.status!=="submitted"?(k(""),P("voice"),_.sendMessage({text:G})):k(G)},[w,C,_]),B=v.useCallback(()=>{w&&(w.input.status==="recording"?w.input.stop():w.input.start(z))},[w,z]),V=e.intents?.length??0,K=!!w,L=w?.input.status==="transcribing",H=w?.input.status==="recording";return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-neutral-700/50 bg-neutral-900/50",children:[i.jsx(z3,{size:11,className:"text-cyan-400/60"}),i.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-neutral-500",children:"Assistant"}),i.jsxs("span",{className:"text-[10px] font-mono text-neutral-600",children:["· ",e.name]}),i.jsx("div",{className:"flex-1"}),K&&j==="chat"&&i.jsx("button",{type:"button",onClick:()=>{E&&w?.output.stop(),S(!E)},className:`p-1 rounded transition-colors ${E?"text-cyan-300 hover:text-cyan-200":"text-neutral-500 hover:text-neutral-300"}`,title:E?"Speaker on (click to mute)":"Speaker off (click to enable)",children:w?.output.isPlaying?i.jsx(A1,{size:12,className:"animate-spin"}):E?i.jsx(H3,{size:12}):i.jsx(Z3,{size:12})}),i.jsxs("div",{className:"flex items-center gap-1 rounded-full border border-neutral-700 p-0.5",children:[i.jsx(_1,{active:j==="relay",onClick:()=>N("relay"),children:"Relay"}),i.jsx(_1,{active:j==="chat",onClick:()=>N("chat"),children:"Chat"})]}),j==="relay"&&M.status==="connected"&&i.jsx("button",{type:"button",onClick:()=>M.restart(),className:"text-[10px] px-2 py-0.5 rounded-full border text-cyan-400 border-cyan-500/30 hover:bg-cyan-500/10 transition-colors",title:"Kill session and start fresh",children:"Restart"}),j==="relay"&&M.status==="connected"&&i.jsx("button",{type:"button",onClick:()=>M.disconnect(),className:"text-[10px] px-2 py-0.5 rounded-full border text-red-400 border-red-500/30 hover:bg-red-500/10 transition-colors",children:"Disconnect"}),j==="relay"&&M.status!=="connected"&&M.status!=="connecting"&&i.jsx("button",{type:"button",onClick:()=>M.connect(),className:"text-[10px] px-2 py-0.5 rounded-full border text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/10 transition-colors",children:"Connect"})]}),i.jsx("div",{className:"flex-1 min-h-0",children:j==="relay"?i.jsx(_v,{relay:M,configItems:U,onOpenSettings:y,onStartService:D}):i.jsx(W3,{chat:_,placeholder:V===0?`Ask about ${e.name} — no intents declared, conversation only.`:`Ask ${e.name} to do something… (${V} intent${V===1?"":"s"})`,inputValue:C,onInputChange:$=>{F==="voice"&&$.length===0&&P("text"),k($)},inputExtras:K&&w?.input.isSupported?i.jsx("button",{type:"button",onClick:B,disabled:L,className:`p-1 rounded transition-colors disabled:opacity-30 ${H?"bg-red-500/15 text-red-300 hover:bg-red-500/20":"text-neutral-500 hover:text-cyan-400"}`,title:H?"Stop recording":"Record voice prompt",children:L?i.jsx(A1,{size:12,className:"animate-spin"}):H?i.jsx(fE,{size:11}):i.jsx(v3,{size:12})}):void 0,inputStatus:K&&w?i.jsx(sP,{inputStatus:w.input.status,inputError:w.input.error,outputStatus:w.output.status,outputError:w.output.error}):void 0})})]})}function sP({inputStatus:e,inputError:t,outputStatus:n,outputError:a}){const o=R1(e)??R1(n),l=t??a;return!o&&!l?null:i.jsxs("div",{className:"flex items-center gap-2",children:[o&&i.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full border font-mono ${o.className}`,children:o.label}),l&&i.jsx("span",{className:"text-[10px] text-neutral-500 truncate flex-1",title:l,children:l})]})}function R1(e){switch(e){case"recording":return{label:"listening",className:"border-red-500/20 bg-red-500/10 text-red-300"};case"transcribing":return{label:"transcribing",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"};case"ready":return{label:"draft ready",className:"border-cyan-500/20 bg-cyan-500/10 text-cyan-300"};case"synthesizing":return{label:"voicing",className:"border-cyan-500/20 bg-cyan-500/10 text-cyan-300"};case"speaking":return{label:"speaking",className:"border-emerald-500/20 bg-emerald-500/10 text-emerald-300"};case"unavailable":return{label:"voice offline",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"};case"error":return{label:"voice error",className:"border-red-500/20 bg-red-500/10 text-red-300"};default:return null}}function _1({active:e,onClick:t,children:n}){return i.jsx("button",{type:"button",onClick:t,className:`text-[10px] px-2 py-0.5 rounded-full transition-colors ${e?"bg-cyan-500/15 text-cyan-300":"text-neutral-500 hover:text-neutral-300"}`,children:n})}function aP(e){const t=[`You are working alongside the user inside the **${e.name}** Hudson app.`];e.description&&t.push(e.description);const n=e.intents??[];if(n.length>0){t.push("","## What this app can do (for context)");for(const a of n)t.push(`- ${a.title} — ${a.description}`);t.push("","These actions live inside the running app. You can describe them to the user, but you do not invoke them yourself — the user can trigger any of them via the command palette (Cmd+K).")}return t.push("","## How to behave","- Be terse. The user is in a terminal; respect their attention.","- Use your own tools (file ops, shell, etc.) freely if it helps.","- When asked to change something inside the app itself, prefer guiding the user to the matching command rather than hacking around it."),t.join(`
110
- `)}typeof window<"u"&&localStorage.getItem("frame_sounds");const _f={panels:{statusBar:"bg-neutral-950/95 backdrop-blur-xl border-t border-neutral-700 shadow-[0_-5px_30px_rgba(0,0,0,0.6),inset_0_1px_0_rgba(255,255,255,0.06)] fixed bottom-0 left-0 right-0 z-[60]"},zIndex:{drawer:70},layout:{navHeight:48,statusBarHeight:28}},rP=_f.panels;function Ov(){const{titleBarInset:e}=Rf();return v.useMemo(()=>{const t=_f.layout.navHeight+e;return{navTotalHeight:t,panelTopOffset:t}},[e])}const iP=({panOffset:e,scale:t,onPan:n,onPanStart:a,onPanEnd:o,isPanLocked:l=!1,onClick:u,showGuides:f=!1,onGuidesChange:m,gridOpacity:h=1})=>{const[p,y]=v.useState(f),[b,w]=v.useState(!1),j=v.useRef(!1),N=v.useRef({x:0,y:0}),C=v.useRef({active:!1,startX:0,startY:0}),k=v.useRef(null),E=v.useRef(null),S=v.useRef(null),R=4,A=v.useRef({x:0,y:0}),M=v.useRef(0),D=v.useRef(!1);v.useEffect(()=>{y(f)},[f]);const U=v.useCallback(X=>{const O=X;return O?O.tagName==="INPUT"||O.tagName==="TEXTAREA"||O.isContentEditable:!1},[]),F=v.useCallback(X=>{const O=X;return O?!!O.closest('button, [role="button"], a, input, textarea, select, [data-interactive="true"]'):!1},[]),P=v.useCallback(X=>{j.current=X,w(X)},[]);v.useEffect(()=>{const X=Q=>{if(M.current=Q.buttons,C.current.active&&(Q.buttons&1)!==1&&(C.current.active=!1),j.current&&(Q.buttons&1)!==1){P(!1),C.current.active=!1,o?.(),document.body.style.cursor="";return}if(l&&j.current){P(!1),C.current.active=!1,o?.(),document.body.style.cursor="";return}const ce=k.current?.getBoundingClientRect(),ae=ce?Q.clientX-ce.left:Q.clientX,ge=ce?Q.clientY-ce.top:Q.clientY;if(A.current={x:ae,y:ge},E.current&&(E.current.style.left=`${ae}px`),S.current&&(S.current.style.top=`${ge}px`),C.current.active&&!j.current){const ye=Q.clientX-C.current.startX,be=Q.clientY-C.current.startY;Math.hypot(ye,be)>=R&&(C.current.active=!1,P(!0),D.current=!0,a?.(),N.current={x:Q.clientX,y:Q.clientY},document.body.style.cursor="grabbing")}j.current&&(n({x:(Q.clientX-N.current.x)/t,y:(Q.clientY-N.current.y)/t}),N.current={x:Q.clientX,y:Q.clientY})},O=Q=>{M.current=Q.buttons,C.current.active=!1,j.current&&(P(!1),o?.(),document.body.style.cursor="")},Z=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.key==="\\"&&(Q.preventDefault(),y(ce=>{const ae=!ce;return m?.(ae),ae}))},W=()=>{C.current.active=!1,O(new MouseEvent("mouseup"))};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",O),window.addEventListener("keydown",Z),window.addEventListener("blur",W),document.addEventListener("visibilitychange",W),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",O),window.removeEventListener("keydown",Z),window.removeEventListener("blur",W),document.removeEventListener("visibilitychange",W)}},[n,o,a,t,U,F,l,P,m]),v.useEffect(()=>{!l||!j.current||(P(!1),o?.(),document.body.style.cursor="")},[l,o,P]);const _=X=>{D.current=!1,!(l||X.button!==0)&&(U(X.target)||F(X.target)||(M.current=X.buttons,C.current={active:!0,startX:X.clientX,startY:X.clientY},X.preventDefault()))},z=X=>{!D.current&&u&&u(X),D.current=!1},[B,V]=v.useState({w:0,h:0});v.useEffect(()=>{const X=()=>V({w:window.innerWidth,h:window.innerHeight});return X(),window.addEventListener("resize",X),()=>window.removeEventListener("resize",X)},[]);const K=Math.max(.4,Math.min(2,t)),L=100*K,H=20*K,$=(B.w/2+e.x*t)%L,G=(B.h/2+e.y*t)%L;return i.jsxs("div",{ref:k,className:`absolute inset-0 z-0 overflow-hidden bg-black ${b?"cursor-grabbing":"cursor-grab"}`,onMouseDown:_,onClick:z,children:[i.jsx("div",{className:"absolute pointer-events-none",style:{inset:"-100px",opacity:.5*h,transition:"opacity 1s ease",backgroundImage:"radial-gradient(circle, #444 1px, transparent 1px)",backgroundSize:`${H}px ${H}px`,backgroundPosition:`${$+100}px ${G+100}px`}}),i.jsx("div",{className:"absolute pointer-events-none",style:{inset:"-100px",opacity:.25*h,transition:"opacity 1s ease",backgroundImage:"radial-gradient(circle, #555 1.5px, transparent 1.5px)",backgroundSize:`${L}px ${L}px`,backgroundPosition:`${$+100}px ${G+100}px`}}),p&&i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:E,className:"absolute top-0 bottom-0 w-px pointer-events-none bg-emerald-500/10",style:{left:0}}),i.jsx("div",{ref:S,className:"absolute left-0 right-0 h-px pointer-events-none bg-emerald-500/10",style:{top:0}})]})]})},oP=({scale:e,onZoom:t,min:n=.2,max:a=3,step:o=.1})=>{const[l,u]=v.useState(!1),[f,m]=v.useState(""),h=v.useRef(null),p=v.useCallback(C=>Math.min(a,Math.max(n,C)),[n,a]),y=v.useCallback(()=>{t(p(e+o))},[e,o,t,p]),b=v.useCallback(()=>{t(p(e-o))},[e,o,t,p]),w=v.useCallback(()=>{m(Math.round(e*100).toString()),u(!0)},[e]),j=v.useCallback(()=>{u(!1);const C=parseInt(f,10);!isNaN(C)&&C>0&&t(p(C/100))},[f,t,p]),N=v.useCallback(C=>{C.key==="Enter"?j():C.key==="Escape"&&u(!1)},[j]);return v.useEffect(()=>{l&&h.current&&(h.current.focus(),h.current.select())},[l]),i.jsxs("div",{className:"pointer-events-auto flex flex-col items-center bg-neutral-950/95 backdrop-blur-xl border border-neutral-700/80 rounded-md shadow-[0_0_20px_rgba(0,0,0,0.6)] overflow-hidden",children:[i.jsx("button",{onClick:y,className:"w-9 h-8 flex items-center justify-center hover:bg-white/10 text-neutral-300 hover:text-white transition-colors",title:"Zoom in",children:i.jsx(O3,{size:14})}),i.jsx("div",{className:"w-full border-t border-b border-neutral-700/50",children:l?i.jsx("input",{ref:h,type:"text",value:f,onChange:C=>m(C.target.value.replace(/[^0-9]/g,"")),onBlur:j,onKeyDown:N,className:"w-9 py-1.5 text-center text-[11px] font-mono text-white bg-black/60 outline-none tabular-nums"}):i.jsxs("button",{onClick:w,className:"w-9 py-1.5 text-center text-[11px] font-mono text-neutral-200 hover:text-white hover:bg-white/10 transition-colors cursor-text tabular-nums",title:"Click to set zoom",children:[Math.round(e*100),"%"]})}),i.jsx("button",{onClick:b,className:"w-9 h-8 flex items-center justify-center hover:bg-white/10 text-neutral-300 hover:text-white transition-colors",title:"Zoom out",children:i.jsx(w3,{size:14})})]})},lP={...AN};let O1=0;function cP(e,t="mui"){const[n,a]=v.useState(e),o=e||n;return v.useEffect(()=>{n==null&&(O1+=1,a(`${t}-${O1}`))},[n,t]),o}const I1=lP.useId;function kr(e,t){if(I1!==void 0){const n=I1();return e??(t?`${t}-${n}`:n)}return cP(e,t)}function yi(e,...t){const n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(a=>n.searchParams.append("args[]",a)),`Base UI error #${e}; visit ${n} for the full message.`}const mE=v.createContext(void 0);function Of(e=!0){const t=v.useContext(mE);if(t===void 0&&!e)throw new Error(yi(25));return t}const pE=v.createContext(void 0);function gE(e){const t=v.useContext(pE);if(t===void 0&&!e)throw new Error(yi(33));return t}const Iv=v.createContext(void 0);function Vo(e){const t=v.useContext(Iv);if(t===void 0&&!e)throw new Error(yi(36));return t}const D1={};function Cs(e,t){const n=v.useRef(D1);return n.current===D1&&(n.current=e(t)),n}function vc(e,t,n,a){const o=Cs(vE).current;return dP(o,e,t,n,a)&&yE(o,[e,t,n,a]),o.callback}function uP(e){const t=Cs(vE).current;return fP(t,e)&&yE(t,e),t.callback}function vE(){return{callback:null,cleanup:null,refs:[]}}function dP(e,t,n,a,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==a||e.refs[3]!==o}function fP(e,t){return e.refs.length!==t.length||e.refs.some((n,a)=>n!==t[a])}function yE(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const a=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const l=t[o];if(l!=null)switch(typeof l){case"function":{const u=l(n);typeof u=="function"&&(a[o]=u);break}case"object":{l.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const l=t[o];if(l!=null)switch(typeof l){case"function":{const u=a[o];typeof u=="function"?u():l(null);break}case"object":{l.current=null;break}}}}}}}const hP=parseInt(v.version,10);function Dv(e){return hP>=e}function z1(e){if(!v.isValidElement(e))return null;const t=e,n=t.props;return(Dv(19)?n?.ref:t.ref)??null}function Eg(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function mP(e,t){const n={};for(const a in e){const o=e[a];if(t?.hasOwnProperty(a)){const l=t[a](o);l!=null&&Object.assign(n,l);continue}o===!0?n[`data-${a.toLowerCase()}`]="":o&&(n[`data-${a.toLowerCase()}`]=o.toString())}return n}function pP(e,t){return typeof e=="function"?e(t):e}function gP(e,t){return typeof e=="function"?e(t):e}const ec={};function If(e,t,n,a,o){let l={...Cg(e,ec)};return t&&(l=Md(l,t)),n&&(l=Md(l,n)),a&&(l=Md(l,a)),l}function vP(e){if(e.length===0)return ec;if(e.length===1)return Cg(e[0],ec);let t={...Cg(e[0],ec)};for(let n=1;n<e.length;n+=1)t=Md(t,e[n]);return t}function Md(e,t){return xE(t)?t(e):yP(e,t)}function yP(e,t){if(!t)return e;for(const n in t){const a=t[n];switch(n){case"style":{e[n]=Eg(e.style,a);break}case"className":{e[n]=bE(e.className,a);break}default:xP(n,a)?e[n]=bP(e[n],a):e[n]=a}}return e}function xP(e,t){const n=e.charCodeAt(0),a=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&a===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function xE(e){return typeof e=="function"}function Cg(e,t){return xE(e)?e(t):e??ec}function bP(e,t){return t?e?n=>{if(wP(n)){const o=n;Tg(o);const l=t(o);return o.baseUIHandlerPrevented||e?.(o),l}const a=t(n);return e?.(n),a}:t:e}function Tg(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function bE(e,t){return t?e?t+" "+e:t:e}function wP(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function wE(){}const jE=Object.freeze([]),Kn=Object.freeze({}),jP=500,SP={style:{transition:"none"}},NP="data-base-ui-click-trigger",kP={fallbackAxisSide:"none"},EP={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function Er(e,t,n={}){const a=t.render,o=CP(t,n);if(n.enabled===!1)return null;const l=n.state??Kn;return TP(e,a,o,l)}function CP(e,t={}){const{className:n,style:a,render:o}=e,{state:l=Kn,ref:u,props:f,stateAttributesMapping:m,enabled:h=!0}=t,p=h?pP(n,l):void 0,y=h?gP(a,l):void 0,b=h?mP(l,m):Kn,w=h?Eg(b,Array.isArray(f)?vP(f):f)??Kn:Kn;return typeof document<"u"&&(h?Array.isArray(u)?w.ref=uP([w.ref,z1(o),...u]):w.ref=vc(w.ref,z1(o),u):vc(null,null)),h?(p!==void 0&&(w.className=bE(w.className,p)),y!==void 0&&(w.style=Eg(w.style,y)),w):Kn}function TP(e,t,n,a){if(t){if(typeof t=="function")return t(n,a);const o=If(n,t.props);return o.ref=n.ref,v.cloneElement(t,o)}return AP(e,n)}function AP(e,t){return v.createElement(e,t)}let Jd=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const MP={[Jd.startingStyle]:""},RP={[Jd.endingStyle]:""},_P={transitionStatus(e){return e==="starting"?MP:e==="ending"?RP:null}};let zv=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Jd.startingStyle]="startingStyle",e[e.endingStyle=Jd.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),P1=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const OP={[P1.popupOpen]:"",[P1.pressed]:""},IP={[zv.open]:""},DP={[zv.closed]:""},zP={[zv.anchorHidden]:""},PP={open(e){return e?OP:null}},SE={open(e){return e?IP:DP},anchorHidden(e){return e?zP:null}},LP="none",Qd="trigger-press",ri="trigger-hover",L1="trigger-focus",Pv="outside-press",NE="item-press",Df="focus-out",kE="escape-key",Rd="list-navigation",$P="cancel-open",Gl="sibling-open",UP="imperative-action",yp=AN[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],BP=yp&&yp!==v.useLayoutEffect?yp:e=>e();function qe(e){const t=Cs(VP).current;return t.next=e,BP(t.effect),t.trampoline}function VP(){const e={next:void 0,callback:HP,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function HP(){}function zf(){return typeof window<"u"}function Cr(e){return Lv(e)?(e.nodeName||"").toLowerCase():"#document"}function An(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ia(e){var t;return(t=(Lv(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Lv(e){return zf()?e instanceof Node||e instanceof An(e).Node:!1}function It(e){return zf()?e instanceof Element||e instanceof An(e).Element:!1}function Qt(e){return zf()?e instanceof HTMLElement||e instanceof An(e).HTMLElement:!1}function Ag(e){return!zf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof An(e).ShadowRoot}const FP=new Set(["inline","contents"]);function xi(e){const{overflow:t,overflowX:n,overflowY:a,display:o}=us(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!FP.has(o)}const ZP=new Set(["table","td","th"]);function qP(e){return ZP.has(Cr(e))}const WP=[":popover-open",":modal"];function Pf(e){return WP.some(t=>{try{return e.matches(t)}catch{return!1}})}const YP=["transform","translate","scale","rotate","perspective"],GP=["transform","translate","scale","rotate","perspective","filter"],KP=["paint","layout","strict","content"];function $v(e){const t=Lf(),n=It(e)?us(e):e;return YP.some(a=>n[a]?n[a]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||GP.some(a=>(n.willChange||"").includes(a))||KP.some(a=>(n.contain||"").includes(a))}function XP(e){let t=aa(e);for(;Qt(t)&&!ea(t);){if($v(t))return t;if(Pf(t))return null;t=aa(t)}return null}function Lf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const JP=new Set(["html","body","#document"]);function ea(e){return JP.has(Cr(e))}function us(e){return An(e).getComputedStyle(e)}function $f(e){return It(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function aa(e){if(Cr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ag(e)&&e.host||ia(e);return Ag(t)?t.host:t}function EE(e){const t=aa(e);return ea(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qt(t)&&xi(t)?t:EE(t)}function gr(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=EE(e),l=o===((a=e.ownerDocument)==null?void 0:a.body),u=An(o);if(l){const f=Mg(u);return t.concat(u,u.visualViewport||[],xi(o)?o:[],f&&n?gr(f):[])}return t.concat(o,gr(o,[],n))}function Mg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const QP=()=>{},Fe=typeof document<"u"?v.useLayoutEffect:QP,eL=v.createContext(void 0);function tL(e=!1){const t=v.useContext(eL);if(t===void 0&&!e)throw new Error(yi(16));return t}function nL(e){const{focusableWhenDisabled:t,disabled:n,composite:a=!1,tabIndex:o=0,isNativeButton:l}=e,u=a&&t!==!1,f=a&&t===!1;return{props:v.useMemo(()=>{const h={onKeyDown(p){n&&t&&p.key!=="Tab"&&p.preventDefault()}};return a||(h.tabIndex=o,!l&&n&&(h.tabIndex=t?o:-1)),(l&&(t||u)||!l&&n)&&(h["aria-disabled"]=n),l&&(!t||f)&&(h.disabled=n),h},[a,n,t,u,f,l,o])}}function sL(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:a=0,native:o=!0}=e,l=v.useRef(null),u=tL(!0)!==void 0,f=qe(()=>{const b=l.current;return!!(b?.tagName==="A"&&b?.href)}),{props:m}=nL({focusableWhenDisabled:n,disabled:t,composite:u,tabIndex:a,isNativeButton:o}),h=v.useCallback(()=>{const b=l.current;aL(b)&&u&&t&&m.disabled===void 0&&b.disabled&&(b.disabled=!1)},[t,m.disabled,u]);Fe(h,[h]);const p=v.useCallback((b={})=>{const{onClick:w,onMouseDown:j,onKeyUp:N,onKeyDown:C,onPointerDown:k,...E}=b;return If({type:o?"button":void 0,onClick(R){if(t){R.preventDefault();return}w?.(R)},onMouseDown(R){t||j?.(R)},onKeyDown(R){if(t||(Tg(R),C?.(R)),R.baseUIHandlerPrevented)return;const A=R.target===R.currentTarget&&!o&&!f()&&!t,M=R.key==="Enter",D=R.key===" ";A&&((D||M)&&R.preventDefault(),M&&w?.(R))},onKeyUp(R){t||(Tg(R),N?.(R)),!R.baseUIHandlerPrevented&&R.target===R.currentTarget&&!o&&!t&&R.key===" "&&w?.(R)},onPointerDown(R){if(t){R.preventDefault();return}k?.(R)}},o?void 0:{role:"button"},m,E)},[t,m,o,f]),y=qe(b=>{l.current=b,h()});return{getButtonProps:p,buttonRef:y}}function aL(e){return Qt(e)&&e.tagName==="BUTTON"}const rL={type:"regular-item"};function iL(e){const{closeOnClick:t,disabled:n=!1,highlighted:a,id:o,store:l,nativeButton:u,itemMetadata:f,nodeId:m}=e,h=v.useRef(null),p=Of(!0),y=p!==void 0,{events:b}=l.useState("floatingTreeRoot"),{getButtonProps:w,buttonRef:j}=sL({disabled:n,focusableWhenDisabled:!0,native:u}),N=v.useCallback(k=>If({id:o,role:"menuitem",tabIndex:a?0:-1,onMouseMove(E){m&&b.emit("itemhover",{nodeId:m,target:E.currentTarget})},onMouseEnter(){f.type==="submenu-trigger"&&f.setActive()},onKeyUp(E){E.key===" "&&l.context.typingRef.current&&E.preventBaseUIHandler()},onClick(E){t&&b.emit("close",{domEvent:E,reason:NE})},onMouseUp(E){if(p){const S=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,y&&S&&Math.abs(E.clientX-S.x)<=1&&Math.abs(E.clientY-S.y)<=1)return}h.current&&l.context.allowMouseUpTriggerRef.current&&(!y||E.button===2)&&f.type==="regular-item"&&h.current.click()}},k,w),[o,a,w,t,b,l,y,p,f,m]),C=vc(h,j);return v.useMemo(()=>({getItemProps:N,itemRef:C}),[N,C])}const CE=v.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function oL(){return v.useContext(CE)}let lL=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function cL(e={}){const{label:t,metadata:n,textRef:a,indexGuessBehavior:o,index:l}=e,{register:u,unregister:f,subscribeMapChange:m,elementsRef:h,labelsRef:p,nextIndexRef:y}=oL(),b=v.useRef(-1),[w,j]=v.useState(l??(o===lL.GuessFromOrder?()=>{if(b.current===-1){const k=y.current;y.current+=1,b.current=k}return b.current}:-1)),N=v.useRef(null),C=v.useCallback(k=>{if(N.current=k,w!==-1&&k!==null&&(h.current[w]=k,p)){const E=t!==void 0;p.current[w]=E?t:a?.current?.textContent??k.textContent}},[w,h,p,t,a]);return Fe(()=>{if(l!=null)return;const k=N.current;if(k)return u(k,n),()=>{f(k)}},[l,u,f,n]),Fe(()=>{if(l==null)return m(k=>{const E=N.current?k.get(N.current)?.index:null;E!=null&&j(E)})},[l,m,j]),v.useMemo(()=>({ref:C,index:w}),[w,C])}function TE(e){return kr(e,"base-ui")}function rn(e,t,n,a){let o=!1,l=!1;const u=Kn;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){l=!0},get isCanceled(){return o},get isPropagationAllowed(){return l},trigger:n,...u}}var hi=MN();const uL=[];function AE(e){v.useEffect(e,uL)}const Qu=null;class dL{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,a=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,a>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const ed=new dL;class Js{static create(){return new Js}static request(t){return ed.request(t)}static cancel(t){return ed.cancel(t)}currentId=Qu;request(t){this.cancel(),this.currentId=ed.request(()=>{this.currentId=Qu,t()})}cancel=()=>{this.currentId!==Qu&&(ed.cancel(this.currentId),this.currentId=Qu)};disposeEffect=()=>this.cancel}function Uv(){const e=Cs(Js.create).current;return AE(e.disposeEffect),e}function fL(e,t=!1,n=!1){const[a,o]=v.useState(e&&t?"idle":void 0),[l,u]=v.useState(e);return e&&!l&&(u(!0),o("starting")),!e&&l&&a!=="ending"&&!n&&o("ending"),!e&&!l&&a==="ending"&&o(void 0),Fe(()=>{if(!e&&l&&a!=="ending"&&n){const f=Js.request(()=>{o("ending")});return()=>{Js.cancel(f)}}},[e,l,a,n]),Fe(()=>{if(!e||t)return;const f=Js.request(()=>{hi.flushSync(()=>{o(void 0)})});return()=>{Js.cancel(f)}},[t,e]),Fe(()=>{if(!e||!t)return;e&&l&&a!=="idle"&&o("starting");const f=Js.request(()=>{o("idle")});return()=>{Js.cancel(f)}},[t,e,l,o,a]),v.useMemo(()=>({mounted:l,setMounted:u,transitionStatus:a}),[l,a])}function Yn(e){const t=Cs(hL,e).current;return t.next=e,Fe(t.effect),t}function hL(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function Jr(e){return e==null?e:"current"in e?e.current:e}function mL(e,t=!1,n=!0){const a=Uv();return qe((o,l=null)=>{a.cancel();const u=Jr(e);u!=null&&(typeof u.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?o():a.request(()=>{function f(){u&&Promise.all(u.getAnimations().map(m=>m.finished)).then(()=>{l!=null&&l.aborted||hi.flushSync(o)}).catch(()=>{if(n){if(l!=null&&l.aborted)return;hi.flushSync(o)}else u.getAnimations().length>0&&u.getAnimations().some(m=>m.pending||m.playState!=="finished")&&f()})}t?a.request(f):f()}))})}function ME(e){const{enabled:t=!0,open:n,ref:a,onComplete:o}=e,l=Yn(n),u=qe(o),f=mL(a,n);v.useEffect(()=>{t&&f(()=>{n===l.current&&u()})},[t,n,u,f,l])}const RE=v.createContext(void 0);function pL(){const e=v.useContext(RE);if(e===void 0)throw new Error(yi(31));return e}const gL=v.forwardRef(function(t,n){const{render:a,className:o,...l}=t,[u,f]=v.useState(void 0),m=v.useMemo(()=>({setLabelId:f}),[f]),h=Er("div",t,{ref:n,props:{role:"group","aria-labelledby":u,...l}});return i.jsx(RE.Provider,{value:m,children:h})}),vL=v.forwardRef(function(t,n){const{className:a,render:o,id:l,...u}=t,f=TE(l),{setLabelId:m}=pL();return Fe(()=>(m(f),()=>{m(void 0)}),[m,f]),Er("div",t,{ref:n,props:{id:f,role:"presentation",...u}})}),yL=v.forwardRef(function(t,n){const{render:a,className:o,id:l,label:u,nativeButton:f=!1,disabled:m=!1,closeOnClick:h=!0,...p}=t,y=cL({label:u}),b=gE(!0),w=TE(l),{store:j}=Vo(),N=j.useState("isActive",y.index),C=j.useState("itemProps"),{getItemProps:k,itemRef:E}=iL({closeOnClick:h,disabled:m,highlighted:N,id:w,store:j,nativeButton:f,nodeId:b?.nodeId,itemMetadata:rL}),S=v.useMemo(()=>({disabled:m,highlighted:N}),[m,N]);return Er("div",t,{state:S,props:[C,p,k],ref:[E,n,y.ref]})}),$l=0;class zo{static create(){return new zo}currentId=$l;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=$l,n()},t)}isStarted(){return this.currentId!==$l}clear=()=>{this.currentId!==$l&&(clearTimeout(this.currentId),this.currentId=$l)};disposeEffect=()=>this.clear}function Bs(){const e=Cs(zo.create).current;return AE(e.disposeEffect),e}const Ho=typeof navigator<"u",xp=SL(),_E=kL(),OE=NL(),xL=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),bL=xp.platform==="MacIntel"&&xp.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(xp.platform),wL=Ho&&/apple/i.test(navigator.vendor),Rg=Ho&&/android/i.test(_E)||/android/i.test(OE);Ho&&_E.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const jL=OE.includes("jsdom/");function SL(){if(!Ho)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function NL(){if(!Ho)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function kL(){if(!Ho)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const _g="data-base-ui-focusable",IE="active",DE="selected",zE="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",vr="ArrowLeft",yr="ArrowRight",Bv="ArrowUp",Ac="ArrowDown";function fr(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Ot(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Ag(n)){let a=t;for(;a;){if(e===a)return!0;a=a.parentNode||a.host}}return!1}function Gn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function zs(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function EL(e){return e.matches("html,body")}function Cn(e){return e?.ownerDocument||document}function CL(e){return Qt(e)&&e.matches(zE)}function Og(e){return e?e.getAttribute("role")==="combobox"&&CL(e):!1}function ef(e){return e?e.hasAttribute(_g)?e:e.querySelector(`[${_g}]`)||e:null}function Ao(e,t,n=!0){return e.filter(o=>o.parentId===t&&(!n||o.context?.open)).flatMap(o=>[o,...Ao(e,o.id,n)])}function $1(e,t){let n=[],a=e.find(o=>o.id===t)?.parentId;for(;a;){const o=e.find(l=>l.id===a);a=o?.parentId,o&&(n=n.concat(o))}return n}function Tn(e){e.preventDefault(),e.stopPropagation()}function TL(e){return"nativeEvent"in e}function PE(e){return e.mozInputSource===0&&e.isTrusted?!0:Rg&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function LE(e){return jL?!1:!Rg&&e.width===0&&e.height===0||Rg&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function AL(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function ML(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const RL=["top","right","bottom","left"],Po=Math.min,os=Math.max,tf=Math.round,jo=Math.floor,ta=e=>({x:e,y:e}),_L={left:"right",right:"left",bottom:"top",top:"bottom"},OL={start:"end",end:"start"};function Ig(e,t,n){return os(e,Po(t,n))}function Ra(e,t){return typeof e=="function"?e(t):e}function ls(e){return e.split("-")[0]}function Tr(e){return e.split("-")[1]}function Vv(e){return e==="x"?"y":"x"}function Hv(e){return e==="y"?"height":"width"}const IL=new Set(["top","bottom"]);function Ss(e){return IL.has(ls(e))?"y":"x"}function Fv(e){return Vv(Ss(e))}function DL(e,t,n){n===void 0&&(n=!1);const a=Tr(e),o=Fv(e),l=Hv(o);let u=o==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=nf(u)),[u,nf(u)]}function zL(e){const t=nf(e);return[Dg(e),t,Dg(t)]}function Dg(e){return e.replace(/start|end/g,t=>OL[t])}const U1=["left","right"],B1=["right","left"],PL=["top","bottom"],LL=["bottom","top"];function $L(e,t,n){switch(e){case"top":case"bottom":return n?t?B1:U1:t?U1:B1;case"left":case"right":return t?PL:LL;default:return[]}}function UL(e,t,n,a){const o=Tr(e);let l=$L(ls(e),n==="start",a);return o&&(l=l.map(u=>u+"-"+o),t&&(l=l.concat(l.map(Dg)))),l}function nf(e){return e.replace(/left|right|bottom|top/g,t=>_L[t])}function BL(e){return{top:0,right:0,bottom:0,left:0,...e}}function $E(e){return typeof e!="number"?BL(e):{top:e,right:e,bottom:e,left:e}}function sf(e){const{x:t,y:n,width:a,height:o}=e;return{width:a,height:o,top:n,left:t,right:t+a,bottom:n+o,x:t,y:n}}function td(e,t,n){return Math.floor(e/t)!==n}function tc(e,t){return t<0||t>=e.current.length}function bp(e,t){return Rn(e,{disabledIndices:t})}function V1(e,t){return Rn(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Rn(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:a,amount:o=1}={}){let l=t;do l+=n?-o:o;while(l>=0&&l<=e.current.length-1&&nc(e,l,a));return l}function VL(e,{event:t,orientation:n,loopFocus:a,rtl:o,cols:l,disabledIndices:u,minIndex:f,maxIndex:m,prevIndex:h,stopEvent:p=!1}){let y=h;const b=[],w={};let j=!1;{let k=null,E=-1;e.current.forEach((S,R)=>{if(S==null)return;const A=S.closest('[role="row"]');A&&(j=!0),(A!==k||E===-1)&&(k=A,E+=1,b[E]=[]),b[E].push(R),w[R]=E})}const N=j&&b.length>0&&b.some(k=>k.length!==l);function C(k){if(!N||h===-1)return;const E=w[h];if(E==null)return;const S=b[E].indexOf(h);let R=k==="up"?E-1:E+1;a&&(R<0?R=b.length-1:R>=b.length&&(R=0));const A=new Set;for(;R>=0&&R<b.length&&!A.has(R);){A.add(R);const M=b[R];if(M.length===0){R=k==="up"?R-1:R+1;continue}const D=Math.min(S,M.length-1);for(let U=D;U>=0;U-=1){const F=M[U];if(!nc(e,F,u))return F}R=k==="up"?R-1:R+1,a&&(R<0?R=b.length-1:R>=b.length&&(R=0))}}if(t.key===Bv){const k=C("up");if(k!==void 0)p&&Tn(t),y=k;else{if(p&&Tn(t),h===-1)y=m;else if(y=Rn(e,{startingIndex:y,amount:l,decrement:!0,disabledIndices:u}),a&&(h-l<f||y<0)){const E=h%l,S=m%l,R=m-(S-E);S===E?y=m:y=S>E?R:R-l}tc(e,y)&&(y=h)}}if(t.key===Ac){const k=C("down");k!==void 0?(p&&Tn(t),y=k):(p&&Tn(t),h===-1?y=f:(y=Rn(e,{startingIndex:h,amount:l,disabledIndices:u}),a&&h+l>m&&(y=Rn(e,{startingIndex:h%l-l,amount:l,disabledIndices:u}))),tc(e,y)&&(y=h))}if(n==="both"){const k=jo(h/l);t.key===(o?vr:yr)&&(p&&Tn(t),h%l!==l-1?(y=Rn(e,{startingIndex:h,disabledIndices:u}),a&&td(y,l,k)&&(y=Rn(e,{startingIndex:h-h%l-1,disabledIndices:u}))):a&&(y=Rn(e,{startingIndex:h-h%l-1,disabledIndices:u})),td(y,l,k)&&(y=h)),t.key===(o?yr:vr)&&(p&&Tn(t),h%l!==0?(y=Rn(e,{startingIndex:h,decrement:!0,disabledIndices:u}),a&&td(y,l,k)&&(y=Rn(e,{startingIndex:h+(l-h%l),decrement:!0,disabledIndices:u}))):a&&(y=Rn(e,{startingIndex:h+(l-h%l),decrement:!0,disabledIndices:u})),td(y,l,k)&&(y=h));const E=jo(m/l)===k;tc(e,y)&&(a&&E?y=t.key===(o?yr:vr)?m:Rn(e,{startingIndex:h-h%l-1,disabledIndices:u}):y=h)}return y}function HL(e,t,n){const a=[];let o=0;return e.forEach(({width:l,height:u},f)=>{let m=!1;for(n&&(o=0);!m;){const h=[];for(let p=0;p<l;p+=1)for(let y=0;y<u;y+=1)h.push(o+p+y*t);o%t+l<=t&&h.every(p=>a[p]==null)?(h.forEach(p=>{a[p]=f}),m=!0):o+=1}}),[...a]}function FL(e,t,n,a,o){if(e===-1)return-1;const l=n.indexOf(e),u=t[e];switch(o){case"tl":return l;case"tr":return u?l+u.width-1:l;case"bl":return u?l+(u.height-1)*a:l;case"br":return n.lastIndexOf(e);default:return-1}}function ZL(e,t){return t.flatMap((n,a)=>e.includes(n)?[a]:[])}function nc(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const a=e.current[t];return a?a.hasAttribute("disabled")||a.getAttribute("aria-disabled")==="true":!1}var qL=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],af=qL.join(","),UE=typeof Element>"u",Lo=UE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,rf=!UE&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},of=function(t,n){var a;n===void 0&&(n=!0);var o=t==null||(a=t.getAttribute)===null||a===void 0?void 0:a.call(t,"inert"),l=o===""||o==="true",u=l||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):of(t.parentNode));return u},WL=function(t){var n,a=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return a===""||a==="true"},BE=function(t,n,a){if(of(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(af));return n&&Lo.call(t,af)&&o.unshift(t),o=o.filter(a),o},lf=function(t,n,a){for(var o=[],l=Array.from(t);l.length;){var u=l.shift();if(!of(u,!1))if(u.tagName==="SLOT"){var f=u.assignedElements(),m=f.length?f:u.children,h=lf(m,!0,a);a.flatten?o.push.apply(o,h):o.push({scopeParent:u,candidates:h})}else{var p=Lo.call(u,af);p&&a.filter(u)&&(n||!t.includes(u))&&o.push(u);var y=u.shadowRoot||typeof a.getShadowRoot=="function"&&a.getShadowRoot(u),b=!of(y,!1)&&(!a.shadowRootFilter||a.shadowRootFilter(u));if(y&&b){var w=lf(y===!0?u.children:y.children,!0,a);a.flatten?o.push.apply(o,w):o.push({scopeParent:u,candidates:w})}else l.unshift.apply(l,u.children)}}return o},VE=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},HE=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||WL(t))&&!VE(t)?0:t.tabIndex},YL=function(t,n){var a=HE(t);return a<0&&n&&!VE(t)?0:a},GL=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},FE=function(t){return t.tagName==="INPUT"},KL=function(t){return FE(t)&&t.type==="hidden"},XL=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(a){return a.tagName==="SUMMARY"});return n},JL=function(t,n){for(var a=0;a<t.length;a++)if(t[a].checked&&t[a].form===n)return t[a]},QL=function(t){if(!t.name)return!0;var n=t.form||rf(t),a=function(f){return n.querySelectorAll('input[type="radio"][name="'+f+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=a(window.CSS.escape(t.name));else try{o=a(t.name)}catch(u){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",u.message),!1}var l=JL(o,t.form);return!l||l===t},e$=function(t){return FE(t)&&t.type==="radio"},t$=function(t){return e$(t)&&!QL(t)},n$=function(t){var n,a=t&&rf(t),o=(n=a)===null||n===void 0?void 0:n.host,l=!1;if(a&&a!==t){var u,f,m;for(l=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o)||t!=null&&(m=t.ownerDocument)!==null&&m!==void 0&&m.contains(t));!l&&o;){var h,p,y;a=rf(o),o=(h=a)===null||h===void 0?void 0:h.host,l=!!((p=o)!==null&&p!==void 0&&(y=p.ownerDocument)!==null&&y!==void 0&&y.contains(o))}}return l},H1=function(t){var n=t.getBoundingClientRect(),a=n.width,o=n.height;return a===0&&o===0},s$=function(t,n){var a=n.displayCheck,o=n.getShadowRoot;if(a==="full-native"&&"checkVisibility"in t){var l=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!l}if(getComputedStyle(t).visibility==="hidden")return!0;var u=Lo.call(t,"details>summary:first-of-type"),f=u?t.parentElement:t;if(Lo.call(f,"details:not([open]) *"))return!0;if(!a||a==="full"||a==="full-native"||a==="legacy-full"){if(typeof o=="function"){for(var m=t;t;){var h=t.parentElement,p=rf(t);if(h&&!h.shadowRoot&&o(h)===!0)return H1(t);t.assignedSlot?t=t.assignedSlot:!h&&p!==t.ownerDocument?t=p.host:t=h}t=m}if(n$(t))return!t.getClientRects().length;if(a!=="legacy-full")return!0}else if(a==="non-zero-area")return H1(t);return!1},a$=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var a=0;a<n.children.length;a++){var o=n.children.item(a);if(o.tagName==="LEGEND")return Lo.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},zg=function(t,n){return!(n.disabled||KL(n)||s$(n,t)||XL(n)||a$(n))},Pg=function(t,n){return!(t$(n)||HE(n)<0||!zg(t,n))},r$=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},ZE=function(t){var n=[],a=[];return t.forEach(function(o,l){var u=!!o.scopeParent,f=u?o.scopeParent:o,m=YL(f,u),h=u?ZE(o.candidates):f;m===0?u?n.push.apply(n,h):n.push(f):a.push({documentOrder:l,tabIndex:m,item:o,isScope:u,content:h})}),a.sort(GL).reduce(function(o,l){return l.isScope?o.push.apply(o,l.content):o.push(l.content),o},[]).concat(n)},Uf=function(t,n){n=n||{};var a;return n.getShadowRoot?a=lf([t],n.includeContainer,{filter:Pg.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:r$}):a=BE(t,n.includeContainer,Pg.bind(null,n)),ZE(a)},i$=function(t,n){n=n||{};var a;return n.getShadowRoot?a=lf([t],n.includeContainer,{filter:zg.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):a=BE(t,n.includeContainer,zg.bind(null,n)),a},qE=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Lo.call(t,af)===!1?!1:Pg(n,t)};const Mc=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function WE(e,t){const n=Uf(e,Mc()),a=n.length;if(a===0)return;const o=fr(Cn(e)),l=n.indexOf(o),u=l===-1?t===1?0:a-1:l+t;return n[u]}function YE(e){return WE(Cn(e).body,1)||e}function GE(e){return WE(Cn(e).body,-1)||e}function sc(e,t){const n=t||e.currentTarget,a=e.relatedTarget;return!a||!Ot(n,a)}function o$(e){Uf(e,Mc()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function F1(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const a=n.dataset.tabindex;delete n.dataset.tabindex,a?n.setAttribute("tabindex",a):n.removeAttribute("tabindex")})}function KE(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(a=>a(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class XE{nodesRef={current:[]};events=KE();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(a=>a===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const JE=v.createContext(null),QE=v.createContext(null),Ar=()=>v.useContext(JE)?.id||null,Fo=e=>{const t=v.useContext(QE);return e??t};function l$(e){const t=kr(),n=Fo(e),a=Ar();return Fe(()=>{if(!t)return;const o={id:t,parentId:a};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,a]),t}function c$(e){const{children:t,id:n}=e,a=Ar();return i.jsx(JE.Provider,{value:v.useMemo(()=>({id:n,parentId:a}),[n,a]),children:t})}function u$(e){const{children:t,externalTree:n}=e,a=Cs(()=>n??new XE).current;return i.jsx(QE.Provider,{value:a,children:t})}function yc(e){return`data-base-ui-${e}`}const eC={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1};function mi(e){return e?.ownerDocument||document}const cf=v.forwardRef(function(t,n){const[a,o]=v.useState();Fe(()=>{wL&&o("button")},[]);const l={tabIndex:0,role:a};return i.jsx("span",{...t,ref:n,style:eC,"aria-hidden":a?void 0:!0,...l,"data-base-ui-focus-guard":""})});let Z1=0;function _d(e,t={}){const{preventScroll:n=!1,cancelPrevious:a=!0,sync:o=!1}=t;a&&cancelAnimationFrame(Z1);const l=()=>e?.focus({preventScroll:n});o?l():Z1=requestAnimationFrame(l)}const Mo={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function q1(e){return e==="inert"?Mo.inert:e==="aria-hidden"?Mo["aria-hidden"]:Mo.none}let nd=new WeakSet,sd={},wp=0;const tC=e=>e&&(e.host||tC(e.parentNode)),d$=(e,t)=>t.map(n=>{if(e.contains(n))return n;const a=tC(n);return e.contains(a)?a:null}).filter(n=>n!=null);function f$(e,t,n,a){const o="data-base-ui-inert",l=a?"inert":n?"aria-hidden":null,u=d$(t,e),f=new Set,m=new Set(u),h=[];sd[o]||(sd[o]=new WeakMap);const p=sd[o];u.forEach(y),b(t),f.clear();function y(w){!w||f.has(w)||(f.add(w),w.parentNode&&y(w.parentNode))}function b(w){!w||m.has(w)||[].forEach.call(w.children,j=>{if(Cr(j)!=="script")if(f.has(j))b(j);else{const N=l?j.getAttribute(l):null,C=N!==null&&N!=="false",k=q1(l),E=(k.get(j)||0)+1,S=(p.get(j)||0)+1;k.set(j,E),p.set(j,S),h.push(j),E===1&&C&&nd.add(j),S===1&&j.setAttribute(o,""),!C&&l&&j.setAttribute(l,l==="inert"?"":"true")}})}return wp+=1,()=>{h.forEach(w=>{const j=q1(l),C=(j.get(w)||0)-1,k=(p.get(w)||0)-1;j.set(w,C),p.set(w,k),C||(!nd.has(w)&&l&&w.removeAttribute(l),nd.delete(w)),k||w.removeAttribute(o)}),wp-=1,wp||(Mo.inert=new WeakMap,Mo["aria-hidden"]=new WeakMap,Mo.none=new WeakMap,nd=new WeakSet,sd={})}}function h$(e,t=!1,n=!1){const a=Cn(e[0]).body;return f$(e.concat(Array.from(a.querySelectorAll("[aria-live]"))),a,t,n)}const nC=v.createContext(null),sC=()=>v.useContext(nC),m$=yc("portal");function p$(e={}){const{ref:t,container:n,componentProps:a=Kn,elementProps:o,elementState:l}=e,u=kr(),m=sC()?.portalNode,[h,p]=v.useState(null),[y,b]=v.useState(null),w=v.useRef(null);Fe(()=>{if(n===null){w.current&&(w.current=null,b(null),p(null));return}if(u==null)return;const C=(n&&(Lv(n)?n:n.current))??m??document.body;if(C==null){w.current&&(w.current=null,b(null),p(null));return}w.current!==C&&(w.current=C,b(null),p(C))},[n,m,u]);const j=Er("div",a,{ref:[t,b],state:l,props:[{id:u,[m$]:""},o]});return{portalNode:y,portalSubtree:h&&j?hi.createPortal(j,h):null}}const g$=v.forwardRef(function(t,n){const{children:a,container:o,className:l,render:u,renderGuards:f,...m}=t,{portalNode:h,portalSubtree:p}=p$({container:o,ref:n,componentProps:t,elementProps:m}),y=v.useRef(null),b=v.useRef(null),w=v.useRef(null),j=v.useRef(null),[N,C]=v.useState(null),k=N?.modal,E=N?.open,S=typeof f=="boolean"?f:!!N&&!N.modal&&N.open&&!!h;v.useEffect(()=>{if(!h||k)return;function A(M){h&&sc(M)&&(M.type==="focusin"?F1:o$)(h)}return h.addEventListener("focusin",A,!0),h.addEventListener("focusout",A,!0),()=>{h.removeEventListener("focusin",A,!0),h.removeEventListener("focusout",A,!0)}},[h,k]),v.useEffect(()=>{!h||E||F1(h)},[E,h]);const R=v.useMemo(()=>({beforeOutsideRef:y,afterOutsideRef:b,beforeInsideRef:w,afterInsideRef:j,portalNode:h,setFocusManagerState:C}),[h]);return i.jsxs(v.Fragment,{children:[p,i.jsxs(nC.Provider,{value:R,children:[S&&h&&i.jsx(cf,{"data-type":"outside",ref:y,onFocus:A=>{if(sc(A,h))w.current?.focus();else{const M=N?N.domReference:null;GE(M)?.focus()}}}),S&&h&&i.jsx("span",{"aria-owns":h.id,style:EP}),h&&hi.createPortal(a,h),S&&h&&i.jsx(cf,{"data-type":"outside",ref:b,onFocus:A=>{if(sc(A,h))j.current?.focus();else{const M=N?N.domReference:null;YE(M)?.focus(),N?.closeOnFocusOut&&N?.onOpenChange(!1,rn(Df,A.nativeEvent))}}})]})]})});function v$(e,t){const n=An(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const W1=20;let hr=[];function Zv(){hr=hr.filter(e=>e.isConnected)}function y$(e){Zv(),e&&Cr(e)!=="body"&&(hr.push(e),hr.length>W1&&(hr=hr.slice(-W1)))}function jp(){return Zv(),hr[hr.length-1]}function x$(e){if(!e)return null;const t=Mc();return qE(e,t)?e:Uf(e,t)[0]||e}function b$(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():us(e).display!=="none"}function Y1(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=Mc(),o=i$(e,n).filter(u=>{const f=u.getAttribute("data-tabindex")||"";return qE(u,n)||u.hasAttribute("data-tabindex")&&!f.startsWith("-")}),l=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?l!=="0"&&e.setAttribute("tabindex","0"):(l!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function w$(e){const{context:t,children:n,disabled:a=!1,order:o=["content"],initialFocus:l=!0,returnFocus:u=!0,restoreFocus:f=!1,modal:m=!0,closeOnFocusOut:h=!0,openInteractionType:p="",getInsideElements:y=()=>[],nextFocusableElement:b,previousFocusableElement:w,beforeContentFocusGuardRef:j,externalTree:N}=e,C="rootStore"in t?t.rootStore:t,k=C.useState("open"),E=C.useState("domReferenceElement"),S=C.useState("floatingElement"),{events:R,dataRef:A}=C.context,M=qe(()=>A.current.floatingContext?.nodeId),D=qe(y),U=l===!1,F=Og(E)&&U,P=Yn(o),_=Yn(l),z=Yn(u),B=Yn(p),V=Fo(N),K=sC(),L=v.useRef(null),H=v.useRef(null),$=v.useRef(!1),G=v.useRef(!1),X=v.useRef(!1),O=v.useRef(-1),Z=v.useRef(""),W=v.useRef(""),Q=Bs(),ce=Bs(),ae=Uv(),ge=K!=null,ye=ef(S),be=qe((je=ye)=>je?Uf(je,Mc()):[]),Oe=qe(je=>{const Ne=be(je);return P.current.map(()=>Ne).filter(Boolean).flat()});v.useEffect(()=>{if(a||!m)return;function je(We){We.key==="Tab"&&Ot(ye,fr(Cn(ye)))&&be().length===0&&!F&&Tn(We)}const Ne=Cn(ye);return Ne.addEventListener("keydown",je),()=>{Ne.removeEventListener("keydown",je)}},[a,E,ye,m,P,F,be,Oe]),v.useEffect(()=>{if(a||!S)return;function je(Ne){const We=Gn(Ne),He=be().indexOf(We);He!==-1&&(O.current=He)}return S.addEventListener("focusin",je),()=>{S.removeEventListener("focusin",je)}},[a,S,be]),v.useEffect(()=>{if(a||!k)return;const je=Cn(ye);function Ne(){X.current=!1}function We(He){const le=Gn(He),he=Ot(S,le)||Ot(E,le)||Ot(K?.portalNode,le);X.current=!he,W.current=He.pointerType||"keyboard"}function Be(){W.current="keyboard"}return je.addEventListener("pointerdown",We,!0),je.addEventListener("pointerup",Ne,!0),je.addEventListener("pointercancel",Ne,!0),je.addEventListener("keydown",Be,!0),()=>{je.removeEventListener("pointerdown",We,!0),je.removeEventListener("pointerup",Ne,!0),je.removeEventListener("pointercancel",Ne,!0),je.removeEventListener("keydown",Be,!0)}},[a,S,E,ye,k,K]),v.useEffect(()=>{if(a||!h)return;function je(){G.current=!0,ce.start(0,()=>{G.current=!1})}function Ne(le){const he=le.relatedTarget,pe=le.currentTarget,ke=Gn(le);queueMicrotask(()=>{const Ee=M(),Je=C.context.triggerElements,et=!(Ot(E,he)||Ot(S,he)||Ot(he,S)||Ot(K?.portalNode,he)||he!=null&&Je.hasElement(he)||Je.hasMatchingElement(Ye=>Ot(Ye,he))||he?.hasAttribute(yc("focus-guard"))||V&&(Ao(V.nodesRef.current,Ee).find(Ye=>Ot(Ye.context?.elements.floating,he)||Ot(Ye.context?.elements.domReference,he))||$1(V.nodesRef.current,Ee).find(Ye=>[Ye.context?.elements.floating,ef(Ye.context?.elements.floating)].includes(he)||Ye.context?.elements.domReference===he)));if(pe===E&&ye&&Y1(ye,P),f&&pe!==E&&!b$(ke)&&fr(Cn(ye))===Cn(ye).body){if(Qt(ye)&&(ye.focus(),f==="popup")){ae.request(()=>{ye.focus()});return}const Ye=O.current,Bt=be(),Et=Bt[Ye]||Bt[Bt.length-1]||ye;Qt(Et)&&Et.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(F||!m)&&he&&et&&!G.current&&(F||he!==jp())&&($.current=!0,C.setOpen(!1,rn(Df,le)))})}function We(){X.current||(A.current.insideReactTree=!0,Q.start(0,()=>{A.current.insideReactTree=!1}))}const Be=Qt(E)?E:null,He=[];if(!(!S&&!Be))return Be&&(Be.addEventListener("focusout",Ne),Be.addEventListener("pointerdown",je),He.push(()=>{Be.removeEventListener("focusout",Ne),Be.removeEventListener("pointerdown",je)})),S&&(S.addEventListener("focusout",Ne),K&&(S.addEventListener("focusout",We,!0),He.push(()=>{S.removeEventListener("focusout",We,!0)})),He.push(()=>{S.removeEventListener("focusout",Ne)})),()=>{He.forEach(le=>{le()})}},[a,E,S,ye,m,V,K,C,h,f,be,F,M,P,A,Q,ce,ae]);const fe=v.useRef(null),xe=v.useRef(null),we=vc(fe,j,K?.beforeInsideRef),ze=vc(xe,K?.afterInsideRef);v.useEffect(()=>{if(a||!S||!k)return;const je=Array.from(K?.portalNode?.querySelectorAll(`[${yc("portal")}]`)||[]),We=(V?$1(V.nodesRef.current,M()):[]).find(le=>Og(le.context?.elements.domReference||null))?.context?.elements.domReference,Be=[S,We,...je,...D(),L.current,H.current,fe.current,xe.current,K?.beforeOutsideRef.current,K?.afterOutsideRef.current,Jr(w),Jr(b),F?E:null].filter(le=>le!=null),He=h$(Be,m||F);return()=>{He()}},[k,a,E,S,m,P,K,F,V,M,D,b,w]),Fe(()=>{if(!k||a||!Qt(ye))return;const je=Cn(ye),Ne=fr(je);queueMicrotask(()=>{const We=Oe(ye),Be=_.current,He=typeof Be=="function"?Be(B.current||""):Be;if(He===void 0||He===!1)return;let le;He===!0||He===null?le=We[0]||ye:le=Jr(He),le=le||We[0]||ye,!Ot(ye,Ne)&&_d(le,{preventScroll:le===ye})})},[a,k,ye,U,Oe,_,B]),Fe(()=>{if(a||!ye)return;const je=Cn(ye),Ne=fr(je);y$(Ne);function We(le){if(le.open||(Z.current=v$(le.nativeEvent,W.current)),le.reason===ri&&le.nativeEvent.type==="mouseleave"&&($.current=!0),le.reason===Pv)if(le.nested)$.current=!1;else if(PE(le.nativeEvent)||LE(le.nativeEvent))$.current=!1;else{let he=!1;document.createElement("div").focus({get preventScroll(){return he=!0,!1}}),he?$.current=!1:$.current=!0}}R.on("openchange",We);const Be=je.createElement("span");Be.setAttribute("tabindex","-1"),Be.setAttribute("aria-hidden","true"),Object.assign(Be.style,eC),ge&&E&&E.insertAdjacentElement("afterend",Be);function He(){const le=z.current;let he=typeof le=="function"?le(Z.current):le;if(he===void 0||he===!1)return null;if(he===null&&(he=!0),typeof he=="boolean"){const ke=E||jp();return ke&&ke.isConnected?ke:Be}const pe=E||jp()||Be;return Jr(he)||pe}return()=>{R.off("openchange",We);const le=fr(je),he=Ot(S,le)||V&&Ao(V.nodesRef.current,M(),!1).some(ke=>Ot(ke.context?.elements.floating,le)),pe=He();queueMicrotask(()=>{const ke=x$(pe),Ee=typeof z.current!="boolean";z.current&&!$.current&&Qt(ke)&&(!(!Ee&&ke!==le&&le!==je.body)||he)&&ke.focus({preventScroll:!0}),Be.remove()})}},[a,S,ye,z,A,R,V,ge,E,M]),v.useEffect(()=>{queueMicrotask(()=>{$.current=!1})},[a]),v.useEffect(()=>{if(a||!k)return;function je(We){Gn(We)?.closest(`[${NP}]`)&&(G.current=!0)}const Ne=Cn(ye);return Ne.addEventListener("pointerdown",je,!0),()=>{Ne.removeEventListener("pointerdown",je,!0)}},[a,k,ye]),Fe(()=>{if(!a&&K)return K.setFocusManagerState({modal:m,closeOnFocusOut:h,open:k,onOpenChange:C.setOpen,domReference:E}),()=>{K.setFocusManagerState(null)}},[a,K,m,k,C,h,E]),Fe(()=>{if(!(a||!ye))return Y1(ye,P),()=>{queueMicrotask(Zv)}},[a,ye,P]);const Me=!a&&(m?!F:!0)&&(ge||m);return i.jsxs(v.Fragment,{children:[Me&&i.jsx(cf,{"data-type":"inside",ref:we,onFocus:je=>{if(m){const Ne=Oe();_d(Ne[Ne.length-1])}else K?.portalNode&&($.current=!1,sc(je,K.portalNode)?YE(E)?.focus():Jr(w??K.beforeOutsideRef)?.focus())}}),n,Me&&i.jsx(cf,{"data-type":"inside",ref:ze,onFocus:je=>{m?_d(Oe()[0]):K?.portalNode&&(h&&($.current=!0),sc(je,K.portalNode)?GE(E)?.focus():Jr(b??K.afterOutsideRef)?.focus())}})]})}function G1(e,t,n){let{reference:a,floating:o}=e;const l=Ss(t),u=Fv(t),f=Hv(u),m=ls(t),h=l==="y",p=a.x+a.width/2-o.width/2,y=a.y+a.height/2-o.height/2,b=a[f]/2-o[f]/2;let w;switch(m){case"top":w={x:p,y:a.y-o.height};break;case"bottom":w={x:p,y:a.y+a.height};break;case"right":w={x:a.x+a.width,y};break;case"left":w={x:a.x-o.width,y};break;default:w={x:a.x,y:a.y}}switch(Tr(t)){case"start":w[u]-=b*(n&&h?-1:1);break;case"end":w[u]+=b*(n&&h?-1:1);break}return w}async function j$(e,t){var n;t===void 0&&(t={});const{x:a,y:o,platform:l,rects:u,elements:f,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:y="floating",altBoundary:b=!1,padding:w=0}=Ra(t,e),j=$E(w),C=f[b?y==="floating"?"reference":"floating":y],k=sf(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(C)))==null||n?C:C.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(f.floating)),boundary:h,rootBoundary:p,strategy:m})),E=y==="floating"?{x:a,y:o,width:u.floating.width,height:u.floating.height}:u.reference,S=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f.floating)),R=await(l.isElement==null?void 0:l.isElement(S))?await(l.getScale==null?void 0:l.getScale(S))||{x:1,y:1}:{x:1,y:1},A=sf(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:E,offsetParent:S,strategy:m}):E);return{top:(k.top-A.top+j.top)/R.y,bottom:(A.bottom-k.bottom+j.bottom)/R.y,left:(k.left-A.left+j.left)/R.x,right:(A.right-k.right+j.right)/R.x}}const S$=async(e,t,n)=>{const{placement:a="bottom",strategy:o="absolute",middleware:l=[],platform:u}=n,f=l.filter(Boolean),m=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y}=G1(h,a,m),b=a,w={},j=0;for(let C=0;C<f.length;C++){var N;const{name:k,fn:E}=f[C],{x:S,y:R,data:A,reset:M}=await E({x:p,y,initialPlacement:a,placement:b,strategy:o,middlewareData:w,rects:h,platform:{...u,detectOverflow:(N=u.detectOverflow)!=null?N:j$},elements:{reference:e,floating:t}});p=S??p,y=R??y,w={...w,[k]:{...w[k],...A}},M&&j<=50&&(j++,typeof M=="object"&&(M.placement&&(b=M.placement),M.rects&&(h=M.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:o}):M.rects),{x:p,y}=G1(h,b,m)),C=-1)}return{x:p,y,placement:b,strategy:o,middlewareData:w}},N$=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:o,middlewareData:l,rects:u,initialPlacement:f,platform:m,elements:h}=t,{mainAxis:p=!0,crossAxis:y=!0,fallbackPlacements:b,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:N=!0,...C}=Ra(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=ls(o),E=Ss(f),S=ls(f)===f,R=await(m.isRTL==null?void 0:m.isRTL(h.floating)),A=b||(S||!N?[nf(f)]:zL(f)),M=j!=="none";!b&&M&&A.push(...UL(f,N,j,R));const D=[f,...A],U=await m.detectOverflow(t,C),F=[];let P=((a=l.flip)==null?void 0:a.overflows)||[];if(p&&F.push(U[k]),y){const V=DL(o,u,R);F.push(U[V[0]],U[V[1]])}if(P=[...P,{placement:o,overflows:F}],!F.every(V=>V<=0)){var _,z;const V=(((_=l.flip)==null?void 0:_.index)||0)+1,K=D[V];if(K&&(!(y==="alignment"?E!==Ss(K):!1)||P.every($=>Ss($.placement)===E?$.overflows[0]>0:!0)))return{data:{index:V,overflows:P},reset:{placement:K}};let L=(z=P.filter(H=>H.overflows[0]<=0).sort((H,$)=>H.overflows[1]-$.overflows[1])[0])==null?void 0:z.placement;if(!L)switch(w){case"bestFit":{var B;const H=(B=P.filter($=>{if(M){const G=Ss($.placement);return G===E||G==="y"}return!0}).map($=>[$.placement,$.overflows.filter(G=>G>0).reduce((G,X)=>G+X,0)]).sort(($,G)=>$[1]-G[1])[0])==null?void 0:B[0];H&&(L=H);break}case"initialPlacement":L=f;break}if(o!==L)return{reset:{placement:L}}}return{}}}};function K1(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function X1(e){return RL.some(t=>e[t]>=0)}const k$=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:a}=t,{strategy:o="referenceHidden",...l}=Ra(e,t);switch(o){case"referenceHidden":{const u=await a.detectOverflow(t,{...l,elementContext:"reference"}),f=K1(u,n.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:X1(f)}}}case"escaped":{const u=await a.detectOverflow(t,{...l,altBoundary:!0}),f=K1(u,n.floating);return{data:{escapedOffsets:f,escaped:X1(f)}}}default:return{}}}}},aC=new Set(["left","top"]);async function E$(e,t){const{placement:n,platform:a,elements:o}=e,l=await(a.isRTL==null?void 0:a.isRTL(o.floating)),u=ls(n),f=Tr(n),m=Ss(n)==="y",h=aC.has(u)?-1:1,p=l&&m?-1:1,y=Ra(t,e);let{mainAxis:b,crossAxis:w,alignmentAxis:j}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return f&&typeof j=="number"&&(w=f==="end"?j*-1:j),m?{x:w*p,y:b*h}:{x:b*h,y:w*p}}const C$=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:o,y:l,placement:u,middlewareData:f}=t,m=await E$(t,e);return u===((n=f.offset)==null?void 0:n.placement)&&(a=f.arrow)!=null&&a.alignmentOffset?{}:{x:o+m.x,y:l+m.y,data:{...m,placement:u}}}}},T$=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:o,platform:l}=t,{mainAxis:u=!0,crossAxis:f=!1,limiter:m={fn:k=>{let{x:E,y:S}=k;return{x:E,y:S}}},...h}=Ra(e,t),p={x:n,y:a},y=await l.detectOverflow(t,h),b=Ss(ls(o)),w=Vv(b);let j=p[w],N=p[b];if(u){const k=w==="y"?"top":"left",E=w==="y"?"bottom":"right",S=j+y[k],R=j-y[E];j=Ig(S,j,R)}if(f){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",S=N+y[k],R=N-y[E];N=Ig(S,N,R)}const C=m.fn({...t,[w]:j,[b]:N});return{...C,data:{x:C.x-n,y:C.y-a,enabled:{[w]:u,[b]:f}}}}}},A$=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:o,rects:l,middlewareData:u}=t,{offset:f=0,mainAxis:m=!0,crossAxis:h=!0}=Ra(e,t),p={x:n,y:a},y=Ss(o),b=Vv(y);let w=p[b],j=p[y];const N=Ra(f,t),C=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(m){const S=b==="y"?"height":"width",R=l.reference[b]-l.floating[S]+C.mainAxis,A=l.reference[b]+l.reference[S]-C.mainAxis;w<R?w=R:w>A&&(w=A)}if(h){var k,E;const S=b==="y"?"width":"height",R=aC.has(ls(o)),A=l.reference[y]-l.floating[S]+(R&&((k=u.offset)==null?void 0:k[y])||0)+(R?0:C.crossAxis),M=l.reference[y]+l.reference[S]+(R?0:((E=u.offset)==null?void 0:E[y])||0)-(R?C.crossAxis:0);j<A?j=A:j>M&&(j=M)}return{[b]:w,[y]:j}}}},M$=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:o,rects:l,platform:u,elements:f}=t,{apply:m=()=>{},...h}=Ra(e,t),p=await u.detectOverflow(t,h),y=ls(o),b=Tr(o),w=Ss(o)==="y",{width:j,height:N}=l.floating;let C,k;y==="top"||y==="bottom"?(C=y,k=b===(await(u.isRTL==null?void 0:u.isRTL(f.floating))?"start":"end")?"left":"right"):(k=y,C=b==="end"?"top":"bottom");const E=N-p.top-p.bottom,S=j-p.left-p.right,R=Po(N-p[C],E),A=Po(j-p[k],S),M=!t.middlewareData.shift;let D=R,U=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(U=S),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(D=E),M&&!b){const P=os(p.left,0),_=os(p.right,0),z=os(p.top,0),B=os(p.bottom,0);w?U=j-2*(P!==0||_!==0?P+_:os(p.left,p.right)):D=N-2*(z!==0||B!==0?z+B:os(p.top,p.bottom))}await m({...t,availableWidth:U,availableHeight:D});const F=await u.getDimensions(f.floating);return j!==F.width||N!==F.height?{reset:{rects:!0}}:{}}}};function rC(e){const t=us(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const o=Qt(e),l=o?e.offsetWidth:n,u=o?e.offsetHeight:a,f=tf(n)!==l||tf(a)!==u;return f&&(n=l,a=u),{width:n,height:a,$:f}}function qv(e){return It(e)?e:e.contextElement}function Ro(e){const t=qv(e);if(!Qt(t))return ta(1);const n=t.getBoundingClientRect(),{width:a,height:o,$:l}=rC(t);let u=(l?tf(n.width):n.width)/a,f=(l?tf(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const R$=ta(0);function iC(e){const t=An(e);return!Lf()||!t.visualViewport?R$:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _$(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==An(e)?!1:t}function pi(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),l=qv(e);let u=ta(1);t&&(a?It(a)&&(u=Ro(a)):u=Ro(e));const f=_$(l,n,a)?iC(l):ta(0);let m=(o.left+f.x)/u.x,h=(o.top+f.y)/u.y,p=o.width/u.x,y=o.height/u.y;if(l){const b=An(l),w=a&&It(a)?An(a):a;let j=b,N=Mg(j);for(;N&&a&&w!==j;){const C=Ro(N),k=N.getBoundingClientRect(),E=us(N),S=k.left+(N.clientLeft+parseFloat(E.paddingLeft))*C.x,R=k.top+(N.clientTop+parseFloat(E.paddingTop))*C.y;m*=C.x,h*=C.y,p*=C.x,y*=C.y,m+=S,h+=R,j=An(N),N=Mg(j)}}return sf({width:p,height:y,x:m,y:h})}function Bf(e,t){const n=$f(e).scrollLeft;return t?t.left+n:pi(ia(e)).left+n}function oC(e,t){const n=e.getBoundingClientRect(),a=n.left+t.scrollLeft-Bf(e,n),o=n.top+t.scrollTop;return{x:a,y:o}}function O$(e){let{elements:t,rect:n,offsetParent:a,strategy:o}=e;const l=o==="fixed",u=ia(a),f=t?Pf(t.floating):!1;if(a===u||f&&l)return n;let m={scrollLeft:0,scrollTop:0},h=ta(1);const p=ta(0),y=Qt(a);if((y||!y&&!l)&&((Cr(a)!=="body"||xi(u))&&(m=$f(a)),Qt(a))){const w=pi(a);h=Ro(a),p.x=w.x+a.clientLeft,p.y=w.y+a.clientTop}const b=u&&!y&&!l?oC(u,m):ta(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-m.scrollLeft*h.x+p.x+b.x,y:n.y*h.y-m.scrollTop*h.y+p.y+b.y}}function I$(e){return Array.from(e.getClientRects())}function D$(e){const t=ia(e),n=$f(e),a=e.ownerDocument.body,o=os(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=os(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let u=-n.scrollLeft+Bf(e);const f=-n.scrollTop;return us(a).direction==="rtl"&&(u+=os(t.clientWidth,a.clientWidth)-o),{width:o,height:l,x:u,y:f}}const J1=25;function z$(e,t){const n=An(e),a=ia(e),o=n.visualViewport;let l=a.clientWidth,u=a.clientHeight,f=0,m=0;if(o){l=o.width,u=o.height;const p=Lf();(!p||p&&t==="fixed")&&(f=o.offsetLeft,m=o.offsetTop)}const h=Bf(a);if(h<=0){const p=a.ownerDocument,y=p.body,b=getComputedStyle(y),w=p.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,j=Math.abs(a.clientWidth-y.clientWidth-w);j<=J1&&(l-=j)}else h<=J1&&(l+=h);return{width:l,height:u,x:f,y:m}}const P$=new Set(["absolute","fixed"]);function L$(e,t){const n=pi(e,!0,t==="fixed"),a=n.top+e.clientTop,o=n.left+e.clientLeft,l=Qt(e)?Ro(e):ta(1),u=e.clientWidth*l.x,f=e.clientHeight*l.y,m=o*l.x,h=a*l.y;return{width:u,height:f,x:m,y:h}}function Q1(e,t,n){let a;if(t==="viewport")a=z$(e,n);else if(t==="document")a=D$(ia(e));else if(It(t))a=L$(t,n);else{const o=iC(e);a={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return sf(a)}function lC(e,t){const n=aa(e);return n===t||!It(n)||ea(n)?!1:us(n).position==="fixed"||lC(n,t)}function $$(e,t){const n=t.get(e);if(n)return n;let a=gr(e,[],!1).filter(f=>It(f)&&Cr(f)!=="body"),o=null;const l=us(e).position==="fixed";let u=l?aa(e):e;for(;It(u)&&!ea(u);){const f=us(u),m=$v(u);!m&&f.position==="fixed"&&(o=null),(l?!m&&!o:!m&&f.position==="static"&&!!o&&P$.has(o.position)||xi(u)&&!m&&lC(e,u))?a=a.filter(p=>p!==u):o=f,u=aa(u)}return t.set(e,a),a}function U$(e){let{element:t,boundary:n,rootBoundary:a,strategy:o}=e;const u=[...n==="clippingAncestors"?Pf(t)?[]:$$(t,this._c):[].concat(n),a],f=u[0],m=u.reduce((h,p)=>{const y=Q1(t,p,o);return h.top=os(y.top,h.top),h.right=Po(y.right,h.right),h.bottom=Po(y.bottom,h.bottom),h.left=os(y.left,h.left),h},Q1(t,f,o));return{width:m.right-m.left,height:m.bottom-m.top,x:m.left,y:m.top}}function B$(e){const{width:t,height:n}=rC(e);return{width:t,height:n}}function V$(e,t,n){const a=Qt(t),o=ia(t),l=n==="fixed",u=pi(e,!0,l,t);let f={scrollLeft:0,scrollTop:0};const m=ta(0);function h(){m.x=Bf(o)}if(a||!a&&!l)if((Cr(t)!=="body"||xi(o))&&(f=$f(t)),a){const w=pi(t,!0,l,t);m.x=w.x+t.clientLeft,m.y=w.y+t.clientTop}else o&&h();l&&!a&&o&&h();const p=o&&!a&&!l?oC(o,f):ta(0),y=u.left+f.scrollLeft-m.x-p.x,b=u.top+f.scrollTop-m.y-p.y;return{x:y,y:b,width:u.width,height:u.height}}function Sp(e){return us(e).position==="static"}function ej(e,t){if(!Qt(e)||us(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ia(e)===n&&(n=n.ownerDocument.body),n}function cC(e,t){const n=An(e);if(Pf(e))return n;if(!Qt(e)){let o=aa(e);for(;o&&!ea(o);){if(It(o)&&!Sp(o))return o;o=aa(o)}return n}let a=ej(e,t);for(;a&&qP(a)&&Sp(a);)a=ej(a,t);return a&&ea(a)&&Sp(a)&&!$v(a)?n:a||XP(e)||n}const H$=async function(e){const t=this.getOffsetParent||cC,n=this.getDimensions,a=await n(e.floating);return{reference:V$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function F$(e){return us(e).direction==="rtl"}const Z$={convertOffsetParentRelativeRectToViewportRelativeRect:O$,getDocumentElement:ia,getClippingRect:U$,getOffsetParent:cC,getElementRects:H$,getClientRects:I$,getDimensions:B$,getScale:Ro,isElement:It,isRTL:F$};function uC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function q$(e,t){let n=null,a;const o=ia(e);function l(){var f;clearTimeout(a),(f=n)==null||f.disconnect(),n=null}function u(f,m){f===void 0&&(f=!1),m===void 0&&(m=1),l();const h=e.getBoundingClientRect(),{left:p,top:y,width:b,height:w}=h;if(f||t(),!b||!w)return;const j=jo(y),N=jo(o.clientWidth-(p+b)),C=jo(o.clientHeight-(y+w)),k=jo(p),S={rootMargin:-j+"px "+-N+"px "+-C+"px "+-k+"px",threshold:os(0,Po(1,m))||1};let R=!0;function A(M){const D=M[0].intersectionRatio;if(D!==m){if(!R)return u();D?u(!1,D):a=setTimeout(()=>{u(!1,1e-7)},1e3)}D===1&&!uC(h,e.getBoundingClientRect())&&u(),R=!1}try{n=new IntersectionObserver(A,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(A,S)}n.observe(e)}return u(!0),l}function tj(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:m=!1}=a,h=qv(e),p=o||l?[...h?gr(h):[],...gr(t)]:[];p.forEach(k=>{o&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const y=h&&f?q$(h,n):null;let b=-1,w=null;u&&(w=new ResizeObserver(k=>{let[E]=k;E&&E.target===h&&w&&(w.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var S;(S=w)==null||S.observe(t)})),n()}),h&&!m&&w.observe(h),w.observe(t));let j,N=m?pi(e):null;m&&C();function C(){const k=pi(e);N&&!uC(N,k)&&n(),N=k,j=requestAnimationFrame(C)}return n(),()=>{var k;p.forEach(E=>{o&&E.removeEventListener("scroll",n),l&&E.removeEventListener("resize",n)}),y?.(),(k=w)==null||k.disconnect(),w=null,m&&cancelAnimationFrame(j)}}const W$=C$,Y$=T$,G$=N$,K$=M$,X$=k$,J$=A$,Q$=(e,t,n)=>{const a=new Map,o={platform:Z$,...n},l={...o.platform,_c:a};return S$(e,t,{...o,platform:l})};var e6=typeof document<"u",t6=function(){},Od=e6?v.useLayoutEffect:t6;function uf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,a,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(a=n;a--!==0;)if(!uf(e[a],t[a]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,o[a]))return!1;for(a=n;a--!==0;){const l=o[a];if(!(l==="_owner"&&e.$$typeof)&&!uf(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function dC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nj(e,t){const n=dC(e);return Math.round(t*n)/n}function Np(e){const t=v.useRef(e);return Od(()=>{t.current=e}),t}function n6(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:o,elements:{reference:l,floating:u}={},transform:f=!0,whileElementsMounted:m,open:h}=e,[p,y]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,w]=v.useState(a);uf(b,a)||w(a);const[j,N]=v.useState(null),[C,k]=v.useState(null),E=v.useCallback($=>{$!==M.current&&(M.current=$,N($))},[]),S=v.useCallback($=>{$!==D.current&&(D.current=$,k($))},[]),R=l||j,A=u||C,M=v.useRef(null),D=v.useRef(null),U=v.useRef(p),F=m!=null,P=Np(m),_=Np(o),z=Np(h),B=v.useCallback(()=>{if(!M.current||!D.current)return;const $={placement:t,strategy:n,middleware:b};_.current&&($.platform=_.current),Q$(M.current,D.current,$).then(G=>{const X={...G,isPositioned:z.current!==!1};V.current&&!uf(U.current,X)&&(U.current=X,hi.flushSync(()=>{y(X)}))})},[b,t,n,_,z]);Od(()=>{h===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,y($=>({...$,isPositioned:!1})))},[h]);const V=v.useRef(!1);Od(()=>(V.current=!0,()=>{V.current=!1}),[]),Od(()=>{if(R&&(M.current=R),A&&(D.current=A),R&&A){if(P.current)return P.current(R,A,B);B()}},[R,A,B,P,F]);const K=v.useMemo(()=>({reference:M,floating:D,setReference:E,setFloating:S}),[E,S]),L=v.useMemo(()=>({reference:R,floating:A}),[R,A]),H=v.useMemo(()=>{const $={position:n,left:0,top:0};if(!L.floating)return $;const G=nj(L.floating,p.x),X=nj(L.floating,p.y);return f?{...$,transform:"translate("+G+"px, "+X+"px)",...dC(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:X}},[n,f,L.floating,p.x,p.y]);return v.useMemo(()=>({...p,update:B,refs:K,elements:L,floatingStyles:H}),[p,B,K,L,H])}const s6=(e,t)=>({...W$(e),options:[e,t]}),a6=(e,t)=>({...Y$(e),options:[e,t]}),r6=(e,t)=>({...J$(e),options:[e,t]}),i6=(e,t)=>({...G$(e),options:[e,t]}),o6=(e,t)=>({...K$(e),options:[e,t]}),l6=(e,t)=>({...X$(e),options:[e,t]}),c6={intentional:"onClick",sloppy:"onPointerDown"};function u6(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function d6(e,t={}){const n="rootStore"in e?e.rootStore:e,a=n.useState("open"),o=n.useState("floatingElement"),l=n.useState("referenceElement"),u=n.useState("domReferenceElement"),{onOpenChange:f,dataRef:m}=n.context,{enabled:h=!0,escapeKey:p=!0,outsidePress:y=!0,outsidePressEvent:b="sloppy",referencePress:w=!1,referencePressEvent:j="sloppy",ancestorScroll:N=!1,bubbles:C,externalTree:k}=t,E=Fo(k),S=qe(typeof y=="function"?y:()=>!1),R=typeof y=="function"?S:y,A=v.useRef(!1),{escapeKey:M,outsidePress:D}=u6(C),U=v.useRef(null),F=Bs(),P=Bs(),_=qe(()=>{P.clear(),m.current.insideReactTree=!1}),z=v.useRef(!1),B=v.useRef(""),V=qe(fe=>{B.current=fe.pointerType}),K=qe(()=>{const fe=B.current,xe=fe==="pen"||!fe?"mouse":fe,we=typeof b=="function"?b():b;return typeof we=="string"?we:we[xe]}),L=qe(fe=>{if(!a||!h||!p||fe.key!=="Escape"||z.current)return;const xe=m.current.floatingContext?.nodeId,we=E?Ao(E.nodesRef.current,xe):[];if(!M&&we.length>0){let je=!0;if(we.forEach(Ne=>{Ne.context?.open&&!Ne.context.dataRef.current.__escapeKeyBubbles&&(je=!1)}),!je)return}const ze=TL(fe)?fe.nativeEvent:fe,Me=rn(kE,ze);n.setOpen(!1,Me),!M&&!Me.isPropagationAllowed&&fe.stopPropagation()}),H=qe(fe=>{const xe=K();return xe==="intentional"&&fe.type!=="click"||xe==="sloppy"&&fe.type==="click"}),$=qe(()=>{m.current.insideReactTree=!0,P.start(0,_)}),G=qe((fe,xe=!1)=>{if(H(fe)){_();return}if(m.current.insideReactTree){_();return}if(K()==="intentional"&&xe||typeof R=="function"&&!R(fe))return;const we=Gn(fe),ze=`[${yc("inert")}]`,Me=Cn(n.select("floatingElement")).querySelectorAll(ze),je=n.context.triggerElements;if(we&&(je.hasElement(we)||je.hasMatchingElement(le=>Ot(le,we))))return;let Ne=It(we)?we:null;for(;Ne&&!ea(Ne);){const le=aa(Ne);if(ea(le)||!It(le))break;Ne=le}if(Me.length&&It(we)&&!EL(we)&&!Ot(we,n.select("floatingElement"))&&Array.from(Me).every(le=>!Ot(Ne,le)))return;if(Qt(we)&&!("touches"in fe)){const le=ea(we),he=us(we),pe=/auto|scroll/,ke=le||pe.test(he.overflowX),Ee=le||pe.test(he.overflowY),Je=ke&&we.clientWidth>0&&we.scrollWidth>we.clientWidth,et=Ee&&we.clientHeight>0&&we.scrollHeight>we.clientHeight,Ye=he.direction==="rtl",Bt=et&&(Ye?fe.offsetX<=we.offsetWidth-we.clientWidth:fe.offsetX>we.clientWidth),Et=Je&&fe.offsetY>we.clientHeight;if(Bt||Et)return}const We=m.current.floatingContext?.nodeId,Be=E&&Ao(E.nodesRef.current,We).some(le=>zs(fe,le.context?.elements.floating));if(zs(fe,n.select("floatingElement"))||zs(fe,n.select("domReferenceElement"))||Be)return;const He=E?Ao(E.nodesRef.current,We):[];if(He.length>0){let le=!0;if(He.forEach(he=>{he.context?.open&&!he.context.dataRef.current.__outsidePressBubbles&&(le=!1)}),!le)return}n.setOpen(!1,rn(Pv,fe)),_()}),X=qe(fe=>{K()!=="sloppy"||fe.pointerType==="touch"||!n.select("open")||!h||zs(fe,n.select("floatingElement"))||zs(fe,n.select("domReferenceElement"))||G(fe)}),O=qe(fe=>{if(K()!=="sloppy"||!n.select("open")||!h||zs(fe,n.select("floatingElement"))||zs(fe,n.select("domReferenceElement")))return;const xe=fe.touches[0];xe&&(U.current={startTime:Date.now(),startX:xe.clientX,startY:xe.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},F.start(1e3,()=>{U.current&&(U.current.dismissOnTouchEnd=!1,U.current.dismissOnMouseDown=!1)}))}),Z=qe(fe=>{const xe=Gn(fe);function we(){O(fe),xe?.removeEventListener(fe.type,we)}xe?.addEventListener(fe.type,we)}),W=qe(fe=>{const xe=A.current;if(A.current=!1,F.clear(),fe.type==="mousedown"&&U.current&&!U.current.dismissOnMouseDown)return;const we=Gn(fe);function ze(){fe.type==="pointerdown"?X(fe):G(fe,xe),we?.removeEventListener(fe.type,ze)}we?.addEventListener(fe.type,ze)}),Q=qe(fe=>{if(K()!=="sloppy"||!U.current||zs(fe,n.select("floatingElement"))||zs(fe,n.select("domReferenceElement")))return;const xe=fe.touches[0];if(!xe)return;const we=Math.abs(xe.clientX-U.current.startX),ze=Math.abs(xe.clientY-U.current.startY),Me=Math.sqrt(we*we+ze*ze);Me>5&&(U.current.dismissOnTouchEnd=!0),Me>10&&(G(fe),F.clear(),U.current=null)}),ce=qe(fe=>{const xe=Gn(fe);function we(){Q(fe),xe?.removeEventListener(fe.type,we)}xe?.addEventListener(fe.type,we)}),ae=qe(fe=>{K()!=="sloppy"||!U.current||zs(fe,n.select("floatingElement"))||zs(fe,n.select("domReferenceElement"))||(U.current.dismissOnTouchEnd&&G(fe),F.clear(),U.current=null)}),ge=qe(fe=>{const xe=Gn(fe);function we(){ae(fe),xe?.removeEventListener(fe.type,we)}xe?.addEventListener(fe.type,we)});v.useEffect(()=>{if(!a||!h)return;m.current.__escapeKeyBubbles=M,m.current.__outsidePressBubbles=D;const fe=new zo;function xe(Ne){n.setOpen(!1,rn(LP,Ne))}function we(){fe.clear(),z.current=!0}function ze(){fe.start(Lf()?5:0,()=>{z.current=!1})}const Me=Cn(o);Me.addEventListener("pointerdown",V,!0),p&&(Me.addEventListener("keydown",L),Me.addEventListener("compositionstart",we),Me.addEventListener("compositionend",ze)),R&&(Me.addEventListener("click",W,!0),Me.addEventListener("pointerdown",W,!0),Me.addEventListener("touchstart",Z,!0),Me.addEventListener("touchmove",ce,!0),Me.addEventListener("touchend",ge,!0),Me.addEventListener("mousedown",W,!0));let je=[];return N&&(It(u)&&(je=gr(u)),It(o)&&(je=je.concat(gr(o))),!It(l)&&l&&l.contextElement&&(je=je.concat(gr(l.contextElement)))),je=je.filter(Ne=>Ne!==Me.defaultView?.visualViewport),je.forEach(Ne=>{Ne.addEventListener("scroll",xe,{passive:!0})}),()=>{Me.removeEventListener("pointerdown",V,!0),p&&(Me.removeEventListener("keydown",L),Me.removeEventListener("compositionstart",we),Me.removeEventListener("compositionend",ze)),R&&(Me.removeEventListener("click",W,!0),Me.removeEventListener("pointerdown",W,!0),Me.removeEventListener("touchstart",Z,!0),Me.removeEventListener("touchmove",ce,!0),Me.removeEventListener("touchend",ge,!0),Me.removeEventListener("mousedown",W,!0)),je.forEach(Ne=>{Ne.removeEventListener("scroll",xe)}),fe.clear()}},[m,o,l,u,p,R,a,f,N,h,M,D,L,G,W,X,Z,ce,ge,V,n]),v.useEffect(_,[R,_]);const ye=v.useMemo(()=>({onKeyDown:L,...w&&{[c6[j]]:fe=>{n.setOpen(!1,rn(Qd,fe.nativeEvent))},...j!=="intentional"&&{onClick(fe){n.setOpen(!1,rn(Qd,fe.nativeEvent))}}}}),[L,n,w,j]),be=qe(fe=>{const xe=Gn(fe.nativeEvent);!Ot(n.select("floatingElement"),xe)||fe.button!==0||(A.current=!0)}),Oe=v.useMemo(()=>({onKeyDown:L,onPointerDown:be,onMouseDown:be,onMouseUp:be,onClickCapture:$,onMouseDownCapture:$,onPointerDownCapture:$,onMouseUpCapture:$,onTouchEndCapture:$,onTouchMoveCapture:$}),[L,be,$]);return v.useMemo(()=>h?{reference:ye,floating:Oe,trigger:ye}:{},[h,ye,Oe])}var df=Symbol("NOT_FOUND");function f6(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function h6(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function m6(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(a=>typeof a=="function"?`function ${a.name||"unnamed"}()`:typeof a).join(", ");throw new TypeError(`${t}[${n}]`)}}var sj=e=>Array.isArray(e)?e:[e];function p6(e){const t=Array.isArray(e[0])?e[0]:e;return m6(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function g6(e,t){const n=[],{length:a}=e;for(let o=0;o<a;o++)n.push(e[o].apply(null,t));return n}function v6(e){let t;return{get(n){return t&&e(t.key,n)?t.value:df},put(n,a){t={key:n,value:a}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function y6(e,t){let n=[];function a(f){const m=n.findIndex(h=>t(f,h.key));if(m>-1){const h=n[m];return m>0&&(n.splice(m,1),n.unshift(h)),h.value}return df}function o(f,m){a(f)===df&&(n.unshift({key:f,value:m}),n.length>e&&n.pop())}function l(){return n}function u(){n=[]}return{get:a,put:o,getEntries:l,clear:u}}var x6=(e,t)=>e===t;function b6(e){return function(n,a){if(n===null||a===null||n.length!==a.length)return!1;const{length:o}=n;for(let l=0;l<o;l++)if(!e(n[l],a[l]))return!1;return!0}}function w6(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:a=x6,maxSize:o=1,resultEqualityCheck:l}=n,u=b6(a);let f=0;const m=o<=1?v6(u):y6(o,u);function h(){let p=m.get(arguments);if(p===df){if(p=e.apply(null,arguments),f++,l){const b=m.getEntries().find(w=>l(w.value,p));b&&(p=b.value,f!==0&&f--)}m.put(arguments,p)}return p}return h.clearCache=()=>{m.clear(),h.resetResultsCount()},h.resultsCount=()=>f,h.resetResultsCount=()=>{f=0},h}var j6=class{constructor(e){this.value=e}deref(){return this.value}},S6=typeof WeakRef<"u"?WeakRef:j6,N6=0,aj=1;function ad(){return{s:N6,v:void 0,o:null,p:null}}function fC(e,t={}){let n=ad();const{resultEqualityCheck:a}=t;let o,l=0;function u(){let f=n;const{length:m}=arguments;for(let y=0,b=m;y<b;y++){const w=arguments[y];if(typeof w=="function"||typeof w=="object"&&w!==null){let j=f.o;j===null&&(f.o=j=new WeakMap);const N=j.get(w);N===void 0?(f=ad(),j.set(w,f)):f=N}else{let j=f.p;j===null&&(f.p=j=new Map);const N=j.get(w);N===void 0?(f=ad(),j.set(w,f)):f=N}}const h=f;let p;if(f.s===aj)p=f.v;else if(p=e.apply(null,arguments),l++,a){const y=o?.deref?.()??o;y!=null&&a(y,p)&&(p=y,l!==0&&l--),o=typeof p=="object"&&p!==null||typeof p=="function"?new S6(p):p}return h.s=aj,h.v=p,p}return u.clearCache=()=>{n=ad(),u.resetResultsCount()},u.resultsCount=()=>l,u.resetResultsCount=()=>{l=0},u}function hC(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,a=(...o)=>{let l=0,u=0,f,m={},h=o.pop();typeof h=="object"&&(m=h,h=o.pop()),f6(h,`createSelector expects an output function after the inputs, but received: [${typeof h}]`);const p={...n,...m},{memoize:y,memoizeOptions:b=[],argsMemoize:w=fC,argsMemoizeOptions:j=[]}=p,N=sj(b),C=sj(j),k=p6(o),E=y(function(){return l++,h.apply(null,arguments)},...N),S=w(function(){u++;const A=g6(k,arguments);return f=E.apply(null,A),f},...C);return Object.assign(S,{resultFunc:h,memoizedResultFunc:E,dependencies:k,dependencyRecomputations:()=>u,resetDependencyRecomputations:()=>{u=0},lastResult:()=>f,recomputations:()=>l,resetRecomputations:()=>{l=0},memoize:y,argsMemoize:w})};return Object.assign(a,{withTypes:()=>a}),a}var k6=hC(fC),E6=Object.assign((e,t=k6)=>{h6(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),a=n.map(l=>e[l]);return t(a,(...l)=>l.reduce((u,f,m)=>(u[n[m]]=f,u),{}))},{withTypes:()=>E6});hC({memoize:w6,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const Qe=(e,t,n,a,o,l,...u)=>{if(u.length>0)throw new Error(yi(1));let f;if(e)f=e;else throw new Error("Missing arguments");return f};var kp={exports:{}},Ep={};var rj;function C6(){if(rj)return Ep;rj=1;var e=Ec();function t(y,b){return y===b&&(y!==0||1/y===1/b)||y!==y&&b!==b}var n=typeof Object.is=="function"?Object.is:t,a=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function f(y,b){var w=b(),j=a({inst:{value:w,getSnapshot:b}}),N=j[0].inst,C=j[1];return l(function(){N.value=w,N.getSnapshot=b,m(N)&&C({inst:N})},[y,w,b]),o(function(){return m(N)&&C({inst:N}),y(function(){m(N)&&C({inst:N})})},[y]),u(w),w}function m(y){var b=y.getSnapshot;y=y.value;try{var w=b();return!n(y,w)}catch{return!0}}function h(y,b){return b()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return Ep.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Ep}var ij;function mC(){return ij||(ij=1,kp.exports=C6()),kp.exports}var T6=mC(),Cp={exports:{}},Tp={};var oj;function A6(){if(oj)return Tp;oj=1;var e=Ec(),t=mC();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var a=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,f=e.useMemo,m=e.useDebugValue;return Tp.useSyncExternalStoreWithSelector=function(h,p,y,b,w){var j=l(null);if(j.current===null){var N={hasValue:!1,value:null};j.current=N}else N=j.current;j=f(function(){function k(M){if(!E){if(E=!0,S=M,M=b(M),w!==void 0&&N.hasValue){var D=N.value;if(w(D,M))return R=D}return R=M}if(D=R,a(S,M))return D;var U=b(M);return w!==void 0&&w(D,U)?(S=M,D):(S=M,R=U)}var E=!1,S,R,A=y===void 0?null:y;return[function(){return k(p())},A===null?void 0:function(){return k(A())}]},[p,y,b,w]);var C=o(h,j[0],j[1]);return u(function(){N.hasValue=!0,N.value=C},[C]),m(C),C},Tp}var lj;function M6(){return lj||(lj=1,Cp.exports=A6()),Cp.exports}var R6=M6();const _6=Dv(19),O6=_6?D6:z6;function I6(e,t,n,a,o){return O6(e,t,n,a,o)}function D6(e,t,n,a,o){const l=v.useCallback(()=>t(e.getSnapshot(),n,a,o),[e,t,n,a,o]);return T6.useSyncExternalStore(e.subscribe,l,l)}function z6(e,t,n,a,o){return R6.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,l=>t(l,n,a,o))}class ac{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const a of this.listeners){if(n!==this.updateTick)return;a(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){ac.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||ac.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};ac.prototype.setState.call(this,t)}}class pC extends ac{constructor(t,n={},a){super(t),this.context=n,this.selectors=a}controlledValues=new Map;useSyncedValue(t,n){v.useDebugValue(t),Fe(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){Fe(()=>(this.state[t]!==n&&this.set(t,n),()=>{this.set(t,void 0)}),[t,n])}useSyncedValues(t){const n=Object.values(t);Fe(()=>{this.update(t)},n)}useControlledProp(t,n,a){v.useDebugValue(t);const o=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,o),!o&&!Object.is(this.state[t],a)&&super.setState({...this.state,[t]:a})),Fe(()=>{o&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,a,o])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const a in n)if(Object.hasOwn(n,a)&&this.controlledValues.get(a)===!0){delete n[a];continue}super.update(n)}setState(t){const n={...t};for(const a in n)if(Object.hasOwn(n,a)&&this.controlledValues.get(a)===!0){delete n[a];continue}super.setState({...this.state,...n})}select=(t,n,a,o)=>{const l=this.selectors[t];return l(this.state,n,a,o)};useState=(t,n,a,o)=>{v.useDebugValue(t);const l=this.selectors[t];return I6(this,l,n,a,o)};useContextCallback(t,n){v.useDebugValue(t);const a=qe(n??wE);this.context[t]=a}useStateSetter(t){const n=v.useRef(void 0);return n.current===void 0&&(n.current=a=>{this.set(t,a)}),n.current}observe(t,n){let a;typeof t=="function"?a=t:a=this.selectors[t];let o=a(this.state);return n(o,o,this),this.subscribe(l=>{const u=a(l);if(!Object.is(o,u)){const f=o;o=u,n(u,f,this)}})}}const P6={open:Qe(e=>e.open),domReferenceElement:Qe(e=>e.domReferenceElement),referenceElement:Qe(e=>e.positionReference??e.referenceElement),floatingElement:Qe(e=>e.floatingElement),floatingId:Qe(e=>e.floatingId)};class Wv extends pC{constructor(t){const{nested:n,noEmit:a,onOpenChange:o,triggerElements:l,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:KE(),nested:n,noEmit:a,triggerElements:l},P6)}setOpen=(t,n)=>{if((!t||!this.state.open||ML(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const a={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",a)}this.context.onOpenChange?.(t,n)}}function L6(e){const t=e.useState("open");Fe(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[a,o]=n.value;e.update({activeTriggerId:a,activeTriggerElement:o})}}},[t,e])}function $6(e,t,n){const{mounted:a,setMounted:o,transitionStatus:l}=fL(e);t.useSyncedValues({mounted:a,transitionStatus:l});const u=qe(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),f=t.useState("preventUnmountingOnClose");return ME({enabled:!f,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:l}}class Yv{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const a=this.idMap.get(t);a!==n&&(a!==void 0&&this.elements.delete(a),this.elements.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function U6(){return new Wv({open:!1,floatingElement:null,referenceElement:null,triggerElements:new Yv,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function B6(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:U6(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:Kn,inactiveTriggerProps:Kn,popupProps:Kn}}const V6={open:Qe(e=>e.open),mounted:Qe(e=>e.mounted),transitionStatus:Qe(e=>e.transitionStatus),floatingRootContext:Qe(e=>e.floatingRootContext),preventUnmountingOnClose:Qe(e=>e.preventUnmountingOnClose),payload:Qe(e=>e.payload),activeTriggerId:Qe(e=>e.activeTriggerId),activeTriggerElement:Qe(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Qe((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:Qe((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:Qe((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:Qe((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Qe(e=>e.popupProps),popupElement:Qe(e=>e.popupElement),positionerElement:Qe(e=>e.positionerElement)};function H6(e){const{open:t=!1,onOpenChange:n,elements:a={}}=e,o=kr(),l=Ar()!=null,u=Cs(()=>new Wv({open:t,onOpenChange:n,referenceElement:a.reference??null,floatingElement:a.floating??null,triggerElements:a.triggers??new Yv,floatingId:o,nested:l,noEmit:e.noEmit||!1})).current;return Fe(()=>{const f={open:t,floatingId:o};a.reference!==void 0&&(f.referenceElement=a.reference,f.domReferenceElement=It(a.reference)?a.reference:null),a.floating!==void 0&&(f.floatingElement=a.floating),u.update(f)},[t,o,a.reference,a.floating,u]),u.context.onOpenChange=n,u.context.nested=l,u.context.noEmit=e.noEmit||!1,u}function F6(e={}){const{nodeId:t,externalTree:n}=e,a=H6(e),o=e.rootContext||a,l={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[u,f]=v.useState(null),m=v.useRef(null),h=Fo(n);Fe(()=>{l.domReference&&(m.current=l.domReference)},[l.domReference]);const p=n6({...e,elements:{...l,...u&&{reference:u}}}),y=v.useCallback(D=>{const U=It(D)?{getBoundingClientRect:()=>D.getBoundingClientRect(),getClientRects:()=>D.getClientRects(),contextElement:D}:D;f(U),p.refs.setReference(U)},[p.refs]),[b,w]=v.useState(null),[j,N]=v.useState(null);o.useSyncedValue("referenceElement",b),o.useSyncedValue("domReferenceElement",It(b)?b:null),o.useSyncedValue("floatingElement",j);const C=v.useCallback(D=>{(It(D)||D===null)&&(m.current=D,w(D)),(It(p.refs.reference.current)||p.refs.reference.current===null||D!==null&&!It(D))&&p.refs.setReference(D)},[p.refs,w]),k=v.useCallback(D=>{N(D),p.refs.setFloating(D)},[p.refs]),E=v.useMemo(()=>({...p.refs,setReference:C,setFloating:k,setPositionReference:y,domReference:m}),[p.refs,C,k,y]),S=v.useMemo(()=>({...p.elements,domReference:l.domReference}),[p.elements,l.domReference]),R=o.useState("open"),A=o.useState("floatingId"),M=v.useMemo(()=>({...p,dataRef:o.context.dataRef,open:R,onOpenChange:o.setOpen,events:o.context.events,floatingId:A,refs:E,elements:S,nodeId:t,rootStore:o}),[p,E,S,t,o,R,A]);return Fe(()=>{o.context.dataRef.current.floatingContext=M;const D=h?.nodesRef.current.find(U=>U.id===t);D&&(D.context=M)}),v.useMemo(()=>({...p,context:M,refs:E,elements:S,rootStore:o}),[p,E,S,M,o])}function Z6(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:a=!1,onOpenChange:o}=e,l=kr(),u=Ar()!=null,f=t.useState("open"),m=t.useState("activeTriggerElement"),h=t.useState(a?"popupElement":"positionerElement"),p=t.context.triggerElements,y=Cs(()=>new Wv({open:f,referenceElement:m,floatingElement:h,triggerElements:p,onOpenChange:o,floatingId:l,nested:u,noEmit:n})).current;return Fe(()=>{const b={open:f,floatingId:l,referenceElement:m,floatingElement:h};It(m)&&(b.domReferenceElement=m),y.update(b)},[f,l,m,h,y]),y.context.onOpenChange=o,y.context.nested=u,y.context.noEmit=n,y}const cj=yc("safe-polygon"),q6=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${zE}`;function W6(e){return e?!!e.closest(q6):!1}function Y6(e){const t=v.useRef(void 0),n=v.useRef(!1),a=v.useRef(void 0),o=v.useRef(!0),l=v.useRef(!1),u=v.useRef(()=>{}),f=v.useRef(!1),m=Bs(),h=Bs(),p=v.useRef(void 0);return v.useMemo(()=>{const y=e.context.dataRef.current;return y.hoverInteractionState||(y.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:a,blockMouseMoveRef:o,performedPointerEventsMutationRef:l,unbindMouseMoveRef:u,restTimeoutPendingRef:f,openChangeTimeout:m,restTimeout:h,handleCloseOptionsRef:p}),y.hoverInteractionState},[e,t,n,a,o,l,u,f,m,h,p])}const G6=new Set(["click","mousedown"]);function K6(e,t={}){const n="rootStore"in e?e.rootStore:e,a=n.useState("open"),o=n.useState("floatingElement"),l=n.useState("domReferenceElement"),{dataRef:u}=n.context,{enabled:f=!0,closeDelay:m=0,externalTree:h}=t,{pointerTypeRef:p,interactedInsideRef:y,handlerRef:b,performedPointerEventsMutationRef:w,unbindMouseMoveRef:j,restTimeoutPendingRef:N,openChangeTimeout:C,handleCloseOptionsRef:k}=Y6(n),E=Fo(h),S=Ar(),R=qe(()=>y.current?!0:u.current.openEvent?G6.has(u.current.openEvent.type):!1),A=qe(()=>{const P=u.current.openEvent?.type;return P?.includes("mouse")&&P!=="mousedown"}),M=v.useCallback((P,_=!0)=>{const z=X6(m,p.current);z&&!b.current?C.start(z,()=>n.setOpen(!1,rn(ri,P))):_&&(C.clear(),n.setOpen(!1,rn(ri,P)))},[m,b,n,p,C]),D=qe(()=>{j.current(),b.current=void 0}),U=qe(()=>{if(w.current){const P=Cn(o).body;P.style.pointerEvents="",P.removeAttribute(cj),w.current=!1}}),F=qe(P=>{const _=Gn(P);if(!W6(_)){y.current=!1;return}y.current=!0});Fe(()=>{a||(p.current=void 0,N.current=!1,y.current=!1,D(),U())},[a,p,N,y,D,U]),v.useEffect(()=>()=>{D()},[D]),v.useEffect(()=>U,[U]),Fe(()=>{if(f&&a&&k.current?.blockPointerEvents&&A()&&It(l)&&o){w.current=!0;const P=Cn(o).body;P.setAttribute(cj,"");const _=l,z=o,B=E?.nodesRef.current.find(V=>V.id===S)?.context?.elements.floating;return B&&(B.style.pointerEvents=""),P.style.pointerEvents="none",_.style.pointerEvents="auto",z.style.pointerEvents="auto",()=>{P.style.pointerEvents="",_.style.pointerEvents="",z.style.pointerEvents=""}}},[f,a,l,o,k,A,E,S,w]),v.useEffect(()=>{if(!f)return;function P(V){if(R()||!u.current.floatingContext)return;const K=n.context.triggerElements;V.relatedTarget&&K.hasElement(V.relatedTarget)||(U(),D(),R()||M(V))}function _(V){C.clear(),U(),b.current?.(V),D()}function z(V){R()||M(V,!1)}const B=o;return B&&(B.addEventListener("mouseleave",P),B.addEventListener("mouseenter",_),B.addEventListener("mouseleave",z),B.addEventListener("pointerdown",F,!0)),()=>{B&&(B.removeEventListener("mouseleave",P),B.removeEventListener("mouseenter",_),B.removeEventListener("mouseleave",z),B.removeEventListener("pointerdown",F,!0))}})}function X6(e,t){return t&&!AL(t)?0:typeof e=="function"?e():e}function J6(e=[]){const t=e.map(h=>h?.reference),n=e.map(h=>h?.floating),a=e.map(h=>h?.item),o=e.map(h=>h?.trigger),l=v.useCallback(h=>rd(h,e,"reference"),t),u=v.useCallback(h=>rd(h,e,"floating"),n),f=v.useCallback(h=>rd(h,e,"item"),a),m=v.useCallback(h=>rd(h,e,"trigger"),o);return v.useMemo(()=>({getReferenceProps:l,getFloatingProps:u,getItemProps:f,getTriggerProps:m}),[l,u,f,m])}function rd(e,t,n){const a=new Map,o=n==="item",l={};n==="floating"&&(l.tabIndex=-1,l[_g]="");for(const u in e)o&&e&&(u===IE||u===DE)||(l[u]=e[u]);for(let u=0;u<t.length;u+=1){let f;const m=t[u]?.[n];typeof m=="function"?f=e?m(e):null:f=m,f&&uj(l,f,o,a)}return uj(l,e,o,a),l}function uj(e,t,n,a){for(const o in t){const l=t[o];n&&(o===IE||o===DE)||(o.startsWith("on")?(a.has(o)||a.set(o,[]),typeof l=="function"&&(a.get(o)?.push(l),e[o]=(...u)=>a.get(o)?.map(f=>f(...u)).find(f=>f!==void 0))):e[o]=l)}}const Q6="Escape";function Vf(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function id(e,t){return Vf(t,e===Bv||e===Ac,e===vr||e===yr)}function Ap(e,t,n){return Vf(t,e===Ac,n?e===vr:e===yr)||e==="Enter"||e===" "||e===""}function e8(e,t,n){return Vf(t,n?e===vr:e===yr,e===Ac)}function t8(e,t,n,a){const o=n?e===yr:e===vr,l=e===Bv;return t==="both"||t==="horizontal"&&a&&a>1?e===Q6:Vf(t,o,l)}function n8(e,t){const n="rootStore"in e?e.rootStore:e,a=n.useState("open"),o=n.useState("floatingElement"),l=n.useState("domReferenceElement"),u=n.context.dataRef,{listRef:f,activeIndex:m,onNavigate:h=()=>{},enabled:p=!0,selectedIndex:y=null,allowEscape:b=!1,loopFocus:w=!1,nested:j=!1,rtl:N=!1,virtual:C=!1,focusItemOnOpen:k="auto",focusItemOnHover:E=!0,openOnArrowKeyDown:S=!0,disabledIndices:R=void 0,orientation:A="vertical",parentOrientation:M,cols:D=1,scrollItemIntoView:U=!0,itemSizes:F,dense:P=!1,id:_,resetOnPointerLeave:z=!0,externalTree:B}=t,V=ef(o),K=Yn(V),L=Ar(),H=Fo(B);Fe(()=>{u.current.orientation=A},[u,A]);const $=Og(l),G=v.useRef(k),X=v.useRef(y??-1),O=v.useRef(null),Z=v.useRef(!0),W=qe(pe=>{h(X.current===-1?null:X.current,pe)}),Q=v.useRef(W),ce=v.useRef(!!o),ae=v.useRef(a),ge=v.useRef(!1),ye=v.useRef(!1),be=Yn(R),Oe=Yn(a),fe=Yn(U),xe=Yn(y),we=Yn(z),ze=qe(()=>{function pe(et){C?H?.events.emit("virtualfocus",et):_d(et,{sync:ge.current,preventScroll:!0})}const ke=f.current[X.current],Ee=ye.current;ke&&pe(ke),(ge.current?et=>et():requestAnimationFrame)(()=>{const et=f.current[X.current]||ke;if(!et)return;ke||pe(et);const Ye=fe.current;Ye&&je&&(Ee||!Z.current)&&et.scrollIntoView?.(typeof Ye=="boolean"?{block:"nearest",inline:"nearest"}:Ye)})});Fe(()=>{p&&(a&&o?(X.current=y??-1,G.current&&y!=null&&(ye.current=!0,W())):ce.current&&(X.current=-1,Q.current()))},[p,a,o,y,W]),Fe(()=>{if(p){if(!a){ge.current=!1;return}if(o)if(m==null){if(ge.current=!1,xe.current!=null)return;if(ce.current&&(X.current=-1,ze()),(!ae.current||!ce.current)&&G.current&&(O.current!=null||G.current===!0&&O.current==null)){let pe=0;const ke=()=>{f.current[0]==null?(pe<2&&(pe?requestAnimationFrame:queueMicrotask)(ke),pe+=1):(X.current=O.current==null||Ap(O.current,A,N)||j?bp(f):V1(f),O.current=null,W())};ke()}}else tc(f,m)||(X.current=m,ze(),ye.current=!1)}},[p,a,o,m,xe,j,f,A,N,W,ze,be]),Fe(()=>{if(!p||o||!H||C||!ce.current)return;const pe=H.nodesRef.current,ke=pe.find(et=>et.id===L)?.context?.elements.floating,Ee=fr(Cn(o)),Je=pe.some(et=>et.context&&Ot(et.context.elements.floating,Ee));ke&&!Je&&Z.current&&ke.focus({preventScroll:!0})},[p,o,H,L,C]),Fe(()=>{Q.current=W,ae.current=a,ce.current=!!o}),Fe(()=>{a||(O.current=null,G.current=k)},[a,k]);const Me=m!=null,je=v.useMemo(()=>{function pe(Ee){if(!Oe.current)return;const Je=f.current.indexOf(Ee.currentTarget);Je!==-1&&X.current!==Je&&(X.current=Je,W(Ee))}return{onFocus(Ee){ge.current=!0,pe(Ee)},onClick:({currentTarget:Ee})=>Ee.focus({preventScroll:!0}),onMouseMove(Ee){ge.current=!0,ye.current=!1,E&&pe(Ee)},onPointerLeave(Ee){if(!Oe.current||!Z.current||Ee.pointerType==="touch")return;ge.current=!0;const Je=Ee.relatedTarget;!E||f.current.includes(Je)||we.current&&(X.current=-1,W(Ee),C||K.current?.focus({preventScroll:!0}))}}},[Oe,K,E,f,W,we,C]),Ne=v.useCallback(()=>M??H?.nodesRef.current.find(pe=>pe.id===L)?.context?.dataRef?.current.orientation,[L,H,M]),We=qe(pe=>{if(Z.current=!1,ge.current=!0,pe.which===229||!Oe.current&&pe.currentTarget===K.current)return;if(j&&t8(pe.key,A,N,D)){id(pe.key,Ne())||Tn(pe),n.setOpen(!1,rn(Rd,pe.nativeEvent)),Qt(l)&&(C?H?.events.emit("virtualfocus",l):l.focus());return}const ke=X.current,Ee=bp(f,R),Je=V1(f,R);if($||(pe.key==="Home"&&(Tn(pe),X.current=Ee,W(pe)),pe.key==="End"&&(Tn(pe),X.current=Je,W(pe))),D>1){const et=F||Array.from({length:f.current.length},()=>({width:1,height:1})),Ye=HL(et,D,P),Bt=Ye.findIndex(mn=>mn!=null&&!nc(f,mn,R)),Et=Ye.reduce((mn,on,Ie)=>on!=null&&!nc(f,on,R)?Ie:mn,-1),hn=Ye[VL({current:Ye.map(mn=>mn!=null?f.current[mn]:null)},{event:pe,orientation:A,loopFocus:w,rtl:N,cols:D,disabledIndices:ZL([...(typeof R!="function"?R:null)||f.current.map((mn,on)=>nc(f,on,R)?on:void 0),void 0],Ye),minIndex:Bt,maxIndex:Et,prevIndex:FL(X.current>Je?Ee:X.current,et,Ye,D,pe.key===Ac?"bl":pe.key===(N?vr:yr)?"tr":"tl"),stopEvent:!0})];if(hn!=null&&(X.current=hn,W(pe)),A==="both")return}if(id(pe.key,A)){if(Tn(pe),a&&!C&&fr(pe.currentTarget.ownerDocument)===pe.currentTarget){X.current=Ap(pe.key,A,N)?Ee:Je,W(pe);return}Ap(pe.key,A,N)?w?ke>=Je?b&&ke!==f.current.length?X.current=-1:(ge.current=!1,X.current=Ee):X.current=Rn(f,{startingIndex:ke,disabledIndices:R}):X.current=Math.min(Je,Rn(f,{startingIndex:ke,disabledIndices:R})):w?ke<=Ee?b&&ke!==-1?X.current=f.current.length:(ge.current=!1,X.current=Je):X.current=Rn(f,{startingIndex:ke,decrement:!0,disabledIndices:R}):X.current=Math.max(Ee,Rn(f,{startingIndex:ke,decrement:!0,disabledIndices:R})),tc(f,X.current)&&(X.current=-1),W(pe)}}),Be=v.useMemo(()=>C&&a&&Me&&{"aria-activedescendant":`${_}-${m}`},[C,a,Me,_,m]),He=v.useMemo(()=>({"aria-orientation":A==="both"?void 0:A,...$?{}:Be,onKeyDown(pe){if(pe.key==="Tab"&&pe.shiftKey&&a&&!C){const ke=Gn(pe.nativeEvent);if(ke&&!Ot(K.current,ke))return;Tn(pe),n.setOpen(!1,rn(Df,pe.nativeEvent)),Qt(l)&&l.focus();return}We(pe)},onPointerMove(){Z.current=!0}}),[Be,We,K,A,$,n,a,C,l]),le=v.useMemo(()=>{function pe(Ee){k==="auto"&&PE(Ee.nativeEvent)&&(G.current=!C)}function ke(Ee){G.current=k,k==="auto"&&LE(Ee.nativeEvent)&&(G.current=!0)}return{onKeyDown(Ee){const Je=n.select("open");Z.current=!1;const et=Ee.key.startsWith("Arrow"),Ye=e8(Ee.key,Ne(),N),Bt=id(Ee.key,A),Et=(j?Ye:Bt)||Ee.key==="Enter"||Ee.key.trim()==="";if(C&&Je)return We(Ee);if(!(!Je&&!S&&et)){if(Et){const hn=id(Ee.key,Ne());O.current=j&&hn?null:Ee.key}if(j){Ye&&(Tn(Ee),Je?(X.current=bp(f,be.current),W(Ee)):n.setOpen(!0,rn(Rd,Ee.nativeEvent,Ee.currentTarget)));return}Bt&&(xe.current!=null&&(X.current=xe.current),Tn(Ee),!Je&&S?n.setOpen(!0,rn(Rd,Ee.nativeEvent,Ee.currentTarget)):We(Ee),Je&&W(Ee))}},onFocus(Ee){n.select("open")&&!C&&(X.current=-1,W(Ee))},onPointerDown:ke,onPointerEnter:ke,onMouseDown:pe,onClick:pe}},[We,be,k,f,j,W,n,S,A,Ne,N,xe,C]),he=v.useMemo(()=>({...Be,...le}),[Be,le]);return v.useMemo(()=>p?{reference:he,floating:He,item:je,trigger:le}:{},[p,he,He,le,je])}const s8=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function a8(e,t={}){const n="rootStore"in e?e.rootStore:e,a=n.useState("open"),o=n.useState("floatingId"),l=n.useState("domReferenceElement"),u=n.useState("floatingElement"),{enabled:f=!0,role:m="dialog"}=t,h=kr(),p=l?.id||h,y=v.useMemo(()=>ef(u)?.id||o,[u,o]),b=s8.get(m)??m,j=Ar()!=null,N=v.useMemo(()=>b==="tooltip"||m==="label"?Kn:{"aria-haspopup":b==="alertdialog"?"dialog":b,"aria-expanded":"false",...b==="listbox"&&{role:"combobox"},...b==="menu"&&j&&{role:"menuitem"},...m==="select"&&{"aria-autocomplete":"none"},...m==="combobox"&&{"aria-autocomplete":"list"}},[b,j,m]),C=v.useMemo(()=>b==="tooltip"||m==="label"?{[`aria-${m==="label"?"labelledby":"describedby"}`]:a?y:void 0}:{...N,"aria-expanded":a?"true":"false","aria-controls":a?y:void 0,...b==="menu"&&{id:p}},[b,y,a,p,m,N]),k=v.useMemo(()=>{const S={id:y,...b&&{role:b}};return b==="tooltip"||m==="label"?S:{...S,...b==="menu"&&{"aria-labelledby":p}}},[b,y,p,m]),E=v.useCallback(({active:S,selected:R})=>{const A={role:"option",...S&&{id:`${y}-fui-option`}};switch(m){case"select":case"combobox":return{...A,"aria-selected":R}}return{}},[y,m]);return v.useMemo(()=>f?{reference:C,floating:k,item:E,trigger:N}:{},[f,C,k,N,E])}function r8(e,t){const n="rootStore"in e?e.rootStore:e,a=n.useState("open"),o=n.context.dataRef,{listRef:l,activeIndex:u,onMatch:f,onTypingChange:m,enabled:h=!0,findMatch:p=null,resetMs:y=750,ignoreKeys:b=jE,selectedIndex:w=null}=t,j=Bs(),N=v.useRef(""),C=v.useRef(w??u??-1),k=v.useRef(null);Fe(()=>{a&&(j.clear(),k.current=null,N.current="")},[a,j]),Fe(()=>{a&&N.current===""&&(C.current=w??u??-1)},[a,w,u]);const E=qe(M=>{M?o.current.typing||(o.current.typing=M,m?.(M)):o.current.typing&&(o.current.typing=M,m?.(M))}),S=qe(M=>{function D(z,B,V){const K=p?p(B,V):B.find(L=>L?.toLocaleLowerCase().indexOf(V.toLocaleLowerCase())===0);return K?z.indexOf(K):-1}const U=l.current;if(N.current.length>0&&N.current[0]!==" "&&(D(U,U,N.current)===-1?E(!1):M.key===" "&&Tn(M)),U==null||b.includes(M.key)||M.key.length!==1||M.ctrlKey||M.metaKey||M.altKey)return;a&&M.key!==" "&&(Tn(M),E(!0)),U.every(z=>z?z[0]?.toLocaleLowerCase()!==z[1]?.toLocaleLowerCase():!0)&&N.current===M.key&&(N.current="",C.current=k.current),N.current+=M.key,j.start(y,()=>{N.current="",C.current=k.current,E(!1)});const P=C.current,_=D(U,[...U.slice((P||0)+1),...U.slice(0,(P||0)+1)],N.current);_!==-1?(f?.(_),k.current=_):M.key!==" "&&(N.current="",E(!1))}),R=v.useMemo(()=>({onKeyDown:S}),[S]),A=v.useMemo(()=>({onKeyDown:S,onKeyUp(M){M.key===" "&&E(!1)}}),[S,E]);return v.useMemo(()=>h?{reference:R,floating:A}:{},[h,R,A])}const i8=v.createContext(void 0);function o8(e){return v.useContext(i8)}const gC="ArrowUp",vC="ArrowDown",yC="ArrowLeft",xC="ArrowRight",bC="Home",wC="End",l8=new Set([yC,xC]),c8=new Set([gC,vC]),u8=new Set([...l8,...c8]);[...u8];const d8=new Set([gC,vC,yC,xC,bC,wC]);function f8(e){return e==="starting"?SP:Kn}const h8={...SE,..._P},m8=v.forwardRef(function(t,n){const{render:a,className:o,finalFocus:l,...u}=t,{store:f}=Vo(),{side:m,align:h}=gE(),p=o8()!=null,y=f.useState("open"),b=f.useState("transitionStatus"),w=f.useState("popupProps"),j=f.useState("mounted"),N=f.useState("instantType"),C=f.useState("activeTriggerElement"),k=f.useState("parent"),E=f.useState("lastOpenChangeReason"),S=f.useState("rootId"),R=f.useState("floatingRootContext"),A=f.useState("floatingTreeRoot"),M=f.useState("closeDelay"),D=f.useState("activeTriggerElement");ME({open:y,ref:f.context.popupRef,onComplete(){y&&f.context.onOpenChangeComplete?.(!0)}}),v.useEffect(()=>{function B(V){f.setOpen(!1,rn(V.reason,V.domEvent))}return A.events.on("close",B),()=>{A.events.off("close",B)}},[A.events,f]);const U=f.useState("hoverEnabled"),F=f.useState("disabled");K6(R,{enabled:U&&!F&&k.type!=="context-menu"&&k.type!=="menubar",closeDelay:M});const P=v.useMemo(()=>({transitionStatus:b,side:m,align:h,open:y,nested:k.type==="menu",instant:N}),[b,m,h,y,k.type,N]),_=Er("div",t,{state:P,ref:[n,f.context.popupRef],stateAttributesMapping:h8,props:[w,{onKeyDown(B){p&&d8.has(B.key)&&B.stopPropagation()}},f8(b),u,{"data-rootownerid":S}]});let z=k.type===void 0||k.type==="context-menu";return(C||k.type==="menubar"&&E!==Pv)&&(z=!0),i.jsx(w$,{context:R,modal:!1,disabled:!j,returnFocus:l===void 0?z:l,initialFocus:k.type!=="menu",restoreFocus:!0,externalTree:k.type!=="menubar"?A:void 0,previousFocusableElement:D,nextFocusableElement:k.type===void 0?f.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:k.type===void 0?f.context.beforeContentFocusGuardRef:void 0,children:_})}),jC=v.createContext(void 0);function p8(){const e=v.useContext(jC);if(e===void 0)throw new Error(yi(32));return e}const g8=v.forwardRef(function(t,n){const{keepMounted:a=!1,...o}=t,{store:l}=Vo();return l.useState("mounted")||a?i.jsx(jC.Provider,{value:a,children:i.jsx(g$,{ref:n,...o})}):null});function v8(e){return Dv(19)?e:e?"true":void 0}const y8=v.createContext(void 0);function SC(){return v.useContext(y8)?.direction??"ltr"}const x8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:o,rects:l,platform:u,elements:f,middlewareData:m}=t,{element:h,padding:p=0,offsetParent:y="real"}=Ra(e,t)||{};if(h==null)return{};const b=$E(p),w={x:n,y:a},j=Fv(o),N=Hv(j),C=await u.getDimensions(h),k=j==="y",E=k?"top":"left",S=k?"bottom":"right",R=k?"clientHeight":"clientWidth",A=l.reference[N]+l.reference[j]-w[j]-l.floating[N],M=w[j]-l.reference[j],D=y==="real"?await u.getOffsetParent?.(h):f.floating;let U=f.floating[R]||l.floating[N];(!U||!await u.isElement?.(D))&&(U=f.floating[R]||l.floating[N]);const F=A/2-M/2,P=U/2-C[N]/2-1,_=Math.min(b[E],P),z=Math.min(b[S],P),B=_,V=U-C[N]-z,K=U/2-C[N]/2+F,L=Ig(B,K,V),H=!m.arrow&&Tr(o)!=null&&K!==L&&l.reference[N]/2-(K<B?_:z)-C[N]/2<0,$=H?K<B?K-B:K-V:0;return{[j]:w[j]+$,data:{[j]:L,centerOffset:K-L-$,...H&&{alignmentOffset:$}},reset:H}}}),b8=(e,t)=>({...x8(e),options:[e,t]}),w8={name:"hide",async fn(e){const{width:t,height:n,x:a,y:o}=e.rects.reference,l=t===0&&n===0&&a===0&&o===0;return{data:{referenceHidden:(await l6().fn(e)).data?.referenceHidden||l}}}},j8={sideX:"left",sideY:"top"};function NC(e,t,n){const a=e==="inline-start"||e==="inline-end";return{top:"top",right:a?n?"inline-start":"inline-end":"right",bottom:"bottom",left:a?n?"inline-end":"inline-start":"left"}[t]}function dj(e,t,n){const{rects:a,placement:o}=e;return{side:NC(t,ls(o),n),align:Tr(o)||"center",anchor:{width:a.reference.width,height:a.reference.height},positioner:{width:a.floating.width,height:a.floating.height}}}function S8(e){const{anchor:t,positionMethod:n="absolute",side:a="bottom",sideOffset:o=0,align:l="center",alignOffset:u=0,collisionBoundary:f,collisionPadding:m=5,sticky:h=!1,arrowPadding:p=5,disableAnchorTracking:y=!1,keepMounted:b=!1,floatingRootContext:w,mounted:j,collisionAvoidance:N,shiftCrossAxis:C=!1,nodeId:k,adaptiveOrigin:E,lazyFlip:S=!1,externalTree:R}=e,[A,M]=v.useState(null);!j&&A!==null&&M(null);const D=N.side||"flip",U=N.align||"flip",F=N.fallbackAxisSide||"end",P=typeof t=="function"?t:void 0,_=qe(P),z=P?_:t,B=Yn(t),K=SC()==="rtl",L=A||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":K?"left":"right","inline-start":K?"right":"left"}[a],H=l==="center"?L:`${L}-${l}`;let $=m;const G=1,X=a==="bottom"?G:0,O=a==="top"?G:0,Z=a==="right"?G:0,W=a==="left"?G:0;typeof $=="number"?$={top:$+X,right:$+W,bottom:$+O,left:$+Z}:$&&($={top:($.top||0)+X,right:($.right||0)+W,bottom:($.bottom||0)+O,left:($.left||0)+Z});const Q={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:$},ce=v.useRef(null),ae=Yn(o),ge=Yn(u),Oe=[s6(xt=>{const Pt=dj(xt,a,K),yn=typeof ae.current=="function"?ae.current(Pt):ae.current,Kt=typeof ge.current=="function"?ge.current(Pt):ge.current;return{mainAxis:yn,crossAxis:Kt,alignmentAxis:Kt}},[typeof o!="function"?o:0,typeof u!="function"?u:0,K,a])],fe=U==="none"&&D!=="shift",xe=!fe&&(h||C||D==="shift"),we=D==="none"?null:i6({...Q,padding:{top:$.top+G,right:$.right+G,bottom:$.bottom+G,left:$.left+G},mainAxis:!C&&D==="flip",crossAxis:U==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),ze=fe?null:a6(xt=>{const Pt=mi(xt.elements.floating).documentElement;return{...Q,rootBoundary:C?{x:0,y:0,width:Pt.clientWidth,height:Pt.clientHeight}:void 0,mainAxis:U!=="none",crossAxis:xe,limiter:h||C?void 0:r6(yn=>{if(!ce.current)return{};const{width:Kt,height:pn}=ce.current.getBoundingClientRect(),ln=Ss(ls(yn.placement)),xn=ln==="y"?Kt:pn,As=ln==="y"?$.left+$.right:$.top+$.bottom;return{offset:xn/2+As/2}})}},[Q,h,C,$,U]);D==="shift"||U==="shift"||l==="center"?Oe.push(ze,we):Oe.push(we,ze),Oe.push(o6({...Q,apply({elements:{floating:xt},rects:{reference:Pt},availableWidth:yn,availableHeight:Kt}){Object.entries({"--available-width":`${yn}px`,"--available-height":`${Kt}px`,"--anchor-width":`${Pt.width}px`,"--anchor-height":`${Pt.height}px`}).forEach(([pn,ln])=>{xt.style.setProperty(pn,ln)})}}),b8(()=>({element:ce.current||document.createElement("div"),padding:p,offsetParent:"floating"}),[p]),{name:"transformOrigin",fn(xt){const{elements:Pt,middlewareData:yn,placement:Kt,rects:pn,y:ln}=xt,xn=ls(Kt),As=Ss(xn),ee=ce.current,me=yn.arrow?.x||0,ve=yn.arrow?.y||0,Ve=ee?.clientWidth||0,Le=ee?.clientHeight||0,dt=me+Ve/2,Lt=ve+Le/2,Zt=Math.abs(yn.shift?.y||0),bn=pn.reference.height/2,qt=typeof o=="function"?o(dj(xt,a,K)):o,Ms=Zt>qt,cn={top:`${dt}px calc(100% + ${qt}px)`,bottom:`${dt}px ${-qt}px`,left:`calc(100% + ${qt}px) ${Lt}px`,right:`${-qt}px ${Lt}px`}[xn],Pc=`${dt}px ${pn.reference.y+bn-ln}px`;return Pt.floating.style.setProperty("--transform-origin",xe&&As==="y"&&Ms?Pc:cn),{}}},w8,E),Fe(()=>{!j&&w&&w.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[j,w]);const Me=v.useMemo(()=>({elementResize:!y&&typeof ResizeObserver<"u",layoutShift:!y&&typeof IntersectionObserver<"u"}),[y]),{refs:je,elements:Ne,x:We,y:Be,middlewareData:He,update:le,placement:he,context:pe,isPositioned:ke,floatingStyles:Ee}=F6({rootContext:w,placement:H,middleware:Oe,strategy:n,whileElementsMounted:b?void 0:(...xt)=>tj(...xt,Me),nodeId:k,externalTree:R}),{sideX:Je,sideY:et}=He.adaptiveOrigin||j8,Ye=ke?n:"fixed",Bt=v.useMemo(()=>E?{position:Ye,[Je]:We,[et]:Be}:{position:Ye,...Ee},[E,Ye,Je,We,et,Be,Ee]),Et=v.useRef(null);Fe(()=>{if(!j)return;const xt=B.current,Pt=typeof xt=="function"?xt():xt,Kt=(fj(Pt)?Pt.current:Pt)||null||null;Kt!==Et.current&&(je.setPositionReference(Kt),Et.current=Kt)},[j,je,z,B]),v.useEffect(()=>{if(!j)return;const xt=B.current;typeof xt!="function"&&fj(xt)&&xt.current!==Et.current&&(je.setPositionReference(xt.current),Et.current=xt.current)},[j,je,z,B]),v.useEffect(()=>{if(b&&j&&Ne.domReference&&Ne.floating)return tj(Ne.domReference,Ne.floating,le,Me)},[b,j,Ne,le,Me]);const hn=ls(he),mn=NC(a,hn,K),on=Tr(he)||"center",Ie=!!He.hide?.referenceHidden;Fe(()=>{S&&j&&ke&&M(hn)},[S,j,ke,hn]);const tt=v.useMemo(()=>({position:"absolute",top:He.arrow?.y,left:He.arrow?.x}),[He.arrow]),ut=He.arrow?.centerOffset!==0;return v.useMemo(()=>({positionerStyles:Bt,arrowStyles:tt,arrowRef:ce,arrowUncentered:ut,side:mn,align:on,physicalSide:hn,anchorHidden:Ie,refs:je,context:pe,isPositioned:ke,update:le}),[Bt,tt,ce,ut,mn,on,hn,Ie,je,pe,ke,le])}function fj(e){return e!=null&&"current"in e}function N8(e){const{children:t,elementsRef:n,labelsRef:a,onMapChange:o}=e,l=qe(o),u=v.useRef(0),f=Cs(E8).current,m=Cs(k8).current,[h,p]=v.useState(0),y=v.useRef(h),b=qe((k,E)=>{m.set(k,E??null),y.current+=1,p(y.current)}),w=qe(k=>{m.delete(k),y.current+=1,p(y.current)}),j=v.useMemo(()=>{const k=new Map;return Array.from(m.keys()).filter(S=>S.isConnected).sort(C8).forEach((S,R)=>{const A=m.get(S)??{};k.set(S,{...A,index:R})}),k},[m,h]);Fe(()=>{if(typeof MutationObserver!="function"||j.size===0)return;const k=new MutationObserver(E=>{const S=new Set,R=A=>S.has(A)?S.delete(A):S.add(A);E.forEach(A=>{A.removedNodes.forEach(R),A.addedNodes.forEach(R)}),S.size===0&&(y.current+=1,p(y.current))});return j.forEach((E,S)=>{S.parentElement&&k.observe(S.parentElement,{childList:!0})}),()=>{k.disconnect()}},[j]),Fe(()=>{y.current===h&&(n.current.length!==j.size&&(n.current.length=j.size),a&&a.current.length!==j.size&&(a.current.length=j.size),u.current=j.size),l(j)},[l,j,n,a,h]),Fe(()=>()=>{n.current=[]},[n]),Fe(()=>()=>{a&&(a.current=[])},[a]);const N=qe(k=>(f.add(k),()=>{f.delete(k)}));Fe(()=>{f.forEach(k=>k(j))},[f,j]);const C=v.useMemo(()=>({register:b,unregister:w,subscribeMapChange:N,elementsRef:n,labelsRef:a,nextIndexRef:u}),[b,w,N,n,a,u]);return i.jsx(CE.Provider,{value:C,children:t})}function k8(){return new Map}function E8(){return new Set}function C8(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const T8=v.forwardRef(function(t,n){const{cutout:a,...o}=t;let l;if(a){const u=a?.getBoundingClientRect();l=`polygon(
111
- 0% 0%,
112
- 100% 0%,
113
- 100% 100%,
114
- 0% 100%,
115
- 0% 0%,
116
- ${u.left}px ${u.top}px,
117
- ${u.left}px ${u.bottom}px,
118
- ${u.right}px ${u.bottom}px,
119
- ${u.right}px ${u.top}px,
120
- ${u.left}px ${u.top}px
121
- )`}return i.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:l}})}),A8=v.forwardRef(function(t,n){const{anchor:a,positionMethod:o="absolute",className:l,render:u,side:f,align:m,sideOffset:h=0,alignOffset:p=0,collisionBoundary:y="clipping-ancestors",collisionPadding:b=5,arrowPadding:w=5,sticky:j=!1,disableAnchorTracking:N=!1,collisionAvoidance:C=kP,...k}=t,{store:E}=Vo(),S=p8(),R=Of(!0),A=E.useState("parent"),M=E.useState("floatingRootContext"),D=E.useState("floatingTreeRoot"),U=E.useState("mounted"),F=E.useState("open"),P=E.useState("modal"),_=E.useState("activeTriggerElement"),z=E.useState("lastOpenChangeReason"),B=E.useState("floatingNodeId"),V=E.useState("floatingParentNodeId");let K=a,L=h,H=p,$=m;A.type==="context-menu"&&(K=a??A.context?.anchor,$=$??"start",!f&&$!=="center"&&(H=t.alignOffset??2,L=t.sideOffset??-5));let G=f,X=$;A.type==="menu"?(G=G??"inline-end",X=X??"start"):A.type==="menubar"&&(G=G??"bottom",X=X??"start");const O=A.type==="context-menu",Z=S8({anchor:K,floatingRootContext:M,positionMethod:R?"fixed":o,mounted:U,side:G,sideOffset:L,align:X,alignOffset:H,arrowPadding:O?0:w,collisionBoundary:y,collisionPadding:b,sticky:j,nodeId:B,keepMounted:S,disableAnchorTracking:N,collisionAvoidance:C,shiftCrossAxis:O,externalTree:D}),W=v.useMemo(()=>{const be={};return F||(be.pointerEvents="none"),{role:"presentation",hidden:!U,style:{...Z.positionerStyles,...be}}},[F,U,Z.positionerStyles]);v.useEffect(()=>{function be(Oe){Oe.open?(Oe.parentNodeId===B&&E.set("hoverEnabled",!1),Oe.nodeId!==B&&Oe.parentNodeId===E.select("floatingParentNodeId")&&E.setOpen(!1,rn(Gl))):Oe.parentNodeId===B&&Oe.reason!==Gl&&E.set("hoverEnabled",!0)}return D.events.on("menuopenchange",be),()=>{D.events.off("menuopenchange",be)}},[E,D.events,B]),v.useEffect(()=>{if(E.select("floatingParentNodeId")==null)return;function be(Oe){if(Oe.open||Oe.nodeId!==E.select("floatingParentNodeId"))return;const fe=Oe.reason??Gl;E.setOpen(!1,rn(fe))}return D.events.on("menuopenchange",be),()=>{D.events.off("menuopenchange",be)}},[D.events,E]),v.useEffect(()=>{function be(Oe){!F||Oe.nodeId!==E.select("floatingParentNodeId")||Oe.target&&_&&_!==Oe.target&&E.setOpen(!1,rn(Gl))}return D.events.on("itemhover",be),()=>{D.events.off("itemhover",be)}},[D.events,F,_,E]),v.useEffect(()=>{const be={open:F,nodeId:B,parentNodeId:V,reason:E.select("lastOpenChangeReason")};D.events.emit("menuopenchange",be)},[D.events,F,E,B,V]);const Q=v.useMemo(()=>({open:F,side:Z.side,align:Z.align,anchorHidden:Z.anchorHidden,nested:A.type==="menu"}),[F,Z.side,Z.align,Z.anchorHidden,A.type]),ce=v.useMemo(()=>({side:Z.side,align:Z.align,arrowRef:Z.arrowRef,arrowUncentered:Z.arrowUncentered,arrowStyles:Z.arrowStyles,nodeId:Z.context.nodeId}),[Z.side,Z.align,Z.arrowRef,Z.arrowUncentered,Z.arrowStyles,Z.context.nodeId]),ae=Er("div",t,{state:Q,stateAttributesMapping:SE,ref:[n,E.useStateSetter("positionerElement")],props:[W,k]}),ge=U&&A.type!=="menu"&&(A.type!=="menubar"&&P&&z!==ri||A.type==="menubar"&&A.context.modal);let ye=null;return A.type==="menubar"?ye=A.context.contentElement:A.type===void 0&&(ye=_),i.jsxs(pE.Provider,{value:ce,children:[ge&&i.jsx(T8,{ref:A.type==="context-menu"||A.type==="nested-context-menu"?A.context.internalBackdropRef:null,inert:v8(!F),cutout:ye}),i.jsx(c$,{id:B,children:i.jsx(N8,{elementsRef:E.context.itemDomElements,labelsRef:E.context.itemLabels,children:ae})})]})});let hj={},mj={},pj="";function M8(e){if(typeof document>"u")return!1;const t=mi(e);return An(t).innerWidth-t.documentElement.clientWidth>0}function R8(e){const t=mi(e),n=t.documentElement,a=t.body,o=xi(n)?n:a,l=o.style.overflow;return o.style.overflow="hidden",()=>{o.style.overflow=l}}function _8(e){const t=mi(e),n=t.documentElement,a=t.body,o=An(n);let l=0,u=0;const f=Js.create(),m=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(xL&&(o.visualViewport?.scale??1)!==1)return()=>{};function h(){const b=o.getComputedStyle(n),w=o.getComputedStyle(a),C=(b.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";l=n.scrollTop,u=n.scrollLeft,hj={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},pj=n.style.scrollBehavior,mj={position:a.style.position,height:a.style.height,width:a.style.width,boxSizing:a.style.boxSizing,overflowY:a.style.overflowY,overflowX:a.style.overflowX,scrollBehavior:a.style.scrollBehavior};const k=n.scrollHeight>n.clientHeight,E=n.scrollWidth>n.clientWidth,S=b.overflowY==="scroll"||w.overflowY==="scroll",R=b.overflowX==="scroll"||w.overflowX==="scroll",A=Math.max(0,o.innerWidth-n.clientWidth),M=Math.max(0,o.innerHeight-n.clientHeight),D=parseFloat(w.marginTop)+parseFloat(w.marginBottom),U=parseFloat(w.marginLeft)+parseFloat(w.marginRight),F=xi(n)?n:a;if(m){n.style.scrollbarGutter=C,F.style.overflowY="hidden",F.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:C,overflowY:"hidden",overflowX:"hidden"}),(k||S)&&(n.style.overflowY="scroll"),(E||R)&&(n.style.overflowX="scroll"),Object.assign(a.style,{position:"relative",height:D||M?`calc(100dvh - ${D+M}px)`:"100dvh",width:U||A?`calc(100vw - ${U+A}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),a.scrollTop=l,a.scrollLeft=u,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function p(){Object.assign(n.style,hj),Object.assign(a.style,mj),m||(n.scrollTop=l,n.scrollLeft=u,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=pj)}function y(){p(),f.request(h)}return h(),o.addEventListener("resize",y),()=>{f.cancel(),p(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",y)}}class O8{lockCount=0;restore=null;timeoutLock=zo.create();timeoutUnlock=zo.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const a=mi(t).documentElement,o=An(a).getComputedStyle(a).overflowY;if(o==="hidden"||o==="clip"){this.restore=wE;return}const l=bL||!M8(t);this.restore=l?R8(t):_8(t)}}const I8=new O8;function D8(e=!0,t=null){Fe(()=>{if(e)return I8.acquire(t)},[e,t])}const z8=v.createContext(null);function P8(e){return v.useContext(z8)}function L8(e){const t=v.useRef(""),n=v.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:v.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o&&e(o,o.pointerType),e(o,t.current),t.current=""},[e]),onPointerDown:n}}function $8(e){const[t,n]=v.useState(null),a=qe((f,m)=>{e||n(m)}),o=v.useCallback(()=>{n(null)},[]),{onClick:l,onPointerDown:u}=L8(a);return v.useMemo(()=>({openMethod:t,reset:o,triggerProps:{onClick:l,onPointerDown:u}}),[t,o,l,u])}const U8={...V6,disabled:Qe(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Qe(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Qe(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Qe(e=>e.stickIfOpen),parent:Qe(e=>e.parent),rootId:Qe(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Qe(e=>e.activeIndex),isActive:Qe((e,t)=>e.activeIndex===t),hoverEnabled:Qe(e=>e.hoverEnabled),instantType:Qe(e=>e.instantType),lastOpenChangeReason:Qe(e=>e.openChangeReason),floatingTreeRoot:Qe(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Qe(e=>e.floatingNodeId),floatingParentNodeId:Qe(e=>e.floatingParentNodeId),itemProps:Qe(e=>e.itemProps),closeDelay:Qe(e=>e.closeDelay),keyboardEventRelay:Qe(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Gv extends pC{constructor(t){super({...B8(),...t},{positionerRef:v.createRef(),popupRef:v.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:v.createRef(),beforeContentFocusGuardRef:v.createRef(),onOpenChangeComplete:void 0,triggerElements:new Yv},U8),this.observe(Qe(n=>n.allowMouseEnter),(n,a)=>{this.state.parent.type==="menu"&&n!==a&&this.state.parent.store.set("allowMouseEnter",n)}),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}static useStore(t,n){return Cs(()=>t??new Gv(n)).current}unsubscribeParentListener=null}function B8(){return{...B6(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new XE,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Kn,keyboardEventRelay:void 0,closeDelay:0}}const V8=v.createContext(void 0);function H8(){return v.useContext(V8)}function F8(e){const{children:t,open:n,onOpenChange:a,onOpenChangeComplete:o,defaultOpen:l=!1,disabled:u=!1,modal:f,loopFocus:m=!0,orientation:h="vertical",actionsRef:p,closeParentOnEsc:y=!0,handle:b,triggerId:w,defaultTriggerId:j=null,highlightItemOnHover:N=!0}=e,C=Of(!0),k=Vo(!0),E=P8(),S=H8(),R=v.useMemo(()=>S&&k?{type:"menu",store:k.store}:E?{type:"menubar",context:E}:C&&!k?{type:"context-menu",context:C}:{type:void 0},[C,k,E,S]),A=Gv.useStore(b?.store,{parent:R}),M=A.useState("floatingTreeRoot"),D=l$(M),U=Ar();Fe(()=>{C&&!k?A.update({parent:{type:"context-menu",context:C},floatingNodeId:D,floatingParentNodeId:U}):k&&A.update({floatingNodeId:D,floatingParentNodeId:U})},[C,k,D,U,A]),A.useControlledProp("open",n,l),A.useControlledProp("activeTriggerId",w,j),A.useContextCallback("onOpenChangeComplete",o);const F=A.useState("open"),P=A.useState("activeTriggerElement"),_=A.useState("positionerElement"),z=A.useState("hoverEnabled"),B=A.useState("modal"),V=A.useState("disabled"),K=A.useState("lastOpenChangeReason"),L=A.useState("parent"),H=A.useState("activeIndex"),$=A.useState("payload"),G=A.useState("floatingParentNodeId"),X=v.useRef(null),O=G!=null;let Z;A.useSyncedValues({disabled:u,modal:L.type===void 0?f:void 0,rootId:kr()});const{openMethod:W,triggerProps:Q,reset:ce}=$8(F);L6(A);const{forceUnmount:ae}=$6(F,A,()=>{A.update({allowMouseEnter:!1,stickIfOpen:!0}),ce()}),ge=v.useRef(L.type!=="context-menu"),ye=Bs();v.useEffect(()=>{if(F||(X.current=null),L.type==="context-menu"){if(!F){ye.clear(),ge.current=!1;return}ye.start(500,()=>{ge.current=!0})}},[ye,F,L.type]),D8(F&&B&&K!==ri&&W!=="touch",_),Fe(()=>{!F&&!z&&A.set("hoverEnabled",!0)},[F,z,A]);const be=v.useRef(!0),Oe=Bs(),fe=qe((Ie,tt)=>{const ut=tt.reason;if(F===Ie&&tt.trigger===P||(tt.preventUnmountOnClose=()=>{A.set("preventUnmountingOnClose",!0)},!Ie&&tt.trigger==null&&(tt.trigger=P??void 0),a?.(Ie,tt),tt.isCanceled))return;const xt={open:Ie,nativeEvent:tt.event,reason:tt.reason,nested:O};Z?.emit("openchange",xt);const Pt=tt.event;if(Ie===!1&&Pt?.type==="click"&&Pt.pointerType==="touch"&&!be.current)return;if(!Ie&&H!==null){const ln=A.context.itemDomElements.current[H];queueMicrotask(()=>{ln?.setAttribute("tabindex","-1")})}Ie&&ut===L1?(be.current=!1,Oe.start(300,()=>{be.current=!0})):(be.current=!0,Oe.clear());const yn=(ut===Qd||ut===NE)&&Pt.detail===0&&Pt?.isTrusted,Kt=!Ie&&(ut===kE||ut==null);function pn(){const ln={open:Ie,openChangeReason:ut};X.current=tt.event??null;const xn=tt.trigger?.id??null;(xn||Ie)&&(ln.activeTriggerId=xn,ln.activeTriggerElement=tt.trigger??null),A.update(ln)}ut===ri?hi.flushSync(pn):pn(),L.type==="menubar"&&(ut===L1||ut===Df||ut===ri||ut===Rd||ut===Gl)?A.set("instantType","group"):yn||Kt?A.set("instantType",yn?"click":"dismiss"):A.set("instantType",void 0)}),xe=v.useCallback(Ie=>{const tt=rn(Ie);return tt.preventUnmountOnClose=()=>{A.set("preventUnmountingOnClose",!0)},tt},[A]),we=v.useCallback(()=>{A.setOpen(!1,xe(UP))},[A,xe]);v.useImperativeHandle(p,()=>({unmount:ae,close:we}),[ae,we]);let ze;L.type==="context-menu"&&(ze=L.context),v.useImperativeHandle(ze?.positionerRef,()=>_,[_]),v.useImperativeHandle(ze?.actionsRef,()=>({setOpen:fe}),[fe]);const Me=Z6({popupStore:A,onOpenChange:fe});Z=Me.context.events,v.useEffect(()=>{const Ie=({open:tt,eventDetails:ut})=>fe(tt,ut);return Z.on("setOpen",Ie),()=>{Z?.off("setOpen",Ie)}},[Z,fe]);const je=d6(Me,{enabled:!V,bubbles:y&&L.type==="menu",outsidePress(){return L.type!=="context-menu"||X.current?.type==="contextmenu"?!0:ge.current},externalTree:O?M:void 0}),Ne=a8(Me,{role:"menu"}),We=SC(),Be=v.useCallback(Ie=>{A.select("activeIndex")!==Ie&&A.set("activeIndex",Ie)},[A]),He=n8(Me,{enabled:!V,listRef:A.context.itemDomElements,activeIndex:H,nested:L.type!==void 0,loopFocus:m,orientation:h,parentOrientation:L.type==="menubar"?L.context.orientation:void 0,rtl:We==="rtl",disabledIndices:jE,onNavigate:Be,openOnArrowKeyDown:L.type!=="context-menu",externalTree:O?M:void 0,focusItemOnHover:N}),le=v.useCallback(Ie=>{A.context.typingRef.current=Ie},[A]),he=r8(Me,{listRef:A.context.itemLabels,activeIndex:H,resetMs:jP,onMatch:Ie=>{F&&Ie!==H&&A.set("activeIndex",Ie)},onTypingChange:le}),{getReferenceProps:pe,getFloatingProps:ke,getItemProps:Ee,getTriggerProps:Je}=J6([je,Ne,He,he]),et=v.useMemo(()=>{const Ie=If(pe(),{onMouseEnter(){A.set("hoverEnabled",!0)},onMouseMove(){A.set("allowMouseEnter",!0)}},Q);return delete Ie.role,Ie},[pe,A,Q]),Ye=v.useMemo(()=>{const Ie=Je();if(!Ie)return Ie;const{role:tt,["aria-controls"]:ut,...xt}=Ie;return xt},[Je]),Bt=Uv(),Et=v.useMemo(()=>ke({onMouseEnter(){L.type==="menu"&&Bt.request(()=>A.set("hoverEnabled",!1))},onMouseMove(){A.set("allowMouseEnter",!0)},onClick(){A.select("hoverEnabled")&&A.set("hoverEnabled",!1)},onKeyDown(Ie){const tt=A.select("keyboardEventRelay");tt&&!Ie.isPropagationStopped()&&tt(Ie)}}),[ke,L.type,Bt,A]),hn=v.useMemo(()=>Ee(),[Ee]);A.useSyncedValues({floatingRootContext:Me,activeTriggerProps:et,inactiveTriggerProps:Ye,popupProps:Et,itemProps:hn});const mn=v.useMemo(()=>({store:A,parent:R}),[A,R]),on=i.jsx(Iv.Provider,{value:mn,children:typeof t=="function"?t({payload:$}):t});return L.type===void 0||L.type==="context-menu"?i.jsx(u$,{externalTree:M,children:on}):on}function kC(e){if(Qt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!ea(e))return kC(aa(e))}const Z8=v.forwardRef(function(t,n){const{className:a,render:o,orientation:l="horizontal",...u}=t,f=v.useMemo(()=>({orientation:l}),[l]);return Er("div",t,{state:f,ref:n,props:[{role:"separator","aria-orientation":l},u]})});function q8(e){const[t,n]=v.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),a=v.useRef(null),o=v.useRef(null),l=v.useRef(null),u=v.useRef(null),f=v.useRef(!0),m=v.useRef(null),h=kr(),p=v.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:l,backdropRef:a,internalBackdropRef:o,positionerRef:u,allowMouseUpTriggerRef:f,initialCursorPointRef:m,rootId:h}),[t,h]);return i.jsx(mE.Provider,{value:p,children:i.jsx(Iv.Provider,{value:void 0,children:i.jsx(F8,{...e})})})}const gj=500,W8=v.forwardRef(function(t,n){const{render:a,className:o,...l}=t,{setAnchor:u,actionsRef:f,internalBackdropRef:m,backdropRef:h,positionerRef:p,allowMouseUpTriggerRef:y,initialCursorPointRef:b,rootId:w}=Of(!1),{store:j}=Vo(!1),N=j.useState("open"),C=v.useRef(null),k=v.useRef(null),E=Bs(),S=Bs(),R=v.useRef(!1);function A(z,B,V){const K=V.type.startsWith("touch");b.current={x:z,y:B},u({getBoundingClientRect(){return DOMRect.fromRect({width:K?10:0,height:K?10:0,x:z,y:B})}}),R.current=!1,f.current?.setOpen(!0,rn(Qd,V)),S.start(gj,()=>{R.current=!0})}function M(z){y.current=!0,Tn(z),A(z.clientX,z.clientY,z.nativeEvent),mi(C.current).addEventListener("mouseup",V=>{if(y.current=!1,!R.current)return;S.clear(),R.current=!1;const K=Gn(V);Ot(p.current,K)||w&&K&&kC(K)===w||f.current?.setOpen(!1,rn($P,V))},{once:!0})}function D(z){if(y.current=!1,z.touches.length===1){z.stopPropagation();const B=z.touches[0];k.current={x:B.clientX,y:B.clientY},E.start(gj,()=>{k.current&&A(k.current.x,k.current.y,z.nativeEvent)})}}function U(z){if(E.isStarted()&&k.current&&z.touches.length===1){const B=z.touches[0],V=10,K=Math.abs(B.clientX-k.current.x),L=Math.abs(B.clientY-k.current.y);(K>V||L>V)&&E.clear()}}function F(){E.clear(),k.current=null}v.useEffect(()=>{function z(V){const L=Gn(V);(Ot(C.current,L)||Ot(m.current,L)||Ot(h.current,L))&&V.preventDefault()}const B=mi(C.current);return B.addEventListener("contextmenu",z),()=>{B.removeEventListener("contextmenu",z)}},[h,m]);const P=v.useMemo(()=>({open:N}),[N]);return Er("div",t,{state:P,ref:[C,n],props:[{onContextMenu:M,onTouchStart:D,onTouchMove:U,onTouchEnd:F,onTouchCancel:F,style:{WebkitTouchCallout:"none"}},l],stateAttributesMapping:PP})}),Kv=v.createContext({});function Xv(e){const t=v.useRef(null);return t.current===null&&(t.current=e()),t.current}const EC=typeof window<"u",CC=EC?v.useLayoutEffect:v.useEffect,Hf=v.createContext(null);function Jv(e,t){e.indexOf(t)===-1&&e.push(t)}function ff(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const ra=(e,t,n)=>n>t?t:n<e?e:n;let Qv=()=>{};const _a={},TC=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function AC(e){return typeof e=="object"&&e!==null}const MC=e=>/^0[^.\s]+$/u.test(e);function RC(e){let t;return()=>(t===void 0&&(t=e()),t)}const ks=e=>e,Y8=(e,t)=>n=>t(e(n)),Rc=(...e)=>e.reduce(Y8),xc=(e,t,n)=>{const a=t-e;return a===0?1:(n-e)/a};class ey{constructor(){this.subscriptions=[]}add(t){return Jv(this.subscriptions,t),()=>ff(this.subscriptions,t)}notify(t,n,a){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,n,a);else for(let l=0;l<o;l++){const u=this.subscriptions[l];u&&u(t,n,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const $s=e=>e*1e3,Ns=e=>e/1e3;function _C(e,t){return t?e*(1e3/t):0}const OC=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,G8=1e-7,K8=12;function X8(e,t,n,a,o){let l,u,f=0;do u=t+(n-t)/2,l=OC(u,a,o)-e,l>0?n=u:t=u;while(Math.abs(l)>G8&&++f<K8);return u}function _c(e,t,n,a){if(e===t&&n===a)return ks;const o=l=>X8(l,0,1,e,n);return l=>l===0||l===1?l:OC(o(l),t,a)}const IC=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,DC=e=>t=>1-e(1-t),zC=_c(.33,1.53,.69,.99),ty=DC(zC),PC=IC(ty),LC=e=>(e*=2)<1?.5*ty(e):.5*(2-Math.pow(2,-10*(e-1))),ny=e=>1-Math.sin(Math.acos(e)),$C=DC(ny),UC=IC(ny),J8=_c(.42,0,1,1),Q8=_c(0,0,.58,1),BC=_c(.42,0,.58,1),eU=e=>Array.isArray(e)&&typeof e[0]!="number",VC=e=>Array.isArray(e)&&typeof e[0]=="number",tU={linear:ks,easeIn:J8,easeInOut:BC,easeOut:Q8,circIn:ny,circInOut:UC,circOut:$C,backIn:ty,backInOut:PC,backOut:zC,anticipate:LC},nU=e=>typeof e=="string",vj=e=>{if(VC(e)){Qv(e.length===4);const[t,n,a,o]=e;return _c(t,n,a,o)}else if(nU(e))return tU[e];return e},od=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function sU(e,t){let n=new Set,a=new Set,o=!1,l=!1;const u=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function m(p){u.has(p)&&(h.schedule(p),e()),p(f)}const h={schedule:(p,y=!1,b=!1)=>{const j=b&&o?n:a;return y&&u.add(p),j.has(p)||j.add(p),p},cancel:p=>{a.delete(p),u.delete(p)},process:p=>{if(f=p,o){l=!0;return}o=!0,[n,a]=[a,n],n.forEach(m),n.clear(),o=!1,l&&(l=!1,h.process(p))}};return h}const aU=40;function HC(e,t){let n=!1,a=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=od.reduce((S,R)=>(S[R]=sU(l),S),{}),{setup:f,read:m,resolveKeyframes:h,preUpdate:p,update:y,preRender:b,render:w,postRender:j}=u,N=()=>{const S=_a.useManualTiming?o.timestamp:performance.now();n=!1,_a.useManualTiming||(o.delta=a?1e3/60:Math.max(Math.min(S-o.timestamp,aU),1)),o.timestamp=S,o.isProcessing=!0,f.process(o),m.process(o),h.process(o),p.process(o),y.process(o),b.process(o),w.process(o),j.process(o),o.isProcessing=!1,n&&t&&(a=!1,e(N))},C=()=>{n=!0,a=!0,o.isProcessing||e(N)};return{schedule:od.reduce((S,R)=>{const A=u[R];return S[R]=(M,D=!1,U=!1)=>(n||C(),A.schedule(M,D,U)),S},{}),cancel:S=>{for(let R=0;R<od.length;R++)u[od[R]].cancel(S)},state:o,steps:u}}const{schedule:Ct,cancel:wr,state:En,steps:Mp}=HC(typeof requestAnimationFrame<"u"?requestAnimationFrame:ks,!0);let Id;function rU(){Id=void 0}const Pn={now:()=>(Id===void 0&&Pn.set(En.isProcessing||_a.useManualTiming?En.timestamp:performance.now()),Id),set:e=>{Id=e,queueMicrotask(rU)}},FC=e=>t=>typeof t=="string"&&t.startsWith(e),ZC=FC("--"),iU=FC("var(--"),sy=e=>iU(e)?oU.test(e.split("/*")[0].trim()):!1,oU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function yj(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Zo={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},bc={...Zo,transform:e=>ra(0,1,e)},ld={...Zo,default:1},rc=e=>Math.round(e*1e5)/1e5,ay=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function lU(e){return e==null}const cU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ry=(e,t)=>n=>!!(typeof n=="string"&&cU.test(n)&&n.startsWith(e)||t&&!lU(n)&&Object.prototype.hasOwnProperty.call(n,t)),qC=(e,t,n)=>a=>{if(typeof a!="string")return a;const[o,l,u,f]=a.match(ay);return{[e]:parseFloat(o),[t]:parseFloat(l),[n]:parseFloat(u),alpha:f!==void 0?parseFloat(f):1}},uU=e=>ra(0,255,e),Rp={...Zo,transform:e=>Math.round(uU(e))},ni={test:ry("rgb","red"),parse:qC("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:a=1})=>"rgba("+Rp.transform(e)+", "+Rp.transform(t)+", "+Rp.transform(n)+", "+rc(bc.transform(a))+")"};function dU(e){let t="",n="",a="",o="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),a=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),a=e.substring(3,4),o=e.substring(4,5),t+=t,n+=n,a+=a,o+=o),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(a,16),alpha:o?parseInt(o,16)/255:1}}const Lg={test:ry("#"),parse:dU,transform:ni.transform},Oc=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),lr=Oc("deg"),na=Oc("%"),Ae=Oc("px"),fU=Oc("vh"),hU=Oc("vw"),xj={...na,parse:e=>na.parse(e)/100,transform:e=>na.transform(e*100)},So={test:ry("hsl","hue"),parse:qC("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:a=1})=>"hsla("+Math.round(e)+", "+na.transform(rc(t))+", "+na.transform(rc(n))+", "+rc(bc.transform(a))+")"},an={test:e=>ni.test(e)||Lg.test(e)||So.test(e),parse:e=>ni.test(e)?ni.parse(e):So.test(e)?So.parse(e):Lg.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ni.transform(e):So.transform(e),getAnimatableNone:e=>{const t=an.parse(e);return t.alpha=0,an.transform(t)}},mU=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function pU(e){return isNaN(e)&&typeof e=="string"&&(e.match(ay)?.length||0)+(e.match(mU)?.length||0)>0}const WC="number",YC="color",gU="var",vU="var(",bj="${}",yU=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function wc(e){const t=e.toString(),n=[],a={color:[],number:[],var:[]},o=[];let l=0;const f=t.replace(yU,m=>(an.test(m)?(a.color.push(l),o.push(YC),n.push(an.parse(m))):m.startsWith(vU)?(a.var.push(l),o.push(gU),n.push(m)):(a.number.push(l),o.push(WC),n.push(parseFloat(m))),++l,bj)).split(bj);return{values:n,split:f,indexes:a,types:o}}function GC(e){return wc(e).values}function KC(e){const{split:t,types:n}=wc(e),a=t.length;return o=>{let l="";for(let u=0;u<a;u++)if(l+=t[u],o[u]!==void 0){const f=n[u];f===WC?l+=rc(o[u]):f===YC?l+=an.transform(o[u]):l+=o[u]}return l}}const xU=e=>typeof e=="number"?0:an.test(e)?an.getAnimatableNone(e):e;function bU(e){const t=GC(e);return KC(e)(t.map(xU))}const Us={test:pU,parse:GC,createTransformer:KC,getAnimatableNone:bU};function _p(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function wU({hue:e,saturation:t,lightness:n,alpha:a}){e/=360,t/=100,n/=100;let o=0,l=0,u=0;if(!t)o=l=u=n;else{const f=n<.5?n*(1+t):n+t-n*t,m=2*n-f;o=_p(m,f,e+1/3),l=_p(m,f,e),u=_p(m,f,e-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:a}}function hf(e,t){return n=>n>0?t:e}const Vt=(e,t,n)=>e+(t-e)*n,Op=(e,t,n)=>{const a=e*e,o=n*(t*t-a)+a;return o<0?0:Math.sqrt(o)},jU=[Lg,ni,So],SU=e=>jU.find(t=>t.test(e));function wj(e){const t=SU(e);if(!t)return!1;let n=t.parse(e);return t===So&&(n=wU(n)),n}const jj=(e,t)=>{const n=wj(e),a=wj(t);if(!n||!a)return hf(e,t);const o={...n};return l=>(o.red=Op(n.red,a.red,l),o.green=Op(n.green,a.green,l),o.blue=Op(n.blue,a.blue,l),o.alpha=Vt(n.alpha,a.alpha,l),ni.transform(o))},$g=new Set(["none","hidden"]);function NU(e,t){return $g.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function kU(e,t){return n=>Vt(e,t,n)}function iy(e){return typeof e=="number"?kU:typeof e=="string"?sy(e)?hf:an.test(e)?jj:TU:Array.isArray(e)?XC:typeof e=="object"?an.test(e)?jj:EU:hf}function XC(e,t){const n=[...e],a=n.length,o=e.map((l,u)=>iy(l)(l,t[u]));return l=>{for(let u=0;u<a;u++)n[u]=o[u](l);return n}}function EU(e,t){const n={...e,...t},a={};for(const o in n)e[o]!==void 0&&t[o]!==void 0&&(a[o]=iy(e[o])(e[o],t[o]));return o=>{for(const l in a)n[l]=a[l](o);return n}}function CU(e,t){const n=[],a={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const l=t.types[o],u=e.indexes[l][a[l]],f=e.values[u]??0;n[o]=f,a[l]++}return n}const TU=(e,t)=>{const n=Us.createTransformer(t),a=wc(e),o=wc(t);return a.indexes.var.length===o.indexes.var.length&&a.indexes.color.length===o.indexes.color.length&&a.indexes.number.length>=o.indexes.number.length?$g.has(e)&&!o.values.length||$g.has(t)&&!a.values.length?NU(e,t):Rc(XC(CU(a,o),o.values),n):hf(e,t)};function JC(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Vt(e,t,n):iy(e)(e,t)}const AU=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Ct.update(t,n),stop:()=>wr(t),now:()=>En.isProcessing?En.timestamp:Pn.now()}},QC=(e,t,n=10)=>{let a="";const o=Math.max(Math.round(t/n),2);for(let l=0;l<o;l++)a+=Math.round(e(l/(o-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},mf=2e4;function oy(e){let t=0;const n=50;let a=e.next(t);for(;!a.done&&t<mf;)t+=n,a=e.next(t);return t>=mf?1/0:t}function MU(e,t=100,n){const a=n({...e,keyframes:[0,t]}),o=Math.min(oy(a),mf);return{type:"keyframes",ease:l=>a.next(o*l).value/t,duration:Ns(o)}}const RU=5;function eT(e,t,n){const a=Math.max(t-RU,0);return _C(n-e(a),t-a)}const Gt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ip=.001;function _U({duration:e=Gt.duration,bounce:t=Gt.bounce,velocity:n=Gt.velocity,mass:a=Gt.mass}){let o,l,u=1-t;u=ra(Gt.minDamping,Gt.maxDamping,u),e=ra(Gt.minDuration,Gt.maxDuration,Ns(e)),u<1?(o=h=>{const p=h*u,y=p*e,b=p-n,w=Ug(h,u),j=Math.exp(-y);return Ip-b/w*j},l=h=>{const y=h*u*e,b=y*n+n,w=Math.pow(u,2)*Math.pow(h,2)*e,j=Math.exp(-y),N=Ug(Math.pow(h,2),u);return(-o(h)+Ip>0?-1:1)*((b-w)*j)/N}):(o=h=>{const p=Math.exp(-h*e),y=(h-n)*e+1;return-Ip+p*y},l=h=>{const p=Math.exp(-h*e),y=(n-h)*(e*e);return p*y});const f=5/e,m=IU(o,l,f);if(e=$s(e),isNaN(m))return{stiffness:Gt.stiffness,damping:Gt.damping,duration:e};{const h=Math.pow(m,2)*a;return{stiffness:h,damping:u*2*Math.sqrt(a*h),duration:e}}}const OU=12;function IU(e,t,n){let a=n;for(let o=1;o<OU;o++)a=a-e(a)/t(a);return a}function Ug(e,t){return e*Math.sqrt(1-t*t)}const DU=["duration","bounce"],zU=["stiffness","damping","mass"];function Sj(e,t){return t.some(n=>e[n]!==void 0)}function PU(e){let t={velocity:Gt.velocity,stiffness:Gt.stiffness,damping:Gt.damping,mass:Gt.mass,isResolvedFromDuration:!1,...e};if(!Sj(e,zU)&&Sj(e,DU))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,a=2*Math.PI/(n*1.2),o=a*a,l=2*ra(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:Gt.mass,stiffness:o,damping:l}}else{const n=_U({...e,velocity:0});t={...t,...n,mass:Gt.mass},t.isResolvedFromDuration=!0}return t}function pf(e=Gt.visualDuration,t=Gt.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:a,restDelta:o}=n;const l=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],f={done:!1,value:l},{stiffness:m,damping:h,mass:p,duration:y,velocity:b,isResolvedFromDuration:w}=PU({...n,velocity:-Ns(n.velocity||0)}),j=b||0,N=h/(2*Math.sqrt(m*p)),C=u-l,k=Ns(Math.sqrt(m/p)),E=Math.abs(C)<5;a||(a=E?Gt.restSpeed.granular:Gt.restSpeed.default),o||(o=E?Gt.restDelta.granular:Gt.restDelta.default);let S;if(N<1){const A=Ug(k,N);S=M=>{const D=Math.exp(-N*k*M);return u-D*((j+N*k*C)/A*Math.sin(A*M)+C*Math.cos(A*M))}}else if(N===1)S=A=>u-Math.exp(-k*A)*(C+(j+k*C)*A);else{const A=k*Math.sqrt(N*N-1);S=M=>{const D=Math.exp(-N*k*M),U=Math.min(A*M,300);return u-D*((j+N*k*C)*Math.sinh(U)+A*C*Math.cosh(U))/A}}const R={calculatedDuration:w&&y||null,next:A=>{const M=S(A);if(w)f.done=A>=y;else{let D=A===0?j:0;N<1&&(D=A===0?$s(j):eT(S,A,M));const U=Math.abs(D)<=a,F=Math.abs(u-M)<=o;f.done=U&&F}return f.value=f.done?u:M,f},toString:()=>{const A=Math.min(oy(R),mf),M=QC(D=>R.next(A*D).value,A,30);return A+"ms "+M},toTransition:()=>{}};return R}pf.applyToOptions=e=>{const t=MU(e,100,pf);return e.ease=t.ease,e.duration=$s(t.duration),e.type="keyframes",e};function Bg({keyframes:e,velocity:t=0,power:n=.8,timeConstant:a=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:f,max:m,restDelta:h=.5,restSpeed:p}){const y=e[0],b={done:!1,value:y},w=U=>f!==void 0&&U<f||m!==void 0&&U>m,j=U=>f===void 0?m:m===void 0||Math.abs(f-U)<Math.abs(m-U)?f:m;let N=n*t;const C=y+N,k=u===void 0?C:u(C);k!==C&&(N=k-y);const E=U=>-N*Math.exp(-U/a),S=U=>k+E(U),R=U=>{const F=E(U),P=S(U);b.done=Math.abs(F)<=h,b.value=b.done?k:P};let A,M;const D=U=>{w(b.value)&&(A=U,M=pf({keyframes:[b.value,j(b.value)],velocity:eT(S,U,b.value),damping:o,stiffness:l,restDelta:h,restSpeed:p}))};return D(0),{calculatedDuration:null,next:U=>{let F=!1;return!M&&A===void 0&&(F=!0,R(U),D(U)),A!==void 0&&U>=A?M.next(U-A):(!F&&R(U),b)}}}function LU(e,t,n){const a=[],o=n||_a.mix||JC,l=e.length-1;for(let u=0;u<l;u++){let f=o(e[u],e[u+1]);if(t){const m=Array.isArray(t)?t[u]||ks:t;f=Rc(m,f)}a.push(f)}return a}function $U(e,t,{clamp:n=!0,ease:a,mixer:o}={}){const l=e.length;if(Qv(l===t.length),l===1)return()=>t[0];if(l===2&&t[0]===t[1])return()=>t[1];const u=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),t=[...t].reverse());const f=LU(t,a,o),m=f.length,h=p=>{if(u&&p<e[0])return t[0];let y=0;if(m>1)for(;y<e.length-2&&!(p<e[y+1]);y++);const b=xc(e[y],e[y+1],p);return f[y](b)};return n?p=>h(ra(e[0],e[l-1],p)):h}function UU(e,t){const n=e[e.length-1];for(let a=1;a<=t;a++){const o=xc(0,t,a);e.push(Vt(n,1,o))}}function BU(e){const t=[0];return UU(t,e.length-1),t}function VU(e,t){return e.map(n=>n*t)}function HU(e,t){return e.map(()=>t||BC).splice(0,e.length-1)}function ic({duration:e=300,keyframes:t,times:n,ease:a="easeInOut"}){const o=eU(a)?a.map(vj):vj(a),l={done:!1,value:t[0]},u=VU(n&&n.length===t.length?n:BU(t),e),f=$U(u,t,{ease:Array.isArray(o)?o:HU(t,o)});return{calculatedDuration:e,next:m=>(l.value=f(m),l.done=m>=e,l)}}const FU=e=>e!==null;function ly(e,{repeat:t,repeatType:n="loop"},a,o=1){const l=e.filter(FU),f=o<0||t&&n!=="loop"&&t%2===1?0:l.length-1;return!f||a===void 0?l[f]:a}const ZU={decay:Bg,inertia:Bg,tween:ic,keyframes:ic,spring:pf};function tT(e){typeof e.type=="string"&&(e.type=ZU[e.type])}class cy{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const qU=e=>e/100;class uy extends cy{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==Pn.now()&&this.tick(Pn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;tT(t);const{type:n=ic,repeat:a=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=t;let{keyframes:f}=t;const m=n||ic;m!==ic&&typeof f[0]!="number"&&(this.mixKeyframes=Rc(qU,JC(f[0],f[1])),f=[0,100]);const h=m({...t,keyframes:f});l==="mirror"&&(this.mirroredGenerator=m({...t,keyframes:[...f].reverse(),velocity:-u})),h.calculatedDuration===null&&(h.calculatedDuration=oy(h));const{calculatedDuration:p}=h;this.calculatedDuration=p,this.resolvedDuration=p+o,this.totalDuration=this.resolvedDuration*(a+1)-o,this.generator=h}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:a,totalDuration:o,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:f,calculatedDuration:m}=this;if(this.startTime===null)return a.next(0);const{delay:h=0,keyframes:p,repeat:y,repeatType:b,repeatDelay:w,type:j,onUpdate:N,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const k=this.currentTime-h*(this.playbackSpeed>=0?1:-1),E=this.playbackSpeed>=0?k<0:k>o;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let S=this.currentTime,R=a;if(y){const U=Math.min(this.currentTime,o)/f;let F=Math.floor(U),P=U%1;!P&&U>=1&&(P=1),P===1&&F--,F=Math.min(F,y+1),F%2&&(b==="reverse"?(P=1-P,w&&(P-=w/f)):b==="mirror"&&(R=u)),S=ra(0,1,P)*f}const A=E?{done:!1,value:p[0]}:R.next(S);l&&(A.value=l(A.value));let{done:M}=A;!E&&m!==null&&(M=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const D=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&M);return D&&j!==Bg&&(A.value=ly(p,this.options,C,this.speed)),N&&N(A.value),D&&this.finish(),A}then(t,n){return this.finished.then(t,n)}get duration(){return Ns(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ns(t)}get time(){return Ns(this.currentTime)}set time(t){t=$s(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(Pn.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Ns(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=AU,startTime:n}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),this.options.onPlay?.();const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=n??a),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Pn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function WU(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const si=e=>e*180/Math.PI,Vg=e=>{const t=si(Math.atan2(e[1],e[0]));return Hg(t)},YU={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Vg,rotateZ:Vg,skewX:e=>si(Math.atan(e[1])),skewY:e=>si(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Hg=e=>(e=e%360,e<0&&(e+=360),e),Nj=Vg,kj=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Ej=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),GU={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:kj,scaleY:Ej,scale:e=>(kj(e)+Ej(e))/2,rotateX:e=>Hg(si(Math.atan2(e[6],e[5]))),rotateY:e=>Hg(si(Math.atan2(-e[2],e[0]))),rotateZ:Nj,rotate:Nj,skewX:e=>si(Math.atan(e[4])),skewY:e=>si(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Fg(e){return e.includes("scale")?1:0}function Zg(e,t){if(!e||e==="none")return Fg(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,o;if(n)a=GU,o=n;else{const f=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=YU,o=f}if(!o)return Fg(t);const l=a[t],u=o[1].split(",").map(XU);return typeof l=="function"?l(u):u[l]}const KU=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Zg(n,t)};function XU(e){return parseFloat(e.trim())}const qo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Wo=new Set(qo),Cj=e=>e===Zo||e===Ae,JU=new Set(["x","y","z"]),QU=qo.filter(e=>!JU.has(e));function e9(e){const t=[];return QU.forEach(n=>{const a=e.getValue(n);a!==void 0&&(t.push([n,a.get()]),a.set(n.startsWith("scale")?1:0))}),t}const mr={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Zg(t,"x"),y:(e,{transform:t})=>Zg(t,"y")};mr.translateX=mr.x;mr.translateY=mr.y;const ii=new Set;let qg=!1,Wg=!1,Yg=!1;function nT(){if(Wg){const e=Array.from(ii).filter(a=>a.needsMeasurement),t=new Set(e.map(a=>a.element)),n=new Map;t.forEach(a=>{const o=e9(a);o.length&&(n.set(a,o),a.render())}),e.forEach(a=>a.measureInitialState()),t.forEach(a=>{a.render();const o=n.get(a);o&&o.forEach(([l,u])=>{a.getValue(l)?.set(u)})}),e.forEach(a=>a.measureEndState()),e.forEach(a=>{a.suspendedScrollY!==void 0&&window.scrollTo(0,a.suspendedScrollY)})}Wg=!1,qg=!1,ii.forEach(e=>e.complete(Yg)),ii.clear()}function sT(){ii.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Wg=!0)})}function t9(){Yg=!0,sT(),nT(),Yg=!1}class dy{constructor(t,n,a,o,l,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=a,this.motionValue=o,this.element=l,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(ii.add(this),qg||(qg=!0,Ct.read(sT),Ct.resolveKeyframes(nT))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:a,motionValue:o}=this;if(t[0]===null){const l=o?.get(),u=t[t.length-1];if(l!==void 0)t[0]=l;else if(a&&n){const f=a.readValue(n,u);f!=null&&(t[0]=f)}t[0]===void 0&&(t[0]=u),o&&l===void 0&&o.set(t[0])}WU(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ii.delete(this)}cancel(){this.state==="scheduled"&&(ii.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const n9=e=>e.startsWith("--");function s9(e,t,n){n9(t)?e.style.setProperty(t,n):e.style[t]=n}const a9={};function aT(e,t){const n=RC(e);return()=>a9[t]??n()}const r9=aT(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),rT=aT(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Kl=([e,t,n,a])=>`cubic-bezier(${e}, ${t}, ${n}, ${a})`,Tj={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Kl([0,.65,.55,1]),circOut:Kl([.55,0,1,.45]),backIn:Kl([.31,.01,.66,-.59]),backOut:Kl([.33,1.53,.69,.99])};function iT(e,t){if(e)return typeof e=="function"?rT()?QC(e,t):"ease-out":VC(e)?Kl(e):Array.isArray(e)?e.map(n=>iT(n,t)||Tj.easeOut):Tj[e]}function i9(e,t,n,{delay:a=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:f="easeOut",times:m}={},h=void 0){const p={[t]:n};m&&(p.offset=m);const y=iT(f,o);Array.isArray(y)&&(p.easing=y);const b={delay:a,duration:o,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return h&&(b.pseudoElement=h),e.animate(p,b)}function oT(e){return typeof e=="function"&&"applyToOptions"in e}function o9({type:e,...t}){return oT(e)&&rT()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class lT extends cy{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:a,keyframes:o,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:f,onComplete:m}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,Qv(typeof t.type!="string");const h=o9(t);this.animation=i9(n,a,o,h,l),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const p=ly(o,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(p):s9(n,a,p),this.animation.cancel()}m?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Ns(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ns(t)}get time(){return Ns(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=$s(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&r9()?(this.animation.timeline=t,ks):n(this)}}const cT={anticipate:LC,backInOut:PC,circInOut:UC};function l9(e){return e in cT}function c9(e){typeof e.ease=="string"&&l9(e.ease)&&(e.ease=cT[e.ease])}const Dp=10;class u9 extends lT{constructor(t){c9(t),tT(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:a,onComplete:o,element:l,...u}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const f=new uy({...u,autoplay:!1}),m=Math.max(Dp,Pn.now()-this.startTime),h=ra(0,Dp,m-Dp);n.setWithVelocity(f.sample(Math.max(0,m-h)).value,f.sample(m).value,h),f.stop()}}const Aj=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Us.test(e)||e==="0")&&!e.startsWith("url("));function d9(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function f9(e,t,n,a){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const l=e[e.length-1],u=Aj(o,t),f=Aj(l,t);return!u||!f?!1:d9(e)||(n==="spring"||oT(n))&&a}function Gg(e){e.duration=0,e.type="keyframes"}const h9=new Set(["opacity","clipPath","filter","transform"]),m9=RC(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function p9(e){const{motionValue:t,name:n,repeatDelay:a,repeatType:o,damping:l,type:u}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:h}=t.owner.getProps();return m9()&&n&&h9.has(n)&&(n!=="transform"||!h)&&!m&&!a&&o!=="mirror"&&l!==0&&u!=="inertia"}const g9=40;class v9 extends cy{constructor({autoplay:t=!0,delay:n=0,type:a="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:u="loop",keyframes:f,name:m,motionValue:h,element:p,...y}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Pn.now();const b={autoplay:t,delay:n,type:a,repeat:o,repeatDelay:l,repeatType:u,name:m,motionValue:h,element:p,...y},w=p?.KeyframeResolver||dy;this.keyframeResolver=new w(f,(j,N,C)=>this.onKeyframesResolved(j,N,b,!C),m,h,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,a,o){this.keyframeResolver=void 0;const{name:l,type:u,velocity:f,delay:m,isHandoff:h,onUpdate:p}=a;this.resolvedAt=Pn.now(),f9(t,l,u,f)||((_a.instantAnimations||!m)&&p?.(ly(t,a,n)),t[0]=t[t.length-1],Gg(a),a.repeat=0);const b={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>g9?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...a,keyframes:t},w=!h&&p9(b),j=b.motionValue?.owner?.current,N=w?new u9({...b,element:j}):new uy(b);N.finished.then(()=>{this.notifyFinished()}).catch(ks),this.pendingTimeline&&(this.stopTimeline=N.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=N}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),t9()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function uT(e,t,n,a=0,o=1){const l=Array.from(e).sort((h,p)=>h.sortNodePosition(p)).indexOf(t),u=e.size,f=(u-1)*a;return typeof n=="function"?n(l,u):o===1?l*a:f-l*a}const y9=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function x9(e){const t=y9.exec(e);if(!t)return[,];const[,n,a,o]=t;return[`--${n??a}`,o]}function dT(e,t,n=1){const[a,o]=x9(e);if(!a)return;const l=window.getComputedStyle(t).getPropertyValue(a);if(l){const u=l.trim();return TC(u)?parseFloat(u):u}return sy(o)?dT(o,t,n+1):o}const b9={type:"spring",stiffness:500,damping:25,restSpeed:10},w9=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),j9={type:"keyframes",duration:.8},S9={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},N9=(e,{keyframes:t})=>t.length>2?j9:Wo.has(e)?e.startsWith("scale")?w9(t[1]):b9:S9,k9=e=>e!==null;function E9(e,{repeat:t,repeatType:n="loop"},a){const o=e.filter(k9),l=t&&n!=="loop"&&t%2===1?0:o.length-1;return o[l]}function fT(e,t){if(e?.inherit&&t){const{inherit:n,...a}=e;return{...t,...a}}return e}function fy(e,t){const n=e?.[t]??e?.default??e;return n!==e?fT(n,e):n}function C9({when:e,delay:t,delayChildren:n,staggerChildren:a,staggerDirection:o,repeat:l,repeatType:u,repeatDelay:f,from:m,elapsed:h,...p}){return!!Object.keys(p).length}const hy=(e,t,n,a={},o,l)=>u=>{const f=fy(a,e)||{},m=f.delay||a.delay||0;let{elapsed:h=0}=a;h=h-$s(m);const p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...f,delay:-h,onUpdate:b=>{t.set(b),f.onUpdate&&f.onUpdate(b)},onComplete:()=>{u(),f.onComplete&&f.onComplete()},name:e,motionValue:t,element:l?void 0:o};C9(f)||Object.assign(p,N9(e,p)),p.duration&&(p.duration=$s(p.duration)),p.repeatDelay&&(p.repeatDelay=$s(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let y=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(Gg(p),p.delay===0&&(y=!0)),(_a.instantAnimations||_a.skipAnimations||o?.shouldSkipAnimations)&&(y=!0,Gg(p),p.delay=0),p.allowFlatten=!f.type&&!f.ease,y&&!l&&t.get()!==void 0){const b=E9(p.keyframes,f);if(b!==void 0){Ct.update(()=>{p.onUpdate(b),p.onComplete()});return}}return f.isSync?new uy(p):new v9(p)};function Mj(e){const t=[{},{}];return e?.values.forEach((n,a)=>{t[0][a]=n.get(),t[1][a]=n.getVelocity()}),t}function my(e,t,n,a){if(typeof t=="function"){const[o,l]=Mj(a);t=t(n!==void 0?n:e.custom,o,l)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[o,l]=Mj(a);t=t(n!==void 0?n:e.custom,o,l)}return t}function _o(e,t,n){const a=e.getProps();return my(a,t,n!==void 0?n:a.custom,e)}const hT=new Set(["width","height","top","left","right","bottom",...qo]),Rj=30,T9=e=>!isNaN(parseFloat(e));class A9{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const o=Pn.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Pn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=T9(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new ey);const a=this.events[t].add(n);return t==="change"?()=>{a(),Ct.read(()=>{this.events.change.getSize()||this.stop()})}:a}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,a){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-a}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Pn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Rj)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Rj);return _C(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function $o(e,t){return new A9(e,t)}const Kg=e=>Array.isArray(e);function M9(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,$o(n))}function R9(e){return Kg(e)?e[e.length-1]||0:e}function _9(e,t){const n=_o(e,t);let{transitionEnd:a={},transition:o={},...l}=n||{};l={...l,...a};for(const u in l){const f=R9(l[u]);M9(e,u,f)}}const _n=e=>!!(e&&e.getVelocity);function O9(e){return!!(_n(e)&&e.add)}function Xg(e,t){const n=e.getValue("willChange");if(O9(n))return n.add(t);if(!n&&_a.WillChange){const a=new _a.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function py(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const I9="framerAppearId",mT="data-"+py(I9);function pT(e){return e.props[mT]}function D9({protectedKeys:e,needsAnimating:t},n){const a=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,a}function gT(e,t,{delay:n=0,transitionOverride:a,type:o}={}){let{transition:l,transitionEnd:u,...f}=t;const m=e.getDefaultTransition();l=l?fT(l,m):m;const h=l?.reduceMotion;a&&(l=a);const p=[],y=o&&e.animationState&&e.animationState.getState()[o];for(const b in f){const w=e.getValue(b,e.latestValues[b]??null),j=f[b];if(j===void 0||y&&D9(y,b))continue;const N={delay:n,...fy(l||{},b)},C=w.get();if(C!==void 0&&!w.isAnimating&&!Array.isArray(j)&&j===C&&!N.velocity)continue;let k=!1;if(window.MotionHandoffAnimation){const R=pT(e);if(R){const A=window.MotionHandoffAnimation(R,b,Ct);A!==null&&(N.startTime=A,k=!0)}}Xg(e,b);const E=h??e.shouldReduceMotion;w.start(hy(b,w,j,E&&hT.has(b)?{type:!1}:N,e,k));const S=w.animation;S&&p.push(S)}if(u){const b=()=>Ct.update(()=>{u&&_9(e,u)});p.length?Promise.all(p).then(b):b()}return p}function Jg(e,t,n={}){const a=_o(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:o=e.getDefaultTransition()||{}}=a||{};n.transitionOverride&&(o=n.transitionOverride);const l=a?()=>Promise.all(gT(e,a,n)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(m=0)=>{const{delayChildren:h=0,staggerChildren:p,staggerDirection:y}=o;return z9(e,t,m,h,p,y,n)}:()=>Promise.resolve(),{when:f}=o;if(f){const[m,h]=f==="beforeChildren"?[l,u]:[u,l];return m().then(()=>h())}else return Promise.all([l(),u(n.delay)])}function z9(e,t,n=0,a=0,o=0,l=1,u){const f=[];for(const m of e.variantChildren)m.notify("AnimationStart",t),f.push(Jg(m,t,{...u,delay:n+(typeof a=="function"?0:a)+uT(e.variantChildren,m,a,o,l)}).then(()=>m.notify("AnimationComplete",t)));return Promise.all(f)}function P9(e,t,n={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const o=t.map(l=>Jg(e,l,n));a=Promise.all(o)}else if(typeof t=="string")a=Jg(e,t,n);else{const o=typeof t=="function"?_o(e,t,n.custom):t;a=Promise.all(gT(e,o,n))}return a.then(()=>{e.notify("AnimationComplete",t)})}const L9={test:e=>e==="auto",parse:e=>e},vT=e=>t=>t.test(e),yT=[Zo,Ae,na,lr,hU,fU,L9],_j=e=>yT.find(vT(e));function $9(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||MC(e):!0}const U9=new Set(["brightness","contrast","saturate","opacity"]);function B9(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=n.match(ay)||[];if(!a)return e;const o=n.replace(a,"");let l=U9.has(t)?1:0;return a!==n&&(l*=100),t+"("+l+o+")"}const V9=/\b([a-z-]*)\(.*?\)/gu,Qg={...Us,getAnimatableNone:e=>{const t=e.match(V9);return t?t.map(B9).join(" "):e}},ev={...Us,getAnimatableNone:e=>{const t=Us.parse(e);return Us.createTransformer(e)(t.map(a=>typeof a=="number"?0:typeof a=="object"?{...a,alpha:1}:a))}},Oj={...Zo,transform:Math.round},H9={rotate:lr,rotateX:lr,rotateY:lr,rotateZ:lr,scale:ld,scaleX:ld,scaleY:ld,scaleZ:ld,skew:lr,skewX:lr,skewY:lr,distance:Ae,translateX:Ae,translateY:Ae,translateZ:Ae,x:Ae,y:Ae,z:Ae,perspective:Ae,transformPerspective:Ae,opacity:bc,originX:xj,originY:xj,originZ:Ae},gy={borderWidth:Ae,borderTopWidth:Ae,borderRightWidth:Ae,borderBottomWidth:Ae,borderLeftWidth:Ae,borderRadius:Ae,borderTopLeftRadius:Ae,borderTopRightRadius:Ae,borderBottomRightRadius:Ae,borderBottomLeftRadius:Ae,width:Ae,maxWidth:Ae,height:Ae,maxHeight:Ae,top:Ae,right:Ae,bottom:Ae,left:Ae,inset:Ae,insetBlock:Ae,insetBlockStart:Ae,insetBlockEnd:Ae,insetInline:Ae,insetInlineStart:Ae,insetInlineEnd:Ae,padding:Ae,paddingTop:Ae,paddingRight:Ae,paddingBottom:Ae,paddingLeft:Ae,paddingBlock:Ae,paddingBlockStart:Ae,paddingBlockEnd:Ae,paddingInline:Ae,paddingInlineStart:Ae,paddingInlineEnd:Ae,margin:Ae,marginTop:Ae,marginRight:Ae,marginBottom:Ae,marginLeft:Ae,marginBlock:Ae,marginBlockStart:Ae,marginBlockEnd:Ae,marginInline:Ae,marginInlineStart:Ae,marginInlineEnd:Ae,fontSize:Ae,backgroundPositionX:Ae,backgroundPositionY:Ae,...H9,zIndex:Oj,fillOpacity:bc,strokeOpacity:bc,numOctaves:Oj},F9={...gy,color:an,backgroundColor:an,outlineColor:an,fill:an,stroke:an,borderColor:an,borderTopColor:an,borderRightColor:an,borderBottomColor:an,borderLeftColor:an,filter:Qg,WebkitFilter:Qg,mask:ev,WebkitMask:ev},xT=e=>F9[e],Z9=new Set([Qg,ev]);function bT(e,t){let n=xT(e);return Z9.has(n)||(n=Us),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const q9=new Set(["auto","none","0"]);function W9(e,t,n){let a=0,o;for(;a<e.length&&!o;){const l=e[a];typeof l=="string"&&!q9.has(l)&&wc(l).values.length&&(o=e[a]),a++}if(o&&n)for(const l of t)e[l]=bT(n,o)}class Y9 extends dy{constructor(t,n,a,o,l){super(t,n,a,o,l,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:a}=this;if(!n||!n.current)return;super.readKeyframes();for(let p=0;p<t.length;p++){let y=t[p];if(typeof y=="string"&&(y=y.trim(),sy(y))){const b=dT(y,n.current);b!==void 0&&(t[p]=b),p===t.length-1&&(this.finalKeyframe=y)}}if(this.resolveNoneKeyframes(),!hT.has(a)||t.length!==2)return;const[o,l]=t,u=_j(o),f=_j(l),m=yj(o),h=yj(l);if(m!==h&&mr[a]){this.needsMeasurement=!0;return}if(u!==f)if(Cj(u)&&Cj(f))for(let p=0;p<t.length;p++){const y=t[p];typeof y=="string"&&(t[p]=parseFloat(y))}else mr[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,a=[];for(let o=0;o<t.length;o++)(t[o]===null||$9(t[o]))&&a.push(o);a.length&&W9(t,a,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:a}=this;if(!t||!t.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=mr[a](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&t.getValue(a,o).jump(o,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:a}=this;if(!t||!t.current)return;const o=t.getValue(n);o&&o.jump(this.measuredOrigin,!1);const l=a.length-1,u=a[l];a[l]=mr[n](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([f,m])=>{t.getValue(f).set(m)}),this.resolveNoneKeyframes()}}const G9=new Set(["opacity","clipPath","filter","transform"]);function wT(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let a=document;const o=n?.[e]??a.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e).filter(a=>a!=null)}const jT=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function tv(e){return AC(e)&&"offsetHeight"in e}const{schedule:vy}=HC(queueMicrotask,!1),Ls={x:!1,y:!1};function ST(){return Ls.x||Ls.y}function K9(e){return e==="x"||e==="y"?Ls[e]?null:(Ls[e]=!0,()=>{Ls[e]=!1}):Ls.x||Ls.y?null:(Ls.x=Ls.y=!0,()=>{Ls.x=Ls.y=!1})}function NT(e,t){const n=wT(e),a=new AbortController,o={passive:!0,...t,signal:a.signal};return[n,o,()=>a.abort()]}function X9(e){return!(e.pointerType==="touch"||ST())}function J9(e,t,n={}){const[a,o,l]=NT(e,n);return a.forEach(u=>{let f=!1,m=!1,h;const p=()=>{u.removeEventListener("pointerleave",j)},y=C=>{h&&(h(C),h=void 0),p()},b=C=>{f=!1,window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),m&&(m=!1,y(C))},w=()=>{f=!0,window.addEventListener("pointerup",b,o),window.addEventListener("pointercancel",b,o)},j=C=>{if(C.pointerType!=="touch"){if(f){m=!0;return}y(C)}},N=C=>{if(!X9(C))return;m=!1;const k=t(u,C);typeof k=="function"&&(h=k,u.addEventListener("pointerleave",j,o))};u.addEventListener("pointerenter",N,o),u.addEventListener("pointerdown",w,o)}),l}const kT=(e,t)=>t?e===t?!0:kT(e,t.parentElement):!1,yy=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Q9=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function eB(e){return Q9.has(e.tagName)||e.isContentEditable===!0}const tB=new Set(["INPUT","SELECT","TEXTAREA"]);function nB(e){return tB.has(e.tagName)||e.isContentEditable===!0}const Dd=new WeakSet;function Ij(e){return t=>{t.key==="Enter"&&e(t)}}function zp(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const sB=(e,t)=>{const n=e.currentTarget;if(!n)return;const a=Ij(()=>{if(Dd.has(n))return;zp(n,"down");const o=Ij(()=>{zp(n,"up")}),l=()=>zp(n,"cancel");n.addEventListener("keyup",o,t),n.addEventListener("blur",l,t)});n.addEventListener("keydown",a,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",a),t)};function Dj(e){return yy(e)&&!ST()}const zj=new WeakSet;function aB(e,t,n={}){const[a,o,l]=NT(e,n),u=f=>{const m=f.currentTarget;if(!Dj(f)||zj.has(f))return;Dd.add(m),n.stopPropagation&&zj.add(f);const h=t(m,f),p=(w,j)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",b),Dd.has(m)&&Dd.delete(m),Dj(w)&&typeof h=="function"&&h(w,{success:j})},y=w=>{p(w,m===window||m===document||n.useGlobalTarget||kT(m,w.target))},b=w=>{p(w,!1)};window.addEventListener("pointerup",y,o),window.addEventListener("pointercancel",b,o)};return a.forEach(f=>{(n.useGlobalTarget?window:f).addEventListener("pointerdown",u,o),tv(f)&&(f.addEventListener("focus",h=>sB(h,o)),!eB(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),l}function xy(e){return AC(e)&&"ownerSVGElement"in e}const zd=new WeakMap;let Pd;const ET=(e,t,n)=>(a,o)=>o&&o[0]?o[0][e+"Size"]:xy(a)&&"getBBox"in a?a.getBBox()[t]:a[n],rB=ET("inline","width","offsetWidth"),iB=ET("block","height","offsetHeight");function oB({target:e,borderBoxSize:t}){zd.get(e)?.forEach(n=>{n(e,{get width(){return rB(e,t)},get height(){return iB(e,t)}})})}function lB(e){e.forEach(oB)}function cB(){typeof ResizeObserver>"u"||(Pd=new ResizeObserver(lB))}function uB(e,t){Pd||cB();const n=wT(e);return n.forEach(a=>{let o=zd.get(a);o||(o=new Set,zd.set(a,o)),o.add(t),Pd?.observe(a)}),()=>{n.forEach(a=>{const o=zd.get(a);o?.delete(t),o?.size||Pd?.unobserve(a)})}}const Ld=new Set;let No;function dB(){No=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Ld.forEach(t=>t(e))},window.addEventListener("resize",No)}function fB(e){return Ld.add(e),No||dB(),()=>{Ld.delete(e),!Ld.size&&typeof No=="function"&&(window.removeEventListener("resize",No),No=void 0)}}function Pj(e,t){return typeof e=="function"?fB(e):uB(e,t)}function hB(e){return xy(e)&&e.tagName==="svg"}const mB=[...yT,an,Us],pB=e=>mB.find(vT(e)),Lj=()=>({translate:0,scale:1,origin:0,originPoint:0}),ko=()=>({x:Lj(),y:Lj()}),$j=()=>({min:0,max:0}),dn=()=>({x:$j(),y:$j()}),gB=new WeakMap;function Ff(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function jc(e){return typeof e=="string"||Array.isArray(e)}const by=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],wy=["initial",...by];function Zf(e){return Ff(e.animate)||wy.some(t=>jc(e[t]))}function CT(e){return!!(Zf(e)||e.variants)}function vB(e,t,n){for(const a in t){const o=t[a],l=n[a];if(_n(o))e.addValue(a,o);else if(_n(l))e.addValue(a,$o(o,{owner:e}));else if(l!==o)if(e.hasValue(a)){const u=e.getValue(a);u.liveStyle===!0?u.jump(o):u.hasAnimated||u.set(o)}else{const u=e.getStaticValue(a);e.addValue(a,$o(u!==void 0?u:o,{owner:e}))}}for(const a in n)t[a]===void 0&&e.removeValue(a);return t}const nv={current:null},TT={current:!1},yB=typeof window<"u";function xB(){if(TT.current=!0,!!yB)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>nv.current=e.matches;e.addEventListener("change",t),t()}else nv.current=!1}const Uj=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let gf={};function AT(e){gf=e}function bB(){return gf}class wB{scrapeMotionValuesFromProps(t,n,a){return{}}constructor({parent:t,props:n,presenceContext:a,reducedMotionConfig:o,skipAnimations:l,blockInitialAnimation:u,visualState:f},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=dy,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const w=Pn.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,Ct.render(this.render,!1,!0))};const{latestValues:h,renderState:p}=f;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=p,this.parent=t,this.props=n,this.presenceContext=a,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.skipAnimationsConfig=l,this.options=m,this.blockInitialAnimation=!!u,this.isControllingVariants=Zf(n),this.isVariantNode=CT(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:y,...b}=this.scrapeMotionValuesFromProps(n,{},this);for(const w in b){const j=b[w];h[w]!==void 0&&_n(j)&&j.set(h[w])}}mount(t){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=t,gB.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,a)=>this.bindToMotionValue(a,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(TT.current||xB(),this.shouldReduceMotion=nv.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),wr(this.notifyUpdate),wr(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&G9.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:f,times:m,ease:h,duration:p}=n.accelerate,y=new lT({element:this.current,name:t,keyframes:f,times:m,ease:h,duration:$s(p)}),b=u(y);this.valueSubscriptions.set(t,()=>{b(),y.cancel()});return}const a=Wo.has(t);a&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&Ct.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{o(),l&&l(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in gf){const n=gf[t];if(!n)continue;const{isEnabled:a,Feature:o}=n;if(!this.features[t]&&o&&a(this.props)&&(this.features[t]=new o(this)),this.features[t]){const l=this.features[t];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):dn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let a=0;a<Uj.length;a++){const o=Uj[a];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const l="on"+o,u=t[l];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=vB(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const a=this.values.get(t);n!==a&&(a&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let a=this.values.get(t);return a===void 0&&n!==void 0&&(a=$o(n===null?void 0:n,{owner:this}),this.addValue(t,a)),a}readValue(t,n){let a=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return a!=null&&(typeof a=="string"&&(TC(a)||MC(a))?a=parseFloat(a):!pB(a)&&Us.test(n)&&(a=bT(t,n)),this.setBaseTarget(t,_n(a)?a.get():a)),_n(a)?a.get():a}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let a;if(typeof n=="string"||typeof n=="object"){const l=my(this.props,n,this.presenceContext?.custom);l&&(a=l[t])}if(n&&a!==void 0)return a;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!_n(o)?o:this.initialValues[t]!==void 0&&a===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new ey),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){vy.render(this.render)}}class MT extends wB{constructor(){super(...arguments),this.KeyframeResolver=Y9}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const a=t.style;return a?a[n]:void 0}removeValueFromRenderState(t,{vars:n,style:a}){delete n[t],delete a[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;_n(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Mr{constructor(t){this.isMounted=!1,this.node=t}update(){}}function RT({top:e,left:t,right:n,bottom:a}){return{x:{min:t,max:n},y:{min:e,max:a}}}function jB({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function SB(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:a.y,right:a.x}}function Pp(e){return e===void 0||e===1}function sv({scale:e,scaleX:t,scaleY:n}){return!Pp(e)||!Pp(t)||!Pp(n)}function Qr(e){return sv(e)||_T(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function _T(e){return Bj(e.x)||Bj(e.y)}function Bj(e){return e&&e!=="0%"}function vf(e,t,n){const a=e-n,o=t*a;return n+o}function Vj(e,t,n,a,o){return o!==void 0&&(e=vf(e,o,a)),vf(e,n,a)+t}function av(e,t=0,n=1,a,o){e.min=Vj(e.min,t,n,a,o),e.max=Vj(e.max,t,n,a,o)}function OT(e,{x:t,y:n}){av(e.x,t.translate,t.scale,t.originPoint),av(e.y,n.translate,n.scale,n.originPoint)}const Hj=.999999999999,Fj=1.0000000000001;function NB(e,t,n,a=!1){const o=n.length;if(!o)return;t.x=t.y=1;let l,u;for(let f=0;f<o;f++){l=n[f],u=l.projectionDelta;const{visualElement:m}=l.options;m&&m.props.style&&m.props.style.display==="contents"||(a&&l.options.layoutScroll&&l.scroll&&l!==l.root&&Co(e,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(t.x*=u.x.scale,t.y*=u.y.scale,OT(e,u)),a&&Qr(l.latestValues)&&Co(e,l.latestValues))}t.x<Fj&&t.x>Hj&&(t.x=1),t.y<Fj&&t.y>Hj&&(t.y=1)}function Eo(e,t){e.min=e.min+t,e.max=e.max+t}function Zj(e,t,n,a,o=.5){const l=Vt(e.min,e.max,o);av(e,t,n,l,a)}function Co(e,t){Zj(e.x,t.x,t.scaleX,t.scale,t.originX),Zj(e.y,t.y,t.scaleY,t.scale,t.originY)}function IT(e,t){return RT(SB(e.getBoundingClientRect(),t))}function kB(e,t,n){const a=IT(e,n),{scroll:o}=t;return o&&(Eo(a.x,o.offset.x),Eo(a.y,o.offset.y)),a}const EB={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},CB=qo.length;function TB(e,t,n){let a="",o=!0;for(let l=0;l<CB;l++){const u=qo[l],f=e[u];if(f===void 0)continue;let m=!0;if(typeof f=="number")m=f===(u.startsWith("scale")?1:0);else{const h=parseFloat(f);m=u.startsWith("scale")?h===1:h===0}if(!m||n){const h=jT(f,gy[u]);if(!m){o=!1;const p=EB[u]||u;a+=`${p}(${h}) `}n&&(t[u]=h)}}return a=a.trim(),n?a=n(t,o?"":a):o&&(a="none"),a}function jy(e,t,n){const{style:a,vars:o,transformOrigin:l}=e;let u=!1,f=!1;for(const m in t){const h=t[m];if(Wo.has(m)){u=!0;continue}else if(ZC(m)){o[m]=h;continue}else{const p=jT(h,gy[m]);m.startsWith("origin")?(f=!0,l[m]=p):a[m]=p}}if(t.transform||(u||n?a.transform=TB(t,e.transform,n):a.transform&&(a.transform="none")),f){const{originX:m="50%",originY:h="50%",originZ:p=0}=l;a.transformOrigin=`${m} ${h} ${p}`}}function DT(e,{style:t,vars:n},a,o){const l=e.style;let u;for(u in t)l[u]=t[u];o?.applyProjectionStyles(l,a);for(u in n)l.setProperty(u,n[u])}function qj(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Ul={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ae.test(e))e=parseFloat(e);else return e;const n=qj(e,t.target.x),a=qj(e,t.target.y);return`${n}% ${a}%`}},AB={correct:(e,{treeScale:t,projectionDelta:n})=>{const a=e,o=Us.parse(e);if(o.length>5)return a;const l=Us.createTransformer(e),u=typeof o[0]!="number"?1:0,f=n.x.scale*t.x,m=n.y.scale*t.y;o[0+u]/=f,o[1+u]/=m;const h=Vt(f,m,.5);return typeof o[2+u]=="number"&&(o[2+u]/=h),typeof o[3+u]=="number"&&(o[3+u]/=h),l(o)}},rv={borderRadius:{...Ul,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ul,borderTopRightRadius:Ul,borderBottomLeftRadius:Ul,borderBottomRightRadius:Ul,boxShadow:AB};function zT(e,{layout:t,layoutId:n}){return Wo.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!rv[e]||e==="opacity")}function Sy(e,t,n){const a=e.style,o=t?.style,l={};if(!a)return l;for(const u in a)(_n(a[u])||o&&_n(o[u])||zT(u,e)||n?.getValue(u)?.liveStyle!==void 0)&&(l[u]=a[u]);return l}function MB(e){return window.getComputedStyle(e)}class RB extends MT{constructor(){super(...arguments),this.type="html",this.renderInstance=DT}readValueFromInstance(t,n){if(Wo.has(n))return this.projection?.isProjecting?Fg(n):KU(t,n);{const a=MB(t),o=(ZC(n)?a.getPropertyValue(n):a[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return IT(t,n)}build(t,n,a){jy(t,n,a.transformTemplate)}scrapeMotionValuesFromProps(t,n,a){return Sy(t,n,a)}}const _B={offset:"stroke-dashoffset",array:"stroke-dasharray"},OB={offset:"strokeDashoffset",array:"strokeDasharray"};function IB(e,t,n=1,a=0,o=!0){e.pathLength=1;const l=o?_B:OB;e[l.offset]=`${-a}`,e[l.array]=`${t} ${n}`}const DB=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function PT(e,{attrX:t,attrY:n,attrScale:a,pathLength:o,pathSpacing:l=1,pathOffset:u=0,...f},m,h,p){if(jy(e,f,h),m){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:y,style:b}=e;y.transform&&(b.transform=y.transform,delete y.transform),(b.transform||y.transformOrigin)&&(b.transformOrigin=y.transformOrigin??"50% 50%",delete y.transformOrigin),b.transform&&(b.transformBox=p?.transformBox??"fill-box",delete y.transformBox);for(const w of DB)y[w]!==void 0&&(b[w]=y[w],delete y[w]);t!==void 0&&(y.x=t),n!==void 0&&(y.y=n),a!==void 0&&(y.scale=a),o!==void 0&&IB(y,o,l,u,!1)}const LT=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),$T=e=>typeof e=="string"&&e.toLowerCase()==="svg";function zB(e,t,n,a){DT(e,t,void 0,a);for(const o in t.attrs)e.setAttribute(LT.has(o)?o:py(o),t.attrs[o])}function UT(e,t,n){const a=Sy(e,t,n);for(const o in e)if(_n(e[o])||_n(t[o])){const l=qo.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;a[l]=e[o]}return a}class PB extends MT{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=dn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Wo.has(n)){const a=xT(n);return a&&a.default||0}return n=LT.has(n)?n:py(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,a){return UT(t,n,a)}build(t,n,a){PT(t,n,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,n,a,o){zB(t,n,a,o)}mount(t){this.isSVGTag=$T(t.tagName),super.mount(t)}}const LB=wy.length;function BT(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?BT(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<LB;n++){const a=wy[n],o=e.props[a];(jc(o)||o===!1)&&(t[a]=o)}return t}function VT(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let a=0;a<n;a++)if(t[a]!==e[a])return!1;return!0}const $B=[...by].reverse(),UB=by.length;function BB(e){return t=>Promise.all(t.map(({animation:n,options:a})=>P9(e,n,a)))}function VB(e){let t=BB(e),n=Wj(),a=!0;const o=m=>(h,p)=>{const y=_o(e,p,m==="exit"?e.presenceContext?.custom:void 0);if(y){const{transition:b,transitionEnd:w,...j}=y;h={...h,...j,...w}}return h};function l(m){t=m(e)}function u(m){const{props:h}=e,p=BT(e.parent)||{},y=[],b=new Set;let w={},j=1/0;for(let C=0;C<UB;C++){const k=$B[C],E=n[k],S=h[k]!==void 0?h[k]:p[k],R=jc(S),A=k===m?E.isActive:null;A===!1&&(j=C);let M=S===p[k]&&S!==h[k]&&R;if(M&&a&&e.manuallyAnimateOnMount&&(M=!1),E.protectedKeys={...w},!E.isActive&&A===null||!S&&!E.prevProp||Ff(S)||typeof S=="boolean")continue;if(k==="exit"&&E.isActive&&A!==!0){E.prevResolvedValues&&(w={...w,...E.prevResolvedValues});continue}const D=HB(E.prevProp,S);let U=D||k===m&&E.isActive&&!M&&R||C>j&&R,F=!1;const P=Array.isArray(S)?S:[S];let _=P.reduce(o(k),{});A===!1&&(_={});const{prevResolvedValues:z={}}=E,B={...z,..._},V=H=>{U=!0,b.has(H)&&(F=!0,b.delete(H)),E.needsAnimating[H]=!0;const $=e.getValue(H);$&&($.liveStyle=!1)};for(const H in B){const $=_[H],G=z[H];if(w.hasOwnProperty(H))continue;let X=!1;Kg($)&&Kg(G)?X=!VT($,G):X=$!==G,X?$!=null?V(H):b.add(H):$!==void 0&&b.has(H)?V(H):E.protectedKeys[H]=!0}E.prevProp=S,E.prevResolvedValues=_,E.isActive&&(w={...w,..._}),a&&e.blockInitialAnimation&&(U=!1);const K=M&&D;U&&(!K||F)&&y.push(...P.map(H=>{const $={type:k};if(typeof H=="string"&&a&&!K&&e.manuallyAnimateOnMount&&e.parent){const{parent:G}=e,X=_o(G,H);if(G.enteringChildren&&X){const{delayChildren:O}=X.transition||{};$.delay=uT(G.enteringChildren,e,O)}}return{animation:H,options:$}}))}if(b.size){const C={};if(typeof h.initial!="boolean"){const k=_o(e,Array.isArray(h.initial)?h.initial[0]:h.initial);k&&k.transition&&(C.transition=k.transition)}b.forEach(k=>{const E=e.getBaseTarget(k),S=e.getValue(k);S&&(S.liveStyle=!0),C[k]=E??null}),y.push({animation:C})}let N=!!y.length;return a&&(h.initial===!1||h.initial===h.animate)&&!e.manuallyAnimateOnMount&&(N=!1),a=!1,N?t(y):Promise.resolve()}function f(m,h){if(n[m].isActive===h)return Promise.resolve();e.variantChildren?.forEach(y=>y.animationState?.setActive(m,h)),n[m].isActive=h;const p=u(m);for(const y in n)n[y].protectedKeys={};return p}return{animateChanges:u,setActive:f,setAnimateFunction:l,getState:()=>n,reset:()=>{n=Wj()}}}function HB(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!VT(t,e):!1}function Kr(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Wj(){return{animate:Kr(!0),whileInView:Kr(),whileHover:Kr(),whileTap:Kr(),whileDrag:Kr(),whileFocus:Kr(),exit:Kr()}}function Yj(e,t){e.min=t.min,e.max=t.max}function Ps(e,t){Yj(e.x,t.x),Yj(e.y,t.y)}function Gj(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const HT=1e-4,FB=1-HT,ZB=1+HT,FT=.01,qB=0-FT,WB=0+FT;function Ln(e){return e.max-e.min}function YB(e,t,n){return Math.abs(e-t)<=n}function Kj(e,t,n,a=.5){e.origin=a,e.originPoint=Vt(t.min,t.max,e.origin),e.scale=Ln(n)/Ln(t),e.translate=Vt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=FB&&e.scale<=ZB||isNaN(e.scale))&&(e.scale=1),(e.translate>=qB&&e.translate<=WB||isNaN(e.translate))&&(e.translate=0)}function oc(e,t,n,a){Kj(e.x,t.x,n.x,a?a.originX:void 0),Kj(e.y,t.y,n.y,a?a.originY:void 0)}function Xj(e,t,n){e.min=n.min+t.min,e.max=e.min+Ln(t)}function GB(e,t,n){Xj(e.x,t.x,n.x),Xj(e.y,t.y,n.y)}function Jj(e,t,n){e.min=t.min-n.min,e.max=e.min+Ln(t)}function yf(e,t,n){Jj(e.x,t.x,n.x),Jj(e.y,t.y,n.y)}function Qj(e,t,n,a,o){return e-=t,e=vf(e,1/n,a),o!==void 0&&(e=vf(e,1/o,a)),e}function KB(e,t=0,n=1,a=.5,o,l=e,u=e){if(na.test(t)&&(t=parseFloat(t),t=Vt(u.min,u.max,t/100)-u.min),typeof t!="number")return;let f=Vt(l.min,l.max,a);e===l&&(f-=t),e.min=Qj(e.min,t,n,f,o),e.max=Qj(e.max,t,n,f,o)}function eS(e,t,[n,a,o],l,u){KB(e,t[n],t[a],t[o],t.scale,l,u)}const XB=["x","scaleX","originX"],JB=["y","scaleY","originY"];function tS(e,t,n,a){eS(e.x,t,XB,n?n.x:void 0,a?a.x:void 0),eS(e.y,t,JB,n?n.y:void 0,a?a.y:void 0)}function nS(e){return e.translate===0&&e.scale===1}function ZT(e){return nS(e.x)&&nS(e.y)}function sS(e,t){return e.min===t.min&&e.max===t.max}function QB(e,t){return sS(e.x,t.x)&&sS(e.y,t.y)}function aS(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function qT(e,t){return aS(e.x,t.x)&&aS(e.y,t.y)}function rS(e){return Ln(e.x)/Ln(e.y)}function iS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Gs(e){return[e("x"),e("y")]}function eV(e,t,n){let a="";const o=e.x.translate/t.x,l=e.y.translate/t.y,u=n?.z||0;if((o||l||u)&&(a=`translate3d(${o}px, ${l}px, ${u}px) `),(t.x!==1||t.y!==1)&&(a+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:h,rotate:p,rotateX:y,rotateY:b,skewX:w,skewY:j}=n;h&&(a=`perspective(${h}px) ${a}`),p&&(a+=`rotate(${p}deg) `),y&&(a+=`rotateX(${y}deg) `),b&&(a+=`rotateY(${b}deg) `),w&&(a+=`skewX(${w}deg) `),j&&(a+=`skewY(${j}deg) `)}const f=e.x.scale*t.x,m=e.y.scale*t.y;return(f!==1||m!==1)&&(a+=`scale(${f}, ${m})`),a||"none"}const WT=["TopLeft","TopRight","BottomLeft","BottomRight"],tV=WT.length,oS=e=>typeof e=="string"?parseFloat(e):e,lS=e=>typeof e=="number"||Ae.test(e);function nV(e,t,n,a,o,l){o?(e.opacity=Vt(0,n.opacity??1,sV(a)),e.opacityExit=Vt(t.opacity??1,0,aV(a))):l&&(e.opacity=Vt(t.opacity??1,n.opacity??1,a));for(let u=0;u<tV;u++){const f=`border${WT[u]}Radius`;let m=cS(t,f),h=cS(n,f);if(m===void 0&&h===void 0)continue;m||(m=0),h||(h=0),m===0||h===0||lS(m)===lS(h)?(e[f]=Math.max(Vt(oS(m),oS(h),a),0),(na.test(h)||na.test(m))&&(e[f]+="%")):e[f]=h}(t.rotate||n.rotate)&&(e.rotate=Vt(t.rotate||0,n.rotate||0,a))}function cS(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const sV=YT(0,.5,$C),aV=YT(.5,.95,ks);function YT(e,t,n){return a=>a<e?0:a>t?1:n(xc(e,t,a))}function rV(e,t,n){const a=_n(e)?e:$o(e);return a.start(hy("",a,t,n)),a.animation}function Sc(e,t,n,a={passive:!0}){return e.addEventListener(t,n,a),()=>e.removeEventListener(t,n)}const iV=(e,t)=>e.depth-t.depth;class oV{constructor(){this.children=[],this.isDirty=!1}add(t){Jv(this.children,t),this.isDirty=!0}remove(t){ff(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(iV),this.isDirty=!1,this.children.forEach(t)}}function lV(e,t){const n=Pn.now(),a=({timestamp:o})=>{const l=o-n;l>=t&&(wr(a),e(l-t))};return Ct.setup(a,!0),()=>wr(a)}function $d(e){return _n(e)?e.get():e}class cV{constructor(){this.members=[]}add(t){Jv(this.members,t);for(let n=this.members.length-1;n>=0;n--){const a=this.members[n];if(a===t||a===this.lead||a===this.prevLead)continue;const o=a.instance;o&&o.isConnected===!1&&a.isPresent!==!1&&!a.snapshot&&ff(this.members,a)}t.scheduleRender()}remove(t){if(ff(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(o=>t===o);if(n===0)return!1;let a;for(let o=n;o>=0;o--){const l=this.members[o],u=l.instance;if(l.isPresent!==!1&&(!u||u.isConnected!==!1)){a=l;break}}return a?(this.promote(a),!0):!1}promote(t,n){const a=this.lead;if(t!==a&&(this.prevLead=a,this.lead=t,t.show(),a)){a.instance&&a.scheduleRender(),t.scheduleRender();const o=a.options.layoutDependency,l=t.options.layoutDependency;if(!(o!==void 0&&l!==void 0&&o===l)){const m=a.instance;m&&m.isConnected===!1&&!a.snapshot||(t.resumeFrom=a,n&&(t.resumeFrom.preserveOpacity=!0),a.snapshot&&(t.snapshot=a.snapshot,t.snapshot.latestValues=a.animationValues||a.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0))}const{crossfade:f}=t.options;f===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:a}=t;n.onExitComplete&&n.onExitComplete(),a&&a.options.onExitComplete&&a.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Ud={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Lp=["","X","Y","Z"],uV=1e3;let dV=0;function $p(e,t,n,a){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),a&&(a[e]=0))}function GT(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=pT(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ct,!(o||l))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&GT(a)}function KT({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:a,resetTransform:o}){return class{constructor(u={},f=t?.()){this.id=dV++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(mV),this.nodes.forEach(yV),this.nodes.forEach(xV),this.nodes.forEach(pV)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new oV)}addEventListener(u,f){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new ey),this.eventHandlers.get(u).add(f)}notifyListeners(u,...f){const m=this.eventHandlers.get(u);m&&m.notify(...f)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=xy(u)&&!hB(u),this.instance=u;const{layoutId:f,layout:m,visualElement:h}=this.options;if(h&&!h.current&&h.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||f)&&(this.isLayoutDirty=!0),e){let p,y=0;const b=()=>this.root.updateBlockedByResize=!1;Ct.read(()=>{y=window.innerWidth}),e(u,()=>{const w=window.innerWidth;w!==y&&(y=w,this.root.updateBlockedByResize=!0,p&&p(),p=lV(b,250),Ud.hasAnimatedSinceResize&&(Ud.hasAnimatedSinceResize=!1,this.nodes.forEach(fS)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&h&&(f||m)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:y,hasRelativeLayoutChanged:b,layout:w})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||h.getDefaultTransition()||NV,{onLayoutAnimationStart:N,onLayoutAnimationComplete:C}=h.getProps(),k=!this.targetLayout||!qT(this.targetLayout,w),E=!y&&b;if(this.options.layoutRoot||this.resumeFrom||E||y&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...fy(j,"layout"),onPlay:N,onComplete:C};(h.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(p,E)}else y||fS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=w})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),wr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(bV),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&GT(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const y=this.path[p];y.shouldResetTransform=!0,y.updateScroll("snapshot"),y.options.layoutRoot&&y.willUpdate(!1)}const{layoutId:f,layout:m}=this.options;if(f===void 0&&!m)return;const h=this.getTransformTemplate();this.prevTransformTemplateValue=h?h(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(uS);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(dS);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(vV),this.nodes.forEach(fV),this.nodes.forEach(hV)):this.nodes.forEach(dS),this.clearAllSnapshots();const f=Pn.now();En.delta=ra(0,1e3/60,f-En.timestamp),En.timestamp=f,En.isProcessing=!0,Mp.update.process(En),Mp.preRender.process(En),Mp.render.process(En),En.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,vy.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(gV),this.sharedNodes.forEach(wV)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ct.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ct.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ln(this.snapshot.measuredBox.x)&&!Ln(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=dn(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(f=!1),f&&this.instance){const m=a(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!ZT(this.projectionDelta),m=this.getTransformTemplate(),h=m?m(this.latestValues,""):void 0,p=h!==this.prevTransformTemplateValue;u&&this.instance&&(f||Qr(this.latestValues)||p)&&(o(this.instance,h),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const f=this.measurePageBox();let m=this.removeElementScroll(f);return u&&(m=this.removeTransform(m)),kV(m),{animationId:this.root.animationId,measuredBox:f,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return dn();const f=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(EV))){const{scroll:h}=this.root;h&&(Eo(f.x,h.offset.x),Eo(f.y,h.offset.y))}return f}removeElementScroll(u){const f=dn();if(Ps(f,u),this.scroll?.wasRoot)return f;for(let m=0;m<this.path.length;m++){const h=this.path[m],{scroll:p,options:y}=h;h!==this.root&&p&&y.layoutScroll&&(p.wasRoot&&Ps(f,u),Eo(f.x,p.offset.x),Eo(f.y,p.offset.y))}return f}applyTransform(u,f=!1){const m=dn();Ps(m,u);for(let h=0;h<this.path.length;h++){const p=this.path[h];!f&&p.options.layoutScroll&&p.scroll&&p!==p.root&&Co(m,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),Qr(p.latestValues)&&Co(m,p.latestValues)}return Qr(this.latestValues)&&Co(m,this.latestValues),m}removeTransform(u){const f=dn();Ps(f,u);for(let m=0;m<this.path.length;m++){const h=this.path[m];if(!h.instance||!Qr(h.latestValues))continue;sv(h.latestValues)&&h.updateSnapshot();const p=dn(),y=h.measurePageBox();Ps(p,y),tS(f,h.latestValues,h.snapshot?h.snapshot.layoutBox:void 0,p)}return Qr(this.latestValues)&&tS(f,this.latestValues),f}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==En.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==f;if(!(u||m&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:y}=this.options;if(!this.layout||!(p||y))return;this.resolvedRelativeTargetAt=En.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=dn(),this.targetWithTransforms=dn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),GB(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ps(this.target,this.layout.layoutBox),OT(this.target,this.targetDelta)):Ps(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||sv(this.parent.latestValues)||_T(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,f,m){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=dn(),this.relativeTargetOrigin=dn(),yf(this.relativeTargetOrigin,f,m),Ps(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),f=!!this.resumingFrom||this!==u;let m=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(m=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===En.timestamp&&(m=!1),m)return;const{layout:h,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(h||p))return;Ps(this.layoutCorrected,this.layout.layoutBox);const y=this.treeScale.x,b=this.treeScale.y;NB(this.layoutCorrected,this.treeScale,this.path,f),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=dn());const{target:w}=u;if(!w){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Gj(this.prevProjectionDelta.x,this.projectionDelta.x),Gj(this.prevProjectionDelta.y,this.projectionDelta.y)),oc(this.projectionDelta,this.layoutCorrected,w,this.latestValues),(this.treeScale.x!==y||this.treeScale.y!==b||!iS(this.projectionDelta.x,this.prevProjectionDelta.x)||!iS(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",w))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){if(this.options.visualElement?.scheduleRender(),u){const f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ko(),this.projectionDelta=ko(),this.projectionDeltaWithTransform=ko()}setAnimationOrigin(u,f=!1){const m=this.snapshot,h=m?m.latestValues:{},p={...this.latestValues},y=ko();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const b=dn(),w=m?m.source:void 0,j=this.layout?this.layout.source:void 0,N=w!==j,C=this.getStack(),k=!C||C.members.length<=1,E=!!(N&&!k&&this.options.crossfade===!0&&!this.path.some(SV));this.animationProgress=0;let S;this.mixTargetDelta=R=>{const A=R/1e3;hS(y.x,u.x,A),hS(y.y,u.y,A),this.setTargetDelta(y),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(yf(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),jV(this.relativeTarget,this.relativeTargetOrigin,b,A),S&&QB(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=dn()),Ps(S,this.relativeTarget)),N&&(this.animationValues=p,nV(p,h,this.latestValues,A,E,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=A},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(wr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ct.update(()=>{Ud.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=$o(0)),this.motionValue.jump(0,!1),this.currentAnimation=rV(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),u.onUpdate&&u.onUpdate(f)},onStop:()=>{},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(uV),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:f,target:m,layout:h,latestValues:p}=u;if(!(!f||!m||!h)){if(this!==u&&this.layout&&h&&XT(this.options.animationType,this.layout.layoutBox,h.layoutBox)){m=this.target||dn();const y=Ln(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+y;const b=Ln(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+b}Ps(f,m),Co(f,p),oc(this.projectionDeltaWithTransform,this.layoutCorrected,f,p)}}registerSharedNode(u,f){this.sharedNodes.has(u)||this.sharedNodes.set(u,new cV),this.sharedNodes.get(u).add(f);const h=f.options.initialPromotionConfig;f.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(f):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:f,preserveFollowOpacity:m}={}){const h=this.getStack();h&&h.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let f=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(f=!0),!f)return;const h={};m.z&&$p("z",u,h,this.animationValues);for(let p=0;p<Lp.length;p++)$p(`rotate${Lp[p]}`,u,h,this.animationValues),$p(`skew${Lp[p]}`,u,h,this.animationValues);u.render();for(const p in h)u.setStaticValue(p,h[p]),this.animationValues&&(this.animationValues[p]=h[p]);u.scheduleRender()}applyProjectionStyles(u,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=$d(f?.pointerEvents)||"",u.transform=m?m(this.latestValues,""):"none";return}const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=$d(f?.pointerEvents)||""),this.hasProjected&&!Qr(this.latestValues)&&(u.transform=m?m({},""):"none",this.hasProjected=!1);return}u.visibility="";const p=h.animationValues||h.latestValues;this.applyTransformsToTarget();let y=eV(this.projectionDeltaWithTransform,this.treeScale,p);m&&(y=m(p,y)),u.transform=y;const{x:b,y:w}=this.projectionDelta;u.transformOrigin=`${b.origin*100}% ${w.origin*100}% 0`,h.animationValues?u.opacity=h===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:u.opacity=h===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const j in rv){if(p[j]===void 0)continue;const{correct:N,applyTo:C,isCSSVariable:k}=rv[j],E=y==="none"?p[j]:N(p[j],h);if(C){const S=C.length;for(let R=0;R<S;R++)u[C[R]]=E}else k?this.options.visualElement.renderState.vars[j]=E:u[j]=E}this.options.layoutId&&(u.pointerEvents=h===this?$d(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(uS),this.root.sharedNodes.clear()}}}function fV(e){e.updateLayout()}function hV(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:a}=e.layout,{animationType:o}=e.options,l=t.source!==e.layout.source;o==="size"?Gs(p=>{const y=l?t.measuredBox[p]:t.layoutBox[p],b=Ln(y);y.min=n[p].min,y.max=y.min+b}):XT(o,t.layoutBox,n)&&Gs(p=>{const y=l?t.measuredBox[p]:t.layoutBox[p],b=Ln(n[p]);y.max=y.min+b,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+b)});const u=ko();oc(u,n,t.layoutBox);const f=ko();l?oc(f,e.applyTransform(a,!0),t.measuredBox):oc(f,n,t.layoutBox);const m=!ZT(u);let h=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:y,layout:b}=p;if(y&&b){const w=dn();yf(w,t.layoutBox,y.layoutBox);const j=dn();yf(j,n,b.layoutBox),qT(w,j)||(h=!0),p.options.layoutRoot&&(e.relativeTarget=j,e.relativeTargetOrigin=w,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:f,layoutDelta:u,hasLayoutChanged:m,hasRelativeLayoutChanged:h})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function mV(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function pV(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function gV(e){e.clearSnapshot()}function uS(e){e.clearMeasurements()}function dS(e){e.isLayoutDirty=!1}function vV(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function fS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function yV(e){e.resolveTargetDelta()}function xV(e){e.calcProjection()}function bV(e){e.resetSkewAndRotation()}function wV(e){e.removeLeadSnapshot()}function hS(e,t,n){e.translate=Vt(t.translate,0,n),e.scale=Vt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function mS(e,t,n,a){e.min=Vt(t.min,n.min,a),e.max=Vt(t.max,n.max,a)}function jV(e,t,n,a){mS(e.x,t.x,n.x,a),mS(e.y,t.y,n.y,a)}function SV(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const NV={duration:.45,ease:[.4,0,.1,1]},pS=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),gS=pS("applewebkit/")&&!pS("chrome/")?Math.round:ks;function vS(e){e.min=gS(e.min),e.max=gS(e.max)}function kV(e){vS(e.x),vS(e.y)}function XT(e,t,n){return e==="position"||e==="preserve-aspect"&&!YB(rS(t),rS(n),.2)}function EV(e){return e!==e.root&&e.scroll?.wasRoot}const CV=KT({attachResizeListener:(e,t)=>Sc(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Up={current:void 0},JT=KT({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Up.current){const e=new CV({});e.mount(window),e.setOptions({layoutScroll:!0}),Up.current=e}return Up.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Ny=v.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function yS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function TV(...e){return t=>{let n=!1;const a=e.map(o=>{const l=yS(o,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let o=0;o<a.length;o++){const l=a[o];typeof l=="function"?l():yS(e[o],null)}}}}function AV(...e){return v.useCallback(TV(...e),e)}class MV extends v.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=n.offsetParent,o=tv(a)&&a.offsetWidth||0,l=tv(a)&&a.offsetHeight||0,u=this.props.sizeRef.current;u.height=n.offsetHeight||0,u.width=n.offsetWidth||0,u.top=n.offsetTop,u.left=n.offsetLeft,u.right=o-u.width-u.left,u.bottom=l-u.height-u.top}return null}componentDidUpdate(){}render(){return this.props.children}}function RV({children:e,isPresent:t,anchorX:n,anchorY:a,root:o,pop:l}){const u=v.useId(),f=v.useRef(null),m=v.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:h}=v.useContext(Ny),p=e.props?.ref??e?.ref,y=AV(f,p);return v.useInsertionEffect(()=>{const{width:b,height:w,top:j,left:N,right:C,bottom:k}=m.current;if(t||l===!1||!f.current||!b||!w)return;const E=n==="left"?`left: ${N}`:`right: ${C}`,S=a==="bottom"?`bottom: ${k}`:`top: ${j}`;f.current.dataset.motionPopId=u;const R=document.createElement("style");h&&(R.nonce=h);const A=o??document.head;return A.appendChild(R),R.sheet&&R.sheet.insertRule(`
122
- [data-motion-pop-id="${u}"] {
123
- position: absolute !important;
124
- width: ${b}px !important;
125
- height: ${w}px !important;
126
- ${E}px !important;
127
- ${S}px !important;
128
- }
129
- `),()=>{A.contains(R)&&A.removeChild(R)}},[t]),i.jsx(MV,{isPresent:t,childRef:f,sizeRef:m,pop:l,children:l===!1?e:v.cloneElement(e,{ref:y})})}const _V=({children:e,initial:t,isPresent:n,onExitComplete:a,custom:o,presenceAffectsLayout:l,mode:u,anchorX:f,anchorY:m,root:h})=>{const p=Xv(OV),y=v.useId();let b=!0,w=v.useMemo(()=>(b=!1,{id:y,initial:t,isPresent:n,custom:o,onExitComplete:j=>{p.set(j,!0);for(const N of p.values())if(!N)return;a&&a()},register:j=>(p.set(j,!1),()=>p.delete(j))}),[n,p,a]);return l&&b&&(w={...w}),v.useMemo(()=>{p.forEach((j,N)=>p.set(N,!1))},[n]),v.useEffect(()=>{!n&&!p.size&&a&&a()},[n]),e=i.jsx(RV,{pop:u==="popLayout",isPresent:n,anchorX:f,anchorY:m,root:h,children:e}),i.jsx(Hf.Provider,{value:w,children:e})};function OV(){return new Map}function QT(e=!0){const t=v.useContext(Hf);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:a,register:o}=t,l=v.useId();v.useEffect(()=>{if(e)return o(l)},[e]);const u=v.useCallback(()=>e&&a&&a(l),[l,a,e]);return!n&&a?[!1,u]:[!0]}const cd=e=>e.key||"";function xS(e){const t=[];return v.Children.forEach(e,n=>{v.isValidElement(n)&&t.push(n)}),t}const IV=({children:e,custom:t,initial:n=!0,onExitComplete:a,presenceAffectsLayout:o=!0,mode:l="sync",propagate:u=!1,anchorX:f="left",anchorY:m="top",root:h})=>{const[p,y]=QT(u),b=v.useMemo(()=>xS(e),[e]),w=u&&!p?[]:b.map(cd),j=v.useRef(!0),N=v.useRef(b),C=Xv(()=>new Map),k=v.useRef(new Set),[E,S]=v.useState(b),[R,A]=v.useState(b);CC(()=>{j.current=!1,N.current=b;for(let U=0;U<R.length;U++){const F=cd(R[U]);w.includes(F)?(C.delete(F),k.current.delete(F)):C.get(F)!==!0&&C.set(F,!1)}},[R,w.length,w.join("-")]);const M=[];if(b!==E){let U=[...b];for(let F=0;F<R.length;F++){const P=R[F],_=cd(P);w.includes(_)||(U.splice(F,0,P),M.push(P))}return l==="wait"&&M.length&&(U=M),A(xS(U)),S(b),null}const{forceRender:D}=v.useContext(Kv);return i.jsx(i.Fragment,{children:R.map(U=>{const F=cd(U),P=u&&!p?!1:b===R||w.includes(F),_=()=>{if(k.current.has(F))return;if(k.current.add(F),C.has(F))C.set(F,!0);else return;let z=!0;C.forEach(B=>{B||(z=!1)}),z&&(D?.(),A(N.current),u&&y?.(),a&&a())};return i.jsx(_V,{isPresent:P,initial:!j.current||n?void 0:!1,custom:t,presenceAffectsLayout:o,mode:l,root:h,onExitComplete:P?void 0:_,anchorX:f,anchorY:m,children:U},F)})})},eA=v.createContext({strict:!1}),bS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let wS=!1;function DV(){if(wS)return;const e={};for(const t in bS)e[t]={isEnabled:n=>bS[t].some(a=>!!n[a])};AT(e),wS=!0}function tA(){return DV(),bB()}function zV(e){const t=tA();for(const n in e)t[n]={...t[n],...e[n]};AT(t)}const PV=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function xf(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||PV.has(e)}let nA=e=>!xf(e);function LV(e){typeof e=="function"&&(nA=t=>t.startsWith("on")?!xf(t):e(t))}try{LV(require("@emotion/is-prop-valid").default)}catch{}function $V(e,t,n){const a={};for(const o in e)o==="values"&&typeof e.values=="object"||(nA(o)||n===!0&&xf(o)||!t&&!xf(o)||e.draggable&&o.startsWith("onDrag"))&&(a[o]=e[o]);return a}const qf=v.createContext({});function UV(e,t){if(Zf(e)){const{initial:n,animate:a}=e;return{initial:n===!1||jc(n)?n:void 0,animate:jc(a)?a:void 0}}return e.inherit!==!1?t:{}}function BV(e){const{initial:t,animate:n}=UV(e,v.useContext(qf));return v.useMemo(()=>({initial:t,animate:n}),[jS(t),jS(n)])}function jS(e){return Array.isArray(e)?e.join(" "):e}const ky=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function sA(e,t,n){for(const a in t)!_n(t[a])&&!zT(a,n)&&(e[a]=t[a])}function VV({transformTemplate:e},t){return v.useMemo(()=>{const n=ky();return jy(n,t,e),Object.assign({},n.vars,n.style)},[t])}function HV(e,t){const n=e.style||{},a={};return sA(a,n,e),Object.assign(a,VV(e,t)),a}function FV(e,t){const n={},a=HV(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=a,n}const aA=()=>({...ky(),attrs:{}});function ZV(e,t,n,a){const o=v.useMemo(()=>{const l=aA();return PT(l,t,$T(a),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};sA(l,e.style,e),o.style={...l,...o.style}}return o}const qV=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Ey(e){return typeof e!="string"||e.includes("-")?!1:!!(qV.indexOf(e)>-1||/[A-Z]/u.test(e))}function WV(e,t,n,{latestValues:a},o,l=!1,u){const m=(u??Ey(e)?ZV:FV)(t,a,o,e),h=$V(t,typeof e=="string",l),p=e!==v.Fragment?{...h,...m,ref:n}:{},{children:y}=t,b=v.useMemo(()=>_n(y)?y.get():y,[y]);return v.createElement(e,{...p,children:b})}function YV({scrapeMotionValuesFromProps:e,createRenderState:t},n,a,o){return{latestValues:GV(n,a,o,e),renderState:t()}}function GV(e,t,n,a){const o={},l=a(e,{});for(const b in l)o[b]=$d(l[b]);let{initial:u,animate:f}=e;const m=Zf(e),h=CT(e);t&&h&&!m&&e.inherit!==!1&&(u===void 0&&(u=t.initial),f===void 0&&(f=t.animate));let p=n?n.initial===!1:!1;p=p||u===!1;const y=p?f:u;if(y&&typeof y!="boolean"&&!Ff(y)){const b=Array.isArray(y)?y:[y];for(let w=0;w<b.length;w++){const j=my(e,b[w]);if(j){const{transitionEnd:N,transition:C,...k}=j;for(const E in k){let S=k[E];if(Array.isArray(S)){const R=p?S.length-1:0;S=S[R]}S!==null&&(o[E]=S)}for(const E in N)o[E]=N[E]}}}return o}const rA=e=>(t,n)=>{const a=v.useContext(qf),o=v.useContext(Hf),l=()=>YV(e,t,a,o);return n?l():Xv(l)},KV=rA({scrapeMotionValuesFromProps:Sy,createRenderState:ky}),XV=rA({scrapeMotionValuesFromProps:UT,createRenderState:aA}),JV=Symbol.for("motionComponentSymbol");function QV(e,t,n){const a=v.useRef(n);v.useInsertionEffect(()=>{a.current=n});const o=v.useRef(null);return v.useCallback(l=>{l&&e.onMount?.(l),t&&(l?t.mount(l):t.unmount());const u=a.current;if(typeof u=="function")if(l){const f=u(l);typeof f=="function"&&(o.current=f)}else o.current?(o.current(),o.current=null):u(l);else u&&(u.current=l)},[t])}const iA=v.createContext({});function go(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function eH(e,t,n,a,o,l){const{visualElement:u}=v.useContext(qf),f=v.useContext(eA),m=v.useContext(Hf),h=v.useContext(Ny),p=h.reducedMotion,y=h.skipAnimations,b=v.useRef(null),w=v.useRef(!1);a=a||f.renderer,!b.current&&a&&(b.current=a(e,{visualState:t,parent:u,props:n,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:p,skipAnimations:y,isSVG:l}),w.current&&b.current&&(b.current.manuallyAnimateOnMount=!0));const j=b.current,N=v.useContext(iA);j&&!j.projection&&o&&(j.type==="html"||j.type==="svg")&&tH(b.current,n,o,N);const C=v.useRef(!1);v.useInsertionEffect(()=>{j&&C.current&&j.update(n,m)});const k=n[mT],E=v.useRef(!!k&&!window.MotionHandoffIsComplete?.(k)&&window.MotionHasOptimisedAnimation?.(k));return CC(()=>{w.current=!0,j&&(C.current=!0,window.MotionIsMounted=!0,j.updateFeatures(),j.scheduleRenderMicrotask(),E.current&&j.animationState&&j.animationState.animateChanges())}),v.useEffect(()=>{j&&(!E.current&&j.animationState&&j.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(k)}),E.current=!1),j.enteringChildren=void 0)}),j}function tH(e,t,n,a){const{layoutId:o,layout:l,drag:u,dragConstraints:f,layoutScroll:m,layoutRoot:h,layoutCrossfade:p}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:oA(e.parent)),e.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||f&&go(f),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:a,crossfade:p,layoutScroll:m,layoutRoot:h})}function oA(e){if(e)return e.options.allowProjection!==!1?e.projection:oA(e.parent)}function Bp(e,{forwardMotionProps:t=!1,type:n}={},a,o){a&&zV(a);const l=n?n==="svg":Ey(e),u=l?XV:KV;function f(h,p){let y;const b={...v.useContext(Ny),...h,layoutId:nH(h)},{isStatic:w}=b,j=BV(h),N=u(h,w);if(!w&&EC){sH();const C=aH(b);y=C.MeasureLayout,j.visualElement=eH(e,N,b,o,C.ProjectionNode,l)}return i.jsxs(qf.Provider,{value:j,children:[y&&j.visualElement?i.jsx(y,{visualElement:j.visualElement,...b}):null,WV(e,h,QV(N,j.visualElement,p),N,w,t,l)]})}f.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const m=v.forwardRef(f);return m[JV]=e,m}function nH({layoutId:e}){const t=v.useContext(Kv).id;return t&&e!==void 0?t+"-"+e:e}function sH(e,t){v.useContext(eA).strict}function aH(e){const t=tA(),{drag:n,layout:a}=t;if(!n&&!a)return{};const o={...n,...a};return{MeasureLayout:n?.isEnabled(e)||a?.isEnabled(e)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function rH(e,t){if(typeof Proxy>"u")return Bp;const n=new Map,a=(l,u)=>Bp(l,u,e,t),o=(l,u)=>a(l,u);return new Proxy(o,{get:(l,u)=>u==="create"?a:(n.has(u)||n.set(u,Bp(u,void 0,e,t)),n.get(u))})}const iH=(e,t)=>t.isSVG??Ey(e)?new PB(t):new RB(t,{allowProjection:e!==v.Fragment});class oH extends Mr{constructor(t){super(t),t.animationState||(t.animationState=VB(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Ff(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let lH=0;class cH extends Mr{constructor(){super(...arguments),this.id=lH++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===a)return;const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const uH={animation:{Feature:oH},exit:{Feature:cH}};function Ic(e){return{point:{x:e.pageX,y:e.pageY}}}const dH=e=>t=>yy(t)&&e(t,Ic(t));function lc(e,t,n,a){return Sc(e,t,dH(n),a)}const lA=({current:e})=>e?e.ownerDocument.defaultView:null,SS=(e,t)=>Math.abs(e-t);function fH(e,t){const n=SS(e.x,t.x),a=SS(e.y,t.y);return Math.sqrt(n**2+a**2)}const NS=new Set(["auto","scroll"]);class cA{constructor(t,n,{transformPagePoint:a,contextWindow:o=window,dragSnapToOrigin:l=!1,distanceThreshold:u=3,element:f}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=w=>{this.handleScroll(w.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Hp(this.lastMoveEventInfo,this.history),j=this.startEvent!==null,N=fH(w.offset,{x:0,y:0})>=this.distanceThreshold;if(!j&&!N)return;const{point:C}=w,{timestamp:k}=En;this.history.push({...C,timestamp:k});const{onStart:E,onMove:S}=this.handlers;j||(E&&E(this.lastMoveEvent,w),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,w)},this.handlePointerMove=(w,j)=>{this.lastMoveEvent=w,this.lastMoveEventInfo=Vp(j,this.transformPagePoint),Ct.update(this.updatePoint,!0)},this.handlePointerUp=(w,j)=>{this.end();const{onEnd:N,onSessionEnd:C,resumeAnimation:k}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&k&&k(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=Hp(w.type==="pointercancel"?this.lastMoveEventInfo:Vp(j,this.transformPagePoint),this.history);this.startEvent&&N&&N(w,E),C&&C(w,E)},!yy(t))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=o||window;const m=Ic(t),h=Vp(m,this.transformPagePoint),{point:p}=h,{timestamp:y}=En;this.history=[{...p,timestamp:y}];const{onSessionStart:b}=n;b&&b(t,Hp(h,this.history)),this.removeListeners=Rc(lc(this.contextWindow,"pointermove",this.handlePointerMove),lc(this.contextWindow,"pointerup",this.handlePointerUp),lc(this.contextWindow,"pointercancel",this.handlePointerUp)),f&&this.startScrollTracking(f)}startScrollTracking(t){let n=t.parentElement;for(;n;){const a=getComputedStyle(n);(NS.has(a.overflowX)||NS.has(a.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const a=t===window,o=a?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},l={x:o.x-n.x,y:o.y-n.y};l.x===0&&l.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(t,o),Ct.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),wr(this.updatePoint)}}function Vp(e,t){return t?{point:t(e.point)}:e}function kS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Hp({point:e},t){return{point:e,delta:kS(e,uA(t)),offset:kS(e,hH(t)),velocity:mH(t,.1)}}function hH(e){return e[0]}function uA(e){return e[e.length-1]}function mH(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,a=null;const o=uA(e);for(;n>=0&&(a=e[n],!(o.timestamp-a.timestamp>$s(t)));)n--;if(!a)return{x:0,y:0};a===e[0]&&e.length>2&&o.timestamp-a.timestamp>$s(t)*2&&(a=e[1]);const l=Ns(o.timestamp-a.timestamp);if(l===0)return{x:0,y:0};const u={x:(o.x-a.x)/l,y:(o.y-a.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function pH(e,{min:t,max:n},a){return t!==void 0&&e<t?e=a?Vt(t,e,a.min):Math.max(e,t):n!==void 0&&e>n&&(e=a?Vt(n,e,a.max):Math.min(e,n)),e}function ES(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function gH(e,{top:t,left:n,bottom:a,right:o}){return{x:ES(e.x,n,o),y:ES(e.y,t,a)}}function CS(e,t){let n=t.min-e.min,a=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,a]=[a,n]),{min:n,max:a}}function vH(e,t){return{x:CS(e.x,t.x),y:CS(e.y,t.y)}}function yH(e,t){let n=.5;const a=Ln(e),o=Ln(t);return o>a?n=xc(t.min,t.max-a,e.min):a>o&&(n=xc(e.min,e.max-o,t.min)),ra(0,1,n)}function xH(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const iv=.35;function bH(e=iv){return e===!1?e=0:e===!0&&(e=iv),{x:TS(e,"left","right"),y:TS(e,"top","bottom")}}function TS(e,t,n){return{min:AS(e,t),max:AS(e,n)}}function AS(e,t){return typeof e=="number"?e:e[t]||0}const wH=new WeakMap;class jH{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=dn(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:a}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const l=y=>{n&&this.snapToCursor(Ic(y).point),this.stopAnimation()},u=(y,b)=>{const{drag:w,dragPropagation:j,onDragStart:N}=this.getProps();if(w&&!j&&(this.openDragLock&&this.openDragLock(),this.openDragLock=K9(w),!this.openDragLock))return;this.latestPointerEvent=y,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Gs(k=>{let E=this.getAxisMotionValue(k).get()||0;if(na.test(E)){const{projection:S}=this.visualElement;if(S&&S.layout){const R=S.layout.layoutBox[k];R&&(E=Ln(R)*(parseFloat(E)/100))}}this.originPoint[k]=E}),N&&Ct.update(()=>N(y,b),!1,!0),Xg(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},f=(y,b)=>{this.latestPointerEvent=y,this.latestPanInfo=b;const{dragPropagation:w,dragDirectionLock:j,onDirectionLock:N,onDrag:C}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:k}=b;if(j&&this.currentDirection===null){this.currentDirection=NH(k),this.currentDirection!==null&&N&&N(this.currentDirection);return}this.updateAxis("x",b.point,k),this.updateAxis("y",b.point,k),this.visualElement.render(),C&&Ct.update(()=>C(y,b),!1,!0)},m=(y,b)=>{this.latestPointerEvent=y,this.latestPanInfo=b,this.stop(y,b),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:y}=this.getProps();(y||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new cA(t,{onSessionStart:l,onStart:u,onMove:f,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:a,contextWindow:lA(this.visualElement),element:this.visualElement.current})}stop(t,n){const a=t||this.latestPointerEvent,o=n||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!o||!a)return;const{velocity:u}=o;this.startAnimation(u);const{onDragEnd:f}=this.getProps();f&&Ct.postRender(()=>f(a,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,a){const{drag:o}=this.getProps();if(!a||!ud(t,o,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(u=pH(u,this.constraints[t],this.elastic[t])),l.set(u)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;t&&go(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&a?this.constraints=gH(a.layoutBox,t):this.constraints=!1,this.elastic=bH(n),o!==this.constraints&&!go(t)&&a&&this.constraints&&!this.hasMutatedConstraints&&Gs(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=xH(a.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!go(t))return!1;const a=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=kB(a,o.root,this.visualElement.getTransformPagePoint());let u=vH(o.layout.layoutBox,l);if(n){const f=n(jB(u));this.hasMutatedConstraints=!!f,f&&(u=RT(f))}return u}startAnimation(t){const{drag:n,dragMomentum:a,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:f}=this.getProps(),m=this.constraints||{},h=Gs(p=>{if(!ud(p,n,this.currentDirection))return;let y=m&&m[p]||{};u&&(y={min:0,max:0});const b=o?200:1e6,w=o?40:1e7,j={type:"inertia",velocity:a?t[p]:0,bounceStiffness:b,bounceDamping:w,timeConstant:750,restDelta:1,restSpeed:10,...l,...y};return this.startAxisValueAnimation(p,j)});return Promise.all(h).then(f)}startAxisValueAnimation(t,n){const a=this.getAxisMotionValue(t);return Xg(this.visualElement,t),a.start(hy(t,a,0,n,this.visualElement,!1))}stopAnimation(){Gs(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,a=this.visualElement.getProps(),o=a[n];return o||this.visualElement.getValue(t,(a.initial?a.initial[t]:void 0)||0)}snapToCursor(t){Gs(n=>{const{drag:a}=this.getProps();if(!ud(n,a,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(n);if(o&&o.layout){const{min:u,max:f}=o.layout.layoutBox[n],m=l.get()||0;l.set(t[n]-Vt(u,f,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:a}=this.visualElement;if(!go(n)||!a||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Gs(u=>{const f=this.getAxisMotionValue(u);if(f&&this.constraints!==!1){const m=f.get();o[u]=yH({min:m,max:m},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.constraints=!1,this.resolveConstraints(),Gs(u=>{if(!ud(u,t,null))return;const f=this.getAxisMotionValue(u),{min:m,max:h}=this.constraints[u];f.set(Vt(m,h,o[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;wH.set(this.visualElement,this);const t=this.visualElement.current,n=lc(t,"pointerdown",h=>{const{drag:p,dragListener:y=!0}=this.getProps(),b=h.target,w=b!==t&&nB(b);p&&y&&!w&&this.start(h)});let a;const o=()=>{const{dragConstraints:h}=this.getProps();go(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),a||(a=SH(t,h.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,u=l.addEventListener("measure",o);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),Ct.read(o);const f=Sc(window,"resize",()=>this.scalePositionWithinConstraints()),m=l.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(Gs(y=>{const b=this.getAxisMotionValue(y);b&&(this.originPoint[y]+=h[y].translate,b.set(b.get()+h[y].translate))}),this.visualElement.render())}));return()=>{f(),n(),u(),m&&m(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:a=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=iv,dragMomentum:f=!0}=t;return{...t,drag:n,dragDirectionLock:a,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:f}}}function MS(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function SH(e,t,n){const a=Pj(e,MS(n)),o=Pj(t,MS(n));return()=>{a(),o()}}function ud(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function NH(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class kH extends Mr{constructor(t){super(t),this.removeGroupControls=ks,this.removeListeners=ks,this.controls=new jH(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ks}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Fp=e=>(t,n)=>{e&&Ct.update(()=>e(t,n),!1,!0)};class EH extends Mr{constructor(){super(...arguments),this.removePointerDownListener=ks}onPointerDown(t){this.session=new cA(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lA(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:a,onPanEnd:o}=this.node.getProps();return{onSessionStart:Fp(t),onStart:Fp(n),onMove:Fp(a),onEnd:(l,u)=>{delete this.session,o&&Ct.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=lc(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Zp=!1;class CH extends v.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:a,layoutId:o}=this.props,{projection:l}=t;l&&(n.group&&n.group.add(l),a&&a.register&&o&&a.register(l),Zp&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Ud.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:a,drag:o,isPresent:l}=this.props,{projection:u}=a;return u&&(u.isPresent=l,t.layoutDependency!==n&&u.setOptions({...u.options,layoutDependency:n}),Zp=!0,o||t.layoutDependency!==n||n===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||Ct.postRender(()=>{const f=u.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),vy.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:a}=this.props,{projection:o}=t;Zp=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),a&&a.deregister&&a.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function dA(e){const[t,n]=QT(),a=v.useContext(Kv);return i.jsx(CH,{...e,layoutGroup:a,switchLayoutGroup:v.useContext(iA),isPresent:t,safeToRemove:n})}const TH={pan:{Feature:EH},drag:{Feature:kH,ProjectionNode:JT,MeasureLayout:dA}};function RS(e,t,n){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,l=a[o];l&&Ct.postRender(()=>l(t,Ic(t)))}class AH extends Mr{mount(){const{current:t}=this.node;t&&(this.unmount=J9(t,(n,a)=>(RS(this.node,a,"Start"),o=>RS(this.node,o,"End"))))}unmount(){}}class MH extends Mr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Rc(Sc(this.node.current,"focus",()=>this.onFocus()),Sc(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function _S(e,t,n){const{props:a}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),l=a[o];l&&Ct.postRender(()=>l(t,Ic(t)))}class RH extends Mr{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:a}=this.node.props;this.unmount=aB(t,(o,l)=>(_S(this.node,l,"Start"),(u,{success:f})=>_S(this.node,u,f?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:a?.tap===!1})}unmount(){}}const ov=new WeakMap,qp=new WeakMap,_H=e=>{const t=ov.get(e.target);t&&t(e)},OH=e=>{e.forEach(_H)};function IH({root:e,...t}){const n=e||document;qp.has(n)||qp.set(n,{});const a=qp.get(n),o=JSON.stringify(t);return a[o]||(a[o]=new IntersectionObserver(OH,{root:e,...t})),a[o]}function DH(e,t,n){const a=IH(t);return ov.set(e,n),a.observe(e),()=>{ov.delete(e),a.unobserve(e)}}const zH={some:0,all:1};class PH extends Mr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:a,amount:o="some",once:l}=t,u={root:n?n.current:void 0,rootMargin:a,threshold:typeof o=="number"?o:zH[o]},f=m=>{const{isIntersecting:h}=m;if(this.isInView===h||(this.isInView=h,l&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:p,onViewportLeave:y}=this.node.getProps(),b=h?p:y;b&&b(m)};return DH(this.node.current,u,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(LH(t,n))&&this.startObserver()}unmount(){}}function LH({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const $H={inView:{Feature:PH},tap:{Feature:RH},focus:{Feature:MH},hover:{Feature:AH}},UH={layout:{ProjectionNode:JT,MeasureLayout:dA}},BH={...uH,...$H,...TH,...UH},VH=rH(BH,iH);function HH(e){return"type"in e&&e.type==="separator"}function FH(e){return"type"in e&&e.type==="group"}function OS({item:e}){return i.jsxs(yL,{disabled:e.disabled,onClick:e.action,className:"flex items-center gap-3 px-3 py-1.5 text-[12px] font-mono text-neutral-300 outline-none select-none data-[highlighted]:bg-neutral-700/50 data-[highlighted]:text-white data-[disabled]:opacity-40 data-[disabled]:pointer-events-none cursor-default",children:[e.icon&&i.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-neutral-400",children:e.icon}),i.jsx("span",{className:"flex-1",children:e.label}),e.shortcut&&i.jsx("span",{className:"text-neutral-400 text-[10px] ml-4 tracking-wider",children:e.shortcut})]})}const fA=xo.forwardRef(({items:e},t)=>i.jsx(VH.div,{ref:t,initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.1,ease:"easeOut"},children:i.jsx(m8,{className:"bg-neutral-900/95 backdrop-blur-xl border border-neutral-700/60 rounded-lg shadow-2xl py-1 min-w-[180px] z-[200] outline-none",children:e.map((n,a)=>HH(n)?i.jsx(Z8,{className:"h-px bg-neutral-700/50 my-1"},`sep-${a}`):FH(n)?i.jsxs(gL,{children:[i.jsx(vL,{className:"px-3 py-1 text-[10px] font-mono uppercase tracking-widest text-neutral-400",children:n.label}),n.items.map(o=>i.jsx(OS,{item:o},o.id))]},`grp-${a}`):i.jsx(OS,{item:n},n.id))})}));fA.displayName="PopupContent";function ZH({items:e,children:t}){return e.length===0?i.jsx(i.Fragment,{children:t}):i.jsxs(q8,{children:[i.jsx(W8,{render:i.jsx("div",{style:{display:"contents"}}),children:t}),i.jsx(g8,{children:i.jsx(A8,{className:"z-[200]",sideOffset:4,children:i.jsx(IV,{children:i.jsx(fA,{items:e})})})})]})}const IS=()=>{},qH={x:0,y:0},WH=({children:e,hud:t,mode:n="canvas",panOffset:a=qH,scale:o=1,onPan:l=IS,onZoom:u=IS,onPanStart:f,onPanEnd:m,isTransitioning:h=!1,onViewportChange:p,onCanvasClick:y,canvasProps:b,zoomSensitivity:w,zoomControlsRightOffset:j,canvasContextMenuItems:N})=>{const C=v.useRef(null),k=v.useRef(o);k.current=o;const E=v.useRef(u);E.current=u;const S=v.useRef(l);S.current=l;const R=v.useRef(f);R.current=f;const A=v.useRef(m);A.current=m;const M=v.useRef(w);M.current=w;const[D,U]=v.useState(!1),F=v.useRef(!1),[P,_]=v.useState(!1),z=v.useRef(!1),B=v.useRef({x:0,y:0}),V=v.useRef(L=>{const H=L.target||document.activeElement;if(!H)return!1;const $=H.tagName;return!!($==="INPUT"||$==="TEXTAREA"||H.isContentEditable||H.closest?.(".xterm"))});v.useEffect(()=>{if(n!=="canvas")return;const L=G=>{G.key!==" "||G.repeat||V.current(G)||h||(G.preventDefault(),F.current=!0,U(!0))},H=G=>{G.key===" "&&F.current&&(F.current=!1,U(!1),z.current&&(z.current=!1,_(!1),A.current?.()))},$=()=>{F.current&&(F.current=!1,U(!1),z.current&&(z.current=!1,_(!1),A.current?.()))};return window.addEventListener("keydown",L),window.addEventListener("keyup",H),window.addEventListener("blur",$),()=>{window.removeEventListener("keydown",L),window.removeEventListener("keyup",H),window.removeEventListener("blur",$)}},[n,h]);const K=v.useCallback(L=>{L.button===0&&(L.preventDefault(),z.current=!0,_(!0),B.current={x:L.clientX,y:L.clientY},R.current?.())},[]);return v.useEffect(()=>{if(!D)return;const L=$=>{if(!z.current)return;const G=($.clientX-B.current.x)/k.current,X=($.clientY-B.current.y)/k.current;B.current={x:$.clientX,y:$.clientY},S.current({x:G,y:X})},H=()=>{z.current&&(z.current=!1,_(!1),A.current?.())};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",H),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",H)}},[D]),v.useEffect(()=>{if(n!=="canvas")return;const L=H=>{if(H.ctrlKey||H.metaKey){H.preventDefault();const $=k.current,G=-H.deltaY*.001*(M.current??1),X=Math.min(Math.max(.2,$+G),3);k.current=X,E.current(X)}};return window.addEventListener("wheel",L,{passive:!1}),()=>window.removeEventListener("wheel",L)},[n]),v.useEffect(()=>{if(!p)return;let L=null;const H=()=>{L&&cancelAnimationFrame(L),L=requestAnimationFrame(()=>{p({width:window.innerWidth,height:window.innerHeight})})};return H(),window.addEventListener("resize",H),()=>{window.removeEventListener("resize",H),L&&cancelAnimationFrame(L)}},[p]),n==="panel"?i.jsxs("div",{ref:C,className:"fixed inset-0 bg-black text-neutral-200 overflow-hidden font-sans select-none z-0",children:[i.jsx("div",{className:"absolute inset-0 z-10 overflow-auto frame-scrollbar",children:e}),i.jsx("div",{className:"fixed inset-0 z-50 pointer-events-none overflow-hidden",children:t})]}):i.jsxs("div",{ref:C,className:"fixed inset-0 bg-black text-neutral-200 overflow-hidden font-sans select-none z-0",children:[i.jsx(ZH,{items:N??[],children:i.jsx(iP,{panOffset:a,scale:o,onPan:l,onPanStart:f,onPanEnd:m,isPanLocked:h,onClick:y,showGuides:b?.showGuides,onGuidesChange:b?.onGuidesChange,gridOpacity:b?.gridOpacity})}),i.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:"50%",top:"50%",zoom:o},children:i.jsx("div",{style:{position:"absolute",left:a.x,top:a.y},children:e})}),D&&i.jsx("div",{className:`fixed inset-0 z-20 ${P?"cursor-grabbing":"cursor-grab"}`,onMouseDown:K}),i.jsx("div",{className:"fixed bottom-[36px] z-30",style:{right:(j??280)+16},children:i.jsx(oP,{scale:o,onZoom:L=>u(L)})}),i.jsx("div",{className:"fixed inset-0 z-50 pointer-events-none overflow-hidden",children:t})]})},io=4e3,YH=xo.forwardRef(({pan:e,zoom:t,viewportSize:n,height:a,onClick:o,children:l},u)=>{const[f,m]=xo.useState(0),h=v.useRef(null),p=xo.useCallback(E=>{h.current=E,typeof u=="function"?u(E):u&&(u.current=E)},[u]);xo.useEffect(()=>{const E=h.current;if(!E)return;const S=new ResizeObserver(([R])=>m(R.contentRect.width));return S.observe(E),()=>S.disconnect()},[]);const y=f||260,b=n.width/t/io*y,w=n.height/t/io*a,j=(-e.x+io/2)/io*y,N=(-e.y+io/2)/io*a,C=j-b/2,k=N-w/2;return i.jsxs("div",{ref:p,className:"relative cursor-crosshair overflow-hidden",style:{height:`${a}px`},onClick:o,children:[i.jsx("div",{className:"absolute inset-0 opacity-30",style:{backgroundImage:"radial-gradient(circle, #555 0.5px, transparent 0.5px)",backgroundSize:"14px 14px"}}),i.jsx("div",{className:"absolute top-1/2 left-0 right-0 h-px bg-neutral-600/40"}),i.jsx("div",{className:"absolute left-1/2 top-0 bottom-0 w-px bg-neutral-600/40"}),i.jsxs("div",{className:"absolute border border-emerald-500/50 bg-emerald-500/5 rounded-[1px] transition-all duration-75 ease-out",style:{left:`${C}px`,top:`${k}px`,width:`${Math.max(b,4)}px`,height:`${Math.max(w,4)}px`},children:[i.jsx("div",{className:"absolute -top-[1px] -left-[1px] w-[3px] h-[3px] bg-emerald-400 rounded-full"}),i.jsx("div",{className:"absolute -top-[1px] -right-[1px] w-[3px] h-[3px] bg-emerald-400 rounded-full"}),i.jsx("div",{className:"absolute -bottom-[1px] -left-[1px] w-[3px] h-[3px] bg-emerald-400 rounded-full"}),i.jsx("div",{className:"absolute -bottom-[1px] -right-[1px] w-[3px] h-[3px] bg-emerald-400 rounded-full"})]}),l]})});YH.displayName="MinimapCanvas";const GH=({title:e,subtitle:t,center:n,actions:a,onTitleClick:o,search:l})=>{const{dragRegionProps:u,onInteractiveMouseDown:f}=Rf(),{navTotalHeight:m}=Ov(),h=l&&l.value&&l.value.length>0;return i.jsx("div",{"data-frame-panel":"navigation",className:"fixed top-0 left-0 right-0 z-50 pointer-events-auto",...u,children:i.jsxs("div",{className:"bg-neutral-950/95 backdrop-blur-xl border-b border-neutral-700/80 shadow-[0_4px_30px_rgba(0,0,0,0.5)] flex items-end px-4",style:{height:m},children:[i.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/8 to-transparent"}),i.jsxs("div",{className:"absolute left-4 bottom-0 h-12 z-10 flex items-center gap-3 select-none",onMouseDown:f,children:[t&&i.jsx("span",{className:"text-neutral-400 flex items-center",children:t}),i.jsx("button",{onClick:o,className:"text-[22px] font-bold text-white tracking-[0.25em] font-mono leading-none bg-transparent border-none cursor-pointer",children:e})]}),n&&i.jsx("div",{className:"flex-1 flex justify-center h-12 items-center",onMouseDown:f,children:n}),i.jsxs("div",{className:"absolute right-4 bottom-0 h-12 z-10 flex items-center gap-3",onMouseDown:f,children:[a,l&&i.jsxs("div",{className:"relative w-[220px] bg-white/[0.06] border border-neutral-600/50 rounded px-2.5 hover:border-neutral-500/60 focus-within:border-neutral-400/50 focus-within:bg-white/[0.08] transition-all duration-200",children:[i.jsx(Rv,{size:11,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-neutral-400"}),i.jsx("input",{type:"text",value:l.value,onChange:p=>l.onChange(p.target.value),placeholder:l.placeholder??"Search...",className:`
130
- w-full h-7 pl-5 pr-6 bg-transparent text-[12px] font-mono tracking-wider
131
- placeholder:text-neutral-400 text-neutral-200
132
- focus:outline-none transition-all duration-200
133
- ${h?"text-emerald-400":""}
134
- `}),h&&i.jsx("button",{onClick:()=>l.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-neutral-400 hover:text-white transition-colors",children:i.jsx(hE,{size:12})})]})]})]})})},DS=({side:e,title:t,icon:n,isCollapsed:a=!1,onToggleCollapse:o,headerActions:l,footer:u,style:f,width:m,onResizeStart:h,children:p})=>{if(a){const k=e==="left"?k3:A3;return i.jsx("button",{onClick:o,className:`fixed top-1/2 -translate-y-1/2 z-40 ${e==="left"?"left-3":"right-3"} p-2.5 rounded bg-neutral-950/95 border border-neutral-700/80 hover:border-emerald-500/60 backdrop-blur-xl shadow-[0_0_20px_rgba(0,0,0,0.5),inset_0_1px_0_rgba(255,255,255,0.08)] hover:shadow-[0_0_30px_rgba(16,185,129,0.2),inset_0_1px_0_rgba(255,255,255,0.1)] transition-all duration-200 group pointer-events-auto`,title:`Expand ${t||"panel"}`,children:i.jsx(k,{size:14,className:"text-neutral-400 group-hover:text-emerald-400 transition-colors",strokeWidth:1.5})})}const y=e==="left"?S3:C3,{panelTopOffset:b}=Ov(),N=`bg-neutral-950/95 backdrop-blur-xl border border-neutral-700/80 shadow-[0_0_30px_rgba(0,0,0,0.8),inset_0_1px_0_rgba(255,255,255,0.08)] fixed bottom-[28px] z-40 rounded-none border-t-0 overflow-hidden ${e==="left"?"border-l-0 border-r-0":"border-r-0 border-l-0"}`,C={...f,position:"fixed",top:b,left:e==="left"?0:void 0,right:e==="right"?0:void 0,width:`${m||280}px`};return i.jsxs("div",{"data-frame-panel":e==="left"?"manifest":"inspector",className:`${N} pointer-events-none select-none font-mono text-[11px] flex flex-col`,style:C,children:[h&&i.jsxs("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-[7px] cursor-ew-resize z-50 pointer-events-auto group flex items-center justify-center`,onMouseDown:h,children:[i.jsx("div",{className:`absolute top-0 bottom-0 ${e==="left"?"right-0":"left-0"} w-px bg-neutral-700/80 group-hover:bg-emerald-500/50 transition-colors`}),i.jsxs("div",{className:"flex flex-col gap-[3px] opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"}),i.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"}),i.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"})]})]}),!h&&i.jsx("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-px bg-neutral-700/80`}),i.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/12 to-transparent z-10"}),i.jsxs("div",{className:"pointer-events-auto flex-1 flex flex-col overflow-hidden",children:[t&&i.jsx("div",{className:"shrink-0 p-4 border-b border-neutral-700/50",children:i.jsxs("div",{className:"flex items-center justify-between text-neutral-200 text-[12px]",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[n&&i.jsx("span",{className:"text-neutral-400",children:n}),i.jsx("span",{className:"tracking-widest font-bold uppercase",children:t})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[l,o&&i.jsx("button",{onClick:o,className:"p-1 hover:bg-white/10 rounded transition-colors text-neutral-400 hover:text-white",title:"Collapse panel",children:i.jsx(y,{size:12})})]})]})}),i.jsx("div",{className:"flex-1 overflow-y-auto frame-scrollbar",children:p}),u&&i.jsx("div",{className:"shrink-0",children:u})]})]})},KH={emerald:{dot:"bg-emerald-500",ping:"bg-emerald-400",text:"text-emerald-500"},amber:{dot:"bg-amber-500",ping:"bg-amber-400",text:"text-amber-500"},red:{dot:"bg-red-500",ping:"bg-red-400",text:"text-red-500"},neutral:{dot:"bg-neutral-500",ping:"bg-neutral-400",text:"text-neutral-400"}},XH=({left:e,viewport:t,right:n,isMinimapCollapsed:a=!1,onExpandMinimap:o,status:l={label:"READY",color:"emerald"},onToggleTerminal:u,isTerminalOpen:f=!1})=>{const[m,h]=v.useState(new Date),[p,y]=v.useState(!1),[b,w]=v.useState(!1);v.useEffect(()=>{w(!0);const C=setInterval(()=>h(new Date),1e3);return()=>clearInterval(C)},[]);const j=KH[l.color],N=async()=>{if(!t)return;const C=`PAN: ${t.pan.x.toFixed(0)},${t.pan.y.toFixed(0)} | SIZE: ${t.canvasSize?.w??1024}x${t.canvasSize?.h??1024} | ZOOM: ${(t.zoom*100).toFixed(0)}%`;try{await navigator.clipboard.writeText(C),y(!0),setTimeout(()=>y(!1),1500)}catch{}};return i.jsxs("div",{"data-frame-panel":"status-bar",className:`${rP.statusBar} h-7 flex items-center justify-between px-3 select-none font-mono text-[12px] text-neutral-200 pointer-events-auto`,children:[i.jsxs("div",{className:"flex items-center gap-4",children:[a&&o&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-white/5 border border-neutral-800 hover:bg-white/10 transition-colors text-neutral-400 hover:text-white",title:"Expand minimap",children:[i.jsx(m3,{size:10}),i.jsx("span",{className:"text-[11px] font-bold",children:"MAP"}),i.jsx(dE,{size:8,className:"opacity-60"})]}),i.jsx("div",{className:"h-3 w-px bg-neutral-700"})]}),i.jsxs("div",{className:`flex items-center gap-2 ${j.text}`,children:[i.jsxs("div",{className:"relative flex h-2 w-2",children:[i.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${j.ping} opacity-75`}),i.jsx("span",{className:`relative inline-flex rounded-full h-2 w-2 ${j.dot}`})]}),i.jsx("span",{className:"font-bold tracking-wider",children:l.label})]}),e&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-3 w-px bg-neutral-700"}),e]})]}),t&&i.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 flex items-center gap-3 opacity-70 hover:opacity-100 transition-opacity",children:i.jsxs("button",{onClick:N,className:"flex items-center gap-3 hover:text-neutral-200 transition-colors cursor-pointer",title:"Copy viewport data",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-neutral-400",children:"PAN:"}),i.jsxs("span",{className:`tabular-nums ${p?"text-emerald-500":""}`,children:[t.pan.x.toFixed(0),",",t.pan.y.toFixed(0)]})]}),i.jsx("div",{className:"h-3 w-px bg-neutral-700"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-neutral-400",children:"SIZE:"}),i.jsxs("span",{className:`tabular-nums ${p?"text-emerald-500":""}`,children:[t.canvasSize?.w??1024,"x",t.canvasSize?.h??1024]})]}),i.jsx("div",{className:"h-3 w-px bg-neutral-700"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-neutral-400",children:"ZOOM:"}),i.jsxs("span",{className:`tabular-nums ${p?"text-emerald-500":""}`,children:[(t.zoom*100).toFixed(0),"%"]})]})]})}),i.jsxs("div",{className:"flex items-center gap-4",children:[n,n&&i.jsx("div",{className:"h-3 w-px bg-neutral-700"}),u&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:u,className:`flex items-center gap-1.5 px-2 py-1 rounded transition-all ${f?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/30":"text-neutral-400 hover:text-neutral-100 hover:bg-white/5 border border-transparent"}`,title:"Toggle Terminal (Ctrl+`)",children:[i.jsxs("span",{className:"text-[12px]",children:[">","_"]}),i.jsx("span",{className:"uppercase text-[11px] font-semibold tracking-wider",children:"Console"})]}),i.jsx("div",{className:"h-3 w-px bg-neutral-700"})]}),i.jsxs("div",{className:"flex items-center gap-1.5 text-neutral-200 min-w-[60px] justify-end",children:[i.jsx(c3,{size:11,className:"text-neutral-400"}),i.jsx("span",{children:b?m.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"--:--"})]})]})]})},JH=({onOpenCommandPalette:e,extraControls:t})=>i.jsx("div",{className:"select-none font-mono text-[12px] border-t border-neutral-700/50",children:i.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[i.jsxs("button",{onClick:e,className:"flex items-center gap-1.5 text-neutral-400 hover:text-white transition-colors",children:[i.jsx(Rv,{size:10}),i.jsx("span",{className:"tracking-widest font-bold uppercase",children:"Command Palette"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[t,i.jsx("kbd",{className:"text-[11px] text-neutral-400 font-mono",children:"⌘K"})]})]})}),{statusBarHeight:dd}=_f.layout,zS=120,QH=({isOpen:e,onClose:t,onToggleMaximize:n,isMaximized:a=!1,height:o=320,onHeightChange:l,title:u,headerActions:f,children:m})=>{const h=v.useRef(!1),p=v.useRef(null),y=v.useCallback(w=>{if(!l)return;w.preventDefault(),h.current=!0;const j=w.clientY,N=o;p.current&&(p.current.style.transition="none");const C=E=>{const S=j-E.clientY,R=window.innerHeight-dd,A=Math.max(zS,Math.min(R,N+S));p.current&&(p.current.style.height=`${A}px`)},k=E=>{h.current=!1,document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",k),p.current&&(p.current.style.transition="");const S=j-E.clientY,R=window.innerHeight-dd;l(Math.max(zS,Math.min(R,N+S)))};document.addEventListener("mousemove",C),document.addEventListener("mouseup",k)},[o,l]),b=a?`calc(100vh - ${dd}px)`:`${o}px`;return i.jsxs("div",{ref:p,className:`
135
- fixed left-0 right-0 shadow-[0_-10px_40px_rgba(0,0,0,0.8)] flex flex-col border-t border-neutral-700
136
- bg-neutral-950/95 backdrop-blur-xl
137
- ${e?"translate-y-0 opacity-100 pointer-events-auto":"translate-y-full opacity-0 pointer-events-none"}
138
- transition-all duration-300 ease-in-out
139
- `,style:{bottom:dd,height:b,zIndex:_f.zIndex.drawer},children:[i.jsxs("div",{className:"h-9 bg-neutral-900/70 border-b border-neutral-700 flex items-center justify-between px-3 shrink-0 select-none backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[u||i.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[i.jsx($3,{size:14}),i.jsx("span",{className:"text-xs font-bold tracking-widest font-mono",children:"TERMINAL"})]}),f]}),i.jsx("div",{className:"flex-1 flex items-center justify-center h-full cursor-ns-resize text-neutral-500 hover:text-neutral-300 transition-colors group",title:"Drag to Resize",onMouseDown:y,children:i.jsx("div",{className:"w-16 h-1 rounded-full bg-neutral-700 group-hover:bg-neutral-500 transition-colors"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:n,className:"p-1.5 rounded hover:bg-neutral-700 text-neutral-400 hover:text-white transition-colors",title:a?"Restore":"Maximize",children:a?i.jsx(x3,{size:14}):i.jsx(dE,{size:14})}),i.jsx("button",{onClick:t,className:"p-1.5 rounded hover:bg-red-900/20 text-neutral-400 hover:text-red-400 transition-colors",title:"Close",children:i.jsx(hE,{size:14})})]})]}),i.jsx("div",{className:"flex-1 relative overflow-hidden flex flex-col bg-transparent",children:m})]})},e7=({isOpen:e,onClose:t,commands:n})=>{const[a,o]=v.useState(""),[l,u]=v.useState(0),f=v.useRef(null),m=v.useRef(null),h=n.filter(y=>y.label.toLowerCase().includes(a.toLowerCase()));v.useEffect(()=>{e&&(setTimeout(()=>f.current?.focus(),10),o(""),u(0))},[e]),v.useEffect(()=>{u(0)},[a]),v.useEffect(()=>{m.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[l]);const p=y=>{y.key==="ArrowDown"?(y.preventDefault(),u(b=>(b+1)%h.length)):y.key==="ArrowUp"?(y.preventDefault(),u(b=>(b-1+h.length)%h.length)):y.key==="Enter"?(y.preventDefault(),h[l]&&(h[l].action(),t())):y.key==="Escape"&&t()};return e?i.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh] bg-black/60 backdrop-blur-[2px] pointer-events-auto",onClick:t,children:i.jsxs("div",{className:"w-[640px] max-w-[90vw] bg-[#161616] border border-neutral-700 shadow-2xl rounded-lg overflow-hidden flex flex-col animate-in fade-in zoom-in-95 duration-100",onClick:y=>y.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center px-4 py-3 border-b border-neutral-700 gap-3",children:[i.jsx(Rv,{className:"text-neutral-400",size:18}),i.jsx("input",{ref:f,className:"flex-1 bg-transparent border-none outline-none text-neutral-100 placeholder-neutral-500 font-mono text-sm",placeholder:"Type a command or search...",value:a,onChange:y=>o(y.target.value),onKeyDown:p,autoFocus:!0}),i.jsx("div",{className:"px-1.5 py-0.5 rounded bg-neutral-700 border border-neutral-700 text-[12px] text-neutral-200 font-mono",children:"ESC"})]}),i.jsxs("div",{className:"max-h-[300px] overflow-y-auto py-2 relative",children:[i.jsx("div",{className:"pb-2",children:h.length===0?i.jsx("div",{className:"px-4 py-8 text-center text-neutral-400 text-xs font-mono",children:"No matching commands"}):h.map((y,b)=>i.jsxs("div",{ref:b===l?m:null,className:`px-4 py-2.5 flex items-center gap-3 cursor-pointer transition-colors ${b===l?"bg-emerald-900/20 border-l-2 border-emerald-500":"border-l-2 border-transparent hover:bg-white/5"}`,onClick:()=>{y.action(),t()},onMouseEnter:()=>u(b),children:[y.icon&&i.jsx("div",{className:`text-neutral-300 ${b===l?"text-emerald-400":""}`,children:y.icon}),i.jsx("div",{className:"flex-1",children:i.jsx("div",{className:`text-sm ${b===l?"text-emerald-100":"text-neutral-200"}`,children:y.label})}),y.shortcut&&i.jsx("div",{className:"text-[12px] font-mono text-neutral-300 bg-neutral-800 px-1.5 py-0.5 rounded border border-neutral-700",children:y.shortcut}),b===l&&i.jsx(d3,{size:14,className:"text-emerald-500 ml-2"})]},y.id))}),h.length>6&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-[#111] to-transparent pointer-events-none"})]}),i.jsxs("div",{className:"px-4 py-1.5 bg-neutral-800/90 backdrop-blur-sm border-t border-neutral-700 flex justify-between items-center text-[12px] text-neutral-300 font-mono relative z-10",children:[i.jsx("span",{children:"Command Palette"}),i.jsxs("span",{children:[h.length," matches"]})]})]})}):null},Wp=new Map;function Yp(e){if(e)return JSON.parse(e)}function t7(e){return e?JSON.stringify([...new Headers(e).entries()].sort(([t],[n])=>t.localeCompare(n))):""}function n7(e,t){return`${(t?.method??"GET").toUpperCase()}:${e}:${t7(t?.headers)}`}async function PS(e,t){const n=await fetch(e,{...t,headers:{...t?.headers??{},...t?.body?{"content-type":"application/json"}:{}}});if(!n.ok){const a=await n.text();let o=a||`HTTP ${n.status}`;try{const l=JSON.parse(a);l?.error&&(o=l.error)}catch{}throw new Error(o)}return await n.text()}async function Ce(e,t){if(!((t?.method??"GET").toUpperCase()==="GET"&&!t?.body))return Yp(await PS(e,t));const o=n7(e,t),l=Wp.get(o);if(l)return Yp(await l);const u=PS(e,t);Wp.set(o,u);try{return Yp(await u)}finally{Wp.delete(o)}}function Dc(){return!(typeof window>"u"||new URLSearchParams(window.location.search).has("no-ops"))}function s7(e){switch(e){case"profile":case"observe":case"message":return e;default:return}}function a7(e){const t=new URL(e.toString()),n=t.pathname.replace(/^\/+/,"").split("/").filter(Boolean),a=t.searchParams.get("compose")==="ask"?"ask":void 0,o=s7(t.searchParams.get("tab"));if(n[0]==="agent"&&n[1])return{view:"agent-info",conversationId:decodeURIComponent(n[1])};if(n[0]==="agents"&&n[1]&&n[2]==="c"&&n[3])return{view:"agents",agentId:decodeURIComponent(n[1]),conversationId:decodeURIComponent(n[3]),tab:o??"message"};if(n[0]==="agents"&&n[1]){const l=decodeURIComponent(n[1]);return o==="message"?{view:"agents",agentId:l,conversationId:Jn(l),tab:"message"}:{view:"agents",agentId:l,...o?{tab:o}:{}}}if(n[0]==="agents")return{view:"agents"};if(n[0]==="fleet")return{view:"fleet"};if(n[0]==="c"&&n[1])return{view:"conversation",conversationId:decodeURIComponent(n[1]),...a?{composeMode:a}:{}};if(n[0]==="sessions"&&n[1])return{view:"sessions",sessionId:decodeURIComponent(n[1])};if(n[0]==="sessions")return{view:"sessions"};if(n[0]==="mesh")return{view:"mesh"};if(n[0]==="activity")return{view:"activity"};if(n[0]==="work"&&n[1])return{view:"work",workId:decodeURIComponent(n[1])};if(n[0]==="settings")return{view:"settings"};if(n[0]==="terminal")return{view:"terminal",...n[1]?{agentId:decodeURIComponent(n[1])}:{}};if(n[0]==="ops"){if(!Dc())return{view:"inbox"};const l=n[1];return l==="conductor"||l==="warroom"||l==="plan"||l==="mission"||l==="agents"||l==="tail"||l==="atop"?{view:"ops",mode:l}:{view:"ops"}}return{view:"inbox"}}function Gp(){return a7(window.location.href)}function r7(e){switch(e.view){case"inbox":return"/";case"conversation":{const t=new URLSearchParams;e.composeMode==="ask"&&t.set("compose","ask");const n=t.toString();return`/c/${encodeURIComponent(e.conversationId)}${n?`?${n}`:""}`}case"agent-info":return`/agent/${encodeURIComponent(e.conversationId)}`;case"agents":{const t=new URLSearchParams,n=!!e.agentId&&!!e.conversationId&&e.conversationId===Jn(e.agentId),a=n?"profile":e.conversationId?"message":"profile";n?t.set("tab","message"):e.tab&&e.tab!==a&&t.set("tab",e.tab);const o=t.toString();return`${e.agentId?n?`/agents/${encodeURIComponent(e.agentId)}`:e.conversationId?`/agents/${encodeURIComponent(e.agentId)}/c/${encodeURIComponent(e.conversationId)}`:`/agents/${encodeURIComponent(e.agentId)}`:"/agents"}${o?`?${o}`:""}`}case"fleet":return"/fleet";case"sessions":return e.sessionId?`/sessions/${encodeURIComponent(e.sessionId)}`:"/sessions";case"mesh":return"/mesh";case"activity":return"/activity";case"work":return`/work/${encodeURIComponent(e.workId)}`;case"settings":return"/settings";case"ops":return e.mode&&e.mode!=="plan"?`/ops/${e.mode}`:"/ops";case"terminal":return e.agentId?`/terminal/${encodeURIComponent(e.agentId)}`:"/terminal"}}function Kp(e){switch(e.view){case"conversation":return`conv:${e.conversationId}`;case"agent-info":return`agent-info:${e.conversationId}`;case"agents":return e.conversationId?`agent-conv:${e.conversationId}:${e.tab??"message"}`:e.agentId?`agent:${e.agentId}:${e.tab??"profile"}`:"agents";case"sessions":return e.sessionId?`session:${e.sessionId}`:"sessions";case"work":return`work:${e.workId}`;case"ops":return`ops:${e.mode??"plan"}`;default:return e.view}}function i7(){const[e,t]=v.useState(Gp),n=v.useRef({});v.useEffect(()=>{const o=()=>{const l=Gp();t(l),requestAnimationFrame(()=>{window.scrollTo(0,n.current[Kp(l)]??0)})};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[]);const a=v.useCallback(o=>{const l=o.view==="ops"&&!Dc()?{view:"inbox"}:o;n.current[Kp(Gp())]=window.scrollY,window.history.pushState(null,"",r7(l)),t(l),requestAnimationFrame(()=>{window.scrollTo(0,n.current[Kp(l)]??0)})},[]);return{route:e,navigate:a}}function hA(e){const t=e.match(/^dm\.operator\.(.+)$/);return t?t[1]:null}function Jn(e){return`dm.operator.${e}`}const o7=["hello","node.upserted","actor.registered","agent.registered","agent.endpoint.upserted","conversation.upserted","binding.upserted","message.posted","invocation.requested","flight.updated","delivery.planned","delivery.attempted","delivery.state.changed","collaboration.upserted","collaboration.event.appended","scout.dispatched"],oi=new Set;let cc=null,Ta=null,bf=0;function l7(e){try{return JSON.parse(e)}catch{return{kind:"unknown"}}}function mA(){cc?.close(),cc=null}function c7(){if(Ta||oi.size===0)return;bf++;const e=Math.min(3e3*2**(bf-1),6e4);Ta=setTimeout(()=>{Ta=null,oi.size>0&&pA()},e)}function u7(e){for(const t of[...oi])t(e)}function pA(){if(cc||oi.size===0)return;const e=new EventSource("/api/events");cc=e;const t=n=>{u7(l7(n.data))};e.onopen=()=>{bf=0},e.onmessage=t;for(const n of o7)e.addEventListener(n,t);e.onerror=()=>{cc===e?mA():e.close(),c7()}}function d7(e){return oi.add(e),Ta&&(clearTimeout(Ta),Ta=null),pA(),()=>{oi.delete(e),!(oi.size>0)&&(Ta&&(clearTimeout(Ta),Ta=null),bf=0,mA())}}function fn(e){const t=v.useRef(e);t.current=e,v.useEffect(()=>d7(n=>{t.current(n)}),[])}function ft(e){return e==="working"?"working":!e||e==="offline"?"offline":"available"}function gi(e){return ft(e)!=="offline"}function Vs(e){switch(ft(e)){case"working":return"Working";case"available":return"Available";default:return"Offline"}}const Wf="ranger.main.mini",f7=new Set([Wf,"ranger","@ranger"]),h7=new Set(["plan","conductor","warroom","mission","agents","tail","atop"]);function gA(e){return[e.id,e.name,e.handle??"",e.selector??"",e.role??""].map(n=>n.trim().toLowerCase()).some(n=>f7.has(n)||n==="ranger"||n.startsWith("ranger.")||n.includes(".ranger.")||n.includes(" ranger"))}function m7(e){return e.find(t=>t.id===Wf)??e.find(t=>t.handle?.toLowerCase()==="@ranger")??e.find(t=>t.selector?.toLowerCase()==="@ranger")??e.find(t=>t.role?.toLowerCase()==="ranger")??e.find(gA)??null}function p7(e){return m7(e)?.id??Wf}function g7(e){return Jn(e)}function vA(e,t=Wf){const n=e.trim().toLowerCase(),a=t.trim().toLowerCase();return n===a||n==="ranger"||n.startsWith("ranger.")||n.includes(".ranger.")}function v7(e){const t=[],n=/```(?:scout-ui|scout-ui-action|ranger-ui)\s*([\s\S]*?)```/gi;let a;for(;(a=n.exec(e))!==null;){const o=y7(a[1]??"");t.push(...o)}return t}function y7(e){const t=e.trim();if(!t)return[];try{const n=JSON.parse(t);return(Array.isArray(n)?n:[n]).map(o=>yA(o)).filter(o=>!!o)}catch{return[]}}function yA(e){if(!e||typeof e!="object")return null;const t=e,n=t.scoutUi??t.scout_ui??t.rangerUi??t.ranger_ui;if(n)return yA(n);const a=typeof t.type=="string"?t.type:typeof t.action=="string"?t.action:"",o=typeof t.reason=="string"?t.reason:void 0;if(a==="open-ranger"||a==="open_ranger"){const u=t.mode==="tell"?"tell":t.mode==="ask"?"ask":void 0;return{type:"open-ranger",...u?{mode:u}:{},...o?{reason:o}:{}}}if(a==="refresh")return{type:"refresh",...o?{reason:o}:{}};if(a!=="navigate"&&a!=="open")return null;const l=x7(t.route??t);return l?{type:"navigate",route:l,...o?{reason:o}:{}}:null}function x7(e){if(!e||typeof e!="object")return null;const t=e;switch(typeof t.view=="string"?t.view:""){case"inbox":return{view:"inbox"};case"fleet":return{view:"fleet"};case"agents":return{view:"agents",...typeof t.agentId=="string"?{agentId:t.agentId}:{},...typeof t.conversationId=="string"?{conversationId:t.conversationId}:{},...t.tab==="profile"||t.tab==="observe"||t.tab==="message"?{tab:t.tab}:{}};case"sessions":return{view:"sessions",...typeof t.sessionId=="string"?{sessionId:t.sessionId}:{}};case"mesh":return{view:"mesh"};case"activity":return{view:"activity"};case"settings":return{view:"settings"};case"terminal":return{view:"terminal",...typeof t.agentId=="string"?{agentId:t.agentId}:{}};case"work":return typeof t.workId=="string"?{view:"work",workId:t.workId}:null;case"conversation":return typeof t.conversationId=="string"?{view:"conversation",conversationId:t.conversationId,...t.composeMode==="ask"||t.composeMode==="tell"?{composeMode:t.composeMode}:{}}:null;case"ops":{const a=typeof t.mode=="string"&&h7.has(t.mode)?t.mode:void 0;return{view:"ops",...a?{mode:a}:{}}}default:return null}}const xA={current:null,setMenu:null};function Yf(){return v.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),xA.setMenu?.({position:{x:e.clientX,y:e.clientY},items:t})},[])}function b7({children:e}){const[t,n]=v.useState(null),a=v.useRef(null);xA.setMenu=n;const o=v.useCallback(()=>n(null),[]);return v.useEffect(()=>{if(!t)return;const l=()=>o(),u=m=>{m.key==="Escape"&&o()},f=()=>o();return window.addEventListener("mousedown",l,!0),window.addEventListener("keydown",u),window.addEventListener("scroll",f,!0),window.addEventListener("contextmenu",o,!0),()=>{window.removeEventListener("mousedown",l,!0),window.removeEventListener("keydown",u),window.removeEventListener("scroll",f,!0),window.removeEventListener("contextmenu",o,!0)}},[t,o]),v.useEffect(()=>{if(!t||!a.current)return;const l=a.current,u=l.getBoundingClientRect(),f=window.innerWidth,m=window.innerHeight;let h=t.position.x,p=t.position.y;h+u.width>f-8&&(h=f-u.width-8),p+u.height>m-8&&(p=m-u.height-8),h<8&&(h=8),p<8&&(p=8),l.style.left=`${h}px`,l.style.top=`${p}px`},[t]),t?i.jsxs(i.Fragment,{children:[e,i.jsx("div",{ref:a,className:"s-context-menu",style:{left:t.position.x,top:t.position.y},role:"menu",onMouseDown:l=>l.stopPropagation(),children:t.items.map((l,u)=>l.kind==="separator"?i.jsx("div",{className:"s-context-menu-sep",role:"separator"},u):i.jsxs("button",{type:"button",className:"s-context-menu-item",role:"menuitem",onClick:()=>{l.onSelect(),o()},children:[i.jsx("span",{className:"s-context-menu-label",children:l.label}),l.shortcut&&i.jsx("span",{className:"s-context-menu-shortcut",children:l.shortcut})]},u))})]}):i.jsx(i.Fragment,{children:e})}const w7=[195,125,300,45,355,210];function LS(e){return`oklch(0.80 0.14 ${e})`}function j7(e){return`oklch(0.18 0.08 ${e})`}function li({label:e,right:t}){return i.jsxs("div",{className:"s-settings-section-rule",children:[i.jsx("span",{className:"s-settings-section-label",children:e}),i.jsx("span",{className:"s-settings-section-line"}),t&&i.jsx("span",{className:"s-settings-section-right",children:t})]})}function js({label:e,hint:t,children:n}){return i.jsxs("div",{className:"s-settings-field",children:[i.jsx("label",{className:"s-settings-field-label",children:e}),n,t&&i.jsx("span",{className:"s-settings-field-hint",children:t})]})}function vo({value:e,onChange:t,mono:n}){return i.jsx("input",{className:`s-settings-input${n?" s-settings-input--mono":""}`,value:e,onChange:a=>t(a.target.value)})}function S7({value:e,onChange:t,rows:n=3}){return i.jsx("textarea",{className:"s-settings-textarea",value:e,onChange:a=>t(a.target.value),rows:n})}function N7({value:e,onChange:t,min:n,max:a,step:o=1,unit:l=""}){return i.jsxs("div",{className:"s-settings-slider-wrap",children:[i.jsx("input",{type:"range",min:n,max:a,step:o,value:e,onChange:u=>t(Number(u.target.value))}),i.jsxs("span",{className:"s-settings-slider-value",children:[e," ",l]})]})}function fd({value:e,onChange:t,options:n,stacked:a,columns:o}){return i.jsx("div",{className:a?"s-settings-option-stacked":"s-settings-option-grid",style:a?void 0:{gridTemplateColumns:`repeat(${o??n.length}, 1fr)`},children:n.map(l=>i.jsxs("button",{className:`s-settings-option-btn${e===l.id?" s-settings-option-btn--active":""}`,onClick:()=>t(l.id),children:[i.jsx("span",{className:"s-settings-option-label",children:l.label}),i.jsx("span",{className:"s-settings-option-sub",children:l.sub})]},l.id))})}function k7({profile:e,update:t}){return i.jsxs("div",{className:"s-settings-col-gap",children:[i.jsx(li,{label:"Identity",right:"visible to every agent"}),i.jsxs("div",{className:"s-settings-identity-card",children:[i.jsx("span",{className:"s-settings-identity-dot",style:{background:LS(e.hue),color:j7(e.hue)},children:(e.name||"?")[0].toUpperCase()}),i.jsxs("div",{style:{flex:1},children:[i.jsx("div",{className:"s-settings-identity-name",children:e.name||"Unnamed"}),i.jsxs("div",{className:"s-settings-identity-meta",children:[e.handle||"@you"," · ",e.pronouns||"—"," · operator"]})]}),i.jsxs("div",{className:"s-settings-hue-wrap",children:[i.jsx("span",{className:"s-settings-field-label",children:"Identity hue"}),i.jsx("div",{className:"s-settings-hue-row",children:w7.map(n=>i.jsx("button",{onClick:()=>t({hue:n}),className:`s-settings-hue-dot${e.hue===n?" s-settings-hue-dot--active":""}`,style:{background:LS(n)}},n))})]})]}),i.jsx(js,{label:"Display name",hint:"Shown when agents address you.",children:i.jsx(vo,{value:e.name,onChange:n=>t({name:n})})}),i.jsx(js,{label:"Handle",hint:"Used in @mentions across threads.",children:i.jsx(vo,{value:e.handle,onChange:n=>t({handle:n}),mono:!0})}),i.jsx(js,{label:"Pronouns",children:i.jsx(vo,{value:e.pronouns,onChange:n=>t({pronouns:n})})}),i.jsx(li,{label:"How agents understand you",right:"shipped as system prompt context"}),i.jsx(js,{label:"Operator bio",hint:"How you want to be worked with. Agents read this before asking you things.",children:i.jsx(S7,{value:e.bio,onChange:n=>t({bio:n}),rows:4})}),i.jsxs("div",{className:"s-settings-two-col",children:[i.jsx(js,{label:"Timezone",children:i.jsx(vo,{value:e.timezone,onChange:n=>t({timezone:n}),mono:!0})}),i.jsx(js,{label:"Working hours",children:i.jsx(vo,{value:e.workingHours,onChange:n=>t({workingHours:n}),mono:!0})})]})]})}function E7({profile:e,update:t}){return i.jsxs("div",{className:"s-settings-col-gap",children:[i.jsx(li,{label:"Interrupt policy"}),i.jsx(js,{label:"When agents can ping you directly",hint:"Blocking-only means only asks that truly stall work. Others get batched.",children:i.jsx(fd,{value:e.interruptThreshold,onChange:n=>t({interruptThreshold:n}),options:[{id:"always",label:"Always",sub:"any ask, any time"},{id:"blocking-only",label:"Blocking only",sub:"stuck agents · default"},{id:"batched",label:"Batched",sub:"grouped every 15m"},{id:"never",label:"Never",sub:"queue only, I'll check in"}]})}),i.jsxs("div",{className:"s-settings-two-col",children:[i.jsx(js,{label:"Batch window (min)",children:i.jsx(N7,{value:e.batchWindow,min:5,max:60,step:5,onChange:n=>t({batchWindow:n}),unit:"min"})}),i.jsx(js,{label:"Quiet hours",children:i.jsx(vo,{value:e.quietHours,onChange:n=>t({quietHours:n}),mono:!0})})]}),i.jsx(li,{label:"Where to reach you"}),i.jsx(js,{label:"Preferred channel",children:i.jsx(fd,{value:e.channel,onChange:n=>t({channel:n}),options:[{id:"here",label:"Here only",sub:"desktop app"},{id:"mobile",label:"Mobile only",sub:"paired phone"},{id:"here+mobile",label:"Both",sub:"whichever is active"}]})}),i.jsx(li,{label:"Tone calibration",right:"how agents write to you"}),i.jsxs("div",{className:"s-settings-two-col",children:[i.jsx(js,{label:"Verbosity",children:i.jsx(fd,{stacked:!0,value:e.verbosity,onChange:n=>t({verbosity:n}),options:[{id:"terse",label:"Terse",sub:"one-liners, answers only"},{id:"normal",label:"Normal",sub:"context + answer"},{id:"detailed",label:"Detailed",sub:"show reasoning"}]})}),i.jsx(js,{label:"Tone",children:i.jsx(fd,{stacked:!0,value:e.tone,onChange:n=>t({tone:n}),options:[{id:"direct",label:"Direct",sub:"no hedging"},{id:"warm",label:"Warm",sub:"friendly, conversational"},{id:"formal",label:"Formal",sub:"business-like"}]})})]})]})}const C7={desktop:"◻",mobile:"▯",tablet:"▭"};function T7({device:e}){const t=e.status==="this-device"?"var(--accent)":e.status==="online"?"var(--green)":"var(--dim)";return i.jsxs("div",{className:"s-settings-device-row",children:[i.jsx("span",{className:"s-settings-device-icon",children:C7[e.kind]??"□"}),i.jsxs("div",{children:[i.jsx("div",{className:"s-settings-device-name",children:e.name}),i.jsxs("div",{className:"s-settings-device-meta",children:[e.kind," · via ",e.relay," · ",e.lastSeen]})]}),i.jsxs("span",{className:"s-settings-device-status",style:{color:t},children:["●"," ",e.status==="this-device"?"this device":e.status]}),i.jsx("button",{className:"s-btn",disabled:e.status==="this-device",children:e.status==="this-device"?"—":"Unpair"})]})}function A7({pairing:e}){const t=[{id:"local",name:"This machine",kind:"desktop",status:"this-device",relay:"local",lastSeen:"now"}];if(e?.trustedPeers)for(const n of e.trustedPeers){const a=n.fingerprint===e.connectedPeerFingerprint;t.push({id:n.fingerprint,name:n.name??"Paired device",kind:"mobile",status:a?"online":"offline",relay:"tailscale",lastSeen:n.lastSeenLabel??"—"})}return i.jsxs("div",{className:"s-settings-col-gap",children:[i.jsx(li,{label:`Paired devices · ${t.length}`}),i.jsx("div",{className:"s-settings-col-gap",style:{gap:10},children:t.map(n=>i.jsx(T7,{device:n},n.id))}),i.jsx(li,{label:"Relay"}),i.jsxs("div",{className:"s-settings-relay-card",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"s-settings-relay-title",children:["Relay · ",i.jsxs("span",{className:"s-settings-device-status",style:{color:e?.isRunning?"var(--green)":"var(--dim)"},children:["●"," ",e?.isRunning?"connected":"offline"]})]}),i.jsxs("div",{className:"s-settings-relay-meta",children:[e?.relay??"not configured"," · tailscale"]}),i.jsx("div",{className:"s-settings-relay-desc",children:"Agents route through your relay to reach mobile when the app is backgrounded. End-to-end encrypted; keys never leave your devices."})]}),i.jsx("button",{className:"s-btn",children:"Configure"})]})]})}const M7=[{id:"operator",label:"Operator",sub:"identity · bio · hours"},{id:"comms",label:"Communication",sub:"how agents reach you"},{id:"devices",label:"Paired devices",sub:"relay · connected"}],R7={operator:"Operator identity",comms:"Communication",devices:"Paired devices"},_7={name:"",handle:"",pronouns:"",hue:195,bio:"",timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,workingHours:"08:00 – 18:00",interruptThreshold:"blocking-only",batchWindow:15,channel:"here+mobile",verbosity:"terse",tone:"direct",quietHours:"22:00 – 07:00"};function O7({open:e,onClose:t}){const{refreshOnboarding:n}=St(),[a,o]=v.useState("operator"),[l,u]=v.useState(_7),[f,m]=v.useState(null),[h,p]=v.useState(!1),y=v.useRef(null),b=v.useCallback(async()=>{try{const N=Ce("/api/user"),C=Promise.race([Ce("/api/pairing-state"),new Promise((S,R)=>setTimeout(()=>R(new Error("timeout")),3e3))]),[k,E]=await Promise.allSettled([N,C]);k.status==="fulfilled"&&u(k.value),E.status==="fulfilled"&&m(E.value)}finally{p(!0)}},[]);v.useEffect(()=>{e&&b()},[e,b]),v.useEffect(()=>{if(!e)return;const N=C=>{C.key==="Escape"&&t()};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[e,t]);const w=v.useCallback(N=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{Ce("/api/user",{method:"POST",body:JSON.stringify(N)}).then(()=>n()).catch(()=>{})},400)},[n]),j=v.useCallback(N=>{u(C=>{const k={...C,...N};return w(k),k})},[w]);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:`s-settings-scrim ${e?"s-settings-scrim--open":"s-settings-scrim--closed"}`,onClick:t}),i.jsxs("div",{className:`s-settings-drawer ${e?"s-settings-drawer--open":"s-settings-drawer--closed"}`,children:[i.jsxs("div",{className:"s-settings-header",children:[i.jsxs("div",{className:"s-settings-header-title",children:["⚙"," SETTINGS"]}),i.jsx("span",{className:"s-settings-header-sep",children:"/"}),i.jsx("span",{className:"s-settings-header-section",children:R7[a]}),i.jsx("span",{style:{flex:1}}),i.jsx("span",{className:"s-settings-header-hint",children:"ESC to close"}),i.jsx("button",{className:"s-settings-close",onClick:t,children:"×"})]}),i.jsx("nav",{className:"s-settings-rail",children:M7.map(N=>i.jsxs("button",{onClick:()=>o(N.id),className:`s-settings-rail-btn${a===N.id?" s-settings-rail-btn--active":""}`,children:[i.jsx("span",{className:"s-settings-rail-label",children:N.label}),i.jsx("span",{className:"s-settings-rail-sub",children:N.sub})]},N.id))}),i.jsx("main",{className:"s-settings-content",children:h?i.jsxs(i.Fragment,{children:[a==="operator"&&i.jsx(k7,{profile:l,update:j}),a==="comms"&&i.jsx(E7,{profile:l,update:j}),a==="devices"&&i.jsx(A7,{pairing:f})]}):i.jsx("div",{style:{color:"var(--dim)",fontFamily:"var(--font-mono)",fontSize:12},children:"Loading..."})}),i.jsxs("div",{className:"s-settings-footer",children:[i.jsxs("span",{className:"s-settings-footer-sync",children:["●"," synced"]}),i.jsx("span",{children:"·"}),i.jsx("span",{children:"changes apply instantly to every agent in your fleet"}),i.jsx("span",{style:{flex:1}}),i.jsx("button",{className:"s-btn",onClick:t,children:"Done"})]})]})]})}function I7({onOpen:e}){return i.jsxs("button",{className:"s-settings-launcher",onClick:e,children:[i.jsx("span",{className:"s-settings-launcher-icon",children:"⚙"}),i.jsx("span",{children:"settings"})]})}const bA=v.createContext(null),D7=["hello","node.upserted","actor.registered","agent.registered","agent.endpoint.upserted","invocation.requested","flight.updated","delivery.state.changed","scout.dispatched"],z7=new Set(D7),P7={"--hud-bg":"oklch(0.14 0.008 80)","--hud-surface":"oklch(0.18 0.009 80)","--hud-ink":"oklch(0.96 0.008 80)","--hud-muted":"oklch(0.72 0.012 80)","--hud-dim":"oklch(0.58 0.012 80)","--hud-border":"oklch(0.23 0.010 80 / 0.8)","--hud-accent":"oklch(0.86 0.17 125)","--hud-accent-soft":"oklch(0.86 0.17 125 / 0.08)","--hud-shadow-soft":"oklch(0.10 0.006 75 / 0.4)","--hud-status-ok":"oklch(0.80 0.15 155)","--hud-status-warn":"oklch(0.82 0.15 85)","--hud-status-error":"oklch(0.72 0.18 25)","--scout-chrome-ink-strong":"color-mix(in srgb, var(--hud-ink) 92%, transparent)","--scout-chrome-ink":"color-mix(in srgb, var(--hud-ink) 78%, transparent)","--scout-chrome-ink-soft":"color-mix(in srgb, var(--hud-ink) 58%, transparent)","--scout-chrome-ink-faint":"color-mix(in srgb, var(--hud-ink) 38%, transparent)","--scout-chrome-ink-ghost":"color-mix(in srgb, var(--hud-ink) 22%, transparent)","--scout-chrome-hover":"color-mix(in srgb, var(--hud-ink) 4%, transparent)","--scout-chrome-active":"color-mix(in srgb, var(--hud-ink) 8%, transparent)","--scout-chrome-border-soft":"color-mix(in srgb, var(--hud-border) 55%, transparent)","--scout-chrome-avatar-ink":"#111111","--hud-font-sans":"'Inter Tight', 'Inter', ui-sans-serif, system-ui, sans-serif","--hud-font-mono":"'JetBrains Mono', ui-monospace, Menlo, monospace","--hud-font-serif":"'Instrument Serif', 'Spectral', Georgia, serif"},L7={"--hud-bg":"oklch(0.978 0.004 85)","--hud-surface":"oklch(0.992 0.003 85)","--hud-ink":"oklch(0.24 0.01 80)","--hud-muted":"oklch(0.56 0.014 80)","--hud-dim":"oklch(0.72 0.01 80)","--hud-border":"oklch(0.88 0.008 82 / 0.95)","--hud-accent":"oklch(0.72 0.16 125)","--hud-accent-soft":"oklch(0.72 0.16 125 / 0.11)","--hud-shadow-soft":"oklch(0.42 0.01 80 / 0.12)","--hud-status-ok":"oklch(0.64 0.16 155)","--hud-status-warn":"oklch(0.72 0.15 85)","--hud-status-error":"oklch(0.62 0.19 25)","--scout-chrome-ink-strong":"color-mix(in srgb, var(--hud-ink) 94%, transparent)","--scout-chrome-ink":"color-mix(in srgb, var(--hud-ink) 78%, transparent)","--scout-chrome-ink-soft":"color-mix(in srgb, var(--hud-ink) 60%, transparent)","--scout-chrome-ink-faint":"color-mix(in srgb, var(--hud-ink) 40%, transparent)","--scout-chrome-ink-ghost":"color-mix(in srgb, var(--hud-ink) 24%, transparent)","--scout-chrome-hover":"color-mix(in srgb, var(--hud-ink) 4%, transparent)","--scout-chrome-active":"color-mix(in srgb, var(--hud-ink) 8%, transparent)","--scout-chrome-border-soft":"color-mix(in srgb, var(--hud-border) 80%, transparent)","--scout-chrome-avatar-ink":"#ffffff","--hud-font-sans":"'Inter Tight', 'Inter', ui-sans-serif, system-ui, sans-serif","--hud-font-mono":"'JetBrains Mono', ui-monospace, Menlo, monospace","--hud-font-serif":"'Instrument Serif', 'Spectral', Georgia, serif"};function St(){const e=v.useContext(bA);if(!e)throw new Error("useScout must be used inside ScoutProvider");return e}function $7({children:e,initialTheme:t="dark"}){const{route:n,navigate:a}=i7(),[o,l]=v.useState([]),[u,f]=v.useState(null),[m,h]=v.useState(!1),p=v.useCallback(()=>h(!0),[]),[y,b]=v.useState(!1),w=v.useCallback(()=>b(!0),[]),j=v.useCallback(()=>b(!1),[]),N=t==="light"?L7:P7,C=v.useMemo(()=>p7(o),[o]),k=v.useMemo(()=>g7(C),[C]),E=v.useCallback(async()=>{const U=await Ce("/api/agents").catch(()=>null);U&&l(U)},[]),S=v.useCallback(async()=>{try{const U=await Ce("/api/onboarding/state");f(U)}catch{f({hasLocalConfig:!0,hasProjectConfig:!0,hasOperatorName:!0,localConfigPath:null,projectRoot:null,currentDirectory:null,operatorName:null,operatorNameSuggestion:null})}},[]);v.useEffect(()=>{E(),S()},[E,S]);const R=v.useMemo(()=>o.filter(U=>gi(U.state)).length,[o]),A=v.useCallback(U=>{switch(U.type){case"navigate":a(U.route);break;case"open-ranger":a({view:"conversation",conversationId:k,...U.mode==="ask"?{composeMode:"ask"}:{}});break;case"refresh":E();break}},[a,k,E]),M=v.useRef({rangerAgentId:C,applyRangerUiAction:A});M.current={rangerAgentId:C,applyRangerUiAction:A},fn(U=>{z7.has(U.kind)&&E();const F=U.kind==="message.posted"&&U.payload&&typeof U.payload=="object"?U.payload.message:null;if(!F||typeof F!="object")return;const P=F,_=typeof P.actorId=="string"?P.actorId:"",z=typeof P.body=="string"?P.body:"";if(!(!_||!z||!vA(_,M.current.rangerAgentId)))for(const B of v7(z))M.current.applyRangerUiAction(B)}),v.useEffect(()=>{const U=F=>{const P=F.detail,_=P&&typeof P=="object"&&"type"in P?P:null;_&&M.current.applyRangerUiAction(_)};return window.addEventListener("scout:ranger-ui-action",U),window.scoutRanger={applyUiAction:F=>M.current.applyRangerUiAction(F),navigate:F=>M.current.applyRangerUiAction({type:"navigate",route:F})},()=>{window.removeEventListener("scout:ranger-ui-action",U),window.scoutRanger?.applyUiAction&&delete window.scoutRanger}},[]);const D=v.useMemo(()=>({route:n,navigate:a,agents:o,onlineCount:R,reload:E,onboarding:u,refreshOnboarding:S,onboardingSkipped:m,skipOnboarding:p,settingsOpen:y,openSettings:w,closeSettings:j,rangerAgentId:C,rangerConversationId:k,applyRangerUiAction:A}),[n,a,o,R,E,u,S,m,p,y,w,j,C,k,A]);return i.jsx(bA.Provider,{value:D,children:i.jsx("div",{"data-scout-theme":t,"data-scout-theme-mode":t,style:{...N},children:i.jsxs(b7,{children:[e,i.jsx(O7,{open:y,onClose:j})]})})})}function U7(){const{navigate:e,agents:t,reload:n,openSettings:a,rangerConversationId:o,applyRangerUiAction:l}=St(),u=Dc(),f=v.useCallback(async()=>{try{const h=await Ce("/api/ask",{method:"POST",body:JSON.stringify({conversationId:o,body:"What's the state of things? Give me a terse ops summary, the biggest risk, and the next action you recommend."})});e({view:"conversation",conversationId:h.conversationId??o,composeMode:"ask"})}catch{e({view:"conversation",conversationId:o,composeMode:"ask"})}},[e,o]),m=v.useCallback(async h=>{await Ce(`/api/agents/${encodeURIComponent(h)}/interrupt`,{method:"POST",body:JSON.stringify({})})},[]);return v.useMemo(()=>{const h=[{id:"nav:home",label:"Go to Home",action:()=>e({view:"inbox"}),shortcut:"Cmd+1"},{id:"nav:agents",label:"Go to Agents",action:()=>e({view:"agents"}),shortcut:"Cmd+2"},{id:"nav:fleet",label:"Go to Fleet",action:()=>e({view:"fleet"}),shortcut:"Cmd+3"},{id:"nav:sessions",label:"Go to Sessions",action:()=>e({view:"sessions"}),shortcut:"Cmd+4"},{id:"nav:activity",label:"Go to Activity",action:()=>e({view:"activity"}),shortcut:"Cmd+5"},{id:"nav:mesh",label:"Go to Mesh",action:()=>e({view:"mesh"}),shortcut:"Cmd+6"},...u?[{id:"nav:ops",label:"Go to Ops",action:()=>e({view:"ops"}),shortcut:"Cmd+7"}]:[],{id:"nav:settings",label:"Open Settings",action:()=>a(),shortcut:"Cmd+,"},{id:"ranger:open",label:"Open Ranger",action:()=>e({view:"conversation",conversationId:o,composeMode:"ask"})},{id:"ranger:state",label:"Ask Ranger for State",action:()=>{f()}},{id:"ranger:ops-tail",label:"Ranger: Open Ops Tail",action:()=>l({type:"navigate",route:{view:"ops",mode:"tail"}})},{id:"nav:pair",label:"Pair Device",action:()=>a()},{id:"scout:reload",label:"Reload Agents",action:()=>{n()}}];for(const p of t)h.push({id:`scout:open:${p.id}`,label:`Open ${p.name}`,action:()=>e({view:"conversation",conversationId:Jn(p.id)})}),h.push({id:`scout:send:${p.id}`,label:`Tell ${p.name}`,action:()=>e({view:"conversation",conversationId:Jn(p.id)})}),h.push({id:`scout:ask:${p.id}`,label:`Ask ${p.name}`,action:()=>e({view:"conversation",conversationId:Jn(p.id),composeMode:"ask"})}),h.push({id:`scout:interrupt:${p.id}`,label:`Interrupt ${p.name}`,action:()=>{m(p.id)}});return h},[t,l,f,m,e,u,o,n,a])}function wA(){const{onlineCount:e}=St(),[t,n]=v.useState(null),a=v.useRef(0),o=v.useCallback(async()=>{const l=++a.current;try{const u=await Ce("/api/mesh");if(l!==a.current)return;n(u)}catch{if(l!==a.current)return;n(null)}},[]);return v.useEffect(()=>{o();const l=setInterval(()=>{o()},15e3);return()=>clearInterval(l)},[o]),{status:t===null?{label:"Broker: …",color:"neutral"}:t.health.reachable?{label:"Broker: UP",color:"emerald"}:{label:"Broker: DOWN",color:"red"},activeAgents:{label:"Active Agents",count:e},mesh:t===null?{label:"Mesh",value:"checking",color:"neutral"}:t.health.reachable?Object.values(t.nodes).filter(u=>u.id!==t.localNode?.id).length>0?{label:"Mesh",value:"connected",color:"neutral"}:t.identity.discoverable?{label:"Mesh",value:"discoverable",color:"neutral"}:{label:"Mesh",value:"local",color:"amber"}:{label:"Mesh",value:"offline",color:"neutral"}}}function B7(){return wA().status}const V7={inbox:"Fleet",conversation:"Conversation","agent-info":"Agent",agents:"Agents",fleet:"Fleet",sessions:"Sessions",activity:"Activity",mesh:"Mesh",settings:"Settings",work:"Work",ops:"Ops"};function H7(){const{route:e,navigate:t}=St(),n=Dc(),a=[{label:"Fleet",view:"inbox"},{label:"Agents",view:"agents"},{label:"Sessions",view:"sessions"},{label:"Mesh",view:"mesh"},...n?[{label:"Ops",view:"ops"}]:[]],o=e.view==="fleet"||e.view==="activity"?"inbox":e.view==="conversation"||e.view==="agent-info"?"agents":e.view==="work"?n?"ops":"inbox":e.view,l=e.view==="conversation"||e.view==="agent-info"||e.view==="work"?V7[e.view]??e.view:null;return v.createElement("div",{className:"scout-nav-tabs"},a.map(({label:u,view:f})=>v.createElement("button",{key:f,className:`scout-nav-tab${o===f?" active":""}`,onClick:()=>t({view:f})},u)),l&&v.createElement("span",{className:"scout-nav-slash"},"/"),l&&v.createElement("span",{className:"scout-nav-crumb"},l))}function F7(){const{openSettings:e,navigate:t,rangerConversationId:n}=St();return v.createElement("div",{className:"scout-nav-actions"},v.createElement("button",{onClick:()=>t({view:"conversation",conversationId:n,composeMode:"ask"}),className:"scout-nav-action scout-nav-action--ranger"},"Ranger"),v.createElement("button",{onClick:()=>e(),className:"scout-nav-action"},"Pair device"))}function Z7(){return"panel"}function q7(){const{onboarding:e,onboardingSkipped:t,skipOnboarding:n}=St();if(!e)return null;if(t)return{active:!1,dismissible:!0};const a=!e.hasLocalConfig,o=!e.hasProjectConfig,l=!e.hasOperatorName;return{active:a||l||o,dismissible:!0,onDismiss:n}}function W7({app:e,assistant:t=!0}){return i.jsx(e.Provider,{children:i.jsx(G7,{app:e,assistantEnabled:t})})}function Y7({statusBar:e}){const t=e.mesh.color==="amber"?"text-amber-400":e.mesh.color==="red"?"text-red-400":"text-neutral-100";return i.jsxs("div",{className:"flex items-center gap-3 font-mono text-[12px]",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsxs("span",{className:"text-neutral-500",children:[e.activeAgents.label,":"]}),i.jsx("span",{className:"text-neutral-100",children:e.activeAgents.count})]}),i.jsx("div",{className:"h-3 w-px bg-neutral-700"}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsxs("span",{className:"text-neutral-500",children:[e.mesh.label,":"]}),i.jsx("span",{className:t,children:e.mesh.value})]})]})}function G7({app:e,assistantEnabled:t}){const{navTotalHeight:n}=Ov(),a=e.hooks.useCommands(),o=e.hooks.useSearch?.()??null,l=e.hooks.useNavCenter?.()??null,u=e.hooks.useNavActions?.()??null,f=e.hooks.useLayoutMode?.()??e.mode,m=e.hooks.useActiveToolHint?.()??null,h=e.hooks.useTakeover?.()??null,p=h?.active===!0,y=p&&h?.dismissible===!0,b=h?.onDismiss,w=e.slots.Takeover,j=wA(),[N,C]=Ca(`appshell.${e.id}.left`,!1),[k,E]=Ca(`appshell.${e.id}.right`,!1),[S,R]=Ca(`appshell.${e.id}.leftW`,260),[A,M]=Ca(`appshell.${e.id}.rightW`,280),[D,U]=v.useState({x:0,y:0}),[F,P]=v.useState(1),_=v.useCallback(le=>{U(he=>({x:he.x+le.x,y:he.y+le.y}))},[]),z=v.useCallback(le=>{P(le)},[]),[B,V]=v.useState(!1),[K,L]=v.useState(!1),[H,$]=Ca(`appshell.${e.id}.termH`,320),G=!!e.slots.Terminal,X=v.useMemo(()=>{const le=[];return G&&le.push("terminal"),t&&le.push("assistant"),le},[G,t]),O=X[0]??"terminal",[Z,W]=Ca(`appshell.${e.id}.drawerTab`,O),Q=X.includes(Z)?Z:O,[ce,ae]=v.useState(!1),[ge,ye]=v.useState(new Set),be=v.useCallback(le=>{ye(he=>{const pe=new Set(he);return pe.has(le)?pe.delete(le):pe.add(le),pe})},[]),Oe=v.useCallback(le=>he=>{he.preventDefault();const pe=he.clientX,ke=le==="left"?S:A,Ee=le==="left"?R:M,Je=le==="left"?1:-1,et=Bt=>{const Et=(Bt.clientX-pe)*Je;Ee(Math.max(200,Math.min(500,ke+Et)))},Ye=()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",Ye)};document.addEventListener("mousemove",et),document.addEventListener("mouseup",Ye)},[S,A,R,M]),fe=v.useMemo(()=>{const le=[{id:"shell:toggle-left",label:"Toggle Left Panel",shortcut:"Cmd+[",action:()=>C(he=>!he)},{id:"shell:toggle-right",label:"Toggle Right Panel",shortcut:"Cmd+]",action:()=>E(he=>!he)},{id:"shell:toggle-terminal",label:"Toggle Terminal",shortcut:"Ctrl+`",action:()=>V(he=>!he)}];return t&&le.push({id:"shell:toggle-assistant",label:"Toggle Assistant",shortcut:"Cmd+J",action:()=>{W("assistant"),V(he=>!he||Z!=="assistant")}}),le},[t,Z,W,C,E]),xe=v.useMemo(()=>[...a,...fe],[a,fe]);v.useEffect(()=>{const le=he=>{p||((he.metaKey||he.ctrlKey)&&he.key==="k"&&(he.preventDefault(),ae(!0)),(he.metaKey||he.ctrlKey)&&he.key==="["&&(he.preventDefault(),C(pe=>!pe)),(he.metaKey||he.ctrlKey)&&he.key==="]"&&(he.preventDefault(),E(pe=>!pe)),he.ctrlKey&&he.key==="`"&&(he.preventDefault(),V(pe=>!pe)),t&&(he.metaKey||he.ctrlKey)&&he.key==="j"&&(he.preventDefault(),W("assistant"),V(pe=>!(pe&&Q==="assistant"))))};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[t,Q,W,C,E,p]),v.useEffect(()=>{const le=()=>{W("terminal"),V(!0),$(he=>he>window.innerHeight*.8?420:he)};return window.addEventListener("scout:open-terminal",le),()=>window.removeEventListener("scout:open-terminal",le)},[W,$]);const we=e.slots.Inspector,ze=e.slots.RightPanel,Me=e.tools&&e.tools.length>0,je=i.jsxs(i.Fragment,{children:[we&&i.jsx(we,{}),!we&&ze&&i.jsx(ze,{}),Me&&i.jsx("div",{className:"border-t border-neutral-700/50",children:e.tools.map(le=>{const he=ge.has(le.id);return i.jsxs("div",{children:[i.jsxs("button",{onClick:()=>be(le.id),className:`w-full flex items-center gap-2 px-4 py-2.5 text-[11px] font-mono tracking-wider uppercase transition-colors hover:bg-white/5 ${m===le.id?"text-emerald-400":"text-neutral-300"}`,children:[he?i.jsx(W2,{size:10}):i.jsx(G2,{size:10}),i.jsx("span",{className:"text-neutral-400",children:le.icon}),i.jsx("span",{className:"font-bold",children:le.name})]}),he&&i.jsx("div",{className:"px-4 pb-3",children:i.jsx(le.Component,{})})]},le.id)})})]}),Ne=i.jsxs(i.Fragment,{children:[e.slots.LeftFooter&&i.jsx(e.slots.LeftFooter,{}),i.jsx(JH,{onOpenCommandPalette:()=>ae(!0)})]}),We=v.useRef(null),Be=v.useRef(null);v.useEffect(()=>{const le=We.current;le&&(p?le.setAttribute("inert",""):le.removeAttribute("inert"))},[p]),v.useEffect(()=>{if(!p)return;const le=Be.current;if(le&&(le.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")??le).focus(),!y)return;const he=pe=>{pe.key==="Escape"&&(pe.preventDefault(),b?.())};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[p,y,b]);const He=f==="panel"?{position:"absolute",top:n,bottom:28,left:N?0:S,right:k?0:A,overflow:"auto",transition:"left 200ms ease, right 200ms ease"}:{};return i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:We,"aria-hidden":p?!0:void 0,style:{display:"contents"},children:i.jsx(WH,{mode:f,panOffset:D,scale:F,onPan:_,onZoom:z,hud:i.jsxs(i.Fragment,{children:[i.jsx(GH,{title:e.name.toUpperCase(),search:o??void 0,center:l,actions:u}),i.jsx(DS,{side:"left",title:e.leftPanel?.title??"Navigation",icon:e.leftPanel?.icon,isCollapsed:N,onToggleCollapse:()=>C(!N),width:S,onResizeStart:Oe("left"),footer:Ne,headerActions:e.leftPanel?.headerActions&&i.jsx(e.leftPanel.headerActions,{}),children:e.slots.LeftPanel&&i.jsx(e.slots.LeftPanel,{})}),i.jsx(DS,{side:"right",title:e.rightPanel?.title??"Inspector",icon:e.rightPanel?.icon,isCollapsed:k,onToggleCollapse:()=>E(!k),width:A,onResizeStart:Oe("right"),headerActions:e.rightPanel?.headerActions&&i.jsx(e.rightPanel.headerActions,{}),children:je}),i.jsx(XH,{status:j.status,left:i.jsx(Y7,{statusBar:j}),onToggleTerminal:()=>V(le=>!le),isTerminalOpen:B}),i.jsx("div",{className:"pointer-events-none",style:{position:"fixed",left:N?0:S,right:k?0:A,bottom:0,top:0,zIndex:45,transition:"left 200ms ease, right 200ms ease",transform:"translateZ(0)"},children:i.jsxs(QH,{isOpen:B,onClose:()=>V(!1),onToggleMaximize:()=>L(le=>!le),isMaximized:K,height:Math.min(H,window.innerHeight*.8),onHeightChange:le=>$(Math.min(le,window.innerHeight*.8)),title:i.jsx(K7,{tabs:X,active:Q,onSelect:W}),children:[Q==="terminal"&&(e.slots.Terminal?i.jsx(e.slots.Terminal,{}):i.jsx("div",{className:"p-4 font-mono text-[12px] text-neutral-400",children:"No terminal content"})),Q==="assistant"&&i.jsx(nP,{app:e,commands:a})]})}),i.jsx(e7,{isOpen:ce,onClose:()=>ae(!1),commands:xe})]}),children:i.jsx("div",{style:He,className:"frame-scrollbar",children:i.jsx(e.slots.Content,{})})})}),p&&w?i.jsx("div",{ref:Be,tabIndex:-1,role:"dialog","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:80,outline:"none"},children:i.jsx(w,{})}):null]})}function K7({tabs:e,active:t,onSelect:n}){return e.length===0?null:i.jsx("div",{className:"flex items-center gap-0.5",children:e.map(a=>{const o=a===t,l=a==="terminal"?h_:d_,u=a==="terminal"?"TERMINAL":"ASSISTANT",f=a==="terminal"?"text-emerald-400":"text-cyan-400";return i.jsxs("button",{type:"button",onClick:()=>n(a),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-bold tracking-widest font-mono transition-colors ${o?`${f} bg-white/[0.04]`:"text-neutral-500 hover:text-neutral-300"}`,children:[i.jsx(l,{size:13}),i.jsx("span",{children:u})]},a)})})}const X7={ask_sent:"asked",ask_replied:"replied",ask_failed:"failed",ask_working:"working",flight_created:"task started",flight_updated:"task updated",message_sent:"sent",message_received:"received",agent_online:"online",agent_offline:"offline"};function J7(e){return X7[e]??e.replace(/_/g," ")}const $S=["#6366f1","#8b5cf6","#0ea5e9","#14b8a6","#f59e0b","#ef4444","#ec4899","#10b981"];function ct(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return $S[Math.abs(t)%$S.length]}function Oa(e){switch(ft(e)){case"working":return"var(--green)";case"available":return"var(--accent)";default:return"var(--dim)"}}const Q7={workspace:"workspace",worktree:"workspace",branch:"workspace",profile:"profile",persona:"profile",harness:"harness",runtime:"harness",node:"node",host:"node"};function eF(e){return e.trim().replace(/^@+/,"").replace(/[.,!?;)\]]+$/,"")}function Qs(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const tF="scout";function nF(e){return Q7[Qs(e)]??null}function jA(e){const t=Qs(e.definitionId),n=e.workspaceQualifier?Qs(e.workspaceQualifier):void 0,a=e.profile?Qs(e.profile):void 0,o=e.harness?Qs(e.harness):void 0,l=e.nodeQualifier?Qs(e.nodeQualifier):void 0;return t?{definitionId:t,...n?{workspaceQualifier:n}:{},...a?{profile:a}:{},...o?{harness:o}:{},...l?{nodeQualifier:l}:{}}:null}function sF(e){const t=e.split(".").filter(Boolean),n=t.shift();if(!n)return null;const a={definitionId:n},o=[];for(const l of t){if(l.includes(":")){const[u,f=""]=l.split(":",2),m=nF(u),h=Qs(f);if(!m||!h)return null;m==="workspace"?a.workspaceQualifier=h:m==="profile"?a.profile=h:m==="harness"?a.harness=h:m==="node"&&(a.nodeQualifier=h);continue}o.push(l)}if(o.length===1){const l=Qs(o[0]);if(!l)return null;a.workspaceQualifier=l}else if(o.length===2){const l=Qs(o[0]),u=Qs(o[1]);if(!l||!u)return null;a.workspaceQualifier||(a.workspaceQualifier=l),a.nodeQualifier||(a.nodeQualifier=u)}else if(o.length>2)return null;return rF(a,{raw:e})}function aF(e){const t=eF(e);return!t||t.includes("@")||t.includes("#")?null:sF(t)}function US(e,t={}){const n=jA(e);if(!n)return t.includeSigil===!1?"":"@";const o=[`${t.includeSigil===!1?"":"@"}${n.definitionId}`];return n.workspaceQualifier&&o.push(n.workspaceQualifier),n.profile&&o.push(`profile:${n.profile}`),n.harness&&o.push(`harness:${n.harness}`),n.nodeQualifier&&o.push(`node:${n.nodeQualifier}`),o.join(".")}function rF(e,t={}){const n=jA(e);return n?{raw:t.raw??US(n,{includeSigil:!1}),label:US(n),definitionId:n.definitionId,...n.nodeQualifier?{nodeQualifier:n.nodeQualifier}:{},...n.workspaceQualifier?{workspaceQualifier:n.workspaceQualifier}:{},...n.profile?{profile:n.profile}:{},...n.harness?{harness:n.harness}:{}}:null}function iF(e){return oF(e).parsed}function oF(e){const t=Array.from(e.matchAll(/(^|\s)@([a-z0-9][a-z0-9._/:-]*)/gi)),n=new Map,a=[];for(const o of t){const l=o[2]??"",u=aF(l);if(!u){l&&a.push(`@${l}`);continue}n.set(u.label,u)}return{parsed:Array.from(n.values()),unparsed:Array.from(new Set(a))}}function lF(e,t){if(t.length===0)return[{kind:"text",value:e}];const n=new Map;for(const u of t)n.set(u.label.toLowerCase(),u);const a=[];let o=e;const l=/@([a-z0-9][a-z0-9._/:-]*)/i;for(;o.length>0;){const u=l.exec(o);if(!u||u.index===void 0){a.push({kind:"text",value:o});break}u.index>0&&a.push({kind:"text",value:o.slice(0,u.index)});const f=u[0],m=f.toLowerCase(),h=n.get(m);h?a.push({kind:"mention",identity:h}):a.push({kind:"text",value:f}),o=o.slice(u.index+f.length)}return a}function cF(e,t){const n=[],a=/\*\*(.+?)\*\*/g;let o=0,l,u=0;for(;(l=a.exec(e))!==null;)l.index>o&&n.push(i.jsx("span",{children:e.slice(o,l.index)},`${t}-${u++}`)),n.push(i.jsx("strong",{children:l[1]},`${t}-${u++}`)),o=l.index+l[0].length;return o<e.length&&n.push(i.jsx("span",{children:e.slice(o)},`${t}-${u++}`)),n.length>0?n:[i.jsx("span",{children:e},t)]}function Es(e){if(!e)return e??"";const t=iF(e);return lF(e,t).flatMap((a,o)=>{if(a.kind==="text")return cF(a.value,o*100);const{identity:l}=a,f=l.definitionId===tF?"var(--accent)":ct(l.definitionId);return i.jsx("span",{className:"s-mention",style:{"--mention-color":f},children:l.label},o)})}function Pe(e){const t=e<1e12?e*1e3:e,n=Math.floor((Date.now()-t)/1e3);return n<5?"now":n<60?`${n}s`:n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:`${Math.floor(n/86400)}d`}function ai(e){return new Date(e<1e12?e*1e3:e).toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"})}const uF={"agent.registered":"registered","agent.online":"came online","agent.offline":"went offline","flight.started":"started task","flight.completed":"completed task","flight.updated":"updated task","message.sent":"sent message","message.received":"received message","collaboration.ask":"asked a question","collaboration.answer":"answered",ask_sent:"asked",ask_replied:"replied",ask_working:"working",flight_created:"started task",flight_updated:"updated task",message_sent:"sent",message_received:"received"},dF={presence:{label:"Presence",tone:"notice"},work:{label:"Execution",tone:"working"},message:{label:"Delivery",tone:"completed"},collaboration:{label:"Coordination",tone:"working"},system:{label:"System",tone:"notice"}};function SA(e){return uF[e]??e.replace(/[._]/g," ")}function fF(e){return e.startsWith("agent.")||e.includes("registered")||e.includes("online")||e.includes("offline")?"presence":e.startsWith("flight")||e.startsWith("ask_")?"work":e.startsWith("message")?"message":e.startsWith("collaboration")?"collaboration":"system"}function hF(e){return(e??"system").charAt(0).toUpperCase()}function NA(e){return e.length<=14?e:`${e.slice(0,8)}...${e.slice(-4)}`}function mF(e){if(!e)return null;const t=e.split("/").filter(Boolean);return t[t.length-1]??e}function pF(e){return`${e.actorName??"system"} ${SA(e.kind)}`}function gF(e){return e.workspaceRoot?`Recorded from ${e.workspaceRoot}.`:e.conversationId?`Linked to thread ${NA(e.conversationId)}.`:"No additional detail was captured for this event."}function vF({navigate:e}){const[t,n]=v.useState([]),[a,o]=v.useState(null),[l,u]=v.useState(!0),[f,m]=v.useState(!1),[h,p]=v.useState(null),[y,b]=v.useState(null),w=v.useRef([]),j=v.useRef(0),N=v.useRef(null),C=Yf();v.useEffect(()=>{w.current=t},[t]);const k=v.useCallback(async(M="initial")=>{const D=++j.current;!(w.current.length>0)&&M!=="background"?(u(!0),p(null)):m(!0);try{const F=await Ce("/api/activity");if(D!==j.current)return;n(F),p(null),b(Date.now()),o(P=>F.some(_=>_.id===P)?P:null)}catch(F){if(D!==j.current)return;p(F instanceof Error?F.message:String(F))}finally{D===j.current&&(u(!1),m(!1))}},[]),E=v.useCallback(()=>{N.current||(N.current=setTimeout(()=>{N.current=null,k("background")},250))},[k]);v.useEffect(()=>(k("initial"),()=>{N.current&&clearTimeout(N.current)}),[k]),fn(E);const S=v.useMemo(()=>{const M=new Set(t.map(U=>U.actorName??"system")),D=new Set(t.map(U=>U.conversationId).filter(U=>!!U));return[{label:"Events",value:`${t.length}`,detail:t.length>0?`Latest ${Pe(t[0].ts)}`:"Waiting for records"},{label:"Actors",value:`${M.size}`,detail:M.size>0?"Distinct event owners":"No actors yet"},{label:"Threads",value:`${D.size}`,detail:D.size>0?"Conversation-linked records":"No linked threads"}]},[t]),R=!l&&t.length===0&&!!h,A=!l&&t.length===0&&!h;return i.jsxs("div",{className:"sys-surface-page",children:[i.jsxs("div",{className:"sys-page-head",children:[i.jsxs("div",{className:"sys-page-title-group",children:[i.jsx("h2",{className:"sys-page-title",children:"Activity"}),i.jsx("p",{className:"sys-page-subtitle",children:"Broker events, task execution, and collaboration handoffs."})]}),i.jsxs("div",{className:"sys-page-actions",children:[i.jsx("div",{className:"sys-sync-note",children:l?"Loading audit ledger...":h&&t.length>0?`Showing last confirmed snapshot from ${y?Pe(y):"earlier"}`:y?`Updated ${Pe(y)}`:"Waiting for first snapshot"}),i.jsx("button",{type:"button",className:"s-btn",disabled:l||f,onClick:()=>{k("manual")},children:f?"Refreshing...":"Refresh"})]})]}),i.jsx("div",{className:"sys-stat-grid",children:S.map(M=>i.jsxs("div",{className:"sys-stat-card",children:[i.jsx("span",{className:"sys-stat-label",children:M.label}),i.jsx("strong",{className:"sys-stat-value",children:M.value}),i.jsx("span",{className:"sys-stat-detail",children:M.detail})]},M.label))}),h&&t.length>0&&i.jsxs("div",{className:"sys-banner sys-banner-warning",children:[i.jsx("strong",{children:"Refresh failed."}),i.jsx("span",{children:h})]}),l&&t.length===0&&i.jsxs("div",{className:"sys-panel sys-state-card",children:[i.jsx("h3",{className:"sys-state-title",children:"Loading activity"}),i.jsx("p",{className:"sys-state-body",children:"Pulling the latest records from the broker database."})]}),R&&i.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[i.jsx("h3",{className:"sys-state-title",children:"Activity is unavailable"}),i.jsx("p",{className:"sys-state-body",children:h}),i.jsx("div",{className:"sys-inline-actions",children:i.jsx("button",{type:"button",className:"s-btn",onClick:()=>{k("manual")},children:"Try again"})})]}),A&&i.jsxs("div",{className:"sys-panel sys-state-card",children:[i.jsx("h3",{className:"sys-state-title",children:"No activity yet"}),i.jsx("p",{className:"sys-state-body",children:"Events appear here after agents register, send messages, or advance work."})]}),t.length>0&&i.jsx("div",{className:"sys-audit-list",children:t.map(M=>{const D=a===M.id,U=fF(M.kind),F=dF[U],P=mF(M.workspaceRoot),_=M.summary&&M.summary!==M.title?M.summary:gF(M);return i.jsxs("article",{className:`sys-audit-entry${D?" sys-audit-entry-expanded":""}`,onContextMenu:z=>{const B=window.getSelection()?.toString().trim(),V=[];B&&(V.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(B)}),V.push({kind:"separator"}));const K=M.title??M.summary??"";K&&V.push({kind:"action",label:"Copy Details",onSelect:()=>navigator.clipboard.writeText(K)}),M.actorName&&V.push({kind:"action",label:"Copy Actor",onSelect:()=>navigator.clipboard.writeText(M.actorName)}),V.push({kind:"action",label:"Copy Event ID",onSelect:()=>navigator.clipboard.writeText(M.id)}),M.conversationId&&(V.push({kind:"separator"}),V.push({kind:"action",label:"Open Thread",onSelect:()=>e({view:"conversation",conversationId:M.conversationId})})),C(z,V)},children:[i.jsxs("button",{type:"button",className:"sys-audit-toggle","aria-expanded":D,onClick:()=>o(D?null:M.id),children:[i.jsxs("div",{className:"sys-audit-stamp",children:[i.jsx("span",{className:"sys-audit-time",children:Pe(M.ts)}),i.jsx("span",{className:"sys-audit-date",children:ai(M.ts)})]}),i.jsx("div",{className:`sys-audit-marker sys-audit-marker-${F.tone}`,children:i.jsx("span",{})}),i.jsxs("div",{className:"sys-audit-body",children:[i.jsxs("div",{className:"sys-audit-topline",children:[i.jsx("span",{className:"sys-audit-category",children:F.label}),i.jsx("span",{className:"sys-audit-kind",children:SA(M.kind)})]}),i.jsx("h3",{className:"sys-audit-title",children:Es(M.title??pF(M))}),i.jsx("p",{className:"sys-audit-summary",children:Es(_)}),i.jsxs("div",{className:"sys-audit-meta",children:[i.jsxs("span",{className:"sys-audit-meta-item",children:[i.jsx("span",{className:"sys-audit-avatar",style:{background:ct(M.actorName??"system")},children:hF(M.actorName)}),M.actorName??"system"]}),P&&i.jsxs("span",{className:"sys-audit-meta-item",children:["Workspace ",P]}),M.conversationId&&i.jsxs("span",{className:"sys-audit-meta-item",children:["Thread ",NA(M.conversationId)]})]})]}),i.jsx("div",{className:"sys-audit-expand",children:D?"Close":"Details"})]}),D&&i.jsxs("div",{className:"sys-audit-details",children:[i.jsxs("div",{className:"sys-detail-grid",children:[i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Event"}),i.jsx("code",{className:"sys-detail-value",children:M.kind})]}),i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Recorded"}),i.jsx("span",{className:"sys-detail-value",children:ai(M.ts)})]}),i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Actor"}),i.jsx("span",{className:"sys-detail-value",children:M.actorName??"system"})]}),i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Workspace"}),i.jsx("span",{className:"sys-detail-value",children:M.workspaceRoot??"Not attached"})]}),i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Thread"}),i.jsx("span",{className:"sys-detail-value",children:M.conversationId??"Not attached"})]}),i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Record id"}),i.jsx("code",{className:"sys-detail-value",children:M.id})]})]}),M.conversationId&&i.jsx("div",{className:"sys-inline-actions",children:i.jsx("button",{type:"button",className:"s-btn s-btn-sm",onClick:()=>e({view:"conversation",conversationId:M.conversationId}),children:"Open thread"})})]})]},M.id)})})]})}function jr(e){const t=e?.trim();if(!t)return null;const[n]=t.split(".");return n?.trim()||t}function yF(e){const t=e.handle?.trim().replace(/^@+/,"");if(t)return`@${t}`;const n=e.selector?.trim();if(n)return n;const a=jr(e.id);return a?`@${a}`:null}function xF(e){return e.name?.trim()||e.agentName?.trim()||jr(e.id)||e.title?.trim()||"Conversation"}function Xp(e){return e?e.replace(/_/g," "):null}function bF({values:e}){return i.jsx("span",{className:"s-agent-token-list",children:e.map(t=>i.jsx("span",{className:"s-agent-token",children:t},t))})}function hd({title:e,items:t}){return t.length===0?null:i.jsxs("section",{className:"s-agent-profile-card",children:[i.jsx("div",{className:"s-agent-profile-card-header",children:i.jsx("div",{className:"s-agent-profile-card-title",children:e})}),i.jsx("div",{className:"s-agent-meta-card-body",children:t.map(n=>i.jsxs("div",{className:"s-agent-meta-row",children:[i.jsx("span",{className:"s-agent-meta-label",children:n.label}),i.jsx("span",{className:"s-agent-meta-value",children:n.value})]},n.label))})]})}function wF({conversationId:e,navigate:t}){const{agents:n}=St(),[a,o]=v.useState(null),[l,u]=v.useState(null),f=hA(e),m=v.useCallback(async()=>{u(null);try{const C=await Ce(`/api/session/${encodeURIComponent(e)}`).catch(()=>null);o(C)}catch(C){u(C instanceof Error?C.message:String(C)),o(null)}},[e]);v.useEffect(()=>{m()},[m]),fn(()=>{m()});const h=a?.agentId??f,p=v.useMemo(()=>h?n.find(C=>C.id===h)??null:null,[n,h]);if(!p)return i.jsxs("div",{children:[i.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"conversation",conversationId:e}),children:"← Back"}),l&&i.jsx("p",{className:"s-error",children:l}),i.jsx("div",{className:"s-empty",children:i.jsx("p",{children:"Agent not found"})})]});const y=yF(p),b=[{label:"System ID",value:p.id},{label:"Class",value:Xp(p.agentClass)??"—"},...p.role?[{label:"Role",value:p.role}]:[],...p.selector&&p.selector!==y?[{label:"Selector",value:p.selector}]:[]],w=[...p.project?[{label:"Project",value:p.project}]:[],...p.branch?[{label:"Branch",value:p.branch}]:[],...p.projectRoot?[{label:"Path",value:p.projectRoot}]:[],...p.cwd?[{label:"Working dir",value:p.cwd}]:[]],j=[...p.harness?[{label:"Harness",value:p.harness}]:[],...p.transport?[{label:"Transport",value:Xp(p.transport)??p.transport}]:[],...p.wakePolicy?[{label:"Wake policy",value:Xp(p.wakePolicy)??p.wakePolicy}]:[],...p.capabilities.length>0?[{label:"Capabilities",value:i.jsx(bF,{values:p.capabilities})}]:[]],N=[{label:"Thread ID",value:e},...a?.workspaceRoot?[{label:"Workspace",value:a.workspaceRoot}]:[],...a?.currentBranch?[{label:"Session branch",value:a.currentBranch}]:[],...a?.messageCount!=null?[{label:"Messages",value:String(a.messageCount)}]:[],...a?.lastMessageAt?[{label:"Last message",value:ai(a.lastMessageAt)}]:[],...p.harnessSessionId?[{label:"Harness session",value:p.harnessSessionId}]:[],...p.harnessLogPath?[{label:"Harness log",value:p.harnessLogPath}]:[]];return i.jsxs("div",{className:"s-agent-profile-page",children:[i.jsxs("div",{className:"s-agent-profile-page-topbar",children:[i.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"conversation",conversationId:e}),children:"← Conversation"}),i.jsx("button",{type:"button",className:"s-btn",onClick:()=>t({view:"agents",agentId:p.id}),children:"Open in Agents"})]}),l&&i.jsx("p",{className:"s-error",children:l}),i.jsxs("section",{className:"s-agent-profile-hero",children:[i.jsx("div",{className:"s-agent-profile-hero-main",children:i.jsxs("div",{className:"s-agent-profile-hero-title-row",children:[i.jsx("div",{className:"s-avatar s-agent-profile-hero-avatar",style:{background:ct(p.name)},children:p.name[0].toUpperCase()}),i.jsxs("div",{className:"s-agent-profile-hero-copy",children:[i.jsxs("div",{className:"s-agent-casefile-title-meta",children:[i.jsx("span",{className:"s-agent-casefile-record",children:y??jr(p.id)??p.id}),i.jsxs("span",{className:`s-agent-state-chip s-agent-state-chip-${ft(p.state)}`,children:[i.jsx("span",{className:"s-dot",style:{background:Oa(p.state)}}),Vs(p.state)]})]}),i.jsx("h1",{className:"s-agent-profile-hero-title",children:p.name}),i.jsxs("p",{className:"s-agent-profile-hero-context",children:[a?.title?`Conversation: ${a.title}.`:"Attached to the current conversation.",p.updatedAt?` Updated ${Pe(p.updatedAt)}.`:""]})]})]})}),i.jsx("div",{className:"s-agent-profile-hero-actions",children:i.jsx("button",{type:"button",className:"s-btn s-btn-primary",onClick:()=>t({view:"conversation",conversationId:e}),children:"Open conversation"})})]}),i.jsxs("div",{className:"s-agent-profile-grid",children:[i.jsx(hd,{title:"Identity",items:b}),i.jsx(hd,{title:"Workspace",items:w}),i.jsx(hd,{title:"Runtime",items:j}),i.jsx(hd,{title:"Conversation context",items:N})]})]})}function jF(e){return e.attention==="interrupt"?"failed":e.state==="done"?"completed":e.attention==="badge"||e.state==="waiting"||e.state==="review"?"updated":"working"}function SF(e){switch(e){case"review":return"In review";case"waiting":return"Waiting";case"working":return"Working";case"done":return"Done";default:return e.replace(/_/g," ")}}function NF(e){switch(e){case"badge":return"Needs attention";case"interrupt":return"Blocked";default:return null}}function BS({items:e,navigate:t,emptyTitle:n,emptyDetail:a}){if(e.length===0){const o=[{titleWidth:"56%",metaWidths:["18%","14%","16%"],summaryWidth:"74%"},{titleWidth:"48%",metaWidths:["16%","20%","12%"],summaryWidth:"62%"}];return i.jsxs("div",{className:"s-work-empty-state",children:[i.jsxs("div",{className:"s-work-empty-copy",children:[i.jsx("p",{className:"s-work-empty-kicker",children:"Quiet for now"}),i.jsx("p",{className:"s-work-empty-title",children:n}),a&&i.jsx("p",{className:"s-work-empty-detail",children:a})]}),i.jsx("div",{className:"s-work-empty-skeleton","aria-hidden":"true",children:o.map((l,u)=>i.jsxs("div",{className:"s-work-empty-row",children:[i.jsxs("div",{className:"s-work-empty-row-header",children:[i.jsx("span",{className:"s-work-empty-line s-work-empty-line-title",style:{width:l.titleWidth}}),i.jsx("span",{className:"s-work-empty-pill"})]}),i.jsx("div",{className:"s-work-empty-row-meta",children:l.metaWidths.map(f=>i.jsx("span",{className:"s-work-empty-line s-work-empty-line-meta",style:{width:f}},f))}),i.jsx("span",{className:"s-work-empty-line s-work-empty-line-summary",style:{width:l.summaryWidth}})]},u))})]})}return i.jsx("div",{className:"s-work-list",children:e.map(o=>{const l=!!o.id||!!o.conversationId,u=NF(o.attention),f=o.ownerName??o.ownerId??"Unassigned",m=o.id?()=>t({view:"work",workId:o.id}):o.conversationId?()=>t({view:"conversation",conversationId:o.conversationId}):void 0;return i.jsxs("div",{className:`s-work-row${l?" s-work-row-clickable":""}`,onClick:m,children:[i.jsxs("div",{className:"s-work-row-header",children:[i.jsxs("div",{className:"s-work-row-title-wrap",children:[i.jsx("span",{className:"s-work-row-title",children:o.title}),o.priority&&i.jsx("span",{className:"s-badge",children:o.priority})]}),i.jsx("span",{className:`s-pill s-pill-${jF(o)}`,children:o.currentPhase})]}),i.jsxs("div",{className:"s-work-row-meta",children:[i.jsx("span",{children:f}),i.jsx("span",{children:SF(o.state)}),o.activeChildWorkCount>0&&i.jsxs("span",{children:[o.activeChildWorkCount," child",o.activeChildWorkCount===1?"":"ren"]}),o.activeFlightCount>0&&i.jsxs("span",{children:[o.activeFlightCount," flight",o.activeFlightCount===1?"":"s"]}),u&&i.jsx("span",{children:u}),i.jsx("span",{children:Pe(o.lastMeaningfulAt)})]}),o.lastMeaningfulSummary&&i.jsx("p",{className:"s-work-row-summary",children:Es(o.lastMeaningfulSummary)})]},o.id)})})}const kA="/api",kF=`${kA}/health`,EF=`${kA}/terminal/run`,EA="/ws/terminal",CF=`${EA}/health`,TF="/ws/hmr";function AF(e,t){if(typeof e!="string")return t;const n=e.trim();return n&&`${n.startsWith("/")?"":"/"}${n}`.replace(/\/{2,}/g,"/").replace(/\/+$/g,"")||t}const MF={healthPath:kF,terminalRunPath:EF,terminalRelayPath:EA,terminalRelayHealthPath:CF,viteHmrPath:TF};function CA(){return typeof window>"u"?null:window.__OPENSCOUT_WEB_BOOTSTRAP__??null}function RF(){const e=CA()?.theme;return typeof e=="string"?e:null}function zc(e){return AF(CA()?.routes?.[e],MF[e])}function TA(){const e=zc("terminalRelayPath");return typeof window>"u"?`ws://localhost:3200${e}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${e}`}function AA(){const e=zc("terminalRelayHealthPath");return typeof window>"u"?`http://localhost:3200${e}`:`${window.location.protocol}//${window.location.host}${e}`}const MA="scout:sessions:lastViewed";function Cy(){if(typeof localStorage>"u")return{};try{const e=localStorage.getItem(MA);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function _F(e,t=Date.now()){const n=Cy();n[e]=t;try{localStorage.setItem(MA,JSON.stringify(n))}catch{}return n}function Jp(e,t,n){return e?e>(n[t]??0):!1}async function OF(e){await fetch(zc("terminalRunPath"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})})}const lv=new Set(["completed","failed","cancelled"]),IF={direct:"Direct message",channel:"Channel",group_direct:"Group",thread:"Thread"},VS=[{command:"/ask",label:"/ask",description:"Ask the agent owned work with a reply",insert:"/ask "},{command:"/tell",label:"/tell",description:"Send a heads-up or quick message",insert:"/tell "},{command:"/steer",label:"/steer",description:"Steer the active turn mid-flight",insert:"/steer "},{command:"/route",label:"/route",description:"Route this to another agent",insert:"/route @"},{command:"/inbox",label:"/inbox",description:"Go to the inbox",insert:"/inbox"},{command:"/agents",label:"/agents",description:"Open the agents list",insert:"/agents"},{command:"/fleet",label:"/fleet",description:"Open the fleet view",insert:"/fleet"},{command:"/sessions",label:"/sessions",description:"Browse sessions",insert:"/sessions"},{command:"/mesh",label:"/mesh",description:"Open the mesh view",insert:"/mesh"},{command:"/activity",label:"/activity",description:"Open activity feed",insert:"/activity"},{command:"/settings",label:"/settings",description:"Open settings",insert:"/settings"}];function RA(e,t){if(t<=0)return!0;const n=e[t-1];return!n||/\s/.test(n)}function DF(e,t){if(t===0)return null;let n=t-1;for(;n>=0;){const o=e[n];if(o==="/")break;if(!o||/\s/.test(o))return null;n-=1}if(n<0||e[n]!=="/"||!RA(e,n))return null;const a=e.slice(n+1,t);return/[^a-zA-Z0-9_-]/.test(a)?null:{start:n,query:a}}function zF(e,t){if(t===0)return null;let n=t-1;for(;n>=0;){const o=e[n];if(o==="@")break;if(!o||/\s/.test(o))return null;n-=1}if(n<0||e[n]!=="@"||!RA(e,n))return null;const a=e.slice(n+1,t);return/[^a-zA-Z0-9._/:-]/.test(a)?null:{start:n,query:a}}function Xn(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?null:e<1e12?e*1e3:e}function PF(e){if(!e)return null;const t=e.replace(/[\\/]+$/,"");return t?t.split(/[\\/]/).filter(Boolean).at(-1)??t:null}function LF(e){return e.kind==="direct"&&e.agentName?e.agentName:e.kind==="direct"&&e.agentId?jr(e.agentId)??e.agentId:e.title.replace(/\s*<>\s*/g," · ")}function Qp(e){const t=Xn(e);return t===null?"":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function $F(e,t){const n=Xn(e),a=Xn(t);if(n===null||a===null)return!1;const o=new Date(n),l=new Date(a);return o.getFullYear()===l.getFullYear()&&o.getMonth()===l.getMonth()&&o.getDate()===l.getDate()}function HS(e){const t=Xn(e);if(t===null)return"";const n=new Date(t),a=new Date,o=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),l=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),u=1440*60*1e3;return l===o?"Today":l===o-u?"Yesterday":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}).format(t)}function UF(e){switch(e){case"status":return"Status";case"system":return"System";case"scout.dispatch":return"Dispatch";default:return null}}function md(e){return[...e].sort((t,n)=>(Xn(t.createdAt)??0)-(Xn(n.createdAt)??0))}function BF(e){return e.filter(t=>!lv.has(t.state)).sort((t,n)=>(Xn(n.startedAt)??0)-(Xn(t.startedAt)??0))[0]??null}function FS(e,t,n){return{id:e.id,invocationId:e.invocationId,agentId:e.targetAgentId||n,agentName:null,conversationId:t,collaborationRecordId:null,state:e.state,summary:e.summary??null,startedAt:e.startedAt??null,completedAt:e.completedAt??null}}function VF(e){const t=e.metadata?.scoutDispatch;if(!t||typeof t!="object")return null;const n=t;return!n.id||!n.kind||!Array.isArray(n.candidates)?null:n}function cv(e,t){if(e.class==="operator")return!0;const n=e.actorName?.toLowerCase()??"";return n===t.toLowerCase()||n==="operator"||n==="you"}function HF(e,t){return e.reduce((n,a)=>{if(cv(a,t))return n;const o=Xn(a.createdAt);return o===null?n:n===null||o>n?o:n},null)}function FF(e,t){switch(t){case"queued":return`${e} has your message and is waiting to start.`;case"waking":return`${e} is waking up now.`;case"waiting":return`${e} is thinking through the request.`;case"running":return`${e} is working on your request.`;default:return`${e} is working on it.`}}function ZF(e){const{agentName:t,agentState:n,sending:a,currentFlight:o,showWorkingTurn:l}=e;if(a&&!o)return{label:"Sending",detail:`Handing your message to ${t}.`,tone:"pending",showStrip:!0,showTyping:!1};if(o&&l){const u=o.summary?.trim()||FF(t,o.state);switch(o.state){case"queued":return{label:"Queued",detail:u,tone:"pending",showStrip:!0,showTyping:!0};case"waking":return{label:"Coming online",detail:u,tone:"working",showStrip:!0,showTyping:!0};case"waiting":return{label:"Thinking",detail:u,tone:"working",showStrip:!0,showTyping:!0};default:return{label:"Working",detail:u,tone:"working",showStrip:!0,showTyping:!0}}}return gi(n)?{label:"Available",detail:`${t} is connected.`,tone:"idle",showStrip:!1,showTyping:!1}:{label:"Offline",detail:`${t} is offline right now. Sending a message will wake it up.`,tone:"offline",showStrip:!0,showTyping:!1}}function qF(e,t){switch(e.tone){case"pending":return"var(--accent)";case"working":return"var(--green)";case"offline":return"var(--dim)";default:return Oa(t)}}function WF(){return i.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"m3 11 18-8-8 18-2.8-7.2L3 11Z"}),i.jsx("path",{d:"M10.2 13.8 21 3"})]})}function YF(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}function GF(e){if(!e)return null;if(e.kind==="direct")return e.agentName??jr(e.agentId)??null;const t=e.participantIds.filter(n=>n!=="operator");return t.length===0?null:t.map(n=>jr(n)??n).join(", ")}function uv({conversationId:e,initialComposeMode:t,navigate:n,embedded:a}){const{agents:o}=St(),[l,u]=v.useState(null),[f,m]=v.useState([]),[h,p]=v.useState(null),[y,b]=v.useState([]),[w,j]=v.useState(null),N=v.useRef(null),C=v.useRef(null),k=v.useRef(new Set),E=v.useRef(null),S=v.useRef(0),R=hA(e),A=l?.agentId??R,M=l?.kind==="direct"||R!==null,D=v.useMemo(()=>A?o.find(ee=>ee.id===A)??null:null,[o,A]),[U,F]=v.useState([]),[P,_]=v.useState(new Set),[z]=v.useState(()=>Cy());v.useEffect(()=>{Ce("/api/sessions").then(ee=>F(ee.sort((me,ve)=>(ve.lastMessageAt??0)-(me.lastMessageAt??0)))).catch(()=>{}),Ce("/api/fleet").then(ee=>{const me=new Set;for(const ve of ee.needsAttention)ve.conversationId&&me.add(ve.conversationId),ve.agentId&&me.add(ve.agentId);for(const ve of ee.activeAsks)ve.status==="needs_attention"&&ve.conversationId&&me.add(ve.conversationId);_(me)}).catch(()=>{})},[]);const B=v.useCallback(async()=>{j(null);try{const ee=await Ce(`/api/session/${encodeURIComponent(e)}`).catch(()=>null);u(ee);const me=ee?.agentId??R,ve=ee?.kind==="direct"&&me&&me.startsWith("local-session-agent-")?Jn(me):e;if(ve!==e){n({view:"conversation",conversationId:ve,...t?{composeMode:t}:{}});return}const[Ve,Le]=await Promise.all([Ce(`/api/messages?conversationId=${encodeURIComponent(ve)}&limit=300`),Ce(`/api/flights?conversationId=${encodeURIComponent(ve)}`)]);m(md(Ve)),b(Le),k.current=new Set(Le.map(dt=>dt.invocationId)),p(BF(Le))}catch(ee){j(ee instanceof Error?ee.message:String(ee))}},[e,t,R,n]);v.useEffect(()=>{B()},[B]);const[V,K]=v.useState(null),[L,H]=v.useState(!1);v.useEffect(()=>{if(!A)return;let ee=!1;return Ce(`/api/agents/${encodeURIComponent(A)}/session-catalog`).then(me=>{ee||K(me)}).catch(()=>{}),()=>{ee=!0}},[A]),v.useEffect(()=>{E.current=h},[h]);const[$,G]=v.useState(""),[X,O]=v.useState(!1),[Z,W]=v.useState("operator"),[Q,ce]=v.useState({open:!1,query:"",triggerStart:-1,index:0}),[ae,ge]=v.useState({open:!1,query:"",triggerStart:-1,index:0}),[ye,be]=v.useState(null),[Oe,fe]=v.useState(t==="ask"?"ask":"tell");v.useEffect(()=>{fe(M&&t==="ask"?"ask":"tell")},[e,t,M]);const xe=v.useMemo(()=>{const ee=new Set,me=[];for(const ve of o){const Ve=ve.handle?.trim().replace(/^@+/,"")??jr(ve.id)??ve.id;if(!Ve)continue;const Le=Ve.toLowerCase();ee.has(Le)||(ee.add(Le),me.push({id:ve.id,label:Ve,name:ve.name??Ve,handle:Ve}))}return me.sort((ve,Ve)=>ve.handle.localeCompare(Ve.handle))},[o]),we=v.useMemo(()=>{if(!Q.open)return[];const ee=Q.query.toLowerCase();return ee?VS.filter(me=>me.command.toLowerCase().startsWith("/"+ee)||me.command.toLowerCase().includes(ee)):VS},[Q.open,Q.query]),ze=v.useMemo(()=>{if(!ae.open)return[];const ee=ae.query.toLowerCase();return ee?xe.filter(me=>me.handle.toLowerCase().includes(ee)||me.name.toLowerCase().includes(ee)).slice(0,8):xe.slice(0,8)},[ae.open,ae.query,xe]),Me=v.useCallback(()=>{ce(ee=>ee.open?{...ee,open:!1}:ee),ge(ee=>ee.open?{...ee,open:!1}:ee)},[]),je=v.useCallback((ee,me)=>{const ve=DF(ee,me);ce(ve?Le=>({open:!0,query:ve.query,triggerStart:ve.start,index:Le.open&&Le.triggerStart===ve.start?Le.index:0}):Le=>Le.open?{...Le,open:!1}:Le);const Ve=zF(ee,me);ge(Ve?Le=>({open:!0,query:Ve.query,triggerStart:Ve.start,index:Le.open&&Le.triggerStart===Ve.start?Le.index:0}):Le=>Le.open?{...Le,open:!1}:Le)},[]),Ne=v.useCallback(ee=>{const me=C.current,ve=Q.triggerStart;if(ve<0)return;const Ve=me?.selectionStart??$.length,Le=$.slice(0,ve),dt=$.slice(Ve),Lt=ee.insert,Zt=`${Le}${Lt}${dt}`;G(Zt),ce(bn=>({...bn,open:!1})),requestAnimationFrame(()=>{const bn=C.current;if(!bn)return;const qt=Le.length+Lt.length;bn.focus(),bn.setSelectionRange(qt,qt)})},[$,Q.triggerStart]),We=v.useCallback(ee=>{const me=C.current,ve=ae.triggerStart;if(ve<0)return;const Ve=me?.selectionStart??$.length,Le=$.slice(0,ve),dt=$.slice(Ve),Lt=dt.length===0||!dt.startsWith(" "),Zt=`@${ee.handle}${Lt?" ":""}`,bn=`${Le}${Zt}${dt}`;G(bn),ge(qt=>({...qt,open:!1})),requestAnimationFrame(()=>{const qt=C.current;if(!qt)return;const Ms=Le.length+Zt.length;qt.focus(),qt.setSelectionRange(Ms,Ms)})},[$,ae.triggerStart]);v.useEffect(()=>{const ee=C.current;if(!ee)return;ee.style.height="0px";const me=Math.min(Math.max(ee.scrollHeight,40),160);ee.style.height=`${me}px`,ee.style.overflowY=ee.scrollHeight>me?"auto":"hidden"},[$]),v.useEffect(()=>{Ce("/api/user").then(ee=>W(ee.name)).catch(()=>{})},[]);const Be=v.useMemo(()=>HF(f,Z),[f,Z]);v.useEffect(()=>{ye===null||Be===null||Be>=ye&&be(null)},[ye,Be]);const He=v.useMemo(()=>!h||lv.has(h.state)?!1:(Xn(h.startedAt)??ye??Date.now())>=(Be??0),[ye,h,Be]),le=X||ye!==null||He,he=xF({name:D?.name,agentName:l?.agentName,id:A,title:l?.title}),pe=v.useMemo(()=>ZF({agentName:he,agentState:D?.state??null,sending:X,currentFlight:h,showWorkingTurn:He}),[D?.state,he,h,X,He]),ke=l?LF(l):he,Ee=l?.kind?IF[l.kind]??l.kind:"Conversation";GF(l);const Je=PF(l?.workspaceRoot),et=l?.lastMessageAt??f[f.length-1]?.createdAt??null,Ye=[Je?{label:Je,title:l?.workspaceRoot??void 0}:null,l?.currentBranch?{label:l.currentBranch,title:l.currentBranch}:null,D?.harness??l?.harness?{label:D?.harness??l?.harness??"",title:void 0}:null].filter(ee=>!!ee),Bt=l?l.participantIds.length:M?2:1,Et=v.useMemo(()=>(!P.has(e)&&!(A&&P.has(A)),null),[e,A,P]);fn(v.useCallback(ee=>{if(ee.kind==="message.posted"){const me=ee.payload?.message;if(!me||me.conversationId!==e)return;const ve=me.actorId===A,Ve={id:me.id,conversationId:me.conversationId,actorName:ve?he:Z,body:me.body,createdAt:me.createdAt,class:ve?me.class:"operator"};if(m(Le=>{if(Le.some(dt=>dt.id===me.id))return Le;if(!ve){const dt=Le.findIndex(Lt=>Lt.id.startsWith("optimistic-")&&Lt.body===me.body&&Math.abs((Xn(Lt.createdAt)??0)-(Xn(me.createdAt)??0))<=6e4);if(dt!==-1){const Lt=[...Le];return Lt[dt]=Ve,md(Lt)}}return md([...Le,Ve])}),ve){const Le=Xn(me.createdAt)??Date.now();be(dt=>dt===null||Le<dt?dt:null),p(dt=>{if(!dt)return dt;const Lt=Xn(dt.startedAt)??0;return Le>=Lt?null:dt})}return}if(ee.kind==="invocation.requested"){const me=ee.payload?.invocation;if(!me||me.targetAgentId!==A||me.conversationId!==e)return;k.current.add(me.id),be(ve=>ve??Date.now());return}if(ee.kind==="flight.updated"){const me=ee.payload?.flight;if(!me||me.targetAgentId!==A||!(k.current.has(me.invocationId)||E.current?.id===me.id))return;if(lv.has(me.state)){p(Ve=>Ve?.id===me.id?null:Ve),B();return}k.current.add(me.invocationId),p(FS(me,e,A??""));return}ee.kind!=="agent.endpoint.upserted"&&ee.kind==="unknown"&&B()},[A,he,e,B,Z])),v.useEffect(()=>{if(!le)return;const ee=setInterval(()=>{B()},5e3);return()=>clearInterval(ee)},[le,B]),v.useEffect(()=>{const ee=()=>{if(document.visibilityState!=="visible")return;const me=Date.now();me-S.current<1e3||(S.current=me,B())};return window.addEventListener("focus",ee),document.addEventListener("visibilitychange",ee),()=>{window.removeEventListener("focus",ee),document.removeEventListener("visibilitychange",ee)}},[B]);const hn=f.length+(pe.showTyping?1:0),mn=v.useRef(0);v.useEffect(()=>{hn>mn.current&&N.current?.scrollIntoView({behavior:"smooth"}),mn.current=hn},[hn]);const[,on]=v.useState(0);v.useEffect(()=>{const ee=setInterval(()=>on(me=>me+1),15e3);return()=>clearInterval(ee)},[]);const Ie=async(ee,me)=>{const ve=ee.trim();if(!ve||X)return;const Ve=me?.forceMode??Oe,Le=M?le?"steer":Ve:"tell",dt=Date.now(),Lt={id:`optimistic-${dt}`,conversationId:e,actorName:Z,body:ve,createdAt:dt,class:"operator"};O(!0),be(dt),j(null),m(Zt=>md([...Zt,Lt]));try{const Zt=await Ce(Le==="ask"?"/api/ask":"/api/send",{method:"POST",body:JSON.stringify({body:ve,conversationId:e})});Zt.flight&&(k.current.add(Zt.flight.invocationId),p(FS(Zt.flight,e,A??"")))}catch(Zt){m(bn=>bn.filter(qt=>qt.id!==Lt.id)),be(null),j(Zt instanceof Error?Zt.message:String(Zt))}finally{O(!1)}},tt=async()=>{const ee=$.trim();ee&&(G(""),await Ie(ee))},ut=async()=>{if(A)try{await Ce("/api/agents/"+encodeURIComponent(A)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},xt=pe.tone==="working"||pe.tone==="pending",Pt=M?le?"steer":Oe:"tell",yn=M?"Reply — or type / to route, @ to mention an agent, ? to ask a question":`Message ${he}...`,Kt=!$.trim()&&xt,pn=Yf(),ln=v.useCallback((ee,me)=>{const ve=window.getSelection()?.toString().trim(),Ve=[];ve&&(Ve.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(ve)}),Ve.push({kind:"separator"})),Ve.push({kind:"action",label:"Copy Message",onSelect:()=>navigator.clipboard.writeText(me.body)}),me.actorName&&!cv(me,Z)&&Ve.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(me.actorName??"")}),Ve.push({kind:"separator"}),Ve.push({kind:"action",label:"Copy Message ID",onSelect:()=>navigator.clipboard.writeText(me.id)}),pn(ee,Ve)},[Z,pn]),xn=async(ee,me)=>{const ve=`@${me.agentId} `,Ve=$.trim();if(Ve){G(""),await Ie(`${ve}${Ve}`,{forceMode:"tell"});return}G(ve),C.current?.focus()},As=v.useMemo(()=>l?l.participantIds.filter(ee=>ee!=="operator").slice(0,4).map(ee=>{const me=o.find(ve=>ve.id===ee);return{id:ee,name:me?.name??ee}}):[],[l,o]);return i.jsx("div",{className:`s-thread-layout${a?" s-thread-layout--embedded":""}`,children:i.jsxs("div",{className:"s-thread-center",children:[!a&&i.jsxs("div",{className:"s-thread-center-header",onClick:()=>M?n({view:"agent-info",conversationId:e}):void 0,style:M?{cursor:"pointer"}:void 0,onContextMenu:ee=>{const me=[{kind:"action",label:"Copy Title",onSelect:()=>navigator.clipboard.writeText(ke)}];A&&me.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(A)}),me.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>navigator.clipboard.writeText(e)}),pn(ee,me)},children:[i.jsxs("div",{className:"s-thread-center-header-info",children:[i.jsx("span",{className:"s-thread-center-header-name",children:ke}),i.jsxs("div",{className:"s-thread-center-header-eyebrow",children:[i.jsx("span",{className:"s-thread-center-header-kicker",children:Ee}),et&&i.jsx("span",{className:"s-thread-center-header-time",title:Qp(et),children:Pe(et)})]})]}),i.jsxs("div",{className:"s-thread-center-header-right",children:[Ye.length>0&&i.jsx("div",{className:"s-thread-center-header-chips",children:Ye.map((ee,me)=>i.jsx("span",{className:"s-thread-center-chip",title:ee.title,children:ee.label},`${ee.label}-${me}`))}),As.length>0&&i.jsxs("div",{className:"s-thread-center-avatars",children:[As.map(ee=>i.jsx("div",{className:"s-ops-avatar",style:{"--size":"22px",background:ct(ee.name)},title:ee.name,children:ee.name[0]?.toUpperCase()??"?"},ee.id)),i.jsx("span",{className:"s-thread-center-participant-count",children:Bt})]})]})]}),Et&&i.jsxs("div",{className:"s-thread-pinned-ask",children:[i.jsx("div",{className:"s-thread-pinned-ask-label",children:"Pinned ask · Awaiting operator"}),i.jsx("div",{className:"s-thread-pinned-ask-body",children:Et.task}),i.jsxs("div",{className:"s-thread-pinned-ask-routing",children:[i.jsx("span",{children:Et.agentName??jr(Et.agentId)??Et.agentId}),i.jsx("span",{className:"s-thread-pinned-ask-routing-arrow",children:"→"}),i.jsx("span",{children:"You"})]}),i.jsxs("div",{className:"s-thread-pinned-ask-actions",children:[i.jsx("button",{type:"button",className:"s-ops-btn s-ops-btn--primary",onClick:()=>{C.current?.focus()},children:"Answer"}),i.jsx("button",{type:"button",className:"s-ops-btn",children:"Defer"}),i.jsx("button",{type:"button",className:"s-ops-btn",children:"Route"})]}),i.jsx("div",{className:"s-thread-pinned-ask-strip"})]}),pe.showStrip&&i.jsxs("div",{className:`s-thread-status s-thread-status--${pe.tone}`,"aria-live":"polite",children:[i.jsx("span",{className:"s-thread-status-dot",style:{background:qF(pe,D?.state??null)}}),i.jsxs("div",{className:"s-thread-status-copy",children:[i.jsx("span",{className:"s-thread-status-label",children:pe.label}),i.jsx("span",{className:"s-thread-status-detail",children:pe.detail})]})]}),!a&&M&&D&&(D.harnessSessionId||D.harnessLogPath||V?.activeSessionId)&&i.jsxs("details",{className:"s-thread-meta-disclosure",children:[i.jsx("summary",{className:"s-thread-meta-toggle",children:"Session details"}),i.jsxs("div",{className:"s-thread-meta-block",children:[V?.activeSessionId&&i.jsxs("div",{className:"s-thread-meta-row",children:[i.jsx("span",{className:"s-thread-meta-row-label",children:"Session ID"}),i.jsx("span",{className:"s-thread-meta-row-value s-thread-meta-row-value--accent",title:V.activeSessionId,children:V.activeSessionId.slice(0,8)})]}),V?.resumeCommand&&i.jsxs("div",{className:"s-thread-meta-row",children:[i.jsx("span",{className:"s-thread-meta-row-label",children:"Takeover"}),i.jsx("span",{className:"s-thread-meta-row-value",children:i.jsx("button",{type:"button",className:"s-thread-meta-takeover-btn",title:V.resumeCommand,onClick:()=>{OF(V.resumeCommand).then(()=>n({view:"terminal",agentId:A??void 0})),H(!0)},children:L?"Going…":`Takeover — ${V.resumeCommand}`})})]}),D.harnessSessionId&&i.jsxs("div",{className:"s-thread-meta-row",children:[i.jsx("span",{className:"s-thread-meta-row-label",children:"Harness Session"}),i.jsx("span",{className:"s-thread-meta-row-value",children:D.harnessSessionId})]}),D.harnessLogPath&&i.jsxs("div",{className:"s-thread-meta-row",children:[i.jsx("span",{className:"s-thread-meta-row-label",children:"Harness Log"}),i.jsx("span",{className:"s-thread-meta-row-value",children:D.harnessLogPath})]})]})]}),w&&i.jsx("p",{className:"s-thread-error",children:w}),i.jsxs("div",{className:"s-thread-feed",children:[i.jsx("div",{className:"s-thread-feed-spacer"}),f.length===0?i.jsxs("div",{className:"s-thread-empty",children:[i.jsx("p",{children:"No messages yet"}),i.jsx("p",{children:M?"Use Tell for quick coordination or Ask for owned work with a reply.":"Start the thread below."})]}):f.map((ee,me)=>{const ve=cv(ee,Z),Ve=VF(ee),Le=Ve?"scout.dispatch":ee.class,dt=UF(Le),Lt=Le==="status",Zt=me===0||!$F(f[me-1]?.createdAt,ee.createdAt),bn=Qp(ee.createdAt),qt=!ve&&ee.actorName?o.find(cn=>cn.name===ee.actorName)??null:null,Ms=ve?Z.toLowerCase():qt?.handle??null;return i.jsxs("div",{className:["s-thread-feed-block",ve&&"s-thread-feed-block--you",Zt&&"s-thread-feed-block--full-width"].filter(Boolean).join(" "),children:[Zt&&i.jsxs("div",{className:"s-thread-day-divider","aria-label":HS(ee.createdAt),children:[i.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"}),i.jsx("span",{className:"s-thread-day-label",children:HS(ee.createdAt)}),i.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"})]}),i.jsx("article",{id:`msg-${ee.id}`,className:["s-thread-msg",ve&&"s-thread-msg--you",Lt&&"s-thread-msg--tool"].filter(Boolean).join(" "),"data-class":Le,onContextMenu:cn=>ln(cn,ee),children:i.jsxs("div",{className:"s-thread-msg-card s-thread-msg-card--avatar-row",children:[i.jsx("div",{className:"s-ops-avatar s-thread-msg-avatar",style:{"--size":"28px",background:ct(ve?Z:ee.actorName??"?")},children:(ve?Z[0]:ee.actorName?.[0]??"?").toUpperCase()}),i.jsxs("div",{className:"s-thread-msg-card-content",children:[i.jsxs("div",{className:"s-thread-msg-header",children:[i.jsxs("div",{className:"s-thread-msg-meta",children:[i.jsx("span",{className:"s-thread-msg-actor",children:ve?Z:ee.actorName}),Ms&&i.jsxs("span",{className:"s-thread-msg-handle",children:["@",Ms]}),dt&&i.jsx("span",{className:"s-thread-msg-kind",children:dt})]}),i.jsx("span",{className:"s-thread-msg-time",title:bn,children:Pe(ee.createdAt)}),i.jsx("button",{type:"button",className:"s-thread-msg-permalink","aria-label":"Copy link to message",title:"Copy link to message",onClick:()=>{const cn=`${window.location.origin}${window.location.pathname}#msg-${ee.id}`;navigator.clipboard.writeText(cn)},children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[i.jsx("path",{d:"M6.5 9.5a2.5 2.5 0 0 0 3.54 0l2.12-2.12a2.5 2.5 0 0 0-3.54-3.54l-.7.7"}),i.jsx("path",{d:"M9.5 6.5a2.5 2.5 0 0 0-3.54 0L3.84 8.62a2.5 2.5 0 0 0 3.54 3.54l.7-.7"})]})})]}),i.jsx("div",{className:"s-thread-msg-body",title:bn,children:Es(ee.body)}),Ve&&Ve.candidates.length>0&&i.jsx("div",{className:"s-thread-dispatch",children:Ve.candidates.map(cn=>i.jsxs("button",{type:"button",className:"s-thread-dispatch-tile",onClick:()=>{xn(Ve,cn)},children:[i.jsxs("span",{className:"s-thread-dispatch-tile-id",children:["@",cn.agentId]}),i.jsx("span",{className:"s-thread-dispatch-tile-state",children:cn.endpointState}),i.jsx("span",{className:"s-thread-dispatch-tile-meta",children:[cn.workspace,cn.node,cn.projectRoot].filter(Boolean).join(" · ")||cn.displayName})]},cn.agentId))})]})]})})]},ee.id)}),pe.showTyping&&i.jsx("div",{className:"s-thread-feed-block",children:i.jsx("div",{className:"s-thread-msg","aria-live":"polite",children:i.jsxs("div",{className:"s-thread-msg-card s-thread-msg-working-card s-thread-msg-card--avatar-row",children:[i.jsx("div",{className:"s-ops-avatar s-thread-msg-avatar",style:{"--size":"28px",background:ct(he)},children:he[0]?.toUpperCase()??"?"}),i.jsxs("div",{className:"s-thread-msg-card-content",children:[i.jsxs("div",{className:"s-thread-msg-header",children:[i.jsxs("div",{className:"s-thread-msg-meta",children:[i.jsx("span",{className:"s-thread-msg-actor",children:he}),i.jsx("span",{className:"s-thread-msg-kind",children:"Live"})]}),i.jsx("span",{className:"s-thread-msg-time",title:h?.startedAt?Qp(h.startedAt):"now",children:h?.startedAt?Pe(h.startedAt):"now"})]}),i.jsxs("div",{className:"s-thread-msg-working-body",children:[i.jsxs("span",{className:"s-thread-typing-indicator","aria-hidden":"true",children:[i.jsx("span",{className:"s-thread-typing-dot"}),i.jsx("span",{className:"s-thread-typing-dot"}),i.jsx("span",{className:"s-thread-typing-dot"})]}),i.jsx("span",{className:"s-thread-msg-working-copy",children:pe.detail})]})]})]})})}),i.jsx("div",{ref:N})]}),pe.showTyping&&i.jsxs("div",{className:"s-thread-presence-line",children:[i.jsx("div",{className:"s-thread-presence-line-avatars",children:i.jsx("div",{className:"s-ops-avatar",style:{"--size":"20px",background:ct(he)},children:he[0]?.toUpperCase()??"?"})}),i.jsxs("span",{className:"s-thread-presence-line-label",children:[he," is ",pe.label.toLowerCase(),"..."]}),i.jsx("div",{className:"s-thread-presence-strip"})]}),i.jsx("form",{className:"s-thread-compose",onSubmit:ee=>{ee.preventDefault(),tt()},children:i.jsxs("div",{className:"s-thread-compose-shell",children:[Q.open&&we.length>0&&i.jsxs("div",{className:"s-thread-compose-suggest",role:"listbox","aria-label":"Slash commands",children:[i.jsx("div",{className:"s-thread-compose-suggest-label",children:"Slash commands"}),we.map((ee,me)=>i.jsxs("button",{type:"button",role:"option","aria-selected":me===Q.index,className:["s-thread-compose-suggest-item",me===Q.index&&"s-thread-compose-suggest-item--active"].filter(Boolean).join(" "),onMouseDown:ve=>{ve.preventDefault(),Ne(ee)},onMouseEnter:()=>ce(ve=>({...ve,index:me})),children:[i.jsx("span",{className:"s-thread-compose-suggest-cmd",children:ee.label}),i.jsx("span",{className:"s-thread-compose-suggest-desc",children:ee.description})]},ee.command))]}),ae.open&&ze.length>0&&i.jsxs("div",{className:"s-thread-compose-suggest",role:"listbox","aria-label":"Mention agents",children:[i.jsx("div",{className:"s-thread-compose-suggest-label",children:"Mention agent"}),ze.map((ee,me)=>i.jsxs("button",{type:"button",role:"option","aria-selected":me===ae.index,className:["s-thread-compose-suggest-item",me===ae.index&&"s-thread-compose-suggest-item--active"].filter(Boolean).join(" "),onMouseDown:ve=>{ve.preventDefault(),We(ee)},onMouseEnter:()=>ge(ve=>({...ve,index:me})),children:[i.jsx("span",{className:"s-ops-avatar s-thread-compose-suggest-avatar",style:{"--size":"20px",background:ct(ee.name)},children:ee.name[0]?.toUpperCase()??"?"}),i.jsxs("span",{className:"s-thread-compose-suggest-cmd",children:["@",ee.handle]}),i.jsx("span",{className:"s-thread-compose-suggest-desc",children:ee.name})]},ee.id))]}),i.jsxs("div",{className:"s-thread-compose-row",children:[i.jsx("textarea",{ref:C,className:"s-thread-compose-input",placeholder:yn,value:$,onChange:ee=>{const me=ee.target.value;G(me),je(me,ee.target.selectionStart)},onSelect:ee=>{const me=ee.currentTarget;je(me.value,me.selectionStart)},onBlur:()=>{setTimeout(Me,120)},onKeyDown:ee=>{if(Q.open&&we.length>0||ae.open&&ze.length>0){if(ee.key==="ArrowDown"){ee.preventDefault(),Q.open?ce(ve=>({...ve,index:(ve.index+1)%we.length})):ae.open&&ge(ve=>({...ve,index:(ve.index+1)%ze.length}));return}if(ee.key==="ArrowUp"){ee.preventDefault(),Q.open?ce(ve=>({...ve,index:(ve.index-1+we.length)%we.length})):ae.open&&ge(ve=>({...ve,index:(ve.index-1+ze.length)%ze.length}));return}if(ee.key==="Escape"){ee.preventDefault(),Me();return}if(ee.key==="Enter"||ee.key==="Tab"){if(ee.shiftKey)return;if(ee.preventDefault(),Q.open){const ve=we[Q.index]??we[0];ve&&Ne(ve)}else if(ae.open){const ve=ze[ae.index]??ze[0];ve&&We(ve)}return}}ee.key!=="Enter"||ee.shiftKey||ee.nativeEvent.isComposing||(ee.preventDefault(),!X&&$.trim()&&tt())},rows:1}),Kt?i.jsx("button",{type:"button",className:"s-thread-compose-send s-thread-compose-send--stop",onClick:()=>{ut()},"aria-label":"Stop agent",children:i.jsx(YF,{})}):i.jsx("button",{type:"submit",className:"s-thread-compose-send",disabled:X||!$.trim(),"aria-label":Pt==="ask"?"Ask agent":Pt==="steer"?"Steer agent":M?"Tell agent":"Send message",children:i.jsx(WF,{})})]})]})})]})})}async function KF(e){await fetch(zc("terminalRunPath"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})})}const _A={think:"var(--dim)",tool:"var(--accent)",ask:"var(--amber)",message:"var(--muted)",note:"var(--green)",system:"var(--dim)",boot:"var(--dim)"},XF={read:"◎",edit:"✎",bash:"$",grep:"⌕",write:"✎",think:"∿"},JF=20,OA=new Intl.NumberFormat("en-US"),QF=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});function eZ(e){const t=Math.floor(e/60),n=Math.floor(e%60);return`${String(t).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function ZS(e,t){return e>=Math.max(0,t-JF)}function Bl(e){return typeof e!="number"||!Number.isFinite(e)?null:OA.format(e)}function ar(e){return typeof e!="number"||!Number.isFinite(e)?"—":Math.abs(e)<1e3?OA.format(e):QF.format(e).toLowerCase()}function tZ(e){if(!Number.isFinite(e)||e<=0)return"0s";if(e<60)return`${Math.round(e)}s`;const t=Math.round(e),n=Math.floor(t/3600),a=Math.floor(t%3600/60),o=t%60;return n>0?`${n}h ${a}m`:a>=10||o===0?`${a}m`:`${a}m ${o}s`}function qS(e){return!!e&&Object.keys(e).length>0}function eg(e){return e.filter(t=>!!t)}function nZ({event:e}){return i.jsxs("div",{children:[i.jsx("div",{className:"s-observe-think-label",children:"thinking"}),i.jsxs("div",{className:"s-observe-think-text",children:["“",e.text,"”",e.live&&i.jsx("span",{className:"s-observe-cursor"})]})]})}function sZ({event:e}){const t=XF[e.tool??""]??"▸",n=!!(e.result||e.diff||e.stream);return i.jsxs("div",{className:"s-observe-tool",children:[i.jsxs("div",{className:`s-observe-tool-header${n?" s-observe-tool-header--has-body":""}`,children:[i.jsx("span",{className:"s-observe-tool-glyph",children:t}),i.jsxs("span",{className:"s-observe-tool-cmd",children:[i.jsx("span",{className:"s-observe-tool-cmd-name",children:e.tool})," ",e.arg]})]}),e.result&&i.jsx("div",{className:"s-observe-tool-result",children:Object.entries(e.result).map(([a,o])=>`${a}: ${o}`).join(" · ")}),e.diff&&i.jsxs("div",{className:"s-observe-tool-diff",children:[i.jsxs("div",{className:"s-observe-tool-diff-stats",children:[i.jsxs("span",{className:"s-observe-tool-diff-add",children:["+",e.diff.add]}),e.diff.del>0&&i.jsxs(i.Fragment,{children:[" ",i.jsxs("span",{className:"s-observe-tool-diff-del",children:["−",e.diff.del]})]})]}),i.jsx("pre",{className:"s-observe-tool-diff-preview",children:e.diff.preview})]}),e.stream&&i.jsx("pre",{className:"s-observe-tool-stream",children:e.stream.join(`
140
- `)})]})}function aZ({event:e}){const t=e.to==="human"?"you":e.to??"?";return i.jsxs("div",{className:"s-observe-ask",children:[i.jsxs("div",{className:"s-observe-ask-label",children:["↗ ask → ",t]}),i.jsxs("div",{className:"s-observe-ask-text",children:["“",e.text,"”"]}),e.answer&&i.jsxs("div",{className:"s-observe-ask-answer",children:[i.jsxs("span",{className:"s-observe-ask-answer-meta",children:["↳ @",e.to??"you"," · +",(e.answerT??e.t)-e.t,"s"]}),i.jsx("div",{className:"s-observe-ask-answer-text",children:e.answer})]})]})}function rZ({event:e}){const t=e.to==="human"?"you":e.to??"?";return i.jsxs("div",{children:[i.jsxs("div",{className:"s-observe-message-label",children:["→ message → ",t]}),i.jsx("div",{className:"s-observe-message-text",children:e.text})]})}function iZ({event:e}){return i.jsxs("div",{className:"s-observe-note",children:[i.jsx("span",{className:"s-observe-note-icon",children:"✓"}),i.jsx("span",{className:"s-observe-note-text",children:e.text})]})}function oZ({event:e}){return i.jsxs("div",{className:"s-observe-system",children:[i.jsx("span",{className:"s-observe-system-arrow",children:"▸ "}),e.text,e.detail&&i.jsx("div",{className:"s-observe-system-detail",children:e.detail})]})}function lZ(){return i.jsxs("div",{className:"s-observe-live",children:[i.jsx("span",{className:"s-observe-live-dot"}),i.jsx("span",{className:"s-observe-live-label",children:"LIVE · tailing session"})]})}function cZ({liveSession:e,isLive:t}){const n=e?t?"live":"paused":"replay",a=e?t?"LIVE · tail mode on":"LIVE · tail paused":"REPLAY · saved trace";return i.jsxs("div",{className:`s-observe-tail-state s-observe-tail-state--${n}`,children:[i.jsx("span",{className:"s-observe-tail-state-dot"}),i.jsx("span",{className:"s-observe-tail-state-label",children:a})]})}function uZ({event:e,prevT:t}){const n=e.t-t,a=_A[e.kind]??"var(--dim)";return i.jsxs("div",{className:"s-observe-row",children:[n>15&&i.jsxs("div",{className:"s-observe-row-gap",children:["+",n,"s"]}),i.jsx("div",{className:"s-observe-row-time",children:eZ(e.t)}),i.jsx("span",{className:"s-observe-row-bead",style:{background:a}}),e.kind==="think"&&i.jsx(nZ,{event:e}),e.kind==="tool"&&i.jsx(sZ,{event:e}),e.kind==="ask"&&i.jsx(aZ,{event:e}),e.kind==="message"&&i.jsx(rZ,{event:e}),e.kind==="note"&&i.jsx(iZ,{event:e}),(e.kind==="system"||e.kind==="boot")&&i.jsx(oZ,{event:e})]})}function dZ({events:e,isLive:t}){const n=v.useRef(null);return v.useEffect(()=>{t&&n.current?.scrollIntoView({behavior:"smooth"})},[e.length,t]),i.jsxs("div",{className:"s-observe-stream",children:[i.jsx("div",{className:"s-observe-spine"}),e.map((a,o)=>i.jsx(uZ,{event:a,prevT:o>0?e[o-1].t:0},a.id)),i.jsx("div",{ref:n})]})}function fZ({data:e,cursor:t}){const o=e.length;if(o<2)return null;const l=276/(o-1),u=e.map((m,h)=>`${h===0?"M":"L"} ${(h*l).toFixed(1)} ${((1-m)*44).toFixed(1)}`).join(" "),f=t*276;return i.jsxs("svg",{viewBox:"0 0 276 44",style:{width:"100%",height:44,display:"block"},children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:"observeCtxFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:.25}),i.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:0})]})}),i.jsx("path",{d:`${u} L 276 44 L 0 44 Z`,fill:"url(#observeCtxFill)"}),i.jsx("path",{d:u,fill:"none",stroke:"var(--accent)",strokeWidth:1.2}),i.jsx("line",{x1:f,y1:0,x2:f,y2:44,stroke:"var(--accent)",strokeWidth:1,opacity:.6,strokeDasharray:"2 3"})]})}function hZ({state:e}){const t=e==="created"?"var(--green)":e==="modified"?"var(--accent)":"var(--dim)",n=e==="created"?"+":e==="modified"?"~":"◎";return i.jsx("span",{className:"s-observe-file-glyph",style:{background:"color-mix(in srgb, var(--bg) 70%, black)",border:`1px solid color-mix(in srgb, ${t} 40%, var(--border))`,color:t},children:n})}function ka({label:e,value:t,detail:n}){return i.jsxs("div",{className:"s-observe-stat",children:[i.jsx("div",{className:"s-observe-stat-label",children:e}),i.jsx("div",{className:"s-observe-stat-value",children:t}),n&&i.jsx("div",{className:"s-observe-stat-detail",children:n})]})}function tg({rows:e}){return e.length===0?null:i.jsx("div",{className:"s-observe-detail-list",children:e.map(t=>i.jsxs("div",{className:"s-observe-detail-row",children:[i.jsx("div",{className:"s-observe-detail-label",children:t.label}),i.jsx("div",{className:`s-observe-detail-value s-observe-detail-value--${t.tone??"default"}${t.wrap?" s-observe-detail-value--wrap":""}`,title:t.title,children:t.value})]},t.label))})}function mZ({events:e,duration:t,cursor:n,onCursor:a}){const o=v.useRef(null),l=v.useCallback(u=>{const f=o.current.getBoundingClientRect(),m=u.clientX-f.left;a(Math.max(0,Math.min(t,m/f.width*t)))},[t,a]);return i.jsx("div",{className:"s-observe-track-wrap",children:i.jsxs("div",{ref:o,className:"s-observe-track",onClick:l,children:[e.map(u=>{const f=u.kind==="tool"?6:u.kind==="think"?4:5;return i.jsx("span",{className:"s-observe-track-tick",style:{left:`${u.t/t*100}%`,top:f===6?-2:-1,height:f,background:_A[u.kind]??"var(--dim)"}},u.id)}),i.jsx("div",{className:"s-observe-track-played",style:{width:`${n/t*100}%`}}),i.jsx("span",{className:"s-observe-track-cursor",style:{left:`${n/t*100}%`}})]})})}function WS(e){const t=Date.now()-e;return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function pZ(e,t){const n=t-e;return n<6e4?`${Math.floor(n/1e3)}s`:n<36e5?`${Math.floor(n/6e4)}m`:`${Math.floor(n/36e5)}h ${Math.floor(n%36e5/6e4)}m`}function gZ({catalog:e,sessionId:t,agentId:n}){const{navigate:a}=St(),[o,l]=v.useState(!1),u=e.sessions.find(y=>y.id===e.activeSessionId),f=e.sessions.filter(y=>y.id!==e.activeSessionId&&y.endedAt).sort((y,b)=>(b.endedAt??0)-(y.endedAt??0)).slice(0,5),m=e.activeSessionId??t,h=m?m.slice(0,8):null,p=v.useCallback(()=>{e.resumeCommand&&(KF(e.resumeCommand).then(()=>{a({view:"terminal",agentId:n})}),l(!0))},[e.resumeCommand,a,n]);return i.jsxs("div",{className:"s-observe-session-header",children:[i.jsx("div",{className:"s-observe-session-active",children:i.jsxs("div",{className:"s-observe-session-row",children:[h&&i.jsx("span",{className:"s-observe-session-id",title:m??void 0,children:h}),u&&i.jsxs("span",{className:"s-observe-session-time",children:["started ",WS(u.startedAt)]}),e.resumeCommand&&i.jsx("button",{className:"s-observe-takeover-btn",onClick:p,title:e.resumeCommand,children:o?"Sent":"Takeover"})]})}),f.length>0&&i.jsxs("div",{className:"s-observe-session-history",children:[i.jsxs("div",{className:"s-observe-session-history-label",children:[e.sessions.length," session",e.sessions.length!==1?"s":""," total"]}),f.map(y=>i.jsxs("div",{className:"s-observe-session-past",children:[i.jsx("span",{className:"s-observe-session-id",children:y.id.slice(0,8)}),i.jsxs("span",{className:"s-observe-session-time",children:[WS(y.startedAt),y.endedAt?` · ${pZ(y.startedAt,y.endedAt)}`:""]})]},y.id))]})]})}const vZ={events:[{id:"observe:empty",t:0,kind:"system",text:"No session trace is available for this agent yet.",detail:"Waiting for a live session or readable history file."}],files:[],contextUsage:[],live:!1};function IA({data:e,agentId:t,sessionId:n}){const a=e??vZ,{events:o,files:l,contextUsage:u}=a,f=a.live===!0,[m,h]=v.useState(null);v.useEffect(()=>{if(!t)return;let O=!1;return Ce(`/api/agents/${encodeURIComponent(t)}/session-catalog`).then(Z=>{O||h(Z)}).catch(()=>{}),()=>{O=!0}},[t]);const p=o.length>0?o[o.length-1].t+30:60,[y,b]=v.useState(p),[w,j]=v.useState(!1),[N,C]=v.useState(1),k=v.useRef(p);v.useEffect(()=>{b(O=>{const Z=k.current;k.current=p;const W=ZS(O,Z);return O>p||W?p:O})},[p]),v.useEffect(()=>{if(!w)return;const O=setInterval(()=>{b(Z=>{const W=Z+N;return W>=p?(j(!1),p):W})},100);return()=>clearInterval(O)},[w,p,N]);const E=o.filter(O=>O.t<=y),S=f&&ZS(y,p),R=f?S?"Following live":"Jump to live ↦":"Jump to end ↦",A=a.metadata,M=A?.session,D=A?.usage,U=o.filter(O=>O.kind==="tool").length,F=o.filter(O=>O.kind==="think").length,P=o.filter(O=>O.kind==="ask").length,_=o.filter(O=>O.kind==="tool"&&O.tool==="read").length,z=o.filter(O=>O.kind==="tool"&&(O.tool==="edit"||O.tool==="write")).length,B=o.length>0?o[o.length-1].t:0,V=u&&u.length>0?Math.round((u[u.length-1]??0)*100):null,K=[{label:"Input",value:D?.inputTokens},{label:"Output",value:D?.outputTokens},{label:"Cache hit",value:D?.cacheReadInputTokens},{label:"Cache write",value:D?.cacheCreationInputTokens},{label:"Total",value:D?.totalTokens},{label:"Reasoning",value:D?.reasoningOutputTokens}].filter(O=>typeof O.value=="number"),L=eg([typeof D?.assistantMessages=="number"?{label:"Assistant msgs",value:Bl(D.assistantMessages)??"0",tone:"accent"}:null,typeof D?.webSearchRequests=="number"?{label:"Web search",value:Bl(D.webSearchRequests)??"0"}:null,typeof D?.webFetchRequests=="number"?{label:"Web fetch",value:Bl(D.webFetchRequests)??"0"}:null,D?.serviceTier?{label:"Service tier",value:D.serviceTier,tone:"good"}:null,D?.speed?{label:"Speed",value:D.speed}:null,D?.planType?{label:"Plan",value:D.planType}:null]),H=eg([typeof D?.contextWindowTokens=="number"?{label:"Model window",value:`${Bl(D.contextWindowTokens)} tokens`,title:Bl(D.contextWindowTokens)??void 0,tone:"accent"}:null,V!==null?{label:"Derived load",value:`${V}%`,tone:V>=80?"warn":"default"}:null]),$=eg([M?.model?{label:"Model",value:M.model,tone:"accent"}:null,M?.adapterType?{label:"Adapter",value:M.adapterType}:null,M?.gitBranch?{label:"Branch",value:M.gitBranch}:null,M?.cwd?{label:"Workspace",value:M.cwd,title:M.cwd,wrap:!0}:null,M?.entrypoint?{label:"Entrypoint",value:M.entrypoint}:null,M?.cliVersion?{label:"CLI",value:M.cliVersion}:null,M?.permissionMode?{label:"Permissions",value:M.permissionMode}:null,M?.approvalPolicy?{label:"Approval",value:M.approvalPolicy}:null,M?.sandbox?{label:"Sandbox",value:M.sandbox}:null,M?.userType?{label:"User type",value:M.userType}:null,M?.originator?{label:"Originator",value:M.originator}:null,M?.modelProvider?{label:"Provider",value:M.modelProvider}:null,M?.effort?{label:"Effort",value:M.effort}:null,M?.timezone?{label:"Timezone",value:M.timezone}:null,M?.externalSessionId?{label:"External session",value:M.externalSessionId,title:M.externalSessionId,wrap:!0}:null,M?.threadId?{label:"Thread",value:M.threadId,title:M.threadId,wrap:!0}:null,M?.threadPath?{label:"Thread path",value:M.threadPath,title:M.threadPath,wrap:!0}:null,M?.source?{label:"Runtime source",value:M.source}:null]),G=qS(D),X=qS(M);return i.jsxs("div",{className:"s-observe",children:[i.jsxs("main",{className:"s-observe-main",children:[S&&i.jsx("div",{className:"s-observe-live-sticky",children:i.jsx(lZ,{})}),i.jsx(dZ,{events:E,isLive:S})]}),i.jsxs("aside",{className:"s-observe-rail",children:[m&&m.sessions.length>0&&i.jsxs("div",{children:[i.jsx("div",{className:"s-observe-rail-label",children:"Session"}),i.jsx(gZ,{catalog:m,sessionId:n??null,agentId:t})]}),i.jsxs("div",{children:[i.jsx("div",{className:"s-observe-rail-label",children:"Trace stats"}),i.jsxs("div",{className:"s-observe-stats",children:[i.jsx(ka,{label:"Turns",value:ar(M?.turnCount??0)}),i.jsx(ka,{label:"Tools",value:ar(U)}),i.jsx(ka,{label:"Thinks",value:ar(F)}),i.jsx(ka,{label:"Asks",value:ar(P)}),i.jsx(ka,{label:"Reads",value:ar(_)}),i.jsx(ka,{label:"Edits",value:ar(z)}),i.jsx(ka,{label:"Files",value:ar(l.length)}),i.jsx(ka,{label:"Window",value:tZ(B)})]})]}),i.jsxs("div",{children:[i.jsx("div",{className:"s-observe-rail-label",children:"Context window"}),i.jsx(tg,{rows:H}),u&&u.length>=2?i.jsxs(i.Fragment,{children:[i.jsx(fZ,{data:u,cursor:y/p}),i.jsx("div",{className:"s-observe-ctx-detail",children:"Sparkline shows derived session load across the observed trace."})]}):H.length===0?i.jsx("div",{className:"s-observe-ctx-detail",children:"Unavailable for this session"}):i.jsx("div",{className:"s-observe-ctx-detail",children:"Exact window metadata is available, but no derived load trace was captured."})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"s-observe-rail-label",children:["Files touched · ",l.length]}),i.jsx("div",{className:"s-observe-files",children:l.map(O=>i.jsxs("div",{className:`s-observe-file${O.lastT<=y?" s-observe-file--visible":" s-observe-file--hidden"}`,children:[i.jsx(hZ,{state:O.state}),i.jsx("span",{className:"s-observe-file-path",children:O.path}),i.jsxs("span",{className:"s-observe-file-touches",children:["×",O.touches]})]},O.path))})]}),i.jsxs("div",{children:[i.jsx("div",{className:"s-observe-rail-label",children:"Usage"}),K.length>0&&i.jsx("div",{className:"s-observe-stats s-observe-stats--usage",children:K.map(O=>i.jsx(ka,{label:O.label,value:ar(O.value)},O.label))}),L.length>0?i.jsx(tg,{rows:L}):G?null:i.jsx("div",{className:"s-observe-ctx-detail",children:"Unavailable for this session"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"s-observe-rail-label",children:"Metadata"}),$.length>0?i.jsx(tg,{rows:$}):X?null:i.jsx("div",{className:"s-observe-ctx-detail",children:"Unavailable for this session"})]})]}),i.jsxs("footer",{className:"s-observe-scrubber",children:[i.jsx("button",{className:"s-observe-play-btn",onClick:()=>j(!w),children:w?"❚❚":"▶"}),i.jsx("button",{className:"s-observe-rewind-btn",onClick:()=>{b(0),j(!1)},children:"⏮"}),i.jsx(mZ,{events:o,duration:p,cursor:y,onCursor:b}),i.jsx("div",{className:"s-observe-speed-group",children:[.5,1,2,4].map(O=>i.jsxs("button",{className:`s-observe-speed-btn${N===O?" s-observe-speed-btn--active":""}`,onClick:()=>C(O),children:[O,"×"]},O))}),i.jsx(cZ,{liveSession:f,isLive:S}),i.jsx("button",{className:`s-observe-jump-btn${S?" s-observe-jump-btn--active":""}`,onClick:()=>b(p),children:R})]})]})}async function yZ(e){await fetch(zc("terminalRunPath"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})})}function xZ(e,t){if(t.filter(o=>o.name===e.name).length<=1)return{name:e.name,qualifier:null};const a=e.project??e.branch??e.id.replace(/^.*\./,"");return{name:e.name,qualifier:a}}function YS(e){if(!e)return null;const t=e.replace(/_/g," ");return t.toLowerCase()==="relay agent"?"agent":t}function bZ(e){const t=[...e].filter(o=>o.kind==="direct"&&!!o.agentId).sort((o,l)=>(l.lastMessageAt??0)-(o.lastMessageAt??0)),n=new Map,a=new Map;for(const o of t)n.has(o.agentId)||(n.set(o.agentId,o.id),a.set(o.agentId,o));return{conversationByAgentId:n,sessionByAgentId:a}}function wZ({catalog:e,agentId:t}){const{navigate:n}=St(),[a,o]=v.useState(!1),l=e.activeSessionId?.slice(0,8)??null,u=e.sessions.find(m=>m.id===e.activeSessionId),f=()=>{e.resumeCommand&&(yZ(e.resumeCommand).then(()=>n({view:"terminal",agentId:t})),o(!0))};return i.jsxs("div",{className:"s-profile-facet",children:[i.jsx("div",{className:"s-profile-facet-label",children:"Session"}),i.jsxs("div",{className:"s-profile-facet-value s-profile-facet-value--mono",title:e.activeSessionId??void 0,children:[l,e.resumeCommand&&i.jsx("button",{type:"button",className:"s-profile-facet-action",onClick:f,title:e.resumeCommand,children:a?"Going…":"Takeover"})]}),u&&i.jsxs("div",{className:"s-profile-facet-detail",children:[e.sessions.length," session",e.sessions.length!==1?"s":""," · started ",Pe(u.startedAt)]})]})}function jZ({agent:e,fleet:t,navigate:n}){const a=v.useMemo(()=>t?t.activity.filter(l=>l.agentId===e.id||l.actorId===e.id).slice(0,6):[],[t,e.id]),o=v.useMemo(()=>t?t.recentCompleted.filter(l=>l.agentId===e.id).slice(0,4):[],[t,e.id]);return a.length===0&&o.length===0?i.jsxs("div",{className:"s-profile-activity-empty",children:[i.jsx("div",{className:"s-profile-activity-empty-title",children:"Quiet for now"}),i.jsx("div",{className:"s-profile-activity-empty-detail",children:"Activity will appear here as this agent works, receives asks, and completes tasks."})]}):i.jsxs("div",{className:"s-profile-activity-feed",children:[o.map(l=>i.jsxs("div",{className:"s-profile-activity-row",onClick:()=>{l.conversationId&&n({view:"agents",agentId:e.id,conversationId:l.conversationId})},children:[i.jsx("div",{className:"s-profile-activity-dot s-profile-activity-dot--done"}),i.jsxs("div",{className:"s-profile-activity-body",children:[i.jsx("div",{className:"s-profile-activity-title",children:l.summary??l.task}),i.jsxs("div",{className:"s-profile-activity-meta",children:[l.status==="completed"?"completed":l.status,l.completedAt&&` · ${Pe(l.completedAt)}`]})]})]},l.invocationId)),a.map(l=>i.jsxs("div",{className:"s-profile-activity-row",onClick:()=>{l.conversationId&&n({view:"agents",agentId:e.id,conversationId:l.conversationId})},children:[i.jsx("div",{className:"s-profile-activity-dot"}),i.jsxs("div",{className:"s-profile-activity-body",children:[i.jsx("div",{className:"s-profile-activity-title",children:l.title??l.summary??l.kind}),i.jsxs("div",{className:"s-profile-activity-meta",children:[l.kind.replace(/_/g," "),l.actorName&&` · ${l.actorName}`,` · ${Pe(l.ts)}`]})]})]},l.id))]})}function Xl({label:e,right:t,rightClassName:n}){return i.jsxs("div",{className:"s-profile-section-rule",children:[i.jsx("span",{className:"s-profile-section-rule-label",children:e}),i.jsx("span",{className:"s-profile-section-rule-line"}),t&&i.jsx("span",{className:`s-profile-section-rule-right${n?` ${n}`:""}`,children:t})]})}function SZ({messages:e,navigate:t,conversationId:n,agentId:a}){const o=e.slice(-8).reverse();return o.length===0?null:i.jsxs("div",{className:"s-profile-signals",children:[i.jsx(Xl,{label:"Recent signal",right:"last 1h"}),i.jsx("div",{className:"s-profile-signal-list",children:o.map(l=>{const f=l.class==="ask"||l.body?.toLowerCase().startsWith("@")?"ASK":"MESSAGE";return i.jsxs("div",{className:"s-profile-signal",onClick:()=>{n&&t({view:"agents",agentId:a,conversationId:n})},children:[i.jsx("div",{className:"s-profile-signal-avatar",style:{background:ct(l.actorName??"?")},children:(l.actorName??"?")[0].toUpperCase()}),i.jsxs("div",{className:"s-profile-signal-body",children:[i.jsxs("div",{className:"s-profile-signal-header",children:[i.jsx("span",{className:"s-profile-signal-kind",children:f}),i.jsx("span",{className:"s-profile-signal-sep",children:"·"}),i.jsx("span",{className:"s-profile-signal-routing",children:l.actorName}),i.jsx("span",{className:"s-profile-signal-time",children:Pe(l.createdAt)})]}),i.jsx("div",{className:"s-profile-signal-text",children:l.body})]})]},l.id)})})]})}function NZ({agent:e,allAgents:t,session:n,conversationId:a,navigate:o,activeTab:l}){const{name:u,qualifier:f}=xZ(e,t),[m,h]=v.useState([]),[p,y]=v.useState([]),[b,w]=v.useState(null),[j,N]=v.useState(null),[C,k]=v.useState(!1),[E,S]=v.useState(null),R=ft(e.state),A=Yf(),M=v.useCallback(async()=>{const[G,X]=await Promise.allSettled([Ce(`/api/work?agentId=${encodeURIComponent(e.id)}`),Ce("/api/fleet")]);G.status==="fulfilled"&&h(G.value),X.status==="fulfilled"&&w(X.value)},[e.id]),D=v.useCallback(async()=>{if(!a){y([]);return}try{const G=await Ce(`/api/messages?conversationId=${encodeURIComponent(a)}&limit=20`);y(G)}catch{y([])}},[a]),U=v.useCallback(async()=>{k(!0);try{const G=await Ce(`/api/agents/${encodeURIComponent(e.id)}/observe`);N(G)}catch{N({agentId:e.id,source:"unavailable",fidelity:"synthetic",historyPath:null,sessionId:null,updatedAt:Date.now(),data:{events:[{id:`${e.id}:observe-error`,t:0,kind:"system",text:"Observer data is temporarily unavailable.",detail:"Retrying will resume once the session source becomes reachable."}],files:[],contextUsage:[],live:!1}})}finally{k(!1)}},[e.id]);v.useEffect(()=>{M(),D(),Ce(`/api/agents/${encodeURIComponent(e.id)}/session-catalog`).then(S).catch(()=>{})},[M,D,e.id]),v.useEffect(()=>{N(null),k(!1)},[e.id]),v.useEffect(()=>{l==="observe"&&U()},[l,U]),fn(()=>{M(),D(),l==="observe"&&U()}),v.useEffect(()=>{if(l!=="observe"||!j?.data.live)return;const G=setInterval(()=>{U()},2500);return()=>clearInterval(G)},[l,j?.data.live,U]);const F=m.find(G=>G.state==="working"||G.state==="review"),P=m.filter(G=>G.state==="working"||G.state==="review"||G.state==="waiting"),_=m.filter(G=>G.state==="done").slice(0,5),z=YS(e.role)??YS(e.agentClass),B=e.harness,V=[z,B].filter(Boolean).filter((G,X,O)=>O.indexOf(G)===X),K=v.useMemo(()=>t.filter(G=>G.project===e.project).length,[t,e.project]),L=F?.currentPhase==="review"?85:F?.currentPhase==="working"?50:20,H=[{key:"profile",label:"Profile"},{key:"observe",label:"Observe"},{key:"message",label:"Message",disabled:!a}],$=G=>{o({view:"agents",agentId:e.id,...a?{conversationId:a}:{},tab:G})};return i.jsxs("div",{className:`s-profile-center${l!=="profile"?" s-profile-center--tabbed":""}`,children:[i.jsx("button",{type:"button",className:"s-back s-profile-mobile-back",onClick:()=>o({view:"agents"}),children:"← All agents"}),i.jsx("section",{className:"s-profile-identity",onContextMenu:G=>{const X=window.getSelection()?.toString().trim(),O=[];X&&(O.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(X)}),O.push({kind:"separator"})),O.push({kind:"action",label:"Copy Agent Name",onSelect:()=>navigator.clipboard.writeText(u)}),O.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(e.id)}),e.handle&&O.push({kind:"action",label:`Copy @${e.handle}`,onSelect:()=>navigator.clipboard.writeText(`@${e.handle}`)}),A(G,O)},children:i.jsxs("div",{className:"s-profile-identity-top",children:[i.jsxs("div",{className:"s-profile-identity-avatar-wrap",children:[i.jsx("div",{className:"s-profile-identity-avatar",style:{background:ct(e.name)},children:e.name[0].toUpperCase()}),i.jsx("span",{className:`s-profile-identity-pulse s-profile-identity-pulse--${R}`,style:{background:Oa(e.state)}})]}),i.jsxs("div",{className:"s-profile-identity-copy",children:[V.length>0&&i.jsx("div",{className:"s-profile-identity-eyebrow",children:V.join(" · ")}),i.jsxs("h1",{className:"s-profile-identity-name",children:[u,f&&i.jsx("span",{className:"s-profile-identity-name-qualifier",children:f}),e.handle&&i.jsxs("span",{className:"s-profile-identity-name-handle",children:["@",e.handle]})]}),i.jsx("div",{className:"s-profile-identity-state-row",children:i.jsxs("span",{className:"s-profile-identity-state",children:[i.jsx("span",{className:`s-profile-identity-state-dot${R==="working"?" s-profile-identity-state-dot--pulse":""}`,style:{background:Oa(e.state)}}),i.jsx("span",{className:"s-profile-identity-state-label",children:Vs(e.state)}),e.updatedAt&&i.jsxs("span",{className:"s-profile-identity-state-detail",children:["— ",Pe(e.updatedAt)]})]})})]}),i.jsx("nav",{className:"s-profile-tabs",children:H.map(G=>i.jsx("button",{type:"button",className:`s-profile-tab${l===G.key?" s-profile-tab--active":""}`,disabled:G.disabled,onClick:()=>$(G.key),children:G.label},G.key))})]})}),l==="profile"&&i.jsxs("div",{className:"s-profile-tab-content",children:[(e.project||e.branch||e.cwd||E?.activeSessionId)&&i.jsxs("div",{className:"s-profile-facets",children:[e.project&&i.jsxs("div",{className:"s-profile-facet",children:[i.jsx("div",{className:"s-profile-facet-label",children:"Workspace"}),i.jsx("div",{className:"s-profile-facet-value",children:e.project}),K>1&&i.jsxs("div",{className:"s-profile-facet-detail",children:[K," teammates"]})]}),(e.branch||e.projectRoot)&&i.jsxs("div",{className:"s-profile-facet",children:[i.jsx("div",{className:"s-profile-facet-label",children:"Repo / Branch"}),i.jsx("div",{className:"s-profile-facet-value",children:e.projectRoot?e.projectRoot.split("/").pop():e.project??"—"}),e.branch&&i.jsxs("div",{className:"s-profile-facet-detail",children:[i.jsx("span",{className:"s-profile-facet-accent",children:"⎇"})," ",e.branch]})]}),e.cwd&&i.jsxs("div",{className:"s-profile-facet",children:[i.jsx("div",{className:"s-profile-facet-label",children:"Working Dir"}),i.jsx("div",{className:"s-profile-facet-value",children:e.cwd.startsWith("/Users/")?"~/"+e.cwd.split("/").slice(3).join("/"):e.cwd}),e.updatedAt&&i.jsxs("div",{className:"s-profile-facet-detail",children:["uptime ",Pe(e.updatedAt)]})]}),E?.activeSessionId&&i.jsx(wZ,{catalog:E,agentId:e.id})]}),F&&R==="working"&&i.jsxs(i.Fragment,{children:[i.jsx(Xl,{label:"Current task",right:`${L}% · live`}),i.jsxs("div",{className:"s-profile-task",children:[i.jsx("div",{className:"s-profile-task-title",children:F.title}),F.lastMeaningfulSummary&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"s-profile-task-progress",children:i.jsx("div",{className:"s-profile-task-progress-bar",style:{width:`${L}%`}})}),i.jsxs("div",{className:"s-profile-task-action",children:[i.jsx("span",{className:"s-profile-task-action-chevron",children:"›"}),i.jsx("span",{children:F.lastMeaningfulSummary}),i.jsx("span",{className:"s-profile-task-cursor"})]})]}),i.jsxs("div",{className:"s-profile-task-meta",children:[i.jsx("span",{children:F.currentPhase}),i.jsx("span",{children:Pe(F.lastMeaningfulAt)})]})]})]}),P.length>0&&i.jsxs(i.Fragment,{children:[i.jsx(Xl,{label:"Active work",right:`${P.length} in flight`}),i.jsx("div",{className:"s-profile-work",children:i.jsx(BS,{items:P,navigate:o,emptyTitle:"Nothing in flight"})})]}),_.length>0&&i.jsxs(i.Fragment,{children:[i.jsx(Xl,{label:P.length>0?"Recently completed":"Recent work",right:`${_.length}`}),i.jsx("div",{className:"s-profile-work",children:i.jsx(BS,{items:_,navigate:o,emptyTitle:""})})]}),i.jsx(Xl,{label:"Activity"}),i.jsx("div",{className:"s-profile-work",children:i.jsx(jZ,{agent:e,fleet:b,navigate:o})}),i.jsx(SZ,{messages:p,navigate:o,conversationId:a,agentId:e.id})]}),l==="observe"&&i.jsx("div",{className:"s-profile-tab-conversation",children:C&&!j?i.jsxs("div",{className:"s-profile-activity-empty",children:[i.jsx("div",{className:"s-profile-activity-empty-title",children:"Loading trace"}),i.jsx("div",{className:"s-profile-activity-empty-detail",children:"Resolving the best available live or history-backed session stream for this agent."})]}):i.jsx(IA,{data:j?.data,agentId:e.id,sessionId:j?.sessionId})}),l==="message"&&a&&i.jsx("div",{className:"s-profile-tab-conversation",children:i.jsx(uv,{conversationId:a,navigate:o,embedded:!0})})]})}function kZ({navigate:e,selectedAgentId:t,conversationId:n,tab:a}){const{agents:o}=St(),[l,u]=v.useState([]),f=v.useCallback(async()=>{const y=await Ce("/api/sessions").catch(()=>null);y&&u(y)},[]);v.useEffect(()=>{f()},[f]),fn(()=>{f()});const m=t?o.find(y=>y.id===t)??null:null,{conversationByAgentId:h,sessionByAgentId:p}=bZ(l);if(m){const y=n??h.get(m.id)??m.conversationId??null,b=a??(n?"message":"profile");return i.jsx(NZ,{agent:m,allAgents:o,session:p.get(m.id)??null,conversationId:y,navigate:e,activeTab:b})}return i.jsx("div",{className:"s-profile-center",style:{height:"100%"},children:i.jsxs("div",{className:"s-profile-empty",children:[i.jsx("h2",{className:"s-profile-empty-title",children:"Select an agent"}),i.jsx("p",{className:"s-profile-empty-copy",children:"Pick an agent from the sidebar to view its profile, current work, and session context."})]})})}function EZ(e){switch(e){case"queued":case"working":return"working";case"needs_attention":return"updated";case"failed":return"failed";default:return"completed"}}function CZ(e){switch(e){case"completed":return"completed";case"failed":case"cancelled":return"failed";case"waiting":return"updated";default:return"working"}}function TZ(e){return e.replace(/[_-]/g," ")}function AZ(e,t){return e.summary?.trim()||t?.summary?.trim()||t?.task?.trim()||"No flight summary yet."}function MZ(e,t){if(typeof e!="number")return"duration unknown";const n=e<1e12?e*1e3:e,a=Math.max(0,t-n),o=Math.floor(a/1e3);if(o<5)return"just started";if(o<60)return`${o}s`;const l=Math.floor(o/60);if(l<60)return`${l}m`;const u=Math.floor(l/60);return u<24?`${u}h ${l%60}m`:`${Math.floor(u/24)}d ${u%24}h`}function RZ(e){return e.conversationId?{view:"conversation",conversationId:e.conversationId}:{view:"agents",agentId:e.agentId}}function _Z(e){return e.collaborationRecordId?{view:"work",workId:e.collaborationRecordId}:e.conversationId?{view:"conversation",conversationId:e.conversationId}:{view:"agents",agentId:e.agentId}}function OZ(e){return e.kind==="work_item"&&e.recordId?{view:"work",workId:e.recordId}:e.conversationId?{view:"conversation",conversationId:e.conversationId}:e.agentId?{view:"agents",agentId:e.agentId}:null}function IZ(e){return e.recordId?{view:"work",workId:e.recordId}:e.conversationId?{view:"conversation",conversationId:e.conversationId}:e.agentId?{view:"agents",agentId:e.agentId}:null}function Vl({title:e,detail:t}){return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"s-dashboard-panel-header",children:i.jsx("div",{children:i.jsx("h3",{children:e})})}),i.jsx("p",{className:"s-dashboard-panel-copy",children:t})]})}function GS({ask:e,navigate:t,section:n}){const a=RZ(e),o=e.completedAt?`finished ${Pe(e.completedAt)}`:e.startedAt?`started ${Pe(e.startedAt)}`:`updated ${Pe(e.updatedAt)}`;return i.jsxs("div",{className:`s-work-row s-work-row-clickable s-dashboard-fleet-row s-dashboard-fleet-row-${n}`,"data-status":e.status,onClick:()=>t(a),children:[i.jsxs("div",{className:"s-work-row-header",children:[i.jsxs("div",{className:"s-fleet-row-title-wrap",children:[i.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:ct(e.agentName??e.agentId)},children:(e.agentName??e.agentId)[0]?.toUpperCase()??"?"}),i.jsxs("div",{className:"s-fleet-row-title-copy",children:[i.jsxs("div",{className:"s-work-row-title-wrap",children:[i.jsx("span",{className:"s-work-row-title",children:e.agentName??e.agentId}),e.harness&&i.jsx("span",{className:"s-badge",children:e.harness})]}),i.jsxs("div",{className:"s-work-row-meta",style:{marginTop:2},children:[i.jsx("span",{className:"s-dot",style:{background:Oa(e.agentState)}}),i.jsx("span",{children:Vs(e.agentState)}),i.jsx("span",{children:o})]})]})]}),i.jsx("span",{className:`s-pill s-pill-${EZ(e.status)}`,children:e.statusLabel})]}),i.jsx("p",{className:"s-work-row-summary",children:Es(e.task)}),e.summary&&i.jsx("p",{className:"s-work-row-summary",style:{marginTop:8},children:Es(e.summary)})]})}function DZ({item:e,navigate:t}){const n=OZ(e),a=e.kind==="question"?"question":e.state.replace(/_/g," "),o=e.acceptanceState!=="none"?e.acceptanceState.replace(/_/g," "):e.kind==="question"?"awaiting answer":"your move";return i.jsxs("div",{className:`s-work-row s-dashboard-fleet-row s-dashboard-fleet-attention-row${n?" s-work-row-clickable":""}`,onClick:n?()=>t(n):void 0,children:[i.jsx("div",{className:"s-work-row-header",children:i.jsx("div",{className:"s-work-row-title-wrap",children:i.jsx("span",{className:"s-work-row-title",children:e.title})})}),i.jsxs("div",{className:"s-work-row-meta",children:[e.kind==="work_item"&&i.jsx("span",{children:"work item"}),e.agentName&&i.jsx("span",{children:e.agentName}),i.jsx("span",{children:a}),i.jsx("span",{children:o}),i.jsx("span",{children:Pe(e.updatedAt)})]}),e.summary&&i.jsx("p",{className:"s-work-row-summary",children:Es(e.summary)})]})}function zZ({flight:e,navigate:t,nowMs:n,description:a}){const o=_Z(e),l=e.agentName??e.agentId,u=TZ(e.state),f=MZ(e.startedAt,n),m=typeof e.startedAt=="number"&&f!=="just started"?`in flight for ${f}`:f;return i.jsxs("div",{className:"s-work-row s-work-row-clickable s-dashboard-fleet-row s-dashboard-flight-row","data-status":e.state,onClick:()=>t(o),children:[i.jsxs("div",{className:"s-work-row-header",children:[i.jsxs("div",{className:"s-fleet-row-title-wrap",children:[i.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:ct(l)},children:l[0]?.toUpperCase()??"?"}),i.jsxs("div",{className:"s-fleet-row-title-copy",children:[i.jsx("div",{className:"s-work-row-title-wrap",children:i.jsx("span",{className:"s-work-row-title",children:l})}),i.jsxs("div",{className:"s-work-row-meta",style:{marginTop:2},children:[i.jsx("span",{children:m}),e.conversationId&&i.jsx("span",{children:"conversation linked"}),e.collaborationRecordId&&i.jsx("span",{children:"work linked"})]})]})]}),i.jsx("span",{className:`s-pill s-pill-${CZ(e.state)}`,children:u})]}),i.jsx("p",{className:"s-work-row-summary",children:Es(a)})]})}function PZ({item:e,navigate:t}){const n=IZ(e),a=e.actorName??"system",o=e.agentId&&e.agentId!==e.actorName?e.agentId:null;return i.jsxs("div",{className:`s-dashboard-activity-row${n?" s-dashboard-activity-row-clickable":""}`,onClick:n?()=>t(n):void 0,children:[i.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:ct(a)},children:a[0]?.toUpperCase()??"S"}),i.jsxs("div",{className:"s-dashboard-activity-actors",children:[i.jsx("span",{className:"s-dashboard-activity-actor",children:a}),o&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"s-dashboard-activity-arrow","aria-hidden":"true",children:"→"}),i.jsx("span",{className:"s-dashboard-activity-recipient",children:o})]})]}),i.jsx("span",{className:"s-dashboard-activity-kind",children:J7(e.kind)}),i.jsx("span",{className:"s-dashboard-activity-time",children:Pe(e.ts)}),(e.title||e.summary)&&i.jsx("p",{className:"s-dashboard-activity-summary",children:Es(e.title??e.summary??"")})]})}function LZ({navigate:e}){const[t,n]=v.useState(null),[a,o]=v.useState([]),[l,u]=v.useState(()=>Date.now()),f=v.useCallback(async()=>{const[j,N]=await Promise.allSettled([Ce("/api/fleet"),Ce("/api/flights")]);j.status==="fulfilled"?n(j.value):n(null),N.status==="fulfilled"?o(N.value):o([])},[]);v.useEffect(()=>{f()},[f]),fn(()=>{f()}),v.useEffect(()=>{const j=setInterval(()=>u(Date.now()),15e3);return()=>clearInterval(j)},[]);const m=t?.activeAsks??[],h=t?.recentCompleted??[],p=t?.needsAttention??[],y=t?.activity??[],b=new Map(m.map(j=>[j.invocationId,j])),w=p.length>0?`${p.length} item${p.length===1?" is":"s are"} waiting on you. Clear ${p.length===1?"it":"those"} first, then monitor the rest of the queue.`:a.length>0?`${a.length} flight${a.length===1?" is":"s are"} active across the fleet. The queue is clear of interruptions.`:m.length>0?`${m.length} ask${m.length===1?" is":"s are"} currently in flight. The queue is clear of interruptions.`:h.length>0?"Nothing is actively running right now. Recent finishes are ready for review.":"No asks have moved through the fleet yet. Start work and this becomes the operations board.";return i.jsxs("div",{className:"s-home s-dashboard-screen s-dashboard-fleet",children:[i.jsx("div",{className:"s-dashboard-hero s-dashboard-hero-fleet",children:i.jsxs("div",{className:"s-dashboard-hero-copy",children:[i.jsxs("div",{className:"s-dashboard-hero-head",children:[i.jsx("h2",{children:"Fleet"}),t&&i.jsxs("span",{className:"s-time",children:["Updated ",Pe(t.generatedAt)]})]}),i.jsx("p",{children:w}),i.jsxs("div",{className:"s-dashboard-summary-grid",children:[i.jsxs("div",{className:`s-dashboard-summary-card${(t?.totals.needsAttention??0)>0?" s-dashboard-summary-card-attention":""}`,children:[i.jsx("div",{className:"s-dashboard-summary-label",children:"Needs input"}),i.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.needsAttention??0}),i.jsx("div",{className:"s-dashboard-summary-meta",children:"Questions, reviews, or decisions waiting on you"})]}),i.jsxs("div",{className:"s-dashboard-summary-card",children:[i.jsx("div",{className:"s-dashboard-summary-label",children:"Active flights"}),i.jsx("div",{className:"s-dashboard-summary-value",children:a.length}),i.jsx("div",{className:"s-dashboard-summary-meta",children:"Tasks currently running or queued on agents"})]}),i.jsxs("div",{className:`s-dashboard-summary-card${(t?.totals.recentCompleted??0)>0?" s-dashboard-summary-card-finished":""}`,children:[i.jsx("div",{className:"s-dashboard-summary-label",children:"Finished"}),i.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.recentCompleted??0}),i.jsx("div",{className:"s-dashboard-summary-meta",children:"Recent completions and failures to review"})]}),i.jsxs("div",{className:"s-dashboard-summary-card",children:[i.jsx("div",{className:"s-dashboard-summary-label",children:"Activity"}),i.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.activity??0}),i.jsx("div",{className:"s-dashboard-summary-meta",children:"Recent events across the fleet"})]})]})]})}),i.jsxs("div",{className:"s-dashboard-fleet-stack",children:[i.jsxs("section",{className:`s-dashboard-panel${p.length>0?" s-dashboard-panel-attention":""}`,children:[i.jsx(Vl,{title:"Needs your input",detail:"Handle interruptions, pending answers, and review requests first."}),p.length===0?i.jsxs("div",{className:"s-empty",children:[i.jsx("p",{children:"Nothing is waiting on you"}),i.jsx("p",{children:"When agents ask a question or a work item needs review, it will land here first."})]}):i.jsx("div",{className:"s-work-list",children:p.map(j=>i.jsx(DZ,{item:j,navigate:e},j.recordId))})]}),i.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-flights",children:[i.jsx(Vl,{title:"In-flight agents",detail:"Agents with active flights right now, including how long each task has been in flight."}),a.length===0?i.jsxs("div",{className:"s-empty",children:[i.jsx("p",{children:"No agents in flight"}),i.jsx("p",{children:"Active flights will appear here as soon as an agent starts, queues, or waits on a task."})]}):i.jsx("div",{className:"s-work-list",children:a.map(j=>i.jsx(zZ,{flight:j,navigate:e,nowMs:l,description:AZ(j,b.get(j.invocationId))},j.id))})]}),i.jsxs("div",{className:"s-dashboard-fleet-columns",children:[i.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-active",children:[i.jsx(Vl,{title:"Active asks",detail:"The asks still in flight across the fleet."}),m.length===0?i.jsxs("div",{className:"s-empty",children:[i.jsx("p",{children:"No active asks"}),i.jsx("p",{children:"New agent work will appear here while it is still in progress."})]}):i.jsx("div",{className:"s-work-list",children:m.map(j=>i.jsx(GS,{ask:j,navigate:e,section:"active"},j.invocationId))})]}),i.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-finished",children:[i.jsx(Vl,{title:"Recent finishes",detail:"Review completions and failures once the active queue is stable."}),h.length===0?i.jsxs("div",{className:"s-empty",children:[i.jsx("p",{children:"No recent finishes"}),i.jsx("p",{children:"Completed asks and failures will show up here once they settle."})]}):i.jsx("div",{className:"s-work-list",children:h.map(j=>i.jsx(GS,{ask:j,navigate:e,section:"finished"},j.invocationId))})]})]}),i.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-activity",children:[i.jsx(Vl,{title:"Recent activity",detail:"The broader event stream behind the queue."}),y.length===0?i.jsxs("div",{className:"s-empty",children:[i.jsx("p",{children:"No recent fleet activity"}),i.jsx("p",{children:"Messages, asks, and other agent activity will stream here."})]}):i.jsx("div",{className:"s-dashboard-activity-feed",children:y.slice(0,20).map(j=>i.jsx(PZ,{item:j,navigate:e},j.id))})]})]})]})}function $Z(e){return e<5?"Still up":e<12?"Good morning":e<18?"Good afternoon":"Good evening"}function UZ({navigate:e}){const{agents:t,onboarding:n}=St(),[a,o]=v.useState([]),[l,u]=v.useState([]),[f,m]=v.useState(null),[h,p]=v.useState([]),[y,b]=v.useState("trailing 7d"),[w,j]=v.useState("3h buckets"),N=v.useRef(null),C=v.useCallback(async()=>{const[B,V,K,L]=await Promise.allSettled([Ce("/api/activity"),Ce("/api/sessions"),Ce("/api/fleet"),Ce("/api/heartrate")]);B.status==="fulfilled"&&o(B.value),V.status==="fulfilled"&&u([...V.value].sort((H,$)=>($.lastMessageAt??0)-(H.lastMessageAt??0))),K.status==="fulfilled"&&m(K.value),L.status==="fulfilled"&&(p(L.value.buckets),b(L.value.windowLabel),j(L.value.bucketLabel??""))},[]),k=v.useCallback(()=>{N.current||(N.current=setTimeout(()=>{N.current=null,C()},250))},[C]);v.useEffect(()=>(C(),()=>{N.current&&clearTimeout(N.current)}),[C]),fn(k);const E=v.useMemo(()=>t.filter(B=>ft(B.state)==="working"),[t]),S=v.useMemo(()=>t.filter(B=>ft(B.state)==="available"),[t]),R=v.useMemo(()=>t.filter(B=>ft(B.state)==="offline"),[t]),A=v.useMemo(()=>(f?.activeAsks??[]).filter(B=>B.status==="needs_attention"||B.status==="queued"),[f]),M=v.useMemo(()=>(f?.recentCompleted??[]).slice(0,3),[f]),D=v.useMemo(()=>a.slice(0,8),[a]),U=new Date,F=$Z(U.getHours()),P=Dc(),_=n?.operatorName?.trim()||n?.operatorNameSuggestion?.trim()||"operator",z=v.useMemo(()=>{const B=[];return E.length>0&&B.push(`${E.length} agent${E.length===1?" is":"s are"} working now`),A.length>0&&B.push(`${A.length} thing${A.length===1?"":"s"} need${A.length===1?"s":""} you`),M.length>0&&B.push(`${M.length} ask${M.length===1?" was":"s were"} resolved recently`),B.length===0&&t.length>0&&B.push(`${t.length} agent${t.length===1?" is":"s are"} registered`),B.length===0&&B.push("no agents are connected yet"),B},[E,A,M,t]);return i.jsx("div",{className:"s-fleet-home",children:i.jsxs("div",{className:"s-fleet-home-inner",children:[i.jsxs("div",{className:"s-hero",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"s-eyebrow",style:{marginBottom:12},children:["Fleet briefing ·"," ",U.toLocaleDateString([],{weekday:"long",month:"short",day:"numeric"})]}),i.jsxs("h1",{className:"s-hero-greeting",children:[F,", ",i.jsxs("em",{children:[_,"."]})]}),i.jsxs("p",{className:"s-hero-narrative",children:[z.map((B,V)=>i.jsxs("span",{children:[V>0&&", ",B.includes("need")?i.jsx("span",{className:"s-hero-warn",children:B}):i.jsx("strong",{children:B})]},V)),"."]}),i.jsxs("div",{className:"s-hero-actions",children:[A.length>0&&i.jsxs("button",{className:"s-btn-fleet s-btn-fleet--primary",onClick:()=>e({view:"fleet"}),children:["Answer asks · ",A.length]}),P&&i.jsx("button",{className:"s-btn-fleet",onClick:()=>e({view:"ops"}),children:"Open ops center"}),i.jsx("button",{className:"s-btn-fleet",onClick:()=>e({view:"sessions"}),children:"Jump to thread"})]})]}),i.jsxs("div",{className:"s-heartrate-card",children:[i.jsxs("div",{className:"s-heartrate-header",children:[i.jsx("span",{className:"s-eyebrow",children:"Fleet heart-rate"}),i.jsx("span",{style:{flex:1}}),i.jsxs("span",{className:"s-heartrate-live",children:["● ",y,w?` · ${w}`:""]})]}),i.jsx(VZ,{buckets:h}),i.jsxs("div",{className:"s-heartrate-stats",children:[i.jsx(ng,{label:"Active",value:E.length,color:"var(--green)"}),i.jsx(ng,{label:"Waiting",value:S.length,color:"var(--amber)"}),i.jsx(ng,{label:"Done",value:R.length,color:"var(--dim)"})]})]})]}),i.jsxs("div",{className:"s-fleet-section",children:[i.jsx(sg,{label:`Needs you · ${A.length}`,right:A.length>0?i.jsxs("span",{style:{color:"var(--amber)"},children:["oldest"," ",Pe(Math.min(...A.map(B=>B.updatedAt)))]}):"clear"}),i.jsxs("div",{className:"s-ask-grid",children:[A.slice(0,4).map(B=>i.jsx(KS,{ask:B,agents:t,navigate:e,operatorName:_,pending:!0},B.invocationId)),M.slice(0,Math.max(0,2-A.length)).map(B=>i.jsx(KS,{ask:B,agents:t,navigate:e,operatorName:_,pending:!1},B.invocationId)),A.length<2&&M.length===0&&i.jsxs("div",{className:"s-ask-empty",children:[i.jsx("span",{className:"s-eyebrow",children:"No more asks"}),i.jsx("span",{className:"s-ask-empty-detail",children:"Fleet is unblocked on you."})]})]})]}),E.length>0&&i.jsxs("div",{className:"s-fleet-section",children:[i.jsx(sg,{label:`What's moving · ${E.length} active`,right:i.jsx("button",{className:"s-link-btn",onClick:()=>e({view:"mesh"}),children:"open mesh ↗"})}),i.jsx("div",{className:"s-now-grid",style:{gridTemplateColumns:`repeat(${Math.min(E.length,3)}, 1fr)`},children:E.map(B=>i.jsx(HZ,{agent:B,navigate:e},B.id))})]}),D.length>0&&i.jsxs("div",{className:"s-fleet-section",children:[i.jsx(sg,{label:"Since you were away",right:`last hour · ${D.length} events`}),i.jsx(FZ,{items:D,agents:t,navigate:e})]})]})})}function BZ(e){if(e.length===0)return"";if(e.length===1)return`M ${e[0].x.toFixed(1)} ${e[0].y.toFixed(1)}`;const t=[`M ${e[0].x.toFixed(1)} ${e[0].y.toFixed(1)}`];for(let n=0;n<e.length-1;n++){const a=e[Math.max(0,n-1)],o=e[n],l=e[n+1],u=e[Math.min(e.length-1,n+2)],f={x:o.x+(l.x-a.x)/6,y:o.y+(l.y-a.y)/6},m={x:l.x-(u.x-o.x)/6,y:l.y-(u.y-o.y)/6};t.push(`C ${f.x.toFixed(1)} ${f.y.toFixed(1)}, ${m.x.toFixed(1)} ${m.y.toFixed(1)}, ${l.x.toFixed(1)} ${l.y.toFixed(1)}`)}return t.join(" ")}function VZ({buckets:e}){const u=e.length;if(u<2||e.every(b=>b.count===0))return i.jsxs("svg",{viewBox:"0 0 372 82",style:{width:"100%",height:82,display:"block"},children:[i.jsx("line",{x1:"0",y1:60,x2:372,y2:60,stroke:"var(--border)"}),i.jsx("text",{x:372/2,y:82/2-4,textAnchor:"middle",fill:"var(--dim)",fontSize:"14",letterSpacing:"0.3em",children:"zzz"}),i.jsx("text",{x:372/2,y:82/2+12,textAnchor:"middle",fill:"var(--dim)",fontSize:"10",fontFamily:"var(--hud-font-mono)",opacity:"0.7",children:"nothing to report"})]});const m=372/(u-1),h=e.map((b,w)=>({x:w*m,y:60-Math.max(0,Math.min(1,b.value))*54})),p=BZ(h),y=`${p} L 372 60 L 0 60 Z`;return i.jsxs("svg",{viewBox:"0 0 372 82",style:{width:"100%",height:82,display:"block"},children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:"hrFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.28"}),i.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0"})]})}),i.jsx("line",{x1:"0",y1:6,x2:372,y2:6,stroke:"var(--border)",opacity:"0.18"}),i.jsx("line",{x1:"0",y1:66/2,x2:372,y2:66/2,stroke:"var(--border)",opacity:"0.25"}),i.jsx("line",{x1:"0",y1:60,x2:372,y2:60,stroke:"var(--border)"}),i.jsx("path",{d:y,fill:"url(#hrFill)"}),i.jsx("path",{d:p,fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round"}),i.jsx("circle",{cx:h[u-1].x,cy:h[u-1].y,r:"3.5",fill:"var(--accent)"}),i.jsx("text",{x:"0",y:77,fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"7d ago"}),i.jsx("text",{x:372/2,y:77,textAnchor:"middle",fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"3d"}),i.jsx("text",{x:372,y:77,textAnchor:"end",fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"now"})]})}function ng({label:e,value:t,color:n}){return i.jsxs("div",{className:"s-stat",children:[i.jsxs("div",{className:"s-stat-label",children:[i.jsx("span",{className:"s-stat-dot",style:{background:n}}),i.jsx("span",{className:"s-eyebrow",children:e})]}),i.jsx("span",{className:"s-stat-value",children:t})]})}function sg({label:e,right:t}){return i.jsxs("div",{className:"s-section-rule",children:[i.jsx("span",{className:"s-eyebrow",children:e}),i.jsx("span",{className:"s-section-rule-line"}),t&&i.jsx("span",{className:"s-section-rule-right",children:t})]})}function KS({ask:e,agents:t,navigate:n,operatorName:a,pending:o}){const u=t.find(m=>m.id===e.agentId)?.name??e.agentName??e.agentId,f=e.conversationId?{view:"conversation",conversationId:e.conversationId}:{view:"agents",agentId:e.agentId};return i.jsxs("div",{className:`s-ask-block${o?" s-ask-block--pending":""}`,style:{cursor:"pointer"},onClick:()=>n(f),children:[i.jsxs("div",{className:"s-ask-header",children:[i.jsx("span",{className:"s-eyebrow s-ask-label",children:o?"◌ ASK — AWAITING":"● ASK — RESOLVED"}),i.jsx("span",{style:{flex:1}}),i.jsx("span",{className:"s-eyebrow",children:Pe(e.updatedAt)})]}),i.jsxs("div",{className:"s-ask-body",children:[i.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:ct(u)},children:u[0]?.toUpperCase()??"?"}),i.jsxs("div",{className:"s-ask-body-copy",children:[i.jsxs("div",{className:"s-ask-route",children:[i.jsx("span",{className:"s-ask-route-name",children:u}),i.jsx("span",{children:" → "}),i.jsx("span",{style:{color:"var(--accent)"},children:a})]}),i.jsxs("div",{className:"s-ask-text",children:['"',e.summary??e.task,'"']})]})]}),o&&i.jsxs("div",{className:"s-ask-actions",children:[i.jsx("button",{className:"s-btn-fleet s-btn-fleet--primary",children:"Answer"}),i.jsx("button",{className:"s-btn-fleet",children:"Defer"}),i.jsx("button",{className:"s-btn-fleet",children:"Route…"}),i.jsx("span",{className:"s-ask-thinking",children:i.jsx("span",{className:"s-thinking-strip"})})]})]})}function HZ({agent:e,navigate:t}){const n=e.handle?`@${e.handle}`:e.id,a=e.role??e.agentClass,o=e.branch??"main",l=Jn(e.id);return i.jsxs("div",{className:"s-now-card",onClick:()=>t({view:"agents",agentId:e.id,conversationId:l,tab:"observe"}),children:[i.jsxs("div",{className:"s-now-card-head",children:[i.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:ct(e.name)},children:e.name[0]?.toUpperCase()??"?"}),i.jsxs("div",{className:"s-now-card-copy",children:[i.jsx("div",{className:"s-now-card-name",children:e.name}),i.jsxs("div",{className:"s-now-card-meta",children:[n," · ",a]})]}),i.jsx("span",{className:"s-now-card-live",children:"● live"})]}),i.jsx("div",{className:"s-now-card-task",children:e.cwd??`Working in ${e.project??"workspace"}`}),i.jsxs("div",{className:"s-now-card-ticker",children:[i.jsx("span",{className:"s-now-card-ticker-prompt",children:"›"}),i.jsx("span",{className:"s-now-card-ticker-text",children:"working…"}),i.jsx("span",{className:"s-now-card-cursor"})]}),i.jsxs("div",{className:"s-now-card-footer",children:[i.jsx("span",{children:e.updatedAt?`updated ${Pe(e.updatedAt)}`:"active"}),i.jsx("span",{children:o})]})]})}function FZ({items:e,agents:t,navigate:n}){const a=[...e].sort((u,f)=>f.ts-u.ts),o={"collaboration.ask":"?","message.sent":"·","message.received":"·","flight.started":"⌘","flight.completed":"⌘","agent.online":"→","agent.offline":"→","agent.registered":"→","collaboration.answer":"↳"},l={"collaboration.ask":"var(--amber)","collaboration.answer":"var(--accent)","message.sent":"var(--dim)","message.received":"var(--dim)","flight.started":"var(--muted)","flight.completed":"var(--green)","agent.online":"var(--accent)","agent.offline":"var(--dim)","agent.registered":"var(--accent)"};return i.jsxs("div",{className:"s-timeline",children:[i.jsx("div",{className:"s-timeline-spine"}),a.map(u=>{const f=u.actorName??"system",m=l[u.kind]??"var(--dim)",h=o[u.kind]??"·",p=u.kind.split(".").pop()??u.kind,y=u.conversationId?{view:"conversation",conversationId:u.conversationId}:null;return i.jsxs("div",{className:"s-timeline-row",style:{cursor:y?"pointer":void 0},onClick:y?()=>n(y):void 0,children:[i.jsx("div",{className:"s-timeline-bead",style:{background:m}}),i.jsx("span",{className:"s-timeline-time",children:Pe(u.ts)}),i.jsxs("div",{className:"s-timeline-actors",children:[i.jsx("span",{className:"s-timeline-kind-mark",style:{color:m},children:h}),i.jsx("div",{className:"s-avatar",style:{width:18,height:18,fontSize:9,background:ct(f)},children:f[0]?.toUpperCase()??"?"}),i.jsx("span",{className:"s-timeline-handle",children:f})]}),i.jsx("span",{className:"s-timeline-text",children:u.title??u.summary??""}),i.jsx("span",{className:"s-timeline-kind",children:p})]},u.id)})]})}const ZZ=v.lazy(()=>Ad(()=>import("./arc.es-nBIiEfYv.js"),[]).then(e=>({default:e.ArcDiagram})));function ci(e){if(!e)return"";const t=e.replace(/^https?:\/\//,"").split("/")[0],[n]=t.split(":");return n.split(".")[0]}function qZ(e){const t=e.hostName?.trim();if(t&&t.toLowerCase()!=="localhost")return ci(t)||t;const n=e.dnsName?.trim().replace(/\.$/,"");return n?ci(n)||n:ci(e.name)||e.name}function dv(e){if(!e)return"";const t=e.replace(/^https?:\/\//,"").split("/")[0],[n]=t.split(":");return n.replace(/\.$/,"").toLowerCase()}function ur(e){const t=dv(e);return t?t.split(".")[0]??t:""}function WZ(e){return e.brokerUrl?ci(e.brokerUrl):e.hostName?ci(e.hostName):e.id.slice(0,10)}function YZ(e,t){return Math.abs(e)>=Math.abs(t)?e>=0?["right","left"]:["left","right"]:t>=0?["bottom","top"]:["top","bottom"]}function GZ(e,t){const n=ur(t.hostName||t.name),a=ur(e.localNode?.hostName||e.localNode?.name);return!!a&&n===a}function KZ(e,t){const n=new Set([ur(e.hostName),ur(e.name),...e.addresses.map(o=>dv(o)),...e.addresses.map(o=>ur(o))].filter(Boolean)),a=new Set([ur(t.hostName),ur(t.name),dv(t.brokerUrl),ur(t.brokerUrl)].filter(Boolean));for(const o of n)if(a.has(o))return!0;return!1}function XZ(e){if(!e.localNode)return null;const t=e.localNode.id,n=Object.values(e.nodes).filter(b=>b.id!==t),a=e.tailscale.peers.filter(b=>!GZ(e,b)).filter(b=>!n.some(w=>KZ(b,w))),o=[...n.map(b=>({kind:"mesh",peer:b})),...a.map(b=>({kind:"tailnet",peer:b}))],l=800,u=300,f=l/2,m=u/2,h={[t]:{x:f,y:m,size:"m"}},p={[t]:{icon:"Database",name:ci(e.localNode.hostName)||e.localNode.name||"broker",subtitle:"this node",color:"violet"}},y=[];if(o.length===0)h.__placeholder={x:f+220,y:m,size:"m"},p.__placeholder={icon:"CircleDashed",name:"No peers yet",subtitle:"awaiting discovery",color:"zinc"},y.push({from:t,to:"__placeholder",fromAnchor:"right",toAnchor:"left",style:"pending"});else{const b=o.length,w=Math.min(170,100+b*10);o.forEach(({kind:j,peer:N},C)=>{const k=C/b*Math.PI*2-Math.PI/2,E=Math.round(f+w*Math.cos(k)),S=Math.round(m+w*Math.sin(k)),R=j==="mesh"?N.id:`tailnet:${N.id}`,A=j==="mesh"?ci(N.hostName)||N.name||"peer":qZ(N)||"tailnet",M=j==="mesh"?WZ(N):N.online?N.addresses[0]??"tailnet only":"tailnet offline";h[R]={x:E,y:S,size:j==="mesh"?"m":"s"},p[R]={icon:j==="mesh"?"Database":"CircleDashed",name:A,subtitle:M,color:j==="mesh"?N.advertiseScope==="mesh"?"emerald":"zinc":N.online?"sky":"zinc"};const[D,U]=YZ(E-f,S-m);y.push({from:t,to:R,fromAnchor:D,toAnchor:U,style:j==="mesh"?N.advertiseScope==="mesh"?"mesh":"local":N.online?"tailnet":"tailnet-offline"})})}return{layout:{width:l,height:u},nodes:h,nodeData:p,connectors:y,connectorStyles:{mesh:{color:"emerald",strokeWidth:2,label:"mesh"},local:{color:"zinc",strokeWidth:1.5},tailnet:{color:"sky",strokeWidth:1.5,dashed:!0,label:"tailnet"},"tailnet-offline":{color:"zinc",strokeWidth:1.25,dashed:!0,label:"tailnet"},pending:{color:"zinc",strokeWidth:1.5,dashed:!0}}}}function JZ({mesh:e}){const t=v.useMemo(()=>XZ(e),[e]);return t?i.jsx("div",{className:"s-mesh-topology",children:i.jsx(v.Suspense,{fallback:i.jsx("div",{className:"s-mesh-topology-fallback"}),children:i.jsx(ZZ,{data:t,className:"s-mesh-topology-canvas",mode:"light",theme:"cool",interactive:!0,showArcToggle:!1,defaultZoom:"fit",maxFitZoom:.95,hoverEffects:{dim:!0,lift:!0,glow:!0,highlightEdges:!0}})})}):null}function QZ(e){return e.code==="local_only"?"notice":e.severity==="error"?"error":"warning"}function eq(e){switch(e.code){case"tailscale_stopped":return"Stopped";case"local_only":return"Not discoverable";case"mesh_loopback":return"Wrong address";case"discovery_unconfigured":return"No path";default:return"Offline"}}function tq(e){return e?e.replace(/^https?:\/\//,"").split("/")[0]??e:"Unavailable"}function nq(e){const t=e.hostName?.trim();if(t&&t.toLowerCase()!=="localhost")return t;const n=e.dnsName?.trim().replace(/\.$/,"");return n?n.split(".")[0]??n:e.name}function sq(e){return e==="mesh"?"Announced to mesh":e==="local"?"Local only":e||"Not advertised"}function aq(e){return e.identity.discoverable?"success":e.health.reachable?"warning":"danger"}function rq(e){return e.identity.discoverable?"Discoverable":e.health.reachable?"Not discoverable":"Broker offline"}function iq(e){return!e.health.reachable||e.issues.some(t=>t.severity==="error")?"danger":e.issues.length>0?"warning":"success"}function oq(e){return e.health.reachable?e.issues.some(t=>t.severity==="error")?"Degraded":e.issues.length>0?"Needs attention":"Healthy":"Broker unreachable"}function lq({issue:e}){const t=QZ(e);return i.jsxs("article",{className:`sys-issue-card sys-issue-card-${t}`,children:[i.jsxs("div",{className:"sys-issue-head",children:[i.jsx("h3",{className:"sys-issue-title",children:e.title}),i.jsx("span",{className:`sys-chip sys-chip-${t==="error"?"failed":t}`,children:eq(e)})]}),i.jsx("p",{className:"sys-issue-body",children:e.summary}),(e.action||e.actionCommand)&&i.jsxs("div",{className:"sys-issue-action",children:[e.actionCommand&&i.jsx("code",{className:"sys-code-inline",children:e.actionCommand}),e.action&&i.jsx("span",{children:e.action})]})]})}function cq({navigate:e}){const[t,n]=v.useState(null),[a,o]=v.useState(!0),[l,u]=v.useState(!1),[f,m]=v.useState(!1),[h,p]=v.useState(!1),[y,b]=v.useState(null),[w,j]=v.useState(null),[N,C]=v.useState(null),[k,E]=v.useState(null),S=v.useRef(null),R=v.useRef(0);v.useEffect(()=>{S.current=t},[t]);const A=v.useCallback(async(H="initial")=>{const $=++R.current;!(S.current!==null)&&H!=="background"?(o(!0),C(null)):u(!0);try{const X=await Ce("/api/mesh");if($!==R.current)return;n(X),C(null),E(Date.now())}catch(X){if($!==R.current)return;C(X instanceof Error?X.message:String(X))}finally{$===R.current&&(o(!1),u(!1))}},[]);v.useEffect(()=>{A("initial")},[A]),v.useEffect(()=>{const H=setInterval(()=>{A("background")},1e4);return()=>clearInterval(H)},[A]);const M=v.useCallback(async()=>{m(!0),b(null);try{const H=await Ce("/api/mesh/announce",{method:"POST",body:"{}"});n(H),S.current=H,C(null),E(Date.now()),b({tone:H.identity.discoverable?"success":"warning",title:H.identity.discoverable?"Mesh updated.":"Mesh updated, but still needs attention.",message:H.identity.discoverable?"This broker is now announced to the mesh.":"Mesh visibility was updated, but this broker still is not peer-reachable."})}catch(H){b({tone:"warning",title:"Could not announce broker.",message:H instanceof Error?H.message:String(H)})}finally{m(!1)}},[]),D=v.useCallback(async()=>{p(!0),j(null);try{const H=await Ce("/api/mesh/tailscale",{method:"POST",body:JSON.stringify({action:"open_app"})});n(H),S.current=H,C(null),E(Date.now()),j({tone:H.tailscale.running?"success":"warning",title:H.tailscale.running?"Tailscale is running.":"Tailscale launch requested.",message:H.tailscale.running?"Mesh discovery can resume on this machine.":"Scout asked macOS to open Tailscale. Approve any prompts, then refresh this page in a moment."})}catch(H){j({tone:"warning",title:"Could not open Tailscale.",message:H instanceof Error?H.message:String(H)})}finally{p(!1)}},[]),U=t?iq(t):"warning",F=t?oq(t):"Loading",P=t?Object.values(t.nodes):[],_=t?.localNode?.id,z=t?.localNode?.hostName?.toLowerCase(),B=P.filter(H=>H.id!==_),V=(t?.tailscale.peers??[]).filter(H=>{const $=H.hostName?.toLowerCase();return!$||$==="localhost"?!0:!(z&&($===z||$.startsWith(`${z.split(".")[0]}.`)))}),K=t?t.issues.length>0?t.issues:t.warnings.map((H,$)=>({code:`fallback-${$}`,severity:"warning",title:"Mesh notice",summary:H,action:null,actionCommand:null})):[],L=v.useMemo(()=>t?[{label:"Broker",value:t.health.reachable?"Reachable":"Unavailable",detail:t.health.error??tq(t.brokerUrl)},{label:"Discoverable",value:t.identity.discoverable?"Yes":"No",detail:t.identity.modeLabel},{label:"Mesh peers",value:`${B.length}`,detail:B.length>0?"Remote brokers in this mesh":"No remote brokers discovered"},{label:"Tailnet",value:t.tailscale.available?t.tailscale.running?`${V.filter(H=>H.online).length}/${V.length}`:"Stopped":"Unavailable",detail:t.tailscale.available?t.tailscale.running?"Online peers / visible peers":`Backend state: ${t.tailscale.backendState??"unknown"}`:"Tailscale was not detected on this machine"}]:[],[V,t,B.length]);return i.jsxs("div",{className:"sys-surface-page",children:[i.jsxs("div",{className:"sys-page-head",children:[i.jsxs("div",{className:"sys-page-title-group",children:[i.jsx("h2",{className:"sys-page-title",children:"Mesh"}),i.jsx("p",{className:"sys-page-subtitle",children:"Who this broker is, whether peers can discover it, and what the current mesh can see."})]}),i.jsxs("div",{className:"sys-page-actions",children:[i.jsx("span",{className:`sys-chip sys-chip-${U}`,children:F}),t?.tailscale.available&&!t.tailscale.running&&i.jsx("span",{className:"sys-chip sys-chip-warning",children:"Tailnet stopped"}),i.jsx("div",{className:"sys-sync-note",children:a?"Loading system snapshot...":N&&t?`Showing last confirmed snapshot from ${k?Pe(k):"earlier"}`:k?`Confirmed ${Pe(k)}`:"Waiting for first snapshot"}),i.jsx("button",{type:"button",className:"s-btn",disabled:a||l,onClick:()=>{A("manual")},children:l?"Refreshing...":"Refresh"})]})]}),N&&t&&i.jsxs("div",{className:"sys-banner sys-banner-warning",children:[i.jsx("strong",{children:"Mesh refresh failed."}),i.jsx("span",{children:N})]}),a&&!t&&i.jsxs("div",{className:"sys-panel sys-state-card",children:[i.jsx("h3",{className:"sys-state-title",children:"Loading mesh status"}),i.jsx("p",{className:"sys-state-body",children:"Inspecting broker reachability and peer discovery inputs."})]}),!a&&!t&&N&&i.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[i.jsx("h3",{className:"sys-state-title",children:"Mesh status is unavailable"}),i.jsx("p",{className:"sys-state-body",children:N}),i.jsx("div",{className:"sys-inline-actions",children:i.jsx("button",{type:"button",className:"s-btn",onClick:()=>{A("manual")},children:"Try again"})})]}),t&&i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"sys-panel sys-mesh-identity",children:[i.jsxs("div",{className:"sys-section-head",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"sys-section-title",children:"This broker"}),i.jsx("p",{className:"sys-section-subtitle",children:"The identity peers will learn if they discover this machine."})]}),i.jsx("span",{className:`sys-chip sys-chip-${aq(t)}`,children:rq(t)})]}),t.tailscale.available&&!t.tailscale.running&&i.jsxs("div",{className:"sys-banner sys-banner-warning",children:[i.jsx("strong",{children:"Tailscale is stopped."}),i.jsx("span",{children:t.tailscale.health[0]??"This machine is showing cached Tailnet peers, but the local Tailscale backend is not running."})]}),t.tailscale.available&&!t.tailscale.running&&i.jsxs("div",{className:"sys-inline-actions",children:[i.jsx("button",{type:"button",className:"s-btn",disabled:h,onClick:()=>{D()},children:h?"Opening Tailscale...":"Open Tailscale"}),i.jsx("button",{type:"button",className:"s-btn",disabled:h||l,onClick:()=>{A("manual")},children:l?"Refreshing...":"Refresh status"})]}),i.jsxs("div",{className:"sys-detail-grid",children:[i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Who Am I"}),i.jsx("span",{className:"sys-detail-value",children:t.identity.name??t.localNode?.name??"Unavailable"})]}),i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Node ID"}),i.jsx("code",{className:"sys-detail-value",children:t.identity.nodeId??"Unavailable"})]}),i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Mesh"}),i.jsx("code",{className:"sys-detail-value",children:t.identity.meshId??"Unassigned"})]}),i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Mode"}),i.jsx("span",{className:"sys-detail-value",children:t.identity.modeLabel})]}),i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Discoverable"}),i.jsx("span",{className:"sys-detail-value",children:t.identity.discoverable?"Yes":"No"})]}),i.jsxs("div",{className:"sys-detail-card",children:[i.jsx("span",{className:"sys-detail-label",children:"Announced As"}),i.jsx("code",{className:"sys-detail-value",children:t.identity.announceUrl??"Not announced"})]})]}),i.jsxs("div",{className:`sys-banner ${t.identity.discoverable?"sys-banner-success":"sys-banner-muted"}`,children:[i.jsx("strong",{children:"How peers find you."}),i.jsx("span",{children:t.identity.discoveryDetail})]}),!t.identity.discoverable&&t.health.reachable&&i.jsx("div",{className:"sys-inline-actions",children:i.jsx("button",{type:"button",className:"s-btn",disabled:f,onClick:()=>{M()},children:f?"Announcing...":"Announce on mesh"})}),y&&i.jsxs("div",{className:`sys-banner ${y.tone==="success"?"sys-banner-success":"sys-banner-warning"}`,children:[i.jsx("strong",{children:y.title}),i.jsx("span",{children:y.message})]}),w&&i.jsxs("div",{className:`sys-banner ${w.tone==="success"?"sys-banner-success":"sys-banner-warning"}`,children:[i.jsx("strong",{children:w.title}),i.jsx("span",{children:w.message})]})]}),i.jsx("div",{className:"sys-stat-grid",children:L.map(H=>i.jsxs("div",{className:"sys-stat-card",children:[i.jsx("span",{className:"sys-stat-label",children:H.label}),i.jsx("strong",{className:"sys-stat-value",children:H.value}),i.jsx("span",{className:"sys-stat-detail",children:H.detail})]},H.label))}),i.jsxs("section",{className:"sys-panel",children:[i.jsx("div",{className:"sys-section-head",children:i.jsxs("div",{children:[i.jsx("h3",{className:"sys-section-title",children:"Health notices"}),i.jsx("p",{className:"sys-section-subtitle",children:"Warnings and errors from the current broker and discovery snapshot."})]})}),K.length>0?i.jsx("div",{className:"sys-issue-grid",children:K.map((H,$)=>i.jsx(lq,{issue:H},`${H.code}-${$}`))}):i.jsxs("div",{className:"sys-list-empty",children:[i.jsx("h3",{children:"No active mesh warnings"}),i.jsx("p",{children:"The broker is reachable and discovery inputs look healthy from this page."})]})]}),i.jsxs("section",{className:"sys-panel",children:[i.jsx("div",{className:"sys-section-head",children:i.jsxs("div",{children:[i.jsx("h3",{className:"sys-section-title",children:"Topology"}),i.jsx("p",{className:"sys-section-subtitle",children:"Current broker relationships plus visible tailnet peers from this machine."})]})}),t.localNode?i.jsx(JZ,{mesh:t}):i.jsxs("div",{className:"sys-list-empty",children:[i.jsx("h3",{children:"Topology unavailable"}),i.jsx("p",{children:"A local node record is required before the topology view can render."})]})]}),i.jsxs("section",{className:"sys-panel",children:[i.jsx("div",{className:"sys-section-head",children:i.jsxs("div",{children:[i.jsx("h3",{className:"sys-section-title",children:"Discovered peers"}),i.jsxs("p",{className:"sys-section-subtitle",children:["Remote brokers registered in ",t.meshId??"this mesh","."]})]})}),B.length===0?i.jsxs("div",{className:"sys-list-empty",children:[i.jsx("h3",{children:"No remote brokers discovered"}),i.jsx("p",{children:"This can be normal on a single-node setup. If you expect peers, check the health notices above."})]}):i.jsx("div",{className:"sys-list-grid",children:B.map(H=>i.jsxs("article",{className:"sys-list-card",children:[i.jsxs("div",{className:"sys-list-card-head",children:[i.jsx("h3",{className:"sys-list-card-title",children:H.name}),i.jsx("span",{className:`sys-chip sys-chip-${H.advertiseScope==="mesh"?"success":"neutral"}`,children:sq(H.advertiseScope)})]}),i.jsxs("div",{className:"sys-list-card-detail",children:[i.jsx("span",{className:"sys-detail-label",children:"Node id"}),i.jsx("code",{className:"sys-detail-value",children:H.id})]}),H.brokerUrl&&i.jsxs("div",{className:"sys-list-card-detail",children:[i.jsx("span",{className:"sys-detail-label",children:"Broker"}),i.jsx("code",{className:"sys-detail-value",children:H.brokerUrl})]}),i.jsxs("div",{className:"sys-list-card-detail",children:[i.jsx("span",{className:"sys-detail-label",children:"Last seen"}),i.jsx("span",{className:"sys-detail-value",children:H.lastSeenAt?Pe(H.lastSeenAt):"Recently registered"})]})]},H.id))})]}),i.jsxs("section",{className:"sys-panel",children:[i.jsx("div",{className:"sys-section-head",children:i.jsxs("div",{children:[i.jsx("h3",{className:"sys-section-title",children:"Tailnet"}),i.jsx("p",{className:"sys-section-subtitle",children:"External Tailscale peers visible from this machine."})]})}),V.length===0?i.jsxs("div",{className:"sys-list-empty",children:[i.jsx("h3",{children:"No external tailnet peers"}),i.jsx("p",{children:t.tailscale.available?t.tailscale.running?"Only this host is visible in the current tailnet snapshot.":"Tailscale is installed but currently stopped on this machine.":"Tailscale peers were not detected on this machine."})]}):i.jsx("div",{className:"sys-list-grid",children:V.map(H=>i.jsxs("article",{className:"sys-list-card",children:[i.jsxs("div",{className:"sys-list-card-head",children:[i.jsx("h3",{className:"sys-list-card-title",children:nq(H)}),i.jsx("span",{className:`sys-chip sys-chip-${H.online?"success":"failed"}`,children:H.online?"Online":"Offline"})]}),i.jsxs("div",{className:"sys-list-card-detail",children:[i.jsx("span",{className:"sys-detail-label",children:"Address"}),i.jsx("code",{className:"sys-detail-value",children:H.addresses?.[0]??"Unavailable"})]}),i.jsxs("div",{className:"sys-list-card-detail",children:[i.jsx("span",{className:"sys-detail-label",children:"Platform"}),i.jsx("span",{className:"sys-detail-value",children:H.os??"Unknown"})]})]},H.id))})]})]})]})}const uq=[[/```[\s\S]*?```/g," "],[/`([^`]+)`/g,"$1"],[/!\[([^\]]*)\]\([^)]+\)/g,"$1"],[/\[([^\]]+)\]\([^)]+\)/g,"$1"],[/\*\*(.+?)\*\*/g,"$1"],[/__(.+?)__/g,"$1"],[new RegExp("(?<!\\*)\\*(?!\\*)([^*\\n]+)\\*(?!\\*)","g"),"$1"],[new RegExp("(?<!_)_(?!_)([^_\\n]+)_(?!_)","g"),"$1"],[/~~(.+?)~~/g,"$1"],[/^#{1,6}\s+/gm,""],[/^>\s?/gm,""],[/^[-*+]\s+/gm,""],[/^\d+\.\s+/gm,""],[/^---+\s*$/gm,""],[/^\s*\|.*\|\s*$/gm,""]];function dq(e,t=140){if(!e)return"";let n=e;for(const[a,o]of uq)n=n.replace(a,o);return n=n.replace(/\s+/g," ").trim(),n.length>t&&(n=`${n.slice(0,t-1)}…`),n}function fq(){const e=window.getSelection();return e!==null&&e.toString().trim().length>0}function hq(e){fq()||e()}const XS={direct:"DM",channel:"Channel",group_direct:"Group",thread:"Thread"},mq=new Set(["all","direct","channel","group_direct","thread"]);function fv(e){return typeof window>"u"?"":new URLSearchParams(window.location.search).get(e)??""}function pq(e){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search);for(const[a,o]of Object.entries(e))o===null||o===""?t.delete(a):t.set(a,o);const n=t.toString();window.history.replaceState(null,"",window.location.pathname+(n?`?${n}`:""))}function gq(){const e=fv("view");return mq.has(e)?e:"all"}function vq(e){return e.kind==="direct"&&e.agentName?e.agentName:e.title.replace(/\s*<>\s*/g," · ")}function yq(e){return e.trim().toLowerCase()}function xq(e){return[e.id,e.title,e.preview??"",e.agentName??"",e.harness??"",e.harnessSessionId??"",e.harnessLogPath??"",...e.participantIds]}function JS(e,t){if(!t)return null;const n=e.harnessSessionId?.trim();return n&&n.toLowerCase().includes(t)?n:null}function bq(e){if(!e)return null;const t=e.replace(/[\\/]+$/,"");return t?t.split(/[\\/]/).filter(Boolean).at(-1)??t:null}function wq(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return"";const t=e<1e12?e*1e3:e;return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function jq({navigate:e}){const[t,n]=v.useState([]),[a,o]=v.useState(()=>gq()),[l,u]=v.useState(()=>fv("q")),[f,m]=v.useState(()=>fv("unread")==="1"),[h,p]=v.useState(()=>Cy()),[y,b]=v.useState(0),[w,j]=v.useState(null),N=v.useRef(null),C=v.useRef(null),k=Yf(),E=v.useCallback(async()=>{j(null);try{const z=await Ce("/api/sessions");n(z.sort((B,V)=>(V.lastMessageAt??0)-(B.lastMessageAt??0)))}catch(z){j(z instanceof Error?z.message:String(z))}},[]);v.useEffect(()=>{E()},[E]),fn(()=>{E()});const[,S]=v.useState(0);v.useEffect(()=>{const z=setInterval(()=>S(B=>B+1),15e3);return()=>clearInterval(z)},[]),v.useEffect(()=>{pq({view:a==="all"?null:a,q:l.trim()||null,unread:f?"1":null})},[a,l,f]);const R=v.useMemo(()=>Array.from(new Set(t.map(z=>z.kind))),[t]),A=v.useMemo(()=>{const z={all:t.length};for(const B of t)z[B.kind]=(z[B.kind]??0)+1;return z},[t]),M=v.useMemo(()=>yq(l),[l]),D=v.useMemo(()=>t.filter(z=>Jp(z.lastMessageAt,z.id,h)).length,[t,h]),U=v.useMemo(()=>t.filter(z=>!(a!=="all"&&z.kind!==a||f&&!Jp(z.lastMessageAt,z.id,h)||M&&!xq(z).some(V=>V.toLowerCase().includes(M)))),[t,a,f,h,M]);v.useEffect(()=>{y>=U.length&&b(Math.max(0,U.length-1))},[U.length,y]);const F=v.useCallback((z,B={})=>{if(p(_F(z.id)),B.observe&&z.agentId){e({view:"agents",agentId:z.agentId,conversationId:z.id,tab:"observe"});return}e({view:"conversation",conversationId:z.id})},[e]);v.useEffect(()=>{function z(B){const V=B.target,K=V instanceof HTMLInputElement||V instanceof HTMLTextAreaElement||V instanceof HTMLElement&&V.isContentEditable;if((B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="k"){B.preventDefault(),N.current?.focus(),N.current?.select();return}if(K){B.key==="Escape"&&V===N.current&&N.current?.blur();return}if(B.key==="/"){B.preventDefault(),N.current?.focus();return}if(B.key==="j"||B.key==="ArrowDown"){B.preventDefault(),b(L=>Math.min(U.length-1,L+1));return}if(B.key==="k"||B.key==="ArrowUp"){B.preventDefault(),b(L=>Math.max(0,L-1));return}if(B.key==="Enter"||B.key==="o"){const L=U[y];L&&(B.preventDefault(),F(L,{observe:!!JS(L,M)}))}}return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[U,y,F,M]),v.useEffect(()=>{C.current?.querySelector(`[data-idx="${y}"]`)?.scrollIntoView({block:"nearest"})},[y]);const P=R.length>1,_=f?D>0?`${D} unread threads need attention.`:"No unread threads right now.":U.length===t.length?"Recent activity across every conversation.":`${U.length} conversations match the current filters.`;return i.jsxs("div",{className:"s-sessions-screen s-inbox-thread-redesign",children:[i.jsx("section",{className:"s-thread-overview",children:i.jsxs("div",{className:"s-thread-overview-copy",children:[i.jsxs("div",{className:"s-sessions-header s-thread-overview-heading",children:[i.jsx("h2",{className:"s-page-title",children:"Sessions"}),i.jsxs("span",{className:"s-meta s-tabular",children:[U.length," of ",t.length]})]}),i.jsx("p",{className:"s-thread-overview-summary",children:_})]})}),i.jsxs("section",{className:"s-thread-panel s-thread-panel-list",children:[i.jsxs("div",{className:"s-sessions-toolbar",children:[P&&i.jsxs("div",{className:"s-seg",role:"tablist","aria-label":"Session kind",children:[i.jsx(QS,{label:"All",count:A.all,pressed:a==="all",onClick:()=>o("all")}),R.map(z=>i.jsx(QS,{label:XS[z]??z,count:A[z]??0,pressed:a===z,onClick:()=>o(z)},z))]}),i.jsxs("button",{type:"button",className:`s-seg-standalone${f?" is-on":""}`,onClick:()=>m(z=>!z),"aria-pressed":f,title:"Show unread only",children:[i.jsx("span",{className:"s-dot s-dot-sm","aria-hidden":"true"}),i.jsx("span",{children:"Unread"}),D>0&&i.jsx("span",{className:"s-seg-count",children:D})]}),i.jsxs("div",{className:"s-search",children:[i.jsx("input",{ref:N,type:"text",className:"s-search-input",placeholder:"Search conversations or session IDs…",value:l,onChange:z=>u(z.target.value),onKeyDown:z=>{z.key==="Escape"&&(l?u(""):z.target.blur())}}),i.jsx("kbd",{className:"s-search-kbd",children:"⌘K"})]})]}),w&&i.jsx("p",{className:"s-error",children:w}),U.length===0?i.jsxs("div",{className:"s-empty s-thread-empty-state",children:[i.jsx("p",{children:l||f?"No matches":"No conversations"}),i.jsx("p",{children:l?"Try a different search term.":f?"You're all caught up.":"Conversations appear here when agents communicate."})]}):i.jsx("div",{className:"s-inbox",ref:C,role:"listbox","aria-label":"Sessions",children:U.map((z,B)=>{const V=vq(z),K=(z.agentName??V)[0]?.toUpperCase()??"?",L=Jp(z.lastMessageAt,z.id,h),H=B===y,$=dq(z.preview,160),G=XS[z.kind]??z.kind,X=bq(z.workspaceRoot),O=JS(z,M);return i.jsxs("div",{"data-idx":B,"data-unread":L?"true":"false","data-selected":H?"true":"false",className:"s-inbox-row",role:"option","aria-selected":H,tabIndex:H?0:-1,onClick:()=>{hq(()=>{b(B),F(z,{observe:!!O})})},onMouseEnter:()=>b(B),onContextMenu:Z=>{const W=window.getSelection()?.toString().trim(),Q=[];W&&(Q.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(W)}),Q.push({kind:"separator"})),Q.push({kind:"action",label:"Open Conversation",onSelect:()=>F(z)}),z.agentId&&Q.push({kind:"action",label:"Open Observe",onSelect:()=>F(z,{observe:!0})}),Q.push({kind:"action",label:"Copy Title",onSelect:()=>navigator.clipboard.writeText(V)}),z.id&&Q.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>navigator.clipboard.writeText(z.id)});const ce=z.harnessSessionId;ce&&Q.push({kind:"action",label:"Copy Harness Session ID",onSelect:()=>navigator.clipboard.writeText(ce)}),k(Z,Q)},children:[i.jsxs("div",{className:"s-session-avatar-wrap",children:[i.jsx("div",{className:"s-avatar",style:{background:ct(z.agentName??V)},"aria-hidden":"true",children:K}),L&&i.jsx("span",{className:"s-session-unread-dot","aria-hidden":"true"})]}),i.jsxs("div",{className:"s-inbox-body",children:[i.jsxs("div",{className:"s-inbox-header",children:[i.jsx("div",{className:"s-session-heading",children:i.jsx("span",{className:"s-inbox-name",title:V,children:V})}),i.jsx("div",{className:"s-session-trailing",children:z.lastMessageAt&&i.jsx("span",{className:"s-inbox-time s-tabular",title:wq(z.lastMessageAt),children:Pe(z.lastMessageAt)})})]}),$?i.jsx("p",{className:"s-inbox-preview",children:$}):i.jsx("p",{className:"s-inbox-preview s-inbox-preview-empty",children:"No messages yet"}),i.jsxs("div",{className:"s-session-meta-row","aria-label":"Conversation details",children:[i.jsx("span",{className:"s-session-pill",children:G}),O&&i.jsxs("span",{className:"s-session-pill",title:O,children:["session · ",O]}),X&&i.jsx("span",{className:"s-session-pill",title:z.workspaceRoot??void 0,children:X}),z.currentBranch&&i.jsx("span",{className:"s-session-pill",title:z.currentBranch,children:z.currentBranch})]})]})]},z.id)})})]})]})}function QS({label:e,count:t,pressed:n,onClick:a}){return i.jsxs("button",{type:"button",className:"s-seg-btn","aria-pressed":n,onClick:a,children:[i.jsx("span",{children:e}),i.jsx("span",{className:"s-seg-count",children:t})]})}var ti=(e=>(e[e.Border=-1]="Border",e[e.Data=0]="Data",e[e.Function=1]="Function",e[e.Position=2]="Position",e[e.Timing=3]="Timing",e[e.Alignment=4]="Alignment",e))(ti||{});const Sq=[0,1],DA=[1,0],zA=[2,3],PA=[3,2],Nq={L:Sq,M:DA,Q:zA,H:PA},kq=/^\d*$/,Eq=/^[A-Z0-9 $%*+./:-]*$/,ag="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Ty=1,Ay=40,eN=3,Cq=3,pd=40,Tq=10,LA=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],$A=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];class Aq{constructor(t,n,a,o){if(this.version=t,this.ecc=n,t<Ty||t>Ay)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=t*4+17;const l=Array.from({length:this.size}).fill(!1);for(let f=0;f<this.size;f++)this.modules.push(l.slice()),this.types.push(l.map(()=>0));this.drawFunctionPatterns();const u=this.addEccAndInterleave(a);if(this.drawCodewords(u),o===-1){let f=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const h=this.getPenaltyScore();h<f&&(o=m,f=h),this.applyMask(m)}}this.mask=o,this.applyMask(o),this.drawFormatBits(o)}size;mask;modules=[];types=[];getModule(t,n){return t>=0&&t<this.size&&n>=0&&n<this.size&&this.modules[n][t]}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2===0,ti.Timing),this.setFunctionModule(a,6,a%2===0,ti.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const t=this.getAlignmentPatternPositions(),n=t.length;for(let a=0;a<n;a++)for(let o=0;o<n;o++)a===0&&o===0||a===0&&o===n-1||a===n-1&&o===0||this.drawAlignmentPattern(t[a],t[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){const n=this.ecc[1]<<3|t;let a=n;for(let l=0;l<10;l++)a=a<<1^(a>>>9)*1335;const o=(n<<10|a)^21522;for(let l=0;l<=5;l++)this.setFunctionModule(8,l,Ea(o,l));this.setFunctionModule(8,7,Ea(o,6)),this.setFunctionModule(8,8,Ea(o,7)),this.setFunctionModule(7,8,Ea(o,8));for(let l=9;l<15;l++)this.setFunctionModule(14-l,8,Ea(o,l));for(let l=0;l<8;l++)this.setFunctionModule(this.size-1-l,8,Ea(o,l));for(let l=8;l<15;l++)this.setFunctionModule(8,this.size-15+l,Ea(o,l));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let a=0;a<12;a++)t=t<<1^(t>>>11)*7973;const n=this.version<<12|t;for(let a=0;a<18;a++){const o=Ea(n,a),l=this.size-11+a%3,u=Math.floor(a/3);this.setFunctionModule(l,u,o),this.setFunctionModule(u,l,o)}}drawFinderPattern(t,n){for(let a=-4;a<=4;a++)for(let o=-4;o<=4;o++){const l=Math.max(Math.abs(o),Math.abs(a)),u=t+o,f=n+a;u>=0&&u<this.size&&f>=0&&f<this.size&&this.setFunctionModule(u,f,l!==2&&l!==4,ti.Position)}}drawAlignmentPattern(t,n){for(let a=-2;a<=2;a++)for(let o=-2;o<=2;o++)this.setFunctionModule(t+o,n+a,Math.max(Math.abs(o),Math.abs(a))!==1,ti.Alignment)}setFunctionModule(t,n,a,o=ti.Function){this.modules[n][t]=a,this.types[n][t]=o}addEccAndInterleave(t){const n=this.version,a=this.ecc;if(t.length!==Bd(n,a))throw new RangeError("Invalid argument");const o=$A[a[0]][n],l=LA[a[0]][n],u=Math.floor(hv(n)/8),f=o-u%o,m=Math.floor(u/o),h=[],p=Lq(l);for(let b=0,w=0;b<o;b++){const j=t.slice(w,w+m-l+(b<f?0:1));w+=j.length;const N=$q(j,p);b<f&&j.push(0),h.push(j.concat(N))}const y=[];for(let b=0;b<h[0].length;b++)h.forEach((w,j)=>{(b!==m-l||j>=f)&&y.push(w[b])});return y}drawCodewords(t){if(t.length!==Math.floor(hv(this.version)/8))throw new RangeError("Invalid argument");let n=0;for(let a=this.size-1;a>=1;a-=2){a===6&&(a=5);for(let o=0;o<this.size;o++)for(let l=0;l<2;l++){const u=a-l,m=(a+1&2)===0?this.size-1-o:o;!this.types[m][u]&&n<t.length*8&&(this.modules[m][u]=Ea(t[n>>>3],7-(n&7)),n++)}}}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let n=0;n<this.size;n++)for(let a=0;a<this.size;a++){let o;switch(t){case 0:o=(a+n)%2===0;break;case 1:o=n%2===0;break;case 2:o=a%3===0;break;case 3:o=(a+n)%3===0;break;case 4:o=(Math.floor(a/3)+Math.floor(n/2))%2===0;break;case 5:o=a*n%2+a*n%3===0;break;case 6:o=(a*n%2+a*n%3)%2===0;break;case 7:o=((a+n)%2+a*n%3)%2===0;break;default:throw new Error("Unreachable")}!this.types[n][a]&&o&&(this.modules[n][a]=!this.modules[n][a])}}getPenaltyScore(){let t=0;for(let l=0;l<this.size;l++){let u=!1,f=0;const m=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[l][h]===u?(f++,f===5?t+=eN:f>5&&t++):(this.finderPenaltyAddHistory(f,m),u||(t+=this.finderPenaltyCountPatterns(m)*pd),u=this.modules[l][h],f=1);t+=this.finderPenaltyTerminateAndCount(u,f,m)*pd}for(let l=0;l<this.size;l++){let u=!1,f=0;const m=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][l]===u?(f++,f===5?t+=eN:f>5&&t++):(this.finderPenaltyAddHistory(f,m),u||(t+=this.finderPenaltyCountPatterns(m)*pd),u=this.modules[h][l],f=1);t+=this.finderPenaltyTerminateAndCount(u,f,m)*pd}for(let l=0;l<this.size-1;l++)for(let u=0;u<this.size-1;u++){const f=this.modules[l][u];f===this.modules[l][u+1]&&f===this.modules[l+1][u]&&f===this.modules[l+1][u+1]&&(t+=Cq)}let n=0;for(const l of this.modules)n=l.reduce((u,f)=>u+(f?1:0),n);const a=this.size*this.size,o=Math.ceil(Math.abs(n*20-a*10)/a)-1;return t+=o*Tq,t}getAlignmentPatternPositions(){if(this.version===1)return[];{const t=Math.floor(this.version/7)+2,n=this.version===32?26:Math.ceil((this.version*4+4)/(t*2-2))*2,a=[6];for(let o=this.size-7;a.length<t;o-=n)a.splice(1,0,o);return a}}finderPenaltyCountPatterns(t){const n=t[1],a=n>0&&t[2]===n&&t[3]===n*3&&t[4]===n&&t[5]===n;return(a&&t[0]>=n*4&&t[6]>=n?1:0)+(a&&t[6]>=n*4&&t[0]>=n?1:0)}finderPenaltyTerminateAndCount(t,n,a){return t&&(this.finderPenaltyAddHistory(n,a),n=0),n+=this.size,this.finderPenaltyAddHistory(n,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(t,n){n[0]===0&&(t+=this.size),n.pop(),n.unshift(t)}}function Ma(e,t,n){if(t<0||t>31||e>>>t)throw new RangeError("Value out of range");for(let a=t-1;a>=0;a--)n.push(e>>>a&1)}function Ea(e,t){return(e>>>t&1)!==0}class My{constructor(t,n,a){if(this.mode=t,this.numChars=n,this.bitData=a,n<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}getData(){return this.bitData.slice()}}const Mq=[1,10,12,14],Rq=[2,9,11,13],_q=[4,8,16,16];function UA(e,t){return e[Math.floor((t+7)/17)+1]}function BA(e){const t=[];for(const n of e)Ma(n,8,t);return new My(_q,e.length,t)}function Oq(e){if(!VA(e))throw new RangeError("String contains non-numeric characters");const t=[];for(let n=0;n<e.length;){const a=Math.min(e.length-n,3);Ma(Number.parseInt(e.substring(n,n+a),10),a*3+1,t),n+=a}return new My(Mq,e.length,t)}function Iq(e){if(!HA(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");const t=[];let n;for(n=0;n+2<=e.length;n+=2){let a=ag.indexOf(e.charAt(n))*45;a+=ag.indexOf(e.charAt(n+1)),Ma(a,11,t)}return n<e.length&&Ma(ag.indexOf(e.charAt(n)),6,t),new My(Rq,e.length,t)}function Dq(e){return e===""?[]:VA(e)?[Oq(e)]:HA(e)?[Iq(e)]:[BA(Pq(e))]}function VA(e){return kq.test(e)}function HA(e){return Eq.test(e)}function zq(e,t){let n=0;for(const a of e){const o=UA(a.mode,t);if(a.numChars>=1<<o)return Number.POSITIVE_INFINITY;n+=4+o+a.bitData.length}return n}function Pq(e){e=encodeURI(e);const t=[];for(let n=0;n<e.length;n++)e.charAt(n)!=="%"?t.push(e.charCodeAt(n)):(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2);return t}function hv(e){if(e<Ty||e>Ay)throw new RangeError("Version number out of range");let t=(16*e+128)*e+64;if(e>=2){const n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function Bd(e,t){return Math.floor(hv(e)/8)-LA[t[0]][e]*$A[t[0]][e]}function Lq(e){if(e<1||e>255)throw new RangeError("Degree out of range");const t=[];for(let a=0;a<e-1;a++)t.push(0);t.push(1);let n=1;for(let a=0;a<e;a++){for(let o=0;o<t.length;o++)t[o]=mv(t[o],n),o+1<t.length&&(t[o]^=t[o+1]);n=mv(n,2)}return t}function $q(e,t){const n=t.map(a=>0);for(const a of e){const o=a^n.shift();n.push(0),t.forEach((l,u)=>n[u]^=mv(l,o))}return n}function mv(e,t){if(e>>>8||t>>>8)throw new RangeError("Byte out of range");let n=0;for(let a=7;a>=0;a--)n=n<<1^(n>>>7)*285,n^=(t>>>a&1)*e;return n}function Uq(e,t,n=1,a=40,o=-1,l=!0){if(!(Ty<=n&&n<=a&&a<=Ay)||o<-1||o>7)throw new RangeError("Invalid value");let u,f;for(u=n;;u++){const y=Bd(u,t)*8,b=zq(e,u);if(b<=y){f=b;break}if(u>=a)throw new RangeError("Data too long")}for(const y of[DA,zA,PA])l&&f<=Bd(u,y)*8&&(t=y);const m=[];for(const y of e){Ma(y.mode[0],4,m),Ma(y.numChars,UA(y.mode,u),m);for(const b of y.getData())m.push(b)}const h=Bd(u,t)*8;Ma(0,Math.min(4,h-m.length),m),Ma(0,(8-m.length%8)%8,m);for(let y=236;m.length<h;y^=253)Ma(y,8,m);const p=Array.from({length:Math.ceil(m.length/8)},()=>0);return m.forEach((y,b)=>p[b>>>3]|=y<<7-(b&7)),new Aq(u,t,p,o)}function Bq(e,t){const{ecc:n="L",boostEcc:a=!1,minVersion:o=1,maxVersion:l=40,maskPattern:u=-1,border:f=1}=t||{},m=typeof e=="string"?Dq(e):Array.isArray(e)?[BA(e)]:void 0;if(!m)throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);const h=Uq(m,Nq[n],o,l,u,a),p=Vq({version:h.version,maskPattern:h.mask,size:h.size,data:h.modules,types:h.types},f);return t?.invert&&(p.data=p.data.map(y=>y.map(b=>!b))),t?.onEncoded?.(p),p}function Vq(e,t=1){if(!t)return e;const{size:n}=e,a=n+t*2;e.size=a,e.data.forEach(l=>{for(let u=0;u<t;u++)l.unshift(!1),l.push(!1)});for(let l=0;l<t;l++)e.data.unshift(Array.from({length:a},u=>!1)),e.data.push(Array.from({length:a},u=>!1));const o=ti.Border;e.types.forEach(l=>{for(let u=0;u<t;u++)l.unshift(o),l.push(o)});for(let l=0;l<t;l++)e.types.unshift(Array.from({length:a},u=>o)),e.types.push(Array.from({length:a},u=>o));return e}function tN(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hq(e,t={}){const n=Bq(e,t),{pixelSize:a=10,whiteColor:o="white",blackColor:l="black"}=t,u=n.size*a,f=n.size*a;let m=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${f} ${u}">`;const h=[];for(let p=0;p<n.size;p++)for(let y=0;y<n.size;y++){const b=y*a,w=p*a;n.data[p][y]&&h.push(`M${b},${w}h${a}v${a}h-${a}z`)}return m+=`<rect fill="${tN(o)}" width="${f}" height="${u}"/>`,m+=`<path fill="${tN(l)}" d="${h.join("")}"/>`,m+="</svg>",m}function Fq(e){return e?e.replace(/^wss?:\/\//,"").replace(/:\d+$/,""):null}function nN(e){return e?e.length<=18?e:`${e.slice(0,10)}...${e.slice(-6)}`:null}function Zq(e){return e?e.status==="paired"||e.status==="connected"?"success":e.status==="error"||e.status==="closed"?"danger":"warning":"warning"}function qq(e,t){if(!e)return null;const n=Math.max(0,Math.floor((e-t)/1e3));if(n===0)return null;if(n<60)return`${n}s`;const a=Math.floor(n/60),o=n%60;return o>0?`${a}m ${o}s`:`${a}m`}function sN({value:e}){const[t,n]=v.useState(!1),a=v.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},[e]);return i.jsx("button",{type:"button",className:"sys-copy-btn",onClick:a,title:"Copy",children:t?i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("polyline",{points:"20 6 9 17 4 12"})}):i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),i.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})}function Wq({navigate:e}){const[t,n]=v.useState(null),[a,o]=v.useState(""),[l,u]=v.useState(""),[f,m]=v.useState(!0),[h,p]=v.useState(!1),[y,b]=v.useState(!1),[w,j]=v.useState(null),[N,C]=v.useState(null),[k,E]=v.useState(null),[S,R]=v.useState(null),[A,M]=v.useState(()=>Date.now()),[D,U]=v.useState(null),F=v.useRef(null),P=v.useRef(0),_=v.useRef(null);v.useEffect(()=>{F.current=t},[t]),v.useEffect(()=>{_.current=w},[w]);const z=v.useCallback(async(ae="initial")=>{if(ae==="background"&&_.current)return;const ge=++P.current;!(F.current!==null)&&ae!=="background"?(m(!0),C(null)):p(!0);try{const be=await Ce(ae==="manual"?"/api/pairing-state/refresh":"/api/pairing-state");if(ge!==P.current)return;n(be),C(null),R(Date.now())}catch(be){if(ge!==P.current)return;C(be instanceof Error?be.message:String(be))}finally{ge===P.current&&(m(!1),p(!1))}},[]),B=v.useCallback(async()=>{try{const ae=await Ce("/api/user");u(ae.name),o(ae.name),E(null)}catch(ae){E(ae instanceof Error?ae.message:String(ae))}},[]),V=v.useRef(!1);v.useEffect(()=>{z("initial"),B()},[z,B]),v.useEffect(()=>{const ae=setInterval(()=>{z("background")},1e4);return()=>clearInterval(ae)},[z]),v.useEffect(()=>{if(!t?.pairing?.expiresAt)return;M(Date.now());const ae=setInterval(()=>{M(Date.now())},1e3);return()=>clearInterval(ae)},[t?.pairing?.expiresAt]);const K=v.useCallback(async()=>{b(!0),E(null);try{const ae=await Ce("/api/user",{method:"POST",body:JSON.stringify({name:a})});u(ae.name),o(ae.name)}catch(ae){E(ae instanceof Error?ae.message:String(ae))}finally{b(!1)}},[a]),L=v.useCallback(async ae=>{const ge=++P.current;j(ae),C(null);try{const ye=await Ce("/api/pairing/control",{method:"POST",body:JSON.stringify({action:ae})});if(ge!==P.current)return;n(ye),R(Date.now())}catch(ye){if(ge!==P.current)return;C(ye instanceof Error?ye.message:String(ye))}finally{ge===P.current&&j(null)}},[]);v.useEffect(()=>{!t||t.isRunning||V.current||(V.current=!0,L("start"))},[t,L]);const H=v.useCallback(async ae=>{U(ae);try{await Ce(`/api/pairing/peers/${encodeURIComponent(ae)}`,{method:"DELETE"}),z("manual")}catch{}finally{U(null)}},[z]),$=v.useMemo(()=>{const ae=t?.pairing?.qrValue?.trim();return ae?Hq(ae,{border:2,ecc:"M",pixelSize:8}):null},[t?.pairing?.qrValue]),G=Fq(t?.pairing?.relay??t?.relay??null),X=qq(t?.pairing?.expiresAt,A),Z=(t?.trustedPeers.find(ae=>ae.fingerprint===t.connectedPeerFingerprint)??null)?.name??nN(t?.connectedPeerFingerprint??null),W=Zq(t),Q=a.trim()!==l,ce=!f&&!t&&!!N;return i.jsxs("div",{className:"sys-surface-page sys-settings-page",children:[i.jsxs("div",{className:"sys-page-head",children:[i.jsxs("div",{className:"sys-page-title-group",children:[i.jsx("h2",{className:"sys-page-title",children:"Settings"}),i.jsx("p",{className:"sys-page-subtitle",children:"Identity, pairing, and trusted devices."})]}),i.jsxs("div",{className:"sys-page-actions",children:[t&&i.jsx("span",{className:`sys-chip sys-chip-${W}`,children:t.statusLabel}),i.jsx("div",{className:"sys-sync-note",children:f?"Loading...":N&&t?`Snapshot from ${S?Pe(S):"earlier"}`:S?`Updated ${Pe(S)}`:""}),i.jsx("button",{type:"button",className:"s-btn",disabled:f||h||!!w,onClick:()=>{z("manual")},children:h?"Refreshing...":"Refresh"})]})]}),N&&t&&i.jsxs("div",{className:"sys-banner sys-banner-warning",children:[i.jsx("strong",{children:"Refresh failed."}),i.jsx("span",{children:N})]}),k&&i.jsxs("div",{className:"sys-banner sys-banner-warning",children:[i.jsx("strong",{children:"Identity error."}),i.jsx("span",{children:k})]}),f&&!t&&i.jsxs("div",{className:"sys-panel sys-state-card",children:[i.jsx("h3",{className:"sys-state-title",children:"Loading settings"}),i.jsx("p",{className:"sys-state-body",children:"Checking relay status and trusted peers."})]}),ce&&i.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[i.jsx("h3",{className:"sys-state-title",children:"Pairing unavailable"}),i.jsx("p",{className:"sys-state-body",children:N}),i.jsx("div",{className:"sys-inline-actions",children:i.jsx("button",{type:"button",className:"s-btn",onClick:()=>{z("manual")},children:"Try again"})})]}),i.jsxs("div",{className:"sys-settings-hero",children:[i.jsx("div",{className:"sys-settings-qr-col",children:$?i.jsxs("div",{className:"sys-settings-qr-frame",children:[i.jsx("div",{className:"s-qr",dangerouslySetInnerHTML:{__html:$}}),X&&i.jsxs("span",{className:"sys-settings-qr-expires",children:["Expires in ",X]})]}):i.jsx("div",{className:"sys-settings-qr-empty",children:i.jsx("span",{className:"sys-settings-qr-empty-label",children:"Generating QR..."})})}),i.jsxs("div",{className:"sys-settings-info-col",children:[i.jsxs("div",{className:"sys-input-row",children:[i.jsx("input",{className:"sys-input",type:"text",placeholder:"Your name",value:a,onChange:ae=>o(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&Q&&!y&&K()}}),i.jsx("button",{type:"button",className:"s-btn s-btn-primary",disabled:!Q||y,onClick:()=>{K()},children:y?"Saving...":"Save"})]}),i.jsxs("div",{className:"sys-settings-kv-list",children:[t?.identityFingerprint&&i.jsxs("div",{className:"sys-settings-kv",children:[i.jsx("span",{className:"sys-settings-kv-label",children:"Fingerprint"}),i.jsxs("span",{className:"sys-settings-kv-value",children:[i.jsx("code",{children:t.identityFingerprint}),i.jsx(sN,{value:t.identityFingerprint})]})]}),G&&i.jsxs("div",{className:"sys-settings-kv",children:[i.jsx("span",{className:"sys-settings-kv-label",children:"Relay"}),i.jsxs("span",{className:"sys-settings-kv-value",children:[i.jsx("code",{children:G}),i.jsx(sN,{value:G})]})]}),t?.statusDetail&&i.jsxs("div",{className:"sys-settings-kv",children:[i.jsx("span",{className:"sys-settings-kv-label",children:"Status"}),i.jsx("span",{className:"sys-settings-kv-value sys-settings-kv-nowrap",children:t.statusDetail})]}),Z&&i.jsxs("div",{className:"sys-settings-kv",children:[i.jsx("span",{className:"sys-settings-kv-label",children:"Connected"}),i.jsx("span",{className:"sys-settings-kv-value",children:Z})]}),t?.secure&&i.jsxs("div",{className:"sys-settings-kv",children:[i.jsx("span",{className:"sys-settings-kv-label",children:"Security"}),i.jsx("span",{className:"sys-settings-kv-value",children:i.jsx("span",{className:"sys-chip sys-chip-success",children:"Noise XX"})})]})]}),t&&i.jsx("div",{className:"sys-inline-actions sys-settings-controls",children:t.isRunning?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"s-btn",disabled:!!w,onClick:()=>{L("restart")},children:w==="restart"?"Restarting...":"Restart"}),i.jsx("button",{type:"button",className:"s-btn",disabled:!!w,onClick:()=>{L("stop")},children:w==="stop"?"Stopping...":"Stop"})]}):i.jsx("button",{type:"button",className:"s-btn s-btn-primary",disabled:!!w,onClick:()=>{L("start")},children:w==="start"?"Starting...":"Start pairing"})})]})]}),t&&i.jsxs("section",{className:"sys-settings-peers",children:[i.jsx("div",{className:"sys-section-head",children:i.jsxs("div",{children:[i.jsx("h3",{className:"sys-section-title",children:"Trusted peers"}),i.jsxs("p",{className:"sys-section-subtitle",children:[t.trustedPeers.length," device",t.trustedPeers.length!==1?"s":""," paired with this broker."]})]})}),t.trustedPeers.length===0?i.jsxs("div",{className:"sys-list-empty",children:[i.jsx("h3",{children:"No trusted peers"}),i.jsx("p",{children:"Devices appear here after completing pairing."})]}):i.jsxs("table",{className:"sys-peers-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Device"}),i.jsx("th",{children:"Fingerprint"}),i.jsx("th",{children:"Paired"}),i.jsx("th",{children:"Last seen"}),i.jsx("th",{})]})}),i.jsx("tbody",{children:t.trustedPeers.map(ae=>{const ge=ae.fingerprint===t.connectedPeerFingerprint;return i.jsxs("tr",{className:ge?"sys-peers-row-connected":"",children:[i.jsx("td",{children:i.jsxs("span",{className:"sys-peers-name",children:[ae.name??nN(ae.fingerprint)??"Peer",ge&&i.jsx("span",{className:"sys-chip sys-chip-success sys-peers-badge",children:"Connected"})]})}),i.jsx("td",{children:i.jsx("code",{className:"sys-peers-fp",children:ae.fingerprint})}),i.jsx("td",{children:ae.pairedAtLabel??"—"}),i.jsx("td",{children:ae.lastSeenLabel??"—"}),i.jsx("td",{children:i.jsx("button",{type:"button",className:"sys-peers-remove",disabled:D===ae.fingerprint,onClick:()=>{H(ae.fingerprint)},title:"Remove peer",children:D===ae.fingerprint?"...":"Remove"})})]},ae.fingerprint)})})]})]})]})}const Yq=2500,Gq=1e4;function FA(e){const[t,n]=v.useState({}),a=v.useRef(!0),o=v.useRef(!1),l=v.useRef(!1),u=e.map(h=>h.id.trim()).filter(h=>h.length>0).join(","),f=e.some(h=>ft(h.state)==="working")?Yq:Gq,m=v.useCallback(async()=>{if(e.length===0){n({});return}if(o.current){l.current=!0;return}o.current=!0;try{const h=u?`?ids=${encodeURIComponent(u)}`:"",p=await Ce(`/api/observe/agents${h}`);if(!a.current)return;n(y=>{const b={};for(const w of e)b[w.id]=y[w.id];for(const w of p){const{agentId:j,...N}=w;b[j]=N}return b})}finally{o.current=!1,l.current&&(l.current=!1,m())}},[u,e]);return v.useEffect(()=>{if(a.current=!0,e.length===0)return n({}),()=>{a.current=!1};m();const h=setInterval(()=>{m()},f);return()=>{a.current=!1,clearInterval(h)}},[e.length,m,f]),t}function dr(e){switch(e.kind){case"tool":return`${e.tool??"tool"} ${e.arg??""}`.trim();case"think":return e.text.slice(0,120);case"ask":return`ask: ${e.text}`.slice(0,120);case"message":return e.text.slice(0,100);case"note":return e.text.slice(0,100);case"system":case"boot":return e.text.slice(0,100)}}const Jl=340,wf=220,oo=16,Kq=48,Xq=36,aN=28,gd=40,ZA=180,qA=140;function Jq(e){const t=Qq(e);if(t.length===0)return{groups:[],canvasW:0,canvasH:0};const n=Math.max(1,Math.round(Math.sqrt(t.length*1.4))),a=[],o=new Array(n).fill(gd),l=Array.from({length:n},(m,h)=>gd+h*(Jl*2+oo+Kq));for(const m of t){const h=o.indexOf(Math.min(...o)),p=l[h],y=o[h],b=Math.min(2,m.agents.length),w=Math.ceil(m.agents.length/b),j=b*Jl+(b-1)*oo,N=aN+w*wf+(w-1)*oo,C=m.agents.map((k,E)=>{const S=E%b,R=Math.floor(E/b);return{agentId:k.id,x:p+S*(Jl+oo),y:y+aN+R*(wf+oo)}});a.push({label:m.label,x:p,y,w:j,h:N,tiles:C}),o[h]=y+N+Xq}const u=Math.max(...l.map((m,h)=>m+Jl*2+oo))+gd,f=Math.max(...o)+gd;return{groups:a,canvasW:u,canvasH:f}}function Qq(e){const t={working:0,available:1,offline:2},n=[...e].sort((l,u)=>{const f=t[ft(l.state)]??1,m=t[ft(u.state)]??1;return f!==m?f-m:l.name.localeCompare(u.name)}),a=new Map;for(const l of n){const u=l.project??"unassigned";a.has(u)||a.set(u,[]),a.get(u).push(l)}const o=[];for(const[l,u]of a)o.push({label:l,agents:u});return o.sort((l,u)=>u.agents.length-l.agents.length),o}function eW(e){switch(e.kind){case"tool":return`$ ${dr(e)}`;case"think":return`~ ${dr(e)}`;case"ask":return`↗ ${dr(e)}`;case"message":return`→ ${dr(e)}`;case"note":return`+ ${dr(e)}`;case"system":case"boot":return`▸ ${dr(e)}`}}function WA(e,t,n){const a=n?.events.slice(-8).map(eW).filter(Boolean)??[];return a.length>0?a:ft(e.state)==="offline"?["No session trace available"]:["Waiting for session trace…",...t?[`task: ${t}`]:[]]}function tW(e){switch(ft(e)){case"working":return"var(--green)";case"available":return"var(--accent)";default:return"var(--dim)"}}function nW({color:e,data:t}){const n=t??[];if(n.length<2)return i.jsx("div",{style:{width:80,height:16,display:"flex",alignItems:"center",color:"var(--dim)",fontSize:10,letterSpacing:"0.08em",textTransform:"uppercase"},children:"No ctx"});const a=n.map((o,l)=>`${l/(n.length-1)*100},${20-o*18-1}`).join(" ");return i.jsx("svg",{viewBox:"0 0 100 20",preserveAspectRatio:"none",style:{width:80,height:16},children:i.jsx("polyline",{points:a,fill:"none",stroke:e,strokeWidth:"1"})})}function sW({navigate:e,agents:t}){const[n,a]=v.useState(null),[o,l]=v.useState(null),u=FA(t),f=v.useCallback(async P=>{await Ce(`/api/agents/${encodeURIComponent(P)}/interrupt`,{method:"POST",body:JSON.stringify({})})},[]),m=v.useRef(null),[h,p]=v.useState({w:0,h:0}),[y,b]=v.useState({x:0,y:0}),[w,j]=v.useState(1),N=v.useRef(!1),C=v.useRef({x:0,y:0,panX:0,panY:0});v.useEffect(()=>{const P=m.current;if(!P)return;const _=new ResizeObserver(([z])=>{const{width:B,height:V}=z.contentRect;p({w:B,h:V})});return _.observe(P),()=>_.disconnect()},[]);const k=v.useCallback(async()=>{try{l(await Ce("/api/fleet"))}catch{}},[]);v.useEffect(()=>{k()},[k]),fn(()=>{k()});const E=v.useMemo(()=>{const P={};for(const _ of o?.activeAsks??[])P[_.agentId]={agentId:_.agentId,task:_.task,summary:_.summary??null};return P},[o]),S=v.useMemo(()=>Jq(t),[t]);v.useEffect(()=>{if(S.canvasW===0||h.w===0)return;const P=Math.min(1,h.w/S.canvasW,h.h/S.canvasH),_=Math.max(.15,Math.min(1,P*.92));b({x:(h.w-S.canvasW*_)/2,y:Math.max(8,(h.h-S.canvasH*_)/2)}),j(_)},[S,h]);const R=v.useCallback(P=>{P.target.closest(".s-conductor-tile")||(N.current=!0,C.current={x:P.clientX,y:P.clientY,panX:y.x,panY:y.y})},[y]),A=v.useCallback(P=>{N.current&&b({x:C.current.panX+(P.clientX-C.current.x),y:C.current.panY+(P.clientY-C.current.y)})},[]),M=v.useCallback(()=>{N.current=!1},[]);v.useEffect(()=>{const P=m.current;if(!P)return;const _=z=>{z.preventDefault();const B=P.getBoundingClientRect(),V=z.clientX-B.left,K=z.clientY-B.top,L=z.deltaY>0?.92:1.08,H=Math.max(.2,Math.min(2,w*L)),$=H/w;b(G=>({x:V-(V-G.x)*$,y:K-(K-G.y)*$})),j(H)};return P.addEventListener("wheel",_,{passive:!1}),()=>P.removeEventListener("wheel",_)},[w]);const D=n?t.find(P=>P.id===n):null;v.useEffect(()=>{if(!D)return;const P=_=>{_.key==="Escape"&&a(null)};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[D]);const U=v.useCallback(P=>{const _=m.current;if(!_)return;const z=P.currentTarget.getBoundingClientRect(),B=P.clientX-z.left,V=P.clientY-z.top,K=Math.min(ZA/S.canvasW,qA/S.canvasH),L=B/K,H=V/K,$=_.clientWidth,G=_.clientHeight;b({x:$/2-L*w,y:G/2-H*w})},[S,w]),F=v.useMemo(()=>{const P={};for(const _ of S.groups)for(const z of _.tiles)P[z.agentId]={x:z.x,y:z.y};return P},[S]);return i.jsxs("div",{className:"s-conductor",children:[i.jsxs("div",{className:"s-conductor-bar",children:[i.jsxs("span",{className:"s-conductor-bar-label",children:[t.length," agent",t.length!==1?"s":""," ·"," ",S.groups.length," workspace",S.groups.length!==1?"s":""]}),i.jsxs("div",{className:"s-conductor-hotkeys",children:[i.jsxs("span",{className:"s-conductor-hotkey",children:[i.jsx("kbd",{children:"F"})," Freeze all"]}),i.jsxs("span",{className:"s-conductor-hotkey",children:[i.jsx("kbd",{children:"B"})," Broadcast"]}),i.jsxs("span",{className:"s-conductor-hotkey",children:[i.jsx("kbd",{children:"R"})," Route ask"]})]})]}),i.jsxs("div",{ref:m,className:"s-conductor-viewport",onMouseDown:R,onMouseMove:A,onMouseUp:M,onMouseLeave:M,children:[i.jsxs("div",{className:"s-conductor-canvas",style:{transform:`translate(${y.x}px, ${y.y}px) scale(${w})`},children:[S.groups.map(P=>i.jsx("div",{className:"s-conductor-group-label",style:{left:P.x,top:P.y},children:P.label},P.label)),t.map(P=>{const _=F[P.id];return _?i.jsx(iW,{agent:P,task:E[P.id]??null,observe:u[P.id]?.data??null,x:_.x,y:_.y,onClick:()=>a(P.id)},P.id):null})]}),i.jsx(aW,{layout:S,agents:t,pan:y,zoom:w,viewportRef:m,onClick:U})]}),D&&i.jsx(rW,{agent:D,task:E[D.id]??null,observe:u[D.id]?.data??null,onClose:()=>a(null),onTell:()=>{a(null),e({view:"conversation",conversationId:Jn(D.id),composeMode:"tell"})},onAsk:()=>{a(null),e({view:"conversation",conversationId:Jn(D.id),composeMode:"ask"})},onFreeze:ft(D.state)==="working"?()=>{a(null),f(D.id)}:void 0,onOpenProfile:()=>{a(null),e({view:"agents",agentId:D.id})}})]})}function aW({layout:e,agents:t,pan:n,zoom:a,viewportRef:o,onClick:l}){if(e.canvasW===0||t.length===0)return null;const u=Math.min(ZA/e.canvasW,qA/e.canvasH),f=e.canvasW*u,m=e.canvasH*u,h=o.current,p=h?.clientWidth??0,y=h?.clientHeight??0,b=-n.x/a*u,w=-n.y/a*u,j=p/a*u,N=y/a*u;return i.jsxs("div",{className:"s-conductor-minimap",style:{width:f,height:m,opacity:.85},onClick:l,children:[e.groups.map(C=>i.jsx("div",{className:"s-conductor-minimap-group",style:{left:C.x*u,top:C.y*u},children:C.label},C.label)),e.groups.flatMap(C=>C.tiles.map(k=>{const E=t.find(S=>S.id===k.agentId);return i.jsx("div",{className:"s-conductor-minimap-tile",style:{left:k.x*u,top:k.y*u,width:Jl*u,height:wf*u,background:E?ct(E.name):"var(--dim)",opacity:E&&ft(E.state)==="working"?.8:.35}},k.agentId)})),i.jsx("div",{className:"s-conductor-minimap-viewport",style:{left:Math.max(0,b),top:Math.max(0,w),width:Math.min(j,f),height:Math.min(N,m)}})]})}function rW({agent:e,task:t,observe:n,onClose:a,onTell:o,onAsk:l,onFreeze:u,onOpenProfile:f}){const m=WA(e,t?.summary??null,n);return i.jsx("div",{className:"s-conductor-overlay",onClick:a,children:i.jsxs("div",{className:"s-conductor-overlay-panel",onClick:h=>h.stopPropagation(),children:[i.jsxs("div",{className:"s-conductor-overlay-header",children:[i.jsx("div",{className:"s-ops-avatar",style:{"--size":"32px",background:ct(e.name)},children:e.name[0]?.toUpperCase()}),i.jsxs("div",{children:[i.jsxs("div",{style:{fontSize:16,fontWeight:500},children:[e.name," ",i.jsx("span",{style:{color:"var(--dim)",fontSize:12},children:e.handle?`@${e.handle}`:""})]}),i.jsxs("div",{className:"s-conductor-tile-meta",children:[e.project??"—"," · ",e.branch??"main"]})]}),i.jsx("span",{style:{flex:1}}),i.jsx("button",{className:"s-ops-btn",onClick:a,children:"ESC"})]}),i.jsxs("div",{className:"s-conductor-overlay-body",children:[i.jsx("div",{className:"s-conductor-overlay-task",children:t?.task??"No active task"}),i.jsxs("div",{className:"s-conductor-overlay-detail",children:["› ",t?.summary??Vs(e.state)]}),i.jsxs("div",{className:"s-conductor-terminal",style:{height:"auto",minHeight:160},children:[m.map((h,p)=>i.jsx("div",{className:`s-conductor-terminal-line${h.startsWith("$")?" s-conductor-terminal-line--cmd":""}${h.startsWith("→")||h.startsWith("+")?" s-conductor-terminal-line--result":""}`,children:h},p)),ft(e.state)==="working"&&i.jsx("span",{className:"s-conductor-terminal-cursor"})]})]}),i.jsxs("div",{className:"s-conductor-overlay-footer",children:[i.jsx("button",{className:"s-ops-btn s-ops-btn--primary",onClick:o,children:"Send instruction"}),i.jsx("button",{className:"s-ops-btn",onClick:u,disabled:!u,children:"Freeze"}),i.jsx("button",{className:"s-ops-btn",onClick:l,children:"Route ask"}),i.jsx("span",{style:{flex:1}}),i.jsx("button",{className:"s-ops-btn",onClick:f,children:"Open profile ↗"})]})]})})}function iW({agent:e,task:t,observe:n,x:a,y:o,onClick:l}){const u=ct(e.name),f=tW(e.state),m=Vs(e.state).toUpperCase(),h=WA(e,t?.summary??null,n),p=ft(e.state)==="working",y=n?.events[n.events.length-1],b=y?dr(y):t?.summary??Vs(e.state);return i.jsxs("div",{className:"s-conductor-tile",style:{left:a,top:o,height:wf},onClick:w=>{w.stopPropagation(),l()},children:[i.jsxs("div",{className:"s-conductor-tile-identity",children:[i.jsx("div",{className:"s-ops-avatar",style:{"--size":"24px",background:u},children:e.name[0]?.toUpperCase()}),i.jsxs("div",{className:"s-conductor-tile-identity-copy",children:[i.jsxs("div",{className:"s-conductor-tile-name",children:[e.name,i.jsx("span",{className:"s-conductor-tile-handle",children:e.handle?`@${e.handle}`:""})]}),i.jsxs("div",{className:"s-conductor-tile-meta",children:[e.project??"—"," · ",e.branch??"main"]})]}),i.jsx("span",{className:"s-ops-state-chip",style:{color:f},children:m})]}),i.jsx("div",{className:"s-conductor-tile-task",children:t?.task??"No active task"}),i.jsxs("div",{className:"s-conductor-terminal",children:[h.slice(-4).map((w,j)=>i.jsx("div",{className:`s-conductor-terminal-line${w.startsWith("$")?" s-conductor-terminal-line--cmd":""}${w.startsWith("→")||w.startsWith("+")?" s-conductor-terminal-line--result":""}`,style:{opacity:(j+1)/Math.min(4,h.length)},children:w},j)),p&&i.jsx("span",{className:"s-conductor-terminal-cursor"})]}),i.jsxs("div",{className:"s-conductor-tile-footer",children:[i.jsx(nW,{color:u,data:n?.contextUsage}),i.jsx("span",{className:"s-conductor-tile-detail",children:b}),p&&i.jsx("span",{className:"s-conductor-terminal-cursor"})]})]})}const Ql=420,jf=320,lo=20,oW=48,lW=36,rN=28,vd=40,YA=180,GA=140,KA="scout_mc_vp";function cW(e){try{localStorage.setItem(KA,JSON.stringify(e))}catch{}}function uW(){try{const e=localStorage.getItem(KA);if(!e)return null;const t=JSON.parse(e);if(typeof t?.zoom=="number"&&typeof t?.pan?.x=="number"&&typeof t?.pan?.y=="number")return t}catch{}return null}function dW(e){const t=fW(e);if(t.length===0)return{groups:[],canvasW:0,canvasH:0};const n=Math.max(1,Math.round(Math.sqrt(t.length*1.2))),a=[],o=new Array(n).fill(vd),l=Array.from({length:n},(m,h)=>vd+h*(Ql*2+lo+oW));for(const m of t){const h=o.indexOf(Math.min(...o)),p=l[h],y=o[h],b=Math.min(2,m.agents.length),w=Math.ceil(m.agents.length/b),j=b*Ql+(b-1)*lo,N=rN+w*jf+(w-1)*lo,C=m.agents.map((k,E)=>({agentId:k.id,x:p+E%b*(Ql+lo),y:y+rN+Math.floor(E/b)*(jf+lo)}));a.push({label:m.label,x:p,y,w:j,h:N,tiles:C}),o[h]=y+N+lW}const u=Math.max(...l.map(m=>m+Ql*2+lo))+vd,f=Math.max(...o)+vd;return{groups:a,canvasW:u,canvasH:f}}function fW(e){const t={working:0,available:1,offline:2},n=[...e].sort((l,u)=>{const f=t[ft(l.state)]??1,m=t[ft(u.state)]??1;return f!==m?f-m:l.name.localeCompare(u.name)}),a=new Map;for(const l of n){const u=l.project??"unassigned";a.has(u)||a.set(u,[]),a.get(u).push(l)}const o=[];for(const[l,u]of a)o.push({label:l,agents:u});return o.sort((l,u)=>u.agents.length-l.agents.length),o}const hW={think:"var(--dim)",tool:"var(--accent)",ask:"var(--amber)",message:"var(--muted)",note:"var(--green)",system:"var(--dim)",boot:"var(--dim)"},mW={think:"think",tool:"tool",ask:"ask",message:"msg",note:"note",system:"sys",boot:"boot"};function pW({navigate:e,agents:t}){const[n,a]=v.useState(null),o=FA(t),l=v.useRef(null),[u,f]=v.useState({w:0,h:0}),[m,h]=v.useState({x:0,y:0}),[p,y]=v.useState(1),[b,w]=v.useState(!1),j=v.useRef(!1),N=v.useRef({x:0,y:0,panX:0,panY:0}),C=v.useRef(!1);v.useEffect(()=>{const _=l.current;if(!_)return;const z=new ResizeObserver(([B])=>{f({w:B.contentRect.width,h:B.contentRect.height})});return z.observe(_),()=>z.disconnect()},[]);const k=v.useMemo(()=>dW(t),[t]),E=v.useRef([]),S=v.useCallback((_=!0)=>{if(k.canvasW===0||u.w===0)return;E.current.forEach(clearTimeout);const z=Math.min(1,u.w/k.canvasW,u.h/k.canvasH),B=Math.max(.15,Math.min(1,z*.92));w(!1),y(B),h({x:(u.w-k.canvasW*B)/2,y:Math.max(8,(u.h-k.canvasH*B)/2)});const V=setTimeout(()=>{w(!0);const L=_?uW():null;L?(h(L.pan),y(L.zoom)):(h({x:24,y:24}),y(.55))},700),K=setTimeout(()=>w(!1),1700);E.current=[V,K]},[k,u]);v.useEffect(()=>{k.canvasW===0||u.w===0||C.current||(C.current=!0,S(!0))},[k,u,S]),v.useEffect(()=>{const _=setInterval(()=>{cW({pan:m,zoom:p})},3e4);return()=>clearInterval(_)},[m,p]);const R=v.useCallback(_=>{_.target.closest(".s-mission-tile")||(j.current=!0,N.current={x:_.clientX,y:_.clientY,panX:m.x,panY:m.y})},[m]),A=v.useCallback(_=>{j.current&&h({x:N.current.panX+(_.clientX-N.current.x),y:N.current.panY+(_.clientY-N.current.y)})},[]),M=v.useCallback(()=>{j.current=!1},[]);v.useEffect(()=>{const _=l.current;if(!_)return;const z=B=>{B.preventDefault();const V=_.getBoundingClientRect(),K=B.clientX-V.left,L=B.clientY-V.top,H=B.deltaY>0?.92:1.08,$=Math.max(.2,Math.min(2,p*H)),G=$/p;h(X=>({x:K-(K-X.x)*G,y:L-(L-X.y)*G})),y($)};return _.addEventListener("wheel",z,{passive:!1}),()=>_.removeEventListener("wheel",z)},[p]);const D=n?t.find(_=>_.id===n):null;v.useEffect(()=>{const _=z=>{z.target.tagName==="INPUT"||z.target.tagName==="TEXTAREA"||(z.key==="Escape"&&a(null),(z.key==="h"||z.key==="H")&&S(!1))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[D,S]);const U=v.useCallback(_=>{const z=_.currentTarget.getBoundingClientRect(),B=_.clientX-z.left,V=_.clientY-z.top,K=Math.min(YA/k.canvasW,GA/k.canvasH),L=B/K,H=V/K,$=l.current;$&&h({x:$.clientWidth/2-L*p,y:$.clientHeight/2-H*p})},[k,p]),F=v.useMemo(()=>{const _={};for(const z of k.groups)for(const B of z.tiles)_[B.agentId]={x:B.x,y:B.y};return _},[k]),P=t.filter(_=>ft(_.state)==="working").length;return i.jsxs("div",{className:"s-mission",children:[i.jsxs("div",{className:"s-mission-bar",children:[i.jsxs("span",{className:"s-mission-bar-label",children:[t.length," agent",t.length!==1?"s":""," ·"," ",k.groups.length," workspace",k.groups.length!==1?"s":""]}),P>0&&i.jsxs("span",{className:"s-mission-bar-live",children:[i.jsx("span",{className:"s-mission-bar-live-dot"}),P," active"]}),i.jsxs("div",{className:"s-mission-hotkeys",children:[i.jsxs("button",{className:"s-mission-hotkey s-mission-hotkey--btn",onClick:()=>S(!1),title:"Reset to overview",children:[i.jsx("kbd",{children:"H"})," Home"]}),i.jsxs("span",{className:"s-mission-hotkey",children:[i.jsx("kbd",{children:"Esc"})," Close focus"]})]})]}),i.jsxs("div",{ref:l,className:"s-mission-viewport",onMouseDown:R,onMouseMove:A,onMouseUp:M,onMouseLeave:M,children:[t.length===0?i.jsxs("div",{className:"s-mission-empty",children:[i.jsx("div",{className:"s-mission-empty-title",children:"Mission Control"}),i.jsx("div",{className:"s-mission-empty-sub",children:"Connect agents to observe their sessions here."})]}):i.jsxs("div",{className:"s-mission-canvas",style:{transform:`translate(${m.x}px, ${m.y}px) scale(${p})`,transition:b?"transform 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94)":"none"},children:[k.groups.map(_=>i.jsx("div",{className:"s-mission-group-label",style:{left:_.x,top:_.y},children:_.label},_.label)),t.map(_=>{const z=F[_.id];if(!z)return null;const B=o[_.id];return i.jsx(gW,{agent:_,observe:B?.data??null,x:z.x,y:z.y,onClick:()=>a(_.id)},_.id)})]}),t.length>0&&i.jsx(yW,{layout:k,agents:t,pan:m,zoom:p,viewportRef:l,onClick:U})]}),D&&i.jsx(vW,{agent:D,observe:o[D.id]?.data??null,onClose:()=>a(null),onTell:()=>{a(null),e({view:"conversation",conversationId:Jn(D.id),composeMode:"tell"})},onAsk:()=>{a(null),e({view:"conversation",conversationId:Jn(D.id),composeMode:"ask"})},onProfile:()=>{a(null),e({view:"agents",agentId:D.id})}})]})}function gW({agent:e,observe:t,x:n,y:a,onClick:o}){const l=v.useRef(null),u=ft(e.state),f=ct(e.name),m=t?.events??[],h=m.slice(-8),p=t?.live===!0,y=m.some(C=>C.kind==="ask"&&!C.answer),b=t?.contextUsage,w=b&&b.length>0?Math.round(b[b.length-1]*100):null,j=m.filter(C=>C.kind==="tool").length,N=m.filter(C=>C.kind==="tool"&&C.tool==="edit").length;return v.useEffect(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[m.length]),i.jsxs("div",{className:`s-mission-tile${u==="working"?" s-mission-tile--working":""}${y?" s-mission-tile--asking":""}`,style:{left:n,top:a,height:jf},onClick:C=>{C.stopPropagation(),o()},children:[i.jsxs("div",{className:"s-mission-tile-header",children:[i.jsx("div",{className:"s-ops-avatar",style:{"--size":"22px",background:f},children:e.name[0]?.toUpperCase()}),i.jsxs("div",{className:"s-mission-tile-identity",children:[i.jsxs("div",{className:"s-mission-tile-name",children:[e.name,i.jsx("span",{className:"s-mission-tile-handle",children:e.handle?`@${e.handle}`:""})]}),i.jsxs("div",{className:"s-mission-tile-meta",children:[e.project??"—"," · ",e.branch??"main"]})]}),i.jsx("span",{className:"s-ops-state-chip",style:{color:xW(u)},children:Vs(e.state).toUpperCase()})]}),i.jsx("div",{className:"s-mission-tile-stream",ref:l,children:h.length===0?i.jsx("div",{className:"s-mission-tile-stream-inner",children:i.jsxs("div",{className:"s-mission-evt",children:[i.jsx("span",{className:"s-mission-evt-bead",style:{background:"var(--dim)"}}),i.jsx("span",{className:"s-mission-evt-text",style:{color:"var(--dim)"},children:u==="offline"?"No session data":"Waiting for events…"})]})}):i.jsx("div",{className:"s-mission-tile-stream-inner",children:h.map(C=>i.jsxs("div",{className:"s-mission-evt",children:[i.jsx("span",{className:"s-mission-evt-bead",style:{background:hW[C.kind]??"var(--dim)"}}),i.jsx("span",{className:"s-mission-evt-kind",children:mW[C.kind]??C.kind}),i.jsxs("span",{className:`s-mission-evt-text s-mission-evt-text--${C.kind}`,children:[dr(C),C.live&&i.jsx("span",{className:"s-observe-cursor"})]})]},C.id))})}),i.jsxs("div",{className:"s-mission-tile-footer",children:[w!==null&&i.jsx("div",{className:"s-mission-tile-ctx",title:`Context: ${w}%`,children:i.jsx("div",{className:"s-mission-tile-ctx-fill",style:{width:`${w}%`}})}),i.jsxs("div",{className:"s-mission-tile-stats",children:[j>0&&i.jsxs("span",{children:[j," tools"]}),N>0&&i.jsxs("span",{children:[N," edits"]})]}),p&&i.jsxs("span",{className:"s-mission-tile-live",children:[i.jsx("span",{className:"s-mission-tile-live-dot"}),"LIVE"]})]})]})}function vW({agent:e,observe:t,onClose:n,onTell:a,onAsk:o,onProfile:l}){const u=ct(e.name);return i.jsx("div",{className:"s-mission-overlay",onClick:n,children:i.jsxs("div",{onClick:f=>f.stopPropagation(),style:{display:"contents"},children:[i.jsxs("div",{className:"s-mission-overlay-header",children:[i.jsx("div",{className:"s-ops-avatar",style:{"--size":"28px",background:u},children:e.name[0]?.toUpperCase()}),i.jsxs("div",{children:[i.jsxs("div",{className:"s-mission-overlay-name",children:[e.name," ",i.jsx("span",{style:{color:"var(--dim)",fontSize:11},children:e.handle?`@${e.handle}`:""})]}),i.jsxs("div",{className:"s-mission-overlay-meta",children:[e.project??"—"," · ",e.branch??"main"," · ",Vs(e.state)]})]}),i.jsxs("div",{className:"s-mission-overlay-actions",children:[i.jsx("button",{className:"s-ops-btn s-ops-btn--primary",onClick:a,children:"Tell"}),i.jsx("button",{className:"s-ops-btn",onClick:o,children:"Ask"}),i.jsx("button",{className:"s-ops-btn",onClick:l,children:"Profile ↗"}),i.jsx("button",{className:"s-ops-btn",onClick:n,children:"ESC"})]})]}),i.jsx("div",{className:"s-mission-overlay-body",children:i.jsx(IA,{data:t??void 0,agentId:e.id})})]})})}function yW({layout:e,agents:t,pan:n,zoom:a,viewportRef:o,onClick:l}){if(e.canvasW===0)return null;const u=Math.min(YA/e.canvasW,GA/e.canvasH),f=e.canvasW*u,m=e.canvasH*u,h=o.current,p=h?.clientWidth??0,y=h?.clientHeight??0,b=-n.x/a*u,w=-n.y/a*u,j=p/a*u,N=y/a*u;return i.jsxs("div",{className:"s-mission-minimap",style:{width:f,height:m},onClick:l,children:[e.groups.map(C=>i.jsx("div",{className:"s-mission-minimap-group",style:{left:C.x*u,top:C.y*u},children:C.label},C.label)),e.groups.flatMap(C=>C.tiles.map(k=>{const E=t.find(S=>S.id===k.agentId);return i.jsx("div",{className:"s-mission-minimap-tile",style:{left:k.x*u,top:k.y*u,width:Ql*u,height:jf*u,background:E?ct(E.name):"var(--dim)",opacity:E&&ft(E.state)==="working"?.8:.35}},k.agentId)})),i.jsx("div",{className:"s-mission-minimap-viewport",style:{left:Math.max(0,b),top:Math.max(0,w),width:Math.min(j,f),height:Math.min(N,m)}})]})}function xW(e){switch(e){case"working":return"var(--green)";case"available":return"var(--accent)";default:return"var(--dim)"}}const bW=["openai","codex","codex_app_server"],wW=["anthropic","claude","claude-code","claude_stream_json"],Xr={"openai:gpt-5.5":{provider:"openai",model:"gpt-5.5",inputPerM:5,cachedInputPerM:.5,cacheWritePerM:null,outputPerM:30,webSearchPer1K:10},"openai:gpt-5.5-pro":{provider:"openai",model:"gpt-5.5-pro",inputPerM:30,cachedInputPerM:null,cacheWritePerM:null,outputPerM:180,webSearchPer1K:10},"openai:gpt-5.4":{provider:"openai",model:"gpt-5.4",inputPerM:2.5,cachedInputPerM:.25,cacheWritePerM:null,outputPerM:15,webSearchPer1K:10},"openai:gpt-5.4-mini":{provider:"openai",model:"gpt-5.4-mini",inputPerM:.75,cachedInputPerM:.075,cacheWritePerM:null,outputPerM:4.5,webSearchPer1K:10},"openai:gpt-5.4-nano":{provider:"openai",model:"gpt-5.4-nano",inputPerM:.2,cachedInputPerM:.02,cacheWritePerM:null,outputPerM:1.25,webSearchPer1K:10},"openai:gpt-5.4-pro":{provider:"openai",model:"gpt-5.4-pro",inputPerM:30,cachedInputPerM:null,cacheWritePerM:null,outputPerM:180,webSearchPer1K:10},"openai:gpt-5.3-codex":{provider:"openai",model:"gpt-5.3-codex",inputPerM:1.75,cachedInputPerM:.175,cacheWritePerM:null,outputPerM:14,webSearchPer1K:10},"openai:gpt-5.3-chat-latest":{provider:"openai",model:"gpt-5.3-chat-latest",inputPerM:1.75,cachedInputPerM:.175,cacheWritePerM:null,outputPerM:14,webSearchPer1K:10},"openai:gpt-5.2":{provider:"openai",model:"gpt-5.2",inputPerM:1.75,cachedInputPerM:.175,cacheWritePerM:null,outputPerM:14,webSearchPer1K:10},"openai:gpt-5.2-codex":{provider:"openai",model:"gpt-5.2-codex",inputPerM:1.75,cachedInputPerM:.175,cacheWritePerM:null,outputPerM:14,webSearchPer1K:10},"openai:gpt-5.2-chat-latest":{provider:"openai",model:"gpt-5.2-chat-latest",inputPerM:1.75,cachedInputPerM:.175,cacheWritePerM:null,outputPerM:14,webSearchPer1K:10},"openai:gpt-5.2-pro":{provider:"openai",model:"gpt-5.2-pro",inputPerM:21,cachedInputPerM:null,cacheWritePerM:null,outputPerM:168,webSearchPer1K:10},"openai:gpt-5.1":{provider:"openai",model:"gpt-5.1",inputPerM:1.25,cachedInputPerM:.125,cacheWritePerM:null,outputPerM:10,webSearchPer1K:10},"openai:gpt-5.1-codex":{provider:"openai",model:"gpt-5.1-codex",inputPerM:1.25,cachedInputPerM:.125,cacheWritePerM:null,outputPerM:10,webSearchPer1K:10},"openai:gpt-5.1-codex-max":{provider:"openai",model:"gpt-5.1-codex-max",inputPerM:1.25,cachedInputPerM:.125,cacheWritePerM:null,outputPerM:10,webSearchPer1K:10},"openai:gpt-5.1-chat-latest":{provider:"openai",model:"gpt-5.1-chat-latest",inputPerM:1.25,cachedInputPerM:.125,cacheWritePerM:null,outputPerM:10,webSearchPer1K:10},"openai:gpt-5":{provider:"openai",model:"gpt-5",inputPerM:1.25,cachedInputPerM:.125,cacheWritePerM:null,outputPerM:10,webSearchPer1K:10},"openai:gpt-5-codex":{provider:"openai",model:"gpt-5-codex",inputPerM:1.25,cachedInputPerM:.125,cacheWritePerM:null,outputPerM:10,webSearchPer1K:10},"openai:gpt-5-chat-latest":{provider:"openai",model:"gpt-5-chat-latest",inputPerM:1.25,cachedInputPerM:.125,cacheWritePerM:null,outputPerM:10,webSearchPer1K:10},"openai:gpt-5-mini":{provider:"openai",model:"gpt-5-mini",inputPerM:.25,cachedInputPerM:.025,cacheWritePerM:null,outputPerM:2,webSearchPer1K:10},"openai:gpt-5-nano":{provider:"openai",model:"gpt-5-nano",inputPerM:.05,cachedInputPerM:.005,cacheWritePerM:null,outputPerM:.4,webSearchPer1K:10},"openai:gpt-5-pro":{provider:"openai",model:"gpt-5-pro",inputPerM:15,cachedInputPerM:null,cacheWritePerM:null,outputPerM:120,webSearchPer1K:10},"openai:gpt-4.1":{provider:"openai",model:"gpt-4.1",inputPerM:2,cachedInputPerM:.5,cacheWritePerM:null,outputPerM:8,webSearchPer1K:10},"openai:gpt-4.1-mini":{provider:"openai",model:"gpt-4.1-mini",inputPerM:.4,cachedInputPerM:.1,cacheWritePerM:null,outputPerM:1.6,webSearchPer1K:10},"openai:gpt-4.1-nano":{provider:"openai",model:"gpt-4.1-nano",inputPerM:.1,cachedInputPerM:.025,cacheWritePerM:null,outputPerM:.4,webSearchPer1K:10},"openai:gpt-4o":{provider:"openai",model:"gpt-4o",inputPerM:2.5,cachedInputPerM:1.25,cacheWritePerM:null,outputPerM:10,webSearchPer1K:10},"openai:gpt-4o-mini":{provider:"openai",model:"gpt-4o-mini",inputPerM:.15,cachedInputPerM:.075,cacheWritePerM:null,outputPerM:.6,webSearchPer1K:10},"anthropic:claude-opus-4.6":{provider:"anthropic",model:"claude-opus-4.6",inputPerM:5,cachedInputPerM:.5,cacheWritePerM:6.25,outputPerM:25,webSearchPer1K:10},"anthropic:claude-opus-4.5":{provider:"anthropic",model:"claude-opus-4.5",inputPerM:5,cachedInputPerM:.5,cacheWritePerM:6.25,outputPerM:25,webSearchPer1K:10},"anthropic:claude-opus-4.1":{provider:"anthropic",model:"claude-opus-4.1",inputPerM:15,cachedInputPerM:1.5,cacheWritePerM:18.75,outputPerM:75,webSearchPer1K:10},"anthropic:claude-opus-4":{provider:"anthropic",model:"claude-opus-4",inputPerM:15,cachedInputPerM:1.5,cacheWritePerM:18.75,outputPerM:75,webSearchPer1K:10},"anthropic:claude-sonnet-4.6":{provider:"anthropic",model:"claude-sonnet-4.6",inputPerM:3,cachedInputPerM:.3,cacheWritePerM:3.75,outputPerM:15,webSearchPer1K:10},"anthropic:claude-sonnet-4.5":{provider:"anthropic",model:"claude-sonnet-4.5",inputPerM:3,cachedInputPerM:.3,cacheWritePerM:3.75,outputPerM:15,webSearchPer1K:10},"anthropic:claude-sonnet-4":{provider:"anthropic",model:"claude-sonnet-4",inputPerM:3,cachedInputPerM:.3,cacheWritePerM:3.75,outputPerM:15,webSearchPer1K:10},"anthropic:claude-3-7-sonnet":{provider:"anthropic",model:"claude-3-7-sonnet",inputPerM:3,cachedInputPerM:.3,cacheWritePerM:3.75,outputPerM:15,webSearchPer1K:10},"anthropic:claude-haiku-4.5":{provider:"anthropic",model:"claude-haiku-4.5",inputPerM:1,cachedInputPerM:.1,cacheWritePerM:1.25,outputPerM:5,webSearchPer1K:10}},jW={"claude-sonnet-4-5":"anthropic:claude-sonnet-4.5","claude-sonnet-4-6":"anthropic:claude-sonnet-4.6","claude-opus-4-5":"anthropic:claude-opus-4.5","claude-opus-4-6":"anthropic:claude-opus-4.6","claude-haiku-4-5":"anthropic:claude-haiku-4.5"};function SW(e){const t=e.provider?.trim().toLowerCase()??"",n=e.adapterType?.trim().toLowerCase()??"",a=XA(e.model)??"",o=[t,n].filter(Boolean);return o.some(l=>bW.some(u=>l.includes(u)))?"openai":o.some(l=>wW.some(u=>l.includes(u)))?"anthropic":a.startsWith("gpt-")||a.startsWith("o")||a.includes("codex")?"openai":a.startsWith("claude-")?"anthropic":"unknown"}function XA(e){return e?e.trim().toLowerCase().replace(/^(openai|anthropic)\//,"").replace(/_/g,"-").replace(/-\d{8}$/,""):null}function NW(e){const t=rr(e?.inputTokens),n=rr(e?.cacheReadInputTokens),a=rr(e?.cacheCreationInputTokens),o=rr(e?.outputTokens),l=rr(e?.reasoningOutputTokens),u=[t,o].reduce((m,h)=>m+(h??0),0),f=rr(e?.totalTokens)??(u||null);return{input:t,uncachedInput:t==null?null:Math.max(0,t-(n??0)-(a??0)),cachedInput:n,cacheWrite:a,output:o,reasoningOutput:l,total:f,webSearchRequests:rr(e?.webSearchRequests),webFetchRequests:rr(e?.webFetchRequests)}}function kW(e){const t=SW(e),n=XA(e.model),a=NW(e.usage),o=EW(t,n),l=CW(e);if(!o.rateCard)return{provider:t,model:n,rateCard:null,rateCardSource:"unknown",capturedAt:e.capturedAt??Date.now(),usage:a,lineItems:[],totalUsd:null,billedTotalUsd:null,billingMode:l,subscriptionWindows:e.subscriptionWindows??[]};const u=o.rateCard,f=a.uncachedInput??a.input??0,m=a.cachedInput??0,h=a.cacheWrite??0,p=a.output??0,y=a.webSearchRequests??0,b=[yd("input","Input",f,u.inputPerM,l),yd("cached_input","Cached input",m,u.cachedInputPerM??u.inputPerM,l),yd("cache_write","Cache write",h,u.cacheWritePerM??u.inputPerM,l),yd("output","Output",p,u.outputPerM,l),{key:"web_search",label:"Web search",quantity:y,unit:"requests",rate:u.webSearchPer1K??0,billedRate:l==="subscription"?0:u.webSearchPer1K??0,costUsd:y/1e3*(u.webSearchPer1K??0),billedCostUsd:l==="subscription"?0:y/1e3*(u.webSearchPer1K??0)}].filter(w=>w.quantity>0);return{provider:t,model:n,rateCard:u,rateCardSource:o.source,capturedAt:e.capturedAt??Date.now(),usage:a,lineItems:b,totalUsd:b.reduce((w,j)=>w+j.costUsd,0),billedTotalUsd:b.reduce((w,j)=>w+j.billedCostUsd,0),billingMode:l,subscriptionWindows:e.subscriptionWindows??[]}}function EW(e,t){if(e==="unknown")return{rateCard:null,source:"unknown"};const n=t?`${e}:${t}`:null;if(n&&Xr[n])return{rateCard:Xr[n],source:"exact"};const a=t?jW[t]:null;if(a&&Xr[a])return{rateCard:Xr[a],source:"alias"};if(e==="anthropic"){if(t?.includes("opus"))return{rateCard:Xr["anthropic:claude-opus-4.5"],source:"provider-default"};if(t?.includes("haiku"))return{rateCard:Xr["anthropic:claude-haiku-4.5"],source:"provider-default"};if(t?.includes("sonnet")||!t)return{rateCard:Xr["anthropic:claude-sonnet-4.5"],source:"provider-default"}}return{rateCard:null,source:"unknown"}}function yd(e,t,n,a,o){const l=o==="subscription"?0:a;return{key:e,label:t,quantity:n,unit:"tokens",rate:a,billedRate:l,costUsd:n/1e6*a,billedCostUsd:n/1e6*l}}function rr(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function CW(e){if(e.billingMode)return e.billingMode;const t=e.adapterType?.trim().toLowerCase();if(t==="claude-code"||t==="claude_stream_json")return"subscription";const n=e.usage?.planType?.trim().toLowerCase();return!n||n==="api"||n.includes("api")?"api":"subscription"}const pv=1440*6e4,TW=90*6e4;function iN(e){if(!e)return null;const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n>=0?t.slice(n+1):t}function Hl(e){return e==null?"—":e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}K`:String(e)}function oN(e){return e==null?"—":e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(2)}s`}function xd(e){return e==null?"$—":e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function AW(e,t){if(!e)return null;const n=e.data.events.filter(o=>o.kind==="message"||o.kind==="tool").filter(o=>t-o.t<=TW).sort((o,l)=>o.t-l.t);if(n.length<2)return null;const a=[];for(let o=1;o<n.length;o+=1){const l=n[o].t-n[o-1].t;l>0&&l<12e4&&a.push(l)}return a.length===0?null:Math.round(a.reduce((o,l)=>o+l,0)/a.length)}function MW(e,t){const n=new Array(24).fill(0),a=t-pv;for(const o of e){if(o.ts<a||o.ts>t)continue;const l=Math.min(23,Math.max(0,Math.floor((o.ts-a)/pv*n.length)));n[l]+=1}return n}function RW({values:e,warn:t=!1}){const o=Math.max(1,...e),l=e.map((u,f)=>{const m=f/Math.max(1,e.length-1)*92,h=22-u/o*19-1.5;return`${m.toFixed(1)},${h.toFixed(1)}`}).join(" ");return i.jsx("svg",{className:`s-ops-agents-spark${t?" s-ops-agents-spark--warn":""}`,viewBox:"0 0 92 22","aria-hidden":"true",children:i.jsx("polyline",{points:l,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function _W(e){return e.transport??iN(e.cwd)??iN(e.projectRoot)??"local"}function OW(e){return e.project??e.role??e.agentClass??"Unassigned"}function IW(e,t,n,a,o,l){const u=t.filter(w=>w.agentId===e.id),f=u.filter(w=>{const j=w.lastMessageAt??0;return j>0&&l-j<=pv}),m=n.filter(w=>w.actorName===e.name||w.conversationId===e.conversationId),h=o.get(e.id),p=h?.data.metadata?.session?.model??null,y=h?.data.metadata?.session?.modelProvider??null,b=kW({adapterType:h?.data.metadata?.session?.adapterType,capturedAt:h?.updatedAt??l,model:p,provider:y,usage:h?.data.metadata?.usage});return{agent:e,team:OW(e),machine:_W(e),model:p,provider:y,state:ft(e.state),activeFlights:a.filter(w=>w.agentId===e.id).length,sessions24h:f.length,throughput:MW(m,l),avgLatencyMs:AW(h,l),usage:b.usage,cost:b,errors:a.filter(w=>w.agentId===e.id&&(w.status==="failed"||w.status==="needs_attention")).length,lastActiveAt:Math.max(0,...u.map(w=>w.lastMessageAt??0),...m.map(w=>w.ts),e.updatedAt??0)||null}}function DW({navigate:e,agents:t}){const[n,a]=v.useState(null),[o,l]=v.useState([]),[u,f]=v.useState([]),[m,h]=v.useState([]),[p,y]=v.useState(""),[b,w]=v.useState(()=>Date.now()),j=v.useCallback(async()=>{const _=t.map(L=>L.id).join(","),[z,B,V,K]=await Promise.allSettled([Ce("/api/fleet"),Ce("/api/sessions"),Ce("/api/activity"),_?Ce(`/api/observe/agents?ids=${encodeURIComponent(_)}`):Promise.resolve([])]);z.status==="fulfilled"&&a(z.value),B.status==="fulfilled"&&l(B.value),V.status==="fulfilled"&&f(V.value),K.status==="fulfilled"&&h(K.value),w(Date.now())},[t]);v.useEffect(()=>{j()},[j]),fn(()=>{j()}),v.useEffect(()=>{const _=setInterval(()=>w(Date.now()),1e3);return()=>clearInterval(_)},[]);const N=v.useMemo(()=>new Map(m.map(_=>[_.agentId,_])),[m]),C=v.useMemo(()=>{const _=n?.activeAsks??[];return t.map(z=>IW(z,o,u,_,N,b)).sort((z,B)=>{const V={working:0,available:1,offline:2},K=V[z.state]-V[B.state];return K!==0?K:(B.lastActiveAt??0)-(z.lastActiveAt??0)})},[u,t,n?.activeAsks,b,N,o]),k=v.useMemo(()=>{const _=p.trim().toLowerCase();return _?C.filter(z=>`${z.agent.name} ${z.team} ${z.machine} ${z.agent.handle??""} ${z.agent.harness??""}`.toLowerCase().includes(_)):C},[p,C]),E=C.filter(_=>_.state==="working").length,S=C.filter(_=>_.state!=="offline").length,R=C.reduce((_,z)=>_+(z.usage.total??0),0),A=C.some(_=>_.cost.totalUsd!=null)?C.reduce((_,z)=>_+(z.cost.totalUsd??0),0):null,M=C.some(_=>_.cost.billedTotalUsd!=null)?C.reduce((_,z)=>_+(z.cost.billedTotalUsd??0),0):null,D=(()=>{const _=C.map(z=>z.avgLatencyMs).filter(z=>z!=null);return _.length===0?null:Math.round(_.reduce((z,B)=>z+B,0)/_.length)})(),U=C.reduce((_,z)=>_+z.errors,0),F=v.useMemo(()=>{const _=new Map;for(const z of C)_.set(z.team,(_.get(z.team)??0)+1);return[..._.entries()].sort((z,B)=>B[1]-z[1]).slice(0,6)},[C]),P=v.useMemo(()=>{const _=new Map;for(const z of C)_.set(z.machine,(_.get(z.machine)??0)+1);return[..._.entries()].sort((z,B)=>B[1]-z[1]).slice(0,7)},[C]);return i.jsxs("div",{className:"s-ops-agents",children:[i.jsxs("aside",{className:"s-ops-agents-rail",children:[i.jsxs("div",{className:"s-ops-agents-brand",children:[i.jsx("div",{className:"s-ops-agents-mark",children:"sc"}),i.jsxs("div",{children:[i.jsx("div",{className:"s-ops-agents-brand-name",children:"agentctl"}),i.jsx("div",{className:"s-ops-agents-brand-sub",children:"ops console"})]})]}),i.jsxs("div",{className:"s-ops-agents-rail-group",children:[i.jsx("div",{className:"s-ops-agents-rail-heading",children:"Fleet"}),i.jsxs("button",{className:"s-ops-agents-rail-row",type:"button",children:["Overview ",i.jsx("span",{children:t.length})]}),i.jsxs("button",{className:"s-ops-agents-rail-row s-ops-agents-rail-row--active",type:"button",children:["Agents ",i.jsx("span",{children:S})]}),i.jsxs("button",{className:"s-ops-agents-rail-row",type:"button",children:["Sessions ",i.jsx("span",{children:o.length})]}),i.jsxs("button",{className:"s-ops-agents-rail-row",type:"button",children:["Alerts ",i.jsx("span",{children:U})]})]}),i.jsxs("div",{className:"s-ops-agents-rail-group",children:[i.jsx("div",{className:"s-ops-agents-rail-heading",children:"Teams"}),F.map(([_,z])=>i.jsxs("button",{className:"s-ops-agents-rail-row",type:"button",children:[_,i.jsx("span",{children:z})]},_))]}),i.jsxs("div",{className:"s-ops-agents-rail-group",children:[i.jsx("div",{className:"s-ops-agents-rail-heading",children:"Machines"}),P.map(([_,z])=>i.jsxs("button",{className:"s-ops-agents-rail-row",type:"button",children:[_,i.jsx("span",{children:z})]},_))]})]}),i.jsxs("main",{className:"s-ops-agents-main",children:[i.jsxs("div",{className:"s-ops-agents-toolbar",children:[i.jsxs("div",{className:"s-ops-agents-breadcrumb",children:["Fleet ",i.jsx("span",{children:"/"})," Agents"]}),i.jsxs("div",{className:"s-ops-agents-live",children:[i.jsx("span",{className:"s-ops-agents-live-dot"}),S," active"]}),i.jsxs("div",{className:"s-ops-agents-search",children:[i.jsx(o_,{size:13}),i.jsx("input",{value:p,onChange:_=>y(_.target.value),placeholder:"Search agents, teams, machines..."})]}),i.jsx("button",{className:"s-ops-agents-icon-btn",type:"button",title:"Filters",children:i.jsx(c_,{size:14})})]}),i.jsx("section",{className:"s-ops-agents-hero",children:i.jsxs("div",{children:[i.jsx("div",{className:"s-ops-agents-kicker",children:"Agents"}),i.jsx("h1",{children:"All agents"}),i.jsx("p",{children:"Every registered agent across the local fleet, sorted by live status."})]})}),i.jsxs("section",{className:"s-ops-agents-stats",children:[i.jsx(bd,{label:"Running",value:String(E),sub:`of ${t.length} total`}),i.jsx(bd,{label:"Tokens",value:Hl(R||null),sub:A==null?"usage metadata pending":`${xd(A)} API equiv`}),i.jsx(bd,{label:"Avg latency",value:oN(D),sub:"recent observe events"}),i.jsx(bd,{label:"Billed",value:xd(M),sub:"subscription usage can mark this down"})]}),i.jsxs("section",{className:"s-ops-agents-table-panel",children:[i.jsxs("div",{className:"s-ops-agents-table-title",children:["Agents ",i.jsx("span",{children:k.length})]}),i.jsx("div",{className:"s-ops-agents-table-wrap",children:i.jsxs("table",{className:"s-ops-agents-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Agent"}),i.jsx("th",{children:"Team"}),i.jsx("th",{children:"Machine"}),i.jsx("th",{children:"Active"}),i.jsx("th",{children:"24h sessions"}),i.jsx("th",{children:"Throughput"}),i.jsx("th",{children:"Avg latency"}),i.jsx("th",{children:"Input"}),i.jsx("th",{children:"Cache read"}),i.jsx("th",{children:"Cache write"}),i.jsx("th",{children:"Output"}),i.jsx("th",{children:"API equiv"}),i.jsx("th",{children:"Billed"}),i.jsx("th",{children:"Errors"}),i.jsx("th",{children:"Last active"})]})}),i.jsxs("tbody",{children:[k.map(_=>i.jsxs("tr",{onClick:()=>e({view:"agents",agentId:_.agent.id}),children:[i.jsx("td",{children:i.jsxs("div",{className:"s-ops-agents-agent-cell",children:[i.jsx("span",{className:`s-ops-agents-status s-ops-agents-status--${_.state}`}),i.jsxs("span",{children:[i.jsx("strong",{children:_.agent.name}),i.jsx("small",{children:Vs(_.agent.state)})]})]})}),i.jsx("td",{children:_.team}),i.jsx("td",{children:_.machine}),i.jsx("td",{className:"s-ops-agents-num",children:_.activeFlights}),i.jsx("td",{className:"s-ops-agents-num",children:_.sessions24h}),i.jsx("td",{children:i.jsx(RW,{values:_.throughput,warn:_.errors>0})}),i.jsx("td",{className:"s-ops-agents-num",children:oN(_.avgLatencyMs)}),i.jsx("td",{className:"s-ops-agents-num",children:Hl(_.usage.uncachedInput??_.usage.input)}),i.jsx("td",{className:"s-ops-agents-num",children:Hl(_.usage.cachedInput)}),i.jsx("td",{className:"s-ops-agents-num",children:Hl(_.usage.cacheWrite)}),i.jsx("td",{className:"s-ops-agents-num",children:Hl(_.usage.output)}),i.jsx("td",{className:`s-ops-agents-num${_.cost.rateCardSource==="unknown"?" s-ops-agents-num--dim":""}`,children:xd(_.cost.totalUsd)}),i.jsx("td",{className:`s-ops-agents-num${_.cost.billingMode==="subscription"?" s-ops-agents-num--covered":""}`,children:xd(_.cost.billedTotalUsd)}),i.jsx("td",{className:`s-ops-agents-num${_.errors>0?" s-ops-agents-num--warn":""}`,children:_.errors}),i.jsx("td",{className:"s-ops-agents-last",children:_.lastActiveAt?Pe(_.lastActiveAt):"—"})]},_.agent.id)),k.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:15,className:"s-ops-agents-empty",children:"No agents match the current search."})})]})]})})]})]})]})}function bd({label:e,value:t,sub:n,tone:a="default"}){return i.jsxs("div",{className:`s-ops-agents-metric s-ops-agents-metric--${a}`,children:[i.jsx("div",{className:"s-ops-agents-metric-label",children:e}),i.jsx("div",{className:"s-ops-agents-metric-value",children:t}),i.jsx("div",{className:"s-ops-agents-metric-sub",children:n})]})}const JA={proposed:{label:"PROPOSED",icon:"◌",color:"var(--dim)"},committed:{label:"COMMITTED",icon:"◐",color:"var(--accent)"},inflight:{label:"IN FLIGHT",icon:"◉",color:"var(--green)"},done:{label:"DONE",icon:"●",color:"var(--muted)"},stuck:{label:"STUCK",icon:"▲",color:"var(--amber)"}};function QA(e){const t=[e];return e.children&&e.children.forEach(n=>t.push(...QA(n))),t}function eM(e,t){if(e.id===t)return e;if(!e.children)return null;for(const n of e.children){const a=eM(n,t);if(a)return a}return null}function lN(e,t){return QA(e).filter(n=>n.kind==="task"&&n.assigneeId===t).length}function Gf(e){switch(e){case"done":return 1;case"inflight":return .7;case"committed":return .32;case"stuck":return .18;default:return .1}}function zW(e){return(e.currentPhase||e.state).replace(/\s+/g," ")}function tM(e){return e.state==="done"?"done":e.attention==="interrupt"||e.attention==="badge"||e.state==="waiting"||e.state==="review"?"stuck":e.state==="working"||e.activeFlightCount>0||e.currentPhase==="Working"||e.currentPhase==="Waking"?"inflight":"committed"}function nM(e){switch(e.status){case"working":return"inflight";case"completed":return"done";case"needs_attention":case"failed":return"stuck";default:return"committed"}}function cN(e){const t=tM(e);return t==="stuck"?"attention":t==="inflight"?"active":"committed"}function PW(e){const t=nM(e);return t==="stuck"?"attention":t==="inflight"?"active":"committed"}function Kf(e,t){return typeof e!="number"||!Number.isFinite(e)?null:Math.max(0,Math.round((t-e)/6e4))}function Ry(e){return e.recordId?{view:"work",workId:e.recordId}:e.conversationId?{view:"conversation",conversationId:e.conversationId}:e.agentId?{view:"agents",agentId:e.agentId}:null}function sM(e){return e.conversationId?{view:"conversation",conversationId:e.conversationId}:e.collaborationRecordId?{view:"work",workId:e.collaborationRecordId}:{view:"agents",agentId:e.agentId}}function rg(e,t){const n=tM(e),a=e.lastMeaningfulSummary??e.summary??null;return{id:`work:${e.id}`,kind:"task",title:e.title,summary:e.summary??e.lastMeaningfulSummary??null,state:n,assigneeId:e.ownerId??e.nextMoveOwnerId,detail:a,why:e.summary??`Current phase: ${zW(e)}`,progress:Gf(n),stuckMins:n==="stuck"?Kf(e.lastMeaningfulAt,t):null,updatedAt:e.lastMeaningfulAt,route:{view:"work",workId:e.id}}}function LW(e,t){const n=nM(e);return{id:`ask:${e.invocationId}`,kind:"task",title:e.task,summary:e.summary,state:n,assigneeId:e.agentId,detail:e.summary??e.statusLabel,why:`Ask status: ${e.statusLabel}`,progress:Gf(n),stuckMins:n==="stuck"?Kf(e.updatedAt,t):null,updatedAt:e.updatedAt,route:sM(e)}}function $W(e,t){return{id:`attention:${e.recordId}`,kind:"task",title:e.title,summary:e.summary,state:"stuck",assigneeId:e.agentId,detail:e.summary??e.state.replace(/_/g," "),why:e.kind==="question"?"Operator input is required before this can move again.":"This work item is blocked on a review, decision, or reply.",progress:Gf("stuck"),stuckMins:Kf(e.updatedAt,t),updatedAt:e.updatedAt,route:Ry(e)}}function ig(e,t){return(t.updatedAt??0)-(e.updatedAt??0)}function og(e,t,n,a,o){return{id:`lane:${e}`,kind:"phase",title:t,summary:n,state:a,assigneeId:null,detail:n,why:n,progress:Gf(a),stuckMins:null,updatedAt:o[0]?.updatedAt??null,route:{view:"fleet"},children:o}}function UW(e,t,n,a){return e>0?"Resolve blockers before the queue widens":t>0?"Keep the live queue moving":n>0?"Commit the next slice of work":a>0?"Stand up the next unit of work":"No live operational plan yet"}function BW(e,t,n,a){return e===0&&t===0?a>0?`${a} agent${a===1?" is":"s are"} connected, but no work items or asks are active yet.`:"Bring agents online or dispatch the first ask to light up the plan surface.":`${e} live work item${e===1?"":"s"}, ${t} active ask${t===1?"":"s"}, and ${n} item${n===1?"":"s"} currently need operator awareness.`}function VW(e,t){return`Derived from live collaboration records, active asks, and recent fleet activity. This surface now reflects the current checkout instead of a canned mission narrative. ${e>0?`You have ${e} active work records in play.`:"No work records are active yet."} ${t>0?`${t} recent fleet events are informing the live view.`:"Recent fleet activity is quiet right now."}`}function HW(e,t,n){const a=[];for(const o of e.slice(0,4))a.push({id:`risk:attention:${o.recordId}`,title:o.title,detail:o.summary??(o.kind==="question"?"Waiting on an answer or decision.":"Waiting on the next operator move."),severity:o.kind==="question"?"high":"med"});for(const o of n){if(a.length>=4)break;o.attention==="interrupt"&&a.push({id:`risk:work:${o.id}`,title:o.title,detail:o.lastMeaningfulSummary??"Latest flight failed or the work item is blocked.",severity:"high"})}for(const o of t){if(a.length>=4)break;o.status==="failed"&&a.push({id:`risk:ask:${o.invocationId}`,title:o.task,detail:o.summary??"The delegated ask reported a failure state.",severity:"high"})}return a}function FW({navigate:e,agents:t}){const[n,a]=v.useState(null),[o,l]=v.useState([]),[u,f]=v.useState(null),[m,h]=v.useState("plan"),[p,y]=v.useState(()=>Date.now()),b=v.useCallback(async()=>{const[k,E]=await Promise.allSettled([Ce("/api/fleet"),Ce("/api/work")]);k.status==="fulfilled"&&a(k.value),E.status==="fulfilled"&&l(E.value),y(Date.now())},[]);v.useEffect(()=>{b()},[b]),fn(()=>{b()}),v.useEffect(()=>{const k=setInterval(()=>y(Date.now()),15e3);return()=>clearInterval(k)},[]);const w=v.useMemo(()=>Object.fromEntries(t.map(k=>[k.id,k])),[t]),j=v.useMemo(()=>t.filter(k=>ft(k.state)!=="offline").length,[t]),N=v.useMemo(()=>{const k=[],E=[],S=[],R=new Set,A=new Map(o.map(_=>[_.id,_]));for(const _ of n?.needsAttention??[]){const z=A.get(_.recordId);if(z){const B=rg(z,p);k.push({...B,state:"stuck",detail:_.summary??B.detail,why:_.summary??B.summary??B.why,stuckMins:Kf(_.updatedAt,p),updatedAt:_.updatedAt,route:B.route??Ry(_)}),R.add(z.id)}else k.push($W(_,p))}for(const _ of n?.activeAsks??[]){const z=_.collaborationRecordId??null,B=z?A.get(z):null;if(!(B&&R.has(B.id)))if(B){const V=rg(B,p),K=cN(B);K==="attention"?k.push(V):K==="active"?E.push(V):S.push(V),R.add(B.id)}else{const V=LW(_,p),K=PW(_);K==="attention"?k.push(V):K==="active"?E.push(V):S.push(V)}}for(const _ of o){if(R.has(_.id))continue;const z=rg(_,p),B=cN(_);B==="attention"?k.push(z):B==="active"?E.push(z):S.push(z)}k.sort(ig),E.sort(ig),S.sort(ig);const M=[];k.length>0&&M.push(og("attention","Needs input",`${k.length} item${k.length===1?"":"s"} are waiting on an answer, decision, or unblock.`,"stuck",k)),E.length>0&&M.push(og("active","In flight",`${E.length} item${E.length===1?"":"s"} are currently moving through the fleet.`,"inflight",E)),S.length>0&&M.push(og("committed","Committed next",`${S.length} item${S.length===1?"":"s"} are queued or ready to be picked up next.`,"committed",S));const D=[...k,...E,...S],U={id:"plan:root",kind:"mission",title:UW(k.length,E.length,S.length,j),summary:BW(o.length,n?.activeAsks.length??0,k.length,j),state:k.length>0?"stuck":E.length>0?"inflight":S.length>0?"committed":"proposed",assigneeId:null,detail:null,why:VW(o.length,n?.activity.length??0),progress:D.length>0?D.reduce((_,z)=>_+(z.progress??0),0)/D.length:0,stuckMins:null,updatedAt:n?.generatedAt??null,route:{view:"fleet"},badge:`${D.length} live item${D.length===1?"":"s"}`,children:M},F=HW(n?.needsAttention??[],n?.activeAsks??[],o),P=(n?.recentCompleted??[]).slice(0,4);return{root:U,leafNodes:D,risks:F,recentCompleted:P,pendingAttention:n?.needsAttention??[],counts:{done:P.length,inflight:E.length,stuck:k.length}}},[n,p,j,o]),C=u?eM(N.root,u):null;return v.useEffect(()=>{C||f(N.leafNodes[0]?.id??N.root.id)},[N.leafNodes,N.root.id,C]),i.jsx("div",{className:"s-plan",children:i.jsxs("div",{className:"s-plan-inner",children:[i.jsxs("div",{className:"s-plan-banner",children:[i.jsx("span",{className:"s-plan-banner-badge",children:"◉ Live plan"}),i.jsxs("span",{className:"s-plan-banner-meta",children:[o.length," work item",o.length===1?"":"s"," · ",n?.activeAsks.length??0," active ask",(n?.activeAsks.length??0)===1?"":"s"," · ",N.pendingAttention.length," waiting on you"]}),i.jsx("span",{style:{flex:1}}),n&&i.jsxs("span",{className:"s-plan-banner-meta",children:["updated ",Pe(n.generatedAt)]}),i.jsx("button",{className:"s-ops-btn",onClick:()=>e({view:"fleet"}),children:"Open fleet"}),i.jsx("button",{className:"s-ops-btn",onClick:()=>e({view:"sessions"}),children:"Sessions"})]}),i.jsxs("div",{className:"s-plan-col",children:[i.jsx("div",{className:"s-ops-eyebrow",children:"◇ Mission"}),i.jsx("h1",{className:"s-plan-title",children:N.root.title}),i.jsx("p",{className:"s-plan-goal",children:N.root.summary}),i.jsx("div",{className:"s-ops-eyebrow",children:"Derived from live state"}),i.jsx("p",{className:"s-plan-rationale",children:N.root.why}),i.jsx("div",{className:"s-ops-eyebrow",children:"Risks · watch"}),N.risks.length===0?i.jsxs("div",{className:"s-plan-change-card",children:[i.jsx("div",{className:"s-plan-change-summary",children:"No active blockers"}),i.jsx("div",{className:"s-plan-change-why",children:"The queue is clear of explicit questions, failed asks, and blocked work items."})]}):N.risks.map(k=>i.jsx(GW,{risk:k},k.id)),i.jsx("div",{className:"s-ops-eyebrow",style:{marginTop:24},children:"Agents on mission"}),t.filter(k=>lN(N.root,k.id)>0).length===0?i.jsxs("div",{className:"s-plan-change-card",children:[i.jsx("div",{className:"s-plan-change-summary",children:"No assigned work yet"}),i.jsx("div",{className:"s-plan-change-why",children:"As soon as asks and work items have clear owners, this roster will show who is carrying what."})]}):t.map(k=>{const E=lN(N.root,k.id);return E===0?null:i.jsxs("div",{className:"s-plan-agent-row",children:[i.jsx("div",{className:"s-ops-avatar",style:{"--size":"22px",background:ct(k.name)},children:k.name[0]?.toUpperCase()}),i.jsxs("div",{className:"s-plan-agent-row-copy",children:[i.jsx("div",{className:"s-plan-agent-row-name",children:k.name}),i.jsxs("div",{className:"s-plan-agent-row-tasks",children:[E," item",E===1?"":"s"," assigned"]})]})]},k.id)})]}),i.jsxs("div",{className:"s-plan-col",style:{padding:"20px 16px 40px"},children:[i.jsxs("div",{className:"s-plan-tree-header",children:[i.jsx("div",{className:"s-ops-eyebrow",style:{marginBottom:0},children:"◆ Execution tree"}),i.jsxs("span",{className:"s-plan-tree-stats",children:[N.leafNodes.length," items · ",N.counts.done," recent done · ",N.counts.inflight," in flight · ",N.counts.stuck," stuck"]}),i.jsx("div",{className:"s-plan-tree-toggle",children:["plan","live"].map(k=>i.jsx("button",{className:`s-plan-tree-toggle-btn${m===k?" s-plan-tree-toggle-btn--active":""}`,onClick:()=>h(k),children:k},k))})]}),N.root.children&&N.root.children.length>0?i.jsx(aM,{node:N.root,depth:0,mode:m,selected:u??N.root.id,setSelected:f,agentsById:w,nowMs:p}):i.jsxs("div",{className:"s-plan-change-card",children:[i.jsx("div",{className:"s-plan-change-summary",children:"No live plan records yet"}),i.jsx("div",{className:"s-plan-change-why",children:"The execution tree is populated from live work items and active asks. Dispatch work and it will appear here automatically."})]})]}),i.jsxs("div",{className:"s-plan-col",style:{display:"flex",flexDirection:"column",gap:24},children:[i.jsxs("div",{children:[i.jsxs("div",{className:"s-ops-eyebrow",children:["↻ Attention queue · ",N.pendingAttention.length]}),N.pendingAttention.length===0?i.jsxs("div",{className:"s-plan-change-card",children:[i.jsx("div",{className:"s-plan-change-summary",children:"Nothing is waiting on you"}),i.jsx("div",{className:"s-plan-change-why",children:"Questions, reviews, and blocked work items will show up here as soon as operator input is required."})]}):N.pendingAttention.map(k=>i.jsx(WW,{item:k,navigate:e},k.recordId))]}),i.jsxs("div",{children:[i.jsxs("div",{className:"s-ops-eyebrow",children:["✓ Recent finishes · ",N.recentCompleted.length]}),N.recentCompleted.length===0?i.jsxs("div",{className:"s-plan-change-card",children:[i.jsx("div",{className:"s-plan-change-summary",children:"No recent completions"}),i.jsx("div",{className:"s-plan-change-why",children:"Completed asks will land here so you can review what just finished without leaving the plan view."})]}):N.recentCompleted.map(k=>i.jsx(YW,{ask:k,navigate:e},k.invocationId))]}),C&&i.jsxs("div",{children:[i.jsx("div",{className:"s-ops-eyebrow",children:"◎ Selected"}),i.jsx(KW,{node:C,agentsById:w,navigate:e})]})]})]})})}function aM({node:e,depth:t,mode:n,selected:a,setSelected:o,agentsById:l,nowMs:u}){const f=e.children&&e.children.length>0;return i.jsxs("div",{children:[i.jsx(ZW,{node:e,depth:t,mode:n,selected:a===e.id,onClick:()=>o(e.id),agentsById:l,nowMs:u}),f&&i.jsx("div",{className:t===0?void 0:"s-plan-node-children",children:e.children.map(m=>i.jsx(aM,{node:m,depth:t+1,mode:n,selected:a,setSelected:o,agentsById:l,nowMs:u},m.id))})]})}function ZW({node:e,depth:t,mode:n,selected:a,onClick:o,agentsById:l,nowMs:u}){const f=JA[e.state],m=e.assigneeId?l[e.assigneeId]:null,h=e.kind==="mission",p=e.kind==="phase",y=h?"mission":p?"phase":"task";return i.jsxs("div",{className:`s-plan-node s-plan-node--${y}${a?" s-plan-node--selected":""}`,onClick:o,children:[!h&&i.jsx("span",{className:"s-plan-node-icon",style:{color:f.color},children:f.icon}),i.jsxs("div",{className:"s-plan-node-title-wrap",children:[i.jsx("div",{className:"s-plan-node-title-row",style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:i.jsx("span",{className:`s-plan-node-title s-plan-node-title--${y}${e.state==="done"?" s-plan-node-title--done":""}`,children:e.title})}),i.jsx("div",{className:`s-plan-node-payload${n==="live"?" s-plan-node-payload--live":""}`,children:n==="plan"?i.jsx("span",{children:e.why??e.summary??"—"}):i.jsx(qW,{node:e,nowMs:u})})]}),!h&&i.jsx("div",{className:"s-plan-node-assignee",children:m?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:ct(m.name)},children:m.name[0]?.toUpperCase()}),i.jsx("span",{className:"s-plan-node-assignee-handle",children:m.handle?`@${m.handle}`:m.name})]}):i.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10.5,color:"var(--dim)"},children:"unassigned"})}),!h&&i.jsxs("div",{className:"s-plan-node-right",children:[i.jsx("div",{className:"s-plan-confidence-bar",children:i.jsx("div",{className:"s-plan-confidence-bar-fill",style:{width:`${(e.progress??0)*100}%`,background:f.color}})}),i.jsx("span",{className:"s-ops-state-chip",style:{color:f.color},children:f.label})]}),h&&i.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:10.5,color:"var(--dim)",letterSpacing:"0.08em"},children:e.badge??"LIVE"})]})}function qW({node:e,nowMs:t}){return e.state==="done"?i.jsxs("span",{style:{opacity:.55},children:["✓ completed ",e.updatedAt?Pe(e.updatedAt):"recently"]}):e.state==="stuck"?i.jsxs("span",{style:{color:"var(--amber)"},children:["▲ ",e.detail??"blocked",e.stuckMins?` · ${e.stuckMins}m`:""]}):e.state==="inflight"?i.jsxs("span",{children:["› ",e.detail??"working",e.updatedAt?` · ${Pe(e.updatedAt)}`:""]}):e.state==="committed"?i.jsxs("span",{children:["◐ ",e.detail??"queued",e.updatedAt?` · ${Pe(e.updatedAt)}`:""]}):i.jsxs("span",{style:{opacity:.55},children:["◌ waiting for first live signal ",e.updatedAt?Pe(e.updatedAt):""]})}function WW({item:e,navigate:t}){const n=Ry(e);return i.jsxs("div",{className:"s-plan-change-card",children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[i.jsx("span",{className:"s-plan-change-kind",style:{color:"var(--amber)"},children:e.kind==="question"?"question":"work item"}),i.jsx("span",{style:{flex:1}}),i.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--dim)"},children:Pe(e.updatedAt)})]}),i.jsx("div",{className:"s-plan-change-summary",children:e.title}),i.jsx("div",{className:"s-plan-change-why",children:e.summary??`${e.state.replace(/_/g," ")} · ${e.acceptanceState.replace(/_/g," ")}`}),n&&i.jsx("div",{className:"s-plan-change-actions",children:i.jsx("button",{className:"s-ops-btn s-ops-btn--primary",style:{flex:1},onClick:()=>t(n),children:"Open item"})})]})}function YW({ask:e,navigate:t}){const n=sM(e);return i.jsxs("div",{className:"s-plan-change-card s-plan-change-card--accepted",children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[i.jsx("span",{className:"s-plan-change-kind",style:{color:"var(--green)"},children:e.status}),i.jsx("span",{style:{flex:1}}),i.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--dim)"},children:Pe(e.completedAt??e.updatedAt)})]}),i.jsx("div",{className:"s-plan-change-summary",children:e.summary??e.task}),i.jsxs("div",{className:"s-plan-change-why",children:[e.agentName??e.agentId," · ",e.task]}),n&&i.jsx("div",{className:"s-plan-change-actions",children:i.jsx("button",{className:"s-ops-btn",style:{flex:1},onClick:()=>t(n),children:"Open thread"})})]})}function GW({risk:e}){return i.jsxs("div",{className:"s-plan-risk",children:[i.jsx("span",{className:`s-plan-risk-icon s-plan-risk-icon--${e.severity}`,children:"▲"}),i.jsxs("div",{children:[i.jsx("div",{className:"s-plan-risk-title",children:e.title}),i.jsx("div",{className:"s-plan-risk-detail",children:e.detail})]})]})}function KW({node:e,agentsById:t,navigate:n}){const a=JA[e.state],o=e.assigneeId?t[e.assigneeId]:null;return i.jsxs("div",{className:"s-plan-detail",children:[i.jsxs("div",{className:"s-plan-detail-header",children:[i.jsx("span",{style:{color:a.color},children:a.icon}),i.jsx("span",{className:"s-ops-state-chip",style:{color:a.color,fontSize:10},children:a.label})]}),i.jsx("div",{className:"s-plan-detail-title",children:e.title}),(e.summary||e.detail||e.why)&&i.jsx("div",{className:"s-plan-detail-why",children:e.summary??e.detail??e.why}),o&&i.jsxs("div",{className:"s-plan-detail-assignee",children:[i.jsx("div",{className:"s-ops-avatar",style:{"--size":"22px",background:ct(o.name)},children:o.name[0]?.toUpperCase()}),i.jsxs("div",{style:{flex:1},children:[i.jsx("div",{style:{fontSize:12.5},children:o.name}),i.jsxs("div",{style:{fontSize:10.5,color:"var(--dim)",fontFamily:"var(--font-mono)"},children:[o.project??"—"," · ",o.branch??"main"]})]})]}),i.jsxs("div",{className:"s-plan-detail-actions",children:[e.route&&i.jsx("button",{className:"s-ops-btn s-ops-btn--primary",onClick:()=>n(e.route),children:"Open item"}),o&&i.jsx("button",{className:"s-ops-btn",onClick:()=>n({view:"conversation",conversationId:Jn(o.id),composeMode:"tell"}),children:"Tell owner"}),o&&i.jsx("button",{className:"s-ops-btn",onClick:()=>n({view:"conversation",conversationId:Jn(o.id),composeMode:"ask"}),children:"Ask owner"})]})]})}const uN=48,dN=720;function XW(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);if(!n||typeof n!="object")return null;const a={};for(const[o,l]of Object.entries(n))typeof l=="number"&&Number.isFinite(l)&&l>0&&(a[o]=l);return a}catch{return null}}function lg(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function JW({storageKey:e,columns:t}){const n=v.useMemo(()=>{const b=XW(e)??{},w={};for(const j of t)w[j.key]=b[j.key]??j.defaultWidth;return w},[e,t]),[a,o]=v.useState(n);v.useEffect(()=>{o(b=>{let w=!1;const j={...b};for(const N of t)j[N.key]==null&&(j[N.key]=N.defaultWidth,w=!0);return w?j:b})},[t]);const l=v.useMemo(()=>{const b=new Map;for(const w of t)b.set(w.key,w);return b},[t]),u=v.useRef(null),f=v.useCallback(b=>{const w=u.current;if(!w)return;const j=b.clientX-w.startX,N=Math.min(w.max,Math.max(w.min,w.startWidth+j));o(C=>C[w.key]===N?C:{...C,[w.key]:N})},[]),m=v.useCallback(()=>{u.current&&(u.current=null,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m),o(b=>(lg(e,b),b)))},[f,e]);v.useEffect(()=>()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)},[f,m]);const h=v.useCallback(b=>{const w=a[b],j=l.get(b),N=j?.minWidth??uN,C=j?.maxWidth??dN;return{style:{width:w,minWidth:N,maxWidth:C},"data-resize-key":b}},[a,l]),p=v.useCallback(b=>({onPointerDown:C=>{if(C.button!==0)return;C.preventDefault(),C.stopPropagation();const k=l.get(b),E=k?.minWidth??uN,S=k?.maxWidth??dN,R=a[b]??k?.defaultWidth??E;u.current={key:b,startX:C.clientX,startWidth:R,min:E,max:S},document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",f),window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m)},onClick:C=>{C.stopPropagation()},onDoubleClick:C=>{C.preventDefault(),C.stopPropagation();const k=l.get(b);k&&o(E=>{const S={...E,[b]:k.defaultWidth};return lg(e,S),S})},role:"separator","aria-orientation":"vertical","aria-label":"Resize column",className:"s-resize-handle"}),[a,l,f,m,e]),y=v.useCallback(()=>{o(()=>{const b={};for(const w of t)b[w.key]=w.defaultWidth;return lg(e,b),b})},[t,e]);return{widths:a,getColumnProps:h,getResizeHandleProps:p,resetAll:y}}const ui=new Set;let uc=null,Aa=null,Nc=0;function QW(e){try{return JSON.parse(e)}catch{return null}}function eY(e){for(const t of[...ui])t(e)}function rM(){uc?.close(),uc=null}function tY(){if(Aa||ui.size===0)return;Nc++;const e=Math.min(2e3*2**(Nc-1),3e4);Aa=setTimeout(()=>{Aa=null,ui.size>0&&iM()},e)}function iM(){if(uc||ui.size===0)return;const e=new EventSource("/api/tail/stream");uc=e;const t=n=>{const a=QW(n.data);a&&eY(a)};e.onopen=()=>{Nc=0},e.onmessage=t,e.addEventListener("ready",()=>{Nc=0}),e.onerror=()=>{uc===e?rM():e.close(),tY()}}function oM(e){const t=v.useRef(e);t.current=e,v.useEffect(()=>{const n=a=>t.current(a);return ui.add(n),Aa&&(clearTimeout(Aa),Aa=null),iM(),()=>{ui.delete(n),ui.size===0&&(Aa&&(clearTimeout(Aa),Aa=null),Nc=0,rM())}},[])}const fN=4e3,nY=500,sY=5e3,aY=5e3,rY=6e4,_y={"scout-managed":"scout","hudson-managed":"hudson",unattributed:"ghost"},Oy={tool:"working",run:"active",idle:"idle"};function gv(e){const t=e.split(/\s+/)[0]??"",n=t.lastIndexOf("/");return n>=0?t.slice(n+1):t}function iY(e,t=60){const n=e.split(/\s+/);if(n.length===0)return e;n[0]=gv(n[0]);const a=n.join(" ");return a.length<=t?a:a.slice(0,t-1)+"…"}function oY(e){for(const t of e){const n=gv(t.command);if(n&&!(n==="sh"||n==="zsh"||n==="bash"||n==="login"))return n}return e[0]?.command?gv(e[0].command):"—"}function lY(e){const t=e.match(/^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)$/);if(!t){const f=e.match(/^(\d+)$/);return f?Number.parseInt(f[1],10):0}const[,n,a,o,l]=t;let u=Number.parseInt(l,10)+Number.parseInt(o,10)*60;return a&&(u+=Number.parseInt(a,10)*3600),n&&(u+=Number.parseInt(n,10)*86400),u}function lM(e){if(e<60)return`${e}s`;if(e<3600)return`${Math.floor(e/60)}m${String(e%60).padStart(2,"0")}`;if(e<86400){const a=Math.floor(e/3600),o=Math.floor(e%3600/60);return`${a}h${String(o).padStart(2,"0")}`}const t=Math.floor(e/86400),n=Math.floor(e%86400/3600);return`${t}d${String(n).padStart(2,"0")}h`}function cM(e,t){if(e==null)return"—";const n=Math.max(0,Math.round((t-e)/1e3));return n<2?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:`${Math.floor(n/3600)}h ago`}function cY(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}`}function vv(e){return e?e.slice(0,8):"—"}const uY=/permission-mode/i;function dY(e){return e.kind!=="system"?!1:uY.test(e.summary)}function uM(e){return e.kind==="assistant"}function fY(e,t,n){if(!e)return[];const a=new Map;for(const o of t){let l=a.get(o.pid);l||(l={firstEventAt:o.ts,lastEventAt:o.ts,lastKind:o.kind,lastSummary:o.summary,reqCount:0,toolCount:0,permCount:0,eventCount:0,sessionId:o.sessionId||null,model:null,tokIn:null,tokOut:null,cacheReadIn:null,cacheWriteIn:null},a.set(o.pid,l)),o.ts<l.firstEventAt&&(l.firstEventAt=o.ts),o.ts>=l.lastEventAt&&(l.lastEventAt=o.ts,l.lastKind=o.kind,l.lastSummary=o.summary),l.eventCount++,o.kind==="tool"&&l.toolCount++,uM(o)&&l.reqCount++,dY(o)&&l.permCount++,o.sessionId&&!l.sessionId&&(l.sessionId=o.sessionId)}return e.processes.map(o=>{const l=a.get(o.pid);let u="idle";l&&n-l.lastEventAt<aY&&(u=l.lastKind==="tool"?"tool":"run");const f=lY(o.etime),m=l?.firstEventAt??null,h=l&&l.firstEventAt<l.lastEventAt?Math.min(Math.max(0,Math.round((l.lastEventAt-l.firstEventAt)/1e3)),f||Number.POSITIVE_INFINITY):0;return{pid:o.pid,ppid:o.ppid,sessionId:l?.sessionId??null,harness:o.harness,project:o.cwd?hY(o.cwd):"(unknown)",cwd:o.cwd??"",command:o.command,parentLabel:oY(o.parentChain??[]),procRuntimeSec:f,procEtime:o.etime,sessionStartAt:m,sessionRuntimeSec:h,status:u,lastEventAt:l?.lastEventAt??null,lastEventKind:l?.lastKind??null,lastSummary:l?.lastSummary??null,reqCount:l?.reqCount??0,toolCount:l?.toolCount??0,permCount:l?.permCount??0,eventCount:l?.eventCount??0,model:l?.model??null,tokIn:l?.tokIn??null,tokOut:l?.tokOut??null,cacheReadIn:l?.cacheReadIn??null,cacheWriteIn:l?.cacheWriteIn??null}})}function kc(e){if(e.cacheReadIn==null||e.tokIn==null)return null;const t=e.cacheReadIn+e.tokIn;return t===0?null:e.cacheReadIn/t}function ei(e){return e==null?"—":e===0?"0":e>=1e6?(e/1e6).toFixed(e>=1e7?0:1)+"M":e>=1e3?(e/1e3).toFixed(e>=1e4?0:1)+"k":String(e)}function dM(e){return e==null?"—":`${Math.round(e*100)}%`}function hY(e){if(!e)return"";const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function mY(e,t,n){const a=n-rY;let o=0;for(const u of t)uM(u)&&u.ts>=a&&o++;const l={total:e.length,running:0,tooling:0,idle:0,scout:0,hudson:0,ghost:0,reqsPerMin:o};for(const u of e)u.status==="tool"?(l.tooling++,l.running++):u.status==="run"?l.running++:l.idle++,u.harness==="scout-managed"?l.scout++:u.harness==="hudson-managed"?l.hudson++:l.ghost++;return l}const Sf={tool:0,run:1,idle:2};function co(e){return e??-1}function pY(e,t,n,a){switch(n){case"status":return(Sf[e.status]-Sf[t.status])*a;case"agent":{const o=e.harness.localeCompare(t.harness);return o!==0?o*a:(e.sessionId??"").localeCompare(t.sessionId??"")*a}case"project":return e.project.localeCompare(t.project)*a;case"reqs":return(e.reqCount-t.reqCount)*a;case"tokIn":return(co(e.tokIn)-co(t.tokIn))*a;case"tokOut":return(co(e.tokOut)-co(t.tokOut))*a;case"cache":return(co(kc(e))-co(kc(t)))*a;case"tools":return(e.toolCount-t.toolCount)*a;case"perms":return(e.permCount-t.permCount)*a;case"last":{const o=e.lastEventAt??0,l=t.lastEventAt??0;return(o-l)*a}case"runtime":return(e.sessionRuntimeSec-t.sessionRuntimeSec)*a}}function hN({values:e,color:t}){if(e.length<2)return i.jsx("svg",{className:"s-atop-spark",width:88,height:18,viewBox:"0 0 88 18"});const o=Math.max(1,...e),l=88/(e.length-1),u=e.map((f,m)=>`${(m*l).toFixed(1)},${(18-f/o*18).toFixed(1)}`).join(" ");return i.jsx("svg",{className:"s-atop-spark",width:88,height:18,viewBox:"0 0 88 18",children:i.jsx("polyline",{fill:"none",stroke:t,strokeWidth:"1.25",points:u})})}function gY(){const[e,t]=v.useState([]),[n,a]=v.useState(null),[o,l]=v.useState(()=>Date.now()),[u,f]=v.useState(""),[m,h]=v.useState(()=>new Set),[p,y]=v.useState(()=>new Set),[b,w]=v.useState("status"),[j,N]=v.useState(1),[C,k]=v.useState(null),E=v.useRef([]),S=v.useRef([]),[R,A]=v.useState([]),[M,D]=v.useState([]),U=v.useCallback(O=>{t(Z=>Z.length>=fN?[...Z.slice(Z.length-fN+1),O]:[...Z,O])},[]);oM(U),v.useEffect(()=>{let O=!1;return(async()=>{try{const Z=await Ce(`/api/tail/recent?limit=${nY}`);O||t(Z.events??[])}catch{}})(),()=>{O=!0}},[]);const F=v.useCallback(async()=>{try{const O=await Ce("/api/tail/discover");a(O)}catch{}},[]);v.useEffect(()=>{F();const O=setInterval(()=>{F()},sY);return()=>clearInterval(O)},[F]),v.useEffect(()=>{const O=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(O)},[]);const P=v.useMemo(()=>fY(n,e,o),[n,e,o]),_=v.useMemo(()=>mY(P,e,o),[P,e,o]);v.useEffect(()=>{E.current=[...E.current,_.running].slice(-24),S.current=[...S.current,_.tooling].slice(-24),A(E.current),D(S.current)},[_.running,_.tooling]);const z=v.useMemo(()=>{const O=new Set;return P.forEach(Z=>O.add(Z.harness)),[...O]},[P]),B=v.useMemo(()=>{const O=new Set;return P.forEach(Z=>O.add(Z.status)),[...O]},[P]),V=v.useMemo(()=>{const O=u.trim().toLowerCase();return P.filter(W=>m.size>0&&!m.has(W.harness)||p.size>0&&!p.has(W.status)?!1:O?`${W.pid} ${W.project} ${W.command} ${W.harness} ${W.sessionId??""} ${W.lastSummary??""}`.toLowerCase().includes(O):!0).slice().sort((W,Q)=>{const ce=Sf[W.status]-Sf[Q.status];return ce!==0&&b!=="status"?ce:pY(W,Q,b,j)})},[P,u,m,p,b,j]);v.useEffect(()=>{C!=null&&(P.some(O=>O.pid===C)||k(null))},[P,C]),v.useEffect(()=>{const O=Z=>{const W=Z.target,Q=W instanceof HTMLInputElement||W instanceof HTMLTextAreaElement||(W?.isContentEditable??!1);if(Z.key==="Escape"&&C!=null){Z.preventDefault(),k(null);return}if(!Q&&(Z.key==="j"||Z.key==="k")){if(V.length===0)return;Z.preventDefault();const ce=V.findIndex(ge=>ge.pid===C),ae=Z.key==="j"?V[Math.min(V.length-1,ce<0?0:ce+1)]:V[Math.max(0,ce<0?0:ce-1)];ae&&k(ae.pid)}};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[V,C]);const K=O=>{b===O?N(Z=>Z===1?-1:1):(w(O),N(O==="project"||O==="agent"?1:-1))},L=O=>{h(Z=>{const W=new Set(Z);return W.has(O)?W.delete(O):W.add(O),W})},H=O=>{y(Z=>{const W=new Set(Z);return W.has(O)?W.delete(O):W.add(O),W})},$=v.useMemo(()=>C!=null?P.find(O=>O.pid===C)??null:null,[P,C]),G=v.useMemo(()=>C!=null?n?.processes.find(O=>O.pid===C)??null:null,[n,C]),X=v.useMemo(()=>C==null?[]:e.filter(O=>O.pid===C).slice(-40),[e,C]);return i.jsxs("div",{className:"s-atop",children:[i.jsx(vY,{summary:_,runHistory:R,toolHistory:M}),i.jsx(yY,{search:u,onSearch:f,harnessOptions:z,harnessFilter:m,onToggleHarness:L,statusOptions:B,statusFilter:p,onToggleStatus:H,summary:_}),i.jsx(bY,{rows:V,sortKey:b,sortDir:j,onSort:K,selectedPid:C,onSelect:k,now:o}),i.jsx(wY,{shown:V.length,total:P.length,hasSelection:C!=null}),$&&i.jsx(jY,{row:$,process:G,events:X,now:o,onClose:()=>k(null)})]})}function vY({summary:e,runHistory:t,toolHistory:n}){return i.jsxs("div",{className:"s-atop-summary",children:[i.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--primary",children:[i.jsxs("div",{className:"s-atop-summary-num",children:[i.jsx("strong",{children:e.running}),i.jsxs("span",{className:"s-atop-summary-of",children:["/ ",e.total]})]}),i.jsx("span",{className:"s-atop-summary-lbl",children:"active"}),i.jsx(hN,{values:t,color:"var(--green)"})]}),i.jsxs("div",{className:"s-atop-summary-cell",children:[i.jsx("div",{className:"s-atop-summary-num",children:i.jsx("strong",{children:e.tooling})}),i.jsx("span",{className:"s-atop-summary-lbl",children:"working"}),i.jsx(hN,{values:n,color:"var(--accent)"})]}),i.jsxs("div",{className:"s-atop-summary-cell",children:[i.jsx("div",{className:"s-atop-summary-num",children:i.jsx("strong",{children:e.idle})}),i.jsx("span",{className:"s-atop-summary-lbl",children:"idle"})]}),i.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--breakdown",children:[i.jsx("span",{className:"s-atop-summary-lbl",children:"harness"}),i.jsxs("div",{className:"s-atop-summary-row",children:[i.jsxs("span",{className:"s-atop-chip s-atop-chip--scout",children:["scout ",e.scout]}),i.jsxs("span",{className:"s-atop-chip s-atop-chip--hudson",children:["hudson ",e.hudson]}),i.jsxs("span",{className:`s-atop-chip s-atop-chip--ghost${e.ghost>0?"":" s-atop-chip--mute"}`,children:["ghost ",e.ghost]})]})]}),i.jsx("div",{className:"s-atop-summary-spacer"}),i.jsxs("div",{className:"s-atop-summary-cell s-atop-summary-cell--rate",children:[i.jsxs("div",{className:"s-atop-summary-num",children:[i.jsx("strong",{children:e.reqsPerMin}),i.jsx("span",{className:"s-atop-summary-of",children:"/ min"})]}),i.jsx("span",{className:"s-atop-summary-lbl",children:"requests"})]})]})}function yY({search:e,onSearch:t,harnessOptions:n,harnessFilter:a,onToggleHarness:o,statusOptions:l,statusFilter:u,onToggleStatus:f,summary:m}){const h=b=>b==="scout-managed"?m.scout:b==="hudson-managed"?m.hudson:m.ghost,p=b=>b==="tool"?m.tooling:b==="run"?m.running-m.tooling:m.idle,y=v.useRef(null);return v.useEffect(()=>{const b=w=>{if(w.key!=="/")return;const j=w.target;j instanceof HTMLInputElement||j instanceof HTMLTextAreaElement||(j?.isContentEditable??!1)||(w.preventDefault(),y.current?.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]),i.jsxs("div",{className:"s-atop-fbar",children:[i.jsxs("div",{className:"s-atop-search",children:[i.jsx("span",{className:"s-atop-search-prompt",children:"▸"}),i.jsx("input",{ref:y,className:"s-atop-search-input",value:e,onChange:b=>t(b.target.value),placeholder:"filter by pid · project · command · summary",spellCheck:!1}),i.jsx("span",{className:"s-atop-search-kbd",children:"/"})]}),n.length>1&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"s-atop-fbar-label",children:"harness"}),n.map(b=>{const w=a.has(b);return i.jsxs("button",{className:`s-atop-pill s-atop-pill--${b}${w?" s-atop-pill--on":""}`,onClick:()=>o(b),children:[_y[b],i.jsx("span",{className:"s-atop-pill-ct",children:h(b)})]},b)})]}),l.length>1&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"s-atop-fbar-label",children:"status"}),["tool","run","idle"].filter(b=>l.includes(b)).map(b=>{const w=u.has(b);return i.jsxs("button",{className:`s-atop-pill s-atop-pill--status-${b}${w?" s-atop-pill--on":""}`,onClick:()=>f(b),children:[Oy[b],i.jsx("span",{className:"s-atop-pill-ct",children:p(b)})]},b)})]}),i.jsx("div",{className:"s-atop-fbar-spacer"})]})}const cg=[{key:"status",label:"Status",cls:"s-atop-col-status",defaultWidth:96,minWidth:70},{key:"agent",label:"Agent",cls:"s-atop-col-agent",tip:"Harness · short session id",defaultWidth:168,minWidth:110},{key:"project",label:"Project",cls:"s-atop-col-project",defaultWidth:200,minWidth:96,maxWidth:480},{key:"reqs",label:"Reqs",cls:"s-atop-col-num",tip:"Model invocations (assistant turns) for this session",defaultWidth:64,minWidth:56},{key:"tokIn",label:"Tok ↓",cls:"s-atop-col-num",tip:"Input tokens — populated when backend emits usage",defaultWidth:64,minWidth:56},{key:"tokOut",label:"Tok ↑",cls:"s-atop-col-num",tip:"Output tokens — populated when backend emits usage",defaultWidth:64,minWidth:56},{key:"cache",label:"Cache",cls:"s-atop-col-num",tip:"Cache hit rate — populated when backend emits usage",defaultWidth:64,minWidth:56},{key:"tools",label:"Tools",cls:"s-atop-col-num",defaultWidth:64,minWidth:56},{key:"perms",label:"Perms",cls:"s-atop-col-num",tip:"Permission requests — heuristic count of permission-mode events",defaultWidth:64,minWidth:56},{key:"last",label:"Last",cls:"s-atop-col-last",defaultWidth:86,minWidth:64},{key:"runtime",label:"Runtime",cls:"s-atop-col-runtime",tip:"Session duration (active period in current buffer)",defaultWidth:80,minWidth:64}];function Fl({value:e,accent:t}){const n=e==null?"s-atop-col-num s-atop-col-num--dim":`s-atop-col-num${t?` s-atop-col-num--${t}`:""}`;return i.jsx("td",{className:n,children:ei(e)})}function xY({value:e}){const t=e==null?"s-atop-col-num s-atop-col-num--dim":"s-atop-col-num";return i.jsx("td",{className:t,children:dM(e)})}function bY({rows:e,sortKey:t,sortDir:n,onSort:a,selectedPid:o,onSelect:l,now:u}){const{getColumnProps:f,getResizeHandleProps:m}=JW({storageKey:"openscout.atop.cols",columns:cg});return i.jsx("div",{className:"s-atop-table-wrap",children:i.jsxs("table",{className:"s-atop-table",children:[i.jsx("thead",{children:i.jsx("tr",{children:cg.map(h=>i.jsxs("th",{className:`${h.cls??""}${t===h.key?" s-atop-th--sorted":""}`,onClick:()=>a(h.key),title:h.tip,...f(h.key),children:[h.label,t===h.key&&i.jsx("span",{className:"s-atop-th-arrow",children:n===1?"↑":"↓"}),i.jsx("span",{...m(h.key)})]},h.key))})}),i.jsx("tbody",{children:e.length===0?i.jsx("tr",{className:"s-atop-empty-row",children:i.jsx("td",{colSpan:cg.length,children:i.jsxs("div",{className:"s-atop-empty",children:[i.jsx("span",{className:"s-atop-empty-title",children:"no agents match"}),i.jsx("span",{children:"adjust filters or start a session to populate"})]})})}):e.map(h=>i.jsxs("tr",{className:`s-atop-row${o===h.pid?" s-atop-row--selected":""}`,onClick:()=>l(h.pid),children:[i.jsx("td",{className:"s-atop-col-status",children:i.jsxs("span",{className:`s-atop-status s-atop-status--${h.status}`,children:[i.jsx("span",{className:"s-atop-status-dot"}),Oy[h.status]]})}),i.jsxs("td",{className:"s-atop-col-agent",children:[i.jsx("span",{className:`s-atop-chip s-atop-chip--${h.harness}`,children:_y[h.harness]}),i.jsx("span",{className:"s-atop-agent-id",title:h.sessionId??`pid ${h.pid}`,children:vv(h.sessionId)})]}),i.jsx("td",{className:"s-atop-col-project",title:h.cwd,children:h.project}),i.jsx(Fl,{value:h.reqCount||null}),i.jsx(Fl,{value:h.tokIn}),i.jsx(Fl,{value:h.tokOut}),i.jsx(xY,{value:kc(h)}),i.jsx(Fl,{value:h.toolCount||null}),i.jsx(Fl,{value:h.permCount||null,accent:h.permCount>0?"amber":void 0}),i.jsx("td",{className:"s-atop-col-last",children:cM(h.lastEventAt,u)}),i.jsx("td",{className:"s-atop-col-runtime",children:lM(h.sessionRuntimeSec)})]},h.pid))})]})})}function wY({shown:e,total:t,hasSelection:n}){return i.jsxs("div",{className:"s-atop-keys",children:[i.jsxs("span",{className:"s-atop-keys-count",children:[i.jsx("strong",{children:e})," / ",t," agents"]}),i.jsx("span",{className:"s-atop-keys-spacer"}),i.jsxs("span",{children:[i.jsx("kbd",{children:"/"})," filter"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"j"}),"/",i.jsx("kbd",{children:"k"})," select"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"click"})," drill in"]}),n&&i.jsxs("span",{children:[i.jsx("kbd",{children:"esc"})," close"]})]})}function jY({row:e,process:t,events:n,now:a,onClose:o}){const l=v.useMemo(()=>{const f={};for(const p of n){if(p.kind!=="tool")continue;const y=p.summary.match(/^([a-z_][a-z0-9_]*)/i),b=y?y[1]:"(tool)";f[b]=(f[b]??0)+1}const m=Object.entries(f).sort((p,y)=>y[1]-p[1]).slice(0,6),h=Math.max(1,...m.map(p=>p[1]));return m.map(([p,y])=>({name:p,count:y,frac:y/h}))},[n]),u=n.slice(-40).reverse();return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"s-atop-drawer-bg",onClick:o}),i.jsxs("aside",{className:"s-atop-drawer",role:"dialog","aria-label":`Agent ${e.pid}`,children:[i.jsxs("header",{className:"s-atop-drawer-head",children:[i.jsxs("div",{className:"s-atop-drawer-head-meta",children:[i.jsxs("span",{className:`s-atop-status s-atop-status--${e.status}`,children:[i.jsx("span",{className:"s-atop-status-dot"}),Oy[e.status]]}),i.jsxs("span",{className:"s-atop-drawer-pid",children:["pid ",e.pid]}),i.jsx("span",{className:`s-atop-chip s-atop-chip--${e.harness}`,children:_y[e.harness]}),i.jsxs("span",{className:"s-atop-drawer-session",children:["session ",vv(e.sessionId)]})]}),i.jsx("h2",{className:"s-atop-drawer-title",children:e.project}),i.jsxs("p",{className:"s-atop-drawer-sub",children:["session ",vv(e.sessionId)," · runtime ",lM(e.sessionRuntimeSec)," · last activity ",cM(e.lastEventAt,a)]}),i.jsx("button",{className:"s-atop-drawer-close",onClick:o,"aria-label":"Close",children:"✕"})]}),i.jsxs("div",{className:"s-atop-drawer-body",children:[i.jsxs("section",{children:[i.jsx("h3",{className:"s-atop-drawer-h3",children:"Activity"}),i.jsxs("div",{className:"s-atop-metrics",children:[i.jsx(ir,{label:"Requests",value:ei(e.reqCount||null)}),i.jsx(ir,{label:"Tools",value:ei(e.toolCount||null)}),i.jsx(ir,{label:"Permissions",value:ei(e.permCount||null),accent:e.permCount>0?"amber":void 0}),i.jsx(ir,{label:"Tok in",value:ei(e.tokIn),dim:e.tokIn==null}),i.jsx(ir,{label:"Tok out",value:ei(e.tokOut),dim:e.tokOut==null}),i.jsx(ir,{label:"Cache hit",value:dM(kc(e)),dim:kc(e)==null}),i.jsx(ir,{label:"Model",value:e.model??"—",dim:e.model==null}),i.jsx(ir,{label:"Events",value:ei(e.eventCount||null)})]})]}),l.length>0&&i.jsxs("section",{children:[i.jsx("h3",{className:"s-atop-drawer-h3",children:"Tool calls"}),i.jsx("ul",{className:"s-atop-histo",children:l.map(f=>i.jsxs("li",{children:[i.jsx("span",{className:"s-atop-histo-name",children:f.name}),i.jsx("span",{className:"s-atop-histo-bar",children:i.jsx("span",{className:"s-atop-histo-fill",style:{width:`${(f.frac*100).toFixed(1)}%`}})}),i.jsx("span",{className:"s-atop-histo-count",children:f.count})]},f.name))})]}),i.jsxs("section",{children:[i.jsxs("h3",{className:"s-atop-drawer-h3",children:["Recent activity",i.jsxs("span",{className:"s-atop-drawer-h3-aside",children:[n.length," buffered"]})]}),u.length===0?i.jsx("div",{className:"s-atop-peek-empty",children:"no events buffered for this agent yet"}):i.jsx("ol",{className:"s-atop-peek",children:u.map(f=>i.jsxs("li",{className:`s-atop-peek-row s-atop-peek-row--${f.kind}`,children:[i.jsx("span",{className:"s-atop-peek-time",children:cY(f.ts)}),i.jsx("span",{className:"s-atop-peek-kind",children:f.kind}),i.jsx("span",{className:"s-atop-peek-text",children:f.summary})]},f.id))})]}),i.jsxs("section",{className:"s-atop-drawer-section--secondary",children:[i.jsx("h3",{className:"s-atop-drawer-h3",children:"Process"}),i.jsx("code",{className:"s-atop-codeblock",children:e.command}),i.jsxs("dl",{className:"s-atop-kvs",children:[i.jsx("dt",{children:"PID"}),i.jsx("dd",{children:e.pid}),i.jsx("dt",{children:"Parent"}),i.jsxs("dd",{children:[e.parentLabel," (ppid ",e.ppid,")"]}),i.jsx("dt",{children:"Process etime"}),i.jsx("dd",{children:e.procEtime}),i.jsx("dt",{children:"CWD"}),i.jsx("dd",{children:e.cwd||"(none)"})]}),t?.parentChain&&t.parentChain.length>0&&i.jsx("ol",{className:"s-atop-chain",children:t.parentChain.map(f=>i.jsxs("li",{children:[i.jsx("span",{className:"s-atop-chain-pid",children:f.pid}),i.jsx("span",{className:"s-atop-chain-cmd",children:iY(f.command,80)})]},f.pid))})]})]})]})]})}function ir({label:e,value:t,dim:n,accent:a}){const o=`s-atop-metric${n?" s-atop-metric--dim":""}${a?` s-atop-metric--${a}`:""}`;return i.jsxs("div",{className:o,children:[i.jsx("span",{className:"s-atop-metric-lbl",children:e}),i.jsx("span",{className:"s-atop-metric-val",children:t})]})}const SY=e=>e==="right"?"railOccupantRight":"railOccupantBottom";function NY(e,t,n,a){v.useEffect(()=>{if(!n||typeof window>"u"||typeof document>"u")return;const o=SY(e),l=document.body.dataset[o];document.body.dataset[o]=t,window.dispatchEvent(new CustomEvent("hudson:rail:claim",{detail:{owner:t,side:e}})),l&&l!==t&&window.dispatchEvent(new CustomEvent("hudson:rail:preempted",{detail:{owner:l,side:e,by:t}}));const u=m=>{const h=m.detail;h&&h.side===e&&h.owner!==t&&a?.()},f=m=>{const h=m.detail;h&&h.side===e&&h.owner===t&&a?.()};return window.addEventListener("hudson:rail:claim",u),window.addEventListener("hudson:rail:preempted",f),()=>{window.removeEventListener("hudson:rail:claim",u),window.removeEventListener("hudson:rail:preempted",f),document.body.dataset[o]===t&&delete document.body.dataset[o],window.dispatchEvent(new CustomEvent("hudson:rail:release",{detail:{owner:t,side:e}}))}},[e,t,n,a])}const kY=620,EY=360,CY=280,TY=900,AY=720,mN=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(", ");function MY({open:e,onClose:t,side:n="right",owner:a,defaultSize:o,minSize:l=CY,maxSize:u,resizable:f=!1,backdrop:m=!0,scrollLock:h=!1,focusTrap:p=!1,ariaLabel:y,className:b,children:w}){const j=o??(n==="right"?kY:EY),N=u??(n==="right"?TY:AY),[C,k]=v.useState(j),[E,S]=v.useState(!1),R=v.useRef(null),A=v.useRef(null),M=v.useCallback(()=>t(),[t]);NY(n,a,e,M),v.useEffect(()=>{if(!e)return;const F=P=>{P.key==="Escape"&&(P.preventDefault(),M())};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[e,M]),v.useEffect(()=>{if(!e||!h)return;const F=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=F}},[e,h]),v.useEffect(()=>{if(!e)return;A.current=document.activeElement;const F=R.current;return F?((F.querySelector(mN)??F).focus(),()=>{A.current?.focus?.()}):void 0},[e]),v.useEffect(()=>{if(!E)return;const F=_=>{if(n==="right"){const z=window.innerWidth-_.clientX;k(Math.min(N,Math.max(l,z)))}else{const z=window.innerHeight-_.clientY;k(Math.min(N,Math.max(l,z)))}},P=()=>S(!1);return window.addEventListener("pointermove",F),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P),()=>{window.removeEventListener("pointermove",F),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P)}},[E,n,l,N]);const D=F=>{if(!p||F.key!=="Tab")return;const P=R.current;if(!P)return;const _=Array.from(P.querySelectorAll(mN));if(_.length===0){F.preventDefault(),P.focus();return}const z=_[0],B=_[_.length-1],V=document.activeElement;F.shiftKey?(V===z||!P.contains(V))&&(F.preventDefault(),B.focus()):V===B&&(F.preventDefault(),z.focus())};if(!e)return null;const U=n==="right"?{width:C}:{height:C};return i.jsxs(i.Fragment,{children:[m&&i.jsx("div",{className:"s-slide-backdrop","data-side":n,onClick:M,"aria-hidden":"true"}),i.jsxs("aside",{ref:R,className:`s-slide s-slide--${n}${E?" s-slide--resizing":""}${b?` ${b}`:""}`,role:"dialog","aria-modal":"true","aria-label":y,tabIndex:-1,onKeyDown:D,style:U,children:[f&&i.jsx("div",{className:`s-slide-resize s-slide-resize--${n}`,onPointerDown:F=>{F.preventDefault(),S(!0)},role:"separator","aria-orientation":n==="right"?"vertical":"horizontal","aria-label":"Resize panel"}),w]})]})}const pN=5e3,RY=500,gN=5e3,fM={user:">",assistant:"<",tool:"*","tool-result":"=",system:"~",other:"·"},hM={"scout-managed":"scout","hudson-managed":"hudson",unattributed:"ghost"},mM={"scout-managed":"s-tail-chip--scout","hudson-managed":"s-tail-chip--hudson",unattributed:"s-tail-chip--ghost"};function _Y(e){const t=new Date(e),n=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),l=String(t.getMilliseconds()).padStart(3,"0");return`${n}:${a}:${o}.${l}`}function OY(e){return e?(e.split(":")[0]??e).slice(0,8):"—"}function IY(e,t){return t?`${e.summary} ${e.project} ${e.sessionId} ${e.harness}`.toLowerCase().includes(t.toLowerCase()):!0}function DY({navigate:e}={}){const[t,n]=v.useState([]),[a,o]=v.useState(null),[l,u]=v.useState(""),[f,m]=v.useState(!1),[h,p]=v.useState(!1),[y,b]=v.useState(0),[w,j]=v.useState(0),[N,C]=v.useState(null),k=v.useRef(null),E=v.useRef(null),S=v.useRef(!0),R=v.useRef([]),A=v.useCallback(V=>{R.current.push(Date.now()),n(K=>K.length>=pN?[...K.slice(K.length-pN+1),V]:[...K,V])},[]);oM(A),v.useEffect(()=>{let V=!1;return(async()=>{try{const K=await Ce(`/api/tail/recent?limit=${RY}`);V||n(K.events??[])}catch{}})(),()=>{V=!0}},[]);const M=v.useCallback(async()=>{try{const V=await Ce("/api/tail/discover");o(V)}catch{}},[]);v.useEffect(()=>{M();const V=setInterval(()=>{M()},5e3);return()=>clearInterval(V)},[M]),v.useEffect(()=>{const V=setInterval(()=>{const L=Date.now()-gN,H=R.current.filter($=>$>=L);R.current=H,j(H.length/(gN/1e3))},1e3);return()=>clearInterval(V)},[]);const D=v.useMemo(()=>l?t.filter(V=>IY(V,l)):t,[t,l]);v.useLayoutEffect(()=>{const V=k.current;if(V){if(h){b(K=>K+1);return}V.scrollTop=V.scrollHeight}},[D,h]);const U=v.useCallback(()=>{const V=k.current;if(!V)return;const L=V.scrollHeight-V.scrollTop-V.clientHeight<24;S.current=L,L?(p(!1),b(0)):h||p(!0)},[h]),F=v.useCallback(V=>{u(V),m(!0),requestAnimationFrame(()=>E.current?.focus())},[]),P=v.useCallback(V=>{!V||!e||e({view:"sessions",sessionId:V})},[e]),_=v.useCallback(()=>{const V=k.current;V&&(V.scrollTop=V.scrollHeight,p(!1),b(0))},[]);v.useEffect(()=>{const V=K=>{const L=K.target,H=L instanceof HTMLInputElement||L instanceof HTMLTextAreaElement||(L?.isContentEditable??!1);if(K.key==="/"&&!H){K.preventDefault(),m(!0),requestAnimationFrame(()=>E.current?.focus());return}if(K.key==="Escape"&&f&&document.activeElement===E.current){K.preventDefault(),m(!1),E.current?.blur(),u("");return}(K.key==="g"||K.key==="G")&&!H&&(K.preventDefault(),_())};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[f,_]);const z=a?.totals,B=z?.unattributed??0;return i.jsxs("div",{className:"s-tail",children:[i.jsxs("div",{className:"s-tail-status",children:[i.jsxs("span",{className:"s-tail-status-cell",children:[i.jsx("span",{className:"s-tail-rate-pulse"}),i.jsx("strong",{children:z?.total??0})," agent",(z?.total??0)===1?"":"s"]}),i.jsxs("span",{className:"s-tail-status-cell",children:[i.jsx("strong",{children:w.toFixed(1)})," lines/s"]}),i.jsxs("span",{className:`s-tail-status-cell${B>0?" s-tail-status-cell--ghost":""}`,children:[i.jsx("strong",{children:B})," ghost",B===1?"":"s"]}),i.jsxs("span",{className:"s-tail-status-cell",children:[i.jsx("strong",{children:z?.scoutManaged??0})," scout · ",i.jsx("strong",{children:z?.hudsonManaged??0})," hudson"]}),i.jsx("span",{className:"s-tail-status-spacer"}),h&&i.jsx("span",{className:"s-tail-status-paused",children:"paused"})]}),f&&i.jsxs("div",{className:"s-tail-filter",children:[i.jsx("span",{className:"s-tail-filter-prompt",children:"/"}),i.jsx("input",{ref:E,className:"s-tail-filter-input",value:l,placeholder:"substring across summary · project · session",onChange:V=>u(V.target.value),onKeyDown:V=>{V.key==="Enter"&&(V.preventDefault(),E.current?.blur())},autoFocus:!0,spellCheck:!1}),i.jsx("span",{className:"s-tail-filter-hint",children:"esc to clear"})]}),i.jsxs("div",{className:"s-tail-body",ref:k,onScroll:U,children:[D.length===0?i.jsxs("div",{className:"s-tail-empty",children:[i.jsx("span",{className:"s-tail-empty-title",children:"tail · waiting for transcripts"}),i.jsx("span",{children:z?.total?i.jsxs(i.Fragment,{children:["watching ",z.total," claude session",z.total===1?"":"s"]}):i.jsx(i.Fragment,{children:"no claude processes detected · start a session to see traffic"})})]}):D.map(V=>i.jsx(zY,{event:V,selected:N?.id===V.id,onSelect:C,onProjectClick:F,onSessionClick:P},V.id)),h&&y>0&&i.jsxs("div",{className:"s-tail-divider",onClick:_,role:"button",children:["── paused · ",y," new · click or press G to jump back to live ──"]})]}),i.jsxs("div",{className:"s-tail-keys",children:[i.jsxs("span",{children:[i.jsx("kbd",{children:"j"}),"/",i.jsx("kbd",{children:"k"})," scroll"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"/"})," filter"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"G"})," jump live"]}),i.jsxs("span",{children:[i.jsx("kbd",{children:"esc"})," close filter"]}),i.jsx("span",{className:"s-tail-keys-spacer"}),i.jsxs("span",{children:[D.length," / ",t.length," lines buffered"]})]}),N&&i.jsx($Y,{event:N,onClose:()=>C(null),onProjectClick:F,onSessionClick:P})]})}function zY({event:e,selected:t,onSelect:n,onProjectClick:a,onSessionClick:o}){const l=mM[e.harness],u=hM[e.harness];return i.jsxs("div",{className:`s-tail-row s-tail-row--${e.kind}${t?" s-tail-row--selected":""}`,role:"button",tabIndex:0,onClick:()=>n(e),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),n(e))},children:[i.jsx("span",{className:"s-tail-cell-time",children:_Y(e.ts)}),i.jsx("span",{className:"s-tail-gutter",children:"│"}),i.jsx("span",{className:"s-tail-chip s-tail-chip--source",children:e.source}),i.jsx("span",{className:`s-tail-chip ${l}`,children:u}),i.jsxs("span",{className:"s-tail-cell-context",children:[i.jsx(Nf,{className:"s-tail-link s-tail-link--project",onClick:a?()=>a(e.project):void 0,title:`Filter to ${e.project}`,children:i.jsx("strong",{children:e.project})})," · ",i.jsx(Nf,{className:"s-tail-link s-tail-link--session",onClick:o&&e.sessionId?()=>o(e.sessionId):void 0,title:e.sessionId?`Open session ${e.sessionId}`:void 0,children:OY(e.sessionId)})," · ",i.jsx("span",{className:"s-tail-cell-pid",title:`pid ${e.pid}`,children:e.pid})]}),i.jsx("span",{className:`s-tail-glyph s-tail-glyph--${e.kind}`,children:fM[e.kind]}),i.jsx("span",{className:"s-tail-summary",children:e.summary})]})}function Nf({className:e,onClick:t,title:n,children:a}){return t?i.jsx("span",{className:`${e} s-tail-link--active`,role:"link",tabIndex:0,title:n,onClick:o=>{o.stopPropagation(),t()},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),o.stopPropagation(),t())},children:a}):i.jsx("span",{className:e,title:n,children:a})}function PY(e){const t=new Date(e),n=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),l=String(t.getHours()).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0"),f=String(t.getSeconds()).padStart(2,"0"),m=String(t.getMilliseconds()).padStart(3,"0");return`${n}-${a}-${o} ${l}:${u}:${f}.${m}`}function Vd(e){return(JSON.stringify(e,null,2)??"undefined").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/("(?:\\.|[^"\\])*"\s*:)|("(?:\\.|[^"\\])*")|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g,(a,o,l,u,f)=>o?`<span class="s-tail-jk">${o}</span>`:l?`<span class="s-tail-js">${l}</span>`:u?`<span class="s-tail-jl">${u}</span>`:f?`<span class="s-tail-jn">${f}</span>`:a)}function LY(e){if(!e||typeof e!="object")return null;const t=e,a=t.message?.content??t.content;return Array.isArray(a)?a:typeof a=="string"?[{type:"text",text:a}]:null}function $Y({event:e,onClose:t,onProjectClick:n,onSessionClick:a}){const[o,l]=v.useState(!0),u=mM[e.harness],f=hM[e.harness],m=LY(e.raw);return i.jsxs(MY,{open:!0,onClose:t,side:"right",owner:"openscout.tail",resizable:!0,defaultSize:620,minSize:400,maxSize:960,ariaLabel:"Tail event detail",children:[i.jsxs("div",{className:"s-slide-header s-tail-sheet-header",children:[i.jsx("span",{className:`s-tail-glyph s-tail-glyph--${e.kind}`,children:fM[e.kind]}),i.jsx("span",{className:"s-tail-sheet-kind",children:e.kind}),i.jsx("span",{className:`s-tail-chip ${u}`,children:f}),i.jsx("span",{className:"s-tail-chip s-tail-chip--source",children:e.source}),i.jsx("span",{className:"s-slide-spacer"}),i.jsx("span",{className:"s-tail-sheet-time",children:PY(e.ts)}),i.jsx("button",{type:"button",className:"s-slide-close",onClick:t,"aria-label":"Close",children:"×"})]}),i.jsxs("div",{className:"s-slide-body s-tail-sheet-body",children:[i.jsx("section",{className:"s-tail-sheet-section",children:i.jsxs("div",{className:"s-tail-sheet-grid",children:[i.jsx("span",{className:"s-tail-sheet-key",children:"project"}),i.jsx("span",{className:"s-tail-sheet-val",children:i.jsx(Nf,{className:"s-tail-link s-tail-link--project",onClick:n?()=>n(e.project):void 0,title:`Filter to ${e.project}`,children:e.project})}),i.jsx("span",{className:"s-tail-sheet-key",children:"cwd"}),i.jsx("span",{className:"s-tail-sheet-val s-tail-sheet-val--mono",children:e.cwd||"—"}),i.jsx("span",{className:"s-tail-sheet-key",children:"session"}),i.jsx("span",{className:"s-tail-sheet-val s-tail-sheet-val--mono",children:i.jsx(Nf,{className:"s-tail-link s-tail-link--session",onClick:a&&e.sessionId?()=>a(e.sessionId):void 0,title:e.sessionId?`Open session ${e.sessionId}`:void 0,children:e.sessionId||"—"})}),i.jsx("span",{className:"s-tail-sheet-key",children:"pid"}),i.jsxs("span",{className:"s-tail-sheet-val s-tail-sheet-val--mono",children:[e.pid,e.parentPid!=null?` ← ${e.parentPid}`:""]})]})}),i.jsxs("section",{className:"s-tail-sheet-section",children:[i.jsx("h4",{className:"s-tail-sheet-h",children:"summary"}),i.jsx("div",{className:"s-tail-sheet-summary",children:e.summary})]}),m&&m.length>0&&i.jsxs("section",{className:"s-tail-sheet-section",children:[i.jsx("h4",{className:"s-tail-sheet-h",children:"content"}),m.map((h,p)=>i.jsx(UY,{block:h},p))]}),i.jsxs("section",{className:"s-tail-sheet-section",children:[i.jsxs("button",{type:"button",className:"s-tail-sheet-toggle",onClick:()=>l(h=>!h),children:[o?"▾":"▸"," raw event"]}),o&&i.jsx("pre",{className:"s-tail-sheet-json",dangerouslySetInnerHTML:{__html:Vd(e.raw??e)}})]})]})]})}function UY({block:e}){if(e.type==="text"){const t=e.text??"";return i.jsx("div",{className:"s-tail-sheet-text",children:t})}if(e.type==="tool_use"){const t=e;return i.jsxs("div",{className:"s-tail-sheet-block s-tail-sheet-block--tool",children:[i.jsxs("div",{className:"s-tail-sheet-block-head",children:[i.jsx("span",{className:"s-tail-glyph s-tail-glyph--tool",children:"*"}),i.jsx("span",{className:"s-tail-sheet-block-title",children:t.name??"tool_use"})]}),i.jsx("pre",{className:"s-tail-sheet-json",dangerouslySetInnerHTML:{__html:Vd(t.input??{})}})]})}if(e.type==="tool_result"){const t=e,n=typeof t.content=="string";return i.jsxs("div",{className:`s-tail-sheet-block s-tail-sheet-block--tool-result${t.is_error?" s-tail-sheet-block--err":""}`,children:[i.jsxs("div",{className:"s-tail-sheet-block-head",children:[i.jsx("span",{className:"s-tail-glyph s-tail-glyph--tool-result",children:"="}),i.jsxs("span",{className:"s-tail-sheet-block-title",children:["tool_result",t.is_error?" · error":""]})]}),n?i.jsx("pre",{className:"s-tail-sheet-pre",children:t.content}):i.jsx("pre",{className:"s-tail-sheet-json",dangerouslySetInnerHTML:{__html:Vd(t.content??{})}})]})}return i.jsxs("div",{className:"s-tail-sheet-block",children:[i.jsxs("div",{className:"s-tail-sheet-block-head",children:[i.jsx("span",{className:"s-tail-glyph s-tail-glyph--other",children:"·"}),i.jsx("span",{className:"s-tail-sheet-block-title",children:e.type})]}),i.jsx("pre",{className:"s-tail-sheet-json",dangerouslySetInnerHTML:{__html:Vd(e)}})]})}function BY(e){const t=Math.floor(e/3600).toString().padStart(2,"0"),n=Math.floor(e%3600/60).toString().padStart(2,"0"),a=(e%60).toString().padStart(2,"0");return`${t}:${n}:${a}`}function VY(e){return e.replace(/[._]/g," ")}function ug(e,t=56){const n=(e??"").replace(/\s+/g," ").trim();return n?n.length>t?`${n.slice(0,t-1)}…`:n:"live event"}function vN(e){return e.recordId?{view:"work",workId:e.recordId}:e.conversationId?{view:"conversation",conversationId:e.conversationId}:e.agentId?{view:"agents",agentId:e.agentId}:null}function yN(e){return e.conversationId?{view:"conversation",conversationId:e.conversationId}:e.collaborationRecordId?{view:"work",workId:e.collaborationRecordId}:{view:"agents",agentId:e.agentId}}function HY(e){return e.conversationId?{view:"conversation",conversationId:e.conversationId}:null}function FY(e,t,n=60){const a=new Array(n).fill(0),o=60*6e4,l=t-o;for(const f of e){if(f.ts<l||f.ts>t)continue;const m=f.ts-l,h=Math.min(n-1,Math.max(0,Math.floor(m/o*n)));a[h]+=1}const u=Math.max(1,...a);return{raw:a,normalized:a.map(f=>f/u)}}function ZY({navigate:e,agents:t}){const[n,a]=v.useState(null),[o,l]=v.useState([]),[u,f]=v.useState([]),[m,h]=v.useState(()=>Date.now()),p=v.useCallback(async()=>{const[P,_,z]=await Promise.allSettled([Ce("/api/fleet"),Ce("/api/activity"),Ce("/api/sessions")]);P.status==="fulfilled"&&a(P.value),_.status==="fulfilled"&&l(_.value),z.status==="fulfilled"&&f(z.value),h(Date.now())},[]);v.useEffect(()=>{p()},[p]),fn(()=>{p()}),v.useEffect(()=>{const P=setInterval(()=>h(Date.now()),1e3);return()=>clearInterval(P)},[]);const y=t.filter(P=>ft(P.state)!=="offline").length,b=n?.needsAttention??[],w=n?.activeAsks??[],j=u.length>0?u.length:new Set(o.map(P=>P.conversationId).filter(P=>!!P)).size,N=[...b.map(P=>P.updatedAt),...w.map(P=>P.updatedAt)].filter(P=>typeof P=="number"&&Number.isFinite(P)),C=N.length>0?Math.min(...N):null,k=C?Math.max(0,Math.floor((m-C)/1e3)):0,E=v.useMemo(()=>FY(o,m),[o,m]),S=E.raw.reduce((P,_)=>P+_,0),R=Math.max(0,...E.raw),A=E.raw[E.raw.length-1]??0,M=v.useMemo(()=>o.slice(0,8).map(P=>({key:P.id,agent:P.actorName??"system",tool:VY(P.kind),result:ug(P.title??P.summary),route:HY(P)})),[o]),D=v.useMemo(()=>{const P=[];for(const _ of b)P.push({key:_.recordId,label:_.title||"Unresolved item",route:vN(_),tone:_.kind==="question"?"high":"med"});for(const _ of w)(_.status==="failed"||_.status==="needs_attention")&&P.push({key:_.invocationId,label:_.summary??_.task,route:yN(_),tone:_.status==="failed"?"high":"med"});return P.slice(0,6)},[w,b]),U=b.length>0?b:[],F=U.length===0?w.slice(0,3):[];return i.jsxs("div",{className:"s-warroom",children:[i.jsxs("div",{className:"s-warroom-topstrip",children:[i.jsx("div",{className:"s-warroom-topstrip-left",children:i.jsx("span",{className:"s-ops-label",children:"▸ War Room"})}),i.jsxs("div",{className:"s-warroom-topstrip-center",children:["OPERATIONS · ",new Date(m).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})]}),i.jsxs("div",{className:"s-warroom-topstrip-right",children:[i.jsx(wd,{label:"Agents",value:`${y}/${t.length}`}),i.jsx(wd,{label:"Threads",value:String(j)}),i.jsx(wd,{label:"Attention",value:String(b.length),warn:b.length>0}),i.jsx(wd,{label:"Events/h",value:String(S)})]})]}),i.jsxs("div",{className:"s-warroom-grid",children:[i.jsxs("div",{className:"s-warroom-panel",children:[i.jsx("div",{className:"s-ops-label",style:{marginBottom:12},children:"◌ Asks · Awaiting"}),i.jsxs("div",{className:"s-warroom-breach",children:[i.jsx("div",{className:"s-warroom-breach-clock",children:BY(k)}),i.jsxs("div",{className:"s-warroom-breach-sub",children:["Oldest unresolved · ",b[0]?.agentName??w[0]?.agentName??"clear"]})]}),U.length>0?U.slice(0,3).map(P=>{const _=vN(P);return i.jsxs("button",{type:"button",className:"s-warroom-ask-card",style:{textAlign:"left",cursor:_?"pointer":"default"},onClick:_?()=>e(_):void 0,children:[i.jsxs("div",{className:"s-warroom-ask-header",children:[i.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:ct(P.agentName??"?")},children:(P.agentName??"?")[0]?.toUpperCase()}),i.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--muted)"},children:P.agentName??"unknown"})]}),i.jsx("div",{className:"s-warroom-ask-body",children:ug(P.title??P.summary,110)})]},P.recordId)}):F.length>0?F.map(P=>{const _=yN(P);return i.jsxs("button",{type:"button",className:"s-warroom-ask-card",style:{textAlign:"left",cursor:_?"pointer":"default"},onClick:_?()=>e(_):void 0,children:[i.jsxs("div",{className:"s-warroom-ask-header",children:[i.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:ct(P.agentName??P.agentId)},children:(P.agentName??P.agentId)[0]?.toUpperCase()}),i.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--muted)"},children:P.agentName??P.agentId})]}),i.jsx("div",{className:"s-warroom-ask-body",children:ug(P.summary??P.task,110)})]},P.invocationId)}):i.jsx("div",{className:"s-warroom-ask-card",style:{color:"var(--dim)"},children:"No unresolved asks right now."}),i.jsx("div",{className:"s-ops-label",style:{marginTop:16},children:"○ Blockers"}),i.jsx("div",{className:"s-warroom-blockers",children:D.length===0?i.jsx("div",{style:{color:"var(--dim)"},children:"No blockers"}):D.map(P=>i.jsxs("button",{type:"button",className:P.tone==="high"?"s-warroom-blockers-item--high":"s-warroom-blockers-item--med",style:{textAlign:"left",cursor:P.route?"pointer":"default"},onClick:P.route?()=>e(P.route):void 0,children:[P.tone==="high"?"▲":"•"," ",P.label]},P.key))})]}),i.jsxs("div",{className:"s-warroom-panel s-warroom-mesh",children:[i.jsx("div",{className:"s-warroom-mesh-label",children:i.jsx("span",{className:"s-ops-label",children:"◉ Mesh · Live"})}),i.jsx(WY,{agents:t})]}),i.jsxs("div",{className:"s-warroom-panel",style:{display:"flex",flexDirection:"column",gap:14},children:[i.jsx("div",{className:"s-ops-label",children:"›_ Live stream"}),i.jsx(qY,{items:M,navigate:e}),i.jsx("div",{className:"s-ops-label",children:"Fleet load"}),i.jsxs("div",{className:"s-warroom-burn-grid",children:[i.jsx(jd,{num:String(S),label:"events/h"}),i.jsx(jd,{num:String(w.length),label:"active asks"}),i.jsx(jd,{num:String(b.length),label:"waiting"}),i.jsx(jd,{num:String(y),label:"online"})]})]}),i.jsxs("div",{className:"s-warroom-waveform-panel",children:[i.jsxs("div",{className:"s-warroom-waveform-header",children:[i.jsx("span",{className:"s-ops-label",children:"⌇ Fleet activity · Last 60m"}),i.jsx("span",{className:"s-warroom-waveform-meta",children:"events/min · live"}),i.jsx("span",{style:{flex:1}}),i.jsxs("span",{className:"s-warroom-waveform-meta",children:["peak ",R," · now ",A]})]}),i.jsx(YY,{values:E.normalized})]})]})]})}function wd({label:e,value:t,warn:n}){return i.jsxs("div",{className:"s-warroom-telemetry",children:[i.jsx("div",{className:"s-warroom-telemetry-label",children:e}),i.jsx("div",{className:`s-warroom-telemetry-value${n?" s-warroom-telemetry-value--warn":""}`,children:t})]})}function qY({items:e,navigate:t}){return e.length===0?i.jsx("div",{className:"s-warroom-ticker",children:i.jsxs("div",{className:"s-warroom-ticker-line",style:{opacity:.5},children:[i.jsx("span",{className:"s-warroom-ticker-agent",children:"system"}),i.jsx("span",{className:"s-warroom-ticker-sep",children:"›"}),i.jsx("span",{className:"s-warroom-ticker-tool",children:"waiting"}),i.jsx("span",{className:"s-warroom-ticker-result",children:"no recent fleet activity"})]})}):i.jsx("div",{className:"s-warroom-ticker",children:e.map((n,a)=>i.jsxs("button",{type:"button",className:"s-warroom-ticker-line",style:{opacity:1-a*.06,textAlign:"left",cursor:n.route?"pointer":"default"},onClick:n.route?()=>t(n.route):void 0,children:[i.jsx("span",{className:"s-warroom-ticker-agent",children:n.agent}),i.jsx("span",{className:"s-warroom-ticker-sep",children:"›"}),i.jsx("span",{className:"s-warroom-ticker-tool",children:n.tool}),i.jsx("span",{className:"s-warroom-ticker-result",children:n.result})]},n.key))})}function jd({num:e,label:t}){return i.jsxs("div",{className:"s-warroom-burn-tile",children:[i.jsx("div",{className:"s-warroom-burn-num",children:e}),i.jsx("div",{className:"s-warroom-burn-label",children:t})]})}function WY({agents:e}){const a=v.useMemo(()=>{if(e.length===0)return{};const o=.5,l=.5,u=.3,f={};return e.forEach((m,h)=>{const p=h/e.length*Math.PI*2-Math.PI/2;f[m.id]={x:o+u*Math.cos(p),y:l+u*Math.sin(p)}}),f},[e]);return i.jsxs("svg",{viewBox:"0 0 800 480",preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:[i.jsxs("defs",{children:[i.jsx("pattern",{id:"warGrid",width:"40",height:"40",patternUnits:"userSpaceOnUse",children:i.jsx("path",{d:"M 40 0 L 0 0 0 40",fill:"none",stroke:"var(--border)",strokeWidth:"0.5",opacity:"0.4"})}),i.jsxs("radialGradient",{id:"warGlow",cx:"50%",cy:"50%",r:"50%",children:[i.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.1"}),i.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0"})]})]}),i.jsx("rect",{width:800,height:480,fill:"url(#warGrid)"}),i.jsx("circle",{cx:800/2,cy:480/2,r:200,fill:"url(#warGlow)"}),e.flatMap((o,l)=>e.slice(l+1).map(u=>{const f=a[o.id],m=a[u.id];return!f||!m?null:i.jsx("line",{x1:f.x*800,y1:f.y*480,x2:m.x*800,y2:m.y*480,stroke:"var(--dim)",strokeWidth:"0.8",opacity:"0.3"},`${o.id}-${u.id}`)})),e.map(o=>{const l=a[o.id];if(!l)return null;const u=l.x*800,f=l.y*480,m=ct(o.name),h=ft(o.state)==="working";return i.jsxs("g",{transform:`translate(${u}, ${f})`,children:[h&&i.jsxs("circle",{r:"18",fill:"none",stroke:m,strokeWidth:"1",opacity:"0.5",children:[i.jsx("animate",{attributeName:"r",values:"18;30;18",dur:"2.5s",repeatCount:"indefinite"}),i.jsx("animate",{attributeName:"opacity",values:"0.5;0;0.5",dur:"2.5s",repeatCount:"indefinite"})]}),i.jsx("circle",{r:"18",fill:m,stroke:"var(--bg)",strokeWidth:"2"}),i.jsx("text",{textAnchor:"middle",dy:"0.35em",fontFamily:"var(--font-mono)",fontSize:"14",fontWeight:"600",fill:"rgba(0,0,0,0.7)",children:o.name[0]?.toUpperCase()}),i.jsx("text",{textAnchor:"middle",y:36,fontFamily:"var(--font-mono)",fontSize:"10",fill:"var(--muted)",letterSpacing:"0.1em",children:o.name.toUpperCase()}),i.jsxs("text",{textAnchor:"middle",y:48,fontFamily:"var(--font-mono)",fontSize:"8.5",fill:"var(--dim)",letterSpacing:"0.08em",children:[ft(o.state).toUpperCase()," · ",o.project??"—"]})]},o.id)})]})}function YY({values:e}){const a=e.length>1?e:[0,0],o=a.map((l,u)=>`${u/(a.length-1)*1e3},${80-l*72-4}`).join(" ");return i.jsxs("svg",{viewBox:"0 0 1000 80",preserveAspectRatio:"none",style:{width:"100%",height:80,display:"block"},children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:"waveFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.35"}),i.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0"})]})}),i.jsx("polyline",{points:`0,80 ${o} 1000,80`,fill:"url(#waveFill)"}),i.jsx("polyline",{points:o,fill:"none",stroke:"var(--accent)",strokeWidth:"1.2"})]})}const GY=[{id:"mission",label:"Mission Control"},{id:"agents",label:"Agents"},{id:"plan",label:"Plan"},{id:"conductor",label:"Conductor"},{id:"warroom",label:"War Room"},{id:"tail",label:"Tail"},{id:"atop",label:"Atop"}];function KY({navigate:e,mode:t="mission"}){const{agents:n}=St();return i.jsxs("div",{className:"s-ops",children:[i.jsxs("div",{className:"s-ops-header",children:[i.jsx("span",{className:"s-ops-header-title",children:"Ops"}),i.jsx("div",{className:"s-ops-tabs",children:GY.map(a=>i.jsx("button",{className:`s-ops-tab${t===a.id?" s-ops-tab--active":""}`,onClick:()=>e({view:"ops",mode:a.id}),children:a.label},a.id))})]}),i.jsxs("div",{className:"s-ops-body",children:[t==="mission"&&i.jsx(pW,{navigate:e,agents:n}),t==="agents"&&i.jsx(DW,{navigate:e,agents:n}),t==="plan"&&i.jsx(FW,{navigate:e,agents:n}),t==="conductor"&&i.jsx(sW,{navigate:e,agents:n}),t==="warroom"&&i.jsx(ZY,{navigate:e,agents:n}),t==="tail"&&i.jsx(DY,{navigate:e}),t==="atop"&&i.jsx(gY,{})]})]})}function XY({agentId:e,navigate:t}){const{agents:n}=St(),a=e?n.find(f=>f.id===e):null,o=a?ct(a.name):"var(--accent)",l=Mv({url:TA(),healthUrl:AA(),autoConnect:!0,sessionKey:e?`scout-takeover-${e}`:"scout-takeover"}),u=()=>{t(e?{view:"agents",agentId:e}:{view:"inbox"})};return i.jsxs("div",{className:"s-term",children:[i.jsxs("div",{className:"s-term-bar",children:[i.jsx("button",{className:"s-term-back",onClick:u,children:"← Back"}),a&&i.jsxs("div",{className:"s-term-agent",children:[i.jsx("div",{className:"s-ops-avatar",style:{"--size":"18px",background:o},children:a.name[0]?.toUpperCase()}),i.jsx("span",{className:"s-term-agent-name",children:a.name}),a.handle&&i.jsxs("span",{className:"s-term-agent-handle",children:["@",a.handle]})]}),i.jsx("span",{className:"s-term-label",children:"TAKEOVER"}),i.jsxs("div",{className:"s-term-status",children:[i.jsx("span",{className:`s-term-dot${l.status==="connected"?" s-term-dot--live":l.status==="connecting"?" s-term-dot--connecting":""}`}),l.status==="connected"?"LIVE":l.status==="connecting"?"CONNECTING":"OFFLINE"]})]}),i.jsx("div",{className:"s-term-body",children:i.jsx(_v,{relay:l,fontSize:13,quiet:!0})})]})}function JY(e){return e.attention==="interrupt"?"failed":e.state==="done"?"completed":e.attention==="badge"||e.state==="waiting"||e.state==="review"?"updated":"working"}function dg(e){switch(e){case"review":return"In review";case"waiting":return"Waiting";case"working":return"Working";case"done":return"Done";default:return e.replace(/_/g," ")}}function QY(e){switch(e){case"badge":return"Needs attention";case"interrupt":return"Blocked";default:return null}}function eG(e){switch(e.kind){case"flight_started":return"flight started";case"flight_completed":return e.detailKind?`flight ${e.detailKind}`:"flight ended";case"message":return"message";default:return e.title??e.detailKind??"event"}}function xN(e){return e.kind==="message"?"message":e.kind==="flight_started"?"flight":e.kind==="flight_completed"?e.detailKind?.includes("fail")?"alert":"done":e.detailKind?.includes("interrupt")||e.detailKind?.includes("block")?"alert":"system"}function fg({title:e,items:t}){return t.length===0?null:i.jsxs("section",{className:"s-work-fact-card",children:[i.jsx("div",{className:"s-work-fact-card-header",children:i.jsx("div",{className:"s-work-fact-card-title",children:e})}),i.jsx("div",{className:"s-work-fact-card-body",children:t.map(n=>i.jsxs("div",{className:"s-work-fact-row",children:[i.jsx("span",{className:"s-work-fact-label",children:n.label}),i.jsx("span",{className:"s-work-fact-value",children:n.value})]},n.label))})]})}function bN({label:e,value:t,onClick:n}){return i.jsxs("button",{type:"button",className:"s-work-action-row",onClick:n,children:[i.jsx("span",{className:"s-work-action-row-label",children:e}),i.jsx("span",{className:"s-work-action-row-value",children:t})]})}function tG(e){const t=e.split(".");return t[t.length-1]||e}function nG({workId:e,navigate:t}){const[n,a]=v.useState(null),[o,l]=v.useState(null),[u,f]=v.useState(!1),m=v.useCallback(async()=>{l(null);try{const N=await Ce(`/api/work/${encodeURIComponent(e)}`);a(N)}catch(N){l(N instanceof Error?N.message:String(N)),a(null)}finally{f(!0)}},[e]);if(v.useEffect(()=>{f(!1),m()},[m]),fn(()=>{m()}),!u)return i.jsxs("div",{children:[i.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),i.jsx("div",{className:"s-empty",children:i.jsx("p",{children:"Loading…"})})]});if(!n)return i.jsxs("div",{children:[i.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),o&&i.jsx("p",{className:"s-error",children:o}),i.jsx("div",{className:"s-empty",children:i.jsx("p",{children:"Work item not found"})})]});const h=QY(n.attention),p=n.ownerName??n.ownerId??"Unassigned",y=n.nextMoveOwnerName??n.nextMoveOwnerId??"—",b=[{label:"State",value:dg(n.state)},{label:"Acceptance",value:n.acceptanceState.replace(/_/g," ")},{label:"Phase",value:n.currentPhase},...h?[{label:"Attention",value:h}]:[]],w=[{label:"Owner",value:p},{label:"Next move",value:y},...n.priority?[{label:"Priority",value:n.priority}]:[],{label:"Conversation",value:n.conversationId?"Attached":"None"}],j=[{label:"Case ID",value:n.id},{label:"Created",value:ai(n.createdAt)},{label:"Updated",value:ai(n.updatedAt)},{label:"Last activity",value:ai(n.lastMeaningfulAt)}];return i.jsxs("div",{className:"s-work-detail s-work-casefile",children:[i.jsxs("div",{className:"s-work-casefile-topbar",children:[i.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),i.jsxs("span",{className:"s-work-casefile-record",children:["Case ",tG(n.id)]})]}),o&&i.jsx("p",{className:"s-error",children:o}),i.jsx("section",{className:"s-work-casefile-hero",children:i.jsxs("div",{className:"s-work-casefile-hero-main",children:[i.jsxs("div",{className:"s-work-casefile-title-row",children:[i.jsx("h1",{className:"s-work-casefile-title",children:n.title}),i.jsx("span",{className:`s-pill s-pill-${JY(n)}`,children:n.currentPhase})]}),n.lastMeaningfulSummary&&i.jsx("div",{className:"s-work-casefile-summary",children:Es(n.lastMeaningfulSummary)}),i.jsxs("div",{className:"s-work-casefile-meta",children:[i.jsxs("span",{children:["Updated ",Pe(n.updatedAt)]}),i.jsx("span",{children:p}),i.jsx("span",{children:dg(n.state)}),h&&i.jsx("span",{children:h}),n.priority&&i.jsxs("span",{children:["Priority ",n.priority]})]})]})}),i.jsxs("div",{className:"s-work-casefile-layout",children:[i.jsxs("div",{className:"s-work-casefile-main",children:[i.jsxs("section",{className:"s-work-casefile-section",children:[i.jsx("div",{className:"s-agent-section-heading",children:i.jsx("h2",{className:"s-agent-section-title",children:"Case facts"})}),i.jsxs("div",{className:"s-work-fact-grid",children:[i.jsx(fg,{title:"Status",items:b}),i.jsx(fg,{title:"Assignment",items:w})]})]}),n.activeFlights.length>0&&i.jsxs("section",{className:"s-work-casefile-section",children:[i.jsx("div",{className:"s-agent-section-heading",children:i.jsx("h2",{className:"s-agent-section-title",children:"Flights"})}),i.jsx("div",{className:"s-work-flight-list",children:n.activeFlights.map(N=>i.jsxs("button",{type:"button",className:"s-work-flight-card",onClick:N.conversationId?()=>t({view:"conversation",conversationId:N.conversationId}):void 0,disabled:!N.conversationId,children:[i.jsxs("div",{className:"s-work-flight-card-header",children:[i.jsx("span",{className:"s-work-flight-card-title",children:N.agentName??N.agentId}),i.jsx("span",{className:"s-pill s-pill-working",children:N.state})]}),i.jsxs("div",{className:"s-work-flight-card-meta",children:[i.jsx("span",{children:N.startedAt?`Started ${Pe(N.startedAt)}`:"Start time unavailable"}),N.completedAt&&i.jsxs("span",{children:["Completed ",Pe(N.completedAt)]})]}),N.summary&&i.jsx("div",{className:"s-work-flight-card-copy",children:N.summary})]},N.id))})]}),n.childWork.length>0&&i.jsxs("section",{className:"s-work-casefile-section",children:[i.jsx("div",{className:"s-agent-section-heading",children:i.jsx("h2",{className:"s-agent-section-title",children:"Child work"})}),i.jsx("div",{className:"s-work-related-list",children:n.childWork.map(N=>i.jsxs("button",{type:"button",className:"s-work-related-card",onClick:()=>t({view:"work",workId:N.id}),children:[i.jsxs("div",{className:"s-work-related-card-header",children:[i.jsx("span",{className:"s-work-related-card-title",children:N.title}),i.jsx("span",{className:`s-pill s-pill-${N.attention==="interrupt"?"failed":"updated"}`,children:N.currentPhase})]}),i.jsxs("div",{className:"s-work-related-card-meta",children:[i.jsx("span",{children:N.ownerName??N.ownerId??"Unassigned"}),i.jsx("span",{children:dg(N.state)}),i.jsx("span",{children:Pe(N.lastMeaningfulAt)})]}),N.lastMeaningfulSummary&&i.jsx("div",{className:"s-work-related-card-copy",children:Es(N.lastMeaningfulSummary)})]},N.id))})]}),i.jsxs("section",{className:"s-work-casefile-section",children:[i.jsx("div",{className:"s-agent-section-heading",children:i.jsx("h2",{className:"s-agent-section-title",children:"Timeline"})}),n.timeline.length===0?i.jsxs("div",{className:"s-empty",children:[i.jsx("p",{children:"No activity yet."}),i.jsx("p",{children:"Timeline events will appear once the case receives messages or coordination updates."})]}):i.jsx("div",{className:"s-work-timeline",children:n.timeline.map(N=>i.jsxs("button",{type:"button",className:`s-work-timeline-entry${N.conversationId?" s-work-timeline-entry-clickable":""}`,onClick:N.conversationId?()=>t({view:"conversation",conversationId:N.conversationId}):void 0,disabled:!N.conversationId,children:[i.jsx("span",{className:`s-work-timeline-marker s-work-timeline-marker-${xN(N)}`}),i.jsxs("div",{className:"s-work-timeline-content",children:[i.jsxs("div",{className:"s-work-timeline-header",children:[i.jsx("span",{className:"s-work-timeline-time",children:Pe(N.at)}),i.jsx("span",{className:`s-work-timeline-kind s-work-timeline-kind-${xN(N)}`,children:eG(N)})]}),i.jsx("div",{className:"s-work-timeline-actor",children:N.actorName??"system"}),N.title&&i.jsx("div",{className:"s-work-timeline-title",children:N.title}),N.summary&&i.jsx("div",{className:"s-work-timeline-summary",children:Es(N.summary)}),i.jsx("div",{className:"s-work-timeline-stamp",children:ai(N.at)})]})]},N.id))})]})]}),i.jsxs("aside",{className:"s-work-casefile-side",children:[i.jsx(fg,{title:"Record",items:j}),i.jsxs("section",{className:"s-work-fact-card",children:[i.jsx("div",{className:"s-work-fact-card-header",children:i.jsx("div",{className:"s-work-fact-card-title",children:"Links"})}),i.jsxs("div",{className:"s-work-action-list",children:[n.conversationId?i.jsx(bN,{label:"Conversation",value:"Open thread",onClick:()=>t({view:"conversation",conversationId:n.conversationId})}):i.jsx("div",{className:"s-work-action-list-empty",children:"No conversation attached."}),n.parentId&&n.parentTitle?i.jsx(bN,{label:"Parent",value:n.parentTitle,onClick:()=>t({view:"work",workId:n.parentId})}):i.jsx("div",{className:"s-work-action-list-empty",children:"No parent work item."})]})]})]})]})]})}function sG(){const{route:e,navigate:t}=St();return i.jsx(aG,{children:rG(e,t)})}function aG({children:e}){return i.jsx("div",{style:{background:"var(--bg)",color:"var(--ink)",minHeight:"100%",height:"100%",display:"flex",flexDirection:"column"},children:e})}function rG(e,t){switch(e.view){case"conversation":return i.jsx(uv,{conversationId:e.conversationId,initialComposeMode:e.composeMode,navigate:t});case"agent-info":return i.jsx(wF,{conversationId:e.conversationId,navigate:t});case"settings":return i.jsx(Wq,{navigate:t});case"agents":return i.jsx(kZ,{navigate:t,selectedAgentId:e.agentId,conversationId:e.conversationId,tab:e.tab});case"fleet":return i.jsx(LZ,{navigate:t});case"sessions":return e.sessionId?i.jsx(uv,{conversationId:e.sessionId,navigate:t}):i.jsx(jq,{navigate:t});case"mesh":return i.jsx(cq,{navigate:t});case"activity":return i.jsx(vF,{navigate:t});case"ops":return i.jsx(KY,{navigate:t,mode:e.mode});case"terminal":return i.jsx(XY,{agentId:e.agentId,navigate:t});case"work":return i.jsx(nG,{workId:e.workId,navigate:t});default:return i.jsx(UZ,{navigate:t})}}function iG(){const{route:e,agents:t,navigate:n}=St();if(e.view!=="agents")return null;const a=e.agentId?t.find(o=>o.id===e.agentId)??null:null;if(!a){const o=t.filter(l=>gi(l.state)).length;return i.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[i.jsx(Xs,{label:"Total",value:`${t.length}`}),i.jsx(Xs,{label:"Working",value:`${o}`}),i.jsx(Xs,{label:"Available",value:`${t.length-o}`}),i.jsx("div",{className:"mt-2 text-[10px] font-mono uppercase tracking-[0.15em] leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:"Select an agent from the roster to see its context here."})]})}return i.jsx(oG,{agent:a,agents:t,navigate:n})}function oG({agent:e,agents:t,navigate:n}){const a=gi(e.state),[o,l]=v.useState(null),u=v.useCallback(async()=>{const f=await Ce("/api/fleet").catch(()=>null);f&&l(f)},[]);return v.useEffect(()=>{u()},[u]),fn(()=>{u()}),i.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[i.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--scout-chrome-border-soft)] pb-3",children:[i.jsxs("div",{className:"relative flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-[13px] font-mono text-[var(--scout-chrome-avatar-ink)]",style:{background:ct(e.name)},children:[e.name[0]?.toUpperCase()??"?",a&&i.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-[var(--hud-bg)]",style:{background:Oa(e.state),opacity:ft(e.state)==="working"?.85:.6}})]}),i.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[i.jsx("span",{className:"truncate text-[13px] text-[var(--scout-chrome-ink-strong)]",children:e.name}),e.handle&&i.jsxs("span",{className:"text-[10px] font-mono text-cyan-400/70",children:["@",e.handle]})]})]}),i.jsxs(yo,{label:"State",children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:Oa(e.state),opacity:a?1:.4}}),i.jsx("span",{className:"text-[12px] capitalize text-[var(--scout-chrome-ink)]",children:Vs(e.state)})]}),e.updatedAt&&i.jsxs("div",{className:"mt-1 text-[10px] font-mono text-[var(--scout-chrome-ink-faint)]",children:["Updated ",Pe(e.updatedAt)]})]}),i.jsx(yo,{label:"Presence",children:i.jsx(lG,{focusAgent:e,agents:t,navigate:n})}),o&&i.jsx(cG,{asks:o.activeAsks,agentId:e.id,navigate:n}),i.jsxs(yo,{label:"Identity",children:[i.jsx(Xs,{label:"Class",value:e.agentClass}),e.role&&i.jsx(Xs,{label:"Role",value:e.role}),e.harness&&i.jsx(Xs,{label:"Harness",value:e.harness}),e.transport&&i.jsx(Xs,{label:"Transport",value:e.transport})]}),(e.project||e.branch||e.cwd)&&i.jsxs(yo,{label:"Project",children:[e.project&&i.jsx(Xs,{label:"Name",value:e.project}),e.branch&&i.jsx(Xs,{label:"Branch",value:e.branch}),e.cwd&&i.jsx(Xs,{label:"Cwd",value:e.cwd})]}),e.capabilities.length>0&&i.jsx(yo,{label:`Capabilities · ${e.capabilities.length}`,children:i.jsx("div",{className:"flex flex-wrap gap-1",children:e.capabilities.map(f=>i.jsx("span",{className:"rounded-sm bg-[var(--scout-chrome-hover)] px-1.5 py-0.5 text-[10px] font-mono text-[var(--scout-chrome-ink-soft)]",children:f},f))})})]})}function lG({focusAgent:e,agents:t,navigate:n}){const m=t.filter(p=>p.id!==e.id).slice(0,8),h=v.useMemo(()=>{const p=[{agent:e,x:120,y:90,focused:!0}];return m.forEach((y,b)=>{const w=2*Math.PI*b/Math.max(m.length,1)-Math.PI/2;p.push({agent:y,x:120+68*Math.cos(w),y:90+68*Math.sin(w),focused:!1})}),p},[e,m,120,90,68]);return i.jsxs("svg",{viewBox:"0 0 240 180",className:"w-full block",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("defs",{children:i.jsxs("radialGradient",{id:"inspMeshGlow",cx:"50%",cy:"50%",r:"50%",children:[i.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.06"}),i.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0"})]})}),i.jsx("circle",{cx:120,cy:90,r:82,fill:"url(#inspMeshGlow)"}),i.jsx("circle",{cx:120,cy:90,r:68,fill:"none",stroke:"var(--border)",strokeDasharray:"2 4"}),h.slice(1).map((p,y)=>i.jsxs("g",{children:[i.jsx("line",{x1:120,y1:90,x2:p.x,y2:p.y,stroke:"var(--accent)",strokeWidth:1,opacity:.6}),i.jsx("circle",{r:2,fill:"var(--accent)",children:i.jsx("animateMotion",{dur:`${2+y*.3}s`,repeatCount:"indefinite",path:`M 120,90 L ${p.x},${p.y}`})})]},`e-${p.agent.id}`)),h.map(p=>{const y=ft(p.agent.state),b=y==="working"||y==="available",w=p.focused?14:9;return i.jsxs("g",{style:{cursor:"pointer"},onClick:()=>n({view:"agents",agentId:p.agent.id}),children:[b&&i.jsxs("circle",{cx:p.x,cy:p.y,r:w+5,fill:"none",stroke:ct(p.agent.name),strokeWidth:.8,opacity:.3,children:[i.jsx("animate",{attributeName:"r",values:`${w};${w+8};${w}`,dur:"2.5s",repeatCount:"indefinite"}),i.jsx("animate",{attributeName:"opacity",values:"0.3;0;0.3",dur:"2.5s",repeatCount:"indefinite"})]}),i.jsx("circle",{cx:p.x,cy:p.y,r:w,fill:ct(p.agent.name),stroke:p.focused?"var(--accent)":"var(--surface)",strokeWidth:p.focused?1.5:1}),i.jsx("text",{x:p.x,y:p.y,dy:"0.35em",textAnchor:"middle",fontFamily:"var(--font-mono)",fontSize:p.focused?10:8,fontWeight:600,fill:"var(--scout-chrome-avatar-ink)",children:p.agent.name[0].toUpperCase()}),i.jsx("text",{x:p.x,y:p.y+w+10,textAnchor:"middle",fontFamily:"var(--font-mono)",fontSize:8,fill:"var(--dim)",letterSpacing:"0.04em",children:p.agent.name.length>9?p.agent.name.slice(0,8)+"...":p.agent.name})]},p.agent.id)})]})}function cG({asks:e,agentId:t,navigate:n}){const a=e.filter(o=>o.agentId===t&&(o.status==="needs_attention"||o.status==="queued"));return a.length===0?null:i.jsx(yo,{label:`Incoming asks · ${a.length}`,children:i.jsx("div",{className:"flex flex-col gap-2",children:a.map(o=>i.jsxs("div",{className:"p-2.5 rounded-md border border-amber-500/30 bg-amber-500/[0.04] cursor-pointer hover:bg-amber-500/[0.08] transition-colors",onClick:()=>{o.conversationId&&n({view:"agents",agentId:t,conversationId:o.conversationId})},children:[i.jsx("div",{className:"text-[9px] font-mono uppercase tracking-[0.12em] text-amber-500/80 mb-1",children:"awaiting"}),i.jsx("div",{className:"line-clamp-2 text-[11px] leading-relaxed text-[var(--scout-chrome-ink)]",children:o.summary??o.task}),i.jsxs("div",{className:"mt-1.5 text-[9px] font-mono text-[var(--scout-chrome-ink-ghost)]",children:[o.harness??"operator"," → ",o.agentName??"agent"]})]},o.invocationId))})})}function yo({label:e,children:t}){return i.jsxs("div",{className:"flex flex-col",children:[i.jsx("div",{className:"mb-1.5 text-[9px] font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:e}),t]})}function Xs({label:e,value:t}){return i.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[i.jsx("span",{className:"shrink-0 text-[10px] font-mono uppercase tracking-wider text-[var(--scout-chrome-ink-faint)]",children:e}),i.jsx("span",{className:"truncate text-[11px] font-mono text-[var(--scout-chrome-ink)]",children:t})]})}function uG(){const[e,t]=v.useState(null),n=v.useCallback(async()=>{try{t(await Ce("/api/fleet"))}catch{}},[]);if(v.useEffect(()=>{n()},[n]),fn(()=>{n()}),!e)return i.jsx("div",{className:"flex h-full items-center justify-center text-[11px] font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-ghost)]",children:"Loading fleet…"});const a=e.totals;return i.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[i.jsxs("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:["Updated ",Pe(e.generatedAt)]}),i.jsx(Sd,{label:"Needs Input",value:a.needsAttention,emphasis:a.needsAttention>0?"warn":"muted"}),i.jsx(Sd,{label:"Active Asks",value:a.active}),i.jsx(Sd,{label:"Recent Finished",value:a.recentCompleted,emphasis:a.recentCompleted>0?"good":"muted"}),i.jsx(Sd,{label:"Activity",value:a.activity})]})}function Sd({label:e,value:t,emphasis:n}){const a=n==="good"?"text-emerald-300/90":n==="warn"?"text-amber-300/90":n==="muted"?"text-[var(--scout-chrome-ink-faint)]":"text-[var(--scout-chrome-ink)]";return i.jsxs("div",{className:"flex flex-col border-b border-[var(--scout-chrome-border-soft)] pb-3 last:border-b-0",children:[i.jsx("span",{className:`text-[24px] font-mono tabular-nums leading-none ${a}`,children:t}),i.jsx("span",{className:"mt-1 text-[9px] font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:e})]})}function dG(){const{agents:e,navigate:t}=St();if(e.length===0)return i.jsxs("div",{className:"flex h-full flex-col items-center justify-center px-4 text-center font-mono text-[11px] leading-relaxed text-[var(--scout-chrome-ink-faint)]",children:[i.jsx("div",{className:"mb-1 uppercase tracking-[0.15em]",children:"No agents"}),i.jsx("div",{children:"Connect an agent to see your roster here."})]});const n=e.filter(o=>gi(o.state)),a=e.filter(o=>!gi(o.state));return i.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[n.length>0&&i.jsx(wN,{label:"Online",count:n.length,children:n.map(o=>i.jsx(jN,{agent:o,navigate:t},o.id))}),a.length>0&&i.jsx(wN,{label:"Standby",count:a.length,children:a.map(o=>i.jsx(jN,{agent:o,navigate:t,dim:!0},o.id))})]})}function wN({label:e,count:t,children:n}){return i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("div",{className:"flex items-baseline justify-between mb-1.5",children:[i.jsx("span",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:e}),i.jsx("span",{className:"text-[9px] font-mono tabular-nums text-[var(--scout-chrome-ink-ghost)]",children:t})]}),i.jsx("div",{className:"flex flex-col gap-0.5",children:n})]})}function jN({agent:e,navigate:t,dim:n}){const a=gi(e.state);return i.jsxs("button",{onClick:()=>t({view:"agents",agentId:e.id}),className:`group flex items-center gap-2.5 px-2 py-1.5 rounded-sm text-left transition-colors ${n?"opacity-60 hover:opacity-100 hover:bg-[var(--scout-chrome-hover)]":"hover:bg-[var(--scout-chrome-hover)]"}`,children:[i.jsxs("div",{className:"relative h-6 w-6 shrink-0 rounded-full text-[10px] font-mono flex items-center justify-center text-[var(--scout-chrome-avatar-ink)]",style:{background:ct(e.name)},children:[e.name[0]?.toUpperCase()??"?",a&&i.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 h-2 w-2 rounded-full bg-emerald-400 ring-2 ring-[var(--hud-bg)]"})]}),i.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[i.jsx("span",{className:"truncate text-[12px] text-[var(--scout-chrome-ink)] transition-colors group-hover:text-[var(--scout-chrome-ink-strong)]",children:e.name}),i.jsx("span",{className:"truncate text-[10px] font-mono text-[var(--scout-chrome-ink-faint)]",children:Vs(e.state)})]}),e.updatedAt&&i.jsx("span",{className:"shrink-0 text-[9px] font-mono tabular-nums text-[var(--scout-chrome-ink-ghost)]",children:Pe(e.updatedAt)})]})}function fG(){const{route:e}=St(),[t,n]=v.useState([]),a=v.useCallback(async()=>{try{n(await Ce("/api/sessions"))}catch{}},[]);if(v.useEffect(()=>{a()},[a]),fn(()=>{a()}),e.view!=="sessions")return null;const o=e.sessionId?t.find(l=>l.id===e.sessionId)??null:null;if(!o){const l=new Set(t.map(f=>f.kind)),u=t.filter(f=>f.currentBranch).length;return i.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[i.jsx(Ws,{label:"Total",value:`${t.length}`}),i.jsx(Ws,{label:"Kinds",value:`${l.size}`}),i.jsx(Ws,{label:"Branched",value:`${u}`}),i.jsx("div",{className:"mt-2 text-[10px] font-mono uppercase tracking-[0.15em] leading-relaxed text-[var(--scout-chrome-ink-ghost)]",children:"Select a session from the list to see its context here."})]})}return i.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[i.jsxs("div",{className:"border-b border-[var(--scout-chrome-border-soft)] pb-3",children:[i.jsx("div",{className:"text-[13px] leading-snug text-[var(--scout-chrome-ink-strong)]",children:o.title}),i.jsx("div",{className:"text-[10px] font-mono uppercase tracking-wider text-cyan-400/70 mt-1",children:o.kind})]}),o.agentName&&i.jsxs(Nd,{label:"Agent",children:[i.jsx(Ws,{label:"Name",value:o.agentName}),o.harness&&i.jsx(Ws,{label:"Harness",value:o.harness})]}),(o.currentBranch||o.workspaceRoot)&&i.jsxs(Nd,{label:"Workspace",children:[o.currentBranch&&i.jsx(Ws,{label:"Branch",value:o.currentBranch}),o.workspaceRoot&&i.jsx(Ws,{label:"Root",value:o.workspaceRoot})]}),i.jsxs(Nd,{label:"Activity",children:[i.jsx(Ws,{label:"Messages",value:`${o.messageCount}`}),o.lastMessageAt&&i.jsx(Ws,{label:"Last",value:Pe(o.lastMessageAt)}),o.participantIds.length>0&&i.jsx(Ws,{label:"Participants",value:`${o.participantIds.length}`})]}),o.preview&&i.jsx(Nd,{label:"Preview",children:i.jsxs("div",{className:"text-[11px] italic leading-relaxed text-[var(--scout-chrome-ink-soft)]",children:['"',o.preview,'"']})})]})}function Nd({label:e,children:t}){return i.jsxs("div",{className:"flex flex-col",children:[i.jsx("div",{className:"mb-1.5 text-[9px] font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:e}),t]})}function Ws({label:e,value:t}){return i.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[i.jsx("span",{className:"shrink-0 text-[10px] font-mono uppercase tracking-wider text-[var(--scout-chrome-ink-faint)]",children:e}),i.jsx("span",{className:"truncate text-[11px] font-mono text-[var(--scout-chrome-ink)]",children:t})]})}function hG(){const{route:e}=St(),t=e.view==="work"?e.workId:null,[n,a]=v.useState(null),o=v.useCallback(async()=>{if(!t){a(null);return}try{a(await Ce(`/api/work/${encodeURIComponent(t)}`))}catch{a(null)}},[t]);if(v.useEffect(()=>{o()},[o]),fn(()=>{t&&o()}),e.view!=="work")return null;if(!n)return i.jsx("div",{className:"flex h-full items-center justify-center px-4 text-center text-[11px] font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-ghost)]",children:"Loading work item…"});const l=pG(n.state);return i.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[i.jsxs("div",{className:"border-b border-[var(--scout-chrome-border-soft)] pb-3",children:[i.jsxs("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-cyan-400/70 mb-1",children:["Case ",mG(n.id)]}),i.jsx("div",{className:"text-[13px] leading-snug text-[var(--scout-chrome-ink-strong)]",children:n.title})]}),i.jsxs(kd,{label:"State",children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),i.jsx("span",{className:`text-[12px] capitalize ${l.text}`,children:n.state.replace(/_/g," ")})]}),i.jsxs("div",{className:"mt-1 text-[10px] font-mono text-[var(--scout-chrome-ink-faint)]",children:["Phase · ",n.currentPhase]})]}),i.jsxs(kd,{label:"Ownership",children:[n.ownerName&&i.jsx(uo,{label:"Owner",value:n.ownerName}),n.nextMoveOwnerName&&i.jsx(uo,{label:"Next move",value:n.nextMoveOwnerName}),n.priority&&i.jsx(uo,{label:"Priority",value:n.priority})]}),i.jsxs(kd,{label:"Activity",children:[i.jsx(uo,{label:"Children",value:`${n.activeChildWorkCount}`}),i.jsx(uo,{label:"Flights",value:`${n.activeFlightCount}`}),n.lastMeaningfulAt&&i.jsx(uo,{label:"Last update",value:Pe(n.lastMeaningfulAt)})]}),n.attention!=="silent"&&i.jsx("div",{className:`text-[10px] font-mono uppercase tracking-wider px-2 py-1 rounded-sm ${n.attention==="interrupt"?"text-red-300/90 bg-red-500/10 border border-red-500/20":"text-amber-300/90 bg-amber-500/10 border border-amber-500/20"}`,children:n.attention==="interrupt"?"Interrupt":"Needs attention"}),n.lastMeaningfulSummary&&i.jsx(kd,{label:"Latest",children:i.jsx("div",{className:"text-[11px] italic leading-relaxed text-[var(--scout-chrome-ink-soft)]",children:n.lastMeaningfulSummary})})]})}function mG(e){return e.length>10?`${e.slice(0,8)}…`:e}function pG(e){return/complete|done|finished/i.test(e)?{dot:"bg-emerald-400",text:"text-emerald-300/90"}:/fail|error/i.test(e)?{dot:"bg-red-400",text:"text-red-300/90"}:/block|wait|pause/i.test(e)?{dot:"bg-amber-400",text:"text-amber-300/90"}:/active|working|in[_-]?progress/i.test(e)?{dot:"bg-cyan-400",text:"text-cyan-300/90"}:{dot:"bg-[var(--scout-chrome-ink-faint)]",text:"text-[var(--scout-chrome-ink)]"}}function kd({label:e,children:t}){return i.jsxs("div",{className:"flex flex-col",children:[i.jsx("div",{className:"mb-1.5 text-[9px] font-mono uppercase tracking-[0.15em] text-[var(--scout-chrome-ink-faint)]",children:e}),t]})}function uo({label:e,value:t}){return i.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[i.jsx("span",{className:"shrink-0 text-[10px] font-mono uppercase tracking-wider text-[var(--scout-chrome-ink-faint)]",children:e}),i.jsx("span",{className:"truncate text-[11px] font-mono text-[var(--scout-chrome-ink)]",children:t})]})}const gG="http://127.0.0.1:43115";class SN{constructor(t=gG){this.baseUrl=t}baseUrl;state="unknown";get connectionState(){return this.state}async probe(t=1200){this.state="probing";const n=new AbortController,a=window.setTimeout(()=>n.abort(),t);try{const o=await fetch(`${this.baseUrl}/health`,{signal:n.signal}),l=await o.json().catch(()=>null);return this.state=o.ok&&l?.ok?"connected":"unavailable",this.state==="connected"}catch{return this.state="unavailable",!1}finally{window.clearTimeout(a)}}launch(){window.location.href="vox://launch"}openSettings(){window.location.href="vox://settings"}async startLive(t={}){let n=null,a=null;const o=new AbortController,l=(async()=>{const u=await fetch(`${this.baseUrl}/live`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({clientId:"openscout-web",modelId:"parakeet:v3"}),signal:o.signal});if(!u.ok)throw new Error(await u.text().catch(()=>`Vox returned HTTP ${u.status}`));if(!u.body)throw new Error("Vox live session did not return a stream.");const f=u.body.getReader(),m=new TextDecoder;let h="";for(;;){const{done:p,value:y}=await f.read();if(p)break;h+=m.decode(y,{stream:!0});const b=h.split(/\r?\n/);h=b.pop()??"";for(const w of b){const j=yG(w);if(j){if(typeof j.error=="string"&&j.error)throw new Error(j.error);if(typeof j.event=="string"){const N=xG(j.data),C=kf(N.sessionId);C&&(n=C),j.event==="session.state"&&t.onState?.(bG(N.state)),j.event==="session.partial"&&t.onPartial?.(kf(N.text)),j.event==="session.final"&&(a=NN(N,n),t.onFinal?.(a));continue}j.result&&typeof j.result=="object"&&(a=NN(j.result,n))}}}if(!a)throw new Error("Vox live session ended without a transcript.");return a})();return{get sessionId(){return n},result:l,stop:async()=>{await fetch(`${this.baseUrl}/live/stop`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n?{sessionId:n}:{})})},cancel:async()=>{o.abort(),await fetch(`${this.baseUrl}/live/cancel`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n?{sessionId:n}:{})}).catch(()=>{})}}}}async function vG(e){const t=await fetch("/api/voice/speak",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:e})});if(!t.ok){const o=await t.text().catch(()=>"");try{const l=JSON.parse(o);throw new Error(l.error??`Voice returned HTTP ${t.status}`)}catch(l){throw l instanceof SyntaxError?new Error(o||`Voice returned HTTP ${t.status}`):l}}const n=await t.json();return await new Audio(`data:${n.contentType};base64,${n.audioBase64}`).play(),n}function yG(e){const t=e.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}function xG(e){return e&&typeof e=="object"?e:{}}function kf(e){return typeof e=="string"?e:e==null?"":String(e)}function bG(e){switch(e){case"starting":case"recording":case"processing":case"done":case"cancelled":case"error":return e;default:return"error"}}function NN(e,t){return{sessionId:kf(e.sessionId)||t||"",text:kf(e.text).trim(),durationMs:Number(e.durationMs??e.elapsedMs??0)}}const wG="What's the state of things? Give me a terse ops summary, the biggest risk, and the next action you recommend.";function jG(){const{agents:e,navigate:t,rangerAgentId:n,rangerConversationId:a,applyRangerUiAction:o}=St(),l=v.useMemo(()=>e.find($=>$.id===n)??e.find(gA)??null,[e,n]),[u,f]=v.useState(""),[m,h]=v.useState(!1),[p,y]=v.useState(null),[b,w]=v.useState(null),[j,N]=SG("openscout.ranger.voiceReplies",!1),[C,k]=v.useState(!1),[E,S]=v.useState(null),[R,A]=v.useState(""),[M,D]=v.useState(!1),U=v.useRef(null),F=v.useRef(null),P=v.useRef(j);P.current=j,v.useEffect(()=>{const $=new SN;U.current=$,$.probe().then(w)},[]);const _=v.useCallback(($="ask")=>{t({view:"conversation",conversationId:a,...$==="ask"?{composeMode:"ask"}:{}})},[t,a]),z=v.useCallback(async $=>{const G=$.trim();if(!(!G||m)){h(!0),y(null);try{const X=await Ce("/api/ask",{method:"POST",body:JSON.stringify({body:G,conversationId:a})});f(""),t({view:"conversation",conversationId:X.conversationId??a,composeMode:"ask"})}catch(X){y(X instanceof Error?X.message:"Could not ask Ranger.")}finally{h(!1)}}},[t,a,m]),B=v.useCallback(async()=>{if(C)return;const $=U.current??new SN;if(U.current=$,y(null),A(""),S("starting"),b!==!0){const G=await $.probe();if(w(G),!G){S(null),y("Vox Companion is not reachable.");return}}try{const G=await $.startLive({onState:S,onPartial:A});F.current=G,k(!0);const X=await G.result;k(!1),F.current=null,A(""),S("done"),X.text&&await z(X.text)}catch(G){k(!1),F.current=null,S("error"),y(G instanceof Error?G.message:"Vox recording failed.")}},[z,C,b]),V=v.useCallback(async()=>{S("processing"),await F.current?.stop()},[]),K=v.useCallback(async()=>{await F.current?.cancel(),F.current=null,k(!1),A(""),S(null)},[]);fn($=>{if(!P.current||$.kind!=="message.posted")return;const G=$.payload&&typeof $.payload=="object"?$.payload.message:null;if(!G||typeof G!="object")return;const X=G;typeof X.actorId!="string"||!vA(X.actorId,n)||typeof X.body!="string"||!X.body.trim()||(D(!0),vG(X.body).catch(O=>y(O instanceof Error?O.message:"Vox speech failed.")).finally(()=>D(!1)))});const L=C?E==="processing"?"Processing":"Listening":b===!1?"Launch Vox":"Talk",H=l?l.state??"registered":"default target";return i.jsxs("section",{className:"flex flex-col gap-3 border-b border-[var(--scout-chrome-border-soft)] p-4",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Z2,{size:14,className:"text-lime-300"}),i.jsx("h2",{className:"font-mono text-[10px] font-bold uppercase tracking-[0.18em] text-[var(--scout-chrome-ink-strong)]",children:"Ranger"})]}),i.jsxs("p",{className:"mt-1 truncate font-mono text-[10px] text-[var(--scout-chrome-ink-faint)]",children:[l?.name??n," · ",H]})]}),i.jsx("button",{type:"button",onClick:()=>_("ask"),className:"rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1 font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--scout-chrome-ink)] hover:bg-[var(--scout-chrome-hover)]",children:"Open"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Ed,{icon:i.jsx(r_,{size:13}),label:"State",onClick:()=>{z(wG)},disabled:m}),i.jsx(Ed,{icon:i.jsx(Q2,{size:13}),label:"Ops Tail",onClick:()=>o({type:"navigate",route:{view:"ops",mode:"tail"}})}),i.jsx(Ed,{icon:i.jsx(_N,{size:13}),label:"Fleet",onClick:()=>o({type:"navigate",route:{view:"fleet"}})}),i.jsx(Ed,{icon:j?i.jsx(p_,{size:13}):i.jsx(v_,{size:13}),label:j?"Replies On":"Replies Off",onClick:()=>N(!j)})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>{if(b===!1){U.current?.launch();return}C?V():B()},className:`flex flex-1 items-center justify-center gap-2 rounded border px-2.5 py-2 font-mono text-[10px] uppercase tracking-[0.12em] transition-colors ${C?"border-lime-300/50 bg-lime-300/10 text-lime-200":"border-[var(--scout-chrome-border-soft)] text-[var(--scout-chrome-ink)] hover:bg-[var(--scout-chrome-hover)]"}`,disabled:m||E==="processing",children:[E==="processing"?i.jsx(Lw,{size:13,className:"animate-spin"}):C?i.jsx(t_,{size:13}):i.jsx(s_,{size:13}),L]}),C&&i.jsx("button",{type:"button",onClick:()=>{K()},className:"rounded border border-[var(--scout-chrome-border-soft)] px-2.5 py-2 font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--scout-chrome-ink-faint)] hover:bg-[var(--scout-chrome-hover)]",children:"Cancel"})]}),(R||M)&&i.jsx("div",{className:"rounded border border-[var(--scout-chrome-border-soft)] bg-black/10 px-2.5 py-2 font-mono text-[10px] leading-relaxed text-[var(--scout-chrome-ink-faint)]",children:M?"Speaking Ranger reply…":R}),i.jsxs("form",{className:"flex flex-col gap-2",onSubmit:$=>{$.preventDefault(),z(u)},children:[i.jsx("textarea",{value:u,onChange:$=>f($.target.value),placeholder:"Ask Ranger to inspect state or move the UI…",rows:3,className:"w-full resize-none rounded border border-[var(--scout-chrome-border-soft)] bg-black/10 px-2.5 py-2 font-mono text-[11px] leading-relaxed text-[var(--scout-chrome-ink)] placeholder:text-[var(--scout-chrome-ink-ghost)]"}),i.jsxs("button",{type:"submit",disabled:!u.trim()||m,className:"flex items-center justify-center gap-2 rounded bg-lime-300/90 px-2.5 py-2 font-mono text-[10px] font-bold uppercase tracking-[0.12em] text-black transition-opacity disabled:cursor-not-allowed disabled:opacity-40",children:[m&&i.jsx(Lw,{size:13,className:"animate-spin"}),"Ask Ranger"]})]}),p&&i.jsx("div",{className:"rounded border border-red-400/30 bg-red-400/10 px-2.5 py-2 font-mono text-[10px] leading-relaxed text-red-200",children:p})]})}function Ed({icon:e,label:t,onClick:n,disabled:a}){return i.jsxs("button",{type:"button",onClick:n,disabled:a,className:"flex items-center justify-center gap-1.5 rounded border border-[var(--scout-chrome-border-soft)] px-2 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--scout-chrome-ink)] transition-colors hover:bg-[var(--scout-chrome-hover)] disabled:cursor-not-allowed disabled:opacity-45",children:[e,t]})}function SG(e,t){const[n,a]=v.useState(()=>{try{const l=window.localStorage.getItem(e);return l===null?t:l==="true"}catch{return t}}),o=v.useCallback(l=>{a(l);try{window.localStorage.setItem(e,l?"true":"false")}catch{}},[e]);return[n,o]}function NG(){const{route:e}=St();let t=null;switch(e.view){case"inbox":t=i.jsx(dG,{});break;case"agents":case"agent-info":t=i.jsx(iG,{});break;case"fleet":t=i.jsx(uG,{});break;case"sessions":case"conversation":t=i.jsx(fG,{});break;case"work":t=i.jsx(hG,{});break;case"ops":t=null;break;default:t=null}return i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsx(jG,{}),i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t})]})}function kG(){const{openSettings:e}=St();return i.jsx(I7,{onOpen:e})}const fo={working:0,available:1,offline:2};function EG(e){return e.project?e.project.toLowerCase():"other"}function CG(e){const t=new Map;for(const a of e){const o=EG(a),l=t.get(o);l?l.push(a):t.set(o,[a])}const n=[];for(const[a,o]of t){o.sort((f,m)=>{const h=(fo[ft(f.state)]??9)-(fo[ft(m.state)]??9);return h!==0?h:(m.updatedAt??0)-(f.updatedAt??0)});const l=o.reduce((f,m)=>{const h=ft(m.state);return(fo[h]??9)<(fo[f]??9)?h:f},"offline"),u=Math.max(...o.map(f=>f.updatedAt??0));n.push({key:a,label:a,agents:o,bestState:l,latestUpdate:u})}return n.sort((a,o)=>{const l=(fo[a.bestState]??9)-(fo[o.bestState]??9);return l!==0?l:o.latestUpdate-a.latestUpdate}),n}function TG(e){return e.trim().toLowerCase()}function AG(e){return[e.id,e.name,e.handle??"",e.selector??"",e.project??"",e.branch??"",e.role??"",e.harness??"",e.harnessSessionId??"",e.conversationId,e.harnessLogPath??""]}function MG(e,t){return t?AG(e).some(n=>n.toLowerCase().includes(t)):!0}function ho(e,t){return t?[e.harnessSessionId,e.conversationId].find(a=>a?.toLowerCase().includes(t))??null:null}function hg(e,t,n={}){e({view:"agents",agentId:t.id,...n.observe?{conversationId:t.conversationId,tab:"observe"}:{}})}function RG(){const{agents:e,route:t,navigate:n}=St(),[a,o]=v.useState(()=>new Set),[l,u]=v.useState(""),f=TG(l),m=f.length>0,h=v.useMemo(()=>e.filter(j=>MG(j,f)),[e,f]),p=v.useMemo(()=>CG(h),[h]),y=h[0]??null,b=t.view==="agents"?t.agentId:void 0,w=j=>{o(N=>{const C=new Set(N);return C.has(j)?C.delete(j):C.add(j),C})};return i.jsxs("div",{className:"s-left-roster",children:[i.jsx("div",{className:"s-left-roster-search s-search",children:i.jsx("input",{type:"text",className:"s-search-input",placeholder:"Search agents or session IDs…",value:l,onChange:j=>u(j.target.value),onKeyDown:j=>{j.key==="Escape"&&(l?u(""):j.target.blur()),j.key==="Enter"&&y&&hg(n,y,{observe:!!ho(y,f)})}})}),i.jsx("div",{style:{flex:1,overflow:"auto"},children:e.length===0?i.jsx("div",{className:"s-left-roster-empty",children:"No agents registered"}):h.length===0?i.jsx("div",{className:"s-left-roster-empty",children:"No agents match this session or agent search."}):p.map(j=>{const N=j.agents.length===1,C=m||a.has(j.key),k=N?j.agents[0]:null,E=j.agents.some(R=>R.id===b),S=k?ho(k,f):null;return i.jsxs("div",{className:"s-left-roster-parent",children:[i.jsxs("button",{className:`s-left-roster-row${E&&(N||!C)?" s-left-roster-row--active":""}`,onClick:()=>{N?hg(n,k,{observe:!!S}):w(j.key)},children:[i.jsxs("span",{className:"s-left-roster-avatar-wrap",children:[i.jsx("span",{className:"s-left-roster-avatar",style:{background:ct(j.label)},children:j.label[0].toUpperCase()}),i.jsx("span",{className:`s-left-roster-dot s-left-roster-dot--${j.bestState}`,style:{background:Oa(j.bestState==="working"?"working":j.bestState==="available"?"available":null)}})]}),i.jsxs("span",{className:"s-left-roster-body",children:[i.jsx("span",{className:"s-left-roster-name",children:j.label}),N&&S?i.jsxs("span",{className:"s-left-roster-sub",title:S,children:["session · ",S]}):N&&(k.project||k.branch)&&i.jsxs("span",{className:"s-left-roster-sub",children:[k.name,k.branch?` · ${k.branch}`:""]}),!N&&!C&&i.jsxs("span",{className:"s-left-roster-sub",children:[j.agents.length," agents"]})]}),!N&&i.jsx("span",{className:"s-left-roster-ct",children:C?"▾":"▸"}),N&&k.updatedAt&&i.jsx("span",{className:"s-left-roster-time",children:Pe(k.updatedAt)})]}),!N&&C&&i.jsx("div",{className:"s-left-roster-instances",children:j.agents.map(R=>i.jsxs("button",{className:`s-left-roster-instance${R.id===b?" s-left-roster-instance--active":""}`,onClick:()=>hg(n,R,{observe:!!ho(R,f)}),title:ho(R,f)??void 0,children:[i.jsx("span",{className:`s-left-roster-instance-dot s-left-roster-dot--${ft(R.state)}`,style:{background:Oa(R.state)}}),i.jsxs("span",{className:"s-left-roster-instance-label",children:[R.name,R.branch?` · ${R.branch}`:"",ho(R,f)?` · ${ho(R,f)}`:""]}),R.updatedAt&&i.jsx("span",{className:"s-left-roster-time",children:Pe(R.updatedAt)})]},R.id))})]},j.key)})})]})}function _G(){const e=Mv({url:TA(),healthUrl:AA(),autoConnect:!0,sessionKey:"scout-terminal"});return i.jsx("div",{style:{height:"100%",background:"#0d0d0d",overflow:"hidden"},children:i.jsx(_v,{relay:e,fontSize:13})})}function OG(){const{onboarding:e}=St();return e?e.hasLocalConfig?e.hasOperatorName?e.hasProjectConfig?null:i.jsx(mg,{children:i.jsx(zG,{})}):i.jsx(mg,{children:i.jsx(DG,{})}):i.jsx(mg,{children:i.jsx(IG,{})}):null}function mg({children:e}){return i.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto",background:"var(--bg)",color:"var(--ink)"},children:i.jsx("div",{style:{width:"100%",maxWidth:720,padding:"80px 72px",display:"flex",flexDirection:"column",gap:40},children:e})})}function Iy({eyebrow:e,title:t,description:n}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[i.jsx("div",{style:PG,children:e}),i.jsx("div",{style:LG,children:t}),i.jsx("div",{style:$G,children:n})]})}function Dy({primary:e,onPrimary:t,primaryDisabled:n,busy:a}){const{skipOnboarding:o}=St();return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24,paddingTop:8},children:[i.jsx("button",{type:"button",onClick:t,disabled:n||a,style:{...BG,opacity:n||a?.5:1,cursor:n||a?"default":"pointer"},children:a?"Working…":e}),i.jsx("button",{type:"button",onClick:o,style:VG,onMouseEnter:l=>{l.currentTarget.style.color="rgba(255,255,255,0.8)"},onMouseLeave:l=>{l.currentTarget.style.color="rgba(255,255,255,0.45)"},children:"Skip for now"})]})}function zy({message:e}){return e?i.jsx("div",{style:{borderRadius:8,border:"1px solid rgba(239,68,68,0.35)",backgroundColor:"rgba(239,68,68,0.08)",color:"rgba(252,165,165,0.95)",padding:"12px 16px",fontSize:12,lineHeight:1.5},children:e}):null}function IG(){const{onboarding:e,refreshOnboarding:t}=St(),[n,a]=v.useState(!1),[o,l]=v.useState(null),u=async()=>{a(!0),l(null);try{await Ce("/api/onboarding/init",{method:"POST",body:"{}"}),await t()}catch(f){l(f instanceof Error?f.message:String(f))}finally{a(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(Iy,{eyebrow:"First-run setup",title:"Welcome to Scout",description:i.jsxs(i.Fragment,{children:["Scout needs a local config before it can talk to the broker, the web app, and paired devices. This writes"," ",i.jsx("code",{style:xv,children:"~/.openscout/config.json"})," with sensible defaults — you can edit it any time."]})}),i.jsxs("ul",{style:HG,children:[i.jsx(kN,{label:"Local config (~/.openscout/config.json)",done:!1,hint:"missing"}),i.jsx(kN,{label:".openscout/project.json in a repo",done:!!e?.hasProjectConfig,hint:e?.hasProjectConfig?e.projectRoot??void 0:"checked after setup"})]}),i.jsx(zy,{message:o}),i.jsx(Dy,{primary:"Initialize Scout",onPrimary:()=>{u()},busy:n})]})}function DG(){const{onboarding:e,refreshOnboarding:t}=St(),n=e?.operatorNameSuggestion??"",[a,o]=v.useState(n),[l,u]=v.useState(!1),[f,m]=v.useState(null);v.useEffect(()=>{!a&&n&&o(n)},[n,a]);const h=async()=>{const p=a.trim();if(!p){m("Name is required.");return}u(!0),m(null);try{await Ce("/api/user",{method:"POST",body:JSON.stringify({name:p})}),await t()}catch(y){m(y instanceof Error?y.message:String(y))}finally{u(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(Iy,{eyebrow:"Step 1 of 2",title:"What should we call you?",description:"Your name shows up on messages you send and in any agent that speaks for you. You can change it later in Settings."}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[i.jsx("label",{style:Hd,children:"Your name"}),i.jsx("input",{autoFocus:!0,value:a,onChange:p=>{o(p.target.value),m(null)},onKeyDown:p=>{p.key==="Enter"&&h()},placeholder:n||"Operator",style:yv}),n?i.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)",fontFamily:"var(--hud-font-mono)"},children:"Prefilled from your machine."}):null]}),i.jsx(zy,{message:f}),i.jsx(Dy,{primary:"Continue",onPrimary:()=>{h()},busy:l,primaryDisabled:!a.trim()})]})}function zG(){const{onboarding:e,refreshOnboarding:t}=St(),n=e?.currentDirectory??"",[a,o]=v.useState([n||"~/dev"]),[l,u]=v.useState(n),[f,m]=v.useState("claude"),[h,p]=v.useState(!1),[y,b]=v.useState(null),w=(k,E)=>{o(S=>S.map((R,A)=>A===k?E:R))},j=()=>o(k=>[...k,""]),N=k=>o(E=>E.filter((S,R)=>R!==k)),C=async()=>{const k=a.map(S=>S.trim()).filter(Boolean),E=l.trim();if(!E){b("Pick where Scout should anchor this context.");return}p(!0),b(null);try{await Ce("/api/onboarding/project",{method:"POST",body:JSON.stringify({contextRoot:E,sourceRoots:k,defaultHarness:f})}),await t()}catch(S){b(S instanceof Error?S.message:String(S))}finally{p(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(Iy,{eyebrow:"Step 2 of 2",title:"Where do your repos live?",description:i.jsxs(i.Fragment,{children:["Scout scans these folders for projects and anchors this context at"," ",i.jsx("code",{style:xv,children:"<context>/.openscout/project.json"}),"."]})}),i.jsxs("div",{style:pg,children:[i.jsx("label",{style:Hd,children:"Scan folders"}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[a.map((k,E)=>i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsx("input",{value:k,onChange:S=>w(E,S.target.value),placeholder:E===0?"~/dev":"Add another folder",style:{...yv,flex:1}}),i.jsx("button",{type:"button",onClick:()=>N(E),disabled:a.length<=1,style:{...EN,opacity:a.length<=1?.4:1,cursor:a.length<=1?"default":"pointer"},"aria-label":`Remove folder ${E+1}`,children:"−"})]},E)),i.jsx("button",{type:"button",onClick:j,style:{...EN,alignSelf:"flex-start"},children:"+ Add folder"})]})]}),i.jsxs("div",{style:pg,children:[i.jsx("label",{style:Hd,children:"Context root"}),i.jsx("input",{value:l,onChange:k=>u(k.target.value),placeholder:"~/dev",style:yv}),i.jsxs("div",{style:UG,children:["Scout writes ",i.jsx("code",{style:xv,children:".openscout/project.json"})," ","inside this folder."]})]}),i.jsxs("div",{style:pg,children:[i.jsx("label",{style:Hd,children:"Default harness"}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:["claude","codex"].map(k=>{const E=f===k;return i.jsxs("button",{type:"button",onClick:()=>m(k),style:{...FG,borderColor:E?"var(--accent, #2dd4bf)":"rgba(255,255,255,0.12)",backgroundColor:E?"rgba(45,212,191,0.08)":"rgba(255,255,255,0.02)"},children:[i.jsx("div",{style:{fontSize:15,fontWeight:600,textTransform:"capitalize"},children:k}),i.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.55)",marginTop:6,lineHeight:1.5},children:k==="claude"?"Anthropic Claude Code — local CLI agent.":"OpenAI Codex — cloud agentic sandbox."})]},k)})})]}),i.jsx(zy,{message:y}),i.jsx(Dy,{primary:"Create project",onPrimary:()=>{C()},busy:h,primaryDisabled:!l.trim()})]})}function kN({label:e,done:t,hint:n}){return i.jsxs("li",{style:{display:"flex",alignItems:"flex-start",gap:16},children:[i.jsx("span",{style:{marginTop:2,width:20,height:20,borderRadius:999,display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700,flexShrink:0,backgroundColor:t?"rgba(34,197,94,0.15)":"rgba(239,68,68,0.12)",color:t?"#4ade80":"#f87171"},children:t?"✓":"•"}),i.jsxs("div",{style:{minWidth:0},children:[i.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:t?"rgba(255,255,255,0.75)":"rgba(255,255,255,0.9)"},children:e}),n?i.jsx("div",{style:{fontSize:11,fontFamily:"var(--hud-font-mono)",color:"rgba(255,255,255,0.35)",marginTop:4,wordBreak:"break-all"},children:n}):null]})]})}const PG={fontSize:11,fontFamily:"var(--hud-font-mono)",textTransform:"uppercase",letterSpacing:"0.18em",color:"rgba(255,255,255,0.4)"},LG={fontSize:36,fontWeight:600,letterSpacing:"-0.01em",lineHeight:1.15},$G={fontSize:15,lineHeight:1.75,color:"rgba(255,255,255,0.6)",maxWidth:580},pg={display:"flex",flexDirection:"column",gap:10},Hd={fontSize:11,fontFamily:"var(--hud-font-mono)",textTransform:"uppercase",letterSpacing:"0.15em",color:"rgba(255,255,255,0.5)"},yv={width:"100%",padding:"10px 14px",fontSize:14,fontFamily:"var(--hud-font-mono)",color:"rgba(255,255,255,0.92)",backgroundColor:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,outline:"none",boxSizing:"border-box"},UG={fontSize:12,color:"rgba(255,255,255,0.45)",lineHeight:1.6},xv={fontFamily:"var(--hud-font-mono)",fontSize:12,padding:"2px 6px",borderRadius:4,backgroundColor:"rgba(255,255,255,0.06)"},BG={fontSize:13,fontWeight:600,padding:"12px 24px",borderRadius:10,backgroundColor:"var(--accent, #2dd4bf)",color:"#0b0d12",border:"none",transition:"opacity 0.15s ease"},EN={fontSize:13,fontWeight:500,padding:"10px 14px",borderRadius:8,backgroundColor:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.12)",color:"rgba(255,255,255,0.85)",transition:"all 0.15s ease"},VG={fontSize:12,color:"rgba(255,255,255,0.45)",textDecoration:"underline dotted rgba(255,255,255,0.25)",textUnderlineOffset:4,background:"none",border:"none",cursor:"pointer",padding:"4px 2px",transition:"color 0.15s ease"},HG={display:"flex",flexDirection:"column",gap:20,margin:0,padding:0,listStyle:"none"},FG={textAlign:"left",padding:"16px 18px",borderRadius:12,border:"1px solid rgba(255,255,255,0.12)",color:"rgba(255,255,255,0.9)",cursor:"pointer",transition:"all 0.15s ease"},ZG=[{commandId:"nav:home",title:"Go to Home",description:"Navigate to the home overview showing queue, threads, signal, and activity",category:"navigation",keywords:["home","inbox","dashboard"],shortcut:"Cmd+1"},{commandId:"nav:agents",title:"Go to Agents",description:"Navigate to the agents roster showing all registered agents",category:"navigation",keywords:["agents","roster","list"],shortcut:"Cmd+2"},{commandId:"nav:fleet",title:"Go to Fleet",description:"Navigate to the fleet overview with agent status summary",category:"navigation",keywords:["fleet","overview","status"],shortcut:"Cmd+3"},{commandId:"nav:sessions",title:"Go to Sessions",description:"Navigate to the sessions list showing all active conversations",category:"navigation",keywords:["sessions","conversations","threads"],shortcut:"Cmd+4"},{commandId:"nav:activity",title:"Go to Activity",description:"Navigate to the activity feed showing recent events",category:"navigation",keywords:["activity","feed","events","log"],shortcut:"Cmd+5"},{commandId:"nav:mesh",title:"Go to Mesh",description:"Navigate to the mesh network view showing nodes and topology",category:"navigation",keywords:["mesh","network","nodes","peers","topology"],shortcut:"Cmd+6"},{commandId:"nav:settings",title:"Open Settings",description:"Open the settings screen for pairing, identity, and relay config",category:"settings",keywords:["settings","preferences","config","pair"],shortcut:"Cmd+,"},{commandId:"nav:pair",title:"Pair Device",description:"Open the device pairing flow to connect a mobile device",category:"settings",keywords:["pair","qr","device","phone","mobile"]},{commandId:"scout:reload",title:"Reload Agents",description:"Refresh the agent list and message state from the broker",category:"workspace",keywords:["reload","refresh","sync"]},{commandId:"scout:open:*",title:"Open Agent Conversation",description:"Open the DM lane for one specific agent. One agent maps to a DM; group work belongs in an explicit channel and broadcasts belong in the shared channel.",category:"navigation",keywords:["open","chat","conversation","dm","message"],params:[{name:"agentId",description:"The agent identifier to open",type:"string"}]},{commandId:"scout:send:*",title:"Tell Agent",description:"Open or compose the DM tell/update path for one specific agent. Use Tell for heads-up, replies, status, and steering an active turn inside the same DM.",category:"workspace",keywords:["tell","message","update","dm","reply","steer"],params:[{name:"agentId",description:"The agent identifier to tell",type:"string"},{name:"message",description:"The message body to send",type:"string"}]},{commandId:"scout:ask:*",title:"Ask Agent",description:"Open the DM ask path for one specific agent. Use Ask when the meaning is 'own this work and get back to me' and keep follow-up in the same DM.",category:"workspace",keywords:["ask","assign","task","dm","work","reply"],params:[{name:"agentId",description:"The agent identifier to ask",type:"string"},{name:"message",description:"The message body to send",type:"string"}]},{commandId:"scout:interrupt:*",title:"Interrupt Agent",description:"Send Ctrl-C to interrupt a working agent. The commandId is scout:interrupt:{agentId}.",category:"workspace",keywords:["stop","interrupt","cancel","halt","kill"],dangerous:!0,params:[{name:"agentId",description:"The agent identifier to interrupt",type:"string"}]}];function pM(e={}){const{initialTheme:t="dark"}=e;return{id:"openscout",name:"Scout",description:"All your agents, one message away. Scout is a control plane for managing coding agents: one agent means a DM, group work means an explicit channel, Tell stays conversational, Ask is owned work with a reply path, and shared updates mean broadcast.",mode:"panel",icon:v.createElement(_N,{size:14,strokeWidth:1.2}),Provider:({children:n})=>v.createElement($7,{initialTheme:t},n),leftPanel:{title:"Agents"},rightPanel:{title:"Context"},slots:{Content:sG,LeftPanel:RG,LeftFooter:kG,Inspector:NG,Takeover:OG,Terminal:_G},intents:ZG,hooks:{useCommands:U7,useStatus:B7,useNavCenter:H7,useNavActions:F7,useLayoutMode:Z7,useTakeover:q7}}}pM();function CN(e){return e==="dark"||e==="light"?e:null}function qG(){if(typeof window>"u")return"dark";const e=CN(RF());if(e)return e;const t=CN(new URLSearchParams(window.location.search).get("theme"));return t||"dark"}function WG(e){typeof document>"u"||(document.documentElement.dataset.scoutThemeMode=e,document.documentElement.style.colorScheme=e)}const gM=document.getElementById("root");if(!gM)throw new Error("missing #root");const vM=qG();WG(vM);L2.createRoot(gM).render(i.jsx(v.StrictMode,{children:i.jsx(W7,{app:pM({initialTheme:vM})})}));export{AN as F,xo as f,i as j,v as r};