@amenophis1er/foreman 0.1.8 → 0.1.10

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,39 +1,39 @@
1
- (function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const g of h.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&o(g)}).observe(document,{childList:!0,subtree:!0});function u(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function o(d){if(d.ep)return;d.ep=!0;const h=u(d);fetch(d.href,h)}})();function gm(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var bc={exports:{}},ki={};var Xh;function mm(){if(Xh)return ki;Xh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function u(o,d,h){var g=null;if(h!==void 0&&(g=""+h),d.key!==void 0&&(g=""+d.key),"key"in d){h={};for(var y in d)y!=="key"&&(h[y]=d[y])}else h=d;return d=h.ref,{$$typeof:i,type:o,key:g,ref:d!==void 0?d:null,props:h}}return ki.Fragment=c,ki.jsx=u,ki.jsxs=u,ki}var Qh;function ym(){return Qh||(Qh=1,bc.exports=mm()),bc.exports}var a=ym(),jc={exports:{}},je={};var Vh;function xm(){if(Vh)return je;Vh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),g=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),j=Symbol.iterator;function k(T){return T===null||typeof T!="object"?null:(T=j&&T[j]||T["@@iterator"],typeof T=="function"?T:null)}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},K=Object.assign,M={};function z(T,_,Z){this.props=T,this.context=_,this.refs=M,this.updater=Z||B}z.prototype.isReactComponent={},z.prototype.setState=function(T,_){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,_,"setState")},z.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function D(){}D.prototype=z.prototype;function U(T,_,Z){this.props=T,this.context=_,this.refs=M,this.updater=Z||B}var F=U.prototype=new D;F.constructor=U,K(F,z.prototype),F.isPureReactComponent=!0;var re=Array.isArray;function q(){}var N={H:null,A:null,T:null,S:null},Y=Object.prototype.hasOwnProperty;function G(T,_,Z){var I=Z.ref;return{$$typeof:i,type:T,key:_,ref:I!==void 0?I:null,props:Z}}function fe(T,_){return G(T.type,_,T.props)}function Q(T){return typeof T=="object"&&T!==null&&T.$$typeof===i}function J(T){var _={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(Z){return _[Z]})}var ge=/\/+/g;function oe(T,_){return typeof T=="object"&&T!==null&&T.key!=null?J(""+T.key):_.toString(36)}function ne(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(q,q):(T.status="pending",T.then(function(_){T.status==="pending"&&(T.status="fulfilled",T.value=_)},function(_){T.status==="pending"&&(T.status="rejected",T.reason=_)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function E(T,_,Z,I,ce){var ue=typeof T;(ue==="undefined"||ue==="boolean")&&(T=null);var be=!1;if(T===null)be=!0;else switch(ue){case"bigint":case"string":case"number":be=!0;break;case"object":switch(T.$$typeof){case i:case c:be=!0;break;case S:return be=T._init,E(be(T._payload),_,Z,I,ce)}}if(be)return ce=ce(T),be=I===""?"."+oe(T,0):I,re(ce)?(Z="",be!=null&&(Z=be.replace(ge,"$&/")+"/"),E(ce,_,Z,"",function(te){return te})):ce!=null&&(Q(ce)&&(ce=fe(ce,Z+(ce.key==null||T&&T.key===ce.key?"":(""+ce.key).replace(ge,"$&/")+"/")+be)),_.push(ce)),1;be=0;var Re=I===""?".":I+":";if(re(T))for(var ee=0;ee<T.length;ee++)I=T[ee],ue=Re+oe(I,ee),be+=E(I,_,Z,ue,ce);else if(ee=k(T),typeof ee=="function")for(T=ee.call(T),ee=0;!(I=T.next()).done;)I=I.value,ue=Re+oe(I,ee++),be+=E(I,_,Z,ue,ce);else if(ue==="object"){if(typeof T.then=="function")return E(ne(T),_,Z,I,ce);throw _=String(T),Error("Objects are not valid as a React child (found: "+(_==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":_)+"). If you meant to render a collection of children, use an array instead.")}return be}function $(T,_,Z){if(T==null)return T;var I=[],ce=0;return E(T,I,"","",function(ue){return _.call(Z,ue,ce++)}),I}function P(T){if(T._status===-1){var _=T._result;_=_(),_.then(function(Z){(T._status===0||T._status===-1)&&(T._status=1,T._result=Z)},function(Z){(T._status===0||T._status===-1)&&(T._status=2,T._result=Z)}),T._status===-1&&(T._status=0,T._result=_)}if(T._status===1)return T._result.default;throw T._result}var me=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var _=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(_))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},xe={map:$,forEach:function(T,_,Z){$(T,function(){_.apply(this,arguments)},Z)},count:function(T){var _=0;return $(T,function(){_++}),_},toArray:function(T){return $(T,function(_){return _})||[]},only:function(T){if(!Q(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return je.Activity=b,je.Children=xe,je.Component=z,je.Fragment=u,je.Profiler=d,je.PureComponent=U,je.StrictMode=o,je.Suspense=x,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,je.__COMPILER_RUNTIME={__proto__:null,c:function(T){return N.H.useMemoCache(T)}},je.cache=function(T){return function(){return T.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(T,_,Z){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var I=K({},T.props),ce=T.key;if(_!=null)for(ue in _.key!==void 0&&(ce=""+_.key),_)!Y.call(_,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&_.ref===void 0||(I[ue]=_[ue]);var ue=arguments.length-2;if(ue===1)I.children=Z;else if(1<ue){for(var be=Array(ue),Re=0;Re<ue;Re++)be[Re]=arguments[Re+2];I.children=be}return G(T.type,ce,I)},je.createContext=function(T){return T={$$typeof:g,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:h,_context:T},T},je.createElement=function(T,_,Z){var I,ce={},ue=null;if(_!=null)for(I in _.key!==void 0&&(ue=""+_.key),_)Y.call(_,I)&&I!=="key"&&I!=="__self"&&I!=="__source"&&(ce[I]=_[I]);var be=arguments.length-2;if(be===1)ce.children=Z;else if(1<be){for(var Re=Array(be),ee=0;ee<be;ee++)Re[ee]=arguments[ee+2];ce.children=Re}if(T&&T.defaultProps)for(I in be=T.defaultProps,be)ce[I]===void 0&&(ce[I]=be[I]);return G(T,ue,ce)},je.createRef=function(){return{current:null}},je.forwardRef=function(T){return{$$typeof:y,render:T}},je.isValidElement=Q,je.lazy=function(T){return{$$typeof:S,_payload:{_status:-1,_result:T},_init:P}},je.memo=function(T,_){return{$$typeof:v,type:T,compare:_===void 0?null:_}},je.startTransition=function(T){var _=N.T,Z={};N.T=Z;try{var I=T(),ce=N.S;ce!==null&&ce(Z,I),typeof I=="object"&&I!==null&&typeof I.then=="function"&&I.then(q,me)}catch(ue){me(ue)}finally{_!==null&&Z.types!==null&&(_.types=Z.types),N.T=_}},je.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},je.use=function(T){return N.H.use(T)},je.useActionState=function(T,_,Z){return N.H.useActionState(T,_,Z)},je.useCallback=function(T,_){return N.H.useCallback(T,_)},je.useContext=function(T){return N.H.useContext(T)},je.useDebugValue=function(){},je.useDeferredValue=function(T,_){return N.H.useDeferredValue(T,_)},je.useEffect=function(T,_){return N.H.useEffect(T,_)},je.useEffectEvent=function(T){return N.H.useEffectEvent(T)},je.useId=function(){return N.H.useId()},je.useImperativeHandle=function(T,_,Z){return N.H.useImperativeHandle(T,_,Z)},je.useInsertionEffect=function(T,_){return N.H.useInsertionEffect(T,_)},je.useLayoutEffect=function(T,_){return N.H.useLayoutEffect(T,_)},je.useMemo=function(T,_){return N.H.useMemo(T,_)},je.useOptimistic=function(T,_){return N.H.useOptimistic(T,_)},je.useReducer=function(T,_,Z){return N.H.useReducer(T,_,Z)},je.useRef=function(T){return N.H.useRef(T)},je.useState=function(T){return N.H.useState(T)},je.useSyncExternalStore=function(T,_,Z){return N.H.useSyncExternalStore(T,_,Z)},je.useTransition=function(){return N.H.useTransition()},je.version="19.2.8",je}var Wh;function Kc(){return Wh||(Wh=1,jc.exports=xm()),jc.exports}var m=Kc();const On=gm(m);var Sc={exports:{}},wi={},kc={exports:{}},wc={};var Kh;function bm(){return Kh||(Kh=1,(function(i){function c(E,$){var P=E.length;E.push($);e:for(;0<P;){var me=P-1>>>1,xe=E[me];if(0<d(xe,$))E[me]=$,E[P]=xe,P=me;else break e}}function u(E){return E.length===0?null:E[0]}function o(E){if(E.length===0)return null;var $=E[0],P=E.pop();if(P!==$){E[0]=P;e:for(var me=0,xe=E.length,T=xe>>>1;me<T;){var _=2*(me+1)-1,Z=E[_],I=_+1,ce=E[I];if(0>d(Z,P))I<xe&&0>d(ce,Z)?(E[me]=ce,E[I]=P,me=I):(E[me]=Z,E[_]=P,me=_);else if(I<xe&&0>d(ce,P))E[me]=ce,E[I]=P,me=I;else break e}}return $}function d(E,$){var P=E.sortIndex-$.sortIndex;return P!==0?P:E.id-$.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;i.unstable_now=function(){return h.now()}}else{var g=Date,y=g.now();i.unstable_now=function(){return g.now()-y}}var x=[],v=[],S=1,b=null,j=3,k=!1,B=!1,K=!1,M=!1,z=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function F(E){for(var $=u(v);$!==null;){if($.callback===null)o(v);else if($.startTime<=E)o(v),$.sortIndex=$.expirationTime,c(x,$);else break;$=u(v)}}function re(E){if(K=!1,F(E),!B)if(u(x)!==null)B=!0,q||(q=!0,J());else{var $=u(v);$!==null&&ne(re,$.startTime-E)}}var q=!1,N=-1,Y=5,G=-1;function fe(){return M?!0:!(i.unstable_now()-G<Y)}function Q(){if(M=!1,q){var E=i.unstable_now();G=E;var $=!0;try{e:{B=!1,K&&(K=!1,D(N),N=-1),k=!0;var P=j;try{t:{for(F(E),b=u(x);b!==null&&!(b.expirationTime>E&&fe());){var me=b.callback;if(typeof me=="function"){b.callback=null,j=b.priorityLevel;var xe=me(b.expirationTime<=E);if(E=i.unstable_now(),typeof xe=="function"){b.callback=xe,F(E),$=!0;break t}b===u(x)&&o(x),F(E)}else o(x);b=u(x)}if(b!==null)$=!0;else{var T=u(v);T!==null&&ne(re,T.startTime-E),$=!1}}break e}finally{b=null,j=P,k=!1}$=void 0}}finally{$?J():q=!1}}}var J;if(typeof U=="function")J=function(){U(Q)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,oe=ge.port2;ge.port1.onmessage=Q,J=function(){oe.postMessage(null)}}else J=function(){z(Q,0)};function ne(E,$){N=z(function(){E(i.unstable_now())},$)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(E){E.callback=null},i.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<E?Math.floor(1e3/E):5},i.unstable_getCurrentPriorityLevel=function(){return j},i.unstable_next=function(E){switch(j){case 1:case 2:case 3:var $=3;break;default:$=j}var P=j;j=$;try{return E()}finally{j=P}},i.unstable_requestPaint=function(){M=!0},i.unstable_runWithPriority=function(E,$){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var P=j;j=E;try{return $()}finally{j=P}},i.unstable_scheduleCallback=function(E,$,P){var me=i.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?me+P:me):P=me,E){case 1:var xe=-1;break;case 2:xe=250;break;case 5:xe=1073741823;break;case 4:xe=1e4;break;default:xe=5e3}return xe=P+xe,E={id:S++,callback:$,priorityLevel:E,startTime:P,expirationTime:xe,sortIndex:-1},P>me?(E.sortIndex=P,c(v,E),u(x)===null&&E===u(v)&&(K?(D(N),N=-1):K=!0,ne(re,P-me))):(E.sortIndex=xe,c(x,E),B||k||(B=!0,q||(q=!0,J()))),E},i.unstable_shouldYield=fe,i.unstable_wrapCallback=function(E){var $=j;return function(){var P=j;j=$;try{return E.apply(this,arguments)}finally{j=P}}}})(wc)),wc}var Zh;function jm(){return Zh||(Zh=1,kc.exports=bm()),kc.exports}var zc={exports:{}},xt={};var Fh;function Sm(){if(Fh)return xt;Fh=1;var i=Kc();function c(x){var v="https://react.dev/errors/"+x;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)v+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+x+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(){}var o={d:{f:u,r:function(){throw Error(c(522))},D:u,C:u,L:u,m:u,X:u,S:u,M:u},p:0,findDOMNode:null},d=Symbol.for("react.portal");function h(x,v,S){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:b==null?null:""+b,children:x,containerInfo:v,implementation:S}}var g=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function y(x,v){if(x==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return xt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,xt.createPortal=function(x,v){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(c(299));return h(x,v,null,S)},xt.flushSync=function(x){var v=g.T,S=o.p;try{if(g.T=null,o.p=2,x)return x()}finally{g.T=v,o.p=S,o.d.f()}},xt.preconnect=function(x,v){typeof x=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,o.d.C(x,v))},xt.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},xt.preinit=function(x,v){if(typeof x=="string"&&v&&typeof v.as=="string"){var S=v.as,b=y(S,v.crossOrigin),j=typeof v.integrity=="string"?v.integrity:void 0,k=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;S==="style"?o.d.S(x,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:b,integrity:j,fetchPriority:k}):S==="script"&&o.d.X(x,{crossOrigin:b,integrity:j,fetchPriority:k,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},xt.preinitModule=function(x,v){if(typeof x=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var S=y(v.as,v.crossOrigin);o.d.M(x,{crossOrigin:S,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0})}}else v==null&&o.d.M(x)},xt.preload=function(x,v){if(typeof x=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var S=v.as,b=y(S,v.crossOrigin);o.d.L(x,S,{crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},xt.preloadModule=function(x,v){if(typeof x=="string")if(v){var S=y(v.as,v.crossOrigin);o.d.m(x,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:S,integrity:typeof v.integrity=="string"?v.integrity:void 0})}else o.d.m(x)},xt.requestFormReset=function(x){o.d.r(x)},xt.unstable_batchedUpdates=function(x,v){return x(v)},xt.useFormState=function(x,v,S){return g.H.useFormState(x,v,S)},xt.useFormStatus=function(){return g.H.useHostTransitionStatus()},xt.version="19.2.8",xt}var Jh;function km(){if(Jh)return zc.exports;Jh=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),zc.exports=Sm(),zc.exports}var Ih;function wm(){if(Ih)return wi;Ih=1;var i=jm(),c=Kc(),u=km();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function h(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function g(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function y(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function x(e){if(h(e)!==e)throw Error(o(188))}function v(e){var t=e.alternate;if(!t){if(t=h(e),t===null)throw Error(o(188));return t!==e?null:e}for(var n=e,l=t;;){var s=n.return;if(s===null)break;var r=s.alternate;if(r===null){if(l=s.return,l!==null){n=l;continue}break}if(s.child===r.child){for(r=s.child;r;){if(r===n)return x(s),e;if(r===l)return x(s),t;r=r.sibling}throw Error(o(188))}if(n.return!==l.return)n=s,l=r;else{for(var f=!1,p=s.child;p;){if(p===n){f=!0,n=s,l=r;break}if(p===l){f=!0,l=s,n=r;break}p=p.sibling}if(!f){for(p=r.child;p;){if(p===n){f=!0,n=r,l=s;break}if(p===l){f=!0,l=r,n=s;break}p=p.sibling}if(!f)throw Error(o(189))}}if(n.alternate!==l)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,j=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),K=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),U=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),fe=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function J(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||e["@@iterator"],typeof e=="function"?e:null)}var ge=Symbol.for("react.client.reference");function oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case K:return"Fragment";case z:return"Profiler";case M:return"StrictMode";case re:return"Suspense";case q:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case B:return"Portal";case U:return e.displayName||"Context";case D:return(e._context.displayName||"Context")+".Consumer";case F:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case N:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case Y:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var ne=Array.isArray,E=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=u.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},me=[],xe=-1;function T(e){return{current:e}}function _(e){0>xe||(e.current=me[xe],me[xe]=null,xe--)}function Z(e,t){xe++,me[xe]=e.current,e.current=t}var I=T(null),ce=T(null),ue=T(null),be=T(null);function Re(e,t){switch(Z(ue,t),Z(ce,e),Z(I,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?hh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=hh(t),e=ph(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_(I),Z(I,e)}function ee(){_(I),_(ce),_(ue)}function te(e){e.memoizedState!==null&&Z(be,e);var t=I.current,n=ph(t,e.type);t!==n&&(Z(ce,e),Z(I,n))}function we(e){ce.current===e&&(_(I),_(ce)),be.current===e&&(_(be),xi._currentValue=P)}var le,Ne;function Ge(e){if(le===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||"",Ne=-1<n.stack.indexOf(`
1
+ (function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const g of h.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&o(g)}).observe(document,{childList:!0,subtree:!0});function u(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function o(d){if(d.ep)return;d.ep=!0;const h=u(d);fetch(d.href,h)}})();function gm(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var bc={exports:{}},wi={};var Xh;function mm(){if(Xh)return wi;Xh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function u(o,d,h){var g=null;if(h!==void 0&&(g=""+h),d.key!==void 0&&(g=""+d.key),"key"in d){h={};for(var y in d)y!=="key"&&(h[y]=d[y])}else h=d;return d=h.ref,{$$typeof:i,type:o,key:g,ref:d!==void 0?d:null,props:h}}return wi.Fragment=c,wi.jsx=u,wi.jsxs=u,wi}var Qh;function ym(){return Qh||(Qh=1,bc.exports=mm()),bc.exports}var l=ym(),jc={exports:{}},je={};var Vh;function xm(){if(Vh)return je;Vh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),g=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),j=Symbol.iterator;function k(T){return T===null||typeof T!="object"?null:(T=j&&T[j]||T["@@iterator"],typeof T=="function"?T:null)}var U={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Z=Object.assign,C={};function z(T,_,F){this.props=T,this.context=_,this.refs=C,this.updater=F||U}z.prototype.isReactComponent={},z.prototype.setState=function(T,_){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,_,"setState")},z.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function D(){}D.prototype=z.prototype;function B(T,_,F){this.props=T,this.context=_,this.refs=C,this.updater=F||U}var J=B.prototype=new D;J.constructor=B,Z(J,z.prototype),J.isPureReactComponent=!0;var re=Array.isArray;function q(){}var N={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function Y(T,_,F){var I=F.ref;return{$$typeof:i,type:T,key:_,ref:I!==void 0?I:null,props:F}}function de(T,_){return Y(T.type,_,T.props)}function Q(T){return typeof T=="object"&&T!==null&&T.$$typeof===i}function W(T){var _={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(F){return _[F]})}var ge=/\/+/g;function oe(T,_){return typeof T=="object"&&T!==null&&T.key!=null?W(""+T.key):_.toString(36)}function ne(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(q,q):(T.status="pending",T.then(function(_){T.status==="pending"&&(T.status="fulfilled",T.value=_)},function(_){T.status==="pending"&&(T.status="rejected",T.reason=_)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function E(T,_,F,I,ce){var ue=typeof T;(ue==="undefined"||ue==="boolean")&&(T=null);var be=!1;if(T===null)be=!0;else switch(ue){case"bigint":case"string":case"number":be=!0;break;case"object":switch(T.$$typeof){case i:case c:be=!0;break;case S:return be=T._init,E(be(T._payload),_,F,I,ce)}}if(be)return ce=ce(T),be=I===""?"."+oe(T,0):I,re(ce)?(F="",be!=null&&(F=be.replace(ge,"$&/")+"/"),E(ce,_,F,"",function(te){return te})):ce!=null&&(Q(ce)&&(ce=de(ce,F+(ce.key==null||T&&T.key===ce.key?"":(""+ce.key).replace(ge,"$&/")+"/")+be)),_.push(ce)),1;be=0;var Re=I===""?".":I+":";if(re(T))for(var ee=0;ee<T.length;ee++)I=T[ee],ue=Re+oe(I,ee),be+=E(I,_,F,ue,ce);else if(ee=k(T),typeof ee=="function")for(T=ee.call(T),ee=0;!(I=T.next()).done;)I=I.value,ue=Re+oe(I,ee++),be+=E(I,_,F,ue,ce);else if(ue==="object"){if(typeof T.then=="function")return E(ne(T),_,F,I,ce);throw _=String(T),Error("Objects are not valid as a React child (found: "+(_==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":_)+"). If you meant to render a collection of children, use an array instead.")}return be}function G(T,_,F){if(T==null)return T;var I=[],ce=0;return E(T,I,"","",function(ue){return _.call(F,ue,ce++)}),I}function P(T){if(T._status===-1){var _=T._result;_=_(),_.then(function(F){(T._status===0||T._status===-1)&&(T._status=1,T._result=F)},function(F){(T._status===0||T._status===-1)&&(T._status=2,T._result=F)}),T._status===-1&&(T._status=0,T._result=_)}if(T._status===1)return T._result.default;throw T._result}var me=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var _=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(_))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},xe={map:G,forEach:function(T,_,F){G(T,function(){_.apply(this,arguments)},F)},count:function(T){var _=0;return G(T,function(){_++}),_},toArray:function(T){return G(T,function(_){return _})||[]},only:function(T){if(!Q(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return je.Activity=x,je.Children=xe,je.Component=z,je.Fragment=u,je.Profiler=d,je.PureComponent=B,je.StrictMode=o,je.Suspense=b,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,je.__COMPILER_RUNTIME={__proto__:null,c:function(T){return N.H.useMemoCache(T)}},je.cache=function(T){return function(){return T.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(T,_,F){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var I=Z({},T.props),ce=T.key;if(_!=null)for(ue in _.key!==void 0&&(ce=""+_.key),_)!$.call(_,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&_.ref===void 0||(I[ue]=_[ue]);var ue=arguments.length-2;if(ue===1)I.children=F;else if(1<ue){for(var be=Array(ue),Re=0;Re<ue;Re++)be[Re]=arguments[Re+2];I.children=be}return Y(T.type,ce,I)},je.createContext=function(T){return T={$$typeof:g,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:h,_context:T},T},je.createElement=function(T,_,F){var I,ce={},ue=null;if(_!=null)for(I in _.key!==void 0&&(ue=""+_.key),_)$.call(_,I)&&I!=="key"&&I!=="__self"&&I!=="__source"&&(ce[I]=_[I]);var be=arguments.length-2;if(be===1)ce.children=F;else if(1<be){for(var Re=Array(be),ee=0;ee<be;ee++)Re[ee]=arguments[ee+2];ce.children=Re}if(T&&T.defaultProps)for(I in be=T.defaultProps,be)ce[I]===void 0&&(ce[I]=be[I]);return Y(T,ue,ce)},je.createRef=function(){return{current:null}},je.forwardRef=function(T){return{$$typeof:y,render:T}},je.isValidElement=Q,je.lazy=function(T){return{$$typeof:S,_payload:{_status:-1,_result:T},_init:P}},je.memo=function(T,_){return{$$typeof:v,type:T,compare:_===void 0?null:_}},je.startTransition=function(T){var _=N.T,F={};N.T=F;try{var I=T(),ce=N.S;ce!==null&&ce(F,I),typeof I=="object"&&I!==null&&typeof I.then=="function"&&I.then(q,me)}catch(ue){me(ue)}finally{_!==null&&F.types!==null&&(_.types=F.types),N.T=_}},je.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},je.use=function(T){return N.H.use(T)},je.useActionState=function(T,_,F){return N.H.useActionState(T,_,F)},je.useCallback=function(T,_){return N.H.useCallback(T,_)},je.useContext=function(T){return N.H.useContext(T)},je.useDebugValue=function(){},je.useDeferredValue=function(T,_){return N.H.useDeferredValue(T,_)},je.useEffect=function(T,_){return N.H.useEffect(T,_)},je.useEffectEvent=function(T){return N.H.useEffectEvent(T)},je.useId=function(){return N.H.useId()},je.useImperativeHandle=function(T,_,F){return N.H.useImperativeHandle(T,_,F)},je.useInsertionEffect=function(T,_){return N.H.useInsertionEffect(T,_)},je.useLayoutEffect=function(T,_){return N.H.useLayoutEffect(T,_)},je.useMemo=function(T,_){return N.H.useMemo(T,_)},je.useOptimistic=function(T,_){return N.H.useOptimistic(T,_)},je.useReducer=function(T,_,F){return N.H.useReducer(T,_,F)},je.useRef=function(T){return N.H.useRef(T)},je.useState=function(T){return N.H.useState(T)},je.useSyncExternalStore=function(T,_,F){return N.H.useSyncExternalStore(T,_,F)},je.useTransition=function(){return N.H.useTransition()},je.version="19.2.8",je}var Wh;function Kc(){return Wh||(Wh=1,jc.exports=xm()),jc.exports}var m=Kc();const On=gm(m);var Sc={exports:{}},zi={},kc={exports:{}},wc={};var Kh;function bm(){return Kh||(Kh=1,(function(i){function c(E,G){var P=E.length;E.push(G);e:for(;0<P;){var me=P-1>>>1,xe=E[me];if(0<d(xe,G))E[me]=G,E[P]=xe,P=me;else break e}}function u(E){return E.length===0?null:E[0]}function o(E){if(E.length===0)return null;var G=E[0],P=E.pop();if(P!==G){E[0]=P;e:for(var me=0,xe=E.length,T=xe>>>1;me<T;){var _=2*(me+1)-1,F=E[_],I=_+1,ce=E[I];if(0>d(F,P))I<xe&&0>d(ce,F)?(E[me]=ce,E[I]=P,me=I):(E[me]=F,E[_]=P,me=_);else if(I<xe&&0>d(ce,P))E[me]=ce,E[I]=P,me=I;else break e}}return G}function d(E,G){var P=E.sortIndex-G.sortIndex;return P!==0?P:E.id-G.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;i.unstable_now=function(){return h.now()}}else{var g=Date,y=g.now();i.unstable_now=function(){return g.now()-y}}var b=[],v=[],S=1,x=null,j=3,k=!1,U=!1,Z=!1,C=!1,z=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function J(E){for(var G=u(v);G!==null;){if(G.callback===null)o(v);else if(G.startTime<=E)o(v),G.sortIndex=G.expirationTime,c(b,G);else break;G=u(v)}}function re(E){if(Z=!1,J(E),!U)if(u(b)!==null)U=!0,q||(q=!0,W());else{var G=u(v);G!==null&&ne(re,G.startTime-E)}}var q=!1,N=-1,$=5,Y=-1;function de(){return C?!0:!(i.unstable_now()-Y<$)}function Q(){if(C=!1,q){var E=i.unstable_now();Y=E;var G=!0;try{e:{U=!1,Z&&(Z=!1,D(N),N=-1),k=!0;var P=j;try{t:{for(J(E),x=u(b);x!==null&&!(x.expirationTime>E&&de());){var me=x.callback;if(typeof me=="function"){x.callback=null,j=x.priorityLevel;var xe=me(x.expirationTime<=E);if(E=i.unstable_now(),typeof xe=="function"){x.callback=xe,J(E),G=!0;break t}x===u(b)&&o(b),J(E)}else o(b);x=u(b)}if(x!==null)G=!0;else{var T=u(v);T!==null&&ne(re,T.startTime-E),G=!1}}break e}finally{x=null,j=P,k=!1}G=void 0}}finally{G?W():q=!1}}}var W;if(typeof B=="function")W=function(){B(Q)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,oe=ge.port2;ge.port1.onmessage=Q,W=function(){oe.postMessage(null)}}else W=function(){z(Q,0)};function ne(E,G){N=z(function(){E(i.unstable_now())},G)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(E){E.callback=null},i.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<E?Math.floor(1e3/E):5},i.unstable_getCurrentPriorityLevel=function(){return j},i.unstable_next=function(E){switch(j){case 1:case 2:case 3:var G=3;break;default:G=j}var P=j;j=G;try{return E()}finally{j=P}},i.unstable_requestPaint=function(){C=!0},i.unstable_runWithPriority=function(E,G){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var P=j;j=E;try{return G()}finally{j=P}},i.unstable_scheduleCallback=function(E,G,P){var me=i.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?me+P:me):P=me,E){case 1:var xe=-1;break;case 2:xe=250;break;case 5:xe=1073741823;break;case 4:xe=1e4;break;default:xe=5e3}return xe=P+xe,E={id:S++,callback:G,priorityLevel:E,startTime:P,expirationTime:xe,sortIndex:-1},P>me?(E.sortIndex=P,c(v,E),u(b)===null&&E===u(v)&&(Z?(D(N),N=-1):Z=!0,ne(re,P-me))):(E.sortIndex=xe,c(b,E),U||k||(U=!0,q||(q=!0,W()))),E},i.unstable_shouldYield=de,i.unstable_wrapCallback=function(E){var G=j;return function(){var P=j;j=G;try{return E.apply(this,arguments)}finally{j=P}}}})(wc)),wc}var Zh;function jm(){return Zh||(Zh=1,kc.exports=bm()),kc.exports}var zc={exports:{}},xt={};var Fh;function Sm(){if(Fh)return xt;Fh=1;var i=Kc();function c(b){var v="https://react.dev/errors/"+b;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)v+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+b+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(){}var o={d:{f:u,r:function(){throw Error(c(522))},D:u,C:u,L:u,m:u,X:u,S:u,M:u},p:0,findDOMNode:null},d=Symbol.for("react.portal");function h(b,v,S){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:x==null?null:""+x,children:b,containerInfo:v,implementation:S}}var g=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function y(b,v){if(b==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return xt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,xt.createPortal=function(b,v){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(c(299));return h(b,v,null,S)},xt.flushSync=function(b){var v=g.T,S=o.p;try{if(g.T=null,o.p=2,b)return b()}finally{g.T=v,o.p=S,o.d.f()}},xt.preconnect=function(b,v){typeof b=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,o.d.C(b,v))},xt.prefetchDNS=function(b){typeof b=="string"&&o.d.D(b)},xt.preinit=function(b,v){if(typeof b=="string"&&v&&typeof v.as=="string"){var S=v.as,x=y(S,v.crossOrigin),j=typeof v.integrity=="string"?v.integrity:void 0,k=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;S==="style"?o.d.S(b,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:x,integrity:j,fetchPriority:k}):S==="script"&&o.d.X(b,{crossOrigin:x,integrity:j,fetchPriority:k,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},xt.preinitModule=function(b,v){if(typeof b=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var S=y(v.as,v.crossOrigin);o.d.M(b,{crossOrigin:S,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0})}}else v==null&&o.d.M(b)},xt.preload=function(b,v){if(typeof b=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var S=v.as,x=y(S,v.crossOrigin);o.d.L(b,S,{crossOrigin:x,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},xt.preloadModule=function(b,v){if(typeof b=="string")if(v){var S=y(v.as,v.crossOrigin);o.d.m(b,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:S,integrity:typeof v.integrity=="string"?v.integrity:void 0})}else o.d.m(b)},xt.requestFormReset=function(b){o.d.r(b)},xt.unstable_batchedUpdates=function(b,v){return b(v)},xt.useFormState=function(b,v,S){return g.H.useFormState(b,v,S)},xt.useFormStatus=function(){return g.H.useHostTransitionStatus()},xt.version="19.2.8",xt}var Jh;function km(){if(Jh)return zc.exports;Jh=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),zc.exports=Sm(),zc.exports}var Ih;function wm(){if(Ih)return zi;Ih=1;var i=jm(),c=Kc(),u=km();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function h(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function g(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function y(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function b(e){if(h(e)!==e)throw Error(o(188))}function v(e){var t=e.alternate;if(!t){if(t=h(e),t===null)throw Error(o(188));return t!==e?null:e}for(var n=e,a=t;;){var s=n.return;if(s===null)break;var r=s.alternate;if(r===null){if(a=s.return,a!==null){n=a;continue}break}if(s.child===r.child){for(r=s.child;r;){if(r===n)return b(s),e;if(r===a)return b(s),t;r=r.sibling}throw Error(o(188))}if(n.return!==a.return)n=s,a=r;else{for(var f=!1,p=s.child;p;){if(p===n){f=!0,n=s,a=r;break}if(p===a){f=!0,a=s,n=r;break}p=p.sibling}if(!f){for(p=r.child;p;){if(p===n){f=!0,n=r,a=s;break}if(p===a){f=!0,a=r,n=s;break}p=p.sibling}if(!f)throw Error(o(189))}}if(n.alternate!==a)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var x=Object.assign,j=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),B=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),de=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||e["@@iterator"],typeof e=="function"?e:null)}var ge=Symbol.for("react.client.reference");function oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Z:return"Fragment";case z:return"Profiler";case C:return"StrictMode";case re:return"Suspense";case q:return"SuspenseList";case Y:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case U:return"Portal";case B:return e.displayName||"Context";case D:return(e._context.displayName||"Context")+".Consumer";case J:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case N:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case $:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var ne=Array.isArray,E=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=u.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},me=[],xe=-1;function T(e){return{current:e}}function _(e){0>xe||(e.current=me[xe],me[xe]=null,xe--)}function F(e,t){xe++,me[xe]=e.current,e.current=t}var I=T(null),ce=T(null),ue=T(null),be=T(null);function Re(e,t){switch(F(ue,t),F(ce,e),F(I,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?hh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=hh(t),e=ph(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_(I),F(I,e)}function ee(){_(I),_(ce),_(ue)}function te(e){e.memoizedState!==null&&F(be,e);var t=I.current,n=ph(t,e.type);t!==n&&(F(ce,e),F(I,n))}function we(e){ce.current===e&&(_(I),_(ce)),be.current===e&&(_(be),bi._currentValue=P)}var le,Ne;function Ge(e){if(le===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||"",Ne=-1<n.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+le+e+Ne}var bt=!1;function hl(e,t){if(!e||bt)return"";bt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var W=function(){throw Error()};if(Object.defineProperty(W.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(W,[])}catch(L){var H=L}Reflect.construct(e,[],W)}else{try{W.call()}catch(L){H=L}e.call(W.prototype)}}else{try{throw Error()}catch(L){H=L}(W=e())&&typeof W.catch=="function"&&W.catch(function(){})}}catch(L){if(L&&H&&typeof L.stack=="string")return[L.stack,H.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=l.DetermineComponentFrameRoot(),f=r[0],p=r[1];if(f&&p){var w=f.split(`
3
+ `+le+e+Ne}var bt=!1;function ha(e,t){if(!e||bt)return"";bt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var K=function(){throw Error()};if(Object.defineProperty(K.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(K,[])}catch(L){var H=L}Reflect.construct(e,[],K)}else{try{K.call()}catch(L){H=L}e.call(K.prototype)}}else{try{throw Error()}catch(L){H=L}(K=e())&&typeof K.catch=="function"&&K.catch(function(){})}}catch(L){if(L&&H&&typeof L.stack=="string")return[L.stack,H.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=a.DetermineComponentFrameRoot(),f=r[0],p=r[1];if(f&&p){var w=f.split(`
4
4
  `),O=p.split(`
5
- `);for(s=l=0;l<w.length&&!w[l].includes("DetermineComponentFrameRoot");)l++;for(;s<O.length&&!O[s].includes("DetermineComponentFrameRoot");)s++;if(l===w.length||s===O.length)for(l=w.length-1,s=O.length-1;1<=l&&0<=s&&w[l]!==O[s];)s--;for(;1<=l&&0<=s;l--,s--)if(w[l]!==O[s]){if(l!==1||s!==1)do if(l--,s--,0>s||w[l]!==O[s]){var X=`
6
- `+w[l].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=l&&0<=s);break}}}finally{bt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ge(n):""}function sn(e,t){switch(e.tag){case 26:case 27:case 5:return Ge(e.type);case 16:return Ge("Lazy");case 13:return e.child!==t&&t!==null?Ge("Suspense Fallback"):Ge("Suspense");case 19:return Ge("SuspenseList");case 0:case 15:return hl(e.type,!1);case 11:return hl(e.type.render,!1);case 1:return hl(e.type,!0);case 31:return Ge("Activity");default:return""}}function Hl(e){try{var t="",n=null;do t+=sn(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
7
- Error generating stack: `+l.message+`
8
- `+l.stack}}var Nn=Object.prototype.hasOwnProperty,Ul=i.unstable_scheduleCallback,Bl=i.unstable_cancelCallback,ql=i.unstable_shouldYield,Ca=i.unstable_requestPaint,mt=i.unstable_now,or=i.unstable_getCurrentPriorityLevel,Ma=i.unstable_ImmediatePriority,Ea=i.unstable_UserBlockingPriority,Ll=i.unstable_NormalPriority,hn=i.unstable_LowPriority,pl=i.unstable_IdlePriority,Ri=i.log,Oi=i.unstable_setDisableYieldValue,Hn=null,ct=null;function Ft(e){if(typeof Ri=="function"&&Oi(e),ct&&typeof ct.setStrictMode=="function")try{ct.setStrictMode(Hn,e)}catch{}}var ut=Math.clz32?Math.clz32:_a,cr=Math.log,Ni=Math.LN2;function _a(e){return e>>>=0,e===0?32:31-(cr(e)/Ni|0)|0}var Ht=256,Ut=262144,Jt=4194304;function It(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Un(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var s=0,r=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var p=l&134217727;return p!==0?(l=p&~r,l!==0?s=It(l):(f&=p,f!==0?s=It(f):n||(n=p&~e,n!==0&&(s=It(n))))):(p=l&~r,p!==0?s=It(p):f!==0?s=It(f):n||(n=l&~e,n!==0&&(s=It(n)))),s===0?0:t!==0&&t!==s&&(t&r)===0&&(r=s&-s,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:s}function Bn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ur(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Hi(){var e=Jt;return Jt<<=1,(Jt&62914560)===0&&(Jt=4194304),e}function Aa(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function dr(e,t,n,l,s,r){var f=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var p=e.entanglements,w=e.expirationTimes,O=e.hiddenUpdates;for(n=f&~n;0<n;){var X=31-ut(n),W=1<<X;p[X]=0,w[X]=-1;var H=O[X];if(H!==null)for(O[X]=null,X=0;X<H.length;X++){var L=H[X];L!==null&&(L.lane&=-536870913)}n&=~W}l!==0&&Ui(e,l,0),r!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=r&~(f&~t))}function Ui(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-ut(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function Bi(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-ut(n),s=1<<l;s&t|e[l]&t&&(e[l]|=t),n&=~s}}function qi(e,t){var n=t&-t;return n=(n&42)!==0?1:vl(n),(n&(e.suspendedLanes|t))!==0?0:n}function vl(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function $l(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Da(){var e=$.p;return e!==0?e:(e=window.event,e===void 0?32:Uh(e.type))}function Ra(e,t){var n=$.p;try{return $.p=e,t()}finally{$.p=n}}var Pt=Math.random().toString(36).slice(2),at="__reactFiber$"+Pt,yt="__reactProps$"+Pt,pn="__reactContainer$"+Pt,ae="__reactEvents$"+Pt,Je="__reactListeners$"+Pt,en="__reactHandles$"+Pt,gl="__reactResources$"+Pt,Ln="__reactMarker$"+Pt;function Oa(e){delete e[at],delete e[yt],delete e[ae],delete e[Je],delete e[en]}function Yl(e){var t=e[at];if(t)return t;for(var n=e.parentNode;n;){if(t=n[pn]||n[at]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=jh(e);e!==null;){if(n=e[at])return n;e=jh(e)}return t}e=n,n=e.parentNode}return null}function Gl(e){if(e=e[at]||e[pn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Na(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Xl(e){var t=e[gl];return t||(t=e[gl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function st(e){e[Ln]=!0}var eu=new Set,tu={};function ml(e,t){Ql(e,t),Ql(e+"Capture",t)}function Ql(e,t){for(tu[e]=t,e=0;e<t.length;e++)eu.add(t[e])}var rv=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]*$"),nu={},lu={};function ov(e){return Nn.call(lu,e)?!0:Nn.call(nu,e)?!1:rv.test(e)?lu[e]=!0:(nu[e]=!0,!1)}function Li(e,t,n){if(ov(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function $i(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function vn(e,t,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+l)}}function Bt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function au(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cv(e,t,n){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var s=l.get,r=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(f){n=""+f,r.call(this,f)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(f){n=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function fr(e){if(!e._valueTracker){var t=au(e)?"checked":"value";e._valueTracker=cv(e,t,""+e[t])}}function iu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=au(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function Yi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var uv=/[\n"\\]/g;function qt(e){return e.replace(uv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function hr(e,t,n,l,s,r,f,p){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Bt(t)):e.value!==""+Bt(t)&&(e.value=""+Bt(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?pr(e,f,Bt(t)):n!=null?pr(e,f,Bt(n)):l!=null&&e.removeAttribute("value"),s==null&&r!=null&&(e.defaultChecked=!!r),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.name=""+Bt(p):e.removeAttribute("name")}function su(e,t,n,l,s,r,f,p){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null)){fr(e);return}n=n!=null?""+Bt(n):"",t=t!=null?""+Bt(t):n,p||t===e.value||(e.value=t),e.defaultValue=t}l=l??s,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=p?e.checked:!!l,e.defaultChecked=!!l,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),fr(e)}function pr(e,t,n){t==="number"&&Yi(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Vl(e,t,n,l){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&l&&(e[n].defaultSelected=!0)}else{for(n=""+Bt(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,l&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function ru(e,t,n){if(t!=null&&(t=""+Bt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Bt(n):""}function ou(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(o(92));if(ne(l)){if(1<l.length)throw Error(o(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=Bt(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),fr(e)}function Wl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var dv=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 cu(e,t,n){var l=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,n):typeof n!="number"||n===0||dv.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function uu(e,t,n){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,n!=null){for(var l in n)!n.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var s in t)l=t[s],t.hasOwnProperty(s)&&n[s]!==l&&cu(e,s,l)}else for(var r in t)t.hasOwnProperty(r)&&cu(e,r,t[r])}function vr(e){if(e.indexOf("-")===-1)return!1;switch(e){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 fv=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"]]),hv=/^[\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 Gi(e){return hv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function gn(){}var gr=null;function mr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Kl=null,Zl=null;function du(e){var t=Gl(e);if(t&&(e=t.stateNode)){var n=e[yt]||null;e:switch(e=t.stateNode,t.type){case"input":if(hr(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+qt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var s=l[yt]||null;if(!s)throw Error(o(90));hr(l,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&iu(l)}break e;case"textarea":ru(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Vl(e,!!n.multiple,t,!1)}}}var yr=!1;function fu(e,t,n){if(yr)return e(t,n);yr=!0;try{var l=e(t);return l}finally{if(yr=!1,(Kl!==null||Zl!==null)&&(_s(),Kl&&(t=Kl,e=Zl,Zl=Kl=null,du(t),e)))for(t=0;t<e.length;t++)du(e[t])}}function Ha(e,t){var n=e.stateNode;if(n===null)return null;var l=n[yt]||null;if(l===null)return null;n=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(o(231,t,typeof n));return n}var mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xr=!1;if(mn)try{var Ua={};Object.defineProperty(Ua,"passive",{get:function(){xr=!0}}),window.addEventListener("test",Ua,Ua),window.removeEventListener("test",Ua,Ua)}catch{xr=!1}var $n=null,br=null,Xi=null;function hu(){if(Xi)return Xi;var e,t=br,n=t.length,l,s="value"in $n?$n.value:$n.textContent,r=s.length;for(e=0;e<n&&t[e]===s[e];e++);var f=n-e;for(l=1;l<=f&&t[n-l]===s[r-l];l++);return Xi=s.slice(e,1<l?1-l:void 0)}function Qi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Vi(){return!0}function pu(){return!1}function St(e){function t(n,l,s,r,f){this._reactName=n,this._targetInst=s,this.type=l,this.nativeEvent=r,this.target=f,this.currentTarget=null;for(var p in e)e.hasOwnProperty(p)&&(n=e[p],this[p]=n?n(r):r[p]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?Vi:pu,this.isPropagationStopped=pu,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Vi)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Vi)},persist:function(){},isPersistent:Vi}),t}var yl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wi=St(yl),Ba=b({},yl,{view:0,detail:0}),pv=St(Ba),jr,Sr,qa,Ki=b({},Ba,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==qa&&(qa&&e.type==="mousemove"?(jr=e.screenX-qa.screenX,Sr=e.screenY-qa.screenY):Sr=jr=0,qa=e),jr)},movementY:function(e){return"movementY"in e?e.movementY:Sr}}),vu=St(Ki),vv=b({},Ki,{dataTransfer:0}),gv=St(vv),mv=b({},Ba,{relatedTarget:0}),kr=St(mv),yv=b({},yl,{animationName:0,elapsedTime:0,pseudoElement:0}),xv=St(yv),bv=b({},yl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jv=St(bv),Sv=b({},yl,{data:0}),gu=St(Sv),kv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wv={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"},zv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Tv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=zv[e])?!!t[e]:!1}function wr(){return Tv}var Cv=b({},Ba,{key:function(e){if(e.key){var t=kv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Qi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wr,charCode:function(e){return e.type==="keypress"?Qi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Qi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Mv=St(Cv),Ev=b({},Ki,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mu=St(Ev),_v=b({},Ba,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wr}),Av=St(_v),Dv=b({},yl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Rv=St(Dv),Ov=b({},Ki,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Nv=St(Ov),Hv=b({},yl,{newState:0,oldState:0}),Uv=St(Hv),Bv=[9,13,27,32],zr=mn&&"CompositionEvent"in window,La=null;mn&&"documentMode"in document&&(La=document.documentMode);var qv=mn&&"TextEvent"in window&&!La,yu=mn&&(!zr||La&&8<La&&11>=La),xu=" ",bu=!1;function ju(e,t){switch(e){case"keyup":return Bv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Su(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Fl=!1;function Lv(e,t){switch(e){case"compositionend":return Su(t);case"keypress":return t.which!==32?null:(bu=!0,xu);case"textInput":return e=t.data,e===xu&&bu?null:e;default:return null}}function $v(e,t){if(Fl)return e==="compositionend"||!zr&&ju(e,t)?(e=hu(),Xi=br=$n=null,Fl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return yu&&t.locale!=="ko"?null:t.data;default:return null}}var Yv={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 ku(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Yv[e.type]:t==="textarea"}function wu(e,t,n,l){Kl?Zl?Zl.push(l):Zl=[l]:Kl=l,t=Us(t,"onChange"),0<t.length&&(n=new Wi("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var $a=null,Ya=null;function Gv(e){rh(e,0)}function Zi(e){var t=Na(e);if(iu(t))return e}function zu(e,t){if(e==="change")return t}var Tu=!1;if(mn){var Tr;if(mn){var Cr="oninput"in document;if(!Cr){var Cu=document.createElement("div");Cu.setAttribute("oninput","return;"),Cr=typeof Cu.oninput=="function"}Tr=Cr}else Tr=!1;Tu=Tr&&(!document.documentMode||9<document.documentMode)}function Mu(){$a&&($a.detachEvent("onpropertychange",Eu),Ya=$a=null)}function Eu(e){if(e.propertyName==="value"&&Zi(Ya)){var t=[];wu(t,Ya,e,mr(e)),fu(Gv,t)}}function Xv(e,t,n){e==="focusin"?(Mu(),$a=t,Ya=n,$a.attachEvent("onpropertychange",Eu)):e==="focusout"&&Mu()}function Qv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zi(Ya)}function Vv(e,t){if(e==="click")return Zi(t)}function Wv(e,t){if(e==="input"||e==="change")return Zi(t)}function Kv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Et=typeof Object.is=="function"?Object.is:Kv;function Ga(e,t){if(Et(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var s=n[l];if(!Nn.call(t,s)||!Et(e[s],t[s]))return!1}return!0}function _u(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Au(e,t){var n=_u(e);e=0;for(var l;n;){if(n.nodeType===3){if(l=e+n.textContent.length,e<=t&&l>=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=_u(n)}}function Du(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Du(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ru(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Yi(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yi(e.document)}return t}function Mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Zv=mn&&"documentMode"in document&&11>=document.documentMode,Jl=null,Er=null,Xa=null,_r=!1;function Ou(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_r||Jl==null||Jl!==Yi(l)||(l=Jl,"selectionStart"in l&&Mr(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Xa&&Ga(Xa,l)||(Xa=l,l=Us(Er,"onSelect"),0<l.length&&(t=new Wi("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Jl)))}function xl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Il={animationend:xl("Animation","AnimationEnd"),animationiteration:xl("Animation","AnimationIteration"),animationstart:xl("Animation","AnimationStart"),transitionrun:xl("Transition","TransitionRun"),transitionstart:xl("Transition","TransitionStart"),transitioncancel:xl("Transition","TransitionCancel"),transitionend:xl("Transition","TransitionEnd")},Ar={},Nu={};mn&&(Nu=document.createElement("div").style,"AnimationEvent"in window||(delete Il.animationend.animation,delete Il.animationiteration.animation,delete Il.animationstart.animation),"TransitionEvent"in window||delete Il.transitionend.transition);function bl(e){if(Ar[e])return Ar[e];if(!Il[e])return e;var t=Il[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Nu)return Ar[e]=t[n];return e}var Hu=bl("animationend"),Uu=bl("animationiteration"),Bu=bl("animationstart"),Fv=bl("transitionrun"),Jv=bl("transitionstart"),Iv=bl("transitioncancel"),qu=bl("transitionend"),Lu=new Map,Dr="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(" ");Dr.push("scrollEnd");function tn(e,t){Lu.set(e,t),ml(t,[e])}var Fi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Lt=[],Pl=0,Rr=0;function Ji(){for(var e=Pl,t=Rr=Pl=0;t<e;){var n=Lt[t];Lt[t++]=null;var l=Lt[t];Lt[t++]=null;var s=Lt[t];Lt[t++]=null;var r=Lt[t];if(Lt[t++]=null,l!==null&&s!==null){var f=l.pending;f===null?s.next=s:(s.next=f.next,f.next=s),l.pending=s}r!==0&&$u(n,s,r)}}function Ii(e,t,n,l){Lt[Pl++]=e,Lt[Pl++]=t,Lt[Pl++]=n,Lt[Pl++]=l,Rr|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Or(e,t,n,l){return Ii(e,t,n,l),Pi(e)}function jl(e,t){return Ii(e,null,null,t),Pi(e)}function $u(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var s=!1,r=e.return;r!==null;)r.childLanes|=n,l=r.alternate,l!==null&&(l.childLanes|=n),r.tag===22&&(e=r.stateNode,e===null||e._visibility&1||(s=!0)),e=r,r=r.return;return e.tag===3?(r=e.stateNode,s&&t!==null&&(s=31-ut(n),e=r.hiddenUpdates,l=e[s],l===null?e[s]=[t]:l.push(t),t.lane=n|536870912),r):null}function Pi(e){if(50<fi)throw fi=0,Xo=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ea={};function Pv(e,t,n,l){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _t(e,t,n,l){return new Pv(e,t,n,l)}function Nr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function yn(e,t){var n=e.alternate;return n===null?(n=_t(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Yu(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function es(e,t,n,l,s,r){var f=0;if(l=e,typeof e=="function")Nr(e)&&(f=1);else if(typeof e=="string")f=am(e,n,I.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=_t(31,n,t,s),e.elementType=G,e.lanes=r,e;case K:return Sl(n.children,s,r,t);case M:f=8,s|=24;break;case z:return e=_t(12,n,t,s|2),e.elementType=z,e.lanes=r,e;case re:return e=_t(13,n,t,s),e.elementType=re,e.lanes=r,e;case q:return e=_t(19,n,t,s),e.elementType=q,e.lanes=r,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case U:f=10;break e;case D:f=9;break e;case F:f=11;break e;case N:f=14;break e;case Y:f=16,l=null;break e}f=29,n=Error(o(130,e===null?"null":typeof e,"")),l=null}return t=_t(f,n,t,s),t.elementType=e,t.type=l,t.lanes=r,t}function Sl(e,t,n,l){return e=_t(7,e,l,t),e.lanes=n,e}function Hr(e,t,n){return e=_t(6,e,null,t),e.lanes=n,e}function Gu(e){var t=_t(18,null,null,0);return t.stateNode=e,t}function Ur(e,t,n){return t=_t(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Xu=new WeakMap;function $t(e,t){if(typeof e=="object"&&e!==null){var n=Xu.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Hl(t)},Xu.set(e,t),t)}return{value:e,source:t,stack:Hl(t)}}var ta=[],na=0,ts=null,Qa=0,Yt=[],Gt=0,Yn=null,rn=1,on="";function xn(e,t){ta[na++]=Qa,ta[na++]=ts,ts=e,Qa=t}function Qu(e,t,n){Yt[Gt++]=rn,Yt[Gt++]=on,Yt[Gt++]=Yn,Yn=e;var l=rn;e=on;var s=32-ut(l)-1;l&=~(1<<s),n+=1;var r=32-ut(t)+s;if(30<r){var f=s-s%5;r=(l&(1<<f)-1).toString(32),l>>=f,s-=f,rn=1<<32-ut(t)+s|n<<s|l,on=r+e}else rn=1<<r|n<<s|l,on=e}function Br(e){e.return!==null&&(xn(e,1),Qu(e,1,0))}function qr(e){for(;e===ts;)ts=ta[--na],ta[na]=null,Qa=ta[--na],ta[na]=null;for(;e===Yn;)Yn=Yt[--Gt],Yt[Gt]=null,on=Yt[--Gt],Yt[Gt]=null,rn=Yt[--Gt],Yt[Gt]=null}function Vu(e,t){Yt[Gt++]=rn,Yt[Gt++]=on,Yt[Gt++]=Yn,rn=t.id,on=t.overflow,Yn=e}var dt=null,Xe=null,Ee=!1,Gn=null,Xt=!1,Lr=Error(o(519));function Xn(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Va($t(t,e)),Lr}function Wu(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[at]=e,t[yt]=l,n){case"dialog":Te("cancel",t),Te("close",t);break;case"iframe":case"object":case"embed":Te("load",t);break;case"video":case"audio":for(n=0;n<pi.length;n++)Te(pi[n],t);break;case"source":Te("error",t);break;case"img":case"image":case"link":Te("error",t),Te("load",t);break;case"details":Te("toggle",t);break;case"input":Te("invalid",t),su(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Te("invalid",t);break;case"textarea":Te("invalid",t),ou(t,l.value,l.defaultValue,l.children)}n=l.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||l.suppressHydrationWarning===!0||dh(t.textContent,n)?(l.popover!=null&&(Te("beforetoggle",t),Te("toggle",t)),l.onScroll!=null&&Te("scroll",t),l.onScrollEnd!=null&&Te("scrollend",t),l.onClick!=null&&(t.onclick=gn),t=!0):t=!1,t||Xn(e,!0)}function Ku(e){for(dt=e.return;dt;)switch(dt.tag){case 5:case 31:case 13:Xt=!1;return;case 27:case 3:Xt=!0;return;default:dt=dt.return}}function la(e){if(e!==dt)return!1;if(!Ee)return Ku(e),Ee=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||ic(e.type,e.memoizedProps)),n=!n),n&&Xe&&Xn(e),Ku(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=bh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=bh(e)}else t===27?(t=Xe,al(e.type)?(e=uc,uc=null,Xe=e):Xe=t):Xe=dt?Vt(e.stateNode.nextSibling):null;return!0}function kl(){Xe=dt=null,Ee=!1}function $r(){var e=Gn;return e!==null&&(Tt===null?Tt=e:Tt.push.apply(Tt,e),Gn=null),e}function Va(e){Gn===null?Gn=[e]:Gn.push(e)}var Yr=T(null),wl=null,bn=null;function Qn(e,t,n){Z(Yr,t._currentValue),t._currentValue=n}function jn(e){e._currentValue=Yr.current,_(Yr)}function Gr(e,t,n){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===n)break;e=e.return}}function Xr(e,t,n,l){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var r=s.dependencies;if(r!==null){var f=s.child;r=r.firstContext;e:for(;r!==null;){var p=r;r=s;for(var w=0;w<t.length;w++)if(p.context===t[w]){r.lanes|=n,p=r.alternate,p!==null&&(p.lanes|=n),Gr(r.return,n,e),l||(f=null);break e}r=p.next}}else if(s.tag===18){if(f=s.return,f===null)throw Error(o(341));f.lanes|=n,r=f.alternate,r!==null&&(r.lanes|=n),Gr(f,n,e),f=null}else f=s.child;if(f!==null)f.return=s;else for(f=s;f!==null;){if(f===e){f=null;break}if(s=f.sibling,s!==null){s.return=f.return,f=s;break}f=f.return}s=f}}function aa(e,t,n,l){e=null;for(var s=t,r=!1;s!==null;){if(!r){if((s.flags&524288)!==0)r=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var f=s.alternate;if(f===null)throw Error(o(387));if(f=f.memoizedProps,f!==null){var p=s.type;Et(s.pendingProps.value,f.value)||(e!==null?e.push(p):e=[p])}}else if(s===be.current){if(f=s.alternate,f===null)throw Error(o(387));f.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(xi):e=[xi])}s=s.return}e!==null&&Xr(t,e,n,l),t.flags|=262144}function ns(e){for(e=e.firstContext;e!==null;){if(!Et(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function zl(e){wl=e,bn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ft(e){return Zu(wl,e)}function ls(e,t){return wl===null&&zl(e),Zu(e,t)}function Zu(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},bn===null){if(e===null)throw Error(o(308));bn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else bn=bn.next=t;return n}var eg=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},tg=i.unstable_scheduleCallback,ng=i.unstable_NormalPriority,et={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qr(){return{controller:new eg,data:new Map,refCount:0}}function Wa(e){e.refCount--,e.refCount===0&&tg(ng,function(){e.controller.abort()})}var Ka=null,Vr=0,ia=0,sa=null;function lg(e,t){if(Ka===null){var n=Ka=[];Vr=0,ia=Fo(),sa={status:"pending",value:void 0,then:function(l){n.push(l)}}}return Vr++,t.then(Fu,Fu),t}function Fu(){if(--Vr===0&&Ka!==null){sa!==null&&(sa.status="fulfilled");var e=Ka;Ka=null,ia=0,sa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ag(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(s){n.push(s)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var s=0;s<n.length;s++)(0,n[s])(t)},function(s){for(l.status="rejected",l.reason=s,s=0;s<n.length;s++)(0,n[s])(void 0)}),l}var Ju=E.S;E.S=function(e,t){Nf=mt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&lg(e,t),Ju!==null&&Ju(e,t)};var Tl=T(null);function Wr(){var e=Tl.current;return e!==null?e:Ye.pooledCache}function as(e,t){t===null?Z(Tl,Tl.current):Z(Tl,t.pool)}function Iu(){var e=Wr();return e===null?null:{parent:et._currentValue,pool:e}}var ra=Error(o(460)),Kr=Error(o(474)),is=Error(o(542)),ss={then:function(){}};function Pu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ed(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(gn,gn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,nd(e),e;default:if(typeof t.status=="string")t.then(gn,gn);else{if(e=Ye,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=l}},function(l){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,nd(e),e}throw Ml=t,ra}}function Cl(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ml=n,ra):n}}var Ml=null;function td(){if(Ml===null)throw Error(o(459));var e=Ml;return Ml=null,e}function nd(e){if(e===ra||e===is)throw Error(o(483))}var oa=null,Za=0;function rs(e){var t=Za;return Za+=1,oa===null&&(oa=[]),ed(oa,e,t)}function Fa(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function os(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function ld(e){function t(A,C){if(e){var R=A.deletions;R===null?(A.deletions=[C],A.flags|=16):R.push(C)}}function n(A,C){if(!e)return null;for(;C!==null;)t(A,C),C=C.sibling;return null}function l(A){for(var C=new Map;A!==null;)A.key!==null?C.set(A.key,A):C.set(A.index,A),A=A.sibling;return C}function s(A,C){return A=yn(A,C),A.index=0,A.sibling=null,A}function r(A,C,R){return A.index=R,e?(R=A.alternate,R!==null?(R=R.index,R<C?(A.flags|=67108866,C):R):(A.flags|=67108866,C)):(A.flags|=1048576,C)}function f(A){return e&&A.alternate===null&&(A.flags|=67108866),A}function p(A,C,R,V){return C===null||C.tag!==6?(C=Hr(R,A.mode,V),C.return=A,C):(C=s(C,R),C.return=A,C)}function w(A,C,R,V){var ve=R.type;return ve===K?X(A,C,R.props.children,V,R.key):C!==null&&(C.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===Y&&Cl(ve)===C.type)?(C=s(C,R.props),Fa(C,R),C.return=A,C):(C=es(R.type,R.key,R.props,null,A.mode,V),Fa(C,R),C.return=A,C)}function O(A,C,R,V){return C===null||C.tag!==4||C.stateNode.containerInfo!==R.containerInfo||C.stateNode.implementation!==R.implementation?(C=Ur(R,A.mode,V),C.return=A,C):(C=s(C,R.children||[]),C.return=A,C)}function X(A,C,R,V,ve){return C===null||C.tag!==7?(C=Sl(R,A.mode,V,ve),C.return=A,C):(C=s(C,R),C.return=A,C)}function W(A,C,R){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=Hr(""+C,A.mode,R),C.return=A,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case k:return R=es(C.type,C.key,C.props,null,A.mode,R),Fa(R,C),R.return=A,R;case B:return C=Ur(C,A.mode,R),C.return=A,C;case Y:return C=Cl(C),W(A,C,R)}if(ne(C)||J(C))return C=Sl(C,A.mode,R,null),C.return=A,C;if(typeof C.then=="function")return W(A,rs(C),R);if(C.$$typeof===U)return W(A,ls(A,C),R);os(A,C)}return null}function H(A,C,R,V){var ve=C!==null?C.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return ve!==null?null:p(A,C,""+R,V);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case k:return R.key===ve?w(A,C,R,V):null;case B:return R.key===ve?O(A,C,R,V):null;case Y:return R=Cl(R),H(A,C,R,V)}if(ne(R)||J(R))return ve!==null?null:X(A,C,R,V,null);if(typeof R.then=="function")return H(A,C,rs(R),V);if(R.$$typeof===U)return H(A,C,ls(A,R),V);os(A,R)}return null}function L(A,C,R,V,ve){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return A=A.get(R)||null,p(C,A,""+V,ve);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case k:return A=A.get(V.key===null?R:V.key)||null,w(C,A,V,ve);case B:return A=A.get(V.key===null?R:V.key)||null,O(C,A,V,ve);case Y:return V=Cl(V),L(A,C,R,V,ve)}if(ne(V)||J(V))return A=A.get(R)||null,X(C,A,V,ve,null);if(typeof V.then=="function")return L(A,C,R,rs(V),ve);if(V.$$typeof===U)return L(A,C,R,ls(C,V),ve);os(C,V)}return null}function he(A,C,R,V){for(var ve=null,Ae=null,pe=C,ke=C=0,Me=null;pe!==null&&ke<R.length;ke++){pe.index>ke?(Me=pe,pe=null):Me=pe.sibling;var De=H(A,pe,R[ke],V);if(De===null){pe===null&&(pe=Me);break}e&&pe&&De.alternate===null&&t(A,pe),C=r(De,C,ke),Ae===null?ve=De:Ae.sibling=De,Ae=De,pe=Me}if(ke===R.length)return n(A,pe),Ee&&xn(A,ke),ve;if(pe===null){for(;ke<R.length;ke++)pe=W(A,R[ke],V),pe!==null&&(C=r(pe,C,ke),Ae===null?ve=pe:Ae.sibling=pe,Ae=pe);return Ee&&xn(A,ke),ve}for(pe=l(pe);ke<R.length;ke++)Me=L(pe,A,ke,R[ke],V),Me!==null&&(e&&Me.alternate!==null&&pe.delete(Me.key===null?ke:Me.key),C=r(Me,C,ke),Ae===null?ve=Me:Ae.sibling=Me,Ae=Me);return e&&pe.forEach(function(cl){return t(A,cl)}),Ee&&xn(A,ke),ve}function ye(A,C,R,V){if(R==null)throw Error(o(151));for(var ve=null,Ae=null,pe=C,ke=C=0,Me=null,De=R.next();pe!==null&&!De.done;ke++,De=R.next()){pe.index>ke?(Me=pe,pe=null):Me=pe.sibling;var cl=H(A,pe,De.value,V);if(cl===null){pe===null&&(pe=Me);break}e&&pe&&cl.alternate===null&&t(A,pe),C=r(cl,C,ke),Ae===null?ve=cl:Ae.sibling=cl,Ae=cl,pe=Me}if(De.done)return n(A,pe),Ee&&xn(A,ke),ve;if(pe===null){for(;!De.done;ke++,De=R.next())De=W(A,De.value,V),De!==null&&(C=r(De,C,ke),Ae===null?ve=De:Ae.sibling=De,Ae=De);return Ee&&xn(A,ke),ve}for(pe=l(pe);!De.done;ke++,De=R.next())De=L(pe,A,ke,De.value,V),De!==null&&(e&&De.alternate!==null&&pe.delete(De.key===null?ke:De.key),C=r(De,C,ke),Ae===null?ve=De:Ae.sibling=De,Ae=De);return e&&pe.forEach(function(vm){return t(A,vm)}),Ee&&xn(A,ke),ve}function Le(A,C,R,V){if(typeof R=="object"&&R!==null&&R.type===K&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case k:e:{for(var ve=R.key;C!==null;){if(C.key===ve){if(ve=R.type,ve===K){if(C.tag===7){n(A,C.sibling),V=s(C,R.props.children),V.return=A,A=V;break e}}else if(C.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===Y&&Cl(ve)===C.type){n(A,C.sibling),V=s(C,R.props),Fa(V,R),V.return=A,A=V;break e}n(A,C);break}else t(A,C);C=C.sibling}R.type===K?(V=Sl(R.props.children,A.mode,V,R.key),V.return=A,A=V):(V=es(R.type,R.key,R.props,null,A.mode,V),Fa(V,R),V.return=A,A=V)}return f(A);case B:e:{for(ve=R.key;C!==null;){if(C.key===ve)if(C.tag===4&&C.stateNode.containerInfo===R.containerInfo&&C.stateNode.implementation===R.implementation){n(A,C.sibling),V=s(C,R.children||[]),V.return=A,A=V;break e}else{n(A,C);break}else t(A,C);C=C.sibling}V=Ur(R,A.mode,V),V.return=A,A=V}return f(A);case Y:return R=Cl(R),Le(A,C,R,V)}if(ne(R))return he(A,C,R,V);if(J(R)){if(ve=J(R),typeof ve!="function")throw Error(o(150));return R=ve.call(R),ye(A,C,R,V)}if(typeof R.then=="function")return Le(A,C,rs(R),V);if(R.$$typeof===U)return Le(A,C,ls(A,R),V);os(A,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,C!==null&&C.tag===6?(n(A,C.sibling),V=s(C,R),V.return=A,A=V):(n(A,C),V=Hr(R,A.mode,V),V.return=A,A=V),f(A)):n(A,C)}return function(A,C,R,V){try{Za=0;var ve=Le(A,C,R,V);return oa=null,ve}catch(pe){if(pe===ra||pe===is)throw pe;var Ae=_t(29,pe,null,A.mode);return Ae.lanes=V,Ae.return=A,Ae}}}var El=ld(!0),ad=ld(!1),Vn=!1;function Zr(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fr(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Wn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Kn(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Oe&2)!==0){var s=l.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),l.pending=t,t=Pi(e),$u(e,null,n),t}return Ii(e,l,t,n),Pi(e)}function Ja(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Bi(e,n)}}function Jr(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var s=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var f={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?s=r=f:r=r.next=f,n=n.next}while(n!==null);r===null?s=r=t:r=r.next=t}else s=r=t;n={baseState:l.baseState,firstBaseUpdate:s,lastBaseUpdate:r,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ir=!1;function Ia(){if(Ir){var e=sa;if(e!==null)throw e}}function Pa(e,t,n,l){Ir=!1;var s=e.updateQueue;Vn=!1;var r=s.firstBaseUpdate,f=s.lastBaseUpdate,p=s.shared.pending;if(p!==null){s.shared.pending=null;var w=p,O=w.next;w.next=null,f===null?r=O:f.next=O,f=w;var X=e.alternate;X!==null&&(X=X.updateQueue,p=X.lastBaseUpdate,p!==f&&(p===null?X.firstBaseUpdate=O:p.next=O,X.lastBaseUpdate=w))}if(r!==null){var W=s.baseState;f=0,X=O=w=null,p=r;do{var H=p.lane&-536870913,L=H!==p.lane;if(L?(Ce&H)===H:(l&H)===H){H!==0&&H===ia&&(Ir=!0),X!==null&&(X=X.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var he=e,ye=p;H=t;var Le=n;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){W=he.call(Le,W,H);break e}W=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,H=typeof he=="function"?he.call(Le,W,H):he,H==null)break e;W=b({},W,H);break e;case 2:Vn=!0}}H=p.callback,H!==null&&(e.flags|=64,L&&(e.flags|=8192),L=s.callbacks,L===null?s.callbacks=[H]:L.push(H))}else L={lane:H,tag:p.tag,payload:p.payload,callback:p.callback,next:null},X===null?(O=X=L,w=W):X=X.next=L,f|=H;if(p=p.next,p===null){if(p=s.shared.pending,p===null)break;L=p,p=L.next,L.next=null,s.lastBaseUpdate=L,s.shared.pending=null}}while(!0);X===null&&(w=W),s.baseState=w,s.firstBaseUpdate=O,s.lastBaseUpdate=X,r===null&&(s.shared.lanes=0),Pn|=f,e.lanes=f,e.memoizedState=W}}function id(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function sd(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)id(n[e],t)}var ca=T(null),cs=T(0);function rd(e,t){e=_n,Z(cs,e),Z(ca,t),_n=e|t.baseLanes}function Pr(){Z(cs,_n),Z(ca,ca.current)}function eo(){_n=cs.current,_(ca),_(cs)}var At=T(null),Qt=null;function Zn(e){var t=e.alternate;Z(Ie,Ie.current&1),Z(At,e),Qt===null&&(t===null||ca.current!==null||t.memoizedState!==null)&&(Qt=e)}function to(e){Z(Ie,Ie.current),Z(At,e),Qt===null&&(Qt=e)}function od(e){e.tag===22?(Z(Ie,Ie.current),Z(At,e),Qt===null&&(Qt=e)):Fn()}function Fn(){Z(Ie,Ie.current),Z(At,At.current)}function Dt(e){_(At),Qt===e&&(Qt=null),_(Ie)}var Ie=T(0);function us(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||oc(n)||cc(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Sn=0,Se=null,Be=null,tt=null,ds=!1,ua=!1,_l=!1,fs=0,ei=0,da=null,ig=0;function Ke(){throw Error(o(321))}function no(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Et(e[n],t[n]))return!1;return!0}function lo(e,t,n,l,s,r){return Sn=r,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Qd:xo,_l=!1,r=n(l,s),_l=!1,ua&&(r=ud(t,n,l,s)),cd(e),r}function cd(e){E.H=li;var t=Be!==null&&Be.next!==null;if(Sn=0,tt=Be=Se=null,ds=!1,ei=0,da=null,t)throw Error(o(300));e===null||nt||(e=e.dependencies,e!==null&&ns(e)&&(nt=!0))}function ud(e,t,n,l){Se=e;var s=0;do{if(ua&&(da=null),ei=0,ua=!1,25<=s)throw Error(o(301));if(s+=1,tt=Be=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}E.H=Vd,r=t(n,l)}while(ua);return r}function sg(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?ti(t):t,e=e.useState()[0],(Be!==null?Be.memoizedState:null)!==e&&(Se.flags|=1024),t}function ao(){var e=fs!==0;return fs=0,e}function io(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function so(e){if(ds){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ds=!1}Sn=0,tt=Be=Se=null,ua=!1,ei=fs=0,da=null}function jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tt===null?Se.memoizedState=tt=e:tt=tt.next=e,tt}function Pe(){if(Be===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Be.next;var t=tt===null?Se.memoizedState:tt.next;if(t!==null)tt=t,Be=e;else{if(e===null)throw Se.alternate===null?Error(o(467)):Error(o(310));Be=e,e={memoizedState:Be.memoizedState,baseState:Be.baseState,baseQueue:Be.baseQueue,queue:Be.queue,next:null},tt===null?Se.memoizedState=tt=e:tt=tt.next=e}return tt}function hs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ti(e){var t=ei;return ei+=1,da===null&&(da=[]),e=ed(da,e,t),t=Se,(tt===null?t.memoizedState:tt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Qd:xo),e}function ps(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ti(e);if(e.$$typeof===U)return ft(e)}throw Error(o(438,String(e)))}function ro(e){var t=null,n=Se.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=Se.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=hs(),Se.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),l=0;l<e;l++)n[l]=fe;return t.index++,n}function kn(e,t){return typeof t=="function"?t(e):t}function vs(e){var t=Pe();return oo(t,Be,e)}function oo(e,t,n){var l=e.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=n;var s=e.baseQueue,r=l.pending;if(r!==null){if(s!==null){var f=s.next;s.next=r.next,r.next=f}t.baseQueue=s=r,l.pending=null}if(r=e.baseState,s===null)e.memoizedState=r;else{t=s.next;var p=f=null,w=null,O=t,X=!1;do{var W=O.lane&-536870913;if(W!==O.lane?(Ce&W)===W:(Sn&W)===W){var H=O.revertLane;if(H===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null}),W===ia&&(X=!0);else if((Sn&H)===H){O=O.next,H===ia&&(X=!0);continue}else W={lane:0,revertLane:O.revertLane,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},w===null?(p=w=W,f=r):w=w.next=W,Se.lanes|=H,Pn|=H;W=O.action,_l&&n(r,W),r=O.hasEagerState?O.eagerState:n(r,W)}else H={lane:W,revertLane:O.revertLane,gesture:O.gesture,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},w===null?(p=w=H,f=r):w=w.next=H,Se.lanes|=W,Pn|=W;O=O.next}while(O!==null&&O!==t);if(w===null?f=r:w.next=p,!Et(r,e.memoizedState)&&(nt=!0,X&&(n=sa,n!==null)))throw n;e.memoizedState=r,e.baseState=f,e.baseQueue=w,l.lastRenderedState=r}return s===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function co(e){var t=Pe(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var l=n.dispatch,s=n.pending,r=t.memoizedState;if(s!==null){n.pending=null;var f=s=s.next;do r=e(r,f.action),f=f.next;while(f!==s);Et(r,t.memoizedState)||(nt=!0),t.memoizedState=r,t.baseQueue===null&&(t.baseState=r),n.lastRenderedState=r}return[r,l]}function dd(e,t,n){var l=Se,s=Pe(),r=Ee;if(r){if(n===void 0)throw Error(o(407));n=n()}else n=t();var f=!Et((Be||s).memoizedState,n);if(f&&(s.memoizedState=n,nt=!0),s=s.queue,ho(pd.bind(null,l,s,e),[e]),s.getSnapshot!==t||f||tt!==null&&tt.memoizedState.tag&1){if(l.flags|=2048,fa(9,{destroy:void 0},hd.bind(null,l,s,n,t),null),Ye===null)throw Error(o(349));r||(Sn&127)!==0||fd(l,t,n)}return n}function fd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Se.updateQueue,t===null?(t=hs(),Se.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function hd(e,t,n,l){t.value=n,t.getSnapshot=l,vd(t)&&gd(e)}function pd(e,t,n){return n(function(){vd(t)&&gd(e)})}function vd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Et(e,n)}catch{return!0}}function gd(e){var t=jl(e,2);t!==null&&Ct(t,e,2)}function uo(e){var t=jt();if(typeof e=="function"){var n=e;if(e=n(),_l){Ft(!0);try{n()}finally{Ft(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kn,lastRenderedState:e},t}function md(e,t,n,l){return e.baseState=n,oo(e,Be,typeof l=="function"?l:kn)}function rg(e,t,n,l,s){if(ys(e))throw Error(o(485));if(e=t.action,e!==null){var r={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){r.listeners.push(f)}};E.T!==null?n(!0):r.isTransition=!1,l(r),n=t.pending,n===null?(r.next=t.pending=r,yd(t,r)):(r.next=n.next,t.pending=n.next=r)}}function yd(e,t){var n=t.action,l=t.payload,s=e.state;if(t.isTransition){var r=E.T,f={};E.T=f;try{var p=n(s,l),w=E.S;w!==null&&w(f,p),xd(e,t,p)}catch(O){fo(e,t,O)}finally{r!==null&&f.types!==null&&(r.types=f.types),E.T=r}}else try{r=n(s,l),xd(e,t,r)}catch(O){fo(e,t,O)}}function xd(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){bd(e,t,l)},function(l){return fo(e,t,l)}):bd(e,t,n)}function bd(e,t,n){t.status="fulfilled",t.value=n,jd(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,yd(e,n)))}function fo(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,jd(t),t=t.next;while(t!==l)}e.action=null}function jd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Sd(e,t){return t}function kd(e,t){if(Ee){var n=Ye.formState;if(n!==null){e:{var l=Se;if(Ee){if(Xe){t:{for(var s=Xe,r=Xt;s.nodeType!==8;){if(!r){s=null;break t}if(s=Vt(s.nextSibling),s===null){s=null;break t}}r=s.data,s=r==="F!"||r==="F"?s:null}if(s){Xe=Vt(s.nextSibling),l=s.data==="F!";break e}}Xn(l)}l=!1}l&&(t=n[0])}}return n=jt(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sd,lastRenderedState:t},n.queue=l,n=Yd.bind(null,Se,l),l.dispatch=n,l=uo(!1),r=yo.bind(null,Se,!1,l.queue),l=jt(),s={state:t,dispatch:null,action:e,pending:null},l.queue=s,n=rg.bind(null,Se,s,r,n),s.dispatch=n,l.memoizedState=e,[t,n,!1]}function wd(e){var t=Pe();return zd(t,Be,e)}function zd(e,t,n){if(t=oo(e,t,Sd)[0],e=vs(kn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ti(t)}catch(f){throw f===ra?is:f}else l=t;t=Pe();var s=t.queue,r=s.dispatch;return n!==t.memoizedState&&(Se.flags|=2048,fa(9,{destroy:void 0},og.bind(null,s,n),null)),[l,r,e]}function og(e,t){e.action=t}function Td(e){var t=Pe(),n=Be;if(n!==null)return zd(t,n,e);Pe(),t=t.memoizedState,n=Pe();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function fa(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=Se.updateQueue,t===null&&(t=hs(),Se.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e),e}function Cd(){return Pe().memoizedState}function gs(e,t,n,l){var s=jt();Se.flags|=e,s.memoizedState=fa(1|t,{destroy:void 0},n,l===void 0?null:l)}function ms(e,t,n,l){var s=Pe();l=l===void 0?null:l;var r=s.memoizedState.inst;Be!==null&&l!==null&&no(l,Be.memoizedState.deps)?s.memoizedState=fa(t,r,n,l):(Se.flags|=e,s.memoizedState=fa(1|t,r,n,l))}function Md(e,t){gs(8390656,8,e,t)}function ho(e,t){ms(2048,8,e,t)}function cg(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=hs(),Se.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ed(e){var t=Pe().memoizedState;return cg({ref:t,nextImpl:e}),function(){if((Oe&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function _d(e,t){return ms(4,2,e,t)}function Ad(e,t){return ms(4,4,e,t)}function Dd(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Rd(e,t,n){n=n!=null?n.concat([e]):null,ms(4,4,Dd.bind(null,t,e),n)}function po(){}function Od(e,t){var n=Pe();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&no(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function Nd(e,t){var n=Pe();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&no(t,l[1]))return l[0];if(l=e(),_l){Ft(!0);try{e()}finally{Ft(!1)}}return n.memoizedState=[l,t],l}function vo(e,t,n){return n===void 0||(Sn&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Uf(),Se.lanes|=e,Pn|=e,n)}function Hd(e,t,n,l){return Et(n,t)?n:ca.current!==null?(e=vo(e,n,l),Et(e,t)||(nt=!0),e):(Sn&42)===0||(Sn&1073741824)!==0&&(Ce&261930)===0?(nt=!0,e.memoizedState=n):(e=Uf(),Se.lanes|=e,Pn|=e,t)}function Ud(e,t,n,l,s){var r=$.p;$.p=r!==0&&8>r?r:8;var f=E.T,p={};E.T=p,yo(e,!1,t,n);try{var w=s(),O=E.S;if(O!==null&&O(p,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var X=ag(w,l);ni(e,t,X,Nt(e))}else ni(e,t,l,Nt(e))}catch(W){ni(e,t,{then:function(){},status:"rejected",reason:W},Nt())}finally{$.p=r,f!==null&&p.types!==null&&(f.types=p.types),E.T=f}}function ug(){}function go(e,t,n,l){if(e.tag!==5)throw Error(o(476));var s=Bd(e).queue;Ud(e,s,t,P,n===null?ug:function(){return qd(e),n(l)})}function Bd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kn,lastRenderedState:P},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function qd(e){var t=Bd(e);t.next===null&&(t=e.alternate.memoizedState),ni(e,t.next.queue,{},Nt())}function mo(){return ft(xi)}function Ld(){return Pe().memoizedState}function $d(){return Pe().memoizedState}function dg(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Nt();e=Wn(n);var l=Kn(t,e,n);l!==null&&(Ct(l,t,n),Ja(l,t,n)),t={cache:Qr()},e.payload=t;return}t=t.return}}function fg(e,t,n){var l=Nt();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ys(e)?Gd(t,n):(n=Or(e,t,n,l),n!==null&&(Ct(n,e,l),Xd(n,t,l)))}function Yd(e,t,n){var l=Nt();ni(e,t,n,l)}function ni(e,t,n,l){var s={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ys(e))Gd(t,s);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var f=t.lastRenderedState,p=r(f,n);if(s.hasEagerState=!0,s.eagerState=p,Et(p,f))return Ii(e,t,s,0),Ye===null&&Ji(),!1}catch{}if(n=Or(e,t,s,l),n!==null)return Ct(n,e,l),Xd(n,t,l),!0}return!1}function yo(e,t,n,l){if(l={lane:2,revertLane:Fo(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ys(e)){if(t)throw Error(o(479))}else t=Or(e,n,l,2),t!==null&&Ct(t,e,2)}function ys(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Gd(e,t){ua=ds=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Xd(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Bi(e,n)}}var li={readContext:ft,use:ps,useCallback:Ke,useContext:Ke,useEffect:Ke,useImperativeHandle:Ke,useLayoutEffect:Ke,useInsertionEffect:Ke,useMemo:Ke,useReducer:Ke,useRef:Ke,useState:Ke,useDebugValue:Ke,useDeferredValue:Ke,useTransition:Ke,useSyncExternalStore:Ke,useId:Ke,useHostTransitionStatus:Ke,useFormState:Ke,useActionState:Ke,useOptimistic:Ke,useMemoCache:Ke,useCacheRefresh:Ke};li.useEffectEvent=Ke;var Qd={readContext:ft,use:ps,useCallback:function(e,t){return jt().memoizedState=[e,t===void 0?null:t],e},useContext:ft,useEffect:Md,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,gs(4194308,4,Dd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return gs(4194308,4,e,t)},useInsertionEffect:function(e,t){gs(4,2,e,t)},useMemo:function(e,t){var n=jt();t=t===void 0?null:t;var l=e();if(_l){Ft(!0);try{e()}finally{Ft(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=jt();if(n!==void 0){var s=n(t);if(_l){Ft(!0);try{n(t)}finally{Ft(!1)}}}else s=t;return l.memoizedState=l.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},l.queue=e,e=e.dispatch=fg.bind(null,Se,e),[l.memoizedState,e]},useRef:function(e){var t=jt();return e={current:e},t.memoizedState=e},useState:function(e){e=uo(e);var t=e.queue,n=Yd.bind(null,Se,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:po,useDeferredValue:function(e,t){var n=jt();return vo(n,e,t)},useTransition:function(){var e=uo(!1);return e=Ud.bind(null,Se,e.queue,!0,!1),jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Se,s=jt();if(Ee){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ye===null)throw Error(o(349));(Ce&127)!==0||fd(l,t,n)}s.memoizedState=n;var r={value:n,getSnapshot:t};return s.queue=r,Md(pd.bind(null,l,r,e),[e]),l.flags|=2048,fa(9,{destroy:void 0},hd.bind(null,l,r,n,t),null),n},useId:function(){var e=jt(),t=Ye.identifierPrefix;if(Ee){var n=on,l=rn;n=(l&~(1<<32-ut(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=fs++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=ig++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:mo,useFormState:kd,useActionState:kd,useOptimistic:function(e){var t=jt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=yo.bind(null,Se,!0,n),n.dispatch=t,[e,t]},useMemoCache:ro,useCacheRefresh:function(){return jt().memoizedState=dg.bind(null,Se)},useEffectEvent:function(e){var t=jt(),n={impl:e};return t.memoizedState=n,function(){if((Oe&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},xo={readContext:ft,use:ps,useCallback:Od,useContext:ft,useEffect:ho,useImperativeHandle:Rd,useInsertionEffect:_d,useLayoutEffect:Ad,useMemo:Nd,useReducer:vs,useRef:Cd,useState:function(){return vs(kn)},useDebugValue:po,useDeferredValue:function(e,t){var n=Pe();return Hd(n,Be.memoizedState,e,t)},useTransition:function(){var e=vs(kn)[0],t=Pe().memoizedState;return[typeof e=="boolean"?e:ti(e),t]},useSyncExternalStore:dd,useId:Ld,useHostTransitionStatus:mo,useFormState:wd,useActionState:wd,useOptimistic:function(e,t){var n=Pe();return md(n,Be,e,t)},useMemoCache:ro,useCacheRefresh:$d};xo.useEffectEvent=Ed;var Vd={readContext:ft,use:ps,useCallback:Od,useContext:ft,useEffect:ho,useImperativeHandle:Rd,useInsertionEffect:_d,useLayoutEffect:Ad,useMemo:Nd,useReducer:co,useRef:Cd,useState:function(){return co(kn)},useDebugValue:po,useDeferredValue:function(e,t){var n=Pe();return Be===null?vo(n,e,t):Hd(n,Be.memoizedState,e,t)},useTransition:function(){var e=co(kn)[0],t=Pe().memoizedState;return[typeof e=="boolean"?e:ti(e),t]},useSyncExternalStore:dd,useId:Ld,useHostTransitionStatus:mo,useFormState:Td,useActionState:Td,useOptimistic:function(e,t){var n=Pe();return Be!==null?md(n,Be,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:ro,useCacheRefresh:$d};Vd.useEffectEvent=Ed;function bo(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:b({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var jo={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=Nt(),s=Wn(l);s.payload=t,n!=null&&(s.callback=n),t=Kn(e,s,l),t!==null&&(Ct(t,e,l),Ja(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=Nt(),s=Wn(l);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Kn(e,s,l),t!==null&&(Ct(t,e,l),Ja(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Nt(),l=Wn(n);l.tag=2,t!=null&&(l.callback=t),t=Kn(e,l,n),t!==null&&(Ct(t,e,n),Ja(t,e,n))}};function Wd(e,t,n,l,s,r,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,r,f):t.prototype&&t.prototype.isPureReactComponent?!Ga(n,l)||!Ga(s,r):!0}function Kd(e,t,n,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,l),t.state!==e&&jo.enqueueReplaceState(t,t.state,null)}function Al(e,t){var n=t;if("ref"in t){n={};for(var l in t)l!=="ref"&&(n[l]=t[l])}if(e=e.defaultProps){n===t&&(n=b({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function Zd(e){Fi(e)}function Fd(e){console.error(e)}function Jd(e){Fi(e)}function xs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Id(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function So(e,t,n){return n=Wn(n),n.tag=3,n.payload={element:null},n.callback=function(){xs(e,t)},n}function Pd(e){return e=Wn(e),e.tag=3,e}function ef(e,t,n,l){var s=n.type.getDerivedStateFromError;if(typeof s=="function"){var r=l.value;e.payload=function(){return s(r)},e.callback=function(){Id(t,n,l)}}var f=n.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){Id(t,n,l),typeof s!="function"&&(el===null?el=new Set([this]):el.add(this));var p=l.stack;this.componentDidCatch(l.value,{componentStack:p!==null?p:""})})}function hg(e,t,n,l,s){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&aa(t,n,s,!0),n=At.current,n!==null){switch(n.tag){case 31:case 13:return Qt===null?As():n.alternate===null&&Ze===0&&(Ze=3),n.flags&=-257,n.flags|=65536,n.lanes=s,l===ss?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),Wo(e,l,s)),!1;case 22:return n.flags|=65536,l===ss?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([l]):n.add(l)),Wo(e,l,s)),!1}throw Error(o(435,n.tag))}return Wo(e,l,s),As(),!1}if(Ee)return t=At.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,l!==Lr&&(e=Error(o(422),{cause:l}),Va($t(e,n)))):(l!==Lr&&(t=Error(o(423),{cause:l}),Va($t(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,l=$t(l,n),s=So(e.stateNode,l,s),Jr(e,s),Ze!==4&&(Ze=2)),!1;var r=Error(o(520),{cause:l});if(r=$t(r,n),di===null?di=[r]:di.push(r),Ze!==4&&(Ze=2),t===null)return!0;l=$t(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=So(n.stateNode,l,e),Jr(n,e),!1;case 1:if(t=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(el===null||!el.has(r))))return n.flags|=65536,s&=-s,n.lanes|=s,s=Pd(s),ef(s,e,n,l),Jr(n,s),!1}n=n.return}while(n!==null);return!1}var ko=Error(o(461)),nt=!1;function ht(e,t,n,l){t.child=e===null?ad(t,null,n,l):El(t,e.child,n,l)}function tf(e,t,n,l,s){n=n.render;var r=t.ref;if("ref"in l){var f={};for(var p in l)p!=="ref"&&(f[p]=l[p])}else f=l;return zl(t),l=lo(e,t,n,f,r,s),p=ao(),e!==null&&!nt?(io(e,t,s),wn(e,t,s)):(Ee&&p&&Br(t),t.flags|=1,ht(e,t,l,s),t.child)}function nf(e,t,n,l,s){if(e===null){var r=n.type;return typeof r=="function"&&!Nr(r)&&r.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=r,lf(e,t,r,l,s)):(e=es(n.type,null,l,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(r=e.child,!Ao(e,s)){var f=r.memoizedProps;if(n=n.compare,n=n!==null?n:Ga,n(f,l)&&e.ref===t.ref)return wn(e,t,s)}return t.flags|=1,e=yn(r,l),e.ref=t.ref,e.return=t,t.child=e}function lf(e,t,n,l,s){if(e!==null){var r=e.memoizedProps;if(Ga(r,l)&&e.ref===t.ref)if(nt=!1,t.pendingProps=l=r,Ao(e,s))(e.flags&131072)!==0&&(nt=!0);else return t.lanes=e.lanes,wn(e,t,s)}return wo(e,t,n,l,s)}function af(e,t,n,l){var s=l.children,r=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(r=r!==null?r.baseLanes|n:n,e!==null){for(l=t.child=e.child,s=0;l!==null;)s=s|l.lanes|l.childLanes,l=l.sibling;l=s&~r}else l=0,t.child=null;return sf(e,t,r,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&as(t,r!==null?r.cachePool:null),r!==null?rd(t,r):Pr(),od(t);else return l=t.lanes=536870912,sf(e,t,r!==null?r.baseLanes|n:n,n,l)}else r!==null?(as(t,r.cachePool),rd(t,r),Fn(),t.memoizedState=null):(e!==null&&as(t,null),Pr(),Fn());return ht(e,t,s,n),t.child}function ai(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sf(e,t,n,l,s){var r=Wr();return r=r===null?null:{parent:et._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&as(t,null),Pr(),od(t),e!==null&&aa(e,t,l,!0),t.childLanes=s,null}function bs(e,t){return t=Ss({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function rf(e,t,n){return El(t,e.child,null,n),e=bs(t,t.pendingProps),e.flags|=2,Dt(t),t.memoizedState=null,e}function pg(e,t,n){var l=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ee){if(l.mode==="hidden")return e=bs(t,l),t.lanes=536870912,ai(null,e);if(to(t),(e=Xe)?(e=xh(e,Xt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yn!==null?{id:rn,overflow:on}:null,retryLane:536870912,hydrationErrors:null},n=Gu(e),n.return=t,t.child=n,dt=t,Xe=null)):e=null,e===null)throw Xn(t);return t.lanes=536870912,null}return bs(t,l)}var r=e.memoizedState;if(r!==null){var f=r.dehydrated;if(to(t),s)if(t.flags&256)t.flags&=-257,t=rf(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(nt||aa(e,t,n,!1),s=(n&e.childLanes)!==0,nt||s){if(l=Ye,l!==null&&(f=qi(l,n),f!==0&&f!==r.retryLane))throw r.retryLane=f,jl(e,f),Ct(l,e,f),ko;As(),t=rf(e,t,n)}else e=r.treeContext,Xe=Vt(f.nextSibling),dt=t,Ee=!0,Gn=null,Xt=!1,e!==null&&Vu(t,e),t=bs(t,l),t.flags|=4096;return t}return e=yn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function js(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function wo(e,t,n,l,s){return zl(t),n=lo(e,t,n,l,void 0,s),l=ao(),e!==null&&!nt?(io(e,t,s),wn(e,t,s)):(Ee&&l&&Br(t),t.flags|=1,ht(e,t,n,s),t.child)}function of(e,t,n,l,s,r){return zl(t),t.updateQueue=null,n=ud(t,l,n,s),cd(e),l=ao(),e!==null&&!nt?(io(e,t,r),wn(e,t,r)):(Ee&&l&&Br(t),t.flags|=1,ht(e,t,n,r),t.child)}function cf(e,t,n,l,s){if(zl(t),t.stateNode===null){var r=ea,f=n.contextType;typeof f=="object"&&f!==null&&(r=ft(f)),r=new n(l,r),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=jo,t.stateNode=r,r._reactInternals=t,r=t.stateNode,r.props=l,r.state=t.memoizedState,r.refs={},Zr(t),f=n.contextType,r.context=typeof f=="object"&&f!==null?ft(f):ea,r.state=t.memoizedState,f=n.getDerivedStateFromProps,typeof f=="function"&&(bo(t,n,f,l),r.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(f=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),f!==r.state&&jo.enqueueReplaceState(r,r.state,null),Pa(t,l,r,s),Ia(),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){r=t.stateNode;var p=t.memoizedProps,w=Al(n,p);r.props=w;var O=r.context,X=n.contextType;f=ea,typeof X=="object"&&X!==null&&(f=ft(X));var W=n.getDerivedStateFromProps;X=typeof W=="function"||typeof r.getSnapshotBeforeUpdate=="function",p=t.pendingProps!==p,X||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(p||O!==f)&&Kd(t,r,l,f),Vn=!1;var H=t.memoizedState;r.state=H,Pa(t,l,r,s),Ia(),O=t.memoizedState,p||H!==O||Vn?(typeof W=="function"&&(bo(t,n,W,l),O=t.memoizedState),(w=Vn||Wd(t,n,w,l,H,O,f))?(X||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(t.flags|=4194308)):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=O),r.props=l,r.state=O,r.context=f,l=w):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{r=t.stateNode,Fr(e,t),f=t.memoizedProps,X=Al(n,f),r.props=X,W=t.pendingProps,H=r.context,O=n.contextType,w=ea,typeof O=="object"&&O!==null&&(w=ft(O)),p=n.getDerivedStateFromProps,(O=typeof p=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(f!==W||H!==w)&&Kd(t,r,l,w),Vn=!1,H=t.memoizedState,r.state=H,Pa(t,l,r,s),Ia();var L=t.memoizedState;f!==W||H!==L||Vn||e!==null&&e.dependencies!==null&&ns(e.dependencies)?(typeof p=="function"&&(bo(t,n,p,l),L=t.memoizedState),(X=Vn||Wd(t,n,X,l,H,L,w)||e!==null&&e.dependencies!==null&&ns(e.dependencies))?(O||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(l,L,w),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(l,L,w)),typeof r.componentDidUpdate=="function"&&(t.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof r.componentDidUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=L),r.props=l,r.state=L,r.context=w,l=X):(typeof r.componentDidUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),l=!1)}return r=l,js(e,t),l=(t.flags&128)!==0,r||l?(r=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:r.render(),t.flags|=1,e!==null&&l?(t.child=El(t,e.child,null,s),t.child=El(t,null,n,s)):ht(e,t,n,s),t.memoizedState=r.state,e=t.child):e=wn(e,t,s),e}function uf(e,t,n,l){return kl(),t.flags|=256,ht(e,t,n,l),t.child}var zo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function To(e){return{baseLanes:e,cachePool:Iu()}}function Co(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Ot),e}function df(e,t,n){var l=t.pendingProps,s=!1,r=(t.flags&128)!==0,f;if((f=r)||(f=e!==null&&e.memoizedState===null?!1:(Ie.current&2)!==0),f&&(s=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ee){if(s?Zn(t):Fn(),(e=Xe)?(e=xh(e,Xt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yn!==null?{id:rn,overflow:on}:null,retryLane:536870912,hydrationErrors:null},n=Gu(e),n.return=t,t.child=n,dt=t,Xe=null)):e=null,e===null)throw Xn(t);return cc(e)?t.lanes=32:t.lanes=536870912,null}var p=l.children;return l=l.fallback,s?(Fn(),s=t.mode,p=Ss({mode:"hidden",children:p},s),l=Sl(l,s,n,null),p.return=t,l.return=t,p.sibling=l,t.child=p,l=t.child,l.memoizedState=To(n),l.childLanes=Co(e,f,n),t.memoizedState=zo,ai(null,l)):(Zn(t),Mo(t,p))}var w=e.memoizedState;if(w!==null&&(p=w.dehydrated,p!==null)){if(r)t.flags&256?(Zn(t),t.flags&=-257,t=Eo(e,t,n)):t.memoizedState!==null?(Fn(),t.child=e.child,t.flags|=128,t=null):(Fn(),p=l.fallback,s=t.mode,l=Ss({mode:"visible",children:l.children},s),p=Sl(p,s,n,null),p.flags|=2,l.return=t,p.return=t,l.sibling=p,t.child=l,El(t,e.child,null,n),l=t.child,l.memoizedState=To(n),l.childLanes=Co(e,f,n),t.memoizedState=zo,t=ai(null,l));else if(Zn(t),cc(p)){if(f=p.nextSibling&&p.nextSibling.dataset,f)var O=f.dgst;f=O,l=Error(o(419)),l.stack="",l.digest=f,Va({value:l,source:null,stack:null}),t=Eo(e,t,n)}else if(nt||aa(e,t,n,!1),f=(n&e.childLanes)!==0,nt||f){if(f=Ye,f!==null&&(l=qi(f,n),l!==0&&l!==w.retryLane))throw w.retryLane=l,jl(e,l),Ct(f,e,l),ko;oc(p)||As(),t=Eo(e,t,n)}else oc(p)?(t.flags|=192,t.child=e.child,t=null):(e=w.treeContext,Xe=Vt(p.nextSibling),dt=t,Ee=!0,Gn=null,Xt=!1,e!==null&&Vu(t,e),t=Mo(t,l.children),t.flags|=4096);return t}return s?(Fn(),p=l.fallback,s=t.mode,w=e.child,O=w.sibling,l=yn(w,{mode:"hidden",children:l.children}),l.subtreeFlags=w.subtreeFlags&65011712,O!==null?p=yn(O,p):(p=Sl(p,s,n,null),p.flags|=2),p.return=t,l.return=t,l.sibling=p,t.child=l,ai(null,l),l=t.child,p=e.child.memoizedState,p===null?p=To(n):(s=p.cachePool,s!==null?(w=et._currentValue,s=s.parent!==w?{parent:w,pool:w}:s):s=Iu(),p={baseLanes:p.baseLanes|n,cachePool:s}),l.memoizedState=p,l.childLanes=Co(e,f,n),t.memoizedState=zo,ai(e.child,l)):(Zn(t),n=e.child,e=n.sibling,n=yn(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=n,t.memoizedState=null,n)}function Mo(e,t){return t=Ss({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ss(e,t){return e=_t(22,e,null,t),e.lanes=0,e}function Eo(e,t,n){return El(t,e.child,null,n),e=Mo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ff(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Gr(e.return,t,n)}function _o(e,t,n,l,s,r){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:s,treeForkCount:r}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=l,f.tail=n,f.tailMode=s,f.treeForkCount=r)}function hf(e,t,n){var l=t.pendingProps,s=l.revealOrder,r=l.tail;l=l.children;var f=Ie.current,p=(f&2)!==0;if(p?(f=f&1|2,t.flags|=128):f&=1,Z(Ie,f),ht(e,t,l,n),l=Ee?Qa:0,!p&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ff(e,n,t);else if(e.tag===19)ff(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&us(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),_o(t,!1,s,n,r,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&us(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}_o(t,!0,n,null,r,l);break;case"together":_o(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function wn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Pn|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(aa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=yn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=yn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ao(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ns(e)))}function vg(e,t,n){switch(t.tag){case 3:Re(t,t.stateNode.containerInfo),Qn(t,et,e.memoizedState.cache),kl();break;case 27:case 5:te(t);break;case 4:Re(t,t.stateNode.containerInfo);break;case 10:Qn(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,to(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Zn(t),t.flags|=128,null):(n&t.child.childLanes)!==0?df(e,t,n):(Zn(t),e=wn(e,t,n),e!==null?e.sibling:null);Zn(t);break;case 19:var s=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(aa(e,t,n,!1),l=(n&t.childLanes)!==0),s){if(l)return hf(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Z(Ie,Ie.current),l)break;return null;case 22:return t.lanes=0,af(e,t,n,t.pendingProps);case 24:Qn(t,et,e.memoizedState.cache)}return wn(e,t,n)}function pf(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)nt=!0;else{if(!Ao(e,n)&&(t.flags&128)===0)return nt=!1,vg(e,t,n);nt=(e.flags&131072)!==0}else nt=!1,Ee&&(t.flags&1048576)!==0&&Qu(t,Qa,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Cl(t.elementType),t.type=e,typeof e=="function")Nr(e)?(l=Al(e,l),t.tag=1,t=cf(null,t,e,l,n)):(t.tag=0,t=wo(null,t,e,l,n));else{if(e!=null){var s=e.$$typeof;if(s===F){t.tag=11,t=tf(null,t,e,l,n);break e}else if(s===N){t.tag=14,t=nf(null,t,e,l,n);break e}}throw t=oe(e)||e,Error(o(306,t,""))}}return t;case 0:return wo(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,s=Al(l,t.pendingProps),cf(e,t,l,s,n);case 3:e:{if(Re(t,t.stateNode.containerInfo),e===null)throw Error(o(387));l=t.pendingProps;var r=t.memoizedState;s=r.element,Fr(e,t),Pa(t,l,null,n);var f=t.memoizedState;if(l=f.cache,Qn(t,et,l),l!==r.cache&&Xr(t,[et],n,!0),Ia(),l=f.element,r.isDehydrated)if(r={element:l,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=uf(e,t,l,n);break e}else if(l!==s){s=$t(Error(o(424)),t),Va(s),t=uf(e,t,l,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Xe=Vt(e.firstChild),dt=t,Ee=!0,Gn=null,Xt=!0,n=ad(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(kl(),l===s){t=wn(e,t,n);break e}ht(e,t,l,n)}t=t.child}return t;case 26:return js(e,t),e===null?(n=zh(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ee||(n=t.type,e=t.pendingProps,l=Bs(ue.current).createElement(n),l[at]=t,l[yt]=e,pt(l,n,e),st(l),t.stateNode=l):t.memoizedState=zh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return te(t),e===null&&Ee&&(l=t.stateNode=Sh(t.type,t.pendingProps,ue.current),dt=t,Xt=!0,s=Xe,al(t.type)?(uc=s,Xe=Vt(l.firstChild)):Xe=s),ht(e,t,t.pendingProps.children,n),js(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ee&&((s=l=Xe)&&(l=Qg(l,t.type,t.pendingProps,Xt),l!==null?(t.stateNode=l,dt=t,Xe=Vt(l.firstChild),Xt=!1,s=!0):s=!1),s||Xn(t)),te(t),s=t.type,r=t.pendingProps,f=e!==null?e.memoizedProps:null,l=r.children,ic(s,r)?l=null:f!==null&&ic(s,f)&&(t.flags|=32),t.memoizedState!==null&&(s=lo(e,t,sg,null,null,n),xi._currentValue=s),js(e,t),ht(e,t,l,n),t.child;case 6:return e===null&&Ee&&((e=n=Xe)&&(n=Vg(n,t.pendingProps,Xt),n!==null?(t.stateNode=n,dt=t,Xe=null,e=!0):e=!1),e||Xn(t)),null;case 13:return df(e,t,n);case 4:return Re(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=El(t,null,l,n):ht(e,t,l,n),t.child;case 11:return tf(e,t,t.type,t.pendingProps,n);case 7:return ht(e,t,t.pendingProps,n),t.child;case 8:return ht(e,t,t.pendingProps.children,n),t.child;case 12:return ht(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,Qn(t,t.type,l.value),ht(e,t,l.children,n),t.child;case 9:return s=t.type._context,l=t.pendingProps.children,zl(t),s=ft(s),l=l(s),t.flags|=1,ht(e,t,l,n),t.child;case 14:return nf(e,t,t.type,t.pendingProps,n);case 15:return lf(e,t,t.type,t.pendingProps,n);case 19:return hf(e,t,n);case 31:return pg(e,t,n);case 22:return af(e,t,n,t.pendingProps);case 24:return zl(t),l=ft(et),e===null?(s=Wr(),s===null&&(s=Ye,r=Qr(),s.pooledCache=r,r.refCount++,r!==null&&(s.pooledCacheLanes|=n),s=r),t.memoizedState={parent:l,cache:s},Zr(t),Qn(t,et,s)):((e.lanes&n)!==0&&(Fr(e,t),Pa(t,null,null,n),Ia()),s=e.memoizedState,r=t.memoizedState,s.parent!==l?(s={parent:l,cache:l},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Qn(t,et,l)):(l=r.cache,Qn(t,et,l),l!==s.cache&&Xr(t,[et],n,!0))),ht(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function zn(e){e.flags|=4}function Do(e,t,n,l,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if($f())e.flags|=8192;else throw Ml=ss,Kr}else e.flags&=-16777217}function vf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!_h(t))if($f())e.flags|=8192;else throw Ml=ss,Kr}function ks(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Hi():536870912,e.lanes|=t,ga|=t)}function ii(e,t){if(!Ee)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,l|=s.subtreeFlags&65011712,l|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,l|=s.subtreeFlags,l|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function gg(e,t,n){var l=t.pendingProps;switch(qr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return Qe(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),jn(et),ee(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(la(t)?zn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,$r())),Qe(t),null;case 26:var s=t.type,r=t.memoizedState;return e===null?(zn(t),r!==null?(Qe(t),vf(t,r)):(Qe(t),Do(t,s,null,l,n))):r?r!==e.memoizedState?(zn(t),Qe(t),vf(t,r)):(Qe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&zn(t),Qe(t),Do(t,s,e,l,n)),null;case 27:if(we(t),n=ue.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&zn(t);else{if(!l){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}e=I.current,la(t)?Wu(t):(e=Sh(s,l,n),t.stateNode=e,zn(t))}return Qe(t),null;case 5:if(we(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&zn(t);else{if(!l){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}if(r=I.current,la(t))Wu(t);else{var f=Bs(ue.current);switch(r){case 1:r=f.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:r=f.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":r=f.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":r=f.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":r=f.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof l.is=="string"?f.createElement("select",{is:l.is}):f.createElement("select"),l.multiple?r.multiple=!0:l.size&&(r.size=l.size);break;default:r=typeof l.is=="string"?f.createElement(s,{is:l.is}):f.createElement(s)}}r[at]=t,r[yt]=l;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)r.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=r;e:switch(pt(r,s,l),s){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&zn(t)}}return Qe(t),Do(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&zn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(o(166));if(e=ue.current,la(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,s=dt,s!==null)switch(s.tag){case 27:case 5:l=s.memoizedProps}e[at]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||dh(e.nodeValue,n)),e||Xn(t,!0)}else e=Bs(e).createTextNode(l),e[at]=t,t.stateNode=e}return Qe(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=la(t),n!==null){if(e===null){if(!l)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[at]=t}else kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else n=$r(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Dt(t),t):(Dt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Qe(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=la(t),l!==null&&l.dehydrated!==null){if(e===null){if(!s)throw Error(o(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(317));s[at]=t}else kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),s=!1}else s=$r(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Dt(t),t):(Dt(t),null)}return Dt(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,s=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(s=l.alternate.memoizedState.cachePool.pool),r=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(r=l.memoizedState.cachePool.pool),r!==s&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ks(t,t.updateQueue),Qe(t),null);case 4:return ee(),e===null&&ec(t.stateNode.containerInfo),Qe(t),null;case 10:return jn(t.type),Qe(t),null;case 19:if(_(Ie),l=t.memoizedState,l===null)return Qe(t),null;if(s=(t.flags&128)!==0,r=l.rendering,r===null)if(s)ii(l,!1);else{if(Ze!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(r=us(e),r!==null){for(t.flags|=128,ii(l,!1),e=r.updateQueue,t.updateQueue=e,ks(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Yu(n,e),n=n.sibling;return Z(Ie,Ie.current&1|2),Ee&&xn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&mt()>Ms&&(t.flags|=128,s=!0,ii(l,!1),t.lanes=4194304)}else{if(!s)if(e=us(r),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,ks(t,e),ii(l,!0),l.tail===null&&l.tailMode==="hidden"&&!r.alternate&&!Ee)return Qe(t),null}else 2*mt()-l.renderingStartTime>Ms&&n!==536870912&&(t.flags|=128,s=!0,ii(l,!1),t.lanes=4194304);l.isBackwards?(r.sibling=t.child,t.child=r):(e=l.last,e!==null?e.sibling=r:t.child=r,l.last=r)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=mt(),e.sibling=null,n=Ie.current,Z(Ie,s?n&1|2:n&1),Ee&&xn(t,l.treeForkCount),e):(Qe(t),null);case 22:case 23:return Dt(t),eo(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(n&536870912)!==0&&(t.flags&128)===0&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),n=t.updateQueue,n!==null&&ks(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&_(Tl),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),jn(et),Qe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function mg(e,t){switch(qr(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jn(et),ee(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return we(t),null;case 31:if(t.memoizedState!==null){if(Dt(t),t.alternate===null)throw Error(o(340));kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Dt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _(Ie),null;case 4:return ee(),null;case 10:return jn(t.type),null;case 22:case 23:return Dt(t),eo(),e!==null&&_(Tl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return jn(et),null;case 25:return null;default:return null}}function gf(e,t){switch(qr(t),t.tag){case 3:jn(et),ee();break;case 26:case 27:case 5:we(t);break;case 4:ee();break;case 31:t.memoizedState!==null&&Dt(t);break;case 13:Dt(t);break;case 19:_(Ie);break;case 10:jn(t.type);break;case 22:case 23:Dt(t),eo(),e!==null&&_(Tl);break;case 24:jn(et)}}function si(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var s=l.next;n=s;do{if((n.tag&e)===e){l=void 0;var r=n.create,f=n.inst;l=r(),f.destroy=l}n=n.next}while(n!==s)}}catch(p){Ue(t,t.return,p)}}function Jn(e,t,n){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var r=s.next;l=r;do{if((l.tag&e)===e){var f=l.inst,p=f.destroy;if(p!==void 0){f.destroy=void 0,s=t;var w=n,O=p;try{O()}catch(X){Ue(s,w,X)}}}l=l.next}while(l!==r)}}catch(X){Ue(t,t.return,X)}}function mf(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{sd(t,n)}catch(l){Ue(e,e.return,l)}}}function yf(e,t,n){n.props=Al(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){Ue(e,t,l)}}function ri(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(s){Ue(e,t,s)}}function cn(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(s){Ue(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){Ue(e,t,s)}else n.current=null}function xf(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(s){Ue(e,e.return,s)}}function Ro(e,t,n){try{var l=e.stateNode;qg(l,e.type,n,t),l[yt]=t}catch(s){Ue(e,e.return,s)}}function bf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&al(e.type)||e.tag===4}function Oo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bf(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&al(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function No(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gn));else if(l!==4&&(l===27&&al(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(No(e,t,n),e=e.sibling;e!==null;)No(e,t,n),e=e.sibling}function ws(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(l===27&&al(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(ws(e,t,n),e=e.sibling;e!==null;)ws(e,t,n),e=e.sibling}function jf(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);pt(t,l,n),t[at]=e,t[yt]=n}catch(r){Ue(e,e.return,r)}}var Tn=!1,lt=!1,Ho=!1,Sf=typeof WeakSet=="function"?WeakSet:Set,rt=null;function yg(e,t){if(e=e.containerInfo,lc=Qs,e=Ru(e),Mr(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var s=l.anchorOffset,r=l.focusNode;l=l.focusOffset;try{n.nodeType,r.nodeType}catch{n=null;break e}var f=0,p=-1,w=-1,O=0,X=0,W=e,H=null;t:for(;;){for(var L;W!==n||s!==0&&W.nodeType!==3||(p=f+s),W!==r||l!==0&&W.nodeType!==3||(w=f+l),W.nodeType===3&&(f+=W.nodeValue.length),(L=W.firstChild)!==null;)H=W,W=L;for(;;){if(W===e)break t;if(H===n&&++O===s&&(p=f),H===r&&++X===l&&(w=f),(L=W.nextSibling)!==null)break;W=H,H=W.parentNode}W=L}n=p===-1||w===-1?null:{start:p,end:w}}else n=null}n=n||{start:0,end:0}}else n=null;for(ac={focusedElem:e,selectionRange:n},Qs=!1,rt=t;rt!==null;)if(t=rt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,rt=e;else for(;rt!==null;){switch(t=rt,r=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)s=e[n],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&r!==null){e=void 0,n=t,s=r.memoizedProps,r=r.memoizedState,l=n.stateNode;try{var he=Al(n.type,s);e=l.getSnapshotBeforeUpdate(he,r),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Ue(n,n.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)rc(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":rc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,rt=e;break}rt=t.return}}function kf(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:Mn(e,n),l&4&&si(5,n);break;case 1:if(Mn(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(f){Ue(n,n.return,f)}else{var s=Al(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){Ue(n,n.return,f)}}l&64&&mf(n),l&512&&ri(n,n.return);break;case 3:if(Mn(e,n),l&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{sd(e,t)}catch(f){Ue(n,n.return,f)}}break;case 27:t===null&&l&4&&jf(n);case 26:case 5:Mn(e,n),t===null&&l&4&&xf(n),l&512&&ri(n,n.return);break;case 12:Mn(e,n);break;case 31:Mn(e,n),l&4&&Tf(e,n);break;case 13:Mn(e,n),l&4&&Cf(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Cg.bind(null,n),Wg(e,n))));break;case 22:if(l=n.memoizedState!==null||Tn,!l){t=t!==null&&t.memoizedState!==null||lt,s=Tn;var r=lt;Tn=l,(lt=t)&&!r?En(e,n,(n.subtreeFlags&8772)!==0):Mn(e,n),Tn=s,lt=r}break;case 30:break;default:Mn(e,n)}}function wf(e){var t=e.alternate;t!==null&&(e.alternate=null,wf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Oa(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ve=null,kt=!1;function Cn(e,t,n){for(n=n.child;n!==null;)zf(e,t,n),n=n.sibling}function zf(e,t,n){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(Hn,n)}catch{}switch(n.tag){case 26:lt||cn(n,t),Cn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:lt||cn(n,t);var l=Ve,s=kt;al(n.type)&&(Ve=n.stateNode,kt=!1),Cn(e,t,n),gi(n.stateNode),Ve=l,kt=s;break;case 5:lt||cn(n,t);case 6:if(l=Ve,s=kt,Ve=null,Cn(e,t,n),Ve=l,kt=s,Ve!==null)if(kt)try{(Ve.nodeType===9?Ve.body:Ve.nodeName==="HTML"?Ve.ownerDocument.body:Ve).removeChild(n.stateNode)}catch(r){Ue(n,t,r)}else try{Ve.removeChild(n.stateNode)}catch(r){Ue(n,t,r)}break;case 18:Ve!==null&&(kt?(e=Ve,mh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),wa(e)):mh(Ve,n.stateNode));break;case 4:l=Ve,s=kt,Ve=n.stateNode.containerInfo,kt=!0,Cn(e,t,n),Ve=l,kt=s;break;case 0:case 11:case 14:case 15:Jn(2,n,t),lt||Jn(4,n,t),Cn(e,t,n);break;case 1:lt||(cn(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&yf(n,t,l)),Cn(e,t,n);break;case 21:Cn(e,t,n);break;case 22:lt=(l=lt)||n.memoizedState!==null,Cn(e,t,n),lt=l;break;default:Cn(e,t,n)}}function Tf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{wa(e)}catch(n){Ue(t,t.return,n)}}}function Cf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{wa(e)}catch(n){Ue(t,t.return,n)}}function xg(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Sf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Sf),t;default:throw Error(o(435,e.tag))}}function zs(e,t){var n=xg(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var s=Mg.bind(null,e,l);l.then(s,s)}})}function wt(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var s=n[l],r=e,f=t,p=f;e:for(;p!==null;){switch(p.tag){case 27:if(al(p.type)){Ve=p.stateNode,kt=!1;break e}break;case 5:Ve=p.stateNode,kt=!1;break e;case 3:case 4:Ve=p.stateNode.containerInfo,kt=!0;break e}p=p.return}if(Ve===null)throw Error(o(160));zf(r,f,s),Ve=null,kt=!1,r=s.alternate,r!==null&&(r.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Mf(t,e),t=t.sibling}var nn=null;function Mf(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:wt(t,e),zt(e),l&4&&(Jn(3,e,e.return),si(3,e),Jn(5,e,e.return));break;case 1:wt(t,e),zt(e),l&512&&(lt||n===null||cn(n,n.return)),l&64&&Tn&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?l:n.concat(l))));break;case 26:var s=nn;if(wt(t,e),zt(e),l&512&&(lt||n===null||cn(n,n.return)),l&4){var r=n!==null?n.memoizedState:null;if(l=e.memoizedState,n===null)if(l===null)if(e.stateNode===null){e:{l=e.type,n=e.memoizedProps,s=s.ownerDocument||s;t:switch(l){case"title":r=s.getElementsByTagName("title")[0],(!r||r[Ln]||r[at]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=s.createElement(l),s.head.insertBefore(r,s.querySelector("head > title"))),pt(r,l,n),r[at]=e,st(r),l=r;break e;case"link":var f=Mh("link","href",s).get(l+(n.href||""));if(f){for(var p=0;p<f.length;p++)if(r=f[p],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){f.splice(p,1);break t}}r=s.createElement(l),pt(r,l,n),s.head.appendChild(r);break;case"meta":if(f=Mh("meta","content",s).get(l+(n.content||""))){for(p=0;p<f.length;p++)if(r=f[p],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){f.splice(p,1);break t}}r=s.createElement(l),pt(r,l,n),s.head.appendChild(r);break;default:throw Error(o(468,l))}r[at]=e,st(r),l=r}e.stateNode=l}else Eh(s,e.type,e.stateNode);else e.stateNode=Ch(s,l,e.memoizedProps);else r!==l?(r===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):r.count--,l===null?Eh(s,e.type,e.stateNode):Ch(s,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Ro(e,e.memoizedProps,n.memoizedProps)}break;case 27:wt(t,e),zt(e),l&512&&(lt||n===null||cn(n,n.return)),n!==null&&l&4&&Ro(e,e.memoizedProps,n.memoizedProps);break;case 5:if(wt(t,e),zt(e),l&512&&(lt||n===null||cn(n,n.return)),e.flags&32){s=e.stateNode;try{Wl(s,"")}catch(he){Ue(e,e.return,he)}}l&4&&e.stateNode!=null&&(s=e.memoizedProps,Ro(e,s,n!==null?n.memoizedProps:s)),l&1024&&(Ho=!0);break;case 6:if(wt(t,e),zt(e),l&4){if(e.stateNode===null)throw Error(o(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(he){Ue(e,e.return,he)}}break;case 3:if($s=null,s=nn,nn=qs(t.containerInfo),wt(t,e),nn=s,zt(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{wa(t.containerInfo)}catch(he){Ue(e,e.return,he)}Ho&&(Ho=!1,Ef(e));break;case 4:l=nn,nn=qs(e.stateNode.containerInfo),wt(t,e),zt(e),nn=l;break;case 12:wt(t,e),zt(e);break;case 31:wt(t,e),zt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,zs(e,l)));break;case 13:wt(t,e),zt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Cs=mt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,zs(e,l)));break;case 22:s=e.memoizedState!==null;var w=n!==null&&n.memoizedState!==null,O=Tn,X=lt;if(Tn=O||s,lt=X||w,wt(t,e),lt=X,Tn=O,zt(e),l&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||w||Tn||lt||Dl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){w=n=t;try{if(r=w.stateNode,s)f=r.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none";else{p=w.stateNode;var W=w.memoizedProps.style,H=W!=null&&W.hasOwnProperty("display")?W.display:null;p.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(he){Ue(w,w.return,he)}}}else if(t.tag===6){if(n===null){w=t;try{w.stateNode.nodeValue=s?"":w.memoizedProps}catch(he){Ue(w,w.return,he)}}}else if(t.tag===18){if(n===null){w=t;try{var L=w.stateNode;s?yh(L,!0):yh(w.stateNode,!1)}catch(he){Ue(w,w.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(n=l.retryQueue,n!==null&&(l.retryQueue=null,zs(e,n))));break;case 19:wt(t,e),zt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,zs(e,l)));break;case 30:break;case 21:break;default:wt(t,e),zt(e)}}function zt(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(bf(l)){n=l;break}l=l.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var s=n.stateNode,r=Oo(e);ws(e,r,s);break;case 5:var f=n.stateNode;n.flags&32&&(Wl(f,""),n.flags&=-33);var p=Oo(e);ws(e,p,f);break;case 3:case 4:var w=n.stateNode.containerInfo,O=Oo(e);No(e,O,w);break;default:throw Error(o(161))}}catch(X){Ue(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ef(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ef(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Mn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)kf(e,t.alternate,t),t=t.sibling}function Dl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Jn(4,t,t.return),Dl(t);break;case 1:cn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&yf(t,t.return,n),Dl(t);break;case 27:gi(t.stateNode);case 26:case 5:cn(t,t.return),Dl(t);break;case 22:t.memoizedState===null&&Dl(t);break;case 30:Dl(t);break;default:Dl(t)}e=e.sibling}}function En(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,s=e,r=t,f=r.flags;switch(r.tag){case 0:case 11:case 15:En(s,r,n),si(4,r);break;case 1:if(En(s,r,n),l=r,s=l.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(O){Ue(l,l.return,O)}if(l=r,s=l.updateQueue,s!==null){var p=l.stateNode;try{var w=s.shared.hiddenCallbacks;if(w!==null)for(s.shared.hiddenCallbacks=null,s=0;s<w.length;s++)id(w[s],p)}catch(O){Ue(l,l.return,O)}}n&&f&64&&mf(r),ri(r,r.return);break;case 27:jf(r);case 26:case 5:En(s,r,n),n&&l===null&&f&4&&xf(r),ri(r,r.return);break;case 12:En(s,r,n);break;case 31:En(s,r,n),n&&f&4&&Tf(s,r);break;case 13:En(s,r,n),n&&f&4&&Cf(s,r);break;case 22:r.memoizedState===null&&En(s,r,n),ri(r,r.return);break;case 30:break;default:En(s,r,n)}t=t.sibling}}function Uo(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Wa(n))}function Bo(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Wa(e))}function ln(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)_f(e,t,n,l),t=t.sibling}function _f(e,t,n,l){var s=t.flags;switch(t.tag){case 0:case 11:case 15:ln(e,t,n,l),s&2048&&si(9,t);break;case 1:ln(e,t,n,l);break;case 3:ln(e,t,n,l),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Wa(e)));break;case 12:if(s&2048){ln(e,t,n,l),e=t.stateNode;try{var r=t.memoizedProps,f=r.id,p=r.onPostCommit;typeof p=="function"&&p(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(w){Ue(t,t.return,w)}}else ln(e,t,n,l);break;case 31:ln(e,t,n,l);break;case 13:ln(e,t,n,l);break;case 23:break;case 22:r=t.stateNode,f=t.alternate,t.memoizedState!==null?r._visibility&2?ln(e,t,n,l):oi(e,t):r._visibility&2?ln(e,t,n,l):(r._visibility|=2,ha(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),s&2048&&Uo(f,t);break;case 24:ln(e,t,n,l),s&2048&&Bo(t.alternate,t);break;default:ln(e,t,n,l)}}function ha(e,t,n,l,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var r=e,f=t,p=n,w=l,O=f.flags;switch(f.tag){case 0:case 11:case 15:ha(r,f,p,w,s),si(8,f);break;case 23:break;case 22:var X=f.stateNode;f.memoizedState!==null?X._visibility&2?ha(r,f,p,w,s):oi(r,f):(X._visibility|=2,ha(r,f,p,w,s)),s&&O&2048&&Uo(f.alternate,f);break;case 24:ha(r,f,p,w,s),s&&O&2048&&Bo(f.alternate,f);break;default:ha(r,f,p,w,s)}t=t.sibling}}function oi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,s=l.flags;switch(l.tag){case 22:oi(n,l),s&2048&&Uo(l.alternate,l);break;case 24:oi(n,l),s&2048&&Bo(l.alternate,l);break;default:oi(n,l)}t=t.sibling}}var ci=8192;function pa(e,t,n){if(e.subtreeFlags&ci)for(e=e.child;e!==null;)Af(e,t,n),e=e.sibling}function Af(e,t,n){switch(e.tag){case 26:pa(e,t,n),e.flags&ci&&e.memoizedState!==null&&im(n,nn,e.memoizedState,e.memoizedProps);break;case 5:pa(e,t,n);break;case 3:case 4:var l=nn;nn=qs(e.stateNode.containerInfo),pa(e,t,n),nn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ci,ci=16777216,pa(e,t,n),ci=l):pa(e,t,n));break;default:pa(e,t,n)}}function Df(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ui(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];rt=l,Of(l,e)}Df(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Rf(e),e=e.sibling}function Rf(e){switch(e.tag){case 0:case 11:case 15:ui(e),e.flags&2048&&Jn(9,e,e.return);break;case 3:ui(e);break;case 12:ui(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ts(e)):ui(e);break;default:ui(e)}}function Ts(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];rt=l,Of(l,e)}Df(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Jn(8,t,t.return),Ts(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ts(t));break;default:Ts(t)}e=e.sibling}}function Of(e,t){for(;rt!==null;){var n=rt;switch(n.tag){case 0:case 11:case 15:Jn(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var l=n.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Wa(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,rt=l;else e:for(n=e;rt!==null;){l=rt;var s=l.sibling,r=l.return;if(wf(l),l===n){rt=null;break e}if(s!==null){s.return=r,rt=s;break e}rt=r}}}var bg={getCacheForType:function(e){var t=ft(et),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ft(et).controller.signal}},jg=typeof WeakMap=="function"?WeakMap:Map,Oe=0,Ye=null,ze=null,Ce=0,He=0,Rt=null,In=!1,va=!1,qo=!1,_n=0,Ze=0,Pn=0,Rl=0,Lo=0,Ot=0,ga=0,di=null,Tt=null,$o=!1,Cs=0,Nf=0,Ms=1/0,Es=null,el=null,it=0,tl=null,ma=null,An=0,Yo=0,Go=null,Hf=null,fi=0,Xo=null;function Nt(){return(Oe&2)!==0&&Ce!==0?Ce&-Ce:E.T!==null?Fo():Da()}function Uf(){if(Ot===0)if((Ce&536870912)===0||Ee){var e=Ut;Ut<<=1,(Ut&3932160)===0&&(Ut=262144),Ot=e}else Ot=536870912;return e=At.current,e!==null&&(e.flags|=32),Ot}function Ct(e,t,n){(e===Ye&&(He===2||He===9)||e.cancelPendingCommit!==null)&&(ya(e,0),nl(e,Ce,Ot,!1)),qn(e,n),((Oe&2)===0||e!==Ye)&&(e===Ye&&((Oe&2)===0&&(Rl|=n),Ze===4&&nl(e,Ce,Ot,!1)),un(e))}function Bf(e,t,n){if((Oe&6)!==0)throw Error(o(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Bn(e,t),s=l?wg(e,t):Vo(e,t,!0),r=l;do{if(s===0){va&&!l&&nl(e,t,0,!1);break}else{if(n=e.current.alternate,r&&!Sg(n)){s=Vo(e,t,!1),r=!1;continue}if(s===2){if(r=t,e.errorRecoveryDisabledLanes&r)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var p=e;s=di;var w=p.current.memoizedState.isDehydrated;if(w&&(ya(p,f).flags|=256),f=Vo(p,f,!1),f!==2){if(qo&&!w){p.errorRecoveryDisabledLanes|=r,Rl|=r,s=4;break e}r=Tt,Tt=s,r!==null&&(Tt===null?Tt=r:Tt.push.apply(Tt,r))}s=f}if(r=!1,s!==2)continue}}if(s===1){ya(e,0),nl(e,t,0,!0);break}e:{switch(l=e,r=s,r){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:nl(l,t,Ot,!In);break e;case 2:Tt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(s=Cs+300-mt(),10<s)){if(nl(l,t,Ot,!In),Un(l,0,!0)!==0)break e;An=t,l.timeoutHandle=vh(qf.bind(null,l,n,Tt,Es,$o,t,Ot,Rl,ga,In,r,"Throttled",-0,0),s);break e}qf(l,n,Tt,Es,$o,t,Ot,Rl,ga,In,r,null,-0,0)}}break}while(!0);un(e)}function qf(e,t,n,l,s,r,f,p,w,O,X,W,H,L){if(e.timeoutHandle=-1,W=t.subtreeFlags,W&8192||(W&16785408)===16785408){W={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gn},Af(t,r,W);var he=(r&62914560)===r?Cs-mt():(r&4194048)===r?Nf-mt():0;if(he=sm(W,he),he!==null){An=r,e.cancelPendingCommit=he(Wf.bind(null,e,t,r,n,l,s,f,p,w,X,W,null,H,L)),nl(e,r,f,!O);return}}Wf(e,t,r,n,l,s,f,p,w)}function Sg(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var l=0;l<n.length;l++){var s=n[l],r=s.getSnapshot;s=s.value;try{if(!Et(r(),s))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function nl(e,t,n,l){t&=~Lo,t&=~Rl,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var s=t;0<s;){var r=31-ut(s),f=1<<r;l[r]=-1,s&=~f}n!==0&&Ui(e,n,t)}function _s(){return(Oe&6)===0?(hi(0),!1):!0}function Qo(){if(ze!==null){if(He===0)var e=ze.return;else e=ze,bn=wl=null,so(e),oa=null,Za=0,e=ze;for(;e!==null;)gf(e.alternate,e),e=e.return;ze=null}}function ya(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Yg(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),An=0,Qo(),Ye=e,ze=n=yn(e.current,null),Ce=t,He=0,Rt=null,In=!1,va=Bn(e,t),qo=!1,ga=Ot=Lo=Rl=Pn=Ze=0,Tt=di=null,$o=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var s=31-ut(l),r=1<<s;t|=e[s],l&=~r}return _n=t,Ji(),n}function Lf(e,t){Se=null,E.H=li,t===ra||t===is?(t=td(),He=3):t===Kr?(t=td(),He=4):He=t===ko?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Rt=t,ze===null&&(Ze=1,xs(e,$t(t,e.current)))}function $f(){var e=At.current;return e===null?!0:(Ce&4194048)===Ce?Qt===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===Qt:!1}function Yf(){var e=E.H;return E.H=li,e===null?li:e}function Gf(){var e=E.A;return E.A=bg,e}function As(){Ze=4,In||(Ce&4194048)!==Ce&&At.current!==null||(va=!0),(Pn&134217727)===0&&(Rl&134217727)===0||Ye===null||nl(Ye,Ce,Ot,!1)}function Vo(e,t,n){var l=Oe;Oe|=2;var s=Yf(),r=Gf();(Ye!==e||Ce!==t)&&(Es=null,ya(e,t)),t=!1;var f=Ze;e:do try{if(He!==0&&ze!==null){var p=ze,w=Rt;switch(He){case 8:Qo(),f=6;break e;case 3:case 2:case 9:case 6:At.current===null&&(t=!0);var O=He;if(He=0,Rt=null,xa(e,p,w,O),n&&va){f=0;break e}break;default:O=He,He=0,Rt=null,xa(e,p,w,O)}}kg(),f=Ze;break}catch(X){Lf(e,X)}while(!0);return t&&e.shellSuspendCounter++,bn=wl=null,Oe=l,E.H=s,E.A=r,ze===null&&(Ye=null,Ce=0,Ji()),f}function kg(){for(;ze!==null;)Xf(ze)}function wg(e,t){var n=Oe;Oe|=2;var l=Yf(),s=Gf();Ye!==e||Ce!==t?(Es=null,Ms=mt()+500,ya(e,t)):va=Bn(e,t);e:do try{if(He!==0&&ze!==null){t=ze;var r=Rt;t:switch(He){case 1:He=0,Rt=null,xa(e,t,r,1);break;case 2:case 9:if(Pu(r)){He=0,Rt=null,Qf(t);break}t=function(){He!==2&&He!==9||Ye!==e||(He=7),un(e)},r.then(t,t);break e;case 3:He=7;break e;case 4:He=5;break e;case 7:Pu(r)?(He=0,Rt=null,Qf(t)):(He=0,Rt=null,xa(e,t,r,7));break;case 5:var f=null;switch(ze.tag){case 26:f=ze.memoizedState;case 5:case 27:var p=ze;if(f?_h(f):p.stateNode.complete){He=0,Rt=null;var w=p.sibling;if(w!==null)ze=w;else{var O=p.return;O!==null?(ze=O,Ds(O)):ze=null}break t}}He=0,Rt=null,xa(e,t,r,5);break;case 6:He=0,Rt=null,xa(e,t,r,6);break;case 8:Qo(),Ze=6;break e;default:throw Error(o(462))}}zg();break}catch(X){Lf(e,X)}while(!0);return bn=wl=null,E.H=l,E.A=s,Oe=n,ze!==null?0:(Ye=null,Ce=0,Ji(),Ze)}function zg(){for(;ze!==null&&!ql();)Xf(ze)}function Xf(e){var t=pf(e.alternate,e,_n);e.memoizedProps=e.pendingProps,t===null?Ds(e):ze=t}function Qf(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=of(n,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=of(n,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:so(t);default:gf(n,t),t=ze=Yu(t,_n),t=pf(n,t,_n)}e.memoizedProps=e.pendingProps,t===null?Ds(e):ze=t}function xa(e,t,n,l){bn=wl=null,so(t),oa=null,Za=0;var s=t.return;try{if(hg(e,s,t,n,Ce)){Ze=1,xs(e,$t(n,e.current)),ze=null;return}}catch(r){if(s!==null)throw ze=s,r;Ze=1,xs(e,$t(n,e.current)),ze=null;return}t.flags&32768?(Ee||l===1?e=!0:va||(Ce&536870912)!==0?e=!1:(In=e=!0,(l===2||l===9||l===3||l===6)&&(l=At.current,l!==null&&l.tag===13&&(l.flags|=16384))),Vf(t,e)):Ds(t)}function Ds(e){var t=e;do{if((t.flags&32768)!==0){Vf(t,In);return}e=t.return;var n=gg(t.alternate,t,_n);if(n!==null){ze=n;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);Ze===0&&(Ze=5)}function Vf(e,t){do{var n=mg(e.alternate,e);if(n!==null){n.flags&=32767,ze=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ze=e;return}ze=e=n}while(e!==null);Ze=6,ze=null}function Wf(e,t,n,l,s,r,f,p,w){e.cancelPendingCommit=null;do Rs();while(it!==0);if((Oe&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(r=t.lanes|t.childLanes,r|=Rr,dr(e,n,r,f,p,w),e===Ye&&(ze=Ye=null,Ce=0),ma=t,tl=e,An=n,Yo=r,Go=s,Hf=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Eg(Ll,function(){return If(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null,s=$.p,$.p=2,f=Oe,Oe|=4;try{yg(e,t,n)}finally{Oe=f,$.p=s,E.T=l}}it=1,Kf(),Zf(),Ff()}}function Kf(){if(it===1){it=0;var e=tl,t=ma,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=E.T,E.T=null;var l=$.p;$.p=2;var s=Oe;Oe|=4;try{Mf(t,e);var r=ac,f=Ru(e.containerInfo),p=r.focusedElem,w=r.selectionRange;if(f!==p&&p&&p.ownerDocument&&Du(p.ownerDocument.documentElement,p)){if(w!==null&&Mr(p)){var O=w.start,X=w.end;if(X===void 0&&(X=O),"selectionStart"in p)p.selectionStart=O,p.selectionEnd=Math.min(X,p.value.length);else{var W=p.ownerDocument||document,H=W&&W.defaultView||window;if(H.getSelection){var L=H.getSelection(),he=p.textContent.length,ye=Math.min(w.start,he),Le=w.end===void 0?ye:Math.min(w.end,he);!L.extend&&ye>Le&&(f=Le,Le=ye,ye=f);var A=Au(p,ye),C=Au(p,Le);if(A&&C&&(L.rangeCount!==1||L.anchorNode!==A.node||L.anchorOffset!==A.offset||L.focusNode!==C.node||L.focusOffset!==C.offset)){var R=W.createRange();R.setStart(A.node,A.offset),L.removeAllRanges(),ye>Le?(L.addRange(R),L.extend(C.node,C.offset)):(R.setEnd(C.node,C.offset),L.addRange(R))}}}}for(W=[],L=p;L=L.parentNode;)L.nodeType===1&&W.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<W.length;p++){var V=W[p];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}Qs=!!lc,ac=lc=null}finally{Oe=s,$.p=l,E.T=n}}e.current=t,it=2}}function Zf(){if(it===2){it=0;var e=tl,t=ma,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=E.T,E.T=null;var l=$.p;$.p=2;var s=Oe;Oe|=4;try{kf(e,t.alternate,t)}finally{Oe=s,$.p=l,E.T=n}}it=3}}function Ff(){if(it===4||it===3){it=0,Ca();var e=tl,t=ma,n=An,l=Hf;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?it=5:(it=0,ma=tl=null,Jf(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(el=null),$l(n),t=t.stateNode,ct&&typeof ct.onCommitFiberRoot=="function")try{ct.onCommitFiberRoot(Hn,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=E.T,s=$.p,$.p=2,E.T=null;try{for(var r=e.onRecoverableError,f=0;f<l.length;f++){var p=l[f];r(p.value,{componentStack:p.stack})}}finally{E.T=t,$.p=s}}(An&3)!==0&&Rs(),un(e),s=e.pendingLanes,(n&261930)!==0&&(s&42)!==0?e===Xo?fi++:(fi=0,Xo=e):fi=0,hi(0)}}function Jf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Wa(t)))}function Rs(){return Kf(),Zf(),Ff(),If()}function If(){if(it!==5)return!1;var e=tl,t=Yo;Yo=0;var n=$l(An),l=E.T,s=$.p;try{$.p=32>n?32:n,E.T=null,n=Go,Go=null;var r=tl,f=An;if(it=0,ma=tl=null,An=0,(Oe&6)!==0)throw Error(o(331));var p=Oe;if(Oe|=4,Rf(r.current),_f(r,r.current,f,n),Oe=p,hi(0,!1),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(Hn,r)}catch{}return!0}finally{$.p=s,E.T=l,Jf(e,t)}}function Pf(e,t,n){t=$t(n,t),t=So(e.stateNode,t,2),e=Kn(e,t,2),e!==null&&(qn(e,2),un(e))}function Ue(e,t,n){if(e.tag===3)Pf(e,e,n);else for(;t!==null;){if(t.tag===3){Pf(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(el===null||!el.has(l))){e=$t(n,e),n=Pd(2),l=Kn(t,n,2),l!==null&&(ef(n,l,t,e),qn(l,2),un(l));break}}t=t.return}}function Wo(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new jg;var s=new Set;l.set(t,s)}else s=l.get(t),s===void 0&&(s=new Set,l.set(t,s));s.has(n)||(qo=!0,s.add(n),e=Tg.bind(null,e,t,n),t.then(e,e))}function Tg(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ye===e&&(Ce&n)===n&&(Ze===4||Ze===3&&(Ce&62914560)===Ce&&300>mt()-Cs?(Oe&2)===0&&ya(e,0):Lo|=n,ga===Ce&&(ga=0)),un(e)}function eh(e,t){t===0&&(t=Hi()),e=jl(e,t),e!==null&&(qn(e,t),un(e))}function Cg(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),eh(e,n)}function Mg(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(o(314))}l!==null&&l.delete(t),eh(e,n)}function Eg(e,t){return Ul(e,t)}var Os=null,ba=null,Ko=!1,Ns=!1,Zo=!1,ll=0;function un(e){e!==ba&&e.next===null&&(ba===null?Os=ba=e:ba=ba.next=e),Ns=!0,Ko||(Ko=!0,Ag())}function hi(e,t){if(!Zo&&Ns){Zo=!0;do for(var n=!1,l=Os;l!==null;){if(e!==0){var s=l.pendingLanes;if(s===0)var r=0;else{var f=l.suspendedLanes,p=l.pingedLanes;r=(1<<31-ut(42|e)+1)-1,r&=s&~(f&~p),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,ah(l,r))}else r=Ce,r=Un(l,l===Ye?r:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(r&3)===0||Bn(l,r)||(n=!0,ah(l,r));l=l.next}while(n);Zo=!1}}function _g(){th()}function th(){Ns=Ko=!1;var e=0;ll!==0&&$g()&&(e=ll);for(var t=mt(),n=null,l=Os;l!==null;){var s=l.next,r=nh(l,t);r===0?(l.next=null,n===null?Os=s:n.next=s,s===null&&(ba=n)):(n=l,(e!==0||(r&3)!==0)&&(Ns=!0)),l=s}it!==0&&it!==5||hi(e),ll!==0&&(ll=0)}function nh(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,s=e.expirationTimes,r=e.pendingLanes&-62914561;0<r;){var f=31-ut(r),p=1<<f,w=s[f];w===-1?((p&n)===0||(p&l)!==0)&&(s[f]=ur(p,t)):w<=t&&(e.expiredLanes|=p),r&=~p}if(t=Ye,n=Ce,n=Un(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(He===2||He===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Bl(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Bn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&Bl(l),$l(n)){case 2:case 8:n=Ea;break;case 32:n=Ll;break;case 268435456:n=pl;break;default:n=Ll}return l=lh.bind(null,e),n=Ul(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&Bl(l),e.callbackPriority=2,e.callbackNode=null,2}function lh(e,t){if(it!==0&&it!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Rs()&&e.callbackNode!==n)return null;var l=Ce;return l=Un(e,e===Ye?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Bf(e,l,t),nh(e,mt()),e.callbackNode!=null&&e.callbackNode===n?lh.bind(null,e):null)}function ah(e,t){if(Rs())return null;Bf(e,t,!0)}function Ag(){Gg(function(){(Oe&6)!==0?Ul(Ma,_g):th()})}function Fo(){if(ll===0){var e=ia;e===0&&(e=Ht,Ht<<=1,(Ht&261888)===0&&(Ht=256)),ll=e}return ll}function ih(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Gi(""+e)}function sh(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Dg(e,t,n,l,s){if(t==="submit"&&n&&n.stateNode===s){var r=ih((s[yt]||null).action),f=l.submitter;f&&(t=(t=f[yt]||null)?ih(t.formAction):f.getAttribute("formAction"),t!==null&&(r=t,f=null));var p=new Wi("action","action",null,l,s);e.push({event:p,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ll!==0){var w=f?sh(s,f):new FormData(s);go(n,{pending:!0,data:w,method:s.method,action:r},null,w)}}else typeof r=="function"&&(p.preventDefault(),w=f?sh(s,f):new FormData(s),go(n,{pending:!0,data:w,method:s.method,action:r},r,w))},currentTarget:s}]})}}for(var Jo=0;Jo<Dr.length;Jo++){var Io=Dr[Jo],Rg=Io.toLowerCase(),Og=Io[0].toUpperCase()+Io.slice(1);tn(Rg,"on"+Og)}tn(Hu,"onAnimationEnd"),tn(Uu,"onAnimationIteration"),tn(Bu,"onAnimationStart"),tn("dblclick","onDoubleClick"),tn("focusin","onFocus"),tn("focusout","onBlur"),tn(Fv,"onTransitionRun"),tn(Jv,"onTransitionStart"),tn(Iv,"onTransitionCancel"),tn(qu,"onTransitionEnd"),Ql("onMouseEnter",["mouseout","mouseover"]),Ql("onMouseLeave",["mouseout","mouseover"]),Ql("onPointerEnter",["pointerout","pointerover"]),Ql("onPointerLeave",["pointerout","pointerover"]),ml("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ml("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ml("onBeforeInput",["compositionend","keypress","textInput","paste"]),ml("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ml("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ml("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pi="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(" "),Ng=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pi));function rh(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],s=l.event;l=l.listeners;e:{var r=void 0;if(t)for(var f=l.length-1;0<=f;f--){var p=l[f],w=p.instance,O=p.currentTarget;if(p=p.listener,w!==r&&s.isPropagationStopped())break e;r=p,s.currentTarget=O;try{r(s)}catch(X){Fi(X)}s.currentTarget=null,r=w}else for(f=0;f<l.length;f++){if(p=l[f],w=p.instance,O=p.currentTarget,p=p.listener,w!==r&&s.isPropagationStopped())break e;r=p,s.currentTarget=O;try{r(s)}catch(X){Fi(X)}s.currentTarget=null,r=w}}}}function Te(e,t){var n=t[ae];n===void 0&&(n=t[ae]=new Set);var l=e+"__bubble";n.has(l)||(oh(t,e,2,!1),n.add(l))}function Po(e,t,n){var l=0;t&&(l|=4),oh(n,e,l,t)}var Hs="_reactListening"+Math.random().toString(36).slice(2);function ec(e){if(!e[Hs]){e[Hs]=!0,eu.forEach(function(n){n!=="selectionchange"&&(Ng.has(n)||Po(n,!1,e),Po(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Hs]||(t[Hs]=!0,Po("selectionchange",!1,t))}}function oh(e,t,n,l){switch(Uh(t)){case 2:var s=cm;break;case 8:s=um;break;default:s=vc}n=s.bind(null,t,n,e),s=void 0,!xr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),l?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function tc(e,t,n,l,s){var r=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var f=l.tag;if(f===3||f===4){var p=l.stateNode.containerInfo;if(p===s)break;if(f===4)for(f=l.return;f!==null;){var w=f.tag;if((w===3||w===4)&&f.stateNode.containerInfo===s)return;f=f.return}for(;p!==null;){if(f=Yl(p),f===null)return;if(w=f.tag,w===5||w===6||w===26||w===27){l=r=f;continue e}p=p.parentNode}}l=l.return}fu(function(){var O=r,X=mr(n),W=[];e:{var H=Lu.get(e);if(H!==void 0){var L=Wi,he=e;switch(e){case"keypress":if(Qi(n)===0)break e;case"keydown":case"keyup":L=Mv;break;case"focusin":he="focus",L=kr;break;case"focusout":he="blur",L=kr;break;case"beforeblur":case"afterblur":L=kr;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=vu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=gv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=Av;break;case Hu:case Uu:case Bu:L=xv;break;case qu:L=Rv;break;case"scroll":case"scrollend":L=pv;break;case"wheel":L=Nv;break;case"copy":case"cut":case"paste":L=jv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=mu;break;case"toggle":case"beforetoggle":L=Uv}var ye=(t&4)!==0,Le=!ye&&(e==="scroll"||e==="scrollend"),A=ye?H!==null?H+"Capture":null:H;ye=[];for(var C=O,R;C!==null;){var V=C;if(R=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||R===null||A===null||(V=Ha(C,A),V!=null&&ye.push(vi(C,V,R))),Le)break;C=C.return}0<ye.length&&(H=new L(H,he,null,n,X),W.push({event:H,listeners:ye}))}}if((t&7)===0){e:{if(H=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",H&&n!==gr&&(he=n.relatedTarget||n.fromElement)&&(Yl(he)||he[pn]))break e;if((L||H)&&(H=X.window===X?X:(H=X.ownerDocument)?H.defaultView||H.parentWindow:window,L?(he=n.relatedTarget||n.toElement,L=O,he=he?Yl(he):null,he!==null&&(Le=h(he),ye=he.tag,he!==Le||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(L=null,he=O),L!==he)){if(ye=vu,V="onMouseLeave",A="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(ye=mu,V="onPointerLeave",A="onPointerEnter",C="pointer"),Le=L==null?H:Na(L),R=he==null?H:Na(he),H=new ye(V,C+"leave",L,n,X),H.target=Le,H.relatedTarget=R,V=null,Yl(X)===O&&(ye=new ye(A,C+"enter",he,n,X),ye.target=R,ye.relatedTarget=Le,V=ye),Le=V,L&&he)t:{for(ye=Hg,A=L,C=he,R=0,V=A;V;V=ye(V))R++;V=0;for(var ve=C;ve;ve=ye(ve))V++;for(;0<R-V;)A=ye(A),R--;for(;0<V-R;)C=ye(C),V--;for(;R--;){if(A===C||C!==null&&A===C.alternate){ye=A;break t}A=ye(A),C=ye(C)}ye=null}else ye=null;L!==null&&ch(W,H,L,ye,!1),he!==null&&Le!==null&&ch(W,Le,he,ye,!0)}}e:{if(H=O?Na(O):window,L=H.nodeName&&H.nodeName.toLowerCase(),L==="select"||L==="input"&&H.type==="file")var Ae=zu;else if(ku(H))if(Tu)Ae=Wv;else{Ae=Qv;var pe=Xv}else L=H.nodeName,!L||L.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?O&&vr(O.elementType)&&(Ae=zu):Ae=Vv;if(Ae&&(Ae=Ae(e,O))){wu(W,Ae,n,X);break e}pe&&pe(e,H,O),e==="focusout"&&O&&H.type==="number"&&O.memoizedProps.value!=null&&pr(H,"number",H.value)}switch(pe=O?Na(O):window,e){case"focusin":(ku(pe)||pe.contentEditable==="true")&&(Jl=pe,Er=O,Xa=null);break;case"focusout":Xa=Er=Jl=null;break;case"mousedown":_r=!0;break;case"contextmenu":case"mouseup":case"dragend":_r=!1,Ou(W,n,X);break;case"selectionchange":if(Zv)break;case"keydown":case"keyup":Ou(W,n,X)}var ke;if(zr)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Fl?ju(e,n)&&(Me="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Me="onCompositionStart");Me&&(yu&&n.locale!=="ko"&&(Fl||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Fl&&(ke=hu()):($n=X,br="value"in $n?$n.value:$n.textContent,Fl=!0)),pe=Us(O,Me),0<pe.length&&(Me=new gu(Me,e,null,n,X),W.push({event:Me,listeners:pe}),ke?Me.data=ke:(ke=Su(n),ke!==null&&(Me.data=ke)))),(ke=qv?Lv(e,n):$v(e,n))&&(Me=Us(O,"onBeforeInput"),0<Me.length&&(pe=new gu("onBeforeInput","beforeinput",null,n,X),W.push({event:pe,listeners:Me}),pe.data=ke)),Dg(W,e,O,n,X)}rh(W,t)})}function vi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Us(e,t){for(var n=t+"Capture",l=[];e!==null;){var s=e,r=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||r===null||(s=Ha(e,n),s!=null&&l.unshift(vi(e,s,r)),s=Ha(e,t),s!=null&&l.push(vi(e,s,r))),e.tag===3)return l;e=e.return}return[]}function Hg(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ch(e,t,n,l,s){for(var r=t._reactName,f=[];n!==null&&n!==l;){var p=n,w=p.alternate,O=p.stateNode;if(p=p.tag,w!==null&&w===l)break;p!==5&&p!==26&&p!==27||O===null||(w=O,s?(O=Ha(n,r),O!=null&&f.unshift(vi(n,O,w))):s||(O=Ha(n,r),O!=null&&f.push(vi(n,O,w)))),n=n.return}f.length!==0&&e.push({event:t,listeners:f})}var Ug=/\r\n?/g,Bg=/\u0000|\uFFFD/g;function uh(e){return(typeof e=="string"?e:""+e).replace(Ug,`
9
- `).replace(Bg,"")}function dh(e,t){return t=uh(t),uh(e)===t}function qe(e,t,n,l,s,r){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Wl(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Wl(e,""+l);break;case"className":$i(e,"class",l);break;case"tabIndex":$i(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":$i(e,n,l);break;case"style":uu(e,l,r);break;case"data":if(t!=="object"){$i(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=Gi(""+l),e.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(n,"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 r=="function"&&(n==="formAction"?(t!=="input"&&qe(e,t,"name",s.name,s,null),qe(e,t,"formEncType",s.formEncType,s,null),qe(e,t,"formMethod",s.formMethod,s,null),qe(e,t,"formTarget",s.formTarget,s,null)):(qe(e,t,"encType",s.encType,s,null),qe(e,t,"method",s.method,s,null),qe(e,t,"target",s.target,s,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=Gi(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=gn);break;case"onScroll":l!=null&&Te("scroll",e);break;case"onScrollEnd":l!=null&&Te("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(n=l.__html,n!=null){if(s.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}n=Gi(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""+l):e.removeAttribute(n);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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":l===!0?e.setAttribute(n,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,l):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(n,l):e.removeAttribute(n);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(n):e.setAttribute(n,l);break;case"popover":Te("beforetoggle",e),Te("toggle",e),Li(e,"popover",l);break;case"xlinkActuate":vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":vn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":vn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":vn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":vn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Li(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=fv.get(n)||n,Li(e,n,l))}}function nc(e,t,n,l,s,r){switch(n){case"style":uu(e,l,r);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(n=l.__html,n!=null){if(s.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"children":typeof l=="string"?Wl(e,l):(typeof l=="number"||typeof l=="bigint")&&Wl(e,""+l);break;case"onScroll":l!=null&&Te("scroll",e);break;case"onScrollEnd":l!=null&&Te("scrollend",e);break;case"onClick":l!=null&&(e.onclick=gn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tu.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(s=n.endsWith("Capture"),t=n.slice(2,s?n.length-7:void 0),r=e[yt]||null,r=r!=null?r[n]:null,typeof r=="function"&&e.removeEventListener(t,r,s),typeof l=="function")){typeof r!="function"&&r!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,s);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):Li(e,n,l)}}}function pt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Te("error",e),Te("load",e);var l=!1,s=!1,r;for(r in n)if(n.hasOwnProperty(r)){var f=n[r];if(f!=null)switch(r){case"src":l=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:qe(e,t,r,f,n,null)}}s&&qe(e,t,"srcSet",n.srcSet,n,null),l&&qe(e,t,"src",n.src,n,null);return;case"input":Te("invalid",e);var p=r=f=s=null,w=null,O=null;for(l in n)if(n.hasOwnProperty(l)){var X=n[l];if(X!=null)switch(l){case"name":s=X;break;case"type":f=X;break;case"checked":w=X;break;case"defaultChecked":O=X;break;case"value":r=X;break;case"defaultValue":p=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(o(137,t));break;default:qe(e,t,l,X,n,null)}}su(e,r,p,w,O,f,s,!1);return;case"select":Te("invalid",e),l=f=r=null;for(s in n)if(n.hasOwnProperty(s)&&(p=n[s],p!=null))switch(s){case"value":r=p;break;case"defaultValue":f=p;break;case"multiple":l=p;default:qe(e,t,s,p,n,null)}t=r,n=f,e.multiple=!!l,t!=null?Vl(e,!!l,t,!1):n!=null&&Vl(e,!!l,n,!0);return;case"textarea":Te("invalid",e),r=s=l=null;for(f in n)if(n.hasOwnProperty(f)&&(p=n[f],p!=null))switch(f){case"value":l=p;break;case"defaultValue":s=p;break;case"children":r=p;break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(o(91));break;default:qe(e,t,f,p,n,null)}ou(e,l,s,r);return;case"option":for(w in n)n.hasOwnProperty(w)&&(l=n[w],l!=null)&&(w==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":qe(e,t,w,l,n,null));return;case"dialog":Te("beforetoggle",e),Te("toggle",e),Te("cancel",e),Te("close",e);break;case"iframe":case"object":Te("load",e);break;case"video":case"audio":for(l=0;l<pi.length;l++)Te(pi[l],e);break;case"image":Te("error",e),Te("load",e);break;case"details":Te("toggle",e);break;case"embed":case"source":case"link":Te("error",e),Te("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(O in n)if(n.hasOwnProperty(O)&&(l=n[O],l!=null))switch(O){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:qe(e,t,O,l,n,null)}return;default:if(vr(t)){for(X in n)n.hasOwnProperty(X)&&(l=n[X],l!==void 0&&nc(e,t,X,l,n,void 0));return}}for(p in n)n.hasOwnProperty(p)&&(l=n[p],l!=null&&qe(e,t,p,l,n,null))}function qg(e,t,n,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,r=null,f=null,p=null,w=null,O=null,X=null;for(L in n){var W=n[L];if(n.hasOwnProperty(L)&&W!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":w=W;default:l.hasOwnProperty(L)||qe(e,t,L,null,l,W)}}for(var H in l){var L=l[H];if(W=n[H],l.hasOwnProperty(H)&&(L!=null||W!=null))switch(H){case"type":r=L;break;case"name":s=L;break;case"checked":O=L;break;case"defaultChecked":X=L;break;case"value":f=L;break;case"defaultValue":p=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(o(137,t));break;default:L!==W&&qe(e,t,H,L,l,W)}}hr(e,f,p,w,O,X,r,s);return;case"select":L=f=p=H=null;for(r in n)if(w=n[r],n.hasOwnProperty(r)&&w!=null)switch(r){case"value":break;case"multiple":L=w;default:l.hasOwnProperty(r)||qe(e,t,r,null,l,w)}for(s in l)if(r=l[s],w=n[s],l.hasOwnProperty(s)&&(r!=null||w!=null))switch(s){case"value":H=r;break;case"defaultValue":p=r;break;case"multiple":f=r;default:r!==w&&qe(e,t,s,r,l,w)}t=p,n=f,l=L,H!=null?Vl(e,!!n,H,!1):!!l!=!!n&&(t!=null?Vl(e,!!n,t,!0):Vl(e,!!n,n?[]:"",!1));return;case"textarea":L=H=null;for(p in n)if(s=n[p],n.hasOwnProperty(p)&&s!=null&&!l.hasOwnProperty(p))switch(p){case"value":break;case"children":break;default:qe(e,t,p,null,l,s)}for(f in l)if(s=l[f],r=n[f],l.hasOwnProperty(f)&&(s!=null||r!=null))switch(f){case"value":H=s;break;case"defaultValue":L=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(o(91));break;default:s!==r&&qe(e,t,f,s,l,r)}ru(e,H,L);return;case"option":for(var he in n)H=n[he],n.hasOwnProperty(he)&&H!=null&&!l.hasOwnProperty(he)&&(he==="selected"?e.selected=!1:qe(e,t,he,null,l,H));for(w in l)H=l[w],L=n[w],l.hasOwnProperty(w)&&H!==L&&(H!=null||L!=null)&&(w==="selected"?e.selected=H&&typeof H!="function"&&typeof H!="symbol":qe(e,t,w,H,l,L));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 ye in n)H=n[ye],n.hasOwnProperty(ye)&&H!=null&&!l.hasOwnProperty(ye)&&qe(e,t,ye,null,l,H);for(O in l)if(H=l[O],L=n[O],l.hasOwnProperty(O)&&H!==L&&(H!=null||L!=null))switch(O){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(137,t));break;default:qe(e,t,O,H,l,L)}return;default:if(vr(t)){for(var Le in n)H=n[Le],n.hasOwnProperty(Le)&&H!==void 0&&!l.hasOwnProperty(Le)&&nc(e,t,Le,void 0,l,H);for(X in l)H=l[X],L=n[X],!l.hasOwnProperty(X)||H===L||H===void 0&&L===void 0||nc(e,t,X,H,l,L);return}}for(var A in n)H=n[A],n.hasOwnProperty(A)&&H!=null&&!l.hasOwnProperty(A)&&qe(e,t,A,null,l,H);for(W in l)H=l[W],L=n[W],!l.hasOwnProperty(W)||H===L||H==null&&L==null||qe(e,t,W,H,l,L)}function fh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Lg(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var s=n[l],r=s.transferSize,f=s.initiatorType,p=s.duration;if(r&&p&&fh(f)){for(f=0,p=s.responseEnd,l+=1;l<n.length;l++){var w=n[l],O=w.startTime;if(O>p)break;var X=w.transferSize,W=w.initiatorType;X&&fh(W)&&(w=w.responseEnd,f+=X*(w<p?1:(p-O)/(w-O)))}if(--l,t+=8*(r+f)/(s.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var lc=null,ac=null;function Bs(e){return e.nodeType===9?e:e.ownerDocument}function hh(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ph(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function ic(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var sc=null;function $g(){var e=window.event;return e&&e.type==="popstate"?e===sc?!1:(sc=e,!0):(sc=null,!1)}var vh=typeof setTimeout=="function"?setTimeout:void 0,Yg=typeof clearTimeout=="function"?clearTimeout:void 0,gh=typeof Promise=="function"?Promise:void 0,Gg=typeof queueMicrotask=="function"?queueMicrotask:typeof gh<"u"?function(e){return gh.resolve(null).then(e).catch(Xg)}:vh;function Xg(e){setTimeout(function(){throw e})}function al(e){return e==="head"}function mh(e,t){var n=t,l=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(s),wa(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")gi(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,gi(n);for(var r=n.firstChild;r;){var f=r.nextSibling,p=r.nodeName;r[Ln]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&r.rel.toLowerCase()==="stylesheet"||n.removeChild(r),r=f}}else n==="body"&&gi(e.ownerDocument.body);n=s}while(n);wa(t)}function yh(e,t){var n=e;e=0;do{var l=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=l}while(n)}function rc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":rc(n),Oa(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Qg(e,t,n,l){for(;e.nodeType===1;){var s=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Ln])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=Vt(e.nextSibling),e===null)break}return null}function Vg(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Vt(e.nextSibling),e===null))return null;return e}function xh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Vt(e.nextSibling),e===null))return null;return e}function oc(e){return e.data==="$?"||e.data==="$~"}function cc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Wg(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var l=function(){t(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Vt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var uc=null;function bh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Vt(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function jh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Sh(e,t,n){switch(t=Bs(n),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function gi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Oa(e)}var Wt=new Map,kh=new Set;function qs(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Dn=$.d;$.d={f:Kg,r:Zg,D:Fg,C:Jg,L:Ig,m:Pg,X:tm,S:em,M:nm};function Kg(){var e=Dn.f(),t=_s();return e||t}function Zg(e){var t=Gl(e);t!==null&&t.tag===5&&t.type==="form"?qd(t):Dn.r(e)}var ja=typeof document>"u"?null:document;function wh(e,t,n){var l=ja;if(l&&typeof t=="string"&&t){var s=qt(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),kh.has(s)||(kh.add(s),e={rel:e,crossOrigin:n,href:t},l.querySelector(s)===null&&(t=l.createElement("link"),pt(t,"link",e),st(t),l.head.appendChild(t)))}}function Fg(e){Dn.D(e),wh("dns-prefetch",e,null)}function Jg(e,t){Dn.C(e,t),wh("preconnect",e,t)}function Ig(e,t,n){Dn.L(e,t,n);var l=ja;if(l&&e&&t){var s='link[rel="preload"][as="'+qt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+qt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+qt(n.imageSizes)+'"]')):s+='[href="'+qt(e)+'"]';var r=s;switch(t){case"style":r=Sa(e);break;case"script":r=ka(e)}Wt.has(r)||(e=b({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Wt.set(r,e),l.querySelector(s)!==null||t==="style"&&l.querySelector(mi(r))||t==="script"&&l.querySelector(yi(r))||(t=l.createElement("link"),pt(t,"link",e),st(t),l.head.appendChild(t)))}}function Pg(e,t){Dn.m(e,t);var n=ja;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+qt(l)+'"][href="'+qt(e)+'"]',r=s;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=ka(e)}if(!Wt.has(r)&&(e=b({rel:"modulepreload",href:e},t),Wt.set(r,e),n.querySelector(s)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(yi(r)))return}l=n.createElement("link"),pt(l,"link",e),st(l),n.head.appendChild(l)}}}function em(e,t,n){Dn.S(e,t,n);var l=ja;if(l&&e){var s=Xl(l).hoistableStyles,r=Sa(e);t=t||"default";var f=s.get(r);if(!f){var p={loading:0,preload:null};if(f=l.querySelector(mi(r)))p.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Wt.get(r))&&dc(e,n);var w=f=l.createElement("link");st(w),pt(w,"link",e),w._p=new Promise(function(O,X){w.onload=O,w.onerror=X}),w.addEventListener("load",function(){p.loading|=1}),w.addEventListener("error",function(){p.loading|=2}),p.loading|=4,Ls(f,t,l)}f={type:"stylesheet",instance:f,count:1,state:p},s.set(r,f)}}}function tm(e,t){Dn.X(e,t);var n=ja;if(n&&e){var l=Xl(n).hoistableScripts,s=ka(e),r=l.get(s);r||(r=n.querySelector(yi(s)),r||(e=b({src:e,async:!0},t),(t=Wt.get(s))&&fc(e,t),r=n.createElement("script"),st(r),pt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},l.set(s,r))}}function nm(e,t){Dn.M(e,t);var n=ja;if(n&&e){var l=Xl(n).hoistableScripts,s=ka(e),r=l.get(s);r||(r=n.querySelector(yi(s)),r||(e=b({src:e,async:!0,type:"module"},t),(t=Wt.get(s))&&fc(e,t),r=n.createElement("script"),st(r),pt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},l.set(s,r))}}function zh(e,t,n,l){var s=(s=ue.current)?qs(s):null;if(!s)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Sa(n.href),n=Xl(s).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Sa(n.href);var r=Xl(s).hoistableStyles,f=r.get(e);if(f||(s=s.ownerDocument||s,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,f),(r=s.querySelector(mi(e)))&&!r._p&&(f.instance=r,f.state.loading=5),Wt.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Wt.set(e,n),r||lm(s,e,n,f.state))),t&&l===null)throw Error(o(528,""));return f}if(t&&l!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ka(n),n=Xl(s).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Sa(e){return'href="'+qt(e)+'"'}function mi(e){return'link[rel="stylesheet"]['+e+"]"}function Th(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function lm(e,t,n,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),pt(t,"link",n),st(t),e.head.appendChild(t))}function ka(e){return'[src="'+qt(e)+'"]'}function yi(e){return"script[async]"+e}function Ch(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+qt(n.href)+'"]');if(l)return t.instance=l,st(l),l;var s=b({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),st(l),pt(l,"style",s),Ls(l,n.precedence,e),t.instance=l;case"stylesheet":s=Sa(n.href);var r=e.querySelector(mi(s));if(r)return t.state.loading|=4,t.instance=r,st(r),r;l=Th(n),(s=Wt.get(s))&&dc(l,s),r=(e.ownerDocument||e).createElement("link"),st(r);var f=r;return f._p=new Promise(function(p,w){f.onload=p,f.onerror=w}),pt(r,"link",l),t.state.loading|=4,Ls(r,n.precedence,e),t.instance=r;case"script":return r=ka(n.src),(s=e.querySelector(yi(r)))?(t.instance=s,st(s),s):(l=n,(s=Wt.get(r))&&(l=b({},n),fc(l,s)),e=e.ownerDocument||e,s=e.createElement("script"),st(s),pt(s,"link",l),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Ls(l,n.precedence,e));return t.instance}function Ls(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=l.length?l[l.length-1]:null,r=s,f=0;f<l.length;f++){var p=l[f];if(p.dataset.precedence===t)r=p;else if(r!==s)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function dc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function fc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var $s=null;function Mh(e,t,n){if($s===null){var l=new Map,s=$s=new Map;s.set(n,l)}else s=$s,l=s.get(n),l||(l=new Map,s.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),s=0;s<n.length;s++){var r=n[s];if(!(r[Ln]||r[at]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var f=r.getAttribute(t)||"";f=e+f;var p=l.get(f);p?p.push(r):l.set(f,[r])}}return l}function Eh(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function am(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function _h(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function im(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var s=Sa(l.href),r=t.querySelector(mi(s));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ys.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,st(r);return}r=t.ownerDocument||t,l=Th(l),(s=Wt.get(s))&&dc(l,s),r=r.createElement("link"),st(r);var f=r;f._p=new Promise(function(p,w){f.onload=p,f.onerror=w}),pt(r,"link",l),n.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Ys.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var hc=0;function sm(e,t){return e.stylesheets&&e.count===0&&Xs(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&Xs(e,e.stylesheets),e.unsuspend){var r=e.unsuspend;e.unsuspend=null,r()}},6e4+t);0<e.imgBytes&&hc===0&&(hc=62500*Lg());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xs(e,e.stylesheets),e.unsuspend)){var r=e.unsuspend;e.unsuspend=null,r()}},(e.imgBytes>hc?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(s)}}:null}function Ys(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Gs=null;function Xs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Gs=new Map,t.forEach(rm,e),Gs=null,Ys.call(e))}function rm(e,t){if(!(t.state.loading&4)){var n=Gs.get(e);if(n)var l=n.get(null);else{n=new Map,Gs.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<s.length;r++){var f=s[r];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(n.set(f.dataset.precedence,f),l=f)}l&&n.set(null,l)}s=t.instance,f=s.getAttribute("data-precedence"),r=n.get(f)||l,r===l&&n.set(null,s),n.set(f,s),this.count++,l=Ys.bind(this),s.addEventListener("load",l),s.addEventListener("error",l),r?r.parentNode.insertBefore(s,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var xi={$$typeof:U,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function om(e,t,n,l,s,r,f,p,w){this.tag=1,this.containerInfo=e,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=Aa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Aa(0),this.hiddenUpdates=Aa(null),this.identifierPrefix=l,this.onUncaughtError=s,this.onCaughtError=r,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function Ah(e,t,n,l,s,r,f,p,w,O,X,W){return e=new om(e,t,n,f,w,O,X,W,p),t=1,r===!0&&(t|=24),r=_t(3,null,null,t),e.current=r,r.stateNode=e,t=Qr(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:l,isDehydrated:n,cache:t},Zr(r),e}function Dh(e){return e?(e=ea,e):ea}function Rh(e,t,n,l,s,r){s=Dh(s),l.context===null?l.context=s:l.pendingContext=s,l=Wn(t),l.payload={element:n},r=r===void 0?null:r,r!==null&&(l.callback=r),n=Kn(e,l,t),n!==null&&(Ct(n,e,t),Ja(n,e,t))}function Oh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function pc(e,t){Oh(e,t),(e=e.alternate)&&Oh(e,t)}function Nh(e){if(e.tag===13||e.tag===31){var t=jl(e,67108864);t!==null&&Ct(t,e,67108864),pc(e,67108864)}}function Hh(e){if(e.tag===13||e.tag===31){var t=Nt();t=vl(t);var n=jl(e,t);n!==null&&Ct(n,e,t),pc(e,t)}}var Qs=!0;function cm(e,t,n,l){var s=E.T;E.T=null;var r=$.p;try{$.p=2,vc(e,t,n,l)}finally{$.p=r,E.T=s}}function um(e,t,n,l){var s=E.T;E.T=null;var r=$.p;try{$.p=8,vc(e,t,n,l)}finally{$.p=r,E.T=s}}function vc(e,t,n,l){if(Qs){var s=gc(l);if(s===null)tc(e,t,l,Vs,n),Bh(e,l);else if(fm(s,e,t,n,l))l.stopPropagation();else if(Bh(e,l),t&4&&-1<dm.indexOf(e)){for(;s!==null;){var r=Gl(s);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var f=It(r.pendingLanes);if(f!==0){var p=r;for(p.pendingLanes|=2,p.entangledLanes|=2;f;){var w=1<<31-ut(f);p.entanglements[1]|=w,f&=~w}un(r),(Oe&6)===0&&(Ms=mt()+500,hi(0))}}break;case 31:case 13:p=jl(r,2),p!==null&&Ct(p,r,2),_s(),pc(r,2)}if(r=gc(l),r===null&&tc(e,t,l,Vs,n),r===s)break;s=r}s!==null&&l.stopPropagation()}else tc(e,t,l,null,n)}}function gc(e){return e=mr(e),mc(e)}var Vs=null;function mc(e){if(Vs=null,e=Yl(e),e!==null){var t=h(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=g(t),e!==null)return e;e=null}else if(n===31){if(e=y(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Vs=e,null}function Uh(e){switch(e){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(or()){case Ma:return 2;case Ea:return 8;case Ll:case hn:return 32;case pl:return 268435456;default:return 32}default:return 32}}var yc=!1,il=null,sl=null,rl=null,bi=new Map,ji=new Map,ol=[],dm="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 Bh(e,t){switch(e){case"focusin":case"focusout":il=null;break;case"dragenter":case"dragleave":sl=null;break;case"mouseover":case"mouseout":rl=null;break;case"pointerover":case"pointerout":bi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ji.delete(t.pointerId)}}function Si(e,t,n,l,s,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:r,targetContainers:[s]},t!==null&&(t=Gl(t),t!==null&&Nh(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function fm(e,t,n,l,s){switch(t){case"focusin":return il=Si(il,e,t,n,l,s),!0;case"dragenter":return sl=Si(sl,e,t,n,l,s),!0;case"mouseover":return rl=Si(rl,e,t,n,l,s),!0;case"pointerover":var r=s.pointerId;return bi.set(r,Si(bi.get(r)||null,e,t,n,l,s)),!0;case"gotpointercapture":return r=s.pointerId,ji.set(r,Si(ji.get(r)||null,e,t,n,l,s)),!0}return!1}function qh(e){var t=Yl(e.target);if(t!==null){var n=h(t);if(n!==null){if(t=n.tag,t===13){if(t=g(n),t!==null){e.blockedOn=t,Ra(e.priority,function(){Hh(n)});return}}else if(t===31){if(t=y(n),t!==null){e.blockedOn=t,Ra(e.priority,function(){Hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ws(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gc(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);gr=l,n.target.dispatchEvent(l),gr=null}else return t=Gl(n),t!==null&&Nh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ws(e)&&n.delete(t)}function hm(){yc=!1,il!==null&&Ws(il)&&(il=null),sl!==null&&Ws(sl)&&(sl=null),rl!==null&&Ws(rl)&&(rl=null),bi.forEach(Lh),ji.forEach(Lh)}function Ks(e,t){e.blockedOn===t&&(e.blockedOn=null,yc||(yc=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,hm)))}var Zs=null;function $h(e){Zs!==e&&(Zs=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Zs===e&&(Zs=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],s=e[t+2];if(typeof l!="function"){if(mc(l||n)===null)continue;break}var r=Gl(n);r!==null&&(e.splice(t,3),t-=3,go(r,{pending:!0,data:s,method:n.method,action:l},l,s))}}))}function wa(e){function t(w){return Ks(w,e)}il!==null&&Ks(il,e),sl!==null&&Ks(sl,e),rl!==null&&Ks(rl,e),bi.forEach(t),ji.forEach(t);for(var n=0;n<ol.length;n++){var l=ol[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ol.length&&(n=ol[0],n.blockedOn===null);)qh(n),n.blockedOn===null&&ol.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var s=n[l],r=n[l+1],f=s[yt]||null;if(typeof r=="function")f||$h(n);else if(f){var p=null;if(r&&r.hasAttribute("formAction")){if(s=r,f=r[yt]||null)p=f.formAction;else if(mc(s)!==null)continue}else p=f.action;typeof p=="function"?n[l+1]=p:(n.splice(l,3),l-=3),$h(n)}}}function Yh(){function e(r){r.canIntercept&&r.info==="react-transition"&&r.intercept({handler:function(){return new Promise(function(f){return s=f})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var r=navigation.currentEntry;r&&r.url!=null&&navigation.navigate(r.url,{state:r.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function xc(e){this._internalRoot=e}Fs.prototype.render=xc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current,l=Nt();Rh(n,l,e,t,null,null)},Fs.prototype.unmount=xc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Rh(e.current,2,null,e,null,null),_s(),t[pn]=null}};function Fs(e){this._internalRoot=e}Fs.prototype.unstable_scheduleHydration=function(e){if(e){var t=Da();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ol.length&&t!==0&&t<ol[n].priority;n++);ol.splice(n,0,e),n===0&&qh(e)}};var Gh=c.version;if(Gh!=="19.2.8")throw Error(o(527,Gh,"19.2.8"));$.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=v(t),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var pm={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Js=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Js.isDisabled&&Js.supportsFiber)try{Hn=Js.inject(pm),ct=Js}catch{}}return wi.createRoot=function(e,t){if(!d(e))throw Error(o(299));var n=!1,l="",s=Zd,r=Fd,f=Jd;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=Ah(e,1,!1,null,null,n,l,null,s,r,f,Yh),e[pn]=t.current,ec(e),new xc(t)},wi.hydrateRoot=function(e,t,n){if(!d(e))throw Error(o(299));var l=!1,s="",r=Zd,f=Fd,p=Jd,w=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(p=n.onRecoverableError),n.formState!==void 0&&(w=n.formState)),t=Ah(e,1,!0,t,n??null,l,s,w,r,f,p,Yh),t.context=Dh(null),n=t.current,l=Nt(),l=vl(l),s=Wn(l),s.callback=null,Kn(n,s,l),n=l,t.current.lanes=n,qn(t,n),un(t),e[pn]=t.current,ec(e),new Fs(t)},wi.version="19.2.8",wi}var Ph;function zm(){if(Ph)return Sc.exports;Ph=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),Sc.exports=wm(),Sc.exports}var Tm=zm();const Cm=["run_started","run_resumed","run_finished","run_error","run_titled","cost","budget_alert","budget_stop","usage_limit","mission_incomplete","settings_changed","message","steer","worker_started","worker_progress","worker_finished","worker_stalled","worker_looping","director_looping","service_exposed","auto_allowed","auto_denied","root_allowed","permission_request","permission_resolved","permission_timeout","question","question_answered","question_timeout","chat_message","chat_turn","chat_cost","chat_error","chat_cleared","chat_proposal_dismissed","chat_question","chat_answered","chat_question_timeout","mission_proposed","models_changed","git_branch","git_note","git_committed","pull_request","memory_updated"],Yc=new Set,ir=new Set;let zi=null;function Hp(){if(!zi){zi=new EventSource("/events"),zi.onopen=()=>ir.forEach(i=>i(!0)),zi.onerror=()=>ir.forEach(i=>i(!1));for(const i of Cm)zi.addEventListener(i,c=>{const u=JSON.parse(c.data);Yc.forEach(o=>o(i,u))})}}function Ei(i){return Hp(),Yc.add(i),()=>Yc.delete(i)}function Mm(i){return Hp(),ir.add(i),()=>ir.delete(i)}function dl(i){return i.costBasis==="priced"||i.costBasis==="free"||i.costBasis==="unpriced"?i.costBasis:i.metered===!1?"unpriced":"priced"}function Up(i){if(i)switch(i.kind){case"claude-code":return i.configDir;case"codex":return i.codexHome??"~/.codex";case"openai-compatible":return i.baseUrl;case"anthropic-api":return`$${i.apiKeyEnv}`}}const Zc={runStatus:"idle",mission:"",title:"",costBasis:"priced",usage:null,costUsd:0,budgetUsd:5,agents:[],entries:[],approvals:[],questions:[],missionDoc:null,services:[]};let $e=0;function Bp(i,c,u){const o=[],d=(h,g,y)=>o.push({id:++$e,ts:u,agent:i,kind:h,title:g,body:y});if(c.type==="system"&&c.subtype==="init")d("system","init",`model: ${c.model??"?"}`);else if(c.type==="assistant"){for(const h of c.message?.content??[])if(h.type==="text"&&h.text?.trim())d("text",i,h.text);else if(h.type==="tool_use"){const g=String(h.name).replace("mcp__foreman__","").replace("mcp__playwright__","");d("tool",g,JSON.stringify(h.input).slice(0,4e3))}}else if(c.type==="user"&&Array.isArray(c.message?.content)){for(const h of c.message.content)if(h.type==="tool_result"){const g=typeof h.content=="string"?h.content:(h.content??[]).map(y=>y.text??"").join("");d("result","result",String(g).slice(0,700))}}else c.type==="result"&&d(c.is_error?"error":"system",`result · ${c.subtype??""}`,String(c.result??"").slice(0,2500));return o}const ep=i=>String(i??"").replace(/\s+/g," ").trim();function Em(i,c){if(i.kind==="system"&&i.title.startsWith("result ·")&&i.body){for(let u=c.length-1;u>=0&&u>=c.length-40;u--){const o=c[u];if(o.agent===i.agent&&o.kind==="text"){const d=ep(o.body),h=ep(i.body);return d.length>=40&&h.length>=40&&(d.startsWith(h)||h.startsWith(d))?{...i,body:""}:i}}return i}if(i.kind==="result"){const u=/^\[(worker-\d+) (finished|failed|done|started|resumed|stalled|interrupted)\]\s*/.exec(i.body);if(u){const o=i.body.slice(u[0].length).split(`
10
- `).find(d=>d.trim())??"";return{...i,title:`${u[1]} ${u[2]}`,body:o.length>160?`${o.slice(0,159).trimEnd()}…`:o}}}return i}function _m(i,c){const u=c.ts??Date.now(),o=c.data;switch(c.event){case"run_started":return{...Zc,missionDoc:i.missionDoc,runStatus:"running",mission:o.mission,budgetUsd:o.budgetUsd,costBasis:dl(o),usage:o.usage??null,agents:[{id:"director",status:"running"}]};case"run_resumed":{const d=i.agents.filter(h=>h.id!=="director").map(h=>h.status==="running"?{...h,status:"interrupted"}:h);return{...i,runStatus:"running",mission:o.mission??i.mission,budgetUsd:o.budgetUsd??i.budgetUsd,costUsd:o.costUsd??i.costUsd,costBasis:o.costBasis||o.metered!==void 0?dl(o):i.costBasis,usage:o.usage??i.usage,agents:[{id:"director",status:"running"},...d],entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"system",title:"mission resumed",body:"Director session restored; re-verifying state against MISSION.md."}]}}case"run_finished":return{...i,runStatus:o.status||"done",costUsd:o.costUsd??i.costUsd,approvals:[],questions:[],agents:i.agents.map(d=>d.id==="director"?{...d,status:o.status||"done"}:d)};case"mission_incomplete":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"error",title:"not done",body:[o.text,"",...(o.unmet??[]).map(d=>`▢ ${d}`)].join(`
5
+ `);for(s=a=0;a<w.length&&!w[a].includes("DetermineComponentFrameRoot");)a++;for(;s<O.length&&!O[s].includes("DetermineComponentFrameRoot");)s++;if(a===w.length||s===O.length)for(a=w.length-1,s=O.length-1;1<=a&&0<=s&&w[a]!==O[s];)s--;for(;1<=a&&0<=s;a--,s--)if(w[a]!==O[s]){if(a!==1||s!==1)do if(a--,s--,0>s||w[a]!==O[s]){var X=`
6
+ `+w[a].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=a&&0<=s);break}}}finally{bt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ge(n):""}function sn(e,t){switch(e.tag){case 26:case 27:case 5:return Ge(e.type);case 16:return Ge("Lazy");case 13:return e.child!==t&&t!==null?Ge("Suspense Fallback"):Ge("Suspense");case 19:return Ge("SuspenseList");case 0:case 15:return ha(e.type,!1);case 11:return ha(e.type.render,!1);case 1:return ha(e.type,!0);case 31:return Ge("Activity");default:return""}}function Ua(e){try{var t="",n=null;do t+=sn(e,n),n=e,e=e.return;while(e);return t}catch(a){return`
7
+ Error generating stack: `+a.message+`
8
+ `+a.stack}}var Nn=Object.prototype.hasOwnProperty,Ba=i.unstable_scheduleCallback,qa=i.unstable_cancelCallback,La=i.unstable_shouldYield,El=i.unstable_requestPaint,mt=i.unstable_now,or=i.unstable_getCurrentPriorityLevel,_l=i.unstable_ImmediatePriority,Al=i.unstable_UserBlockingPriority,$a=i.unstable_NormalPriority,hn=i.unstable_LowPriority,pa=i.unstable_IdlePriority,Oi=i.log,Ni=i.unstable_setDisableYieldValue,Hn=null,ct=null;function Ft(e){if(typeof Oi=="function"&&Ni(e),ct&&typeof ct.setStrictMode=="function")try{ct.setStrictMode(Hn,e)}catch{}}var ut=Math.clz32?Math.clz32:Dl,cr=Math.log,Hi=Math.LN2;function Dl(e){return e>>>=0,e===0?32:31-(cr(e)/Hi|0)|0}var Ht=256,Ut=262144,Jt=4194304;function It(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Un(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var s=0,r=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var p=a&134217727;return p!==0?(a=p&~r,a!==0?s=It(a):(f&=p,f!==0?s=It(f):n||(n=p&~e,n!==0&&(s=It(n))))):(p=a&~r,p!==0?s=It(p):f!==0?s=It(f):n||(n=a&~e,n!==0&&(s=It(n)))),s===0?0:t!==0&&t!==s&&(t&r)===0&&(r=s&-s,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:s}function Bn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ur(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Ui(){var e=Jt;return Jt<<=1,(Jt&62914560)===0&&(Jt=4194304),e}function va(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function dr(e,t,n,a,s,r){var f=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var p=e.entanglements,w=e.expirationTimes,O=e.hiddenUpdates;for(n=f&~n;0<n;){var X=31-ut(n),K=1<<X;p[X]=0,w[X]=-1;var H=O[X];if(H!==null)for(O[X]=null,X=0;X<H.length;X++){var L=H[X];L!==null&&(L.lane&=-536870913)}n&=~K}a!==0&&Ya(e,a,0),r!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=r&~(f&~t))}function Ya(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-ut(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&261930}function Bi(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-ut(n),s=1<<a;s&t|e[a]&t&&(e[a]|=t),n&=~s}}function qi(e,t){var n=t&-t;return n=(n&42)!==0?1:ga(n),(n&(e.suspendedLanes|t))!==0?0:n}function ga(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ga(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rl(){var e=G.p;return e!==0?e:(e=window.event,e===void 0?32:Uh(e.type))}function Ol(e,t){var n=G.p;try{return G.p=e,t()}finally{G.p=n}}var Pt=Math.random().toString(36).slice(2),it="__reactFiber$"+Pt,yt="__reactProps$"+Pt,pn="__reactContainer$"+Pt,ae="__reactEvents$"+Pt,Je="__reactListeners$"+Pt,en="__reactHandles$"+Pt,ma="__reactResources$"+Pt,Ln="__reactMarker$"+Pt;function Nl(e){delete e[it],delete e[yt],delete e[ae],delete e[Je],delete e[en]}function Xa(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[pn]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=jh(e);e!==null;){if(n=e[it])return n;e=jh(e)}return t}e=n,n=e.parentNode}return null}function Qa(e){if(e=e[it]||e[pn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Hl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Va(e){var t=e[ma];return t||(t=e[ma]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function rt(e){e[Ln]=!0}var eu=new Set,tu={};function ya(e,t){Wa(e,t),Wa(e+"Capture",t)}function Wa(e,t){for(tu[e]=t,e=0;e<t.length;e++)eu.add(t[e])}var rv=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]*$"),nu={},au={};function ov(e){return Nn.call(au,e)?!0:Nn.call(nu,e)?!1:rv.test(e)?au[e]=!0:(nu[e]=!0,!1)}function Li(e,t,n){if(ov(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function $i(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function vn(e,t,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+a)}}function Bt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cv(e,t,n){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var s=a.get,r=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(f){n=""+f,r.call(this,f)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return n},setValue:function(f){n=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function fr(e){if(!e._valueTracker){var t=lu(e)?"checked":"value";e._valueTracker=cv(e,t,""+e[t])}}function iu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=lu(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function Yi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var uv=/[\n"\\]/g;function qt(e){return e.replace(uv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function hr(e,t,n,a,s,r,f,p){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Bt(t)):e.value!==""+Bt(t)&&(e.value=""+Bt(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?pr(e,f,Bt(t)):n!=null?pr(e,f,Bt(n)):a!=null&&e.removeAttribute("value"),s==null&&r!=null&&(e.defaultChecked=!!r),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.name=""+Bt(p):e.removeAttribute("name")}function su(e,t,n,a,s,r,f,p){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null)){fr(e);return}n=n!=null?""+Bt(n):"",t=t!=null?""+Bt(t):n,p||t===e.value||(e.value=t),e.defaultValue=t}a=a??s,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=p?e.checked:!!a,e.defaultChecked=!!a,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),fr(e)}function pr(e,t,n){t==="number"&&Yi(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ka(e,t,n,a){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&a&&(e[n].defaultSelected=!0)}else{for(n=""+Bt(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,a&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function ru(e,t,n){if(t!=null&&(t=""+Bt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Bt(n):""}function ou(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(o(92));if(ne(a)){if(1<a.length)throw Error(o(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=Bt(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a),fr(e)}function Za(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var dv=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 cu(e,t,n){var a=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,n):typeof n!="number"||n===0||dv.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function uu(e,t,n){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,n!=null){for(var a in n)!n.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var s in t)a=t[s],t.hasOwnProperty(s)&&n[s]!==a&&cu(e,s,a)}else for(var r in t)t.hasOwnProperty(r)&&cu(e,r,t[r])}function vr(e){if(e.indexOf("-")===-1)return!1;switch(e){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 fv=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"]]),hv=/^[\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 Gi(e){return hv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function gn(){}var gr=null;function mr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fa=null,Ja=null;function du(e){var t=Qa(e);if(t&&(e=t.stateNode)){var n=e[yt]||null;e:switch(e=t.stateNode,t.type){case"input":if(hr(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+qt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var s=a[yt]||null;if(!s)throw Error(o(90));hr(a,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&iu(a)}break e;case"textarea":ru(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ka(e,!!n.multiple,t,!1)}}}var yr=!1;function fu(e,t,n){if(yr)return e(t,n);yr=!0;try{var a=e(t);return a}finally{if(yr=!1,(Fa!==null||Ja!==null)&&(_s(),Fa&&(t=Fa,e=Ja,Ja=Fa=null,du(t),e)))for(t=0;t<e.length;t++)du(e[t])}}function Ul(e,t){var n=e.stateNode;if(n===null)return null;var a=n[yt]||null;if(a===null)return null;n=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(o(231,t,typeof n));return n}var mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xr=!1;if(mn)try{var Bl={};Object.defineProperty(Bl,"passive",{get:function(){xr=!0}}),window.addEventListener("test",Bl,Bl),window.removeEventListener("test",Bl,Bl)}catch{xr=!1}var $n=null,br=null,Xi=null;function hu(){if(Xi)return Xi;var e,t=br,n=t.length,a,s="value"in $n?$n.value:$n.textContent,r=s.length;for(e=0;e<n&&t[e]===s[e];e++);var f=n-e;for(a=1;a<=f&&t[n-a]===s[r-a];a++);return Xi=s.slice(e,1<a?1-a:void 0)}function Qi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Vi(){return!0}function pu(){return!1}function St(e){function t(n,a,s,r,f){this._reactName=n,this._targetInst=s,this.type=a,this.nativeEvent=r,this.target=f,this.currentTarget=null;for(var p in e)e.hasOwnProperty(p)&&(n=e[p],this[p]=n?n(r):r[p]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?Vi:pu,this.isPropagationStopped=pu,this}return x(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Vi)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Vi)},persist:function(){},isPersistent:Vi}),t}var xa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wi=St(xa),ql=x({},xa,{view:0,detail:0}),pv=St(ql),jr,Sr,Ll,Ki=x({},ql,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ll&&(Ll&&e.type==="mousemove"?(jr=e.screenX-Ll.screenX,Sr=e.screenY-Ll.screenY):Sr=jr=0,Ll=e),jr)},movementY:function(e){return"movementY"in e?e.movementY:Sr}}),vu=St(Ki),vv=x({},Ki,{dataTransfer:0}),gv=St(vv),mv=x({},ql,{relatedTarget:0}),kr=St(mv),yv=x({},xa,{animationName:0,elapsedTime:0,pseudoElement:0}),xv=St(yv),bv=x({},xa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jv=St(bv),Sv=x({},xa,{data:0}),gu=St(Sv),kv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wv={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"},zv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Tv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=zv[e])?!!t[e]:!1}function wr(){return Tv}var Cv=x({},ql,{key:function(e){if(e.key){var t=kv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Qi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wr,charCode:function(e){return e.type==="keypress"?Qi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Qi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Mv=St(Cv),Ev=x({},Ki,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mu=St(Ev),_v=x({},ql,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wr}),Av=St(_v),Dv=x({},xa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Rv=St(Dv),Ov=x({},Ki,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Nv=St(Ov),Hv=x({},xa,{newState:0,oldState:0}),Uv=St(Hv),Bv=[9,13,27,32],zr=mn&&"CompositionEvent"in window,$l=null;mn&&"documentMode"in document&&($l=document.documentMode);var qv=mn&&"TextEvent"in window&&!$l,yu=mn&&(!zr||$l&&8<$l&&11>=$l),xu=" ",bu=!1;function ju(e,t){switch(e){case"keyup":return Bv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Su(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ia=!1;function Lv(e,t){switch(e){case"compositionend":return Su(t);case"keypress":return t.which!==32?null:(bu=!0,xu);case"textInput":return e=t.data,e===xu&&bu?null:e;default:return null}}function $v(e,t){if(Ia)return e==="compositionend"||!zr&&ju(e,t)?(e=hu(),Xi=br=$n=null,Ia=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return yu&&t.locale!=="ko"?null:t.data;default:return null}}var Yv={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 ku(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Yv[e.type]:t==="textarea"}function wu(e,t,n,a){Fa?Ja?Ja.push(a):Ja=[a]:Fa=a,t=Us(t,"onChange"),0<t.length&&(n=new Wi("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var Yl=null,Gl=null;function Gv(e){rh(e,0)}function Zi(e){var t=Hl(e);if(iu(t))return e}function zu(e,t){if(e==="change")return t}var Tu=!1;if(mn){var Tr;if(mn){var Cr="oninput"in document;if(!Cr){var Cu=document.createElement("div");Cu.setAttribute("oninput","return;"),Cr=typeof Cu.oninput=="function"}Tr=Cr}else Tr=!1;Tu=Tr&&(!document.documentMode||9<document.documentMode)}function Mu(){Yl&&(Yl.detachEvent("onpropertychange",Eu),Gl=Yl=null)}function Eu(e){if(e.propertyName==="value"&&Zi(Gl)){var t=[];wu(t,Gl,e,mr(e)),fu(Gv,t)}}function Xv(e,t,n){e==="focusin"?(Mu(),Yl=t,Gl=n,Yl.attachEvent("onpropertychange",Eu)):e==="focusout"&&Mu()}function Qv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zi(Gl)}function Vv(e,t){if(e==="click")return Zi(t)}function Wv(e,t){if(e==="input"||e==="change")return Zi(t)}function Kv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Et=typeof Object.is=="function"?Object.is:Kv;function Xl(e,t){if(Et(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var s=n[a];if(!Nn.call(t,s)||!Et(e[s],t[s]))return!1}return!0}function _u(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Au(e,t){var n=_u(e);e=0;for(var a;n;){if(n.nodeType===3){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=_u(n)}}function Du(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Du(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ru(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Yi(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yi(e.document)}return t}function Mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Zv=mn&&"documentMode"in document&&11>=document.documentMode,Pa=null,Er=null,Ql=null,_r=!1;function Ou(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_r||Pa==null||Pa!==Yi(a)||(a=Pa,"selectionStart"in a&&Mr(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ql&&Xl(Ql,a)||(Ql=a,a=Us(Er,"onSelect"),0<a.length&&(t=new Wi("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Pa)))}function ba(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var el={animationend:ba("Animation","AnimationEnd"),animationiteration:ba("Animation","AnimationIteration"),animationstart:ba("Animation","AnimationStart"),transitionrun:ba("Transition","TransitionRun"),transitionstart:ba("Transition","TransitionStart"),transitioncancel:ba("Transition","TransitionCancel"),transitionend:ba("Transition","TransitionEnd")},Ar={},Nu={};mn&&(Nu=document.createElement("div").style,"AnimationEvent"in window||(delete el.animationend.animation,delete el.animationiteration.animation,delete el.animationstart.animation),"TransitionEvent"in window||delete el.transitionend.transition);function ja(e){if(Ar[e])return Ar[e];if(!el[e])return e;var t=el[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Nu)return Ar[e]=t[n];return e}var Hu=ja("animationend"),Uu=ja("animationiteration"),Bu=ja("animationstart"),Fv=ja("transitionrun"),Jv=ja("transitionstart"),Iv=ja("transitioncancel"),qu=ja("transitionend"),Lu=new Map,Dr="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(" ");Dr.push("scrollEnd");function tn(e,t){Lu.set(e,t),ya(t,[e])}var Fi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Lt=[],tl=0,Rr=0;function Ji(){for(var e=tl,t=Rr=tl=0;t<e;){var n=Lt[t];Lt[t++]=null;var a=Lt[t];Lt[t++]=null;var s=Lt[t];Lt[t++]=null;var r=Lt[t];if(Lt[t++]=null,a!==null&&s!==null){var f=a.pending;f===null?s.next=s:(s.next=f.next,f.next=s),a.pending=s}r!==0&&$u(n,s,r)}}function Ii(e,t,n,a){Lt[tl++]=e,Lt[tl++]=t,Lt[tl++]=n,Lt[tl++]=a,Rr|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Or(e,t,n,a){return Ii(e,t,n,a),Pi(e)}function Sa(e,t){return Ii(e,null,null,t),Pi(e)}function $u(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var s=!1,r=e.return;r!==null;)r.childLanes|=n,a=r.alternate,a!==null&&(a.childLanes|=n),r.tag===22&&(e=r.stateNode,e===null||e._visibility&1||(s=!0)),e=r,r=r.return;return e.tag===3?(r=e.stateNode,s&&t!==null&&(s=31-ut(n),e=r.hiddenUpdates,a=e[s],a===null?e[s]=[t]:a.push(t),t.lane=n|536870912),r):null}function Pi(e){if(50<hi)throw hi=0,Xo=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var nl={};function Pv(e,t,n,a){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _t(e,t,n,a){return new Pv(e,t,n,a)}function Nr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function yn(e,t){var n=e.alternate;return n===null?(n=_t(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Yu(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function es(e,t,n,a,s,r){var f=0;if(a=e,typeof e=="function")Nr(e)&&(f=1);else if(typeof e=="string")f=lm(e,n,I.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Y:return e=_t(31,n,t,s),e.elementType=Y,e.lanes=r,e;case Z:return ka(n.children,s,r,t);case C:f=8,s|=24;break;case z:return e=_t(12,n,t,s|2),e.elementType=z,e.lanes=r,e;case re:return e=_t(13,n,t,s),e.elementType=re,e.lanes=r,e;case q:return e=_t(19,n,t,s),e.elementType=q,e.lanes=r,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:f=10;break e;case D:f=9;break e;case J:f=11;break e;case N:f=14;break e;case $:f=16,a=null;break e}f=29,n=Error(o(130,e===null?"null":typeof e,"")),a=null}return t=_t(f,n,t,s),t.elementType=e,t.type=a,t.lanes=r,t}function ka(e,t,n,a){return e=_t(7,e,a,t),e.lanes=n,e}function Hr(e,t,n){return e=_t(6,e,null,t),e.lanes=n,e}function Gu(e){var t=_t(18,null,null,0);return t.stateNode=e,t}function Ur(e,t,n){return t=_t(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Xu=new WeakMap;function $t(e,t){if(typeof e=="object"&&e!==null){var n=Xu.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Ua(t)},Xu.set(e,t),t)}return{value:e,source:t,stack:Ua(t)}}var al=[],ll=0,ts=null,Vl=0,Yt=[],Gt=0,Yn=null,rn=1,on="";function xn(e,t){al[ll++]=Vl,al[ll++]=ts,ts=e,Vl=t}function Qu(e,t,n){Yt[Gt++]=rn,Yt[Gt++]=on,Yt[Gt++]=Yn,Yn=e;var a=rn;e=on;var s=32-ut(a)-1;a&=~(1<<s),n+=1;var r=32-ut(t)+s;if(30<r){var f=s-s%5;r=(a&(1<<f)-1).toString(32),a>>=f,s-=f,rn=1<<32-ut(t)+s|n<<s|a,on=r+e}else rn=1<<r|n<<s|a,on=e}function Br(e){e.return!==null&&(xn(e,1),Qu(e,1,0))}function qr(e){for(;e===ts;)ts=al[--ll],al[ll]=null,Vl=al[--ll],al[ll]=null;for(;e===Yn;)Yn=Yt[--Gt],Yt[Gt]=null,on=Yt[--Gt],Yt[Gt]=null,rn=Yt[--Gt],Yt[Gt]=null}function Vu(e,t){Yt[Gt++]=rn,Yt[Gt++]=on,Yt[Gt++]=Yn,rn=t.id,on=t.overflow,Yn=e}var dt=null,Xe=null,Ee=!1,Gn=null,Xt=!1,Lr=Error(o(519));function Xn(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wl($t(t,e)),Lr}function Wu(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[it]=e,t[yt]=a,n){case"dialog":Te("cancel",t),Te("close",t);break;case"iframe":case"object":case"embed":Te("load",t);break;case"video":case"audio":for(n=0;n<vi.length;n++)Te(vi[n],t);break;case"source":Te("error",t);break;case"img":case"image":case"link":Te("error",t),Te("load",t);break;case"details":Te("toggle",t);break;case"input":Te("invalid",t),su(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":Te("invalid",t);break;case"textarea":Te("invalid",t),ou(t,a.value,a.defaultValue,a.children)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||dh(t.textContent,n)?(a.popover!=null&&(Te("beforetoggle",t),Te("toggle",t)),a.onScroll!=null&&Te("scroll",t),a.onScrollEnd!=null&&Te("scrollend",t),a.onClick!=null&&(t.onclick=gn),t=!0):t=!1,t||Xn(e,!0)}function Ku(e){for(dt=e.return;dt;)switch(dt.tag){case 5:case 31:case 13:Xt=!1;return;case 27:case 3:Xt=!0;return;default:dt=dt.return}}function il(e){if(e!==dt)return!1;if(!Ee)return Ku(e),Ee=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||ic(e.type,e.memoizedProps)),n=!n),n&&Xe&&Xn(e),Ku(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=bh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=bh(e)}else t===27?(t=Xe,la(e.type)?(e=uc,uc=null,Xe=e):Xe=t):Xe=dt?Vt(e.stateNode.nextSibling):null;return!0}function wa(){Xe=dt=null,Ee=!1}function $r(){var e=Gn;return e!==null&&(Tt===null?Tt=e:Tt.push.apply(Tt,e),Gn=null),e}function Wl(e){Gn===null?Gn=[e]:Gn.push(e)}var Yr=T(null),za=null,bn=null;function Qn(e,t,n){F(Yr,t._currentValue),t._currentValue=n}function jn(e){e._currentValue=Yr.current,_(Yr)}function Gr(e,t,n){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===n)break;e=e.return}}function Xr(e,t,n,a){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var r=s.dependencies;if(r!==null){var f=s.child;r=r.firstContext;e:for(;r!==null;){var p=r;r=s;for(var w=0;w<t.length;w++)if(p.context===t[w]){r.lanes|=n,p=r.alternate,p!==null&&(p.lanes|=n),Gr(r.return,n,e),a||(f=null);break e}r=p.next}}else if(s.tag===18){if(f=s.return,f===null)throw Error(o(341));f.lanes|=n,r=f.alternate,r!==null&&(r.lanes|=n),Gr(f,n,e),f=null}else f=s.child;if(f!==null)f.return=s;else for(f=s;f!==null;){if(f===e){f=null;break}if(s=f.sibling,s!==null){s.return=f.return,f=s;break}f=f.return}s=f}}function sl(e,t,n,a){e=null;for(var s=t,r=!1;s!==null;){if(!r){if((s.flags&524288)!==0)r=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var f=s.alternate;if(f===null)throw Error(o(387));if(f=f.memoizedProps,f!==null){var p=s.type;Et(s.pendingProps.value,f.value)||(e!==null?e.push(p):e=[p])}}else if(s===be.current){if(f=s.alternate,f===null)throw Error(o(387));f.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(bi):e=[bi])}s=s.return}e!==null&&Xr(t,e,n,a),t.flags|=262144}function ns(e){for(e=e.firstContext;e!==null;){if(!Et(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ta(e){za=e,bn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ft(e){return Zu(za,e)}function as(e,t){return za===null&&Ta(e),Zu(e,t)}function Zu(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},bn===null){if(e===null)throw Error(o(308));bn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else bn=bn.next=t;return n}var eg=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},tg=i.unstable_scheduleCallback,ng=i.unstable_NormalPriority,et={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qr(){return{controller:new eg,data:new Map,refCount:0}}function Kl(e){e.refCount--,e.refCount===0&&tg(ng,function(){e.controller.abort()})}var Zl=null,Vr=0,rl=0,ol=null;function ag(e,t){if(Zl===null){var n=Zl=[];Vr=0,rl=Fo(),ol={status:"pending",value:void 0,then:function(a){n.push(a)}}}return Vr++,t.then(Fu,Fu),t}function Fu(){if(--Vr===0&&Zl!==null){ol!==null&&(ol.status="fulfilled");var e=Zl;Zl=null,rl=0,ol=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function lg(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(s){n.push(s)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var s=0;s<n.length;s++)(0,n[s])(t)},function(s){for(a.status="rejected",a.reason=s,s=0;s<n.length;s++)(0,n[s])(void 0)}),a}var Ju=E.S;E.S=function(e,t){Nf=mt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ag(e,t),Ju!==null&&Ju(e,t)};var Ca=T(null);function Wr(){var e=Ca.current;return e!==null?e:Ye.pooledCache}function ls(e,t){t===null?F(Ca,Ca.current):F(Ca,t.pool)}function Iu(){var e=Wr();return e===null?null:{parent:et._currentValue,pool:e}}var cl=Error(o(460)),Kr=Error(o(474)),is=Error(o(542)),ss={then:function(){}};function Pu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ed(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(gn,gn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,nd(e),e;default:if(typeof t.status=="string")t.then(gn,gn);else{if(e=Ye,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=a}},function(a){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,nd(e),e}throw Ea=t,cl}}function Ma(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ea=n,cl):n}}var Ea=null;function td(){if(Ea===null)throw Error(o(459));var e=Ea;return Ea=null,e}function nd(e){if(e===cl||e===is)throw Error(o(483))}var ul=null,Fl=0;function rs(e){var t=Fl;return Fl+=1,ul===null&&(ul=[]),ed(ul,e,t)}function Jl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function os(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function ad(e){function t(A,M){if(e){var R=A.deletions;R===null?(A.deletions=[M],A.flags|=16):R.push(M)}}function n(A,M){if(!e)return null;for(;M!==null;)t(A,M),M=M.sibling;return null}function a(A){for(var M=new Map;A!==null;)A.key!==null?M.set(A.key,A):M.set(A.index,A),A=A.sibling;return M}function s(A,M){return A=yn(A,M),A.index=0,A.sibling=null,A}function r(A,M,R){return A.index=R,e?(R=A.alternate,R!==null?(R=R.index,R<M?(A.flags|=67108866,M):R):(A.flags|=67108866,M)):(A.flags|=1048576,M)}function f(A){return e&&A.alternate===null&&(A.flags|=67108866),A}function p(A,M,R,V){return M===null||M.tag!==6?(M=Hr(R,A.mode,V),M.return=A,M):(M=s(M,R),M.return=A,M)}function w(A,M,R,V){var ve=R.type;return ve===Z?X(A,M,R.props.children,V,R.key):M!==null&&(M.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===$&&Ma(ve)===M.type)?(M=s(M,R.props),Jl(M,R),M.return=A,M):(M=es(R.type,R.key,R.props,null,A.mode,V),Jl(M,R),M.return=A,M)}function O(A,M,R,V){return M===null||M.tag!==4||M.stateNode.containerInfo!==R.containerInfo||M.stateNode.implementation!==R.implementation?(M=Ur(R,A.mode,V),M.return=A,M):(M=s(M,R.children||[]),M.return=A,M)}function X(A,M,R,V,ve){return M===null||M.tag!==7?(M=ka(R,A.mode,V,ve),M.return=A,M):(M=s(M,R),M.return=A,M)}function K(A,M,R){if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return M=Hr(""+M,A.mode,R),M.return=A,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case k:return R=es(M.type,M.key,M.props,null,A.mode,R),Jl(R,M),R.return=A,R;case U:return M=Ur(M,A.mode,R),M.return=A,M;case $:return M=Ma(M),K(A,M,R)}if(ne(M)||W(M))return M=ka(M,A.mode,R,null),M.return=A,M;if(typeof M.then=="function")return K(A,rs(M),R);if(M.$$typeof===B)return K(A,as(A,M),R);os(A,M)}return null}function H(A,M,R,V){var ve=M!==null?M.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return ve!==null?null:p(A,M,""+R,V);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case k:return R.key===ve?w(A,M,R,V):null;case U:return R.key===ve?O(A,M,R,V):null;case $:return R=Ma(R),H(A,M,R,V)}if(ne(R)||W(R))return ve!==null?null:X(A,M,R,V,null);if(typeof R.then=="function")return H(A,M,rs(R),V);if(R.$$typeof===B)return H(A,M,as(A,R),V);os(A,R)}return null}function L(A,M,R,V,ve){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return A=A.get(R)||null,p(M,A,""+V,ve);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case k:return A=A.get(V.key===null?R:V.key)||null,w(M,A,V,ve);case U:return A=A.get(V.key===null?R:V.key)||null,O(M,A,V,ve);case $:return V=Ma(V),L(A,M,R,V,ve)}if(ne(V)||W(V))return A=A.get(R)||null,X(M,A,V,ve,null);if(typeof V.then=="function")return L(A,M,R,rs(V),ve);if(V.$$typeof===B)return L(A,M,R,as(M,V),ve);os(M,V)}return null}function he(A,M,R,V){for(var ve=null,Ae=null,pe=M,ke=M=0,Me=null;pe!==null&&ke<R.length;ke++){pe.index>ke?(Me=pe,pe=null):Me=pe.sibling;var De=H(A,pe,R[ke],V);if(De===null){pe===null&&(pe=Me);break}e&&pe&&De.alternate===null&&t(A,pe),M=r(De,M,ke),Ae===null?ve=De:Ae.sibling=De,Ae=De,pe=Me}if(ke===R.length)return n(A,pe),Ee&&xn(A,ke),ve;if(pe===null){for(;ke<R.length;ke++)pe=K(A,R[ke],V),pe!==null&&(M=r(pe,M,ke),Ae===null?ve=pe:Ae.sibling=pe,Ae=pe);return Ee&&xn(A,ke),ve}for(pe=a(pe);ke<R.length;ke++)Me=L(pe,A,ke,R[ke],V),Me!==null&&(e&&Me.alternate!==null&&pe.delete(Me.key===null?ke:Me.key),M=r(Me,M,ke),Ae===null?ve=Me:Ae.sibling=Me,Ae=Me);return e&&pe.forEach(function(ca){return t(A,ca)}),Ee&&xn(A,ke),ve}function ye(A,M,R,V){if(R==null)throw Error(o(151));for(var ve=null,Ae=null,pe=M,ke=M=0,Me=null,De=R.next();pe!==null&&!De.done;ke++,De=R.next()){pe.index>ke?(Me=pe,pe=null):Me=pe.sibling;var ca=H(A,pe,De.value,V);if(ca===null){pe===null&&(pe=Me);break}e&&pe&&ca.alternate===null&&t(A,pe),M=r(ca,M,ke),Ae===null?ve=ca:Ae.sibling=ca,Ae=ca,pe=Me}if(De.done)return n(A,pe),Ee&&xn(A,ke),ve;if(pe===null){for(;!De.done;ke++,De=R.next())De=K(A,De.value,V),De!==null&&(M=r(De,M,ke),Ae===null?ve=De:Ae.sibling=De,Ae=De);return Ee&&xn(A,ke),ve}for(pe=a(pe);!De.done;ke++,De=R.next())De=L(pe,A,ke,De.value,V),De!==null&&(e&&De.alternate!==null&&pe.delete(De.key===null?ke:De.key),M=r(De,M,ke),Ae===null?ve=De:Ae.sibling=De,Ae=De);return e&&pe.forEach(function(vm){return t(A,vm)}),Ee&&xn(A,ke),ve}function Le(A,M,R,V){if(typeof R=="object"&&R!==null&&R.type===Z&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case k:e:{for(var ve=R.key;M!==null;){if(M.key===ve){if(ve=R.type,ve===Z){if(M.tag===7){n(A,M.sibling),V=s(M,R.props.children),V.return=A,A=V;break e}}else if(M.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===$&&Ma(ve)===M.type){n(A,M.sibling),V=s(M,R.props),Jl(V,R),V.return=A,A=V;break e}n(A,M);break}else t(A,M);M=M.sibling}R.type===Z?(V=ka(R.props.children,A.mode,V,R.key),V.return=A,A=V):(V=es(R.type,R.key,R.props,null,A.mode,V),Jl(V,R),V.return=A,A=V)}return f(A);case U:e:{for(ve=R.key;M!==null;){if(M.key===ve)if(M.tag===4&&M.stateNode.containerInfo===R.containerInfo&&M.stateNode.implementation===R.implementation){n(A,M.sibling),V=s(M,R.children||[]),V.return=A,A=V;break e}else{n(A,M);break}else t(A,M);M=M.sibling}V=Ur(R,A.mode,V),V.return=A,A=V}return f(A);case $:return R=Ma(R),Le(A,M,R,V)}if(ne(R))return he(A,M,R,V);if(W(R)){if(ve=W(R),typeof ve!="function")throw Error(o(150));return R=ve.call(R),ye(A,M,R,V)}if(typeof R.then=="function")return Le(A,M,rs(R),V);if(R.$$typeof===B)return Le(A,M,as(A,R),V);os(A,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,M!==null&&M.tag===6?(n(A,M.sibling),V=s(M,R),V.return=A,A=V):(n(A,M),V=Hr(R,A.mode,V),V.return=A,A=V),f(A)):n(A,M)}return function(A,M,R,V){try{Fl=0;var ve=Le(A,M,R,V);return ul=null,ve}catch(pe){if(pe===cl||pe===is)throw pe;var Ae=_t(29,pe,null,A.mode);return Ae.lanes=V,Ae.return=A,Ae}}}var _a=ad(!0),ld=ad(!1),Vn=!1;function Zr(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fr(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Wn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Kn(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Oe&2)!==0){var s=a.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),a.pending=t,t=Pi(e),$u(e,null,n),t}return Ii(e,a,t,n),Pi(e)}function Il(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Bi(e,n)}}function Jr(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var s=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var f={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?s=r=f:r=r.next=f,n=n.next}while(n!==null);r===null?s=r=t:r=r.next=t}else s=r=t;n={baseState:a.baseState,firstBaseUpdate:s,lastBaseUpdate:r,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ir=!1;function Pl(){if(Ir){var e=ol;if(e!==null)throw e}}function ei(e,t,n,a){Ir=!1;var s=e.updateQueue;Vn=!1;var r=s.firstBaseUpdate,f=s.lastBaseUpdate,p=s.shared.pending;if(p!==null){s.shared.pending=null;var w=p,O=w.next;w.next=null,f===null?r=O:f.next=O,f=w;var X=e.alternate;X!==null&&(X=X.updateQueue,p=X.lastBaseUpdate,p!==f&&(p===null?X.firstBaseUpdate=O:p.next=O,X.lastBaseUpdate=w))}if(r!==null){var K=s.baseState;f=0,X=O=w=null,p=r;do{var H=p.lane&-536870913,L=H!==p.lane;if(L?(Ce&H)===H:(a&H)===H){H!==0&&H===rl&&(Ir=!0),X!==null&&(X=X.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var he=e,ye=p;H=t;var Le=n;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){K=he.call(Le,K,H);break e}K=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,H=typeof he=="function"?he.call(Le,K,H):he,H==null)break e;K=x({},K,H);break e;case 2:Vn=!0}}H=p.callback,H!==null&&(e.flags|=64,L&&(e.flags|=8192),L=s.callbacks,L===null?s.callbacks=[H]:L.push(H))}else L={lane:H,tag:p.tag,payload:p.payload,callback:p.callback,next:null},X===null?(O=X=L,w=K):X=X.next=L,f|=H;if(p=p.next,p===null){if(p=s.shared.pending,p===null)break;L=p,p=L.next,L.next=null,s.lastBaseUpdate=L,s.shared.pending=null}}while(!0);X===null&&(w=K),s.baseState=w,s.firstBaseUpdate=O,s.lastBaseUpdate=X,r===null&&(s.shared.lanes=0),Pn|=f,e.lanes=f,e.memoizedState=K}}function id(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function sd(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)id(n[e],t)}var dl=T(null),cs=T(0);function rd(e,t){e=_n,F(cs,e),F(dl,t),_n=e|t.baseLanes}function Pr(){F(cs,_n),F(dl,dl.current)}function eo(){_n=cs.current,_(dl),_(cs)}var At=T(null),Qt=null;function Zn(e){var t=e.alternate;F(Ie,Ie.current&1),F(At,e),Qt===null&&(t===null||dl.current!==null||t.memoizedState!==null)&&(Qt=e)}function to(e){F(Ie,Ie.current),F(At,e),Qt===null&&(Qt=e)}function od(e){e.tag===22?(F(Ie,Ie.current),F(At,e),Qt===null&&(Qt=e)):Fn()}function Fn(){F(Ie,Ie.current),F(At,At.current)}function Dt(e){_(At),Qt===e&&(Qt=null),_(Ie)}var Ie=T(0);function us(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||oc(n)||cc(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Sn=0,Se=null,Be=null,tt=null,ds=!1,fl=!1,Aa=!1,fs=0,ti=0,hl=null,ig=0;function Ke(){throw Error(o(321))}function no(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Et(e[n],t[n]))return!1;return!0}function ao(e,t,n,a,s,r){return Sn=r,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Qd:xo,Aa=!1,r=n(a,s),Aa=!1,fl&&(r=ud(t,n,a,s)),cd(e),r}function cd(e){E.H=li;var t=Be!==null&&Be.next!==null;if(Sn=0,tt=Be=Se=null,ds=!1,ti=0,hl=null,t)throw Error(o(300));e===null||nt||(e=e.dependencies,e!==null&&ns(e)&&(nt=!0))}function ud(e,t,n,a){Se=e;var s=0;do{if(fl&&(hl=null),ti=0,fl=!1,25<=s)throw Error(o(301));if(s+=1,tt=Be=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}E.H=Vd,r=t(n,a)}while(fl);return r}function sg(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?ni(t):t,e=e.useState()[0],(Be!==null?Be.memoizedState:null)!==e&&(Se.flags|=1024),t}function lo(){var e=fs!==0;return fs=0,e}function io(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function so(e){if(ds){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ds=!1}Sn=0,tt=Be=Se=null,fl=!1,ti=fs=0,hl=null}function jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tt===null?Se.memoizedState=tt=e:tt=tt.next=e,tt}function Pe(){if(Be===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Be.next;var t=tt===null?Se.memoizedState:tt.next;if(t!==null)tt=t,Be=e;else{if(e===null)throw Se.alternate===null?Error(o(467)):Error(o(310));Be=e,e={memoizedState:Be.memoizedState,baseState:Be.baseState,baseQueue:Be.baseQueue,queue:Be.queue,next:null},tt===null?Se.memoizedState=tt=e:tt=tt.next=e}return tt}function hs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ni(e){var t=ti;return ti+=1,hl===null&&(hl=[]),e=ed(hl,e,t),t=Se,(tt===null?t.memoizedState:tt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Qd:xo),e}function ps(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ni(e);if(e.$$typeof===B)return ft(e)}throw Error(o(438,String(e)))}function ro(e){var t=null,n=Se.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Se.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=hs(),Se.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),a=0;a<e;a++)n[a]=de;return t.index++,n}function kn(e,t){return typeof t=="function"?t(e):t}function vs(e){var t=Pe();return oo(t,Be,e)}function oo(e,t,n){var a=e.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=n;var s=e.baseQueue,r=a.pending;if(r!==null){if(s!==null){var f=s.next;s.next=r.next,r.next=f}t.baseQueue=s=r,a.pending=null}if(r=e.baseState,s===null)e.memoizedState=r;else{t=s.next;var p=f=null,w=null,O=t,X=!1;do{var K=O.lane&-536870913;if(K!==O.lane?(Ce&K)===K:(Sn&K)===K){var H=O.revertLane;if(H===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null}),K===rl&&(X=!0);else if((Sn&H)===H){O=O.next,H===rl&&(X=!0);continue}else K={lane:0,revertLane:O.revertLane,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},w===null?(p=w=K,f=r):w=w.next=K,Se.lanes|=H,Pn|=H;K=O.action,Aa&&n(r,K),r=O.hasEagerState?O.eagerState:n(r,K)}else H={lane:K,revertLane:O.revertLane,gesture:O.gesture,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},w===null?(p=w=H,f=r):w=w.next=H,Se.lanes|=K,Pn|=K;O=O.next}while(O!==null&&O!==t);if(w===null?f=r:w.next=p,!Et(r,e.memoizedState)&&(nt=!0,X&&(n=ol,n!==null)))throw n;e.memoizedState=r,e.baseState=f,e.baseQueue=w,a.lastRenderedState=r}return s===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function co(e){var t=Pe(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var a=n.dispatch,s=n.pending,r=t.memoizedState;if(s!==null){n.pending=null;var f=s=s.next;do r=e(r,f.action),f=f.next;while(f!==s);Et(r,t.memoizedState)||(nt=!0),t.memoizedState=r,t.baseQueue===null&&(t.baseState=r),n.lastRenderedState=r}return[r,a]}function dd(e,t,n){var a=Se,s=Pe(),r=Ee;if(r){if(n===void 0)throw Error(o(407));n=n()}else n=t();var f=!Et((Be||s).memoizedState,n);if(f&&(s.memoizedState=n,nt=!0),s=s.queue,ho(pd.bind(null,a,s,e),[e]),s.getSnapshot!==t||f||tt!==null&&tt.memoizedState.tag&1){if(a.flags|=2048,pl(9,{destroy:void 0},hd.bind(null,a,s,n,t),null),Ye===null)throw Error(o(349));r||(Sn&127)!==0||fd(a,t,n)}return n}function fd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Se.updateQueue,t===null?(t=hs(),Se.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function hd(e,t,n,a){t.value=n,t.getSnapshot=a,vd(t)&&gd(e)}function pd(e,t,n){return n(function(){vd(t)&&gd(e)})}function vd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Et(e,n)}catch{return!0}}function gd(e){var t=Sa(e,2);t!==null&&Ct(t,e,2)}function uo(e){var t=jt();if(typeof e=="function"){var n=e;if(e=n(),Aa){Ft(!0);try{n()}finally{Ft(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kn,lastRenderedState:e},t}function md(e,t,n,a){return e.baseState=n,oo(e,Be,typeof a=="function"?a:kn)}function rg(e,t,n,a,s){if(ys(e))throw Error(o(485));if(e=t.action,e!==null){var r={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){r.listeners.push(f)}};E.T!==null?n(!0):r.isTransition=!1,a(r),n=t.pending,n===null?(r.next=t.pending=r,yd(t,r)):(r.next=n.next,t.pending=n.next=r)}}function yd(e,t){var n=t.action,a=t.payload,s=e.state;if(t.isTransition){var r=E.T,f={};E.T=f;try{var p=n(s,a),w=E.S;w!==null&&w(f,p),xd(e,t,p)}catch(O){fo(e,t,O)}finally{r!==null&&f.types!==null&&(r.types=f.types),E.T=r}}else try{r=n(s,a),xd(e,t,r)}catch(O){fo(e,t,O)}}function xd(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){bd(e,t,a)},function(a){return fo(e,t,a)}):bd(e,t,n)}function bd(e,t,n){t.status="fulfilled",t.value=n,jd(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,yd(e,n)))}function fo(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,jd(t),t=t.next;while(t!==a)}e.action=null}function jd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Sd(e,t){return t}function kd(e,t){if(Ee){var n=Ye.formState;if(n!==null){e:{var a=Se;if(Ee){if(Xe){t:{for(var s=Xe,r=Xt;s.nodeType!==8;){if(!r){s=null;break t}if(s=Vt(s.nextSibling),s===null){s=null;break t}}r=s.data,s=r==="F!"||r==="F"?s:null}if(s){Xe=Vt(s.nextSibling),a=s.data==="F!";break e}}Xn(a)}a=!1}a&&(t=n[0])}}return n=jt(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sd,lastRenderedState:t},n.queue=a,n=Yd.bind(null,Se,a),a.dispatch=n,a=uo(!1),r=yo.bind(null,Se,!1,a.queue),a=jt(),s={state:t,dispatch:null,action:e,pending:null},a.queue=s,n=rg.bind(null,Se,s,r,n),s.dispatch=n,a.memoizedState=e,[t,n,!1]}function wd(e){var t=Pe();return zd(t,Be,e)}function zd(e,t,n){if(t=oo(e,t,Sd)[0],e=vs(kn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=ni(t)}catch(f){throw f===cl?is:f}else a=t;t=Pe();var s=t.queue,r=s.dispatch;return n!==t.memoizedState&&(Se.flags|=2048,pl(9,{destroy:void 0},og.bind(null,s,n),null)),[a,r,e]}function og(e,t){e.action=t}function Td(e){var t=Pe(),n=Be;if(n!==null)return zd(t,n,e);Pe(),t=t.memoizedState,n=Pe();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function pl(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Se.updateQueue,t===null&&(t=hs(),Se.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(a=n.next,n.next=e,e.next=a,t.lastEffect=e),e}function Cd(){return Pe().memoizedState}function gs(e,t,n,a){var s=jt();Se.flags|=e,s.memoizedState=pl(1|t,{destroy:void 0},n,a===void 0?null:a)}function ms(e,t,n,a){var s=Pe();a=a===void 0?null:a;var r=s.memoizedState.inst;Be!==null&&a!==null&&no(a,Be.memoizedState.deps)?s.memoizedState=pl(t,r,n,a):(Se.flags|=e,s.memoizedState=pl(1|t,r,n,a))}function Md(e,t){gs(8390656,8,e,t)}function ho(e,t){ms(2048,8,e,t)}function cg(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=hs(),Se.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ed(e){var t=Pe().memoizedState;return cg({ref:t,nextImpl:e}),function(){if((Oe&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function _d(e,t){return ms(4,2,e,t)}function Ad(e,t){return ms(4,4,e,t)}function Dd(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Rd(e,t,n){n=n!=null?n.concat([e]):null,ms(4,4,Dd.bind(null,t,e),n)}function po(){}function Od(e,t){var n=Pe();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&no(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function Nd(e,t){var n=Pe();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&no(t,a[1]))return a[0];if(a=e(),Aa){Ft(!0);try{e()}finally{Ft(!1)}}return n.memoizedState=[a,t],a}function vo(e,t,n){return n===void 0||(Sn&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Uf(),Se.lanes|=e,Pn|=e,n)}function Hd(e,t,n,a){return Et(n,t)?n:dl.current!==null?(e=vo(e,n,a),Et(e,t)||(nt=!0),e):(Sn&42)===0||(Sn&1073741824)!==0&&(Ce&261930)===0?(nt=!0,e.memoizedState=n):(e=Uf(),Se.lanes|=e,Pn|=e,t)}function Ud(e,t,n,a,s){var r=G.p;G.p=r!==0&&8>r?r:8;var f=E.T,p={};E.T=p,yo(e,!1,t,n);try{var w=s(),O=E.S;if(O!==null&&O(p,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var X=lg(w,a);ai(e,t,X,Nt(e))}else ai(e,t,a,Nt(e))}catch(K){ai(e,t,{then:function(){},status:"rejected",reason:K},Nt())}finally{G.p=r,f!==null&&p.types!==null&&(f.types=p.types),E.T=f}}function ug(){}function go(e,t,n,a){if(e.tag!==5)throw Error(o(476));var s=Bd(e).queue;Ud(e,s,t,P,n===null?ug:function(){return qd(e),n(a)})}function Bd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kn,lastRenderedState:P},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function qd(e){var t=Bd(e);t.next===null&&(t=e.alternate.memoizedState),ai(e,t.next.queue,{},Nt())}function mo(){return ft(bi)}function Ld(){return Pe().memoizedState}function $d(){return Pe().memoizedState}function dg(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Nt();e=Wn(n);var a=Kn(t,e,n);a!==null&&(Ct(a,t,n),Il(a,t,n)),t={cache:Qr()},e.payload=t;return}t=t.return}}function fg(e,t,n){var a=Nt();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ys(e)?Gd(t,n):(n=Or(e,t,n,a),n!==null&&(Ct(n,e,a),Xd(n,t,a)))}function Yd(e,t,n){var a=Nt();ai(e,t,n,a)}function ai(e,t,n,a){var s={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ys(e))Gd(t,s);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var f=t.lastRenderedState,p=r(f,n);if(s.hasEagerState=!0,s.eagerState=p,Et(p,f))return Ii(e,t,s,0),Ye===null&&Ji(),!1}catch{}if(n=Or(e,t,s,a),n!==null)return Ct(n,e,a),Xd(n,t,a),!0}return!1}function yo(e,t,n,a){if(a={lane:2,revertLane:Fo(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ys(e)){if(t)throw Error(o(479))}else t=Or(e,n,a,2),t!==null&&Ct(t,e,2)}function ys(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Gd(e,t){fl=ds=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Xd(e,t,n){if((n&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Bi(e,n)}}var li={readContext:ft,use:ps,useCallback:Ke,useContext:Ke,useEffect:Ke,useImperativeHandle:Ke,useLayoutEffect:Ke,useInsertionEffect:Ke,useMemo:Ke,useReducer:Ke,useRef:Ke,useState:Ke,useDebugValue:Ke,useDeferredValue:Ke,useTransition:Ke,useSyncExternalStore:Ke,useId:Ke,useHostTransitionStatus:Ke,useFormState:Ke,useActionState:Ke,useOptimistic:Ke,useMemoCache:Ke,useCacheRefresh:Ke};li.useEffectEvent=Ke;var Qd={readContext:ft,use:ps,useCallback:function(e,t){return jt().memoizedState=[e,t===void 0?null:t],e},useContext:ft,useEffect:Md,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,gs(4194308,4,Dd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return gs(4194308,4,e,t)},useInsertionEffect:function(e,t){gs(4,2,e,t)},useMemo:function(e,t){var n=jt();t=t===void 0?null:t;var a=e();if(Aa){Ft(!0);try{e()}finally{Ft(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=jt();if(n!==void 0){var s=n(t);if(Aa){Ft(!0);try{n(t)}finally{Ft(!1)}}}else s=t;return a.memoizedState=a.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},a.queue=e,e=e.dispatch=fg.bind(null,Se,e),[a.memoizedState,e]},useRef:function(e){var t=jt();return e={current:e},t.memoizedState=e},useState:function(e){e=uo(e);var t=e.queue,n=Yd.bind(null,Se,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:po,useDeferredValue:function(e,t){var n=jt();return vo(n,e,t)},useTransition:function(){var e=uo(!1);return e=Ud.bind(null,Se,e.queue,!0,!1),jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Se,s=jt();if(Ee){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ye===null)throw Error(o(349));(Ce&127)!==0||fd(a,t,n)}s.memoizedState=n;var r={value:n,getSnapshot:t};return s.queue=r,Md(pd.bind(null,a,r,e),[e]),a.flags|=2048,pl(9,{destroy:void 0},hd.bind(null,a,r,n,t),null),n},useId:function(){var e=jt(),t=Ye.identifierPrefix;if(Ee){var n=on,a=rn;n=(a&~(1<<32-ut(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=fs++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=ig++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:mo,useFormState:kd,useActionState:kd,useOptimistic:function(e){var t=jt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=yo.bind(null,Se,!0,n),n.dispatch=t,[e,t]},useMemoCache:ro,useCacheRefresh:function(){return jt().memoizedState=dg.bind(null,Se)},useEffectEvent:function(e){var t=jt(),n={impl:e};return t.memoizedState=n,function(){if((Oe&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},xo={readContext:ft,use:ps,useCallback:Od,useContext:ft,useEffect:ho,useImperativeHandle:Rd,useInsertionEffect:_d,useLayoutEffect:Ad,useMemo:Nd,useReducer:vs,useRef:Cd,useState:function(){return vs(kn)},useDebugValue:po,useDeferredValue:function(e,t){var n=Pe();return Hd(n,Be.memoizedState,e,t)},useTransition:function(){var e=vs(kn)[0],t=Pe().memoizedState;return[typeof e=="boolean"?e:ni(e),t]},useSyncExternalStore:dd,useId:Ld,useHostTransitionStatus:mo,useFormState:wd,useActionState:wd,useOptimistic:function(e,t){var n=Pe();return md(n,Be,e,t)},useMemoCache:ro,useCacheRefresh:$d};xo.useEffectEvent=Ed;var Vd={readContext:ft,use:ps,useCallback:Od,useContext:ft,useEffect:ho,useImperativeHandle:Rd,useInsertionEffect:_d,useLayoutEffect:Ad,useMemo:Nd,useReducer:co,useRef:Cd,useState:function(){return co(kn)},useDebugValue:po,useDeferredValue:function(e,t){var n=Pe();return Be===null?vo(n,e,t):Hd(n,Be.memoizedState,e,t)},useTransition:function(){var e=co(kn)[0],t=Pe().memoizedState;return[typeof e=="boolean"?e:ni(e),t]},useSyncExternalStore:dd,useId:Ld,useHostTransitionStatus:mo,useFormState:Td,useActionState:Td,useOptimistic:function(e,t){var n=Pe();return Be!==null?md(n,Be,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:ro,useCacheRefresh:$d};Vd.useEffectEvent=Ed;function bo(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:x({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var jo={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=Nt(),s=Wn(a);s.payload=t,n!=null&&(s.callback=n),t=Kn(e,s,a),t!==null&&(Ct(t,e,a),Il(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=Nt(),s=Wn(a);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Kn(e,s,a),t!==null&&(Ct(t,e,a),Il(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Nt(),a=Wn(n);a.tag=2,t!=null&&(a.callback=t),t=Kn(e,a,n),t!==null&&(Ct(t,e,n),Il(t,e,n))}};function Wd(e,t,n,a,s,r,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,r,f):t.prototype&&t.prototype.isPureReactComponent?!Xl(n,a)||!Xl(s,r):!0}function Kd(e,t,n,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&jo.enqueueReplaceState(t,t.state,null)}function Da(e,t){var n=t;if("ref"in t){n={};for(var a in t)a!=="ref"&&(n[a]=t[a])}if(e=e.defaultProps){n===t&&(n=x({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function Zd(e){Fi(e)}function Fd(e){console.error(e)}function Jd(e){Fi(e)}function xs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Id(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function So(e,t,n){return n=Wn(n),n.tag=3,n.payload={element:null},n.callback=function(){xs(e,t)},n}function Pd(e){return e=Wn(e),e.tag=3,e}function ef(e,t,n,a){var s=n.type.getDerivedStateFromError;if(typeof s=="function"){var r=a.value;e.payload=function(){return s(r)},e.callback=function(){Id(t,n,a)}}var f=n.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){Id(t,n,a),typeof s!="function"&&(ea===null?ea=new Set([this]):ea.add(this));var p=a.stack;this.componentDidCatch(a.value,{componentStack:p!==null?p:""})})}function hg(e,t,n,a,s){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&sl(t,n,s,!0),n=At.current,n!==null){switch(n.tag){case 31:case 13:return Qt===null?As():n.alternate===null&&Ze===0&&(Ze=3),n.flags&=-257,n.flags|=65536,n.lanes=s,a===ss?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),Wo(e,a,s)),!1;case 22:return n.flags|=65536,a===ss?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),Wo(e,a,s)),!1}throw Error(o(435,n.tag))}return Wo(e,a,s),As(),!1}if(Ee)return t=At.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,a!==Lr&&(e=Error(o(422),{cause:a}),Wl($t(e,n)))):(a!==Lr&&(t=Error(o(423),{cause:a}),Wl($t(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,a=$t(a,n),s=So(e.stateNode,a,s),Jr(e,s),Ze!==4&&(Ze=2)),!1;var r=Error(o(520),{cause:a});if(r=$t(r,n),fi===null?fi=[r]:fi.push(r),Ze!==4&&(Ze=2),t===null)return!0;a=$t(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=So(n.stateNode,a,e),Jr(n,e),!1;case 1:if(t=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(ea===null||!ea.has(r))))return n.flags|=65536,s&=-s,n.lanes|=s,s=Pd(s),ef(s,e,n,a),Jr(n,s),!1}n=n.return}while(n!==null);return!1}var ko=Error(o(461)),nt=!1;function ht(e,t,n,a){t.child=e===null?ld(t,null,n,a):_a(t,e.child,n,a)}function tf(e,t,n,a,s){n=n.render;var r=t.ref;if("ref"in a){var f={};for(var p in a)p!=="ref"&&(f[p]=a[p])}else f=a;return Ta(t),a=ao(e,t,n,f,r,s),p=lo(),e!==null&&!nt?(io(e,t,s),wn(e,t,s)):(Ee&&p&&Br(t),t.flags|=1,ht(e,t,a,s),t.child)}function nf(e,t,n,a,s){if(e===null){var r=n.type;return typeof r=="function"&&!Nr(r)&&r.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=r,af(e,t,r,a,s)):(e=es(n.type,null,a,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(r=e.child,!Ao(e,s)){var f=r.memoizedProps;if(n=n.compare,n=n!==null?n:Xl,n(f,a)&&e.ref===t.ref)return wn(e,t,s)}return t.flags|=1,e=yn(r,a),e.ref=t.ref,e.return=t,t.child=e}function af(e,t,n,a,s){if(e!==null){var r=e.memoizedProps;if(Xl(r,a)&&e.ref===t.ref)if(nt=!1,t.pendingProps=a=r,Ao(e,s))(e.flags&131072)!==0&&(nt=!0);else return t.lanes=e.lanes,wn(e,t,s)}return wo(e,t,n,a,s)}function lf(e,t,n,a){var s=a.children,r=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(r=r!==null?r.baseLanes|n:n,e!==null){for(a=t.child=e.child,s=0;a!==null;)s=s|a.lanes|a.childLanes,a=a.sibling;a=s&~r}else a=0,t.child=null;return sf(e,t,r,n,a)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ls(t,r!==null?r.cachePool:null),r!==null?rd(t,r):Pr(),od(t);else return a=t.lanes=536870912,sf(e,t,r!==null?r.baseLanes|n:n,n,a)}else r!==null?(ls(t,r.cachePool),rd(t,r),Fn(),t.memoizedState=null):(e!==null&&ls(t,null),Pr(),Fn());return ht(e,t,s,n),t.child}function ii(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sf(e,t,n,a,s){var r=Wr();return r=r===null?null:{parent:et._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&ls(t,null),Pr(),od(t),e!==null&&sl(e,t,a,!0),t.childLanes=s,null}function bs(e,t){return t=Ss({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function rf(e,t,n){return _a(t,e.child,null,n),e=bs(t,t.pendingProps),e.flags|=2,Dt(t),t.memoizedState=null,e}function pg(e,t,n){var a=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ee){if(a.mode==="hidden")return e=bs(t,a),t.lanes=536870912,ii(null,e);if(to(t),(e=Xe)?(e=xh(e,Xt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yn!==null?{id:rn,overflow:on}:null,retryLane:536870912,hydrationErrors:null},n=Gu(e),n.return=t,t.child=n,dt=t,Xe=null)):e=null,e===null)throw Xn(t);return t.lanes=536870912,null}return bs(t,a)}var r=e.memoizedState;if(r!==null){var f=r.dehydrated;if(to(t),s)if(t.flags&256)t.flags&=-257,t=rf(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(nt||sl(e,t,n,!1),s=(n&e.childLanes)!==0,nt||s){if(a=Ye,a!==null&&(f=qi(a,n),f!==0&&f!==r.retryLane))throw r.retryLane=f,Sa(e,f),Ct(a,e,f),ko;As(),t=rf(e,t,n)}else e=r.treeContext,Xe=Vt(f.nextSibling),dt=t,Ee=!0,Gn=null,Xt=!1,e!==null&&Vu(t,e),t=bs(t,a),t.flags|=4096;return t}return e=yn(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function js(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function wo(e,t,n,a,s){return Ta(t),n=ao(e,t,n,a,void 0,s),a=lo(),e!==null&&!nt?(io(e,t,s),wn(e,t,s)):(Ee&&a&&Br(t),t.flags|=1,ht(e,t,n,s),t.child)}function of(e,t,n,a,s,r){return Ta(t),t.updateQueue=null,n=ud(t,a,n,s),cd(e),a=lo(),e!==null&&!nt?(io(e,t,r),wn(e,t,r)):(Ee&&a&&Br(t),t.flags|=1,ht(e,t,n,r),t.child)}function cf(e,t,n,a,s){if(Ta(t),t.stateNode===null){var r=nl,f=n.contextType;typeof f=="object"&&f!==null&&(r=ft(f)),r=new n(a,r),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=jo,t.stateNode=r,r._reactInternals=t,r=t.stateNode,r.props=a,r.state=t.memoizedState,r.refs={},Zr(t),f=n.contextType,r.context=typeof f=="object"&&f!==null?ft(f):nl,r.state=t.memoizedState,f=n.getDerivedStateFromProps,typeof f=="function"&&(bo(t,n,f,a),r.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(f=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),f!==r.state&&jo.enqueueReplaceState(r,r.state,null),ei(t,a,r,s),Pl(),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){r=t.stateNode;var p=t.memoizedProps,w=Da(n,p);r.props=w;var O=r.context,X=n.contextType;f=nl,typeof X=="object"&&X!==null&&(f=ft(X));var K=n.getDerivedStateFromProps;X=typeof K=="function"||typeof r.getSnapshotBeforeUpdate=="function",p=t.pendingProps!==p,X||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(p||O!==f)&&Kd(t,r,a,f),Vn=!1;var H=t.memoizedState;r.state=H,ei(t,a,r,s),Pl(),O=t.memoizedState,p||H!==O||Vn?(typeof K=="function"&&(bo(t,n,K,a),O=t.memoizedState),(w=Vn||Wd(t,n,w,a,H,O,f))?(X||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(t.flags|=4194308)):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=O),r.props=a,r.state=O,r.context=f,a=w):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{r=t.stateNode,Fr(e,t),f=t.memoizedProps,X=Da(n,f),r.props=X,K=t.pendingProps,H=r.context,O=n.contextType,w=nl,typeof O=="object"&&O!==null&&(w=ft(O)),p=n.getDerivedStateFromProps,(O=typeof p=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(f!==K||H!==w)&&Kd(t,r,a,w),Vn=!1,H=t.memoizedState,r.state=H,ei(t,a,r,s),Pl();var L=t.memoizedState;f!==K||H!==L||Vn||e!==null&&e.dependencies!==null&&ns(e.dependencies)?(typeof p=="function"&&(bo(t,n,p,a),L=t.memoizedState),(X=Vn||Wd(t,n,X,a,H,L,w)||e!==null&&e.dependencies!==null&&ns(e.dependencies))?(O||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(a,L,w),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(a,L,w)),typeof r.componentDidUpdate=="function"&&(t.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof r.componentDidUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=L),r.props=a,r.state=L,r.context=w,a=X):(typeof r.componentDidUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),a=!1)}return r=a,js(e,t),a=(t.flags&128)!==0,r||a?(r=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:r.render(),t.flags|=1,e!==null&&a?(t.child=_a(t,e.child,null,s),t.child=_a(t,null,n,s)):ht(e,t,n,s),t.memoizedState=r.state,e=t.child):e=wn(e,t,s),e}function uf(e,t,n,a){return wa(),t.flags|=256,ht(e,t,n,a),t.child}var zo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function To(e){return{baseLanes:e,cachePool:Iu()}}function Co(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Ot),e}function df(e,t,n){var a=t.pendingProps,s=!1,r=(t.flags&128)!==0,f;if((f=r)||(f=e!==null&&e.memoizedState===null?!1:(Ie.current&2)!==0),f&&(s=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ee){if(s?Zn(t):Fn(),(e=Xe)?(e=xh(e,Xt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yn!==null?{id:rn,overflow:on}:null,retryLane:536870912,hydrationErrors:null},n=Gu(e),n.return=t,t.child=n,dt=t,Xe=null)):e=null,e===null)throw Xn(t);return cc(e)?t.lanes=32:t.lanes=536870912,null}var p=a.children;return a=a.fallback,s?(Fn(),s=t.mode,p=Ss({mode:"hidden",children:p},s),a=ka(a,s,n,null),p.return=t,a.return=t,p.sibling=a,t.child=p,a=t.child,a.memoizedState=To(n),a.childLanes=Co(e,f,n),t.memoizedState=zo,ii(null,a)):(Zn(t),Mo(t,p))}var w=e.memoizedState;if(w!==null&&(p=w.dehydrated,p!==null)){if(r)t.flags&256?(Zn(t),t.flags&=-257,t=Eo(e,t,n)):t.memoizedState!==null?(Fn(),t.child=e.child,t.flags|=128,t=null):(Fn(),p=a.fallback,s=t.mode,a=Ss({mode:"visible",children:a.children},s),p=ka(p,s,n,null),p.flags|=2,a.return=t,p.return=t,a.sibling=p,t.child=a,_a(t,e.child,null,n),a=t.child,a.memoizedState=To(n),a.childLanes=Co(e,f,n),t.memoizedState=zo,t=ii(null,a));else if(Zn(t),cc(p)){if(f=p.nextSibling&&p.nextSibling.dataset,f)var O=f.dgst;f=O,a=Error(o(419)),a.stack="",a.digest=f,Wl({value:a,source:null,stack:null}),t=Eo(e,t,n)}else if(nt||sl(e,t,n,!1),f=(n&e.childLanes)!==0,nt||f){if(f=Ye,f!==null&&(a=qi(f,n),a!==0&&a!==w.retryLane))throw w.retryLane=a,Sa(e,a),Ct(f,e,a),ko;oc(p)||As(),t=Eo(e,t,n)}else oc(p)?(t.flags|=192,t.child=e.child,t=null):(e=w.treeContext,Xe=Vt(p.nextSibling),dt=t,Ee=!0,Gn=null,Xt=!1,e!==null&&Vu(t,e),t=Mo(t,a.children),t.flags|=4096);return t}return s?(Fn(),p=a.fallback,s=t.mode,w=e.child,O=w.sibling,a=yn(w,{mode:"hidden",children:a.children}),a.subtreeFlags=w.subtreeFlags&65011712,O!==null?p=yn(O,p):(p=ka(p,s,n,null),p.flags|=2),p.return=t,a.return=t,a.sibling=p,t.child=a,ii(null,a),a=t.child,p=e.child.memoizedState,p===null?p=To(n):(s=p.cachePool,s!==null?(w=et._currentValue,s=s.parent!==w?{parent:w,pool:w}:s):s=Iu(),p={baseLanes:p.baseLanes|n,cachePool:s}),a.memoizedState=p,a.childLanes=Co(e,f,n),t.memoizedState=zo,ii(e.child,a)):(Zn(t),n=e.child,e=n.sibling,n=yn(n,{mode:"visible",children:a.children}),n.return=t,n.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=n,t.memoizedState=null,n)}function Mo(e,t){return t=Ss({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ss(e,t){return e=_t(22,e,null,t),e.lanes=0,e}function Eo(e,t,n){return _a(t,e.child,null,n),e=Mo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ff(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),Gr(e.return,t,n)}function _o(e,t,n,a,s,r){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:s,treeForkCount:r}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=a,f.tail=n,f.tailMode=s,f.treeForkCount=r)}function hf(e,t,n){var a=t.pendingProps,s=a.revealOrder,r=a.tail;a=a.children;var f=Ie.current,p=(f&2)!==0;if(p?(f=f&1|2,t.flags|=128):f&=1,F(Ie,f),ht(e,t,a,n),a=Ee?Vl:0,!p&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ff(e,n,t);else if(e.tag===19)ff(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&us(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),_o(t,!1,s,n,r,a);break;case"backwards":case"unstable_legacy-backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&us(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}_o(t,!0,n,null,r,a);break;case"together":_o(t,!1,null,null,void 0,a);break;default:t.memoizedState=null}return t.child}function wn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Pn|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(sl(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=yn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=yn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ao(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ns(e)))}function vg(e,t,n){switch(t.tag){case 3:Re(t,t.stateNode.containerInfo),Qn(t,et,e.memoizedState.cache),wa();break;case 27:case 5:te(t);break;case 4:Re(t,t.stateNode.containerInfo);break;case 10:Qn(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,to(t),null;break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(Zn(t),t.flags|=128,null):(n&t.child.childLanes)!==0?df(e,t,n):(Zn(t),e=wn(e,t,n),e!==null?e.sibling:null);Zn(t);break;case 19:var s=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(sl(e,t,n,!1),a=(n&t.childLanes)!==0),s){if(a)return hf(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),F(Ie,Ie.current),a)break;return null;case 22:return t.lanes=0,lf(e,t,n,t.pendingProps);case 24:Qn(t,et,e.memoizedState.cache)}return wn(e,t,n)}function pf(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)nt=!0;else{if(!Ao(e,n)&&(t.flags&128)===0)return nt=!1,vg(e,t,n);nt=(e.flags&131072)!==0}else nt=!1,Ee&&(t.flags&1048576)!==0&&Qu(t,Vl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=Ma(t.elementType),t.type=e,typeof e=="function")Nr(e)?(a=Da(e,a),t.tag=1,t=cf(null,t,e,a,n)):(t.tag=0,t=wo(null,t,e,a,n));else{if(e!=null){var s=e.$$typeof;if(s===J){t.tag=11,t=tf(null,t,e,a,n);break e}else if(s===N){t.tag=14,t=nf(null,t,e,a,n);break e}}throw t=oe(e)||e,Error(o(306,t,""))}}return t;case 0:return wo(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,s=Da(a,t.pendingProps),cf(e,t,a,s,n);case 3:e:{if(Re(t,t.stateNode.containerInfo),e===null)throw Error(o(387));a=t.pendingProps;var r=t.memoizedState;s=r.element,Fr(e,t),ei(t,a,null,n);var f=t.memoizedState;if(a=f.cache,Qn(t,et,a),a!==r.cache&&Xr(t,[et],n,!0),Pl(),a=f.element,r.isDehydrated)if(r={element:a,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=uf(e,t,a,n);break e}else if(a!==s){s=$t(Error(o(424)),t),Wl(s),t=uf(e,t,a,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Xe=Vt(e.firstChild),dt=t,Ee=!0,Gn=null,Xt=!0,n=ld(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wa(),a===s){t=wn(e,t,n);break e}ht(e,t,a,n)}t=t.child}return t;case 26:return js(e,t),e===null?(n=zh(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ee||(n=t.type,e=t.pendingProps,a=Bs(ue.current).createElement(n),a[it]=t,a[yt]=e,pt(a,n,e),rt(a),t.stateNode=a):t.memoizedState=zh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return te(t),e===null&&Ee&&(a=t.stateNode=Sh(t.type,t.pendingProps,ue.current),dt=t,Xt=!0,s=Xe,la(t.type)?(uc=s,Xe=Vt(a.firstChild)):Xe=s),ht(e,t,t.pendingProps.children,n),js(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ee&&((s=a=Xe)&&(a=Qg(a,t.type,t.pendingProps,Xt),a!==null?(t.stateNode=a,dt=t,Xe=Vt(a.firstChild),Xt=!1,s=!0):s=!1),s||Xn(t)),te(t),s=t.type,r=t.pendingProps,f=e!==null?e.memoizedProps:null,a=r.children,ic(s,r)?a=null:f!==null&&ic(s,f)&&(t.flags|=32),t.memoizedState!==null&&(s=ao(e,t,sg,null,null,n),bi._currentValue=s),js(e,t),ht(e,t,a,n),t.child;case 6:return e===null&&Ee&&((e=n=Xe)&&(n=Vg(n,t.pendingProps,Xt),n!==null?(t.stateNode=n,dt=t,Xe=null,e=!0):e=!1),e||Xn(t)),null;case 13:return df(e,t,n);case 4:return Re(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=_a(t,null,a,n):ht(e,t,a,n),t.child;case 11:return tf(e,t,t.type,t.pendingProps,n);case 7:return ht(e,t,t.pendingProps,n),t.child;case 8:return ht(e,t,t.pendingProps.children,n),t.child;case 12:return ht(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,Qn(t,t.type,a.value),ht(e,t,a.children,n),t.child;case 9:return s=t.type._context,a=t.pendingProps.children,Ta(t),s=ft(s),a=a(s),t.flags|=1,ht(e,t,a,n),t.child;case 14:return nf(e,t,t.type,t.pendingProps,n);case 15:return af(e,t,t.type,t.pendingProps,n);case 19:return hf(e,t,n);case 31:return pg(e,t,n);case 22:return lf(e,t,n,t.pendingProps);case 24:return Ta(t),a=ft(et),e===null?(s=Wr(),s===null&&(s=Ye,r=Qr(),s.pooledCache=r,r.refCount++,r!==null&&(s.pooledCacheLanes|=n),s=r),t.memoizedState={parent:a,cache:s},Zr(t),Qn(t,et,s)):((e.lanes&n)!==0&&(Fr(e,t),ei(t,null,null,n),Pl()),s=e.memoizedState,r=t.memoizedState,s.parent!==a?(s={parent:a,cache:a},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Qn(t,et,a)):(a=r.cache,Qn(t,et,a),a!==s.cache&&Xr(t,[et],n,!0))),ht(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function zn(e){e.flags|=4}function Do(e,t,n,a,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if($f())e.flags|=8192;else throw Ea=ss,Kr}else e.flags&=-16777217}function vf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!_h(t))if($f())e.flags|=8192;else throw Ea=ss,Kr}function ks(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ui():536870912,e.lanes|=t,yl|=t)}function si(e,t){if(!Ee)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function Qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,a|=s.subtreeFlags&65011712,a|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,a|=s.subtreeFlags,a|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function gg(e,t,n){var a=t.pendingProps;switch(qr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return Qe(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),jn(et),ee(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(il(t)?zn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,$r())),Qe(t),null;case 26:var s=t.type,r=t.memoizedState;return e===null?(zn(t),r!==null?(Qe(t),vf(t,r)):(Qe(t),Do(t,s,null,a,n))):r?r!==e.memoizedState?(zn(t),Qe(t),vf(t,r)):(Qe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&zn(t),Qe(t),Do(t,s,e,a,n)),null;case 27:if(we(t),n=ue.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&zn(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}e=I.current,il(t)?Wu(t):(e=Sh(s,a,n),t.stateNode=e,zn(t))}return Qe(t),null;case 5:if(we(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&zn(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}if(r=I.current,il(t))Wu(t);else{var f=Bs(ue.current);switch(r){case 1:r=f.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:r=f.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":r=f.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":r=f.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":r=f.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof a.is=="string"?f.createElement("select",{is:a.is}):f.createElement("select"),a.multiple?r.multiple=!0:a.size&&(r.size=a.size);break;default:r=typeof a.is=="string"?f.createElement(s,{is:a.is}):f.createElement(s)}}r[it]=t,r[yt]=a;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)r.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=r;e:switch(pt(r,s,a),s){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&zn(t)}}return Qe(t),Do(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&zn(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(o(166));if(e=ue.current,il(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,s=dt,s!==null)switch(s.tag){case 27:case 5:a=s.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||dh(e.nodeValue,n)),e||Xn(t,!0)}else e=Bs(e).createTextNode(a),e[it]=t,t.stateNode=e}return Qe(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=il(t),n!==null){if(e===null){if(!a)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[it]=t}else wa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else n=$r(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Dt(t),t):(Dt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Qe(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=il(t),a!==null&&a.dehydrated!==null){if(e===null){if(!s)throw Error(o(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(317));s[it]=t}else wa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),s=!1}else s=$r(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Dt(t),t):(Dt(t),null)}return Dt(t),(t.flags&128)!==0?(t.lanes=n,t):(n=a!==null,e=e!==null&&e.memoizedState!==null,n&&(a=t.child,s=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(s=a.alternate.memoizedState.cachePool.pool),r=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==s&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ks(t,t.updateQueue),Qe(t),null);case 4:return ee(),e===null&&ec(t.stateNode.containerInfo),Qe(t),null;case 10:return jn(t.type),Qe(t),null;case 19:if(_(Ie),a=t.memoizedState,a===null)return Qe(t),null;if(s=(t.flags&128)!==0,r=a.rendering,r===null)if(s)si(a,!1);else{if(Ze!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(r=us(e),r!==null){for(t.flags|=128,si(a,!1),e=r.updateQueue,t.updateQueue=e,ks(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Yu(n,e),n=n.sibling;return F(Ie,Ie.current&1|2),Ee&&xn(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&mt()>Ms&&(t.flags|=128,s=!0,si(a,!1),t.lanes=4194304)}else{if(!s)if(e=us(r),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,ks(t,e),si(a,!0),a.tail===null&&a.tailMode==="hidden"&&!r.alternate&&!Ee)return Qe(t),null}else 2*mt()-a.renderingStartTime>Ms&&n!==536870912&&(t.flags|=128,s=!0,si(a,!1),t.lanes=4194304);a.isBackwards?(r.sibling=t.child,t.child=r):(e=a.last,e!==null?e.sibling=r:t.child=r,a.last=r)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=mt(),e.sibling=null,n=Ie.current,F(Ie,s?n&1|2:n&1),Ee&&xn(t,a.treeForkCount),e):(Qe(t),null);case 22:case 23:return Dt(t),eo(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(n&536870912)!==0&&(t.flags&128)===0&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),n=t.updateQueue,n!==null&&ks(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&_(Ca),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),jn(et),Qe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function mg(e,t){switch(qr(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jn(et),ee(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return we(t),null;case 31:if(t.memoizedState!==null){if(Dt(t),t.alternate===null)throw Error(o(340));wa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Dt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));wa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _(Ie),null;case 4:return ee(),null;case 10:return jn(t.type),null;case 22:case 23:return Dt(t),eo(),e!==null&&_(Ca),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return jn(et),null;case 25:return null;default:return null}}function gf(e,t){switch(qr(t),t.tag){case 3:jn(et),ee();break;case 26:case 27:case 5:we(t);break;case 4:ee();break;case 31:t.memoizedState!==null&&Dt(t);break;case 13:Dt(t);break;case 19:_(Ie);break;case 10:jn(t.type);break;case 22:case 23:Dt(t),eo(),e!==null&&_(Ca);break;case 24:jn(et)}}function ri(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var s=a.next;n=s;do{if((n.tag&e)===e){a=void 0;var r=n.create,f=n.inst;a=r(),f.destroy=a}n=n.next}while(n!==s)}}catch(p){Ue(t,t.return,p)}}function Jn(e,t,n){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var r=s.next;a=r;do{if((a.tag&e)===e){var f=a.inst,p=f.destroy;if(p!==void 0){f.destroy=void 0,s=t;var w=n,O=p;try{O()}catch(X){Ue(s,w,X)}}}a=a.next}while(a!==r)}}catch(X){Ue(t,t.return,X)}}function mf(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{sd(t,n)}catch(a){Ue(e,e.return,a)}}}function yf(e,t,n){n.props=Da(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){Ue(e,t,a)}}function oi(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(s){Ue(e,t,s)}}function cn(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(s){Ue(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){Ue(e,t,s)}else n.current=null}function xf(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(s){Ue(e,e.return,s)}}function Ro(e,t,n){try{var a=e.stateNode;qg(a,e.type,n,t),a[yt]=t}catch(s){Ue(e,e.return,s)}}function bf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&la(e.type)||e.tag===4}function Oo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bf(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&la(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function No(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gn));else if(a!==4&&(a===27&&la(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(No(e,t,n),e=e.sibling;e!==null;)No(e,t,n),e=e.sibling}function ws(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(a!==4&&(a===27&&la(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(ws(e,t,n),e=e.sibling;e!==null;)ws(e,t,n),e=e.sibling}function jf(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);pt(t,a,n),t[it]=e,t[yt]=n}catch(r){Ue(e,e.return,r)}}var Tn=!1,at=!1,Ho=!1,Sf=typeof WeakSet=="function"?WeakSet:Set,ot=null;function yg(e,t){if(e=e.containerInfo,ac=Qs,e=Ru(e),Mr(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var a=n.getSelection&&n.getSelection();if(a&&a.rangeCount!==0){n=a.anchorNode;var s=a.anchorOffset,r=a.focusNode;a=a.focusOffset;try{n.nodeType,r.nodeType}catch{n=null;break e}var f=0,p=-1,w=-1,O=0,X=0,K=e,H=null;t:for(;;){for(var L;K!==n||s!==0&&K.nodeType!==3||(p=f+s),K!==r||a!==0&&K.nodeType!==3||(w=f+a),K.nodeType===3&&(f+=K.nodeValue.length),(L=K.firstChild)!==null;)H=K,K=L;for(;;){if(K===e)break t;if(H===n&&++O===s&&(p=f),H===r&&++X===a&&(w=f),(L=K.nextSibling)!==null)break;K=H,H=K.parentNode}K=L}n=p===-1||w===-1?null:{start:p,end:w}}else n=null}n=n||{start:0,end:0}}else n=null;for(lc={focusedElem:e,selectionRange:n},Qs=!1,ot=t;ot!==null;)if(t=ot,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ot=e;else for(;ot!==null;){switch(t=ot,r=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)s=e[n],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&r!==null){e=void 0,n=t,s=r.memoizedProps,r=r.memoizedState,a=n.stateNode;try{var he=Da(n.type,s);e=a.getSnapshotBeforeUpdate(he,r),a.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Ue(n,n.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)rc(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":rc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,ot=e;break}ot=t.return}}function kf(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:Mn(e,n),a&4&&ri(5,n);break;case 1:if(Mn(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(f){Ue(n,n.return,f)}else{var s=Da(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){Ue(n,n.return,f)}}a&64&&mf(n),a&512&&oi(n,n.return);break;case 3:if(Mn(e,n),a&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{sd(e,t)}catch(f){Ue(n,n.return,f)}}break;case 27:t===null&&a&4&&jf(n);case 26:case 5:Mn(e,n),t===null&&a&4&&xf(n),a&512&&oi(n,n.return);break;case 12:Mn(e,n);break;case 31:Mn(e,n),a&4&&Tf(e,n);break;case 13:Mn(e,n),a&4&&Cf(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Cg.bind(null,n),Wg(e,n))));break;case 22:if(a=n.memoizedState!==null||Tn,!a){t=t!==null&&t.memoizedState!==null||at,s=Tn;var r=at;Tn=a,(at=t)&&!r?En(e,n,(n.subtreeFlags&8772)!==0):Mn(e,n),Tn=s,at=r}break;case 30:break;default:Mn(e,n)}}function wf(e){var t=e.alternate;t!==null&&(e.alternate=null,wf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Nl(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ve=null,kt=!1;function Cn(e,t,n){for(n=n.child;n!==null;)zf(e,t,n),n=n.sibling}function zf(e,t,n){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(Hn,n)}catch{}switch(n.tag){case 26:at||cn(n,t),Cn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:at||cn(n,t);var a=Ve,s=kt;la(n.type)&&(Ve=n.stateNode,kt=!1),Cn(e,t,n),mi(n.stateNode),Ve=a,kt=s;break;case 5:at||cn(n,t);case 6:if(a=Ve,s=kt,Ve=null,Cn(e,t,n),Ve=a,kt=s,Ve!==null)if(kt)try{(Ve.nodeType===9?Ve.body:Ve.nodeName==="HTML"?Ve.ownerDocument.body:Ve).removeChild(n.stateNode)}catch(r){Ue(n,t,r)}else try{Ve.removeChild(n.stateNode)}catch(r){Ue(n,t,r)}break;case 18:Ve!==null&&(kt?(e=Ve,mh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Tl(e)):mh(Ve,n.stateNode));break;case 4:a=Ve,s=kt,Ve=n.stateNode.containerInfo,kt=!0,Cn(e,t,n),Ve=a,kt=s;break;case 0:case 11:case 14:case 15:Jn(2,n,t),at||Jn(4,n,t),Cn(e,t,n);break;case 1:at||(cn(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&yf(n,t,a)),Cn(e,t,n);break;case 21:Cn(e,t,n);break;case 22:at=(a=at)||n.memoizedState!==null,Cn(e,t,n),at=a;break;default:Cn(e,t,n)}}function Tf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Tl(e)}catch(n){Ue(t,t.return,n)}}}function Cf(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Tl(e)}catch(n){Ue(t,t.return,n)}}function xg(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Sf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Sf),t;default:throw Error(o(435,e.tag))}}function zs(e,t){var n=xg(e);t.forEach(function(a){if(!n.has(a)){n.add(a);var s=Mg.bind(null,e,a);a.then(s,s)}})}function wt(e,t){var n=t.deletions;if(n!==null)for(var a=0;a<n.length;a++){var s=n[a],r=e,f=t,p=f;e:for(;p!==null;){switch(p.tag){case 27:if(la(p.type)){Ve=p.stateNode,kt=!1;break e}break;case 5:Ve=p.stateNode,kt=!1;break e;case 3:case 4:Ve=p.stateNode.containerInfo,kt=!0;break e}p=p.return}if(Ve===null)throw Error(o(160));zf(r,f,s),Ve=null,kt=!1,r=s.alternate,r!==null&&(r.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Mf(t,e),t=t.sibling}var nn=null;function Mf(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:wt(t,e),zt(e),a&4&&(Jn(3,e,e.return),ri(3,e),Jn(5,e,e.return));break;case 1:wt(t,e),zt(e),a&512&&(at||n===null||cn(n,n.return)),a&64&&Tn&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?a:n.concat(a))));break;case 26:var s=nn;if(wt(t,e),zt(e),a&512&&(at||n===null||cn(n,n.return)),a&4){var r=n!==null?n.memoizedState:null;if(a=e.memoizedState,n===null)if(a===null)if(e.stateNode===null){e:{a=e.type,n=e.memoizedProps,s=s.ownerDocument||s;t:switch(a){case"title":r=s.getElementsByTagName("title")[0],(!r||r[Ln]||r[it]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=s.createElement(a),s.head.insertBefore(r,s.querySelector("head > title"))),pt(r,a,n),r[it]=e,rt(r),a=r;break e;case"link":var f=Mh("link","href",s).get(a+(n.href||""));if(f){for(var p=0;p<f.length;p++)if(r=f[p],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){f.splice(p,1);break t}}r=s.createElement(a),pt(r,a,n),s.head.appendChild(r);break;case"meta":if(f=Mh("meta","content",s).get(a+(n.content||""))){for(p=0;p<f.length;p++)if(r=f[p],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){f.splice(p,1);break t}}r=s.createElement(a),pt(r,a,n),s.head.appendChild(r);break;default:throw Error(o(468,a))}r[it]=e,rt(r),a=r}e.stateNode=a}else Eh(s,e.type,e.stateNode);else e.stateNode=Ch(s,a,e.memoizedProps);else r!==a?(r===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):r.count--,a===null?Eh(s,e.type,e.stateNode):Ch(s,a,e.memoizedProps)):a===null&&e.stateNode!==null&&Ro(e,e.memoizedProps,n.memoizedProps)}break;case 27:wt(t,e),zt(e),a&512&&(at||n===null||cn(n,n.return)),n!==null&&a&4&&Ro(e,e.memoizedProps,n.memoizedProps);break;case 5:if(wt(t,e),zt(e),a&512&&(at||n===null||cn(n,n.return)),e.flags&32){s=e.stateNode;try{Za(s,"")}catch(he){Ue(e,e.return,he)}}a&4&&e.stateNode!=null&&(s=e.memoizedProps,Ro(e,s,n!==null?n.memoizedProps:s)),a&1024&&(Ho=!0);break;case 6:if(wt(t,e),zt(e),a&4){if(e.stateNode===null)throw Error(o(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(he){Ue(e,e.return,he)}}break;case 3:if($s=null,s=nn,nn=qs(t.containerInfo),wt(t,e),nn=s,zt(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{Tl(t.containerInfo)}catch(he){Ue(e,e.return,he)}Ho&&(Ho=!1,Ef(e));break;case 4:a=nn,nn=qs(e.stateNode.containerInfo),wt(t,e),zt(e),nn=a;break;case 12:wt(t,e),zt(e);break;case 31:wt(t,e),zt(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,zs(e,a)));break;case 13:wt(t,e),zt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Cs=mt()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,zs(e,a)));break;case 22:s=e.memoizedState!==null;var w=n!==null&&n.memoizedState!==null,O=Tn,X=at;if(Tn=O||s,at=X||w,wt(t,e),at=X,Tn=O,zt(e),a&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||w||Tn||at||Ra(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){w=n=t;try{if(r=w.stateNode,s)f=r.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none";else{p=w.stateNode;var K=w.memoizedProps.style,H=K!=null&&K.hasOwnProperty("display")?K.display:null;p.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(he){Ue(w,w.return,he)}}}else if(t.tag===6){if(n===null){w=t;try{w.stateNode.nodeValue=s?"":w.memoizedProps}catch(he){Ue(w,w.return,he)}}}else if(t.tag===18){if(n===null){w=t;try{var L=w.stateNode;s?yh(L,!0):yh(w.stateNode,!1)}catch(he){Ue(w,w.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}a&4&&(a=e.updateQueue,a!==null&&(n=a.retryQueue,n!==null&&(a.retryQueue=null,zs(e,n))));break;case 19:wt(t,e),zt(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,zs(e,a)));break;case 30:break;case 21:break;default:wt(t,e),zt(e)}}function zt(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(bf(a)){n=a;break}a=a.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var s=n.stateNode,r=Oo(e);ws(e,r,s);break;case 5:var f=n.stateNode;n.flags&32&&(Za(f,""),n.flags&=-33);var p=Oo(e);ws(e,p,f);break;case 3:case 4:var w=n.stateNode.containerInfo,O=Oo(e);No(e,O,w);break;default:throw Error(o(161))}}catch(X){Ue(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ef(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ef(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Mn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)kf(e,t.alternate,t),t=t.sibling}function Ra(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Jn(4,t,t.return),Ra(t);break;case 1:cn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&yf(t,t.return,n),Ra(t);break;case 27:mi(t.stateNode);case 26:case 5:cn(t,t.return),Ra(t);break;case 22:t.memoizedState===null&&Ra(t);break;case 30:Ra(t);break;default:Ra(t)}e=e.sibling}}function En(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,s=e,r=t,f=r.flags;switch(r.tag){case 0:case 11:case 15:En(s,r,n),ri(4,r);break;case 1:if(En(s,r,n),a=r,s=a.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(O){Ue(a,a.return,O)}if(a=r,s=a.updateQueue,s!==null){var p=a.stateNode;try{var w=s.shared.hiddenCallbacks;if(w!==null)for(s.shared.hiddenCallbacks=null,s=0;s<w.length;s++)id(w[s],p)}catch(O){Ue(a,a.return,O)}}n&&f&64&&mf(r),oi(r,r.return);break;case 27:jf(r);case 26:case 5:En(s,r,n),n&&a===null&&f&4&&xf(r),oi(r,r.return);break;case 12:En(s,r,n);break;case 31:En(s,r,n),n&&f&4&&Tf(s,r);break;case 13:En(s,r,n),n&&f&4&&Cf(s,r);break;case 22:r.memoizedState===null&&En(s,r,n),oi(r,r.return);break;case 30:break;default:En(s,r,n)}t=t.sibling}}function Uo(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Kl(n))}function Bo(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Kl(e))}function an(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)_f(e,t,n,a),t=t.sibling}function _f(e,t,n,a){var s=t.flags;switch(t.tag){case 0:case 11:case 15:an(e,t,n,a),s&2048&&ri(9,t);break;case 1:an(e,t,n,a);break;case 3:an(e,t,n,a),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Kl(e)));break;case 12:if(s&2048){an(e,t,n,a),e=t.stateNode;try{var r=t.memoizedProps,f=r.id,p=r.onPostCommit;typeof p=="function"&&p(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(w){Ue(t,t.return,w)}}else an(e,t,n,a);break;case 31:an(e,t,n,a);break;case 13:an(e,t,n,a);break;case 23:break;case 22:r=t.stateNode,f=t.alternate,t.memoizedState!==null?r._visibility&2?an(e,t,n,a):ci(e,t):r._visibility&2?an(e,t,n,a):(r._visibility|=2,vl(e,t,n,a,(t.subtreeFlags&10256)!==0||!1)),s&2048&&Uo(f,t);break;case 24:an(e,t,n,a),s&2048&&Bo(t.alternate,t);break;default:an(e,t,n,a)}}function vl(e,t,n,a,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var r=e,f=t,p=n,w=a,O=f.flags;switch(f.tag){case 0:case 11:case 15:vl(r,f,p,w,s),ri(8,f);break;case 23:break;case 22:var X=f.stateNode;f.memoizedState!==null?X._visibility&2?vl(r,f,p,w,s):ci(r,f):(X._visibility|=2,vl(r,f,p,w,s)),s&&O&2048&&Uo(f.alternate,f);break;case 24:vl(r,f,p,w,s),s&&O&2048&&Bo(f.alternate,f);break;default:vl(r,f,p,w,s)}t=t.sibling}}function ci(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,s=a.flags;switch(a.tag){case 22:ci(n,a),s&2048&&Uo(a.alternate,a);break;case 24:ci(n,a),s&2048&&Bo(a.alternate,a);break;default:ci(n,a)}t=t.sibling}}var ui=8192;function gl(e,t,n){if(e.subtreeFlags&ui)for(e=e.child;e!==null;)Af(e,t,n),e=e.sibling}function Af(e,t,n){switch(e.tag){case 26:gl(e,t,n),e.flags&ui&&e.memoizedState!==null&&im(n,nn,e.memoizedState,e.memoizedProps);break;case 5:gl(e,t,n);break;case 3:case 4:var a=nn;nn=qs(e.stateNode.containerInfo),gl(e,t,n),nn=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=ui,ui=16777216,gl(e,t,n),ui=a):gl(e,t,n));break;default:gl(e,t,n)}}function Df(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function di(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];ot=a,Of(a,e)}Df(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Rf(e),e=e.sibling}function Rf(e){switch(e.tag){case 0:case 11:case 15:di(e),e.flags&2048&&Jn(9,e,e.return);break;case 3:di(e);break;case 12:di(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ts(e)):di(e);break;default:di(e)}}function Ts(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];ot=a,Of(a,e)}Df(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Jn(8,t,t.return),Ts(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ts(t));break;default:Ts(t)}e=e.sibling}}function Of(e,t){for(;ot!==null;){var n=ot;switch(n.tag){case 0:case 11:case 15:Jn(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var a=n.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Kl(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,ot=a;else e:for(n=e;ot!==null;){a=ot;var s=a.sibling,r=a.return;if(wf(a),a===n){ot=null;break e}if(s!==null){s.return=r,ot=s;break e}ot=r}}}var bg={getCacheForType:function(e){var t=ft(et),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ft(et).controller.signal}},jg=typeof WeakMap=="function"?WeakMap:Map,Oe=0,Ye=null,ze=null,Ce=0,He=0,Rt=null,In=!1,ml=!1,qo=!1,_n=0,Ze=0,Pn=0,Oa=0,Lo=0,Ot=0,yl=0,fi=null,Tt=null,$o=!1,Cs=0,Nf=0,Ms=1/0,Es=null,ea=null,st=0,ta=null,xl=null,An=0,Yo=0,Go=null,Hf=null,hi=0,Xo=null;function Nt(){return(Oe&2)!==0&&Ce!==0?Ce&-Ce:E.T!==null?Fo():Rl()}function Uf(){if(Ot===0)if((Ce&536870912)===0||Ee){var e=Ut;Ut<<=1,(Ut&3932160)===0&&(Ut=262144),Ot=e}else Ot=536870912;return e=At.current,e!==null&&(e.flags|=32),Ot}function Ct(e,t,n){(e===Ye&&(He===2||He===9)||e.cancelPendingCommit!==null)&&(bl(e,0),na(e,Ce,Ot,!1)),qn(e,n),((Oe&2)===0||e!==Ye)&&(e===Ye&&((Oe&2)===0&&(Oa|=n),Ze===4&&na(e,Ce,Ot,!1)),un(e))}function Bf(e,t,n){if((Oe&6)!==0)throw Error(o(327));var a=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Bn(e,t),s=a?wg(e,t):Vo(e,t,!0),r=a;do{if(s===0){ml&&!a&&na(e,t,0,!1);break}else{if(n=e.current.alternate,r&&!Sg(n)){s=Vo(e,t,!1),r=!1;continue}if(s===2){if(r=t,e.errorRecoveryDisabledLanes&r)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var p=e;s=fi;var w=p.current.memoizedState.isDehydrated;if(w&&(bl(p,f).flags|=256),f=Vo(p,f,!1),f!==2){if(qo&&!w){p.errorRecoveryDisabledLanes|=r,Oa|=r,s=4;break e}r=Tt,Tt=s,r!==null&&(Tt===null?Tt=r:Tt.push.apply(Tt,r))}s=f}if(r=!1,s!==2)continue}}if(s===1){bl(e,0),na(e,t,0,!0);break}e:{switch(a=e,r=s,r){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:na(a,t,Ot,!In);break e;case 2:Tt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(s=Cs+300-mt(),10<s)){if(na(a,t,Ot,!In),Un(a,0,!0)!==0)break e;An=t,a.timeoutHandle=vh(qf.bind(null,a,n,Tt,Es,$o,t,Ot,Oa,yl,In,r,"Throttled",-0,0),s);break e}qf(a,n,Tt,Es,$o,t,Ot,Oa,yl,In,r,null,-0,0)}}break}while(!0);un(e)}function qf(e,t,n,a,s,r,f,p,w,O,X,K,H,L){if(e.timeoutHandle=-1,K=t.subtreeFlags,K&8192||(K&16785408)===16785408){K={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gn},Af(t,r,K);var he=(r&62914560)===r?Cs-mt():(r&4194048)===r?Nf-mt():0;if(he=sm(K,he),he!==null){An=r,e.cancelPendingCommit=he(Wf.bind(null,e,t,r,n,a,s,f,p,w,X,K,null,H,L)),na(e,r,f,!O);return}}Wf(e,t,r,n,a,s,f,p,w)}function Sg(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var a=0;a<n.length;a++){var s=n[a],r=s.getSnapshot;s=s.value;try{if(!Et(r(),s))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function na(e,t,n,a){t&=~Lo,t&=~Oa,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var s=t;0<s;){var r=31-ut(s),f=1<<r;a[r]=-1,s&=~f}n!==0&&Ya(e,n,t)}function _s(){return(Oe&6)===0?(pi(0),!1):!0}function Qo(){if(ze!==null){if(He===0)var e=ze.return;else e=ze,bn=za=null,so(e),ul=null,Fl=0,e=ze;for(;e!==null;)gf(e.alternate,e),e=e.return;ze=null}}function bl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Yg(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),An=0,Qo(),Ye=e,ze=n=yn(e.current,null),Ce=t,He=0,Rt=null,In=!1,ml=Bn(e,t),qo=!1,yl=Ot=Lo=Oa=Pn=Ze=0,Tt=fi=null,$o=!1,(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var s=31-ut(a),r=1<<s;t|=e[s],a&=~r}return _n=t,Ji(),n}function Lf(e,t){Se=null,E.H=li,t===cl||t===is?(t=td(),He=3):t===Kr?(t=td(),He=4):He=t===ko?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Rt=t,ze===null&&(Ze=1,xs(e,$t(t,e.current)))}function $f(){var e=At.current;return e===null?!0:(Ce&4194048)===Ce?Qt===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===Qt:!1}function Yf(){var e=E.H;return E.H=li,e===null?li:e}function Gf(){var e=E.A;return E.A=bg,e}function As(){Ze=4,In||(Ce&4194048)!==Ce&&At.current!==null||(ml=!0),(Pn&134217727)===0&&(Oa&134217727)===0||Ye===null||na(Ye,Ce,Ot,!1)}function Vo(e,t,n){var a=Oe;Oe|=2;var s=Yf(),r=Gf();(Ye!==e||Ce!==t)&&(Es=null,bl(e,t)),t=!1;var f=Ze;e:do try{if(He!==0&&ze!==null){var p=ze,w=Rt;switch(He){case 8:Qo(),f=6;break e;case 3:case 2:case 9:case 6:At.current===null&&(t=!0);var O=He;if(He=0,Rt=null,jl(e,p,w,O),n&&ml){f=0;break e}break;default:O=He,He=0,Rt=null,jl(e,p,w,O)}}kg(),f=Ze;break}catch(X){Lf(e,X)}while(!0);return t&&e.shellSuspendCounter++,bn=za=null,Oe=a,E.H=s,E.A=r,ze===null&&(Ye=null,Ce=0,Ji()),f}function kg(){for(;ze!==null;)Xf(ze)}function wg(e,t){var n=Oe;Oe|=2;var a=Yf(),s=Gf();Ye!==e||Ce!==t?(Es=null,Ms=mt()+500,bl(e,t)):ml=Bn(e,t);e:do try{if(He!==0&&ze!==null){t=ze;var r=Rt;t:switch(He){case 1:He=0,Rt=null,jl(e,t,r,1);break;case 2:case 9:if(Pu(r)){He=0,Rt=null,Qf(t);break}t=function(){He!==2&&He!==9||Ye!==e||(He=7),un(e)},r.then(t,t);break e;case 3:He=7;break e;case 4:He=5;break e;case 7:Pu(r)?(He=0,Rt=null,Qf(t)):(He=0,Rt=null,jl(e,t,r,7));break;case 5:var f=null;switch(ze.tag){case 26:f=ze.memoizedState;case 5:case 27:var p=ze;if(f?_h(f):p.stateNode.complete){He=0,Rt=null;var w=p.sibling;if(w!==null)ze=w;else{var O=p.return;O!==null?(ze=O,Ds(O)):ze=null}break t}}He=0,Rt=null,jl(e,t,r,5);break;case 6:He=0,Rt=null,jl(e,t,r,6);break;case 8:Qo(),Ze=6;break e;default:throw Error(o(462))}}zg();break}catch(X){Lf(e,X)}while(!0);return bn=za=null,E.H=a,E.A=s,Oe=n,ze!==null?0:(Ye=null,Ce=0,Ji(),Ze)}function zg(){for(;ze!==null&&!La();)Xf(ze)}function Xf(e){var t=pf(e.alternate,e,_n);e.memoizedProps=e.pendingProps,t===null?Ds(e):ze=t}function Qf(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=of(n,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=of(n,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:so(t);default:gf(n,t),t=ze=Yu(t,_n),t=pf(n,t,_n)}e.memoizedProps=e.pendingProps,t===null?Ds(e):ze=t}function jl(e,t,n,a){bn=za=null,so(t),ul=null,Fl=0;var s=t.return;try{if(hg(e,s,t,n,Ce)){Ze=1,xs(e,$t(n,e.current)),ze=null;return}}catch(r){if(s!==null)throw ze=s,r;Ze=1,xs(e,$t(n,e.current)),ze=null;return}t.flags&32768?(Ee||a===1?e=!0:ml||(Ce&536870912)!==0?e=!1:(In=e=!0,(a===2||a===9||a===3||a===6)&&(a=At.current,a!==null&&a.tag===13&&(a.flags|=16384))),Vf(t,e)):Ds(t)}function Ds(e){var t=e;do{if((t.flags&32768)!==0){Vf(t,In);return}e=t.return;var n=gg(t.alternate,t,_n);if(n!==null){ze=n;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);Ze===0&&(Ze=5)}function Vf(e,t){do{var n=mg(e.alternate,e);if(n!==null){n.flags&=32767,ze=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ze=e;return}ze=e=n}while(e!==null);Ze=6,ze=null}function Wf(e,t,n,a,s,r,f,p,w){e.cancelPendingCommit=null;do Rs();while(st!==0);if((Oe&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(r=t.lanes|t.childLanes,r|=Rr,dr(e,n,r,f,p,w),e===Ye&&(ze=Ye=null,Ce=0),xl=t,ta=e,An=n,Yo=r,Go=s,Hf=a,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Eg($a,function(){return If(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=E.T,E.T=null,s=G.p,G.p=2,f=Oe,Oe|=4;try{yg(e,t,n)}finally{Oe=f,G.p=s,E.T=a}}st=1,Kf(),Zf(),Ff()}}function Kf(){if(st===1){st=0;var e=ta,t=xl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=E.T,E.T=null;var a=G.p;G.p=2;var s=Oe;Oe|=4;try{Mf(t,e);var r=lc,f=Ru(e.containerInfo),p=r.focusedElem,w=r.selectionRange;if(f!==p&&p&&p.ownerDocument&&Du(p.ownerDocument.documentElement,p)){if(w!==null&&Mr(p)){var O=w.start,X=w.end;if(X===void 0&&(X=O),"selectionStart"in p)p.selectionStart=O,p.selectionEnd=Math.min(X,p.value.length);else{var K=p.ownerDocument||document,H=K&&K.defaultView||window;if(H.getSelection){var L=H.getSelection(),he=p.textContent.length,ye=Math.min(w.start,he),Le=w.end===void 0?ye:Math.min(w.end,he);!L.extend&&ye>Le&&(f=Le,Le=ye,ye=f);var A=Au(p,ye),M=Au(p,Le);if(A&&M&&(L.rangeCount!==1||L.anchorNode!==A.node||L.anchorOffset!==A.offset||L.focusNode!==M.node||L.focusOffset!==M.offset)){var R=K.createRange();R.setStart(A.node,A.offset),L.removeAllRanges(),ye>Le?(L.addRange(R),L.extend(M.node,M.offset)):(R.setEnd(M.node,M.offset),L.addRange(R))}}}}for(K=[],L=p;L=L.parentNode;)L.nodeType===1&&K.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<K.length;p++){var V=K[p];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}Qs=!!ac,lc=ac=null}finally{Oe=s,G.p=a,E.T=n}}e.current=t,st=2}}function Zf(){if(st===2){st=0;var e=ta,t=xl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=E.T,E.T=null;var a=G.p;G.p=2;var s=Oe;Oe|=4;try{kf(e,t.alternate,t)}finally{Oe=s,G.p=a,E.T=n}}st=3}}function Ff(){if(st===4||st===3){st=0,El();var e=ta,t=xl,n=An,a=Hf;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?st=5:(st=0,xl=ta=null,Jf(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(ea=null),Ga(n),t=t.stateNode,ct&&typeof ct.onCommitFiberRoot=="function")try{ct.onCommitFiberRoot(Hn,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=E.T,s=G.p,G.p=2,E.T=null;try{for(var r=e.onRecoverableError,f=0;f<a.length;f++){var p=a[f];r(p.value,{componentStack:p.stack})}}finally{E.T=t,G.p=s}}(An&3)!==0&&Rs(),un(e),s=e.pendingLanes,(n&261930)!==0&&(s&42)!==0?e===Xo?hi++:(hi=0,Xo=e):hi=0,pi(0)}}function Jf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Kl(t)))}function Rs(){return Kf(),Zf(),Ff(),If()}function If(){if(st!==5)return!1;var e=ta,t=Yo;Yo=0;var n=Ga(An),a=E.T,s=G.p;try{G.p=32>n?32:n,E.T=null,n=Go,Go=null;var r=ta,f=An;if(st=0,xl=ta=null,An=0,(Oe&6)!==0)throw Error(o(331));var p=Oe;if(Oe|=4,Rf(r.current),_f(r,r.current,f,n),Oe=p,pi(0,!1),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(Hn,r)}catch{}return!0}finally{G.p=s,E.T=a,Jf(e,t)}}function Pf(e,t,n){t=$t(n,t),t=So(e.stateNode,t,2),e=Kn(e,t,2),e!==null&&(qn(e,2),un(e))}function Ue(e,t,n){if(e.tag===3)Pf(e,e,n);else for(;t!==null;){if(t.tag===3){Pf(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(ea===null||!ea.has(a))){e=$t(n,e),n=Pd(2),a=Kn(t,n,2),a!==null&&(ef(n,a,t,e),qn(a,2),un(a));break}}t=t.return}}function Wo(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new jg;var s=new Set;a.set(t,s)}else s=a.get(t),s===void 0&&(s=new Set,a.set(t,s));s.has(n)||(qo=!0,s.add(n),e=Tg.bind(null,e,t,n),t.then(e,e))}function Tg(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ye===e&&(Ce&n)===n&&(Ze===4||Ze===3&&(Ce&62914560)===Ce&&300>mt()-Cs?(Oe&2)===0&&bl(e,0):Lo|=n,yl===Ce&&(yl=0)),un(e)}function eh(e,t){t===0&&(t=Ui()),e=Sa(e,t),e!==null&&(qn(e,t),un(e))}function Cg(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),eh(e,n)}function Mg(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(t),eh(e,n)}function Eg(e,t){return Ba(e,t)}var Os=null,Sl=null,Ko=!1,Ns=!1,Zo=!1,aa=0;function un(e){e!==Sl&&e.next===null&&(Sl===null?Os=Sl=e:Sl=Sl.next=e),Ns=!0,Ko||(Ko=!0,Ag())}function pi(e,t){if(!Zo&&Ns){Zo=!0;do for(var n=!1,a=Os;a!==null;){if(e!==0){var s=a.pendingLanes;if(s===0)var r=0;else{var f=a.suspendedLanes,p=a.pingedLanes;r=(1<<31-ut(42|e)+1)-1,r&=s&~(f&~p),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,lh(a,r))}else r=Ce,r=Un(a,a===Ye?r:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(r&3)===0||Bn(a,r)||(n=!0,lh(a,r));a=a.next}while(n);Zo=!1}}function _g(){th()}function th(){Ns=Ko=!1;var e=0;aa!==0&&$g()&&(e=aa);for(var t=mt(),n=null,a=Os;a!==null;){var s=a.next,r=nh(a,t);r===0?(a.next=null,n===null?Os=s:n.next=s,s===null&&(Sl=n)):(n=a,(e!==0||(r&3)!==0)&&(Ns=!0)),a=s}st!==0&&st!==5||pi(e),aa!==0&&(aa=0)}function nh(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,s=e.expirationTimes,r=e.pendingLanes&-62914561;0<r;){var f=31-ut(r),p=1<<f,w=s[f];w===-1?((p&n)===0||(p&a)!==0)&&(s[f]=ur(p,t)):w<=t&&(e.expiredLanes|=p),r&=~p}if(t=Ye,n=Ce,n=Un(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(He===2||He===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&qa(a),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Bn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&qa(a),Ga(n)){case 2:case 8:n=Al;break;case 32:n=$a;break;case 268435456:n=pa;break;default:n=$a}return a=ah.bind(null,e),n=Ba(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&qa(a),e.callbackPriority=2,e.callbackNode=null,2}function ah(e,t){if(st!==0&&st!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Rs()&&e.callbackNode!==n)return null;var a=Ce;return a=Un(e,e===Ye?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(Bf(e,a,t),nh(e,mt()),e.callbackNode!=null&&e.callbackNode===n?ah.bind(null,e):null)}function lh(e,t){if(Rs())return null;Bf(e,t,!0)}function Ag(){Gg(function(){(Oe&6)!==0?Ba(_l,_g):th()})}function Fo(){if(aa===0){var e=rl;e===0&&(e=Ht,Ht<<=1,(Ht&261888)===0&&(Ht=256)),aa=e}return aa}function ih(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Gi(""+e)}function sh(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Dg(e,t,n,a,s){if(t==="submit"&&n&&n.stateNode===s){var r=ih((s[yt]||null).action),f=a.submitter;f&&(t=(t=f[yt]||null)?ih(t.formAction):f.getAttribute("formAction"),t!==null&&(r=t,f=null));var p=new Wi("action","action",null,a,s);e.push({event:p,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(aa!==0){var w=f?sh(s,f):new FormData(s);go(n,{pending:!0,data:w,method:s.method,action:r},null,w)}}else typeof r=="function"&&(p.preventDefault(),w=f?sh(s,f):new FormData(s),go(n,{pending:!0,data:w,method:s.method,action:r},r,w))},currentTarget:s}]})}}for(var Jo=0;Jo<Dr.length;Jo++){var Io=Dr[Jo],Rg=Io.toLowerCase(),Og=Io[0].toUpperCase()+Io.slice(1);tn(Rg,"on"+Og)}tn(Hu,"onAnimationEnd"),tn(Uu,"onAnimationIteration"),tn(Bu,"onAnimationStart"),tn("dblclick","onDoubleClick"),tn("focusin","onFocus"),tn("focusout","onBlur"),tn(Fv,"onTransitionRun"),tn(Jv,"onTransitionStart"),tn(Iv,"onTransitionCancel"),tn(qu,"onTransitionEnd"),Wa("onMouseEnter",["mouseout","mouseover"]),Wa("onMouseLeave",["mouseout","mouseover"]),Wa("onPointerEnter",["pointerout","pointerover"]),Wa("onPointerLeave",["pointerout","pointerover"]),ya("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ya("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ya("onBeforeInput",["compositionend","keypress","textInput","paste"]),ya("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ya("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ya("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vi="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(" "),Ng=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(vi));function rh(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],s=a.event;a=a.listeners;e:{var r=void 0;if(t)for(var f=a.length-1;0<=f;f--){var p=a[f],w=p.instance,O=p.currentTarget;if(p=p.listener,w!==r&&s.isPropagationStopped())break e;r=p,s.currentTarget=O;try{r(s)}catch(X){Fi(X)}s.currentTarget=null,r=w}else for(f=0;f<a.length;f++){if(p=a[f],w=p.instance,O=p.currentTarget,p=p.listener,w!==r&&s.isPropagationStopped())break e;r=p,s.currentTarget=O;try{r(s)}catch(X){Fi(X)}s.currentTarget=null,r=w}}}}function Te(e,t){var n=t[ae];n===void 0&&(n=t[ae]=new Set);var a=e+"__bubble";n.has(a)||(oh(t,e,2,!1),n.add(a))}function Po(e,t,n){var a=0;t&&(a|=4),oh(n,e,a,t)}var Hs="_reactListening"+Math.random().toString(36).slice(2);function ec(e){if(!e[Hs]){e[Hs]=!0,eu.forEach(function(n){n!=="selectionchange"&&(Ng.has(n)||Po(n,!1,e),Po(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Hs]||(t[Hs]=!0,Po("selectionchange",!1,t))}}function oh(e,t,n,a){switch(Uh(t)){case 2:var s=cm;break;case 8:s=um;break;default:s=vc}n=s.bind(null,t,n,e),s=void 0,!xr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),a?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function tc(e,t,n,a,s){var r=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var f=a.tag;if(f===3||f===4){var p=a.stateNode.containerInfo;if(p===s)break;if(f===4)for(f=a.return;f!==null;){var w=f.tag;if((w===3||w===4)&&f.stateNode.containerInfo===s)return;f=f.return}for(;p!==null;){if(f=Xa(p),f===null)return;if(w=f.tag,w===5||w===6||w===26||w===27){a=r=f;continue e}p=p.parentNode}}a=a.return}fu(function(){var O=r,X=mr(n),K=[];e:{var H=Lu.get(e);if(H!==void 0){var L=Wi,he=e;switch(e){case"keypress":if(Qi(n)===0)break e;case"keydown":case"keyup":L=Mv;break;case"focusin":he="focus",L=kr;break;case"focusout":he="blur",L=kr;break;case"beforeblur":case"afterblur":L=kr;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=vu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=gv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=Av;break;case Hu:case Uu:case Bu:L=xv;break;case qu:L=Rv;break;case"scroll":case"scrollend":L=pv;break;case"wheel":L=Nv;break;case"copy":case"cut":case"paste":L=jv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=mu;break;case"toggle":case"beforetoggle":L=Uv}var ye=(t&4)!==0,Le=!ye&&(e==="scroll"||e==="scrollend"),A=ye?H!==null?H+"Capture":null:H;ye=[];for(var M=O,R;M!==null;){var V=M;if(R=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||R===null||A===null||(V=Ul(M,A),V!=null&&ye.push(gi(M,V,R))),Le)break;M=M.return}0<ye.length&&(H=new L(H,he,null,n,X),K.push({event:H,listeners:ye}))}}if((t&7)===0){e:{if(H=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",H&&n!==gr&&(he=n.relatedTarget||n.fromElement)&&(Xa(he)||he[pn]))break e;if((L||H)&&(H=X.window===X?X:(H=X.ownerDocument)?H.defaultView||H.parentWindow:window,L?(he=n.relatedTarget||n.toElement,L=O,he=he?Xa(he):null,he!==null&&(Le=h(he),ye=he.tag,he!==Le||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(L=null,he=O),L!==he)){if(ye=vu,V="onMouseLeave",A="onMouseEnter",M="mouse",(e==="pointerout"||e==="pointerover")&&(ye=mu,V="onPointerLeave",A="onPointerEnter",M="pointer"),Le=L==null?H:Hl(L),R=he==null?H:Hl(he),H=new ye(V,M+"leave",L,n,X),H.target=Le,H.relatedTarget=R,V=null,Xa(X)===O&&(ye=new ye(A,M+"enter",he,n,X),ye.target=R,ye.relatedTarget=Le,V=ye),Le=V,L&&he)t:{for(ye=Hg,A=L,M=he,R=0,V=A;V;V=ye(V))R++;V=0;for(var ve=M;ve;ve=ye(ve))V++;for(;0<R-V;)A=ye(A),R--;for(;0<V-R;)M=ye(M),V--;for(;R--;){if(A===M||M!==null&&A===M.alternate){ye=A;break t}A=ye(A),M=ye(M)}ye=null}else ye=null;L!==null&&ch(K,H,L,ye,!1),he!==null&&Le!==null&&ch(K,Le,he,ye,!0)}}e:{if(H=O?Hl(O):window,L=H.nodeName&&H.nodeName.toLowerCase(),L==="select"||L==="input"&&H.type==="file")var Ae=zu;else if(ku(H))if(Tu)Ae=Wv;else{Ae=Qv;var pe=Xv}else L=H.nodeName,!L||L.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?O&&vr(O.elementType)&&(Ae=zu):Ae=Vv;if(Ae&&(Ae=Ae(e,O))){wu(K,Ae,n,X);break e}pe&&pe(e,H,O),e==="focusout"&&O&&H.type==="number"&&O.memoizedProps.value!=null&&pr(H,"number",H.value)}switch(pe=O?Hl(O):window,e){case"focusin":(ku(pe)||pe.contentEditable==="true")&&(Pa=pe,Er=O,Ql=null);break;case"focusout":Ql=Er=Pa=null;break;case"mousedown":_r=!0;break;case"contextmenu":case"mouseup":case"dragend":_r=!1,Ou(K,n,X);break;case"selectionchange":if(Zv)break;case"keydown":case"keyup":Ou(K,n,X)}var ke;if(zr)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Ia?ju(e,n)&&(Me="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Me="onCompositionStart");Me&&(yu&&n.locale!=="ko"&&(Ia||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Ia&&(ke=hu()):($n=X,br="value"in $n?$n.value:$n.textContent,Ia=!0)),pe=Us(O,Me),0<pe.length&&(Me=new gu(Me,e,null,n,X),K.push({event:Me,listeners:pe}),ke?Me.data=ke:(ke=Su(n),ke!==null&&(Me.data=ke)))),(ke=qv?Lv(e,n):$v(e,n))&&(Me=Us(O,"onBeforeInput"),0<Me.length&&(pe=new gu("onBeforeInput","beforeinput",null,n,X),K.push({event:pe,listeners:Me}),pe.data=ke)),Dg(K,e,O,n,X)}rh(K,t)})}function gi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Us(e,t){for(var n=t+"Capture",a=[];e!==null;){var s=e,r=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||r===null||(s=Ul(e,n),s!=null&&a.unshift(gi(e,s,r)),s=Ul(e,t),s!=null&&a.push(gi(e,s,r))),e.tag===3)return a;e=e.return}return[]}function Hg(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ch(e,t,n,a,s){for(var r=t._reactName,f=[];n!==null&&n!==a;){var p=n,w=p.alternate,O=p.stateNode;if(p=p.tag,w!==null&&w===a)break;p!==5&&p!==26&&p!==27||O===null||(w=O,s?(O=Ul(n,r),O!=null&&f.unshift(gi(n,O,w))):s||(O=Ul(n,r),O!=null&&f.push(gi(n,O,w)))),n=n.return}f.length!==0&&e.push({event:t,listeners:f})}var Ug=/\r\n?/g,Bg=/\u0000|\uFFFD/g;function uh(e){return(typeof e=="string"?e:""+e).replace(Ug,`
9
+ `).replace(Bg,"")}function dh(e,t){return t=uh(t),uh(e)===t}function qe(e,t,n,a,s,r){switch(n){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||Za(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&Za(e,""+a);break;case"className":$i(e,"class",a);break;case"tabIndex":$i(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":$i(e,n,a);break;case"style":uu(e,a,r);break;case"data":if(t!=="object"){$i(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=Gi(""+a),e.setAttribute(n,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(n,"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 r=="function"&&(n==="formAction"?(t!=="input"&&qe(e,t,"name",s.name,s,null),qe(e,t,"formEncType",s.formEncType,s,null),qe(e,t,"formMethod",s.formMethod,s,null),qe(e,t,"formTarget",s.formTarget,s,null)):(qe(e,t,"encType",s.encType,s,null),qe(e,t,"method",s.method,s,null),qe(e,t,"target",s.target,s,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=Gi(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=gn);break;case"onScroll":a!=null&&Te("scroll",e);break;case"onScrollEnd":a!=null&&Te("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(n=a.__html,n!=null){if(s.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}n=Gi(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""+a):e.removeAttribute(n);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":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":a===!0?e.setAttribute(n,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(n,a):e.removeAttribute(n);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(n):e.setAttribute(n,a);break;case"popover":Te("beforetoggle",e),Te("toggle",e),Li(e,"popover",a);break;case"xlinkActuate":vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":vn(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":vn(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":vn(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":vn(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Li(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=fv.get(n)||n,Li(e,n,a))}}function nc(e,t,n,a,s,r){switch(n){case"style":uu(e,a,r);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(n=a.__html,n!=null){if(s.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"children":typeof a=="string"?Za(e,a):(typeof a=="number"||typeof a=="bigint")&&Za(e,""+a);break;case"onScroll":a!=null&&Te("scroll",e);break;case"onScrollEnd":a!=null&&Te("scrollend",e);break;case"onClick":a!=null&&(e.onclick=gn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tu.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(s=n.endsWith("Capture"),t=n.slice(2,s?n.length-7:void 0),r=e[yt]||null,r=r!=null?r[n]:null,typeof r=="function"&&e.removeEventListener(t,r,s),typeof a=="function")){typeof r!="function"&&r!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,a,s);break e}n in e?e[n]=a:a===!0?e.setAttribute(n,""):Li(e,n,a)}}}function pt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Te("error",e),Te("load",e);var a=!1,s=!1,r;for(r in n)if(n.hasOwnProperty(r)){var f=n[r];if(f!=null)switch(r){case"src":a=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:qe(e,t,r,f,n,null)}}s&&qe(e,t,"srcSet",n.srcSet,n,null),a&&qe(e,t,"src",n.src,n,null);return;case"input":Te("invalid",e);var p=r=f=s=null,w=null,O=null;for(a in n)if(n.hasOwnProperty(a)){var X=n[a];if(X!=null)switch(a){case"name":s=X;break;case"type":f=X;break;case"checked":w=X;break;case"defaultChecked":O=X;break;case"value":r=X;break;case"defaultValue":p=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(o(137,t));break;default:qe(e,t,a,X,n,null)}}su(e,r,p,w,O,f,s,!1);return;case"select":Te("invalid",e),a=f=r=null;for(s in n)if(n.hasOwnProperty(s)&&(p=n[s],p!=null))switch(s){case"value":r=p;break;case"defaultValue":f=p;break;case"multiple":a=p;default:qe(e,t,s,p,n,null)}t=r,n=f,e.multiple=!!a,t!=null?Ka(e,!!a,t,!1):n!=null&&Ka(e,!!a,n,!0);return;case"textarea":Te("invalid",e),r=s=a=null;for(f in n)if(n.hasOwnProperty(f)&&(p=n[f],p!=null))switch(f){case"value":a=p;break;case"defaultValue":s=p;break;case"children":r=p;break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(o(91));break;default:qe(e,t,f,p,n,null)}ou(e,a,s,r);return;case"option":for(w in n)n.hasOwnProperty(w)&&(a=n[w],a!=null)&&(w==="selected"?e.selected=a&&typeof a!="function"&&typeof a!="symbol":qe(e,t,w,a,n,null));return;case"dialog":Te("beforetoggle",e),Te("toggle",e),Te("cancel",e),Te("close",e);break;case"iframe":case"object":Te("load",e);break;case"video":case"audio":for(a=0;a<vi.length;a++)Te(vi[a],e);break;case"image":Te("error",e),Te("load",e);break;case"details":Te("toggle",e);break;case"embed":case"source":case"link":Te("error",e),Te("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(O in n)if(n.hasOwnProperty(O)&&(a=n[O],a!=null))switch(O){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:qe(e,t,O,a,n,null)}return;default:if(vr(t)){for(X in n)n.hasOwnProperty(X)&&(a=n[X],a!==void 0&&nc(e,t,X,a,n,void 0));return}}for(p in n)n.hasOwnProperty(p)&&(a=n[p],a!=null&&qe(e,t,p,a,n,null))}function qg(e,t,n,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,r=null,f=null,p=null,w=null,O=null,X=null;for(L in n){var K=n[L];if(n.hasOwnProperty(L)&&K!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":w=K;default:a.hasOwnProperty(L)||qe(e,t,L,null,a,K)}}for(var H in a){var L=a[H];if(K=n[H],a.hasOwnProperty(H)&&(L!=null||K!=null))switch(H){case"type":r=L;break;case"name":s=L;break;case"checked":O=L;break;case"defaultChecked":X=L;break;case"value":f=L;break;case"defaultValue":p=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(o(137,t));break;default:L!==K&&qe(e,t,H,L,a,K)}}hr(e,f,p,w,O,X,r,s);return;case"select":L=f=p=H=null;for(r in n)if(w=n[r],n.hasOwnProperty(r)&&w!=null)switch(r){case"value":break;case"multiple":L=w;default:a.hasOwnProperty(r)||qe(e,t,r,null,a,w)}for(s in a)if(r=a[s],w=n[s],a.hasOwnProperty(s)&&(r!=null||w!=null))switch(s){case"value":H=r;break;case"defaultValue":p=r;break;case"multiple":f=r;default:r!==w&&qe(e,t,s,r,a,w)}t=p,n=f,a=L,H!=null?Ka(e,!!n,H,!1):!!a!=!!n&&(t!=null?Ka(e,!!n,t,!0):Ka(e,!!n,n?[]:"",!1));return;case"textarea":L=H=null;for(p in n)if(s=n[p],n.hasOwnProperty(p)&&s!=null&&!a.hasOwnProperty(p))switch(p){case"value":break;case"children":break;default:qe(e,t,p,null,a,s)}for(f in a)if(s=a[f],r=n[f],a.hasOwnProperty(f)&&(s!=null||r!=null))switch(f){case"value":H=s;break;case"defaultValue":L=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(o(91));break;default:s!==r&&qe(e,t,f,s,a,r)}ru(e,H,L);return;case"option":for(var he in n)H=n[he],n.hasOwnProperty(he)&&H!=null&&!a.hasOwnProperty(he)&&(he==="selected"?e.selected=!1:qe(e,t,he,null,a,H));for(w in a)H=a[w],L=n[w],a.hasOwnProperty(w)&&H!==L&&(H!=null||L!=null)&&(w==="selected"?e.selected=H&&typeof H!="function"&&typeof H!="symbol":qe(e,t,w,H,a,L));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 ye in n)H=n[ye],n.hasOwnProperty(ye)&&H!=null&&!a.hasOwnProperty(ye)&&qe(e,t,ye,null,a,H);for(O in a)if(H=a[O],L=n[O],a.hasOwnProperty(O)&&H!==L&&(H!=null||L!=null))switch(O){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(137,t));break;default:qe(e,t,O,H,a,L)}return;default:if(vr(t)){for(var Le in n)H=n[Le],n.hasOwnProperty(Le)&&H!==void 0&&!a.hasOwnProperty(Le)&&nc(e,t,Le,void 0,a,H);for(X in a)H=a[X],L=n[X],!a.hasOwnProperty(X)||H===L||H===void 0&&L===void 0||nc(e,t,X,H,a,L);return}}for(var A in n)H=n[A],n.hasOwnProperty(A)&&H!=null&&!a.hasOwnProperty(A)&&qe(e,t,A,null,a,H);for(K in a)H=a[K],L=n[K],!a.hasOwnProperty(K)||H===L||H==null&&L==null||qe(e,t,K,H,a,L)}function fh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Lg(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),a=0;a<n.length;a++){var s=n[a],r=s.transferSize,f=s.initiatorType,p=s.duration;if(r&&p&&fh(f)){for(f=0,p=s.responseEnd,a+=1;a<n.length;a++){var w=n[a],O=w.startTime;if(O>p)break;var X=w.transferSize,K=w.initiatorType;X&&fh(K)&&(w=w.responseEnd,f+=X*(w<p?1:(p-O)/(w-O)))}if(--a,t+=8*(r+f)/(s.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var ac=null,lc=null;function Bs(e){return e.nodeType===9?e:e.ownerDocument}function hh(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ph(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function ic(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var sc=null;function $g(){var e=window.event;return e&&e.type==="popstate"?e===sc?!1:(sc=e,!0):(sc=null,!1)}var vh=typeof setTimeout=="function"?setTimeout:void 0,Yg=typeof clearTimeout=="function"?clearTimeout:void 0,gh=typeof Promise=="function"?Promise:void 0,Gg=typeof queueMicrotask=="function"?queueMicrotask:typeof gh<"u"?function(e){return gh.resolve(null).then(e).catch(Xg)}:vh;function Xg(e){setTimeout(function(){throw e})}function la(e){return e==="head"}function mh(e,t){var n=t,a=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"||n==="/&"){if(a===0){e.removeChild(s),Tl(t);return}a--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")a++;else if(n==="html")mi(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,mi(n);for(var r=n.firstChild;r;){var f=r.nextSibling,p=r.nodeName;r[Ln]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&r.rel.toLowerCase()==="stylesheet"||n.removeChild(r),r=f}}else n==="body"&&mi(e.ownerDocument.body);n=s}while(n);Tl(t)}function yh(e,t){var n=e;e=0;do{var a=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=a}while(n)}function rc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":rc(n),Nl(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Qg(e,t,n,a){for(;e.nodeType===1;){var s=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[Ln])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=Vt(e.nextSibling),e===null)break}return null}function Vg(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Vt(e.nextSibling),e===null))return null;return e}function xh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Vt(e.nextSibling),e===null))return null;return e}function oc(e){return e.data==="$?"||e.data==="$~"}function cc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Wg(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var a=function(){t(),n.removeEventListener("DOMContentLoaded",a)};n.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function Vt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var uc=null;function bh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Vt(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function jh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Sh(e,t,n){switch(t=Bs(n),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function mi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Nl(e)}var Wt=new Map,kh=new Set;function qs(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Dn=G.d;G.d={f:Kg,r:Zg,D:Fg,C:Jg,L:Ig,m:Pg,X:tm,S:em,M:nm};function Kg(){var e=Dn.f(),t=_s();return e||t}function Zg(e){var t=Qa(e);t!==null&&t.tag===5&&t.type==="form"?qd(t):Dn.r(e)}var kl=typeof document>"u"?null:document;function wh(e,t,n){var a=kl;if(a&&typeof t=="string"&&t){var s=qt(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),kh.has(s)||(kh.add(s),e={rel:e,crossOrigin:n,href:t},a.querySelector(s)===null&&(t=a.createElement("link"),pt(t,"link",e),rt(t),a.head.appendChild(t)))}}function Fg(e){Dn.D(e),wh("dns-prefetch",e,null)}function Jg(e,t){Dn.C(e,t),wh("preconnect",e,t)}function Ig(e,t,n){Dn.L(e,t,n);var a=kl;if(a&&e&&t){var s='link[rel="preload"][as="'+qt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+qt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+qt(n.imageSizes)+'"]')):s+='[href="'+qt(e)+'"]';var r=s;switch(t){case"style":r=wl(e);break;case"script":r=zl(e)}Wt.has(r)||(e=x({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Wt.set(r,e),a.querySelector(s)!==null||t==="style"&&a.querySelector(yi(r))||t==="script"&&a.querySelector(xi(r))||(t=a.createElement("link"),pt(t,"link",e),rt(t),a.head.appendChild(t)))}}function Pg(e,t){Dn.m(e,t);var n=kl;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+qt(a)+'"][href="'+qt(e)+'"]',r=s;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=zl(e)}if(!Wt.has(r)&&(e=x({rel:"modulepreload",href:e},t),Wt.set(r,e),n.querySelector(s)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(xi(r)))return}a=n.createElement("link"),pt(a,"link",e),rt(a),n.head.appendChild(a)}}}function em(e,t,n){Dn.S(e,t,n);var a=kl;if(a&&e){var s=Va(a).hoistableStyles,r=wl(e);t=t||"default";var f=s.get(r);if(!f){var p={loading:0,preload:null};if(f=a.querySelector(yi(r)))p.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Wt.get(r))&&dc(e,n);var w=f=a.createElement("link");rt(w),pt(w,"link",e),w._p=new Promise(function(O,X){w.onload=O,w.onerror=X}),w.addEventListener("load",function(){p.loading|=1}),w.addEventListener("error",function(){p.loading|=2}),p.loading|=4,Ls(f,t,a)}f={type:"stylesheet",instance:f,count:1,state:p},s.set(r,f)}}}function tm(e,t){Dn.X(e,t);var n=kl;if(n&&e){var a=Va(n).hoistableScripts,s=zl(e),r=a.get(s);r||(r=n.querySelector(xi(s)),r||(e=x({src:e,async:!0},t),(t=Wt.get(s))&&fc(e,t),r=n.createElement("script"),rt(r),pt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(s,r))}}function nm(e,t){Dn.M(e,t);var n=kl;if(n&&e){var a=Va(n).hoistableScripts,s=zl(e),r=a.get(s);r||(r=n.querySelector(xi(s)),r||(e=x({src:e,async:!0,type:"module"},t),(t=Wt.get(s))&&fc(e,t),r=n.createElement("script"),rt(r),pt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(s,r))}}function zh(e,t,n,a){var s=(s=ue.current)?qs(s):null;if(!s)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=wl(n.href),n=Va(s).hoistableStyles,a=n.get(t),a||(a={type:"style",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=wl(n.href);var r=Va(s).hoistableStyles,f=r.get(e);if(f||(s=s.ownerDocument||s,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,f),(r=s.querySelector(yi(e)))&&!r._p&&(f.instance=r,f.state.loading=5),Wt.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Wt.set(e,n),r||am(s,e,n,f.state))),t&&a===null)throw Error(o(528,""));return f}if(t&&a!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=zl(n),n=Va(s).hoistableScripts,a=n.get(t),a||(a={type:"script",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function wl(e){return'href="'+qt(e)+'"'}function yi(e){return'link[rel="stylesheet"]['+e+"]"}function Th(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function am(e,t,n,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),pt(t,"link",n),rt(t),e.head.appendChild(t))}function zl(e){return'[src="'+qt(e)+'"]'}function xi(e){return"script[async]"+e}function Ch(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+qt(n.href)+'"]');if(a)return t.instance=a,rt(a),a;var s=x({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),rt(a),pt(a,"style",s),Ls(a,n.precedence,e),t.instance=a;case"stylesheet":s=wl(n.href);var r=e.querySelector(yi(s));if(r)return t.state.loading|=4,t.instance=r,rt(r),r;a=Th(n),(s=Wt.get(s))&&dc(a,s),r=(e.ownerDocument||e).createElement("link"),rt(r);var f=r;return f._p=new Promise(function(p,w){f.onload=p,f.onerror=w}),pt(r,"link",a),t.state.loading|=4,Ls(r,n.precedence,e),t.instance=r;case"script":return r=zl(n.src),(s=e.querySelector(xi(r)))?(t.instance=s,rt(s),s):(a=n,(s=Wt.get(r))&&(a=x({},n),fc(a,s)),e=e.ownerDocument||e,s=e.createElement("script"),rt(s),pt(s,"link",a),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Ls(a,n.precedence,e));return t.instance}function Ls(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=a.length?a[a.length-1]:null,r=s,f=0;f<a.length;f++){var p=a[f];if(p.dataset.precedence===t)r=p;else if(r!==s)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function dc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function fc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var $s=null;function Mh(e,t,n){if($s===null){var a=new Map,s=$s=new Map;s.set(n,a)}else s=$s,a=s.get(n),a||(a=new Map,s.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),s=0;s<n.length;s++){var r=n[s];if(!(r[Ln]||r[it]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var f=r.getAttribute(t)||"";f=e+f;var p=a.get(f);p?p.push(r):a.set(f,[r])}}return a}function Eh(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function lm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function _h(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function im(e,t,n,a){if(n.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var s=wl(a.href),r=t.querySelector(yi(s));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ys.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,rt(r);return}r=t.ownerDocument||t,a=Th(a),(s=Wt.get(s))&&dc(a,s),r=r.createElement("link"),rt(r);var f=r;f._p=new Promise(function(p,w){f.onload=p,f.onerror=w}),pt(r,"link",a),n.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Ys.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var hc=0;function sm(e,t){return e.stylesheets&&e.count===0&&Xs(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var a=setTimeout(function(){if(e.stylesheets&&Xs(e,e.stylesheets),e.unsuspend){var r=e.unsuspend;e.unsuspend=null,r()}},6e4+t);0<e.imgBytes&&hc===0&&(hc=62500*Lg());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xs(e,e.stylesheets),e.unsuspend)){var r=e.unsuspend;e.unsuspend=null,r()}},(e.imgBytes>hc?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(s)}}:null}function Ys(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Gs=null;function Xs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Gs=new Map,t.forEach(rm,e),Gs=null,Ys.call(e))}function rm(e,t){if(!(t.state.loading&4)){var n=Gs.get(e);if(n)var a=n.get(null);else{n=new Map,Gs.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<s.length;r++){var f=s[r];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(n.set(f.dataset.precedence,f),a=f)}a&&n.set(null,a)}s=t.instance,f=s.getAttribute("data-precedence"),r=n.get(f)||a,r===a&&n.set(null,s),n.set(f,s),this.count++,a=Ys.bind(this),s.addEventListener("load",a),s.addEventListener("error",a),r?r.parentNode.insertBefore(s,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var bi={$$typeof:B,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function om(e,t,n,a,s,r,f,p,w){this.tag=1,this.containerInfo=e,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=va(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=va(0),this.hiddenUpdates=va(null),this.identifierPrefix=a,this.onUncaughtError=s,this.onCaughtError=r,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function Ah(e,t,n,a,s,r,f,p,w,O,X,K){return e=new om(e,t,n,f,w,O,X,K,p),t=1,r===!0&&(t|=24),r=_t(3,null,null,t),e.current=r,r.stateNode=e,t=Qr(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:a,isDehydrated:n,cache:t},Zr(r),e}function Dh(e){return e?(e=nl,e):nl}function Rh(e,t,n,a,s,r){s=Dh(s),a.context===null?a.context=s:a.pendingContext=s,a=Wn(t),a.payload={element:n},r=r===void 0?null:r,r!==null&&(a.callback=r),n=Kn(e,a,t),n!==null&&(Ct(n,e,t),Il(n,e,t))}function Oh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function pc(e,t){Oh(e,t),(e=e.alternate)&&Oh(e,t)}function Nh(e){if(e.tag===13||e.tag===31){var t=Sa(e,67108864);t!==null&&Ct(t,e,67108864),pc(e,67108864)}}function Hh(e){if(e.tag===13||e.tag===31){var t=Nt();t=ga(t);var n=Sa(e,t);n!==null&&Ct(n,e,t),pc(e,t)}}var Qs=!0;function cm(e,t,n,a){var s=E.T;E.T=null;var r=G.p;try{G.p=2,vc(e,t,n,a)}finally{G.p=r,E.T=s}}function um(e,t,n,a){var s=E.T;E.T=null;var r=G.p;try{G.p=8,vc(e,t,n,a)}finally{G.p=r,E.T=s}}function vc(e,t,n,a){if(Qs){var s=gc(a);if(s===null)tc(e,t,a,Vs,n),Bh(e,a);else if(fm(s,e,t,n,a))a.stopPropagation();else if(Bh(e,a),t&4&&-1<dm.indexOf(e)){for(;s!==null;){var r=Qa(s);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var f=It(r.pendingLanes);if(f!==0){var p=r;for(p.pendingLanes|=2,p.entangledLanes|=2;f;){var w=1<<31-ut(f);p.entanglements[1]|=w,f&=~w}un(r),(Oe&6)===0&&(Ms=mt()+500,pi(0))}}break;case 31:case 13:p=Sa(r,2),p!==null&&Ct(p,r,2),_s(),pc(r,2)}if(r=gc(a),r===null&&tc(e,t,a,Vs,n),r===s)break;s=r}s!==null&&a.stopPropagation()}else tc(e,t,a,null,n)}}function gc(e){return e=mr(e),mc(e)}var Vs=null;function mc(e){if(Vs=null,e=Xa(e),e!==null){var t=h(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=g(t),e!==null)return e;e=null}else if(n===31){if(e=y(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Vs=e,null}function Uh(e){switch(e){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(or()){case _l:return 2;case Al:return 8;case $a:case hn:return 32;case pa:return 268435456;default:return 32}default:return 32}}var yc=!1,ia=null,sa=null,ra=null,ji=new Map,Si=new Map,oa=[],dm="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 Bh(e,t){switch(e){case"focusin":case"focusout":ia=null;break;case"dragenter":case"dragleave":sa=null;break;case"mouseover":case"mouseout":ra=null;break;case"pointerover":case"pointerout":ji.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Si.delete(t.pointerId)}}function ki(e,t,n,a,s,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:r,targetContainers:[s]},t!==null&&(t=Qa(t),t!==null&&Nh(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function fm(e,t,n,a,s){switch(t){case"focusin":return ia=ki(ia,e,t,n,a,s),!0;case"dragenter":return sa=ki(sa,e,t,n,a,s),!0;case"mouseover":return ra=ki(ra,e,t,n,a,s),!0;case"pointerover":var r=s.pointerId;return ji.set(r,ki(ji.get(r)||null,e,t,n,a,s)),!0;case"gotpointercapture":return r=s.pointerId,Si.set(r,ki(Si.get(r)||null,e,t,n,a,s)),!0}return!1}function qh(e){var t=Xa(e.target);if(t!==null){var n=h(t);if(n!==null){if(t=n.tag,t===13){if(t=g(n),t!==null){e.blockedOn=t,Ol(e.priority,function(){Hh(n)});return}}else if(t===31){if(t=y(n),t!==null){e.blockedOn=t,Ol(e.priority,function(){Hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ws(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gc(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);gr=a,n.target.dispatchEvent(a),gr=null}else return t=Qa(n),t!==null&&Nh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ws(e)&&n.delete(t)}function hm(){yc=!1,ia!==null&&Ws(ia)&&(ia=null),sa!==null&&Ws(sa)&&(sa=null),ra!==null&&Ws(ra)&&(ra=null),ji.forEach(Lh),Si.forEach(Lh)}function Ks(e,t){e.blockedOn===t&&(e.blockedOn=null,yc||(yc=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,hm)))}var Zs=null;function $h(e){Zs!==e&&(Zs=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Zs===e&&(Zs=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],s=e[t+2];if(typeof a!="function"){if(mc(a||n)===null)continue;break}var r=Qa(n);r!==null&&(e.splice(t,3),t-=3,go(r,{pending:!0,data:s,method:n.method,action:a},a,s))}}))}function Tl(e){function t(w){return Ks(w,e)}ia!==null&&Ks(ia,e),sa!==null&&Ks(sa,e),ra!==null&&Ks(ra,e),ji.forEach(t),Si.forEach(t);for(var n=0;n<oa.length;n++){var a=oa[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<oa.length&&(n=oa[0],n.blockedOn===null);)qh(n),n.blockedOn===null&&oa.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var s=n[a],r=n[a+1],f=s[yt]||null;if(typeof r=="function")f||$h(n);else if(f){var p=null;if(r&&r.hasAttribute("formAction")){if(s=r,f=r[yt]||null)p=f.formAction;else if(mc(s)!==null)continue}else p=f.action;typeof p=="function"?n[a+1]=p:(n.splice(a,3),a-=3),$h(n)}}}function Yh(){function e(r){r.canIntercept&&r.info==="react-transition"&&r.intercept({handler:function(){return new Promise(function(f){return s=f})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),a||setTimeout(n,20)}function n(){if(!a&&!navigation.transition){var r=navigation.currentEntry;r&&r.url!=null&&navigation.navigate(r.url,{state:r.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function xc(e){this._internalRoot=e}Fs.prototype.render=xc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current,a=Nt();Rh(n,a,e,t,null,null)},Fs.prototype.unmount=xc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Rh(e.current,2,null,e,null,null),_s(),t[pn]=null}};function Fs(e){this._internalRoot=e}Fs.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rl();e={blockedOn:null,target:e,priority:t};for(var n=0;n<oa.length&&t!==0&&t<oa[n].priority;n++);oa.splice(n,0,e),n===0&&qh(e)}};var Gh=c.version;if(Gh!=="19.2.8")throw Error(o(527,Gh,"19.2.8"));G.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=v(t),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var pm={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Js=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Js.isDisabled&&Js.supportsFiber)try{Hn=Js.inject(pm),ct=Js}catch{}}return zi.createRoot=function(e,t){if(!d(e))throw Error(o(299));var n=!1,a="",s=Zd,r=Fd,f=Jd;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=Ah(e,1,!1,null,null,n,a,null,s,r,f,Yh),e[pn]=t.current,ec(e),new xc(t)},zi.hydrateRoot=function(e,t,n){if(!d(e))throw Error(o(299));var a=!1,s="",r=Zd,f=Fd,p=Jd,w=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(p=n.onRecoverableError),n.formState!==void 0&&(w=n.formState)),t=Ah(e,1,!0,t,n??null,a,s,w,r,f,p,Yh),t.context=Dh(null),n=t.current,a=Nt(),a=ga(a),s=Wn(a),s.callback=null,Kn(n,s,a),n=a,t.current.lanes=n,qn(t,n),un(t),e[pn]=t.current,ec(e),new Fs(t)},zi.version="19.2.8",zi}var Ph;function zm(){if(Ph)return Sc.exports;Ph=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),Sc.exports=wm(),Sc.exports}var Tm=zm();const Cm=["run_started","run_resumed","run_finished","run_error","run_titled","cost","budget_alert","budget_stop","usage_limit","mission_incomplete","settings_changed","message","steer","worker_started","worker_progress","worker_finished","worker_stalled","worker_looping","director_looping","service_exposed","auto_allowed","auto_denied","root_allowed","permission_request","permission_resolved","permission_timeout","question","question_answered","question_timeout","chat_message","chat_turn","chat_cost","chat_error","chat_cleared","chat_proposal_dismissed","chat_question","chat_answered","chat_question_timeout","mission_proposed","models_changed","git_branch","git_note","git_committed","pull_request","memory_updated"],Yc=new Set,ir=new Set;let Ti=null;function Hp(){if(!Ti){Ti=new EventSource("/events"),Ti.onopen=()=>ir.forEach(i=>i(!0)),Ti.onerror=()=>ir.forEach(i=>i(!1));for(const i of Cm)Ti.addEventListener(i,c=>{const u=JSON.parse(c.data);Yc.forEach(o=>o(i,u))})}}function _i(i){return Hp(),Yc.add(i),()=>Yc.delete(i)}function Mm(i){return Hp(),ir.add(i),()=>ir.delete(i)}function da(i){return i.costBasis==="priced"||i.costBasis==="free"||i.costBasis==="unpriced"?i.costBasis:i.metered===!1?"unpriced":"priced"}function Up(i){if(i)switch(i.kind){case"claude-code":return i.configDir;case"codex":return i.codexHome??"~/.codex";case"openai-compatible":return i.baseUrl;case"anthropic-api":return`$${i.apiKeyEnv}`}}const Zc={runStatus:"idle",mission:"",title:"",costBasis:"priced",usage:null,costUsd:0,budgetUsd:5,agents:[],entries:[],approvals:[],questions:[],missionDoc:null,services:[]};let $e=0;function Bp(i,c,u){const o=[],d=(h,g,y)=>o.push({id:++$e,ts:u,agent:i,kind:h,title:g,body:y});if(c.type==="system"&&c.subtype==="init")d("system","init",`model: ${c.model??"?"}`);else if(c.type==="assistant"){for(const h of c.message?.content??[])if(h.type==="text"&&h.text?.trim())d("text",i,h.text);else if(h.type==="tool_use"){const g=String(h.name).replace("mcp__foreman__","").replace("mcp__playwright__","");d("tool",g,JSON.stringify(h.input).slice(0,4e3))}}else if(c.type==="user"&&Array.isArray(c.message?.content)){for(const h of c.message.content)if(h.type==="tool_result"){const g=typeof h.content=="string"?h.content:(h.content??[]).map(y=>y.text??"").join("");d("result","result",String(g).slice(0,700))}}else c.type==="result"&&d(c.is_error?"error":"system",`result · ${c.subtype??""}`,String(c.result??"").slice(0,2500));return o}const ep=i=>String(i??"").replace(/\s+/g," ").trim();function Em(i,c){if(i.kind==="system"&&i.title.startsWith("result ·")&&i.body){for(let u=c.length-1;u>=0&&u>=c.length-40;u--){const o=c[u];if(o.agent===i.agent&&o.kind==="text"){const d=ep(o.body),h=ep(i.body);return d.length>=40&&h.length>=40&&(d.startsWith(h)||h.startsWith(d))?{...i,body:""}:i}}return i}if(i.kind==="result"){const u=/^\[(worker-\d+) (finished|failed|done|started|resumed|stalled|interrupted)\]\s*/.exec(i.body);if(u){const o=i.body.slice(u[0].length).split(`
10
+ `).find(d=>d.trim())??"";return{...i,title:`${u[1]} ${u[2]}`,body:o.length>160?`${o.slice(0,159).trimEnd()}…`:o}}}return i}function _m(i,c){const u=c.ts??Date.now(),o=c.data;switch(c.event){case"run_started":return{...Zc,missionDoc:i.missionDoc,runStatus:"running",mission:o.mission,budgetUsd:o.budgetUsd,costBasis:da(o),usage:o.usage??null,agents:[{id:"director",status:"running"}]};case"run_resumed":{const d=i.agents.filter(h=>h.id!=="director").map(h=>h.status==="running"?{...h,status:"interrupted"}:h);return{...i,runStatus:"running",mission:o.mission??i.mission,budgetUsd:o.budgetUsd??i.budgetUsd,costUsd:o.costUsd??i.costUsd,costBasis:o.costBasis||o.metered!==void 0?da(o):i.costBasis,usage:o.usage??i.usage,agents:[{id:"director",status:"running"},...d],entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"system",title:"mission resumed",body:"Director session restored; re-verifying state against MISSION.md."}]}}case"run_finished":return{...i,runStatus:o.status||"done",costUsd:o.costUsd??i.costUsd,approvals:[],questions:[],agents:i.agents.map(d=>d.id==="director"?{...d,status:o.status||"done"}:d)};case"mission_incomplete":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"error",title:"not done",body:[o.text,"",...(o.unmet??[]).map(d=>`▢ ${d}`)].join(`
11
11
  `)}]};case"run_error":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"error",title:"error",body:o.error}]};case"worker_stalled":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:String(o.id??"worker"),kind:"error",title:"worker stalled",body:String(o.text??"Worker produced no output and was stopped.")}]};case"worker_looping":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:String(o.id??"worker"),kind:"error",title:"worker looping",body:String(o.text??`Worker repeated the identical ${String(o.toolName??"tool")} call ${String(o.count??"?")} times and was stopped.`)}]};case"director_looping":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"director",kind:"error",title:"director looping",body:String(o.text??`Director issued the identical ${String(o.toolName??"tool")} call ${String(o.count??"?")} times in a row — notified.`)}]};case"settings_changed":return{...i,budgetUsd:typeof o.budgetUsd=="number"?o.budgetUsd:i.budgetUsd,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"steer",title:"settings changed",body:(o.changes??[]).join(`
12
- `)}]};case"run_titled":return{...i,title:String(o.title??"")};case"cost":return{...i,costUsd:o.costUsd,budgetUsd:o.budgetUsd,usage:o.usage??i.usage,costBasis:dl(o)};case"message":{const d=o.agent==="director"&&o.msg?.session_id?{directorSessionId:o.msg.session_id}:{},h=Bp(o.agent,o.msg,u).map(g=>Em(g,i.entries));return h.length||d.directorSessionId?{...i,...d,entries:[...i.entries.slice(-1499),...h]}:i}case"steer":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"you",kind:"steer",title:"steer",body:o.text,to:o.to,timing:o.timing}]};case"usage_limit":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"error",title:"usage limit",body:o.text}]};case"models_changed":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"system",title:"models changed",body:o.text}]};case"memory_updated":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"system",title:"memory",body:String(o.text??"Project memory rewritten.")}]};case"pull_request":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:o.error?"error":"system",title:o.method==="gh"?"pull request":"branch pushed",body:String(o.text??"")}]};case"git_branch":case"git_note":case"git_committed":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:c.event==="git_committed"&&o.error||c.event==="git_note"?"error":"system",title:c.event==="git_branch"?`branch · ${String(o.branch??"")}`:c.event==="git_committed"?"branch closed":"git",body:String(o.text??"")}]};case"budget_alert":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:o.level==="exceeded"?"error":"system",title:"budget",body:o.text}]};case"service_exposed":return{...i,services:[...i.services.filter(d=>d.port!==o.port),{port:o.port,label:o.label,path:o.path,url:o.url,since:u}]};case"worker_started":{const d=i.agents.filter(g=>g.id!==o.id),h=i.agents.find(g=>g.id===o.id);return{...i,agents:[...d,{id:o.id,status:"running",task:o.task??h?.task}],entries:[...i.entries,{id:++$e,ts:u,agent:o.id,kind:"system",title:o.resumed?"resumed":"spawned",body:o.task??""}]}}case"worker_progress":{const d=String(o.status??""),h=[d,...Array.isArray(o.done)&&o.done.length?[`done: ${o.done.join(", ")}`]:[],...o.next?[`next: ${String(o.next)}`]:[],...o.blocked?[`BLOCKED: ${String(o.blocked)}`]:[]].join(`
13
- `);return{...i,agents:i.agents.map(g=>g.id===o.id?{...g,task:d||g.task}:g),entries:[...i.entries,{id:++$e,ts:u,agent:String(o.id??"worker"),kind:"system",title:o.blocked?"progress · blocked":"progress",body:h}]}}case"worker_finished":return{...i,agents:i.agents.map(d=>d.id===o.id?{...d,status:o.status}:d)};case"permission_request":return i.approvals.some(d=>d.id===o.id)?i:{...i,approvals:[...i.approvals,{...o,since:u}],entries:[...i.entries,{id:++$e,ts:u,agent:String(o.agent??"director"),kind:"system",title:"waiting on you",body:`${String(o.toolName??"tool")}: ${String(o.description??o.decisionReason??o.title??"needs your approval")}`}]};case"permission_resolved":{const d=i.approvals.find(h=>h.id===o.id);return d?{...i,approvals:i.approvals.filter(h=>h.id!==o.id),entries:[...i.entries,{id:++$e,ts:u,agent:String(d.agent??"director"),kind:"system",title:"resolved",body:String(o.behavior??"resolved")}]}:i}case"question":return i.questions.some(d=>d.id===o.id)?i:{...i,questions:[...i.questions,{...o,since:u}],entries:[...i.entries,{id:++$e,ts:u,agent:"director",kind:"system",title:"waiting on you",body:`question: ${String(o.question??"")}`}]};case"question_answered":return i.questions.find(h=>h.id===o.id)?{...i,questions:i.questions.filter(h=>h.id!==o.id),entries:[...i.entries,{id:++$e,ts:u,agent:"director",kind:"system",title:"resolved",body:"answered"}]}:i;case"root_allowed":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:String(o.agent??"director"),kind:"system",title:"path allowed for run",body:String(o.path??"")}]};case"auto_denied":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:String(o.agent??"director"),kind:"system",title:"redirected to workspace",body:String(o.reason??"")}]};case"permission_timeout":case"question_timeout":{const d=c.event==="permission_timeout";if(!(d?i.approvals.find(y=>y.id===o.id):i.questions.find(y=>y.id===o.id)))return i;const g=Math.max(1,Math.round(Number(o.afterMs??0)/6e4));return{...i,approvals:d?i.approvals.filter(y=>y.id!==o.id):i.approvals,questions:d?i.questions:i.questions.filter(y=>y.id!==o.id),entries:[...i.entries,{id:++$e,ts:u,agent:String(o.agent??"director"),kind:"error",title:d?"auto-denied (unattended)":"auto-answered (unattended)",body:d?`${String(o.toolName??"tool")} waited ${g} min with no answer and was denied; the agent was told to redo the work inside .foreman/work/.`:`The director's question waited ${g} min with no answer; it was told to decide itself and record the decision in MISSION.md.`}]}}default:return i}}function Am(i,c){switch(c.t){case"reset":return Zc;case"wire":return _m(i,c.e);case"missiondoc":return{...i,missionDoc:c.doc}}}function Dm(i,c){const[u,o]=m.useReducer(Am,Zc),d=m.useRef(null);return m.useEffect(()=>{if(o({t:"reset"}),!i)return;let h=!1;d.current=[];const g=c?Ei((v,S)=>{if(S.runId!==i)return;const b={event:v,data:S.data};d.current?d.current.push(b):o({t:"wire",e:b})}):null;(async()=>{try{const v=await fetch(`/runs/${encodeURIComponent(i)}/events`).catch(()=>null);if(h||!v?.ok)return;const{events:S}=await v.json();if(h)return;for(const b of S)o({t:"wire",e:b})}finally{if(!h){for(const v of d.current??[])o({t:"wire",e:v});d.current=null}}})();const y=async()=>{const v=await fetch(`/missiondoc?run=${encodeURIComponent(i)}`).catch(()=>null);v?.ok&&!h&&o({t:"missiondoc",doc:(await v.json()).doc})};y();const x=c?setInterval(y,5e3):null;return()=>{h=!0,g?.(),x&&clearInterval(x)}},[i,c]),u}function Rm(i,c){if(i==="message"){const u=c.msg;if(u?.type==="assistant")for(const o of u.message?.content??[]){if(o.type==="text"&&o.text?.trim())return`${c.agent}: ${o.text.trim()}`;if(o.type==="tool_use"){const d=String(o.name||"").replace(/^mcp__(foreman|playwright)__/,"");return`${c.agent} · ${d}`}}return null}return i==="worker_started"?`${c.id} ${c.resumed?"resumed":"spawned"}`:i==="worker_finished"?`${c.id} ${c.status}`:i==="worker_progress"?`${c.id}: ${c.blocked?`BLOCKED — ${c.blocked}`:c.status}`:i==="steer"?`you → ${c.to}: ${c.text}`:i==="budget_alert"?c.text:i==="question"?`director asks: ${c.question}`:null}function Om(){const[i,c]=m.useState([]),[u,o]=m.useState(!1),[d,h]=m.useState({mode:"none",source:""}),[g,y]=m.useState({}),[x,v]=m.useState(null),[S,b]=m.useState(""),[j,k]=m.useState(null),B=m.useCallback(async()=>{const K=await fetch("/projects").catch(()=>null);if(!K?.ok)return;const M=await K.json();c(M.projects),h({mode:M.authMode??"none",source:M.authSource??"",account:M.authAccount??void 0}),v(M.update?.latest?{latest:String(M.update.latest),current:String(M.version??"")}:null),b(String(M.version??"")),k(!!M.firstRun)},[]);return m.useEffect(()=>{B();const K=setInterval(B,3e3),M=Ei((D,U)=>{if(!U.chat&&(["run_started","run_resumed","run_finished","permission_request","permission_resolved","permission_timeout","question","question_answered","question_timeout"].includes(D)&&B(),U.projectId))if(D==="run_finished")y(F=>{const{[U.projectId]:re,...q}=F;return q});else{const F=Rm(D,U.data);F&&y(re=>({...re,[U.projectId]:F.slice(0,160)}))}}),z=Mm(D=>{o(D),D&&B()});return()=>{clearInterval(K),M(),z()}},[B]),{projects:i,connected:u,auth:d,refresh:B,activity:g,update:x,version:S,firstRun:j}}function Nm(i){const[c,u]=m.useState([]),o=m.useCallback(async()=>{const d=await fetch(`/runs?projectId=${encodeURIComponent(i)}`).catch(()=>null);d?.ok&&u((await d.json()).runs)},[i]);return m.useEffect(()=>(o(),Ei((h,g)=>{g.projectId===i&&(h==="run_started"||h==="run_resumed"||h==="run_finished"||h==="git_committed"||h==="pull_request")&&o()})),[i,o]),c}const Gc={entries:[],costUsd:0,proposal:null,thinking:!1,question:null,who:null};function Hm(i,c){return i.map(u=>`${u.question.replace(/[?:]\s*$/,"")} → ${c[u.question]||"(no answer)"}`).join(`
14
- `)}function qp(i,c){const u=c.ts??Date.now(),o=c.data;switch(c.event){case"chat_cleared":return Lp(i,{t:"reset"});case"chat_proposal_dismissed":return{...i,proposal:null};case"chat_message":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"you",kind:"steer",title:"you",body:o.text}]};case"message":{const d=Bp("foreman",o.msg,u).filter(h=>h.kind==="text"||h.kind==="tool"&&!/ask_user/.test(h.title));return d.length?{...i,entries:[...i.entries,...d]}:i}case"mission_proposed":return{...i,proposal:o};case"chat_cost":return{...i,costUsd:o.costUsd??i.costUsd};case"chat_turn":return{...i,thinking:o.state==="thinking",who:typeof o.model=="string"&&typeof o.provider=="string"?{model:o.model,provider:o.provider,costBasis:dl(o)}:i.who};case"chat_question":return Array.isArray(o.questions)&&o.questions.length?{...i,question:{id:String(o.id),questions:o.questions,askedAt:u}}:i;case"chat_answered":{const d=i.question,h=d&&d.id===o.id?d.questions:[],g=h.length?Hm(h,o.answers??{}):Object.entries(o.answers??{}).map(([y,x])=>`${y} → ${x}`).join(`
15
- `);return{...i,question:i.question?.id===o.id?null:i.question,entries:g?[...i.entries,{id:++$e,ts:u,agent:"you",kind:"steer",title:o.source?`you chose · via ${o.source}`:"you chose",body:g}]:i.entries}}case"chat_question_timeout":return{...i,question:i.question?.id===o.id?null:i.question,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"error",title:"no answer (unattended)",body:`No answer after ${Math.round((o.afterMs??0)/6e4)} minutes — the planner is proceeding on its recommended options and will state the assumptions.`}]};case"chat_error":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"error",title:"planner",body:o.error}]};default:return i}}function Lp(i,c){switch(c.t){case"reset":return Gc;case"load":return c.view;case"dismiss":return{...i,proposal:null};case"wire":return qp(i,c.e)}}function Um(i){const[c,u]=m.useState([]),[o,d]=m.useState(!1);return m.useEffect(()=>{if(i.length<2){u([]),d(!1);return}let h=!1;d(!0);const g=setTimeout(()=>{fetch(`/search?q=${encodeURIComponent(i)}`).then(y=>y.ok?y.json():{runs:[]}).then(y=>{h||(u(y.runs??[]),d(!1))}).catch(()=>{h||(u([]),d(!1))})},200);return()=>{h=!0,clearTimeout(g)}},[i]),{hits:c,busy:o}}const Bm="_fleet";function $p(i){const[c,u]=m.useReducer(Lp,Gc),o=m.useRef(null),d=m.useCallback(async S=>{const b=await fetch(`/chat?projectId=${encodeURIComponent(S)}`).catch(()=>null);return b?.ok?await b.json():null},[]);m.useEffect(()=>{if(u({t:"reset"}),!i)return;let S=!1;o.current=[];const b=Ei((j,k)=>{if(!k.chat||k.projectId!==i)return;const B={event:j,data:k.data};o.current?o.current.push(B):u({t:"wire",e:B})});return(async()=>{const j=await d(i);if(!S){if(j){let k={...Gc,costUsd:j.costUsd,proposal:j.proposal,thinking:j.thinking};for(const B of j.events)k=qp(k,B);k={...k,question:j.question??null,who:j.who??k.who,thinking:j.thinking},u({t:"load",view:k})}for(const k of o.current??[])u({t:"wire",e:k});o.current=null}})(),()=>{S=!0,b()}},[i,d]);const h=m.useCallback(async S=>{if(!i)return"no project";const b=await gt("/chat",{projectId:i,text:S});return b.ok?null:(await b.json().catch(()=>({}))).error??"could not reach the planner"},[i]),g=m.useCallback(async()=>{i&&await gt("/chat/stop",{projectId:i}).catch(()=>{})},[i]),y=m.useCallback(async()=>{i&&(await fetch(`/chat?projectId=${encodeURIComponent(i)}`,{method:"DELETE"}).catch(()=>{}),u({t:"reset"}))},[i]),x=m.useCallback(async(S,b)=>{if(!i)return"no project";const j=await gt("/chat/answer",{projectId:i,id:S,answers:b});return j.ok?null:(await j.json().catch(()=>({}))).error??"could not deliver the answer"},[i]),v=m.useCallback(()=>u({t:"dismiss"}),[]);return{...c,send:h,answer:x,clear:y,stop:g,dismissProposal:v}}function qm(){const[i,c]=m.useState(null),[u,o]=m.useState(!1),[d,h]=m.useState(""),g=m.useCallback(async()=>{const v=await fetch("/notify").catch(()=>null);v?.ok&&c(await v.json())},[]);m.useEffect(()=>{g()},[g]),m.useEffect(()=>{if(!i?.telegram.linking)return;const v=setInterval(()=>{g()},3e3);return()=>clearInterval(v)},[i?.telegram.linking,g]);const y=m.useCallback(async v=>{o(!0),h("");try{const S=await v();S.ok||h((await S.json().catch(()=>({}))).error??`HTTP ${S.status}`)}catch(S){h(S instanceof Error?S.message:String(S))}finally{o(!1),await g()}},[g]),x=(v,S,b)=>fetch(S,{method:v,headers:b?{"content-type":"application/json"}:void 0,body:b?JSON.stringify(b):void 0});return{status:i,busy:u,error:d,refresh:g,onSaveToken:v=>{y(()=>x("PUT","/notify/telegram/token",{token:v}))},onClearToken:()=>{y(()=>x("DELETE","/notify/telegram/token"))},onLink:()=>{y(()=>x("POST","/notify/telegram/link"))},onUnlink:()=>{y(()=>x("DELETE","/notify/telegram/link"))},onTest:()=>{y(()=>x("POST","/notify/test"))},onSavePublicUrl:v=>{y(()=>x("PATCH","/notify/settings",{publicUrl:v}))}}}function Lm(){const i=()=>{const h=window.location.hash.match(/^#\/p\/([^/]+)(?:\/r\/([^/]+)(?:\/(files|runs))?)?/);return{setup:/^#\/setup\b/.test(window.location.hash),projectId:h?decodeURIComponent(h[1]):null,runId:h?.[2]?decodeURIComponent(h[2]):null,tab:h?.[3]==="files"||h?.[3]==="runs"?h[3]:"mission"}},[c,u]=m.useState(i);m.useEffect(()=>{const h=()=>u(i());return window.addEventListener("hashchange",h),()=>window.removeEventListener("hashchange",h)},[]);const o=m.useCallback(h=>{window.location.hash=h?`#/p/${encodeURIComponent(h)}`:"#/"},[]),d=m.useCallback((h,g,y="mission")=>{window.location.hash=g?`#/p/${encodeURIComponent(h)}/r/${encodeURIComponent(g)}${y==="mission"?"":`/${y}`}`:`#/p/${encodeURIComponent(h)}`},[]);return{...c,go:o,goRun:d}}const gt=(i,c)=>fetch(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(c)}),_e={linkProject:(i,c,u)=>gt("/projects",{folder:i,name:c,provider:u}),cloneProject:(i,c)=>gt("/projects/clone",{url:i,branch:c}),cloneStatus:i=>fetch(`/projects/clone/${encodeURIComponent(i)}`),cloneWhere:i=>fetch(`/projects/clone/where?url=${encodeURIComponent(i)}`),prDraft:i=>fetch(`/runs/${encodeURIComponent(i)}/pr`),openPr:(i,c,u)=>gt(`/runs/${encodeURIComponent(i)}/pr`,{title:c,body:u}),prState:i=>fetch(`/runs/${encodeURIComponent(i)}/pr/state`),memory:i=>fetch(`/projects/${encodeURIComponent(i)}/memory`),instances:()=>fetch("/instances"),doctor:()=>fetch("/doctor"),setupDone:()=>gt("/setup/done",{}),installBrowser:()=>gt("/setup/browser",{}),browserInstall:i=>fetch(`/setup/browser/${encodeURIComponent(i)}`),updateProject:(i,c)=>fetch(`/projects/${encodeURIComponent(i)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(c)}),unlinkProject:i=>fetch(`/projects/${encodeURIComponent(i)}`,{method:"DELETE"}),run:(i,c,u,o={})=>gt("/run",{projectId:i,mission:c,budgetUsd:u,directorModel:o.directorModel||void 0,workerModel:o.workerModel||void 0,directorProviderId:o.directorProviderId||void 0,workerProviderId:o.workerProviderId||void 0,browserTools:o.browserTools||void 0}),resume:(i,c={})=>gt(`/runs/${encodeURIComponent(i)}/resume`,c),permission:(i,c,u)=>gt("/permission",{id:i,behavior:c,message:u}),answer:(i,c)=>gt("/answer",{id:i,text:c}),attach:async(i,c)=>{const u=await Promise.all(c.map(async o=>({name:o.name,type:o.type,data:await new Promise((d,h)=>{const g=new FileReader;g.onload=()=>d(String(g.result).split(",")[1]??""),g.onerror=()=>h(g.error),g.readAsDataURL(o)})})));return gt("/attachments",{projectId:i,files:u})},forkPlan:(i,c)=>gt("/chat/fork",{projectId:i,runId:c}),steer:(i,c)=>gt("/steer",{runId:i,text:c}),interrupt:i=>gt("/interrupt",{runId:i}),updateRun:(i,c)=>fetch("/run",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({runId:i,...c})}).then(async u=>{if(!u.ok)throw new Error((await u.json().catch(()=>({}))).error||`HTTP ${u.status}`);return u.json()}),setProviderKey:(i,c)=>fetch(`/providers/${encodeURIComponent(i)}/key`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({key:c})}),clearProviderKey:i=>fetch(`/providers/${encodeURIComponent(i)}/key`,{method:"DELETE"}),browse:i=>fetch("/browse"+(i?`?path=${encodeURIComponent(i)}`:"")),mkdir:(i,c)=>gt("/mkdir",{parent:i,name:c}),locate:i=>fetch(`/locate?name=${encodeURIComponent(i)}`)};async function Yp(i,c,u){if(!u.length)return c;const o=await _e.attach(i,u),d=await o.json().catch(()=>({}));if(!o.ok)throw new Error(d.error||"could not save the attachments");const h=(d.files??[]).map(g=>g.path);return`${c}
12
+ `)}]};case"run_titled":return{...i,title:String(o.title??"")};case"cost":return{...i,costUsd:o.costUsd,budgetUsd:o.budgetUsd,usage:o.usage??i.usage,costBasis:da(o)};case"message":{const d=o.agent==="director"&&o.msg?.session_id?{directorSessionId:o.msg.session_id}:{},h=Bp(o.agent,o.msg,u).map(g=>Em(g,i.entries));return h.length||d.directorSessionId?{...i,...d,entries:[...i.entries.slice(-1499),...h]}:i}case"steer":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"you",kind:"steer",title:"steer",body:o.text,to:o.to,timing:o.timing}]};case"usage_limit":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"error",title:"usage limit",body:o.text}]};case"models_changed":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"system",title:"models changed",body:o.text}]};case"memory_updated":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"system",title:"memory",body:String(o.text??"Project memory rewritten.")}]};case"pull_request":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:o.error?"error":"system",title:o.method==="gh"?"pull request":"branch pushed",body:String(o.text??"")}]};case"git_branch":case"git_note":case"git_committed":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:c.event==="git_committed"&&o.error||c.event==="git_note"?"error":"system",title:c.event==="git_branch"?`branch · ${String(o.branch??"")}`:c.event==="git_committed"?"branch closed":"git",body:String(o.text??"")}]};case"budget_alert":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:o.level==="exceeded"?"error":"system",title:"budget",body:o.text}]};case"service_exposed":return{...i,services:[...i.services.filter(d=>d.port!==o.port),{port:o.port,label:o.label,path:o.path,url:o.url,since:u}]};case"worker_started":{const d=i.agents.filter(g=>g.id!==o.id),h=i.agents.find(g=>g.id===o.id);return{...i,agents:[...d,{id:o.id,status:"running",task:o.task??h?.task}],entries:[...i.entries,{id:++$e,ts:u,agent:o.id,kind:"system",title:o.resumed?"resumed":"spawned",body:o.task??""}]}}case"worker_progress":{const d=String(o.status??""),h=[d,...Array.isArray(o.done)&&o.done.length?[`done: ${o.done.join(", ")}`]:[],...o.next?[`next: ${String(o.next)}`]:[],...o.blocked?[`BLOCKED: ${String(o.blocked)}`]:[]].join(`
13
+ `);return{...i,agents:i.agents.map(g=>g.id===o.id?{...g,task:d||g.task}:g),entries:[...i.entries,{id:++$e,ts:u,agent:String(o.id??"worker"),kind:"system",title:o.blocked?"progress · blocked":"progress",body:h}]}}case"worker_finished":return{...i,agents:i.agents.map(d=>d.id===o.id?{...d,status:o.status}:d)};case"permission_request":return i.approvals.some(d=>d.id===o.id)?i:{...i,approvals:[...i.approvals,{...o,since:u}],entries:[...i.entries,{id:++$e,ts:u,agent:String(o.agent??"director"),kind:"system",title:"waiting on you",body:`${String(o.toolName??"tool")}: ${String(o.description??o.decisionReason??o.title??"needs your approval")}`}]};case"permission_resolved":{const d=i.approvals.find(h=>h.id===o.id);return d?{...i,approvals:i.approvals.filter(h=>h.id!==o.id),entries:[...i.entries,{id:++$e,ts:u,agent:String(d.agent??"director"),kind:"system",title:"resolved",body:String(o.behavior??"resolved")}]}:i}case"question":return i.questions.some(d=>d.id===o.id)?i:{...i,questions:[...i.questions,{...o,since:u}],entries:[...i.entries,{id:++$e,ts:u,agent:"director",kind:"system",title:"waiting on you",body:`question: ${String(o.question??"")}`}]};case"question_answered":return i.questions.find(h=>h.id===o.id)?{...i,questions:i.questions.filter(h=>h.id!==o.id),entries:[...i.entries,{id:++$e,ts:u,agent:"director",kind:"system",title:"resolved",body:"answered"}]}:i;case"root_allowed":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:String(o.agent??"director"),kind:"system",title:"path allowed for run",body:String(o.path??"")}]};case"auto_denied":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:String(o.agent??"director"),kind:"system",title:"redirected to workspace",body:String(o.reason??"")}]};case"permission_timeout":case"question_timeout":{const d=c.event==="permission_timeout";if(!(d?i.approvals.find(y=>y.id===o.id):i.questions.find(y=>y.id===o.id)))return i;const g=Math.max(1,Math.round(Number(o.afterMs??0)/6e4));return{...i,approvals:d?i.approvals.filter(y=>y.id!==o.id):i.approvals,questions:d?i.questions:i.questions.filter(y=>y.id!==o.id),entries:[...i.entries,{id:++$e,ts:u,agent:String(o.agent??"director"),kind:"error",title:d?"auto-denied (unattended)":"auto-answered (unattended)",body:d?`${String(o.toolName??"tool")} waited ${g} min with no answer and was denied; the agent was told to redo the work inside .foreman/work/.`:`The director's question waited ${g} min with no answer; it was told to decide itself and record the decision in MISSION.md.`}]}}default:return i}}function Am(i,c){switch(c.t){case"reset":return Zc;case"wire":return _m(i,c.e);case"missiondoc":return{...i,missionDoc:c.doc}}}function Dm(i,c){const[u,o]=m.useReducer(Am,Zc),d=m.useRef(null);return m.useEffect(()=>{if(o({t:"reset"}),!i)return;let h=!1;d.current=[];const g=c?_i((v,S)=>{if(S.runId!==i)return;const x={event:v,data:S.data};d.current?d.current.push(x):o({t:"wire",e:x})}):null;(async()=>{try{const v=await fetch(`/runs/${encodeURIComponent(i)}/events`).catch(()=>null);if(h||!v?.ok)return;const{events:S}=await v.json();if(h)return;for(const x of S)o({t:"wire",e:x})}finally{if(!h){for(const v of d.current??[])o({t:"wire",e:v});d.current=null}}})();const y=async()=>{const v=await fetch(`/missiondoc?run=${encodeURIComponent(i)}`).catch(()=>null);v?.ok&&!h&&o({t:"missiondoc",doc:(await v.json()).doc})};y();const b=c?setInterval(y,5e3):null;return()=>{h=!0,g?.(),b&&clearInterval(b)}},[i,c]),u}function Rm(i,c){if(i==="message"){const u=c.msg;if(u?.type==="assistant")for(const o of u.message?.content??[]){if(o.type==="text"&&o.text?.trim())return`${c.agent}: ${o.text.trim()}`;if(o.type==="tool_use"){const d=String(o.name||"").replace(/^mcp__(foreman|playwright)__/,"");return`${c.agent} · ${d}`}}return null}return i==="worker_started"?`${c.id} ${c.resumed?"resumed":"spawned"}`:i==="worker_finished"?`${c.id} ${c.status}`:i==="worker_progress"?`${c.id}: ${c.blocked?`BLOCKED — ${c.blocked}`:c.status}`:i==="steer"?`you → ${c.to}: ${c.text}`:i==="budget_alert"?c.text:i==="question"?`director asks: ${c.question}`:null}function Om(){const[i,c]=m.useState([]),[u,o]=m.useState(!1),[d,h]=m.useState({mode:"none",source:""}),[g,y]=m.useState({}),[b,v]=m.useState(null),[S,x]=m.useState(""),[j,k]=m.useState(null),U=m.useCallback(async()=>{const Z=await fetch("/projects").catch(()=>null);if(!Z?.ok)return;const C=await Z.json();c(C.projects),h({mode:C.authMode??"none",source:C.authSource??"",account:C.authAccount??void 0}),v(C.update?.latest?{latest:String(C.update.latest),current:String(C.version??"")}:null),x(String(C.version??"")),k(!!C.firstRun)},[]);return m.useEffect(()=>{U();const Z=setInterval(U,3e3),C=_i((D,B)=>{if(!B.chat&&(["run_started","run_resumed","run_finished","permission_request","permission_resolved","permission_timeout","question","question_answered","question_timeout"].includes(D)&&U(),B.projectId))if(D==="run_finished")y(J=>{const{[B.projectId]:re,...q}=J;return q});else{const J=Rm(D,B.data);J&&y(re=>({...re,[B.projectId]:J.slice(0,160)}))}}),z=Mm(D=>{o(D),D&&U()});return()=>{clearInterval(Z),C(),z()}},[U]),{projects:i,connected:u,auth:d,refresh:U,activity:g,update:b,version:S,firstRun:j}}function Nm(i){const[c,u]=m.useState([]),o=m.useCallback(async()=>{const d=await fetch(`/runs?projectId=${encodeURIComponent(i)}`).catch(()=>null);d?.ok&&u((await d.json()).runs)},[i]);return m.useEffect(()=>(o(),_i((h,g)=>{g.projectId===i&&(h==="run_started"||h==="run_resumed"||h==="run_finished"||h==="git_committed"||h==="pull_request")&&o()})),[i,o]),c}const Gc={entries:[],costUsd:0,proposal:null,thinking:!1,question:null,who:null};function Hm(i,c){return i.map(u=>`${u.question.replace(/[?:]\s*$/,"")} → ${c[u.question]||"(no answer)"}`).join(`
14
+ `)}function qp(i,c){const u=c.ts??Date.now(),o=c.data;switch(c.event){case"chat_cleared":return Lp(i,{t:"reset"});case"chat_proposal_dismissed":return{...i,proposal:null};case"chat_message":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"you",kind:"steer",title:"you",body:o.text}]};case"message":{const d=Bp("foreman",o.msg,u).filter(h=>h.kind==="text"||h.kind==="tool"&&!/ask_user/.test(h.title));return d.length?{...i,entries:[...i.entries,...d]}:i}case"mission_proposed":return{...i,proposal:o};case"chat_cost":return{...i,costUsd:o.costUsd??i.costUsd};case"chat_turn":return{...i,thinking:o.state==="thinking",who:typeof o.model=="string"&&typeof o.provider=="string"?{model:o.model,provider:o.provider,costBasis:da(o)}:i.who};case"chat_question":return Array.isArray(o.questions)&&o.questions.length?{...i,question:{id:String(o.id),questions:o.questions,askedAt:u}}:i;case"chat_answered":{const d=i.question,h=d&&d.id===o.id?d.questions:[],g=h.length?Hm(h,o.answers??{}):Object.entries(o.answers??{}).map(([y,b])=>`${y} → ${b}`).join(`
15
+ `);return{...i,question:i.question?.id===o.id?null:i.question,entries:g?[...i.entries,{id:++$e,ts:u,agent:"you",kind:"steer",title:o.source?`you chose · via ${o.source}`:"you chose",body:g}]:i.entries}}case"chat_question_timeout":return{...i,question:i.question?.id===o.id?null:i.question,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"error",title:"no answer (unattended)",body:`No answer after ${Math.round((o.afterMs??0)/6e4)} minutes — the planner is proceeding on its recommended options and will state the assumptions.`}]};case"chat_error":return{...i,entries:[...i.entries,{id:++$e,ts:u,agent:"system",kind:"error",title:"planner",body:o.error}]};default:return i}}function Lp(i,c){switch(c.t){case"reset":return Gc;case"load":return c.view;case"dismiss":return{...i,proposal:null};case"wire":return qp(i,c.e)}}function Um(i){const[c,u]=m.useState([]),[o,d]=m.useState(!1);return m.useEffect(()=>{if(i.length<2){u([]),d(!1);return}let h=!1;d(!0);const g=setTimeout(()=>{fetch(`/search?q=${encodeURIComponent(i)}`).then(y=>y.ok?y.json():{runs:[]}).then(y=>{h||(u(y.runs??[]),d(!1))}).catch(()=>{h||(u([]),d(!1))})},200);return()=>{h=!0,clearTimeout(g)}},[i]),{hits:c,busy:o}}const Bm="_fleet";function $p(i){const[c,u]=m.useReducer(Lp,Gc),o=m.useRef(null),d=m.useCallback(async S=>{const x=await fetch(`/chat?projectId=${encodeURIComponent(S)}`).catch(()=>null);return x?.ok?await x.json():null},[]);m.useEffect(()=>{if(u({t:"reset"}),!i)return;let S=!1;o.current=[];const x=_i((j,k)=>{if(!k.chat||k.projectId!==i)return;const U={event:j,data:k.data};o.current?o.current.push(U):u({t:"wire",e:U})});return(async()=>{const j=await d(i);if(!S){if(j){let k={...Gc,costUsd:j.costUsd,proposal:j.proposal,thinking:j.thinking};for(const U of j.events)k=qp(k,U);k={...k,question:j.question??null,who:j.who??k.who,thinking:j.thinking},u({t:"load",view:k})}for(const k of o.current??[])u({t:"wire",e:k});o.current=null}})(),()=>{S=!0,x()}},[i,d]);const h=m.useCallback(async S=>{if(!i)return"no project";const x=await gt("/chat",{projectId:i,text:S});return x.ok?null:(await x.json().catch(()=>({}))).error??"could not reach the planner"},[i]),g=m.useCallback(async()=>{i&&await gt("/chat/stop",{projectId:i}).catch(()=>{})},[i]),y=m.useCallback(async()=>{i&&(await fetch(`/chat?projectId=${encodeURIComponent(i)}`,{method:"DELETE"}).catch(()=>{}),u({t:"reset"}))},[i]),b=m.useCallback(async(S,x)=>{if(!i)return"no project";const j=await gt("/chat/answer",{projectId:i,id:S,answers:x});return j.ok?null:(await j.json().catch(()=>({}))).error??"could not deliver the answer"},[i]),v=m.useCallback(()=>u({t:"dismiss"}),[]);return{...c,send:h,answer:b,clear:y,stop:g,dismissProposal:v}}function qm(){const[i,c]=m.useState(null),[u,o]=m.useState(!1),[d,h]=m.useState(""),g=m.useCallback(async()=>{const v=await fetch("/notify").catch(()=>null);v?.ok&&c(await v.json())},[]);m.useEffect(()=>{g()},[g]),m.useEffect(()=>{if(!i?.telegram.linking)return;const v=setInterval(()=>{g()},3e3);return()=>clearInterval(v)},[i?.telegram.linking,g]);const y=m.useCallback(async v=>{o(!0),h("");try{const S=await v();S.ok||h((await S.json().catch(()=>({}))).error??`HTTP ${S.status}`)}catch(S){h(S instanceof Error?S.message:String(S))}finally{o(!1),await g()}},[g]),b=(v,S,x)=>fetch(S,{method:v,headers:x?{"content-type":"application/json"}:void 0,body:x?JSON.stringify(x):void 0});return{status:i,busy:u,error:d,refresh:g,onSaveToken:v=>{y(()=>b("PUT","/notify/telegram/token",{token:v}))},onClearToken:()=>{y(()=>b("DELETE","/notify/telegram/token"))},onLink:()=>{y(()=>b("POST","/notify/telegram/link"))},onUnlink:()=>{y(()=>b("DELETE","/notify/telegram/link"))},onTest:()=>{y(()=>b("POST","/notify/test"))},onSavePublicUrl:v=>{y(()=>b("PATCH","/notify/settings",{publicUrl:v}))}}}function Lm(){const i=()=>{const h=window.location.hash.match(/^#\/p\/([^/]+)(?:\/r\/([^/]+)(?:\/(files|runs))?)?/);return{setup:/^#\/setup\b/.test(window.location.hash),projectId:h?decodeURIComponent(h[1]):null,runId:h?.[2]?decodeURIComponent(h[2]):null,tab:h?.[3]==="files"||h?.[3]==="runs"?h[3]:"mission"}},[c,u]=m.useState(i);m.useEffect(()=>{const h=()=>u(i());return window.addEventListener("hashchange",h),()=>window.removeEventListener("hashchange",h)},[]);const o=m.useCallback(h=>{window.location.hash=h?`#/p/${encodeURIComponent(h)}`:"#/"},[]),d=m.useCallback((h,g,y="mission")=>{window.location.hash=g?`#/p/${encodeURIComponent(h)}/r/${encodeURIComponent(g)}${y==="mission"?"":`/${y}`}`:`#/p/${encodeURIComponent(h)}`},[]);return{...c,go:o,goRun:d}}const gt=(i,c)=>fetch(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(c)}),_e={linkProject:(i,c,u)=>gt("/projects",{folder:i,name:c,provider:u}),cloneProject:(i,c)=>gt("/projects/clone",{url:i,branch:c}),cloneStatus:i=>fetch(`/projects/clone/${encodeURIComponent(i)}`),cloneWhere:i=>fetch(`/projects/clone/where?url=${encodeURIComponent(i)}`),prDraft:i=>fetch(`/runs/${encodeURIComponent(i)}/pr`),openPr:(i,c,u)=>gt(`/runs/${encodeURIComponent(i)}/pr`,{title:c,body:u}),prState:i=>fetch(`/runs/${encodeURIComponent(i)}/pr/state`),memory:i=>fetch(`/projects/${encodeURIComponent(i)}/memory`),instances:()=>fetch("/instances"),doctor:()=>fetch("/doctor"),setupDone:()=>gt("/setup/done",{}),installBrowser:()=>gt("/setup/browser",{}),browserInstall:i=>fetch(`/setup/browser/${encodeURIComponent(i)}`),updateProject:(i,c)=>fetch(`/projects/${encodeURIComponent(i)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(c)}),unlinkProject:i=>fetch(`/projects/${encodeURIComponent(i)}`,{method:"DELETE"}),run:(i,c,u,o={})=>gt("/run",{projectId:i,mission:c,budgetUsd:u,directorModel:o.directorModel||void 0,workerModel:o.workerModel||void 0,directorProviderId:o.directorProviderId||void 0,workerProviderId:o.workerProviderId||void 0,browserTools:o.browserTools||void 0}),resume:(i,c={})=>gt(`/runs/${encodeURIComponent(i)}/resume`,c),permission:(i,c,u)=>gt("/permission",{id:i,behavior:c,message:u}),answer:(i,c)=>gt("/answer",{id:i,text:c}),attach:async(i,c)=>{const u=await Promise.all(c.map(async o=>({name:o.name,type:o.type,data:await new Promise((d,h)=>{const g=new FileReader;g.onload=()=>d(String(g.result).split(",")[1]??""),g.onerror=()=>h(g.error),g.readAsDataURL(o)})})));return gt("/attachments",{projectId:i,files:u})},forkPlan:(i,c)=>gt("/chat/fork",{projectId:i,runId:c}),steer:(i,c)=>gt("/steer",{runId:i,text:c}),interrupt:i=>gt("/interrupt",{runId:i}),updateRun:(i,c)=>fetch("/run",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({runId:i,...c})}).then(async u=>{if(!u.ok)throw new Error((await u.json().catch(()=>({}))).error||`HTTP ${u.status}`);return u.json()}),setProviderKey:(i,c)=>fetch(`/providers/${encodeURIComponent(i)}/key`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({key:c})}),clearProviderKey:i=>fetch(`/providers/${encodeURIComponent(i)}/key`,{method:"DELETE"}),browse:i=>fetch("/browse"+(i?`?path=${encodeURIComponent(i)}`:"")),mkdir:(i,c)=>gt("/mkdir",{parent:i,name:c}),locate:i=>fetch(`/locate?name=${encodeURIComponent(i)}`)};async function Yp(i,c,u){if(!u.length)return c;const o=await _e.attach(i,u),d=await o.json().catch(()=>({}));if(!o.ok)throw new Error(d.error||"could not save the attachments");const h=(d.files??[]).map(g=>g.path);return`${c}
16
16
 
17
17
  Attached files (in the project folder — read them):
18
18
  ${h.map(g=>`- ${g}`).join(`
19
- `)}`}function Gp(i){const[c,u]=m.useState(null),o=m.useCallback(()=>{_e.installBrowser().then(async d=>{if(!d.ok){u({id:"",state:"error",progress:"",error:`HTTP ${d.status}`});return}const{id:h}=await d.json();u({id:h,state:"running",progress:"Starting…"})})},[]);return m.useEffect(()=>{if(!c||c.state!=="running"||!c.id)return;const d=setInterval(async()=>{const h=await _e.browserInstall(c.id).catch(()=>null);if(!h?.ok)return;const g=await h.json();u({id:c.id,...g}),g.state!=="running"&&(clearInterval(d),g.state==="done"&&i?.())},1e3);return()=>clearInterval(d)},[c?.id,c?.state]),{start:o,job:c?{state:c.state,progress:c.progress,error:c.error}:null}}const Xp=(...i)=>i.filter((c,u,o)=>!!c&&c.trim()!==""&&o.indexOf(c)===u).join(" ").trim();const $m=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ym=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(c,u,o)=>o?o.toUpperCase():u.toLowerCase());const tp=i=>{const c=Ym(i);return c.charAt(0).toUpperCase()+c.slice(1)};var Tc={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 Gm=i=>{for(const c in i)if(c.startsWith("aria-")||c==="role"||c==="title")return!0;return!1},Xm=m.createContext({}),Qm=()=>m.useContext(Xm),Vm=m.forwardRef(({color:i,size:c,strokeWidth:u,absoluteStrokeWidth:o,className:d="",children:h,iconNode:g,...y},x)=>{const{size:v=24,strokeWidth:S=2,absoluteStrokeWidth:b=!1,color:j="currentColor",className:k=""}=Qm()??{},B=o??b?Number(u??S)*24/Number(c??v):u??S;return m.createElement("svg",{ref:x,...Tc,width:c??v??Tc.width,height:c??v??Tc.height,stroke:i??j,strokeWidth:B,className:Xp("lucide",k,d),...!h&&!Gm(y)&&{"aria-hidden":"true"},...y},[...g.map(([K,M])=>m.createElement(K,M)),...Array.isArray(h)?h:[h]])});const de=(i,c)=>{const u=m.forwardRef(({className:o,...d},h)=>m.createElement(Vm,{ref:h,iconNode:c,className:Xp(`lucide-${$m(tp(i))}`,`lucide-${i}`,o),...d}));return u.displayName=tp(i),u};const Wm=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Km=de("activity",Wm);const Zm=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Fm=de("arrow-left",Zm);const Jm=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Im=de("arrow-up-down",Jm);const Pm=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ey=de("bell",Pm);const ty=[["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"}]],ny=de("bot",ty);const ly=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],ay=de("braces",ly);const iy=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],sy=de("bug",iy);const ry=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],oy=de("check",ry);const cy=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],uy=de("chevron-down",cy);const dy=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],fy=de("chevron-left",dy);const hy=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],py=de("chevron-right",hy);const vy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],gy=de("circle",vy);const my=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],yy=de("clock",my);const xy=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],by=de("code",xy);const jy=[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]],Sy=de("coins",jy);const ky=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],wy=de("corner-down-left",ky);const zy=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],Ty=de("corner-left-up",zy);const Cy=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],My=de("cpu",Cy);const Ey=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],_y=de("eye",Ey);const Ay=[["path",{d:"M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z",key:"ukzhwg"}],["path",{d:"M14.487 7.858A1 1 0 0 1 14 7V2",key:"1klhew"}],["path",{d:"M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516",key:"rxaxab"}],["path",{d:"M8 18h1",key:"13wk12"}]],Dy=de("file-pen-line",Ay);const Ry=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],Oy=de("file-pen",Ry);const Ny=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Hy=de("file-text",Ny);const Uy=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],By=de("file",Uy);const qy=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Ly=de("folder-open",qy);const $y=[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]],Yy=de("folder-search",$y);const Gy=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Xy=de("folder",Gy);const Qy=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Vy=de("funnel",Qy);const Wy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Ky=de("globe",Wy);const Zy=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Fy=de("image",Zy);const Jy=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],Iy=de("layout-template",Jy);const Py=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],ex=de("list-checks",Py);const tx=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M9 19H3",key:"s61nz1"}],["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M21 5v12a2 2 0 0 1-2 2h-6",key:"hey24a"}]],nx=de("list-end",tx);const lx=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ax=de("loader-circle",lx);const ix=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],sx=de("message-circle-question-mark",ix);const rx=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],ox=de("message-square-plus",rx);const cx=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],ux=de("message-square",cx);const dx=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],fx=de("moon",dx);const hx=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],px=de("octagon-alert",hx);const vx=[["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"}]],gx=de("paperclip",vx);const mx=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],yx=de("pause",mx);const xx=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],bx=de("pen-line",xx);const jx=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Sx=de("plus",jx);const kx=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],wx=de("power",kx);const zx=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],Tx=de("quote",zx);const Cx=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Mx=de("rotate-ccw-clock",Cx);const Ex=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],_x=de("rotate-cw",Ex);const Ax=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Dx=de("save",Ax);const Rx=[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Ox=de("search-check",Rx);const Nx=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Hx=de("search",Nx);const Ux=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],Bx=de("send-horizontal",Ux);const qx=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Lx=de("server",qx);const $x=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Yx=de("settings",$x);const Gx=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Xx=de("shield-check",Gx);const Qx=[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]],Vx=de("shuffle",Qx);const Wx=[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],Kx=de("square-code",Wx);const Zx=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Fx=de("sun",Zx);const Jx=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ix=de("terminal",Jx);const Px=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],e0=de("text-align-start",Px);const t0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],n0=de("triangle-alert",t0);const l0=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],a0=de("unlink",l0);const i0=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],s0=de("user-plus",i0);const r0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],o0=de("user",r0);const c0=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],u0=de("users",c0);const d0=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],f0=de("wifi-off",d0);const h0=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],p0=de("wrench",h0);const v0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],g0=de("x",v0);const m0=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]],y0=de("zap",m0),np={Circle:gy,Activity:Km,Check:oy,X:g0,Pause:yx,WifiOff:f0,History:Mx,TriangleAlert:n0,OctagonAlert:px,RotateCw:_x,Bot:ny,Plus:Sx,CornerLeftUp:Ty,ArrowLeft:Fm,Folder:Xy,Bell:ey,Unlink:a0,Sun:Fx,Moon:fx,Clock:yy,AlignLeft:e0,Users:u0,ChevronDown:uy,ChevronRight:py,ChevronLeft:fy,Braces:ay,MessageCircleQuestion:sx,ShieldCheck:Xx,Coins:Sy,LayoutTemplate:Iy,Save:Dx,Filter:Vy,Settings:Yx,Paperclip:gx,File:By,Image:Fy,Code:by,SquareCode:Kx,Quote:Tx,PenLine:bx,Eye:_y,Cpu:My,LoaderCircle:ax,MessageSquarePlus:ox,SendHorizontal:Bx,User:o0,Zap:y0,ListEnd:nx,FilePen:Oy,FilePenLine:Dy,FileText:Hy,Terminal:Ix,Search:Hx,FolderSearch:Yy,FolderOpen:Ly,Globe:Ky,ListChecks:ex,UserPlus:s0,MessageSquare:ux,CornerDownLeft:wy,Power:wx,Wrench:p0,Bug:sy,Shuffle:Vx,SearchCheck:Ox,ArrowUpDown:Im,Server:Lx},lp={idle:"Circle",running:"Activity",done:"Check",error:"X",interrupted:"Pause",disconnected:"WifiOff",readonly:"History",warning:"TriangleAlert",critical:"OctagonAlert",caution:"TriangleAlert",resume:"RotateCw",orchestration:"Bot",add:"Plus",parent:"CornerLeftUp",back:"ArrowLeft",folder:"Folder",needsYou:"Bell",unlink:"Unlink",sun:"Sun",moon:"Moon",provider:"Server",search:"Search",sort:"ArrowUpDown",timeline:"Clock",transcript:"AlignLeft",crew:"Users",chevronDown:"ChevronDown",chevronRight:"ChevronRight",chevronLeft:"ChevronLeft",raw:"Braces",question:"MessageCircleQuestion",approval:"ShieldCheck",check:"Check",close:"X",budget:"Coins",template:"LayoutTemplate",draft:"Save",filter:"Filter",settings:"Settings",attach:"Paperclip",file:"File",image:"Image",code:"Code",codeBlock:"SquareCode",quote:"Quote",write:"PenLine",preview:"Eye",model:"Cpu",loading:"LoaderCircle",steer:"MessageSquarePlus",send:"SendHorizontal",you:"User",now:"Zap",nextTurn:"ListEnd",Write:"FilePen",Edit:"FilePenLine",MultiEdit:"FilePenLine",Read:"FileText",Bash:"Terminal",Grep:"Search",Glob:"FolderSearch",LS:"FolderOpen",WebFetch:"Globe",WebSearch:"Globe",Task:"ListChecks",TodoWrite:"ListChecks",spawn_worker:"UserPlus",message_worker:"MessageSquare",ask_human:"MessageCircleQuestion",result:"CornerDownLeft",init:"Power",tool:"Wrench",Bug:"Bug",Shuffle:"Shuffle",SearchCheck:"SearchCheck"};function ie({name:i,size:c=16,strokeWidth:u=1.75,color:o,label:d,style:h}){const g=lp[i]||i,y=np[g]||np[lp.tool];return a.jsx(y,{width:c,height:c,strokeWidth:u,color:o||"currentColor","aria-hidden":d?void 0:!0,"aria-label":d,role:d?"img":void 0,style:{flex:"0 0 auto",display:"block",...h}})}const ap={idle:{color:"var(--ink-2)",icon:"idle",label:"idle"},running:{color:"var(--status-good)",icon:"running",label:"running"},done:{color:"var(--status-good)",icon:"done",label:"done"},error:{color:"var(--status-critical)",icon:"error",label:"error"},interrupted:{color:"var(--status-serious)",icon:"interrupted",label:"interrupted"},"needs-you":{color:"var(--status-warning)",icon:"needsYou",label:"needs you"}};function fl({status:i,style:c}){const u=ap[i]??ap.idle;return a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:"var(--fs-sm)",color:"var(--ink-1)",padding:"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:"var(--bg-inset)",border:"1px solid var(--line)",whiteSpace:"nowrap",lineHeight:"16px",...c},children:[a.jsx(ie,{name:u.icon,size:12,strokeWidth:2.25,color:u.color}),u.label]})}function x0({value:i,onChange:c,groups:u=[],placeholder:o="Search projects and runs…",busy:d=!1,style:h}){const g=m.useRef(null),[y,x]=m.useState(!1),[v,S]=m.useState(0),b=i.trim().length>0,j=u.flatMap(z=>z.items),k=y&&b&&(j.length>0||!d);m.useEffect(()=>{const z=D=>{const U=document.activeElement,F=U&&(U.tagName==="INPUT"||U.tagName==="TEXTAREA"||U.isContentEditable),re=D.key==="/"&&!F&&!D.metaKey&&!D.ctrlKey&&!D.altKey,q=D.key.toLowerCase()==="k"&&(D.metaKey||D.ctrlKey)&&!D.altKey;(re||q)&&(D.preventDefault(),g.current?.focus(),g.current?.select())};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[]),m.useEffect(()=>{S(0)},[i,j.length]);const B=z=>{z.onPick?.(),c?.(""),g.current?.blur()},K=z=>{if(z.key==="Escape"){i?c?.(""):z.currentTarget.blur();return}!k||!j.length||(z.key==="ArrowDown"?(z.preventDefault(),S(D=>(D+1)%j.length)):z.key==="ArrowUp"?(z.preventDefault(),S(D=>(D-1+j.length)%j.length)):z.key==="Enter"&&(z.preventDefault(),B(j[v]??j[0])))};let M=-1;return a.jsxs("div",{style:{position:"relative",flex:"0 1 26rem",minWidth:"12rem",...h},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",background:"var(--bg-card)",borderRadius:"var(--r-sm)",border:`1px solid ${y?"var(--brand)":"var(--line)"}`,padding:"4px var(--sp-2)",transition:"border-color var(--dur-fast) var(--ease)"},children:[a.jsx(ie,{name:"search",size:14,color:"var(--ink-2)"}),a.jsx("input",{ref:g,value:i,type:"text",placeholder:o,"aria-label":"Search projects, runs and actions",role:"combobox","aria-expanded":k,onChange:z=>c?.(z.target.value),onFocus:()=>x(!0),onBlur:()=>setTimeout(()=>x(!1),120),onKeyDown:K,style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--ink-0)",font:"inherit",fontSize:"var(--fs-sm)",padding:0,boxShadow:"none"}}),b?a.jsx("button",{type:"button",onClick:()=>{c?.(""),g.current?.focus()},title:"Clear (Esc)","aria-label":"Clear search",style:{display:"inline-flex",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--ink-2)"},children:a.jsx(ie,{name:"close",size:13})}):a.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",border:"1px solid var(--line)",borderRadius:3,padding:"0 4px",lineHeight:"15px",whiteSpace:"nowrap"},children:"⌘K"})]}),k&&a.jsxs("div",{role:"listbox",style:{position:"absolute",top:"calc(100% + 6px)",left:0,width:"max(100%, 34rem)",maxWidth:"calc(100vw - 2rem)",maxHeight:"60vh",overflowY:"auto",zIndex:30,background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",boxShadow:"0 12px 32px rgba(0,0,0,.35)",padding:"var(--sp-1) 0"},children:[j.length===0&&a.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)",fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:["Nothing matches “",i.trim(),"”."]}),u.filter(z=>z.items.length).map(z=>a.jsxs("div",{children:[a.jsxs("div",{style:{padding:"6px var(--sp-3) 2px",fontSize:"var(--fs-xs)",color:"var(--ink-2)",letterSpacing:".06em",textTransform:"uppercase"},children:[z.label,z.count!==void 0?` · ${z.count}`:""]}),z.items.map(D=>{M+=1;const U=M,F=U===v;return a.jsxs("button",{type:"button",role:"option","aria-selected":F,onMouseDown:re=>re.preventDefault(),onMouseEnter:()=>S(U),onClick:()=>B(D),style:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr) auto",alignItems:"center",gap:"var(--sp-2)",width:"100%",textAlign:"left",padding:"6px var(--sp-3)",border:"none",font:"inherit",background:F?"var(--bg-hover)":"transparent",color:"var(--ink-0)",cursor:"pointer"},children:[a.jsx(ie,{name:D.icon??"folder",size:14,color:"var(--ink-2)"}),a.jsxs("span",{style:{minWidth:0,display:"flex",flexDirection:"column"},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--fs-sm)"},children:D.title}),D.detail&&a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:D.detail})]}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:[D.status&&a.jsx(fl,{status:D.status}),D.meta]})]},D.id)})]},z.label))]})]})}const ip={"api-key":{color:"var(--status-warning)",icon:"budget",label:"API key billing",hint:"Missions bill a metered API key, not a Claude subscription. Usage is charged per token."},subscription:{color:"var(--ink-2)",icon:"budget",label:"subscription",hint:"Missions run on the signed-in Claude subscription."},cloud:{color:"var(--ink-2)",icon:"budget",label:"cloud provider",hint:"Missions bill a cloud provider (Bedrock/Vertex)."},local:{color:"var(--ink-2)",icon:"model",label:"local model",hint:"Missions run on a model served from this machine. No per-token cost, so budgets are capped by turns and time."},provider:{color:"var(--status-warning)",icon:"budget",label:"external provider",hint:"Missions bill an endpoint Foreman does not price. Spend is real but its dollar figure is not shown."},none:{color:"var(--status-critical)",icon:"error",label:"no credentials",hint:"No credentials found — missions cannot run."}};function Qp({mode:i,source:c,account:u,compact:o,style:d}){const h=ip[i]??ip.none,g=u?.email,y=h.label,x=[h.hint,g&&u.org?`Account: ${g} (${u.org})`:g&&`Account: ${g}`,c&&`Source: ${c}`].filter(Boolean).join(`
20
- `),v=i==="api-key"||i==="none"||i==="provider";return a.jsxs("span",{title:x,style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:o?"var(--fs-xs)":"var(--fs-sm)",color:"var(--ink-1)",padding:o?"1px 6px 1px 5px":"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:"var(--bg-inset)",border:`1px solid ${v?h.color:"var(--line)"}`,whiteSpace:"nowrap",lineHeight:"16px",...d},children:[a.jsx(ie,{name:h.icon,size:12,strokeWidth:2.25,color:h.color}),o?y:`billing: ${y}`]})}function Ti({children:i,title:c,onClick:u,tone:o}){const d=o==="warn"?"var(--status-warning)":o==="bad"?"var(--status-error)":"var(--ink-2)",h=a.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:d,whiteSpace:"nowrap",minWidth:0},children:i});return u?a.jsx("button",{type:"button",onClick:u,title:c,style:{background:"none",border:0,padding:"0 2px",margin:"0 -2px",font:"inherit",cursor:"pointer",display:"inline-flex",minWidth:0,borderRadius:3},children:h}):a.jsx("span",{title:c,style:{display:"inline-flex",minWidth:0},children:h})}const b0=({color:i})=>a.jsx("span",{"aria-hidden":!0,style:{width:7,height:7,borderRadius:"50%",background:i,flex:"0 0 auto"}}),Is=()=>a.jsx("span",{"aria-hidden":!0,style:{width:1,height:12,background:"var(--line)",margin:"0 var(--sp-2)",flex:"0 0 auto"}}),Ps=i=>String(i??"").replace(/^https?:\/\//,"").replace(/\/+$/,"");function j0({connected:i,localUrl:c,publicUrl:u,phone:o,auth:d,version:h,update:g,onOpenSettings:y,style:x}){const v=typeof u=="string"&&u.startsWith("https://"),S=u&&Ps(u)!==Ps(c)?u:null;return a.jsxs("footer",{style:{display:"flex",alignItems:"center",gap:0,flex:"0 0 auto",minHeight:24,padding:"2px var(--sp-4)",background:"var(--bg-panel)",borderTop:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",overflow:"hidden",...x},children:[a.jsxs(Ti,{title:i?"Live: this tab follows the server’s event stream":"Disconnected: the tab lost the server’s event stream and is reconnecting",tone:i?void 0:"bad",children:[a.jsx(b0,{color:i?"var(--status-success)":"var(--status-error)"}),i?"connected":"disconnected"]}),a.jsx(Is,{}),a.jsxs(Ti,{title:`Serving on ${c}${S?` and, on your tailnet, ${S}${v?" (HTTPS via tailscale serve)":" (plain HTTP — foreman doctor shows the one command for HTTPS)"}`:""}`,children:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis"},children:Ps(c)}),S&&a.jsxs(a.Fragment,{children:[a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsx(ie,{name:v?"approval":"provider",size:12,color:v?"var(--status-success)":"var(--ink-2)"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis"},children:Ps(S)})]})]}),o!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx(Is,{}),a.jsxs(Ti,{onClick:()=>y?.("notifications"),title:o?`Telegram linked to ${o}. Approvals, questions and the front desk reach that chat. Click for Notifications.`:"No phone linked. Settings → Notifications links a Telegram chat: approvals, questions and the front desk on the move.",children:[a.jsx(ie,{name:"needsYou",size:12}),o?`phone ${o}`:"no phone linked"]})]}),a.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",minWidth:0},children:[d&&a.jsxs(a.Fragment,{children:[a.jsx(Ti,{onClick:()=>y?.("provider"),title:"Who pays for missions by default. Click for Provider.",children:a.jsx(Qp,{mode:d.mode,source:d.source,account:d.account,compact:!0})}),a.jsx(Is,{})]}),g&&a.jsxs(a.Fragment,{children:[a.jsxs(Ti,{tone:"warn",title:`You run ${g.current}; ${g.latest} is on npm. In a terminal: foreman update — it refuses while a mission is live.`,children:[g.latest," available · ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"foreman update"})]}),a.jsx(Is,{})]}),h&&a.jsxs("a",{href:"https://github.com/amenophis1er/foreman/releases",target:"_blank",rel:"noopener noreferrer",title:`Foreman ${h} — release notes`,style:{fontFamily:"var(--font-mono)",color:"var(--ink-2)",textDecoration:"none",whiteSpace:"nowrap"},children:["v",h]})]})]})}const S0=/\.(png|jpe?g|gif|webp|svg|heic)$/i,k0=/\.(js|jsx|ts|tsx|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|css|html|json|ya?ml|toml|sh|sql|md)$/i;function w0(i){return i==null?"":i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(i<10240?1:0)} KB`:`${(i/1048576).toFixed(1)} MB`}function Vp({name:i,size:c,onRemove:u,style:o}){const[d,h]=m.useState(!1),g=S0.test(i)?"image":k0.test(i)?"code":"file";return a.jsxs("span",{onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{display:"inline-flex",alignItems:"center",gap:6,maxWidth:260,height:24,padding:"0 4px 0 8px",background:"var(--bg-inset)",border:`1px solid ${d?"var(--line-strong)":"var(--line)"}`,borderRadius:"var(--r-sm)",fontSize:"var(--fs-sm)",color:"var(--ink-0)",...o},children:[a.jsx(ie,{name:g,size:13,color:"var(--ink-2)"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),c!=null&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap"},children:w0(c)}),u&&a.jsx("button",{type:"button",onClick:u,"aria-label":`Remove ${i}`,style:{display:"inline-flex",width:18,height:18,alignItems:"center",justifyContent:"center",background:"none",border:"none",borderRadius:3,padding:0,cursor:"pointer",color:"var(--ink-2)"},children:a.jsx(ie,{name:"close",size:12})})]})}const z0={default:{background:"var(--bg-card)",border:"1px solid var(--line-strong)",color:"var(--ink-0)"},primary:{background:"var(--brand)",border:"1px solid var(--brand)",color:"var(--brand-ink)",fontWeight:"var(--fw-semibold)"},good:{background:"transparent",border:"1px solid var(--status-good)",color:"var(--ink-0)"},danger:{background:"transparent",border:"1px solid var(--status-critical)",color:"var(--ink-0)"},ghost:{background:"none",border:"1px solid transparent",color:"var(--ink-1)"}},T0={default:{borderColor:"var(--ink-2)"},primary:{filter:"brightness(1.08)"},good:{background:"color-mix(in srgb, var(--status-good) 14%, transparent)"},danger:{background:"color-mix(in srgb, var(--status-critical) 14%, transparent)"},ghost:{color:"var(--ink-0)",background:"var(--bg-hover)"}},C0={default:{background:"var(--bg-inset)"},primary:{filter:"brightness(0.94)"},good:{background:"color-mix(in srgb, var(--status-good) 22%, transparent)"},danger:{background:"color-mix(in srgb, var(--status-critical) 22%, transparent)"},ghost:{background:"var(--bg-inset)"}},sp={sm:{padding:"3px 8px",fontSize:"var(--fs-sm)",gap:5,icon:13},md:{padding:"6px 12px",fontSize:"var(--fs-md)",gap:6,icon:15}};function se({children:i,onClick:c,variant:u="default",size:o="md",icon:d,disabled:h,title:g,type:y="button",style:x}){const[v,S]=m.useState(!1),[b,j]=m.useState(!1),k=sp[o]||sp.md;return a.jsxs("button",{type:y,title:g,disabled:h,onClick:c,onMouseEnter:()=>S(!0),onMouseLeave:()=>{S(!1),j(!1)},onMouseDown:()=>j(!0),onMouseUp:()=>j(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:k.gap,padding:k.padding,borderRadius:"var(--r-sm)",fontSize:k.fontSize,lineHeight:"var(--lh)",whiteSpace:"nowrap",cursor:h?"default":"pointer",transition:"background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease)",...z0[u],...h?{opacity:.5}:v?T0[u]:null,...!h&&b?C0[u]:null,...x},children:[d&&a.jsx(ie,{name:d,size:k.icon}),i]})}const Cc=i=>`${i.name}:${i.size}`,Fc=22,rp=Fc*3,op=Fc*10;function Xc({value:i,onChange:c,onSend:u,onStop:o,busy:d,disabled:h,disabledReason:g,placeholder:y,who:x,onChangeModel:v,autoFocus:S,style:b,hint:j,busyHint:k,attach:B=!0}){const[K,M]=m.useState(""),[z,D]=m.useState(!1),[U,F]=m.useState([]),[re,q]=m.useState(!1),N=m.useRef(null),Y=m.useRef(null),G=oe=>{if(!B)return;const ne=Array.from(oe||[]);ne.length&&F(E=>{const $=new Set(E.map(Cc));return[...E,...ne.filter(P=>!$.has(Cc(P)))]})},fe=i??K,Q=c??M,J=!h&&!d&&(fe.trim().length>0||U.length>0);m.useEffect(()=>{const oe=N.current;oe&&(oe.style.height="auto",oe.style.height=Math.max(rp,Math.min(oe.scrollHeight,op))+"px")},[fe]);const ge=()=>{J&&(u?.(fe.trim()||(U.length?"See the attached files.":""),U),Q(""),F([]))};return a.jsxs("div",{style:{flex:"0 0 auto",background:re?"var(--brand-wash)":"var(--bg-card)",border:`1px solid ${z||re?"var(--brand)":"var(--line-strong)"}`,borderRadius:"var(--r-md)",padding:"var(--sp-2) var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",opacity:h?.6:1,transition:"border-color var(--dur-fast) var(--ease)",...b},onDragOver:oe=>{h||(oe.preventDefault(),q(!0))},onDragLeave:oe=>{oe.target===oe.currentTarget&&q(!1)},onDrop:oe=>{oe.preventDefault(),q(!1),h||G(oe.dataTransfer.files)},children:[a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"flex-start"},children:[a.jsx("span",{className:d?"pulse":void 0,style:{marginTop:3,flex:"0 0 auto",display:"inline-flex"},children:a.jsx(ie,{name:d?"loading":"steer",size:15,color:"var(--brand)"})}),a.jsx("textarea",{ref:N,rows:3,value:fe,disabled:h,autoFocus:S,placeholder:h?g||"Not available right now.":y||"Ask, think out loud, or describe what you want built…",onChange:oe=>Q(oe.target.value),onPaste:oe=>{oe.clipboardData?.files?.length&&(oe.preventDefault(),G(oe.clipboardData.files))},onFocus:()=>D(!0),onBlur:()=>D(!1),onKeyDown:oe=>{(oe.metaKey||oe.ctrlKey)&&oe.key==="Enter"&&(oe.preventDefault(),ge())},style:{flex:1,minWidth:0,resize:"none",border:"none",outline:"none",boxShadow:"none",background:"transparent",borderRadius:"var(--r-sm)",color:"var(--ink-0)",font:"inherit",lineHeight:`${Fc}px`,padding:"2px 0",minHeight:rp,maxHeight:op}})]}),U.length>0&&a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:U.map((oe,ne)=>a.jsx(Vp,{name:oe.name,size:oe.size,onRemove:()=>F(E=>E.filter(($,P)=>P!==ne))},Cc(oe)))}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:x?`${x.model} via ${x.provider}`:void 0,children:[x&&a.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},role:v?"button":void 0,onClick:v,title:v?"Change the planner model in Settings → Models":void 0,...v?{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)",cursor:"pointer",textDecoration:"underline dotted",textUnderlineOffset:3}}:{},children:[x.model," · ",x.provider.split(" · ")[0],x.costBasis==="free"?" · free":x.costBasis==="unpriced"?" · unpriced":""," — "]}),d?k??"The foreman is looking…":j??"Reads the project, never changes it."]}),a.jsx("span",{style:{marginLeft:"auto"}}),B&&a.jsx("input",{ref:Y,type:"file",multiple:!0,style:{display:"none"},onChange:oe=>{G(oe.target.files),oe.target.value=""}}),B&&a.jsx(se,{size:"sm",variant:"ghost",icon:"attach",disabled:h,title:"Attach files — or drop them here, or paste an image",onClick:()=>Y.current?.click(),children:"Attach"}),d&&o?a.jsx(se,{size:"sm",variant:"danger",icon:"close",onClick:o,title:"Stop the planner and discard the rest of this reply",children:"Stop"}):a.jsx(se,{size:"sm",icon:"send",onClick:ge,disabled:!J,title:"⌘↵",children:"Send"})]})]})}function Jc({children:i,accent:c,tone:u="card",style:o,onClick:d,title:h}){const g=u==="panel"?"var(--bg-panel)":u==="inset"?"var(--bg-inset)":"var(--bg-card)";return a.jsx("div",{onClick:d,title:h,role:d?"button":void 0,style:{background:g,border:"1px solid var(--line)",borderLeft:c?`var(--accent-w) solid ${c}`:"1px solid var(--line)",borderRadius:"var(--r-sm)",padding:"var(--sp-3)",cursor:d?"pointer":void 0,...o},children:i})}function sr(i){if(i==="director")return"var(--brand)";if(i==="you")return"var(--ink-0)";const c=/(\d+)/.exec(String(i||""));return`var(--agent-worker-${c?(parseInt(c[1],10)-1)%6+1:1})`}function fn({agent:i,size:c="md",style:u}){const o=c==="sm"?"var(--dot-sm)":"var(--dot)";return a.jsx("span",{"aria-hidden":!0,style:{width:o,height:o,borderRadius:"var(--r-pill)",background:sr(i),flex:"0 0 auto",...u}})}function Wp(i){if(i==null)return null;if(typeof i=="object")return i;try{return JSON.parse(i)}catch{return null}}function cp(i){if(!i)return"";const c=String(i).split("/");return c.length>3?"…/"+c.slice(-3).join("/"):i}function Kp(i,c){if(!c)return"";switch(i){case"Write":case"Edit":case"MultiEdit":case"Read":return cp(c.file_path||c.path);case"Bash":return c.command||"";case"Grep":return`${c.pattern??""}${c.path?" in "+cp(c.path):""}`;case"Glob":return c.pattern||"";case"WebFetch":case"WebSearch":return c.url||c.query||"";case"spawn_worker":return`${c.id??"worker"} — ${(c.task||"").slice(0,80)}`;case"message_worker":return`${c.id??"worker"} — ${(c.message||"").slice(0,80)}`;case"ask_human":return c.question||"";default:{const u=Object.keys(c)[0];return u?`${u}: ${String(c[u]).slice(0,80)}`:""}}}function Mc({text:i,tone:c,max:u=12}){const o=String(i??"").split(`
21
- `),d=o.slice(0,u),h=c==="add"?"var(--diff-add-bg)":c==="del"?"var(--diff-del-bg)":"transparent",g=c==="add"?"+":c==="del"?"−":" ";return a.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",lineHeight:1.5},children:[d.map((y,x)=>a.jsxs("div",{style:{display:"flex",background:h,padding:"0 8px"},children:[a.jsx("span",{style:{width:14,flex:"0 0 auto",color:c==="add"?"var(--status-good)":c==="del"?"var(--status-critical)":"var(--ink-2)"},children:g}),a.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--ink-0)"},children:y})]},x)),o.length>u&&a.jsxs("div",{style:{padding:"2px 8px",color:"var(--ink-2)"},children:["… ",o.length-u," more lines"]})]})}function M0({tool:i,input:c}){if(!c)return null;if(i==="Write")return a.jsx(Mc,{text:c.content,tone:"add"});const u=i==="MultiEdit"?c.edits||[]:[c];return a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:u.map((o,d)=>a.jsxs("div",{children:[a.jsx(Mc,{text:o.old_string,tone:"del",max:8}),a.jsx(Mc,{text:o.new_string,tone:"add",max:8})]},d))})}const E0=new Set(["spawn_worker","message_worker","ask_human"]);function Zp({tool:i="tool",input:c,body:u,defaultOpen:o=!1,style:d}){const h=c??Wp(u),[g,y]=m.useState(o),[x,v]=m.useState(!1),S=E0.has(i),b=h&&(i==="Write"||i==="Edit"||i==="MultiEdit"),j=Kp(i,h)||(typeof u=="string"?u.slice(0,120):"");return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,...d},children:[a.jsxs("button",{type:"button",onClick:()=>y(!g),title:g?"Collapse":"Expand",style:{display:"flex",alignItems:"center",gap:8,padding:0,background:"none",border:"none",cursor:"pointer",color:"var(--ink-0)",textAlign:"left",width:"100%",font:"inherit"},children:[a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,padding:"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:S?"var(--brand-wash-strong)":"var(--bg-inset)",border:`1px solid ${S?"var(--brand)":"var(--line)"}`,color:S?"var(--brand)":"var(--ink-1)",fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap",lineHeight:"16px"},children:[a.jsx(ie,{name:i,size:12,strokeWidth:2}),i]}),a.jsx("span",{style:{flex:1,minWidth:0,fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",color:"var(--ink-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:j}),a.jsx(ie,{name:g?"chevronDown":"chevronRight",size:14,color:"var(--ink-2)"})]}),g&&a.jsxs("div",{style:{background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",overflow:"hidden"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 8px",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsx("span",{children:b&&!x?"changes":"payload"}),a.jsx("span",{style:{flex:1}}),b&&a.jsxs("button",{type:"button",onClick:()=>v(!x),style:{display:"inline-flex",alignItems:"center",gap:4,background:"none",border:"none",color:"var(--ink-2)",cursor:"pointer",font:"inherit",padding:0},children:[a.jsx(ie,{name:"raw",size:12}),x?"diff":"raw"]})]}),a.jsx("div",{style:{padding:"6px 0",maxHeight:260,overflow:"auto"},children:b&&!x?a.jsx(M0,{tool:i,input:h}):a.jsx("pre",{style:{margin:0,padding:"0 8px",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--ink-0)"},children:h?JSON.stringify(h,null,2):String(u??"")})})]})]})}const _0=/(`[^`\n]+`|\*\*[^*\n]+\*\*|<[^<>\n]{1,80}>)/g;function er(i,c){return i.split(_0).filter(Boolean).map((u,o)=>u.startsWith("`")&&u.endsWith("`")&&u.length>2?a.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:"0.92em",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:4,padding:"0 5px"},children:u.slice(1,-1)},o):u.startsWith("**")&&u.endsWith("**")&&u.length>4?a.jsx("strong",{style:{fontWeight:"var(--fw-semibold)",color:"var(--ink-0)"},children:u.slice(2,-2)},o):c&&u.startsWith("<")&&u.endsWith(">")?a.jsx("span",{style:{background:"var(--brand-wash-strong)",border:"1px dashed var(--brand)",borderRadius:4,padding:"0 5px",color:"var(--ink-0)"},children:u.slice(1,-1)},o):u)}function A0(i){const c=String(i||"").replace(/\r\n?/g,`
19
+ `)}`}function Gp(i){const[c,u]=m.useState(null),o=m.useCallback(()=>{_e.installBrowser().then(async d=>{if(!d.ok){u({id:"",state:"error",progress:"",error:`HTTP ${d.status}`});return}const{id:h}=await d.json();u({id:h,state:"running",progress:"Starting…"})})},[]);return m.useEffect(()=>{if(!c||c.state!=="running"||!c.id)return;const d=setInterval(async()=>{const h=await _e.browserInstall(c.id).catch(()=>null);if(!h?.ok)return;const g=await h.json();u({id:c.id,...g}),g.state!=="running"&&(clearInterval(d),g.state==="done"&&i?.())},1e3);return()=>clearInterval(d)},[c?.id,c?.state]),{start:o,job:c?{state:c.state,progress:c.progress,error:c.error}:null}}const Xp=(...i)=>i.filter((c,u,o)=>!!c&&c.trim()!==""&&o.indexOf(c)===u).join(" ").trim();const $m=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ym=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(c,u,o)=>o?o.toUpperCase():u.toLowerCase());const tp=i=>{const c=Ym(i);return c.charAt(0).toUpperCase()+c.slice(1)};var Tc={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 Gm=i=>{for(const c in i)if(c.startsWith("aria-")||c==="role"||c==="title")return!0;return!1},Xm=m.createContext({}),Qm=()=>m.useContext(Xm),Vm=m.forwardRef(({color:i,size:c,strokeWidth:u,absoluteStrokeWidth:o,className:d="",children:h,iconNode:g,...y},b)=>{const{size:v=24,strokeWidth:S=2,absoluteStrokeWidth:x=!1,color:j="currentColor",className:k=""}=Qm()??{},U=o??x?Number(u??S)*24/Number(c??v):u??S;return m.createElement("svg",{ref:b,...Tc,width:c??v??Tc.width,height:c??v??Tc.height,stroke:i??j,strokeWidth:U,className:Xp("lucide",k,d),...!h&&!Gm(y)&&{"aria-hidden":"true"},...y},[...g.map(([Z,C])=>m.createElement(Z,C)),...Array.isArray(h)?h:[h]])});const fe=(i,c)=>{const u=m.forwardRef(({className:o,...d},h)=>m.createElement(Vm,{ref:h,iconNode:c,className:Xp(`lucide-${$m(tp(i))}`,`lucide-${i}`,o),...d}));return u.displayName=tp(i),u};const Wm=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Km=fe("activity",Wm);const Zm=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Fm=fe("arrow-left",Zm);const Jm=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Im=fe("arrow-up-down",Jm);const Pm=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ey=fe("bell",Pm);const ty=[["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"}]],ny=fe("bot",ty);const ay=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],ly=fe("braces",ay);const iy=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],sy=fe("bug",iy);const ry=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],oy=fe("check",ry);const cy=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],uy=fe("chevron-down",cy);const dy=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],fy=fe("chevron-left",dy);const hy=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],py=fe("chevron-right",hy);const vy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],gy=fe("circle",vy);const my=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],yy=fe("clock",my);const xy=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],by=fe("code",xy);const jy=[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]],Sy=fe("coins",jy);const ky=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],wy=fe("corner-down-left",ky);const zy=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],Ty=fe("corner-left-up",zy);const Cy=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],My=fe("cpu",Cy);const Ey=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],_y=fe("eye",Ey);const Ay=[["path",{d:"M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z",key:"ukzhwg"}],["path",{d:"M14.487 7.858A1 1 0 0 1 14 7V2",key:"1klhew"}],["path",{d:"M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516",key:"rxaxab"}],["path",{d:"M8 18h1",key:"13wk12"}]],Dy=fe("file-pen-line",Ay);const Ry=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],Oy=fe("file-pen",Ry);const Ny=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Hy=fe("file-text",Ny);const Uy=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],By=fe("file",Uy);const qy=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Ly=fe("folder-open",qy);const $y=[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]],Yy=fe("folder-search",$y);const Gy=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Xy=fe("folder",Gy);const Qy=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Vy=fe("funnel",Qy);const Wy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Ky=fe("globe",Wy);const Zy=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Fy=fe("image",Zy);const Jy=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],Iy=fe("layout-template",Jy);const Py=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],ex=fe("list-checks",Py);const tx=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M9 19H3",key:"s61nz1"}],["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M21 5v12a2 2 0 0 1-2 2h-6",key:"hey24a"}]],nx=fe("list-end",tx);const ax=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],lx=fe("loader-circle",ax);const ix=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],sx=fe("message-circle-question-mark",ix);const rx=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],ox=fe("message-square-plus",rx);const cx=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],ux=fe("message-square",cx);const dx=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],fx=fe("moon",dx);const hx=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],px=fe("octagon-alert",hx);const vx=[["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"}]],gx=fe("paperclip",vx);const mx=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],yx=fe("pause",mx);const xx=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],bx=fe("pen-line",xx);const jx=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Sx=fe("plus",jx);const kx=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],wx=fe("power",kx);const zx=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],Tx=fe("quote",zx);const Cx=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Mx=fe("rotate-ccw-clock",Cx);const Ex=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],_x=fe("rotate-cw",Ex);const Ax=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Dx=fe("save",Ax);const Rx=[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Ox=fe("search-check",Rx);const Nx=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Hx=fe("search",Nx);const Ux=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],Bx=fe("send-horizontal",Ux);const qx=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Lx=fe("server",qx);const $x=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Yx=fe("settings",$x);const Gx=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Xx=fe("shield-check",Gx);const Qx=[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]],Vx=fe("shuffle",Qx);const Wx=[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],Kx=fe("square-code",Wx);const Zx=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Fx=fe("sun",Zx);const Jx=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ix=fe("terminal",Jx);const Px=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],e0=fe("text-align-start",Px);const t0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],n0=fe("triangle-alert",t0);const a0=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],l0=fe("unlink",a0);const i0=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],s0=fe("user-plus",i0);const r0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],o0=fe("user",r0);const c0=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],u0=fe("users",c0);const d0=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],f0=fe("wifi-off",d0);const h0=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],p0=fe("wrench",h0);const v0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],g0=fe("x",v0);const m0=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]],y0=fe("zap",m0),np={Circle:gy,Activity:Km,Check:oy,X:g0,Pause:yx,WifiOff:f0,History:Mx,TriangleAlert:n0,OctagonAlert:px,RotateCw:_x,Bot:ny,Plus:Sx,CornerLeftUp:Ty,ArrowLeft:Fm,Folder:Xy,Bell:ey,Unlink:l0,Sun:Fx,Moon:fx,Clock:yy,AlignLeft:e0,Users:u0,ChevronDown:uy,ChevronRight:py,ChevronLeft:fy,Braces:ly,MessageCircleQuestion:sx,ShieldCheck:Xx,Coins:Sy,LayoutTemplate:Iy,Save:Dx,Filter:Vy,Settings:Yx,Paperclip:gx,File:By,Image:Fy,Code:by,SquareCode:Kx,Quote:Tx,PenLine:bx,Eye:_y,Cpu:My,LoaderCircle:lx,MessageSquarePlus:ox,SendHorizontal:Bx,User:o0,Zap:y0,ListEnd:nx,FilePen:Oy,FilePenLine:Dy,FileText:Hy,Terminal:Ix,Search:Hx,FolderSearch:Yy,FolderOpen:Ly,Globe:Ky,ListChecks:ex,UserPlus:s0,MessageSquare:ux,CornerDownLeft:wy,Power:wx,Wrench:p0,Bug:sy,Shuffle:Vx,SearchCheck:Ox,ArrowUpDown:Im,Server:Lx},ap={idle:"Circle",running:"Activity",done:"Check",error:"X",interrupted:"Pause",disconnected:"WifiOff",readonly:"History",warning:"TriangleAlert",critical:"OctagonAlert",caution:"TriangleAlert",resume:"RotateCw",orchestration:"Bot",add:"Plus",parent:"CornerLeftUp",back:"ArrowLeft",folder:"Folder",needsYou:"Bell",unlink:"Unlink",sun:"Sun",moon:"Moon",provider:"Server",search:"Search",sort:"ArrowUpDown",timeline:"Clock",transcript:"AlignLeft",crew:"Users",chevronDown:"ChevronDown",chevronRight:"ChevronRight",chevronLeft:"ChevronLeft",raw:"Braces",question:"MessageCircleQuestion",approval:"ShieldCheck",check:"Check",close:"X",budget:"Coins",template:"LayoutTemplate",draft:"Save",filter:"Filter",settings:"Settings",attach:"Paperclip",file:"File",image:"Image",code:"Code",codeBlock:"SquareCode",quote:"Quote",write:"PenLine",preview:"Eye",model:"Cpu",loading:"LoaderCircle",steer:"MessageSquarePlus",send:"SendHorizontal",you:"User",now:"Zap",nextTurn:"ListEnd",Write:"FilePen",Edit:"FilePenLine",MultiEdit:"FilePenLine",Read:"FileText",Bash:"Terminal",Grep:"Search",Glob:"FolderSearch",LS:"FolderOpen",WebFetch:"Globe",WebSearch:"Globe",Task:"ListChecks",TodoWrite:"ListChecks",spawn_worker:"UserPlus",message_worker:"MessageSquare",ask_human:"MessageCircleQuestion",result:"CornerDownLeft",init:"Power",tool:"Wrench",Bug:"Bug",Shuffle:"Shuffle",SearchCheck:"SearchCheck"};function se({name:i,size:c=16,strokeWidth:u=1.75,color:o,label:d,style:h}){const g=ap[i]||i,y=np[g]||np[ap.tool];return l.jsx(y,{width:c,height:c,strokeWidth:u,color:o||"currentColor","aria-hidden":d?void 0:!0,"aria-label":d,role:d?"img":void 0,style:{flex:"0 0 auto",display:"block",...h}})}const lp={idle:{color:"var(--ink-2)",icon:"idle",label:"idle"},running:{color:"var(--status-good)",icon:"running",label:"running"},done:{color:"var(--status-good)",icon:"done",label:"done"},error:{color:"var(--status-critical)",icon:"error",label:"error"},interrupted:{color:"var(--status-serious)",icon:"interrupted",label:"interrupted"},"needs-you":{color:"var(--status-warning)",icon:"needsYou",label:"needs you"}};function fa({status:i,style:c}){const u=lp[i]??lp.idle;return l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:"var(--fs-sm)",color:"var(--ink-1)",padding:"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:"var(--bg-inset)",border:"1px solid var(--line)",whiteSpace:"nowrap",lineHeight:"16px",...c},children:[l.jsx(se,{name:u.icon,size:12,strokeWidth:2.25,color:u.color}),u.label]})}function x0({value:i,onChange:c,groups:u=[],placeholder:o="Search projects and runs…",busy:d=!1,style:h}){const g=m.useRef(null),[y,b]=m.useState(!1),[v,S]=m.useState(0),x=i.trim().length>0,j=u.flatMap(z=>z.items),k=y&&x&&(j.length>0||!d);m.useEffect(()=>{const z=D=>{const B=document.activeElement,J=B&&(B.tagName==="INPUT"||B.tagName==="TEXTAREA"||B.isContentEditable),re=D.key==="/"&&!J&&!D.metaKey&&!D.ctrlKey&&!D.altKey,q=D.key.toLowerCase()==="k"&&(D.metaKey||D.ctrlKey)&&!D.altKey;(re||q)&&(D.preventDefault(),g.current?.focus(),g.current?.select())};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[]),m.useEffect(()=>{S(0)},[i,j.length]);const U=z=>{z.onPick?.(),c?.(""),g.current?.blur()},Z=z=>{if(z.key==="Escape"){i?c?.(""):z.currentTarget.blur();return}!k||!j.length||(z.key==="ArrowDown"?(z.preventDefault(),S(D=>(D+1)%j.length)):z.key==="ArrowUp"?(z.preventDefault(),S(D=>(D-1+j.length)%j.length)):z.key==="Enter"&&(z.preventDefault(),U(j[v]??j[0])))};let C=-1;return l.jsxs("div",{style:{position:"relative",flex:"0 1 26rem",minWidth:"12rem",...h},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",background:"var(--bg-card)",borderRadius:"var(--r-sm)",border:`1px solid ${y?"var(--brand)":"var(--line)"}`,padding:"4px var(--sp-2)",transition:"border-color var(--dur-fast) var(--ease)"},children:[l.jsx(se,{name:"search",size:14,color:"var(--ink-2)"}),l.jsx("input",{ref:g,value:i,type:"text",placeholder:o,"aria-label":"Search projects, runs and actions",role:"combobox","aria-expanded":k,onChange:z=>c?.(z.target.value),onFocus:()=>b(!0),onBlur:()=>setTimeout(()=>b(!1),120),onKeyDown:Z,style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--ink-0)",font:"inherit",fontSize:"var(--fs-sm)",padding:0,boxShadow:"none"}}),x?l.jsx("button",{type:"button",onClick:()=>{c?.(""),g.current?.focus()},title:"Clear (Esc)","aria-label":"Clear search",style:{display:"inline-flex",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--ink-2)"},children:l.jsx(se,{name:"close",size:13})}):l.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",border:"1px solid var(--line)",borderRadius:3,padding:"0 4px",lineHeight:"15px",whiteSpace:"nowrap"},children:"⌘K"})]}),k&&l.jsxs("div",{role:"listbox",style:{position:"absolute",top:"calc(100% + 6px)",left:0,width:"max(100%, 34rem)",maxWidth:"calc(100vw - 2rem)",maxHeight:"60vh",overflowY:"auto",zIndex:30,background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",boxShadow:"0 12px 32px rgba(0,0,0,.35)",padding:"var(--sp-1) 0"},children:[j.length===0&&l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)",fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:["Nothing matches “",i.trim(),"”."]}),u.filter(z=>z.items.length).map(z=>l.jsxs("div",{children:[l.jsxs("div",{style:{padding:"6px var(--sp-3) 2px",fontSize:"var(--fs-xs)",color:"var(--ink-2)",letterSpacing:".06em",textTransform:"uppercase"},children:[z.label,z.count!==void 0?` · ${z.count}`:""]}),z.items.map(D=>{C+=1;const B=C,J=B===v;return l.jsxs("button",{type:"button",role:"option","aria-selected":J,onMouseDown:re=>re.preventDefault(),onMouseEnter:()=>S(B),onClick:()=>U(D),style:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr) auto",alignItems:"center",gap:"var(--sp-2)",width:"100%",textAlign:"left",padding:"6px var(--sp-3)",border:"none",font:"inherit",background:J?"var(--bg-hover)":"transparent",color:"var(--ink-0)",cursor:"pointer"},children:[l.jsx(se,{name:D.icon??"folder",size:14,color:"var(--ink-2)"}),l.jsxs("span",{style:{minWidth:0,display:"flex",flexDirection:"column"},children:[l.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--fs-sm)"},children:D.title}),D.detail&&l.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:D.detail})]}),l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:[D.status&&l.jsx(fa,{status:D.status}),D.meta]})]},D.id)})]},z.label))]})]})}const ip={"api-key":{color:"var(--status-warning)",icon:"budget",label:"API key billing",hint:"Missions bill a metered API key, not a Claude subscription. Usage is charged per token."},subscription:{color:"var(--ink-2)",icon:"budget",label:"subscription",hint:"Missions run on the signed-in Claude subscription."},cloud:{color:"var(--ink-2)",icon:"budget",label:"cloud provider",hint:"Missions bill a cloud provider (Bedrock/Vertex)."},local:{color:"var(--ink-2)",icon:"model",label:"local model",hint:"Missions run on a model served from this machine. No per-token cost, so budgets are capped by turns and time."},provider:{color:"var(--status-warning)",icon:"budget",label:"external provider",hint:"Missions bill an endpoint Foreman does not price. Spend is real but its dollar figure is not shown."},none:{color:"var(--status-critical)",icon:"error",label:"no credentials",hint:"No credentials found — missions cannot run."}};function Qp({mode:i,source:c,account:u,compact:o,style:d}){const h=ip[i]??ip.none,g=u?.email,y=h.label,b=[h.hint,g&&u.org?`Account: ${g} (${u.org})`:g&&`Account: ${g}`,c&&`Source: ${c}`].filter(Boolean).join(`
20
+ `),v=i==="api-key"||i==="none"||i==="provider";return l.jsxs("span",{title:b,style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:o?"var(--fs-xs)":"var(--fs-sm)",color:"var(--ink-1)",padding:o?"1px 6px 1px 5px":"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:"var(--bg-inset)",border:`1px solid ${v?h.color:"var(--line)"}`,whiteSpace:"nowrap",lineHeight:"16px",...d},children:[l.jsx(se,{name:h.icon,size:12,strokeWidth:2.25,color:h.color}),o?y:`billing: ${y}`]})}function Ci({children:i,title:c,onClick:u,tone:o}){const d=o==="warn"?"var(--status-warning)":o==="bad"?"var(--status-error)":"var(--ink-2)",h=l.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:d,whiteSpace:"nowrap",minWidth:0},children:i});return u?l.jsx("button",{type:"button",onClick:u,title:c,style:{background:"none",border:0,padding:"0 2px",margin:"0 -2px",font:"inherit",cursor:"pointer",display:"inline-flex",minWidth:0,borderRadius:3},children:h}):l.jsx("span",{title:c,style:{display:"inline-flex",minWidth:0},children:h})}const b0=({color:i})=>l.jsx("span",{"aria-hidden":!0,style:{width:7,height:7,borderRadius:"50%",background:i,flex:"0 0 auto"}}),Is=()=>l.jsx("span",{"aria-hidden":!0,style:{width:1,height:12,background:"var(--line)",margin:"0 var(--sp-2)",flex:"0 0 auto"}}),Ps=i=>String(i??"").replace(/^https?:\/\//,"").replace(/\/+$/,"");function j0({connected:i,localUrl:c,publicUrl:u,phone:o,auth:d,version:h,update:g,onOpenSettings:y,style:b}){const v=typeof u=="string"&&u.startsWith("https://"),S=u&&Ps(u)!==Ps(c)?u:null;return l.jsxs("footer",{style:{display:"flex",alignItems:"center",gap:0,flex:"0 0 auto",minHeight:24,padding:"2px var(--sp-4)",background:"var(--bg-panel)",borderTop:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",overflow:"hidden",...b},children:[l.jsxs(Ci,{title:i?"Live: this tab follows the server’s event stream":"Disconnected: the tab lost the server’s event stream and is reconnecting",tone:i?void 0:"bad",children:[l.jsx(b0,{color:i?"var(--status-success)":"var(--status-error)"}),i?"connected":"disconnected"]}),l.jsx(Is,{}),l.jsxs(Ci,{title:`Serving on ${c}${S?` and, on your tailnet, ${S}${v?" (HTTPS via tailscale serve)":" (plain HTTP — foreman doctor shows the one command for HTTPS)"}`:""}`,children:[l.jsx("span",{style:{fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis"},children:Ps(c)}),S&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx(se,{name:v?"approval":"provider",size:12,color:v?"var(--status-success)":"var(--ink-2)"}),l.jsx("span",{style:{fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis"},children:Ps(S)})]})]}),o!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx(Is,{}),l.jsxs(Ci,{onClick:()=>y?.("notifications"),title:o?`Telegram linked to ${o}. Approvals, questions and the front desk reach that chat. Click for Notifications.`:"No phone linked. Settings → Notifications links a Telegram chat: approvals, questions and the front desk on the move.",children:[l.jsx(se,{name:"needsYou",size:12}),o?`phone ${o}`:"no phone linked"]})]}),l.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",minWidth:0},children:[d&&l.jsxs(l.Fragment,{children:[l.jsx(Ci,{onClick:()=>y?.("provider"),title:"Who pays for missions by default. Click for Provider.",children:l.jsx(Qp,{mode:d.mode,source:d.source,account:d.account,compact:!0})}),l.jsx(Is,{})]}),g&&l.jsxs(l.Fragment,{children:[l.jsxs(Ci,{tone:"warn",title:`You run ${g.current}; ${g.latest} is on npm. In a terminal: foreman update — it refuses while a mission is live.`,children:[g.latest," available · ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"foreman update"})]}),l.jsx(Is,{})]}),h&&l.jsxs("a",{href:"https://github.com/amenophis1er/foreman/releases",target:"_blank",rel:"noopener noreferrer",title:`Foreman ${h} — release notes`,style:{fontFamily:"var(--font-mono)",color:"var(--ink-2)",textDecoration:"none",whiteSpace:"nowrap"},children:["v",h]})]})]})}const S0=/\.(png|jpe?g|gif|webp|svg|heic)$/i,k0=/\.(js|jsx|ts|tsx|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|css|html|json|ya?ml|toml|sh|sql|md)$/i;function w0(i){return i==null?"":i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(i<10240?1:0)} KB`:`${(i/1048576).toFixed(1)} MB`}function Vp({name:i,size:c,onRemove:u,style:o}){const[d,h]=m.useState(!1),g=S0.test(i)?"image":k0.test(i)?"code":"file";return l.jsxs("span",{onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{display:"inline-flex",alignItems:"center",gap:6,maxWidth:260,height:24,padding:"0 4px 0 8px",background:"var(--bg-inset)",border:`1px solid ${d?"var(--line-strong)":"var(--line)"}`,borderRadius:"var(--r-sm)",fontSize:"var(--fs-sm)",color:"var(--ink-0)",...o},children:[l.jsx(se,{name:g,size:13,color:"var(--ink-2)"}),l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),c!=null&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap"},children:w0(c)}),u&&l.jsx("button",{type:"button",onClick:u,"aria-label":`Remove ${i}`,style:{display:"inline-flex",width:18,height:18,alignItems:"center",justifyContent:"center",background:"none",border:"none",borderRadius:3,padding:0,cursor:"pointer",color:"var(--ink-2)"},children:l.jsx(se,{name:"close",size:12})})]})}const z0={default:{background:"var(--bg-card)",border:"1px solid var(--line-strong)",color:"var(--ink-0)"},primary:{background:"var(--brand)",border:"1px solid var(--brand)",color:"var(--brand-ink)",fontWeight:"var(--fw-semibold)"},good:{background:"transparent",border:"1px solid var(--status-good)",color:"var(--ink-0)"},danger:{background:"transparent",border:"1px solid var(--status-critical)",color:"var(--ink-0)"},ghost:{background:"none",border:"1px solid transparent",color:"var(--ink-1)"}},T0={default:{borderColor:"var(--ink-2)"},primary:{filter:"brightness(1.08)"},good:{background:"color-mix(in srgb, var(--status-good) 14%, transparent)"},danger:{background:"color-mix(in srgb, var(--status-critical) 14%, transparent)"},ghost:{color:"var(--ink-0)",background:"var(--bg-hover)"}},C0={default:{background:"var(--bg-inset)"},primary:{filter:"brightness(0.94)"},good:{background:"color-mix(in srgb, var(--status-good) 22%, transparent)"},danger:{background:"color-mix(in srgb, var(--status-critical) 22%, transparent)"},ghost:{background:"var(--bg-inset)"}},sp={sm:{padding:"3px 8px",fontSize:"var(--fs-sm)",gap:5,icon:13},md:{padding:"6px 12px",fontSize:"var(--fs-md)",gap:6,icon:15}};function ie({children:i,onClick:c,variant:u="default",size:o="md",icon:d,disabled:h,title:g,type:y="button",style:b}){const[v,S]=m.useState(!1),[x,j]=m.useState(!1),k=sp[o]||sp.md;return l.jsxs("button",{type:y,title:g,disabled:h,onClick:c,onMouseEnter:()=>S(!0),onMouseLeave:()=>{S(!1),j(!1)},onMouseDown:()=>j(!0),onMouseUp:()=>j(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:k.gap,padding:k.padding,borderRadius:"var(--r-sm)",fontSize:k.fontSize,lineHeight:"var(--lh)",whiteSpace:"nowrap",cursor:h?"default":"pointer",transition:"background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease)",...z0[u],...h?{opacity:.5}:v?T0[u]:null,...!h&&x?C0[u]:null,...b},children:[d&&l.jsx(se,{name:d,size:k.icon}),i]})}const Cc=i=>`${i.name}:${i.size}`,Fc=22,rp=Fc*3,op=Fc*10;function Xc({value:i,onChange:c,onSend:u,onStop:o,busy:d,disabled:h,disabledReason:g,placeholder:y,who:b,onChangeModel:v,autoFocus:S,style:x,hint:j,busyHint:k,attach:U=!0}){const[Z,C]=m.useState(""),[z,D]=m.useState(!1),[B,J]=m.useState([]),[re,q]=m.useState(!1),N=m.useRef(null),$=m.useRef(null),Y=oe=>{if(!U)return;const ne=Array.from(oe||[]);ne.length&&J(E=>{const G=new Set(E.map(Cc));return[...E,...ne.filter(P=>!G.has(Cc(P)))]})},de=i??Z,Q=c??C,W=!h&&!d&&(de.trim().length>0||B.length>0);m.useEffect(()=>{const oe=N.current;oe&&(oe.style.height="auto",oe.style.height=Math.max(rp,Math.min(oe.scrollHeight,op))+"px")},[de]);const ge=()=>{W&&(u?.(de.trim()||(B.length?"See the attached files.":""),B),Q(""),J([]))};return l.jsxs("div",{style:{flex:"0 0 auto",background:re?"var(--brand-wash)":"var(--bg-card)",border:`1px solid ${z||re?"var(--brand)":"var(--line-strong)"}`,borderRadius:"var(--r-md)",padding:"var(--sp-2) var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",opacity:h?.6:1,transition:"border-color var(--dur-fast) var(--ease)",...x},onDragOver:oe=>{h||(oe.preventDefault(),q(!0))},onDragLeave:oe=>{oe.target===oe.currentTarget&&q(!1)},onDrop:oe=>{oe.preventDefault(),q(!1),h||Y(oe.dataTransfer.files)},children:[l.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"flex-start"},children:[l.jsx("span",{className:d?"pulse":void 0,style:{marginTop:3,flex:"0 0 auto",display:"inline-flex"},children:l.jsx(se,{name:d?"loading":"steer",size:15,color:"var(--brand)"})}),l.jsx("textarea",{ref:N,rows:3,value:de,disabled:h,autoFocus:S,placeholder:h?g||"Not available right now.":y||"Ask, think out loud, or describe what you want built…",onChange:oe=>Q(oe.target.value),onPaste:oe=>{oe.clipboardData?.files?.length&&(oe.preventDefault(),Y(oe.clipboardData.files))},onFocus:()=>D(!0),onBlur:()=>D(!1),onKeyDown:oe=>{(oe.metaKey||oe.ctrlKey)&&oe.key==="Enter"&&(oe.preventDefault(),ge())},style:{flex:1,minWidth:0,resize:"none",border:"none",outline:"none",boxShadow:"none",background:"transparent",borderRadius:"var(--r-sm)",color:"var(--ink-0)",font:"inherit",lineHeight:`${Fc}px`,padding:"2px 0",minHeight:rp,maxHeight:op}})]}),B.length>0&&l.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:B.map((oe,ne)=>l.jsx(Vp,{name:oe.name,size:oe.size,onRemove:()=>J(E=>E.filter((G,P)=>P!==ne))},Cc(oe)))}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b?`${b.model} via ${b.provider}`:void 0,children:[b&&l.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},role:v?"button":void 0,onClick:v,title:v?"Change the planner model in Settings → Models":void 0,...v?{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)",cursor:"pointer",textDecoration:"underline dotted",textUnderlineOffset:3}}:{},children:[b.model," · ",b.provider.split(" · ")[0],b.costBasis==="free"?" · free":b.costBasis==="unpriced"?" · unpriced":""," — "]}),d?k??"The foreman is looking…":j??"Reads the project, never changes it."]}),l.jsx("span",{style:{marginLeft:"auto"}}),U&&l.jsx("input",{ref:$,type:"file",multiple:!0,style:{display:"none"},onChange:oe=>{Y(oe.target.files),oe.target.value=""}}),U&&l.jsx(ie,{size:"sm",variant:"ghost",icon:"attach",disabled:h,title:"Attach files — or drop them here, or paste an image",onClick:()=>$.current?.click(),children:"Attach"}),d&&o?l.jsx(ie,{size:"sm",variant:"danger",icon:"close",onClick:o,title:"Stop the planner and discard the rest of this reply",children:"Stop"}):l.jsx(ie,{size:"sm",icon:"send",onClick:ge,disabled:!W,title:"⌘↵",children:"Send"})]})]})}function Jc({children:i,accent:c,tone:u="card",style:o,onClick:d,title:h}){const g=u==="panel"?"var(--bg-panel)":u==="inset"?"var(--bg-inset)":"var(--bg-card)";return l.jsx("div",{onClick:d,title:h,role:d?"button":void 0,style:{background:g,border:"1px solid var(--line)",borderLeft:c?`var(--accent-w) solid ${c}`:"1px solid var(--line)",borderRadius:"var(--r-sm)",padding:"var(--sp-3)",cursor:d?"pointer":void 0,...o},children:i})}function sr(i){if(i==="director")return"var(--brand)";if(i==="you")return"var(--ink-0)";const c=/(\d+)/.exec(String(i||""));return`var(--agent-worker-${c?(parseInt(c[1],10)-1)%6+1:1})`}function fn({agent:i,size:c="md",style:u}){const o=c==="sm"?"var(--dot-sm)":"var(--dot)";return l.jsx("span",{"aria-hidden":!0,style:{width:o,height:o,borderRadius:"var(--r-pill)",background:sr(i),flex:"0 0 auto",...u}})}function Wp(i){if(i==null)return null;if(typeof i=="object")return i;try{return JSON.parse(i)}catch{return null}}function cp(i){if(!i)return"";const c=String(i).split("/");return c.length>3?"…/"+c.slice(-3).join("/"):i}function Kp(i,c){if(!c)return"";switch(i){case"Write":case"Edit":case"MultiEdit":case"Read":return cp(c.file_path||c.path);case"Bash":return c.command||"";case"Grep":return`${c.pattern??""}${c.path?" in "+cp(c.path):""}`;case"Glob":return c.pattern||"";case"WebFetch":case"WebSearch":return c.url||c.query||"";case"spawn_worker":return`${c.id??"worker"} — ${(c.task||"").slice(0,80)}`;case"message_worker":return`${c.id??"worker"} — ${(c.message||"").slice(0,80)}`;case"ask_human":return c.question||"";default:{const u=Object.keys(c)[0];return u?`${u}: ${String(c[u]).slice(0,80)}`:""}}}function Mc({text:i,tone:c,max:u=12}){const o=String(i??"").split(`
21
+ `),d=o.slice(0,u),h=c==="add"?"var(--diff-add-bg)":c==="del"?"var(--diff-del-bg)":"transparent",g=c==="add"?"+":c==="del"?"−":" ";return l.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",lineHeight:1.5},children:[d.map((y,b)=>l.jsxs("div",{style:{display:"flex",background:h,padding:"0 8px"},children:[l.jsx("span",{style:{width:14,flex:"0 0 auto",color:c==="add"?"var(--status-good)":c==="del"?"var(--status-critical)":"var(--ink-2)"},children:g}),l.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--ink-0)"},children:y})]},b)),o.length>u&&l.jsxs("div",{style:{padding:"2px 8px",color:"var(--ink-2)"},children:["… ",o.length-u," more lines"]})]})}function M0({tool:i,input:c}){if(!c)return null;if(i==="Write")return l.jsx(Mc,{text:c.content,tone:"add"});const u=i==="MultiEdit"?c.edits||[]:[c];return l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:u.map((o,d)=>l.jsxs("div",{children:[l.jsx(Mc,{text:o.old_string,tone:"del",max:8}),l.jsx(Mc,{text:o.new_string,tone:"add",max:8})]},d))})}const E0=new Set(["spawn_worker","message_worker","ask_human"]);function Zp({tool:i="tool",input:c,body:u,defaultOpen:o=!1,style:d}){const h=c??Wp(u),[g,y]=m.useState(o),[b,v]=m.useState(!1),S=E0.has(i),x=h&&(i==="Write"||i==="Edit"||i==="MultiEdit"),j=Kp(i,h)||(typeof u=="string"?u.slice(0,120):"");return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,...d},children:[l.jsxs("button",{type:"button",onClick:()=>y(!g),title:g?"Collapse":"Expand",style:{display:"flex",alignItems:"center",gap:8,padding:0,background:"none",border:"none",cursor:"pointer",color:"var(--ink-0)",textAlign:"left",width:"100%",font:"inherit"},children:[l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,padding:"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:S?"var(--brand-wash-strong)":"var(--bg-inset)",border:`1px solid ${S?"var(--brand)":"var(--line)"}`,color:S?"var(--brand)":"var(--ink-1)",fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap",lineHeight:"16px"},children:[l.jsx(se,{name:i,size:12,strokeWidth:2}),i]}),l.jsx("span",{style:{flex:1,minWidth:0,fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",color:"var(--ink-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:j}),l.jsx(se,{name:g?"chevronDown":"chevronRight",size:14,color:"var(--ink-2)"})]}),g&&l.jsxs("div",{style:{background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",overflow:"hidden"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 8px",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[l.jsx("span",{children:x&&!b?"changes":"payload"}),l.jsx("span",{style:{flex:1}}),x&&l.jsxs("button",{type:"button",onClick:()=>v(!b),style:{display:"inline-flex",alignItems:"center",gap:4,background:"none",border:"none",color:"var(--ink-2)",cursor:"pointer",font:"inherit",padding:0},children:[l.jsx(se,{name:"raw",size:12}),b?"diff":"raw"]})]}),l.jsx("div",{style:{padding:"6px 0",maxHeight:260,overflow:"auto"},children:x&&!b?l.jsx(M0,{tool:i,input:h}):l.jsx("pre",{style:{margin:0,padding:"0 8px",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--ink-0)"},children:h?JSON.stringify(h,null,2):String(u??"")})})]})]})}const _0=/(`[^`\n]+`|\*\*[^*\n]+\*\*|<[^<>\n]{1,80}>)/g;function er(i,c){return i.split(_0).filter(Boolean).map((u,o)=>u.startsWith("`")&&u.endsWith("`")&&u.length>2?l.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:"0.92em",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:4,padding:"0 5px"},children:u.slice(1,-1)},o):u.startsWith("**")&&u.endsWith("**")&&u.length>4?l.jsx("strong",{style:{fontWeight:"var(--fw-semibold)",color:"var(--ink-0)"},children:u.slice(2,-2)},o):c&&u.startsWith("<")&&u.endsWith(">")?l.jsx("span",{style:{background:"var(--brand-wash-strong)",border:"1px dashed var(--brand)",borderRadius:4,padding:"0 5px",color:"var(--ink-0)"},children:u.slice(1,-1)},o):u)}function A0(i){const c=String(i||"").replace(/\r\n?/g,`
22
22
  `).split(`
23
- `),u=[];let o=0;for(;o<c.length;){const d=c[o];if(/^```/.test(d)){const y=d.slice(3).trim(),x=[];for(o++;o<c.length&&!/^```/.test(c[o]);)x.push(c[o++]);o++,u.push({t:"code",lang:y,body:x.join(`
24
- `)});continue}if(/^>\s?/.test(d)){const y=[];for(;o<c.length&&/^>\s?/.test(c[o]);)y.push(c[o++].replace(/^>\s?/,""));u.push({t:"quote",body:y});continue}if(/^\s*[-*]\s+/.test(d)){const y=[];for(;o<c.length&&/^\s*[-*]\s+/.test(c[o]);)y.push(c[o++].replace(/^\s*[-*]\s+/,""));u.push({t:"list",items:y});continue}const h=/^(#{1,3})\s+(.*)$/.exec(d);if(h){u.push({t:"h",level:h[1].length,body:h[2]}),o++;continue}if(!d.trim()){o++;continue}const g=[];for(;o<c.length&&c[o].trim()&&!/^(```|>|\s*[-*]\s|#{1,3}\s)/.test(c[o]);)g.push(c[o++]);u.push({t:"p",body:g})}return u}function _i({text:i,slots:c=!0,style:u}){const o=A0(i);return a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10,lineHeight:"var(--lh-prose)",color:"var(--ink-prose, var(--ink-0))",...u},children:o.map((d,h)=>d.t==="code"?a.jsxs("pre",{style:{margin:0,padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",lineHeight:"var(--lh)",overflowX:"auto",whiteSpace:"pre",position:"relative"},children:[d.lang&&a.jsx("span",{style:{position:"absolute",top:4,right:8,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:d.lang}),d.body]},h):d.t==="quote"?a.jsx("blockquote",{style:{margin:0,padding:"2px 0 2px 12px",borderLeft:"2px solid var(--agent-worker)",color:"var(--ink-1)"},children:d.body.map((g,y)=>a.jsx("div",{children:er(g,c)},y))},h):d.t==="list"?a.jsx("ul",{style:{margin:0,paddingLeft:20},children:d.items.map((g,y)=>a.jsx("li",{children:er(g,c)},y))},h):d.t==="h"?a.jsx("div",{style:{fontWeight:"var(--fw-semibold)",fontSize:d.level===1?"var(--fs-lg)":"var(--fs-md)",color:"var(--ink-0)",marginTop:h?4:0},children:er(d.body,c)},h):a.jsx("p",{style:{margin:0},children:d.body.map((g,y)=>a.jsxs(On.Fragment,{children:[y>0&&a.jsx("br",{}),er(g,c)]},y))},h))})}const Fp=new Set(["spawn_worker","message_worker","ask_human"]);function Ic({agent:i,title:c,kind:u="text",body:o,ts:d,to:h,timing:g,dense:y=!1,style:x}){const v=u==="tool";if(v&&y)return a.jsx(O0,{agent:i,title:c,body:o,ts:d,style:x});if(u==="system"&&!o&&typeof c=="string"&&c.startsWith("result ·"))return a.jsx(R0,{agent:i,title:c,ts:d,style:x});const S=u==="steer",b=u==="result",j=u==="error"?"var(--status-critical)":S?"var(--ink-0)":u==="text"?sr(i):void 0,k=d?new Date(d).toLocaleTimeString(void 0,{hour12:!1}):null,B=v?String(c||"tool").replace(/^[^\w]+/,""):null,K=v?null:c;return a.jsxs(Jc,{accent:j,style:{padding:"var(--sp-2) var(--sp-3)",...b?{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)"}:null,...u==="system"?{color:"var(--ink-1)",fontSize:"var(--fs-sm)"}:null,...x},children:[a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:u==="error"?"var(--status-critical)":"var(--ink-2)",marginBottom:4,display:"flex",alignItems:"center",gap:6,fontFamily:"var(--font-ui)"},children:[a.jsx(fn,{agent:i,size:"sm"}),a.jsx("span",{children:i}),S&&h&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{name:"chevronRight",size:11}),a.jsx(fn,{agent:h,size:"sm"}),a.jsx("span",{children:h})]}),S&&g&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[a.jsx(ie,{name:g==="now"?"now":"nextTurn",size:11}),g==="now"?"now":"next turn"]})]}),K&&K!==i&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[u==="error"&&a.jsx(ie,{name:"error",size:11,strokeWidth:2.25}),K]})]}),v&&Fp.has(B)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsx("span",{style:{color:"var(--brand)"},children:"orchestration"})]}),k&&a.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:k})]}),v?a.jsx(Zp,{tool:B,body:o}):u==="text"&&typeof o=="string"?a.jsx(_i,{text:o}):a.jsx(D0,{body:o})]})}const up=12;function D0({body:i}){const[c,u]=m.useState(!1),o=typeof i=="string"?i:null,d=o?o.split(`
25
- `):[];if(!(o!==null&&(d.length>up+4||o.length>1600)))return a.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i});const g=c?o:d.slice(0,up).join(`
26
- `).slice(0,1600);return a.jsxs("div",{children:[a.jsxs("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[g,!c&&`
27
- …`]}),a.jsx("button",{type:"button",onClick:()=>u(!c),style:{marginTop:4,padding:0,background:"none",border:"none",cursor:"pointer",font:"inherit",fontFamily:"var(--font-ui)",fontSize:"var(--fs-xs)",color:"var(--brand)"},children:c?"Show less":`Show all · ${d.length} lines`})]})}function R0({agent:i,title:c,ts:u,style:o}){const d=u?new Date(u).toLocaleTimeString(void 0,{hour12:!1}):null;return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap",overflow:"hidden",...o},children:[a.jsx(fn,{agent:i,size:"sm"}),a.jsx("span",{children:i}),a.jsx("span",{children:"·"}),a.jsx("span",{children:c.replace(/^result · /,"turn ended · ")}),d&&a.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:d})]})}function O0({agent:i,title:c,body:u,ts:o,style:d}){const h=String(c||"tool").replace(/^[^\w]+/,""),g=Kp(h,Wp(u))||(typeof u=="string"?u:""),y=String(g).replace(/\s+/g," ").slice(0,90),x=o?new Date(o).toLocaleTimeString(void 0,{hour12:!1}):null;return a.jsxs("div",{title:typeof u=="string"?u.slice(0,2e3):void 0,style:{display:"flex",alignItems:"center",gap:6,padding:"1px var(--sp-2)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap",overflow:"hidden",minWidth:0,...d},children:[a.jsx(fn,{agent:i,size:"sm"}),a.jsx(ie,{name:h,size:12}),a.jsx("span",{style:{color:Fp.has(h)?"var(--brand)":"var(--ink-1)",flex:"0 0 auto"},children:h}),a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:y}),x&&a.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:x})]})}function Ol({icon:i,label:c,onClick:u,active:o,size:d="md",disabled:h,style:g}){const[y,x]=m.useState(!1),v=d==="sm"?26:32;return a.jsx("button",{type:"button",title:c,"aria-label":c,"aria-pressed":o,disabled:h,onClick:u,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),style:{width:v,height:v,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,borderRadius:"var(--r-sm)",cursor:h?"default":"pointer",background:o?"var(--bg-card)":y?"var(--bg-hover)":"transparent",border:`1px solid ${o?"var(--line-strong)":"transparent"}`,color:o||y?"var(--ink-0)":"var(--ink-1)",opacity:h?.5:1,transition:"background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease)",...g},children:a.jsx(ie,{name:i,size:d==="sm"?14:16})})}function rr(i){if(!i)return"";let c=String(i).replace(/^\/(Users|home)\/[^/]+/,"~");const u=c.split("/");return u.length>4&&(c=[u[0],u[1],"…",...u.slice(-2)].join("/")),c}function Jp({size:i=24,mono:c,style:u}){const o=c?"currentColor":"var(--brand)",d=c?"currentColor":"var(--agent-worker)";return a.jsxs("svg",{viewBox:"0 0 32 32",width:i,height:i,"aria-hidden":!0,style:{flex:"0 0 auto",display:"block",...u},children:[a.jsx("rect",{x:"5",y:"4",width:"6",height:"24",rx:"3",fill:o}),a.jsx("rect",{x:"5",y:"4",width:"22",height:"6",rx:"3",fill:o}),a.jsx("rect",{x:"5",y:"13",width:"15",height:"6",rx:"3",fill:d,opacity:c?.55:1})]})}function N0({size:i=22,tagline:c,mono:u,style:o}){return a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:Math.round(i*.4),...o},children:[a.jsx(Jp,{size:i,mono:u}),a.jsx("span",{style:{fontSize:Math.round(i*.82),fontWeight:"var(--fw-semibold)",letterSpacing:"-0.01em",color:u?"currentColor":"var(--ink-0)",lineHeight:1},children:"Foreman"}),c&&a.jsx("span",{style:{color:"var(--ink-2)",fontSize:"var(--fs-sm)",marginLeft:4},children:c})]})}function H0({folder:i}){const[c,u]=On.useState(!1),[o,d]=On.useState(!1),h=()=>{navigator.clipboard&&navigator.clipboard.writeText(i).catch(()=>{}),u(!0),setTimeout(()=>u(!1),1200)};return a.jsxs("button",{type:"button",onClick:h,title:c?"Copied":i,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0,maxWidth:420,padding:"3px 8px",borderRadius:999,border:"1px solid transparent",background:o?"var(--bg-inset, rgba(255,255,255,.06))":"transparent",color:c?"var(--ink-1)":"var(--ink-2)",cursor:"pointer",font:"inherit"},children:[a.jsx(ie,{name:"folder",size:13}),a.jsx("span",{style:{fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c?"copied":rr(i)})]})}function Ip({mode:i="fleet",title:c,subtitle:u="mission control",folder:o,branch:d,onBack:h,theme:g,onToggleTheme:y,onSettings:x,version:v,search:S,children:b,style:j}){const k=i==="fleet";return a.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)",padding:k?"var(--sp-3) var(--sp-5)":"var(--sp-2) var(--sp-3)",background:"var(--bg-panel)",borderBottom:"1px solid var(--line)",flex:"0 0 auto",minHeight:48,...j},children:[k?a.jsx(N0,{size:22,tagline:u}):a.jsxs("nav",{"aria-label":"Breadcrumb",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:0},children:[a.jsx("button",{type:"button",onClick:h,title:"Back to the fleet","aria-label":"Back to the fleet",style:{background:"none",border:0,padding:0,cursor:"pointer",display:"inline-flex",alignItems:"center"},children:a.jsx(Jp,{size:22})}),a.jsx("button",{type:"button",onClick:h,style:{background:"none",border:0,padding:0,font:"inherit",color:"var(--ink-2)",cursor:"pointer"},children:"Fleet"}),a.jsx(ie,{name:"chevronRight",size:14,color:"var(--ink-3, var(--ink-2))"}),a.jsx("span",{style:{fontWeight:"var(--fw-semibold)",whiteSpace:"nowrap"},children:c}),o&&a.jsx(H0,{folder:o}),d&&a.jsxs("span",{title:d.hint??`On branch ${d.name}${d.dirty?" · uncommitted changes":""}`,style:{display:"inline-flex",alignItems:"center",gap:5,padding:"2px 8px",borderRadius:999,border:"1px solid var(--line)",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",color:"var(--ink-1)",whiteSpace:"nowrap",maxWidth:260},children:[a.jsx("span",{"aria-hidden":!0,style:{color:"var(--ink-2)"},children:"⎇"}),a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:d.name}),d.dirty&&a.jsx("span",{"aria-label":"uncommitted changes",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-warning)",flex:"0 0 auto"}})]})]}),S&&a.jsx("div",{style:{flex:"1 1 auto",display:"flex",justifyContent:"center",minWidth:0,padding:"0 var(--sp-3)"},children:S}),a.jsxs("div",{style:{marginLeft:S?0:"auto",display:"flex",alignItems:"center",gap:"var(--sp-3)",flexWrap:"wrap",justifyContent:"flex-end"},children:[b,y&&a.jsx(Ol,{icon:g==="light"?"moon":"sun",label:g==="light"?"Switch to dark theme":"Switch to light theme",onClick:y}),x&&a.jsx(Ol,{icon:"settings",label:"Settings",onClick:x}),v&&a.jsxs("a",{href:"https://github.com/amenophis1er/foreman/releases",target:"_blank",rel:"noopener noreferrer",title:`Foreman ${v} — release notes`,style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textDecoration:"none",whiteSpace:"nowrap"},children:["v",v]})]})]})}function Fe({children:i}){return a.jsx("div",{style:{color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:i})}function Rn({children:i,style:c}){return a.jsx("h2",{style:{margin:"0 0 var(--sp-2)",fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)",color:"var(--ink-2)",...c},children:i})}const dp={readonly:{icon:"readonly",color:"var(--status-warning)"},disconnected:{icon:"disconnected",color:"var(--status-serious)"},error:{icon:"error",color:"var(--status-critical)"},caution:{icon:"caution",color:"var(--status-serious)"}};function ot({tone:i="readonly",children:c,inline:u,style:o}){const d=dp[i]??dp.readonly;return u?a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,color:d.color,fontSize:"var(--fs-sm)",...o},children:[a.jsx(ie,{name:d.icon,size:13,strokeWidth:2}),c]}):a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1) var(--sp-3)",background:"var(--bg-inset)",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-sm)",color:"var(--ink-1)",...o},children:[a.jsx(ie,{name:d.icon,size:14,color:d.color}),c]})}function Pp(i,c=Date.now()){const u=Math.max(0,Math.round((c-i)/1e3));if(u<60)return`${u}s`;const o=Math.floor(u/60);if(o<60)return`${o}m`;const d=Math.floor(o/60);return d<24?o%60?`${d}h ${o%60}m`:`${d}h`:`${Math.floor(d/24)}d`}const U0={permission:"approval",question:"director asks",planner:"the planner is asking",summary:"needs you"};function fp(i,c){return`${i} ${c}${i>1?"s":""}`}function B0({item:i,onPermission:c,onAnswer:u,onPlanner:o,onOpen:d}){const[h,g]=m.useState(!1),[y,x]=m.useState(""),[v,S]=m.useState(!1),[b,j]=m.useState("");m.useEffect(()=>{g(!1),x(""),S(!1),j("")},[i.id]);const k=async U=>{if(!h){g(!0),x("");try{const F=await U();F&&(x(F),g(!1))}catch(F){x(F instanceof Error?F.message:String(F)),g(!1)}}},B=U=>i.kind==="planner"?k(()=>o(i,U)):k(()=>u(i,U)),K=()=>{const U=b.trim();U&&B(U)},M=Array.isArray(i.options)&&i.options.length>0,z=i.kind==="question"||i.kind==="planner",D=z&&(v||!M);return a.jsxs("div",{className:h?void 0:"pulse",style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",padding:"var(--sp-3) var(--sp-4)",background:"var(--brand-wash-strong)",border:"1px solid var(--status-warning)",borderLeft:"var(--accent-w) solid var(--status-warning)",borderRadius:"var(--r-md)",opacity:h?.7:1,transition:"opacity var(--dur-fast) var(--ease)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",minWidth:0,fontSize:"var(--fs-sm)"},children:[a.jsx(ie,{name:i.kind==="permission"?"approval":i.kind==="summary"?"needsYou":"question",size:14,strokeWidth:2,color:"var(--status-warning)",style:{alignSelf:"center",flex:"0 0 auto"}}),a.jsx("span",{style:{fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",flex:"0 0 auto"},children:i.projectName}),a.jsx("span",{style:{color:"var(--status-warning)",fontWeight:"var(--fw-medium)",flex:"0 0 auto"},children:U0[i.kind]??i.kind}),a.jsx("span",{title:i.text,style:{color:"var(--ink-0)",minWidth:0,flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.text}),typeof i.since=="number"&&a.jsxs("span",{style:{color:"var(--ink-2)",fontSize:"var(--fs-xs)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:["waiting ",Pp(i.since)]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[i.kind==="permission"&&a.jsxs(a.Fragment,{children:[a.jsx(se,{size:"sm",variant:"good",disabled:h,onClick:()=>{k(()=>c(i,"allow"))},children:"Allow"}),a.jsx(se,{size:"sm",variant:"danger",disabled:h,onClick:()=>{k(()=>c(i,"deny"))},children:"Deny"})]}),z&&M&&i.options.map((U,F)=>a.jsxs("button",{type:"button",disabled:h,onClick:()=>{B(U)},title:F===0?"Recommended":void 0,style:{display:"inline-flex",alignItems:"center",gap:5,padding:"4px 10px",borderRadius:"var(--r-sm)",cursor:h?"default":"pointer",font:"inherit",fontSize:"var(--fs-sm)",textAlign:"left",maxWidth:360,background:"var(--bg-card)",border:"1px solid var(--line-strong)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[F===0&&a.jsx("span",{style:{color:"var(--status-warning)",fontSize:"var(--fs-xs)"},children:"★"}),U]},U)),z&&M&&!v&&a.jsx(se,{size:"sm",variant:"ghost",disabled:h,onClick:()=>S(!0),children:"type…"}),D&&a.jsxs("form",{onSubmit:U=>{U.preventDefault(),K()},style:{display:"flex",alignItems:"center",gap:6,flex:"1 1 16rem",minWidth:0},children:[a.jsx("input",{autoFocus:v,value:b,disabled:h,placeholder:i.kind==="planner"?"Answer the planner…":"Answer the director…",onChange:U=>j(U.target.value),onKeyDown:U=>{U.key==="Escape"&&M&&(S(!1),j(""))},style:{flex:"1 1 auto",minWidth:0,font:"inherit",fontSize:"var(--fs-sm)",padding:"4px 8px",borderRadius:"var(--r-sm)",background:"var(--bg-card)",border:"1px solid var(--line-strong)",color:"var(--ink-0)",outline:"none"}}),a.jsx(se,{size:"sm",type:"submit",icon:"send",disabled:h||!b.trim(),children:"Send"})]}),a.jsx("span",{style:{marginLeft:"auto",flex:"0 0 auto"},children:a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>d?.(i.projectId),title:"Open the project for the full context",children:"open"})})]}),y&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"var(--fs-xs)",color:"var(--text-danger)"},children:[a.jsx(ie,{name:"caution",size:12,strokeWidth:2}),y]})]})}function q0({items:i=[],onPermission:c,onAnswer:u,onPlanner:o,onOpen:d,style:h}){return i.length?a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",...h},children:i.map(g=>a.jsx(B0,{item:g,onPermission:c,onAnswer:u,onPlanner:o,onOpen:d},`${g.projectId}:${g.kind}:${g.id??""}`))}):null}function L0({approvals:i=0,questions:c=0,planner:u=!1}){const o=[];i>0&&o.push(fp(i,"approval"));const d=u?c-1:c;return d>0&&o.push(fp(d,"question")),u&&o.push("the planner is asking"),o.join(", ")}function $0(i){const c=Math.max(0,Math.round(Number(i)||0)/1e3);if(c<60)return`${Math.round(c)}s`;const u=Math.round(c/60);return u<60?`${u}m`:`${Math.floor(u/60)}h ${String(u%60).padStart(2,"0")}m`}function Nl(i){return i>=1e6?`${(i/1e6).toFixed(1)}m`:i>=1e3?`${(i/1e3).toFixed(1)}k`:String(i)}const Y0=i=>i?i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheWriteTokens:0,G0="repeating-linear-gradient(-45deg, var(--line-strong) 0 3px, transparent 3px 7px)";function ev({spent:i,budget:c,costBasis:u="priced",usage:o=null,turns:d,elapsedMs:h,detail:g=!1,style:y}){const x=typeof h=="number"&&h>0?` · ${$0(h)}`:"";if(i=Number(i)||0,c=Number(c)||0,u!=="priced"){const j=u==="unpriced",k=Y0(o);return a.jsxs("div",{title:j?"Real spend, on an account Foreman cannot price — no table for this endpoint, or a plan being drawn down. Check the provider for the bill; turns and tokens are all that is known here.":"Runs on hardware you already own, so nothing is billed per token. Turns and tokens are the only real units.",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:170,...y},children:[a.jsx("div",{style:{flex:1,height:"var(--meter-h)",background:"var(--bg-inset)",borderRadius:2,overflow:"hidden",backgroundImage:j?G0:void 0}}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-sm)",color:"var(--ink-1)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[g?`${Nl(o?.inputTokens??0)} in · ${Nl(o?.outputTokens??0)} out`:`${Nl(k)} tok`,typeof d=="number"?` · ${d} turn${d===1?"":"s"}`:"",x]})]})}const v=c>0?Math.min(i/c,1):0,S=v>=.9?"critical":v>=.7?"warning":"ok",b=S==="critical"?"var(--status-critical)":S==="warning"?"var(--status-warning)":"var(--brand)";return a.jsxs("div",{title:`$${i.toFixed(2)} spent of $${c.toFixed(2)} budget`,style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:170,...y},children:[a.jsx("div",{style:{flex:1,height:"var(--meter-h)",background:"var(--bg-inset)",borderRadius:2,overflow:"hidden"},children:a.jsx("div",{style:{width:`${v*100}%`,height:"100%",background:b,transition:"width var(--dur-meter)"}})}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-sm)",color:"var(--ink-1)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[S!=="ok"&&a.jsx(ie,{name:S,size:12,strokeWidth:2.25,color:b}),"$",i.toFixed(2)," / $",c.toFixed(0),x]})]})}function X0({name:i,folder:c,title:u,mission:o,activity:d,costUsd:h,budgetUsd:g,costBasis:y,usage:x,turns:v,directorModel:S,workerModel:b,createdAt:j,onOpen:k,style:B}){const[K,M]=m.useState(!1),z=[S,b].filter(Boolean);return a.jsxs("div",{role:"button",tabIndex:0,onClick:k,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),k?.())},onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),style:{display:"grid",gridTemplateColumns:"minmax(9rem, 12rem) minmax(0, 1fr) minmax(11rem, 15rem) auto",gap:"var(--sp-4)",alignItems:"center",padding:"var(--sp-3) var(--sp-4)",cursor:"pointer",background:K?"var(--bg-hover)":"transparent",borderLeft:`var(--accent-w) solid ${K?"var(--brand)":"transparent"}`,transition:"background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease)",...B},children:[a.jsxs("div",{style:{minWidth:0},children:[a.jsx("div",{style:{fontSize:"var(--fs-md)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),a.jsx("div",{title:c,style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:rr(c)})]}),a.jsxs("div",{style:{minWidth:0},children:[a.jsx("div",{title:o,style:{fontSize:"var(--fs-md)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u||o}),d&&a.jsx("div",{className:"ticker",title:d,style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d},d)]}),a.jsx(ev,{spent:h,budget:g,costBasis:y,usage:x,turns:v}),a.jsxs("div",{style:{textAlign:"right",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[z.length>0&&a.jsx("div",{title:"director · worker",style:{maxWidth:"16rem",overflow:"hidden",textOverflow:"ellipsis"},children:z.join(" · ")}),typeof j=="number"&&a.jsx("div",{children:Pp(j)})]})]})}function Q0(i){return new Date(i).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ec(){return a.jsx("span",{style:{color:"var(--ink-2)",opacity:.6},children:"·"})}function V0({name:i,folder:c,lastRun:u,onOpen:o,onUnlink:d,style:h}){const[g,y]=m.useState(!1),[x,v]=m.useState(!1),S=u?.usage?u.usage.inputTokens+u.usage.outputTokens:null;return a.jsxs("article",{role:"button",tabIndex:0,onClick:o,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),o?.())},onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),style:{background:"var(--bg-card)",borderRadius:"var(--r-md)",cursor:"pointer",border:`1px solid ${g?"var(--line-strong)":"var(--line)"}`,padding:"var(--sp-3) var(--sp-4)",display:"flex",flexDirection:"column",gap:6,minWidth:0,transition:"border-color var(--dur-fast) var(--ease)",...h},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",minWidth:0},children:[a.jsx("span",{style:{fontSize:"var(--fs-md)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),a.jsx("span",{title:c,style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginLeft:"auto"},children:rr(c)})]}),u?a.jsxs(a.Fragment,{children:[a.jsx("div",{title:u.mission,style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.title||u.mission}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:[a.jsx(fl,{status:u.status}),u.createdAt&&a.jsxs(a.Fragment,{children:[a.jsx(Ec,{}),Q0(u.createdAt)]}),u.costBasis==="priced"?a.jsxs(a.Fragment,{children:[a.jsx(Ec,{}),"$",(Number(u.costUsd)||0).toFixed(2)]}):S!==null?a.jsxs(a.Fragment,{children:[a.jsx(Ec,{}),Nl(S)," tok"]}):null]})]}):a.jsx("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:"No missions yet — open to compose one."}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",height:14,marginTop:-2},children:a.jsxs("button",{type:"button",tabIndex:g?0:-1,onClick:b=>{b.stopPropagation(),d?.()},onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),title:"Unlink project (run history is kept)",style:{display:"inline-flex",alignItems:"center",gap:4,background:"none",border:"none",cursor:"pointer",padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:x?"var(--ink-0)":"var(--ink-2)",opacity:g?1:0,pointerEvents:g?"auto":"none",transition:"opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease)"},children:[a.jsx(ie,{name:"unlink",size:11}),"Unlink"]})})]})}function W0({onClick:i,style:c}){const[u,o]=m.useState(!1);return a.jsxs("div",{role:"button",onClick:i,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{border:`1px dashed ${u?"var(--ink-2)":"var(--line-strong)"}`,borderRadius:"var(--r-md)",minHeight:"var(--card-min-h)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--sp-2)",cursor:"pointer",color:u?"var(--ink-0)":"var(--ink-1)",background:u?"var(--bg-hover)":"transparent",transition:"border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease)",...c},children:[a.jsx(ie,{name:"add",size:22,strokeWidth:1.5}),a.jsx("span",{style:{fontSize:"var(--fs-sm)"},children:"Link a project"}),a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"or drop a folder anywhere"})]})}const hp={ok:{icon:"done",color:"var(--status-good)"},warn:{icon:"caution",color:"var(--status-serious)"},error:{icon:"critical",color:"var(--status-critical)"}};function K0({load:i,onSettings:c,onInstallBrowser:u,install:o,style:d}){const[h,g]=m.useState(null),[y,x]=m.useState(!1),[v,S]=m.useState(null),b=async()=>{x(!0),S(null);try{const k=await i();if(!k.ok)throw new Error(`HTTP ${k.status}`);g((await k.json()).checks??[])}catch(k){S(k instanceof Error?k.message:String(k))}finally{x(!1)}};m.useEffect(()=>{b()},[]);const j=(h??[]).filter(k=>k.status!=="ok").length;return a.jsxs("section",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-md)",background:"var(--bg-card)",padding:"var(--sp-3) var(--sp-4)",textAlign:"left",display:"flex",flexDirection:"column",gap:"var(--sp-2)",...d},children:[a.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsx("span",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)",flex:1},children:"This machine"}),h&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:j?"var(--status-serious)":"var(--ink-2)"},children:j?`${j} thing${j===1?"":"s"} to look at`:"ready"}),a.jsx(se,{variant:"ghost",size:"sm",icon:y?"loading":"resume",onClick:b,disabled:y,children:"Check again"}),a.jsx(se,{variant:"ghost",size:"sm",onClick:()=>{window.location.hash="#/setup"},children:"Walk-through"})]}),v&&a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--status-critical)"},children:["Could not run the checks: ",v]}),!h&&!v&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Checking…"}),h&&a.jsx("div",{style:{display:"flex",flexDirection:"column"},children:h.map(k=>{const B=hp[k.status]||hp.warn;return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"16px minmax(0, 1fr)",columnGap:"var(--sp-2)",padding:"5px 0",borderTop:"1px solid var(--line)",fontSize:"var(--fs-sm)"},children:[a.jsx(ie,{name:B.icon,size:14,color:B.color,style:{marginTop:2}}),a.jsxs("div",{style:{minWidth:0},children:[a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"baseline",minWidth:0},children:[a.jsx("span",{style:{color:"var(--ink-0)",flex:"0 0 auto"},children:k.name}),a.jsx("span",{style:{color:"var(--ink-2)",minWidth:0,overflowWrap:"anywhere"},children:k.detail})]}),k.fix&&k.status!=="ok"&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-1)",marginTop:2,overflowWrap:"anywhere"},children:k.fix}),k.name==="Browser"&&k.status!=="ok"&&!/install-deps/.test(k.fix||"")&&u&&a.jsxs("div",{style:{marginTop:4,display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[a.jsx(se,{size:"sm",icon:o?.state==="running"?"loading":"add",disabled:o?.state==="running",onClick:u,children:o?.state==="running"?"Installing…":"Install Playwright Chromium"}),o&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:o.state==="error"?"var(--status-critical)":"var(--ink-2)",fontFamily:"var(--font-mono)"},children:o.state==="error"?o.error:o.progress})]})]})]},k.name)})}),a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:["A project can run on a provider of its own — an Anthropic API key, a Codex login or any OpenAI-compatible endpoint — from"," ",a.jsx("button",{type:"button",onClick:c,style:{background:"none",border:"none",padding:0,font:"inherit",color:"var(--brand)",cursor:"pointer",textDecoration:"underline"},children:"Settings → Provider"})," ","once it is linked."]})]})}function Ai({width:i=480,children:c,onClose:u,dismissible:o=!0,style:d}){return a.jsx("div",{onClick:h=>{o&&h.target===h.currentTarget&&u?.()},style:{position:"fixed",inset:0,background:"var(--scrim)",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx("div",{style:{width:i,maxHeight:"70vh",display:"flex",flexDirection:"column",background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",overflow:"hidden",...d},children:c})})}function Pc({children:i,style:c}){return a.jsx("div",{style:{padding:"var(--sp-3)",borderBottom:"1px solid var(--line)",wordBreak:"break-all",...c},children:i})}function Di({children:i,style:c}){return a.jsx("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center",padding:"var(--sp-3)",borderTop:"1px solid var(--line)",...c},children:i})}function We({value:i,onChange:c,placeholder:u,type:o="text",min:d,max:h,step:g,width:y,mono:x,prefix:v,autoFocus:S,onKeyDown:b,style:j}){const k=a.jsx("input",{type:o,min:d,max:h,step:g,value:i,autoFocus:S,placeholder:u,onKeyDown:b,onChange:B=>c?.(o==="number"?Number(B.target.value):B.target.value),style:{width:v?"100%":y??"100%",background:v?"transparent":"var(--bg-card)",border:v?"none":"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",padding:v?"6px 9px 6px 0":"6px 9px",color:"var(--ink-0)",outline:v?"none":void 0,fontFamily:x?"var(--font-mono)":"var(--font-ui)",...v?null:j}});return v?a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",width:y??"100%",boxSizing:"border-box",background:"var(--bg-card)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",paddingLeft:9,...j},children:[a.jsx("span",{style:{color:"var(--ink-2)",marginRight:4,userSelect:"none"},children:v}),k]}):k}function dn({tabs:i,value:c,onChange:u,size:o="md",style:d}){return a.jsx("div",{role:"tablist",style:{display:"inline-flex",gap:2,padding:2,background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",...d},children:i.map(h=>a.jsx(Z0,{tab:h,selected:h.value===c,size:o,onSelect:()=>u?.(h.value)},h.value))})}function Z0({tab:i,selected:c,size:u,onSelect:o}){const[d,h]=m.useState(!1);return a.jsxs("button",{type:"button",role:"tab","aria-selected":c,onClick:o,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{display:"inline-flex",alignItems:"center",gap:6,padding:u==="sm"?"3px 8px":"5px 10px",borderRadius:4,border:"none",cursor:"pointer",fontSize:u==="sm"?"var(--fs-xs)":"var(--fs-sm)",fontWeight:c?"var(--fw-semibold)":"var(--fw-regular)",background:c?"var(--bg-card)":d?"var(--bg-hover)":"transparent",color:c?"var(--ink-0)":"var(--ink-1)",whiteSpace:"nowrap",boxShadow:c?"inset 0 0 0 1px var(--line-strong)":"none",transition:"background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease)"},children:[i.icon&&a.jsx(ie,{name:i.icon,size:u==="sm"?12:14}),i.label,i.count>0&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",padding:"0 5px",borderRadius:"var(--r-pill)",lineHeight:"16px",background:i.attention?"var(--status-warning)":"var(--line-strong)",color:i.attention?"var(--brand-ink)":"var(--ink-0)",fontWeight:"var(--fw-semibold)"},children:i.count})]})}function pp({children:i,icon:c,onClick:u}){const[o,d]=m.useState(!1);return a.jsxs("div",{role:"button",onClick:u,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:8,padding:"7px 12px",cursor:"pointer",fontSize:"var(--fs-md)",background:o?"var(--bg-card)":"transparent",transition:"background var(--dur-fast) var(--ease)"},children:[a.jsx(ie,{name:c,size:15,color:"var(--ink-1)"}),i]})}function F0({path:i="…",parent:c,dirs:u=[],error:o,onNavigate:d,onCreate:h,onPick:g,onClone:y,cloneWhere:x,clone:v,onClose:S}){const[b,j]=m.useState("folder"),[k,B]=m.useState(!1),[K,M]=m.useState(""),[z,D]=m.useState(""),[U,F]=m.useState(""),[re,q]=m.useState(null),N=v?.state==="running",Y=!!z.trim()&&!!re?.dest&&!N;m.useEffect(()=>{if(!x)return;const Q=z.trim();if(!Q){q(null);return}let J=!1;const ge=setTimeout(()=>{Promise.resolve(x(Q)).then(oe=>{J||q(oe)}).catch(()=>{J||q(null)})},250);return()=>{J=!0,clearTimeout(ge)}},[z,x]);const G=()=>{Y&&y?.(z.trim(),U.trim()||void 0)},fe=b==="git"&&y;return a.jsxs(Ai,{width:520,onClose:N?void 0:S,children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)",padding:"var(--sp-3) var(--sp-3) var(--sp-2)"},children:[a.jsx("span",{style:{fontWeight:"var(--fw-semibold)"},children:"Link a project"}),y&&a.jsx(dn,{size:"sm",value:b,onChange:Q=>{N||j(Q)},style:{marginLeft:"auto"},tabs:[{value:"folder",label:"Folder on this machine",icon:"folder"},{value:"git",label:"Git repository",icon:"provider"}]})]}),fe?a.jsxs("div",{style:{padding:"0 var(--sp-3) var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("label",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Repository"}),a.jsx(We,{autoFocus:!0,placeholder:"https://github.com/owner/repo · git@host:owner/repo.git · owner/repo",value:z,onChange:D,disabled:N,onKeyDown:Q=>{Q.key==="Enter"&&G()}})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsxs("label",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Branch ",a.jsx("span",{style:{color:"var(--ink-3, var(--ink-2))"},children:"· optional, the default branch otherwise"})]}),a.jsx(We,{placeholder:"main",value:U,onChange:F,disabled:N,width:220,onKeyDown:Q=>{Q.key==="Enter"&&G()}})]}),a.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",display:"flex",flexDirection:"column",gap:4},children:[!z.trim()&&a.jsx("span",{children:"Will be cloned under your projects root and linked as a project. Paste a URL to see the exact folder."}),z.trim()&&re?.dest&&a.jsxs("span",{children:["Will be cloned to ",a.jsx("span",{style:{fontFamily:"var(--font-mono)",color:"var(--brand)"},children:re.dest})," and linked as ",a.jsx("b",{style:{color:"var(--ink-1)"},children:re.name}),"."]}),z.trim()&&re&&!re.dest&&a.jsx("span",{style:{color:"var(--status-error)"},children:re.error}),z.trim()&&!re&&a.jsx("span",{children:"Checking…"}),a.jsxs("span",{children:["Runs ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"git clone"})," as you, with your own SSH keys and credential helpers. Foreman never asks for a token. Full clone, so the deck can diff against it."]})]}),v?.state==="running"&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-1)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v.progress||"Starting git…"}),v?.state==="error"&&a.jsx(ot,{tone:"error",inline:!0,style:{fontSize:"var(--fs-xs)"},children:v.error})]}):a.jsxs(a.Fragment,{children:[a.jsx(Pc,{style:{font:"var(--fs-sm) var(--font-mono)",color:"var(--brand)"},children:i}),a.jsxs("div",{style:{overflowY:"auto",flex:1},children:[c&&a.jsx(pp,{icon:"parent",onClick:()=>d?.(c),children:".."}),u.map(Q=>a.jsx(pp,{icon:"folder",onClick:()=>d?.(`${i}${i.endsWith("/")?"":"/"}${Q}`),children:Q},Q)),u.length===0&&a.jsx("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:"No subfolders."})]}),k&&a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center",padding:"var(--sp-2) var(--sp-3)",borderTop:"1px solid var(--line)"},children:[a.jsx(We,{autoFocus:!0,placeholder:"New folder name",value:K,onChange:M,onKeyDown:Q=>{Q.key==="Enter"&&h?.(K)},style:{flex:1}}),a.jsx(se,{variant:"good",onClick:()=>h?.(K),children:"Create"})]}),o&&a.jsx("div",{style:{padding:"4px var(--sp-3)"},children:a.jsx(ot,{tone:"error",inline:!0,style:{fontSize:"var(--fs-xs)"},children:o})})]}),a.jsxs(Di,{children:[fe?null:a.jsx(se,{icon:"add",onClick:()=>B(!k),title:"Create a subfolder here",children:"New folder"}),a.jsx("span",{style:{flex:1}}),a.jsx(se,{onClick:S,disabled:N,children:"Cancel"}),fe?a.jsx(se,{variant:"primary",disabled:!Y,onClick:G,children:N?"Cloning…":"Clone & link"}):a.jsx(se,{variant:"primary",onClick:()=>g?.(i),children:"Select this folder"})]})]})}function J0({name:i,matches:c,onPick:u,onClose:o}){const[d,h]=m.useState(null);return a.jsxs(Ai,{width:520,onClose:o,style:{maxHeight:"60vh"},children:[a.jsxs(Pc,{children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontWeight:"var(--fw-semibold)"},children:[a.jsx(ie,{name:"folder",size:16,color:"var(--ink-1)"}),i]}),a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginTop:2},children:"Browsers hide dropped folders' full paths — pick the matching location."})]}),a.jsxs("div",{style:{overflowY:"auto",flex:1},children:[c==null&&a.jsx("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:"Searching your home folder…"}),c?.map(g=>a.jsx("div",{role:"button",onClick:()=>u?.(g),onMouseEnter:()=>h(g),onMouseLeave:()=>h(null),style:{padding:"8px 12px",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",background:d===g?"var(--bg-card)":"transparent",transition:"background var(--dur-fast) var(--ease)"},children:g},g)),c?.length===0&&a.jsxs("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:["No folder named “",i,"” found under your home directory — use the folder picker instead."]})]}),a.jsx(Di,{style:{justifyContent:"flex-end"},children:a.jsx(se,{onClick:o,children:"Cancel"})})]})}function I0({children:i="Drop a folder to link it"}){return a.jsxs("div",{style:{position:"absolute",inset:8,zIndex:5,pointerEvents:"none",border:"2px dashed var(--brand)",borderRadius:"var(--r-md)",background:"var(--brand-wash)",display:"flex",alignItems:"center",gap:10,justifyContent:"center",color:"var(--brand)",fontSize:"var(--fs-lg)"},children:[a.jsx(ie,{name:"folder",size:20}),i]})}function P0({title:i,body:c,confirmLabel:u="Confirm",tone:o="danger",icon:d,onConfirm:h,onCancel:g}){return a.jsxs(Ai,{width:420,onClose:g,children:[a.jsx(Pc,{children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontWeight:"var(--fw-semibold)"},children:[d&&a.jsx(ie,{name:d,size:16,color:o==="danger"?"var(--status-critical)":"var(--ink-1)"}),i]})}),a.jsx("div",{style:{padding:"var(--sp-3)",fontSize:"var(--fs-md)",color:"var(--ink-1)",lineHeight:"var(--lh-prose)"},children:c}),a.jsxs(Di,{style:{justifyContent:"flex-end"},children:[a.jsx(se,{onClick:g,children:"Cancel"}),a.jsx(se,{variant:o,onClick:h,children:u})]})]})}const vp="foreman.fleet.desk";function e1(){const[i,c]=m.useState(()=>{try{return localStorage.getItem(vp)!=="closed"}catch{return!0}});return[i,()=>c(o=>{try{localStorage.setItem(vp,o?"closed":"open")}catch{}return!o})]}function t1({onSettings:i,open:c,onToggle:u}){const o=$p(Bm),[d,h]=m.useState(null),g=m.useRef(null),y=o.entries.filter(j=>j.kind!=="tool"),[x,v]=m.useState(!1),S=m.useRef(0);m.useEffect(()=>{c?(S.current=y.length,v(!1)):y.length>S.current&&!o.thinking&&v(!0)},[c,y.length,o.thinking]),m.useEffect(()=>{c&&g.current?.scrollIntoView({block:"end"})},[y.length,o.thinking,c]);const b=async j=>h(await o.send(j));return c?a.jsxs("aside",{style:{width:"clamp(22rem, 28vw, 30rem)",flex:"0 0 auto",minHeight:0,display:"flex",flexDirection:"column",borderLeft:"1px solid var(--line)",background:"var(--bg-panel)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",flex:"0 0 auto"},children:[a.jsx("span",{style:{color:"var(--ink-0)",fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)"},children:"Front desk"}),a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:"the same conversation as your phone"}),a.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",gap:"var(--sp-1)",alignItems:"center",flex:"0 0 auto"},children:[o.costUsd>0&&a.jsxs("span",{title:"What this conversation has cost. Not charged to any mission.",style:{fontVariantNumeric:"tabular-nums",marginRight:"var(--sp-1)"},children:["$",o.costUsd.toFixed(2)]}),y.length>0&&!o.thinking&&a.jsx(se,{variant:"ghost",size:"sm",onClick:()=>{o.clear()},title:"Forget this conversation; the next message starts fresh",children:"Forget"}),a.jsx(Ol,{icon:"chevronRight",label:"Fold the front desk away",onClick:u})]})]}),a.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[y.length===0&&!o.thinking&&a.jsx(Fe,{children:"Ask how things are going, or say what you want started where. It knows every project, can open a planning conversation, propose a mission, or pass a note to a running director. It never starts a run or answers an approval for you."}),y.map(j=>a.jsx(Ic,{agent:j.agent,title:j.title,kind:j.kind,body:j.body,ts:j.ts},j.id)),a.jsx("div",{ref:g})]}),a.jsxs("div",{style:{flex:"0 0 auto",padding:"var(--sp-2) var(--sp-3) var(--sp-3)",borderTop:"1px solid var(--line)"},children:[a.jsx(Xc,{busy:o.thinking,who:o.who,placeholder:"How is everything going?",attach:!1,hint:"Knows the fleet. Never starts a run or answers for you.",busyHint:"The front desk is looking…",onSend:j=>{b(j)},onStop:()=>{o.stop()},onChangeModel:i}),d&&a.jsx(ot,{tone:"error",inline:!0,style:{marginTop:4},children:d})]})]}):a.jsx("aside",{style:{flex:"0 0 auto",borderLeft:"1px solid var(--line)",background:"var(--bg-panel)",display:"flex",flexDirection:"column",alignItems:"center",padding:"var(--sp-2) 4px"},children:a.jsxs("button",{type:"button",onClick:u,title:o.thinking?"The front desk is replying — open it":x?"The front desk answered — open it":"Open the front desk (the same conversation as your phone)","aria-label":"Open the front desk",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,background:"none",border:0,padding:"6px 4px",cursor:"pointer",color:"var(--ink-2)",borderRadius:"var(--r-sm)",position:"relative"},children:[a.jsx(ie,{name:"chevronLeft",size:14}),a.jsx("span",{style:{writingMode:"vertical-rl",fontSize:"var(--fs-xs)",letterSpacing:".06em",textTransform:"uppercase"},children:"Front desk"}),(x||o.thinking)&&a.jsx("span",{"aria-hidden":!0,style:{position:"absolute",top:4,right:2,width:7,height:7,borderRadius:"50%",background:o.thinking?"var(--ink-2)":"var(--brand)"}})]})})}function n1(i,c){const u=i.activeRun??i.lastRun;return[i.name,i.folder,u?.title,u?.mission].some(o=>o?.toLowerCase().includes(c))}function l1(i){const c=[];for(const u of i){if(Array.isArray(u.needs)){const h=[...u.needs].sort((g,y)=>(g.since??0)-(y.since??0));for(const g of h)c.push({...g,projectId:u.id,projectName:u.name});continue}const o=u.pendingPermissions||0,d=u.pendingQuestions||0;o+d!==0&&c.push({projectId:u.id,projectName:u.name,kind:"summary",text:L0({approvals:o,questions:d,planner:!!u.plannerQuestion})})}return c}async function a1(i){return i.ok?null:(await i.json().catch(()=>({}))).error??(i.status===404?"already answered or timed out":`HTTP ${i.status}`)}function i1(i,c){const[u,o]=m.useState(!1),[d,h]=m.useState(null),[g,y]=m.useState(""),[x,v]=m.useState(null),S=async(k,B)=>{v({state:"running",progress:"Starting git…"});const K=await _e.cloneProject(k,B),M=await K.json().catch(()=>({}));if(!K.ok){v({state:"error",error:M.error??`HTTP ${K.status}`});return}const z=M.id,D=async()=>{const U=await _e.cloneStatus(z).catch(()=>null),F=U&&U.ok?await U.json():null;if(!F){v({state:"error",error:"Lost track of the clone. Check the projects root."});return}if(F.state==="running"){v({state:"running",progress:F.progress,dest:F.dest}),setTimeout(()=>{D()},1e3);return}if(F.state==="error"){v({state:"error",error:F.error});return}v(null),o(!1),h(null),F.projectId&&c(F.projectId)};D()},b=async k=>{y("");const B=await _e.browse(k);B.ok&&h(await B.json())},j=async k=>{if(!d)return;y("");const B=await _e.mkdir(d.path,k);B.ok?await b((await B.json().catch(()=>null))?.path??d.path):y((await B.json()).error)};return{open:u,show:()=>{o(!0),b()},close:()=>{x?.state!=="running"&&(o(!1),h(null),v(null))},props:d&&{path:d.path,parent:d.parent,dirs:d.dirs,error:g,onNavigate:k=>{b(k)},onCreate:k=>{j(k)},onPick:k=>{o(!1),h(null),i(k)},onClone:(k,B)=>{S(k,B)},cloneWhere:k=>_e.cloneWhere(k).then(B=>B.json()),clone:x}}}const _c={display:"flex",flexDirection:"column",gap:"var(--sp-2)"};function s1({projects:i,connected:c,activity:u,auth:o,onOpen:d,onOpenRun:h,refresh:g,theme:y,onToggleTheme:x,onSettings:v,query:S="",onQuery:b,search:j}){const[k,B]=m.useState(!1),[K,M]=e1(),[z,D]=m.useState(null),[U,F]=m.useState(null),re=async _=>{const Z=await _e.linkProject(_);Z.ok&&(g(),d((await Z.json()).project.id))},q=Gp(),N=i1(_=>{re(_)},_=>{g(),d(_)}),Y=S.trim().toLowerCase(),G=Y?i.filter(_=>n1(_,Y)):i,fe=l1(G),Q=G.filter(_=>_.activeRun).sort((_,Z)=>(Z.lastActivityAt??0)-(_.lastActivityAt??0)),J=G.filter(_=>!_.activeRun),ge=i.filter(_=>_.activeRun).length,oe=i.reduce((_,Z)=>_+(Array.isArray(Z.needs)?Z.needs.length:(Z.pendingPermissions||0)+(Z.pendingQuestions||0)),0),ne=ge===0&&oe===0,E=ne&&i.length>0?"all quiet":[ge>0?`${ge} running`:null,oe>0?`${oe} needs you`:null].filter(Boolean).join(" · "),$=async _=>{_.preventDefault(),B(!1);const Z=_.dataTransfer.items[0]?.webkitGetAsEntry?.();if(!Z?.isDirectory)return;D({name:Z.name,matches:null});const I=await _e.locate(Z.name);D({name:Z.name,matches:I.ok?(await I.json()).matches:[]})},P=async _=>{const Z=await a1(await _);return g(),Z},me=(_,Z)=>P(_e.permission(_.id,Z)),xe=(_,Z)=>P(_e.answer(_.id,Z)),T=(_,Z)=>P(fetch("/chat/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({projectId:_.projectId,id:_.id,answers:{[_.text]:Z}})}));return a.jsxs("div",{style:{height:"100%",overflow:"hidden",position:"relative",display:"flex",flexDirection:"column"},onDragOver:_=>{_.preventDefault(),B(!0)},onDragLeave:_=>{_.target===_.currentTarget&&B(!1)},onDrop:_=>{$(_)},children:[k&&a.jsx(I0,{}),a.jsxs(Ip,{mode:"fleet",subtitle:"mission control",theme:y,onToggleTheme:x,onSettings:v,search:j,children:[!c&&a.jsx(ot,{tone:"disconnected",inline:!0,children:"disconnected"}),c&&o.mode==="none"&&a.jsx(ot,{tone:"caution",inline:!0,children:"No model credentials on this machine, so missions cannot start. Sign in with Claude Code and restart Foreman, or give a project its own API key or endpoint in Settings → Provider."}),E&&a.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"2px 10px",borderRadius:"var(--r-pill)",border:`1px solid ${oe>0?"var(--status-warning)":ne?"var(--line)":"var(--line-strong)"}`,background:oe>0?"var(--brand-wash)":"transparent",fontSize:"var(--fs-xs)",color:ne?"var(--ink-3)":"var(--ink-1)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:E}),i.length>0&&a.jsx(se,{variant:"primary",icon:"add",onClick:N.show,title:"Link a folder as a project (or drop one anywhere on this page)",children:"Link project"})]}),a.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[a.jsxs("div",{style:{flex:1,minWidth:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:[Y&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",maxWidth:"var(--fleet-max)",margin:"0 auto",width:"100%",padding:"var(--sp-4) var(--sp-5) 0",boxSizing:"border-box",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsxs("span",{children:["Showing projects matching “",S.trim(),"” · ",a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[G.length," of ",i.length]})]}),a.jsx(se,{variant:"ghost",size:"sm",onClick:()=>b?.(""),children:"Show all"})]}),i.length===0?a.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--sp-3)",padding:"var(--sp-5)",textAlign:"center"},children:[a.jsx("div",{style:{width:"20rem",maxWidth:"100%"},children:a.jsx(W0,{onClick:N.show})}),a.jsx(Fe,{children:"No projects linked yet — link a folder to give the director a job site."}),a.jsx("div",{style:{width:"32rem",maxWidth:"100%",marginTop:"var(--sp-3)"},children:a.jsx(K0,{load:_e.doctor,onSettings:()=>v("provider"),onInstallBrowser:q.start,install:q.job})})]}):a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-5)",padding:"var(--sp-5)",maxWidth:"var(--fleet-max)",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:[G.length===0&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsxs(Fe,{children:["No project matches “",S.trim(),"”. Runs that do are in the search box above."]}),a.jsx(se,{variant:"ghost",size:"sm",onClick:()=>b?.(""),children:"Show all"})]}),fe.length===0&&Q.length===0&&G.length>0&&a.jsx(Fe,{children:"All quiet — nothing running, nothing waiting on you. Open a project to plan its next mission."}),fe.length>0&&a.jsxs("section",{style:_c,children:[a.jsxs(Rn,{children:["Needs you · ",fe.length]}),a.jsx(q0,{items:fe,onPermission:me,onAnswer:xe,onPlanner:T,onOpen:d})]}),Q.length>0&&a.jsxs("section",{style:_c,children:[a.jsxs(Rn,{children:["Running · ",Q.length]}),a.jsx("div",{style:{background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-md)",overflow:"hidden"},children:Q.map((_,Z)=>{const I=_.activeRun;return a.jsx(X0,{name:_.name,folder:_.folder,title:I.title,mission:I.mission,activity:u[_.id],costUsd:I.costUsd,budgetUsd:I.budgetUsd,costBasis:dl(I),usage:I.usage,turns:I.turns,directorModel:I.directorModel,workerModel:I.workerModel,createdAt:I.createdAt,onOpen:()=>d(_.id),style:Z>0?{borderTop:"1px solid var(--line)"}:void 0},_.id)})})]}),J.length>0&&a.jsxs("section",{style:_c,children:[a.jsxs(Rn,{children:["Recent · ",J.length]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"var(--sp-3)"},children:J.map(_=>a.jsx(V0,{name:_.name,folder:_.folder,lastRun:_.lastRun&&_.lastRun.status!=="idle"&&_.lastRun.status!=="running"?_.lastRun:null,onOpen:()=>{const Z=_.lastRun;Z?.id&&h&&(Z.status==="error"||Z.status==="interrupted")?h(_.id,Z.id):d(_.id)},onUnlink:()=>F(_)},_.id))})]})]})]}),i.length>0&&a.jsx(t1,{onSettings:v,open:K,onToggle:M})]}),N.open&&N.props&&a.jsx(F0,{...N.props,onClose:N.close}),z&&a.jsx(J0,{name:z.name,matches:z.matches,onPick:_=>{D(null),re(_)},onClose:()=>D(null)}),U&&a.jsx(P0,{title:`Unlink ${U.name}?`,body:"Foreman stops tracking this folder. Run history and its .foreman/ files stay on disk; you can link it again later.",confirmLabel:"Unlink",tone:"danger",icon:"unlink",onConfirm:()=>{const _=U.id;F(null),_e.unlinkProject(_).then(g)},onCancel:()=>F(null)})]})}const gp=["Welcome","Where missions run","Your phone","Reach & browser","Ready"],r1={ok:{icon:"done",color:"var(--status-good)"},warn:{icon:"caution",color:"var(--status-serious)"},none:{icon:"idle",color:"var(--ink-2)"}};function vt({tone:i,title:c,children:u}){const o=r1[i];return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"20px minmax(0, 1fr)",columnGap:"var(--sp-2)",padding:"var(--sp-2) 0",borderTop:"1px solid var(--line)"},children:[a.jsx(ie,{name:o.icon,size:16,color:o.color,style:{marginTop:2}}),a.jsxs("div",{style:{minWidth:0},children:[a.jsx("div",{style:{color:"var(--ink-0)",fontWeight:"var(--fw-semibold)"},children:c}),u&&a.jsx("div",{style:{color:"var(--ink-1)",marginTop:2,lineHeight:"var(--lh)"},children:u})]})]})}function Kt({children:i}){return a.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:"0.92em",background:"var(--bg-inset)",padding:"1px 5px",borderRadius:"var(--r-xs, 3px)"},children:i})}function o1({onDone:i,onSettings:c}){const[u,o]=m.useState(0),[d,h]=m.useState(null),[g,y]=m.useState(!1),[x,v]=m.useState(null),S=async()=>{y(!0),v(null);try{const M=await _e.doctor();if(!M.ok)throw new Error(`HTTP ${M.status}`);h(await M.json())}catch(M){v(M instanceof Error?M.message:String(M))}finally{y(!1)}};m.useEffect(()=>{S()},[]),m.useEffect(()=>{u>0&&S()},[u]);const b=Gp(()=>{S()}),j=b.job?.state==="running",k=d?d.auth.mode==="none"&&!d.ollama&&!d.codex:!1,B=u===gp.length-1,K=()=>{if(u===0)return a.jsxs(a.Fragment,{children:[a.jsx("h1",{style:Ci,children:"Foreman runs missions on your projects."}),a.jsx("p",{style:za,children:"You link a folder, talk over what should happen with a planner that reads the code and never changes it, and start a mission with a budget. A director plans the work, hires workers, verifies what they did and stops at the cap. You approve what matters — from here or from your phone — and read the result: the files that changed, the screenshots, the branch, a pull request when you want one."}),a.jsx("p",{style:za,children:"The next four pages show what this machine has for that. Nothing on them is required; anything missing says how to get it."})]});if(!d)return a.jsx("p",{style:za,children:x?`Could not read this machine: ${x}`:"Reading this machine…"});if(u===1){const z=d.auth;return a.jsxs(a.Fragment,{children:[a.jsx("h1",{style:Ci,children:k?"Nothing to run missions on yet.":"Where missions run."}),a.jsx("p",{style:za,children:"Missions run through a model provider. By default that is the Claude Code install on this machine, and whoever it is signed in as pays. A project can also have a provider of its own."}),a.jsxs("div",{children:[z.mode==="subscription"&&a.jsxs(vt,{tone:"ok",title:`Claude Code is signed in${z.account?.email?` as ${z.account.email}`:""}`,children:["Missions bill that subscription",z.account?.org?` (${z.account.org})`:"",". Source: ",a.jsx(Kt,{children:z.source}),"."]}),z.mode==="api-key"&&a.jsxs(vt,{tone:"ok",title:"An Anthropic API key is set in the environment",children:["Missions bill that key, per token. Source: ",a.jsx(Kt,{children:z.source}),"."]}),z.mode==="cloud"&&a.jsx(vt,{tone:"ok",title:`Claude through ${z.source}`,children:"Missions bill that cloud account."}),z.mode==="none"&&a.jsxs(vt,{tone:"warn",title:"Claude Code is not signed in on this machine",children:["Until it is, or a project gets a provider of its own, nothing can run. Three ways forward:",a.jsxs("ol",{style:{margin:"var(--sp-2) 0 0",paddingLeft:"1.2em",display:"flex",flexDirection:"column",gap:4},children:[a.jsxs("li",{children:["In a terminal, run ",a.jsx(Kt,{children:"claude"}),", then ",a.jsx(Kt,{children:"/login"}),". Restart Foreman and press ",a.jsx("em",{children:"Check again"}),"."]}),a.jsxs("li",{children:["Start Foreman with ",a.jsx(Kt,{children:"ANTHROPIC_API_KEY"})," set. The key is billed per token."]}),a.jsx("li",{children:"Link a project, then give it an Anthropic API key, a Codex login or any OpenAI-compatible endpoint in Settings → Provider."})]})]}),d.ollama&&a.jsxs(vt,{tone:"ok",title:`Ollama is running with ${d.ollama.models} model${d.ollama.models===1?"":"s"}`,children:[d.ollama.local," served from this machine at no cost per token; the rest are cloud models Ollama proxies. They appear in every model picker."]}),d.codex&&a.jsx(vt,{tone:"ok",title:`Codex is signed in, ${d.codex.models} model${d.codex.models===1?"":"s"}`,children:"Runs on the ChatGPT subscription. In every model picker as well."}),!d.ollama&&!d.codex&&z.mode!=="none"&&a.jsx(vt,{tone:"none",title:"No local Ollama or Codex",children:"Not needed. If either is installed later, its models show up in the pickers on their own."})]})]})}if(u===2){const z=d.phone;return a.jsxs(a.Fragment,{children:[a.jsx("h1",{style:Ci,children:"Your phone."}),a.jsx("p",{style:za,children:"Foreman can reach you on Telegram: an approval to tap, a question to answer, a mission that finished, a budget alert. From there you can also talk to the front desk and start planning. Optional, and the bot token is only ever typed into Settings."}),a.jsxs("div",{children:[z?.label&&a.jsxs(vt,{tone:"ok",title:`Linked to ${z.label}`,children:["Through ",z.bot?a.jsxs(Kt,{children:["@",z.bot.replace(/^@/,"")]}):"your bot","."]}),z&&!z.label&&a.jsxs(vt,{tone:"warn",title:"A bot is configured but no chat is linked yet",children:["Send it ",a.jsx(Kt,{children:"/start"})," from your phone to link this chat."]}),!z&&a.jsxs(vt,{tone:"none",title:"Not set up",children:["Create a bot with @BotFather, paste its token in Settings → Notifications, then send it ",a.jsx(Kt,{children:"/start"}),"."]})]}),a.jsx("div",{children:a.jsx(se,{variant:"ghost",size:"sm",icon:"needsYou",onClick:()=>c("notifications"),children:"Settings → Notifications"})})]})}if(u===3){const z=d.tailnet,D=d.browser;return a.jsxs(a.Fragment,{children:[a.jsx("h1",{style:Ci,children:"Reach, and a browser for the crew."}),a.jsxs("div",{children:[z?a.jsxs(vt,{tone:"ok",title:`On a tailnet: ${z.dnsName??z.ip}`,children:["The dashboard is also at ",a.jsx(Kt,{children:z.url}),z.https?", over HTTPS":"",". Phone links open there.",!z.https&&a.jsxs(a.Fragment,{children:[" For HTTPS, ",a.jsx(Kt,{children:"tailscale serve"})," can front it; Foreman never opens a Funnel."]})]}):a.jsx(vt,{tone:"none",title:"This machine only",children:"The dashboard listens on localhost. With Tailscale installed it also listens on the tailnet, so the phone can open links; nothing is ever exposed to the internet."}),D&&a.jsxs(vt,{tone:D.status==="ok"?"ok":"warn",title:D.status==="ok"?"A browser for missions":/install-deps/.test(D.fix??"")?"A browser is installed, but it cannot start here":"No browser for missions",children:[D.detail,D.status!=="ok"&&D.fix&&/install-deps/.test(D.fix)&&a.jsxs(a.Fragment,{children:[a.jsx("br",{}),D.fix,a.jsx("br",{}),"That is the one step Foreman will not do for you: it never runs anything as root. Once the libraries are in, press ",a.jsx("em",{children:"Check again"}),". Missions that do not need a browser are unaffected."]}),D.status!=="ok"&&!/install-deps/.test(D.fix??"")&&a.jsxs(a.Fragment,{children:[a.jsx("br",{}),"Missions that do not need a browser are unaffected. Foreman can install Playwright's own Chromium for you — about 150 MB, into your home directory, no administrator rights.",a.jsxs("div",{style:{marginTop:"var(--sp-2)",display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[a.jsx(se,{variant:"primary",size:"sm",icon:b.job?.state==="running"?"loading":"add",disabled:b.job?.state==="running",onClick:b.start,children:b.job?.state==="running"?"Installing…":"Install Playwright Chromium"}),b.job&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:b.job.state==="error"?"var(--status-critical)":"var(--ink-2)",fontFamily:"var(--font-mono)"},children:b.job.state==="error"?b.job.error:b.job.progress})]})]})]})]})]})}const M=d.auth;return a.jsxs(a.Fragment,{children:[a.jsx("h1",{style:Ci,children:k?"Set up, minus a provider.":"Ready."}),a.jsxs("div",{children:[a.jsxs(vt,{tone:M.mode==="none"?(d.ollama||d.codex,"warn"):"ok",title:"Missions run on",children:[M.mode==="none"?"nothing yet — see page 2":M.mode==="subscription"?`Claude Code${M.account?.email?`, ${M.account.email}`:""}`:M.mode==="api-key"?"an Anthropic API key":M.source,d.ollama?` · Ollama, ${d.ollama.models} models`:"",d.codex?" · Codex":""]}),a.jsx(vt,{tone:d.phone?.label?"ok":"none",title:"Phone",children:d.phone?.label?`Telegram, ${d.phone.label}`:"not linked"}),a.jsx(vt,{tone:d.tailnet?"ok":"none",title:"Reach",children:d.tailnet?`localhost and ${d.tailnet.dnsName??d.tailnet.ip}`:"localhost"}),a.jsx(vt,{tone:d.browser?.status==="ok"?"ok":"warn",title:"Browser",children:d.browser?.status==="ok"?"found":"none — browser missions will fail"})]}),a.jsxs("p",{style:za,children:["Next: link a project — a folder on this machine, or a Git URL to clone. The fleet page has the card; dropping a folder anywhere on it works too. This walk-through is at ",a.jsx(Kt,{children:"#/setup"})," whenever you want it, and ",a.jsx(Kt,{children:"foreman doctor"})," says the same in a terminal."]})]})};return a.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--bg-app)",display:"flex",flexDirection:"column"},children:a.jsxs("div",{style:{width:"100%",maxWidth:"44rem",margin:"0 auto",padding:"56px var(--sp-4) 40px",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"var(--sp-4)",flex:1},children:[a.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)"},children:[a.jsx("span",{style:{fontWeight:"var(--fw-semibold)"},children:"Foreman"}),a.jsxs("span",{style:{color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:["first run",d?.version?` · v${d.version}`:""]}),a.jsx("span",{style:{flex:1}}),a.jsx(se,{variant:"ghost",size:"sm",disabled:j,onClick:i,children:"Skip to the fleet"})]}),a.jsx("ol",{style:{listStyle:"none",margin:0,padding:0,display:"flex",gap:"var(--sp-2)",flexWrap:"wrap"},children:gp.map((M,z)=>{const D=z<u?"done":z===u?"now":"todo";return a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>z<u&&o(z),disabled:z>u,style:{display:"inline-flex",alignItems:"center",gap:6,background:"none",border:"none",padding:"4px 6px",font:"inherit",fontSize:"var(--fs-sm)",cursor:z<u?"pointer":"default",color:D==="now"?"var(--ink-0)":D==="done"?"var(--ink-1)":"var(--ink-2)",fontWeight:D==="now"?"var(--fw-semibold)":"inherit"},children:[a.jsx("span",{style:{width:18,height:18,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"var(--fs-xs)",fontVariantNumeric:"tabular-nums",background:D==="now"?"var(--brand)":D==="done"?"var(--status-good)":"transparent",color:D==="todo"?"var(--ink-2)":"var(--brand-ink)",border:D==="todo"?"1px solid var(--line-strong)":"1px solid transparent"},children:D==="done"?a.jsx(ie,{name:"done",size:11}):z+1}),M]})},M)})}),a.jsx("section",{style:{background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-md)",padding:"var(--sp-5)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",fontSize:"var(--fs-md, var(--fs-sm))"},children:K()}),a.jsxs("footer",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[u>0&&a.jsx(se,{variant:"ghost",icon:"back",disabled:j,onClick:()=>o(u-1),children:"Back"}),a.jsx("span",{style:{flex:1}}),j&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Installing — stay on this page"}),u>0&&a.jsx(se,{variant:"ghost",icon:g?"loading":"resume",disabled:g||j,onClick:()=>{S()},children:"Check again"}),B?a.jsx(se,{variant:"primary",icon:"add",disabled:j,onClick:i,children:"Go link a project"}):a.jsx(se,{variant:"primary",disabled:j,onClick:()=>o(u+1),children:u===0?"Show me":u===1&&k?"Continue without a provider":"Continue"})]})]})})}const Ci={margin:0,fontSize:"var(--fs-xl, 1.35rem)",fontWeight:"var(--fw-semibold)",lineHeight:1.25,textWrap:"balance"},za={margin:0,color:"var(--ink-1)",lineHeight:"var(--lh)",maxWidth:"62ch"},c1=15e3;function u1(i,c){const[u,o]=m.useState(null),[d,h]=m.useState(!1),[g,y]=m.useState(null),[x,v]=m.useState(!1),[S,b]=m.useState(0),j=m.useCallback(()=>b(k=>k+1),[]);return m.useEffect(()=>{if(o(null),y(null),v(!1),!i){h(!1);return}let k=!1;h(!0);const B=async()=>{const M=await fetch(`/runs/${encodeURIComponent(i)}/deck`).catch(()=>null);if(k)return;if(!M){y("Could not reach the server."),h(!1);return}if(M.status===404){v(!0),y(null),h(!1);return}if(!M.ok){const D=await M.json().catch(()=>({}));y(D.error||`HTTP ${M.status}`),h(!1);return}const z=await M.json().catch(()=>null);k||(z&&(o(z),v(!1),y(null)),h(!1))};B();const K=c?setInterval(()=>{B()},c1):null;return()=>{k=!0,K&&clearInterval(K)}},[i,c,S]),{deck:u,loading:d,error:g,missing:x,refresh:j}}function d1(i,c=null){const[u,o]=m.useState([]),[d,h]=m.useState(!1),[g,y]=m.useState(!1),[x,v]=m.useState(null),[S,b]=m.useState(0),j=m.useCallback(()=>b(k=>k+1),[]);return m.useEffect(()=>{if(o([]),v(null),!i){y(!1);return}let k=!1;return y(!0),fetch(`/projects/${encodeURIComponent(i)}/tree`).then(async B=>{if(k)return;if(!B.ok){v((await B.json().catch(()=>({}))).error||`HTTP ${B.status}`);return}const K=await B.json();o(K.files??[]),h(!!K.truncated)}).catch(()=>{k||v("Could not reach the server.")}).finally(()=>{k||y(!1)}),()=>{k=!0}},[i,S,c]),{files:u,truncated:d,loading:g,error:x,refresh:j}}const tv=m.forwardRef(function({value:c,onChange:u,placeholder:o,size:d="mission",bare:h,onKeyDown:g,onPaste:y,onFocus:x,onBlur:v,style:S},b){const j=d==="mission";return a.jsx("textarea",{ref:b,value:c,placeholder:o,onKeyDown:g,onPaste:y,onFocus:x,onBlur:v,onChange:k=>u?.(k.target.value),style:{width:"100%",boxSizing:"border-box",display:"block",minHeight:j?180:void 0,height:j?void 0:56,resize:"vertical",background:h?"transparent":j?"var(--bg-card)":"var(--bg-inset)",border:h?"none":"1px solid var(--line-strong)",outline:h?"none":void 0,borderRadius:h?0:j?"var(--r-md)":"var(--r-sm)",padding:j?"var(--sp-3)":"var(--sp-2)",color:"var(--ink-0)",lineHeight:j?"var(--lh-prose)":"var(--lh)",...S}})});function tr(i){return new Date(i).toLocaleTimeString(void 0,{hour12:!1})}const Ac=[1,5,15,30,60,120,300,600,900,1800,3600,7200,21600].map(i=>i*1e3);function f1(i,c){const u=c-i,o=Ac.find(h=>u/h<=6)??Ac[Ac.length-1],d=[];for(let h=Math.ceil(i/o)*o;h<c;h+=o)d.push(h);return{marks:d,step:o}}function h1({agents:i=[],entries:c=[],live:u,selected:o,onSelect:d,onTick:h,height:g=22,style:y}){if(!c.length)return null;const x=Math.min(...c.map(M=>M.ts)),v=Math.max(...c.map(M=>M.ts)),S=u?Math.min(Math.max(Date.now(),v),v+6e4):v,b=Math.max(S-x,1e3),j=M=>`${(M-x)/b*100}%`,k=M=>(M-x)/b*100,{marks:B}=f1(x,x+b),K=i.length?i.map(M=>M.id??M):[...new Set(c.map(M=>M.agent))];return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"84px 1fr",rowGap:4,columnGap:10,fontSize:"var(--fs-xs)",color:"var(--ink-2)",...y},children:[K.map(M=>{const z=c.filter(q=>q.agent===M);if(!z.length)return null;const D=Math.min(...z.map(q=>q.ts)),U=i.find(q=>(q.id??q)===M)?.status,F=U==="running"&&u?S:Math.max(...z.map(q=>q.ts)),re=o&&o!==M;return a.jsxs(On.Fragment,{children:[a.jsxs("button",{type:"button",onClick:()=>d?.(M),title:`Filter transcript to ${M}`,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",padding:0,cursor:d?"pointer":"default",color:re?"var(--ink-2)":"var(--ink-1)",font:"inherit",textAlign:"left",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[a.jsx(fn,{agent:M,size:"sm"}),M]}),a.jsxs("div",{style:{position:"relative",height:g,background:"var(--bg-inset)",borderRadius:4,opacity:re?.45:1,overflow:"hidden"},children:[B.map(q=>a.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:j(q),top:0,bottom:0,width:1,background:"var(--line)",opacity:.9}},q)),a.jsx("div",{style:{position:"absolute",left:j(D),width:`calc(${j(F)} - ${j(D)})`,top:6,bottom:6,minWidth:3,background:sr(M),opacity:.15,borderRadius:3}}),z.map(q=>{const N=a.jsx("span",{style:{display:"block",width:q.kind==="text"?3:2,height:q.kind==="text"?g-6:g-14,borderRadius:1,background:q.kind==="error"?"var(--status-critical)":q.kind==="tool"?"var(--ink-0)":sr(M),boxShadow:"0 0 0 1px var(--bg-inset)"}}),Y=`${tr(q.ts)} · ${q.title||q.kind}`;return h?a.jsx("button",{type:"button",title:Y,"aria-label":`Jump to ${Y}`,onClick:()=>h(q),style:{position:"absolute",left:j(q.ts),top:0,bottom:0,width:9,marginLeft:-4,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer"},children:N},q.id??q.ts):a.jsx("span",{title:Y,style:{position:"absolute",left:j(q.ts),top:q.kind==="text"?3:7,marginLeft:-1},children:N},q.id??q.ts)}),u&&U==="running"&&a.jsx("span",{className:"pulse",style:{position:"absolute",right:0,top:0,bottom:0,width:2,background:"var(--status-good)"}})]})]},M)}),a.jsx("span",{}),a.jsxs("div",{style:{position:"relative",height:16,fontVariantNumeric:"tabular-nums"},children:[a.jsx("span",{style:{position:"absolute",left:0,top:0},children:tr(x)}),B.map(M=>{const z=k(M);return z<12||z>88?null:a.jsx("span",{style:{position:"absolute",left:`${z}%`,top:0,transform:"translateX(-50%)",color:"var(--ink-3, var(--ink-2))"},children:tr(M)},M)}),a.jsx("span",{style:{position:"absolute",right:0,top:0},children:u?"now":tr(S)})]})]})}function p1(i){const c=[];let u=!1;for(const o of String(i||"").split(`
28
- `)){const d=/^#{1,6}\s+(.*)$/.exec(o.trim());if(d){u=/^DONE\s*WHEN/i.test(d[1]);continue}if(u)continue;const h=/^\s*[-*]\s*\[([ xX])\]\s*(.+)$/.exec(o);h&&c.push({done:h[1]!==" ",text:h[2].trim()})}return c}function v1({doc:i,style:c}){const[u,o]=m.useState(!1),d=i?p1(i):[],h=d.filter(g=>g.done).length;return a.jsxs("section",{style:c,children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)"},children:[a.jsx(Rn,{children:"Plan"}),d.length>0&&a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:[h,"/",d.length]}),i&&a.jsxs("button",{type:"button",onClick:()=>o(!u),style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:4,background:"none",border:"none",cursor:"pointer",color:"var(--ink-2)",fontSize:"var(--fs-xs)",padding:0,font:"inherit"},children:[a.jsx(ie,{name:"raw",size:12}),u?"board":"raw doc"]})]}),d.length>0&&!u&&a.jsx("div",{style:{height:3,background:"var(--bg-inset)",borderRadius:2,marginBottom:6,overflow:"hidden"},children:a.jsx("div",{style:{width:`${h/d.length*100}%`,height:"100%",background:"var(--status-good)",transition:"width var(--dur-meter)"}})}),!i&&a.jsx(Fe,{children:"MISSION.md not written yet."}),i&&!u&&d.map((g,y)=>a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"4px 0",fontSize:"var(--fs-sm)",color:g.done?"var(--ink-2)":"var(--ink-0)"},children:[a.jsx(ie,{name:g.done?"done":"idle",size:14,strokeWidth:2,color:g.done?"var(--status-good)":"var(--ink-2)",style:{marginTop:2}}),a.jsx("span",{style:{textDecoration:g.done?"line-through":"none"},children:g.text})]},y)),i&&u&&a.jsx("pre",{style:{fontSize:"var(--fs-xs)",whiteSpace:"pre-wrap",color:"var(--ink-1)",background:"var(--bg-inset)",borderRadius:"var(--r-sm)",padding:"var(--sp-2)",maxHeight:320,overflowY:"auto",fontFamily:"var(--font-mono)",margin:0},children:i})]})}function ul({label:i,hint:c,layout:u="inline",children:o,style:d}){return u==="stacked"?a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,...d},children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--ink-2)"},children:i}),o,c&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:c})]}):a.jsxs("label",{title:c,style:{display:"flex",alignItems:"center",gap:6,color:"var(--ink-1)",fontSize:"var(--fs-sm)",...d},children:[i,o]})}const g1=/(`[^`\n]+`|<[^<>\n]{1,80}>)/g;function m1(i){const c=[];let u=!1;for(const o of i.split(`
29
- `)){if(/^```/.test(o)){c.push({text:o,kind:"fence",open:!u}),u=!u;continue}if(u){c.push({text:o,kind:"code"});continue}/^>\s?/.test(o)?c.push({text:o,kind:"quote"}):/^\s*[-*]\s+/.test(o)?c.push({text:o,kind:"list"}):/^#{1,3}\s/.test(o)?c.push({text:o,kind:"heading"}):c.push({text:o,kind:"text"})}return c}function nr(i){return i.split(g1).filter(Boolean).map((c,u)=>c.length>2&&c.startsWith("`")&&c.endsWith("`")?a.jsxs("span",{style:{background:"var(--bg-inset)",boxShadow:"0 0 0 1px var(--line)",borderRadius:3,color:"var(--agent-worker)"},children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:"`"}),c.slice(1,-1),a.jsx("span",{style:{color:"var(--ink-2)"},children:"`"})]},u):c.startsWith("<")&&c.endsWith(">")?a.jsx("span",{style:{background:"var(--brand-wash-strong)",boxShadow:"0 0 0 1px var(--brand)",borderRadius:3},children:c},u):c)}const Mi="var(--sp-3)",y1=m.forwardRef(function({value:c,onChange:u,placeholder:o,minHeight:d=200,maxHeight:h=460,onKeyDown:g,onPaste:y,onFocus:x,onBlur:v,style:S},b){const j=m.useRef(null),k=m.useRef(null);m.useImperativeHandle(b,()=>j.current),m.useEffect(()=>{const z=j.current;z&&(z.style.height="0px",z.style.height=`${Math.max(z.scrollHeight,d)}px`,k.current!=null&&(z.setSelectionRange(k.current,k.current),k.current=null))},[c,d]);const B=z=>{const D=z.target;let U=D.value,F=D.selectionStart;const re=z.nativeEvent?.inputType==="insertText"&&z.nativeEvent?.data==="`",q=U.slice(0,F),N=U.slice(F),Y=q.lastIndexOf(`
30
- `)+1;if(re&&q.slice(Y)==="```"&&(N===""||N.startsWith(`
31
- `))){const G=(q.match(/^```/gm)||[]).length%2===1;G&&(N.match(/^```/gm)||[]).length%2===0?(U=`${q}
23
+ `),u=[];let o=0;for(;o<c.length;){const d=c[o];if(/^```/.test(d)){const y=d.slice(3).trim(),b=[];for(o++;o<c.length&&!/^```/.test(c[o]);)b.push(c[o++]);o++,u.push({t:"code",lang:y,body:b.join(`
24
+ `)});continue}if(/^>\s?/.test(d)){const y=[];for(;o<c.length&&/^>\s?/.test(c[o]);)y.push(c[o++].replace(/^>\s?/,""));u.push({t:"quote",body:y});continue}if(/^\s*[-*]\s+/.test(d)){const y=[];for(;o<c.length&&/^\s*[-*]\s+/.test(c[o]);)y.push(c[o++].replace(/^\s*[-*]\s+/,""));u.push({t:"list",items:y});continue}const h=/^(#{1,3})\s+(.*)$/.exec(d);if(h){u.push({t:"h",level:h[1].length,body:h[2]}),o++;continue}if(!d.trim()){o++;continue}const g=[];for(;o<c.length&&c[o].trim()&&!/^(```|>|\s*[-*]\s|#{1,3}\s)/.test(c[o]);)g.push(c[o++]);u.push({t:"p",body:g})}return u}function Ai({text:i,slots:c=!0,style:u}){const o=A0(i);return l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10,lineHeight:"var(--lh-prose)",color:"var(--ink-prose, var(--ink-0))",...u},children:o.map((d,h)=>d.t==="code"?l.jsxs("pre",{style:{margin:0,padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",lineHeight:"var(--lh)",overflowX:"auto",whiteSpace:"pre",position:"relative"},children:[d.lang&&l.jsx("span",{style:{position:"absolute",top:4,right:8,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:d.lang}),d.body]},h):d.t==="quote"?l.jsx("blockquote",{style:{margin:0,padding:"2px 0 2px 12px",borderLeft:"2px solid var(--agent-worker)",color:"var(--ink-1)"},children:d.body.map((g,y)=>l.jsx("div",{children:er(g,c)},y))},h):d.t==="list"?l.jsx("ul",{style:{margin:0,paddingLeft:20},children:d.items.map((g,y)=>l.jsx("li",{children:er(g,c)},y))},h):d.t==="h"?l.jsx("div",{style:{fontWeight:"var(--fw-semibold)",fontSize:d.level===1?"var(--fs-lg)":"var(--fs-md)",color:"var(--ink-0)",marginTop:h?4:0},children:er(d.body,c)},h):l.jsx("p",{style:{margin:0},children:d.body.map((g,y)=>l.jsxs(On.Fragment,{children:[y>0&&l.jsx("br",{}),er(g,c)]},y))},h))})}const Fp=new Set(["spawn_worker","message_worker","ask_human"]);function Ic({agent:i,title:c,kind:u="text",body:o,ts:d,to:h,timing:g,dense:y=!1,style:b}){const v=u==="tool";if(v&&y)return l.jsx(O0,{agent:i,title:c,body:o,ts:d,style:b});if(u==="system"&&!o&&typeof c=="string"&&c.startsWith("result ·"))return l.jsx(R0,{agent:i,title:c,ts:d,style:b});const S=u==="steer",x=u==="result",j=u==="error"?"var(--status-critical)":S?"var(--ink-0)":u==="text"?sr(i):void 0,k=d?new Date(d).toLocaleTimeString(void 0,{hour12:!1}):null,U=v?String(c||"tool").replace(/^[^\w]+/,""):null,Z=v?null:c;return l.jsxs(Jc,{accent:j,style:{padding:"var(--sp-2) var(--sp-3)",...x?{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)"}:null,...u==="system"?{color:"var(--ink-1)",fontSize:"var(--fs-sm)"}:null,...b},children:[l.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:u==="error"?"var(--status-critical)":"var(--ink-2)",marginBottom:4,display:"flex",alignItems:"center",gap:6,fontFamily:"var(--font-ui)"},children:[l.jsx(fn,{agent:i,size:"sm"}),l.jsx("span",{children:i}),S&&h&&l.jsxs(l.Fragment,{children:[l.jsx(se,{name:"chevronRight",size:11}),l.jsx(fn,{agent:h,size:"sm"}),l.jsx("span",{children:h})]}),S&&g&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"·"}),l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[l.jsx(se,{name:g==="now"?"now":"nextTurn",size:11}),g==="now"?"now":"next turn"]})]}),Z&&Z!==i&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"·"}),l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[u==="error"&&l.jsx(se,{name:"error",size:11,strokeWidth:2.25}),Z]})]}),v&&Fp.has(U)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"·"}),l.jsx("span",{style:{color:"var(--brand)"},children:"orchestration"})]}),k&&l.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:k})]}),v?l.jsx(Zp,{tool:U,body:o}):u==="text"&&typeof o=="string"?l.jsx(Ai,{text:o}):l.jsx(D0,{body:o})]})}const up=12;function D0({body:i}){const[c,u]=m.useState(!1),o=typeof i=="string"?i:null,d=o?o.split(`
25
+ `):[];if(!(o!==null&&(d.length>up+4||o.length>1600)))return l.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i});const g=c?o:d.slice(0,up).join(`
26
+ `).slice(0,1600);return l.jsxs("div",{children:[l.jsxs("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[g,!c&&`
27
+ …`]}),l.jsx("button",{type:"button",onClick:()=>u(!c),style:{marginTop:4,padding:0,background:"none",border:"none",cursor:"pointer",font:"inherit",fontFamily:"var(--font-ui)",fontSize:"var(--fs-xs)",color:"var(--brand)"},children:c?"Show less":`Show all · ${d.length} lines`})]})}function R0({agent:i,title:c,ts:u,style:o}){const d=u?new Date(u).toLocaleTimeString(void 0,{hour12:!1}):null;return l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap",overflow:"hidden",...o},children:[l.jsx(fn,{agent:i,size:"sm"}),l.jsx("span",{children:i}),l.jsx("span",{children:"·"}),l.jsx("span",{children:c.replace(/^result · /,"turn ended · ")}),d&&l.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:d})]})}function O0({agent:i,title:c,body:u,ts:o,style:d}){const h=String(c||"tool").replace(/^[^\w]+/,""),g=Kp(h,Wp(u))||(typeof u=="string"?u:""),y=String(g).replace(/\s+/g," ").slice(0,90),b=o?new Date(o).toLocaleTimeString(void 0,{hour12:!1}):null;return l.jsxs("div",{title:typeof u=="string"?u.slice(0,2e3):void 0,style:{display:"flex",alignItems:"center",gap:6,padding:"1px var(--sp-2)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap",overflow:"hidden",minWidth:0,...d},children:[l.jsx(fn,{agent:i,size:"sm"}),l.jsx(se,{name:h,size:12}),l.jsx("span",{style:{color:Fp.has(h)?"var(--brand)":"var(--ink-1)",flex:"0 0 auto"},children:h}),l.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:y}),b&&l.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:b})]})}function Na({icon:i,label:c,onClick:u,active:o,size:d="md",disabled:h,style:g}){const[y,b]=m.useState(!1),v=d==="sm"?26:32;return l.jsx("button",{type:"button",title:c,"aria-label":c,"aria-pressed":o,disabled:h,onClick:u,onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),style:{width:v,height:v,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,borderRadius:"var(--r-sm)",cursor:h?"default":"pointer",background:o?"var(--bg-card)":y?"var(--bg-hover)":"transparent",border:`1px solid ${o?"var(--line-strong)":"transparent"}`,color:o||y?"var(--ink-0)":"var(--ink-1)",opacity:h?.5:1,transition:"background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease)",...g},children:l.jsx(se,{name:i,size:d==="sm"?14:16})})}function rr(i){if(!i)return"";let c=String(i).replace(/^\/(Users|home)\/[^/]+/,"~");const u=c.split("/");return u.length>4&&(c=[u[0],u[1],"…",...u.slice(-2)].join("/")),c}function Jp({size:i=24,mono:c,style:u}){const o=c?"currentColor":"var(--brand)",d=c?"currentColor":"var(--agent-worker)";return l.jsxs("svg",{viewBox:"0 0 32 32",width:i,height:i,"aria-hidden":!0,style:{flex:"0 0 auto",display:"block",...u},children:[l.jsx("rect",{x:"5",y:"4",width:"6",height:"24",rx:"3",fill:o}),l.jsx("rect",{x:"5",y:"4",width:"22",height:"6",rx:"3",fill:o}),l.jsx("rect",{x:"5",y:"13",width:"15",height:"6",rx:"3",fill:d,opacity:c?.55:1})]})}function N0({size:i=22,tagline:c,mono:u,style:o}){return l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:Math.round(i*.4),...o},children:[l.jsx(Jp,{size:i,mono:u}),l.jsx("span",{style:{fontSize:Math.round(i*.82),fontWeight:"var(--fw-semibold)",letterSpacing:"-0.01em",color:u?"currentColor":"var(--ink-0)",lineHeight:1},children:"Foreman"}),c&&l.jsx("span",{style:{color:"var(--ink-2)",fontSize:"var(--fs-sm)",marginLeft:4},children:c})]})}function H0({folder:i}){const[c,u]=On.useState(!1),[o,d]=On.useState(!1),h=()=>{navigator.clipboard&&navigator.clipboard.writeText(i).catch(()=>{}),u(!0),setTimeout(()=>u(!1),1200)};return l.jsxs("button",{type:"button",onClick:h,title:c?"Copied":i,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0,maxWidth:420,padding:"3px 8px",borderRadius:999,border:"1px solid transparent",background:o?"var(--bg-inset, rgba(255,255,255,.06))":"transparent",color:c?"var(--ink-1)":"var(--ink-2)",cursor:"pointer",font:"inherit"},children:[l.jsx(se,{name:"folder",size:13}),l.jsx("span",{style:{fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c?"copied":rr(i)})]})}function Ip({mode:i="fleet",title:c,subtitle:u="mission control",folder:o,branch:d,onBack:h,theme:g,onToggleTheme:y,onSettings:b,version:v,search:S,children:x,style:j}){const k=i==="fleet";return l.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)",padding:k?"var(--sp-3) var(--sp-5)":"var(--sp-2) var(--sp-3)",background:"var(--bg-panel)",borderBottom:"1px solid var(--line)",flex:"0 0 auto",minHeight:48,...j},children:[k?l.jsx(N0,{size:22,tagline:u}):l.jsxs("nav",{"aria-label":"Breadcrumb",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:0},children:[l.jsx("button",{type:"button",onClick:h,title:"Back to the fleet","aria-label":"Back to the fleet",style:{background:"none",border:0,padding:0,cursor:"pointer",display:"inline-flex",alignItems:"center"},children:l.jsx(Jp,{size:22})}),l.jsx("button",{type:"button",onClick:h,style:{background:"none",border:0,padding:0,font:"inherit",color:"var(--ink-2)",cursor:"pointer"},children:"Fleet"}),l.jsx(se,{name:"chevronRight",size:14,color:"var(--ink-3, var(--ink-2))"}),l.jsx("span",{style:{fontWeight:"var(--fw-semibold)",whiteSpace:"nowrap"},children:c}),o&&l.jsx(H0,{folder:o}),d&&l.jsxs("span",{title:d.hint??`On branch ${d.name}${d.dirty?" · uncommitted changes":""}`,style:{display:"inline-flex",alignItems:"center",gap:5,padding:"2px 8px",borderRadius:999,border:"1px solid var(--line)",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",color:"var(--ink-1)",whiteSpace:"nowrap",maxWidth:260},children:[l.jsx("span",{"aria-hidden":!0,style:{color:"var(--ink-2)"},children:"⎇"}),l.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:d.name}),d.dirty&&l.jsx("span",{"aria-label":"uncommitted changes",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-warning)",flex:"0 0 auto"}})]})]}),S&&l.jsx("div",{style:{flex:"1 1 auto",display:"flex",justifyContent:"center",minWidth:0,padding:"0 var(--sp-3)"},children:S}),l.jsxs("div",{style:{marginLeft:S?0:"auto",display:"flex",alignItems:"center",gap:"var(--sp-3)",flexWrap:"wrap",justifyContent:"flex-end"},children:[x,y&&l.jsx(Na,{icon:g==="light"?"moon":"sun",label:g==="light"?"Switch to dark theme":"Switch to light theme",onClick:y}),b&&l.jsx(Na,{icon:"settings",label:"Settings",onClick:b}),v&&l.jsxs("a",{href:"https://github.com/amenophis1er/foreman/releases",target:"_blank",rel:"noopener noreferrer",title:`Foreman ${v} — release notes`,style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textDecoration:"none",whiteSpace:"nowrap"},children:["v",v]})]})]})}function Fe({children:i}){return l.jsx("div",{style:{color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:i})}function Rn({children:i,style:c}){return l.jsx("h2",{style:{margin:"0 0 var(--sp-2)",fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)",color:"var(--ink-2)",...c},children:i})}const dp={readonly:{icon:"readonly",color:"var(--status-warning)"},disconnected:{icon:"disconnected",color:"var(--status-serious)"},error:{icon:"error",color:"var(--status-critical)"},caution:{icon:"caution",color:"var(--status-serious)"}};function lt({tone:i="readonly",children:c,inline:u,style:o}){const d=dp[i]??dp.readonly;return u?l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,color:d.color,fontSize:"var(--fs-sm)",...o},children:[l.jsx(se,{name:d.icon,size:13,strokeWidth:2}),c]}):l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1) var(--sp-3)",background:"var(--bg-inset)",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-sm)",color:"var(--ink-1)",...o},children:[l.jsx(se,{name:d.icon,size:14,color:d.color}),c]})}function Pp(i,c=Date.now()){const u=Math.max(0,Math.round((c-i)/1e3));if(u<60)return`${u}s`;const o=Math.floor(u/60);if(o<60)return`${o}m`;const d=Math.floor(o/60);return d<24?o%60?`${d}h ${o%60}m`:`${d}h`:`${Math.floor(d/24)}d`}const U0={permission:"approval",question:"director asks",planner:"the planner is asking",summary:"needs you"};function fp(i,c){return`${i} ${c}${i>1?"s":""}`}function B0({item:i,onPermission:c,onAnswer:u,onPlanner:o,onOpen:d}){const[h,g]=m.useState(!1),[y,b]=m.useState(""),[v,S]=m.useState(!1),[x,j]=m.useState("");m.useEffect(()=>{g(!1),b(""),S(!1),j("")},[i.id]);const k=async B=>{if(!h){g(!0),b("");try{const J=await B();J&&(b(J),g(!1))}catch(J){b(J instanceof Error?J.message:String(J)),g(!1)}}},U=B=>i.kind==="planner"?k(()=>o(i,B)):k(()=>u(i,B)),Z=()=>{const B=x.trim();B&&U(B)},C=Array.isArray(i.options)&&i.options.length>0,z=i.kind==="question"||i.kind==="planner",D=z&&(v||!C);return l.jsxs("div",{className:h?void 0:"pulse",style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",padding:"var(--sp-3) var(--sp-4)",background:"var(--brand-wash-strong)",border:"1px solid var(--status-warning)",borderLeft:"var(--accent-w) solid var(--status-warning)",borderRadius:"var(--r-md)",opacity:h?.7:1,transition:"opacity var(--dur-fast) var(--ease)"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",minWidth:0,fontSize:"var(--fs-sm)"},children:[l.jsx(se,{name:i.kind==="permission"?"approval":i.kind==="summary"?"needsYou":"question",size:14,strokeWidth:2,color:"var(--status-warning)",style:{alignSelf:"center",flex:"0 0 auto"}}),l.jsx("span",{style:{fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",flex:"0 0 auto"},children:i.projectName}),l.jsx("span",{style:{color:"var(--status-warning)",fontWeight:"var(--fw-medium)",flex:"0 0 auto"},children:U0[i.kind]??i.kind}),l.jsx("span",{title:i.text,style:{color:"var(--ink-0)",minWidth:0,flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.text}),typeof i.since=="number"&&l.jsxs("span",{style:{color:"var(--ink-2)",fontSize:"var(--fs-xs)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:["waiting ",Pp(i.since)]})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[i.kind==="permission"&&l.jsxs(l.Fragment,{children:[l.jsx(ie,{size:"sm",variant:"good",disabled:h,onClick:()=>{k(()=>c(i,"allow"))},children:"Allow"}),l.jsx(ie,{size:"sm",variant:"danger",disabled:h,onClick:()=>{k(()=>c(i,"deny"))},children:"Deny"})]}),z&&C&&i.options.map((B,J)=>l.jsxs("button",{type:"button",disabled:h,onClick:()=>{U(B)},title:J===0?"Recommended":void 0,style:{display:"inline-flex",alignItems:"center",gap:5,padding:"4px 10px",borderRadius:"var(--r-sm)",cursor:h?"default":"pointer",font:"inherit",fontSize:"var(--fs-sm)",textAlign:"left",maxWidth:360,background:"var(--bg-card)",border:"1px solid var(--line-strong)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[J===0&&l.jsx("span",{style:{color:"var(--status-warning)",fontSize:"var(--fs-xs)"},children:"★"}),B]},B)),z&&C&&!v&&l.jsx(ie,{size:"sm",variant:"ghost",disabled:h,onClick:()=>S(!0),children:"type…"}),D&&l.jsxs("form",{onSubmit:B=>{B.preventDefault(),Z()},style:{display:"flex",alignItems:"center",gap:6,flex:"1 1 16rem",minWidth:0},children:[l.jsx("input",{autoFocus:v,value:x,disabled:h,placeholder:i.kind==="planner"?"Answer the planner…":"Answer the director…",onChange:B=>j(B.target.value),onKeyDown:B=>{B.key==="Escape"&&C&&(S(!1),j(""))},style:{flex:"1 1 auto",minWidth:0,font:"inherit",fontSize:"var(--fs-sm)",padding:"4px 8px",borderRadius:"var(--r-sm)",background:"var(--bg-card)",border:"1px solid var(--line-strong)",color:"var(--ink-0)",outline:"none"}}),l.jsx(ie,{size:"sm",type:"submit",icon:"send",disabled:h||!x.trim(),children:"Send"})]}),l.jsx("span",{style:{marginLeft:"auto",flex:"0 0 auto"},children:l.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>d?.(i.projectId),title:"Open the project for the full context",children:"open"})})]}),y&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"var(--fs-xs)",color:"var(--text-danger)"},children:[l.jsx(se,{name:"caution",size:12,strokeWidth:2}),y]})]})}function q0({items:i=[],onPermission:c,onAnswer:u,onPlanner:o,onOpen:d,style:h}){return i.length?l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",...h},children:i.map(g=>l.jsx(B0,{item:g,onPermission:c,onAnswer:u,onPlanner:o,onOpen:d},`${g.projectId}:${g.kind}:${g.id??""}`))}):null}function L0({approvals:i=0,questions:c=0,planner:u=!1}){const o=[];i>0&&o.push(fp(i,"approval"));const d=u?c-1:c;return d>0&&o.push(fp(d,"question")),u&&o.push("the planner is asking"),o.join(", ")}function $0(i){const c=Math.max(0,Math.round(Number(i)||0)/1e3);if(c<60)return`${Math.round(c)}s`;const u=Math.round(c/60);return u<60?`${u}m`:`${Math.floor(u/60)}h ${String(u%60).padStart(2,"0")}m`}function Ha(i){return i>=1e6?`${(i/1e6).toFixed(1)}m`:i>=1e3?`${(i/1e3).toFixed(1)}k`:String(i)}const Y0=i=>i?i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheWriteTokens:0,G0="repeating-linear-gradient(-45deg, var(--line-strong) 0 3px, transparent 3px 7px)";function ev({spent:i,budget:c,costBasis:u="priced",usage:o=null,turns:d,elapsedMs:h,detail:g=!1,style:y}){const b=typeof h=="number"&&h>0?` · ${$0(h)}`:"";if(i=Number(i)||0,c=Number(c)||0,u!=="priced"){const j=u==="unpriced",k=Y0(o);return l.jsxs("div",{title:j?"Real spend, on an account Foreman cannot price — no table for this endpoint, or a plan being drawn down. Check the provider for the bill; turns and tokens are all that is known here.":"Runs on hardware you already own, so nothing is billed per token. Turns and tokens are the only real units.",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:170,...y},children:[l.jsx("div",{style:{flex:1,height:"var(--meter-h)",background:"var(--bg-inset)",borderRadius:2,overflow:"hidden",backgroundImage:j?G0:void 0}}),l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-sm)",color:"var(--ink-1)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[g?`${Ha(o?.inputTokens??0)} in · ${Ha(o?.outputTokens??0)} out`:`${Ha(k)} tok`,typeof d=="number"?` · ${d} turn${d===1?"":"s"}`:"",b]})]})}const v=c>0?Math.min(i/c,1):0,S=v>=.9?"critical":v>=.7?"warning":"ok",x=S==="critical"?"var(--status-critical)":S==="warning"?"var(--status-warning)":"var(--brand)";return l.jsxs("div",{title:`$${i.toFixed(2)} spent of $${c.toFixed(2)} budget`,style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",minWidth:170,...y},children:[l.jsx("div",{style:{flex:1,height:"var(--meter-h)",background:"var(--bg-inset)",borderRadius:2,overflow:"hidden"},children:l.jsx("div",{style:{width:`${v*100}%`,height:"100%",background:x,transition:"width var(--dur-meter)"}})}),l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-sm)",color:"var(--ink-1)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[S!=="ok"&&l.jsx(se,{name:S,size:12,strokeWidth:2.25,color:x}),"$",i.toFixed(2)," / $",c.toFixed(0),b]})]})}function X0({name:i,folder:c,title:u,mission:o,activity:d,costUsd:h,budgetUsd:g,costBasis:y,usage:b,turns:v,directorModel:S,workerModel:x,createdAt:j,onOpen:k,style:U}){const[Z,C]=m.useState(!1),z=[S,x].filter(Boolean);return l.jsxs("div",{role:"button",tabIndex:0,onClick:k,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),k?.())},onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),style:{display:"grid",gridTemplateColumns:"minmax(9rem, 12rem) minmax(0, 1fr) minmax(11rem, 15rem) auto",gap:"var(--sp-4)",alignItems:"center",padding:"var(--sp-3) var(--sp-4)",cursor:"pointer",background:Z?"var(--bg-hover)":"transparent",borderLeft:`var(--accent-w) solid ${Z?"var(--brand)":"transparent"}`,transition:"background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease)",...U},children:[l.jsxs("div",{style:{minWidth:0},children:[l.jsx("div",{style:{fontSize:"var(--fs-md)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),l.jsx("div",{title:c,style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:rr(c)})]}),l.jsxs("div",{style:{minWidth:0},children:[l.jsx("div",{title:o,style:{fontSize:"var(--fs-md)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u||o}),d&&l.jsx("div",{className:"ticker",title:d,style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d},d)]}),l.jsx(ev,{spent:h,budget:g,costBasis:y,usage:b,turns:v}),l.jsxs("div",{style:{textAlign:"right",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[z.length>0&&l.jsx("div",{title:"director · worker",style:{maxWidth:"16rem",overflow:"hidden",textOverflow:"ellipsis"},children:z.join(" · ")}),typeof j=="number"&&l.jsx("div",{children:Pp(j)})]})]})}function Q0(i){return new Date(i).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ec(){return l.jsx("span",{style:{color:"var(--ink-2)",opacity:.6},children:"·"})}function V0({name:i,folder:c,lastRun:u,onOpen:o,onUnlink:d,style:h}){const[g,y]=m.useState(!1),[b,v]=m.useState(!1),S=u?.usage?u.usage.inputTokens+u.usage.outputTokens:null;return l.jsxs("article",{role:"button",tabIndex:0,onClick:o,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),o?.())},onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),style:{background:"var(--bg-card)",borderRadius:"var(--r-md)",cursor:"pointer",border:`1px solid ${g?"var(--line-strong)":"var(--line)"}`,padding:"var(--sp-3) var(--sp-4)",display:"flex",flexDirection:"column",gap:6,minWidth:0,transition:"border-color var(--dur-fast) var(--ease)",...h},children:[l.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",minWidth:0},children:[l.jsx("span",{style:{fontSize:"var(--fs-md)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),l.jsx("span",{title:c,style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginLeft:"auto"},children:rr(c)})]}),u?l.jsxs(l.Fragment,{children:[l.jsx("div",{title:u.mission,style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.title||u.mission}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:[l.jsx(fa,{status:u.status}),u.createdAt&&l.jsxs(l.Fragment,{children:[l.jsx(Ec,{}),Q0(u.createdAt)]}),u.costBasis==="priced"?l.jsxs(l.Fragment,{children:[l.jsx(Ec,{}),"$",(Number(u.costUsd)||0).toFixed(2)]}):S!==null?l.jsxs(l.Fragment,{children:[l.jsx(Ec,{}),Ha(S)," tok"]}):null]})]}):l.jsx("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:"No missions yet — open to compose one."}),l.jsx("div",{style:{display:"flex",justifyContent:"flex-end",height:14,marginTop:-2},children:l.jsxs("button",{type:"button",tabIndex:g?0:-1,onClick:x=>{x.stopPropagation(),d?.()},onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),title:"Unlink project (run history is kept)",style:{display:"inline-flex",alignItems:"center",gap:4,background:"none",border:"none",cursor:"pointer",padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:b?"var(--ink-0)":"var(--ink-2)",opacity:g?1:0,pointerEvents:g?"auto":"none",transition:"opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease)"},children:[l.jsx(se,{name:"unlink",size:11}),"Unlink"]})})]})}function W0({onClick:i,style:c}){const[u,o]=m.useState(!1);return l.jsxs("div",{role:"button",onClick:i,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{border:`1px dashed ${u?"var(--ink-2)":"var(--line-strong)"}`,borderRadius:"var(--r-md)",minHeight:"var(--card-min-h)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--sp-2)",cursor:"pointer",color:u?"var(--ink-0)":"var(--ink-1)",background:u?"var(--bg-hover)":"transparent",transition:"border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease)",...c},children:[l.jsx(se,{name:"add",size:22,strokeWidth:1.5}),l.jsx("span",{style:{fontSize:"var(--fs-sm)"},children:"Link a project"}),l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"or drop a folder anywhere"})]})}const hp={ok:{icon:"done",color:"var(--status-good)"},warn:{icon:"caution",color:"var(--status-serious)"},error:{icon:"critical",color:"var(--status-critical)"}};function K0({load:i,onSettings:c,onInstallBrowser:u,install:o,style:d}){const[h,g]=m.useState(null),[y,b]=m.useState(!1),[v,S]=m.useState(null),x=async()=>{b(!0),S(null);try{const k=await i();if(!k.ok)throw new Error(`HTTP ${k.status}`);g((await k.json()).checks??[])}catch(k){S(k instanceof Error?k.message:String(k))}finally{b(!1)}};m.useEffect(()=>{x()},[]);const j=(h??[]).filter(k=>k.status!=="ok").length;return l.jsxs("section",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-md)",background:"var(--bg-card)",padding:"var(--sp-3) var(--sp-4)",textAlign:"left",display:"flex",flexDirection:"column",gap:"var(--sp-2)",...d},children:[l.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[l.jsx("span",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)",flex:1},children:"This machine"}),h&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:j?"var(--status-serious)":"var(--ink-2)"},children:j?`${j} thing${j===1?"":"s"} to look at`:"ready"}),l.jsx(ie,{variant:"ghost",size:"sm",icon:y?"loading":"resume",onClick:x,disabled:y,children:"Check again"}),l.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>{window.location.hash="#/setup"},children:"Walk-through"})]}),v&&l.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--status-critical)"},children:["Could not run the checks: ",v]}),!h&&!v&&l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Checking…"}),h&&l.jsx("div",{style:{display:"flex",flexDirection:"column"},children:h.map(k=>{const U=hp[k.status]||hp.warn;return l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"16px minmax(0, 1fr)",columnGap:"var(--sp-2)",padding:"5px 0",borderTop:"1px solid var(--line)",fontSize:"var(--fs-sm)"},children:[l.jsx(se,{name:U.icon,size:14,color:U.color,style:{marginTop:2}}),l.jsxs("div",{style:{minWidth:0},children:[l.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"baseline",minWidth:0},children:[l.jsx("span",{style:{color:"var(--ink-0)",flex:"0 0 auto"},children:k.name}),l.jsx("span",{style:{color:"var(--ink-2)",minWidth:0,overflowWrap:"anywhere"},children:k.detail})]}),k.fix&&k.status!=="ok"&&l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-1)",marginTop:2,overflowWrap:"anywhere"},children:k.fix}),k.name==="Browser"&&k.status!=="ok"&&!/install-deps/.test(k.fix||"")&&u&&l.jsxs("div",{style:{marginTop:4,display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[l.jsx(ie,{size:"sm",icon:o?.state==="running"?"loading":"add",disabled:o?.state==="running",onClick:u,children:o?.state==="running"?"Installing…":"Install Playwright Chromium"}),o&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:o.state==="error"?"var(--status-critical)":"var(--ink-2)",fontFamily:"var(--font-mono)"},children:o.state==="error"?o.error:o.progress})]})]})]},k.name)})}),l.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:["A project can run on a provider of its own — an Anthropic API key, a Codex login or any OpenAI-compatible endpoint — from"," ",l.jsx("button",{type:"button",onClick:c,style:{background:"none",border:"none",padding:0,font:"inherit",color:"var(--brand)",cursor:"pointer",textDecoration:"underline"},children:"Settings → Provider"})," ","once it is linked."]})]})}function Di({width:i=480,children:c,onClose:u,dismissible:o=!0,style:d}){return l.jsx("div",{onClick:h=>{o&&h.target===h.currentTarget&&u?.()},style:{position:"fixed",inset:0,background:"var(--scrim)",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},children:l.jsx("div",{style:{width:i,maxHeight:"70vh",display:"flex",flexDirection:"column",background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",overflow:"hidden",...d},children:c})})}function Pc({children:i,style:c}){return l.jsx("div",{style:{padding:"var(--sp-3)",borderBottom:"1px solid var(--line)",wordBreak:"break-all",...c},children:i})}function Ri({children:i,style:c}){return l.jsx("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center",padding:"var(--sp-3)",borderTop:"1px solid var(--line)",...c},children:i})}function We({value:i,onChange:c,placeholder:u,type:o="text",min:d,max:h,step:g,width:y,mono:b,prefix:v,autoFocus:S,onKeyDown:x,style:j}){const k=l.jsx("input",{type:o,min:d,max:h,step:g,value:i,autoFocus:S,placeholder:u,onKeyDown:x,onChange:U=>c?.(o==="number"?Number(U.target.value):U.target.value),style:{width:v?"100%":y??"100%",background:v?"transparent":"var(--bg-card)",border:v?"none":"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",padding:v?"6px 9px 6px 0":"6px 9px",color:"var(--ink-0)",outline:v?"none":void 0,fontFamily:b?"var(--font-mono)":"var(--font-ui)",...v?null:j}});return v?l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",width:y??"100%",boxSizing:"border-box",background:"var(--bg-card)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",paddingLeft:9,...j},children:[l.jsx("span",{style:{color:"var(--ink-2)",marginRight:4,userSelect:"none"},children:v}),k]}):k}function dn({tabs:i,value:c,onChange:u,size:o="md",style:d}){return l.jsx("div",{role:"tablist",style:{display:"inline-flex",gap:2,padding:2,background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",...d},children:i.map(h=>l.jsx(Z0,{tab:h,selected:h.value===c,size:o,onSelect:()=>u?.(h.value)},h.value))})}function Z0({tab:i,selected:c,size:u,onSelect:o}){const[d,h]=m.useState(!1);return l.jsxs("button",{type:"button",role:"tab","aria-selected":c,onClick:o,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{display:"inline-flex",alignItems:"center",gap:6,padding:u==="sm"?"3px 8px":"5px 10px",borderRadius:4,border:"none",cursor:"pointer",fontSize:u==="sm"?"var(--fs-xs)":"var(--fs-sm)",fontWeight:c?"var(--fw-semibold)":"var(--fw-regular)",background:c?"var(--bg-card)":d?"var(--bg-hover)":"transparent",color:c?"var(--ink-0)":"var(--ink-1)",whiteSpace:"nowrap",boxShadow:c?"inset 0 0 0 1px var(--line-strong)":"none",transition:"background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease)"},children:[i.icon&&l.jsx(se,{name:i.icon,size:u==="sm"?12:14}),i.label,i.count>0&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",padding:"0 5px",borderRadius:"var(--r-pill)",lineHeight:"16px",background:i.attention?"var(--status-warning)":"var(--line-strong)",color:i.attention?"var(--brand-ink)":"var(--ink-0)",fontWeight:"var(--fw-semibold)"},children:i.count})]})}function pp({children:i,icon:c,onClick:u}){const[o,d]=m.useState(!1);return l.jsxs("div",{role:"button",onClick:u,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:8,padding:"7px 12px",cursor:"pointer",fontSize:"var(--fs-md)",background:o?"var(--bg-card)":"transparent",transition:"background var(--dur-fast) var(--ease)"},children:[l.jsx(se,{name:c,size:15,color:"var(--ink-1)"}),i]})}function F0({path:i="…",parent:c,dirs:u=[],error:o,onNavigate:d,onCreate:h,onPick:g,onClone:y,cloneWhere:b,clone:v,onClose:S}){const[x,j]=m.useState("folder"),[k,U]=m.useState(!1),[Z,C]=m.useState(""),[z,D]=m.useState(""),[B,J]=m.useState(""),[re,q]=m.useState(null),N=v?.state==="running",$=!!z.trim()&&!!re?.dest&&!N;m.useEffect(()=>{if(!b)return;const Q=z.trim();if(!Q){q(null);return}let W=!1;const ge=setTimeout(()=>{Promise.resolve(b(Q)).then(oe=>{W||q(oe)}).catch(()=>{W||q(null)})},250);return()=>{W=!0,clearTimeout(ge)}},[z,b]);const Y=()=>{$&&y?.(z.trim(),B.trim()||void 0)},de=x==="git"&&y;return l.jsxs(Di,{width:520,onClose:N?void 0:S,children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)",padding:"var(--sp-3) var(--sp-3) var(--sp-2)"},children:[l.jsx("span",{style:{fontWeight:"var(--fw-semibold)"},children:"Link a project"}),y&&l.jsx(dn,{size:"sm",value:x,onChange:Q=>{N||j(Q)},style:{marginLeft:"auto"},tabs:[{value:"folder",label:"Folder on this machine",icon:"folder"},{value:"git",label:"Git repository",icon:"provider"}]})]}),de?l.jsxs("div",{style:{padding:"0 var(--sp-3) var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.jsx("label",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Repository"}),l.jsx(We,{autoFocus:!0,placeholder:"https://github.com/owner/repo · git@host:owner/repo.git · owner/repo",value:z,onChange:D,disabled:N,onKeyDown:Q=>{Q.key==="Enter"&&Y()}})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.jsxs("label",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Branch ",l.jsx("span",{style:{color:"var(--ink-3, var(--ink-2))"},children:"· optional, the default branch otherwise"})]}),l.jsx(We,{placeholder:"main",value:B,onChange:J,disabled:N,width:220,onKeyDown:Q=>{Q.key==="Enter"&&Y()}})]}),l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",display:"flex",flexDirection:"column",gap:4},children:[!z.trim()&&l.jsx("span",{children:"Will be cloned under your projects root and linked as a project. Paste a URL to see the exact folder."}),z.trim()&&re?.dest&&l.jsxs("span",{children:["Will be cloned to ",l.jsx("span",{style:{fontFamily:"var(--font-mono)",color:"var(--brand)"},children:re.dest})," and linked as ",l.jsx("b",{style:{color:"var(--ink-1)"},children:re.name}),"."]}),z.trim()&&re&&!re.dest&&l.jsx("span",{style:{color:"var(--status-error)"},children:re.error}),z.trim()&&!re&&l.jsx("span",{children:"Checking…"}),l.jsxs("span",{children:["Runs ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"git clone"})," as you, with your own SSH keys and credential helpers. Foreman never asks for a token. Full clone, so the deck can diff against it."]})]}),v?.state==="running"&&l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-1)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v.progress||"Starting git…"}),v?.state==="error"&&l.jsx(lt,{tone:"error",inline:!0,style:{fontSize:"var(--fs-xs)"},children:v.error})]}):l.jsxs(l.Fragment,{children:[l.jsx(Pc,{style:{font:"var(--fs-sm) var(--font-mono)",color:"var(--brand)"},children:i}),l.jsxs("div",{style:{overflowY:"auto",flex:1},children:[c&&l.jsx(pp,{icon:"parent",onClick:()=>d?.(c),children:".."}),u.map(Q=>l.jsx(pp,{icon:"folder",onClick:()=>d?.(`${i}${i.endsWith("/")?"":"/"}${Q}`),children:Q},Q)),u.length===0&&l.jsx("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:"No subfolders."})]}),k&&l.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center",padding:"var(--sp-2) var(--sp-3)",borderTop:"1px solid var(--line)"},children:[l.jsx(We,{autoFocus:!0,placeholder:"New folder name",value:Z,onChange:C,onKeyDown:Q=>{Q.key==="Enter"&&h?.(Z)},style:{flex:1}}),l.jsx(ie,{variant:"good",onClick:()=>h?.(Z),children:"Create"})]}),o&&l.jsx("div",{style:{padding:"4px var(--sp-3)"},children:l.jsx(lt,{tone:"error",inline:!0,style:{fontSize:"var(--fs-xs)"},children:o})})]}),l.jsxs(Ri,{children:[de?null:l.jsx(ie,{icon:"add",onClick:()=>U(!k),title:"Create a subfolder here",children:"New folder"}),l.jsx("span",{style:{flex:1}}),l.jsx(ie,{onClick:S,disabled:N,children:"Cancel"}),de?l.jsx(ie,{variant:"primary",disabled:!$,onClick:Y,children:N?"Cloning…":"Clone & link"}):l.jsx(ie,{variant:"primary",onClick:()=>g?.(i),children:"Select this folder"})]})]})}function J0({name:i,matches:c,onPick:u,onClose:o}){const[d,h]=m.useState(null);return l.jsxs(Di,{width:520,onClose:o,style:{maxHeight:"60vh"},children:[l.jsxs(Pc,{children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontWeight:"var(--fw-semibold)"},children:[l.jsx(se,{name:"folder",size:16,color:"var(--ink-1)"}),i]}),l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginTop:2},children:"Browsers hide dropped folders' full paths — pick the matching location."})]}),l.jsxs("div",{style:{overflowY:"auto",flex:1},children:[c==null&&l.jsx("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:"Searching your home folder…"}),c?.map(g=>l.jsx("div",{role:"button",onClick:()=>u?.(g),onMouseEnter:()=>h(g),onMouseLeave:()=>h(null),style:{padding:"8px 12px",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",background:d===g?"var(--bg-card)":"transparent",transition:"background var(--dur-fast) var(--ease)"},children:g},g)),c?.length===0&&l.jsxs("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:["No folder named “",i,"” found under your home directory — use the folder picker instead."]})]}),l.jsx(Ri,{style:{justifyContent:"flex-end"},children:l.jsx(ie,{onClick:o,children:"Cancel"})})]})}function I0({children:i="Drop a folder to link it"}){return l.jsxs("div",{style:{position:"absolute",inset:8,zIndex:5,pointerEvents:"none",border:"2px dashed var(--brand)",borderRadius:"var(--r-md)",background:"var(--brand-wash)",display:"flex",alignItems:"center",gap:10,justifyContent:"center",color:"var(--brand)",fontSize:"var(--fs-lg)"},children:[l.jsx(se,{name:"folder",size:20}),i]})}function P0({title:i,body:c,confirmLabel:u="Confirm",tone:o="danger",icon:d,onConfirm:h,onCancel:g}){return l.jsxs(Di,{width:420,onClose:g,children:[l.jsx(Pc,{children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontWeight:"var(--fw-semibold)"},children:[d&&l.jsx(se,{name:d,size:16,color:o==="danger"?"var(--status-critical)":"var(--ink-1)"}),i]})}),l.jsx("div",{style:{padding:"var(--sp-3)",fontSize:"var(--fs-md)",color:"var(--ink-1)",lineHeight:"var(--lh-prose)"},children:c}),l.jsxs(Ri,{style:{justifyContent:"flex-end"},children:[l.jsx(ie,{onClick:g,children:"Cancel"}),l.jsx(ie,{variant:o,onClick:h,children:u})]})]})}const vp="foreman.fleet.desk";function e1(){const[i,c]=m.useState(()=>{try{return localStorage.getItem(vp)!=="closed"}catch{return!0}});return[i,()=>c(o=>{try{localStorage.setItem(vp,o?"closed":"open")}catch{}return!o})]}function t1({onSettings:i,open:c,onToggle:u}){const o=$p(Bm),[d,h]=m.useState(null),g=m.useRef(null),y=o.entries.filter(j=>j.kind!=="tool"),[b,v]=m.useState(!1),S=m.useRef(0);m.useEffect(()=>{c?(S.current=y.length,v(!1)):y.length>S.current&&!o.thinking&&v(!0)},[c,y.length,o.thinking]),m.useEffect(()=>{c&&g.current?.scrollIntoView({block:"end"})},[y.length,o.thinking,c]);const x=async j=>h(await o.send(j));return c?l.jsxs("aside",{style:{width:"clamp(22rem, 28vw, 30rem)",flex:"0 0 auto",minHeight:0,display:"flex",flexDirection:"column",borderLeft:"1px solid var(--line)",background:"var(--bg-panel)"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",flex:"0 0 auto"},children:[l.jsx("span",{style:{color:"var(--ink-0)",fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)"},children:"Front desk"}),l.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:"the same conversation as your phone"}),l.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",gap:"var(--sp-1)",alignItems:"center",flex:"0 0 auto"},children:[o.costUsd>0&&l.jsxs("span",{title:"What this conversation has cost. Not charged to any mission.",style:{fontVariantNumeric:"tabular-nums",marginRight:"var(--sp-1)"},children:["$",o.costUsd.toFixed(2)]}),y.length>0&&!o.thinking&&l.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>{o.clear()},title:"Forget this conversation; the next message starts fresh",children:"Forget"}),l.jsx(Na,{icon:"chevronRight",label:"Fold the front desk away",onClick:u})]})]}),l.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[y.length===0&&!o.thinking&&l.jsx(Fe,{children:"Ask how things are going, or say what you want started where. It knows every project, can open a planning conversation, propose a mission, or pass a note to a running director. It never starts a run or answers an approval for you."}),y.map(j=>l.jsx(Ic,{agent:j.agent,title:j.title,kind:j.kind,body:j.body,ts:j.ts},j.id)),l.jsx("div",{ref:g})]}),l.jsxs("div",{style:{flex:"0 0 auto",padding:"var(--sp-2) var(--sp-3) var(--sp-3)",borderTop:"1px solid var(--line)"},children:[l.jsx(Xc,{busy:o.thinking,who:o.who,placeholder:"How is everything going?",attach:!1,hint:"Knows the fleet. Never starts a run or answers for you.",busyHint:"The front desk is looking…",onSend:j=>{x(j)},onStop:()=>{o.stop()},onChangeModel:i}),d&&l.jsx(lt,{tone:"error",inline:!0,style:{marginTop:4},children:d})]})]}):l.jsx("aside",{style:{flex:"0 0 auto",borderLeft:"1px solid var(--line)",background:"var(--bg-panel)",display:"flex",flexDirection:"column",alignItems:"center",padding:"var(--sp-2) 4px"},children:l.jsxs("button",{type:"button",onClick:u,title:o.thinking?"The front desk is replying — open it":b?"The front desk answered — open it":"Open the front desk (the same conversation as your phone)","aria-label":"Open the front desk",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,background:"none",border:0,padding:"6px 4px",cursor:"pointer",color:"var(--ink-2)",borderRadius:"var(--r-sm)",position:"relative"},children:[l.jsx(se,{name:"chevronLeft",size:14}),l.jsx("span",{style:{writingMode:"vertical-rl",fontSize:"var(--fs-xs)",letterSpacing:".06em",textTransform:"uppercase"},children:"Front desk"}),(b||o.thinking)&&l.jsx("span",{"aria-hidden":!0,style:{position:"absolute",top:4,right:2,width:7,height:7,borderRadius:"50%",background:o.thinking?"var(--ink-2)":"var(--brand)"}})]})})}function n1(i,c){const u=i.activeRun??i.lastRun;return[i.name,i.folder,u?.title,u?.mission].some(o=>o?.toLowerCase().includes(c))}function a1(i){const c=[];for(const u of i){if(Array.isArray(u.needs)){const h=[...u.needs].sort((g,y)=>(g.since??0)-(y.since??0));for(const g of h)c.push({...g,projectId:u.id,projectName:u.name});continue}const o=u.pendingPermissions||0,d=u.pendingQuestions||0;o+d!==0&&c.push({projectId:u.id,projectName:u.name,kind:"summary",text:L0({approvals:o,questions:d,planner:!!u.plannerQuestion})})}return c}async function l1(i){return i.ok?null:(await i.json().catch(()=>({}))).error??(i.status===404?"already answered or timed out":`HTTP ${i.status}`)}function i1(i,c){const[u,o]=m.useState(!1),[d,h]=m.useState(null),[g,y]=m.useState(""),[b,v]=m.useState(null),S=async(k,U)=>{v({state:"running",progress:"Starting git…"});const Z=await _e.cloneProject(k,U),C=await Z.json().catch(()=>({}));if(!Z.ok){v({state:"error",error:C.error??`HTTP ${Z.status}`});return}const z=C.id,D=async()=>{const B=await _e.cloneStatus(z).catch(()=>null),J=B&&B.ok?await B.json():null;if(!J){v({state:"error",error:"Lost track of the clone. Check the projects root."});return}if(J.state==="running"){v({state:"running",progress:J.progress,dest:J.dest}),setTimeout(()=>{D()},1e3);return}if(J.state==="error"){v({state:"error",error:J.error});return}v(null),o(!1),h(null),J.projectId&&c(J.projectId)};D()},x=async k=>{y("");const U=await _e.browse(k);U.ok&&h(await U.json())},j=async k=>{if(!d)return;y("");const U=await _e.mkdir(d.path,k);U.ok?await x((await U.json().catch(()=>null))?.path??d.path):y((await U.json()).error)};return{open:u,show:()=>{o(!0),x()},close:()=>{b?.state!=="running"&&(o(!1),h(null),v(null))},props:d&&{path:d.path,parent:d.parent,dirs:d.dirs,error:g,onNavigate:k=>{x(k)},onCreate:k=>{j(k)},onPick:k=>{o(!1),h(null),i(k)},onClone:(k,U)=>{S(k,U)},cloneWhere:k=>_e.cloneWhere(k).then(U=>U.json()),clone:b}}}const _c={display:"flex",flexDirection:"column",gap:"var(--sp-2)"};function s1({projects:i,connected:c,activity:u,auth:o,onOpen:d,onOpenRun:h,refresh:g,theme:y,onToggleTheme:b,onSettings:v,query:S="",onQuery:x,search:j}){const[k,U]=m.useState(!1),[Z,C]=e1(),[z,D]=m.useState(null),[B,J]=m.useState(null),re=async _=>{const F=await _e.linkProject(_);F.ok&&(g(),d((await F.json()).project.id))},q=Gp(),N=i1(_=>{re(_)},_=>{g(),d(_)}),$=S.trim().toLowerCase(),Y=$?i.filter(_=>n1(_,$)):i,de=a1(Y),Q=Y.filter(_=>_.activeRun).sort((_,F)=>(F.lastActivityAt??0)-(_.lastActivityAt??0)),W=Y.filter(_=>!_.activeRun),ge=i.filter(_=>_.activeRun).length,oe=i.reduce((_,F)=>_+(Array.isArray(F.needs)?F.needs.length:(F.pendingPermissions||0)+(F.pendingQuestions||0)),0),ne=ge===0&&oe===0,E=ne&&i.length>0?"all quiet":[ge>0?`${ge} running`:null,oe>0?`${oe} needs you`:null].filter(Boolean).join(" · "),G=async _=>{_.preventDefault(),U(!1);const F=_.dataTransfer.items[0]?.webkitGetAsEntry?.();if(!F?.isDirectory)return;D({name:F.name,matches:null});const I=await _e.locate(F.name);D({name:F.name,matches:I.ok?(await I.json()).matches:[]})},P=async _=>{const F=await l1(await _);return g(),F},me=(_,F)=>P(_e.permission(_.id,F)),xe=(_,F)=>P(_e.answer(_.id,F)),T=(_,F)=>P(fetch("/chat/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({projectId:_.projectId,id:_.id,answers:{[_.text]:F}})}));return l.jsxs("div",{style:{height:"100%",overflow:"hidden",position:"relative",display:"flex",flexDirection:"column"},onDragOver:_=>{_.preventDefault(),U(!0)},onDragLeave:_=>{_.target===_.currentTarget&&U(!1)},onDrop:_=>{G(_)},children:[k&&l.jsx(I0,{}),l.jsxs(Ip,{mode:"fleet",subtitle:"mission control",theme:y,onToggleTheme:b,onSettings:v,search:j,children:[!c&&l.jsx(lt,{tone:"disconnected",inline:!0,children:"disconnected"}),c&&o.mode==="none"&&l.jsx(lt,{tone:"caution",inline:!0,children:"No model credentials on this machine, so missions cannot start. Sign in with Claude Code and restart Foreman, or give a project its own API key or endpoint in Settings → Provider."}),E&&l.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"2px 10px",borderRadius:"var(--r-pill)",border:`1px solid ${oe>0?"var(--status-warning)":ne?"var(--line)":"var(--line-strong)"}`,background:oe>0?"var(--brand-wash)":"transparent",fontSize:"var(--fs-xs)",color:ne?"var(--ink-3)":"var(--ink-1)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:E}),i.length>0&&l.jsx(ie,{variant:"primary",icon:"add",onClick:N.show,title:"Link a folder as a project (or drop one anywhere on this page)",children:"Link project"})]}),l.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[l.jsxs("div",{style:{flex:1,minWidth:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:[$&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",maxWidth:"var(--fleet-max)",margin:"0 auto",width:"100%",padding:"var(--sp-4) var(--sp-5) 0",boxSizing:"border-box",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[l.jsxs("span",{children:["Showing projects matching “",S.trim(),"” · ",l.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[Y.length," of ",i.length]})]}),l.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>x?.(""),children:"Show all"})]}),i.length===0?l.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--sp-3)",padding:"var(--sp-5)",textAlign:"center"},children:[l.jsx("div",{style:{width:"20rem",maxWidth:"100%"},children:l.jsx(W0,{onClick:N.show})}),l.jsx(Fe,{children:"No projects linked yet — link a folder to give the director a job site."}),l.jsx("div",{style:{width:"32rem",maxWidth:"100%",marginTop:"var(--sp-3)"},children:l.jsx(K0,{load:_e.doctor,onSettings:()=>v("provider"),onInstallBrowser:q.start,install:q.job})})]}):l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-5)",padding:"var(--sp-5)",maxWidth:"var(--fleet-max)",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:[Y.length===0&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[l.jsxs(Fe,{children:["No project matches “",S.trim(),"”. Runs that do are in the search box above."]}),l.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>x?.(""),children:"Show all"})]}),de.length===0&&Q.length===0&&Y.length>0&&l.jsx(Fe,{children:"All quiet — nothing running, nothing waiting on you. Open a project to plan its next mission."}),de.length>0&&l.jsxs("section",{style:_c,children:[l.jsxs(Rn,{children:["Needs you · ",de.length]}),l.jsx(q0,{items:de,onPermission:me,onAnswer:xe,onPlanner:T,onOpen:d})]}),Q.length>0&&l.jsxs("section",{style:_c,children:[l.jsxs(Rn,{children:["Running · ",Q.length]}),l.jsx("div",{style:{background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-md)",overflow:"hidden"},children:Q.map((_,F)=>{const I=_.activeRun;return l.jsx(X0,{name:_.name,folder:_.folder,title:I.title,mission:I.mission,activity:u[_.id],costUsd:I.costUsd,budgetUsd:I.budgetUsd,costBasis:da(I),usage:I.usage,turns:I.turns,directorModel:I.directorModel,workerModel:I.workerModel,createdAt:I.createdAt,onOpen:()=>d(_.id),style:F>0?{borderTop:"1px solid var(--line)"}:void 0},_.id)})})]}),W.length>0&&l.jsxs("section",{style:_c,children:[l.jsxs(Rn,{children:["Recent · ",W.length]}),l.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"var(--sp-3)"},children:W.map(_=>l.jsx(V0,{name:_.name,folder:_.folder,lastRun:_.lastRun&&_.lastRun.status!=="idle"&&_.lastRun.status!=="running"?_.lastRun:null,onOpen:()=>{const F=_.lastRun;F?.id&&h&&(F.status==="error"||F.status==="interrupted")?h(_.id,F.id):d(_.id)},onUnlink:()=>J(_)},_.id))})]})]})]}),i.length>0&&l.jsx(t1,{onSettings:v,open:Z,onToggle:C})]}),N.open&&N.props&&l.jsx(F0,{...N.props,onClose:N.close}),z&&l.jsx(J0,{name:z.name,matches:z.matches,onPick:_=>{D(null),re(_)},onClose:()=>D(null)}),B&&l.jsx(P0,{title:`Unlink ${B.name}?`,body:"Foreman stops tracking this folder. Run history and its .foreman/ files stay on disk; you can link it again later.",confirmLabel:"Unlink",tone:"danger",icon:"unlink",onConfirm:()=>{const _=B.id;J(null),_e.unlinkProject(_).then(g)},onCancel:()=>J(null)})]})}const gp=["Welcome","Where missions run","Your phone","Reach & browser","Ready"],r1={ok:{icon:"done",color:"var(--status-good)"},warn:{icon:"caution",color:"var(--status-serious)"},none:{icon:"idle",color:"var(--ink-2)"}};function vt({tone:i,title:c,children:u}){const o=r1[i];return l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"20px minmax(0, 1fr)",columnGap:"var(--sp-2)",padding:"var(--sp-2) 0",borderTop:"1px solid var(--line)"},children:[l.jsx(se,{name:o.icon,size:16,color:o.color,style:{marginTop:2}}),l.jsxs("div",{style:{minWidth:0},children:[l.jsx("div",{style:{color:"var(--ink-0)",fontWeight:"var(--fw-semibold)"},children:c}),u&&l.jsx("div",{style:{color:"var(--ink-1)",marginTop:2,lineHeight:"var(--lh)"},children:u})]})]})}function Kt({children:i}){return l.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:"0.92em",background:"var(--bg-inset)",padding:"1px 5px",borderRadius:"var(--r-xs, 3px)"},children:i})}function o1({onDone:i,onSettings:c}){const[u,o]=m.useState(0),[d,h]=m.useState(null),[g,y]=m.useState(!1),[b,v]=m.useState(null),S=async()=>{y(!0),v(null);try{const C=await _e.doctor();if(!C.ok)throw new Error(`HTTP ${C.status}`);h(await C.json())}catch(C){v(C instanceof Error?C.message:String(C))}finally{y(!1)}};m.useEffect(()=>{S()},[]),m.useEffect(()=>{u>0&&S()},[u]);const x=Gp(()=>{S()}),j=x.job?.state==="running",k=d?d.auth.mode==="none"&&!d.ollama&&!d.codex:!1,U=u===gp.length-1,Z=()=>{if(u===0)return l.jsxs(l.Fragment,{children:[l.jsx("h1",{style:Mi,children:"Foreman runs missions on your projects."}),l.jsx("p",{style:Cl,children:"You link a folder, talk over what should happen with a planner that reads the code and never changes it, and start a mission with a budget. A director plans the work, hires workers, verifies what they did and stops at the cap. You approve what matters — from here or from your phone — and read the result: the files that changed, the screenshots, the branch, a pull request when you want one."}),l.jsx("p",{style:Cl,children:"The next four pages show what this machine has for that. Nothing on them is required; anything missing says how to get it."})]});if(!d)return l.jsx("p",{style:Cl,children:b?`Could not read this machine: ${b}`:"Reading this machine…"});if(u===1){const z=d.auth;return l.jsxs(l.Fragment,{children:[l.jsx("h1",{style:Mi,children:k?"Nothing to run missions on yet.":"Where missions run."}),l.jsx("p",{style:Cl,children:"Missions run through a model provider. By default that is the Claude Code install on this machine, and whoever it is signed in as pays. A project can also have a provider of its own."}),l.jsxs("div",{children:[z.mode==="subscription"&&l.jsxs(vt,{tone:"ok",title:`Claude Code is signed in${z.account?.email?` as ${z.account.email}`:""}`,children:["Missions bill that subscription",z.account?.org?` (${z.account.org})`:"",". Source: ",l.jsx(Kt,{children:z.source}),"."]}),z.mode==="api-key"&&l.jsxs(vt,{tone:"ok",title:"An Anthropic API key is set in the environment",children:["Missions bill that key, per token. Source: ",l.jsx(Kt,{children:z.source}),"."]}),z.mode==="cloud"&&l.jsx(vt,{tone:"ok",title:`Claude through ${z.source}`,children:"Missions bill that cloud account."}),z.mode==="none"&&l.jsxs(vt,{tone:"warn",title:"Claude Code is not signed in on this machine",children:["Until it is, or a project gets a provider of its own, nothing can run. Three ways forward:",l.jsxs("ol",{style:{margin:"var(--sp-2) 0 0",paddingLeft:"1.2em",display:"flex",flexDirection:"column",gap:4},children:[l.jsxs("li",{children:["In a terminal, run ",l.jsx(Kt,{children:"claude"}),", then ",l.jsx(Kt,{children:"/login"}),". Restart Foreman and press ",l.jsx("em",{children:"Check again"}),"."]}),l.jsxs("li",{children:["Start Foreman with ",l.jsx(Kt,{children:"ANTHROPIC_API_KEY"})," set. The key is billed per token."]}),l.jsx("li",{children:"Link a project, then give it an Anthropic API key, a Codex login or any OpenAI-compatible endpoint in Settings → Provider."})]})]}),d.ollama&&l.jsxs(vt,{tone:"ok",title:`Ollama is running with ${d.ollama.models} model${d.ollama.models===1?"":"s"}`,children:[d.ollama.local," served from this machine at no cost per token; the rest are cloud models Ollama proxies. They appear in every model picker."]}),d.codex&&l.jsx(vt,{tone:"ok",title:`Codex is signed in, ${d.codex.models} model${d.codex.models===1?"":"s"}`,children:"Runs on the ChatGPT subscription. In every model picker as well."}),!d.ollama&&!d.codex&&z.mode!=="none"&&l.jsx(vt,{tone:"none",title:"No local Ollama or Codex",children:"Not needed. If either is installed later, its models show up in the pickers on their own."})]})]})}if(u===2){const z=d.phone;return l.jsxs(l.Fragment,{children:[l.jsx("h1",{style:Mi,children:"Your phone."}),l.jsx("p",{style:Cl,children:"Foreman can reach you on Telegram: an approval to tap, a question to answer, a mission that finished, a budget alert. From there you can also talk to the front desk and start planning. Optional, and the bot token is only ever typed into Settings."}),l.jsxs("div",{children:[z?.label&&l.jsxs(vt,{tone:"ok",title:`Linked to ${z.label}`,children:["Through ",z.bot?l.jsxs(Kt,{children:["@",z.bot.replace(/^@/,"")]}):"your bot","."]}),z&&!z.label&&l.jsxs(vt,{tone:"warn",title:"A bot is configured but no chat is linked yet",children:["Send it ",l.jsx(Kt,{children:"/start"})," from your phone to link this chat."]}),!z&&l.jsxs(vt,{tone:"none",title:"Not set up",children:["Create a bot with @BotFather, paste its token in Settings → Notifications, then send it ",l.jsx(Kt,{children:"/start"}),"."]})]}),l.jsx("div",{children:l.jsx(ie,{variant:"ghost",size:"sm",icon:"needsYou",onClick:()=>c("notifications"),children:"Settings → Notifications"})})]})}if(u===3){const z=d.tailnet,D=d.browser;return l.jsxs(l.Fragment,{children:[l.jsx("h1",{style:Mi,children:"Reach, and a browser for the crew."}),l.jsxs("div",{children:[z?l.jsxs(vt,{tone:"ok",title:`On a tailnet: ${z.dnsName??z.ip}`,children:["The dashboard is also at ",l.jsx(Kt,{children:z.url}),z.https?", over HTTPS":"",". Phone links open there.",!z.https&&l.jsxs(l.Fragment,{children:[" For HTTPS, ",l.jsx(Kt,{children:"tailscale serve"})," can front it; Foreman never opens a Funnel."]})]}):l.jsx(vt,{tone:"none",title:"This machine only",children:"The dashboard listens on localhost. With Tailscale installed it also listens on the tailnet, so the phone can open links; nothing is ever exposed to the internet."}),D&&l.jsxs(vt,{tone:D.status==="ok"?"ok":"warn",title:D.status==="ok"?"A browser for missions":/install-deps/.test(D.fix??"")?"A browser is installed, but it cannot start here":"No browser for missions",children:[D.detail,D.status!=="ok"&&D.fix&&/install-deps/.test(D.fix)&&l.jsxs(l.Fragment,{children:[l.jsx("br",{}),D.fix,l.jsx("br",{}),"That is the one step Foreman will not do for you: it never runs anything as root. Once the libraries are in, press ",l.jsx("em",{children:"Check again"}),". Missions that do not need a browser are unaffected."]}),D.status!=="ok"&&!/install-deps/.test(D.fix??"")&&l.jsxs(l.Fragment,{children:[l.jsx("br",{}),"Missions that do not need a browser are unaffected. Foreman can install Playwright's own Chromium for you — about 150 MB, into your home directory, no administrator rights.",l.jsxs("div",{style:{marginTop:"var(--sp-2)",display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[l.jsx(ie,{variant:"primary",size:"sm",icon:x.job?.state==="running"?"loading":"add",disabled:x.job?.state==="running",onClick:x.start,children:x.job?.state==="running"?"Installing…":"Install Playwright Chromium"}),x.job&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:x.job.state==="error"?"var(--status-critical)":"var(--ink-2)",fontFamily:"var(--font-mono)"},children:x.job.state==="error"?x.job.error:x.job.progress})]})]})]})]})]})}const C=d.auth;return l.jsxs(l.Fragment,{children:[l.jsx("h1",{style:Mi,children:k?"Set up, minus a provider.":"Ready."}),l.jsxs("div",{children:[l.jsxs(vt,{tone:C.mode==="none"?(d.ollama||d.codex,"warn"):"ok",title:"Missions run on",children:[C.mode==="none"?"nothing yet — see page 2":C.mode==="subscription"?`Claude Code${C.account?.email?`, ${C.account.email}`:""}`:C.mode==="api-key"?"an Anthropic API key":C.source,d.ollama?` · Ollama, ${d.ollama.models} models`:"",d.codex?" · Codex":""]}),l.jsx(vt,{tone:d.phone?.label?"ok":"none",title:"Phone",children:d.phone?.label?`Telegram, ${d.phone.label}`:"not linked"}),l.jsx(vt,{tone:d.tailnet?"ok":"none",title:"Reach",children:d.tailnet?`localhost and ${d.tailnet.dnsName??d.tailnet.ip}`:"localhost"}),l.jsx(vt,{tone:d.browser?.status==="ok"?"ok":"warn",title:"Browser",children:d.browser?.status==="ok"?"found":"none — browser missions will fail"})]}),l.jsxs("p",{style:Cl,children:["Next: link a project — a folder on this machine, or a Git URL to clone. The fleet page has the card; dropping a folder anywhere on it works too. This walk-through is at ",l.jsx(Kt,{children:"#/setup"})," whenever you want it, and ",l.jsx(Kt,{children:"foreman doctor"})," says the same in a terminal."]})]})};return l.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--bg-app)",display:"flex",flexDirection:"column"},children:l.jsxs("div",{style:{width:"100%",maxWidth:"44rem",margin:"0 auto",padding:"56px var(--sp-4) 40px",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"var(--sp-4)",flex:1},children:[l.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)"},children:[l.jsx("span",{style:{fontWeight:"var(--fw-semibold)"},children:"Foreman"}),l.jsxs("span",{style:{color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:["first run",d?.version?` · v${d.version}`:""]}),l.jsx("span",{style:{flex:1}}),l.jsx(ie,{variant:"ghost",size:"sm",disabled:j,onClick:i,children:"Skip to the fleet"})]}),l.jsx("ol",{style:{listStyle:"none",margin:0,padding:0,display:"flex",gap:"var(--sp-2)",flexWrap:"wrap"},children:gp.map((C,z)=>{const D=z<u?"done":z===u?"now":"todo";return l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>z<u&&o(z),disabled:z>u,style:{display:"inline-flex",alignItems:"center",gap:6,background:"none",border:"none",padding:"4px 6px",font:"inherit",fontSize:"var(--fs-sm)",cursor:z<u?"pointer":"default",color:D==="now"?"var(--ink-0)":D==="done"?"var(--ink-1)":"var(--ink-2)",fontWeight:D==="now"?"var(--fw-semibold)":"inherit"},children:[l.jsx("span",{style:{width:18,height:18,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"var(--fs-xs)",fontVariantNumeric:"tabular-nums",background:D==="now"?"var(--brand)":D==="done"?"var(--status-good)":"transparent",color:D==="todo"?"var(--ink-2)":"var(--brand-ink)",border:D==="todo"?"1px solid var(--line-strong)":"1px solid transparent"},children:D==="done"?l.jsx(se,{name:"done",size:11}):z+1}),C]})},C)})}),l.jsx("section",{style:{background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-md)",padding:"var(--sp-5)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",fontSize:"var(--fs-md, var(--fs-sm))"},children:Z()}),l.jsxs("footer",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[u>0&&l.jsx(ie,{variant:"ghost",icon:"back",disabled:j,onClick:()=>o(u-1),children:"Back"}),l.jsx("span",{style:{flex:1}}),j&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Installing — stay on this page"}),u>0&&l.jsx(ie,{variant:"ghost",icon:g?"loading":"resume",disabled:g||j,onClick:()=>{S()},children:"Check again"}),U?l.jsx(ie,{variant:"primary",icon:"add",disabled:j,onClick:i,children:"Go link a project"}):l.jsx(ie,{variant:"primary",disabled:j,onClick:()=>o(u+1),children:u===0?"Show me":u===1&&k?"Continue without a provider":"Continue"})]})]})})}const Mi={margin:0,fontSize:"var(--fs-xl, 1.35rem)",fontWeight:"var(--fw-semibold)",lineHeight:1.25,textWrap:"balance"},Cl={margin:0,color:"var(--ink-1)",lineHeight:"var(--lh)",maxWidth:"62ch"},c1=15e3;function u1(i,c){const[u,o]=m.useState(null),[d,h]=m.useState(!1),[g,y]=m.useState(null),[b,v]=m.useState(!1),[S,x]=m.useState(0),j=m.useCallback(()=>x(k=>k+1),[]);return m.useEffect(()=>{if(o(null),y(null),v(!1),!i){h(!1);return}let k=!1;h(!0);const U=async()=>{const C=await fetch(`/runs/${encodeURIComponent(i)}/deck`).catch(()=>null);if(k)return;if(!C){y("Could not reach the server."),h(!1);return}if(C.status===404){v(!0),y(null),h(!1);return}if(!C.ok){const D=await C.json().catch(()=>({}));y(D.error||`HTTP ${C.status}`),h(!1);return}const z=await C.json().catch(()=>null);k||(z&&(o(z),v(!1),y(null)),h(!1))};U();const Z=c?setInterval(()=>{U()},c1):null;return()=>{k=!0,Z&&clearInterval(Z)}},[i,c,S]),{deck:u,loading:d,error:g,missing:b,refresh:j}}function d1(i,c=null){const[u,o]=m.useState([]),[d,h]=m.useState(!1),[g,y]=m.useState(!1),[b,v]=m.useState(null),[S,x]=m.useState(0),j=m.useCallback(()=>x(k=>k+1),[]);return m.useEffect(()=>{if(o([]),v(null),!i){y(!1);return}let k=!1;return y(!0),fetch(`/projects/${encodeURIComponent(i)}/tree`).then(async U=>{if(k)return;if(!U.ok){v((await U.json().catch(()=>({}))).error||`HTTP ${U.status}`);return}const Z=await U.json();o(Z.files??[]),h(!!Z.truncated)}).catch(()=>{k||v("Could not reach the server.")}).finally(()=>{k||y(!1)}),()=>{k=!0}},[i,S,c]),{files:u,truncated:d,loading:g,error:b,refresh:j}}const tv=m.forwardRef(function({value:c,onChange:u,placeholder:o,size:d="mission",bare:h,onKeyDown:g,onPaste:y,onFocus:b,onBlur:v,style:S},x){const j=d==="mission";return l.jsx("textarea",{ref:x,value:c,placeholder:o,onKeyDown:g,onPaste:y,onFocus:b,onBlur:v,onChange:k=>u?.(k.target.value),style:{width:"100%",boxSizing:"border-box",display:"block",minHeight:j?180:void 0,height:j?void 0:56,resize:"vertical",background:h?"transparent":j?"var(--bg-card)":"var(--bg-inset)",border:h?"none":"1px solid var(--line-strong)",outline:h?"none":void 0,borderRadius:h?0:j?"var(--r-md)":"var(--r-sm)",padding:j?"var(--sp-3)":"var(--sp-2)",color:"var(--ink-0)",lineHeight:j?"var(--lh-prose)":"var(--lh)",...S}})});function tr(i){return new Date(i).toLocaleTimeString(void 0,{hour12:!1})}const Ac=[1,5,15,30,60,120,300,600,900,1800,3600,7200,21600].map(i=>i*1e3);function f1(i,c){const u=c-i,o=Ac.find(h=>u/h<=6)??Ac[Ac.length-1],d=[];for(let h=Math.ceil(i/o)*o;h<c;h+=o)d.push(h);return{marks:d,step:o}}function h1({agents:i=[],entries:c=[],live:u,selected:o,onSelect:d,onTick:h,height:g=22,style:y}){if(!c.length)return null;const b=Math.min(...c.map(C=>C.ts)),v=Math.max(...c.map(C=>C.ts)),S=u?Math.min(Math.max(Date.now(),v),v+6e4):v,x=Math.max(S-b,1e3),j=C=>`${(C-b)/x*100}%`,k=C=>(C-b)/x*100,{marks:U}=f1(b,b+x),Z=i.length?i.map(C=>C.id??C):[...new Set(c.map(C=>C.agent))];return l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"84px 1fr",rowGap:4,columnGap:10,fontSize:"var(--fs-xs)",color:"var(--ink-2)",...y},children:[Z.map(C=>{const z=c.filter(q=>q.agent===C);if(!z.length)return null;const D=Math.min(...z.map(q=>q.ts)),B=i.find(q=>(q.id??q)===C)?.status,J=B==="running"&&u?S:Math.max(...z.map(q=>q.ts)),re=o&&o!==C;return l.jsxs(On.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>d?.(C),title:`Filter transcript to ${C}`,style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",padding:0,cursor:d?"pointer":"default",color:re?"var(--ink-2)":"var(--ink-1)",font:"inherit",textAlign:"left",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[l.jsx(fn,{agent:C,size:"sm"}),C]}),l.jsxs("div",{style:{position:"relative",height:g,background:"var(--bg-inset)",borderRadius:4,opacity:re?.45:1,overflow:"hidden"},children:[U.map(q=>l.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:j(q),top:0,bottom:0,width:1,background:"var(--line)",opacity:.9}},q)),l.jsx("div",{style:{position:"absolute",left:j(D),width:`calc(${j(J)} - ${j(D)})`,top:6,bottom:6,minWidth:3,background:sr(C),opacity:.15,borderRadius:3}}),z.map(q=>{const N=l.jsx("span",{style:{display:"block",width:q.kind==="text"?3:2,height:q.kind==="text"?g-6:g-14,borderRadius:1,background:q.kind==="error"?"var(--status-critical)":q.kind==="tool"?"var(--ink-0)":sr(C),boxShadow:"0 0 0 1px var(--bg-inset)"}}),$=`${tr(q.ts)} · ${q.title||q.kind}`;return h?l.jsx("button",{type:"button",title:$,"aria-label":`Jump to ${$}`,onClick:()=>h(q),style:{position:"absolute",left:j(q.ts),top:0,bottom:0,width:9,marginLeft:-4,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer"},children:N},q.id??q.ts):l.jsx("span",{title:$,style:{position:"absolute",left:j(q.ts),top:q.kind==="text"?3:7,marginLeft:-1},children:N},q.id??q.ts)}),u&&B==="running"&&l.jsx("span",{className:"pulse",style:{position:"absolute",right:0,top:0,bottom:0,width:2,background:"var(--status-good)"}})]})]},C)}),l.jsx("span",{}),l.jsxs("div",{style:{position:"relative",height:16,fontVariantNumeric:"tabular-nums"},children:[l.jsx("span",{style:{position:"absolute",left:0,top:0},children:tr(b)}),U.map(C=>{const z=k(C);return z<12||z>88?null:l.jsx("span",{style:{position:"absolute",left:`${z}%`,top:0,transform:"translateX(-50%)",color:"var(--ink-3, var(--ink-2))"},children:tr(C)},C)}),l.jsx("span",{style:{position:"absolute",right:0,top:0},children:u?"now":tr(S)})]})]})}function p1(i){const c=[];let u=!1;for(const o of String(i||"").split(`
28
+ `)){const d=/^#{1,6}\s+(.*)$/.exec(o.trim());if(d){u=/^DONE\s*WHEN/i.test(d[1]);continue}if(u)continue;const h=/^\s*[-*]\s*\[([ xX])\]\s*(.+)$/.exec(o);h&&c.push({done:h[1]!==" ",text:h[2].trim()})}return c}function v1({doc:i,style:c}){const[u,o]=m.useState(!1),d=i?p1(i):[],h=d.filter(g=>g.done).length;return l.jsxs("section",{style:c,children:[l.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)"},children:[l.jsx(Rn,{children:"Plan"}),d.length>0&&l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:[h,"/",d.length]}),i&&l.jsxs("button",{type:"button",onClick:()=>o(!u),style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:4,background:"none",border:"none",cursor:"pointer",color:"var(--ink-2)",fontSize:"var(--fs-xs)",padding:0,font:"inherit"},children:[l.jsx(se,{name:"raw",size:12}),u?"board":"raw doc"]})]}),d.length>0&&!u&&l.jsx("div",{style:{height:3,background:"var(--bg-inset)",borderRadius:2,marginBottom:6,overflow:"hidden"},children:l.jsx("div",{style:{width:`${h/d.length*100}%`,height:"100%",background:"var(--status-good)",transition:"width var(--dur-meter)"}})}),!i&&l.jsx(Fe,{children:"MISSION.md not written yet."}),i&&!u&&d.map((g,y)=>l.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"4px 0",fontSize:"var(--fs-sm)",color:g.done?"var(--ink-2)":"var(--ink-0)"},children:[l.jsx(se,{name:g.done?"done":"idle",size:14,strokeWidth:2,color:g.done?"var(--status-good)":"var(--ink-2)",style:{marginTop:2}}),l.jsx("span",{style:{textDecoration:g.done?"line-through":"none"},children:g.text})]},y)),i&&u&&l.jsx("pre",{style:{fontSize:"var(--fs-xs)",whiteSpace:"pre-wrap",color:"var(--ink-1)",background:"var(--bg-inset)",borderRadius:"var(--r-sm)",padding:"var(--sp-2)",maxHeight:320,overflowY:"auto",fontFamily:"var(--font-mono)",margin:0},children:i})]})}function ua({label:i,hint:c,layout:u="inline",children:o,style:d}){return u==="stacked"?l.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,...d},children:[l.jsx("span",{style:{fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--ink-2)"},children:i}),o,c&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:c})]}):l.jsxs("label",{title:c,style:{display:"flex",alignItems:"center",gap:6,color:"var(--ink-1)",fontSize:"var(--fs-sm)",...d},children:[i,o]})}const g1=/(`[^`\n]+`|<[^<>\n]{1,80}>)/g;function m1(i){const c=[];let u=!1;for(const o of i.split(`
29
+ `)){if(/^```/.test(o)){c.push({text:o,kind:"fence",open:!u}),u=!u;continue}if(u){c.push({text:o,kind:"code"});continue}/^>\s?/.test(o)?c.push({text:o,kind:"quote"}):/^\s*[-*]\s+/.test(o)?c.push({text:o,kind:"list"}):/^#{1,3}\s/.test(o)?c.push({text:o,kind:"heading"}):c.push({text:o,kind:"text"})}return c}function nr(i){return i.split(g1).filter(Boolean).map((c,u)=>c.length>2&&c.startsWith("`")&&c.endsWith("`")?l.jsxs("span",{style:{background:"var(--bg-inset)",boxShadow:"0 0 0 1px var(--line)",borderRadius:3,color:"var(--agent-worker)"},children:[l.jsx("span",{style:{color:"var(--ink-2)"},children:"`"}),c.slice(1,-1),l.jsx("span",{style:{color:"var(--ink-2)"},children:"`"})]},u):c.startsWith("<")&&c.endsWith(">")?l.jsx("span",{style:{background:"var(--brand-wash-strong)",boxShadow:"0 0 0 1px var(--brand)",borderRadius:3},children:c},u):c)}const Ei="var(--sp-3)",y1=m.forwardRef(function({value:c,onChange:u,placeholder:o,minHeight:d=200,maxHeight:h=460,onKeyDown:g,onPaste:y,onFocus:b,onBlur:v,style:S},x){const j=m.useRef(null),k=m.useRef(null);m.useImperativeHandle(x,()=>j.current),m.useEffect(()=>{const z=j.current;z&&(z.style.height="0px",z.style.height=`${Math.max(z.scrollHeight,d)}px`,k.current!=null&&(z.setSelectionRange(k.current,k.current),k.current=null))},[c,d]);const U=z=>{const D=z.target;let B=D.value,J=D.selectionStart;const re=z.nativeEvent?.inputType==="insertText"&&z.nativeEvent?.data==="`",q=B.slice(0,J),N=B.slice(J),$=q.lastIndexOf(`
30
+ `)+1;if(re&&q.slice($)==="```"&&(N===""||N.startsWith(`
31
+ `))){const Y=(q.match(/^```/gm)||[]).length%2===1;Y&&(N.match(/^```/gm)||[]).length%2===0?(B=`${q}
32
32
 
33
33
  \`\`\`
34
- ${N.replace(/^\n/,"")}`,F+=1):G||(U=N.startsWith(`
35
- `)?U:`${q}
36
- ${N}`,F+=1),k.current=F}u?.(U)},K=m1(c||""),M={margin:0,padding:Mi,boxSizing:"border-box",width:"100%",font:"inherit",fontSize:"inherit",lineHeight:"var(--lh-prose)",whiteSpace:"pre-wrap",overflowWrap:"break-word",wordBreak:"break-word",tabSize:4};return a.jsxs("div",{style:{position:"relative",overflowY:"auto",maxHeight:h,...S},children:[a.jsxs("div",{"aria-hidden":!0,style:{...M,position:"absolute",inset:0,height:"auto",color:"var(--ink-0)",pointerEvents:"none"},children:[!c&&o&&a.jsx("div",{style:{color:"var(--ink-2)"},children:o}),c&&K.map((z,D)=>{const U=z.kind==="code"||z.kind==="fence";return a.jsx("div",{style:{...U?{background:"var(--bg-inset)",margin:`0 calc(-0.5 * ${Mi})`,padding:`0 calc(0.5 * ${Mi})`}:null,...z.kind==="fence"?{borderRadius:z.open?"6px 6px 0 0":"0 0 6px 6px"}:null,...z.kind==="quote"?{color:"var(--ink-1)",boxShadow:"inset 2px 0 0 var(--agent-worker)",margin:`0 calc(-1 * ${Mi})`,padding:`0 ${Mi}`}:null,...z.kind==="fence"?{color:"var(--ink-2)"}:null,...z.kind==="code"?{color:"var(--ink-1)"}:null},children:z.text===""?"​":z.kind==="fence"?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"transparent"},children:"```"}),z.text.slice(3)]}):z.kind==="code"?z.text:z.kind==="list"?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--brand)"},children:/^\s*[-*]\s+/.exec(z.text)[0]}),nr(z.text.replace(/^\s*[-*]\s+/,""))]}):z.kind==="heading"?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--brand)"},children:/^#{1,3}\s/.exec(z.text)[0]}),nr(z.text.replace(/^#{1,3}\s/,""))]}):z.kind==="quote"?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:/^>\s?/.exec(z.text)[0]}),nr(z.text.replace(/^>\s?/,""))]}):nr(z.text)},D)})]}),a.jsx("textarea",{ref:j,value:c,onChange:B,spellCheck:!1,onKeyDown:g,onPaste:y,onFocus:x,onBlur:v,style:{...M,position:"relative",display:"block",minHeight:d,resize:"none",overflow:"hidden",background:"transparent",border:"none",outline:"none",color:"transparent",caretColor:"var(--ink-0)"}})]})}),x1=[{id:"fable",label:"Fable",model:"claude-fable-5",cost:4,note:"Frontier. Long-horizon planning and verification."},{id:"opus",label:"Opus",model:"claude-opus-5",cost:3,note:"Deep reasoning for hard refactors."},{id:"sonnet",label:"Sonnet",model:"claude-sonnet-5",cost:2,note:"Balanced. The usual worker."},{id:"haiku",label:"Haiku",model:"claude-haiku-4-5",cost:1,note:"Fast and cheap for reads and mechanical edits."}],mp={id:"",label:"Default",model:"inherits your Claude Code default",cost:0};function b1(i){const[c,u]=m.useState({models:null,loading:!!i,error:null});return m.useEffect(()=>{if(!i)return;let o=!0;return u(h=>({...h,loading:!0})),(typeof i=="string"?fetch(i).then(h=>{if(!h.ok)throw new Error(`${h.status} from ${i}`);return h.json()}).then(h=>h.models||h):Promise.resolve().then(i)).then(h=>o&&u({models:h,loading:!1,error:null})).catch(h=>o&&u({models:null,loading:!1,error:String(h&&h.message||h)})),()=>{o=!1}},[i]),c}function j1({cost:i}){return i?a.jsx("span",{"aria-label":`cost ${i} of 4`,style:{display:"inline-flex",gap:2},children:[1,2,3,4].map(c=>a.jsx("span",{style:{width:4,height:10,borderRadius:1,background:c<=i?"var(--ink-1)":"var(--line-strong)"}},c))}):a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"—"})}function nv(i){return i&&i.providerLabel||"Anthropic"}function S1(i){const c=[];for(const u of i){const o=nv(u);let d=c.find(h=>h.label===o);d||(d={label:o,items:[]},c.push(d)),d.items.push(u)}return c}function an({align:i="left",block:c=!1,value:u="",onChange:o,models:d,loading:h,note:g,inheritNote:y,allowDefault:x=!0,disabled:v,style:S}){const[b,j]=m.useState(!1),[k,B]=m.useState(null),[K,M]=m.useState(""),z=m.useRef(null),D=m.useRef(null),U=m.useRef(null),F=y?{...mp,model:y}:mp,re=d||x1,q=[...x?[F]:[],...re],N=q.find($=>$.id===u)||(u?{id:u,label:u,model:u}:F),Y=re.length>6,G=K.trim().toLowerCase(),fe=$=>!G||[$.label,$.model,$.id,$.providerLabel,$.note,$.record].some(P=>String(P??"").toLowerCase().includes(G)),Q=Y&&G?re.filter(fe):re,J=S1(Q),ge=J.length>1;m.useEffect(()=>{if(!b)return;const $=me=>{z.current&&!z.current.contains(me.target)&&j(!1)},P=me=>{me.key==="Escape"&&j(!1)};return document.addEventListener("mousedown",$),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",$),document.removeEventListener("keydown",P)}},[b]),m.useEffect(()=>{if(!b||!D.current)return;const $=D.current.querySelector('[data-selected="true"]');$&&$.scrollIntoView({block:"nearest"})},[b]),m.useEffect(()=>{if(!b){M("");return}U.current?.focus()},[b]);const oe=()=>{const $=J[0]?.items[0];$&&(o?.($.id,$),j(!1))},ne=nv(N),E=N.id&&ne!=="Anthropic";return a.jsxs("div",{ref:z,style:{position:"relative",display:c?"block":"inline-block",...c?{width:"100%"}:{},...S},children:[a.jsxs("button",{type:"button",disabled:v||h,onClick:()=>j($=>!$),"aria-haspopup":"listbox","aria-expanded":b,style:{display:c?"flex":"inline-flex",alignItems:"center",gap:8,minWidth:150,padding:"6px 8px 6px 10px",...c?{width:"100%",boxSizing:"border-box"}:{},background:"var(--bg-card)",border:`1px solid ${b?"var(--ink-2)":"var(--line-strong)"}`,borderRadius:"var(--r-sm)",color:h?"var(--ink-2)":"var(--ink-0)",cursor:v||h?"default":"pointer",textAlign:"left",transition:"border-color var(--dur-fast) var(--ease)"},children:[a.jsx(ie,{name:h?"loading":"model",size:14,color:"var(--ink-2)"}),a.jsxs("span",{style:{flex:1,display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[a.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:h?"Fetching models…":N.label}),E&&a.jsx("span",{style:{flex:"0 0 auto",fontSize:"var(--fs-xs)",lineHeight:1,padding:"2px 5px",borderRadius:"var(--r-xs, 3px)",background:"var(--bg-hover)",color:"var(--ink-2)",border:"1px solid var(--line)"},children:ne})]}),a.jsx(ie,{name:"chevronDown",size:14,color:"var(--ink-2)"})]}),b&&a.jsxs("div",{role:"listbox",style:{position:"absolute",top:"calc(100% + 4px)",zIndex:20,minWidth:300,...c?{left:0,right:0}:i==="right"?{right:0}:{left:0},background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",boxShadow:"0 8px 24px rgba(0,0,0,0.28)",padding:4,display:"flex",flexDirection:"column"},children:[g&&a.jsx("div",{style:{padding:"6px 10px",fontSize:"var(--fs-xs)",color:"var(--ink-2)",borderBottom:q.length?"1px solid var(--line)":"none"},children:g}),Y&&a.jsx("div",{style:{padding:6,borderBottom:"1px solid var(--line)"},children:a.jsx("input",{ref:U,value:K,onChange:$=>M($.target.value),placeholder:`Filter ${re.length} models…`,"aria-label":"Filter models",onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),oe())},style:{width:"100%",boxSizing:"border-box",padding:"5px 8px",font:"inherit",fontSize:"var(--fs-sm)",color:"var(--ink-0)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",outline:"none"}})}),a.jsxs("div",{ref:D,style:{maxHeight:360,overflowY:"auto",display:"flex",flexDirection:"column"},children:[Y&&G&&Q.length===0&&a.jsxs("div",{style:{padding:"10px",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["No model matches “",K.trim(),"”."]}),x&&!G&&a.jsx(yp,{m:F,selected:N.id===F.id,hover:k===F.id,onHover:B,onClick:()=>{o?.(F.id,F),j(!1)}},F.id),J.map($=>a.jsxs(On.Fragment,{children:[ge&&a.jsxs("div",{style:{padding:"6px 8px 4px",marginTop:2,fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"0.04em",display:"flex",justifyContent:"space-between",position:"sticky",top:0,background:"var(--bg-panel)",zIndex:1},children:[a.jsx("span",{children:$.label}),a.jsx("span",{children:$.items.length})]}),$.items.map(P=>a.jsx(yp,{m:P,selected:N.id===P.id,hover:k===P.id,onHover:B,onClick:()=>{o?.(P.id,P),j(!1)}},P.id))]},$.label))]})]})]})}function yp({m:i,selected:c,hover:u,onHover:o,onClick:d}){return a.jsxs("button",{type:"button",role:"option","aria-selected":c,"data-selected":c||void 0,onMouseEnter:()=>o(i.id),onMouseLeave:()=>o(null),onClick:d,style:{display:"grid",gridTemplateColumns:"14px 1fr auto",columnGap:10,alignItems:"start",textAlign:"left",padding:"7px 8px",border:"none",borderRadius:4,cursor:"pointer",color:"var(--ink-0)",background:u?"var(--bg-hover)":"transparent",width:"100%"},children:[a.jsx("span",{style:{paddingTop:2},children:c&&a.jsx(ie,{name:"check",size:14,color:"var(--brand)"})}),a.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[a.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[a.jsx("span",{style:{fontWeight:c?"var(--fw-semibold)":"inherit"},children:i.label}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.model})]}),i.note&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:i.note}),i.record&&a.jsx("span",{title:"From Foreman's own run records on this machine",style:{fontSize:"var(--fs-xs)",color:"var(--ink-1)",fontVariantNumeric:"tabular-nums"},children:i.record})]}),a.jsx("span",{style:{paddingTop:3},children:a.jsx(j1,{cost:i.cost})})]})}an.useModels=b1;function Mt({checked:i=!1,onChange:c,disabled:u,label:o,size:d="md",style:h}){const[g,y]=m.useState(!1),x=d==="sm"?28:34,v=d==="sm"?16:20,S=v-4;return a.jsx("button",{type:"button",role:"switch","aria-checked":i,"aria-label":o,disabled:u,onClick:()=>c?.(!i),onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),style:{position:"relative",width:x,height:v,flex:"0 0 auto",padding:0,borderRadius:"var(--r-pill)",border:`1px solid ${i?"var(--brand)":g?"var(--ink-2)":"var(--line-strong)"}`,background:i?"var(--brand)":"var(--bg-inset)",cursor:u?"default":"pointer",opacity:u?.5:1,transition:"background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease)",...h},children:a.jsx("span",{"aria-hidden":!0,style:{position:"absolute",top:1,left:i?x-S-3:1,width:S,height:S,borderRadius:"var(--r-pill)",background:i?"var(--brand-ink)":"var(--ink-1)",transition:"left var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease)"}})})}const k1=`Describe the mission…
34
+ ${N.replace(/^\n/,"")}`,J+=1):Y||(B=N.startsWith(`
35
+ `)?B:`${q}
36
+ ${N}`,J+=1),k.current=J}u?.(B)},Z=m1(c||""),C={margin:0,padding:Ei,boxSizing:"border-box",width:"100%",font:"inherit",fontSize:"inherit",lineHeight:"var(--lh-prose)",whiteSpace:"pre-wrap",overflowWrap:"break-word",wordBreak:"break-word",tabSize:4};return l.jsxs("div",{style:{position:"relative",overflowY:"auto",maxHeight:h,...S},children:[l.jsxs("div",{"aria-hidden":!0,style:{...C,position:"absolute",inset:0,height:"auto",color:"var(--ink-0)",pointerEvents:"none"},children:[!c&&o&&l.jsx("div",{style:{color:"var(--ink-2)"},children:o}),c&&Z.map((z,D)=>{const B=z.kind==="code"||z.kind==="fence";return l.jsx("div",{style:{...B?{background:"var(--bg-inset)",margin:`0 calc(-0.5 * ${Ei})`,padding:`0 calc(0.5 * ${Ei})`}:null,...z.kind==="fence"?{borderRadius:z.open?"6px 6px 0 0":"0 0 6px 6px"}:null,...z.kind==="quote"?{color:"var(--ink-1)",boxShadow:"inset 2px 0 0 var(--agent-worker)",margin:`0 calc(-1 * ${Ei})`,padding:`0 ${Ei}`}:null,...z.kind==="fence"?{color:"var(--ink-2)"}:null,...z.kind==="code"?{color:"var(--ink-1)"}:null},children:z.text===""?"​":z.kind==="fence"?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"transparent"},children:"```"}),z.text.slice(3)]}):z.kind==="code"?z.text:z.kind==="list"?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--brand)"},children:/^\s*[-*]\s+/.exec(z.text)[0]}),nr(z.text.replace(/^\s*[-*]\s+/,""))]}):z.kind==="heading"?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--brand)"},children:/^#{1,3}\s/.exec(z.text)[0]}),nr(z.text.replace(/^#{1,3}\s/,""))]}):z.kind==="quote"?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--ink-2)"},children:/^>\s?/.exec(z.text)[0]}),nr(z.text.replace(/^>\s?/,""))]}):nr(z.text)},D)})]}),l.jsx("textarea",{ref:j,value:c,onChange:U,spellCheck:!1,onKeyDown:g,onPaste:y,onFocus:b,onBlur:v,style:{...C,position:"relative",display:"block",minHeight:d,resize:"none",overflow:"hidden",background:"transparent",border:"none",outline:"none",color:"transparent",caretColor:"var(--ink-0)"}})]})}),x1=[{id:"fable",label:"Fable",model:"claude-fable-5",cost:4,note:"Frontier. Long-horizon planning and verification."},{id:"opus",label:"Opus",model:"claude-opus-5",cost:3,note:"Deep reasoning for hard refactors."},{id:"sonnet",label:"Sonnet",model:"claude-sonnet-5",cost:2,note:"Balanced. The usual worker."},{id:"haiku",label:"Haiku",model:"claude-haiku-4-5",cost:1,note:"Fast and cheap for reads and mechanical edits."}],mp={id:"",label:"Default",model:"inherits your Claude Code default",cost:0};function b1(i){const[c,u]=m.useState({models:null,loading:!!i,error:null});return m.useEffect(()=>{if(!i)return;let o=!0;return u(h=>({...h,loading:!0})),(typeof i=="string"?fetch(i).then(h=>{if(!h.ok)throw new Error(`${h.status} from ${i}`);return h.json()}).then(h=>h.models||h):Promise.resolve().then(i)).then(h=>o&&u({models:h,loading:!1,error:null})).catch(h=>o&&u({models:null,loading:!1,error:String(h&&h.message||h)})),()=>{o=!1}},[i]),c}function j1({cost:i}){return i?l.jsx("span",{"aria-label":`cost ${i} of 4`,style:{display:"inline-flex",gap:2},children:[1,2,3,4].map(c=>l.jsx("span",{style:{width:4,height:10,borderRadius:1,background:c<=i?"var(--ink-1)":"var(--line-strong)"}},c))}):l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"—"})}function nv(i){return i&&i.providerLabel||"Anthropic"}function S1(i){const c=[];for(const u of i){const o=nv(u);let d=c.find(h=>h.label===o);d||(d={label:o,items:[]},c.push(d)),d.items.push(u)}return c}function ln({align:i="left",block:c=!1,value:u="",onChange:o,models:d,loading:h,note:g,inheritNote:y,allowDefault:b=!0,disabled:v,style:S}){const[x,j]=m.useState(!1),[k,U]=m.useState(null),[Z,C]=m.useState(""),z=m.useRef(null),D=m.useRef(null),B=m.useRef(null),J=y?{...mp,model:y}:mp,re=d||x1,q=[...b?[J]:[],...re],N=q.find(G=>G.id===u)||(u?{id:u,label:u,model:u}:J),$=re.length>6,Y=Z.trim().toLowerCase(),de=G=>!Y||[G.label,G.model,G.id,G.providerLabel,G.note,G.record].some(P=>String(P??"").toLowerCase().includes(Y)),Q=$&&Y?re.filter(de):re,W=S1(Q),ge=W.length>1;m.useEffect(()=>{if(!x)return;const G=me=>{z.current&&!z.current.contains(me.target)&&j(!1)},P=me=>{me.key==="Escape"&&j(!1)};return document.addEventListener("mousedown",G),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",G),document.removeEventListener("keydown",P)}},[x]),m.useEffect(()=>{if(!x||!D.current)return;const G=D.current.querySelector('[data-selected="true"]');G&&G.scrollIntoView({block:"nearest"})},[x]),m.useEffect(()=>{if(!x){C("");return}B.current?.focus()},[x]);const oe=()=>{const G=W[0]?.items[0];G&&(o?.(G.id,G),j(!1))},ne=nv(N),E=N.id&&ne!=="Anthropic";return l.jsxs("div",{ref:z,style:{position:"relative",display:c?"block":"inline-block",...c?{width:"100%"}:{},...S},children:[l.jsxs("button",{type:"button",disabled:v||h,onClick:()=>j(G=>!G),"aria-haspopup":"listbox","aria-expanded":x,style:{display:c?"flex":"inline-flex",alignItems:"center",gap:8,minWidth:150,padding:"6px 8px 6px 10px",...c?{width:"100%",boxSizing:"border-box"}:{},background:"var(--bg-card)",border:`1px solid ${x?"var(--ink-2)":"var(--line-strong)"}`,borderRadius:"var(--r-sm)",color:h?"var(--ink-2)":"var(--ink-0)",cursor:v||h?"default":"pointer",textAlign:"left",transition:"border-color var(--dur-fast) var(--ease)"},children:[l.jsx(se,{name:h?"loading":"model",size:14,color:"var(--ink-2)"}),l.jsxs("span",{style:{flex:1,display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[l.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:h?"Fetching models…":N.label}),E&&l.jsx("span",{style:{flex:"0 0 auto",fontSize:"var(--fs-xs)",lineHeight:1,padding:"2px 5px",borderRadius:"var(--r-xs, 3px)",background:"var(--bg-hover)",color:"var(--ink-2)",border:"1px solid var(--line)"},children:ne})]}),l.jsx(se,{name:"chevronDown",size:14,color:"var(--ink-2)"})]}),x&&l.jsxs("div",{role:"listbox",style:{position:"absolute",top:"calc(100% + 4px)",zIndex:20,minWidth:300,...c?{left:0,right:0}:i==="right"?{right:0}:{left:0},background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",boxShadow:"0 8px 24px rgba(0,0,0,0.28)",padding:4,display:"flex",flexDirection:"column"},children:[g&&l.jsx("div",{style:{padding:"6px 10px",fontSize:"var(--fs-xs)",color:"var(--ink-2)",borderBottom:q.length?"1px solid var(--line)":"none"},children:g}),$&&l.jsx("div",{style:{padding:6,borderBottom:"1px solid var(--line)"},children:l.jsx("input",{ref:B,value:Z,onChange:G=>C(G.target.value),placeholder:`Filter ${re.length} models…`,"aria-label":"Filter models",onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),oe())},style:{width:"100%",boxSizing:"border-box",padding:"5px 8px",font:"inherit",fontSize:"var(--fs-sm)",color:"var(--ink-0)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",outline:"none"}})}),l.jsxs("div",{ref:D,style:{maxHeight:360,overflowY:"auto",display:"flex",flexDirection:"column"},children:[$&&Y&&Q.length===0&&l.jsxs("div",{style:{padding:"10px",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["No model matches “",Z.trim(),"”."]}),b&&!Y&&l.jsx(yp,{m:J,selected:N.id===J.id,hover:k===J.id,onHover:U,onClick:()=>{o?.(J.id,J),j(!1)}},J.id),W.map(G=>l.jsxs(On.Fragment,{children:[ge&&l.jsxs("div",{style:{padding:"6px 8px 4px",marginTop:2,fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"0.04em",display:"flex",justifyContent:"space-between",position:"sticky",top:0,background:"var(--bg-panel)",zIndex:1},children:[l.jsx("span",{children:G.label}),l.jsx("span",{children:G.items.length})]}),G.items.map(P=>l.jsx(yp,{m:P,selected:N.id===P.id,hover:k===P.id,onHover:U,onClick:()=>{o?.(P.id,P),j(!1)}},P.id))]},G.label))]})]})]})}function yp({m:i,selected:c,hover:u,onHover:o,onClick:d}){return l.jsxs("button",{type:"button",role:"option","aria-selected":c,"data-selected":c||void 0,onMouseEnter:()=>o(i.id),onMouseLeave:()=>o(null),onClick:d,style:{display:"grid",gridTemplateColumns:"14px 1fr auto",columnGap:10,alignItems:"start",textAlign:"left",padding:"7px 8px",border:"none",borderRadius:4,cursor:"pointer",color:"var(--ink-0)",background:u?"var(--bg-hover)":"transparent",width:"100%"},children:[l.jsx("span",{style:{paddingTop:2},children:c&&l.jsx(se,{name:"check",size:14,color:"var(--brand)"})}),l.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[l.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[l.jsx("span",{style:{fontWeight:c?"var(--fw-semibold)":"inherit"},children:i.label}),l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.model})]}),i.note&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:i.note}),i.record&&l.jsx("span",{title:"From Foreman's own run records on this machine",style:{fontSize:"var(--fs-xs)",color:"var(--ink-1)",fontVariantNumeric:"tabular-nums"},children:i.record})]}),l.jsx("span",{style:{paddingTop:3},children:l.jsx(j1,{cost:i.cost})})]})}ln.useModels=b1;function Mt({checked:i=!1,onChange:c,disabled:u,label:o,size:d="md",style:h}){const[g,y]=m.useState(!1),b=d==="sm"?28:34,v=d==="sm"?16:20,S=v-4;return l.jsx("button",{type:"button",role:"switch","aria-checked":i,"aria-label":o,disabled:u,onClick:()=>c?.(!i),onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),style:{position:"relative",width:b,height:v,flex:"0 0 auto",padding:0,borderRadius:"var(--r-pill)",border:`1px solid ${i?"var(--brand)":g?"var(--ink-2)":"var(--line-strong)"}`,background:i?"var(--brand)":"var(--bg-inset)",cursor:u?"default":"pointer",opacity:u?.5:1,transition:"background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease)",...h},children:l.jsx("span",{"aria-hidden":!0,style:{position:"absolute",top:1,left:i?b-S-3:1,width:S,height:S,borderRadius:"var(--r-pill)",background:i?"var(--brand-ink)":"var(--ink-1)",transition:"left var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease)"}})})}const k1=`Describe the mission…
37
37
 
38
38
  Say what "done" looks like, name constraints, and flag any decision the director should ask you about before implementing.`,w1=[{id:"bugfix",label:"Bug fix",icon:"Bug",budget:3,director:"",worker:"sonnet",brief:`Fix: <describe the bug and how to reproduce it>
39
39
 
@@ -51,18 +51,18 @@ Ask me before: renaming anything exported.`},{id:"audit",label:"Audit",icon:"Sea
51
51
 
52
52
  Done when: a written report in .foreman/AUDIT.md lists findings ranked by severity with file:line references — no code changes.
53
53
  Constraints: read-only; do not modify source files.
54
- Ask me before: nothing — this mission only reads.`}];function z1(i){if(!i)return"";let c=i.replace(/^\/(Users|home)\/[^/]+/,"~");const u=c.split("/");return u.length>4&&(c=[u[0],u[1],"…",...u.slice(-2)].join("/")),c}function Dc(i){return`foreman:draft:${i||"default"}`}const Rc=i=>`${i.name}:${i.size}`;function xp({children:i}){return a.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:18,height:18,padding:"0 4px",boxSizing:"border-box",background:"var(--bg-inset)",border:"1px solid var(--line-strong)",borderRadius:4,color:"var(--ink-1)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",lineHeight:1},children:i})}function Oc({icon:i,label:c,active:u,onClick:o}){const[d,h]=m.useState(!1);return a.jsx("button",{type:"button",title:c,"aria-label":c,"aria-pressed":u,onClick:o,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:26,height:24,padding:0,background:u?"var(--bg-inset)":d?"var(--bg-hover)":"transparent",border:"none",borderRadius:4,color:u||d?"var(--ink-0)":"var(--ink-2)",cursor:"pointer"},children:a.jsx(ie,{name:i,size:14})})}function bp({icon:i,label:c,active:u,onClick:o}){return a.jsxs("button",{type:"button",onClick:o,"aria-selected":u,role:"tab",style:{display:"inline-flex",alignItems:"center",gap:5,padding:"0 10px",height:32,background:"none",border:"none",borderBottom:`2px solid ${u?"var(--brand)":"transparent"}`,marginBottom:-1,color:u?"var(--ink-0)":"var(--ink-2)",fontSize:"var(--fs-sm)",fontWeight:u?"var(--fw-semibold)":"inherit",cursor:"pointer"},children:[a.jsx(ie,{name:i,size:13}),c]})}function T1({folder:i,defaultBudgetUsd:c=5,error:u,busy:o,templates:d=w1,models:h,modelsLoading:g,modelsNote:y,modelsInheritNote:x,onStart:v,style:S}){const b=m.useMemo(()=>{try{return JSON.parse(localStorage.getItem(Dc(i))||"null")}catch{return null}},[i]),[j,k]=m.useState(b?.mission??""),[B,K]=m.useState(b?.budget??c),[M,z]=m.useState(b?.directorModel??""),[D,U]=m.useState(b?.workerModel??""),[F,re]=m.useState(b?.directorProviderId),[q,N]=m.useState(b?.workerProviderId),[Y,G]=m.useState(b?.browserTools??!1),[fe,Q]=m.useState(b?"restored":null),[J,ge]=m.useState("write"),[oe,ne]=m.useState([]),[E,$]=m.useState(!1),[P,me]=m.useState(!1),xe=m.useRef(null),T=m.useRef(null);m.useEffect(()=>{const ee=setTimeout(()=>{try{(j.trim()||b)&&(localStorage.setItem(Dc(i),JSON.stringify({mission:j,budget:B,directorModel:M,workerModel:D,browserTools:Y})),j.trim()&&Q("saved"))}catch{}},400);return()=>clearTimeout(ee)},[j,B,M,D,Y,i]);const _=ee=>{k(ee.brief),K(ee.budget),z(ee.director),U(ee.worker),ge("write")},Z=()=>{k(""),ne([]),Q(null);try{localStorage.removeItem(Dc(i))}catch{}},I=ee=>{const te=Array.from(ee||[]);te.length&&ne(we=>{const le=new Set(we.map(Rc));return[...we,...te.filter(Ne=>!le.has(Rc(Ne)))]})},ce=!o&&j.trim().length>0,ue=()=>{ce&&v?.({mission:j.trim(),budget:B,directorModel:M,workerModel:D,directorProviderId:F,workerProviderId:q,browserTools:Y,attachments:oe})},be=ee=>{const te=xe.current;if(!te){ge("write");return}const we=te.selectionStart??j.length,le=te.selectionEnd??we,Ne=j.slice(we,le);let Ge,bt;if(ee==="code")Ge=`\`${Ne||"code"}\``,bt=Ne?we+Ge.length:we+1;else if(ee==="quote")Ge=(Ne||"quoted text").split(`
55
- `).map(Hl=>`> ${Hl}`).join(`
54
+ Ask me before: nothing — this mission only reads.`}];function z1(i){if(!i)return"";let c=i.replace(/^\/(Users|home)\/[^/]+/,"~");const u=c.split("/");return u.length>4&&(c=[u[0],u[1],"…",...u.slice(-2)].join("/")),c}function Dc(i){return`foreman:draft:${i||"default"}`}const Rc=i=>`${i.name}:${i.size}`;function xp({children:i}){return l.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:18,height:18,padding:"0 4px",boxSizing:"border-box",background:"var(--bg-inset)",border:"1px solid var(--line-strong)",borderRadius:4,color:"var(--ink-1)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",lineHeight:1},children:i})}function Oc({icon:i,label:c,active:u,onClick:o}){const[d,h]=m.useState(!1);return l.jsx("button",{type:"button",title:c,"aria-label":c,"aria-pressed":u,onClick:o,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:26,height:24,padding:0,background:u?"var(--bg-inset)":d?"var(--bg-hover)":"transparent",border:"none",borderRadius:4,color:u||d?"var(--ink-0)":"var(--ink-2)",cursor:"pointer"},children:l.jsx(se,{name:i,size:14})})}function bp({icon:i,label:c,active:u,onClick:o}){return l.jsxs("button",{type:"button",onClick:o,"aria-selected":u,role:"tab",style:{display:"inline-flex",alignItems:"center",gap:5,padding:"0 10px",height:32,background:"none",border:"none",borderBottom:`2px solid ${u?"var(--brand)":"transparent"}`,marginBottom:-1,color:u?"var(--ink-0)":"var(--ink-2)",fontSize:"var(--fs-sm)",fontWeight:u?"var(--fw-semibold)":"inherit",cursor:"pointer"},children:[l.jsx(se,{name:i,size:13}),c]})}function T1({folder:i,defaultBudgetUsd:c=5,error:u,busy:o,templates:d=w1,models:h,modelsLoading:g,modelsNote:y,modelsInheritNote:b,onStart:v,style:S}){const x=m.useMemo(()=>{try{return JSON.parse(localStorage.getItem(Dc(i))||"null")}catch{return null}},[i]),[j,k]=m.useState(x?.mission??""),[U,Z]=m.useState(x?.budget??c),[C,z]=m.useState(x?.directorModel??""),[D,B]=m.useState(x?.workerModel??""),[J,re]=m.useState(x?.directorProviderId),[q,N]=m.useState(x?.workerProviderId),[$,Y]=m.useState(x?.browserTools??!1),[de,Q]=m.useState(x?"restored":null),[W,ge]=m.useState("write"),[oe,ne]=m.useState([]),[E,G]=m.useState(!1),[P,me]=m.useState(!1),xe=m.useRef(null),T=m.useRef(null);m.useEffect(()=>{const ee=setTimeout(()=>{try{(j.trim()||x)&&(localStorage.setItem(Dc(i),JSON.stringify({mission:j,budget:U,directorModel:C,workerModel:D,browserTools:$})),j.trim()&&Q("saved"))}catch{}},400);return()=>clearTimeout(ee)},[j,U,C,D,$,i]);const _=ee=>{k(ee.brief),Z(ee.budget),z(ee.director),B(ee.worker),ge("write")},F=()=>{k(""),ne([]),Q(null);try{localStorage.removeItem(Dc(i))}catch{}},I=ee=>{const te=Array.from(ee||[]);te.length&&ne(we=>{const le=new Set(we.map(Rc));return[...we,...te.filter(Ne=>!le.has(Rc(Ne)))]})},ce=!o&&j.trim().length>0,ue=()=>{ce&&v?.({mission:j.trim(),budget:U,directorModel:C,workerModel:D,directorProviderId:J,workerProviderId:q,browserTools:$,attachments:oe})},be=ee=>{const te=xe.current;if(!te){ge("write");return}const we=te.selectionStart??j.length,le=te.selectionEnd??we,Ne=j.slice(we,le);let Ge,bt;if(ee==="code")Ge=`\`${Ne||"code"}\``,bt=Ne?we+Ge.length:we+1;else if(ee==="quote")Ge=(Ne||"quoted text").split(`
55
+ `).map(Ua=>`> ${Ua}`).join(`
56
56
  `),bt=Ne?we+Ge.length:we+2;else{const sn=we>0&&j[we-1]!==`
57
57
  `?`
58
58
  `:"";Ge=`${sn}\`\`\`
59
59
  ${Ne||""}
60
60
  \`\`\`
61
- `,bt=we+sn.length+4}const hl=j.slice(0,we)+Ge+j.slice(le);k(hl),ge("write"),requestAnimationFrame(()=>{te.focus();const sn=Ne?bt:bt+(ee==="code"?4:ee==="quote"?11:0);te.setSelectionRange(bt,sn)})},Re=E?"var(--brand)":P?"var(--ink-2)":"var(--line-strong)";return a.jsxs("div",{style:{maxWidth:"var(--composer-max)",margin:"var(--sp-5) auto",padding:"0 var(--sp-4)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",...S},children:[a.jsxs("div",{style:{minWidth:0},children:[a.jsx("h2",{style:{margin:0,fontSize:"var(--fs-lg)"},children:"New mission"}),a.jsx("div",{title:i,style:{color:"var(--ink-2)",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:z1(i)})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginRight:2},children:[a.jsx(ie,{name:"template",size:12}),"Start from"]}),d.map(ee=>a.jsx(se,{size:"sm",icon:ee.icon,title:`Budget $${ee.budget} · director ${ee.director||"default"} · workers ${ee.worker||"default"}`,onClick:()=>_(ee),children:ee.label},ee.id))]}),a.jsxs("div",{onDragOver:ee=>{ee.preventDefault(),E||$(!0)},onDragLeave:ee=>{ee.currentTarget.contains(ee.relatedTarget)||$(!1)},onDrop:ee=>{ee.preventDefault(),$(!1),I(ee.dataTransfer.files)},style:{background:"var(--bg-card)",border:`1px solid ${Re}`,borderRadius:"var(--r-md)",overflow:"hidden",boxShadow:E?"0 0 0 3px var(--brand-wash-strong)":"none",transition:"border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease)"},children:[a.jsxs("div",{role:"tablist",style:{display:"flex",alignItems:"center",gap:2,padding:"0 6px",borderBottom:"1px solid var(--line)",background:"var(--bg-panel)"},children:[a.jsx(bp,{icon:"write",label:"Write",active:J==="write",onClick:()=>ge("write")}),a.jsx(bp,{icon:"preview",label:"Preview",active:J==="preview",onClick:()=>ge("preview")}),a.jsx("span",{style:{flex:1}}),a.jsx(Oc,{icon:"quote",label:"Quote (> )",onClick:()=>be("quote")}),a.jsx(Oc,{icon:"code",label:"Inline code (`)",onClick:()=>be("code")}),a.jsx(Oc,{icon:"codeBlock",label:"Code block (```)",onClick:()=>be("block")})]}),J==="write"?a.jsx(y1,{ref:xe,value:j,onChange:k,placeholder:k1,minHeight:200,maxHeight:440,onKeyDown:ee=>{(ee.metaKey||ee.ctrlKey)&&ee.key==="Enter"&&(ee.preventDefault(),ue())},onPaste:ee=>{ee.clipboardData?.files?.length&&(ee.preventDefault(),I(ee.clipboardData.files))},onFocus:()=>me(!0),onBlur:()=>me(!1)}):a.jsx("div",{style:{minHeight:200,maxHeight:440,overflowY:"auto",padding:"var(--sp-3)",boxSizing:"border-box"},children:j.trim()?a.jsx(_i,{text:j}):a.jsx("span",{style:{color:"var(--ink-2)"},children:"Nothing to preview yet."})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",padding:"6px 8px",borderTop:"1px solid var(--line)",minHeight:36,boxSizing:"border-box"},children:[a.jsx("input",{ref:T,type:"file",multiple:!0,style:{display:"none"},onChange:ee=>{I(ee.target.files),ee.target.value=""}}),a.jsx(se,{size:"sm",variant:"ghost",icon:"attach",title:"Attach files — or drop them on the editor, or paste an image",onClick:()=>T.current?.click(),children:"Attach"}),oe.map((ee,te)=>a.jsx(Vp,{name:ee.name,size:ee.size,onRemove:()=>ne(we=>we.filter((le,Ne)=>Ne!==te))},Rc(ee))),a.jsx("span",{style:{flex:1}}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[fe&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{name:"draft",size:11}),fe==="restored"?"Draft restored":"Draft saved"]}),(j||oe.length>0)&&a.jsx("button",{type:"button",onClick:Z,style:{background:"none",border:"none",padding:0,color:"var(--ink-2)",cursor:"pointer",font:"inherit",textDecoration:"underline"},children:"Clear"})]})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-4)",flexWrap:"wrap"},children:[a.jsx(ul,{layout:"stacked",label:"Budget cap",hint:"Hard stop; the run halts here.",children:a.jsx(We,{type:"number",min:1,step:1,width:96,prefix:"$",value:B,onChange:K})}),a.jsx(ul,{layout:"stacked",label:"Director",hint:"Plans, delegates, verifies.",children:a.jsx(an,{value:M,models:h,loading:g,note:y,inheritNote:x,onChange:(ee,te)=>{z(ee),re(te?.providerId)}})}),a.jsx(ul,{layout:"stacked",label:"Workers",hint:"Implement. Cheaper models cut cost.",children:a.jsx(an,{value:D,models:h,loading:g,note:y,inheritNote:x,onChange:(ee,te)=>{U(ee),N(te?.providerId)}})}),a.jsx(ul,{label:"Browser",hint:"Headless Playwright for the agents — navigate, click, screenshot. Non-local URLs still ask you.",children:a.jsx(Mt,{checked:Y,onChange:G,label:Y?"on":"off"})})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--sp-3)",flexWrap:"wrap"},children:[u&&a.jsx(ot,{tone:"error",inline:!0,style:{marginRight:"auto"},children:u}),a.jsxs("span",{title:"Start the mission with Cmd+Enter from the editor",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsx(xp,{children:"⌘"}),a.jsx(xp,{children:"↵"})]}),a.jsx(se,{variant:"primary",disabled:!ce,onClick:ue,children:"Start mission"})]})]})}function C1({questions:i=[],askedAt:c,who:u,onAnswer:o,onFreeText:d,style:h}){const[g,y]=m.useState({}),[x,v]=m.useState(""),[S,b]=m.useState(0),[j,k]=m.useState(!1),B=m.useRef(null),K=i.length===1&&!i[0]?.multi,M=i.every(N=>{const Y=g[N.question];return Array.isArray(Y)?Y.length>0:!!Y});m.useEffect(()=>{y({}),v(""),b(0),k(!1)},[i]);const z=m.useMemo(()=>{const N={};for(const Y of i){const G=g[Y.question];Array.isArray(G)?N[Y.question]=G.join(", "):G&&(N[Y.question]=G)}return N},[g,i]),D=N=>{j||(k(!0),o?.(N))},U=(N,Y)=>{if(j)return;if(N.multi){y(fe=>{const Q=Array.isArray(fe[N.question])?fe[N.question]:[],J=Q.includes(Y)?Q.filter(ge=>ge!==Y):[...Q,Y];return{...fe,[N.question]:J}});return}const G={...g,[N.question]:Y};y(G),K&&D({[N.question]:Y})},F=()=>{const N=x.trim();if(!N||j)return;const Y=i[Math.min(S,i.length-1)],G={...z,[Y.question]:N};if(i.length===1){k(!0),o?.(G);return}k(!0),o?.(G)},re=N=>{if(N.target.tagName==="TEXTAREA"){(N.metaKey||N.ctrlKey)&&N.key==="Enter"&&(N.preventDefault(),F());return}const Y=i[S];if(Y)if(/^[1-9]$/.test(N.key)){const G=Y.options[Number(N.key)-1];G&&(N.preventDefault(),U(Y,G.label))}else N.key==="ArrowDown"?(N.preventDefault(),b(G=>Math.min(i.length-1,G+1))):N.key==="ArrowUp"?(N.preventDefault(),b(G=>Math.max(0,G-1))):N.key==="Enter"&&!K&&M&&(N.preventDefault(),D(z))},q=c?Math.max(0,Math.round((Date.now()-c)/6e4)):0;return a.jsxs("div",{ref:B,tabIndex:0,onKeyDown:re,style:{flex:"0 0 auto",outline:"none",background:"var(--bg-card)",border:"1px solid var(--brand)",borderRadius:"var(--r-md)",overflow:"hidden",opacity:j?.6:1,transition:"opacity var(--dur-fast) var(--ease)",...h},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsx(ie,{name:"question",size:14,color:"var(--brand)"}),a.jsx("span",{style:{color:"var(--ink-1)",fontWeight:"var(--fw-semibold)"},children:"The foreman asks"}),a.jsx("span",{children:"· pick an answer, or type one"}),q>=1&&a.jsxs("span",{style:{marginLeft:"auto"},children:["waiting ",q,"m"]})]}),i.map((N,Y)=>{const G=g[N.question],fe=Array.isArray(G)?G.length>0:!!G,Q=Y===S;return a.jsxs("div",{onMouseEnter:()=>b(Y),style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",background:Q&&i.length>1?"var(--bg-inset)":"transparent"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6,marginBottom:6,fontSize:"var(--fs-md)",color:"var(--ink-0)"},children:[i.length>1&&a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:fe?"var(--status-ok, var(--brand))":"var(--ink-2)"},children:fe?"✓":`${Y+1}.`}),a.jsx("span",{children:N.question}),N.multi&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"choose any"})]}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:N.options.map((J,ge)=>{const oe=Array.isArray(G)?G.includes(J.label):G===J.label;return a.jsxs("button",{type:"button",disabled:j,onClick:()=>U(N,J.label),title:J.hint||(ge===0?"Recommended":void 0),style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:2,padding:"6px 10px",borderRadius:"var(--r-sm)",cursor:j?"default":"pointer",font:"inherit",textAlign:"left",maxWidth:360,background:oe?"color-mix(in srgb, var(--brand) 16%, transparent)":"var(--bg-inset)",border:`1px solid ${oe?"var(--brand)":"var(--line-strong)"}`,color:oe?"var(--brand)":"var(--ink-0)",transition:"border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease)"},children:[a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"var(--fs-sm)"},children:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",minWidth:14,color:oe?"var(--brand)":"var(--ink-2)"},children:ge+1}),J.label,ge===0&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontWeight:"var(--fw-normal)"},children:"· recommended"})]}),J.hint&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:J.hint})]},J.label)})})]},N.question)}),a.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)"},children:[a.jsx("textarea",{rows:1,value:x,disabled:j,placeholder:i.length>1?`Something else for question ${S+1}…`:"Something else…",onChange:N=>v(N.target.value),onFocus:()=>{},style:{flex:1,minWidth:0,resize:"none",border:"none",outline:"none",background:"transparent",color:"var(--ink-0)",font:"inherit",lineHeight:"var(--lh)",padding:"4px 0"}}),x.trim()?a.jsx(se,{size:"sm",icon:"send",onClick:F,disabled:j,title:"⌘↵",children:"Send"}):K?null:a.jsx(se,{size:"sm",variant:"primary",onClick:()=>D(z),disabled:j||!M,title:M?"Enter":"Answer every question first",children:"Send answers"})]}),u&&a.jsxs("div",{style:{padding:"0 var(--sp-3) var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:[u.model," · ",String(u.provider).split(" · ")[0]]})]})}function M1({mission:i,doneWhen:c=[],budgetUsd:u=5,rationale:o,browser:d=!1,directorModel:h="",workerModel:g="",directorProviderId:y,workerProviderId:x,modelRationale:v,models:S,modelsLoading:b,modelsNote:j,modelsInheritNote:k,busy:B,error:K,onStart:M,onDismiss:z,style:D}){const[U,F]=m.useState(i),[re,q]=m.useState(u),[N,Y]=m.useState(!!d),[G,fe]=m.useState(h||""),[Q,J]=m.useState(g||""),[ge,oe]=m.useState(y),[ne,E]=m.useState(x),$=U!==i||Number(re)!==Number(u);return a.jsxs("section",{style:{background:"var(--bg-card)",border:"1px solid var(--brand)",borderRadius:"var(--r-md)",padding:"var(--sp-4)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",...D},children:[a.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsx(ie,{name:"orchestration",size:16,color:"var(--brand)"}),a.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:"Proposed mission"}),$&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"edited"})]}),o&&a.jsx("p",{style:{margin:0,fontSize:"var(--fs-sm)",color:"var(--ink-1)"},children:o}),a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:"Brief"}),a.jsx("textarea",{value:U,onChange:P=>F(P.target.value),rows:6,style:{resize:"vertical",minHeight:"6rem",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",padding:"var(--sp-2) var(--sp-3)",color:"var(--ink-0)",font:"inherit",lineHeight:"var(--lh-prose)",outline:"none"}})]}),c.length>0&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:"Done when"}),c.map((P,me)=>a.jsxs("div",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:"var(--fs-sm)",color:"var(--ink-1)"},children:[a.jsx("span",{style:{color:"var(--ink-2)",fontFamily:"var(--font-mono)",flex:"0 0 auto"},children:"▢"}),a.jsx("span",{children:P})]},me))]}),v&&(h||g)&&a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsx(ie,{name:"model",size:12}),a.jsxs("span",{children:[a.jsx("span",{style:{color:"var(--ink-1)"},children:"Suggested models —"})," ",v]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-4)",flexWrap:"wrap"},children:[a.jsx(ul,{layout:"stacked",label:"Budget cap",hint:"Hard stop; the run halts here.",children:a.jsx(We,{type:"number",prefix:"$",min:0,step:1,width:96,value:re,onChange:q})}),a.jsx(ul,{layout:"stacked",label:"Director",hint:"Plans, delegates, verifies.",children:a.jsx(an,{value:G,models:S,loading:b,note:j,inheritNote:k,onChange:(P,me)=>{fe(P),oe(me?.providerId)}})}),a.jsx(ul,{layout:"stacked",label:"Workers",hint:"Implement. Cheaper models cut cost.",children:a.jsx(an,{value:Q,models:S,loading:b,note:j,inheritNote:k,onChange:(P,me)=>{J(P),E(me?.providerId)}})}),a.jsx(ul,{label:"Browser",hint:d?"The planner judged the criteria need a browser, so it starts on.":"Headless Playwright for the agents — navigate, click, screenshot. Non-local URLs still ask you.",children:a.jsx(Mt,{checked:N,onChange:Y,label:N?"on":"off"})})]}),K&&a.jsx(ot,{tone:"error",inline:!0,children:K}),a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--sp-2)"},children:[a.jsx(se,{variant:"ghost",onClick:z,disabled:B,children:"Not this one"}),a.jsx(se,{variant:"primary",icon:"orchestration",disabled:B||!U.trim(),title:"Starts the mission: a director plans it and workers do the work",onClick:()=>M?.({mission:U.trim(),budget:Number(re)||u,directorModel:G,workerModel:Q,directorProviderId:ge,workerProviderId:ne,browserTools:N}),children:B?"Starting…":"Start mission"})]})]})}const E1=[{value:"next",label:"Next turn",icon:"nextTurn"},{value:"now",label:"Now",icon:"now"}];function _1({agents:i=[],to:c,onTo:u,value:o,onChange:d,timing:h,onTiming:g,onSend:y,disabled:x,disabledReason:v,style:S}){const[b,j]=m.useState(""),[k,B]=m.useState("director"),[K,M]=m.useState("next"),[z,D]=m.useState(!1),[U,F]=m.useState(!1),re=m.useRef(null),q=m.useRef(null),N=o??b,Y=d??j,G=c??k,fe=u??B,Q=h??K,J=g??M,ge=i.filter(E=>E.status==="running"||E.id==="director"),oe=!x&&N.trim().length>0;m.useEffect(()=>{const E=re.current;E&&(E.style.height="auto",E.style.height=Math.min(E.scrollHeight,132)+"px")},[N]),m.useEffect(()=>{if(!z)return;const E=$=>{q.current&&!q.current.contains($.target)&&D(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[z]);const ne=()=>{oe&&(y?.(N.trim(),{to:G,timing:Q}),Y(""))};return a.jsxs("div",{ref:q,style:{position:"relative",flex:"0 0 auto",background:"var(--bg-card)",border:`1px solid ${U?"var(--brand)":"var(--line-strong)"}`,borderRadius:"var(--r-md)",padding:"var(--sp-2) var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",opacity:x?.6:1,transition:"border-color var(--dur-fast) var(--ease)",...S},children:[a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"flex-start"},children:[a.jsx(ie,{name:"steer",size:15,color:"var(--brand)",style:{marginTop:3,flex:"0 0 auto"}}),a.jsx("textarea",{ref:re,rows:1,value:N,disabled:x,placeholder:x?v||"Nothing is running.":`Steer ${G}… a constraint, a correction, a hint. Not a question reply.`,onChange:E=>Y(E.target.value),onFocus:()=>F(!0),onBlur:()=>F(!1),onKeyDown:E=>{(E.metaKey||E.ctrlKey)&&E.key==="Enter"&&(E.preventDefault(),ne())},style:{flex:1,minWidth:0,resize:"none",border:"none",outline:"none",background:"transparent",color:"var(--ink-0)",font:"inherit",lineHeight:"var(--lh)",padding:"2px 0",maxHeight:132}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[a.jsx(A1,{agent:G,open:z,onClick:()=>!x&&D(E=>!E),disabled:x}),a.jsx(dn,{size:"sm",tabs:E1,value:Q,onChange:J}),a.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap"},children:Q==="now"?"Interrupts the current tool call":"Delivered before the next tool call"}),a.jsx(se,{size:"sm",icon:"send",onClick:ne,disabled:!oe,title:"⌘↵",children:"Send"})]}),z&&a.jsx("div",{role:"listbox",style:{position:"absolute",left:"var(--sp-3)",bottom:"calc(100% - 4px)",zIndex:10,minWidth:220,background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",boxShadow:"var(--shadow-pop, 0 8px 24px rgba(0,0,0,.35))",padding:4},children:ge.map(E=>a.jsx(D1,{agent:E,selected:E.id===G,onSelect:()=>{fe(E.id),D(!1),re.current?.focus()}},E.id))})]})}function A1({agent:i,open:c,onClick:u,disabled:o}){const[d,h]=m.useState(!1);return a.jsxs("button",{type:"button",onClick:u,disabled:o,"aria-haspopup":"listbox","aria-expanded":c,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"3px 8px 3px 6px",borderRadius:"var(--r-pill)",border:"1px solid var(--line)",cursor:o?"default":"pointer",background:c||d?"var(--bg-hover)":"var(--bg-inset)",color:"var(--ink-0)",font:"inherit",fontSize:"var(--fs-xs)"},children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:"to"}),a.jsx(fn,{agent:i,size:"sm"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i}),a.jsx(ie,{name:"chevronDown",size:12,color:"var(--ink-2)"})]})}function D1({agent:i,selected:c,onSelect:u}){const[o,d]=m.useState(!1);return a.jsxs("button",{type:"button",role:"option","aria-selected":c,onClick:u,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:8,width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:4,border:"none",cursor:"pointer",font:"inherit",background:o?"var(--bg-hover)":"transparent",color:"var(--ink-0)"},children:[a.jsx("span",{style:{width:12,display:"inline-flex",color:"var(--brand)"},children:c&&a.jsx(ie,{name:"check",size:12,strokeWidth:2.5})}),a.jsx(fn,{agent:i.id,size:"sm"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)"},children:i.id}),i.task&&a.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.task})]})}function R1({agents:i=[],filter:c,onFilter:u,style:o}){return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",...o},children:[a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginRight:2},children:[a.jsx(ie,{name:"crew",size:12}),"Crew"]}),i.map(d=>{const h=c===d.id;return a.jsxs("button",{type:"button",onClick:()=>u?.(d.id),title:d.task||d.id,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:h?"var(--bg-card)":"var(--bg-inset)",border:`1px solid ${h?"var(--line-strong)":"var(--line)"}`,color:h?"var(--ink-0)":"var(--ink-1)",fontSize:"var(--fs-xs)",cursor:"pointer",font:"inherit",lineHeight:"16px"},children:[a.jsx(fn,{agent:d.id,size:"sm"}),d.id,a.jsx(ie,{name:d.status||"running",size:11,strokeWidth:2.25,color:d.status==="error"?"var(--status-critical)":d.status==="interrupted"?"var(--status-serious)":d.status==="idle"?"var(--ink-2)":"var(--status-good)"})]},d.id)})]})}function O1({mission:i,title:c,createdAt:u,costUsd:o=0,costBasis:d="priced",usage:h,status:g="done",selected:y,current:x,onSelect:v,style:S}){const[b,j]=m.useState(!1),k=Number(o)||0,B=h?(h.inputTokens||0)+(h.outputTokens||0)+(h.cacheReadTokens||0)+(h.cacheWriteTokens||0):0,K=d==="priced"?`$${k.toFixed(2)}`:d==="unpriced"&&B>0?`${Nl(B)} tok`:null,M=u?new Date(u).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null;return a.jsxs("div",{role:"button",title:i,onClick:v,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),style:{padding:"6px 10px",borderRadius:"var(--r-sm)",cursor:v?"pointer":"default",background:y?"var(--bg-card)":b&&v?"var(--bg-hover)":"transparent",border:y?"1px solid var(--line-strong)":"1px solid transparent",marginBottom:2,transition:"background var(--dur-fast) var(--ease)",...S},children:[a.jsx("div",{style:{fontSize:"var(--fs-sm)",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",color:"var(--ink-0)",fontWeight:x?"var(--fw-semibold)":"var(--fw-regular)"},children:c||i}),a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center",marginTop:2,fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:[M&&a.jsx("span",{children:M}),K&&a.jsx("span",{title:d==="unpriced"?"This provider publishes no prices; tokens are what is known.":void 0,children:K}),a.jsx(fl,{status:g})]})]})}function N1({agent:i,title:c,toolName:u,decisionReason:o,input:d,escapedPath:h,onAllow:g,onAlways:y,onDeny:x,style:v}){const S=u||(c||"").replace(/^Wants to use\s+/i,"")||"tool",b=h?{label:"Allow this path (run)",hint:`Allow ${h} for the rest of the run; other paths outside the folder will still ask`}:{label:"Always (run)",hint:"Allow this tool for the rest of the run"};return a.jsxs(Jc,{accent:"var(--brand)",style:{marginBottom:"var(--sp-2)",...v},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontWeight:"var(--fw-semibold)",color:"var(--brand)",fontSize:"var(--fs-sm)"},children:[a.jsx(ie,{name:"approval",size:14,strokeWidth:2}),a.jsxs("span",{children:[i," wants to use ",S]})]}),o&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,color:"var(--status-serious)",fontSize:"var(--fs-xs)",marginTop:4},children:[a.jsx(ie,{name:"caution",size:12,strokeWidth:2}),o]}),a.jsx(Zp,{tool:S,input:typeof d=="string"?void 0:d,body:typeof d=="string"?d:void 0,defaultOpen:!0,style:{margin:"var(--sp-2) 0"}}),a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",flexWrap:"wrap",justifyContent:"flex-end"},children:[a.jsx(se,{variant:"good",onClick:g,children:"Allow"}),a.jsx(se,{variant:"good",onClick:y,title:b.hint,children:b.label}),a.jsx(se,{variant:"danger",onClick:x,children:"Deny"})]})]})}function H1({question:i,options:c=[],value:u,onChange:o,onAnswer:d,style:h}){const[g,y]=m.useState(""),x=u??g,v=o??y;return a.jsxs(Jc,{accent:"var(--brand)",style:{marginBottom:"var(--sp-2)",...h},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontWeight:"var(--fw-semibold)",color:"var(--brand)",fontSize:"var(--fs-sm)",marginBottom:4},children:[a.jsx(ie,{name:"question",size:14,strokeWidth:2}),"Director asks:"]}),a.jsx("div",{style:{whiteSpace:"pre-wrap",fontSize:"var(--fs-md)"},children:i}),c.length>0&&a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,margin:"var(--sp-2) 0 0"},children:c.map((S,b)=>a.jsxs("button",{type:"button",onClick:()=>d?.(S),title:b===0?"Recommended":void 0,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",fontSize:"var(--fs-sm)",background:"var(--bg-inset)",border:"1px solid var(--line-strong)",color:"var(--ink-0)"},children:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:b+1}),S,b===0&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"· recommended"})]},S))}),a.jsx("div",{style:{margin:"var(--sp-2) 0"},children:a.jsx(tv,{size:"answer",value:x,onChange:v})}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:a.jsx(se,{variant:"primary",onClick:()=>d?.(x),disabled:!String(x).trim(),children:"Answer"})})]})}function U1(i,c){if(!i)return"";const u=Math.max(0,Math.round((c-i)/1e3));return u<60?`${u}s`:u<3600?`${Math.floor(u/60)}m`:`${Math.floor(u/3600)}h ${Math.floor(u%3600/60)}m`}function jp({since:i,now:c}){const u=U1(i,c);return u?a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--status-warning)",fontWeight:"var(--fw-semibold)",marginBottom:4},children:["waiting ",u]}):null}function B1({approvals:i=[],questions:c=[],now:u=Date.now(),running:o=!1,activity:d,onAllow:h,onAlways:g,onDeny:y,onAnswer:x,style:v}){const S=i.length+c.length;if(S===0&&!o||S===0&&!d)return null;const b={flex:"0 0 auto",padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",...v};return S===0?a.jsxs("div",{role:"status",style:{...b,display:"flex",alignItems:"center",gap:"var(--sp-2)",background:"var(--bg-panel)",fontSize:"var(--fs-sm)",minWidth:0},children:[a.jsx(ie,{name:"running",size:14,color:"var(--status-good)",strokeWidth:2}),d.agent&&a.jsx(fn,{agent:d.agent,size:"sm"}),a.jsx("span",{style:{color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},title:d.line,children:d.line}),d.crew&&a.jsx("span",{style:{marginLeft:"auto",flex:"0 0 auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:d.crew})]}):a.jsxs("div",{role:"region","aria-label":"Needs you",style:{...b,background:"var(--brand-wash-strong)",borderTop:"2px solid var(--status-warning)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",maxHeight:"55vh",overflowY:"auto"},children:[a.jsxs("div",{className:"pulse",style:{display:"flex",alignItems:"center",gap:6,fontSize:"var(--fs-xs)",color:"var(--status-warning)",fontWeight:"var(--fw-semibold)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:[a.jsx(ie,{name:"needsYou",size:13,strokeWidth:2.25}),"Needs you — ",[i.length?`${i.length} approval${i.length===1?"":"s"}`:null,c.length?`${c.length} question${c.length===1?"":"s"}`:null].filter(Boolean).join(", ")]}),i.map(j=>a.jsxs("div",{children:[a.jsx(jp,{since:j.since,now:u}),a.jsx(N1,{agent:j.agent,title:j.title,toolName:j.toolName,decisionReason:j.decisionReason,input:j.input,escapedPath:j.escapedPath,onAllow:()=>h?.(j.id),onAlways:()=>g?.(j.id),onDeny:()=>y?.(j.id)})]},j.id)),c.map(j=>a.jsxs("div",{children:[a.jsx(jp,{since:j.since,now:u}),a.jsx(H1,{question:j.question,options:j.options,onAnswer:k=>x?.(j.id,k)})]},j.id))]})}function lv(i){if(!i)return null;const c=String(i).split(`
62
- `),u=c.findIndex(d=>/^#{1,6}\s*DONE\s*WHEN/i.test(d.trim()));if(u===-1)return null;const o=[];for(const d of c.slice(u+1)){if(/^#{1,6}\s/.test(d))break;const h=d.match(/^\s*[-*]\s*\[( |x|X)\]\s*(.*)$/);if(!h)continue;const g=h[2].trim().replace(/\*\*(.+?)\*\*/g,"$1").replace(/`([^`]*)`/g,"$1");o.push({text:g,done:h[1]!==" "})}return o.length?o:null}function q1(i){return i?`Done when · ${i.filter(c=>c.done).length} / ${i.length}`:"Done when"}function L1({doc:i,style:c}){const u=lv(i),o=u?u.filter(d=>d.done).length:0;return a.jsxs("section",{style:c,children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",marginBottom:"var(--sp-2)",fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)",color:"var(--ink-2)"},children:[a.jsx("span",{children:"Done when"}),u&&a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",textTransform:"none",letterSpacing:0,color:o===u.length?"var(--status-good)":"var(--ink-1)"},children:[o," / ",u.length]})]}),!i&&a.jsx(Fe,{children:"MISSION.md not written yet."}),i&&!u&&a.jsx(Fe,{children:"No DONE WHEN section in the mission doc."}),u&&u.map((d,h)=>a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"3px 0",fontSize:"var(--fs-sm)",lineHeight:"var(--lh)",color:d.done?"var(--ink-2)":"var(--ink-0)"},children:[a.jsx(ie,{name:d.done?"done":"idle",size:14,strokeWidth:2,color:d.done?"var(--status-good)":"var(--ink-2)",style:{marginTop:2}}),a.jsx("span",{style:{textDecoration:d.done?"line-through":"none"},children:d.text})]},h))]})}function $1({text:i,truncated:c,style:u}){const o=String(i||"").split(`
63
- `);return a.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",lineHeight:"var(--lh)",background:"var(--bg-inset)",overflowX:"auto",...u},children:[o.map((d,h)=>{const g=d.startsWith("@@")||d.startsWith("diff ")||d.startsWith("index ")||d.startsWith("--- ")||d.startsWith("+++ "),y=!g&&d.startsWith("+"),x=!g&&d.startsWith("-");return a.jsx("div",{style:{padding:"0 var(--sp-2)",whiteSpace:"pre",background:y?"var(--diff-add-bg)":x?"var(--diff-del-bg)":"transparent",color:g?"var(--ink-2)":"var(--ink-0)"},children:d||" "},h)}),c&&a.jsx("div",{style:{padding:"2px var(--sp-2)",color:"var(--ink-2)",fontFamily:"var(--font-ui)"},children:"first 400 lines — the rest is in your working tree"})]})}const Nc=512*1024;function Qc({artifact:i,url:c,previewUrl:u,onClose:o,index:d,count:h,onStep:g}){const y=/\.html?$/i.test(i?.path??""),[x,v]=m.useState("rendered"),S=typeof g=="function"&&typeof h=="number"&&h>1,b=S&&d>0?()=>g(d-1):null,j=S&&d<h-1?()=>g(d+1):null,[k,B]=m.useState(null),[K,M]=m.useState(null),z=i?.kind,D=z==="diff",U=i?.path?.split("/").pop()??"",F=/\.md$/i.test(U);if(m.useEffect(()=>{const Y=G=>{G.key==="Escape"?o():G.key==="ArrowLeft"&&b?(G.preventDefault(),b()):G.key==="ArrowRight"&&j&&(G.preventDefault(),j())};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[o,b,j]),m.useEffect(()=>{if(B(null),M(null),z!=="text"||!c)return;let Y=!0;return fetch(c).then(async G=>{if(!G.ok)throw new Error(`HTTP ${G.status}`);const fe=await G.text();Y&&B(fe.length>Nc?`${fe.slice(0,Nc)}
61
+ `,bt=we+sn.length+4}const ha=j.slice(0,we)+Ge+j.slice(le);k(ha),ge("write"),requestAnimationFrame(()=>{te.focus();const sn=Ne?bt:bt+(ee==="code"?4:ee==="quote"?11:0);te.setSelectionRange(bt,sn)})},Re=E?"var(--brand)":P?"var(--ink-2)":"var(--line-strong)";return l.jsxs("div",{style:{maxWidth:"var(--composer-max)",margin:"var(--sp-5) auto",padding:"0 var(--sp-4)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",...S},children:[l.jsxs("div",{style:{minWidth:0},children:[l.jsx("h2",{style:{margin:0,fontSize:"var(--fs-lg)"},children:"New mission"}),l.jsx("div",{title:i,style:{color:"var(--ink-2)",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:z1(i)})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginRight:2},children:[l.jsx(se,{name:"template",size:12}),"Start from"]}),d.map(ee=>l.jsx(ie,{size:"sm",icon:ee.icon,title:`Budget $${ee.budget} · director ${ee.director||"default"} · workers ${ee.worker||"default"}`,onClick:()=>_(ee),children:ee.label},ee.id))]}),l.jsxs("div",{onDragOver:ee=>{ee.preventDefault(),E||G(!0)},onDragLeave:ee=>{ee.currentTarget.contains(ee.relatedTarget)||G(!1)},onDrop:ee=>{ee.preventDefault(),G(!1),I(ee.dataTransfer.files)},style:{background:"var(--bg-card)",border:`1px solid ${Re}`,borderRadius:"var(--r-md)",overflow:"hidden",boxShadow:E?"0 0 0 3px var(--brand-wash-strong)":"none",transition:"border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease)"},children:[l.jsxs("div",{role:"tablist",style:{display:"flex",alignItems:"center",gap:2,padding:"0 6px",borderBottom:"1px solid var(--line)",background:"var(--bg-panel)"},children:[l.jsx(bp,{icon:"write",label:"Write",active:W==="write",onClick:()=>ge("write")}),l.jsx(bp,{icon:"preview",label:"Preview",active:W==="preview",onClick:()=>ge("preview")}),l.jsx("span",{style:{flex:1}}),l.jsx(Oc,{icon:"quote",label:"Quote (> )",onClick:()=>be("quote")}),l.jsx(Oc,{icon:"code",label:"Inline code (`)",onClick:()=>be("code")}),l.jsx(Oc,{icon:"codeBlock",label:"Code block (```)",onClick:()=>be("block")})]}),W==="write"?l.jsx(y1,{ref:xe,value:j,onChange:k,placeholder:k1,minHeight:200,maxHeight:440,onKeyDown:ee=>{(ee.metaKey||ee.ctrlKey)&&ee.key==="Enter"&&(ee.preventDefault(),ue())},onPaste:ee=>{ee.clipboardData?.files?.length&&(ee.preventDefault(),I(ee.clipboardData.files))},onFocus:()=>me(!0),onBlur:()=>me(!1)}):l.jsx("div",{style:{minHeight:200,maxHeight:440,overflowY:"auto",padding:"var(--sp-3)",boxSizing:"border-box"},children:j.trim()?l.jsx(Ai,{text:j}):l.jsx("span",{style:{color:"var(--ink-2)"},children:"Nothing to preview yet."})}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",padding:"6px 8px",borderTop:"1px solid var(--line)",minHeight:36,boxSizing:"border-box"},children:[l.jsx("input",{ref:T,type:"file",multiple:!0,style:{display:"none"},onChange:ee=>{I(ee.target.files),ee.target.value=""}}),l.jsx(ie,{size:"sm",variant:"ghost",icon:"attach",title:"Attach files — or drop them on the editor, or paste an image",onClick:()=>T.current?.click(),children:"Attach"}),oe.map((ee,te)=>l.jsx(Vp,{name:ee.name,size:ee.size,onRemove:()=>ne(we=>we.filter((le,Ne)=>Ne!==te))},Rc(ee))),l.jsx("span",{style:{flex:1}}),l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[de&&l.jsxs(l.Fragment,{children:[l.jsx(se,{name:"draft",size:11}),de==="restored"?"Draft restored":"Draft saved"]}),(j||oe.length>0)&&l.jsx("button",{type:"button",onClick:F,style:{background:"none",border:"none",padding:0,color:"var(--ink-2)",cursor:"pointer",font:"inherit",textDecoration:"underline"},children:"Clear"})]})]})]}),l.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-4)",flexWrap:"wrap"},children:[l.jsx(ua,{layout:"stacked",label:"Budget cap",hint:"Hard stop; the run halts here.",children:l.jsx(We,{type:"number",min:1,step:1,width:96,prefix:"$",value:U,onChange:Z})}),l.jsx(ua,{layout:"stacked",label:"Director",hint:"Plans, delegates, verifies.",children:l.jsx(ln,{value:C,models:h,loading:g,note:y,inheritNote:b,onChange:(ee,te)=>{z(ee),re(te?.providerId)}})}),l.jsx(ua,{layout:"stacked",label:"Workers",hint:"Implement. Cheaper models cut cost.",children:l.jsx(ln,{value:D,models:h,loading:g,note:y,inheritNote:b,onChange:(ee,te)=>{B(ee),N(te?.providerId)}})}),l.jsx(ua,{label:"Browser",hint:"Headless Playwright for the agents — navigate, click, screenshot. Non-local URLs still ask you.",children:l.jsx(Mt,{checked:$,onChange:Y,label:$?"on":"off"})})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--sp-3)",flexWrap:"wrap"},children:[u&&l.jsx(lt,{tone:"error",inline:!0,style:{marginRight:"auto"},children:u}),l.jsxs("span",{title:"Start the mission with Cmd+Enter from the editor",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[l.jsx(xp,{children:"⌘"}),l.jsx(xp,{children:"↵"})]}),l.jsx(ie,{variant:"primary",disabled:!ce,onClick:ue,children:"Start mission"})]})]})}function C1({questions:i=[],askedAt:c,who:u,onAnswer:o,onFreeText:d,style:h}){const[g,y]=m.useState({}),[b,v]=m.useState(""),[S,x]=m.useState(0),[j,k]=m.useState(!1),U=m.useRef(null),Z=i.length===1&&!i[0]?.multi,C=i.every(N=>{const $=g[N.question];return Array.isArray($)?$.length>0:!!$});m.useEffect(()=>{y({}),v(""),x(0),k(!1)},[i]);const z=m.useMemo(()=>{const N={};for(const $ of i){const Y=g[$.question];Array.isArray(Y)?N[$.question]=Y.join(", "):Y&&(N[$.question]=Y)}return N},[g,i]),D=N=>{j||(k(!0),o?.(N))},B=(N,$)=>{if(j)return;if(N.multi){y(de=>{const Q=Array.isArray(de[N.question])?de[N.question]:[],W=Q.includes($)?Q.filter(ge=>ge!==$):[...Q,$];return{...de,[N.question]:W}});return}const Y={...g,[N.question]:$};y(Y),Z&&D({[N.question]:$})},J=()=>{const N=b.trim();if(!N||j)return;const $=i[Math.min(S,i.length-1)],Y={...z,[$.question]:N};if(i.length===1){k(!0),o?.(Y);return}k(!0),o?.(Y)},re=N=>{if(N.target.tagName==="TEXTAREA"){(N.metaKey||N.ctrlKey)&&N.key==="Enter"&&(N.preventDefault(),J());return}const $=i[S];if($)if(/^[1-9]$/.test(N.key)){const Y=$.options[Number(N.key)-1];Y&&(N.preventDefault(),B($,Y.label))}else N.key==="ArrowDown"?(N.preventDefault(),x(Y=>Math.min(i.length-1,Y+1))):N.key==="ArrowUp"?(N.preventDefault(),x(Y=>Math.max(0,Y-1))):N.key==="Enter"&&!Z&&C&&(N.preventDefault(),D(z))},q=c?Math.max(0,Math.round((Date.now()-c)/6e4)):0;return l.jsxs("div",{ref:U,tabIndex:0,onKeyDown:re,style:{flex:"0 0 auto",outline:"none",background:"var(--bg-card)",border:"1px solid var(--brand)",borderRadius:"var(--r-md)",overflow:"hidden",opacity:j?.6:1,transition:"opacity var(--dur-fast) var(--ease)",...h},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[l.jsx(se,{name:"question",size:14,color:"var(--brand)"}),l.jsx("span",{style:{color:"var(--ink-1)",fontWeight:"var(--fw-semibold)"},children:"The foreman asks"}),l.jsx("span",{children:"· pick an answer, or type one"}),q>=1&&l.jsxs("span",{style:{marginLeft:"auto"},children:["waiting ",q,"m"]})]}),i.map((N,$)=>{const Y=g[N.question],de=Array.isArray(Y)?Y.length>0:!!Y,Q=$===S;return l.jsxs("div",{onMouseEnter:()=>x($),style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",background:Q&&i.length>1?"var(--bg-inset)":"transparent"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6,marginBottom:6,fontSize:"var(--fs-md)",color:"var(--ink-0)"},children:[i.length>1&&l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:de?"var(--status-ok, var(--brand))":"var(--ink-2)"},children:de?"✓":`${$+1}.`}),l.jsx("span",{children:N.question}),N.multi&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"choose any"})]}),l.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:N.options.map((W,ge)=>{const oe=Array.isArray(Y)?Y.includes(W.label):Y===W.label;return l.jsxs("button",{type:"button",disabled:j,onClick:()=>B(N,W.label),title:W.hint||(ge===0?"Recommended":void 0),style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:2,padding:"6px 10px",borderRadius:"var(--r-sm)",cursor:j?"default":"pointer",font:"inherit",textAlign:"left",maxWidth:360,background:oe?"color-mix(in srgb, var(--brand) 16%, transparent)":"var(--bg-inset)",border:`1px solid ${oe?"var(--brand)":"var(--line-strong)"}`,color:oe?"var(--brand)":"var(--ink-0)",transition:"border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease)"},children:[l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"var(--fs-sm)"},children:[l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",minWidth:14,color:oe?"var(--brand)":"var(--ink-2)"},children:ge+1}),W.label,ge===0&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontWeight:"var(--fw-normal)"},children:"· recommended"})]}),W.hint&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:W.hint})]},W.label)})})]},N.question)}),l.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)"},children:[l.jsx("textarea",{rows:1,value:b,disabled:j,placeholder:i.length>1?`Something else for question ${S+1}…`:"Something else…",onChange:N=>v(N.target.value),onFocus:()=>{},style:{flex:1,minWidth:0,resize:"none",border:"none",outline:"none",background:"transparent",color:"var(--ink-0)",font:"inherit",lineHeight:"var(--lh)",padding:"4px 0"}}),b.trim()?l.jsx(ie,{size:"sm",icon:"send",onClick:J,disabled:j,title:"⌘↵",children:"Send"}):Z?null:l.jsx(ie,{size:"sm",variant:"primary",onClick:()=>D(z),disabled:j||!C,title:C?"Enter":"Answer every question first",children:"Send answers"})]}),u&&l.jsxs("div",{style:{padding:"0 var(--sp-3) var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:[u.model," · ",String(u.provider).split(" · ")[0]]})]})}function M1({mission:i,doneWhen:c=[],budgetUsd:u=5,rationale:o,browser:d=!1,directorModel:h="",workerModel:g="",directorProviderId:y,workerProviderId:b,modelRationale:v,models:S,modelsLoading:x,modelsNote:j,modelsInheritNote:k,busy:U,error:Z,onStart:C,onDismiss:z,style:D}){const[B,J]=m.useState(i),[re,q]=m.useState(u),[N,$]=m.useState(!!d),[Y,de]=m.useState(h||""),[Q,W]=m.useState(g||""),[ge,oe]=m.useState(y),[ne,E]=m.useState(b),G=B!==i||Number(re)!==Number(u);return l.jsxs("section",{style:{background:"var(--bg-card)",border:"1px solid var(--brand)",borderRadius:"var(--r-md)",padding:"var(--sp-4)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",...D},children:[l.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[l.jsx(se,{name:"orchestration",size:16,color:"var(--brand)"}),l.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:"Proposed mission"}),G&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"edited"})]}),o&&l.jsx("p",{style:{margin:0,fontSize:"var(--fs-sm)",color:"var(--ink-1)"},children:o}),l.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:"Brief"}),l.jsx("textarea",{value:B,onChange:P=>J(P.target.value),rows:6,style:{resize:"vertical",minHeight:"6rem",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",padding:"var(--sp-2) var(--sp-3)",color:"var(--ink-0)",font:"inherit",lineHeight:"var(--lh-prose)",outline:"none"}})]}),c.length>0&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:"Done when"}),c.map((P,me)=>l.jsxs("div",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:"var(--fs-sm)",color:"var(--ink-1)"},children:[l.jsx("span",{style:{color:"var(--ink-2)",fontFamily:"var(--font-mono)",flex:"0 0 auto"},children:"▢"}),l.jsx("span",{children:P})]},me))]}),v&&(h||g)&&l.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[l.jsx(se,{name:"model",size:12}),l.jsxs("span",{children:[l.jsx("span",{style:{color:"var(--ink-1)"},children:"Suggested models —"})," ",v]})]}),l.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-4)",flexWrap:"wrap"},children:[l.jsx(ua,{layout:"stacked",label:"Budget cap",hint:"Hard stop; the run halts here.",children:l.jsx(We,{type:"number",prefix:"$",min:0,step:1,width:96,value:re,onChange:q})}),l.jsx(ua,{layout:"stacked",label:"Director",hint:"Plans, delegates, verifies.",children:l.jsx(ln,{value:Y,models:S,loading:x,note:j,inheritNote:k,onChange:(P,me)=>{de(P),oe(me?.providerId)}})}),l.jsx(ua,{layout:"stacked",label:"Workers",hint:"Implement. Cheaper models cut cost.",children:l.jsx(ln,{value:Q,models:S,loading:x,note:j,inheritNote:k,onChange:(P,me)=>{W(P),E(me?.providerId)}})}),l.jsx(ua,{label:"Browser",hint:d?"The planner judged the criteria need a browser, so it starts on.":"Headless Playwright for the agents — navigate, click, screenshot. Non-local URLs still ask you.",children:l.jsx(Mt,{checked:N,onChange:$,label:N?"on":"off"})})]}),Z&&l.jsx(lt,{tone:"error",inline:!0,children:Z}),l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--sp-2)"},children:[l.jsx(ie,{variant:"ghost",onClick:z,disabled:U,children:"Not this one"}),l.jsx(ie,{variant:"primary",icon:"orchestration",disabled:U||!B.trim(),title:"Starts the mission: a director plans it and workers do the work",onClick:()=>C?.({mission:B.trim(),budget:Number(re)||u,directorModel:Y,workerModel:Q,directorProviderId:ge,workerProviderId:ne,browserTools:N}),children:U?"Starting…":"Start mission"})]})]})}const E1=[{value:"next",label:"Next turn",icon:"nextTurn"},{value:"now",label:"Now",icon:"now"}];function _1({agents:i=[],to:c,onTo:u,value:o,onChange:d,timing:h,onTiming:g,onSend:y,disabled:b,disabledReason:v,style:S}){const[x,j]=m.useState(""),[k,U]=m.useState("director"),[Z,C]=m.useState("next"),[z,D]=m.useState(!1),[B,J]=m.useState(!1),re=m.useRef(null),q=m.useRef(null),N=o??x,$=d??j,Y=c??k,de=u??U,Q=h??Z,W=g??C,ge=i.filter(E=>E.status==="running"||E.id==="director"),oe=!b&&N.trim().length>0;m.useEffect(()=>{const E=re.current;E&&(E.style.height="auto",E.style.height=Math.min(E.scrollHeight,132)+"px")},[N]),m.useEffect(()=>{if(!z)return;const E=G=>{q.current&&!q.current.contains(G.target)&&D(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[z]);const ne=()=>{oe&&(y?.(N.trim(),{to:Y,timing:Q}),$(""))};return l.jsxs("div",{ref:q,style:{position:"relative",flex:"0 0 auto",background:"var(--bg-card)",border:`1px solid ${B?"var(--brand)":"var(--line-strong)"}`,borderRadius:"var(--r-md)",padding:"var(--sp-2) var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",opacity:b?.6:1,transition:"border-color var(--dur-fast) var(--ease)",...S},children:[l.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"flex-start"},children:[l.jsx(se,{name:"steer",size:15,color:"var(--brand)",style:{marginTop:3,flex:"0 0 auto"}}),l.jsx("textarea",{ref:re,rows:1,value:N,disabled:b,placeholder:b?v||"Nothing is running.":`Steer ${Y}… a constraint, a correction, a hint. Not a question reply.`,onChange:E=>$(E.target.value),onFocus:()=>J(!0),onBlur:()=>J(!1),onKeyDown:E=>{(E.metaKey||E.ctrlKey)&&E.key==="Enter"&&(E.preventDefault(),ne())},style:{flex:1,minWidth:0,resize:"none",border:"none",outline:"none",background:"transparent",color:"var(--ink-0)",font:"inherit",lineHeight:"var(--lh)",padding:"2px 0",maxHeight:132}})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[l.jsx(A1,{agent:Y,open:z,onClick:()=>!b&&D(E=>!E),disabled:b}),l.jsx(dn,{size:"sm",tabs:E1,value:Q,onChange:W}),l.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap"},children:Q==="now"?"Interrupts the current tool call":"Delivered before the next tool call"}),l.jsx(ie,{size:"sm",icon:"send",onClick:ne,disabled:!oe,title:"⌘↵",children:"Send"})]}),z&&l.jsx("div",{role:"listbox",style:{position:"absolute",left:"var(--sp-3)",bottom:"calc(100% - 4px)",zIndex:10,minWidth:220,background:"var(--bg-panel)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",boxShadow:"var(--shadow-pop, 0 8px 24px rgba(0,0,0,.35))",padding:4},children:ge.map(E=>l.jsx(D1,{agent:E,selected:E.id===Y,onSelect:()=>{de(E.id),D(!1),re.current?.focus()}},E.id))})]})}function A1({agent:i,open:c,onClick:u,disabled:o}){const[d,h]=m.useState(!1);return l.jsxs("button",{type:"button",onClick:u,disabled:o,"aria-haspopup":"listbox","aria-expanded":c,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"3px 8px 3px 6px",borderRadius:"var(--r-pill)",border:"1px solid var(--line)",cursor:o?"default":"pointer",background:c||d?"var(--bg-hover)":"var(--bg-inset)",color:"var(--ink-0)",font:"inherit",fontSize:"var(--fs-xs)"},children:[l.jsx("span",{style:{color:"var(--ink-2)"},children:"to"}),l.jsx(fn,{agent:i,size:"sm"}),l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i}),l.jsx(se,{name:"chevronDown",size:12,color:"var(--ink-2)"})]})}function D1({agent:i,selected:c,onSelect:u}){const[o,d]=m.useState(!1);return l.jsxs("button",{type:"button",role:"option","aria-selected":c,onClick:u,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:8,width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:4,border:"none",cursor:"pointer",font:"inherit",background:o?"var(--bg-hover)":"transparent",color:"var(--ink-0)"},children:[l.jsx("span",{style:{width:12,display:"inline-flex",color:"var(--brand)"},children:c&&l.jsx(se,{name:"check",size:12,strokeWidth:2.5})}),l.jsx(fn,{agent:i.id,size:"sm"}),l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)"},children:i.id}),i.task&&l.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.task})]})}function R1({agents:i=[],filter:c,onFilter:u,style:o}){return l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",...o},children:[l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginRight:2},children:[l.jsx(se,{name:"crew",size:12}),"Crew"]}),i.map(d=>{const h=c===d.id;return l.jsxs("button",{type:"button",onClick:()=>u?.(d.id),title:d.task||d.id,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"2px 8px 2px 6px",borderRadius:"var(--r-pill)",background:h?"var(--bg-card)":"var(--bg-inset)",border:`1px solid ${h?"var(--line-strong)":"var(--line)"}`,color:h?"var(--ink-0)":"var(--ink-1)",fontSize:"var(--fs-xs)",cursor:"pointer",font:"inherit",lineHeight:"16px"},children:[l.jsx(fn,{agent:d.id,size:"sm"}),d.id,l.jsx(se,{name:d.status||"running",size:11,strokeWidth:2.25,color:d.status==="error"?"var(--status-critical)":d.status==="interrupted"?"var(--status-serious)":d.status==="idle"?"var(--ink-2)":"var(--status-good)"})]},d.id)})]})}function O1({mission:i,title:c,createdAt:u,costUsd:o=0,costBasis:d="priced",usage:h,status:g="done",selected:y,current:b,onSelect:v,style:S}){const[x,j]=m.useState(!1),k=Number(o)||0,U=h?(h.inputTokens||0)+(h.outputTokens||0)+(h.cacheReadTokens||0)+(h.cacheWriteTokens||0):0,Z=d==="priced"?`$${k.toFixed(2)}`:d==="unpriced"&&U>0?`${Ha(U)} tok`:null,C=u?new Date(u).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null;return l.jsxs("div",{role:"button",title:i,onClick:v,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),style:{padding:"6px 10px",borderRadius:"var(--r-sm)",cursor:v?"pointer":"default",background:y?"var(--bg-card)":x&&v?"var(--bg-hover)":"transparent",border:y?"1px solid var(--line-strong)":"1px solid transparent",marginBottom:2,transition:"background var(--dur-fast) var(--ease)",...S},children:[l.jsx("div",{style:{fontSize:"var(--fs-sm)",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",color:"var(--ink-0)",fontWeight:b?"var(--fw-semibold)":"var(--fw-regular)"},children:c||i}),l.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center",marginTop:2,fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:[C&&l.jsx("span",{children:C}),Z&&l.jsx("span",{title:d==="unpriced"?"This provider publishes no prices; tokens are what is known.":void 0,children:Z}),l.jsx(fa,{status:g})]})]})}function N1({agent:i,title:c,toolName:u,decisionReason:o,input:d,escapedPath:h,onAllow:g,onAlways:y,onDeny:b,style:v}){const S=u||(c||"").replace(/^Wants to use\s+/i,"")||"tool",x=h?{label:"Allow this path (run)",hint:`Allow ${h} for the rest of the run; other paths outside the folder will still ask`}:{label:"Always (run)",hint:"Allow this tool for the rest of the run"};return l.jsxs(Jc,{accent:"var(--brand)",style:{marginBottom:"var(--sp-2)",...v},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontWeight:"var(--fw-semibold)",color:"var(--brand)",fontSize:"var(--fs-sm)"},children:[l.jsx(se,{name:"approval",size:14,strokeWidth:2}),l.jsxs("span",{children:[i," wants to use ",S]})]}),o&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,color:"var(--status-serious)",fontSize:"var(--fs-xs)",marginTop:4},children:[l.jsx(se,{name:"caution",size:12,strokeWidth:2}),o]}),l.jsx(Zp,{tool:S,input:typeof d=="string"?void 0:d,body:typeof d=="string"?d:void 0,defaultOpen:!0,style:{margin:"var(--sp-2) 0"}}),l.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",flexWrap:"wrap",justifyContent:"flex-end"},children:[l.jsx(ie,{variant:"good",onClick:g,children:"Allow"}),l.jsx(ie,{variant:"good",onClick:y,title:x.hint,children:x.label}),l.jsx(ie,{variant:"danger",onClick:b,children:"Deny"})]})]})}function H1({question:i,options:c=[],value:u,onChange:o,onAnswer:d,style:h}){const[g,y]=m.useState(""),b=u??g,v=o??y;return l.jsxs(Jc,{accent:"var(--brand)",style:{marginBottom:"var(--sp-2)",...h},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontWeight:"var(--fw-semibold)",color:"var(--brand)",fontSize:"var(--fs-sm)",marginBottom:4},children:[l.jsx(se,{name:"question",size:14,strokeWidth:2}),"Director asks:"]}),l.jsx("div",{style:{whiteSpace:"pre-wrap",fontSize:"var(--fs-md)"},children:i}),c.length>0&&l.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,margin:"var(--sp-2) 0 0"},children:c.map((S,x)=>l.jsxs("button",{type:"button",onClick:()=>d?.(S),title:x===0?"Recommended":void 0,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",fontSize:"var(--fs-sm)",background:"var(--bg-inset)",border:"1px solid var(--line-strong)",color:"var(--ink-0)"},children:[l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:x+1}),S,x===0&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"· recommended"})]},S))}),l.jsx("div",{style:{margin:"var(--sp-2) 0"},children:l.jsx(tv,{size:"answer",value:b,onChange:v})}),l.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:l.jsx(ie,{variant:"primary",onClick:()=>d?.(b),disabled:!String(b).trim(),children:"Answer"})})]})}function U1(i,c){if(!i)return"";const u=Math.max(0,Math.round((c-i)/1e3));return u<60?`${u}s`:u<3600?`${Math.floor(u/60)}m`:`${Math.floor(u/3600)}h ${Math.floor(u%3600/60)}m`}function jp({since:i,now:c}){const u=U1(i,c);return u?l.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--status-warning)",fontWeight:"var(--fw-semibold)",marginBottom:4},children:["waiting ",u]}):null}function B1({approvals:i=[],questions:c=[],now:u=Date.now(),running:o=!1,activity:d,onAllow:h,onAlways:g,onDeny:y,onAnswer:b,style:v}){const S=i.length+c.length;if(S===0&&!o||S===0&&!d)return null;const x={flex:"0 0 auto",padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",...v};return S===0?l.jsxs("div",{role:"status",style:{...x,display:"flex",alignItems:"center",gap:"var(--sp-2)",background:"var(--bg-panel)",fontSize:"var(--fs-sm)",minWidth:0},children:[l.jsx(se,{name:"running",size:14,color:"var(--status-good)",strokeWidth:2}),d.agent&&l.jsx(fn,{agent:d.agent,size:"sm"}),l.jsx("span",{style:{color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},title:d.line,children:d.line}),d.crew&&l.jsx("span",{style:{marginLeft:"auto",flex:"0 0 auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:d.crew})]}):l.jsxs("div",{role:"region","aria-label":"Needs you",style:{...x,background:"var(--brand-wash-strong)",borderTop:"2px solid var(--status-warning)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",maxHeight:"55vh",overflowY:"auto"},children:[l.jsxs("div",{className:"pulse",style:{display:"flex",alignItems:"center",gap:6,fontSize:"var(--fs-xs)",color:"var(--status-warning)",fontWeight:"var(--fw-semibold)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:[l.jsx(se,{name:"needsYou",size:13,strokeWidth:2.25}),"Needs you — ",[i.length?`${i.length} approval${i.length===1?"":"s"}`:null,c.length?`${c.length} question${c.length===1?"":"s"}`:null].filter(Boolean).join(", ")]}),i.map(j=>l.jsxs("div",{children:[l.jsx(jp,{since:j.since,now:u}),l.jsx(N1,{agent:j.agent,title:j.title,toolName:j.toolName,decisionReason:j.decisionReason,input:j.input,escapedPath:j.escapedPath,onAllow:()=>h?.(j.id),onAlways:()=>g?.(j.id),onDeny:()=>y?.(j.id)})]},j.id)),c.map(j=>l.jsxs("div",{children:[l.jsx(jp,{since:j.since,now:u}),l.jsx(H1,{question:j.question,options:j.options,onAnswer:k=>b?.(j.id,k)})]},j.id))]})}function av(i){if(!i)return null;const c=String(i).split(`
62
+ `),u=c.findIndex(d=>/^#{1,6}\s*DONE\s*WHEN/i.test(d.trim()));if(u===-1)return null;const o=[];for(const d of c.slice(u+1)){if(/^#{1,6}\s/.test(d))break;const h=d.match(/^\s*[-*]\s*\[( |x|X)\]\s*(.*)$/);if(!h)continue;const g=h[2].trim().replace(/\*\*(.+?)\*\*/g,"$1").replace(/`([^`]*)`/g,"$1");o.push({text:g,done:h[1]!==" "})}return o.length?o:null}function q1(i){return i?`Done when · ${i.filter(c=>c.done).length} / ${i.length}`:"Done when"}function L1({doc:i,style:c}){const u=av(i),o=u?u.filter(d=>d.done).length:0;return l.jsxs("section",{style:c,children:[l.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",marginBottom:"var(--sp-2)",fontSize:"var(--fs-xs)",fontWeight:"var(--fw-semibold)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)",color:"var(--ink-2)"},children:[l.jsx("span",{children:"Done when"}),u&&l.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",textTransform:"none",letterSpacing:0,color:o===u.length?"var(--status-good)":"var(--ink-1)"},children:[o," / ",u.length]})]}),!i&&l.jsx(Fe,{children:"MISSION.md not written yet."}),i&&!u&&l.jsx(Fe,{children:"No DONE WHEN section in the mission doc."}),u&&u.map((d,h)=>l.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"3px 0",fontSize:"var(--fs-sm)",lineHeight:"var(--lh)",color:d.done?"var(--ink-2)":"var(--ink-0)"},children:[l.jsx(se,{name:d.done?"done":"idle",size:14,strokeWidth:2,color:d.done?"var(--status-good)":"var(--ink-2)",style:{marginTop:2}}),l.jsx("span",{style:{textDecoration:d.done?"line-through":"none"},children:d.text})]},h))]})}function $1({text:i,truncated:c,style:u}){const o=String(i||"").split(`
63
+ `);return l.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",lineHeight:"var(--lh)",background:"var(--bg-inset)",overflowX:"auto",...u},children:[o.map((d,h)=>{const g=d.startsWith("@@")||d.startsWith("diff ")||d.startsWith("index ")||d.startsWith("--- ")||d.startsWith("+++ "),y=!g&&d.startsWith("+"),b=!g&&d.startsWith("-");return l.jsx("div",{style:{padding:"0 var(--sp-2)",whiteSpace:"pre",background:y?"var(--diff-add-bg)":b?"var(--diff-del-bg)":"transparent",color:g?"var(--ink-2)":"var(--ink-0)"},children:d||" "},h)}),c&&l.jsx("div",{style:{padding:"2px var(--sp-2)",color:"var(--ink-2)",fontFamily:"var(--font-ui)"},children:"first 400 lines — the rest is in your working tree"})]})}const Nc=512*1024;function Qc({artifact:i,url:c,previewUrl:u,onClose:o,index:d,count:h,onStep:g}){const y=/\.html?$/i.test(i?.path??""),[b,v]=m.useState("rendered"),S=typeof g=="function"&&typeof h=="number"&&h>1,x=S&&d>0?()=>g(d-1):null,j=S&&d<h-1?()=>g(d+1):null,[k,U]=m.useState(null),[Z,C]=m.useState(null),z=i?.kind,D=z==="diff",B=i?.path?.split("/").pop()??"",J=/\.md$/i.test(B);if(m.useEffect(()=>{const $=Y=>{Y.key==="Escape"?o():Y.key==="ArrowLeft"&&x?(Y.preventDefault(),x()):Y.key==="ArrowRight"&&j&&(Y.preventDefault(),j())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[o,x,j]),m.useEffect(()=>{if(U(null),C(null),z!=="text"||!c)return;let $=!0;return fetch(c).then(async Y=>{if(!Y.ok)throw new Error(`HTTP ${Y.status}`);const de=await Y.text();$&&U(de.length>Nc?`${de.slice(0,Nc)}
64
64
 
65
- [… ${fe.length-Nc} more characters — open in a new tab for the whole file]`:fe)}).catch(G=>{Y&&M(String(G.message||G))}),()=>{Y=!1}},[c,z]),!i)return null;const re=typeof i.size!="number"?null:i.size>=1024*1024?`${(i.size/1024/1024).toFixed(1)} MB`:i.size>=1024?`${(i.size/1024).toFixed(1)} KB`:`${i.size} B`;let q;return D&&i.binary&&c&&/\.(png|jpe?g|webp|gif|svg)$/i.test(U)?q=a.jsx("img",{src:c,alt:i.path,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",margin:"auto",background:"var(--bg-inset)"}}):D?q=i.binary?a.jsx("div",{style:{margin:"auto",color:"var(--ink-2)"},children:"Binary file — no diff to show."}):i.diff?a.jsx($1,{text:i.diff,truncated:i.truncated,style:{minHeight:"100%"}}):a.jsx("div",{style:{margin:"auto",color:"var(--ink-2)"},children:"No diff recorded for this file."}):y&&u&&x==="rendered"?q=a.jsx("iframe",{title:i.path,src:u,sandbox:"allow-scripts",style:{width:"100%",height:"100%",border:"none",background:"#fff"}}):z==="image"?q=a.jsx("img",{src:c,alt:i.path,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",margin:"auto",background:"var(--bg-inset)"}}):z==="pdf"?q=a.jsx("iframe",{title:i.path,src:c,style:{width:"100%",height:"100%",border:"none",background:"var(--bg-inset)"}}):z==="text"?q=K?a.jsxs("div",{style:{padding:"var(--sp-3)",color:"var(--status-critical)"},children:["Could not load it: ",K]}):k===null?a.jsx("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)"},children:"Loading…"}):F?a.jsx("div",{style:{padding:"var(--sp-3) var(--sp-4)",maxWidth:"72ch",margin:"0 auto"},children:a.jsx(_i,{text:k,slots:!1})}):a.jsx("pre",{style:{margin:0,padding:"var(--sp-3) var(--sp-4)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--ink-0)",tabSize:2},children:k}):q=a.jsxs("div",{style:{margin:"auto",textAlign:"center",color:"var(--ink-2)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",alignItems:"center"},children:[a.jsx(ie,{name:"file",size:28,color:"var(--ink-3)"}),a.jsx("span",{children:"No preview for this kind of file."}),a.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--brand)"},children:["Download ",U]})]}),a.jsx("div",{role:"dialog","aria-modal":"true","aria-label":i.path,onClick:o,style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.55)",display:"flex",alignItems:"center",justifyContent:"center",padding:"var(--sp-4)"},children:a.jsxs("div",{onClick:Y=>Y.stopPropagation(),style:{width:"min(1200px, 100%)",height:"min(900px, 100%)",display:"flex",flexDirection:"column",background:"var(--bg-card)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",boxShadow:"0 24px 64px rgba(0,0,0,0.35)",overflow:"hidden"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"6px var(--sp-2) 6px var(--sp-3)",borderBottom:"1px solid var(--line)",background:"var(--bg-panel)",flex:"0 0 auto",minWidth:0},children:[a.jsx(ie,{name:z==="image"?"Image":z==="text"?"transcript":"file",size:14,color:"var(--ink-2)"}),D&&i.status&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",flex:"0 0 auto"},children:i.status}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:1},title:i.path,children:i.path}),D?a.jsxs("span",{style:{fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:[a.jsxs("span",{style:{color:"var(--status-good)"},children:["+",i.additions??0]})," ",a.jsxs("span",{style:{color:"var(--status-critical)"},children:["−",i.deletions??0]})]}):re&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:re}),y&&u&&a.jsx(dn,{size:"sm",value:x,onChange:v,tabs:[{value:"rendered",label:"Rendered"},{value:"source",label:"Source"}]}),S&&a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,flex:"0 0 auto",marginLeft:"var(--sp-1)"},children:[a.jsx(Ol,{icon:"chevronLeft",label:"Previous (←)",onClick:b??void 0,disabled:!b,size:"sm"}),a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",minWidth:"4.5ch",textAlign:"center"},children:[d+1," / ",h]}),a.jsx(Ol,{icon:"chevronRight",label:"Next (→)",onClick:j??void 0,disabled:!j,size:"sm"})]}),c&&!D&&a.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",flex:"0 0 auto"},children:a.jsx(se,{variant:"ghost",size:"sm",children:"Open in a new tab"})}),a.jsx(Ol,{icon:"close",label:"Close (Esc)",onClick:o,size:"sm"})]}),a.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",display:"flex",flexDirection:"column",background:z==="image"?"var(--bg-inset)":"var(--bg-card)"},children:q})]})})}function Hc(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(i<10*1024?1:0)} KB`:`${(i/1024/1024).toFixed(1)} MB`}function Sp(i,c){return`${i}/preview/${c.split("/").map(encodeURIComponent).join("/")}`}function Uc(i,c){return`${i}/artifact?path=${encodeURIComponent(c)}`}const Y1={image:"image",text:"transcript",pdf:"file",other:"file"};function av(i,c){const u=c?`${c}/`:"",o=new Map,d=[];for(const y of i){if(!y.path.startsWith(u))continue;const x=y.path.slice(u.length),v=x.indexOf("/");if(v<0){d.push(y);continue}const S=x.slice(0,v),b=o.get(S)??{name:S,count:0,sub:new Set};b.count+=1;const j=x.slice(v+1),k=j.indexOf("/");b.sub.add(k<0?"":j.slice(0,k)),o.set(S,b)}const h=(y,x)=>y.localeCompare(x,void 0,{sensitivity:"base",numeric:!0}),g=[...o.values()].sort((y,x)=>h(y.name,x.name)).map(y=>{let x=y.name,v=`${u}${y.name}`,S=y;for(;S.sub.size===1&&!S.sub.has("");){const[b]=[...S.sub],j=av(i,v).dirs.find(k=>k.name===b);if(!j)break;x=`${x}/${b}`,v=`${v}/${b}`,S={sub:j.sub}}return{name:y.name,label:x,path:v,count:y.count,sub:y.sub}});return d.sort((y,x)=>h(y.path,x.path)),{dirs:g,files:d}}const G1={display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"5px 6px",width:"100%",fontSize:"var(--fs-sm)",color:"inherit",minWidth:0,background:"none",border:"none",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",textAlign:"left"};function Bc({onClick:i,title:c,children:u}){const[o,d]=m.useState(!1);return a.jsx("button",{type:"button",onClick:i,title:c,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...G1,background:o?"var(--bg-hover)":"none"},children:u})}const qc={fontFamily:"var(--font-mono)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--ink-0)"},kp={fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"};function X1(i){if(!i?.length)return"";let c=i[0].path.split("/").slice(0,-1);for(const u of i){const o=u.path.split("/").slice(0,-1);let d=0;for(;d<c.length&&d<o.length&&c[d]===o[d];)d++;if(c=c.slice(0,d),!c.length)break}return c.join("/")}const wp=9;function Vc({files:i,truncated:c,loading:u,error:o,onRefresh:d,urlBase:h,initialDir:g="",summary:y,images:x=!0,style:v}){const[S,b]=m.useState(g),[j,k]=m.useState(null),[B,K]=m.useState(!1),[M,z]=m.useState(null),D=m.useMemo(()=>av(i??[],S),[i,S]),U=m.useMemo(()=>x?(i??[]).filter(G=>G.kind==="image").sort((G,fe)=>(fe.mtimeMs??0)-(G.mtimeMs??0)):[],[i,x]),F=B?U:U.slice(0,wp),re={display:"flex",flexDirection:"column",gap:"var(--sp-2)",...v};if(o)return a.jsx("div",{style:re,children:a.jsxs(Fe,{children:["Could not list the folder: ",o]})});if(u&&!i?.length)return a.jsx("div",{style:re,children:a.jsx(Fe,{children:"Reading the folder…"})});const q=S?S.split("/"):[],N=j===null?null:D.files[j]??null,Y=i?.length??0;return a.jsxs("div",{style:re,children:[y!==null&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:[a.jsx("span",{style:{flex:1,minWidth:0},children:y??a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--ink-0)"},children:[Y," file",Y===1?"":"s"]})," in the folder as it stands · every run here shares them"]})}),d&&a.jsx("button",{type:"button",onClick:d,title:"Read the folder again",disabled:u,style:{background:"none",border:"none",padding:2,cursor:"pointer",color:"var(--ink-2)",display:"inline-flex"},children:a.jsx(ie,{name:u?"loading":"resume",size:13})})]}),c&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--status-serious)"},children:"A large folder: only the first 2000 files are listed."}),U.length>0&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(88px, 1fr))",gap:6},children:F.map((G,fe)=>a.jsxs("button",{type:"button",onClick:()=>z(fe),title:`${G.path} · ${Hc(G.size)}`,style:{display:"block",padding:0,width:"100%",cursor:"pointer",font:"inherit",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",overflow:"hidden",background:"var(--bg-inset)",color:"inherit",textAlign:"left"},children:[a.jsx("img",{src:Uc(h,G.path),alt:G.path,loading:"lazy",style:{display:"block",width:"100%",aspectRatio:"4 / 3",objectFit:"cover"}}),a.jsx("div",{style:{padding:"2px 5px",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",color:"var(--ink-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:G.path.split("/").pop()})]},G.path))}),U.length>wp&&a.jsx("button",{type:"button",onClick:()=>K(G=>!G),style:{alignSelf:"flex-start",background:"none",border:"none",padding:"0 2px",cursor:"pointer",font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textDecoration:"underline"},children:B?"Fewer images":`All ${U.length} images`})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:2,padding:"4px 6px",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",background:"var(--bg-inset)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",minWidth:0},children:[a.jsxs("button",{type:"button",onClick:()=>b(""),title:"The project folder",style:{background:"none",border:"none",padding:"1px 3px",cursor:S?"pointer":"default",color:S?"var(--ink-2)":"var(--ink-0)",display:"inline-flex",alignItems:"center",gap:4,font:"inherit"},children:[a.jsx(ie,{name:"folder",size:12}),!S&&a.jsx("span",{children:"/"})]}),q.map((G,fe)=>{const Q=fe===q.length-1,J=q.slice(0,fe+1).join("/");return a.jsxs(On.Fragment,{children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:"/"}),a.jsx("button",{type:"button",onClick:()=>b(J),disabled:Q,style:{background:"none",border:"none",padding:"1px 3px",cursor:Q?"default":"pointer",color:Q?"var(--ink-0)":"var(--ink-2)",font:"inherit",fontWeight:Q?"var(--fw-semibold)":"inherit"},children:G})]},J)})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[S&&a.jsxs(Bc,{onClick:()=>b(q.slice(0,-1).join("/")),title:"Up one level",children:[a.jsx(ie,{name:"parent",size:13,color:"var(--ink-2)"}),a.jsx("span",{style:{...qc,color:"var(--ink-2)"},children:".."})]}),D.dirs.map(G=>a.jsxs(Bc,{onClick:()=>b(G.path),title:`${G.path}/ · ${G.count} file${G.count===1?"":"s"}`,children:[a.jsx(ie,{name:"folder",size:13,color:"var(--brand)"}),a.jsx("span",{style:qc,children:G.label}),a.jsx("span",{style:kp,children:G.count}),a.jsx(ie,{name:"chevronRight",size:12,color:"var(--ink-2)"})]},G.path)),D.files.map((G,fe)=>a.jsxs(Bc,{onClick:()=>k(fe),title:`${G.path} · ${Hc(G.size)}`,children:[a.jsx(ie,{name:Y1[G.kind]||"file",size:13,color:"var(--ink-2)"}),a.jsx("span",{style:qc,children:G.path.slice(G.path.lastIndexOf("/")+1)}),a.jsx("span",{style:kp,children:Hc(G.size)})]},G.path)),D.dirs.length===0&&D.files.length===0&&a.jsx(Fe,{children:S?"Nothing here.":"The folder is empty."})]}),M!==null&&F[M]&&a.jsx(Qc,{artifact:F[M],url:Uc(h,F[M].path),previewUrl:Sp(h,F[M].path),onClose:()=>z(null),index:M,count:F.length,onStep:z}),N&&a.jsx(Qc,{artifact:N,url:Uc(h,N.path),previewUrl:Sp(h,N.path),onClose:()=>k(null),index:j,count:D.files.length,onStep:k})]})}const Q1={added:"added",modified:"modified",deleted:"deleted",renamed:"renamed"},zp={added:"var(--status-good)",deleted:"var(--status-critical)",modified:"var(--ink-1)",renamed:"var(--ink-1)"};function V1(i,c){return`${i}/artifact?path=${encodeURIComponent(c)}`}function W1({path:i,muted:c,strike:u}){const o=i.lastIndexOf("/"),d=o>=0?i.slice(0,o+1):"",h=o>=0?i.slice(o+1):i;return a.jsxs("span",{title:i,style:{fontFamily:"var(--font-mono)",display:"flex",minWidth:0,flex:1,color:c?"var(--ink-2)":"var(--ink-0)",textDecoration:u?"line-through":"none"},children:[d&&a.jsx("span",{style:{color:"var(--ink-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:"0 1 auto"},children:d}),a.jsx("span",{style:{whiteSpace:"nowrap",flex:"0 0 auto"},children:h})]})}const iv={display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"4px 6px",width:"100%",fontSize:"var(--fs-sm)",color:"inherit",minWidth:0,background:"none",border:"none",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",textAlign:"left"};function K1({onClick:i,title:c,children:u}){const[o,d]=m.useState(!1);return a.jsx("button",{type:"button",onClick:i,title:c,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...iv,background:o?"var(--bg-hover)":"none"},children:u})}function Z1({runId:i,deck:c,loading:u,error:o,missing:d,services:h=[],urlBase:g,tree:y,style:x}){const v=g??`/runs/${encodeURIComponent(i)}`,[S,b]=m.useState(null),j={display:"flex",flexDirection:"column",gap:"var(--sp-3)",...x};if(o)return a.jsx("div",{style:j,children:a.jsxs(Fe,{children:["Could not read the working tree: ",o]})});if(d||!c&&!u)return a.jsx("div",{style:j,children:a.jsx(Fe,{children:"No file record for this run — the server has no baseline for it."})});if(!c)return a.jsx("div",{style:j,children:a.jsx(Fe,{children:"Reading the working tree…"})});const{files:k,artifacts:B,totals:K}=c,M=k.map(q=>({...q,kind:"diff"})),z=q=>b(q),D=S===null?null:M[S]??null,U=new Set((y?.files??[]).map(q=>q.path)),F=[...y?.files??[],...B.filter(q=>!U.has(q.path))],re=c.baseline.kind==="git"&&c.baseline.head?`against ${String(c.baseline.head).slice(0,8)}`:c.baseline.kind==="snapshot"?"against a snapshot at run start":"no baseline";return a.jsxs("div",{style:j,children:[a.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",lineHeight:"var(--lh)"},children:[a.jsxs("span",{style:{color:"var(--ink-0)"},children:[K.files," changed · ",a.jsxs("span",{style:{color:"var(--status-good)"},children:["+",K.additions]})," ",a.jsxs("span",{style:{color:"var(--status-critical)"},children:["−",K.deletions]})," · ",B.length," artifact",B.length===1?"":"s"]})," ",a.jsx("span",{children:re}),c.note&&a.jsx("div",{style:{color:"var(--status-serious)"},children:c.note})]}),h.length>0&&a.jsxs("section",{children:[a.jsx(Rn,{children:"Services"}),a.jsx("div",{style:{display:"flex",flexDirection:"column"},children:h.map(q=>a.jsxs("a",{href:q.url??q.path,target:"_blank",rel:"noopener noreferrer",title:`${q.label} — 127.0.0.1:${q.port} through Foreman`,style:{...iv,textDecoration:"none"},children:[a.jsx(ie,{name:"provider",size:12,color:"var(--status-good)"}),a.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--ink-0)"},children:q.label}),a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",flex:"0 0 auto"},children:[":",q.port]})]},q.port))})]}),a.jsxs("section",{children:[a.jsx(Rn,{children:"Changed files"}),k.length===0&&a.jsx(Fe,{children:"Nothing changed in the folder yet."}),a.jsx("div",{style:{display:"flex",flexDirection:"column"},children:k.map((q,N)=>a.jsxs(K1,{onClick:()=>z(N),title:q.binary?`${q.path} — binary, no diff`:q.preexisting?`${q.path} — also dirty before the run`:`${q.path} — open the diff`,children:[a.jsx(ie,{name:"file",size:12,color:"var(--ink-2)"}),a.jsx(W1,{path:q.path,muted:q.status==="deleted",strike:q.status==="deleted"}),a.jsx("span",{style:{fontSize:"var(--fs-xs)",padding:"0 5px",borderRadius:"var(--r-pill)",lineHeight:"15px",border:`1px solid ${zp[q.status]||"var(--line-strong)"}`,color:zp[q.status]||"var(--ink-1)",flex:"0 0 auto"},children:q.binary?"binary":Q1[q.status]||q.status}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",flex:"0 0 auto"},children:[a.jsxs("span",{style:{color:"var(--status-good)"},children:["+",q.additions]})," ",a.jsxs("span",{style:{color:"var(--status-critical)"},children:["−",q.deletions]})]})]},`${q.status}:${q.path}`))})]}),a.jsxs("section",{children:[a.jsx(Rn,{children:"Folder"}),y?a.jsx(Vc,{files:F,truncated:y.truncated,loading:y.loading,error:y.error,onRefresh:y.refresh,urlBase:v,summary:a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--ink-0)"},children:[F.length," file",F.length===1?"":"s"]})," as the folder stands · the run's work files included"]})},i):B.length===0?a.jsx(Fe,{children:"No screenshots or work files yet."}):a.jsx(Vc,{files:B,urlBase:v,initialDir:X1(B),summary:null},i)]}),D&&a.jsx(Qc,{artifact:D,url:D.kind==="diff"&&!D.binary?void 0:V1(v,D.path),previewUrl:void 0,onClose:()=>b(null),index:S,count:M.length,onStep:b})]})}const F1=[{value:"default",label:"Server default"},{value:"claude-code",label:"Claude Code",icon:"model"},{value:"anthropic-api",label:"Anthropic API",icon:"budget"},{value:"codex",label:"Codex",icon:"Bash"},{value:"openai-compatible",label:"Custom endpoint",icon:"WebFetch"}];function J1(i){const c=`pr-${Math.random().toString(16).slice(2,10)}`;switch(i){case"claude-code":return{kind:i};case"anthropic-api":return{kind:i,id:c,apiKeyEnv:""};case"codex":return{kind:i,id:c};case"openai-compatible":return{kind:i,id:c,baseUrl:""};default:return null}}function Tp(){return a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginTop:4},children:"Names an environment variable on the server. A stored key below takes precedence; leave both empty and this endpoint needs no credential."})}function Cp({providerId:i,hasKey:c,busy:u,error:o,onStore:d,onClear:h}){const[g,y]=m.useState(""),[x,v]=m.useState(!1);return!d||!i?null:a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[a.jsx("span",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)"},children:c?"A key is stored for this provider.":"No key stored."}),c&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"It cannot be shown — only replaced or removed."}),a.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",gap:"var(--sp-2)"},children:[a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>v(S=>!S),children:x?"Cancel":c?"Replace":"Add a key"}),c&&a.jsx(se,{size:"sm",variant:"danger",disabled:u,onClick:()=>h?.(i),children:"Remove"})]})]}),x&&a.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center"},children:[a.jsx(We,{mono:!0,type:"password",placeholder:"paste the key",value:g,onChange:y,autoFocus:!0,onKeyDown:S=>{S.key==="Enter"&&g.trim()&&(d(i,g.trim()),y(""),v(!1))}}),a.jsx(se,{size:"sm",variant:"good",disabled:u||!g.trim(),onClick:()=>{d(i,g.trim()),y(""),v(!1)},children:u?"Saving…":"Save key"})]}),o&&a.jsx(ot,{tone:"error",inline:!0,children:o})]})}function Zt({label:i,children:c}){return a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:i}),c]})}function I1({inst:i,selected:c,onClick:u}){const[o,d]=m.useState(!1);return a.jsxs("button",{type:"button",onClick:u,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:8,textAlign:"left",width:"100%",padding:"6px 8px",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",background:c?"var(--brand-wash-strong)":o?"var(--bg-hover)":"transparent",border:`1px solid ${c?"var(--brand)":"var(--line)"}`},children:[a.jsx(ie,{name:"model",size:13,color:c?"var(--brand)":"var(--ink-2)"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:i.configDir,children:rr(i.configDir)}),a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:i.origin}),i.hasStoredLogin&&a.jsx("span",{title:"Has a stored login",style:{width:6,height:6,borderRadius:"var(--r-pill)",background:"var(--status-good)",flex:"0 0 auto"}})]})}function P1({value:i,onChange:c,instances:u,ollama:o,hasKey:d,keyBusy:h,keyError:g,onStoreKey:y,onClearKey:x,style:v}){const[S,b]=m.useState(!1),j=i?.kind??"default",k=M=>c({...i,...M}),B=M=>c(J1(M)),K=j==="openai-compatible"&&o&&i.baseUrl===o.host;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)",...v},children:[a.jsx(dn,{size:"sm",value:j,onChange:B,tabs:F1}),j==="default"&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Runs on whatever the server itself authenticates as."}),j==="claude-code"&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[u?.length>0&&a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:u.map(M=>a.jsx(I1,{inst:M,selected:(i.configDir??"")===M.configDir,onClick:()=>k({configDir:M.configDir})},M.configDir))}),a.jsx(Zt,{label:"Config dir (blank inherits the server's own install)",children:a.jsx(We,{mono:!0,placeholder:"~/.claude-work",value:i.configDir??"",onChange:M=>k({configDir:M||void 0})})}),S?a.jsx(Zt,{label:"Executable (blank uses the SDK's bundled one)",children:a.jsx(We,{mono:!0,placeholder:"/usr/local/bin/claude",value:i.executable??"",onChange:M=>k({executable:M||void 0})})}):a.jsx("button",{type:"button",onClick:()=>b(!0),style:{alignSelf:"flex-start",background:"none",border:0,padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:"Pin an executable too"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(Mt,{checked:!!i.ownLogin,onChange:M=>k({ownLogin:M||void 0})}),a.jsx("span",{style:{fontSize:"var(--fs-sm)"},children:"Own login"})]}),a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Strips any inherited API key from this project's agents so this install's own stored subscription pays, instead of whatever the server process authenticates as."})]}),j==="anthropic-api"&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[a.jsx(Cp,{providerId:i.id,hasKey:d,busy:h,error:g,onStore:y,onClear:x}),a.jsx(Zt,{label:"Environment variable (optional fallback)",children:a.jsx(We,{mono:!0,placeholder:"ANTHROPIC_API_KEY_ALPHA",value:i.apiKeyEnv??"",onChange:M=>k({apiKeyEnv:M})})}),a.jsx(Tp,{}),a.jsx(Zt,{label:"Model (blank uses the provider's default)",children:a.jsx(We,{mono:!0,placeholder:"claude-sonnet-4-5",value:i.model??"",onChange:M=>k({model:M||void 0})})})]}),j==="codex"&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Reads the login `codex login` already stored — Foreman never mints its own token."}),a.jsx(Zt,{label:"Codex home (blank is ~/.codex)",children:a.jsx(We,{mono:!0,placeholder:"~/.codex",value:i.codexHome??"",onChange:M=>k({codexHome:M||void 0})})}),S?a.jsx(Zt,{label:"Upstream URL (blank is the public ChatGPT backend)",children:a.jsx(We,{mono:!0,placeholder:"https://chatgpt.com/backend-api/codex",value:i.upstreamUrl??"",onChange:M=>k({upstreamUrl:M||void 0})})}):a.jsx("button",{type:"button",onClick:()=>b(!0),style:{alignSelf:"flex-start",background:"none",border:0,padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:"Point at a different upstream"}),a.jsx(Zt,{label:"Model (blank uses Codex's own default)",children:a.jsx(We,{mono:!0,placeholder:"gpt-5-codex",value:i.model??"",onChange:M=>k({model:M||void 0})})})]}),j==="openai-compatible"&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[o&&a.jsxs("button",{type:"button",onClick:()=>k({baseUrl:o.host,label:"Ollama"}),style:{display:"flex",alignItems:"center",gap:8,textAlign:"left",width:"100%",padding:"6px 8px",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",background:K?"var(--brand-wash-strong)":"transparent",border:`1px solid ${K?"var(--brand)":"var(--line)"}`},children:[a.jsx(ie,{name:"Bash",size:13,color:K?"var(--brand)":"var(--ink-2)"}),a.jsx("span",{style:{fontSize:"var(--fs-sm)",flex:1},children:"Use local Ollama"}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[o.host," · ",o.models.length," model",o.models.length===1?"":"s"]})]}),a.jsx(Zt,{label:"Base URL",children:a.jsx(We,{mono:!0,placeholder:"http://127.0.0.1:11434",value:i.baseUrl??"",onChange:M=>k({baseUrl:M})})}),K&&o.models.length>0?a.jsx(Zt,{label:"Model (blank lets the run pick)",children:a.jsxs("select",{value:i.model??"",onChange:M=>k({model:M.target.value||void 0}),style:{font:"inherit",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",padding:"6px 8px",borderRadius:"var(--r-sm)",border:"1px solid var(--line-strong)",background:"var(--bg-card)",color:"var(--ink-0)"},children:[a.jsx("option",{value:"",children:"— server picks —"}),o.models.map(M=>a.jsxs("option",{value:M.id,children:[M.id,M.remote?" (cloud)":""]},M.id))]})}):a.jsx(Zt,{label:"Model (blank lets the run pick)",children:a.jsx(We,{mono:!0,placeholder:"llama3.1",value:i.model??"",onChange:M=>k({model:M||void 0})})}),a.jsx(Zt,{label:"Label (shown in place of the raw URL)",children:a.jsx(We,{placeholder:"OpenRouter",value:i.label??"",onChange:M=>k({label:M||void 0})})}),a.jsx(Zt,{label:"Environment variable (blank when the endpoint needs no key)",children:a.jsx(We,{mono:!0,placeholder:"OPENROUTER_API_KEY",value:i.apiKeyEnv??"",onChange:M=>k({apiKeyEnv:M||void 0})})}),!!i.apiKeyEnv&&a.jsx(Tp,{}),a.jsx(Cp,{providerId:i.id,hasKey:d,busy:h,error:g,onStore:y,onClear:x}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-sm)"},children:[a.jsx(Mt,{checked:i.needsKey===!0,onChange:M=>k({needsKey:M||void 0})}),"This endpoint requires a credential"]})]})]})}function eb({status:i,busy:c,error:u,onSaveToken:o,onClearToken:d,onLink:h,onUnlink:g,onTest:y,onSavePublicUrl:x,style:v}){const[S,b]=m.useState(""),[j,k]=m.useState(!1),[B,K]=m.useState(null),M=i?.telegram,z=!!M?.hasToken,D=!!M?.chatId,U=M?.linking,F=B??i?.publicUrl??"",re=B!==null&&B!==(i?.publicUrl??""),q=(N,Y,G)=>a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-3)",padding:"var(--sp-2) 0",borderTop:"1px solid var(--line)"},children:[a.jsxs("div",{style:{flex:"0 0 180px"},children:[a.jsx("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-0)"},children:N}),Y&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:Y})]}),a.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:6},children:G})]});return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",marginTop:"var(--sp-3)",...v},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)"},children:[a.jsx(ie,{name:"send",size:13,color:"var(--brand)"})," Telegram",a.jsxs("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontWeight:"var(--fw-normal)"},children:[D?`linked · ${M.chatLabel||M.chatId}`:z?"token stored · not linked":"not set up",i?.delivered?` · ${i.delivered} sent`:"",i?.failures?` · ${i.failures} failed`:""]})]}),a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh-prose)"},children:"Approvals, questions, stalls and finished missions arrive in a chat with your own bot, using the toggles above. Every ask still has its unattended default — this makes it less likely to be needed."}),u&&a.jsx(ot,{tone:"error",inline:!0,children:u}),q("Bot token",a.jsxs(a.Fragment,{children:["Create a bot with ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"@BotFather"})," and paste its token. Stored write-only; Foreman can replace it but never show it."]}),z&&!j?a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-sm)"},children:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:M?.bot||"token stored"}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>k(!0),disabled:c,children:"Replace"}),a.jsx(se,{size:"sm",variant:"ghost",onClick:d,disabled:c,children:"Remove"})]}):a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsx(We,{mono:!0,type:"password",width:320,placeholder:"123456789:AA…",value:S,onChange:b}),a.jsx(se,{size:"sm",variant:"primary",disabled:c||!S.trim(),onClick:()=>{o?.(S.trim()),b(""),k(!1)},children:c?"Checking…":"Save"}),z&&a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>k(!1),children:"Cancel"})]})),q("Linked chat","Send the one-time command to your bot from the chat that should receive messages. Only that chat is ever written to.",D?a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-sm)"},children:[a.jsx(ie,{name:"check",size:13,color:"var(--status-ok, var(--brand))"}),a.jsxs("span",{children:[M.chatLabel||"linked"," ",a.jsx("span",{style:{color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:M.chatId})]}),a.jsx(se,{size:"sm",variant:"ghost",onClick:y,disabled:c,children:"Send test"}),a.jsx(se,{size:"sm",variant:"ghost",onClick:g,disabled:c,children:"Unlink"})]}):U?a.jsxs("div",{style:{display:"flex",gap:"var(--sp-3)",alignItems:"flex-start"},children:[U.deepLink&&a.jsx("a",{href:U.deepLink,target:"_blank",rel:"noreferrer",title:"Open in Telegram",style:{flex:"0 0 auto",display:"block",padding:6,background:"#fff",borderRadius:"var(--r-sm)",border:"1px solid var(--line-strong)",lineHeight:0},children:a.jsx("img",{src:`/notify/telegram/qr.svg?c=${encodeURIComponent(U.code)}`,alt:`QR: ${U.deepLink}`,width:132,height:132,style:{display:"block"}})}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:"var(--fs-sm)",minWidth:0},children:[a.jsx("div",{children:"Scan with your phone, or send this to your bot:"}),a.jsxs("code",{style:{alignSelf:"flex-start",fontFamily:"var(--font-mono)",fontSize:"var(--fs-lg)",padding:"4px 10px",background:"var(--bg-inset)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)"},children:["/start ",U.code]}),U.deepLink&&a.jsx("a",{href:U.deepLink,target:"_blank",rel:"noreferrer",style:{fontSize:"var(--fs-xs)",color:"var(--brand)",textDecoration:"none"},children:"Open in Telegram on this computer →"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)",flexWrap:"wrap"},children:[a.jsx("span",{className:"pulse",style:{display:"inline-flex"},children:a.jsx(ie,{name:"loading",size:12})}),"waiting… the code expires in 10 minutes",a.jsx(se,{size:"sm",variant:"ghost",onClick:h,disabled:c,children:"New code"})]})]})]}):a.jsx("div",{children:a.jsx(se,{size:"sm",variant:"primary",onClick:h,disabled:c||!z,title:z?"Shows a one-time code to send to your bot":"Store a bot token first",children:"Link a chat"})})),q("Foreman URL","Where links in messages point. A phone cannot open localhost — use a LAN or Tailscale address if you have one.",a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[a.jsx(We,{mono:!0,width:320,value:F,onChange:K,placeholder:"http://localhost:4177"}),a.jsx(se,{size:"sm",disabled:c||!re,onClick:()=>{x?.(F),K(null)},children:"Save"})]}))]})}const Lc=[{id:"provider",label:"Provider",icon:"provider"},{id:"models",label:"Models",icon:"model"},{id:"budget",label:"Budget",icon:"budget"},{id:"approvals",label:"Approvals",icon:"approval"},{id:"appearance",label:"Appearance",icon:"sun"},{id:"notifications",label:"Notifications",icon:"needsYou"},{id:"projects",label:"Projects",icon:"folder"}],Wc={directorModel:"opus",workerModel:"sonnet",plannerModel:"sonnet",budgetCap:5,budgetWarnAt:80,budgetHardStop:!0,autoAllowReadOnly:!0,alwaysSurvivesResume:!0,toolPolicy:{Bash:"allow",Write:"allow",Edit:"allow",WebFetch:"allow",spawn_worker:"allow"},theme:"light",textSize:"default",density:"comfortable",showTimestamps:!0,notifyNeedsYou:!0,notifyDone:!0,notifyBudget:!0,sound:!1,gitBranchPerMission:!0,projectsRoot:"~/Projects",missionDir:".foreman",showHidden:!1},tb=[{value:"allow",label:"Allow"},{value:"ask",label:"Ask"},{value:"deny",label:"Deny"}],nb=["Bash","Write","Edit","WebFetch","spawn_worker"];function lb({instances:i=[],ollama:c,codex:u}){const o=[...i.map(d=>({icon:"orchestration",name:"Claude Code",detail:d.configDir,note:d.hasStoredLogin?"signed in":"no stored login"})),...c?[{icon:"model",name:"Ollama",detail:c.host,note:`${c.models.length} model${c.models.length===1?"":"s"}`}]:[],...u?[{icon:"provider",name:"Codex",detail:u.home,note:u.signedIn?"signed in":"not signed in"}]:[]];return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[a.jsxs("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",lineHeight:"var(--lh-prose)"},children:["A provider is chosen per project — open one and its tab appears beside",a.jsx("b",{style:{color:"var(--ink-0)"},children:" Global"})," above. These are what this machine can offer."]}),o.length===0&&a.jsx(Fe,{children:"Nothing detected. An Anthropic API key or any OpenAI-compatible endpoint still works."}),o.map((d,h)=>a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)"},children:[a.jsx(ie,{name:d.icon,size:14,color:"var(--ink-2)"}),a.jsx("span",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-medium)"},children:d.name}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.detail}),a.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:d.note})]},h))]})}function ab({global:i,project:c,projectName:u,models:o,modelsLoading:d,modelsNote:h,provider:g,providerInstances:y,providerOllama:x,providerCodex:v,providerHasKey:S,providerKeyBusy:b,providerKeyError:j,onStoreProviderKey:k,onClearProviderKey:B,notify:K,scope:M,onScope:z,section:D,onSection:U,onSave:F,onClose:re,onUnlink:q,style:N}){const[Y,G]=m.useState(M??"global"),[fe,Q]=m.useState(D??"models"),J=z?M:Y,ge=z??G,oe=U?D:fe,ne=U??Q,[E,$]=m.useState({...Wc,...i}),[P,me]=m.useState({...c}),[xe,T]=m.useState(g??null),_=JSON.stringify(xe)!==JSON.stringify(g??null),Z=JSON.stringify(E)!==JSON.stringify({...Wc,...i})||JSON.stringify(P)!==JSON.stringify({...c})||_,I=J==="project",ce=le=>I&&le in P?P[le]:E[le],ue=(le,Ne)=>I?me(Ge=>({...Ge,[le]:Ne})):$(Ge=>({...Ge,[le]:Ne})),be=le=>I&&le in P,Re=le=>me(Ne=>{const Ge={...Ne};return delete Ge[le],Ge}),ee=(le,Ne,Ge,bt)=>a.jsx(lr,{label:Ne,hint:Ge,overridden:be(le),inherits:I&&!be(le),onReset:()=>Re(le),children:bt}),te={models:a.jsxs(a.Fragment,{children:[ee("directorModel","Director","Plans, delegates, verifies. Opus by default; Fable for long-horizon work.",a.jsx(an,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:ce("directorModel"),onChange:(le,Ne)=>{ue("directorModel",le),ue("directorProviderId",Ne?.providerId)}})),ee("workerModel","Workers","Implement scoped tasks. Cheaper models cut cost sharply.",a.jsx(an,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:ce("workerModel"),onChange:(le,Ne)=>{ue("workerModel",le),ue("workerProviderId",Ne?.providerId)}})),ee("plannerModel","Planner","Talks the next mission through with you and reads the project. Conversation, not deep reasoning; Sonnet by default.",a.jsx(an,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:ce("plannerModel"),onChange:le=>ue("plannerModel",le)})),!I&&ee("fleetPlannerModel","Fleet planner","The front desk on your phone: knows every project, opens planning, proposes, steers. Fast tool calls matter more than depth; follows the planner when unset.",a.jsx(an,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:ce("fleetPlannerModel")||ce("plannerModel"),onChange:le=>ue("fleetPlannerModel",le)}))]}),budget:a.jsxs(a.Fragment,{children:[ee("budgetCap","Default cap per run","The composer starts here; you can change it per mission.",a.jsx(We,{type:"number",prefix:"$",min:0,step:1,width:110,value:ce("budgetCap"),onChange:le=>ue("budgetCap",le)})),ee("budgetWarnAt","Warn at","Meter turns amber and, if enabled, you get a notification.",a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[a.jsx(We,{type:"number",min:10,max:100,step:5,width:80,value:ce("budgetWarnAt"),onChange:le=>ue("budgetWarnAt",le)}),a.jsx("span",{style:{color:"var(--ink-2)"},children:"%"})]})),ee("budgetHardStop","Hard stop at cap","Off: the run pauses and asks instead of stopping.",a.jsx(Mt,{checked:ce("budgetHardStop"),onChange:le=>ue("budgetHardStop",le)}))]}),approvals:a.jsxs(a.Fragment,{children:[ee("autoAllowReadOnly","Auto-allow read-only tools","Read, Grep, Glob, LS never prompt.",a.jsx(Mt,{checked:ce("autoAllowReadOnly"),onChange:le=>ue("autoAllowReadOnly",le)})),ee("alwaysSurvivesResume","“Always (run)” survives resume","Grants made during a run carry into a resumed run.",a.jsx(Mt,{checked:ce("alwaysSurvivesResume"),onChange:le=>ue("alwaysSurvivesResume",le)})),a.jsx(lr,{label:"Guarded tools",hint:"Policy per tool. “Ask” escalates to an approval card; writes outside the project folder always ask.",overridden:be("toolPolicy"),inherits:I&&!be("toolPolicy"),onReset:()=>Re("toolPolicy"),stacked:!0,children:a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:nb.map(le=>a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(ie,{name:le,size:14,color:"var(--ink-2)"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",flex:1},children:le}),a.jsx(dn,{size:"sm",tabs:tb,value:ce("toolPolicy")[le]||"ask",onChange:Ne=>ue("toolPolicy",{...ce("toolPolicy"),[le]:Ne})})]},le))})})]}),appearance:a.jsxs(a.Fragment,{children:[ee("theme","Theme",null,a.jsx(dn,{size:"sm",value:ce("theme"),onChange:le=>ue("theme",le),tabs:[{value:"system",label:"System"},{value:"dark",label:"Dark",icon:"moon"},{value:"light",label:"Light",icon:"sun"}]})),ee("textSize","Text size","Scales the whole interface. Anything but Default overrides your browser’s own font size.",a.jsx(dn,{size:"sm",value:ce("textSize"),onChange:le=>ue("textSize",le),tabs:[{value:"small",label:"Small"},{value:"default",label:"Default"},{value:"large",label:"Large"},{value:"larger",label:"Larger"}]})),ee("density","Density","Compact tightens transcript rows and rail padding.",a.jsx(dn,{size:"sm",value:ce("density"),onChange:le=>ue("density",le),tabs:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}]})),ee("showTimestamps","Timestamps in transcript",null,a.jsx(Mt,{checked:ce("showTimestamps"),onChange:le=>ue("showTimestamps",le)}))]}),notifications:a.jsxs(a.Fragment,{children:[ee("notifyNeedsYou","Needs you","An approval or question is waiting.",a.jsx(Mt,{checked:ce("notifyNeedsYou"),onChange:le=>ue("notifyNeedsYou",le)})),ee("notifyDone","Run finished","Done, errored or interrupted.",a.jsx(Mt,{checked:ce("notifyDone"),onChange:le=>ue("notifyDone",le)})),ee("notifyBudget","Budget warning","When spend crosses the warn threshold.",a.jsx(Mt,{checked:ce("notifyBudget"),onChange:le=>ue("notifyBudget",le)})),ee("sound","Sound",null,a.jsx(Mt,{checked:ce("sound"),onChange:le=>ue("sound",le)})),!I&&K&&a.jsx(eb,{...K})]}),provider:I?a.jsx(lr,{label:"Provider",hint:"Which engine runs this project's agents, who pays, and where requests go. Clearing it returns to the server default.",stacked:!0,children:a.jsx(P1,{value:xe,onChange:T,instances:y,ollama:x,hasKey:S,keyBusy:b,keyError:j,onStoreKey:k,onClearKey:B})}):a.jsx(lb,{instances:y,ollama:x,codex:v}),projects:a.jsxs(a.Fragment,{children:[!I&&ee("projectsRoot","Projects root","Where the folder picker opens.",a.jsx(We,{mono:!0,width:260,value:ce("projectsRoot"),onChange:le=>ue("projectsRoot",le)})),ee("missionDir","Mission folder","Relative to the project. Holds MISSION.md and run history.",a.jsx(We,{mono:!0,width:160,value:ce("missionDir"),onChange:le=>ue("missionDir",le)})),ee("gitBranchPerMission","Each mission on its own branch","In a git repository: Foreman creates foreman/<mission> from what is checked out, commits the work on it at the end, and never merges or pushes. Off: missions edit the current branch.",a.jsx(Mt,{checked:ce("gitBranchPerMission")!==!1,onChange:le=>ue("gitBranchPerMission",le)})),!I&&ee("showHidden","Show hidden folders in picker",null,a.jsx(Mt,{checked:ce("showHidden"),onChange:le=>ue("showHidden",le)})),I&&a.jsx(lr,{label:"Unlink this project",hint:"Removes it from the fleet. Files on disk are untouched.",danger:!0,children:a.jsx(se,{variant:"danger",size:"sm",icon:"unlink",onClick:q,children:"Unlink"})})]})},we=Lc.find(le=>le.id===oe)||Lc[0];return a.jsxs(Ai,{width:"51.25rem",onClose:re,dismissible:!1,style:{maxHeight:"82vh",height:"37.5rem",...N},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)"},children:[a.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:"Settings"}),a.jsx(dn,{size:"sm",value:J,onChange:ge,tabs:[...u?[{value:"project",label:u,icon:"folder"}]:[],{value:"global",label:"Global"}]}),a.jsx(Ol,{icon:"close",label:"Close",onClick:re,style:{marginLeft:"auto"}})]}),a.jsxs("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:"11.25rem 1fr"},children:[a.jsx("nav",{style:{background:"var(--bg-inset)",borderRight:"1px solid var(--line)",padding:"var(--sp-2)",display:"flex",flexDirection:"column",gap:2},children:Lc.map(le=>a.jsx(rb,{s:le,selected:le.id===oe,dot:I&&(sb(le.id,P)||le.id==="provider"&&!!xe),onClick:()=>ne(le.id)},le.id))}),a.jsxs("div",{style:{minHeight:0,overflowY:"auto",padding:"var(--sp-3) var(--sp-5)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",marginBottom:"var(--sp-2)"},children:[a.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:we.label}),I&&a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Overrides for ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:u}),". Rows without a change inherit global."]})]}),te[we.id]]})]}),a.jsxs(Di,{children:[a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:Z?"var(--status-warning)":"var(--ink-2)"},children:Z?"Unsaved changes":"Nothing to save"}),a.jsxs("span",{style:{marginLeft:"auto",display:"flex",gap:"var(--sp-2)"},children:[a.jsx(se,{onClick:re,children:"Cancel"}),a.jsx(se,{variant:"primary",disabled:!Z,onClick:()=>F?.({global:E,project:P,provider:_?xe:void 0}),children:"Save"})]})]})]})}const ib={models:["directorModel","workerModel","plannerModel","fleetPlannerModel","directorProviderId","workerProviderId"],budget:["budgetCap","budgetWarnAt","budgetHardStop"],approvals:["autoAllowReadOnly","alwaysSurvivesResume","toolPolicy"],appearance:["theme","density","showTimestamps"],notifications:["notifyNeedsYou","notifyDone","notifyBudget","sound"],projects:["missionDir","gitBranchPerMission"]};function sb(i,c){return(ib[i]||[]).some(u=>u in c)}function rb({s:i,selected:c,dot:u,onClick:o}){const[d,h]=m.useState(!1);return a.jsxs("button",{type:"button",onClick:o,"aria-current":c||void 0,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:"var(--r-sm)",border:"none",textAlign:"left",cursor:"pointer",font:"inherit",color:c?"var(--ink-0)":"var(--ink-1)",fontWeight:c?"var(--fw-semibold)":"var(--fw-regular)",background:c?"var(--bg-card)":d?"var(--bg-hover)":"transparent",boxShadow:c?"inset 0 0 0 1px var(--line-strong)":"none"},children:[a.jsx(ie,{name:i.icon,size:14,color:c?"var(--brand)":"var(--ink-2)"}),a.jsx("span",{style:{flex:1},children:i.label}),u&&a.jsx("span",{title:"Has project overrides",style:{width:6,height:6,borderRadius:"var(--r-pill)",background:"var(--brand)"}})]})}function lr({label:i,hint:c,children:u,overridden:o,inherits:d,onReset:h,stacked:g,danger:y}){return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:g?"1fr":"1fr auto",gap:g?10:"var(--sp-4)",alignItems:"center",padding:"var(--sp-3) 0",borderBottom:"1px solid var(--line)"},children:[a.jsxs("div",{style:{minWidth:0},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:y?"var(--status-critical)":"var(--ink-0)"},children:[a.jsx("span",{children:i}),d&&a.jsx(Mp,{children:"global"}),o&&a.jsxs(a.Fragment,{children:[a.jsx(Mp,{brand:!0,children:"override"}),a.jsx("button",{type:"button",onClick:h,style:{background:"none",border:0,padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:"reset to global"})]})]}),c&&a.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginTop:2},children:c})]}),a.jsx("div",{style:{display:"flex",justifyContent:g?"stretch":"flex-end",minWidth:0},children:u})]})}function Mp({children:i,brand:c}){return a.jsx("span",{style:{fontSize:"var(--fs-xs)",letterSpacing:"0.06em",textTransform:"uppercase",padding:"1px 6px",borderRadius:"var(--r-pill)",background:c?"var(--brand-wash-strong)":"var(--bg-inset)",color:c?"var(--brand)":"var(--ink-2)",border:`1px solid ${c?"transparent":"var(--line)"}`},children:i})}function Ep({agent:i,status:c="running",task:u,selected:o,indent:d,last:h,onSelect:g,style:y}){const[x,v]=m.useState(!1);return a.jsxs("div",{style:{position:"relative",marginLeft:d?14:0},children:[d&&a.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:-8,top:0,bottom:h?"50%":0,borderLeft:"1px solid var(--line-strong)"}}),d&&a.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:-8,top:"50%",width:8,borderTop:"1px solid var(--line-strong)"}}),a.jsxs("div",{role:"button",title:u,onClick:()=>g?.(i),onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"6px 8px",borderRadius:"var(--r-sm)",cursor:"pointer",background:o?"var(--bg-card)":x?"var(--bg-hover)":"transparent",border:o?"1px solid var(--line-strong)":"1px solid transparent",transition:"background var(--dur-fast) var(--ease)",...y},children:[a.jsx(fn,{agent:i}),a.jsx("span",{style:{flex:1,minWidth:0,fontSize:"var(--fs-md)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),a.jsx(fl,{status:c})]})]})}function ob({agents:i=[],filter:c,onFilter:u,sessionId:o,details:d,style:h}){const g=i.find(v=>v.id==="director"),y=i.filter(v=>v.id!=="director"),x={margin:"0 0 6px 0",fontSize:"var(--fs-xs)",color:"var(--ink-1)",lineHeight:"var(--lh)",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)",...h},children:[a.jsxs("section",{style:{minWidth:0},children:[a.jsx(Rn,{children:"Crew"}),i.length===0&&a.jsx(Fe,{children:"No agents yet."}),g&&a.jsx(Ep,{agent:"director",status:g.status,selected:c==="director",onSelect:u}),y.map((v,S)=>a.jsxs(On.Fragment,{children:[a.jsx(Ep,{agent:v.id,status:v.status,task:v.task,indent:!0,last:S===y.length-1,selected:c===v.id,onSelect:u}),v.task&&a.jsx("div",{title:v.task,style:{...x,marginLeft:34},children:v.task})]},v.id)),c&&a.jsxs("div",{style:{marginTop:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Transcript shows only ",a.jsx("b",{style:{color:"var(--ink-1)"},children:c})," — click again to clear."]})]}),a.jsxs("section",{style:{minWidth:0},children:[a.jsx(Rn,{children:"Run"}),d??a.jsx(Fe,{children:"No run details."}),o&&a.jsxs("div",{style:{marginTop:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:["director session ",String(o).slice(0,8)]})]})]})}function cb({director:i,worker:c,models:u,loading:o,note:d,busy:h,onResume:g,style:y}){const[x,v]=m.useState(!1),[S,b]=m.useState({id:i||"",providerId:void 0}),[j,k]=m.useState({id:c||"",providerId:void 0}),B=m.useRef(null);m.useEffect(()=>{b({id:i||"",providerId:void 0}),k({id:c||"",providerId:void 0})},[i,c,x]),m.useEffect(()=>{if(!x)return;const D=F=>{B.current&&!B.current.contains(F.target)&&v(!1)},U=F=>{F.key==="Escape"&&v(!1)};return document.addEventListener("mousedown",D),document.addEventListener("keydown",U),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",U)}},[x]);const K=S.id&&S.id!==i||j.id&&j.id!==c,M=()=>{g?.({...S.id&&S.id!==i?{directorModel:S.id,directorProviderId:S.providerId}:{},...j.id&&j.id!==c?{workerModel:j.id,workerProviderId:j.providerId}:{}}),v(!1)},z={fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)",marginBottom:4};return a.jsxs("div",{ref:B,style:{position:"relative",display:"inline-flex",...y},children:[a.jsx(se,{variant:"good",icon:"resume",disabled:h,title:"Restore the director's session and continue this mission",onClick:()=>g?.({}),style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:h?"Resuming…":"Resume"}),a.jsx(se,{variant:"good",disabled:h,"aria-label":"Resume on other models",title:"Resume on other models…",onClick:()=>v(!x),style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid rgba(255,255,255,0.35)",paddingLeft:6,paddingRight:6},children:a.jsx(ie,{name:"chevronDown",size:14})}),x&&a.jsxs("div",{role:"dialog","aria-label":"Resume on other models",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:50,width:340,background:"var(--bg-card)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",boxShadow:"0 12px 32px rgba(0,0,0,0.25)",padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[a.jsx("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",lineHeight:"var(--lh)"},children:"Same mission, other models. A new director starts a fresh session and reads the mission doc; workers change for the next spawns."}),a.jsxs("div",{children:[a.jsx("div",{style:z,children:"Director"}),a.jsx(an,{block:!0,allowDefault:!1,models:u,loading:o,note:d,value:S.id,onChange:(D,U)=>b({id:D,providerId:U?.providerId})})]}),a.jsxs("div",{children:[a.jsx("div",{style:z,children:"Workers"}),a.jsx(an,{block:!0,allowDefault:!1,models:u,loading:o,note:d,value:j.id,onChange:(D,U)=>k({id:D,providerId:U?.providerId})})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"var(--sp-2)"},children:[a.jsx(se,{variant:"ghost",size:"sm",onClick:()=>v(!1),children:"Cancel"}),a.jsx(se,{variant:"good",size:"sm",icon:"resume",disabled:h||!K,onClick:M,title:K?"Resume with these models":"Pick a different model first — or use Resume as is",children:"Resume"})]})]})]})}function ub(i,c){const u=Up(i.provider);return!i.provider||!u?c:i.provider.kind==="claude-code"?i.provider.ownLogin?`${u} (this project's own login)`:u:`${i.provider.kind} · ${u}`}function db(i){const c=`(min-width: ${i}px)`,[u,o]=m.useState(()=>typeof window<"u"&&window.matchMedia(c).matches);return m.useEffect(()=>{const d=window.matchMedia(c),h=()=>o(d.matches);return h(),d.addEventListener("change",h),()=>d.removeEventListener("change",h)},[c]),u}const fb=1100;function hb(i){const c=i.agents.filter(y=>y.status==="running"),u=c.filter(y=>y.id!=="director").length,o=c.length===0?"":[c.some(y=>y.id==="director")?"director":null,u?`${u} worker${u===1?"":"s"}`:null].filter(Boolean).join(" · ");let d=null;for(let y=i.entries.length-1;y>=0&&y>=i.entries.length-40;y--){const x=i.entries[y],v=x.kind==="system"&&x.title.startsWith("progress"),S=x.kind==="text"&&x.agent==="director";if(v||S){d=x;break}}if(!d){const y=c.find(x=>x.id!=="director"&&x.task);return y?{line:`${y.id}: ${y.task}`,agent:y.id,crew:o}:o?{line:"Crew is starting up",crew:o}:null}const h=d.body.split(`
66
- `).find(y=>y.trim())??"";return{line:`${d.agent}: ${h.replace(/[*_`#>]/g,"").trim().slice(0,160)}`,agent:d.agent,crew:o}}function Ta({label:i,open:c,onToggle:u,children:o}){return a.jsxs("div",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-sm)",background:"var(--bg-panel)"},children:[a.jsxs("button",{type:"button",onClick:u,style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"6px 10px",background:"none",border:"none",cursor:"pointer",font:"inherit",textAlign:"left",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:[a.jsx(ie,{name:c?"chevronDown":"chevronRight",size:12}),i]}),c&&a.jsx("div",{style:{padding:"0 10px 10px"},children:o})]})}const sv={width:"100%",maxWidth:"var(--spine-max)",margin:"0 auto",display:"flex",flexDirection:"column",gap:"var(--sp-2)",boxSizing:"border-box"},_p="foreman.transcriptOrder",Ap="foreman.timeline",ar=i=>new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"}),Dp="foreman.railWidth",$c=280,Rp=340;function pb(){const[i,c]=m.useState(()=>{try{return localStorage.getItem(_p)==="oldest"?"oldest":"newest"}catch{return"newest"}});return[i,u=>{c(u);try{localStorage.setItem(_p,u)}catch{}}]}function Op(i,c){return c==="newest"?0:i.scrollHeight}function vb({run:i,filter:c,jump:u,order:o,header:d}){const h=m.useRef(null),g=m.useRef(!0),[y,x]=m.useState(null),v=c?i.entries.filter(b=>b.agent===c):i.entries,S=o==="newest"?[...v].reverse():v;return m.useEffect(()=>{const b=h.current;b&&g.current&&(b.scrollTop=Op(b,o))},[S.length,o]),m.useEffect(()=>{g.current=!0;const b=h.current;b&&(b.scrollTop=Op(b,o))},[o]),m.useEffect(()=>{if(!u)return;g.current=!1;const b=requestAnimationFrame(()=>{document.getElementById(`entry-${u.id}`)?.scrollIntoView({behavior:"smooth",block:"center"}),x(u.id)}),j=setTimeout(()=>x(null),1600);return()=>{cancelAnimationFrame(b),clearTimeout(j)}},[u]),a.jsx("div",{ref:h,onScroll:b=>{const j=b.currentTarget;g.current=o==="newest"?j.scrollTop<60:j.scrollHeight-j.scrollTop-j.clientHeight<60},style:{overflowY:"auto",padding:"var(--sp-3)",minHeight:0,flex:1,display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:a.jsxs("div",{style:sv,children:[d,S.length===0&&a.jsx(Fe,{children:"Transcript will appear here."}),S.map(b=>a.jsx("div",{id:`entry-${b.id}`,style:{scrollMarginTop:8,borderRadius:"var(--r-sm)",outline:y===b.id?"2px solid var(--brand)":"none",transition:"outline-color var(--dur-fast) var(--ease)"},children:a.jsx(Ic,{agent:b.agent,title:b.title,dense:!0,kind:b.kind,body:b.body,ts:b.ts,to:b.to,timing:b.timing})},b.id))]})})}function gb(i){const[c,u]=m.useState({text:"",loaded:!1});return m.useEffect(()=>{let o=!1;const d=()=>_e.memory(i).then(async g=>{if(o||!g.ok)return;const y=await g.json();u({text:y.text??"",updatedAt:y.updatedAt,loaded:!0})}).catch(()=>{});d();const h=Ei((g,y)=>{g==="memory_updated"&&y.projectId===i&&d()});return()=>{o=!0,h()}},[i]),c}function mb({memory:i}){const c=i.updatedAt?new Date(i.updatedAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null;return a.jsxs("section",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:["Memory",c&&a.jsx("span",{style:{textTransform:"none",letterSpacing:0,marginLeft:"auto"},children:c})]}),i.loaded&&!i.text.trim()?a.jsxs(Fe,{children:["Nothing yet. The director writes ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:".foreman/MEMORY.md"})," at the end of a mission: how to run and test the project, ports and paths, conventions, traps. Every later crew and the planner read it first."]}):i.text.trim()?a.jsx("div",{title:"The project's notes for the next crew — .foreman/MEMORY.md. Edit it with any editor.",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",fontSize:"var(--fs-sm)",maxHeight:"40vh",overflowY:"auto"},children:a.jsx(_i,{text:i.text})}):null]})}function yb({runId:i,onClose:c,onDone:u}){const[o,d]=m.useState(null),[h,g]=m.useState(""),[y,x]=m.useState(""),[v,S]=m.useState(""),[b,j]=m.useState(!1),[k,B]=m.useState(null);m.useEffect(()=>{let z=!1;return _e.prDraft(i).then(async D=>{const U=await D.json().catch(()=>({}));if(!z){if(!D.ok){g(U.error??`HTTP ${D.status}`);return}d(U),x(U.title),S(U.body)}}).catch(()=>{z||g("Could not reach the server.")}),()=>{z=!0}},[i]);const K=async()=>{j(!0),g("");try{const z=await _e.openPr(i,y,v),D=await z.json().catch(()=>({}));if(!z.ok){g(D.error??`HTTP ${z.status}`);return}B(D),u(D.url)}finally{j(!1)}},M=o?.gh.present&&o.gh.authed&&/github\.com/.test(o.remote);return a.jsxs(Ai,{width:640,onClose:b?void 0:c,children:[a.jsxs("div",{style:{padding:"var(--sp-3)",borderBottom:"1px solid var(--line)",display:"flex",flexDirection:"column",gap:4},children:[a.jsx("span",{style:{fontWeight:"var(--fw-semibold)"},children:"Open a pull request"}),o&&a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:[o.branch," → ",o.base,o.commits!==null?` · ${o.commits} commit${o.commits===1?"":"s"}`:""," · ",o.remote]})]}),a.jsxs("div",{style:{padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",overflowY:"auto",minHeight:0},children:[!o&&!h&&a.jsx(Fe,{children:"Reading the branch…"}),o&&!k&&a.jsxs(a.Fragment,{children:[o.pr&&a.jsxs(ot,{tone:"readonly",inline:!0,children:["A pull request already exists for this branch: ",a.jsx("a",{href:o.pr,target:"_blank",rel:"noopener noreferrer",children:o.pr})]}),!o.onBranch&&a.jsxs(ot,{tone:"caution",inline:!0,children:["The folder is currently on another branch. The push sends ",o.branch," as it is in git, which is fine; just know what you are looking at locally."]}),o.dirty&&o.onBranch&&a.jsx(ot,{tone:"caution",inline:!0,children:"There are uncommitted changes in the folder. They are not part of this pull request."}),a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Title",a.jsx(We,{value:y,onChange:x})]}),a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Body",a.jsx(tv,{size:"mission",value:v,onChange:S})]}),a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Create pushes ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o.branch})," to origin as you, with your own git credentials",M?a.jsxs(a.Fragment,{children:[", then opens the pull request with ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"gh"}),"."]}):a.jsxs(a.Fragment,{children:[", then gives you the link to finish the pull request in the browser",o.gh.present?"":" (gh is not installed)","."]})," ","Nothing is merged."]})]}),k&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[a.jsx("span",{children:k.method==="gh"?"Pull request opened.":"Branch pushed. Finish the pull request in the browser:"}),k.url&&a.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--font-mono)",wordBreak:"break-all"},children:k.url}),k.note&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:k.note})]}),h&&a.jsx(ot,{tone:"error",inline:!0,children:h})]}),a.jsxs(Di,{children:[a.jsx("span",{style:{flex:1}}),a.jsx(se,{onClick:c,disabled:b,children:k?"Close":"Cancel"}),o&&!k&&a.jsx(se,{variant:"primary",disabled:b||!y.trim(),onClick:()=>{K()},children:b?"Pushing…":M?"Push & create pull request":"Push & get the link"})]})]})}function xb({chat:i,folder:c,starting:u,error:o,models:d,modelsLoading:h,modelsNote:g,modelsInheritNote:y,onStart:x,onCompose:v,hasRuns:S,projectId:b,onSettings:j,recent:k=[],runsOn:B,onOpenRun:K,onForkRun:M,forking:z=!1}){const[D,U]=m.useState(""),[F,re]=m.useState(""),[q,N]=m.useState(0),[Y,G]=m.useState(!1),fe=ne=>{re(ne),N(E=>E+1)},Q=async(ne,E=[])=>{U("");try{await i.send(await Yp(b,ne,E))}catch($){U($.message)}},J=m.useRef(null),ge=m.useRef(!0);return m.useEffect(()=>{const ne=J.current;ne&&ge.current&&(ne.scrollTop=ne.scrollHeight)},[i.entries.length,i.proposal,i.thinking]),i.entries.length===0&&!i.thinking&&!i.question&&!i.proposal?a.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:a.jsxs("div",{style:{margin:"auto",width:"100%",maxWidth:"var(--composer-max)",padding:"var(--sp-4) var(--sp-3)",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[a.jsxs("div",{style:{textAlign:"center",display:"flex",flexDirection:"column",gap:"var(--sp-1)"},children:[a.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:k.length?"Pick up where you left off, or start something new":"What should this project do next?"}),a.jsx("span",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:k.length?"Open a run to see what it built, plan the next step from it, or describe something new below.":"Describe it, paste a spec or a screenshot, or pick a starter and edit it before sending."})]}),k.length>0&&a.jsxs("div",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-md)",background:"var(--bg-card)",overflow:"hidden"},children:[(Y?k:k.slice(0,4)).map((ne,E)=>{const $=ne.status!=="running",P=new Date(ne.createdAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"center",gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",borderTop:E>0?"1px solid var(--line)":"none"},children:[a.jsxs("button",{type:"button",onClick:()=>K?.(ne.id),title:"Open this run",style:{minWidth:0,textAlign:"left",background:"none",border:0,padding:0,font:"inherit",color:"inherit",cursor:"pointer",display:"flex",flexDirection:"column",gap:2},children:[a.jsx("span",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ne.title||ne.mission.split(`
67
- `)[0]}),a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",display:"inline-flex",alignItems:"center",gap:"var(--sp-2)",fontVariantNumeric:"tabular-nums"},children:[a.jsx(fl,{status:ne.status}),a.jsx("span",{children:P}),dl(ne)==="priced"&&a.jsxs("span",{children:["$",ne.costUsd.toFixed(2)]})]})]}),a.jsxs("span",{style:{display:"inline-flex",gap:"var(--sp-1)",flex:"0 0 auto"},children:[a.jsx(se,{variant:"ghost",size:"sm",onClick:()=>K?.(ne.id),children:"Open"}),$&&a.jsx(se,{size:"sm",icon:"steer",disabled:z||i.thinking,title:"Start a planning conversation seeded with what this run built",onClick:()=>M?.(ne.id),children:"Plan the next step"})]})]},ne.id)}),k.length>4&&a.jsx("div",{style:{borderTop:"1px solid var(--line)",padding:"4px var(--sp-2)"},children:a.jsx(se,{variant:"ghost",size:"sm",onClick:()=>G(ne=>!ne),children:Y?"Show the latest four":`Show all ${k.length} runs`})})]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(${k.length?150:200}px, 1fr))`,gap:"var(--sp-2)"},children:[...k.length?[]:[{t:"Survey the project",q:"Read this project and tell me what it is, how it is built, and what state it is in."}],{t:"Find risks worth a mission",q:"Audit this project for bugs, security holes and missing tests. Rank what you find and propose the one mission most worth running first."},{t:"Scope a feature",q:"I have a feature in mind. Ask me what you need to know to scope it, then draft the mission."},{t:"Plan a refactor",q:"Where is this codebase hardest to change? Propose one contained refactor with clear DONE WHEN criteria."}].map(ne=>a.jsxs("button",{type:"button",onClick:()=>fe(ne.q),disabled:i.thinking,title:k.length?ne.q:void 0,style:{textAlign:"left",padding:k.length?"6px 10px":"8px 10px",background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",color:"inherit",display:"flex",flexDirection:"column",gap:2},children:[a.jsx("span",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)"},children:ne.t}),!k.length&&a.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:ne.q})]},ne.t))}),a.jsx(Xc,{value:F,onChange:re,busy:i.thinking,who:i.who,onSend:(ne,E)=>{Q(ne,E)},onStop:()=>{i.stop()},onChangeModel:j,autoFocus:!0},q),D&&a.jsx(ot,{tone:"error",inline:!0,children:D}),a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",textAlign:"center"},children:["Planning reads the project and never changes it — a mission does that. Know what you want already? ",a.jsx("b",{style:{color:"var(--ink-1)"},children:"New mission"}),", top right."]}),B&&a.jsx("div",{style:{display:"flex",justifyContent:"center"},children:B})]})}):a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:J,onScroll:ne=>{const E=ne.currentTarget;ge.current=E.scrollHeight-E.scrollTop-E.clientHeight<60},style:{flex:1,minHeight:0,overflowY:"auto",padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:a.jsxs("div",{style:sv,children:[i.entries.map((ne,E)=>{const $=ar(ne.ts),P=E>0?ar(i.entries[E-1].ts):null;return a.jsxs(On.Fragment,{children:[$!==P&&(E>0||$!==ar(Date.now()))&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",margin:"4px 0"},children:[a.jsx("span",{style:{flex:1,borderTop:"1px solid var(--line)"}}),a.jsx("span",{children:$===ar(Date.now())?"today":$}),a.jsx("span",{style:{flex:1,borderTop:"1px solid var(--line)"}})]}),a.jsx(Ic,{agent:ne.agent,title:ne.title,kind:ne.kind,body:ne.body,ts:ne.ts})]},ne.id)}),i.proposal&&a.jsx(M1,{mission:i.proposal.mission,doneWhen:i.proposal.doneWhen,budgetUsd:i.proposal.budgetUsd,rationale:i.proposal.rationale,browser:i.proposal.browser,directorModel:i.proposal.directorModel,workerModel:i.proposal.workerModel,directorProviderId:i.proposal.directorProviderId,workerProviderId:i.proposal.workerProviderId,modelRationale:i.proposal.modelRationale,models:d,modelsLoading:h,modelsNote:g,modelsInheritNote:y,busy:u,error:o,onStart:ne=>x(ne),onDismiss:i.dismissProposal})]})}),a.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3) var(--sp-3)",flex:"0 0 auto",width:"100%",maxWidth:"var(--spine-max)",margin:"0 auto",boxSizing:"border-box"},children:[i.question?a.jsx(C1,{questions:i.question.questions,askedAt:i.question.askedAt,who:i.who,onAnswer:ne=>{i.answer(i.question.id,ne)},onFreeText:ne=>{Q(ne)}}):a.jsx(Xc,{busy:i.thinking,who:i.who,onSend:(ne,E)=>{Q(ne,E)},onStop:()=>{i.stop()},onChangeModel:j}),D&&a.jsx(ot,{tone:"error",inline:!0,style:{marginTop:4},children:D}),(i.costUsd>0||i.entries.length>0)&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"4px 2px 0",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[i.costUsd>0&&a.jsxs("span",{title:"What this conversation has cost so far. Planning is not charged to any mission budget.",style:{fontVariantNumeric:"tabular-nums"},children:["conversation $",i.costUsd.toFixed(3)]}),a.jsx("span",{style:{flex:1}}),i.thinking&&a.jsx(se,{variant:"ghost",size:"sm",icon:"close",title:"Stop the planner and discard the rest of this reply",onClick:()=>{i.stop()},children:"Stop"}),i.entries.length>0&&a.jsx(se,{variant:"ghost",size:"sm",icon:"close",disabled:i.thinking,title:i.thinking?"The planner is replying — clear once it has answered.":"Forget this conversation and start a new one",onClick:()=>{i.clear()},children:i.thinking?"Clear (after this reply)":"Clear conversation"})]})]}),a.jsxs("button",{type:"button",onClick:v,style:{flex:"0 0 auto",display:"flex",alignItems:"center",gap:6,margin:"0 auto var(--sp-3)",padding:"6px 10px",width:"calc(100% - 2 * var(--sp-3))",maxWidth:"calc(var(--spine-max) - 2 * var(--sp-3))",boxSizing:"border-box",background:"none",border:"1px dashed var(--line-strong)",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textAlign:"left"},children:[a.jsx(ie,{name:"write",size:12}),"Or skip the talk: describe the mission and start it",a.jsx(ie,{name:"chevronRight",size:12,style:{marginLeft:"auto"}})]})]})}function bb({r:i,live:c,liveCost:u,liveBasis:o,liveUsage:d,liveTurns:h,onChanged:g}){const[y,x]=m.useState(!1),[v,S]=m.useState(""),b=!!c&&i.status==="running",j=async D=>{x(!0),S("");try{await _e.updateRun(i.id,D),g?.()}catch(U){S(U instanceof Error?U.message:String(U))}finally{x(!1)}},k=o??dl(i),B=d??i.usage??null,K=h??i.turns,M=[["director",i.directorModel||"default"],["workers",i.workerModel||"default"],["budget",k==="priced"?`$${((u??i.costUsd)||0).toFixed(2)} / $${i.budgetUsd.toFixed(2)}`:`${Nl(B?.inputTokens??0)} in · ${Nl(B?.outputTokens??0)} out${typeof K=="number"?` · ${K} turn${K===1?"":"s"}`:""}`+(k==="unpriced"?" · cost not tracked":" · no per-token cost")]],z={color:"var(--ink-1)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};return a.jsxs("div",{style:{marginTop:8,fontSize:"var(--fs-xs)"},children:[a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:10,rowGap:2},children:[M.map(([D,U])=>a.jsxs(On.Fragment,{children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:D}),a.jsx("span",{style:z,children:U})]},D)),a.jsx("span",{style:{color:"var(--ink-2)"},children:"browser"}),b?a.jsx("button",{type:"button",disabled:y,onClick:()=>{j({browserTools:!i.browserTools})},title:i.browserTools?"Turn off. No worker spawned after this gets a browser.":"Turn on. Workers spawned after this get a headless browser; the director itself gains it when the run is resumed.",style:{...z,justifySelf:"start",background:"none",padding:0,border:"none",borderBottom:"1px dashed var(--line-strong)",cursor:y?"wait":"pointer",font:"inherit",fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:i.browserTools?"on":"off"}):a.jsx("span",{style:z,children:i.browserTools?"on":"off"}),i.resumes?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--ink-2)"},children:"resumes"}),a.jsx("span",{style:z,children:i.resumes})]}):null]}),v&&a.jsx("div",{style:{marginTop:4,color:"var(--status-critical)"},children:v})]})}function jb({p:i,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,routeRunId:h,onSelectRun:g,routeTab:y,onSelectTab:x,onBack:v,refreshFleet:S,auth:b,theme:j,onToggleTheme:k,onSettings:B,settings:K,search:M}){const z=Nm(i.id),D=gb(i.id),U={...Wc,...K.global,...K.project??{}},F=Object.keys(K.project??{}),re=U.gitBranchPerMission!==!1,q=a.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap",justifyContent:"center"},children:[a.jsx("span",{children:"missions here run on"}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:[String(U.directorModel??"opus")," · ",String(U.workerModel??"sonnet")]}),a.jsx("span",{children:"· cap"}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:["$",String(U.budgetCap??6)]}),i.git?.repo&&a.jsxs("span",{children:["· ",re?"each on its own branch":`on ${i.git.branch} directly`]}),F.length>0&&a.jsxs("span",{children:["· ",F.length," project override",F.length===1?"":"s"]}),a.jsx(se,{variant:"ghost",size:"sm",icon:"settings",onClick:B,children:"Change…"})]}),N=i.activeRun?.id??null,Y=h,G=g;m.useEffect(()=>{N&&g(N)},[N]);const fe=Y!==null&&Y===N,Q=Dm(Y,fe),J=z.find(ae=>ae.id===Y),ge=fe&&Q.runStatus==="running",[oe,ne]=m.useState(null),[E,$]=m.useState(null),P=y,me=x,[xe,T]=m.useState(()=>{try{const ae=Number(localStorage.getItem(Dp));return ae>=$c?ae:Rp}catch{return Rp}}),_=ae=>{const Je=Math.max($c,Math.floor(window.innerWidth*.5)),en=Math.min(Je,Math.max($c,Math.round(ae)));T(en);try{localStorage.setItem(Dp,String(en))}catch{}},Z=ae=>{ae.preventDefault();const Je=ae.clientX,en=xe,gl=Oa=>_(en+(Je-Oa.clientX)),Ln=()=>{window.removeEventListener("pointermove",gl),window.removeEventListener("pointerup",Ln),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",gl),window.addEventListener("pointerup",Ln)},I=ae=>{typeof ae.id=="number"&&(oe&&oe!==ae.agent&&ne(null),$({id:ae.id,n:Date.now()}))},ce=ae=>ne(oe===ae?null:ae),[ue,be]=m.useState(!1),[Re,ee]=pb(),[te,we]=m.useState(()=>{try{return localStorage.getItem(Ap)!=="closed"}catch{return!0}}),le=ae=>{we(ae);try{localStorage.setItem(Ap,ae?"open":"closed")}catch{}},[Ne,Ge]=m.useState(!1),[bt,hl]=m.useState(!1),[sn,Hl]=m.useState(!1),[Nn,Ul]=m.useState(!1),[Bl,ql]=m.useState(""),[Ca,mt]=m.useState(!1),[or,Ma]=m.useState(!1),[Ea,Ll]=m.useState(!1),[hn,pl]=m.useState(null),Ri=J?.git?.pr;m.useEffect(()=>{if(!Y||!Ri){pl(null);return}if(J?.git?.prState){pl({runId:Y,state:J.git.prState});return}let ae=!1;return _e.prState(Y).then(async Je=>{const en=Je.ok?await Je.json():{state:null};ae||pl({runId:Y,state:en.state})}).catch(()=>{ae||pl({runId:Y,state:null})}),()=>{ae=!0}},[Y,Ri,J?.git?.prState]);const Oi=async ae=>{ql(""),mt(!0);try{const Je=await _e.forkPlan(i.id,ae);if(!Je.ok){ql((await Je.json()).error);return}G(null)}finally{mt(!1)}},[Hn,ct]=m.useState(""),[Ft,ut]=m.useState(!1),cr=$p(N?null:i.id),[Ni,_a]=m.useState(!1),Ht=db(fb),Ut=u1(Y,ge),Jt=d1(i.id,Y),It=Q.approvals.length+Q.questions.length,[Un,Bn]=m.useState(()=>Date.now());m.useEffect(()=>{if(It===0&&!ge)return;Bn(Date.now());const ae=setInterval(()=>Bn(Date.now()),1e4);return()=>clearInterval(ae)},[It,ge]),m.useEffect(()=>{ne(null)},[Y]);const ur=m.useMemo(()=>ge?hb(Q):null,[ge,Q]),Hi=m.useMemo(()=>lv(Q.missionDoc),[Q.missionDoc]),Aa=async(ae={})=>{if(!Y)return;ql(""),be(!0);const Je=await _e.resume(Y,ae).finally(()=>be(!1));Je.ok?S():ql((await Je.json()).error)},qn=async ae=>{ct(""),ut(!0);let Je=ae.mission;try{Je=await Yp(i.id,ae.mission,ae.attachments??[])}catch(gl){ct(gl.message),ut(!1);return}const en=await _e.run(i.id,Je,ae.budget,{directorModel:ae.directorModel,workerModel:ae.workerModel,directorProviderId:ae.directorProviderId,workerProviderId:ae.workerProviderId,browserTools:ae.browserTools}).finally(()=>ut(!1));en.ok?S():ct((await en.json()).error)},dr=!N&&Y===null,Ui=!N&&Y&&(J?.status==="interrupted"||J?.status==="error")&&J?.directorSessionId,Bi=Ht&&J&&(J.directorModel||J.workerModel)?a.jsxs("span",{title:`director: ${J.directorModel||"default"} · workers: ${J.workerModel||"default"}`,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:"var(--r-pill)",border:"1px solid var(--line)",background:"var(--bg-inset)",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",color:"var(--ink-1)",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[a.jsx(ie,{name:"model",size:11}),J.directorModel||"default"," · ",J.workerModel||"default"]}):null,qi=J&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[a.jsx("div",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",lineHeight:"var(--lh)"},title:J.mission,children:J.title||J.mission.split(`
68
- `).find(ae=>ae.trim())||"Untitled run"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",flexWrap:"wrap"},children:[a.jsx("span",{children:new Date(J.createdAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),a.jsx(fl,{status:fe?Q.runStatus:J.status}),!fe&&a.jsx("span",{children:"read-only"})]})]}),vl=a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[z.length===0&&a.jsx(Fe,{children:"No runs yet."}),z.map(ae=>a.jsx(O1,{mission:ae.mission,title:ae.title,createdAt:ae.createdAt,costUsd:ae.costUsd,costBasis:dl(ae),usage:ae.usage,status:ae.status,selected:ae.id===Y,current:ae.id===N,onSelect:ae.id===Y?void 0:()=>G(ae.id)},ae.id))]}),$l=(ae,Je)=>a.jsxs("aside",{style:{position:"relative",borderLeft:"1px solid var(--line)",background:"var(--bg-panel)",minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[a.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize the rail",title:"Drag to resize",onPointerDown:Z,style:{position:"absolute",left:-4,top:0,bottom:0,width:8,cursor:"col-resize",zIndex:2}}),ae&&a.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3) 0",flex:"0 0 auto"},children:ae}),a.jsx("div",{style:{minHeight:0,overflowY:"auto",padding:"var(--sp-3)"},children:Je})]}),Da=a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[qi,a.jsx(L1,{doc:Q.missionDoc}),a.jsx(Ta,{label:"Mission doc",open:Ne,onToggle:()=>Ge(!Ne),children:a.jsx(v1,{doc:Q.missionDoc??void 0})}),D.text.trim()&&a.jsx(Ta,{label:"Project memory",open:Ea,onToggle:()=>Ll(!Ea),children:a.jsx("div",{style:{fontSize:"var(--fs-sm)"},children:a.jsx(_i,{text:D.text})})}),a.jsx(ob,{agents:Q.agents,filter:oe,onFilter:ce,sessionId:Q.directorSessionId,details:J&&a.jsx(bb,{r:J,live:fe,liveCost:Q.costUsd,liveBasis:Q.costBasis,liveUsage:Q.usage,liveTurns:J.turns,onChanged:S})})]}),Ra=Y?a.jsx(Z1,{runId:Y,deck:Ut.deck,loading:Ut.loading,error:Ut.error,missing:Ut.missing,services:Q.services,tree:Jt}):null,Pt=Ut.deck?Ut.deck.totals.files+Ut.deck.artifacts.length:0,at=a.jsx(dn,{size:"sm",value:P,onChange:ae=>me(ae),tabs:[{value:"mission",label:"Mission"},{value:"files",label:"Files",count:Pt},{value:"runs",label:"Runs",count:z.length}]}),yt=a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:"0 0 auto",flexWrap:"wrap",padding:"6px var(--sp-3) 0",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[Q.agents.length>1&&a.jsx(R1,{agents:Q.agents,filter:oe,onFilter:ce}),a.jsx("span",{style:{flex:1}}),Q.entries.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(se,{variant:"ghost",size:"sm",icon:"timeline",title:te?"Hide the timeline":"Show the swimlane timeline — click a tick to jump to its entry",onClick:()=>le(!te),children:"Timeline"}),a.jsx(se,{variant:"ghost",size:"sm",icon:"sort",title:Re==="newest"?"Newest first — click to read oldest first":"Oldest first — click to read newest first",onClick:()=>ee(Re==="newest"?"oldest":"newest"),children:Re==="newest"?"Newest first":"Oldest first"})]})]}),pn=a.jsxs("div",{style:{minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[yt,te&&Q.entries.length>0&&a.jsx("div",{style:{padding:"6px var(--sp-3) 0",flex:"0 0 auto"},children:a.jsx("div",{style:{background:"var(--bg-panel)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",padding:"8px 10px"},children:a.jsx(h1,{agents:Q.agents,entries:Q.entries,live:ge,selected:oe,onSelect:ce,onTick:I})})}),!Ht&&a.jsxs("div",{style:{padding:"6px var(--sp-3) 0",flex:"0 0 auto",display:"flex",flexDirection:"column",gap:6},children:[a.jsx(Ta,{label:q1(Hi),open:bt,onToggle:()=>hl(!bt),children:Da}),a.jsx(Ta,{label:`Files · ${Pt}`,open:sn,onToggle:()=>Hl(!sn),children:Ra}),a.jsx(Ta,{label:`Runs · ${z.length}`,open:Nn,onToggle:()=>Ul(!Nn),children:vl})]}),a.jsx(vb,{run:Q,filter:oe,jump:E,order:Re})]});return a.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[a.jsxs(Ip,{mode:"project",title:i.name,folder:i.folder,onBack:v,branch:J?.git?{name:J.git.branch,hint:`This mission runs on ${J.git.branch}, made from ${J.git.base}${J.git.commits!==void 0?` · ${J.git.commits} commit${J.git.commits===1?"":"s"} ahead`:""}`}:i.git?.repo&&i.git.branch?{name:i.git.branch,dirty:i.git.dirty}:null,theme:j,onToggleTheme:k,onSettings:B,search:M,children:[Bl&&a.jsx(ot,{tone:"error",inline:!0,children:Bl}),Y&&(Q.runStatus==="running"&&It>0?a.jsx("span",{title:`Waiting on you: ${Q.approvals.length} approval(s), ${Q.questions.length} question(s)`,children:a.jsx(fl,{status:"needs-you"})}):a.jsx(fl,{status:Q.runStatus})),Y&&a.jsx(ev,{spent:Q.costUsd,budget:Q.budgetUsd,detail:!0,costBasis:Q.costBasis,usage:Q.usage,turns:J?.turns,elapsedMs:J?.createdAt?(ge?Un:J.endedAt??Un)-J.createdAt:void 0}),Bi,ge&&a.jsx(se,{variant:"danger",onClick:()=>{_e.interrupt(Y)},children:"Interrupt"}),Ui&&a.jsx(cb,{director:J?.directorModel,worker:J?.workerModel,models:c,loading:u,note:o,busy:ue,onResume:ae=>{Aa(ae)}}),!N&&Y&&J&&J.status!=="running"&&a.jsx(se,{variant:"good",icon:"write",disabled:Ca,title:"Start a new planning conversation that builds on what this mission did",onClick:()=>{Oi(Y)},children:Ca?"Opening…":"Plan the next step"}),!N&&Y&&J?.git&&J.status!=="running"&&i.git?.remote&&(J.git.pr?a.jsxs(se,{icon:hn?.state==="merged"?"check":hn?.state==="closed"?"close":"preview",onClick:()=>window.open(J.git.pr,"_blank","noopener"),title:`${J.git.pr}${hn?.state?` · ${hn.state}`:""}`,children:["Pull request",hn?.runId===Y&&hn.state?` · ${hn.state}`:""," ↗"]}):a.jsx(se,{icon:"steer",onClick:()=>Ma(!0),title:`Push ${J.git.branch} and open a pull request against ${J.git.base}`,children:"Open pull request…"})),!N&&Y&&a.jsx(se,{variant:"primary",onClick:()=>G(null),children:"New mission"}),!N&&!Y&&!Ni&&a.jsx(se,{variant:"primary",icon:"write",onClick:()=>_a(!0),title:"Skip the talk: describe the mission and start it",children:"New mission"})]}),or&&Y&&a.jsx(yb,{runId:Y,onClose:()=>Ma(!1),onDone:()=>S()}),Y&&a.jsx(B1,{approvals:Q.approvals,questions:Q.questions,now:Un,running:ge,activity:ur,onAllow:ae=>{_e.permission(ae,"allow")},onAlways:ae=>{_e.permission(ae,"allow_always")},onDeny:ae=>{_e.permission(ae,"deny")},onAnswer:(ae,Je)=>{_e.answer(ae,Je)}}),(i.billingMode??b.mode)==="none"&&a.jsxs(ot,{tone:"caution",children:["This project has nothing to run on: Claude Code is not signed in on this machine. Sign in and restart Foreman, or give the project a provider of its own.",a.jsx(se,{variant:"ghost",size:"sm",icon:"provider",style:{marginLeft:"var(--sp-2)"},onClick:()=>B("provider"),children:"Settings → Provider"})]}),Y&&!fe&&a.jsxs(ot,{tone:"readonly",children:["Viewing a past run (read-only).",a.jsx(se,{variant:"ghost",size:"sm",icon:"back",style:{marginLeft:"var(--sp-2)"},onClick:()=>G(N??null),children:N?"Back to the live run":"Back to planning"})]}),dr?a.jsxs("div",{style:{flex:1,minHeight:0,minWidth:0,display:Ht?"grid":"flex",flexDirection:"column",gridTemplateColumns:Ht?`minmax(0, 1fr) ${xe}px`:void 0},children:[a.jsxs("div",{style:{minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[!Ht&&z.length>0&&a.jsx("div",{style:{padding:"6px var(--sp-3) 0",flex:"0 0 auto"},children:a.jsx(Ta,{label:`Runs · ${z.length}`,open:Nn,onToggle:()=>Ul(!Nn),children:vl})}),Ni?a.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:[a.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3) 0",flex:"0 0 auto"},children:a.jsx(se,{variant:"ghost",size:"sm",icon:"back",onClick:()=>_a(!1),children:"Back to the conversation"})}),a.jsxs("div",{style:{margin:"auto",width:"100%",padding:"var(--sp-4) 0 var(--sp-5)"},children:[a.jsx(T1,{folder:i.folder,defaultBudgetUsd:i.defaultBudgetUsd,error:Hn,busy:Ft,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,onStart:ae=>{qn(ae)},style:{background:"var(--bg-panel)",border:"1px solid var(--line)",borderRadius:"var(--r-md)",padding:"var(--sp-5)",margin:"0 auto",boxSizing:"border-box"}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap",margin:"var(--sp-3) auto 0",maxWidth:"var(--composer-max)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[a.jsx(Qp,{mode:i.billingMode??b.mode,compact:!0,account:b.account,source:ub(i,b.source)}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)"},children:["runs on ",Up(i.provider)??"the server default instance"]}),i.git?.repo&&a.jsxs("span",{title:re?"Foreman creates the branch from what is checked out, commits the mission's work on it at the end, and never merges or pushes. Settings → Projects turns this off.":"The mission edits the current branch. Settings → Projects can give each mission a branch of its own.",children:["· ",re?a.jsxs(a.Fragment,{children:["on its own branch from ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i.git.branch})]}):a.jsxs(a.Fragment,{children:["on ",a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i.git.branch})," directly"]})]})]})]})]}):a.jsx(a.Fragment,{children:a.jsx(xb,{chat:cr,folder:i.folder,starting:Ft,error:Hn,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,onStart:ae=>{qn(ae)},onCompose:()=>_a(!0),hasRuns:z.length>0,recent:z,runsOn:q,onOpenRun:ae=>G(ae),onForkRun:ae=>{Oi(ae)},forking:Ca,projectId:i.id,onSettings:B})})]}),Ht&&$l(null,a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[a.jsx(mb,{memory:D}),a.jsx(Vc,{files:Jt.files,truncated:Jt.truncated,loading:Jt.loading,error:Jt.error,onRefresh:Jt.refresh,urlBase:`/projects/${encodeURIComponent(i.id)}`},i.id)]}))]}):a.jsxs("main",{style:{flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[Ht?a.jsxs("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:`minmax(0, 1fr) ${xe}px`},children:[pn,$l(at,P==="mission"?Da:P==="files"?Ra:vl)]}):a.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:pn}),fe&&a.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3) var(--sp-3)",flex:"0 0 auto"},children:a.jsx(_1,{agents:[{id:"director",status:Q.runStatus==="running"?"running":"done"}],to:"director",onTo:()=>{},timing:"next",onTiming:()=>{},disabled:Q.runStatus!=="running",disabledReason:"Run finished — start a new mission.",onSend:ae=>{_e.steer(Y,ae)}})})]})]})}const Np={small:.88,default:1,large:1.15,larger:1.3};function Sb(){const i=m.useCallback(c=>{const u=Np[c]??1;document.documentElement.style.setProperty("--ui-scale",String(u));try{localStorage.setItem("foreman:textSize",c)}catch{}},[]);return m.useEffect(()=>{let c=null;try{c=localStorage.getItem("foreman:textSize")}catch{}c&&c in Np&&i(c)},[i]),i}function kb(){const[i,c]=m.useState(()=>localStorage.getItem("foreman:theme")||"light");m.useEffect(()=>{document.documentElement.dataset.theme=i,localStorage.setItem("foreman:theme",i)},[i]);const u=m.useCallback(o=>{c(o==="system"?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":o)},[]);return[i,()=>c(o=>o==="dark"?"light":"dark"),u]}function wb(i){const[c,u]=m.useState({models:null,loading:!0});return m.useEffect(()=>{let o=!0;u(h=>({...h,loading:!0}));const d=i?`/models?projectId=${encodeURIComponent(i)}`:"/models";return fetch(d).then(h=>h.ok?h.json():null).then(h=>{if(o){if(!h)return u({models:null,loading:!1});u({models:h.models,loading:!1,note:h.reachable===!1?`Cannot reach ${h.endpoint??"this project’s endpoint"}.`:h.models?.length===0?"This endpoint has no models installed.":void 0,inheritNote:h.provider&&h.provider!=="claude-code"?"inherits this project’s provider default":void 0})}}).catch(()=>o&&u({models:null,loading:!1})),()=>{o=!1}},[i]),c}function zb(i){const[c,u]=m.useState({instances:[],ollama:null,codex:null});return m.useEffect(()=>{if(!i)return;let o=!0;return fetch("/instances").then(d=>d.ok?d.json():null).then(d=>{o&&d&&u({instances:d.instances??[],ollama:d.ollama??null,codex:d.codex??null})}).catch(()=>{}),()=>{o=!1}},[i]),c}function Tb(){const{projects:i,connected:c,auth:u,refresh:o,activity:d,update:h,version:g,firstRun:y}=Om(),{setup:x,projectId:v,runId:S,tab:b,go:j,goRun:k}=Lm(),[B,K,M]=kb(),z=Sb(),D=wb(v),[U,F]=m.useState({global:{},projects:{}}),[re,q]=m.useState(!1),[N,Y]=m.useState("models"),G=te=>{te&&Y(te),q(!0)},fe=zb(re);m.useEffect(()=>{fetch("/settings").then(te=>te.ok?te.json():null).then(te=>te&&F(te)).catch(()=>{})},[]);const Q=v?i.find(te=>te.id===v):null,[J,ge]=m.useState(!1),[oe,ne]=m.useState(""),E=async(te,we)=>{ne(""),ge(!0);const le=await(we===null?_e.clearProviderKey(te):_e.setProviderKey(te,we)).finally(()=>ge(!1));le.ok?o():ne((await le.json().catch(()=>({}))).error??"could not save the key")},$=async te=>{const we={global:te.global,projects:{...U.projects}};Q&&(Object.keys(te.project).length?we.projects[Q.id]=te.project:delete we.projects[Q.id]),F(we),q(!1),te.global.theme&&M(te.global.theme),te.global.textSize&&z(te.global.textSize),await fetch("/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({global:te.global,projectId:Q?.id,project:Q?we.projects[Q.id]??{}:void 0})}).catch(()=>{}),Q&&te.provider!==void 0&&(await _e.updateProject(Q.id,{provider:te.provider}).catch(()=>{}),o())},[P,me]=m.useState(""),xe=P.trim().toLowerCase(),T=Um(xe),_=te=>new Date(te).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Z=xe?i.filter(te=>[te.name,te.folder].some(we=>we.toLowerCase().includes(xe))).slice(0,8):[],I=[{id:"act-fleet",title:"Fleet",detail:"The board: what needs you, what is running, what finished",icon:"back",keys:"fleet home board",onPick:()=>j(null)},{id:"act-settings",title:"Settings",detail:Q?`Global, and ${Q.name}'s overrides`:"Models, budget, approvals, notifications",icon:"settings",keys:"settings preferences models budget telegram",onPick:()=>q(!0)},...Q?[{id:"act-plan",title:`Plan in ${Q.name}`,detail:"Back to the planning conversation",icon:"steer",keys:"plan planner mission new",onPick:()=>j(Q.id)}]:[]].filter(te=>xe&&(te.title.toLowerCase().includes(xe)||te.keys.includes(xe))),ce=[{label:"Projects",items:Z.map(te=>({id:`p-${te.id}`,title:te.name,detail:te.folder,icon:"folder",onPick:()=>j(te.id)}))},{label:"Runs",count:T.hits.length>=30?30:void 0,items:T.hits.map(te=>({id:`r-${te.id}`,title:te.title||te.mission,detail:`${te.projectName}${te.title?` · ${te.mission}`:""}`,icon:"idle",status:te.status,meta:`${_(te.endedAt??te.createdAt)}${te.costBasis==="priced"?` · $${te.costUsd.toFixed(2)}`:""}`,onPick:()=>{te.projectId&&k(te.projectId,te.id)}}))},{label:"Actions",items:I}],ue=a.jsx(x0,{value:P,onChange:me,groups:ce,busy:T.busy}),be={theme:B,onToggleTheme:K,search:ue,onSettings:te=>G(te),auth:u},Re=qm(),ee=Re.status?Re.status.telegram.chatId?Re.status.telegram.chatLabel??"linked":null:void 0;return a.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[a.jsx("div",{style:{flex:1,minHeight:0},children:x||y===!0&&!Q?a.jsx(o1,{onDone:()=>{_e.setupDone().then(()=>o()),x&&j(null)},onSettings:te=>G(te)}):Q?a.jsx(jb,{p:Q,models:D.models,modelsLoading:D.loading,modelsNote:D.note,modelsInheritNote:D.inheritNote,routeRunId:S,onSelectRun:te=>k(Q.id,te),routeTab:b,onSelectTab:te=>S&&k(Q.id,S,te),onBack:()=>j(null),refreshFleet:o,settings:{global:U.global,project:U.projects[Q.id]},...be}):a.jsx(s1,{projects:i,connected:c,activity:d,onOpen:te=>j(te),onOpenRun:(te,we)=>k(te,we),refresh:o,query:P,onQuery:me,...be})}),a.jsx(j0,{connected:c,localUrl:window.location.origin,publicUrl:Re.status?.publicUrl,phone:ee,auth:u,version:g,update:h,onOpenSettings:G}),re&&a.jsx(ab,{scope:Q?"project":"global",section:N,onSection:Y,global:U.global,project:Q?U.projects[Q.id]:void 0,projectName:Q?.name,models:D.models,modelsLoading:D.loading,modelsNote:D.note,provider:Q?.provider??null,providerInstances:fe.instances,providerOllama:fe.ollama,providerCodex:fe.codex,providerHasKey:Q?.providerHasKey,providerKeyBusy:J,providerKeyError:oe,onStoreProviderKey:(te,we)=>{E(te,we)},onClearProviderKey:te=>{E(te,null)},notify:Re,onSave:te=>{$(te)},onClose:()=>q(!1)})]})}Tm.createRoot(document.getElementById("root")).render(a.jsx(m.StrictMode,{children:a.jsx(Tb,{})}));
65
+ [… ${de.length-Nc} more characters — open in a new tab for the whole file]`:de)}).catch(Y=>{$&&C(String(Y.message||Y))}),()=>{$=!1}},[c,z]),!i)return null;const re=typeof i.size!="number"?null:i.size>=1024*1024?`${(i.size/1024/1024).toFixed(1)} MB`:i.size>=1024?`${(i.size/1024).toFixed(1)} KB`:`${i.size} B`;let q;return D&&i.binary&&c&&/\.(png|jpe?g|webp|gif|svg)$/i.test(B)?q=l.jsx("img",{src:c,alt:i.path,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",margin:"auto",background:"var(--bg-inset)"}}):D?q=i.binary?l.jsx("div",{style:{margin:"auto",color:"var(--ink-2)"},children:"Binary file — no diff to show."}):i.diff?l.jsx($1,{text:i.diff,truncated:i.truncated,style:{minHeight:"100%"}}):l.jsx("div",{style:{margin:"auto",color:"var(--ink-2)"},children:"No diff recorded for this file."}):y&&u&&b==="rendered"?q=l.jsx("iframe",{title:i.path,src:u,sandbox:"allow-scripts",style:{width:"100%",height:"100%",border:"none",background:"#fff"}}):z==="image"?q=l.jsx("img",{src:c,alt:i.path,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",margin:"auto",background:"var(--bg-inset)"}}):z==="pdf"?q=l.jsx("iframe",{title:i.path,src:c,style:{width:"100%",height:"100%",border:"none",background:"var(--bg-inset)"}}):z==="text"?q=Z?l.jsxs("div",{style:{padding:"var(--sp-3)",color:"var(--status-critical)"},children:["Could not load it: ",Z]}):k===null?l.jsx("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)"},children:"Loading…"}):J?l.jsx("div",{style:{padding:"var(--sp-3) var(--sp-4)",maxWidth:"72ch",margin:"0 auto"},children:l.jsx(Ai,{text:k,slots:!1})}):l.jsx("pre",{style:{margin:0,padding:"var(--sp-3) var(--sp-4)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--ink-0)",tabSize:2},children:k}):q=l.jsxs("div",{style:{margin:"auto",textAlign:"center",color:"var(--ink-2)",display:"flex",flexDirection:"column",gap:"var(--sp-2)",alignItems:"center"},children:[l.jsx(se,{name:"file",size:28,color:"var(--ink-3)"}),l.jsx("span",{children:"No preview for this kind of file."}),l.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--brand)"},children:["Download ",B]})]}),l.jsx("div",{role:"dialog","aria-modal":"true","aria-label":i.path,onClick:o,style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.55)",display:"flex",alignItems:"center",justifyContent:"center",padding:"var(--sp-4)"},children:l.jsxs("div",{onClick:$=>$.stopPropagation(),style:{width:"min(1200px, 100%)",height:"min(900px, 100%)",display:"flex",flexDirection:"column",background:"var(--bg-card)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",boxShadow:"0 24px 64px rgba(0,0,0,0.35)",overflow:"hidden"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"6px var(--sp-2) 6px var(--sp-3)",borderBottom:"1px solid var(--line)",background:"var(--bg-panel)",flex:"0 0 auto",minWidth:0},children:[l.jsx(se,{name:z==="image"?"Image":z==="text"?"transcript":"file",size:14,color:"var(--ink-2)"}),D&&i.status&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",flex:"0 0 auto"},children:i.status}),l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:1},title:i.path,children:i.path}),D?l.jsxs("span",{style:{fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:[l.jsxs("span",{style:{color:"var(--status-good)"},children:["+",i.additions??0]})," ",l.jsxs("span",{style:{color:"var(--status-critical)"},children:["−",i.deletions??0]})]}):re&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:re}),y&&u&&l.jsx(dn,{size:"sm",value:b,onChange:v,tabs:[{value:"rendered",label:"Rendered"},{value:"source",label:"Source"}]}),S&&l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,flex:"0 0 auto",marginLeft:"var(--sp-1)"},children:[l.jsx(Na,{icon:"chevronLeft",label:"Previous (←)",onClick:x??void 0,disabled:!x,size:"sm"}),l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",minWidth:"4.5ch",textAlign:"center"},children:[d+1," / ",h]}),l.jsx(Na,{icon:"chevronRight",label:"Next (→)",onClick:j??void 0,disabled:!j,size:"sm"})]}),c&&!D&&l.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",flex:"0 0 auto"},children:l.jsx(ie,{variant:"ghost",size:"sm",children:"Open in a new tab"})}),l.jsx(Na,{icon:"close",label:"Close (Esc)",onClick:o,size:"sm"})]}),l.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",display:"flex",flexDirection:"column",background:z==="image"?"var(--bg-inset)":"var(--bg-card)"},children:q})]})})}function Hc(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(i<10*1024?1:0)} KB`:`${(i/1024/1024).toFixed(1)} MB`}function Sp(i,c){return`${i}/preview/${c.split("/").map(encodeURIComponent).join("/")}`}function Uc(i,c){return`${i}/artifact?path=${encodeURIComponent(c)}`}const Y1={image:"image",text:"transcript",pdf:"file",other:"file"};function lv(i,c){const u=c?`${c}/`:"",o=new Map,d=[];for(const y of i){if(!y.path.startsWith(u))continue;const b=y.path.slice(u.length),v=b.indexOf("/");if(v<0){d.push(y);continue}const S=b.slice(0,v),x=o.get(S)??{name:S,count:0,sub:new Set};x.count+=1;const j=b.slice(v+1),k=j.indexOf("/");x.sub.add(k<0?"":j.slice(0,k)),o.set(S,x)}const h=(y,b)=>y.localeCompare(b,void 0,{sensitivity:"base",numeric:!0}),g=[...o.values()].sort((y,b)=>h(y.name,b.name)).map(y=>{let b=y.name,v=`${u}${y.name}`,S=y;for(;S.sub.size===1&&!S.sub.has("");){const[x]=[...S.sub],j=lv(i,v).dirs.find(k=>k.name===x);if(!j)break;b=`${b}/${x}`,v=`${v}/${x}`,S={sub:j.sub}}return{name:y.name,label:b,path:v,count:y.count,sub:y.sub}});return d.sort((y,b)=>h(y.path,b.path)),{dirs:g,files:d}}const G1={display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"5px 6px",width:"100%",fontSize:"var(--fs-sm)",color:"inherit",minWidth:0,background:"none",border:"none",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",textAlign:"left"};function Bc({onClick:i,title:c,children:u}){const[o,d]=m.useState(!1);return l.jsx("button",{type:"button",onClick:i,title:c,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...G1,background:o?"var(--bg-hover)":"none"},children:u})}const qc={fontFamily:"var(--font-mono)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--ink-0)"},kp={fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"};function X1(i){if(!i?.length)return"";let c=i[0].path.split("/").slice(0,-1);for(const u of i){const o=u.path.split("/").slice(0,-1);let d=0;for(;d<c.length&&d<o.length&&c[d]===o[d];)d++;if(c=c.slice(0,d),!c.length)break}return c.join("/")}const wp=9;function Vc({files:i,truncated:c,loading:u,error:o,onRefresh:d,urlBase:h,initialDir:g="",summary:y,images:b=!0,style:v}){const[S,x]=m.useState(g),[j,k]=m.useState(null),[U,Z]=m.useState(!1),[C,z]=m.useState(null),D=m.useMemo(()=>lv(i??[],S),[i,S]),B=m.useMemo(()=>b?(i??[]).filter(Y=>Y.kind==="image").sort((Y,de)=>(de.mtimeMs??0)-(Y.mtimeMs??0)):[],[i,b]),J=U?B:B.slice(0,wp),re={display:"flex",flexDirection:"column",gap:"var(--sp-2)",...v};if(o)return l.jsx("div",{style:re,children:l.jsxs(Fe,{children:["Could not list the folder: ",o]})});if(u&&!i?.length)return l.jsx("div",{style:re,children:l.jsx(Fe,{children:"Reading the folder…"})});const q=S?S.split("/"):[],N=j===null?null:D.files[j]??null,$=i?.length??0;return l.jsxs("div",{style:re,children:[y!==null&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:[l.jsx("span",{style:{flex:1,minWidth:0},children:y??l.jsxs(l.Fragment,{children:[l.jsxs("span",{style:{color:"var(--ink-0)"},children:[$," file",$===1?"":"s"]})," in the folder as it stands · every run here shares them"]})}),d&&l.jsx("button",{type:"button",onClick:d,title:"Read the folder again",disabled:u,style:{background:"none",border:"none",padding:2,cursor:"pointer",color:"var(--ink-2)",display:"inline-flex"},children:l.jsx(se,{name:u?"loading":"resume",size:13})})]}),c&&l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--status-serious)"},children:"A large folder: only the first 2000 files are listed."}),B.length>0&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[l.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(88px, 1fr))",gap:6},children:J.map((Y,de)=>l.jsxs("button",{type:"button",onClick:()=>z(de),title:`${Y.path} · ${Hc(Y.size)}`,style:{display:"block",padding:0,width:"100%",cursor:"pointer",font:"inherit",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",overflow:"hidden",background:"var(--bg-inset)",color:"inherit",textAlign:"left"},children:[l.jsx("img",{src:Uc(h,Y.path),alt:Y.path,loading:"lazy",style:{display:"block",width:"100%",aspectRatio:"4 / 3",objectFit:"cover"}}),l.jsx("div",{style:{padding:"2px 5px",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",color:"var(--ink-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Y.path.split("/").pop()})]},Y.path))}),B.length>wp&&l.jsx("button",{type:"button",onClick:()=>Z(Y=>!Y),style:{alignSelf:"flex-start",background:"none",border:"none",padding:"0 2px",cursor:"pointer",font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textDecoration:"underline"},children:U?"Fewer images":`All ${B.length} images`})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:2,padding:"4px 6px",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",background:"var(--bg-inset)",fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",minWidth:0},children:[l.jsxs("button",{type:"button",onClick:()=>x(""),title:"The project folder",style:{background:"none",border:"none",padding:"1px 3px",cursor:S?"pointer":"default",color:S?"var(--ink-2)":"var(--ink-0)",display:"inline-flex",alignItems:"center",gap:4,font:"inherit"},children:[l.jsx(se,{name:"folder",size:12}),!S&&l.jsx("span",{children:"/"})]}),q.map((Y,de)=>{const Q=de===q.length-1,W=q.slice(0,de+1).join("/");return l.jsxs(On.Fragment,{children:[l.jsx("span",{style:{color:"var(--ink-2)"},children:"/"}),l.jsx("button",{type:"button",onClick:()=>x(W),disabled:Q,style:{background:"none",border:"none",padding:"1px 3px",cursor:Q?"default":"pointer",color:Q?"var(--ink-0)":"var(--ink-2)",font:"inherit",fontWeight:Q?"var(--fw-semibold)":"inherit"},children:Y})]},W)})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[S&&l.jsxs(Bc,{onClick:()=>x(q.slice(0,-1).join("/")),title:"Up one level",children:[l.jsx(se,{name:"parent",size:13,color:"var(--ink-2)"}),l.jsx("span",{style:{...qc,color:"var(--ink-2)"},children:".."})]}),D.dirs.map(Y=>l.jsxs(Bc,{onClick:()=>x(Y.path),title:`${Y.path}/ · ${Y.count} file${Y.count===1?"":"s"}`,children:[l.jsx(se,{name:"folder",size:13,color:"var(--brand)"}),l.jsx("span",{style:qc,children:Y.label}),l.jsx("span",{style:kp,children:Y.count}),l.jsx(se,{name:"chevronRight",size:12,color:"var(--ink-2)"})]},Y.path)),D.files.map((Y,de)=>l.jsxs(Bc,{onClick:()=>k(de),title:`${Y.path} · ${Hc(Y.size)}`,children:[l.jsx(se,{name:Y1[Y.kind]||"file",size:13,color:"var(--ink-2)"}),l.jsx("span",{style:qc,children:Y.path.slice(Y.path.lastIndexOf("/")+1)}),l.jsx("span",{style:kp,children:Hc(Y.size)})]},Y.path)),D.dirs.length===0&&D.files.length===0&&l.jsx(Fe,{children:S?"Nothing here.":"The folder is empty."})]}),C!==null&&J[C]&&l.jsx(Qc,{artifact:J[C],url:Uc(h,J[C].path),previewUrl:Sp(h,J[C].path),onClose:()=>z(null),index:C,count:J.length,onStep:z}),N&&l.jsx(Qc,{artifact:N,url:Uc(h,N.path),previewUrl:Sp(h,N.path),onClose:()=>k(null),index:j,count:D.files.length,onStep:k})]})}const Q1={added:"added",modified:"modified",deleted:"deleted",renamed:"renamed"},zp={added:"var(--status-good)",deleted:"var(--status-critical)",modified:"var(--ink-1)",renamed:"var(--ink-1)"};function V1(i,c){return`${i}/artifact?path=${encodeURIComponent(c)}`}function W1({path:i,muted:c,strike:u}){const o=i.lastIndexOf("/"),d=o>=0?i.slice(0,o+1):"",h=o>=0?i.slice(o+1):i;return l.jsxs("span",{title:i,style:{fontFamily:"var(--font-mono)",display:"flex",minWidth:0,flex:1,color:c?"var(--ink-2)":"var(--ink-0)",textDecoration:u?"line-through":"none"},children:[d&&l.jsx("span",{style:{color:"var(--ink-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:"0 1 auto"},children:d}),l.jsx("span",{style:{whiteSpace:"nowrap",flex:"0 0 auto"},children:h})]})}const iv={display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"4px 6px",width:"100%",fontSize:"var(--fs-sm)",color:"inherit",minWidth:0,background:"none",border:"none",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",textAlign:"left"};function K1({onClick:i,title:c,children:u}){const[o,d]=m.useState(!1);return l.jsx("button",{type:"button",onClick:i,title:c,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...iv,background:o?"var(--bg-hover)":"none"},children:u})}function Z1({runId:i,deck:c,loading:u,error:o,missing:d,services:h=[],urlBase:g,tree:y,style:b}){const v=g??`/runs/${encodeURIComponent(i)}`,[S,x]=m.useState(null),j={display:"flex",flexDirection:"column",gap:"var(--sp-3)",...b};if(o)return l.jsx("div",{style:j,children:l.jsxs(Fe,{children:["Could not read the working tree: ",o]})});if(d||!c&&!u)return l.jsx("div",{style:j,children:l.jsx(Fe,{children:"No file record for this run — the server has no baseline for it."})});if(!c)return l.jsx("div",{style:j,children:l.jsx(Fe,{children:"Reading the working tree…"})});const{files:k,artifacts:U,totals:Z}=c,C=k.map(q=>({...q,kind:"diff"})),z=q=>x(q),D=S===null?null:C[S]??null,B=new Set((y?.files??[]).map(q=>q.path)),J=[...y?.files??[],...U.filter(q=>!B.has(q.path))],re=c.baseline.kind==="git"&&c.baseline.head?`against ${String(c.baseline.head).slice(0,8)}`:c.baseline.kind==="snapshot"?"against a snapshot at run start":"no baseline";return l.jsxs("div",{style:j,children:[l.jsxs("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",lineHeight:"var(--lh)"},children:[l.jsxs("span",{style:{color:"var(--ink-0)"},children:[Z.files," changed · ",l.jsxs("span",{style:{color:"var(--status-good)"},children:["+",Z.additions]})," ",l.jsxs("span",{style:{color:"var(--status-critical)"},children:["−",Z.deletions]})," · ",U.length," artifact",U.length===1?"":"s"]})," ",l.jsx("span",{children:re}),c.note&&l.jsx("div",{style:{color:"var(--status-serious)"},children:c.note})]}),h.length>0&&l.jsxs("section",{children:[l.jsx(Rn,{children:"Services"}),l.jsx("div",{style:{display:"flex",flexDirection:"column"},children:h.map(q=>l.jsxs("a",{href:q.url??q.path,target:"_blank",rel:"noopener noreferrer",title:`${q.label} — 127.0.0.1:${q.port} through Foreman`,style:{...iv,textDecoration:"none"},children:[l.jsx(se,{name:"provider",size:12,color:"var(--status-good)"}),l.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--ink-0)"},children:q.label}),l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)",flex:"0 0 auto"},children:[":",q.port]})]},q.port))})]}),l.jsxs("section",{children:[l.jsx(Rn,{children:"Changed files"}),k.length===0&&l.jsx(Fe,{children:"Nothing changed in the folder yet."}),l.jsx("div",{style:{display:"flex",flexDirection:"column"},children:k.map((q,N)=>l.jsxs(K1,{onClick:()=>z(N),title:q.binary?`${q.path} — binary, no diff`:q.preexisting?`${q.path} — also dirty before the run`:`${q.path} — open the diff`,children:[l.jsx(se,{name:"file",size:12,color:"var(--ink-2)"}),l.jsx(W1,{path:q.path,muted:q.status==="deleted",strike:q.status==="deleted"}),l.jsx("span",{style:{fontSize:"var(--fs-xs)",padding:"0 5px",borderRadius:"var(--r-pill)",lineHeight:"15px",border:`1px solid ${zp[q.status]||"var(--line-strong)"}`,color:zp[q.status]||"var(--ink-1)",flex:"0 0 auto"},children:q.binary?"binary":Q1[q.status]||q.status}),l.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",flex:"0 0 auto"},children:[l.jsxs("span",{style:{color:"var(--status-good)"},children:["+",q.additions]})," ",l.jsxs("span",{style:{color:"var(--status-critical)"},children:["−",q.deletions]})]})]},`${q.status}:${q.path}`))})]}),l.jsxs("section",{children:[l.jsx(Rn,{children:"Folder"}),y?l.jsx(Vc,{files:J,truncated:y.truncated,loading:y.loading,error:y.error,onRefresh:y.refresh,urlBase:v,summary:l.jsxs(l.Fragment,{children:[l.jsxs("span",{style:{color:"var(--ink-0)"},children:[J.length," file",J.length===1?"":"s"]})," as the folder stands · the run's work files included"]})},i):U.length===0?l.jsx(Fe,{children:"No screenshots or work files yet."}):l.jsx(Vc,{files:U,urlBase:v,initialDir:X1(U),summary:null},i)]}),D&&l.jsx(Qc,{artifact:D,url:D.kind==="diff"&&!D.binary?void 0:V1(v,D.path),previewUrl:void 0,onClose:()=>x(null),index:S,count:C.length,onStep:x})]})}const F1=[{value:"default",label:"Server default"},{value:"claude-code",label:"Claude Code",icon:"model"},{value:"anthropic-api",label:"Anthropic API",icon:"budget"},{value:"codex",label:"Codex",icon:"Bash"},{value:"openai-compatible",label:"Custom endpoint",icon:"WebFetch"}];function J1(i){const c=`pr-${Math.random().toString(16).slice(2,10)}`;switch(i){case"claude-code":return{kind:i};case"anthropic-api":return{kind:i,id:c,apiKeyEnv:""};case"codex":return{kind:i,id:c};case"openai-compatible":return{kind:i,id:c,baseUrl:""};default:return null}}function Tp(){return l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginTop:4},children:"Names an environment variable on the server. A stored key below takes precedence; leave both empty and this endpoint needs no credential."})}function Cp({providerId:i,hasKey:c,busy:u,error:o,onStore:d,onClear:h}){const[g,y]=m.useState(""),[b,v]=m.useState(!1);return!d||!i?null:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap"},children:[l.jsx("span",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)"},children:c?"A key is stored for this provider.":"No key stored."}),c&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"It cannot be shown — only replaced or removed."}),l.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",gap:"var(--sp-2)"},children:[l.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>v(S=>!S),children:b?"Cancel":c?"Replace":"Add a key"}),c&&l.jsx(ie,{size:"sm",variant:"danger",disabled:u,onClick:()=>h?.(i),children:"Remove"})]})]}),b&&l.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center"},children:[l.jsx(We,{mono:!0,type:"password",placeholder:"paste the key",value:g,onChange:y,autoFocus:!0,onKeyDown:S=>{S.key==="Enter"&&g.trim()&&(d(i,g.trim()),y(""),v(!1))}}),l.jsx(ie,{size:"sm",variant:"good",disabled:u||!g.trim(),onClick:()=>{d(i,g.trim()),y(""),v(!1)},children:u?"Saving…":"Save key"})]}),o&&l.jsx(lt,{tone:"error",inline:!0,children:o})]})}function Zt({label:i,children:c}){return l.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:i}),c]})}function I1({inst:i,selected:c,onClick:u}){const[o,d]=m.useState(!1);return l.jsxs("button",{type:"button",onClick:u,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",gap:8,textAlign:"left",width:"100%",padding:"6px 8px",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",background:c?"var(--brand-wash-strong)":o?"var(--bg-hover)":"transparent",border:`1px solid ${c?"var(--brand)":"var(--line)"}`},children:[l.jsx(se,{name:"model",size:13,color:c?"var(--brand)":"var(--ink-2)"}),l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:i.configDir,children:rr(i.configDir)}),l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:i.origin}),i.hasStoredLogin&&l.jsx("span",{title:"Has a stored login",style:{width:6,height:6,borderRadius:"var(--r-pill)",background:"var(--status-good)",flex:"0 0 auto"}})]})}function P1({value:i,onChange:c,instances:u,ollama:o,hasKey:d,keyBusy:h,keyError:g,onStoreKey:y,onClearKey:b,style:v}){const[S,x]=m.useState(!1),j=i?.kind??"default",k=C=>c({...i,...C}),U=C=>c(J1(C)),Z=j==="openai-compatible"&&o&&i.baseUrl===o.host;return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)",...v},children:[l.jsx(dn,{size:"sm",value:j,onChange:U,tabs:F1}),j==="default"&&l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Runs on whatever the server itself authenticates as."}),j==="claude-code"&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[u?.length>0&&l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:u.map(C=>l.jsx(I1,{inst:C,selected:(i.configDir??"")===C.configDir,onClick:()=>k({configDir:C.configDir})},C.configDir))}),l.jsx(Zt,{label:"Config dir (blank inherits the server's own install)",children:l.jsx(We,{mono:!0,placeholder:"~/.claude-work",value:i.configDir??"",onChange:C=>k({configDir:C||void 0})})}),S?l.jsx(Zt,{label:"Executable (blank uses the SDK's bundled one)",children:l.jsx(We,{mono:!0,placeholder:"/usr/local/bin/claude",value:i.executable??"",onChange:C=>k({executable:C||void 0})})}):l.jsx("button",{type:"button",onClick:()=>x(!0),style:{alignSelf:"flex-start",background:"none",border:0,padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:"Pin an executable too"}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[l.jsx(Mt,{checked:!!i.ownLogin,onChange:C=>k({ownLogin:C||void 0})}),l.jsx("span",{style:{fontSize:"var(--fs-sm)"},children:"Own login"})]}),l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Strips any inherited API key from this project's agents so this install's own stored subscription pays, instead of whatever the server process authenticates as."})]}),j==="anthropic-api"&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[l.jsx(Cp,{providerId:i.id,hasKey:d,busy:h,error:g,onStore:y,onClear:b}),l.jsx(Zt,{label:"Environment variable (optional fallback)",children:l.jsx(We,{mono:!0,placeholder:"ANTHROPIC_API_KEY_ALPHA",value:i.apiKeyEnv??"",onChange:C=>k({apiKeyEnv:C})})}),l.jsx(Tp,{}),l.jsx(Zt,{label:"Model (blank uses the provider's default)",children:l.jsx(We,{mono:!0,placeholder:"claude-sonnet-4-5",value:i.model??"",onChange:C=>k({model:C||void 0})})})]}),j==="codex"&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:"Reads the login `codex login` already stored — Foreman never mints its own token."}),l.jsx(Zt,{label:"Codex home (blank is ~/.codex)",children:l.jsx(We,{mono:!0,placeholder:"~/.codex",value:i.codexHome??"",onChange:C=>k({codexHome:C||void 0})})}),S?l.jsx(Zt,{label:"Upstream URL (blank is the public ChatGPT backend)",children:l.jsx(We,{mono:!0,placeholder:"https://chatgpt.com/backend-api/codex",value:i.upstreamUrl??"",onChange:C=>k({upstreamUrl:C||void 0})})}):l.jsx("button",{type:"button",onClick:()=>x(!0),style:{alignSelf:"flex-start",background:"none",border:0,padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:"Point at a different upstream"}),l.jsx(Zt,{label:"Model (blank uses Codex's own default)",children:l.jsx(We,{mono:!0,placeholder:"gpt-5-codex",value:i.model??"",onChange:C=>k({model:C||void 0})})})]}),j==="openai-compatible"&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[o&&l.jsxs("button",{type:"button",onClick:()=>k({baseUrl:o.host,label:"Ollama"}),style:{display:"flex",alignItems:"center",gap:8,textAlign:"left",width:"100%",padding:"6px 8px",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",background:Z?"var(--brand-wash-strong)":"transparent",border:`1px solid ${Z?"var(--brand)":"var(--line)"}`},children:[l.jsx(se,{name:"Bash",size:13,color:Z?"var(--brand)":"var(--ink-2)"}),l.jsx("span",{style:{fontSize:"var(--fs-sm)",flex:1},children:"Use local Ollama"}),l.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[o.host," · ",o.models.length," model",o.models.length===1?"":"s"]})]}),l.jsx(Zt,{label:"Base URL",children:l.jsx(We,{mono:!0,placeholder:"http://127.0.0.1:11434",value:i.baseUrl??"",onChange:C=>k({baseUrl:C})})}),Z&&o.models.length>0?l.jsx(Zt,{label:"Model (blank lets the run pick)",children:l.jsxs("select",{value:i.model??"",onChange:C=>k({model:C.target.value||void 0}),style:{font:"inherit",fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",padding:"6px 8px",borderRadius:"var(--r-sm)",border:"1px solid var(--line-strong)",background:"var(--bg-card)",color:"var(--ink-0)"},children:[l.jsx("option",{value:"",children:"— server picks —"}),o.models.map(C=>l.jsxs("option",{value:C.id,children:[C.id,C.remote?" (cloud)":""]},C.id))]})}):l.jsx(Zt,{label:"Model (blank lets the run pick)",children:l.jsx(We,{mono:!0,placeholder:"llama3.1",value:i.model??"",onChange:C=>k({model:C||void 0})})}),l.jsx(Zt,{label:"Label (shown in place of the raw URL)",children:l.jsx(We,{placeholder:"OpenRouter",value:i.label??"",onChange:C=>k({label:C||void 0})})}),l.jsx(Zt,{label:"Environment variable (blank when the endpoint needs no key)",children:l.jsx(We,{mono:!0,placeholder:"OPENROUTER_API_KEY",value:i.apiKeyEnv??"",onChange:C=>k({apiKeyEnv:C||void 0})})}),!!i.apiKeyEnv&&l.jsx(Tp,{}),l.jsx(Cp,{providerId:i.id,hasKey:d,busy:h,error:g,onStore:y,onClear:b}),l.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-sm)"},children:[l.jsx(Mt,{checked:i.needsKey===!0,onChange:C=>k({needsKey:C||void 0})}),"This endpoint requires a credential"]})]})]})}function eb({status:i,busy:c,error:u,onSaveToken:o,onClearToken:d,onLink:h,onUnlink:g,onTest:y,onSavePublicUrl:b,style:v}){const[S,x]=m.useState(""),[j,k]=m.useState(!1),[U,Z]=m.useState(null),C=i?.telegram,z=!!C?.hasToken,D=!!C?.chatId,B=C?.linking,J=U??i?.publicUrl??"",re=U!==null&&U!==(i?.publicUrl??""),q=(N,$,Y)=>l.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-3)",padding:"var(--sp-2) 0",borderTop:"1px solid var(--line)"},children:[l.jsxs("div",{style:{flex:"0 0 180px"},children:[l.jsx("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-0)"},children:N}),$&&l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:$})]}),l.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:6},children:Y})]});return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",marginTop:"var(--sp-3)",...v},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)"},children:[l.jsx(se,{name:"send",size:13,color:"var(--brand)"})," Telegram",l.jsxs("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontWeight:"var(--fw-normal)"},children:[D?`linked · ${C.chatLabel||C.chatId}`:z?"token stored · not linked":"not set up",i?.delivered?` · ${i.delivered} sent`:"",i?.failures?` · ${i.failures} failed`:""]})]}),l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh-prose)"},children:"Approvals, questions, stalls and finished missions arrive in a chat with your own bot, using the toggles above. Every ask still has its unattended default — this makes it less likely to be needed."}),u&&l.jsx(lt,{tone:"error",inline:!0,children:u}),q("Bot token",l.jsxs(l.Fragment,{children:["Create a bot with ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"@BotFather"})," and paste its token. Stored write-only; Foreman can replace it but never show it."]}),z&&!j?l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-sm)"},children:[l.jsx("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:C?.bot||"token stored"}),l.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>k(!0),disabled:c,children:"Replace"}),l.jsx(ie,{size:"sm",variant:"ghost",onClick:d,disabled:c,children:"Remove"})]}):l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[l.jsx(We,{mono:!0,type:"password",width:320,placeholder:"123456789:AA…",value:S,onChange:x}),l.jsx(ie,{size:"sm",variant:"primary",disabled:c||!S.trim(),onClick:()=>{o?.(S.trim()),x(""),k(!1)},children:c?"Checking…":"Save"}),z&&l.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>k(!1),children:"Cancel"})]})),q("Linked chat","Send the one-time command to your bot from the chat that should receive messages. Only that chat is ever written to.",D?l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-sm)"},children:[l.jsx(se,{name:"check",size:13,color:"var(--status-ok, var(--brand))"}),l.jsxs("span",{children:[C.chatLabel||"linked"," ",l.jsx("span",{style:{color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:C.chatId})]}),l.jsx(ie,{size:"sm",variant:"ghost",onClick:y,disabled:c,children:"Send test"}),l.jsx(ie,{size:"sm",variant:"ghost",onClick:g,disabled:c,children:"Unlink"})]}):B?l.jsxs("div",{style:{display:"flex",gap:"var(--sp-3)",alignItems:"flex-start"},children:[B.deepLink&&l.jsx("a",{href:B.deepLink,target:"_blank",rel:"noreferrer",title:"Open in Telegram",style:{flex:"0 0 auto",display:"block",padding:6,background:"#fff",borderRadius:"var(--r-sm)",border:"1px solid var(--line-strong)",lineHeight:0},children:l.jsx("img",{src:`/notify/telegram/qr.svg?c=${encodeURIComponent(B.code)}`,alt:`QR: ${B.deepLink}`,width:132,height:132,style:{display:"block"}})}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:"var(--fs-sm)",minWidth:0},children:[l.jsx("div",{children:"Scan with your phone, or send this to your bot:"}),l.jsxs("code",{style:{alignSelf:"flex-start",fontFamily:"var(--font-mono)",fontSize:"var(--fs-lg)",padding:"4px 10px",background:"var(--bg-inset)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)"},children:["/start ",B.code]}),B.deepLink&&l.jsx("a",{href:B.deepLink,target:"_blank",rel:"noreferrer",style:{fontSize:"var(--fs-xs)",color:"var(--brand)",textDecoration:"none"},children:"Open in Telegram on this computer →"}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)",flexWrap:"wrap"},children:[l.jsx("span",{className:"pulse",style:{display:"inline-flex"},children:l.jsx(se,{name:"loading",size:12})}),"waiting… the code expires in 10 minutes",l.jsx(ie,{size:"sm",variant:"ghost",onClick:h,disabled:c,children:"New code"})]})]})]}):l.jsx("div",{children:l.jsx(ie,{size:"sm",variant:"primary",onClick:h,disabled:c||!z,title:z?"Shows a one-time code to send to your bot":"Store a bot token first",children:"Link a chat"})})),q("Foreman URL","Where links in messages point. A phone cannot open localhost — use a LAN or Tailscale address if you have one.",l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[l.jsx(We,{mono:!0,width:320,value:J,onChange:Z,placeholder:"http://localhost:4177"}),l.jsx(ie,{size:"sm",disabled:c||!re,onClick:()=>{b?.(J),Z(null)},children:"Save"})]}))]})}const Lc=[{id:"provider",label:"Provider",icon:"provider"},{id:"models",label:"Models",icon:"model"},{id:"budget",label:"Budget",icon:"budget"},{id:"approvals",label:"Approvals",icon:"approval"},{id:"appearance",label:"Appearance",icon:"sun"},{id:"notifications",label:"Notifications",icon:"needsYou"},{id:"projects",label:"Projects",icon:"folder"}],Wc={directorModel:"opus",workerModel:"sonnet",plannerModel:"sonnet",budgetCap:5,budgetWarnAt:80,budgetHardStop:!0,autoAllowReadOnly:!0,alwaysSurvivesResume:!0,toolPolicy:{Bash:"allow",Write:"allow",Edit:"allow",WebFetch:"allow",spawn_worker:"allow"},theme:"light",textSize:"default",density:"comfortable",showTimestamps:!0,notifyNeedsYou:!0,notifyDone:!0,notifyBudget:!0,sound:!1,gitBranchPerMission:!0,projectsRoot:"~/Projects",missionDir:".foreman",showHidden:!1},tb=[{value:"allow",label:"Allow"},{value:"ask",label:"Ask"},{value:"deny",label:"Deny"}],nb=["Bash","Write","Edit","WebFetch","spawn_worker"];function ab({instances:i=[],ollama:c,codex:u}){const o=[...i.map(d=>({icon:"orchestration",name:"Claude Code",detail:d.configDir,note:d.hasStoredLogin?"signed in":"no stored login"})),...c?[{icon:"model",name:"Ollama",detail:c.host,note:`${c.models.length} model${c.models.length===1?"":"s"}`}]:[],...u?[{icon:"provider",name:"Codex",detail:u.home,note:u.signedIn?"signed in":"not signed in"}]:[]];return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsxs("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",lineHeight:"var(--lh-prose)"},children:["A provider is chosen per project — open one and its tab appears beside",l.jsx("b",{style:{color:"var(--ink-0)"},children:" Global"})," above. These are what this machine can offer."]}),o.length===0&&l.jsx(Fe,{children:"Nothing detected. An Anthropic API key or any OpenAI-compatible endpoint still works."}),o.map((d,h)=>l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-inset)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)"},children:[l.jsx(se,{name:d.icon,size:14,color:"var(--ink-2)"}),l.jsx("span",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-medium)"},children:d.name}),l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.detail}),l.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:d.note})]},h))]})}function lb({global:i,project:c,projectName:u,models:o,modelsLoading:d,modelsNote:h,provider:g,providerInstances:y,providerOllama:b,providerCodex:v,providerHasKey:S,providerKeyBusy:x,providerKeyError:j,onStoreProviderKey:k,onClearProviderKey:U,notify:Z,scope:C,onScope:z,section:D,onSection:B,onSave:J,onClose:re,onUnlink:q,style:N}){const[$,Y]=m.useState(C??"global"),[de,Q]=m.useState(D??"models"),W=z?C:$,ge=z??Y,oe=B?D:de,ne=B??Q,[E,G]=m.useState({...Wc,...i}),[P,me]=m.useState({...c}),[xe,T]=m.useState(g??null),_=JSON.stringify(xe)!==JSON.stringify(g??null),F=JSON.stringify(E)!==JSON.stringify({...Wc,...i})||JSON.stringify(P)!==JSON.stringify({...c})||_,I=W==="project",ce=le=>I&&le in P?P[le]:E[le],ue=(le,Ne)=>I?me(Ge=>({...Ge,[le]:Ne})):G(Ge=>({...Ge,[le]:Ne})),be=le=>I&&le in P,Re=le=>me(Ne=>{const Ge={...Ne};return delete Ge[le],Ge}),ee=(le,Ne,Ge,bt)=>l.jsx(ar,{label:Ne,hint:Ge,overridden:be(le),inherits:I&&!be(le),onReset:()=>Re(le),children:bt}),te={models:l.jsxs(l.Fragment,{children:[ee("directorModel","Director","Plans, delegates, verifies. Opus by default; Fable for long-horizon work.",l.jsx(ln,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:ce("directorModel"),onChange:(le,Ne)=>{ue("directorModel",le),ue("directorProviderId",Ne?.providerId)}})),ee("workerModel","Workers","Implement scoped tasks. Cheaper models cut cost sharply.",l.jsx(ln,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:ce("workerModel"),onChange:(le,Ne)=>{ue("workerModel",le),ue("workerProviderId",Ne?.providerId)}})),ee("plannerModel","Planner","Talks the next mission through with you and reads the project. Conversation, not deep reasoning; Sonnet by default.",l.jsx(ln,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:ce("plannerModel"),onChange:le=>ue("plannerModel",le)})),!I&&ee("fleetPlannerModel","Fleet planner","The front desk on your phone: knows every project, opens planning, proposes, steers. Fast tool calls matter more than depth; follows the planner when unset.",l.jsx(ln,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:ce("fleetPlannerModel")||ce("plannerModel"),onChange:le=>ue("fleetPlannerModel",le)}))]}),budget:l.jsxs(l.Fragment,{children:[ee("budgetCap","Default cap per run","The composer starts here; you can change it per mission.",l.jsx(We,{type:"number",prefix:"$",min:0,step:1,width:110,value:ce("budgetCap"),onChange:le=>ue("budgetCap",le)})),ee("budgetWarnAt","Warn at","Meter turns amber and, if enabled, you get a notification.",l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[l.jsx(We,{type:"number",min:10,max:100,step:5,width:80,value:ce("budgetWarnAt"),onChange:le=>ue("budgetWarnAt",le)}),l.jsx("span",{style:{color:"var(--ink-2)"},children:"%"})]})),ee("budgetHardStop","Hard stop at cap","Off: the run pauses and asks instead of stopping.",l.jsx(Mt,{checked:ce("budgetHardStop"),onChange:le=>ue("budgetHardStop",le)}))]}),approvals:l.jsxs(l.Fragment,{children:[ee("autoAllowReadOnly","Auto-allow read-only tools","Read, Grep, Glob, LS never prompt.",l.jsx(Mt,{checked:ce("autoAllowReadOnly"),onChange:le=>ue("autoAllowReadOnly",le)})),ee("alwaysSurvivesResume","“Always (run)” survives resume","Grants made during a run carry into a resumed run.",l.jsx(Mt,{checked:ce("alwaysSurvivesResume"),onChange:le=>ue("alwaysSurvivesResume",le)})),l.jsx(ar,{label:"Guarded tools",hint:"Policy per tool. “Ask” escalates to an approval card; writes outside the project folder always ask.",overridden:be("toolPolicy"),inherits:I&&!be("toolPolicy"),onReset:()=>Re("toolPolicy"),stacked:!0,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:nb.map(le=>l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[l.jsx(se,{name:le,size:14,color:"var(--ink-2)"}),l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",flex:1},children:le}),l.jsx(dn,{size:"sm",tabs:tb,value:ce("toolPolicy")[le]||"ask",onChange:Ne=>ue("toolPolicy",{...ce("toolPolicy"),[le]:Ne})})]},le))})})]}),appearance:l.jsxs(l.Fragment,{children:[ee("theme","Theme",null,l.jsx(dn,{size:"sm",value:ce("theme"),onChange:le=>ue("theme",le),tabs:[{value:"system",label:"System"},{value:"dark",label:"Dark",icon:"moon"},{value:"light",label:"Light",icon:"sun"}]})),ee("textSize","Text size","Scales the whole interface. Anything but Default overrides your browser’s own font size.",l.jsx(dn,{size:"sm",value:ce("textSize"),onChange:le=>ue("textSize",le),tabs:[{value:"small",label:"Small"},{value:"default",label:"Default"},{value:"large",label:"Large"},{value:"larger",label:"Larger"}]})),ee("density","Density","Compact tightens transcript rows and rail padding.",l.jsx(dn,{size:"sm",value:ce("density"),onChange:le=>ue("density",le),tabs:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}]})),ee("showTimestamps","Timestamps in transcript",null,l.jsx(Mt,{checked:ce("showTimestamps"),onChange:le=>ue("showTimestamps",le)}))]}),notifications:l.jsxs(l.Fragment,{children:[ee("notifyNeedsYou","Needs you","An approval or question is waiting.",l.jsx(Mt,{checked:ce("notifyNeedsYou"),onChange:le=>ue("notifyNeedsYou",le)})),ee("notifyDone","Run finished","Done, errored or interrupted.",l.jsx(Mt,{checked:ce("notifyDone"),onChange:le=>ue("notifyDone",le)})),ee("notifyBudget","Budget warning","When spend crosses the warn threshold.",l.jsx(Mt,{checked:ce("notifyBudget"),onChange:le=>ue("notifyBudget",le)})),ee("sound","Sound",null,l.jsx(Mt,{checked:ce("sound"),onChange:le=>ue("sound",le)})),!I&&Z&&l.jsx(eb,{...Z})]}),provider:I?l.jsx(ar,{label:"Provider",hint:"Which engine runs this project's agents, who pays, and where requests go. Clearing it returns to the server default.",stacked:!0,children:l.jsx(P1,{value:xe,onChange:T,instances:y,ollama:b,hasKey:S,keyBusy:x,keyError:j,onStoreKey:k,onClearKey:U})}):l.jsx(ab,{instances:y,ollama:b,codex:v}),projects:l.jsxs(l.Fragment,{children:[!I&&ee("projectsRoot","Projects root","Where the folder picker opens.",l.jsx(We,{mono:!0,width:260,value:ce("projectsRoot"),onChange:le=>ue("projectsRoot",le)})),ee("missionDir","Mission folder","Relative to the project. Holds MISSION.md and run history.",l.jsx(We,{mono:!0,width:160,value:ce("missionDir"),onChange:le=>ue("missionDir",le)})),ee("gitBranchPerMission","Each mission on its own branch","In a git repository: Foreman creates foreman/<mission> from what is checked out, commits the work on it at the end, and never merges or pushes. Off: missions edit the current branch.",l.jsx(Mt,{checked:ce("gitBranchPerMission")!==!1,onChange:le=>ue("gitBranchPerMission",le)})),!I&&ee("showHidden","Show hidden folders in picker",null,l.jsx(Mt,{checked:ce("showHidden"),onChange:le=>ue("showHidden",le)})),I&&l.jsx(ar,{label:"Unlink this project",hint:"Removes it from the fleet. Files on disk are untouched.",danger:!0,children:l.jsx(ie,{variant:"danger",size:"sm",icon:"unlink",onClick:q,children:"Unlink"})})]})},we=Lc.find(le=>le.id===oe)||Lc[0];return l.jsxs(Di,{width:"51.25rem",onClose:re,dismissible:!1,style:{maxHeight:"82vh",height:"37.5rem",...N},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)"},children:[l.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:"Settings"}),l.jsx(dn,{size:"sm",value:W,onChange:ge,tabs:[...u?[{value:"project",label:u,icon:"folder"}]:[],{value:"global",label:"Global"}]}),l.jsx(Na,{icon:"close",label:"Close",onClick:re,style:{marginLeft:"auto"}})]}),l.jsxs("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:"11.25rem 1fr"},children:[l.jsx("nav",{style:{background:"var(--bg-inset)",borderRight:"1px solid var(--line)",padding:"var(--sp-2)",display:"flex",flexDirection:"column",gap:2},children:Lc.map(le=>l.jsx(rb,{s:le,selected:le.id===oe,dot:I&&(sb(le.id,P)||le.id==="provider"&&!!xe),onClick:()=>ne(le.id)},le.id))}),l.jsxs("div",{style:{minHeight:0,overflowY:"auto",padding:"var(--sp-3) var(--sp-5)"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",marginBottom:"var(--sp-2)"},children:[l.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:we.label}),I&&l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Overrides for ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:u}),". Rows without a change inherit global."]})]}),te[we.id]]})]}),l.jsxs(Ri,{children:[l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:F?"var(--status-warning)":"var(--ink-2)"},children:F?"Unsaved changes":"Nothing to save"}),l.jsxs("span",{style:{marginLeft:"auto",display:"flex",gap:"var(--sp-2)"},children:[l.jsx(ie,{onClick:re,children:"Cancel"}),l.jsx(ie,{variant:"primary",disabled:!F,onClick:()=>J?.({global:E,project:P,provider:_?xe:void 0}),children:"Save"})]})]})]})}const ib={models:["directorModel","workerModel","plannerModel","fleetPlannerModel","directorProviderId","workerProviderId"],budget:["budgetCap","budgetWarnAt","budgetHardStop"],approvals:["autoAllowReadOnly","alwaysSurvivesResume","toolPolicy"],appearance:["theme","density","showTimestamps"],notifications:["notifyNeedsYou","notifyDone","notifyBudget","sound"],projects:["missionDir","gitBranchPerMission"]};function sb(i,c){return(ib[i]||[]).some(u=>u in c)}function rb({s:i,selected:c,dot:u,onClick:o}){const[d,h]=m.useState(!1);return l.jsxs("button",{type:"button",onClick:o,"aria-current":c||void 0,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:"var(--r-sm)",border:"none",textAlign:"left",cursor:"pointer",font:"inherit",color:c?"var(--ink-0)":"var(--ink-1)",fontWeight:c?"var(--fw-semibold)":"var(--fw-regular)",background:c?"var(--bg-card)":d?"var(--bg-hover)":"transparent",boxShadow:c?"inset 0 0 0 1px var(--line-strong)":"none"},children:[l.jsx(se,{name:i.icon,size:14,color:c?"var(--brand)":"var(--ink-2)"}),l.jsx("span",{style:{flex:1},children:i.label}),u&&l.jsx("span",{title:"Has project overrides",style:{width:6,height:6,borderRadius:"var(--r-pill)",background:"var(--brand)"}})]})}function ar({label:i,hint:c,children:u,overridden:o,inherits:d,onReset:h,stacked:g,danger:y}){return l.jsxs("div",{style:{display:"grid",gridTemplateColumns:g?"1fr":"1fr auto",gap:g?10:"var(--sp-4)",alignItems:"center",padding:"var(--sp-3) 0",borderBottom:"1px solid var(--line)"},children:[l.jsxs("div",{style:{minWidth:0},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:y?"var(--status-critical)":"var(--ink-0)"},children:[l.jsx("span",{children:i}),d&&l.jsx(Mp,{children:"global"}),o&&l.jsxs(l.Fragment,{children:[l.jsx(Mp,{brand:!0,children:"override"}),l.jsx("button",{type:"button",onClick:h,style:{background:"none",border:0,padding:0,font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:"reset to global"})]})]}),c&&l.jsx("div",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",marginTop:2},children:c})]}),l.jsx("div",{style:{display:"flex",justifyContent:g?"stretch":"flex-end",minWidth:0},children:u})]})}function Mp({children:i,brand:c}){return l.jsx("span",{style:{fontSize:"var(--fs-xs)",letterSpacing:"0.06em",textTransform:"uppercase",padding:"1px 6px",borderRadius:"var(--r-pill)",background:c?"var(--brand-wash-strong)":"var(--bg-inset)",color:c?"var(--brand)":"var(--ink-2)",border:`1px solid ${c?"transparent":"var(--line)"}`},children:i})}function Ep({agent:i,status:c="running",task:u,selected:o,indent:d,last:h,onSelect:g,style:y}){const[b,v]=m.useState(!1);return l.jsxs("div",{style:{position:"relative",marginLeft:d?14:0},children:[d&&l.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:-8,top:0,bottom:h?"50%":0,borderLeft:"1px solid var(--line-strong)"}}),d&&l.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:-8,top:"50%",width:8,borderTop:"1px solid var(--line-strong)"}}),l.jsxs("div",{role:"button",title:u,onClick:()=>g?.(i),onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"6px 8px",borderRadius:"var(--r-sm)",cursor:"pointer",background:o?"var(--bg-card)":b?"var(--bg-hover)":"transparent",border:o?"1px solid var(--line-strong)":"1px solid transparent",transition:"background var(--dur-fast) var(--ease)",...y},children:[l.jsx(fn,{agent:i}),l.jsx("span",{style:{flex:1,minWidth:0,fontSize:"var(--fs-md)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),l.jsx(fa,{status:c})]})]})}function ob({agents:i=[],filter:c,onFilter:u,sessionId:o,details:d,style:h}){const g=i.find(v=>v.id==="director"),y=i.filter(v=>v.id!=="director"),b={margin:"0 0 6px 0",fontSize:"var(--fs-xs)",color:"var(--ink-1)",lineHeight:"var(--lh)",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"};return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)",...h},children:[l.jsxs("section",{style:{minWidth:0},children:[l.jsx(Rn,{children:"Crew"}),i.length===0&&l.jsx(Fe,{children:"No agents yet."}),g&&l.jsx(Ep,{agent:"director",status:g.status,selected:c==="director",onSelect:u}),y.map((v,S)=>l.jsxs(On.Fragment,{children:[l.jsx(Ep,{agent:v.id,status:v.status,task:v.task,indent:!0,last:S===y.length-1,selected:c===v.id,onSelect:u}),v.task&&l.jsx("div",{title:v.task,style:{...b,marginLeft:34},children:v.task})]},v.id)),c&&l.jsxs("div",{style:{marginTop:4,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Transcript shows only ",l.jsx("b",{style:{color:"var(--ink-1)"},children:c})," — click again to clear."]})]}),l.jsxs("section",{style:{minWidth:0},children:[l.jsx(Rn,{children:"Run"}),d??l.jsx(Fe,{children:"No run details."}),o&&l.jsxs("div",{style:{marginTop:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:["director session ",String(o).slice(0,8)]})]})]})}function cb({director:i,worker:c,budget:u,spent:o,models:d,loading:h,note:g,busy:y,onResume:b,style:v}){const[S,x]=m.useState(!1),[j,k]=m.useState({id:i||"",providerId:void 0}),[U,Z]=m.useState({id:c||"",providerId:void 0}),[C,z]=m.useState(u??0),D=m.useRef(null);m.useEffect(()=>{k({id:i||"",providerId:void 0}),Z({id:c||"",providerId:void 0}),z(u??0)},[i,c,u,S]),m.useEffect(()=>{if(!S)return;const $=de=>{D.current&&!D.current.contains(de.target)&&x(!1)},Y=de=>{de.key==="Escape"&&x(!1)};return document.addEventListener("mousedown",$),document.addEventListener("keydown",Y),()=>{document.removeEventListener("mousedown",$),document.removeEventListener("keydown",Y)}},[S]);const B=typeof u=="number"&&Number.isFinite(C)&&C>0&&Math.abs(C-u)>=.005,J=j.id&&j.id!==i||U.id&&U.id!==c||B,re=()=>{b?.({...j.id&&j.id!==i?{directorModel:j.id,directorProviderId:j.providerId}:{},...U.id&&U.id!==c?{workerModel:U.id,workerProviderId:U.providerId}:{},...B?{budgetUsd:Math.round(C*100)/100}:{}}),x(!1)},q=$=>z(Math.round((C+$)*100)/100),N={fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)",marginBottom:4};return l.jsxs("div",{ref:D,style:{position:"relative",display:"inline-flex",...v},children:[l.jsx(ie,{variant:"good",icon:"resume",disabled:y,title:"Restore the director's session and continue this mission",onClick:()=>b?.({}),style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:y?"Resuming…":"Resume"}),l.jsx(ie,{variant:"good",disabled:y,"aria-label":"Resume on other models",title:"Resume on other models…",onClick:()=>x(!S),style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid rgba(255,255,255,0.35)",paddingLeft:6,paddingRight:6},children:l.jsx(se,{name:"chevronDown",size:14})}),S&&l.jsxs("div",{role:"dialog","aria-label":"Resume on other models",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:50,width:340,background:"var(--bg-card)",border:"1px solid var(--line-strong)",borderRadius:"var(--r-md)",boxShadow:"0 12px 32px rgba(0,0,0,0.25)",padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsx("div",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-1)",lineHeight:"var(--lh)"},children:"Same mission, other terms. A new director starts a fresh session and reads the mission doc; workers change for the next spawns; a new cap applies from the first turn."}),typeof u=="number"&&l.jsxs("div",{children:[l.jsx("div",{style:N,children:"Budget cap"}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[l.jsx("span",{style:{color:"var(--ink-2)"},children:"$"}),l.jsx("input",{type:"number",min:"0.5",step:"0.5",value:C,onChange:$=>z(Number($.target.value)),style:{width:72,font:"inherit",fontFamily:"var(--font-mono)",padding:"4px 6px",border:"1px solid var(--line-strong)",borderRadius:"var(--r-sm)",background:"var(--bg-inset)",color:"var(--ink-0)"}}),l.jsx(ie,{size:"sm",onClick:()=>q(5),children:"+$5"}),l.jsx(ie,{size:"sm",onClick:()=>q(10),children:"+$10"}),l.jsx(ie,{size:"sm",onClick:()=>z(Math.round(u*2*100)/100),children:"×2"}),typeof o=="number"&&l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums"},children:["$",o.toFixed(2)," spent of $",u.toFixed(2)]})]})]}),l.jsxs("div",{children:[l.jsx("div",{style:N,children:"Director"}),l.jsx(ln,{block:!0,allowDefault:!1,models:d,loading:h,note:g,value:j.id,onChange:($,Y)=>k({id:$,providerId:Y?.providerId})})]}),l.jsxs("div",{children:[l.jsx("div",{style:N,children:"Workers"}),l.jsx(ln,{block:!0,allowDefault:!1,models:d,loading:h,note:g,value:U.id,onChange:($,Y)=>Z({id:$,providerId:Y?.providerId})})]}),l.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"var(--sp-2)"},children:[l.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>x(!1),children:"Cancel"}),l.jsx(ie,{variant:"good",size:"sm",icon:"resume",disabled:y||!J,onClick:re,title:J?"Resume on these terms":"Change a model or the cap first — or use Resume as is",children:"Resume"})]})]})]})}function ub(i,c){const u=Up(i.provider);return!i.provider||!u?c:i.provider.kind==="claude-code"?i.provider.ownLogin?`${u} (this project's own login)`:u:`${i.provider.kind} · ${u}`}function db(i){const c=`(min-width: ${i}px)`,[u,o]=m.useState(()=>typeof window<"u"&&window.matchMedia(c).matches);return m.useEffect(()=>{const d=window.matchMedia(c),h=()=>o(d.matches);return h(),d.addEventListener("change",h),()=>d.removeEventListener("change",h)},[c]),u}const fb=1100;function hb(i){const c=i.agents.filter(y=>y.status==="running"),u=c.filter(y=>y.id!=="director").length,o=c.length===0?"":[c.some(y=>y.id==="director")?"director":null,u?`${u} worker${u===1?"":"s"}`:null].filter(Boolean).join(" · ");let d=null;for(let y=i.entries.length-1;y>=0&&y>=i.entries.length-40;y--){const b=i.entries[y],v=b.kind==="system"&&b.title.startsWith("progress"),S=b.kind==="text"&&b.agent==="director";if(v||S){d=b;break}}if(!d){const y=c.find(b=>b.id!=="director"&&b.task);return y?{line:`${y.id}: ${y.task}`,agent:y.id,crew:o}:o?{line:"Crew is starting up",crew:o}:null}const h=d.body.split(`
66
+ `).find(y=>y.trim())??"";return{line:`${d.agent}: ${h.replace(/[*_`#>]/g,"").trim().slice(0,160)}`,agent:d.agent,crew:o}}function Ml({label:i,open:c,onToggle:u,children:o}){return l.jsxs("div",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-sm)",background:"var(--bg-panel)"},children:[l.jsxs("button",{type:"button",onClick:u,style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"6px 10px",background:"none",border:"none",cursor:"pointer",font:"inherit",textAlign:"left",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:[l.jsx(se,{name:c?"chevronDown":"chevronRight",size:12}),i]}),c&&l.jsx("div",{style:{padding:"0 10px 10px"},children:o})]})}const sv={width:"100%",maxWidth:"var(--spine-max)",margin:"0 auto",display:"flex",flexDirection:"column",gap:"var(--sp-2)",boxSizing:"border-box"},_p="foreman.transcriptOrder",Ap="foreman.timeline",lr=i=>new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"}),Dp="foreman.railWidth",$c=280,Rp=340;function pb(){const[i,c]=m.useState(()=>{try{return localStorage.getItem(_p)==="oldest"?"oldest":"newest"}catch{return"newest"}});return[i,u=>{c(u);try{localStorage.setItem(_p,u)}catch{}}]}function Op(i,c){return c==="newest"?0:i.scrollHeight}function vb({run:i,filter:c,jump:u,order:o,header:d}){const h=m.useRef(null),g=m.useRef(!0),[y,b]=m.useState(null),v=c?i.entries.filter(x=>x.agent===c):i.entries,S=o==="newest"?[...v].reverse():v;return m.useEffect(()=>{const x=h.current;x&&g.current&&(x.scrollTop=Op(x,o))},[S.length,o]),m.useEffect(()=>{g.current=!0;const x=h.current;x&&(x.scrollTop=Op(x,o))},[o]),m.useEffect(()=>{if(!u)return;g.current=!1;const x=requestAnimationFrame(()=>{document.getElementById(`entry-${u.id}`)?.scrollIntoView({behavior:"smooth",block:"center"}),b(u.id)}),j=setTimeout(()=>b(null),1600);return()=>{cancelAnimationFrame(x),clearTimeout(j)}},[u]),l.jsx("div",{ref:h,onScroll:x=>{const j=x.currentTarget;g.current=o==="newest"?j.scrollTop<60:j.scrollHeight-j.scrollTop-j.clientHeight<60},style:{overflowY:"auto",padding:"var(--sp-3)",minHeight:0,flex:1,display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:l.jsxs("div",{style:sv,children:[d,S.length===0&&l.jsx(Fe,{children:"Transcript will appear here."}),S.map(x=>l.jsx("div",{id:`entry-${x.id}`,style:{scrollMarginTop:8,borderRadius:"var(--r-sm)",outline:y===x.id?"2px solid var(--brand)":"none",transition:"outline-color var(--dur-fast) var(--ease)"},children:l.jsx(Ic,{agent:x.agent,title:x.title,dense:!0,kind:x.kind,body:x.body,ts:x.ts,to:x.to,timing:x.timing})},x.id))]})})}function gb(i){const[c,u]=m.useState({text:"",loaded:!1});return m.useEffect(()=>{let o=!1;const d=()=>_e.memory(i).then(async g=>{if(o||!g.ok)return;const y=await g.json();u({text:y.text??"",updatedAt:y.updatedAt,loaded:!0})}).catch(()=>{});d();const h=_i((g,y)=>{g==="memory_updated"&&y.projectId===i&&d()});return()=>{o=!0,h()}},[i]),c}function mb({memory:i}){const c=i.updatedAt?new Date(i.updatedAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null;return l.jsxs("section",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textTransform:"uppercase",letterSpacing:"var(--ls-caps)"},children:["Memory",c&&l.jsx("span",{style:{textTransform:"none",letterSpacing:0,marginLeft:"auto"},children:c})]}),i.loaded&&!i.text.trim()?l.jsxs(Fe,{children:["Nothing yet. The director writes ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:".foreman/MEMORY.md"})," at the end of a mission: how to run and test the project, ports and paths, conventions, traps. Every later crew and the planner read it first."]}):i.text.trim()?l.jsx("div",{title:"The project's notes for the next crew — .foreman/MEMORY.md. Edit it with any editor.",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",fontSize:"var(--fs-sm)",maxHeight:"40vh",overflowY:"auto"},children:l.jsx(Ai,{text:i.text})}):null]})}function yb({runId:i,onClose:c,onDone:u}){const[o,d]=m.useState(null),[h,g]=m.useState(""),[y,b]=m.useState(""),[v,S]=m.useState(""),[x,j]=m.useState(!1),[k,U]=m.useState(null);m.useEffect(()=>{let z=!1;return _e.prDraft(i).then(async D=>{const B=await D.json().catch(()=>({}));if(!z){if(!D.ok){g(B.error??`HTTP ${D.status}`);return}d(B),b(B.title),S(B.body)}}).catch(()=>{z||g("Could not reach the server.")}),()=>{z=!0}},[i]);const Z=async()=>{j(!0),g("");try{const z=await _e.openPr(i,y,v),D=await z.json().catch(()=>({}));if(!z.ok){g(D.error??`HTTP ${z.status}`);return}U(D),u(D.url)}finally{j(!1)}},C=o?.gh.present&&o.gh.authed&&/github\.com/.test(o.remote);return l.jsxs(Di,{width:640,onClose:x?void 0:c,children:[l.jsxs("div",{style:{padding:"var(--sp-3)",borderBottom:"1px solid var(--line)",display:"flex",flexDirection:"column",gap:4},children:[l.jsx("span",{style:{fontWeight:"var(--fw-semibold)"},children:"Open a pull request"}),o&&l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:[o.branch," → ",o.base,o.commits!==null?` · ${o.commits} commit${o.commits===1?"":"s"}`:""," · ",o.remote]})]}),l.jsxs("div",{style:{padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)",overflowY:"auto",minHeight:0},children:[!o&&!h&&l.jsx(Fe,{children:"Reading the branch…"}),o&&!k&&l.jsxs(l.Fragment,{children:[o.pr&&l.jsxs(lt,{tone:"readonly",inline:!0,children:["A pull request already exists for this branch: ",l.jsx("a",{href:o.pr,target:"_blank",rel:"noopener noreferrer",children:o.pr})]}),!o.onBranch&&l.jsxs(lt,{tone:"caution",inline:!0,children:["The folder is currently on another branch. The push sends ",o.branch," as it is in git, which is fine; just know what you are looking at locally."]}),o.dirty&&o.onBranch&&l.jsx(lt,{tone:"caution",inline:!0,children:"There are uncommitted changes in the folder. They are not part of this pull request."}),l.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Title",l.jsx(We,{value:y,onChange:b})]}),l.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Body",l.jsx(tv,{size:"mission",value:v,onChange:S})]}),l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["Create pushes ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o.branch})," to origin as you, with your own git credentials",C?l.jsxs(l.Fragment,{children:[", then opens the pull request with ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:"gh"}),"."]}):l.jsxs(l.Fragment,{children:[", then gives you the link to finish the pull request in the browser",o.gh.present?"":" (gh is not installed)","."]})," ","Nothing is merged."]})]}),k&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:[l.jsx("span",{children:k.method==="gh"?"Pull request opened.":"Branch pushed. Finish the pull request in the browser:"}),k.url&&l.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--font-mono)",wordBreak:"break-all"},children:k.url}),k.note&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:k.note})]}),h&&l.jsx(lt,{tone:"error",inline:!0,children:h})]}),l.jsxs(Ri,{children:[l.jsx("span",{style:{flex:1}}),l.jsx(ie,{onClick:c,disabled:x,children:k?"Close":"Cancel"}),o&&!k&&l.jsx(ie,{variant:"primary",disabled:x||!y.trim(),onClick:()=>{Z()},children:x?"Pushing…":C?"Push & create pull request":"Push & get the link"})]})]})}function xb({chat:i,folder:c,starting:u,error:o,models:d,modelsLoading:h,modelsNote:g,modelsInheritNote:y,onStart:b,onCompose:v,hasRuns:S,projectId:x,onSettings:j,recent:k=[],runsOn:U,onOpenRun:Z,onForkRun:C,forking:z=!1}){const[D,B]=m.useState(""),[J,re]=m.useState(""),[q,N]=m.useState(0),[$,Y]=m.useState(!1),de=ne=>{re(ne),N(E=>E+1)},Q=async(ne,E=[])=>{B("");try{await i.send(await Yp(x,ne,E))}catch(G){B(G.message)}},W=m.useRef(null),ge=m.useRef(!0);return m.useEffect(()=>{const ne=W.current;ne&&ge.current&&(ne.scrollTop=ne.scrollHeight)},[i.entries.length,i.proposal,i.thinking]),i.entries.length===0&&!i.thinking&&!i.question&&!i.proposal?l.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:l.jsxs("div",{style:{margin:"auto",width:"100%",maxWidth:"var(--composer-max)",padding:"var(--sp-4) var(--sp-3)",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[l.jsxs("div",{style:{textAlign:"center",display:"flex",flexDirection:"column",gap:"var(--sp-1)"},children:[l.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:k.length?"Pick up where you left off, or start something new":"What should this project do next?"}),l.jsx("span",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-2)"},children:k.length?"Open a run to see what it built, plan the next step from it, or describe something new below.":"Describe it, paste a spec or a screenshot, or pick a starter and edit it before sending."})]}),k.length>0&&l.jsxs("div",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-md)",background:"var(--bg-card)",overflow:"hidden"},children:[($?k:k.slice(0,4)).map((ne,E)=>{const G=ne.status!=="running",P=new Date(ne.createdAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"center",gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",borderTop:E>0?"1px solid var(--line)":"none"},children:[l.jsxs("button",{type:"button",onClick:()=>Z?.(ne.id),title:"Open this run",style:{minWidth:0,textAlign:"left",background:"none",border:0,padding:0,font:"inherit",color:"inherit",cursor:"pointer",display:"flex",flexDirection:"column",gap:2},children:[l.jsx("span",{style:{fontSize:"var(--fs-sm)",color:"var(--ink-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ne.title||ne.mission.split(`
67
+ `)[0]}),l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",display:"inline-flex",alignItems:"center",gap:"var(--sp-2)",fontVariantNumeric:"tabular-nums"},children:[l.jsx(fa,{status:ne.status}),l.jsx("span",{children:P}),da(ne)==="priced"&&l.jsxs("span",{children:["$",ne.costUsd.toFixed(2)]})]})]}),l.jsxs("span",{style:{display:"inline-flex",gap:"var(--sp-1)",flex:"0 0 auto"},children:[l.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>Z?.(ne.id),children:"Open"}),G&&l.jsx(ie,{size:"sm",icon:"steer",disabled:z||i.thinking,title:"Start a planning conversation seeded with what this run built",onClick:()=>C?.(ne.id),children:"Plan the next step"})]})]},ne.id)}),k.length>4&&l.jsx("div",{style:{borderTop:"1px solid var(--line)",padding:"4px var(--sp-2)"},children:l.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>Y(ne=>!ne),children:$?"Show the latest four":`Show all ${k.length} runs`})})]}),l.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(${k.length?150:200}px, 1fr))`,gap:"var(--sp-2)"},children:[...k.length?[]:[{t:"Survey the project",q:"Read this project and tell me what it is, how it is built, and what state it is in."}],{t:"Find risks worth a mission",q:"Audit this project for bugs, security holes and missing tests. Rank what you find and propose the one mission most worth running first."},{t:"Scope a feature",q:"I have a feature in mind. Ask me what you need to know to scope it, then draft the mission."},{t:"Plan a refactor",q:"Where is this codebase hardest to change? Propose one contained refactor with clear DONE WHEN criteria."}].map(ne=>l.jsxs("button",{type:"button",onClick:()=>de(ne.q),disabled:i.thinking,title:k.length?ne.q:void 0,style:{textAlign:"left",padding:k.length?"6px 10px":"8px 10px",background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",color:"inherit",display:"flex",flexDirection:"column",gap:2},children:[l.jsx("span",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)"},children:ne.t}),!k.length&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:ne.q})]},ne.t))}),l.jsx(Xc,{value:J,onChange:re,busy:i.thinking,who:i.who,onSend:(ne,E)=>{Q(ne,E)},onStop:()=>{i.stop()},onChangeModel:j,autoFocus:!0},q),D&&l.jsx(lt,{tone:"error",inline:!0,children:D}),l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",textAlign:"center"},children:["Planning reads the project and never changes it — a mission does that. Know what you want already? ",l.jsx("b",{style:{color:"var(--ink-1)"},children:"New mission"}),", top right."]}),U&&l.jsx("div",{style:{display:"flex",justifyContent:"center"},children:U})]})}):l.jsxs(l.Fragment,{children:[l.jsx("div",{ref:W,onScroll:ne=>{const E=ne.currentTarget;ge.current=E.scrollHeight-E.scrollTop-E.clientHeight<60},style:{flex:1,minHeight:0,overflowY:"auto",padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-2)"},children:l.jsxs("div",{style:sv,children:[i.entries.map((ne,E)=>{const G=lr(ne.ts),P=E>0?lr(i.entries[E-1].ts):null;return l.jsxs(On.Fragment,{children:[G!==P&&(E>0||G!==lr(Date.now()))&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",margin:"4px 0"},children:[l.jsx("span",{style:{flex:1,borderTop:"1px solid var(--line)"}}),l.jsx("span",{children:G===lr(Date.now())?"today":G}),l.jsx("span",{style:{flex:1,borderTop:"1px solid var(--line)"}})]}),l.jsx(Ic,{agent:ne.agent,title:ne.title,kind:ne.kind,body:ne.body,ts:ne.ts})]},ne.id)}),i.proposal&&l.jsx(M1,{mission:i.proposal.mission,doneWhen:i.proposal.doneWhen,budgetUsd:i.proposal.budgetUsd,rationale:i.proposal.rationale,browser:i.proposal.browser,directorModel:i.proposal.directorModel,workerModel:i.proposal.workerModel,directorProviderId:i.proposal.directorProviderId,workerProviderId:i.proposal.workerProviderId,modelRationale:i.proposal.modelRationale,models:d,modelsLoading:h,modelsNote:g,modelsInheritNote:y,busy:u,error:o,onStart:ne=>b(ne),onDismiss:i.dismissProposal})]})}),l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3) var(--sp-3)",flex:"0 0 auto",width:"100%",maxWidth:"var(--spine-max)",margin:"0 auto",boxSizing:"border-box"},children:[i.question?l.jsx(C1,{questions:i.question.questions,askedAt:i.question.askedAt,who:i.who,onAnswer:ne=>{i.answer(i.question.id,ne)},onFreeText:ne=>{Q(ne)}}):l.jsx(Xc,{busy:i.thinking,who:i.who,onSend:(ne,E)=>{Q(ne,E)},onStop:()=>{i.stop()},onChangeModel:j}),D&&l.jsx(lt,{tone:"error",inline:!0,style:{marginTop:4},children:D}),(i.costUsd>0||i.entries.length>0)&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"4px 2px 0",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[i.costUsd>0&&l.jsxs("span",{title:"What this conversation has cost so far. Planning is not charged to any mission budget.",style:{fontVariantNumeric:"tabular-nums"},children:["conversation $",i.costUsd.toFixed(3)]}),l.jsx("span",{style:{flex:1}}),i.thinking&&l.jsx(ie,{variant:"ghost",size:"sm",icon:"close",title:"Stop the planner and discard the rest of this reply",onClick:()=>{i.stop()},children:"Stop"}),i.entries.length>0&&l.jsx(ie,{variant:"ghost",size:"sm",icon:"close",disabled:i.thinking,title:i.thinking?"The planner is replying — clear once it has answered.":"Forget this conversation and start a new one",onClick:()=>{i.clear()},children:i.thinking?"Clear (after this reply)":"Clear conversation"})]})]}),l.jsxs("button",{type:"button",onClick:v,style:{flex:"0 0 auto",display:"flex",alignItems:"center",gap:6,margin:"0 auto var(--sp-3)",padding:"6px 10px",width:"calc(100% - 2 * var(--sp-3))",maxWidth:"calc(var(--spine-max) - 2 * var(--sp-3))",boxSizing:"border-box",background:"none",border:"1px dashed var(--line-strong)",borderRadius:"var(--r-sm)",cursor:"pointer",font:"inherit",fontSize:"var(--fs-xs)",color:"var(--ink-2)",textAlign:"left"},children:[l.jsx(se,{name:"write",size:12}),"Or skip the talk: describe the mission and start it",l.jsx(se,{name:"chevronRight",size:12,style:{marginLeft:"auto"}})]})]})}function bb({r:i,live:c,liveCost:u,liveBasis:o,liveUsage:d,liveTurns:h,onChanged:g}){const[y,b]=m.useState(!1),[v,S]=m.useState(""),x=!!c&&i.status==="running",j=async D=>{b(!0),S("");try{await _e.updateRun(i.id,D),g?.()}catch(B){S(B instanceof Error?B.message:String(B))}finally{b(!1)}},k=o??da(i),U=d??i.usage??null,Z=h??i.turns,C=[["director",i.directorModel||"default"],["workers",i.workerModel||"default"],["budget",k==="priced"?`$${((u??i.costUsd)||0).toFixed(2)} / $${i.budgetUsd.toFixed(2)}`:`${Ha(U?.inputTokens??0)} in · ${Ha(U?.outputTokens??0)} out${typeof Z=="number"?` · ${Z} turn${Z===1?"":"s"}`:""}`+(k==="unpriced"?" · cost not tracked":" · no per-token cost")]],z={color:"var(--ink-1)",fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};return l.jsxs("div",{style:{marginTop:8,fontSize:"var(--fs-xs)"},children:[l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:10,rowGap:2},children:[C.map(([D,B])=>l.jsxs(On.Fragment,{children:[l.jsx("span",{style:{color:"var(--ink-2)"},children:D}),l.jsx("span",{style:z,children:B})]},D)),l.jsx("span",{style:{color:"var(--ink-2)"},children:"browser"}),x?l.jsx("button",{type:"button",disabled:y,onClick:()=>{j({browserTools:!i.browserTools})},title:i.browserTools?"Turn off. No worker spawned after this gets a browser.":"Turn on. Workers spawned after this get a headless browser; the director itself gains it when the run is resumed.",style:{...z,justifySelf:"start",background:"none",padding:0,border:"none",borderBottom:"1px dashed var(--line-strong)",cursor:y?"wait":"pointer",font:"inherit",fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:i.browserTools?"on":"off"}):l.jsx("span",{style:z,children:i.browserTools?"on":"off"}),i.resumes?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--ink-2)"},children:"resumes"}),l.jsx("span",{style:z,children:i.resumes})]}):null]}),v&&l.jsx("div",{style:{marginTop:4,color:"var(--status-critical)"},children:v})]})}function jb({p:i,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,routeRunId:h,onSelectRun:g,routeTab:y,onSelectTab:b,onBack:v,refreshFleet:S,auth:x,theme:j,onToggleTheme:k,onSettings:U,settings:Z,search:C}){const z=Nm(i.id),D=gb(i.id),B={...Wc,...Z.global,...Z.project??{}},J=Object.keys(Z.project??{}),re=B.gitBranchPerMission!==!1,q=l.jsxs("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap",justifyContent:"center"},children:[l.jsx("span",{children:"missions here run on"}),l.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:[String(B.directorModel??"opus")," · ",String(B.workerModel??"sonnet")]}),l.jsx("span",{children:"· cap"}),l.jsxs("span",{style:{fontFamily:"var(--font-mono)",color:"var(--ink-1)"},children:["$",String(B.budgetCap??6)]}),i.git?.repo&&l.jsxs("span",{children:["· ",re?"each on its own branch":`on ${i.git.branch} directly`]}),J.length>0&&l.jsxs("span",{children:["· ",J.length," project override",J.length===1?"":"s"]}),l.jsx(ie,{variant:"ghost",size:"sm",icon:"settings",onClick:U,children:"Change…"})]}),N=i.activeRun?.id??null,$=h,Y=g;m.useEffect(()=>{N&&g(N)},[N]);const de=$!==null&&$===N,Q=Dm($,de),W=z.find(ae=>ae.id===$),ge=de&&Q.runStatus==="running",[oe,ne]=m.useState(null),[E,G]=m.useState(null),P=y,me=b,[xe,T]=m.useState(()=>{try{const ae=Number(localStorage.getItem(Dp));return ae>=$c?ae:Rp}catch{return Rp}}),_=ae=>{const Je=Math.max($c,Math.floor(window.innerWidth*.5)),en=Math.min(Je,Math.max($c,Math.round(ae)));T(en);try{localStorage.setItem(Dp,String(en))}catch{}},F=ae=>{ae.preventDefault();const Je=ae.clientX,en=xe,ma=Nl=>_(en+(Je-Nl.clientX)),Ln=()=>{window.removeEventListener("pointermove",ma),window.removeEventListener("pointerup",Ln),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",ma),window.addEventListener("pointerup",Ln)},I=ae=>{typeof ae.id=="number"&&(oe&&oe!==ae.agent&&ne(null),G({id:ae.id,n:Date.now()}))},ce=ae=>ne(oe===ae?null:ae),[ue,be]=m.useState(!1),[Re,ee]=pb(),[te,we]=m.useState(()=>{try{return localStorage.getItem(Ap)!=="closed"}catch{return!0}}),le=ae=>{we(ae);try{localStorage.setItem(Ap,ae?"open":"closed")}catch{}},[Ne,Ge]=m.useState(!1),[bt,ha]=m.useState(!1),[sn,Ua]=m.useState(!1),[Nn,Ba]=m.useState(!1),[qa,La]=m.useState(""),[El,mt]=m.useState(!1),[or,_l]=m.useState(!1),[Al,$a]=m.useState(!1),[hn,pa]=m.useState(null),Oi=W?.git?.pr;m.useEffect(()=>{if(!$||!Oi){pa(null);return}if(W?.git?.prState){pa({runId:$,state:W.git.prState});return}let ae=!1;return _e.prState($).then(async Je=>{const en=Je.ok?await Je.json():{state:null};ae||pa({runId:$,state:en.state})}).catch(()=>{ae||pa({runId:$,state:null})}),()=>{ae=!0}},[$,Oi,W?.git?.prState]);const Ni=async ae=>{La(""),mt(!0);try{const Je=await _e.forkPlan(i.id,ae);if(!Je.ok){La((await Je.json()).error);return}Y(null)}finally{mt(!1)}},[Hn,ct]=m.useState(""),[Ft,ut]=m.useState(!1),cr=$p(N?null:i.id),[Hi,Dl]=m.useState(!1),Ht=db(fb),Ut=u1($,ge),Jt=d1(i.id,$),It=Q.approvals.length+Q.questions.length,[Un,Bn]=m.useState(()=>Date.now());m.useEffect(()=>{if(It===0&&!ge)return;Bn(Date.now());const ae=setInterval(()=>Bn(Date.now()),1e4);return()=>clearInterval(ae)},[It,ge]),m.useEffect(()=>{ne(null)},[$]);const ur=m.useMemo(()=>ge?hb(Q):null,[ge,Q]),Ui=m.useMemo(()=>av(Q.missionDoc),[Q.missionDoc]),va=async(ae={})=>{if(!$)return;La(""),be(!0);const Je=await _e.resume($,ae).finally(()=>be(!1));Je.ok?S():La((await Je.json()).error)},qn=async ae=>{ct(""),ut(!0);let Je=ae.mission;try{Je=await Yp(i.id,ae.mission,ae.attachments??[])}catch(ma){ct(ma.message),ut(!1);return}const en=await _e.run(i.id,Je,ae.budget,{directorModel:ae.directorModel,workerModel:ae.workerModel,directorProviderId:ae.directorProviderId,workerProviderId:ae.workerProviderId,browserTools:ae.browserTools}).finally(()=>ut(!1));en.ok?S():ct((await en.json()).error)},dr=!N&&$===null,Ya=!N&&$&&(W?.status==="interrupted"||W?.status==="error")&&W?.directorSessionId,Bi=Ht&&W&&(W.directorModel||W.workerModel)?l.jsxs("span",{title:`director: ${W.directorModel||"default"} · workers: ${W.workerModel||"default"}`,style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:"var(--r-pill)",border:"1px solid var(--line)",background:"var(--bg-inset)",fontSize:"var(--fs-xs)",fontFamily:"var(--font-mono)",color:"var(--ink-1)",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[l.jsx(se,{name:"model",size:11}),W.directorModel||"default"," · ",W.workerModel||"default"]}):null,qi=W&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[l.jsx("div",{style:{fontSize:"var(--fs-sm)",fontWeight:"var(--fw-semibold)",color:"var(--ink-0)",lineHeight:"var(--lh)"},title:W.mission,children:W.title||W.mission.split(`
68
+ `).find(ae=>ae.trim())||"Untitled run"}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",flexWrap:"wrap"},children:[l.jsx("span",{children:new Date(W.createdAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),l.jsx(fa,{status:de?Q.runStatus:W.status}),!de&&l.jsx("span",{children:"read-only"})]})]}),ga=l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[z.length===0&&l.jsx(Fe,{children:"No runs yet."}),z.map(ae=>l.jsx(O1,{mission:ae.mission,title:ae.title,createdAt:ae.createdAt,costUsd:ae.costUsd,costBasis:da(ae),usage:ae.usage,status:ae.status,selected:ae.id===$,current:ae.id===N,onSelect:ae.id===$?void 0:()=>Y(ae.id)},ae.id))]}),Ga=(ae,Je)=>l.jsxs("aside",{style:{position:"relative",borderLeft:"1px solid var(--line)",background:"var(--bg-panel)",minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[l.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize the rail",title:"Drag to resize",onPointerDown:F,style:{position:"absolute",left:-4,top:0,bottom:0,width:8,cursor:"col-resize",zIndex:2}}),ae&&l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3) 0",flex:"0 0 auto"},children:ae}),l.jsx("div",{style:{minHeight:0,overflowY:"auto",padding:"var(--sp-3)"},children:Je})]}),Rl=l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[qi,l.jsx(L1,{doc:Q.missionDoc}),l.jsx(Ml,{label:"Mission doc",open:Ne,onToggle:()=>Ge(!Ne),children:l.jsx(v1,{doc:Q.missionDoc??void 0})}),D.text.trim()&&l.jsx(Ml,{label:"Project memory",open:Al,onToggle:()=>$a(!Al),children:l.jsx("div",{style:{fontSize:"var(--fs-sm)"},children:l.jsx(Ai,{text:D.text})})}),l.jsx(ob,{agents:Q.agents,filter:oe,onFilter:ce,sessionId:Q.directorSessionId,details:W&&l.jsx(bb,{r:W,live:de,liveCost:Q.costUsd,liveBasis:Q.costBasis,liveUsage:Q.usage,liveTurns:W.turns,onChanged:S})})]}),Ol=$?l.jsx(Z1,{runId:$,deck:Ut.deck,loading:Ut.loading,error:Ut.error,missing:Ut.missing,services:Q.services,tree:Jt}):null,Pt=Ut.deck?Ut.deck.totals.files+Ut.deck.artifacts.length:0,it=l.jsx(dn,{size:"sm",value:P,onChange:ae=>me(ae),tabs:[{value:"mission",label:"Mission"},{value:"files",label:"Files",count:Pt},{value:"runs",label:"Runs",count:z.length}]}),yt=l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:"0 0 auto",flexWrap:"wrap",padding:"6px var(--sp-3) 0",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[Q.agents.length>1&&l.jsx(R1,{agents:Q.agents,filter:oe,onFilter:ce}),l.jsx("span",{style:{flex:1}}),Q.entries.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(ie,{variant:"ghost",size:"sm",icon:"timeline",title:te?"Hide the timeline":"Show the swimlane timeline — click a tick to jump to its entry",onClick:()=>le(!te),children:"Timeline"}),l.jsx(ie,{variant:"ghost",size:"sm",icon:"sort",title:Re==="newest"?"Newest first — click to read oldest first":"Oldest first — click to read newest first",onClick:()=>ee(Re==="newest"?"oldest":"newest"),children:Re==="newest"?"Newest first":"Oldest first"})]})]}),pn=l.jsxs("div",{style:{minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[yt,te&&Q.entries.length>0&&l.jsx("div",{style:{padding:"6px var(--sp-3) 0",flex:"0 0 auto"},children:l.jsx("div",{style:{background:"var(--bg-panel)",border:"1px solid var(--line)",borderRadius:"var(--r-sm)",padding:"8px 10px"},children:l.jsx(h1,{agents:Q.agents,entries:Q.entries,live:ge,selected:oe,onSelect:ce,onTick:I})})}),!Ht&&l.jsxs("div",{style:{padding:"6px var(--sp-3) 0",flex:"0 0 auto",display:"flex",flexDirection:"column",gap:6},children:[l.jsx(Ml,{label:q1(Ui),open:bt,onToggle:()=>ha(!bt),children:Rl}),l.jsx(Ml,{label:`Files · ${Pt}`,open:sn,onToggle:()=>Ua(!sn),children:Ol}),l.jsx(Ml,{label:`Runs · ${z.length}`,open:Nn,onToggle:()=>Ba(!Nn),children:ga})]}),l.jsx(vb,{run:Q,filter:oe,jump:E,order:Re})]});return l.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[l.jsxs(Ip,{mode:"project",title:i.name,folder:i.folder,onBack:v,branch:W?.git?{name:W.git.branch,hint:`This mission runs on ${W.git.branch}, made from ${W.git.base}${W.git.commits!==void 0?` · ${W.git.commits} commit${W.git.commits===1?"":"s"} ahead`:""}`}:i.git?.repo&&i.git.branch?{name:i.git.branch,dirty:i.git.dirty}:null,theme:j,onToggleTheme:k,onSettings:U,search:C,children:[qa&&l.jsx(lt,{tone:"error",inline:!0,children:qa}),$&&(Q.runStatus==="running"&&It>0?l.jsx("span",{title:`Waiting on you: ${Q.approvals.length} approval(s), ${Q.questions.length} question(s)`,children:l.jsx(fa,{status:"needs-you"})}):l.jsx(fa,{status:Q.runStatus})),$&&l.jsx(ev,{spent:Q.costUsd,budget:Q.budgetUsd,detail:!0,costBasis:Q.costBasis,usage:Q.usage,turns:W?.turns,elapsedMs:W?.createdAt?(ge?Un:W.endedAt??Un)-W.createdAt:void 0}),Bi,ge&&l.jsx(ie,{variant:"danger",onClick:()=>{_e.interrupt($)},children:"Interrupt"}),Ya&&l.jsx(cb,{director:W?.directorModel,worker:W?.workerModel,budget:W?.budgetUsd,spent:W?.costUsd,models:c,loading:u,note:o,busy:ue,onResume:ae=>{va(ae)}}),!N&&$&&W&&W.status!=="running"&&l.jsx(ie,{variant:"good",icon:"write",disabled:El,title:"Start a new planning conversation that builds on what this mission did",onClick:()=>{Ni($)},children:El?"Opening…":"Plan the next step"}),!N&&$&&W?.git&&W.status!=="running"&&i.git?.remote&&(W.git.pr?l.jsxs(ie,{icon:hn?.state==="merged"?"check":hn?.state==="closed"?"close":"preview",onClick:()=>window.open(W.git.pr,"_blank","noopener"),title:`${W.git.pr}${hn?.state?` · ${hn.state}`:""}`,children:["Pull request",hn?.runId===$&&hn.state?` · ${hn.state}`:""," ↗"]}):l.jsx(ie,{icon:"steer",onClick:()=>_l(!0),title:`Push ${W.git.branch} and open a pull request against ${W.git.base}`,children:"Open pull request…"})),!N&&$&&l.jsx(ie,{variant:"primary",onClick:()=>Y(null),children:"New mission"}),!N&&!$&&!Hi&&l.jsx(ie,{variant:"primary",icon:"write",onClick:()=>Dl(!0),title:"Skip the talk: describe the mission and start it",children:"New mission"})]}),or&&$&&l.jsx(yb,{runId:$,onClose:()=>_l(!1),onDone:()=>S()}),$&&l.jsx(B1,{approvals:Q.approvals,questions:Q.questions,now:Un,running:ge,activity:ur,onAllow:ae=>{_e.permission(ae,"allow")},onAlways:ae=>{_e.permission(ae,"allow_always")},onDeny:ae=>{_e.permission(ae,"deny")},onAnswer:(ae,Je)=>{_e.answer(ae,Je)}}),(i.billingMode??x.mode)==="none"&&l.jsxs(lt,{tone:"caution",children:["This project has nothing to run on: Claude Code is not signed in on this machine. Sign in and restart Foreman, or give the project a provider of its own.",l.jsx(ie,{variant:"ghost",size:"sm",icon:"provider",style:{marginLeft:"var(--sp-2)"},onClick:()=>U("provider"),children:"Settings → Provider"})]}),Ya&&W?.stopReason==="budget"&&l.jsxs(lt,{tone:"caution",children:["This run stopped at its $",W.budgetUsd.toFixed(2)," cap with $",W.costUsd.toFixed(2)," spent. Raise the cap and continue:",[5,10].map(ae=>l.jsxs(ie,{variant:"good",size:"sm",icon:"resume",disabled:ue,style:{marginLeft:"var(--sp-2)"},onClick:()=>{va({budgetUsd:Math.round((W.budgetUsd+ae)*100)/100})},children:["+$",ae," & resume"]},ae)),l.jsx(ie,{variant:"good",size:"sm",icon:"resume",disabled:ue,style:{marginLeft:"var(--sp-2)"},onClick:()=>{va({budgetUsd:Math.round(W.budgetUsd*2*100)/100})},children:"Double & resume"})]}),Ya&&W?.stopReason&&W.stopReason!=="budget"&&l.jsxs(lt,{tone:"caution",children:["This run stopped at its ",W.stopReason==="turns"?"turn":W.stopReason==="time"?"time":"token"," cap. Resume continues it with a fresh allowance."]}),$&&!de&&l.jsxs(lt,{tone:"readonly",children:["Viewing a past run (read-only).",l.jsx(ie,{variant:"ghost",size:"sm",icon:"back",style:{marginLeft:"var(--sp-2)"},onClick:()=>Y(N??null),children:N?"Back to the live run":"Back to planning"})]}),dr?l.jsxs("div",{style:{flex:1,minHeight:0,minWidth:0,display:Ht?"grid":"flex",flexDirection:"column",gridTemplateColumns:Ht?`minmax(0, 1fr) ${xe}px`:void 0},children:[l.jsxs("div",{style:{minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[!Ht&&z.length>0&&l.jsx("div",{style:{padding:"6px var(--sp-3) 0",flex:"0 0 auto"},children:l.jsx(Ml,{label:`Runs · ${z.length}`,open:Nn,onToggle:()=>Ba(!Nn),children:ga})}),Hi?l.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:[l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3) 0",flex:"0 0 auto"},children:l.jsx(ie,{variant:"ghost",size:"sm",icon:"back",onClick:()=>Dl(!1),children:"Back to the conversation"})}),l.jsxs("div",{style:{margin:"auto",width:"100%",padding:"var(--sp-4) 0 var(--sp-5)"},children:[l.jsx(T1,{folder:i.folder,defaultBudgetUsd:i.defaultBudgetUsd,error:Hn,busy:Ft,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,onStart:ae=>{qn(ae)},style:{background:"var(--bg-panel)",border:"1px solid var(--line)",borderRadius:"var(--r-md)",padding:"var(--sp-5)",margin:"0 auto",boxSizing:"border-box"}}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",flexWrap:"wrap",margin:"var(--sp-3) auto 0",maxWidth:"var(--composer-max)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:[l.jsx(Qp,{mode:i.billingMode??x.mode,compact:!0,account:x.account,source:ub(i,x.source)}),l.jsxs("span",{style:{fontFamily:"var(--font-mono)"},children:["runs on ",Up(i.provider)??"the server default instance"]}),i.git?.repo&&l.jsxs("span",{title:re?"Foreman creates the branch from what is checked out, commits the mission's work on it at the end, and never merges or pushes. Settings → Projects turns this off.":"The mission edits the current branch. Settings → Projects can give each mission a branch of its own.",children:["· ",re?l.jsxs(l.Fragment,{children:["on its own branch from ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i.git.branch})]}):l.jsxs(l.Fragment,{children:["on ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i.git.branch})," directly"]})]})]})]})]}):l.jsx(l.Fragment,{children:l.jsx(xb,{chat:cr,folder:i.folder,starting:Ft,error:Hn,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,onStart:ae=>{qn(ae)},onCompose:()=>Dl(!0),hasRuns:z.length>0,recent:z,runsOn:q,onOpenRun:ae=>Y(ae),onForkRun:ae=>{Ni(ae)},forking:El,projectId:i.id,onSettings:U})})]}),Ht&&Ga(null,l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[l.jsx(mb,{memory:D}),l.jsx(Vc,{files:Jt.files,truncated:Jt.truncated,loading:Jt.loading,error:Jt.error,onRefresh:Jt.refresh,urlBase:`/projects/${encodeURIComponent(i.id)}`},i.id)]}))]}):l.jsxs("main",{style:{flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[Ht?l.jsxs("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:`minmax(0, 1fr) ${xe}px`},children:[pn,Ga(it,P==="mission"?Rl:P==="files"?Ol:ga)]}):l.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:pn}),de&&l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3) var(--sp-3)",flex:"0 0 auto"},children:l.jsx(_1,{agents:[{id:"director",status:Q.runStatus==="running"?"running":"done"}],to:"director",onTo:()=>{},timing:"next",onTiming:()=>{},disabled:Q.runStatus!=="running",disabledReason:"Run finished — start a new mission.",onSend:ae=>{_e.steer($,ae)}})})]})]})}const Np={small:.88,default:1,large:1.15,larger:1.3};function Sb(){const i=m.useCallback(c=>{const u=Np[c]??1;document.documentElement.style.setProperty("--ui-scale",String(u));try{localStorage.setItem("foreman:textSize",c)}catch{}},[]);return m.useEffect(()=>{let c=null;try{c=localStorage.getItem("foreman:textSize")}catch{}c&&c in Np&&i(c)},[i]),i}function kb(){const[i,c]=m.useState(()=>localStorage.getItem("foreman:theme")||"light");m.useEffect(()=>{document.documentElement.dataset.theme=i,localStorage.setItem("foreman:theme",i)},[i]);const u=m.useCallback(o=>{c(o==="system"?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":o)},[]);return[i,()=>c(o=>o==="dark"?"light":"dark"),u]}function wb(i){const[c,u]=m.useState({models:null,loading:!0});return m.useEffect(()=>{let o=!0;u(h=>({...h,loading:!0}));const d=i?`/models?projectId=${encodeURIComponent(i)}`:"/models";return fetch(d).then(h=>h.ok?h.json():null).then(h=>{if(o){if(!h)return u({models:null,loading:!1});u({models:h.models,loading:!1,note:h.reachable===!1?`Cannot reach ${h.endpoint??"this project’s endpoint"}.`:h.models?.length===0?"This endpoint has no models installed.":void 0,inheritNote:h.provider&&h.provider!=="claude-code"?"inherits this project’s provider default":void 0})}}).catch(()=>o&&u({models:null,loading:!1})),()=>{o=!1}},[i]),c}function zb(i){const[c,u]=m.useState({instances:[],ollama:null,codex:null});return m.useEffect(()=>{if(!i)return;let o=!0;return fetch("/instances").then(d=>d.ok?d.json():null).then(d=>{o&&d&&u({instances:d.instances??[],ollama:d.ollama??null,codex:d.codex??null})}).catch(()=>{}),()=>{o=!1}},[i]),c}function Tb(){const{projects:i,connected:c,auth:u,refresh:o,activity:d,update:h,version:g,firstRun:y}=Om(),{setup:b,projectId:v,runId:S,tab:x,go:j,goRun:k}=Lm(),[U,Z,C]=kb(),z=Sb(),D=wb(v),[B,J]=m.useState({global:{},projects:{}}),[re,q]=m.useState(!1),[N,$]=m.useState("models"),Y=te=>{te&&$(te),q(!0)},de=zb(re);m.useEffect(()=>{fetch("/settings").then(te=>te.ok?te.json():null).then(te=>te&&J(te)).catch(()=>{})},[]);const Q=v?i.find(te=>te.id===v):null,[W,ge]=m.useState(!1),[oe,ne]=m.useState(""),E=async(te,we)=>{ne(""),ge(!0);const le=await(we===null?_e.clearProviderKey(te):_e.setProviderKey(te,we)).finally(()=>ge(!1));le.ok?o():ne((await le.json().catch(()=>({}))).error??"could not save the key")},G=async te=>{const we={global:te.global,projects:{...B.projects}};Q&&(Object.keys(te.project).length?we.projects[Q.id]=te.project:delete we.projects[Q.id]),J(we),q(!1),te.global.theme&&C(te.global.theme),te.global.textSize&&z(te.global.textSize),await fetch("/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({global:te.global,projectId:Q?.id,project:Q?we.projects[Q.id]??{}:void 0})}).catch(()=>{}),Q&&te.provider!==void 0&&(await _e.updateProject(Q.id,{provider:te.provider}).catch(()=>{}),o())},[P,me]=m.useState(""),xe=P.trim().toLowerCase(),T=Um(xe),_=te=>new Date(te).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),F=xe?i.filter(te=>[te.name,te.folder].some(we=>we.toLowerCase().includes(xe))).slice(0,8):[],I=[{id:"act-fleet",title:"Fleet",detail:"The board: what needs you, what is running, what finished",icon:"back",keys:"fleet home board",onPick:()=>j(null)},{id:"act-settings",title:"Settings",detail:Q?`Global, and ${Q.name}'s overrides`:"Models, budget, approvals, notifications",icon:"settings",keys:"settings preferences models budget telegram",onPick:()=>q(!0)},...Q?[{id:"act-plan",title:`Plan in ${Q.name}`,detail:"Back to the planning conversation",icon:"steer",keys:"plan planner mission new",onPick:()=>j(Q.id)}]:[]].filter(te=>xe&&(te.title.toLowerCase().includes(xe)||te.keys.includes(xe))),ce=[{label:"Projects",items:F.map(te=>({id:`p-${te.id}`,title:te.name,detail:te.folder,icon:"folder",onPick:()=>j(te.id)}))},{label:"Runs",count:T.hits.length>=30?30:void 0,items:T.hits.map(te=>({id:`r-${te.id}`,title:te.title||te.mission,detail:`${te.projectName}${te.title?` · ${te.mission}`:""}`,icon:"idle",status:te.status,meta:`${_(te.endedAt??te.createdAt)}${te.costBasis==="priced"?` · $${te.costUsd.toFixed(2)}`:""}`,onPick:()=>{te.projectId&&k(te.projectId,te.id)}}))},{label:"Actions",items:I}],ue=l.jsx(x0,{value:P,onChange:me,groups:ce,busy:T.busy}),be={theme:U,onToggleTheme:Z,search:ue,onSettings:te=>Y(te),auth:u},Re=qm(),ee=Re.status?Re.status.telegram.chatId?Re.status.telegram.chatLabel??"linked":null:void 0;return l.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[l.jsx("div",{style:{flex:1,minHeight:0},children:b||y===!0&&!Q?l.jsx(o1,{onDone:()=>{_e.setupDone().then(()=>o()),b&&j(null)},onSettings:te=>Y(te)}):Q?l.jsx(jb,{p:Q,models:D.models,modelsLoading:D.loading,modelsNote:D.note,modelsInheritNote:D.inheritNote,routeRunId:S,onSelectRun:te=>k(Q.id,te),routeTab:x,onSelectTab:te=>S&&k(Q.id,S,te),onBack:()=>j(null),refreshFleet:o,settings:{global:B.global,project:B.projects[Q.id]},...be}):l.jsx(s1,{projects:i,connected:c,activity:d,onOpen:te=>j(te),onOpenRun:(te,we)=>k(te,we),refresh:o,query:P,onQuery:me,...be})}),l.jsx(j0,{connected:c,localUrl:window.location.origin,publicUrl:Re.status?.publicUrl,phone:ee,auth:u,version:g,update:h,onOpenSettings:Y}),re&&l.jsx(lb,{scope:Q?"project":"global",section:N,onSection:$,global:B.global,project:Q?B.projects[Q.id]:void 0,projectName:Q?.name,models:D.models,modelsLoading:D.loading,modelsNote:D.note,provider:Q?.provider??null,providerInstances:de.instances,providerOllama:de.ollama,providerCodex:de.codex,providerHasKey:Q?.providerHasKey,providerKeyBusy:W,providerKeyError:oe,onStoreProviderKey:(te,we)=>{E(te,we)},onClearProviderKey:te=>{E(te,null)},notify:Re,onSave:te=>{G(te)},onClose:()=>q(!1)})]})}Tm.createRoot(document.getElementById("root")).render(l.jsx(m.StrictMode,{children:l.jsx(Tb,{})}));