@shanesaravia/hive 0.3.0 → 0.4.0
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/CHANGELOG.md +21 -0
- package/README.md +16 -1
- package/node_modules/@hive/shared/dist/status.js +9 -0
- package/node_modules/@hive/shared/dist/types.d.ts +162 -1
- package/node_modules/@hive/shared/dist/types.js +27 -0
- package/package.json +1 -1
- package/packages/server/dist/agents/agentDiscovery.js +64 -0
- package/packages/server/dist/api/rest.js +474 -14
- package/packages/server/dist/api/ws.js +66 -2
- package/packages/server/dist/control/missionQuiesce.js +66 -0
- package/packages/server/dist/health/deriveAlerts.js +8 -0
- package/packages/server/dist/index.js +26 -2
- package/packages/server/dist/loops/loopCommand.js +56 -0
- package/packages/server/dist/loops/loopNoop.js +38 -0
- package/packages/server/dist/loops/loopScheduler.js +58 -0
- package/packages/server/dist/loops/loopStore.js +118 -0
- package/packages/server/dist/loops/monitors.js +38 -0
- package/packages/server/dist/messages/attachmentStore.js +92 -0
- package/packages/server/dist/messages/messagesStore.js +97 -33
- package/packages/server/dist/reviews/reviewDiff.js +47 -0
- package/packages/server/dist/roster/replyAsk.js +62 -0
- package/packages/server/dist/roster/rosterBuilder.js +41 -5
- package/packages/server/dist/roster/workerIdentity.js +46 -9
- package/packages/server/dist/skills/skillDiscovery.js +28 -4
- package/packages/server/dist/terminals/claudeStreamClient.js +90 -0
- package/packages/server/dist/terminals/codexAppServerClient.js +195 -0
- package/packages/server/dist/terminals/providerDetection.js +27 -0
- package/packages/server/dist/terminals/terminalCapability.js +45 -0
- package/packages/server/dist/terminals/terminalFeatures.js +11 -0
- package/packages/server/dist/terminals/terminalObservability.js +21 -0
- package/packages/server/dist/terminals/terminalRuntime.js +125 -0
- package/packages/server/dist/terminals/terminalStream.js +30 -0
- package/packages/server/dist/transcripts/transcriptReader.js +345 -0
- package/packages/web/dist/assets/index-DWjqiitn.js +17 -0
- package/packages/web/dist/assets/index-rd4RnLqj.css +2 -0
- package/packages/web/dist/index.html +2 -2
- package/packages/web/dist/assets/index-BpEYVjCF.css +0 -2
- package/packages/web/dist/assets/index-rIAIJyuF.js +0 -12
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P={current:null},F={transition:null},I={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function L(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,e.act=L,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},e.unstable_act=L,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u(),n=f();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;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.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,d=/^[: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]*$/,p={},m={};function h(e){return l.call(m,e)?!0:l.call(p,e)?!1:d.test(e)?m[e]=!0:(p[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?h(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),O=Symbol.for(`react.profiler`),k=Symbol.for(`react.provider`),A=Symbol.for(`react.context`),j=Symbol.for(`react.forward_ref`),M=Symbol.for(`react.suspense`),N=Symbol.for(`react.suspense_list`),P=Symbol.for(`react.memo`),F=Symbol.for(`react.lazy`),I=Symbol.for(`react.offscreen`),L=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=L&&e[L]||e[`@@iterator`],typeof e==`function`?e:null)}var R=Object.assign,te;function z(e){if(te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);te=t&&t[1]||``}return`
|
|
2
|
+
`+te+e}var ne=!1;function B(e,t){if(!e||ne)return``;ne=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
3
|
+
`),a=r.stack.split(`
|
|
4
|
+
`),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
|
|
5
|
+
`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ne=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?z(e):``}function re(e){switch(e.tag){case 5:return z(e.type);case 16:return z(`Lazy`);case 13:return z(`Suspense`);case 19:return z(`SuspenseList`);case 0:case 2:case 15:return e=B(e.type,!1),e;case 11:return e=B(e.type.render,!1),e;case 1:return e=B(e.type,!0),e;default:return``}}function V(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?V(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return V(e(t))}catch{}}return null}function ie(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return V(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function ae(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function H(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function U(e){var t=H(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function W(e){e._valueTracker||=U(e)}function oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=H(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function se(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function G(e,t){var n=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ce(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ae(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function le(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function ue(e,t){le(e,t);var n=ae(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?fe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&fe(e,t.type,ae(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function de(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function fe(e,t,n){(t!==`number`||se(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var K=Array.isArray;function pe(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+ae(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function me(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return R({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function he(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(K(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:ae(n)}}function q(e,t){var n=ae(t.value),r=ae(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function ge(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function _e(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function ve(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?_e(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var ye,be=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(ye||=document.createElement(`div`),ye.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=ye.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Se={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ce=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Se).forEach(function(e){Ce.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Se[t]=Se[e]})});function we(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Se.hasOwnProperty(e)&&Se[e]?(``+t).trim():t+`px`}function Te(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=we(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ee=R({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function De(e,t){if(t){if(Ee[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Oe(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;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 ke=null;function Ae(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var je=null,Me=null,Ne=null;function Pe(e){if(e=Mi(e)){if(typeof je!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Pi(t),je(e.stateNode,e.type,t))}}function Fe(e){Me?Ne?Ne.push(e):Ne=[e]:Me=e}function Ie(){if(Me){var e=Me,t=Ne;if(Ne=Me=null,Pe(e),t)for(e=0;e<t.length;e++)Pe(t[e])}}function Le(e,t){return e(t)}function Re(){}var ze=!1;function Be(e,t,n){if(ze)return e(t,n);ze=!0;try{return Le(e,t,n)}finally{ze=!1,(Me!==null||Ne!==null)&&(Re(),Ie())}}function Ve(e,t){var n=e.stateNode;if(n===null)return null;var i=Pi(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var He=!1;if(c)try{var Ue={};Object.defineProperty(Ue,"passive",{get:function(){He=!0}}),window.addEventListener(`test`,Ue,Ue),window.removeEventListener(`test`,Ue,Ue)}catch{He=!1}function We(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var Ge=!1,Ke=null,qe=!1,Je=null,Ye={onError:function(e){Ge=!0,Ke=e}};function Xe(e,t,n,r,i,a,o,s,c){Ge=!1,Ke=null,We.apply(Ye,arguments)}function Ze(e,t,n,i,a,o,s,c,l){if(Xe.apply(this,arguments),Ge){if(Ge){var u=Ke;Ge=!1,Ke=null}else throw Error(r(198));qe||(qe=!0,Je=u)}}function Qe(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function $e(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 et(e){if(Qe(e)!==e)throw Error(r(188))}function tt(e){var t=e.alternate;if(!t){if(t=Qe(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return et(a),e;if(o===i)return et(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function nt(e){return e=tt(e),e===null?null:rt(e)}function rt(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=rt(e);if(t!==null)return t;e=e.sibling}return null}var it=n.unstable_scheduleCallback,at=n.unstable_cancelCallback,ot=n.unstable_shouldYield,st=n.unstable_requestPaint,ct=n.unstable_now,lt=n.unstable_getCurrentPriorityLevel,ut=n.unstable_ImmediatePriority,dt=n.unstable_UserBlockingPriority,ft=n.unstable_NormalPriority,pt=n.unstable_LowPriority,mt=n.unstable_IdlePriority,ht=null,gt=null;function _t(e){if(gt&&typeof gt.onCommitFiberRoot==`function`)try{gt.onCommitFiberRoot(ht,e,void 0,(e.current.flags&128)==128)}catch{}}var vt=Math.clz32?Math.clz32:xt,yt=Math.log,bt=Math.LN2;function xt(e){return e>>>=0,e===0?32:31-(yt(e)/bt|0)|0}var St=64,Ct=4194304;function wt(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Tt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=wt(a))):r=wt(s)}else o=n&~i,o===0?a!==0&&(r=wt(a)):r=wt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-vt(t),i=1<<n,r|=e[n],t&=~i;return r}function Et(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Dt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-vt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Et(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Ot(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function kt(){var e=St;return St<<=1,!(St&4194240)&&(St=64),e}function At(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function jt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-vt(t),e[t]=n}function Mt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-vt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Nt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-vt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var J=0;function Pt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Ft,It,Lt,Rt,zt,Bt=!1,Vt=[],Ht=null,Ut=null,Wt=null,Gt=new Map,Kt=new Map,qt=[],Jt=`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 submit`.split(` `);function Yt(e,t){switch(e){case`focusin`:case`focusout`:Ht=null;break;case`dragenter`:case`dragleave`:Ut=null;break;case`mouseover`:case`mouseout`:Wt=null;break;case`pointerover`:case`pointerout`:Gt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Kt.delete(t.pointerId)}}function Xt(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Mi(t),t!==null&&It(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Zt(e,t,n,r,i){switch(t){case`focusin`:return Ht=Xt(Ht,e,t,n,r,i),!0;case`dragenter`:return Ut=Xt(Ut,e,t,n,r,i),!0;case`mouseover`:return Wt=Xt(Wt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Gt.set(a,Xt(Gt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Kt.set(a,Xt(Kt.get(a)||null,e,t,n,r,i)),!0}return!1}function Qt(e){var t=ji(e.target);if(t!==null){var n=Qe(t);if(n!==null){if(t=n.tag,t===13){if(t=$e(n),t!==null){e.blockedOn=t,zt(e.priority,function(){Lt(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 $t(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ke=r,n.target.dispatchEvent(r),ke=null}else return t=Mi(n),t!==null&&It(t),e.blockedOn=n,!1;t.shift()}return!0}function en(e,t,n){$t(e)&&n.delete(t)}function tn(){Bt=!1,Ht!==null&&$t(Ht)&&(Ht=null),Ut!==null&&$t(Ut)&&(Ut=null),Wt!==null&&$t(Wt)&&(Wt=null),Gt.forEach(en),Kt.forEach(en)}function nn(e,t){e.blockedOn===t&&(e.blockedOn=null,Bt||(Bt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,tn)))}function rn(e){function t(t){return nn(t,e)}if(0<Vt.length){nn(Vt[0],e);for(var n=1;n<Vt.length;n++){var r=Vt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ht!==null&&nn(Ht,e),Ut!==null&&nn(Ut,e),Wt!==null&&nn(Wt,e),Gt.forEach(t),Kt.forEach(t),n=0;n<qt.length;n++)r=qt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<qt.length&&(n=qt[0],n.blockedOn===null);)Qt(n),n.blockedOn===null&&qt.shift()}var an=C.ReactCurrentBatchConfig,on=!0;function sn(e,t,n,r){var i=J,a=an.transition;an.transition=null;try{J=1,ln(e,t,n,r)}finally{J=i,an.transition=a}}function cn(e,t,n,r){var i=J,a=an.transition;an.transition=null;try{J=4,ln(e,t,n,r)}finally{J=i,an.transition=a}}function ln(e,t,n,r){if(on){var i=dn(e,t,n,r);if(i===null)ai(e,t,r,un,n),Yt(e,r);else if(Zt(i,e,t,n,r))r.stopPropagation();else if(Yt(e,r),t&4&&-1<Jt.indexOf(e)){for(;i!==null;){var a=Mi(i);if(a!==null&&Ft(a),a=dn(e,t,n,r),a===null&&ai(e,t,r,un,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ai(e,t,r,null,n)}}var un=null;function dn(e,t,n,r){if(un=null,e=Ae(r),e=ji(e),e!==null){if(t=Qe(e),t===null)e=null;else if(n=t.tag,n===13){if(e=$e(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 un=e,null}function fn(e){switch(e){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`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 1;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`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(lt()){case ut:return 1;case dt:return 4;case ft:case pt:return 16;case mt:return 536870912;default:return 16}default:return 16}}var pn=null,mn=null,hn=null;function gn(){if(hn)return hn;var e,t=mn,n=t.length,r,i=`value`in pn?pn.value:pn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return hn=i.slice(e,1<r?1-r:void 0)}function _n(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 vn(){return!0}function yn(){return!1}function bn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?vn:yn,this.isPropagationStopped=yn,this}return R(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=vn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=vn)},persist:function(){},isPersistent:vn}),t}var xn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sn=bn(xn),Cn=R({},xn,{view:0,detail:0}),wn=bn(Cn),Tn,En,Dn,On=R({},Cn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zn,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!==Dn&&(Dn&&e.type===`mousemove`?(Tn=e.screenX-Dn.screenX,En=e.screenY-Dn.screenY):En=Tn=0,Dn=e),Tn)},movementY:function(e){return`movementY`in e?e.movementY:En}}),kn=bn(On),An=bn(R({},On,{dataTransfer:0})),jn=bn(R({},Cn,{relatedTarget:0})),Mn=bn(R({},xn,{animationName:0,elapsedTime:0,pseudoElement:0})),Nn=bn(R({},xn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Pn=bn(R({},xn,{data:0})),Fn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},In={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`},Ln={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Rn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ln[e])?!!t[e]:!1}function zn(){return Rn}var Bn=bn(R({},Cn,{key:function(e){if(e.key){var t=Fn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=_n(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?In[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zn,charCode:function(e){return e.type===`keypress`?_n(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?_n(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Vn=bn(R({},On,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Hn=bn(R({},Cn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zn})),Un=bn(R({},xn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Wn=bn(R({},On,{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})),Gn=[9,13,27,32],Kn=c&&`CompositionEvent`in window,qn=null;c&&`documentMode`in document&&(qn=document.documentMode);var Jn=c&&`TextEvent`in window&&!qn,Yn=c&&(!Kn||qn&&8<qn&&11>=qn),Xn=` `,Zn=!1;function Qn(e,t){switch(e){case`keyup`:return Gn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function $n(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var er=!1;function tr(e,t){switch(e){case`compositionend`:return $n(t);case`keypress`:return t.which===32?(Zn=!0,Xn):null;case`textInput`:return e=t.data,e===Xn&&Zn?null:e;default:return null}}function nr(e,t){if(er)return e===`compositionend`||!Kn&&Qn(e,t)?(e=gn(),hn=mn=pn=null,er=!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 Yn&&t.locale!==`ko`?null:t.data;default:return null}}var rr={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 ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!rr[e.type]:t===`textarea`}function ar(e,t,n,r){Fe(r),t=si(t,`onChange`),0<t.length&&(n=new Sn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var or=null,sr=null;function cr(e){$r(e,0)}function lr(e){if(oe(Ni(e)))return e}function ur(e,t){if(e===`change`)return t}var dr=!1;if(c){var fr;if(c){var pr=`oninput`in document;if(!pr){var mr=document.createElement(`div`);mr.setAttribute(`oninput`,`return;`),pr=typeof mr.oninput==`function`}fr=pr}else fr=!1;dr=fr&&(!document.documentMode||9<document.documentMode)}function hr(){or&&(or.detachEvent(`onpropertychange`,gr),sr=or=null)}function gr(e){if(e.propertyName===`value`&&lr(sr)){var t=[];ar(t,sr,e,Ae(e)),Be(cr,t)}}function _r(e,t,n){e===`focusin`?(hr(),or=t,sr=n,or.attachEvent(`onpropertychange`,gr)):e===`focusout`&&hr()}function vr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return lr(sr)}function yr(e,t){if(e===`click`)return lr(t)}function br(e,t){if(e===`input`||e===`change`)return lr(t)}function xr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Sr=typeof Object.is==`function`?Object.is:xr;function Cr(e,t){if(Sr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Sr(e[i],t[i]))return!1}return!0}function wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tr(e,t){var n=wr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=wr(n)}}function Er(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Er(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dr(){for(var e=window,t=se();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=se(e.document)}return t}function Or(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`)}function kr(e){var t=Dr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Er(n.ownerDocument.documentElement,n)){if(r!==null&&Or(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Tr(n,a);var o=Tr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Ar=c&&`documentMode`in document&&11>=document.documentMode,jr=null,Mr=null,Nr=null,Pr=!1;function Fr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pr||jr==null||jr!==se(r)||(r=jr,`selectionStart`in r&&Or(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Nr&&Cr(Nr,r)||(Nr=r,r=si(Mr,`onSelect`),0<r.length&&(t=new Sn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=jr)))}function Ir(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Lr={animationend:Ir(`Animation`,`AnimationEnd`),animationiteration:Ir(`Animation`,`AnimationIteration`),animationstart:Ir(`Animation`,`AnimationStart`),transitionend:Ir(`Transition`,`TransitionEnd`)},Rr={},zr={};c&&(zr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Lr.animationend.animation,delete Lr.animationiteration.animation,delete Lr.animationstart.animation),`TransitionEvent`in window||delete Lr.transitionend.transition);function Br(e){if(Rr[e])return Rr[e];if(!Lr[e])return e;var t=Lr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in zr)return Rr[e]=t[n];return e}var Vr=Br(`animationend`),Hr=Br(`animationiteration`),Ur=Br(`animationstart`),Wr=Br(`transitionend`),Gr=new Map,Kr=`abort auxClick 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(` `);function qr(e,t){Gr.set(e,t),o(t,[e])}for(var Jr=0;Jr<Kr.length;Jr++){var Yr=Kr[Jr];qr(Yr.toLowerCase(),`on`+(Yr[0].toUpperCase()+Yr.slice(1)))}qr(Vr,`onAnimationEnd`),qr(Hr,`onAnimationIteration`),qr(Ur,`onAnimationStart`),qr(`dblclick`,`onDoubleClick`),qr(`focusin`,`onFocus`),qr(`focusout`,`onBlur`),qr(Wr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Xr=`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(` `),Zr=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(Xr));function Qr(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,Ze(r,t,void 0,e),e.currentTarget=null}function $r(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;Qr(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;Qr(i,s,l),a=c}}}if(qe)throw e=Je,qe=!1,Je=null,e}function ei(e,t){var n=t[X];n===void 0&&(n=t[X]=new Set);var r=e+`__bubble`;n.has(r)||(ii(t,e,2,!1),n.add(r))}function ti(e,t,n){var r=0;t&&(r|=4),ii(n,e,r,t)}var ni=`_reactListening`+Math.random().toString(36).slice(2);function ri(e){if(!e[ni]){e[ni]=!0,i.forEach(function(t){t!==`selectionchange`&&(Zr.has(t)||ti(t,!1,e),ti(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ni]||(t[ni]=!0,ti(`selectionchange`,!1,t))}}function ii(e,t,n,r){switch(fn(t)){case 1:var i=sn;break;case 4:i=cn;break;default:i=ln}n=i.bind(null,t,n,e),i=void 0,!He||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function ai(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=ji(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Be(function(){var r=a,i=Ae(n),o=[];a:{var s=Gr.get(e);if(s!==void 0){var c=Sn,l=e;switch(e){case`keypress`:if(_n(n)===0)break a;case`keydown`:case`keyup`:c=Bn;break;case`focusin`:l=`focus`,c=jn;break;case`focusout`:l=`blur`,c=jn;break;case`beforeblur`:case`afterblur`:c=jn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=kn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=An;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Hn;break;case Vr:case Hr:case Ur:c=Mn;break;case Wr:c=Un;break;case`scroll`:c=wn;break;case`wheel`:c=Wn;break;case`copy`:case`cut`:case`paste`:c=Nn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Vn}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Ve(p,f),h!=null&&u.push(oi(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==ke&&(l=n.relatedTarget||n.fromElement)&&(ji(l)||l[Oi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?ji(l):null,l!==null&&(d=Qe(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=kn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Vn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Ni(c),m=l==null?s:Ni(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,ji(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=ci(m))p++;for(m=0,h=f;h;h=ci(h))m++;for(;0<p-m;)u=ci(u),p--;for(;0<m-p;)f=ci(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=ci(u),f=ci(f)}u=null}else u=null;c!==null&&li(o,s,c,u,!1),l!==null&&d!==null&&li(o,d,l,u,!0)}}a:{if(s=r?Ni(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=ur;else if(ir(s)){if(dr)g=br;else{g=vr;var _=_r}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=yr);if(g&&=g(e,r)){ar(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&fe(s,`number`,s.value)}switch(_=r?Ni(r):window,e){case`focusin`:(ir(_)||_.contentEditable===`true`)&&(jr=_,Mr=r,Nr=null);break;case`focusout`:Nr=Mr=jr=null;break;case`mousedown`:Pr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Pr=!1,Fr(o,n,i);break;case`selectionchange`:if(Ar)break;case`keydown`:case`keyup`:Fr(o,n,i)}var v;if(Kn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else er?Qn(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(Yn&&n.locale!==`ko`&&(er||y!==`onCompositionStart`?y===`onCompositionEnd`&&er&&(v=gn()):(pn=i,mn=`value`in pn?pn.value:pn.textContent,er=!0)),_=si(r,y),0<_.length&&(y=new Pn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=$n(n),v!==null&&(y.data=v)))),(v=Jn?tr(e,n):nr(e,n))&&(r=si(r,`onBeforeInput`),0<r.length&&(i=new Pn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}$r(o,t)})}function oi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function si(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Ve(e,n),a!=null&&r.unshift(oi(e,a,i)),a=Ve(e,t),a!=null&&r.push(oi(e,a,i))),e=e.return}return r}function ci(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function li(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Ve(n,a),c!=null&&o.unshift(oi(n,c,s))):i||(c=Ve(n,a),c!=null&&o.push(oi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var ui=/\r\n?/g,di=/\u0000|\uFFFD/g;function fi(e){return(typeof e==`string`?e:``+e).replace(ui,`
|
|
6
|
+
`).replace(di,``)}function pi(e,t,n){if(t=fi(t),fi(e)!==t&&n)throw Error(r(425))}function mi(){}var hi=null,gi=null;function _i(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var vi=typeof setTimeout==`function`?setTimeout:void 0,yi=typeof clearTimeout==`function`?clearTimeout:void 0,bi=typeof Promise==`function`?Promise:void 0,xi=typeof queueMicrotask==`function`?queueMicrotask:bi===void 0?vi:function(e){return bi.resolve(null).then(e).catch(Si)};function Si(e){setTimeout(function(){throw e})}function Ci(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),rn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);rn(t)}function wi(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===`$?`)break;if(t===`/$`)return null}}return e}function Ti(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Ei=Math.random().toString(36).slice(2),Di=`__reactFiber$`+Ei,Y=`__reactProps$`+Ei,Oi=`__reactContainer$`+Ei,X=`__reactEvents$`+Ei,ki=`__reactListeners$`+Ei,Ai=`__reactHandles$`+Ei;function ji(e){var t=e[Di];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Oi]||n[Di]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ti(e);e!==null;){if(n=e[Di])return n;e=Ti(e)}return t}e=n,n=e.parentNode}return null}function Mi(e){return e=e[Di]||e[Oi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ni(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Pi(e){return e[Y]||null}var Fi=[],Ii=-1;function Li(e){return{current:e}}function Ri(e){0>Ii||(e.current=Fi[Ii],Fi[Ii]=null,Ii--)}function Z(e,t){Ii++,Fi[Ii]=e.current,e.current=t}var zi={},Bi=Li(zi),Vi=Li(!1),Hi=zi;function Ui(e,t){var n=e.type.contextTypes;if(!n)return zi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Wi(e){return e=e.childContextTypes,e!=null}function Gi(){Ri(Vi),Ri(Bi)}function Ki(e,t,n){if(Bi.current!==zi)throw Error(r(168));Z(Bi,t),Z(Vi,n)}function qi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ie(e)||`Unknown`,a));return R({},n,i)}function Ji(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||zi,Hi=Bi.current,Z(Bi,e),Z(Vi,Vi.current),!0}function Yi(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=qi(e,t,Hi),i.__reactInternalMemoizedMergedChildContext=e,Ri(Vi),Ri(Bi),Z(Bi,e)):Ri(Vi),Z(Vi,n)}var Xi=null,Zi=!1,Qi=!1;function $i(e){Xi===null?Xi=[e]:Xi.push(e)}function ea(e){Zi=!0,$i(e)}function ta(){if(!Qi&&Xi!==null){Qi=!0;var e=0,t=J;try{var n=Xi;for(J=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Xi=null,Zi=!1}catch(t){throw Xi!==null&&(Xi=Xi.slice(e+1)),it(ut,ta),t}finally{J=t,Qi=!1}}return null}var na=[],ra=0,ia=null,aa=0,oa=[],sa=0,ca=null,la=1,ua=``;function da(e,t){na[ra++]=aa,na[ra++]=ia,ia=e,aa=t}function fa(e,t,n){oa[sa++]=la,oa[sa++]=ua,oa[sa++]=ca,ca=e;var r=la;e=ua;var i=32-vt(r)-1;r&=~(1<<i),n+=1;var a=32-vt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,la=1<<32-vt(t)+i|n<<i|r,ua=a+e}else la=1<<a|n<<i|r,ua=e}function pa(e){e.return!==null&&(da(e,1),fa(e,1,0))}function ma(e){for(;e===ia;)ia=na[--ra],na[ra]=null,aa=na[--ra],na[ra]=null;for(;e===ca;)ca=oa[--sa],oa[sa]=null,ua=oa[--sa],oa[sa]=null,la=oa[--sa],oa[sa]=null}var ha=null,ga=null,_a=!1,va=null;function ya(e,t){var n=Kl(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ba(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null&&(e.stateNode=t,ha=e,ga=wi(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,ha=e,ga=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=ca===null?null:{id:la,overflow:ua},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Kl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ha=e,ga=null,!0);default:return!1}}function xa(e){return!!(e.mode&1)&&!(e.flags&128)}function Sa(e){if(_a){var t=ga;if(t){var n=t;if(!ba(e,t)){if(xa(e))throw Error(r(418));t=wi(n.nextSibling);var i=ha;t&&ba(e,t)?ya(i,n):(e.flags=e.flags&-4097|2,_a=!1,ha=e)}}else{if(xa(e))throw Error(r(418));e.flags=e.flags&-4097|2,_a=!1,ha=e}}}function Ca(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ha=e}function wa(e){if(e!==ha)return!1;if(!_a)return Ca(e),_a=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!_i(e.type,e.memoizedProps)),t&&=ga){if(xa(e))throw Ta(),Error(r(418));for(;t;)ya(e,t),t=wi(t.nextSibling)}if(Ca(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){ga=wi(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}ga=null}}else ga=ha?wi(e.stateNode.nextSibling):null;return!0}function Ta(){for(var e=ga;e;)e=wi(e.nextSibling)}function Ea(){ga=ha=null,_a=!1}function Da(e){va===null?va=[e]:va.push(e)}var Oa=C.ReactCurrentBatchConfig;function ka(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Aa(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function ja(e){var t=e._init;return t(e._payload)}function Ma(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=Yl(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=$l(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===F&&ja(i)===t.type)?(r=a(t,n.props),r.ref=ka(e,t,n),r.return=e,r):(r=Xl(n.type,n.key,n.props,null,e.mode,r),r.ref=ka(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=eu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Zl(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=$l(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=Xl(t.type,t.key,t.props,null,e.mode,n),n.ref=ka(e,null,t),n.return=e,n;case T:return t=eu(t,e.mode,n),t.return=e,t;case F:var r=t._init;return f(e,r(t._payload),n)}if(K(t)||ee(t))return t=Zl(t,e.mode,n,null),t.return=e,t;Aa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case F:return i=n._init,p(e,t,i(n._payload),r)}if(K(n)||ee(n))return i===null?d(e,t,n,r,null):null;Aa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case F:var a=r._init;return m(e,t,n,a(r._payload),i)}if(K(r)||ee(r))return e=e.get(n)||null,d(t,e,r,i,null);Aa(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),_a&&da(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return _a&&da(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),_a&&da(r,h),l}function g(a,s,c,l){var u=ee(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),_a&&da(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return _a&&da(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),_a&&da(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&ja(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=ka(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===E?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=ka(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(K(i))return h(e,r,i,o);if(ee(i))return g(e,r,i,o);Aa(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Na=Ma(!0),Pa=Ma(!1),Fa=Li(null),Ia=null,La=null,Ra=null;function za(){Ra=La=Ia=null}function Ba(e){var t=Fa.current;Ri(Fa),e._currentValue=t}function Va(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ha(e,t){Ia=e,Ra=La=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ms=!0),e.firstContext=null)}function Ua(e){var t=e._currentValue;if(Ra!==e){if(e={context:e,memoizedValue:t,next:null},La===null){if(Ia===null)throw Error(r(308));La=e,Ia.dependencies={lanes:0,firstContext:e}}else La=La.next=e}return t}var Wa=null;function Ga(e){Wa===null?Wa=[e]:Wa.push(e)}function Ka(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ga(t)):(n.next=i.next,i.next=n),t.interleaved=n,qa(e,r)}function qa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ja=!1;function Ya(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Za(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Qa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,qa(e,n)}return i=r.interleaved,i===null?(t.next=t,Ga(r)):(t.next=i.next,i.next=t),r.interleaved=t,qa(e,n)}function $a(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Nt(e,n)}}function eo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function to(e,t,n,r){var i=e.updateQueue;Ja=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=R({},d,f);break a;case 2:Ja=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Jc|=o,e.lanes=o,e.memoizedState=d}}function no(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var ro={},io=Li(ro),ao=Li(ro),oo=Li(ro);function so(e){if(e===ro)throw Error(r(174));return e}function co(e,t){switch(Z(oo,t),Z(ao,e),Z(io,ro),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ve(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ve(t,e)}Ri(io),Z(io,t)}function lo(){Ri(io),Ri(ao),Ri(oo)}function uo(e){so(oo.current);var t=so(io.current),n=ve(t,e.type);t!==n&&(Z(ao,e),Z(io,n))}function fo(e){ao.current===e&&(Ri(io),Ri(ao))}var po=Li(0);function mo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)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 ho=[];function go(){for(var e=0;e<ho.length;e++)ho[e]._workInProgressVersionPrimary=null;ho.length=0}var _o=C.ReactCurrentDispatcher,vo=C.ReactCurrentBatchConfig,yo=0,bo=null,xo=null,So=null,Co=!1,wo=!1,To=0,Eo=0;function Do(){throw Error(r(321))}function Oo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Sr(e[n],t[n]))return!1;return!0}function ko(e,t,n,i,a,o){if(yo=o,bo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_o.current=e===null||e.memoizedState===null?fs:ps,e=n(i,a),wo){o=0;do{if(wo=!1,To=0,25<=o)throw Error(r(301));o+=1,So=xo=null,t.updateQueue=null,_o.current=ms,e=n(i,a)}while(wo)}if(_o.current=ds,t=xo!==null&&xo.next!==null,yo=0,So=xo=bo=null,Co=!1,t)throw Error(r(300));return e}function Ao(){var e=To!==0;return To=0,e}function jo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return So===null?bo.memoizedState=So=e:So=So.next=e,So}function Mo(){if(xo===null){var e=bo.alternate;e=e===null?null:e.memoizedState}else e=xo.next;var t=So===null?bo.memoizedState:So.next;if(t!==null)So=t,xo=e;else{if(e===null)throw Error(r(310));xo=e,e={memoizedState:xo.memoizedState,baseState:xo.baseState,baseQueue:xo.baseQueue,queue:xo.queue,next:null},So===null?bo.memoizedState=So=e:So=So.next=e}return So}function No(e,t){return typeof t==`function`?t(e):t}function Po(e){var t=Mo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=xo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((yo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,bo.lanes|=d,Jc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Sr(i,t.memoizedState)||(Ms=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,bo.lanes|=o,Jc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Fo(e){var t=Mo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Sr(o,t.memoizedState)||(Ms=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Io(){}function Lo(e,t){var n=bo,i=Mo(),a=t(),o=!Sr(i.memoizedState,a);if(o&&(i.memoizedState=a,Ms=!0),i=i.queue,Yo(Bo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||So!==null&&So.memoizedState.tag&1){if(n.flags|=2048,Wo(9,zo.bind(null,n,i,a,t),void 0,null),Vc===null)throw Error(r(349));yo&30||Ro(n,t,a)}return a}function Ro(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=bo.updateQueue,t===null?(t={lastEffect:null,stores:null},bo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zo(e,t,n,r){t.value=n,t.getSnapshot=r,Vo(t)&&Ho(e)}function Bo(e,t,n){return n(function(){Vo(t)&&Ho(e)})}function Vo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Sr(e,n)}catch{return!0}}function Ho(e){var t=qa(e,1);t!==null&&ml(t,e,1,-1)}function Uo(e){var t=jo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:e},t.queue=e,e=e.dispatch=ss.bind(null,bo,e),[t.memoizedState,e]}function Wo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=bo.updateQueue,t===null?(t={lastEffect:null,stores:null},bo.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Go(){return Mo().memoizedState}function Ko(e,t,n,r){var i=jo();bo.flags|=e,i.memoizedState=Wo(1|t,n,void 0,r===void 0?null:r)}function qo(e,t,n,r){var i=Mo();r=r===void 0?null:r;var a=void 0;if(xo!==null){var o=xo.memoizedState;if(a=o.destroy,r!==null&&Oo(r,o.deps)){i.memoizedState=Wo(t,n,a,r);return}}bo.flags|=e,i.memoizedState=Wo(1|t,n,a,r)}function Jo(e,t){return Ko(8390656,8,e,t)}function Yo(e,t){return qo(2048,8,e,t)}function Xo(e,t){return qo(4,2,e,t)}function Zo(e,t){return qo(4,4,e,t)}function Qo(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function $o(e,t,n){return n=n==null?null:n.concat([e]),qo(4,4,Qo.bind(null,t,e),n)}function es(){}function ts(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ns(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function rs(e,t,n){return yo&21?(Sr(n,t)||(n=kt(),bo.lanes|=n,Jc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ms=!0),e.memoizedState=n)}function is(e,t){var n=J;J=n!==0&&4>n?n:4,e(!0);var r=vo.transition;vo.transition={};try{e(!1),t()}finally{J=n,vo.transition=r}}function as(){return Mo().memoizedState}function os(e,t,n){var r=pl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},cs(e))ls(t,n);else if(n=Ka(e,t,n,r),n!==null){var i=fl();ml(n,e,r,i),us(n,t,r)}}function ss(e,t,n){var r=pl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(cs(e))ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Sr(s,o)){var c=t.interleaved;c===null?(i.next=i,Ga(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Ka(e,t,i,r),n!==null&&(i=fl(),ml(n,e,r,i),us(n,t,r))}}function cs(e){var t=e.alternate;return e===bo||t!==null&&t===bo}function ls(e,t){wo=Co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function us(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Nt(e,n)}}var ds={readContext:Ua,useCallback:Do,useContext:Do,useEffect:Do,useImperativeHandle:Do,useInsertionEffect:Do,useLayoutEffect:Do,useMemo:Do,useReducer:Do,useRef:Do,useState:Do,useDebugValue:Do,useDeferredValue:Do,useTransition:Do,useMutableSource:Do,useSyncExternalStore:Do,useId:Do,unstable_isNewReconciler:!1},fs={readContext:Ua,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:Ua,useEffect:Jo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Ko(4194308,4,Qo.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ko(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ko(4,2,e,t)},useMemo:function(e,t){var n=jo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=jo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=os.bind(null,bo,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:Uo,useDebugValue:es,useDeferredValue:function(e){return jo().memoizedState=e},useTransition:function(){var e=Uo(!1),t=e[0];return e=is.bind(null,e[1]),jo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=bo,a=jo();if(_a){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Vc===null)throw Error(r(349));yo&30||Ro(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Jo(Bo.bind(null,i,o,e),[e]),i.flags|=2048,Wo(9,zo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=jo(),t=Vc.identifierPrefix;if(_a){var n=ua,r=la;n=(r&~(1<<32-vt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=To++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Eo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ps={readContext:Ua,useCallback:ts,useContext:Ua,useEffect:Yo,useImperativeHandle:$o,useInsertionEffect:Xo,useLayoutEffect:Zo,useMemo:ns,useReducer:Po,useRef:Go,useState:function(){return Po(No)},useDebugValue:es,useDeferredValue:function(e){return rs(Mo(),xo.memoizedState,e)},useTransition:function(){return[Po(No)[0],Mo().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:as,unstable_isNewReconciler:!1},ms={readContext:Ua,useCallback:ts,useContext:Ua,useEffect:Yo,useImperativeHandle:$o,useInsertionEffect:Xo,useLayoutEffect:Zo,useMemo:ns,useReducer:Fo,useRef:Go,useState:function(){return Fo(No)},useDebugValue:es,useDeferredValue:function(e){var t=Mo();return xo===null?t.memoizedState=e:rs(t,xo.memoizedState,e)},useTransition:function(){return[Fo(No)[0],Mo().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:as,unstable_isNewReconciler:!1};function hs(e,t){if(e&&e.defaultProps){for(var n in t=R({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function gs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:R({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var _s={isMounted:function(e){return(e=e._reactInternals)?Qe(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fl(),i=pl(e),a=Za(r,i);a.payload=t,n!=null&&(a.callback=n),t=Qa(e,a,i),t!==null&&(ml(t,e,i,r),$a(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fl(),i=pl(e),a=Za(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Qa(e,a,i),t!==null&&(ml(t,e,i,r),$a(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fl(),r=pl(e),i=Za(n,r);i.tag=2,t!=null&&(i.callback=t),t=Qa(e,i,r),t!==null&&(ml(t,e,r,n),$a(t,e,r))}};function vs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Cr(n,r)||!Cr(i,a):!0}function ys(e,t,n){var r=!1,i=zi,a=t.contextType;return typeof a==`object`&&a?a=Ua(a):(i=Wi(t)?Hi:Bi.current,r=t.contextTypes,a=(r=r!=null)?Ui(e,i):zi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=_s,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function bs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&_s.enqueueReplaceState(t,t.state,null)}function xs(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Ya(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ua(a):(a=Wi(t)?Hi:Bi.current,i.context=Ui(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(gs(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&_s.enqueueReplaceState(i,i.state,null),to(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ss(e,t){try{var n=``,r=t;do n+=re(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Cs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ws(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Ts=typeof WeakMap==`function`?WeakMap:Map;function Es(e,t,n){n=Za(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){nl||(nl=!0,rl=r),ws(e,t)},n}function Ds(e,t,n){n=Za(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ws(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){ws(e,t),typeof r!=`function`&&(il===null?il=new Set([this]):il.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Os(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ts;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zl.bind(null,e,t,n),t.then(e,e))}function ks(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function As(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Za(-1,1),t.tag=2,Qa(n,t,1))),n.lanes|=1),e)}var js=C.ReactCurrentOwner,Ms=!1;function Ns(e,t,n,r){t.child=e===null?Pa(t,null,n,r):Na(t,e.child,n,r)}function Ps(e,t,n,r,i){n=n.render;var a=t.ref;return Ha(t,i),r=ko(e,t,n,r,a,i),n=Ao(),e!==null&&!Ms?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ec(e,t,i)):(_a&&n&&pa(t),t.flags|=1,Ns(e,t,r,i),t.child)}function Fs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ql(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Is(e,t,a,r,i)):(e=Xl(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Cr:n,n(o,r)&&e.ref===t.ref)return ec(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Is(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Cr(a,r)&&e.ref===t.ref){if(Ms=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ms=!0);else return t.lanes=e.lanes,ec(e,t,i)}}return zs(e,t,n,r,i)}function Ls(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Z(Gc,Wc),Wc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Z(Gc,Wc),Wc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Z(Gc,Wc),Wc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Z(Gc,Wc),Wc|=r;return Ns(e,t,i,n),t.child}function Rs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function zs(e,t,n,r,i){var a=Wi(n)?Hi:Bi.current;return a=Ui(t,a),Ha(t,i),n=ko(e,t,n,r,a,i),r=Ao(),e!==null&&!Ms?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ec(e,t,i)):(_a&&r&&pa(t),t.flags|=1,Ns(e,t,n,i),t.child)}function Bs(e,t,n,r,i){if(Wi(n)){var a=!0;Ji(t)}else a=!1;if(Ha(t,i),t.stateNode===null)$s(e,t),ys(t,n,r),xs(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ua(l):(l=Wi(n)?Hi:Bi.current,l=Ui(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&bs(t,o,r,l),Ja=!1;var f=t.memoizedState;o.state=f,to(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Vi.current||Ja?(typeof u==`function`&&(gs(t,n,u,r),c=t.memoizedState),(s=Ja||vs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Xa(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:hs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ua(c):(c=Wi(n)?Hi:Bi.current,c=Ui(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&bs(t,o,r,c),Ja=!1,f=t.memoizedState,o.state=f,to(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Vi.current||Ja?(typeof p==`function`&&(gs(t,n,p,r),m=t.memoizedState),(l=Ja||vs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Vs(e,t,n,r,a,i)}function Vs(e,t,n,r,i,a){Rs(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&Yi(t,n,!1),ec(e,t,a);r=t.stateNode,js.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Na(t,e.child,null,a),t.child=Na(t,null,s,a)):Ns(e,t,s,a),t.memoizedState=r.state,i&&Yi(t,n,!0),t.child}function Hs(e){var t=e.stateNode;t.pendingContext?Ki(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ki(e,t.context,!1),co(e,t.containerInfo)}function Us(e,t,n,r,i){return Ea(),Da(i),t.flags|=256,Ns(e,t,n,r),t.child}var Ws={dehydrated:null,treeContext:null,retryLane:0};function Gs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ks(e,t,n){var r=t.pendingProps,i=po.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Z(po,i&1),e===null)return Sa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Ql(o,r,0,null),e=Zl(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Gs(n),t.memoizedState=Ws,e):qs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Ys(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Yl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Zl(a,o,n,null),a.flags|=2):a=Yl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Gs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ws,r}return a=e.child,e=a.sibling,r=Yl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function qs(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Js(e,t,n,r){return r!==null&&Da(r),Na(t,e.child,null,n),e=qs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ys(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Cs(Error(r(422))),Js(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=Ql({mode:`visible`,children:i.children},a,0,null),o=Zl(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Na(t,e.child,null,s),t.child.memoizedState=Gs(s),t.memoizedState=Ws,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Js(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Cs(o,i,void 0),Js(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ms||c){if(i=Vc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,qa(e,a),ml(i,e,a,-1))}return Ol(),i=Cs(Error(r(421))),Js(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Vl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,ga=wi(a.nextSibling),ha=t,_a=!0,va=null,e!==null&&(oa[sa++]=la,oa[sa++]=ua,oa[sa++]=ca,la=e.id,ua=e.overflow,ca=t),t=qs(t,i.children),t.flags|=4096,t)}function Xs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Va(e.return,t,n)}function Zs(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function Qs(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ns(e,t,r.children,n),r=po.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xs(e,n,t);else if(e.tag===19)Xs(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Z(po,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&mo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Zs(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&mo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Zs(t,!0,n,null,a);break;case`together`:Zs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function $s(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ec(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Yl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function tc(e,t,n){switch(t.tag){case 3:Hs(t),Ea();break;case 5:uo(t);break;case 1:Wi(t.type)&&Ji(t);break;case 4:co(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Z(Fa,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Z(po,po.current&1),e=ec(e,t,n),e===null?null:e.sibling):Ks(e,t,n):(Z(po,po.current&1),t.flags|=128,null);Z(po,po.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Qs(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Z(po,po.current),r)break;return null;case 22:case 23:return t.lanes=0,Ls(e,t,n)}return ec(e,t,n)}var nc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},rc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,so(io.current);var o=null;switch(n){case`input`:i=G(e,i),r=G(e,r),o=[];break;case`select`:i=R({},i,{value:void 0}),r=R({},r,{value:void 0}),o=[];break;case`textarea`:i=me(e,i),r=me(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=mi)}De(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ei(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},ic=function(e,t,n,r){n!==r&&(t.flags|=4)};function ac(e,t){if(!_a)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 r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function oc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function sc(e,t,n){var i=t.pendingProps;switch(ma(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return oc(t),null;case 1:return Wi(t.type)&&Gi(),oc(t),null;case 3:return i=t.stateNode,lo(),Ri(Vi),Ri(Bi),go(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(wa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,va!==null&&(vl(va),va=null))),oc(t),null;case 5:fo(t);var o=so(oo.current);if(n=t.type,e!==null&&t.stateNode!=null)rc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return oc(t),null}if(e=so(io.current),wa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Di]=t,i[Y]=s,e=!!(t.mode&1),n){case`dialog`:ei(`cancel`,i),ei(`close`,i);break;case`iframe`:case`object`:case`embed`:ei(`load`,i);break;case`video`:case`audio`:for(o=0;o<Xr.length;o++)ei(Xr[o],i);break;case`source`:ei(`error`,i);break;case`img`:case`image`:case`link`:ei(`error`,i),ei(`load`,i);break;case`details`:ei(`toggle`,i);break;case`input`:ce(i,s),ei(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ei(`invalid`,i);break;case`textarea`:he(i,s),ei(`invalid`,i)}for(var c in De(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&pi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&pi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ei(`scroll`,i)}switch(n){case`input`:W(i),de(i,s,!0);break;case`textarea`:W(i),ge(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=mi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=_e(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Di]=t,e[Y]=i,nc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Oe(n,i),n){case`dialog`:ei(`cancel`,e),ei(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ei(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Xr.length;o++)ei(Xr[o],e);o=i;break;case`source`:ei(`error`,e),o=i;break;case`img`:case`image`:case`link`:ei(`error`,e),ei(`load`,e),o=i;break;case`details`:ei(`toggle`,e),o=i;break;case`input`:ce(e,i),o=G(e,i),ei(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=R({},i,{value:void 0}),ei(`invalid`,e);break;case`textarea`:he(e,i),o=me(e,i),ei(`invalid`,e);break;default:o=i}for(s in De(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Te(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&be(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&xe(e,u):typeof u==`number`&&xe(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ei(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:W(e),de(e,i,!1);break;case`textarea`:W(e),ge(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+ae(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&pe(e,!!i.multiple,i.defaultValue,!0):pe(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=mi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return oc(t),null;case 6:if(e&&t.stateNode!=null)ic(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=so(oo.current),so(io.current),wa(t)){if(i=t.stateNode,n=t.memoizedProps,i[Di]=t,(s=i.nodeValue!==n)&&(e=ha,e!==null))switch(e.tag){case 3:pi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&pi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Di]=t,t.stateNode=i}return oc(t),null;case 13:if(Ri(po),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(_a&&ga!==null&&t.mode&1&&!(t.flags&128))Ta(),Ea(),t.flags|=98560,s=!1;else if(s=wa(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Di]=t}else Ea(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;oc(t),s=!1}else va!==null&&(vl(va),va=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||po.current&1?Kc===0&&(Kc=3):Ol())),t.updateQueue!==null&&(t.flags|=4),oc(t),null);case 4:return lo(),e===null&&ri(t.stateNode.containerInfo),oc(t),null;case 10:return Ba(t.type._context),oc(t),null;case 17:return Wi(t.type)&&Gi(),oc(t),null;case 19:if(Ri(po),s=t.memoizedState,s===null)return oc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)ac(s,!1);else{if(Kc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=mo(e),c!==null){for(t.flags|=128,ac(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Z(po,po.current&1|2),t.child}e=e.sibling}s.tail!==null&&ct()>el&&(t.flags|=128,i=!0,ac(s,!1),t.lanes=4194304)}}else{if(!i){if(e=mo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ac(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!_a)return oc(t),null}else 2*ct()-s.renderingStartTime>el&&n!==1073741824&&(t.flags|=128,i=!0,ac(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(oc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=ct(),t.sibling=null,n=po.current,Z(po,i?n&1|2:n&1),t);case 22:case 23:return wl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Wc&1073741824&&(oc(t),t.subtreeFlags&6&&(t.flags|=8192)):oc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function cc(e,t){switch(ma(t),t.tag){case 1:return Wi(t.type)&&Gi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return lo(),Ri(Vi),Ri(Bi),go(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return fo(t),null;case 13:if(Ri(po),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ri(po),null;case 4:return lo(),null;case 10:return Ba(t.type._context),null;case 22:case 23:return wl(),null;case 24:return null;default:return null}}var lc=!1,uc=!1,dc=typeof WeakSet==`function`?WeakSet:Set,Q=null;function fc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Rl(e,t,n)}else n.current=null}}function pc(e,t,n){try{n()}catch(n){Rl(e,t,n)}}var mc=!1;function hc(e,t){if(hi=on,e=Dr(),Or(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(gi={focusedElem:e,selectionRange:n},on=!1,Q=t;Q!==null;)if(t=Q,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Q=e;else for(;Q!==null;){t=Q;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:hs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Rl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,Q=e;break}Q=t.return}return h=mc,mc=!1,h}function gc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&pc(t,n,a)}i=i.next}while(i!==r)}}function _c(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function vc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function yc(e){var t=e.alternate;t!==null&&(e.alternate=null,yc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Di],delete t[Y],delete t[X],delete t[ki],delete t[Ai])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function bc(e){return e.tag===5||e.tag===3||e.tag===4}function xc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||bc(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.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Sc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=mi));else if(r!==4&&(e=e.child,e!==null))for(Sc(e,t,n),e=e.sibling;e!==null;)Sc(e,t,n),e=e.sibling}function Cc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Cc(e,t,n),e=e.sibling;e!==null;)Cc(e,t,n),e=e.sibling}var wc=null,Tc=!1;function Ec(e,t,n){for(n=n.child;n!==null;)Dc(e,t,n),n=n.sibling}function Dc(e,t,n){if(gt&&typeof gt.onCommitFiberUnmount==`function`)try{gt.onCommitFiberUnmount(ht,n)}catch{}switch(n.tag){case 5:uc||fc(n,t);case 6:var r=wc,i=Tc;wc=null,Ec(e,t,n),wc=r,Tc=i,wc!==null&&(Tc?(e=wc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wc.removeChild(n.stateNode));break;case 18:wc!==null&&(Tc?(e=wc,n=n.stateNode,e.nodeType===8?Ci(e.parentNode,n):e.nodeType===1&&Ci(e,n),rn(e)):Ci(wc,n.stateNode));break;case 4:r=wc,i=Tc,wc=n.stateNode.containerInfo,Tc=!0,Ec(e,t,n),wc=r,Tc=i;break;case 0:case 11:case 14:case 15:if(!uc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&pc(n,t,o),i=i.next}while(i!==r)}Ec(e,t,n);break;case 1:if(!uc&&(fc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Rl(n,t,e)}Ec(e,t,n);break;case 21:Ec(e,t,n);break;case 22:n.mode&1?(uc=(r=uc)||n.memoizedState!==null,Ec(e,t,n),uc=r):Ec(e,t,n);break;default:Ec(e,t,n)}}function Oc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new dc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function kc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:wc=c.stateNode,Tc=!1;break a;case 3:wc=c.stateNode.containerInfo,Tc=!0;break a;case 4:wc=c.stateNode.containerInfo,Tc=!0;break a}c=c.return}if(wc===null)throw Error(r(160));Dc(o,s,a),wc=null,Tc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Rl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ac(t,e),t=t.sibling}function Ac(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(kc(t,e),jc(e),i&4){try{gc(3,e,e.return),_c(3,e)}catch(t){Rl(e,e.return,t)}try{gc(5,e,e.return)}catch(t){Rl(e,e.return,t)}}break;case 1:kc(t,e),jc(e),i&512&&n!==null&&fc(n,n.return);break;case 5:if(kc(t,e),jc(e),i&512&&n!==null&&fc(n,n.return),e.flags&32){var a=e.stateNode;try{xe(a,``)}catch(t){Rl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&le(a,o),Oe(c,s);var u=Oe(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Te(a,f):d===`dangerouslySetInnerHTML`?be(a,f):d===`children`?xe(a,f):S(a,d,f,u)}switch(c){case`input`:ue(a,o);break;case`textarea`:q(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?pe(a,!!o.multiple,o.multiple?[]:``,!1):pe(a,!!o.multiple,o.defaultValue,!0)):pe(a,!!o.multiple,m,!1)}a[Y]=o}catch(t){Rl(e,e.return,t)}}break;case 6:if(kc(t,e),jc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Rl(e,e.return,t)}}break;case 3:if(kc(t,e),jc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{rn(t.containerInfo)}catch(t){Rl(e,e.return,t)}break;case 4:kc(t,e),jc(e);break;case 13:kc(t,e),jc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||($c=ct())),i&4&&Oc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(uc=(u=uc)||d,kc(t,e),uc=u):kc(t,e),jc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Q=e,d=e.child;d!==null;){for(f=Q=d;Q!==null;){switch(p=Q,m=p.child,p.tag){case 0:case 11:case 14:case 15:gc(4,p,p.return);break;case 1:fc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Rl(i,n,e)}}break;case 5:fc(p,p.return);break;case 22:if(p.memoizedState!==null){Fc(f);continue}}m===null?Fc(f):(m.return=p,Q=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=we(`display`,s))}catch(t){Rl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Rl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:kc(t,e),jc(e),i&4&&Oc(e);break;case 21:break;default:kc(t,e),jc(e)}}function jc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(bc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(xe(a,``),i.flags&=-33),Cc(e,xc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Sc(e,xc(e),o);break;default:throw Error(r(161))}}catch(t){Rl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Mc(e,t,n){Q=e,Nc(e,t,n)}function Nc(e,t,n){for(var r=!!(e.mode&1);Q!==null;){var i=Q,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||lc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||uc;s=lc;var l=uc;if(lc=o,(uc=c)&&!l)for(Q=i;Q!==null;)o=Q,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Ic(i):(c.return=o,Q=c);for(;a!==null;)Q=a,Nc(a,t,n),a=a.sibling;Q=i,lc=s,uc=l}Pc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Q=a):Pc(e,t,n)}}function Pc(e){for(;Q!==null;){var t=Q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:uc||_c(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!uc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:hs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&no(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}no(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&rn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}uc||t.flags&512&&vc(t)}catch(e){Rl(t,t.return,e)}}if(t===e){Q=null;break}if(n=t.sibling,n!==null){n.return=t.return,Q=n;break}Q=t.return}}function Fc(e){for(;Q!==null;){var t=Q;if(t===e){Q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Q=n;break}Q=t.return}}function Ic(e){for(;Q!==null;){var t=Q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{_c(4,t)}catch(e){Rl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Rl(t,i,e)}}var a=t.return;try{vc(t)}catch(e){Rl(t,a,e)}break;case 5:var o=t.return;try{vc(t)}catch(e){Rl(t,o,e)}}}catch(e){Rl(t,t.return,e)}if(t===e){Q=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Q=s;break}Q=t.return}}var Lc=Math.ceil,Rc=C.ReactCurrentDispatcher,zc=C.ReactCurrentOwner,Bc=C.ReactCurrentBatchConfig,$=0,Vc=null,Hc=null,Uc=0,Wc=0,Gc=Li(0),Kc=0,qc=null,Jc=0,Yc=0,Xc=0,Zc=null,Qc=null,$c=0,el=1/0,tl=null,nl=!1,rl=null,il=null,al=!1,ol=null,sl=0,cl=0,ll=null,ul=-1,dl=0;function fl(){return $&6?ct():ul===-1?ul=ct():ul}function pl(e){return e.mode&1?$&2&&Uc!==0?Uc&-Uc:Oa.transition===null?(e=J,e===0?(e=window.event,e=e===void 0?16:fn(e.type),e):e):(dl===0&&(dl=kt()),dl):1}function ml(e,t,n,i){if(50<cl)throw cl=0,ll=null,Error(r(185));jt(e,n,i),(!($&2)||e!==Vc)&&(e===Vc&&(!($&2)&&(Yc|=n),Kc===4&&bl(e,Uc)),hl(e,i),n===1&&$===0&&!(t.mode&1)&&(el=ct()+500,Zi&&ta()))}function hl(e,t){var n=e.callbackNode;Dt(e,t);var r=Tt(e,e===Vc?Uc:0);if(r===0)n!==null&&at(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&at(n),t===1)e.tag===0?ea(xl.bind(null,e)):$i(xl.bind(null,e)),xi(function(){!($&6)&&ta()}),n=null;else{switch(Pt(r)){case 1:n=ut;break;case 4:n=dt;break;case 16:n=ft;break;case 536870912:n=mt;break;default:n=ft}n=Wl(n,gl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function gl(e,t){if(ul=-1,dl=0,$&6)throw Error(r(327));var n=e.callbackNode;if(Il()&&e.callbackNode!==n)return null;var i=Tt(e,e===Vc?Uc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=kl(e,i);else{t=i;var a=$;$|=2;var o=Dl();(Vc!==e||Uc!==t)&&(tl=null,el=ct()+500,Tl(e,t));do try{jl();break}catch(t){El(e,t)}while(1);za(),Rc.current=o,$=a,Hc===null?(Vc=null,Uc=0,t=Kc):t=0}if(t!==0){if(t===2&&(a=Ot(e),a!==0&&(i=a,t=_l(e,a))),t===1)throw n=qc,Tl(e,0),bl(e,i),hl(e,ct()),n;if(t===6)bl(e,i);else{if(a=e.current.alternate,!(i&30)&&!yl(a)&&(t=kl(e,i),t===2&&(o=Ot(e),o!==0&&(i=o,t=_l(e,o))),t===1))throw n=qc,Tl(e,0),bl(e,i),hl(e,ct()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Pl(e,Qc,tl);break;case 3:if(bl(e,i),(i&130023424)===i&&(t=$c+500-ct(),10<t)){if(Tt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){fl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=vi(Pl.bind(null,e,Qc,tl),t);break}Pl(e,Qc,tl);break;case 4:if(bl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-vt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=ct()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Lc(i/1960))-i,10<i){e.timeoutHandle=vi(Pl.bind(null,e,Qc,tl),i);break}Pl(e,Qc,tl);break;case 5:Pl(e,Qc,tl);break;default:throw Error(r(329))}}}return hl(e,ct()),e.callbackNode===n?gl.bind(null,e):null}function _l(e,t){var n=Zc;return e.current.memoizedState.isDehydrated&&(Tl(e,t).flags|=256),e=kl(e,t),e!==2&&(t=Qc,Qc=n,t!==null&&vl(t)),e}function vl(e){Qc===null?Qc=e:Qc.push.apply(Qc,e)}function yl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Sr(a(),i))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 bl(e,t){for(t&=~Xc,t&=~Yc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-vt(t),r=1<<n;e[n]=-1,t&=~r}}function xl(e){if($&6)throw Error(r(327));Il();var t=Tt(e,0);if(!(t&1))return hl(e,ct()),null;var n=kl(e,t);if(e.tag!==0&&n===2){var i=Ot(e);i!==0&&(t=i,n=_l(e,i))}if(n===1)throw n=qc,Tl(e,0),bl(e,t),hl(e,ct()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Pl(e,Qc,tl),hl(e,ct()),null}function Sl(e,t){var n=$;$|=1;try{return e(t)}finally{$=n,$===0&&(el=ct()+500,Zi&&ta())}}function Cl(e){ol!==null&&ol.tag===0&&!($&6)&&Il();var t=$;$|=1;var n=Bc.transition,r=J;try{if(Bc.transition=null,J=1,e)return e()}finally{J=r,Bc.transition=n,$=t,!($&6)&&ta()}}function wl(){Wc=Gc.current,Ri(Gc)}function Tl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,yi(n)),Hc!==null)for(n=Hc.return;n!==null;){var r=n;switch(ma(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Gi();break;case 3:lo(),Ri(Vi),Ri(Bi),go();break;case 5:fo(r);break;case 4:lo();break;case 13:Ri(po);break;case 19:Ri(po);break;case 10:Ba(r.type._context);break;case 22:case 23:wl()}n=n.return}if(Vc=e,Hc=e=Yl(e.current,null),Uc=Wc=t,Kc=0,qc=null,Xc=Yc=Jc=0,Qc=Zc=null,Wa!==null){for(t=0;t<Wa.length;t++)if(n=Wa[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Wa=null}return e}function El(e,t){do{var n=Hc;try{if(za(),_o.current=ds,Co){for(var i=bo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Co=!1}if(yo=0,So=xo=bo=null,wo=!1,To=0,zc.current=null,n===null||n.return===null){Kc=1,qc=t,Hc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Uc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=ks(s);if(m!==null){m.flags&=-257,As(m,s,c,o,t),m.mode&1&&Os(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){Os(o,u,t),Ol();break a}l=Error(r(426))}else if(_a&&c.mode&1){var _=ks(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),As(_,s,c,o,t),Da(Ss(l,c));break a}}o=l=Ss(l,c),Kc!==4&&(Kc=2),Zc===null?Zc=[o]:Zc.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Es(o,l,t);eo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(il===null||!il.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ds(o,c,t);eo(o,x);break a}}o=o.return}while(o!==null)}Nl(n)}catch(e){t=e,Hc===n&&n!==null&&(Hc=n=n.return);continue}break}while(1)}function Dl(){var e=Rc.current;return Rc.current=ds,e===null?ds:e}function Ol(){(Kc===0||Kc===3||Kc===2)&&(Kc=4),Vc===null||!(Jc&268435455)&&!(Yc&268435455)||bl(Vc,Uc)}function kl(e,t){var n=$;$|=2;var i=Dl();(Vc!==e||Uc!==t)&&(tl=null,Tl(e,t));do try{Al();break}catch(t){El(e,t)}while(1);if(za(),$=n,Rc.current=i,Hc!==null)throw Error(r(261));return Vc=null,Uc=0,Kc}function Al(){for(;Hc!==null;)Ml(Hc)}function jl(){for(;Hc!==null&&!ot();)Ml(Hc)}function Ml(e){var t=Ul(e.alternate,e,Wc);e.memoizedProps=e.pendingProps,t===null?Nl(e):Hc=t,zc.current=null}function Nl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=cc(n,t),n!==null){n.flags&=32767,Hc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Kc=6,Hc=null;return}}else if(n=sc(n,t,Wc),n!==null){Hc=n;return}if(t=t.sibling,t!==null){Hc=t;return}Hc=t=e}while(t!==null);Kc===0&&(Kc=5)}function Pl(e,t,n){var r=J,i=Bc.transition;try{Bc.transition=null,J=1,Fl(e,t,n,r)}finally{Bc.transition=i,J=r}return null}function Fl(e,t,n,i){do Il();while(ol!==null);if($&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Mt(e,o),e===Vc&&(Hc=Vc=null,Uc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||al||(al=!0,Wl(ft,function(){return Il(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Bc.transition,Bc.transition=null;var s=J;J=1;var c=$;$|=4,zc.current=null,hc(e,n),Ac(n,e),kr(gi),on=!!hi,gi=hi=null,e.current=n,Mc(n,e,a),st(),$=c,J=s,Bc.transition=o}else e.current=n;if(al&&(al=!1,ol=e,sl=a),o=e.pendingLanes,o===0&&(il=null),_t(n.stateNode,i),hl(e,ct()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(nl)throw nl=!1,e=rl,rl=null,e;return sl&1&&e.tag!==0&&Il(),o=e.pendingLanes,o&1?e===ll?cl++:(cl=0,ll=e):cl=0,ta(),null}function Il(){if(ol!==null){var e=Pt(sl),t=Bc.transition,n=J;try{if(Bc.transition=null,J=16>e?16:e,ol===null)var i=!1;else{if(e=ol,ol=null,sl=0,$&6)throw Error(r(331));var a=$;for($|=4,Q=e.current;Q!==null;){var o=Q,s=o.child;if(Q.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(Q=u;Q!==null;){var d=Q;switch(d.tag){case 0:case 11:case 15:gc(8,d,o)}var f=d.child;if(f!==null)f.return=d,Q=f;else for(;Q!==null;){d=Q;var p=d.sibling,m=d.return;if(yc(d),d===u){Q=null;break}if(p!==null){p.return=m,Q=p;break}Q=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}Q=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,Q=s;else b:for(;Q!==null;){if(o=Q,o.flags&2048)switch(o.tag){case 0:case 11:case 15:gc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,Q=v;break b}Q=o.return}}var y=e.current;for(Q=y;Q!==null;){s=Q;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Q=b;else b:for(s=y;Q!==null;){if(c=Q,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:_c(9,c)}}catch(e){Rl(c,c.return,e)}if(c===s){Q=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,Q=x;break b}Q=c.return}}if($=a,ta(),gt&&typeof gt.onPostCommitFiberRoot==`function`)try{gt.onPostCommitFiberRoot(ht,e)}catch{}i=!0}return i}finally{J=n,Bc.transition=t}}return!1}function Ll(e,t,n){t=Ss(n,t),t=Es(e,t,1),e=Qa(e,t,1),t=fl(),e!==null&&(jt(e,1,t),hl(e,t))}function Rl(e,t,n){if(e.tag===3)Ll(e,e,n);else for(;t!==null;){if(t.tag===3){Ll(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(il===null||!il.has(r))){e=Ss(n,e),e=Ds(t,e,1),t=Qa(t,e,1),e=fl(),t!==null&&(jt(t,1,e),hl(t,e));break}}t=t.return}}function zl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=fl(),e.pingedLanes|=e.suspendedLanes&n,Vc===e&&(Uc&n)===n&&(Kc===4||Kc===3&&(Uc&130023424)===Uc&&500>ct()-$c?Tl(e,0):Xc|=n),hl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Ct,Ct<<=1,!(Ct&130023424)&&(Ct=4194304)):t=1);var n=fl();e=qa(e,t),e!==null&&(jt(e,t,n),hl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Vi.current)Ms=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ms=!1,tc(e,t,n);Ms=!!(e.flags&131072)}}else Ms=!1,_a&&t.flags&1048576&&fa(t,aa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;$s(e,t),e=t.pendingProps;var a=Ui(t,Bi.current);Ha(t,n),a=ko(null,t,i,e,a,n);var o=Ao();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Wi(i)?(o=!0,Ji(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Ya(t),a.updater=_s,t.stateNode=a,a._reactInternals=t,xs(t,i,e,n),t=Vs(null,t,i,!0,o,n)):(t.tag=0,_a&&o&&pa(t),Ns(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch($s(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=hs(i,e),a){case 0:t=zs(null,t,i,e,n);break a;case 1:t=Bs(null,t,i,e,n);break a;case 11:t=Ps(null,t,i,e,n);break a;case 14:t=Fs(null,t,i,hs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),zs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),Bs(e,t,i,a,n);case 3:a:{if(Hs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Xa(e,t),to(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ss(Error(r(423)),t),t=Us(e,t,i,n,a);break a}if(i!==a){a=Ss(Error(r(424)),t),t=Us(e,t,i,n,a);break a}for(ga=wi(t.stateNode.containerInfo.firstChild),ha=t,_a=!0,va=null,n=Pa(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ea(),i===a){t=ec(e,t,n);break a}Ns(e,t,i,n)}t=t.child}return t;case 5:return uo(t),e===null&&Sa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,_i(i,a)?s=null:o!==null&&_i(i,o)&&(t.flags|=32),Rs(e,t),Ns(e,t,s,n),t.child;case 6:return e===null&&Sa(t),null;case 13:return Ks(e,t,n);case 4:return co(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Na(t,null,i,n):Ns(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),Ps(e,t,i,a,n);case 7:return Ns(e,t,t.pendingProps,n),t.child;case 8:return Ns(e,t,t.pendingProps.children,n),t.child;case 12:return Ns(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Z(Fa,i._currentValue),i._currentValue=s,o!==null){if(Sr(o.value,s)){if(o.children===a.children&&!Vi.current){t=ec(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=Za(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Va(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Va(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Ns(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ha(t,n),a=Ua(a),i=i(a),t.flags|=1,Ns(e,t,i,n),t.child;case 14:return i=t.type,a=hs(i,t.pendingProps),a=hs(i.type,a),Fs(e,t,i,a,n);case 15:return Is(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:hs(i,a),$s(e,t),t.tag=1,Wi(i)?(e=!0,Ji(t)):e=!1,Ha(t,n),ys(t,i,a),xs(t,i,a,n),Vs(null,t,i,!0,e,n);case 19:return Qs(e,t,n);case 22:return Ls(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return it(e,t)}function Gl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(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&14680064,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}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return Zl(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Kl(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Kl(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=Kl(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=At(0),this.expirationTimes=At(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=At(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ya(a),e}function ru(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function iu(e){if(!e)return zi;e=e._reactInternals;a:{if(Qe(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Wi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Wi(n))return qi(e,n,t)}return t}function au(e,t,n,r,i,a,o,s,c){return e=nu(n,r,!0,e,i,a,o,s,c),e.context=iu(null),n=e.current,r=fl(),i=pl(n),a=Za(r,i),a.callback=t??null,Qa(n,a,i),e.current.lanes=i,jt(e,i,r),hl(e,r),e}function ou(e,t,n,r){var i=t.current,a=fl(),o=pl(i);return n=iu(n),t.context===null?t.context=n:t.pendingContext=n,t=Za(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Qa(i,t,o),e!==null&&(ml(e,i,o,a),$a(e,i,o)),o}function su(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lu(e,t){cu(e,t),(e=e.alternate)&&cu(e,t)}function uu(){return null}var du=typeof reportError==`function`?reportError:function(e){console.error(e)};function fu(e){this._internalRoot=e}pu.prototype.render=fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));ou(e,t,null,null)},pu.prototype.unmount=fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Cl(function(){ou(null,e,null,null)}),t[Oi]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<qt.length&&t!==0&&t<qt[n].priority;n++);qt.splice(n,0,e),n===0&&Qt(e)}};function mu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function gu(){}function _u(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=su(o);a.call(e)}}var o=au(t,r,e,0,null,!1,!1,``,gu);return e._reactRootContainer=o,e[Oi]=o.current,ri(e.nodeType===8?e.parentNode:e),Cl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=su(c);s.call(e)}}var c=nu(e,0,!1,null,null,!1,!1,``,gu);return e._reactRootContainer=c,e[Oi]=c.current,ri(e.nodeType===8?e.parentNode:e),Cl(function(){ou(t,c,n,r)}),c}function vu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=su(o);s.call(e)}}ou(t,o,e,i)}else o=_u(n,t,e,i,r);return su(o)}Ft=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=wt(t.pendingLanes);n!==0&&(Nt(t,n|1),hl(t,ct()),!($&6)&&(el=ct()+500,ta()))}break;case 13:Cl(function(){var t=qa(e,1);t!==null&&ml(t,e,1,fl())}),lu(e,1)}},It=function(e){if(e.tag===13){var t=qa(e,134217728);t!==null&&ml(t,e,134217728,fl()),lu(e,134217728)}},Lt=function(e){if(e.tag===13){var t=pl(e),n=qa(e,t);n!==null&&ml(n,e,t,fl()),lu(e,t)}},Rt=function(){return J},zt=function(e,t){var n=J;try{return J=e,t()}finally{J=n}},je=function(e,t,n){switch(t){case`input`:if(ue(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Pi(i);if(!a)throw Error(r(90));oe(i),ue(i,a)}}}break;case`textarea`:q(e,n);break;case`select`:t=n.value,t!=null&&pe(e,!!n.multiple,t,!1)}},Le=Sl,Re=Cl;var yu={usingClientEntryPoint:!1,Events:[Mi,Ni,Pi,Fe,Ie,Sl]},bu={findFiberByHostInstance:ji,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},xu={bundleType:bu.bundleType,version:bu.version,rendererPackageName:bu.rendererPackageName,rendererConfig:bu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=nt(e),e===null?null:e.stateNode},findFiberByHostInstance:bu.findFiberByHostInstance||uu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Su.isDisabled&&Su.supportsFiber)try{ht=Su.inject(xu),gt=Su}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mu(t))throw Error(r(200));return ru(e,t,null,n)},e.createRoot=function(e,t){if(!mu(e))throw Error(r(299));var n=!1,i=``,a=du;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=nu(e,1,!1,null,null,n,!1,i,a),e[Oi]=t.current,ri(e.nodeType===8?e.parentNode:e),new fu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=nt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Cl(e)},e.hydrate=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!mu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=du;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=au(t,null,e,1,n??null,a,!1,o,s),e[Oi]=t.current,ri(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new pu(t)},e.render=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!hu(e))throw Error(r(40));return e._reactRootContainer?(Cl(function(){vu(null,null,e,!1,function(){e._reactRootContainer=null,e[Oi]=null})}),!0):!1},e.unstable_batchedUpdates=Sl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!hu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return vu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=c(o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))(),1),g=c(u(),1);function _(){let e=window.location;return`${e.protocol===`https:`?`wss:`:`ws:`}//${e.host}/ws`}var v=new Map,y=new Map,b;function x(e,t){return`${e}:${t}`}function S(e,t,n){e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({type:`terminal/subscribe`,missionId:t,source:n,after:y.get(x(t,n))?.sequence??0}))}function C(e,t,n){let r=x(e,t),i=v.get(r)??new Set,a=i.size===0;return i.add(n),v.set(r,i),a&&b&&S(b,e,t),()=>{let i=v.get(r);i?.delete(n),!i?.size&&(v.delete(r),b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:`terminal/unsubscribe`,missionId:e,source:t})))}}function w(e){let t=e.type===`terminal/event`?e.event:void 0,n=t?.missionId??e.missionId,r=t?.source??e.source;if(!n||!r)return;let i=x(n,r),a=y.get(i),o=t?.streamId??e.streamId;if(!o)return;let s=a?.streamId!==void 0&&a.streamId!==o,c=t?[t]:e.events??[],l=s?c:c.filter(e=>e.sequence>(a?.sequence??0)),u=Math.max(s?0:a?.sequence??0,e.latestSequence??0,...l.map(e=>e.sequence));y.set(i,{streamId:o,sequence:u});let d={streamId:o,events:l,truncated:!!e.truncated,restarted:s};for(let e of v.get(i)??[])e(d)}var T;function E(){let[e,t]=(0,g.useState)(null),[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(),o=(0,g.useRef)(),s=(0,g.useRef)(()=>void 0);return(0,g.useEffect)(()=>{let e=!1,n;function i(){o.current&&clearTimeout(o.current),n=new WebSocket(_()),b=n,n.onopen=()=>{r(!0),a(void 0);for(let e of v.keys()){let t=e.indexOf(`:`);S(n,e.slice(0,t),e.slice(t+1))}},n.onclose=()=>{b===n&&(b=void 0),r(!1),a(Date.now()),e||(o.current=setTimeout(i,1500))},n.onmessage=e=>{let n=JSON.parse(e.data);if(n.type===`hello`&&n.build){if(T&&T!==n.build){window.location.reload();return}T=n.build}n.type===`roster`&&n.snapshot&&t(n.snapshot),(n.type===`terminal/event`||n.type===`terminal/replay`)&&w(n)}}return s.current=()=>{n?.readyState===WebSocket.OPEN||n?.readyState===WebSocket.CONNECTING?n.close():i()},i(),()=>{e=!0,o.current&&clearTimeout(o.current),n?.close(),b===n&&(b=void 0)}},[]),{snapshot:e,connected:n,lastDisconnectedAt:i,reconnect:()=>s.current()}}var D=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),O=o(((e,t)=>{t.exports=D()}))(),k={working:{label:`Working`,className:`bg-amber-500/15 text-amber-400 ring-amber-500/30`,pulse:!0},idle:{label:`Idle`,className:`bg-slate-500/15 text-slate-400 ring-slate-500/30`,pulse:!1},stalled:{label:`Stalled`,className:`bg-orange-500/10 text-orange-400 ring-orange-500/50 ring-2 ring-dashed`,pulse:!0},offline:{label:`Offline`,className:`bg-slate-700/20 text-slate-500 ring-slate-600/30`,pulse:!1},waiting_on_you:{label:`Needs you`,className:`bg-rose-500/15 text-rose-400 ring-rose-500/40`,pulse:!0},done:{label:`Done`,className:`bg-emerald-500/15 text-emerald-400 ring-emerald-500/30`,pulse:!1},error:{label:`Stale`,className:`bg-red-500/10 text-red-400 ring-red-500/50 ring-2 ring-dashed`,pulse:!1}};function A({status:e}){let t=k[e];return(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium ring-1 ${t.className}`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-current ${t.pulse?`hive-pulse`:``}`}),t.label]})}var j=``;function M(e){return`${j}${e}`}async function N(e){let t=await fetch(`${j}${e}`),n=await t.json();if(!t.ok)throw Error(n.error??`Request failed: ${t.status}`);return n}async function P(e,t){let n=await fetch(`${j}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=await n.json();if(!n.ok)throw Error(r.error??`Request failed: ${n.status}`);return r}async function F(e){let t=await fetch(`${j}${e}`,{method:`DELETE`}),n=await t.json();if(!t.ok)throw Error(n.error??`Request failed: ${t.status}`);return n}async function I(e,t){let n=await fetch(`${j}${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=await n.json();if(!n.ok)throw Error(r.error??`Request failed: ${n.status}`);return r}function L(e){return P(`/api/orchestrator/start`,e)}function ee(e,t=`claude`){return P(`/api/skills/discover`,{cwd:e,provider:t})}async function R(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`could not read ${t.name||`the pasted image`}`)),r.onload=()=>e(String(r.result).split(`,`)[1]??``),r.readAsDataURL(t)});return P(`/api/mission/${e}/attachment`,{name:t.name,mediaType:t.type,data:n})}function te(){return N(`/api/tasks`)}function z(e){return P(`/api/loop/${encodeURIComponent(e)}/stop`,{})}function ne(e){return P(`/api/mission/${encodeURIComponent(e)}/monitors/stop`,{})}function B(e){return P(`/api/agents/discover`,{cwd:e})}function re(e){return P(`/api/templates/discover`,{cwd:e})}function V(e,t,n){return P(`/api/templates`,{template:e,source:t,cwd:n})}function ie(e,t){if(e.source===`built-in`)throw Error(`built-in templates are read-only`);return I(`/api/templates/${e.source}/${encodeURIComponent(e.id)}`,{template:e,cwd:t})}function ae(e,t){if(e.source===`built-in`)throw Error(`built-in templates cannot be deleted`);let n=t?`?cwd=${encodeURIComponent(t)}`:``;return F(`/api/templates/${e.source}/${encodeURIComponent(e.id)}${n}`)}function H(e){return P(`/api/directories/suggest`,{input:e})}function U(e){return P(`/api/paths/inspect`,{input:e})}function W(e,t,n){return P(`/api/mission/${encodeURIComponent(e)}/message`,{text:t,attachmentIds:n})}function oe(e,t,n){return P(`/api/mission/${encodeURIComponent(e)}/decision/${encodeURIComponent(t)}/answer`,{answer:n})}function se(e,t){return P(`/api/mission/${encodeURIComponent(e)}/rename`,{name:t})}function G(e,t){return P(`/api/mission/${encodeURIComponent(e)}/status`,{status:t})}function ce(){return P(`/api/direct-studio/clear-completed`,{})}function le(){return P(`/api/review-hall/accept-clear`,{})}function ue(e){return F(`/api/mission/${encodeURIComponent(e)}`)}function de(e,t){return P(`/api/mission/${encodeURIComponent(e)}/action`,{action:t})}function fe(e,t,n){return P(`/api/mission/${encodeURIComponent(e)}/gate/${encodeURIComponent(t)}/waive`,{reason:n})}function K(e,t){return P(`/api/mission/${encodeURIComponent(e)}/gate`,t)}function pe(e,t,n){return I(`/api/mission/${encodeURIComponent(e)}/gate/${encodeURIComponent(t)}`,n)}function me(e,t){return F(`/api/mission/${encodeURIComponent(e)}/gate/${encodeURIComponent(t)}`)}function he(e){return N(`/api/mission/${encodeURIComponent(e)}/plan/revisions`)}function q(e,t,n){return P(`/api/mission/${encodeURIComponent(e)}/plan/approval`,{status:t,reason:n})}function ge(e,t,n,r){return P(`/api/mission/${encodeURIComponent(e)}/task/${encodeURIComponent(t)}/action`,{action:n,detail:r})}function _e(e,t){return P(`/api/mission/${encodeURIComponent(e)}/task`,{description:t})}function ve(e,t={}){let n=new URLSearchParams;t.before!==void 0&&n.set(`before`,String(t.before)),t.limit!==void 0&&n.set(`limit`,String(t.limit));let r=n.size?`?${n}`:``;return N(`/api/mission/${encodeURIComponent(e)}/messages${r}`)}function ye(e,t={}){let n=new URLSearchParams;t.source&&n.set(`source`,t.source),t.limit!==void 0&&n.set(`limit`,String(t.limit));let r=n.size?`?${n}`:``;return N(`/api/mission/${encodeURIComponent(e)}/transcript${r}`)}function be(e,t,n=`orchestrator`,r=crypto.randomUUID()){return P(`/api/mission/${encodeURIComponent(e)}/terminal/input`,{source:n,text:t,clientInputId:r})}function xe(e){return P(`/api/mission/${encodeURIComponent(e)}/terminal/interrupt`,{})}function Se(e){return N(`/api/mission/${encodeURIComponent(e)}/context`)}function Ce(e){return P(`/api/mission/${encodeURIComponent(e)}/handoff`,{})}function we(e,t){return`${j}/api/mission/${encodeURIComponent(e)}/report?format=${t}`}function Te(e){return N(`/api/mission/${encodeURIComponent(e)}/review-diff`)}function Ee(e,t,n){return P(`/api/mission/${encodeURIComponent(e)}/report/github`,{kind:t,target:n,confirmed:!0})}function De(){return N(`/api/policies`)}function Oe(e){return I(`/api/policies`,e)}function ke(e,t){return I(`/api/mission/${encodeURIComponent(e)}/policy`,{policy:t,confirmed:!0})}function Ae(){return N(`/api/providers/models`)}function je(e,t=!1){return P(`/api/session/${e}/stop`,{force:t})}function Me(e,t){return P(`/api/session/${encodeURIComponent(e)}/adopt`,{name:t})}var Ne=e=>({name:e.name,description:e.description,argumentHint:e.argumentHint,badge:e.source,tone:e.source===`claude`?`sky`:`violet`}),Pe=e=>({name:e.name,description:e.description,badge:`${e.source} agent`,tone:`emerald`}),Fe={sky:`text-sky-300`,violet:`text-violet-300`,emerald:`text-emerald-300`};function Ie({value:e,onChange:t,skills:n,agents:r=[],placeholder:i,rows:a=3,onSubmit:o,className:s=``,suggestionsPlacement:c=`above`,autoFocus:l=!1,focusCaret:u,marker:d}){let f=(0,g.useMemo)(()=>{let e=new Map;for(let t of n)e.set(`/${t.name}`,t.source===`claude`?`sky`:`violet`);for(let t of r)e.set(`@${t.name}`,`emerald`);return e},[r,n]),[p,m]=(0,g.useState)(()=>u===`end`?e.length:0),[h,_]=(0,g.useState)(0),[v,y]=(0,g.useState)(!1),b=(0,g.useRef)(null),x=(0,g.useRef)(null),S=e.slice(0,p).match(/(?:^|\s)([/@])([\w:-]*)$/),C=S?.[1],w=S?.[2]??``,T=C===`@`?r.map(Pe):C===`/`?n.map(Ne):[],E=S&&!v?T.filter(e=>e.name.toLowerCase().startsWith(w.toLowerCase())).slice(0,8):[];(0,g.useEffect)(()=>{if(!l||!u)return;let t=u===`end`?e.length:0,n=requestAnimationFrame(()=>{b.current?.focus(),b.current?.setSelectionRange(t,t),m(t)});return()=>cancelAnimationFrame(n)},[]);function D(n){if(!C)return;let r=p-w.length-1,i=`${e.slice(0,r)}${C}${n.name} ${e.slice(p)}`,a=r+n.name.length+2;t(i),m(a),_(0),requestAnimationFrame(()=>{b.current?.focus(),b.current?.setSelectionRange(a,a)})}function k(e){x.current&&(x.current.scrollTop=e.scrollTop,x.current.scrollLeft=e.scrollLeft)}return(0,O.jsxs)(`div`,{className:`relative ${s}`,children:[(0,O.jsx)(`div`,{ref:x,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 whitespace-pre-wrap break-words overflow-hidden rounded-lg py-1.5 pl-2 pr-6 text-sm leading-5 [scrollbar-gutter:stable]`,children:e.split(/([/@][\w:-]+)/g).map((e,t)=>{let n=f.get(e);return n?(0,O.jsx)(`span`,{className:Fe[n],children:e},t):(0,O.jsx)(`span`,{className:`text-white`,children:e},t)})}),(0,O.jsx)(`textarea`,{ref:b,...d?{[d]:``}:{},value:e,onScroll:e=>k(e.currentTarget),onChange:e=>{t(e.target.value),m(e.target.selectionStart),_(0),y(!1),requestAnimationFrame(()=>k(e.target))},onClick:e=>m(e.currentTarget.selectionStart),onKeyUp:e=>m(e.currentTarget.selectionStart),onKeyDown:e=>{if(e.key===`Escape`){if(e.preventDefault(),E.length&&!v){y(!0);return}e.currentTarget.blur();return}if(E.length){if(e.key===`ArrowDown`){e.preventDefault(),_((h+1)%E.length);return}if(e.key===`ArrowUp`){e.preventDefault(),_((h-1+E.length)%E.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),D(E[h]);return}}o&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),o())},rows:a,placeholder:i,autoFocus:l,className:`relative w-full resize-none overflow-y-auto bg-transparent py-1.5 pl-2 pr-6 text-sm leading-5 text-transparent caret-white outline-none placeholder:text-white/25 [scrollbar-gutter:stable]`}),E.length>0&&(0,O.jsx)(`div`,{className:`absolute left-0 right-0 z-30 overflow-hidden rounded-lg border border-white/10 bg-[#17171c] shadow-2xl ${c===`above`?`bottom-full mb-2`:`top-full mt-2`}`,children:E.map((e,t)=>(0,O.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),D(e)},className:`flex w-full items-start justify-between gap-4 px-3 py-2 text-left ${t===h?`bg-violet-400/10`:`hover:bg-white/5`}`,children:[(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsxs)(`span`,{className:`text-sm ${Fe[e.tone]}`,children:[C,e.name]}),e.argumentHint&&(0,O.jsx)(`span`,{className:`ml-1.5 font-mono text-[10px] text-amber-200/45`,children:e.argumentHint}),e.description&&(0,O.jsx)(`span`,{className:`mt-0.5 block line-clamp-1 text-[11px] text-white/35`,children:e.description})]}),(0,O.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase text-white/20`,children:e.badge})]},`${e.badge}:${e.name}`))})]})}function Le(e){let t=(0,g.useRef)(!1);return{onMouseDown:e=>{t.current=e.target===e.currentTarget},onClick:n=>{t.current&&n.target===n.currentTarget&&e(),t.current=!1}}}function Re({value:e,onChange:t}){return(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[[`networkAccess`,`Network access`],[`commits`,`Git commits`],[`pushes`,`Git pushes`],[`pullRequests`,`Pull requests`],[`releases`,`Releases / publishing`],[`destructiveActions`,`Destructive commands`]].map(([n,r])=>(0,O.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-white/[0.07] px-3 py-2 text-xs text-white/45`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:!!e[n],onChange:r=>t({...e,[n]:r.target.checked})}),r]},n))}),(0,O.jsxs)(`label`,{className:`block text-[10px] text-white/35`,children:[`Allowed repository roots `,(0,O.jsx)(`span`,{className:`text-white/20`,children:`(one per line; blank allows any directory)`}),(0,O.jsx)(`textarea`,{rows:2,value:e.allowedRoots.join(`
|
|
9
|
+
`),onChange:n=>t({...e,allowedRoots:n.target.value.split(`
|
|
10
|
+
`).map(e=>e.trim()).filter(Boolean)}),className:`mt-1 w-full rounded-lg border border-white/10 bg-black/20 p-2 font-mono text-xs text-white/60 outline-none`})]}),(0,O.jsxs)(`label`,{className:`block text-[10px] text-white/35`,children:[`Allowed Claude tools `,(0,O.jsx)(`span`,{className:`text-white/20`,children:`(comma separated; blank uses normal CLI availability)`}),(0,O.jsx)(`input`,{value:e.allowedTools.join(`, `),onChange:n=>t({...e,allowedTools:n.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}),className:`mt-1 w-full rounded-lg border border-white/10 bg-black/20 p-2 font-mono text-xs text-white/60 outline-none`})]})]})}var ze={page:10,selection:15,panel:20,field:25,drawer:30,modal:40};function Be(e){return[...e].sort((e,t)=>t.level-e.level||t.sequence-e.sequence)}var Ve=new Set,He=0,Ue;function We(e){if(!(e.key!==`Escape`||e.defaultPrevented)){for(let t of Be([...Ve]))if(t.onEscape()!==!1){e.preventDefault(),e.stopImmediatePropagation();return}}}function Ge(e,t){let n={level:e,sequence:He+=1,onEscape:t};return Ve.add(n),!Ue&&typeof window<`u`&&(Ue=We,window.addEventListener(`keydown`,Ue,!0)),()=>{Ve.delete(n),Ve.size===0&&Ue&&typeof window<`u`&&(window.removeEventListener(`keydown`,Ue,!0),Ue=void 0)}}function Ke(e,t,n){let r=(0,g.useRef)(n);r.current=n,(0,g.useEffect)(()=>{if(e)return Ge(t,()=>r.current())},[e,t])}var qe=e=>typeof window>`u`?null:localStorage.getItem(e);function Je({onClose:e,initialDraft:t,onLaunch:n}){let r=Le(e),[i,a]=(0,g.useState)(t?.task??``),[o,s]=(0,g.useState)(t?.name??``),[c,l]=(0,g.useState)(()=>t?.cwd??qe(`hive:last-cwd`)??``),[u,d]=(0,g.useState)(()=>t?.mode??(qe(`hive:last-mode`)||`direct`)),[f,p]=(0,g.useState)(t?.provider??`claude`),[m,h]=(0,g.useState)(t?.model??``),[_,v]=(0,g.useState)(()=>t?.worktree??(qe(`hive:last-mode`)||`direct`)===`orchestrated`),y=(0,g.useRef)(t?.worktree!==void 0);function b(e){d(e),y.current||v(e===`orchestrated`)}let[x,S]=(0,g.useState)(!1),[C,w]=(0,g.useState)(null),[T,E]=(0,g.useState)([]),[D,k]=(0,g.useState)(null),[A,j]=(0,g.useState)([]),[M,N]=(0,g.useState)([]),[P,F]=(0,g.useState)(!1),[I,R]=(0,g.useState)(!1),te=(0,g.useRef)(null),[z,ne]=(0,g.useState)(),[B,V]=(0,g.useState)(!1),[ie,ae]=(0,g.useState)(!1),[W,oe]=(0,g.useState)({}),[se,G]=(0,g.useState)([]),[ce,le]=(0,g.useState)(``),[ue,de]=(0,g.useState)([]),[fe,K]=(0,g.useState)(),[pe,me]=(0,g.useState)(),[he,q]=(0,g.useState)(!1),[ge,_e]=(0,g.useState)(t?.planFirst??!1);Ke(!0,ze.modal,e),(0,g.useEffect)(()=>{if(!P)return;let e=e=>{te.current?.contains(e.target)||F(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[P]),(0,g.useEffect)(()=>{Ae().then(({providers:e})=>de(e)).catch(()=>de([]))},[]),(0,g.useEffect)(()=>{De().then(({policy:e})=>{K(e),me(e)}).catch(()=>void 0)},[]),(0,g.useEffect)(()=>{H(``).then(({directories:e})=>{N(e),!c.trim()&&e[0]&&l(e[0].path)}).catch(()=>N([]))},[]),(0,g.useEffect)(()=>{c&&z?.exists&&!z.repositoryRoot&&R(!0)},[c,z]),(0,g.useEffect)(()=>{let e=setTimeout(()=>{Promise.allSettled([ee(c.trim()||void 0,f),H(c),U(c.trim()||void 0),re(c.trim()||void 0)]).then(([e,t,n,r])=>{e.status===`fulfilled`?(E(e.value.skills),k(null)):(E([]),k(e.reason.message)),t.status===`fulfilled`&&j(t.value.directories),n.status===`fulfilled`&&ne(n.value),r.status===`fulfilled`&&G(r.value.templates)})},250);return()=>clearTimeout(e)},[c,f]);async function ve(){if(!i.trim())return;let t={task:i,name:o.trim()||void 0,worktree:f===`claude`&&_,cwd:c.trim()||void 0,mode:u,budgets:W,templateId:ce||void 0,provider:f,model:m.trim()||void 0,policy:he?pe:void 0,planFirst:ge};if(n){try{c.trim()&&localStorage.setItem(`hive:last-cwd`,c.trim()),localStorage.setItem(`hive:last-mode`,u)}catch{}n({promise:L(t),draft:{task:i,name:o.trim()||void 0,cwd:c.trim()||void 0,mode:u,provider:f,model:m.trim()||void 0,worktree:_,planFirst:ge,templateId:ce||void 0,budgets:W,policy:he?pe:void 0}}),e();return}S(!0),w(null);try{await L({task:i,name:o.trim()||void 0,worktree:f===`claude`&&_,cwd:c.trim()||void 0,mode:u,budgets:W,templateId:ce||void 0,provider:f,model:m.trim()||void 0,policy:he?pe:void 0,planFirst:u===`orchestrated`&&ge});try{c.trim()&&localStorage.setItem(`hive:last-cwd`,c.trim()),localStorage.setItem(`hive:last-mode`,u)}catch{}e()}catch(e){w(e.message)}finally{S(!1)}}let ye=ue.find(e=>e.provider===f),be=se.find(e=>e.id===ce),xe=z?.repositoryRoot?.split(`/`).filter(Boolean).at(-1)??c.split(`/`).filter(Boolean).at(-1)??`working directory`,Se=m?ye?.models.find(e=>e.id===m)?.label??m:ye?.defaultModel?.label?`Default (${ye.defaultModel.label})`:`CLI default`,Ce=[u===`orchestrated`?`Orchestrated`:`Direct`,`${f===`claude`?`Claude`:`Codex`} ${Se}`,xe,f===`claude`&&_&&z?.repositoryRoot?`isolated worktree`:`current checkout`,u===`orchestrated`&&ge?`plan approval required`:void 0].filter(Boolean).join(` · `);return(0,O.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,...r,children:(0,O.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-mission-title`,className:`relative max-h-[calc(100dvh-2rem)] w-full max-w-xl overflow-y-auto overscroll-contain rounded-xl border border-white/10 bg-[#0f0f12] p-5 shadow-2xl shadow-black/40`,onClick:e=>e.stopPropagation(),children:[(0,O.jsxs)(`div`,{className:`mb-5 flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{id:`new-mission-title`,className:`text-sm font-medium text-white`,children:`New mission`}),(0,O.jsx)(`p`,{className:`mt-1 text-[10px] text-white/25`,children:`Define the work, choose how it runs, then launch.`})]}),(0,O.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`Close new mission dialog`,className:`rounded-lg border border-transparent px-2.5 py-1.5 text-sm text-white/35 transition hover:border-white/10 hover:bg-white/5 hover:text-white/75`,children:`×`})]}),(0,O.jsxs)(`section`,{children:[(0,O.jsx)(`p`,{className:`mb-3 text-[9px] font-semibold uppercase tracking-[0.18em] text-amber-200/40`,children:`Mission`}),(0,O.jsx)(`label`,{className:`mb-1 block text-xs text-white/40`,children:`Task`}),(0,O.jsx)(`div`,{className:`rounded-lg border border-white/10 bg-transparent p-1 focus-within:border-white/25`,children:(0,O.jsx)(Ie,{value:i,onChange:a,skills:T,rows:4,suggestionsPlacement:`below`,placeholder:`What should this mission accomplish? Type / to use a skill.`,autoFocus:!0,focusCaret:t?.task?`end`:void 0,onSubmit:ve})}),(0,O.jsx)(`p`,{className:`mb-3 mt-1.5 text-[10px] text-white/22`,children:`Enter to launch · Shift+Enter for a new line · / for skills`}),(0,O.jsxs)(`label`,{className:`mb-1 block text-xs text-white/40`,children:[`Name `,(0,O.jsx)(`span`,{className:`text-white/20`,children:`(optional)`})]}),(0,O.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`e.g. billing-refactor`,className:`mb-3 w-full rounded-lg border border-white/10 bg-white/[0.03] p-2.5 text-sm text-white placeholder:text-white/25 focus:border-white/25 focus:outline-none`}),I?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,O.jsx)(`label`,{className:`text-xs text-white/40`,children:`Custom working directory`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>{R(!1),M[0]&&l(M[0].path),F(!1)},className:`text-[10px] text-violet-300/45 hover:text-violet-200`,children:`Choose a repository instead`})]}),(0,O.jsxs)(`div`,{ref:te,className:`relative`,children:[(0,O.jsx)(`input`,{value:c,onFocus:()=>F(!0),onChange:e=>l(e.target.value),placeholder:`~/Development/project or /absolute/path`,className:`w-full rounded-lg border border-white/10 bg-white/[0.03] p-2.5 font-mono text-xs text-white placeholder:text-white/25 focus:border-white/25 focus:outline-none`}),P&&A.length>0&&(0,O.jsx)(`div`,{className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-56 overflow-y-auto rounded-lg border border-white/10 bg-[#17171c] p-1 shadow-2xl`,children:A.map(e=>(0,O.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{l(e.path),F(!1)},className:`block w-full rounded-md px-3 py-2 text-left hover:bg-white/5`,children:[(0,O.jsx)(`span`,{className:`block font-mono text-xs text-white/75`,children:e.path}),e.path!==e.resolvedPath&&(0,O.jsx)(`span`,{className:`mt-0.5 block truncate font-mono text-[10px] text-white/25`,children:e.resolvedPath})]},e.resolvedPath))})]})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,O.jsx)(`label`,{className:`text-xs text-white/40`,children:`Repository`}),(0,O.jsx)(`span`,{className:`text-[10px] text-white/20`,children:`Recent Git repositories`})]}),(0,O.jsxs)(`select`,{value:c,onChange:e=>{e.target.value===`__custom__`?(R(!0),F(!1)):l(e.target.value)},className:`w-full rounded-lg border border-white/10 bg-[#151519] p-2.5 font-mono text-xs text-white/70 outline-none focus:border-white/25`,children:[c&&!M.some(e=>e.path===c||e.resolvedPath===c)&&(0,O.jsx)(`option`,{value:c,children:c}),M.map(e=>(0,O.jsx)(`option`,{value:e.path,children:e.path},e.resolvedPath)),(0,O.jsx)(`option`,{value:`__custom__`,children:`Custom working directory…`})]})]}),z&&(0,O.jsx)(`div`,{className:`mt-2 rounded-lg border px-3 py-2 ${z.exists?`border-white/[0.06] bg-white/[0.018]`:`border-rose-400/15 bg-rose-400/[0.04]`}`,children:z.exists?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[10px]`,children:[(0,O.jsx)(`span`,{className:`font-mono text-white/45`,children:xe}),(0,O.jsx)(`span`,{className:z.repositoryRoot?`text-emerald-300/45`:`text-amber-200/45`,children:z.repositoryRoot?`Git repository`:`Non-Git directory`}),z.branch&&(0,O.jsx)(`span`,{className:`text-violet-300/50`,children:z.branch}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>ae(!ie),className:`ml-auto text-white/25 hover:text-white/50`,children:ie?`Hide details`:`View project details`})]}),ie&&(0,O.jsxs)(`div`,{className:`mt-2 border-t border-white/[0.05] pt-2`,children:[(0,O.jsx)(`p`,{className:`break-all font-mono text-[9px] text-white/25`,children:z.resolvedPath}),(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:z.configuration.map(e=>(0,O.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${e.available?`bg-emerald-300/[0.07] text-emerald-200/45`:`bg-white/[0.025] text-white/18`}`,children:[e.available?`✓`:`—`,` `,e.label]},e.label))})]})]}):(0,O.jsxs)(`p`,{className:`text-[11px] text-rose-300/70`,children:[`Directory not found: `,(0,O.jsx)(`span`,{className:`font-mono`,children:z.resolvedPath})]})}),(0,O.jsx)(`p`,{className:`mt-2 text-[10px] ${D?`text-rose-400`:`text-white/22`}`,children:D??`${T.length} skill${T.length===1?``:`s`} available`})]}),(0,O.jsxs)(`section`,{className:`mt-5 border-t border-white/[0.06] pt-5`,children:[(0,O.jsx)(`p`,{className:`mb-3 text-[9px] font-semibold uppercase tracking-[0.18em] text-violet-200/40`,children:`Execution`}),(0,O.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-2`,children:[`direct`,`orchestrated`].map(e=>(0,O.jsxs)(`button`,{type:`button`,"aria-pressed":u===e,onClick:()=>b(e),className:`rounded-lg border p-3 text-left transition hover:-translate-y-0.5 ${u===e?`border-violet-400/40 bg-violet-400/10`:`border-white/10 bg-white/[0.02] hover:bg-white/[0.04]`}`,children:[(0,O.jsx)(`span`,{className:`block text-sm font-medium capitalize text-white/85`,children:e}),(0,O.jsx)(`span`,{className:`mt-1 block text-[10px] leading-relaxed text-white/32`,children:e===`direct`?`One agent for focused work.`:`A manager coordinates parallel workers.`})]},e))}),(0,O.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-2`,children:[`claude`,`codex`].map(e=>{let t=ue.find(t=>t.provider===e)?.available===!1;return(0,O.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":f===e,onClick:()=>{p(e),h(``)},className:`rounded-lg border px-3 py-2.5 text-left transition disabled:cursor-not-allowed disabled:opacity-35 ${f===e?e===`codex`?`border-emerald-300/35 bg-emerald-300/[0.08]`:`border-violet-300/35 bg-violet-300/[0.08]`:`border-white/10 bg-white/[0.02] hover:bg-white/[0.04]`}`,children:[(0,O.jsx)(`span`,{className:`text-xs font-medium capitalize text-white/75`,children:e}),t&&(0,O.jsx)(`span`,{className:`ml-2 text-[8px] uppercase text-rose-300/60`,children:`Not detected`})]},e)})}),(0,O.jsx)(`label`,{className:`mb-1 block text-xs text-white/40`,children:`Model`}),(0,O.jsxs)(`select`,{value:m,onChange:e=>h(e.target.value),className:`mb-3 w-full rounded-lg border border-white/10 bg-[#151519] p-2.5 font-mono text-xs text-white/70 outline-none focus:border-white/25`,children:[(0,O.jsxs)(`option`,{value:``,children:[`CLI default`,ye?.defaultModel?` (${ye.defaultModel.label})`:``,` · recommended`]}),(ye?.models??[]).map(e=>(0,O.jsxs)(`option`,{value:e.id,children:[e.label,` · `,e.description??e.id]},e.id))]}),(0,O.jsx)(`p`,{className:`mb-2 text-[10px] font-medium text-white/30`,children:`Launch options`}),(0,O.jsxs)(`div`,{className:`mb-3 grid gap-2 ${u===`orchestrated`?`sm:grid-cols-2`:``}`,children:[(0,O.jsxs)(`label`,{className:`flex items-start gap-2 rounded-lg border px-3 py-2.5 ${f===`claude`&&z?.repositoryRoot?`cursor-pointer border-white/[0.07] bg-white/[0.015]`:`cursor-not-allowed border-white/[0.04] bg-white/[0.008] opacity-45`}`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:f===`claude`&&!!z?.repositoryRoot&&_,disabled:f!==`claude`||!z?.repositoryRoot,onChange:e=>{y.current=!0,v(e.target.checked)},className:`mt-0.5 accent-violet-400`}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`block text-xs text-white/60`,children:`Isolated worktree`}),(0,O.jsx)(`span`,{className:`mt-0.5 block text-[9px] text-white/25`,children:`Separate checkout for this mission.`})]})]}),u===`orchestrated`&&(0,O.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-lg border px-3 py-2.5 ${ge?`border-amber-300/25 bg-amber-300/[0.05]`:`border-white/[0.07] bg-white/[0.015]`}`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:ge,onChange:e=>_e(e.target.checked),className:`mt-0.5 accent-amber-300`}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`block text-xs text-white/60`,children:`Plan first`}),(0,O.jsx)(`span`,{className:`mt-0.5 block text-[9px] text-white/25`,children:`Approve the plan before workers begin.`})]})]})]}),(0,O.jsx)(`label`,{className:`mb-1 block text-xs text-white/40`,children:`Mission template`}),(0,O.jsxs)(`select`,{value:ce,onChange:e=>{let t=e.target.value;le(t);let n=se.find(e=>e.id===t);n&&(d(n.mode),y.current=!0,v(n.worktree),oe(n.budgets??{}))},className:`w-full rounded-lg border border-white/10 bg-[#151519] px-3 py-2.5 text-xs text-white/60`,children:[(0,O.jsx)(`option`,{value:``,children:`No template`}),se.map(e=>(0,O.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.version,` · `,e.source]},`${e.source}:${e.id}`))]}),be&&(0,O.jsxs)(`div`,{className:`mt-2 rounded-lg border border-violet-300/10 bg-violet-300/[0.03] px-3 py-2`,children:[(0,O.jsx)(`p`,{className:`text-[10px] text-white/45`,children:be.description}),(0,O.jsxs)(`p`,{className:`mt-1 truncate text-[9px] text-white/22`,children:[be.stages.map(e=>e.title).join(` → `),` · `,be.gates.length,` required gate`,be.gates.length===1?``:`s`]})]})]}),(0,O.jsxs)(`section`,{className:`mt-4 rounded-lg border border-white/[0.06] bg-white/[0.012]`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>V(!B),className:`flex w-full items-center justify-between px-3 py-3 text-left`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`block text-xs font-medium text-white/50`,children:`Advanced settings`}),(0,O.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-white/22`,children:`Permission policy and mission budgets`})]}),(0,O.jsx)(`span`,{className:`text-xs text-white/25`,children:B?`−`:`+`})]}),B&&(0,O.jsxs)(`div`,{className:`space-y-5 border-t border-white/[0.05] p-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs font-medium text-white/50`,children:`Permission policy`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-[9px] text-white/22`,children:he?`Custom mission override`:`Workspace defaults and template restrictions`})]}),he&&fe&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>{me(fe),q(!1)},className:`text-[9px] text-white/25 hover:text-white/50`,children:`Reset`})]}),pe?(0,O.jsx)(Re,{value:pe,onChange:e=>{me(e),q(!0)}}):(0,O.jsx)(`p`,{className:`text-xs text-white/25`,children:`Loading policy…`})]}),(0,O.jsxs)(`div`,{className:`border-t border-white/[0.05] pt-4`,children:[(0,O.jsxs)(`p`,{className:`mb-3 text-xs font-medium text-white/50`,children:[`Mission budgets `,(0,O.jsx)(`span`,{className:`font-normal text-white/20`,children:`· optional soft limits`})]}),(0,O.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[[`maxWorkers`,`Maximum workers`,`e.g. 8`],[`maxConcurrentWorkers`,`Concurrent workers`,`e.g. 4`],[`maxTokens`,`Token budget`,`e.g. 100000`],[`maxElapsedMinutes`,`Time budget (minutes)`,`e.g. 120`]].map(([e,t,n])=>(0,O.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[t,(0,O.jsx)(`input`,{type:`number`,min:`1`,value:W[e]??``,onChange:t=>oe(n=>({...n,[e]:t.target.value?Math.max(1,Number(t.target.value)):void 0})),placeholder:n,className:`mt-1 w-full rounded-md border border-white/10 bg-black/20 px-2 py-1.5 text-xs text-white/65 outline-none focus:border-amber-300/25`})]},e))})]})]})]}),C&&(0,O.jsx)(`p`,{className:`mt-3 text-xs text-rose-400`,children:C}),(0,O.jsxs)(`div`,{className:`mt-4 border-t border-white/[0.06] pt-4`,children:[(0,O.jsx)(`p`,{className:`mb-3 truncate text-[10px] text-white/28`,title:Ce,children:Ce}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{onClick:e,className:`rounded-lg px-3 py-1.5 text-sm text-white/45 hover:text-white/75`,children:`Cancel`}),(0,O.jsx)(`button`,{onClick:ve,disabled:x||!i.trim()||!!D||z?.exists===!1,className:`rounded-lg bg-amber-300 px-3 py-1.5 text-sm font-medium text-black transition hover:bg-amber-200 disabled:opacity-40`,children:x?`Starting…`:`Start ${u} mission`})]})]})]})})}function Ye({missionId:e,name:t,large:n=!1}){let[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(t),[s,c]=(0,g.useState)(!1),l=(0,g.useRef)(null);(0,g.useEffect)(()=>o(t),[t]),(0,g.useEffect)(()=>{r&&l.current?.select()},[r]);async function u(){let n=a.trim();if(!n||n===t){o(t),i(!1);return}c(!0);try{await se(e,n),i(!1)}finally{c(!1)}}return r?(0,O.jsx)(`input`,{ref:l,value:a,disabled:s,onChange:e=>o(e.target.value),onClick:e=>e.stopPropagation(),onBlur:u,onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&u(),e.key===`Escape`&&(o(t),i(!1))},className:`${n?`text-xl`:`text-sm`} min-w-0 max-w-full rounded border border-violet-400/40 bg-black/30 px-1.5 py-0.5 font-semibold text-white outline-none`}):(0,O.jsxs)(`div`,{className:`group/name flex min-w-0 items-center gap-1.5`,children:[(0,O.jsx)(`span`,{title:t,className:`${n?`text-xl`:`text-sm`} truncate font-semibold text-white`,children:t}),(0,O.jsx)(`button`,{type:`button`,title:`Rename mission`,onClick:e=>{e.stopPropagation(),i(!0)},className:`shrink-0 rounded p-1 text-white/25 opacity-0 transition hover:bg-white/10 hover:text-white/70 group-hover/name:opacity-100`,children:`✎`})]})}function Xe({compact:e=!1}){return(0,O.jsx)(`div`,{className:`hive-mark ${e?`h-8 w-8`:`h-10 w-10`}`,"aria-hidden":`true`,children:(0,O.jsxs)(`svg`,{viewBox:`0 0 48 48`,fill:`none`,className:`h-full w-full`,children:[(0,O.jsx)(`path`,{d:`M24 3.5 41.75 13.75v20.5L24 44.5 6.25 34.25v-20.5L24 3.5Z`,fill:`url(#hive-fill)`,stroke:`url(#hive-stroke)`,strokeWidth:`1.5`}),(0,O.jsx)(`path`,{d:`M17.5 19.2c-4.8-4.4-8.7.4-4.5 4.3 1.7 1.6 4 1.8 6.2 1M30.5 19.2c4.8-4.4 8.7.4 4.5 4.3-1.7 1.6-4 1.8-6.2 1`,fill:`#f7b93e`,fillOpacity:`.2`,stroke:`#f7c65a`,strokeWidth:`1.4`,strokeLinecap:`round`}),(0,O.jsx)(`path`,{d:`M18.5 22.5c0-3 2.45-5.5 5.5-5.5s5.5 2.5 5.5 5.5v4c0 3.6-2.45 6.5-5.5 6.5s-5.5-2.9-5.5-6.5v-4Z`,fill:`#f7b93e`}),(0,O.jsx)(`path`,{d:`M19 23h10M18.7 27.5h10.6`,stroke:`#30230b`,strokeWidth:`2.4`}),(0,O.jsx)(`path`,{d:`m21 32.1 3 3 3-3`,fill:`#f7b93e`}),(0,O.jsx)(`circle`,{cx:`22`,cy:`20.5`,r:`.8`,fill:`#30230b`}),(0,O.jsx)(`circle`,{cx:`26`,cy:`20.5`,r:`.8`,fill:`#30230b`}),(0,O.jsxs)(`defs`,{children:[(0,O.jsxs)(`linearGradient`,{id:`hive-fill`,x1:`9`,y1:`7`,x2:`39`,y2:`42`,gradientUnits:`userSpaceOnUse`,children:[(0,O.jsx)(`stop`,{stopColor:`#F9C74F`,stopOpacity:`.22`}),(0,O.jsx)(`stop`,{offset:`1`,stopColor:`#7C3AED`,stopOpacity:`.1`})]}),(0,O.jsxs)(`linearGradient`,{id:`hive-stroke`,x1:`8`,y1:`8`,x2:`40`,y2:`41`,gradientUnits:`userSpaceOnUse`,children:[(0,O.jsx)(`stop`,{stopColor:`#FFD875`}),(0,O.jsx)(`stop`,{offset:`1`,stopColor:`#A78BFA`,stopOpacity:`.55`})]})]})]})})}function Ze({subtitle:e}){return(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(Xe,{}),(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`h1`,{className:`hive-wordmark text-xl text-white`,children:`Hive`}),(0,O.jsx)(`span`,{className:`rounded-full border border-amber-300/15 bg-amber-300/[0.06] px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-[0.18em] text-amber-200/55`,children:`Mission control`})]}),e]})]})}var Qe={critical:0,warning:1,info:2};function $e(e){return[...e].sort((e,t)=>Qe[e.severity]-Qe[t.severity])}function et(e){return e.split(`/.claude/worktrees/`)[0]}function tt(e){return et(e).split(`/`).at(-1)??e}function nt(e){let t=e.replace(/^worktree-/,``);return t.length>24?`…${t.slice(-23)}`:t}function rt(e){let t=new Set,n=e=>{for(let r of e){for(let e of r.changedFiles??[])t.add(e);r.subtasks?.length&&n(r.subtasks)}};for(let t of e?.phases??[])n(t.tasks);return t.size}function it(e,t){return e===`active`||e===`failed`||t===`working`||t===`waiting_on_you`||t===`stalled`||t===`error`}function at(e){let t=e?.trim();if(!(!t||/^awaiting (user )?acceptance\.?$/i.test(t)))return t}function ot(e,t,n){return at(t)??at(n)}function st(e){let t=e=>e.status!==`queued`||(e.subtasks??[]).some(t);return(e?.phases??[]).some(e=>e.status!==`queued`||e.tasks.some(t))}function ct(e){return e.lifecycleStatus!==`active`||e.plan?.approvalStatus!==`proposed`?!1:!!e.mission?.planFirst||!st(e.plan)}function lt(e){if(!e||e.layout!==`phased`||!e.phases.length)return;let t=e.phases.findIndex(e=>e.status===`working`||e.status===`reviewing`||e.status===`blocked`),n=e.phases.findIndex(e=>e.status!==`completed`&&e.status!==`cancelled`),r=t===-1?n===-1?e.phases.length-1:n:t,i=e.phases[r],a=e=>e.flatMap(e=>e.subtasks?.length?a(e.subtasks):[e]),o=a(i.tasks).filter(e=>e.status!==`cancelled`);return{index:r+1,total:e.phases.length,title:i.title,completed:o.filter(e=>e.status===`completed`).length,tasks:o.length}}function ut(e){let t=e?.gates.filter(e=>e.required)??[];if(t.length)return{satisfied:t.filter(e=>e.status===`satisfied`||e.status===`waived`).length,required:t.length}}function dt(e){return e===`ready_for_review`?{label:`Accept & complete`,shortLabel:`Accept`,next:`completed`}:e===`paused`?{label:`Resume mission`,shortLabel:`Resume`,next:`active`}:e===`completed`||e===`failed`||e===`archived`?{label:`Reopen mission`,shortLabel:`Reopen`,next:`active`}:{label:`Pause mission`,shortLabel:`Pause`,next:`paused`}}function ft(e){return e===`active`||e===`ready_for_review`||e===`paused`||e===`failed`}function pt(e){if(e===`active`)return{label:`Pause mission`,shortLabel:`Pause`,next:`paused`};if(e===`paused`)return{label:`Resume mission`,shortLabel:`Resume`,next:`active`}}function mt(e,t){let n=t[0];if(n?.choices.length)return{label:n.choices[0],decisionId:n.id,answer:n.choices[0]};if(!n&&e===`ready_for_review`)return{label:`Accept & complete`,next:`completed`}}function ht(e,t){let n=t[0];if(n?.choices.length)return n.choices.length===2?{label:n.choices[1],decisionId:n.id,answer:n.choices[1]}:void 0;if(!n&&e===`ready_for_review`)return{label:`Request changes`,needsWords:!0}}var gt=new Set([`button`,`checkbox`,`color`,`file`,`image`,`radio`,`range`,`reset`,`submit`]);function _t(e){let t=e;return t&&t.nodeType===1?t:void 0}function vt(e){let t=_t(e);return t?t.isContentEditable?!0:[`INPUT`,`TEXTAREA`,`SELECT`].includes(t.tagName):!1}function yt(e){let t=_t(e);if(!t)return!1;if(t.isContentEditable)return!0;let n=t.tagName;if(n===`TEXTAREA`||n===`SELECT`)return!0;if(n!==`INPUT`)return!1;let r=(t.type||`text`).toLowerCase();return!gt.has(r)}var bt=`hive:collapsed-sections`;function xt(){if(typeof window>`u`)return{};try{let e=JSON.parse(localStorage.getItem(`hive:collapsed-sections`)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`boolean`))}catch{return{}}}function St(e,t){let n=xt()[e];return typeof n==`boolean`?n:t}var Ct=`Needs you`,wt=`Needs you:pinned`;function Tt(e){let t=xt()[wt]===!0;return{pinned:t,collapsed:t?St(Ct,e):e}}function Et(e){Dt(Ct,e),Dt(wt,!0)}function Dt(e,t){try{localStorage.setItem(bt,JSON.stringify({...xt(),[e]:t}))}catch{}}var Ot={decision:`text-rose-200/85`,failure:`text-rose-200/85`,stale:`text-rose-200/85`,acceptance:`text-amber-100/85`,plan_approval:`text-violet-200/85`,stall:`text-orange-200/85`},kt={decision:`Decision`,failure:`Failed`,stale:`Stale`,acceptance:`Accept`,plan_approval:`Plan`,stall:`Stalled`},At=`rounded-md border border-amber-200/25 bg-amber-200/[0.08] px-2.5 py-1 text-[11px] font-medium text-amber-100/85 transition hover:bg-amber-200/[0.14] disabled:opacity-35`,jt=`rounded-md border border-white/12 px-2.5 py-1 text-[11px] text-white/50 transition hover:border-white/25 hover:text-white/80 disabled:opacity-35`;function Mt(e){return e.length>0&&e.every(e=>e.kind===`acceptance`)}function Nt({items:e,onOpenMission:t,numbersActive:n=!0}){let r=e,i=Mt(r),[a,o]=(0,g.useState)(()=>Tt(i).collapsed),[s,c]=(0,g.useState)(()=>Tt(i).pinned),l=e=>{c(!0),o(e),Et(e)},[u,d]=(0,g.useState)(-1);(0,g.useEffect)(()=>d(e=>e<0?e:Math.min(e,r.length-1)),[r.length]),(0,g.useEffect)(()=>{s||o(i)},[s,i]);let[f,p]=(0,g.useState)({}),[m,h]=(0,g.useState)(null),[_,v]=(0,g.useState)(null),[y,b]=(0,g.useState)({}),[x,S]=(0,g.useState)();if((0,g.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{if(e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||yt(e.target))return;if(e.key===`0`){e.preventDefault(),l(!a);return}if(e.key.toLowerCase()===`t`&&r.length){e.preventDefault(),o(!1),d(0);return}if(u>=0&&u<r.length){let n=r[u],i=e.key.toLowerCase();if(e.key===`Escape`){e.preventDefault(),h(null),d(-1);return}if(i===`a`||i===`d`){if(n.kind===`plan_approval`){e.preventDefault(),i===`a`?C(n.id,()=>q(n.missionId,`approved`)):h(n.id);return}let t=i===`a`?mt(n.lifecycle,n.pending):ht(n.lifecycle,n.pending);if(!t)return;if(e.preventDefault(),t.needsWords){h(n.id);return}C(n.id,()=>t.answer?oe(n.missionId,t.decisionId,t.answer):G(n.missionId,t.next),!t.answer&&t.next?{label:`Undo ${t.label.toLowerCase()}`,run:()=>G(n.missionId,n.lifecycle)}:void 0);return}if(e.key===`Enter`){e.preventDefault(),t(n.missionId);return}if(i===`r`&&(n.kind===`failure`||n.kind===`stale`||n.kind===`stall`)){e.preventDefault(),C(n.id,()=>de(n.missionId,`test_pass`));return}if(i===`p`&&n.lifecycle===`active`){e.preventDefault(),C(n.id,()=>G(n.missionId,`paused`),{label:`Undo pause`,run:()=>G(n.missionId,`active`)});return}if(i===`q`){e.preventDefault(),t(n.missionId);return}if(i===`w`&&n.unresolvedGates?.length){e.preventDefault();let t=n.unresolvedGates[0],r=window.prompt(`Reason for waiving “${t.label}”`);r?.trim()&&C(n.id,()=>fe(n.missionId,t.id,r.trim()));return}}if((e.key===`j`||e.key===`k`)&&r.length&&u>=0){e.preventDefault(),o(!1),d(t=>e.key===`j`?Math.min(r.length-1,t+1):Math.max(0,t<0?0:t-1));return}if(!n)return;let i=Number(e.key)-1;!Number.isInteger(i)||i<0||i>=Math.min(r.length,9)||(e.preventDefault(),d(i),o(!1))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)}),!e.length)return null;async function C(e,t,n){v(e),b(t=>({...t,[e]:``}));try{await t(),n&&S(n),d(e=>e<0?e:Math.min(e,Math.max(0,r.length-2)))}catch(t){b(n=>({...n,[e]:t.message}))}finally{v(null)}}function w(e){let t=(f[e.id]??``).trim();t&&(e.kind===`plan_approval`?C(e.id,()=>q(e.missionId,`rejected`,t)):C(e.id,async()=>{await G(e.missionId,`active`),await W(e.missionId,`Review changes requested: ${t}`)},{label:`Undo change request`,run:()=>G(e.missionId,`ready_for_review`)}),h(null))}new Set(r.map(e=>e.missionId)).size;let T=r.reduce((e,t)=>({...e,[t.kind]:(e[t.kind]??0)+1}),{}),E=[T.decision&&`${T.decision} decision${T.decision===1?``:`s`}`,T.failure&&`${T.failure} failed`,T.stall&&`${T.stall} stalled`,T.plan_approval&&`${T.plan_approval} plan${T.plan_approval===1?``:`s`} to approve`,T.acceptance&&`${T.acceptance} to accept`].filter(Boolean).join(` · `)||`${r.length} item${r.length===1?``:`s`}`,D=u>=0&&u<r.length?[r[u]]:r;return(0,O.jsxs)(`section`,{"aria-label":`Needs you`,"data-urgent":!i,className:`sticky top-2 z-30 mb-6 rounded-xl border-2 border-rose-400 bg-rose-400/[0.07] p-3 backdrop-blur ${i?`shadow-[0_0_18px_rgba(251,113,133,0.3)]`:`hive-attention`}`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>l(!a),"aria-expanded":!a,className:`group/rail flex w-full items-center justify-between gap-3 px-1 text-left`,children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,O.jsx)(`span`,{className:`flex h-6 min-w-6 shrink-0 items-center justify-center rounded-full px-1.5 text-xs font-bold tabular-nums text-[#2b0a13] ${i?`bg-rose-300`:`bg-rose-400 hive-pulse`}`,children:r.length}),(0,O.jsx)(`span`,{className:`text-[11px] font-bold uppercase tracking-[0.2em] text-rose-50`,children:`Needs you`}),(0,O.jsxs)(`span`,{className:`truncate text-[11px] text-rose-100/60`,children:[E,!a&&r.length>1&&` · t triages · 1–9 focuses`]})]}),(0,O.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 rounded-md border border-rose-200/45 bg-rose-300/20 px-2.5 py-1 text-[11px] font-semibold text-rose-50 transition group-hover/rail:border-rose-200/80 group-hover/rail:bg-rose-300/30`,children:[a?`Review`:`Hide`,(0,O.jsx)(`kbd`,{className:`mono text-[9px] text-rose-100/40`,children:`0`})]})]}),!a&&(0,O.jsxs)(O.Fragment,{children:[x&&(0,O.jsxs)(`div`,{role:`status`,className:`mt-2 flex items-center justify-between rounded-lg border border-sky-200/15 bg-sky-200/[0.05] px-3 py-1.5 text-[10px] text-sky-100/55`,children:[(0,O.jsx)(`span`,{children:`Action completed.`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>{let e=x;S(void 0),e.run()},className:`font-semibold text-sky-100/80`,children:x.label})]}),(0,O.jsxs)(`div`,{className:`mt-2.5 flex items-center justify-between border-t border-rose-200/10 pt-2`,children:[(0,O.jsx)(`span`,{className:`text-[9px] text-rose-100/35`,children:u>=0?`Triage ${u+1} of ${r.length} · j/k move · a/d act · Esc exits`:`Press t or Start triage`}),(0,O.jsx)(`span`,{className:`flex gap-1.5`,children:u>=0?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`button`,{type:`button`,disabled:u===0,onClick:()=>d(e=>Math.max(0,e-1)),className:jt,children:`Previous`}),(0,O.jsx)(`button`,{type:`button`,disabled:u>=r.length-1,onClick:()=>d(e=>Math.min(r.length-1,e+1)),className:jt,children:`Next`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>d(-1),className:jt,children:`Show all`})]}):r.length>0&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>d(0),className:At,children:[`Start triage `,(0,O.jsx)(`kbd`,{className:`mono ml-1 text-[9px]`,children:`t`})]})})]}),(0,O.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1.5`,children:D.map(e=>{let i=r.indexOf(e),a=_===e.id,o=y[e.id];return(0,O.jsxs)(`li`,{className:`rounded-lg border bg-white/[0.022] px-3 py-2.5 ${u===i?`border-amber-300/30 ring-1 ring-amber-300/20`:`border-white/[0.06]`}`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5`,children:[i<9&&(0,O.jsx)(`span`,{className:`mono shrink-0 rounded border px-1.5 text-[10px] ${u===i?`border-amber-300/40 bg-amber-300/10 text-amber-100/85`:n?`border-white/[0.08] text-white/25`:`border-white/[0.04] text-white/12`}`,children:i+1}),(0,O.jsx)(`span`,{className:`shrink-0 text-[9px] font-semibold uppercase tracking-wider ${Ot[e.kind]}`,children:kt[e.kind]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>t(e.missionId),className:`shrink-0 text-xs font-semibold text-white/85 transition hover:text-amber-100`,children:e.missionName}),e.repository&&(0,O.jsx)(`span`,{className:`mono shrink-0 rounded bg-white/[0.045] px-1.5 py-0.5 text-[9px] text-white/35`,title:e.repository,children:tt(e.repository)}),(0,O.jsx)(`span`,{className:`min-w-0 flex-1 basis-40 truncate text-xs text-white/50`,title:e.summary,children:e.summary}),(0,O.jsxs)(`span`,{className:`ml-auto flex shrink-0 flex-wrap justify-end gap-1.5`,children:[e.decision?.choices.slice(0,3).map(t=>(0,O.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>C(e.id,()=>oe(e.missionId,e.decision.id,t)),className:At,children:t},t)),e.kind===`acceptance`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>C(e.id,()=>G(e.missionId,`completed`),{label:`Undo acceptance`,run:()=>G(e.missionId,`ready_for_review`)}),className:At,children:[`Accept `,(0,O.jsx)(`kbd`,{className:`mono ml-1 text-[9px]`,children:`a`})]}),(0,O.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>h(e.id),className:jt,children:[`Request changes `,(0,O.jsx)(`kbd`,{className:`mono ml-1 text-[9px]`,children:`d`})]})]}),e.unresolvedGates?.slice(0,1).map(t=>(0,O.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>{let n=window.prompt(`Reason for waiving “${t.label}”`);n?.trim()&&C(e.id,()=>fe(e.missionId,t.id,n.trim()))},className:jt,children:`Waive gate…`},t.id)),e.kind===`plan_approval`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>C(e.id,()=>q(e.missionId,`approved`)),className:At,children:[`Approve plan `,(0,O.jsx)(`kbd`,{className:`mono ml-1 text-[9px]`,children:`a`})]}),(0,O.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>h(e.id),className:jt,children:[`Reject `,(0,O.jsx)(`kbd`,{className:`mono ml-1 text-[9px]`,children:`d`})]})]}),(e.kind===`failure`||e.kind===`stale`||e.kind===`stall`)&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>C(e.id,()=>de(e.missionId,`status_summary`)),className:At,children:`Diagnose`}),(0,O.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>C(e.id,()=>de(e.missionId,`test_pass`)),className:jt,children:`Retry verification`}),e.lifecycle===`active`&&(0,O.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>C(e.id,()=>G(e.missionId,`paused`)),className:jt,children:`Pause`})]})]})]}),e.decision&&(0,O.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 pl-1`,children:[e.decision.recommendation&&(0,O.jsxs)(`span`,{className:`rounded bg-emerald-300/[0.05] px-2 py-1 text-[10px] text-emerald-100/55`,children:[(0,O.jsx)(`span`,{className:`font-medium`,children:`Recommended:`}),` `,e.decision.recommendation]}),(0,O.jsx)(`input`,{value:f[e.id]??``,onChange:t=>p(n=>({...n,[e.id]:t.target.value})),onKeyDown:t=>{if(t.key!==`Enter`)return;let n=(f[e.id]??``).trim();n&&C(e.id,()=>oe(e.missionId,e.decision.id,n))},placeholder:`Or write an answer and press Enter…`,className:`min-w-40 flex-1 rounded-md border border-white/10 bg-black/20 px-2.5 py-1.5 text-[11px] text-white/70 outline-none placeholder:text-white/20 focus:border-rose-300/30`})]}),m===e.id&&(e.kind===`acceptance`||e.kind===`plan_approval`)&&(0,O.jsxs)(`div`,{className:`mt-2 flex gap-2 pl-1`,children:[(0,O.jsx)(`input`,{autoFocus:!0,value:f[e.id]??``,onChange:t=>p(n=>({...n,[e.id]:t.target.value})),onKeyDown:t=>{t.key===`Enter`&&w(e),t.key===`Escape`&&h(null)},placeholder:e.kind===`plan_approval`?`What should change in the plan?`:`What should change before acceptance?`,className:`min-w-40 flex-1 rounded-md border border-rose-300/20 bg-black/20 px-2.5 py-1.5 text-[11px] text-white/70 outline-none placeholder:text-white/20 focus:border-rose-300/40`}),(0,O.jsx)(`button`,{type:`button`,disabled:a||!(f[e.id]??``).trim(),onClick:()=>w(e),className:jt,children:`Send request`})]}),(e.context||e.impact||e.evidence?.length)&&(0,O.jsxs)(`div`,{className:`mt-2 grid gap-1.5 border-t border-white/[0.05] pt-2 text-[10px] leading-relaxed text-white/38 sm:grid-cols-2`,children:[e.context&&(0,O.jsxs)(`p`,{children:[(0,O.jsx)(`span`,{className:`text-white/22`,children:`Context · `}),e.context]}),e.impact&&(0,O.jsxs)(`p`,{children:[(0,O.jsx)(`span`,{className:`text-white/22`,children:`Impact of waiting · `}),e.impact]}),e.evidence?.length?(0,O.jsxs)(`details`,{className:`sm:col-span-2`,children:[(0,O.jsxs)(`summary`,{className:`cursor-pointer text-white/30`,children:[`Evidence and recovery (`,e.evidence.length,`)`]}),(0,O.jsx)(`ul`,{className:`mt-1 space-y-0.5 border-l border-white/8 pl-2`,children:e.evidence.map((e,t)=>(0,O.jsx)(`li`,{children:e},t))})]}):null]}),a&&(0,O.jsx)(`p`,{className:`mt-1.5 pl-1 text-[10px] text-white/30`,children:`Sending…`}),o&&(0,O.jsx)(`p`,{className:`mt-1.5 pl-1 text-[10px] text-rose-400`,children:o})]},e.id)})})]})]})}function J({pid:e,status:t,force:n=!1,label:r=`Stop`}){let[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(!1);if(e<0||t===`done`||t===`offline`)return null;async function f(){if(!i){a(!0),setTimeout(()=>a(!1),3e3);return}s(!0),l(null);let t=n||u;try{await je(e,t),a(!1)}catch(e){l(e.message),a(!1),t||d(!0)}finally{s(!1)}}let p=u&&!n?`Force stop`:r;return(0,O.jsxs)(`span`,{className:`relative inline-flex`,children:[(0,O.jsx)(`button`,{disabled:o,onClick:f,title:n||u?`Force stops this local Claude process after confirmation`:`Gracefully stops the Claude job while preserving its conversation`,className:`rounded-lg border px-3 py-1.5 text-xs font-medium transition disabled:opacity-40 ${i||u?`border-rose-500/40 bg-rose-500/10 text-rose-300`:`border-white/10 text-white/40 hover:bg-white/5 hover:text-white/70`}`,children:o?`Stopping…`:i?`Confirm ${p.toLowerCase()}`:p}),c&&(0,O.jsxs)(`span`,{className:`absolute right-0 top-full z-20 mt-1 whitespace-nowrap rounded bg-[#18181d] px-2 py-1 text-[10px] text-rose-400 shadow-xl`,children:[c,u&&!n?` · Force stop is now available.`:``]})]})}var Pt=[`investigation`,`implementation`,`testing`,`review`,`browser_qa`,`documentation`,`custom`],Ft=[`test`,`typecheck`,`lint`,`ci`,`review`,`pr`,`screenshot`,`documentation`,`user_approval`,`custom`],It=[`commits`,`pushes`,`pullRequests`,`releases`,`destructiveActions`,`network`],Lt=e=>e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,63);function Rt(e){return{id:`new-template`,name:`New template`,description:`Describe when this workflow should be used.`,version:1,source:e,mode:`orchestrated`,worktree:!0,managerInstructions:`Delegate independent work, report evidence, and stop for approval before external or destructive actions.`,stages:[{id:`stage-1`,title:`Investigation`,role:`investigation`}],gates:[{id:`gate-review`,label:`Review complete`,type:`review`,status:`pending`,required:!0,evidence:[]}],budgets:{maxWorkers:8,maxConcurrentWorkers:4},permissions:{commits:!0,pushes:!1,pullRequests:!1,releases:!1,destructiveActions:!1,network:!0}}}function zt({initial:e,cwd:t,onCancel:n,onSaved:r}){let i=!!e,[a,o]=(0,g.useState)(()=>e?structuredClone(e):Rt(`user`)),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(null),d=(0,g.useMemo)(()=>{let e=[];return a.id.match(/^[a-z0-9][a-z0-9-]{1,62}$/)||e.push(`Use a 2–63 character lowercase template ID.`),(!a.name.trim()||!a.description.trim()||!a.managerInstructions.trim())&&e.push(`Name, description, and manager instructions are required.`),a.stages.length||e.push(`Add at least one mission stage.`),new Set(a.stages.map(e=>e.id)).size!==a.stages.length&&e.push(`Stage IDs must be unique.`),e},[a]),f=`w-full rounded-lg border border-white/10 bg-black/20 px-3 py-2 text-xs text-white/65 outline-none focus:border-amber-300/20`;async function p(){if(!(d.length||s)){c(!0),u(null);try{r((i?await ie(a,t):await V(a,a.source,t)).template)}catch(e){u(e.message)}finally{c(!1)}}}return(0,O.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto p-6`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.16em] text-amber-300/55`,children:i?`Edit workflow`:`Create workflow`}),(0,O.jsx)(`h2`,{className:`mt-1 text-xl font-semibold text-white`,children:a.name||`Untitled template`})]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`button`,{onClick:n,className:`rounded-lg px-3 py-2 text-xs text-white/40 hover:text-white/70`,children:`Cancel`}),(0,O.jsx)(`button`,{onClick:()=>void p(),disabled:s||d.length>0||a.source===`repository`&&!t,className:`rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-[#291a04] hover:bg-amber-200 disabled:opacity-35`,children:s?`Saving…`:i?`Save template`:`Create template`})]})]}),(l||d.length>0)&&(0,O.jsx)(`div`,{className:`mt-4 rounded-lg border border-rose-300/10 bg-rose-300/[0.035] px-3 py-2 text-xs text-rose-200/60`,children:l??d.join(` `)}),(0,O.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,O.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Name`,(0,O.jsx)(`input`,{className:f,value:a.name,onChange:e=>o({...a,name:e.target.value,...!i&&a.id===`new-template`?{id:Lt(e.target.value)}:{}})})]}),(0,O.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Template ID`,(0,O.jsx)(`input`,{disabled:i,className:`${f} font-mono disabled:opacity-40`,value:a.id,onChange:e=>o({...a,id:Lt(e.target.value)})})]}),(0,O.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Version`,(0,O.jsx)(`input`,{type:`number`,min:`1`,className:f,value:a.version,onChange:e=>o({...a,version:Math.max(1,Number(e.target.value))})})]}),(0,O.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Ownership`,(0,O.jsxs)(`select`,{disabled:i,className:`${f} disabled:opacity-40`,value:a.source,onChange:e=>o({...a,source:e.target.value}),children:[(0,O.jsx)(`option`,{value:`user`,children:`My templates`}),(0,O.jsx)(`option`,{value:`repository`,children:`This repository`})]})]})]}),a.source===`repository`&&(0,O.jsxs)(`p`,{className:`mt-2 text-[10px] text-violet-200/40`,children:[`Repository scope: `,t||`Select a repository in the library first.`]}),(0,O.jsxs)(`label`,{className:`mt-4 block text-[10px] text-white/35`,children:[`Purpose`,(0,O.jsx)(`textarea`,{rows:2,className:f,value:a.description,onChange:e=>o({...a,description:e.target.value})})]}),(0,O.jsxs)(`label`,{className:`mt-3 block text-[10px] text-white/35`,children:[`Manager instructions`,(0,O.jsx)(`textarea`,{rows:4,className:f,value:a.managerInstructions,onChange:e=>o({...a,managerInstructions:e.target.value})})]}),(0,O.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,O.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Execution mode`,(0,O.jsxs)(`select`,{className:f,value:a.mode,onChange:e=>o({...a,mode:e.target.value}),children:[(0,O.jsx)(`option`,{value:`orchestrated`,children:`Orchestrated`}),(0,O.jsx)(`option`,{value:`direct`,children:`Direct`})]})]}),(0,O.jsxs)(`label`,{className:`flex items-end gap-2 pb-2 text-xs text-white/50`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:a.worktree,onChange:e=>o({...a,worktree:e.target.checked})}),`Create a worktree`]})]}),(0,O.jsxs)(`section`,{className:`mt-5 rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Mission stages`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/25`,children:`Stages become the initial phased plan; dependencies control which may start in parallel.`})]}),(0,O.jsx)(`button`,{onClick:()=>o({...a,stages:[...a.stages,{id:`stage-${a.stages.length+1}`,title:`New stage`,role:`implementation`,dependsOn:a.stages.length?[a.stages.at(-1).id]:[]}]}),className:`rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-white/40 hover:bg-white/5`,children:`+ Stage`})]}),(0,O.jsx)(`div`,{className:`mt-3 space-y-2`,children:a.stages.map((e,t)=>(0,O.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_1fr_34px] gap-2`,children:[(0,O.jsx)(`input`,{"aria-label":`Stage title`,className:f,value:e.title,onChange:n=>{let r=[...a.stages],s=e.id,c=i?e.id:Lt(n.target.value)||`stage-${t+1}`;if(r[t]={...e,title:n.target.value,id:c},c!==s)for(let e=0;e<r.length;e++)r[e]={...r[e],dependsOn:r[e].dependsOn?.map(e=>e===s?c:e)};o({...a,stages:r})}}),(0,O.jsx)(`select`,{"aria-label":`Worker role`,className:f,value:e.role,onChange:n=>{let r=[...a.stages];r[t]={...e,role:n.target.value},o({...a,stages:r})},children:Pt.map(e=>(0,O.jsx)(`option`,{value:e,children:e.replaceAll(`_`,` `)},e))}),(0,O.jsxs)(`select`,{"aria-label":`Stage dependency`,className:f,value:e.dependsOn?.[0]??``,onChange:n=>{let r=[...a.stages];r[t]={...e,dependsOn:n.target.value?[n.target.value]:[]},o({...a,stages:r})},children:[(0,O.jsx)(`option`,{value:``,children:`No dependency`}),a.stages.filter(t=>t.id!==e.id).map(e=>(0,O.jsxs)(`option`,{value:e.id,children:[`After `,e.title]},e.id))]}),(0,O.jsx)(`button`,{"aria-label":`Remove stage`,onClick:()=>{let n=e.id;o({...a,stages:a.stages.filter((e,n)=>n!==t).map(e=>({...e,dependsOn:e.dependsOn?.filter(e=>e!==n)}))})},className:`rounded-lg border border-white/8 text-white/25 hover:bg-rose-300/[0.05] hover:text-rose-200`,children:`×`})]},t))})]}),(0,O.jsxs)(`section`,{className:`mt-4 rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Completion gates`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/25`,children:`Required evidence before the mission can appear complete.`})]}),(0,O.jsx)(`button`,{onClick:()=>o({...a,gates:[...a.gates,{id:`gate-${a.gates.length+1}`,label:`New gate`,type:`custom`,status:`pending`,required:!0,evidence:[]}]}),className:`rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-white/40 hover:bg-white/5`,children:`+ Gate`})]}),(0,O.jsx)(`div`,{className:`mt-3 space-y-2`,children:a.gates.map((e,t)=>(0,O.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_auto_34px] gap-2`,children:[(0,O.jsx)(`input`,{"aria-label":`Gate label`,className:f,value:e.label,onChange:n=>{let r=[...a.gates];r[t]={...e,label:n.target.value,id:i?e.id:`gate-${Lt(n.target.value)||t+1}`},o({...a,gates:r})}}),(0,O.jsx)(`select`,{"aria-label":`Gate type`,className:f,value:e.type,onChange:n=>{let r=[...a.gates];r[t]={...e,type:n.target.value},o({...a,gates:r})},children:Ft.map(e=>(0,O.jsx)(`option`,{value:e,children:e.replaceAll(`_`,` `)},e))}),(0,O.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px] text-white/35`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:e.required,onChange:n=>{let r=[...a.gates];r[t]={...e,required:n.target.checked},o({...a,gates:r})}}),`Required`]}),(0,O.jsx)(`button`,{"aria-label":`Remove gate`,onClick:()=>o({...a,gates:a.gates.filter((e,n)=>n!==t)}),className:`rounded-lg border border-white/8 text-white/25 hover:bg-rose-300/[0.05] hover:text-rose-200`,children:`×`})]},t))})]}),(0,O.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Budgets`}),(0,O.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:[`maxWorkers`,`maxConcurrentWorkers`,`maxTokens`,`maxElapsedMinutes`].map(e=>(0,O.jsxs)(`label`,{className:`text-[9px] text-white/30`,children:[e.replace(/([A-Z])/g,` $1`),(0,O.jsx)(`input`,{type:`number`,min:`1`,className:f,value:a.budgets?.[e]??``,onChange:t=>o({...a,budgets:{...a.budgets,[e]:t.target.value?Number(t.target.value):void 0}})})]},e))})]}),(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Permissions`}),(0,O.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:It.map(e=>(0,O.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-white/[0.06] px-2 py-2 text-[10px] text-white/40`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:a.permissions[e],onChange:t=>o({...a,permissions:{...a.permissions,[e]:t.target.checked}})}),`Allow `,e.replace(/([A-Z])/g,` $1`)]},e))})]})]}),(0,O.jsxs)(`section`,{className:`mt-4 rounded-xl border border-violet-300/10 bg-violet-300/[0.025] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-violet-200/45`,children:`Live mission preview`}),(0,O.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-white/50`,children:a.managerInstructions||`Manager instructions will appear here.`}),(0,O.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:a.stages.map((e,t)=>(0,O.jsxs)(`span`,{className:`text-[10px] text-white/40`,children:[(0,O.jsxs)(`span`,{className:`rounded bg-white/[0.05] px-2 py-1`,children:[e.title||`Untitled stage`,e.dependsOn?.length?` · after ${e.dependsOn.join(`, `)}`:` · parallel-ready`]}),t<a.stages.length-1&&(0,O.jsx)(`span`,{className:`ml-2 text-white/15`,children:`→`})]},`${e.id}:${t}`))}),(0,O.jsxs)(`p`,{className:`mt-3 text-[10px] text-white/25`,children:[`Completion requires: `,a.gates.filter(e=>e.required).map(e=>e.label).join(`, `)||`no required gates`,`.`]})]})]})}function Bt(e){return e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}function Vt({template:e,repository:t,onDuplicate:n,onEdit:r,onDelete:i}){return(0,O.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto p-6`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:e.name}),(0,O.jsx)(`span`,{className:`rounded-full border border-white/10 px-2 py-0.5 text-[9px] uppercase text-white/35`,children:e.source}),(0,O.jsxs)(`span`,{className:`text-[10px] text-white/25`,children:[`v`,e.version]})]}),(0,O.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm leading-relaxed text-white/50`,children:e.description}),(0,O.jsxs)(`p`,{className:`mt-2 text-[10px] text-white/25`,children:[e.source===`built-in`?`Built into Hive · read-only`:e.source===`user`?`Owned by you · available across repositories`:`Owned by repository · ${t??`current repository`}`,`. Repository templates override personal templates with the same ID; personal templates override built-ins. Existing missions retain their original version.`]})]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[e.source!==`built-in`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`button`,{onClick:r,className:`rounded-lg border border-white/10 px-3 py-2 text-xs text-white/45 transition hover:bg-white/5 hover:text-white/70`,children:`Edit`}),(0,O.jsx)(`button`,{onClick:i,className:`rounded-lg border border-rose-300/10 px-3 py-2 text-xs text-rose-200/40 transition hover:bg-rose-300/[0.05] hover:text-rose-200/65`,children:`Delete`})]}),(0,O.jsx)(`button`,{onClick:n,className:`rounded-lg border border-amber-300/15 bg-amber-300/[0.05] px-3 py-2 text-xs text-amber-200/65 transition hover:border-amber-300/30 hover:bg-amber-300/[0.09]`,children:`Duplicate template`})]})]}),(0,O.jsxs)(`div`,{className:`mt-6 grid gap-4 lg:grid-cols-2`,children:[(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Manager instructions`}),(0,O.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap text-xs leading-relaxed text-white/55`,children:e.managerInstructions})]}),(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Launch configuration`}),(0,O.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[110px_1fr] gap-y-2 text-xs`,children:[(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Mode`}),(0,O.jsx)(`dd`,{className:`capitalize text-white/55`,children:e.mode}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Worktree`}),(0,O.jsx)(`dd`,{className:`text-white/55`,children:e.worktree?`Create isolated worktree`:`Use working directory`}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Source`}),(0,O.jsx)(`dd`,{className:`capitalize text-white/55`,children:e.source}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Template ID`}),(0,O.jsx)(`dd`,{className:`font-mono text-white/45`,children:e.id})]})]})]}),(0,O.jsxs)(`section`,{className:`mt-4 rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Mission stages`}),(0,O.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:e.stages.map((t,n)=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(`div`,{className:`rounded-lg border border-violet-300/10 bg-violet-300/[0.035] px-3 py-2`,children:[(0,O.jsx)(`p`,{className:`text-xs font-medium text-white/65`,children:t.title}),(0,O.jsx)(`p`,{className:`mt-0.5 text-[9px] uppercase text-violet-300/45`,children:Bt(t.role)})]}),n<e.stages.length-1&&(0,O.jsx)(`span`,{className:`text-white/15`,children:`→`})]},t.id))})]}),(0,O.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Completion gates`}),(0,O.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.gates.length?e.gates.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-white/[0.06] px-3 py-2`,children:[(0,O.jsx)(`span`,{className:`text-xs text-white/55`,children:e.label}),(0,O.jsxs)(`span`,{className:`text-[9px] uppercase text-white/25`,children:[Bt(e.type),e.required?` · required`:``]})]},e.id)):(0,O.jsx)(`p`,{className:`text-xs text-white/25`,children:`No completion gates.`})})]}),(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Budgets and permissions`}),(0,O.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:Object.entries(e.budgets??{}).map(([e,t])=>(0,O.jsxs)(`span`,{className:`rounded bg-white/[0.04] px-2 py-1 text-[10px] text-white/40`,children:[Bt(e),`: `,t?.toLocaleString()]},e))}),(0,O.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:Object.entries(e.permissions).map(([e,t])=>(0,O.jsxs)(`div`,{className:`rounded-lg border px-2.5 py-2 text-[10px] ${t?`border-emerald-300/10 bg-emerald-300/[0.035] text-emerald-200/50`:`border-amber-300/10 bg-amber-300/[0.025] text-amber-200/45`}`,children:[t?`✓ Allowed`:`Approval required`,` · `,Bt(e)]},e))})]})]})]})}function Ht({repositories:e,onClose:t}){let n=Le(t),[r,i]=(0,g.useState)(e[0]??``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(!0),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(`user`),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)([]),k=(0,g.useMemo)(()=>a.find(e=>e.id===s)??a[0],[a,s]);async function A(){u(!0),f(null);try{let e=await re(r||void 0);o(e.templates),D(e.diagnostics??[]),c(t=>e.templates.some(e=>e.id===t)?t:e.templates[0]?.id??``)}catch(e){f(e.message),D([])}finally{u(!1)}}(0,g.useEffect)(()=>{A()},[r]),Ke(!0,ze.modal,t);function j(){k&&(_(`${k.name} copy`),y(`${k.id}-copy`),m(!0),f(null))}async function M(){if(!(!k||!h.trim()||!v.trim())){C(!0),f(null);try{let e={...k,id:v.trim().toLowerCase().replace(/[^a-z0-9-]+/g,`-`),name:h.trim(),version:1,source:b};await V(e,b,r||void 0),m(!1),await A(),c(e.id)}catch(e){f(e.message)}finally{C(!1)}}}async function N(){if(!(!k||k.source===`built-in`||!window.confirm(`Delete ${k.name}? Existing missions will keep their retained template configuration, but this template will no longer be available for new missions.`))){f(null);try{await ae(k,r||void 0),c(``),await A()}catch(e){f(e.message)}}}return(0,O.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,...n,children:(0,O.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Template library`,onMouseDown:e=>e.stopPropagation(),className:`flex h-[min(820px,92vh)] w-full max-w-6xl flex-col overflow-hidden rounded-2xl border border-white/10 bg-[#0e0e12] shadow-2xl`,children:[(0,O.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-white/8 px-5 py-4`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.18em] text-amber-300/55`,children:`Hive workflows`}),(0,O.jsx)(`h1`,{className:`mt-0.5 text-lg font-semibold text-white`,children:`Template library`})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.length>0&&(0,O.jsxs)(`select`,{value:r,onChange:e=>{i(e.target.value),T(null)},className:`max-w-64 rounded-lg border border-white/10 bg-[#17171c] px-3 py-2 text-xs text-white/50`,children:[(0,O.jsx)(`option`,{value:``,children:`Current Hive repository`}),e.map(e=>(0,O.jsxs)(`option`,{value:e,children:[e.split(`/`).at(-1),` · `,e]},e))]}),(0,O.jsx)(`button`,{onClick:()=>{T(`new`),m(!1)},className:`rounded-lg border border-amber-300/15 bg-amber-300/[0.05] px-3 py-2 text-xs text-amber-200/60 hover:bg-amber-300/[0.09]`,children:`+ New template`}),(0,O.jsx)(`button`,{onClick:t,"aria-label":`Close template library`,className:`rounded-lg border border-white/10 px-2.5 py-1.5 text-white/40 hover:bg-white/5 hover:text-white`,children:`×`})]})]}),d&&(0,O.jsxs)(`div`,{className:`border-b border-rose-300/10 bg-rose-300/[0.04] px-5 py-2.5 text-xs text-rose-200/65`,children:[d,` `,(0,O.jsx)(`button`,{onClick:()=>void A(),className:`ml-2 underline hover:text-white`,children:`Retry`})]}),E.length>0&&(0,O.jsxs)(`details`,{className:`border-b border-amber-300/10 bg-amber-300/[0.035] px-5 py-2.5 text-xs text-amber-100/55`,children:[(0,O.jsxs)(`summary`,{className:`cursor-pointer`,children:[E.length,` malformed template file`,E.length===1?` was`:`s were`,` skipped · View recovery details`]}),(0,O.jsx)(`div`,{className:`mt-2 space-y-1`,children:E.map(e=>(0,O.jsxs)(`p`,{children:[(0,O.jsx)(`span`,{className:`font-mono text-amber-200/45`,children:e.file}),` — `,e.error,`. Fix or remove this JSON file, then reload.`]},e.file))})]}),(0,O.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,O.jsx)(`aside`,{className:`w-64 shrink-0 overflow-y-auto border-r border-white/8 p-3`,children:l?(0,O.jsx)(`p`,{className:`p-3 text-xs text-white/25`,children:`Loading templates…`}):a.length?a.map(e=>(0,O.jsxs)(`button`,{onClick:()=>{c(e.id),m(!1),T(null)},className:`mb-1 w-full rounded-lg border px-3 py-2.5 text-left transition ${k?.id===e.id&&!w?`border-amber-300/15 bg-amber-300/[0.06]`:`border-transparent hover:border-white/8 hover:bg-white/[0.03]`}`,children:[(0,O.jsx)(`p`,{className:`truncate text-xs font-medium text-white/65`,children:e.name}),(0,O.jsxs)(`p`,{className:`mt-1 text-[9px] uppercase tracking-wide text-white/25`,children:[e.source,` · v`,e.version]})]},`${e.source}:${e.id}`)):(0,O.jsx)(`p`,{className:`rounded-lg border border-dashed border-white/8 p-4 text-center text-xs text-white/25`,children:`No templates found for this repository.`})}),w?(0,O.jsx)(zt,{initial:w===`edit`?k:void 0,cwd:r||void 0,onCancel:()=>T(null),onSaved:e=>{T(null),A().then(()=>c(e.id))}}):k?(0,O.jsx)(Vt,{template:k,repository:r||void 0,onDuplicate:j,onEdit:()=>T(`edit`),onDelete:()=>void N()}):!l&&(0,O.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-white/25`,children:`Choose a repository or create its first template.`})]}),p&&k&&(0,O.jsxs)(`div`,{className:`border-t border-white/8 bg-[#121217] p-4`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,O.jsxs)(`label`,{className:`min-w-48 flex-1 text-[10px] text-white/35`,children:[`Template name`,(0,O.jsx)(`input`,{value:h,onChange:e=>_(e.target.value),className:`mt-1 w-full rounded-lg border border-white/10 bg-black/20 px-3 py-2 text-xs text-white/65 outline-none focus:border-amber-300/20`})]}),(0,O.jsxs)(`label`,{className:`min-w-40 flex-1 text-[10px] text-white/35`,children:[`Template ID`,(0,O.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),className:`mt-1 w-full rounded-lg border border-white/10 bg-black/20 px-3 py-2 font-mono text-xs text-white/65 outline-none focus:border-amber-300/20`})]}),(0,O.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Save to`,(0,O.jsxs)(`select`,{value:b,onChange:e=>x(e.target.value),className:`mt-1 block rounded-lg border border-white/10 bg-[#17171c] px-3 py-2 text-xs text-white/55`,children:[(0,O.jsx)(`option`,{value:`user`,children:`My templates`}),(0,O.jsx)(`option`,{value:`repository`,children:`This repository`})]})]}),(0,O.jsx)(`button`,{onClick:()=>m(!1),className:`rounded-lg px-3 py-2 text-xs text-white/35 hover:text-white/65`,children:`Cancel`}),(0,O.jsx)(`button`,{onClick:()=>void M(),disabled:S||!h.trim()||!v.trim()||b===`repository`&&!r,className:`rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-[#2a1a04] hover:bg-amber-200 disabled:opacity-35`,children:S?`Saving…`:`Create copy`})]}),b===`repository`&&!r&&(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-amber-200/45`,children:`Select a repository before saving a repository template.`})]})]})})}function Ut({onClose:e}){let t=Le(e),[n,r]=(0,g.useState)(),[i,a]=(0,g.useState)(),[o,s]=(0,g.useState)(!1);(0,g.useEffect)(()=>{De().then(({policy:e})=>r(e)).catch(e=>a(e.message))},[]),Ke(!0,ze.modal,e);async function c(){if(n){s(!0);try{await Oe(n),e()}catch(e){a(e.message)}finally{s(!1)}}}return(0,O.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/65 p-4`,...t,children:(0,O.jsxs)(`div`,{className:`w-full max-w-xl rounded-2xl border border-white/10 bg-[#101014] p-5`,onClick:e=>e.stopPropagation(),children:[(0,O.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Workspace policy`}),(0,O.jsx)(`p`,{className:`mt-1 text-[10px] text-white/30`,children:`Defaults copied into every new mission. Mission overrides remain durable.`})]}),(0,O.jsx)(`button`,{onClick:e,className:`px-2 text-white/40`,children:`×`})]}),n&&(0,O.jsx)(Re,{value:n,onChange:r}),i&&(0,O.jsx)(`p`,{className:`mt-3 text-xs text-rose-300`,children:i}),(0,O.jsx)(`p`,{className:`mt-3 text-[10px] text-amber-100/35`,children:`Disabled tools and actions are passed to Claude CLI as hard restrictions where supported. The manager requests your approval before a policy boundary is expanded.`}),(0,O.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{onClick:e,className:`px-3 py-2 text-xs text-white/40`,children:`Cancel`}),(0,O.jsx)(`button`,{disabled:!n||o,onClick:()=>void c(),className:`rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-black disabled:opacity-40`,children:o?`Saving…`:`Save defaults`})]})]})})}var Wt={queued:`Queued`,working:`In progress`,blocked:`Blocked`,reviewing:`Reviewing`,completed:`Complete`,failed:`Failed`,cancelled:`Cancelled`};function Gt(e){return Wt[e]??e}function Kt(e){return e.flatMap(e=>[e,...Kt(e.subtasks??[])])}function qt(e){return e.flatMap(e=>e.subtasks?.length?qt(e.subtasks):[e])}function Jt(e){return e?.phases.flatMap(e=>Kt(e.tasks))??[]}var Yt={query:``,queryScope:`name`,status:`all`,repository:`all`,template:`all`,date:`all`,needsMe:!1},Xt={waiting_on_you:0,error:1,working:2,stalled:3,idle:4,offline:5,done:6};function Zt(e){return[e.name,e.mission.repository,e.mission.repository?tt(e.mission.repository):void 0,e.worktreeBranch].filter(Boolean).join(` `).toLowerCase()}function Qt(e,t){let n=Jt(e.plan),r=t.decisions.filter(t=>t.missionId===e.missionId);return[e.name,e.mission.provider,e.mission.model,e.mission.objective,e.mission.compactSummary,e.mission.currentState,e.mission.repository,e.mission.template?.name,...e.messages.map(e=>e.text),...e.workers.flatMap(e=>[e.id,e.label]),...n.flatMap(e=>[e.title,e.description,e.assignment,e.context,e.owner,e.workerId,e.branch,e.worktree,...e.changedFiles??[],...e.evidence]),...e.recentEvents.flatMap(e=>[e.detail,e.filePath,e.command,e.artifactPath,e.targetWorker,e.targetTask]),...e.alerts.flatMap(e=>[e.title,e.explanation,e.evidence]),...e.prs.flatMap(e=>[e.id,e.href,e.kind]),...r.flatMap(e=>[e.question,e.context,e.answer,e.recommendation])].filter(Boolean).join(` `).toLowerCase()}function $t(e,t){return e===`24h`?t-864e5:e===`7d`?t-6048e5:e===`30d`?t-2592e6:0}function en(e,t){return t.has(e.missionId)||e.lifecycleStatus===`ready_for_review`||e.lifecycleStatus===`failed`||e.activityStatus===`waiting_on_you`||e.activityStatus===`error`||e.activityStatus===`stalled`||ct(e)}function tn(e,t){return t.has(e.missionId)||e.lifecycleStatus===`failed`||e.activityStatus===`waiting_on_you`||e.activityStatus===`error`||e.activityStatus===`stalled`||ct(e)}function nn(e){return e===`recent`?(e,t)=>t.updatedAt-e.updatedAt:e===`longest`?(e,t)=>e.runStartedAt-t.runStartedAt:e===`workers`?(e,t)=>t.workers.length-e.workers.length||t.updatedAt-e.updatedAt:e===`repository`?(e,t)=>(e.mission.repository?tt(e.mission.repository):``).localeCompare(t.mission.repository?tt(t.mission.repository):``)||t.updatedAt-e.updatedAt:(e,t)=>Xt[e.activityStatus]-Xt[t.activityStatus]||t.updatedAt-e.updatedAt}function rn(e,t,n=Date.now(),r=`attention`){let i=[...new Set(e.orchestrators.map(e=>e.mission.repository).filter(e=>!!e).map(et))].sort(),a=[...new Map(e.orchestrators.flatMap(e=>e.mission.template?[[e.mission.template.id,e.mission.template.name]]:[])).entries()],o=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean),s=$t(t.date,n),c=new Set((e.decisions??[]).map(e=>e.missionId)),l=e.orchestrators.filter(n=>{if(o.length){let r=t.queryScope===`all`?Qt(n,e):Zt(n);if(!o.every(e=>r.includes(e)))return!1}return t.needsMe&&!en(n,c)||t.status!==`all`&&n.lifecycleStatus!==t.status&&n.activityStatus!==t.status||t.repository!==`all`&&(!n.mission.repository||et(n.mission.repository)!==t.repository)||t.template!==`all`&&n.mission.template?.id!==t.template?!1:!s||n.updatedAt>=s}),u=nn(r),d=l.filter(e=>e.lifecycleStatus===`active`||e.lifecycleStatus===`failed`).sort(u),f=l.filter(e=>e.lifecycleStatus===`ready_for_review`).sort(u);return{filtered:l,sections:{review:f,operational:d,paused:l.filter(e=>e.lifecycleStatus===`paused`).sort(u),completed:l.filter(e=>e.lifecycleStatus===`completed`).sort(u),archived:l.filter(e=>e.lifecycleStatus===`archived`).sort(u)},repositories:i,templates:a,operationalCount:d.length+f.length,needsMeCount:e.orchestrators.filter(e=>en(e,c)).length}}function an(e){let t=new Set((e.decisions??[]).map(e=>e.missionId)),n=e.orchestrators.filter(e=>e.lifecycleStatus!==`archived`),r=n.filter(e=>en(e,t)),i=new Set(r.map(e=>e.missionId)),a=n.filter(e=>!i.has(e.missionId)),o=a.filter(e=>e.activityStatus===`working`),s=a.filter(e=>e.lifecycleStatus===`completed`),c=new Set(s.map(e=>e.missionId)),l=a.filter(e=>e.activityStatus!==`working`&&!c.has(e.missionId));return[{key:`needsMe`,count:r.length,label:`needs you`,filter:{needsMe:!0,status:`all`}},{key:`working`,count:o.length,label:`working`,filter:{needsMe:!1,status:`working`}},{key:`idle`,count:l.length,label:`idle`,filter:{needsMe:!1,status:`idle`}},{key:`done`,count:s.length,label:`done`,filter:{needsMe:!1,status:`completed`}}].filter(e=>e.count>0)}var on={"24h":`last 24 hours`,"7d":`last 7 days`,"30d":`last 30 days`};function sn(e,t,n){let r=n=>()=>t({...e,[n]:Yt[n]}),i=[];if(e.query.trim()&&i.push({key:`query`,label:`“${e.query.trim()}”${e.queryScope===`all`?` everywhere`:``}`,clear:()=>t({...e,query:``,queryScope:`name`})}),e.needsMe&&i.push({key:`needsMe`,label:`needs me`,clear:r(`needsMe`)}),e.status!==`all`&&i.push({key:`status`,label:e.status===`ready_for_review`?`awaiting acceptance`:e.status.replaceAll(`_`,` `),clear:r(`status`)}),e.repository!==`all`&&i.push({key:`repository`,label:tt(e.repository),clear:r(`repository`)}),e.template!==`all`){let t=n.find(([t])=>t===e.template)?.[1]??e.template;i.push({key:`template`,label:t,clear:r(`template`)})}return e.date!==`all`&&i.push({key:`date`,label:on[e.date]??e.date,clear:r(`date`)}),i}function cn({value:e,onChange:t,templates:n,shown:r,total:i}){let a=sn(e,t,n);return a.length?(0,O.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-1.5`,children:[(0,O.jsxs)(`span`,{className:`text-[10px] text-white/25`,children:[`Showing `,r,` of `,i]}),a.map(e=>(0,O.jsxs)(`button`,{type:`button`,onClick:e.clear,title:`Remove this filter`,className:`group flex items-center gap-1.5 rounded-md border border-amber-200/20 bg-amber-200/[0.06] px-2 py-0.5 text-[11px] text-amber-100/75 transition hover:border-amber-200/40 hover:bg-amber-200/[0.11]`,children:[(0,O.jsx)(`span`,{className:`max-w-48 truncate`,children:e.label}),(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`text-white/30 transition group-hover:text-amber-100/80`,children:`✕`})]},e.key)),a.length>1&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>t({...Yt}),className:`px-1 text-[11px] text-white/35 transition hover:text-white/70`,children:`Clear all`})]}):null}var ln=[`active`,`ready_for_review`,`paused`,`completed`,`failed`,`archived`,`working`,`waiting_on_you`,`stalled`,`idle`,`offline`,`done`,`error`],un={attention:`Attention first`,recent:`Recently active`,longest:`Longest running`,workers:`Most workers`,repository:`Repository`};function dn(e){return e===`ready_for_review`?`awaiting acceptance`:e===`error`?`stale`:e.replaceAll(`_`,` `)}function fn({value:e,onChange:t,repositories:n,templates:r,shown:i,total:a,sort:o,onSortChange:s}){let c=(n,r)=>t({...e,[n]:r}),l=`rounded-lg border border-white/10 bg-[#141418] px-2.5 py-2 text-xs text-white/45`;return(0,O.jsxs)(`div`,{className:`mb-6 rounded-xl border border-white/[0.07] bg-white/[0.018] p-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,O.jsx)(`input`,{"data-fleet-search":!0,value:e.query,onChange:n=>t({...e,query:n.target.value,queryScope:`name`}),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.currentTarget.blur())},placeholder:`Filter missions by name or repository… / to focus, esc to leave`,className:`min-w-0 flex-1 rounded-lg border border-white/10 bg-black/15 px-3 py-2 text-xs text-white/70 outline-none placeholder:text-white/20 focus:border-amber-300/25`}),(0,O.jsxs)(`select`,{value:e.status,onChange:e=>c(`status`,e.target.value),className:l,children:[(0,O.jsx)(`option`,{value:`all`,children:`All statuses`}),ln.map(e=>(0,O.jsx)(`option`,{value:e,children:dn(e)},e))]}),(0,O.jsxs)(`select`,{value:e.repository,onChange:e=>c(`repository`,e.target.value),className:`${l} max-w-52`,children:[(0,O.jsx)(`option`,{value:`all`,children:`All repositories`}),n.map(e=>(0,O.jsx)(`option`,{value:e,children:e.split(`/`).at(-1)},e))]}),(0,O.jsxs)(`select`,{value:e.template,onChange:e=>c(`template`,e.target.value),className:l,children:[(0,O.jsx)(`option`,{value:`all`,children:`All templates`}),r.map(([e,t])=>(0,O.jsx)(`option`,{value:e,children:t},e))]}),(0,O.jsxs)(`select`,{value:e.date,onChange:e=>c(`date`,e.target.value),className:l,children:[(0,O.jsx)(`option`,{value:`all`,children:`Any date`}),(0,O.jsx)(`option`,{value:`24h`,children:`Last 24 hours`}),(0,O.jsx)(`option`,{value:`7d`,children:`Last 7 days`}),(0,O.jsx)(`option`,{value:`30d`,children:`Last 30 days`})]}),(0,O.jsx)(`select`,{"aria-label":`Sort missions`,value:o,onChange:e=>s(e.target.value),className:l,children:Object.keys(un).map(e=>(0,O.jsx)(`option`,{value:e,children:un[e]},e))})]}),(0,O.jsx)(cn,{value:e,onChange:t,templates:r,shown:i,total:a})]})}var pn={active:`bg-violet-500/10 text-violet-300 ring-violet-500/25`,ready_for_review:`bg-amber-500/10 text-amber-300 ring-amber-500/30`,paused:`bg-sky-500/10 text-sky-300 ring-sky-500/25`,completed:`bg-emerald-500/10 text-emerald-300 ring-emerald-500/25`,failed:`bg-red-500/10 text-red-300 ring-red-500/25`,archived:`bg-slate-500/10 text-slate-400 ring-slate-500/25`};function mn({status:e}){return(0,O.jsx)(`span`,{className:`inline-flex items-center justify-center whitespace-nowrap rounded-full px-2.5 py-1 text-center text-xs font-medium capitalize ring-1 ${pn[e]}`,children:e===`ready_for_review`?`Awaiting acceptance`:e})}var hn=[{name:`usage`,description:`Show subscription usage limits and what is consuming them`,scope:`account`},{name:`cost`,description:`Show the cost and duration breakdown for Claude usage`,scope:`account`},{name:`context`,description:`Show this mission session's context window usage`,scope:`session`}],gn=[{name:`loop`,description:`Re-send a prompt to this mission on a schedule Hive owns, so it can be listed and stopped`,argumentHint:`[interval] <prompt> · list · stop [id]`,source:`built-in`},{name:`tasks`,description:`Show every loop and background monitor running, here and across the fleet`,source:`built-in`}];function _n(e){return[e.id,e.label,...e.aliases??[],...e.taskIds??[]].map(e=>e?.trim()).filter(e=>!!e)}function vn(e,t){let n=e?.trim().toLowerCase();return n?_n(t).some(e=>e.toLowerCase()===n):!1}var yn=new Set([`idle`,`done`,`offline`]);function bn(e){return e.mission.mode!==`direct`||e.lifecycleStatus!==`active`||!e.turnCompleted||![`idle`,`done`].includes(e.activityStatus)||e.inFlight.tasks>0||e.inFlight.queued>0?!1:e.alerts.every(e=>e.severity!==`critical`)}function xn(e){return e.mission.mode!==`direct`||e.lifecycleStatus!==`active`||!yn.has(e.activityStatus)||e.inFlight.tasks>0||e.inFlight.queued>0||e.workers.some(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`))||e.alerts.length>0?!1:!(e.plan?.gates??[]).some(e=>e.required&&e.status!==`satisfied`&&e.status!==`waived`)}function Sn(e,t=!1){return e.lifecycleStatus!==`ready_for_review`||t||e.activityStatus===`waiting_on_you`||e.activityStatus===`error`||e.activityStatus===`stalled`||e.inFlight.tasks>0||e.inFlight.queued>0||e.workers.some(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`))||e.alerts.length>0?!1:!(e.plan?.gates??[]).some(e=>e.required&&e.status!==`satisfied`&&e.status!==`waived`)}function Cn(e,t=!1){if(e.lifecycleStatus!==`ready_for_review`)return`not awaiting acceptance`;if(t)return`waiting on your answer`;if(e.activityStatus===`waiting_on_you`)return`waiting on you`;if(e.activityStatus===`error`)return`runtime error`;if(e.activityStatus===`stalled`)return`work stalled`;if(e.inFlight.tasks>0||e.inFlight.queued>0)return`work still in flight`;if(e.workers.some(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)))return`a worker is still running`;if(e.alerts.length>0)return e.alerts.length===1?`1 open alert`:`${e.alerts.length} open alerts`;let n=(e.plan?.gates??[]).filter(e=>e.required&&e.status!==`satisfied`&&e.status!==`waived`);if(n.length)return n.length===1?`unmet gate: ${n[0].label}`:`${n.length} unmet gates`}function wn(e){return e.activityKind?e.activityKind:e.source===`custom`?e.phase===`delegating`||e.phase===`worker_started`||e.phase===`worker_reported`?`agent`:e.phase===`ready_for_review`?`output`:e.phase===`blocked_on_user`?`decision`:`lifecycle`:`tool`}function Tn(e){let t=wn(e);return t===`file_read`?`Read file`:t===`file_write`?`Changed file`:t===`command`?`Ran command`:t===`test`?`Ran tests`:t===`output`?`Produced output`:e.phase===`delegating`?`Manager delegated`:e.phase===`worker_started`?`Worker started`:e.phase===`worker_reported`?`Worker reported`:e.phase===`reviewing`?`Manager reviewing`:e.phase===`plan_updated`?`Plan revised`:e.phase===`ready_for_review`?`Awaiting acceptance`:e.hookEventName===`SubagentStart`?`Worker started`:e.hookEventName===`SubagentStop`?`Worker finished`:e.hookEventName===`TaskCreated`?`Task created`:e.hookEventName===`TaskCompleted`?`Task completed`:e.hookEventName===`TeammateIdle`?`Worker became idle`:e.hookEventName===`Notification`&&/waiting for your input/i.test(e.detail??``)?`Turn finished`:e.hookEventName===`PermissionRequest`?`Permission requested`:e.hookEventName===`PermissionDenied`?`Permission denied`:e.hookEventName===`PostToolUseFailure`?`Tool failed`:e.hookEventName===`StopFailure`?`Turn failed`:e.hookEventName===`PreCompact`?`Compacting context`:e.hookEventName===`PostCompact`?`Context compacted`:e.hookEventName===`WorktreeCreate`?`Worktree created`:e.hookEventName===`WorktreeRemove`?`Worktree removed`:e.hookEventName===`InstructionsLoaded`?`Instructions loaded`:e.hookEventName===`ConfigChange`?`Configuration changed`:e.hookEventName===`CwdChanged`?`Working directory changed`:e.hookEventName===`Elicitation`?`MCP needs input`:e.hookEventName===`ElicitationResult`?`MCP input answered`:t===`agent`?`Worker activity`:t===`decision`?e.phase===`decision_resolved`?`Decision answered`:`Needs you`:e.outcome===`failure`?`Tool failed`:e.phase?.replaceAll(`_`,` `)??e.hookEventName??`Activity`}var En=new Set([`InstructionsLoaded`,`ConfigChange`,`CwdChanged`,`PreCompact`,`PostCompact`,`TeammateIdle`]);function Dn(e){return e.hookEventName&&En.has(e.hookEventName)||e.hookEventName===`Notification`&&/waiting for your input/i.test(e.detail??``)?!1:wn(e)!==`lifecycle`||!!(e.phase&&e.phase!==`custom`)}function On(e){return e.split(`/`).filter(Boolean).slice(-2).join(`/`)||e}function kn(e,t=52){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function An(e){return e.replace(/\s+/g,` `).trim().split(` `).map(e=>{let t=/^["']|["']$/.test(e)?e.replace(/^["']|["']$/g,``):e;return!t.startsWith(`/`)||t.length<2?e:t.split(`/`).filter(Boolean).at(-1)??e}).join(` `)}function jn(e){return e.hookEventName===`PreToolUse`}function Mn(e,t=!0){let n=e.outcome===`failure`,r=n?`error`:`normal`,i=wn(e),a=t&&jn(e);if(e.filePath&&(i===`file_write`||i===`file_read`))return{verb:i===`file_write`?a?`Editing`:`Edited`:a?`Reading`:`Read`,object:On(e.filePath),full:e.filePath,tone:r};if(e.command)return{verb:i===`test`?n?`Tests failed`:a?`Testing`:`Tested`:n?`Command failed`:a?`Running`:`Ran`,object:kn(An(e.command)),full:e.command,tone:r};if(e.artifactPath)return{verb:`Produced`,object:On(e.artifactPath),full:e.artifactPath,tone:r};if(e.phase===`blocked_on_user`)return{verb:`Waiting on you`,object:kn(An(e.detail)),full:e.detail,tone:`attention`};if(e.phase===`ready_for_review`)return{verb:`Ready for review`,tone:`attention`};if(e.phase===`delegating`)return{verb:`Delegating`,object:kn(An(e.detail)),full:e.detail,tone:r};if(e.phase===`worker_reported`)return{verb:`Worker reported`,object:kn(An(e.targetWorker??e.detail)),full:e.detail,tone:r};if(e.phase===`plan_updated`)return{verb:`Revised the plan`,tone:r};if(e.toolName&&i===`tool`)return{verb:n?`Tool failed`:a?`Using`:`Used`,object:kn(e.toolName),full:e.detail,tone:r};let o=Nn(e);return{verb:Tn(e),object:o&&kn(o.shown),full:o?.full,tone:r}}function Nn(e){let t=e.detail?.trim();if(!t)return;let n=e.hookEventName??e.phase,r=n&&t.startsWith(`${n}:`)?t.slice(n.length+1).trim():t;if(!r||r===n)return;let i=An(r);return/\s/.test(i)?{shown:i,full:r}:void 0}function Pn(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(Dn(n))return n}}function Fn(e,t){for(let n=e.length-1;n>=0;--n){let r=e[n];if(vn(r.targetWorker,t)&&Dn(r))return r}}var In=new Map;function Ln(e,t){let n=In.get(e);if(!n){let t=new Set;n={timer:setInterval(()=>{let e=Date.now();for(let n of t)n(e)},e),listeners:t},In.set(e,n)}return n.listeners.add(t),()=>{let n=In.get(e);n&&(n.listeners.delete(t),n.listeners.size||(clearInterval(n.timer),In.delete(e)))}}function Rn(e=1e3){let[t,n]=(0,g.useState)(()=>Date.now());return(0,g.useEffect)(()=>Ln(e,n),[e]),t}function zn(e){let t=Math.max(0,Math.floor(e/6e4));return t<1?`<1m`:t<60?`${t}m`:`${Math.floor(t/60)}h ${String(t%60).padStart(2,`0`)}m`}function Bn(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function Vn(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}k`:`${(e/1e6).toFixed(1)}M`}var Hn={normal:`text-amber-200/70`,error:`text-rose-300/80`,attention:`text-rose-200/80`};function Un({event:e,fallback:t,working:n=!0}){let r=Rn(1e3);if(!e)return(0,O.jsx)(`p`,{className:`text-xs leading-relaxed text-white/40`,children:(0,O.jsx)(`span`,{className:`line-clamp-2`,children:t??`Waiting for activity`})});let{verb:i,object:a,full:o,tone:s}=Mn(e,n),c=n&&jn(e);return(0,O.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-[11px]`,title:o??i,children:[(0,O.jsx)(`span`,{className:`shrink-0 font-medium ${Hn[s]}`,children:i}),a&&(0,O.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-white/40`,children:a}),(0,O.jsxs)(`span`,{className:`mono ml-auto shrink-0 text-white/22`,title:new Date(e.ts).toLocaleString(),children:[Bn(r-e.ts),c?``:` ago`]})]})}function Wn(e){return!!(e.blocker?.trim()||e.unblock?.trim())}function Gn(e){let t=Jt(e),n=new Map(t.map(e=>[e.id,e])),r=e=>{let t=n.get(e)?.status;return t===`completed`||t===`cancelled`};return{now:t.filter(e=>e.status===`working`||e.status===`reviewing`),next:t.filter(e=>e.status===`queued`&&e.dependsOn.every(r)),attention:t.filter(e=>e.status===`blocked`||e.status===`failed`)}}function Kn(e){if(!e.blocked)return;let t=e.waitingFor?.trim()||void 0,n=Gn(e.plan).attention.find(e=>e.status===`blocked`&&Wn(e)),r=n?.blocker?.trim()||void 0,i=n?.unblock?.trim()||void 0,a=t??r;return a?{ask:a,unblock:i&&i!==a?i:void 0,task:n?{id:n.id,title:n.title}:void 0,source:t?`runtime`:`plan`}:{ask:`Waiting on your reply.`,source:`generic`}}function qn(e){return{...Gn(e.plan),waitingOn:Kn(e)}}function Jn({task:e}){let t=e.owner??e.workerId;return(0,O.jsxs)(`span`,{className:`block truncate`,title:e.title,children:[e.title,t&&(0,O.jsxs)(`span`,{className:`text-white/25`,children:[` · `,t]})]})}function Yn({label:e,tone:t,tasks:n,empty:r}){return(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] ${t===`amber`?`text-amber-200/50`:`text-violet-200/50`}`,children:e}),n.length?(0,O.jsxs)(`div`,{className:`mt-1 space-y-0.5 text-[11px] leading-snug text-white/55`,children:[n.slice(0,2).map(e=>(0,O.jsx)(Jn,{task:e},e.id)),n.length>2&&(0,O.jsxs)(`span`,{className:`block text-[9px] text-white/22`,children:[`+`,n.length-2,` more`]})]}):(0,O.jsx)(`p`,{className:`mt-1 text-[10px] text-white/22`,children:r})]})}function Xn({plan:e,waitingFor:t,blocked:n,onOpenPlan:r,variant:i=`panel`,className:a=``}){let o=qn({plan:e,waitingFor:t,blocked:n}),s=o.now.length>0||o.next.length>0;return i===`card`?o.waitingOn?(0,O.jsxs)(`div`,{className:`rounded-md border border-amber-300/15 bg-amber-300/[0.04] px-2.5 py-2 ${a}`,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-amber-200/55`,children:`Waiting on you`}),(0,O.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-white/60`,title:o.waitingOn.ask,children:(0,O.jsx)(`span`,{className:`line-clamp-2`,children:o.waitingOn.ask})}),o.waitingOn.unblock&&(0,O.jsx)(`p`,{className:`mt-1 text-[10px] leading-relaxed text-amber-100/50`,title:o.waitingOn.unblock,children:(0,O.jsxs)(`span`,{className:`line-clamp-1`,children:[`→ `,o.waitingOn.unblock]})})]}):null:!o.waitingOn&&!s?null:(0,O.jsxs)(`div`,{className:`space-y-2 ${a}`,children:[o.waitingOn&&(0,O.jsxs)(`div`,{className:`rounded-lg border border-amber-300/20 bg-amber-300/[0.05] px-3 py-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-amber-300/80`}),(0,O.jsx)(`span`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-amber-200/60`,children:`Waiting on you`})]}),(0,O.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-white/70`,children:o.waitingOn.ask}),o.waitingOn.unblock&&(0,O.jsxs)(`p`,{className:`mt-1 text-[10px] leading-relaxed text-amber-100/55`,children:[(0,O.jsx)(`span`,{className:`text-white/28`,children:`To unblock: `}),o.waitingOn.unblock]})]}),s&&(0,O.jsxs)(`div`,{className:`flex items-start gap-4 rounded-lg border border-white/[0.06] bg-white/[0.018] px-3 py-2`,children:[(0,O.jsx)(Yn,{label:`Now`,tone:`amber`,tasks:o.now,empty:`Nothing running.`}),(0,O.jsx)(`span`,{className:`mt-3 shrink-0 text-white/12`,children:`→`}),(0,O.jsx)(Yn,{label:`Next`,tone:`violet`,tasks:o.next,empty:`Nothing queued.`}),r&&(0,O.jsx)(`button`,{type:`button`,onClick:r,title:`Open the plan`,className:`mt-2 shrink-0 cursor-pointer rounded border border-white/10 px-1.5 py-0.5 text-[9px] text-white/30 transition hover:border-amber-300/25 hover:text-amber-100/70`,children:`Plan`})]})]})}function Zn(e){let t=e.jobState.toLowerCase();return t===`failed`||t===`error`?`failed`:e.doneAt?`complete`:t===`working`||t===`busy`?`working`:`ended`}function Qn(e){let t=e.map(e=>({worker:e,state:Zn(e)}));return{notable:t.filter(e=>e.state===`working`||e.state===`failed`).sort((e,t)=>(e.state===`failed`?0:1)-(t.state===`failed`?0:1)).map(e=>e.worker),done:t.filter(e=>e.state===`complete`).length,total:e.length}}var $n={working:`hive-pulse bg-amber-400`,failed:`bg-rose-400`,complete:`bg-emerald-400`,ended:`bg-white/25`};function er({workers:e,events:t,limit:n=4,onSelect:r}){if(!e.length)return null;let{notable:i,done:a}=Qn(e),o=i.slice(0,n),s=i.length-o.length;return o.length?(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[o.map(e=>{let n=Zn(e),i=Fn(t,e),a=i?Mn(i):void 0,o=a?[a.verb,a.object].filter(Boolean).join(` `):void 0,s=`${e.jobId}:${e.id}`,c=o?`${e.label} · ${o}`:e.label,l=`flex min-w-0 max-w-full items-center gap-1.5 rounded-lg border border-white/[0.09] bg-white/[0.03] px-2 py-1 text-[11px] text-white/60`,u=(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${$n[n]}`}),(0,O.jsx)(`span`,{className:`max-w-28 truncate`,children:e.label}),o&&(0,O.jsx)(`span`,{className:`mono max-w-36 truncate text-[10px] text-white/32`,children:o})]});return r?(0,O.jsx)(`button`,{type:`button`,"aria-label":`Inspect worker ${e.label}`,title:c,onClick:t=>{t.stopPropagation(),r(e)},className:`${l} cursor-pointer transition hover:border-amber-300/25 hover:bg-white/[0.06]`,children:u},s):(0,O.jsx)(`span`,{title:c,className:l,children:u},s)}),(s>0||a>0)&&(0,O.jsxs)(`span`,{className:`flex items-center rounded-lg border border-dashed border-white/[0.09] px-2 py-1 text-[11px] text-white/32`,children:[s>0&&`+${s}`,s>0&&a>0&&` · `,a>0&&`${a} done`]})]}):null}var tr={critical:`border-rose-400/25 bg-rose-400/[0.07] text-rose-200/85 hover:bg-rose-400/[0.11]`,warning:`border-orange-400/22 bg-orange-400/[0.06] text-orange-200/80 hover:bg-orange-400/[0.1]`,info:`border-violet-400/20 bg-violet-400/[0.05] text-violet-200/75 hover:bg-violet-400/[0.09]`};function nr({alerts:e,decisionCount:t=0,onOpenDecisions:n}){let[r,i]=(0,g.useState)(null),a=$e(e);if(!a.length&&!t)return null;let o=a.find(e=>e.id===r);return(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[t>0&&(0,O.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),n?.()},className:`rounded-lg border border-rose-300/25 bg-rose-300/[0.07] px-2 py-1 text-[11px] font-medium text-rose-200/85 transition hover:bg-rose-300/[0.12]`,children:[t,` decision`,t===1?``:`s`]}),a.map(e=>(0,O.jsx)(`button`,{type:`button`,"aria-expanded":r===e.id,onClick:t=>{t.stopPropagation(),i(r===e.id?null:e.id)},className:`max-w-full truncate rounded-lg border px-2 py-1 text-[11px] transition ${tr[e.severity]}`,children:e.title},e.id))]}),o&&(0,O.jsxs)(`div`,{className:`rounded-lg border border-white/[0.07] bg-black/25 px-3 py-2 text-[11px] leading-relaxed`,children:[(0,O.jsx)(`p`,{className:`text-white/55`,children:o.explanation}),(0,O.jsxs)(`p`,{className:`mt-1 text-white/30`,children:[(0,O.jsx)(`span`,{className:`font-medium text-white/40`,children:`Evidence:`}),` `,o.evidence]}),(0,O.jsxs)(`p`,{className:`mt-1 text-white/40`,children:[(0,O.jsx)(`span`,{className:`font-medium text-white/50`,children:`Try:`}),` `,o.recovery]})]})]})}function rr({plan:e}){return(0,O.jsx)(`span`,{title:e?`Plan revision ${e.revision} is waiting for your approval`:`A plan is waiting for your approval`,className:`inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-full bg-rose-500/12 px-2.5 py-1 text-center text-xs font-medium text-rose-300 ring-1 ring-rose-400/40`,children:`Approve plan`})}var ir=/https:\/\/claude\.ai\/code\/artifact\/[\w-]+/g,ar=/https?:\/\/[^\s<>"')\]]+\/-\/merge_requests\/(\d+)/g,or=/https?:\/\/github\.com\/[^\s<>"')\]]+\/pull\/(\d+)/g,sr=/https?:\/\/[\w.-]+(?:\.atlassian\.net|\/jira)\/browse\/([A-Z][A-Z0-9]*-\d+)/g;function cr(e){let t=e.match(/\/-\/merge_requests\/(\d+)/);if(t)return`MR !${t[1]}`;let n=e.match(/github\.com\/.+\/pull\/(\d+)/);if(n)return`PR #${n[1]}`;if(/claude\.ai\/code\/artifact\//.test(e))return`Artifact`}function lr(e,t){let n=new Map;for(let t of e)n.set(t.href,cr(t.href)??`${(t.kind||`PR`).toUpperCase()} ${t.id}`);let r=t.map(e=>e.text).join(`
|
|
11
|
+
`);for(let e of r.matchAll(ar))n.set(e[0],`MR !${e[1]}`);for(let e of r.matchAll(or))n.set(e[0],`PR #${e[1]}`);for(let e of r.matchAll(sr))n.set(e[0],e[1]);let i=[...new Set([...r.matchAll(ir)].map(e=>e[0]))];return i.forEach((e,t)=>n.set(e,i.length>1?`Artifact ${t+1}`:`Artifact`)),[...n.entries()].map(([e,t])=>({href:e,label:t}))}function ur({prs:e,messages:t}){let n=(0,g.useMemo)(()=>lr(e,t),[e,t]);return n.length?(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-emerald-300/10 bg-emerald-300/[0.025] px-3 py-2.5`,children:[(0,O.jsx)(`span`,{className:`text-[9px] font-semibold uppercase tracking-[0.16em] text-emerald-200/50`,children:`Outputs`}),n.map(e=>(0,O.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,title:e.href,className:`rounded-lg border border-white/10 bg-white/[0.03] px-2.5 py-1 text-[11px] text-violet-300 transition hover:border-violet-400/30 hover:text-violet-200`,children:[e.label,` ↗`]},e.href))]}):null}function dr({missionId:e,status:t,onDeleted:n,compact:r=!1,hidePrimary:i=!1}){let[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(!1),p=(0,g.useRef)(null);Ke(s,ze.modal,()=>{c(!1),f(!1)}),(0,g.useEffect)(()=>{if(!s)return;let e=e=>{p.current?.contains(e.target)||(c(!1),f(!1))};return document.addEventListener(`pointerdown`,e),()=>{document.removeEventListener(`pointerdown`,e)}},[s]);async function m(t){o(t),u(null);try{await G(e,t),c(!1)}catch(e){u(e.message)}finally{o(null)}}async function h(t){o(t),u(null);try{await de(e,t),c(!1)}catch(e){u(e.message)}finally{o(null)}}async function _(){o(`archived`),u(null);try{await ue(e),n?.()}catch(e){u(e.message)}finally{o(null),f(!1)}}let v=dt(t),y=r?`rounded-md border border-white/12 px-2 py-1 text-[11px] text-white/50 transition hover:border-amber-300/25 hover:text-amber-100/85 disabled:opacity-35`:`rounded-lg border border-white/10 bg-white/[0.035] px-3 py-1.5 text-xs font-medium text-white/55 transition hover:border-amber-300/20 hover:text-amber-200 disabled:opacity-40`;return(0,O.jsxs)(`div`,{ref:p,className:`relative flex items-center gap-1.5`,children:[!i&&(0,O.jsx)(`button`,{disabled:!!a,onClick:()=>m(v.next),className:r&&t===`ready_for_review`?`rounded-md border border-amber-200/30 bg-amber-200/[0.08] px-2 py-1 text-[11px] text-amber-100/85 transition hover:bg-amber-200/[0.14] disabled:opacity-35`:y,children:a===v.next?`Updating…`:r?v.shortLabel:v.label}),(0,O.jsx)(`button`,{"aria-label":`More mission actions`,"aria-expanded":s,onClick:()=>c(!s),className:`${y} ${r?``:`px-2.5`}`,children:`•••`}),s&&(0,O.jsxs)(`div`,{role:`menu`,className:`absolute right-0 top-full z-30 mt-1 min-w-56 rounded-lg border border-white/10 bg-[#18181d] p-1 shadow-2xl`,children:[(t===`active`||t===`ready_for_review`)&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`px-3 pb-1 pt-2 text-[9px] font-medium uppercase tracking-wider text-white/20`,children:`Ask orchestrator`}),[[`status_summary`,`Request status summary`],[`plan_revision`,`Revise plan`],[`review`,`Request fresh review`],[`test_pass`,`Run verification pass`]].map(([e,t])=>(0,O.jsx)(`button`,{disabled:!!a,onClick:()=>h(e),className:`block w-full rounded-md px-3 py-2 text-left text-xs text-white/60 hover:bg-white/5 hover:text-white disabled:opacity-35`,children:a===e?`Sending…`:t},e)),(0,O.jsx)(`div`,{className:`my-1 border-t border-white/[0.06]`})]}),t===`ready_for_review`&&(0,O.jsx)(`button`,{onClick:()=>m(`active`),className:`block w-full rounded-md px-3 py-2 text-left text-xs text-white/60 hover:bg-white/5 hover:text-white`,children:`Request changes`}),t===`active`&&(0,O.jsx)(`button`,{onClick:()=>m(`completed`),className:`block w-full rounded-md px-3 py-2 text-left text-xs text-white/60 hover:bg-white/5 hover:text-white`,children:`Mark complete`}),t!==`archived`&&(0,O.jsx)(`button`,{onClick:()=>m(`archived`),className:`block w-full rounded-md px-3 py-2 text-left text-xs text-white/60 hover:bg-white/5 hover:text-white`,children:`Archive mission`}),(0,O.jsx)(`div`,{className:`my-1 border-t border-white/[0.06]`}),d?(0,O.jsxs)(`div`,{className:`p-2`,children:[(0,O.jsx)(`p`,{className:`text-[10px] leading-relaxed text-rose-200/60`,children:`Permanently remove this mission, its conversation, and plan? Claude jobs are hidden but not deleted from disk.`}),(0,O.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{onClick:()=>f(!1),className:`px-2 py-1 text-[10px] text-white/35`,children:`Cancel`}),(0,O.jsx)(`button`,{disabled:!!a,onClick:_,className:`rounded-md bg-rose-500/70 px-2 py-1 text-[10px] text-white`,children:`Delete permanently`})]})]}):(0,O.jsx)(`button`,{onClick:()=>f(!0),className:`block w-full rounded-md px-3 py-2 text-left text-xs text-rose-300/55 hover:bg-rose-400/[0.06] hover:text-rose-200`,children:`Delete mission…`})]}),l&&(0,O.jsx)(`span`,{className:`absolute right-0 top-full mt-2 whitespace-nowrap text-[10px] text-rose-400`,children:l})]})}var fr=`rounded-md border border-white/12 px-2 py-1 text-[11px] text-white/50 transition hover:border-white/25 hover:text-white/85 disabled:opacity-35`,pr=`rounded-md border border-amber-200/30 bg-amber-200/[0.08] px-2 py-1 text-[11px] text-amber-100/85 transition hover:bg-amber-200/[0.14] disabled:opacity-35`;function mr({missionId:e,status:t,prs:n=[],messages:r=[],replyToken:i,onReplyOpenChange:a}){let[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(null),[m,h]=(0,g.useState)(!1),[_,v]=(0,g.useState)(!1),y=(0,g.useRef)(null),b=ft(t),x=t===`ready_for_review`,S=(0,g.useMemo)(()=>lr(n,r),[r,n]),C=(0,g.useMemo)(()=>[...r].reverse().find(e=>e.role===`assistant`&&e.text.trim()),[r]);(0,g.useEffect)(()=>{!i||!b||s(!0)},[b,i]),(0,g.useEffect)(()=>{a?.(o),o&&y.current?.focus()},[a,o]),(0,g.useEffect)(()=>{if(!m)return;let e=window.setTimeout(()=>h(!1),2500);return()=>window.clearTimeout(e)},[m]);function w(){s(!1),l(``),p(null)}async function T(){if(!_){v(!0),p(null);try{await G(e,dt(t).next)}catch(e){p(e.message)}finally{v(!1)}}}async function E(){let t=c.trim();if(!(!t||u)){d(!0),p(null);try{await W(e,t),l(``),s(!1),h(!0)}catch(e){p(e.message)}finally{d(!1)}}}return o?(0,O.jsxs)(`div`,{className:`flex flex-col gap-1`,onClick:e=>e.stopPropagation(),children:[C&&(0,O.jsxs)(`p`,{className:`max-h-24 overflow-y-auto whitespace-pre-wrap rounded-md border-l-2 border-white/10 bg-white/[0.02] px-2.5 py-1.5 text-[11px] leading-relaxed text-white/45`,title:C.text,children:[(0,O.jsx)(`span`,{className:`text-white/25`,children:`Last said · `}),C.text.trim()]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`input`,{ref:y,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&(e.preventDefault(),E()),e.key===`Escape`&&(e.preventDefault(),w())},placeholder:x?`What should change? Enter sends, Esc cancels`:`Reply — Enter sends, Esc cancels`,"aria-label":`Reply to this mission`,className:`min-w-0 flex-1 rounded-md border border-amber-300/25 bg-black/25 px-2.5 py-1.5 text-[11px] text-white/80 outline-none placeholder:text-white/25 focus:border-amber-300/45`}),(0,O.jsx)(`button`,{type:`button`,disabled:!c.trim()||u,onClick:()=>void E(),className:pr,children:u?`Sending…`:`Send`})]}),f&&(0,O.jsx)(`p`,{className:`text-[10px] text-rose-400`,children:f})]}):(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,onClick:e=>e.stopPropagation(),children:[f&&(0,O.jsx)(`span`,{className:`mr-auto text-[10px] text-rose-400`,children:f}),m&&(0,O.jsx)(`span`,{className:`mr-auto text-[10px] text-emerald-300/70`,children:`Sent`}),S.slice(0,2).map(e=>(0,O.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,title:e.href,className:fr,children:[e.label,` ↗`]},e.href)),x&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>void T(),disabled:_,className:pr,title:`Accept this mission as complete (a)`,children:_?`Accepting…`:dt(t).shortLabel}),b&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>s(!0),className:fr,title:x?`Say what should change, without opening the mission (d)`:`Reply without opening the mission (r)`,children:x?`Request changes`:`Reply`}),(0,O.jsx)(dr,{missionId:e,status:t,compact:!0,hidePrimary:x})]})}var hr=70;function gr({node:e,decisions:t=[],blocked:n=!1,changed:r=!1,selected:i=!1,active:a=!1,onToggleSelect:o,onSelect:s,onSelectWorker:c,onOpenDecisions:l}){let u=Rn(3e4),d=e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`,f=Pn(e.recentEvents),p=ut(e.plan),m=lt(e.plan),h=rt(e.plan),_=e.plan?.progress,v=zn((e.status===`working`?u:e.updatedAt)-e.runStartedAt),[y,b]=(0,g.useState)(!1),[x,S]=(0,g.useState)(),[C,w]=(0,g.useState)(!1),T=Qn(e.workers),E=e.mission.objective?.trim(),D=!!(E&&E.length>hr),k=ot(e.lifecycleStatus,e.mission.currentState,e.mission.compactSummary),j=k&&k!==E;return(0,O.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:s,"data-mission-card":e.missionId,onKeyDown:e=>{e.target===e.currentTarget&&((e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s()),e.key.toLowerCase()===`r`&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),S(Date.now())))},className:`group relative flex w-full cursor-pointer flex-col gap-3 rounded-2xl border bg-gradient-to-br from-white/[0.05] via-white/[0.025] to-amber-300/[0.018] p-4 text-left transition hover:-translate-y-0.5 hover:shadow-xl hover:shadow-amber-950/10 ${n?`border-white/10 border-l-2 border-l-rose-400/70 hover:border-rose-300/30`:`border-white/10 hover:border-amber-300/20`} ${a?`bg-white/[0.06] ring-2 ring-violet-400/55`:i?`ring-1 ring-amber-300/35`:``}`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-x-3`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[o&&(0,O.jsx)(`label`,{onClick:e=>e.stopPropagation(),className:`flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center transition ${i?``:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,title:`Select for bulk actions`,children:(0,O.jsx)(`input`,{type:`checkbox`,checked:i,onChange:()=>o(),className:`h-3 w-3 accent-amber-400`,"aria-label":`Select ${e.name}`})}),r&&(0,O.jsx)(`span`,{title:`Moved while you were away`,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-sky-400`}),(0,O.jsx)(Ye,{missionId:e.missionId,name:e.name})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1.5`,children:[it(e.lifecycleStatus,e.activityStatus)&&(0,O.jsx)(A,{status:e.activityStatus}),(d||e.lifecycleStatus!==`active`)&&(0,O.jsx)(mn,{status:e.lifecycleStatus}),ct(e)&&(0,O.jsx)(rr,{plan:e.plan})]})]}),(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.mission.repository&&(0,O.jsx)(`span`,{className:`mono min-w-0 max-w-40 shrink truncate rounded bg-white/[0.055] px-1.5 py-0.5 text-[10px] text-white/50`,title:e.mission.repository,children:tt(e.mission.repository)}),e.worktreeBranch&&(0,O.jsx)(`span`,{className:`mono min-w-0 max-w-40 shrink truncate rounded bg-violet-300/[0.08] px-1.5 py-0.5 text-[10px] text-violet-200/60`,title:e.worktreeBranch,children:nt(e.worktreeBranch)}),e.mission.planFirst&&e.plan?.approvalStatus===`proposed`&&(0,O.jsx)(`span`,{className:`shrink-0 rounded bg-amber-300/[0.1] px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-amber-200/70`,children:`Plan pending`})]}),(0,O.jsxs)(`div`,{className:`mono truncate text-[10px] text-white/25`,title:`${e.mission.mode} · ${e.mission.provider??`claude`} · ${e.mission.model??`CLI default`} · ${e.jobIds.length} turn${e.jobIds.length===1?``:`s`}`,children:[e.mission.mode,` · `,e.mission.provider??`claude`]})]}),(E||j)&&(0,O.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[E&&(D?(0,O.jsxs)(`button`,{type:`button`,"aria-expanded":y,"aria-label":y?`Collapse the full request`:`Show the full request`,onClick:e=>{e.stopPropagation(),b(!y)},className:`group/objective -mx-1 flex w-full items-start gap-1.5 rounded px-1 py-0.5 text-left transition hover:bg-white/[0.03]`,children:[(0,O.jsx)(`span`,{className:`min-w-0 flex-1 text-xs leading-relaxed text-white/45`,children:(0,O.jsx)(`span`,{className:y?`whitespace-pre-wrap`:`line-clamp-1`,children:E})}),(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-white/30 transition group-hover/objective:text-white/60`,children:y?`⌃`:`⌄`})]}):(0,O.jsx)(`p`,{className:`text-xs leading-relaxed text-white/45`,children:E})),j&&(0,O.jsx)(`p`,{className:`text-[11px] leading-relaxed text-white/30`,title:k,children:(0,O.jsxs)(`span`,{className:`line-clamp-2`,children:[(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`text-white/15`,children:`└ `}),k]})})]}),(0,O.jsx)(Un,{event:f,fallback:e.detail??e.intent,working:e.activityStatus===`working`}),(0,O.jsx)(Xn,{variant:`card`,plan:e.plan,waitingFor:e.waitingFor,blocked:e.lifecycleStatus===`active`&&e.activityStatus===`waiting_on_you`}),(0,O.jsx)(er,{workers:e.workers,events:e.recentEvents,onSelect:c}),_&&(0,O.jsxs)(`div`,{children:[m&&(0,O.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2 text-[10px] uppercase tracking-wide text-white/30`,children:[(0,O.jsxs)(`span`,{className:`min-w-0 truncate`,title:m.title,children:[`Phase `,m.index,`/`,m.total,` · `,(0,O.jsx)(`span`,{className:`normal-case text-white/45`,children:m.title})]}),(0,O.jsxs)(`span`,{className:`mono shrink-0 text-white/25`,children:[m.completed,`/`,m.tasks]})]}),(0,O.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between gap-2 text-[10px] uppercase tracking-wide text-white/25`,children:[(0,O.jsxs)(`span`,{className:`truncate`,children:[m?`Plan · `:``,_.completedTasks,`/`,_.totalTasks,` tasks`,p&&` · ${p.satisfied}/${p.required} gates`,h>0&&` · ${h} file${h===1?``:`s`}`]}),(0,O.jsxs)(`span`,{className:`shrink-0 text-amber-200/60`,children:[_.percent??0,`%`]})]}),(0,O.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,O.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-amber-400 to-violet-400`,style:{width:`${_.percent??0}%`}})})]}),(0,O.jsx)(nr,{alerts:e.alerts??[],decisionCount:t.length,onOpenDecisions:l}),(0,O.jsxs)(`p`,{className:`mono mt-auto flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-white/[0.06] pt-2.5 text-[10px] text-white/28`,children:[(0,O.jsx)(`span`,{children:v}),T.total>0&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`text-white/12`,children:`·`}),(0,O.jsxs)(`span`,{children:[T.total,` worker`,T.total===1?``:`s`,T.done>0&&(0,O.jsxs)(`span`,{className:`text-emerald-300/55`,children:[` ✓`,T.done]})]})]}),(0,O.jsx)(`span`,{className:`text-white/12`,children:`·`}),(0,O.jsxs)(`span`,{children:[Vn(e.tokens),` tok`]})]}),(0,O.jsx)(`div`,{className:`transition ${C?``:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 group-focus:opacity-100`}`,children:(0,O.jsx)(mr,{missionId:e.missionId,status:e.lifecycleStatus,prs:e.prs,messages:e.messages,replyToken:x,onReplyOpenChange:w})})]})}var _r={working:`hive-pulse bg-amber-400`,waiting_on_you:`hive-pulse bg-rose-400`,stalled:`hive-pulse bg-orange-400`,error:`bg-red-400`,done:`bg-emerald-400`,idle:`bg-slate-400`,offline:`bg-slate-600`};function vr({node:e,decisions:t=[],blocked:n=!1,changed:r=!1,selected:i=!1,active:a=!1,onToggleSelect:o,onSelect:s,onSelectWorker:c}){let l=Rn(3e4),[u,d]=(0,g.useState)(),[f,p]=(0,g.useState)(!1),m=Pn(e.recentEvents),h=e.plan?.progress,_=$e(e.alerts??[])[0],v=Qn(e.workers),y=v.notable.length>0||!!_,b=zn((e.status===`working`?l:e.updatedAt)-e.runStartedAt);return(0,O.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:s,"data-mission-card":e.missionId,onKeyDown:e=>{e.target===e.currentTarget&&((e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s()),e.key.toLowerCase()===`r`&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),d(Date.now())))},className:`group relative cursor-pointer rounded-xl border bg-white/[0.022] px-3 py-2.5 transition hover:bg-white/[0.045] ${n?`border-white/[0.07] border-l-2 border-l-rose-400/70 hover:border-rose-300/25`:`border-white/[0.07] hover:border-amber-300/20`} ${a?`bg-white/[0.06] ring-2 ring-violet-400/55`:i?`ring-1 ring-amber-300/35`:``}`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[o&&(0,O.jsx)(`label`,{onClick:e=>e.stopPropagation(),className:`flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center transition ${i?``:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,title:`Select for bulk actions`,children:(0,O.jsx)(`input`,{type:`checkbox`,checked:i,onChange:()=>o(),className:`h-3 w-3 accent-amber-400`,"aria-label":`Select ${e.name}`})}),(0,O.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${_r[e.activityStatus]}`,title:e.activityStatus.replaceAll(`_`,` `)}),r&&(0,O.jsx)(`span`,{title:`Moved while you were away`,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-sky-400`}),(0,O.jsx)(`span`,{className:`min-w-0 shrink-0 max-w-52`,title:e.mission.objective,children:(0,O.jsx)(Ye,{missionId:e.missionId,name:e.name})}),e.mission.repository&&(0,O.jsx)(`span`,{className:`mono hidden shrink-0 truncate rounded bg-white/[0.05] px-1.5 py-0.5 text-[10px] text-white/45 sm:inline-block sm:max-w-28`,title:e.mission.repository,children:tt(e.mission.repository)}),e.worktreeBranch&&(0,O.jsx)(`span`,{className:`mono hidden shrink-0 truncate rounded bg-violet-300/[0.07] px-1.5 py-0.5 text-[10px] text-violet-200/55 lg:inline-block lg:max-w-32`,title:e.worktreeBranch,children:nt(e.worktreeBranch)}),(0,O.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,O.jsx)(Un,{event:m,fallback:e.detail??e.intent,working:e.activityStatus===`working`})}),t.length>0&&(0,O.jsxs)(`span`,{className:`shrink-0 rounded border border-rose-300/25 bg-rose-300/[0.07] px-1.5 py-0.5 text-[10px] font-medium text-rose-200/85`,children:[t.length,` decision`,t.length===1?``:`s`]}),ct(e)&&(0,O.jsx)(`span`,{title:`Plan revision ${e.plan?.revision} is waiting for your approval`,className:`shrink-0 rounded bg-rose-500/12 px-1.5 py-0.5 text-[10px] font-medium text-rose-300 ring-1 ring-rose-400/40`,children:`Approve plan`}),h&&(0,O.jsxs)(`span`,{className:`hidden shrink-0 items-center gap-1.5 md:flex`,title:`${h.completedTasks}/${h.totalTasks} tasks`,children:[(0,O.jsx)(`span`,{className:`h-1 w-14 overflow-hidden rounded-full bg-white/[0.07]`,children:(0,O.jsx)(`span`,{className:`block h-full rounded-full bg-gradient-to-r from-amber-400 to-violet-400`,style:{width:`${h.percent??0}%`}})}),(0,O.jsxs)(`span`,{className:`mono text-[10px] text-white/30`,children:[h.percent??0,`%`]})]}),!y&&v.total>0&&(0,O.jsxs)(`span`,{className:`mono hidden shrink-0 text-[10px] text-white/28 sm:inline`,title:`${v.total} worker${v.total===1?``:`s`}, ${v.done} complete`,children:[v.total,`w`,v.done>0&&(0,O.jsxs)(`span`,{className:`text-emerald-300/60`,children:[` ✓`,v.done]})]}),(0,O.jsxs)(`span`,{className:`mono hidden shrink-0 text-[10px] text-white/25 sm:inline`,children:[b,` · `,Vn(e.tokens)]}),(0,O.jsx)(`span`,{className:`shrink-0 transition ${f?``:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 group-focus:opacity-100`}`,children:(0,O.jsx)(mr,{missionId:e.missionId,status:e.lifecycleStatus,prs:e.prs,messages:e.messages,replyToken:u,onReplyOpenChange:p})})]}),y&&(0,O.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-2 pl-4.5`,children:[(0,O.jsx)(er,{workers:e.workers,events:e.recentEvents,limit:3,onSelect:c}),_&&(0,O.jsxs)(`span`,{title:`${_.explanation} · ${_.evidence}`,className:`truncate rounded px-1.5 py-0.5 text-[10px] ${_.severity===`critical`?`bg-rose-400/[0.08] text-rose-200/80`:_.severity===`warning`?`bg-orange-400/[0.07] text-orange-200/75`:`bg-violet-400/[0.06] text-violet-200/70`}`,children:[_.title,(e.alerts?.length??0)>1&&(0,O.jsxs)(`span`,{className:`ml-1 text-white/25`,children:[`+`,e.alerts.length-1]})]})]})]})}function yr(e){let t=new Map;for(let n of e){let e=n.mission.repository?et(n.mission.repository):``;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].sort(([e],[t])=>(e||``).localeCompare(t||``))}function br({title:e,description:t,missions:n,decisionsByMission:r,blockedMissionIds:i,changedMissionIds:a,selectedMissionIds:o,activeMissionId:s,groupByRepository:c=!1,onToggleSelect:l,density:u=`comfortable`,onSelect:d,onSelectWorker:f,onOpenDecisions:p,collapsedByDefault:m=!1}){let[h,_]=(0,g.useState)(()=>St(e,m)),v=e=>u===`compact`?(0,O.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.map(e=>(0,O.jsx)(vr,{node:e,decisions:r?.get(e.missionId),blocked:i?.has(e.missionId),changed:a?.has(e.missionId),selected:o?.has(e.missionId),active:s===e.missionId,onToggleSelect:l?()=>l(e.missionId):void 0,onSelect:()=>d(e.missionId),onSelectWorker:f?t=>f(e.missionId,t):void 0},e.missionId))}):(0,O.jsx)(`div`,{className:`@container/board`,children:(0,O.jsx)(`div`,{className:`grid grid-cols-1 items-stretch gap-4 @2xl/board:grid-cols-2 @5xl/board:grid-cols-3 @7xl/board:grid-cols-4`,children:e.map(e=>(0,O.jsx)(gr,{node:e,decisions:r?.get(e.missionId),blocked:i?.has(e.missionId),changed:a?.has(e.missionId),selected:o?.has(e.missionId),active:s===e.missionId,onToggleSelect:l?()=>l(e.missionId):void 0,onSelect:()=>d(e.missionId),onSelectWorker:f?t=>f(e.missionId,t):void 0,onOpenDecisions:p},e.missionId))})});return n.length?(0,O.jsxs)(`section`,{className:`mb-8`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>{let t=!h;_(t),Dt(e,t)},className:`mb-3 flex w-full items-center justify-between text-left`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`h2`,{className:`text-sm font-medium uppercase tracking-wide text-white/40`,children:[e,` `,(0,O.jsx)(`span`,{className:`ml-1 text-white/20`,children:n.length})]}),t&&(0,O.jsx)(`p`,{className:`mt-1 text-xs text-white/25`,children:t})]}),(0,O.jsx)(`span`,{className:`rounded-md border border-white/8 px-2 py-1 text-xs text-white/30`,children:h?`+`:`−`})]}),!h&&(c?yr(n).map(([e,t])=>(0,O.jsxs)(`section`,{className:`mb-5 last:mb-0`,children:[(0,O.jsxs)(`h3`,{className:`mb-2 flex items-baseline gap-2 text-[10px] font-medium uppercase tracking-wider text-white/30`,children:[tt(e),(0,O.jsx)(`span`,{className:`text-white/15`,children:t.length})]}),v(t)]},e)):v(n))]}):null}var xr=12e3;function Sr(e,t){let n=[],r=[];for(let i of e){let e=i.lifecycleStatus===`active`||i.lifecycleStatus===`ready_for_review`;t.has(i.missionId)?r.push({name:i.name,reason:`has an unanswered question`}):e?n.push(i):r.push({name:i.name,reason:`already ${i.lifecycleStatus.replaceAll(`_`,` `)}`})}return{eligible:n,skipped:r}}function Cr(e){return{eligible:e.filter(e=>e.lifecycleStatus===`active`),skipped:e.filter(e=>e.lifecycleStatus!==`active`).map(e=>({name:e.name,reason:`not running (${e.lifecycleStatus.replaceAll(`_`,` `)})`}))}}function wr(e){return{eligible:e.filter(e=>e.lifecycleStatus!==`archived`),skipped:e.filter(e=>e.lifecycleStatus===`archived`).map(e=>({name:e.name,reason:`already archived`}))}}function Tr(e,t,n){return t===n?e:`${e} ${t}`}var Er=`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-[11px] transition disabled:opacity-35`,Dr=`mono rounded border border-current/25 px-1 text-[9px] opacity-45`,Or={complete:`C`,pause:`P`,archive:`A`,delete:`Backspace`};function kr({selected:e,missionsWithDecisions:t,onClear:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(!1);Ke(!0,ze.panel,()=>!l&&!d?!1:(u(!1),f(!1),document.activeElement?.blur?.(),!0));let p=(0,g.useRef)(null);(0,g.useEffect)(()=>{(l||d)&&p.current?.focus()},[l,d]);let m=(0,g.useRef)({});(0,g.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{if(!e.shiftKey||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||yt(e.target))return;let t=m.current[e.key===`Backspace`?`Backspace`:e.key.toUpperCase()];t&&(e.preventDefault(),t())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,g.useEffect)(()=>{if(!a?.undo)return;let e=setTimeout(()=>o(e=>e&&{...e,undo:void 0}),xr);return()=>clearTimeout(e)},[a]);async function h(e){i(`undo`),c(null);try{for(let t of e)await G(t.missionId,t.previous);o(null)}catch(e){c(e.message)}finally{i(null)}}if(!e.length&&!a?.undo)return null;let _=(t,n)=>Tr(n,t,e.length),v=Sr(e,t),y=Cr(e),b=wr(e);m.current={[Or.complete]:v.eligible.length&&!r?()=>void S(`complete`,v,`completed`,!0):void 0,[Or.pause]:y.eligible.length&&!r?()=>void S(`pause`,y,`paused`):void 0,[Or.archive]:b.eligible.length&&!r?()=>{f(!1),u(!0)}:void 0,[Or.delete]:e.length&&!r?()=>{u(!1),f(!0)}:void 0};async function x(){i(`delete`),c(null),o(null);try{for(let t of e)await ue(t.missionId);o({changed:e.length,skipped:[]}),n()}catch(e){c(e.message)}finally{i(null),f(!1)}}async function S(e,t,r,a=!1){i(e),c(null),o(null);let s=t.eligible.map(e=>({missionId:e.missionId,previous:e.lifecycleStatus}));try{for(let e of t.eligible)await G(e.missionId,r);o({changed:t.eligible.length,skipped:t.skipped,undo:a?s:void 0}),n()}catch(e){c(e.message)}finally{i(null),u(!1)}}return(0,O.jsxs)(`div`,{className:`sticky bottom-4 z-40 mx-auto mb-4 flex w-fit max-w-full flex-wrap items-center gap-2.5 rounded-xl border border-amber-200/25 bg-[#161009]/95 px-4 py-2.5 shadow-2xl shadow-black/50 backdrop-blur`,children:[e.length>0&&(0,O.jsxs)(`span`,{className:`text-xs font-medium text-amber-100/85`,children:[e.length,` selected`]}),e.length>0&&v.skipped.length>0&&(0,O.jsxs)(`span`,{className:`text-[10px] text-white/35`,title:v.skipped.map(e=>`${e.name} — ${e.reason}`).join(`
|
|
12
|
+
`),children:[v.skipped.length,` can’t be completed`]}),e.length>0&&(0,O.jsx)(`span`,{className:`h-4 w-px bg-white/12`}),v.eligible.length>0&&(0,O.jsx)(`button`,{type:`button`,disabled:!!r,onClick:()=>void S(`complete`,v,`completed`,!0),title:`Finish ${v.eligible.length} mission${v.eligible.length===1?``:`s`} — accepting the ones awaiting acceptance`,className:`${Er} border-emerald-300/30 bg-emerald-300/[0.09] text-emerald-100/90 hover:bg-emerald-300/[0.15]`,children:r===`complete`?`Completing…`:(0,O.jsxs)(O.Fragment,{children:[_(v.eligible.length,`Complete`),(0,O.jsx)(`kbd`,{className:Dr,children:`⇧C`})]})}),y.eligible.length>0&&(0,O.jsx)(`button`,{type:`button`,disabled:!!r,onClick:()=>void S(`pause`,y,`paused`),className:`${Er} border-white/12 text-white/55 hover:border-white/25 hover:text-white/85`,children:r===`pause`?`Pausing…`:(0,O.jsxs)(O.Fragment,{children:[_(y.eligible.length,`Pause`),(0,O.jsx)(`kbd`,{className:Dr,children:`⇧P`})]})}),b.eligible.length>0&&(l?(0,O.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,O.jsxs)(`span`,{className:`text-[10px] text-white/45`,children:[`Archive `,b.eligible.length,`?`]}),(0,O.jsx)(`button`,{ref:p,type:`button`,disabled:!!r,onClick:()=>void S(`archive`,b,`archived`),className:`${Er} border-rose-300/30 bg-rose-400/[0.1] text-rose-100/90`,children:r===`archive`?`Archiving…`:(0,O.jsxs)(O.Fragment,{children:[`Confirm`,(0,O.jsx)(`kbd`,{className:Dr,children:`⏎`})]})}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>u(!1),className:`${Er} border-white/12 text-white/45`,children:`Cancel`})]}):(0,O.jsxs)(`button`,{type:`button`,disabled:!!r,onClick:()=>{f(!1),u(!0)},className:`${Er} border-white/12 text-white/55 hover:border-white/25 hover:text-white/85`,children:[_(b.eligible.length,`Archive`),`…`,(0,O.jsx)(`kbd`,{className:Dr,children:`⇧A`})]})),e.length>0&&(d?(0,O.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,O.jsxs)(`span`,{className:`text-[10px] text-rose-200/70`,children:[`Permanently delete `,e.length,`? Conversations and plans go with them.`]}),(0,O.jsx)(`button`,{ref:p,type:`button`,disabled:!!r,onClick:()=>void x(),className:`${Er} border-rose-400/40 bg-rose-500/20 text-rose-50`,children:r===`delete`?`Deleting…`:(0,O.jsxs)(O.Fragment,{children:[`Delete permanently`,(0,O.jsx)(`kbd`,{className:Dr,children:`⏎`})]})}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>f(!1),className:`${Er} border-white/12 text-white/45`,children:`Cancel`})]}):(0,O.jsxs)(`button`,{type:`button`,disabled:!!r,onClick:()=>{u(!1),f(!0)},className:`${Er} border-white/12 text-rose-300/60 hover:border-rose-300/30 hover:text-rose-200`,children:[`Delete…`,(0,O.jsx)(`kbd`,{className:Dr,children:`⇧⌫`})]})),e.length>0&&(0,O.jsx)(`span`,{className:`h-4 w-px bg-white/12`}),e.length>0&&(0,O.jsx)(`button`,{type:`button`,onClick:n,className:`text-[11px] text-white/40 transition hover:text-white/70`,children:`Clear`}),a&&(0,O.jsxs)(`span`,{className:`text-[10px] text-emerald-300/70`,children:[a.changed,` updated`,a.skipped.length?` · ${a.skipped.length} skipped`:``]}),a?.undo&&(0,O.jsx)(`button`,{type:`button`,disabled:!!r,onClick:()=>void h(a.undo),className:`${Er} border-white/15 text-white/70 hover:border-white/30 hover:text-white`,children:r===`undo`?`Undoing…`:`Undo`}),s&&(0,O.jsx)(`span`,{className:`text-[10px] text-rose-400`,children:s})]})}function Ar(e,t){let n=e.toLowerCase().trim();if(!n)return 0;let r=t.toLowerCase(),i=r.indexOf(n);if(i!==-1)return 1e3-i;let a=0,o=0,s=0;for(let e of n){let t=r.indexOf(e,o);if(t===-1)return;s=t===o?s+1:0,a+=10+s*5-Math.min(t-o,20),o=t+1}return a}var jr={mission:0,action:1,global:2};function Mr(e,t,n=12){return[...t.trim()?e.map(e=>{let n=Ar(t,`${e.title} ${e.hint??``} ${e.keywords??``}`);return n===void 0?void 0:{command:e,score:n}}).filter(e=>e!==void 0).sort((e,t)=>t.score-e.score).slice(0,n).map(e=>e.command):e.slice(0,n)].sort((e,t)=>jr[e.group]-jr[t.group])}function Nr(e){let t=e.missions.flatMap(t=>{let n=t.mission.repository?tt(t.mission.repository):void 0,r=dt(t.lifecycleStatus);return[{id:`open:${t.missionId}`,group:`mission`,title:t.name,hint:[n,t.mission.objective].filter(Boolean).join(` · `),keywords:`${t.lifecycleStatus} ${t.activityStatus} ${t.worktreeBranch??``}`,run:()=>e.openMission(t.missionId)},...e.pinToWorkspace?[{id:`workspace:${t.missionId}`,group:`action`,title:`Pin ${t.name} to workspace`,hint:`Monitor and converse alongside other missions`,keywords:`split multi mission workspace`,run:()=>e.pinToWorkspace(t.missionId)}]:[],{id:`reply:${t.missionId}`,group:`action`,title:`Reply to ${t.name}`,hint:`Send a message without opening the mission`,run:()=>e.replyToMission(t.missionId)},{id:`lifecycle:${t.missionId}`,group:`action`,title:`${r.shortLabel} ${t.name}`,hint:r.label,run:()=>e.setLifecycle(t.missionId,r.next)}]}),n=[{id:`new`,group:`global`,title:`New mission`,hint:`Open the launch dialog`,keywords:`start create orchestrator`,run:e.newMission},{id:`templates`,group:`global`,title:`Templates`,hint:`Browse and edit mission templates`,run:e.openTemplates},{id:`policies`,group:`global`,title:`Policies`,hint:`Workspace permissions`,keywords:`permissions`,run:e.openPolicies},{id:`needs-me`,group:`global`,title:`Filter: needs me`,hint:`Only missions blocked on you`,keywords:`blocked decisions`,run:e.toggleNeedsMe},{id:`search`,group:`global`,title:`Search missions`,hint:`Focus the fleet search field /`,run:e.focusSearch},{id:`view-grid`,group:`global`,title:`View: Grid`,hint:`One card per mission`,run:()=>e.setView(`grid`)},{id:`view-list`,group:`global`,title:`View: List`,hint:`Two-line rows`,run:()=>e.setView(`list`)},{id:`view-office`,group:`global`,title:`View: Office`,hint:`The isometric floor`,run:()=>e.setView(`office`)}];return[...t.filter(e=>e.group===`mission`),...n,...t.filter(e=>e.group===`action`)]}var Pr={mission:`Missions`,global:`Hive`,action:`Actions`},Fr={mission:`text-amber-200/60`,global:`text-violet-200/60`,action:`text-emerald-200/60`};function Ir({commands:e,open:t,onOpenChange:n,onFilterBoard:r}){let[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(0),c=(0,g.useRef)(null),l=(0,g.useRef)(null),u=(0,g.useMemo)(()=>Mr(e,i),[e,i]),d=!!(r&&i.trim()),f=u.length+ +!!d;if((0,g.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{e.key.toLowerCase()!==`k`||!(e.metaKey||e.ctrlKey)||(e.preventDefault(),n(!t))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,t]),Ke(t,ze.modal,()=>n(!1)),(0,g.useEffect)(()=>{t&&(a(``),s(0),c.current?.focus())},[t]),(0,g.useEffect)(()=>s(0),[i]),(0,g.useEffect)(()=>{l.current?.querySelector(`[data-active="true"]`)?.scrollIntoView?.({block:`nearest`})},[o]),!t)return null;function p(e){e&&(n(!1),e.run())}let m;return(0,O.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,className:`fixed inset-0 z-50 flex items-start justify-center bg-black/55 px-4 pt-[12vh] backdrop-blur-sm`,onClick:()=>n(!1),children:(0,O.jsxs)(`div`,{className:`w-full max-w-xl overflow-hidden rounded-xl border border-white/12 bg-[#141419] shadow-2xl shadow-black/60`,onClick:e=>e.stopPropagation(),children:[(0,O.jsx)(`input`,{ref:c,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{if((e.key===`ArrowDown`||e.key===`n`&&e.ctrlKey)&&(e.preventDefault(),s(e=>Math.min(f-1,e+1))),(e.key===`ArrowUp`||e.key===`p`&&e.ctrlKey)&&(e.preventDefault(),s(e=>Math.max(0,e-1))),e.key===`Enter`){if(e.preventDefault(),d&&o===u.length){n(!1),r?.(i.trim());return}p(u[o])}},placeholder:`Go to a mission, or run a command…`,"aria-label":`Go to a mission or run a command`,className:`w-full border-b border-white/[0.08] bg-transparent px-4 py-3.5 text-sm text-white/85 outline-none placeholder:text-white/25`}),(0,O.jsxs)(`div`,{ref:l,className:`max-h-80 overflow-y-auto p-1.5`,children:[u.length===0&&!d&&(0,O.jsxs)(`p`,{className:`px-3 py-6 text-center text-xs text-white/30`,children:[`Nothing matches “`,i,`”.`]}),u.map((e,t)=>{let n=e.group===m?void 0:e.group;return m=e.group,(0,O.jsxs)(`div`,{children:[n&&(0,O.jsx)(`p`,{className:`px-3 pb-1 pt-2.5 text-[9px] font-semibold uppercase tracking-[0.16em] ${Fr[n]}`,children:Pr[n]}),(0,O.jsxs)(`button`,{type:`button`,"data-active":t===o,onMouseEnter:()=>s(t),onClick:()=>p(e),className:`flex w-full items-baseline gap-2.5 rounded-lg px-3 py-2 text-left transition ${t===o?`bg-amber-300/[0.1]`:`hover:bg-white/[0.04]`}`,children:[(0,O.jsx)(`span`,{className:`shrink-0 text-xs font-medium ${t===o?`text-amber-100/90`:`text-white/75`}`,children:e.title}),e.hint&&(0,O.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-white/30`,children:e.hint})]})]},e.id)}),d&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`px-3 pb-1 pt-2.5 text-[9px] font-semibold uppercase tracking-[0.16em] text-violet-200/60`,children:`Search everything`}),(0,O.jsxs)(`button`,{type:`button`,"data-active":o===u.length,onMouseEnter:()=>s(u.length),onClick:()=>{n(!1),r?.(i.trim())},className:`flex w-full items-baseline gap-2.5 rounded-lg px-3 py-2 text-left transition ${o===u.length?`bg-amber-300/[0.1]`:`hover:bg-white/[0.04]`}`,children:[(0,O.jsxs)(`span`,{className:`shrink-0 text-xs font-medium ${o===u.length?`text-amber-100/90`:`text-white/75`}`,children:[`Filter the board for “`,i.trim(),`”`]}),(0,O.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-white/30`,children:`Searches messages, files, commands, errors — the board filter reads names only`})]})]})]}),(0,O.jsxs)(`p`,{className:`flex items-center gap-3 border-t border-white/[0.06] px-4 py-2 text-[10px] text-white/25`,children:[(0,O.jsx)(`span`,{children:`↑↓ move`}),(0,O.jsx)(`span`,{children:`↵ run`}),(0,O.jsx)(`span`,{children:`esc close`})]})]})})}var Lr=[{id:`highlights`,label:`Highlights`},{id:`all`,label:`All events`},{id:`manager`,label:`Manager`},{id:`worker`,label:`Workers`},{id:`task`,label:`Tasks`},{id:`tool`,label:`Tools`},{id:`errors`,label:`Errors`},{id:`outputs`,label:`Outputs`}],Rr=new Set([`PreToolUse`,`PostToolUse`,`PostToolBatch`,`UserPromptSubmit`,`SessionStart`,`Stop`]);function zr(e){return e.outcome===`failure`||e.source===`custom`||[`test`,`output`,`decision`,`file_write`].includes(wn(e))||e.phase===`worker_started`||e.phase===`worker_reported`?!0:!Rr.has(e.hookEventName??``)&&!!e.targetWorker}function Br(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function Vr(e,t){let n=!e.targetWorker||e.targetWorker===`hive-orchestrator`;return t===`highlights`?zr(e):t===`all`?!0:t===`manager`?n&&e.phase!==`worker_started`&&e.phase!==`worker_reported`:t===`worker`?!n&&!!e.targetWorker||e.phase===`worker_started`||e.phase===`worker_reported`:t===`task`?!!e.targetTask||e.phase===`plan_updated`:t===`tool`?e.source===`hook`&&!!e.toolName:t===`errors`?e.outcome===`failure`:wn(e)===`output`||e.phase===`ready_for_review`}function Hr(e){let t=Math.floor(e/6e4);return t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function Ur(e){return[wn(e),e.targetWorker,e.filePath,e.command,e.artifactPath,e.phase,e.detail].join(`|`)}function Wr(e){let t=wn(e);if(!(e.outcome===`failure`||e.phase||t===`decision`||t===`output`)&&[`file_read`,`file_write`,`command`,`test`].includes(t))return[t,e.targetWorker??`manager`,e.targetTask??``,e.outcome??``].join(`|`)}function Gr(e){let t=[];for(let n of[...e].sort((e,t)=>t.ts-e.ts)){let e=t.at(-1),r=e&&Wr(n)&&Wr(e.event)===Wr(n)&&Math.abs(e.events.at(-1).ts-n.ts)<15e3,i=!!(e&&Wr(n)!==void 0&&Wr(e.event)!==void 0);e&&i&&(Ur(e.event)===Ur(n)||r)&&Math.abs(e.events.at(-1).ts-n.ts)<15e3?(e.count+=1,e.events.push(n)):t.push({event:n,count:1,events:[n]})}return t}function Kr(e,t){if(t<2)return;let n=wn(e);if(n===`file_read`)return`Read ${t} files`;if(n===`file_write`)return`Changed ${t} files`;if(n===`command`)return`Ran ${t} commands`;if(n===`test`)return`${t} verification runs ${e.outcome===`failure`?`failed`:`completed`}`}function qr({events:e,compact:t=!1}){let[n,r]=(0,g.useState)(()=>{if(typeof window>`u`)return`highlights`;let e=localStorage.getItem(`hive:activity-filter`);return Lr.some(t=>t.id===e)?e:`highlights`}),i=e=>{r(e);try{localStorage.setItem(`hive:activity-filter`,e)}catch{}},a=(0,g.useMemo)(()=>Gr(e.filter(e=>Vr(e,n))),[e,n]);return e.length?(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,role:`group`,"aria-label":`Activity filters`,children:Lr.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),className:`rounded-full border px-2.5 py-1 text-[10px] transition ${n===e.id?`border-amber-300/25 bg-amber-300/10 text-amber-100/75`:`border-white/8 text-white/30 hover:bg-white/5 hover:text-white/55`}`,children:e.label},e.id))}),a.length?(0,O.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:a.map(({event:e,count:n,events:r},i)=>(0,O.jsxs)(g.Fragment,{children:[(0,O.jsxs)(`li`,{className:`flex gap-2 rounded-lg px-1 py-1.5 text-sm hover:bg-white/[0.02] ${t?`flex-wrap items-center`:`items-start`}`,children:[(0,O.jsx)(`span`,{className:`mono mt-0.5 shrink-0 text-xs text-white/25`,children:Br(e.ts)}),(0,O.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${e.source===`custom`?`bg-violet-400`:wn(e)===`test`?`bg-emerald-400`:wn(e)===`decision`?`bg-amber-400`:`bg-white/25`}`}),(0,O.jsxs)(`span`,{className:`min-w-0 text-white/65 ${t?`basis-full pl-5`:``}`,children:[(0,O.jsx)(`span`,{className:`font-medium text-white/45`,children:Kr(e,n)??Tn(e)}),e.targetWorker&&(0,O.jsxs)(`span`,{className:`ml-1 text-violet-300/55`,children:[`· `,e.targetWorker]}),e.targetTask&&(0,O.jsxs)(`span`,{className:`ml-1 text-sky-300/50`,children:[`· task `,e.targetTask]}),n>1&&(0,O.jsxs)(`span`,{className:`ml-1 rounded bg-white/5 px-1 text-[10px] text-white/25`,children:[`×`,n]}),n===1&&(0,O.jsx)(`span`,{className:`ml-1 break-words`,children:e.filePath??e.command??e.artifactPath??e.detail}),n>1&&(0,O.jsxs)(`details`,{className:`mt-1.5 rounded border border-white/[0.06] bg-black/20 px-2 py-1`,children:[(0,O.jsxs)(`summary`,{className:`cursor-pointer text-[9px] uppercase tracking-wider text-white/25 hover:text-white/45`,children:[`Show `,n,` events`]}),(0,O.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:r.map((e,t)=>(0,O.jsx)(`li`,{className:`mono break-all text-[9px] leading-relaxed text-white/35`,children:e.filePath??e.command??e.artifactPath??e.detail},`${e.ts}:${t}`))})]}),n===1&&e.rawPayload!==void 0&&(0,O.jsxs)(`details`,{className:`mt-1.5 rounded border border-white/[0.06] bg-black/20 px-2 py-1`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer text-[9px] uppercase tracking-wider text-white/25 hover:text-white/45`,children:`Raw event`}),(0,O.jsx)(`pre`,{className:`mono mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-all text-[9px] leading-relaxed text-white/35`,children:JSON.stringify(e.rawPayload,null,2)})]})]})]}),a[i+1]&&e.ts-a[i+1].event.ts>=3e5&&(0,O.jsxs)(`li`,{className:`ml-16 flex items-center gap-2 py-1 text-[9px] uppercase tracking-wider text-white/18`,children:[(0,O.jsx)(`span`,{className:`h-px w-8 bg-white/8`}),`Idle gap · `,Hr(e.ts-a[i+1].event.ts)]})]},`${e.ts}:${i}`))}):(0,O.jsx)(`p`,{className:`rounded-lg border border-dashed border-white/8 py-5 text-center text-xs text-white/25`,children:n===`highlights`?`No semantic activity yet. All provider events remain available under All events.`:`No activity in this category.`})]}):(0,O.jsx)(`p`,{className:`text-sm text-white/40`,children:`No activity yet.`})}var Jr=[{id:`all`,label:`All`},{id:`worker`,label:`Workers`},{id:`tool`,label:`Tools`},{id:`errors`,label:`Errors`},{id:`outputs`,label:`Outputs`}],Yr={normal:`text-amber-200/70`,error:`text-rose-300/80`,attention:`text-rose-200/80`};function Xr({missions:e,onOpenMission:t,limit:n=60}){let[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(`all`),s=Rn(5e3),c=(0,g.useMemo)(()=>{let t=[];for(let n of e){let e=n.recentEvents.filter(e=>Dn(e)&&Vr(e,a));for(let r of e.slice(-12))t.push({event:r,missionId:n.missionId,missionName:n.name,repository:n.mission.repository})}return t.sort((e,t)=>t.event.ts-e.event.ts).slice(0,n)},[a,n,e]);return e.length?(0,O.jsxs)(`section`,{className:`mb-8`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),"aria-expanded":r,className:`mb-3 flex w-full items-center justify-between text-left`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`h2`,{className:`text-sm font-medium uppercase tracking-wide text-white/40`,children:[`Fleet activity `,c.length>0&&(0,O.jsx)(`span`,{className:`ml-1 text-white/20`,children:c.length})]}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-white/25`,children:`Every mission's activity in one stream, newest first.`})]}),(0,O.jsx)(`span`,{className:`rounded-md border border-white/8 px-2 py-1 text-xs text-white/30`,children:r?`−`:`+`})]}),r&&(0,O.jsxs)(`div`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.015] p-3`,children:[(0,O.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,role:`group`,"aria-label":`Fleet activity filters`,children:Jr.map(e=>(0,O.jsx)(`button`,{type:`button`,"aria-pressed":a===e.id,onClick:()=>o(e.id),className:`rounded-full border px-2.5 py-1 text-[10px] transition ${a===e.id?`border-amber-300/25 bg-amber-300/10 text-amber-100/75`:`border-white/8 text-white/30 hover:bg-white/5 hover:text-white/55`}`,children:e.label},e.id))}),c.length===0?(0,O.jsx)(`p`,{className:`rounded-lg border border-dashed border-white/8 py-5 text-center text-xs text-white/25`,children:`No activity in this category.`}):(0,O.jsx)(`ul`,{className:`flex max-h-96 flex-col gap-0.5 overflow-y-auto`,children:c.map(({event:e,missionId:n,missionName:r,repository:i},a)=>{let{verb:o,object:c,full:l,tone:u}=Mn(e);return(0,O.jsx)(`li`,{children:(0,O.jsxs)(`button`,{type:`button`,onClick:()=>t(n),title:l??o,className:`flex w-full min-w-0 items-baseline gap-2 rounded-md px-2 py-1.5 text-left transition hover:bg-white/[0.04]`,children:[(0,O.jsx)(`span`,{className:`mono w-14 shrink-0 truncate text-[10px] text-white/25`,title:i,children:i?tt(i):``}),(0,O.jsx)(`span`,{className:`w-28 shrink-0 truncate text-[11px] font-medium text-white/70`,children:r}),(0,O.jsx)(`span`,{className:`shrink-0 text-[11px] ${Yr[u]}`,children:o}),c&&(0,O.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-[11px] text-white/35`,children:c}),(0,O.jsx)(`span`,{className:`mono ml-auto shrink-0 text-[10px] text-white/22`,children:Bn(s-e.ts)})]})},`${n}:${e.ts}:${a}`)})})]})]}):null}var Zr={needsMe:`text-rose-300/85 hover:text-rose-200`,working:`text-amber-200/75 hover:text-amber-100`,idle:`text-white/40 hover:text-white/70`,done:`text-emerald-300/60 hover:text-emerald-200`};function Qr({snapshot:e,onFilter:t}){let n=an(e);return n.length?(0,O.jsx)(`p`,{className:`mt-0.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs`,children:n.map((e,n)=>(0,O.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[n>0&&(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`text-white/12`,children:`·`}),(0,O.jsxs)(`button`,{type:`button`,onClick:()=>t(e.filter),title:`Show only missions that are ${e.label}`,className:`transition ${Zr[e.key]}`,children:[(0,O.jsx)(`span`,{className:`font-medium`,children:e.count}),` `,e.label]})]},e.key))}):(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-white/35`,children:`No missions yet`})}var $r=`mx-auto w-full max-w-[1800px] px-4 sm:px-6 lg:px-8`,ei=`hive:last-seen`;function ti(){if(typeof window>`u`)return Date.now();let e=Number(localStorage.getItem(ei));return Number.isFinite(e)&&e>0?e:Date.now()}function ni(e=Date.now()){try{localStorage.setItem(ei,String(e))}catch{}}function ri(e,t){let n=new Set,r=0,i=0;for(let a of e.orchestrators)a.updatedAt<=t||(n.add(a.missionId),a.createdAt>t&&(i+=1),(a.lifecycleStatus===`ready_for_review`||a.lifecycleStatus===`failed`||a.activityStatus===`waiting_on_you`)&&(r+=1));return{missionIds:n,needingAttention:r,started:i}}function ii(e,t){let n=e.missionIds.size;if(!n)return;let r=[`${n} mission${n===1?``:`s`} moved`];if(e.started&&r.push(`${e.started} started`),e.needingAttention&&r.push(`${e.needingAttention} needing you`),n===1){let n=t.find(t=>e.missionIds.has(t.missionId));if(n)return`${n.name} moved while you were away`}return`${r.join(` · `)} while you were away`}var ai={missionIds:new Set,needingAttention:0,started:0};function oi(e){let[t,n]=(0,g.useState)(),r=(0,g.useRef)();(0,g.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{if(document.visibilityState===`hidden`){r.current=Date.now(),ni();return}(r.current?Date.now()-r.current:0)>=6e4&&n(ti()),r.current=void 0},t=ti();return Date.now()-t>=6e4&&n(t),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let i=(0,g.useMemo)(()=>e&&t?ri(e,t):ai,[t,e]);return{changes:i,dismiss:(0,g.useCallback)(()=>{ni(),n(void 0)},[]),active:!!t&&i.missionIds.size>0}}var si=[{title:`On the board`,scope:`board`,note:`The board's own keys. A mission's page has its own set below; ? and Esc are the two that answer from either.`,shortcuts:[{keys:[`⌘`,`K`],description:`Go to a mission, or run a command`},{keys:[`/`],description:`Filter missions by name or repository`},{keys:[`i`],description:`Type a quick mission`},{keys:[`n`],description:`New mission, with all options`},{keys:[`?`],description:`This list`},{keys:[`Esc`],description:`Back out of whatever is open`}]},{title:`Move around`,scope:`board`,note:`vim's own axes: h and l run along the row of missions, j and k move the page.`,shortcuts:[{keys:[`h`],description:`Previous mission (left)`},{keys:[`l`],description:`Next mission (right)`},{keys:[`j`],description:`Scroll down`},{keys:[`k`],description:`Scroll up`},{keys:[`Enter`],description:`Open the focused mission`},{keys:[`o`],description:`Open it as a full page`},{keys:[`[`,`]`],description:`Previous or next panel tab`}]},{title:`Act on the focused mission`,scope:`board`,note:`a and d do whatever the mission is asking of you — the button shows which.`,shortcuts:[{keys:[`a`],description:`Affirm — approve the request, or accept the work`},{keys:[`d`],description:`Decline — deny the request, or request changes`},{keys:[`r`],description:`Reply`},{keys:[`p`],description:`Pause, or resume`},{keys:[`s`],description:`Select for a bulk action`}]},{title:`Act on the selection`,scope:`board`,note:`Shift means the selection. Archive and Delete arm their confirmation rather than firing — nothing irreversible happens on a keystroke.`,shortcuts:[{keys:[`⇧`,`C`],description:`Complete every selected mission`},{keys:[`⇧`,`P`],description:`Pause every selected mission`},{keys:[`⇧`,`A`],description:`Archive the selection — asks first`},{keys:[`⇧`,`⌫`],description:`Delete the selection — asks first`},{keys:[`⏎`],description:`Confirm the armed action`},{keys:[`Esc`],description:`Back out of a confirmation, then clear the selection`}]},{title:`On a mission's page`,scope:`mission`,note:`o opens a mission full width. The same keys act on it there — h and l change unit, walking the missions still yours to do rather than a row of cards, and g goes somewhere on the page.`,shortcuts:[{keys:[`a`],description:`Affirm — the button in the bar shows what it will do`},{keys:[`d`],description:`Decline`},{keys:[`r`],description:`Jump to the composer`},{keys:[`p`],description:`Pause, or resume`},{keys:[`h`],description:`Previous active mission`},{keys:[`l`],description:`Next active mission`},{keys:[`j`],description:`Scroll down`},{keys:[`k`],description:`Scroll up`},{keys:[`?`],description:`This list`},{keys:[`⇧`,`L`],description:`Next mission that needs you`},{keys:[`⇧`,`H`],description:`Previous mission that needs you`},{keys:[`g`,`c`],description:`Go to the conversation`},{keys:[`g`,`w`],description:`Go to what is happening now`},{keys:[`g`,`p`],description:`Go to the plan`},{keys:[`g`,`d`],description:`Go to diagnostics`},{keys:[`g`,`g`],description:`Go to the top`},{keys:[`1`,`…`,`9`],description:`Answer the open question with the nth choice`},{keys:[`Esc`],description:`Back to the fleet`}]},{title:`Needs you`,scope:`board`,note:`t enters focused triage. While it is active, j/k move through the queue instead of scrolling the page; Esc gives them back.`,shortcuts:[{keys:[`t`],description:`Open Needs you and start triage`},{keys:[`1`,`…`,`9`],description:`Focus the nth item — a or d then acts on it`},{keys:[`Enter`],description:`Open the focused item's mission`},{keys:[`Esc`],description:`Exit focused triage`},{keys:[`0`],description:`Fold the rail away, or bring it back`}]},{title:`In Terminal input`,scope:`mission`,note:`Terminal input never forwards browser shortcuts or raw control keys. Interrupt turn is an explicit button and does not stop the mission.`,shortcuts:[{keys:[`Enter`],description:`Send input or a provider follow-up`},{keys:[`⇧`,`Enter`],description:`Insert a new line`},{keys:[`Esc`],description:`Leave the input before using mission shortcuts`}]}],ci=new Set([`h`]),li=new Set([`l`]),ui=new Set([`k`]),di=new Set([`j`]);function fi({open:e,onClose:t}){return Ke(e,ze.modal,t),e?(0,O.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Keyboard shortcuts`,className:`fixed inset-0 z-50 flex items-start justify-center bg-black/55 px-4 pt-[14vh] backdrop-blur-sm`,onClick:t,children:(0,O.jsxs)(`div`,{className:`w-full max-w-lg overflow-hidden rounded-xl border border-white/12 bg-[#141419] shadow-2xl shadow-black/60`,onClick:e=>e.stopPropagation(),children:[(0,O.jsxs)(`div`,{className:`flex items-baseline justify-between border-b border-white/[0.08] px-5 py-3.5`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white/85`,children:`Keyboard shortcuts`}),(0,O.jsx)(`button`,{type:`button`,onClick:t,className:`text-[11px] text-white/35 transition hover:text-white/70`,children:`Esc to close`})]}),(0,O.jsx)(`div`,{className:`max-h-[60vh] overflow-y-auto px-5 py-4`,children:si.map(e=>(0,O.jsxs)(`section`,{className:`mb-5 last:mb-0`,children:[(0,O.jsx)(`h3`,{className:`text-[9px] font-semibold uppercase tracking-[0.16em] text-amber-200/55`,children:e.title}),e.note&&(0,O.jsx)(`p`,{className:`mb-2 mt-1 text-[11px] leading-relaxed text-white/30`,children:e.note}),!e.note&&(0,O.jsx)(`div`,{className:`mb-2`}),(0,O.jsx)(`dl`,{className:`flex flex-col gap-1.5`,children:e.shortcuts.map(e=>(0,O.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4`,children:[(0,O.jsx)(`dt`,{className:`text-xs text-white/55`,children:e.description}),(0,O.jsx)(`dd`,{className:`flex shrink-0 items-center gap-1`,children:e.keys.map(e=>(0,O.jsx)(`kbd`,{className:e===`…`?`text-[10px] text-white/25`:`mono rounded border border-white/[0.14] bg-white/[0.04] px-1.5 py-0.5 text-[10px] text-white/60`,children:e},e))})]},e.description))})]},e.title))})]})}):null}var pi=`[data-mission-card]`,mi=`[data-fleet-search]`,hi=`[data-quick-ask]`;function gi(e){let{enabled:t,onNewMission:n,onShowHelp:r,onFocusMission:i,activeMissionId:a,onAffirm:o,onDecline:s,onReply:c,onPauseToggle:l,onOpenFull:u,onToggleSelect:d,onCycleTab:f}=e;(0,g.useEffect)(()=>{if(!t||typeof window>`u`)return;let e=e=>{if(e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||yt(e.target))return;if(e.key===`?`){if(!r)return;e.preventDefault(),r();return}if(e.shiftKey)return;if(e.key===`[`||e.key===`]`){if(!f)return;e.preventDefault(),f(e.key===`]`?1:-1);return}if(e.key===`/`){let t=document.querySelector(mi);if(!t)return;e.preventDefault(),t.focus(),t.select();return}let t=e.key.toLowerCase();if(t===`i`){let t=document.querySelector(hi);if(!t)return;e.preventDefault(),t.focus(),t.setSelectionRange(t.value.length,t.value.length);return}let p=document.activeElement?.closest(pi),m=a??p?.getAttribute(`data-mission-card`)??void 0,h={a:o,d:s,r:c,p:l,o:u,s:d}[t];if(h){if(!m)return;e.preventDefault(),h(m);return}if(t===`n`){if(!n)return;e.preventDefault(),n();return}if(di.has(t)||ui.has(t)){e.preventDefault(),window.scrollBy?.({top:di.has(t)?160:-160});return}let g=ci.has(t);if(!g&&!li.has(t))return;let _=[...document.querySelectorAll(pi)];if(!_.length)return;e.preventDefault();let v=p?_.indexOf(p):-1,y=v===-1?g?_.length-1:0:Math.min(_.length-1,Math.max(0,v+(g?-1:1)));_[y].focus(),_[y].scrollIntoView?.({block:`nearest`});let b=_[y].getAttribute(`data-mission-card`);b&&i?.(b)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,e])}var _i=`hive:fleet-filters`;function vi(){if(typeof window>`u`)return Yt;try{return yi(JSON.parse(localStorage.getItem(`hive:fleet-filters`)??`null`))}catch{return Yt}}function yi(e){if(!e||typeof e!=`object`||Array.isArray(e))return Yt;let t=e,n=e=>typeof t[e]==typeof Yt[e]?t[e]:Yt[e];return{...Yt,query:n(`query`),queryScope:t.queryScope===`all`?`all`:`name`,status:n(`status`),repository:n(`repository`),template:n(`template`),date:n(`date`),needsMe:n(`needsMe`)}}function bi(e){try{localStorage.setItem(_i,JSON.stringify(e))}catch{}}var xi={decision:0,failure:1,stale:1,acceptance:2,plan_approval:3,stall:4};function Si(e){return e.kind===`destructive`||e.kind===`permission`?0:e.kind===`merge`||e.kind===`scope`?1:2}function Ci(e,t=e.orchestrators){let n=new Map(t.map(e=>[e.missionId,e])),r=[];for(let t of e.decisions??[])n.has(t.missionId)&&r.push({id:`decision:${t.id}`,kind:`decision`,missionId:t.missionId,missionName:t.missionName,repository:t.repository,summary:t.question,decision:t,lifecycle:n.get(t.missionId).lifecycleStatus,pending:[{id:t.id,choices:t.choices}],createdAt:t.createdAt,context:t.context??t.missionObjective,impact:t.impact});for(let e of t){let t={missionId:e.missionId,missionName:e.name,repository:e.mission.repository,lifecycle:e.lifecycleStatus,pending:[],createdAt:e.updatedAt,context:e.detail??e.intent,evidence:[...(e.alerts??[]).flatMap(e=>[e.evidence,e.recovery]),...e.plan?.gates.flatMap(e=>e.evidence)??[]].filter(Boolean).slice(0,4),unresolvedGates:e.plan?.gates.filter(e=>e.required&&e.status!==`satisfied`&&e.status!==`waived`).map(e=>({id:e.id,label:e.label}))};if(e.lifecycleStatus===`ready_for_review`){let n=e.plan?.gates.filter(e=>e.required)??[],i=n.filter(e=>e.status===`satisfied`||e.status===`waived`).length;r.push({...t,id:`acceptance:${e.missionId}`,kind:`acceptance`,summary:n.length?`Ready for acceptance · ${i}/${n.length} gates satisfied`:`Ready for acceptance`})}if(ct(e)&&r.push({...t,id:`plan:${e.missionId}`,kind:`plan_approval`,summary:`Plan revision ${e.plan?.revision} is waiting for your approval`}),e.lifecycleStatus===`failed`||e.activityStatus===`error`){let n=$e(e.alerts??[])[0],i=e.lifecycleStatus===`failed`;r.push({...t,id:`failure:${e.missionId}`,kind:i?`failure`:`stale`,summary:n?`${n.title} · ${n.evidence}`:i?`The mission failed and needs a decision`:`The mission's job state has gone stale`})}else if(e.activityStatus===`stalled`){let n=$e(e.alerts??[])[0];r.push({...t,id:`stall:${e.missionId}`,kind:`stall`,summary:n?n.title:`Expected work has stopped producing activity`})}}return r.sort((e,t)=>{let n=xi[e.kind]-xi[t.kind];if(n!==0)return n;if(e.decision&&t.decision){let n=Si(e.decision)-Si(t.decision);if(n!==0)return n}return e.createdAt-t.createdAt})}var wi=[{mode:`grid`,icon:`▦`,label:`Grid`,title:`One card per mission`},{mode:`list`,icon:`☰`,label:`List`,title:`Two-line rows — fits many more missions on screen`},{mode:`office`,icon:`⌂`,label:`Office`,title:`The isometric floor, with missions at desks`}];function Ti(e,t){return e===`office`?`office`:t===`compact`?`list`:`grid`}function Ei({value:e,onChange:t}){return(0,O.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/[0.08] bg-black/20 p-1`,role:`group`,"aria-label":`Board view`,children:wi.map(({mode:n,icon:r,label:i,title:a})=>(0,O.jsxs)(`button`,{type:`button`,"aria-pressed":e===n,title:a,onClick:()=>t(n),className:`rounded-md px-3 py-1.5 text-xs font-medium transition ${e===n?`bg-amber-300/[0.12] text-amber-100/80 shadow-sm`:`text-white/35 hover:bg-white/[0.04] hover:text-white/60`}`,children:[r,` `,i]},n))})}var Di={tileWidth:58,tileHeight:52,skewX:-16,riseX:7,originX:140,originY:90};function Y(e,t,n=0,r=Di){return{x:r.originX+e*r.tileWidth+t*r.skewX,y:r.originY+e*r.riseX+t*r.tileHeight-n}}function Oi(e,t=0){return[Y(e.x,e.y,t),Y(e.x+e.width,e.y,t),Y(e.x+e.width,e.y+e.depth,t),Y(e.x,e.y+e.depth,t)]}function X(e){return e.map(({x:e,y:t})=>`${e},${t}`).join(` `)}function ki(e,t=0){return Y(e.x+e.width/2,e.y+e.depth/2,t)}var Ai=5,ji={width:4.2,depth:2.8},Mi=[[.58,.82],[1.78,.92],[2.78,.92],[1.55,1.78],[2.65,1.78]];function Ni(e){return Mi.map(([t,n])=>[e.x+t/ji.width*e.width,e.y+n/ji.depth*e.depth])}var Pi=[{id:`direct-studio`,label:`Direct studio`,shortLabel:`DIRECT STUDIO`,kind:`direct`,capacity:8,x:0,y:0,width:3.5,depth:6.3},{id:`standard-a`,label:`Orchestration room A`,shortLabel:`ORCH A`,kind:`standard`,capacity:Ai,x:3.5,y:0,width:4.2,depth:2.8},{id:`standard-b`,label:`Orchestration room B`,shortLabel:`ORCH B`,kind:`standard`,capacity:Ai,x:7.7,y:0,width:4.2,depth:2.8},{id:`standard-c`,label:`Orchestration room C`,shortLabel:`ORCH C`,kind:`standard`,capacity:Ai,x:3.5,y:3.5,width:4.2,depth:2.8},{id:`review`,label:`Review hall`,shortLabel:`REVIEW HALL`,kind:`large`,capacity:8,x:7.7,y:3.5,width:4.2,depth:2.8}],Fi=11.9/3,Ii=[...[`a`,`b`,`c`].map((e,t)=>({id:`standard-${e}`,label:`Orchestration room ${e.toUpperCase()}`,shortLabel:`ORCH ${e.toUpperCase()}`,kind:`standard`,capacity:Ai,x:t*Fi,y:0,width:Fi,depth:2.8})),...[`d`,`e`,`f`].map((e,t)=>({id:`standard-${e}`,label:`Orchestration room ${e.toUpperCase()}`,shortLabel:`ORCH ${e.toUpperCase()}`,kind:`standard`,capacity:Ai,x:t*Fi,y:3.5,width:Fi,depth:2.8}))],Li=e=>e===`operations`?Ii:Pi,Ri=e=>e>0&&e<1e3?`operations`:`headquarters`,Z=e=>e===0?`Headquarters`:e>=1e3?`Headquarters annex ${e-999}`:`Operations ${e}`,zi=[`#f0c7a3`,`#dca77e`,`#b97855`,`#87543d`,`#68402f`],Bi=[`#211b1a`,`#51372a`,`#875f35`,`#c1a17a`,`#3b3037`],Vi=[`#42667a`,`#65527d`,`#477164`,`#80595b`,`#6d6547`],Hi=[`short`,`side`,`crop`,`long`,`ponytail`,`bun`,`curls`],Ui=[`tee`,`hoodie`,`jacket`,`sweater`];function Wi(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Gi(e){let t=Wi(e);return{skin:zi[t%zi.length],hair:Bi[(t>>>4)%Bi.length],clothing:Vi[(t>>>8)%Vi.length],variant:(t>>>12)%3,hairStyle:Hi[(t>>>14)%Hi.length],outfit:Ui[(t>>>18)%Ui.length],offset:t%1200,gesture:(t>>>22)%2?`notes`:`monitor`}}function Ki(e){return!!e.doneAt}function qi(e){return!Ki(e)}function Ji(e,t){return e.jobState===`failed`||e.jobState===`error`?`failed`:Ki(e)?`completed`:t.lifecycleStatus===`paused`?`paused`:e.jobState===`blocked`?`blocked`:e.jobState===`failed`||e.jobState===`error`?`failed`:e.jobState===`working`||e.jobState===`busy`?`working`:`idle`}function Yi(e){return e.lifecycleStatus===`paused`?`paused`:e.lifecycleStatus===`failed`||e.activityStatus===`error`?`failed`:e.activityStatus===`stalled`?`blocked`:e.activityStatus===`waiting_on_you`?`waiting`:e.activityStatus===`working`||e.messages.at(-1)?.role===`user`?`working`:`idle`}function Xi(e,t,n=4){let r={...t},i=e=>e.slice(0,e.lastIndexOf(`:`)),a=new Map,o=(e,t)=>{let n=i(e),r=a.get(n)??new Set;r.add(t),a.set(n,r)};for(let[e,n]of Object.entries(t))o(e,n);for(let[t,s]of Object.entries(e)){if(r[t]!==void 0)continue;let e=a.get(i(t))??new Set,c=e.has(s)?Array.from({length:n},(e,t)=>t).find(t=>!e.has(t)):s;c!==void 0&&(r[t]=c,o(t,c))}return r}function Zi(e,t){let n={};for(let r of e.filter(e=>e.kind===`orchestrated`)){let e=r.mission.workers.filter(qi).sort((e,t)=>e.startedAt-t.startedAt||e.id.localeCompare(t.id)),i=new Set;for(let a of e){let e=`${r.mission.missionId}:${a.id}`,o=t[e];Number.isInteger(o)&&o>=0&&o<4&&!i.has(o)&&(n[e]=o,i.add(o))}for(let t of e){let e=`${r.mission.missionId}:${t.id}`;if(n[e]!==void 0)continue;let a=Array.from({length:4},(e,t)=>t).find(e=>!i.has(e));a!==void 0&&(n[e]=a,i.add(a))}}return n}function Qi(e,t){let n=Object.entries(e);return n.length===Object.keys(t).length&&n.every(([e,n])=>t[e]===n)}function $i(e,t=6){let n=[];for(let t of e)if(Yi(t.mission)===`working`&&n.push(t.mission.missionId),t.kind===`orchestrated`)for(let e of t.mission.workers.filter(qi))Ji(e,t.mission)===`working`&&n.push(`${t.mission.missionId}:${e.id}`);return new Set(n.sort((e,t)=>Wi(e)-Wi(t)||e.localeCompare(t)).slice(0,Math.max(0,t)))}function ea(e,t){return e.targetWorker?vn(e.targetWorker,t):e.jobId===t.jobId}function ta(e){if(!e)return;if(e.outcome===`failure`)return`failed`;let t=`${e.activityKind??``} ${e.toolName??``} ${e.detail} ${e.filePath??``}`.toLowerCase();return e.activityKind===`test`?e.outcome===`success`?`active`:`testing`:/\b(spec|vitest|jest|playwright|pytest)\b/.test(`${e.toolName??``} ${e.command??``}`.toLowerCase())?`testing`:/websearch|webfetch|browser|https?:|research|documentation lookup/.test(t)?`research`:e.activityKind===`file_write`||/write|edit|patch|document|markdown|readme/.test(t)?`writing`:`active`}function na(e,t){if(!e)return`vacant`;let n=t?Ji(t,e):Yi(e);return n===`failed`?`failed`:n===`waiting`||n===`blocked`?`waiting`:n===`idle`||n===`paused`||n===`completed`?`idle`:ta((t?e.recentEvents.filter(e=>ea(e,t)):e.recentEvents.filter(t=>!e.workers.some(e=>ea(t,e)))).at(-1))??`active`}function ra(e,t){return t===`room-activate`||t===`desk-reserved`||t===`entering`?`idle`:t===`arrived`||t===`working`?`active`:(t===`reporting`||t===`exiting`)&&e!==`failed`||(t===`moving-to-review`||t===`awaiting-acceptance`)&&e!==`failed`?`test-passed`:e}function ia(e,t,n,r){let i=n===`working`||n===`arrived`?`working`:r??(t?Ji(t,e):Yi(e)),a=i===`completed`&&t&&n!==`reporting`&&n!==`exiting`,o=!t&&(e.lifecycleStatus===`ready_for_review`||e.lifecycleStatus===`completed`||n===`moving-to-review`||n===`awaiting-acceptance`||bn(e))&&e.activityStatus!==`error`,s=ra(na(e,t),n);return{state:o?`completed`:a?`idle`:i,monitor:o&&s!==`failed`?`test-passed`:s}}function aa(e){return e.length?e.some(e=>e.lifecycleStatus===`failed`||e.activityStatus===`error`)?`failed`:e.some(e=>e.activityStatus===`stalled`)?`blocked`:e.some(e=>e.activityStatus===`waiting_on_you`)?`waiting`:e.some(e=>e.lifecycleStatus===`ready_for_review`)?`review`:e.some(e=>Yi(e)===`working`||e.workers.some(t=>qi(t)&&Ji(t,e)===`working`))?`active`:e.every(e=>e.lifecycleStatus===`paused`)?`paused`:`idle`:`vacant`}var oa={vacant:`#77717e`,idle:`#8b8792`,active:`#f1c75b`,waiting:`#f472b6`,blocked:`#fb923c`,failed:`#fb7185`,review:`#e6bd62`,paused:`#7dd3fc`};function sa(e,t,n=`worker`){let r=n===`manager`;return{x:e,y:t,width:r?.88:.72,depth:r?.52:.46}}function ca(e,t,n=`worker`){let r=sa(e,t,n),i=Oi(r,17),a=Oi(r,0);return X([i[0],i[1],i[2],a[2],a[3],i[3]])}function la({x:e,y:t,role:n=`worker`,occupied:r=!1,visualState:i,monitor:a=r?`active`:`vacant`,transition:o,selected:s=!1}){let c=n===`manager`,l=o===`room-activate`||o===`entering`||o===`desk-reserved`||o===`exiting`||o===`accepted-completion`,u=l?`idle`:i,d=l?`idle`:a,f=c?`#856a43`:n===`direct`?`#536b67`:`#7c6a53`,p=Oi(sa(e,t,n),17),m=p[3],h=p[2],g=Oi({x:e+.18,y:t+.29,width:.28,depth:.1},19),_=Y(e+.54,t+.34,19),v=u===`working`?`#f1c75b`:u===`idle`?`#8b8792`:u===`waiting`?`#f472b6`:u===`completed`?`#4ade80`:u===`blocked`?`#fb923c`:u===`failed`?`#fb7185`:`#7dd3fc`;return(0,O.jsxs)(`g`,{"aria-hidden":`true`,"data-seat-role":n,"data-seat-occupied":r?`true`:`false`,"data-seat-state":u,"data-office-monitor":d,"data-seat-selected":s?`true`:void 0,"data-office-transition":o,className:s?`office-station-selected`:void 0,filter:s?`url(#direct-station-glow)`:void 0,children:[s&&(0,O.jsx)(`polygon`,{points:X(p),fill:`#55c7b3`,fillOpacity:`.18`,stroke:`#6ee7d2`,strokeOpacity:`.8`,strokeWidth:`3`}),(0,O.jsx)(`polygon`,{points:X(p),fill:f,stroke:r?v:c?`#e6bd62`:`#bda77e`,strokeOpacity:r?`.9`:c?`.58`:`.25`,strokeWidth:s?2.4:r?2:c?1.5:1}),(0,O.jsx)(`polygon`,{points:X(g),fill:`#242831`,stroke:`#9eb6c0`,strokeOpacity:`.35`}),(0,O.jsx)(`path`,{d:`M ${g[0].x+4} ${g[0].y+1}l14 2`,stroke:`#d7dde2`,strokeOpacity:`.18`}),(0,O.jsxs)(`g`,{transform:`rotate(7 ${_.x} ${_.y})`,children:[(0,O.jsx)(`rect`,{x:_.x-3.6,y:_.y-2.6,width:`7.2`,height:`5.2`,rx:`2.5`,fill:`#252a31`,stroke:`#9eb6c0`,strokeOpacity:`.38`}),(0,O.jsx)(`path`,{d:`M ${_.x} ${_.y-2}v2.2`,stroke:`#9eb6c0`,strokeOpacity:`.5`,strokeWidth:`.8`})]}),(0,O.jsx)(`polygon`,{points:`${m.x},${m.y} ${h.x},${h.y} ${h.x},${h.y+12} ${m.x},${m.y+12}`,fill:c?`#463824`:`#342b24`}),(0,O.jsx)(`path`,{d:`M ${m.x+4} ${m.y+9}v20 M ${h.x-4} ${h.y+9}v20`,stroke:`#28252a`,strokeWidth:`4`}),(0,O.jsx)(ha,{x:e+(c?.43:.35),y:t+.22,activity:d,color:v}),(0,O.jsx)(ua,{x:e+.17,y:t+(c?.63:.57),facing:`south`,seatType:c?`manager`:n===`direct`?`direct`:`worker`,occupied:r})]})}function ua({x:e,y:t,facing:n,seatType:r=`review`,occupied:i=!1}){let a=r===`manager`,o=a?{x:e-.04,y:t-.025,width:.46,depth:.35}:{x:e,y:t,width:.38,depth:.3},s=Oi(o,8),c=ki(o,8),l=n===`north`?[s[0],s[1]]:n===`south`?[s[3],s[2]]:n===`west`?[s[0],s[3]]:[s[1],s[2]],u=a?27:19,d=[l[0],l[1],{x:l[1].x,y:l[1].y-u},{x:l[0].x,y:l[0].y-u}],f=r===`review`?{"data-review-seat":i?`occupied`:`empty`}:r===`manager`?{"data-manager-seat":i?`occupied`:`empty`}:r===`direct`?{"data-direct-seat":i?`occupied`:`empty`}:{"data-worker-seat":i?`occupied`:`empty`},p=r===`review`?`#443849`:a?`#34343b`:r===`direct`?`#2f4140`:`#302f38`,m=r===`review`?`#5b4960`:a?`#484850`:r===`direct`?`#3c5753`:`#41404b`;return(0,O.jsxs)(`g`,{"aria-hidden":`true`,...f,children:[(0,O.jsx)(`polygon`,{points:X(s),fill:p,stroke:a?`#d5d1c8`:`#cbb6d0`,strokeOpacity:a?`.48`:`.25`}),(0,O.jsx)(`polygon`,{points:X(d),fill:m,stroke:a?`#d5d1c8`:`#ddd2e0`,strokeOpacity:a?`.48`:`.42`,strokeWidth:a?1.5:1}),a&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`path`,{d:`M ${s[0].x} ${s[0].y-1}v-7M ${s[0].x} ${s[0].y-7}l${s[3].x-s[0].x} ${s[3].y-s[0].y}`,stroke:`#b9b5ad`,strokeWidth:`2.5`,strokeLinecap:`round`}),(0,O.jsx)(`path`,{d:`M ${s[1].x} ${s[1].y-1}v-7M ${s[1].x} ${s[1].y-7}l${s[2].x-s[1].x} ${s[2].y-s[1].y}`,stroke:`#b9b5ad`,strokeWidth:`2.5`,strokeLinecap:`round`})]}),(0,O.jsx)(`path`,{d:`M ${c.x} ${c.y+3}v11M ${c.x-8} ${c.y+14}h16M ${c.x-6} ${c.y+14}l-4 4M ${c.x+6} ${c.y+14}l4 4`,stroke:`#25242b`,strokeWidth:`2`,strokeLinecap:`round`}),(0,O.jsx)(`circle`,{cx:c.x,cy:c.y+14,r:`2.5`,fill:`#292830`})]})}function da({x:e,y:t,occupiedCount:n=0,dimmedSeatIndexes:r=new Set}){let i={x:e+.78,y:t+.82,width:2.55,depth:1.12},a=Oi(i,15),o=a[3],s=a[2],c=[[.82,.38],[1.47,.38],[2.12,.38],[2.77,.38],[.82,2.16],[1.47,2.16],[2.12,2.16],[2.77,2.16]];return(0,O.jsxs)(`g`,{"aria-hidden":`true`,children:[c.slice(0,4).map(([i,a],o)=>(0,O.jsx)(`g`,{"data-filter-match":o<n?String(!r.has(o)):void 0,opacity:r.has(o)?.2:1,children:(0,O.jsx)(ua,{x:e+i,y:t+a,facing:`north`,occupied:o<n})},`north-${o}`)),(0,O.jsx)(`polygon`,{points:X(a),fill:`#6e5947`,stroke:`#e6bd62`,strokeOpacity:`.34`}),(0,O.jsx)(`polygon`,{points:`${o.x},${o.y} ${s.x},${s.y} ${s.x},${s.y+11} ${o.x},${o.y+11}`,fill:`#352b27`}),(0,O.jsx)(`path`,{d:`M ${o.x+14} ${o.y+8}v16M ${s.x-14} ${s.y+8}v16`,stroke:`#29252a`,strokeWidth:`5`}),(0,O.jsx)(`path`,{d:`M ${ki(i,16).x-22} ${ki(i,16).y}h44`,stroke:`#e6bd62`,strokeOpacity:`.16`,strokeWidth:`2`}),(0,O.jsxs)(`g`,{transform:`rotate(6.88 ${ki(i,18).x} ${ki(i,18).y})`,children:[(0,O.jsx)(`rect`,{x:ki(i,18).x-16,y:ki(i,18).y-8,width:`32`,height:`16`,rx:`8`,fill:`#242831`,stroke:`#b8c2cb`,strokeOpacity:`.32`}),(0,O.jsx)(`circle`,{cx:ki(i,18).x-6,cy:ki(i,18).y,r:`2`,fill:`#101318`}),(0,O.jsx)(`circle`,{cx:ki(i,18).x,cy:ki(i,18).y,r:`2`,fill:`#101318`}),(0,O.jsx)(`circle`,{cx:ki(i,18).x+6,cy:ki(i,18).y,r:`2`,fill:`#101318`}),(0,O.jsx)(`circle`,{cx:ki(i,18).x+12,cy:ki(i,18).y-3,r:`1.5`,fill:`#55c7b3`,opacity:`.7`})]}),c.slice(4).map(([i,a],o)=>{let s=o+4;return(0,O.jsx)(`g`,{"data-filter-match":s<n?String(!r.has(s)):void 0,opacity:r.has(s)?.2:1,children:(0,O.jsx)(ua,{x:e+i,y:t+a,facing:`south`,occupied:s<n})},`south-${o}`)})]})}function fa({x:e,y:t}){let n=Y(e,t,5),r=Y(e+.7,t,5),i=Y(e,t,28),a=Y(e+.7,t,28),o=Y(e,t,13),s=Y(e+.7,t,13),c=Y(e,t,21),l=Y(e+.7,t,21);return(0,O.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,O.jsx)(`polygon`,{points:X([n,r,a,i]),fill:`#29272d`,stroke:`#9c8b70`,strokeOpacity:`.34`}),(0,O.jsx)(`path`,{d:`M ${o.x} ${o.y}L ${s.x} ${s.y}M ${c.x} ${c.y}L ${l.x} ${l.y}`,stroke:`#8d7657`,strokeOpacity:`.5`}),(0,O.jsx)(`path`,{d:`M ${i.x+9} ${i.y+8}v7M ${i.x+17} ${i.y+9}v6M ${i.x+25} ${i.y+7}v8`,stroke:`#55c7b3`,strokeOpacity:`.42`,strokeWidth:`4`})]})}function pa({x:e,y:t}){let n=Y(e,t,5),r=Y(e+.82,t,5),i=Y(e,t,28),a=Y(e+.82,t,28);return(0,O.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,O.jsx)(`polygon`,{points:X([n,r,a,i]),fill:`#d8d5cf`,fillOpacity:`.1`,stroke:`#a78bfa`,strokeOpacity:`.42`}),(0,O.jsx)(`path`,{d:`M ${i.x+10} ${i.y+10}l18 2M ${i.x+9} ${i.y+17}l31 4M ${i.x+8} ${i.y+24}l14 2`,stroke:`#a78bfa`,strokeOpacity:`.3`,strokeWidth:`2`})]})}function ma({x:e,y:t}){let n={x:e,y:t,width:.62,depth:.48},r=Oi(n),i=Oi(n,18),a={x:e+.12,y:t+.1,width:.38,depth:.26},o=Oi(a,18),s=Oi(a,33),c=ki(a,25);return(0,O.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,O.jsx)(`polygon`,{points:X([i[3],i[2],r[2],r[3]]),fill:`#382f2a`}),(0,O.jsx)(`polygon`,{points:X([i[1],i[2],r[2],r[1]]),fill:`#2d2928`}),(0,O.jsx)(`polygon`,{points:X(i),fill:`#65513e`,stroke:`#c4a77d`,strokeOpacity:`.3`}),(0,O.jsx)(`polygon`,{points:X([s[3],s[2],o[2],o[3]]),fill:`#171a20`}),(0,O.jsx)(`polygon`,{points:X([s[1],s[2],o[2],o[1]]),fill:`#11141a`}),(0,O.jsx)(`polygon`,{points:X(s),fill:`#292d35`,stroke:`#55c7b3`,strokeOpacity:`.3`}),(0,O.jsx)(`circle`,{cx:c.x+6,cy:c.y-2,r:`2`,fill:`#e6bd62`,opacity:`.65`}),(0,O.jsx)(`path`,{d:`M ${c.x} ${c.y+4}v7h6`,stroke:`#b7a58d`,strokeOpacity:`.5`,strokeWidth:`2`}),(0,O.jsx)(`ellipse`,{cx:c.x+6,cy:c.y+12,rx:`5`,ry:`2.5`,fill:`#d7d2c8`,fillOpacity:`.45`})]})}function ha({x:e,y:t,activity:n=`vacant`,color:r=`#f1c75b`}){let i=Y(e,t,24),a=n!==`vacant`&&n!==`idle`,o=n===`failed`?`#fb7185`:n===`waiting`?`#f4b942`:n===`test-passed`?`#4ade80`:r;return(0,O.jsxs)(`g`,{"aria-hidden":`true`,"data-monitor-activity":n,children:[(0,O.jsx)(`rect`,{x:i.x-10,y:i.y-17,width:`20`,height:`14`,rx:`2`,fill:`#151921`,stroke:a?o:`#8bb5c8`,strokeOpacity:a?`.8`:`.3`}),(0,O.jsx)(`rect`,{x:i.x-7,y:i.y-14,width:`14`,height:`8`,rx:`1`,fill:a?o:`#53616a`,opacity:a?`.2`:`.11`}),n===`active`&&(0,O.jsx)(`path`,{d:`M ${i.x-5} ${i.y-12}h8M ${i.x-5} ${i.y-9}h11M ${i.x-5} ${i.y-6}h6`,stroke:o,strokeWidth:`1`,opacity:`.75`,className:`office-monitor-scroll`}),n===`writing`&&(0,O.jsx)(`path`,{d:`M ${i.x-5} ${i.y-12}h10M ${i.x-5} ${i.y-9}h7M ${i.x-5} ${i.y-6}h11`,stroke:`#d9e2ea`,strokeWidth:`1`,opacity:`.62`}),n===`research`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:i.x-5.5,y:i.y-12.5,width:`11`,height:`6.5`,rx:`.8`,fill:`none`,stroke:`#7dd3fc`,opacity:`.68`}),(0,O.jsx)(`path`,{d:`M ${i.x-5} ${i.y-10.5}h10`,stroke:`#7dd3fc`,opacity:`.48`})]}),n===`testing`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`circle`,{cx:i.x-3.5,cy:i.y-9.5,r:`1.2`,fill:`#f1c75b`}),(0,O.jsx)(`circle`,{cx:i.x,cy:i.y-9.5,r:`1.2`,fill:`#f1c75b`,opacity:`.65`}),(0,O.jsx)(`circle`,{cx:i.x+3.5,cy:i.y-9.5,r:`1.2`,fill:`#f1c75b`,opacity:`.3`})]}),n===`test-passed`&&(0,O.jsx)(`path`,{d:`m ${i.x-4} ${i.y-9} 3 3 6-7`,fill:`none`,stroke:`#4ade80`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`}),n===`failed`&&(0,O.jsx)(`path`,{d:`M ${i.x-4} ${i.y-12}l8 7M ${i.x+4} ${i.y-12}l-8 7`,stroke:`#fb7185`,strokeWidth:`1.5`}),n===`waiting`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`circle`,{cx:i.x,cy:i.y-10,r:`3.2`,fill:`none`,stroke:`#f4b942`,opacity:`.78`}),(0,O.jsx)(`path`,{d:`M ${i.x} ${i.y-12}v2.5l2 1`,stroke:`#f4b942`,strokeWidth:`1`})]}),n===`idle`&&(0,O.jsx)(`path`,{d:`M ${i.x-4} ${i.y-8}h8`,stroke:`#8bb5c8`,opacity:`.25`}),(0,O.jsx)(`path`,{d:`M ${i.x} ${i.y-3}v7`,stroke:`#5c5961`,strokeWidth:`2`})]})}function ga({x:e,y:t,atmosphere:n}){let r=Y(e,t,17),i=oa[n],a=n===`idle`?`#e2c477`:i,o=n!==`vacant`,s=n===`active`?.17:n===`idle`||n===`paused`?.075:.13;return(0,O.jsxs)(`g`,{"aria-hidden":`true`,"data-room-bulb":n,"data-room-bulb-powered":o?`true`:`false`,children:[o&&(0,O.jsx)(`ellipse`,{cx:r.x+1,cy:r.y+4,rx:`17`,ry:`11`,fill:a,opacity:s,className:n===`active`?`office-room-light-pulse`:void 0}),(0,O.jsxs)(`g`,{transform:`rotate(6.88 ${r.x} ${r.y})`,children:[(0,O.jsx)(`rect`,{x:r.x-7,y:r.y-7,width:`14`,height:`13`,rx:`3`,fill:`#2a2930`,stroke:`#8d8993`,strokeOpacity:`.58`}),(0,O.jsx)(`path`,{d:`M ${r.x} ${r.y+3}v5`,stroke:`#aaa5ad`,strokeWidth:`2.2`,strokeLinecap:`round`}),(0,O.jsx)(`path`,{d:`M ${r.x-5} ${r.y+11}Q ${r.x} ${r.y+5} ${r.x+5} ${r.y+11}`,fill:o?a:`#35343b`,stroke:o?a:`#706d76`,strokeOpacity:o?`.9`:`.38`}),(0,O.jsx)(`ellipse`,{cx:r.x,cy:r.y+11,rx:`5`,ry:`2.2`,fill:o?a:`#2b2a30`,opacity:o?`.9`:`.65`})]})]})}function _a({floor:e,doorway:t,center:n,atmosphere:r,occupied:i=r!==`vacant`,scope:a=`fleet`}){let o=a===`detail`,s=oa[r],c={vacant:.2,idle:.018,active:o?.052:.045,waiting:.028,blocked:.038,failed:.045,paused:.04},l=r===`vacant`?`#05060a`:s;return(0,O.jsxs)(`g`,{"aria-hidden":`true`,"data-room-lighting":r,"data-lighting-scope":a,pointerEvents:`none`,children:[c[r]!==void 0&&(0,O.jsx)(`polygon`,{points:X(e),fill:l,opacity:c[r]}),i&&r!==`review`&&(0,O.jsx)(`ellipse`,{cx:n.x,cy:n.y,rx:o?92:58,ry:o?40:25,fill:`#f1c75b`,opacity:r===`active`?o?.055:.045:o?.04:.032,className:r===`active`?`office-room-light-pulse`:void 0,"data-occupied-warmth":`true`,"data-light-motion":r===`active`?`breathing`:`steady`}),t&&r===`waiting`&&(0,O.jsx)(`polygon`,{points:X(t),fill:s,opacity:o?.34:.3,"data-doorway-light":`waiting`,className:`office-doorway-waiting`}),r===`review`&&(0,O.jsx)(`ellipse`,{cx:n.x,cy:n.y,rx:o?112:75,ry:o?52:34,fill:s,opacity:o?.11:.1,"data-review-spotlight":`true`})]})}function va({rect:e,label:t,capacity:n,occupied:r=0,accent:i,z:a=25}){let o=ki(e,a);return(0,O.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:o.x-47,y:o.y-17,width:`94`,height:`24`,rx:`5`,fill:`#111318`,stroke:i,strokeOpacity:`.48`}),(0,O.jsx)(`circle`,{cx:o.x-39,cy:o.y-5,r:`2.3`,fill:i,opacity:`.72`}),(0,O.jsx)(`text`,{x:o.x-32,y:o.y-2,fill:`#e7e3ec`,fillOpacity:`.76`,fontFamily:`ui-monospace, monospace`,fontSize:`5.8`,fontWeight:`700`,letterSpacing:`.3`,children:t}),(0,O.jsx)(`path`,{d:`M ${o.x+19} ${o.y-12}v13`,stroke:i,strokeOpacity:`.14`}),(0,O.jsx)(`rect`,{x:o.x+24,y:o.y-11,width:`18`,height:`11`,rx:`3`,fill:i,fillOpacity:`.11`}),(0,O.jsxs)(`text`,{x:o.x+33,y:o.y-3,textAnchor:`middle`,fill:i,fillOpacity:`.9`,fontFamily:`ui-monospace, monospace`,fontSize:`5.4`,fontWeight:`700`,children:[r,`/`,n]})]})}function ya({x:e,y:t}){let n=Y(e,t,4);return(0,O.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,O.jsx)(`path`,{d:`M ${n.x} ${n.y}c-2-18-15-18-9-29 8 2 11 8 10 16 4-18 17-16 16-5-4 5-10 7-14 8`,fill:`#47735c`,opacity:`.75`}),(0,O.jsx)(`path`,{d:`M ${n.x-8} ${n.y}h16l-3 13h-10z`,fill:`#6a4d35`})]})}var ba=4200,xa=3600,Sa=1200,Ca=1e3,wa=2400,Ta=4500;function Ea(e){return!!e.doneAt}function Da(e){let t=new Map;for(let n of e)for(let e of n.workers)t.set(`${n.missionId}:${e.id}`,{mission:n,worker:e});return t}function Oa(e,t,n,r){let i=`${e}:${t}`;return[{id:`${n}:desk`,targetId:i,missionId:e,workerId:t,action:`desk-reserved`,startsAt:r,duration:720},{id:`${n}:enter`,targetId:i,missionId:e,workerId:t,action:`entering`,startsAt:r+180,duration:ba},{id:`${n}:arrive`,targetId:i,missionId:e,workerId:t,action:`arrived`,startsAt:r+180+ba,duration:Sa}]}function ka(e,t,n){let r=new Map(e.map(e=>[e.missionId,e])),i=new Map(t.map(e=>[e.missionId,e])),a=[],o=(e,t,r,i,o=0,s=720)=>a.push({id:`${t}:${r}:${n}`,targetId:t,missionId:e,workerId:i,action:r,startsAt:n+o,duration:s});for(let e of t){let t=r.get(e.missionId);if(!t){o(e.missionId,e.missionId,`room-activate`),o(e.missionId,e.missionId,`entering`,void 0,180,ba),o(e.missionId,e.missionId,`arrived`,void 0,4380,Sa);continue}if(t.lifecycleStatus!==e.lifecycleStatus)e.lifecycleStatus===`paused`?o(e.missionId,e.missionId,`paused`):t.lifecycleStatus===`paused`&&e.lifecycleStatus===`active`?o(e.missionId,e.missionId,`resumed`):e.lifecycleStatus===`ready_for_review`?o(e.missionId,e.missionId,e.mission.mode===`orchestrated`?`moving-to-review`:`awaiting-acceptance`,void 0,0,e.mission.mode===`orchestrated`?Ta:720):(e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`)&&o(e.missionId,e.missionId,`accepted-completion`,void 0,0,Ta);else if(t.activityStatus!==e.activityStatus){let t=e.activityStatus===`working`?`working`:e.activityStatus===`waiting_on_you`?`waiting`:e.activityStatus===`stalled`?`blocked`:e.activityStatus===`error`?`failed`:`waiting`;o(e.missionId,e.missionId,t)}}for(let t of e)i.has(t.missionId)||o(t.missionId,t.missionId,`accepted-completion`,void 0,0,Ta);let s=Da(e),c=Da(t);for(let[e,t]of c){let n=s.get(e);n?!Ea(n.worker)&&Ea(t.worker)&&(o(t.mission.missionId,e,`reporting`,t.worker.id,0,xa),o(t.mission.missionId,e,`exiting`,t.worker.id,xa,Ta)):(o(t.mission.missionId,e,`desk-reserved`,t.worker.id),o(t.mission.missionId,e,`entering`,t.worker.id,180,ba),o(t.mission.missionId,e,`arrived`,t.worker.id,4380,Sa),Ea(t.worker)&&(o(t.mission.missionId,e,`reporting`,t.worker.id,5580,xa),o(t.mission.missionId,e,`exiting`,t.worker.id,9180,Ta)))}for(let[e,t]of s)c.has(e)||Ea(t.worker)||(o(t.mission.missionId,e,`reporting`,t.worker.id,0,xa),o(t.mission.missionId,e,`exiting`,t.worker.id,xa,Ta));return a}function Aa(e){let t=e.missionId,n=[{key:`door:${t}`,holdMs:Ca},{key:`elevator:in`,holdMs:600}],r=[{key:`door:${t}`,holdMs:Ca},{key:`elevator:out`,holdMs:600}];switch(e.action){case`entering`:return n;case`reporting`:return[{key:`handoff:${t}`}];case`exiting`:return r;case`accepted-completion`:return r;case`moving-to-review`:return[{key:`handoff:${t}`},...r];default:return[]}}function ja(e,t,n,r=new Set){let i=new Map([...t].map(([e,t])=>[e,{...t}])),a=[];for(let t of e){let e=`${t.missionId}:${t.workerId}`;if(r.has(e))continue;let o=i.get(e)??{missionId:t.missionId,workerId:t.workerId,launched:!1,stopped:!1,completionQueued:!1,exited:!1};t.kind===`start`?o.launched?o.exited||o.completionQueued?(a=Ma(a,Oa(t.missionId,t.workerId,`worker:${t.storyKey}:reenter`,n),n),o.stopped=!1,o.completionQueued=!1,o.exited=!1):o.stopped=!1:(a=Ma(a,Oa(t.missionId,t.workerId,`worker:${t.storyKey}:launch`,n),n),o.launched=!0,o.exited=!1):o.launched&&(o.stopped=!0),i.set(e,o)}return{stories:a,lifecycles:i}}function Ma(e,t,n){let r=e.filter(e=>e.startsAt+e.duration>n),i=new Set(r.map(e=>e.id)),a=new Set(r.map(e=>`${e.targetId}:${e.action}`)),o=t.filter(e=>!i.has(e.id)&&!a.has(`${e.targetId}:${e.action}`)),s=new Map,c=new Map,l=new Map,u=e=>{for(let t of Aa(e))t.holdMs===void 0?s.set(t.key,Math.max(s.get(t.key)??n,e.startsAt+e.duration)):l.set(t.key,[...l.get(t.key)??[],e.startsAt]);c.set(e.targetId,Math.max(c.get(e.targetId)??n,e.startsAt+e.duration))};for(let e of r)u(e);let d=new Map;for(let e of o)d.set(e.targetId,[...d.get(e.targetId)??[],e]);let f=[...d.values()].sort((e,t)=>Math.min(...e.map(e=>e.startsAt))-Math.min(...t.map(e=>e.startsAt))||e[0].id.localeCompare(t[0].id)).flatMap(e=>{let t=Math.min(...e.map(e=>e.startsAt)),r=e[0].targetId,i=Math.max(0,n-t,(c.get(r)??n)-t);for(let t of e)for(let e of Aa(t))e.holdMs===void 0&&(i=Math.max(i,(s.get(e.key)??n)-t.startsAt));for(let t=0;t<16;t+=1){let t=!1;for(let n of e)for(let e of Aa(n))if(e.holdMs!==void 0)for(let r of l.get(e.key)??[])Math.abs(n.startsAt+i-r)<e.holdMs&&(i=r+e.holdMs-n.startsAt,t=!0);if(!t)break}let a=i?e.map(e=>({...e,startsAt:e.startsAt+i})):e;for(let e of a)u(e);return a});return[...r,...f].slice(0,96)}var Na=new Set([`moving-to-review`]);function Pa(e,t,n,r){if(!t.size)return e;let i=new Set(n.filter(e=>!e.workerId&&Na.has(e.action)&&e.startsAt>r).map(e=>e.missionId));return i.size?e.map(n=>{if(!i.has(n.mission.missionId))return n;let r=t.get(n.mission.missionId);return!r||r.slotId===n.slotId||e.some(e=>e!==n&&e.slotId===r.slotId)?n:{...r,mission:n.mission}}):e}function Fa(e,t){let n={};for(let r of e)r.startsAt<=t&&r.startsAt+r.duration>t&&(n[r.targetId]=r.action);return n}var Ia={direct:[`On it — getting started!`,`I’m on the case.`,`Let’s get this moving.`,`Starting a focused pass.`,`I’ve got this one.`,`Time to dig in.`,`Opening the task now.`,`Let’s make it happen.`,`Getting straight to work.`,`I’m picking this up.`,`Starting with the essentials.`,`Let’s see what we’ve got.`,`Kicking off the first pass.`,`I’ll take it from here.`,`Settling in and starting.`,`Focus mode: activated.`,`Starting clean and simple.`,`I’m diving into the details.`,`Let’s build something solid.`,`Beginning the work now.`,`Task received — moving.`,`All right, here we go.`,`Starting with a quick scan.`,`I’m getting oriented.`,`Let’s knock this out.`],manager:[`Team assembled — starting now!`,`I’m briefing the team.`,`Let’s coordinate the first pass.`,`Assignments are going out.`,`The team is getting started.`,`Kicking off the mission plan.`,`I’m lining up the work.`,`Let’s divide and conquer.`,`Starting the team sync now.`,`The mission is underway.`,`I’m setting the team in motion.`,`Delegation mode: engaged.`,`Let’s get everyone aligned.`,`I’m mapping the first moves.`,`The swarm is on the case.`,`Launching the coordinated pass.`,`I’m handing out assignments.`,`Let’s make parallel progress.`,`The plan is leaving the runway.`,`I’m organizing the opening move.`,`Team, we have a mission.`,`Starting with a clean handoff.`,`Let’s put the plan to work.`,`I’m coordinating the kickoff.`,`Everyone has their heading.`],worker:[`Ready to work!`,`I’ve got my assignment.`,`Starting my piece now.`,`I’m on this part.`,`Task received — digging in.`,`I’ll take this one.`,`Getting started over here.`,`I’m opening the relevant files.`,`Time for a focused pass.`,`I’m picking up this thread.`,`Starting with a quick review.`,`I know what to do.`,`Let’s get this piece done.`,`I’m diving into my task.`,`My part is underway.`,`I’m getting the context now.`,`Beginning the first pass.`,`I’ll report back shortly.`,`I’m tracing this section.`,`Starting carefully.`,`I have the brief.`,`Let me work through this.`,`I’m taking the next step.`,`Assignment accepted.`,`I’m moving on it now.`]};function La(e,t,n){return Wa(Ia[e],`${e}:${t}:${n}:arrival`)}var Ra=[`Checking`,`Reviewing`,`Tracing`,`Inspecting`,`Polishing`,`Updating`,`Validating`,`Testing`,`Tuning`,`Refining`,`Mapping`,`Auditing`,`Building`,`Comparing`,`Verifying`,`Cleaning up`,`Wiring up`,`Working through`,`Taking a look at`,`Digging into`],za={web:[`the latest docs`,`the web results`,`the source material`,`a few references`,`the external details`,`the relevant pages`,`the current guidance`,`the research trail`,`the available evidence`,`the upstream documentation`],read:[`the surrounding code`,`the existing flow`,`the current implementation`,`the relevant files`,`the data path`,`the component structure`,`the nearby logic`,`the repository context`,`the interfaces`,`how this fits together`],write:[`the implementation`,`a focused change`,`the UI details`,`the data flow`,`the edge cases`,`the integration`,`the new behavior`,`the component`,`the finishing touches`,`a small improvement`],test:[`the test suite`,`the tricky cases`,`the new behavior`,`the regression checks`,`the happy path`,`the failure path`,`the browser flow`,`the acceptance criteria`,`the final checks`,`the build`],command:[`a local command`,`the build output`,`the runtime state`,`the development setup`,`the generated output`,`the package scripts`,`the diagnostics`,`the environment`,`the logs`,`the verification command`],agent:[`the delegated work`,`the worker reports`,`the parallel tasks`,`the handoff`,`the team output`,`the remaining assignments`,`the work split`,`the incoming results`,`the task queue`,`the next delegation`],decision:[`the available options`,`the tradeoffs`,`the acceptance gate`,`the requested decision`,`the safest path`,`the review feedback`,`the open question`,`the approval state`,`the user preference`,`the next move`],output:[`the latest result`,`the generated output`,`the implementation summary`,`the reported progress`,`the final evidence`,`the changed files`,`the current result`,`the deliverable`,`the completion notes`,`the latest update`],lifecycle:[`the mission state`,`the current phase`,`the next milestone`,`the plan progress`,`the review handoff`,`the completion state`,`the active phase`,`the remaining work`,`the mission timeline`,`the current checkpoint`],tool:[`the current task`,`the tool output`,`the next step`,`the implementation details`,`the active work`,`the latest change`,`the underlying issue`,`the requested update`,`the current approach`,`the result`],design:[`the visual details`,`the spacing`,`the color treatment`,`the interaction states`,`the responsive layout`,`the component styling`,`the interface polish`,`the animation timing`,`the visual hierarchy`,`the user flow`],api:[`the API flow`,`the request handling`,`the server path`,`the response shape`,`the endpoint behavior`,`the integration boundary`,`the error handling`,`the runtime contract`,`the provider adapter`,`the backend logic`],docs:[`the documentation`,`the setup guide`,`the usage notes`,`the examples`,`the installation steps`,`the project overview`,`the troubleshooting notes`,`the contributor guidance`,`the release notes`,`the written instructions`],data:[`the persisted state`,`the data model`,`the storage path`,`the migration behavior`,`the saved preferences`,`the state reconciliation`,`the cached data`,`the mission record`,`the event history`,`the durable snapshot`]},Ba=[`now`,`carefully`,`before moving on`,`one step at a time`,`to make sure it holds up`,`and checking the edges`,`with fresh eyes`,`for anything surprising`,`before the final pass`,`and keeping it tidy`,`against the plan`,`to keep things moving`],Va=`Let’s keep the swarm moving.(Tiny sync, then onward.(I love a clean handoff.(Delegation is my cardio.(Let’s not overcomplicate it.(One dependency at a time.(Keeping an eye on the edges.(The plan is coming together.(I brought a checklist.(Time for a quick status sweep.(Everybody has context, right?(A crisp brief saves a long meeting.(Let’s close the loop.(I can smell a milestone.(No blockers on my watch.(Coordination mode: engaged.(The queue looks manageable.(A little structure goes a long way.(I’m aligning the moving pieces.(Let’s make the handoff boring.(Quiet office, busy team.(I’ll take the big picture.(Keeping scope in its lane.(Good work deserves good evidence.(Let’s leave clear notes.(Progress loves a checklist.(I have a meeting with the plan.(Status reports, assemble.(Another day, another dependency.(I’m professionally circling back.(The roadmap says hello.(Let’s make future-us happy.(Calm plan, fast team.(I’m counting green checks.(No mystery meat handoffs.(The mission has a pulse.(I’ll coordinate; you create.(Keeping the context warm.(The board is looking healthier.(Let’s ship something sturdy.(I believe in short meetings.(This could be a concise update.(Manager hat: firmly on.(I’m herding very capable cats.(All signal, minimal ceremony.(A plan with receipts—lovely.(Let’s turn motion into progress.(The swarm knows the assignment.(I’ll watch the critical path.(Coffee, context, coordination.`.split(`(`),Ha=`One more tiny fix…(Coffee would understand.(Making pixels behave.(I found the weird edge case.(This function has opinions.(Saving future-me a headache.(The bug blinked first.(Just tidying the corners.(I speak fluent stack trace.(This should be straightforward™.(Adding a little polish.(The tests are judging me.(I brought extra semicolons.(Compiling my thoughts.(The cache remembers everything.(One clean diff, coming up.(I definitely read the docs.(Making the happy path happier.(Negotiating with TypeScript.(The linter and I are talking.(Rubber duck unavailable.(No magic numbers on my watch.(Turning coffee into commits.(This edge case is ambitious.(I found a suspicious boolean.(Small change, big feelings.(Keeping the diff civilized.(The browser has entered the chat.(I enjoy reproducible bugs.(Just one more assertion.(The logs are telling a story.(Naming things: final boss.(I’m in the flow now.(Future maintainers, you’re welcome.(I see what the code meant.(The pixels have unionized.(Making this less surprising.(Today we choose clarity.(A tidy interface is a happy interface.(I have located the vibes.(The build is thinking about it.(Tests first, victory later.(I’m giving this a careful squint.(The TODO looked lonely.(I came, I saw, I refactored.(The abstraction is behaving now.(I’m following the breadcrumbs.(A breakpoint would be nice.(This comment earned its keep.(The component needed boundaries.(I’m reducing future confusion.(The diff is almost photogenic.(It works locally—promising start.(I’m asking the code politely.(This path could use a map.(I found the missing piece.(Keeping complexity on a leash.(The state machine sends regards.(I’m making errors more useful.(One deterministic step at a time.(The UI deserves nice spacing.(I’m adding guardrails.(This deserves a regression test.(The types caught something sneaky.(No tokens were harmed here.(The terminal says maybe.(I’m on speaking terms with the API.(That selector was oddly specific.(A clean build sparks joy.(I’m untangling this gently.(The data has arrived safely.(Making the invisible state visible.(The layout is finding balance.(I’ll keep the cleverness modest.(This branch has character.(I see a green check approaching.(The error message can do better.(This needs exactly one helper.(I’m keeping the scope honest.(The final 10% has entered the room.`.split(`(`),Ua={waiting:[`I need your decision.`,`Waiting on your call.`,`A choice is blocking progress.`,`Your input unlocks the next step.`,`I’m paused at a decision point.`,`Ready when you are.`,`One answer and we can continue.`,`The next move is yours.`,`I need a quick direction check.`,`Holding here for your input.`],blocked:[`I hit a blocker.`,`Something needs attention.`,`The path forward is blocked.`,`I found an obstacle.`,`Progress is paused on an issue.`,`This needs a recovery step.`,`I can’t safely continue yet.`,`The current approach is stuck.`,`A dependency is holding us up.`,`I need help clearing this path.`],failed:[`That step failed.`,`I found a failure to investigate.`,`The latest attempt didn’t pass.`,`Something broke during verification.`,`The result needs another look.`,`I have an error to resolve.`,`The check came back red.`,`That path didn’t work.`,`The runtime reported a failure.`,`I’m stopping on a real error.`],review:[`Ready for your review!`,`The evidence is ready.`,`This is ready for acceptance.`,`The work is ready to inspect.`,`I’ve reached the review gate.`,`Ready for the final check.`,`The result is waiting for you.`,`Review package is ready.`,`All set for acceptance.`,`Your review is the next step.`],paused:[`Mission paused.`,`Holding the current state.`,`Everything is safely paused.`,`Standing by with context intact.`,`Work is paused for now.`,`I’ll keep our place here.`,`Paused and ready to resume.`,`The mission is on hold.`,`Context saved; standing by.`,`Waiting for the restart signal.`]};function Wa(e,t){return e[Wi(t)%e.length]}var Ga=[`methodical`,`energetic`,`thoughtful`,`social`,`quiet`];function Ka(e){return Wa(Ga,`${e}:personality`)}function qa(e,t,n){let r=Ka(e),i=Wa(t?Ha:Va,`${e}:ambient:${n}`),a={methodical:[`Checklist update:`,`Careful pass:`],energetic:[`Quick update!`,`Making moves!`],thoughtful:[`Thinking aloud:`,`One consideration:`],social:[`Team thought:`,`Quick office note:`]};return a[r]&&Wi(`${e}:${n}:prefix`)%3==0?`${Wa(a[r],`${e}:${n}:prefix-pick`)} ${i}`:i}function Ja(e){let t=`${e.toolName??``} ${e.detail} ${e.filePath??``}`.toLowerCase();return t.includes(`websearch`)||t.includes(`webfetch`)||t.includes(`browser`)||t.includes(`http`)?`web`:/css|style|layout|color|colour|ui|ux|component|animation|hover|responsive/.test(t)?`design`:/api|server|endpoint|request|response|route|provider/.test(t)?`api`:/readme|documentation|\.md\b|guide|docs/.test(t)?`docs`:/database|sqlite|migration|persist|storage|cache|snapshot/.test(t)?`data`:e.activityKind&&e.activityKind in za?e.activityKind:`tool`}function Ya(e,t){let n=Ja(e),r=`${t}:${e.ts}:${e.toolName??e.detail}`;return`${Wa(Ra,`${r}:open`)} ${Wa(za[n],`${r}:object`)} ${Wa(Ba,`${r}:close`)}.`}function Xa(e,t){return e.targetWorker?vn(e.targetWorker,t):e.jobId===t.jobId}function Za(e,t){if(t&&[`failed`,`error`].includes(t.jobState.toLowerCase()))return`failed`;if(t?.jobState.toLowerCase()===`blocked`)return`blocked`;if(e.lifecycleStatus===`ready_for_review`)return`review`;if(e.lifecycleStatus===`paused`)return`paused`;if(e.activityStatus===`error`)return`failed`;if(e.activityStatus===`stalled`)return`blocked`;if(e.activityStatus===`waiting_on_you`)return`waiting`}var Qa=9e3,$a=180+ba;function eo(e,t,n){if(t===`off`)return[];let r=[],i=e=>`${e.floorIndex}:${e.spaceId}`,a=[...new Set(e.map(i))].sort(),o=e.reduce((e,t)=>e+1+(t.kind===`orchestrated`?t.mission.workers.filter(qi).length:0),0),s=o<=2?28e3:o<=5?22e3:o<=9?18e3:15e3,c=o<=5?1:o<=10?2:3,l=(n%s+s)%s,u=s/Math.max(1,a.length),d=Math.floor(n/s);for(let o of e){let e=o.mission,c=i(o),f=(l-a.indexOf(c)*u+s)%s,p=f<4800,m=(i,a)=>{let o=e.recentEvents.filter(t=>a?Xa(t,a):!e.workers.some(e=>Xa(t,e))),l=o.at(-1),u=e=>e?.phase===`delegating`||e?.phase===`worker_started`||e?.phase===`worker_reported`,m=o.filter(u).at(-1),h=m!==void 0&&n-Math.max(m.ts,m.phase===`worker_reported`||!a?0:a.startedAt+$a)<Qa,g=n-f,_=h?m:u(l)?l:o.find(e=>e.ts>=g)??l,v=Za(e,a),y=v===`failed`||v===`blocked`||v===`waiting`,b=o.slice(-5).some(e=>n-e.ts<12e4&&/security|secret|credential|password|token|auth|vulnerab/i.test(`${e.detail} ${e.filePath??``}`)),x=_?.phase===`delegating`||_?.phase===`worker_started`?`delegating`:_?.phase===`worker_reported`?`reporting`:void 0,S=x===`delegating`&&a?Math.max(_?.ts??0,a.startedAt+$a):_?.ts??0,C=_&&n>=S&&n-S<Qa&&(!!x||p),w=!l||n-l.ts>=Math.max(14e3,s/2);C&&x?r.push({targetId:i,missionId:e.missionId,workerId:a?.id,text:x===`delegating`?`Assignment: ${_.detail}`:x===`reporting`?`Results delivered: ${_.detail}`:_.outcome===`failure`?Wa(Ua.failed,`${i}:event-failed:${_.ts}`):Ya(_,i),kind:_.outcome===`failure`?`alert`:x===`reporting`?`output`:`speech`,interaction:x,priority:x?105:_.outcome===`failure`?100:80,room:c,freshness:S,scheduled:!1}):y&&p?r.push({targetId:i,missionId:e.missionId,workerId:a?.id,text:Wa(Ua[v],`${i}:${v}:${d}`),kind:`alert`,priority:100,room:c,freshness:n-f,scheduled:!0}):C?r.push({targetId:i,missionId:e.missionId,workerId:a?.id,text:x===`delegating`?`Assignment: ${_.detail}`:x===`reporting`?`Results delivered: ${_.detail}`:_.outcome===`failure`?Wa(Ua.failed,`${i}:event-failed:${_.ts}`):Ya(_,i),kind:_.outcome===`failure`?`alert`:x===`reporting`?`output`:`speech`,interaction:x,priority:x?105:_.outcome===`failure`?100:80,room:c,freshness:S,scheduled:!1}):v&&p?r.push({targetId:i,missionId:e.missionId,workerId:a?.id,text:Wa(Ua[v],`${i}:${v}:${d}`),kind:y?`alert`:v===`review`?`output`:`speech`,priority:75,room:c,freshness:n-f,scheduled:!0}):t===`work_personality`&&p&&w&&!v&&!b&&e.lifecycleStatus===`active`&&r.push({targetId:i,missionId:e.missionId,workerId:a?.id,text:qa(i,!!a,d),kind:`thought`,priority:20,room:c,freshness:n-f,scheduled:!0})};if(m(e.missionId),o.kind===`orchestrated`)for(let t of e.workers.filter(t=>qi(t)||e.recentEvents.some(e=>e.phase===`worker_reported`&&Xa(e,t)&&n-e.ts<18e3)))m(`${e.missionId}:${t.id}`,t)}let f=new Map;for(let e of r.sort((e,t)=>t.priority-e.priority||t.freshness-e.freshness||Wi(e.targetId)-Wi(t.targetId)))f.has(e.room)||f.set(e.room,e);let p=[...f.values()].sort((e,t)=>t.priority-e.priority||t.freshness-e.freshness),m=p.filter(e=>e.scheduled).slice(0,c);for(let e of p)m.length<c&&!m.includes(e)&&m.push(e);return m.map(({room:e,freshness:t,scheduled:n,...r})=>r)}function to({identity:e,x:t,y:n,role:r,provider:i,state:a,transition:o,transitionStartedAt:s,activeMotion:c=!0,reviewing:l=!1,needsAttention:u=!1,route:d,transferOrigin:f,interaction:p,interactionTarget:m}){let h=Gi(e),_=Y(t,n,26),v=r===`manager`||r===`review`,y=i===`codex`?`#55c7b3`:`#a78bfa`,b=Y(d?.entrance?.x??12.28,d?.entrance?.y??2.9,26),x=Y(d?.lobby?.x??12.28,d?.lobby?.y??3.18,26),S=d??(r===`direct`?{doorway:{x:3.62,y:3.15},inside:{x:3.18,y:3.15}}:void 0),C=S?Y(S.doorway.x,S.doorway.y,26):void 0,w=S?Y(S.inside.x,S.inside.y,26):void 0,T=f?Y(f.position.x,f.position.y,26):void 0,E=f?Y(f.doorway.x,f.doorway.y,26):void 0,D=f?Y(f.inside.x,f.inside.y,26):void 0,k=m?Y(m.x,m.y,26):void 0,A=(0,g.useMemo)(()=>o&&s!==void 0?`${Math.min(0,s-Date.now())}ms`:void 0,[o,s]),j={"--avatar-offset":`${h.offset}ms`,...A?{animationDelay:A}:{},...k?{"--interaction-x":`${(k.x-_.x)*.72}px`,"--interaction-y":`${(k.y-_.y)*.72}px`}:{},...C&&w?{"--office-start-x":`${b.x-_.x}px`,"--office-start-y":`${b.y-_.y}px`,"--office-lobby-x":`${x.x-_.x}px`,"--office-lobby-y":`${x.y-_.y}px`,"--office-door-x":`${C.x-_.x}px`,"--office-door-y":`${C.y-_.y}px`,"--office-inside-x":`${w.x-_.x}px`,"--office-inside-y":`${w.y-_.y}px`}:{},...T&&E&&D?{"--office-origin-x":`${T.x-_.x}px`,"--office-origin-y":`${T.y-_.y}px`,"--office-origin-door-x":`${E.x-_.x}px`,"--office-origin-door-y":`${E.y-_.y}px`,"--office-origin-inside-x":`${D.x-_.x}px`,"--office-origin-inside-y":`${D.y-_.y}px`}:{}},M=h.hairStyle===`long`?(0,O.jsx)(`path`,{d:`M ${_.x-8} ${_.y-7}q8-10 16 0l-1 15-5-5h-10l-5 5z`,fill:h.hair}):h.hairStyle===`ponytail`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`circle`,{cx:_.x+8,cy:_.y-3,r:`4.5`,fill:h.hair}),(0,O.jsx)(`path`,{d:`M ${_.x+7} ${_.y-5}q8 5 3 13-1-6-6-8z`,fill:h.hair})]}):h.hairStyle===`bun`?(0,O.jsx)(`circle`,{cx:_.x+1,cy:_.y-14,r:`4.5`,fill:h.hair}):null,N=h.hairStyle===`short`?(0,O.jsx)(`path`,{d:`M ${_.x-7} ${_.y-7}q7-9 14 0v3q-7-4-14 0z`,fill:h.hair}):h.hairStyle===`side`?(0,O.jsx)(`path`,{d:`M ${_.x-8} ${_.y-6}q2-10 9-8 7 2 7 9-8-4-16-1z`,fill:h.hair}):h.hairStyle===`crop`?(0,O.jsx)(`path`,{d:`M ${_.x-7} ${_.y-7}q7-7 14 0l-2 2q-6-3-12 1z`,fill:h.hair}):h.hairStyle===`curls`?(0,O.jsxs)(`g`,{fill:h.hair,children:[[-6,-3,0,3,6].map((e,t)=>(0,O.jsx)(`circle`,{cx:_.x+e,cy:_.y-10+Math.abs(t-2)*1.2,r:`3.4`},e)),(0,O.jsx)(`circle`,{cx:_.x-7,cy:_.y-5,r:`3`}),(0,O.jsx)(`circle`,{cx:_.x+7,cy:_.y-5,r:`3`})]}):(0,O.jsx)(`path`,{d:`M ${_.x-7.5} ${_.y-7}q7.5-10 15 0v4q-4-3-7-3l-2 5-2-5q-3 0-6 3z`,fill:h.hair});return(0,O.jsx)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,"data-avatar-id":e,"data-avatar-role":r,"data-avatar-state":r===`review`&&a===`working`?`idle`:a,"data-avatar-hair":h.hairStyle,"data-avatar-outfit":v?`suit`:h.outfit,"data-avatar-behavior":l?`reviewing`:void 0,"data-avatar-personality":Ka(e),"data-avatar-gesture":h.gesture,"data-avatar-motion":a!==`working`||c?`active`:`rest`,"data-avatar-interaction":p,"data-avatar-reported":r===`worker`&&o===`exiting`&&m?`true`:void 0,"data-office-route":S?`hallway`:void 0,"data-office-transfer":f?`review`:void 0,"data-office-transition":o,style:j,children:(0,O.jsxs)(`g`,{className:`office-avatar-pose`,children:[(0,O.jsx)(`ellipse`,{cx:_.x,cy:_.y+19,rx:v?9:8,ry:`3.5`,fill:`#000`,opacity:`.32`}),(0,O.jsxs)(`g`,{className:`office-avatar-body`,children:[(0,O.jsx)(`path`,{d:`M ${_.x-(v?8:7)} ${_.y+3}Q ${_.x} ${_.y-2} ${_.x+(v?8:7)} ${_.y+3}L ${_.x+6} ${_.y+18}H ${_.x-6}Z`,fill:v?`#202938`:h.clothing,stroke:y,strokeOpacity:v?`.68`:`.3`}),v&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`path`,{d:`M ${_.x-2.7} ${_.y+2}H ${_.x+2.7}L ${_.x+1.4} ${_.y+10}H ${_.x-1.4}Z`,fill:`#e7e9ed`,opacity:`.9`}),(0,O.jsx)(`path`,{d:`M ${_.x-7} ${_.y+3}L ${_.x-2.6} ${_.y+2}L ${_.x-.8} ${_.y+11}L ${_.x-5} ${_.y+7}ZM ${_.x+7} ${_.y+3}L ${_.x+2.6} ${_.y+2}L ${_.x+.8} ${_.y+11}L ${_.x+5} ${_.y+7}Z`,fill:`#39465a`}),(0,O.jsx)(`path`,{d:`M ${_.x} ${_.y+4}l2 3-2 7-2-7z`,fill:`#d6aa4b`})]}),!v&&h.outfit===`hoodie`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`path`,{d:`M ${_.x-6} ${_.y+4}q6-7 12 0`,fill:`none`,stroke:`#d8dde2`,strokeOpacity:`.42`,strokeWidth:`2.2`}),(0,O.jsx)(`path`,{d:`M ${_.x-2} ${_.y+4}v7M ${_.x+2} ${_.y+4}v7`,stroke:`#e7e9ed`,strokeOpacity:`.6`,strokeWidth:`.8`}),(0,O.jsx)(`path`,{d:`M ${_.x-3} ${_.y+15}h6`,stroke:`#252a31`,strokeOpacity:`.45`})]}),!v&&h.outfit===`jacket`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`path`,{d:`M ${_.x-6} ${_.y+4}l5 5 1-7M ${_.x+6} ${_.y+4}l-5 5-1-7`,fill:`none`,stroke:`#e2e6ea`,strokeOpacity:`.6`,strokeWidth:`1.2`}),(0,O.jsx)(`path`,{d:`M ${_.x} ${_.y+8}v10`,stroke:`#20242a`,strokeOpacity:`.65`})]}),!v&&h.outfit===`sweater`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`path`,{d:`M ${_.x-6} ${_.y+10}h12M ${_.x-5.5} ${_.y+13}h11`,stroke:`#f3e4c5`,strokeOpacity:`.35`,strokeWidth:`1.5`}),(0,O.jsx)(`path`,{d:`M ${_.x-3} ${_.y+3}q3 3 6 0`,fill:`none`,stroke:`#ede7dc`,strokeOpacity:`.45`})]}),!v&&h.outfit===`tee`&&(0,O.jsx)(`path`,{d:`M ${_.x-3} ${_.y+3}q3 4 6 0`,fill:`none`,stroke:`#f4f6f8`,strokeOpacity:`.38`,strokeWidth:`1.2`}),(0,O.jsxs)(`g`,{className:`office-avatar-arms-rest`,children:[(0,O.jsx)(`path`,{d:`M ${_.x-5} ${_.y+7}l-5 8`,stroke:h.skin,strokeWidth:`3`,strokeLinecap:`round`}),(0,O.jsx)(`path`,{d:`M ${_.x+5} ${_.y+7}l5 8`,stroke:h.skin,strokeWidth:`3`,strokeLinecap:`round`})]}),(0,O.jsxs)(`g`,{className:`office-avatar-arms-working`,"data-avatar-hands":`keyboard`,children:[(0,O.jsx)(`path`,{className:`office-avatar-arm office-avatar-arm-left`,d:`M ${_.x-5} ${_.y+7}Q ${_.x-7} ${_.y} ${_.x+1} ${_.y-(v?14:11)}`,stroke:h.skin,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`}),(0,O.jsx)(`path`,{className:`office-avatar-arm office-avatar-arm-right`,d:`M ${_.x+5} ${_.y+7}Q ${_.x+8} ${_.y} ${_.x+7} ${_.y-(v?14:11)}`,stroke:h.skin,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`})]})]}),(0,O.jsxs)(`g`,{className:`office-avatar-head`,children:[M,(0,O.jsx)(`circle`,{cx:_.x,cy:_.y-5,r:v?8:7.5,fill:h.skin,stroke:`#f8e4d1`,strokeOpacity:`.24`}),N]}),u&&(0,O.jsxs)(`g`,{className:`office-attention-badge`,children:[(0,O.jsx)(`circle`,{cx:_.x+10,cy:_.y-18,r:`6.5`,fill:`#3a162e`,stroke:`#f472b6`,strokeWidth:`1.2`}),(0,O.jsx)(`text`,{x:_.x+10,y:_.y-15.4,textAnchor:`middle`,fill:`#f9a8d4`,fontSize:`8`,fontWeight:`900`,children:`?`})]})]})})}function no({x:e,y:t,text:n,delayMs:r=ba+100,kind:i=`speech`,targetId:a,onClick:o}){let s=Y(e,t,26),c=n.length>40?`${n.slice(0,39)}…`:n,l=Math.min(164,Math.max(104,24+c.length*4.15)),u=i===`alert`?`#fb7185`:i===`thought`?`#a78bfa`:i===`output`?`#e6bd62`:`#55c7b3`;return(0,O.jsxs)(`g`,{"aria-hidden":o?void 0:`true`,role:o?`button`:void 0,tabIndex:o?0:void 0,"aria-label":o?`${n} Open details`:void 0,pointerEvents:o?`all`:`none`,"data-office-speech":`true`,"data-office-speech-kind":i,"data-office-speech-target":a,className:`office-speech-bubble ${o?`cursor-pointer`:``}`,onClick:o?e=>{e.stopPropagation(),o()}:void 0,onKeyDown:o?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),o())}:void 0,style:{"--office-speech-delay":`${r}ms`},children:[(0,O.jsx)(`rect`,{x:s.x-l/2,y:s.y-58,width:l,height:`29`,rx:i===`thought`?14:9,fill:i===`alert`?`#fff3f3`:`#f5f1e8`,stroke:u,strokeWidth:i===`alert`?1.4:1,strokeOpacity:`.75`}),i===`thought`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`circle`,{cx:s.x-3,cy:s.y-25,r:`3.5`,fill:`#f5f1e8`,stroke:u,strokeOpacity:`.65`}),(0,O.jsx)(`circle`,{cx:s.x+2,cy:s.y-19,r:`2`,fill:`#f5f1e8`,stroke:u,strokeOpacity:`.55`})]}):(0,O.jsx)(`path`,{d:`M ${s.x-7} ${s.y-31}l7 9 8-9z`,fill:i===`alert`?`#fff3f3`:`#f5f1e8`}),i===`alert`&&(0,O.jsx)(`text`,{x:s.x-l/2+10,y:s.y-40,fill:u,fontSize:`9`,fontWeight:`900`,children:`!`}),i===`output`&&(0,O.jsx)(`path`,{d:`M ${s.x-l/2+7} ${s.y-46.5}h3.6l1.2 1.6h4.2v6.4h-9z`,fill:`none`,stroke:u,strokeWidth:`1.1`,strokeLinejoin:`round`}),(0,O.jsx)(`text`,{x:s.x+(i===`alert`||i===`output`?8:0),y:s.y-41,textAnchor:`middle`,fill:`#202529`,fontFamily:`ui-sans-serif, system-ui`,fontSize:`7`,fontWeight:`700`,children:c})]})}var ro={direct:`#17171d`,standard:`#15161c`,large:`#19171b`},io={direct:`#55c7b3`,standard:`#a78bfa`,large:`#e6bd62`};function ao({room:e,occupants:t,visibleMissionIds:n,attentionMissionIds:r=new Set,workerSeatAssignments:i,animatedActors:a=new Set,transitions:o,transitionStarts:s={},sceneWorkers:c={},presentedStates:l={},transferOrigins:u={},bubbles:d=[],announcement:f,selected:p,focused:m,dimmed:h,onSelect:g,onOpenMission:_,onOpenWorker:v,onFocus:y,onBlur:b,layer:x}){let S=e=>l[e.missionId]??Yi(e),C=(e,t)=>l[`${e.missionId}:${t.id}`]??Ji(t,e),w=Oi(e),T=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g())},E=e=>{e.stopPropagation(),g()},D=e.kind===`direct`?[[.55,.72],[1.65,.72],[.55,2.05],[1.65,2.05],[.55,3.38],[1.65,3.38],[.55,4.71],[1.65,4.71]]:e.kind===`large`?[]:Mi,k=t[0],A=aa(t.map(e=>e.mission)),j=h||A===`vacant`?.42:1,M=e=>n.has(e.mission.missionId),N=e.kind===`standard`&&k?Math.min(e.capacity,1+k.mission.workers.filter(qi).length):t.length,P=k?.mission.lifecycleStatus===`ready_for_review`?`#e6bd62`:k?.mission.lifecycleStatus===`failed`||k?.mission.activityStatus===`error`?`#fb7185`:k?.mission.activityStatus===`stalled`?`#fb923c`:k?.mission.activityStatus===`waiting_on_you`?`#f472b6`:k?.mission.lifecycleStatus===`paused`?`#7dd3fc`:k?.mission.activityStatus===`working`?`#f1c75b`:io[e.kind];if(x===`plaque`){let t=e.y===0?-.58:6.8,n=e.kind===`standard`&&k?k.mission.name.slice(0,12).toUpperCase():e.shortLabel,r=e.kind===`standard`&&k?`${e.label}: ${k.mission.name}`:e.kind===`direct`?`${e.label}: hover an occupied desk to see its mission`:e.label;return(0,O.jsxs)(`g`,{"aria-label":r,pointerEvents:`visiblePainted`,opacity:j,style:{transition:`opacity 180ms ease`},children:[(0,O.jsx)(`title`,{children:r}),(0,O.jsx)(va,{rect:{x:e.x+e.width/2-.1,y:t,width:.2,depth:.1},label:n,capacity:e.capacity,occupied:N,accent:P,z:0})]})}if(x===`contents`||x===`furniture`||x===`people`){let n=x===`contents`||x===`furniture`,l=x===`contents`||x===`people`,p=new Map;if(k)for(let e of c[k.mission.missionId]??k.mission.workers){let t=`${k.mission.missionId}:${e.id}`,n=i[t];n!==void 0&&o[t]!==`room-activate`&&p.set(n,e)}let m=[[.82,.38],[1.47,.38],[2.12,.38],[2.77,.38],[.82,2.16],[1.47,2.16],[2.12,2.16],[2.77,2.16]],h=(e,t)=>{e.stopPropagation(),!(`key`in e&&e.key!==`Enter`&&e.key!==` `)&&(`key`in e&&e.preventDefault(),t())},g=e=>d.find(t=>t.targetId===e),y=(e,t,n)=>e?(0,O.jsx)(no,{x:t,y:n,text:e.text,kind:e.kind,targetId:e.targetId,delayMs:0,onClick:e.kind===`thought`?void 0:()=>e.workerId?v(e.missionId,e.workerId):_(e.missionId)},`dialogue:${e.targetId}`):null,b=e.kind===`standard`&&k?[...p.entries()].find(([,e])=>o[`${k.mission.missionId}:${e.id}`]===`reporting`):void 0,w=b?.[0],T=e.kind===`standard`&&k?{x:e.x+D[0][0]+.36,y:e.y+D[0][1]+.78}:void 0,E=w===void 0?void 0:{x:e.x+D[w+1][0]+.36,y:e.y+D[w+1][1]+.72},N=e.x+e.width*.83,P=e.kind===`direct`?void 0:{doorway:{x:N,y:3.15},inside:{x:N,y:e.y===0?2.55:3.75}};return(0,O.jsxs)(`g`,{opacity:j,"data-office-transition":k?o[k.mission.missionId]:void 0,style:{transition:`opacity 180ms ease`},children:[n&&(0,O.jsxs)(`g`,{pointerEvents:`none`,children:[(0,O.jsx)(ga,{x:e.x+e.width*.52,y:e.y+.12,atmosphere:A}),(e.id===`direct-studio`||e.id===`standard-a`||e.id===`review`)&&(0,O.jsx)(ya,{x:e.x+.35,y:e.y+.35}),e.id===`direct-studio`&&(0,O.jsx)(fa,{x:e.x+2.45,y:e.y}),e.id===`standard-b`&&(0,O.jsx)(ma,{x:e.x+.18,y:e.y+2.18}),e.id===`standard-c`&&(0,O.jsx)(pa,{x:e.x+.2,y:e.y}),e.kind===`large`?(0,O.jsx)(da,{x:e.x,y:e.y,occupiedCount:t.length,dimmedSeatIndexes:new Set(t.filter(e=>!M(e)).map(e=>e.seatIndex))}):D.map(([n,r],i)=>{let a=e.kind===`direct`?t.find(e=>e.seatIndex===i):i===0&&!k?.relocated?k:void 0,s=e.kind===`standard`&&i>0?p.get(i-1):void 0,c=s&&k?`${k.mission.missionId}:${s.id}`:a?.mission.missionId,l=c?o[c]:void 0,u=s&&k?ia(k.mission,s,l,C(k.mission,s)):a?ia(a.mission,void 0,l,S(a.mission)):void 0,d=e.kind===`direct`&&a&&!M(a);return(0,O.jsx)(`g`,{"data-filter-match":d?`false`:a?`true`:void 0,opacity:d?.2:1,style:{transition:`opacity 180ms ease`},children:(0,O.jsx)(la,{x:e.x+n,y:e.y+r,role:e.kind===`direct`?`direct`:i===0?`manager`:`worker`,occupied:!!(e.kind===`direct`?a:i===0?k:s),visualState:u?.state,monitor:u?.monitor??`vacant`,transition:l})},i)})]}),l&&(0,O.jsxs)(O.Fragment,{children:[e.kind===`direct`&&t.map(t=>{let[n,i]=D[t.seatIndex],c=M(t);return(0,O.jsx)(`g`,{"data-filter-match":String(c),opacity:c?1:.2,style:{transition:`opacity 180ms ease`},children:(0,O.jsx)(to,{transitionStartedAt:s[t.mission.missionId],identity:t.mission.missionId,x:e.x+n+.36,y:e.y+i+.72,role:`direct`,provider:t.mission.mission.provider,state:S(t.mission),needsAttention:r.has(t.mission.missionId),activeMotion:a.has(t.mission.missionId),transition:o[t.mission.missionId]})},t.mission.missionId)}),e.kind===`direct`&&f&&t.map(t=>{if(t.mission.missionId!==f.id)return null;let[n,r]=D[t.seatIndex];return(0,O.jsx)(no,{x:e.x+n+.36,y:e.y+r+.72,text:La(`direct`,t.mission.missionId,t.mission.missionId)},`speech:${t.mission.missionId}`)}),e.kind===`direct`&&t.map(t=>{if(f?.id===t.mission.missionId||o[t.mission.missionId]!==`arrived`)return null;let[n,r]=D[t.seatIndex];return(0,O.jsx)(no,{x:e.x+n+.36,y:e.y+r+.72,text:La(`direct`,t.mission.missionId,t.mission.missionId)},`arrived:${t.mission.missionId}`)}),e.kind===`direct`&&t.map(t=>{let n=o[t.mission.missionId];if(!M(t)||f?.id===t.mission.missionId||n===`arrived`||n===`room-activate`||n===`desk-reserved`||n===`entering`||n===`exiting`)return null;let[r,i]=D[t.seatIndex];return y(g(t.mission.missionId),e.x+r+.36,e.y+i+.72)}),e.kind===`standard`&&k&&(0,O.jsxs)(O.Fragment,{children:[!k.relocated&&(0,O.jsx)(to,{transitionStartedAt:s[k.mission.missionId],identity:k.mission.missionId,x:e.x+D[0][0]+.36,y:e.y+D[0][1]+.78,role:`manager`,provider:k.mission.mission.provider,state:S(k.mission),needsAttention:r.has(k.mission.missionId),activeMotion:a.has(k.mission.missionId),reviewing:k.mission.activityStatus===`idle`&&k.mission.workers.some(e=>!qi(e)),transition:o[k.mission.missionId],route:P,interaction:b?`receiving-report`:void 0,interactionTarget:E}),[...p.entries()].map(([t,n])=>{let r=`${k.mission.missionId}:${n.id}`,i=o[r],c=b?.[1].id===n.id,l=i===`exiting`,u=i===`arrived`||i===`working`?`working`:C(k.mission,n);return(0,O.jsx)(to,{identity:r,transitionStartedAt:s[r],x:e.x+D[t+1][0]+.36,y:e.y+D[t+1][1]+.72,role:`worker`,provider:k.mission.mission.provider,state:u,activeMotion:a.has(r)||u===`working`,transition:i,route:P,interaction:c?`reporting`:void 0,interactionTarget:c||l?T:void 0},n.id)}),b&&T&&E&&(()=>{let e=Y(T.x,T.y,34);return(0,O.jsxs)(`g`,{className:`office-handoff-document`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:e.x+8,y:e.y-18,width:`12`,height:`15`,rx:`1.5`,fill:`#f5f1e8`,stroke:`#e6bd62`}),(0,O.jsx)(`path`,{d:`M ${e.x+11} ${e.y-13}h6M ${e.x+11} ${e.y-10}h6M ${e.x+11} ${e.y-7}h4`,stroke:`#665f51`,strokeWidth:`1`})]},`document:${b[1].id}`)})()]}),e.kind===`standard`&&k&&!k.relocated&&f?.id===k.mission.missionId&&(0,O.jsx)(no,{x:e.x+D[0][0]+.36,y:e.y+D[0][1]+.78,text:La(`manager`,k.mission.missionId,k.mission.missionId)}),e.kind===`standard`&&k&&o[k.mission.missionId]===`arrived`&&f?.id!==k.mission.missionId&&(0,O.jsx)(no,{x:e.x+D[0][0]+.36,y:e.y+D[0][1]+.78,text:La(`manager`,k.mission.missionId,k.mission.missionId),delayMs:0}),e.kind===`standard`&&k&&[...p.entries()].map(([t,n])=>{let r=`${k.mission.missionId}:${n.id}`;return o[r]===`arrived`?(0,O.jsx)(no,{x:e.x+D[t+1][0]+.36,y:e.y+D[t+1][1]+.72,text:La(`worker`,r,k.mission.missionId),delayMs:0},`speech:${r}`):null}),e.kind===`standard`&&k&&f?.id!==k.mission.missionId&&![`room-activate`,`desk-reserved`,`entering`,`arrived`,`moving-to-review`,`exiting`].includes(o[k.mission.missionId]??``)&&y(g(k.mission.missionId),e.x+D[0][0]+.36,e.y+D[0][1]+.78),e.kind===`standard`&&k&&[...p.entries()].map(([t,n])=>{let r=`${k.mission.missionId}:${n.id}`,i=o[r],a=g(r);if(i===`arrived`||i===`desk-reserved`||i===`entering`||a?.interaction===`reporting`&&i!==`reporting`)return null;let s=i===`reporting`&&T?T:{x:e.x+D[t+1][0]+.36,y:e.y+D[t+1][1]+.72};return y(a,s.x,s.y)}),e.kind===`large`&&t.map(t=>{let[n,i]=m[t.seatIndex],a=M(t);return(0,O.jsx)(`g`,{"data-filter-match":String(a),opacity:a?1:.2,style:{transition:`opacity 180ms ease`},children:(0,O.jsx)(to,{transitionStartedAt:s[t.mission.missionId],identity:t.mission.missionId,x:e.x+n+.19,y:e.y+i+.15,role:`review`,provider:t.mission.mission.provider,state:S(t.mission),needsAttention:r.has(t.mission.missionId),transition:o[t.mission.missionId],route:P,transferOrigin:u[t.mission.missionId]})},t.mission.missionId)}),e.kind===`large`&&t.map(t=>{if(!M(t))return null;let[n,r]=m[t.seatIndex];return y(g(t.mission.missionId),e.x+n+.19,e.y+r+.15)}),e.kind===`direct`&&t.map(t=>{let[n,r]=D[t.seatIndex],i=Y(e.x+n+.36,e.y+r+.72,26);return(0,O.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Open direct mission ${t.mission.name}`,onClick:e=>h(e,()=>_(t.mission.missionId)),onKeyDown:e=>h(e,()=>_(t.mission.missionId)),className:`cursor-pointer outline-none`,children:[(0,O.jsx)(`title`,{children:t.mission.name}),(0,O.jsx)(`polygon`,{"data-hit-target":`desk`,points:ca(e.x+n,e.y+r,`direct`),fill:`transparent`,pointerEvents:`all`}),(0,O.jsx)(`circle`,{cx:i.x,cy:i.y,r:`22`,fill:`transparent`,pointerEvents:`all`})]},`target:${t.mission.missionId}`)}),e.kind===`standard`&&k&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Open manager for ${k.mission.name}`,onClick:e=>h(e,()=>_(k.mission.missionId)),onKeyDown:e=>h(e,()=>_(k.mission.missionId)),className:`cursor-pointer outline-none`,children:[(0,O.jsx)(`title`,{children:k.mission.name}),(0,O.jsx)(`polygon`,{"data-hit-target":`desk`,points:ca(e.x+D[0][0],e.y+D[0][1],`manager`),fill:`transparent`,pointerEvents:`all`}),(0,O.jsx)(`circle`,{...(()=>{let t=Y(e.x+D[0][0]+.36,e.y+D[0][1]+.78,26);return{cx:t.x,cy:t.y}})(),r:`24`,fill:`transparent`,pointerEvents:`all`})]}),[...p.entries()].map(([t,n])=>{let r=Y(e.x+D[t+1][0]+.36,e.y+D[t+1][1]+.72,26);return(0,O.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Inspect worker ${n.label} in ${k.mission.name}`,onClick:e=>h(e,()=>v(k.mission.missionId,n.id)),onKeyDown:e=>h(e,()=>v(k.mission.missionId,n.id)),className:`cursor-pointer outline-none`,children:[(0,O.jsx)(`polygon`,{"data-hit-target":`desk`,points:ca(e.x+D[t+1][0],e.y+D[t+1][1],`worker`),fill:`transparent`,pointerEvents:`all`}),(0,O.jsx)(`circle`,{cx:r.x,cy:r.y,r:`22`,fill:`transparent`,pointerEvents:`all`})]},`target:${n.id}`)})]}),e.kind===`large`&&t.map(t=>{let[n,r]=m[t.seatIndex],i=Y(e.x+n+.19,e.y+r+.15,26);return(0,O.jsx)(`g`,{role:`button`,tabIndex:0,"aria-label":`Open review mission ${t.mission.name}`,onClick:e=>h(e,()=>_(t.mission.missionId)),onKeyDown:e=>h(e,()=>_(t.mission.missionId)),className:`cursor-pointer outline-none`,children:(0,O.jsx)(`circle`,{cx:i.x,cy:i.y,r:`22`,fill:`transparent`,pointerEvents:`all`})},`target:${t.mission.missionId}`)})]})]})}let F=p||m,I=Oi({x:e.x+e.width*.76,y:e.y+e.depth-.16,width:.72,depth:.28},2),L=Y(e.x+e.width/2,e.y+e.depth/2,2);return(0,O.jsxs)(`g`,{role:`button`,tabIndex:0,"data-room-atmosphere":A,"data-office-transition":k?o[k.mission.missionId]:void 0,"aria-label":`${e.label}, ${t.length?`${t.length} mission${t.length===1?``:`s`}`:`empty`}, ${N} of ${e.capacity} ${e.capacity===1?`seat`:`seats`} occupied`,"aria-pressed":p,onClick:E,onKeyDown:T,onFocus:y,onBlur:b,opacity:j,className:`office-room cursor-pointer outline-none`,children:[(0,O.jsx)(`title`,{children:`${e.label} · ${t.length?`${t.length} mission${t.length===1?``:`s`}`:`empty`} · capacity ${e.capacity}`}),(0,O.jsx)(`polygon`,{points:X(w),fill:ro[e.kind],stroke:F||t.length?P:`#77717e`,strokeOpacity:F?`.95`:t.length?`.48`:`.24`,strokeWidth:F?2.5:t.length?1.5:1}),(0,O.jsx)(`polygon`,{points:X(w),fill:`url(#office-floor-${e.kind})`,opacity:F?`.8`:`.48`,pointerEvents:`none`}),(0,O.jsx)(_a,{floor:w,doorway:I,center:L,atmosphere:A,occupied:t.length>0}),(0,O.jsx)(`polygon`,{points:X(w),fill:`none`,stroke:`#fde68a`,strokeOpacity:`0`,strokeWidth:`2`,pointerEvents:`none`,className:`office-room-hover-outline`,"data-room-hover-outline":`true`})]})}var oo=30;function so(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function co({start:e,end:t,height:n=oo}){let r=[e,t,{x:t.x,y:t.y-n},{x:e.x,y:e.y-n}];return(0,O.jsx)(`polygon`,{points:X(r),fill:`#24242c`,stroke:`#696472`,strokeOpacity:`.34`,strokeWidth:`1`})}function lo({start:e,end:t,opensToward:n,opening:r=[.78,.88]}){let i=so(e,t,r[0]),a=so(e,t,r[1]);return(0,O.jsxs)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,"data-office-entrance":n,children:[(0,O.jsx)(co,{start:e,end:i}),(0,O.jsx)(co,{start:a,end:t}),(0,O.jsx)(`path`,{d:`M ${i.x} ${i.y}L ${a.x} ${a.y}`,stroke:`#e6bd62`,strokeOpacity:`.44`,strokeWidth:`2.5`})]})}function uo(e,t,n){return{start:Y(e,t),end:Y(e+n,t)}}function fo(e,t,n){return{start:Y(e,t),end:Y(e,t+n)}}function po({action:e,floorLabel:t,layer:n}){let r=Y(11.82,2.78),i=Y(12.76,2.78),a=so(r,i,.08),o=so(r,i,.5),s=so(r,i,.92),c=(e,t)=>({x:e.x,y:e.y-t}),l=Oi({x:11.78,y:2.78,width:1.02,depth:.72}),u=so(r,i,.5);return n===`lobby`?(0,O.jsx)(`polygon`,{"data-office-elevator-lobby":`true`,points:X(l),fill:`#24242b`,stroke:`#d9b65d`,strokeOpacity:`.18`}):(0,O.jsxs)(`g`,{"data-office-elevator":`true`,"data-elevator-action":e,children:[(0,O.jsx)(co,{start:r,end:i,height:44}),(0,O.jsx)(`polygon`,{className:`office-elevator-door office-elevator-door-left`,points:X([a,o,c(o,34),c(a,34)]),fill:`#555b66`,stroke:`#c7ccd5`,strokeOpacity:`.62`}),(0,O.jsx)(`polygon`,{className:`office-elevator-door office-elevator-door-right`,points:X([o,s,c(s,34),c(o,34)]),fill:`#474c56`,stroke:`#c7ccd5`,strokeOpacity:`.62`}),(0,O.jsx)(`path`,{d:`M ${o.x} ${o.y}V ${o.y-34}`,stroke:`#15171c`,strokeWidth:`1.6`,opacity:`.9`}),(0,O.jsx)(`path`,{d:`M ${a.x} ${a.y-35}L ${s.x} ${s.y-35}`,stroke:`#d8bd78`,strokeOpacity:`.35`,strokeWidth:`2`}),(0,O.jsx)(`rect`,{x:u.x-11,y:u.y-43,width:`22`,height:`8`,rx:`2`,fill:`#101218`,stroke:`#d9b65d`,strokeOpacity:`.5`}),(0,O.jsxs)(`text`,{className:`office-elevator-indicator`,x:u.x,y:u.y-37,textAnchor:`middle`,fill:`#f2c75c`,fontSize:`6`,fontWeight:`800`,children:[`◆ `,t]}),(0,O.jsx)(`rect`,{x:s.x+5,y:s.y-24,width:`7`,height:`14`,rx:`2`,fill:`#171920`,stroke:`#aeb4c0`,strokeOpacity:`.5`}),(0,O.jsx)(`circle`,{className:`office-elevator-call`,cx:s.x+8.5,cy:s.y-19,r:`1.5`,fill:`#f2c75c`}),(0,O.jsx)(`path`,{d:`M ${s.x+6.5} ${s.y-14}h4`,stroke:`#737986`,strokeWidth:`1`}),(0,O.jsx)(`text`,{x:u.x,y:u.y-48,textAnchor:`middle`,fill:`#d8dbe2`,fillOpacity:`.52`,fontSize:`4.8`,fontWeight:`700`,letterSpacing:`1.2`,children:`ELEVATOR`})]})}function mo({rooms:e,elevatorAction:t,floorIndex:n=0}){let r=3.5,i=6.3;return(0,O.jsxs)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,children:[(0,O.jsx)(co,{...uo(0,0,11.9)}),(0,O.jsx)(co,{...uo(0,i,11.9)}),(0,O.jsx)(co,{...fo(0,0,i)}),[...new Set(e.flatMap(e=>[e.x,e.x+e.width]).filter(t=>t>0&&t<11.9&&!(e.some(e=>e.kind===`direct`)&&t===3.5)))].map(e=>(0,O.jsxs)(`g`,{children:[(0,O.jsx)(co,{...fo(e,0,2.8)}),(0,O.jsx)(co,{...fo(e,r,2.8)})]},`column-${e}`)),e.some(e=>e.kind===`direct`)&&(0,O.jsx)(lo,{...fo(3.5,0,i),opensToward:`up`,opening:[.45,.55]}),e.filter(e=>e.kind!==`direct`&&e.y===0).map(e=>(0,O.jsx)(lo,{...uo(e.x,e.y+e.depth,e.width),opensToward:`up`},`${e.id}-door`)),e.filter(e=>e.y===r).map(e=>(0,O.jsx)(lo,{...uo(e.x,e.y,e.width),opensToward:`down`},`${e.id}-door`)),(0,O.jsx)(po,{action:t,floorLabel:n>=1e3?`A${n-999}`:String(n+1).padStart(2,`0`),layer:`lobby`}),(0,O.jsxs)(`g`,{"data-office-perimeter":`right`,children:[(0,O.jsx)(co,{...fo(11.9,0,2.8)}),(0,O.jsx)(co,{...fo(11.9,r,2.8)})]}),(0,O.jsx)(po,{action:t,floorLabel:n>=1e3?`A${n-999}`:String(n+1).padStart(2,`0`),layer:`cab`})]})}function ho({floorIndex:e,placements:t,workerSeatAssignments:n,visibleMissionIds:r,attentionMissionIds:i=new Set,transitions:a,transitionStarts:o={},sceneWorkers:s={},presentedStates:c={},transferOrigins:l,bubbles:u,announcement:d,motion:f,active:p=!0,onOpenMission:m,onOpenWorker:h,onOpenDirectStudio:_,onOpenReviewHall:v}){let[y,b]=(0,g.useState)(null),[x,S]=(0,g.useState)(null),C=Ri(e),w=Li(C);(0,g.useEffect)(()=>{b(null),S(null)},[e]);let T=w.find(e=>e.id===y),E=Oi({x:-.45,y:-.95,width:13.55,depth:8.2}),D=Oi(C===`headquarters`?{x:3.35,y:2.82,width:9.45,depth:.66}:{x:-.15,y:2.82,width:12.95,depth:.66}),k=Y(12.7,7.08),A=e=>t.filter(t=>t.spaceId===e),j=e=>{let t=w.find(t=>t.id===e),n=A(e);if(!t||n.length===0){b(null);return}if(t.kind===`direct`){_();return}if(t.kind===`large`){v();return}if(t.kind===`standard`||n.length===1){m(n[0].mission.missionId);return}b(t=>t===e?null:e)},M=T?A(T.id):[],N=T?.kind===`standard`&&M[0]?Math.min(T.capacity,1+M[0].mission.workers.filter(qi).length):M.length,P=new Set(t.map(e=>e.spaceId)).size,F=$i(t),I=Object.values(a).find(e=>e===`entering`||e===`exiting`||e===`accepted-completion`||e===`moving-to-review`),L=()=>{b(null),S(null),document.activeElement?.blur?.()};(0,g.useEffect)(()=>{if(typeof performance>`u`||typeof requestAnimationFrame>`u`)return;let t=`hive-office-floor-${e}`;performance.mark(`${t}:commit`);let n=requestAnimationFrame(()=>{performance.mark(`${t}:paint`),performance.measure(`hive-office-render`,`${t}:commit`,`${t}:paint`),performance.clearMarks(`${t}:commit`),performance.clearMarks(`${t}:paint`)});return()=>cancelAnimationFrame(n)},[e,t.length]);let ee=w.map(e=>{let t=A(e.id);return{room:e,occupants:t,seatCount:e.kind===`standard`&&t[0]?Math.min(e.capacity,1+t[0].mission.workers.filter(qi).length):t.length}});return(0,O.jsxs)(`div`,{"data-office-motion":f,"data-office-active":p?`true`:`false`,"data-office-room-count":w.length,"data-office-mission-count":t.length,className:`overflow-hidden rounded-2xl border border-white/[0.08] bg-[radial-gradient(circle_at_48%_30%,rgba(245,190,76,0.07),transparent_40%),#0b0b0e]`,children:[(0,O.jsxs)(`div`,{className:`flex min-h-[58px] flex-wrap items-center justify-between gap-3 border-b border-white/[0.06] px-4 py-2.5`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.2em] text-amber-200/40`,children:Z(e)}),(0,O.jsxs)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:[P,`/`,w.length,` spaces active · `,t.length,` mission`,t.length===1?``:`s`,` placed`]})]}),T?(0,O.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-white/[0.07] bg-white/[0.025] px-3 py-2 text-right`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold text-white/65`,children:T.label}),(0,O.jsxs)(`p`,{className:`mt-0.5 text-[8px] text-white/28`,children:[T.kind===`large`?`Review`:`Direct`,` · `,N,`/`,T.capacity,` occupied`]})]}),(0,O.jsx)(`span`,{className:`rounded-full border border-white/[0.07] px-2 py-1 text-[8px] uppercase tracking-wider text-white/28`,children:`Choose an occupant`})]}):(0,O.jsx)(`p`,{className:`text-[10px] text-white/22`,children:`Click an occupied room, manager, or worker to inspect it`})]}),(0,O.jsx)(`div`,{className:`grid gap-2 p-3 sm:hidden`,"aria-label":`${Z(e)} room directory`,children:ee.map(({room:e,occupants:t,seatCount:n})=>(0,O.jsxs)(`button`,{type:`button`,disabled:!t.length,onClick:()=>j(e.id),className:`flex items-center justify-between gap-3 rounded-xl border border-white/[0.08] bg-white/[0.025] px-3 py-3 text-left enabled:hover:border-amber-300/25 disabled:cursor-default disabled:opacity-45`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`block text-xs font-medium text-white/70`,children:e.label}),(0,O.jsx)(`span`,{className:`mt-1 block text-[10px] text-white/35`,children:t.length?t.map(e=>e.mission.name).join(`, `):`Vacant`})]}),(0,O.jsxs)(`span`,{className:`shrink-0 rounded-full border border-white/[0.08] px-2 py-1 text-[9px] text-white/40`,children:[n,`/`,e.capacity]})]},e.id))}),(0,O.jsx)(`div`,{"data-testid":`office-canvas`,className:`relative hidden min-h-[560px] sm:block lg:min-h-[640px]`,onClick:L,children:(0,O.jsxs)(`svg`,{viewBox:`0 0 1100 620`,className:`absolute inset-0 h-full w-full`,role:`img`,"aria-labelledby":`office-floor-title office-floor-description`,preserveAspectRatio:`xMidYMid meet`,children:[(0,O.jsx)(`title`,{id:`office-floor-title`,children:`Hive visual office floor`}),(0,O.jsxs)(`desc`,{id:`office-floor-description`,children:[`An elevated overhead `,C===`operations`?`operations floor with six orchestration rooms`:`headquarters with a shared direct studio, three orchestration rooms, and a review hall`,`. Use Tab to focus rooms and Enter to select one.`]}),(0,O.jsxs)(`defs`,{children:[(0,O.jsx)(`filter`,{id:`office-shadow`,x:`-30%`,y:`-30%`,width:`160%`,height:`180%`,children:(0,O.jsx)(`feDropShadow`,{dx:`0`,dy:`14`,stdDeviation:`14`,floodColor:`#000`,floodOpacity:`.6`})}),(0,O.jsx)(`pattern`,{id:`office-grid`,width:`28`,height:`16`,patternUnits:`userSpaceOnUse`,children:(0,O.jsx)(`path`,{d:`M0 8 14 0l14 8-14 8z`,fill:`none`,stroke:`#f1c15a`,strokeOpacity:`.03`})}),(0,O.jsx)(`pattern`,{id:`office-floor-direct`,width:`22`,height:`22`,patternUnits:`userSpaceOnUse`,children:(0,O.jsx)(`path`,{d:`M0 11h22M11 0v22`,stroke:`#55c7b3`,strokeOpacity:`.055`})}),(0,O.jsxs)(`pattern`,{id:`office-floor-standard`,width:`18`,height:`18`,patternUnits:`userSpaceOnUse`,children:[(0,O.jsx)(`circle`,{cx:`9`,cy:`9`,r:`1.2`,fill:`#a78bfa`,fillOpacity:`.09`}),(0,O.jsx)(`path`,{d:`M0 0h18v18H0z`,fill:`none`,stroke:`#a78bfa`,strokeOpacity:`.035`})]}),(0,O.jsx)(`pattern`,{id:`office-floor-large`,width:`24`,height:`14`,patternUnits:`userSpaceOnUse`,children:(0,O.jsx)(`path`,{d:`M0 7 12 0l12 7-12 7z`,fill:`none`,stroke:`#e6bd62`,strokeOpacity:`.07`})})]}),(0,O.jsx)(`rect`,{"data-testid":`office-background`,width:`1100`,height:`600`,fill:`url(#office-grid)`,onClick:L}),(0,O.jsxs)(`g`,{transform:`translate(42 -24) scale(1.16)`,filter:`url(#office-shadow)`,children:[(0,O.jsx)(`polygon`,{points:X(E),fill:`#101015`,stroke:`#d6b464`,strokeOpacity:`.16`,strokeWidth:`2`}),(0,O.jsx)(`polygon`,{points:X(D),fill:`#28252a`,stroke:`#e8be62`,strokeOpacity:`.16`}),w.map(e=>{let t=A(e.id),i=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,O.jsx)(ao,{room:e,occupants:t,visibleMissionIds:r,workerSeatAssignments:n,transitions:a,transitionStarts:o,sceneWorkers:s,presentedStates:c,selected:y===e.id,focused:x===e.id,dimmed:i||y!==null&&y!==e.id&&x!==e.id,onSelect:()=>j(e.id),onOpenMission:m,onOpenWorker:h,onFocus:()=>S(e.id),onBlur:()=>S(null),layer:`floor`},`${e.id}-floor`)}),(0,O.jsx)(mo,{rooms:w,elevatorAction:I,floorIndex:e}),w.map(e=>{let t=A(e.id),i=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,O.jsx)(ao,{room:e,occupants:t,visibleMissionIds:r,workerSeatAssignments:n,transitions:a,transitionStarts:o,sceneWorkers:s,presentedStates:c,selected:y===e.id,focused:x===e.id,dimmed:i||y!==null&&y!==e.id&&x!==e.id,onSelect:()=>j(e.id),onOpenMission:m,onOpenWorker:h,onFocus:()=>void 0,onBlur:()=>void 0,layer:`furniture`},`${e.id}-furniture`)}),w.map(e=>{let t=A(e.id),i=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,O.jsx)(ao,{room:e,occupants:t,visibleMissionIds:r,workerSeatAssignments:n,transitions:a,transitionStarts:o,sceneWorkers:s,presentedStates:c,selected:y===e.id,focused:x===e.id,dimmed:i||y!==null&&y!==e.id&&x!==e.id,onSelect:()=>void 0,onOpenMission:m,onOpenWorker:h,onFocus:()=>void 0,onBlur:()=>void 0,layer:`plaque`},`${e.id}-plaque`)}),w.map(e=>{let t=A(e.id),f=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,O.jsx)(ao,{room:e,occupants:t,visibleMissionIds:r,attentionMissionIds:i,workerSeatAssignments:n,animatedActors:F,transitions:a,transitionStarts:o,sceneWorkers:s,presentedStates:c,transferOrigins:l,bubbles:u,announcement:d,selected:y===e.id,focused:x===e.id,dimmed:f||y!==null&&y!==e.id&&x!==e.id,onSelect:()=>j(e.id),onOpenMission:e.kind===`direct`?e=>_(e):m,onOpenWorker:h,onFocus:()=>void 0,onBlur:()=>void 0,layer:`people`},`${e.id}-people`)}),(0,O.jsxs)(`text`,{x:k.x,y:k.y,textAnchor:`end`,transform:`rotate(6.88 ${k.x} ${k.y})`,fill:`#e6bd62`,fillOpacity:`.58`,fontFamily:`ui-monospace, monospace`,fontSize:`6.2`,fontWeight:`700`,letterSpacing:`1.2`,pointerEvents:`none`,children:[`HIVE · `,Z(e).toUpperCase()]})]})]})}),(0,O.jsx)(`ul`,{className:`sr-only`,"aria-label":`${Z(e)} room summaries`,children:ee.map(({room:e,occupants:t,seatCount:n})=>(0,O.jsxs)(`li`,{children:[e.label,`: `,t.length?t.map(e=>e.mission.name).join(`, `):`vacant`,`; `,n,` of `,e.capacity,` seats occupied.`]},e.id))}),T&&T.kind!==`large`&&T.kind!==`direct`&&M.length>1&&(0,O.jsx)(`div`,{className:`border-t border-white/[0.06] px-4 py-3`,children:(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`p`,{className:`mr-1 text-[9px] font-semibold uppercase tracking-wider text-white/25`,children:`Choose an occupant`}),M.map(e=>(0,O.jsxs)(`button`,{type:`button`,onClick:()=>m(e.mission.missionId),className:`rounded-lg border border-white/[0.08] bg-white/[0.025] px-3 py-2 text-left transition hover:border-amber-300/25 hover:bg-amber-300/[0.04]`,children:[(0,O.jsx)(`span`,{className:`block max-w-48 truncate text-[10px] font-medium text-white/65`,children:e.mission.name}),(0,O.jsxs)(`span`,{className:`mt-0.5 block text-[8px] uppercase tracking-wider text-white/25`,children:[e.mission.lifecycleStatus===`ready_for_review`?`Awaiting acceptance`:e.mission.activityStatus.replaceAll(`_`,` `),` · Open room`]})]},e.mission.missionId))]})})]})}var go=Array.from({length:8},(e,t)=>({id:`direct-studio:${t}`,spaceId:`direct-studio`,seatIndex:t,kind:`direct`})),_o=[`standard-a`,`standard-b`,`standard-c`].map(e=>({id:e,spaceId:e,seatIndex:0,kind:`orchestrated`})),vo=[`standard-a`,`standard-b`,`standard-c`,`standard-d`,`standard-e`,`standard-f`].map(e=>({id:e,spaceId:e,seatIndex:0,kind:`orchestrated`})),yo=Array.from({length:10},(e,t)=>({id:`review:${t}`,spaceId:`review`,seatIndex:t,kind:`review`})),bo=[...go,...vo,...yo];function xo(e){return(e===0?[...go,..._o,...yo]:e>=1e3?[...go,...yo]:vo).map(t=>({...t,id:`floor:${e}:${t.id}`,floorIndex:e}))}xo(0);function So(e){let t=/^floor:(\d+):(.+)$/.exec(e),n=t?Number(t[1]):0,r=t?.[2]??e,i=bo.find(e=>e.id===r);return i&&Number.isSafeInteger(n)&&n>=0&&xo(n).some(e=>e.id.endsWith(`:${i.id}`))?{...i,id:`floor:${n}:${i.id}`,floorIndex:n}:void 0}function Co(e){return e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`?null:e.lifecycleStatus===`ready_for_review`?`review`:e.mission.mode===`direct`?`direct`:`orchestrated`}function wo(e,t){let n=e.filter(e=>Co(e)!==null),r=new Map(n.map(e=>[e.missionId,e])),i={},a=new Set;for(let[e,n]of Object.entries(t)){let t=r.get(e),o=So(n);!t||!o||o.kind!==Co(t)||a.has(o.id)||(i[e]=o.id,a.add(o.id))}let o=[...n].sort((e,t)=>e.createdAt-t.createdAt||e.missionId.localeCompare(t.missionId));for(let e of o){if(i[e.missionId])continue;let n=Co(e);if(!n)continue;let r=So(t[e.missionId]??``)?.floorIndex,o=n===`orchestrated`?function*(){yield 0;for(let e=1;;e+=1)yield e}():function*(){yield 0;for(let e=1e3;;e+=1)yield e}(),s=r===void 0?o:function*(){yield r;for(let e of o)e!==r&&(yield e)}(),c;for(let e of s)if(c=xo(e).find(e=>e.kind===n&&!a.has(e.id)),c)break;c&&(i[e.missionId]=c.id,a.add(c.id))}return{assignments:i,placements:Object.entries(i).flatMap(([e,t])=>{let n=r.get(e),i=So(t);return n&&i?[{mission:n,slotId:t,spaceId:i.spaceId,seatIndex:i.seatIndex,kind:i.kind,floorIndex:i.floorIndex}]:[]}),unplaced:n.filter(e=>!i[e.missionId])}}function To(e,t){let n=Object.entries(e),r=Object.entries(t);return n.length===r.length&&n.every(([e,n])=>t[e]===n)}var Eo=`hive:office-checkpoint`,Do=6e5;function Oo(){try{return typeof window>`u`?void 0:window.sessionStorage}catch{return}}function ko(e=Date.now()){let t=Oo();if(t)try{let n=t.getItem(Eo);if(!n)return;let r=JSON.parse(n);return typeof r?.savedAt!=`number`||e-r.savedAt>Do||!Array.isArray(r.queue)?void 0:{savedAt:r.savedAt,queue:r.queue.filter(e=>!!(e&&typeof e.targetId==`string`&&typeof e.startsAt==`number`&&typeof e.duration==`number`)),presented:Array.isArray(r.presented)?r.presented.filter(e=>typeof e==`string`):[],seats:r.seats&&typeof r.seats==`object`?Object.fromEntries(Object.entries(r.seats).filter(([,e])=>typeof e==`number`)):{}}}catch{return}}function Ao(e,t=Date.now()){let n=Oo();if(n)try{let r=e.queue.filter(e=>e.startsAt+e.duration>t);n.setItem(Eo,JSON.stringify({...e,queue:r,savedAt:t}))}catch{}}function jo(e,t,n=Date.now()){if(!e)return;let r=e.queue.filter(e=>e.startsAt+e.duration>n&&t.has(e.targetId)),i=e.presented.filter(e=>t.has(e)),a=Object.fromEntries(Object.entries(e.seats).filter(([e])=>t.has(e)));if(!(!r.length&&!i.length&&!Object.keys(a).length))return{savedAt:e.savedAt,queue:r,presented:i,seats:a}}var Mo,No=!1,Po=new Set;function Fo(){for(let e of Po)e()}function Io(e=Date.now()){if(No||=(Mo=ko(e),!0),!Mo)return;let t=Mo.queue.filter(t=>t.startsAt+t.duration>e);return{...Mo,queue:t}}function Lo(e,t=Date.now()){let n=Io(t)??{savedAt:t,queue:[],presented:[],seats:{}},r=e.missionId,i=e=>!r||e===r||e.startsWith(`${r}:`),a={savedAt:t,queue:[...n.queue.filter(e=>!i(e.targetId)),...e.queue].filter(e=>e.startsAt+e.duration>t),presented:[...new Set([...n.presented.filter(e=>!i(e)),...e.presented])],seats:{...Object.fromEntries(Object.entries(n.seats).filter(([e])=>!i(e))),...e.seats}};Mo=a,No=!0,Ao(a,t),Fo()}function Ro(e,t,n,r){let i={},a=new Map,o;for(let[s,c]of Object.entries(t)){let t=e.get(s);if(!t){i[s]=c,a.set(s,{state:c,since:n});continue}if(t.state===c){i[s]=c,a.set(s,t);continue}let l=t.since+r;if(n<l){i[s]=t.state,a.set(s,t),o=o===void 0?l:Math.min(o,l);continue}i[s]=c,a.set(s,{state:c,since:n})}return{states:i,held:a,nextExpiry:o}}var zo=typeof window>`u`?g.useEffect:g.useLayoutEffect,Bo=3e4,Vo=0,Ho=new Set([`room-activate`,`desk-reserved`,`entering`,`arrived`]),Uo=512;function Wo(e,t,n,r,i=0,a=!1,o={}){let s=(0,g.useMemo)(()=>e.map(e=>e.mission),[e]),c=o.scope,l=(0,g.useRef)(c),u=(0,g.useRef)(),d=(0,g.useRef)([]),[f,p]=(0,g.useState)([]),[m,h]=(0,g.useState)(()=>Date.now()),[_,v]=(0,g.useState)([]),[y,b]=(0,g.useState)({}),x=(0,g.useRef)({}),[S,C]=(0,g.useState)({}),w=(0,g.useRef)(new Map),T=(0,g.useRef)(new Set),E=(0,g.useRef)(new Map),D=(0,g.useRef)(new Set),O=(0,g.useRef)(new Map),k=(0,g.useRef)(new Map),A=(0,g.useRef)(new Set),j=(0,g.useRef)(new Map),M=(0,g.useRef)([]);M.current=f;let N=(0,g.useRef)(new Map),P=(0,g.useRef)(new Map),F=(0,g.useRef)({}),I=(0,g.useRef)(new Set),[L,ee]=(0,g.useState)(0),[R,te]=(0,g.useState)({}),[z,ne]=(0,g.useState)(()=>typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches);(0,g.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>ne(e.matches);return t(),e.addEventListener?.(`change`,t),()=>e.removeEventListener?.(`change`,t)},[]);let B=r===`full`||r===`system`&&!z,re=(e,t)=>{let n=e.filter(e=>e.startsAt+e.duration<=t&&!A.current.has(e.id));if(!n.length)return;for(let e of n)A.current.add(e.id);A.current.size>Uo&&(A.current=new Set([...A.current].slice(-256)));for(let e of n)e.action===`arrived`&&D.current.add(e.targetId);let r=n.filter(e=>e.workerId&&e.action===`exiting`);if(!r.length)return;let i={...x.current},a=!1;for(let n of r){let r=e.some(e=>e.targetId===n.targetId&&e.action===`entering`&&e.startsAt>t);!r&&i[n.targetId]!==void 0&&(delete i[n.targetId],a=!0),D.current.delete(n.targetId);let o=E.current.get(n.targetId);o&&(o.exited=!r)}a&&(x.current=i,b(i))};zo(()=>{if(a){u.current||(u.current=s,d.current=e);return}let n=Date.now();if(c!==l.current&&(l.current=c,u.current=void 0),!u.current||!B){v([]),x.current={},b({}),C({}),w.current.clear(),te({}),D.current.clear(),T.current=new Set(s.flatMap(e=>e.recentEvents.map(e=>`${e.sessionId}:${e.jobId??``}:${e.ts}:${e.hookEventName??``}:${e.toolName??``}:${e.targetWorker??``}`))),E.current.clear();for(let e of s)for(let t of e.workers)E.current.set(`${e.missionId}:${t.id}`,{missionId:e.missionId,workerId:t.id,launched:!0,stopped:!!t.doneAt,completionQueued:!!t.doneAt,exited:!!t.doneAt});if(!B)p([]);else{let e=new Set;for(let t of s){e.add(t.missionId);for(let n of t.workers)e.add(`${t.missionId}:${n.id}`)}let t=jo(Io(n),e,n),r=new Set((t?.queue??[]).filter(e=>e.action===`desk-reserved`||e.action===`entering`||e.action===`arrived`).map(e=>e.targetId));for(let t of e)r.has(t)||D.current.add(t);for(let e of t?.presented??[])D.current.add(e);for(let t of e)j.current.set(t,n-Vo);for(let e of r){let[t,...n]=e.split(`:`),r=n.join(`:`);r&&E.current.set(e,{missionId:t,workerId:r,launched:!0,stopped:!1,completionQueued:!1,exited:!1})}x.current=t?.seats??{},b(t?.seats??{}),p(t?t.queue.filter(e=>e.startsAt+e.duration>n):[]),I.current=new Set([i])}}else{if(!I.current.has(i)){I.current.add(i);for(let t of e){if(t.floorIndex!==i)continue;let e=t.mission;for(let t of e.recentEvents)T.current.add(`${t.sessionId}:${t.jobId??``}:${t.ts}:${t.hookEventName??``}:${t.toolName??``}:${t.targetWorker??``}`);D.current.add(e.missionId);for(let t of e.workers){let r=`${e.missionId}:${t.id}`;t.doneAt||D.current.add(r),j.current.set(r,n-Vo),E.current.set(r,{missionId:e.missionId,workerId:t.id,launched:!0,stopped:!!t.doneAt,completionQueued:!!t.doneAt,exited:!!t.doneAt})}}}let r=e=>e.map(e=>({...e,workers:[],activityStatus:`idle`})),a=ka(r(u.current),r(s),n),o=ka(u.current,s,n).filter(e=>e.workerId&&(e.action===`desk-reserved`||e.action===`entering`||e.action===`arrived`||e.action===`reporting`||e.action===`exiting`)),c=new Set(u.current.map(e=>e.missionId)),l=a.filter(e=>!c.has(e.missionId)),f=a.filter(e=>c.has(e.missionId)&&[`moving-to-review`,`awaiting-acceptance`,`accepted-completion`,`paused`,`resumed`].includes(e.action)),m=new Map(e.map(e=>[e.mission.missionId,e.floorIndex])),h=new Set(s.flatMap(e=>e.workers.map(t=>`${e.missionId}:${t.id}`)));for(let e of h)j.current.has(e)||j.current.set(e,n);for(let e of[...j.current.keys()])!h.has(e)&&!D.current.has(e)&&j.current.delete(e);let g=e=>D.current.has(e)||n-(j.current.get(e)??n)>=Vo,_=s.flatMap(e=>e.recentEvents.map(t=>({mission:e,event:t}))).filter(({mission:e})=>m.get(e.missionId)===i).filter(({mission:e,event:t})=>t.targetWorker&&t.targetWorker!==`hive-orchestrator`&&(t.hookEventName===`SubagentStart`||t.hookEventName===`SubagentStop`||t.hookEventName===`PostToolUse`&&t.toolName===`Agent`)).filter(({mission:e,event:t})=>g(`${e.missionId}:${t.targetWorker}`)).sort((e,t)=>e.event.ts-t.event.ts).filter(({event:e})=>{let t=`${e.sessionId}:${e.jobId??``}:${e.ts}:${e.hookEventName??``}:${e.toolName??``}:${e.targetWorker??``}`;return!T.current.has(t)&&(T.current.add(t),!0)}),y=[...l,...f],S=new Map(d.current.map(e=>[e.mission.missionId,e])),k=[];for(let e of y){let t=m.get(e.missionId),r=S.get(e.missionId)?.floorIndex;if(e.action===`moving-to-review`&&t!==void 0&&r!==void 0&&t!==r){if(i===r&&k.push({...e,id:`${e.id}:source`}),i===t)k.push({...e,id:`${e.id}:destination`});else{let r=w.current.get(t)??{queuedAt:n,transitions:[]};r.transitions=[...r.transitions,{...e,id:`${e.id}:destination`}].slice(-32),w.current.set(t,r)}continue}if(t!==void 0&&t!==i&&Ho.has(e.action)){let r=w.current.get(t)??{queuedAt:n,transitions:[]};r.transitions=[...r.transitions,e].slice(-32),w.current.set(t,r)}else k.push(e)}let A=w.current.get(i);if(A&&(w.current.delete(i),n-A.queuedAt<=Bo)){let e=Math.min(...A.transitions.map(e=>e.startsAt));k.push(...A.transitions.map(t=>({...t,startsAt:n+t.startsAt-e})))}for(let[e,t]of w.current)n-t.queuedAt>Bo&&w.current.delete(e);te(Object.fromEntries([...w.current].map(([e,t])=>[e,new Set(t.transitions.map(e=>e.targetId)).size])));let P=l.filter(e=>m.get(e.missionId)===i),F=o.filter(e=>m.get(e.missionId)===i).filter(e=>g(e.targetId)),L=k.filter(e=>f.some(t=>t.missionId===e.missionId&&t.action===e.action));re(M.current,n);for(let e of F)!e.workerId||E.current.has(e.targetId)||E.current.set(e.targetId,{missionId:e.missionId,workerId:e.workerId,launched:!0,stopped:!1,completionQueued:!1,exited:!1});let ee=_.map(({mission:e,event:t})=>({missionId:e.missionId,workerId:t.targetWorker,kind:t.hookEventName===`SubagentStop`?`stop`:`start`,storyKey:`${t.jobId??t.sessionId}:${t.targetWorker}:${t.ts}`})),R=new Set(e.flatMap(e=>e.mission.workers.filter(e=>e.doneAt).map(t=>`${e.mission.missionId}:${t.id}`))),z=ja(ee,E.current,n,R);E.current=z.lifecycles;let ne=new Map(u.current.flatMap(e=>e.workers.map(t=>[`${e.missionId}:${t.id}`,t]))),B=new Set(s.flatMap(e=>e.workers.filter(t=>!t.doneAt&&ne.get(`${e.missionId}:${t.id}`)?.doneAt).map(t=>`${e.missionId}:${t.id}`)));for(let e of B){D.current.add(e);let t=E.current.get(e);t&&(t.completionQueued=!1,t.exited=!1,t.stopped=!1)}for(let e of s)for(let t of e.workers)N.current.set(`${e.missionId}:${t.id}`,{missionId:e.missionId,worker:t});p(e=>{let t=Ma(e,[...P,...F],n);return z.stories.length&&(t=Ma(t,z.stories,n)),t=Ma(t,L,n),B.size?t.flatMap(e=>!B.has(e.targetId)||e.action!==`reporting`&&e.action!==`exiting`?[e]:e.startsAt>n?[]:[{...e,duration:Math.max(0,n-e.startsAt)}]):t});let V=new Set(e.map(e=>e.mission.missionId)),ie=d.current.filter(e=>!V.has(e.mission.missionId)),ae=d.current.filter(t=>e.some(e=>e.mission.missionId===t.mission.missionId&&(e.slotId!==t.slotId||e.floorIndex!==t.floorIndex)));v(t=>{let n=new Set(e.map(e=>e.slotId)),r=t.filter(e=>!n.has(e.slotId)),i=new Set(r.map(e=>e.slotId)),a=[...ie.map(e=>({...e,retained:!0})),...ae.map(e=>({...e,retained:!0,relocated:!0}))];return[...r,...a.filter(e=>!i.has(e.slotId))]});let H=new Map(d.current.map(e=>[e.mission.missionId,e])),U=[];for(let t of e){let e=H.get(t.mission.missionId);if(t.kind!==`review`||e?.kind!==`orchestrated`)continue;let n=Li(Ri(e.floorIndex)).find(t=>t.id===e.spaceId);if(!n)continue;if(O.current.set(t.mission.missionId,e),e.floorIndex!==t.floorIndex){U.push([t.mission.missionId,{position:{x:12.28,y:2.9},doorway:{x:11.9,y:3.18},inside:{x:12.28,y:3.18}}]);continue}let r=n.x+n.width*.83;U.push([t.mission.missionId,{position:{x:n.x+.94,y:n.y+1.6},doorway:{x:r,y:3.15},inside:{x:r,y:n.y===0?2.55:3.75}}])}U.length&&C(e=>({...e,...Object.fromEntries(U)}));let W={},oe=new Set(_.map(({mission:e,event:t})=>`${e.missionId}:${t.targetWorker}`));for(let e of oe){if(x.current[e]!==void 0)continue;let n=e.slice(0,e.lastIndexOf(`:`)),r=new Set([...Object.entries(t),...Object.entries(x.current),...Object.entries(W)].filter(([t])=>t!==e&&t.startsWith(`${n}:`)).map(([,e])=>e)),i=t[e],a=i!==void 0&&!r.has(i)?i:Array.from({length:4},(e,t)=>t).find(e=>!r.has(e));a!==void 0&&(W[e]=a)}Object.keys(W).length&&(x.current={...x.current,...W},b(x.current))}u.current=s,d.current=e,h(n)},[B,n,s,e,i,a,t]),(0,g.useEffect)(()=>{if(!Object.keys(R).length)return;let e=Math.min(...[...w.current.values()].map(e=>e.queuedAt+Bo)),t=window.setTimeout(()=>{let e=Date.now();for(let[t,n]of w.current)e-n.queuedAt>=Bo&&w.current.delete(t);te(Object.fromEntries([...w.current].map(([e,t])=>[e,new Set(t.transitions.map(e=>e.targetId)).size])))},Math.max(16,e-Date.now()+8));return()=>window.clearTimeout(t)},[R]),(0,g.useEffect)(()=>{if(!f.length)return;let e=Math.min(...f.map(e=>e.startsAt>m?e.startsAt:e.startsAt+e.duration)),t=window.setTimeout(()=>{let e=Date.now();h(e),p(t=>{re(t,e);for(let n of[...O.current.keys()])t.some(t=>t.missionId===n&&t.action===`moving-to-review`&&t.startsAt>e)||O.current.delete(n);let n=Ma(t,[],e),r=new Set(n.map(e=>e.missionId));return v(e=>e.some(e=>!r.has(e.mission.missionId))?e.filter(e=>r.has(e.mission.missionId)):e),C(e=>Object.keys(e).some(e=>!r.has(e))?Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e))):e),n})},Math.max(16,e-Date.now()+8));return()=>window.clearTimeout(t)},[m,f]),(0,g.useEffect)(()=>{B&&Lo({missionId:c,queue:f,presented:[...D.current],seats:{...F.current,...x.current}})},[B,f,m,c]);let V=(0,g.useMemo)(()=>{let t={};for(let n of e){t[n.mission.missionId]=Yi(n.mission);for(let e of n.mission.workers)t[`${n.mission.missionId}:${e.id}`]=Ji(e,n.mission)}return Ro(k.current,t,m,wa)},[e,m,L]);return k.current=V.held,(0,g.useEffect)(()=>{if(V.nextExpiry===void 0)return;let e=window.setTimeout(()=>ee(e=>e+1),Math.max(16,V.nextExpiry-Date.now()+8));return()=>window.clearTimeout(e)},[V.nextExpiry]),(0,g.useMemo)(()=>{let n=new Set(e.map(e=>e.mission.missionId)),r=Fa(f,m);for(let e of f)!r[e.targetId]&&e.startsAt>m&&!D.current.has(e.targetId)&&(e.action===`room-activate`||e.action===`entering`)&&(r[e.targetId]=`room-activate`);for(let[e,t]of E.current)t.exited&&(r[e]=`room-activate`);for(let e of Object.keys(y))!r[e]&&!D.current.has(e)&&(r[e]=`desk-reserved`);for(let[e,t]of j.current)!D.current.has(e)&&m-t<Vo&&(r[e]=`room-activate`);let i=new Set(_.filter(e=>!e.relocated).map(e=>e.mission.missionId)),a=Pa(e,O.current,f,m).filter(e=>!i.has(e.mission.missionId)),o=new Set(e.flatMap(e=>e.mission.workers.filter(e=>!e.doneAt).map(t=>`${e.mission.missionId}:${t.id}`))),s=new Set(f.filter(e=>e.workerId&&e.startsAt+e.duration>m).map(e=>e.targetId));for(let e of[...P.current.keys()])!o.has(e)&&!s.has(e)&&y[e]===void 0&&P.current.delete(e);let c=Xi(t,{...Object.fromEntries(P.current),...y});for(let[e,t]of Object.entries(c))!P.current.has(e)&&(o.has(e)||s.has(e))&&P.current.set(e,t);F.current=Object.fromEntries(P.current);let l={},u=new Set;for(let t of e)for(let e of t.mission.workers){let n=`${t.mission.missionId}:${e.id}`;(l[t.mission.missionId]??=[]).push(e),u.add(n)}for(let[e,t]of N.current)if(!u.has(e)){if(!s.has(e)&&c[e]===void 0){N.current.delete(e);continue}(l[t.missionId]??=[]).push(t.worker)}for(let e of Object.values(l))e.sort((e,t)=>e.startedAt-t.startedAt||e.id.localeCompare(t.id));let d={},p={};for(let e of f)e.startsAt+e.duration<=m||((d[e.targetId]??=[]).push(e.action),e.startsAt<=m&&r[e.targetId]===e.action&&(p[e.targetId]=e.startsAt));let h=[...D.current];return{transitions:r,transitionStarts:p,queuedActions:d,clock:m,animated:B,presentedStates:V.states,presented:h,sceneWorkers:l,placements:[...a,..._.filter(t=>(!n.has(t.mission.missionId)||e.some(e=>e.mission.missionId===t.mission.missionId&&e.slotId!==t.slotId))&&!(t.relocated&&a.some(e=>e.slotId===t.slotId&&e.mission.missionId===t.mission.missionId)))],workerSeats:c,transferOrigins:S,pendingArrivals:R}},[B,m,R,e,V.states,f,_,y,S,t])}function Go(){let e=(0,g.useRef)(null),[t,n]=(0,g.useState)(()=>typeof document>`u`||document.visibilityState!==`hidden`),[r,i]=(0,g.useState)(!0);return(0,g.useEffect)(()=>{let e=()=>n(document.visibilityState!==`hidden`);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,g.useEffect)(()=>{let t=e.current;if(!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(([e])=>i(e?.isIntersecting??!0),{rootMargin:`120px`});return n.observe(t),()=>n.disconnect()},[]),{sceneRef:e,active:t&&r}}function Ko({missions:e,allMissions:t,roomAssignments:n,workerSeatAssignments:r,announcement:i,onAssignmentsChange:a,connected:o,suspended:s=!1,selectedFloor:c=0,onSelectedFloorChange:l=()=>void 0,motion:u=`system`,onMotionChange:d=()=>void 0,dialogue:f=`work_personality`,onDialogueChange:p=()=>void 0,attentionMissionIds:m=new Set,onSelectMission:h,onSelectWorker:_=()=>void 0,onSelectDirectStudio:v=()=>void 0,onSelectReviewHall:y=()=>void 0}){let b=(0,g.useMemo)(()=>wo(t,n),[t,n]),x=(0,g.useMemo)(()=>Zi(b.placements,r),[b.placements,r]);(0,g.useEffect)(()=>{(!To(n,b.assignments)||!Qi(r,x))&&a(b.assignments,x)},[a,b.assignments,n,r,x]);let S=(0,g.useMemo)(()=>new Set(e.map(e=>e.missionId)),[e]),C=(0,g.useMemo)(()=>[...new Set([0,c,...b.placements.map(e=>e.floorIndex)])].sort((e,t)=>e-t),[b.placements,c]),w=C.includes(c)?c:0,T=Wo(b.placements,x,o,u,w,s),E=Go();(0,g.useEffect)(()=>{w!==c&&l(w)},[w,l,c]);let D=(0,g.useMemo)(()=>C.map(e=>{let t=b.placements.filter(t=>t.floorIndex===e),n=t.filter(({mission:e})=>m.has(e.missionId)).length;return{floorIndex:e,occupied:t.length,attention:n}}),[m,C,b.placements]),k=T.placements.filter(e=>e.floorIndex===w),[j,M]=(0,g.useState)(()=>Date.now());(0,g.useEffect)(()=>{if(f===`off`||!E.active)return;let e=window.setInterval(()=>M(Date.now()),2e3);return()=>window.clearInterval(e)},[f,E.active]);let N=(0,g.useMemo)(()=>eo(T.placements,f,j),[f,j,T.placements]),P=b.unplaced.filter(e=>S.has(e.missionId));return(0,O.jsxs)(`section`,{ref:E.sceneRef,"aria-label":`Visual office`,className:`space-y-4`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.22em] text-amber-200/40`,children:`Visual office`}),(0,O.jsx)(`h2`,{className:`mt-1 text-lg font-semibold text-white/75`,children:`Hive headquarters`}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-white/30`,children:`Live missions remain in stable desks and rooms until their lifecycle releases them.`})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex gap-2.5 text-[9px] text-white/35`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`b`,{className:`text-[#55c7b3]`,children:`◆`}),` Direct`]}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`b`,{className:`text-[#a78bfa]`,children:`◆`}),` Orchestrated`]}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`b`,{className:`text-[#e6bd62]`,children:`◆`}),` Review`]})]}),(0,O.jsxs)(`label`,{className:`flex items-center gap-1.5 rounded-full border border-white/[0.08] bg-black/15 px-2.5 py-1 text-[9px] text-white/35`,children:[(0,O.jsx)(`span`,{children:`Talk`}),(0,O.jsxs)(`select`,{"aria-label":`Office dialogue`,value:f,onChange:e=>p(e.target.value),className:`bg-transparent text-[9px] text-white/55 outline-none`,children:[(0,O.jsx)(`option`,{value:`off`,children:`Off`}),(0,O.jsx)(`option`,{value:`work`,children:`Work only`}),(0,O.jsx)(`option`,{value:`work_personality`,children:`Work + personality`})]})]}),(0,O.jsxs)(`label`,{className:`flex items-center gap-1.5 rounded-full border border-white/[0.08] bg-black/15 px-2.5 py-1 text-[9px] text-white/35`,children:[(0,O.jsx)(`span`,{children:`Motion`}),(0,O.jsxs)(`select`,{"aria-label":`Office motion`,value:u,onChange:e=>d(e.target.value),className:`bg-transparent text-[9px] text-white/55 outline-none`,children:[(0,O.jsx)(`option`,{value:`system`,children:`System`}),(0,O.jsx)(`option`,{value:`full`,children:`On`}),(0,O.jsx)(`option`,{value:`reduced`,children:`Reduced`})]})]}),(0,O.jsx)(`span`,{className:`rounded-full border px-2.5 py-1 text-[10px] ${o?`border-emerald-300/15 bg-emerald-300/[0.05] text-emerald-200/55`:`border-orange-300/20 bg-orange-300/[0.06] text-orange-100/65`}`,children:o?`Live`:`Last durable snapshot`})]})]}),Object.keys(T.pendingArrivals).length>0&&(0,O.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-wrap items-center gap-2 rounded-xl border border-emerald-300/15 bg-emerald-300/[0.045] px-3 py-2`,children:[(0,O.jsx)(`span`,{className:`text-[10px] font-medium text-emerald-100/65`,children:`New arrival elsewhere:`}),Object.entries(T.pendingArrivals).map(([e,t])=>(0,O.jsxs)(`button`,{type:`button`,onClick:()=>l(Number(e)),className:`rounded-lg border border-emerald-200/15 bg-emerald-200/[0.06] px-2.5 py-1 text-[10px] text-emerald-100/70 transition hover:border-emerald-200/30 hover:bg-emerald-200/[0.1]`,children:[t,` new agent`,t===1?``:`s`,` in `,Z(Number(e)),` · View`]},e))]}),C.length>1&&(0,O.jsx)(`nav`,{"aria-label":`Office floors`,className:`flex gap-2 overflow-x-auto rounded-xl border border-white/[0.07] bg-black/15 p-2`,children:D.map(e=>{let t=T.pendingArrivals[e.floorIndex]??0;return(0,O.jsxs)(`button`,{type:`button`,"aria-current":w===e.floorIndex?`page`:void 0,onClick:()=>l(e.floorIndex),className:`min-w-36 rounded-lg border px-3 py-2 text-left transition ${w===e.floorIndex?`border-amber-300/25 bg-amber-300/[0.08]`:t?`animate-pulse border-emerald-300/30 bg-emerald-300/[0.07] hover:bg-emerald-300/[0.11]`:`border-white/[0.06] bg-white/[0.02] hover:border-white/15 hover:bg-white/[0.04]`}`,children:[(0,O.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[10px] font-semibold uppercase tracking-wider text-white/65`,children:[(0,O.jsx)(`span`,{children:Z(e.floorIndex)}),t>0&&(0,O.jsx)(`span`,{className:`rounded-full bg-emerald-300/15 px-1.5 py-0.5 text-[8px] text-emerald-100/75`,children:`New`})]}),(0,O.jsxs)(`span`,{className:`mt-1 block text-[9px] text-white/28`,children:[e.occupied,` occupied`,e.attention?` · ${e.attention} attention`:``]})]},e.floorIndex)})}),(0,O.jsx)(ho,{floorIndex:w,placements:k,workerSeatAssignments:T.workerSeats,visibleMissionIds:S,attentionMissionIds:m,transitions:T.transitions,transitionStarts:T.transitionStarts,sceneWorkers:T.sceneWorkers,presentedStates:T.presentedStates,transferOrigins:T.transferOrigins,bubbles:N,announcement:i,motion:u,active:E.active,onOpenMission:h,onOpenWorker:_,onOpenDirectStudio:v,onOpenReviewHall:y}),t.length===0?(0,O.jsxs)(`div`,{className:`rounded-xl border border-dashed border-white/8 px-4 py-5 text-center`,children:[(0,O.jsx)(`p`,{className:`text-xs font-medium text-white/45`,children:`The office is ready for its first mission`}),(0,O.jsx)(`p`,{className:`mt-1 text-[10px] text-white/25`,children:`Start a mission above and Hive will assign a compatible workspace.`})]}):e.length===0?(0,O.jsx)(`div`,{className:`rounded-xl border border-dashed border-white/8 px-4 py-5 text-center text-xs text-white/30`,children:`No missions match the current fleet filters. Existing assignments are preserved.`}):P.length>0?(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,O.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-wider text-orange-200/45`,children:`Waiting for compatible space`}),(0,O.jsxs)(`p`,{className:`text-[10px] text-white/20`,children:[P.length,` overflow`]})]}),(0,O.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:P.map(e=>(0,O.jsxs)(`button`,{type:`button`,onClick:()=>h(e.missionId),"aria-label":`Open ${e.name} mission`,className:`group rounded-xl border border-orange-300/[0.12] bg-orange-300/[0.025] p-3 text-left hover:border-orange-300/25`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,O.jsx)(`h3`,{className:`truncate text-xs font-medium text-white/55 group-hover:text-white/75`,children:e.name}),(0,O.jsxs)(`div`,{className:`flex gap-1`,children:[(0,O.jsx)(mn,{status:e.lifecycleStatus}),(0,O.jsx)(A,{status:e.activityStatus})]})]}),(0,O.jsxs)(`p`,{className:`mt-2 text-[9px] text-white/22`,children:[e.mission.mode,` · no compatible space on Floor 1`]})]},e.missionId))})]}):null]})}function qo({sounds:e,notifications:t,onOpenPolicies:n,onOpenTemplates:r}){let[i,a]=(0,g.useState)(!1),o=(0,g.useRef)(null);Ke(i,ze.modal,()=>a(!1)),(0,g.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[i]);let s=`flex w-full items-center justify-between gap-6 rounded-md px-3 py-2 text-left text-xs text-white/60 transition hover:bg-white/[0.05] hover:text-white/90`,c=e=>`mono text-[10px] ${e?`text-amber-200/70`:`text-white/25`}`;return(0,O.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-expanded":i,"aria-haspopup":`menu`,"aria-label":`Workspace settings`,title:`Sound, notifications, policies, and templates`,onClick:()=>a(!i),className:`rounded-lg border px-3 py-2 text-xs transition ${i?`border-white/25 bg-white/[0.06] text-white/80`:`border-white/10 text-white/40 hover:border-white/25 hover:text-white/70`}`,children:`Settings`}),i&&(0,O.jsxs)(`div`,{role:`menu`,className:`absolute right-0 top-full z-40 mt-1.5 w-60 rounded-xl border border-white/10 bg-[#16161b] p-1.5 shadow-2xl shadow-black/60`,children:[e&&(0,O.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":e.enabled,onClick:()=>e.toggle(),className:s,children:[(0,O.jsx)(`span`,{children:`Sound alerts`}),(0,O.jsx)(`span`,{className:c(e.enabled),children:e.enabled?`On`:`Off`})]}),t?.supported&&(0,O.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":t.enabled,onClick:()=>void t.toggle(),className:s,children:[(0,O.jsx)(`span`,{children:`Desktop notifications`}),(0,O.jsx)(`span`,{className:c(t.enabled),children:t.enabled?`On`:`Off`})]}),(0,O.jsx)(`div`,{className:`my-1 border-t border-white/[0.06]`}),(0,O.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{a(!1),n()},className:s,children:`Workspace policy`}),(0,O.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{a(!1),r()},className:s,children:`Mission templates`})]})]})}function Jo({label:e,eyebrow:t,title:n,subtitle:r,accent:i=`amber`,onClose:a,closeLabel:o,children:s,afterHeader:c}){Ke(!0,ze.drawer,a);let l=Le(a),u=i===`needs-you`?`text-rose-300/60`:`text-amber-300/55`;return(0,O.jsx)(`div`,{className:`fixed inset-0 z-50 flex justify-end bg-black/55`,role:`presentation`,...l,children:(0,O.jsxs)(`aside`,{role:`dialog`,"aria-modal":`true`,"aria-label":e,onMouseDown:e=>e.stopPropagation(),className:`flex h-full w-full max-w-[480px] flex-col border-l border-white/10 bg-[#0d0d10] shadow-2xl`,children:[(0,O.jsxs)(`div`,{className:`sticky top-0 z-10 flex shrink-0 items-start justify-between gap-4 border-b border-white/8 bg-[#0d0d10]/95 px-6 py-5 backdrop-blur`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.16em] ${u}`,children:t}),(0,O.jsx)(`h2`,{className:`mt-1 text-lg font-semibold text-white`,children:n}),r&&(0,O.jsx)(`p`,{className:`mt-1 text-[11px] text-white/25`,children:r})]}),(0,O.jsx)(`button`,{type:`button`,onClick:a,"aria-label":o,className:`shrink-0 cursor-pointer rounded-lg border border-white/10 px-2.5 py-1.5 text-sm text-white/40 hover:bg-white/5 hover:text-white`,children:`×`})]}),c,(0,O.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:s})]})})}var Yo=1e4;function Xo(e){let t=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),r=Math.round(e%6e4/1e3);return[t&&`${t}h`,n&&`${n}m`,r&&`${r}s`].filter(Boolean).join(``)||`0s`}function Zo(e,t){let n=e-t;return n<=0?`due now`:`in ${Xo(n)}`}function Qo(){let[e,t]=(0,g.useState)({loops:[],monitors:[]}),n=(0,g.useCallback)(()=>{te().then(t).catch(()=>void 0)},[]);return(0,g.useEffect)(()=>{n();let e=setInterval(n,Yo);return()=>clearInterval(e)},[n]),{tasks:e,refresh:n}}function $o({tasks:e,onRefresh:t,onClose:n,onOpenMission:r}){let[i,a]=(0,g.useState)(),[o,s]=(0,g.useState)(),c=Date.now(),l=e.loops.length+e.monitors.length;async function u(e,n){a(e),s(void 0);try{await n(),t()}catch(e){s(e.message)}finally{a(void 0)}}return(0,O.jsx)(Jo,{label:`Active loops and monitors`,eyebrow:`Tasks`,title:l?`${l} running`:`Nothing running`,subtitle:`Recurring prompts Hive is sending, and background watchers a mission has open · Esc to close`,onClose:n,closeLabel:`Close tasks`,children:(0,O.jsxs)(`div`,{className:`space-y-6 p-5`,children:[o&&(0,O.jsx)(`p`,{className:`rounded-lg border border-rose-300/20 bg-rose-300/[0.05] px-3 py-2 text-[11px] text-rose-200/75`,children:o}),(0,O.jsxs)(`section`,{children:[(0,O.jsxs)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-violet-200/55`,children:[`Loops · `,e.loops.length]}),(0,O.jsx)(`p`,{className:`mt-1 text-[11px] text-white/30`,children:`Prompts Hive re-sends on a schedule. Stopping one is immediate.`}),e.loops.length===0?(0,O.jsxs)(`p`,{className:`mt-3 text-xs text-white/25`,children:[`No loops are running. Start one from a mission conversation with `,(0,O.jsx)(`code`,{className:`text-violet-300/70`,children:`/loop 10m …`})]}):(0,O.jsx)(`ul`,{className:`mt-3 space-y-2`,children:e.loops.map(e=>(0,O.jsx)(`li`,{className:`rounded-xl border border-white/[0.08] bg-white/[0.02] p-3`,children:(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>r(e.missionId),className:`cursor-pointer text-xs font-semibold text-violet-300/80 hover:text-violet-200`,children:[e.missionName??e.missionId,` ↗`]}),(0,O.jsx)(`p`,{className:`mt-1 break-words text-[11px] leading-relaxed text-white/55`,children:e.prompt}),(0,O.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-white/28`,children:[`every `,Xo(e.intervalMs),` · next `,Zo(e.nextRunAt,c),` · `,e.runCount,` run`,e.runCount===1?``:`s`,` · `,(0,O.jsx)(`code`,{className:`text-white/35`,children:e.id})]})]}),(0,O.jsx)(`button`,{type:`button`,disabled:i===e.id,onClick:()=>u(e.id,()=>z(e.id)),className:`shrink-0 cursor-pointer rounded-lg border border-rose-300/25 bg-rose-300/[0.06] px-2.5 py-1.5 text-[10px] font-medium text-rose-100/75 transition hover:bg-rose-300/[0.12] disabled:opacity-40`,children:i===e.id?`Stopping…`:`Stop loop`})]})},e.id))})]}),(0,O.jsxs)(`section`,{children:[(0,O.jsxs)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-amber-200/55`,children:[`Monitors · `,e.monitors.length]}),(0,O.jsx)(`p`,{className:`mt-1 text-[11px] text-white/30`,children:`Background watchers the agent opened, by name. Hive did not start these and the CLI has no per-watcher stop — ending the turn ends all of its watchers together.`}),e.monitors.length===0?(0,O.jsx)(`p`,{className:`mt-3 text-xs text-white/25`,children:`No mission is monitoring anything right now.`}):(0,O.jsx)(`ul`,{className:`mt-3 space-y-2`,children:[...new Map(e.monitors.map(e=>[e.jobId,e])).values()].map(t=>{let n=e.monitors.filter(e=>e.jobId===t.jobId);return(0,O.jsx)(`li`,{className:`rounded-xl border border-white/[0.08] bg-white/[0.02] p-3`,children:(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>r(t.missionId),className:`cursor-pointer text-xs font-semibold text-amber-200/80 hover:text-amber-100`,children:[t.missionName,` ↗`]}),(0,O.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:n.map(e=>(0,O.jsxs)(`li`,{className:`flex items-baseline gap-2`,children:[(0,O.jsx)(`span`,{className:`mt-1 h-1 w-1 shrink-0 rounded-full bg-amber-300/70`}),(0,O.jsx)(`span`,{className:`min-w-0 break-words text-[11px] leading-relaxed text-white/60`,children:e.label}),e.startedAt>0&&(0,O.jsxs)(`span`,{className:`ml-auto shrink-0 text-[9px] text-white/22`,children:[`since `,new Date(e.startedAt).toLocaleTimeString()]})]},e.id))}),t.detail&&(0,O.jsx)(`p`,{className:`mt-1.5 break-words text-[10px] leading-relaxed text-white/28`,children:t.detail})]}),(0,O.jsx)(`button`,{type:`button`,disabled:i===t.jobId,onClick:()=>u(t.jobId,()=>ne(t.missionId)),title:`Ends the turn, stopping ${n.length===1?`this watcher`:`all ${n.length} watchers`}`,className:`shrink-0 cursor-pointer rounded-lg border border-rose-300/25 bg-rose-300/[0.06] px-2.5 py-1.5 text-[10px] font-medium text-rose-100/75 transition hover:bg-rose-300/[0.12] disabled:opacity-40`,children:i===t.jobId?`Stopping…`:n.length===1?`End the turn`:`End the turn · ${n.length}`})]})},t.jobId)})})]})]})})}function es({session:e,onHide:t}){let[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(null);async function o(){r(!0),a(null);try{await Me(e.sessionId,e.name)}catch(e){a(e.message)}finally{r(!1)}}return(0,O.jsxs)(`div`,{className:`rounded-lg border border-white/10 bg-white/[0.02] px-4 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(Ye,{missionId:`session:${e.sessionId}`,name:e.name}),(0,O.jsx)(`p`,{className:`mono truncate text-xs text-white/30`,children:e.cwd})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,O.jsx)(A,{status:e.status}),e.jobId&&(0,O.jsx)(`button`,{disabled:n,onClick:o,className:`rounded-lg border border-violet-300/15 px-3 py-1.5 text-xs text-violet-200/60 hover:bg-violet-300/[0.06] disabled:opacity-40`,children:n?`Adopting…`:`Adopt`}),(0,O.jsx)(`button`,{onClick:t,className:`rounded-lg border border-white/8 px-3 py-1.5 text-xs text-white/35 hover:bg-white/5`,children:`Hide`}),(0,O.jsx)(J,{pid:e.pid,status:e.status,force:!e.jobId,label:`End`})]})]}),i&&(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:i}),!e.jobId&&(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-white/20`,children:`Interactive process · no background-job identity to adopt safely`})]})}function ts({onStarted:e,onConfigure:t}){let[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)([]),[u,d]=(0,g.useState)([]),[f,p]=(0,g.useState)(),[m,h]=(0,g.useState)([]),[_,v]=(0,g.useState)(()=>(typeof window>`u`?null:localStorage.getItem(`hive:quick-provider`))===`codex`?`codex`:`claude`),[y,b]=(0,g.useState)(()=>typeof window>`u`?``:localStorage.getItem(`hive:quick-model:${localStorage.getItem(`hive:quick-provider`)===`codex`?`codex`:`claude`}`)??``),[x,S]=(0,g.useState)(()=>typeof window>`u`||localStorage.getItem(`hive:quick-worktree`)!==`false`),[C,w]=(0,g.useState)(()=>typeof window>`u`?``:localStorage.getItem(`hive:last-cwd`)??``),[T,E]=(0,g.useState)(()=>typeof window>`u`?!1:localStorage.getItem(`hive:quick-options`)===`true`);(0,g.useEffect)(()=>{l([]),ee(C||void 0,_).then(({skills:e})=>l(e)).catch(()=>l([]))},[C,_]),(0,g.useEffect)(()=>{U(C||void 0).then(p).catch(()=>p(void 0))},[C]),(0,g.useEffect)(()=>{H(``).then(({directories:e})=>h(e)).catch(()=>h([]))},[]),(0,g.useEffect)(()=>{Ae().then(({providers:e})=>{if(d(e),e.find(e=>e.provider===_)?.available===!1){let t=e.find(e=>e.available);t&&D(t.provider)}else if(y&&!e.find(e=>e.provider===_)?.models.some(e=>e.id===y)){b(``);try{localStorage.removeItem(`hive:quick-model:${_}`)}catch{}}}).catch(()=>d([]))},[]);function D(e){v(e);let t=typeof window>`u`?``:localStorage.getItem(`hive:quick-model:${e}`)??``,n=u.find(t=>t.provider===e)?.models??[];b(t&&n.some(e=>e.id===t)?t:``);try{localStorage.setItem(`hive:quick-provider`,e)}catch{}}function k(e){b(e);try{localStorage.setItem(`hive:quick-model:${_}`,e)}catch{}}function A(e){S(e);try{localStorage.setItem(`hive:quick-worktree`,String(e))}catch{}}function j(e){w(e);try{localStorage.setItem(`hive:last-cwd`,e)}catch{}}function M(e){t({task:n,cwd:C||void 0,mode:e,provider:_,model:y||void 0,worktree:_===`claude`&&x})}async function N(){let t=n.trim();if(!(!t||i)){a(!0),s(null);try{let n=await L({task:t,mode:`direct`,worktree:_===`claude`&&!!f?.repositoryRoot&&x,cwd:C||void 0,provider:_,model:y||void 0});r(``),e(n.missionId,t)}catch(e){s(e.message)}finally{a(!1)}}}return(0,O.jsxs)(`div`,{className:`mb-4 rounded-xl border border-violet-300/15 bg-violet-300/[0.03] p-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,O.jsx)(`div`,{className:`min-w-0 flex-1 rounded-lg border border-white/10 bg-black/20 p-1 focus-within:border-violet-300/35`,children:(0,O.jsx)(Ie,{marker:`data-quick-ask`,value:n,onChange:r,skills:c,onSubmit:N,rows:1,suggestionsPlacement:`below`,placeholder:`Ask anything — Enter starts a direct mission, / for skills… i`,className:`min-h-9`})}),(0,O.jsx)(`button`,{onClick:()=>void N(),disabled:i||!n.trim(),className:`shrink-0 rounded-lg bg-violet-500 px-4 py-2 text-sm font-semibold text-white transition hover:bg-violet-400 disabled:opacity-35`,children:i?`Starting…`:`Ask`})]}),(0,O.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-2 px-1`,children:[(0,O.jsxs)(`label`,{className:`flex min-w-0 items-center gap-1.5 text-[10px] text-white/30`,children:[(0,O.jsx)(`span`,{children:`Repository`}),(0,O.jsxs)(`select`,{"aria-label":`Quick mission repository`,value:C,onChange:e=>j(e.target.value),className:`max-w-44 rounded-md border border-white/10 bg-[#151519] px-2 py-1 text-[11px] text-white/65 outline-none transition hover:border-white/20 focus:border-violet-300/30`,children:[C&&!m.some(e=>e.path===C||e.resolvedPath===C)&&(0,O.jsx)(`option`,{value:C,children:C.split(`/`).filter(Boolean).at(-1)??C}),m.map(e=>(0,O.jsx)(`option`,{value:e.path,children:e.path.split(`/`).filter(Boolean).at(-1)??e.path},e.resolvedPath))]})]}),(0,O.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[10px] text-white/30`,children:[(0,O.jsx)(`span`,{children:`Provider`}),(0,O.jsx)(`select`,{"aria-label":`Quick mission provider`,value:_,onChange:e=>D(e.target.value),className:`rounded-md border border-white/10 bg-[#151519] px-2 py-1 text-[11px] capitalize text-white/65 outline-none transition hover:border-white/20 focus:border-violet-300/30`,children:[`claude`,`codex`].map(e=>(0,O.jsx)(`option`,{value:e,disabled:u.find(t=>t.provider===e)?.available===!1,children:e},e))})]}),(0,O.jsxs)(`label`,{className:`flex min-w-0 items-center gap-1.5 text-[10px] text-white/30`,children:[(0,O.jsx)(`span`,{children:`Model`}),(0,O.jsxs)(`select`,{"aria-label":`Quick mission model`,value:y,onChange:e=>k(e.target.value),className:`max-w-56 rounded-md border border-white/10 bg-[#151519] px-2 py-1 text-[11px] text-white/65 outline-none transition hover:border-white/20 focus:border-violet-300/30`,children:[(0,O.jsxs)(`option`,{value:``,children:[`CLI default`,u.find(e=>e.provider===_)?.defaultModel?` (${u.find(e=>e.provider===_).defaultModel.label})`:``]}),(u.find(e=>e.provider===_)?.models??[]).map(e=>(0,O.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),(0,O.jsxs)(`label`,{title:_===`codex`?`Hive-created worktrees are not yet available for Codex`:f?.repositoryRoot?`Run this direct mission in an isolated Git worktree`:`Worktrees require a Git repository`,className:`flex items-center gap-1.5 text-[10px] ${_===`claude`&&f?.repositoryRoot?`cursor-pointer text-white/40`:`cursor-not-allowed text-white/18`}`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:_===`claude`&&!!f?.repositoryRoot&&x,disabled:_!==`claude`||!f?.repositoryRoot,onChange:e=>A(e.target.checked),className:`accent-violet-400`}),(0,O.jsx)(`span`,{children:`Isolated worktree`})]}),(0,O.jsx)(`span`,{className:`text-white/10`,children:`·`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>M(`direct`),className:`text-[10px] text-white/30 transition hover:text-white/60`,children:`All settings`}),(0,O.jsx)(`span`,{className:`text-white/10`,children:`·`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>M(`orchestrated`),className:`text-[10px] text-amber-200/45 transition hover:text-amber-100/75`,children:`Need parallel workers? Use an orchestrator →`})]}),o&&(0,O.jsx)(`p`,{className:`mt-1 px-1 text-xs text-rose-400`,children:o})]})}function ns({snapshot:e,connected:t,officePreferences:n,setOfficePreferences:r,onPresentationChange:i,onSelectOrchestrator:a,activeMissionId:o,onFollowMission:s,onOpenFullMission:c,onPinWorkspace:l,onSelectDirectStudio:u,onSelectReviewHall:d,notifications:f,sounds:p}){let[m,h]=(0,g.useState)(!1),[_,v]=(0,g.useState)(),[y,b]=(0,g.useState)(!1),[x,S]=(0,g.useState)(!1),[C,w]=(0,g.useState)(!1),{tasks:T,refresh:E}=Qo(),D=T.loops.length+T.monitors.length,[k,A]=(0,g.useState)(!1),[j,M]=(0,g.useState)(null),[N,P]=(0,g.useState)(null),[F,I]=(0,g.useState)(vi);(0,g.useEffect)(()=>{bi(F)},[F]);let[L,ee]=(0,g.useState)(new Set),[R,te]=(0,g.useState)(!1),[z,ne]=(0,g.useState)(!1),B=oi(e);Ke(!0,ze.field,()=>{let e=document.activeElement;return vt(e)?(e?.blur?.(),!0):!1}),Ke(L.size>0,ze.selection,()=>{yt(document.activeElement)||ee(new Set)});let re=e=>ee(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[V,ie]=(0,g.useState)(()=>{try{return new Set(JSON.parse(localStorage.getItem(`hive:hidden-sessions`)??`[]`))}catch{return new Set}}),ae=e=>ie(t=>{let n=new Set(t).add(e);return localStorage.setItem(`hive:hidden-sessions`,JSON.stringify([...n])),n}),H=e.other.filter(e=>!V.has(e.sessionId)),U=rn(e,F,Date.now(),n.fleetSort),{filtered:W,repositories:se,templates:ce,operationalCount:le,needsMeCount:ue}=U,{operational:de,review:fe,paused:K,completed:pe,archived:me}=U.sections,he=(0,g.useMemo)(()=>Ci(e),[e]),q=(0,g.useMemo)(()=>new Set((e.decisions??[]).map(e=>e.missionId)),[e.decisions]),ge=(0,g.useMemo)(()=>e.orchestrators.filter(e=>L.has(e.missionId)),[L,e.orchestrators]),_e=(0,g.useMemo)(()=>new Set(e.orchestrators.filter(e=>tn(e,q)).map(e=>e.missionId)),[q,e.orchestrators]),ve=(0,g.useMemo)(()=>new Set(e.orchestrators.filter(e=>en(e,q)).map(e=>e.missionId)),[q,e.orchestrators]),ye=(0,g.useMemo)(()=>{let t=new Map;for(let n of e.decisions??[]){let e=t.get(n.missionId)??[];e.push(n),t.set(n.missionId,e)}return t},[e.decisions]),be=(0,g.useCallback)(()=>{v(void 0),h(!0)},[]),xe=(0,g.useCallback)(()=>ne(!0),[]),Se=(0,g.useMemo)(()=>new Map(e.orchestrators.map(e=>[e.missionId,e])),[e.orchestrators]),Ce=(e,t)=>{let n=Se.get(e);if(!n)return;let r=(ye.get(e)??[]).map(e=>({id:e.id,choices:e.choices})),i=t(n.lifecycleStatus,r);if(i){if(i.needsWords){a(e,De);return}i.answer&&i.decisionId?oe(e,i.decisionId,i.answer):i.next&&G(e,i.next)}};gi({enabled:!m&&!y&&!x&&!R&&!z,onNewMission:be,onShowHelp:xe,onFocusMission:o&&s?s:void 0,activeMissionId:o,onAffirm:e=>Ce(e,mt),onDecline:e=>Ce(e,ht),onReply:e=>a(e,De),onPauseToggle:e=>{let t=Se.get(e),n=t&&pt(t.lifecycleStatus);n&&G(e,n.next)},onOpenFull:e=>c?.(e),onToggleSelect:re});let we=Ti(n.fleetPresentation,n.fleetDensity),Te=e=>{if(e===`office`){i(`office`);return}r(t=>({...t,fleetDensity:e===`list`?`compact`:`comfortable`})),n.fleetPresentation!==`cards`&&i(`cards`)},Ee=(0,g.useMemo)(()=>Nr({missions:e.orchestrators,openMission:e=>a(e,n.fleetPresentation===`office`?`room`:`details`),replyToMission:e=>a(e,n.fleetPresentation===`office`?`room`:`details`),setLifecycle:(e,t)=>{G(e,t)},newMission:be,openTemplates:()=>b(!0),openPolicies:()=>S(!0),setView:e=>Te(e),toggleNeedsMe:()=>I(e=>({...e,needsMe:!e.needsMe})),focusSearch:()=>{typeof document<`u`&&document.querySelector(mi)?.focus()},pinToWorkspace:l}),[n.fleetPresentation,n.fleetDensity,l,a,e.orchestrators]),De=n.fleetPresentation===`office`?`room`:`details`,Oe=e=>a(e,De),ke=(e,t)=>a(e,De,t.id);return(0,g.useEffect)(()=>{if(!N)return;let e=window.setTimeout(()=>P(e=>e?.id===N.id?null:e),11e3);return()=>window.clearTimeout(e)},[N]),(0,O.jsxs)(`div`,{className:`${$r} py-6 sm:py-10`,children:[(0,O.jsxs)(`header`,{className:`mb-8 flex flex-wrap items-center justify-between gap-4`,children:[(0,O.jsx)(Ze,{subtitle:(0,O.jsx)(Qr,{snapshot:e,onFilter:e=>I(t=>({...t,...e}))})}),(0,O.jsxs)(`div`,{className:`flex max-w-full flex-wrap items-center justify-end gap-2`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>te(!0),title:`Jump to a mission, or run a command`,className:`hidden items-center gap-2 rounded-lg border border-white/10 px-3 py-2 text-xs text-white/35 transition hover:border-amber-300/20 hover:text-amber-100/70 sm:flex`,children:[(0,O.jsx)(`span`,{children:`Go to…`}),(0,O.jsx)(`kbd`,{className:`mono rounded border border-white/[0.12] px-1 py-0.5 text-[9px] text-white/30`,children:`⌘K`})]}),(0,O.jsx)(`button`,{type:`button`,onClick:xe,title:`Keyboard shortcuts (?)`,"aria-label":`Keyboard shortcuts`,className:`hidden rounded-lg border border-white/10 px-2.5 py-2 text-xs text-white/35 transition hover:border-amber-300/20 hover:text-amber-100/70 sm:block`,children:`?`}),(0,O.jsx)(Ei,{value:we,onChange:Te}),D>0&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>w(!0),title:`Active loops and monitors`,className:`flex items-center gap-1.5 rounded-lg border border-violet-300/30 bg-violet-300/[0.08] px-2.5 py-2 text-xs font-medium text-violet-100/80 transition hover:border-violet-300/50 hover:bg-violet-300/[0.14]`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-violet-300 motion-reduce:animate-none`}),D,` running`]}),(0,O.jsx)(qo,{sounds:p,notifications:f,onOpenPolicies:()=>S(!0),onOpenTemplates:()=>b(!0)}),(0,O.jsx)(`button`,{onClick:()=>{v(void 0),h(!0)},className:`rounded-lg border border-amber-300/40 bg-amber-300/[0.09] px-3.5 py-2 text-sm font-semibold text-amber-100/90 transition hover:border-amber-300/70 hover:bg-amber-300/[0.16] hover:text-amber-50`,children:`+ New mission`})]})]}),j&&(0,O.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-rose-300/20 bg-rose-300/[0.06] px-4 py-2.5 text-xs text-rose-100/80`,children:[(0,O.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,O.jsx)(`span`,{className:`font-medium text-rose-200`,children:`Mission didn’t start.`}),` `,j.message]}),(0,O.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>{v(j.draft),M(null),h(!0)},className:`rounded-md border border-rose-200/25 px-2.5 py-1 font-medium text-rose-100 hover:bg-rose-300/10`,children:`Edit & retry`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>M(null),className:`px-2 py-1 text-rose-100/55 hover:text-rose-100`,children:`Dismiss`})]})]}),m&&(0,O.jsx)(Je,{initialDraft:_,onClose:()=>h(!1),onLaunch:e=>{M(null),e.promise.catch(t=>M({message:t.message,draft:e.draft}))}}),y&&(0,O.jsx)(Ht,{repositories:se,onClose:()=>b(!1)}),x&&(0,O.jsx)(Ut,{onClose:()=>S(!1)}),(0,O.jsx)(fi,{open:z,onClose:()=>ne(!1)}),C&&(0,O.jsx)($o,{tasks:T,onRefresh:E,onClose:()=>w(!1),onOpenMission:e=>{w(!1),Oe(e)}}),(0,O.jsx)(Ir,{commands:Ee,open:R,onOpenChange:te,onFilterBoard:e=>I(t=>({...t,query:e,queryScope:`all`}))}),(0,O.jsx)(ts,{onStarted:(e,t)=>P({id:e,task:t}),onConfigure:e=>{v(e),h(!0)}}),(0,O.jsx)(fn,{value:F,onChange:I,repositories:se,templates:ce,shown:W.length,total:e.orchestrators.length,sort:n.fleetSort,onSortChange:e=>r(t=>({...t,fleetSort:e}))}),B.active&&(0,O.jsxs)(`div`,{role:`status`,className:`mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-sky-300/20 bg-sky-300/[0.05] px-4 py-2.5 text-xs`,children:[(0,O.jsx)(`span`,{className:`min-w-0 text-sky-100/80`,children:ii(B.changes,e.orchestrators)}),(0,O.jsx)(`span`,{className:`flex shrink-0 gap-2`,children:(0,O.jsx)(`button`,{type:`button`,onClick:()=>{I(e=>({...e,query:``})),B.dismiss()},className:`rounded-md border border-sky-200/25 px-2.5 py-1 font-medium text-sky-100/85 transition hover:bg-sky-300/10`,children:`Got it`})})]}),(0,O.jsxs)(`section`,{"aria-label":`Fleet cockpit`,className:`sticky top-2 z-20 mb-3 flex flex-wrap items-center gap-2 rounded-xl border border-white/[0.07] bg-[#0d0d11]/90 px-3 py-2 text-[10px] text-white/35 shadow-lg backdrop-blur`,children:[(0,O.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-white/45`,children:`Cockpit`}),[[`Working`,e.orchestrators.filter(e=>e.activityStatus===`working`).length,`text-violet-200/60`],[`Blocked`,e.orchestrators.filter(e=>e.activityStatus===`waiting_on_you`).length,`text-amber-200/65`],[`Stalled`,e.orchestrators.filter(e=>e.activityStatus===`stalled`).length,`text-orange-200/65`],[`Review`,e.orchestrators.filter(e=>e.lifecycleStatus===`ready_for_review`).length,`text-emerald-200/65`],[`Changed`,B.active?B.changes.missionIds.size:0,`text-sky-200/65`]].map(([e,t,n])=>(0,O.jsxs)(`span`,{className:`rounded-full border border-white/[0.06] px-2 py-0.5 ${n}`,children:[(0,O.jsx)(`strong`,{className:`tabular-nums`,children:t}),` `,e]},String(e)))]}),(0,O.jsx)(Nt,{items:he,onOpenMission:Oe}),n.fleetPresentation===`office`?(0,O.jsx)(Ko,{missions:W,allMissions:e.orchestrators,roomAssignments:n.roomAssignments,workerSeatAssignments:n.workerSeatAssignments,announcement:N,onAssignmentsChange:(e,t)=>r(n=>({...n,roomAssignments:e,workerSeatAssignments:t})),connected:t,suspended:m,selectedFloor:n.selectedFloor,onSelectedFloorChange:e=>r(t=>({...t,selectedFloor:e})),motion:n.motion,onMotionChange:e=>r(t=>({...t,motion:e})),dialogue:n.dialogue,onDialogueChange:e=>r(t=>({...t,dialogue:e})),attentionMissionIds:ve,onSelectMission:e=>a(e,`room`),onSelectWorker:(e,t)=>a(e,`room`,t),onSelectDirectStudio:u,onSelectReviewHall:d}):(0,O.jsxs)(O.Fragment,{children:[e.orchestrators.length===0&&(0,O.jsx)(`p`,{className:`mb-8 rounded-xl border border-dashed border-white/10 py-8 text-center text-sm text-white/35`,children:`No Hive missions yet. Start one above or adopt a discovered background job.`}),e.orchestrators.length>0&&W.length===0&&(0,O.jsx)(`p`,{className:`mb-8 rounded-xl border border-dashed border-white/10 py-8 text-center text-sm text-white/35`,children:`No missions match these filters.`}),(0,O.jsx)(br,{title:`Active missions`,description:`Work in progress, idle, stalled, or failed.`,missions:de,decisionsByMission:ye,blockedMissionIds:_e,changedMissionIds:B.active?B.changes.missionIds:void 0,selectedMissionIds:L,activeMissionId:o,onToggleSelect:re,groupByRepository:n.fleetSort===`repository`,density:n.fleetDensity,onSelect:a,onSelectWorker:ke}),(0,O.jsx)(br,{title:`Awaiting acceptance`,description:`The orchestrator reports that work and required verification are complete. Accept the result or request changes.`,missions:fe,decisionsByMission:ye,blockedMissionIds:_e,changedMissionIds:B.active?B.changes.missionIds:void 0,selectedMissionIds:L,activeMissionId:o,onToggleSelect:re,groupByRepository:n.fleetSort===`repository`,density:n.fleetDensity,onSelect:a,onSelectWorker:ke}),(0,O.jsx)(br,{title:`Paused`,missions:K,decisionsByMission:ye,blockedMissionIds:_e,changedMissionIds:B.active?B.changes.missionIds:void 0,selectedMissionIds:L,activeMissionId:o,onToggleSelect:re,groupByRepository:n.fleetSort===`repository`,density:n.fleetDensity,onSelect:a,onSelectWorker:ke}),(0,O.jsx)(br,{title:`Completed`,description:`Finished work retained for review, follow-ups, or reopening.`,missions:pe,decisionsByMission:ye,blockedMissionIds:_e,changedMissionIds:B.active?B.changes.missionIds:void 0,selectedMissionIds:L,activeMissionId:o,onToggleSelect:re,groupByRepository:n.fleetSort===`repository`,density:n.fleetDensity,onSelect:a,onSelectWorker:ke,collapsedByDefault:!0}),(0,O.jsx)(br,{title:`Archive`,description:`Missions intentionally removed from the operational fleet.`,missions:me,blockedMissionIds:_e,changedMissionIds:B.active?B.changes.missionIds:void 0,selectedMissionIds:L,activeMissionId:o,onToggleSelect:re,groupByRepository:n.fleetSort===`repository`,density:n.fleetDensity,onSelect:a,collapsedByDefault:!0}),(0,O.jsx)(Xr,{missions:W,onOpenMission:Oe}),(0,O.jsx)(kr,{selected:ge,missionsWithDecisions:q,onClear:()=>ee(new Set)}),e.other.length>0&&(0,O.jsxs)(`section`,{className:`mt-10 border-t border-white/[0.06] pt-6`,children:[(0,O.jsxs)(`button`,{onClick:()=>A(!k),className:`flex w-full items-center justify-between text-left`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`h2`,{className:`text-sm font-medium uppercase tracking-wide text-white/30`,children:[`Discovered local sessions `,(0,O.jsx)(`span`,{className:`ml-1 text-white/15`,children:H.length})]}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-white/20`,children:`Claude processes started outside Hive. Adopt a background job, end it, or hide it locally.`})]}),(0,O.jsx)(`span`,{className:`rounded-md border border-white/8 px-2 py-1 text-xs text-white/30`,children:k?`−`:`+`})]}),k&&(0,O.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2`,children:[V.size>0&&(0,O.jsx)(`div`,{className:`flex justify-end`,children:(0,O.jsxs)(`button`,{onClick:()=>{ie(new Set),localStorage.removeItem(`hive:hidden-sessions`)},className:`text-[10px] text-white/25 hover:text-white/50`,children:[`Restore `,V.size,` hidden session`,V.size===1?``:`s`]})}),H.map(e=>(0,O.jsx)(es,{session:e,onHide:()=>ae(e.sessionId)},e.sessionId)),!H.length&&(0,O.jsx)(`p`,{className:`rounded-lg border border-dashed border-white/8 py-5 text-center text-xs text-white/25`,children:`All discovered sessions are hidden.`})]})]})]})]})}function rs({decision:e,header:t,compact:n=!1,stacked:r=!1,shortcutHints:i=!1,onAnswered:a}){let[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)();async function f(t){let n=(t??o).trim();if(!(!n||c)){l(!0),d(void 0);try{await oe(e.missionId,e.id,n),s(``),a?.()}catch(e){d(e.message)}finally{l(!1)}}}return(0,O.jsxs)(O.Fragment,{children:[t,(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium leading-relaxed text-white/80 ${n?`max-h-32 overflow-y-auto whitespace-pre-wrap break-words`:``}`,children:e.question}),e.context&&(0,O.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/35`,children:e.context})]}),(0,O.jsx)(`span`,{className:`rounded-md border border-white/8 px-2 py-1 text-[9px] uppercase tracking-wide text-white/30`,children:e.kind})]}),(e.recommendation||e.impact)&&(0,O.jsxs)(`div`,{className:`mt-3 grid gap-2 ${n||r?``:`sm:grid-cols-2`}`,children:[e.recommendation&&(0,O.jsxs)(`p`,{className:`rounded-lg bg-emerald-300/[0.04] px-3 py-2 text-[11px] text-emerald-100/50`,children:[(0,O.jsx)(`span`,{className:`font-medium`,children:`Recommended:`}),` `,e.recommendation]}),e.impact&&(0,O.jsxs)(`p`,{className:`rounded-lg bg-white/[0.025] px-3 py-2 text-[11px] text-white/35`,children:[(0,O.jsx)(`span`,{className:`font-medium text-white/45`,children:`While waiting:`}),` `,e.impact]})]}),e.choices.length>0&&(0,O.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:e.choices.map((e,t)=>(0,O.jsxs)(`button`,{type:`button`,disabled:c,onClick:()=>f(e),className:`flex cursor-pointer items-center gap-1.5 rounded-lg border border-amber-200/15 bg-amber-200/[0.06] px-3 py-1.5 text-xs text-amber-100/65 hover:bg-amber-200/10 disabled:opacity-40`,children:[e,i&&t<9&&(0,O.jsx)(`kbd`,{className:`mono rounded border border-amber-200/20 px-1 text-[9px] text-amber-100/40`,children:t+1})]},e))}),(0,O.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,O.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f()},placeholder:`Or write a custom answer…`,className:`min-w-0 flex-1 rounded-lg border border-white/10 bg-black/15 px-3 py-2 text-xs text-white/70 outline-none placeholder:text-white/20 focus:border-amber-300/25`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>f(),disabled:!o.trim()||c,className:`cursor-pointer rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-[#291b05] disabled:opacity-35`,children:c?`Sending…`:`Answer`})]}),u&&(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:u})]})}function is({decisions:e,onOpenMission:t,showMission:n=!0,compact:r=!1,presentation:i=`inline`,openToken:a,className:o,choiceShortcuts:s=!1}){let[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(0),f=(0,g.useMemo)(()=>[...e].sort((e,t)=>Si(e)-Si(t)||e.createdAt-t.createdAt),[e]);if((0,g.useEffect)(()=>{d(e=>Math.min(e,Math.max(0,f.length-1)))},[f.length]),(0,g.useEffect)(()=>{a&&i===`drawer`&&l(!0)},[a,i]),(0,g.useEffect)(()=>{if(!s||typeof window>`u`||i===`drawer`&&!c)return;let e=f[0];if(!e?.choices.length)return;let t=t=>{if(t.altKey||t.metaKey||t.ctrlKey||t.defaultPrevented||yt(t.target))return;let n=Number(t.key)-1;!Number.isInteger(n)||n<0||n>=Math.min(e.choices.length,9)||(t.preventDefault(),oe(e.missionId,e.id,e.choices[n]).catch(()=>void 0))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)}),!e.length)return null;let p=e=>(0,O.jsx)(`article`,{className:`p-5`,children:(0,O.jsx)(rs,{decision:e,compact:r,stacked:i===`drawer`,shortcutHints:s&&e.id===f[0]?.id,header:n&&(0,O.jsxs)(`div`,{className:`mb-2.5 rounded-lg border border-violet-300/10 bg-violet-300/[0.03] px-3 py-2`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsxs)(`button`,{onClick:()=>{l(!1),t(e.missionId)},className:`cursor-pointer text-xs font-semibold text-violet-300/80 hover:text-violet-200`,children:[e.missionName,` ↗`]}),e.repository&&(0,O.jsx)(`span`,{className:`mono rounded bg-white/[0.04] px-1.5 py-0.5 text-[9px] text-white/35`,title:e.repository,children:e.repository.split(`/`).at(-1)})]}),e.missionObjective&&(0,O.jsxs)(`p`,{className:`mt-1 truncate text-[11px] text-white/40`,title:e.missionObjective,children:[(0,O.jsx)(`span`,{className:`text-white/20`,children:`Mission goal:`}),` `,e.missionObjective]})]})})},e.id);if(i===`drawer`){let t=f[u],n=new Set(e.map(e=>e.missionId)).size;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>l(!0),"aria-expanded":c,className:`group flex w-full cursor-pointer items-center justify-between gap-4 rounded-xl border border-rose-300/15 bg-rose-300/[0.035] px-4 py-3 text-left transition hover:border-rose-300/30 hover:bg-rose-300/[0.055] ${o??`mb-6`}`,children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,O.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-rose-300/10 text-sm font-bold text-rose-200/80`,children:`?`}),(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsxs)(`span`,{className:`block text-sm font-semibold text-rose-100/80`,children:[`Needs you · `,e.length,` pending`]}),(0,O.jsxs)(`span`,{className:`block truncate text-[11px] text-white/35`,children:[`Across `,n,` mission`,n===1?``:`s`,` · `,f[0].missionName,`: `,f[0].question]})]})]}),(0,O.jsx)(`span`,{className:`shrink-0 text-xs font-medium text-rose-200/55 group-hover:text-rose-100/80`,children:`Review →`})]}),c&&(0,O.jsx)(Jo,{label:`Pending mission decisions`,eyebrow:`Needs you`,accent:`needs-you`,title:`${e.length} pending decision${e.length===1?``:`s`}`,subtitle:`Across ${n} mission${n===1?``:`s`} · Esc to close`,onClose:()=>l(!1),closeLabel:`Close pending decisions`,afterHeader:f.length>1?(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-white/[0.06] px-6 py-2.5`,children:[(0,O.jsx)(`button`,{type:`button`,disabled:u===0,onClick:()=>d(e=>e-1),className:`cursor-pointer text-xs text-white/40 hover:text-white/70 disabled:cursor-not-allowed disabled:opacity-20`,children:`← Previous`}),(0,O.jsxs)(`span`,{className:`text-[10px] font-medium text-white/30`,children:[u+1,` of `,f.length]}),(0,O.jsx)(`button`,{type:`button`,disabled:u===f.length-1,onClick:()=>d(e=>e+1),className:`cursor-pointer text-xs text-white/40 hover:text-white/70 disabled:cursor-not-allowed disabled:opacity-20`,children:`Next →`})]}):void 0,children:p(t)})]})}return(0,O.jsxs)(`section`,{className:`mb-8 overflow-hidden rounded-2xl border border-amber-300/15 bg-amber-300/[0.035]`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between border-b border-amber-300/10 px-5 py-4`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-amber-100/85`,children:`Needs you`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-white/35`,children:`Answer mission and skill prompts without leaving Hive.`})]}),(0,O.jsxs)(`span`,{className:`rounded-full bg-amber-300/10 px-2.5 py-1 text-[10px] font-semibold text-amber-200/70`,children:[e.length,` pending`]})]}),(0,O.jsx)(`div`,{className:`divide-y divide-amber-300/10`,children:e.map(p)})]})}function as(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function os(e,t){let n=Jt(e);return n.find(e=>t.taskIds?.includes(e.id))??n.find(e=>vn(e.workerId,t)||vn(e.owner,t))??n.find(e=>e.title.toLowerCase()===t.label.toLowerCase())}function ss({missionId:e,worker:t,plan:n,events:r,onClose:i}){let[a,o]=(0,g.useState)(Date.now()),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(null);(0,g.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=(0,g.useMemo)(()=>os(n,t),[n,t]),m=(0,g.useMemo)(()=>r.filter(e=>vn(e.targetWorker,t)).sort((e,t)=>t.ts-e.ts),[r,t]),h=(0,g.useMemo)(()=>({filesRead:[...new Set(m.filter(e=>e.activityKind===`file_read`).map(e=>e.filePath).filter(e=>!!e))],filesChanged:[...new Set(m.filter(e=>e.activityKind===`file_write`).map(e=>e.filePath).filter(e=>!!e))],commands:[...new Set(m.filter(e=>e.activityKind===`command`).map(e=>e.command).filter(e=>!!e))],tests:[...new Set(m.filter(e=>e.activityKind===`test`).map(e=>e.command).filter(e=>!!e))],outputs:[...new Set(m.filter(e=>e.activityKind===`output`).map(e=>e.artifactPath??e.detail).filter(Boolean))]}),[m]),_=m[0],v=t.jobState===`working`||t.jobState===`busy`,y=Math.max(t.updatedAt??0,t.doneAt??0,_?.ts??0),b=t.doneAt??(v?a:y||t.jobUpdatedAt||a),x=t.doneAt?`Completed`:v?`Working`:`Ended`,S=y||t.jobUpdatedAt||0,C=t.terminationReason??(t.doneAt?`Worker reported completion`:x===`Working`?`Still running`:`Parent job ended with state: ${t.jobState}`);async function w(){let n=s.trim();if(!n||l)return;u(!0),f(null);let r=p?`worker ${t.label} on plan task ${p.id} (${p.title})`:`worker ${t.label} (${t.id})`;try{await W(e,`Guidance for ${r}:\n\n${n}`),c(``)}catch(e){f(e.message)}finally{u(!1)}}return(0,O.jsx)(Jo,{label:`Worker details: ${t.label}`,eyebrow:`Worker inspection`,title:t.label,subtitle:(0,O.jsxs)(`span`,{className:`mono`,children:[t.id,` · job `,t.jobId.slice(0,8)]}),onClose:i,closeLabel:`Close worker details`,children:(0,O.jsxs)(`div`,{className:`space-y-5 p-6`,children:[(0,O.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`State`,x],[`Elapsed`,as(b-t.startedAt)],[`Role`,p?.role?.replaceAll(`_`,` `)??t.kind]].map(([e,t])=>(0,O.jsxs)(`div`,{className:`rounded-xl border border-white/8 bg-white/[0.025] p-3`,children:[(0,O.jsx)(`p`,{className:`truncate text-sm font-semibold capitalize text-white/75`,title:t,children:t}),(0,O.jsx)(`p`,{className:`mt-1 text-[9px] uppercase tracking-wider text-white/25`,children:e})]},e))}),(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Assignment`}),p?(0,O.jsxs)(`div`,{className:`mt-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`p`,{className:`text-xs font-medium text-violet-200/75`,children:p.title}),(0,O.jsx)(`span`,{className:`text-[9px] uppercase text-white/25`,children:p.status})]}),(0,O.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-white/55`,children:p.assignment??p.description??t.label}),p.context&&(0,O.jsxs)(`div`,{className:`mt-3 border-t border-white/[0.06] pt-3`,children:[(0,O.jsx)(`p`,{className:`text-[9px] uppercase tracking-wide text-white/25`,children:`Delegated context`}),(0,O.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/40`,children:p.context})]}),p.status===`blocked`&&(p.blocker||p.unblock)&&(0,O.jsxs)(`div`,{className:`mt-3 rounded-lg border border-rose-400/10 bg-rose-400/[0.04] p-2.5`,children:[(0,O.jsx)(`p`,{className:`text-xs text-rose-200/60`,children:p.blocker??`Task is blocked`}),p.unblock&&(0,O.jsxs)(`p`,{className:`mt-1 text-[10px] text-white/35`,children:[`Unblock by: `,p.unblock]})]}),p.dependsOn.length>0&&(0,O.jsxs)(`p`,{className:`mt-2 text-[10px] text-white/25`,children:[`Depends on: `,p.dependsOn.join(`, `)]})]}):(0,O.jsx)(`p`,{className:`mt-3 text-xs text-white/25`,children:`No structured plan task is linked to this worker yet.`})]}),(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Runtime`}),(0,O.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[110px_1fr] gap-y-2 text-xs`,children:[(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Started`}),(0,O.jsx)(`dd`,{className:`text-white/55`,children:new Date(t.startedAt).toLocaleString()}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Elapsed`}),(0,O.jsx)(`dd`,{className:`text-white/55`,children:as(b-t.startedAt)}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Last update`}),(0,O.jsx)(`dd`,{className:`text-white/55`,children:S?`${new Date(S).toLocaleString()} · ${as(a-S)} ago`:`Not reported`}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Latest activity`}),(0,O.jsx)(`dd`,{className:`text-white/55`,children:_?_.command??_.filePath??_.detail:`No targeted report`}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Termination`}),(0,O.jsx)(`dd`,{className:`text-white/55`,children:C}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Token usage`}),(0,O.jsx)(`dd`,{className:t.tokens===void 0?`text-white/30`:`text-white/55`,children:t.tokens===void 0?`Not exposed per worker by this Claude CLI record`:t.tokens.toLocaleString()})]})]}),p?.evidence.length?(0,O.jsxs)(`section`,{className:`rounded-xl border border-emerald-400/10 bg-emerald-400/[0.025] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-emerald-300/55`,children:`Evidence`}),(0,O.jsx)(`ul`,{className:`mt-3 space-y-2`,children:p.evidence.map((e,t)=>(0,O.jsxs)(`li`,{className:`flex gap-2 text-xs leading-relaxed text-white/55`,children:[(0,O.jsx)(`span`,{className:`text-emerald-400`,children:`✓`}),e]},t))})]}):null,(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Observed work`}),(0,O.jsx)(`span`,{className:`text-[10px] text-white/20`,children:`From attributed hooks`})]}),(0,O.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:[[`Files read`,h.filesRead],[`Files changed`,h.filesChanged],[`Commands`,h.commands],[`Tests`,h.tests],[`Outputs`,h.outputs]].map(([e,t])=>(0,O.jsxs)(`div`,{className:`${e===`Outputs`?`col-span-2`:``} rounded-lg border border-white/[0.06] bg-black/10 p-3`,children:[(0,O.jsxs)(`p`,{className:`text-[9px] font-medium uppercase tracking-wide text-white/25`,children:[e,` · `,t.length]}),t.length?(0,O.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:t.slice(0,6).map(e=>(0,O.jsx)(`li`,{title:e,className:`mono truncate text-[10px] text-white/50`,children:e},e))}):(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-white/18`,children:`None reported`})]},e))})]}),(0,O.jsxs)(`section`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Worker activity`}),(0,O.jsxs)(`span`,{className:`text-[10px] text-white/20`,children:[m.length,` events`]})]}),m.length?(0,O.jsx)(`div`,{className:`mt-3 space-y-2`,children:m.map((e,t)=>(0,O.jsxs)(`div`,{className:`rounded-lg border border-white/[0.06] bg-white/[0.018] p-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between text-[9px] uppercase tracking-wide text-white/25`,children:[(0,O.jsx)(`span`,{children:e.phase??e.hookEventName??`activity`}),(0,O.jsx)(`span`,{children:new Date(e.ts).toLocaleTimeString()})]}),(0,O.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/55`,children:e.detail})]},`${e.ts}:${t}`))}):(0,O.jsx)(`p`,{className:`mt-3 rounded-lg border border-dashed border-white/8 px-3 py-5 text-center text-xs text-white/25`,children:`No targeted activity reports were recorded for this worker.`})]}),(0,O.jsxs)(`section`,{className:`rounded-xl border border-violet-400/10 bg-violet-400/[0.025] p-4`,children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-violet-300/55`,children:`Guide this worker`}),(0,O.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-white/30`,children:`Guidance is sent through the orchestrator, which remains responsible for relaying or revising the task.`}),(0,O.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:3,placeholder:`Clarify scope, suggest an approach, or change a requirement…`,className:`mt-3 w-full resize-none rounded-lg border border-white/10 bg-black/20 p-2.5 text-xs text-white/70 outline-none placeholder:text-white/20 focus:border-violet-400/25`}),(0,O.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-3`,children:[d?(0,O.jsx)(`p`,{className:`text-[10px] text-rose-400`,children:d}):(0,O.jsx)(`span`,{}),(0,O.jsx)(`button`,{onClick:w,disabled:!s.trim()||l,className:`rounded-lg bg-violet-500 px-3 py-1.5 text-xs font-semibold text-white hover:bg-violet-400 disabled:opacity-35`,children:l?`Sending…`:`Send through orchestrator`})]})]})]})})}var cs={info:`border-sky-400/15 bg-sky-400/[0.04] text-sky-200/75`,warning:`border-orange-400/20 bg-orange-400/[0.055] text-orange-200/80`,critical:`border-rose-400/25 bg-rose-400/[0.06] text-rose-200/85`};function ls({alerts:e,missionName:t,onNavigate:n}){return e.length?(0,O.jsx)(`section`,{className:`mb-5 space-y-2`,"aria-label":`Mission health alerts`,children:e.map(e=>(0,O.jsxs)(`details`,{className:`rounded-xl border px-4 py-3 ${cs[e.severity]}`,children:[(0,O.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:[(0,O.jsx)(`span`,{className:`mr-2 text-[9px] uppercase tracking-wider opacity-60`,children:e.severity}),t&&(0,O.jsxs)(`span`,{className:`mr-1.5 text-white/85`,children:[t,` ·`]}),e.title]}),(0,O.jsxs)(`div`,{className:`mt-2 space-y-1.5 pl-12 text-xs leading-relaxed`,children:[(0,O.jsx)(`p`,{className:`text-white/50`,children:e.explanation}),(0,O.jsxs)(`p`,{className:`text-white/30`,children:[(0,O.jsx)(`span`,{className:`font-medium text-white/40`,children:`Evidence:`}),` `,e.evidence]}),(0,O.jsxs)(`p`,{className:`text-white/40`,children:[(0,O.jsx)(`span`,{className:`font-medium text-white/50`,children:`Suggested recovery:`}),` `,e.recovery]}),n&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`mt-1 cursor-pointer rounded-md border border-current/15 px-2.5 py-1.5 text-[10px] font-medium opacity-70 transition hover:bg-white/[0.05] hover:opacity-100`,children:[`Open `,e.workerId?`worker`:`mission`,` →`]})]})]},e.id))}):null}function us({value:e,onChange:t}){return(0,O.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/[0.08] bg-black/20 p-1`,role:`group`,"aria-label":`Mission presentation`,children:[`cards`,`office`].map(n=>(0,O.jsx)(`button`,{type:`button`,"aria-pressed":e===n,title:n===`cards`?`Full operational detail`:`The mission's room in the office`,onClick:()=>t(n),className:`rounded-md px-3 py-1.5 text-xs font-medium transition ${e===n?`bg-amber-300/[0.12] text-amber-100/80 shadow-sm`:`text-white/35 hover:bg-white/[0.04] hover:text-white/60`}`,children:n===`cards`?`▦ Details`:`⌂ Room`},n))})}function ds({onBack:e,header:t,notices:n,metrics:r,presentation:i,onPresentationChange:a,switcher:o,actions:s,children:c}){return(0,O.jsx)(`div`,{className:`min-h-screen bg-[radial-gradient(circle_at_top_left,rgba(124,58,237,0.08),transparent_35%)]`,children:(0,O.jsxs)(`div`,{className:`${$r} py-8`,children:[(0,O.jsxs)(`div`,{className:`sticky top-3 z-30 mb-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-white/[0.07] bg-[#0d0d11]/90 p-1.5 shadow-lg shadow-black/20 backdrop-blur`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsxs)(`button`,{onClick:e,className:`flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-xs text-white/40 transition hover:bg-white/[0.04] hover:text-amber-200/80`,children:[(0,O.jsx)(Xe,{compact:!0}),(0,O.jsx)(`span`,{children:`← Fleet`})]}),o]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[s,(0,O.jsx)(`p`,{className:`hidden text-[10px] text-white/22 sm:block`,children:i===`room`?`Spatial mission control`:`Full operational detail`}),(0,O.jsx)(us,{value:i===`room`?`office`:`cards`,onChange:a})]})]}),t,n,r,(0,O.jsx)(`div`,{className:`mission-presentation-enter`,children:c},i)]})})}function fs(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function ps({attachments:e}){return e.length?(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:e.map(e=>(0,O.jsx)(`a`,{href:M(e.url),target:`_blank`,rel:`noopener noreferrer`,title:`${e.name} · ${fs(e.bytes)}`,className:`block overflow-hidden rounded-lg border border-white/15 transition hover:border-white/35`,children:(0,O.jsx)(`img`,{src:M(e.url),alt:e.name,className:`max-h-40 w-auto max-w-[240px] object-contain`})},e.id))}):null}function ms({pending:e,onRemove:t}){return e.length?(0,O.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:e.map(e=>(0,O.jsxs)(`div`,{className:`group relative overflow-hidden rounded-lg border ${e.status===`failed`?`border-rose-400/40`:`border-white/15`}`,children:[(0,O.jsx)(`img`,{src:e.previewUrl,alt:e.name,className:`h-16 w-16 object-cover`}),e.status!==`ready`&&(0,O.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/65 text-[9px] ${e.status===`failed`?`text-rose-200`:`text-white/70`}`,children:e.status===`failed`?`Failed`:`Uploading…`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>t(e.key),"aria-label":`Remove ${e.name}`,title:e.error??e.name,className:`absolute right-0.5 top-0.5 flex h-4 w-4 cursor-pointer items-center justify-center rounded-full bg-black/70 text-[10px] leading-none text-white/70 transition hover:bg-black/90 hover:text-white`,children:`×`})]},e.key))}):null}function hs(e,t){if(!t)return;let n=e=>{for(let r of e){if(r.id===t)return r.title;let e=n(r.subtasks??[]);if(e)return e}};for(let t of e?.phases??[]){let e=n(t.tasks);if(e)return e}}function gs(e,t){let n=hs(t,e.targetTask)??e.targetTask,r=e.targetWorker&&e.targetWorker!==`hive-orchestrator`?e.targetWorker:void 0;switch(e.phase){case`plan_updated`:return{title:e.detail.startsWith(`Plan updated`)?e.detail:`Plan updated`,detail:e.detail.startsWith(`Plan updated`)?void 0:e.detail,tone:`neutral`};case`phase_started`:return{title:`Started phase: ${e.detail}`,tone:`progress`};case`phase_completed`:return{title:`Completed phase: ${e.detail}`,tone:`success`};case`task_started`:return{title:`Started task: ${e.detail}`,tone:`progress`};case`task_completed`:return{title:`Completed task: ${e.detail}`,tone:`success`};case`gate_satisfied`:return{title:`Completion gate satisfied: ${e.detail}`,tone:`success`};case`gate_failed`:return{title:`Completion gate failed: ${e.detail}`,tone:`attention`};case`gate_waived`:return{title:`Completion gate waived: ${e.detail}`,tone:`neutral`};case`delegating`:return{title:n?`Started task: ${n}`:`Work delegated`,detail:r?`Delegated to ${r}${e.detail?` · ${e.detail}`:``}`:e.detail,tone:`progress`};case`worker_started`:return{title:`Worker started${r?`: ${r}`:``}`,detail:n?`Working on ${n}`:e.detail,tone:`progress`};case`worker_reported`:return{title:n?`Completed task: ${n}`:`Worker completed${r?`: ${r}`:``}`,detail:e.detail,tone:`success`};case`reviewing`:return{title:n?`Reviewing task: ${n}`:`Review started`,detail:e.detail,tone:`progress`};case`blocked_on_user`:return{title:`Waiting for your input`,detail:e.detail,tone:`attention`};case`decision_resolved`:return{title:`Decision resolved`,detail:e.detail,tone:`success`};case`ready_for_review`:return{title:`Ready for review`,detail:e.detail,tone:`success`};case`resuming`:return{title:`Mission resumed`,detail:e.detail,tone:`progress`};default:if(e.activityKind===`test`&&e.outcome===`success`)return{title:`Verification passed`,detail:e.command??e.detail,tone:`success`};if(e.activityKind===`test`&&e.outcome===`failure`)return{title:`Verification failed`,detail:e.command??e.detail,tone:`attention`};if(e.outcome===`failure`)return{title:e.activityKind===`command`?`Command failed`:`Work failed`,detail:vs(e.command??e.detail),tone:`attention`}}}function _s(e){return(e??``).toLowerCase().replace(/\b(started|starting|delegated|worker|task|completed|finished|reported)\b/g,``).replace(/[^a-z0-9]+/g,` `).trim()}function vs(e,t=220){return e.length>t?`${e.slice(0,t-1)}…`:e}function ys(e,t){let n=[];for(let[r,i]of[...e].sort((e,t)=>e.ts-t.ts).entries()){let e=gs(i,t);if(!e)continue;let a=n.at(-1);if(a&&i.ts-a.createdAt<1e4){let t=_s(`${a.title} ${a.detail??``}`),n=_s(`${e.title} ${e.detail??``}`);if(t&&n&&(t===n||t.includes(n)||n.includes(t)))continue}let o=n.at(-1),s=e=>e.startsWith(`Completed task:`)||e.startsWith(`Started task:`)||e.startsWith(`Worker started:`)||e===`Verification passed`;if(o&&o.tone===e.tone&&s(o.title)&&s(e.title)&&i.ts-o.createdAt<3e4){let t=o.items?.[0]??o.title;o.items=[...o.items??[t],e.detail?`${e.title} — ${e.detail}`:e.title],o.title=`${e.title.startsWith(`Started`)?`Work started`:e.title===`Verification passed`?`Verification passed`:`Work completed`}: ${o.items.length} updates`,o.detail=void 0;continue}n.push({...e,id:`checkpoint:${i.ts}:${r}`,createdAt:i.ts})}return n}function bs(e,t=72){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function xs(e){return e?`auto`:`smooth`}function Ss(){return typeof window<`u`&&!!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches}function Cs(...e){let t=new Map;for(let n of e)for(let e of n){let n=t.get(e.id);(!n||e.text.length>n.text.length)&&t.set(e.id,e)}return[...t.values()].sort((e,t)=>e.createdAt-t.createdAt||e.id.localeCompare(t.id))}var ws=e=>e.kind===`message`&&!!e.message.noop;function Ts(e){let t=[];for(let n of e){if(!ws(n)){t.push(n);continue}let e=t.at(-1);if(e&&`kind`in e&&e.kind===`quiet`){let t=e;t.items.push(n),t.lastAt=n.createdAt,t.runs=Math.max(1,Math.round(t.items.length/2));continue}t.push({kind:`quiet`,createdAt:n.createdAt,items:[n],runs:1,firstAt:n.createdAt,lastAt:n.createdAt})}return t}function Es(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function Ds({streak:e,render:t}){let[n,r]=(0,g.useState)(!1),i=e.firstAt===e.lastAt?Es(e.firstAt):`${Es(e.firstAt)} → ${Es(e.lastAt)}`;return(0,O.jsx)(`div`,{className:`flex justify-center py-0.5`,children:(0,O.jsxs)(`div`,{className:`w-full max-w-[92%]`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,className:`flex w-full cursor-pointer items-center gap-2 rounded-xl border border-white/[0.06] bg-white/[0.015] px-3 py-1.5 text-left transition hover:border-white/12 hover:bg-white/[0.03]`,children:[(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-white/25`,children:n?`▾`:`↻`}),(0,O.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[10px] text-white/35`,children:e.runs===1?`Checked once, nothing new`:`Checked ${e.runs} times, nothing new`}),(0,O.jsx)(`span`,{className:`shrink-0 text-[9px] text-white/20`,children:i})]}),n&&(0,O.jsx)(`div`,{className:`mt-2 space-y-3 border-l border-white/[0.07] pl-3`,children:e.items.map(t)})]})})}var Os=hn.map(e=>({name:e.name,description:e.description,source:`claude`})),ks=typeof window>`u`?g.useEffect:g.useLayoutEffect;function As(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}var js=/https?:\/\/[^\s<>"')\]]+/g,Ms=/\b(MR|PR)\s*[#!]\s*(\d+)\b/g;function Ns(e,t){return e.find(e=>e.id===t||RegExp(`/(merge_requests|pull)/${t}$`).test(e.href))?.href}function Ps(e,t,n){return e.some(e=>e.role===`user`&&e.text===t.text&&!n.has(e.id))}function Fs(e,t){return e.some(e=>e.role===`assistant`&&!t.has(e.id))}function Is(e,t,n){if(!t.length)return[e];let r=[],i=0;for(let a of e.matchAll(Ms)){let o=Ns(t,a[2]);o&&(a.index>i&&r.push(e.slice(i,a.index)),r.push((0,O.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 transition-colors ${n}`,children:a[0]},`${o}:${a.index}`)),i=a.index+a[0].length)}return i<e.length&&r.push(e.slice(i)),r}function Ls({text:e,role:t,prs:n=[]}){let r=t===`user`?`text-sky-200 hover:text-white`:`text-violet-300 hover:text-violet-200`,i=[],a=0;for(let t of e.matchAll(js)){let n=t[0].replace(/[.,;:!?*]+$/,``);t.index>a&&i.push(e.slice(a,t.index)),i.push({url:n}),a=t.index+n.length}return a<e.length&&i.push(e.slice(a)),(0,O.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:i.map((e,t)=>typeof e==`string`?(0,O.jsx)(`span`,{children:Is(e,n,r)},t):(0,O.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all underline underline-offset-2 transition-colors ${r}`,children:e.url},t))})}function Rs({missionId:e,messages:t,events:n=[],hasMoreMessages:r,repository:i,provider:a=`claude`,live:o,contained:s=!1,decisions:c=[],autoFocus:l=!1,onOpenDecisions:u}){let[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(null),[v,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)([]),[w,T]=(0,g.useState)(!!r),[E,D]=(0,g.useState)(!1),[k,A]=(0,g.useState)([]),[j,M]=(0,g.useState)([]),[N,P]=(0,g.useState)([]),[F,I]=(0,g.useState)(()=>typeof window>`u`||localStorage.getItem(`hive:conversation-mode`)!==`messages`),L=e=>{I(e);try{localStorage.setItem(`hive:conversation-mode`,e?`narrative`:`messages`)}catch{}},[te,z]=(0,g.useState)(!0),[ne,re]=(0,g.useState)(0),V=(0,g.useRef)(null),ie=(0,g.useRef)(new Map),[ae,H]=(0,g.useState)(0),U=(0,g.useRef)(null),oe=(0,g.useRef)(),se=(0,g.useRef)(new Set),G=(0,g.useRef)(new Set),ce=(0,g.useRef)(!1),le=(0,g.useRef)([]),ue=(0,g.useRef)(e);ue.current!==e&&(ue.current=e,le.current=[]);let de=Array.isArray(t)?t:[],fe=Cs(le.current,S,de);le.current=fe,(0,g.useEffect)(()=>{C([]),T(!!r),y(null),x(!1),z(!0),re(0),H(0),P(e=>{for(let t of e)URL.revokeObjectURL(t.previewUrl);return[]}),ie.current.clear(),se.current.clear(),G.current.clear(),ce.current=!1},[e]),(0,g.useEffect)(()=>{A([]),ee(i,a).then(({skills:e})=>A(e)).catch(()=>A([]))},[a,i]),(0,g.useEffect)(()=>{M([]),a===`claude`&&B(i).then(({agents:e})=>M(e)).catch(()=>M([]))},[a,i]),(0,g.useEffect)(()=>{r&&T(!0)},[r]),(0,g.useEffect)(()=>{v&&Ps(fe,v,se.current)&&y(null)},[fe,v]),(0,g.useEffect)(()=>{if(b){if(Fs(fe,G.current)){x(!1),ce.current=!1;return}o?.status===`working`?ce.current=!0:(ce.current||o?.status===`error`||o?.lifecycle===`failed`||o?.lifecycle===`paused`)&&(x(!1),ce.current=!1)}},[b,fe,o?.lifecycle,o?.status]);async function K(){let t=fe[0];if(!(!t||E)){D(!0),_(null);try{let n=await ve(e,{before:t.createdAt,limit:30});C(e=>[...n.messages,...e]),T(n.hasMore)}catch(e){_(e.message)}finally{D(!1)}}}function pe(t){let n=t.filter(e=>e.type.startsWith(`image/`));if(n.length)for(let t of n){let n=`${Date.now()}:${t.name}:${Math.random().toString(36).slice(2,8)}`,r=URL.createObjectURL(t);P(e=>[...e,{key:n,name:t.name||`pasted image`,previewUrl:r,status:`uploading`}]),R(e,t).then(({attachment:e})=>P(t=>t.map(t=>t.key===n?{...t,status:`ready`,attachment:e}:t))).catch(e=>P(t=>t.map(t=>t.key===n?{...t,status:`failed`,error:e.message}:t)))}}function me(e){P(t=>{let n=t.find(t=>t.key===e);return n&&URL.revokeObjectURL(n.previewUrl),t.filter(t=>t.key!==e)})}let he=N.some(e=>e.status===`uploading`),q=N.filter(e=>e.status===`ready`&&e.attachment);async function ge(){let t=d.trim();if(!t&&!q.length||p||he)return;let n=new Set(fe.map(e=>e.id));se.current=n,G.current=n,ce.current=o?.status===`working`,m(!0),x(!0),_(null);let r=q.map(e=>e.attachment);y({id:`pending:${Date.now()}`,role:`user`,text:t,createdAt:Date.now(),jobId:`pending`,...r.length?{attachments:r}:{}}),f(``),P([]);try{await W(e,t,r.map(e=>e.id));for(let e of q)URL.revokeObjectURL(e.previewUrl)}catch(e){y(null),x(!1),ce.current=!1,f(t),P(q),_(e.message)}finally{m(!1)}}let _e=v?[...fe,v]:fe,ye=F?ys(n,o?.plan):[],be=c.filter(e=>!e.answer),xe=[..._e.map(e=>({kind:`message`,createdAt:e.createdAt,message:e})),...ye.map(e=>({kind:`checkpoint`,createdAt:e.createdAt,checkpoint:e})),...be.map(e=>({kind:`decision`,createdAt:e.createdAt,decision:e}))].sort((e,t)=>e.createdAt-t.createdAt),Se=Ts(xe),Ce=xe.at(-1),we=Ce?.kind===`message`?Ce.message.id:Ce?.kind===`decision`?Ce.decision.id:Ce?.checkpoint.id,Te=o?.workers.filter(e=>!e.doneAt)??[],Ee=o?.status===`working`||b,De=!Ee&&!be.length&&o?.lifecycle===`active`&&o?.status===`waiting_on_you`,Oe=De?Kn({waitingFor:o?.waitingFor,plan:o?.plan,blocked:!0}):void 0,ke=v?`Delivering your message…`:b&&o?.status!==`working`?`Starting response…`:o?.detail?.trim()||`Orchestrator is working…`,Ae=(e=xs(Ss()))=>{let t=V.current;t&&(t.scrollTo({top:t.scrollHeight,behavior:e}),z(!0),re(0))};ks(()=>{let t=V.current;if(U.current!==e){U.current=e,t&&(t.scrollTop=t.scrollHeight);return}!t||!we||(te?t.scrollTo({top:t.scrollHeight,behavior:xs(Ss())}):we!==oe.current&&re(e=>e+1),oe.current=we)},[e,we,Ee,De]);let je=e=>e.kind===`decision`?(0,O.jsxs)(`div`,{ref:t=>{t?ie.current.set(e.decision.id,t):ie.current.delete(e.decision.id)},className:`rounded-2xl border border-amber-300/25 bg-amber-300/[0.05] px-4 py-3.5`,children:[(0,O.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-amber-300/80`}),(0,O.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-amber-200/60`,children:`Needs you`}),(0,O.jsx)(`span`,{className:`ml-auto text-[9px] text-white/20`,children:As(e.decision.createdAt)})]}),(0,O.jsx)(rs,{decision:e.decision,compact:!0,stacked:!0,shortcutHints:!1})]},e.decision.id):e.kind===`checkpoint`?(0,O.jsx)(`div`,{role:`status`,"aria-label":`${e.checkpoint.title}${e.checkpoint.detail?`: ${e.checkpoint.detail}`:``}`,className:`flex justify-center py-0.5`,children:(0,O.jsx)(`div`,{className:`w-full max-w-[92%] rounded-xl border px-3 py-2 ${e.checkpoint.tone===`success`?`border-emerald-300/12 bg-emerald-300/[0.035]`:e.checkpoint.tone===`attention`?`border-amber-300/15 bg-amber-300/[0.04]`:e.checkpoint.tone===`progress`?`border-violet-300/12 bg-violet-300/[0.035]`:`border-white/8 bg-white/[0.02]`}`,children:(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${e.checkpoint.tone===`success`?`bg-emerald-300/75`:e.checkpoint.tone===`attention`?`bg-amber-300/80`:e.checkpoint.tone===`progress`?`bg-violet-300/75`:`bg-white/25`}`}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`p`,{className:`text-[11px] font-medium leading-relaxed text-white/60`,children:e.checkpoint.title}),e.checkpoint.detail&&(0,O.jsx)(`p`,{className:`mt-0.5 break-words text-[10px] leading-relaxed text-white/30`,children:e.checkpoint.detail}),e.checkpoint.items&&(0,O.jsxs)(`details`,{className:`mt-1`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer text-[9px] text-white/25 hover:text-white/45`,children:`Show updates`}),(0,O.jsx)(`ul`,{className:`mt-1 space-y-0.5 border-l border-white/8 pl-2`,children:e.checkpoint.items.map((e,t)=>(0,O.jsx)(`li`,{className:`text-[9px] leading-relaxed text-white/30`,children:e},t))})]})]}),(0,O.jsx)(`span`,{className:`shrink-0 text-[9px] text-white/20`,children:As(e.checkpoint.createdAt)})]})})},e.checkpoint.id):e.message.kind===`update`?(0,O.jsx)(`div`,{className:`flex justify-start`,children:(0,O.jsx)(`div`,{className:`min-w-0 max-w-[85%] border-l-2 border-white/10 py-0.5 pl-3 text-[12px] leading-relaxed text-white/45 [overflow-wrap:anywhere]`,children:(0,O.jsx)(Ls,{text:e.message.text,role:e.message.role,prs:o?.prs})})},e.message.id):(0,O.jsx)(`div`,{className:`flex ${e.message.role===`user`?`justify-end`:`justify-start`}`,children:(0,O.jsxs)(`div`,{className:`min-w-0 max-w-[85%] break-words rounded-2xl px-4 py-3 text-sm leading-relaxed [overflow-wrap:anywhere] ${e.message.role===`user`?`rounded-br-md bg-violet-500 text-white`:`rounded-bl-md border border-white/8 bg-white/[0.045] text-white/80`} ${e.message.jobId===`pending`?`opacity-70`:``}`,children:[(0,O.jsx)(Ls,{text:e.message.text,role:e.message.role,prs:o?.prs}),e.message.attachments?.length?(0,O.jsx)(ps,{attachments:e.message.attachments}):null,(0,O.jsx)(`p`,{className:`mt-1.5 text-[10px] ${e.message.role===`user`?`text-white/55`:`text-white/25`}`,children:e.message.jobId===`pending`?`Sending…`:As(e.message.createdAt)})]})},e.message.id);return(0,O.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-white/10 bg-[#101014] ${s?`xl:flex xl:min-h-0 xl:flex-1 xl:flex-col`:``}`,children:[!s&&(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-white/8 px-5 py-3.5`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Conversation`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-white/35`,children:`Context carries forward across every follow-up`})]}),(0,O.jsx)(`div`,{role:`group`,"aria-label":`Conversation display`,className:`flex rounded-lg border border-white/8 p-0.5`,children:[[!0,`Narrative`],[!1,`Messages only`]].map(([e,t])=>(0,O.jsx)(`button`,{type:`button`,"aria-pressed":F===e,onClick:()=>L(e),className:`rounded-md px-2 py-1 text-[9px] ${F===e?`bg-white/8 text-white/65`:`text-white/25`}`,children:t},t))})]}),be.length>0&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>{let e=ae%be.length;ie.current.get(be[e].id)?.scrollIntoView({behavior:xs(Ss()),block:`center`}),H(e+1)},className:`flex w-full shrink-0 cursor-pointer items-center gap-2 border-b border-amber-300/15 bg-amber-300/[0.06] px-5 py-2 text-left transition hover:bg-amber-300/[0.1]`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-amber-300/80 motion-reduce:animate-none`}),(0,O.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-amber-100/75`,children:be.length===1?`Unaddressed decision in conversation — ${be[0].question}`:`${be.length} unaddressed decisions in conversation`}),(0,O.jsx)(`span`,{className:`shrink-0 text-[11px] text-amber-200/60`,children:be.length===1?`Jump to it ↓`:`Next ↓ ${ae%be.length+1}/${be.length}`})]}),(0,O.jsxs)(`div`,{ref:V,onScroll:e=>{let t=bs(e.currentTarget);z(t),t&&re(0)},role:`log`,"aria-live":`polite`,"aria-relevant":`additions`,"aria-label":`Mission conversation`,className:`relative min-h-48 space-y-4 overflow-y-auto px-5 py-5 ${s?`max-h-[460px] xl:min-h-0 xl:max-h-none xl:flex-1`:`max-h-[460px]`}`,children:[w&&(0,O.jsx)(`div`,{className:`text-center`,children:(0,O.jsx)(`button`,{onClick:K,disabled:E,className:`rounded-full border border-white/10 px-3 py-1.5 text-xs text-white/40 hover:bg-white/5 hover:text-white/70 disabled:opacity-40`,children:E?`Loading…`:`Load older messages`})}),xe.length===0&&(0,O.jsx)(`p`,{className:`py-12 text-center text-sm text-white/30`,children:`Send a message to continue this mission.`}),Se.map(e=>e.kind===`quiet`?(0,O.jsx)(Ds,{streak:e,render:je},`quiet:${e.firstAt}`):je(e)),Ee&&(0,O.jsx)(`div`,{className:`flex justify-start`,children:(0,O.jsxs)(`div`,{className:`max-w-[85%] rounded-2xl rounded-bl-md border border-violet-300/15 bg-violet-400/[0.06] px-4 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,O.jsx)(`span`,{className:`flex gap-1`,children:[0,1,2].map(e=>(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-violet-300/80 motion-reduce:animate-none`,style:{animationDelay:`${e*.18}s`}},e))}),(0,O.jsx)(`span`,{className:`text-xs text-violet-200/75`,children:ke})]}),(Te.length>0||(o?.inFlight.tasks??0)>0)&&(0,O.jsx)(`p`,{className:`mt-1.5 text-[11px] text-white/35`,children:Te.length>0?`${Te.length} worker${Te.length===1?``:`s`} running: ${Te.slice(0,3).map(e=>e.label).join(`, `)}${Te.length>3?`…`:``}`:`${o.inFlight.tasks} task${o.inFlight.tasks===1?``:`s`} in flight${o.inFlight.queued?`, ${o.inFlight.queued} queued`:``}`})]})}),De&&Oe&&(0,O.jsx)(`div`,{className:`flex justify-center`,children:o?.lifecycle===`ready_for_review`?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-emerald-300/20 bg-emerald-300/[0.06] px-3 py-1 text-[11px] text-emerald-200/75`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-300/80`}),`Work complete — awaiting your acceptance`]}):(0,O.jsxs)(`div`,{className:`w-full max-w-[85%] rounded-2xl border border-amber-300/20 bg-amber-300/[0.05] px-4 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-amber-300/80`}),(0,O.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-amber-200/60`,children:`Needs you`})]}),(0,O.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-white/70`,children:(0,O.jsx)(Ls,{text:Oe.ask,role:`assistant`,prs:o?.prs})}),Oe.unblock&&(0,O.jsxs)(`div`,{className:`mt-2 border-t border-amber-300/10 pt-2 text-[11px] leading-relaxed text-amber-100/60`,children:[(0,O.jsx)(`span`,{className:`text-white/30`,children:`To unblock: `}),(0,O.jsx)(Ls,{text:Oe.unblock,role:`assistant`,prs:o?.prs})]}),Oe.task&&(0,O.jsxs)(`p`,{className:`mt-2 truncate text-[10px] text-white/25`,title:Oe.task.title,children:[`Plan step · `,Oe.task.title]}),u&&(0,O.jsx)(`button`,{type:`button`,onClick:u,className:`mt-2.5 cursor-pointer text-[11px] text-amber-200/70 underline underline-offset-2 transition hover:text-amber-100`,children:`Open pending decisions ↗`})]})})]}),(0,O.jsxs)(`div`,{className:`relative border-t border-white/8 p-3`,children:[ne>0&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>Ae(),className:`absolute -top-9 left-1/2 z-10 flex -translate-x-1/2 cursor-pointer items-center gap-1.5 rounded-full border border-violet-300/25 bg-[#1a1622] px-3 py-1.5 text-[11px] text-violet-100/80 shadow-lg shadow-black/40 transition hover:border-violet-300/45`,children:[ne,` new message`,ne===1?``:`s`,` ↓`]}),(0,O.jsx)(ms,{pending:N,onRemove:me}),(0,O.jsxs)(`div`,{onPaste:e=>{let t=[...e.clipboardData.files];t.some(e=>e.type.startsWith(`image/`))&&(e.preventDefault(),pe(t))},onDragOver:e=>{[...e.dataTransfer.types].includes(`Files`)&&e.preventDefault()},onDrop:e=>{let t=[...e.dataTransfer.files];t.some(e=>e.type.startsWith(`image/`))&&(e.preventDefault(),pe(t))},className:`flex items-end gap-2 rounded-xl border border-white/10 bg-white/[0.035] p-2 focus-within:border-violet-400/35`,children:[(0,O.jsx)(Ie,{value:d,onChange:f,skills:a===`claude`?[...Os,...gn,...k]:k,agents:j,onSubmit:ge,rows:2,marker:`data-mission-composer`,autoFocus:l,focusCaret:`end`,placeholder:o?.lifecycle===`ready_for_review`?`Say what should change, or just ask a question…`:`Ask a follow-up, paste an image, or type / for skills and @ for agents…`,className:`min-h-12 flex-1`},e),(0,O.jsx)(`button`,{onClick:ge,disabled:p||he||!d.trim()&&!q.length,className:`rounded-lg bg-violet-500 px-4 py-2 text-sm font-semibold text-white transition hover:bg-violet-400 disabled:opacity-35`,children:p?`Sending…`:he?`Uploading…`:`Send`})]}),h&&(0,O.jsx)(`p`,{className:`mt-2 px-2 text-xs text-rose-400`,children:h})]})]})}function zs({missionId:e}){let[t,n]=(0,g.useState)(!1),[r,i]=(0,g.useState)(),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(!1);async function p(){if(t){n(!1);return}if(n(!0),!r){o(!0);try{i(await Se(e))}catch(e){c(e.message)}finally{o(!1)}}}async function m(){f(!0),c(void 0);try{await Ce(e),u(!1),i(void 0)}catch(e){c(e.message)}finally{f(!1)}}return(0,O.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,O.jsxs)(`button`,{onClick:p,className:`flex w-full items-center justify-between text-left`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`block text-sm font-semibold text-white/65`,children:`Manager handoff context`}),(0,O.jsx)(`span`,{className:`mt-0.5 block text-xs text-white/30`,children:`Preview the bounded history a replacement manager receives`})]}),(0,O.jsx)(`span`,{className:`text-xs text-white/25`,children:t?`−`:`+`})]}),t&&(0,O.jsxs)(`div`,{className:`mt-3 border-t border-white/[0.06] pt-3`,children:[a&&(0,O.jsx)(`p`,{className:`text-xs text-white/25`,children:`Building preview…`}),s&&(0,O.jsx)(`p`,{className:`text-xs text-rose-400`,children:s}),r&&(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`Summary`,r.estimatedTokens.summary,r.budgets.summaryTokens],[`Recent`,r.estimatedTokens.recent,r.budgets.recentTokens],[`Retrieved`,r.estimatedTokens.retrieved,r.budgets.retrievedTokens]].map(([e,t,n])=>(0,O.jsxs)(`div`,{className:`rounded-lg bg-white/[0.025] p-2`,children:[(0,O.jsxs)(`p`,{className:`text-xs font-medium text-white/55`,children:[`~`,t,` / `,n]}),(0,O.jsxs)(`p`,{className:`mt-0.5 text-[8px] uppercase tracking-wider text-white/20`,children:[e,` tokens`]})]},e))}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/20`,children:`Compact mission state`}),(0,O.jsxs)(`p`,{className:`mt-1.5 whitespace-pre-wrap text-[10px] leading-relaxed text-white/40`,children:[r.mission.compactSummary??`No checkpoint summary published yet.`,r.mission.currentState?`\nCurrent state: ${r.mission.currentState}`:``]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/20`,children:[`Recent messages · `,r.recentMessages.length]}),(0,O.jsx)(`ul`,{className:`mt-1 space-y-1`,children:r.recentMessages.map(e=>(0,O.jsxs)(`li`,{className:`line-clamp-2 text-[10px] text-white/30`,children:[(0,O.jsxs)(`span`,{className:`text-white/18`,children:[e.role,`:`]}),` `,e.text]},e.id))})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/20`,children:[`Relevant older messages · `,r.retrievedMessages.length]}),r.retrievedMessages.length?(0,O.jsx)(`ul`,{className:`mt-1 space-y-1`,children:r.retrievedMessages.map(e=>(0,O.jsxs)(`li`,{className:`line-clamp-2 text-[10px] text-white/30`,children:[(0,O.jsxs)(`span`,{className:`text-white/18`,children:[e.role,`:`]}),` `,e.text]},e.id))}):(0,O.jsx)(`p`,{className:`mt-1 text-[10px] text-white/20`,children:`No older messages were relevant enough to include.`})]}),(0,O.jsx)(`div`,{className:`border-t border-white/[0.06] pt-3`,children:l?(0,O.jsxs)(`div`,{className:`rounded-lg border border-amber-300/10 bg-amber-300/[0.035] p-2.5`,children:[(0,O.jsx)(`p`,{className:`text-[10px] leading-relaxed text-amber-100/55`,children:`Gracefully stop the current manager if it is active and start a fresh manager with exactly the context shown above? Mission identity, plan, conversation, and outputs remain unchanged.`}),(0,O.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{onClick:()=>u(!1),className:`px-2 py-1 text-[10px] text-white/35`,children:`Cancel`}),(0,O.jsx)(`button`,{disabled:d,onClick:m,className:`rounded-md bg-amber-300 px-2 py-1.5 text-[10px] font-semibold text-[#291b05] disabled:opacity-40`,children:d?`Replacing…`:`Confirm handoff`})]})]}):(0,O.jsx)(`button`,{onClick:()=>u(!0),className:`rounded-md border border-amber-300/15 px-2.5 py-1.5 text-[10px] text-amber-200/55 hover:bg-amber-300/[0.05]`,children:`Replace manager with this context`})})]})]})]})}function Bs({jobs:e}){return e?.length?(0,O.jsxs)(`details`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,O.jsxs)(`summary`,{className:`flex items-center justify-between text-sm font-semibold text-white/65`,children:[(0,O.jsx)(`span`,{children:`Claude job history`}),(0,O.jsxs)(`span`,{className:`font-normal text-[10px] text-white/25`,children:[e.length,` turn`,e.length===1?``:`s`]})]}),(0,O.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-white/25`,children:`Advanced runtime lineage. Each follow-up creates a new Claude job while remaining part of this Hive mission.`}),(0,O.jsx)(`ol`,{className:`mt-3 space-y-2 border-l border-white/[0.07] pl-3`,children:e.map((e,t)=>(0,O.jsxs)(`li`,{className:`relative rounded-lg border border-white/[0.05] bg-black/10 px-3 py-2 before:absolute before:-left-[17px] before:top-3 before:h-2 before:w-2 before:rounded-full before:bg-violet-400/60`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsxs)(`span`,{className:`font-mono text-[10px] text-white/50`,children:[t+1,`. `,e.jobId.slice(0,12)]}),(0,O.jsx)(`span`,{className:`text-[9px] uppercase text-white/25`,children:e.state})]}),(0,O.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[9px] text-white/22`,children:[e.createdAt&&(0,O.jsx)(`span`,{children:new Date(e.createdAt).toLocaleString()}),(0,O.jsxs)(`span`,{children:[e.tokens.toLocaleString(),` tokens`]}),e.sessionId&&(0,O.jsxs)(`span`,{className:`font-mono`,children:[`session `,e.sessionId.slice(0,8)]}),e.resumedFrom&&(0,O.jsxs)(`span`,{className:`font-mono text-violet-300/35`,children:[`resumed `,e.resumedFrom.slice(0,8)]})]})]},e.jobId))})]}):null}function Vs({missionId:e,initial:t}){let[n,r]=(0,g.useState)(t),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)();if(!n)return(0,O.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Permission policy`}),(0,O.jsx)(`p`,{className:`mt-2 text-xs text-white/30`,children:`This recovered mission predates mission policies. Its next handoff can adopt the workspace defaults.`})]});async function c(){if(window.confirm(`Apply these permission changes to future turns of this mission? Expanding access is an explicit approval.`))try{let t=await ke(e,n);r(t.policy),a(!1)}catch(e){s(e.message)}}let l=[[`Network`,n.networkAccess],[`Commits`,n.commits],[`Pushes`,n.pushes],[`PRs`,n.pullRequests],[`Releases`,n.releases],[`Destructive`,n.destructiveActions]];return(0,O.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Permission policy`}),(0,O.jsx)(`button`,{onClick:()=>a(!i),className:`rounded-lg border border-white/10 px-2.5 py-1 text-[10px] text-white/45 hover:bg-white/5`,children:i?`Cancel`:`Edit override`})]}),i?(0,O.jsxs)(`div`,{className:`mt-4`,children:[(0,O.jsx)(Re,{value:n,onChange:r}),o&&(0,O.jsx)(`p`,{className:`mt-2 text-xs text-rose-300`,children:o}),(0,O.jsx)(`button`,{onClick:()=>void c(),className:`mt-3 rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-black`,children:`Review and apply`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:l.map(([e,t])=>(0,O.jsxs)(`span`,{className:`rounded px-2 py-1 text-[10px] ${t?`bg-emerald-300/[0.07] text-emerald-200/50`:`bg-white/[0.03] text-white/25`}`,children:[e,`: `,t?`allowed`:`blocked`]},e))}),(0,O.jsxs)(`p`,{className:`mt-3 text-[10px] text-white/25`,children:[n.allowedRoots.length?`Restricted to ${n.allowedRoots.join(`, `)}`:`Any working directory`,` · `,n.allowedTools.length?`${n.allowedTools.length} explicitly allowed tools`:`normal tool set`]})]})]})}function Hs({missionId:e}){let[t,n]=(0,g.useState)(!1),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(`pr`),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(!1);async function p(){if(!(!s.trim()||t)){n(!0),u(null),f(!1);try{await Ee(e,a,s.trim()),f(!0),i(!1)}catch(e){u(e.message)}finally{n(!1)}}}return(0,O.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Mission report`}),(0,O.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-white/30`,children:`Export the request, plan, decisions, workers, changes, verification, outputs, usage, conversation, and remaining risks. Reports include a deep link back to this mission.`}),(0,O.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,O.jsx)(`a`,{href:we(e,`markdown`),download:!0,className:`rounded-lg border border-white/10 bg-white/[0.025] px-3 py-2 text-xs text-white/50 hover:border-amber-300/15 hover:text-amber-200`,children:`Download Markdown`}),(0,O.jsx)(`a`,{href:we(e,`json`),download:!0,className:`rounded-lg border border-white/10 bg-white/[0.025] px-3 py-2 text-xs text-white/50 hover:border-violet-300/15 hover:text-violet-200`,children:`Download JSON`}),(0,O.jsx)(`button`,{onClick:()=>{i(!r),u(null),f(!1)},className:`rounded-lg border border-sky-300/10 bg-sky-300/[0.025] px-3 py-2 text-xs text-sky-200/50 hover:border-sky-300/20 hover:text-sky-200/75`,children:`Post to GitHub…`})]}),r&&(0,O.jsxs)(`div`,{className:`mt-3 rounded-xl border border-amber-300/10 bg-amber-300/[0.025] p-3`,children:[(0,O.jsxs)(`p`,{className:`text-[10px] leading-relaxed text-amber-100/50`,children:[`This is externally visible. Hive will use your locally authenticated `,(0,O.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI and record both approval and outcome in the mission timeline.`]}),(0,O.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,O.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),className:`rounded-lg border border-white/10 bg-[#17171c] px-2 py-2 text-xs text-white/55`,children:[(0,O.jsx)(`option`,{value:`pr`,children:`Pull request`}),(0,O.jsx)(`option`,{value:`issue`,children:`Issue`})]}),(0,O.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`#123 or GitHub URL`,className:`min-w-0 flex-1 rounded-lg border border-white/10 bg-black/20 px-3 py-2 text-xs text-white/65 outline-none placeholder:text-white/20 focus:border-amber-300/20`}),(0,O.jsx)(`button`,{onClick:()=>i(!1),className:`px-2 text-xs text-white/30`,children:`Cancel`}),(0,O.jsx)(`button`,{onClick:()=>void p(),disabled:!s.trim()||t,className:`rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-[#291a04] disabled:opacity-35`,children:t?`Publishing…`:`Confirm publish`})]})]}),l&&(0,O.jsxs)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:[`Publish failed: `,l,`. Verify `,(0,O.jsx)(`span`,{className:`font-mono`,children:`gh auth status`}),`, the target, and repository access, then retry.`]}),d&&(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-emerald-300/60`,children:`Report published and recorded in the mission timeline.`})]})}var Us=`Mission diagnostics`;function Ws({node:e}){let[t,n]=(0,g.useState)(()=>St(Us,!0));return(0,O.jsxs)(`section`,{id:`mission-diagnostics`,className:`mt-5 scroll-mt-24`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>{let e=!t;n(e),Dt(Us,e)},"aria-expanded":!t,className:`flex w-full items-center gap-2 rounded-xl border border-white/[0.06] bg-white/[0.015] px-4 py-2.5 text-left transition hover:border-white/12`,children:[(0,O.jsx)(`span`,{className:`text-[10px] text-white/25 transition-transform ${t?``:`rotate-90`}`,children:`▶`}),(0,O.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-white/35`,children:`Diagnostics`}),(0,O.jsx)(`span`,{className:`text-[10px] text-white/20`,children:`identity · policy · job history · exports`})]}),!t&&(0,O.jsxs)(`div`,{className:`mt-4 grid items-start gap-5 xl:grid-cols-2`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,O.jsxs)(`section`,{className:`rounded-2xl border border-white/[0.08] bg-[#101014] p-4`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Runtime identity`}),(0,O.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-white/35`,children:`Hive keeps one durable mission while the agent creates a new background job for each follow-up turn. These identifiers are diagnostic details and do not change the conversation.`}),(0,O.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[110px_1fr] gap-y-2 text-xs`,children:[(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Mission ID`}),(0,O.jsx)(`dd`,{className:`mono text-white/50`,children:e.missionId}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Current job`}),(0,O.jsx)(`dd`,{className:`mono text-white/50`,children:e.jobId}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Process ID`}),(0,O.jsx)(`dd`,{className:`mono text-white/50`,children:e.pid>=0?e.pid:`not running`}),(0,O.jsx)(`dt`,{className:`text-white/25`,children:`Job turns`}),(0,O.jsx)(`dd`,{className:`text-white/50`,children:e.jobIds.length})]})]}),(0,O.jsx)(Vs,{missionId:e.missionId,initial:e.mission.policy}),(0,O.jsx)(Bs,{jobs:e.jobHistory})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,O.jsx)(zs,{missionId:e.missionId}),(0,O.jsx)(Hs,{missionId:e.missionId})]})]})]})}function Gs(e){let t=Math.max(0,Math.round(e/6e4));return t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function Ks({events:e,workers:t,plan:n,compact:r=!1}){let i=(0,g.useMemo)(()=>{let r=Date.now(),i=[...e.map(e=>e.ts),...t.flatMap(e=>[e.startedAt,e.doneAt??e.jobUpdatedAt??r])],a=Math.min(...i),o=Math.max(...i,a+6e4),s=Math.max(1,o-a),c=e=>Math.max(0,Math.min(100,(e-a)/s*100)),l=[...e].sort((e,t)=>e.ts-t.ts),u=l.slice(1).map((e,t)=>({start:l[t].ts,end:e.ts})).filter(e=>e.end-e.start>=3e5),d=Jt(n),f=new Map(d.map(e=>[e.id,e])),p=new Map,m=new Map,h=[...d];for(let e=0;e<d.length+1&&h.length;e+=1)for(let e=h.length-1;e>=0;--e){let t=h[e],n=t.dependsOn.filter(e=>f.has(e));if(n.some(e=>!p.has(e)))continue;let r=0;for(let e of n)(p.get(e)??0)>r&&(r=p.get(e),m.set(t.id,e));p.set(t.id,r+t.weight),h.splice(e,1)}let g=[...d].sort((e,t)=>(p.get(t.id)??0)-(p.get(e.id)??0))[0]?.id,_=new Set;for(;g;)_.add(g),g=m.get(g);return{start:a,end:o,span:s,x:c,gaps:u,criticalWorkers:new Set(d.filter(e=>_.has(e.id)).map(e=>e.workerId??e.owner).filter(e=>!!e))}},[e,t,n]);if(!e.length&&!t.length)return(0,O.jsx)(`p`,{className:`text-sm text-white/40`,children:`No runtime data yet.`});let a=[{id:`manager`,label:`Manager`,events:e.filter(e=>!e.targetWorker||e.targetWorker===`hive-orchestrator`)},...t.map(t=>({id:`${t.jobId}:${t.id}`,label:t.label,worker:t,events:e.filter(e=>e.targetWorker&&e.targetWorker!==`hive-orchestrator`&&vn(e.targetWorker,t))}))],o=r?`grid-cols-[90px_minmax(0,1fr)]`:`grid-cols-[150px_1fr]`;return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`mb-3 flex flex-wrap gap-3 text-[9px] text-white/25`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`text-amber-300`,children:`━`}),` critical path worker`]}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`text-rose-300`,children:`▧`}),` blocked/bottleneck`]}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`text-white/20`,children:`▧`}),` idle gap ≥5m`]})]}),(0,O.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-white/[0.06] bg-black/15`,children:(0,O.jsxs)(`div`,{className:r?`min-w-0`:`min-w-[680px]`,children:[(0,O.jsxs)(`div`,{className:`grid ${o} border-b border-white/[0.06] px-3 py-2 text-[9px] text-white/20`,children:[(0,O.jsx)(`span`,{children:`Lane`}),(0,O.jsxs)(`div`,{className:`flex justify-between`,children:[(0,O.jsx)(`span`,{children:new Date(i.start).toLocaleTimeString()}),(0,O.jsx)(`span`,{children:Gs(i.span)}),(0,O.jsx)(`span`,{children:new Date(i.end).toLocaleTimeString()})]})]}),a.map(e=>{let t=`worker`in e?e.worker:void 0,n=t?t.doneAt??t.jobUpdatedAt??Date.now():void 0,r=t?[...i.criticalWorkers].some(e=>vn(e,t)):!1,a=t?.jobState===`blocked`||e.events.some(e=>e.outcome===`failure`);return(0,O.jsxs)(`div`,{className:`grid min-h-12 ${o} border-b border-white/[0.04] px-3 last:border-0`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center pr-3`,children:[(0,O.jsx)(`span`,{className:`truncate text-[10px] text-white/45`,title:e.label,children:e.label}),r&&(0,O.jsx)(`span`,{className:`ml-1 text-amber-300`,children:`◆`})]}),(0,O.jsxs)(`div`,{className:`relative my-2 overflow-hidden rounded bg-white/[0.015]`,children:[i.gaps.map((e,t)=>(0,O.jsx)(`span`,{className:`absolute inset-y-0 bg-white/[0.025]`,style:{left:`${i.x(e.start)}%`,width:`${i.x(e.end)-i.x(e.start)}%`},title:`Idle gap ${Gs(e.end-e.start)}`},t)),t&&(0,O.jsx)(`span`,{className:`absolute top-1/2 h-2 -translate-y-1/2 rounded-full ${a?`bg-rose-400/60`:r?`bg-amber-300/65`:t.doneAt?`bg-emerald-400/45`:`bg-violet-400/50`}`,style:{left:`${i.x(t.startedAt)}%`,width:`${Math.max(.7,i.x(n)-i.x(t.startedAt))}%`},title:`${t.label}: ${Gs(n-t.startedAt)}`}),e.events.map((e,t)=>(0,O.jsx)(`span`,{className:`absolute top-1/2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-black/40 ${e.outcome===`failure`?`bg-rose-400`:e.source===`custom`?`bg-violet-400`:`bg-white/45`}`,style:{left:`${i.x(e.ts)}%`},title:`${new Date(e.ts).toLocaleTimeString()} · ${e.detail}`},`${e.ts}:${t}`))]})]},e.id)})]})})]})}function qs(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function Js(e){return e.doneAt?`complete`:e.jobState===`working`||e.jobState===`busy`?`working`:`ended`}function Ys({workers:e,compact:t=!1,narrow:n=!1,onSelect:r}){let[i,a]=(0,g.useState)(Date.now());if((0,g.useEffect)(()=>{let e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[]),!e.length)return t?null:(0,O.jsxs)(`div`,{className:`rounded-xl border border-dashed border-white/10 py-10 text-center`,children:[(0,O.jsx)(`p`,{className:`text-sm text-white/35`,children:`No workers have been delegated yet.`}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-white/20`,children:`Workers appear here as the orchestrator fans out work.`})]});if(t){let t=e.filter(e=>Js(e)===`working`).length,n=e.filter(e=>Js(e)===`complete`).length;return(0,O.jsxs)(`div`,{className:`mt-4 flex items-center gap-3 text-xs text-white/40`,children:[(0,O.jsxs)(`span`,{children:[e.length,` worker`,e.length===1?``:`s`]}),t>0&&(0,O.jsxs)(`span`,{className:`text-amber-300`,children:[`● `,t,` active`]}),n>0&&(0,O.jsxs)(`span`,{className:`text-emerald-300`,children:[`✓ `,n,` done`]})]})}return(0,O.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let t=Js(e),a=e.doneAt??(t===`working`?i:e.jobUpdatedAt??i),o=Math.max(e.updatedAt??0,e.jobUpdatedAt??0);return(0,O.jsx)(`button`,{type:`button`,onClick:()=>r?.(e),className:`group w-full min-w-0 overflow-hidden rounded-xl border border-white/8 bg-white/[0.025] px-4 py-3.5 text-left transition hover:-translate-y-px hover:border-amber-300/20 hover:bg-white/[0.045] hover:shadow-lg hover:shadow-black/15`,children:(0,O.jsxs)(`div`,{className:`flex gap-3 ${n?`flex-col`:`items-start justify-between gap-4`}`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${t===`working`?`hive-pulse bg-amber-400`:t===`complete`?`bg-emerald-400`:`bg-white/25`}`}),(0,O.jsx)(`p`,{className:`${n?`whitespace-normal break-words [overflow-wrap:anywhere]`:`truncate`} min-w-0 text-sm font-medium text-white/85`,title:e.label,children:e.label})]}),(0,O.jsxs)(`div`,{className:`ml-4 mt-1.5 flex flex-wrap items-center gap-2 text-[11px] text-white/30`,children:[(0,O.jsx)(`span`,{className:`rounded bg-white/5 px-1.5 py-0.5 uppercase tracking-wide`,children:e.kind}),(0,O.jsx)(`span`,{className:`mono`,children:e.id.slice(0,8)}),e.tokens!==void 0&&(0,O.jsxs)(`span`,{children:[e.tokens.toLocaleString(),` tokens`]}),o>0&&(0,O.jsxs)(`span`,{title:new Date(o).toLocaleString(),children:[`updated `,qs(i-o),` ago`]})]})]}),(0,O.jsxs)(`div`,{className:`shrink-0 ${n?`ml-4 flex items-center gap-2 text-left`:`text-right`}`,children:[(0,O.jsx)(`p`,{className:`text-xs font-medium capitalize ${t===`working`?`text-amber-300`:t===`complete`?`text-emerald-300`:`text-white/35`}`,children:t}),(0,O.jsx)(`p`,{className:`mono mt-1 text-[11px] text-white/30`,children:qs(a-e.startedAt)})]})]})},`${e.jobId}:${e.id}`)})})}function Xs(e){return e.replace(/\u001b\][^\u0007]*(?:\u0007|\u001b\\)/g,``).replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,``).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001a\u001c-\u001f\u007f]/g,``)}function Zs(e){return Xs([e.kind,e.tool,e.invocation,e.input,e.output,e.text].filter(Boolean).join(`
|
|
13
|
+
`))}function Qs(e){return e.map(e=>[e.ts?new Date(e.ts).toISOString():``,Zs(e)].filter(Boolean).join(` `)).join(`
|
|
14
|
+
|
|
15
|
+
`)}function $s(e){return e.key===`Enter`&&!e.shiftKey&&!e.isComposing}function ec(e,t=1e4){return e.length>t}var tc=typeof window>`u`?g.useEffect:g.useLayoutEffect,nc=3e3,rc=1e4;function ic(e){return e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):``}function ac(e){if(e)return e>=1048576?`${(e/1048576).toFixed(1)}MB`:`${Math.round(e/1024)}KB`}function oc(e){return e.split(`
|
|
16
|
+
`).find(e=>e.trim())??``}function sc({children:e,time:t,gutter:n}){return(0,O.jsxs)(`div`,{className:`flex gap-2 px-1 py-0.5`,children:[(0,O.jsx)(`span`,{className:`mono w-[52px] shrink-0 select-none pt-0.5 text-right text-[10px] text-white/20`,children:ic(t)}),(0,O.jsx)(`span`,{className:`w-3 shrink-0 select-none pt-0.5 text-center text-[10px] leading-4`,children:n}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1`,children:e})]})}function cc({body:e,lines:t,truncated:n,tone:r,label:i}){e=Xs(e);let a=oc(e);return(t??e.split(`
|
|
17
|
+
`).length)>1||e.length>160?(0,O.jsxs)(`details`,{className:`group`,children:[(0,O.jsxs)(`summary`,{className:`mono cursor-pointer list-none truncate text-[11px] leading-relaxed ${r} hover:text-white/75`,children:[(0,O.jsx)(`span`,{className:`mr-1 inline-block text-white/25 transition group-open:rotate-90`,children:`▸`}),(0,O.jsx)(`span`,{className:`group-open:hidden`,children:a}),(0,O.jsxs)(`span`,{className:`hidden text-white/30 group-open:inline`,children:[i??`output`,t?` · ${t} line${t===1?``:`s`}`:``,n?` · truncated`:``]})]}),(0,O.jsx)(`pre`,{className:`mono mt-1 max-h-80 overflow-auto whitespace-pre-wrap break-words rounded border border-white/[0.06] bg-black/25 px-2 py-1.5 text-[10px] leading-relaxed ${r}`,children:e}),!n&&t!==void 0&&t>1&&(0,O.jsxs)(`p`,{className:`mt-0.5 text-[9px] text-white/18`,children:[t,` lines`]})]}):(0,O.jsx)(`p`,{className:`mono whitespace-pre-wrap break-words text-[11px] leading-relaxed ${r}`,children:e||(0,O.jsx)(`span`,{className:`text-white/20`,children:`(no output)`})})}function lc({entry:e}){if(e.kind===`tool_use`)return(0,O.jsx)(sc,{time:e.ts,gutter:(0,O.jsx)(`span`,{className:`text-violet-300/70`,children:`●`}),children:(0,O.jsxs)(`details`,{className:`group`,children:[(0,O.jsx)(`summary`,{className:`mono cursor-pointer list-none break-words text-[11px] leading-relaxed text-violet-200/80 hover:text-violet-100`,children:Xs(e.invocation??e.tool??`tool`)}),e.input&&(0,O.jsx)(`pre`,{className:`mono mt-1 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded border border-violet-300/10 bg-black/25 px-2 py-1.5 text-[10px] leading-relaxed text-white/45`,children:Xs(e.input)})]})});if(e.kind===`tool_result`)return(0,O.jsx)(sc,{time:e.ts,gutter:(0,O.jsx)(`span`,{className:e.isError?`text-rose-400/80`:`text-white/20`,children:`⎿`}),children:(0,O.jsx)(cc,{body:e.output??``,lines:e.lines,truncated:e.truncated,tone:e.isError?`text-rose-200/70`:`text-white/45`,label:e.isError?`error output`:`output`})});if(e.kind===`assistant`)return(0,O.jsxs)(sc,{time:e.ts,children:[(0,O.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-[12px] leading-relaxed text-white/75`,children:Xs(e.text??``)}),e.skill&&(0,O.jsxs)(`p`,{className:`mt-0.5 text-[9px] text-violet-300/40`,children:[`via /`,e.skill]})]});if(e.kind===`thinking`)return(0,O.jsx)(sc,{time:e.ts,gutter:(0,O.jsx)(`span`,{className:`text-white/15`,children:`✻`}),children:(0,O.jsx)(cc,{body:e.text??``,truncated:e.truncated,tone:`italic text-white/35`,label:`thinking`})});let t=e.kind===`injected`;return(0,O.jsx)(sc,{time:e.ts,gutter:(0,O.jsx)(`span`,{className:t?`text-white/15`:`text-amber-300/60`,children:t?`⚙`:`▸`}),children:(0,O.jsx)(cc,{body:e.text??``,truncated:e.truncated,tone:t?`text-white/30`:`text-amber-100/70`,label:t?`injected instructions`:`prompt`})})}function uc({missionId:e,live:t=!1}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(void 0),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(!0),[u,d]=(0,g.useState)(!0),[f,p]=(0,g.useState)(``),[m,h]=(0,g.useState)(!1),[_,v]=(0,g.useState)(null),[y,b]=(0,g.useState)(``),[x,S]=(0,g.useState)(0),[w,T]=(0,g.useState)(`idle`),E=(0,g.useRef)(null),D=(0,g.useRef)(!0),k=(0,g.useRef)(!0),A=`hive:terminal-source:${e}`,j=(0,g.useCallback)(async(t,n=!1)=>{n||l(!0);try{let n=await ye(e,{source:t});r(n),a(n.source),s(null)}catch(e){s(e.message)}finally{n||l(!1)}},[e]);(0,g.useEffect)(()=>{r(null),a(void 0);let e;try{e=sessionStorage.getItem(A)??void 0}catch{}k.current=!0,j(e)},[j,A]),(0,g.useEffect)(()=>{if(!u||!t)return;let e=setInterval(()=>void j(i,!0),nc);return()=>clearInterval(e)},[u,t,j,i]),(0,g.useEffect)(()=>{if(i)return C(e,i,e=>{(e.restarted||e.truncated||e.events.length)&&j(i,!0)})},[j,e,i]);let M=n?.entries??[],N=(0,g.useMemo)(()=>{let e=y.trim().toLocaleLowerCase();return e?M.flatMap((t,n)=>Zs(t).toLocaleLowerCase().includes(e)?[n]:[]):[]},[M,y]),P=M.at(-1);tc(()=>{let t=E.current;if(!t)return;let n=`hive:terminal-scroll:${e}:${i??`orchestrator`}`;if(k.current){k.current=!1;let e;try{let t=sessionStorage.getItem(n);t!==null&&(e=Number(t))}catch{}if(e!==void 0&&Number.isFinite(e)){t.scrollTop=e,D.current=t.scrollHeight-t.scrollTop-t.clientHeight<40;return}}u&&D.current&&(t.scrollTop=t.scrollHeight)},[u,M.length,P?.ts,i]),(0,g.useEffect)(()=>{S(0)},[y,i]),(0,g.useEffect)(()=>{x>=N.length&&S(Math.max(0,N.length-1))},[N.length,x]),(0,g.useEffect)(()=>{let e=N[x];e!==void 0&&(E.current?.querySelector(`[data-terminal-entry="${e}"]`)?.scrollIntoView?.({block:`center`}),D.current=!1)},[N,x]);let F=n?.sources??[],I=F.find(e=>e.id===i),L=`hive:terminal-draft:${e}:${i??`orchestrator`}`;(0,g.useEffect)(()=>{try{p(sessionStorage.getItem(L)??``)}catch{p(``)}},[L]);async function ee(){let t=f.trim();if(!(!t||!I?.terminal||I.terminal.mode===`read_only`)){h(!0),v(null);try{I.terminal.mode===`interactive`?await be(e,t,i):await W(e,t),p(``);try{sessionStorage.removeItem(L)}catch{}D.current=!0,j(i,!0)}catch(e){v(e.message)}finally{h(!1)}}}async function R(){h(!0),v(null);try{await xe(e)}catch(e){v(e.message)}finally{h(!1)}}async function te(){try{await navigator.clipboard.writeText(Qs(M)),T(`copied`),setTimeout(()=>T(`idle`),1500)}catch{T(`failed`)}}return(0,O.jsxs)(`section`,{"aria-label":`Mission terminal`,className:`overflow-hidden rounded-2xl border border-white/10 bg-[#0b0b0e]`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-white/[0.07] px-3 py-2`,children:[F.length>1?(0,O.jsx)(`select`,{"aria-label":`Transcript source`,value:i??``,onChange:e=>{let t=e.target.value;k.current=!0;try{sessionStorage.setItem(A,t)}catch{}j(t)},className:`min-w-0 max-w-[260px] shrink rounded-md border border-white/10 bg-[#17171c] px-2 py-1 text-[11px] text-white/70 outline-none focus:border-violet-400/40`,children:F.map(e=>(0,O.jsx)(`option`,{value:e.id,children:dc(e)},e.id))}):(0,O.jsx)(`span`,{className:`text-[11px] text-white/45`,children:I?.label??`Transcript`}),I?.agentType&&(0,O.jsx)(`span`,{className:`mono shrink-0 rounded bg-white/[0.05] px-1.5 py-0.5 text-[9px] text-white/30`,children:I.agentType}),I?.terminal?.provider&&(0,O.jsxs)(`span`,{className:`mono shrink-0 text-[9px] text-white/20`,children:[I.terminal.provider,I.terminal.providerVersion?` ${I.terminal.providerVersion}`:``]}),I?.terminal&&(0,O.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wider ${I.terminal.mode===`interactive`?`bg-emerald-300/10 text-emerald-200/70`:I.terminal.mode===`follow_up`?`bg-sky-300/10 text-sky-200/60`:`bg-white/[0.05] text-white/30`}`,children:I.terminal.mode===`interactive`?`Interactive`:I.terminal.mode===`follow_up`?`Follow-up`:`Read only`}),I?.terminal&&(0,O.jsx)(`span`,{className:`mono shrink-0 text-[9px] ${I.terminal.connected?`text-emerald-300/45`:`text-white/20`}`,children:I.terminal.connected?`Connected`:`Disconnected`}),ac(I?.bytes)&&(0,O.jsx)(`span`,{className:`mono shrink-0 text-[9px] text-white/20`,children:ac(I?.bytes)}),(0,O.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,O.jsxs)(`label`,{className:`flex items-center rounded-md border border-white/10 bg-black/20 px-2 focus-within:border-violet-300/30`,children:[(0,O.jsx)(`span`,{className:`sr-only`,children:`Search terminal output`}),(0,O.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Search`,className:`mono w-24 bg-transparent py-1 text-[10px] text-white/60 outline-none placeholder:text-white/20 sm:w-32`}),y&&(0,O.jsx)(`span`,{"aria-live":`polite`,className:`mono ml-1 text-[9px] text-white/25`,children:N.length?`${x+1}/${N.length}`:`0`})]}),N.length>1&&(0,O.jsxs)(`div`,{className:`flex`,"aria-label":`Terminal search results`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-label":`Previous result`,onClick:()=>S(e=>(e-1+N.length)%N.length),className:`px-1 text-[11px] text-white/35 hover:text-white/70`,children:`↑`}),(0,O.jsx)(`button`,{type:`button`,"aria-label":`Next result`,onClick:()=>S(e=>(e+1)%N.length),className:`px-1 text-[11px] text-white/35 hover:text-white/70`,children:`↓`})]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>void te(),disabled:!M.length,className:`rounded-md border border-white/10 px-2 py-1 text-[10px] text-white/40 transition hover:border-white/25 hover:text-white/70 disabled:opacity-30`,children:w===`copied`?`Copied`:w===`failed`?`Copy failed`:`Copy`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>void j(i),className:`rounded-md border border-white/10 px-2 py-1 text-[10px] text-white/40 transition hover:border-white/25 hover:text-white/70`,children:`Refresh`}),t&&(0,O.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-[10px] text-white/40`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>{d(e.target.checked),e.target.checked&&(D.current=!0)},className:`h-3 w-3 accent-violet-500`}),`Follow`]})]})]}),(0,O.jsxs)(`div`,{ref:E,role:`log`,"aria-label":`Terminal output`,"aria-live":`off`,tabIndex:0,onScroll:t=>{let n=t.currentTarget;D.current=n.scrollHeight-n.scrollTop-n.clientHeight<40;try{sessionStorage.setItem(`hive:terminal-scroll:${e}:${i??`orchestrator`}`,String(n.scrollTop))}catch{}},className:`max-h-[520px] min-h-40 overflow-y-auto py-2`,children:[n?.truncated&&(0,O.jsx)(`p`,{className:`mb-1 px-3 text-[9px] uppercase tracking-wider text-white/20`,children:`⋯ earlier history not shown`}),c&&!n&&(0,O.jsx)(`p`,{className:`px-4 py-8 text-center text-xs text-white/30`,children:`Reading the transcript…`}),o&&(0,O.jsx)(`p`,{className:`px-4 py-8 text-center text-xs text-rose-400`,children:o}),!c&&!o&&M.length===0&&(0,O.jsx)(`p`,{className:`px-4 py-8 text-center text-xs text-white/30`,children:F.length===0?`No transcript on disk for this mission yet.`:`This transcript has nothing to show yet.`}),M.map((e,t)=>(0,O.jsx)(`div`,{"data-terminal-entry":t,className:N[x]===t?`bg-amber-200/[0.06] ring-1 ring-inset ring-amber-200/10`:void 0,children:(0,O.jsx)(lc,{entry:e})},`${e.ts??0}:${e.kind}:${e.toolUseId??t}:${t}`))]}),I?.terminal&&(0,O.jsxs)(`div`,{className:`border-t border-white/[0.07] bg-black/15 p-3`,children:[I.terminal.mode===`read_only`?(0,O.jsx)(`p`,{className:`text-[10px] text-white/30`,children:I.terminal.reason??`This terminal source is read only.`}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-2 text-[10px] text-white/30`,children:I.terminal.reason}),(0,O.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,O.jsx)(`textarea`,{"aria-label":I.terminal.mode===`interactive`?`Terminal input`:`Terminal follow-up`,rows:2,value:f,onChange:e=>{p(e.target.value);try{sessionStorage.setItem(L,e.target.value)}catch{}},onKeyDown:e=>{e.stopPropagation(),$s({key:e.key,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),ee())},onPaste:e=>{let t=e.clipboardData.getData(`text`);ec(t,rc)&&!window.confirm(`Paste ${t.length.toLocaleString()} characters into this terminal?`)&&e.preventDefault()},placeholder:I.terminal.mode===`interactive`?`Send input to this Codex thread…`:`Send a provider follow-up…`,className:`mono min-h-16 min-w-0 flex-1 resize-y rounded-lg border border-white/10 bg-black/25 px-3 py-2 text-[11px] leading-relaxed text-white/70 outline-none placeholder:text-white/20 focus:border-sky-300/30`}),(0,O.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1.5`,children:[(0,O.jsx)(`button`,{type:`button`,disabled:m||!f.trim(),onClick:()=>void ee(),className:`rounded-lg border border-sky-300/20 bg-sky-300/[0.07] px-3 py-2 text-[11px] font-medium text-sky-100/70 hover:bg-sky-300/[0.12] disabled:opacity-30`,children:m?`Sending…`:I.terminal.mode===`interactive`?`Send input`:`Send follow-up`}),I.terminal.mode===`interactive`&&I.terminal.acceptsInterrupt&&(0,O.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void R(),className:`rounded-lg border border-rose-300/15 px-3 py-1.5 text-[10px] text-rose-200/60 hover:bg-rose-300/[0.07] disabled:opacity-30`,children:`Interrupt turn`})]})]}),_&&(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-300/75`,children:_})]}),(0,O.jsx)(`p`,{className:`mt-2 text-[9px] leading-relaxed text-white/20`,children:`Recovery: return to Chat if input fails; Refresh reloads durable output. If the stream disconnects, reload Hive. Interrupt turn stops only the current interactive turn; mission Pause/Stop controls remain separate.`})]})]})}function dc(e){return e.kind===`orchestrator`?`Orchestrator`:`${e.label.length>44?`${e.label.slice(0,43)}…`:e.label}${e.agentType?` · ${e.agentType}`:``}`}function Q({title:e,subtitle:t,right:n,children:r}){return(0,O.jsxs)(`section`,{className:`rounded-2xl border border-white/[0.08] bg-[#101014] p-4`,children:[(0,O.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h2`,{className:`text-xs font-semibold text-white/80`,children:e}),t&&(0,O.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-white/25`,children:t})]}),n]}),r]})}function fc({node:e,events:t,onSelectWorker:n}){let[r,i]=(0,g.useState)(`feed`),a=e.workers.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)).length,o=e.inFlight.tasks>0||e.inFlight.queued>0;return(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,O.jsx)(ur,{prs:e.prs,messages:e.messages}),e.workers.length>0&&(0,O.jsxs)(Q,{title:`Workers`,subtitle:`Delegated tasks and runtime`,right:a>0?(0,O.jsxs)(`span`,{className:`shrink-0 rounded-full bg-amber-400/10 px-2 py-0.5 text-[10px] font-medium text-amber-300`,children:[a,` active`]}):void 0,children:[(0,O.jsx)(Ys,{workers:e.workers,narrow:!0,onSelect:n}),o&&(0,O.jsxs)(`div`,{className:`mt-3 flex gap-3 rounded-lg bg-white/[0.03] px-3 py-2 text-[11px] text-white/35`,children:[(0,O.jsxs)(`span`,{children:[e.inFlight.tasks,` in flight`]}),(0,O.jsxs)(`span`,{children:[e.inFlight.queued,` queued`]})]})]}),e.detail&&(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] px-4 py-3`,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/25`,children:`Latest runtime note`}),(0,O.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-white/45`,children:e.detail})]}),(0,O.jsx)(Q,{title:`Activity`,subtitle:r===`log`?`The session's own terminal output`:`Transitions, tools, workers, and gaps`,right:(0,O.jsx)(`div`,{className:`inline-flex shrink-0 rounded-lg border border-white/[0.06] bg-black/15 p-0.5`,children:[`feed`,`parallel`,`log`].map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-md px-2 py-1 text-[9px] font-medium uppercase tracking-wider transition ${r===e?`bg-white/[0.08] text-white/65`:`text-white/25 hover:text-white/45`}`,children:e===`log`?`terminal`:e},e))}),children:r===`feed`?(0,O.jsx)(qr,{events:t,compact:!0}):r===`parallel`?(0,O.jsx)(Ks,{events:t,workers:e.workers,plan:e.plan}):(0,O.jsx)(uc,{missionId:e.missionId,live:e.activityStatus===`working`})})]})}var pc=/(?:^|\s)\/([\w:-]+)/g;function mc(e){return e?[...e.matchAll(pc)].map(e=>e[1]):[]}function hc({messages:e,plan:t}){let n=[...new Map(e.flatMap(e=>mc(e.text).map(t=>[`${e.role}:${t}`,{skill:t,role:e.role}]))).values()],r=Jt(t).flatMap(e=>[...new Set([...mc(e.assignment),...mc(e.context),...mc(e.description)])].map(t=>({skill:t,task:e.title,worker:e.owner??e.workerId})));return!n.length&&!r.length?null:(0,O.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,O.jsxs)(`div`,{className:`mb-3`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Skills`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Explicit slash skills observed in requests and assignments`})]}),n.length>0&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-[9px] font-medium uppercase tracking-wider text-white/20`,children:`Invoked in conversation`}),(0,O.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:n.map(e=>(0,O.jsxs)(`span`,{className:`rounded-md border border-violet-300/10 bg-violet-300/[0.05] px-2 py-1 font-mono text-[10px] text-violet-200/55`,children:[`/`,e.skill,` `,(0,O.jsx)(`span`,{className:`ml-1 font-sans uppercase text-white/20`,children:e.role===`assistant`?`manager`:`you`})]},`${e.role}:${e.skill}`))})]}),r.length>0&&(0,O.jsxs)(`div`,{className:n.length?`mt-3`:``,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-medium uppercase tracking-wider text-white/20`,children:`Assigned to workers`}),(0,O.jsx)(`ul`,{className:`mt-1.5 space-y-1.5`,children:r.map((e,t)=>(0,O.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md bg-white/[0.02] px-2 py-1.5 text-[10px]`,children:[(0,O.jsxs)(`span`,{className:`font-mono text-violet-200/55`,children:[`/`,e.skill]}),(0,O.jsx)(`span`,{className:`truncate text-white/35`,children:e.task}),e.worker&&(0,O.jsx)(`span`,{className:`ml-auto shrink-0 text-amber-200/35`,children:e.worker})]},`${e.skill}:${e.task}:${t}`))})]})]})}function gc(e){return e>=100?`bg-rose-400`:e>=80?`bg-amber-400`:`bg-emerald-400`}function _c(e){return e<60?`${Math.round(e)}m`:`${Math.floor(e/60)}h ${Math.round(e%60)}m`}function vc({budgets:e,tokens:t,workers:n,elapsedMs:r}){if(!e||!Object.values(e).some(Boolean))return null;let i=n.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)).length,a=[e.maxTokens?{label:`Tokens`,used:t,limit:e.maxTokens,display:`${t.toLocaleString()} / ${e.maxTokens.toLocaleString()}`}:void 0,e.maxElapsedMinutes?{label:`Elapsed`,used:r/6e4,limit:e.maxElapsedMinutes,display:`${_c(r/6e4)} / ${_c(e.maxElapsedMinutes)}`}:void 0,e.maxWorkers?{label:`Workers`,used:n.length,limit:e.maxWorkers,display:`${n.length} / ${e.maxWorkers}`}:void 0,e.maxConcurrentWorkers?{label:`Concurrent`,used:i,limit:e.maxConcurrentWorkers,display:`${i} / ${e.maxConcurrentWorkers}`}:void 0].filter(e=>!!e),o=r>6e4?t/(r/6e4):0,s=e.maxTokens&&o>0?Math.max(0,(e.maxTokens-t)/o):void 0;return(0,O.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,O.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Mission budgets`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Soft limits requiring approval to exceed`})]}),a.some(e=>e.used>=e.limit)&&(0,O.jsx)(`span`,{className:`rounded-full bg-rose-400/10 px-2 py-1 text-[9px] uppercase text-rose-200/65`,children:`Limit reached`})]}),(0,O.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>{let t=Math.round(e.used/e.limit*100);return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`mb-1 flex justify-between text-[10px]`,children:[(0,O.jsx)(`span`,{className:`text-white/35`,children:e.label}),(0,O.jsxs)(`span`,{className:t>=100?`text-rose-300/70`:`text-white/45`,children:[e.display,` · `,t,`%`]})]}),(0,O.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,O.jsx)(`div`,{className:`h-full rounded-full ${gc(t)}`,style:{width:`${Math.min(100,t)}%`}})})]},e.label)})}),s!==void 0&&(0,O.jsxs)(`p`,{className:`mt-3 border-t border-white/[0.05] pt-2 text-[10px] text-white/25`,children:[`At the current average rate, the token budget has about `,_c(s),` remaining.`]})]})}function yc({value:e,label:t,display:n,className:r=``}){let[i,a]=(0,g.useState)(!1);return(0,g.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>a(!1),1400);return()=>clearTimeout(e)},[i]),(0,O.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>a(!0)).catch(()=>a(!1))},title:i?`Copied`:`Copy ${t??e}`,"aria-label":`Copy ${t??e}`,className:`group/copy inline-flex max-w-full cursor-pointer items-baseline gap-1.5 rounded text-left transition hover:bg-white/[0.05] ${r}`,children:[(0,O.jsx)(`span`,{className:`min-w-0 break-all`,children:n??e}),(0,O.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-[9px] transition ${i?`text-emerald-300/80`:`text-white/15 group-hover/copy:text-white/45`}`,children:i?`copied`:`⧉`})]})}function bc({label:e,children:t}){return(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/22`,children:e}),(0,O.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-white/55`,children:t})]})}function xc({node:e,defaultModelLabel:t,elapsedMs:n}){let{mission:r}=e,i=r.acceptanceCriteria??[];return(0,O.jsxs)(`aside`,{className:`flex flex-col gap-4`,children:[(0,O.jsx)(`section`,{className:`rounded-2xl border border-white/[0.08] bg-[#101014] p-4`,children:(0,O.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,O.jsx)(bc,{label:`Objective`,children:(0,O.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:r.objective})}),i.length>0&&(0,O.jsx)(bc,{label:`Acceptance criteria · ${i.length}`,children:(0,O.jsx)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:i.map((e,t)=>(0,O.jsxs)(`li`,{className:`flex gap-2`,children:[(0,O.jsx)(`span`,{className:`mono shrink-0 text-white/20`,children:t+1}),(0,O.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]},`${t}:${e}`))})})]})}),(0,O.jsx)(`section`,{className:`rounded-2xl border border-white/[0.08] bg-[#101014] p-4`,children:(0,O.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r.repository&&(0,O.jsxs)(bc,{label:`Repository`,children:[(0,O.jsx)(yc,{value:r.repository,label:`repository path`,display:tt(r.repository),className:`mono`}),r.additionalRepositories?.map(e=>(0,O.jsx)(yc,{value:e,label:`path for ${tt(e)}`,display:`+ ${tt(e)}`,className:`mono mt-1 flex text-sky-200/50`},e))]}),e.worktreeBranch&&(0,O.jsx)(bc,{label:`Branch`,children:(0,O.jsx)(yc,{value:e.worktreeBranch,label:`branch name`,display:nt(e.worktreeBranch),className:`mono text-violet-300/60`})}),(0,O.jsx)(bc,{label:`Mission ID`,children:(0,O.jsx)(yc,{value:e.missionId,label:`mission id`,className:`mono text-white/40`})}),(0,O.jsxs)(bc,{label:`Agent`,children:[(0,O.jsx)(`span`,{className:`capitalize`,children:r.provider??`claude`}),(0,O.jsx)(`span`,{className:`mono mt-1 block text-white/40`,children:r.model??(t?`CLI default (${t})`:`CLI default`)}),(0,O.jsxs)(`span`,{className:`mt-1 block capitalize text-white/35`,children:[r.mode,r.planFirst?` · plan first`:``]})]}),r.template&&(0,O.jsx)(bc,{label:`Template`,children:(0,O.jsxs)(`span`,{className:`text-amber-200/50`,children:[r.template.name,` v`,r.template.version,` · `,r.template.source]})})]})}),(0,O.jsx)(vc,{budgets:r.budgets,tokens:e.tokens,workers:e.workers,elapsedMs:n})]})}var Sc={pending:`text-amber-200/65 bg-amber-300/[0.06]`,satisfied:`text-emerald-200/65 bg-emerald-300/[0.06]`,failed:`text-rose-200/70 bg-rose-300/[0.06]`,waived:`text-slate-300/50 bg-slate-300/[0.05]`};function Cc({missionId:e,gates:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)({label:``,type:`test`,required:!0});async function m(t){if(i.trim()){s(!0),l(null);try{await fe(e,t,i),r(null),a(``)}catch(e){l(e.message)}finally{s(!1)}}}function h(e){d(e?.id??`new`),p(e?{label:e.label,type:e.type,required:e.required}:{label:``,type:`test`,required:!0}),l(null)}async function _(){if(!(!f.label.trim()||!u)){s(!0),l(null);try{let t=u===`new`?await K(e,{...f,label:f.label.trim()}):await pe(e,u,{...f,label:f.label.trim()});d(null),t.notified||l(`Gate saved, but the current manager could not be notified. Send a follow-up when the mission is resumable.`)}catch(e){l(e.message)}finally{s(!1)}}}async function v(t){if(window.confirm(`Remove completion gate “${t.label}”?`)){s(!0),l(null);try{(await me(e,t.id)).notified||l(`Gate removed, but the current manager could not be notified.`)}catch(e){l(e.message)}finally{s(!1)}}}let y=(0,O.jsxs)(`div`,{className:`rounded-lg border border-amber-300/10 bg-amber-300/[0.025] p-3`,children:[(0,O.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_140px]`,children:[(0,O.jsx)(`input`,{autoFocus:!0,value:f.label,onChange:e=>p({...f,label:e.target.value}),placeholder:`Gate name, e.g. Tests pass`,className:`min-w-0 rounded-md border border-white/10 bg-black/20 px-2.5 py-2 text-xs text-white/65 outline-none focus:border-amber-300/25`}),(0,O.jsx)(`select`,{value:f.type,onChange:e=>p({...f,type:e.target.value}),className:`rounded-md border border-white/10 bg-[#151519] px-2 py-2 text-xs text-white/55`,children:[`test`,`typecheck`,`lint`,`ci`,`review`,`pr`,`screenshot`,`documentation`,`user_approval`,`custom`].map(e=>(0,O.jsx)(`option`,{value:e,children:e.replaceAll(`_`,` `)},e))})]}),(0,O.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center gap-2 text-[10px] text-white/35`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:f.required,onChange:e=>p({...f,required:e.target.checked})}),`Required before mission completion`]}),(0,O.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{onClick:()=>d(null),className:`px-2 py-1 text-[10px] text-white/30`,children:`Cancel`}),(0,O.jsx)(`button`,{disabled:!f.label.trim()||o,onClick:()=>void _(),className:`rounded-md bg-amber-300 px-2.5 py-1.5 text-[10px] font-semibold text-black disabled:opacity-35`,children:o?`Saving…`:`Save gate`})]})]});return(0,O.jsxs)(`div`,{className:`border-t border-white/[0.06] px-5 py-4`,children:[(0,O.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Completion gates`}),(0,O.jsx)(`p`,{className:`mt-1 text-[10px] text-white/22`,children:`Verification gates must be resolved before completion. User-created gates persist across orchestrator plan revisions.`})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,O.jsxs)(`span`,{className:`text-[10px] text-white/25`,children:[t.filter(e=>e.status===`satisfied`||e.status===`waived`).length,`/`,t.length,` resolved`]}),(0,O.jsx)(`button`,{onClick:()=>h(),className:`rounded-md border border-amber-300/15 px-2 py-1 text-[10px] text-amber-200/55 hover:bg-amber-300/[0.05]`,children:`+ Add gate`})]})]}),u===`new`&&(0,O.jsx)(`div`,{className:`mb-2`,children:y}),!t.length&&u!==`new`&&(0,O.jsx)(`p`,{className:`rounded-lg border border-dashed border-white/8 px-3 py-4 text-center text-[10px] text-white/22`,children:`No completion gates yet. Add one to define a durable requirement.`}),(0,O.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>u===e.id?(0,O.jsx)(`div`,{children:y},e.id):(0,O.jsxs)(`div`,{className:`rounded-lg border border-white/[0.06] bg-black/10 px-3 py-2.5`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`p`,{className:`text-xs font-medium text-white/65`,children:e.label}),e.required&&(0,O.jsx)(`span`,{className:`text-[8px] uppercase tracking-wider text-white/20`,children:`required`}),(0,O.jsx)(`span`,{className:`rounded bg-white/[0.035] px-1.5 py-0.5 text-[8px] uppercase tracking-wider text-white/22`,children:e.source===`user`?`Added by you`:e.source===`template`?`From template`:`Orchestrator`})]}),(0,O.jsx)(`p`,{className:`mt-1 text-[9px] uppercase tracking-wide text-white/22`,children:e.type.replaceAll(`_`,` `)})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[9px] font-medium uppercase ${Sc[e.status]}`,children:e.status}),e.source===`user`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`button`,{onClick:()=>h(e),className:`rounded px-1.5 py-1 text-[9px] text-white/25 hover:bg-white/5 hover:text-white/50`,children:`Edit`}),(0,O.jsx)(`button`,{onClick:()=>void v(e),className:`rounded px-1.5 py-1 text-[9px] text-rose-300/35 hover:bg-rose-300/[0.05] hover:text-rose-200/60`,children:`Remove`})]})]})]}),e.evidence.length>0&&(0,O.jsx)(`ul`,{className:`mt-2 space-y-1 border-t border-white/[0.05] pt-2`,children:e.evidence.map((e,t)=>(0,O.jsxs)(`li`,{className:`text-[10px] text-emerald-100/40`,children:[`✓ `,e]},t))}),e.waiver&&(0,O.jsxs)(`p`,{className:`mt-2 text-[10px] text-white/30`,children:[`Waived: `,e.waiver.reason]}),e.type===`user_approval`&&e.status!==`satisfied`&&e.status!==`waived`&&(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-amber-100/45`,children:`This resolves automatically when you choose Accept & complete.`}),e.type!==`user_approval`&&e.required&&e.status!==`satisfied`&&e.status!==`waived`&&(n===e.id?(0,O.jsx)(`div`,{className:`mt-2`,children:(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:`Required reason…`,className:`min-w-0 flex-1 rounded-md border border-white/10 bg-black/20 px-2 py-1.5 text-[10px] text-white/60 outline-none`}),(0,O.jsx)(`button`,{disabled:!i.trim()||o,onClick:()=>m(e.id),className:`rounded-md bg-slate-600 px-2 py-1.5 text-[10px] text-white disabled:opacity-35`,children:`Confirm waiver`}),(0,O.jsx)(`button`,{onClick:()=>{r(null),a(``)},className:`text-[10px] text-white/25`,children:`Cancel`})]})}):(0,O.jsx)(`button`,{onClick:()=>{r(e.id),l(null)},className:`mt-2 text-[10px] text-white/25 hover:text-white/50`,children:`Waive with reason`}))]},e.id))}),c&&(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:c})]})}function wc(e,t){if(!t)return[`Initial plan: ${e.phases.length} phase${e.phases.length===1?``:`s`}, ${e.progress.totalTasks} task${e.progress.totalTasks===1?``:`s`}`];let n=[],r=e=>new Map(e.phases.flatMap((e,t)=>[[e.id,{label:e.title,status:e.status,description:e.description,order:t,kind:`phase`}],...Kt(e.tasks).map((e,n)=>[e.id,{label:e.title,status:e.status,description:e.description??e.assignment,order:t*1e3+n,kind:`task`}])])),i=r(t),a=r(e);for(let[e,t]of a){let r=i.get(e);r?((r.label!==t.label||r.description!==t.description)&&n.push(`Rescoped ${t.kind}: ${r.label} → ${t.label}`),r.status!==t.status&&n.push(`${t.label}: ${Gt(r.status).toLowerCase()} → ${Gt(t.status).toLowerCase()}`),r.order!==t.order&&n.push(`Reordered ${t.kind}: ${t.label}`)):n.push(`Added ${t.kind}: ${t.label}`)}for(let[e,t]of i)a.has(e)||n.push(`Removed ${t.kind}: ${t.label}`);let o=new Map((t.gates??[]).map(e=>[e.id,e]));for(let t of e.gates??[]){let e=o.get(t.id);e?e.status!==t.status&&n.push(`${t.label}: ${e.status} → ${t.status}`):n.push(`Added gate: ${t.label}`)}return(t.approvalStatus??`proposed`)!==(e.approvalStatus??`proposed`)&&n.push(`Plan approval: ${t.approvalStatus??`proposed`} → ${e.approvalStatus}`),n.length?n:[`Metadata-only revision; no task, phase, or gate changes.`]}function Tc({missionId:e,currentRevision:t}){let[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)([]),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(!1);async function u(){if(n){r(!1);return}if(r(!0),!i.length){l(!0);try{a((await he(e)).revisions)}catch(e){s(e.message)}finally{l(!1)}}}return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`button`,{onClick:u,className:`rounded-full border border-white/8 px-2 py-0.5 text-[9px] uppercase tracking-wider text-white/30 hover:text-white/55`,children:[`Revision `,t,` · `,n?`hide history`:`history`]}),n&&(0,O.jsxs)(`div`,{className:`mt-3 max-h-72 space-y-2 overflow-y-auto rounded-xl border border-white/[0.06] bg-black/15 p-3`,children:[c&&(0,O.jsx)(`p`,{className:`text-xs text-white/25`,children:`Loading revisions…`}),o&&(0,O.jsx)(`p`,{className:`text-xs text-rose-400`,children:o}),i.map((e,t)=>(0,O.jsxs)(`div`,{className:`rounded-lg border border-white/[0.05] bg-white/[0.018] p-3`,children:[(0,O.jsxs)(`div`,{className:`flex justify-between text-[10px]`,children:[(0,O.jsxs)(`span`,{className:`font-medium text-white/50`,children:[`Revision `,e.revision]}),(0,O.jsx)(`span`,{className:`text-white/20`,children:new Date(e.updatedAt).toLocaleString()})]}),(0,O.jsx)(`ul`,{className:`mt-2 space-y-1`,children:wc(e,i[t+1]).map((e,t)=>(0,O.jsxs)(`li`,{className:`text-[10px] leading-relaxed text-white/35`,children:[`• `,e]},t))})]},e.revision))]})]})}function Ec({missionId:e,plan:t,required:n=!1}){let r=t.approvalStatus??`proposed`,i=st(t),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(null);async function p(t){u(!0),f(null);try{await q(e,t,t===`rejected`?s:void 0),o(!1),c(``)}catch(e){f(e.message)}finally{u(!1)}}return i&&r===`proposed`&&!n?null:(0,O.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[9px] font-medium uppercase ${r===`approved`?`bg-emerald-300/10 text-emerald-200/60`:r===`rejected`?`bg-rose-300/10 text-rose-200/65`:`bg-amber-300/10 text-amber-200/60`}`,children:r===`approved`?`Plan approved`:r===`rejected`?`Plan changes requested`:n?`Approval required`:`Optional plan checkpoint`}),r===`proposed`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`text-[10px] text-white/25`,children:n?`Implementation and worker delegation are paused until you approve this plan.`:`Approve the approach before implementation, or let the autonomous mission continue.`}),(0,O.jsx)(`button`,{disabled:l,onClick:()=>p(`approved`),className:`cursor-pointer rounded-md border border-emerald-300/15 px-2 py-1 text-[10px] text-emerald-200/55 hover:bg-emerald-300/[0.06]`,children:l?`Approving…`:`Approve & begin`}),(0,O.jsx)(`button`,{onClick:()=>o(!a),className:`cursor-pointer rounded-md border border-rose-300/15 px-2 py-1 text-[10px] text-rose-200/50 hover:bg-rose-300/[0.05]`,children:`Request changes`})]}),t.approvalReason&&(0,O.jsx)(`span`,{className:`text-[10px] text-white/30`,children:t.approvalReason}),a&&(0,O.jsxs)(`div`,{className:`flex w-full gap-2`,children:[(0,O.jsx)(`input`,{autoFocus:!0,value:s,onChange:e=>c(e.target.value),placeholder:`What should change before implementation?`,className:`min-w-0 flex-1 rounded-md border border-white/10 bg-black/20 px-2 py-1.5 text-[10px] text-white/60 outline-none`}),(0,O.jsx)(`button`,{disabled:!s.trim()||l,onClick:()=>p(`rejected`),className:`cursor-pointer rounded-md bg-rose-500/60 px-2 py-1.5 text-[10px] text-white disabled:opacity-35`,children:`Request plan revision`})]}),d&&(0,O.jsx)(`p`,{className:`w-full text-[10px] text-rose-400`,children:d})]})}function Dc({missionId:e,task:t}){let[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(null);if(t.status===`completed`||t.status===`cancelled`)return null;async function f(n=i){if(n){l(!0),d(null);try{await ge(e,t.id,n,o),r(!1),a(null),s(``)}catch(e){d(e.message)}finally{l(!1)}}}let p=e=>{e===`retry`?(a(e),f(e)):(a(e),s(e===`priority`?`high`:``))},m=[[`retry`,`Retry remaining work`],[`cancel`,`Cancel task / worker`],[`replace_worker`,`Replace worker`],[`reassign`,`Reassign`],[`priority`,`Change priority`]];return(0,O.jsxs)(`div`,{className:`relative ml-auto`,children:[(0,O.jsx)(`button`,{onClick:()=>r(!n),"aria-label":`Task controls for ${t.title}`,className:`rounded-md border border-white/8 px-1.5 py-0.5 text-[10px] text-white/25 hover:text-white/55`,children:`•••`}),n&&(0,O.jsxs)(`div`,{className:`absolute right-0 top-full z-30 mt-1 w-64 rounded-lg border border-white/10 bg-[#18181d] p-1 shadow-2xl`,children:[!i&&m.filter(([e])=>e!==`retry`||t.status===`failed`).map(([e,t])=>(0,O.jsx)(`button`,{disabled:c,onClick:()=>p(e),className:`block w-full rounded-md px-3 py-2 text-left text-xs hover:bg-white/5 ${e===`cancel`?`text-rose-300/60`:`text-white/60`}`,children:t},e)),i&&i!==`retry`&&(0,O.jsxs)(`div`,{className:`p-2`,children:[(0,O.jsx)(`p`,{className:`mb-2 text-[10px] font-medium uppercase tracking-wide text-white/30`,children:m.find(([e])=>e===i)?.[1]}),i===`priority`?(0,O.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),className:`w-full rounded-md border border-white/10 bg-black/30 px-2 py-1.5 text-xs text-white/60`,children:[(0,O.jsx)(`option`,{value:`high`,children:`High`}),(0,O.jsx)(`option`,{value:`normal`,children:`Normal`}),(0,O.jsx)(`option`,{value:`low`,children:`Low`})]}):(0,O.jsx)(`textarea`,{autoFocus:!0,value:o,onChange:e=>s(e.target.value),rows:2,placeholder:i===`reassign`?`New owner or assignment guidance…`:i===`cancel`?`Reason for cancellation…`:`Context for the replacement worker…`,className:`w-full resize-none rounded-md border border-white/10 bg-black/20 p-2 text-xs text-white/60 outline-none placeholder:text-white/20`}),(0,O.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{onClick:()=>{a(null),s(``)},className:`text-[10px] text-white/30`,children:`Back`}),(0,O.jsx)(`button`,{disabled:c||i===`reassign`&&!o.trim(),onClick:()=>f(),className:`rounded-md px-2 py-1.5 text-[10px] text-white disabled:opacity-35 ${i===`cancel`?`bg-rose-500/60`:`bg-violet-500/70`}`,children:c?`Sending…`:i===`cancel`?`Confirm cancel`:`Send control`})]})]}),u&&(0,O.jsx)(`p`,{className:`px-3 py-2 text-[10px] text-rose-400`,children:u})]})]})}function Oc({missionId:e}){let[t,n]=(0,g.useState)(!1),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(null);async function l(){if(r.trim()){o(!0),c(null);try{await _e(e,r),n(!1),i(``)}catch(e){c(e.message)}finally{o(!1)}}}return(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(`button`,{onClick:()=>n(!t),className:`rounded-md border border-white/8 px-2 py-1 text-[10px] text-white/35 hover:text-white/60`,children:`+ Add task`}),t&&(0,O.jsxs)(`div`,{className:`absolute left-0 top-full z-30 mt-1 w-72 rounded-lg border border-white/10 bg-[#18181d] p-3 shadow-2xl`,children:[(0,O.jsx)(`textarea`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),rows:3,placeholder:`Describe the task, outcome, or changed priority…`,className:`w-full resize-none rounded-md border border-white/10 bg-black/20 p-2 text-xs text-white/60 outline-none placeholder:text-white/20`}),(0,O.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{onClick:()=>n(!1),className:`text-[10px] text-white/30`,children:`Cancel`}),(0,O.jsx)(`button`,{disabled:!r.trim()||a,onClick:l,className:`rounded-md bg-violet-500/70 px-2 py-1.5 text-[10px] text-white disabled:opacity-35`,children:a?`Sending…`:`Add through orchestrator`})]}),s&&(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:s})]})]})}var kc={queued:`#64748b`,working:`#fbbf24`,blocked:`#fb7185`,reviewing:`#a78bfa`,completed:`#34d399`,failed:`#ef4444`,cancelled:`#475569`};function Ac(e){return e.phases.flatMap(e=>Kt(e.tasks).map(t=>({id:t.id,title:t.title,status:t.status,dependsOn:t.dependsOn,worker:t.owner??t.workerId,weight:t.weight,phase:e.title})))}function jc({plan:e}){let t=(0,g.useMemo)(()=>Ac(e),[e]),[n,r]=(0,g.useState)(),i=(0,g.useMemo)(()=>{let e=new Map(t.map(e=>[e.id,e])),n=new Map,r=new Set,i=t=>{if(n.has(t))return n.get(t);if(r.has(t))return 0;r.add(t);let a=e.get(t),o=a?.dependsOn.length?1+Math.max(0,...a.dependsOn.filter(t=>e.has(t)).map(i)):0;return r.delete(t),n.set(t,o),o},a=new Map;t.forEach(e=>{let t=i(e.id);a.set(t,[...a.get(t)??[],e])});let o=new Map;[...a].sort(([e],[t])=>e-t).forEach(([e,t])=>t.forEach((t,n)=>o.set(t.id,{x:30+e*230,y:30+n*92})));let s=new Map,c=new Map;[...t].sort((e,t)=>i(e.id)-i(t.id)).forEach(e=>{let t=0;for(let n of e.dependsOn)(s.get(n)??0)>t&&(t=s.get(n),c.set(e.id,n));s.set(e.id,t+Math.max(1,e.weight))});let l=[...t].sort((e,t)=>(s.get(t.id)??0)-(s.get(e.id)??0))[0]?.id,u=new Set;for(;l;)u.add(l),l=c.get(l);return{byId:e,positions:o,critical:u,width:Math.max(480,60+(Math.max(0,...a.keys())+1)*230),height:Math.max(160,60+Math.max(1,...[...a.values()].map(e=>e.length))*92)}},[t]),a=n?i.byId.get(n):void 0;return t.length?(0,O.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,O.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-3 text-[9px] text-white/25`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`text-amber-300`,children:`━`}),` critical path`]}),(0,O.jsx)(`span`,{children:`Click a task for details`})]}),(0,O.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-white/[0.06] bg-black/15`,children:(0,O.jsxs)(`svg`,{width:i.width,height:i.height,role:`img`,"aria-label":`Task dependency graph`,children:[t.flatMap(e=>e.dependsOn.map(t=>{let n=i.positions.get(t),r=i.positions.get(e.id);if(!n||!r)return null;let a=i.critical.has(t)&&i.critical.has(e.id);return(0,O.jsx)(`path`,{d:`M ${n.x+174} ${n.y+26} C ${n.x+202} ${n.y+26}, ${r.x-28} ${r.y+26}, ${r.x} ${r.y+26}`,fill:`none`,stroke:a?`#fbbf24`:`rgba(255,255,255,.12)`,strokeWidth:a?2:1},`${t}:${e.id}`)})),t.map(e=>{let t=i.positions.get(e.id),a=n===e.id;return(0,O.jsxs)(`g`,{transform:`translate(${t.x} ${t.y})`,onClick:()=>r(e.id),className:`cursor-pointer`,children:[(0,O.jsx)(`rect`,{width:`174`,height:`54`,rx:`10`,fill:a?`rgba(255,255,255,.08)`:`#15151a`,stroke:i.critical.has(e.id)?`#fbbf24`:a?`#a78bfa`:`rgba(255,255,255,.1)`}),(0,O.jsx)(`circle`,{cx:`12`,cy:`16`,r:`3`,fill:kc[e.status]}),(0,O.jsx)(`text`,{x:`21`,y:`19`,fill:`rgba(255,255,255,.72)`,fontSize:`11`,children:e.title.length>22?`${e.title.slice(0,21)}…`:e.title}),(0,O.jsxs)(`text`,{x:`12`,y:`39`,fill:`rgba(255,255,255,.25)`,fontSize:`9`,children:[e.worker?`${e.worker} · `:``,Gt(e.status).toLowerCase()]})]},e.id)})]})}),a&&(0,O.jsxs)(`div`,{className:`mt-3 rounded-lg border border-violet-300/10 bg-violet-300/[0.025] px-3 py-2 text-[10px] text-white/40`,children:[(0,O.jsx)(`span`,{className:`font-medium text-white/65`,children:a.title}),` · `,a.phase,` · weight `,a.weight,a.worker?` · ${a.worker}`:``,a.dependsOn.length?` · blocked by ${a.dependsOn.map(e=>i.byId.get(e)?.title??e).join(`, `)}`:` · no dependencies`,i.critical.has(a.id)?` · critical path`:``]})]}):(0,O.jsx)(`p`,{className:`px-5 py-8 text-center text-xs text-white/25`,children:`Add tasks to see their dependency graph.`})}var Mc={queued:`bg-slate-500`,working:`bg-amber-400`,blocked:`bg-rose-400`,reviewing:`bg-violet-400`,completed:`bg-emerald-400`,failed:`bg-red-500`,cancelled:`bg-slate-600`},Nc={queued:`border-l-slate-500/45`,working:`border-l-amber-400/70`,blocked:`border-l-rose-400/70`,reviewing:`border-l-violet-400/70`,completed:`border-l-emerald-400/45`,failed:`border-l-red-500/70`,cancelled:`border-l-slate-600/45`};function Pc({status:e}){return(0,O.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-white/35`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${Mc[e]}`}),Gt(e)]})}function Fc(e){let t=qt(e.tasks).filter(e=>e.status!==`cancelled`),n=t.reduce((e,t)=>e+t.weight,0),r=t.filter(e=>e.status===`completed`).reduce((e,t)=>e+t.weight,0);return{completed:t.filter(e=>e.status===`completed`).length,total:t.length,percent:n?Math.round(r/n*100):void 0}}function Ic(e){if(!e.startedAt)return;let t=e.updatedAt??Date.now(),n=Math.max(0,Math.floor((t-e.startedAt)/6e4));return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function Lc(e){let t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Rc(e,t){return t.get(e)?.title??e}function zc({id:e,lookup:t,indexById:n}){let r=t.get(e),i=r?.status===`completed`||r?.status===`cancelled`,a=n.get(e);return(0,O.jsxs)(`span`,{title:r?.title??e,className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 font-mono text-[9px] ${i?`bg-emerald-300/[0.06] text-emerald-200/45`:`bg-white/[0.05] text-white/45`}`,children:[i?`✓`:`○`,` `,a===void 0?e:`#${a}`]})}function Bc({missionId:e,task:t,lookup:n,indexById:r,compact:i=!1}){let a=Ic(t),o=[...n.values()].filter(e=>e.dependsOn.includes(t.id)),s=t.assignment??t.description,c=t.dependsOn.filter(e=>{let t=n.get(e);return t&&t.status!==`completed`&&t.status!==`cancelled`}).length,l=!!(t.role||a||t.updatedAt||t.branch||t.worktree||t.testState||t.dependsOn.length||o.length||t.changedFiles?.length||t.evidence.length);return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`rounded-lg border border-l-2 px-3 py-2.5 ${Nc[t.status]} ${t.status===`blocked`||t.status===`failed`?`border-rose-400/15 bg-rose-400/[0.025]`:`border-white/[0.06] bg-white/[0.018]`}`,children:[(0,O.jsxs)(`div`,{className:`flex gap-3 ${i?`flex-col`:`items-start justify-between`}`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`p`,{className:`text-xs font-medium ${t.status===`completed`?`text-white/35 line-through`:`text-white/70`}`,children:[(0,O.jsxs)(`span`,{title:`Task ${r.get(t.id)} of ${r.size} (numbered across all phases)`,className:`mr-1.5 font-mono text-[9px] font-normal text-white/25`,children:[`#`,r.get(t.id)]}),t.title]}),s&&(0,O.jsxs)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-white/32`,children:[(0,O.jsx)(`span`,{className:`text-white/20`,children:`Deliverable:`}),` `,s]})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,O.jsx)(Pc,{status:t.status}),(0,O.jsx)(Dc,{missionId:e,task:t})]})]}),(0,O.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-white/30`,children:[t.owner||t.workerId?(0,O.jsxs)(`span`,{className:`text-violet-200/55`,children:[`Owner: `,t.owner??t.workerId]}):(0,O.jsx)(`span`,{children:`Unassigned`}),t.dependsOn.length>0&&(0,O.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1`,children:[t.status!==`completed`&&c>0?`Waiting on ${c} of`:`After`,t.dependsOn.map(e=>(0,O.jsx)(zc,{id:e,lookup:n,indexById:r},e))]}),o.length>0&&(0,O.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1`,children:[`Unblocks →`,o.map(e=>(0,O.jsx)(zc,{id:e.id,lookup:n,indexById:r},e.id))]}),t.updatedAt&&(0,O.jsxs)(`span`,{children:[`Updated `,Lc(t.updatedAt)]})]}),t.status===`blocked`&&(0,O.jsxs)(`div`,{className:`mt-2 rounded-md border border-rose-400/10 bg-rose-400/[0.04] px-2.5 py-2 text-[10px] leading-relaxed`,children:[(0,O.jsx)(`p`,{className:`text-rose-200/65`,children:t.blocker??`This task is blocked.`}),t.unblock&&(0,O.jsxs)(`p`,{className:`mt-1 text-white/35`,children:[`To unblock: `,t.unblock]})]}),l&&(0,O.jsxs)(`details`,{className:`mt-2 border-t border-white/[0.05] pt-2`,children:[(0,O.jsx)(`summary`,{className:`cursor-pointer select-none text-[10px] text-white/25 transition hover:text-white/50`,children:`Operational details`}),(0,O.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[9px] text-white/28`,children:[t.role&&(0,O.jsxs)(`span`,{children:[`Role: `,t.role.replaceAll(`_`,` `)]}),a&&(0,O.jsxs)(`span`,{children:[`Duration: `,a]}),t.branch&&(0,O.jsxs)(`span`,{className:`mono`,children:[`Branch: `,t.branch]}),t.worktree&&(0,O.jsxs)(`span`,{className:`mono truncate`,title:t.worktree,children:[`Worktree: `,t.worktree]}),t.testState&&(0,O.jsxs)(`span`,{className:t.testState===`passed`?`text-emerald-300/50`:t.testState===`failed`?`text-rose-300/55`:``,children:[`Tests: `,t.testState.replaceAll(`_`,` `)]})]}),t.changedFiles?.length?(0,O.jsx)(`div`,{className:`mono mt-2 flex flex-wrap gap-1`,children:t.changedFiles.map(e=>(0,O.jsx)(`span`,{title:e,className:`max-w-56 truncate rounded bg-white/[0.035] px-1.5 py-1 text-[9px] text-white/30`,children:e},e))}):null,t.evidence.length>0&&(0,O.jsx)(`ul`,{className:`mt-2 space-y-1`,children:t.evidence.map((e,t)=>(0,O.jsxs)(`li`,{className:`text-[10px] text-emerald-100/45`,children:[`✓ `,e]},t))})]})]}),t.subtasks?.length?(0,O.jsx)(`div`,{className:`ml-4 mt-1 space-y-1 border-l border-white/[0.07] pl-3`,children:t.subtasks.map(t=>(0,O.jsx)(Bc,{missionId:e,task:t,lookup:n,indexById:r,compact:i},t.id))}):null]})}function $({title:e,tone:t,empty:n,tasks:r,lookup:i}){return(0,O.jsxs)(`div`,{className:`min-w-0 rounded-xl border p-3 ${{amber:`border-amber-300/10 bg-amber-300/[0.025] text-amber-200/60`,violet:`border-violet-300/10 bg-violet-300/[0.025] text-violet-200/60`,rose:`border-rose-300/10 bg-rose-300/[0.025] text-rose-200/65`}[t]}`,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.16em]`,children:e}),r.length?(0,O.jsx)(`ul`,{className:`mt-2 space-y-2`,children:r.slice(0,3).map(e=>(0,O.jsxs)(`li`,{className:`text-[11px] leading-snug text-white/60`,children:[(0,O.jsx)(`span`,{className:`font-medium text-white/75`,children:e.title}),(e.owner||e.workerId)&&(0,O.jsx)(`span`,{className:`block text-[9px] text-white/28`,children:e.owner??e.workerId}),t===`rose`&&(0,O.jsx)(`span`,{className:`block text-[9px] text-rose-200/45`,children:e.blocker??(e.status===`failed`?`Task failed`:e.dependsOn.length?`Waiting for ${e.dependsOn.map(e=>Rc(e,i)).join(`, `)}`:`Needs intervention`)})]},e.id))}):(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-white/25`,children:n}),r.length>3&&(0,O.jsxs)(`p`,{className:`mt-2 text-[9px] text-white/20`,children:[`+`,r.length-3,` more`]})]})}function Vc({missionId:e,plan:t,objective:n,missionAcceptanceCriteria:r=[],workers:i=[],missionUpdatedAt:a,compact:o=!1,approvalRequired:s=!1}){let[c,l]=(0,g.useState)(()=>new Set(t?.phases.filter(e=>e.status===`completed`||e.status===`queued`).map(e=>e.id)??[])),[u,d]=(0,g.useState)(`plan`),f=(0,g.useMemo)(()=>Jt(t),[t]),p=(0,g.useMemo)(()=>new Map(f.map(e=>[e.id,e])),[f]),m=(0,g.useMemo)(()=>new Map(f.map((e,t)=>[e.id,t+1])),[f]);if(!t)return(0,O.jsxs)(`section`,{className:`mb-6 overflow-hidden rounded-2xl border border-dashed border-white/10 bg-white/[0.018]`,children:[(0,O.jsx)(`div`,{className:`px-5 py-5`,children:(0,O.jsxs)(`div`,{className:`flex gap-4 ${o?`flex-col items-start`:`items-center justify-between`}`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white/75`,children:`Mission plan`}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-white/30`,children:`Waiting for the orchestrator to publish a structured plan.`}),n&&(0,O.jsxs)(`p`,{className:`mt-3 text-sm leading-relaxed text-white/55`,children:[(0,O.jsx)(`span`,{className:`text-white/25`,children:`Goal:`}),` `,n]})]}),(0,O.jsx)(`span`,{className:`rounded-full bg-white/[0.04] px-2.5 py-1 text-[10px] uppercase tracking-wider text-white/25`,children:`Not published`})]})}),(0,O.jsx)(Cc,{missionId:e,gates:[]})]});let h=t.phases.find(e=>e.status===`working`||e.status===`reviewing`||e.status===`blocked`),_=t.phases.find(e=>e.status===`queued`),v=f.filter(e=>e.status===`working`||e.status===`reviewing`),y=f.filter(e=>e.status===`queued`&&e.dependsOn.every(e=>p.get(e)?.status===`completed`)),b=f.filter(e=>e.status===`blocked`||e.status===`failed`),x=t.phases.filter(e=>e.status===`completed`).length,S=(t.gates??[]).filter(e=>e.status===`satisfied`||e.status===`waived`).length,C=i.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)),w=v.flatMap(e=>[e.workerId,e.owner,e.id].filter(Boolean)),T=C.filter(e=>!w.some(t=>vn(t,e))&&!w.includes(e.jobId)),E=C.length>0&&a&&a>t.updatedAt+3e5,D=T.length>0?`${T.length} active worker${T.length===1?` is`:`s are`} doing work this plan does not describe.`:E?`Mission activity is newer than this plan; a revision may be needed.`:void 0,k=f.flatMap(e=>e.evidence.map(t=>({task:e.title,item:t}))).slice(-5).reverse();return(0,O.jsxs)(`section`,{className:`mb-6 overflow-hidden rounded-2xl border border-white/10 bg-[#101014]`,children:[(0,O.jsxs)(`div`,{className:`border-b border-white/8 px-5 py-4`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Plan at a glance`}),(0,O.jsx)(Tc,{missionId:e,currentRevision:t.revision}),(0,O.jsx)(Oc,{missionId:e})]}),(0,O.jsxs)(`p`,{className:`mt-3 max-w-4xl text-sm leading-relaxed text-white/65`,children:[(0,O.jsx)(`span`,{className:`mr-2 text-[10px] font-semibold uppercase tracking-wider text-amber-200/45`,children:`Goal`}),n??`No mission objective has been recorded.`]}),(0,O.jsx)(Ec,{missionId:e,plan:t,required:s})]}),(0,O.jsxs)(`div`,{className:`shrink-0 text-right`,children:[(0,O.jsxs)(`p`,{className:`text-2xl font-semibold text-amber-300`,children:[t.progress.percent??`—`,t.progress.percent!==void 0&&`%`]}),(0,O.jsx)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/25`,children:`weighted progress`})]})]}),(0,O.jsx)(`div`,{className:`mt-4 h-1.5 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,O.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-amber-400 to-violet-400 transition-all`,style:{width:`${t.progress.percent??0}%`}})}),(0,O.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-white/30`,children:[(0,O.jsxs)(`span`,{children:[t.progress.completedTasks,`/`,t.progress.totalTasks,` tasks`]}),(0,O.jsxs)(`span`,{children:[x,`/`,t.phases.length,` phases`]}),(0,O.jsxs)(`span`,{children:[S,`/`,t.gates?.length??0,` gates`]}),(0,O.jsxs)(`span`,{children:[`Current: `,h?.title??(t.progress.percent===100?`Complete`:`None active`)]}),(0,O.jsxs)(`span`,{children:[`Next: `,_?.milestone??_?.title??`Not scheduled`]})]}),(0,O.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[10px] text-white/25`,children:[(0,O.jsxs)(`span`,{children:[`Updated `,Lc(t.updatedAt)]}),(0,O.jsx)(`span`,{children:`·`}),(0,O.jsxs)(`span`,{children:[`Revision `,t.revision]}),D&&(0,O.jsxs)(`span`,{className:`rounded-md border border-amber-300/10 bg-amber-300/[0.04] px-2 py-1 text-amber-100/50`,children:[`⚠ `,D]})]}),(0,O.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/[0.06] bg-black/15 p-0.5`,children:[[`plan`,`Plan`],[`dependencies`,`Dependencies`]].map(([e,t])=>(0,O.jsx)(`button`,{onClick:()=>d(e),className:`cursor-pointer rounded-md px-2.5 py-1 text-[9px] font-medium uppercase tracking-wider transition ${u===e?`bg-white/[0.08] text-white/65`:`text-white/25 hover:bg-white/[0.03] hover:text-white/45`}`,children:t},e))})]})]}),(0,O.jsxs)(`div`,{className:`grid gap-2 border-b border-white/[0.06] p-4 ${o?``:`md:grid-cols-3`}`,children:[(0,O.jsx)($,{title:`Now`,tone:`amber`,tasks:v,empty:`No task is actively running.`,lookup:p}),(0,O.jsx)($,{title:`Next`,tone:`violet`,tasks:y,empty:t.progress.percent===100?`All planned work is complete.`:`No unblocked task is queued.`,lookup:p}),(0,O.jsx)($,{title:`Needs attention`,tone:`rose`,tasks:b,empty:`No blockers or failed tasks.`,lookup:p})]}),u===`dependencies`&&(0,O.jsx)(jc,{plan:t}),u===`plan`&&(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-white/[0.06] px-5 pt-4 pb-2`,children:[(0,O.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/35`,children:t.layout===`flat`?`Tasks`:`Phases`}),(0,O.jsx)(`p`,{className:`text-[9px] text-white/20`,children:t.layout===`flat`?`${f.length} task${f.length===1?``:`s`}`:`${t.phases.length} phase${t.phases.length===1?``:`s`} · tasks numbered #1–#${f.length} across all phases`})]}),u===`plan`&&(0,O.jsx)(`div`,{className:`divide-y divide-white/[0.06]`,children:t.phases.map((n,r)=>{let i=c.has(n.id),a=Fc(n);return t.layout===`flat`?(0,O.jsxs)(`div`,{className:`space-y-1 px-5 py-4`,children:[n.tasks.map(t=>(0,O.jsx)(Bc,{missionId:e,task:t,lookup:p,indexById:m,compact:o},t.id)),n.tasks.length===0&&(0,O.jsx)(`p`,{className:`py-2 text-xs text-white/25`,children:`No tasks yet.`})]},n.id):(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`button`,{onClick:()=>l(e=>{let t=new Set(e);return t.has(n.id)?t.delete(n.id):t.add(n.id),t}),className:`flex w-full cursor-pointer items-center justify-between gap-4 px-5 py-3.5 text-left transition hover:bg-white/[0.025]`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,O.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-amber-300/[0.07] text-[10px] font-semibold text-amber-200/60`,children:r+1}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`p`,{className:`truncate text-sm font-medium text-white/80`,children:n.title}),n.milestone&&(0,O.jsxs)(`span`,{className:`truncate rounded-full border border-amber-300/10 bg-amber-300/[0.04] px-2 py-0.5 text-[9px] text-amber-200/45`,children:[`◆ `,n.milestone]})]}),(0,O.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`h-1 w-20 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,O.jsx)(`div`,{className:`h-full rounded-full bg-amber-300/60`,style:{width:`${a.percent??0}%`}})}),(0,O.jsxs)(`p`,{className:`text-[10px] text-white/25`,children:[a.completed,`/`,a.total,` tasks`,a.percent===void 0?``:` · ${a.percent}%`]})]})]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(Pc,{status:n.status}),(0,O.jsx)(`span`,{className:`text-xs text-white/25`,children:i?`+`:`−`})]})]}),!i&&(0,O.jsxs)(`div`,{className:o?`px-4 pb-4`:`px-5 pb-4 pl-14`,children:[n.description&&(0,O.jsx)(`p`,{className:`mb-3 text-xs leading-relaxed text-white/40`,children:n.description}),n.acceptanceCriteria.length>0&&(0,O.jsxs)(`div`,{className:`mb-3 rounded-lg border border-emerald-300/10 bg-emerald-300/[0.02] p-3`,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-wider text-emerald-200/45`,children:`Definition of done`}),(0,O.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:n.acceptanceCriteria.map((e,t)=>(0,O.jsxs)(`li`,{className:`flex gap-2 text-[10px] leading-relaxed text-white/45`,children:[(0,O.jsx)(`span`,{className:n.status===`completed`?`text-emerald-300/70`:`text-white/20`,children:n.status===`completed`?`✓`:`○`}),e]},t))})]}),(0,O.jsxs)(`div`,{className:`space-y-1`,children:[n.tasks.map(t=>(0,O.jsx)(Bc,{missionId:e,task:t,lookup:p,indexById:m,compact:o},t.id)),n.tasks.length===0&&(0,O.jsx)(`p`,{className:`py-2 text-xs text-white/25`,children:`No tasks in this phase.`})]})]})]},n.id)})}),r.length>0&&(0,O.jsxs)(`div`,{className:`border-t border-white/[0.06] px-5 py-4`,children:[(0,O.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/35`,children:`Mission acceptance criteria`}),(0,O.jsx)(`ul`,{className:`mt-2 grid gap-1.5 ${o?``:`sm:grid-cols-2`}`,children:r.map((e,t)=>(0,O.jsxs)(`li`,{className:`flex gap-2 text-[11px] text-white/45`,children:[(0,O.jsx)(`span`,{className:`text-amber-200/40`,children:`◇`}),e]},t))})]}),(0,O.jsx)(Cc,{missionId:e,gates:t.gates??[]}),k.length>0&&(0,O.jsxs)(`div`,{className:`border-t border-white/[0.06] px-5 py-4`,children:[(0,O.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,O.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-emerald-300/50`,children:`Recent evidence`}),(0,O.jsx)(`span`,{className:`text-[9px] text-white/20`,children:`Reported by the plan`})]}),(0,O.jsx)(`ul`,{className:`space-y-1.5`,children:k.map(({task:e,item:t},n)=>(0,O.jsxs)(`li`,{className:`flex gap-2 text-[11px] leading-relaxed text-white/45`,children:[(0,O.jsx)(`span`,{className:`text-emerald-400/70`,children:`✓`}),(0,O.jsxs)(`span`,{children:[(0,O.jsxs)(`span`,{className:`text-white/25`,children:[e,`:`]}),` `,t]})]},`${e}:${t}:${n}`))})]})]})}var Hc=`[data-mission-composer]`;function Uc(){if(typeof document>`u`)return!1;let e=document.querySelector(Hc);return e?(e.focus(),e.setSelectionRange?.(e.value.length,e.value.length),e.scrollIntoView?.({block:`nearest`}),!0):!1}var Wc={g:`top`,c:`conversation`,w:`now`,p:`plan`,d:`diagnostics`};function Gc(e){(0,g.useEffect)(()=>{let{enabled:t,onAffirm:n,onDecline:r,onPauseToggle:i,onShowHelp:a,onGoTo:o,onStepMission:s,onStepNeedsYou:c}=e;if(!t||typeof window>`u`)return;let l,u=()=>{l&&clearTimeout(l),l=void 0},d=e=>{if(e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||yt(e.target))return;if((e.key===`H`||e.key===`L`)&&e.shiftKey){if(!c)return;e.preventDefault(),u(),c(e.key===`L`?1:-1);return}if(e.key===`?`){if(u(),!a)return;e.preventDefault(),a();return}let t=e.key.toLowerCase();if(l){u();let n=Wc[t];n&&o&&(e.preventDefault(),o(n));return}if(t===`g`){if(!o)return;e.preventDefault(),l=setTimeout(u,1200);return}if(t===`r`){e.preventDefault(),Uc();return}let d={a:n,d:r,p:i}[t];if(d){e.preventDefault(),d();return}if(di.has(t)||ui.has(t)){e.preventDefault(),window.scrollBy?.({top:di.has(t)?160:-160});return}let f=ci.has(t);!f&&!li.has(t)||s&&(e.preventDefault(),s(f?-1:1))};return window.addEventListener(`keydown`,d),()=>{u(),window.removeEventListener(`keydown`,d)}},[e])}function Kc(e){return e.filter(e=>e.lifecycleStatus===`active`||e.lifecycleStatus===`ready_for_review`||e.lifecycleStatus===`paused`||e.lifecycleStatus===`failed`).map(e=>e.missionId)}function qc(e,t,n){let r=e.indexOf(t);if(!(r===-1||e.length<2))return e[(r+n+e.length)%e.length]}function Jc(e,t,n){if(!e.length)return;let r=e.indexOf(t);if(r===-1)return n===1?e[0]:e[e.length-1];if(!(e.length<2))return e[(r+n+e.length)%e.length]}function Yc(e){let t=new Set;return e.map(e=>e.missionId).filter(e=>!t.has(e)&&t.add(e))}function Xc(e){let t=e.plan?.phases.flatMap(e=>e.tasks).flatMap(function e(t){return[...t.changedFiles??[],...(t.subtasks??[]).flatMap(e)]})??[],n=e.recentEvents.filter(e=>e.activityKind===`file_write`).map(e=>e.filePath).filter(e=>!!e),r=e.recentEvents.filter(e=>e.activityKind===`test`).map(e=>({label:e.command??e.detail,passed:e.outcome!==`failure`})),i=e.recentEvents.filter(e=>e.activityKind===`output`).map(e=>e.artifactPath??e.detail).filter(Boolean),a=e.plan?.gates??[];return{files:[...new Set([...t,...n])],tests:[...new Map(r.map(e=>[e.label,e])).values()],outputs:[...new Set(i)],unresolvedGates:a.filter(e=>e.required&&e.status!==`satisfied`&&e.status!==`waived`).map(e=>e.label),resolvedGates:a.filter(e=>e.status===`satisfied`||e.status===`waived`).map(e=>`${e.label} · ${e.status}`),criteria:[...new Set(e.plan?.phases.flatMap(e=>e.acceptanceCriteria??[])??[])],commits:[...new Set(e.recentEvents.map(e=>e.detail.match(/\b[0-9a-f]{7,40}\b/i)?.[0]).filter(e=>!!e))],work:e.plan?.phases.flatMap(e=>e.tasks).filter(e=>e.status===`completed`).map(e=>`${e.title}${e.evidence?.length?` — ${e.evidence.join(`; `)}`:``}`)??[],reviewNotes:e.recentEvents.filter(e=>e.phase===`plan_updated`||e.phase===`reviewing`||e.phase===`worker_reported`).map(e=>e.detail).filter(Boolean)}}function Zc({title:e,items:t,empty:n,sourceHref:r}){return(0,O.jsxs)(`section`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/25`,children:e}),r&&t.length>0&&(0,O.jsx)(`a`,{href:r,className:`text-[9px] text-sky-200/40 hover:text-sky-100/70`,children:`Inspect source`})]}),t.length?(0,O.jsx)(`ul`,{className:`mt-2 space-y-1`,children:t.slice(0,12).map(e=>(0,O.jsxs)(`li`,{className:`break-words text-[11px] leading-relaxed text-white/50`,children:[`• `,e]},e))}):(0,O.jsx)(`p`,{className:`mt-2 text-[11px] text-white/22`,children:n}),t.length>12&&(0,O.jsxs)(`p`,{className:`mt-1 text-[9px] text-white/20`,children:[`+`,t.length-12,` more`]})]})}function Qc({node:e,compact:t=!1,showPrimaryActions:n=!0}){let r=(0,g.useMemo)(()=>Xc(e),[e]),[i,a]=(0,g.useState)(()=>Date.now()),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(``),[m,h]=(0,g.useState)();(0,g.useEffect)(()=>{let t=!0;return Te(e.missionId).then(e=>{t&&h(e)}).catch(e=>{t&&h({available:!1,stat:``,patch:``,files:[],truncated:!1,error:e.message})}),()=>{t=!1}},[e.missionId,e.updatedAt]);let _=e.updatedAt>i,v=r.tests.filter(e=>!e.passed),y=e.lifecycleStatus===`ready_for_review`&&!r.unresolvedGates.length&&!v.length&&!_,b=async()=>{s(!0),l(void 0);try{await G(e.missionId,`completed`)}catch(e){l(e.message)}finally{s(!1)}},x=async()=>{let t=u.trim();if(!t){Uc();return}s(!0),l(void 0);try{await G(e.missionId,`active`),await W(e.missionId,`Review changes requested: ${t}`),d(``)}catch(e){l(e.message)}finally{s(!1)}},S=async()=>{let t=f.trim();if(t){s(!0),l(void 0);try{await K(e.missionId,{label:t,type:`custom`,required:!0}),p(``)}catch(e){l(e.message)}finally{s(!1)}}};return(0,O.jsxs)(`section`,{className:`rounded-2xl border border-amber-300/15 bg-amber-300/[0.025] ${t?`p-3`:`p-5`}`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.16em] text-amber-200/45`,children:`Review packet`}),(0,O.jsx)(`h2`,{className:`mt-1 text-sm font-semibold text-white/80`,children:`Evidence for acceptance`}),(0,O.jsx)(`p`,{className:`mt-1 text-[11px] text-white/30`,children:`Observed changes and verification, not only the manager's completion claim.`})]}),(0,O.jsx)(`span`,{className:`rounded-full border px-2 py-1 text-[9px] ${y?`border-emerald-300/20 text-emerald-200/65`:`border-amber-300/20 text-amber-100/60`}`,children:y?`Ready to accept`:_?`Updated while open`:`Review required`})]}),_&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>a(Date.now()),className:`mt-3 w-full rounded-lg border border-sky-300/15 bg-sky-300/[0.04] px-3 py-2 text-left text-[10px] text-sky-100/60`,children:`New mission evidence arrived. Review the latest packet, then mark it reviewed.`}),(0,O.jsxs)(`div`,{className:`mt-4 rounded-xl border border-white/[0.06] bg-black/10 p-3`,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/25`,children:`Requested outcome`}),(0,O.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-white/60`,children:e.mission.objective||e.intent||`No explicit outcome was recorded.`}),r.criteria.length>0&&(0,O.jsx)(`ul`,{className:`mt-2 space-y-1`,children:r.criteria.map(e=>(0,O.jsxs)(`li`,{className:`text-[10px] text-white/38`,children:[`✓ `,e]},e))})]}),(0,O.jsxs)(`div`,{className:`mt-4 grid gap-4 ${t?`grid-cols-1`:`md:grid-cols-2 xl:grid-cols-4`}`,children:[(0,O.jsx)(Zc,{title:`Changed files`,items:r.files,empty:`No file writes were observed.`,sourceHref:`#mission-now`}),(0,O.jsx)(Zc,{title:`Verification`,items:r.tests.map(e=>`${e.passed?`✓`:`✕`} ${e.label}`),empty:`No test or verification command was observed.`,sourceHref:`#mission-now`}),(0,O.jsx)(Zc,{title:`Completion gates`,items:[...r.resolvedGates.map(e=>`✓ ${e}`),...r.unresolvedGates.map(e=>`○ ${e}`)],empty:`No completion gates were published.`,sourceHref:`#mission-plan`}),(0,O.jsx)(Zc,{title:`Outputs and risks`,items:[...e.prs.map(e=>`${e.kind}: ${e.href}`),...r.outputs,...e.alerts.map(e=>`${e.title}: ${e.explanation}`)],empty:`No outputs or current risks were reported.`,sourceHref:`#mission-now`})]}),!t&&(0,O.jsxs)(`div`,{className:`mt-4 grid gap-3 border-t border-white/[0.06] pt-3 md:grid-cols-3`,children:[(0,O.jsx)(Zc,{title:`Implementation summary`,items:r.work,empty:`No completed task evidence was published.`,sourceHref:`#mission-plan`}),(0,O.jsx)(Zc,{title:`Plan changes and review`,items:r.reviewNotes,empty:`No plan deviations or review findings were reported.`,sourceHref:`#mission-now`}),(0,O.jsx)(Zc,{title:`Source control`,items:[e.worktreeBranch&&`Branch: ${e.worktreeBranch}`,e.worktreePath&&`Worktree: ${e.worktreePath}`,...r.commits.map(e=>`Commit: ${e}`)].filter(e=>!!e),empty:`No branch, worktree, or commit evidence was observed.`})]}),!t&&(0,O.jsxs)(`section`,{className:`mt-4 border-t border-white/[0.06] pt-3`,children:[(0,O.jsx)(`h3`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/25`,children:`Inspectable diff`}),m===void 0?(0,O.jsx)(`p`,{className:`mt-2 text-[11px] text-white/25`,children:`Loading source-control evidence…`}):m.available?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`pre`,{className:`mono mt-2 max-h-28 overflow-auto whitespace-pre-wrap rounded-lg border border-white/[0.06] bg-black/20 p-2 text-[10px] text-white/45`,children:m.stat||`No committed or working-tree changes relative to the base branch.`}),(0,O.jsxs)(`details`,{className:`mt-2 rounded-lg border border-white/[0.06] bg-black/20`,children:[(0,O.jsxs)(`summary`,{className:`cursor-pointer px-3 py-2 text-[10px] text-white/40`,children:[`Inspect patch`,m.files.length?` · ${m.files.length} files`:``]}),(0,O.jsx)(`pre`,{className:`mono max-h-96 overflow-auto whitespace-pre-wrap break-words border-t border-white/[0.05] p-3 text-[9px] leading-relaxed text-white/40`,children:m.patch||`No textual patch available.`}),m.truncated&&(0,O.jsx)(`p`,{className:`border-t border-amber-300/10 px-3 py-2 text-[9px] text-amber-100/50`,children:`Patch truncated at 200 KB. Open the worktree for the complete diff.`})]})]}):(0,O.jsxs)(`p`,{className:`mt-2 text-[11px] text-amber-100/45`,children:[`Diff unavailable: `,m.error]})]}),(0,O.jsxs)(`div`,{className:`mt-4 grid gap-2 border-t border-white/[0.06] pt-3 ${n?`sm:grid-cols-2`:`grid-cols-1`}`,children:[n&&(0,O.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,O.jsx)(`input`,{"aria-label":`Requested review changes`,value:u,onChange:e=>d(e.target.value),placeholder:`Describe required changes…`,className:`min-w-0 flex-1 rounded-lg border border-white/10 bg-black/15 px-2.5 py-1.5 text-[11px] text-white/65 outline-none`}),(0,O.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>void x(),className:`rounded-lg border border-white/10 px-3 py-1.5 text-[11px] text-white/50 hover:text-white/75`,children:`Request changes`})]}),(0,O.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,O.jsx)(`input`,{"aria-label":`New completion gate`,value:f,onChange:e=>p(e.target.value),placeholder:`Add required gate…`,className:`min-w-0 flex-1 rounded-lg border border-white/10 bg-black/15 px-2.5 py-1.5 text-[11px] text-white/65 outline-none`}),(0,O.jsx)(`button`,{type:`button`,disabled:o||!f.trim(),onClick:()=>void S(),className:`rounded-lg border border-white/10 px-3 py-1.5 text-[11px] text-white/50`,children:`Add gate`})]})]}),r.unresolvedGates.length>0&&(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.plan?.gates.filter(e=>e.required&&e.status!==`satisfied`&&e.status!==`waived`).map(t=>(0,O.jsxs)(`button`,{type:`button`,disabled:o,onClick:()=>{let n=window.prompt(`Reason for waiving “${t.label}”`);n?.trim()&&fe(e.missionId,t.id,n.trim())},className:`rounded border border-amber-300/15 px-2 py-1 text-[9px] text-amber-100/50`,children:[`Waive `,t.label,`…`]},t.id))}),(0,O.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-end gap-2`,children:[(0,O.jsx)(`a`,{href:we(e.missionId,`markdown`),target:`_blank`,rel:`noopener noreferrer`,className:`rounded-lg border border-white/10 px-3 py-1.5 text-[11px] text-white/50`,children:`Open full evidence ↗`}),(0,O.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>void de(e.missionId,`test_pass`),className:`rounded-lg border border-white/10 px-3 py-1.5 text-[11px] text-white/50`,children:`Run fresh verification`}),_&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>a(Date.now()),className:`rounded-lg border border-sky-300/15 px-3 py-1.5 text-[11px] text-sky-100/60`,children:`Mark latest reviewed`}),n&&(0,O.jsx)(`button`,{type:`button`,disabled:!y||o,onClick:()=>void b(),title:r.unresolvedGates.length?`Unresolved gates: ${r.unresolvedGates.join(`, `)}`:v.length?`Verification failures remain`:_?`Review the new evidence first`:void 0,className:`rounded-lg bg-emerald-400/80 px-3 py-1.5 text-[11px] font-semibold text-[#07150f] disabled:cursor-not-allowed disabled:opacity-30`,children:o?`Working…`:`Accept & complete`})]}),c&&(0,O.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-300`,children:c})]})}var $c={conversation:`mission-conversation`,plan:`mission-plan`,now:`mission-now`,diagnostics:`mission-diagnostics`,top:`mission-top`};function el(e){if(!(typeof document>`u`)){if(e===`top`){window.scrollTo?.({top:0,behavior:`smooth`});return}document.getElementById($c[e])?.scrollIntoView?.({behavior:`smooth`,block:`start`})}}function tl({node:e,decisions:t,defaultModelLabel:n,elapsedMs:r,onSelectWorker:i,onOpenDecisions:a}){return(0,O.jsxs)(`div`,{className:`flex flex-col`,children:[(0,O.jsx)(Xn,{className:`mb-4`,plan:e.plan,waitingFor:e.waitingFor,blocked:e.lifecycleStatus===`active`&&e.activityStatus===`waiting_on_you`}),e.lifecycleStatus===`ready_for_review`&&(0,O.jsx)(`div`,{className:`mb-5`,children:(0,O.jsx)(Qc,{node:e,showPrimaryActions:!1})}),(0,O.jsxs)(`div`,{className:`grid items-start gap-5 xl:grid-cols-[300px_minmax(0,1fr)_340px]`,children:[(0,O.jsx)(xc,{node:e,defaultModelLabel:n,elapsedMs:r}),(0,O.jsx)(`div`,{id:$c.conversation,className:`flex min-w-0 flex-col xl:h-[calc(100vh-19rem)] xl:min-h-[520px]`,children:(0,O.jsx)(Rs,{missionId:e.missionId,repository:e.mission.repository,provider:e.mission.provider,messages:e.messages,events:e.recentEvents,hasMoreMessages:e.hasMoreMessages,contained:!0,onOpenDecisions:t.length?a:void 0,live:{status:e.activityStatus,lifecycle:e.lifecycleStatus,detail:e.detail,waitingFor:e.waitingFor,plan:e.plan,workers:e.workers,inFlight:e.inFlight,prs:e.prs}})}),(0,O.jsx)(`div`,{id:$c.now,className:`min-w-0 xl:max-h-[calc(100vh-19rem)] xl:overflow-y-auto xl:pr-1`,children:(0,O.jsx)(fc,{node:e,events:e.recentEvents,onSelectWorker:i})})]}),(0,O.jsxs)(`div`,{id:$c.plan,className:`mt-5 flex flex-col gap-5 scroll-mt-24`,children:[(0,O.jsx)(Vc,{missionId:e.missionId,plan:e.plan,objective:e.mission.objective,missionAcceptanceCriteria:e.mission.acceptanceCriteria,workers:e.workers,missionUpdatedAt:e.updatedAt,approvalRequired:e.mission.planFirst}),(0,O.jsx)(hc,{messages:e.messages,plan:e.plan})]}),(0,O.jsx)(Ws,{node:e})]})}function nl(e,t){let n=[],r=lt(e.plan);r&&n.push({label:`Phase ${r.index} of ${r.total}`,value:`${r.completed}/${r.tasks} tasks`,ratio:{done:r.completed,total:r.tasks},hint:r.title});let i=ut(e.plan);if(i){let e=i.satisfied===i.required;n.push({label:`Gates cleared`,value:`${i.satisfied}/${i.required}`,ratio:{done:i.satisfied,total:i.required},accent:e?`emerald`:void 0})}let a=rt(e.plan);a&&n.push({label:`Files changed`,value:`${a}`});let o=e.workers.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)).length;e.workers.length&&n.push({label:`Workers`,value:o?`${o} of ${e.workers.length} live`:`${e.workers.length} done`,accent:o?`amber`:void 0});let s=e.status===`working`?t:e.updatedAt;return n.push({label:`This turn`,value:zn(Math.max(0,s-e.runStartedAt))}),n.push({label:`Tokens`,value:Vn(e.tokens)}),n}var rl={amber:`text-amber-300/90`,emerald:`text-emerald-300/85`},il={amber:`bg-amber-300/60`,emerald:`bg-emerald-300/60`};function al({node:e,now:t}){let n=nl(e,t);return(0,O.jsx)(`div`,{className:`mb-5 flex flex-wrap gap-2.5`,children:n.map(e=>(0,O.jsxs)(`div`,{className:`min-w-0 max-w-[260px] flex-1 basis-40 rounded-xl border border-white/[0.07] bg-white/[0.022] px-3.5 py-2.5`,title:e.hint,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold tabular-nums ${e.accent?rl[e.accent]:`text-white/85`}`,children:e.value}),(0,O.jsx)(`p`,{className:`mt-0.5 truncate text-[9px] font-medium uppercase tracking-wider text-white/25`,children:e.label}),e.ratio&&e.ratio.total>0&&(0,O.jsx)(`div`,{className:`mt-1.5 h-0.5 w-full overflow-hidden rounded-full bg-white/[0.07]`,children:(0,O.jsx)(`div`,{className:`h-full rounded-full ${e.accent?il[e.accent]:`bg-white/25`}`,style:{width:`${Math.round(e.ratio.done/e.ratio.total*100)}%`}})})]},e.label))})}function ol({position:e,total:t,onStep:n}){if(t<2)return null;let r=`cursor-pointer rounded-md px-1.5 py-1 text-xs text-white/35 transition hover:bg-white/[0.05] hover:text-white/75`;return(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 border-l border-white/[0.07] pl-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>n(-1),title:`Previous mission (h)`,"aria-label":`Previous mission`,className:r,children:`‹`}),(0,O.jsxs)(`span`,{className:`mono px-0.5 text-[10px] tabular-nums text-white/25`,children:[e,`/`,t]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>n(1),title:`Next mission (l)`,"aria-label":`Next mission`,className:r,children:`›`})]})}function sl({affirm:e,decline:t}){return!e&&!t?null:(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[e&&(0,O.jsxs)(`button`,{type:`button`,onClick:e.run,className:`cursor-pointer rounded-lg border border-amber-200/30 bg-amber-200/[0.1] px-2.5 py-1.5 text-[11px] font-medium text-amber-100/90 transition hover:bg-amber-200/[0.16]`,children:[e.label,` `,(0,O.jsx)(`kbd`,{className:`mono ml-1 text-[9px] text-amber-100/45`,children:`a`})]}),t&&(0,O.jsxs)(`button`,{type:`button`,onClick:t.run,className:`cursor-pointer rounded-lg border border-white/12 px-2.5 py-1.5 text-[11px] text-white/55 transition hover:border-white/25 hover:text-white/85`,children:[t.label,` `,(0,O.jsx)(`kbd`,{className:`mono ml-1 text-[9px] text-white/30`,children:`d`})]})]})}var cl=`hive:office-preferences`,ll={version:2,fleetPresentation:`cards`,missionPresentation:`details`,fleetDensity:`comfortable`,fleetSort:`attention`,motion:`system`,dialogue:`work_personality`,selectedFloor:0,roomAssignments:{},workerSeatAssignments:{}},ul=[`comfortable`,`compact`],dl=[`attention`,`recent`,`longest`,`workers`,`repository`];function fl(e){if(!e)return ll;try{let t=JSON.parse(e);if(t.version!==1&&t.version!==2||t.fleetPresentation!==`cards`&&t.fleetPresentation!==`office`)return ll;let n=t.roomAssignments&&typeof t.roomAssignments==`object`&&!Array.isArray(t.roomAssignments)?Object.fromEntries(Object.entries(t.roomAssignments).filter(e=>typeof e[1]==`string`)):{},r=t.workerSeatAssignments&&typeof t.workerSeatAssignments==`object`&&!Array.isArray(t.workerSeatAssignments)?Object.fromEntries(Object.entries(t.workerSeatAssignments).filter(e=>Number.isInteger(e[1])&&Number(e[1])>=0)):{};return{version:2,fleetPresentation:t.fleetPresentation,missionPresentation:t.missionPresentation===`room`?`room`:`details`,fleetDensity:ul.includes(t.fleetDensity)?t.fleetDensity:`comfortable`,fleetSort:dl.includes(t.fleetSort)?t.fleetSort:`attention`,motion:t.motion===`reduced`||t.motion===`full`?t.motion:`system`,dialogue:t.dialogue===`off`||t.dialogue===`work`?t.dialogue:`work_personality`,selectedFloor:typeof t.selectedFloor==`number`&&Number.isInteger(t.selectedFloor)&&t.selectedFloor>=0?t.selectedFloor:0,roomAssignments:n,workerSeatAssignments:r}}catch{return ll}}var pl,ml=new Set;function hl(){return pl||=typeof window>`u`?ll:fl(localStorage.getItem(cl)),pl}function gl(e){pl=e;for(let e of ml)e()}function _l(e){return ml.add(e),ml.size===1&&typeof window<`u`&&window.addEventListener(`storage`,vl),()=>{ml.delete(e),!ml.size&&typeof window<`u`&&window.removeEventListener(`storage`,vl)}}function vl(e){(e.key===null||e.key===`hive:office-preferences`)&&gl(fl(localStorage.getItem(cl)))}function yl(e){let t=typeof e==`function`?e(hl()):e;try{localStorage.setItem(cl,JSON.stringify(t))}catch{}gl(t)}function bl(){return[(0,g.useSyncExternalStore)(_l,hl,()=>ll),(0,g.useCallback)(yl,[])]}function xl(e){let t=(0,g.useMemo)(()=>({mission:e,slotId:`detail:${e.missionId}`,spaceId:`detail`,seatIndex:0,kind:e.lifecycleStatus===`ready_for_review`?`review`:`orchestrated`,floorIndex:0}),[e]),n=(0,g.useRef)();if(!n.current){let t=Io();n.current=Object.fromEntries(Object.entries(t?.seats??{}).filter(([t])=>t.startsWith(`${e.missionId}:`)))}let r=(0,g.useMemo)(()=>[t],[t]),i=Wo(r,(0,g.useMemo)(()=>Zi(r,n.current??{}),[r]),!0,`full`,0,!1,(0,g.useMemo)(()=>({scope:e.missionId}),[e.missionId]));return n.current={...n.current,...i.workerSeats},(0,g.useMemo)(()=>{let t=`${e.missionId}:`,n={};for(let[e,r]of Object.entries(i.workerSeats))e.startsWith(t)&&(n[e.slice(t.length)]=r);let r=(i.sceneWorkers[e.missionId]??[]).filter(e=>{let r=`${t}${e.id}`;return n[e.id]!==void 0&&i.transitions[r]!==`room-activate`}),a=(i.queuedActions[e.missionId]??[]).includes(`moving-to-review`);return{transitions:i.transitions,transitionStarts:i.transitionStarts,clock:i.clock,workers:r,seats:n,presentedStates:i.presentedStates,presented:i.presented,walkingToReview:a}},[e.missionId,i])}var Sl=[[.45,.85],[1.7,.85],[2.95,.85],[4.2,.85],[.45,3.1],[1.7,3.1],[2.95,3.1],[4.2,3.1]],Cl=[[1.57,1.78],[2.22,1.78],[2.87,1.78],[3.52,1.78],[1.57,3.56],[2.22,3.56],[2.87,3.56],[3.52,3.56]];function wl(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/60);return n>=60?`${Math.floor(n/60)}h ${n%60}m`:n?`${n}m ${t%60}s`:`${t}s`}function Tl({label:e,value:t,detail:n,tone:r=`white`,onClick:i}){let a=(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,O.jsx)(`p`,{className:`text-base font-semibold leading-tight ${{white:`text-white/75`,amber:`text-amber-200/80`,emerald:`text-emerald-200/75`,rose:`text-rose-200/80`}[r]}`,children:t}),i&&(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`text-[9px] text-amber-200/0 transition group-hover:text-amber-200/50`,children:`→`})]}),(0,O.jsx)(`p`,{className:`mt-0.5 text-[9px] font-semibold uppercase tracking-[0.16em] text-white/25`,children:e}),(0,O.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-white/32`,title:n,children:n})]});return i?(0,O.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`${t} ${e} — ${n}. Open ${e.toLowerCase()}`,className:`group min-w-0 rounded-xl border border-white/[0.07] bg-white/[0.02] px-3 py-2 text-left transition hover:border-amber-300/20 hover:bg-white/[0.035] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-300/35`,children:a}):(0,O.jsx)(`div`,{className:`min-w-0 rounded-xl border border-white/[0.07] bg-white/[0.02] px-3 py-2 text-left`,children:a})}function El({node:e,fleetMissions:t,decisions:n,onOpenDecisions:r,onSelectWorker:i,onReviewMissionSelect:a,reviewMissions:o,selectedReviewMissionId:s,onReviewClear:c,studioMissions:l,selectedStudioMissionId:u,onStudioMissionSelect:d,onStudioClear:f,requestedPanel:p}){let m=xl(e),[h,_]=(0,g.useState)(`conversation`),[v,y]=(0,g.useState)(!1);(0,g.useEffect)(()=>{p&&_(p.panel)},[p]);let[b,x]=(0,g.useState)(`feed`),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(!1),[k,A]=(0,g.useState)(!1),[j,M]=(0,g.useState)(),[N,P]=(0,g.useState)([]),[F,I]=(0,g.useState)(),[L,ee]=bl(),[R,te]=(0,g.useState)(()=>Date.now()),[z,ne]=(0,g.useState)(!1);(0,g.useEffect)(()=>{if(L.dialogue===`off`)return;let e=window.setInterval(()=>te(Date.now()),2e3);return()=>window.clearInterval(e)},[L.dialogue]);let B=Jt(e.plan),re=B.filter(e=>e.status===`completed`).length,V=B.filter(e=>e.status===`blocked`||e.status===`failed`),ie=e.plan?.gates??[],ae=ie.filter(e=>e.status===`satisfied`||e.status===`waived`).length,H=!!l,U=e.mission.mode===`direct`,W=!!o,oe=!H&&(W||e.lifecycleStatus===`ready_for_review`&&!m.walkingToReview),se=W&&!s,ue=new Set(n.map(e=>e.missionId)),de={x:.3,y:.25,width:5.2,depth:5.25},fe=Ni(de),K=U?Sl:fe,pe=e.workers.filter(qi),me=U?[]:m.workers.slice(0,4),he=U?0:Math.max(0,m.workers.length-me.length),q=Oi(de,0),ge=Oi({x:4.45,y:5.1,width:.76,depth:.24},2),_e=[q[0],q[1],{x:q[1].x,y:q[1].y-48},{x:q[0].x,y:q[0].y-48}],ve=[q[0],q[3],{x:q[3].x,y:q[3].y-48},{x:q[0].x,y:q[0].y-48}],ye=m.presentedStates[e.missionId]??Yi(e),be=ye,xe=t=>m.presentedStates[`${e.missionId}:${t.id}`]??Ji(t,e),Se=Y(K[0][0]+.36,K[0][1]+.78,26),Ce=(0,g.useMemo)(()=>wo(t,L.roomAssignments).placements,[t,L.roomAssignments]),we=H?Ce.filter(e=>e.floorIndex===0&&e.spaceId===`direct-studio`&&l?.some(t=>t.missionId===e.mission.missionId)):[],Te=oe?Ce.filter(e=>e.spaceId===`review`).slice(0,8):[],Ee={entrance:{x:5.42,y:5.28},lobby:{x:5.16,y:5.18},doorway:{x:4.82,y:5.02},inside:{x:4.36,y:4.62}},De=aa(H?we.map(e=>e.mission):W?Te.map(e=>e.mission):[e]),Oe=(0,g.useMemo)(()=>eo(Ce,L.dialogue,R),[R,Ce,L.dialogue]),ke=e=>Oe.find(t=>t.targetId===e),Ae=(e,t,n,r)=>e?(0,O.jsx)(no,{x:t,y:n,text:e.text,kind:e.kind,targetId:e.targetId,delayMs:0,onClick:e.kind===`thought`?void 0:()=>r?i(r):_(`conversation`)},`detail-dialogue:${e.targetId}`):null,je=H?void 0:me.find(t=>m.transitions[`${e.missionId}:${t.id}`]===`reporting`),Me=je,Ne=Me?m.seats[Me.id]??-1:-1,Pe=je?`receiving-report`:void 0,Fe={x:K[0][0]+.36,y:K[0][1]+.78},Ie=Ne>=0?{x:K[Ne+1][0]+.36,y:K[Ne+1][1]+.72}:void 0,Le=e.workers.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)).length,Re=[[`conversation`,`Conversation`],[`plan`,`Plan`],[`workers`,`Workers`],[`activity`,`Activity`],[`log`,`Terminal`],[`technical`,`Technical`]],ze=H&&!u,Be=l?.filter(e=>e.activityStatus===`working`).length??0,Ve=l?.filter(e=>e.activityStatus===`waiting_on_you`||e.activityStatus===`error`||e.activityStatus===`stalled`).length??0,He=(l??[]).reduce((e,t)=>e+t.tokens,0),Ue=(l??[]).filter(xn),We=async e=>{I(void 0);try{await G(e,`completed`)}catch(e){I(e.message)}},Ge=(l?.length??0)-Ue.length,Ke=e.activityStatus===`working`?Date.now():e.updatedAt,qe=(0,O.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6`,children:[(0,O.jsx)(Tl,{label:`Occupied`,value:`${l?.length??0}/8`,detail:`Direct-agent desks in use`,tone:`emerald`}),(0,O.jsx)(Tl,{label:`Working`,value:`${Be}`,detail:`Agents active right now`,tone:Be?`amber`:`white`}),(0,O.jsx)(Tl,{label:`Attention`,value:`${Ve}`,detail:`Waiting, stalled, or failed`,tone:Ve?`rose`:`emerald`}),(0,O.jsx)(Tl,{label:`Available`,value:`${Math.max(0,8-(l?.length??0))}`,detail:`Desks ready for new missions`}),(0,O.jsx)(Tl,{label:`Tokens`,value:He.toLocaleString(),detail:`Combined studio usage`}),(0,O.jsx)(Tl,{label:`Providers`,value:`${new Set((l??[]).map(e=>e.mission.provider??`claude`)).size}`,detail:[...new Set((l??[]).map(e=>e.mission.provider??`claude`))].join(` · `)||`No active agents`})]});function Je(e){a?.(e),_(`conversation`)}async function Xe(){A(!0),M(void 0);try{let e=await le();P(e.skipped),D(!1)}catch(e){M(e.message)}finally{A(!1)}}async function Ze(){T(!0),I(void 0);try{await ce(),C(!1)}catch(e){I(e.message)}finally{T(!1)}}let Qe=(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] p-3`,children:[(0,O.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold text-white/65`,children:`Direct agents`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/28`,children:`Select an agent to open its mission workspace.`})]}),(0,O.jsxs)(`button`,{type:`button`,disabled:!Ue.length||w,onClick:()=>C(!0),className:`shrink-0 rounded-lg border border-emerald-300/15 bg-emerald-300/[0.045] px-2.5 py-1.5 text-[9px] font-medium text-emerald-100/55 transition hover:border-emerald-300/30 hover:bg-emerald-300/[0.08] disabled:cursor-not-allowed disabled:border-white/[0.05] disabled:bg-white/[0.02] disabled:text-white/20`,children:[`Clear completed desks · `,Ue.length]})]}),S&&(0,O.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-300/15 bg-amber-300/[0.035] p-3`,children:[(0,O.jsxs)(`p`,{className:`text-[10px] leading-relaxed text-amber-50/60`,children:[`Clear `,Ue.length,` finished direct `,Ue.length===1?`mission`:`missions`,`? `,Ge,` active or attention `,Ge===1?`mission`:`missions`,` will remain untouched.`]}),(0,O.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,disabled:w,onClick:()=>C(!1),className:`px-2 py-1 text-[9px] text-white/35 hover:text-white/60`,children:`Cancel`}),(0,O.jsx)(`button`,{type:`button`,disabled:w||!Ue.length,onClick:Ze,className:`rounded-md bg-emerald-400/15 px-2.5 py-1 text-[9px] font-medium text-emerald-100/65 hover:bg-emerald-400/25 disabled:opacity-40`,children:w?`Clearing…`:`Clear ${Ue.length} desks`})]})]}),F&&(0,O.jsx)(`p`,{className:`mb-3 rounded-lg border border-rose-300/15 bg-rose-300/[0.04] px-3 py-2 text-[10px] text-rose-200/65`,children:F}),(0,O.jsx)(`div`,{className:`space-y-2`,children:we.map(({mission:e,seatIndex:t})=>(0,O.jsxs)(`button`,{type:`button`,onClick:()=>d?.(e.missionId),className:`flex w-full items-start justify-between gap-3 rounded-lg border border-white/[0.06] bg-black/15 px-3 py-2 text-left transition hover:border-emerald-300/20 hover:bg-emerald-300/[0.035]`,children:[(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsx)(`span`,{className:`block truncate text-[11px] font-medium text-white/65`,children:e.name}),(0,O.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-[9px] leading-relaxed text-white/28`,children:e.mission.objective})]}),(0,O.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-[9px] uppercase tracking-wider text-white/25`,children:[`Desk `,t+1,` · `,bn(e)?(0,O.jsx)(`span`,{className:`text-emerald-200/70`,children:`finished`}):e.activityStatus.replaceAll(`_`,` `),bn(e)&&(0,O.jsx)(`span`,{role:`button`,tabIndex:0,onClick:t=>{t.stopPropagation(),We(e.missionId)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),We(e.missionId))},className:`rounded-md border border-emerald-300/25 bg-emerald-300/[0.06] px-2 py-0.5 normal-case tracking-normal text-emerald-100/80 hover:bg-emerald-300/[0.12]`,children:`Mark complete`})]})]},e.missionId))})]}),$e=Te.filter(({mission:e})=>Sn(e,ue.has(e.missionId))),et=(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] p-3`,children:[(0,O.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`text-xs font-semibold text-white/65`,children:`Awaiting acceptance`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/28`,children:`Select a manager to review its evidence and accept or reopen the work.`})]}),(0,O.jsxs)(`button`,{type:`button`,disabled:!$e.length||k,onClick:()=>D(!0),className:`shrink-0 cursor-pointer rounded-lg border border-emerald-300/15 bg-emerald-300/[0.045] px-2.5 py-1.5 text-[9px] font-medium text-emerald-100/55 transition hover:border-emerald-300/30 hover:bg-emerald-300/[0.08] disabled:cursor-not-allowed disabled:border-white/[0.05] disabled:bg-white/[0.02] disabled:text-white/20`,children:[`Accept all clear · `,$e.length]})]}),E&&(0,O.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-300/15 bg-amber-300/[0.035] p-3`,children:[(0,O.jsxs)(`p`,{className:`text-[10px] leading-relaxed text-amber-50/60`,children:[`Accept `,$e.length,` `,$e.length===1?`mission`:`missions`,` with no open gates, questions, or alerts? `,Te.length-$e.length>0?`${Te.length-$e.length} still needing review will stay seated.`:`Every seated mission qualifies.`,` Any worktree holding uncommitted work is preserved.`]}),(0,O.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,disabled:k,onClick:()=>D(!1),className:`cursor-pointer px-2 py-1 text-[9px] text-white/35 hover:text-white/60`,children:`Cancel`}),(0,O.jsx)(`button`,{type:`button`,disabled:k||!$e.length,onClick:Xe,className:`cursor-pointer rounded-md bg-emerald-400/15 px-2.5 py-1 text-[9px] font-medium text-emerald-100/65 hover:bg-emerald-400/25 disabled:opacity-40`,children:k?`Accepting…`:`Accept ${$e.length}`})]})]}),j&&(0,O.jsx)(`p`,{className:`mb-3 text-[10px] text-rose-300/70`,children:j}),N.length>0&&(0,O.jsxs)(`div`,{className:`mb-3 rounded-lg border border-white/[0.07] bg-black/20 p-2.5`,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-wider text-white/30`,children:`Left for you to review`}),(0,O.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:N.map(e=>(0,O.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-[10px]`,children:[(0,O.jsx)(`span`,{className:`truncate text-white/50`,children:e.name}),(0,O.jsx)(`span`,{className:`shrink-0 text-amber-200/45`,children:e.reason})]},e.missionId))})]}),Te.length?(0,O.jsx)(`ul`,{className:`space-y-1.5`,children:Te.map(({mission:e})=>(0,O.jsx)(`li`,{children:(0,O.jsx)(`button`,{type:`button`,onClick:()=>Je(e.missionId),className:`w-full cursor-pointer rounded-lg border border-white/[0.06] bg-white/[0.02] px-3 py-2 text-left transition hover:border-amber-300/25 hover:bg-white/[0.04]`,children:(0,O.jsxs)(`span`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsx)(`span`,{className:`block truncate text-xs font-medium text-white/70`,children:e.name}),(0,O.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-white/32`,children:e.mission.objective||`No recorded objective`})]}),(0,O.jsxs)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-wider text-amber-200/45`,children:[Cn(e,ue.has(e.missionId))??(e.plan?.progress.percent===void 0?`clear`:`${e.plan.progress.percent}%`),` →`]})]})})},e.missionId))}):(0,O.jsx)(`p`,{className:`text-[10px] text-white/25`,children:`No mission is awaiting acceptance.`})]}),tt=(0,O.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6`,children:[(0,O.jsx)(Tl,{label:`Awaiting`,value:`${Te.length}`,detail:`Missions seated for acceptance`,tone:`amber`}),(0,O.jsx)(Tl,{label:`Seats`,value:`${Te.length}/8`,detail:`Review hall capacity in use`}),(0,O.jsx)(Tl,{label:`Needs you`,value:`${n.length}`,detail:`Open decisions across the hall`,tone:n.length?`rose`:`white`}),(0,O.jsx)(Tl,{label:`Tokens`,value:Te.reduce((e,t)=>e+t.mission.tokens,0).toLocaleString(),detail:`Spent by seated missions`})]}),nt=(0,O.jsx)(`div`,{className:`flex w-full max-w-full overflow-x-auto rounded-xl border border-white/[0.07] bg-black/20 p-1`,"aria-label":`Room workspace`,children:Re.map(([e,t])=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>_(e),"aria-pressed":h===e,className:`min-w-0 flex-1 whitespace-nowrap rounded-lg px-2 py-1.5 text-[10px] font-medium transition ${h===e?`bg-amber-300/[0.1] text-amber-100/75`:`text-white/28 hover:bg-white/[0.035] hover:text-white/55`}`,children:t},e))}),rt=(0,O.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6`,children:[(0,O.jsx)(Tl,{label:`Plan`,value:e.plan?.progress.percent===void 0?`—`:`${e.plan.progress.percent}%`,detail:B.length?`${re} of ${B.length} tasks complete`:`Waiting for a structured plan`,tone:`amber`,onClick:()=>_(`plan`)}),(0,O.jsx)(Tl,{label:U?`Status`:`Workers`,value:U?e.activityStatus.replaceAll(`_`,` `):`${e.workers.length}`,detail:U?`${e.mission.provider??`claude`} direct agent`:`${Le} active · ${pe.length} present`,onClick:()=>_(U?`activity`:`workers`)}),(0,O.jsx)(Tl,{label:`Gates`,value:`${ae}/${ie.length}`,detail:ie.length?`Completion requirements resolved`:`No completion gates published`,tone:ae===ie.length&&ie.length?`emerald`:`white`,onClick:()=>_(`plan`)}),(0,O.jsx)(Tl,{label:`Health`,value:V.length||e.alerts.length?`${V.length+e.alerts.length}`:`Clear`,detail:V.length?`${V.length} blocked or failed tasks`:e.alerts.length?`${e.alerts.length} mission alerts`:`No reported blockers or alerts`,tone:V.length||e.alerts.length?`rose`:`emerald`,onClick:()=>_(`activity`)}),(0,O.jsx)(Tl,{label:`This turn`,value:wl(Ke-e.runStartedAt),detail:e.activityStatus.replaceAll(`_`,` `)}),(0,O.jsx)(Tl,{label:`Tokens`,value:e.tokens.toLocaleString(),detail:`${e.jobIds.length} job turn${e.jobIds.length===1?``:`s`}`})]}),it=ze?Qe:se?et:h===`conversation`?(0,O.jsxs)(`div`,{className:`space-y-3 xl:flex xl:h-full xl:min-h-0 xl:flex-col xl:space-y-0 xl:gap-3`,children:[(0,O.jsx)(ur,{prs:e.prs,messages:e.messages}),(0,O.jsx)(Rs,{missionId:e.missionId,repository:e.mission.repository,provider:e.mission.provider,messages:e.messages,hasMoreMessages:e.hasMoreMessages,contained:!0,autoFocus:!0,decisions:n.filter(t=>t.missionId===e.missionId),onOpenDecisions:r,live:{status:e.activityStatus,lifecycle:e.lifecycleStatus,detail:e.detail,waitingFor:e.waitingFor,plan:e.plan,workers:e.workers,inFlight:e.inFlight,prs:e.prs}})]}):h===`plan`?(0,O.jsxs)(`div`,{children:[(0,O.jsx)(Vc,{missionId:e.missionId,plan:e.plan,objective:e.mission.objective,missionAcceptanceCriteria:e.mission.acceptanceCriteria,workers:e.workers,missionUpdatedAt:e.updatedAt,compact:!0,approvalRequired:e.mission.planFirst}),(0,O.jsx)(hc,{messages:e.messages,plan:e.plan})]}):h===`workers`?(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsx)(vc,{budgets:e.mission.budgets,tokens:e.tokens,workers:e.workers,elapsedMs:Math.max(0,Date.now()-e.createdAt)}),(0,O.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,O.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:`Workers`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Select a worker here or at their desk.`})]}),Le>0&&(0,O.jsxs)(`span`,{className:`rounded-full bg-amber-400/10 px-2 py-1 text-[10px] text-amber-300`,children:[Le,` active`]})]}),(0,O.jsx)(Ys,{workers:e.workers,onSelect:i,narrow:!0})]}),(0,O.jsx)(ur,{prs:e.prs,messages:e.messages})]}):h===`log`?(0,O.jsx)(uc,{missionId:e.missionId,live:e.activityStatus===`working`}):h===`activity`?(0,O.jsxs)(`div`,{className:`space-y-3`,children:[e.detail&&(0,O.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] px-4 py-3`,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/25`,children:`Latest runtime note`}),(0,O.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/45`,children:e.detail})]}),(0,O.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,O.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:`Activity timeline`}),(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Live work, transitions, gaps, and bottlenecks`})]}),(0,O.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/[0.06] bg-black/15 p-0.5`,children:[`feed`,`parallel`].map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>x(e),className:`rounded-md px-2.5 py-1 text-[9px] font-medium uppercase tracking-wider ${b===e?`bg-white/[0.08] text-white/65`:`text-white/25 hover:text-white/45`}`,children:e},e))})]}),b===`feed`?(0,O.jsx)(qr,{events:e.recentEvents,compact:!0}):(0,O.jsx)(Ks,{events:e.recentEvents,workers:e.workers,plan:e.plan,compact:!0})]})]}):(0,O.jsxs)(`div`,{className:`grid gap-4`,children:[(0,O.jsx)(Vs,{missionId:e.missionId,initial:e.mission.policy}),(0,O.jsx)(Bs,{jobs:e.jobHistory}),(0,O.jsx)(zs,{missionId:e.missionId}),(0,O.jsx)(Hs,{missionId:e.missionId})]});return(0,O.jsx)(`div`,{className:`space-y-5`,children:(0,O.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-white/10 bg-[#0e0f13]`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-white/[0.07] px-5 py-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.2em] text-amber-200/45`,children:H?`Shared direct-agent workspace`:W?`Shared review hall`:`Mission room`}),ze?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`h2`,{className:`mt-1 text-base font-semibold text-white/75`,children:`Direct Studio overview`}),(0,O.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-relaxed text-white/35`,children:`All direct missions remain visible. Select a desk to inspect its agent.`})]}):se?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`h2`,{className:`mt-1 text-base font-semibold text-white/75`,children:`Review hall overview`}),(0,O.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-relaxed text-white/35`,children:`Every mission awaiting acceptance is seated here. Select a manager to review its work.`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,O.jsx)(Ye,{missionId:e.missionId,name:e.name})}),e.mission.objective&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>y(e=>!e),"aria-expanded":v,className:`mt-1 flex max-w-2xl cursor-pointer items-start gap-1.5 text-left text-xs leading-relaxed text-white/35 hover:text-white/55`,children:[(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px shrink-0 text-[9px] text-white/25`,children:v?`▾`:`▸`}),(0,O.jsxs)(`span`,{className:v?``:`truncate`,children:[(0,O.jsx)(`span`,{className:`text-white/20`,children:`Goal:`}),` `,e.mission.objective]})]})]})]}),(0,O.jsxs)(`label`,{className:`flex items-center gap-1.5 rounded-lg border border-white/[0.07] bg-black/20 px-2.5 py-1.5 text-[9px] text-white/35`,children:[(0,O.jsx)(`span`,{children:`Talk`}),(0,O.jsxs)(`select`,{"aria-label":`Room dialogue`,value:L.dialogue,onChange:e=>ee(t=>({...t,dialogue:e.target.value})),className:`bg-transparent text-[9px] text-white/55 outline-none`,children:[(0,O.jsx)(`option`,{value:`off`,children:`Off`}),(0,O.jsx)(`option`,{value:`work`,children:`Work only`}),(0,O.jsx)(`option`,{value:`work_personality`,children:`Work + personality`})]})]})]}),(0,O.jsx)(`div`,{className:`border-b border-white/[0.06] bg-black/[0.08] px-4 py-2.5`,children:ze?qe:se?tt:rt}),(0,O.jsxs)(`div`,{className:`grid ${z?`xl:grid-cols-[minmax(0,1fr)]`:`xl:grid-cols-[minmax(0,1fr)_480px]`}`,children:[(0,O.jsxs)(`div`,{className:`relative h-[520px] bg-[radial-gradient(circle_at_center,rgba(167,139,250,0.065),transparent_58%)] lg:h-[clamp(600px,calc(100vh_-_500px),730px)] ${z?`xl:hidden`:``}`,children:[(0,O.jsxs)(`svg`,{viewBox:`4 -6 452 450`,role:`img`,"aria-label":H?`Spatial Direct Studio`:`Spatial room for ${e.name}`,className:`h-full w-full`,onClick:()=>{H?f?.():W&&c?.()},children:[(0,O.jsxs)(`defs`,{children:[(0,O.jsxs)(`filter`,{id:`review-manager-glow`,x:`-120%`,y:`-120%`,width:`340%`,height:`340%`,children:[(0,O.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`2.6`,result:`tight`}),(0,O.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`10`,result:`wide`}),(0,O.jsx)(`feFlood`,{floodColor:`#ffd77a`,floodOpacity:`.62`,result:`hot`}),(0,O.jsx)(`feFlood`,{floodColor:`#e6bd62`,floodOpacity:`.4`,result:`warm`}),(0,O.jsx)(`feComposite`,{in:`hot`,in2:`tight`,operator:`in`,result:`core`}),(0,O.jsx)(`feComposite`,{in:`warm`,in2:`wide`,operator:`in`,result:`halo`}),(0,O.jsxs)(`feMerge`,{children:[(0,O.jsx)(`feMergeNode`,{in:`halo`}),(0,O.jsx)(`feMergeNode`,{in:`core`}),(0,O.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,O.jsxs)(`filter`,{id:`direct-station-glow`,x:`-80%`,y:`-80%`,width:`260%`,height:`260%`,children:[(0,O.jsx)(`feGaussianBlur`,{stdDeviation:`4.5`,result:`blur`}),(0,O.jsx)(`feFlood`,{floodColor:`#55c7b3`,floodOpacity:`.48`,result:`color`}),(0,O.jsx)(`feComposite`,{in:`color`,in2:`blur`,operator:`in`,result:`glow`}),(0,O.jsxs)(`feMerge`,{children:[(0,O.jsx)(`feMergeNode`,{in:`glow`}),(0,O.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,O.jsxs)(`g`,{transform:`translate(-65 -45) scale(1.12)`,children:[(0,O.jsx)(`polygon`,{points:X(q),fill:`#17181f`,stroke:H?`#55c7b3`:`#a78bfa`,strokeOpacity:`.28`,strokeWidth:`2`}),(0,O.jsx)(_a,{floor:q,doorway:ge,center:Y(2.9,2.85,2),atmosphere:De,occupied:!H||we.length>0,scope:`detail`}),(0,O.jsx)(`polygon`,{points:X(_e),fill:`#23242d`,stroke:`#a78bfa`,strokeOpacity:`.22`}),(0,O.jsx)(`polygon`,{points:X(ve),fill:`#1d1e26`,stroke:`#a78bfa`,strokeOpacity:`.18`}),(0,O.jsx)(ya,{x:.55,y:.55}),(0,O.jsx)(pa,{x:3.75,y:.25}),(0,O.jsx)(ga,{x:2.9,y:.35,atmosphere:De}),oe?(0,O.jsx)(da,{x:.55,y:1.2,occupiedCount:Te.length}):K.map(([t,n],r)=>{let i=H?we.find(e=>e.seatIndex===r):void 0,a=!U&&r?me.find(e=>m.seats[e.id]===r-1):void 0,o=i?m.transitions[i.mission.missionId]:a?m.transitions[`${e.missionId}:${a.id}`]:!H&&r===0?m.transitions[e.missionId]:void 0,s=H?!!i:r===0||!!a,c=i?ia(i.mission,void 0,o):a?ia(e,a,o,xe(a)):!H&&r===0?ia(e,void 0,o,ye):void 0;return(0,O.jsx)(la,{x:t,y:n,role:U?`direct`:r===0?`manager`:`worker`,occupied:s,visualState:c?.state,monitor:c?.monitor??`vacant`,transition:o,selected:!!(i&&i.mission.missionId===u)},r)}),oe?Te.map((e,t)=>{let[r,i]=Cl[t],a=Y(r,i,26);return(0,O.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Open review mission ${e.mission.name}`,onClick:t=>{t.stopPropagation(),Je(e.mission.missionId)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),Je(e.mission.missionId))},className:`cursor-pointer outline-none ${e.mission.missionId===s?`office-review-selected`:``}`,"data-review-selected":e.mission.missionId===s?`true`:void 0,filter:e.mission.missionId===s?`url(#review-manager-glow)`:void 0,children:[(0,O.jsx)(`circle`,{cx:a.x,cy:a.y,r:`26`,fill:`transparent`,pointerEvents:`all`}),(0,O.jsx)(`title`,{children:e.mission.name}),(0,O.jsx)(to,{identity:e.mission.missionId,x:r,y:i,role:`review`,provider:e.mission.mission.provider,state:Yi(e.mission),needsAttention:e.mission.missionId===s&&n.length>0})]},e.mission.missionId)}):!H&&(0,O.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":U?`Open direct mission ${e.name}`:`Open orchestrator for ${e.name}`,onClick:()=>_(`conversation`),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&_(`conversation`)},className:`cursor-pointer outline-none`,children:[(0,O.jsx)(`title`,{children:e.name}),(0,O.jsx)(`polygon`,{"data-hit-target":`desk`,points:ca(K[0][0],K[0][1],U?`direct`:`manager`),fill:`transparent`,pointerEvents:`all`}),(0,O.jsx)(`circle`,{cx:Se.x,cy:Se.y,r:`28`,fill:`transparent`,pointerEvents:`all`}),(0,O.jsx)(to,{identity:e.missionId,x:K[0][0]+.36,y:K[0][1]+.78,role:U?`direct`:`manager`,provider:e.mission.provider,state:be,needsAttention:n.length>0,transition:m.transitions[e.missionId],transitionStartedAt:m.transitionStarts[e.missionId],route:Ee,interaction:Pe,interactionTarget:Ie})]}),H&&we.map(({mission:e,seatIndex:t})=>{let[n,r]=K[t],i=Y(n+.36,r+.72,26),a=e.missionId===u;return(0,O.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Inspect direct agent ${e.name}`,"data-agent-selected":a?`true`:void 0,onClick:t=>{t.stopPropagation(),d?.(e.missionId),_(`conversation`)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),d?.(e.missionId),_(`conversation`))},className:`cursor-pointer outline-none`,children:[(0,O.jsx)(`title`,{children:e.name}),(0,O.jsx)(`polygon`,{"data-hit-target":`desk`,points:ca(n,r,`direct`),fill:`transparent`,pointerEvents:`all`}),(0,O.jsx)(`circle`,{cx:i.x,cy:i.y,r:`27`,fill:`transparent`,pointerEvents:`all`}),(0,O.jsx)(to,{identity:e.missionId,x:n+.36,y:r+.72,role:`direct`,provider:e.mission.provider,state:Yi(e)})]},e.missionId)}),!oe&&me.map((t,n)=>{let r=m.seats[t.id];if(r===void 0)return null;let[a,o]=K[r+1],s=Y(a+.36,o+.72,26),c=m.transitions[`${e.missionId}:${t.id}`],l=c===`reporting`||c===`exiting`;return(0,O.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Inspect worker ${t.label}`,onClick:()=>i(t),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&i(t)},className:`cursor-pointer outline-none`,children:[(0,O.jsx)(`polygon`,{"data-hit-target":`desk`,points:ca(a,o,`worker`),fill:`transparent`,pointerEvents:`all`}),(0,O.jsx)(`circle`,{cx:s.x,cy:s.y,r:`26`,fill:`transparent`,pointerEvents:`all`}),(0,O.jsx)(to,{identity:`${e.missionId}:${t.id}`,transitionStartedAt:m.transitionStarts[`${e.missionId}:${t.id}`],x:a+.36,y:o+.72,role:`worker`,provider:e.mission.provider,state:c===`working`||c===`arrived`?`working`:xe(t),transition:c,route:Ee,interaction:c===`reporting`?`reporting`:void 0,interactionTarget:l?Fe:void 0})]},t.id)}),!oe&&je&&(()=>{let e=Y(Fe.x,Fe.y,34);return(0,O.jsxs)(`g`,{className:`office-handoff-document`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:e.x+8,y:e.y-18,width:`12`,height:`15`,rx:`1.5`,fill:`#f5f1e8`,stroke:`#e6bd62`}),(0,O.jsx)(`path`,{d:`M ${e.x+11} ${e.y-13}h6M ${e.x+11} ${e.y-10}h6M ${e.x+11} ${e.y-7}h4`,stroke:`#665f51`,strokeWidth:`1`})]},`document:${je.id}`)})(),!H&&(()=>{let t=oe?Cl[Math.max(0,Te.findIndex(t=>t.mission.missionId===e.missionId))]:void 0;return t?Ae(ke(e.missionId),t[0],t[1]):Ae(ke(e.missionId),K[0][0]+.36,K[0][1]+.78)})(),H&&we.map(({mission:e,seatIndex:t})=>{let[n,r]=K[t];return Ae(ke(e.missionId),n+.36,r+.72)}),!oe&&me.map((t,n)=>{let r=m.transitions[`${e.missionId}:${t.id}`];if([`room-activate`,`desk-reserved`,`entering`].includes(r??``))return null;let i=m.seats[t.id];if(i===void 0)return null;let[a,o]=K[i+1];return Ae(ke(`${e.missionId}:${t.id}`),a+.36,o+.72,t)})]})]}),(0,O.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 left-4 flex flex-wrap gap-2 text-[9px]`,children:[(0,O.jsx)(`span`,{className:`rounded-full border border-amber-300/15 bg-black/35 px-2.5 py-1 text-amber-100/55`,children:H?`Agents · click a desk to inspect`:W?`Managers · click a seat to review`:`${U?`Direct agent`:`Manager`} · click to converse`}),!U&&!W&&(0,O.jsx)(`span`,{className:`rounded-full border border-violet-300/15 bg-black/35 px-2.5 py-1 text-violet-100/55`,children:`Workers · click to inspect`}),he>0&&(0,O.jsxs)(`span`,{className:`rounded-full border border-orange-300/15 bg-black/35 px-2.5 py-1 text-orange-100/60`,children:[`+`,he,` workers outside visible capacity`]})]})]}),(0,O.jsxs)(`aside`,{className:`room-sidebar relative min-w-0 break-words border-t border-white/[0.06] bg-black/[0.08] p-4 pl-6 [overflow-wrap:anywhere] sm:p-5 sm:pl-7 xl:max-h-[clamp(600px,calc(100vh_-_500px),730px)] xl:border-t-0 ${z?``:`xl:border-l`} ${!ze&&h===`conversation`?`xl:flex xl:h-[clamp(600px,calc(100vh_-_500px),730px)] xl:flex-col xl:overflow-hidden`:`xl:overflow-y-auto`}`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>ne(e=>!e),"aria-label":z?`Show the room`:`Widen the panel over the room`,title:z?`Show the room`:`Widen`,className:`absolute left-0 top-1/2 z-10 hidden -translate-y-1/2 rounded-r-md border border-l-0 border-white/10 bg-[#101014] px-1 py-3 text-[11px] leading-none text-white/45 hover:border-white/25 hover:text-white/85 xl:block`,children:z?`›`:`‹`}),!ze&&!se&&(0,O.jsx)(Xn,{className:`mb-2 shrink-0`,plan:e.plan,waitingFor:e.waitingFor,blocked:e.lifecycleStatus===`active`&&e.activityStatus===`waiting_on_you`,onOpenPlan:h===`plan`?void 0:()=>_(`plan`)}),!ze&&!se&&(0,O.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center gap-2`,children:[nt,bn(e)&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>void We(e.missionId),className:`shrink-0 rounded-lg border border-emerald-300/25 bg-emerald-300/[0.08] px-3 py-1.5 text-xs font-medium text-emerald-100/85 transition hover:bg-emerald-300/[0.16]`,title:`Accept this agent's reply and let it leave`,children:`Mark complete`})]}),(ze||se)&&(0,O.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-center justify-between gap-3`,children:[(0,O.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.18em] text-white/25`,children:ze?`Direct Studio`:`Review hall`}),(0,O.jsxs)(`p`,{className:`text-[9px] text-white/18`,children:[`Select a `,ze?`desk`:`manager`]})]}),(0,O.jsx)(`div`,{className:`mission-presentation-enter ${!ze&&h===`conversation`?`xl:min-h-0 xl:flex-1`:``}`,children:it},ze?`studio`:`${e.missionId}:${h}`)]})]})]})})}function Dl(e,t,n){return n(e.lifecycleStatus,t.map(e=>({id:e.id,choices:e.choices})))}function Ol(e,t,n,r){let i=Dl(e,t,n);if(!i)return!1;if(i.needsWords)return r?.(),!1;if(i.answer&&i.decisionId)oe(e.missionId,i.decisionId,i.answer);else if(i.next)G(e.missionId,i.next);else return!1;return!0}var kl=`hive:mission-seen`,Al=100;function jl(){if(typeof window>`u`)return{};try{let e=JSON.parse(localStorage.getItem(`hive:mission-seen`)??`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`number`&&Number.isFinite(e)))}catch{return{}}}function Ml(e){return jl()[e]}function Nl(e,t=Date.now()){try{let n={...jl(),[e]:t},r=Object.entries(n).sort(([,e],[,t])=>t-e).slice(0,Al);localStorage.setItem(kl,JSON.stringify(Object.fromEntries(r)))}catch{}}function Pl(e,t,n=Date.now()){if(t===void 0)return;let r=n-t;if(r<6e4)return;let i=e.messages.filter(e=>e.createdAt>t).length,a=e.recentEvents.filter(e=>e.ts>t).length;if(!(!i&&!a))return{messages:i,events:a,awayMs:r}}function Fl(e){let t=[];return e.messages&&t.push(`${e.messages} new message${e.messages===1?``:`s`}`),e.events&&t.push(`${e.events} new event${e.events===1?``:`s`}`),t.join(` · `)}function Il({changes:e,onDismiss:t}){return e?(0,O.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-sky-300/15 bg-sky-300/[0.035] px-4 py-2.5`,children:[(0,O.jsxs)(`p`,{className:`min-w-0 text-xs text-sky-100/70`,children:[(0,O.jsx)(`span`,{className:`font-medium`,children:Fl(e)}),(0,O.jsxs)(`span`,{className:`text-white/30`,children:[` since you last opened this, `,Bn(e.awayMs),` ago`]})]}),(0,O.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 cursor-pointer text-[11px] text-white/35 transition hover:text-white/70`,children:`Dismiss`})]}):null}function Ll(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h ${r}m`:`${r}m ${t%60}s`}var Rl={conversation:`conversation`,plan:`plan`,workers:`now`,activity:`now`,log:`now`,technical:`plan`};function zl(e){return e.workerId?`workers`:e.id===`unclear-wait`?`conversation`:`activity`}function Bl({mission:e,tone:t,title:n,detail:r,onOpen:i}){return(0,O.jsxs)(`button`,{type:`button`,onClick:i,className:`mb-3 flex w-full cursor-pointer items-center justify-between gap-4 rounded-xl border px-4 py-3 text-left transition hover:brightness-125 ${t===`rose`?`border-rose-400/20 bg-rose-400/[0.06] text-rose-100/80`:t===`orange`?`border-orange-400/20 bg-orange-400/[0.06] text-orange-100/80`:t===`amber`?`border-amber-300/20 bg-amber-300/[0.06] text-amber-100/80`:`border-slate-400/10 bg-slate-400/[0.04] text-slate-200/70`}`,children:[(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsxs)(`span`,{className:`block text-sm font-medium`,children:[(0,O.jsx)(`span`,{className:`text-white/90`,children:e.name}),` · `,n]}),(0,O.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed opacity-65`,children:r})]}),(0,O.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium opacity-55`,children:`Open →`})]})}function Vl({label:e,value:t,accent:n}){return(0,O.jsxs)(`div`,{className:`rounded-xl border border-white/8 bg-white/[0.025] px-4 py-3`,children:[(0,O.jsx)(`p`,{className:`text-lg font-semibold ${n??`text-white/85`}`,children:t}),(0,O.jsx)(`p`,{className:`mt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/25`,children:e})]})}function Hl({node:e,fleetMissions:t=[e],decisions:n=[],onBack:r,initialPresentation:i=`details`,presentation:a=i,onPresentationChange:o=()=>void 0,initialWorkerId:s,onWorkerClose:c,onReviewMissionSelect:l,onStepMission:u,needsYouMissionIds:d=[],reviewMissions:f,selectedReviewMissionId:p,onReviewClear:m,studioMissions:h,selectedStudioMissionId:_,onStudioMissionSelect:v,onStudioClear:y}){let[b,x]=(0,g.useState)({});(0,g.useEffect)(()=>{Ae().then(({providers:e})=>x(Object.fromEntries(e.flatMap(e=>e.defaultModel?[[e.provider,e.defaultModel.label]]:[])))).catch(()=>x({}))},[]);let S=b[e.mission.provider??`claude`],[C,w]=(0,g.useState)(Date.now()),[T,E]=(0,g.useState)(()=>e.workers.find(e=>e.id===s)??null),[D,k]=(0,g.useState)(),[j,M]=(0,g.useState)(!1),[N,P]=(0,g.useState)(()=>Pl(e,Ml(e.missionId)));(0,g.useEffect)(()=>{P(Pl(e,Ml(e.missionId))),Nl(e.missionId)},[e.missionId]);let[F,I]=(0,g.useState)(),L=()=>I(Date.now()),ee=n.length>0,R=(0,g.useRef)(null),te=e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`;(0,g.useEffect)(()=>{let e=setInterval(()=>w(Date.now()),1e3);return()=>clearInterval(e)},[]);let z=e.status===`working`?C:e.updatedAt,ne=!!h,B=!ne&&!f,re=B&&a===`details`,V=Dl(e,n,mt),ie=Dl(e,n,ht),ae=!!f&&!p,H=h?.filter(e=>e.activityStatus===`working`).length??0,U=h?.filter(e=>e.activityStatus===`waiting_on_you`||e.activityStatus===`error`||e.activityStatus===`stalled`).length??0,W=(t,n,r)=>{if(ne&&t.missionId!==_&&v?.(t.missionId),k({panel:n,token:Date.now()}),r){let n=t.workers.find(e=>e.id===r);n&&t.missionId===e.missionId&&E(n)}window.requestAnimationFrame(()=>{a===`details`?el(Rl[n]):R.current?.scrollIntoView?.({behavior:`smooth`,block:`start`})})},oe=(0,O.jsxs)(`header`,{className:`mb-6`,children:[(0,O.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-amber-200/45`,children:`Shared workspace`}),(0,O.jsx)(`h1`,{className:`mt-1 text-2xl font-semibold text-white/85`,children:`Review hall`}),(0,O.jsxs)(`p`,{className:`mt-2 max-w-2xl text-sm leading-relaxed text-white/35`,children:[f?.length??0,` mission`,(f?.length??0)===1?``:`s`,` awaiting your acceptance. Select a manager to review its evidence, or accept everything that has nothing outstanding.`]})]}),se=ae?oe:ne?(0,O.jsxs)(`header`,{className:`mb-6`,children:[(0,O.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-emerald-200/45`,children:`Shared workspace`}),(0,O.jsx)(`h1`,{className:`mt-1 text-2xl font-semibold text-white/85`,children:`Direct Studio`}),(0,O.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm leading-relaxed text-white/35`,children:`Independent direct agents share this room. Select a desk to inspect and converse with that mission.`})]}):(0,O.jsxs)(`header`,{className:`mb-6 flex flex-wrap items-start justify-between gap-4`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(Ye,{missionId:e.missionId,name:e.name,large:!0}),(0,O.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-white/30`,children:[(0,O.jsxs)(`span`,{className:`mono`,children:[`mission `,e.missionId.slice(0,8)]}),!re&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{children:`·`}),(0,O.jsx)(`span`,{className:`capitalize`,children:e.mission.mode}),(0,O.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] font-semibold uppercase ${e.mission.provider===`codex`?`bg-emerald-300/[0.09] text-emerald-200/60`:`bg-violet-300/[0.09] text-violet-200/60`}`,children:e.mission.provider??`claude`}),(0,O.jsx)(`span`,{className:`mono rounded bg-white/[0.04] px-1.5 py-0.5 text-[10px] text-white/40`,children:e.mission.model??(S?`CLI default (${S})`:`CLI default`)}),e.mission.repository&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{children:`·`}),(0,O.jsx)(`span`,{className:`mono text-white/40`,title:e.mission.repository,children:tt(e.mission.repository)})]}),e.mission.additionalRepositories?.map(e=>(0,O.jsxs)(`span`,{className:`mono rounded bg-sky-300/[0.06] px-1.5 py-0.5 text-[10px] text-sky-200/50`,title:e,children:[`+ `,tt(e)]},e)),e.mission.template&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{children:`·`}),(0,O.jsxs)(`span`,{className:`text-amber-200/50`,children:[e.mission.template.name,` v`,e.mission.template.version,` · `,e.mission.template.source]})]}),e.mission.planFirst&&(0,O.jsx)(`span`,{className:`rounded bg-amber-300/[0.08] px-1.5 py-0.5 text-[9px] font-semibold uppercase text-amber-200/55`,children:`Plan first`}),e.worktreeBranch&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{children:`·`}),(0,O.jsx)(`span`,{className:`mono text-violet-300/60`,children:e.worktreeBranch})]})]})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,O.jsx)(mn,{status:e.lifecycleStatus}),!te&&(0,O.jsx)(A,{status:e.activityStatus}),!te&&(0,O.jsx)(J,{pid:e.pid,status:e.activityStatus}),(0,O.jsx)(dr,{missionId:e.missionId,status:e.lifecycleStatus,onDeleted:r,hidePrimary:B&&!!V})]})]}),ce=(t,n=!0)=>(0,O.jsxs)(`div`,{children:[t.activityStatus===`waiting_on_you`&&!(ee&&t.missionId===e.missionId)&&(0,O.jsx)(Bl,{mission:t,tone:`rose`,title:`Waiting for your reply`,detail:t.waitingFor??`Open the conversation to review what this agent needs.`,onOpen:()=>W(t,`conversation`)}),t.activityStatus===`stalled`&&(0,O.jsx)(Bl,{mission:t,tone:`orange`,title:`Work appears stalled`,detail:`No meaningful activity for ${Ll(t.inactiveForMs)}. Open activity to inspect the evidence and recovery options.`,onOpen:()=>W(t,`activity`)}),t.activityStatus===`error`&&(0,O.jsx)(Bl,{mission:t,tone:`rose`,title:`Runtime needs attention`,detail:`Open activity to inspect the failure and recent execution evidence.`,onOpen:()=>W(t,`activity`)}),n&&t.activityStatus===`idle`&&t.lifecycleStatus===`active`&&!t.workers.some(e=>!e.doneAt)&&t.inFlight.tasks===0&&t.inFlight.queued===0&&(0,O.jsx)(Bl,{mission:t,tone:`slate`,title:t.turnCompleted?`Latest turn finished`:`Mission is idle`,detail:t.turnCompleted?`The mission remains open for follow-up or manual completion.`:`No orchestrator or worker is currently doing work.`,onOpen:()=>W(t,`conversation`)}),t.lifecycleStatus===`ready_for_review`&&!re&&(0,O.jsx)(Bl,{mission:t,tone:`amber`,title:`Ready for your acceptance`,detail:`Review the plan evidence, accept completion, or request changes.`,onOpen:()=>W(t,`plan`)}),(0,O.jsx)(ls,{alerts:t.alerts??[],missionName:t.name,onNavigate:e=>W(t,zl(e),e.workerId)})]},`notices:${t.missionId}`),le=(0,O.jsxs)(O.Fragment,{children:[ee&&!te?(0,O.jsx)(is,{decisions:n,onOpenMission:()=>void 0,showMission:!1,presentation:`drawer`,openToken:F,className:`mb-3`,choiceShortcuts:B}):null,ae?null:ne?h?.map(e=>ce(e,!1)):ce(e)]}),ue=ne?(0,O.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,O.jsx)(Vl,{label:`Occupied desks`,value:`${h?.length??0}/8`}),(0,O.jsx)(Vl,{label:`Working`,value:`${H}`,accent:H?`text-amber-300`:void 0}),(0,O.jsx)(Vl,{label:`Needs attention`,value:`${U}`,accent:U?`text-rose-300`:void 0}),(0,O.jsx)(Vl,{label:`Total tokens`,value:`${(h??[]).reduce((e,t)=>e+t.tokens,0).toLocaleString()}`})]}):ae?null:(0,O.jsx)(al,{node:e,now:C}),de=Kc(t),fe=de.includes(e.missionId)?de:[...de,e.missionId],K=pt(e.lifecycleStatus),pe=()=>Ol(e,n,ht,Uc),me=()=>Ol(e,n,mt,Uc),he=t=>{let n=qc(fe,e.missionId,t);n&&u?.(n)};return Gc({enabled:B&&!T&&!j,onAffirm:V?me:void 0,onDecline:ie?pe:void 0,onPauseToggle:K?()=>void G(e.missionId,K.next):void 0,onShowHelp:()=>M(!0),onGoTo:re?e=>el(e):void 0,onStepMission:u?he:void 0,onStepNeedsYou:u&&d.length?t=>{let n=Jc(d,e.missionId,t);n&&n!==e.missionId&&u?.(n)}:void 0}),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(fi,{open:j,onClose:()=>M(!1)}),(0,O.jsx)(ds,{onBack:r,header:se,notices:le,metrics:a===`details`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Il,{changes:re?N:void 0,onDismiss:()=>P(void 0)}),ue]}):null,presentation:a,onPresentationChange:o,switcher:B&&u?(0,O.jsx)(ol,{position:fe.indexOf(e.missionId)+1,total:fe.length,onStep:he}):void 0,actions:B?(0,O.jsx)(sl,{affirm:V?{label:V.label,run:me}:void 0,decline:ie?{label:ie.label,run:pe}:void 0}):void 0,children:(0,O.jsxs)(`div`,{ref:R,className:`scroll-mt-4`,children:[a===`room`&&(0,O.jsx)(El,{node:e,fleetMissions:t,decisions:n,onOpenDecisions:ee?L:void 0,onSelectWorker:E,onReviewMissionSelect:l,reviewMissions:f,selectedReviewMissionId:p,onReviewClear:m,studioMissions:h,selectedStudioMissionId:_,onStudioMissionSelect:v,onStudioClear:y,requestedPanel:D}),a===`details`&&(0,O.jsx)(tl,{node:e,decisions:n,defaultModelLabel:S,elapsedMs:Math.max(0,z-e.createdAt),onSelectWorker:E,onOpenDecisions:ee?L:void 0}),T&&(0,O.jsx)(ss,{missionId:e.missionId,worker:e.workers.find(e=>e.id===T.id&&e.jobId===T.jobId)??T,plan:e.plan,events:e.recentEvents,onClose:()=>{E(null),c?.()}})]})})]})}function Ul(e){let t=typeof Notification<`u`,[n,r]=(0,g.useState)(()=>t&&Notification.permission===`granted`&&localStorage.getItem(`hive:decision-notifications`)===`on`),i=(0,g.useRef)(null);(0,g.useEffect)(()=>{if(!i.current){i.current=new Set(e.map(e=>e.id));return}for(let t of e)i.current.has(t.id)||(i.current.add(t.id),n&&Notification.permission===`granted`&&new Notification(`Hive · ${t.missionName}`,{body:t.question,tag:`hive-decision:${t.id}`}))},[e,n]);async function a(){if(t){if(n){r(!1),localStorage.setItem(`hive:decision-notifications`,`off`);return}(Notification.permission===`granted`?`granted`:await Notification.requestPermission())===`granted`&&(r(!0),localStorage.setItem(`hive:decision-notifications`,`on`))}}return{supported:t,enabled:n,toggle:a}}var Wl;function Gl(){try{return Wl??=new AudioContext,Wl.state===`suspended`&&Wl.resume(),Wl}catch{return}}function Kl(e,t,n,r){let i=e.createOscillator(),a=e.createGain();i.type=`sine`,i.frequency.value=t,a.gain.setValueAtTime(0,n),a.gain.linearRampToValueAtTime(.07,n+.015),a.gain.exponentialRampToValueAtTime(5e-4,n+r),i.connect(a).connect(e.destination),i.start(n),i.stop(n+r+.05)}function ql(){let e=Gl();if(!e)return;let t=e.currentTime;Kl(e,659.25,t,.16),Kl(e,880,t+.14,.22)}function Jl(){let e=Gl();if(!e)return;let t=e.currentTime;Kl(e,523.25,t,.18),Kl(e,659.25,t+.13,.18),Kl(e,783.99,t+.26,.3)}function Yl(e){let[t,n]=(0,g.useState)(()=>typeof window<`u`&&localStorage.getItem(`hive:sounds`)===`on`),r=(0,g.useRef)(null);return(0,g.useEffect)(()=>{if(!e)return;let n=new Map(e.orchestrators.map(e=>[e.missionId,{activity:e.activityStatus,lifecycle:e.lifecycleStatus}])),i=r.current;if(r.current=n,!i||!t)return;let a=!1,o=!1;for(let[e,t]of n){let n=i.get(e);t.lifecycle===`ready_for_review`&&n?.lifecycle!==`ready_for_review`?o=!0:t.lifecycle===`active`&&t.activity===`waiting_on_you`&&n?.activity!==`waiting_on_you`&&(a=!0)}o&&Jl(),a&&window.setTimeout(ql,o?700:0)},[e,t]),{enabled:t,toggle:()=>n(e=>{let t=!e;try{localStorage.setItem(`hive:sounds`,t?`on`:`off`)}catch{}return t&&ql(),t})}}var Xl=`hive:drawer-width`,Zl=[{id:`chat`,label:`Chat`},{id:`plan`,label:`Plan`},{id:`workers`,label:`Workers`},{id:`activity`,label:`Activity`},{id:`log`,label:`Terminal`}];function Ql(e){return Math.min(900,Math.max(380,Math.round(e)))}function $l(){if(typeof window>`u`)return 520;let e=Number(localStorage.getItem(Xl));return Number.isFinite(e)&&e>0?Ql(e):520}function eu({node:e,decisions:t,width:n,onWidthChange:r,onClose:i,onExpand:a,workerId:o,onWorkerChange:s}){let[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(()=>e.lifecycleStatus===`ready_for_review`?`review`:`chat`),f=e.lifecycleStatus===`ready_for_review`?[{id:`review`,label:`Review`},...Zl]:Zl,p=(0,g.useRef)();Ke(!0,ze.panel,()=>{_t(document.activeElement)?.closest(`input, textarea, select, [role='menu']`)||i()}),(0,g.useEffect)(()=>{if(typeof document>`u`)return;let e=e=>{let t=_t(e.target);t&&(t.closest(`[data-mission-drawer]`)||t.closest(`[data-workspace-control]`)||t.closest(`[data-mission-card]`)||t.closest(`[role='dialog'], [role='menu']`)||i())};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[i]);let m=(0,g.useCallback)(e=>{e.preventDefault(),l(!0);let t=e=>{p.current&&cancelAnimationFrame(p.current),p.current=requestAnimationFrame(()=>r(Ql(window.innerWidth-e.clientX)))},n=()=>{l(!1),window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n)},[r]),h=Pn(e.recentEvents),_=e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`,v=t.length>0,y=o?e.workers.find(e=>e.id===o):void 0;return(0,g.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{if(e.key!==`[`&&e.key!==`]`||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||_t(e.target)?.closest(`input, textarea, select`))return;e.preventDefault();let t=(Zl.findIndex(e=>e.id===u)+(e.key===`]`?1:Zl.length-1))%Zl.length;d(Zl[t].id)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u]),(0,O.jsxs)(`aside`,{"data-mission-drawer":e.missionId,"aria-label":`Mission ${e.name}`,style:{width:n},className:`fixed right-0 top-0 z-40 flex h-screen flex-col border-l border-white/10 bg-[#0d0d10] shadow-2xl shadow-black/50`,children:[(0,O.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize mission panel`,onPointerDown:m,className:`absolute left-0 top-0 h-full w-1.5 cursor-col-resize transition ${c?`bg-amber-300/40`:`bg-transparent hover:bg-amber-300/25`}`}),(0,O.jsxs)(`header`,{className:`shrink-0 border-b border-white/[0.07] px-4 py-3.5`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(Ye,{missionId:e.missionId,name:e.name}),(0,O.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-1.5`,children:[e.mission.repository&&(0,O.jsx)(`span`,{className:`mono max-w-40 truncate rounded bg-white/[0.055] px-1.5 py-0.5 text-[10px] text-white/50`,title:e.mission.repository,children:tt(e.mission.repository)}),e.worktreeBranch&&(0,O.jsx)(`span`,{className:`mono max-w-40 truncate rounded bg-emerald-300/[0.08] px-1.5 py-0.5 text-[10px] text-emerald-200/65`,title:e.worktreeBranch,children:nt(e.worktreeBranch)}),(0,O.jsxs)(`span`,{className:`mono text-[10px] text-white/25`,children:[e.mission.mode,` · `,e.mission.provider??`claude`]})]})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:a,title:`Open the full mission — plan, workers, activity`,"aria-label":`Open full mission`,className:`rounded-md border border-white/12 px-2 py-1 text-[11px] text-white/45 transition hover:border-amber-300/25 hover:text-amber-100/80`,children:`⤢`}),(0,O.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`Close mission panel`,className:`rounded-md border border-white/12 px-2 py-1 text-[11px] text-white/45 transition hover:border-white/25 hover:text-white/80`,children:`✕`})]})]}),(0,O.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-1.5`,children:[it(e.lifecycleStatus,e.activityStatus)&&(0,O.jsx)(A,{status:e.activityStatus}),(_||e.lifecycleStatus!==`active`)&&(0,O.jsx)(mn,{status:e.lifecycleStatus}),(0,O.jsx)(`span`,{className:`ml-auto`,children:(0,O.jsx)(dr,{missionId:e.missionId,status:e.lifecycleStatus,compact:!0,onDeleted:i})})]})]}),(0,O.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-white/[0.07] px-4 py-3`,children:[e.mission.objective&&(0,O.jsx)(`p`,{className:`text-xs leading-relaxed text-white/45`,title:e.mission.objective,children:(0,O.jsx)(`span`,{className:`line-clamp-2`,children:e.mission.objective})}),(0,O.jsx)(Un,{event:h,fallback:e.detail??e.intent,working:e.activityStatus===`working`}),(0,O.jsx)(nr,{alerts:e.alerts??[]}),(0,O.jsx)(Xn,{plan:e.plan,waitingFor:e.waitingFor,blocked:e.lifecycleStatus===`active`&&e.activityStatus===`waiting_on_you`,onOpenPlan:u===`plan`?void 0:()=>d(`plan`)})]}),y&&(0,O.jsx)(ss,{missionId:e.missionId,worker:y,plan:e.plan,events:e.recentEvents,onClose:()=>s(void 0)}),(0,O.jsx)(`nav`,{"aria-label":`Mission panel`,className:`flex shrink-0 gap-1 border-b border-white/[0.07] px-3 py-1.5`,children:f.map(({id:t,label:n})=>(0,O.jsxs)(`button`,{type:`button`,"aria-current":u===t?`page`:void 0,onClick:()=>d(t),className:`rounded-md px-2.5 py-1 text-[11px] font-medium transition ${u===t?`bg-amber-300/[0.1] text-amber-100/85`:`text-white/35 hover:bg-white/[0.04] hover:text-white/65`}`,children:[t===`chat`&&v?`Answer`:n,t===`chat`&&v&&(0,O.jsx)(`span`,{className:`ml-1.5 inline-block h-1.5 w-1.5 rounded-full bg-rose-400 align-middle`}),t===`workers`&&e.workers.length>0&&(0,O.jsx)(`span`,{className:`ml-1 text-white/25`,children:e.workers.length})]},t))}),(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[u===`review`&&(0,O.jsx)(`div`,{className:`px-3 py-3`,children:(0,O.jsx)(Qc,{node:e,compact:!0})}),u===`chat`&&(0,O.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,O.jsx)(Rs,{missionId:e.missionId,messages:e.messages,events:e.recentEvents,hasMoreMessages:e.hasMoreMessages,repository:e.mission.repository,provider:e.mission.provider,decisions:t,autoFocus:!0,live:{status:e.activityStatus,lifecycle:e.lifecycleStatus,detail:e.detail,waitingFor:e.waitingFor,plan:e.plan,workers:e.workers,inFlight:e.inFlight,prs:e.prs},contained:!0})}),u===`plan`&&(0,O.jsx)(`div`,{className:`px-3 py-3`,children:(0,O.jsx)(Vc,{missionId:e.missionId,plan:e.plan,objective:e.mission.objective,missionAcceptanceCriteria:e.mission.acceptanceCriteria,workers:e.workers,missionUpdatedAt:e.updatedAt,approvalRequired:e.mission.planFirst,compact:!0})}),u===`workers`&&(0,O.jsxs)(`div`,{className:`space-y-3 px-3 py-3`,children:[(0,O.jsx)(ur,{prs:e.prs,messages:e.messages}),(0,O.jsx)(Ys,{workers:e.workers,narrow:!0,onSelect:e=>s(e.id)})]}),u===`activity`&&(0,O.jsx)(`div`,{className:`px-3 py-3`,children:(0,O.jsx)(qr,{events:e.recentEvents,compact:!0})}),u===`log`&&(0,O.jsx)(`div`,{className:`px-3 py-3`,children:(0,O.jsx)(uc,{missionId:e.missionId,live:e.activityStatus===`working`})})]})]})}function tu({missions:e,onRemove:t,onClose:n,onOpenMission:r,onReorder:i}){let a=(0,g.useRef)([]),[o,s]=(0,g.useState)(),[c,l]=(0,g.useState)(()=>typeof window<`u`&&localStorage.getItem(`hive:workspace-density`)===`compact`?`compact`:`comfortable`),[u,d]=(0,g.useState)(()=>typeof window>`u`?50:Number(localStorage.getItem(`hive:workspace-split`)??50)),[f,p]=(0,g.useState)({}),[m,h]=(0,g.useState)(),_=e=>{l(e);try{localStorage.setItem(`hive:workspace-density`,e)}catch{}},v=e=>{d(e);try{localStorage.setItem(`hive:workspace-split`,String(e))}catch{}};(0,g.useEffect)(()=>{let n=n=>{if(!(n.metaKey||n.ctrlKey)||n.altKey||yt(n.target))return;if(n.shiftKey&&m){let r=e.findIndex(e=>e.missionId===m);if(n.key===`ArrowLeft`||n.key===`ArrowRight`){n.preventDefault();let t=r+(n.key===`ArrowLeft`?-1:1);if(t>=0&&t<e.length){let n=e.map(e=>e.missionId);[n[r],n[t]]=[n[t],n[r]],i?.(n)}return}if(n.key.toLowerCase()===`m`){n.preventDefault(),s(e=>e===m?void 0:m);return}if(n.key===`Backspace`||n.key===`Delete`){n.preventDefault(),t(m);return}}if(n.shiftKey)return;let r=Number(n.key)-1;!Number.isInteger(r)||r<0||r>=e.length||(n.preventDefault(),a.current[r]?.focus())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[m,e,t,i]);let y=o?e.filter(e=>e.missionId===o):e;return(0,O.jsxs)(`section`,{role:`dialog`,"aria-label":`Multi-mission workspace`,className:`fixed inset-x-3 bottom-3 z-40 flex max-h-[68vh] min-h-[420px] flex-col overflow-hidden rounded-2xl border border-violet-300/20 bg-[#0b0b0f]/98 shadow-[0_0_60px_rgba(0,0,0,0.75)] backdrop-blur-xl`,children:[(0,O.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-b border-white/[0.08] px-4 py-2.5`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-violet-200/60`,children:`Mission workspace`}),(0,O.jsxs)(`span`,{className:`rounded-full bg-violet-300/10 px-2 py-0.5 text-[9px] text-violet-100/50`,children:[e.length,`/4 pinned`]}),(0,O.jsxs)(`span`,{className:`hidden text-[9px] text-white/20 sm:inline`,children:[`⌘1–`,e.length,` focuses`]})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>void Promise.all(e.filter(e=>e.lifecycleStatus===`active`).map(e=>G(e.missionId,`paused`))),className:`text-[10px] text-white/40`,children:`Pause all eligible`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>void Promise.all(e.map(e=>de(e.missionId,`status_summary`))),className:`text-[10px] text-white/40`,children:`Refresh status`}),(0,O.jsxs)(`select`,{"aria-label":`Workspace density`,value:c,onChange:e=>_(e.target.value),className:`rounded border border-white/10 bg-[#111116] px-1.5 py-1 text-[9px] text-white/45`,children:[(0,O.jsx)(`option`,{value:`comfortable`,children:`Comfortable`}),(0,O.jsx)(`option`,{value:`compact`,children:`Compact`})]}),y.length===2&&(0,O.jsx)(`input`,{"aria-label":`Pane split`,title:`Adjust pane widths`,type:`range`,min:`30`,max:`70`,value:u,onChange:e=>v(Number(e.target.value)),className:`w-20`}),o&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>s(void 0),className:`text-[10px] text-white/40 hover:text-white/70`,children:`Show all`}),(0,O.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md border border-white/10 px-2 py-1 text-[10px] text-white/45 hover:text-white/75`,children:`Minimize`})]})]}),(0,O.jsx)(`div`,{style:y.length===2?{"--workspace-columns":`${u}% ${100-u}%`}:void 0,className:`grid min-h-0 flex-1 gap-px overflow-hidden bg-white/[0.06] ${y.length===1?`grid-cols-1`:y.length>2?`grid-cols-1 lg:grid-cols-2`:`grid-cols-1 lg:grid-cols-[var(--workspace-columns)]`}`,children:y.map(n=>{let l=e.findIndex(e=>e.missionId===n.missionId),u=pt(n.lifecycleStatus),d=n.plan?.phases.flatMap(e=>e.tasks).find(e=>e.status===`working`||e.status===`reviewing`||e.status===`blocked`),m=n.workers.find(e=>!e.doneAt),g=n.updatedAt>(f[n.missionId]??n.updatedAt),_=t=>{let n=e.map(e=>e.missionId),r=l+t;r<0||r>=n.length||([n[l],n[r]]=[n[r],n[l]],i?.(n))};return(0,O.jsxs)(`article`,{ref:e=>{a.current[l]=e},onFocusCapture:()=>{h(n.missionId),p(e=>({...e,[n.missionId]:n.updatedAt}))},tabIndex:-1,className:`flex min-h-0 flex-col bg-[#0f0f14] outline-none focus:ring-2 focus:ring-inset focus:ring-violet-300/35`,children:[(0,O.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-white/[0.06] px-3 py-2`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>r(n.missionId),className:`min-w-0 text-left`,children:[(0,O.jsx)(`span`,{className:`block truncate text-xs font-semibold text-white/75`,children:n.name}),(0,O.jsxs)(`span`,{className:`block truncate text-[9px] text-white/25`,children:[n.mission.repository?.split(`/`).filter(Boolean).at(-1)??`No repository`,` · pane `,l+1]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,O.jsx)(mn,{status:n.lifecycleStatus}),(0,O.jsx)(A,{status:n.activityStatus}),u&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>void G(n.missionId,u.next),className:`rounded border border-white/8 px-1.5 py-1 text-[9px] text-white/35`,children:u.label}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>s(o?void 0:n.missionId),title:`Maximize pane`,className:`rounded border border-white/8 px-1.5 py-1 text-[9px] text-white/35`,children:o?`⊞`:`□`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>t(n.missionId),title:`Remove from workspace`,className:`rounded border border-white/8 px-1.5 py-1 text-[9px] text-white/35`,children:`×`})]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-white/[0.04] px-3 py-1.5 text-[9px] text-white/28`,children:[g&&(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-sky-300 motion-reduce:animate-none`,title:`Unread updates`}),(0,O.jsx)(`span`,{className:`truncate`,children:d?`Task: ${d.title}`:n.waitingFor?`Blocked: ${n.waitingFor}`:`No active task`}),m&&(0,O.jsx)(`span`,{className:`ml-auto truncate text-violet-200/40`,children:m.label}),(0,O.jsx)(`button`,{type:`button`,disabled:l===0,onClick:()=>_(-1),"aria-label":`Move pane left`,children:`←`}),(0,O.jsx)(`button`,{type:`button`,disabled:l===e.length-1,onClick:()=>_(1),"aria-label":`Move pane right`,children:`→`})]}),(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto ${c===`compact`?`p-1`:`p-2`}`,children:[n.lifecycleStatus===`ready_for_review`&&(0,O.jsx)(Qc,{node:n,compact:!0}),(0,O.jsx)(Rs,{missionId:n.missionId,repository:n.mission.repository,provider:n.mission.provider,messages:n.messages,events:n.recentEvents,hasMoreMessages:n.hasMoreMessages,live:{status:n.activityStatus,lifecycle:n.lifecycleStatus,detail:n.detail,waitingFor:n.waitingFor,plan:n.plan,workers:n.workers,inFlight:n.inFlight,prs:n.prs},contained:!0})]})]},n.missionId)})})]})}var nu=`hive:mission-workspace`;function ru(){let{snapshot:e,connected:t,lastDisconnectedAt:n,reconnect:r}=E(),[i,a]=bl(),[o,s]=(0,g.useState)(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`mission`)),[c,l]=(0,g.useState)(()=>typeof window<`u`&&new URLSearchParams(window.location.search).get(`presentation`)===`room`?`room`:i.missionPresentation),[u,d]=(0,g.useState)(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`worker`)),[f,p]=(0,g.useState)(()=>typeof window<`u`&&new URLSearchParams(window.location.search).get(`view`)===`full`?`full`:`drawer`),[m,h]=(0,g.useState)($l),[_,v]=(0,g.useState)(()=>{if(typeof window>`u`)return[];try{return JSON.parse(localStorage.getItem(nu)??`[]`).slice(0,4)}catch{return[]}}),[y,b]=(0,g.useState)(()=>_.length>0),x=e=>{v(e);try{localStorage.setItem(nu,JSON.stringify(e))}catch{}},S=e=>{x(_.includes(e)?_:[..._,e].slice(-4)),b(!0)},C=e=>x(_.filter(t=>t!==e)),w=e=>{let t=Ql(e);h(t);try{localStorage.setItem(Xl,String(t))}catch{}},[T,D]=(0,g.useState)(()=>typeof window<`u`&&new URLSearchParams(window.location.search).get(`space`)===`direct-studio`),[k,A]=(0,g.useState)(()=>typeof window<`u`&&new URLSearchParams(window.location.search).get(`space`)===`review`),j=Ul(e?.decisions??[]),M=Yl(e??void 0),N=(e,t)=>{if(typeof window>`u`)return;let n=new URL(window.location.href);e(n.searchParams),n.href!==window.location.href&&(t===`push`?window.history.pushState({},``,n):window.history.replaceState({},``,n))},P=(e,t,n)=>{let r=t??i.missionPresentation,a=e===o&&e!==null&&r===c;s(e),l(r),d(n??null),p(`drawer`),N(t=>{e?t.set(`mission`,e):t.delete(`mission`),e&&r===`room`?t.set(`presentation`,`room`):t.delete(`presentation`),e&&n?t.set(`worker`,n):t.delete(`worker`),t.delete(`view`)},a?`replace`:`push`)},F=e=>{e!==o&&(s(e),d(null),N(t=>{t.set(`mission`,e),t.delete(`worker`)},`replace`))},I=()=>{d(null),N(e=>e.delete(`worker`),`replace`)},L=()=>{p(`full`),N(e=>e.set(`view`,`full`),`push`)},ee=()=>{p(`drawer`),N(e=>e.delete(`view`),`replace`)},R=e=>{D(!0),s(e??null),d(null),l(`room`),N(t=>{t.set(`space`,`direct-studio`),t.set(`presentation`,`room`),e?t.set(`mission`,e):t.delete(`mission`),t.delete(`worker`)},T?`replace`:`push`)},te=()=>{D(!1),s(null),N(e=>{e.delete(`space`),e.delete(`mission`),e.delete(`presentation`)},`push`)},z=e=>{A(!0),s(e??null),d(null),l(`room`),N(t=>{t.set(`space`,`review`),t.set(`presentation`,`room`),e?t.set(`mission`,e):t.delete(`mission`),t.delete(`worker`)},k?`replace`:`push`)},ne=()=>{A(!1),s(null),N(e=>{e.delete(`space`),e.delete(`mission`),e.delete(`presentation`)},`push`)};(0,g.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{let e=new URLSearchParams(window.location.search);s(e.get(`mission`)),d(e.get(`worker`)),D(e.get(`space`)===`direct-studio`),A(e.get(`space`)===`review`),l(e.get(`presentation`)===`room`?`room`:i.missionPresentation),p(e.get(`view`)===`full`?`full`:`drawer`)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[i.missionPresentation]),Ke(!!o||T||k,ze.page,()=>{let e=document.activeElement;if(e&&(e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName))){e.blur?.();return}T?te():k?ne():P(null)});let B=(0,g.useMemo)(()=>e?Yc(Ci(e)):[],[e]),re=(0,g.useMemo)(()=>e?wo(e.orchestrators,i.roomAssignments).placements:[],[i.roomAssignments,e]),V=(0,g.useMemo)(()=>re.filter(e=>e.floorIndex===0&&e.spaceId===`direct-studio`).sort((e,t)=>e.seatIndex-t.seatIndex).map(e=>e.mission),[re]),ie=(0,g.useMemo)(()=>re.filter(e=>e.spaceId===`review`).sort((e,t)=>e.seatIndex-t.seatIndex).map(e=>e.mission),[re]);(0,g.useEffect)(()=>{e&&(k&&!ie.length&&ne(),T&&!V.length&&te())},[V.length,ie.length,k,T,e]);let ae=e=>{let t=e===`office`?`room`:`details`;if(a(n=>({...n,fleetPresentation:e,missionPresentation:t})),l(t),typeof window<`u`){let e=new URL(window.location.href);(o||T)&&t===`room`?e.searchParams.set(`presentation`,`room`):e.searchParams.delete(`presentation`),T&&t===`details`&&e.searchParams.delete(`space`),window.history.replaceState({},``,e)}T&&t===`details`&&D(!1)};if((0,g.useEffect)(()=>{if(!e)return;let t=new Set(e.orchestrators.map(e=>e.missionId)),n=_.filter(e=>t.has(e));n.length!==_.length&&x(n)},[e,_]),(0,g.useEffect)(()=>{let e=e=>{e.key!==`Enter`||!e.shiftKey||e.metaKey||e.ctrlKey||e.altKey||!o||yt(e.target)||(e.preventDefault(),S(o))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}),!e)return(0,O.jsx)(`div`,{className:`flex h-screen items-center justify-center px-6`,children:(0,O.jsxs)(`div`,{className:`max-w-md rounded-2xl border border-white/10 bg-white/[0.025] p-6 text-center`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium text-white/55`,children:t?`Loading fleet…`:`Connecting to Hive…`}),(0,O.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-white/25`,children:t?`The server is connected and preparing the durable mission snapshot.`:`Make sure npm run dev is running. Hive will retry automatically.`}),!t&&(0,O.jsx)(`button`,{onClick:r,className:`mt-4 rounded-lg border border-amber-300/15 bg-amber-300/[0.05] px-3 py-2 text-xs text-amber-200/60 hover:bg-amber-300/[0.09]`,children:`Retry now`})]})});let H=o?e.orchestrators.find(e=>e.missionId===o):void 0,U=_.map(t=>e.orchestrators.find(e=>e.missionId===t)).filter(e=>!!e),W=y&&U.length>0?(0,O.jsx)(tu,{missions:U,onRemove:C,onReorder:x,onClose:()=>b(!1),onOpenMission:e=>{b(!1),P(e,`details`)}}):null;if(T&&V.length){let i=V.find(e=>e.missionId===o);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(iu,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,O.jsx)(Hl,{node:i??V[0],fleetMissions:e.orchestrators,decisions:i?(e.decisions??[]).filter(e=>e.missionId===i.missionId):[],initialPresentation:`room`,presentation:`room`,onPresentationChange:ae,studioMissions:V,selectedStudioMissionId:i?.missionId,onStudioMissionSelect:e=>R(e),onStudioClear:()=>R(),onBack:te}),W]})}if(k&&ie.length){let i=ie.find(e=>e.missionId===o);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(iu,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,O.jsx)(Hl,{node:i??ie[0],fleetMissions:e.orchestrators,decisions:i?(e.decisions??[]).filter(e=>e.missionId===i.missionId):[],onBack:ne,presentation:`room`,onPresentationChange:ae,reviewMissions:ie,selectedReviewMissionId:o??void 0,onReviewMissionSelect:z,onReviewClear:()=>z(void 0)}),W]})}return H&&(f===`full`||c===`room`)?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(iu,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,O.jsx)(Hl,{node:H,fleetMissions:e.orchestrators,decisions:(e.decisions??[]).filter(e=>e.missionId===H.missionId),initialPresentation:c,presentation:c,onPresentationChange:ae,initialWorkerId:u??void 0,onWorkerClose:I,onReviewMissionSelect:e=>P(e,`room`),needsYouMissionIds:B,onStepMission:e=>{s(e),d(null),p(`full`),window.scrollTo?.({top:0}),N(t=>{t.set(`mission`,e),t.set(`view`,`full`)},`push`)},onBack:()=>{ee(),P(null)}},H.missionId),W]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(iu,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,O.jsx)(`div`,{style:H?{paddingRight:m}:void 0,className:`transition-[padding] duration-150`,children:(0,O.jsx)(ns,{snapshot:e,connected:t,officePreferences:i,setOfficePreferences:a,onPresentationChange:ae,onSelectOrchestrator:(e,t,n)=>P(e,t,n),activeMissionId:H?.missionId,onFollowMission:F,onPinWorkspace:S,onOpenFullMission:e=>{s(e),p(`full`),N(t=>{t.set(`mission`,e),t.set(`view`,`full`)},`push`)},onSelectDirectStudio:R,onSelectReviewHall:z,notifications:j,sounds:M})}),H&&(0,O.jsx)(eu,{node:H,decisions:(e.decisions??[]).filter(e=>e.missionId===H.missionId),width:m,onWidthChange:w,onClose:()=>P(null),onExpand:L,workerId:u??void 0,onWorkerChange:e=>{d(e??null),N(t=>{e?t.set(`worker`,e):t.delete(`worker`)},`replace`)}},H.missionId),(H||U.length>0)&&(0,O.jsxs)(`div`,{"data-workspace-control":!0,className:`fixed bottom-4 left-4 z-50 flex items-center gap-2`,children:[H&&!_.includes(H.missionId)&&_.length<4&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>S(H.missionId),className:`rounded-full border border-violet-300/25 bg-[#17131f]/95 px-3 py-2 text-[10px] font-medium text-violet-100/70 shadow-xl`,children:[`Pin to workspace `,(0,O.jsx)(`span`,{className:`ml-1 text-white/25`,children:`⇧↵`})]}),U.length>0&&!y&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),className:`rounded-full border border-violet-300/25 bg-[#17131f]/95 px-3 py-2 text-[10px] font-medium text-violet-100/70 shadow-xl`,children:[`Open workspace · `,U.length]})]}),W]})}function iu({connected:e,lastDisconnectedAt:t,reconnect:n}){return e?null:(0,O.jsxs)(`div`,{role:`status`,className:`sticky top-0 z-40 flex flex-wrap items-center justify-center gap-2 border-b border-orange-300/15 bg-[#261a0f]/95 px-4 py-2 text-xs text-orange-100/65 backdrop-blur`,children:[(0,O.jsxs)(`span`,{children:[`Live updates disconnected`,t?` at ${new Date(t).toLocaleTimeString()}`:``,`. Showing the last durable snapshot.`]}),(0,O.jsx)(`button`,{onClick:n,className:`rounded-md border border-orange-200/15 px-2 py-1 text-[10px] font-medium text-orange-100/70 hover:bg-orange-200/[0.08]`,children:`Reconnect now`}),(0,O.jsx)(`span`,{className:`text-orange-100/30`,children:`If this persists, restart npm run dev; mission data remains on disk.`})]})}h.createRoot(document.getElementById(`root`)).render((0,O.jsx)(g.StrictMode,{children:(0,O.jsx)(ru,{})}));
|