@shanesaravia/hive 0.2.0 → 0.3.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 +53 -0
- package/README.md +16 -0
- package/node_modules/@hive/shared/dist/directStudio.d.ts +6 -0
- package/node_modules/@hive/shared/dist/directStudio.js +12 -0
- package/node_modules/@hive/shared/dist/index.d.ts +2 -0
- package/node_modules/@hive/shared/dist/index.js +2 -0
- package/node_modules/@hive/shared/dist/reviewHall.d.ts +15 -0
- package/node_modules/@hive/shared/dist/reviewHall.js +49 -0
- package/node_modules/@hive/shared/dist/types.d.ts +29 -0
- package/node_modules/@hive/shared/dist/workers.d.ts +14 -0
- package/node_modules/@hive/shared/dist/workers.js +22 -0
- package/package.json +1 -1
- package/packages/server/dist/api/rest.js +130 -11
- package/packages/server/dist/api/ws.js +25 -8
- package/packages/server/dist/control/launcher.js +50 -11
- package/packages/server/dist/control/messaging.js +3 -2
- package/packages/server/dist/health/deriveAlerts.js +1 -2
- package/packages/server/dist/hooks/hookIngest.js +69 -10
- package/packages/server/dist/index.js +20 -4
- package/packages/server/dist/messages/messagesStore.js +25 -12
- package/packages/server/dist/missions/missionsStore.js +19 -0
- package/packages/server/dist/missions/reopenOnWork.js +20 -0
- package/packages/server/dist/plans/planReconcile.js +114 -0
- package/packages/server/dist/plans/plansStore.js +46 -3
- package/packages/server/dist/roster/missionReplay.js +82 -0
- package/packages/server/dist/roster/rosterBuilder.js +93 -189
- package/packages/server/dist/roster/workerIdentity.js +886 -0
- package/packages/server/dist/watch/jobsWatcher.js +55 -24
- package/packages/server/dist/worktrees/worktreeReclaim.js +156 -0
- package/packages/web/dist/assets/index-BpEYVjCF.css +2 -0
- package/packages/web/dist/assets/index-rIAIJyuF.js +12 -0
- package/packages/web/dist/index.html +2 -2
- package/templates/agents/hive-orchestrator.md +1 -0
- package/packages/web/dist/assets/index-BrkIk6ny.js +0 -11
- package/packages/web/dist/assets/index-DJFn_ZsI.css +0 -2
|
@@ -0,0 +1,12 @@
|
|
|
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},ee={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function I(){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=ee,e.act=I,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=I,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`),ee=Symbol.for(`react.offscreen`),I=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=I&&e[I]||e[`@@iterator`],typeof e==`function`?e:null)}var L=Object.assign,R;function z(e){if(R===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);R=t&&t[1]||``}return`
|
|
2
|
+
`+R+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 V(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 re(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?re(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return re(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 re(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 oe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function se(e){var t=oe(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 ce(e){e._valueTracker||=se(e)}function H(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=oe(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function le(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 ue(e,t){var n=t.checked;return L({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function de(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 fe(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function pe(e,t){fe(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`)?he(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&he(e,t.type,ae(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function me(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 he(e,t,n){(t!==`number`||le(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var U=Array.isArray;function ge(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 _e(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return L({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function ve(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(U(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:ae(n)}}function ye(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 be(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function xe(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 Se(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?xe(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Ce,we=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(Ce||=document.createElement(`div`),Ce.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Ce.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Te(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ee={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},De=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ee).forEach(function(e){De.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ee[t]=Ee[e]})});function Oe(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ee.hasOwnProperty(e)&&Ee[e]?(``+t).trim():t+`px`}function ke(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Oe(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ae=L({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 je(e,t){if(t){if(Ae[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 Me(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 Ne=null;function Pe(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fe=null,Ie=null,Le=null;function Re(e){if(e=Fi(e)){if(typeof Fe!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Li(t),Fe(e.stateNode,e.type,t))}}function ze(e){Ie?Le?Le.push(e):Le=[e]:Ie=e}function Be(){if(Ie){var e=Ie,t=Le;if(Le=Ie=null,Re(e),t)for(e=0;e<t.length;e++)Re(t[e])}}function Ve(e,t){return e(t)}function He(){}var Ue=!1;function We(e,t,n){if(Ue)return e(t,n);Ue=!0;try{return Ve(e,t,n)}finally{Ue=!1,(Ie!==null||Le!==null)&&(He(),Be())}}function Ge(e,t){var n=e.stateNode;if(n===null)return null;var i=Li(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 Ke=!1;if(c)try{var qe={};Object.defineProperty(qe,"passive",{get:function(){Ke=!0}}),window.addEventListener(`test`,qe,qe),window.removeEventListener(`test`,qe,qe)}catch{Ke=!1}function Je(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 Ye=!1,Xe=null,Ze=!1,Qe=null,$e={onError:function(e){Ye=!0,Xe=e}};function et(e,t,n,r,i,a,o,s,c){Ye=!1,Xe=null,Je.apply($e,arguments)}function tt(e,t,n,i,a,o,s,c,l){if(et.apply(this,arguments),Ye){if(Ye){var u=Xe;Ye=!1,Xe=null}else throw Error(r(198));Ze||(Ze=!0,Qe=u)}}function nt(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 rt(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 it(e){if(nt(e)!==e)throw Error(r(188))}function at(e){var t=e.alternate;if(!t){if(t=nt(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 it(a),e;if(o===i)return it(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 ot(e){return e=at(e),e===null?null:st(e)}function st(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=st(e);if(t!==null)return t;e=e.sibling}return null}var ct=n.unstable_scheduleCallback,lt=n.unstable_cancelCallback,ut=n.unstable_shouldYield,dt=n.unstable_requestPaint,ft=n.unstable_now,pt=n.unstable_getCurrentPriorityLevel,mt=n.unstable_ImmediatePriority,ht=n.unstable_UserBlockingPriority,gt=n.unstable_NormalPriority,_t=n.unstable_LowPriority,vt=n.unstable_IdlePriority,yt=null,bt=null;function xt(e){if(bt&&typeof bt.onCommitFiberRoot==`function`)try{bt.onCommitFiberRoot(yt,e,void 0,(e.current.flags&128)==128)}catch{}}var St=Math.clz32?Math.clz32:Tt,Ct=Math.log,wt=Math.LN2;function Tt(e){return e>>>=0,e===0?32:31-(Ct(e)/wt|0)|0}var Et=64,Dt=4194304;function Ot(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 kt(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=Ot(a))):r=Ot(s)}else o=n&~i,o===0?a!==0&&(r=Ot(a)):r=Ot(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-St(t),i=1<<n,r|=e[n],t&=~i;return r}function At(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 jt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-St(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=At(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Mt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Nt(){var e=Et;return Et<<=1,!(Et&4194240)&&(Et=64),e}function Pt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ft(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-St(t),e[t]=n}function It(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-St(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Lt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-St(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var W=0;function Rt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var zt,Bt,Vt,Ht,Ut,Wt=!1,Gt=[],Kt=null,qt=null,Jt=null,Yt=new Map,Xt=new Map,Zt=[],Qt=`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 $t(e,t){switch(e){case`focusin`:case`focusout`:Kt=null;break;case`dragenter`:case`dragleave`:qt=null;break;case`mouseover`:case`mouseout`:Jt=null;break;case`pointerover`:case`pointerout`:Yt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Xt.delete(t.pointerId)}}function en(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=Fi(t),t!==null&&Bt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function tn(e,t,n,r,i){switch(t){case`focusin`:return Kt=en(Kt,e,t,n,r,i),!0;case`dragenter`:return qt=en(qt,e,t,n,r,i),!0;case`mouseover`:return Jt=en(Jt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Yt.set(a,en(Yt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Xt.set(a,en(Xt.get(a)||null,e,t,n,r,i)),!0}return!1}function nn(e){var t=Pi(e.target);if(t!==null){var n=nt(t);if(n!==null){if(t=n.tag,t===13){if(t=rt(n),t!==null){e.blockedOn=t,Ut(e.priority,function(){Vt(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 rn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ne=r,n.target.dispatchEvent(r),Ne=null}else return t=Fi(n),t!==null&&Bt(t),e.blockedOn=n,!1;t.shift()}return!0}function an(e,t,n){rn(e)&&n.delete(t)}function on(){Wt=!1,Kt!==null&&rn(Kt)&&(Kt=null),qt!==null&&rn(qt)&&(qt=null),Jt!==null&&rn(Jt)&&(Jt=null),Yt.forEach(an),Xt.forEach(an)}function sn(e,t){e.blockedOn===t&&(e.blockedOn=null,Wt||(Wt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,on)))}function cn(e){function t(t){return sn(t,e)}if(0<Gt.length){sn(Gt[0],e);for(var n=1;n<Gt.length;n++){var r=Gt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Kt!==null&&sn(Kt,e),qt!==null&&sn(qt,e),Jt!==null&&sn(Jt,e),Yt.forEach(t),Xt.forEach(t),n=0;n<Zt.length;n++)r=Zt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Zt.length&&(n=Zt[0],n.blockedOn===null);)nn(n),n.blockedOn===null&&Zt.shift()}var ln=C.ReactCurrentBatchConfig,un=!0;function dn(e,t,n,r){var i=W,a=ln.transition;ln.transition=null;try{W=1,pn(e,t,n,r)}finally{W=i,ln.transition=a}}function fn(e,t,n,r){var i=W,a=ln.transition;ln.transition=null;try{W=4,pn(e,t,n,r)}finally{W=i,ln.transition=a}}function pn(e,t,n,r){if(un){var i=hn(e,t,n,r);if(i===null)oi(e,t,r,mn,n),$t(e,r);else if(tn(i,e,t,n,r))r.stopPropagation();else if($t(e,r),t&4&&-1<Qt.indexOf(e)){for(;i!==null;){var a=Fi(i);if(a!==null&&zt(a),a=hn(e,t,n,r),a===null&&oi(e,t,r,mn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else oi(e,t,r,null,n)}}var mn=null;function hn(e,t,n,r){if(mn=null,e=Pe(r),e=Pi(e),e!==null){if(t=nt(e),t===null)e=null;else if(n=t.tag,n===13){if(e=rt(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 mn=e,null}function gn(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(pt()){case mt:return 1;case ht:return 4;case gt:case _t:return 16;case vt:return 536870912;default:return 16}default:return 16}}var _n=null,vn=null,yn=null;function bn(){if(yn)return yn;var e,t=vn,n=t.length,r,i=`value`in _n?_n.value:_n.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 yn=i.slice(e,1<r?1-r:void 0)}function xn(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 Sn(){return!0}function Cn(){return!1}function wn(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)?Sn:Cn,this.isPropagationStopped=Cn,this}return L(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=Sn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Sn)},persist:function(){},isPersistent:Sn}),t}var Tn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},En=wn(Tn),Dn=L({},Tn,{view:0,detail:0}),On=wn(Dn),kn,An,jn,Mn=L({},Dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Un,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!==jn&&(jn&&e.type===`mousemove`?(kn=e.screenX-jn.screenX,An=e.screenY-jn.screenY):An=kn=0,jn=e),kn)},movementY:function(e){return`movementY`in e?e.movementY:An}}),Nn=wn(Mn),Pn=wn(L({},Mn,{dataTransfer:0})),Fn=wn(L({},Dn,{relatedTarget:0})),In=wn(L({},Tn,{animationName:0,elapsedTime:0,pseudoElement:0})),Ln=wn(L({},Tn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Rn=wn(L({},Tn,{data:0})),zn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Bn={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`},Vn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Hn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vn[e])?!!t[e]:!1}function Un(){return Hn}var Wn=wn(L({},Dn,{key:function(e){if(e.key){var t=zn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=xn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Bn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Un,charCode:function(e){return e.type===`keypress`?xn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?xn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Gn=wn(L({},Mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Kn=wn(L({},Dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Un})),qn=wn(L({},Tn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Jn=wn(L({},Mn,{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})),Yn=[9,13,27,32],Xn=c&&`CompositionEvent`in window,Zn=null;c&&`documentMode`in document&&(Zn=document.documentMode);var Qn=c&&`TextEvent`in window&&!Zn,$n=c&&(!Xn||Zn&&8<Zn&&11>=Zn),er=` `,tr=!1;function nr(e,t){switch(e){case`keyup`:return Yn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function rr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ir=!1;function ar(e,t){switch(e){case`compositionend`:return rr(t);case`keypress`:return t.which===32?(tr=!0,er):null;case`textInput`:return e=t.data,e===er&&tr?null:e;default:return null}}function or(e,t){if(ir)return e===`compositionend`||!Xn&&nr(e,t)?(e=bn(),yn=vn=_n=null,ir=!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 $n&&t.locale!==`ko`?null:t.data;default:return null}}var sr={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 cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!sr[e.type]:t===`textarea`}function lr(e,t,n,r){ze(r),t=ci(t,`onChange`),0<t.length&&(n=new En(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ur=null,dr=null;function fr(e){ti(e,0)}function pr(e){if(H(Ii(e)))return e}function mr(e,t){if(e===`change`)return t}var hr=!1;if(c){var gr;if(c){var _r=`oninput`in document;if(!_r){var vr=document.createElement(`div`);vr.setAttribute(`oninput`,`return;`),_r=typeof vr.oninput==`function`}gr=_r}else gr=!1;hr=gr&&(!document.documentMode||9<document.documentMode)}function yr(){ur&&(ur.detachEvent(`onpropertychange`,br),dr=ur=null)}function br(e){if(e.propertyName===`value`&&pr(dr)){var t=[];lr(t,dr,e,Pe(e)),We(fr,t)}}function xr(e,t,n){e===`focusin`?(yr(),ur=t,dr=n,ur.attachEvent(`onpropertychange`,br)):e===`focusout`&&yr()}function Sr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return pr(dr)}function Cr(e,t){if(e===`click`)return pr(t)}function wr(e,t){if(e===`input`||e===`change`)return pr(t)}function Tr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Er=typeof Object.is==`function`?Object.is:Tr;function Dr(e,t){if(Er(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)||!Er(e[i],t[i]))return!1}return!0}function Or(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function kr(e,t){var n=Or(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=Or(n)}}function Ar(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ar(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jr(){for(var e=window,t=le();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=le(e.document)}return t}function Mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Nr(e){var t=jr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ar(n.ownerDocument.documentElement,n)){if(r!==null&&Mr(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=kr(n,a);var o=kr(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 Pr=c&&`documentMode`in document&&11>=document.documentMode,Fr=null,Ir=null,Lr=null,Rr=!1;function zr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Rr||Fr==null||Fr!==le(r)||(r=Fr,`selectionStart`in r&&Mr(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}),Lr&&Dr(Lr,r)||(Lr=r,r=ci(Ir,`onSelect`),0<r.length&&(t=new En(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Fr)))}function Br(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Vr={animationend:Br(`Animation`,`AnimationEnd`),animationiteration:Br(`Animation`,`AnimationIteration`),animationstart:Br(`Animation`,`AnimationStart`),transitionend:Br(`Transition`,`TransitionEnd`)},Hr={},Ur={};c&&(Ur=document.createElement(`div`).style,`AnimationEvent`in window||(delete Vr.animationend.animation,delete Vr.animationiteration.animation,delete Vr.animationstart.animation),`TransitionEvent`in window||delete Vr.transitionend.transition);function Wr(e){if(Hr[e])return Hr[e];if(!Vr[e])return e;var t=Vr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ur)return Hr[e]=t[n];return e}var Gr=Wr(`animationend`),Kr=Wr(`animationiteration`),qr=Wr(`animationstart`),Jr=Wr(`transitionend`),Yr=new Map,Xr=`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 Zr(e,t){Yr.set(e,t),o(t,[e])}for(var Qr=0;Qr<Xr.length;Qr++){var $r=Xr[Qr];Zr($r.toLowerCase(),`on`+($r[0].toUpperCase()+$r.slice(1)))}Zr(Gr,`onAnimationEnd`),Zr(Kr,`onAnimationIteration`),Zr(qr,`onAnimationStart`),Zr(`dblclick`,`onDoubleClick`),Zr(`focusin`,`onFocus`),Zr(`focusout`,`onBlur`),Zr(Jr,`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 G=`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(` `),ei=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(G));function K(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,tt(r,t,void 0,e),e.currentTarget=null}function ti(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;K(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;K(i,s,l),a=c}}}if(Ze)throw e=Qe,Ze=!1,Qe=null,e}function q(e,t){var n=t[ji];n===void 0&&(n=t[ji]=new Set);var r=e+`__bubble`;n.has(r)||(ai(t,e,2,!1),n.add(r))}function ni(e,t,n){var r=0;t&&(r|=4),ai(n,e,r,t)}var ri=`_reactListening`+Math.random().toString(36).slice(2);function ii(e){if(!e[ri]){e[ri]=!0,i.forEach(function(t){t!==`selectionchange`&&(ei.has(t)||ni(t,!1,e),ni(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ri]||(t[ri]=!0,ni(`selectionchange`,!1,t))}}function ai(e,t,n,r){switch(gn(t)){case 1:var i=dn;break;case 4:i=fn;break;default:i=pn}n=i.bind(null,t,n,e),i=void 0,!Ke||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 oi(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=Pi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}We(function(){var r=a,i=Pe(n),o=[];a:{var s=Yr.get(e);if(s!==void 0){var c=En,l=e;switch(e){case`keypress`:if(xn(n)===0)break a;case`keydown`:case`keyup`:c=Wn;break;case`focusin`:l=`focus`,c=Fn;break;case`focusout`:l=`blur`,c=Fn;break;case`beforeblur`:case`afterblur`:c=Fn;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=Nn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Pn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Kn;break;case Gr:case Kr:case qr:c=In;break;case Jr:c=qn;break;case`scroll`:c=On;break;case`wheel`:c=Jn;break;case`copy`:case`cut`:case`paste`:c=Ln;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Gn}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=Ge(p,f),h!=null&&u.push(si(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!==Ne&&(l=n.relatedTarget||n.fromElement)&&(Pi(l)||l[Ai]))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?Pi(l):null,l!==null&&(d=nt(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Nn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Gn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Ii(c),m=l==null?s:Ii(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Pi(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=li(m))p++;for(m=0,h=f;h;h=li(h))m++;for(;0<p-m;)u=li(u),p--;for(;0<m-p;)f=li(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=li(u),f=li(f)}u=null}else u=null;c!==null&&ui(o,s,c,u,!1),l!==null&&d!==null&&ui(o,d,l,u,!0)}}a:{if(s=r?Ii(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=mr;else if(cr(s)){if(hr)g=wr;else{g=Sr;var _=xr}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=Cr);if(g&&=g(e,r)){lr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&he(s,`number`,s.value)}switch(_=r?Ii(r):window,e){case`focusin`:(cr(_)||_.contentEditable===`true`)&&(Fr=_,Ir=r,Lr=null);break;case`focusout`:Lr=Ir=Fr=null;break;case`mousedown`:Rr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Rr=!1,zr(o,n,i);break;case`selectionchange`:if(Pr)break;case`keydown`:case`keyup`:zr(o,n,i)}var v;if(Xn)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 ir?nr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&($n&&n.locale!==`ko`&&(ir||y!==`onCompositionStart`?y===`onCompositionEnd`&&ir&&(v=bn()):(_n=i,vn=`value`in _n?_n.value:_n.textContent,ir=!0)),_=ci(r,y),0<_.length&&(y=new Rn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=rr(n),v!==null&&(y.data=v)))),(v=Qn?ar(e,n):or(e,n))&&(r=ci(r,`onBeforeInput`),0<r.length&&(i=new Rn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ti(o,t)})}function si(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ci(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Ge(e,n),a!=null&&r.unshift(si(e,a,i)),a=Ge(e,t),a!=null&&r.push(si(e,a,i))),e=e.return}return r}function li(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function ui(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=Ge(n,a),c!=null&&o.unshift(si(n,c,s))):i||(c=Ge(n,a),c!=null&&o.push(si(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var di=/\r\n?/g,fi=/\u0000|\uFFFD/g;function pi(e){return(typeof e==`string`?e:``+e).replace(di,`
|
|
6
|
+
`).replace(fi,``)}function mi(e,t,n){if(t=pi(t),pi(e)!==t&&n)throw Error(r(425))}function hi(){}var gi=null,_i=null;function vi(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 yi=typeof setTimeout==`function`?setTimeout:void 0,bi=typeof clearTimeout==`function`?clearTimeout:void 0,xi=typeof Promise==`function`?Promise:void 0,Si=typeof queueMicrotask==`function`?queueMicrotask:xi===void 0?yi:function(e){return xi.resolve(null).then(e).catch(Ci)};function Ci(e){setTimeout(function(){throw e})}function wi(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),cn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);cn(t)}function Ti(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 Ei(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 Di=Math.random().toString(36).slice(2),Oi=`__reactFiber$`+Di,ki=`__reactProps$`+Di,Ai=`__reactContainer$`+Di,ji=`__reactEvents$`+Di,Mi=`__reactListeners$`+Di,Ni=`__reactHandles$`+Di;function Pi(e){var t=e[Oi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ai]||n[Oi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ei(e);e!==null;){if(n=e[Oi])return n;e=Ei(e)}return t}e=n,n=e.parentNode}return null}function Fi(e){return e=e[Oi]||e[Ai],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ii(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Li(e){return e[ki]||null}var Ri=[],zi=-1;function Bi(e){return{current:e}}function J(e){0>zi||(e.current=Ri[zi],Ri[zi]=null,zi--)}function Y(e,t){zi++,Ri[zi]=e.current,e.current=t}var Vi={},Hi=Bi(Vi),Ui=Bi(!1),Wi=Vi;function Gi(e,t){var n=e.type.contextTypes;if(!n)return Vi;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 Ki(e){return e=e.childContextTypes,e!=null}function qi(){J(Ui),J(Hi)}function Ji(e,t,n){if(Hi.current!==Vi)throw Error(r(168));Y(Hi,t),Y(Ui,n)}function Yi(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 L({},n,i)}function Xi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vi,Wi=Hi.current,Y(Hi,e),Y(Ui,Ui.current),!0}function Zi(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Yi(e,t,Wi),i.__reactInternalMemoizedMergedChildContext=e,J(Ui),J(Hi),Y(Hi,e)):J(Ui),Y(Ui,n)}var Qi=null,$i=!1,ea=!1;function ta(e){Qi===null?Qi=[e]:Qi.push(e)}function na(e){$i=!0,ta(e)}function ra(){if(!ea&&Qi!==null){ea=!0;var e=0,t=W;try{var n=Qi;for(W=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Qi=null,$i=!1}catch(t){throw Qi!==null&&(Qi=Qi.slice(e+1)),ct(mt,ra),t}finally{W=t,ea=!1}}return null}var ia=[],aa=0,oa=null,sa=0,ca=[],la=0,ua=null,da=1,fa=``;function pa(e,t){ia[aa++]=sa,ia[aa++]=oa,oa=e,sa=t}function ma(e,t,n){ca[la++]=da,ca[la++]=fa,ca[la++]=ua,ua=e;var r=da;e=fa;var i=32-St(r)-1;r&=~(1<<i),n+=1;var a=32-St(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,da=1<<32-St(t)+i|n<<i|r,fa=a+e}else da=1<<a|n<<i|r,fa=e}function ha(e){e.return!==null&&(pa(e,1),ma(e,1,0))}function ga(e){for(;e===oa;)oa=ia[--aa],ia[aa]=null,sa=ia[--aa],ia[aa]=null;for(;e===ua;)ua=ca[--la],ca[la]=null,fa=ca[--la],ca[la]=null,da=ca[--la],ca[la]=null}var _a=null,va=null,X=!1,ya=null;function ba(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 xa(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,_a=e,va=Ti(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,_a=e,va=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=ua===null?null:{id:da,overflow:fa},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Kl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,_a=e,va=null,!0);default:return!1}}function Sa(e){return!!(e.mode&1)&&!(e.flags&128)}function Ca(e){if(X){var t=va;if(t){var n=t;if(!xa(e,t)){if(Sa(e))throw Error(r(418));t=Ti(n.nextSibling);var i=_a;t&&xa(e,t)?ba(i,n):(e.flags=e.flags&-4097|2,X=!1,_a=e)}}else{if(Sa(e))throw Error(r(418));e.flags=e.flags&-4097|2,X=!1,_a=e}}}function wa(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;_a=e}function Ta(e){if(e!==_a)return!1;if(!X)return wa(e),X=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!vi(e.type,e.memoizedProps)),t&&=va){if(Sa(e))throw Ea(),Error(r(418));for(;t;)ba(e,t),t=Ti(t.nextSibling)}if(wa(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){va=Ti(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}va=null}}else va=_a?Ti(e.stateNode.nextSibling):null;return!0}function Ea(){for(var e=va;e;)e=Ti(e.nextSibling)}function Da(){va=_a=null,X=!1}function Oa(e){ya===null?ya=[e]:ya.push(e)}var ka=C.ReactCurrentBatchConfig;function Aa(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 ja(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ma(e){var t=e._init;return t(e._payload)}function Na(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&&Ma(i)===t.type)?(r=a(t,n.props),r.ref=Aa(e,t,n),r.return=e,r):(r=Xl(n.type,n.key,n.props,null,e.mode,r),r.ref=Aa(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=Aa(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(U(t)||te(t))return t=Zl(t,e.mode,n,null),t.return=e,t;ja(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(U(n)||te(n))return i===null?d(e,t,n,r,null):null;ja(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(U(r)||te(r))return e=e.get(n)||null,d(t,e,r,i,null);ja(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),X&&pa(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 X&&pa(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)}),X&&pa(r,h),l}function g(a,s,c,l){var u=te(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),X&&pa(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 X&&pa(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)}),X&&pa(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&&Ma(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Aa(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=Aa(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(U(i))return h(e,r,i,o);if(te(i))return g(e,r,i,o);ja(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 Pa=Na(!0),Fa=Na(!1),Ia=Bi(null),La=null,Ra=null,za=null;function Ba(){za=Ra=La=null}function Va(e){var t=Ia.current;J(Ia),e._currentValue=t}function Ha(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 Ua(e,t){La=e,za=Ra=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ns=!0),e.firstContext=null)}function Wa(e){var t=e._currentValue;if(za!==e){if(e={context:e,memoizedValue:t,next:null},Ra===null){if(La===null)throw Error(r(308));Ra=e,La.dependencies={lanes:0,firstContext:e}}else Ra=Ra.next=e}return t}var Ga=null;function Ka(e){Ga===null?Ga=[e]:Ga.push(e)}function qa(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ka(t)):(n.next=i.next,i.next=n),t.interleaved=n,Ja(e,r)}function Ja(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 Ya=!1;function Xa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Za(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 Qa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function $a(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,Ja(e,n)}return i=r.interleaved,i===null?(t.next=t,Ka(r)):(t.next=i.next,i.next=t),r.interleaved=t,Ja(e,n)}function eo(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,Lt(e,n)}}function to(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 no(e,t,n,r){var i=e.updateQueue;Ya=!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=L({},d,f);break a;case 2:Ya=!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 ro(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 io={},ao=Bi(io),oo=Bi(io),so=Bi(io);function co(e){if(e===io)throw Error(r(174));return e}function lo(e,t){switch(Y(so,t),Y(oo,e),Y(ao,io),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Se(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Se(t,e)}J(ao),Y(ao,t)}function uo(){J(ao),J(oo),J(so)}function fo(e){co(so.current);var t=co(ao.current),n=Se(t,e.type);t!==n&&(Y(oo,e),Y(ao,n))}function po(e){oo.current===e&&(J(ao),J(oo))}var mo=Bi(0);function ho(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 go=[];function _o(){for(var e=0;e<go.length;e++)go[e]._workInProgressVersionPrimary=null;go.length=0}var vo=C.ReactCurrentDispatcher,yo=C.ReactCurrentBatchConfig,bo=0,xo=null,So=null,Co=null,wo=!1,To=!1,Eo=0,Do=0;function Oo(){throw Error(r(321))}function ko(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Er(e[n],t[n]))return!1;return!0}function Ao(e,t,n,i,a,o){if(bo=o,xo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,vo.current=e===null||e.memoizedState===null?ps:ms,e=n(i,a),To){o=0;do{if(To=!1,Eo=0,25<=o)throw Error(r(301));o+=1,Co=So=null,t.updateQueue=null,vo.current=hs,e=n(i,a)}while(To)}if(vo.current=fs,t=So!==null&&So.next!==null,bo=0,Co=So=xo=null,wo=!1,t)throw Error(r(300));return e}function jo(){var e=Eo!==0;return Eo=0,e}function Mo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Co===null?xo.memoizedState=Co=e:Co=Co.next=e,Co}function No(){if(So===null){var e=xo.alternate;e=e===null?null:e.memoizedState}else e=So.next;var t=Co===null?xo.memoizedState:Co.next;if(t!==null)Co=t,So=e;else{if(e===null)throw Error(r(310));So=e,e={memoizedState:So.memoizedState,baseState:So.baseState,baseQueue:So.baseQueue,queue:So.queue,next:null},Co===null?xo.memoizedState=Co=e:Co=Co.next=e}return Co}function Po(e,t){return typeof t==`function`?t(e):t}function Fo(e){var t=No(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=So,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((bo&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,xo.lanes|=d,Jc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Er(i,t.memoizedState)||(Ns=!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,xo.lanes|=o,Jc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Io(e){var t=No(),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);Er(o,t.memoizedState)||(Ns=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Lo(){}function Ro(e,t){var n=xo,i=No(),a=t(),o=!Er(i.memoizedState,a);if(o&&(i.memoizedState=a,Ns=!0),i=i.queue,Xo(Vo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Co!==null&&Co.memoizedState.tag&1){if(n.flags|=2048,Go(9,Bo.bind(null,n,i,a,t),void 0,null),Vc===null)throw Error(r(349));bo&30||zo(n,t,a)}return a}function zo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=xo.updateQueue,t===null?(t={lastEffect:null,stores:null},xo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Bo(e,t,n,r){t.value=n,t.getSnapshot=r,Ho(t)&&Uo(e)}function Vo(e,t,n){return n(function(){Ho(t)&&Uo(e)})}function Ho(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Er(e,n)}catch{return!0}}function Uo(e){var t=Ja(e,1);t!==null&&ml(t,e,1,-1)}function Wo(e){var t=Mo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:e},t.queue=e,e=e.dispatch=cs.bind(null,xo,e),[t.memoizedState,e]}function Go(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=xo.updateQueue,t===null?(t={lastEffect:null,stores:null},xo.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 Ko(){return No().memoizedState}function qo(e,t,n,r){var i=Mo();xo.flags|=e,i.memoizedState=Go(1|t,n,void 0,r===void 0?null:r)}function Jo(e,t,n,r){var i=No();r=r===void 0?null:r;var a=void 0;if(So!==null){var o=So.memoizedState;if(a=o.destroy,r!==null&&ko(r,o.deps)){i.memoizedState=Go(t,n,a,r);return}}xo.flags|=e,i.memoizedState=Go(1|t,n,a,r)}function Yo(e,t){return qo(8390656,8,e,t)}function Xo(e,t){return Jo(2048,8,e,t)}function Zo(e,t){return Jo(4,2,e,t)}function Qo(e,t){return Jo(4,4,e,t)}function $o(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 es(e,t,n){return n=n==null?null:n.concat([e]),Jo(4,4,$o.bind(null,t,e),n)}function ts(){}function ns(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ko(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function rs(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ko(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function is(e,t,n){return bo&21?(Er(n,t)||(n=Nt(),xo.lanes|=n,Jc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ns=!0),e.memoizedState=n)}function as(e,t){var n=W;W=n!==0&&4>n?n:4,e(!0);var r=yo.transition;yo.transition={};try{e(!1),t()}finally{W=n,yo.transition=r}}function os(){return No().memoizedState}function ss(e,t,n){var r=pl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ls(e))us(t,n);else if(n=qa(e,t,n,r),n!==null){var i=fl();ml(n,e,r,i),ds(n,t,r)}}function cs(e,t,n){var r=pl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ls(e))us(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,Er(s,o)){var c=t.interleaved;c===null?(i.next=i,Ka(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=qa(e,t,i,r),n!==null&&(i=fl(),ml(n,e,r,i),ds(n,t,r))}}function ls(e){var t=e.alternate;return e===xo||t!==null&&t===xo}function us(e,t){To=wo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ds(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Lt(e,n)}}var fs={readContext:Wa,useCallback:Oo,useContext:Oo,useEffect:Oo,useImperativeHandle:Oo,useInsertionEffect:Oo,useLayoutEffect:Oo,useMemo:Oo,useReducer:Oo,useRef:Oo,useState:Oo,useDebugValue:Oo,useDeferredValue:Oo,useTransition:Oo,useMutableSource:Oo,useSyncExternalStore:Oo,useId:Oo,unstable_isNewReconciler:!1},ps={readContext:Wa,useCallback:function(e,t){return Mo().memoizedState=[e,t===void 0?null:t],e},useContext:Wa,useEffect:Yo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),qo(4194308,4,$o.bind(null,t,e),n)},useLayoutEffect:function(e,t){return qo(4194308,4,e,t)},useInsertionEffect:function(e,t){return qo(4,2,e,t)},useMemo:function(e,t){var n=Mo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Mo();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=ss.bind(null,xo,e),[r.memoizedState,e]},useRef:function(e){var t=Mo();return e={current:e},t.memoizedState=e},useState:Wo,useDebugValue:ts,useDeferredValue:function(e){return Mo().memoizedState=e},useTransition:function(){var e=Wo(!1),t=e[0];return e=as.bind(null,e[1]),Mo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=xo,a=Mo();if(X){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Vc===null)throw Error(r(349));bo&30||zo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Yo(Vo.bind(null,i,o,e),[e]),i.flags|=2048,Go(9,Bo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Mo(),t=Vc.identifierPrefix;if(X){var n=fa,r=da;n=(r&~(1<<32-St(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Eo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Do++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ms={readContext:Wa,useCallback:ns,useContext:Wa,useEffect:Xo,useImperativeHandle:es,useInsertionEffect:Zo,useLayoutEffect:Qo,useMemo:rs,useReducer:Fo,useRef:Ko,useState:function(){return Fo(Po)},useDebugValue:ts,useDeferredValue:function(e){return is(No(),So.memoizedState,e)},useTransition:function(){return[Fo(Po)[0],No().memoizedState]},useMutableSource:Lo,useSyncExternalStore:Ro,useId:os,unstable_isNewReconciler:!1},hs={readContext:Wa,useCallback:ns,useContext:Wa,useEffect:Xo,useImperativeHandle:es,useInsertionEffect:Zo,useLayoutEffect:Qo,useMemo:rs,useReducer:Io,useRef:Ko,useState:function(){return Io(Po)},useDebugValue:ts,useDeferredValue:function(e){var t=No();return So===null?t.memoizedState=e:is(t,So.memoizedState,e)},useTransition:function(){return[Io(Po)[0],No().memoizedState]},useMutableSource:Lo,useSyncExternalStore:Ro,useId:os,unstable_isNewReconciler:!1};function gs(e,t){if(e&&e.defaultProps){for(var n in t=L({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function _s(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:L({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vs={isMounted:function(e){return(e=e._reactInternals)?nt(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fl(),i=pl(e),a=Qa(r,i);a.payload=t,n!=null&&(a.callback=n),t=$a(e,a,i),t!==null&&(ml(t,e,i,r),eo(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fl(),i=pl(e),a=Qa(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=$a(e,a,i),t!==null&&(ml(t,e,i,r),eo(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fl(),r=pl(e),i=Qa(n,r);i.tag=2,t!=null&&(i.callback=t),t=$a(e,i,r),t!==null&&(ml(t,e,r,n),eo(t,e,r))}};function ys(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?!Dr(n,r)||!Dr(i,a):!0}function bs(e,t,n){var r=!1,i=Vi,a=t.contextType;return typeof a==`object`&&a?a=Wa(a):(i=Ki(t)?Wi:Hi.current,r=t.contextTypes,a=(r=r!=null)?Gi(e,i):Vi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=vs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function xs(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&&vs.enqueueReplaceState(t,t.state,null)}function Ss(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Xa(e);var a=t.contextType;typeof a==`object`&&a?i.context=Wa(a):(a=Ki(t)?Wi:Hi.current,i.context=Gi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(_s(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&&vs.enqueueReplaceState(i,i.state,null),no(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Cs(e,t){try{var n=``,r=t;do n+=V(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 ws(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ts(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Es=typeof WeakMap==`function`?WeakMap:Map;function Ds(e,t,n){n=Qa(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){nl||(nl=!0,rl=r),Ts(e,t)},n}function Os(e,t,n){n=Qa(-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(){Ts(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ts(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 ks(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Es;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 As(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 js(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=Qa(-1,1),t.tag=2,$a(n,t,1))),n.lanes|=1),e)}var Ms=C.ReactCurrentOwner,Ns=!1;function Ps(e,t,n,r){t.child=e===null?Fa(t,null,n,r):Pa(t,e.child,n,r)}function Fs(e,t,n,r,i){n=n.render;var a=t.ref;return Ua(t,i),r=Ao(e,t,n,r,a,i),n=jo(),e!==null&&!Ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Z(e,t,i)):(X&&n&&ha(t),t.flags|=1,Ps(e,t,r,i),t.child)}function Is(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,Ls(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?Dr:n,n(o,r)&&e.ref===t.ref)return Z(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ls(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Dr(a,r)&&e.ref===t.ref){if(Ns=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ns=!0);else return t.lanes=e.lanes,Z(e,t,i)}}return Bs(e,t,n,r,i)}function Rs(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},Y(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,Y(Gc,Wc),Wc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Y(Gc,Wc),Wc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Y(Gc,Wc),Wc|=r;return Ps(e,t,i,n),t.child}function zs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Bs(e,t,n,r,i){var a=Ki(n)?Wi:Hi.current;return a=Gi(t,a),Ua(t,i),n=Ao(e,t,n,r,a,i),r=jo(),e!==null&&!Ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Z(e,t,i)):(X&&r&&ha(t),t.flags|=1,Ps(e,t,n,i),t.child)}function Vs(e,t,n,r,i){if(Ki(n)){var a=!0;Xi(t)}else a=!1;if(Ua(t,i),t.stateNode===null)ec(e,t),bs(t,n,r),Ss(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=Wa(l):(l=Ki(n)?Wi:Hi.current,l=Gi(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)&&xs(t,o,r,l),Ya=!1;var f=t.memoizedState;o.state=f,no(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Ui.current||Ya?(typeof u==`function`&&(_s(t,n,u,r),c=t.memoizedState),(s=Ya||ys(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,Za(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:gs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Wa(c):(c=Ki(n)?Wi:Hi.current,c=Gi(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)&&xs(t,o,r,c),Ya=!1,f=t.memoizedState,o.state=f,no(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Ui.current||Ya?(typeof p==`function`&&(_s(t,n,p,r),m=t.memoizedState),(l=Ya||ys(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 Hs(e,t,n,r,a,i)}function Hs(e,t,n,r,i,a){zs(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&Zi(t,n,!1),Z(e,t,a);r=t.stateNode,Ms.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Pa(t,e.child,null,a),t.child=Pa(t,null,s,a)):Ps(e,t,s,a),t.memoizedState=r.state,i&&Zi(t,n,!0),t.child}function Us(e){var t=e.stateNode;t.pendingContext?Ji(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ji(e,t.context,!1),lo(e,t.containerInfo)}function Ws(e,t,n,r,i){return Da(),Oa(i),t.flags|=256,Ps(e,t,n,r),t.child}var Gs={dehydrated:null,treeContext:null,retryLane:0};function Ks(e){return{baseLanes:e,cachePool:null,transitions:null}}function qs(e,t,n){var r=t.pendingProps,i=mo.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),Y(mo,i&1),e===null)return Ca(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=Ks(n),t.memoizedState=Gs,e):Js(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Xs(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?Ks(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Gs,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 Js(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Ys(e,t,n,r){return r!==null&&Oa(r),Pa(t,e.child,null,n),e=Js(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xs(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=ws(Error(r(422))),Ys(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&&Pa(t,e.child,null,s),t.child.memoizedState=Ks(s),t.memoizedState=Gs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Ys(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=ws(o,i,void 0),Ys(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ns||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,Ja(e,a),ml(i,e,a,-1))}return Ol(),i=ws(Error(r(421))),Ys(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,va=Ti(a.nextSibling),_a=t,X=!0,ya=null,e!==null&&(ca[la++]=da,ca[la++]=fa,ca[la++]=ua,da=e.id,fa=e.overflow,ua=t),t=Js(t,i.children),t.flags|=4096,t)}function Zs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ha(e.return,t,n)}function Qs(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 $s(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ps(e,t,r.children,n),r=mo.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&&Zs(e,n,t);else if(e.tag===19)Zs(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(Y(mo,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&&ho(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Qs(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&&ho(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Qs(t,!0,n,null,a);break;case`together`:Qs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ec(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Z(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:Us(t),Da();break;case 5:fo(t);break;case 1:Ki(t.type)&&Xi(t);break;case 4:lo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Y(Ia,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Y(mo,mo.current&1),e=Z(e,t,n),e===null?null:e.sibling):qs(e,t,n):(Y(mo,mo.current&1),t.flags|=128,null);Y(mo,mo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $s(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Y(mo,mo.current),r)break;return null;case 22:case 23:return t.lanes=0,Rs(e,t,n)}return Z(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,co(ao.current);var o=null;switch(n){case`input`:i=ue(e,i),r=ue(e,r),o=[];break;case`select`:i=L({},i,{value:void 0}),r=L({},r,{value:void 0}),o=[];break;case`textarea`:i=_e(e,i),r=_e(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=hi)}je(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`&&q(`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(!X)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(ga(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 Ki(t.type)&&qi(),oc(t),null;case 3:return i=t.stateNode,uo(),J(Ui),J(Hi),_o(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ta(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ya!==null&&(vl(ya),ya=null))),oc(t),null;case 5:po(t);var o=co(so.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=co(ao.current),Ta(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Oi]=t,i[ki]=s,e=!!(t.mode&1),n){case`dialog`:q(`cancel`,i),q(`close`,i);break;case`iframe`:case`object`:case`embed`:q(`load`,i);break;case`video`:case`audio`:for(o=0;o<G.length;o++)q(G[o],i);break;case`source`:q(`error`,i);break;case`img`:case`image`:case`link`:q(`error`,i),q(`load`,i);break;case`details`:q(`toggle`,i);break;case`input`:de(i,s),q(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},q(`invalid`,i);break;case`textarea`:ve(i,s),q(`invalid`,i)}for(var c in je(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&mi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&mi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&q(`scroll`,i)}switch(n){case`input`:ce(i),me(i,s,!0);break;case`textarea`:ce(i),be(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=hi)}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=xe(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[Oi]=t,e[ki]=i,nc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Me(n,i),n){case`dialog`:q(`cancel`,e),q(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:q(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<G.length;o++)q(G[o],e);o=i;break;case`source`:q(`error`,e),o=i;break;case`img`:case`image`:case`link`:q(`error`,e),q(`load`,e),o=i;break;case`details`:q(`toggle`,e),o=i;break;case`input`:de(e,i),o=ue(e,i),q(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=L({},i,{value:void 0}),q(`invalid`,e);break;case`textarea`:ve(e,i),o=_e(e,i),q(`invalid`,e);break;default:o=i}for(s in je(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?ke(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&we(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Te(e,u):typeof u==`number`&&Te(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&q(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:ce(e),me(e,i,!1);break;case`textarea`:ce(e),be(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&&ge(e,!!i.multiple,i.defaultValue,!0):ge(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=hi)}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=co(so.current),co(ao.current),Ta(t)){if(i=t.stateNode,n=t.memoizedProps,i[Oi]=t,(s=i.nodeValue!==n)&&(e=_a,e!==null))switch(e.tag){case 3:mi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&mi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Oi]=t,t.stateNode=i}return oc(t),null;case 13:if(J(mo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(X&&va!==null&&t.mode&1&&!(t.flags&128))Ea(),Da(),t.flags|=98560,s=!1;else if(s=Ta(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[Oi]=t}else Da(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;oc(t),s=!1}else ya!==null&&(vl(ya),ya=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||mo.current&1?Kc===0&&(Kc=3):Ol())),t.updateQueue!==null&&(t.flags|=4),oc(t),null);case 4:return uo(),e===null&&ii(t.stateNode.containerInfo),oc(t),null;case 10:return Va(t.type._context),oc(t),null;case 17:return Ki(t.type)&&qi(),oc(t),null;case 19:if(J(mo),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=ho(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 Y(mo,mo.current&1|2),t.child}e=e.sibling}s.tail!==null&&ft()>el&&(t.flags|=128,i=!0,ac(s,!1),t.lanes=4194304)}}else{if(!i){if(e=ho(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&&!X)return oc(t),null}else 2*ft()-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=ft(),t.sibling=null,n=mo.current,Y(mo,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(ga(t),t.tag){case 1:return Ki(t.type)&&qi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return uo(),J(Ui),J(Hi),_o(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return po(t),null;case 13:if(J(mo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Da()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return J(mo),null;case 4:return uo(),null;case 10:return Va(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(gi=un,e=jr(),Mr(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(_i={focusedElem:e,selectionRange:n},un=!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:gs(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[Oi],delete t[ki],delete t[ji],delete t[Mi],delete t[Ni])),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=hi));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(bt&&typeof bt.onCommitFiberUnmount==`function`)try{bt.onCommitFiberUnmount(yt,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?wi(e.parentNode,n):e.nodeType===1&&wi(e,n),cn(e)):wi(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{Te(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&&fe(a,o),Me(c,s);var u=Me(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?ke(a,f):d===`dangerouslySetInnerHTML`?we(a,f):d===`children`?Te(a,f):S(a,d,f,u)}switch(c){case`input`:pe(a,o);break;case`textarea`:ye(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?ge(a,!!o.multiple,o.multiple?[]:``,!1):ge(a,!!o.multiple,o.defaultValue,!0)):ge(a,!!o.multiple,m,!1)}a[ki]=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{cn(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=ft())),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=Oe(`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&&(Te(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:gs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&ro(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}ro(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&&cn(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=Bi(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?ft():ul===-1?ul=ft():ul}function pl(e){return e.mode&1?$&2&&Uc!==0?Uc&-Uc:ka.transition===null?(e=W,e===0?(e=window.event,e=e===void 0?16:gn(e.type),e):e):(dl===0&&(dl=Nt()),dl):1}function ml(e,t,n,i){if(50<cl)throw cl=0,ll=null,Error(r(185));Ft(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=ft()+500,$i&&ra()))}function hl(e,t){var n=e.callbackNode;jt(e,t);var r=kt(e,e===Vc?Uc:0);if(r===0)n!==null&<(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&<(n),t===1)e.tag===0?na(xl.bind(null,e)):ta(xl.bind(null,e)),Si(function(){!($&6)&&ra()}),n=null;else{switch(Rt(r)){case 1:n=mt;break;case 4:n=ht;break;case 16:n=gt;break;case 536870912:n=vt;break;default:n=gt}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=kt(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=ft()+500,Tl(e,t));do try{jl();break}catch(t){El(e,t)}while(1);Ba(),Rc.current=o,$=a,Hc===null?(Vc=null,Uc=0,t=Kc):t=0}if(t!==0){if(t===2&&(a=Mt(e),a!==0&&(i=a,t=_l(e,a))),t===1)throw n=qc,Tl(e,0),bl(e,i),hl(e,ft()),n;if(t===6)bl(e,i);else{if(a=e.current.alternate,!(i&30)&&!yl(a)&&(t=kl(e,i),t===2&&(o=Mt(e),o!==0&&(i=o,t=_l(e,o))),t===1))throw n=qc,Tl(e,0),bl(e,i),hl(e,ft()),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-ft(),10<t)){if(kt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){fl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=yi(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-St(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=ft()-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=yi(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,ft()),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(!Er(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-St(t),r=1<<n;e[n]=-1,t&=~r}}function xl(e){if($&6)throw Error(r(327));Il();var t=kt(e,0);if(!(t&1))return hl(e,ft()),null;var n=kl(e,t);if(e.tag!==0&&n===2){var i=Mt(e);i!==0&&(t=i,n=_l(e,i))}if(n===1)throw n=qc,Tl(e,0),bl(e,t),hl(e,ft()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Pl(e,Qc,tl),hl(e,ft()),null}function Sl(e,t){var n=$;$|=1;try{return e(t)}finally{$=n,$===0&&(el=ft()+500,$i&&ra())}}function Cl(e){ol!==null&&ol.tag===0&&!($&6)&&Il();var t=$;$|=1;var n=Bc.transition,r=W;try{if(Bc.transition=null,W=1,e)return e()}finally{W=r,Bc.transition=n,$=t,!($&6)&&ra()}}function wl(){Wc=Gc.current,J(Gc)}function Tl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,bi(n)),Hc!==null)for(n=Hc.return;n!==null;){var r=n;switch(ga(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&qi();break;case 3:uo(),J(Ui),J(Hi),_o();break;case 5:po(r);break;case 4:uo();break;case 13:J(mo);break;case 19:J(mo);break;case 10:Va(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,Ga!==null){for(t=0;t<Ga.length;t++)if(n=Ga[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}Ga=null}return e}function El(e,t){do{var n=Hc;try{if(Ba(),vo.current=fs,wo){for(var i=xo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}wo=!1}if(bo=0,Co=So=xo=null,To=!1,Eo=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=As(s);if(m!==null){m.flags&=-257,js(m,s,c,o,t),m.mode&1&&ks(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)){ks(o,u,t),Ol();break a}l=Error(r(426))}else if(X&&c.mode&1){var _=As(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),js(_,s,c,o,t),Oa(Cs(l,c));break a}}o=l=Cs(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=Ds(o,l,t);to(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=Os(o,c,t);to(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=fs,e===null?fs: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(Ba(),$=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&&!ut();)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=W,i=Bc.transition;try{Bc.transition=null,W=1,Fl(e,t,n,r)}finally{Bc.transition=i,W=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(It(e,o),e===Vc&&(Hc=Vc=null,Uc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||al||(al=!0,Wl(gt,function(){return Il(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Bc.transition,Bc.transition=null;var s=W;W=1;var c=$;$|=4,zc.current=null,hc(e,n),Ac(n,e),Nr(_i),un=!!gi,_i=gi=null,e.current=n,Mc(n,e,a),dt(),$=c,W=s,Bc.transition=o}else e.current=n;if(al&&(al=!1,ol=e,sl=a),o=e.pendingLanes,o===0&&(il=null),xt(n.stateNode,i),hl(e,ft()),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,ra(),null}function Il(){if(ol!==null){var e=Rt(sl),t=Bc.transition,n=W;try{if(Bc.transition=null,W=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,ra(),bt&&typeof bt.onPostCommitFiberRoot==`function`)try{bt.onPostCommitFiberRoot(yt,e)}catch{}i=!0}return i}finally{W=n,Bc.transition=t}}return!1}function Ll(e,t,n){t=Cs(n,t),t=Ds(e,t,1),e=$a(e,t,1),t=fl(),e!==null&&(Ft(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=Cs(n,e),e=Os(t,e,1),t=$a(t,e,1),e=fl(),t!==null&&(Ft(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>ft()-$c?Tl(e,0):Xc|=n),hl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Dt,Dt<<=1,!(Dt&130023424)&&(Dt=4194304)):t=1);var n=fl();e=Ja(e,t),e!==null&&(Ft(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||Ui.current)Ns=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ns=!1,tc(e,t,n);Ns=!!(e.flags&131072)}}else Ns=!1,X&&t.flags&1048576&&ma(t,sa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ec(e,t),e=t.pendingProps;var a=Gi(t,Hi.current);Ua(t,n),a=Ao(null,t,i,e,a,n);var o=jo();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,Ki(i)?(o=!0,Xi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Xa(t),a.updater=vs,t.stateNode=a,a._reactInternals=t,Ss(t,i,e,n),t=Hs(null,t,i,!0,o,n)):(t.tag=0,X&&o&&ha(t),Ps(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ec(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=gs(i,e),a){case 0:t=Bs(null,t,i,e,n);break a;case 1:t=Vs(null,t,i,e,n);break a;case 11:t=Fs(null,t,i,e,n);break a;case 14:t=Is(null,t,i,gs(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:gs(i,a),Bs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Vs(e,t,i,a,n);case 3:a:{if(Us(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Za(e,t),no(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=Cs(Error(r(423)),t),t=Ws(e,t,i,n,a);break a}if(i!==a){a=Cs(Error(r(424)),t),t=Ws(e,t,i,n,a);break a}for(va=Ti(t.stateNode.containerInfo.firstChild),_a=t,X=!0,ya=null,n=Fa(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Da(),i===a){t=Z(e,t,n);break a}Ps(e,t,i,n)}t=t.child}return t;case 5:return fo(t),e===null&&Ca(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,vi(i,a)?s=null:o!==null&&vi(i,o)&&(t.flags|=32),zs(e,t),Ps(e,t,s,n),t.child;case 6:return e===null&&Ca(t),null;case 13:return qs(e,t,n);case 4:return lo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Pa(t,null,i,n):Ps(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Fs(e,t,i,a,n);case 7:return Ps(e,t,t.pendingProps,n),t.child;case 8:return Ps(e,t,t.pendingProps.children,n),t.child;case 12:return Ps(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,Y(Ia,i._currentValue),i._currentValue=s,o!==null){if(Er(o.value,s)){if(o.children===a.children&&!Ui.current){t=Z(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=Qa(-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),Ha(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),Ha(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}}Ps(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ua(t,n),a=Wa(a),i=i(a),t.flags|=1,Ps(e,t,i,n),t.child;case 14:return i=t.type,a=gs(i,t.pendingProps),a=gs(i.type,a),Is(e,t,i,a,n);case 15:return Ls(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),ec(e,t),t.tag=1,Ki(i)?(e=!0,Xi(t)):e=!1,Ua(t,n),bs(t,i,a),Ss(t,i,a,n),Hs(null,t,i,!0,e,n);case 19:return $s(e,t,n);case 22:return Rs(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return ct(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 ee: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=ee,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=Pt(0),this.expirationTimes=Pt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(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},Xa(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 Vi;e=e._reactInternals;a:{if(nt(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(Ki(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(Ki(n))return Yi(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=Qa(r,i),a.callback=t??null,$a(n,a,i),e.current.lanes=i,Ft(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=Qa(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=$a(i,t,o),e!==null&&(ml(e,i,o,a),eo(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[Ai]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ht();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Zt.length&&t!==0&&t<Zt[n].priority;n++);Zt.splice(n,0,e),n===0&&nn(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[Ai]=o.current,ii(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[Ai]=c.current,ii(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)}zt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ot(t.pendingLanes);n!==0&&(Lt(t,n|1),hl(t,ft()),!($&6)&&(el=ft()+500,ra()))}break;case 13:Cl(function(){var t=Ja(e,1);t!==null&&ml(t,e,1,fl())}),lu(e,1)}},Bt=function(e){if(e.tag===13){var t=Ja(e,134217728);t!==null&&ml(t,e,134217728,fl()),lu(e,134217728)}},Vt=function(e){if(e.tag===13){var t=pl(e),n=Ja(e,t);n!==null&&ml(n,e,t,fl()),lu(e,t)}},Ht=function(){return W},Ut=function(e,t){var n=W;try{return W=e,t()}finally{W=n}},Fe=function(e,t,n){switch(t){case`input`:if(pe(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=Li(i);if(!a)throw Error(r(90));H(i),pe(i,a)}}}break;case`textarea`:ye(e,n);break;case`select`:t=n.value,t!=null&&ge(e,!!n.multiple,t,!1)}},Ve=Sl,He=Cl;var yu={usingClientEntryPoint:!1,Events:[Fi,Ii,Li,ze,Be,Sl]},bu={findFiberByHostInstance:Pi,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=ot(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{yt=Su.inject(xu),bt=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[Ai]=t.current,ii(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=ot(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[Ai]=t.current,ii(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[Ai]=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;function y(){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(_()),n.onopen=()=>{r(!0),a(void 0)},n.onclose=()=>{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(v&&v!==n.build){window.location.reload();return}v=n.build}n.type===`roster`&&n.snapshot&&t(n.snapshot)}}return s.current=()=>{n?.readyState===WebSocket.OPEN||n?.readyState===WebSocket.CONNECTING?n.close():i()},i(),()=>{e=!0,o.current&&clearTimeout(o.current),n?.close()}},[]),{snapshot:e,connected:n,lastDisconnectedAt:i,reconnect:()=>s.current()}}var b=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})),x=o(((e,t)=>{t.exports=b()}))(),S={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 C({status:e}){let t=S[e];return(0,x.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,x.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-current ${t.pulse?`hive-pulse`:``}`}),t.label]})}var w=``;async function T(e){let t=await fetch(`${w}${e}`),n=await t.json();if(!t.ok)throw Error(n.error??`Request failed: ${t.status}`);return n}async function E(e,t){let n=await fetch(`${w}${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 D(e){let t=await fetch(`${w}${e}`,{method:`DELETE`}),n=await t.json();if(!t.ok)throw Error(n.error??`Request failed: ${t.status}`);return n}async function O(e,t){let n=await fetch(`${w}${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 k(e){return E(`/api/orchestrator/start`,e)}function A(e,t=`claude`){return E(`/api/skills/discover`,{cwd:e,provider:t})}function j(e){return E(`/api/templates/discover`,{cwd:e})}function M(e,t,n){return E(`/api/templates`,{template:e,source:t,cwd:n})}function N(e,t){if(e.source===`built-in`)throw Error(`built-in templates are read-only`);return O(`/api/templates/${e.source}/${encodeURIComponent(e.id)}`,{template:e,cwd:t})}function P(e,t){if(e.source===`built-in`)throw Error(`built-in templates cannot be deleted`);let n=t?`?cwd=${encodeURIComponent(t)}`:``;return D(`/api/templates/${e.source}/${encodeURIComponent(e.id)}${n}`)}function F(e){return E(`/api/directories/suggest`,{input:e})}function ee(e){return E(`/api/paths/inspect`,{input:e})}function I(e,t){return E(`/api/mission/${encodeURIComponent(e)}/message`,{text:t})}function te(e,t,n){return E(`/api/mission/${encodeURIComponent(e)}/decision/${encodeURIComponent(t)}/answer`,{answer:n})}function L(e,t){return E(`/api/mission/${encodeURIComponent(e)}/rename`,{name:t})}function R(e,t){return E(`/api/mission/${encodeURIComponent(e)}/status`,{status:t})}function z(){return E(`/api/direct-studio/clear-completed`,{})}function ne(){return E(`/api/review-hall/accept-clear`,{})}function B(e){return D(`/api/mission/${encodeURIComponent(e)}`)}function V(e,t){return E(`/api/mission/${encodeURIComponent(e)}/action`,{action:t})}function re(e,t,n){return E(`/api/mission/${encodeURIComponent(e)}/gate/${encodeURIComponent(t)}/waive`,{reason:n})}function ie(e,t){return E(`/api/mission/${encodeURIComponent(e)}/gate`,t)}function ae(e,t,n){return O(`/api/mission/${encodeURIComponent(e)}/gate/${encodeURIComponent(t)}`,n)}function oe(e,t){return D(`/api/mission/${encodeURIComponent(e)}/gate/${encodeURIComponent(t)}`)}function se(e){return T(`/api/mission/${encodeURIComponent(e)}/plan/revisions`)}function ce(e,t,n){return E(`/api/mission/${encodeURIComponent(e)}/plan/approval`,{status:t,reason:n})}function H(e,t,n,r){return E(`/api/mission/${encodeURIComponent(e)}/task/${encodeURIComponent(t)}/action`,{action:n,detail:r})}function le(e,t){return E(`/api/mission/${encodeURIComponent(e)}/task`,{description:t})}function ue(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 T(`/api/mission/${encodeURIComponent(e)}/messages${r}`)}function de(e){return T(`/api/mission/${encodeURIComponent(e)}/context`)}function fe(e){return E(`/api/mission/${encodeURIComponent(e)}/handoff`,{})}function pe(e,t){return`${w}/api/mission/${encodeURIComponent(e)}/report?format=${t}`}function me(e,t,n){return E(`/api/mission/${encodeURIComponent(e)}/report/github`,{kind:t,target:n,confirmed:!0})}function he(){return T(`/api/policies`)}function U(e){return O(`/api/policies`,e)}function ge(e,t){return O(`/api/mission/${encodeURIComponent(e)}/policy`,{policy:t,confirmed:!0})}function _e(){return T(`/api/providers/models`)}function ve(e,t=!1){return E(`/api/session/${e}/stop`,{force:t})}function ye(e,t){return E(`/api/session/${encodeURIComponent(e)}/adopt`,{name:t})}function be({value:e,onChange:t,skills:n,placeholder:r,rows:i=3,onSubmit:a,className:o=``,suggestionsPlacement:s=`above`,autoFocus:c=!1,focusCaret:l,marker:u}){let d=(0,g.useMemo)(()=>new Map(n.map(e=>[e.name,e.source])),[n]),f=e=>d.get(e)===`claude`?`text-sky-300`:`text-violet-300`,[p,m]=(0,g.useState)(()=>l===`end`?e.length:0),[h,_]=(0,g.useState)(0),[v,y]=(0,g.useState)(!1),b=(0,g.useRef)(null),S=(0,g.useRef)(null),C=e.slice(0,p).match(/(?:^|\s)\/([\w:-]*)$/),w=C&&!v?n.filter(e=>e.name.toLowerCase().startsWith(C[1].toLowerCase())).slice(0,8):[];(0,g.useEffect)(()=>{if(!c||!l)return;let t=l===`end`?e.length:0,n=requestAnimationFrame(()=>{b.current?.focus(),b.current?.setSelectionRange(t,t),m(t)});return()=>cancelAnimationFrame(n)},[]);function T(n){if(!C)return;let r=p-C[1].length-1,i=`${e.slice(0,r)}/${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 E(e){S.current&&(S.current.scrollTop=e.scrollTop,S.current.scrollLeft=e.scrollLeft)}return(0,x.jsxs)(`div`,{className:`relative ${o}`,children:[(0,x.jsx)(`div`,{ref:S,"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)=>e.startsWith(`/`)&&d.has(e.slice(1))?(0,x.jsx)(`span`,{className:f(e.slice(1)),children:e},t):(0,x.jsx)(`span`,{className:`text-white`,children:e},t))}),(0,x.jsx)(`textarea`,{ref:b,...u?{[u]:``}:{},value:e,onScroll:e=>E(e.currentTarget),onChange:e=>{t(e.target.value),m(e.target.selectionStart),_(0),y(!1),requestAnimationFrame(()=>E(e.target))},onClick:e=>m(e.currentTarget.selectionStart),onKeyUp:e=>m(e.currentTarget.selectionStart),onKeyDown:e=>{if(e.key===`Escape`){if(e.preventDefault(),w.length&&!v){y(!0);return}e.currentTarget.blur();return}if(w.length){if(e.key===`ArrowDown`){e.preventDefault(),_((h+1)%w.length);return}if(e.key===`ArrowUp`){e.preventDefault(),_((h-1+w.length)%w.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),T(w[h]);return}}a&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),a())},rows:i,placeholder:r,autoFocus:c,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]`}),w.length>0&&(0,x.jsx)(`div`,{className:`absolute left-0 right-0 z-30 overflow-hidden rounded-lg border border-white/10 bg-[#17171c] shadow-2xl ${s===`above`?`bottom-full mb-2`:`top-full mt-2`}`,children:w.map((e,t)=>(0,x.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),T(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,x.jsxs)(`span`,{className:`min-w-0`,children:[(0,x.jsxs)(`span`,{className:`text-sm ${e.source===`claude`?`text-sky-300`:`text-violet-300`}`,children:[`/`,e.name]}),e.argumentHint&&(0,x.jsx)(`span`,{className:`ml-1.5 font-mono text-[10px] text-amber-200/45`,children:e.argumentHint}),e.description&&(0,x.jsx)(`span`,{className:`mt-0.5 block line-clamp-1 text-[11px] text-white/35`,children:e.description})]}),(0,x.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase text-white/20`,children:e.source})]},`${e.source}:${e.name}`))})]})}function xe(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 Se({value:e,onChange:t}){return(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.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,x.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,x.jsx)(`input`,{type:`checkbox`,checked:!!e[n],onChange:r=>t({...e,[n]:r.target.checked})}),r]},n))}),(0,x.jsxs)(`label`,{className:`block text-[10px] text-white/35`,children:[`Allowed repository roots `,(0,x.jsx)(`span`,{className:`text-white/20`,children:`(one per line; blank allows any directory)`}),(0,x.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,x.jsxs)(`label`,{className:`block text-[10px] text-white/35`,children:[`Allowed Claude tools `,(0,x.jsx)(`span`,{className:`text-white/20`,children:`(comma separated; blank uses normal CLI availability)`}),(0,x.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 Ce={page:10,selection:15,panel:20,field:25,drawer:30,modal:40};function we(e){return[...e].sort((e,t)=>t.level-e.level||t.sequence-e.sequence)}var Te=new Set,Ee=0,De;function Oe(e){if(!(e.key!==`Escape`||e.defaultPrevented)){for(let t of we([...Te]))if(t.onEscape()!==!1){e.preventDefault(),e.stopImmediatePropagation();return}}}function ke(e,t){let n={level:e,sequence:Ee+=1,onEscape:t};return Te.add(n),!De&&typeof window<`u`&&(De=Oe,window.addEventListener(`keydown`,De,!0)),()=>{Te.delete(n),Te.size===0&&De&&typeof window<`u`&&(window.removeEventListener(`keydown`,De,!0),De=void 0)}}function Ae(e,t,n){let r=(0,g.useRef)(n);r.current=n,(0,g.useEffect)(()=>{if(e)return ke(t,()=>r.current())},[e,t])}var je=e=>typeof window>`u`?null:localStorage.getItem(e);function Me({onClose:e,initialDraft:t,onLaunch:n}){let r=xe(e),[i,a]=(0,g.useState)(t?.task??``),[o,s]=(0,g.useState)(t?.name??``),[c,l]=(0,g.useState)(()=>t?.cwd??je(`hive:last-cwd`)??``),[u,d]=(0,g.useState)(()=>t?.mode??(je(`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??(je(`hive:last-mode`)||`direct`)===`orchestrated`),y=(0,g.useRef)(t?.worktree!==void 0);function b(e){d(e),y.current||v(e===`orchestrated`)}let[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)([]),[O,M]=(0,g.useState)(null),[N,P]=(0,g.useState)([]),[I,te]=(0,g.useState)([]),[L,R]=(0,g.useState)(!1),[z,ne]=(0,g.useState)(!1),B=(0,g.useRef)(null),[V,re]=(0,g.useState)(),[ie,ae]=(0,g.useState)(!1),[oe,se]=(0,g.useState)(!1),[ce,H]=(0,g.useState)({}),[le,ue]=(0,g.useState)([]),[de,fe]=(0,g.useState)(``),[pe,me]=(0,g.useState)([]),[U,ge]=(0,g.useState)(),[ve,ye]=(0,g.useState)(),[we,Te]=(0,g.useState)(!1),[Ee,De]=(0,g.useState)(t?.planFirst??!1);Ae(!0,Ce.modal,e),(0,g.useEffect)(()=>{if(!L)return;let e=e=>{B.current?.contains(e.target)||R(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[L]),(0,g.useEffect)(()=>{_e().then(({providers:e})=>me(e)).catch(()=>me([]))},[]),(0,g.useEffect)(()=>{he().then(({policy:e})=>{ge(e),ye(e)}).catch(()=>void 0)},[]),(0,g.useEffect)(()=>{F(``).then(({directories:e})=>{te(e),!c.trim()&&e[0]&&l(e[0].path)}).catch(()=>te([]))},[]),(0,g.useEffect)(()=>{c&&V?.exists&&!V.repositoryRoot&&ne(!0)},[c,V]),(0,g.useEffect)(()=>{let e=setTimeout(()=>{Promise.allSettled([A(c.trim()||void 0,f),F(c),ee(c.trim()||void 0),j(c.trim()||void 0)]).then(([e,t,n,r])=>{e.status===`fulfilled`?(D(e.value.skills),M(null)):(D([]),M(e.reason.message)),t.status===`fulfilled`&&P(t.value.directories),n.status===`fulfilled`&&re(n.value),r.status===`fulfilled`&&ue(r.value.templates)})},250);return()=>clearTimeout(e)},[c,f]);async function Oe(){if(!i.trim())return;let t={task:i,name:o.trim()||void 0,worktree:f===`claude`&&_,cwd:c.trim()||void 0,mode:u,budgets:ce,templateId:de||void 0,provider:f,model:m.trim()||void 0,policy:we?ve:void 0,planFirst:Ee};if(n){try{c.trim()&&localStorage.setItem(`hive:last-cwd`,c.trim()),localStorage.setItem(`hive:last-mode`,u)}catch{}n({promise:k(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:Ee,templateId:de||void 0,budgets:ce,policy:we?ve:void 0}}),e();return}C(!0),T(null);try{await k({task:i,name:o.trim()||void 0,worktree:f===`claude`&&_,cwd:c.trim()||void 0,mode:u,budgets:ce,templateId:de||void 0,provider:f,model:m.trim()||void 0,policy:we?ve:void 0,planFirst:u===`orchestrated`&&Ee});try{c.trim()&&localStorage.setItem(`hive:last-cwd`,c.trim()),localStorage.setItem(`hive:last-mode`,u)}catch{}e()}catch(e){T(e.message)}finally{C(!1)}}let ke=pe.find(e=>e.provider===f),Me=le.find(e=>e.id===de),Ne=V?.repositoryRoot?.split(`/`).filter(Boolean).at(-1)??c.split(`/`).filter(Boolean).at(-1)??`working directory`,Pe=m?ke?.models.find(e=>e.id===m)?.label??m:ke?.defaultModel?.label?`Default (${ke.defaultModel.label})`:`CLI default`,Fe=[u===`orchestrated`?`Orchestrated`:`Direct`,`${f===`claude`?`Claude`:`Codex`} ${Pe}`,Ne,f===`claude`&&_&&V?.repositoryRoot?`isolated worktree`:`current checkout`,u===`orchestrated`&&Ee?`plan approval required`:void 0].filter(Boolean).join(` · `);return(0,x.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,...r,children:(0,x.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,x.jsxs)(`div`,{className:`mb-5 flex items-center justify-between`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{id:`new-mission-title`,className:`text-sm font-medium text-white`,children:`New mission`}),(0,x.jsx)(`p`,{className:`mt-1 text-[10px] text-white/25`,children:`Define the work, choose how it runs, then launch.`})]}),(0,x.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,x.jsxs)(`section`,{children:[(0,x.jsx)(`p`,{className:`mb-3 text-[9px] font-semibold uppercase tracking-[0.18em] text-amber-200/40`,children:`Mission`}),(0,x.jsx)(`label`,{className:`mb-1 block text-xs text-white/40`,children:`Task`}),(0,x.jsx)(`div`,{className:`rounded-lg border border-white/10 bg-transparent p-1 focus-within:border-white/25`,children:(0,x.jsx)(be,{value:i,onChange:a,skills:E,rows:4,suggestionsPlacement:`below`,placeholder:`What should this mission accomplish? Type / to use a skill.`,autoFocus:!0,focusCaret:t?.task?`end`:void 0,onSubmit:Oe})}),(0,x.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,x.jsxs)(`label`,{className:`mb-1 block text-xs text-white/40`,children:[`Name `,(0,x.jsx)(`span`,{className:`text-white/20`,children:`(optional)`})]}),(0,x.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`}),z?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,x.jsx)(`label`,{className:`text-xs text-white/40`,children:`Custom working directory`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>{ne(!1),I[0]&&l(I[0].path),R(!1)},className:`text-[10px] text-violet-300/45 hover:text-violet-200`,children:`Choose a repository instead`})]}),(0,x.jsxs)(`div`,{ref:B,className:`relative`,children:[(0,x.jsx)(`input`,{value:c,onFocus:()=>R(!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`}),L&&N.length>0&&(0,x.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:N.map(e=>(0,x.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{l(e.path),R(!1)},className:`block w-full rounded-md px-3 py-2 text-left hover:bg-white/5`,children:[(0,x.jsx)(`span`,{className:`block font-mono text-xs text-white/75`,children:e.path}),e.path!==e.resolvedPath&&(0,x.jsx)(`span`,{className:`mt-0.5 block truncate font-mono text-[10px] text-white/25`,children:e.resolvedPath})]},e.resolvedPath))})]})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,x.jsx)(`label`,{className:`text-xs text-white/40`,children:`Repository`}),(0,x.jsx)(`span`,{className:`text-[10px] text-white/20`,children:`Recent Git repositories`})]}),(0,x.jsxs)(`select`,{value:c,onChange:e=>{e.target.value===`__custom__`?(ne(!0),R(!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&&!I.some(e=>e.path===c||e.resolvedPath===c)&&(0,x.jsx)(`option`,{value:c,children:c}),I.map(e=>(0,x.jsx)(`option`,{value:e.path,children:e.path},e.resolvedPath)),(0,x.jsx)(`option`,{value:`__custom__`,children:`Custom working directory…`})]})]}),V&&(0,x.jsx)(`div`,{className:`mt-2 rounded-lg border px-3 py-2 ${V.exists?`border-white/[0.06] bg-white/[0.018]`:`border-rose-400/15 bg-rose-400/[0.04]`}`,children:V.exists?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[10px]`,children:[(0,x.jsx)(`span`,{className:`font-mono text-white/45`,children:Ne}),(0,x.jsx)(`span`,{className:V.repositoryRoot?`text-emerald-300/45`:`text-amber-200/45`,children:V.repositoryRoot?`Git repository`:`Non-Git directory`}),V.branch&&(0,x.jsx)(`span`,{className:`text-violet-300/50`,children:V.branch}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>se(!oe),className:`ml-auto text-white/25 hover:text-white/50`,children:oe?`Hide details`:`View project details`})]}),oe&&(0,x.jsxs)(`div`,{className:`mt-2 border-t border-white/[0.05] pt-2`,children:[(0,x.jsx)(`p`,{className:`break-all font-mono text-[9px] text-white/25`,children:V.resolvedPath}),(0,x.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:V.configuration.map(e=>(0,x.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,x.jsxs)(`p`,{className:`text-[11px] text-rose-300/70`,children:[`Directory not found: `,(0,x.jsx)(`span`,{className:`font-mono`,children:V.resolvedPath})]})}),(0,x.jsx)(`p`,{className:`mt-2 text-[10px] ${O?`text-rose-400`:`text-white/22`}`,children:O??`${E.length} skill${E.length===1?``:`s`} available`})]}),(0,x.jsxs)(`section`,{className:`mt-5 border-t border-white/[0.06] pt-5`,children:[(0,x.jsx)(`p`,{className:`mb-3 text-[9px] font-semibold uppercase tracking-[0.18em] text-violet-200/40`,children:`Execution`}),(0,x.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-2`,children:[`direct`,`orchestrated`].map(e=>(0,x.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,x.jsx)(`span`,{className:`block text-sm font-medium capitalize text-white/85`,children:e}),(0,x.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,x.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-2`,children:[`claude`,`codex`].map(e=>{let t=pe.find(t=>t.provider===e)?.available===!1;return(0,x.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,x.jsx)(`span`,{className:`text-xs font-medium capitalize text-white/75`,children:e}),t&&(0,x.jsx)(`span`,{className:`ml-2 text-[8px] uppercase text-rose-300/60`,children:`Not detected`})]},e)})}),(0,x.jsx)(`label`,{className:`mb-1 block text-xs text-white/40`,children:`Model`}),(0,x.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,x.jsxs)(`option`,{value:``,children:[`CLI default`,ke?.defaultModel?` (${ke.defaultModel.label})`:``,` · recommended`]}),(ke?.models??[]).map(e=>(0,x.jsxs)(`option`,{value:e.id,children:[e.label,` · `,e.description??e.id]},e.id))]}),(0,x.jsx)(`p`,{className:`mb-2 text-[10px] font-medium text-white/30`,children:`Launch options`}),(0,x.jsxs)(`div`,{className:`mb-3 grid gap-2 ${u===`orchestrated`?`sm:grid-cols-2`:``}`,children:[(0,x.jsxs)(`label`,{className:`flex items-start gap-2 rounded-lg border px-3 py-2.5 ${f===`claude`&&V?.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,x.jsx)(`input`,{type:`checkbox`,checked:f===`claude`&&!!V?.repositoryRoot&&_,disabled:f!==`claude`||!V?.repositoryRoot,onChange:e=>{y.current=!0,v(e.target.checked)},className:`mt-0.5 accent-violet-400`}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`block text-xs text-white/60`,children:`Isolated worktree`}),(0,x.jsx)(`span`,{className:`mt-0.5 block text-[9px] text-white/25`,children:`Separate checkout for this mission.`})]})]}),u===`orchestrated`&&(0,x.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-lg border px-3 py-2.5 ${Ee?`border-amber-300/25 bg-amber-300/[0.05]`:`border-white/[0.07] bg-white/[0.015]`}`,children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:Ee,onChange:e=>De(e.target.checked),className:`mt-0.5 accent-amber-300`}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`block text-xs text-white/60`,children:`Plan first`}),(0,x.jsx)(`span`,{className:`mt-0.5 block text-[9px] text-white/25`,children:`Approve the plan before workers begin.`})]})]})]}),(0,x.jsx)(`label`,{className:`mb-1 block text-xs text-white/40`,children:`Mission template`}),(0,x.jsxs)(`select`,{value:de,onChange:e=>{let t=e.target.value;fe(t);let n=le.find(e=>e.id===t);n&&(d(n.mode),y.current=!0,v(n.worktree),H(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,x.jsx)(`option`,{value:``,children:`No template`}),le.map(e=>(0,x.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.version,` · `,e.source]},`${e.source}:${e.id}`))]}),Me&&(0,x.jsxs)(`div`,{className:`mt-2 rounded-lg border border-violet-300/10 bg-violet-300/[0.03] px-3 py-2`,children:[(0,x.jsx)(`p`,{className:`text-[10px] text-white/45`,children:Me.description}),(0,x.jsxs)(`p`,{className:`mt-1 truncate text-[9px] text-white/22`,children:[Me.stages.map(e=>e.title).join(` → `),` · `,Me.gates.length,` required gate`,Me.gates.length===1?``:`s`]})]})]}),(0,x.jsxs)(`section`,{className:`mt-4 rounded-lg border border-white/[0.06] bg-white/[0.012]`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>ae(!ie),className:`flex w-full items-center justify-between px-3 py-3 text-left`,children:[(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`block text-xs font-medium text-white/50`,children:`Advanced settings`}),(0,x.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-white/22`,children:`Permission policy and mission budgets`})]}),(0,x.jsx)(`span`,{className:`text-xs text-white/25`,children:ie?`−`:`+`})]}),ie&&(0,x.jsxs)(`div`,{className:`space-y-5 border-t border-white/[0.05] p-3`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-xs font-medium text-white/50`,children:`Permission policy`}),(0,x.jsx)(`p`,{className:`mt-0.5 text-[9px] text-white/22`,children:we?`Custom mission override`:`Workspace defaults and template restrictions`})]}),we&&U&&(0,x.jsx)(`button`,{type:`button`,onClick:()=>{ye(U),Te(!1)},className:`text-[9px] text-white/25 hover:text-white/50`,children:`Reset`})]}),ve?(0,x.jsx)(Se,{value:ve,onChange:e=>{ye(e),Te(!0)}}):(0,x.jsx)(`p`,{className:`text-xs text-white/25`,children:`Loading policy…`})]}),(0,x.jsxs)(`div`,{className:`border-t border-white/[0.05] pt-4`,children:[(0,x.jsxs)(`p`,{className:`mb-3 text-xs font-medium text-white/50`,children:[`Mission budgets `,(0,x.jsx)(`span`,{className:`font-normal text-white/20`,children:`· optional soft limits`})]}),(0,x.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,x.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[t,(0,x.jsx)(`input`,{type:`number`,min:`1`,value:ce[e]??``,onChange:t=>H(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))})]})]})]}),w&&(0,x.jsx)(`p`,{className:`mt-3 text-xs text-rose-400`,children:w}),(0,x.jsxs)(`div`,{className:`mt-4 border-t border-white/[0.06] pt-4`,children:[(0,x.jsx)(`p`,{className:`mb-3 truncate text-[10px] text-white/28`,title:Fe,children:Fe}),(0,x.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{onClick:e,className:`rounded-lg px-3 py-1.5 text-sm text-white/45 hover:text-white/75`,children:`Cancel`}),(0,x.jsx)(`button`,{onClick:Oe,disabled:S||!i.trim()||!!O||V?.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:S?`Starting…`:`Start ${u} mission`})]})]})]})})}function Ne({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 L(e,n),i(!1)}finally{c(!1)}}return r?(0,x.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,x.jsxs)(`div`,{className:`group/name flex min-w-0 items-center gap-1.5`,children:[(0,x.jsx)(`span`,{title:t,className:`${n?`text-xl`:`text-sm`} truncate font-semibold text-white`,children:t}),(0,x.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 Pe({compact:e=!1}){return(0,x.jsx)(`div`,{className:`hive-mark ${e?`h-8 w-8`:`h-10 w-10`}`,"aria-hidden":`true`,children:(0,x.jsxs)(`svg`,{viewBox:`0 0 48 48`,fill:`none`,className:`h-full w-full`,children:[(0,x.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,x.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,x.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,x.jsx)(`path`,{d:`M19 23h10M18.7 27.5h10.6`,stroke:`#30230b`,strokeWidth:`2.4`}),(0,x.jsx)(`path`,{d:`m21 32.1 3 3 3-3`,fill:`#f7b93e`}),(0,x.jsx)(`circle`,{cx:`22`,cy:`20.5`,r:`.8`,fill:`#30230b`}),(0,x.jsx)(`circle`,{cx:`26`,cy:`20.5`,r:`.8`,fill:`#30230b`}),(0,x.jsxs)(`defs`,{children:[(0,x.jsxs)(`linearGradient`,{id:`hive-fill`,x1:`9`,y1:`7`,x2:`39`,y2:`42`,gradientUnits:`userSpaceOnUse`,children:[(0,x.jsx)(`stop`,{stopColor:`#F9C74F`,stopOpacity:`.22`}),(0,x.jsx)(`stop`,{offset:`1`,stopColor:`#7C3AED`,stopOpacity:`.1`})]}),(0,x.jsxs)(`linearGradient`,{id:`hive-stroke`,x1:`8`,y1:`8`,x2:`40`,y2:`41`,gradientUnits:`userSpaceOnUse`,children:[(0,x.jsx)(`stop`,{stopColor:`#FFD875`}),(0,x.jsx)(`stop`,{offset:`1`,stopColor:`#A78BFA`,stopOpacity:`.55`})]})]})]})})}function Fe({subtitle:e}){return(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(Pe,{}),(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`h1`,{className:`hive-wordmark text-xl text-white`,children:`Hive`}),(0,x.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 Ie={critical:0,warning:1,info:2};function Le(e){return[...e].sort((e,t)=>Ie[e.severity]-Ie[t.severity])}function Re(e){return e.split(`/.claude/worktrees/`)[0]}function ze(e){return Re(e).split(`/`).at(-1)??e}function Be(e){let t=e.replace(/^worktree-/,``);return t.length>24?`…${t.slice(-23)}`:t}function Ve(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 He(e,t){return e===`active`||e===`failed`||t===`working`||t===`waiting_on_you`||t===`stalled`||t===`error`}function Ue(e){let t=e?.trim();if(!(!t||/^awaiting (user )?acceptance\.?$/i.test(t)))return t}function We(e,t,n){return Ue(t)??Ue(n)}function Ge(e){let t=e=>e.status!==`queued`||(e.subtasks??[]).some(t);return(e?.phases??[]).some(e=>e.status!==`queued`||e.tasks.some(t))}function Ke(e){return e.lifecycleStatus!==`active`||e.plan?.approvalStatus!==`proposed`?!1:!!e.mission?.planFirst||!Ge(e.plan)}function qe(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 Je(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 Ye(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 Xe(e){return e===`active`||e===`ready_for_review`||e===`paused`||e===`failed`}function Ze(e){if(e===`active`)return{label:`Pause mission`,shortLabel:`Pause`,next:`paused`};if(e===`paused`)return{label:`Resume mission`,shortLabel:`Resume`,next:`active`}}function Qe(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 $e(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 et=new Set([`button`,`checkbox`,`color`,`file`,`image`,`radio`,`range`,`reset`,`submit`]);function tt(e){let t=e;return t&&t.nodeType===1?t:void 0}function nt(e){let t=tt(e);return t?t.isContentEditable?!0:[`INPUT`,`TEXTAREA`,`SELECT`].includes(t.tagName):!1}function rt(e){let t=tt(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!et.has(r)}var it=`hive:collapsed-sections`;function at(){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 ot(e,t){let n=at()[e];return typeof n==`boolean`?n:t}var st=`Needs you`,ct=`Needs you:pinned`;function lt(e){let t=at()[ct]===!0;return{pinned:t,collapsed:t?ot(st,e):e}}function ut(e){dt(st,e),dt(ct,!0)}function dt(e,t){try{localStorage.setItem(it,JSON.stringify({...at(),[e]:t}))}catch{}}var ft={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`},pt={decision:`Decision`,failure:`Failed`,stale:`Stale`,acceptance:`Accept`,plan_approval:`Plan`,stall:`Stalled`},mt=`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`,ht=`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 gt(e){return e.length>0&&e.every(e=>e.kind===`acceptance`)}function _t({items:e,onOpenMission:t,numbersActive:n=!0}){let r=gt(e),[i,a]=(0,g.useState)(()=>lt(r).collapsed),[o,s]=(0,g.useState)(()=>lt(r).pinned),c=e=>{s(!0),a(e),ut(e)},[l,u]=(0,g.useState)(-1);(0,g.useEffect)(()=>{o||a(r)},[o,r]);let[d,f]=(0,g.useState)({}),[p,m]=(0,g.useState)(null),[h,_]=(0,g.useState)({});if((0,g.useEffect)(()=>{if(typeof window>`u`)return;let r=r=>{if(r.metaKey||r.ctrlKey||r.altKey||r.defaultPrevented||rt(r.target))return;if(r.key===`0`){r.preventDefault(),c(!i);return}if(l>=0&&l<e.length){let n=e[l],i=r.key.toLowerCase();if(i===`a`||i===`d`){let e=i===`a`?Qe(n.lifecycle,n.pending):$e(n.lifecycle,n.pending);if(!e)return;r.preventDefault(),v(n.id,()=>e.answer?te(n.missionId,e.decisionId,e.answer):R(n.missionId,e.next)),u(-1);return}if(r.key===`Enter`){r.preventDefault(),t(n.missionId);return}}if(!n)return;let o=Number(r.key)-1;!Number.isInteger(o)||o<0||o>=Math.min(e.length,9)||(r.preventDefault(),u(o),a(!1))};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)}),!e.length)return null;async function v(e,t){m(e),_(t=>({...t,[e]:``}));try{await t()}catch(t){_(n=>({...n,[e]:t.message}))}finally{m(null)}}new Set(e.map(e=>e.missionId)).size;let y=e.reduce((e,t)=>({...e,[t.kind]:(e[t.kind]??0)+1}),{}),b=[y.decision&&`${y.decision} decision${y.decision===1?``:`s`}`,y.failure&&`${y.failure} failed`,y.stall&&`${y.stall} stalled`,y.plan_approval&&`${y.plan_approval} plan${y.plan_approval===1?``:`s`} to approve`,y.acceptance&&`${y.acceptance} to accept`].filter(Boolean).join(` · `)||`${e.length} item${e.length===1?``:`s`}`;return(0,x.jsxs)(`section`,{"aria-label":`Needs you`,"data-urgent":!r,className:`sticky top-2 z-30 mb-6 rounded-xl border-2 border-rose-400 bg-rose-400/[0.07] p-3 backdrop-blur ${r?`shadow-[0_0_18px_rgba(251,113,133,0.3)]`:`hive-attention`}`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>c(!i),"aria-expanded":!i,className:`group/rail flex w-full items-center justify-between gap-3 px-1 text-left`,children:[(0,x.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,x.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] ${r?`bg-rose-300`:`bg-rose-400 hive-pulse`}`,children:e.length}),(0,x.jsx)(`span`,{className:`text-[11px] font-bold uppercase tracking-[0.2em] text-rose-50`,children:`Needs you`}),(0,x.jsxs)(`span`,{className:`truncate text-[11px] text-rose-100/60`,children:[b,!i&&e.length>1&&` · 1–9 opens`]})]}),(0,x.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:[i?`Review`:`Hide`,(0,x.jsx)(`kbd`,{className:`mono text-[9px] text-rose-100/40`,children:`0`})]})]}),!i&&(0,x.jsx)(`ul`,{className:`mt-2.5 flex flex-col gap-1.5`,children:e.map((e,r)=>{let i=p===e.id,a=h[e.id];return(0,x.jsxs)(`li`,{className:`rounded-lg border bg-white/[0.022] px-3 py-2.5 ${l===r?`border-amber-300/30 ring-1 ring-amber-300/20`:`border-white/[0.06]`}`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5`,children:[r<9&&(0,x.jsx)(`span`,{className:`mono shrink-0 rounded border px-1.5 text-[10px] ${l===r?`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:r+1}),(0,x.jsx)(`span`,{className:`shrink-0 text-[9px] font-semibold uppercase tracking-wider ${ft[e.kind]}`,children:pt[e.kind]}),(0,x.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,x.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:ze(e.repository)}),(0,x.jsx)(`span`,{className:`min-w-0 flex-1 basis-40 truncate text-xs text-white/50`,title:e.summary,children:e.summary}),(0,x.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,x.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>v(e.id,()=>te(e.missionId,e.decision.id,t)),className:mt,children:t},t)),e.kind===`acceptance`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>v(e.id,()=>R(e.missionId,`completed`)),className:mt,children:`Accept`}),(0,x.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>v(e.id,()=>R(e.missionId,`active`)),className:ht,children:`Request changes`})]}),e.kind===`plan_approval`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>v(e.id,()=>ce(e.missionId,`approved`)),className:mt,children:`Approve plan`}),(0,x.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>v(e.id,()=>ce(e.missionId,`rejected`)),className:ht,children:`Reject`})]}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>t(e.missionId),className:ht,children:`Open ↗`})]})]}),e.decision&&(0,x.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 pl-1`,children:[e.decision.recommendation&&(0,x.jsxs)(`span`,{className:`rounded bg-emerald-300/[0.05] px-2 py-1 text-[10px] text-emerald-100/55`,children:[(0,x.jsx)(`span`,{className:`font-medium`,children:`Recommended:`}),` `,e.decision.recommendation]}),(0,x.jsx)(`input`,{value:d[e.id]??``,onChange:t=>f(n=>({...n,[e.id]:t.target.value})),onKeyDown:t=>{if(t.key!==`Enter`)return;let n=(d[e.id]??``).trim();n&&v(e.id,()=>te(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`})]}),i&&(0,x.jsx)(`p`,{className:`mt-1.5 pl-1 text-[10px] text-white/30`,children:`Sending…`}),a&&(0,x.jsx)(`p`,{className:`mt-1.5 pl-1 text-[10px] text-rose-400`,children:a})]},e.id)})})]})}function vt({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 ve(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,x.jsxs)(`span`,{className:`relative inline-flex`,children:[(0,x.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,x.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 yt=[`investigation`,`implementation`,`testing`,`review`,`browser_qa`,`documentation`,`custom`],bt=[`test`,`typecheck`,`lint`,`ci`,`review`,`pr`,`screenshot`,`documentation`,`user_approval`,`custom`],xt=[`commits`,`pushes`,`pullRequests`,`releases`,`destructiveActions`,`network`],St=e=>e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,63);function Ct(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 wt({initial:e,cwd:t,onCancel:n,onSaved:r}){let i=!!e,[a,o]=(0,g.useState)(()=>e?structuredClone(e):Ct(`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 N(a,t):await M(a,a.source,t)).template)}catch(e){u(e.message)}finally{c(!1)}}}return(0,x.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto p-6`,children:[(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.16em] text-amber-300/55`,children:i?`Edit workflow`:`Create workflow`}),(0,x.jsx)(`h2`,{className:`mt-1 text-xl font-semibold text-white`,children:a.name||`Untitled template`})]}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[(0,x.jsx)(`button`,{onClick:n,className:`rounded-lg px-3 py-2 text-xs text-white/40 hover:text-white/70`,children:`Cancel`}),(0,x.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,x.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,x.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,x.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Name`,(0,x.jsx)(`input`,{className:f,value:a.name,onChange:e=>o({...a,name:e.target.value,...!i&&a.id===`new-template`?{id:St(e.target.value)}:{}})})]}),(0,x.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Template ID`,(0,x.jsx)(`input`,{disabled:i,className:`${f} font-mono disabled:opacity-40`,value:a.id,onChange:e=>o({...a,id:St(e.target.value)})})]}),(0,x.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Version`,(0,x.jsx)(`input`,{type:`number`,min:`1`,className:f,value:a.version,onChange:e=>o({...a,version:Math.max(1,Number(e.target.value))})})]}),(0,x.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Ownership`,(0,x.jsxs)(`select`,{disabled:i,className:`${f} disabled:opacity-40`,value:a.source,onChange:e=>o({...a,source:e.target.value}),children:[(0,x.jsx)(`option`,{value:`user`,children:`My templates`}),(0,x.jsx)(`option`,{value:`repository`,children:`This repository`})]})]})]}),a.source===`repository`&&(0,x.jsxs)(`p`,{className:`mt-2 text-[10px] text-violet-200/40`,children:[`Repository scope: `,t||`Select a repository in the library first.`]}),(0,x.jsxs)(`label`,{className:`mt-4 block text-[10px] text-white/35`,children:[`Purpose`,(0,x.jsx)(`textarea`,{rows:2,className:f,value:a.description,onChange:e=>o({...a,description:e.target.value})})]}),(0,x.jsxs)(`label`,{className:`mt-3 block text-[10px] text-white/35`,children:[`Manager instructions`,(0,x.jsx)(`textarea`,{rows:4,className:f,value:a.managerInstructions,onChange:e=>o({...a,managerInstructions:e.target.value})})]}),(0,x.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,x.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Execution mode`,(0,x.jsxs)(`select`,{className:f,value:a.mode,onChange:e=>o({...a,mode:e.target.value}),children:[(0,x.jsx)(`option`,{value:`orchestrated`,children:`Orchestrated`}),(0,x.jsx)(`option`,{value:`direct`,children:`Direct`})]})]}),(0,x.jsxs)(`label`,{className:`flex items-end gap-2 pb-2 text-xs text-white/50`,children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:a.worktree,onChange:e=>o({...a,worktree:e.target.checked})}),`Create a worktree`]})]}),(0,x.jsxs)(`section`,{className:`mt-5 rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Mission stages`}),(0,x.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,x.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,x.jsx)(`div`,{className:`mt-3 space-y-2`,children:a.stages.map((e,t)=>(0,x.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_1fr_34px] gap-2`,children:[(0,x.jsx)(`input`,{"aria-label":`Stage title`,className:f,value:e.title,onChange:n=>{let r=[...a.stages],s=e.id,c=i?e.id:St(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,x.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:yt.map(e=>(0,x.jsx)(`option`,{value:e,children:e.replaceAll(`_`,` `)},e))}),(0,x.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,x.jsx)(`option`,{value:``,children:`No dependency`}),a.stages.filter(t=>t.id!==e.id).map(e=>(0,x.jsxs)(`option`,{value:e.id,children:[`After `,e.title]},e.id))]}),(0,x.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,x.jsxs)(`section`,{className:`mt-4 rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Completion gates`}),(0,x.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/25`,children:`Required evidence before the mission can appear complete.`})]}),(0,x.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,x.jsx)(`div`,{className:`mt-3 space-y-2`,children:a.gates.map((e,t)=>(0,x.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_auto_34px] gap-2`,children:[(0,x.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-${St(n.target.value)||t+1}`},o({...a,gates:r})}}),(0,x.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:bt.map(e=>(0,x.jsx)(`option`,{value:e,children:e.replaceAll(`_`,` `)},e))}),(0,x.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px] text-white/35`,children:[(0,x.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,x.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,x.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Budgets`}),(0,x.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:[`maxWorkers`,`maxConcurrentWorkers`,`maxTokens`,`maxElapsedMinutes`].map(e=>(0,x.jsxs)(`label`,{className:`text-[9px] text-white/30`,children:[e.replace(/([A-Z])/g,` $1`),(0,x.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,x.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Permissions`}),(0,x.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:xt.map(e=>(0,x.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,x.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,x.jsxs)(`section`,{className:`mt-4 rounded-xl border border-violet-300/10 bg-violet-300/[0.025] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-violet-200/45`,children:`Live mission preview`}),(0,x.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-white/50`,children:a.managerInstructions||`Manager instructions will appear here.`}),(0,x.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:a.stages.map((e,t)=>(0,x.jsxs)(`span`,{className:`text-[10px] text-white/40`,children:[(0,x.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,x.jsx)(`span`,{className:`ml-2 text-white/15`,children:`→`})]},`${e.id}:${t}`))}),(0,x.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 Tt(e){return e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}function Et({template:e,repository:t,onDuplicate:n,onEdit:r,onDelete:i}){return(0,x.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto p-6`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:e.name}),(0,x.jsx)(`span`,{className:`rounded-full border border-white/10 px-2 py-0.5 text-[9px] uppercase text-white/35`,children:e.source}),(0,x.jsxs)(`span`,{className:`text-[10px] text-white/25`,children:[`v`,e.version]})]}),(0,x.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm leading-relaxed text-white/50`,children:e.description}),(0,x.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,x.jsxs)(`div`,{className:`flex gap-2`,children:[e.source!==`built-in`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.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,x.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,x.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,x.jsxs)(`div`,{className:`mt-6 grid gap-4 lg:grid-cols-2`,children:[(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Manager instructions`}),(0,x.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap text-xs leading-relaxed text-white/55`,children:e.managerInstructions})]}),(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Launch configuration`}),(0,x.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[110px_1fr] gap-y-2 text-xs`,children:[(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Mode`}),(0,x.jsx)(`dd`,{className:`capitalize text-white/55`,children:e.mode}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Worktree`}),(0,x.jsx)(`dd`,{className:`text-white/55`,children:e.worktree?`Create isolated worktree`:`Use working directory`}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Source`}),(0,x.jsx)(`dd`,{className:`capitalize text-white/55`,children:e.source}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Template ID`}),(0,x.jsx)(`dd`,{className:`font-mono text-white/45`,children:e.id})]})]})]}),(0,x.jsxs)(`section`,{className:`mt-4 rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Mission stages`}),(0,x.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:e.stages.map((t,n)=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(`div`,{className:`rounded-lg border border-violet-300/10 bg-violet-300/[0.035] px-3 py-2`,children:[(0,x.jsx)(`p`,{className:`text-xs font-medium text-white/65`,children:t.title}),(0,x.jsx)(`p`,{className:`mt-0.5 text-[9px] uppercase text-violet-300/45`,children:Tt(t.role)})]}),n<e.stages.length-1&&(0,x.jsx)(`span`,{className:`text-white/15`,children:`→`})]},t.id))})]}),(0,x.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Completion gates`}),(0,x.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.gates.length?e.gates.map(e=>(0,x.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-white/[0.06] px-3 py-2`,children:[(0,x.jsx)(`span`,{className:`text-xs text-white/55`,children:e.label}),(0,x.jsxs)(`span`,{className:`text-[9px] uppercase text-white/25`,children:[Tt(e.type),e.required?` · required`:``]})]},e.id)):(0,x.jsx)(`p`,{className:`text-xs text-white/25`,children:`No completion gates.`})})]}),(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Budgets and permissions`}),(0,x.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:Object.entries(e.budgets??{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`rounded bg-white/[0.04] px-2 py-1 text-[10px] text-white/40`,children:[Tt(e),`: `,t?.toLocaleString()]},e))}),(0,x.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:Object.entries(e.permissions).map(([e,t])=>(0,x.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`,` · `,Tt(e)]},e))})]})]})]})}function Dt({repositories:e,onClose:t}){let n=xe(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,S]=(0,g.useState)(`user`),[C,w]=(0,g.useState)(!1),[T,E]=(0,g.useState)(null),[D,O]=(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 j(r||void 0);o(e.templates),O(e.diagnostics??[]),c(t=>e.templates.some(e=>e.id===t)?t:e.templates[0]?.id??``)}catch(e){f(e.message),O([])}finally{u(!1)}}(0,g.useEffect)(()=>{A()},[r]),Ae(!0,Ce.modal,t);function N(){k&&(_(`${k.name} copy`),y(`${k.id}-copy`),m(!0),f(null))}async function F(){if(!(!k||!h.trim()||!v.trim())){w(!0),f(null);try{let e={...k,id:v.trim().toLowerCase().replace(/[^a-z0-9-]+/g,`-`),name:h.trim(),version:1,source:b};await M(e,b,r||void 0),m(!1),await A(),c(e.id)}catch(e){f(e.message)}finally{w(!1)}}}async function ee(){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 P(k,r||void 0),c(``),await A()}catch(e){f(e.message)}}}return(0,x.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,...n,children:(0,x.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,x.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-white/8 px-5 py-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.18em] text-amber-300/55`,children:`Hive workflows`}),(0,x.jsx)(`h1`,{className:`mt-0.5 text-lg font-semibold text-white`,children:`Template library`})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.length>0&&(0,x.jsxs)(`select`,{value:r,onChange:e=>{i(e.target.value),E(null)},className:`max-w-64 rounded-lg border border-white/10 bg-[#17171c] px-3 py-2 text-xs text-white/50`,children:[(0,x.jsx)(`option`,{value:``,children:`Current Hive repository`}),e.map(e=>(0,x.jsxs)(`option`,{value:e,children:[e.split(`/`).at(-1),` · `,e]},e))]}),(0,x.jsx)(`button`,{onClick:()=>{E(`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,x.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,x.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,x.jsx)(`button`,{onClick:()=>void A(),className:`ml-2 underline hover:text-white`,children:`Retry`})]}),D.length>0&&(0,x.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,x.jsxs)(`summary`,{className:`cursor-pointer`,children:[D.length,` malformed template file`,D.length===1?` was`:`s were`,` skipped · View recovery details`]}),(0,x.jsx)(`div`,{className:`mt-2 space-y-1`,children:D.map(e=>(0,x.jsxs)(`p`,{children:[(0,x.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,x.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,x.jsx)(`aside`,{className:`w-64 shrink-0 overflow-y-auto border-r border-white/8 p-3`,children:l?(0,x.jsx)(`p`,{className:`p-3 text-xs text-white/25`,children:`Loading templates…`}):a.length?a.map(e=>(0,x.jsxs)(`button`,{onClick:()=>{c(e.id),m(!1),E(null)},className:`mb-1 w-full rounded-lg border px-3 py-2.5 text-left transition ${k?.id===e.id&&!T?`border-amber-300/15 bg-amber-300/[0.06]`:`border-transparent hover:border-white/8 hover:bg-white/[0.03]`}`,children:[(0,x.jsx)(`p`,{className:`truncate text-xs font-medium text-white/65`,children:e.name}),(0,x.jsxs)(`p`,{className:`mt-1 text-[9px] uppercase tracking-wide text-white/25`,children:[e.source,` · v`,e.version]})]},`${e.source}:${e.id}`)):(0,x.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.`})}),T?(0,x.jsx)(wt,{initial:T===`edit`?k:void 0,cwd:r||void 0,onCancel:()=>E(null),onSaved:e=>{E(null),A().then(()=>c(e.id))}}):k?(0,x.jsx)(Et,{template:k,repository:r||void 0,onDuplicate:N,onEdit:()=>E(`edit`),onDelete:()=>void ee()}):!l&&(0,x.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,x.jsxs)(`div`,{className:`border-t border-white/8 bg-[#121217] p-4`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,x.jsxs)(`label`,{className:`min-w-48 flex-1 text-[10px] text-white/35`,children:[`Template name`,(0,x.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,x.jsxs)(`label`,{className:`min-w-40 flex-1 text-[10px] text-white/35`,children:[`Template ID`,(0,x.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,x.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Save to`,(0,x.jsxs)(`select`,{value:b,onChange:e=>S(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,x.jsx)(`option`,{value:`user`,children:`My templates`}),(0,x.jsx)(`option`,{value:`repository`,children:`This repository`})]})]}),(0,x.jsx)(`button`,{onClick:()=>m(!1),className:`rounded-lg px-3 py-2 text-xs text-white/35 hover:text-white/65`,children:`Cancel`}),(0,x.jsx)(`button`,{onClick:()=>void F(),disabled:C||!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:C?`Saving…`:`Create copy`})]}),b===`repository`&&!r&&(0,x.jsx)(`p`,{className:`mt-2 text-[10px] text-amber-200/45`,children:`Select a repository before saving a repository template.`})]})]})})}function Ot({onClose:e}){let t=xe(e),[n,r]=(0,g.useState)(),[i,a]=(0,g.useState)(),[o,s]=(0,g.useState)(!1);(0,g.useEffect)(()=>{he().then(({policy:e})=>r(e)).catch(e=>a(e.message))},[]),Ae(!0,Ce.modal,e);async function c(){if(n){s(!0);try{await U(n),e()}catch(e){a(e.message)}finally{s(!1)}}}return(0,x.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/65 p-4`,...t,children:(0,x.jsxs)(`div`,{className:`w-full max-w-xl rounded-2xl border border-white/10 bg-[#101014] p-5`,onClick:e=>e.stopPropagation(),children:[(0,x.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Workspace policy`}),(0,x.jsx)(`p`,{className:`mt-1 text-[10px] text-white/30`,children:`Defaults copied into every new mission. Mission overrides remain durable.`})]}),(0,x.jsx)(`button`,{onClick:e,className:`px-2 text-white/40`,children:`×`})]}),n&&(0,x.jsx)(Se,{value:n,onChange:r}),i&&(0,x.jsx)(`p`,{className:`mt-3 text-xs text-rose-300`,children:i}),(0,x.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,x.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{onClick:e,className:`px-3 py-2 text-xs text-white/40`,children:`Cancel`}),(0,x.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 kt={queued:`Queued`,working:`In progress`,blocked:`Blocked`,reviewing:`Reviewing`,completed:`Complete`,failed:`Failed`,cancelled:`Cancelled`};function At(e){return kt[e]??e}function jt(e){return e.flatMap(e=>[e,...jt(e.subtasks??[])])}function Mt(e){return e.flatMap(e=>e.subtasks?.length?Mt(e.subtasks):[e])}function Nt(e){return e?.phases.flatMap(e=>jt(e.tasks))??[]}var Pt={query:``,queryScope:`name`,status:`all`,repository:`all`,template:`all`,date:`all`,needsMe:!1},Ft={waiting_on_you:0,error:1,working:2,stalled:3,idle:4,offline:5,done:6};function It(e){return[e.name,e.mission.repository,e.mission.repository?ze(e.mission.repository):void 0,e.worktreeBranch].filter(Boolean).join(` `).toLowerCase()}function Lt(e,t){let n=Nt(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 W(e,t){return e===`24h`?t-864e5:e===`7d`?t-6048e5:e===`30d`?t-2592e6:0}function Rt(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`||Ke(e)}function zt(e,t){return t.has(e.missionId)||e.lifecycleStatus===`failed`||e.activityStatus===`waiting_on_you`||e.activityStatus===`error`||e.activityStatus===`stalled`||Ke(e)}function Bt(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?ze(e.mission.repository):``).localeCompare(t.mission.repository?ze(t.mission.repository):``)||t.updatedAt-e.updatedAt:(e,t)=>Ft[e.activityStatus]-Ft[t.activityStatus]||t.updatedAt-e.updatedAt}function Vt(e,t,n=Date.now(),r=`attention`){let i=[...new Set(e.orchestrators.map(e=>e.mission.repository).filter(e=>!!e).map(Re))].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=W(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`?Lt(n,e):It(n);if(!o.every(e=>r.includes(e)))return!1}return t.needsMe&&!Rt(n,c)||t.status!==`all`&&n.lifecycleStatus!==t.status&&n.activityStatus!==t.status||t.repository!==`all`&&(!n.mission.repository||Re(n.mission.repository)!==t.repository)||t.template!==`all`&&n.mission.template?.id!==t.template?!1:!s||n.updatedAt>=s}),u=Bt(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=>Rt(e,c)).length}}function Ht(e){let t=new Set((e.decisions??[]).map(e=>e.missionId)),n=e.orchestrators.filter(e=>e.lifecycleStatus!==`archived`),r=n.filter(e=>Rt(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 Ut={"24h":`last 24 hours`,"7d":`last 7 days`,"30d":`last 30 days`};function Wt(e,t,n){let r=n=>()=>t({...e,[n]:Pt[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:ze(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:Ut[e.date]??e.date,clear:r(`date`)}),i}function Gt({value:e,onChange:t,templates:n,shown:r,total:i}){let a=Wt(e,t,n);return a.length?(0,x.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-1.5`,children:[(0,x.jsxs)(`span`,{className:`text-[10px] text-white/25`,children:[`Showing `,r,` of `,i]}),a.map(e=>(0,x.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,x.jsx)(`span`,{className:`max-w-48 truncate`,children:e.label}),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`text-white/30 transition group-hover:text-amber-100/80`,children:`✕`})]},e.key)),a.length>1&&(0,x.jsx)(`button`,{type:`button`,onClick:()=>t({...Pt}),className:`px-1 text-[11px] text-white/35 transition hover:text-white/70`,children:`Clear all`})]}):null}var Kt=[`active`,`ready_for_review`,`paused`,`completed`,`failed`,`archived`,`working`,`waiting_on_you`,`stalled`,`idle`,`offline`,`done`,`error`],qt={attention:`Attention first`,recent:`Recently active`,longest:`Longest running`,workers:`Most workers`,repository:`Repository`};function Jt(e){return e===`ready_for_review`?`awaiting acceptance`:e===`error`?`stale`:e.replaceAll(`_`,` `)}function Yt({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,x.jsxs)(`div`,{className:`mb-6 rounded-xl border border-white/[0.07] bg-white/[0.018] p-3`,children:[(0,x.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,x.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,x.jsxs)(`select`,{value:e.status,onChange:e=>c(`status`,e.target.value),className:l,children:[(0,x.jsx)(`option`,{value:`all`,children:`All statuses`}),Kt.map(e=>(0,x.jsx)(`option`,{value:e,children:Jt(e)},e))]}),(0,x.jsxs)(`select`,{value:e.repository,onChange:e=>c(`repository`,e.target.value),className:`${l} max-w-52`,children:[(0,x.jsx)(`option`,{value:`all`,children:`All repositories`}),n.map(e=>(0,x.jsx)(`option`,{value:e,children:e.split(`/`).at(-1)},e))]}),(0,x.jsxs)(`select`,{value:e.template,onChange:e=>c(`template`,e.target.value),className:l,children:[(0,x.jsx)(`option`,{value:`all`,children:`All templates`}),r.map(([e,t])=>(0,x.jsx)(`option`,{value:e,children:t},e))]}),(0,x.jsxs)(`select`,{value:e.date,onChange:e=>c(`date`,e.target.value),className:l,children:[(0,x.jsx)(`option`,{value:`all`,children:`Any date`}),(0,x.jsx)(`option`,{value:`24h`,children:`Last 24 hours`}),(0,x.jsx)(`option`,{value:`7d`,children:`Last 7 days`}),(0,x.jsx)(`option`,{value:`30d`,children:`Last 30 days`})]}),(0,x.jsx)(`select`,{"aria-label":`Sort missions`,value:o,onChange:e=>s(e.target.value),className:l,children:Object.keys(qt).map(e=>(0,x.jsx)(`option`,{value:e,children:qt[e]},e))})]}),(0,x.jsx)(Gt,{value:e,onChange:t,templates:r,shown:i,total:a})]})}var Xt={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 Zt({status:e}){return(0,x.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 ${Xt[e]}`,children:e===`ready_for_review`?`Awaiting acceptance`:e})}var Qt=[{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`}];function $t(e){return[e.id,e.label,...e.aliases??[],...e.taskIds??[]].map(e=>e?.trim()).filter(e=>!!e)}function en(e,t){let n=e?.trim().toLowerCase();return n?$t(t).some(e=>e.toLowerCase()===n):!1}var tn=new Set([`idle`,`done`,`offline`]);function nn(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 rn(e){return e.mission.mode!==`direct`||e.lifecycleStatus!==`active`||!tn.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 an(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 on(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 sn(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 cn(e){let t=sn(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 ln=new Set([`InstructionsLoaded`,`ConfigChange`,`CwdChanged`,`PreCompact`,`PostCompact`,`TeammateIdle`]);function un(e){return e.hookEventName&&ln.has(e.hookEventName)||e.hookEventName===`Notification`&&/waiting for your input/i.test(e.detail??``)?!1:sn(e)!==`lifecycle`||!!(e.phase&&e.phase!==`custom`)}function dn(e){return e.split(`/`).filter(Boolean).slice(-2).join(`/`)||e}function fn(e,t=52){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function pn(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 mn(e){return e.hookEventName===`PreToolUse`}function hn(e,t=!0){let n=e.outcome===`failure`,r=n?`error`:`normal`,i=sn(e),a=t&&mn(e);if(e.filePath&&(i===`file_write`||i===`file_read`))return{verb:i===`file_write`?a?`Editing`:`Edited`:a?`Reading`:`Read`,object:dn(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:fn(pn(e.command)),full:e.command,tone:r};if(e.artifactPath)return{verb:`Produced`,object:dn(e.artifactPath),full:e.artifactPath,tone:r};if(e.phase===`blocked_on_user`)return{verb:`Waiting on you`,object:fn(pn(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:fn(pn(e.detail)),full:e.detail,tone:r};if(e.phase===`worker_reported`)return{verb:`Worker reported`,object:fn(pn(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:fn(e.toolName),full:e.detail,tone:r};let o=gn(e);return{verb:cn(e),object:o&&fn(o.shown),full:o?.full,tone:r}}function gn(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=pn(r);return/\s/.test(i)?{shown:i,full:r}:void 0}function _n(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(un(n))return n}}function vn(e,t){for(let n=e.length-1;n>=0;--n){let r=e[n];if(en(r.targetWorker,t)&&un(r))return r}}var yn=new Map;function bn(e,t){let n=yn.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},yn.set(e,n)}return n.listeners.add(t),()=>{let n=yn.get(e);n&&(n.listeners.delete(t),n.listeners.size||(clearInterval(n.timer),yn.delete(e)))}}function xn(e=1e3){let[t,n]=(0,g.useState)(()=>Date.now());return(0,g.useEffect)(()=>bn(e,n),[e]),t}function Sn(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 Cn(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 wn(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}k`:`${(e/1e6).toFixed(1)}M`}var Tn={normal:`text-amber-200/70`,error:`text-rose-300/80`,attention:`text-rose-200/80`};function En({event:e,fallback:t,working:n=!0}){let r=xn(1e3);if(!e)return(0,x.jsx)(`p`,{className:`text-xs leading-relaxed text-white/40`,children:(0,x.jsx)(`span`,{className:`line-clamp-2`,children:t??`Waiting for activity`})});let{verb:i,object:a,full:o,tone:s}=hn(e,n),c=n&&mn(e);return(0,x.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-[11px]`,title:o??i,children:[(0,x.jsx)(`span`,{className:`shrink-0 font-medium ${Tn[s]}`,children:i}),a&&(0,x.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-white/40`,children:a}),(0,x.jsxs)(`span`,{className:`mono ml-auto shrink-0 text-white/22`,title:new Date(e.ts).toLocaleString(),children:[Cn(r-e.ts),c?``:` ago`]})]})}function Dn(e){let t=e.jobState.toLowerCase();return t===`failed`||t===`error`?`failed`:e.doneAt?`complete`:t===`working`||t===`busy`?`working`:`ended`}function On(e){let t=e.map(e=>({worker:e,state:Dn(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 kn={working:`hive-pulse bg-amber-400`,failed:`bg-rose-400`,complete:`bg-emerald-400`,ended:`bg-white/25`};function An({workers:e,events:t,limit:n=4,onSelect:r}){if(!e.length)return null;let{notable:i,done:a}=On(e),o=i.slice(0,n),s=i.length-o.length;return o.length?(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[o.map(e=>{let n=Dn(e),i=vn(t,e),a=i?hn(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,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${kn[n]}`}),(0,x.jsx)(`span`,{className:`max-w-28 truncate`,children:e.label}),o&&(0,x.jsx)(`span`,{className:`mono max-w-36 truncate text-[10px] text-white/32`,children:o})]});return r?(0,x.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,x.jsx)(`span`,{title:c,className:l,children:u},s)}),(s>0||a>0)&&(0,x.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 jn={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 Mn({alerts:e,decisionCount:t=0,onOpenDecisions:n}){let[r,i]=(0,g.useState)(null),a=Le(e);if(!a.length&&!t)return null;let o=a.find(e=>e.id===r);return(0,x.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[t>0&&(0,x.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,x.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 ${jn[e.severity]}`,children:e.title},e.id))]}),o&&(0,x.jsxs)(`div`,{className:`rounded-lg border border-white/[0.07] bg-black/25 px-3 py-2 text-[11px] leading-relaxed`,children:[(0,x.jsx)(`p`,{className:`text-white/55`,children:o.explanation}),(0,x.jsxs)(`p`,{className:`mt-1 text-white/30`,children:[(0,x.jsx)(`span`,{className:`font-medium text-white/40`,children:`Evidence:`}),` `,o.evidence]}),(0,x.jsxs)(`p`,{className:`mt-1 text-white/40`,children:[(0,x.jsx)(`span`,{className:`font-medium text-white/50`,children:`Try:`}),` `,o.recovery]})]})]})}function Nn({plan:e}){return(0,x.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 Pn=/https:\/\/claude\.ai\/code\/artifact\/[\w-]+/g,Fn=/https?:\/\/[^\s<>"')\]]+\/-\/merge_requests\/(\d+)/g,In=/https?:\/\/github\.com\/[^\s<>"')\]]+\/pull\/(\d+)/g,Ln=/https?:\/\/[\w.-]+(?:\.atlassian\.net|\/jira)\/browse\/([A-Z][A-Z0-9]*-\d+)/g;function Rn(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 zn(e,t){let n=new Map;for(let t of e)n.set(t.href,Rn(t.href)??`${(t.kind||`PR`).toUpperCase()} ${t.id}`);let r=t.map(e=>e.text).join(`
|
|
11
|
+
`);for(let e of r.matchAll(Fn))n.set(e[0],`MR !${e[1]}`);for(let e of r.matchAll(In))n.set(e[0],`PR #${e[1]}`);for(let e of r.matchAll(Ln))n.set(e[0],e[1]);let i=[...new Set([...r.matchAll(Pn)].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 Bn({prs:e,messages:t}){let n=(0,g.useMemo)(()=>zn(e,t),[e,t]);return n.length?(0,x.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,x.jsx)(`span`,{className:`text-[9px] font-semibold uppercase tracking-[0.16em] text-emerald-200/50`,children:`Outputs`}),n.map(e=>(0,x.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 Vn({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);Ae(s,Ce.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 R(e,t),c(!1)}catch(e){u(e.message)}finally{o(null)}}async function h(t){o(t),u(null);try{await V(e,t),c(!1)}catch(e){u(e.message)}finally{o(null)}}async function _(){o(`archived`),u(null);try{await B(e),n?.()}catch(e){u(e.message)}finally{o(null),f(!1)}}let v=Ye(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,x.jsxs)(`div`,{ref:p,className:`relative flex items-center gap-1.5`,children:[!i&&(0,x.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,x.jsx)(`button`,{"aria-label":`More mission actions`,"aria-expanded":s,onClick:()=>c(!s),className:`${y} ${r?``:`px-2.5`}`,children:`•••`}),s&&(0,x.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,x.jsxs)(x.Fragment,{children:[(0,x.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,x.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,x.jsx)(`div`,{className:`my-1 border-t border-white/[0.06]`})]}),t===`ready_for_review`&&(0,x.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,x.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,x.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,x.jsx)(`div`,{className:`my-1 border-t border-white/[0.06]`}),d?(0,x.jsxs)(`div`,{className:`p-2`,children:[(0,x.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,x.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{onClick:()=>f(!1),className:`px-2 py-1 text-[10px] text-white/35`,children:`Cancel`}),(0,x.jsx)(`button`,{disabled:!!a,onClick:_,className:`rounded-md bg-rose-500/70 px-2 py-1 text-[10px] text-white`,children:`Delete permanently`})]})]}):(0,x.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,x.jsx)(`span`,{className:`absolute right-0 top-full mt-2 whitespace-nowrap text-[10px] text-rose-400`,children:l})]})}var Hn=`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`,Un=`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 Wn({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=Xe(t),S=t===`ready_for_review`,C=(0,g.useMemo)(()=>zn(n,r),[r,n]),w=(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 T(){s(!1),l(``),p(null)}async function E(){if(!_){v(!0),p(null);try{await R(e,Ye(t).next)}catch(e){p(e.message)}finally{v(!1)}}}async function D(){let t=c.trim();if(!(!t||u)){d(!0),p(null);try{await I(e,t),l(``),s(!1),h(!0)}catch(e){p(e.message)}finally{d(!1)}}}return o?(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,onClick:e=>e.stopPropagation(),children:[w&&(0,x.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:w.text,children:[(0,x.jsx)(`span`,{className:`text-white/25`,children:`Last said · `}),w.text.trim()]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,x.jsx)(`input`,{ref:y,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&(e.preventDefault(),D()),e.key===`Escape`&&(e.preventDefault(),T())},placeholder:S?`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,x.jsx)(`button`,{type:`button`,disabled:!c.trim()||u,onClick:()=>void D(),className:Un,children:u?`Sending…`:`Send`})]}),f&&(0,x.jsx)(`p`,{className:`text-[10px] text-rose-400`,children:f})]}):(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,onClick:e=>e.stopPropagation(),children:[f&&(0,x.jsx)(`span`,{className:`mr-auto text-[10px] text-rose-400`,children:f}),m&&(0,x.jsx)(`span`,{className:`mr-auto text-[10px] text-emerald-300/70`,children:`Sent`}),C.slice(0,2).map(e=>(0,x.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,title:e.href,className:Hn,children:[e.label,` ↗`]},e.href)),S&&(0,x.jsx)(`button`,{type:`button`,onClick:()=>void E(),disabled:_,className:Un,title:`Accept this mission as complete (a)`,children:_?`Accepting…`:Ye(t).shortLabel}),b&&(0,x.jsx)(`button`,{type:`button`,onClick:()=>s(!0),className:Hn,title:S?`Say what should change, without opening the mission (d)`:`Reply without opening the mission (r)`,children:S?`Request changes`:`Reply`}),(0,x.jsx)(Vn,{missionId:e,status:t,compact:!0,hidePrimary:S})]})}var Gn=70;function Kn({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=xn(3e4),d=e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`,f=_n(e.recentEvents),p=Je(e.plan),m=qe(e.plan),h=Ve(e.plan),_=e.plan?.progress,v=Sn((e.status===`working`?u:e.updatedAt)-e.runStartedAt),[y,b]=(0,g.useState)(!1),[S,w]=(0,g.useState)(),[T,E]=(0,g.useState)(!1),D=On(e.workers),O=e.mission.objective?.trim(),k=!!(O&&O.length>Gn),A=We(e.lifecycleStatus,e.mission.currentState,e.mission.compactSummary),j=A&&A!==O;return(0,x.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(),w(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,x.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-x-3`,children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[o&&(0,x.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,x.jsx)(`input`,{type:`checkbox`,checked:i,onChange:()=>o(),className:`h-3 w-3 accent-amber-400`,"aria-label":`Select ${e.name}`})}),r&&(0,x.jsx)(`span`,{title:`Moved while you were away`,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-sky-400`}),(0,x.jsx)(Ne,{missionId:e.missionId,name:e.name})]}),(0,x.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1.5`,children:[He(e.lifecycleStatus,e.activityStatus)&&(0,x.jsx)(C,{status:e.activityStatus}),(d||e.lifecycleStatus!==`active`)&&(0,x.jsx)(Zt,{status:e.lifecycleStatus}),Ke(e)&&(0,x.jsx)(Nn,{plan:e.plan})]})]}),(0,x.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.mission.repository&&(0,x.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:ze(e.mission.repository)}),e.worktreeBranch&&(0,x.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:Be(e.worktreeBranch)}),e.mission.planFirst&&e.plan?.approvalStatus===`proposed`&&(0,x.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,x.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`]})]}),(O||j)&&(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O&&(k?(0,x.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,x.jsx)(`span`,{className:`min-w-0 flex-1 text-xs leading-relaxed text-white/45`,children:(0,x.jsx)(`span`,{className:y?`whitespace-pre-wrap`:`line-clamp-1`,children:O})}),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-white/30 transition group-hover/objective:text-white/60`,children:y?`⌃`:`⌄`})]}):(0,x.jsx)(`p`,{className:`text-xs leading-relaxed text-white/45`,children:O})),j&&(0,x.jsx)(`p`,{className:`text-[11px] leading-relaxed text-white/30`,title:A,children:(0,x.jsxs)(`span`,{className:`line-clamp-2`,children:[(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`text-white/15`,children:`└ `}),A]})})]}),(0,x.jsx)(En,{event:f,fallback:e.detail??e.intent,working:e.activityStatus===`working`}),(0,x.jsx)(An,{workers:e.workers,events:e.recentEvents,onSelect:c}),_&&(0,x.jsxs)(`div`,{children:[m&&(0,x.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2 text-[10px] uppercase tracking-wide text-white/30`,children:[(0,x.jsxs)(`span`,{className:`min-w-0 truncate`,title:m.title,children:[`Phase `,m.index,`/`,m.total,` · `,(0,x.jsx)(`span`,{className:`normal-case text-white/45`,children:m.title})]}),(0,x.jsxs)(`span`,{className:`mono shrink-0 text-white/25`,children:[m.completed,`/`,m.tasks]})]}),(0,x.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between gap-2 text-[10px] uppercase tracking-wide text-white/25`,children:[(0,x.jsxs)(`span`,{className:`truncate`,children:[m?`Plan · `:``,_.completedTasks,`/`,_.totalTasks,` tasks`,p&&` · ${p.satisfied}/${p.required} gates`,h>0&&` · ${h} file${h===1?``:`s`}`]}),(0,x.jsxs)(`span`,{className:`shrink-0 text-amber-200/60`,children:[_.percent??0,`%`]})]}),(0,x.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,x.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-amber-400 to-violet-400`,style:{width:`${_.percent??0}%`}})})]}),(0,x.jsx)(Mn,{alerts:e.alerts??[],decisionCount:t.length,onOpenDecisions:l}),(0,x.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,x.jsx)(`span`,{children:v}),D.total>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`text-white/12`,children:`·`}),(0,x.jsxs)(`span`,{children:[D.total,` worker`,D.total===1?``:`s`,D.done>0&&(0,x.jsxs)(`span`,{className:`text-emerald-300/55`,children:[` ✓`,D.done]})]})]}),(0,x.jsx)(`span`,{className:`text-white/12`,children:`·`}),(0,x.jsxs)(`span`,{children:[wn(e.tokens),` tok`]})]}),(0,x.jsx)(`div`,{className:`transition ${T?``:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 group-focus:opacity-100`}`,children:(0,x.jsx)(Wn,{missionId:e.missionId,status:e.lifecycleStatus,prs:e.prs,messages:e.messages,replyToken:S,onReplyOpenChange:E})})]})}var qn={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 Jn({node:e,decisions:t=[],blocked:n=!1,changed:r=!1,selected:i=!1,active:a=!1,onToggleSelect:o,onSelect:s,onSelectWorker:c}){let l=xn(3e4),[u,d]=(0,g.useState)(),[f,p]=(0,g.useState)(!1),m=_n(e.recentEvents),h=e.plan?.progress,_=Le(e.alerts??[])[0],v=On(e.workers),y=v.notable.length>0||!!_,b=Sn((e.status===`working`?l:e.updatedAt)-e.runStartedAt);return(0,x.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,x.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[o&&(0,x.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,x.jsx)(`input`,{type:`checkbox`,checked:i,onChange:()=>o(),className:`h-3 w-3 accent-amber-400`,"aria-label":`Select ${e.name}`})}),(0,x.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${qn[e.activityStatus]}`,title:e.activityStatus.replaceAll(`_`,` `)}),r&&(0,x.jsx)(`span`,{title:`Moved while you were away`,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-sky-400`}),(0,x.jsx)(`span`,{className:`min-w-0 shrink-0 max-w-52`,title:e.mission.objective,children:(0,x.jsx)(Ne,{missionId:e.missionId,name:e.name})}),e.mission.repository&&(0,x.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:ze(e.mission.repository)}),e.worktreeBranch&&(0,x.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:Be(e.worktreeBranch)}),(0,x.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,x.jsx)(En,{event:m,fallback:e.detail??e.intent,working:e.activityStatus===`working`})}),t.length>0&&(0,x.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`]}),Ke(e)&&(0,x.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,x.jsxs)(`span`,{className:`hidden shrink-0 items-center gap-1.5 md:flex`,title:`${h.completedTasks}/${h.totalTasks} tasks`,children:[(0,x.jsx)(`span`,{className:`h-1 w-14 overflow-hidden rounded-full bg-white/[0.07]`,children:(0,x.jsx)(`span`,{className:`block h-full rounded-full bg-gradient-to-r from-amber-400 to-violet-400`,style:{width:`${h.percent??0}%`}})}),(0,x.jsxs)(`span`,{className:`mono text-[10px] text-white/30`,children:[h.percent??0,`%`]})]}),!y&&v.total>0&&(0,x.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,x.jsxs)(`span`,{className:`text-emerald-300/60`,children:[` ✓`,v.done]})]}),(0,x.jsxs)(`span`,{className:`mono hidden shrink-0 text-[10px] text-white/25 sm:inline`,children:[b,` · `,wn(e.tokens)]}),(0,x.jsx)(`span`,{className:`shrink-0 transition ${f?``:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 group-focus:opacity-100`}`,children:(0,x.jsx)(Wn,{missionId:e.missionId,status:e.lifecycleStatus,prs:e.prs,messages:e.messages,replyToken:u,onReplyOpenChange:p})})]}),y&&(0,x.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-2 pl-4.5`,children:[(0,x.jsx)(An,{workers:e.workers,events:e.recentEvents,limit:3,onSelect:c}),_&&(0,x.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,x.jsxs)(`span`,{className:`ml-1 text-white/25`,children:[`+`,e.alerts.length-1]})]})]})]})}function Yn(e){let t=new Map;for(let n of e){let e=n.mission.repository?Re(n.mission.repository):``;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].sort(([e],[t])=>(e||``).localeCompare(t||``))}function Xn({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)(()=>ot(e,m)),v=e=>u===`compact`?(0,x.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.map(e=>(0,x.jsx)(Jn,{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,x.jsx)(`div`,{className:`@container/board`,children:(0,x.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,x.jsx)(Kn,{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,x.jsxs)(`section`,{className:`mb-8`,children:[(0,x.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,x.jsxs)(`div`,{children:[(0,x.jsxs)(`h2`,{className:`text-sm font-medium uppercase tracking-wide text-white/40`,children:[e,` `,(0,x.jsx)(`span`,{className:`ml-1 text-white/20`,children:n.length})]}),t&&(0,x.jsx)(`p`,{className:`mt-1 text-xs text-white/25`,children:t})]}),(0,x.jsx)(`span`,{className:`rounded-md border border-white/8 px-2 py-1 text-xs text-white/30`,children:h?`+`:`−`})]}),!h&&(c?Yn(n).map(([e,t])=>(0,x.jsxs)(`section`,{className:`mb-5 last:mb-0`,children:[(0,x.jsxs)(`h3`,{className:`mb-2 flex items-baseline gap-2 text-[10px] font-medium uppercase tracking-wider text-white/30`,children:[ze(e),(0,x.jsx)(`span`,{className:`text-white/15`,children:t.length})]}),v(t)]},e)):v(n))]}):null}var Zn=12e3;function Qn(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 $n(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 er(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 nr=`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-[11px] transition disabled:opacity-35`,rr=`mono rounded border border-current/25 px-1 text-[9px] opacity-45`,ir={complete:`C`,pause:`P`,archive:`A`,delete:`Backspace`};function ar({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);Ae(!0,Ce.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||rt(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}),Zn);return()=>clearTimeout(e)},[a]);async function h(e){i(`undo`),c(null);try{for(let t of e)await R(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=Qn(e,t),y=$n(e),b=er(e);m.current={[ir.complete]:v.eligible.length&&!r?()=>void C(`complete`,v,`completed`,!0):void 0,[ir.pause]:y.eligible.length&&!r?()=>void C(`pause`,y,`paused`):void 0,[ir.archive]:b.eligible.length&&!r?()=>{f(!1),u(!0)}:void 0,[ir.delete]:e.length&&!r?()=>{u(!1),f(!0)}:void 0};async function S(){i(`delete`),c(null),o(null);try{for(let t of e)await B(t.missionId);o({changed:e.length,skipped:[]}),n()}catch(e){c(e.message)}finally{i(null),f(!1)}}async function C(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 R(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,x.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,x.jsxs)(`span`,{className:`text-xs font-medium text-amber-100/85`,children:[e.length,` selected`]}),e.length>0&&v.skipped.length>0&&(0,x.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,x.jsx)(`span`,{className:`h-4 w-px bg-white/12`}),v.eligible.length>0&&(0,x.jsx)(`button`,{type:`button`,disabled:!!r,onClick:()=>void C(`complete`,v,`completed`,!0),title:`Finish ${v.eligible.length} mission${v.eligible.length===1?``:`s`} — accepting the ones awaiting acceptance`,className:`${nr} border-emerald-300/30 bg-emerald-300/[0.09] text-emerald-100/90 hover:bg-emerald-300/[0.15]`,children:r===`complete`?`Completing…`:(0,x.jsxs)(x.Fragment,{children:[_(v.eligible.length,`Complete`),(0,x.jsx)(`kbd`,{className:rr,children:`⇧C`})]})}),y.eligible.length>0&&(0,x.jsx)(`button`,{type:`button`,disabled:!!r,onClick:()=>void C(`pause`,y,`paused`),className:`${nr} border-white/12 text-white/55 hover:border-white/25 hover:text-white/85`,children:r===`pause`?`Pausing…`:(0,x.jsxs)(x.Fragment,{children:[_(y.eligible.length,`Pause`),(0,x.jsx)(`kbd`,{className:rr,children:`⇧P`})]})}),b.eligible.length>0&&(l?(0,x.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,x.jsxs)(`span`,{className:`text-[10px] text-white/45`,children:[`Archive `,b.eligible.length,`?`]}),(0,x.jsx)(`button`,{ref:p,type:`button`,disabled:!!r,onClick:()=>void C(`archive`,b,`archived`),className:`${nr} border-rose-300/30 bg-rose-400/[0.1] text-rose-100/90`,children:r===`archive`?`Archiving…`:(0,x.jsxs)(x.Fragment,{children:[`Confirm`,(0,x.jsx)(`kbd`,{className:rr,children:`⏎`})]})}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>u(!1),className:`${nr} border-white/12 text-white/45`,children:`Cancel`})]}):(0,x.jsxs)(`button`,{type:`button`,disabled:!!r,onClick:()=>{f(!1),u(!0)},className:`${nr} border-white/12 text-white/55 hover:border-white/25 hover:text-white/85`,children:[_(b.eligible.length,`Archive`),`…`,(0,x.jsx)(`kbd`,{className:rr,children:`⇧A`})]})),e.length>0&&(d?(0,x.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,x.jsxs)(`span`,{className:`text-[10px] text-rose-200/70`,children:[`Permanently delete `,e.length,`? Conversations and plans go with them.`]}),(0,x.jsx)(`button`,{ref:p,type:`button`,disabled:!!r,onClick:()=>void S(),className:`${nr} border-rose-400/40 bg-rose-500/20 text-rose-50`,children:r===`delete`?`Deleting…`:(0,x.jsxs)(x.Fragment,{children:[`Delete permanently`,(0,x.jsx)(`kbd`,{className:rr,children:`⏎`})]})}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>f(!1),className:`${nr} border-white/12 text-white/45`,children:`Cancel`})]}):(0,x.jsxs)(`button`,{type:`button`,disabled:!!r,onClick:()=>{u(!1),f(!0)},className:`${nr} border-white/12 text-rose-300/60 hover:border-rose-300/30 hover:text-rose-200`,children:[`Delete…`,(0,x.jsx)(`kbd`,{className:rr,children:`⇧⌫`})]})),e.length>0&&(0,x.jsx)(`span`,{className:`h-4 w-px bg-white/12`}),e.length>0&&(0,x.jsx)(`button`,{type:`button`,onClick:n,className:`text-[11px] text-white/40 transition hover:text-white/70`,children:`Clear`}),a&&(0,x.jsxs)(`span`,{className:`text-[10px] text-emerald-300/70`,children:[a.changed,` updated`,a.skipped.length?` · ${a.skipped.length} skipped`:``]}),a?.undo&&(0,x.jsx)(`button`,{type:`button`,disabled:!!r,onClick:()=>void h(a.undo),className:`${nr} border-white/15 text-white/70 hover:border-white/30 hover:text-white`,children:r===`undo`?`Undoing…`:`Undo`}),s&&(0,x.jsx)(`span`,{className:`text-[10px] text-rose-400`,children:s})]})}function or(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 sr={mission:0,action:1,global:2};function cr(e,t,n=12){return[...t.trim()?e.map(e=>{let n=or(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)=>sr[e.group]-sr[t.group])}function lr(e){let t=e.missions.flatMap(t=>{let n=t.mission.repository?ze(t.mission.repository):void 0,r=Ye(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)},{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 ur={mission:`Missions`,global:`Hive`,action:`Actions`},dr={mission:`text-amber-200/60`,global:`text-violet-200/60`,action:`text-emerald-200/60`};function fr({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)(()=>cr(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]),Ae(t,Ce.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,x.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,x.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,x.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,x.jsxs)(`div`,{ref:l,className:`max-h-80 overflow-y-auto p-1.5`,children:[u.length===0&&!d&&(0,x.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,x.jsxs)(`div`,{children:[n&&(0,x.jsx)(`p`,{className:`px-3 pb-1 pt-2.5 text-[9px] font-semibold uppercase tracking-[0.16em] ${dr[n]}`,children:ur[n]}),(0,x.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,x.jsx)(`span`,{className:`shrink-0 text-xs font-medium ${t===o?`text-amber-100/90`:`text-white/75`}`,children:e.title}),e.hint&&(0,x.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-white/30`,children:e.hint})]})]},e.id)}),d&&(0,x.jsxs)(`div`,{children:[(0,x.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,x.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,x.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,x.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,x.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,x.jsx)(`span`,{children:`↑↓ move`}),(0,x.jsx)(`span`,{children:`↵ run`}),(0,x.jsx)(`span`,{children:`esc close`})]})]})})}var pr=[{id:`all`,label:`All`},{id:`manager`,label:`Manager`},{id:`worker`,label:`Workers`},{id:`task`,label:`Tasks`},{id:`tool`,label:`Tools`},{id:`errors`,label:`Errors`},{id:`outputs`,label:`Outputs`}];function mr(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function hr(e,t){let n=!e.targetWorker||e.targetWorker===`hive-orchestrator`;return 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`:sn(e)===`output`||e.phase===`ready_for_review`}function gr(e){let t=Math.floor(e/6e4);return t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function _r(e){return[sn(e),e.targetWorker,e.filePath,e.command,e.artifactPath,e.phase,e.detail].join(`|`)}function vr(e){let t=[];for(let n of[...e].sort((e,t)=>t.ts-e.ts)){let e=t.at(-1);e&&_r(e.event)===_r(n)&&Math.abs(e.event.ts-n.ts)<1e4?e.count+=1:t.push({event:n,count:1})}return t}function yr({events:e,compact:t=!1}){let[n,r]=(0,g.useState)(`all`),i=(0,g.useMemo)(()=>vr(e.filter(e=>hr(e,n))),[e,n]);return e.length?(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,role:`group`,"aria-label":`Activity filters`,children:pr.map(e=>(0,x.jsx)(`button`,{type:`button`,onClick:()=>r(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))}),i.length?(0,x.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:i.map(({event:e,count:n},r)=>(0,x.jsxs)(g.Fragment,{children:[(0,x.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,x.jsx)(`span`,{className:`mono mt-0.5 shrink-0 text-xs text-white/25`,children:mr(e.ts)}),(0,x.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${e.source===`custom`?`bg-violet-400`:sn(e)===`test`?`bg-emerald-400`:sn(e)===`decision`?`bg-amber-400`:`bg-white/25`}`}),(0,x.jsxs)(`span`,{className:`min-w-0 text-white/65 ${t?`basis-full pl-5`:``}`,children:[(0,x.jsx)(`span`,{className:`font-medium text-white/45`,children:cn(e)}),e.targetWorker&&(0,x.jsxs)(`span`,{className:`ml-1 text-violet-300/55`,children:[`· `,e.targetWorker]}),e.targetTask&&(0,x.jsxs)(`span`,{className:`ml-1 text-sky-300/50`,children:[`· task `,e.targetTask]}),n>1&&(0,x.jsxs)(`span`,{className:`ml-1 rounded bg-white/5 px-1 text-[10px] text-white/25`,children:[`×`,n]}),(0,x.jsx)(`span`,{className:`ml-1 break-words`,children:e.filePath??e.command??e.artifactPath??e.detail}),e.rawPayload!==void 0&&(0,x.jsxs)(`details`,{className:`mt-1.5 rounded border border-white/[0.06] bg-black/20 px-2 py-1`,children:[(0,x.jsx)(`summary`,{className:`cursor-pointer text-[9px] uppercase tracking-wider text-white/25 hover:text-white/45`,children:`Raw event`}),(0,x.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)})]})]})]}),i[r+1]&&e.ts-i[r+1].event.ts>=3e5&&(0,x.jsxs)(`li`,{className:`ml-16 flex items-center gap-2 py-1 text-[9px] uppercase tracking-wider text-white/18`,children:[(0,x.jsx)(`span`,{className:`h-px w-8 bg-white/8`}),`Idle gap · `,gr(e.ts-i[r+1].event.ts)]})]},`${e.ts}:${r}`))}):(0,x.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,x.jsx)(`p`,{className:`text-sm text-white/40`,children:`No activity yet.`})}var br=[{id:`all`,label:`All`},{id:`worker`,label:`Workers`},{id:`tool`,label:`Tools`},{id:`errors`,label:`Errors`},{id:`outputs`,label:`Outputs`}],xr={normal:`text-amber-200/70`,error:`text-rose-300/80`,attention:`text-rose-200/80`};function Sr({missions:e,onOpenMission:t,limit:n=60}){let[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(`all`),s=xn(5e3),c=(0,g.useMemo)(()=>{let t=[];for(let n of e){let e=n.recentEvents.filter(e=>un(e)&&hr(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,x.jsxs)(`section`,{className:`mb-8`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),"aria-expanded":r,className:`mb-3 flex w-full items-center justify-between text-left`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`h2`,{className:`text-sm font-medium uppercase tracking-wide text-white/40`,children:[`Fleet activity `,c.length>0&&(0,x.jsx)(`span`,{className:`ml-1 text-white/20`,children:c.length})]}),(0,x.jsx)(`p`,{className:`mt-1 text-xs text-white/25`,children:`Every mission's activity in one stream, newest first.`})]}),(0,x.jsx)(`span`,{className:`rounded-md border border-white/8 px-2 py-1 text-xs text-white/30`,children:r?`−`:`+`})]}),r&&(0,x.jsxs)(`div`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.015] p-3`,children:[(0,x.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,role:`group`,"aria-label":`Fleet activity filters`,children:br.map(e=>(0,x.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,x.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,x.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}=hn(e);return(0,x.jsx)(`li`,{children:(0,x.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,x.jsx)(`span`,{className:`mono w-14 shrink-0 truncate text-[10px] text-white/25`,title:i,children:i?ze(i):``}),(0,x.jsx)(`span`,{className:`w-28 shrink-0 truncate text-[11px] font-medium text-white/70`,children:r}),(0,x.jsx)(`span`,{className:`shrink-0 text-[11px] ${xr[u]}`,children:o}),c&&(0,x.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-[11px] text-white/35`,children:c}),(0,x.jsx)(`span`,{className:`mono ml-auto shrink-0 text-[10px] text-white/22`,children:Cn(s-e.ts)})]})},`${n}:${e.ts}:${a}`)})})]})]}):null}var Cr={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 wr({snapshot:e,onFilter:t}){let n=Ht(e);return n.length?(0,x.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,x.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[n>0&&(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`text-white/12`,children:`·`}),(0,x.jsxs)(`button`,{type:`button`,onClick:()=>t(e.filter),title:`Show only missions that are ${e.label}`,className:`transition ${Cr[e.key]}`,children:[(0,x.jsx)(`span`,{className:`font-medium`,children:e.count}),` `,e.label]})]},e.key))}):(0,x.jsx)(`p`,{className:`mt-0.5 text-xs text-white/35`,children:`No missions yet`})}var Tr=`mx-auto w-full max-w-[1800px] px-4 sm:px-6 lg:px-8`,Er=`hive:last-seen`;function Dr(){if(typeof window>`u`)return Date.now();let e=Number(localStorage.getItem(Er));return Number.isFinite(e)&&e>0?e:Date.now()}function Or(e=Date.now()){try{localStorage.setItem(Er,String(e))}catch{}}function kr(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 Ar(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 jr={missionIds:new Set,needingAttention:0,started:0};function Mr(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(),Or();return}(r.current?Date.now()-r.current:0)>=6e4&&n(Dr()),r.current=void 0},t=Dr();return Date.now()-t>=6e4&&n(t),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let i=(0,g.useMemo)(()=>e&&t?kr(e,t):jr,[t,e]);return{changes:i,dismiss:(0,g.useCallback)(()=>{Or(),n(void 0)},[]),active:!!t&&i.missionIds.size>0}}var Nr=[{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:`Digits work where they are drawn: on the rail's items, or on an open answer's choices.`,shortcuts:[{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:[`0`],description:`Fold the rail away, or bring it back`}]}],Pr=new Set([`h`]),Fr=new Set([`l`]),Ir=new Set([`k`]),Lr=new Set([`j`]);function Rr({open:e,onClose:t}){return Ae(e,Ce.modal,t),e?(0,x.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,x.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,x.jsxs)(`div`,{className:`flex items-baseline justify-between border-b border-white/[0.08] px-5 py-3.5`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white/85`,children:`Keyboard shortcuts`}),(0,x.jsx)(`button`,{type:`button`,onClick:t,className:`text-[11px] text-white/35 transition hover:text-white/70`,children:`Esc to close`})]}),(0,x.jsx)(`div`,{className:`max-h-[60vh] overflow-y-auto px-5 py-4`,children:Nr.map(e=>(0,x.jsxs)(`section`,{className:`mb-5 last:mb-0`,children:[(0,x.jsx)(`h3`,{className:`text-[9px] font-semibold uppercase tracking-[0.16em] text-amber-200/55`,children:e.title}),e.note&&(0,x.jsx)(`p`,{className:`mb-2 mt-1 text-[11px] leading-relaxed text-white/30`,children:e.note}),!e.note&&(0,x.jsx)(`div`,{className:`mb-2`}),(0,x.jsx)(`dl`,{className:`flex flex-col gap-1.5`,children:e.shortcuts.map(e=>(0,x.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4`,children:[(0,x.jsx)(`dt`,{className:`text-xs text-white/55`,children:e.description}),(0,x.jsx)(`dd`,{className:`flex shrink-0 items-center gap-1`,children:e.keys.map(e=>(0,x.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 zr=`[data-mission-card]`,Br=`[data-fleet-search]`,Vr=`[data-quick-ask]`;function Hr(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||rt(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(Br);if(!t)return;e.preventDefault(),t.focus(),t.select();return}let t=e.key.toLowerCase();if(t===`i`){let t=document.querySelector(Vr);if(!t)return;e.preventDefault(),t.focus(),t.setSelectionRange(t.value.length,t.value.length);return}let p=document.activeElement?.closest(zr),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(Lr.has(t)||Ir.has(t)){e.preventDefault(),window.scrollBy?.({top:Lr.has(t)?160:-160});return}let g=Pr.has(t);if(!g&&!Fr.has(t))return;let _=[...document.querySelectorAll(zr)];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 Ur=`hive:fleet-filters`;function Wr(){if(typeof window>`u`)return Pt;try{return Gr(JSON.parse(localStorage.getItem(`hive:fleet-filters`)??`null`))}catch{return Pt}}function Gr(e){if(!e||typeof e!=`object`||Array.isArray(e))return Pt;let t=e,n=e=>typeof t[e]==typeof Pt[e]?t[e]:Pt[e];return{...Pt,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 Kr(e){try{localStorage.setItem(Ur,JSON.stringify(e))}catch{}}var qr={decision:0,failure:1,stale:1,acceptance:2,plan_approval:3,stall:4};function Jr(e){return e.kind===`destructive`||e.kind===`permission`?0:e.kind===`merge`||e.kind===`scope`?1:2}function Yr(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});for(let e of t){let t={missionId:e.missionId,missionName:e.name,repository:e.mission.repository,lifecycle:e.lifecycleStatus,pending:[],createdAt:e.updatedAt};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(Ke(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=Le(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=Le(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=qr[e.kind]-qr[t.kind];if(n!==0)return n;if(e.decision&&t.decision){let n=Jr(e.decision)-Jr(t.decision);if(n!==0)return n}return e.createdAt-t.createdAt})}var Xr=[{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 Zr(e,t){return e===`office`?`office`:t===`compact`?`list`:`grid`}function Qr({value:e,onChange:t}){return(0,x.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/[0.08] bg-black/20 p-1`,role:`group`,"aria-label":`Board view`,children:Xr.map(({mode:n,icon:r,label:i,title:a})=>(0,x.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 $r={tileWidth:58,tileHeight:52,skewX:-16,riseX:7,originX:140,originY:90};function G(e,t,n=0,r=$r){return{x:r.originX+e*r.tileWidth+t*r.skewX,y:r.originY+e*r.riseX+t*r.tileHeight-n}}function ei(e,t=0){return[G(e.x,e.y,t),G(e.x+e.width,e.y,t),G(e.x+e.width,e.y+e.depth,t),G(e.x,e.y+e.depth,t)]}function K(e){return e.map(({x:e,y:t})=>`${e},${t}`).join(` `)}function ti(e,t=0){return G(e.x+e.width/2,e.y+e.depth/2,t)}var q=5,ni={width:4.2,depth:2.8},ri=[[.58,.82],[1.78,.92],[2.78,.92],[1.55,1.78],[2.65,1.78]];function ii(e){return ri.map(([t,n])=>[e.x+t/ni.width*e.width,e.y+n/ni.depth*e.depth])}var ai=[{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:q,x:3.5,y:0,width:4.2,depth:2.8},{id:`standard-b`,label:`Orchestration room B`,shortLabel:`ORCH B`,kind:`standard`,capacity:q,x:7.7,y:0,width:4.2,depth:2.8},{id:`standard-c`,label:`Orchestration room C`,shortLabel:`ORCH C`,kind:`standard`,capacity:q,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}],oi=11.9/3,si=[...[`a`,`b`,`c`].map((e,t)=>({id:`standard-${e}`,label:`Orchestration room ${e.toUpperCase()}`,shortLabel:`ORCH ${e.toUpperCase()}`,kind:`standard`,capacity:q,x:t*oi,y:0,width:oi,depth:2.8})),...[`d`,`e`,`f`].map((e,t)=>({id:`standard-${e}`,label:`Orchestration room ${e.toUpperCase()}`,shortLabel:`ORCH ${e.toUpperCase()}`,kind:`standard`,capacity:q,x:t*oi,y:3.5,width:oi,depth:2.8}))],ci=e=>e===`operations`?si:ai,li=e=>e>0&&e<1e3?`operations`:`headquarters`,ui=e=>e===0?`Headquarters`:e>=1e3?`Headquarters annex ${e-999}`:`Operations ${e}`,di=[`#f0c7a3`,`#dca77e`,`#b97855`,`#87543d`,`#68402f`],fi=[`#211b1a`,`#51372a`,`#875f35`,`#c1a17a`,`#3b3037`],pi=[`#42667a`,`#65527d`,`#477164`,`#80595b`,`#6d6547`],mi=[`short`,`side`,`crop`,`long`,`ponytail`,`bun`,`curls`],hi=[`tee`,`hoodie`,`jacket`,`sweater`];function gi(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 _i(e){let t=gi(e);return{skin:di[t%di.length],hair:fi[(t>>>4)%fi.length],clothing:pi[(t>>>8)%pi.length],variant:(t>>>12)%3,hairStyle:mi[(t>>>14)%mi.length],outfit:hi[(t>>>18)%hi.length],offset:t%1200,gesture:(t>>>22)%2?`notes`:`monitor`}}function vi(e){return!!e.doneAt}function yi(e){return!vi(e)}function bi(e,t){return e.jobState===`failed`||e.jobState===`error`?`failed`:vi(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 xi(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 Si(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 Ci(e,t){let n={};for(let r of e.filter(e=>e.kind===`orchestrated`)){let e=r.mission.workers.filter(yi).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 wi(e,t){let n=Object.entries(e);return n.length===Object.keys(t).length&&n.every(([e,n])=>t[e]===n)}function Ti(e,t=6){let n=[];for(let t of e)if(xi(t.mission)===`working`&&n.push(t.mission.missionId),t.kind===`orchestrated`)for(let e of t.mission.workers.filter(yi))bi(e,t.mission)===`working`&&n.push(`${t.mission.missionId}:${e.id}`);return new Set(n.sort((e,t)=>gi(e)-gi(t)||e.localeCompare(t)).slice(0,Math.max(0,t)))}function Ei(e,t){return e.targetWorker?en(e.targetWorker,t):e.jobId===t.jobId}function Di(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 Oi(e,t){if(!e)return`vacant`;let n=t?bi(t,e):xi(e);return n===`failed`?`failed`:n===`waiting`||n===`blocked`?`waiting`:n===`idle`||n===`paused`||n===`completed`?`idle`:Di((t?e.recentEvents.filter(e=>Ei(e,t)):e.recentEvents.filter(t=>!e.workers.some(e=>Ei(t,e)))).at(-1))??`active`}function ki(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 Ai(e,t,n,r){let i=n===`working`||n===`arrived`?`working`:r??(t?bi(t,e):xi(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`||nn(e))&&e.activityStatus!==`error`,s=ki(Oi(e,t),n);return{state:o?`completed`:a?`idle`:i,monitor:o&&s!==`failed`?`test-passed`:s}}function ji(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=>xi(e)===`working`||e.workers.some(t=>yi(t)&&bi(t,e)===`working`))?`active`:e.every(e=>e.lifecycleStatus===`paused`)?`paused`:`idle`:`vacant`}var Mi={vacant:`#77717e`,idle:`#8b8792`,active:`#f1c75b`,waiting:`#f472b6`,blocked:`#fb923c`,failed:`#fb7185`,review:`#e6bd62`,paused:`#7dd3fc`};function Ni(e,t,n=`worker`){let r=n===`manager`;return{x:e,y:t,width:r?.88:.72,depth:r?.52:.46}}function Pi(e,t,n=`worker`){let r=Ni(e,t,n),i=ei(r,17),a=ei(r,0);return K([i[0],i[1],i[2],a[2],a[3],i[3]])}function Fi({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=ei(Ni(e,t,n),17),m=p[3],h=p[2],g=ei({x:e+.18,y:t+.29,width:.28,depth:.1},19),_=G(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,x.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,x.jsx)(`polygon`,{points:K(p),fill:`#55c7b3`,fillOpacity:`.18`,stroke:`#6ee7d2`,strokeOpacity:`.8`,strokeWidth:`3`}),(0,x.jsx)(`polygon`,{points:K(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,x.jsx)(`polygon`,{points:K(g),fill:`#242831`,stroke:`#9eb6c0`,strokeOpacity:`.35`}),(0,x.jsx)(`path`,{d:`M ${g[0].x+4} ${g[0].y+1}l14 2`,stroke:`#d7dde2`,strokeOpacity:`.18`}),(0,x.jsxs)(`g`,{transform:`rotate(7 ${_.x} ${_.y})`,children:[(0,x.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,x.jsx)(`path`,{d:`M ${_.x} ${_.y-2}v2.2`,stroke:`#9eb6c0`,strokeOpacity:`.5`,strokeWidth:`.8`})]}),(0,x.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,x.jsx)(`path`,{d:`M ${m.x+4} ${m.y+9}v20 M ${h.x-4} ${h.y+9}v20`,stroke:`#28252a`,strokeWidth:`4`}),(0,x.jsx)(J,{x:e+(c?.43:.35),y:t+.22,activity:d,color:v}),(0,x.jsx)(Ii,{x:e+.17,y:t+(c?.63:.57),facing:`south`,seatType:c?`manager`:n===`direct`?`direct`:`worker`,occupied:r})]})}function Ii({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=ei(o,8),c=ti(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,x.jsxs)(`g`,{"aria-hidden":`true`,...f,children:[(0,x.jsx)(`polygon`,{points:K(s),fill:p,stroke:a?`#d5d1c8`:`#cbb6d0`,strokeOpacity:a?`.48`:`.25`}),(0,x.jsx)(`polygon`,{points:K(d),fill:m,stroke:a?`#d5d1c8`:`#ddd2e0`,strokeOpacity:a?`.48`:`.42`,strokeWidth:a?1.5:1}),a&&(0,x.jsxs)(x.Fragment,{children:[(0,x.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,x.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,x.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,x.jsx)(`circle`,{cx:c.x,cy:c.y+14,r:`2.5`,fill:`#292830`})]})}function Li({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=ei(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,x.jsxs)(`g`,{"aria-hidden":`true`,children:[c.slice(0,4).map(([i,a],o)=>(0,x.jsx)(`g`,{"data-filter-match":o<n?String(!r.has(o)):void 0,opacity:r.has(o)?.2:1,children:(0,x.jsx)(Ii,{x:e+i,y:t+a,facing:`north`,occupied:o<n})},`north-${o}`)),(0,x.jsx)(`polygon`,{points:K(a),fill:`#6e5947`,stroke:`#e6bd62`,strokeOpacity:`.34`}),(0,x.jsx)(`polygon`,{points:`${o.x},${o.y} ${s.x},${s.y} ${s.x},${s.y+11} ${o.x},${o.y+11}`,fill:`#352b27`}),(0,x.jsx)(`path`,{d:`M ${o.x+14} ${o.y+8}v16M ${s.x-14} ${s.y+8}v16`,stroke:`#29252a`,strokeWidth:`5`}),(0,x.jsx)(`path`,{d:`M ${ti(i,16).x-22} ${ti(i,16).y}h44`,stroke:`#e6bd62`,strokeOpacity:`.16`,strokeWidth:`2`}),(0,x.jsxs)(`g`,{transform:`rotate(6.88 ${ti(i,18).x} ${ti(i,18).y})`,children:[(0,x.jsx)(`rect`,{x:ti(i,18).x-16,y:ti(i,18).y-8,width:`32`,height:`16`,rx:`8`,fill:`#242831`,stroke:`#b8c2cb`,strokeOpacity:`.32`}),(0,x.jsx)(`circle`,{cx:ti(i,18).x-6,cy:ti(i,18).y,r:`2`,fill:`#101318`}),(0,x.jsx)(`circle`,{cx:ti(i,18).x,cy:ti(i,18).y,r:`2`,fill:`#101318`}),(0,x.jsx)(`circle`,{cx:ti(i,18).x+6,cy:ti(i,18).y,r:`2`,fill:`#101318`}),(0,x.jsx)(`circle`,{cx:ti(i,18).x+12,cy:ti(i,18).y-3,r:`1.5`,fill:`#55c7b3`,opacity:`.7`})]}),c.slice(4).map(([i,a],o)=>{let s=o+4;return(0,x.jsx)(`g`,{"data-filter-match":s<n?String(!r.has(s)):void 0,opacity:r.has(s)?.2:1,children:(0,x.jsx)(Ii,{x:e+i,y:t+a,facing:`south`,occupied:s<n})},`south-${o}`)})]})}function Ri({x:e,y:t}){let n=G(e,t,5),r=G(e+.7,t,5),i=G(e,t,28),a=G(e+.7,t,28),o=G(e,t,13),s=G(e+.7,t,13),c=G(e,t,21),l=G(e+.7,t,21);return(0,x.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,x.jsx)(`polygon`,{points:K([n,r,a,i]),fill:`#29272d`,stroke:`#9c8b70`,strokeOpacity:`.34`}),(0,x.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,x.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 zi({x:e,y:t}){let n=G(e,t,5),r=G(e+.82,t,5),i=G(e,t,28),a=G(e+.82,t,28);return(0,x.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,x.jsx)(`polygon`,{points:K([n,r,a,i]),fill:`#d8d5cf`,fillOpacity:`.1`,stroke:`#a78bfa`,strokeOpacity:`.42`}),(0,x.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 Bi({x:e,y:t}){let n={x:e,y:t,width:.62,depth:.48},r=ei(n),i=ei(n,18),a={x:e+.12,y:t+.1,width:.38,depth:.26},o=ei(a,18),s=ei(a,33),c=ti(a,25);return(0,x.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,x.jsx)(`polygon`,{points:K([i[3],i[2],r[2],r[3]]),fill:`#382f2a`}),(0,x.jsx)(`polygon`,{points:K([i[1],i[2],r[2],r[1]]),fill:`#2d2928`}),(0,x.jsx)(`polygon`,{points:K(i),fill:`#65513e`,stroke:`#c4a77d`,strokeOpacity:`.3`}),(0,x.jsx)(`polygon`,{points:K([s[3],s[2],o[2],o[3]]),fill:`#171a20`}),(0,x.jsx)(`polygon`,{points:K([s[1],s[2],o[2],o[1]]),fill:`#11141a`}),(0,x.jsx)(`polygon`,{points:K(s),fill:`#292d35`,stroke:`#55c7b3`,strokeOpacity:`.3`}),(0,x.jsx)(`circle`,{cx:c.x+6,cy:c.y-2,r:`2`,fill:`#e6bd62`,opacity:`.65`}),(0,x.jsx)(`path`,{d:`M ${c.x} ${c.y+4}v7h6`,stroke:`#b7a58d`,strokeOpacity:`.5`,strokeWidth:`2`}),(0,x.jsx)(`ellipse`,{cx:c.x+6,cy:c.y+12,rx:`5`,ry:`2.5`,fill:`#d7d2c8`,fillOpacity:`.45`})]})}function J({x:e,y:t,activity:n=`vacant`,color:r=`#f1c75b`}){let i=G(e,t,24),a=n!==`vacant`&&n!==`idle`,o=n===`failed`?`#fb7185`:n===`waiting`?`#f4b942`:n===`test-passed`?`#4ade80`:r;return(0,x.jsxs)(`g`,{"aria-hidden":`true`,"data-monitor-activity":n,children:[(0,x.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,x.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,x.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,x.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,x.jsxs)(x.Fragment,{children:[(0,x.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,x.jsx)(`path`,{d:`M ${i.x-5} ${i.y-10.5}h10`,stroke:`#7dd3fc`,opacity:`.48`})]}),n===`testing`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`circle`,{cx:i.x-3.5,cy:i.y-9.5,r:`1.2`,fill:`#f1c75b`}),(0,x.jsx)(`circle`,{cx:i.x,cy:i.y-9.5,r:`1.2`,fill:`#f1c75b`,opacity:`.65`}),(0,x.jsx)(`circle`,{cx:i.x+3.5,cy:i.y-9.5,r:`1.2`,fill:`#f1c75b`,opacity:`.3`})]}),n===`test-passed`&&(0,x.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,x.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,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`circle`,{cx:i.x,cy:i.y-10,r:`3.2`,fill:`none`,stroke:`#f4b942`,opacity:`.78`}),(0,x.jsx)(`path`,{d:`M ${i.x} ${i.y-12}v2.5l2 1`,stroke:`#f4b942`,strokeWidth:`1`})]}),n===`idle`&&(0,x.jsx)(`path`,{d:`M ${i.x-4} ${i.y-8}h8`,stroke:`#8bb5c8`,opacity:`.25`}),(0,x.jsx)(`path`,{d:`M ${i.x} ${i.y-3}v7`,stroke:`#5c5961`,strokeWidth:`2`})]})}function Y({x:e,y:t,atmosphere:n}){let r=G(e,t,17),i=Mi[n],a=n===`idle`?`#e2c477`:i,o=n!==`vacant`,s=n===`active`?.17:n===`idle`||n===`paused`?.075:.13;return(0,x.jsxs)(`g`,{"aria-hidden":`true`,"data-room-bulb":n,"data-room-bulb-powered":o?`true`:`false`,children:[o&&(0,x.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,x.jsxs)(`g`,{transform:`rotate(6.88 ${r.x} ${r.y})`,children:[(0,x.jsx)(`rect`,{x:r.x-7,y:r.y-7,width:`14`,height:`13`,rx:`3`,fill:`#2a2930`,stroke:`#8d8993`,strokeOpacity:`.58`}),(0,x.jsx)(`path`,{d:`M ${r.x} ${r.y+3}v5`,stroke:`#aaa5ad`,strokeWidth:`2.2`,strokeLinecap:`round`}),(0,x.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,x.jsx)(`ellipse`,{cx:r.x,cy:r.y+11,rx:`5`,ry:`2.2`,fill:o?a:`#2b2a30`,opacity:o?`.9`:`.65`})]})]})}function Vi({floor:e,doorway:t,center:n,atmosphere:r,occupied:i=r!==`vacant`,scope:a=`fleet`}){let o=a===`detail`,s=Mi[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,x.jsxs)(`g`,{"aria-hidden":`true`,"data-room-lighting":r,"data-lighting-scope":a,pointerEvents:`none`,children:[c[r]!==void 0&&(0,x.jsx)(`polygon`,{points:K(e),fill:l,opacity:c[r]}),i&&r!==`review`&&(0,x.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,x.jsx)(`polygon`,{points:K(t),fill:s,opacity:o?.34:.3,"data-doorway-light":`waiting`,className:`office-doorway-waiting`}),r===`review`&&(0,x.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 Hi({rect:e,label:t,capacity:n,occupied:r=0,accent:i,z:a=25}){let o=ti(e,a);return(0,x.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,x.jsx)(`rect`,{x:o.x-47,y:o.y-17,width:`94`,height:`24`,rx:`5`,fill:`#111318`,stroke:i,strokeOpacity:`.48`}),(0,x.jsx)(`circle`,{cx:o.x-39,cy:o.y-5,r:`2.3`,fill:i,opacity:`.72`}),(0,x.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,x.jsx)(`path`,{d:`M ${o.x+19} ${o.y-12}v13`,stroke:i,strokeOpacity:`.14`}),(0,x.jsx)(`rect`,{x:o.x+24,y:o.y-11,width:`18`,height:`11`,rx:`3`,fill:i,fillOpacity:`.11`}),(0,x.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 Ui({x:e,y:t}){let n=G(e,t,4);return(0,x.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,x.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,x.jsx)(`path`,{d:`M ${n.x-8} ${n.y}h16l-3 13h-10z`,fill:`#6a4d35`})]})}var Wi=4200,Gi=3600,Ki=1200,qi=1e3,Ji=2400,Yi=4500;function Xi(e){return!!e.doneAt}function Zi(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 Qi(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:Wi},{id:`${n}:arrive`,targetId:i,missionId:e,workerId:t,action:`arrived`,startsAt:r+180+Wi,duration:Ki}]}function $i(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,Wi),o(e.missionId,e.missionId,`arrived`,void 0,4380,Ki);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`?Yi:720):(e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`)&&o(e.missionId,e.missionId,`accepted-completion`,void 0,0,Yi);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,Yi);let s=Zi(e),c=Zi(t);for(let[e,t]of c){let n=s.get(e);n?!Xi(n.worker)&&Xi(t.worker)&&(o(t.mission.missionId,e,`reporting`,t.worker.id,0,Gi),o(t.mission.missionId,e,`exiting`,t.worker.id,Gi,Yi)):(o(t.mission.missionId,e,`desk-reserved`,t.worker.id),o(t.mission.missionId,e,`entering`,t.worker.id,180,Wi),o(t.mission.missionId,e,`arrived`,t.worker.id,4380,Ki),Xi(t.worker)&&(o(t.mission.missionId,e,`reporting`,t.worker.id,5580,Gi),o(t.mission.missionId,e,`exiting`,t.worker.id,9180,Yi)))}for(let[e,t]of s)c.has(e)||Xi(t.worker)||(o(t.mission.missionId,e,`reporting`,t.worker.id,0,Gi),o(t.mission.missionId,e,`exiting`,t.worker.id,Gi,Yi));return a}function ea(e){let t=e.missionId,n=[{key:`door:${t}`,holdMs:qi},{key:`elevator:in`,holdMs:600}],r=[{key:`door:${t}`,holdMs:qi},{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 ta(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=na(a,Qi(t.missionId,t.workerId,`worker:${t.storyKey}:reenter`,n),n),o.stopped=!1,o.completionQueued=!1,o.exited=!1):o.stopped=!1:(a=na(a,Qi(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 na(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 ea(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 ea(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 ea(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 ra=new Set([`moving-to-review`]);function ia(e,t,n,r){if(!t.size)return e;let i=new Set(n.filter(e=>!e.workerId&&ra.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 aa(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 oa={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 sa(e,t,n){return ma(oa[e],`${e}:${t}:${n}:arrival`)}var ca=[`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`],la={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`]},ua=[`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`],da=`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(`(`),fa=`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(`(`),pa={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 ma(e,t){return e[gi(t)%e.length]}var ha=[`methodical`,`energetic`,`thoughtful`,`social`,`quiet`];function ga(e){return ma(ha,`${e}:personality`)}function _a(e,t,n){let r=ga(e),i=ma(t?fa:da,`${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]&&gi(`${e}:${n}:prefix`)%3==0?`${ma(a[r],`${e}:${n}:prefix-pick`)} ${i}`:i}function va(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 la?e.activityKind:`tool`}function X(e,t){let n=va(e),r=`${t}:${e.ts}:${e.toolName??e.detail}`;return`${ma(ca,`${r}:open`)} ${ma(la[n],`${r}:object`)} ${ma(ua,`${r}:close`)}.`}function ya(e,t){return e.targetWorker?en(e.targetWorker,t):e.jobId===t.jobId}function ba(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 xa=9e3,Sa=180+Wi;function Ca(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(yi).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?ya(t,a):!e.workers.some(e=>ya(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+Sa)<xa,g=n-f,_=h?m:u(l)?l:o.find(e=>e.ts>=g)??l,v=ba(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+Sa):_?.ts??0,C=_&&n>=S&&n-S<xa&&(!!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`?ma(pa.failed,`${i}:event-failed:${_.ts}`):X(_,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:ma(pa[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`?ma(pa.failed,`${i}:event-failed:${_.ts}`):X(_,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:ma(pa[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:_a(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=>yi(t)||e.recentEvents.some(e=>e.phase===`worker_reported`&&ya(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||gi(e.targetId)-gi(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 wa({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=_i(e),_=G(t,n,26),v=r===`manager`||r===`review`,y=i===`codex`?`#55c7b3`:`#a78bfa`,b=G(d?.entrance?.x??12.28,d?.entrance?.y??2.9,26),S=G(d?.lobby?.x??12.28,d?.lobby?.y??3.18,26),C=d??(r===`direct`?{doorway:{x:3.62,y:3.15},inside:{x:3.18,y:3.15}}:void 0),w=C?G(C.doorway.x,C.doorway.y,26):void 0,T=C?G(C.inside.x,C.inside.y,26):void 0,E=f?G(f.position.x,f.position.y,26):void 0,D=f?G(f.doorway.x,f.doorway.y,26):void 0,O=f?G(f.inside.x,f.inside.y,26):void 0,k=m?G(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`}:{},...w&&T?{"--office-start-x":`${b.x-_.x}px`,"--office-start-y":`${b.y-_.y}px`,"--office-lobby-x":`${S.x-_.x}px`,"--office-lobby-y":`${S.y-_.y}px`,"--office-door-x":`${w.x-_.x}px`,"--office-door-y":`${w.y-_.y}px`,"--office-inside-x":`${T.x-_.x}px`,"--office-inside-y":`${T.y-_.y}px`}:{},...E&&D&&O?{"--office-origin-x":`${E.x-_.x}px`,"--office-origin-y":`${E.y-_.y}px`,"--office-origin-door-x":`${D.x-_.x}px`,"--office-origin-door-y":`${D.y-_.y}px`,"--office-origin-inside-x":`${O.x-_.x}px`,"--office-origin-inside-y":`${O.y-_.y}px`}:{}},M=h.hairStyle===`long`?(0,x.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,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`circle`,{cx:_.x+8,cy:_.y-3,r:`4.5`,fill:h.hair}),(0,x.jsx)(`path`,{d:`M ${_.x+7} ${_.y-5}q8 5 3 13-1-6-6-8z`,fill:h.hair})]}):h.hairStyle===`bun`?(0,x.jsx)(`circle`,{cx:_.x+1,cy:_.y-14,r:`4.5`,fill:h.hair}):null,N=h.hairStyle===`short`?(0,x.jsx)(`path`,{d:`M ${_.x-7} ${_.y-7}q7-9 14 0v3q-7-4-14 0z`,fill:h.hair}):h.hairStyle===`side`?(0,x.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,x.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,x.jsxs)(`g`,{fill:h.hair,children:[[-6,-3,0,3,6].map((e,t)=>(0,x.jsx)(`circle`,{cx:_.x+e,cy:_.y-10+Math.abs(t-2)*1.2,r:`3.4`},e)),(0,x.jsx)(`circle`,{cx:_.x-7,cy:_.y-5,r:`3`}),(0,x.jsx)(`circle`,{cx:_.x+7,cy:_.y-5,r:`3`})]}):(0,x.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,x.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":ga(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":C?`hallway`:void 0,"data-office-transfer":f?`review`:void 0,"data-office-transition":o,style:j,children:(0,x.jsxs)(`g`,{className:`office-avatar-pose`,children:[(0,x.jsx)(`ellipse`,{cx:_.x,cy:_.y+19,rx:v?9:8,ry:`3.5`,fill:`#000`,opacity:`.32`}),(0,x.jsxs)(`g`,{className:`office-avatar-body`,children:[(0,x.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,x.jsxs)(x.Fragment,{children:[(0,x.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,x.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,x.jsx)(`path`,{d:`M ${_.x} ${_.y+4}l2 3-2 7-2-7z`,fill:`#d6aa4b`})]}),!v&&h.outfit===`hoodie`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`path`,{d:`M ${_.x-6} ${_.y+4}q6-7 12 0`,fill:`none`,stroke:`#d8dde2`,strokeOpacity:`.42`,strokeWidth:`2.2`}),(0,x.jsx)(`path`,{d:`M ${_.x-2} ${_.y+4}v7M ${_.x+2} ${_.y+4}v7`,stroke:`#e7e9ed`,strokeOpacity:`.6`,strokeWidth:`.8`}),(0,x.jsx)(`path`,{d:`M ${_.x-3} ${_.y+15}h6`,stroke:`#252a31`,strokeOpacity:`.45`})]}),!v&&h.outfit===`jacket`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.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,x.jsx)(`path`,{d:`M ${_.x} ${_.y+8}v10`,stroke:`#20242a`,strokeOpacity:`.65`})]}),!v&&h.outfit===`sweater`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`path`,{d:`M ${_.x-6} ${_.y+10}h12M ${_.x-5.5} ${_.y+13}h11`,stroke:`#f3e4c5`,strokeOpacity:`.35`,strokeWidth:`1.5`}),(0,x.jsx)(`path`,{d:`M ${_.x-3} ${_.y+3}q3 3 6 0`,fill:`none`,stroke:`#ede7dc`,strokeOpacity:`.45`})]}),!v&&h.outfit===`tee`&&(0,x.jsx)(`path`,{d:`M ${_.x-3} ${_.y+3}q3 4 6 0`,fill:`none`,stroke:`#f4f6f8`,strokeOpacity:`.38`,strokeWidth:`1.2`}),(0,x.jsxs)(`g`,{className:`office-avatar-arms-rest`,children:[(0,x.jsx)(`path`,{d:`M ${_.x-5} ${_.y+7}l-5 8`,stroke:h.skin,strokeWidth:`3`,strokeLinecap:`round`}),(0,x.jsx)(`path`,{d:`M ${_.x+5} ${_.y+7}l5 8`,stroke:h.skin,strokeWidth:`3`,strokeLinecap:`round`})]}),(0,x.jsxs)(`g`,{className:`office-avatar-arms-working`,"data-avatar-hands":`keyboard`,children:[(0,x.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,x.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,x.jsxs)(`g`,{className:`office-avatar-head`,children:[M,(0,x.jsx)(`circle`,{cx:_.x,cy:_.y-5,r:v?8:7.5,fill:h.skin,stroke:`#f8e4d1`,strokeOpacity:`.24`}),N]}),u&&(0,x.jsxs)(`g`,{className:`office-attention-badge`,children:[(0,x.jsx)(`circle`,{cx:_.x+10,cy:_.y-18,r:`6.5`,fill:`#3a162e`,stroke:`#f472b6`,strokeWidth:`1.2`}),(0,x.jsx)(`text`,{x:_.x+10,y:_.y-15.4,textAnchor:`middle`,fill:`#f9a8d4`,fontSize:`8`,fontWeight:`900`,children:`?`})]})]})})}function Ta({x:e,y:t,text:n,delayMs:r=Wi+100,kind:i=`speech`,targetId:a,onClick:o}){let s=G(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,x.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,x.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,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`circle`,{cx:s.x-3,cy:s.y-25,r:`3.5`,fill:`#f5f1e8`,stroke:u,strokeOpacity:`.65`}),(0,x.jsx)(`circle`,{cx:s.x+2,cy:s.y-19,r:`2`,fill:`#f5f1e8`,stroke:u,strokeOpacity:`.55`})]}):(0,x.jsx)(`path`,{d:`M ${s.x-7} ${s.y-31}l7 9 8-9z`,fill:i===`alert`?`#fff3f3`:`#f5f1e8`}),i===`alert`&&(0,x.jsx)(`text`,{x:s.x-l/2+10,y:s.y-40,fill:u,fontSize:`9`,fontWeight:`900`,children:`!`}),i===`output`&&(0,x.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,x.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 Ea={direct:`#17171d`,standard:`#15161c`,large:`#19171b`},Da={direct:`#55c7b3`,standard:`#a78bfa`,large:`#e6bd62`};function Oa({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:S}){let C=e=>l[e.missionId]??xi(e),w=(e,t)=>l[`${e.missionId}:${t.id}`]??bi(t,e),T=ei(e),E=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g())},D=e=>{e.stopPropagation(),g()},O=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`?[]:ri,k=t[0],A=ji(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(yi).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`:Da[e.kind];if(S===`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,x.jsxs)(`g`,{"aria-label":r,pointerEvents:`visiblePainted`,opacity:j,style:{transition:`opacity 180ms ease`},children:[(0,x.jsx)(`title`,{children:r}),(0,x.jsx)(Hi,{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(S===`contents`||S===`furniture`||S===`people`){let n=S===`contents`||S===`furniture`,l=S===`contents`||S===`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,x.jsx)(Ta,{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,T=b?.[0],E=e.kind===`standard`&&k?{x:e.x+O[0][0]+.36,y:e.y+O[0][1]+.78}:void 0,D=T===void 0?void 0:{x:e.x+O[T+1][0]+.36,y:e.y+O[T+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,x.jsxs)(`g`,{opacity:j,"data-office-transition":k?o[k.mission.missionId]:void 0,style:{transition:`opacity 180ms ease`},children:[n&&(0,x.jsxs)(`g`,{pointerEvents:`none`,children:[(0,x.jsx)(Y,{x:e.x+e.width*.52,y:e.y+.12,atmosphere:A}),(e.id===`direct-studio`||e.id===`standard-a`||e.id===`review`)&&(0,x.jsx)(Ui,{x:e.x+.35,y:e.y+.35}),e.id===`direct-studio`&&(0,x.jsx)(Ri,{x:e.x+2.45,y:e.y}),e.id===`standard-b`&&(0,x.jsx)(Bi,{x:e.x+.18,y:e.y+2.18}),e.id===`standard-c`&&(0,x.jsx)(zi,{x:e.x+.2,y:e.y}),e.kind===`large`?(0,x.jsx)(Li,{x:e.x,y:e.y,occupiedCount:t.length,dimmedSeatIndexes:new Set(t.filter(e=>!M(e)).map(e=>e.seatIndex))}):O.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?Ai(k.mission,s,l,w(k.mission,s)):a?Ai(a.mission,void 0,l,C(a.mission)):void 0,d=e.kind===`direct`&&a&&!M(a);return(0,x.jsx)(`g`,{"data-filter-match":d?`false`:a?`true`:void 0,opacity:d?.2:1,style:{transition:`opacity 180ms ease`},children:(0,x.jsx)(Fi,{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,x.jsxs)(x.Fragment,{children:[e.kind===`direct`&&t.map(t=>{let[n,i]=O[t.seatIndex],c=M(t);return(0,x.jsx)(`g`,{"data-filter-match":String(c),opacity:c?1:.2,style:{transition:`opacity 180ms ease`},children:(0,x.jsx)(wa,{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:C(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]=O[t.seatIndex];return(0,x.jsx)(Ta,{x:e.x+n+.36,y:e.y+r+.72,text:sa(`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]=O[t.seatIndex];return(0,x.jsx)(Ta,{x:e.x+n+.36,y:e.y+r+.72,text:sa(`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]=O[t.seatIndex];return y(g(t.mission.missionId),e.x+r+.36,e.y+i+.72)}),e.kind===`standard`&&k&&(0,x.jsxs)(x.Fragment,{children:[!k.relocated&&(0,x.jsx)(wa,{transitionStartedAt:s[k.mission.missionId],identity:k.mission.missionId,x:e.x+O[0][0]+.36,y:e.y+O[0][1]+.78,role:`manager`,provider:k.mission.mission.provider,state:C(k.mission),needsAttention:r.has(k.mission.missionId),activeMotion:a.has(k.mission.missionId),reviewing:k.mission.activityStatus===`idle`&&k.mission.workers.some(e=>!yi(e)),transition:o[k.mission.missionId],route:P,interaction:b?`receiving-report`:void 0,interactionTarget:D}),[...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`:w(k.mission,n);return(0,x.jsx)(wa,{identity:r,transitionStartedAt:s[r],x:e.x+O[t+1][0]+.36,y:e.y+O[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?E:void 0},n.id)}),b&&E&&D&&(()=>{let e=G(E.x,E.y,34);return(0,x.jsxs)(`g`,{className:`office-handoff-document`,"aria-hidden":`true`,children:[(0,x.jsx)(`rect`,{x:e.x+8,y:e.y-18,width:`12`,height:`15`,rx:`1.5`,fill:`#f5f1e8`,stroke:`#e6bd62`}),(0,x.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,x.jsx)(Ta,{x:e.x+O[0][0]+.36,y:e.y+O[0][1]+.78,text:sa(`manager`,k.mission.missionId,k.mission.missionId)}),e.kind===`standard`&&k&&o[k.mission.missionId]===`arrived`&&f?.id!==k.mission.missionId&&(0,x.jsx)(Ta,{x:e.x+O[0][0]+.36,y:e.y+O[0][1]+.78,text:sa(`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,x.jsx)(Ta,{x:e.x+O[t+1][0]+.36,y:e.y+O[t+1][1]+.72,text:sa(`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+O[0][0]+.36,e.y+O[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`&&E?E:{x:e.x+O[t+1][0]+.36,y:e.y+O[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,x.jsx)(`g`,{"data-filter-match":String(a),opacity:a?1:.2,style:{transition:`opacity 180ms ease`},children:(0,x.jsx)(wa,{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:C(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]=O[t.seatIndex],i=G(e.x+n+.36,e.y+r+.72,26);return(0,x.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,x.jsx)(`title`,{children:t.mission.name}),(0,x.jsx)(`polygon`,{"data-hit-target":`desk`,points:Pi(e.x+n,e.y+r,`direct`),fill:`transparent`,pointerEvents:`all`}),(0,x.jsx)(`circle`,{cx:i.x,cy:i.y,r:`22`,fill:`transparent`,pointerEvents:`all`})]},`target:${t.mission.missionId}`)}),e.kind===`standard`&&k&&(0,x.jsxs)(x.Fragment,{children:[(0,x.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,x.jsx)(`title`,{children:k.mission.name}),(0,x.jsx)(`polygon`,{"data-hit-target":`desk`,points:Pi(e.x+O[0][0],e.y+O[0][1],`manager`),fill:`transparent`,pointerEvents:`all`}),(0,x.jsx)(`circle`,{...(()=>{let t=G(e.x+O[0][0]+.36,e.y+O[0][1]+.78,26);return{cx:t.x,cy:t.y}})(),r:`24`,fill:`transparent`,pointerEvents:`all`})]}),[...p.entries()].map(([t,n])=>{let r=G(e.x+O[t+1][0]+.36,e.y+O[t+1][1]+.72,26);return(0,x.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,x.jsx)(`polygon`,{"data-hit-target":`desk`,points:Pi(e.x+O[t+1][0],e.y+O[t+1][1],`worker`),fill:`transparent`,pointerEvents:`all`}),(0,x.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=G(e.x+n+.19,e.y+r+.15,26);return(0,x.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,x.jsx)(`circle`,{cx:i.x,cy:i.y,r:`22`,fill:`transparent`,pointerEvents:`all`})},`target:${t.mission.missionId}`)})]})]})}let F=p||m,ee=ei({x:e.x+e.width*.76,y:e.y+e.depth-.16,width:.72,depth:.28},2),I=G(e.x+e.width/2,e.y+e.depth/2,2);return(0,x.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:D,onKeyDown:E,onFocus:y,onBlur:b,opacity:j,className:`office-room cursor-pointer outline-none`,children:[(0,x.jsx)(`title`,{children:`${e.label} · ${t.length?`${t.length} mission${t.length===1?``:`s`}`:`empty`} · capacity ${e.capacity}`}),(0,x.jsx)(`polygon`,{points:K(T),fill:Ea[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,x.jsx)(`polygon`,{points:K(T),fill:`url(#office-floor-${e.kind})`,opacity:F?`.8`:`.48`,pointerEvents:`none`}),(0,x.jsx)(Vi,{floor:T,doorway:ee,center:I,atmosphere:A,occupied:t.length>0}),(0,x.jsx)(`polygon`,{points:K(T),fill:`none`,stroke:`#fde68a`,strokeOpacity:`0`,strokeWidth:`2`,pointerEvents:`none`,className:`office-room-hover-outline`,"data-room-hover-outline":`true`})]})}var ka=30;function Aa(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function ja({start:e,end:t,height:n=ka}){let r=[e,t,{x:t.x,y:t.y-n},{x:e.x,y:e.y-n}];return(0,x.jsx)(`polygon`,{points:K(r),fill:`#24242c`,stroke:`#696472`,strokeOpacity:`.34`,strokeWidth:`1`})}function Ma({start:e,end:t,opensToward:n,opening:r=[.78,.88]}){let i=Aa(e,t,r[0]),a=Aa(e,t,r[1]);return(0,x.jsxs)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,"data-office-entrance":n,children:[(0,x.jsx)(ja,{start:e,end:i}),(0,x.jsx)(ja,{start:a,end:t}),(0,x.jsx)(`path`,{d:`M ${i.x} ${i.y}L ${a.x} ${a.y}`,stroke:`#e6bd62`,strokeOpacity:`.44`,strokeWidth:`2.5`})]})}function Na(e,t,n){return{start:G(e,t),end:G(e+n,t)}}function Pa(e,t,n){return{start:G(e,t),end:G(e,t+n)}}function Fa({action:e,floorLabel:t,layer:n}){let r=G(11.82,2.78),i=G(12.76,2.78),a=Aa(r,i,.08),o=Aa(r,i,.5),s=Aa(r,i,.92),c=(e,t)=>({x:e.x,y:e.y-t}),l=ei({x:11.78,y:2.78,width:1.02,depth:.72}),u=Aa(r,i,.5);return n===`lobby`?(0,x.jsx)(`polygon`,{"data-office-elevator-lobby":`true`,points:K(l),fill:`#24242b`,stroke:`#d9b65d`,strokeOpacity:`.18`}):(0,x.jsxs)(`g`,{"data-office-elevator":`true`,"data-elevator-action":e,children:[(0,x.jsx)(ja,{start:r,end:i,height:44}),(0,x.jsx)(`polygon`,{className:`office-elevator-door office-elevator-door-left`,points:K([a,o,c(o,34),c(a,34)]),fill:`#555b66`,stroke:`#c7ccd5`,strokeOpacity:`.62`}),(0,x.jsx)(`polygon`,{className:`office-elevator-door office-elevator-door-right`,points:K([o,s,c(s,34),c(o,34)]),fill:`#474c56`,stroke:`#c7ccd5`,strokeOpacity:`.62`}),(0,x.jsx)(`path`,{d:`M ${o.x} ${o.y}V ${o.y-34}`,stroke:`#15171c`,strokeWidth:`1.6`,opacity:`.9`}),(0,x.jsx)(`path`,{d:`M ${a.x} ${a.y-35}L ${s.x} ${s.y-35}`,stroke:`#d8bd78`,strokeOpacity:`.35`,strokeWidth:`2`}),(0,x.jsx)(`rect`,{x:u.x-11,y:u.y-43,width:`22`,height:`8`,rx:`2`,fill:`#101218`,stroke:`#d9b65d`,strokeOpacity:`.5`}),(0,x.jsxs)(`text`,{className:`office-elevator-indicator`,x:u.x,y:u.y-37,textAnchor:`middle`,fill:`#f2c75c`,fontSize:`6`,fontWeight:`800`,children:[`◆ `,t]}),(0,x.jsx)(`rect`,{x:s.x+5,y:s.y-24,width:`7`,height:`14`,rx:`2`,fill:`#171920`,stroke:`#aeb4c0`,strokeOpacity:`.5`}),(0,x.jsx)(`circle`,{className:`office-elevator-call`,cx:s.x+8.5,cy:s.y-19,r:`1.5`,fill:`#f2c75c`}),(0,x.jsx)(`path`,{d:`M ${s.x+6.5} ${s.y-14}h4`,stroke:`#737986`,strokeWidth:`1`}),(0,x.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 Ia({rooms:e,elevatorAction:t,floorIndex:n=0}){let r=3.5,i=6.3;return(0,x.jsxs)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,children:[(0,x.jsx)(ja,{...Na(0,0,11.9)}),(0,x.jsx)(ja,{...Na(0,i,11.9)}),(0,x.jsx)(ja,{...Pa(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,x.jsxs)(`g`,{children:[(0,x.jsx)(ja,{...Pa(e,0,2.8)}),(0,x.jsx)(ja,{...Pa(e,r,2.8)})]},`column-${e}`)),e.some(e=>e.kind===`direct`)&&(0,x.jsx)(Ma,{...Pa(3.5,0,i),opensToward:`up`,opening:[.45,.55]}),e.filter(e=>e.kind!==`direct`&&e.y===0).map(e=>(0,x.jsx)(Ma,{...Na(e.x,e.y+e.depth,e.width),opensToward:`up`},`${e.id}-door`)),e.filter(e=>e.y===r).map(e=>(0,x.jsx)(Ma,{...Na(e.x,e.y,e.width),opensToward:`down`},`${e.id}-door`)),(0,x.jsx)(Fa,{action:t,floorLabel:n>=1e3?`A${n-999}`:String(n+1).padStart(2,`0`),layer:`lobby`}),(0,x.jsxs)(`g`,{"data-office-perimeter":`right`,children:[(0,x.jsx)(ja,{...Pa(11.9,0,2.8)}),(0,x.jsx)(ja,{...Pa(11.9,r,2.8)})]}),(0,x.jsx)(Fa,{action:t,floorLabel:n>=1e3?`A${n-999}`:String(n+1).padStart(2,`0`),layer:`cab`})]})}function La({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),[S,C]=(0,g.useState)(null),w=li(e),T=ci(w);(0,g.useEffect)(()=>{b(null),C(null)},[e]);let E=T.find(e=>e.id===y),D=ei({x:-.45,y:-.95,width:13.55,depth:8.2}),O=ei(w===`headquarters`?{x:3.35,y:2.82,width:9.45,depth:.66}:{x:-.15,y:2.82,width:12.95,depth:.66}),k=G(12.7,7.08),A=e=>t.filter(t=>t.spaceId===e),j=e=>{let t=T.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=E?A(E.id):[],N=E?.kind===`standard`&&M[0]?Math.min(E.capacity,1+M[0].mission.workers.filter(yi).length):M.length,P=new Set(t.map(e=>e.spaceId)).size,F=Ti(t),ee=Object.values(a).find(e=>e===`entering`||e===`exiting`||e===`accepted-completion`||e===`moving-to-review`),I=()=>{b(null),C(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 te=T.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(yi).length):t.length}});return(0,x.jsxs)(`div`,{"data-office-motion":f,"data-office-active":p?`true`:`false`,"data-office-room-count":T.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,x.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,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.2em] text-amber-200/40`,children:ui(e)}),(0,x.jsxs)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:[P,`/`,T.length,` spaces active · `,t.length,` mission`,t.length===1?``:`s`,` placed`]})]}),E?(0,x.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,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[9px] font-semibold text-white/65`,children:E.label}),(0,x.jsxs)(`p`,{className:`mt-0.5 text-[8px] text-white/28`,children:[E.kind===`large`?`Review`:`Direct`,` · `,N,`/`,E.capacity,` occupied`]})]}),(0,x.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,x.jsx)(`p`,{className:`text-[10px] text-white/22`,children:`Click an occupied room, manager, or worker to inspect it`})]}),(0,x.jsx)(`div`,{className:`grid gap-2 p-3 sm:hidden`,"aria-label":`${ui(e)} room directory`,children:te.map(({room:e,occupants:t,seatCount:n})=>(0,x.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,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`block text-xs font-medium text-white/70`,children:e.label}),(0,x.jsx)(`span`,{className:`mt-1 block text-[10px] text-white/35`,children:t.length?t.map(e=>e.mission.name).join(`, `):`Vacant`})]}),(0,x.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,x.jsx)(`div`,{"data-testid":`office-canvas`,className:`relative hidden min-h-[560px] sm:block lg:min-h-[640px]`,onClick:I,children:(0,x.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,x.jsx)(`title`,{id:`office-floor-title`,children:`Hive visual office floor`}),(0,x.jsxs)(`desc`,{id:`office-floor-description`,children:[`An elevated overhead `,w===`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,x.jsxs)(`defs`,{children:[(0,x.jsx)(`filter`,{id:`office-shadow`,x:`-30%`,y:`-30%`,width:`160%`,height:`180%`,children:(0,x.jsx)(`feDropShadow`,{dx:`0`,dy:`14`,stdDeviation:`14`,floodColor:`#000`,floodOpacity:`.6`})}),(0,x.jsx)(`pattern`,{id:`office-grid`,width:`28`,height:`16`,patternUnits:`userSpaceOnUse`,children:(0,x.jsx)(`path`,{d:`M0 8 14 0l14 8-14 8z`,fill:`none`,stroke:`#f1c15a`,strokeOpacity:`.03`})}),(0,x.jsx)(`pattern`,{id:`office-floor-direct`,width:`22`,height:`22`,patternUnits:`userSpaceOnUse`,children:(0,x.jsx)(`path`,{d:`M0 11h22M11 0v22`,stroke:`#55c7b3`,strokeOpacity:`.055`})}),(0,x.jsxs)(`pattern`,{id:`office-floor-standard`,width:`18`,height:`18`,patternUnits:`userSpaceOnUse`,children:[(0,x.jsx)(`circle`,{cx:`9`,cy:`9`,r:`1.2`,fill:`#a78bfa`,fillOpacity:`.09`}),(0,x.jsx)(`path`,{d:`M0 0h18v18H0z`,fill:`none`,stroke:`#a78bfa`,strokeOpacity:`.035`})]}),(0,x.jsx)(`pattern`,{id:`office-floor-large`,width:`24`,height:`14`,patternUnits:`userSpaceOnUse`,children:(0,x.jsx)(`path`,{d:`M0 7 12 0l12 7-12 7z`,fill:`none`,stroke:`#e6bd62`,strokeOpacity:`.07`})})]}),(0,x.jsx)(`rect`,{"data-testid":`office-background`,width:`1100`,height:`600`,fill:`url(#office-grid)`,onClick:I}),(0,x.jsxs)(`g`,{transform:`translate(42 -24) scale(1.16)`,filter:`url(#office-shadow)`,children:[(0,x.jsx)(`polygon`,{points:K(D),fill:`#101015`,stroke:`#d6b464`,strokeOpacity:`.16`,strokeWidth:`2`}),(0,x.jsx)(`polygon`,{points:K(O),fill:`#28252a`,stroke:`#e8be62`,strokeOpacity:`.16`}),T.map(e=>{let t=A(e.id),i=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,x.jsx)(Oa,{room:e,occupants:t,visibleMissionIds:r,workerSeatAssignments:n,transitions:a,transitionStarts:o,sceneWorkers:s,presentedStates:c,selected:y===e.id,focused:S===e.id,dimmed:i||y!==null&&y!==e.id&&S!==e.id,onSelect:()=>j(e.id),onOpenMission:m,onOpenWorker:h,onFocus:()=>C(e.id),onBlur:()=>C(null),layer:`floor`},`${e.id}-floor`)}),(0,x.jsx)(Ia,{rooms:T,elevatorAction:ee,floorIndex:e}),T.map(e=>{let t=A(e.id),i=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,x.jsx)(Oa,{room:e,occupants:t,visibleMissionIds:r,workerSeatAssignments:n,transitions:a,transitionStarts:o,sceneWorkers:s,presentedStates:c,selected:y===e.id,focused:S===e.id,dimmed:i||y!==null&&y!==e.id&&S!==e.id,onSelect:()=>j(e.id),onOpenMission:m,onOpenWorker:h,onFocus:()=>void 0,onBlur:()=>void 0,layer:`furniture`},`${e.id}-furniture`)}),T.map(e=>{let t=A(e.id),i=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,x.jsx)(Oa,{room:e,occupants:t,visibleMissionIds:r,workerSeatAssignments:n,transitions:a,transitionStarts:o,sceneWorkers:s,presentedStates:c,selected:y===e.id,focused:S===e.id,dimmed:i||y!==null&&y!==e.id&&S!==e.id,onSelect:()=>void 0,onOpenMission:m,onOpenWorker:h,onFocus:()=>void 0,onBlur:()=>void 0,layer:`plaque`},`${e.id}-plaque`)}),T.map(e=>{let t=A(e.id),f=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,x.jsx)(Oa,{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:S===e.id,dimmed:f||y!==null&&y!==e.id&&S!==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,x.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 · `,ui(e).toUpperCase()]})]})]})}),(0,x.jsx)(`ul`,{className:`sr-only`,"aria-label":`${ui(e)} room summaries`,children:te.map(({room:e,occupants:t,seatCount:n})=>(0,x.jsxs)(`li`,{children:[e.label,`: `,t.length?t.map(e=>e.mission.name).join(`, `):`vacant`,`; `,n,` of `,e.capacity,` seats occupied.`]},e.id))}),E&&E.kind!==`large`&&E.kind!==`direct`&&M.length>1&&(0,x.jsx)(`div`,{className:`border-t border-white/[0.06] px-4 py-3`,children:(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsx)(`p`,{className:`mr-1 text-[9px] font-semibold uppercase tracking-wider text-white/25`,children:`Choose an occupant`}),M.map(e=>(0,x.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,x.jsx)(`span`,{className:`block max-w-48 truncate text-[10px] font-medium text-white/65`,children:e.mission.name}),(0,x.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 Ra=Array.from({length:8},(e,t)=>({id:`direct-studio:${t}`,spaceId:`direct-studio`,seatIndex:t,kind:`direct`})),za=[`standard-a`,`standard-b`,`standard-c`].map(e=>({id:e,spaceId:e,seatIndex:0,kind:`orchestrated`})),Ba=[`standard-a`,`standard-b`,`standard-c`,`standard-d`,`standard-e`,`standard-f`].map(e=>({id:e,spaceId:e,seatIndex:0,kind:`orchestrated`})),Va=Array.from({length:10},(e,t)=>({id:`review:${t}`,spaceId:`review`,seatIndex:t,kind:`review`})),Ha=[...Ra,...Ba,...Va];function Ua(e){return(e===0?[...Ra,...za,...Va]:e>=1e3?[...Ra,...Va]:Ba).map(t=>({...t,id:`floor:${e}:${t.id}`,floorIndex:e}))}Ua(0);function Wa(e){let t=/^floor:(\d+):(.+)$/.exec(e),n=t?Number(t[1]):0,r=t?.[2]??e,i=Ha.find(e=>e.id===r);return i&&Number.isSafeInteger(n)&&n>=0&&Ua(n).some(e=>e.id.endsWith(`:${i.id}`))?{...i,id:`floor:${n}:${i.id}`,floorIndex:n}:void 0}function Ga(e){return e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`?null:e.lifecycleStatus===`ready_for_review`?`review`:e.mission.mode===`direct`?`direct`:`orchestrated`}function Ka(e,t){let n=e.filter(e=>Ga(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=Wa(n);!t||!o||o.kind!==Ga(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=Ga(e);if(!n)continue;let r=Wa(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=Ua(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=Wa(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 qa(e,t){let n=Object.entries(e),r=Object.entries(t);return n.length===r.length&&n.every(([e,n])=>t[e]===n)}var Ja=`hive:office-checkpoint`,Ya=6e5;function Xa(){try{return typeof window>`u`?void 0:window.sessionStorage}catch{return}}function Za(e=Date.now()){let t=Xa();if(t)try{let n=t.getItem(Ja);if(!n)return;let r=JSON.parse(n);return typeof r?.savedAt!=`number`||e-r.savedAt>Ya||!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 Qa(e,t=Date.now()){let n=Xa();if(n)try{let r=e.queue.filter(e=>e.startsAt+e.duration>t);n.setItem(Ja,JSON.stringify({...e,queue:r,savedAt:t}))}catch{}}function $a(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 eo,to=!1,no=new Set;function ro(){for(let e of no)e()}function io(e=Date.now()){if(to||=(eo=Za(e),!0),!eo)return;let t=eo.queue.filter(t=>t.startsAt+t.duration>e);return{...eo,queue:t}}function ao(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}};eo=a,to=!0,Qa(a,t),ro()}function oo(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 so=typeof window>`u`?g.useEffect:g.useLayoutEffect,co=3e4,lo=0,uo=new Set([`room-activate`,`desk-reserved`,`entering`,`arrived`]),fo=512;function po(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)({}),ee=(0,g.useRef)(new Set),[I,te]=(0,g.useState)(0),[L,R]=(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,V=(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>fo&&(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))};so(()=>{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(),R({}),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=$a(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-lo);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):[]),ee.current=new Set([i])}}else{if(!ee.current.has(i)){ee.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-lo),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=$i(r(u.current),r(s),n),o=$i(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)>=lo,_=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&&uo.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<=co)){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>co&&w.current.delete(e);R(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)),I=k.filter(e=>f.some(t=>t.missionId===e.missionId&&t.action===e.action));V(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 te=_.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}`})),L=new Set(e.flatMap(e=>e.mission.workers.filter(e=>e.doneAt).map(t=>`${e.mission.missionId}:${t.id}`))),z=ta(te,E.current,n,L);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=na(e,[...P,...F],n);return z.stories.length&&(t=na(t,z.stories,n)),t=na(t,I,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 re=new Set(e.map(e=>e.mission.missionId)),ie=d.current.filter(e=>!re.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 oe=new Map(d.current.map(e=>[e.mission.missionId,e])),se=[];for(let t of e){let e=oe.get(t.mission.missionId);if(t.kind!==`review`||e?.kind!==`orchestrated`)continue;let n=ci(li(e.floorIndex)).find(t=>t.id===e.spaceId);if(!n)continue;if(O.current.set(t.mission.missionId,e),e.floorIndex!==t.floorIndex){se.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;se.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}}])}se.length&&C(e=>({...e,...Object.fromEntries(se)}));let ce={},H=new Set(_.map(({mission:e,event:t})=>`${e.missionId}:${t.targetWorker}`));for(let e of H){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(ce)].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&&(ce[e]=a)}Object.keys(ce).length&&(x.current={...x.current,...ce},b(x.current))}u.current=s,d.current=e,h(n)},[B,n,s,e,i,a,t]),(0,g.useEffect)(()=>{if(!Object.keys(L).length)return;let e=Math.min(...[...w.current.values()].map(e=>e.queuedAt+co)),t=window.setTimeout(()=>{let e=Date.now();for(let[t,n]of w.current)e-n.queuedAt>=co&&w.current.delete(t);R(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)},[L]),(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=>{V(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=na(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&&ao({missionId:c,queue:f,presented:[...D.current],seats:{...F.current,...x.current}})},[B,f,m,c]);let re=(0,g.useMemo)(()=>{let t={};for(let n of e){t[n.mission.missionId]=xi(n.mission);for(let e of n.mission.workers)t[`${n.mission.missionId}:${e.id}`]=bi(e,n.mission)}return oo(k.current,t,m,Ji)},[e,m,I]);return k.current=re.held,(0,g.useEffect)(()=>{if(re.nextExpiry===void 0)return;let e=window.setTimeout(()=>te(e=>e+1),Math.max(16,re.nextExpiry-Date.now()+8));return()=>window.clearTimeout(e)},[re.nextExpiry]),(0,g.useMemo)(()=>{let n=new Set(e.map(e=>e.mission.missionId)),r=aa(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<lo&&(r[e]=`room-activate`);let i=new Set(_.filter(e=>!e.relocated).map(e=>e.mission.missionId)),a=ia(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=Si(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:re.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:L}},[B,m,L,e,re.states,f,_,y,S,t])}function mo(){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 ho({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)(()=>Ka(t,n),[t,n]),S=(0,g.useMemo)(()=>Ci(b.placements,r),[b.placements,r]);(0,g.useEffect)(()=>{(!qa(n,b.assignments)||!wi(r,S))&&a(b.assignments,S)},[a,b.assignments,n,r,S]);let w=(0,g.useMemo)(()=>new Set(e.map(e=>e.missionId)),[e]),T=(0,g.useMemo)(()=>[...new Set([0,c,...b.placements.map(e=>e.floorIndex)])].sort((e,t)=>e-t),[b.placements,c]),E=T.includes(c)?c:0,D=po(b.placements,S,o,u,E,s),O=mo();(0,g.useEffect)(()=>{E!==c&&l(E)},[E,l,c]);let k=(0,g.useMemo)(()=>T.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,T,b.placements]),A=D.placements.filter(e=>e.floorIndex===E),[j,M]=(0,g.useState)(()=>Date.now());(0,g.useEffect)(()=>{if(f===`off`||!O.active)return;let e=window.setInterval(()=>M(Date.now()),2e3);return()=>window.clearInterval(e)},[f,O.active]);let N=(0,g.useMemo)(()=>Ca(D.placements,f,j),[f,j,D.placements]),P=b.unplaced.filter(e=>w.has(e.missionId));return(0,x.jsxs)(`section`,{ref:O.sceneRef,"aria-label":`Visual office`,className:`space-y-4`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.22em] text-amber-200/40`,children:`Visual office`}),(0,x.jsx)(`h2`,{className:`mt-1 text-lg font-semibold text-white/75`,children:`Hive headquarters`}),(0,x.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,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,x.jsxs)(`div`,{className:`flex gap-2.5 text-[9px] text-white/35`,children:[(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`b`,{className:`text-[#55c7b3]`,children:`◆`}),` Direct`]}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`b`,{className:`text-[#a78bfa]`,children:`◆`}),` Orchestrated`]}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`b`,{className:`text-[#e6bd62]`,children:`◆`}),` Review`]})]}),(0,x.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,x.jsx)(`span`,{children:`Talk`}),(0,x.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,x.jsx)(`option`,{value:`off`,children:`Off`}),(0,x.jsx)(`option`,{value:`work`,children:`Work only`}),(0,x.jsx)(`option`,{value:`work_personality`,children:`Work + personality`})]})]}),(0,x.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,x.jsx)(`span`,{children:`Motion`}),(0,x.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,x.jsx)(`option`,{value:`system`,children:`System`}),(0,x.jsx)(`option`,{value:`full`,children:`On`}),(0,x.jsx)(`option`,{value:`reduced`,children:`Reduced`})]})]}),(0,x.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(D.pendingArrivals).length>0&&(0,x.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,x.jsx)(`span`,{className:`text-[10px] font-medium text-emerald-100/65`,children:`New arrival elsewhere:`}),Object.entries(D.pendingArrivals).map(([e,t])=>(0,x.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 `,ui(Number(e)),` · View`]},e))]}),T.length>1&&(0,x.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:k.map(e=>{let t=D.pendingArrivals[e.floorIndex]??0;return(0,x.jsxs)(`button`,{type:`button`,"aria-current":E===e.floorIndex?`page`:void 0,onClick:()=>l(e.floorIndex),className:`min-w-36 rounded-lg border px-3 py-2 text-left transition ${E===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,x.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[10px] font-semibold uppercase tracking-wider text-white/65`,children:[(0,x.jsx)(`span`,{children:ui(e.floorIndex)}),t>0&&(0,x.jsx)(`span`,{className:`rounded-full bg-emerald-300/15 px-1.5 py-0.5 text-[8px] text-emerald-100/75`,children:`New`})]}),(0,x.jsxs)(`span`,{className:`mt-1 block text-[9px] text-white/28`,children:[e.occupied,` occupied`,e.attention?` · ${e.attention} attention`:``]})]},e.floorIndex)})}),(0,x.jsx)(La,{floorIndex:E,placements:A,workerSeatAssignments:D.workerSeats,visibleMissionIds:w,attentionMissionIds:m,transitions:D.transitions,transitionStarts:D.transitionStarts,sceneWorkers:D.sceneWorkers,presentedStates:D.presentedStates,transferOrigins:D.transferOrigins,bubbles:N,announcement:i,motion:u,active:O.active,onOpenMission:h,onOpenWorker:_,onOpenDirectStudio:v,onOpenReviewHall:y}),t.length===0?(0,x.jsxs)(`div`,{className:`rounded-xl border border-dashed border-white/8 px-4 py-5 text-center`,children:[(0,x.jsx)(`p`,{className:`text-xs font-medium text-white/45`,children:`The office is ready for its first mission`}),(0,x.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,x.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,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,x.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-wider text-orange-200/45`,children:`Waiting for compatible space`}),(0,x.jsxs)(`p`,{className:`text-[10px] text-white/20`,children:[P.length,` overflow`]})]}),(0,x.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:P.map(e=>(0,x.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,x.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,x.jsx)(`h3`,{className:`truncate text-xs font-medium text-white/55 group-hover:text-white/75`,children:e.name}),(0,x.jsxs)(`div`,{className:`flex gap-1`,children:[(0,x.jsx)(Zt,{status:e.lifecycleStatus}),(0,x.jsx)(C,{status:e.activityStatus})]})]}),(0,x.jsxs)(`p`,{className:`mt-2 text-[9px] text-white/22`,children:[e.mission.mode,` · no compatible space on Floor 1`]})]},e.missionId))})]}):null]})}function go({sounds:e,notifications:t,onOpenPolicies:n,onOpenTemplates:r}){let[i,a]=(0,g.useState)(!1),o=(0,g.useRef)(null);Ae(i,Ce.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,x.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,x.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,x.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,x.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":e.enabled,onClick:()=>e.toggle(),className:s,children:[(0,x.jsx)(`span`,{children:`Sound alerts`}),(0,x.jsx)(`span`,{className:c(e.enabled),children:e.enabled?`On`:`Off`})]}),t?.supported&&(0,x.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":t.enabled,onClick:()=>void t.toggle(),className:s,children:[(0,x.jsx)(`span`,{children:`Desktop notifications`}),(0,x.jsx)(`span`,{className:c(t.enabled),children:t.enabled?`On`:`Off`})]}),(0,x.jsx)(`div`,{className:`my-1 border-t border-white/[0.06]`}),(0,x.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{a(!1),n()},className:s,children:`Workspace policy`}),(0,x.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{a(!1),r()},className:s,children:`Mission templates`})]})]})}function _o({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 ye(e.sessionId,e.name)}catch(e){a(e.message)}finally{r(!1)}}return(0,x.jsxs)(`div`,{className:`rounded-lg border border-white/10 bg-white/[0.02] px-4 py-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(Ne,{missionId:`session:${e.sessionId}`,name:e.name}),(0,x.jsx)(`p`,{className:`mono truncate text-xs text-white/30`,children:e.cwd})]}),(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,x.jsx)(C,{status:e.status}),e.jobId&&(0,x.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,x.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,x.jsx)(vt,{pid:e.pid,status:e.status,force:!e.jobId,label:`End`})]})]}),i&&(0,x.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:i}),!e.jobId&&(0,x.jsx)(`p`,{className:`mt-2 text-[10px] text-white/20`,children:`Interactive process · no background-job identity to adopt safely`})]})}function vo({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`}`)??``),[S,C]=(0,g.useState)(()=>typeof window>`u`||localStorage.getItem(`hive:quick-worktree`)!==`false`),[w,T]=(0,g.useState)(()=>typeof window>`u`?``:localStorage.getItem(`hive:last-cwd`)??``),[E,D]=(0,g.useState)(()=>typeof window>`u`?!1:localStorage.getItem(`hive:quick-options`)===`true`);(0,g.useEffect)(()=>{l([]),A(w||void 0,_).then(({skills:e})=>l(e)).catch(()=>l([]))},[w,_]),(0,g.useEffect)(()=>{ee(w||void 0).then(p).catch(()=>p(void 0))},[w]),(0,g.useEffect)(()=>{F(``).then(({directories:e})=>h(e)).catch(()=>h([]))},[]),(0,g.useEffect)(()=>{_e().then(({providers:e})=>{if(d(e),e.find(e=>e.provider===_)?.available===!1){let t=e.find(e=>e.available);t&&O(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 O(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 j(e){b(e);try{localStorage.setItem(`hive:quick-model:${_}`,e)}catch{}}function M(e){C(e);try{localStorage.setItem(`hive:quick-worktree`,String(e))}catch{}}function N(e){T(e);try{localStorage.setItem(`hive:last-cwd`,e)}catch{}}function P(e){t({task:n,cwd:w||void 0,mode:e,provider:_,model:y||void 0,worktree:_===`claude`&&S})}async function I(){let t=n.trim();if(!(!t||i)){a(!0),s(null);try{let n=await k({task:t,mode:`direct`,worktree:_===`claude`&&!!f?.repositoryRoot&&S,cwd:w||void 0,provider:_,model:y||void 0});r(``),e(n.missionId,t)}catch(e){s(e.message)}finally{a(!1)}}}return(0,x.jsxs)(`div`,{className:`mb-4 rounded-xl border border-violet-300/15 bg-violet-300/[0.03] p-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,x.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,x.jsx)(be,{marker:`data-quick-ask`,value:n,onChange:r,skills:c,onSubmit:I,rows:1,suggestionsPlacement:`below`,placeholder:`Ask anything — Enter starts a direct mission, / for skills… i`,className:`min-h-9`})}),(0,x.jsx)(`button`,{onClick:()=>void I(),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,x.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-2 px-1`,children:[(0,x.jsxs)(`label`,{className:`flex min-w-0 items-center gap-1.5 text-[10px] text-white/30`,children:[(0,x.jsx)(`span`,{children:`Repository`}),(0,x.jsxs)(`select`,{"aria-label":`Quick mission repository`,value:w,onChange:e=>N(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:[w&&!m.some(e=>e.path===w||e.resolvedPath===w)&&(0,x.jsx)(`option`,{value:w,children:w.split(`/`).filter(Boolean).at(-1)??w}),m.map(e=>(0,x.jsx)(`option`,{value:e.path,children:e.path.split(`/`).filter(Boolean).at(-1)??e.path},e.resolvedPath))]})]}),(0,x.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[10px] text-white/30`,children:[(0,x.jsx)(`span`,{children:`Provider`}),(0,x.jsx)(`select`,{"aria-label":`Quick mission provider`,value:_,onChange:e=>O(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,x.jsx)(`option`,{value:e,disabled:u.find(t=>t.provider===e)?.available===!1,children:e},e))})]}),(0,x.jsxs)(`label`,{className:`flex min-w-0 items-center gap-1.5 text-[10px] text-white/30`,children:[(0,x.jsx)(`span`,{children:`Model`}),(0,x.jsxs)(`select`,{"aria-label":`Quick mission model`,value:y,onChange:e=>j(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,x.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,x.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),(0,x.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,x.jsx)(`input`,{type:`checkbox`,checked:_===`claude`&&!!f?.repositoryRoot&&S,disabled:_!==`claude`||!f?.repositoryRoot,onChange:e=>M(e.target.checked),className:`accent-violet-400`}),(0,x.jsx)(`span`,{children:`Isolated worktree`})]}),(0,x.jsx)(`span`,{className:`text-white/10`,children:`·`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>P(`direct`),className:`text-[10px] text-white/30 transition hover:text-white/60`,children:`All settings`}),(0,x.jsx)(`span`,{className:`text-white/10`,children:`·`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>P(`orchestrated`),className:`text-[10px] text-amber-200/45 transition hover:text-amber-100/75`,children:`Need parallel workers? Use an orchestrator →`})]}),o&&(0,x.jsx)(`p`,{className:`mt-1 px-1 text-xs text-rose-400`,children:o})]})}function yo({snapshot:e,connected:t,officePreferences:n,setOfficePreferences:r,onPresentationChange:i,onSelectOrchestrator:a,activeMissionId:o,onFollowMission:s,onOpenFullMission:c,answerVisible:l=!1,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),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(null),[O,k]=(0,g.useState)(null),[A,j]=(0,g.useState)(Wr);(0,g.useEffect)(()=>{Kr(A)},[A]);let[M,N]=(0,g.useState)(new Set),[P,F]=(0,g.useState)(!1),[ee,I]=(0,g.useState)(!1),L=Mr(e);Ae(!0,Ce.field,()=>{let e=document.activeElement;return nt(e)?(e?.blur?.(),!0):!1}),Ae(M.size>0,Ce.selection,()=>{rt(document.activeElement)||N(new Set)});let z=e=>N(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[ne,B]=(0,g.useState)(()=>{try{return new Set(JSON.parse(localStorage.getItem(`hive:hidden-sessions`)??`[]`))}catch{return new Set}}),V=e=>B(t=>{let n=new Set(t).add(e);return localStorage.setItem(`hive:hidden-sessions`,JSON.stringify([...n])),n}),re=e.other.filter(e=>!ne.has(e.sessionId)),ie=Vt(e,A,Date.now(),n.fleetSort),{filtered:ae,repositories:oe,templates:se,operationalCount:ce,needsMeCount:H}=ie,{operational:le,review:ue,paused:de,completed:fe,archived:pe}=ie.sections,me=(0,g.useMemo)(()=>Yr(e),[e]),he=(0,g.useMemo)(()=>new Set((e.decisions??[]).map(e=>e.missionId)),[e.decisions]),U=(0,g.useMemo)(()=>e.orchestrators.filter(e=>M.has(e.missionId)),[M,e.orchestrators]),ge=(0,g.useMemo)(()=>new Set(e.orchestrators.filter(e=>zt(e,he)).map(e=>e.missionId)),[he,e.orchestrators]),_e=(0,g.useMemo)(()=>new Set(e.orchestrators.filter(e=>Rt(e,he)).map(e=>e.missionId)),[he,e.orchestrators]),ve=(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]),ye=(0,g.useCallback)(()=>{v(void 0),h(!0)},[]),be=(0,g.useCallback)(()=>I(!0),[]),xe=(0,g.useMemo)(()=>new Map(e.orchestrators.map(e=>[e.missionId,e])),[e.orchestrators]),Se=(e,t)=>{let n=xe.get(e);if(!n)return;let r=(ve.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?te(e,i.decisionId,i.answer):i.next&&R(e,i.next)}};Hr({enabled:!m&&!y&&!S&&!P&&!ee,onNewMission:ye,onShowHelp:be,onFocusMission:o&&s?s:void 0,activeMissionId:o,onAffirm:e=>Se(e,Qe),onDecline:e=>Se(e,$e),onReply:e=>a(e,De),onPauseToggle:e=>{let t=xe.get(e),n=t&&Ze(t.lifecycleStatus);n&&R(e,n.next)},onOpenFull:e=>c?.(e),onToggleSelect:z});let we=Zr(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)(()=>lr({missions:e.orchestrators,openMission:e=>a(e,n.fleetPresentation===`office`?`room`:`details`),replyToMission:e=>a(e,n.fleetPresentation===`office`?`room`:`details`),setLifecycle:(e,t)=>{R(e,t)},newMission:ye,openTemplates:()=>b(!0),openPolicies:()=>C(!0),setView:e=>Te(e),toggleNeedsMe:()=>j(e=>({...e,needsMe:!e.needsMe})),focusSearch:()=>{typeof document<`u`&&document.querySelector(Br)?.focus()}}),[n.fleetPresentation,n.fleetDensity,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(!O)return;let e=window.setTimeout(()=>k(e=>e?.id===O.id?null:e),11e3);return()=>window.clearTimeout(e)},[O]),(0,x.jsxs)(`div`,{className:`${Tr} py-6 sm:py-10`,children:[(0,x.jsxs)(`header`,{className:`mb-8 flex flex-wrap items-center justify-between gap-4`,children:[(0,x.jsx)(Fe,{subtitle:(0,x.jsx)(wr,{snapshot:e,onFilter:e=>j(t=>({...t,...e}))})}),(0,x.jsxs)(`div`,{className:`flex max-w-full flex-wrap items-center justify-end gap-2`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>F(!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,x.jsx)(`span`,{children:`Go to…`}),(0,x.jsx)(`kbd`,{className:`mono rounded border border-white/[0.12] px-1 py-0.5 text-[9px] text-white/30`,children:`⌘K`})]}),(0,x.jsx)(`button`,{type:`button`,onClick:be,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,x.jsx)(Qr,{value:we,onChange:Te}),(0,x.jsx)(go,{sounds:p,notifications:f,onOpenPolicies:()=>C(!0),onOpenTemplates:()=>b(!0)}),(0,x.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`})]})]}),E&&(0,x.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,x.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,x.jsx)(`span`,{className:`font-medium text-rose-200`,children:`Mission didn’t start.`}),` `,E.message]}),(0,x.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>{v(E.draft),D(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,x.jsx)(`button`,{type:`button`,onClick:()=>D(null),className:`px-2 py-1 text-rose-100/55 hover:text-rose-100`,children:`Dismiss`})]})]}),m&&(0,x.jsx)(Me,{initialDraft:_,onClose:()=>h(!1),onLaunch:e=>{D(null),e.promise.catch(t=>D({message:t.message,draft:e.draft}))}}),y&&(0,x.jsx)(Dt,{repositories:oe,onClose:()=>b(!1)}),S&&(0,x.jsx)(Ot,{onClose:()=>C(!1)}),(0,x.jsx)(Rr,{open:ee,onClose:()=>I(!1)}),(0,x.jsx)(fr,{commands:Ee,open:P,onOpenChange:F,onFilterBoard:e=>j(t=>({...t,query:e,queryScope:`all`}))}),(0,x.jsx)(vo,{onStarted:(e,t)=>k({id:e,task:t}),onConfigure:e=>{v(e),h(!0)}}),(0,x.jsx)(Yt,{value:A,onChange:j,repositories:oe,templates:se,shown:ae.length,total:e.orchestrators.length,sort:n.fleetSort,onSortChange:e=>r(t=>({...t,fleetSort:e}))}),L.active&&(0,x.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,x.jsx)(`span`,{className:`min-w-0 text-sky-100/80`,children:Ar(L.changes,e.orchestrators)}),(0,x.jsx)(`span`,{className:`flex shrink-0 gap-2`,children:(0,x.jsx)(`button`,{type:`button`,onClick:()=>{j(e=>({...e,query:``})),L.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,x.jsx)(_t,{items:me,onOpenMission:Oe,numbersActive:!l}),n.fleetPresentation===`office`?(0,x.jsx)(ho,{missions:ae,allMissions:e.orchestrators,roomAssignments:n.roomAssignments,workerSeatAssignments:n.workerSeatAssignments,announcement:O,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:_e,onSelectMission:e=>a(e,`room`),onSelectWorker:(e,t)=>a(e,`room`,t),onSelectDirectStudio:u,onSelectReviewHall:d}):(0,x.jsxs)(x.Fragment,{children:[e.orchestrators.length===0&&(0,x.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&&ae.length===0&&(0,x.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,x.jsx)(Xn,{title:`Active missions`,description:`Work in progress, idle, stalled, or failed.`,missions:le,decisionsByMission:ve,blockedMissionIds:ge,changedMissionIds:L.active?L.changes.missionIds:void 0,selectedMissionIds:M,activeMissionId:o,onToggleSelect:z,groupByRepository:n.fleetSort===`repository`,density:n.fleetDensity,onSelect:a,onSelectWorker:ke}),(0,x.jsx)(Xn,{title:`Awaiting acceptance`,description:`The orchestrator reports that work and required verification are complete. Accept the result or request changes.`,missions:ue,decisionsByMission:ve,blockedMissionIds:ge,changedMissionIds:L.active?L.changes.missionIds:void 0,selectedMissionIds:M,activeMissionId:o,onToggleSelect:z,groupByRepository:n.fleetSort===`repository`,density:n.fleetDensity,onSelect:a,onSelectWorker:ke}),(0,x.jsx)(Xn,{title:`Paused`,missions:de,decisionsByMission:ve,blockedMissionIds:ge,changedMissionIds:L.active?L.changes.missionIds:void 0,selectedMissionIds:M,activeMissionId:o,onToggleSelect:z,groupByRepository:n.fleetSort===`repository`,density:n.fleetDensity,onSelect:a,onSelectWorker:ke}),(0,x.jsx)(Xn,{title:`Completed`,description:`Finished work retained for review, follow-ups, or reopening.`,missions:fe,decisionsByMission:ve,blockedMissionIds:ge,changedMissionIds:L.active?L.changes.missionIds:void 0,selectedMissionIds:M,activeMissionId:o,onToggleSelect:z,groupByRepository:n.fleetSort===`repository`,density:n.fleetDensity,onSelect:a,onSelectWorker:ke,collapsedByDefault:!0}),(0,x.jsx)(Xn,{title:`Archive`,description:`Missions intentionally removed from the operational fleet.`,missions:pe,blockedMissionIds:ge,changedMissionIds:L.active?L.changes.missionIds:void 0,selectedMissionIds:M,activeMissionId:o,onToggleSelect:z,groupByRepository:n.fleetSort===`repository`,density:n.fleetDensity,onSelect:a,collapsedByDefault:!0}),(0,x.jsx)(Sr,{missions:ae,onOpenMission:Oe}),(0,x.jsx)(ar,{selected:U,missionsWithDecisions:he,onClear:()=>N(new Set)}),e.other.length>0&&(0,x.jsxs)(`section`,{className:`mt-10 border-t border-white/[0.06] pt-6`,children:[(0,x.jsxs)(`button`,{onClick:()=>T(!w),className:`flex w-full items-center justify-between text-left`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`h2`,{className:`text-sm font-medium uppercase tracking-wide text-white/30`,children:[`Discovered local sessions `,(0,x.jsx)(`span`,{className:`ml-1 text-white/15`,children:re.length})]}),(0,x.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,x.jsx)(`span`,{className:`rounded-md border border-white/8 px-2 py-1 text-xs text-white/30`,children:w?`−`:`+`})]}),w&&(0,x.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2`,children:[ne.size>0&&(0,x.jsx)(`div`,{className:`flex justify-end`,children:(0,x.jsxs)(`button`,{onClick:()=>{B(new Set),localStorage.removeItem(`hive:hidden-sessions`)},className:`text-[10px] text-white/25 hover:text-white/50`,children:[`Restore `,ne.size,` hidden session`,ne.size===1?``:`s`]})}),re.map(e=>(0,x.jsx)(_o,{session:e,onHide:()=>V(e.sessionId)},e.sessionId)),!re.length&&(0,x.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 bo({label:e,eyebrow:t,title:n,subtitle:r,accent:i=`amber`,onClose:a,closeLabel:o,children:s,afterHeader:c}){Ae(!0,Ce.drawer,a);let l=xe(a),u=i===`needs-you`?`text-rose-300/60`:`text-amber-300/55`;return(0,x.jsx)(`div`,{className:`fixed inset-0 z-50 flex justify-end bg-black/55`,role:`presentation`,...l,children:(0,x.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,x.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,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.16em] ${u}`,children:t}),(0,x.jsx)(`h2`,{className:`mt-1 text-lg font-semibold text-white`,children:n}),r&&(0,x.jsx)(`p`,{className:`mt-1 text-[11px] text-white/25`,children:r})]}),(0,x.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,x.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:s})]})})}function xo({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)({}),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)({}),[m,h]=(0,g.useState)(!1),[_,v]=(0,g.useState)(0),y=(0,g.useMemo)(()=>[...e].sort((e,t)=>Jr(e)-Jr(t)||e.createdAt-t.createdAt),[e]);if((0,g.useEffect)(()=>{v(e=>Math.min(e,Math.max(0,y.length-1)))},[y.length]),(0,g.useEffect)(()=>{a&&i===`drawer`&&h(!0)},[a,i]),(0,g.useEffect)(()=>{if(!s||typeof window>`u`||i===`drawer`&&!m)return;let e=y[0];if(!e?.choices.length)return;let t=t=>{if(t.altKey||t.metaKey||t.ctrlKey||t.defaultPrevented||rt(t.target))return;let n=Number(t.key)-1;!Number.isInteger(n)||n<0||n>=Math.min(e.choices.length,9)||(t.preventDefault(),b(e,e.choices[n]))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)}),!e.length)return null;async function b(e,t){let n=(t??c[e.id]??``).trim();if(!(!n||u)){d(e.id),p(t=>({...t,[e.id]:``}));try{await te(e.missionId,e.id,n)}catch(t){p(n=>({...n,[e.id]:t.message}))}finally{d(null)}}}let S=e=>(0,x.jsxs)(`article`,{className:`p-5`,children:[n&&(0,x.jsxs)(`div`,{className:`mb-2.5 rounded-lg border border-violet-300/10 bg-violet-300/[0.03] px-3 py-2`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsxs)(`button`,{onClick:()=>{h(!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,x.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,x.jsxs)(`p`,{className:`mt-1 truncate text-[11px] text-white/40`,title:e.missionObjective,children:[(0,x.jsx)(`span`,{className:`text-white/20`,children:`Mission goal:`}),` `,e.missionObjective]})]}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h3`,{className:`text-sm font-medium leading-relaxed text-white/80 ${r?`max-h-32 overflow-y-auto whitespace-pre-wrap break-words`:``}`,children:e.question}),e.context&&(0,x.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/35`,children:e.context})]}),(0,x.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,x.jsxs)(`div`,{className:`mt-3 grid gap-2 ${r||i===`drawer`?``:`sm:grid-cols-2`}`,children:[e.recommendation&&(0,x.jsxs)(`p`,{className:`rounded-lg bg-emerald-300/[0.04] px-3 py-2 text-[11px] text-emerald-100/50`,children:[(0,x.jsx)(`span`,{className:`font-medium`,children:`Recommended:`}),` `,e.recommendation]}),e.impact&&(0,x.jsxs)(`p`,{className:`rounded-lg bg-white/[0.025] px-3 py-2 text-[11px] text-white/35`,children:[(0,x.jsx)(`span`,{className:`font-medium text-white/45`,children:`While waiting:`}),` `,e.impact]})]}),e.choices.length>0&&(0,x.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:e.choices.map((t,n)=>(0,x.jsxs)(`button`,{disabled:!!u,onClick:()=>b(e,t),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:[t,s&&e.id===y[0]?.id&&n<9&&(0,x.jsx)(`kbd`,{className:`mono rounded border border-amber-200/20 px-1 text-[9px] text-amber-100/40`,children:n+1})]},t))}),(0,x.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,x.jsx)(`input`,{value:c[e.id]??``,onChange:t=>l(n=>({...n,[e.id]:t.target.value})),onKeyDown:t=>{t.key===`Enter`&&b(e)},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,x.jsx)(`button`,{onClick:()=>b(e),disabled:!c[e.id]?.trim()||!!u,className:`cursor-pointer rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-[#291b05] disabled:opacity-35`,children:u===e.id?`Sending…`:`Answer`})]}),f[e.id]&&(0,x.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:f[e.id]})]},e.id);if(i===`drawer`){let t=y[_],n=new Set(e.map(e=>e.missionId)).size;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>h(!0),"aria-expanded":m,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,x.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,x.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,x.jsxs)(`span`,{className:`min-w-0`,children:[(0,x.jsxs)(`span`,{className:`block text-sm font-semibold text-rose-100/80`,children:[`Needs you · `,e.length,` pending`]}),(0,x.jsxs)(`span`,{className:`block truncate text-[11px] text-white/35`,children:[`Across `,n,` mission`,n===1?``:`s`,` · `,y[0].missionName,`: `,y[0].question]})]})]}),(0,x.jsx)(`span`,{className:`shrink-0 text-xs font-medium text-rose-200/55 group-hover:text-rose-100/80`,children:`Review →`})]}),m&&(0,x.jsx)(bo,{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:()=>h(!1),closeLabel:`Close pending decisions`,afterHeader:y.length>1?(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-white/[0.06] px-6 py-2.5`,children:[(0,x.jsx)(`button`,{type:`button`,disabled:_===0,onClick:()=>v(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,x.jsxs)(`span`,{className:`text-[10px] font-medium text-white/30`,children:[_+1,` of `,y.length]}),(0,x.jsx)(`button`,{type:`button`,disabled:_===y.length-1,onClick:()=>v(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:S(t)})]})}return(0,x.jsxs)(`section`,{className:`mb-8 overflow-hidden rounded-2xl border border-amber-300/15 bg-amber-300/[0.035]`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between border-b border-amber-300/10 px-5 py-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-amber-100/85`,children:`Needs you`}),(0,x.jsx)(`p`,{className:`mt-0.5 text-xs text-white/35`,children:`Answer mission and skill prompts without leaving Hive.`})]}),(0,x.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,x.jsx)(`div`,{className:`divide-y divide-amber-300/10`,children:e.map(S)})]})}function So(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 Co(e,t){let n=Nt(e);return n.find(e=>t.taskIds?.includes(e.id))??n.find(e=>en(e.workerId,t)||en(e.owner,t))??n.find(e=>e.title.toLowerCase()===t.label.toLowerCase())}function wo({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)(()=>Co(n,t),[n,t]),m=(0,g.useMemo)(()=>r.filter(e=>en(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),S=t.doneAt?`Completed`:v?`Working`:`Ended`,C=y||t.jobUpdatedAt||0,w=t.terminationReason??(t.doneAt?`Worker reported completion`:S===`Working`?`Still running`:`Parent job ended with state: ${t.jobState}`);async function T(){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 I(e,`Guidance for ${r}:\n\n${n}`),c(``)}catch(e){f(e.message)}finally{u(!1)}}return(0,x.jsx)(bo,{label:`Worker details: ${t.label}`,eyebrow:`Worker inspection`,title:t.label,subtitle:(0,x.jsxs)(`span`,{className:`mono`,children:[t.id,` · job `,t.jobId.slice(0,8)]}),onClose:i,closeLabel:`Close worker details`,children:(0,x.jsxs)(`div`,{className:`space-y-5 p-6`,children:[(0,x.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`State`,S],[`Elapsed`,So(b-t.startedAt)],[`Role`,p?.role?.replaceAll(`_`,` `)??t.kind]].map(([e,t])=>(0,x.jsxs)(`div`,{className:`rounded-xl border border-white/8 bg-white/[0.025] p-3`,children:[(0,x.jsx)(`p`,{className:`truncate text-sm font-semibold capitalize text-white/75`,title:t,children:t}),(0,x.jsx)(`p`,{className:`mt-1 text-[9px] uppercase tracking-wider text-white/25`,children:e})]},e))}),(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Assignment`}),p?(0,x.jsxs)(`div`,{className:`mt-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`text-xs font-medium text-violet-200/75`,children:p.title}),(0,x.jsx)(`span`,{className:`text-[9px] uppercase text-white/25`,children:p.status})]}),(0,x.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-white/55`,children:p.assignment??p.description??t.label}),p.context&&(0,x.jsxs)(`div`,{className:`mt-3 border-t border-white/[0.06] pt-3`,children:[(0,x.jsx)(`p`,{className:`text-[9px] uppercase tracking-wide text-white/25`,children:`Delegated context`}),(0,x.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/40`,children:p.context})]}),p.status===`blocked`&&(p.blocker||p.unblock)&&(0,x.jsxs)(`div`,{className:`mt-3 rounded-lg border border-rose-400/10 bg-rose-400/[0.04] p-2.5`,children:[(0,x.jsx)(`p`,{className:`text-xs text-rose-200/60`,children:p.blocker??`Task is blocked`}),p.unblock&&(0,x.jsxs)(`p`,{className:`mt-1 text-[10px] text-white/35`,children:[`Unblock by: `,p.unblock]})]}),p.dependsOn.length>0&&(0,x.jsxs)(`p`,{className:`mt-2 text-[10px] text-white/25`,children:[`Depends on: `,p.dependsOn.join(`, `)]})]}):(0,x.jsx)(`p`,{className:`mt-3 text-xs text-white/25`,children:`No structured plan task is linked to this worker yet.`})]}),(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Runtime`}),(0,x.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[110px_1fr] gap-y-2 text-xs`,children:[(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Started`}),(0,x.jsx)(`dd`,{className:`text-white/55`,children:new Date(t.startedAt).toLocaleString()}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Elapsed`}),(0,x.jsx)(`dd`,{className:`text-white/55`,children:So(b-t.startedAt)}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Last update`}),(0,x.jsx)(`dd`,{className:`text-white/55`,children:C?`${new Date(C).toLocaleString()} · ${So(a-C)} ago`:`Not reported`}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Latest activity`}),(0,x.jsx)(`dd`,{className:`text-white/55`,children:_?_.command??_.filePath??_.detail:`No targeted report`}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Termination`}),(0,x.jsx)(`dd`,{className:`text-white/55`,children:w}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Token usage`}),(0,x.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,x.jsxs)(`section`,{className:`rounded-xl border border-emerald-400/10 bg-emerald-400/[0.025] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-emerald-300/55`,children:`Evidence`}),(0,x.jsx)(`ul`,{className:`mt-3 space-y-2`,children:p.evidence.map((e,t)=>(0,x.jsxs)(`li`,{className:`flex gap-2 text-xs leading-relaxed text-white/55`,children:[(0,x.jsx)(`span`,{className:`text-emerald-400`,children:`✓`}),e]},t))})]}):null,(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Observed work`}),(0,x.jsx)(`span`,{className:`text-[10px] text-white/20`,children:`From attributed hooks`})]}),(0,x.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,x.jsxs)(`div`,{className:`${e===`Outputs`?`col-span-2`:``} rounded-lg border border-white/[0.06] bg-black/10 p-3`,children:[(0,x.jsxs)(`p`,{className:`text-[9px] font-medium uppercase tracking-wide text-white/25`,children:[e,` · `,t.length]}),t.length?(0,x.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:t.slice(0,6).map(e=>(0,x.jsx)(`li`,{title:e,className:`mono truncate text-[10px] text-white/50`,children:e},e))}):(0,x.jsx)(`p`,{className:`mt-2 text-[10px] text-white/18`,children:`None reported`})]},e))})]}),(0,x.jsxs)(`section`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Worker activity`}),(0,x.jsxs)(`span`,{className:`text-[10px] text-white/20`,children:[m.length,` events`]})]}),m.length?(0,x.jsx)(`div`,{className:`mt-3 space-y-2`,children:m.map((e,t)=>(0,x.jsxs)(`div`,{className:`rounded-lg border border-white/[0.06] bg-white/[0.018] p-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between text-[9px] uppercase tracking-wide text-white/25`,children:[(0,x.jsx)(`span`,{children:e.phase??e.hookEventName??`activity`}),(0,x.jsx)(`span`,{children:new Date(e.ts).toLocaleTimeString()})]}),(0,x.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/55`,children:e.detail})]},`${e.ts}:${t}`))}):(0,x.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,x.jsxs)(`section`,{className:`rounded-xl border border-violet-400/10 bg-violet-400/[0.025] p-4`,children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-violet-300/55`,children:`Guide this worker`}),(0,x.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,x.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,x.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-3`,children:[d?(0,x.jsx)(`p`,{className:`text-[10px] text-rose-400`,children:d}):(0,x.jsx)(`span`,{}),(0,x.jsx)(`button`,{onClick:T,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 To={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 Eo({alerts:e,missionName:t,onNavigate:n}){return e.length?(0,x.jsx)(`section`,{className:`mb-5 space-y-2`,"aria-label":`Mission health alerts`,children:e.map(e=>(0,x.jsxs)(`details`,{className:`rounded-xl border px-4 py-3 ${To[e.severity]}`,children:[(0,x.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:[(0,x.jsx)(`span`,{className:`mr-2 text-[9px] uppercase tracking-wider opacity-60`,children:e.severity}),t&&(0,x.jsxs)(`span`,{className:`mr-1.5 text-white/85`,children:[t,` ·`]}),e.title]}),(0,x.jsxs)(`div`,{className:`mt-2 space-y-1.5 pl-12 text-xs leading-relaxed`,children:[(0,x.jsx)(`p`,{className:`text-white/50`,children:e.explanation}),(0,x.jsxs)(`p`,{className:`text-white/30`,children:[(0,x.jsx)(`span`,{className:`font-medium text-white/40`,children:`Evidence:`}),` `,e.evidence]}),(0,x.jsxs)(`p`,{className:`text-white/40`,children:[(0,x.jsx)(`span`,{className:`font-medium text-white/50`,children:`Suggested recovery:`}),` `,e.recovery]}),n&&(0,x.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 Do({value:e,onChange:t}){return(0,x.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,x.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 Oo({onBack:e,header:t,notices:n,metrics:r,presentation:i,onPresentationChange:a,switcher:o,actions:s,children:c}){return(0,x.jsx)(`div`,{className:`min-h-screen bg-[radial-gradient(circle_at_top_left,rgba(124,58,237,0.08),transparent_35%)]`,children:(0,x.jsxs)(`div`,{className:`${Tr} py-8`,children:[(0,x.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,x.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,x.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,x.jsx)(Pe,{compact:!0}),(0,x.jsx)(`span`,{children:`← Fleet`})]}),o]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[s,(0,x.jsx)(`p`,{className:`hidden text-[10px] text-white/22 sm:block`,children:i===`room`?`Spatial mission control`:`Full operational detail`}),(0,x.jsx)(Do,{value:i===`room`?`office`:`cards`,onChange:a})]})]}),t,n,r,(0,x.jsx)(`div`,{className:`mission-presentation-enter`,children:c},i)]})})}var ko=Qt.map(e=>({name:e.name,description:e.description,source:`claude`})),Ao=typeof window>`u`?g.useEffect:g.useLayoutEffect;function jo(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}var Mo=/https?:\/\/[^\s<>"')\]]+/g,No=/\b(MR|PR)\s*[#!]\s*(\d+)\b/g;function Po(e,t){return e.find(e=>e.id===t||RegExp(`/(merge_requests|pull)/${t}$`).test(e.href))?.href}function Fo(e,t,n){return e.some(e=>e.role===`user`&&e.text===t.text&&!n.has(e.id))}function Io(e,t){return e.some(e=>e.role===`assistant`&&!t.has(e.id))}function Lo(e,t,n){if(!t.length)return[e];let r=[],i=0;for(let a of e.matchAll(No)){let o=Po(t,a[2]);o&&(a.index>i&&r.push(e.slice(i,a.index)),r.push((0,x.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 Ro({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(Mo)){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,x.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:i.map((e,t)=>typeof e==`string`?(0,x.jsx)(`span`,{children:Lo(e,n,r)},t):(0,x.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 zo({missionId:e,messages:t,hasMoreMessages:n,repository:r,provider:i=`claude`,live:a,contained:o=!1,onOpenDecisions:s}){let[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(null),[m,h]=(0,g.useState)(null),[_,v]=(0,g.useState)(!1),[y,b]=(0,g.useState)([]),[S,C]=(0,g.useState)(!!n),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)([]),O=(0,g.useRef)(null),k=(0,g.useRef)(null),j=(0,g.useRef)(new Set),M=(0,g.useRef)(new Set),N=(0,g.useRef)(!1),P=Array.isArray(t)?t:[],F=[...y,...P].filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t);(0,g.useEffect)(()=>{b([]),C(!!n),h(null),v(!1),j.current.clear(),M.current.clear(),N.current=!1},[e]),(0,g.useEffect)(()=>{D([]),A(r,i).then(({skills:e})=>D(e)).catch(()=>D([]))},[i,r]),(0,g.useEffect)(()=>{n&&C(!0)},[n]),(0,g.useEffect)(()=>{m&&Fo(F,m,j.current)&&h(null)},[F,m]),(0,g.useEffect)(()=>{if(_){if(Io(F,M.current)){v(!1),N.current=!1;return}a?.status===`working`?N.current=!0:(N.current||a?.status===`error`||a?.lifecycle===`failed`||a?.lifecycle===`paused`)&&(v(!1),N.current=!1)}},[_,F,a?.lifecycle,a?.status]);async function ee(){let t=F[0];if(!(!t||w)){T(!0),p(null);try{let n=await ue(e,{before:t.createdAt,limit:30});b(e=>[...n.messages,...e]),C(n.hasMore)}catch(e){p(e.message)}finally{T(!1)}}}async function te(){let t=c.trim();if(!t||u)return;let n=new Set(F.map(e=>e.id));j.current=n,M.current=n,N.current=a?.status===`working`,d(!0),v(!0),p(null),h({id:`pending:${Date.now()}`,role:`user`,text:t,createdAt:Date.now(),jobId:`pending`}),l(``);try{await I(e,t)}catch(e){h(null),v(!1),N.current=!1,l(t),p(e.message)}finally{d(!1)}}let L=m?[...F,m]:F,R=L.at(-1)?.id,z=a?.workers.filter(e=>!e.doneAt)??[],ne=a?.status===`working`||_,B=!ne&&a?.lifecycle===`active`&&a?.status===`waiting_on_you`,V=m?`Delivering your message…`:_&&a?.status!==`working`?`Starting response…`:a?.detail?.trim()||`Orchestrator is working…`;return Ao(()=>{let t=O.current;if(k.current!==e){k.current=e,t&&(t.scrollTop=t.scrollHeight);return}t&&R&&t.scrollTo({top:t.scrollHeight,behavior:`smooth`})},[e,R,ne,B]),(0,x.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-white/10 bg-[#101014] ${o?`xl:flex xl:min-h-0 xl:flex-1 xl:flex-col`:``}`,children:[!o&&(0,x.jsx)(`div`,{className:`border-b border-white/8 px-5 py-3.5`,children:(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Conversation`}),(0,x.jsx)(`p`,{className:`mt-0.5 text-xs text-white/35`,children:`Context carries forward across every follow-up`})]})}),(0,x.jsxs)(`div`,{ref:O,className:`min-h-48 space-y-4 overflow-y-auto px-5 py-5 ${o?`max-h-[460px] xl:min-h-0 xl:max-h-none xl:flex-1`:`max-h-[460px]`}`,children:[S&&(0,x.jsx)(`div`,{className:`text-center`,children:(0,x.jsx)(`button`,{onClick:ee,disabled:w,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:w?`Loading…`:`Load older messages`})}),L.length===0&&(0,x.jsx)(`p`,{className:`py-12 text-center text-sm text-white/30`,children:`Send a message to continue this mission.`}),L.map(e=>e.kind===`update`?(0,x.jsx)(`div`,{className:`flex justify-start`,children:(0,x.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,x.jsx)(Ro,{text:e.text,role:e.role,prs:a?.prs})})},e.id):(0,x.jsx)(`div`,{className:`flex ${e.role===`user`?`justify-end`:`justify-start`}`,children:(0,x.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.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.jobId===`pending`?`opacity-70`:``}`,children:[(0,x.jsx)(Ro,{text:e.text,role:e.role,prs:a?.prs}),(0,x.jsx)(`p`,{className:`mt-1.5 text-[10px] ${e.role===`user`?`text-white/55`:`text-white/25`}`,children:e.jobId===`pending`?`Sending…`:jo(e.createdAt)})]})},e.id)),ne&&(0,x.jsx)(`div`,{className:`flex justify-start`,children:(0,x.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,x.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,x.jsx)(`span`,{className:`flex gap-1`,children:[0,1,2].map(e=>(0,x.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-violet-300/80`,style:{animationDelay:`${e*.18}s`}},e))}),(0,x.jsx)(`span`,{className:`text-xs text-violet-200/75`,children:V})]}),(z.length>0||(a?.inFlight.tasks??0)>0)&&(0,x.jsx)(`p`,{className:`mt-1.5 text-[11px] text-white/35`,children:z.length>0?`${z.length} worker${z.length===1?``:`s`} running: ${z.slice(0,3).map(e=>e.label).join(`, `)}${z.length>3?`…`:``}`:`${a.inFlight.tasks} task${a.inFlight.tasks===1?``:`s`} in flight${a.inFlight.queued?`, ${a.inFlight.queued} queued`:``}`})]})}),B&&(0,x.jsx)(`div`,{className:`flex justify-center`,children:a?.lifecycle===`ready_for_review`?(0,x.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,x.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-300/80`}),`Work complete — awaiting your acceptance`]}):s?(0,x.jsxs)(`button`,{type:`button`,onClick:s,className:`inline-flex cursor-pointer items-center gap-1.5 rounded-full border border-amber-300/20 bg-amber-300/[0.06] px-3 py-1 text-[11px] text-amber-200/70 transition hover:border-amber-300/40 hover:bg-amber-300/10`,children:[(0,x.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-amber-300/80`}),`Needs you — open pending decisions ↗`]}):(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-amber-300/20 bg-amber-300/[0.06] px-3 py-1 text-[11px] text-amber-200/70`,children:[(0,x.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-amber-300/80`}),`Needs you — waiting on your reply`]})})]}),(0,x.jsxs)(`div`,{className:`border-t border-white/8 p-3`,children:[(0,x.jsxs)(`div`,{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,x.jsx)(be,{value:c,onChange:l,skills:i===`claude`?[...ko,...E]:E,onSubmit:te,rows:2,marker:`data-mission-composer`,placeholder:a?.lifecycle===`ready_for_review`?`Say what should change, or just ask a question…`:`Ask a follow-up, request a change, or type / for skills…`,className:`min-h-12 flex-1`}),(0,x.jsx)(`button`,{onClick:te,disabled:u||!c.trim(),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:u?`Sending…`:`Send`})]}),f&&(0,x.jsx)(`p`,{className:`mt-2 px-2 text-xs text-rose-400`,children:f})]})]})}function Bo({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 de(e))}catch(e){c(e.message)}finally{o(!1)}}}async function m(){f(!0),c(void 0);try{await fe(e),u(!1),i(void 0)}catch(e){c(e.message)}finally{f(!1)}}return(0,x.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,x.jsxs)(`button`,{onClick:p,className:`flex w-full items-center justify-between text-left`,children:[(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`block text-sm font-semibold text-white/65`,children:`Manager handoff context`}),(0,x.jsx)(`span`,{className:`mt-0.5 block text-xs text-white/30`,children:`Preview the bounded history a replacement manager receives`})]}),(0,x.jsx)(`span`,{className:`text-xs text-white/25`,children:t?`−`:`+`})]}),t&&(0,x.jsxs)(`div`,{className:`mt-3 border-t border-white/[0.06] pt-3`,children:[a&&(0,x.jsx)(`p`,{className:`text-xs text-white/25`,children:`Building preview…`}),s&&(0,x.jsx)(`p`,{className:`text-xs text-rose-400`,children:s}),r&&(0,x.jsxs)(`div`,{className:`space-y-3`,children:[(0,x.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,x.jsxs)(`div`,{className:`rounded-lg bg-white/[0.025] p-2`,children:[(0,x.jsxs)(`p`,{className:`text-xs font-medium text-white/55`,children:[`~`,t,` / `,n]}),(0,x.jsxs)(`p`,{className:`mt-0.5 text-[8px] uppercase tracking-wider text-white/20`,children:[e,` tokens`]})]},e))}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/20`,children:`Compact mission state`}),(0,x.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,x.jsxs)(`div`,{children:[(0,x.jsxs)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/20`,children:[`Recent messages · `,r.recentMessages.length]}),(0,x.jsx)(`ul`,{className:`mt-1 space-y-1`,children:r.recentMessages.map(e=>(0,x.jsxs)(`li`,{className:`line-clamp-2 text-[10px] text-white/30`,children:[(0,x.jsxs)(`span`,{className:`text-white/18`,children:[e.role,`:`]}),` `,e.text]},e.id))})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/20`,children:[`Relevant older messages · `,r.retrievedMessages.length]}),r.retrievedMessages.length?(0,x.jsx)(`ul`,{className:`mt-1 space-y-1`,children:r.retrievedMessages.map(e=>(0,x.jsxs)(`li`,{className:`line-clamp-2 text-[10px] text-white/30`,children:[(0,x.jsxs)(`span`,{className:`text-white/18`,children:[e.role,`:`]}),` `,e.text]},e.id))}):(0,x.jsx)(`p`,{className:`mt-1 text-[10px] text-white/20`,children:`No older messages were relevant enough to include.`})]}),(0,x.jsx)(`div`,{className:`border-t border-white/[0.06] pt-3`,children:l?(0,x.jsxs)(`div`,{className:`rounded-lg border border-amber-300/10 bg-amber-300/[0.035] p-2.5`,children:[(0,x.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,x.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{onClick:()=>u(!1),className:`px-2 py-1 text-[10px] text-white/35`,children:`Cancel`}),(0,x.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,x.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 Vo({jobs:e}){return e?.length?(0,x.jsxs)(`details`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,x.jsxs)(`summary`,{className:`flex items-center justify-between text-sm font-semibold text-white/65`,children:[(0,x.jsx)(`span`,{children:`Claude job history`}),(0,x.jsxs)(`span`,{className:`font-normal text-[10px] text-white/25`,children:[e.length,` turn`,e.length===1?``:`s`]})]}),(0,x.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,x.jsx)(`ol`,{className:`mt-3 space-y-2 border-l border-white/[0.07] pl-3`,children:e.map((e,t)=>(0,x.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,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsxs)(`span`,{className:`font-mono text-[10px] text-white/50`,children:[t+1,`. `,e.jobId.slice(0,12)]}),(0,x.jsx)(`span`,{className:`text-[9px] uppercase text-white/25`,children:e.state})]}),(0,x.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[9px] text-white/22`,children:[e.createdAt&&(0,x.jsx)(`span`,{children:new Date(e.createdAt).toLocaleString()}),(0,x.jsxs)(`span`,{children:[e.tokens.toLocaleString(),` tokens`]}),e.sessionId&&(0,x.jsxs)(`span`,{className:`font-mono`,children:[`session `,e.sessionId.slice(0,8)]}),e.resumedFrom&&(0,x.jsxs)(`span`,{className:`font-mono text-violet-300/35`,children:[`resumed `,e.resumedFrom.slice(0,8)]})]})]},e.jobId))})]}):null}function Ho({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,x.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Permission policy`}),(0,x.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 ge(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,x.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Permission policy`}),(0,x.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,x.jsxs)(`div`,{className:`mt-4`,children:[(0,x.jsx)(Se,{value:n,onChange:r}),o&&(0,x.jsx)(`p`,{className:`mt-2 text-xs text-rose-300`,children:o}),(0,x.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,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:l.map(([e,t])=>(0,x.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,x.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 Uo({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 me(e,a,s.trim()),f(!0),i(!1)}catch(e){u(e.message)}finally{n(!1)}}}return(0,x.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Mission report`}),(0,x.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,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,x.jsx)(`a`,{href:pe(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,x.jsx)(`a`,{href:pe(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,x.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,x.jsxs)(`div`,{className:`mt-3 rounded-xl border border-amber-300/10 bg-amber-300/[0.025] p-3`,children:[(0,x.jsxs)(`p`,{className:`text-[10px] leading-relaxed text-amber-100/50`,children:[`This is externally visible. Hive will use your locally authenticated `,(0,x.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI and record both approval and outcome in the mission timeline.`]}),(0,x.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,x.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,x.jsx)(`option`,{value:`pr`,children:`Pull request`}),(0,x.jsx)(`option`,{value:`issue`,children:`Issue`})]}),(0,x.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,x.jsx)(`button`,{onClick:()=>i(!1),className:`px-2 text-xs text-white/30`,children:`Cancel`}),(0,x.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,x.jsxs)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:[`Publish failed: `,l,`. Verify `,(0,x.jsx)(`span`,{className:`font-mono`,children:`gh auth status`}),`, the target, and repository access, then retry.`]}),d&&(0,x.jsx)(`p`,{className:`mt-2 text-[10px] text-emerald-300/60`,children:`Report published and recorded in the mission timeline.`})]})}var Wo=`Mission diagnostics`;function Go({node:e}){let[t,n]=(0,g.useState)(()=>ot(Wo,!0));return(0,x.jsxs)(`section`,{id:`mission-diagnostics`,className:`mt-5 scroll-mt-24`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>{let e=!t;n(e),dt(Wo,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,x.jsx)(`span`,{className:`text-[10px] text-white/25 transition-transform ${t?``:`rotate-90`}`,children:`▶`}),(0,x.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-white/35`,children:`Diagnostics`}),(0,x.jsx)(`span`,{className:`text-[10px] text-white/20`,children:`identity · policy · job history · exports`})]}),!t&&(0,x.jsxs)(`div`,{className:`mt-4 grid items-start gap-5 xl:grid-cols-2`,children:[(0,x.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,x.jsxs)(`section`,{className:`rounded-2xl border border-white/[0.08] bg-[#101014] p-4`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Runtime identity`}),(0,x.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,x.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[110px_1fr] gap-y-2 text-xs`,children:[(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Mission ID`}),(0,x.jsx)(`dd`,{className:`mono text-white/50`,children:e.missionId}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Current job`}),(0,x.jsx)(`dd`,{className:`mono text-white/50`,children:e.jobId}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Process ID`}),(0,x.jsx)(`dd`,{className:`mono text-white/50`,children:e.pid>=0?e.pid:`not running`}),(0,x.jsx)(`dt`,{className:`text-white/25`,children:`Job turns`}),(0,x.jsx)(`dd`,{className:`text-white/50`,children:e.jobIds.length})]})]}),(0,x.jsx)(Ho,{missionId:e.missionId,initial:e.mission.policy}),(0,x.jsx)(Vo,{jobs:e.jobHistory})]}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,x.jsx)(Bo,{missionId:e.missionId}),(0,x.jsx)(Uo,{missionId:e.missionId})]})]})]})}function Ko(e){let t=Math.max(0,Math.round(e/6e4));return t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function qo({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=Nt(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,x.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`&&en(e.targetWorker,t))}))],o=r?`grid-cols-[90px_minmax(0,1fr)]`:`grid-cols-[150px_1fr]`;return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`mb-3 flex flex-wrap gap-3 text-[9px] text-white/25`,children:[(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`text-amber-300`,children:`━`}),` critical path worker`]}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`text-rose-300`,children:`▧`}),` blocked/bottleneck`]}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`text-white/20`,children:`▧`}),` idle gap ≥5m`]})]}),(0,x.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-white/[0.06] bg-black/15`,children:(0,x.jsxs)(`div`,{className:r?`min-w-0`:`min-w-[680px]`,children:[(0,x.jsxs)(`div`,{className:`grid ${o} border-b border-white/[0.06] px-3 py-2 text-[9px] text-white/20`,children:[(0,x.jsx)(`span`,{children:`Lane`}),(0,x.jsxs)(`div`,{className:`flex justify-between`,children:[(0,x.jsx)(`span`,{children:new Date(i.start).toLocaleTimeString()}),(0,x.jsx)(`span`,{children:Ko(i.span)}),(0,x.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=>en(e,t)):!1,a=t?.jobState===`blocked`||e.events.some(e=>e.outcome===`failure`);return(0,x.jsxs)(`div`,{className:`grid min-h-12 ${o} border-b border-white/[0.04] px-3 last:border-0`,children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 items-center pr-3`,children:[(0,x.jsx)(`span`,{className:`truncate text-[10px] text-white/45`,title:e.label,children:e.label}),r&&(0,x.jsx)(`span`,{className:`ml-1 text-amber-300`,children:`◆`})]}),(0,x.jsxs)(`div`,{className:`relative my-2 overflow-hidden rounded bg-white/[0.015]`,children:[i.gaps.map((e,t)=>(0,x.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 ${Ko(e.end-e.start)}`},t)),t&&(0,x.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}: ${Ko(n-t.startedAt)}`}),e.events.map((e,t)=>(0,x.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 Jo(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 Yo(e){return e.doneAt?`complete`:e.jobState===`working`||e.jobState===`busy`?`working`:`ended`}function Xo({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,x.jsxs)(`div`,{className:`rounded-xl border border-dashed border-white/10 py-10 text-center`,children:[(0,x.jsx)(`p`,{className:`text-sm text-white/35`,children:`No workers have been delegated yet.`}),(0,x.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=>Yo(e)===`working`).length,n=e.filter(e=>Yo(e)===`complete`).length;return(0,x.jsxs)(`div`,{className:`mt-4 flex items-center gap-3 text-xs text-white/40`,children:[(0,x.jsxs)(`span`,{children:[e.length,` worker`,e.length===1?``:`s`]}),t>0&&(0,x.jsxs)(`span`,{className:`text-amber-300`,children:[`● `,t,` active`]}),n>0&&(0,x.jsxs)(`span`,{className:`text-emerald-300`,children:[`✓ `,n,` done`]})]})}return(0,x.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let t=Yo(e),a=e.doneAt??(t===`working`?i:e.jobUpdatedAt??i),o=Math.max(e.updatedAt??0,e.jobUpdatedAt??0);return(0,x.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,x.jsxs)(`div`,{className:`flex gap-3 ${n?`flex-col`:`items-start justify-between gap-4`}`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.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,x.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,x.jsxs)(`div`,{className:`ml-4 mt-1.5 flex flex-wrap items-center gap-2 text-[11px] text-white/30`,children:[(0,x.jsx)(`span`,{className:`rounded bg-white/5 px-1.5 py-0.5 uppercase tracking-wide`,children:e.kind}),(0,x.jsx)(`span`,{className:`mono`,children:e.id.slice(0,8)}),e.tokens!==void 0&&(0,x.jsxs)(`span`,{children:[e.tokens.toLocaleString(),` tokens`]}),o>0&&(0,x.jsxs)(`span`,{title:new Date(o).toLocaleString(),children:[`updated `,Jo(i-o),` ago`]})]})]}),(0,x.jsxs)(`div`,{className:`shrink-0 ${n?`ml-4 flex items-center gap-2 text-left`:`text-right`}`,children:[(0,x.jsx)(`p`,{className:`text-xs font-medium capitalize ${t===`working`?`text-amber-300`:t===`complete`?`text-emerald-300`:`text-white/35`}`,children:t}),(0,x.jsx)(`p`,{className:`mono mt-1 text-[11px] text-white/30`,children:Jo(a-e.startedAt)})]})]})},`${e.jobId}:${e.id}`)})})}function Zo({title:e,subtitle:t,right:n,children:r}){return(0,x.jsxs)(`section`,{className:`rounded-2xl border border-white/[0.08] bg-[#101014] p-4`,children:[(0,x.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h2`,{className:`text-xs font-semibold text-white/80`,children:e}),t&&(0,x.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-white/25`,children:t})]}),n]}),r]})}function Qo({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,x.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,x.jsx)(Bn,{prs:e.prs,messages:e.messages}),e.workers.length>0&&(0,x.jsxs)(Zo,{title:`Workers`,subtitle:`Delegated tasks and runtime`,right:a>0?(0,x.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,x.jsx)(Xo,{workers:e.workers,narrow:!0,onSelect:n}),o&&(0,x.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,x.jsxs)(`span`,{children:[e.inFlight.tasks,` in flight`]}),(0,x.jsxs)(`span`,{children:[e.inFlight.queued,` queued`]})]})]}),e.detail&&(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] px-4 py-3`,children:[(0,x.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/25`,children:`Latest runtime note`}),(0,x.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-white/45`,children:e.detail})]}),(0,x.jsx)(Zo,{title:`Activity`,subtitle:`Transitions, tools, workers, and gaps`,right:(0,x.jsx)(`div`,{className:`inline-flex shrink-0 rounded-lg border border-white/[0.06] bg-black/15 p-0.5`,children:[`feed`,`parallel`].map(e=>(0,x.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},e))}),children:r===`feed`?(0,x.jsx)(yr,{events:t,compact:!0}):(0,x.jsx)(qo,{events:t,workers:e.workers,plan:e.plan})})]})}var $o=/(?:^|\s)\/([\w:-]+)/g;function es(e){return e?[...e.matchAll($o)].map(e=>e[1]):[]}function ts({messages:e,plan:t}){let n=[...new Map(e.flatMap(e=>es(e.text).map(t=>[`${e.role}:${t}`,{skill:t,role:e.role}]))).values()],r=Nt(t).flatMap(e=>[...new Set([...es(e.assignment),...es(e.context),...es(e.description)])].map(t=>({skill:t,task:e.title,worker:e.owner??e.workerId})));return!n.length&&!r.length?null:(0,x.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,x.jsxs)(`div`,{className:`mb-3`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Skills`}),(0,x.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Explicit slash skills observed in requests and assignments`})]}),n.length>0&&(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[9px] font-medium uppercase tracking-wider text-white/20`,children:`Invoked in conversation`}),(0,x.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:n.map(e=>(0,x.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,x.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,x.jsxs)(`div`,{className:n.length?`mt-3`:``,children:[(0,x.jsx)(`p`,{className:`text-[9px] font-medium uppercase tracking-wider text-white/20`,children:`Assigned to workers`}),(0,x.jsx)(`ul`,{className:`mt-1.5 space-y-1.5`,children:r.map((e,t)=>(0,x.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md bg-white/[0.02] px-2 py-1.5 text-[10px]`,children:[(0,x.jsxs)(`span`,{className:`font-mono text-violet-200/55`,children:[`/`,e.skill]}),(0,x.jsx)(`span`,{className:`truncate text-white/35`,children:e.task}),e.worker&&(0,x.jsx)(`span`,{className:`ml-auto shrink-0 text-amber-200/35`,children:e.worker})]},`${e.skill}:${e.task}:${t}`))})]})]})}function ns(e){return e>=100?`bg-rose-400`:e>=80?`bg-amber-400`:`bg-emerald-400`}function rs(e){return e<60?`${Math.round(e)}m`:`${Math.floor(e/60)}h ${Math.round(e%60)}m`}function is({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:`${rs(r/6e4)} / ${rs(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,x.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,x.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Mission budgets`}),(0,x.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,x.jsx)(`span`,{className:`rounded-full bg-rose-400/10 px-2 py-1 text-[9px] uppercase text-rose-200/65`,children:`Limit reached`})]}),(0,x.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>{let t=Math.round(e.used/e.limit*100);return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`mb-1 flex justify-between text-[10px]`,children:[(0,x.jsx)(`span`,{className:`text-white/35`,children:e.label}),(0,x.jsxs)(`span`,{className:t>=100?`text-rose-300/70`:`text-white/45`,children:[e.display,` · `,t,`%`]})]}),(0,x.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,x.jsx)(`div`,{className:`h-full rounded-full ${ns(t)}`,style:{width:`${Math.min(100,t)}%`}})})]},e.label)})}),s!==void 0&&(0,x.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 `,rs(s),` remaining.`]})]})}function as({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,x.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,x.jsx)(`span`,{className:`min-w-0 break-all`,children:n??e}),(0,x.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 os({label:e,children:t}){return(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/22`,children:e}),(0,x.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-white/55`,children:t})]})}function ss({node:e,defaultModelLabel:t,elapsedMs:n}){let{mission:r}=e,i=r.acceptanceCriteria??[];return(0,x.jsxs)(`aside`,{className:`flex flex-col gap-4`,children:[(0,x.jsx)(`section`,{className:`rounded-2xl border border-white/[0.08] bg-[#101014] p-4`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,x.jsx)(os,{label:`Objective`,children:(0,x.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:r.objective})}),i.length>0&&(0,x.jsx)(os,{label:`Acceptance criteria · ${i.length}`,children:(0,x.jsx)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:i.map((e,t)=>(0,x.jsxs)(`li`,{className:`flex gap-2`,children:[(0,x.jsx)(`span`,{className:`mono shrink-0 text-white/20`,children:t+1}),(0,x.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]},`${t}:${e}`))})})]})}),(0,x.jsx)(`section`,{className:`rounded-2xl border border-white/[0.08] bg-[#101014] p-4`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r.repository&&(0,x.jsxs)(os,{label:`Repository`,children:[(0,x.jsx)(as,{value:r.repository,label:`repository path`,display:ze(r.repository),className:`mono`}),r.additionalRepositories?.map(e=>(0,x.jsx)(as,{value:e,label:`path for ${ze(e)}`,display:`+ ${ze(e)}`,className:`mono mt-1 flex text-sky-200/50`},e))]}),e.worktreeBranch&&(0,x.jsx)(os,{label:`Branch`,children:(0,x.jsx)(as,{value:e.worktreeBranch,label:`branch name`,display:Be(e.worktreeBranch),className:`mono text-violet-300/60`})}),(0,x.jsx)(os,{label:`Mission ID`,children:(0,x.jsx)(as,{value:e.missionId,label:`mission id`,className:`mono text-white/40`})}),(0,x.jsxs)(os,{label:`Agent`,children:[(0,x.jsx)(`span`,{className:`capitalize`,children:r.provider??`claude`}),(0,x.jsx)(`span`,{className:`mono mt-1 block text-white/40`,children:r.model??(t?`CLI default (${t})`:`CLI default`)}),(0,x.jsxs)(`span`,{className:`mt-1 block capitalize text-white/35`,children:[r.mode,r.planFirst?` · plan first`:``]})]}),r.template&&(0,x.jsx)(os,{label:`Template`,children:(0,x.jsxs)(`span`,{className:`text-amber-200/50`,children:[r.template.name,` v`,r.template.version,` · `,r.template.source]})})]})}),(0,x.jsx)(is,{budgets:r.budgets,tokens:e.tokens,workers:e.workers,elapsedMs:n})]})}var cs={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 ls({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 re(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 ie(e,{...f,label:f.label.trim()}):await ae(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 oe(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,x.jsxs)(`div`,{className:`rounded-lg border border-amber-300/10 bg-amber-300/[0.025] p-3`,children:[(0,x.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_140px]`,children:[(0,x.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,x.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,x.jsx)(`option`,{value:e,children:e.replaceAll(`_`,` `)},e))})]}),(0,x.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center gap-2 text-[10px] text-white/35`,children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:f.required,onChange:e=>p({...f,required:e.target.checked})}),`Required before mission completion`]}),(0,x.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{onClick:()=>d(null),className:`px-2 py-1 text-[10px] text-white/30`,children:`Cancel`}),(0,x.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,x.jsxs)(`div`,{className:`border-t border-white/[0.06] px-5 py-4`,children:[(0,x.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Completion gates`}),(0,x.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,x.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,x.jsxs)(`span`,{className:`text-[10px] text-white/25`,children:[t.filter(e=>e.status===`satisfied`||e.status===`waived`).length,`/`,t.length,` resolved`]}),(0,x.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,x.jsx)(`div`,{className:`mb-2`,children:y}),!t.length&&u!==`new`&&(0,x.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,x.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>u===e.id?(0,x.jsx)(`div`,{children:y},e.id):(0,x.jsxs)(`div`,{className:`rounded-lg border border-white/[0.06] bg-black/10 px-3 py-2.5`,children:[(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsx)(`p`,{className:`text-xs font-medium text-white/65`,children:e.label}),e.required&&(0,x.jsx)(`span`,{className:`text-[8px] uppercase tracking-wider text-white/20`,children:`required`}),(0,x.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,x.jsx)(`p`,{className:`mt-1 text-[9px] uppercase tracking-wide text-white/22`,children:e.type.replaceAll(`_`,` `)})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,x.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[9px] font-medium uppercase ${cs[e.status]}`,children:e.status}),e.source===`user`&&(0,x.jsxs)(x.Fragment,{children:[(0,x.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,x.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,x.jsx)(`ul`,{className:`mt-2 space-y-1 border-t border-white/[0.05] pt-2`,children:e.evidence.map((e,t)=>(0,x.jsxs)(`li`,{className:`text-[10px] text-emerald-100/40`,children:[`✓ `,e]},t))}),e.waiver&&(0,x.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,x.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,x.jsx)(`div`,{className:`mt-2`,children:(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[(0,x.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,x.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,x.jsx)(`button`,{onClick:()=>{r(null),a(``)},className:`text-[10px] text-white/25`,children:`Cancel`})]})}):(0,x.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,x.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:c})]})}function us(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`}],...jt(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}: ${At(r.status).toLowerCase()} → ${At(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 ds({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 se(e)).revisions)}catch(e){s(e.message)}finally{l(!1)}}}return(0,x.jsxs)(`div`,{children:[(0,x.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,x.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,x.jsx)(`p`,{className:`text-xs text-white/25`,children:`Loading revisions…`}),o&&(0,x.jsx)(`p`,{className:`text-xs text-rose-400`,children:o}),i.map((e,t)=>(0,x.jsxs)(`div`,{className:`rounded-lg border border-white/[0.05] bg-white/[0.018] p-3`,children:[(0,x.jsxs)(`div`,{className:`flex justify-between text-[10px]`,children:[(0,x.jsxs)(`span`,{className:`font-medium text-white/50`,children:[`Revision `,e.revision]}),(0,x.jsx)(`span`,{className:`text-white/20`,children:new Date(e.updatedAt).toLocaleString()})]}),(0,x.jsx)(`ul`,{className:`mt-2 space-y-1`,children:us(e,i[t+1]).map((e,t)=>(0,x.jsxs)(`li`,{className:`text-[10px] leading-relaxed text-white/35`,children:[`• `,e]},t))})]},e.revision))]})]})}function fs({missionId:e,plan:t,required:n=!1}){let r=t.approvalStatus??`proposed`,i=Ge(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 ce(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,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,x.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,x.jsxs)(x.Fragment,{children:[(0,x.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,x.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,x.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,x.jsx)(`span`,{className:`text-[10px] text-white/30`,children:t.approvalReason}),a&&(0,x.jsxs)(`div`,{className:`flex w-full gap-2`,children:[(0,x.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,x.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,x.jsx)(`p`,{className:`w-full text-[10px] text-rose-400`,children:d})]})}function ps({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 H(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,x.jsxs)(`div`,{className:`relative ml-auto`,children:[(0,x.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,x.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,x.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,x.jsxs)(`div`,{className:`p-2`,children:[(0,x.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,x.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,x.jsx)(`option`,{value:`high`,children:`High`}),(0,x.jsx)(`option`,{value:`normal`,children:`Normal`}),(0,x.jsx)(`option`,{value:`low`,children:`Low`})]}):(0,x.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,x.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{onClick:()=>{a(null),s(``)},className:`text-[10px] text-white/30`,children:`Back`}),(0,x.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,x.jsx)(`p`,{className:`px-3 py-2 text-[10px] text-rose-400`,children:u})]})]})}function ms({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 le(e,r),n(!1),i(``)}catch(e){c(e.message)}finally{o(!1)}}}return(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.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,x.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,x.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,x.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{onClick:()=>n(!1),className:`text-[10px] text-white/30`,children:`Cancel`}),(0,x.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,x.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:s})]})]})}var hs={queued:`#64748b`,working:`#fbbf24`,blocked:`#fb7185`,reviewing:`#a78bfa`,completed:`#34d399`,failed:`#ef4444`,cancelled:`#475569`};function gs(e){return e.phases.flatMap(e=>jt(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 _s({plan:e}){let t=(0,g.useMemo)(()=>gs(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,x.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,x.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-3 text-[9px] text-white/25`,children:[(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`text-amber-300`,children:`━`}),` critical path`]}),(0,x.jsx)(`span`,{children:`Click a task for details`})]}),(0,x.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-white/[0.06] bg-black/15`,children:(0,x.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,x.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,x.jsxs)(`g`,{transform:`translate(${t.x} ${t.y})`,onClick:()=>r(e.id),className:`cursor-pointer`,children:[(0,x.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,x.jsx)(`circle`,{cx:`12`,cy:`16`,r:`3`,fill:hs[e.status]}),(0,x.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,x.jsxs)(`text`,{x:`12`,y:`39`,fill:`rgba(255,255,255,.25)`,fontSize:`9`,children:[e.worker?`${e.worker} · `:``,At(e.status).toLowerCase()]})]},e.id)})]})}),a&&(0,x.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,x.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,x.jsx)(`p`,{className:`px-5 py-8 text-center text-xs text-white/25`,children:`Add tasks to see their dependency graph.`})}var vs={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`},ys={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 bs({status:e}){return(0,x.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-white/35`,children:[(0,x.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${vs[e]}`}),At(e)]})}function xs(e){let t=Mt(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 Ss(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 Cs(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 ws(e,t){return t.get(e)?.title??e}function Ts({id:e,lookup:t,indexById:n}){let r=t.get(e),i=r?.status===`completed`||r?.status===`cancelled`,a=n.get(e);return(0,x.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 Es({missionId:e,task:t,lookup:n,indexById:r,compact:i=!1}){let a=Ss(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,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`rounded-lg border border-l-2 px-3 py-2.5 ${ys[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,x.jsxs)(`div`,{className:`flex gap-3 ${i?`flex-col`:`items-start justify-between`}`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsxs)(`p`,{className:`text-xs font-medium ${t.status===`completed`?`text-white/35 line-through`:`text-white/70`}`,children:[(0,x.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,x.jsxs)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-white/32`,children:[(0,x.jsx)(`span`,{className:`text-white/20`,children:`Deliverable:`}),` `,s]})]}),(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,x.jsx)(bs,{status:t.status}),(0,x.jsx)(ps,{missionId:e,task:t})]})]}),(0,x.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,x.jsxs)(`span`,{className:`text-violet-200/55`,children:[`Owner: `,t.owner??t.workerId]}):(0,x.jsx)(`span`,{children:`Unassigned`}),t.dependsOn.length>0&&(0,x.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,x.jsx)(Ts,{id:e,lookup:n,indexById:r},e))]}),o.length>0&&(0,x.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1`,children:[`Unblocks →`,o.map(e=>(0,x.jsx)(Ts,{id:e.id,lookup:n,indexById:r},e.id))]}),t.updatedAt&&(0,x.jsxs)(`span`,{children:[`Updated `,Cs(t.updatedAt)]})]}),t.status===`blocked`&&(0,x.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,x.jsx)(`p`,{className:`text-rose-200/65`,children:t.blocker??`This task is blocked.`}),t.unblock&&(0,x.jsxs)(`p`,{className:`mt-1 text-white/35`,children:[`To unblock: `,t.unblock]})]}),l&&(0,x.jsxs)(`details`,{className:`mt-2 border-t border-white/[0.05] pt-2`,children:[(0,x.jsx)(`summary`,{className:`cursor-pointer select-none text-[10px] text-white/25 transition hover:text-white/50`,children:`Operational details`}),(0,x.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[9px] text-white/28`,children:[t.role&&(0,x.jsxs)(`span`,{children:[`Role: `,t.role.replaceAll(`_`,` `)]}),a&&(0,x.jsxs)(`span`,{children:[`Duration: `,a]}),t.branch&&(0,x.jsxs)(`span`,{className:`mono`,children:[`Branch: `,t.branch]}),t.worktree&&(0,x.jsxs)(`span`,{className:`mono truncate`,title:t.worktree,children:[`Worktree: `,t.worktree]}),t.testState&&(0,x.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,x.jsx)(`div`,{className:`mono mt-2 flex flex-wrap gap-1`,children:t.changedFiles.map(e=>(0,x.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,x.jsx)(`ul`,{className:`mt-2 space-y-1`,children:t.evidence.map((e,t)=>(0,x.jsxs)(`li`,{className:`text-[10px] text-emerald-100/45`,children:[`✓ `,e]},t))})]})]}),t.subtasks?.length?(0,x.jsx)(`div`,{className:`ml-4 mt-1 space-y-1 border-l border-white/[0.07] pl-3`,children:t.subtasks.map(t=>(0,x.jsx)(Es,{missionId:e,task:t,lookup:n,indexById:r,compact:i},t.id))}):null]})}function Ds({title:e,tone:t,empty:n,tasks:r,lookup:i}){return(0,x.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,x.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.16em]`,children:e}),r.length?(0,x.jsx)(`ul`,{className:`mt-2 space-y-2`,children:r.slice(0,3).map(e=>(0,x.jsxs)(`li`,{className:`text-[11px] leading-snug text-white/60`,children:[(0,x.jsx)(`span`,{className:`font-medium text-white/75`,children:e.title}),(e.owner||e.workerId)&&(0,x.jsx)(`span`,{className:`block text-[9px] text-white/28`,children:e.owner??e.workerId}),t===`rose`&&(0,x.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=>ws(e,i)).join(`, `)}`:`Needs intervention`)})]},e.id))}):(0,x.jsx)(`p`,{className:`mt-2 text-[10px] text-white/25`,children:n}),r.length>3&&(0,x.jsxs)(`p`,{className:`mt-2 text-[9px] text-white/20`,children:[`+`,r.length-3,` more`]})]})}function Os({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)(()=>Nt(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,x.jsxs)(`section`,{className:`mb-6 overflow-hidden rounded-2xl border border-dashed border-white/10 bg-white/[0.018]`,children:[(0,x.jsx)(`div`,{className:`px-5 py-5`,children:(0,x.jsxs)(`div`,{className:`flex gap-4 ${o?`flex-col items-start`:`items-center justify-between`}`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white/75`,children:`Mission plan`}),(0,x.jsx)(`p`,{className:`mt-1 text-xs text-white/30`,children:`Waiting for the orchestrator to publish a structured plan.`}),n&&(0,x.jsxs)(`p`,{className:`mt-3 text-sm leading-relaxed text-white/55`,children:[(0,x.jsx)(`span`,{className:`text-white/25`,children:`Goal:`}),` `,n]})]}),(0,x.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,x.jsx)(ls,{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`),S=t.phases.filter(e=>e.status===`completed`).length,C=(t.gates??[]).filter(e=>e.status===`satisfied`||e.status===`waived`).length,w=i.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)),T=v.flatMap(e=>[e.workerId,e.owner,e.id].filter(Boolean)),E=w.filter(e=>!T.some(t=>en(t,e))&&!T.includes(e.jobId)),D=w.length>0&&a&&a>t.updatedAt+3e5,O=E.length>0?`${E.length} active worker${E.length===1?` is`:`s are`} doing work this plan does not describe.`:D?`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,x.jsxs)(`section`,{className:`mb-6 overflow-hidden rounded-2xl border border-white/10 bg-[#101014]`,children:[(0,x.jsxs)(`div`,{className:`border-b border-white/8 px-5 py-4`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Plan at a glance`}),(0,x.jsx)(ds,{missionId:e,currentRevision:t.revision}),(0,x.jsx)(ms,{missionId:e})]}),(0,x.jsxs)(`p`,{className:`mt-3 max-w-4xl text-sm leading-relaxed text-white/65`,children:[(0,x.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,x.jsx)(fs,{missionId:e,plan:t,required:s})]}),(0,x.jsxs)(`div`,{className:`shrink-0 text-right`,children:[(0,x.jsxs)(`p`,{className:`text-2xl font-semibold text-amber-300`,children:[t.progress.percent??`—`,t.progress.percent!==void 0&&`%`]}),(0,x.jsx)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/25`,children:`weighted progress`})]})]}),(0,x.jsx)(`div`,{className:`mt-4 h-1.5 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,x.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,x.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-white/30`,children:[(0,x.jsxs)(`span`,{children:[t.progress.completedTasks,`/`,t.progress.totalTasks,` tasks`]}),(0,x.jsxs)(`span`,{children:[S,`/`,t.phases.length,` phases`]}),(0,x.jsxs)(`span`,{children:[C,`/`,t.gates?.length??0,` gates`]}),(0,x.jsxs)(`span`,{children:[`Current: `,h?.title??(t.progress.percent===100?`Complete`:`None active`)]}),(0,x.jsxs)(`span`,{children:[`Next: `,_?.milestone??_?.title??`Not scheduled`]})]}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[10px] text-white/25`,children:[(0,x.jsxs)(`span`,{children:[`Updated `,Cs(t.updatedAt)]}),(0,x.jsx)(`span`,{children:`·`}),(0,x.jsxs)(`span`,{children:[`Revision `,t.revision]}),O&&(0,x.jsxs)(`span`,{className:`rounded-md border border-amber-300/10 bg-amber-300/[0.04] px-2 py-1 text-amber-100/50`,children:[`⚠ `,O]})]}),(0,x.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,x.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,x.jsxs)(`div`,{className:`grid gap-2 border-b border-white/[0.06] p-4 ${o?``:`md:grid-cols-3`}`,children:[(0,x.jsx)(Ds,{title:`Now`,tone:`amber`,tasks:v,empty:`No task is actively running.`,lookup:p}),(0,x.jsx)(Ds,{title:`Next`,tone:`violet`,tasks:y,empty:t.progress.percent===100?`All planned work is complete.`:`No unblocked task is queued.`,lookup:p}),(0,x.jsx)(Ds,{title:`Needs attention`,tone:`rose`,tasks:b,empty:`No blockers or failed tasks.`,lookup:p})]}),u===`dependencies`&&(0,x.jsx)(_s,{plan:t}),u===`plan`&&(0,x.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,x.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/35`,children:t.layout===`flat`?`Tasks`:`Phases`}),(0,x.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,x.jsx)(`div`,{className:`divide-y divide-white/[0.06]`,children:t.phases.map((n,r)=>{let i=c.has(n.id),a=xs(n);return t.layout===`flat`?(0,x.jsxs)(`div`,{className:`space-y-1 px-5 py-4`,children:[n.tasks.map(t=>(0,x.jsx)(Es,{missionId:e,task:t,lookup:p,indexById:m,compact:o},t.id)),n.tasks.length===0&&(0,x.jsx)(`p`,{className:`py-2 text-xs text-white/25`,children:`No tasks yet.`})]},n.id):(0,x.jsxs)(`div`,{children:[(0,x.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,x.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,x.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,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`p`,{className:`truncate text-sm font-medium text-white/80`,children:n.title}),n.milestone&&(0,x.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,x.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,x.jsx)(`div`,{className:`h-1 w-20 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,x.jsx)(`div`,{className:`h-full rounded-full bg-amber-300/60`,style:{width:`${a.percent??0}%`}})}),(0,x.jsxs)(`p`,{className:`text-[10px] text-white/25`,children:[a.completed,`/`,a.total,` tasks`,a.percent===void 0?``:` · ${a.percent}%`]})]})]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(bs,{status:n.status}),(0,x.jsx)(`span`,{className:`text-xs text-white/25`,children:i?`+`:`−`})]})]}),!i&&(0,x.jsxs)(`div`,{className:o?`px-4 pb-4`:`px-5 pb-4 pl-14`,children:[n.description&&(0,x.jsx)(`p`,{className:`mb-3 text-xs leading-relaxed text-white/40`,children:n.description}),n.acceptanceCriteria.length>0&&(0,x.jsxs)(`div`,{className:`mb-3 rounded-lg border border-emerald-300/10 bg-emerald-300/[0.02] p-3`,children:[(0,x.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-wider text-emerald-200/45`,children:`Definition of done`}),(0,x.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:n.acceptanceCriteria.map((e,t)=>(0,x.jsxs)(`li`,{className:`flex gap-2 text-[10px] leading-relaxed text-white/45`,children:[(0,x.jsx)(`span`,{className:n.status===`completed`?`text-emerald-300/70`:`text-white/20`,children:n.status===`completed`?`✓`:`○`}),e]},t))})]}),(0,x.jsxs)(`div`,{className:`space-y-1`,children:[n.tasks.map(t=>(0,x.jsx)(Es,{missionId:e,task:t,lookup:p,indexById:m,compact:o},t.id)),n.tasks.length===0&&(0,x.jsx)(`p`,{className:`py-2 text-xs text-white/25`,children:`No tasks in this phase.`})]})]})]},n.id)})}),r.length>0&&(0,x.jsxs)(`div`,{className:`border-t border-white/[0.06] px-5 py-4`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/35`,children:`Mission acceptance criteria`}),(0,x.jsx)(`ul`,{className:`mt-2 grid gap-1.5 ${o?``:`sm:grid-cols-2`}`,children:r.map((e,t)=>(0,x.jsxs)(`li`,{className:`flex gap-2 text-[11px] text-white/45`,children:[(0,x.jsx)(`span`,{className:`text-amber-200/40`,children:`◇`}),e]},t))})]}),(0,x.jsx)(ls,{missionId:e,gates:t.gates??[]}),k.length>0&&(0,x.jsxs)(`div`,{className:`border-t border-white/[0.06] px-5 py-4`,children:[(0,x.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,x.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-emerald-300/50`,children:`Recent evidence`}),(0,x.jsx)(`span`,{className:`text-[9px] text-white/20`,children:`Reported by the plan`})]}),(0,x.jsx)(`ul`,{className:`space-y-1.5`,children:k.map(({task:e,item:t},n)=>(0,x.jsxs)(`li`,{className:`flex gap-2 text-[11px] leading-relaxed text-white/45`,children:[(0,x.jsx)(`span`,{className:`text-emerald-400/70`,children:`✓`}),(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`span`,{className:`text-white/25`,children:[e,`:`]}),` `,t]})]},`${e}:${t}:${n}`))})]})]})}var ks={conversation:`mission-conversation`,plan:`mission-plan`,now:`mission-now`,diagnostics:`mission-diagnostics`,top:`mission-top`};function As(e){if(!(typeof document>`u`)){if(e===`top`){window.scrollTo?.({top:0,behavior:`smooth`});return}document.getElementById(ks[e])?.scrollIntoView?.({behavior:`smooth`,block:`start`})}}function js({node:e,decisions:t,defaultModelLabel:n,elapsedMs:r,onSelectWorker:i,onOpenDecisions:a}){return(0,x.jsxs)(`div`,{className:`flex flex-col`,children:[(0,x.jsxs)(`div`,{className:`grid items-start gap-5 xl:grid-cols-[300px_minmax(0,1fr)_340px]`,children:[(0,x.jsx)(ss,{node:e,defaultModelLabel:n,elapsedMs:r}),(0,x.jsx)(`div`,{id:ks.conversation,className:`flex min-w-0 flex-col xl:h-[calc(100vh-19rem)] xl:min-h-[520px]`,children:(0,x.jsx)(zo,{missionId:e.missionId,repository:e.mission.repository,provider:e.mission.provider,messages:e.messages,hasMoreMessages:e.hasMoreMessages,contained:!0,onOpenDecisions:t.length?a:void 0,live:{status:e.activityStatus,lifecycle:e.lifecycleStatus,detail:e.detail,waitingFor:e.waitingFor,workers:e.workers,inFlight:e.inFlight,prs:e.prs}})}),(0,x.jsx)(`div`,{id:ks.now,className:`min-w-0 xl:max-h-[calc(100vh-19rem)] xl:overflow-y-auto xl:pr-1`,children:(0,x.jsx)(Qo,{node:e,events:e.recentEvents,onSelectWorker:i})})]}),(0,x.jsxs)(`div`,{id:ks.plan,className:`mt-5 flex flex-col gap-5 scroll-mt-24`,children:[(0,x.jsx)(Os,{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,x.jsx)(ts,{messages:e.messages,plan:e.plan})]}),(0,x.jsx)(Go,{node:e})]})}function Ms(e,t){let n=[],r=qe(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=Je(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=Ve(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:Sn(Math.max(0,s-e.runStartedAt))}),n.push({label:`Tokens`,value:wn(e.tokens)}),n}var Ns={amber:`text-amber-300/90`,emerald:`text-emerald-300/85`},Ps={amber:`bg-amber-300/60`,emerald:`bg-emerald-300/60`};function Fs({node:e,now:t}){let n=Ms(e,t);return(0,x.jsx)(`div`,{className:`mb-5 flex flex-wrap gap-2.5`,children:n.map(e=>(0,x.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,x.jsx)(`p`,{className:`text-sm font-semibold tabular-nums ${e.accent?Ns[e.accent]:`text-white/85`}`,children:e.value}),(0,x.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,x.jsx)(`div`,{className:`mt-1.5 h-0.5 w-full overflow-hidden rounded-full bg-white/[0.07]`,children:(0,x.jsx)(`div`,{className:`h-full rounded-full ${e.accent?Ps[e.accent]:`bg-white/25`}`,style:{width:`${Math.round(e.ratio.done/e.ratio.total*100)}%`}})})]},e.label))})}function Is({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,x.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 border-l border-white/[0.07] pl-2`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>n(-1),title:`Previous mission (h)`,"aria-label":`Previous mission`,className:r,children:`‹`}),(0,x.jsxs)(`span`,{className:`mono px-0.5 text-[10px] tabular-nums text-white/25`,children:[e,`/`,t]}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>n(1),title:`Next mission (l)`,"aria-label":`Next mission`,className:r,children:`›`})]})}function Ls({affirm:e,decline:t}){return!e&&!t?null:(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[e&&(0,x.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,x.jsx)(`kbd`,{className:`mono ml-1 text-[9px] text-amber-100/45`,children:`a`})]}),t&&(0,x.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,x.jsx)(`kbd`,{className:`mono ml-1 text-[9px] text-white/30`,children:`d`})]})]})}var Rs=`hive:office-preferences`,zs={version:2,fleetPresentation:`cards`,missionPresentation:`details`,fleetDensity:`comfortable`,fleetSort:`attention`,motion:`system`,dialogue:`work_personality`,selectedFloor:0,roomAssignments:{},workerSeatAssignments:{}},Bs=[`comfortable`,`compact`],Vs=[`attention`,`recent`,`longest`,`workers`,`repository`];function Hs(e){if(!e)return zs;try{let t=JSON.parse(e);if(t.version!==1&&t.version!==2||t.fleetPresentation!==`cards`&&t.fleetPresentation!==`office`)return zs;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:Bs.includes(t.fleetDensity)?t.fleetDensity:`comfortable`,fleetSort:Vs.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 zs}}var Us,Ws=new Set;function Gs(){return Us||=typeof window>`u`?zs:Hs(localStorage.getItem(Rs)),Us}function Ks(e){Us=e;for(let e of Ws)e()}function qs(e){return Ws.add(e),Ws.size===1&&typeof window<`u`&&window.addEventListener(`storage`,Js),()=>{Ws.delete(e),!Ws.size&&typeof window<`u`&&window.removeEventListener(`storage`,Js)}}function Js(e){(e.key===null||e.key===`hive:office-preferences`)&&Ks(Hs(localStorage.getItem(Rs)))}function Ys(e){let t=typeof e==`function`?e(Gs()):e;try{localStorage.setItem(Rs,JSON.stringify(t))}catch{}Ks(t)}function Xs(){return[(0,g.useSyncExternalStore)(qs,Gs,()=>zs),(0,g.useCallback)(Ys,[])]}function Zs(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=po(r,(0,g.useMemo)(()=>Ci(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 Qs=[[.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]],$s=[[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 ec(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 Z({label:e,value:t,detail:n,tone:r=`white`,onClick:i}){let a=(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,x.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,x.jsx)(`span`,{"aria-hidden":`true`,className:`text-[9px] text-amber-200/0 transition group-hover:text-amber-200/50`,children:`→`})]}),(0,x.jsx)(`p`,{className:`mt-0.5 text-[9px] font-semibold uppercase tracking-[0.16em] text-white/25`,children:e}),(0,x.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-white/32`,title:n,children:n})]});return i?(0,x.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,x.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 tc({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=Zs(e),[h,_]=(0,g.useState)(`conversation`),[v,y]=(0,g.useState)(!1);(0,g.useEffect)(()=>{p&&_(p.panel)},[p]);let[b,S]=(0,g.useState)(`feed`),[C,w]=(0,g.useState)(!1),[T,E]=(0,g.useState)(!1),[D,O]=(0,g.useState)(!1),[k,A]=(0,g.useState)(!1),[j,M]=(0,g.useState)(),[N,P]=(0,g.useState)([]),[F,ee]=(0,g.useState)(),[I,te]=Xs(),[L,B]=(0,g.useState)(()=>Date.now()),[V,re]=(0,g.useState)(!1);(0,g.useEffect)(()=>{if(I.dialogue===`off`)return;let e=window.setInterval(()=>B(Date.now()),2e3);return()=>window.clearInterval(e)},[I.dialogue]);let ie=Nt(e.plan),ae=ie.filter(e=>e.status===`completed`).length,oe=ie.filter(e=>e.status===`blocked`||e.status===`failed`),se=e.plan?.gates??[],ce=se.filter(e=>e.status===`satisfied`||e.status===`waived`).length,H=!!l,le=e.mission.mode===`direct`,ue=!!o,de=!H&&(ue||e.lifecycleStatus===`ready_for_review`&&!m.walkingToReview),fe=ue&&!s,pe=new Set(n.map(e=>e.missionId)),me={x:.3,y:.25,width:5.2,depth:5.25},he=ii(me),U=le?Qs:he,ge=e.workers.filter(yi),_e=le?[]:m.workers.slice(0,4),ve=le?0:Math.max(0,m.workers.length-_e.length),ye=ei(me,0),be=ei({x:4.45,y:5.1,width:.76,depth:.24},2),xe=[ye[0],ye[1],{x:ye[1].x,y:ye[1].y-48},{x:ye[0].x,y:ye[0].y-48}],Se=[ye[0],ye[3],{x:ye[3].x,y:ye[3].y-48},{x:ye[0].x,y:ye[0].y-48}],Ce=m.presentedStates[e.missionId]??xi(e),we=Ce,Te=t=>m.presentedStates[`${e.missionId}:${t.id}`]??bi(t,e),Ee=G(U[0][0]+.36,U[0][1]+.78,26),De=(0,g.useMemo)(()=>Ka(t,I.roomAssignments).placements,[t,I.roomAssignments]),Oe=H?De.filter(e=>e.floorIndex===0&&e.spaceId===`direct-studio`&&l?.some(t=>t.missionId===e.mission.missionId)):[],ke=de?De.filter(e=>e.spaceId===`review`).slice(0,8):[],Ae={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}},je=ji(H?Oe.map(e=>e.mission):ue?ke.map(e=>e.mission):[e]),Me=(0,g.useMemo)(()=>Ca(De,I.dialogue,L),[L,De,I.dialogue]),Pe=e=>Me.find(t=>t.targetId===e),Fe=(e,t,n,r)=>e?(0,x.jsx)(Ta,{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,Ie=H?void 0:_e.find(t=>m.transitions[`${e.missionId}:${t.id}`]===`reporting`),Le=Ie,Re=Le?m.seats[Le.id]??-1:-1,ze=Ie?`receiving-report`:void 0,Be={x:U[0][0]+.36,y:U[0][1]+.78},Ve=Re>=0?{x:U[Re+1][0]+.36,y:U[Re+1][1]+.72}:void 0,He=e.workers.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)).length,Ue=[[`conversation`,`Conversation`],[`plan`,`Plan`],[`workers`,`Workers`],[`activity`,`Activity`],[`technical`,`Technical`]],We=H&&!u,Ge=l?.filter(e=>e.activityStatus===`working`).length??0,Ke=l?.filter(e=>e.activityStatus===`waiting_on_you`||e.activityStatus===`error`||e.activityStatus===`stalled`).length??0,qe=(l??[]).reduce((e,t)=>e+t.tokens,0),Je=(l??[]).filter(rn),Ye=async e=>{ee(void 0);try{await R(e,`completed`)}catch(e){ee(e.message)}},Xe=(l?.length??0)-Je.length,Ze=e.activityStatus===`working`?Date.now():e.updatedAt,Qe=(0,x.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6`,children:[(0,x.jsx)(Z,{label:`Occupied`,value:`${l?.length??0}/8`,detail:`Direct-agent desks in use`,tone:`emerald`}),(0,x.jsx)(Z,{label:`Working`,value:`${Ge}`,detail:`Agents active right now`,tone:Ge?`amber`:`white`}),(0,x.jsx)(Z,{label:`Attention`,value:`${Ke}`,detail:`Waiting, stalled, or failed`,tone:Ke?`rose`:`emerald`}),(0,x.jsx)(Z,{label:`Available`,value:`${Math.max(0,8-(l?.length??0))}`,detail:`Desks ready for new missions`}),(0,x.jsx)(Z,{label:`Tokens`,value:qe.toLocaleString(),detail:`Combined studio usage`}),(0,x.jsx)(Z,{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 $e(e){a?.(e),_(`conversation`)}async function et(){A(!0),M(void 0);try{let e=await ne();P(e.skipped),O(!1)}catch(e){M(e.message)}finally{A(!1)}}async function tt(){E(!0),ee(void 0);try{await z(),w(!1)}catch(e){ee(e.message)}finally{E(!1)}}let nt=(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] p-3`,children:[(0,x.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold text-white/65`,children:`Direct agents`}),(0,x.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/28`,children:`Select an agent to open its mission workspace.`})]}),(0,x.jsxs)(`button`,{type:`button`,disabled:!Je.length||T,onClick:()=>w(!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 · `,Je.length]})]}),C&&(0,x.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-300/15 bg-amber-300/[0.035] p-3`,children:[(0,x.jsxs)(`p`,{className:`text-[10px] leading-relaxed text-amber-50/60`,children:[`Clear `,Je.length,` finished direct `,Je.length===1?`mission`:`missions`,`? `,Xe,` active or attention `,Xe===1?`mission`:`missions`,` will remain untouched.`]}),(0,x.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{type:`button`,disabled:T,onClick:()=>w(!1),className:`px-2 py-1 text-[9px] text-white/35 hover:text-white/60`,children:`Cancel`}),(0,x.jsx)(`button`,{type:`button`,disabled:T||!Je.length,onClick:tt,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:T?`Clearing…`:`Clear ${Je.length} desks`})]})]}),F&&(0,x.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,x.jsx)(`div`,{className:`space-y-2`,children:Oe.map(({mission:e,seatIndex:t})=>(0,x.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,x.jsxs)(`span`,{className:`min-w-0`,children:[(0,x.jsx)(`span`,{className:`block truncate text-[11px] font-medium text-white/65`,children:e.name}),(0,x.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-[9px] leading-relaxed text-white/28`,children:e.mission.objective})]}),(0,x.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-[9px] uppercase tracking-wider text-white/25`,children:[`Desk `,t+1,` · `,nn(e)?(0,x.jsx)(`span`,{className:`text-emerald-200/70`,children:`finished`}):e.activityStatus.replaceAll(`_`,` `),nn(e)&&(0,x.jsx)(`span`,{role:`button`,tabIndex:0,onClick:t=>{t.stopPropagation(),Ye(e.missionId)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),Ye(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))})]}),rt=ke.filter(({mission:e})=>an(e,pe.has(e.missionId))),it=(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] p-3`,children:[(0,x.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h3`,{className:`text-xs font-semibold text-white/65`,children:`Awaiting acceptance`}),(0,x.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,x.jsxs)(`button`,{type:`button`,disabled:!rt.length||k,onClick:()=>O(!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 · `,rt.length]})]}),D&&(0,x.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-300/15 bg-amber-300/[0.035] p-3`,children:[(0,x.jsxs)(`p`,{className:`text-[10px] leading-relaxed text-amber-50/60`,children:[`Accept `,rt.length,` `,rt.length===1?`mission`:`missions`,` with no open gates, questions, or alerts? `,ke.length-rt.length>0?`${ke.length-rt.length} still needing review will stay seated.`:`Every seated mission qualifies.`,` Any worktree holding uncommitted work is preserved.`]}),(0,x.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,x.jsx)(`button`,{type:`button`,disabled:k,onClick:()=>O(!1),className:`cursor-pointer px-2 py-1 text-[9px] text-white/35 hover:text-white/60`,children:`Cancel`}),(0,x.jsx)(`button`,{type:`button`,disabled:k||!rt.length,onClick:et,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 ${rt.length}`})]})]}),j&&(0,x.jsx)(`p`,{className:`mb-3 text-[10px] text-rose-300/70`,children:j}),N.length>0&&(0,x.jsxs)(`div`,{className:`mb-3 rounded-lg border border-white/[0.07] bg-black/20 p-2.5`,children:[(0,x.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-wider text-white/30`,children:`Left for you to review`}),(0,x.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:N.map(e=>(0,x.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-[10px]`,children:[(0,x.jsx)(`span`,{className:`truncate text-white/50`,children:e.name}),(0,x.jsx)(`span`,{className:`shrink-0 text-amber-200/45`,children:e.reason})]},e.missionId))})]}),ke.length?(0,x.jsx)(`ul`,{className:`space-y-1.5`,children:ke.map(({mission:e})=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`button`,{type:`button`,onClick:()=>$e(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,x.jsxs)(`span`,{className:`flex items-center justify-between gap-3`,children:[(0,x.jsxs)(`span`,{className:`min-w-0`,children:[(0,x.jsx)(`span`,{className:`block truncate text-xs font-medium text-white/70`,children:e.name}),(0,x.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-white/32`,children:e.mission.objective||`No recorded objective`})]}),(0,x.jsxs)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-wider text-amber-200/45`,children:[on(e,pe.has(e.missionId))??(e.plan?.progress.percent===void 0?`clear`:`${e.plan.progress.percent}%`),` →`]})]})})},e.missionId))}):(0,x.jsx)(`p`,{className:`text-[10px] text-white/25`,children:`No mission is awaiting acceptance.`})]}),at=(0,x.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6`,children:[(0,x.jsx)(Z,{label:`Awaiting`,value:`${ke.length}`,detail:`Missions seated for acceptance`,tone:`amber`}),(0,x.jsx)(Z,{label:`Seats`,value:`${ke.length}/8`,detail:`Review hall capacity in use`}),(0,x.jsx)(Z,{label:`Needs you`,value:`${n.length}`,detail:`Open decisions across the hall`,tone:n.length?`rose`:`white`}),(0,x.jsx)(Z,{label:`Tokens`,value:ke.reduce((e,t)=>e+t.mission.tokens,0).toLocaleString(),detail:`Spent by seated missions`})]}),ot=(0,x.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:Ue.map(([e,t])=>(0,x.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))}),st=(0,x.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6`,children:[(0,x.jsx)(Z,{label:`Plan`,value:e.plan?.progress.percent===void 0?`—`:`${e.plan.progress.percent}%`,detail:ie.length?`${ae} of ${ie.length} tasks complete`:`Waiting for a structured plan`,tone:`amber`,onClick:()=>_(`plan`)}),(0,x.jsx)(Z,{label:le?`Status`:`Workers`,value:le?e.activityStatus.replaceAll(`_`,` `):`${e.workers.length}`,detail:le?`${e.mission.provider??`claude`} direct agent`:`${He} active · ${ge.length} present`,onClick:()=>_(le?`activity`:`workers`)}),(0,x.jsx)(Z,{label:`Gates`,value:`${ce}/${se.length}`,detail:se.length?`Completion requirements resolved`:`No completion gates published`,tone:ce===se.length&&se.length?`emerald`:`white`,onClick:()=>_(`plan`)}),(0,x.jsx)(Z,{label:`Health`,value:oe.length||e.alerts.length?`${oe.length+e.alerts.length}`:`Clear`,detail:oe.length?`${oe.length} blocked or failed tasks`:e.alerts.length?`${e.alerts.length} mission alerts`:`No reported blockers or alerts`,tone:oe.length||e.alerts.length?`rose`:`emerald`,onClick:()=>_(`activity`)}),(0,x.jsx)(Z,{label:`This turn`,value:ec(Ze-e.runStartedAt),detail:e.activityStatus.replaceAll(`_`,` `)}),(0,x.jsx)(Z,{label:`Tokens`,value:e.tokens.toLocaleString(),detail:`${e.jobIds.length} job turn${e.jobIds.length===1?``:`s`}`})]}),ct=We?nt:fe?it:h===`conversation`?(0,x.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,x.jsx)(Bn,{prs:e.prs,messages:e.messages}),(0,x.jsx)(zo,{missionId:e.missionId,repository:e.mission.repository,provider:e.mission.provider,messages:e.messages,hasMoreMessages:e.hasMoreMessages,contained:!0,onOpenDecisions:r,live:{status:e.activityStatus,lifecycle:e.lifecycleStatus,detail:e.detail,waitingFor:e.waitingFor,workers:e.workers,inFlight:e.inFlight,prs:e.prs}})]}):h===`plan`?(0,x.jsxs)(`div`,{children:[(0,x.jsx)(Os,{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,x.jsx)(ts,{messages:e.messages,plan:e.plan})]}):h===`workers`?(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsx)(is,{budgets:e.mission.budgets,tokens:e.tokens,workers:e.workers,elapsedMs:Math.max(0,Date.now()-e.createdAt)}),(0,x.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,x.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:`Workers`}),(0,x.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Select a worker here or at their desk.`})]}),He>0&&(0,x.jsxs)(`span`,{className:`rounded-full bg-amber-400/10 px-2 py-1 text-[10px] text-amber-300`,children:[He,` active`]})]}),(0,x.jsx)(Xo,{workers:e.workers,onSelect:i,narrow:!0})]}),(0,x.jsx)(Bn,{prs:e.prs,messages:e.messages})]}):h===`activity`?(0,x.jsxs)(`div`,{className:`space-y-3`,children:[e.detail&&(0,x.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] px-4 py-3`,children:[(0,x.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/25`,children:`Latest runtime note`}),(0,x.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/45`,children:e.detail})]}),(0,x.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,x.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:`Activity timeline`}),(0,x.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Live work, transitions, gaps, and bottlenecks`})]}),(0,x.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/[0.06] bg-black/15 p-0.5`,children:[`feed`,`parallel`].map(e=>(0,x.jsx)(`button`,{type:`button`,onClick:()=>S(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,x.jsx)(yr,{events:e.recentEvents,compact:!0}):(0,x.jsx)(qo,{events:e.recentEvents,workers:e.workers,plan:e.plan,compact:!0})]})]}):(0,x.jsxs)(`div`,{className:`grid gap-4`,children:[(0,x.jsx)(Ho,{missionId:e.missionId,initial:e.mission.policy}),(0,x.jsx)(Vo,{jobs:e.jobHistory}),(0,x.jsx)(Bo,{missionId:e.missionId}),(0,x.jsx)(Uo,{missionId:e.missionId})]});return(0,x.jsx)(`div`,{className:`space-y-5`,children:(0,x.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-white/10 bg-[#0e0f13]`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-white/[0.07] px-5 py-3`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.2em] text-amber-200/45`,children:H?`Shared direct-agent workspace`:ue?`Shared review hall`:`Mission room`}),We?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h2`,{className:`mt-1 text-base font-semibold text-white/75`,children:`Direct Studio overview`}),(0,x.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.`})]}):fe?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h2`,{className:`mt-1 text-base font-semibold text-white/75`,children:`Review hall overview`}),(0,x.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,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,x.jsx)(Ne,{missionId:e.missionId,name:e.name})}),e.mission.objective&&(0,x.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,x.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px shrink-0 text-[9px] text-white/25`,children:v?`▾`:`▸`}),(0,x.jsxs)(`span`,{className:v?``:`truncate`,children:[(0,x.jsx)(`span`,{className:`text-white/20`,children:`Goal:`}),` `,e.mission.objective]})]})]})]}),(0,x.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,x.jsx)(`span`,{children:`Talk`}),(0,x.jsxs)(`select`,{"aria-label":`Room dialogue`,value:I.dialogue,onChange:e=>te(t=>({...t,dialogue:e.target.value})),className:`bg-transparent text-[9px] text-white/55 outline-none`,children:[(0,x.jsx)(`option`,{value:`off`,children:`Off`}),(0,x.jsx)(`option`,{value:`work`,children:`Work only`}),(0,x.jsx)(`option`,{value:`work_personality`,children:`Work + personality`})]})]})]}),(0,x.jsx)(`div`,{className:`border-b border-white/[0.06] bg-black/[0.08] px-4 py-2.5`,children:We?Qe:fe?at:st}),(0,x.jsxs)(`div`,{className:`grid ${V?`xl:grid-cols-[minmax(0,1fr)]`:`xl:grid-cols-[minmax(0,1fr)_480px]`}`,children:[(0,x.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)] ${V?`xl:hidden`:``}`,children:[(0,x.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?.():ue&&c?.()},children:[(0,x.jsxs)(`defs`,{children:[(0,x.jsxs)(`filter`,{id:`review-manager-glow`,x:`-120%`,y:`-120%`,width:`340%`,height:`340%`,children:[(0,x.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`2.6`,result:`tight`}),(0,x.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`10`,result:`wide`}),(0,x.jsx)(`feFlood`,{floodColor:`#ffd77a`,floodOpacity:`.62`,result:`hot`}),(0,x.jsx)(`feFlood`,{floodColor:`#e6bd62`,floodOpacity:`.4`,result:`warm`}),(0,x.jsx)(`feComposite`,{in:`hot`,in2:`tight`,operator:`in`,result:`core`}),(0,x.jsx)(`feComposite`,{in:`warm`,in2:`wide`,operator:`in`,result:`halo`}),(0,x.jsxs)(`feMerge`,{children:[(0,x.jsx)(`feMergeNode`,{in:`halo`}),(0,x.jsx)(`feMergeNode`,{in:`core`}),(0,x.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,x.jsxs)(`filter`,{id:`direct-station-glow`,x:`-80%`,y:`-80%`,width:`260%`,height:`260%`,children:[(0,x.jsx)(`feGaussianBlur`,{stdDeviation:`4.5`,result:`blur`}),(0,x.jsx)(`feFlood`,{floodColor:`#55c7b3`,floodOpacity:`.48`,result:`color`}),(0,x.jsx)(`feComposite`,{in:`color`,in2:`blur`,operator:`in`,result:`glow`}),(0,x.jsxs)(`feMerge`,{children:[(0,x.jsx)(`feMergeNode`,{in:`glow`}),(0,x.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,x.jsxs)(`g`,{transform:`translate(-65 -45) scale(1.12)`,children:[(0,x.jsx)(`polygon`,{points:K(ye),fill:`#17181f`,stroke:H?`#55c7b3`:`#a78bfa`,strokeOpacity:`.28`,strokeWidth:`2`}),(0,x.jsx)(Vi,{floor:ye,doorway:be,center:G(2.9,2.85,2),atmosphere:je,occupied:!H||Oe.length>0,scope:`detail`}),(0,x.jsx)(`polygon`,{points:K(xe),fill:`#23242d`,stroke:`#a78bfa`,strokeOpacity:`.22`}),(0,x.jsx)(`polygon`,{points:K(Se),fill:`#1d1e26`,stroke:`#a78bfa`,strokeOpacity:`.18`}),(0,x.jsx)(Ui,{x:.55,y:.55}),(0,x.jsx)(zi,{x:3.75,y:.25}),(0,x.jsx)(Y,{x:2.9,y:.35,atmosphere:je}),de?(0,x.jsx)(Li,{x:.55,y:1.2,occupiedCount:ke.length}):U.map(([t,n],r)=>{let i=H?Oe.find(e=>e.seatIndex===r):void 0,a=!le&&r?_e.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?Ai(i.mission,void 0,o):a?Ai(e,a,o,Te(a)):!H&&r===0?Ai(e,void 0,o,Ce):void 0;return(0,x.jsx)(Fi,{x:t,y:n,role:le?`direct`:r===0?`manager`:`worker`,occupied:s,visualState:c?.state,monitor:c?.monitor??`vacant`,transition:o,selected:!!(i&&i.mission.missionId===u)},r)}),de?ke.map((e,t)=>{let[r,i]=$s[t],a=G(r,i,26);return(0,x.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Open review mission ${e.mission.name}`,onClick:t=>{t.stopPropagation(),$e(e.mission.missionId)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),$e(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,x.jsx)(`circle`,{cx:a.x,cy:a.y,r:`26`,fill:`transparent`,pointerEvents:`all`}),(0,x.jsx)(`title`,{children:e.mission.name}),(0,x.jsx)(wa,{identity:e.mission.missionId,x:r,y:i,role:`review`,provider:e.mission.mission.provider,state:xi(e.mission),needsAttention:e.mission.missionId===s&&n.length>0})]},e.mission.missionId)}):!H&&(0,x.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":le?`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,x.jsx)(`title`,{children:e.name}),(0,x.jsx)(`polygon`,{"data-hit-target":`desk`,points:Pi(U[0][0],U[0][1],le?`direct`:`manager`),fill:`transparent`,pointerEvents:`all`}),(0,x.jsx)(`circle`,{cx:Ee.x,cy:Ee.y,r:`28`,fill:`transparent`,pointerEvents:`all`}),(0,x.jsx)(wa,{identity:e.missionId,x:U[0][0]+.36,y:U[0][1]+.78,role:le?`direct`:`manager`,provider:e.mission.provider,state:we,needsAttention:n.length>0,transition:m.transitions[e.missionId],transitionStartedAt:m.transitionStarts[e.missionId],route:Ae,interaction:ze,interactionTarget:Ve})]}),H&&Oe.map(({mission:e,seatIndex:t})=>{let[n,r]=U[t],i=G(n+.36,r+.72,26),a=e.missionId===u;return(0,x.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,x.jsx)(`title`,{children:e.name}),(0,x.jsx)(`polygon`,{"data-hit-target":`desk`,points:Pi(n,r,`direct`),fill:`transparent`,pointerEvents:`all`}),(0,x.jsx)(`circle`,{cx:i.x,cy:i.y,r:`27`,fill:`transparent`,pointerEvents:`all`}),(0,x.jsx)(wa,{identity:e.missionId,x:n+.36,y:r+.72,role:`direct`,provider:e.mission.provider,state:xi(e)})]},e.missionId)}),!de&&_e.map((t,n)=>{let r=m.seats[t.id];if(r===void 0)return null;let[a,o]=U[r+1],s=G(a+.36,o+.72,26),c=m.transitions[`${e.missionId}:${t.id}`],l=c===`reporting`||c===`exiting`;return(0,x.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,x.jsx)(`polygon`,{"data-hit-target":`desk`,points:Pi(a,o,`worker`),fill:`transparent`,pointerEvents:`all`}),(0,x.jsx)(`circle`,{cx:s.x,cy:s.y,r:`26`,fill:`transparent`,pointerEvents:`all`}),(0,x.jsx)(wa,{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`:Te(t),transition:c,route:Ae,interaction:c===`reporting`?`reporting`:void 0,interactionTarget:l?Be:void 0})]},t.id)}),!de&&Ie&&(()=>{let e=G(Be.x,Be.y,34);return(0,x.jsxs)(`g`,{className:`office-handoff-document`,"aria-hidden":`true`,children:[(0,x.jsx)(`rect`,{x:e.x+8,y:e.y-18,width:`12`,height:`15`,rx:`1.5`,fill:`#f5f1e8`,stroke:`#e6bd62`}),(0,x.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:${Ie.id}`)})(),!H&&(()=>{let t=de?$s[Math.max(0,ke.findIndex(t=>t.mission.missionId===e.missionId))]:void 0;return t?Fe(Pe(e.missionId),t[0],t[1]):Fe(Pe(e.missionId),U[0][0]+.36,U[0][1]+.78)})(),H&&Oe.map(({mission:e,seatIndex:t})=>{let[n,r]=U[t];return Fe(Pe(e.missionId),n+.36,r+.72)}),!de&&_e.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]=U[i+1];return Fe(Pe(`${e.missionId}:${t.id}`),a+.36,o+.72,t)})]})]}),(0,x.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 left-4 flex flex-wrap gap-2 text-[9px]`,children:[(0,x.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`:ue?`Managers · click a seat to review`:`${le?`Direct agent`:`Manager`} · click to converse`}),!le&&!ue&&(0,x.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`}),ve>0&&(0,x.jsxs)(`span`,{className:`rounded-full border border-orange-300/15 bg-black/35 px-2.5 py-1 text-orange-100/60`,children:[`+`,ve,` workers outside visible capacity`]})]})]}),(0,x.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 ${V?``:`xl:border-l`} ${!We&&h===`conversation`?`xl:flex xl:h-[clamp(600px,calc(100vh_-_500px),730px)] xl:flex-col xl:overflow-hidden`:`xl:overflow-y-auto`}`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>re(e=>!e),"aria-label":V?`Show the room`:`Widen the panel over the room`,title:V?`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:V?`›`:`‹`}),!We&&!fe&&(0,x.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center gap-2`,children:[ot,nn(e)&&(0,x.jsx)(`button`,{type:`button`,onClick:()=>void Ye(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`})]}),(We||fe)&&(0,x.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.18em] text-white/25`,children:We?`Direct Studio`:`Review hall`}),(0,x.jsxs)(`p`,{className:`text-[9px] text-white/18`,children:[`Select a `,We?`desk`:`manager`]})]}),(0,x.jsx)(`div`,{className:`mission-presentation-enter ${!We&&h===`conversation`?`xl:min-h-0 xl:flex-1`:``}`,children:ct},We?`studio`:`${e.missionId}:${h}`)]})]})]})})}function nc(e,t,n){return n(e.lifecycleStatus,t.map(e=>({id:e.id,choices:e.choices})))}function rc(e,t,n,r){let i=nc(e,t,n);if(!i)return!1;if(i.needsWords)return r?.(),!1;if(i.answer&&i.decisionId)te(e.missionId,i.decisionId,i.answer);else if(i.next)R(e.missionId,i.next);else return!1;return!0}var ic=`[data-mission-composer]`;function ac(){if(typeof document>`u`)return!1;let e=document.querySelector(ic);return e?(e.focus(),e.setSelectionRange?.(e.value.length,e.value.length),e.scrollIntoView?.({block:`nearest`}),!0):!1}var oc={g:`top`,c:`conversation`,w:`now`,p:`plan`,d:`diagnostics`};function sc(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||rt(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=oc[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(),ac();return}let d={a:n,d:r,p:i}[t];if(d){e.preventDefault(),d();return}if(Lr.has(t)||Ir.has(t)){e.preventDefault(),window.scrollBy?.({top:Lr.has(t)?160:-160});return}let f=Pr.has(t);!f&&!Fr.has(t)||s&&(e.preventDefault(),s(f?-1:1))};return window.addEventListener(`keydown`,d),()=>{u(),window.removeEventListener(`keydown`,d)}},[e])}function cc(e){return e.filter(e=>e.lifecycleStatus===`active`||e.lifecycleStatus===`ready_for_review`||e.lifecycleStatus===`paused`||e.lifecycleStatus===`failed`).map(e=>e.missionId)}function lc(e,t,n){let r=e.indexOf(t);if(!(r===-1||e.length<2))return e[(r+n+e.length)%e.length]}function uc(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 dc(e){let t=new Set;return e.map(e=>e.missionId).filter(e=>!t.has(e)&&t.add(e))}var Q=`hive:mission-seen`,fc=100;function pc(){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 mc(e){return pc()[e]}function hc(e,t=Date.now()){try{let n={...pc(),[e]:t},r=Object.entries(n).sort(([,e],[,t])=>t-e).slice(0,fc);localStorage.setItem(Q,JSON.stringify(Object.fromEntries(r)))}catch{}}function gc(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 _c(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 vc({changes:e,onDismiss:t}){return e?(0,x.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,x.jsxs)(`p`,{className:`min-w-0 text-xs text-sky-100/70`,children:[(0,x.jsx)(`span`,{className:`font-medium`,children:_c(e)}),(0,x.jsxs)(`span`,{className:`text-white/30`,children:[` since you last opened this, `,Cn(e.awayMs),` ago`]})]}),(0,x.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 yc(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 bc={conversation:`conversation`,plan:`plan`,workers:`now`,activity:`now`,technical:`plan`};function xc(e){return e.workerId?`workers`:e.id===`unclear-wait`?`conversation`:`activity`}function Sc({mission:e,tone:t,title:n,detail:r,onOpen:i}){return(0,x.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,x.jsxs)(`span`,{className:`min-w-0`,children:[(0,x.jsxs)(`span`,{className:`block text-sm font-medium`,children:[(0,x.jsx)(`span`,{className:`text-white/90`,children:e.name}),` · `,n]}),(0,x.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed opacity-65`,children:r})]}),(0,x.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium opacity-55`,children:`Open →`})]})}function Cc({label:e,value:t,accent:n}){return(0,x.jsxs)(`div`,{className:`rounded-xl border border-white/8 bg-white/[0.025] px-4 py-3`,children:[(0,x.jsx)(`p`,{className:`text-lg font-semibold ${n??`text-white/85`}`,children:t}),(0,x.jsx)(`p`,{className:`mt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/25`,children:e})]})}function wc({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,S]=(0,g.useState)({});(0,g.useEffect)(()=>{_e().then(({providers:e})=>S(Object.fromEntries(e.flatMap(e=>e.defaultModel?[[e.provider,e.defaultModel.label]]:[])))).catch(()=>S({}))},[]);let w=b[e.mission.provider??`claude`],[T,E]=(0,g.useState)(Date.now()),[D,O]=(0,g.useState)(()=>e.workers.find(e=>e.id===s)??null),[k,A]=(0,g.useState)(),[j,M]=(0,g.useState)(!1),[N,P]=(0,g.useState)(()=>gc(e,mc(e.missionId)));(0,g.useEffect)(()=>{P(gc(e,mc(e.missionId))),hc(e.missionId)},[e.missionId]);let[F,ee]=(0,g.useState)(),I=()=>ee(Date.now()),te=n.length>0,L=(0,g.useRef)(null),z=e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`;(0,g.useEffect)(()=>{let e=setInterval(()=>E(Date.now()),1e3);return()=>clearInterval(e)},[]);let ne=e.status===`working`?T:e.updatedAt,B=!!h,V=!B&&!f,re=V&&a===`details`,ie=nc(e,n,Qe),ae=nc(e,n,$e),oe=!!f&&!p,se=h?.filter(e=>e.activityStatus===`working`).length??0,ce=h?.filter(e=>e.activityStatus===`waiting_on_you`||e.activityStatus===`error`||e.activityStatus===`stalled`).length??0,H=(t,n,r)=>{if(B&&t.missionId!==_&&v?.(t.missionId),A({panel:n,token:Date.now()}),r){let n=t.workers.find(e=>e.id===r);n&&t.missionId===e.missionId&&O(n)}window.requestAnimationFrame(()=>{a===`details`?As(bc[n]):L.current?.scrollIntoView?.({behavior:`smooth`,block:`start`})})},le=(0,x.jsxs)(`header`,{className:`mb-6`,children:[(0,x.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-amber-200/45`,children:`Shared workspace`}),(0,x.jsx)(`h1`,{className:`mt-1 text-2xl font-semibold text-white/85`,children:`Review hall`}),(0,x.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.`]})]}),ue=oe?le:B?(0,x.jsxs)(`header`,{className:`mb-6`,children:[(0,x.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-emerald-200/45`,children:`Shared workspace`}),(0,x.jsx)(`h1`,{className:`mt-1 text-2xl font-semibold text-white/85`,children:`Direct Studio`}),(0,x.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,x.jsxs)(`header`,{className:`mb-6 flex flex-wrap items-start justify-between gap-4`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(Ne,{missionId:e.missionId,name:e.name,large:!0}),(0,x.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-white/30`,children:[(0,x.jsxs)(`span`,{className:`mono`,children:[`mission `,e.missionId.slice(0,8)]}),!re&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{children:`·`}),(0,x.jsx)(`span`,{className:`capitalize`,children:e.mission.mode}),(0,x.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,x.jsx)(`span`,{className:`mono rounded bg-white/[0.04] px-1.5 py-0.5 text-[10px] text-white/40`,children:e.mission.model??(w?`CLI default (${w})`:`CLI default`)}),e.mission.repository&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{children:`·`}),(0,x.jsx)(`span`,{className:`mono text-white/40`,title:e.mission.repository,children:ze(e.mission.repository)})]}),e.mission.additionalRepositories?.map(e=>(0,x.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:[`+ `,ze(e)]},e)),e.mission.template&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{children:`·`}),(0,x.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,x.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,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{children:`·`}),(0,x.jsx)(`span`,{className:`mono text-violet-300/60`,children:e.worktreeBranch})]})]})]})]}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,x.jsx)(Zt,{status:e.lifecycleStatus}),!z&&(0,x.jsx)(C,{status:e.activityStatus}),!z&&(0,x.jsx)(vt,{pid:e.pid,status:e.activityStatus}),(0,x.jsx)(Vn,{missionId:e.missionId,status:e.lifecycleStatus,onDeleted:r,hidePrimary:V&&!!ie})]})]}),de=(t,n=!0)=>(0,x.jsxs)(`div`,{children:[t.activityStatus===`waiting_on_you`&&!(te&&t.missionId===e.missionId)&&(0,x.jsx)(Sc,{mission:t,tone:`rose`,title:`Waiting for your reply`,detail:t.waitingFor??`Open the conversation to review what this agent needs.`,onOpen:()=>H(t,`conversation`)}),t.activityStatus===`stalled`&&(0,x.jsx)(Sc,{mission:t,tone:`orange`,title:`Work appears stalled`,detail:`No meaningful activity for ${yc(t.inactiveForMs)}. Open activity to inspect the evidence and recovery options.`,onOpen:()=>H(t,`activity`)}),t.activityStatus===`error`&&(0,x.jsx)(Sc,{mission:t,tone:`rose`,title:`Runtime needs attention`,detail:`Open activity to inspect the failure and recent execution evidence.`,onOpen:()=>H(t,`activity`)}),n&&t.activityStatus===`idle`&&t.lifecycleStatus===`active`&&!t.workers.some(e=>!e.doneAt)&&t.inFlight.tasks===0&&t.inFlight.queued===0&&(0,x.jsx)(Sc,{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:()=>H(t,`conversation`)}),t.lifecycleStatus===`ready_for_review`&&!re&&(0,x.jsx)(Sc,{mission:t,tone:`amber`,title:`Ready for your acceptance`,detail:`Review the plan evidence, accept completion, or request changes.`,onOpen:()=>H(t,`plan`)}),(0,x.jsx)(Eo,{alerts:t.alerts??[],missionName:t.name,onNavigate:e=>H(t,xc(e),e.workerId)})]},`notices:${t.missionId}`),fe=(0,x.jsxs)(x.Fragment,{children:[te&&!z?(0,x.jsx)(xo,{decisions:n,onOpenMission:()=>void 0,showMission:!1,presentation:`drawer`,openToken:F,className:`mb-3`,choiceShortcuts:V}):null,oe?null:B?h?.map(e=>de(e,!1)):de(e)]}),pe=B?(0,x.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,x.jsx)(Cc,{label:`Occupied desks`,value:`${h?.length??0}/8`}),(0,x.jsx)(Cc,{label:`Working`,value:`${se}`,accent:se?`text-amber-300`:void 0}),(0,x.jsx)(Cc,{label:`Needs attention`,value:`${ce}`,accent:ce?`text-rose-300`:void 0}),(0,x.jsx)(Cc,{label:`Total tokens`,value:`${(h??[]).reduce((e,t)=>e+t.tokens,0).toLocaleString()}`})]}):oe?null:(0,x.jsx)(Fs,{node:e,now:T}),me=cc(t),he=me.includes(e.missionId)?me:[...me,e.missionId],U=Ze(e.lifecycleStatus),ge=()=>rc(e,n,$e,ac),ve=()=>rc(e,n,Qe,ac),ye=t=>{let n=lc(he,e.missionId,t);n&&u?.(n)};return sc({enabled:V&&!D&&!j,onAffirm:ie?ve:void 0,onDecline:ae?ge:void 0,onPauseToggle:U?()=>void R(e.missionId,U.next):void 0,onShowHelp:()=>M(!0),onGoTo:re?e=>As(e):void 0,onStepMission:u?ye:void 0,onStepNeedsYou:u&&d.length?t=>{let n=uc(d,e.missionId,t);n&&n!==e.missionId&&u?.(n)}:void 0}),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Rr,{open:j,onClose:()=>M(!1)}),(0,x.jsx)(Oo,{onBack:r,header:ue,notices:fe,metrics:a===`details`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(vc,{changes:re?N:void 0,onDismiss:()=>P(void 0)}),pe]}):null,presentation:a,onPresentationChange:o,switcher:V&&u?(0,x.jsx)(Is,{position:he.indexOf(e.missionId)+1,total:he.length,onStep:ye}):void 0,actions:V?(0,x.jsx)(Ls,{affirm:ie?{label:ie.label,run:ve}:void 0,decline:ae?{label:ae.label,run:ge}:void 0}):void 0,children:(0,x.jsxs)(`div`,{ref:L,className:`scroll-mt-4`,children:[a===`room`&&(0,x.jsx)(tc,{node:e,fleetMissions:t,decisions:n,onOpenDecisions:te?I:void 0,onSelectWorker:O,onReviewMissionSelect:l,reviewMissions:f,selectedReviewMissionId:p,onReviewClear:m,studioMissions:h,selectedStudioMissionId:_,onStudioMissionSelect:v,onStudioClear:y,requestedPanel:k}),a===`details`&&(0,x.jsx)(js,{node:e,decisions:n,defaultModelLabel:w,elapsedMs:Math.max(0,ne-e.createdAt),onSelectWorker:O,onOpenDecisions:te?I:void 0}),D&&(0,x.jsx)(wo,{missionId:e.missionId,worker:e.workers.find(e=>e.id===D.id&&e.jobId===D.jobId)??D,plan:e.plan,events:e.recentEvents,onClose:()=>{O(null),c?.()}})]})})]})}function Tc(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 Ec;function Dc(){try{return Ec??=new AudioContext,Ec.state===`suspended`&&Ec.resume(),Ec}catch{return}}function Oc(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 kc(){let e=Dc();if(!e)return;let t=e.currentTime;Oc(e,659.25,t,.16),Oc(e,880,t+.14,.22)}function Ac(){let e=Dc();if(!e)return;let t=e.currentTime;Oc(e,523.25,t,.18),Oc(e,659.25,t+.13,.18),Oc(e,783.99,t+.26,.3)}function jc(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&&Ac(),a&&window.setTimeout(kc,o?700:0)},[e,t]),{enabled:t,toggle:()=>n(e=>{let t=!e;try{localStorage.setItem(`hive:sounds`,t?`on`:`off`)}catch{}return t&&kc(),t})}}var Mc=`hive:drawer-width`,Nc=[{id:`chat`,label:`Chat`},{id:`plan`,label:`Plan`},{id:`workers`,label:`Workers`},{id:`activity`,label:`Activity`}];function Pc(e){return Math.min(900,Math.max(380,Math.round(e)))}function Fc(){if(typeof window>`u`)return 520;let e=Number(localStorage.getItem(Mc));return Number.isFinite(e)&&e>0?Pc(e):520}function Ic({node:e,decisions:t,width:n,onWidthChange:r,onClose:i,onExpand:a,workerId:o,onWorkerChange:s,onAnswerVisibleChange:c}){let[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(`chat`),p=(0,g.useRef)();Ae(!0,Ce.panel,()=>{tt(document.activeElement)?.closest(`input, textarea, select, [role='menu']`)||i()}),(0,g.useEffect)(()=>{if(typeof document>`u`)return;let e=e=>{let t=tt(e.target);t&&(t.closest(`[data-mission-drawer]`)||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(),u(!0);let t=e=>{p.current&&cancelAnimationFrame(p.current),p.current=requestAnimationFrame(()=>r(Pc(window.innerWidth-e.clientX)))},n=()=>{u(!1),window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n)},[r]),h=_n(e.recentEvents),_=e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`,v=t.length>0,y=v&&d===`chat`,b=o?e.workers.find(e=>e.id===o):void 0;return(0,g.useEffect)(()=>(c?.(y),()=>c?.(!1)),[y,c]),(0,g.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{if(e.key!==`[`&&e.key!==`]`||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||tt(e.target)?.closest(`input, textarea, select`))return;e.preventDefault();let t=(Nc.findIndex(e=>e.id===d)+(e.key===`]`?1:Nc.length-1))%Nc.length;f(Nc[t].id)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d]),(0,x.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,x.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 ${l?`bg-amber-300/40`:`bg-transparent hover:bg-amber-300/25`}`}),(0,x.jsxs)(`header`,{className:`shrink-0 border-b border-white/[0.07] px-4 py-3.5`,children:[(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(Ne,{missionId:e.missionId,name:e.name}),(0,x.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-1.5`,children:[e.mission.repository&&(0,x.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:ze(e.mission.repository)}),e.worktreeBranch&&(0,x.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:Be(e.worktreeBranch)}),(0,x.jsxs)(`span`,{className:`mono text-[10px] text-white/25`,children:[e.mission.mode,` · `,e.mission.provider??`claude`]})]})]}),(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,x.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,x.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,x.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-1.5`,children:[He(e.lifecycleStatus,e.activityStatus)&&(0,x.jsx)(C,{status:e.activityStatus}),(_||e.lifecycleStatus!==`active`)&&(0,x.jsx)(Zt,{status:e.lifecycleStatus}),(0,x.jsx)(`span`,{className:`ml-auto`,children:(0,x.jsx)(Vn,{missionId:e.missionId,status:e.lifecycleStatus,compact:!0,onDeleted:i})})]})]}),(0,x.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-white/[0.07] px-4 py-3`,children:[e.mission.objective&&(0,x.jsx)(`p`,{className:`text-xs leading-relaxed text-white/45`,title:e.mission.objective,children:(0,x.jsx)(`span`,{className:`line-clamp-2`,children:e.mission.objective})}),(0,x.jsx)(En,{event:h,fallback:e.detail??e.intent,working:e.activityStatus===`working`}),(0,x.jsx)(Mn,{alerts:e.alerts??[]})]}),b&&(0,x.jsx)(wo,{missionId:e.missionId,worker:b,plan:e.plan,events:e.recentEvents,onClose:()=>s(void 0)}),(0,x.jsx)(`nav`,{"aria-label":`Mission panel`,className:`flex shrink-0 gap-1 border-b border-white/[0.07] px-3 py-1.5`,children:Nc.map(({id:t,label:n})=>(0,x.jsxs)(`button`,{type:`button`,"aria-current":d===t?`page`:void 0,onClick:()=>f(t),className:`rounded-md px-2.5 py-1 text-[11px] font-medium transition ${d===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,x.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,x.jsx)(`span`,{className:`ml-1 text-white/25`,children:e.workers.length})]},t))}),(0,x.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[d===`chat`&&v&&(0,x.jsx)(xo,{decisions:t,onOpenMission:()=>void 0,showMission:!1,compact:!0,choiceShortcuts:!0}),d===`chat`&&!v&&(0,x.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,x.jsx)(zo,{missionId:e.missionId,messages:e.messages,hasMoreMessages:e.hasMoreMessages,repository:e.mission.repository,provider:e.mission.provider,live:{status:e.activityStatus,lifecycle:e.lifecycleStatus,detail:e.detail,waitingFor:e.waitingFor,workers:e.workers,inFlight:e.inFlight,prs:e.prs},contained:!0})}),d===`plan`&&(0,x.jsx)(`div`,{className:`px-3 py-3`,children:(0,x.jsx)(Os,{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})}),d===`workers`&&(0,x.jsxs)(`div`,{className:`space-y-3 px-3 py-3`,children:[(0,x.jsx)(Bn,{prs:e.prs,messages:e.messages}),(0,x.jsx)(Xo,{workers:e.workers,narrow:!0,onSelect:e=>s(e.id)})]}),d===`activity`&&(0,x.jsx)(`div`,{className:`px-3 py-3`,children:(0,x.jsx)(yr,{events:e.recentEvents,compact:!0})})]})]})}function Lc(){let{snapshot:e,connected:t,lastDisconnectedAt:n,reconnect:r}=y(),[i,a]=Xs(),[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)(Fc),[_,v]=(0,g.useState)(!1),b=e=>{let t=Pc(e);h(t);try{localStorage.setItem(Mc,String(t))}catch{}},[S,C]=(0,g.useState)(()=>typeof window<`u`&&new URLSearchParams(window.location.search).get(`space`)===`direct-studio`),[w,T]=(0,g.useState)(()=>typeof window<`u`&&new URLSearchParams(window.location.search).get(`space`)===`review`),E=Tc(e?.decisions??[]),D=jc(e??void 0),O=(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))},k=(e,t,n)=>{let r=t??i.missionPresentation,a=e===o&&e!==null&&r===c;s(e),l(r),d(n??null),p(`drawer`),O(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`)},A=e=>{e!==o&&(s(e),d(null),O(t=>{t.set(`mission`,e),t.delete(`worker`)},`replace`))},j=()=>{d(null),O(e=>e.delete(`worker`),`replace`)},M=()=>{p(`full`),O(e=>e.set(`view`,`full`),`push`)},N=()=>{p(`drawer`),O(e=>e.delete(`view`),`replace`)},P=e=>{C(!0),s(e??null),d(null),l(`room`),O(t=>{t.set(`space`,`direct-studio`),t.set(`presentation`,`room`),e?t.set(`mission`,e):t.delete(`mission`),t.delete(`worker`)},S?`replace`:`push`)},F=()=>{C(!1),s(null),O(e=>{e.delete(`space`),e.delete(`mission`),e.delete(`presentation`)},`push`)},ee=e=>{T(!0),s(e??null),d(null),l(`room`),O(t=>{t.set(`space`,`review`),t.set(`presentation`,`room`),e?t.set(`mission`,e):t.delete(`mission`),t.delete(`worker`)},w?`replace`:`push`)},I=()=>{T(!1),s(null),O(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`)),C(e.get(`space`)===`direct-studio`),T(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]),Ae(!!o||S||w,Ce.page,()=>{let e=document.activeElement;if(e&&(e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName))){e.blur?.();return}S?F():w?I():k(null)});let te=(0,g.useMemo)(()=>e?dc(Yr(e)):[],[e]),L=(0,g.useMemo)(()=>e?Ka(e.orchestrators,i.roomAssignments).placements:[],[i.roomAssignments,e]),R=(0,g.useMemo)(()=>L.filter(e=>e.floorIndex===0&&e.spaceId===`direct-studio`).sort((e,t)=>e.seatIndex-t.seatIndex).map(e=>e.mission),[L]),z=(0,g.useMemo)(()=>L.filter(e=>e.spaceId===`review`).sort((e,t)=>e.seatIndex-t.seatIndex).map(e=>e.mission),[L]);(0,g.useEffect)(()=>{e&&(w&&!z.length&&I(),S&&!R.length&&F())},[R.length,z.length,w,S,e]);let ne=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||S)&&t===`room`?e.searchParams.set(`presentation`,`room`):e.searchParams.delete(`presentation`),S&&t===`details`&&e.searchParams.delete(`space`),window.history.replaceState({},``,e)}S&&t===`details`&&C(!1)};if(!e)return(0,x.jsx)(`div`,{className:`flex h-screen items-center justify-center px-6`,children:(0,x.jsxs)(`div`,{className:`max-w-md rounded-2xl border border-white/10 bg-white/[0.025] p-6 text-center`,children:[(0,x.jsx)(`p`,{className:`text-sm font-medium text-white/55`,children:t?`Loading fleet…`:`Connecting to Hive…`}),(0,x.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,x.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 B=o?e.orchestrators.find(e=>e.missionId===o):void 0;if(S&&R.length){let i=R.find(e=>e.missionId===o);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Rc,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,x.jsx)(wc,{node:i??R[0],fleetMissions:e.orchestrators,decisions:i?(e.decisions??[]).filter(e=>e.missionId===i.missionId):[],initialPresentation:`room`,presentation:`room`,onPresentationChange:ne,studioMissions:R,selectedStudioMissionId:i?.missionId,onStudioMissionSelect:e=>P(e),onStudioClear:()=>P(),onBack:F})]})}if(w&&z.length){let i=z.find(e=>e.missionId===o);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Rc,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,x.jsx)(wc,{node:i??z[0],fleetMissions:e.orchestrators,decisions:i?(e.decisions??[]).filter(e=>e.missionId===i.missionId):[],onBack:I,presentation:`room`,onPresentationChange:ne,reviewMissions:z,selectedReviewMissionId:o??void 0,onReviewMissionSelect:ee,onReviewClear:()=>ee(void 0)})]})}return B&&(f===`full`||c===`room`)?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Rc,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,x.jsx)(wc,{node:B,fleetMissions:e.orchestrators,decisions:(e.decisions??[]).filter(e=>e.missionId===B.missionId),initialPresentation:c,presentation:c,onPresentationChange:ne,initialWorkerId:u??void 0,onWorkerClose:j,onReviewMissionSelect:e=>k(e,`room`),needsYouMissionIds:te,onStepMission:e=>{s(e),d(null),p(`full`),window.scrollTo?.({top:0}),O(t=>{t.set(`mission`,e),t.set(`view`,`full`)},`push`)},onBack:()=>{N(),k(null)}},B.missionId)]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Rc,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,x.jsx)(`div`,{style:B?{paddingRight:m}:void 0,className:`transition-[padding] duration-150`,children:(0,x.jsx)(yo,{snapshot:e,connected:t,officePreferences:i,setOfficePreferences:a,onPresentationChange:ne,onSelectOrchestrator:(e,t,n)=>k(e,t,n),activeMissionId:B?.missionId,onFollowMission:A,answerVisible:_,onOpenFullMission:e=>{s(e),p(`full`),O(t=>{t.set(`mission`,e),t.set(`view`,`full`)},`push`)},onSelectDirectStudio:P,onSelectReviewHall:ee,notifications:E,sounds:D})}),B&&(0,x.jsx)(Ic,{node:B,decisions:(e.decisions??[]).filter(e=>e.missionId===B.missionId),width:m,onWidthChange:b,onClose:()=>k(null),onExpand:M,onAnswerVisibleChange:v,workerId:u??void 0,onWorkerChange:e=>{d(e??null),O(t=>{e?t.set(`worker`,e):t.delete(`worker`)},`replace`)}},B.missionId)]})}function Rc({connected:e,lastDisconnectedAt:t,reconnect:n}){return e?null:(0,x.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,x.jsxs)(`span`,{children:[`Live updates disconnected`,t?` at ${new Date(t).toLocaleTimeString()}`:``,`. Showing the last durable snapshot.`]}),(0,x.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,x.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,x.jsx)(g.StrictMode,{children:(0,x.jsx)(Lc,{})}));
|