@amenophis1er/foreman 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/gitwork.test.ts +39 -1
- package/src/gitwork.ts +66 -0
- package/src/orchestrator.ts +20 -9
- package/src/server.ts +86 -12
- package/src/services.test.ts +46 -1
- package/src/services.ts +62 -3
- package/src/types.ts +1 -1
- package/ui/dist/assets/index-DOVnExqF.js +68 -0
- package/ui/dist/index.html +1 -1
- package/ui/dist/assets/index-CnCv2QiH.js +0 -68
|
@@ -0,0 +1,68 @@
|
|
|
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:{}},ji={};var Xh;function mm(){if(Xh)return ji;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 ji.Fragment=c,ji.jsx=u,ji.jsxs=u,ji}var Qh;function ym(){return Qh||(Qh=1,bc.exports=mm()),bc.exports}var l=ym(),jc={exports:{}},be={};var Vh;function xm(){if(Vh)return be;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(C){return C===null||typeof C!="object"?null:(C=j&&C[j]||C["@@iterator"],typeof C=="function"?C:null)}var O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},K=Object.assign,M={};function T(C,_,J){this.props=C,this.context=_,this.refs=M,this.updater=J||O}T.prototype.isReactComponent={},T.prototype.setState=function(C,_){if(typeof C!="object"&&typeof C!="function"&&C!=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,C,_,"setState")},T.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function D(){}D.prototype=T.prototype;function B(C,_,J){this.props=C,this.context=_,this.refs=M,this.updater=J||O}var F=B.prototype=new D;F.constructor=B,K(F,T.prototype),F.isPureReactComponent=!0;var se=Array.isArray;function q(){}var U={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function G(C,_,J){var te=J.ref;return{$$typeof:i,type:C,key:_,ref:te!==void 0?te:null,props:J}}function ue(C,_){return G(C.type,_,C.props)}function ne(C){return typeof C=="object"&&C!==null&&C.$$typeof===i}function P(C){var _={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(J){return _[J]})}var je=/\/+/g;function X(C,_){return typeof C=="object"&&C!==null&&C.key!=null?P(""+C.key):_.toString(36)}function ye(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(q,q):(C.status="pending",C.then(function(_){C.status==="pending"&&(C.status="fulfilled",C.value=_)},function(_){C.status==="pending"&&(C.status="rejected",C.reason=_)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function z(C,_,J,te,re){var oe=typeof C;(oe==="undefined"||oe==="boolean")&&(C=null);var xe=!1;if(C===null)xe=!0;else switch(oe){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(C.$$typeof){case i:case c:xe=!0;break;case S:return xe=C._init,z(xe(C._payload),_,J,te,re)}}if(xe)return re=re(C),xe=te===""?"."+X(C,0):te,se(re)?(J="",xe!=null&&(J=xe.replace(je,"$&/")+"/"),z(re,_,J,"",function(Q){return Q})):re!=null&&(ne(re)&&(re=ue(re,J+(re.key==null||C&&C.key===re.key?"":(""+re.key).replace(je,"$&/")+"/")+xe)),_.push(re)),1;xe=0;var Ae=te===""?".":te+":";if(se(C))for(var me=0;me<C.length;me++)te=C[me],oe=Ae+X(te,me),xe+=z(te,_,J,oe,re);else if(me=k(C),typeof me=="function")for(C=me.call(C),me=0;!(te=C.next()).done;)te=te.value,oe=Ae+X(te,me++),xe+=z(te,_,J,oe,re);else if(oe==="object"){if(typeof C.then=="function")return z(ye(C),_,J,te,re);throw _=String(C),Error("Objects are not valid as a React child (found: "+(_==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":_)+"). If you meant to render a collection of children, use an array instead.")}return xe}function L(C,_,J){if(C==null)return C;var te=[],re=0;return z(C,te,"","",function(oe){return _.call(J,oe,re++)}),te}function ee(C){if(C._status===-1){var _=C._result;_=_(),_.then(function(J){(C._status===0||C._status===-1)&&(C._status=1,C._result=J)},function(J){(C._status===0||C._status===-1)&&(C._status=2,C._result=J)}),C._status===-1&&(C._status=0,C._result=_)}if(C._status===1)return C._result.default;throw C._result}var he=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var _=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof C=="object"&&C!==null&&typeof C.message=="string"?String(C.message):String(C),error:C});if(!window.dispatchEvent(_))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}console.error(C)},ve={map:L,forEach:function(C,_,J){L(C,function(){_.apply(this,arguments)},J)},count:function(C){var _=0;return L(C,function(){_++}),_},toArray:function(C){return L(C,function(_){return _})||[]},only:function(C){if(!ne(C))throw Error("React.Children.only expected to receive a single React element child.");return C}};return be.Activity=b,be.Children=ve,be.Component=T,be.Fragment=u,be.Profiler=d,be.PureComponent=B,be.StrictMode=o,be.Suspense=x,be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,be.__COMPILER_RUNTIME={__proto__:null,c:function(C){return U.H.useMemoCache(C)}},be.cache=function(C){return function(){return C.apply(null,arguments)}},be.cacheSignal=function(){return null},be.cloneElement=function(C,_,J){if(C==null)throw Error("The argument must be a React element, but you passed "+C+".");var te=K({},C.props),re=C.key;if(_!=null)for(oe in _.key!==void 0&&(re=""+_.key),_)!$.call(_,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&_.ref===void 0||(te[oe]=_[oe]);var oe=arguments.length-2;if(oe===1)te.children=J;else if(1<oe){for(var xe=Array(oe),Ae=0;Ae<oe;Ae++)xe[Ae]=arguments[Ae+2];te.children=xe}return G(C.type,re,te)},be.createContext=function(C){return C={$$typeof:g,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null},C.Provider=C,C.Consumer={$$typeof:h,_context:C},C},be.createElement=function(C,_,J){var te,re={},oe=null;if(_!=null)for(te in _.key!==void 0&&(oe=""+_.key),_)$.call(_,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(re[te]=_[te]);var xe=arguments.length-2;if(xe===1)re.children=J;else if(1<xe){for(var Ae=Array(xe),me=0;me<xe;me++)Ae[me]=arguments[me+2];re.children=Ae}if(C&&C.defaultProps)for(te in xe=C.defaultProps,xe)re[te]===void 0&&(re[te]=xe[te]);return G(C,oe,re)},be.createRef=function(){return{current:null}},be.forwardRef=function(C){return{$$typeof:y,render:C}},be.isValidElement=ne,be.lazy=function(C){return{$$typeof:S,_payload:{_status:-1,_result:C},_init:ee}},be.memo=function(C,_){return{$$typeof:v,type:C,compare:_===void 0?null:_}},be.startTransition=function(C){var _=U.T,J={};U.T=J;try{var te=C(),re=U.S;re!==null&&re(J,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(q,he)}catch(oe){he(oe)}finally{_!==null&&J.types!==null&&(_.types=J.types),U.T=_}},be.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},be.use=function(C){return U.H.use(C)},be.useActionState=function(C,_,J){return U.H.useActionState(C,_,J)},be.useCallback=function(C,_){return U.H.useCallback(C,_)},be.useContext=function(C){return U.H.useContext(C)},be.useDebugValue=function(){},be.useDeferredValue=function(C,_){return U.H.useDeferredValue(C,_)},be.useEffect=function(C,_){return U.H.useEffect(C,_)},be.useEffectEvent=function(C){return U.H.useEffectEvent(C)},be.useId=function(){return U.H.useId()},be.useImperativeHandle=function(C,_,J){return U.H.useImperativeHandle(C,_,J)},be.useInsertionEffect=function(C,_){return U.H.useInsertionEffect(C,_)},be.useLayoutEffect=function(C,_){return U.H.useLayoutEffect(C,_)},be.useMemo=function(C,_){return U.H.useMemo(C,_)},be.useOptimistic=function(C,_){return U.H.useOptimistic(C,_)},be.useReducer=function(C,_,J){return U.H.useReducer(C,_,J)},be.useRef=function(C){return U.H.useRef(C)},be.useState=function(C){return U.H.useState(C)},be.useSyncExternalStore=function(C,_,J){return U.H.useSyncExternalStore(C,_,J)},be.useTransition=function(){return U.H.useTransition()},be.version="19.2.8",be}var Wh;function Kc(){return Wh||(Wh=1,jc.exports=xm()),jc.exports}var m=Kc();const vn=gm(m);var Sc={exports:{}},Si={},kc={exports:{}},wc={};var Kh;function bm(){return Kh||(Kh=1,(function(i){function c(z,L){var ee=z.length;z.push(L);e:for(;0<ee;){var he=ee-1>>>1,ve=z[he];if(0<d(ve,L))z[he]=L,z[ee]=ve,ee=he;else break e}}function u(z){return z.length===0?null:z[0]}function o(z){if(z.length===0)return null;var L=z[0],ee=z.pop();if(ee!==L){z[0]=ee;e:for(var he=0,ve=z.length,C=ve>>>1;he<C;){var _=2*(he+1)-1,J=z[_],te=_+1,re=z[te];if(0>d(J,ee))te<ve&&0>d(re,J)?(z[he]=re,z[te]=ee,he=te):(z[he]=J,z[_]=ee,he=_);else if(te<ve&&0>d(re,ee))z[he]=re,z[te]=ee,he=te;else break e}}return L}function d(z,L){var ee=z.sortIndex-L.sortIndex;return ee!==0?ee:z.id-L.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,O=!1,K=!1,M=!1,T=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function F(z){for(var L=u(v);L!==null;){if(L.callback===null)o(v);else if(L.startTime<=z)o(v),L.sortIndex=L.expirationTime,c(x,L);else break;L=u(v)}}function se(z){if(K=!1,F(z),!O)if(u(x)!==null)O=!0,q||(q=!0,P());else{var L=u(v);L!==null&&ye(se,L.startTime-z)}}var q=!1,U=-1,$=5,G=-1;function ue(){return M?!0:!(i.unstable_now()-G<$)}function ne(){if(M=!1,q){var z=i.unstable_now();G=z;var L=!0;try{e:{O=!1,K&&(K=!1,D(U),U=-1),k=!0;var ee=j;try{t:{for(F(z),b=u(x);b!==null&&!(b.expirationTime>z&&ue());){var he=b.callback;if(typeof he=="function"){b.callback=null,j=b.priorityLevel;var ve=he(b.expirationTime<=z);if(z=i.unstable_now(),typeof ve=="function"){b.callback=ve,F(z),L=!0;break t}b===u(x)&&o(x),F(z)}else o(x);b=u(x)}if(b!==null)L=!0;else{var C=u(v);C!==null&&ye(se,C.startTime-z),L=!1}}break e}finally{b=null,j=ee,k=!1}L=void 0}}finally{L?P():q=!1}}}var P;if(typeof B=="function")P=function(){B(ne)};else if(typeof MessageChannel<"u"){var je=new MessageChannel,X=je.port2;je.port1.onmessage=ne,P=function(){X.postMessage(null)}}else P=function(){T(ne,0)};function ye(z,L){U=T(function(){z(i.unstable_now())},L)}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(z){z.callback=null},i.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<z?Math.floor(1e3/z):5},i.unstable_getCurrentPriorityLevel=function(){return j},i.unstable_next=function(z){switch(j){case 1:case 2:case 3:var L=3;break;default:L=j}var ee=j;j=L;try{return z()}finally{j=ee}},i.unstable_requestPaint=function(){M=!0},i.unstable_runWithPriority=function(z,L){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var ee=j;j=z;try{return L()}finally{j=ee}},i.unstable_scheduleCallback=function(z,L,ee){var he=i.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?he+ee:he):ee=he,z){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=ee+ve,z={id:S++,callback:L,priorityLevel:z,startTime:ee,expirationTime:ve,sortIndex:-1},ee>he?(z.sortIndex=ee,c(v,z),u(x)===null&&z===u(v)&&(K?(D(U),U=-1):K=!0,ye(se,ee-he))):(z.sortIndex=ve,c(x,z),O||k||(O=!0,q||(q=!0,P()))),z},i.unstable_shouldYield=ue,i.unstable_wrapCallback=function(z){var L=j;return function(){var ee=j;j=L;try{return z.apply(this,arguments)}finally{j=ee}}}})(wc)),wc}var Zh;function jm(){return Zh||(Zh=1,kc.exports=bm()),kc.exports}var zc={exports:{}},bt={};var Fh;function Sm(){if(Fh)return bt;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 bt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,bt.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)},bt.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()}},bt.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))},bt.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},bt.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})}},bt.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)},bt.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})}},bt.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)},bt.requestFormReset=function(x){o.d.r(x)},bt.unstable_batchedUpdates=function(x,v){return x(v)},bt.useFormState=function(x,v,S){return g.H.useFormState(x,v,S)},bt.useFormStatus=function(){return g.H.useHostTransitionStatus()},bt.version="19.2.8",bt}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 Si;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,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 x(s),e;if(r===a)return x(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 b=Object.assign,j=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),K=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),B=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),ue=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.iterator;function P(e){return e===null||typeof e!="object"?null:(e=ne&&e[ne]||e["@@iterator"],typeof e=="function"?e:null)}var je=Symbol.for("react.client.reference");function X(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===je?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case K:return"Fragment";case T:return"Profiler";case M:return"StrictMode";case se:return"Suspense";case q:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case O:return"Portal";case B: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 U:return t=e.displayName||null,t!==null?t:X(e.type)||"Memo";case $:t=e._payload,e=e._init;try{return X(e(t))}catch{}}return null}var ye=Array.isArray,z=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=u.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},he=[],ve=-1;function C(e){return{current:e}}function _(e){0>ve||(e.current=he[ve],he[ve]=null,ve--)}function J(e,t){ve++,he[ve]=e.current,e.current=t}var te=C(null),re=C(null),oe=C(null),xe=C(null);function Ae(e,t){switch(J(oe,t),J(re,e),J(te,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}}_(te),J(te,e)}function me(){_(te),_(re),_(oe)}function Q(e){e.memoizedState!==null&&J(xe,e);var t=te.current,n=ph(t,e.type);t!==n&&(J(re,e),J(te,n))}function we(e){re.current===e&&(_(te),_(re)),xe.current===e&&(_(xe),mi._currentValue=ee)}var I,We;function Ue(e){if(I===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);I=t&&t[1]||"",We=-1<n.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+I+e+We}var jt=!1;function qt(e,t){if(!e||jt)return"";jt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var Z=function(){throw Error()};if(Object.defineProperty(Z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Z,[])}catch(Y){var H=Y}Reflect.construct(e,[],Z)}else{try{Z.call()}catch(Y){H=Y}e.call(Z.prototype)}}else{try{throw Error()}catch(Y){H=Y}(Z=e())&&typeof Z.catch=="function"&&Z.catch(function(){})}}catch(Y){if(Y&&H&&typeof Y.stack=="string")return[Y.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
|
+
`),N=p.split(`
|
|
5
|
+
`);for(s=a=0;a<w.length&&!w[a].includes("DetermineComponentFrameRoot");)a++;for(;s<N.length&&!N[s].includes("DetermineComponentFrameRoot");)s++;if(a===w.length||s===N.length)for(a=w.length-1,s=N.length-1;1<=a&&0<=s&&w[a]!==N[s];)s--;for(;1<=a&&0<=s;a--,s--)if(w[a]!==N[s]){if(a!==1||s!==1)do if(a--,s--,0>s||w[a]!==N[s]){var V=`
|
|
6
|
+
`+w[a].replace(" at new "," at ");return e.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",e.displayName)),V}while(1<=a&&0<=s);break}}}finally{jt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ue(n):""}function La(e,t){switch(e.tag){case 26:case 27:case 5:return Ue(e.type);case 16:return Ue("Lazy");case 13:return e.child!==t&&t!==null?Ue("Suspense Fallback"):Ue("Suspense");case 19:return Ue("SuspenseList");case 0:case 15:return qt(e.type,!1);case 11:return qt(e.type.render,!1);case 1:return qt(e.type,!0);case 31:return Ue("Activity");default:return""}}function on(e){try{var t="",n=null;do t+=La(e,n),n=e,e=e.return;while(e);return t}catch(a){return`
|
|
7
|
+
Error generating stack: `+a.message+`
|
|
8
|
+
`+a.stack}}var Bn=Object.prototype.hasOwnProperty,El=i.unstable_scheduleCallback,qn=i.unstable_cancelCallback,Ai=i.unstable_shouldYield,Di=i.unstable_requestPaint,rt=i.unstable_now,_l=i.unstable_getCurrentPriorityLevel,Al=i.unstable_ImmediatePriority,Ri=i.unstable_UserBlockingPriority,ga=i.unstable_NormalPriority,Oi=i.unstable_LowPriority,Ni=i.unstable_IdlePriority,mn=i.log,$a=i.unstable_setDisableYieldValue,Ln=null,xt=null;function tn(e){if(typeof mn=="function"&&$a(e),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Ln,e)}catch{}}var ot=Math.clz32?Math.clz32:Hi,Ya=Math.log,Ui=Math.LN2;function Hi(e){return e>>>=0,e===0?32:31-(Ya(e)/Ui|0)|0}var $n=256,Ga=262144,ma=4194304;function nn(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 Lt(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=nn(a):(f&=p,f!==0?s=nn(f):n||(n=p&~e,n!==0&&(s=nn(n))))):(p=a&~r,p!==0?s=nn(p):f!==0?s=nn(f):n||(n=a&~e,n!==0&&(s=nn(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 At(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Yn(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 Xa(){var e=ma;return ma<<=1,(ma&62914560)===0&&(ma=4194304),e}function ya(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Gn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function cr(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,N=e.hiddenUpdates;for(n=f&~n;0<n;){var V=31-ot(n),Z=1<<V;p[V]=0,w[V]=-1;var H=N[V];if(H!==null)for(N[V]=null,V=0;V<H.length;V++){var Y=H[V];Y!==null&&(Y.lane&=-536870913)}n&=~Z}a!==0&&Bi(e,a,0),r!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=r&~(f&~t))}function Bi(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-ot(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&261930}function Qa(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-ot(n),s=1<<a;s&t|e[a]&t&&(e[a]|=t),n&=~s}}function xa(e,t){var n=t&-t;return n=(n&42)!==0?1:Dl(n),(n&(e.suspendedLanes|t))!==0?0:n}function Dl(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 ba(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function qi(){var e=L.p;return e!==0?e:(e=window.event,e===void 0?32:Hh(e.type))}function Li(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var $t=Math.random().toString(36).slice(2),tt="__reactFiber$"+$t,ft="__reactProps$"+$t,yn="__reactContainer$"+$t,Va="__reactEvents$"+$t,ur="__reactListeners$"+$t,dr="__reactHandles$"+$t,Rl="__reactResources$"+$t,ae="__reactMarker$"+$t;function Ze(e){delete e[tt],delete e[ft],delete e[Va],delete e[ur],delete e[dr]}function ht(e){var t=e[tt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[yn]||n[tt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=jh(e);e!==null;){if(n=e[tt])return n;e=jh(e)}return t}e=n,n=e.parentNode}return null}function Yt(e){if(e=e[tt]||e[yn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function cn(e){var t=e[Rl];return t||(t=e[Rl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ct(e){e[ae]=!0}var eu=new Set,tu={};function ja(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 Bn.call(au,e)?!0:Bn.call(nu,e)?!1:rv.test(e)?au[e]=!0:(nu[e]=!0,!1)}function $i(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 Yi(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 xn(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 Gt(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 Gi(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 Xt(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=""+Gt(t)):e.value!==""+Gt(t)&&(e.value=""+Gt(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?pr(e,f,Gt(t)):n!=null?pr(e,f,Gt(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=""+Gt(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?""+Gt(n):"",t=t!=null?""+Gt(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"&&Gi(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=""+Gt(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=""+Gt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Gt(n):""}function ou(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(o(92));if(ye(a)){if(1<a.length)throw Error(o(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=Gt(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 Xi(e){return hv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function bn(){}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=Yt(e);if(t&&(e=t.stateNode)){var n=e[ft]||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="'+Xt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var s=a[ft]||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)&&(As(),Fa&&(t=Fa,e=Ja,Ja=Fa=null,du(t),e)))for(t=0;t<e.length;t++)du(e[t])}}function Ol(e,t){var n=e.stateNode;if(n===null)return null;var a=n[ft]||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 jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xr=!1;if(jn)try{var Nl={};Object.defineProperty(Nl,"passive",{get:function(){xr=!0}}),window.addEventListener("test",Nl,Nl),window.removeEventListener("test",Nl,Nl)}catch{xr=!1}var Xn=null,br=null,Qi=null;function hu(){if(Qi)return Qi;var e,t=br,n=t.length,a,s="value"in Xn?Xn.value:Xn.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 Qi=s.slice(e,1<a?1-a:void 0)}function Vi(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 Wi(){return!0}function pu(){return!1}function wt(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)?Wi: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=Wi)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Wi)},persist:function(){},isPersistent:Wi}),t}var Sa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ki=wt(Sa),Ul=b({},Sa,{view:0,detail:0}),pv=wt(Ul),jr,Sr,Hl,Zi=b({},Ul,{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!==Hl&&(Hl&&e.type==="mousemove"?(jr=e.screenX-Hl.screenX,Sr=e.screenY-Hl.screenY):Sr=jr=0,Hl=e),jr)},movementY:function(e){return"movementY"in e?e.movementY:Sr}}),vu=wt(Zi),vv=b({},Zi,{dataTransfer:0}),gv=wt(vv),mv=b({},Ul,{relatedTarget:0}),kr=wt(mv),yv=b({},Sa,{animationName:0,elapsedTime:0,pseudoElement:0}),xv=wt(yv),bv=b({},Sa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jv=wt(bv),Sv=b({},Sa,{data:0}),gu=wt(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({},Ul,{key:function(e){if(e.key){var t=kv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Vi(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"?Vi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Vi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Mv=wt(Cv),Ev=b({},Zi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mu=wt(Ev),_v=b({},Ul,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wr}),Av=wt(_v),Dv=b({},Sa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Rv=wt(Dv),Ov=b({},Zi,{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=wt(Ov),Uv=b({},Sa,{newState:0,oldState:0}),Hv=wt(Uv),Bv=[9,13,27,32],zr=jn&&"CompositionEvent"in window,Bl=null;jn&&"documentMode"in document&&(Bl=document.documentMode);var qv=jn&&"TextEvent"in window&&!Bl,yu=jn&&(!zr||Bl&&8<Bl&&11>=Bl),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(),Qi=br=Xn=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=Bs(t,"onChange"),0<t.length&&(n=new Ki("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var ql=null,Ll=null;function Gv(e){rh(e,0)}function Fi(e){var t=kt(e);if(iu(t))return e}function zu(e,t){if(e==="change")return t}var Tu=!1;if(jn){var Tr;if(jn){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(){ql&&(ql.detachEvent("onpropertychange",Eu),Ll=ql=null)}function Eu(e){if(e.propertyName==="value"&&Fi(Ll)){var t=[];wu(t,Ll,e,mr(e)),fu(Gv,t)}}function Xv(e,t,n){e==="focusin"?(Mu(),ql=t,Ll=n,ql.attachEvent("onpropertychange",Eu)):e==="focusout"&&Mu()}function Qv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Fi(Ll)}function Vv(e,t){if(e==="click")return Fi(t)}function Wv(e,t){if(e==="input"||e==="change")return Fi(t)}function Kv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Dt=typeof Object.is=="function"?Object.is:Kv;function $l(e,t){if(Dt(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(!Bn.call(t,s)||!Dt(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=Gi(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=Gi(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=jn&&"documentMode"in document&&11>=document.documentMode,Pa=null,Er=null,Yl=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!==Gi(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}),Yl&&$l(Yl,a)||(Yl=a,a=Bs(Er,"onSelect"),0<a.length&&(t=new Ki("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Pa)))}function ka(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var el={animationend:ka("Animation","AnimationEnd"),animationiteration:ka("Animation","AnimationIteration"),animationstart:ka("Animation","AnimationStart"),transitionrun:ka("Transition","TransitionRun"),transitionstart:ka("Transition","TransitionStart"),transitioncancel:ka("Transition","TransitionCancel"),transitionend:ka("Transition","TransitionEnd")},Ar={},Nu={};jn&&(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 wa(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 Uu=wa("animationend"),Hu=wa("animationiteration"),Bu=wa("animationstart"),Fv=wa("transitionrun"),Jv=wa("transitionstart"),Iv=wa("transitioncancel"),qu=wa("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 an(e,t){Lu.set(e,t),ja(t,[e])}var Ji=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)},Qt=[],tl=0,Rr=0;function Ii(){for(var e=tl,t=Rr=tl=0;t<e;){var n=Qt[t];Qt[t++]=null;var a=Qt[t];Qt[t++]=null;var s=Qt[t];Qt[t++]=null;var r=Qt[t];if(Qt[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 Pi(e,t,n,a){Qt[tl++]=e,Qt[tl++]=t,Qt[tl++]=n,Qt[tl++]=a,Rr|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Or(e,t,n,a){return Pi(e,t,n,a),es(e)}function za(e,t){return Pi(e,null,null,t),es(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-ot(n),e=r.hiddenUpdates,a=e[s],a===null?e[s]=[t]:a.push(t),t.lane=n|536870912),r):null}function es(e){if(50<ui)throw ui=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 Rt(e,t,n,a){return new Pv(e,t,n,a)}function Nr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Sn(e,t){var n=e.alternate;return n===null?(n=Rt(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 ts(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,te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Rt(31,n,t,s),e.elementType=G,e.lanes=r,e;case K:return Ta(n.children,s,r,t);case M:f=8,s|=24;break;case T:return e=Rt(12,n,t,s|2),e.elementType=T,e.lanes=r,e;case se:return e=Rt(13,n,t,s),e.elementType=se,e.lanes=r,e;case q:return e=Rt(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 F:f=11;break e;case U: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=Rt(f,n,t,s),t.elementType=e,t.type=a,t.lanes=r,t}function Ta(e,t,n,a){return e=Rt(7,e,a,t),e.lanes=n,e}function Ur(e,t,n){return e=Rt(6,e,null,t),e.lanes=n,e}function Gu(e){var t=Rt(18,null,null,0);return t.stateNode=e,t}function Hr(e,t,n){return t=Rt(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 Vt(e,t){if(typeof e=="object"&&e!==null){var n=Xu.get(e);return n!==void 0?n:(t={value:e,source:t,stack:on(t)},Xu.set(e,t),t)}return{value:e,source:t,stack:on(t)}}var al=[],ll=0,ns=null,Gl=0,Wt=[],Kt=0,Qn=null,un=1,dn="";function kn(e,t){al[ll++]=Gl,al[ll++]=ns,ns=e,Gl=t}function Qu(e,t,n){Wt[Kt++]=un,Wt[Kt++]=dn,Wt[Kt++]=Qn,Qn=e;var a=un;e=dn;var s=32-ot(a)-1;a&=~(1<<s),n+=1;var r=32-ot(t)+s;if(30<r){var f=s-s%5;r=(a&(1<<f)-1).toString(32),a>>=f,s-=f,un=1<<32-ot(t)+s|n<<s|a,dn=r+e}else un=1<<r|n<<s|a,dn=e}function Br(e){e.return!==null&&(kn(e,1),Qu(e,1,0))}function qr(e){for(;e===ns;)ns=al[--ll],al[ll]=null,Gl=al[--ll],al[ll]=null;for(;e===Qn;)Qn=Wt[--Kt],Wt[Kt]=null,dn=Wt[--Kt],Wt[Kt]=null,un=Wt[--Kt],Wt[Kt]=null}function Vu(e,t){Wt[Kt++]=un,Wt[Kt++]=dn,Wt[Kt++]=Qn,un=t.id,dn=t.overflow,Qn=e}var pt=null,Ge=null,Ee=!1,Vn=null,Zt=!1,Lr=Error(o(519));function Wn(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xl(Vt(t,e)),Lr}function Wu(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[tt]=e,t[ft]=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<fi.length;n++)Te(fi[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=bn),t=!0):t=!1,t||Wn(e,!0)}function Ku(e){for(pt=e.return;pt;)switch(pt.tag){case 5:case 31:case 13:Zt=!1;return;case 27:case 3:Zt=!0;return;default:pt=pt.return}}function il(e){if(e!==pt)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&&Ge&&Wn(e),Ku(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ge=bh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ge=bh(e)}else t===27?(t=Ge,ra(e.type)?(e=uc,uc=null,Ge=e):Ge=t):Ge=pt?Jt(e.stateNode.nextSibling):null;return!0}function Ca(){Ge=pt=null,Ee=!1}function $r(){var e=Vn;return e!==null&&(Mt===null?Mt=e:Mt.push.apply(Mt,e),Vn=null),e}function Xl(e){Vn===null?Vn=[e]:Vn.push(e)}var Yr=C(null),Ma=null,wn=null;function Kn(e,t,n){J(Yr,t._currentValue),t._currentValue=n}function zn(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;Dt(s.pendingProps.value,f.value)||(e!==null?e.push(p):e=[p])}}else if(s===xe.current){if(f=s.alternate,f===null)throw Error(o(387));f.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(mi):e=[mi])}s=s.return}e!==null&&Xr(t,e,n,a),t.flags|=262144}function as(e){for(e=e.firstContext;e!==null;){if(!Dt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ea(e){Ma=e,wn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function vt(e){return Zu(Ma,e)}function ls(e,t){return Ma===null&&Ea(e),Zu(e,t)}function Zu(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},wn===null){if(e===null)throw Error(o(308));wn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else wn=wn.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,nt={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qr(){return{controller:new eg,data:new Map,refCount:0}}function Ql(e){e.refCount--,e.refCount===0&&tg(ng,function(){e.controller.abort()})}var Vl=null,Vr=0,rl=0,ol=null;function ag(e,t){if(Vl===null){var n=Vl=[];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&&Vl!==null){ol!==null&&(ol.status="fulfilled");var e=Vl;Vl=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=z.S;z.S=function(e,t){Nf=rt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ag(e,t),Ju!==null&&Ju(e,t)};var _a=C(null);function Wr(){var e=_a.current;return e!==null?e:Ye.pooledCache}function is(e,t){t===null?J(_a,_a.current):J(_a,t.pool)}function Iu(){var e=Wr();return e===null?null:{parent:nt._currentValue,pool:e}}var cl=Error(o(460)),Kr=Error(o(474)),ss=Error(o(542)),rs={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(bn,bn),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(bn,bn);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 Da=t,cl}}function Aa(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Da=n,cl):n}}var Da=null;function td(){if(Da===null)throw Error(o(459));var e=Da;return Da=null,e}function nd(e){if(e===cl||e===ss)throw Error(o(483))}var ul=null,Wl=0;function os(e){var t=Wl;return Wl+=1,ul===null&&(ul=[]),ed(ul,e,t)}function Kl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function cs(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,E){if(e){var R=A.deletions;R===null?(A.deletions=[E],A.flags|=16):R.push(E)}}function n(A,E){if(!e)return null;for(;E!==null;)t(A,E),E=E.sibling;return null}function a(A){for(var E=new Map;A!==null;)A.key!==null?E.set(A.key,A):E.set(A.index,A),A=A.sibling;return E}function s(A,E){return A=Sn(A,E),A.index=0,A.sibling=null,A}function r(A,E,R){return A.index=R,e?(R=A.alternate,R!==null?(R=R.index,R<E?(A.flags|=67108866,E):R):(A.flags|=67108866,E)):(A.flags|=1048576,E)}function f(A){return e&&A.alternate===null&&(A.flags|=67108866),A}function p(A,E,R,W){return E===null||E.tag!==6?(E=Ur(R,A.mode,W),E.return=A,E):(E=s(E,R),E.return=A,E)}function w(A,E,R,W){var pe=R.type;return pe===K?V(A,E,R.props.children,W,R.key):E!==null&&(E.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===$&&Aa(pe)===E.type)?(E=s(E,R.props),Kl(E,R),E.return=A,E):(E=ts(R.type,R.key,R.props,null,A.mode,W),Kl(E,R),E.return=A,E)}function N(A,E,R,W){return E===null||E.tag!==4||E.stateNode.containerInfo!==R.containerInfo||E.stateNode.implementation!==R.implementation?(E=Hr(R,A.mode,W),E.return=A,E):(E=s(E,R.children||[]),E.return=A,E)}function V(A,E,R,W,pe){return E===null||E.tag!==7?(E=Ta(R,A.mode,W,pe),E.return=A,E):(E=s(E,R),E.return=A,E)}function Z(A,E,R){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=Ur(""+E,A.mode,R),E.return=A,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case k:return R=ts(E.type,E.key,E.props,null,A.mode,R),Kl(R,E),R.return=A,R;case O:return E=Hr(E,A.mode,R),E.return=A,E;case $:return E=Aa(E),Z(A,E,R)}if(ye(E)||P(E))return E=Ta(E,A.mode,R,null),E.return=A,E;if(typeof E.then=="function")return Z(A,os(E),R);if(E.$$typeof===B)return Z(A,ls(A,E),R);cs(A,E)}return null}function H(A,E,R,W){var pe=E!==null?E.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return pe!==null?null:p(A,E,""+R,W);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case k:return R.key===pe?w(A,E,R,W):null;case O:return R.key===pe?N(A,E,R,W):null;case $:return R=Aa(R),H(A,E,R,W)}if(ye(R)||P(R))return pe!==null?null:V(A,E,R,W,null);if(typeof R.then=="function")return H(A,E,os(R),W);if(R.$$typeof===B)return H(A,E,ls(A,R),W);cs(A,R)}return null}function Y(A,E,R,W,pe){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return A=A.get(R)||null,p(E,A,""+W,pe);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case k:return A=A.get(W.key===null?R:W.key)||null,w(E,A,W,pe);case O:return A=A.get(W.key===null?R:W.key)||null,N(E,A,W,pe);case $:return W=Aa(W),Y(A,E,R,W,pe)}if(ye(W)||P(W))return A=A.get(R)||null,V(E,A,W,pe,null);if(typeof W.then=="function")return Y(A,E,R,os(W),pe);if(W.$$typeof===B)return Y(A,E,R,ls(E,W),pe);cs(E,W)}return null}function de(A,E,R,W){for(var pe=null,De=null,fe=E,ke=E=0,Me=null;fe!==null&&ke<R.length;ke++){fe.index>ke?(Me=fe,fe=null):Me=fe.sibling;var Re=H(A,fe,R[ke],W);if(Re===null){fe===null&&(fe=Me);break}e&&fe&&Re.alternate===null&&t(A,fe),E=r(Re,E,ke),De===null?pe=Re:De.sibling=Re,De=Re,fe=Me}if(ke===R.length)return n(A,fe),Ee&&kn(A,ke),pe;if(fe===null){for(;ke<R.length;ke++)fe=Z(A,R[ke],W),fe!==null&&(E=r(fe,E,ke),De===null?pe=fe:De.sibling=fe,De=fe);return Ee&&kn(A,ke),pe}for(fe=a(fe);ke<R.length;ke++)Me=Y(fe,A,ke,R[ke],W),Me!==null&&(e&&Me.alternate!==null&&fe.delete(Me.key===null?ke:Me.key),E=r(Me,E,ke),De===null?pe=Me:De.sibling=Me,De=Me);return e&&fe.forEach(function(fa){return t(A,fa)}),Ee&&kn(A,ke),pe}function ge(A,E,R,W){if(R==null)throw Error(o(151));for(var pe=null,De=null,fe=E,ke=E=0,Me=null,Re=R.next();fe!==null&&!Re.done;ke++,Re=R.next()){fe.index>ke?(Me=fe,fe=null):Me=fe.sibling;var fa=H(A,fe,Re.value,W);if(fa===null){fe===null&&(fe=Me);break}e&&fe&&fa.alternate===null&&t(A,fe),E=r(fa,E,ke),De===null?pe=fa:De.sibling=fa,De=fa,fe=Me}if(Re.done)return n(A,fe),Ee&&kn(A,ke),pe;if(fe===null){for(;!Re.done;ke++,Re=R.next())Re=Z(A,Re.value,W),Re!==null&&(E=r(Re,E,ke),De===null?pe=Re:De.sibling=Re,De=Re);return Ee&&kn(A,ke),pe}for(fe=a(fe);!Re.done;ke++,Re=R.next())Re=Y(fe,A,ke,Re.value,W),Re!==null&&(e&&Re.alternate!==null&&fe.delete(Re.key===null?ke:Re.key),E=r(Re,E,ke),De===null?pe=Re:De.sibling=Re,De=Re);return e&&fe.forEach(function(vm){return t(A,vm)}),Ee&&kn(A,ke),pe}function $e(A,E,R,W){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 pe=R.key;E!==null;){if(E.key===pe){if(pe=R.type,pe===K){if(E.tag===7){n(A,E.sibling),W=s(E,R.props.children),W.return=A,A=W;break e}}else if(E.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===$&&Aa(pe)===E.type){n(A,E.sibling),W=s(E,R.props),Kl(W,R),W.return=A,A=W;break e}n(A,E);break}else t(A,E);E=E.sibling}R.type===K?(W=Ta(R.props.children,A.mode,W,R.key),W.return=A,A=W):(W=ts(R.type,R.key,R.props,null,A.mode,W),Kl(W,R),W.return=A,A=W)}return f(A);case O:e:{for(pe=R.key;E!==null;){if(E.key===pe)if(E.tag===4&&E.stateNode.containerInfo===R.containerInfo&&E.stateNode.implementation===R.implementation){n(A,E.sibling),W=s(E,R.children||[]),W.return=A,A=W;break e}else{n(A,E);break}else t(A,E);E=E.sibling}W=Hr(R,A.mode,W),W.return=A,A=W}return f(A);case $:return R=Aa(R),$e(A,E,R,W)}if(ye(R))return de(A,E,R,W);if(P(R)){if(pe=P(R),typeof pe!="function")throw Error(o(150));return R=pe.call(R),ge(A,E,R,W)}if(typeof R.then=="function")return $e(A,E,os(R),W);if(R.$$typeof===B)return $e(A,E,ls(A,R),W);cs(A,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,E!==null&&E.tag===6?(n(A,E.sibling),W=s(E,R),W.return=A,A=W):(n(A,E),W=Ur(R,A.mode,W),W.return=A,A=W),f(A)):n(A,E)}return function(A,E,R,W){try{Wl=0;var pe=$e(A,E,R,W);return ul=null,pe}catch(fe){if(fe===cl||fe===ss)throw fe;var De=Rt(29,fe,null,A.mode);return De.lanes=W,De.return=A,De}}}var Ra=ad(!0),ld=ad(!1),Zn=!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 Fn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Jn(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=es(e),$u(e,null,n),t}return Pi(e,a,t,n),es(e)}function Zl(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,Qa(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 Fl(){if(Ir){var e=ol;if(e!==null)throw e}}function Jl(e,t,n,a){Ir=!1;var s=e.updateQueue;Zn=!1;var r=s.firstBaseUpdate,f=s.lastBaseUpdate,p=s.shared.pending;if(p!==null){s.shared.pending=null;var w=p,N=w.next;w.next=null,f===null?r=N:f.next=N,f=w;var V=e.alternate;V!==null&&(V=V.updateQueue,p=V.lastBaseUpdate,p!==f&&(p===null?V.firstBaseUpdate=N:p.next=N,V.lastBaseUpdate=w))}if(r!==null){var Z=s.baseState;f=0,V=N=w=null,p=r;do{var H=p.lane&-536870913,Y=H!==p.lane;if(Y?(Ce&H)===H:(a&H)===H){H!==0&&H===rl&&(Ir=!0),V!==null&&(V=V.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var de=e,ge=p;H=t;var $e=n;switch(ge.tag){case 1:if(de=ge.payload,typeof de=="function"){Z=de.call($e,Z,H);break e}Z=de;break e;case 3:de.flags=de.flags&-65537|128;case 0:if(de=ge.payload,H=typeof de=="function"?de.call($e,Z,H):de,H==null)break e;Z=b({},Z,H);break e;case 2:Zn=!0}}H=p.callback,H!==null&&(e.flags|=64,Y&&(e.flags|=8192),Y=s.callbacks,Y===null?s.callbacks=[H]:Y.push(H))}else Y={lane:H,tag:p.tag,payload:p.payload,callback:p.callback,next:null},V===null?(N=V=Y,w=Z):V=V.next=Y,f|=H;if(p=p.next,p===null){if(p=s.shared.pending,p===null)break;Y=p,p=Y.next,Y.next=null,s.lastBaseUpdate=Y,s.shared.pending=null}}while(!0);V===null&&(w=Z),s.baseState=w,s.firstBaseUpdate=N,s.lastBaseUpdate=V,r===null&&(s.shared.lanes=0),na|=f,e.lanes=f,e.memoizedState=Z}}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=C(null),us=C(0);function rd(e,t){e=On,J(us,e),J(dl,t),On=e|t.baseLanes}function Pr(){J(us,On),J(dl,dl.current)}function eo(){On=us.current,_(dl),_(us)}var Ot=C(null),Ft=null;function In(e){var t=e.alternate;J(Pe,Pe.current&1),J(Ot,e),Ft===null&&(t===null||dl.current!==null||t.memoizedState!==null)&&(Ft=e)}function to(e){J(Pe,Pe.current),J(Ot,e),Ft===null&&(Ft=e)}function od(e){e.tag===22?(J(Pe,Pe.current),J(Ot,e),Ft===null&&(Ft=e)):Pn()}function Pn(){J(Pe,Pe.current),J(Ot,Ot.current)}function Nt(e){_(Ot),Ft===e&&(Ft=null),_(Pe)}var Pe=C(0);function ds(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 Tn=0,Se=null,qe=null,at=null,fs=!1,fl=!1,Oa=!1,hs=0,Il=0,hl=null,ig=0;function Fe(){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(!Dt(e[n],t[n]))return!1;return!0}function ao(e,t,n,a,s,r){return Tn=r,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,z.H=e===null||e.memoizedState===null?Qd:xo,Oa=!1,r=n(a,s),Oa=!1,fl&&(r=ud(t,n,a,s)),cd(e),r}function cd(e){z.H=ti;var t=qe!==null&&qe.next!==null;if(Tn=0,at=qe=Se=null,fs=!1,Il=0,hl=null,t)throw Error(o(300));e===null||lt||(e=e.dependencies,e!==null&&as(e)&&(lt=!0))}function ud(e,t,n,a){Se=e;var s=0;do{if(fl&&(hl=null),Il=0,fl=!1,25<=s)throw Error(o(301));if(s+=1,at=qe=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}z.H=Vd,r=t(n,a)}while(fl);return r}function sg(){var e=z.H,t=e.useState()[0];return t=typeof t.then=="function"?Pl(t):t,e=e.useState()[0],(qe!==null?qe.memoizedState:null)!==e&&(Se.flags|=1024),t}function lo(){var e=hs!==0;return hs=0,e}function io(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function so(e){if(fs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}fs=!1}Tn=0,at=qe=Se=null,fl=!1,Il=hs=0,hl=null}function St(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return at===null?Se.memoizedState=at=e:at=at.next=e,at}function et(){if(qe===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=qe.next;var t=at===null?Se.memoizedState:at.next;if(t!==null)at=t,qe=e;else{if(e===null)throw Se.alternate===null?Error(o(467)):Error(o(310));qe=e,e={memoizedState:qe.memoizedState,baseState:qe.baseState,baseQueue:qe.baseQueue,queue:qe.queue,next:null},at===null?Se.memoizedState=at=e:at=at.next=e}return at}function ps(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pl(e){var t=Il;return Il+=1,hl===null&&(hl=[]),e=ed(hl,e,t),t=Se,(at===null?t.memoizedState:at.next)===null&&(t=t.alternate,z.H=t===null||t.memoizedState===null?Qd:xo),e}function vs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Pl(e);if(e.$$typeof===B)return vt(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=ps(),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]=ue;return t.index++,n}function Cn(e,t){return typeof t=="function"?t(e):t}function gs(e){var t=et();return oo(t,qe,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,N=t,V=!1;do{var Z=N.lane&-536870913;if(Z!==N.lane?(Ce&Z)===Z:(Tn&Z)===Z){var H=N.revertLane;if(H===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null}),Z===rl&&(V=!0);else if((Tn&H)===H){N=N.next,H===rl&&(V=!0);continue}else Z={lane:0,revertLane:N.revertLane,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},w===null?(p=w=Z,f=r):w=w.next=Z,Se.lanes|=H,na|=H;Z=N.action,Oa&&n(r,Z),r=N.hasEagerState?N.eagerState:n(r,Z)}else H={lane:Z,revertLane:N.revertLane,gesture:N.gesture,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},w===null?(p=w=H,f=r):w=w.next=H,Se.lanes|=Z,na|=Z;N=N.next}while(N!==null&&N!==t);if(w===null?f=r:w.next=p,!Dt(r,e.memoizedState)&&(lt=!0,V&&(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=et(),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);Dt(r,t.memoizedState)||(lt=!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=et(),r=Ee;if(r){if(n===void 0)throw Error(o(407));n=n()}else n=t();var f=!Dt((qe||s).memoizedState,n);if(f&&(s.memoizedState=n,lt=!0),s=s.queue,ho(pd.bind(null,a,s,e),[e]),s.getSnapshot!==t||f||at!==null&&at.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||(Tn&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=ps(),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!Dt(e,n)}catch{return!0}}function gd(e){var t=za(e,2);t!==null&&Et(t,e,2)}function uo(e){var t=St();if(typeof e=="function"){var n=e;if(e=n(),Oa){tn(!0);try{n()}finally{tn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cn,lastRenderedState:e},t}function md(e,t,n,a){return e.baseState=n,oo(e,qe,typeof a=="function"?a:Cn)}function rg(e,t,n,a,s){if(xs(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)}};z.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=z.T,f={};z.T=f;try{var p=n(s,a),w=z.S;w!==null&&w(f,p),xd(e,t,p)}catch(N){fo(e,t,N)}finally{r!==null&&f.types!==null&&(r.types=f.types),z.T=r}}else try{r=n(s,a),xd(e,t,r)}catch(N){fo(e,t,N)}}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(Ge){t:{for(var s=Ge,r=Zt;s.nodeType!==8;){if(!r){s=null;break t}if(s=Jt(s.nextSibling),s===null){s=null;break t}}r=s.data,s=r==="F!"||r==="F"?s:null}if(s){Ge=Jt(s.nextSibling),a=s.data==="F!";break e}}Wn(a)}a=!1}a&&(t=n[0])}}return n=St(),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=St(),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=et();return zd(t,qe,e)}function zd(e,t,n){if(t=oo(e,t,Sd)[0],e=gs(Cn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Pl(t)}catch(f){throw f===cl?ss:f}else a=t;t=et();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=et(),n=qe;if(n!==null)return zd(t,n,e);et(),t=t.memoizedState,n=et();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=ps(),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 et().memoizedState}function ms(e,t,n,a){var s=St();Se.flags|=e,s.memoizedState=pl(1|t,{destroy:void 0},n,a===void 0?null:a)}function ys(e,t,n,a){var s=et();a=a===void 0?null:a;var r=s.memoizedState.inst;qe!==null&&a!==null&&no(a,qe.memoizedState.deps)?s.memoizedState=pl(t,r,n,a):(Se.flags|=e,s.memoizedState=pl(1|t,r,n,a))}function Md(e,t){ms(8390656,8,e,t)}function ho(e,t){ys(2048,8,e,t)}function cg(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=ps(),Se.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ed(e){var t=et().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 ys(4,2,e,t)}function Ad(e,t){return ys(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,ys(4,4,Dd.bind(null,t,e),n)}function po(){}function Od(e,t){var n=et();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=et();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&no(t,a[1]))return a[0];if(a=e(),Oa){tn(!0);try{e()}finally{tn(!1)}}return n.memoizedState=[a,t],a}function vo(e,t,n){return n===void 0||(Tn&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Hf(),Se.lanes|=e,na|=e,n)}function Ud(e,t,n,a){return Dt(n,t)?n:dl.current!==null?(e=vo(e,n,a),Dt(e,t)||(lt=!0),e):(Tn&42)===0||(Tn&1073741824)!==0&&(Ce&261930)===0?(lt=!0,e.memoizedState=n):(e=Hf(),Se.lanes|=e,na|=e,t)}function Hd(e,t,n,a,s){var r=L.p;L.p=r!==0&&8>r?r:8;var f=z.T,p={};z.T=p,yo(e,!1,t,n);try{var w=s(),N=z.S;if(N!==null&&N(p,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var V=lg(w,a);ei(e,t,V,Bt(e))}else ei(e,t,a,Bt(e))}catch(Z){ei(e,t,{then:function(){},status:"rejected",reason:Z},Bt())}finally{L.p=r,f!==null&&p.types!==null&&(f.types=p.types),z.T=f}}function ug(){}function go(e,t,n,a){if(e.tag!==5)throw Error(o(476));var s=Bd(e).queue;Hd(e,s,t,ee,n===null?ug:function(){return qd(e),n(a)})}function Bd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cn,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cn,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),ei(e,t.next.queue,{},Bt())}function mo(){return vt(mi)}function Ld(){return et().memoizedState}function $d(){return et().memoizedState}function dg(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Bt();e=Fn(n);var a=Jn(t,e,n);a!==null&&(Et(a,t,n),Zl(a,t,n)),t={cache:Qr()},e.payload=t;return}t=t.return}}function fg(e,t,n){var a=Bt();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},xs(e)?Gd(t,n):(n=Or(e,t,n,a),n!==null&&(Et(n,e,a),Xd(n,t,a)))}function Yd(e,t,n){var a=Bt();ei(e,t,n,a)}function ei(e,t,n,a){var s={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(xs(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,Dt(p,f))return Pi(e,t,s,0),Ye===null&&Ii(),!1}catch{}if(n=Or(e,t,s,a),n!==null)return Et(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},xs(e)){if(t)throw Error(o(479))}else t=Or(e,n,a,2),t!==null&&Et(t,e,2)}function xs(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Gd(e,t){fl=fs=!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,Qa(e,n)}}var ti={readContext:vt,use:vs,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};ti.useEffectEvent=Fe;var Qd={readContext:vt,use:vs,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:vt,useEffect:Md,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,ms(4194308,4,Dd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ms(4194308,4,e,t)},useInsertionEffect:function(e,t){ms(4,2,e,t)},useMemo:function(e,t){var n=St();t=t===void 0?null:t;var a=e();if(Oa){tn(!0);try{e()}finally{tn(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=St();if(n!==void 0){var s=n(t);if(Oa){tn(!0);try{n(t)}finally{tn(!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=St();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=St();return vo(n,e,t)},useTransition:function(){var e=uo(!1);return e=Hd.bind(null,Se,e.queue,!0,!1),St().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Se,s=St();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=St(),t=Ye.identifierPrefix;if(Ee){var n=dn,a=un;n=(a&~(1<<32-ot(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=hs++,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=St();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 St().memoizedState=dg.bind(null,Se)},useEffectEvent:function(e){var t=St(),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:vt,use:vs,useCallback:Od,useContext:vt,useEffect:ho,useImperativeHandle:Rd,useInsertionEffect:_d,useLayoutEffect:Ad,useMemo:Nd,useReducer:gs,useRef:Cd,useState:function(){return gs(Cn)},useDebugValue:po,useDeferredValue:function(e,t){var n=et();return Ud(n,qe.memoizedState,e,t)},useTransition:function(){var e=gs(Cn)[0],t=et().memoizedState;return[typeof e=="boolean"?e:Pl(e),t]},useSyncExternalStore:dd,useId:Ld,useHostTransitionStatus:mo,useFormState:wd,useActionState:wd,useOptimistic:function(e,t){var n=et();return md(n,qe,e,t)},useMemoCache:ro,useCacheRefresh:$d};xo.useEffectEvent=Ed;var Vd={readContext:vt,use:vs,useCallback:Od,useContext:vt,useEffect:ho,useImperativeHandle:Rd,useInsertionEffect:_d,useLayoutEffect:Ad,useMemo:Nd,useReducer:co,useRef:Cd,useState:function(){return co(Cn)},useDebugValue:po,useDeferredValue:function(e,t){var n=et();return qe===null?vo(n,e,t):Ud(n,qe.memoizedState,e,t)},useTransition:function(){var e=co(Cn)[0],t=et().memoizedState;return[typeof e=="boolean"?e:Pl(e),t]},useSyncExternalStore:dd,useId:Ld,useHostTransitionStatus:mo,useFormState:Td,useActionState:Td,useOptimistic:function(e,t){var n=et();return qe!==null?md(n,qe,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:b({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var jo={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=Bt(),s=Fn(a);s.payload=t,n!=null&&(s.callback=n),t=Jn(e,s,a),t!==null&&(Et(t,e,a),Zl(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=Bt(),s=Fn(a);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Jn(e,s,a),t!==null&&(Et(t,e,a),Zl(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Bt(),a=Fn(n);a.tag=2,t!=null&&(a.callback=t),t=Jn(e,a,n),t!==null&&(Et(t,e,n),Zl(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?!$l(n,a)||!$l(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 Na(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=b({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function Zd(e){Ji(e)}function Fd(e){console.error(e)}function Jd(e){Ji(e)}function bs(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=Fn(n),n.tag=3,n.payload={element:null},n.callback=function(){bs(e,t)},n}function Pd(e){return e=Fn(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"&&(aa===null?aa=new Set([this]):aa.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=Ot.current,n!==null){switch(n.tag){case 31:case 13:return Ft===null?Ds():n.alternate===null&&Je===0&&(Je=3),n.flags&=-257,n.flags|=65536,n.lanes=s,a===rs?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===rs?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),Ds(),!1}if(Ee)return t=Ot.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,a!==Lr&&(e=Error(o(422),{cause:a}),Xl(Vt(e,n)))):(a!==Lr&&(t=Error(o(423),{cause:a}),Xl(Vt(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,a=Vt(a,n),s=So(e.stateNode,a,s),Jr(e,s),Je!==4&&(Je=2)),!1;var r=Error(o(520),{cause:a});if(r=Vt(r,n),ci===null?ci=[r]:ci.push(r),Je!==4&&(Je=2),t===null)return!0;a=Vt(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"&&(aa===null||!aa.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)),lt=!1;function gt(e,t,n,a){t.child=e===null?ld(t,null,n,a):Ra(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 Ea(t),a=ao(e,t,n,f,r,s),p=lo(),e!==null&&!lt?(io(e,t,s),Mn(e,t,s)):(Ee&&p&&Br(t),t.flags|=1,gt(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=ts(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:$l,n(f,a)&&e.ref===t.ref)return Mn(e,t,s)}return t.flags|=1,e=Sn(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($l(r,a)&&e.ref===t.ref)if(lt=!1,t.pendingProps=a=r,Ao(e,s))(e.flags&131072)!==0&&(lt=!0);else return t.lanes=e.lanes,Mn(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&&is(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?(is(t,r.cachePool),rd(t,r),Pn(),t.memoizedState=null):(e!==null&&is(t,null),Pr(),Pn());return gt(e,t,s,n),t.child}function ni(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:nt._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&is(t,null),Pr(),od(t),e!==null&&sl(e,t,a,!0),t.childLanes=s,null}function js(e,t){return t=ks({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 Ra(t,e.child,null,n),e=js(t,t.pendingProps),e.flags|=2,Nt(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=js(t,a),t.lanes=536870912,ni(null,e);if(to(t),(e=Ge)?(e=xh(e,Zt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Qn!==null?{id:un,overflow:dn}:null,retryLane:536870912,hydrationErrors:null},n=Gu(e),n.return=t,t.child=n,pt=t,Ge=null)):e=null,e===null)throw Wn(t);return t.lanes=536870912,null}return js(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(lt||sl(e,t,n,!1),s=(n&e.childLanes)!==0,lt||s){if(a=Ye,a!==null&&(f=xa(a,n),f!==0&&f!==r.retryLane))throw r.retryLane=f,za(e,f),Et(a,e,f),ko;Ds(),t=rf(e,t,n)}else e=r.treeContext,Ge=Jt(f.nextSibling),pt=t,Ee=!0,Vn=null,Zt=!1,e!==null&&Vu(t,e),t=js(t,a),t.flags|=4096;return t}return e=Sn(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ss(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 Ea(t),n=ao(e,t,n,a,void 0,s),a=lo(),e!==null&&!lt?(io(e,t,s),Mn(e,t,s)):(Ee&&a&&Br(t),t.flags|=1,gt(e,t,n,s),t.child)}function of(e,t,n,a,s,r){return Ea(t),t.updateQueue=null,n=ud(t,a,n,s),cd(e),a=lo(),e!==null&&!lt?(io(e,t,r),Mn(e,t,r)):(Ee&&a&&Br(t),t.flags|=1,gt(e,t,n,r),t.child)}function cf(e,t,n,a,s){if(Ea(t),t.stateNode===null){var r=nl,f=n.contextType;typeof f=="object"&&f!==null&&(r=vt(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?vt(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),Jl(t,a,r,s),Fl(),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=Na(n,p);r.props=w;var N=r.context,V=n.contextType;f=nl,typeof V=="object"&&V!==null&&(f=vt(V));var Z=n.getDerivedStateFromProps;V=typeof Z=="function"||typeof r.getSnapshotBeforeUpdate=="function",p=t.pendingProps!==p,V||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(p||N!==f)&&Kd(t,r,a,f),Zn=!1;var H=t.memoizedState;r.state=H,Jl(t,a,r,s),Fl(),N=t.memoizedState,p||H!==N||Zn?(typeof Z=="function"&&(bo(t,n,Z,a),N=t.memoizedState),(w=Zn||Wd(t,n,w,a,H,N,f))?(V||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=N),r.props=a,r.state=N,r.context=f,a=w):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{r=t.stateNode,Fr(e,t),f=t.memoizedProps,V=Na(n,f),r.props=V,Z=t.pendingProps,H=r.context,N=n.contextType,w=nl,typeof N=="object"&&N!==null&&(w=vt(N)),p=n.getDerivedStateFromProps,(N=typeof p=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(f!==Z||H!==w)&&Kd(t,r,a,w),Zn=!1,H=t.memoizedState,r.state=H,Jl(t,a,r,s),Fl();var Y=t.memoizedState;f!==Z||H!==Y||Zn||e!==null&&e.dependencies!==null&&as(e.dependencies)?(typeof p=="function"&&(bo(t,n,p,a),Y=t.memoizedState),(V=Zn||Wd(t,n,V,a,H,Y,w)||e!==null&&e.dependencies!==null&&as(e.dependencies))?(N||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(a,Y,w),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(a,Y,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=Y),r.props=a,r.state=Y,r.context=w,a=V):(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,Ss(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=Ra(t,e.child,null,s),t.child=Ra(t,null,n,s)):gt(e,t,n,s),t.memoizedState=r.state,e=t.child):e=Mn(e,t,s),e}function uf(e,t,n,a){return Ca(),t.flags|=256,gt(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|=Ht),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:(Pe.current&2)!==0),f&&(s=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ee){if(s?In(t):Pn(),(e=Ge)?(e=xh(e,Zt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Qn!==null?{id:un,overflow:dn}:null,retryLane:536870912,hydrationErrors:null},n=Gu(e),n.return=t,t.child=n,pt=t,Ge=null)):e=null,e===null)throw Wn(t);return cc(e)?t.lanes=32:t.lanes=536870912,null}var p=a.children;return a=a.fallback,s?(Pn(),s=t.mode,p=ks({mode:"hidden",children:p},s),a=Ta(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,ni(null,a)):(In(t),Mo(t,p))}var w=e.memoizedState;if(w!==null&&(p=w.dehydrated,p!==null)){if(r)t.flags&256?(In(t),t.flags&=-257,t=Eo(e,t,n)):t.memoizedState!==null?(Pn(),t.child=e.child,t.flags|=128,t=null):(Pn(),p=a.fallback,s=t.mode,a=ks({mode:"visible",children:a.children},s),p=Ta(p,s,n,null),p.flags|=2,a.return=t,p.return=t,a.sibling=p,t.child=a,Ra(t,e.child,null,n),a=t.child,a.memoizedState=To(n),a.childLanes=Co(e,f,n),t.memoizedState=zo,t=ni(null,a));else if(In(t),cc(p)){if(f=p.nextSibling&&p.nextSibling.dataset,f)var N=f.dgst;f=N,a=Error(o(419)),a.stack="",a.digest=f,Xl({value:a,source:null,stack:null}),t=Eo(e,t,n)}else if(lt||sl(e,t,n,!1),f=(n&e.childLanes)!==0,lt||f){if(f=Ye,f!==null&&(a=xa(f,n),a!==0&&a!==w.retryLane))throw w.retryLane=a,za(e,a),Et(f,e,a),ko;oc(p)||Ds(),t=Eo(e,t,n)}else oc(p)?(t.flags|=192,t.child=e.child,t=null):(e=w.treeContext,Ge=Jt(p.nextSibling),pt=t,Ee=!0,Vn=null,Zt=!1,e!==null&&Vu(t,e),t=Mo(t,a.children),t.flags|=4096);return t}return s?(Pn(),p=a.fallback,s=t.mode,w=e.child,N=w.sibling,a=Sn(w,{mode:"hidden",children:a.children}),a.subtreeFlags=w.subtreeFlags&65011712,N!==null?p=Sn(N,p):(p=Ta(p,s,n,null),p.flags|=2),p.return=t,a.return=t,a.sibling=p,t.child=a,ni(null,a),a=t.child,p=e.child.memoizedState,p===null?p=To(n):(s=p.cachePool,s!==null?(w=nt._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,ni(e.child,a)):(In(t),n=e.child,e=n.sibling,n=Sn(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=ks({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ks(e,t){return e=Rt(22,e,null,t),e.lanes=0,e}function Eo(e,t,n){return Ra(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=Pe.current,p=(f&2)!==0;if(p?(f=f&1|2,t.flags|=128):f&=1,J(Pe,f),gt(e,t,a,n),a=Ee?Gl: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&&ds(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&&ds(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 Mn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),na|=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=Sn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Sn(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&&as(e)))}function vg(e,t,n){switch(t.tag){case 3:Ae(t,t.stateNode.containerInfo),Kn(t,nt,e.memoizedState.cache),Ca();break;case 27:case 5:Q(t);break;case 4:Ae(t,t.stateNode.containerInfo);break;case 10:Kn(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?(In(t),t.flags|=128,null):(n&t.child.childLanes)!==0?df(e,t,n):(In(t),e=Mn(e,t,n),e!==null?e.sibling:null);In(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),J(Pe,Pe.current),a)break;return null;case 22:return t.lanes=0,lf(e,t,n,t.pendingProps);case 24:Kn(t,nt,e.memoizedState.cache)}return Mn(e,t,n)}function pf(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)lt=!0;else{if(!Ao(e,n)&&(t.flags&128)===0)return lt=!1,vg(e,t,n);lt=(e.flags&131072)!==0}else lt=!1,Ee&&(t.flags&1048576)!==0&&Qu(t,Gl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=Aa(t.elementType),t.type=e,typeof e=="function")Nr(e)?(a=Na(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===F){t.tag=11,t=tf(null,t,e,a,n);break e}else if(s===U){t.tag=14,t=nf(null,t,e,a,n);break e}}throw t=X(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=Na(a,t.pendingProps),cf(e,t,a,s,n);case 3:e:{if(Ae(t,t.stateNode.containerInfo),e===null)throw Error(o(387));a=t.pendingProps;var r=t.memoizedState;s=r.element,Fr(e,t),Jl(t,a,null,n);var f=t.memoizedState;if(a=f.cache,Kn(t,nt,a),a!==r.cache&&Xr(t,[nt],n,!0),Fl(),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=Vt(Error(o(424)),t),Xl(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,Ge=Jt(e.firstChild),pt=t,Ee=!0,Vn=null,Zt=!0,n=ld(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ca(),a===s){t=Mn(e,t,n);break e}gt(e,t,a,n)}t=t.child}return t;case 26:return Ss(e,t),e===null?(n=zh(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ee||(n=t.type,e=t.pendingProps,a=qs(oe.current).createElement(n),a[tt]=t,a[ft]=e,mt(a,n,e),ct(a),t.stateNode=a):t.memoizedState=zh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Q(t),e===null&&Ee&&(a=t.stateNode=Sh(t.type,t.pendingProps,oe.current),pt=t,Zt=!0,s=Ge,ra(t.type)?(uc=s,Ge=Jt(a.firstChild)):Ge=s),gt(e,t,t.pendingProps.children,n),Ss(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ee&&((s=a=Ge)&&(a=Qg(a,t.type,t.pendingProps,Zt),a!==null?(t.stateNode=a,pt=t,Ge=Jt(a.firstChild),Zt=!1,s=!0):s=!1),s||Wn(t)),Q(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),mi._currentValue=s),Ss(e,t),gt(e,t,a,n),t.child;case 6:return e===null&&Ee&&((e=n=Ge)&&(n=Vg(n,t.pendingProps,Zt),n!==null?(t.stateNode=n,pt=t,Ge=null,e=!0):e=!1),e||Wn(t)),null;case 13:return df(e,t,n);case 4:return Ae(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Ra(t,null,a,n):gt(e,t,a,n),t.child;case 11:return tf(e,t,t.type,t.pendingProps,n);case 7:return gt(e,t,t.pendingProps,n),t.child;case 8:return gt(e,t,t.pendingProps.children,n),t.child;case 12:return gt(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,Kn(t,t.type,a.value),gt(e,t,a.children,n),t.child;case 9:return s=t.type._context,a=t.pendingProps.children,Ea(t),s=vt(s),a=a(s),t.flags|=1,gt(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 Ea(t),a=vt(nt),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),Kn(t,nt,s)):((e.lanes&n)!==0&&(Fr(e,t),Jl(t,null,null,n),Fl()),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),Kn(t,nt,a)):(a=r.cache,Kn(t,nt,a),a!==s.cache&&Xr(t,[nt],n,!0))),gt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function En(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 Da=rs,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 Da=rs,Kr}function ws(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Xa():536870912,e.lanes|=t,yl|=t)}function ai(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 Xe(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 Xe(t),null;case 1:return Xe(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),zn(nt),me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(il(t)?En(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,$r())),Xe(t),null;case 26:var s=t.type,r=t.memoizedState;return e===null?(En(t),r!==null?(Xe(t),vf(t,r)):(Xe(t),Do(t,s,null,a,n))):r?r!==e.memoizedState?(En(t),Xe(t),vf(t,r)):(Xe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&En(t),Xe(t),Do(t,s,e,a,n)),null;case 27:if(we(t),n=oe.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&En(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return Xe(t),null}e=te.current,il(t)?Wu(t):(e=Sh(s,a,n),t.stateNode=e,En(t))}return Xe(t),null;case 5:if(we(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&En(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return Xe(t),null}if(r=te.current,il(t))Wu(t);else{var f=qs(oe.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[tt]=t,r[ft]=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(mt(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&&En(t)}}return Xe(t),Do(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&En(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(o(166));if(e=oe.current,il(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,s=pt,s!==null)switch(s.tag){case 27:case 5:a=s.memoizedProps}e[tt]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||dh(e.nodeValue,n)),e||Wn(t,!0)}else e=qs(e).createTextNode(a),e[tt]=t,t.stateNode=e}return Xe(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[tt]=t}else Ca(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Xe(t),e=!1}else n=$r(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Nt(t),t):(Nt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Xe(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[tt]=t}else Ca(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Xe(t),s=!1}else s=$r(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Nt(t),t):(Nt(t),null)}return Nt(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),ws(t,t.updateQueue),Xe(t),null);case 4:return me(),e===null&&ec(t.stateNode.containerInfo),Xe(t),null;case 10:return zn(t.type),Xe(t),null;case 19:if(_(Pe),a=t.memoizedState,a===null)return Xe(t),null;if(s=(t.flags&128)!==0,r=a.rendering,r===null)if(s)ai(a,!1);else{if(Je!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(r=ds(e),r!==null){for(t.flags|=128,ai(a,!1),e=r.updateQueue,t.updateQueue=e,ws(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Yu(n,e),n=n.sibling;return J(Pe,Pe.current&1|2),Ee&&kn(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&rt()>Es&&(t.flags|=128,s=!0,ai(a,!1),t.lanes=4194304)}else{if(!s)if(e=ds(r),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,ws(t,e),ai(a,!0),a.tail===null&&a.tailMode==="hidden"&&!r.alternate&&!Ee)return Xe(t),null}else 2*rt()-a.renderingStartTime>Es&&n!==536870912&&(t.flags|=128,s=!0,ai(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=rt(),e.sibling=null,n=Pe.current,J(Pe,s?n&1|2:n&1),Ee&&kn(t,a.treeForkCount),e):(Xe(t),null);case 22:case 23:return Nt(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&&(Xe(t),t.subtreeFlags&6&&(t.flags|=8192)):Xe(t),n=t.updateQueue,n!==null&&ws(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&&_(_a),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),zn(nt),Xe(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 zn(nt),me(),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(Nt(t),t.alternate===null)throw Error(o(340));Ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Nt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _(Pe),null;case 4:return me(),null;case 10:return zn(t.type),null;case 22:case 23:return Nt(t),eo(),e!==null&&_(_a),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return zn(nt),null;case 25:return null;default:return null}}function gf(e,t){switch(qr(t),t.tag){case 3:zn(nt),me();break;case 26:case 27:case 5:we(t);break;case 4:me();break;case 31:t.memoizedState!==null&&Nt(t);break;case 13:Nt(t);break;case 19:_(Pe);break;case 10:zn(t.type);break;case 22:case 23:Nt(t),eo(),e!==null&&_(_a);break;case 24:zn(nt)}}function li(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){Be(t,t.return,p)}}function ea(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,N=p;try{N()}catch(V){Be(s,w,V)}}}a=a.next}while(a!==r)}}catch(V){Be(t,t.return,V)}}function mf(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{sd(t,n)}catch(a){Be(e,e.return,a)}}}function yf(e,t,n){n.props=Na(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){Be(e,t,a)}}function ii(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){Be(e,t,s)}}function fn(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(s){Be(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){Be(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){Be(e,e.return,s)}}function Ro(e,t,n){try{var a=e.stateNode;qg(a,e.type,n,t),a[ft]=t}catch(s){Be(e,e.return,s)}}function bf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ra(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&&ra(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=bn));else if(a!==4&&(a===27&&ra(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 zs(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&&ra(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(zs(e,t,n),e=e.sibling;e!==null;)zs(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]);mt(t,a,n),t[tt]=e,t[ft]=n}catch(r){Be(e,e.return,r)}}var _n=!1,it=!1,Uo=!1,Sf=typeof WeakSet=="function"?WeakSet:Set,ut=null;function yg(e,t){if(e=e.containerInfo,ac=Vs,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,N=0,V=0,Z=e,H=null;t:for(;;){for(var Y;Z!==n||s!==0&&Z.nodeType!==3||(p=f+s),Z!==r||a!==0&&Z.nodeType!==3||(w=f+a),Z.nodeType===3&&(f+=Z.nodeValue.length),(Y=Z.firstChild)!==null;)H=Z,Z=Y;for(;;){if(Z===e)break t;if(H===n&&++N===s&&(p=f),H===r&&++V===a&&(w=f),(Y=Z.nextSibling)!==null)break;Z=H,H=Z.parentNode}Z=Y}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},Vs=!1,ut=t;ut!==null;)if(t=ut,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ut=e;else for(;ut!==null;){switch(t=ut,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 de=Na(n.type,s);e=a.getSnapshotBeforeUpdate(de,r),a.__reactInternalSnapshotBeforeUpdate=e}catch(ge){Be(n,n.return,ge)}}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,ut=e;break}ut=t.return}}function kf(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:Dn(e,n),a&4&&li(5,n);break;case 1:if(Dn(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(f){Be(n,n.return,f)}else{var s=Na(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){Be(n,n.return,f)}}a&64&&mf(n),a&512&&ii(n,n.return);break;case 3:if(Dn(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){Be(n,n.return,f)}}break;case 27:t===null&&a&4&&jf(n);case 26:case 5:Dn(e,n),t===null&&a&4&&xf(n),a&512&&ii(n,n.return);break;case 12:Dn(e,n);break;case 31:Dn(e,n),a&4&&Tf(e,n);break;case 13:Dn(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||_n,!a){t=t!==null&&t.memoizedState!==null||it,s=_n;var r=it;_n=a,(it=t)&&!r?Rn(e,n,(n.subtreeFlags&8772)!==0):Dn(e,n),_n=s,it=r}break;case 30:break;default:Dn(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&&Ze(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 Qe=null,zt=!1;function An(e,t,n){for(n=n.child;n!==null;)zf(e,t,n),n=n.sibling}function zf(e,t,n){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(Ln,n)}catch{}switch(n.tag){case 26:it||fn(n,t),An(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:it||fn(n,t);var a=Qe,s=zt;ra(n.type)&&(Qe=n.stateNode,zt=!1),An(e,t,n),pi(n.stateNode),Qe=a,zt=s;break;case 5:it||fn(n,t);case 6:if(a=Qe,s=zt,Qe=null,An(e,t,n),Qe=a,zt=s,Qe!==null)if(zt)try{(Qe.nodeType===9?Qe.body:Qe.nodeName==="HTML"?Qe.ownerDocument.body:Qe).removeChild(n.stateNode)}catch(r){Be(n,t,r)}else try{Qe.removeChild(n.stateNode)}catch(r){Be(n,t,r)}break;case 18:Qe!==null&&(zt?(e=Qe,mh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Tl(e)):mh(Qe,n.stateNode));break;case 4:a=Qe,s=zt,Qe=n.stateNode.containerInfo,zt=!0,An(e,t,n),Qe=a,zt=s;break;case 0:case 11:case 14:case 15:ea(2,n,t),it||ea(4,n,t),An(e,t,n);break;case 1:it||(fn(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&yf(n,t,a)),An(e,t,n);break;case 21:An(e,t,n);break;case 22:it=(a=it)||n.memoizedState!==null,An(e,t,n),it=a;break;default:An(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){Be(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){Be(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 Ts(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 Tt(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(ra(p.type)){Qe=p.stateNode,zt=!1;break e}break;case 5:Qe=p.stateNode,zt=!1;break e;case 3:case 4:Qe=p.stateNode.containerInfo,zt=!0;break e}p=p.return}if(Qe===null)throw Error(o(160));zf(r,f,s),Qe=null,zt=!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 ln=null;function Mf(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Tt(t,e),Ct(e),a&4&&(ea(3,e,e.return),li(3,e),ea(5,e,e.return));break;case 1:Tt(t,e),Ct(e),a&512&&(it||n===null||fn(n,n.return)),a&64&&_n&&(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=ln;if(Tt(t,e),Ct(e),a&512&&(it||n===null||fn(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[ae]||r[tt]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=s.createElement(a),s.head.insertBefore(r,s.querySelector("head > title"))),mt(r,a,n),r[tt]=e,ct(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),mt(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),mt(r,a,n),s.head.appendChild(r);break;default:throw Error(o(468,a))}r[tt]=e,ct(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:Tt(t,e),Ct(e),a&512&&(it||n===null||fn(n,n.return)),n!==null&&a&4&&Ro(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Tt(t,e),Ct(e),a&512&&(it||n===null||fn(n,n.return)),e.flags&32){s=e.stateNode;try{Za(s,"")}catch(de){Be(e,e.return,de)}}a&4&&e.stateNode!=null&&(s=e.memoizedProps,Ro(e,s,n!==null?n.memoizedProps:s)),a&1024&&(Uo=!0);break;case 6:if(Tt(t,e),Ct(e),a&4){if(e.stateNode===null)throw Error(o(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(de){Be(e,e.return,de)}}break;case 3:if(Ys=null,s=ln,ln=Ls(t.containerInfo),Tt(t,e),ln=s,Ct(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{Tl(t.containerInfo)}catch(de){Be(e,e.return,de)}Uo&&(Uo=!1,Ef(e));break;case 4:a=ln,ln=Ls(e.stateNode.containerInfo),Tt(t,e),Ct(e),ln=a;break;case 12:Tt(t,e),Ct(e);break;case 31:Tt(t,e),Ct(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,Ts(e,a)));break;case 13:Tt(t,e),Ct(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ms=rt()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,Ts(e,a)));break;case 22:s=e.memoizedState!==null;var w=n!==null&&n.memoizedState!==null,N=_n,V=it;if(_n=N||s,it=V||w,Tt(t,e),it=V,_n=N,Ct(e),a&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||w||_n||it||Ua(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 Z=w.memoizedProps.style,H=Z!=null&&Z.hasOwnProperty("display")?Z.display:null;p.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(de){Be(w,w.return,de)}}}else if(t.tag===6){if(n===null){w=t;try{w.stateNode.nodeValue=s?"":w.memoizedProps}catch(de){Be(w,w.return,de)}}}else if(t.tag===18){if(n===null){w=t;try{var Y=w.stateNode;s?yh(Y,!0):yh(w.stateNode,!1)}catch(de){Be(w,w.return,de)}}}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,Ts(e,n))));break;case 19:Tt(t,e),Ct(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,Ts(e,a)));break;case 30:break;case 21:break;default:Tt(t,e),Ct(e)}}function Ct(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);zs(e,r,s);break;case 5:var f=n.stateNode;n.flags&32&&(Za(f,""),n.flags&=-33);var p=Oo(e);zs(e,p,f);break;case 3:case 4:var w=n.stateNode.containerInfo,N=Oo(e);No(e,N,w);break;default:throw Error(o(161))}}catch(V){Be(e,e.return,V)}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 Dn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)kf(e,t.alternate,t),t=t.sibling}function Ua(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ea(4,t,t.return),Ua(t);break;case 1:fn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&yf(t,t.return,n),Ua(t);break;case 27:pi(t.stateNode);case 26:case 5:fn(t,t.return),Ua(t);break;case 22:t.memoizedState===null&&Ua(t);break;case 30:Ua(t);break;default:Ua(t)}e=e.sibling}}function Rn(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:Rn(s,r,n),li(4,r);break;case 1:if(Rn(s,r,n),a=r,s=a.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(N){Be(a,a.return,N)}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(N){Be(a,a.return,N)}}n&&f&64&&mf(r),ii(r,r.return);break;case 27:jf(r);case 26:case 5:Rn(s,r,n),n&&a===null&&f&4&&xf(r),ii(r,r.return);break;case 12:Rn(s,r,n);break;case 31:Rn(s,r,n),n&&f&4&&Tf(s,r);break;case 13:Rn(s,r,n),n&&f&4&&Cf(s,r);break;case 22:r.memoizedState===null&&Rn(s,r,n),ii(r,r.return);break;case 30:break;default:Rn(s,r,n)}t=t.sibling}}function Ho(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&&Ql(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&&Ql(e))}function sn(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:sn(e,t,n,a),s&2048&&li(9,t);break;case 1:sn(e,t,n,a);break;case 3:sn(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&&Ql(e)));break;case 12:if(s&2048){sn(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){Be(t,t.return,w)}}else sn(e,t,n,a);break;case 31:sn(e,t,n,a);break;case 13:sn(e,t,n,a);break;case 23:break;case 22:r=t.stateNode,f=t.alternate,t.memoizedState!==null?r._visibility&2?sn(e,t,n,a):si(e,t):r._visibility&2?sn(e,t,n,a):(r._visibility|=2,vl(e,t,n,a,(t.subtreeFlags&10256)!==0||!1)),s&2048&&Ho(f,t);break;case 24:sn(e,t,n,a),s&2048&&Bo(t.alternate,t);break;default:sn(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,N=f.flags;switch(f.tag){case 0:case 11:case 15:vl(r,f,p,w,s),li(8,f);break;case 23:break;case 22:var V=f.stateNode;f.memoizedState!==null?V._visibility&2?vl(r,f,p,w,s):si(r,f):(V._visibility|=2,vl(r,f,p,w,s)),s&&N&2048&&Ho(f.alternate,f);break;case 24:vl(r,f,p,w,s),s&&N&2048&&Bo(f.alternate,f);break;default:vl(r,f,p,w,s)}t=t.sibling}}function si(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:si(n,a),s&2048&&Ho(a.alternate,a);break;case 24:si(n,a),s&2048&&Bo(a.alternate,a);break;default:si(n,a)}t=t.sibling}}var ri=8192;function gl(e,t,n){if(e.subtreeFlags&ri)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&ri&&e.memoizedState!==null&&im(n,ln,e.memoizedState,e.memoizedProps);break;case 5:gl(e,t,n);break;case 3:case 4:var a=ln;ln=Ls(e.stateNode.containerInfo),gl(e,t,n),ln=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=ri,ri=16777216,gl(e,t,n),ri=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 oi(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];ut=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:oi(e),e.flags&2048&&ea(9,e,e.return);break;case 3:oi(e);break;case 12:oi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Cs(e)):oi(e);break;default:oi(e)}}function Cs(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];ut=a,Of(a,e)}Df(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ea(8,t,t.return),Cs(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Cs(t));break;default:Cs(t)}e=e.sibling}}function Of(e,t){for(;ut!==null;){var n=ut;switch(n.tag){case 0:case 11:case 15:ea(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:Ql(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,ut=a;else e:for(n=e;ut!==null;){a=ut;var s=a.sibling,r=a.return;if(wf(a),a===n){ut=null;break e}if(s!==null){s.return=r,ut=s;break e}ut=r}}}var bg={getCacheForType:function(e){var t=vt(nt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return vt(nt).controller.signal}},jg=typeof WeakMap=="function"?WeakMap:Map,Oe=0,Ye=null,ze=null,Ce=0,He=0,Ut=null,ta=!1,ml=!1,qo=!1,On=0,Je=0,na=0,Ha=0,Lo=0,Ht=0,yl=0,ci=null,Mt=null,$o=!1,Ms=0,Nf=0,Es=1/0,_s=null,aa=null,st=0,la=null,xl=null,Nn=0,Yo=0,Go=null,Uf=null,ui=0,Xo=null;function Bt(){return(Oe&2)!==0&&Ce!==0?Ce&-Ce:z.T!==null?Fo():qi()}function Hf(){if(Ht===0)if((Ce&536870912)===0||Ee){var e=Ga;Ga<<=1,(Ga&3932160)===0&&(Ga=262144),Ht=e}else Ht=536870912;return e=Ot.current,e!==null&&(e.flags|=32),Ht}function Et(e,t,n){(e===Ye&&(He===2||He===9)||e.cancelPendingCommit!==null)&&(bl(e,0),ia(e,Ce,Ht,!1)),Gn(e,n),((Oe&2)===0||e!==Ye)&&(e===Ye&&((Oe&2)===0&&(Ha|=n),Je===4&&ia(e,Ce,Ht,!1)),hn(e))}function Bf(e,t,n){if((Oe&6)!==0)throw Error(o(327));var a=!n&&(t&127)===0&&(t&e.expiredLanes)===0||At(e,t),s=a?wg(e,t):Vo(e,t,!0),r=a;do{if(s===0){ml&&!a&&ia(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=ci;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,Ha|=r,s=4;break e}r=Mt,Mt=s,r!==null&&(Mt===null?Mt=r:Mt.push.apply(Mt,r))}s=f}if(r=!1,s!==2)continue}}if(s===1){bl(e,0),ia(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:ia(a,t,Ht,!ta);break e;case 2:Mt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(s=Ms+300-rt(),10<s)){if(ia(a,t,Ht,!ta),Lt(a,0,!0)!==0)break e;Nn=t,a.timeoutHandle=vh(qf.bind(null,a,n,Mt,_s,$o,t,Ht,Ha,yl,ta,r,"Throttled",-0,0),s);break e}qf(a,n,Mt,_s,$o,t,Ht,Ha,yl,ta,r,null,-0,0)}}break}while(!0);hn(e)}function qf(e,t,n,a,s,r,f,p,w,N,V,Z,H,Y){if(e.timeoutHandle=-1,Z=t.subtreeFlags,Z&8192||(Z&16785408)===16785408){Z={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:bn},Af(t,r,Z);var de=(r&62914560)===r?Ms-rt():(r&4194048)===r?Nf-rt():0;if(de=sm(Z,de),de!==null){Nn=r,e.cancelPendingCommit=de(Wf.bind(null,e,t,r,n,a,s,f,p,w,V,Z,null,H,Y)),ia(e,r,f,!N);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(!Dt(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 ia(e,t,n,a){t&=~Lo,t&=~Ha,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var s=t;0<s;){var r=31-ot(s),f=1<<r;a[r]=-1,s&=~f}n!==0&&Bi(e,n,t)}function As(){return(Oe&6)===0?(di(0),!1):!0}function Qo(){if(ze!==null){if(He===0)var e=ze.return;else e=ze,wn=Ma=null,so(e),ul=null,Wl=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()),Nn=0,Qo(),Ye=e,ze=n=Sn(e.current,null),Ce=t,He=0,Ut=null,ta=!1,ml=At(e,t),qo=!1,yl=Ht=Lo=Ha=na=Je=0,Mt=ci=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-ot(a),r=1<<s;t|=e[s],a&=~r}return On=t,Ii(),n}function Lf(e,t){Se=null,z.H=ti,t===cl||t===ss?(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,Ut=t,ze===null&&(Je=1,bs(e,Vt(t,e.current)))}function $f(){var e=Ot.current;return e===null?!0:(Ce&4194048)===Ce?Ft===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===Ft:!1}function Yf(){var e=z.H;return z.H=ti,e===null?ti:e}function Gf(){var e=z.A;return z.A=bg,e}function Ds(){Je=4,ta||(Ce&4194048)!==Ce&&Ot.current!==null||(ml=!0),(na&134217727)===0&&(Ha&134217727)===0||Ye===null||ia(Ye,Ce,Ht,!1)}function Vo(e,t,n){var a=Oe;Oe|=2;var s=Yf(),r=Gf();(Ye!==e||Ce!==t)&&(_s=null,bl(e,t)),t=!1;var f=Je;e:do try{if(He!==0&&ze!==null){var p=ze,w=Ut;switch(He){case 8:Qo(),f=6;break e;case 3:case 2:case 9:case 6:Ot.current===null&&(t=!0);var N=He;if(He=0,Ut=null,jl(e,p,w,N),n&&ml){f=0;break e}break;default:N=He,He=0,Ut=null,jl(e,p,w,N)}}kg(),f=Je;break}catch(V){Lf(e,V)}while(!0);return t&&e.shellSuspendCounter++,wn=Ma=null,Oe=a,z.H=s,z.A=r,ze===null&&(Ye=null,Ce=0,Ii()),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?(_s=null,Es=rt()+500,bl(e,t)):ml=At(e,t);e:do try{if(He!==0&&ze!==null){t=ze;var r=Ut;t:switch(He){case 1:He=0,Ut=null,jl(e,t,r,1);break;case 2:case 9:if(Pu(r)){He=0,Ut=null,Qf(t);break}t=function(){He!==2&&He!==9||Ye!==e||(He=7),hn(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,Ut=null,Qf(t)):(He=0,Ut=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,Ut=null;var w=p.sibling;if(w!==null)ze=w;else{var N=p.return;N!==null?(ze=N,Rs(N)):ze=null}break t}}He=0,Ut=null,jl(e,t,r,5);break;case 6:He=0,Ut=null,jl(e,t,r,6);break;case 8:Qo(),Je=6;break e;default:throw Error(o(462))}}zg();break}catch(V){Lf(e,V)}while(!0);return wn=Ma=null,z.H=a,z.A=s,Oe=n,ze!==null?0:(Ye=null,Ce=0,Ii(),Je)}function zg(){for(;ze!==null&&!Ai();)Xf(ze)}function Xf(e){var t=pf(e.alternate,e,On);e.memoizedProps=e.pendingProps,t===null?Rs(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,On),t=pf(n,t,On)}e.memoizedProps=e.pendingProps,t===null?Rs(e):ze=t}function jl(e,t,n,a){wn=Ma=null,so(t),ul=null,Wl=0;var s=t.return;try{if(hg(e,s,t,n,Ce)){Je=1,bs(e,Vt(n,e.current)),ze=null;return}}catch(r){if(s!==null)throw ze=s,r;Je=1,bs(e,Vt(n,e.current)),ze=null;return}t.flags&32768?(Ee||a===1?e=!0:ml||(Ce&536870912)!==0?e=!1:(ta=e=!0,(a===2||a===9||a===3||a===6)&&(a=Ot.current,a!==null&&a.tag===13&&(a.flags|=16384))),Vf(t,e)):Rs(t)}function Rs(e){var t=e;do{if((t.flags&32768)!==0){Vf(t,ta);return}e=t.return;var n=gg(t.alternate,t,On);if(n!==null){ze=n;return}if(t=t.sibling,t!==null){ze=t;return}ze=t=e}while(t!==null);Je===0&&(Je=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);Je=6,ze=null}function Wf(e,t,n,a,s,r,f,p,w){e.cancelPendingCommit=null;do Os();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,cr(e,n,r,f,p,w),e===Ye&&(ze=Ye=null,Ce=0),xl=t,la=e,Nn=n,Yo=r,Go=s,Uf=a,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Eg(ga,function(){return If(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=z.T,z.T=null,s=L.p,L.p=2,f=Oe,Oe|=4;try{yg(e,t,n)}finally{Oe=f,L.p=s,z.T=a}}st=1,Kf(),Zf(),Ff()}}function Kf(){if(st===1){st=0;var e=la,t=xl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=z.T,z.T=null;var a=L.p;L.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 N=w.start,V=w.end;if(V===void 0&&(V=N),"selectionStart"in p)p.selectionStart=N,p.selectionEnd=Math.min(V,p.value.length);else{var Z=p.ownerDocument||document,H=Z&&Z.defaultView||window;if(H.getSelection){var Y=H.getSelection(),de=p.textContent.length,ge=Math.min(w.start,de),$e=w.end===void 0?ge:Math.min(w.end,de);!Y.extend&&ge>$e&&(f=$e,$e=ge,ge=f);var A=Au(p,ge),E=Au(p,$e);if(A&&E&&(Y.rangeCount!==1||Y.anchorNode!==A.node||Y.anchorOffset!==A.offset||Y.focusNode!==E.node||Y.focusOffset!==E.offset)){var R=Z.createRange();R.setStart(A.node,A.offset),Y.removeAllRanges(),ge>$e?(Y.addRange(R),Y.extend(E.node,E.offset)):(R.setEnd(E.node,E.offset),Y.addRange(R))}}}}for(Z=[],Y=p;Y=Y.parentNode;)Y.nodeType===1&&Z.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<Z.length;p++){var W=Z[p];W.element.scrollLeft=W.left,W.element.scrollTop=W.top}}Vs=!!ac,lc=ac=null}finally{Oe=s,L.p=a,z.T=n}}e.current=t,st=2}}function Zf(){if(st===2){st=0;var e=la,t=xl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=z.T,z.T=null;var a=L.p;L.p=2;var s=Oe;Oe|=4;try{kf(e,t.alternate,t)}finally{Oe=s,L.p=a,z.T=n}}st=3}}function Ff(){if(st===4||st===3){st=0,Di();var e=la,t=xl,n=Nn,a=Uf;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?st=5:(st=0,xl=la=null,Jf(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(aa=null),ba(n),t=t.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(Ln,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=z.T,s=L.p,L.p=2,z.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{z.T=t,L.p=s}}(Nn&3)!==0&&Os(),hn(e),s=e.pendingLanes,(n&261930)!==0&&(s&42)!==0?e===Xo?ui++:(ui=0,Xo=e):ui=0,di(0)}}function Jf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ql(t)))}function Os(){return Kf(),Zf(),Ff(),If()}function If(){if(st!==5)return!1;var e=la,t=Yo;Yo=0;var n=ba(Nn),a=z.T,s=L.p;try{L.p=32>n?32:n,z.T=null,n=Go,Go=null;var r=la,f=Nn;if(st=0,xl=la=null,Nn=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,di(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Ln,r)}catch{}return!0}finally{L.p=s,z.T=a,Jf(e,t)}}function Pf(e,t,n){t=Vt(n,t),t=So(e.stateNode,t,2),e=Jn(e,t,2),e!==null&&(Gn(e,2),hn(e))}function Be(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"&&(aa===null||!aa.has(a))){e=Vt(n,e),n=Pd(2),a=Jn(t,n,2),a!==null&&(ef(n,a,t,e),Gn(a,2),hn(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&&(Je===4||Je===3&&(Ce&62914560)===Ce&&300>rt()-Ms?(Oe&2)===0&&bl(e,0):Lo|=n,yl===Ce&&(yl=0)),hn(e)}function eh(e,t){t===0&&(t=Xa()),e=za(e,t),e!==null&&(Gn(e,t),hn(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 El(e,t)}var Ns=null,Sl=null,Ko=!1,Us=!1,Zo=!1,sa=0;function hn(e){e!==Sl&&e.next===null&&(Sl===null?Ns=Sl=e:Sl=Sl.next=e),Us=!0,Ko||(Ko=!0,Ag())}function di(e,t){if(!Zo&&Us){Zo=!0;do for(var n=!1,a=Ns;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-ot(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=Lt(a,a===Ye?r:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(r&3)===0||At(a,r)||(n=!0,lh(a,r));a=a.next}while(n);Zo=!1}}function _g(){th()}function th(){Us=Ko=!1;var e=0;sa!==0&&$g()&&(e=sa);for(var t=rt(),n=null,a=Ns;a!==null;){var s=a.next,r=nh(a,t);r===0?(a.next=null,n===null?Ns=s:n.next=s,s===null&&(Sl=n)):(n=a,(e!==0||(r&3)!==0)&&(Us=!0)),a=s}st!==0&&st!==5||di(e),sa!==0&&(sa=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-ot(r),p=1<<f,w=s[f];w===-1?((p&n)===0||(p&a)!==0)&&(s[f]=Yn(p,t)):w<=t&&(e.expiredLanes|=p),r&=~p}if(t=Ye,n=Ce,n=Lt(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&&qn(a),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||At(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&qn(a),ba(n)){case 2:case 8:n=Ri;break;case 32:n=ga;break;case 268435456:n=Ni;break;default:n=ga}return a=ah.bind(null,e),n=El(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&qn(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(Os()&&e.callbackNode!==n)return null;var a=Ce;return a=Lt(e,e===Ye?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(Bf(e,a,t),nh(e,rt()),e.callbackNode!=null&&e.callbackNode===n?ah.bind(null,e):null)}function lh(e,t){if(Os())return null;Bf(e,t,!0)}function Ag(){Gg(function(){(Oe&6)!==0?El(Al,_g):th()})}function Fo(){if(sa===0){var e=rl;e===0&&(e=$n,$n<<=1,($n&261888)===0&&($n=256)),sa=e}return sa}function ih(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Xi(""+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[ft]||null).action),f=a.submitter;f&&(t=(t=f[ft]||null)?ih(t.formAction):f.getAttribute("formAction"),t!==null&&(r=t,f=null));var p=new Ki("action","action",null,a,s);e.push({event:p,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(sa!==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);an(Rg,"on"+Og)}an(Uu,"onAnimationEnd"),an(Hu,"onAnimationIteration"),an(Bu,"onAnimationStart"),an("dblclick","onDoubleClick"),an("focusin","onFocus"),an("focusout","onBlur"),an(Fv,"onTransitionRun"),an(Jv,"onTransitionStart"),an(Iv,"onTransitionCancel"),an(qu,"onTransitionEnd"),Wa("onMouseEnter",["mouseout","mouseover"]),Wa("onMouseLeave",["mouseout","mouseover"]),Wa("onPointerEnter",["pointerout","pointerover"]),Wa("onPointerLeave",["pointerout","pointerover"]),ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ja("onBeforeInput",["compositionend","keypress","textInput","paste"]),ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fi="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(fi));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,N=p.currentTarget;if(p=p.listener,w!==r&&s.isPropagationStopped())break e;r=p,s.currentTarget=N;try{r(s)}catch(V){Ji(V)}s.currentTarget=null,r=w}else for(f=0;f<a.length;f++){if(p=a[f],w=p.instance,N=p.currentTarget,p=p.listener,w!==r&&s.isPropagationStopped())break e;r=p,s.currentTarget=N;try{r(s)}catch(V){Ji(V)}s.currentTarget=null,r=w}}}}function Te(e,t){var n=t[Va];n===void 0&&(n=t[Va]=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(Hh(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=ht(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 N=r,V=mr(n),Z=[];e:{var H=Lu.get(e);if(H!==void 0){var Y=Ki,de=e;switch(e){case"keypress":if(Vi(n)===0)break e;case"keydown":case"keyup":Y=Mv;break;case"focusin":de="focus",Y=kr;break;case"focusout":de="blur",Y=kr;break;case"beforeblur":case"afterblur":Y=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":Y=vu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=gv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=Av;break;case Uu:case Hu:case Bu:Y=xv;break;case qu:Y=Rv;break;case"scroll":case"scrollend":Y=pv;break;case"wheel":Y=Nv;break;case"copy":case"cut":case"paste":Y=jv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=mu;break;case"toggle":case"beforetoggle":Y=Hv}var ge=(t&4)!==0,$e=!ge&&(e==="scroll"||e==="scrollend"),A=ge?H!==null?H+"Capture":null:H;ge=[];for(var E=N,R;E!==null;){var W=E;if(R=W.stateNode,W=W.tag,W!==5&&W!==26&&W!==27||R===null||A===null||(W=Ol(E,A),W!=null&&ge.push(hi(E,W,R))),$e)break;E=E.return}0<ge.length&&(H=new Y(H,de,null,n,V),Z.push({event:H,listeners:ge}))}}if((t&7)===0){e:{if(H=e==="mouseover"||e==="pointerover",Y=e==="mouseout"||e==="pointerout",H&&n!==gr&&(de=n.relatedTarget||n.fromElement)&&(ht(de)||de[yn]))break e;if((Y||H)&&(H=V.window===V?V:(H=V.ownerDocument)?H.defaultView||H.parentWindow:window,Y?(de=n.relatedTarget||n.toElement,Y=N,de=de?ht(de):null,de!==null&&($e=h(de),ge=de.tag,de!==$e||ge!==5&&ge!==27&&ge!==6)&&(de=null)):(Y=null,de=N),Y!==de)){if(ge=vu,W="onMouseLeave",A="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(ge=mu,W="onPointerLeave",A="onPointerEnter",E="pointer"),$e=Y==null?H:kt(Y),R=de==null?H:kt(de),H=new ge(W,E+"leave",Y,n,V),H.target=$e,H.relatedTarget=R,W=null,ht(V)===N&&(ge=new ge(A,E+"enter",de,n,V),ge.target=R,ge.relatedTarget=$e,W=ge),$e=W,Y&&de)t:{for(ge=Ug,A=Y,E=de,R=0,W=A;W;W=ge(W))R++;W=0;for(var pe=E;pe;pe=ge(pe))W++;for(;0<R-W;)A=ge(A),R--;for(;0<W-R;)E=ge(E),W--;for(;R--;){if(A===E||E!==null&&A===E.alternate){ge=A;break t}A=ge(A),E=ge(E)}ge=null}else ge=null;Y!==null&&ch(Z,H,Y,ge,!1),de!==null&&$e!==null&&ch(Z,$e,de,ge,!0)}}e:{if(H=N?kt(N):window,Y=H.nodeName&&H.nodeName.toLowerCase(),Y==="select"||Y==="input"&&H.type==="file")var De=zu;else if(ku(H))if(Tu)De=Wv;else{De=Qv;var fe=Xv}else Y=H.nodeName,!Y||Y.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?N&&vr(N.elementType)&&(De=zu):De=Vv;if(De&&(De=De(e,N))){wu(Z,De,n,V);break e}fe&&fe(e,H,N),e==="focusout"&&N&&H.type==="number"&&N.memoizedProps.value!=null&&pr(H,"number",H.value)}switch(fe=N?kt(N):window,e){case"focusin":(ku(fe)||fe.contentEditable==="true")&&(Pa=fe,Er=N,Yl=null);break;case"focusout":Yl=Er=Pa=null;break;case"mousedown":_r=!0;break;case"contextmenu":case"mouseup":case"dragend":_r=!1,Ou(Z,n,V);break;case"selectionchange":if(Zv)break;case"keydown":case"keyup":Ou(Z,n,V)}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()):(Xn=V,br="value"in Xn?Xn.value:Xn.textContent,Ia=!0)),fe=Bs(N,Me),0<fe.length&&(Me=new gu(Me,e,null,n,V),Z.push({event:Me,listeners:fe}),ke?Me.data=ke:(ke=Su(n),ke!==null&&(Me.data=ke)))),(ke=qv?Lv(e,n):$v(e,n))&&(Me=Bs(N,"onBeforeInput"),0<Me.length&&(fe=new gu("onBeforeInput","beforeinput",null,n,V),Z.push({event:fe,listeners:Me}),fe.data=ke)),Dg(Z,e,N,n,V)}rh(Z,t)})}function hi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Bs(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=Ol(e,n),s!=null&&a.unshift(hi(e,s,r)),s=Ol(e,t),s!=null&&a.push(hi(e,s,r))),e.tag===3)return a;e=e.return}return[]}function Ug(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,N=p.stateNode;if(p=p.tag,w!==null&&w===a)break;p!==5&&p!==26&&p!==27||N===null||(w=N,s?(N=Ol(n,r),N!=null&&f.unshift(hi(n,N,w))):s||(N=Ol(n,r),N!=null&&f.push(hi(n,N,w)))),n=n.return}f.length!==0&&e.push({event:t,listeners:f})}var Hg=/\r\n?/g,Bg=/\u0000|\uFFFD/g;function uh(e){return(typeof e=="string"?e:""+e).replace(Hg,`
|
|
9
|
+
`).replace(Bg,"")}function dh(e,t){return t=uh(t),uh(e)===t}function Le(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":Yi(e,"class",a);break;case"tabIndex":Yi(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Yi(e,n,a);break;case"style":uu(e,a,r);break;case"data":if(t!=="object"){Yi(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=Xi(""+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"&&Le(e,t,"name",s.name,s,null),Le(e,t,"formEncType",s.formEncType,s,null),Le(e,t,"formMethod",s.formMethod,s,null),Le(e,t,"formTarget",s.formTarget,s,null)):(Le(e,t,"encType",s.encType,s,null),Le(e,t,"method",s.method,s,null),Le(e,t,"target",s.target,s,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=Xi(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=bn);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=Xi(""+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),$i(e,"popover",a);break;case"xlinkActuate":xn(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":xn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":xn(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":xn(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":xn(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":xn(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":xn(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":xn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":xn(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":$i(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,$i(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=bn);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[ft]||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,""):$i(e,n,a)}}}function mt(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:Le(e,t,r,f,n,null)}}s&&Le(e,t,"srcSet",n.srcSet,n,null),a&&Le(e,t,"src",n.src,n,null);return;case"input":Te("invalid",e);var p=r=f=s=null,w=null,N=null;for(a in n)if(n.hasOwnProperty(a)){var V=n[a];if(V!=null)switch(a){case"name":s=V;break;case"type":f=V;break;case"checked":w=V;break;case"defaultChecked":N=V;break;case"value":r=V;break;case"defaultValue":p=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(o(137,t));break;default:Le(e,t,a,V,n,null)}}su(e,r,p,w,N,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:Le(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:Le(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":Le(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<fi.length;a++)Te(fi[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(N in n)if(n.hasOwnProperty(N)&&(a=n[N],a!=null))switch(N){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Le(e,t,N,a,n,null)}return;default:if(vr(t)){for(V in n)n.hasOwnProperty(V)&&(a=n[V],a!==void 0&&nc(e,t,V,a,n,void 0));return}}for(p in n)n.hasOwnProperty(p)&&(a=n[p],a!=null&&Le(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,N=null,V=null;for(Y in n){var Z=n[Y];if(n.hasOwnProperty(Y)&&Z!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":w=Z;default:a.hasOwnProperty(Y)||Le(e,t,Y,null,a,Z)}}for(var H in a){var Y=a[H];if(Z=n[H],a.hasOwnProperty(H)&&(Y!=null||Z!=null))switch(H){case"type":r=Y;break;case"name":s=Y;break;case"checked":N=Y;break;case"defaultChecked":V=Y;break;case"value":f=Y;break;case"defaultValue":p=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:Y!==Z&&Le(e,t,H,Y,a,Z)}}hr(e,f,p,w,N,V,r,s);return;case"select":Y=f=p=H=null;for(r in n)if(w=n[r],n.hasOwnProperty(r)&&w!=null)switch(r){case"value":break;case"multiple":Y=w;default:a.hasOwnProperty(r)||Le(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&&Le(e,t,s,r,a,w)}t=p,n=f,a=Y,H!=null?Ka(e,!!n,H,!1):!!a!=!!n&&(t!=null?Ka(e,!!n,t,!0):Ka(e,!!n,n?[]:"",!1));return;case"textarea":Y=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:Le(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":Y=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(o(91));break;default:s!==r&&Le(e,t,f,s,a,r)}ru(e,H,Y);return;case"option":for(var de in n)H=n[de],n.hasOwnProperty(de)&&H!=null&&!a.hasOwnProperty(de)&&(de==="selected"?e.selected=!1:Le(e,t,de,null,a,H));for(w in a)H=a[w],Y=n[w],a.hasOwnProperty(w)&&H!==Y&&(H!=null||Y!=null)&&(w==="selected"?e.selected=H&&typeof H!="function"&&typeof H!="symbol":Le(e,t,w,H,a,Y));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 ge in n)H=n[ge],n.hasOwnProperty(ge)&&H!=null&&!a.hasOwnProperty(ge)&&Le(e,t,ge,null,a,H);for(N in a)if(H=a[N],Y=n[N],a.hasOwnProperty(N)&&H!==Y&&(H!=null||Y!=null))switch(N){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(137,t));break;default:Le(e,t,N,H,a,Y)}return;default:if(vr(t)){for(var $e in n)H=n[$e],n.hasOwnProperty($e)&&H!==void 0&&!a.hasOwnProperty($e)&&nc(e,t,$e,void 0,a,H);for(V in a)H=a[V],Y=n[V],!a.hasOwnProperty(V)||H===Y||H===void 0&&Y===void 0||nc(e,t,V,H,a,Y);return}}for(var A in n)H=n[A],n.hasOwnProperty(A)&&H!=null&&!a.hasOwnProperty(A)&&Le(e,t,A,null,a,H);for(Z in a)H=a[Z],Y=n[Z],!a.hasOwnProperty(Z)||H===Y||H==null&&Y==null||Le(e,t,Z,H,a,Y)}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],N=w.startTime;if(N>p)break;var V=w.transferSize,Z=w.initiatorType;V&&fh(Z)&&(w=w.responseEnd,f+=V*(w<p?1:(p-N)/(w-N)))}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 qs(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 ra(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")pi(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,pi(n);for(var r=n.firstChild;r;){var f=r.nextSibling,p=r.nodeName;r[ae]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&r.rel.toLowerCase()==="stylesheet"||n.removeChild(r),r=f}}else n==="body"&&pi(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),Ze(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[ae])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=Jt(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=Jt(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=Jt(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 Jt(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 Jt(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=qs(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 pi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ze(e)}var It=new Map,kh=new Set;function Ls(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Un=L.d;L.d={f:Kg,r:Zg,D:Fg,C:Jg,L:Ig,m:Pg,X:tm,S:em,M:nm};function Kg(){var e=Un.f(),t=As();return e||t}function Zg(e){var t=Yt(e);t!==null&&t.tag===5&&t.type==="form"?qd(t):Un.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=Xt(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"),mt(t,"link",e),ct(t),a.head.appendChild(t)))}}function Fg(e){Un.D(e),wh("dns-prefetch",e,null)}function Jg(e,t){Un.C(e,t),wh("preconnect",e,t)}function Ig(e,t,n){Un.L(e,t,n);var a=kl;if(a&&e&&t){var s='link[rel="preload"][as="'+Xt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Xt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Xt(n.imageSizes)+'"]')):s+='[href="'+Xt(e)+'"]';var r=s;switch(t){case"style":r=wl(e);break;case"script":r=zl(e)}It.has(r)||(e=b({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),It.set(r,e),a.querySelector(s)!==null||t==="style"&&a.querySelector(vi(r))||t==="script"&&a.querySelector(gi(r))||(t=a.createElement("link"),mt(t,"link",e),ct(t),a.head.appendChild(t)))}}function Pg(e,t){Un.m(e,t);var n=kl;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Xt(a)+'"][href="'+Xt(e)+'"]',r=s;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=zl(e)}if(!It.has(r)&&(e=b({rel:"modulepreload",href:e},t),It.set(r,e),n.querySelector(s)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(gi(r)))return}a=n.createElement("link"),mt(a,"link",e),ct(a),n.head.appendChild(a)}}}function em(e,t,n){Un.S(e,t,n);var a=kl;if(a&&e){var s=cn(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(vi(r)))p.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},n),(n=It.get(r))&&dc(e,n);var w=f=a.createElement("link");ct(w),mt(w,"link",e),w._p=new Promise(function(N,V){w.onload=N,w.onerror=V}),w.addEventListener("load",function(){p.loading|=1}),w.addEventListener("error",function(){p.loading|=2}),p.loading|=4,$s(f,t,a)}f={type:"stylesheet",instance:f,count:1,state:p},s.set(r,f)}}}function tm(e,t){Un.X(e,t);var n=kl;if(n&&e){var a=cn(n).hoistableScripts,s=zl(e),r=a.get(s);r||(r=n.querySelector(gi(s)),r||(e=b({src:e,async:!0},t),(t=It.get(s))&&fc(e,t),r=n.createElement("script"),ct(r),mt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(s,r))}}function nm(e,t){Un.M(e,t);var n=kl;if(n&&e){var a=cn(n).hoistableScripts,s=zl(e),r=a.get(s);r||(r=n.querySelector(gi(s)),r||(e=b({src:e,async:!0,type:"module"},t),(t=It.get(s))&&fc(e,t),r=n.createElement("script"),ct(r),mt(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=oe.current)?Ls(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=cn(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=cn(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(vi(e)))&&!r._p&&(f.instance=r,f.state.loading=5),It.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},It.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=cn(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="'+Xt(e)+'"'}function vi(e){return'link[rel="stylesheet"]['+e+"]"}function Th(e){return b({},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}),mt(t,"link",n),ct(t),e.head.appendChild(t))}function zl(e){return'[src="'+Xt(e)+'"]'}function gi(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~="'+Xt(n.href)+'"]');if(a)return t.instance=a,ct(a),a;var s=b({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),ct(a),mt(a,"style",s),$s(a,n.precedence,e),t.instance=a;case"stylesheet":s=wl(n.href);var r=e.querySelector(vi(s));if(r)return t.state.loading|=4,t.instance=r,ct(r),r;a=Th(n),(s=It.get(s))&&dc(a,s),r=(e.ownerDocument||e).createElement("link"),ct(r);var f=r;return f._p=new Promise(function(p,w){f.onload=p,f.onerror=w}),mt(r,"link",a),t.state.loading|=4,$s(r,n.precedence,e),t.instance=r;case"script":return r=zl(n.src),(s=e.querySelector(gi(r)))?(t.instance=s,ct(s),s):(a=n,(s=It.get(r))&&(a=b({},n),fc(a,s)),e=e.ownerDocument||e,s=e.createElement("script"),ct(s),mt(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,$s(a,n.precedence,e));return t.instance}function $s(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 Ys=null;function Mh(e,t,n){if(Ys===null){var a=new Map,s=Ys=new Map;s.set(n,a)}else s=Ys,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[ae]||r[tt]||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(vi(s));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Gs.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,ct(r);return}r=t.ownerDocument||t,a=Th(a),(s=It.get(s))&&dc(a,s),r=r.createElement("link"),ct(r);var f=r;f._p=new Promise(function(p,w){f.onload=p,f.onerror=w}),mt(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=Gs.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var hc=0;function sm(e,t){return e.stylesheets&&e.count===0&&Qs(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var a=setTimeout(function(){if(e.stylesheets&&Qs(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&&Qs(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 Gs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Xs=null;function Qs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xs=new Map,t.forEach(rm,e),Xs=null,Gs.call(e))}function rm(e,t){if(!(t.state.loading&4)){var n=Xs.get(e);if(n)var a=n.get(null);else{n=new Map,Xs.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=Gs.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 mi={$$typeof:B,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_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=ya(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ya(0),this.hiddenUpdates=ya(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,N,V,Z){return e=new om(e,t,n,f,w,N,V,Z,p),t=1,r===!0&&(t|=24),r=Rt(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=Fn(t),a.payload={element:n},r=r===void 0?null:r,r!==null&&(a.callback=r),n=Jn(e,a,t),n!==null&&(Et(n,e,t),Zl(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=za(e,67108864);t!==null&&Et(t,e,67108864),pc(e,67108864)}}function Uh(e){if(e.tag===13||e.tag===31){var t=Bt();t=Dl(t);var n=za(e,t);n!==null&&Et(n,e,t),pc(e,t)}}var Vs=!0;function cm(e,t,n,a){var s=z.T;z.T=null;var r=L.p;try{L.p=2,vc(e,t,n,a)}finally{L.p=r,z.T=s}}function um(e,t,n,a){var s=z.T;z.T=null;var r=L.p;try{L.p=8,vc(e,t,n,a)}finally{L.p=r,z.T=s}}function vc(e,t,n,a){if(Vs){var s=gc(a);if(s===null)tc(e,t,a,Ws,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=Yt(s);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var f=nn(r.pendingLanes);if(f!==0){var p=r;for(p.pendingLanes|=2,p.entangledLanes|=2;f;){var w=1<<31-ot(f);p.entanglements[1]|=w,f&=~w}hn(r),(Oe&6)===0&&(Es=rt()+500,di(0))}}break;case 31:case 13:p=za(r,2),p!==null&&Et(p,r,2),As(),pc(r,2)}if(r=gc(a),r===null&&tc(e,t,a,Ws,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 Ws=null;function mc(e){if(Ws=null,e=ht(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 Ws=e,null}function Hh(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(_l()){case Al:return 2;case Ri:return 8;case ga:case Oi:return 32;case Ni:return 268435456;default:return 32}default:return 32}}var yc=!1,oa=null,ca=null,ua=null,yi=new Map,xi=new Map,da=[],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":oa=null;break;case"dragenter":case"dragleave":ca=null;break;case"mouseover":case"mouseout":ua=null;break;case"pointerover":case"pointerout":yi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":xi.delete(t.pointerId)}}function bi(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=Yt(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 oa=bi(oa,e,t,n,a,s),!0;case"dragenter":return ca=bi(ca,e,t,n,a,s),!0;case"mouseover":return ua=bi(ua,e,t,n,a,s),!0;case"pointerover":var r=s.pointerId;return yi.set(r,bi(yi.get(r)||null,e,t,n,a,s)),!0;case"gotpointercapture":return r=s.pointerId,xi.set(r,bi(xi.get(r)||null,e,t,n,a,s)),!0}return!1}function qh(e){var t=ht(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,Li(e.priority,function(){Uh(n)});return}}else if(t===31){if(t=y(n),t!==null){e.blockedOn=t,Li(e.priority,function(){Uh(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 Ks(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=Yt(n),t!==null&&Nh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ks(e)&&n.delete(t)}function hm(){yc=!1,oa!==null&&Ks(oa)&&(oa=null),ca!==null&&Ks(ca)&&(ca=null),ua!==null&&Ks(ua)&&(ua=null),yi.forEach(Lh),xi.forEach(Lh)}function Zs(e,t){e.blockedOn===t&&(e.blockedOn=null,yc||(yc=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,hm)))}var Fs=null;function $h(e){Fs!==e&&(Fs=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Fs===e&&(Fs=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=Yt(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 Zs(w,e)}oa!==null&&Zs(oa,e),ca!==null&&Zs(ca,e),ua!==null&&Zs(ua,e),yi.forEach(t),xi.forEach(t);for(var n=0;n<da.length;n++){var a=da[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<da.length&&(n=da[0],n.blockedOn===null);)qh(n),n.blockedOn===null&&da.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[ft]||null;if(typeof r=="function")f||$h(n);else if(f){var p=null;if(r&&r.hasAttribute("formAction")){if(s=r,f=r[ft]||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}Js.prototype.render=xc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current,a=Bt();Rh(n,a,e,t,null,null)},Js.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),As(),t[yn]=null}};function Js(e){this._internalRoot=e}Js.prototype.unstable_scheduleHydration=function(e){if(e){var t=qi();e={blockedOn:null,target:e,priority:t};for(var n=0;n<da.length&&t!==0&&t<da[n].priority;n++);da.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"));L.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:z,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Is=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Is.isDisabled&&Is.supportsFiber)try{Ln=Is.inject(pm),xt=Is}catch{}}return Si.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[yn]=t.current,ec(e),new xc(t)},Si.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=Bt(),a=Dl(a),s=Fn(a),s.callback=null,Jn(n,s,a),n=a,t.current.lanes=n,Gn(t,n),hn(t),e[yn]=t.current,ec(e),new Js(t)},Si.version="19.2.8",Si}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","mission_done_at_cap","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","mission_doc_restored"],Yc=new Set,sr=new Set;let ki=null;function Up(){if(!ki){ki=new EventSource("/events"),ki.onopen=()=>sr.forEach(i=>i(!0)),ki.onerror=()=>sr.forEach(i=>i(!1));for(const i of Cm)ki.addEventListener(i,c=>{const u=JSON.parse(c.data);Yc.forEach(o=>o(i,u))})}}function Ci(i){return Up(),Yc.add(i),()=>Yc.delete(i)}function Mm(i){return Up(),sr.add(i),()=>sr.delete(i)}function pa(i){return i.costBasis==="priced"||i.costBasis==="free"||i.costBasis==="unpriced"?i.costBasis:i.metered===!1?"unpriced":"priced"}function Hp(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 Ne=0;function Bp(i,c,u){const o=[],d=(h,g,y)=>o.push({id:++Ne,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:pa(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?pa(o):i.costBasis,usage:o.usage??i.usage,agents:[{id:"director",status:"running"},...d],entries:[...i.entries,{id:++Ne,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_done_at_cap":return{...i,entries:[...i.entries,{id:++Ne,ts:u,agent:"system",kind:"system",title:"done, at the cap",body:String(o.text??"")}]};case"mission_incomplete":return{...i,entries:[...i.entries,{id:++Ne,ts:u,agent:"system",kind:"error",title:"not done",body:[o.text,"",...(o.unmet??[]).map(d=>`▢ ${d}`)].join(`
|
|
11
|
+
`)}]};case"run_error":return{...i,entries:[...i.entries,{id:++Ne,ts:u,agent:"system",kind:"error",title:"error",body:o.error}]};case"worker_stalled":return{...i,entries:[...i.entries,{id:++Ne,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:++Ne,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:++Ne,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:++Ne,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:pa(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:++Ne,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:++Ne,ts:u,agent:"system",kind:"error",title:"usage limit",body:o.text}]};case"models_changed":return{...i,entries:[...i.entries,{id:++Ne,ts:u,agent:"system",kind:"system",title:"models changed",body:o.text}]};case"memory_updated":return{...i,entries:[...i.entries,{id:++Ne,ts:u,agent:"system",kind:"system",title:"memory",body:String(o.text??"Project memory rewritten.")}]};case"pull_request":return{...i,entries:[...i.entries,{id:++Ne,ts:u,agent:"system",kind:o.error?"error":"system",title:o.method==="gh"?"pull request":"branch pushed",body:String(o.text??"")}]};case"mission_doc_restored":return{...i,entries:[...i.entries,{id:++Ne,ts:u,agent:"system",kind:"system",title:"mission doc restored",body:String(o.text??"")}]};case"git_branch":case"git_note":case"git_committed":return{...i,entries:[...i.entries,{id:++Ne,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:++Ne,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:++Ne,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:++Ne,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:++Ne,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:++Ne,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:++Ne,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:++Ne,ts:u,agent:"director",kind:"system",title:"resolved",body:"answered"}]}:i;case"root_allowed":return{...i,entries:[...i.entries,{id:++Ne,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:++Ne,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:++Ne,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?Ci((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),O=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(()=>{O();const K=setInterval(O,3e3),M=Ci((D,B)=>{if(!B.chat&&(["run_started","run_resumed","run_finished","permission_request","permission_resolved","permission_timeout","question","question_answered","question_timeout"].includes(D)&&O(),B.projectId))if(D==="run_finished")y(F=>{const{[B.projectId]:se,...q}=F;return q});else{const F=Rm(D,B.data);F&&y(se=>({...se,[B.projectId]:F.slice(0,160)}))}}),T=Mm(D=>{o(D),D&&O()});return()=>{clearInterval(K),M(),T()}},[O]),{projects:i,connected:u,auth:d,refresh:O,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(),Ci((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 Um(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:++Ne,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:pa(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?Um(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:++Ne,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:++Ne,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:++Ne,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 Hm(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=Ci((j,k)=>{if(!k.chat||k.projectId!==i)return;const O={event:j,data:k.data};o.current?o.current.push(O):u({t:"wire",e:O})});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 O of j.events)k=qp(k,O);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 dt("/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 dt("/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 dt("/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 dt=(i,c)=>fetch(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(c)}),_e={linkProject:(i,c,u)=>dt("/projects",{folder:i,name:c,provider:u}),cloneProject:(i,c)=>dt("/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)=>dt(`/runs/${encodeURIComponent(i)}/pr`,{title:c,body:u}),prState:i=>fetch(`/runs/${encodeURIComponent(i)}/pr/state`),memory:i=>fetch(`/projects/${encodeURIComponent(i)}/memory`),runServices:i=>fetch(`/runs/${encodeURIComponent(i)}/services`),stopService:(i,c)=>dt(`/runs/${encodeURIComponent(i)}/services/${c}/stop`,{}),instances:()=>fetch("/instances"),doctor:()=>fetch("/doctor"),setupDone:()=>dt("/setup/done",{}),installBrowser:()=>dt("/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={})=>dt("/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,allowDirty:o.allowDirty||void 0}),resume:(i,c={})=>dt(`/runs/${encodeURIComponent(i)}/resume`,c),permission:(i,c,u)=>dt("/permission",{id:i,behavior:c,message:u}),answer:(i,c)=>dt("/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 dt("/attachments",{projectId:i,files:u})},forkPlan:(i,c)=>dt("/chat/fork",{projectId:i,runId:c}),steer:(i,c)=>dt("/steer",{runId:i,text:c}),interrupt:i=>dt("/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)=>dt("/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
|
+
|
|
17
|
+
Attached files (in the project folder — read them):
|
|
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()??{},O=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:O,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 ce=(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=ce("activity",Wm);const Zm=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Fm=ce("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=ce("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=ce("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=ce("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=ce("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=ce("bug",iy);const ry=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],oy=ce("check",ry);const cy=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],uy=ce("chevron-down",cy);const dy=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],fy=ce("chevron-left",dy);const hy=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],py=ce("chevron-right",hy);const vy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],gy=ce("circle",vy);const my=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],yy=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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"}]],Uy=ce("file-text",Ny);const Hy=[["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=ce("file",Hy);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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("list-end",tx);const ax=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],lx=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("pen-line",xx);const jx=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Sx=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("search-check",Rx);const Nx=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ux=ce("search",Nx);const Hx=[["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=ce("send-horizontal",Hx);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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("sun",Zx);const Jx=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ix=ce("terminal",Jx);const Px=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],e0=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("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=ce("wrench",h0);const v0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],g0=ce("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=ce("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:Uy,Terminal:Ix,Search:Ux,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 ie({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 va({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(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(T=>T.items),k=y&&b&&(j.length>0||!d);m.useEffect(()=>{const T=D=>{const B=document.activeElement,F=B&&(B.tagName==="INPUT"||B.tagName==="TEXTAREA"||B.isContentEditable),se=D.key==="/"&&!F&&!D.metaKey&&!D.ctrlKey&&!D.altKey,q=D.key.toLowerCase()==="k"&&(D.metaKey||D.ctrlKey)&&!D.altKey;(se||q)&&(D.preventDefault(),g.current?.focus(),g.current?.select())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[]),m.useEffect(()=>{S(0)},[i,j.length]);const O=T=>{T.onPick?.(),c?.(""),g.current?.blur()},K=T=>{if(T.key==="Escape"){i?c?.(""):T.currentTarget.blur();return}!k||!j.length||(T.key==="ArrowDown"?(T.preventDefault(),S(D=>(D+1)%j.length)):T.key==="ArrowUp"?(T.preventDefault(),S(D=>(D-1+j.length)%j.length)):T.key==="Enter"&&(T.preventDefault(),O(j[v]??j[0])))};let M=-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(ie,{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:T=>c?.(T.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?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(ie,{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(T=>T.items.length).map(T=>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:[T.label,T.count!==void 0?` · ${T.count}`:""]}),T.items.map(D=>{M+=1;const B=M,F=B===v;return l.jsxs("button",{type:"button",role:"option","aria-selected":F,onMouseDown:se=>se.preventDefault(),onMouseEnter:()=>S(B),onClick:()=>O(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:[l.jsx(ie,{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(va,{status:D.status}),D.meta]})]},D.id)})]},T.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 l.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:[l.jsx(ie,{name:h.icon,size:12,strokeWidth:2.25,color:h.color}),o?y:`billing: ${y}`]})}function wi({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"}}),Ps=()=>l.jsx("span",{"aria-hidden":!0,style:{width:1,height:12,background:"var(--line)",margin:"0 var(--sp-2)",flex:"0 0 auto"}}),er=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&&er(u)!==er(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",...x},children:[l.jsxs(wi,{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(Ps,{}),l.jsxs(wi,{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:er(c)}),S&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx(ie,{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:er(S)})]})]}),o!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx(Ps,{}),l.jsxs(wi,{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(ie,{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(wi,{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(Ps,{})]}),g&&l.jsxs(l.Fragment,{children:[l.jsxs(wi,{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(Ps,{})]}),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(ie,{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(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 le({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 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&&b?C0[u]:null,...x},children:[d&&l.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:O=!0}){const[K,M]=m.useState(""),[T,D]=m.useState(!1),[B,F]=m.useState([]),[se,q]=m.useState(!1),U=m.useRef(null),$=m.useRef(null),G=X=>{if(!O)return;const ye=Array.from(X||[]);ye.length&&F(z=>{const L=new Set(z.map(Cc));return[...z,...ye.filter(ee=>!L.has(Cc(ee)))]})},ue=i??K,ne=c??M,P=!h&&!d&&(ue.trim().length>0||B.length>0);m.useEffect(()=>{const X=U.current;X&&(X.style.height="auto",X.style.height=Math.max(rp,Math.min(X.scrollHeight,op))+"px")},[ue]);const je=()=>{P&&(u?.(ue.trim()||(B.length?"See the attached files.":""),B),ne(""),F([]))};return l.jsxs("div",{style:{flex:"0 0 auto",background:se?"var(--brand-wash)":"var(--bg-card)",border:`1px solid ${T||se?"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:X=>{h||(X.preventDefault(),q(!0))},onDragLeave:X=>{X.target===X.currentTarget&&q(!1)},onDrop:X=>{X.preventDefault(),q(!1),h||G(X.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(ie,{name:d?"loading":"steer",size:15,color:"var(--brand)"})}),l.jsx("textarea",{ref:U,rows:3,value:ue,disabled:h,autoFocus:S,placeholder:h?g||"Not available right now.":y||"Ask, think out loud, or describe what you want built…",onChange:X=>ne(X.target.value),onPaste:X=>{X.clipboardData?.files?.length&&(X.preventDefault(),G(X.clipboardData.files))},onFocus:()=>D(!0),onBlur:()=>D(!1),onKeyDown:X=>{(X.metaKey||X.ctrlKey)&&X.key==="Enter"&&(X.preventDefault(),je())},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((X,ye)=>l.jsx(Vp,{name:X.name,size:X.size,onRemove:()=>F(z=>z.filter((L,ee)=>ee!==ye))},Cc(X)))}),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:x?`${x.model} via ${x.provider}`:void 0,children:[x&&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:[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."]}),l.jsx("span",{style:{marginLeft:"auto"}}),O&&l.jsx("input",{ref:$,type:"file",multiple:!0,style:{display:"none"},onChange:X=>{G(X.target.files),X.target.value=""}}),O&&l.jsx(le,{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(le,{size:"sm",variant:"danger",icon:"close",onClick:o,title:"Stop the planner and discard the rest of this reply",children:"Stop"}):l.jsx(le,{size:"sm",icon:"send",onClick:je,disabled:!P,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 rr(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 gn({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:rr(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,x)=>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})]},x)),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),[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 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(ie,{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(ie,{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:b&&!x?"changes":"payload"}),l.jsx("span",{style:{flex:1}}),b&&l.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:[l.jsx(ie,{name:"raw",size:12}),x?"diff":"raw"]})]}),l.jsx("div",{style:{padding:"6px 0",maxHeight:260,overflow:"auto"},children:b&&!x?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 tr(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
|
+
`).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 Mi({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:tr(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:tr(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:tr(d.body,c)},h):l.jsx("p",{style:{margin:0},children:d.body.map((g,y)=>l.jsxs(vn.Fragment,{children:[y>0&&l.jsx("br",{}),tr(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 l.jsx(O0,{agent:i,title:c,body:o,ts:d,style:x});if(u==="system"&&!o&&typeof c=="string"&&c.startsWith("result ·"))return l.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"?rr(i):void 0,k=d?new Date(d).toLocaleTimeString(void 0,{hour12:!1}):null,O=v?String(c||"tool").replace(/^[^\w]+/,""):null,K=v?null:c;return l.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:[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(gn,{agent:i,size:"sm"}),l.jsx("span",{children:i}),S&&h&&l.jsxs(l.Fragment,{children:[l.jsx(ie,{name:"chevronRight",size:11}),l.jsx(gn,{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(ie,{name:g==="now"?"now":"nextTurn",size:11}),g==="now"?"now":"next turn"]})]}),K&&K!==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(ie,{name:"error",size:11,strokeWidth:2.25}),K]})]}),v&&Fp.has(O)&&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:O,body:o}):u==="text"&&typeof o=="string"?l.jsx(Mi,{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(gn,{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),x=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(gn,{agent:i,size:"sm"}),l.jsx(ie,{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}),x&&l.jsx("span",{style:{marginLeft:"auto",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:x})]})}function Ba({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 l.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:l.jsx(ie,{name:i,size:d==="sm"?14:16})})}function or(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 U0({folder:i}){const[c,u]=vn.useState(!1),[o,d]=vn.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(ie,{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":or(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 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(ie,{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(U0,{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:[b,y&&l.jsx(Ba,{icon:g==="light"?"moon":"sun",label:g==="light"?"Switch to dark theme":"Switch to light theme",onClick:y}),x&&l.jsx(Ba,{icon:"settings",label:"Settings",onClick:x}),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 Ie({children:i}){return l.jsx("div",{style:{color:"var(--ink-2)",fontSize:"var(--fs-sm)"},children:i})}function Hn({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 Ke({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(ie,{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(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 H0={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 B=>{if(!h){g(!0),x("");try{const F=await B();F&&(x(F),g(!1))}catch(F){x(F instanceof Error?F.message:String(F)),g(!1)}}},O=B=>i.kind==="planner"?k(()=>o(i,B)):k(()=>u(i,B)),K=()=>{const B=b.trim();B&&O(B)},M=Array.isArray(i.options)&&i.options.length>0,T=i.kind==="question"||i.kind==="planner",D=T&&(v||!M);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(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"}}),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:H0[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(le,{size:"sm",variant:"good",disabled:h,onClick:()=>{k(()=>c(i,"allow"))},children:"Allow"}),l.jsx(le,{size:"sm",variant:"danger",disabled:h,onClick:()=>{k(()=>c(i,"deny"))},children:"Deny"})]}),T&&M&&i.options.map((B,F)=>l.jsxs("button",{type:"button",disabled:h,onClick:()=>{O(B)},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&&l.jsx("span",{style:{color:"var(--status-warning)",fontSize:"var(--fs-xs)"},children:"★"}),B]},B)),T&&M&&!v&&l.jsx(le,{size:"sm",variant:"ghost",disabled:h,onClick:()=>S(!0),children:"type…"}),D&&l.jsxs("form",{onSubmit:B=>{B.preventDefault(),K()},style:{display:"flex",alignItems:"center",gap:6,flex:"1 1 16rem",minWidth:0},children:[l.jsx("input",{autoFocus:v,value:b,disabled:h,placeholder:i.kind==="planner"?"Answer the planner…":"Answer the director…",onChange:B=>j(B.target.value),onKeyDown:B=>{B.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"}}),l.jsx(le,{size:"sm",type:"submit",icon:"send",disabled:h||!b.trim(),children:"Send"})]}),l.jsx("span",{style:{marginLeft:"auto",flex:"0 0 auto"},children:l.jsx(le,{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(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?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 qa(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 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?`${qa(o?.inputTokens??0)} in · ${qa(o?.outputTokens??0)} out`:`${qa(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 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:b,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(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:O}){const[K,M]=m.useState(!1),T=[S,b].filter(Boolean);return l.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)",...O},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:or(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:x,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:[T.length>0&&l.jsx("div",{title:"director · worker",style:{maxWidth:"16rem",overflow:"hidden",textOverflow:"ellipsis"},children:T.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),[x,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: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:[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:or(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(va,{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,{}),qa(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: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:[l.jsx(ie,{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(ie,{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,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 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(le,{variant:"ghost",size:"sm",icon:y?"loading":"resume",onClick:b,disabled:y,children:"Check again"}),l.jsx(le,{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 O=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(ie,{name:O.icon,size:14,color:O.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(le,{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 Ei({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 _i({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 Ve({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=l.jsx("input",{type:o,min:d,max:h,step:g,value:i,autoFocus:S,placeholder:u,onKeyDown:b,onChange:O=>c?.(o==="number"?Number(O.target.value):O.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?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 pn({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(ie,{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(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,O]=m.useState(!1),[K,M]=m.useState(""),[T,D]=m.useState(""),[B,F]=m.useState(""),[se,q]=m.useState(null),U=v?.state==="running",$=!!T.trim()&&!!se?.dest&&!U;m.useEffect(()=>{if(!x)return;const ne=T.trim();if(!ne){q(null);return}let P=!1;const je=setTimeout(()=>{Promise.resolve(x(ne)).then(X=>{P||q(X)}).catch(()=>{P||q(null)})},250);return()=>{P=!0,clearTimeout(je)}},[T,x]);const G=()=>{$&&y?.(T.trim(),B.trim()||void 0)},ue=b==="git"&&y;return l.jsxs(Ei,{width:520,onClose:U?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(pn,{size:"sm",value:b,onChange:ne=>{U||j(ne)},style:{marginLeft:"auto"},tabs:[{value:"folder",label:"Folder on this machine",icon:"folder"},{value:"git",label:"Git repository",icon:"provider"}]})]}),ue?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(Ve,{autoFocus:!0,placeholder:"https://github.com/owner/repo · git@host:owner/repo.git · owner/repo",value:T,onChange:D,disabled:U,onKeyDown:ne=>{ne.key==="Enter"&&G()}})]}),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(Ve,{placeholder:"main",value:B,onChange:F,disabled:U,width:220,onKeyDown:ne=>{ne.key==="Enter"&&G()}})]}),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:[!T.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."}),T.trim()&&se?.dest&&l.jsxs("span",{children:["Will be cloned to ",l.jsx("span",{style:{fontFamily:"var(--font-mono)",color:"var(--brand)"},children:se.dest})," and linked as ",l.jsx("b",{style:{color:"var(--ink-1)"},children:se.name}),"."]}),T.trim()&&se&&!se.dest&&l.jsx("span",{style:{color:"var(--status-error)"},children:se.error}),T.trim()&&!se&&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(Ke,{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(ne=>l.jsx(pp,{icon:"folder",onClick:()=>d?.(`${i}${i.endsWith("/")?"":"/"}${ne}`),children:ne},ne)),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(Ve,{autoFocus:!0,placeholder:"New folder name",value:K,onChange:M,onKeyDown:ne=>{ne.key==="Enter"&&h?.(K)},style:{flex:1}}),l.jsx(le,{variant:"good",onClick:()=>h?.(K),children:"Create"})]}),o&&l.jsx("div",{style:{padding:"4px var(--sp-3)"},children:l.jsx(Ke,{tone:"error",inline:!0,style:{fontSize:"var(--fs-xs)"},children:o})})]}),l.jsxs(_i,{children:[ue?null:l.jsx(le,{icon:"add",onClick:()=>O(!k),title:"Create a subfolder here",children:"New folder"}),l.jsx("span",{style:{flex:1}}),l.jsx(le,{onClick:S,disabled:U,children:"Cancel"}),ue?l.jsx(le,{variant:"primary",disabled:!$,onClick:G,children:U?"Cloning…":"Clone & link"}):l.jsx(le,{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(Ei,{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(ie,{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(_i,{style:{justifyContent:"flex-end"},children:l.jsx(le,{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(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 l.jsxs(Ei,{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(ie,{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(_i,{style:{justifyContent:"flex-end"},children:[l.jsx(le,{onClick:g,children:"Cancel"}),l.jsx(le,{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?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(le,{variant:"ghost",size:"sm",onClick:()=>{o.clear()},title:"Forget this conversation; the next message starts fresh",children:"Forget"}),l.jsx(Ba,{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(Ie,{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=>{b(j)},onStop:()=>{o.stop()},onChangeModel:i}),d&&l.jsx(Ke,{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":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:[l.jsx(ie,{name:"chevronLeft",size:14}),l.jsx("span",{style:{writingMode:"vertical-rl",fontSize:"var(--fs-xs)",letterSpacing:".06em",textTransform:"uppercase"},children:"Front desk"}),(x||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(""),[x,v]=m.useState(null),S=async(k,O)=>{v({state:"running",progress:"Starting git…"});const K=await _e.cloneProject(k,O),M=await K.json().catch(()=>({}));if(!K.ok){v({state:"error",error:M.error??`HTTP ${K.status}`});return}const T=M.id,D=async()=>{const B=await _e.cloneStatus(T).catch(()=>null),F=B&&B.ok?await B.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 O=await _e.browse(k);O.ok&&h(await O.json())},j=async k=>{if(!d)return;y("");const O=await _e.mkdir(d.path,k);O.ok?await b((await O.json().catch(()=>null))?.path??d.path):y((await O.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,O)=>{S(k,O)},cloneWhere:k=>_e.cloneWhere(k).then(O=>O.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,O]=m.useState(!1),[K,M]=e1(),[T,D]=m.useState(null),[B,F]=m.useState(null),se=async _=>{const J=await _e.linkProject(_);J.ok&&(g(),d((await J.json()).project.id))},q=Gp(),U=i1(_=>{se(_)},_=>{g(),d(_)}),$=S.trim().toLowerCase(),G=$?i.filter(_=>n1(_,$)):i,ue=a1(G),ne=G.filter(_=>_.activeRun).sort((_,J)=>(J.lastActivityAt??0)-(_.lastActivityAt??0)),P=G.filter(_=>!_.activeRun),je=i.filter(_=>_.activeRun).length,X=i.reduce((_,J)=>_+(Array.isArray(J.needs)?J.needs.length:(J.pendingPermissions||0)+(J.pendingQuestions||0)),0),ye=je===0&&X===0,z=ye&&i.length>0?"all quiet":[je>0?`${je} running`:null,X>0?`${X} needs you`:null].filter(Boolean).join(" · "),L=async _=>{_.preventDefault(),O(!1);const J=_.dataTransfer.items[0]?.webkitGetAsEntry?.();if(!J?.isDirectory)return;D({name:J.name,matches:null});const te=await _e.locate(J.name);D({name:J.name,matches:te.ok?(await te.json()).matches:[]})},ee=async _=>{const J=await l1(await _);return g(),J},he=(_,J)=>ee(_e.permission(_.id,J)),ve=(_,J)=>ee(_e.answer(_.id,J)),C=(_,J)=>ee(fetch("/chat/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({projectId:_.projectId,id:_.id,answers:{[_.text]:J}})}));return l.jsxs("div",{style:{height:"100%",overflow:"hidden",position:"relative",display:"flex",flexDirection:"column"},onDragOver:_=>{_.preventDefault(),O(!0)},onDragLeave:_=>{_.target===_.currentTarget&&O(!1)},onDrop:_=>{L(_)},children:[k&&l.jsx(I0,{}),l.jsxs(Ip,{mode:"fleet",subtitle:"mission control",theme:y,onToggleTheme:x,onSettings:v,search:j,children:[!c&&l.jsx(Ke,{tone:"disconnected",inline:!0,children:"disconnected"}),c&&o.mode==="none"&&l.jsx(Ke,{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."}),z&&l.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"2px 10px",borderRadius:"var(--r-pill)",border:`1px solid ${X>0?"var(--status-warning)":ye?"var(--line)":"var(--line-strong)"}`,background:X>0?"var(--brand-wash)":"transparent",fontSize:"var(--fs-xs)",color:ye?"var(--ink-3)":"var(--ink-1)",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:z}),i.length>0&&l.jsx(le,{variant:"primary",icon:"add",onClick:U.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:[G.length," of ",i.length]})]}),l.jsx(le,{variant:"ghost",size:"sm",onClick:()=>b?.(""),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:U.show})}),l.jsx(Ie,{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:[G.length===0&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[l.jsxs(Ie,{children:["No project matches “",S.trim(),"”. Runs that do are in the search box above."]}),l.jsx(le,{variant:"ghost",size:"sm",onClick:()=>b?.(""),children:"Show all"})]}),ue.length===0&&ne.length===0&&G.length>0&&l.jsx(Ie,{children:"All quiet — nothing running, nothing waiting on you. Open a project to plan its next mission."}),ue.length>0&&l.jsxs("section",{style:_c,children:[l.jsxs(Hn,{children:["Needs you · ",ue.length]}),l.jsx(q0,{items:ue,onPermission:he,onAnswer:ve,onPlanner:C,onOpen:d})]}),ne.length>0&&l.jsxs("section",{style:_c,children:[l.jsxs(Hn,{children:["Running · ",ne.length]}),l.jsx("div",{style:{background:"var(--bg-card)",border:"1px solid var(--line)",borderRadius:"var(--r-md)",overflow:"hidden"},children:ne.map((_,J)=>{const te=_.activeRun;return l.jsx(X0,{name:_.name,folder:_.folder,title:te.title,mission:te.mission,activity:u[_.id],costUsd:te.costUsd,budgetUsd:te.budgetUsd,costBasis:pa(te),usage:te.usage,turns:te.turns,directorModel:te.directorModel,workerModel:te.workerModel,createdAt:te.createdAt,onOpen:()=>d(_.id),style:J>0?{borderTop:"1px solid var(--line)"}:void 0},_.id)})})]}),P.length>0&&l.jsxs("section",{style:_c,children:[l.jsxs(Hn,{children:["Recent · ",P.length]}),l.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"var(--sp-3)"},children:P.map(_=>l.jsx(V0,{name:_.name,folder:_.folder,lastRun:_.lastRun&&_.lastRun.status!=="idle"&&_.lastRun.status!=="running"?_.lastRun:null,onOpen:()=>{const J=_.lastRun;J?.id&&h&&(J.status==="error"||J.status==="interrupted")?h(_.id,J.id):d(_.id)},onUnlink:()=>F(_)},_.id))})]})]})]}),i.length>0&&l.jsx(t1,{onSettings:v,open:K,onToggle:M})]}),U.open&&U.props&&l.jsx(F0,{...U.props,onClose:U.close}),T&&l.jsx(J0,{name:T.name,matches:T.matches,onPick:_=>{D(null),se(_)},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;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 yt({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(ie,{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 Pt({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),[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,O=u===gp.length-1,K=()=>{if(u===0)return l.jsxs(l.Fragment,{children:[l.jsx("h1",{style:zi,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:x?`Could not read this machine: ${x}`:"Reading this machine…"});if(u===1){const T=d.auth;return l.jsxs(l.Fragment,{children:[l.jsx("h1",{style:zi,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:[T.mode==="subscription"&&l.jsxs(yt,{tone:"ok",title:`Claude Code is signed in${T.account?.email?` as ${T.account.email}`:""}`,children:["Missions bill that subscription",T.account?.org?` (${T.account.org})`:"",". Source: ",l.jsx(Pt,{children:T.source}),"."]}),T.mode==="api-key"&&l.jsxs(yt,{tone:"ok",title:"An Anthropic API key is set in the environment",children:["Missions bill that key, per token. Source: ",l.jsx(Pt,{children:T.source}),"."]}),T.mode==="cloud"&&l.jsx(yt,{tone:"ok",title:`Claude through ${T.source}`,children:"Missions bill that cloud account."}),T.mode==="none"&&l.jsxs(yt,{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(Pt,{children:"claude"}),", then ",l.jsx(Pt,{children:"/login"}),". Restart Foreman and press ",l.jsx("em",{children:"Check again"}),"."]}),l.jsxs("li",{children:["Start Foreman with ",l.jsx(Pt,{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(yt,{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(yt,{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&&T.mode!=="none"&&l.jsx(yt,{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 T=d.phone;return l.jsxs(l.Fragment,{children:[l.jsx("h1",{style:zi,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:[T?.label&&l.jsxs(yt,{tone:"ok",title:`Linked to ${T.label}`,children:["Through ",T.bot?l.jsxs(Pt,{children:["@",T.bot.replace(/^@/,"")]}):"your bot","."]}),T&&!T.label&&l.jsxs(yt,{tone:"warn",title:"A bot is configured but no chat is linked yet",children:["Send it ",l.jsx(Pt,{children:"/start"})," from your phone to link this chat."]}),!T&&l.jsxs(yt,{tone:"none",title:"Not set up",children:["Create a bot with @BotFather, paste its token in Settings → Notifications, then send it ",l.jsx(Pt,{children:"/start"}),"."]})]}),l.jsx("div",{children:l.jsx(le,{variant:"ghost",size:"sm",icon:"needsYou",onClick:()=>c("notifications"),children:"Settings → Notifications"})})]})}if(u===3){const T=d.tailnet,D=d.browser;return l.jsxs(l.Fragment,{children:[l.jsx("h1",{style:zi,children:"Reach, and a browser for the crew."}),l.jsxs("div",{children:[T?l.jsxs(yt,{tone:"ok",title:`On a tailnet: ${T.dnsName??T.ip}`,children:["The dashboard is also at ",l.jsx(Pt,{children:T.url}),T.https?", over HTTPS":"",". Phone links open there.",!T.https&&l.jsxs(l.Fragment,{children:[" For HTTPS, ",l.jsx(Pt,{children:"tailscale serve"})," can front it; Foreman never opens a Funnel."]})]}):l.jsx(yt,{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(yt,{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(le,{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&&l.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 l.jsxs(l.Fragment,{children:[l.jsx("h1",{style:zi,children:k?"Set up, minus a provider.":"Ready."}),l.jsxs("div",{children:[l.jsxs(yt,{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":""]}),l.jsx(yt,{tone:d.phone?.label?"ok":"none",title:"Phone",children:d.phone?.label?`Telegram, ${d.phone.label}`:"not linked"}),l.jsx(yt,{tone:d.tailnet?"ok":"none",title:"Reach",children:d.tailnet?`localhost and ${d.tailnet.dnsName??d.tailnet.ip}`:"localhost"}),l.jsx(yt,{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(Pt,{children:"#/setup"})," whenever you want it, and ",l.jsx(Pt,{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(le,{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((M,T)=>{const D=T<u?"done":T===u?"now":"todo";return l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>T<u&&o(T),disabled:T>u,style:{display:"inline-flex",alignItems:"center",gap:6,background:"none",border:"none",padding:"4px 6px",font:"inherit",fontSize:"var(--fs-sm)",cursor:T<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(ie,{name:"done",size:11}):T+1}),M]})},M)})}),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:K()}),l.jsxs("footer",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[u>0&&l.jsx(le,{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(le,{variant:"ghost",icon:g?"loading":"resume",disabled:g||j,onClick:()=>{S()},children:"Check again"}),O?l.jsx(le,{variant:"primary",icon:"add",disabled:j,onClick:i,children:"Go link a project"}):l.jsx(le,{variant:"primary",disabled:j,onClick:()=>o(u+1),children:u===0?"Show me":u===1&&k?"Continue without a provider":"Continue"})]})]})})}const zi={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),[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 O=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 T=await M.json().catch(()=>null);k||(T&&(o(T),v(!1),y(null)),h(!1))};O();const K=c?setInterval(()=>{O()},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 O=>{if(k)return;if(!O.ok){v((await O.json().catch(()=>({}))).error||`HTTP ${O.status}`);return}const K=await O.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 l.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 nr(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:O}=f1(x,x+b),K=i.length?i.map(M=>M.id??M):[...new Set(c.map(M=>M.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:[K.map(M=>{const T=c.filter(q=>q.agent===M);if(!T.length)return null;const D=Math.min(...T.map(q=>q.ts)),B=i.find(q=>(q.id??q)===M)?.status,F=B==="running"&&u?S:Math.max(...T.map(q=>q.ts)),se=o&&o!==M;return l.jsxs(vn.Fragment,{children:[l.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:se?"var(--ink-2)":"var(--ink-1)",font:"inherit",textAlign:"left",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[l.jsx(gn,{agent:M,size:"sm"}),M]}),l.jsxs("div",{style:{position:"relative",height:g,background:"var(--bg-inset)",borderRadius:4,opacity:se?.45:1,overflow:"hidden"},children:[O.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(F)} - ${j(D)})`,top:6,bottom:6,minWidth:3,background:rr(M),opacity:.15,borderRadius:3}}),T.map(q=>{const U=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)":rr(M),boxShadow:"0 0 0 1px var(--bg-inset)"}}),$=`${nr(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:U},q.id??q.ts):l.jsx("span",{title:$,style:{position:"absolute",left:j(q.ts),top:q.kind==="text"?3:7,marginLeft:-1},children:U},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)"}})]})]},M)}),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:nr(x)}),O.map(M=>{const T=k(M);return T<12||T>88?null:l.jsx("span",{style:{position:"absolute",left:`${T}%`,top:0,transform:"translateX(-50%)",color:"var(--ink-3, var(--ink-2))"},children:nr(M)},M)}),l.jsx("span",{style:{position:"absolute",right:0,top:0},children:u?"now":nr(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(Hn,{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(ie,{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(Ie,{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(ie,{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 ha({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 ar(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 Ti="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 T=j.current;T&&(T.style.height="0px",T.style.height=`${Math.max(T.scrollHeight,d)}px`,k.current!=null&&(T.setSelectionRange(k.current,k.current),k.current=null))},[c,d]);const O=T=>{const D=T.target;let B=D.value,F=D.selectionStart;const se=T.nativeEvent?.inputType==="insertText"&&T.nativeEvent?.data==="`",q=B.slice(0,F),U=B.slice(F),$=q.lastIndexOf(`
|
|
30
|
+
`)+1;if(se&&q.slice($)==="```"&&(U===""||U.startsWith(`
|
|
31
|
+
`))){const G=(q.match(/^```/gm)||[]).length%2===1;G&&(U.match(/^```/gm)||[]).length%2===0?(B=`${q}
|
|
32
|
+
|
|
33
|
+
\`\`\`
|
|
34
|
+
${U.replace(/^\n/,"")}`,F+=1):G||(B=U.startsWith(`
|
|
35
|
+
`)?B:`${q}
|
|
36
|
+
${U}`,F+=1),k.current=F}u?.(B)},K=m1(c||""),M={margin:0,padding:Ti,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:{...M,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&&K.map((T,D)=>{const B=T.kind==="code"||T.kind==="fence";return l.jsx("div",{style:{...B?{background:"var(--bg-inset)",margin:`0 calc(-0.5 * ${Ti})`,padding:`0 calc(0.5 * ${Ti})`}:null,...T.kind==="fence"?{borderRadius:T.open?"6px 6px 0 0":"0 0 6px 6px"}:null,...T.kind==="quote"?{color:"var(--ink-1)",boxShadow:"inset 2px 0 0 var(--agent-worker)",margin:`0 calc(-1 * ${Ti})`,padding:`0 ${Ti}`}:null,...T.kind==="fence"?{color:"var(--ink-2)"}:null,...T.kind==="code"?{color:"var(--ink-1)"}:null},children:T.text===""?"":T.kind==="fence"?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"transparent"},children:"```"}),T.text.slice(3)]}):T.kind==="code"?T.text:T.kind==="list"?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--brand)"},children:/^\s*[-*]\s+/.exec(T.text)[0]}),ar(T.text.replace(/^\s*[-*]\s+/,""))]}):T.kind==="heading"?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--brand)"},children:/^#{1,3}\s/.exec(T.text)[0]}),ar(T.text.replace(/^#{1,3}\s/,""))]}):T.kind==="quote"?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--ink-2)"},children:/^>\s?/.exec(T.text)[0]}),ar(T.text.replace(/^>\s?/,""))]}):ar(T.text)},D)})]}),l.jsx("textarea",{ref:j,value:c,onChange:O,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?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 rn({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,O]=m.useState(null),[K,M]=m.useState(""),T=m.useRef(null),D=m.useRef(null),B=m.useRef(null),F=y?{...mp,model:y}:mp,se=d||x1,q=[...x?[F]:[],...se],U=q.find(L=>L.id===u)||(u?{id:u,label:u,model:u}:F),$=se.length>6,G=K.trim().toLowerCase(),ue=L=>!G||[L.label,L.model,L.id,L.providerLabel,L.note,L.record].some(ee=>String(ee??"").toLowerCase().includes(G)),ne=$&&G?se.filter(ue):se,P=S1(ne),je=P.length>1;m.useEffect(()=>{if(!b)return;const L=he=>{T.current&&!T.current.contains(he.target)&&j(!1)},ee=he=>{he.key==="Escape"&&j(!1)};return document.addEventListener("mousedown",L),document.addEventListener("keydown",ee),()=>{document.removeEventListener("mousedown",L),document.removeEventListener("keydown",ee)}},[b]),m.useEffect(()=>{if(!b||!D.current)return;const L=D.current.querySelector('[data-selected="true"]');L&&L.scrollIntoView({block:"nearest"})},[b]),m.useEffect(()=>{if(!b){M("");return}B.current?.focus()},[b]);const X=()=>{const L=P[0]?.items[0];L&&(o?.(L.id,L),j(!1))},ye=nv(U),z=U.id&&ye!=="Anthropic";return l.jsxs("div",{ref:T,style:{position:"relative",display:c?"block":"inline-block",...c?{width:"100%"}:{},...S},children:[l.jsxs("button",{type:"button",disabled:v||h,onClick:()=>j(L=>!L),"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:[l.jsx(ie,{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…":U.label}),z&&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:ye})]}),l.jsx(ie,{name:"chevronDown",size:14,color:"var(--ink-2)"})]}),b&&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:K,onChange:L=>M(L.target.value),placeholder:`Filter ${se.length} models…`,"aria-label":"Filter models",onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),X())},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:[$&&G&&ne.length===0&&l.jsxs("div",{style:{padding:"10px",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:["No model matches “",K.trim(),"”."]}),x&&!G&&l.jsx(yp,{m:F,selected:U.id===F.id,hover:k===F.id,onHover:O,onClick:()=>{o?.(F.id,F),j(!1)}},F.id),P.map(L=>l.jsxs(vn.Fragment,{children:[je&&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:L.label}),l.jsx("span",{children:L.items.length})]}),L.items.map(ee=>l.jsx(yp,{m:ee,selected:U.id===ee.id,hover:k===ee.id,onHover:O,onClick:()=>{o?.(ee.id,ee),j(!1)}},ee.id))]},L.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(ie,{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})})]})}rn.useModels=b1;function _t({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 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: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:l.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…
|
|
37
|
+
|
|
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
|
+
|
|
40
|
+
Done when: the reproduction no longer fails and a regression test covers it.
|
|
41
|
+
Constraints: no unrelated refactors; keep the public API unchanged.
|
|
42
|
+
Ask me before: changing behaviour that other code depends on.`},{id:"tests",label:"Add tests",icon:"ListChecks",budget:4,director:"",worker:"haiku",brief:`Add tests for: <module or feature>
|
|
43
|
+
|
|
44
|
+
Done when: each public function has at least one happy-path and one edge-case test, and the suite passes.
|
|
45
|
+
Constraints: use the existing test runner and conventions; no new dependencies.
|
|
46
|
+
Ask me before: changing production code to make it testable.`},{id:"refactor",label:"Refactor",icon:"Shuffle",budget:6,director:"fable",worker:"sonnet",brief:`Refactor: <what, and why>
|
|
47
|
+
|
|
48
|
+
Done when: behaviour is unchanged (existing tests pass), the code is <goal, e.g. split into pure functions>, and nothing outside <scope> is touched.
|
|
49
|
+
Constraints: one concern per commit-sized step; keep diffs reviewable.
|
|
50
|
+
Ask me before: renaming anything exported.`},{id:"audit",label:"Audit",icon:"SearchCheck",budget:2,director:"",worker:"haiku",brief:`Audit: <area, e.g. error handling / security / accessibility>
|
|
51
|
+
|
|
52
|
+
Done when: a written report in .foreman/AUDIT.md lists findings ranked by severity with file:line references — no code changes.
|
|
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 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(ie,{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(ie,{name:i,size:13}),c]})}function T1({folder:i,defaultBudgetUsd:c=5,error:u,errorAction:o,busy:d,templates:h=w1,models:g,modelsLoading:y,modelsNote:x,modelsInheritNote:v,onStart:S,style:b}){const j=m.useMemo(()=>{try{return JSON.parse(localStorage.getItem(Dc(i))||"null")}catch{return null}},[i]),[k,O]=m.useState(j?.mission??""),[K,M]=m.useState(j?.budget??c),[T,D]=m.useState(j?.directorModel??""),[B,F]=m.useState(j?.workerModel??""),[se,q]=m.useState(j?.directorProviderId),[U,$]=m.useState(j?.workerProviderId),[G,ue]=m.useState(j?.browserTools??!1),[ne,P]=m.useState(j?"restored":null),[je,X]=m.useState("write"),[ye,z]=m.useState([]),[L,ee]=m.useState(!1),[he,ve]=m.useState(!1),C=m.useRef(null),_=m.useRef(null);m.useEffect(()=>{const Q=setTimeout(()=>{try{(k.trim()||j)&&(localStorage.setItem(Dc(i),JSON.stringify({mission:k,budget:K,directorModel:T,workerModel:B,browserTools:G})),k.trim()&&P("saved"))}catch{}},400);return()=>clearTimeout(Q)},[k,K,T,B,G,i]);const J=Q=>{O(Q.brief),M(Q.budget),D(Q.director),F(Q.worker),X("write")},te=()=>{O(""),z([]),P(null);try{localStorage.removeItem(Dc(i))}catch{}},re=Q=>{const we=Array.from(Q||[]);we.length&&z(I=>{const We=new Set(I.map(Rc));return[...I,...we.filter(Ue=>!We.has(Rc(Ue)))]})},oe=!d&&k.trim().length>0,xe=()=>{oe&&S?.({mission:k.trim(),budget:K,directorModel:T,workerModel:B,directorProviderId:se,workerProviderId:U,browserTools:G,attachments:ye})},Ae=Q=>{const we=C.current;if(!we){X("write");return}const I=we.selectionStart??k.length,We=we.selectionEnd??I,Ue=k.slice(I,We);let jt,qt;if(Q==="code")jt=`\`${Ue||"code"}\``,qt=Ue?I+jt.length:I+1;else if(Q==="quote")jt=(Ue||"quoted text").split(`
|
|
55
|
+
`).map(Bn=>`> ${Bn}`).join(`
|
|
56
|
+
`),qt=Ue?I+jt.length:I+2;else{const on=I>0&&k[I-1]!==`
|
|
57
|
+
`?`
|
|
58
|
+
`:"";jt=`${on}\`\`\`
|
|
59
|
+
${Ue||""}
|
|
60
|
+
\`\`\`
|
|
61
|
+
`,qt=I+on.length+4}const La=k.slice(0,I)+jt+k.slice(We);O(La),X("write"),requestAnimationFrame(()=>{we.focus();const on=Ue?qt:qt+(Q==="code"?4:Q==="quote"?11:0);we.setSelectionRange(qt,on)})},me=L?"var(--brand)":he?"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)",...b},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(ie,{name:"template",size:12}),"Start from"]}),h.map(Q=>l.jsx(le,{size:"sm",icon:Q.icon,title:`Budget $${Q.budget} · director ${Q.director||"default"} · workers ${Q.worker||"default"}`,onClick:()=>J(Q),children:Q.label},Q.id))]}),l.jsxs("div",{onDragOver:Q=>{Q.preventDefault(),L||ee(!0)},onDragLeave:Q=>{Q.currentTarget.contains(Q.relatedTarget)||ee(!1)},onDrop:Q=>{Q.preventDefault(),ee(!1),re(Q.dataTransfer.files)},style:{background:"var(--bg-card)",border:`1px solid ${me}`,borderRadius:"var(--r-md)",overflow:"hidden",boxShadow:L?"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:je==="write",onClick:()=>X("write")}),l.jsx(bp,{icon:"preview",label:"Preview",active:je==="preview",onClick:()=>X("preview")}),l.jsx("span",{style:{flex:1}}),l.jsx(Oc,{icon:"quote",label:"Quote (> )",onClick:()=>Ae("quote")}),l.jsx(Oc,{icon:"code",label:"Inline code (`)",onClick:()=>Ae("code")}),l.jsx(Oc,{icon:"codeBlock",label:"Code block (```)",onClick:()=>Ae("block")})]}),je==="write"?l.jsx(y1,{ref:C,value:k,onChange:O,placeholder:k1,minHeight:200,maxHeight:440,onKeyDown:Q=>{(Q.metaKey||Q.ctrlKey)&&Q.key==="Enter"&&(Q.preventDefault(),xe())},onPaste:Q=>{Q.clipboardData?.files?.length&&(Q.preventDefault(),re(Q.clipboardData.files))},onFocus:()=>ve(!0),onBlur:()=>ve(!1)}):l.jsx("div",{style:{minHeight:200,maxHeight:440,overflowY:"auto",padding:"var(--sp-3)",boxSizing:"border-box"},children:k.trim()?l.jsx(Mi,{text:k}):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:_,type:"file",multiple:!0,style:{display:"none"},onChange:Q=>{re(Q.target.files),Q.target.value=""}}),l.jsx(le,{size:"sm",variant:"ghost",icon:"attach",title:"Attach files — or drop them on the editor, or paste an image",onClick:()=>_.current?.click(),children:"Attach"}),ye.map((Q,we)=>l.jsx(Vp,{name:Q.name,size:Q.size,onRemove:()=>z(I=>I.filter((We,Ue)=>Ue!==we))},Rc(Q))),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:[ne&&l.jsxs(l.Fragment,{children:[l.jsx(ie,{name:"draft",size:11}),ne==="restored"?"Draft restored":"Draft saved"]}),(k||ye.length>0)&&l.jsx("button",{type:"button",onClick:te,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(ha,{layout:"stacked",label:"Budget cap",hint:"Hard stop; the run halts here.",children:l.jsx(Ve,{type:"number",min:1,step:1,width:96,prefix:"$",value:K,onChange:M})}),l.jsx(ha,{layout:"stacked",label:"Director",hint:"Plans, delegates, verifies.",children:l.jsx(rn,{value:T,models:g,loading:y,note:x,inheritNote:v,onChange:(Q,we)=>{D(Q),q(we?.providerId)}})}),l.jsx(ha,{layout:"stacked",label:"Workers",hint:"Implement. Cheaper models cut cost.",children:l.jsx(rn,{value:B,models:g,loading:y,note:x,inheritNote:v,onChange:(Q,we)=>{F(Q),$(we?.providerId)}})}),l.jsx(ha,{label:"Browser",hint:"Headless Playwright for the agents — navigate, click, screenshot. Non-local URLs still ask you.",children:l.jsx(_t,{checked:G,onChange:ue,label:G?"on":"off"})})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--sp-3)",flexWrap:"wrap"},children:[u&&l.jsxs(Ke,{tone:"error",inline:!0,style:{marginRight:"auto"},children:[u,o&&l.jsx("button",{type:"button",onClick:o.onClick,disabled:d,style:{marginLeft:8,background:"none",border:0,padding:0,font:"inherit",color:"inherit",textDecoration:"underline",cursor:d?"default":"pointer"},children:o.label})]}),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(le,{variant:"primary",disabled:!oe,onClick:xe,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),O=m.useRef(null),K=i.length===1&&!i[0]?.multi,M=i.every(U=>{const $=g[U.question];return Array.isArray($)?$.length>0:!!$});m.useEffect(()=>{y({}),v(""),b(0),k(!1)},[i]);const T=m.useMemo(()=>{const U={};for(const $ of i){const G=g[$.question];Array.isArray(G)?U[$.question]=G.join(", "):G&&(U[$.question]=G)}return U},[g,i]),D=U=>{j||(k(!0),o?.(U))},B=(U,$)=>{if(j)return;if(U.multi){y(ue=>{const ne=Array.isArray(ue[U.question])?ue[U.question]:[],P=ne.includes($)?ne.filter(je=>je!==$):[...ne,$];return{...ue,[U.question]:P}});return}const G={...g,[U.question]:$};y(G),K&&D({[U.question]:$})},F=()=>{const U=x.trim();if(!U||j)return;const $=i[Math.min(S,i.length-1)],G={...T,[$.question]:U};if(i.length===1){k(!0),o?.(G);return}k(!0),o?.(G)},se=U=>{if(U.target.tagName==="TEXTAREA"){(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),F());return}const $=i[S];if($)if(/^[1-9]$/.test(U.key)){const G=$.options[Number(U.key)-1];G&&(U.preventDefault(),B($,G.label))}else U.key==="ArrowDown"?(U.preventDefault(),b(G=>Math.min(i.length-1,G+1))):U.key==="ArrowUp"?(U.preventDefault(),b(G=>Math.max(0,G-1))):U.key==="Enter"&&!K&&M&&(U.preventDefault(),D(T))},q=c?Math.max(0,Math.round((Date.now()-c)/6e4)):0;return l.jsxs("div",{ref:O,tabIndex:0,onKeyDown:se,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(ie,{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((U,$)=>{const G=g[U.question],ue=Array.isArray(G)?G.length>0:!!G,ne=$===S;return l.jsxs("div",{onMouseEnter:()=>b($),style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"1px solid var(--line)",background:ne&&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:ue?"var(--status-ok, var(--brand))":"var(--ink-2)"},children:ue?"✓":`${$+1}.`}),l.jsx("span",{children:U.question}),U.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:U.options.map((P,je)=>{const X=Array.isArray(G)?G.includes(P.label):G===P.label;return l.jsxs("button",{type:"button",disabled:j,onClick:()=>B(U,P.label),title:P.hint||(je===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:X?"color-mix(in srgb, var(--brand) 16%, transparent)":"var(--bg-inset)",border:`1px solid ${X?"var(--brand)":"var(--line-strong)"}`,color:X?"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:X?"var(--brand)":"var(--ink-2)"},children:je+1}),P.label,je===0&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontWeight:"var(--fw-normal)"},children:"· recommended"})]}),P.hint&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:P.hint})]},P.label)})})]},U.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:x,disabled:j,placeholder:i.length>1?`Something else for question ${S+1}…`:"Something else…",onChange:U=>v(U.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()?l.jsx(le,{size:"sm",icon:"send",onClick:F,disabled:j,title:"⌘↵",children:"Send"}):K?null:l.jsx(le,{size:"sm",variant:"primary",onClick:()=>D(T),disabled:j||!M,title:M?"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:x,modelRationale:v,models:S,modelsLoading:b,modelsNote:j,modelsInheritNote:k,busy:O,error:K,errorAction:M,onStart:T,onDismiss:D,style:B}){const[F,se]=m.useState(i),[q,U]=m.useState(u),[$,G]=m.useState(!!d),[ue,ne]=m.useState(h||""),[P,je]=m.useState(g||""),[X,ye]=m.useState(y),[z,L]=m.useState(x),ee=F!==i||Number(q)!==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)",...B},children:[l.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)"},children:[l.jsx(ie,{name:"orchestration",size:16,color:"var(--brand)"}),l.jsx("span",{style:{fontSize:"var(--fs-lg)",fontWeight:"var(--fw-semibold)"},children:"Proposed mission"}),ee&&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:F,onChange:he=>se(he.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((he,ve)=>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:he})]},ve))]}),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(ie,{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(ha,{layout:"stacked",label:"Budget cap",hint:"Hard stop; the run halts here.",children:l.jsx(Ve,{type:"number",prefix:"$",min:0,step:1,width:96,value:q,onChange:U})}),l.jsx(ha,{layout:"stacked",label:"Director",hint:"Plans, delegates, verifies.",children:l.jsx(rn,{value:ue,models:S,loading:b,note:j,inheritNote:k,onChange:(he,ve)=>{ne(he),ye(ve?.providerId)}})}),l.jsx(ha,{layout:"stacked",label:"Workers",hint:"Implement. Cheaper models cut cost.",children:l.jsx(rn,{value:P,models:S,loading:b,note:j,inheritNote:k,onChange:(he,ve)=>{je(he),L(ve?.providerId)}})}),l.jsx(ha,{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(_t,{checked:$,onChange:G,label:$?"on":"off"})})]}),K&&l.jsxs(Ke,{tone:"error",inline:!0,children:[K,M&&l.jsx("button",{type:"button",onClick:M.onClick,disabled:O,style:{marginLeft:8,background:"none",border:0,padding:0,font:"inherit",color:"inherit",textDecoration:"underline",cursor:O?"default":"pointer"},children:M.label})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--sp-2)"},children:[l.jsx(le,{variant:"ghost",onClick:D,disabled:O,children:"Not this one"}),l.jsx(le,{variant:"primary",icon:"orchestration",disabled:O||!F.trim(),title:"Starts the mission: a director plans it and workers do the work",onClick:()=>T?.({mission:F.trim(),budget:Number(q)||u,directorModel:ue,workerModel:P,directorProviderId:X,workerProviderId:z,browserTools:$}),children:O?"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,O]=m.useState("director"),[K,M]=m.useState("next"),[T,D]=m.useState(!1),[B,F]=m.useState(!1),se=m.useRef(null),q=m.useRef(null),U=o??b,$=d??j,G=c??k,ue=u??O,ne=h??K,P=g??M,je=i.filter(z=>z.status==="running"||z.id==="director"),X=!x&&U.trim().length>0;m.useEffect(()=>{const z=se.current;z&&(z.style.height="auto",z.style.height=Math.min(z.scrollHeight,132)+"px")},[U]),m.useEffect(()=>{if(!T)return;const z=L=>{q.current&&!q.current.contains(L.target)&&D(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[T]);const ye=()=>{X&&(y?.(U.trim(),{to:G,timing:ne}),$(""))};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:x?.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(ie,{name:"steer",size:15,color:"var(--brand)",style:{marginTop:3,flex:"0 0 auto"}}),l.jsx("textarea",{ref:se,rows:1,value:U,disabled:x,placeholder:x?v||"Nothing is running.":`Steer ${G}… a constraint, a correction, a hint. Not a question reply.`,onChange:z=>$(z.target.value),onFocus:()=>F(!0),onBlur:()=>F(!1),onKeyDown:z=>{(z.metaKey||z.ctrlKey)&&z.key==="Enter"&&(z.preventDefault(),ye())},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:G,open:T,onClick:()=>!x&&D(z=>!z),disabled:x}),l.jsx(pn,{size:"sm",tabs:E1,value:ne,onChange:P}),l.jsx("span",{style:{marginLeft:"auto",fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap"},children:ne==="now"?"Interrupts the current tool call":"Delivered before the next tool call"}),l.jsx(le,{size:"sm",icon:"send",onClick:ye,disabled:!X,title:"⌘↵",children:"Send"})]}),T&&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:je.map(z=>l.jsx(D1,{agent:z,selected:z.id===G,onSelect:()=>{ue(z.id),D(!1),se.current?.focus()}},z.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(gn,{agent:i,size:"sm"}),l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:i}),l.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 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(ie,{name:"check",size:12,strokeWidth:2.5})}),l.jsx(gn,{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(ie,{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(gn,{agent:d.id,size:"sm"}),d.id,l.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,O=h?(h.inputTokens||0)+(h.outputTokens||0)+(h.cacheReadTokens||0)+(h.cacheWriteTokens||0):0,K=d==="priced"?`$${k.toFixed(2)}`:d==="unpriced"&&O>0?`${qa(O)} tok`:null,M=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)":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:[l.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}),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:[M&&l.jsx("span",{children:M}),K&&l.jsx("span",{title:d==="unpriced"?"This provider publishes no prices; tokens are what is known.":void 0,children:K}),l.jsx(va,{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 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(ie,{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(ie,{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(le,{variant:"good",onClick:g,children:"Allow"}),l.jsx(le,{variant:"good",onClick:y,title:b.hint,children:b.label}),l.jsx(le,{variant:"danger",onClick:x,children:"Deny"})]})]})}function U1({question:i,options:c=[],value:u,onChange:o,onAnswer:d,style:h}){const[g,y]=m.useState(""),x=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(ie,{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,b)=>l.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:[l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-xs)",color:"var(--ink-2)"},children:b+1}),S,b===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:x,onChange:v})}),l.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:l.jsx(le,{variant:"primary",onClick:()=>d?.(x),disabled:!String(x).trim(),children:"Answer"})})]})}function H1(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=H1(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: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?l.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:[l.jsx(ie,{name:"running",size:14,color:"var(--status-good)",strokeWidth:2}),d.agent&&l.jsx(gn,{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:{...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:[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(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=>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(U1,{question:j.question,options:j.options,onAnswer:k=>x?.(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(Ie,{children:"MISSION.md not written yet."}),i&&!u&&l.jsx(Ie,{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(ie,{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("+"),x=!g&&d.startsWith("-");return l.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&&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??""),[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,O]=m.useState(null),[K,M]=m.useState(null),T=i?.kind,D=T==="diff",B=i?.path?.split("/").pop()??"",F=/\.md$/i.test(B);if(m.useEffect(()=>{const $=G=>{G.key==="Escape"?o():G.key==="ArrowLeft"&&b?(G.preventDefault(),b()):G.key==="ArrowRight"&&j&&(G.preventDefault(),j())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[o,b,j]),m.useEffect(()=>{if(O(null),M(null),T!=="text"||!c)return;let $=!0;return fetch(c).then(async G=>{if(!G.ok)throw new Error(`HTTP ${G.status}`);const ue=await G.text();$&&O(ue.length>Nc?`${ue.slice(0,Nc)}
|
|
64
|
+
|
|
65
|
+
[… ${ue.length-Nc} more characters — open in a new tab for the whole file]`:ue)}).catch(G=>{$&&M(String(G.message||G))}),()=>{$=!1}},[c,T]),!i)return null;const se=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&&x==="rendered"?q=l.jsx("iframe",{title:i.path,src:u,sandbox:"allow-scripts",style:{width:"100%",height:"100%",border:"none",background:"#fff"}}):T==="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)"}}):T==="pdf"?q=l.jsx("iframe",{title:i.path,src:c,style:{width:"100%",height:"100%",border:"none",background:"var(--bg-inset)"}}):T==="text"?q=K?l.jsxs("div",{style:{padding:"var(--sp-3)",color:"var(--status-critical)"},children:["Could not load it: ",K]}):k===null?l.jsx("div",{style:{padding:"var(--sp-3)",color:"var(--ink-2)"},children:"Loading…"}):F?l.jsx("div",{style:{padding:"var(--sp-3) var(--sp-4)",maxWidth:"72ch",margin:"0 auto"},children:l.jsx(Mi,{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(ie,{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(ie,{name:T==="image"?"Image":T==="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]})]}):se&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",fontVariantNumeric:"tabular-nums",flex:"0 0 auto"},children:se}),y&&u&&l.jsx(pn,{size:"sm",value:x,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(Ba,{icon:"chevronLeft",label:"Previous (←)",onClick:b??void 0,disabled:!b,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(Ba,{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(le,{variant:"ghost",size:"sm",children:"Open in a new tab"})}),l.jsx(Ba,{icon:"close",label:"Close (Esc)",onClick:o,size:"sm"})]}),l.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",display:"flex",flexDirection:"column",background:T==="image"?"var(--bg-inset)":"var(--bg-card)"},children:q})]})})}function Uc(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 Hc(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 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=lv(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 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:x=!0,style:v}){const[S,b]=m.useState(g),[j,k]=m.useState(null),[O,K]=m.useState(!1),[M,T]=m.useState(null),D=m.useMemo(()=>lv(i??[],S),[i,S]),B=m.useMemo(()=>x?(i??[]).filter(G=>G.kind==="image").sort((G,ue)=>(ue.mtimeMs??0)-(G.mtimeMs??0)):[],[i,x]),F=O?B:B.slice(0,wp),se={display:"flex",flexDirection:"column",gap:"var(--sp-2)",...v};if(o)return l.jsx("div",{style:se,children:l.jsxs(Ie,{children:["Could not list the folder: ",o]})});if(u&&!i?.length)return l.jsx("div",{style:se,children:l.jsx(Ie,{children:"Reading the folder…"})});const q=S?S.split("/"):[],U=j===null?null:D.files[j]??null,$=i?.length??0;return l.jsxs("div",{style:se,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(ie,{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:F.map((G,ue)=>l.jsxs("button",{type:"button",onClick:()=>T(ue),title:`${G.path} · ${Uc(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:[l.jsx("img",{src:Hc(h,G.path),alt:G.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:G.path.split("/").pop()})]},G.path))}),B.length>wp&&l.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:O?"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:()=>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:[l.jsx(ie,{name:"folder",size:12}),!S&&l.jsx("span",{children:"/"})]}),q.map((G,ue)=>{const ne=ue===q.length-1,P=q.slice(0,ue+1).join("/");return l.jsxs(vn.Fragment,{children:[l.jsx("span",{style:{color:"var(--ink-2)"},children:"/"}),l.jsx("button",{type:"button",onClick:()=>b(P),disabled:ne,style:{background:"none",border:"none",padding:"1px 3px",cursor:ne?"default":"pointer",color:ne?"var(--ink-0)":"var(--ink-2)",font:"inherit",fontWeight:ne?"var(--fw-semibold)":"inherit"},children:G})]},P)})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[S&&l.jsxs(Bc,{onClick:()=>b(q.slice(0,-1).join("/")),title:"Up one level",children:[l.jsx(ie,{name:"parent",size:13,color:"var(--ink-2)"}),l.jsx("span",{style:{...qc,color:"var(--ink-2)"},children:".."})]}),D.dirs.map(G=>l.jsxs(Bc,{onClick:()=>b(G.path),title:`${G.path}/ · ${G.count} file${G.count===1?"":"s"}`,children:[l.jsx(ie,{name:"folder",size:13,color:"var(--brand)"}),l.jsx("span",{style:qc,children:G.label}),l.jsx("span",{style:kp,children:G.count}),l.jsx(ie,{name:"chevronRight",size:12,color:"var(--ink-2)"})]},G.path)),D.files.map((G,ue)=>l.jsxs(Bc,{onClick:()=>k(ue),title:`${G.path} · ${Uc(G.size)}`,children:[l.jsx(ie,{name:Y1[G.kind]||"file",size:13,color:"var(--ink-2)"}),l.jsx("span",{style:qc,children:G.path.slice(G.path.lastIndexOf("/")+1)}),l.jsx("span",{style:kp,children:Uc(G.size)})]},G.path)),D.dirs.length===0&&D.files.length===0&&l.jsx(Ie,{children:S?"Nothing here.":"The folder is empty."})]}),M!==null&&F[M]&&l.jsx(Qc,{artifact:F[M],url:Hc(h,F[M].path),previewUrl:Sp(h,F[M].path),onClose:()=>T(null),index:M,count:F.length,onStep:T}),U&&l.jsx(Qc,{artifact:U,url:Hc(h,U.path),previewUrl:Sp(h,U.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: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 l.jsx("div",{style:j,children:l.jsxs(Ie,{children:["Could not read the working tree: ",o]})});if(d||!c&&!u)return l.jsx("div",{style:j,children:l.jsx(Ie,{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(Ie,{children:"Reading the working tree…"})});const{files:k,artifacts:O,totals:K}=c,M=k.map(q=>({...q,kind:"diff"})),T=q=>b(q),D=S===null?null:M[S]??null,B=new Set((y?.files??[]).map(q=>q.path)),F=[...y?.files??[],...O.filter(q=>!B.has(q.path))],se=(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")+(c.frozenAt?` · as it ended ${new Date(c.frozenAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:"");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:[K.files," changed · ",l.jsxs("span",{style:{color:"var(--status-good)"},children:["+",K.additions]})," ",l.jsxs("span",{style:{color:"var(--status-critical)"},children:["−",K.deletions]})," · ",O.length," artifact",O.length===1?"":"s"]})," ",l.jsx("span",{children:se}),c.note&&l.jsx("div",{style:{color:"var(--status-serious)"},children:c.note})]}),h.length>0&&l.jsxs("section",{children:[l.jsx(Hn,{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(ie,{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(Hn,{children:"Changed files"}),k.length===0&&l.jsx(Ie,{children:"Nothing changed in the folder yet."}),l.jsx("div",{style:{display:"flex",flexDirection:"column"},children:k.map((q,U)=>l.jsxs(K1,{onClick:()=>T(U),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(ie,{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(Hn,{children:"Folder"}),y?l.jsx(Vc,{files:F,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:[F.length," file",F.length===1?"":"s"]})," as the folder stands · the run's work files included"]})},i):O.length===0?l.jsx(Ie,{children:"No screenshots or work files yet."}):l.jsx(Vc,{files:O,urlBase:v,initialDir:X1(O),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:()=>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 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(""),[x,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(le,{size:"sm",variant:"ghost",onClick:()=>v(S=>!S),children:x?"Cancel":c?"Replace":"Add a key"}),c&&l.jsx(le,{size:"sm",variant:"danger",disabled:u,onClick:()=>h?.(i),children:"Remove"})]})]}),x&&l.jsxs("div",{style:{display:"flex",gap:"var(--sp-2)",alignItems:"center"},children:[l.jsx(Ve,{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(le,{size:"sm",variant:"good",disabled:u||!g.trim(),onClick:()=>{d(i,g.trim()),y(""),v(!1)},children:u?"Saving…":"Save key"})]}),o&&l.jsx(Ke,{tone:"error",inline:!0,children:o})]})}function en({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(ie,{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:or(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:x,style:v}){const[S,b]=m.useState(!1),j=i?.kind??"default",k=M=>c({...i,...M}),O=M=>c(J1(M)),K=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(pn,{size:"sm",value:j,onChange:O,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(M=>l.jsx(I1,{inst:M,selected:(i.configDir??"")===M.configDir,onClick:()=>k({configDir:M.configDir})},M.configDir))}),l.jsx(en,{label:"Config dir (blank inherits the server's own install)",children:l.jsx(Ve,{mono:!0,placeholder:"~/.claude-work",value:i.configDir??"",onChange:M=>k({configDir:M||void 0})})}),S?l.jsx(en,{label:"Executable (blank uses the SDK's bundled one)",children:l.jsx(Ve,{mono:!0,placeholder:"/usr/local/bin/claude",value:i.executable??"",onChange:M=>k({executable:M||void 0})})}):l.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"}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[l.jsx(_t,{checked:!!i.ownLogin,onChange:M=>k({ownLogin:M||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:x}),l.jsx(en,{label:"Environment variable (optional fallback)",children:l.jsx(Ve,{mono:!0,placeholder:"ANTHROPIC_API_KEY_ALPHA",value:i.apiKeyEnv??"",onChange:M=>k({apiKeyEnv:M})})}),l.jsx(Tp,{}),l.jsx(en,{label:"Model (blank uses the provider's default)",children:l.jsx(Ve,{mono:!0,placeholder:"claude-sonnet-4-5",value:i.model??"",onChange:M=>k({model:M||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(en,{label:"Codex home (blank is ~/.codex)",children:l.jsx(Ve,{mono:!0,placeholder:"~/.codex",value:i.codexHome??"",onChange:M=>k({codexHome:M||void 0})})}),S?l.jsx(en,{label:"Upstream URL (blank is the public ChatGPT backend)",children:l.jsx(Ve,{mono:!0,placeholder:"https://chatgpt.com/backend-api/codex",value:i.upstreamUrl??"",onChange:M=>k({upstreamUrl:M||void 0})})}):l.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"}),l.jsx(en,{label:"Model (blank uses Codex's own default)",children:l.jsx(Ve,{mono:!0,placeholder:"gpt-5-codex",value:i.model??"",onChange:M=>k({model:M||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:K?"var(--brand-wash-strong)":"transparent",border:`1px solid ${K?"var(--brand)":"var(--line)"}`},children:[l.jsx(ie,{name:"Bash",size:13,color:K?"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(en,{label:"Base URL",children:l.jsx(Ve,{mono:!0,placeholder:"http://127.0.0.1:11434",value:i.baseUrl??"",onChange:M=>k({baseUrl:M})})}),K&&o.models.length>0?l.jsx(en,{label:"Model (blank lets the run pick)",children:l.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:[l.jsx("option",{value:"",children:"— server picks —"}),o.models.map(M=>l.jsxs("option",{value:M.id,children:[M.id,M.remote?" (cloud)":""]},M.id))]})}):l.jsx(en,{label:"Model (blank lets the run pick)",children:l.jsx(Ve,{mono:!0,placeholder:"llama3.1",value:i.model??"",onChange:M=>k({model:M||void 0})})}),l.jsx(en,{label:"Label (shown in place of the raw URL)",children:l.jsx(Ve,{placeholder:"OpenRouter",value:i.label??"",onChange:M=>k({label:M||void 0})})}),l.jsx(en,{label:"Environment variable (blank when the endpoint needs no key)",children:l.jsx(Ve,{mono:!0,placeholder:"OPENROUTER_API_KEY",value:i.apiKeyEnv??"",onChange:M=>k({apiKeyEnv:M||void 0})})}),!!i.apiKeyEnv&&l.jsx(Tp,{}),l.jsx(Cp,{providerId:i.id,hasKey:d,busy:h,error:g,onStore:y,onClear:x}),l.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontSize:"var(--fs-sm)"},children:[l.jsx(_t,{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),[O,K]=m.useState(null),M=i?.telegram,T=!!M?.hasToken,D=!!M?.chatId,B=M?.linking,F=O??i?.publicUrl??"",se=O!==null&&O!==(i?.publicUrl??""),q=(U,$,G)=>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:U}),$&&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:G})]});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(ie,{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 · ${M.chatLabel||M.chatId}`:T?"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(Ke,{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."]}),T&&!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:M?.bot||"token stored"}),l.jsx(le,{size:"sm",variant:"ghost",onClick:()=>k(!0),disabled:c,children:"Replace"}),l.jsx(le,{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(Ve,{mono:!0,type:"password",width:320,placeholder:"123456789:AA…",value:S,onChange:b}),l.jsx(le,{size:"sm",variant:"primary",disabled:c||!S.trim(),onClick:()=>{o?.(S.trim()),b(""),k(!1)},children:c?"Checking…":"Save"}),T&&l.jsx(le,{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(ie,{name:"check",size:13,color:"var(--status-ok, var(--brand))"}),l.jsxs("span",{children:[M.chatLabel||"linked"," ",l.jsx("span",{style:{color:"var(--ink-2)",fontFamily:"var(--font-mono)"},children:M.chatId})]}),l.jsx(le,{size:"sm",variant:"ghost",onClick:y,disabled:c,children:"Send test"}),l.jsx(le,{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(ie,{name:"loading",size:12})}),"waiting… the code expires in 10 minutes",l.jsx(le,{size:"sm",variant:"ghost",onClick:h,disabled:c,children:"New code"})]})]})]}):l.jsx("div",{children:l.jsx(le,{size:"sm",variant:"primary",onClick:h,disabled:c||!T,title:T?"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(Ve,{mono:!0,width:320,value:F,onChange:K,placeholder:"http://localhost:4177"}),l.jsx(le,{size:"sm",disabled:c||!se,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:60,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(Ie,{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(ie,{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:x,providerCodex:v,providerHasKey:S,providerKeyBusy:b,providerKeyError:j,onStoreProviderKey:k,onClearProviderKey:O,notify:K,scope:M,onScope:T,section:D,onSection:B,onSave:F,onClose:se,onUnlink:q,style:U}){const[$,G]=m.useState(M??"global"),[ue,ne]=m.useState(D??"models"),P=T?M:$,je=T??G,X=B?D:ue,ye=B??ne,[z,L]=m.useState({...Wc,...i}),[ee,he]=m.useState({...c}),[ve,C]=m.useState(g??null),_=JSON.stringify(ve)!==JSON.stringify(g??null),J=JSON.stringify(z)!==JSON.stringify({...Wc,...i})||JSON.stringify(ee)!==JSON.stringify({...c})||_,te=P==="project",re=I=>te&&I in ee?ee[I]:z[I],oe=(I,We)=>te?he(Ue=>({...Ue,[I]:We})):L(Ue=>({...Ue,[I]:We})),xe=I=>te&&I in ee,Ae=I=>he(We=>{const Ue={...We};return delete Ue[I],Ue}),me=(I,We,Ue,jt)=>l.jsx(lr,{label:We,hint:Ue,overridden:xe(I),inherits:te&&!xe(I),onReset:()=>Ae(I),children:jt}),Q={models:l.jsxs(l.Fragment,{children:[me("directorModel","Director","Plans, delegates, verifies. Opus by default; Fable for long-horizon work.",l.jsx(rn,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:re("directorModel"),onChange:(I,We)=>{oe("directorModel",I),oe("directorProviderId",We?.providerId)}})),me("workerModel","Workers","Implement scoped tasks. Cheaper models cut cost sharply.",l.jsx(rn,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:re("workerModel"),onChange:(I,We)=>{oe("workerModel",I),oe("workerProviderId",We?.providerId)}})),me("plannerModel","Planner","Talks the next mission through with you and reads the project. Conversation, not deep reasoning; Sonnet by default.",l.jsx(rn,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:re("plannerModel"),onChange:I=>oe("plannerModel",I)})),!te&&me("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(rn,{align:"right",allowDefault:!1,models:o,loading:d,note:h,value:re("fleetPlannerModel")||re("plannerModel"),onChange:I=>oe("fleetPlannerModel",I)}))]}),budget:l.jsxs(l.Fragment,{children:[me("budgetCap","Default cap per run","The composer starts here; you can change it per mission.",l.jsx(Ve,{type:"number",prefix:"$",min:0,step:1,width:110,value:re("budgetCap"),onChange:I=>oe("budgetCap",I)})),me("budgetWarnAt","Warn at","Meter turns amber, the director is told to start verifying, and, if enabled, you get a notification. Leave room: the wind-down turn has to pay for verification and the report.",l.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[l.jsx(Ve,{type:"number",min:10,max:100,step:5,width:80,value:re("budgetWarnAt"),onChange:I=>oe("budgetWarnAt",I)}),l.jsx("span",{style:{color:"var(--ink-2)"},children:"%"})]})),me("budgetHardStop","Hard stop at cap","Off: the run pauses and asks instead of stopping.",l.jsx(_t,{checked:re("budgetHardStop"),onChange:I=>oe("budgetHardStop",I)}))]}),approvals:l.jsxs(l.Fragment,{children:[me("autoAllowReadOnly","Auto-allow read-only tools","Read, Grep, Glob, LS never prompt.",l.jsx(_t,{checked:re("autoAllowReadOnly"),onChange:I=>oe("autoAllowReadOnly",I)})),me("alwaysSurvivesResume","“Always (run)” survives resume","Grants made during a run carry into a resumed run.",l.jsx(_t,{checked:re("alwaysSurvivesResume"),onChange:I=>oe("alwaysSurvivesResume",I)})),l.jsx(lr,{label:"Guarded tools",hint:"Policy per tool. “Ask” escalates to an approval card; writes outside the project folder always ask.",overridden:xe("toolPolicy"),inherits:te&&!xe("toolPolicy"),onReset:()=>Ae("toolPolicy"),stacked:!0,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:nb.map(I=>l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[l.jsx(ie,{name:I,size:14,color:"var(--ink-2)"}),l.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--fs-sm)",flex:1},children:I}),l.jsx(pn,{size:"sm",tabs:tb,value:re("toolPolicy")[I]||"ask",onChange:We=>oe("toolPolicy",{...re("toolPolicy"),[I]:We})})]},I))})})]}),appearance:l.jsxs(l.Fragment,{children:[me("theme","Theme",null,l.jsx(pn,{size:"sm",value:re("theme"),onChange:I=>oe("theme",I),tabs:[{value:"system",label:"System"},{value:"dark",label:"Dark",icon:"moon"},{value:"light",label:"Light",icon:"sun"}]})),me("textSize","Text size","Scales the whole interface. Anything but Default overrides your browser’s own font size.",l.jsx(pn,{size:"sm",value:re("textSize"),onChange:I=>oe("textSize",I),tabs:[{value:"small",label:"Small"},{value:"default",label:"Default"},{value:"large",label:"Large"},{value:"larger",label:"Larger"}]})),me("density","Density","Compact tightens transcript rows and rail padding.",l.jsx(pn,{size:"sm",value:re("density"),onChange:I=>oe("density",I),tabs:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}]})),me("showTimestamps","Timestamps in transcript",null,l.jsx(_t,{checked:re("showTimestamps"),onChange:I=>oe("showTimestamps",I)}))]}),notifications:l.jsxs(l.Fragment,{children:[me("notifyNeedsYou","Needs you","An approval or question is waiting.",l.jsx(_t,{checked:re("notifyNeedsYou"),onChange:I=>oe("notifyNeedsYou",I)})),me("notifyDone","Run finished","Done, errored or interrupted.",l.jsx(_t,{checked:re("notifyDone"),onChange:I=>oe("notifyDone",I)})),me("notifyBudget","Budget warning","When spend crosses the warn threshold.",l.jsx(_t,{checked:re("notifyBudget"),onChange:I=>oe("notifyBudget",I)})),me("sound","Sound",null,l.jsx(_t,{checked:re("sound"),onChange:I=>oe("sound",I)})),!te&&K&&l.jsx(eb,{...K})]}),provider:te?l.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:l.jsx(P1,{value:ve,onChange:C,instances:y,ollama:x,hasKey:S,keyBusy:b,keyError:j,onStoreKey:k,onClearKey:O})}):l.jsx(ab,{instances:y,ollama:x,codex:v}),projects:l.jsxs(l.Fragment,{children:[!te&&me("projectsRoot","Projects root","Where the folder picker opens.",l.jsx(Ve,{mono:!0,width:260,value:re("projectsRoot"),onChange:I=>oe("projectsRoot",I)})),me("missionDir","Mission folder","Relative to the project. Holds MISSION.md and run history.",l.jsx(Ve,{mono:!0,width:160,value:re("missionDir"),onChange:I=>oe("missionDir",I)})),me("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(_t,{checked:re("gitBranchPerMission")!==!1,onChange:I=>oe("gitBranchPerMission",I)})),!te&&me("showHidden","Show hidden folders in picker",null,l.jsx(_t,{checked:re("showHidden"),onChange:I=>oe("showHidden",I)})),te&&l.jsx(lr,{label:"Unlink this project",hint:"Removes it from the fleet. Files on disk are untouched.",danger:!0,children:l.jsx(le,{variant:"danger",size:"sm",icon:"unlink",onClick:q,children:"Unlink"})})]})},we=Lc.find(I=>I.id===X)||Lc[0];return l.jsxs(Ei,{width:"51.25rem",onClose:se,dismissible:!1,style:{maxHeight:"82vh",height:"37.5rem",...U},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(pn,{size:"sm",value:P,onChange:je,tabs:[...u?[{value:"project",label:u,icon:"folder"}]:[],{value:"global",label:"Global"}]}),l.jsx(Ba,{icon:"close",label:"Close",onClick:se,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(I=>l.jsx(rb,{s:I,selected:I.id===X,dot:te&&(sb(I.id,ee)||I.id==="provider"&&!!ve),onClick:()=>ye(I.id)},I.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}),te&&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."]})]}),Q[we.id]]})]}),l.jsxs(_i,{children:[l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:J?"var(--status-warning)":"var(--ink-2)"},children:J?"Unsaved changes":"Nothing to save"}),l.jsxs("span",{style:{marginLeft:"auto",display:"flex",gap:"var(--sp-2)"},children:[l.jsx(le,{onClick:se,children:"Cancel"}),l.jsx(le,{variant:"primary",disabled:!J,onClick:()=>F?.({global:z,project:ee,provider:_?ve: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(ie,{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 lr({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[x,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)":x?"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(gn,{agent:i}),l.jsx("span",{style:{flex:1,minWidth:0,fontSize:"var(--fs-md)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),l.jsx(va,{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 l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)",...h},children:[l.jsxs("section",{style:{minWidth:0},children:[l.jsx(Hn,{children:"Crew"}),i.length===0&&l.jsx(Ie,{children:"No agents yet."}),g&&l.jsx(Ep,{agent:"director",status:g.status,selected:c==="director",onSelect:u}),y.map((v,S)=>l.jsxs(vn.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:{...x,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(Hn,{children:"Run"}),d??l.jsx(Ie,{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:x,style:v}){const[S,b]=m.useState(!1),[j,k]=m.useState({id:i||"",providerId:void 0}),[O,K]=m.useState({id:c||"",providerId:void 0}),[M,T]=m.useState(u??0),D=m.useRef(null);m.useEffect(()=>{k({id:i||"",providerId:void 0}),K({id:c||"",providerId:void 0}),T(u??0)},[i,c,u,S]),m.useEffect(()=>{if(!S)return;const $=ue=>{D.current&&!D.current.contains(ue.target)&&b(!1)},G=ue=>{ue.key==="Escape"&&b(!1)};return document.addEventListener("mousedown",$),document.addEventListener("keydown",G),()=>{document.removeEventListener("mousedown",$),document.removeEventListener("keydown",G)}},[S]);const B=typeof u=="number"&&Number.isFinite(M)&&M>0&&Math.abs(M-u)>=.005,F=j.id&&j.id!==i||O.id&&O.id!==c||B,se=()=>{x?.({...j.id&&j.id!==i?{directorModel:j.id,directorProviderId:j.providerId}:{},...O.id&&O.id!==c?{workerModel:O.id,workerProviderId:O.providerId}:{},...B?{budgetUsd:Math.round(M*100)/100}:{}}),b(!1)},q=$=>T(Math.round((M+$)*100)/100),U={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(le,{variant:"good",icon:"resume",disabled:y,title:"Restore the director's session and continue this mission",onClick:()=>x?.({}),style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:y?"Resuming…":"Resume"}),l.jsx(le,{variant:"good",disabled:y,"aria-label":"Resume on other models",title:"Resume on other models…",onClick:()=>b(!S),style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid rgba(255,255,255,0.35)",paddingLeft:6,paddingRight:6},children:l.jsx(ie,{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:U,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:M,onChange:$=>T(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(le,{size:"sm",onClick:()=>q(5),children:"+$5"}),l.jsx(le,{size:"sm",onClick:()=>q(10),children:"+$10"}),l.jsx(le,{size:"sm",onClick:()=>T(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:U,children:"Director"}),l.jsx(rn,{block:!0,allowDefault:!1,models:d,loading:h,note:g,value:j.id,onChange:($,G)=>k({id:$,providerId:G?.providerId})})]}),l.jsxs("div",{children:[l.jsx("div",{style:U,children:"Workers"}),l.jsx(rn,{block:!0,allowDefault:!1,models:d,loading:h,note:g,value:O.id,onChange:($,G)=>K({id:$,providerId:G?.providerId})})]}),l.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"var(--sp-2)"},children:[l.jsx(le,{variant:"ghost",size:"sm",onClick:()=>b(!1),children:"Cancel"}),l.jsx(le,{variant:"good",size:"sm",icon:"resume",disabled:y||!F,onClick:se,title:F?"Resume on these terms":"Change a model or the cap first — or use Resume as is",children:"Resume"})]})]})]})}function ub(i,c){const u=Hp(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 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(ie,{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",ir=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]),l.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:l.jsxs("div",{style:sv,children:[d,S.length===0&&l.jsx(Ie,{children:"Transcript will appear here."}),S.map(b=>l.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:l.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=Ci((g,y)=>{g==="memory_updated"&&y.projectId===i&&d()});return()=>{o=!0,h()}},[i]),c}function mb(i,c){const[u,o]=m.useState([]),d=vn.useCallback(()=>{if(!i){o([]);return}_e.runServices(i).then(async h=>{if(!h.ok)return;const g=await h.json();o(g.services??[])}).catch(()=>{})},[i]);return m.useEffect(d,[d,c]),{list:u,refresh:d}}function yb({runId:i,services:c,onDone:u}){const[o,d]=m.useState(null),[h,g]=m.useState(""),y=c.filter(v=>v.listening);if(!y.length)return null;const x=async v=>{d(v),g("");const S=await _e.stopService(i,v).finally(()=>d(null));S.ok||g((await S.json().catch(()=>({error:"could not stop it"}))).error),u()};return l.jsxs(Ke,{tone:"caution",children:["This run left ",y.length===1?"a server":`${y.length} servers`," running:"," ",y.map((v,S)=>l.jsxs("span",{children:[S>0?", ":"",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:v.port})," (",v.label,")",v.ours?l.jsx(le,{variant:"ghost",size:"sm",disabled:o===v.port,style:{marginLeft:4},onClick:()=>{x(v.port)},children:o===v.port?"Stopping…":"Stop"}):l.jsx("span",{style:{color:"var(--ink-2)"},children:" — held by another process now, left alone"})]},v.port)),h&&l.jsx("div",{style:{marginTop:4,color:"var(--ink-2)"},children:h})]})}function xb({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(Ie,{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(Mi,{text:i.text})}):null]})}function bb({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,O]=m.useState(null);m.useEffect(()=>{let T=!1;return _e.prDraft(i).then(async D=>{const B=await D.json().catch(()=>({}));if(!T){if(!D.ok){g(B.error??`HTTP ${D.status}`);return}d(B),x(B.title),S(B.body)}}).catch(()=>{T||g("Could not reach the server.")}),()=>{T=!0}},[i]);const K=async()=>{j(!0),g("");try{const T=await _e.openPr(i,y,v),D=await T.json().catch(()=>({}));if(!T.ok){g(D.error??`HTTP ${T.status}`);return}O(D),u(D.url)}finally{j(!1)}},M=o?.gh.present&&o.gh.authed&&/github\.com/.test(o.remote);return l.jsxs(Ei,{width:640,onClose:b?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(Ie,{children:"Reading the branch…"}),o&&!k&&l.jsxs(l.Fragment,{children:[o.pr&&l.jsxs(Ke,{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.baseFellBack&&l.jsxs(Ke,{tone:"caution",inline:!0,children:["This mission was branched from ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o.branchedFrom}),", which is not on the remote — a previous mission's branch, most likely. The request targets"," ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o.base})," instead, so it carries that mission's commits too until its own branch is merged."]}),!o.onBranch&&l.jsxs(Ke,{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(Ke,{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(Ve,{value:y,onChange:x})]}),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",M?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(Ke,{tone:"error",inline:!0,children:h})]}),l.jsxs(_i,{children:[l.jsx("span",{style:{flex:1}}),l.jsx(le,{onClick:c,disabled:b,children:k?"Close":"Cancel"}),o&&!k&&l.jsx(le,{variant:"primary",disabled:b||!y.trim(),onClick:()=>{K()},children:b?"Pushing…":M?"Push & create pull request":"Push & get the link"})]})]})}function jb({chat:i,folder:c,starting:u,error:o,errorAction:d,models:h,modelsLoading:g,modelsNote:y,modelsInheritNote:x,onStart:v,onCompose:S,hasRuns:b,projectId:j,onSettings:k,recent:O=[],runsOn:K,onOpenRun:M,onForkRun:T,forking:D=!1}){const[B,F]=m.useState(""),[se,q]=m.useState(""),[U,$]=m.useState(0),[G,ue]=m.useState(!1),ne=z=>{q(z),$(L=>L+1)},P=async(z,L=[])=>{F("");try{await i.send(await Yp(j,z,L))}catch(ee){F(ee.message)}},je=m.useRef(null),X=m.useRef(!0);return m.useEffect(()=>{const z=je.current;z&&X.current&&(z.scrollTop=z.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:O.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:O.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."})]}),O.length>0&&l.jsxs("div",{style:{border:"1px solid var(--line)",borderRadius:"var(--r-md)",background:"var(--bg-card)",overflow:"hidden"},children:[(G?O:O.slice(0,4)).map((z,L)=>{const ee=z.status!=="running",he=new Date(z.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:L>0?"1px solid var(--line)":"none"},children:[l.jsxs("button",{type:"button",onClick:()=>M?.(z.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:z.title||z.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(va,{status:z.status}),l.jsx("span",{children:he}),pa(z)==="priced"&&l.jsxs("span",{children:["$",z.costUsd.toFixed(2)]})]})]}),l.jsxs("span",{style:{display:"inline-flex",gap:"var(--sp-1)",flex:"0 0 auto"},children:[l.jsx(le,{variant:"ghost",size:"sm",onClick:()=>M?.(z.id),children:"Open"}),ee&&l.jsx(le,{size:"sm",icon:"steer",disabled:D||i.thinking,title:"Start a planning conversation seeded with what this run built",onClick:()=>T?.(z.id),children:"Plan the next step"})]})]},z.id)}),O.length>4&&l.jsx("div",{style:{borderTop:"1px solid var(--line)",padding:"4px var(--sp-2)"},children:l.jsx(le,{variant:"ghost",size:"sm",onClick:()=>ue(z=>!z),children:G?"Show the latest four":`Show all ${O.length} runs`})})]}),l.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(${O.length?150:200}px, 1fr))`,gap:"var(--sp-2)"},children:[...O.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(z=>l.jsxs("button",{type:"button",onClick:()=>ne(z.q),disabled:i.thinking,title:O.length?z.q:void 0,style:{textAlign:"left",padding:O.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:z.t}),!O.length&&l.jsx("span",{style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",lineHeight:"var(--lh)"},children:z.q})]},z.t))}),l.jsx(Xc,{value:se,onChange:q,busy:i.thinking,who:i.who,onSend:(z,L)=>{P(z,L)},onStop:()=>{i.stop()},onChangeModel:k,autoFocus:!0},U),B&&l.jsx(Ke,{tone:"error",inline:!0,children:B}),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."]}),K&&l.jsx("div",{style:{display:"flex",justifyContent:"center"},children:K})]})}):l.jsxs(l.Fragment,{children:[l.jsx("div",{ref:je,onScroll:z=>{const L=z.currentTarget;X.current=L.scrollHeight-L.scrollTop-L.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((z,L)=>{const ee=ir(z.ts),he=L>0?ir(i.entries[L-1].ts):null;return l.jsxs(vn.Fragment,{children:[ee!==he&&(L>0||ee!==ir(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:ee===ir(Date.now())?"today":ee}),l.jsx("span",{style:{flex:1,borderTop:"1px solid var(--line)"}})]}),l.jsx(Ic,{agent:z.agent,title:z.title,kind:z.kind,body:z.body,ts:z.ts})]},z.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:h,modelsLoading:g,modelsNote:y,modelsInheritNote:x,busy:u,error:o,errorAction:d,onStart:z=>v(z),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:z=>{i.answer(i.question.id,z)},onFreeText:z=>{P(z)}}):l.jsx(Xc,{busy:i.thinking,who:i.who,onSend:(z,L)=>{P(z,L)},onStop:()=>{i.stop()},onChangeModel:k}),B&&l.jsx(Ke,{tone:"error",inline:!0,style:{marginTop:4},children:B}),(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(le,{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(le,{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:S,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(ie,{name:"write",size:12}),"Or skip the talk: describe the mission and start it",l.jsx(ie,{name:"chevronRight",size:12,style:{marginLeft:"auto"}})]})]})}function Sb({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(B){S(B instanceof Error?B.message:String(B))}finally{x(!1)}},k=o??pa(i),O=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)}`:`${qa(O?.inputTokens??0)} in · ${qa(O?.outputTokens??0)} out${typeof K=="number"?` · ${K} turn${K===1?"":"s"}`:""}`+(k==="unpriced"?" · cost not tracked":" · no per-token cost")]],T={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:[M.map(([D,B])=>l.jsxs(vn.Fragment,{children:[l.jsx("span",{style:{color:"var(--ink-2)"},children:D}),l.jsx("span",{style:T,children:B})]},D)),l.jsx("span",{style:{color:"var(--ink-2)"},children:"browser"}),b?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:{...T,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:T,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:T,children:i.resumes})]}):null]}),v&&l.jsx("div",{style:{marginTop:4,color:"var(--status-critical)"},children:v})]})}function kb({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:O,settings:K,search:M}){const T=Nm(i.id),D=gb(i.id),B={...Wc,...K.global,...K.project??{}},F=Object.keys(K.project??{}),se=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:["· ",se?"each on its own branch":`on ${i.git.branch} directly`]}),F.length>0&&l.jsxs("span",{children:["· ",F.length," project override",F.length===1?"":"s"]}),l.jsx(le,{variant:"ghost",size:"sm",icon:"settings",onClick:O,children:"Change…"})]}),U=i.activeRun?.id??null,$=h,G=g;m.useEffect(()=>{U&&g(U)},[U]);const ue=U?T.find(ae=>ae.id===U)?.git?.branch:void 0,ne=$!==null&&$===U,P=Dm($,ne),je=mb($,P.runStatus),X=T.find(ae=>ae.id===$),ye=ne&&P.runStatus==="running",[z,L]=m.useState(null),[ee,he]=m.useState(null),ve=y,C=x,[_,J]=m.useState(()=>{try{const ae=Number(localStorage.getItem(Dp));return ae>=$c?ae:Rp}catch{return Rp}}),te=ae=>{const Ze=Math.max($c,Math.floor(window.innerWidth*.5)),ht=Math.min(Ze,Math.max($c,Math.round(ae)));J(ht);try{localStorage.setItem(Dp,String(ht))}catch{}},re=ae=>{ae.preventDefault();const Ze=ae.clientX,ht=_,Yt=cn=>te(ht+(Ze-cn.clientX)),kt=()=>{window.removeEventListener("pointermove",Yt),window.removeEventListener("pointerup",kt),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",Yt),window.addEventListener("pointerup",kt)},oe=ae=>{typeof ae.id=="number"&&(z&&z!==ae.agent&&L(null),he({id:ae.id,n:Date.now()}))},xe=ae=>L(z===ae?null:ae),[Ae,me]=m.useState(!1),[Q,we]=pb(),[I,We]=m.useState(()=>{try{return localStorage.getItem(Ap)!=="closed"}catch{return!0}}),Ue=ae=>{We(ae);try{localStorage.setItem(Ap,ae?"open":"closed")}catch{}},[jt,qt]=m.useState(!1),[La,on]=m.useState(!1),[Bn,El]=m.useState(!1),[qn,Ai]=m.useState(!1),[Di,rt]=m.useState(""),[_l,Al]=m.useState(!1),[Ri,ga]=m.useState(!1),[Oi,Ni]=m.useState(!1),[mn,$a]=m.useState(null),Ln=X?.git?.pr;m.useEffect(()=>{if(!$||!Ln){$a(null);return}if(X?.git?.prState){$a({runId:$,state:X.git.prState});return}let ae=!1;return _e.prState($).then(async Ze=>{const ht=Ze.ok?await Ze.json():{state:null};ae||$a({runId:$,state:ht.state})}).catch(()=>{ae||$a({runId:$,state:null})}),()=>{ae=!0}},[$,Ln,X?.git?.prState]);const xt=async ae=>{rt(""),Al(!0);try{const Ze=await _e.forkPlan(i.id,ae);if(!Ze.ok){rt((await Ze.json()).error);return}G(null)}finally{Al(!1)}},[tn,ot]=m.useState(""),[Ya,Ui]=m.useState(null),[Hi,$n]=m.useState(!1),Ga=$p(U?null:i.id),[ma,nn]=m.useState(!1),Lt=db(fb),At=u1($,ye),Yn=d1(i.id,$),Xa=P.approvals.length+P.questions.length,[ya,Gn]=m.useState(()=>Date.now());m.useEffect(()=>{if(Xa===0&&!ye)return;Gn(Date.now());const ae=setInterval(()=>Gn(Date.now()),1e4);return()=>clearInterval(ae)},[Xa,ye]),m.useEffect(()=>{L(null)},[$]);const cr=m.useMemo(()=>ye?hb(P):null,[ye,P]),Bi=m.useMemo(()=>av(P.missionDoc),[P.missionDoc]),Qa=async(ae={})=>{if(!$)return;rt(""),me(!0);const Ze=await _e.resume($,ae).finally(()=>me(!1));Ze.ok?S():rt((await Ze.json()).error)},xa=async(ae,Ze=!1)=>{ot(""),Ui(null),$n(!0);let ht=ae.mission;try{ht=await Yp(i.id,ae.mission,ae.attachments??[])}catch(cn){ot(cn.message),$n(!1);return}const Yt=await _e.run(i.id,ht,ae.budget,{directorModel:ae.directorModel,workerModel:ae.workerModel,directorProviderId:ae.directorProviderId,workerProviderId:ae.workerProviderId,browserTools:ae.browserTools,allowDirty:Ze||void 0}).finally(()=>$n(!1));if(Yt.ok){S();return}const kt=await Yt.json().catch(()=>({}));ot(kt.error??"could not start"),kt.code==="dirty-checkout"&&(ot(`${kt.error}${kt.files?.length?` (${kt.files.join(", ")})`:""}`),Ui({v:{...ae,mission:ht,attachments:[]}}))},Dl=!U&&$===null,ba=!U&&$&&(X?.status==="interrupted"||X?.status==="error")&&X?.directorSessionId,qi=Lt&&X&&(X.directorModel||X.workerModel)?l.jsxs("span",{title:`director: ${X.directorModel||"default"} · workers: ${X.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(ie,{name:"model",size:11}),X.directorModel||"default"," · ",X.workerModel||"default"]}):null,Li=X&&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:X.mission,children:X.title||X.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(X.createdAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),l.jsx(va,{status:ne?P.runStatus:X.status}),!ne&&l.jsx("span",{children:"read-only"})]})]}),$t=l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[T.length===0&&l.jsx(Ie,{children:"No runs yet."}),T.map(ae=>l.jsx(O1,{mission:ae.mission,title:ae.title,createdAt:ae.createdAt,costUsd:ae.costUsd,costBasis:pa(ae),usage:ae.usage,status:ae.status,selected:ae.id===$,current:ae.id===U,onSelect:ae.id===$?void 0:()=>G(ae.id)},ae.id))]}),tt=(ae,Ze)=>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:re,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:Ze})]}),ft=l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[Li,l.jsx(L1,{doc:P.missionDoc}),l.jsx(Ml,{label:"Mission doc",open:jt,onToggle:()=>qt(!jt),children:l.jsx(v1,{doc:P.missionDoc??void 0})}),D.text.trim()&&l.jsx(Ml,{label:"Project memory",open:Oi,onToggle:()=>Ni(!Oi),children:l.jsx("div",{style:{fontSize:"var(--fs-sm)"},children:l.jsx(Mi,{text:D.text})})}),l.jsx(ob,{agents:P.agents,filter:z,onFilter:xe,sessionId:P.directorSessionId,details:X&&l.jsx(Sb,{r:X,live:ne,liveCost:P.costUsd,liveBasis:P.costBasis,liveUsage:P.usage,liveTurns:X.turns,onChanged:S})})]}),yn=$?l.jsx(Z1,{runId:$,deck:At.deck,loading:At.loading,error:At.error,missing:At.missing,services:P.services,tree:Yn}):null,Va=At.deck?At.deck.totals.files+At.deck.artifacts.length:0,ur=l.jsx(pn,{size:"sm",value:ve,onChange:ae=>C(ae),tabs:[{value:"mission",label:"Mission"},{value:"files",label:"Files",count:Va},{value:"runs",label:"Runs",count:T.length}]}),dr=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:[P.agents.length>1&&l.jsx(R1,{agents:P.agents,filter:z,onFilter:xe}),l.jsx("span",{style:{flex:1}}),P.entries.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(le,{variant:"ghost",size:"sm",icon:"timeline",title:I?"Hide the timeline":"Show the swimlane timeline — click a tick to jump to its entry",onClick:()=>Ue(!I),children:"Timeline"}),l.jsx(le,{variant:"ghost",size:"sm",icon:"sort",title:Q==="newest"?"Newest first — click to read oldest first":"Oldest first — click to read newest first",onClick:()=>we(Q==="newest"?"oldest":"newest"),children:Q==="newest"?"Newest first":"Oldest first"})]})]}),Rl=l.jsxs("div",{style:{minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[dr,I&&P.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:P.agents,entries:P.entries,live:ye,selected:z,onSelect:xe,onTick:oe})})}),!Lt&&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(Bi),open:La,onToggle:()=>on(!La),children:ft}),l.jsx(Ml,{label:`Files · ${Va}`,open:Bn,onToggle:()=>El(!Bn),children:yn}),l.jsx(Ml,{label:`Runs · ${T.length}`,open:qn,onToggle:()=>Ai(!qn),children:$t})]}),l.jsx(vb,{run:P,filter:z,jump:ee,order:Q})]});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:X?.git?{name:X.git.branch,hint:`This mission runs on ${X.git.branch}, made from ${X.git.base}${X.git.commits!==void 0?` · ${X.git.commits} commit${X.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:O,search:M,children:[Di&&l.jsx(Ke,{tone:"error",inline:!0,children:Di}),$&&(P.runStatus==="running"&&Xa>0?l.jsx("span",{title:`Waiting on you: ${P.approvals.length} approval(s), ${P.questions.length} question(s)`,children:l.jsx(va,{status:"needs-you"})}):l.jsx(va,{status:P.runStatus})),$&&X?.status==="done"&&X?.stopReason==="budget"&&l.jsx("span",{title:"Every DONE WHEN criterion was verified; the run stopped at its cap rather than finishing under it.",style:{fontSize:"var(--fs-xs)",color:"var(--ink-2)",whiteSpace:"nowrap"},children:"at the cap"}),$&&l.jsx(ev,{spent:P.costUsd,budget:P.budgetUsd,detail:!0,costBasis:P.costBasis,usage:P.usage,turns:X?.turns,elapsedMs:X?.createdAt?(ye?ya:X.endedAt??ya)-X.createdAt:void 0}),qi,ye&&l.jsx(le,{variant:"danger",onClick:()=>{_e.interrupt($)},children:"Interrupt"}),ba&&l.jsx(cb,{director:X?.directorModel,worker:X?.workerModel,budget:X?.budgetUsd,spent:X?.costUsd,models:c,loading:u,note:o,busy:Ae,onResume:ae=>{Qa(ae)}}),!U&&$&&X&&X.status!=="running"&&l.jsx(le,{variant:"good",icon:"write",disabled:_l,title:"Start a new planning conversation that builds on what this mission did",onClick:()=>{xt($)},children:_l?"Opening…":"Plan the next step"}),!U&&$&&X?.git&&X.status!=="running"&&i.git?.remote&&(X.git.pr?l.jsxs(le,{icon:mn?.state==="merged"?"check":mn?.state==="closed"?"close":"preview",onClick:()=>window.open(X.git.pr,"_blank","noopener"),title:`${X.git.pr}${mn?.state?` · ${mn.state}`:""}`,children:["Pull request",mn?.runId===$&&mn.state?` · ${mn.state}`:""," ↗"]}):l.jsx(le,{icon:"steer",onClick:()=>ga(!0),title:`Push ${X.git.branch} and open a pull request against ${X.git.base}`,children:"Open pull request…"})),!U&&$&&l.jsx(le,{variant:"primary",onClick:()=>G(null),children:"New mission"}),!U&&!$&&!ma&&l.jsx(le,{variant:"primary",icon:"write",onClick:()=>nn(!0),title:"Skip the talk: describe the mission and start it",children:"New mission"})]}),Ri&&$&&l.jsx(bb,{runId:$,onClose:()=>ga(!1),onDone:()=>S()}),$&&l.jsx(B1,{approvals:P.approvals,questions:P.questions,now:ya,running:ye,activity:cr,onAllow:ae=>{_e.permission(ae,"allow")},onAlways:ae=>{_e.permission(ae,"allow_always")},onDeny:ae=>{_e.permission(ae,"deny")},onAnswer:(ae,Ze)=>{_e.answer(ae,Ze)}}),(i.billingMode??b.mode)==="none"&&l.jsxs(Ke,{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(le,{variant:"ghost",size:"sm",icon:"provider",style:{marginLeft:"var(--sp-2)"},onClick:()=>O("provider"),children:"Settings → Provider"})]}),ba&&X?.stopReason==="budget"&&l.jsxs(Ke,{tone:"caution",children:["This run stopped at its $",X.budgetUsd.toFixed(2)," cap with $",X.costUsd.toFixed(2)," spent. Raise the cap and continue:",[5,10].map(ae=>l.jsxs(le,{variant:"good",size:"sm",icon:"resume",disabled:Ae,style:{marginLeft:"var(--sp-2)"},onClick:()=>{Qa({budgetUsd:Math.round((X.budgetUsd+ae)*100)/100})},children:["+$",ae," & resume"]},ae)),l.jsx(le,{variant:"good",size:"sm",icon:"resume",disabled:Ae,style:{marginLeft:"var(--sp-2)"},onClick:()=>{Qa({budgetUsd:Math.round(X.budgetUsd*2*100)/100})},children:"Double & resume"})]}),ba&&X?.stopReason&&X.stopReason!=="budget"&&l.jsxs(Ke,{tone:"caution",children:["This run stopped at its ",X.stopReason==="turns"?"turn":X.stopReason==="time"?"time":"token"," cap. Resume continues it with a fresh allowance."]}),$&&l.jsx(yb,{runId:$,services:je.list,onDone:je.refresh}),ue&&l.jsxs(Ke,{tone:"caution",children:["This checkout is held by the running mission, on"," ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:ue}),". Commits you make in the folder land on that branch, and anything left uncommitted joins the mission's closing commit."]}),$&&!ne&&l.jsxs(Ke,{tone:"readonly",children:["Viewing a past run (read-only).",l.jsx(le,{variant:"ghost",size:"sm",icon:"back",style:{marginLeft:"var(--sp-2)"},onClick:()=>G(U??null),children:U?"Back to the live run":"Back to planning"})]}),Dl?l.jsxs("div",{style:{flex:1,minHeight:0,minWidth:0,display:Lt?"grid":"flex",flexDirection:"column",gridTemplateColumns:Lt?`minmax(0, 1fr) ${_}px`:void 0},children:[l.jsxs("div",{style:{minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[!Lt&&T.length>0&&l.jsx("div",{style:{padding:"6px var(--sp-3) 0",flex:"0 0 auto"},children:l.jsx(Ml,{label:`Runs · ${T.length}`,open:qn,onToggle:()=>Ai(!qn),children:$t})}),ma?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(le,{variant:"ghost",size:"sm",icon:"back",onClick:()=>nn(!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:tn,errorAction:Ya?{label:"Start anyway",onClick:()=>{xa(Ya.v,!0)}}:void 0,busy:Hi,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,onStart:ae=>{xa(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??b.mode,compact:!0,account:b.account,source:ub(i,b.source)}),l.jsxs("span",{style:{fontFamily:"var(--font-mono)"},children:["runs on ",Hp(i.provider)??"the server default instance"]}),i.git?.repo&&l.jsxs("span",{title:se?"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:["· ",se?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(jb,{chat:Ga,folder:i.folder,starting:Hi,error:tn,errorAction:Ya?{label:"Start anyway",onClick:()=>{xa(Ya.v,!0)}}:void 0,models:c,modelsLoading:u,modelsNote:o,modelsInheritNote:d,onStart:ae=>{xa(ae)},onCompose:()=>nn(!0),hasRuns:T.length>0,recent:T,runsOn:q,onOpenRun:ae=>G(ae),onForkRun:ae=>{xt(ae)},forking:_l,projectId:i.id,onSettings:O})})]}),Lt&&tt(null,l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[l.jsx(xb,{memory:D}),l.jsx(Vc,{files:Yn.files,truncated:Yn.truncated,loading:Yn.loading,error:Yn.error,onRefresh:Yn.refresh,urlBase:`/projects/${encodeURIComponent(i.id)}`},i.id)]}))]}):l.jsxs("main",{style:{flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[Lt?l.jsxs("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:`minmax(0, 1fr) ${_}px`},children:[Rl,tt(ur,ve==="mission"?ft:ve==="files"?yn:$t)]}):l.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:Rl}),ne&&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:P.runStatus==="running"?"running":"done"}],to:"director",onTo:()=>{},timing:"next",onTiming:()=>{},disabled:P.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 wb(){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 zb(){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 Tb(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 Cb(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 Mb(){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(),[O,K,M]=zb(),T=wb(),D=Tb(v),[B,F]=m.useState({global:{},projects:{}}),[se,q]=m.useState(!1),[U,$]=m.useState("models"),G=Q=>{Q&&$(Q),q(!0)},ue=Cb(se);m.useEffect(()=>{fetch("/settings").then(Q=>Q.ok?Q.json():null).then(Q=>Q&&F(Q)).catch(()=>{})},[]);const ne=v?i.find(Q=>Q.id===v):null,[P,je]=m.useState(!1),[X,ye]=m.useState(""),z=async(Q,we)=>{ye(""),je(!0);const I=await(we===null?_e.clearProviderKey(Q):_e.setProviderKey(Q,we)).finally(()=>je(!1));I.ok?o():ye((await I.json().catch(()=>({}))).error??"could not save the key")},L=async Q=>{const we={global:Q.global,projects:{...B.projects}};ne&&(Object.keys(Q.project).length?we.projects[ne.id]=Q.project:delete we.projects[ne.id]),F(we),q(!1),Q.global.theme&&M(Q.global.theme),Q.global.textSize&&T(Q.global.textSize),await fetch("/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({global:Q.global,projectId:ne?.id,project:ne?we.projects[ne.id]??{}:void 0})}).catch(()=>{}),ne&&Q.provider!==void 0&&(await _e.updateProject(ne.id,{provider:Q.provider}).catch(()=>{}),o())},[ee,he]=m.useState(""),ve=ee.trim().toLowerCase(),C=Hm(ve),_=Q=>new Date(Q).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),J=ve?i.filter(Q=>[Q.name,Q.folder].some(we=>we.toLowerCase().includes(ve))).slice(0,8):[],te=[{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:ne?`Global, and ${ne.name}'s overrides`:"Models, budget, approvals, notifications",icon:"settings",keys:"settings preferences models budget telegram",onPick:()=>q(!0)},...ne?[{id:"act-plan",title:`Plan in ${ne.name}`,detail:"Back to the planning conversation",icon:"steer",keys:"plan planner mission new",onPick:()=>j(ne.id)}]:[]].filter(Q=>ve&&(Q.title.toLowerCase().includes(ve)||Q.keys.includes(ve))),re=[{label:"Projects",items:J.map(Q=>({id:`p-${Q.id}`,title:Q.name,detail:Q.folder,icon:"folder",onPick:()=>j(Q.id)}))},{label:"Runs",count:C.hits.length>=30?30:void 0,items:C.hits.map(Q=>({id:`r-${Q.id}`,title:Q.title||Q.mission,detail:`${Q.projectName}${Q.title?` · ${Q.mission}`:""}`,icon:"idle",status:Q.status,meta:`${_(Q.endedAt??Q.createdAt)}${Q.costBasis==="priced"?` · $${Q.costUsd.toFixed(2)}`:""}`,onPick:()=>{Q.projectId&&k(Q.projectId,Q.id)}}))},{label:"Actions",items:te}],oe=l.jsx(x0,{value:ee,onChange:he,groups:re,busy:C.busy}),xe={theme:O,onToggleTheme:K,search:oe,onSettings:Q=>G(Q),auth:u},Ae=qm(),me=Ae.status?Ae.status.telegram.chatId?Ae.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:x||y===!0&&!ne?l.jsx(o1,{onDone:()=>{_e.setupDone().then(()=>o()),x&&j(null)},onSettings:Q=>G(Q)}):ne?l.jsx(kb,{p:ne,models:D.models,modelsLoading:D.loading,modelsNote:D.note,modelsInheritNote:D.inheritNote,routeRunId:S,onSelectRun:Q=>k(ne.id,Q),routeTab:b,onSelectTab:Q=>S&&k(ne.id,S,Q),onBack:()=>j(null),refreshFleet:o,settings:{global:B.global,project:B.projects[ne.id]},...xe}):l.jsx(s1,{projects:i,connected:c,activity:d,onOpen:Q=>j(Q),onOpenRun:(Q,we)=>k(Q,we),refresh:o,query:ee,onQuery:he,...xe})}),l.jsx(j0,{connected:c,localUrl:window.location.origin,publicUrl:Ae.status?.publicUrl,phone:me,auth:u,version:g,update:h,onOpenSettings:G}),se&&l.jsx(lb,{scope:ne?"project":"global",section:U,onSection:$,global:B.global,project:ne?B.projects[ne.id]:void 0,projectName:ne?.name,models:D.models,modelsLoading:D.loading,modelsNote:D.note,provider:ne?.provider??null,providerInstances:ue.instances,providerOllama:ue.ollama,providerCodex:ue.codex,providerHasKey:ne?.providerHasKey,providerKeyBusy:P,providerKeyError:X,onStoreProviderKey:(Q,we)=>{z(Q,we)},onClearProviderKey:Q=>{z(Q,null)},notify:Ae,onSave:Q=>{L(Q)},onClose:()=>q(!1)})]})}Tm.createRoot(document.getElementById("root")).render(l.jsx(m.StrictMode,{children:l.jsx(Mb,{})}));
|