@tt-a1i/hive 2.1.16 → 2.1.17

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +14 -4
  2. package/dist/src/server/action-center-summary.d.ts +2 -2
  3. package/dist/src/server/agent-startup-instructions.js +1 -7
  4. package/dist/src/server/agent-stdin-dispatcher.js +0 -1
  5. package/dist/src/server/diagnostics-support-bundle.d.ts +3 -3
  6. package/dist/src/server/hive-team-guidance.js +1 -24
  7. package/dist/src/server/role-template-store.d.ts +1 -1
  8. package/dist/src/server/role-templates.d.ts +0 -2
  9. package/dist/src/server/role-templates.js +0 -24
  10. package/dist/src/server/routes-settings.js +6 -1
  11. package/dist/src/server/routes-workers.js +6 -0
  12. package/dist/src/server/runtime-store-helpers.d.ts +0 -2
  13. package/dist/src/server/runtime-store-helpers.js +0 -11
  14. package/dist/src/server/spawn-worker-defaults.d.ts +1 -1
  15. package/dist/src/server/spawn-worker-defaults.js +7 -2
  16. package/dist/src/server/sqlite-schema-v33.d.ts +1 -1
  17. package/dist/src/server/sqlite-schema-v33.js +2 -16
  18. package/dist/src/server/sqlite-schema-v35.js +1 -2
  19. package/dist/src/server/sqlite-schema-v40.d.ts +3 -0
  20. package/dist/src/server/sqlite-schema-v40.js +46 -0
  21. package/dist/src/server/sqlite-schema.d.ts +1 -1
  22. package/dist/src/server/sqlite-schema.js +6 -1
  23. package/dist/src/server/team-authz.d.ts +0 -8
  24. package/dist/src/server/team-authz.js +0 -21
  25. package/dist/src/server/team-operations.js +0 -2
  26. package/dist/src/server/workflow-agent-call-executor.d.ts +1 -1
  27. package/dist/src/server/workflow-agent-call-executor.js +2 -6
  28. package/dist/src/shared/random-worker-name.js +0 -26
  29. package/dist/src/shared/types.d.ts +3 -1
  30. package/dist/src/shared/types.js +2 -0
  31. package/package.json +1 -1
  32. package/web/dist/assets/AddWorkerDialog-BrvNv3RW.js +2 -0
  33. package/web/dist/assets/AddWorkspaceFlow-BxT9VxkV.js +1 -0
  34. package/web/dist/assets/{FirstRunWizard-DzAnGniE.js → FirstRunWizard-S7Pb_5iy.js} +1 -1
  35. package/web/dist/assets/{MarketplaceDrawer-DAWF9idk.js → MarketplaceDrawer-id-_KJdd.js} +8 -8
  36. package/web/dist/assets/{TaskGraphDrawer-DRVJ4Z7z.js → TaskGraphDrawer-Bc3ntINN.js} +1 -1
  37. package/web/dist/assets/{WhatsNewDialog-BDsPg5Fa.js → WhatsNewDialog-D-UzFajD.js} +1 -1
  38. package/web/dist/assets/WorkerModal-DxAQnNYF.js +1 -0
  39. package/web/dist/assets/{WorkflowsDrawer-Clv5ROhE.js → WorkflowsDrawer-_JG5sK9V.js} +1 -1
  40. package/web/dist/assets/WorkspaceMemoryDrawer-CmesL_Hn.js +1 -0
  41. package/web/dist/assets/{WorkspaceTaskDrawer-C14sALb8.js → WorkspaceTaskDrawer-DdAAFy8G.js} +1 -1
  42. package/web/dist/assets/{index-DoOf8jsj.js → index-CWxTzG6t.js} +20 -22
  43. package/web/dist/assets/index-DLjB6gMZ.css +1 -0
  44. package/web/dist/assets/{search-CPePg8x3.js → search-goAiPVWh.js} +1 -1
  45. package/web/dist/assets/{square-terminal-DwJxHx2m.js → square-terminal-BS_g8jLI.js} +1 -1
  46. package/web/dist/index.html +2 -2
  47. package/web/dist/sw.js +1 -1
  48. package/dist/src/server/sentinel-heartbeat.d.ts +0 -30
  49. package/dist/src/server/sentinel-heartbeat.js +0 -145
  50. package/web/dist/assets/AddWorkerDialog-CPQkMvDz.js +0 -2
  51. package/web/dist/assets/AddWorkspaceFlow-CkOOz4Kj.js +0 -1
  52. package/web/dist/assets/WorkerModal-BN3jQTBO.js +0 -1
  53. package/web/dist/assets/WorkspaceMemoryDrawer-DVZT9TqV.js +0 -1
  54. package/web/dist/assets/index-Cs7E1UKt.css +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspaceTaskDrawer-C14sALb8.js","assets/TaskGraphDrawer-DRVJ4Z7z.js","assets/AddWorkerDialog-CPQkMvDz.js","assets/search-CPePg8x3.js","assets/square-terminal-DwJxHx2m.js","assets/WorkflowsDrawer-Clv5ROhE.js","assets/WorkspaceMemoryDrawer-DVZT9TqV.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspaceTaskDrawer-DdAAFy8G.js","assets/TaskGraphDrawer-Bc3ntINN.js","assets/AddWorkerDialog-BrvNv3RW.js","assets/search-goAiPVWh.js","assets/square-terminal-BS_g8jLI.js","assets/WorkflowsDrawer-_JG5sK9V.js","assets/WorkspaceMemoryDrawer-CmesL_Hn.js"])))=>i.map(i=>d[i]);
2
2
  function J2(t,a){for(var o=0;o<a.length;o++){const s=a[o];if(typeof s!="string"&&!Array.isArray(s)){for(const l in s)if(l!=="default"&&!(l in t)){const u=Object.getOwnPropertyDescriptor(s,l);u&&Object.defineProperty(t,l,u.get?u:{enumerable:!0,get:()=>s[l]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function o(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(l){if(l.ep)return;l.ep=!0;const u=o(l);fetch(l.href,u)}})();function n0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Jd={exports:{}},Bs={};var iy;function eS(){if(iy)return Bs;iy=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function o(s,l,u){var f=null;if(u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+l.key),"key"in l){u={};for(var m in l)m!=="key"&&(u[m]=l[m])}else u=l;return l=u.ref,{$$typeof:t,type:s,key:f,ref:l!==void 0?l:null,props:u}}return Bs.Fragment=a,Bs.jsx=o,Bs.jsxs=o,Bs}var ly;function tS(){return ly||(ly=1,Jd.exports=eS()),Jd.exports}var c=tS(),ef={exports:{}},je={};var cy;function nS(){if(cy)return je;cy=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),k=Symbol.iterator;function E(R){return R===null||typeof R!="object"?null:(R=k&&R[k]||R["@@iterator"],typeof R=="function"?R:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,C={};function T(R,B,se){this.props=R,this.context=B,this.refs=C,this.updater=se||S}T.prototype.isReactComponent={},T.prototype.setState=function(R,B){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,B,"setState")},T.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function N(){}N.prototype=T.prototype;function j(R,B,se){this.props=R,this.context=B,this.refs=C,this.updater=se||S}var A=j.prototype=new N;A.constructor=j,w(A,T.prototype),A.isPureReactComponent=!0;var O=Array.isArray;function D(){}var L={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function J(R,B,se){var re=se.ref;return{$$typeof:t,type:R,key:B,ref:re!==void 0?re:null,props:se}}function Q(R,B){return J(R.type,B,R.props)}function $(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function F(R){var B={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(se){return B[se]})}var ne=/\/+/g;function Z(R,B){return typeof R=="object"&&R!==null&&R.key!=null?F(""+R.key):B.toString(36)}function q(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(D,D):(R.status="pending",R.then(function(B){R.status==="pending"&&(R.status="fulfilled",R.value=B)},function(B){R.status==="pending"&&(R.status="rejected",R.reason=B)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function M(R,B,se,re,ce){var fe=typeof R;(fe==="undefined"||fe==="boolean")&&(R=null);var ue=!1;if(R===null)ue=!0;else switch(fe){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(R.$$typeof){case t:case a:ue=!0;break;case b:return ue=R._init,M(ue(R._payload),B,se,re,ce)}}if(ue)return ce=ce(R),ue=re===""?"."+Z(R,0):re,O(ce)?(se="",ue!=null&&(se=ue.replace(ne,"$&/")+"/"),M(ce,B,se,"",function(xe){return xe})):ce!=null&&($(ce)&&(ce=Q(ce,se+(ce.key==null||R&&R.key===ce.key?"":(""+ce.key).replace(ne,"$&/")+"/")+ue)),B.push(ce)),1;ue=0;var le=re===""?".":re+":";if(O(R))for(var ie=0;ie<R.length;ie++)re=R[ie],fe=le+Z(re,ie),ue+=M(re,B,se,fe,ce);else if(ie=E(R),typeof ie=="function")for(R=ie.call(R),ie=0;!(re=R.next()).done;)re=re.value,fe=le+Z(re,ie++),ue+=M(re,B,se,fe,ce);else if(fe==="object"){if(typeof R.then=="function")return M(q(R),B,se,re,ce);throw B=String(R),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return ue}function U(R,B,se){if(R==null)return R;var re=[],ce=0;return M(R,re,"","",function(fe){return B.call(se,fe,ce++)}),re}function W(R){if(R._status===-1){var B=R._result;B=B(),B.then(function(se){(R._status===0||R._status===-1)&&(R._status=1,R._result=se)},function(se){(R._status===0||R._status===-1)&&(R._status=2,R._result=se)}),R._status===-1&&(R._status=0,R._result=B)}if(R._status===1)return R._result.default;throw R._result}var G=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},V={map:U,forEach:function(R,B,se){U(R,function(){B.apply(this,arguments)},se)},count:function(R){var B=0;return U(R,function(){B++}),B},toArray:function(R){return U(R,function(B){return B})||[]},only:function(R){if(!$(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return je.Activity=v,je.Children=V,je.Component=T,je.Fragment=o,je.Profiler=l,je.PureComponent=j,je.StrictMode=s,je.Suspense=g,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,je.__COMPILER_RUNTIME={__proto__:null,c:function(R){return L.H.useMemoCache(R)}},je.cache=function(R){return function(){return R.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(R,B,se){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var re=w({},R.props),ce=R.key;if(B!=null)for(fe in B.key!==void 0&&(ce=""+B.key),B)!P.call(B,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&B.ref===void 0||(re[fe]=B[fe]);var fe=arguments.length-2;if(fe===1)re.children=se;else if(1<fe){for(var ue=Array(fe),le=0;le<fe;le++)ue[le]=arguments[le+2];re.children=ue}return J(R.type,ce,re)},je.createContext=function(R){return R={$$typeof:f,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},je.createElement=function(R,B,se){var re,ce={},fe=null;if(B!=null)for(re in B.key!==void 0&&(fe=""+B.key),B)P.call(B,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(ce[re]=B[re]);var ue=arguments.length-2;if(ue===1)ce.children=se;else if(1<ue){for(var le=Array(ue),ie=0;ie<ue;ie++)le[ie]=arguments[ie+2];ce.children=le}if(R&&R.defaultProps)for(re in ue=R.defaultProps,ue)ce[re]===void 0&&(ce[re]=ue[re]);return J(R,fe,ce)},je.createRef=function(){return{current:null}},je.forwardRef=function(R){return{$$typeof:m,render:R}},je.isValidElement=$,je.lazy=function(R){return{$$typeof:b,_payload:{_status:-1,_result:R},_init:W}},je.memo=function(R,B){return{$$typeof:p,type:R,compare:B===void 0?null:B}},je.startTransition=function(R){var B=L.T,se={};L.T=se;try{var re=R(),ce=L.S;ce!==null&&ce(se,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(D,G)}catch(fe){G(fe)}finally{B!==null&&se.types!==null&&(B.types=se.types),L.T=B}},je.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},je.use=function(R){return L.H.use(R)},je.useActionState=function(R,B,se){return L.H.useActionState(R,B,se)},je.useCallback=function(R,B){return L.H.useCallback(R,B)},je.useContext=function(R){return L.H.useContext(R)},je.useDebugValue=function(){},je.useDeferredValue=function(R,B){return L.H.useDeferredValue(R,B)},je.useEffect=function(R,B){return L.H.useEffect(R,B)},je.useEffectEvent=function(R){return L.H.useEffectEvent(R)},je.useId=function(){return L.H.useId()},je.useImperativeHandle=function(R,B,se){return L.H.useImperativeHandle(R,B,se)},je.useInsertionEffect=function(R,B){return L.H.useInsertionEffect(R,B)},je.useLayoutEffect=function(R,B){return L.H.useLayoutEffect(R,B)},je.useMemo=function(R,B){return L.H.useMemo(R,B)},je.useOptimistic=function(R,B){return L.H.useOptimistic(R,B)},je.useReducer=function(R,B,se){return L.H.useReducer(R,B,se)},je.useRef=function(R){return L.H.useRef(R)},je.useState=function(R){return L.H.useState(R)},je.useSyncExternalStore=function(R,B,se){return L.H.useSyncExternalStore(R,B,se)},je.useTransition=function(){return L.H.useTransition()},je.version="19.2.5",je}var uy;function jm(){return uy||(uy=1,ef.exports=nS()),ef.exports}var y=jm();const aS=n0(y),a0=J2({__proto__:null,default:aS},[y]);var tf={exports:{}},Ws={},nf={exports:{}},af={};var dy;function rS(){return dy||(dy=1,(function(t){function a(M,U){var W=M.length;M.push(U);e:for(;0<W;){var G=W-1>>>1,V=M[G];if(0<l(V,U))M[G]=U,M[W]=V,W=G;else break e}}function o(M){return M.length===0?null:M[0]}function s(M){if(M.length===0)return null;var U=M[0],W=M.pop();if(W!==U){M[0]=W;e:for(var G=0,V=M.length,R=V>>>1;G<R;){var B=2*(G+1)-1,se=M[B],re=B+1,ce=M[re];if(0>l(se,W))re<V&&0>l(ce,se)?(M[G]=ce,M[re]=W,G=re):(M[G]=se,M[B]=W,G=B);else if(re<V&&0>l(ce,W))M[G]=ce,M[re]=W,G=re;else break e}}return U}function l(M,U){var W=M.sortIndex-U.sortIndex;return W!==0?W:M.id-U.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();t.unstable_now=function(){return f.now()-m}}var g=[],p=[],b=1,v=null,k=3,E=!1,S=!1,w=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function A(M){for(var U=o(p);U!==null;){if(U.callback===null)s(p);else if(U.startTime<=M)s(p),U.sortIndex=U.expirationTime,a(g,U);else break;U=o(p)}}function O(M){if(w=!1,A(M),!S)if(o(g)!==null)S=!0,D||(D=!0,F());else{var U=o(p);U!==null&&q(O,U.startTime-M)}}var D=!1,L=-1,P=5,J=-1;function Q(){return C?!0:!(t.unstable_now()-J<P)}function $(){if(C=!1,D){var M=t.unstable_now();J=M;var U=!0;try{e:{S=!1,w&&(w=!1,N(L),L=-1),E=!0;var W=k;try{t:{for(A(M),v=o(g);v!==null&&!(v.expirationTime>M&&Q());){var G=v.callback;if(typeof G=="function"){v.callback=null,k=v.priorityLevel;var V=G(v.expirationTime<=M);if(M=t.unstable_now(),typeof V=="function"){v.callback=V,A(M),U=!0;break t}v===o(g)&&s(g),A(M)}else s(g);v=o(g)}if(v!==null)U=!0;else{var R=o(p);R!==null&&q(O,R.startTime-M),U=!1}}break e}finally{v=null,k=W,E=!1}U=void 0}}finally{U?F():D=!1}}}var F;if(typeof j=="function")F=function(){j($)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,Z=ne.port2;ne.port1.onmessage=$,F=function(){Z.postMessage(null)}}else F=function(){T($,0)};function q(M,U){L=T(function(){M(t.unstable_now())},U)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(M){M.callback=null},t.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<M?Math.floor(1e3/M):5},t.unstable_getCurrentPriorityLevel=function(){return k},t.unstable_next=function(M){switch(k){case 1:case 2:case 3:var U=3;break;default:U=k}var W=k;k=U;try{return M()}finally{k=W}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(M,U){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var W=k;k=M;try{return U()}finally{k=W}},t.unstable_scheduleCallback=function(M,U,W){var G=t.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?G+W:G):W=G,M){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=W+V,M={id:b++,callback:U,priorityLevel:M,startTime:W,expirationTime:V,sortIndex:-1},W>G?(M.sortIndex=W,a(p,M),o(g)===null&&M===o(p)&&(w?(N(L),L=-1):w=!0,q(O,W-G))):(M.sortIndex=V,a(g,M),S||E||(S=!0,D||(D=!0,F()))),M},t.unstable_shouldYield=Q,t.unstable_wrapCallback=function(M){var U=k;return function(){var W=k;k=U;try{return M.apply(this,arguments)}finally{k=W}}}})(af)),af}var fy;function oS(){return fy||(fy=1,nf.exports=rS()),nf.exports}var rf={exports:{}},jt={};var my;function sS(){if(my)return jt;my=1;var t=jm();function a(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(){}var s={d:{f:o,r:function(){throw Error(a(522))},D:o,C:o,L:o,m:o,X:o,S:o,M:o},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(g,p,b){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:v==null?null:""+v,children:g,containerInfo:p,implementation:b}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,jt.createPortal=function(g,p){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(a(299));return u(g,p,null,b)},jt.flushSync=function(g){var p=f.T,b=s.p;try{if(f.T=null,s.p=2,g)return g()}finally{f.T=p,s.p=b,s.d.f()}},jt.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,s.d.C(g,p))},jt.prefetchDNS=function(g){typeof g=="string"&&s.d.D(g)},jt.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var b=p.as,v=m(b,p.crossOrigin),k=typeof p.integrity=="string"?p.integrity:void 0,E=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?s.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:k,fetchPriority:E}):b==="script"&&s.d.X(g,{crossOrigin:v,integrity:k,fetchPriority:E,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},jt.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=m(p.as,p.crossOrigin);s.d.M(g,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&s.d.M(g)},jt.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,v=m(b,p.crossOrigin);s.d.L(g,b,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},jt.preloadModule=function(g,p){if(typeof g=="string")if(p){var b=m(p.as,p.crossOrigin);s.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else s.d.m(g)},jt.requestFormReset=function(g){s.d.r(g)},jt.unstable_batchedUpdates=function(g,p){return g(p)},jt.useFormState=function(g,p,b){return f.H.useFormState(g,p,b)},jt.useFormStatus=function(){return f.H.useHostTransitionStatus()},jt.version="19.2.5",jt}var py;function r0(){if(py)return rf.exports;py=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),rf.exports=sS(),rf.exports}var hy;function iS(){if(hy)return Ws;hy=1;var t=oS(),a=jm(),o=r0();function s(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,r=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(r=n.return),e=n.return;while(e)}return n.tag===3?r:null}function f(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(u(e)!==e)throw Error(s(188))}function p(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(s(188));return n!==e?null:e}for(var r=e,i=n;;){var d=r.return;if(d===null)break;var h=d.alternate;if(h===null){if(i=d.return,i!==null){r=i;continue}break}if(d.child===h.child){for(h=d.child;h;){if(h===r)return g(d),e;if(h===i)return g(d),n;h=h.sibling}throw Error(s(188))}if(r.return!==i.return)r=d,i=h;else{for(var x=!1,_=d.child;_;){if(_===r){x=!0,r=d,i=h;break}if(_===i){x=!0,i=d,r=h;break}_=_.sibling}if(!x){for(_=h.child;_;){if(_===r){x=!0,r=h,i=d;break}if(_===i){x=!0,i=h,r=d;break}_=_.sibling}if(!x)throw Error(s(189))}}if(r.alternate!==i)throw Error(s(190))}if(r.tag!==3)throw Error(s(188));return r.stateNode.current===r?e:n}function b(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=b(e),n!==null)return n;e=e.sibling}return null}var v=Object.assign,k=Symbol.for("react.element"),E=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),j=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function F(e){return e===null||typeof e!="object"?null:(e=$&&e[$]||e["@@iterator"],typeof e=="function"?e:null)}var ne=Symbol.for("react.client.reference");function Z(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case T:return"Profiler";case C:return"StrictMode";case O:return"Suspense";case D:return"SuspenseList";case J:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case j:return e.displayName||"Context";case N:return(e._context.displayName||"Context")+".Consumer";case A:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return n=e.displayName||null,n!==null?n:Z(e.type)||"Memo";case P:n=e._payload,e=e._init;try{return Z(e(n))}catch{}}return null}var q=Array.isArray,M=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},G=[],V=-1;function R(e){return{current:e}}function B(e){0>V||(e.current=G[V],G[V]=null,V--)}function se(e,n){V++,G[V]=e.current,e.current=n}var re=R(null),ce=R(null),fe=R(null),ue=R(null);function le(e,n){switch(se(fe,n),se(ce,e),se(re,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?_v(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=_v(n),e=Rv(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}B(re),se(re,e)}function ie(){B(re),B(ce),B(fe)}function xe(e){e.memoizedState!==null&&se(ue,e);var n=re.current,r=Rv(n,e.type);n!==r&&(se(ce,e),se(re,r))}function Ne(e){ce.current===e&&(B(re),B(ce)),ue.current===e&&(B(ue),Ls._currentValue=W)}var he,we;function Ce(e){if(he===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);he=n&&n[1]||"",we=-1<r.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+he+e+we}var Ae=!1;function pt(e,n){if(!e||Ae)return"";Ae=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(n){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(ee){var X=ee}Reflect.construct(e,[],oe)}else{try{oe.call()}catch(ee){X=ee}e.call(oe.prototype)}}else{try{throw Error()}catch(ee){X=ee}(oe=e())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(ee){if(ee&&X&&typeof ee.stack=="string")return[ee.stack,X.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=i.DetermineComponentFrameRoot(),x=h[0],_=h[1];if(x&&_){var z=x.split(`
@@ -7,9 +7,9 @@ function J2(t,a){for(var o=0;o<a.length;o++){const s=a[o];if(typeof s!="string"&
7
7
  `+z[i].replace(" at new "," at ");return e.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",e.displayName)),te}while(1<=i&&0<=d);break}}}finally{Ae=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?Ce(r):""}function dt(e,n){switch(e.tag){case 26:case 27:case 5:return Ce(e.type);case 16:return Ce("Lazy");case 13:return e.child!==n&&n!==null?Ce("Suspense Fallback"):Ce("Suspense");case 19:return Ce("SuspenseList");case 0:case 15:return pt(e.type,!1);case 11:return pt(e.type.render,!1);case 1:return pt(e.type,!0);case 31:return Ce("Activity");default:return""}}function wn(e){try{var n="",r=null;do n+=dt(e,r),r=e,e=e.return;while(e);return n}catch(i){return`
8
8
  Error generating stack: `+i.message+`
9
9
  `+i.stack}}var Nt=Object.prototype.hasOwnProperty,Fn=t.unstable_scheduleCallback,ft=t.unstable_cancelCallback,zt=t.unstable_shouldYield,ln=t.unstable_requestPaint,Se=t.unstable_now,nt=t.unstable_getCurrentPriorityLevel,ar=t.unstable_ImmediatePriority,rr=t.unstable_UserBlockingPriority,de=t.unstable_NormalPriority,Ue=t.unstable_LowPriority,st=t.unstable_IdlePriority,Kn=t.log,or=t.unstable_setDisableYieldValue,ya=null,bt=null;function xn(e){if(typeof Kn=="function"&&or(e),bt&&typeof bt.setStrictMode=="function")try{bt.setStrictMode(ya,e)}catch{}}var ht=Math.clz32?Math.clz32:Ot,Te=Math.log,De=Math.LN2;function Ot(e){return e>>>=0,e===0?32:31-(Te(e)/De|0)|0}var ba=256,gi=262144,vi=4194304;function sr(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function yi(e,n,r){var i=e.pendingLanes;if(i===0)return 0;var d=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var _=i&134217727;return _!==0?(i=_&~h,i!==0?d=sr(i):(x&=_,x!==0?d=sr(x):r||(r=_&~e,r!==0&&(d=sr(r))))):(_=i&~h,_!==0?d=sr(_):x!==0?d=sr(x):r||(r=i&~e,r!==0&&(d=sr(r)))),d===0?0:n!==0&&n!==d&&(n&h)===0&&(h=d&-d,r=n&-n,h>=r||h===32&&(r&4194048)!==0)?n:d}function Vo(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function W1(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function dp(){var e=vi;return vi<<=1,(vi&62914560)===0&&(vi=4194304),e}function Ic(e){for(var n=[],r=0;31>r;r++)n.push(e);return n}function Go(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function I1(e,n,r,i,d,h){var x=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var _=e.entanglements,z=e.expirationTimes,Y=e.hiddenUpdates;for(r=x&~r;0<r;){var te=31-ht(r),oe=1<<te;_[te]=0,z[te]=-1;var X=Y[te];if(X!==null)for(Y[te]=null,te=0;te<X.length;te++){var ee=X[te];ee!==null&&(ee.lane&=-536870913)}r&=~oe}i!==0&&fp(e,i,0),h!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function fp(e,n,r){e.pendingLanes|=n,e.suspendedLanes&=~n;var i=31-ht(n);e.entangledLanes|=n,e.entanglements[i]=e.entanglements[i]|1073741824|r&261930}function mp(e,n){var r=e.entangledLanes|=n;for(e=e.entanglements;r;){var i=31-ht(r),d=1<<i;d&n|e[i]&n&&(e[i]|=n),r&=~d}}function pp(e,n){var r=n&-n;return r=(r&42)!==0?1:qc(r),(r&(e.suspendedLanes|n))!==0?0:r}function qc(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Pc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function hp(){var e=U.p;return e!==0?e:(e=window.event,e===void 0?32:ey(e.type))}function gp(e,n){var r=U.p;try{return U.p=e,n()}finally{U.p=r}}var wa=Math.random().toString(36).slice(2),wt="__reactFiber$"+wa,Ht="__reactProps$"+wa,Br="__reactContainer$"+wa,Fc="__reactEvents$"+wa,q1="__reactListeners$"+wa,P1="__reactHandles$"+wa,vp="__reactResources$"+wa,Xo="__reactMarker$"+wa;function Kc(e){delete e[wt],delete e[Ht],delete e[Fc],delete e[q1],delete e[P1]}function Wr(e){var n=e[wt];if(n)return n;for(var r=e.parentNode;r;){if(n=r[Br]||r[wt]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(e=Uv(e);e!==null;){if(r=e[wt])return r;e=Uv(e)}return n}e=r,r=e.parentNode}return null}function Ir(e){if(e=e[wt]||e[Br]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Zo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(s(33))}function qr(e){var n=e[vp];return n||(n=e[vp]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function gt(e){e[Xo]=!0}var yp=new Set,bp={};function ir(e,n){Pr(e,n),Pr(e+"Capture",n)}function Pr(e,n){for(bp[e]=n,e=0;e<n.length;e++)yp.add(n[e])}var F1=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),wp={},xp={};function K1(e){return Nt.call(xp,e)?!0:Nt.call(wp,e)?!1:F1.test(e)?xp[e]=!0:(wp[e]=!0,!1)}function bi(e,n,r){if(K1(n))if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var i=n.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+r)}}function wi(e,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+r)}}function Yn(e,n,r,i){if(i===null)e.removeAttribute(r);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(n,r,""+i)}}function cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function kp(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Y1(e,n,r){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var d=i.get,h=i.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(x){r=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(x){r=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Yc(e){if(!e._valueTracker){var n=kp(e)?"checked":"value";e._valueTracker=Y1(e,n,""+e[n])}}function Sp(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var r=n.getValue(),i="";return e&&(i=kp(e)?e.checked?"true":"false":e.value),e=i,e!==r?(n.setValue(e),!0):!1}function xi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var $1=/[\n"\\]/g;function un(e){return e.replace($1,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function $c(e,n,r,i,d,h,x,_){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+cn(n)):e.value!==""+cn(n)&&(e.value=""+cn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Vc(e,x,cn(n)):r!=null?Vc(e,x,cn(r)):i!=null&&e.removeAttribute("value"),d==null&&h!=null&&(e.defaultChecked=!!h),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.name=""+cn(_):e.removeAttribute("name")}function Ep(e,n,r,i,d,h,x,_){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){Yc(e);return}r=r!=null?""+cn(r):"",n=n!=null?""+cn(n):r,_||n===e.value||(e.value=n),e.defaultValue=n}i=i??d,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=_?e.checked:!!i,e.defaultChecked=!!i,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),Yc(e)}function Vc(e,n,r){n==="number"&&xi(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function Fr(e,n,r,i){if(e=e.options,n){n={};for(var d=0;d<r.length;d++)n["$"+r[d]]=!0;for(r=0;r<e.length;r++)d=n.hasOwnProperty("$"+e[r].value),e[r].selected!==d&&(e[r].selected=d),d&&i&&(e[r].defaultSelected=!0)}else{for(r=""+cn(r),n=null,d=0;d<e.length;d++){if(e[d].value===r){e[d].selected=!0,i&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function Cp(e,n,r){if(n!=null&&(n=""+cn(n),n!==e.value&&(e.value=n),r==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=r!=null?""+cn(r):""}function Tp(e,n,r,i){if(n==null){if(i!=null){if(r!=null)throw Error(s(92));if(q(i)){if(1<i.length)throw Error(s(93));i=i[0]}r=i}r==null&&(r=""),n=r}r=cn(n),e.defaultValue=r,i=e.textContent,i===r&&i!==""&&i!==null&&(e.value=i),Yc(e)}function Kr(e,n){if(n){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=n;return}}e.textContent=n}var V1=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Np(e,n,r){var i=n.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?i?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":i?e.setProperty(n,r):typeof r!="number"||r===0||V1.has(n)?n==="float"?e.cssFloat=r:e[n]=(""+r).trim():e[n]=r+"px"}function jp(e,n,r){if(n!=null&&typeof n!="object")throw Error(s(62));if(e=e.style,r!=null){for(var i in r)!r.hasOwnProperty(i)||n!=null&&n.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var d in n)i=n[d],n.hasOwnProperty(d)&&r[d]!==i&&Np(e,d,i)}else for(var h in n)n.hasOwnProperty(h)&&Np(e,h,n[h])}function Gc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var G1=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),X1=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ki(e){return X1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function $n(){}var Xc=null;function Zc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yr=null,$r=null;function Ap(e){var n=Ir(e);if(n&&(e=n.stateNode)){var r=e[Ht]||null;e:switch(e=n.stateNode,n.type){case"input":if($c(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),n=r.name,r.type==="radio"&&n!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+un(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var i=r[n];if(i!==e&&i.form===e.form){var d=i[Ht]||null;if(!d)throw Error(s(90));$c(i,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<r.length;n++)i=r[n],i.form===e.form&&Sp(i)}break e;case"textarea":Cp(e,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&Fr(e,!!r.multiple,n,!1)}}}var Qc=!1;function _p(e,n,r){if(Qc)return e(n,r);Qc=!0;try{var i=e(n);return i}finally{if(Qc=!1,(Yr!==null||$r!==null)&&(cl(),Yr&&(n=Yr,e=$r,$r=Yr=null,Ap(n),e)))for(n=0;n<e.length;n++)Ap(e[n])}}function Qo(e,n){var r=e.stateNode;if(r===null)return null;var i=r[Ht]||null;if(i===null)return null;r=i[n];e:switch(n){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 e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(s(231,n,typeof r));return r}var Vn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jc=!1;if(Vn)try{var Jo={};Object.defineProperty(Jo,"passive",{get:function(){Jc=!0}}),window.addEventListener("test",Jo,Jo),window.removeEventListener("test",Jo,Jo)}catch{Jc=!1}var xa=null,eu=null,Si=null;function Rp(){if(Si)return Si;var e,n=eu,r=n.length,i,d="value"in xa?xa.value:xa.textContent,h=d.length;for(e=0;e<r&&n[e]===d[e];e++);var x=r-e;for(i=1;i<=x&&n[r-i]===d[h-i];i++);return Si=d.slice(e,1<i?1-i:void 0)}function Ei(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ci(){return!0}function Op(){return!1}function Ut(e){function n(r,i,d,h,x){this._reactName=r,this._targetInst=d,this.type=i,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var _ in e)e.hasOwnProperty(_)&&(r=e[_],this[_]=r?r(h):h[_]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Ci:Op,this.isPropagationStopped=Op,this}return v(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Ci)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ci)},persist:function(){},isPersistent:Ci}),n}var lr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ti=Ut(lr),es=v({},lr,{view:0,detail:0}),Z1=Ut(es),tu,nu,ts,Ni=v({},es,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ru,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!==ts&&(ts&&e.type==="mousemove"?(tu=e.screenX-ts.screenX,nu=e.screenY-ts.screenY):nu=tu=0,ts=e),tu)},movementY:function(e){return"movementY"in e?e.movementY:nu}}),Dp=Ut(Ni),Q1=v({},Ni,{dataTransfer:0}),J1=Ut(Q1),ek=v({},es,{relatedTarget:0}),au=Ut(ek),tk=v({},lr,{animationName:0,elapsedTime:0,pseudoElement:0}),nk=Ut(tk),ak=v({},lr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),rk=Ut(ak),ok=v({},lr,{data:0}),Mp=Ut(ok),sk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ik={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"},lk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ck(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=lk[e])?!!n[e]:!1}function ru(){return ck}var uk=v({},es,{key:function(e){if(e.key){var n=sk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Ei(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ik[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ru,charCode:function(e){return e.type==="keypress"?Ei(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ei(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),dk=Ut(uk),fk=v({},Ni,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lp=Ut(fk),mk=v({},es,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ru}),pk=Ut(mk),hk=v({},lr,{propertyName:0,elapsedTime:0,pseudoElement:0}),gk=Ut(hk),vk=v({},Ni,{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}),yk=Ut(vk),bk=v({},lr,{newState:0,oldState:0}),wk=Ut(bk),xk=[9,13,27,32],ou=Vn&&"CompositionEvent"in window,ns=null;Vn&&"documentMode"in document&&(ns=document.documentMode);var kk=Vn&&"TextEvent"in window&&!ns,zp=Vn&&(!ou||ns&&8<ns&&11>=ns),Hp=" ",Up=!1;function Bp(e,n){switch(e){case"keyup":return xk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Vr=!1;function Sk(e,n){switch(e){case"compositionend":return Wp(n);case"keypress":return n.which!==32?null:(Up=!0,Hp);case"textInput":return e=n.data,e===Hp&&Up?null:e;default:return null}}function Ek(e,n){if(Vr)return e==="compositionend"||!ou&&Bp(e,n)?(e=Rp(),Si=eu=xa=null,Vr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return zp&&n.locale!=="ko"?null:n.data;default:return null}}var Ck={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 Ip(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Ck[e.type]:n==="textarea"}function qp(e,n,r,i){Yr?$r?$r.push(i):$r=[i]:Yr=i,n=gl(n,"onChange"),0<n.length&&(r=new Ti("onChange","change",null,r,i),e.push({event:r,listeners:n}))}var as=null,rs=null;function Tk(e){Ev(e,0)}function ji(e){var n=Zo(e);if(Sp(n))return e}function Pp(e,n){if(e==="change")return n}var Fp=!1;if(Vn){var su;if(Vn){var iu="oninput"in document;if(!iu){var Kp=document.createElement("div");Kp.setAttribute("oninput","return;"),iu=typeof Kp.oninput=="function"}su=iu}else su=!1;Fp=su&&(!document.documentMode||9<document.documentMode)}function Yp(){as&&(as.detachEvent("onpropertychange",$p),rs=as=null)}function $p(e){if(e.propertyName==="value"&&ji(rs)){var n=[];qp(n,rs,e,Zc(e)),_p(Tk,n)}}function Nk(e,n,r){e==="focusin"?(Yp(),as=n,rs=r,as.attachEvent("onpropertychange",$p)):e==="focusout"&&Yp()}function jk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ji(rs)}function Ak(e,n){if(e==="click")return ji(n)}function _k(e,n){if(e==="input"||e==="change")return ji(n)}function Rk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Gt=typeof Object.is=="function"?Object.is:Rk;function os(e,n){if(Gt(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var r=Object.keys(e),i=Object.keys(n);if(r.length!==i.length)return!1;for(i=0;i<r.length;i++){var d=r[i];if(!Nt.call(n,d)||!Gt(e[d],n[d]))return!1}return!0}function Vp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gp(e,n){var r=Vp(e);e=0;for(var i;r;){if(r.nodeType===3){if(i=e+r.textContent.length,e<=n&&i>=n)return{node:r,offset:n-e};e=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Vp(r)}}function Xp(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Xp(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Zp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=xi(e.document);n instanceof e.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)e=n.contentWindow;else break;n=xi(e.document)}return n}function lu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Ok=Vn&&"documentMode"in document&&11>=document.documentMode,Gr=null,cu=null,ss=null,uu=!1;function Qp(e,n,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;uu||Gr==null||Gr!==xi(i)||(i=Gr,"selectionStart"in i&&lu(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),ss&&os(ss,i)||(ss=i,i=gl(cu,"onSelect"),0<i.length&&(n=new Ti("onSelect","select",null,n,r),e.push({event:n,listeners:i}),n.target=Gr)))}function cr(e,n){var r={};return r[e.toLowerCase()]=n.toLowerCase(),r["Webkit"+e]="webkit"+n,r["Moz"+e]="moz"+n,r}var Xr={animationend:cr("Animation","AnimationEnd"),animationiteration:cr("Animation","AnimationIteration"),animationstart:cr("Animation","AnimationStart"),transitionrun:cr("Transition","TransitionRun"),transitionstart:cr("Transition","TransitionStart"),transitioncancel:cr("Transition","TransitionCancel"),transitionend:cr("Transition","TransitionEnd")},du={},Jp={};Vn&&(Jp=document.createElement("div").style,"AnimationEvent"in window||(delete Xr.animationend.animation,delete Xr.animationiteration.animation,delete Xr.animationstart.animation),"TransitionEvent"in window||delete Xr.transitionend.transition);function ur(e){if(du[e])return du[e];if(!Xr[e])return e;var n=Xr[e],r;for(r in n)if(n.hasOwnProperty(r)&&r in Jp)return du[e]=n[r];return e}var eh=ur("animationend"),th=ur("animationiteration"),nh=ur("animationstart"),Dk=ur("transitionrun"),Mk=ur("transitionstart"),Lk=ur("transitioncancel"),ah=ur("transitionend"),rh=new Map,fu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");fu.push("scrollEnd");function kn(e,n){rh.set(e,n),ir(n,[e])}var Ai=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},dn=[],Zr=0,mu=0;function _i(){for(var e=Zr,n=mu=Zr=0;n<e;){var r=dn[n];dn[n++]=null;var i=dn[n];dn[n++]=null;var d=dn[n];dn[n++]=null;var h=dn[n];if(dn[n++]=null,i!==null&&d!==null){var x=i.pending;x===null?d.next=d:(d.next=x.next,x.next=d),i.pending=d}h!==0&&oh(r,d,h)}}function Ri(e,n,r,i){dn[Zr++]=e,dn[Zr++]=n,dn[Zr++]=r,dn[Zr++]=i,mu|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function pu(e,n,r,i){return Ri(e,n,r,i),Oi(e)}function dr(e,n){return Ri(e,null,null,n),Oi(e)}function oh(e,n,r){e.lanes|=r;var i=e.alternate;i!==null&&(i.lanes|=r);for(var d=!1,h=e.return;h!==null;)h.childLanes|=r,i=h.alternate,i!==null&&(i.childLanes|=r),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(d=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,d&&n!==null&&(d=31-ht(r),e=h.hiddenUpdates,i=e[d],i===null?e[d]=[n]:i.push(n),n.lane=r|536870912),h):null}function Oi(e){if(50<js)throw js=0,Sd=null,Error(s(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Qr={};function zk(e,n,r,i){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xt(e,n,r,i){return new zk(e,n,r,i)}function hu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Gn(e,n){var r=e.alternate;return r===null?(r=Xt(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function sh(e,n){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,n=r.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Di(e,n,r,i,d,h){var x=0;if(i=e,typeof e=="function")hu(e)&&(x=1);else if(typeof e=="string")x=I2(e,r,re.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case J:return e=Xt(31,r,n,d),e.elementType=J,e.lanes=h,e;case w:return fr(r.children,d,h,n);case C:x=8,d|=24;break;case T:return e=Xt(12,r,n,d|2),e.elementType=T,e.lanes=h,e;case O:return e=Xt(13,r,n,d),e.elementType=O,e.lanes=h,e;case D:return e=Xt(19,r,n,d),e.elementType=D,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case j:x=10;break e;case N:x=9;break e;case A:x=11;break e;case L:x=14;break e;case P:x=16,i=null;break e}x=29,r=Error(s(130,e===null?"null":typeof e,"")),i=null}return n=Xt(x,r,n,d),n.elementType=e,n.type=i,n.lanes=h,n}function fr(e,n,r,i){return e=Xt(7,e,i,n),e.lanes=r,e}function gu(e,n,r){return e=Xt(6,e,null,n),e.lanes=r,e}function ih(e){var n=Xt(18,null,null,0);return n.stateNode=e,n}function vu(e,n,r){return n=Xt(4,e.children!==null?e.children:[],e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var lh=new WeakMap;function fn(e,n){if(typeof e=="object"&&e!==null){var r=lh.get(e);return r!==void 0?r:(n={value:e,source:n,stack:wn(n)},lh.set(e,n),n)}return{value:e,source:n,stack:wn(n)}}var Jr=[],eo=0,Mi=null,is=0,mn=[],pn=0,ka=null,On=1,Dn="";function Xn(e,n){Jr[eo++]=is,Jr[eo++]=Mi,Mi=e,is=n}function ch(e,n,r){mn[pn++]=On,mn[pn++]=Dn,mn[pn++]=ka,ka=e;var i=On;e=Dn;var d=32-ht(i)-1;i&=~(1<<d),r+=1;var h=32-ht(n)+d;if(30<h){var x=d-d%5;h=(i&(1<<x)-1).toString(32),i>>=x,d-=x,On=1<<32-ht(n)+d|r<<d|i,Dn=h+e}else On=1<<h|r<<d|i,Dn=e}function yu(e){e.return!==null&&(Xn(e,1),ch(e,1,0))}function bu(e){for(;e===Mi;)Mi=Jr[--eo],Jr[eo]=null,is=Jr[--eo],Jr[eo]=null;for(;e===ka;)ka=mn[--pn],mn[pn]=null,Dn=mn[--pn],mn[pn]=null,On=mn[--pn],mn[pn]=null}function uh(e,n){mn[pn++]=On,mn[pn++]=Dn,mn[pn++]=ka,On=n.id,Dn=n.overflow,ka=e}var xt=null,Xe=null,Be=!1,Sa=null,hn=!1,wu=Error(s(519));function Ea(e){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ls(fn(n,e)),wu}function dh(e){var n=e.stateNode,r=e.type,i=e.memoizedProps;switch(n[wt]=e,n[Ht]=i,r){case"dialog":Le("cancel",n),Le("close",n);break;case"iframe":case"object":case"embed":Le("load",n);break;case"video":case"audio":for(r=0;r<_s.length;r++)Le(_s[r],n);break;case"source":Le("error",n);break;case"img":case"image":case"link":Le("error",n),Le("load",n);break;case"details":Le("toggle",n);break;case"input":Le("invalid",n),Ep(n,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Le("invalid",n);break;case"textarea":Le("invalid",n),Tp(n,i.value,i.defaultValue,i.children)}r=i.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||n.textContent===""+r||i.suppressHydrationWarning===!0||jv(n.textContent,r)?(i.popover!=null&&(Le("beforetoggle",n),Le("toggle",n)),i.onScroll!=null&&Le("scroll",n),i.onScrollEnd!=null&&Le("scrollend",n),i.onClick!=null&&(n.onclick=$n),n=!0):n=!1,n||Ea(e,!0)}function fh(e){for(xt=e.return;xt;)switch(xt.tag){case 5:case 31:case 13:hn=!1;return;case 27:case 3:hn=!0;return;default:xt=xt.return}}function to(e){if(e!==xt)return!1;if(!Be)return fh(e),Be=!0,!1;var n=e.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||Ud(e.type,e.memoizedProps)),r=!r),r&&Xe&&Ea(e),fh(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Xe=Hv(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Xe=Hv(e)}else n===27?(n=Xe,Ua(e.type)?(e=Pd,Pd=null,Xe=e):Xe=n):Xe=xt?vn(e.stateNode.nextSibling):null;return!0}function mr(){Xe=xt=null,Be=!1}function xu(){var e=Sa;return e!==null&&(qt===null?qt=e:qt.push.apply(qt,e),Sa=null),e}function ls(e){Sa===null?Sa=[e]:Sa.push(e)}var ku=R(null),pr=null,Zn=null;function Ca(e,n,r){se(ku,n._currentValue),n._currentValue=r}function Qn(e){e._currentValue=ku.current,B(ku)}function Su(e,n,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,i!==null&&(i.childLanes|=n)):i!==null&&(i.childLanes&n)!==n&&(i.childLanes|=n),e===r)break;e=e.return}}function Eu(e,n,r,i){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var h=d.dependencies;if(h!==null){var x=d.child;h=h.firstContext;e:for(;h!==null;){var _=h;h=d;for(var z=0;z<n.length;z++)if(_.context===n[z]){h.lanes|=r,_=h.alternate,_!==null&&(_.lanes|=r),Su(h.return,r,e),i||(x=null);break e}h=_.next}}else if(d.tag===18){if(x=d.return,x===null)throw Error(s(341));x.lanes|=r,h=x.alternate,h!==null&&(h.lanes|=r),Su(x,r,e),x=null}else x=d.child;if(x!==null)x.return=d;else for(x=d;x!==null;){if(x===e){x=null;break}if(d=x.sibling,d!==null){d.return=x.return,x=d;break}x=x.return}d=x}}function no(e,n,r,i){e=null;for(var d=n,h=!1;d!==null;){if(!h){if((d.flags&524288)!==0)h=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var x=d.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var _=d.type;Gt(d.pendingProps.value,x.value)||(e!==null?e.push(_):e=[_])}}else if(d===ue.current){if(x=d.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(Ls):e=[Ls])}d=d.return}e!==null&&Eu(n,e,r,i),n.flags|=262144}function Li(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function hr(e){pr=e,Zn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function kt(e){return mh(pr,e)}function zi(e,n){return pr===null&&hr(e),mh(e,n)}function mh(e,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},Zn===null){if(e===null)throw Error(s(308));Zn=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Zn=Zn.next=n;return r}var Hk=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(r,i){e.push(i)}};this.abort=function(){n.aborted=!0,e.forEach(function(r){return r()})}},Uk=t.unstable_scheduleCallback,Bk=t.unstable_NormalPriority,it={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cu(){return{controller:new Hk,data:new Map,refCount:0}}function cs(e){e.refCount--,e.refCount===0&&Uk(Bk,function(){e.controller.abort()})}var us=null,Tu=0,ao=0,ro=null;function Wk(e,n){if(us===null){var r=us=[];Tu=0,ao=Ad(),ro={status:"pending",value:void 0,then:function(i){r.push(i)}}}return Tu++,n.then(ph,ph),n}function ph(){if(--Tu===0&&us!==null){ro!==null&&(ro.status="fulfilled");var e=us;us=null,ao=0,ro=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Ik(e,n){var r=[],i={status:"pending",value:null,reason:null,then:function(d){r.push(d)}};return e.then(function(){i.status="fulfilled",i.value=n;for(var d=0;d<r.length;d++)(0,r[d])(n)},function(d){for(i.status="rejected",i.reason=d,d=0;d<r.length;d++)(0,r[d])(void 0)}),i}var hh=M.S;M.S=function(e,n){Qg=Se(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Wk(e,n),hh!==null&&hh(e,n)};var gr=R(null);function Nu(){var e=gr.current;return e!==null?e:Ve.pooledCache}function Hi(e,n){n===null?se(gr,gr.current):se(gr,n.pool)}function gh(){var e=Nu();return e===null?null:{parent:it._currentValue,pool:e}}var oo=Error(s(460)),ju=Error(s(474)),Ui=Error(s(542)),Bi={then:function(){}};function vh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function yh(e,n,r){switch(r=e[r],r===void 0?e.push(n):r!==n&&(n.then($n,$n),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,wh(e),e;default:if(typeof n.status=="string")n.then($n,$n);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=n,e.status="pending",e.then(function(i){if(n.status==="pending"){var d=n;d.status="fulfilled",d.value=i}},function(i){if(n.status==="pending"){var d=n;d.status="rejected",d.reason=i}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,wh(e),e}throw yr=n,oo}}function vr(e){try{var n=e._init;return n(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(yr=r,oo):r}}var yr=null;function bh(){if(yr===null)throw Error(s(459));var e=yr;return yr=null,e}function wh(e){if(e===oo||e===Ui)throw Error(s(483))}var so=null,ds=0;function Wi(e){var n=ds;return ds+=1,so===null&&(so=[]),yh(so,e,n)}function fs(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Ii(e,n){throw n.$$typeof===k?Error(s(525)):(e=Object.prototype.toString.call(n),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function xh(e){function n(I,H){if(e){var K=I.deletions;K===null?(I.deletions=[H],I.flags|=16):K.push(H)}}function r(I,H){if(!e)return null;for(;H!==null;)n(I,H),H=H.sibling;return null}function i(I){for(var H=new Map;I!==null;)I.key!==null?H.set(I.key,I):H.set(I.index,I),I=I.sibling;return H}function d(I,H){return I=Gn(I,H),I.index=0,I.sibling=null,I}function h(I,H,K){return I.index=K,e?(K=I.alternate,K!==null?(K=K.index,K<H?(I.flags|=67108866,H):K):(I.flags|=67108866,H)):(I.flags|=1048576,H)}function x(I){return e&&I.alternate===null&&(I.flags|=67108866),I}function _(I,H,K,ae){return H===null||H.tag!==6?(H=gu(K,I.mode,ae),H.return=I,H):(H=d(H,K),H.return=I,H)}function z(I,H,K,ae){var ke=K.type;return ke===w?te(I,H,K.props.children,ae,K.key):H!==null&&(H.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===P&&vr(ke)===H.type)?(H=d(H,K.props),fs(H,K),H.return=I,H):(H=Di(K.type,K.key,K.props,null,I.mode,ae),fs(H,K),H.return=I,H)}function Y(I,H,K,ae){return H===null||H.tag!==4||H.stateNode.containerInfo!==K.containerInfo||H.stateNode.implementation!==K.implementation?(H=vu(K,I.mode,ae),H.return=I,H):(H=d(H,K.children||[]),H.return=I,H)}function te(I,H,K,ae,ke){return H===null||H.tag!==7?(H=fr(K,I.mode,ae,ke),H.return=I,H):(H=d(H,K),H.return=I,H)}function oe(I,H,K){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=gu(""+H,I.mode,K),H.return=I,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case E:return K=Di(H.type,H.key,H.props,null,I.mode,K),fs(K,H),K.return=I,K;case S:return H=vu(H,I.mode,K),H.return=I,H;case P:return H=vr(H),oe(I,H,K)}if(q(H)||F(H))return H=fr(H,I.mode,K,null),H.return=I,H;if(typeof H.then=="function")return oe(I,Wi(H),K);if(H.$$typeof===j)return oe(I,zi(I,H),K);Ii(I,H)}return null}function X(I,H,K,ae){var ke=H!==null?H.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return ke!==null?null:_(I,H,""+K,ae);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case E:return K.key===ke?z(I,H,K,ae):null;case S:return K.key===ke?Y(I,H,K,ae):null;case P:return K=vr(K),X(I,H,K,ae)}if(q(K)||F(K))return ke!==null?null:te(I,H,K,ae,null);if(typeof K.then=="function")return X(I,H,Wi(K),ae);if(K.$$typeof===j)return X(I,H,zi(I,K),ae);Ii(I,K)}return null}function ee(I,H,K,ae,ke){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return I=I.get(K)||null,_(H,I,""+ae,ke);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case E:return I=I.get(ae.key===null?K:ae.key)||null,z(H,I,ae,ke);case S:return I=I.get(ae.key===null?K:ae.key)||null,Y(H,I,ae,ke);case P:return ae=vr(ae),ee(I,H,K,ae,ke)}if(q(ae)||F(ae))return I=I.get(K)||null,te(H,I,ae,ke,null);if(typeof ae.then=="function")return ee(I,H,K,Wi(ae),ke);if(ae.$$typeof===j)return ee(I,H,K,zi(H,ae),ke);Ii(H,ae)}return null}function me(I,H,K,ae){for(var ke=null,We=null,ye=H,Oe=H=0,He=null;ye!==null&&Oe<K.length;Oe++){ye.index>Oe?(He=ye,ye=null):He=ye.sibling;var Ie=X(I,ye,K[Oe],ae);if(Ie===null){ye===null&&(ye=He);break}e&&ye&&Ie.alternate===null&&n(I,ye),H=h(Ie,H,Oe),We===null?ke=Ie:We.sibling=Ie,We=Ie,ye=He}if(Oe===K.length)return r(I,ye),Be&&Xn(I,Oe),ke;if(ye===null){for(;Oe<K.length;Oe++)ye=oe(I,K[Oe],ae),ye!==null&&(H=h(ye,H,Oe),We===null?ke=ye:We.sibling=ye,We=ye);return Be&&Xn(I,Oe),ke}for(ye=i(ye);Oe<K.length;Oe++)He=ee(ye,I,Oe,K[Oe],ae),He!==null&&(e&&He.alternate!==null&&ye.delete(He.key===null?Oe:He.key),H=h(He,H,Oe),We===null?ke=He:We.sibling=He,We=He);return e&&ye.forEach(function(Pa){return n(I,Pa)}),Be&&Xn(I,Oe),ke}function Ee(I,H,K,ae){if(K==null)throw Error(s(151));for(var ke=null,We=null,ye=H,Oe=H=0,He=null,Ie=K.next();ye!==null&&!Ie.done;Oe++,Ie=K.next()){ye.index>Oe?(He=ye,ye=null):He=ye.sibling;var Pa=X(I,ye,Ie.value,ae);if(Pa===null){ye===null&&(ye=He);break}e&&ye&&Pa.alternate===null&&n(I,ye),H=h(Pa,H,Oe),We===null?ke=Pa:We.sibling=Pa,We=Pa,ye=He}if(Ie.done)return r(I,ye),Be&&Xn(I,Oe),ke;if(ye===null){for(;!Ie.done;Oe++,Ie=K.next())Ie=oe(I,Ie.value,ae),Ie!==null&&(H=h(Ie,H,Oe),We===null?ke=Ie:We.sibling=Ie,We=Ie);return Be&&Xn(I,Oe),ke}for(ye=i(ye);!Ie.done;Oe++,Ie=K.next())Ie=ee(ye,I,Oe,Ie.value,ae),Ie!==null&&(e&&Ie.alternate!==null&&ye.delete(Ie.key===null?Oe:Ie.key),H=h(Ie,H,Oe),We===null?ke=Ie:We.sibling=Ie,We=Ie);return e&&ye.forEach(function(Q2){return n(I,Q2)}),Be&&Xn(I,Oe),ke}function $e(I,H,K,ae){if(typeof K=="object"&&K!==null&&K.type===w&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case E:e:{for(var ke=K.key;H!==null;){if(H.key===ke){if(ke=K.type,ke===w){if(H.tag===7){r(I,H.sibling),ae=d(H,K.props.children),ae.return=I,I=ae;break e}}else if(H.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===P&&vr(ke)===H.type){r(I,H.sibling),ae=d(H,K.props),fs(ae,K),ae.return=I,I=ae;break e}r(I,H);break}else n(I,H);H=H.sibling}K.type===w?(ae=fr(K.props.children,I.mode,ae,K.key),ae.return=I,I=ae):(ae=Di(K.type,K.key,K.props,null,I.mode,ae),fs(ae,K),ae.return=I,I=ae)}return x(I);case S:e:{for(ke=K.key;H!==null;){if(H.key===ke)if(H.tag===4&&H.stateNode.containerInfo===K.containerInfo&&H.stateNode.implementation===K.implementation){r(I,H.sibling),ae=d(H,K.children||[]),ae.return=I,I=ae;break e}else{r(I,H);break}else n(I,H);H=H.sibling}ae=vu(K,I.mode,ae),ae.return=I,I=ae}return x(I);case P:return K=vr(K),$e(I,H,K,ae)}if(q(K))return me(I,H,K,ae);if(F(K)){if(ke=F(K),typeof ke!="function")throw Error(s(150));return K=ke.call(K),Ee(I,H,K,ae)}if(typeof K.then=="function")return $e(I,H,Wi(K),ae);if(K.$$typeof===j)return $e(I,H,zi(I,K),ae);Ii(I,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,H!==null&&H.tag===6?(r(I,H.sibling),ae=d(H,K),ae.return=I,I=ae):(r(I,H),ae=gu(K,I.mode,ae),ae.return=I,I=ae),x(I)):r(I,H)}return function(I,H,K,ae){try{ds=0;var ke=$e(I,H,K,ae);return so=null,ke}catch(ye){if(ye===oo||ye===Ui)throw ye;var We=Xt(29,ye,null,I.mode);return We.lanes=ae,We.return=I,We}}}var br=xh(!0),kh=xh(!1),Ta=!1;function Au(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _u(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ja(e,n,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(qe&2)!==0){var d=i.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),i.pending=n,n=Oi(e),oh(e,null,r),n}return Ri(e,i,n,r),Oi(e)}function ms(e,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var i=n.lanes;i&=e.pendingLanes,r|=i,n.lanes=r,mp(e,r)}}function Ru(e,n){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var d=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var x={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?d=h=x:h=h.next=x,r=r.next}while(r!==null);h===null?d=h=n:h=h.next=n}else d=h=n;r={baseState:i.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:i.shared,callbacks:i.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=n:e.next=n,r.lastBaseUpdate=n}var Ou=!1;function ps(){if(Ou){var e=ro;if(e!==null)throw e}}function hs(e,n,r,i){Ou=!1;var d=e.updateQueue;Ta=!1;var h=d.firstBaseUpdate,x=d.lastBaseUpdate,_=d.shared.pending;if(_!==null){d.shared.pending=null;var z=_,Y=z.next;z.next=null,x===null?h=Y:x.next=Y,x=z;var te=e.alternate;te!==null&&(te=te.updateQueue,_=te.lastBaseUpdate,_!==x&&(_===null?te.firstBaseUpdate=Y:_.next=Y,te.lastBaseUpdate=z))}if(h!==null){var oe=d.baseState;x=0,te=Y=z=null,_=h;do{var X=_.lane&-536870913,ee=X!==_.lane;if(ee?(ze&X)===X:(i&X)===X){X!==0&&X===ao&&(Ou=!0),te!==null&&(te=te.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var me=e,Ee=_;X=n;var $e=r;switch(Ee.tag){case 1:if(me=Ee.payload,typeof me=="function"){oe=me.call($e,oe,X);break e}oe=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=Ee.payload,X=typeof me=="function"?me.call($e,oe,X):me,X==null)break e;oe=v({},oe,X);break e;case 2:Ta=!0}}X=_.callback,X!==null&&(e.flags|=64,ee&&(e.flags|=8192),ee=d.callbacks,ee===null?d.callbacks=[X]:ee.push(X))}else ee={lane:X,tag:_.tag,payload:_.payload,callback:_.callback,next:null},te===null?(Y=te=ee,z=oe):te=te.next=ee,x|=X;if(_=_.next,_===null){if(_=d.shared.pending,_===null)break;ee=_,_=ee.next,ee.next=null,d.lastBaseUpdate=ee,d.shared.pending=null}}while(!0);te===null&&(z=oe),d.baseState=z,d.firstBaseUpdate=Y,d.lastBaseUpdate=te,h===null&&(d.shared.lanes=0),Da|=x,e.lanes=x,e.memoizedState=oe}}function Sh(e,n){if(typeof e!="function")throw Error(s(191,e));e.call(n)}function Eh(e,n){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)Sh(r[e],n)}var io=R(null),qi=R(0);function Ch(e,n){e=ia,se(qi,e),se(io,n),ia=e|n.baseLanes}function Du(){se(qi,ia),se(io,io.current)}function Mu(){ia=qi.current,B(io),B(qi)}var Zt=R(null),gn=null;function Aa(e){var n=e.alternate;se(at,at.current&1),se(Zt,e),gn===null&&(n===null||io.current!==null||n.memoizedState!==null)&&(gn=e)}function Lu(e){se(at,at.current),se(Zt,e),gn===null&&(gn=e)}function Th(e){e.tag===22?(se(at,at.current),se(Zt,e),gn===null&&(gn=e)):_a()}function _a(){se(at,at.current),se(Zt,Zt.current)}function Qt(e){B(Zt),gn===e&&(gn=null),B(at)}var at=R(0);function Pi(e){for(var n=e;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Id(r)||qd(r)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Jn=0,Re=null,Ke=null,lt=null,Fi=!1,lo=!1,wr=!1,Ki=0,gs=0,co=null,qk=0;function et(){throw Error(s(321))}function zu(e,n){if(n===null)return!1;for(var r=0;r<n.length&&r<e.length;r++)if(!Gt(e[r],n[r]))return!1;return!0}function Hu(e,n,r,i,d,h){return Jn=h,Re=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,M.H=e===null||e.memoizedState===null?cg:Qu,wr=!1,h=r(i,d),wr=!1,lo&&(h=jh(n,r,i,d)),Nh(e),h}function Nh(e){M.H=bs;var n=Ke!==null&&Ke.next!==null;if(Jn=0,lt=Ke=Re=null,Fi=!1,gs=0,co=null,n)throw Error(s(300));e===null||ct||(e=e.dependencies,e!==null&&Li(e)&&(ct=!0))}function jh(e,n,r,i){Re=e;var d=0;do{if(lo&&(co=null),gs=0,lo=!1,25<=d)throw Error(s(301));if(d+=1,lt=Ke=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}M.H=ug,h=n(r,i)}while(lo);return h}function Pk(){var e=M.H,n=e.useState()[0];return n=typeof n.then=="function"?vs(n):n,e=e.useState()[0],(Ke!==null?Ke.memoizedState:null)!==e&&(Re.flags|=1024),n}function Uu(){var e=Ki!==0;return Ki=0,e}function Bu(e,n,r){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~r}function Wu(e){if(Fi){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Fi=!1}Jn=0,lt=Ke=Re=null,lo=!1,gs=Ki=0,co=null}function Dt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lt===null?Re.memoizedState=lt=e:lt=lt.next=e,lt}function rt(){if(Ke===null){var e=Re.alternate;e=e!==null?e.memoizedState:null}else e=Ke.next;var n=lt===null?Re.memoizedState:lt.next;if(n!==null)lt=n,Ke=e;else{if(e===null)throw Re.alternate===null?Error(s(467)):Error(s(310));Ke=e,e={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},lt===null?Re.memoizedState=lt=e:lt=lt.next=e}return lt}function Yi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vs(e){var n=gs;return gs+=1,co===null&&(co=[]),e=yh(co,e,n),n=Re,(lt===null?n.memoizedState:lt.next)===null&&(n=n.alternate,M.H=n===null||n.memoizedState===null?cg:Qu),e}function $i(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return vs(e);if(e.$$typeof===j)return kt(e)}throw Error(s(438,String(e)))}function Iu(e){var n=null,r=Re.updateQueue;if(r!==null&&(n=r.memoCache),n==null){var i=Re.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(n={data:i.data.map(function(d){return d.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),r===null&&(r=Yi(),Re.updateQueue=r),r.memoCache=n,r=n.data[n.index],r===void 0)for(r=n.data[n.index]=Array(e),i=0;i<e;i++)r[i]=Q;return n.index++,r}function ea(e,n){return typeof n=="function"?n(e):n}function Vi(e){var n=rt();return qu(n,Ke,e)}function qu(e,n,r){var i=e.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=r;var d=e.baseQueue,h=i.pending;if(h!==null){if(d!==null){var x=d.next;d.next=h.next,h.next=x}n.baseQueue=d=h,i.pending=null}if(h=e.baseState,d===null)e.memoizedState=h;else{n=d.next;var _=x=null,z=null,Y=n,te=!1;do{var oe=Y.lane&-536870913;if(oe!==Y.lane?(ze&oe)===oe:(Jn&oe)===oe){var X=Y.revertLane;if(X===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),oe===ao&&(te=!0);else if((Jn&X)===X){Y=Y.next,X===ao&&(te=!0);continue}else oe={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},z===null?(_=z=oe,x=h):z=z.next=oe,Re.lanes|=X,Da|=X;oe=Y.action,wr&&r(h,oe),h=Y.hasEagerState?Y.eagerState:r(h,oe)}else X={lane:oe,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},z===null?(_=z=X,x=h):z=z.next=X,Re.lanes|=oe,Da|=oe;Y=Y.next}while(Y!==null&&Y!==n);if(z===null?x=h:z.next=_,!Gt(h,e.memoizedState)&&(ct=!0,te&&(r=ro,r!==null)))throw r;e.memoizedState=h,e.baseState=x,e.baseQueue=z,i.lastRenderedState=h}return d===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Pu(e){var n=rt(),r=n.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=e;var i=r.dispatch,d=r.pending,h=n.memoizedState;if(d!==null){r.pending=null;var x=d=d.next;do h=e(h,x.action),x=x.next;while(x!==d);Gt(h,n.memoizedState)||(ct=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),r.lastRenderedState=h}return[h,i]}function Ah(e,n,r){var i=Re,d=rt(),h=Be;if(h){if(r===void 0)throw Error(s(407));r=r()}else r=n();var x=!Gt((Ke||d).memoizedState,r);if(x&&(d.memoizedState=r,ct=!0),d=d.queue,Yu(Oh.bind(null,i,d,e),[e]),d.getSnapshot!==n||x||lt!==null&&lt.memoizedState.tag&1){if(i.flags|=2048,uo(9,{destroy:void 0},Rh.bind(null,i,d,r,n),null),Ve===null)throw Error(s(349));h||(Jn&127)!==0||_h(i,n,r)}return r}function _h(e,n,r){e.flags|=16384,e={getSnapshot:n,value:r},n=Re.updateQueue,n===null?(n=Yi(),Re.updateQueue=n,n.stores=[e]):(r=n.stores,r===null?n.stores=[e]:r.push(e))}function Rh(e,n,r,i){n.value=r,n.getSnapshot=i,Dh(n)&&Mh(e)}function Oh(e,n,r){return r(function(){Dh(n)&&Mh(e)})}function Dh(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!Gt(e,r)}catch{return!0}}function Mh(e){var n=dr(e,2);n!==null&&Pt(n,e,2)}function Fu(e){var n=Dt();if(typeof e=="function"){var r=e;if(e=r(),wr){xn(!0);try{r()}finally{xn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:e},n}function Lh(e,n,r,i){return e.baseState=r,qu(e,Ke,typeof i=="function"?i:ea)}function Fk(e,n,r,i,d){if(Zi(e))throw Error(s(485));if(e=n.action,e!==null){var h={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};M.T!==null?r(!0):h.isTransition=!1,i(h),r=n.pending,r===null?(h.next=n.pending=h,zh(n,h)):(h.next=r.next,n.pending=r.next=h)}}function zh(e,n){var r=n.action,i=n.payload,d=e.state;if(n.isTransition){var h=M.T,x={};M.T=x;try{var _=r(d,i),z=M.S;z!==null&&z(x,_),Hh(e,n,_)}catch(Y){Ku(e,n,Y)}finally{h!==null&&x.types!==null&&(h.types=x.types),M.T=h}}else try{h=r(d,i),Hh(e,n,h)}catch(Y){Ku(e,n,Y)}}function Hh(e,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(i){Uh(e,n,i)},function(i){return Ku(e,n,i)}):Uh(e,n,r)}function Uh(e,n,r){n.status="fulfilled",n.value=r,Bh(n),e.state=r,n=e.pending,n!==null&&(r=n.next,r===n?e.pending=null:(r=r.next,n.next=r,zh(e,r)))}function Ku(e,n,r){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do n.status="rejected",n.reason=r,Bh(n),n=n.next;while(n!==i)}e.action=null}function Bh(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Wh(e,n){return n}function Ih(e,n){if(Be){var r=Ve.formState;if(r!==null){e:{var i=Re;if(Be){if(Xe){t:{for(var d=Xe,h=hn;d.nodeType!==8;){if(!h){d=null;break t}if(d=vn(d.nextSibling),d===null){d=null;break t}}h=d.data,d=h==="F!"||h==="F"?d:null}if(d){Xe=vn(d.nextSibling),i=d.data==="F!";break e}}Ea(i)}i=!1}i&&(n=r[0])}}return r=Dt(),r.memoizedState=r.baseState=n,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wh,lastRenderedState:n},r.queue=i,r=sg.bind(null,Re,i),i.dispatch=r,i=Fu(!1),h=Zu.bind(null,Re,!1,i.queue),i=Dt(),d={state:n,dispatch:null,action:e,pending:null},i.queue=d,r=Fk.bind(null,Re,d,h,r),d.dispatch=r,i.memoizedState=e,[n,r,!1]}function qh(e){var n=rt();return Ph(n,Ke,e)}function Ph(e,n,r){if(n=qu(e,n,Wh)[0],e=Vi(ea)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var i=vs(n)}catch(x){throw x===oo?Ui:x}else i=n;n=rt();var d=n.queue,h=d.dispatch;return r!==n.memoizedState&&(Re.flags|=2048,uo(9,{destroy:void 0},Kk.bind(null,d,r),null)),[i,h,e]}function Kk(e,n){e.action=n}function Fh(e){var n=rt(),r=Ke;if(r!==null)return Ph(n,r,e);rt(),n=n.memoizedState,r=rt();var i=r.queue.dispatch;return r.memoizedState=e,[n,i,!1]}function uo(e,n,r,i){return e={tag:e,create:r,deps:i,inst:n,next:null},n=Re.updateQueue,n===null&&(n=Yi(),Re.updateQueue=n),r=n.lastEffect,r===null?n.lastEffect=e.next=e:(i=r.next,r.next=e,e.next=i,n.lastEffect=e),e}function Kh(){return rt().memoizedState}function Gi(e,n,r,i){var d=Dt();Re.flags|=e,d.memoizedState=uo(1|n,{destroy:void 0},r,i===void 0?null:i)}function Xi(e,n,r,i){var d=rt();i=i===void 0?null:i;var h=d.memoizedState.inst;Ke!==null&&i!==null&&zu(i,Ke.memoizedState.deps)?d.memoizedState=uo(n,h,r,i):(Re.flags|=e,d.memoizedState=uo(1|n,h,r,i))}function Yh(e,n){Gi(8390656,8,e,n)}function Yu(e,n){Xi(2048,8,e,n)}function Yk(e){Re.flags|=4;var n=Re.updateQueue;if(n===null)n=Yi(),Re.updateQueue=n,n.events=[e];else{var r=n.events;r===null?n.events=[e]:r.push(e)}}function $h(e){var n=rt().memoizedState;return Yk({ref:n,nextImpl:e}),function(){if((qe&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Vh(e,n){return Xi(4,2,e,n)}function Gh(e,n){return Xi(4,4,e,n)}function Xh(e,n){if(typeof n=="function"){e=e();var r=n(e);return function(){typeof r=="function"?r():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Zh(e,n,r){r=r!=null?r.concat([e]):null,Xi(4,4,Xh.bind(null,n,e),r)}function $u(){}function Qh(e,n){var r=rt();n=n===void 0?null:n;var i=r.memoizedState;return n!==null&&zu(n,i[1])?i[0]:(r.memoizedState=[e,n],e)}function Jh(e,n){var r=rt();n=n===void 0?null:n;var i=r.memoizedState;if(n!==null&&zu(n,i[1]))return i[0];if(i=e(),wr){xn(!0);try{e()}finally{xn(!1)}}return r.memoizedState=[i,n],i}function Vu(e,n,r){return r===void 0||(Jn&1073741824)!==0&&(ze&261930)===0?e.memoizedState=n:(e.memoizedState=r,e=ev(),Re.lanes|=e,Da|=e,r)}function eg(e,n,r,i){return Gt(r,n)?r:io.current!==null?(e=Vu(e,r,i),Gt(e,n)||(ct=!0),e):(Jn&42)===0||(Jn&1073741824)!==0&&(ze&261930)===0?(ct=!0,e.memoizedState=r):(e=ev(),Re.lanes|=e,Da|=e,n)}function tg(e,n,r,i,d){var h=U.p;U.p=h!==0&&8>h?h:8;var x=M.T,_={};M.T=_,Zu(e,!1,n,r);try{var z=d(),Y=M.S;if(Y!==null&&Y(_,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var te=Ik(z,i);ys(e,n,te,tn(e))}else ys(e,n,i,tn(e))}catch(oe){ys(e,n,{then:function(){},status:"rejected",reason:oe},tn())}finally{U.p=h,x!==null&&_.types!==null&&(x.types=_.types),M.T=x}}function $k(){}function Gu(e,n,r,i){if(e.tag!==5)throw Error(s(476));var d=ng(e).queue;tg(e,d,n,W,r===null?$k:function(){return ag(e),r(i)})}function ng(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:W},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:r},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function ag(e){var n=ng(e);n.next===null&&(n=e.alternate.memoizedState),ys(e,n.next.queue,{},tn())}function Xu(){return kt(Ls)}function rg(){return rt().memoizedState}function og(){return rt().memoizedState}function Vk(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var r=tn();e=Na(r);var i=ja(n,e,r);i!==null&&(Pt(i,n,r),ms(i,n,r)),n={cache:Cu()},e.payload=n;return}n=n.return}}function Gk(e,n,r){var i=tn();r={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Zi(e)?ig(n,r):(r=pu(e,n,r,i),r!==null&&(Pt(r,e,i),lg(r,n,i)))}function sg(e,n,r){var i=tn();ys(e,n,r,i)}function ys(e,n,r,i){var d={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Zi(e))ig(n,d);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,_=h(x,r);if(d.hasEagerState=!0,d.eagerState=_,Gt(_,x))return Ri(e,n,d,0),Ve===null&&_i(),!1}catch{}if(r=pu(e,n,d,i),r!==null)return Pt(r,e,i),lg(r,n,i),!0}return!1}function Zu(e,n,r,i){if(i={lane:2,revertLane:Ad(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Zi(e)){if(n)throw Error(s(479))}else n=pu(e,r,i,2),n!==null&&Pt(n,e,2)}function Zi(e){var n=e.alternate;return e===Re||n!==null&&n===Re}function ig(e,n){lo=Fi=!0;var r=e.pending;r===null?n.next=n:(n.next=r.next,r.next=n),e.pending=n}function lg(e,n,r){if((r&4194048)!==0){var i=n.lanes;i&=e.pendingLanes,r|=i,n.lanes=r,mp(e,r)}}var bs={readContext:kt,use:$i,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useLayoutEffect:et,useInsertionEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useSyncExternalStore:et,useId:et,useHostTransitionStatus:et,useFormState:et,useActionState:et,useOptimistic:et,useMemoCache:et,useCacheRefresh:et};bs.useEffectEvent=et;var cg={readContext:kt,use:$i,useCallback:function(e,n){return Dt().memoizedState=[e,n===void 0?null:n],e},useContext:kt,useEffect:Yh,useImperativeHandle:function(e,n,r){r=r!=null?r.concat([e]):null,Gi(4194308,4,Xh.bind(null,n,e),r)},useLayoutEffect:function(e,n){return Gi(4194308,4,e,n)},useInsertionEffect:function(e,n){Gi(4,2,e,n)},useMemo:function(e,n){var r=Dt();n=n===void 0?null:n;var i=e();if(wr){xn(!0);try{e()}finally{xn(!1)}}return r.memoizedState=[i,n],i},useReducer:function(e,n,r){var i=Dt();if(r!==void 0){var d=r(n);if(wr){xn(!0);try{r(n)}finally{xn(!1)}}}else d=n;return i.memoizedState=i.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},i.queue=e,e=e.dispatch=Gk.bind(null,Re,e),[i.memoizedState,e]},useRef:function(e){var n=Dt();return e={current:e},n.memoizedState=e},useState:function(e){e=Fu(e);var n=e.queue,r=sg.bind(null,Re,n);return n.dispatch=r,[e.memoizedState,r]},useDebugValue:$u,useDeferredValue:function(e,n){var r=Dt();return Vu(r,e,n)},useTransition:function(){var e=Fu(!1);return e=tg.bind(null,Re,e.queue,!0,!1),Dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,r){var i=Re,d=Dt();if(Be){if(r===void 0)throw Error(s(407));r=r()}else{if(r=n(),Ve===null)throw Error(s(349));(ze&127)!==0||_h(i,n,r)}d.memoizedState=r;var h={value:r,getSnapshot:n};return d.queue=h,Yh(Oh.bind(null,i,h,e),[e]),i.flags|=2048,uo(9,{destroy:void 0},Rh.bind(null,i,h,r,n),null),r},useId:function(){var e=Dt(),n=Ve.identifierPrefix;if(Be){var r=Dn,i=On;r=(i&~(1<<32-ht(i)-1)).toString(32)+r,n="_"+n+"R_"+r,r=Ki++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=qk++,n="_"+n+"r_"+r.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Xu,useFormState:Ih,useActionState:Ih,useOptimistic:function(e){var n=Dt();n.memoizedState=n.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=r,n=Zu.bind(null,Re,!0,r),r.dispatch=n,[e,n]},useMemoCache:Iu,useCacheRefresh:function(){return Dt().memoizedState=Vk.bind(null,Re)},useEffectEvent:function(e){var n=Dt(),r={impl:e};return n.memoizedState=r,function(){if((qe&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}},Qu={readContext:kt,use:$i,useCallback:Qh,useContext:kt,useEffect:Yu,useImperativeHandle:Zh,useInsertionEffect:Vh,useLayoutEffect:Gh,useMemo:Jh,useReducer:Vi,useRef:Kh,useState:function(){return Vi(ea)},useDebugValue:$u,useDeferredValue:function(e,n){var r=rt();return eg(r,Ke.memoizedState,e,n)},useTransition:function(){var e=Vi(ea)[0],n=rt().memoizedState;return[typeof e=="boolean"?e:vs(e),n]},useSyncExternalStore:Ah,useId:rg,useHostTransitionStatus:Xu,useFormState:qh,useActionState:qh,useOptimistic:function(e,n){var r=rt();return Lh(r,Ke,e,n)},useMemoCache:Iu,useCacheRefresh:og};Qu.useEffectEvent=$h;var ug={readContext:kt,use:$i,useCallback:Qh,useContext:kt,useEffect:Yu,useImperativeHandle:Zh,useInsertionEffect:Vh,useLayoutEffect:Gh,useMemo:Jh,useReducer:Pu,useRef:Kh,useState:function(){return Pu(ea)},useDebugValue:$u,useDeferredValue:function(e,n){var r=rt();return Ke===null?Vu(r,e,n):eg(r,Ke.memoizedState,e,n)},useTransition:function(){var e=Pu(ea)[0],n=rt().memoizedState;return[typeof e=="boolean"?e:vs(e),n]},useSyncExternalStore:Ah,useId:rg,useHostTransitionStatus:Xu,useFormState:Fh,useActionState:Fh,useOptimistic:function(e,n){var r=rt();return Ke!==null?Lh(r,Ke,e,n):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:Iu,useCacheRefresh:og};ug.useEffectEvent=$h;function Ju(e,n,r,i){n=e.memoizedState,r=r(i,n),r=r==null?n:v({},n,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var ed={enqueueSetState:function(e,n,r){e=e._reactInternals;var i=tn(),d=Na(i);d.payload=n,r!=null&&(d.callback=r),n=ja(e,d,i),n!==null&&(Pt(n,e,i),ms(n,e,i))},enqueueReplaceState:function(e,n,r){e=e._reactInternals;var i=tn(),d=Na(i);d.tag=1,d.payload=n,r!=null&&(d.callback=r),n=ja(e,d,i),n!==null&&(Pt(n,e,i),ms(n,e,i))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var r=tn(),i=Na(r);i.tag=2,n!=null&&(i.callback=n),n=ja(e,i,r),n!==null&&(Pt(n,e,r),ms(n,e,r))}};function dg(e,n,r,i,d,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,h,x):n.prototype&&n.prototype.isPureReactComponent?!os(r,i)||!os(d,h):!0}function fg(e,n,r,i){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(r,i),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(r,i),n.state!==e&&ed.enqueueReplaceState(n,n.state,null)}function xr(e,n){var r=n;if("ref"in n){r={};for(var i in n)i!=="ref"&&(r[i]=n[i])}if(e=e.defaultProps){r===n&&(r=v({},r));for(var d in e)r[d]===void 0&&(r[d]=e[d])}return r}function mg(e){Ai(e)}function pg(e){console.error(e)}function hg(e){Ai(e)}function Qi(e,n){try{var r=e.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(i){setTimeout(function(){throw i})}}function gg(e,n,r){try{var i=e.onCaughtError;i(r.value,{componentStack:r.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function td(e,n,r){return r=Na(r),r.tag=3,r.payload={element:null},r.callback=function(){Qi(e,n)},r}function vg(e){return e=Na(e),e.tag=3,e}function yg(e,n,r,i){var d=r.type.getDerivedStateFromError;if(typeof d=="function"){var h=i.value;e.payload=function(){return d(h)},e.callback=function(){gg(n,r,i)}}var x=r.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){gg(n,r,i),typeof d!="function"&&(Ma===null?Ma=new Set([this]):Ma.add(this));var _=i.stack;this.componentDidCatch(i.value,{componentStack:_!==null?_:""})})}function Xk(e,n,r,i,d){if(r.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(n=r.alternate,n!==null&&no(n,r,d,!0),r=Zt.current,r!==null){switch(r.tag){case 31:case 13:return gn===null?ul():r.alternate===null&&tt===0&&(tt=3),r.flags&=-257,r.flags|=65536,r.lanes=d,i===Bi?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([i]):n.add(i),Td(e,i,d)),!1;case 22:return r.flags|=65536,i===Bi?r.flags|=16384:(n=r.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([i])},r.updateQueue=n):(r=n.retryQueue,r===null?n.retryQueue=new Set([i]):r.add(i)),Td(e,i,d)),!1}throw Error(s(435,r.tag))}return Td(e,i,d),ul(),!1}if(Be)return n=Zt.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,i!==wu&&(e=Error(s(422),{cause:i}),ls(fn(e,r)))):(i!==wu&&(n=Error(s(423),{cause:i}),ls(fn(n,r))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,i=fn(i,r),d=td(e.stateNode,i,d),Ru(e,d),tt!==4&&(tt=2)),!1;var h=Error(s(520),{cause:i});if(h=fn(h,r),Ns===null?Ns=[h]:Ns.push(h),tt!==4&&(tt=2),n===null)return!0;i=fn(i,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,e=d&-d,r.lanes|=e,e=td(r.stateNode,i,e),Ru(r,e),!1;case 1:if(n=r.type,h=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Ma===null||!Ma.has(h))))return r.flags|=65536,d&=-d,r.lanes|=d,d=vg(d),yg(d,e,r,i),Ru(r,d),!1}r=r.return}while(r!==null);return!1}var nd=Error(s(461)),ct=!1;function St(e,n,r,i){n.child=e===null?kh(n,null,r,i):br(n,e.child,r,i)}function bg(e,n,r,i,d){r=r.render;var h=n.ref;if("ref"in i){var x={};for(var _ in i)_!=="ref"&&(x[_]=i[_])}else x=i;return hr(n),i=Hu(e,n,r,x,h,d),_=Uu(),e!==null&&!ct?(Bu(e,n,d),ta(e,n,d)):(Be&&_&&yu(n),n.flags|=1,St(e,n,i,d),n.child)}function wg(e,n,r,i,d){if(e===null){var h=r.type;return typeof h=="function"&&!hu(h)&&h.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=h,xg(e,n,h,i,d)):(e=Di(r.type,null,i,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!ud(e,d)){var x=h.memoizedProps;if(r=r.compare,r=r!==null?r:os,r(x,i)&&e.ref===n.ref)return ta(e,n,d)}return n.flags|=1,e=Gn(h,i),e.ref=n.ref,e.return=n,n.child=e}function xg(e,n,r,i,d){if(e!==null){var h=e.memoizedProps;if(os(h,i)&&e.ref===n.ref)if(ct=!1,n.pendingProps=i=h,ud(e,d))(e.flags&131072)!==0&&(ct=!0);else return n.lanes=e.lanes,ta(e,n,d)}return ad(e,n,r,i,d)}function kg(e,n,r,i){var d=i.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|r:r,e!==null){for(i=n.child=e.child,d=0;i!==null;)d=d|i.lanes|i.childLanes,i=i.sibling;i=d&~h}else i=0,n.child=null;return Sg(e,n,h,r,i)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Hi(n,h!==null?h.cachePool:null),h!==null?Ch(n,h):Du(),Th(n);else return i=n.lanes=536870912,Sg(e,n,h!==null?h.baseLanes|r:r,r,i)}else h!==null?(Hi(n,h.cachePool),Ch(n,h),_a(),n.memoizedState=null):(e!==null&&Hi(n,null),Du(),_a());return St(e,n,d,r),n.child}function ws(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Sg(e,n,r,i,d){var h=Nu();return h=h===null?null:{parent:it._currentValue,pool:h},n.memoizedState={baseLanes:r,cachePool:h},e!==null&&Hi(n,null),Du(),Th(n),e!==null&&no(e,n,i,!0),n.childLanes=d,null}function Ji(e,n){return n=tl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Eg(e,n,r){return br(n,e.child,null,r),e=Ji(n,n.pendingProps),e.flags|=2,Qt(n),n.memoizedState=null,e}function Zk(e,n,r){var i=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Be){if(i.mode==="hidden")return e=Ji(n,i),n.lanes=536870912,ws(null,e);if(Lu(n),(e=Xe)?(e=zv(e,hn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ka!==null?{id:On,overflow:Dn}:null,retryLane:536870912,hydrationErrors:null},r=ih(e),r.return=n,n.child=r,xt=n,Xe=null)):e=null,e===null)throw Ea(n);return n.lanes=536870912,null}return Ji(n,i)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(Lu(n),d)if(n.flags&256)n.flags&=-257,n=Eg(e,n,r);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(s(558));else if(ct||no(e,n,r,!1),d=(r&e.childLanes)!==0,ct||d){if(i=Ve,i!==null&&(x=pp(i,r),x!==0&&x!==h.retryLane))throw h.retryLane=x,dr(e,x),Pt(i,e,x),nd;ul(),n=Eg(e,n,r)}else e=h.treeContext,Xe=vn(x.nextSibling),xt=n,Be=!0,Sa=null,hn=!1,e!==null&&uh(n,e),n=Ji(n,i),n.flags|=4096;return n}return e=Gn(e.child,{mode:i.mode,children:i.children}),e.ref=n.ref,n.child=e,e.return=n,e}function el(e,n){var r=n.ref;if(r===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(s(284));(e===null||e.ref!==r)&&(n.flags|=4194816)}}function ad(e,n,r,i,d){return hr(n),r=Hu(e,n,r,i,void 0,d),i=Uu(),e!==null&&!ct?(Bu(e,n,d),ta(e,n,d)):(Be&&i&&yu(n),n.flags|=1,St(e,n,r,d),n.child)}function Cg(e,n,r,i,d,h){return hr(n),n.updateQueue=null,r=jh(n,i,r,d),Nh(e),i=Uu(),e!==null&&!ct?(Bu(e,n,h),ta(e,n,h)):(Be&&i&&yu(n),n.flags|=1,St(e,n,r,h),n.child)}function Tg(e,n,r,i,d){if(hr(n),n.stateNode===null){var h=Qr,x=r.contextType;typeof x=="object"&&x!==null&&(h=kt(x)),h=new r(i,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=ed,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=i,h.state=n.memoizedState,h.refs={},Au(n),x=r.contextType,h.context=typeof x=="object"&&x!==null?kt(x):Qr,h.state=n.memoizedState,x=r.getDerivedStateFromProps,typeof x=="function"&&(Ju(n,r,x,i),h.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&ed.enqueueReplaceState(h,h.state,null),hs(n,i,h,d),ps(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),i=!0}else if(e===null){h=n.stateNode;var _=n.memoizedProps,z=xr(r,_);h.props=z;var Y=h.context,te=r.contextType;x=Qr,typeof te=="object"&&te!==null&&(x=kt(te));var oe=r.getDerivedStateFromProps;te=typeof oe=="function"||typeof h.getSnapshotBeforeUpdate=="function",_=n.pendingProps!==_,te||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(_||Y!==x)&&fg(n,h,i,x),Ta=!1;var X=n.memoizedState;h.state=X,hs(n,i,h,d),ps(),Y=n.memoizedState,_||X!==Y||Ta?(typeof oe=="function"&&(Ju(n,r,oe,i),Y=n.memoizedState),(z=Ta||dg(n,r,z,i,X,Y,x))?(te||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=i,n.memoizedState=Y),h.props=i,h.state=Y,h.context=x,i=z):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),i=!1)}else{h=n.stateNode,_u(e,n),x=n.memoizedProps,te=xr(r,x),h.props=te,oe=n.pendingProps,X=h.context,Y=r.contextType,z=Qr,typeof Y=="object"&&Y!==null&&(z=kt(Y)),_=r.getDerivedStateFromProps,(Y=typeof _=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==oe||X!==z)&&fg(n,h,i,z),Ta=!1,X=n.memoizedState,h.state=X,hs(n,i,h,d),ps();var ee=n.memoizedState;x!==oe||X!==ee||Ta||e!==null&&e.dependencies!==null&&Li(e.dependencies)?(typeof _=="function"&&(Ju(n,r,_,i),ee=n.memoizedState),(te=Ta||dg(n,r,te,i,X,ee,z)||e!==null&&e.dependencies!==null&&Li(e.dependencies))?(Y||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(i,ee,z),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(i,ee,z)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&X===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&X===e.memoizedState||(n.flags|=1024),n.memoizedProps=i,n.memoizedState=ee),h.props=i,h.state=ee,h.context=z,i=te):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&X===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&X===e.memoizedState||(n.flags|=1024),i=!1)}return h=i,el(e,n),i=(n.flags&128)!==0,h||i?(h=n.stateNode,r=i&&typeof r.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&i?(n.child=br(n,e.child,null,d),n.child=br(n,null,r,d)):St(e,n,r,d),n.memoizedState=h.state,e=n.child):e=ta(e,n,d),e}function Ng(e,n,r,i){return mr(),n.flags|=256,St(e,n,r,i),n.child}var rd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function od(e){return{baseLanes:e,cachePool:gh()}}function sd(e,n,r){return e=e!==null?e.childLanes&~r:0,n&&(e|=en),e}function jg(e,n,r){var i=n.pendingProps,d=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(at.current&2)!==0),x&&(d=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Be){if(d?Aa(n):_a(),(e=Xe)?(e=zv(e,hn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ka!==null?{id:On,overflow:Dn}:null,retryLane:536870912,hydrationErrors:null},r=ih(e),r.return=n,n.child=r,xt=n,Xe=null)):e=null,e===null)throw Ea(n);return qd(e)?n.lanes=32:n.lanes=536870912,null}var _=i.children;return i=i.fallback,d?(_a(),d=n.mode,_=tl({mode:"hidden",children:_},d),i=fr(i,d,r,null),_.return=n,i.return=n,_.sibling=i,n.child=_,i=n.child,i.memoizedState=od(r),i.childLanes=sd(e,x,r),n.memoizedState=rd,ws(null,i)):(Aa(n),id(n,_))}var z=e.memoizedState;if(z!==null&&(_=z.dehydrated,_!==null)){if(h)n.flags&256?(Aa(n),n.flags&=-257,n=ld(e,n,r)):n.memoizedState!==null?(_a(),n.child=e.child,n.flags|=128,n=null):(_a(),_=i.fallback,d=n.mode,i=tl({mode:"visible",children:i.children},d),_=fr(_,d,r,null),_.flags|=2,i.return=n,_.return=n,i.sibling=_,n.child=i,br(n,e.child,null,r),i=n.child,i.memoizedState=od(r),i.childLanes=sd(e,x,r),n.memoizedState=rd,n=ws(null,i));else if(Aa(n),qd(_)){if(x=_.nextSibling&&_.nextSibling.dataset,x)var Y=x.dgst;x=Y,i=Error(s(419)),i.stack="",i.digest=x,ls({value:i,source:null,stack:null}),n=ld(e,n,r)}else if(ct||no(e,n,r,!1),x=(r&e.childLanes)!==0,ct||x){if(x=Ve,x!==null&&(i=pp(x,r),i!==0&&i!==z.retryLane))throw z.retryLane=i,dr(e,i),Pt(x,e,i),nd;Id(_)||ul(),n=ld(e,n,r)}else Id(_)?(n.flags|=192,n.child=e.child,n=null):(e=z.treeContext,Xe=vn(_.nextSibling),xt=n,Be=!0,Sa=null,hn=!1,e!==null&&uh(n,e),n=id(n,i.children),n.flags|=4096);return n}return d?(_a(),_=i.fallback,d=n.mode,z=e.child,Y=z.sibling,i=Gn(z,{mode:"hidden",children:i.children}),i.subtreeFlags=z.subtreeFlags&65011712,Y!==null?_=Gn(Y,_):(_=fr(_,d,r,null),_.flags|=2),_.return=n,i.return=n,i.sibling=_,n.child=i,ws(null,i),i=n.child,_=e.child.memoizedState,_===null?_=od(r):(d=_.cachePool,d!==null?(z=it._currentValue,d=d.parent!==z?{parent:z,pool:z}:d):d=gh(),_={baseLanes:_.baseLanes|r,cachePool:d}),i.memoizedState=_,i.childLanes=sd(e,x,r),n.memoizedState=rd,ws(e.child,i)):(Aa(n),r=e.child,e=r.sibling,r=Gn(r,{mode:"visible",children:i.children}),r.return=n,r.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=r,n.memoizedState=null,r)}function id(e,n){return n=tl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function tl(e,n){return e=Xt(22,e,null,n),e.lanes=0,e}function ld(e,n,r){return br(n,e.child,null,r),e=id(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Ag(e,n,r){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n),Su(e.return,n,r)}function cd(e,n,r,i,d,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:i,tail:r,tailMode:d,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=i,x.tail=r,x.tailMode=d,x.treeForkCount=h)}function _g(e,n,r){var i=n.pendingProps,d=i.revealOrder,h=i.tail;i=i.children;var x=at.current,_=(x&2)!==0;if(_?(x=x&1|2,n.flags|=128):x&=1,se(at,x),St(e,n,i,r),i=Be?is:0,!_&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ag(e,r,n);else if(e.tag===19)Ag(e,r,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(r=n.child,d=null;r!==null;)e=r.alternate,e!==null&&Pi(e)===null&&(d=r),r=r.sibling;r=d,r===null?(d=n.child,n.child=null):(d=r.sibling,r.sibling=null),cd(n,!1,d,r,h,i);break;case"backwards":case"unstable_legacy-backwards":for(r=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&Pi(e)===null){n.child=d;break}e=d.sibling,d.sibling=r,r=d,d=e}cd(n,!0,r,null,h,i);break;case"together":cd(n,!1,null,null,void 0,i);break;default:n.memoizedState=null}return n.child}function ta(e,n,r){if(e!==null&&(n.dependencies=e.dependencies),Da|=n.lanes,(r&n.childLanes)===0)if(e!==null){if(no(e,n,r,!1),(r&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(s(153));if(n.child!==null){for(e=n.child,r=Gn(e,e.pendingProps),n.child=r,r.return=n;e.sibling!==null;)e=e.sibling,r=r.sibling=Gn(e,e.pendingProps),r.return=n;r.sibling=null}return n.child}function ud(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Li(e)))}function Qk(e,n,r){switch(n.tag){case 3:le(n,n.stateNode.containerInfo),Ca(n,it,e.memoizedState.cache),mr();break;case 27:case 5:xe(n);break;case 4:le(n,n.stateNode.containerInfo);break;case 10:Ca(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Lu(n),null;break;case 13:var i=n.memoizedState;if(i!==null)return i.dehydrated!==null?(Aa(n),n.flags|=128,null):(r&n.child.childLanes)!==0?jg(e,n,r):(Aa(n),e=ta(e,n,r),e!==null?e.sibling:null);Aa(n);break;case 19:var d=(e.flags&128)!==0;if(i=(r&n.childLanes)!==0,i||(no(e,n,r,!1),i=(r&n.childLanes)!==0),d){if(i)return _g(e,n,r);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),se(at,at.current),i)break;return null;case 22:return n.lanes=0,kg(e,n,r,n.pendingProps);case 24:Ca(n,it,e.memoizedState.cache)}return ta(e,n,r)}function Rg(e,n,r){if(e!==null)if(e.memoizedProps!==n.pendingProps)ct=!0;else{if(!ud(e,r)&&(n.flags&128)===0)return ct=!1,Qk(e,n,r);ct=(e.flags&131072)!==0}else ct=!1,Be&&(n.flags&1048576)!==0&&ch(n,is,n.index);switch(n.lanes=0,n.tag){case 16:e:{var i=n.pendingProps;if(e=vr(n.elementType),n.type=e,typeof e=="function")hu(e)?(i=xr(e,i),n.tag=1,n=Tg(null,n,e,i,r)):(n.tag=0,n=ad(null,n,e,i,r));else{if(e!=null){var d=e.$$typeof;if(d===A){n.tag=11,n=bg(null,n,e,i,r);break e}else if(d===L){n.tag=14,n=wg(null,n,e,i,r);break e}}throw n=Z(e)||e,Error(s(306,n,""))}}return n;case 0:return ad(e,n,n.type,n.pendingProps,r);case 1:return i=n.type,d=xr(i,n.pendingProps),Tg(e,n,i,d,r);case 3:e:{if(le(n,n.stateNode.containerInfo),e===null)throw Error(s(387));i=n.pendingProps;var h=n.memoizedState;d=h.element,_u(e,n),hs(n,i,null,r);var x=n.memoizedState;if(i=x.cache,Ca(n,it,i),i!==h.cache&&Eu(n,[it],r,!0),ps(),i=x.element,h.isDehydrated)if(h={element:i,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=Ng(e,n,i,r);break e}else if(i!==d){d=fn(Error(s(424)),n),ls(d),n=Ng(e,n,i,r);break e}else for(e=n.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Xe=vn(e.firstChild),xt=n,Be=!0,Sa=null,hn=!0,r=kh(n,null,i,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(mr(),i===d){n=ta(e,n,r);break e}St(e,n,i,r)}n=n.child}return n;case 26:return el(e,n),e===null?(r=qv(n.type,null,n.pendingProps,null))?n.memoizedState=r:Be||(r=n.type,e=n.pendingProps,i=vl(fe.current).createElement(r),i[wt]=n,i[Ht]=e,Et(i,r,e),gt(i),n.stateNode=i):n.memoizedState=qv(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return xe(n),e===null&&Be&&(i=n.stateNode=Bv(n.type,n.pendingProps,fe.current),xt=n,hn=!0,d=Xe,Ua(n.type)?(Pd=d,Xe=vn(i.firstChild)):Xe=d),St(e,n,n.pendingProps.children,r),el(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Be&&((d=i=Xe)&&(i=j2(i,n.type,n.pendingProps,hn),i!==null?(n.stateNode=i,xt=n,Xe=vn(i.firstChild),hn=!1,d=!0):d=!1),d||Ea(n)),xe(n),d=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,i=h.children,Ud(d,h)?i=null:x!==null&&Ud(d,x)&&(n.flags|=32),n.memoizedState!==null&&(d=Hu(e,n,Pk,null,null,r),Ls._currentValue=d),el(e,n),St(e,n,i,r),n.child;case 6:return e===null&&Be&&((e=r=Xe)&&(r=A2(r,n.pendingProps,hn),r!==null?(n.stateNode=r,xt=n,Xe=null,e=!0):e=!1),e||Ea(n)),null;case 13:return jg(e,n,r);case 4:return le(n,n.stateNode.containerInfo),i=n.pendingProps,e===null?n.child=br(n,null,i,r):St(e,n,i,r),n.child;case 11:return bg(e,n,n.type,n.pendingProps,r);case 7:return St(e,n,n.pendingProps,r),n.child;case 8:return St(e,n,n.pendingProps.children,r),n.child;case 12:return St(e,n,n.pendingProps.children,r),n.child;case 10:return i=n.pendingProps,Ca(n,n.type,i.value),St(e,n,i.children,r),n.child;case 9:return d=n.type._context,i=n.pendingProps.children,hr(n),d=kt(d),i=i(d),n.flags|=1,St(e,n,i,r),n.child;case 14:return wg(e,n,n.type,n.pendingProps,r);case 15:return xg(e,n,n.type,n.pendingProps,r);case 19:return _g(e,n,r);case 31:return Zk(e,n,r);case 22:return kg(e,n,r,n.pendingProps);case 24:return hr(n),i=kt(it),e===null?(d=Nu(),d===null&&(d=Ve,h=Cu(),d.pooledCache=h,h.refCount++,h!==null&&(d.pooledCacheLanes|=r),d=h),n.memoizedState={parent:i,cache:d},Au(n),Ca(n,it,d)):((e.lanes&r)!==0&&(_u(e,n),hs(n,null,null,r),ps()),d=e.memoizedState,h=n.memoizedState,d.parent!==i?(d={parent:i,cache:i},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),Ca(n,it,i)):(i=h.cache,Ca(n,it,i),i!==d.cache&&Eu(n,[it],r,!0))),St(e,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function na(e){e.flags|=4}function dd(e,n,r,i,d){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(rv())e.flags|=8192;else throw yr=Bi,ju}else e.flags&=-16777217}function Og(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!$v(n))if(rv())e.flags|=8192;else throw yr=Bi,ju}function nl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?dp():536870912,e.lanes|=n,ho|=n)}function xs(e,n){if(!Be)switch(e.tailMode){case"hidden":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Ze(e){var n=e.alternate!==null&&e.alternate.child===e.child,r=0,i=0;if(n)for(var d=e.child;d!==null;)r|=d.lanes|d.childLanes,i|=d.subtreeFlags&65011712,i|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)r|=d.lanes|d.childLanes,i|=d.subtreeFlags,i|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=i,e.childLanes=r,n}function Jk(e,n,r){var i=n.pendingProps;switch(bu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(n),null;case 1:return Ze(n),null;case 3:return r=n.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Qn(it),ie(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(to(n)?na(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,xu())),Ze(n),null;case 26:var d=n.type,h=n.memoizedState;return e===null?(na(n),h!==null?(Ze(n),Og(n,h)):(Ze(n),dd(n,d,null,i,r))):h?h!==e.memoizedState?(na(n),Ze(n),Og(n,h)):(Ze(n),n.flags&=-16777217):(e=e.memoizedProps,e!==i&&na(n),Ze(n),dd(n,d,e,i,r)),null;case 27:if(Ne(n),r=fe.current,d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&na(n);else{if(!i){if(n.stateNode===null)throw Error(s(166));return Ze(n),null}e=re.current,to(n)?dh(n):(e=Bv(d,i,r),n.stateNode=e,na(n))}return Ze(n),null;case 5:if(Ne(n),d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==i&&na(n);else{if(!i){if(n.stateNode===null)throw Error(s(166));return Ze(n),null}if(h=re.current,to(n))dh(n);else{var x=vl(fe.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof i.is=="string"?x.createElement("select",{is:i.is}):x.createElement("select"),i.multiple?h.multiple=!0:i.size&&(h.size=i.size);break;default:h=typeof i.is=="string"?x.createElement(d,{is:i.is}):x.createElement(d)}}h[wt]=n,h[Ht]=i;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(Et(h,d,i),d){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&na(n)}}return Ze(n),dd(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,r),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==i&&na(n);else{if(typeof i!="string"&&n.stateNode===null)throw Error(s(166));if(e=fe.current,to(n)){if(e=n.stateNode,r=n.memoizedProps,i=null,d=xt,d!==null)switch(d.tag){case 27:case 5:i=d.memoizedProps}e[wt]=n,e=!!(e.nodeValue===r||i!==null&&i.suppressHydrationWarning===!0||jv(e.nodeValue,r)),e||Ea(n,!0)}else e=vl(e).createTextNode(i),e[wt]=n,n.stateNode=e}return Ze(n),null;case 31:if(r=n.memoizedState,e===null||e.memoizedState!==null){if(i=to(n),r!==null){if(e===null){if(!i)throw Error(s(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[wt]=n}else mr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ze(n),e=!1}else r=xu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return n.flags&256?(Qt(n),n):(Qt(n),null);if((n.flags&128)!==0)throw Error(s(558))}return Ze(n),null;case 13:if(i=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=to(n),i!==null&&i.dehydrated!==null){if(e===null){if(!d)throw Error(s(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(s(317));d[wt]=n}else mr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ze(n),d=!1}else d=xu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(Qt(n),n):(Qt(n),null)}return Qt(n),(n.flags&128)!==0?(n.lanes=r,n):(r=i!==null,e=e!==null&&e.memoizedState!==null,r&&(i=n.child,d=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(d=i.alternate.memoizedState.cachePool.pool),h=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),h!==d&&(i.flags|=2048)),r!==e&&r&&(n.child.flags|=8192),nl(n,n.updateQueue),Ze(n),null);case 4:return ie(),e===null&&Dd(n.stateNode.containerInfo),Ze(n),null;case 10:return Qn(n.type),Ze(n),null;case 19:if(B(at),i=n.memoizedState,i===null)return Ze(n),null;if(d=(n.flags&128)!==0,h=i.rendering,h===null)if(d)xs(i,!1);else{if(tt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Pi(e),h!==null){for(n.flags|=128,xs(i,!1),e=h.updateQueue,n.updateQueue=e,nl(n,e),n.subtreeFlags=0,e=r,r=n.child;r!==null;)sh(r,e),r=r.sibling;return se(at,at.current&1|2),Be&&Xn(n,i.treeForkCount),n.child}e=e.sibling}i.tail!==null&&Se()>il&&(n.flags|=128,d=!0,xs(i,!1),n.lanes=4194304)}else{if(!d)if(e=Pi(h),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,nl(n,e),xs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!h.alternate&&!Be)return Ze(n),null}else 2*Se()-i.renderingStartTime>il&&r!==536870912&&(n.flags|=128,d=!0,xs(i,!1),n.lanes=4194304);i.isBackwards?(h.sibling=n.child,n.child=h):(e=i.last,e!==null?e.sibling=h:n.child=h,i.last=h)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Se(),e.sibling=null,r=at.current,se(at,d?r&1|2:r&1),Be&&Xn(n,i.treeForkCount),e):(Ze(n),null);case 22:case 23:return Qt(n),Mu(),i=n.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(n.flags|=8192):i&&(n.flags|=8192),i?(r&536870912)!==0&&(n.flags&128)===0&&(Ze(n),n.subtreeFlags&6&&(n.flags|=8192)):Ze(n),r=n.updateQueue,r!==null&&nl(n,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==r&&(n.flags|=2048),e!==null&&B(gr),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),Qn(it),Ze(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function e2(e,n){switch(bu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Qn(it),ie(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Ne(n),null;case 31:if(n.memoizedState!==null){if(Qt(n),n.alternate===null)throw Error(s(340));mr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Qt(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(s(340));mr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return B(at),null;case 4:return ie(),null;case 10:return Qn(n.type),null;case 22:case 23:return Qt(n),Mu(),e!==null&&B(gr),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Qn(it),null;case 25:return null;default:return null}}function Dg(e,n){switch(bu(n),n.tag){case 3:Qn(it),ie();break;case 26:case 27:case 5:Ne(n);break;case 4:ie();break;case 31:n.memoizedState!==null&&Qt(n);break;case 13:Qt(n);break;case 19:B(at);break;case 10:Qn(n.type);break;case 22:case 23:Qt(n),Mu(),e!==null&&B(gr);break;case 24:Qn(it)}}function ks(e,n){try{var r=n.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var d=i.next;r=d;do{if((r.tag&e)===e){i=void 0;var h=r.create,x=r.inst;i=h(),x.destroy=i}r=r.next}while(r!==d)}}catch(_){Fe(n,n.return,_)}}function Ra(e,n,r){try{var i=n.updateQueue,d=i!==null?i.lastEffect:null;if(d!==null){var h=d.next;i=h;do{if((i.tag&e)===e){var x=i.inst,_=x.destroy;if(_!==void 0){x.destroy=void 0,d=n;var z=r,Y=_;try{Y()}catch(te){Fe(d,z,te)}}}i=i.next}while(i!==h)}}catch(te){Fe(n,n.return,te)}}function Mg(e){var n=e.updateQueue;if(n!==null){var r=e.stateNode;try{Eh(n,r)}catch(i){Fe(e,e.return,i)}}}function Lg(e,n,r){r.props=xr(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(i){Fe(e,n,i)}}function Ss(e,n){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof r=="function"?e.refCleanup=r(i):r.current=i}}catch(d){Fe(e,n,d)}}function Mn(e,n){var r=e.ref,i=e.refCleanup;if(r!==null)if(typeof i=="function")try{i()}catch(d){Fe(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(d){Fe(e,n,d)}else r.current=null}function zg(e){var n=e.type,r=e.memoizedProps,i=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&i.focus();break e;case"img":r.src?i.src=r.src:r.srcSet&&(i.srcset=r.srcSet)}}catch(d){Fe(e,e.return,d)}}function fd(e,n,r){try{var i=e.stateNode;k2(i,e.type,r,n),i[Ht]=n}catch(d){Fe(e,e.return,d)}}function Hg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ua(e.type)||e.tag===4}function md(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Hg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ua(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function pd(e,n,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(e),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=$n));else if(i!==4&&(i===27&&Ua(e.type)&&(r=e.stateNode,n=null),e=e.child,e!==null))for(pd(e,n,r),e=e.sibling;e!==null;)pd(e,n,r),e=e.sibling}function al(e,n,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?r.insertBefore(e,n):r.appendChild(e);else if(i!==4&&(i===27&&Ua(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(al(e,n,r),e=e.sibling;e!==null;)al(e,n,r),e=e.sibling}function Ug(e){var n=e.stateNode,r=e.memoizedProps;try{for(var i=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);Et(n,i,r),n[wt]=e,n[Ht]=r}catch(h){Fe(e,e.return,h)}}var aa=!1,ut=!1,hd=!1,Bg=typeof WeakSet=="function"?WeakSet:Set,vt=null;function t2(e,n){if(e=e.containerInfo,zd=El,e=Zp(e),lu(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var d=i.anchorOffset,h=i.focusNode;i=i.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var x=0,_=-1,z=-1,Y=0,te=0,oe=e,X=null;t:for(;;){for(var ee;oe!==r||d!==0&&oe.nodeType!==3||(_=x+d),oe!==h||i!==0&&oe.nodeType!==3||(z=x+i),oe.nodeType===3&&(x+=oe.nodeValue.length),(ee=oe.firstChild)!==null;)X=oe,oe=ee;for(;;){if(oe===e)break t;if(X===r&&++Y===d&&(_=x),X===h&&++te===i&&(z=x),(ee=oe.nextSibling)!==null)break;oe=X,X=oe.parentNode}oe=ee}r=_===-1||z===-1?null:{start:_,end:z}}else r=null}r=r||{start:0,end:0}}else r=null;for(Hd={focusedElem:e,selectionRange:r},El=!1,vt=n;vt!==null;)if(n=vt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,vt=e;else for(;vt!==null;){switch(n=vt,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)d=e[r],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,r=n,d=h.memoizedProps,h=h.memoizedState,i=r.stateNode;try{var me=xr(r.type,d);e=i.getSnapshotBeforeUpdate(me,h),i.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){Fe(r,r.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,r=e.nodeType,r===9)Wd(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Wd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=n.sibling,e!==null){e.return=n.return,vt=e;break}vt=n.return}}function Wg(e,n,r){var i=r.flags;switch(r.tag){case 0:case 11:case 15:oa(e,r),i&4&&ks(5,r);break;case 1:if(oa(e,r),i&4)if(e=r.stateNode,n===null)try{e.componentDidMount()}catch(x){Fe(r,r.return,x)}else{var d=xr(r.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(d,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){Fe(r,r.return,x)}}i&64&&Mg(r),i&512&&Ss(r,r.return);break;case 3:if(oa(e,r),i&64&&(e=r.updateQueue,e!==null)){if(n=null,r.child!==null)switch(r.child.tag){case 27:case 5:n=r.child.stateNode;break;case 1:n=r.child.stateNode}try{Eh(e,n)}catch(x){Fe(r,r.return,x)}}break;case 27:n===null&&i&4&&Ug(r);case 26:case 5:oa(e,r),n===null&&i&4&&zg(r),i&512&&Ss(r,r.return);break;case 12:oa(e,r);break;case 31:oa(e,r),i&4&&Pg(e,r);break;case 13:oa(e,r),i&4&&Fg(e,r),i&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=u2.bind(null,r),_2(e,r))));break;case 22:if(i=r.memoizedState!==null||aa,!i){n=n!==null&&n.memoizedState!==null||ut,d=aa;var h=ut;aa=i,(ut=n)&&!h?sa(e,r,(r.subtreeFlags&8772)!==0):oa(e,r),aa=d,ut=h}break;case 30:break;default:oa(e,r)}}function Ig(e){var n=e.alternate;n!==null&&(e.alternate=null,Ig(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Kc(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Qe=null,Bt=!1;function ra(e,n,r){for(r=r.child;r!==null;)qg(e,n,r),r=r.sibling}function qg(e,n,r){if(bt&&typeof bt.onCommitFiberUnmount=="function")try{bt.onCommitFiberUnmount(ya,r)}catch{}switch(r.tag){case 26:ut||Mn(r,n),ra(e,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:ut||Mn(r,n);var i=Qe,d=Bt;Ua(r.type)&&(Qe=r.stateNode,Bt=!1),ra(e,n,r),Os(r.stateNode),Qe=i,Bt=d;break;case 5:ut||Mn(r,n);case 6:if(i=Qe,d=Bt,Qe=null,ra(e,n,r),Qe=i,Bt=d,Qe!==null)if(Bt)try{(Qe.nodeType===9?Qe.body:Qe.nodeName==="HTML"?Qe.ownerDocument.body:Qe).removeChild(r.stateNode)}catch(h){Fe(r,n,h)}else try{Qe.removeChild(r.stateNode)}catch(h){Fe(r,n,h)}break;case 18:Qe!==null&&(Bt?(e=Qe,Mv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),So(e)):Mv(Qe,r.stateNode));break;case 4:i=Qe,d=Bt,Qe=r.stateNode.containerInfo,Bt=!0,ra(e,n,r),Qe=i,Bt=d;break;case 0:case 11:case 14:case 15:Ra(2,r,n),ut||Ra(4,r,n),ra(e,n,r);break;case 1:ut||(Mn(r,n),i=r.stateNode,typeof i.componentWillUnmount=="function"&&Lg(r,n,i)),ra(e,n,r);break;case 21:ra(e,n,r);break;case 22:ut=(i=ut)||r.memoizedState!==null,ra(e,n,r),ut=i;break;default:ra(e,n,r)}}function Pg(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{So(e)}catch(r){Fe(n,n.return,r)}}}function Fg(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{So(e)}catch(r){Fe(n,n.return,r)}}function n2(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Bg),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Bg),n;default:throw Error(s(435,e.tag))}}function rl(e,n){var r=n2(e);n.forEach(function(i){if(!r.has(i)){r.add(i);var d=d2.bind(null,e,i);i.then(d,d)}})}function Wt(e,n){var r=n.deletions;if(r!==null)for(var i=0;i<r.length;i++){var d=r[i],h=e,x=n,_=x;e:for(;_!==null;){switch(_.tag){case 27:if(Ua(_.type)){Qe=_.stateNode,Bt=!1;break e}break;case 5:Qe=_.stateNode,Bt=!1;break e;case 3:case 4:Qe=_.stateNode.containerInfo,Bt=!0;break e}_=_.return}if(Qe===null)throw Error(s(160));qg(h,x,d),Qe=null,Bt=!1,h=d.alternate,h!==null&&(h.return=null),d.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Kg(n,e),n=n.sibling}var Sn=null;function Kg(e,n){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Wt(n,e),It(e),i&4&&(Ra(3,e,e.return),ks(3,e),Ra(5,e,e.return));break;case 1:Wt(n,e),It(e),i&512&&(ut||r===null||Mn(r,r.return)),i&64&&aa&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?i:r.concat(i))));break;case 26:var d=Sn;if(Wt(n,e),It(e),i&512&&(ut||r===null||Mn(r,r.return)),i&4){var h=r!==null?r.memoizedState:null;if(i=e.memoizedState,r===null)if(i===null)if(e.stateNode===null){e:{i=e.type,r=e.memoizedProps,d=d.ownerDocument||d;t:switch(i){case"title":h=d.getElementsByTagName("title")[0],(!h||h[Xo]||h[wt]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=d.createElement(i),d.head.insertBefore(h,d.querySelector("head > title"))),Et(h,i,r),h[wt]=e,gt(h),i=h;break e;case"link":var x=Kv("link","href",d).get(i+(r.href||""));if(x){for(var _=0;_<x.length;_++)if(h=x[_],h.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&h.getAttribute("rel")===(r.rel==null?null:r.rel)&&h.getAttribute("title")===(r.title==null?null:r.title)&&h.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){x.splice(_,1);break t}}h=d.createElement(i),Et(h,i,r),d.head.appendChild(h);break;case"meta":if(x=Kv("meta","content",d).get(i+(r.content||""))){for(_=0;_<x.length;_++)if(h=x[_],h.getAttribute("content")===(r.content==null?null:""+r.content)&&h.getAttribute("name")===(r.name==null?null:r.name)&&h.getAttribute("property")===(r.property==null?null:r.property)&&h.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&h.getAttribute("charset")===(r.charSet==null?null:r.charSet)){x.splice(_,1);break t}}h=d.createElement(i),Et(h,i,r),d.head.appendChild(h);break;default:throw Error(s(468,i))}h[wt]=e,gt(h),i=h}e.stateNode=i}else Yv(d,e.type,e.stateNode);else e.stateNode=Fv(d,i,e.memoizedProps);else h!==i?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,i===null?Yv(d,e.type,e.stateNode):Fv(d,i,e.memoizedProps)):i===null&&e.stateNode!==null&&fd(e,e.memoizedProps,r.memoizedProps)}break;case 27:Wt(n,e),It(e),i&512&&(ut||r===null||Mn(r,r.return)),r!==null&&i&4&&fd(e,e.memoizedProps,r.memoizedProps);break;case 5:if(Wt(n,e),It(e),i&512&&(ut||r===null||Mn(r,r.return)),e.flags&32){d=e.stateNode;try{Kr(d,"")}catch(me){Fe(e,e.return,me)}}i&4&&e.stateNode!=null&&(d=e.memoizedProps,fd(e,d,r!==null?r.memoizedProps:d)),i&1024&&(hd=!0);break;case 6:if(Wt(n,e),It(e),i&4){if(e.stateNode===null)throw Error(s(162));i=e.memoizedProps,r=e.stateNode;try{r.nodeValue=i}catch(me){Fe(e,e.return,me)}}break;case 3:if(wl=null,d=Sn,Sn=yl(n.containerInfo),Wt(n,e),Sn=d,It(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{So(n.containerInfo)}catch(me){Fe(e,e.return,me)}hd&&(hd=!1,Yg(e));break;case 4:i=Sn,Sn=yl(e.stateNode.containerInfo),Wt(n,e),It(e),Sn=i;break;case 12:Wt(n,e),It(e);break;case 31:Wt(n,e),It(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,rl(e,i)));break;case 13:Wt(n,e),It(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(sl=Se()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,rl(e,i)));break;case 22:d=e.memoizedState!==null;var z=r!==null&&r.memoizedState!==null,Y=aa,te=ut;if(aa=Y||d,ut=te||z,Wt(n,e),ut=te,aa=Y,It(e),i&8192)e:for(n=e.stateNode,n._visibility=d?n._visibility&-2:n._visibility|1,d&&(r===null||z||aa||ut||kr(e)),r=null,n=e;;){if(n.tag===5||n.tag===26){if(r===null){z=r=n;try{if(h=z.stateNode,d)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{_=z.stateNode;var oe=z.memoizedProps.style,X=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;_.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(me){Fe(z,z.return,me)}}}else if(n.tag===6){if(r===null){z=n;try{z.stateNode.nodeValue=d?"":z.memoizedProps}catch(me){Fe(z,z.return,me)}}}else if(n.tag===18){if(r===null){z=n;try{var ee=z.stateNode;d?Lv(ee,!0):Lv(z.stateNode,!1)}catch(me){Fe(z,z.return,me)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;r===n&&(r=null),n=n.return}r===n&&(r=null),n.sibling.return=n.return,n=n.sibling}i&4&&(i=e.updateQueue,i!==null&&(r=i.retryQueue,r!==null&&(i.retryQueue=null,rl(e,r))));break;case 19:Wt(n,e),It(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,rl(e,i)));break;case 30:break;case 21:break;default:Wt(n,e),It(e)}}function It(e){var n=e.flags;if(n&2){try{for(var r,i=e.return;i!==null;){if(Hg(i)){r=i;break}i=i.return}if(r==null)throw Error(s(160));switch(r.tag){case 27:var d=r.stateNode,h=md(e);al(e,h,d);break;case 5:var x=r.stateNode;r.flags&32&&(Kr(x,""),r.flags&=-33);var _=md(e);al(e,_,x);break;case 3:case 4:var z=r.stateNode.containerInfo,Y=md(e);pd(e,Y,z);break;default:throw Error(s(161))}}catch(te){Fe(e,e.return,te)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Yg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Yg(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function oa(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Wg(e,n.alternate,n),n=n.sibling}function kr(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Ra(4,n,n.return),kr(n);break;case 1:Mn(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&Lg(n,n.return,r),kr(n);break;case 27:Os(n.stateNode);case 26:case 5:Mn(n,n.return),kr(n);break;case 22:n.memoizedState===null&&kr(n);break;case 30:kr(n);break;default:kr(n)}e=e.sibling}}function sa(e,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var i=n.alternate,d=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:sa(d,h,r),ks(4,h);break;case 1:if(sa(d,h,r),i=h,d=i.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(Y){Fe(i,i.return,Y)}if(i=h,d=i.updateQueue,d!==null){var _=i.stateNode;try{var z=d.shared.hiddenCallbacks;if(z!==null)for(d.shared.hiddenCallbacks=null,d=0;d<z.length;d++)Sh(z[d],_)}catch(Y){Fe(i,i.return,Y)}}r&&x&64&&Mg(h),Ss(h,h.return);break;case 27:Ug(h);case 26:case 5:sa(d,h,r),r&&i===null&&x&4&&zg(h),Ss(h,h.return);break;case 12:sa(d,h,r);break;case 31:sa(d,h,r),r&&x&4&&Pg(d,h);break;case 13:sa(d,h,r),r&&x&4&&Fg(d,h);break;case 22:h.memoizedState===null&&sa(d,h,r),Ss(h,h.return);break;case 30:break;default:sa(d,h,r)}n=n.sibling}}function gd(e,n){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&cs(r))}function vd(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&cs(e))}function En(e,n,r,i){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)$g(e,n,r,i),n=n.sibling}function $g(e,n,r,i){var d=n.flags;switch(n.tag){case 0:case 11:case 15:En(e,n,r,i),d&2048&&ks(9,n);break;case 1:En(e,n,r,i);break;case 3:En(e,n,r,i),d&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&cs(e)));break;case 12:if(d&2048){En(e,n,r,i),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,_=h.onPostCommit;typeof _=="function"&&_(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(z){Fe(n,n.return,z)}}else En(e,n,r,i);break;case 31:En(e,n,r,i);break;case 13:En(e,n,r,i);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?En(e,n,r,i):Es(e,n):h._visibility&2?En(e,n,r,i):(h._visibility|=2,fo(e,n,r,i,(n.subtreeFlags&10256)!==0||!1)),d&2048&&gd(x,n);break;case 24:En(e,n,r,i),d&2048&&vd(n.alternate,n);break;default:En(e,n,r,i)}}function fo(e,n,r,i,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,_=r,z=i,Y=x.flags;switch(x.tag){case 0:case 11:case 15:fo(h,x,_,z,d),ks(8,x);break;case 23:break;case 22:var te=x.stateNode;x.memoizedState!==null?te._visibility&2?fo(h,x,_,z,d):Es(h,x):(te._visibility|=2,fo(h,x,_,z,d)),d&&Y&2048&&gd(x.alternate,x);break;case 24:fo(h,x,_,z,d),d&&Y&2048&&vd(x.alternate,x);break;default:fo(h,x,_,z,d)}n=n.sibling}}function Es(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var r=e,i=n,d=i.flags;switch(i.tag){case 22:Es(r,i),d&2048&&gd(i.alternate,i);break;case 24:Es(r,i),d&2048&&vd(i.alternate,i);break;default:Es(r,i)}n=n.sibling}}var Cs=8192;function mo(e,n,r){if(e.subtreeFlags&Cs)for(e=e.child;e!==null;)Vg(e,n,r),e=e.sibling}function Vg(e,n,r){switch(e.tag){case 26:mo(e,n,r),e.flags&Cs&&e.memoizedState!==null&&q2(r,Sn,e.memoizedState,e.memoizedProps);break;case 5:mo(e,n,r);break;case 3:case 4:var i=Sn;Sn=yl(e.stateNode.containerInfo),mo(e,n,r),Sn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Cs,Cs=16777216,mo(e,n,r),Cs=i):mo(e,n,r));break;default:mo(e,n,r)}}function Gg(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Ts(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];vt=i,Zg(i,e)}Gg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Xg(e),e=e.sibling}function Xg(e){switch(e.tag){case 0:case 11:case 15:Ts(e),e.flags&2048&&Ra(9,e,e.return);break;case 3:Ts(e);break;case 12:Ts(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,ol(e)):Ts(e);break;default:Ts(e)}}function ol(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];vt=i,Zg(i,e)}Gg(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Ra(8,n,n.return),ol(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,ol(n));break;default:ol(n)}e=e.sibling}}function Zg(e,n){for(;vt!==null;){var r=vt;switch(r.tag){case 0:case 11:case 15:Ra(8,r,n);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var i=r.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:cs(r.memoizedState.cache)}if(i=r.child,i!==null)i.return=r,vt=i;else e:for(r=e;vt!==null;){i=vt;var d=i.sibling,h=i.return;if(Ig(i),i===r){vt=null;break e}if(d!==null){d.return=h,vt=d;break e}vt=h}}}var a2={getCacheForType:function(e){var n=kt(it),r=n.data.get(e);return r===void 0&&(r=e(),n.data.set(e,r)),r},cacheSignal:function(){return kt(it).controller.signal}},r2=typeof WeakMap=="function"?WeakMap:Map,qe=0,Ve=null,Me=null,ze=0,Pe=0,Jt=null,Oa=!1,po=!1,yd=!1,ia=0,tt=0,Da=0,Sr=0,bd=0,en=0,ho=0,Ns=null,qt=null,wd=!1,sl=0,Qg=0,il=1/0,ll=null,Ma=null,mt=0,La=null,go=null,la=0,xd=0,kd=null,Jg=null,js=0,Sd=null;function tn(){return(qe&2)!==0&&ze!==0?ze&-ze:M.T!==null?Ad():hp()}function ev(){if(en===0)if((ze&536870912)===0||Be){var e=gi;gi<<=1,(gi&3932160)===0&&(gi=262144),en=e}else en=536870912;return e=Zt.current,e!==null&&(e.flags|=32),en}function Pt(e,n,r){(e===Ve&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(vo(e,0),za(e,ze,en,!1)),Go(e,r),((qe&2)===0||e!==Ve)&&(e===Ve&&((qe&2)===0&&(Sr|=r),tt===4&&za(e,ze,en,!1)),Ln(e))}function tv(e,n,r){if((qe&6)!==0)throw Error(s(327));var i=!r&&(n&127)===0&&(n&e.expiredLanes)===0||Vo(e,n),d=i?i2(e,n):Cd(e,n,!0),h=i;do{if(d===0){po&&!i&&za(e,n,0,!1);break}else{if(r=e.current.alternate,h&&!o2(r)){d=Cd(e,n,!1),h=!1;continue}if(d===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var _=e;d=Ns;var z=_.current.memoizedState.isDehydrated;if(z&&(vo(_,x).flags|=256),x=Cd(_,x,!1),x!==2){if(yd&&!z){_.errorRecoveryDisabledLanes|=h,Sr|=h,d=4;break e}h=qt,qt=d,h!==null&&(qt===null?qt=h:qt.push.apply(qt,h))}d=x}if(h=!1,d!==2)continue}}if(d===1){vo(e,0),za(e,n,0,!0);break}e:{switch(i=e,h=d,h){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:za(i,n,en,!Oa);break e;case 2:qt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(d=sl+300-Se(),10<d)){if(za(i,n,en,!Oa),yi(i,0,!0)!==0)break e;la=n,i.timeoutHandle=Ov(nv.bind(null,i,r,qt,ll,wd,n,en,Sr,ho,Oa,h,"Throttled",-0,0),d);break e}nv(i,r,qt,ll,wd,n,en,Sr,ho,Oa,h,null,-0,0)}}break}while(!0);Ln(e)}function nv(e,n,r,i,d,h,x,_,z,Y,te,oe,X,ee){if(e.timeoutHandle=-1,oe=n.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$n},Vg(n,h,oe);var me=(h&62914560)===h?sl-Se():(h&4194048)===h?Qg-Se():0;if(me=P2(oe,me),me!==null){la=h,e.cancelPendingCommit=me(uv.bind(null,e,n,h,r,i,d,x,_,z,te,oe,null,X,ee)),za(e,h,x,!Y);return}}uv(e,n,h,r,i,d,x,_,z)}function o2(e){for(var n=e;;){var r=n.tag;if((r===0||r===11||r===15)&&n.flags&16384&&(r=n.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var i=0;i<r.length;i++){var d=r[i],h=d.getSnapshot;d=d.value;try{if(!Gt(h(),d))return!1}catch{return!1}}if(r=n.child,n.subtreeFlags&16384&&r!==null)r.return=n,n=r;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function za(e,n,r,i){n&=~bd,n&=~Sr,e.suspendedLanes|=n,e.pingedLanes&=~n,i&&(e.warmLanes|=n),i=e.expirationTimes;for(var d=n;0<d;){var h=31-ht(d),x=1<<h;i[h]=-1,d&=~x}r!==0&&fp(e,r,n)}function cl(){return(qe&6)===0?(As(0),!1):!0}function Ed(){if(Me!==null){if(Pe===0)var e=Me.return;else e=Me,Zn=pr=null,Wu(e),so=null,ds=0,e=Me;for(;e!==null;)Dg(e.alternate,e),e=e.return;Me=null}}function vo(e,n){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,C2(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),la=0,Ed(),Ve=e,Me=r=Gn(e.current,null),ze=n,Pe=0,Jt=null,Oa=!1,po=Vo(e,n),yd=!1,ho=en=bd=Sr=Da=tt=0,qt=Ns=null,wd=!1,(n&8)!==0&&(n|=n&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=n;0<i;){var d=31-ht(i),h=1<<d;n|=e[d],i&=~h}return ia=n,_i(),r}function av(e,n){Re=null,M.H=bs,n===oo||n===Ui?(n=bh(),Pe=3):n===ju?(n=bh(),Pe=4):Pe=n===nd?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Jt=n,Me===null&&(tt=1,Qi(e,fn(n,e.current)))}function rv(){var e=Zt.current;return e===null?!0:(ze&4194048)===ze?gn===null:(ze&62914560)===ze||(ze&536870912)!==0?e===gn:!1}function ov(){var e=M.H;return M.H=bs,e===null?bs:e}function sv(){var e=M.A;return M.A=a2,e}function ul(){tt=4,Oa||(ze&4194048)!==ze&&Zt.current!==null||(po=!0),(Da&134217727)===0&&(Sr&134217727)===0||Ve===null||za(Ve,ze,en,!1)}function Cd(e,n,r){var i=qe;qe|=2;var d=ov(),h=sv();(Ve!==e||ze!==n)&&(ll=null,vo(e,n)),n=!1;var x=tt;e:do try{if(Pe!==0&&Me!==null){var _=Me,z=Jt;switch(Pe){case 8:Ed(),x=6;break e;case 3:case 2:case 9:case 6:Zt.current===null&&(n=!0);var Y=Pe;if(Pe=0,Jt=null,yo(e,_,z,Y),r&&po){x=0;break e}break;default:Y=Pe,Pe=0,Jt=null,yo(e,_,z,Y)}}s2(),x=tt;break}catch(te){av(e,te)}while(!0);return n&&e.shellSuspendCounter++,Zn=pr=null,qe=i,M.H=d,M.A=h,Me===null&&(Ve=null,ze=0,_i()),x}function s2(){for(;Me!==null;)iv(Me)}function i2(e,n){var r=qe;qe|=2;var i=ov(),d=sv();Ve!==e||ze!==n?(ll=null,il=Se()+500,vo(e,n)):po=Vo(e,n);e:do try{if(Pe!==0&&Me!==null){n=Me;var h=Jt;t:switch(Pe){case 1:Pe=0,Jt=null,yo(e,n,h,1);break;case 2:case 9:if(vh(h)){Pe=0,Jt=null,lv(n);break}n=function(){Pe!==2&&Pe!==9||Ve!==e||(Pe=7),Ln(e)},h.then(n,n);break e;case 3:Pe=7;break e;case 4:Pe=5;break e;case 7:vh(h)?(Pe=0,Jt=null,lv(n)):(Pe=0,Jt=null,yo(e,n,h,7));break;case 5:var x=null;switch(Me.tag){case 26:x=Me.memoizedState;case 5:case 27:var _=Me;if(x?$v(x):_.stateNode.complete){Pe=0,Jt=null;var z=_.sibling;if(z!==null)Me=z;else{var Y=_.return;Y!==null?(Me=Y,dl(Y)):Me=null}break t}}Pe=0,Jt=null,yo(e,n,h,5);break;case 6:Pe=0,Jt=null,yo(e,n,h,6);break;case 8:Ed(),tt=6;break e;default:throw Error(s(462))}}l2();break}catch(te){av(e,te)}while(!0);return Zn=pr=null,M.H=i,M.A=d,qe=r,Me!==null?0:(Ve=null,ze=0,_i(),tt)}function l2(){for(;Me!==null&&!zt();)iv(Me)}function iv(e){var n=Rg(e.alternate,e,ia);e.memoizedProps=e.pendingProps,n===null?dl(e):Me=n}function lv(e){var n=e,r=n.alternate;switch(n.tag){case 15:case 0:n=Cg(r,n,n.pendingProps,n.type,void 0,ze);break;case 11:n=Cg(r,n,n.pendingProps,n.type.render,n.ref,ze);break;case 5:Wu(n);default:Dg(r,n),n=Me=sh(n,ia),n=Rg(r,n,ia)}e.memoizedProps=e.pendingProps,n===null?dl(e):Me=n}function yo(e,n,r,i){Zn=pr=null,Wu(n),so=null,ds=0;var d=n.return;try{if(Xk(e,d,n,r,ze)){tt=1,Qi(e,fn(r,e.current)),Me=null;return}}catch(h){if(d!==null)throw Me=d,h;tt=1,Qi(e,fn(r,e.current)),Me=null;return}n.flags&32768?(Be||i===1?e=!0:po||(ze&536870912)!==0?e=!1:(Oa=e=!0,(i===2||i===9||i===3||i===6)&&(i=Zt.current,i!==null&&i.tag===13&&(i.flags|=16384))),cv(n,e)):dl(n)}function dl(e){var n=e;do{if((n.flags&32768)!==0){cv(n,Oa);return}e=n.return;var r=Jk(n.alternate,n,ia);if(r!==null){Me=r;return}if(n=n.sibling,n!==null){Me=n;return}Me=n=e}while(n!==null);tt===0&&(tt=5)}function cv(e,n){do{var r=e2(e.alternate,e);if(r!==null){r.flags&=32767,Me=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(e=e.sibling,e!==null)){Me=e;return}Me=e=r}while(e!==null);tt=6,Me=null}function uv(e,n,r,i,d,h,x,_,z){e.cancelPendingCommit=null;do fl();while(mt!==0);if((qe&6)!==0)throw Error(s(327));if(n!==null){if(n===e.current)throw Error(s(177));if(h=n.lanes|n.childLanes,h|=mu,I1(e,r,h,x,_,z),e===Ve&&(Me=Ve=null,ze=0),go=n,La=e,la=r,xd=h,kd=d,Jg=i,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,f2(de,function(){return hv(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||i){i=M.T,M.T=null,d=U.p,U.p=2,x=qe,qe|=4;try{t2(e,n,r)}finally{qe=x,U.p=d,M.T=i}}mt=1,dv(),fv(),mv()}}function dv(){if(mt===1){mt=0;var e=La,n=go,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var i=U.p;U.p=2;var d=qe;qe|=4;try{Kg(n,e);var h=Hd,x=Zp(e.containerInfo),_=h.focusedElem,z=h.selectionRange;if(x!==_&&_&&_.ownerDocument&&Xp(_.ownerDocument.documentElement,_)){if(z!==null&&lu(_)){var Y=z.start,te=z.end;if(te===void 0&&(te=Y),"selectionStart"in _)_.selectionStart=Y,_.selectionEnd=Math.min(te,_.value.length);else{var oe=_.ownerDocument||document,X=oe&&oe.defaultView||window;if(X.getSelection){var ee=X.getSelection(),me=_.textContent.length,Ee=Math.min(z.start,me),$e=z.end===void 0?Ee:Math.min(z.end,me);!ee.extend&&Ee>$e&&(x=$e,$e=Ee,Ee=x);var I=Gp(_,Ee),H=Gp(_,$e);if(I&&H&&(ee.rangeCount!==1||ee.anchorNode!==I.node||ee.anchorOffset!==I.offset||ee.focusNode!==H.node||ee.focusOffset!==H.offset)){var K=oe.createRange();K.setStart(I.node,I.offset),ee.removeAllRanges(),Ee>$e?(ee.addRange(K),ee.extend(H.node,H.offset)):(K.setEnd(H.node,H.offset),ee.addRange(K))}}}}for(oe=[],ee=_;ee=ee.parentNode;)ee.nodeType===1&&oe.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<oe.length;_++){var ae=oe[_];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}El=!!zd,Hd=zd=null}finally{qe=d,U.p=i,M.T=r}}e.current=n,mt=2}}function fv(){if(mt===2){mt=0;var e=La,n=go,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var i=U.p;U.p=2;var d=qe;qe|=4;try{Wg(e,n.alternate,n)}finally{qe=d,U.p=i,M.T=r}}mt=3}}function mv(){if(mt===4||mt===3){mt=0,ln();var e=La,n=go,r=la,i=Jg;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?mt=5:(mt=0,go=La=null,pv(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(Ma=null),Pc(r),n=n.stateNode,bt&&typeof bt.onCommitFiberRoot=="function")try{bt.onCommitFiberRoot(ya,n,void 0,(n.current.flags&128)===128)}catch{}if(i!==null){n=M.T,d=U.p,U.p=2,M.T=null;try{for(var h=e.onRecoverableError,x=0;x<i.length;x++){var _=i[x];h(_.value,{componentStack:_.stack})}}finally{M.T=n,U.p=d}}(la&3)!==0&&fl(),Ln(e),d=e.pendingLanes,(r&261930)!==0&&(d&42)!==0?e===Sd?js++:(js=0,Sd=e):js=0,As(0)}}function pv(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,cs(n)))}function fl(){return dv(),fv(),mv(),hv()}function hv(){if(mt!==5)return!1;var e=La,n=xd;xd=0;var r=Pc(la),i=M.T,d=U.p;try{U.p=32>r?32:r,M.T=null,r=kd,kd=null;var h=La,x=la;if(mt=0,go=La=null,la=0,(qe&6)!==0)throw Error(s(331));var _=qe;if(qe|=4,Xg(h.current),$g(h,h.current,x,r),qe=_,As(0,!1),bt&&typeof bt.onPostCommitFiberRoot=="function")try{bt.onPostCommitFiberRoot(ya,h)}catch{}return!0}finally{U.p=d,M.T=i,pv(e,n)}}function gv(e,n,r){n=fn(r,n),n=td(e.stateNode,n,2),e=ja(e,n,2),e!==null&&(Go(e,2),Ln(e))}function Fe(e,n,r){if(e.tag===3)gv(e,e,r);else for(;n!==null;){if(n.tag===3){gv(n,e,r);break}else if(n.tag===1){var i=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Ma===null||!Ma.has(i))){e=fn(r,e),r=vg(2),i=ja(n,r,2),i!==null&&(yg(r,i,n,e),Go(i,2),Ln(i));break}}n=n.return}}function Td(e,n,r){var i=e.pingCache;if(i===null){i=e.pingCache=new r2;var d=new Set;i.set(n,d)}else d=i.get(n),d===void 0&&(d=new Set,i.set(n,d));d.has(r)||(yd=!0,d.add(r),e=c2.bind(null,e,n,r),n.then(e,e))}function c2(e,n,r){var i=e.pingCache;i!==null&&i.delete(n),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,Ve===e&&(ze&r)===r&&(tt===4||tt===3&&(ze&62914560)===ze&&300>Se()-sl?(qe&2)===0&&vo(e,0):bd|=r,ho===ze&&(ho=0)),Ln(e)}function vv(e,n){n===0&&(n=dp()),e=dr(e,n),e!==null&&(Go(e,n),Ln(e))}function u2(e){var n=e.memoizedState,r=0;n!==null&&(r=n.retryLane),vv(e,r)}function d2(e,n){var r=0;switch(e.tag){case 31:case 13:var i=e.stateNode,d=e.memoizedState;d!==null&&(r=d.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(s(314))}i!==null&&i.delete(n),vv(e,r)}function f2(e,n){return Fn(e,n)}var ml=null,bo=null,Nd=!1,pl=!1,jd=!1,Ha=0;function Ln(e){e!==bo&&e.next===null&&(bo===null?ml=bo=e:bo=bo.next=e),pl=!0,Nd||(Nd=!0,p2())}function As(e,n){if(!jd&&pl){jd=!0;do for(var r=!1,i=ml;i!==null;){if(e!==0){var d=i.pendingLanes;if(d===0)var h=0;else{var x=i.suspendedLanes,_=i.pingedLanes;h=(1<<31-ht(42|e)+1)-1,h&=d&~(x&~_),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,xv(i,h))}else h=ze,h=yi(i,i===Ve?h:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(h&3)===0||Vo(i,h)||(r=!0,xv(i,h));i=i.next}while(r);jd=!1}}function m2(){yv()}function yv(){pl=Nd=!1;var e=0;Ha!==0&&E2()&&(e=Ha);for(var n=Se(),r=null,i=ml;i!==null;){var d=i.next,h=bv(i,n);h===0?(i.next=null,r===null?ml=d:r.next=d,d===null&&(bo=r)):(r=i,(e!==0||(h&3)!==0)&&(pl=!0)),i=d}mt!==0&&mt!==5||As(e),Ha!==0&&(Ha=0)}function bv(e,n){for(var r=e.suspendedLanes,i=e.pingedLanes,d=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-ht(h),_=1<<x,z=d[x];z===-1?((_&r)===0||(_&i)!==0)&&(d[x]=W1(_,n)):z<=n&&(e.expiredLanes|=_),h&=~_}if(n=Ve,r=ze,r=yi(e,e===n?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,r===0||e===n&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&ft(i),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||Vo(e,r)){if(n=r&-r,n===e.callbackPriority)return n;switch(i!==null&&ft(i),Pc(r)){case 2:case 8:r=rr;break;case 32:r=de;break;case 268435456:r=st;break;default:r=de}return i=wv.bind(null,e),r=Fn(r,i),e.callbackPriority=n,e.callbackNode=r,n}return i!==null&&i!==null&&ft(i),e.callbackPriority=2,e.callbackNode=null,2}function wv(e,n){if(mt!==0&&mt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(fl()&&e.callbackNode!==r)return null;var i=ze;return i=yi(e,e===Ve?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(tv(e,i,n),bv(e,Se()),e.callbackNode!=null&&e.callbackNode===r?wv.bind(null,e):null)}function xv(e,n){if(fl())return null;tv(e,n,!0)}function p2(){T2(function(){(qe&6)!==0?Fn(ar,m2):yv()})}function Ad(){if(Ha===0){var e=ao;e===0&&(e=ba,ba<<=1,(ba&261888)===0&&(ba=256)),Ha=e}return Ha}function kv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ki(""+e)}function Sv(e,n){var r=n.ownerDocument.createElement("input");return r.name=n.name,r.value=n.value,e.id&&r.setAttribute("form",e.id),n.parentNode.insertBefore(r,n),e=new FormData(e),r.parentNode.removeChild(r),e}function h2(e,n,r,i,d){if(n==="submit"&&r&&r.stateNode===d){var h=kv((d[Ht]||null).action),x=i.submitter;x&&(n=(n=x[Ht]||null)?kv(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var _=new Ti("action","action",null,i,d);e.push({event:_,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Ha!==0){var z=x?Sv(d,x):new FormData(d);Gu(r,{pending:!0,data:z,method:d.method,action:h},null,z)}}else typeof h=="function"&&(_.preventDefault(),z=x?Sv(d,x):new FormData(d),Gu(r,{pending:!0,data:z,method:d.method,action:h},h,z))},currentTarget:d}]})}}for(var _d=0;_d<fu.length;_d++){var Rd=fu[_d],g2=Rd.toLowerCase(),v2=Rd[0].toUpperCase()+Rd.slice(1);kn(g2,"on"+v2)}kn(eh,"onAnimationEnd"),kn(th,"onAnimationIteration"),kn(nh,"onAnimationStart"),kn("dblclick","onDoubleClick"),kn("focusin","onFocus"),kn("focusout","onBlur"),kn(Dk,"onTransitionRun"),kn(Mk,"onTransitionStart"),kn(Lk,"onTransitionCancel"),kn(ah,"onTransitionEnd"),Pr("onMouseEnter",["mouseout","mouseover"]),Pr("onMouseLeave",["mouseout","mouseover"]),Pr("onPointerEnter",["pointerout","pointerover"]),Pr("onPointerLeave",["pointerout","pointerover"]),ir("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ir("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ir("onBeforeInput",["compositionend","keypress","textInput","paste"]),ir("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ir("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ir("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _s="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(" "),y2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(_s));function Ev(e,n){n=(n&4)!==0;for(var r=0;r<e.length;r++){var i=e[r],d=i.event;i=i.listeners;e:{var h=void 0;if(n)for(var x=i.length-1;0<=x;x--){var _=i[x],z=_.instance,Y=_.currentTarget;if(_=_.listener,z!==h&&d.isPropagationStopped())break e;h=_,d.currentTarget=Y;try{h(d)}catch(te){Ai(te)}d.currentTarget=null,h=z}else for(x=0;x<i.length;x++){if(_=i[x],z=_.instance,Y=_.currentTarget,_=_.listener,z!==h&&d.isPropagationStopped())break e;h=_,d.currentTarget=Y;try{h(d)}catch(te){Ai(te)}d.currentTarget=null,h=z}}}}function Le(e,n){var r=n[Fc];r===void 0&&(r=n[Fc]=new Set);var i=e+"__bubble";r.has(i)||(Cv(n,e,2,!1),r.add(i))}function Od(e,n,r){var i=0;n&&(i|=4),Cv(r,e,i,n)}var hl="_reactListening"+Math.random().toString(36).slice(2);function Dd(e){if(!e[hl]){e[hl]=!0,yp.forEach(function(r){r!=="selectionchange"&&(y2.has(r)||Od(r,!1,e),Od(r,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[hl]||(n[hl]=!0,Od("selectionchange",!1,n))}}function Cv(e,n,r,i){switch(ey(n)){case 2:var d=Y2;break;case 8:d=$2;break;default:d=Vd}r=d.bind(null,n,r,e),d=void 0,!Jc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),i?d!==void 0?e.addEventListener(n,r,{capture:!0,passive:d}):e.addEventListener(n,r,!0):d!==void 0?e.addEventListener(n,r,{passive:d}):e.addEventListener(n,r,!1)}function Md(e,n,r,i,d){var h=i;if((n&1)===0&&(n&2)===0&&i!==null)e:for(;;){if(i===null)return;var x=i.tag;if(x===3||x===4){var _=i.stateNode.containerInfo;if(_===d)break;if(x===4)for(x=i.return;x!==null;){var z=x.tag;if((z===3||z===4)&&x.stateNode.containerInfo===d)return;x=x.return}for(;_!==null;){if(x=Wr(_),x===null)return;if(z=x.tag,z===5||z===6||z===26||z===27){i=h=x;continue e}_=_.parentNode}}i=i.return}_p(function(){var Y=h,te=Zc(r),oe=[];e:{var X=rh.get(e);if(X!==void 0){var ee=Ti,me=e;switch(e){case"keypress":if(Ei(r)===0)break e;case"keydown":case"keyup":ee=dk;break;case"focusin":me="focus",ee=au;break;case"focusout":me="blur",ee=au;break;case"beforeblur":case"afterblur":ee=au;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=Dp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=J1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=pk;break;case eh:case th:case nh:ee=nk;break;case ah:ee=gk;break;case"scroll":case"scrollend":ee=Z1;break;case"wheel":ee=yk;break;case"copy":case"cut":case"paste":ee=rk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=Lp;break;case"toggle":case"beforetoggle":ee=wk}var Ee=(n&4)!==0,$e=!Ee&&(e==="scroll"||e==="scrollend"),I=Ee?X!==null?X+"Capture":null:X;Ee=[];for(var H=Y,K;H!==null;){var ae=H;if(K=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||K===null||I===null||(ae=Qo(H,I),ae!=null&&Ee.push(Rs(H,ae,K))),$e)break;H=H.return}0<Ee.length&&(X=new ee(X,me,null,r,te),oe.push({event:X,listeners:Ee}))}}if((n&7)===0){e:{if(X=e==="mouseover"||e==="pointerover",ee=e==="mouseout"||e==="pointerout",X&&r!==Xc&&(me=r.relatedTarget||r.fromElement)&&(Wr(me)||me[Br]))break e;if((ee||X)&&(X=te.window===te?te:(X=te.ownerDocument)?X.defaultView||X.parentWindow:window,ee?(me=r.relatedTarget||r.toElement,ee=Y,me=me?Wr(me):null,me!==null&&($e=u(me),Ee=me.tag,me!==$e||Ee!==5&&Ee!==27&&Ee!==6)&&(me=null)):(ee=null,me=Y),ee!==me)){if(Ee=Dp,ae="onMouseLeave",I="onMouseEnter",H="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=Lp,ae="onPointerLeave",I="onPointerEnter",H="pointer"),$e=ee==null?X:Zo(ee),K=me==null?X:Zo(me),X=new Ee(ae,H+"leave",ee,r,te),X.target=$e,X.relatedTarget=K,ae=null,Wr(te)===Y&&(Ee=new Ee(I,H+"enter",me,r,te),Ee.target=K,Ee.relatedTarget=$e,ae=Ee),$e=ae,ee&&me)t:{for(Ee=b2,I=ee,H=me,K=0,ae=I;ae;ae=Ee(ae))K++;ae=0;for(var ke=H;ke;ke=Ee(ke))ae++;for(;0<K-ae;)I=Ee(I),K--;for(;0<ae-K;)H=Ee(H),ae--;for(;K--;){if(I===H||H!==null&&I===H.alternate){Ee=I;break t}I=Ee(I),H=Ee(H)}Ee=null}else Ee=null;ee!==null&&Tv(oe,X,ee,Ee,!1),me!==null&&$e!==null&&Tv(oe,$e,me,Ee,!0)}}e:{if(X=Y?Zo(Y):window,ee=X.nodeName&&X.nodeName.toLowerCase(),ee==="select"||ee==="input"&&X.type==="file")var We=Pp;else if(Ip(X))if(Fp)We=_k;else{We=jk;var ye=Nk}else ee=X.nodeName,!ee||ee.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?Y&&Gc(Y.elementType)&&(We=Pp):We=Ak;if(We&&(We=We(e,Y))){qp(oe,We,r,te);break e}ye&&ye(e,X,Y),e==="focusout"&&Y&&X.type==="number"&&Y.memoizedProps.value!=null&&Vc(X,"number",X.value)}switch(ye=Y?Zo(Y):window,e){case"focusin":(Ip(ye)||ye.contentEditable==="true")&&(Gr=ye,cu=Y,ss=null);break;case"focusout":ss=cu=Gr=null;break;case"mousedown":uu=!0;break;case"contextmenu":case"mouseup":case"dragend":uu=!1,Qp(oe,r,te);break;case"selectionchange":if(Ok)break;case"keydown":case"keyup":Qp(oe,r,te)}var Oe;if(ou)e:{switch(e){case"compositionstart":var He="onCompositionStart";break e;case"compositionend":He="onCompositionEnd";break e;case"compositionupdate":He="onCompositionUpdate";break e}He=void 0}else Vr?Bp(e,r)&&(He="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(He="onCompositionStart");He&&(zp&&r.locale!=="ko"&&(Vr||He!=="onCompositionStart"?He==="onCompositionEnd"&&Vr&&(Oe=Rp()):(xa=te,eu="value"in xa?xa.value:xa.textContent,Vr=!0)),ye=gl(Y,He),0<ye.length&&(He=new Mp(He,e,null,r,te),oe.push({event:He,listeners:ye}),Oe?He.data=Oe:(Oe=Wp(r),Oe!==null&&(He.data=Oe)))),(Oe=kk?Sk(e,r):Ek(e,r))&&(He=gl(Y,"onBeforeInput"),0<He.length&&(ye=new Mp("onBeforeInput","beforeinput",null,r,te),oe.push({event:ye,listeners:He}),ye.data=Oe)),h2(oe,e,Y,r,te)}Ev(oe,n)})}function Rs(e,n,r){return{instance:e,listener:n,currentTarget:r}}function gl(e,n){for(var r=n+"Capture",i=[];e!==null;){var d=e,h=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||h===null||(d=Qo(e,r),d!=null&&i.unshift(Rs(e,d,h)),d=Qo(e,n),d!=null&&i.push(Rs(e,d,h))),e.tag===3)return i;e=e.return}return[]}function b2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Tv(e,n,r,i,d){for(var h=n._reactName,x=[];r!==null&&r!==i;){var _=r,z=_.alternate,Y=_.stateNode;if(_=_.tag,z!==null&&z===i)break;_!==5&&_!==26&&_!==27||Y===null||(z=Y,d?(Y=Qo(r,h),Y!=null&&x.unshift(Rs(r,Y,z))):d||(Y=Qo(r,h),Y!=null&&x.push(Rs(r,Y,z)))),r=r.return}x.length!==0&&e.push({event:n,listeners:x})}var w2=/\r\n?/g,x2=/\u0000|\uFFFD/g;function Nv(e){return(typeof e=="string"?e:""+e).replace(w2,`
10
- `).replace(x2,"")}function jv(e,n){return n=Nv(n),Nv(e)===n}function Ye(e,n,r,i,d,h){switch(r){case"children":typeof i=="string"?n==="body"||n==="textarea"&&i===""||Kr(e,i):(typeof i=="number"||typeof i=="bigint")&&n!=="body"&&Kr(e,""+i);break;case"className":wi(e,"class",i);break;case"tabIndex":wi(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":wi(e,r,i);break;case"style":jp(e,i,h);break;case"data":if(n!=="object"){wi(e,"data",i);break}case"src":case"href":if(i===""&&(n!=="a"||r!=="href")){e.removeAttribute(r);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=ki(""+i),e.setAttribute(r,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(r==="formAction"?(n!=="input"&&Ye(e,n,"name",d.name,d,null),Ye(e,n,"formEncType",d.formEncType,d,null),Ye(e,n,"formMethod",d.formMethod,d,null),Ye(e,n,"formTarget",d.formTarget,d,null)):(Ye(e,n,"encType",d.encType,d,null),Ye(e,n,"method",d.method,d,null),Ye(e,n,"target",d.target,d,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=ki(""+i),e.setAttribute(r,i);break;case"onClick":i!=null&&(e.onclick=$n);break;case"onScroll":i!=null&&Le("scroll",e);break;case"onScrollEnd":i!=null&&Le("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(r=i.__html,r!=null){if(d.children!=null)throw Error(s(60));e.innerHTML=r}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}r=ki(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""+i):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":i===!0?e.setAttribute(r,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,i):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(r,i):e.removeAttribute(r);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(r):e.setAttribute(r,i);break;case"popover":Le("beforetoggle",e),Le("toggle",e),bi(e,"popover",i);break;case"xlinkActuate":Yn(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Yn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Yn(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Yn(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Yn(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Yn(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":bi(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=G1.get(r)||r,bi(e,r,i))}}function Ld(e,n,r,i,d,h){switch(r){case"style":jp(e,i,h);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(r=i.__html,r!=null){if(d.children!=null)throw Error(s(60));e.innerHTML=r}}break;case"children":typeof i=="string"?Kr(e,i):(typeof i=="number"||typeof i=="bigint")&&Kr(e,""+i);break;case"onScroll":i!=null&&Le("scroll",e);break;case"onScrollEnd":i!=null&&Le("scrollend",e);break;case"onClick":i!=null&&(e.onclick=$n);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!bp.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(d=r.endsWith("Capture"),n=r.slice(2,d?r.length-7:void 0),h=e[Ht]||null,h=h!=null?h[r]:null,typeof h=="function"&&e.removeEventListener(n,h,d),typeof i=="function")){typeof h!="function"&&h!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(n,i,d);break e}r in e?e[r]=i:i===!0?e.setAttribute(r,""):bi(e,r,i)}}}function Et(e,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Le("error",e),Le("load",e);var i=!1,d=!1,h;for(h in r)if(r.hasOwnProperty(h)){var x=r[h];if(x!=null)switch(h){case"src":i=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Ye(e,n,h,x,r,null)}}d&&Ye(e,n,"srcSet",r.srcSet,r,null),i&&Ye(e,n,"src",r.src,r,null);return;case"input":Le("invalid",e);var _=h=x=d=null,z=null,Y=null;for(i in r)if(r.hasOwnProperty(i)){var te=r[i];if(te!=null)switch(i){case"name":d=te;break;case"type":x=te;break;case"checked":z=te;break;case"defaultChecked":Y=te;break;case"value":h=te;break;case"defaultValue":_=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(s(137,n));break;default:Ye(e,n,i,te,r,null)}}Ep(e,h,_,z,Y,x,d,!1);return;case"select":Le("invalid",e),i=x=h=null;for(d in r)if(r.hasOwnProperty(d)&&(_=r[d],_!=null))switch(d){case"value":h=_;break;case"defaultValue":x=_;break;case"multiple":i=_;default:Ye(e,n,d,_,r,null)}n=h,r=x,e.multiple=!!i,n!=null?Fr(e,!!i,n,!1):r!=null&&Fr(e,!!i,r,!0);return;case"textarea":Le("invalid",e),h=d=i=null;for(x in r)if(r.hasOwnProperty(x)&&(_=r[x],_!=null))switch(x){case"value":i=_;break;case"defaultValue":d=_;break;case"children":h=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:Ye(e,n,x,_,r,null)}Tp(e,i,d,h);return;case"option":for(z in r)r.hasOwnProperty(z)&&(i=r[z],i!=null)&&(z==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":Ye(e,n,z,i,r,null));return;case"dialog":Le("beforetoggle",e),Le("toggle",e),Le("cancel",e),Le("close",e);break;case"iframe":case"object":Le("load",e);break;case"video":case"audio":for(i=0;i<_s.length;i++)Le(_s[i],e);break;case"image":Le("error",e),Le("load",e);break;case"details":Le("toggle",e);break;case"embed":case"source":case"link":Le("error",e),Le("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in r)if(r.hasOwnProperty(Y)&&(i=r[Y],i!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Ye(e,n,Y,i,r,null)}return;default:if(Gc(n)){for(te in r)r.hasOwnProperty(te)&&(i=r[te],i!==void 0&&Ld(e,n,te,i,r,void 0));return}}for(_ in r)r.hasOwnProperty(_)&&(i=r[_],i!=null&&Ye(e,n,_,i,r,null))}function k2(e,n,r,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,h=null,x=null,_=null,z=null,Y=null,te=null;for(ee in r){var oe=r[ee];if(r.hasOwnProperty(ee)&&oe!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":z=oe;default:i.hasOwnProperty(ee)||Ye(e,n,ee,null,i,oe)}}for(var X in i){var ee=i[X];if(oe=r[X],i.hasOwnProperty(X)&&(ee!=null||oe!=null))switch(X){case"type":h=ee;break;case"name":d=ee;break;case"checked":Y=ee;break;case"defaultChecked":te=ee;break;case"value":x=ee;break;case"defaultValue":_=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(s(137,n));break;default:ee!==oe&&Ye(e,n,X,ee,i,oe)}}$c(e,x,_,z,Y,te,h,d);return;case"select":ee=x=_=X=null;for(h in r)if(z=r[h],r.hasOwnProperty(h)&&z!=null)switch(h){case"value":break;case"multiple":ee=z;default:i.hasOwnProperty(h)||Ye(e,n,h,null,i,z)}for(d in i)if(h=i[d],z=r[d],i.hasOwnProperty(d)&&(h!=null||z!=null))switch(d){case"value":X=h;break;case"defaultValue":_=h;break;case"multiple":x=h;default:h!==z&&Ye(e,n,d,h,i,z)}n=_,r=x,i=ee,X!=null?Fr(e,!!r,X,!1):!!i!=!!r&&(n!=null?Fr(e,!!r,n,!0):Fr(e,!!r,r?[]:"",!1));return;case"textarea":ee=X=null;for(_ in r)if(d=r[_],r.hasOwnProperty(_)&&d!=null&&!i.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:Ye(e,n,_,null,i,d)}for(x in i)if(d=i[x],h=r[x],i.hasOwnProperty(x)&&(d!=null||h!=null))switch(x){case"value":X=d;break;case"defaultValue":ee=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(s(91));break;default:d!==h&&Ye(e,n,x,d,i,h)}Cp(e,X,ee);return;case"option":for(var me in r)X=r[me],r.hasOwnProperty(me)&&X!=null&&!i.hasOwnProperty(me)&&(me==="selected"?e.selected=!1:Ye(e,n,me,null,i,X));for(z in i)X=i[z],ee=r[z],i.hasOwnProperty(z)&&X!==ee&&(X!=null||ee!=null)&&(z==="selected"?e.selected=X&&typeof X!="function"&&typeof X!="symbol":Ye(e,n,z,X,i,ee));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in r)X=r[Ee],r.hasOwnProperty(Ee)&&X!=null&&!i.hasOwnProperty(Ee)&&Ye(e,n,Ee,null,i,X);for(Y in i)if(X=i[Y],ee=r[Y],i.hasOwnProperty(Y)&&X!==ee&&(X!=null||ee!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,n));break;default:Ye(e,n,Y,X,i,ee)}return;default:if(Gc(n)){for(var $e in r)X=r[$e],r.hasOwnProperty($e)&&X!==void 0&&!i.hasOwnProperty($e)&&Ld(e,n,$e,void 0,i,X);for(te in i)X=i[te],ee=r[te],!i.hasOwnProperty(te)||X===ee||X===void 0&&ee===void 0||Ld(e,n,te,X,i,ee);return}}for(var I in r)X=r[I],r.hasOwnProperty(I)&&X!=null&&!i.hasOwnProperty(I)&&Ye(e,n,I,null,i,X);for(oe in i)X=i[oe],ee=r[oe],!i.hasOwnProperty(oe)||X===ee||X==null&&ee==null||Ye(e,n,oe,X,i,ee)}function Av(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function S2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,r=performance.getEntriesByType("resource"),i=0;i<r.length;i++){var d=r[i],h=d.transferSize,x=d.initiatorType,_=d.duration;if(h&&_&&Av(x)){for(x=0,_=d.responseEnd,i+=1;i<r.length;i++){var z=r[i],Y=z.startTime;if(Y>_)break;var te=z.transferSize,oe=z.initiatorType;te&&Av(oe)&&(z=z.responseEnd,x+=te*(z<_?1:(_-Y)/(z-Y)))}if(--i,n+=8*(h+x)/(d.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var zd=null,Hd=null;function vl(e){return e.nodeType===9?e:e.ownerDocument}function _v(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Rv(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Ud(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Bd=null;function E2(){var e=window.event;return e&&e.type==="popstate"?e===Bd?!1:(Bd=e,!0):(Bd=null,!1)}var Ov=typeof setTimeout=="function"?setTimeout:void 0,C2=typeof clearTimeout=="function"?clearTimeout:void 0,Dv=typeof Promise=="function"?Promise:void 0,T2=typeof queueMicrotask=="function"?queueMicrotask:typeof Dv<"u"?function(e){return Dv.resolve(null).then(e).catch(N2)}:Ov;function N2(e){setTimeout(function(){throw e})}function Ua(e){return e==="head"}function Mv(e,n){var r=n,i=0;do{var d=r.nextSibling;if(e.removeChild(r),d&&d.nodeType===8)if(r=d.data,r==="/$"||r==="/&"){if(i===0){e.removeChild(d),So(n);return}i--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")i++;else if(r==="html")Os(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Os(r);for(var h=r.firstChild;h;){var x=h.nextSibling,_=h.nodeName;h[Xo]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=x}}else r==="body"&&Os(e.ownerDocument.body);r=d}while(r);So(n)}function Lv(e,n){var r=e;e=0;do{var i=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=i}while(r)}function Wd(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Wd(r),Kc(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function j2(e,n,r,i){for(;e.nodeType===1;){var d=r;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Xo])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=vn(e.nextSibling),e===null)break}return null}function A2(e,n,r){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=vn(e.nextSibling),e===null))return null;return e}function zv(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=vn(e.nextSibling),e===null))return null;return e}function Id(e){return e.data==="$?"||e.data==="$~"}function qd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function _2(e,n){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||r.readyState!=="loading")n();else{var i=function(){n(),r.removeEventListener("DOMContentLoaded",i)};r.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function vn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Pd=null;function Hv(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(n===0)return vn(e.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}e=e.nextSibling}return null}function Uv(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return e;n--}else r!=="/$"&&r!=="/&"||n++}e=e.previousSibling}return null}function Bv(e,n,r){switch(n=vl(r),e){case"html":if(e=n.documentElement,!e)throw Error(s(452));return e;case"head":if(e=n.head,!e)throw Error(s(453));return e;case"body":if(e=n.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function Os(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Kc(e)}var yn=new Map,Wv=new Set;function yl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ca=U.d;U.d={f:R2,r:O2,D:D2,C:M2,L:L2,m:z2,X:U2,S:H2,M:B2};function R2(){var e=ca.f(),n=cl();return e||n}function O2(e){var n=Ir(e);n!==null&&n.tag===5&&n.type==="form"?ag(n):ca.r(e)}var wo=typeof document>"u"?null:document;function Iv(e,n,r){var i=wo;if(i&&typeof n=="string"&&n){var d=un(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof r=="string"&&(d+='[crossorigin="'+r+'"]'),Wv.has(d)||(Wv.add(d),e={rel:e,crossOrigin:r,href:n},i.querySelector(d)===null&&(n=i.createElement("link"),Et(n,"link",e),gt(n),i.head.appendChild(n)))}}function D2(e){ca.D(e),Iv("dns-prefetch",e,null)}function M2(e,n){ca.C(e,n),Iv("preconnect",e,n)}function L2(e,n,r){ca.L(e,n,r);var i=wo;if(i&&e&&n){var d='link[rel="preload"][as="'+un(n)+'"]';n==="image"&&r&&r.imageSrcSet?(d+='[imagesrcset="'+un(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(d+='[imagesizes="'+un(r.imageSizes)+'"]')):d+='[href="'+un(e)+'"]';var h=d;switch(n){case"style":h=xo(e);break;case"script":h=ko(e)}yn.has(h)||(e=v({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:e,as:n},r),yn.set(h,e),i.querySelector(d)!==null||n==="style"&&i.querySelector(Ds(h))||n==="script"&&i.querySelector(Ms(h))||(n=i.createElement("link"),Et(n,"link",e),gt(n),i.head.appendChild(n)))}}function z2(e,n){ca.m(e,n);var r=wo;if(r&&e){var i=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+un(i)+'"][href="'+un(e)+'"]',h=d;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=ko(e)}if(!yn.has(h)&&(e=v({rel:"modulepreload",href:e},n),yn.set(h,e),r.querySelector(d)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Ms(h)))return}i=r.createElement("link"),Et(i,"link",e),gt(i),r.head.appendChild(i)}}}function H2(e,n,r){ca.S(e,n,r);var i=wo;if(i&&e){var d=qr(i).hoistableStyles,h=xo(e);n=n||"default";var x=d.get(h);if(!x){var _={loading:0,preload:null};if(x=i.querySelector(Ds(h)))_.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":n},r),(r=yn.get(h))&&Fd(e,r);var z=x=i.createElement("link");gt(z),Et(z,"link",e),z._p=new Promise(function(Y,te){z.onload=Y,z.onerror=te}),z.addEventListener("load",function(){_.loading|=1}),z.addEventListener("error",function(){_.loading|=2}),_.loading|=4,bl(x,n,i)}x={type:"stylesheet",instance:x,count:1,state:_},d.set(h,x)}}}function U2(e,n){ca.X(e,n);var r=wo;if(r&&e){var i=qr(r).hoistableScripts,d=ko(e),h=i.get(d);h||(h=r.querySelector(Ms(d)),h||(e=v({src:e,async:!0},n),(n=yn.get(d))&&Kd(e,n),h=r.createElement("script"),gt(h),Et(h,"link",e),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},i.set(d,h))}}function B2(e,n){ca.M(e,n);var r=wo;if(r&&e){var i=qr(r).hoistableScripts,d=ko(e),h=i.get(d);h||(h=r.querySelector(Ms(d)),h||(e=v({src:e,async:!0,type:"module"},n),(n=yn.get(d))&&Kd(e,n),h=r.createElement("script"),gt(h),Et(h,"link",e),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},i.set(d,h))}}function qv(e,n,r,i){var d=(d=fe.current)?yl(d):null;if(!d)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=xo(r.href),r=qr(d).hoistableStyles,i=r.get(n),i||(i={type:"style",instance:null,count:0,state:null},r.set(n,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=xo(r.href);var h=qr(d).hoistableStyles,x=h.get(e);if(x||(d=d.ownerDocument||d,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=d.querySelector(Ds(e)))&&!h._p&&(x.instance=h,x.state.loading=5),yn.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},yn.set(e,r),h||W2(d,e,r,x.state))),n&&i===null)throw Error(s(528,""));return x}if(n&&i!==null)throw Error(s(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ko(r),r=qr(d).hoistableScripts,i=r.get(n),i||(i={type:"script",instance:null,count:0,state:null},r.set(n,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function xo(e){return'href="'+un(e)+'"'}function Ds(e){return'link[rel="stylesheet"]['+e+"]"}function Pv(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function W2(e,n,r,i){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?i.loading=1:(n=e.createElement("link"),i.preload=n,n.addEventListener("load",function(){return i.loading|=1}),n.addEventListener("error",function(){return i.loading|=2}),Et(n,"link",r),gt(n),e.head.appendChild(n))}function ko(e){return'[src="'+un(e)+'"]'}function Ms(e){return"script[async]"+e}function Fv(e,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var i=e.querySelector('style[data-href~="'+un(r.href)+'"]');if(i)return n.instance=i,gt(i),i;var d=v({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),gt(i),Et(i,"style",d),bl(i,r.precedence,e),n.instance=i;case"stylesheet":d=xo(r.href);var h=e.querySelector(Ds(d));if(h)return n.state.loading|=4,n.instance=h,gt(h),h;i=Pv(r),(d=yn.get(d))&&Fd(i,d),h=(e.ownerDocument||e).createElement("link"),gt(h);var x=h;return x._p=new Promise(function(_,z){x.onload=_,x.onerror=z}),Et(h,"link",i),n.state.loading|=4,bl(h,r.precedence,e),n.instance=h;case"script":return h=ko(r.src),(d=e.querySelector(Ms(h)))?(n.instance=d,gt(d),d):(i=r,(d=yn.get(h))&&(i=v({},r),Kd(i,d)),e=e.ownerDocument||e,d=e.createElement("script"),gt(d),Et(d,"link",i),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(i=n.instance,n.state.loading|=4,bl(i,r.precedence,e));return n.instance}function bl(e,n,r){for(var i=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=i.length?i[i.length-1]:null,h=d,x=0;x<i.length;x++){var _=i[x];if(_.dataset.precedence===n)h=_;else if(h!==d)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(e,n.firstChild))}function Fd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Kd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var wl=null;function Kv(e,n,r){if(wl===null){var i=new Map,d=wl=new Map;d.set(r,i)}else d=wl,i=d.get(r),i||(i=new Map,d.set(r,i));if(i.has(e))return i;for(i.set(e,null),r=r.getElementsByTagName(e),d=0;d<r.length;d++){var h=r[d];if(!(h[Xo]||h[wt]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var _=i.get(x);_?_.push(h):i.set(x,[h])}}return i}function Yv(e,n,r){e=e.ownerDocument||e,e.head.insertBefore(r,n==="title"?e.querySelector("head > title"):null)}function I2(e,n,r){if(r===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(e=n.disabled,typeof n.precedence=="string"&&e==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function $v(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function q2(e,n,r,i){if(r.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var d=xo(i.href),h=n.querySelector(Ds(d));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=xl.bind(e),n.then(e,e)),r.state.loading|=4,r.instance=h,gt(h);return}h=n.ownerDocument||n,i=Pv(i),(d=yn.get(d))&&Fd(i,d),h=h.createElement("link"),gt(h);var x=h;x._p=new Promise(function(_,z){x.onload=_,x.onerror=z}),Et(h,"link",i),r.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=xl.bind(e),n.addEventListener("load",r),n.addEventListener("error",r))}}var Yd=0;function P2(e,n){return e.stylesheets&&e.count===0&&Sl(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var i=setTimeout(function(){if(e.stylesheets&&Sl(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Yd===0&&(Yd=62500*S2());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Sl(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Yd?50:800)+n);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(d)}}:null}function xl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Sl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var kl=null;function Sl(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,kl=new Map,n.forEach(F2,e),kl=null,xl.call(e))}function F2(e,n){if(!(n.state.loading&4)){var r=kl.get(e);if(r)var i=r.get(null);else{r=new Map,kl.set(e,r);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<d.length;h++){var x=d[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(r.set(x.dataset.precedence,x),i=x)}i&&r.set(null,i)}d=n.instance,x=d.getAttribute("data-precedence"),h=r.get(x)||i,h===i&&r.set(null,d),r.set(x,d),this.count++,i=xl.bind(this),d.addEventListener("load",i),d.addEventListener("error",i),h?h.parentNode.insertBefore(d,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var Ls={$$typeof:j,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function K2(e,n,r,i,d,h,x,_,z){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ic(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ic(0),this.hiddenUpdates=Ic(null),this.identifierPrefix=i,this.onUncaughtError=d,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=z,this.incompleteTransitions=new Map}function Vv(e,n,r,i,d,h,x,_,z,Y,te,oe){return e=new K2(e,n,r,x,z,Y,te,oe,_),n=1,h===!0&&(n|=24),h=Xt(3,null,null,n),e.current=h,h.stateNode=e,n=Cu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:i,isDehydrated:r,cache:n},Au(h),e}function Gv(e){return e?(e=Qr,e):Qr}function Xv(e,n,r,i,d,h){d=Gv(d),i.context===null?i.context=d:i.pendingContext=d,i=Na(n),i.payload={element:r},h=h===void 0?null:h,h!==null&&(i.callback=h),r=ja(e,i,n),r!==null&&(Pt(r,e,n),ms(r,e,n))}function Zv(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<n?r:n}}function $d(e,n){Zv(e,n),(e=e.alternate)&&Zv(e,n)}function Qv(e){if(e.tag===13||e.tag===31){var n=dr(e,67108864);n!==null&&Pt(n,e,67108864),$d(e,67108864)}}function Jv(e){if(e.tag===13||e.tag===31){var n=tn();n=qc(n);var r=dr(e,n);r!==null&&Pt(r,e,n),$d(e,n)}}var El=!0;function Y2(e,n,r,i){var d=M.T;M.T=null;var h=U.p;try{U.p=2,Vd(e,n,r,i)}finally{U.p=h,M.T=d}}function $2(e,n,r,i){var d=M.T;M.T=null;var h=U.p;try{U.p=8,Vd(e,n,r,i)}finally{U.p=h,M.T=d}}function Vd(e,n,r,i){if(El){var d=Gd(i);if(d===null)Md(e,n,i,Cl,r),ty(e,i);else if(G2(d,e,n,r,i))i.stopPropagation();else if(ty(e,i),n&4&&-1<V2.indexOf(e)){for(;d!==null;){var h=Ir(d);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=sr(h.pendingLanes);if(x!==0){var _=h;for(_.pendingLanes|=2,_.entangledLanes|=2;x;){var z=1<<31-ht(x);_.entanglements[1]|=z,x&=~z}Ln(h),(qe&6)===0&&(il=Se()+500,As(0))}}break;case 31:case 13:_=dr(h,2),_!==null&&Pt(_,h,2),cl(),$d(h,2)}if(h=Gd(i),h===null&&Md(e,n,i,Cl,r),h===d)break;d=h}d!==null&&i.stopPropagation()}else Md(e,n,i,null,r)}}function Gd(e){return e=Zc(e),Xd(e)}var Cl=null;function Xd(e){if(Cl=null,e=Wr(e),e!==null){var n=u(e);if(n===null)e=null;else{var r=n.tag;if(r===13){if(e=f(n),e!==null)return e;e=null}else if(r===31){if(e=m(n),e!==null)return e;e=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Cl=e,null}function ey(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(nt()){case ar:return 2;case rr:return 8;case de:case Ue:return 32;case st:return 268435456;default:return 32}default:return 32}}var Zd=!1,Ba=null,Wa=null,Ia=null,zs=new Map,Hs=new Map,qa=[],V2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ty(e,n){switch(e){case"focusin":case"focusout":Ba=null;break;case"dragenter":case"dragleave":Wa=null;break;case"mouseover":case"mouseout":Ia=null;break;case"pointerover":case"pointerout":zs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hs.delete(n.pointerId)}}function Us(e,n,r,i,d,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:r,eventSystemFlags:i,nativeEvent:h,targetContainers:[d]},n!==null&&(n=Ir(n),n!==null&&Qv(n)),e):(e.eventSystemFlags|=i,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function G2(e,n,r,i,d){switch(n){case"focusin":return Ba=Us(Ba,e,n,r,i,d),!0;case"dragenter":return Wa=Us(Wa,e,n,r,i,d),!0;case"mouseover":return Ia=Us(Ia,e,n,r,i,d),!0;case"pointerover":var h=d.pointerId;return zs.set(h,Us(zs.get(h)||null,e,n,r,i,d)),!0;case"gotpointercapture":return h=d.pointerId,Hs.set(h,Us(Hs.get(h)||null,e,n,r,i,d)),!0}return!1}function ny(e){var n=Wr(e.target);if(n!==null){var r=u(n);if(r!==null){if(n=r.tag,n===13){if(n=f(r),n!==null){e.blockedOn=n,gp(e.priority,function(){Jv(r)});return}}else if(n===31){if(n=m(r),n!==null){e.blockedOn=n,gp(e.priority,function(){Jv(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Tl(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var r=Gd(e.nativeEvent);if(r===null){r=e.nativeEvent;var i=new r.constructor(r.type,r);Xc=i,r.target.dispatchEvent(i),Xc=null}else return n=Ir(r),n!==null&&Qv(n),e.blockedOn=r,!1;n.shift()}return!0}function ay(e,n,r){Tl(e)&&r.delete(n)}function X2(){Zd=!1,Ba!==null&&Tl(Ba)&&(Ba=null),Wa!==null&&Tl(Wa)&&(Wa=null),Ia!==null&&Tl(Ia)&&(Ia=null),zs.forEach(ay),Hs.forEach(ay)}function Nl(e,n){e.blockedOn===n&&(e.blockedOn=null,Zd||(Zd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,X2)))}var jl=null;function ry(e){jl!==e&&(jl=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jl===e&&(jl=null);for(var n=0;n<e.length;n+=3){var r=e[n],i=e[n+1],d=e[n+2];if(typeof i!="function"){if(Xd(i||r)===null)continue;break}var h=Ir(r);h!==null&&(e.splice(n,3),n-=3,Gu(h,{pending:!0,data:d,method:r.method,action:i},i,d))}}))}function So(e){function n(z){return Nl(z,e)}Ba!==null&&Nl(Ba,e),Wa!==null&&Nl(Wa,e),Ia!==null&&Nl(Ia,e),zs.forEach(n),Hs.forEach(n);for(var r=0;r<qa.length;r++){var i=qa[r];i.blockedOn===e&&(i.blockedOn=null)}for(;0<qa.length&&(r=qa[0],r.blockedOn===null);)ny(r),r.blockedOn===null&&qa.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(i=0;i<r.length;i+=3){var d=r[i],h=r[i+1],x=d[Ht]||null;if(typeof h=="function")x||ry(r);else if(x){var _=null;if(h&&h.hasAttribute("formAction")){if(d=h,x=h[Ht]||null)_=x.formAction;else if(Xd(d)!==null)continue}else _=x.action;typeof _=="function"?r[i+1]=_:(r.splice(i,3),i-=3),ry(r)}}}function oy(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return d=x})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),i||setTimeout(r,20)}function r(){if(!i&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function Qd(e){this._internalRoot=e}Al.prototype.render=Qd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(s(409));var r=n.current,i=tn();Xv(r,i,e,n,null,null)},Al.prototype.unmount=Qd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Xv(e.current,2,null,e,null,null),cl(),n[Br]=null}};function Al(e){this._internalRoot=e}Al.prototype.unstable_scheduleHydration=function(e){if(e){var n=hp();e={blockedOn:null,target:e,priority:n};for(var r=0;r<qa.length&&n!==0&&n<qa[r].priority;r++);qa.splice(r,0,e),r===0&&ny(e)}};var sy=a.version;if(sy!=="19.2.5")throw Error(s(527,sy,"19.2.5"));U.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=p(n),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var Z2={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_l.isDisabled&&_l.supportsFiber)try{ya=_l.inject(Z2),bt=_l}catch{}}return Ws.createRoot=function(e,n){if(!l(e))throw Error(s(299));var r=!1,i="",d=mg,h=pg,x=hg;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=Vv(e,1,!1,null,null,r,i,null,d,h,x,oy),e[Br]=n.current,Dd(e),new Qd(n)},Ws.hydrateRoot=function(e,n,r){if(!l(e))throw Error(s(299));var i=!1,d="",h=mg,x=pg,_=hg,z=null;return r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(_=r.onRecoverableError),r.formState!==void 0&&(z=r.formState)),n=Vv(e,1,!0,n,r??null,i,d,z,h,x,_,oy),n.context=Gv(null),r=n.current,i=tn(),i=qc(i),d=Na(i),d.callback=null,ja(r,d,i),r=i,n.current.lanes=r,Go(n,r),Ln(n),e[Br]=n.current,Dd(e),new Al(n)},Ws.version="19.2.5",Ws}var gy;function lS(){if(gy)return tf.exports;gy=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),tf.exports=iS(),tf.exports}var cS=lS();const uS="modulepreload",dS=function(t){return"/"+t},vy={},Mt=function(a,o,s){let l=Promise.resolve();if(o&&o.length>0){let g=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=f?.nonce||f?.getAttribute("nonce");l=g(o.map(p=>{if(p=dS(p),p in vy)return;vy[p]=!0;const b=p.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const k=document.createElement("link");if(k.rel=b?"stylesheet":uS,b||(k.as="script"),k.crossOrigin="",k.href=p,m&&k.setAttribute("nonce",m),document.head.appendChild(k),b)return new Promise((E,S)=>{k.addEventListener("load",E),k.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${p}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return l.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return a().catch(u)})},fS=y.lazy(()=>Mt(()=>import("./WorkspaceTaskDrawer-C14sALb8.js"),__vite__mapDeps([0,1])).then(t=>({default:t.WorkspaceTaskDrawer}))),mS=y.lazy(()=>Mt(()=>import("./AddWorkspaceFlow-CkOOz4Kj.js"),[]).then(t=>({default:t.AddWorkspaceFlow}))),pS=y.lazy(()=>Mt(()=>import("./FirstRunWizard-DzAnGniE.js"),[]).then(t=>({default:t.FirstRunWizard}))),hS=y.lazy(()=>Mt(()=>import("./WhatsNewDialog-BDsPg5Fa.js"),[]).then(t=>({default:t.WhatsNewDialog}))),gS=({addDialogTrigger:t,onAddWorkspace:a,onCloseTaskGraph:o,onCloseWizard:s,onCreateWorkspace:l,onTryDemo:u,taskGraphOpen:f,tasksFile:m,wizardOpen:g,whatsNewOpen:p,whatsNewEntries:b,onCloseWhatsNew:v,workspacePath:k,workers:E,onSelectOwner:S,connectionStale:w})=>c.jsxs(c.Fragment,{children:[k?c.jsx(y.Suspense,{fallback:null,children:c.jsx(fS,{open:f,tasksFile:m,onClose:o,workspacePath:k,...E?{workers:E}:{},...S?{onSelectOwner:S}:{},...w!==void 0?{connectionStale:w}:{}})}):null,t>0?c.jsx(y.Suspense,{fallback:null,children:c.jsx(mS,{onClose:()=>{},onCreate:l,onTryDemo:u,trigger:t})}):null,g?c.jsx(y.Suspense,{fallback:null,children:c.jsx(pS,{open:g,onClose:s,onAddWorkspace:a,onTryDemo:u})}):null,p?c.jsx(y.Suspense,{fallback:null,children:c.jsx(hS,{open:p,entries:[...b],onClose:v})}):null]});const o0=(...t)=>t.filter((a,o,s)=>!!a&&a.trim()!==""&&s.indexOf(a)===o).join(" ").trim();const vS=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const yS=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,o,s)=>s?s.toUpperCase():o.toLowerCase());const yy=t=>{const a=yS(t);return a.charAt(0).toUpperCase()+a.slice(1)};var of={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const bS=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1},wS=y.createContext({}),xS=()=>y.useContext(wS),kS=y.forwardRef(({color:t,size:a,strokeWidth:o,absoluteStrokeWidth:s,className:l="",children:u,iconNode:f,...m},g)=>{const{size:p=24,strokeWidth:b=2,absoluteStrokeWidth:v=!1,color:k="currentColor",className:E=""}=xS()??{},S=s??v?Number(o??b)*24/Number(a??p):o??b;return y.createElement("svg",{ref:g,...of,width:a??p??of.width,height:a??p??of.height,stroke:t??k,strokeWidth:S,className:o0("lucide",E,l),...!u&&!bS(m)&&{"aria-hidden":"true"},...m},[...f.map(([w,C])=>y.createElement(w,C)),...Array.isArray(u)?u:[u]])});const ve=(t,a)=>{const o=y.forwardRef(({className:s,...l},u)=>y.createElement(kS,{ref:u,iconNode:a,className:o0(`lucide-${vS(yy(t))}`,`lucide-${t}`,s),...l}));return o.displayName=yy(t),o};const SS=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],bc=ve("activity",SS);const ES=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],CS=ve("arrow-right",ES);const TS=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Gf=ve("bell",TS);const NS=[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]],jS=ve("book-open-check",NS);const AS=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],_S=ve("brain",AS);const RS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ga=ve("check",RS);const OS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qo=ve("chevron-down",OS);const DS=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],MS=ve("chevron-left",DS);const LS=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wc=ve("chevron-right",LS);const zS=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],HS=ve("chevrons-left",zS);const US=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],BS=ve("chevrons-right",US);const WS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],s0=ve("circle-check",WS);const IS=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],qS=ve("circle-play",IS);const PS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],FS=ve("circle-question-mark",PS);const KS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],YS=ve("circle-x",KS);const $S=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],VS=ve("circle",$S);const GS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],XS=ve("clock-3",GS);const ZS=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],QS=ve("code-xml",ZS);const JS=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Dr=ve("copy",JS);const eE=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],Am=ve("crown",eE);const tE=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],nE=ve("ellipsis-vertical",tE);const aE=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],_m=ve("external-link",aE);const rE=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],oE=ve("eye",rE);const sE=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],i0=ve("file-text",sE);const iE=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Ql=ve("flask-conical",iE);const lE=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],l0=ve("folder-plus",lE);const cE=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],uE=ve("hammer",cE);const dE=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],by=ve("image-plus",dE);const fE=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],c0=ve("image",fE);const mE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],u0=ve("info",mE);const pE=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],hE=ve("languages",pE);const gE=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],sf=ve("laptop",gE);const vE=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],d0=ve("list-checks",vE);const yE=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ja=ve("loader-circle",yE);const bE=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],wE=ve("log-out",bE);const xE=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],kE=ve("maximize-2",xE);const SE=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],EE=ve("minimize-2",SE);const CE=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],TE=ve("package",CE);const NE=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],f0=ve("pencil",NE);const jE=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Po=ve("play",jE);const AE=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Jl=ve("plus",AE);const _E=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],wy=ve("radio",_E);const RE=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Rm=ve("refresh-cw",RE);const OE=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],xc=ve("rotate-ccw",OE);const DE=[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],ME=ve("search-check",DE);const LE=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],zE=ve("send",LE);const HE=[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]],UE=ve("server-crash",HE);const BE=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Xf=ve("settings",BE);const WE=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],IE=ve("shield-check",WE);const qE=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],PE=ve("sliders-horizontal",qE);const FE=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],m0=ve("smartphone",FE);const KE=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],p0=ve("sparkles",KE);const YE=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],h0=ve("square",YE);const $E=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],kc=ve("terminal",$E);const VE=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Sc=ve("trash-2",VE);const GE=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Js=ve("triangle-alert",GE);const XE=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],lf=ve("user-plus",XE);const ZE=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],QE=ve("user-round",ZE);const JE=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Ec=ve("users",JE);const eC=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],ec=ve("volume-2",eC);const tC=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],g0=ve("volume-x",tC);const nC=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],aC=ve("webhook",nC);const rC=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],v0=ve("workflow",rC);const oC=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fa=ve("x",oC),sC=t=>t==="en"||t==="zh",y0="hive.uiLanguage",b0={"addWorker.agentCli":"Agent CLI","addWorker.agentNotFound":"not found","addWorker.agentExists":"Member name already exists","addWorker.cancel":"Cancel","addWorker.create":"Add Member","addWorker.creating":"Creating…","addWorker.customPlaceholder":"You are a security reviewer focused on auth and input validation. Use team report to hand findings back to the orchestrator.","addWorker.description":"Pick a role and a CLI agent. The orchestrator dispatches work via {command}.","addWorker.enterName":"Enter a name","addWorker.genericAgent":"Generic command","addWorker.genericCommand":"startup command only","addWorker.loadingPresets":"Loading presets…","addWorker.name":"Name","addWorker.namePlaceholder":"e.g. Alice","addWorker.modifiedFrom":"Modified from {role} default","addWorker.pickCliOrStartup":"Pick a CLI agent or enter a startup command","addWorker.random":"Random","addWorker.randomAria":"Generate random member name","addWorker.randomTooltip":"Suggest a random name","addWorker.role":"Role","addWorker.roleInstructions":"Role instructions","addWorker.roleInstructionsTitle":"Injected into the agent's startup prompt and every dispatch. Hive's team protocol stays fixed; this only steers role behavior.","addWorker.reset":"Reset","addWorker.saveAsTemplate":"Save as template","addWorker.startupCommand":"Startup command","addWorker.startupHelp":"Optional. Runs through your shell in this Workspace (bash/zsh/fish on POSIX, cmd.exe on Windows). Use it for custom agents or native resume commands such as {example}.","addWorker.startupOverrides":"overrides CLI launch","addWorker.template":"Saved templates","addWorker.templateClear":"Use blank Custom (no template)","addWorker.templateDeleteAria":"Delete template {name}","addWorker.templateDeleteConfirm":'Delete the saved template "{name}"? This cannot be undone.',"addWorker.templateDeleteConfirmLabel":"Delete","addWorker.templateDeleteTitle":"Delete role template","addWorker.templateEmpty":"No saved templates yet. Fill in role instructions and save one.","addWorker.templateNamePlaceholder":"Template name","addWorker.templateNoMatch":"No templates match this search.","addWorker.templatePickPlaceholder":"Choose a saved template…","addWorker.templateSaveConfirm":"Save","addWorker.templateSearchPlaceholder":"Search templates","addWorker.title":"Add team member","addWorker.unavailable":"{name} is not installed","addWorker.emptyInstructions":"Add role instructions","actionCenter.activity.cancelled":"{worker} cancelled {ago}","actionCenter.activity.queued":"{worker} received work {ago}","actionCenter.activity.reported":"{worker} reported {ago}","actionCenter.activity.submitted":"{worker} started {ago}","actionCenter.attention":"Attention","actionCenter.attention.noWorkers":"No team members yet.","actionCenter.attention.remoteError":"Remote request errored at {endpoint}.","actionCenter.attention.remoteRejected":"Remote request rejected at {endpoint}: {reason}.","actionCenter.attention.stoppedWithQueue":"{worker} is stopped with open work.","actionCenter.attention.waitingReport":"{worker} has been waiting to report for {minutes}m.","actionCenter.attentionSubtitle":"Blocked or stale work that may need orchestration.","actionCenter.allClear":"All clear","actionCenter.collapse":"Collapse Action Center","actionCenter.copyRecap":"Copy recap","actionCenter.currentDispatch":"Current","actionCenter.expand":"Expand Action Center","actionCenter.latestReport":"Report","actionCenter.loadFailed":"Could not load team activity.","actionCenter.liveSnapshot":"Live snapshot","actionCenter.loading":"Loading team activity...","actionCenter.metrics":"Action Center metrics","actionCenter.needsAttention":"{count} need attention","actionCenter.noActivity":"No recent team activity.","actionCenter.noAttention":"No blocked work or remote errors right now.","actionCenter.noWorkerEvidence":"No active worker evidence.","actionCenter.openDispatches":"Open dispatches","actionCenter.recapCopied":"Recap copied to clipboard.","actionCenter.recapCopyFailed":"Could not copy recap.","actionCenter.recent":"Recent","actionCenter.recentReports":"Recent reports","actionCenter.recentSubtitle":"Dispatches, reports, and cancellations in order.","actionCenter.reportCount":"{count} reports","actionCenter.runningCount":"{count} running","actionCenter.subtitle":"Team activity, open dispatches, and evidence for the next orchestration move","actionCenter.terminalHint":"Terminal","actionCenter.title":"Action Center","actionCenter.totalWorkers":"Team members","actionCenter.unknownWorker":"Unknown member","actionCenter.updated":"Updated {ago}","actionCenter.workingWorkers":"Working now","actionCenter.workerStatus":"Status","actionCenter.workers":"Workers","actionCenter.workersSubtitle":"Current work, latest reports, and terminal hints.","common.cancel":"Cancel","common.close":"Close","common.dismiss":"Dismiss","common.never":"Never","common.error":"Error","common.closeDialog":"Close dialog","common.time.sAgo":"{count}s ago","common.time.mAgo":"{count}m ago","common.time.hAgo":"{count}h ago","common.time.dAgo":"{count}d ago","common.copied":"Copied","common.copyError":"Copy error","common.delete":"Delete","common.idle":"idle","common.loading":"Loading…","common.refresh":"Refresh","common.restart":"Restart","common.retry":"Retry","common.running":"running","common.save":"Save","common.saving":"Saving…","common.start":"Start","common.starting":"Starting…","common.stop":"Stop","common.stopped":"stopped","common.working":"working","connect.login.failed":"Sign-in failed — check your connection and try again.","connect.login.heading":"Connect to your Hive","connect.login.subtitle":"Sign in to reach the computers running Hive on your account.","connect.login.github":"Continue with GitHub","connect.login.google":"Continue with Google","connect.login.signingIn":"Signing in…","connect.machines.back":"Back","connect.machines.connecting":"Connecting…","connect.machines.heading":"Your computers","connect.machines.empty":"No computers yet. Run Hive on a computer and enable remote access.","connect.machines.lastSeen":"Last seen {ago} ago","connect.machines.manageDevices":"Manage devices","connect.machines.offline":"Offline","connect.machines.online":"Online","connect.machines.revoked":"Access revoked","connect.machines.revokedHint":"This device's access was revoked — enter a new pairing code to connect again.","connect.machines.select":"Connect","connect.pair.back":"Back","connect.pair.finalizing":"Confirmed — preparing your session…","connect.pair.guideHeading":"Pair this phone","connect.pair.guideStep1":"On that computer, open Settings → Remote access.","connect.pair.guideStep2":"Click Add device and keep the pairing code visible.","connect.pair.guideStep3":"Enter that pairing code below.","connect.pair.qrLabel":"Pairing code","connect.pair.sasInstruction":"On your computer, open Settings → Remote access and tap Confirm if this code matches.","connect.pair.sasPrompt":"Confirm this code matches the one shown on your computer:","connect.pair.startOver":"Start over","connect.pair.submit":"Pair","connect.error.selectFailed":"Couldn't reach that computer. Your saved session may have expired, or it's offline — pair again below.","connect.error.invalidCode":"That pairing code doesn't look right. Check it and try again.","demo.banner":"Demo mode — interactive product replay.","demo.exit":"Exit demo","demo.replaySubtitle":"A local replay of planning, dispatch, report, and task closure.","demo.replayTitle":"Hive demo workspace","demo.tasksTitle":"Task graph","demo.teamTitle":"Team","firstRun.addWorkspace":"Add Workspace","firstRun.back":"Back","firstRun.desc":"Coordinate multiple CLI coding agents — locally.","firstRun.getStarted":"Get started","firstRun.howItWorks":"How it works","firstRun.next":"Next","firstRun.optionDesc":"Choose how you want to begin.","firstRun.slide1Desc":"Pick a project folder.","firstRun.slide1Title":"Add a Workspace","firstRun.slide2Desc":"Antigravity CLI, Claude Code, Codex, Gemini, OpenCode, Hermes, Qwen Code, Pi — your choice.","firstRun.slide2Title":"Pick an Orchestrator","firstRun.slide3Desc":"The Orchestrator dispatches `team send <worker> <task>` to team members.","firstRun.slide3Title":"Dispatch tasks","firstRun.skip":"Skip","firstRun.skipForNow":"Skip for now","firstRun.step":"Step {current} of {total}","firstRun.subtitle":"Each Workspace runs an Orchestrator that dispatches tasks to team members.","firstRun.title":"Welcome to Hive","firstRun.tryDemo":"Try Demo","language.aria":"Switch language","language.currentEn":"EN","language.currentZh":"中","language.en":"EN","language.switchToEn":"Switch language to English","language.switchToZh":"Switch language to 中文","language.tooltip":"Language","language.zh":"中文","marketplace.allCategories":"All","marketplace.backToList":"Back to list","marketplace.close":"Close marketplace","marketplace.empty":"No matching agents","marketplace.importButton":"Fill into form","marketplace.importedBadge":"You have a saved template with this name","marketplace.loading":"Loading…","marketplace.imported":"Filled the form from {name}","marketplace.loadFailed":"Failed to load marketplace","marketplace.openFromAddWorker":"Browse marketplace","marketplace.searchPlaceholder":"Search agents…","marketplace.showAllCategories":"Show {count} more categories","marketplace.showCoreOnly":"Show core only","marketplace.sourceLabel":"Curated from {repo}","marketplace.title":"Template marketplace","marketplace.viewSource":"View on GitHub","mobile.nav.aria":"Main navigation","mobile.focus.enter":"Focus the terminal (hide navigation)","mobile.focus.exit":"Show navigation","mobile.nav.flows":"Flows","mobile.nav.more":"More","mobile.nav.settings":"Settings","mobile.nav.tasks":"Tasks","mobile.nav.team":"Team","mobile.reconnect.disconnected":"Disconnected.","mobile.reconnect.reconnecting":"Reconnecting…","mobile.reconnect.retry":"Retry","mobile.reconnect.revoked":"Access revoked — re-pair this device from your computer.","mobile.section.about":"About","mobile.section.demo":"Demo","mobile.section.devices":"Devices","mobile.section.settings":"Settings","mobile.section.workflows":"Workflows","mobile.section.workspaces":"Workspaces","mobile.tasks.noWorkspaceDesc":"Pick or add a workspace to see its task graph.","mobile.tasks.noWorkspaceTitle":"No workspace selected","mobile.team.orchestrator":"Orchestrator","mobile.team.workers":"Workers","mobile.workspaces.switch":"Switch workspace","openWorkspace.error.appNotInstalled":"Couldn't find {app}. Make sure it's installed and reachable.","openWorkspace.error.commandNotInPath":"Couldn't run the launcher for {app}. Add its CLI to your PATH and retry.","openWorkspace.error.invalidPath":"The workspace path contains characters that are unsafe to launch.","openWorkspace.error.invalidTarget":"That app is no longer a supported open target.","openWorkspace.error.unknown":"Couldn't open in {app}.","openWorkspace.noWorkspace":"Select a workspace to enable","openWorkspace.open":"Open","openWorkspace.opened":"Opened {workspace} in {app} on your computer","openWorkspace.openIn":"Open {workspace} in {app}","openWorkspace.openInAria":"Open workspace {workspace} in {app}","openWorkspace.selectTarget":"Choose app","openWorkspace.target.cursor":"Cursor","openWorkspace.target.finder.linux":"File Manager","openWorkspace.target.finder.mac":"Finder","openWorkspace.target.finder.windows":"File Explorer","openWorkspace.target.ghostty":"Ghostty","openWorkspace.target.terminal":"Terminal","openWorkspace.target.vscode":"VS Code","openWorkspace.target.vscodeInsiders":"VS Code Insiders","openWorkspace.target.zed":"Zed","packageUpdate.body":"You are running v{current}. Update when you are ready; Hive will keep running.","packageUpdate.commandCopied":"Command copied","packageUpdate.commandCopyFailed":"Could not copy command","packageUpdate.copyCommand":"Copy command","packageUpdate.later":"Later","packageUpdate.openRelease":"Open release notes","packageUpdate.release":"Release","packageUpdate.title":"Hive v{version} is available","orchestrator.copyErrorAria":"Copy error message","orchestrator.failed":"Orchestrator failed to start","orchestrator.removeWorkspace":"Remove workspace","orchestrator.start":"Start Orchestrator","orchestrator.stop":"Stop Orchestrator","orchestrator.startingDesc":"Preparing the Orchestrator terminal.","orchestrator.startingTitle":"Starting Orchestrator","orchestrator.stoppedDesc":"Start the Orchestrator to plan tasks and dispatch them to team members.","orchestrator.stoppedTitle":"Orchestrator is stopped","role.coder":"Coder","role.custom":"Custom","role.reviewer":"Reviewer","role.sentinel":"Sentinel","role.tester":"Tester","runtime.retryNow":"Retry now","runtime.staleBody":"Writes are paused until Hive reconnects to the local runtime.","runtime.staleTitle":"Hive runtime connection lost","runtime.writeDisabled":"Hive runtime connection lost; retry once it is back.","sidebar.deleteAria":"Delete Workspace {name}","sidebar.deleteConfirm":'Delete Workspace "{name}"?',"sidebar.deleteDescription":"This stops its agents and removes it from Hive. The folder on disk ({path}) is left untouched. {summary}.","sidebar.deleteFailed":"Failed to delete: {message}","sidebar.deleteLabel":"Delete Workspace","sidebar.deleting":"Deleting…","sidebar.dismissRepository":"Hide the GitHub link","sidebar.noMembers":"no team members yet","sidebar.newWorkspace":"New Workspace","sidebar.noWorkspaces":"No Workspaces","sidebar.noWorkspacesDesc":"Add one to start. Hive will load .hive/tasks.md and start the Orchestrator.","sidebar.oneWorking":"One team member working","sidebar.demoVideo":"Demo video","sidebar.openDemoVideo":"Watch the Hive demo video","sidebar.openRepository":"Open the Hive GitHub repository","sidebar.removed":'Removed Workspace "{name}".',"sidebar.teamMemberCount":"{count} team members","sidebar.workingCount":"{working} of {total} working","sidebar.workingMembers":"{count} team members working","sidebar.workspaces":"Workspaces","shellTerminal.closeFailed":"Failed to close shell: {message}","shellTerminal.open":"Terminal","shellTerminal.openAria":"Open workspace terminal","pairing.awaitingConfirm":"Confirm on your computer to finish pairing.","pairing.cancel":"Cancel","pairing.connecting":"Connecting to your computer…","pairing.failed.expired":"Pairing expired — start again.","pairing.failed.mintForbidden":"Pairing was not confirmed on your computer.","pairing.failed.rejected":"Pairing was rejected.","pairing.failed.socket":"Lost the connection before pairing finished.","pairing.failed.version":"This phone and computer are on different versions.","pairing.handshaking":"Verifying…","pairing.paired":"Paired.","pairing.sasPrompt":"Check that this code matches the one on your computer:","pwa.appShellUpdated":"Web UI updated","pwa.reloadToActivate":"Reload to activate","pwa.reloading":"Reloading…","pwa.runtimeOffline.autoReconnect":"Auto-reconnect on — Hive will reload when the runtime is back.","pwa.runtimeOffline.body":"Start the Hive daemon by running `hive` in a terminal.","pwa.runtimeOffline.retry":"Retry now","pwa.runtimeOffline.retrying":"Retrying…","pwa.runtimeOffline.title":"Hive runtime is not running","pwa.runtimeOffline.tryDemo":"Try Demo instead","pwa.waitForAgents":"Wait for agents to finish","remote.addDevice":"Add device","remote.audit.bytes":"{count} bytes","remote.audit.empty":"No remote activity yet.","remote.audit.heading":"Remote activity","remote.audit.hide":"Hide activity","remote.audit.loadFailed":"Could not load activity.","remote.audit.result.error":"error","remote.audit.result.ok":"ok","remote.audit.result.rejected":"rejected","remote.audit.show":"Show activity","remote.connect.connecting":"Connecting…","remote.connect.disconnected":"Disconnected","remote.connect.online":"Connected","remote.connect.reconnecting":"Reconnecting…","remote.connect.sessionExpired":"Session expired — sign in again.","remote.confirm.confirm":"Confirm","remote.confirm.confirming":"Confirming…","remote.confirm.description":"A phone is trying to pair as “{name}”. Compare this code with the one shown on the phone — they must match.","remote.confirm.expired":"Pairing request expired.","remote.confirm.failed":"Could not complete — try pairing again.","remote.confirm.paired":"Paired “{name}”.","remote.confirm.reject":"Reject","remote.confirm.rejected":"Pairing rejected.","remote.confirm.sasLabel":"Verification code","remote.confirm.title":"Confirm new device","remote.confirm.warning":"Only confirm if you started this and the codes match.","remote.devices.activeNow":"Active just now","remote.devices.empty":"No paired devices yet.","remote.devices.heading":"Paired devices","remote.devices.lastActive":"Active {ago} ago","remote.devices.loadFailed":"Could not load devices.","remote.devices.neverActive":"Not active yet","remote.devices.revoke":"Revoke","remote.devices.revokeAria":"Revoke device {name}","remote.devices.revokeConfirm":"Revoke “{name}”? Its open sessions close immediately and it must pair again.","remote.devices.revokeFailed":"Could not revoke — try again.","remote.devices.revokeTitle":"Revoke device","remote.devices.revoked":"Revoked “{name}”.","remote.diagnostics.copy":"Copy diagnostics","remote.diagnostics.copied":"Diagnostics copied","remote.diagnostics.copyFailed":"Could not copy diagnostics.","remote.diagnostics.copying":"Copying...","remote.retention.activeDays":"active days","remote.retention.loadFailed":"Could not load local retention signals.","remote.retention.localOnly":"local only","remote.retention.reports":"reports","remote.retention.sends":"sends","remote.retention.streak":"current streak","remote.retention.title":"Protocol activity","remote.disable.confirmBody":"Remote devices (including this one) will disconnect immediately. You can only re-enable it from the desktop.","remote.disable.confirmTitle":"Turn off remote access?","remote.enable.description":"Reach this machine from your phone over an end-to-end encrypted tunnel. Off by default.","remote.enable.label":"Remote access","remote.qr.cancel":"Cancel","remote.qr.expired":"Code expired — generate a new one.","remote.qr.expiresIn":"Expires in {seconds}s","remote.qr.instructions":"Enter this code on your phone. Keep this open until you confirm here.","remote.qr.regenerate":"New code","remote.qr.startFailed":"Could not start pairing — try again.","remote.qr.title":"Pairing code","remote.section":"Remote access","remote.status.connected":"Tunnel connected","remote.status.disconnected":"Tunnel offline","remote.status.linked":"Linked to {gateway}","remote.status.notLinked":"Not linked — run `hive remote login` in a terminal.","remote.status.connecting":"Connecting to the gateway…","remote.status.reconnecting":"Reconnecting…","remote.status.revoked":"Access revoked — re-link to restore remote access.","scenario.applied":"Team assembled — the goal is with the Orchestrator","scenario.apply":"Assemble team & start","scenario.applying":"Assembling…","scenario.build_review_test.desc":"Coder + Reviewer + Tester running a build–review–verify loop.","scenario.build_review_test.title":"Build · Review · Test","scenario.cancel":"Cancel","scenario.docs_pipeline.desc":"A drafter writes the doc, a doc reviewer checks facts and flow.","scenario.docs_pipeline.title":"Docs pipeline","scenario.goalHint":"Sent to the Orchestrator — it dispatches with team send/team spawn, or uses team workflow for staged or 3+ worker work.","scenario.goalLabel":"Goal","scenario.research_factcheck.desc":"A researcher gathers sourced findings, a fact-checker verifies them.","scenario.research_factcheck.title":"Research & Fact-check","scenario.sectionTitle":"Or start with a scenario team","settings.aria":"Settings","settings.autostaff.description":"Let the orchestrator size the team to each task — spawn the right mix of coders / testers / reviewers. On by default.","settings.autostaff.label":"Auto-staff team","settings.experimental":"Experimental","settings.language":"Language","settings.heading":"Settings","settings.notifications":"Notifications","settings.subtitle":"Features, webhooks, and remote access.","settings.saveError":"Could not save — check the runtime connection and try again.","settings.tooltip":"Settings","settings.webhook.description":"POST a small JSON payload to this URL when a worker reports or a workflow finishes — wire it to Slack, ntfy, Feishu, etc. Best-effort; the runtime sends to whatever URL you set, so keep it private.","settings.webhook.label":"Completion webhook","settings.webhook.saved":"Saved","settings.workflows.description":"Let the orchestrator author and run multi-agent workflows (`team workflow`). Off by default.","settings.workflows.label":"Workflows","topbar.hideTodo":"Hide Tasks","topbar.openWebsite":"Open hivehq.dev","topbar.showTodo":"Show Tasks (.hive/tasks.md)","topbar.todo":"Tasks","topbar.todoOpen":"Tasks — {count} open tasks","topbar.copyUpdateCommand":"Copy update command","topbar.openRelease":"Open release notes","topbar.updateAvailable":"Update available","topbar.updateCommandCopied":"Update command copied","topbar.updateCommandCopyFailed":"Could not copy update command","topbar.hideMemory":"Hide Memory","topbar.showMemory":"Show Memory","topbar.memory":"Memory","topbar.hideWorkflows":"Hide Workflows","topbar.showWorkflows":"Show Workflows","topbar.workflows":"Workflows","memory.title":"Memory","memory.subtitle":"Workspace knowledge and Dream audit trail","memory.searchPlaceholder":"Search...","memory.tabActive":"Active","memory.tabArchived":"Archived","memory.tabDreams":"Dreams","memory.runNow":"Run now","memory.emptyActive":"No memory entries","memory.emptyActiveDesc":"Entries appear here after the orchestrator adds memory or Dream extracts it.","memory.emptyDreams":"No dream runs yet","memory.emptyDreamsDesc":"Run history appears after a manual or scheduled Dream pass.","memory.archiveTitle":"Archive Memory","memory.archiveDesc":"Archived memory stops appearing in startup, recovery, and dispatch injection.","memory.archiveButton":"Archive","memory.revertTitle":"Revert Dream Run","memory.revertDesc":"This restores the memory rows changed by the selected Dream run and archives entries it added.","memory.revertButton":"Revert","memory.sources":"Sources","memory.noSources":"No source evidence.","memory.updated":"Updated {time}","memory.injected":"Injected {time}","memory.started":"Started {time}","memory.finished":"Finished {time}","memory.revertTooltip":"Revert dream run","memory.status.pending":"pending","memory.status.running":"running","memory.status.completed":"completed","memory.status.failed":"failed","memory.status.reverted":"reverted","memory.trigger.manual":"manual","memory.trigger.cron":"scheduled","memory.trigger.scheduled":"scheduled","memory.noReport":"No report","memory.noInput":"No input","memory.seq":"Seq","memory.reportAdded":"added","memory.reportRewritten":"rewritten","memory.reportArchived":"archived","memory.reportMerged":"merged","memory.diff.added":"Added","memory.diff.rewritten":"Rewritten","memory.diff.archived":"Archived","memory.diff.merged":"Merged","memory.pinned":"Pinned","memory.scopeUser":"User","memory.disabled":"Disabled","memory.unpinTooltip":"Unpin","memory.pinTooltip":"Pin","memory.enableTooltip":"Enable","memory.disableTooltip":"Disable","memory.entries":"entries","memory.runs":"runs","memory.kind.decision":"Decision","memory.kind.fact":"Fact","memory.kind.pitfall":"Pitfall","memory.kind.preference":"Preference","memory.kind.procedure_ref":"Procedure","tasks.title":"Tasks","tasks.subtitle":"Project todo list parsed from .hive/tasks.md","tasks.editMarkdown":"Edit Markdown","tasks.save":"Save","tasks.local":"Keep Local","tasks.reload":"Reload","tasks.noTasks":"No task entries","tasks.noTasksDesc":"Orchestrators parse task items formatted as checkboxes from tasks.md.","workflows.title":"Workflows","workflows.subtitle":"Multi-agent workflows, dispatches, and logs","workflows.description":"Hive workflows are authored and run by the Orchestrator via team workflow run --stdin (recurring runs go through team workflow schedule). Native CLI subagents/workflows do not appear here; this panel observes Hive phases, workers, logs, and schedule controls.","workflows.recentRuns":"Recent runs","workflows.filterAll":"All","workflows.filterRunning":"Running","workflows.filterFailed":"Failed","workflows.emptyRuns":"No runs yet","workflows.emptyRunsDesc":"Ask the Orchestrator to run a Hive workflow for work that fans out across multiple workers.","workflows.emptyFilter":"No runs matching this filter.","workflows.schedules":"Schedules","workflows.noAgents":"No agent() calls in this run.","workflows.narrator":"Narrator ({count} lines)","workflows.narratorOne":"Narrator (1 line)","workflows.runError":"Run error: {error}","workflows.stopTooltip":"Stop run","workflows.deleteScheduleTooltip":"Delete schedule","workflows.pauseTooltip":"Pause","workflows.resumeTooltip":"Resume","workflows.loading":"Loading…","workflows.status.pending":"pending","workflows.status.running":"running","workflows.status.completed":"completed","workflows.status.failed":"failed","workflows.status.interrupted":"interrupted","workflows.status.stopped":"stopped","workflows.dispatchStatus.queued":"queued","workflows.dispatchStatus.submitted":"submitted","workflows.dispatchStatus.reported":"reported","workflows.dispatchStatus.cancelled":"cancelled","workflows.dispatchStatus.awaitingReport":"awaiting report…","workflows.cli.title":"Workflow agent CLI","workflows.cli.desc":"Which CLI a workflow agent launches when its script doesn't name one, and which CLIs are allowed. Custom role templates keep their own CLI.","workflows.cli.default":"Default","workflows.cli.allowed":"Allowed","workflows.cli.saving":"Saving…","workflows.cli.save":"Save","workflows.cli.pickOne":"Pick at least one CLI","workflows.cli.saved":"Saved","workflows.cli.failed":"Failed to save","welcome.addWorkspace":"Add your first Workspace","welcome.demo":"or try the demo (no install needed)","welcome.desc":"Coordinate Antigravity CLI, Claude Code, Codex, Gemini, OpenCode, Hermes, Qwen Code, Pi — locally.","welcome.step1Desc":"Pick a project folder.","welcome.step1Title":"Add a Workspace","welcome.step2Desc":"Antigravity / Claude / Codex / Gemini / OpenCode / Hermes / Qwen / Pi.","welcome.step2Title":"Choose an Orchestrator","welcome.step3Desc":"The Orchestrator routes work via team send.","welcome.step3Title":"Dispatch tasks","welcome.title":"Welcome to Hive","worker.deleteAria":"Delete team member {name}","worker.deleteConfirm":"Delete {name}?","worker.deleteDescription":"This stops {name}'s terminal and removes it from the workspace. All queued dispatches are dropped.","worker.deleteMember":"Delete member","worker.detail":"{name} detail","worker.closeOutsideHint":"Click outside the member window to close.","worker.emptyAdd":"Add your first member","worker.emptyDesc":"Add team members (Antigravity CLI, Claude Code, Codex, Gemini, OpenCode, Hermes, Qwen Code, Pi) and the Orchestrator will route tasks to them.","worker.emptyTitle":"No team members yet","worker.actionsAria":"Actions for {name}","worker.avatar":"Avatar","worker.avatarChange":"Change avatar","worker.avatarChangeAria":"Change avatar for {name}","worker.avatarDefault":"Use default","worker.avatarLoadFailed":"Could not load that image.","worker.avatarNotImage":"Choose a PNG, JPEG, or WebP image.","worker.avatarSourceTooLarge":"Choose an image under 5 MB.","worker.avatarTitle":"Change avatar","worker.avatarTooLarge":"Avatar image is too large.","worker.avatarUpload":"Upload image","worker.avatarHelpText":"Supports PNG, JPEG or WebP, up to 5 MB.","worker.avatarUsingDefault":"Using default avatar","worker.avatarUsingCustom":"Using custom avatar","worker.lastActivity":"Latest terminal output (a hint, not a reported reply).","worker.open":"Open {name}","worker.rename":"Rename","worker.renameAria":"Rename {name}","worker.restartAria":"Restart {name}","worker.renameDesc":"Pick a new display name. The agent's id and PTY are unchanged.","worker.renameFailed":"Rename failed: {message}","worker.renameSuccess":'Renamed to "{name}".',"worker.renameTitle":"Rename team member","worker.startAgent":"Start the agent to begin receiving dispatches.","worker.startAria":"Start {name}","worker.stopAria":"Stop {name}","worker.teamMembers":"Team members","worker.terminalNotStarted":"PTY not started yet — ","worker.terminalStopped":"PTY stopped — ","worker.widthResize":"Resize worker detail width","worker.workingLegend":"Working = busy or waiting for input. Hive doesn’t detect stalls automatically — open the terminal to check.","workerPane.resize":"Resize Orchestrator and Team Members panes","tasks.action.addSubtask":"Add subtask","tasks.action.backToList":"Back to list","tasks.action.closeTodo":"Close Tasks","tasks.action.copied":"Copied","tasks.action.copyLine":"Copy line","tasks.action.delete":"Delete","tasks.action.edit":"Edit","tasks.action.viewSource":"View source","tasks.aria.addSubtask":"Add subtask","tasks.aria.collapseSubtasks":"Collapse {count} subtasks","tasks.aria.copiedTaskLine":"Copied task line","tasks.aria.copyTaskLine":"Copy task line","tasks.aria.deleteTask":"Delete task","tasks.aria.drawer":"Tasks","tasks.aria.editTask":"Edit task","tasks.aria.expandSubtasks":"Expand {count} subtasks","tasks.aria.progress":"Task completion","tasks.button.addTask":"Add task","tasks.completed.toggle":"{count} completed","tasks.empty.description":"Ask the Orchestrator to split the work via team send/team spawn, or team workflow for staged or 3+ worker work — or add your first task to bootstrap .hive/tasks.md.","tasks.empty.title":"No tasks yet","tasks.placeholder.editTask":"Edit task","tasks.placeholder.newSubtask":"New subtask","tasks.placeholder.newTask":"What needs to be done?","tasks.progress.subtaskTitle":"{done} of {total} direct subtasks complete","tasks.raw.conflictDescription":"Reloading will discard the current draft; Keep local will continue editing it.","tasks.raw.conflictTitle":"File changed externally","tasks.raw.keepLocal":"Keep local","tasks.raw.label":"Tasks Markdown","tasks.raw.lineCount":"{count} lines","tasks.raw.reload":"Reload","tasks.raw.save":"Save tasks","tasks.title.todo":"Tasks","notifications.desktop.aria":"Browser notifications","notifications.desktop.helper":"Use system notifications when permission is granted.","notifications.desktop.label":"Browser notifications","notifications.desktop.unsupported":"Not supported in this browser.","notifications.detail.brief.description":"Compact status line","notifications.detail.brief.label":"Brief","notifications.detail.detailed.description":"Workspace and queue context","notifications.detail.detailed.label":"Detailed","notifications.detail.sectionLabel":"Information","notifications.settings.aria":"Notification settings","notifications.settings.heading":"Notifications","notifications.settings.subtitle":"Choose how Hive alerts you when team members report or stop.","notifications.settings.tooltip":"Notifications","notifications.sound.beacon.description":"Distinct question tone","notifications.sound.beacon.label":"Signal","notifications.sound.cascade.description":"Layered success tone","notifications.sound.cascade.label":"Cascade","notifications.sound.chime.description":"Clean glass tap","notifications.sound.chime.label":"Glass","notifications.sound.longerBadge":"longer","notifications.sound.off.description":"Mute sounds","notifications.sound.off.label":"Off","notifications.sound.ping.description":"Tiny UI tick","notifications.sound.ping.label":"Tap","notifications.sound.previewAria":"Preview {label} sound","notifications.sound.resolve.description":"Longer completion cue","notifications.sound.resolve.label":"Done","notifications.sound.sectionLabel":"Sound","notifications.sound.soft.description":"Warm default chime","notifications.sound.soft.label":"Soft","notifications.test.brief":"Hive notifications are working.","notifications.test.button":"Test","notifications.test.detail":"Hive notifications are working with your selected sound and detail level.","notifications.test.title":"Hive notification test","notifications.remoteSession.brief":"{name} connected","notifications.remoteSession.detail":"{name} established a remote session.","notifications.remoteSession.title":"Remote device connected","notifications.toast.blocked":"Browser notifications are blocked.","notifications.toast.declined":"Browser notifications were not enabled.","notifications.toast.unsupported":"This browser does not support notifications.","notifications.workerReported.brief":"{name} reported","notifications.workerReported.detail":"{name} reported in {workspace}.","notifications.workerReported.title":"Team member report","notifications.workerStarted.brief":"{name} started","notifications.workerStarted.detail":"{name} started in {workspace} as {role}.","notifications.workerStarted.title":"Team member started","notifications.workerStopped.brief":"{name} stopped","notifications.workerStopped.detail":"{name} stopped in {workspace}.","notifications.workerStopped.title":"Team member stopped","workspace.add.manualHint":"Type or paste the absolute path to a project folder on your computer.","workspace.advanced.browse":"Advanced: browse server filesystem","workspace.advanced.pastePath":"Advanced: paste path","workspace.advanced.settings":"Advanced Options","workspace.advanced.startup":"Advanced: custom startup command","workspace.browse.breadcrumb":"Breadcrumb","workspace.browse.drivesAria":"Show all drives","workspace.browse.drivesRoot":"This PC","workspace.browse.empty":"This directory is empty.","workspace.browse.gitBadge":"git","workspace.browse.openAria":"Open {name}","workspace.browse.parentAria":"Go to parent directory","workspace.browse.root":"root: {path}","workspace.browse.rootLoading":"(loading)","workspace.browse.selected":"Selected","workspace.browse.title":"Browse server filesystem","workspace.browse.up":"up","workspace.confirm.create":"Create Workspace","workspace.confirm.description":"Hive will load .hive/tasks.md and start the Orchestrator here.","workspace.confirm.title":"Add Workspace","workspace.error.createFailed":"Failed to create workspace","workspace.error.createTitle":"Could not create workspace","workspace.error.outsideSandbox":"Picked folder is not inside the Hive sandbox. Use paste path.","workspace.error.pastePathInstead":"Paste path instead","workspace.error.pickerFailed":"Folder picker failed","workspace.field.absolutePath":"Absolute path","workspace.field.absolutePathPlaceholder":"C:\\path\\to\\project or /absolute/path","workspace.field.name":"Workspace name","workspace.field.nameDefaultPlaceholder":"my-project","workspace.field.path":"Path","workspace.field.pathEmptyPlaceholder":"(no folder picked — use paste path below)","workspace.field.startup":"Startup command","workspace.field.startupPlaceholder":"claude --resume <session-id>","workspace.git.detached":"detached","workspace.git.detected":"git repository detected","workspace.git.none":"No git repository at this path.","workspace.git.noneShort":"no git","workspace.git.short":"git · {branch}","workspace.picking.message":"Opening system folder picker…","workspace.picking.title":"Opening folder picker","workspace.preset.label":"Orchestrator CLI","workspace.preset.generic":"Generic command","workspace.preset.genericPreview":"custom startup command only","workspace.preset.genericRequiresStartup":"Generic command requires a startup command.","workspace.preset.installCopy":"Copy","workspace.preset.installCopyAria":"Copy install command","workspace.preset.installDocs":"Install guide","workspace.preset.installHint":"Install {name}:","workspace.preset.loadFailed":"Failed to load CLI presets; using server default.","workspace.preset.loading":"Loading CLI presets…","workspace.preset.noneAvailable":"No supported CLI agent was found on this machine. You can watch the demo first — no install needed.","workspace.preset.notFoundSuffix":" (not found)","workspace.preset.notInstalled":"{name} is not installed. Choose another CLI or add a custom startup command.","workspace.preset.optionsAria":"Orchestrator CLI options","workspace.preset.pathHelpBody":"Hive detects CLIs using the PATH of the shell that launched it. With nvm or a GUI launcher, that PATH can differ from your terminal. Quit Hive and re-run `hive` from a terminal where this CLI works.","workspace.preset.pathHelpTitle":"Installed it, but still shown as not found?","workspace.preset.tryDemo":"Try the demo first","workspace.yolo.notice":"Agents start in auto-approve mode: CLI permission prompts are skipped (e.g. `--dangerously-skip-permissions`), so an agent can run commands and edit files as you. The Stop button on each card halts a runaway agent.","workspace.startup.hint":"Overrides the preset for this Orchestrator. Runs in the workspace directory through your shell (bash/zsh/fish on POSIX, cmd.exe on Windows), so only paste commands you trust.","workspace.startup.hintShort":"Runs through your shell in the workspace directory. Only paste commands you trust.","demo.orchestratorLabel":"Orchestrator — pre-recorded","demo.readOnlyBadge":"DEMO read-only","layout.sidebarAria":"Workspace sidebar","layout.sidebarResizeAria":"Resize Workspace sidebar","layout.sidebarCollapse":"Collapse sidebar","layout.sidebarExpand":"Expand sidebar","terminal.composer.placeholder":"Type a command…","terminal.composer.send":"Send","terminal.composer.sendEnter":"Send ⏎","terminal.paste.button":"Paste","terminal.paste.cancel":"Cancel","terminal.paste.confirm":"Paste","terminal.paste.denied":"Clipboard access was denied — long-press the input to paste instead.","terminal.paste.lengthChars":"{count} characters","terminal.paste.preview":"Preview","terminal.paste.title":"Paste into terminal?","terminal.renderer.canvasFallbackNotice":"WebGL unavailable — using the canvas renderer.","terminal.firstRunSetup":"Finish this CLI setup in the terminal, then Hive will send startup instructions.","terminal.scrollToBottom":"Jump to latest","terminal.statusConnecting":"Connecting","terminal.statusRunning":"Running","terminalPanel.closePanel":"Close terminal panel","terminalPanel.closeTab":"Close {name}","terminalPanel.maximize":"Maximize terminal panel","terminalPanel.newShell":"New shell","terminalPanel.resizeAria":"Resize terminal panel height","terminalPanel.restore":"Restore terminal panel","terminalPanel.tablistAria":"Workspace terminal tabs","terminalPanel.workerStopped":"{name} is stopped — start the member to attach a terminal.","terminalPanels.aria":"Terminal panels","toast.dismissAria":"Dismiss","whatsNew.gotIt":"Got it","whatsNew.subtitle":"Updates since you were last here","whatsNew.title":"What's New","whatsNew.versionLabel":"Version {version}","workspaceList.empty":"No Workspaces yet"},iC={"addWorker.agentCli":"Agent CLI","addWorker.agentNotFound":"未找到","addWorker.agentExists":"成员名字已存在","addWorker.cancel":"取消","addWorker.create":"添加成员","addWorker.creating":"创建中…","addWorker.customPlaceholder":"你是安全审查成员,重点关注鉴权和输入校验。用 team report 把发现交还给 Orchestrator。","addWorker.description":"选择角色和 CLI Agent。Orchestrator 会通过 {command} 分派任务。","addWorker.emptyInstructions":"补充角色说明","addWorker.enterName":"请输入名称","addWorker.genericAgent":"通用命令","addWorker.genericCommand":"仅使用启动命令","addWorker.loadingPresets":"正在加载预设…","addWorker.name":"名称","addWorker.namePlaceholder":"例如 鲁班","addWorker.modifiedFrom":"已修改 {role} 默认说明","addWorker.pickCliOrStartup":"请选择 CLI Agent,或填写启动命令","addWorker.random":"随机","addWorker.randomAria":"生成随机成员名","addWorker.randomTooltip":"随机来一个","addWorker.role":"角色","addWorker.roleInstructions":"角色说明","addWorker.roleInstructionsTitle":"会注入到 Agent 启动提示和每次派单中。Hive 的 team 协议保持不变,这里只影响角色行为。","addWorker.reset":"重置","addWorker.saveAsTemplate":"保存为模板","addWorker.startupCommand":"启动命令","addWorker.startupHelp":"可选。会在当前 Workspace 里通过当前 shell 运行(POSIX 上是 bash/zsh/fish,Windows 上是 cmd.exe)。适合自定义 Agent 或原生命令恢复会话,例如 {example}。","addWorker.startupOverrides":"覆盖 CLI 启动","addWorker.template":"已保存的模板","addWorker.templateClear":"不使用模板(空白 Custom)","addWorker.templateDeleteAria":"删除模板 {name}","addWorker.templateDeleteConfirm":'删除已保存的模板"{name}"?该操作无法撤销。',"addWorker.templateDeleteConfirmLabel":"删除","addWorker.templateDeleteTitle":"删除角色模板","addWorker.templateEmpty":"还没有已保存的模板。在下方填写角色说明并保存。","addWorker.templateNamePlaceholder":"模板名称","addWorker.templateNoMatch":"没有匹配的模板。","addWorker.templatePickPlaceholder":"选择已保存的模板…","addWorker.templateSaveConfirm":"保存","addWorker.templateSearchPlaceholder":"搜索模板","addWorker.title":"添加团队成员","addWorker.unavailable":"{name} 未安装","actionCenter.activity.cancelled":"{worker} 已取消 · {ago}","actionCenter.activity.queued":"{worker} 已接收任务 · {ago}","actionCenter.activity.reported":"{worker} 已汇报 · {ago}","actionCenter.activity.submitted":"{worker} 已开始 · {ago}","actionCenter.attention":"注意","actionCenter.attention.noWorkers":"还没有团队成员。","actionCenter.attention.remoteError":"远程请求在 {endpoint} 出错。","actionCenter.attention.remoteRejected":"远程请求在 {endpoint} 被拒绝:{reason}。","actionCenter.attention.stoppedWithQueue":"{worker} 已停止,但还有未处理任务。","actionCenter.attention.waitingReport":"{worker} 已等待汇报 {minutes} 分钟。","actionCenter.attentionSubtitle":"可能需要 Orchestrator 处理的阻塞、等待或远程错误。","actionCenter.allClear":"状态正常","actionCenter.collapse":"收起 Action Center","actionCenter.copyRecap":"复制战报","actionCenter.currentDispatch":"当前","actionCenter.expand":"展开 Action Center","actionCenter.latestReport":"汇报","actionCenter.loadFailed":"无法加载团队动态。","actionCenter.liveSnapshot":"实时快照","actionCenter.loading":"正在加载团队动态...","actionCenter.metrics":"Action Center 指标","actionCenter.needsAttention":"{count} 项需关注","actionCenter.noActivity":"暂无团队动态。","actionCenter.noAttention":"当前没有阻塞任务或远程错误。","actionCenter.noWorkerEvidence":"暂无活跃成员证据。","actionCenter.openDispatches":"打开的任务","actionCenter.recapCopied":"战报已复制到剪贴板。","actionCenter.recapCopyFailed":"复制战报失败。","actionCenter.recent":"最近","actionCenter.recentReports":"近期汇报","actionCenter.recentSubtitle":"按时间排列的派发、汇报和取消记录。","actionCenter.reportCount":"{count} 条汇报","actionCenter.runningCount":"{count} 个运行中","actionCenter.subtitle":"团队动态、打开任务与下一步调度需要的证据","actionCenter.terminalHint":"终端","actionCenter.title":"Action Center","actionCenter.totalWorkers":"团队成员","actionCenter.unknownWorker":"未知成员","actionCenter.updated":"更新于 {ago}","actionCenter.workingWorkers":"正在工作","actionCenter.workerStatus":"状态","actionCenter.workers":"成员","actionCenter.workersSubtitle":"当前任务、最新汇报与终端线索。","common.cancel":"取消","common.close":"关闭","common.dismiss":"关闭提示","common.never":"从未","common.error":"错误","common.closeDialog":"关闭对话框","common.time.sAgo":"{count} 秒前","common.time.mAgo":"{count} 分钟前","common.time.hAgo":"{count} 小时前","common.time.dAgo":"{count} 天前","common.copied":"已复制","common.copyError":"复制错误","common.delete":"删除","common.idle":"空闲","common.loading":"加载中…","common.refresh":"刷新","common.restart":"重启","common.retry":"重试","common.running":"运行中","common.save":"保存","common.saving":"保存中…","common.start":"启动","common.starting":"启动中…","common.stop":"停止","common.stopped":"已停止","common.working":"工作中","connect.login.failed":"登录失败——请检查网络后重试。","connect.login.heading":"连接到你的 Hive","connect.login.subtitle":"登录后即可访问你账号下正在运行 Hive 的电脑。","connect.login.github":"使用 GitHub 登录","connect.login.google":"使用 Google 登录","connect.login.signingIn":"登录中…","connect.machines.back":"返回","connect.machines.connecting":"连接中…","connect.machines.heading":"你的电脑","connect.machines.empty":"还没有电脑。在电脑上运行 Hive 并开启远程访问。","connect.machines.lastSeen":"{ago}前在线","connect.machines.manageDevices":"管理设备","connect.machines.offline":"离线","connect.machines.online":"在线","connect.machines.revoked":"访问已被吊销","connect.machines.revokedHint":"此设备的访问已被吊销——请输入新的配对码重新连接。","connect.machines.select":"连接","connect.pair.back":"返回","connect.pair.finalizing":"已确认——正在准备会话…","connect.pair.guideHeading":"配对这台手机","connect.pair.guideStep1":"在那台电脑上,打开 设置 → 远程访问。","connect.pair.guideStep2":"点击添加设备,并保持配对码可见。","connect.pair.guideStep3":"在下面输入那个配对码。","connect.pair.qrLabel":"配对码","connect.pair.sasInstruction":"在你的电脑上,打开 设置 → 远程访问,确认验证码一致后点击确认。","connect.pair.sasPrompt":"确认此验证码与电脑上显示的一致:","connect.pair.startOver":"重新开始","connect.pair.submit":"配对","connect.error.selectFailed":"无法连接那台电脑。你保存的会话可能已失效,或它已离线 —— 请在下方重新配对。","connect.error.invalidCode":"这个配对码看起来不对,请检查后重试。","demo.banner":"演示模式 — 本地交互回放。","demo.exit":"退出演示","demo.replaySubtitle":"本地回放规划、派单、汇报和任务闭环。","demo.replayTitle":"Hive 演示工作区","demo.tasksTitle":"任务图","demo.teamTitle":"团队","firstRun.addWorkspace":"添加 Workspace","firstRun.back":"返回","firstRun.desc":"在本地协调多个 CLI 编码 Agent。","firstRun.getStarted":"开始使用","firstRun.howItWorks":"工作方式","firstRun.next":"下一步","firstRun.optionDesc":"选择一个开始方式。","firstRun.slide1Desc":"选择一个项目目录。","firstRun.slide1Title":"添加 Workspace","firstRun.slide2Desc":"Antigravity CLI、Claude Code、Codex、Gemini、OpenCode、Hermes、Qwen Code、Pi,任选。","firstRun.slide2Title":"选择 Orchestrator","firstRun.slide3Desc":"Orchestrator 通过 `team send <worker> <task>` 向团队成员派单。","firstRun.slide3Title":"分派任务","firstRun.skip":"跳过","firstRun.skipForNow":"暂时跳过","firstRun.step":"第 {current} / {total} 步","firstRun.subtitle":"每个 Workspace 运行一个 Orchestrator,再把任务派给团队成员。","firstRun.title":"欢迎使用 Hive","firstRun.tryDemo":"试用演示","language.aria":"切换语言","language.currentEn":"EN","language.currentZh":"中","language.en":"EN","language.switchToEn":"切换语言到 English","language.switchToZh":"切换语言到中文","language.tooltip":"语言","language.zh":"中文","marketplace.allCategories":"全部","marketplace.backToList":"返回列表","marketplace.close":"关闭模板市场","marketplace.empty":"没有匹配的角色","marketplace.importButton":"填入表单","marketplace.importedBadge":"本地已有同名模板","marketplace.loading":"加载中…","marketplace.imported":"已把 {name} 填入表单","marketplace.loadFailed":"加载失败","marketplace.openFromAddWorker":"从模板市场选择","marketplace.searchPlaceholder":"搜索角色…","marketplace.showAllCategories":"显示其他 {count} 个分类","marketplace.showCoreOnly":"只看核心分类","marketplace.sourceLabel":"由 {repo} 提供","marketplace.title":"模板市场","marketplace.viewSource":"在 GitHub 查看","mobile.nav.aria":"主导航","mobile.focus.enter":"专注终端(隐藏导航)","mobile.focus.exit":"显示导航","mobile.nav.flows":"工作流","mobile.nav.more":"更多","mobile.nav.settings":"设置","mobile.nav.tasks":"任务","mobile.nav.team":"团队","mobile.reconnect.disconnected":"已断开。","mobile.reconnect.reconnecting":"正在重新连接…","mobile.reconnect.retry":"重试","mobile.reconnect.revoked":"访问已被吊销——请在电脑上重新配对此设备。","mobile.section.about":"关于","mobile.section.demo":"演示","mobile.section.devices":"设备","mobile.section.settings":"设置","mobile.section.workflows":"工作流","mobile.section.workspaces":"工作区","mobile.tasks.noWorkspaceDesc":"选择或添加一个工作区即可查看其任务图。","mobile.tasks.noWorkspaceTitle":"未选择工作区","mobile.team.orchestrator":"Orchestrator","mobile.team.workers":"成员","mobile.workspaces.switch":"切换工作区","openWorkspace.error.appNotInstalled":"未找到 {app},请确认已安装并可启动。","openWorkspace.error.commandNotInPath":"{app} 的命令行入口不可用,请把它的 CLI 加入 PATH 后重试。","openWorkspace.error.invalidPath":"workspace 路径包含无法安全启动的字符。","openWorkspace.error.invalidTarget":"该应用已不在支持的打开目标列表里。","openWorkspace.error.unknown":"在 {app} 中打开失败。","openWorkspace.noWorkspace":"请先选择一个 workspace","openWorkspace.open":"打开","openWorkspace.opened":"已在你的电脑上用 {app} 打开 {workspace}","openWorkspace.openIn":"用 {app} 打开 {workspace}","openWorkspace.openInAria":"用 {app} 打开 workspace {workspace}","openWorkspace.selectTarget":"选择应用","openWorkspace.target.cursor":"Cursor","openWorkspace.target.finder.linux":"文件管理器","openWorkspace.target.finder.mac":"访达","openWorkspace.target.finder.windows":"文件资源管理器","openWorkspace.target.ghostty":"Ghostty","openWorkspace.target.terminal":"终端","openWorkspace.target.vscode":"VS Code","openWorkspace.target.vscodeInsiders":"VS Code Insiders","openWorkspace.target.zed":"Zed","packageUpdate.body":"当前运行的是 v{current}。准备好后再升级,Hive 会继续运行。","packageUpdate.commandCopied":"命令已复制","packageUpdate.commandCopyFailed":"复制命令失败","packageUpdate.copyCommand":"复制命令","packageUpdate.later":"稍后","packageUpdate.openRelease":"查看版本说明","packageUpdate.release":"版本说明","packageUpdate.title":"Hive v{version} 可用","orchestrator.copyErrorAria":"复制错误信息","orchestrator.failed":"Orchestrator 启动失败","orchestrator.removeWorkspace":"移除 workspace","orchestrator.start":"启动 Orchestrator","orchestrator.stop":"停止 Orchestrator","orchestrator.startingDesc":"正在准备 Orchestrator 终端。","orchestrator.startingTitle":"Orchestrator 启动中","orchestrator.stoppedDesc":"启动 Orchestrator 后才能规划任务并分派给团队成员。","orchestrator.stoppedTitle":"Orchestrator 已停止","role.coder":"开发","role.custom":"自定义","role.reviewer":"审查","role.sentinel":"巡检","role.tester":"测试","runtime.retryNow":"立即重试","runtime.staleBody":"重新连接本地后端前,写操作已暂停。","runtime.staleTitle":"Hive 后端连接已断开","runtime.writeDisabled":"Hive 后端连接已断开,恢复后再重试。","sidebar.deleteAria":"删除 Workspace {name}","sidebar.deleteConfirm":'删除 Workspace "{name}"?',"sidebar.deleteDescription":"这会停止其中的 Agent,并从 Hive 移除它。磁盘目录({path})不会被删除。{summary}。","sidebar.deleteFailed":"删除失败:{message}","sidebar.deleteLabel":"删除 Workspace","sidebar.deleting":"删除中…","sidebar.dismissRepository":"隐藏 GitHub 链接","sidebar.noMembers":"还没有团队成员","sidebar.newWorkspace":"新建 Workspace","sidebar.noWorkspaces":"还没有 Workspace","sidebar.noWorkspacesDesc":"添加一个开始使用。Hive 会加载 .hive/tasks.md 并启动 Orchestrator。","sidebar.oneWorking":"1 个团队成员工作中","sidebar.demoVideo":"演示视频","sidebar.openDemoVideo":"观看 Hive 演示视频","sidebar.openRepository":"打开 Hive GitHub 仓库","sidebar.removed":'已移除 Workspace "{name}"。',"sidebar.teamMemberCount":"{count} 个团队成员","sidebar.workingCount":"{working} / {total} 工作中","sidebar.workingMembers":"{count} 个团队成员工作中","sidebar.workspaces":"Workspaces","shellTerminal.closeFailed":"关闭 shell 失败:{message}","shellTerminal.open":"终端","shellTerminal.openAria":"打开 workspace 终端","pairing.awaitingConfirm":"在电脑上确认以完成配对。","pairing.cancel":"取消","pairing.connecting":"正在连接你的电脑…","pairing.failed.expired":"配对已过期——请重新开始。","pairing.failed.mintForbidden":"电脑端尚未确认此次配对。","pairing.failed.rejected":"配对被拒绝。","pairing.failed.socket":"配对完成前连接已断开。","pairing.failed.version":"手机与电脑版本不一致。","pairing.handshaking":"校验中…","pairing.paired":"已配对。","pairing.sasPrompt":"请核对此验证码与电脑上显示的一致:","pwa.appShellUpdated":"Web UI 已更新","pwa.reloadToActivate":"刷新以应用","pwa.reloading":"正在刷新…","pwa.runtimeOffline.autoReconnect":"已开启自动重连——后端恢复后会自动刷新。","pwa.runtimeOffline.body":"在终端运行 `hive` 启动后端。","pwa.runtimeOffline.retry":"立即重试","pwa.runtimeOffline.retrying":"重试中…","pwa.runtimeOffline.title":"Hive 后端未启动","pwa.runtimeOffline.tryDemo":"改试用演示","pwa.waitForAgents":"等待 Agent 完成","remote.addDevice":"添加设备","remote.audit.bytes":"{count} 字节","remote.audit.empty":"还没有远程活动。","remote.audit.heading":"远程活动","remote.audit.hide":"隐藏活动","remote.audit.loadFailed":"无法加载活动记录。","remote.audit.result.error":"错误","remote.audit.result.ok":"成功","remote.audit.result.rejected":"已拒绝","remote.audit.show":"查看活动","remote.connect.connecting":"连接中…","remote.connect.disconnected":"已断开","remote.connect.online":"已连接","remote.connect.reconnecting":"重连中…","remote.connect.sessionExpired":"会话已过期 —— 请重新登录。","remote.confirm.confirm":"确认","remote.confirm.confirming":"确认中…","remote.confirm.description":"一台手机正尝试以“{name}”配对。请把这个码和手机上显示的对比 —— 两者必须一致。","remote.confirm.expired":"配对请求已过期。","remote.confirm.failed":"无法完成 —— 请重新配对。","remote.confirm.paired":"已配对“{name}”。","remote.confirm.reject":"拒绝","remote.confirm.rejected":"已拒绝配对。","remote.confirm.sasLabel":"校验码","remote.confirm.title":"确认新设备","remote.confirm.warning":"仅在你发起配对且两个码一致时确认。","remote.devices.activeNow":"刚刚活跃","remote.devices.empty":"还没有已配对的设备。","remote.devices.heading":"已配对设备","remote.devices.lastActive":"{ago}前活跃","remote.devices.loadFailed":"无法加载设备列表。","remote.devices.neverActive":"尚未活跃","remote.devices.revoke":"吊销","remote.devices.revokeAria":"吊销设备 {name}","remote.devices.revokeConfirm":"吊销“{name}”?它的会话会立即断开,需要重新配对。","remote.devices.revokeFailed":"吊销失败 —— 请重试。","remote.devices.revokeTitle":"吊销设备","remote.devices.revoked":"已吊销“{name}”。","remote.diagnostics.copy":"复制诊断信息","remote.diagnostics.copied":"诊断信息已复制","remote.diagnostics.copyFailed":"无法复制诊断信息。","remote.diagnostics.copying":"正在复制...","remote.retention.activeDays":"活跃天数","remote.retention.loadFailed":"无法加载本地留存信号。","remote.retention.localOnly":"仅本地","remote.retention.reports":"汇报","remote.retention.sends":"派单","remote.retention.streak":"当前连续天数","remote.retention.title":"协议活动","remote.disable.confirmBody":"远程设备(包括本设备)将立即断开。只能在桌面端重新开启。","remote.disable.confirmTitle":"关闭远程访问?","remote.enable.description":"通过端到端加密隧道从手机访问这台机器。默认关闭。","remote.enable.label":"远程访问","remote.qr.cancel":"取消","remote.qr.expired":"配对码已过期 —— 请重新生成。","remote.qr.expiresIn":"{seconds} 秒后过期","remote.qr.instructions":"在手机上输入这个配对码。在这里确认前请保持打开。","remote.qr.regenerate":"重新生成","remote.qr.startFailed":"无法开始配对 —— 请重试。","remote.qr.title":"配对码","remote.section":"远程访问","remote.status.connected":"隧道已连接","remote.status.disconnected":"隧道离线","remote.status.linked":"已连接到 {gateway}","remote.status.notLinked":"未连接 —— 在终端运行 `hive remote login`。","remote.status.connecting":"正在连接网关…","remote.status.reconnecting":"正在重连…","remote.status.revoked":"访问已被吊销 —— 重新连接以恢复远程访问。","scenario.applied":"团队已组建,目标已交给 Orchestrator","scenario.apply":"组队并开工","scenario.applying":"组队中…","scenario.build_review_test.desc":"Coder + Reviewer + Tester,实现—审查—验证闭环。","scenario.build_review_test.title":"开发 · 审查 · 测试","scenario.cancel":"取消","scenario.docs_pipeline.desc":"起草成员成文,审稿成员核对事实与表达。","scenario.docs_pipeline.title":"文档流水线","scenario.goalHint":"将以你的名义发给 Orchestrator——由它拆解任务并用 team send 派单。","scenario.goalLabel":"目标","scenario.research_factcheck.desc":"调研员收集带出处的发现,核查员逐条复核。","scenario.research_factcheck.title":"调研与核查","scenario.sectionTitle":"或从场景一键组队","settings.aria":"设置","settings.autostaff.description":"让 Orchestrator 按任务自动配置团队规模,动态补充合适的开发、测试和审查成员。默认开启。","settings.autostaff.label":"自动组队","settings.experimental":"实验性功能","settings.language":"语言","settings.heading":"设置","settings.notifications":"通知","settings.subtitle":"功能开关、Webhook 和远程访问。","settings.saveError":"保存失败 —— 检查 runtime 连接后重试。","settings.tooltip":"设置","settings.webhook.description":"worker 汇报或 workflow 完成时,向此 URL POST 一小段 JSON —— 可接入 Slack、ntfy、飞书等。尽力投递;runtime 会发往你填的任意 URL,请妥善保管。","settings.webhook.label":"完成通知 Webhook","settings.webhook.saved":"已保存","settings.workflows.description":"允许 orchestrator 编写并运行多 agent 工作流(team workflow)。默认关闭。","settings.workflows.label":"工作流","topbar.hideTodo":"隐藏任务","topbar.openWebsite":"访问官网 hivehq.dev","topbar.showTodo":"显示任务 (.hive/tasks.md)","topbar.todo":"任务","topbar.todoOpen":"任务 — {count} 个未完成","topbar.copyUpdateCommand":"复制更新命令","topbar.openRelease":"查看版本","topbar.updateAvailable":"有新版本","topbar.updateCommandCopied":"已复制更新命令","topbar.updateCommandCopyFailed":"复制更新命令失败","topbar.hideMemory":"隐藏记忆","topbar.showMemory":"显示记忆","topbar.memory":"记忆","topbar.hideWorkflows":"隐藏工作流","topbar.showWorkflows":"显示工作流","topbar.workflows":"工作流","memory.title":"记忆","memory.subtitle":"工作区知识积累与 Dream 运行审计","memory.searchPlaceholder":"搜索记忆...","memory.tabActive":"活跃中","memory.tabArchived":"已归档","memory.tabDreams":"Dream 运行记录","memory.runNow":"立即运行","memory.emptyActive":"暂无记忆条目","memory.emptyActiveDesc":"当 Orchestrator 添加记忆或 Dream 提取出知识后,此处会显示记录。","memory.emptyDreams":"暂无 Dream 运行记录","memory.emptyDreamsDesc":"在执行手动或定时的 Dream 优化后,此处将展示运行历史。","memory.archiveTitle":"归档记忆","memory.archiveDesc":"归档后的记忆将不再注入到启动、恢复以及 dispatch 阶段。","memory.archiveButton":"归档","memory.revertTitle":"撤销 Dream 运行","memory.revertDesc":"这将恢复由选定的 Dream 运行所修改的记忆行,并归档其新添加的条目。","memory.revertButton":"撤销","memory.sources":"来源证据","memory.noSources":"暂无来源证据。","memory.updated":"更新于 {time}","memory.injected":"注入于 {time}","memory.started":"启动于 {time}","memory.finished":"结束于 {time}","memory.revertTooltip":"撤销 Dream 运行效果","memory.status.pending":"待处理","memory.status.running":"进行中","memory.status.completed":"已完成","memory.status.failed":"已失败","memory.status.reverted":"已撤销","memory.trigger.manual":"手动触发","memory.trigger.cron":"定时计划","memory.trigger.scheduled":"定时计划","memory.noReport":"无报告","memory.noInput":"无输入","memory.seq":"序列号","memory.reportAdded":"新增","memory.reportRewritten":"已重写","memory.reportArchived":"已归档","memory.reportMerged":"已合并","memory.diff.added":"新增知识","memory.diff.rewritten":"重写知识","memory.diff.archived":"归档知识","memory.diff.merged":"合并知识","memory.pinned":"已置顶","memory.scopeUser":"用户偏好","memory.disabled":"已禁用","memory.unpinTooltip":"取消置顶","memory.pinTooltip":"置顶","memory.enableTooltip":"启用","memory.disableTooltip":"禁用","memory.entries":"条记录","memory.runs":"次运行记录","memory.kind.decision":"决议","memory.kind.fact":"事实","memory.kind.pitfall":"踩坑避雷","memory.kind.preference":"偏好","memory.kind.procedure_ref":"流程步骤","tasks.title":"任务清单","tasks.subtitle":"解析自项目内 .hive/tasks.md 的代办任务图","tasks.editMarkdown":"编辑 Markdown","tasks.save":"保存","tasks.local":"保留本地","tasks.reload":"重新加载","tasks.noTasks":"暂无任务条目","tasks.noTasksDesc":"Orchestrator 会从 tasks.md 中解析出复选框格式的任务项。","workflows.title":"工作流","workflows.subtitle":"多 Agent 工作流、分派任务与运行日志","workflows.description":"Hive 工作流由 Orchestrator 通过 team workflow run --stdin 编写并运行(循环任务会经过 team workflow schedule)。当前 CLI 内建的 subagent/workflow 不会出现在这里;此面板只观察 Hive 阶段、成员、日志和定时计划。","workflows.recentRuns":"最近运行","workflows.filterAll":"全部","workflows.filterRunning":"运行中","workflows.filterFailed":"已失败","workflows.emptyRuns":"暂无运行记录","workflows.emptyRunsDesc":"让 Orchestrator 为需要多个成员并行的任务启动 Hive workflow。","workflows.emptyFilter":"没有与此过滤条件匹配的运行记录。","workflows.schedules":"定时计划","workflows.noAgents":"本次运行没有调用任何 agent()。","workflows.narrator":"叙述器(共 {count} 行)","workflows.narratorOne":"叙述器(共 1 行)","workflows.runError":"运行错误:{error}","workflows.stopTooltip":"停止运行","workflows.deleteScheduleTooltip":"删除定时计划","workflows.pauseTooltip":"暂停","workflows.resumeTooltip":"恢复","workflows.loading":"加载中…","workflows.status.pending":"待处理","workflows.status.running":"运行中","workflows.status.completed":"已完成","workflows.status.failed":"已失败","workflows.status.interrupted":"已中断","workflows.status.stopped":"已停止","workflows.dispatchStatus.queued":"待派发","workflows.dispatchStatus.submitted":"提交中","workflows.dispatchStatus.reported":"已报告","workflows.dispatchStatus.cancelled":"已取消","workflows.dispatchStatus.awaitingReport":"等待报告…","workflows.cli.title":"工作流 Agent 运行环境 (CLI)","workflows.cli.desc":"设置工作流中未指定运行环境的 Agent 默认使用的 CLI,以及允许被工作流调用的 CLI 列表。自定义成员模板使用其自身的 CLI 设定。","workflows.cli.default":"默认运行环境","workflows.cli.allowed":"允许调用的环境","workflows.cli.saving":"保存中…","workflows.cli.save":"保存","workflows.cli.pickOne":"请至少选择一个 CLI","workflows.cli.saved":"保存成功","workflows.cli.failed":"保存失败","welcome.addWorkspace":"添加第一个 Workspace","welcome.demo":"或试用演示(无需安装 CLI)","welcome.desc":"在本地协调 Antigravity CLI、Claude Code、Codex、Gemini、OpenCode、Hermes、Qwen Code、Pi。","welcome.step1Desc":"选择一个项目目录。","welcome.step1Title":"添加 Workspace","welcome.step2Desc":"Antigravity / Claude / Codex / Gemini / OpenCode / Hermes / Qwen / Pi。","welcome.step2Title":"选择 Orchestrator","welcome.step3Desc":"Orchestrator 通过 team send 分派任务。","welcome.step3Title":"分派任务","welcome.title":"欢迎使用 Hive","worker.deleteAria":"删除团队成员 {name}","worker.deleteConfirm":"删除 {name}?","worker.deleteDescription":"这会停止 {name} 的终端,并从 workspace 中移除它。未处理任务会被丢弃。","worker.deleteMember":"删除成员","worker.detail":"{name} 详情","worker.closeOutsideHint":"点击成员窗口外任意区域关闭。","worker.emptyAdd":"添加第一个成员","worker.emptyDesc":"添加团队成员(Antigravity CLI、Claude Code、Codex、Gemini、OpenCode、Hermes、Qwen Code、Pi),Orchestrator 会分派任务。","worker.emptyTitle":"还没有团队成员","worker.actionsAria":"{name} 的操作","worker.avatar":"头像","worker.avatarChange":"更换头像","worker.avatarChangeAria":"更换 {name} 的头像","worker.avatarDefault":"使用默认","worker.avatarLoadFailed":"无法读取这张图片。","worker.avatarNotImage":"请选择 PNG、JPEG 或 WebP 图片。","worker.avatarSourceTooLarge":"请选择 5 MB 以内的图片。","worker.avatarTitle":"更换头像","worker.avatarTooLarge":"头像图片过大。","worker.avatarUpload":"上传图片","worker.avatarHelpText":"支持 PNG、JPEG 或 WebP 图片,5 MB 以内。","worker.avatarUsingDefault":"已应用默认头像","worker.avatarUsingCustom":"已应用自定义头像","worker.lastActivity":"终端最新输出(仅供参考,不是汇报内容)。","worker.open":"打开 {name}","worker.rename":"重命名","worker.renameAria":"重命名 {name}","worker.restartAria":"重启 {name}","worker.renameDesc":"选择新的显示名称。Agent id 和终端不会变化。","worker.renameFailed":"重命名失败:{message}","worker.renameSuccess":'已重命名为 "{name}"。',"worker.renameTitle":"重命名团队成员","worker.startAgent":"启动 Agent 后即可接收派单。","worker.startAria":"启动 {name}","worker.stopAria":"停止 {name}","worker.teamMembers":"团队成员","worker.terminalNotStarted":"终端未启动 — ","worker.terminalStopped":"终端已停止 — ","worker.widthResize":"调整成员详情宽度","worker.workingLegend":"工作中 = 忙碌或等待输入。Hive 不会自动检测卡死 —— 打开终端查看。","workerPane.resize":"调整 Orchestrator 和团队成员面板宽度","tasks.action.addSubtask":"添加子任务","tasks.action.backToList":"返回列表","tasks.action.closeTodo":"关闭任务清单","tasks.action.copied":"已复制","tasks.action.copyLine":"复制行","tasks.action.delete":"删除","tasks.action.edit":"编辑","tasks.action.viewSource":"查看源码","tasks.aria.addSubtask":"添加子任务","tasks.aria.collapseSubtasks":"折叠 {count} 个子任务","tasks.aria.copiedTaskLine":"已复制任务行","tasks.aria.copyTaskLine":"复制任务行","tasks.aria.deleteTask":"删除任务","tasks.aria.drawer":"任务清单","tasks.aria.editTask":"编辑任务","tasks.aria.expandSubtasks":"展开 {count} 个子任务","tasks.aria.progress":"任务完成度","tasks.button.addTask":"添加任务","tasks.completed.toggle":"{count} 个已完成","tasks.empty.description":"让 Orchestrator 拆分任务并用 team send/team spawn 派给成员,或手动加第一条任务来创建 .hive/tasks.md。","tasks.empty.title":"还没有任务","tasks.placeholder.editTask":"编辑任务","tasks.placeholder.newSubtask":"新建子任务","tasks.placeholder.newTask":"下一步要做什么?","tasks.progress.subtaskTitle":"已完成 {done} / {total} 个直接子任务","tasks.raw.conflictDescription":"重新载入会丢弃当前草稿;保留本地会继续编辑当前内容。","tasks.raw.conflictTitle":"文件已在外部变化","tasks.raw.keepLocal":"保留本地","tasks.raw.label":"任务 Markdown","tasks.raw.lineCount":"{count} 行","tasks.raw.reload":"重新载入","tasks.raw.save":"保存任务","tasks.title.todo":"任务","notifications.desktop.aria":"浏览器通知","notifications.desktop.helper":"授权后使用系统通知。","notifications.desktop.label":"浏览器通知","notifications.desktop.unsupported":"此浏览器不支持。","notifications.detail.brief.description":"一行状态摘要","notifications.detail.brief.label":"简略","notifications.detail.detailed.description":"包含 Workspace 和队列信息","notifications.detail.detailed.label":"详细","notifications.detail.sectionLabel":"信息","notifications.settings.aria":"通知设置","notifications.settings.heading":"通知","notifications.settings.subtitle":"选择团队成员汇报或停止时 Hive 的提醒方式。","notifications.settings.tooltip":"通知","notifications.sound.beacon.description":"清晰的提示音","notifications.sound.beacon.label":"信号","notifications.sound.cascade.description":"层次更丰富的完成音","notifications.sound.cascade.label":"瀑布","notifications.sound.chime.description":"干净的玻璃轻点","notifications.sound.chime.label":"玻璃","notifications.sound.longerBadge":"更长","notifications.sound.off.description":"静音","notifications.sound.off.label":"关闭","notifications.sound.ping.description":"很短的界面轻点","notifications.sound.ping.label":"轻点","notifications.sound.previewAria":"试听 {label} 声音","notifications.sound.resolve.description":"更长的完成提示","notifications.sound.resolve.label":"完成","notifications.sound.sectionLabel":"声音","notifications.sound.soft.description":"温和的默认提示","notifications.sound.soft.label":"轻柔","notifications.test.brief":"Hive 通知正常工作。","notifications.test.button":"测试","notifications.test.detail":"Hive 通知按你选择的声音和详情级别正常工作。","notifications.test.title":"Hive 通知测试","notifications.remoteSession.brief":"{name} 已连接","notifications.remoteSession.detail":"{name} 建立了远程会话。","notifications.remoteSession.title":"远程设备已连接","notifications.toast.blocked":"浏览器通知被屏蔽。","notifications.toast.declined":"未启用浏览器通知。","notifications.toast.unsupported":"此浏览器不支持通知。","notifications.workerReported.brief":"{name} 已汇报","notifications.workerReported.detail":"{name} 已在 {workspace} 汇报。","notifications.workerReported.title":"团队成员汇报","notifications.workerStarted.brief":"{name} 已启动","notifications.workerStarted.detail":"{name} 已在 {workspace} 以 {role} 角色启动。","notifications.workerStarted.title":"团队成员已启动","notifications.workerStopped.brief":"{name} 已停止","notifications.workerStopped.detail":"{name} 已在 {workspace} 停止。","notifications.workerStopped.title":"团队成员已停止","workspace.add.manualHint":"输入或粘贴你电脑上某个项目文件夹的绝对路径。","workspace.advanced.browse":"高级:浏览服务器文件系统","workspace.advanced.pastePath":"高级:粘贴路径","workspace.advanced.settings":"高级选项","workspace.advanced.startup":"高级:自定义启动命令","workspace.browse.breadcrumb":"面包屑","workspace.browse.drivesAria":"显示所有磁盘","workspace.browse.drivesRoot":"此电脑","workspace.browse.empty":"此目录为空。","workspace.browse.gitBadge":"git","workspace.browse.openAria":"打开 {name}","workspace.browse.parentAria":"返回上级目录","workspace.browse.root":"根目录:{path}","workspace.browse.rootLoading":"(加载中)","workspace.browse.selected":"已选择","workspace.browse.title":"浏览服务器文件系统","workspace.browse.up":"上级","workspace.confirm.create":"创建 Workspace","workspace.confirm.description":"Hive 会在此加载 .hive/tasks.md 并启动 Orchestrator。","workspace.confirm.title":"添加 Workspace","workspace.error.createFailed":"创建 Workspace 失败","workspace.error.createTitle":"无法创建 Workspace","workspace.error.outsideSandbox":"所选目录不在 Hive 沙盒内,请改用粘贴路径。","workspace.error.pastePathInstead":"改为粘贴路径","workspace.error.pickerFailed":"目录选择失败","workspace.field.absolutePath":"绝对路径","workspace.field.absolutePathPlaceholder":"C:\\path\\to\\project 或 /absolute/path","workspace.field.name":"Workspace 名称","workspace.field.nameDefaultPlaceholder":"my-project","workspace.field.path":"路径","workspace.field.pathEmptyPlaceholder":"(未选择目录 — 请使用下方粘贴路径)","workspace.field.startup":"启动命令","workspace.field.startupPlaceholder":"claude --resume <session-id>","workspace.git.detached":"游离 HEAD","workspace.git.detected":"检测到 git 仓库","workspace.git.none":"此路径下没有 git 仓库。","workspace.git.noneShort":"无 git","workspace.git.short":"git · {branch}","workspace.picking.message":"正在打开系统目录选择器…","workspace.picking.title":"正在打开目录选择器","workspace.preset.label":"Orchestrator CLI","workspace.preset.generic":"通用命令","workspace.preset.genericPreview":"仅使用自定义启动命令","workspace.preset.genericRequiresStartup":"通用命令需要填写启动命令。","workspace.preset.installCopy":"复制","workspace.preset.installCopyAria":"复制安装命令","workspace.preset.installDocs":"安装指南","workspace.preset.installHint":"安装 {name}:","workspace.preset.loadFailed":"加载 CLI 预设失败,使用服务器默认值。","workspace.preset.loading":"正在加载 CLI 预设…","workspace.preset.noneAvailable":"本机未检测到任何支持的 CLI agent。可以先看演示,无需安装。","workspace.preset.notFoundSuffix":"(未找到)","workspace.preset.notInstalled":"{name} 未安装。请选择其他 CLI 或填写启动命令。","workspace.preset.optionsAria":"Orchestrator CLI 选项","workspace.preset.pathHelpBody":"Hive 用启动它的那个 shell 的 PATH 探测 CLI。使用 nvm 或从图形界面启动时,该 PATH 可能与你的终端不同。请退出 Hive,在装有该 CLI 的终端里重新运行 `hive`。","workspace.preset.pathHelpTitle":"装了却显示未找到?","workspace.preset.tryDemo":"先看演示","workspace.yolo.notice":"Agent 默认以自动批准模式运行:CLI 的权限确认会被跳过(如 `--dangerously-skip-permissions`),agent 可以像你本人一样执行命令、修改文件。每张卡片上的 Stop 按钮可随时叫停失控的 agent。","workspace.startup.hint":"覆盖该 Orchestrator 的预设。通过当前 shell(POSIX 上是 bash/zsh/fish,Windows 上是 cmd.exe)在 Workspace 目录中运行,请只粘贴你信任的命令。","workspace.startup.hintShort":"通过当前 shell 在 Workspace 目录中运行。请只粘贴你信任的命令。","demo.orchestratorLabel":"Orchestrator — 预录数据","demo.readOnlyBadge":"演示 只读","layout.sidebarAria":"Workspace 侧栏","layout.sidebarResizeAria":"调整 Workspace 侧栏宽度","layout.sidebarCollapse":"收起侧栏","layout.sidebarExpand":"展开侧栏","terminal.composer.placeholder":"输入命令…","terminal.composer.send":"发送","terminal.composer.sendEnter":"发送 ⏎","terminal.paste.button":"粘贴","terminal.paste.cancel":"取消","terminal.paste.confirm":"粘贴","terminal.paste.denied":"剪贴板访问被拒绝——请长按输入框粘贴。","terminal.paste.lengthChars":"共 {count} 个字符","terminal.paste.preview":"预览","terminal.paste.title":"粘贴到终端?","terminal.renderer.canvasFallbackNotice":"WebGL 不可用——已改用 canvas 渲染器。","terminal.firstRunSetup":"请先在终端完成该 CLI 的首次设置,随后 Hive 会发送启动指令。","terminal.scrollToBottom":"回到底部","terminal.statusConnecting":"连接中","terminal.statusRunning":"运行中","terminalPanel.closePanel":"关闭终端面板","terminalPanel.closeTab":"关闭 {name}","terminalPanel.maximize":"最大化终端面板","terminalPanel.newShell":"新建 shell","terminalPanel.resizeAria":"调整终端面板高度","terminalPanel.restore":"还原终端面板","terminalPanel.tablistAria":"Workspace 终端标签","terminalPanel.workerStopped":"{name} 已停止——启动该成员后会自动连接终端。","terminalPanels.aria":"终端面板","toast.dismissAria":"关闭","whatsNew.gotIt":"知道了","whatsNew.subtitle":"上次使用以来的更新","whatsNew.title":"更新内容","whatsNew.versionLabel":"版本 {version}","workspaceList.empty":"还没有 Workspace"},lC={en:b0,zh:iC},cC=()=>{if(typeof window>"u")return"en";const t=uC();return t||(window.navigator.language.toLowerCase().startsWith("zh")?"zh":"en")},uC=()=>{try{const t=window.localStorage.getItem(y0);return sC(t)?t:null}catch{return null}},dC=t=>{try{window.localStorage.setItem(y0,t)}catch{}},w0=t=>(a,o={})=>(lC[t][a]??b0[a]??a).replace(/\{(\w+)\}/g,(l,u)=>{const f=o[u];return f===void 0?l:String(f)}),fC={language:"en",setLanguage:()=>{},t:w0("en")},x0=y.createContext(fC),mC=({children:t})=>{const[a,o]=y.useState(cC),s=y.useMemo(()=>({language:a,setLanguage:u=>{o(u),dC(u)},t:w0(a)}),[a]);return c.jsx(x0.Provider,{value:s,children:t})},be=()=>y.useContext(x0),pC=({onExit:t})=>{const{t:a}=be();return c.jsxs("section",{"aria-label":"Demo mode","data-testid":"demo-banner",className:"flex shrink-0 items-center justify-between border-b px-4 py-2 text-xs",style:{background:"var(--status-yellow-bg, #3a2c1c)",borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex items-center gap-2 text-pri",children:[c.jsx(p0,{size:14,"aria-hidden":!0}),c.jsx("span",{children:a("demo.banner")})]}),c.jsx("button",{type:"button",onClick:t,className:"icon-btn icon-btn--ghost",children:a("demo.exit")})]})},Rl=[{label:"Plan",terminal:["$ hive demo","Orchestrator: turning the request into .hive/tasks.md","$ team spawn coder --name ada-lovelace","$ team spawn reviewer --name socrates"],doneTasks:1,workerStates:["idle","idle"]},{label:"Dispatch",terminal:['$ team send ada-lovelace "Implement POST /todos with SQLite persistence"',"Hive: dispatch queued and delivered to ada-lovelace","ada-lovelace: editing src/routes/todos.ts"],doneTasks:2,workerStates:["working","idle"]},{label:"Report",terminal:['ada-lovelace: team report "POST /todos implemented; tests added"',"Orchestrator: marking implementation done, sending review",'$ team send socrates "Review todo endpoint and tests"'],doneTasks:3,workerStates:["idle","working"]},{label:"Close",terminal:['socrates: team report "No blocker; one naming nit fixed"',"Orchestrator: validation complete","tasks.md: all demo tasks checked"],doneTasks:5,workerStates:["idle","idle"]}],cf=["Create the Todo API route","Persist todos in SQLite","Add Vitest coverage","Review route behavior","Mark .hive/tasks.md complete"],hC=[{name:"ada-lovelace",role:"Coder"},{name:"socrates",role:"Reviewer"}],gC=({onExit:t})=>{const{t:a}=be(),[o,s]=y.useState(0);y.useEffect(()=>{const f=window.setInterval(()=>{s(m=>(m+1)%Rl.length)},1800);return()=>window.clearInterval(f)},[]);const l=Rl[o]??Rl[0],u=y.useMemo(()=>Rl.slice(0,o+1).flatMap(f=>f.terminal),[o]);return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[c.jsx(pC,{onExit:t}),c.jsx("div",{className:"scroll-y min-h-0 flex-1 px-4 py-4",style:{background:"var(--bg-2)"},children:c.jsxs("section",{className:"mx-auto grid h-full min-h-[520px] w-full max-w-6xl gap-3 lg:grid-cols-[minmax(0,1.35fr)_minmax(320px,0.65fr)]","data-testid":"demo-replay-panel",children:[c.jsxs("div",{className:"flex min-h-0 flex-col rounded-md border bg-0",children:[c.jsxs("header",{className:"flex items-center justify-between border-b px-3 py-2",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(kc,{size:15,className:"text-accent"}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("h1",{className:"truncate text-sm font-semibold text-pri",children:a("demo.replayTitle")}),c.jsx("p",{className:"text-xs text-ter",children:a("demo.replaySubtitle")})]})]}),c.jsx("span",{className:"rounded border px-2 py-1 text-[11px] text-sec",children:l.label})]}),c.jsx("pre",{className:"mono min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-4 text-xs leading-6 text-sec","data-testid":"demo-replay-terminal",children:u.join(`
11
- `)})]}),c.jsxs("aside",{className:"flex min-h-0 flex-col gap-3",children:[c.jsxs("div",{className:"rounded-md border bg-0 p-3","data-testid":"demo-task-graph",children:[c.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[c.jsx("h2",{className:"text-sm font-semibold text-pri",children:a("demo.tasksTitle")}),c.jsxs("span",{className:"text-xs text-ter",children:[Math.min(l.doneTasks,cf.length),"/",cf.length]})]}),c.jsx("ul",{className:"space-y-2",children:cf.map((f,m)=>{const g=m<l.doneTasks;return c.jsxs("li",{className:"flex items-start gap-2 text-sm","data-testid":`demo-task-${m}`,"data-done":g||void 0,children:[g?c.jsx(s0,{size:16,className:"mt-0.5 shrink-0 text-status-green"}):c.jsx(VS,{size:16,className:"mt-0.5 shrink-0 text-ter"}),c.jsx("span",{className:g?"text-pri":"text-sec",children:f})]},f)})})]}),c.jsxs("div",{className:"rounded-md border bg-0 p-3","data-testid":"demo-team",children:[c.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[c.jsx(Ec,{size:15,className:"text-accent"}),c.jsx("h2",{className:"text-sm font-semibold text-pri",children:a("demo.teamTitle")})]}),c.jsx("div",{className:"grid gap-2",children:hC.map((f,m)=>{const g=l.workerStates[m]??"idle";return c.jsxs("div",{className:"rounded border px-3 py-2","data-testid":`demo-worker-${f.name}`,style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-sm font-medium text-pri",children:f.name}),c.jsx("span",{className:"rounded px-1.5 py-0.5 text-[11px] text-sec bg-2",children:g})]}),c.jsx("p",{className:"mt-1 text-xs text-ter",children:f.role})]},f.name)})})]})]})]})})]})};function Kt(t,a,{checkForDefaultPrevented:o=!0}={}){return function(l){if(t?.(l),o===!1||!l.defaultPrevented)return a?.(l)}}function xy(t,a){if(typeof t=="function")return t(a);t!=null&&(t.current=a)}function k0(...t){return a=>{let o=!1;const s=t.map(l=>{const u=xy(l,a);return!o&&typeof u=="function"&&(o=!0),u});if(o)return()=>{for(let l=0;l<s.length;l++){const u=s[l];typeof u=="function"?u():xy(t[l],null)}}}}function _n(...t){return y.useCallback(k0(...t),t)}function vC(t,a){const o=y.createContext(a),s=u=>{const{children:f,...m}=u,g=y.useMemo(()=>m,Object.values(m));return c.jsx(o.Provider,{value:g,children:f})};s.displayName=t+"Provider";function l(u){const f=y.useContext(o);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${t}\``)}return[s,l]}function Om(t,a=[]){let o=[];function s(u,f){const m=y.createContext(f),g=o.length;o=[...o,f];const p=v=>{const{scope:k,children:E,...S}=v,w=k?.[t]?.[g]||m,C=y.useMemo(()=>S,Object.values(S));return c.jsx(w.Provider,{value:C,children:E})};p.displayName=u+"Provider";function b(v,k){const E=k?.[t]?.[g]||m,S=y.useContext(E);if(S)return S;if(f!==void 0)return f;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[p,b]}const l=()=>{const u=o.map(f=>y.createContext(f));return function(m){const g=m?.[t]||u;return y.useMemo(()=>({[`__scope${t}`]:{...m,[t]:g}}),[m,g])}};return l.scopeName=t,[s,yC(l,...a)]}function yC(...t){const a=t[0];if(t.length===1)return a;const o=()=>{const s=t.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(u){const f=s.reduce((m,{useScope:g,scopeName:p})=>{const v=g(u)[`__scope${p}`];return{...m,...v}},{});return y.useMemo(()=>({[`__scope${a.scopeName}`]:f}),[f])}};return o.scopeName=a.scopeName,o}var er=globalThis?.document?y.useLayoutEffect:()=>{},bC=a0[" useId ".trim().toString()]||(()=>{}),wC=0;function Pl(t){const[a,o]=y.useState(bC());return er(()=>{o(s=>s??String(wC++))},[t]),t||(a?`radix-${a}`:"")}var xC=a0[" useInsertionEffect ".trim().toString()]||er;function S0({prop:t,defaultProp:a,onChange:o=()=>{},caller:s}){const[l,u,f]=kC({defaultProp:a,onChange:o}),m=t!==void 0,g=m?t:l;{const b=y.useRef(t!==void 0);y.useEffect(()=>{const v=b.current;v!==m&&console.warn(`${s} is changing from ${v?"controlled":"uncontrolled"} to ${m?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),b.current=m},[m,s])}const p=y.useCallback(b=>{if(m){const v=SC(b)?b(t):b;v!==t&&f.current?.(v)}else u(b)},[m,t,u,f]);return[g,p]}function kC({defaultProp:t,onChange:a}){const[o,s]=y.useState(t),l=y.useRef(o),u=y.useRef(a);return xC(()=>{u.current=a},[a]),y.useEffect(()=>{l.current!==o&&(u.current?.(o),l.current=o)},[o,l]),[o,s,u]}function SC(t){return typeof t=="function"}var Cc=r0();const EC=n0(Cc);function E0(t){const a=CC(t),o=y.forwardRef((s,l)=>{const{children:u,...f}=s,m=y.Children.toArray(u),g=m.find(NC);if(g){const p=g.props.children,b=m.map(v=>v===g?y.Children.count(p)>1?y.Children.only(null):y.isValidElement(p)?p.props.children:null:v);return c.jsx(a,{...f,ref:l,children:y.isValidElement(p)?y.cloneElement(p,void 0,b):null})}return c.jsx(a,{...f,ref:l,children:u})});return o.displayName=`${t}.Slot`,o}function CC(t){const a=y.forwardRef((o,s)=>{const{children:l,...u}=o;if(y.isValidElement(l)){const f=AC(l),m=jC(u,l.props);return l.type!==y.Fragment&&(m.ref=s?k0(s,f):f),y.cloneElement(l,m)}return y.Children.count(l)>1?y.Children.only(null):null});return a.displayName=`${t}.SlotClone`,a}var C0=Symbol("radix.slottable");function TC(t){const a=({children:o})=>c.jsx(c.Fragment,{children:o});return a.displayName=`${t}.Slottable`,a.__radixId=C0,a}function NC(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===C0}function jC(t,a){const o={...a};for(const s in a){const l=t[s],u=a[s];/^on[A-Z]/.test(s)?l&&u?o[s]=(...m)=>{const g=u(...m);return l(...m),g}:l&&(o[s]=l):s==="style"?o[s]={...l,...u}:s==="className"&&(o[s]=[l,u].filter(Boolean).join(" "))}return{...t,...o}}function AC(t){let a=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning;return o?t.ref:(a=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var _C=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vt=_C.reduce((t,a)=>{const o=E0(`Primitive.${a}`),s=y.forwardRef((l,u)=>{const{asChild:f,...m}=l,g=f?o:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(g,{...m,ref:u})});return s.displayName=`Primitive.${a}`,{...t,[a]:s}},{});function RC(t,a){t&&Cc.flushSync(()=>t.dispatchEvent(a))}function zo(t){const a=y.useRef(t);return y.useEffect(()=>{a.current=t}),y.useMemo(()=>(...o)=>a.current?.(...o),[])}function OC(t,a=globalThis?.document){const o=zo(t);y.useEffect(()=>{const s=l=>{l.key==="Escape"&&o(l)};return a.addEventListener("keydown",s,{capture:!0}),()=>a.removeEventListener("keydown",s,{capture:!0})},[o,a])}var DC="DismissableLayer",Zf="dismissableLayer.update",MC="dismissableLayer.pointerDownOutside",LC="dismissableLayer.focusOutside",ky,T0=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Dm=y.forwardRef((t,a)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,onDismiss:m,...g}=t,p=y.useContext(T0),[b,v]=y.useState(null),k=b?.ownerDocument??globalThis?.document,[,E]=y.useState({}),S=_n(a,L=>v(L)),w=Array.from(p.layers),[C]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),T=w.indexOf(C),N=b?w.indexOf(b):-1,j=p.layersWithOutsidePointerEventsDisabled.size>0,A=N>=T,O=UC(L=>{const P=L.target,J=[...p.branches].some(Q=>Q.contains(P));!A||J||(l?.(L),f?.(L),L.defaultPrevented||m?.())},k),D=BC(L=>{const P=L.target;[...p.branches].some(Q=>Q.contains(P))||(u?.(L),f?.(L),L.defaultPrevented||m?.())},k);return OC(L=>{N===p.layers.size-1&&(s?.(L),!L.defaultPrevented&&m&&(L.preventDefault(),m()))},k),y.useEffect(()=>{if(b)return o&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(ky=k.body.style.pointerEvents,k.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(b)),p.layers.add(b),Sy(),()=>{o&&p.layersWithOutsidePointerEventsDisabled.size===1&&(k.body.style.pointerEvents=ky)}},[b,k,o,p]),y.useEffect(()=>()=>{b&&(p.layers.delete(b),p.layersWithOutsidePointerEventsDisabled.delete(b),Sy())},[b,p]),y.useEffect(()=>{const L=()=>E({});return document.addEventListener(Zf,L),()=>document.removeEventListener(Zf,L)},[]),c.jsx(Vt.div,{...g,ref:S,style:{pointerEvents:j?A?"auto":"none":void 0,...t.style},onFocusCapture:Kt(t.onFocusCapture,D.onFocusCapture),onBlurCapture:Kt(t.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Kt(t.onPointerDownCapture,O.onPointerDownCapture)})});Dm.displayName=DC;var zC="DismissableLayerBranch",HC=y.forwardRef((t,a)=>{const o=y.useContext(T0),s=y.useRef(null),l=_n(a,s);return y.useEffect(()=>{const u=s.current;if(u)return o.branches.add(u),()=>{o.branches.delete(u)}},[o.branches]),c.jsx(Vt.div,{...t,ref:l})});HC.displayName=zC;function UC(t,a=globalThis?.document){const o=zo(t),s=y.useRef(!1),l=y.useRef(()=>{});return y.useEffect(()=>{const u=m=>{if(m.target&&!s.current){let g=function(){N0(MC,o,p,{discrete:!0})};const p={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",l.current),l.current=g,a.addEventListener("click",l.current,{once:!0})):g()}else a.removeEventListener("click",l.current);s.current=!1},f=window.setTimeout(()=>{a.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(f),a.removeEventListener("pointerdown",u),a.removeEventListener("click",l.current)}},[a,o]),{onPointerDownCapture:()=>s.current=!0}}function BC(t,a=globalThis?.document){const o=zo(t),s=y.useRef(!1);return y.useEffect(()=>{const l=u=>{u.target&&!s.current&&N0(LC,o,{originalEvent:u},{discrete:!1})};return a.addEventListener("focusin",l),()=>a.removeEventListener("focusin",l)},[a,o]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Sy(){const t=new CustomEvent(Zf);document.dispatchEvent(t)}function N0(t,a,o,{discrete:s}){const l=o.originalEvent.target,u=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:o});a&&l.addEventListener(t,a,{once:!0}),s?RC(l,u):l.dispatchEvent(u)}var uf="focusScope.autoFocusOnMount",df="focusScope.autoFocusOnUnmount",Ey={bubbles:!1,cancelable:!0},WC="FocusScope",j0=y.forwardRef((t,a)=>{const{loop:o=!1,trapped:s=!1,onMountAutoFocus:l,onUnmountAutoFocus:u,...f}=t,[m,g]=y.useState(null),p=zo(l),b=zo(u),v=y.useRef(null),k=_n(a,w=>g(w)),E=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(s){let w=function(j){if(E.paused||!m)return;const A=j.target;m.contains(A)?v.current=A:$a(v.current,{select:!0})},C=function(j){if(E.paused||!m)return;const A=j.relatedTarget;A!==null&&(m.contains(A)||$a(v.current,{select:!0}))},T=function(j){if(document.activeElement===document.body)for(const O of j)O.removedNodes.length>0&&$a(m)};document.addEventListener("focusin",w),document.addEventListener("focusout",C);const N=new MutationObserver(T);return m&&N.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",C),N.disconnect()}}},[s,m,E.paused]),y.useEffect(()=>{if(m){Ty.add(E);const w=document.activeElement;if(!m.contains(w)){const T=new CustomEvent(uf,Ey);m.addEventListener(uf,p),m.dispatchEvent(T),T.defaultPrevented||(IC(YC(A0(m)),{select:!0}),document.activeElement===w&&$a(m))}return()=>{m.removeEventListener(uf,p),setTimeout(()=>{const T=new CustomEvent(df,Ey);m.addEventListener(df,b),m.dispatchEvent(T),T.defaultPrevented||$a(w??document.body,{select:!0}),m.removeEventListener(df,b),Ty.remove(E)},0)}}},[m,p,b,E]);const S=y.useCallback(w=>{if(!o&&!s||E.paused)return;const C=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,T=document.activeElement;if(C&&T){const N=w.currentTarget,[j,A]=qC(N);j&&A?!w.shiftKey&&T===A?(w.preventDefault(),o&&$a(j,{select:!0})):w.shiftKey&&T===j&&(w.preventDefault(),o&&$a(A,{select:!0})):T===N&&w.preventDefault()}},[o,s,E.paused]);return c.jsx(Vt.div,{tabIndex:-1,...f,ref:k,onKeyDown:S})});j0.displayName=WC;function IC(t,{select:a=!1}={}){const o=document.activeElement;for(const s of t)if($a(s,{select:a}),document.activeElement!==o)return}function qC(t){const a=A0(t),o=Cy(a,t),s=Cy(a.reverse(),t);return[o,s]}function A0(t){const a=[],o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const l=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||l?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)a.push(o.currentNode);return a}function Cy(t,a){for(const o of t)if(!PC(o,{upTo:a}))return o}function PC(t,{upTo:a}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(a!==void 0&&t===a)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function FC(t){return t instanceof HTMLInputElement&&"select"in t}function $a(t,{select:a=!1}={}){if(t&&t.focus){const o=document.activeElement;t.focus({preventScroll:!0}),t!==o&&FC(t)&&a&&t.select()}}var Ty=KC();function KC(){let t=[];return{add(a){const o=t[0];a!==o&&o?.pause(),t=Ny(t,a),t.unshift(a)},remove(a){t=Ny(t,a),t[0]?.resume()}}}function Ny(t,a){const o=[...t],s=o.indexOf(a);return s!==-1&&o.splice(s,1),o}function YC(t){return t.filter(a=>a.tagName!=="A")}var $C="Portal",Mm=y.forwardRef((t,a)=>{const{container:o,...s}=t,[l,u]=y.useState(!1);er(()=>u(!0),[]);const f=o||l&&globalThis?.document?.body;return f?EC.createPortal(c.jsx(Vt.div,{...s,ref:a}),f):null});Mm.displayName=$C;function VC(t,a){return y.useReducer((o,s)=>a[o][s]??o,t)}var Fo=t=>{const{present:a,children:o}=t,s=GC(a),l=typeof o=="function"?o({present:s.isPresent}):y.Children.only(o),u=_n(s.ref,XC(l));return typeof o=="function"||s.isPresent?y.cloneElement(l,{ref:u}):null};Fo.displayName="Presence";function GC(t){const[a,o]=y.useState(),s=y.useRef(null),l=y.useRef(t),u=y.useRef("none"),f=t?"mounted":"unmounted",[m,g]=VC(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const p=Ol(s.current);u.current=m==="mounted"?p:"none"},[m]),er(()=>{const p=s.current,b=l.current;if(b!==t){const k=u.current,E=Ol(p);t?g("MOUNT"):E==="none"||p?.display==="none"?g("UNMOUNT"):g(b&&k!==E?"ANIMATION_OUT":"UNMOUNT"),l.current=t}},[t,g]),er(()=>{if(a){let p;const b=a.ownerDocument.defaultView??window,v=E=>{const w=Ol(s.current).includes(CSS.escape(E.animationName));if(E.target===a&&w&&(g("ANIMATION_END"),!l.current)){const C=a.style.animationFillMode;a.style.animationFillMode="forwards",p=b.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=C)})}},k=E=>{E.target===a&&(u.current=Ol(s.current))};return a.addEventListener("animationstart",k),a.addEventListener("animationcancel",v),a.addEventListener("animationend",v),()=>{b.clearTimeout(p),a.removeEventListener("animationstart",k),a.removeEventListener("animationcancel",v),a.removeEventListener("animationend",v)}}else g("ANIMATION_END")},[a,g]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:y.useCallback(p=>{s.current=p?getComputedStyle(p):null,o(p)},[])}}function Ol(t){return t?.animationName||"none"}function XC(t){let a=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning;return o?t.ref:(a=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var ff=0;function ZC(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??jy()),document.body.insertAdjacentElement("beforeend",t[1]??jy()),ff++,()=>{ff===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),ff--}},[])}function jy(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Un=function(){return Un=Object.assign||function(a){for(var o,s=1,l=arguments.length;s<l;s++){o=arguments[s];for(var u in o)Object.prototype.hasOwnProperty.call(o,u)&&(a[u]=o[u])}return a},Un.apply(this,arguments)};function _0(t,a){var o={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&a.indexOf(s)<0&&(o[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,s=Object.getOwnPropertySymbols(t);l<s.length;l++)a.indexOf(s[l])<0&&Object.prototype.propertyIsEnumerable.call(t,s[l])&&(o[s[l]]=t[s[l]]);return o}function QC(t,a,o){if(o||arguments.length===2)for(var s=0,l=a.length,u;s<l;s++)(u||!(s in a))&&(u||(u=Array.prototype.slice.call(a,0,s)),u[s]=a[s]);return t.concat(u||Array.prototype.slice.call(a))}var Fl="right-scroll-bar-position",Kl="width-before-scroll-bar",JC="with-scroll-bars-hidden",eT="--removed-body-scroll-bar-size";function mf(t,a){return typeof t=="function"?t(a):t&&(t.current=a),t}function tT(t,a){var o=y.useState(function(){return{value:t,callback:a,facade:{get current(){return o.value},set current(s){var l=o.value;l!==s&&(o.value=s,o.callback(s,l))}}}})[0];return o.callback=a,o.facade}var nT=typeof window<"u"?y.useLayoutEffect:y.useEffect,Ay=new WeakMap;function aT(t,a){var o=tT(null,function(s){return t.forEach(function(l){return mf(l,s)})});return nT(function(){var s=Ay.get(o);if(s){var l=new Set(s),u=new Set(t),f=o.current;l.forEach(function(m){u.has(m)||mf(m,null)}),u.forEach(function(m){l.has(m)||mf(m,f)})}Ay.set(o,t)},[t]),o}function rT(t){return t}function oT(t,a){a===void 0&&(a=rT);var o=[],s=!1,l={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return o.length?o[o.length-1]:t},useMedium:function(u){var f=a(u,s);return o.push(f),function(){o=o.filter(function(m){return m!==f})}},assignSyncMedium:function(u){for(s=!0;o.length;){var f=o;o=[],f.forEach(u)}o={push:function(m){return u(m)},filter:function(){return o}}},assignMedium:function(u){s=!0;var f=[];if(o.length){var m=o;o=[],m.forEach(u),f=o}var g=function(){var b=f;f=[],b.forEach(u)},p=function(){return Promise.resolve().then(g)};p(),o={push:function(b){f.push(b),p()},filter:function(b){return f=f.filter(b),o}}}};return l}function sT(t){t===void 0&&(t={});var a=oT(null);return a.options=Un({async:!0,ssr:!1},t),a}var R0=function(t){var a=t.sideCar,o=_0(t,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=a.read();if(!s)throw new Error("Sidecar medium not found");return y.createElement(s,Un({},o))};R0.isSideCarExport=!0;function iT(t,a){return t.useMedium(a),R0}var O0=sT(),pf=function(){},Tc=y.forwardRef(function(t,a){var o=y.useRef(null),s=y.useState({onScrollCapture:pf,onWheelCapture:pf,onTouchMoveCapture:pf}),l=s[0],u=s[1],f=t.forwardProps,m=t.children,g=t.className,p=t.removeScrollBar,b=t.enabled,v=t.shards,k=t.sideCar,E=t.noRelative,S=t.noIsolation,w=t.inert,C=t.allowPinchZoom,T=t.as,N=T===void 0?"div":T,j=t.gapMode,A=_0(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=k,D=aT([o,a]),L=Un(Un({},A),l);return y.createElement(y.Fragment,null,b&&y.createElement(O,{sideCar:O0,removeScrollBar:p,shards:v,noRelative:E,noIsolation:S,inert:w,setCallbacks:u,allowPinchZoom:!!C,lockRef:o,gapMode:j}),f?y.cloneElement(y.Children.only(m),Un(Un({},L),{ref:D})):y.createElement(N,Un({},L,{className:g,ref:D}),m))});Tc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Tc.classNames={fullWidth:Kl,zeroRight:Fl};var lT=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cT(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var a=lT();return a&&t.setAttribute("nonce",a),t}function uT(t,a){t.styleSheet?t.styleSheet.cssText=a:t.appendChild(document.createTextNode(a))}function dT(t){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(t)}var fT=function(){var t=0,a=null;return{add:function(o){t==0&&(a=cT())&&(uT(a,o),dT(a)),t++},remove:function(){t--,!t&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},mT=function(){var t=fT();return function(a,o){y.useEffect(function(){return t.add(a),function(){t.remove()}},[a&&o])}},D0=function(){var t=mT(),a=function(o){var s=o.styles,l=o.dynamic;return t(s,l),null};return a},pT={left:0,top:0,right:0,gap:0},hf=function(t){return parseInt(t||"",10)||0},hT=function(t){var a=window.getComputedStyle(document.body),o=a[t==="padding"?"paddingLeft":"marginLeft"],s=a[t==="padding"?"paddingTop":"marginTop"],l=a[t==="padding"?"paddingRight":"marginRight"];return[hf(o),hf(s),hf(l)]},gT=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return pT;var a=hT(t),o=document.documentElement.clientWidth,s=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,s-o+a[2]-a[0])}},vT=D0(),Oo="data-scroll-locked",yT=function(t,a,o,s){var l=t.left,u=t.top,f=t.right,m=t.gap;return o===void 0&&(o="margin"),`
12
- .`.concat(JC,` {
10
+ `).replace(x2,"")}function jv(e,n){return n=Nv(n),Nv(e)===n}function Ye(e,n,r,i,d,h){switch(r){case"children":typeof i=="string"?n==="body"||n==="textarea"&&i===""||Kr(e,i):(typeof i=="number"||typeof i=="bigint")&&n!=="body"&&Kr(e,""+i);break;case"className":wi(e,"class",i);break;case"tabIndex":wi(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":wi(e,r,i);break;case"style":jp(e,i,h);break;case"data":if(n!=="object"){wi(e,"data",i);break}case"src":case"href":if(i===""&&(n!=="a"||r!=="href")){e.removeAttribute(r);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=ki(""+i),e.setAttribute(r,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(r==="formAction"?(n!=="input"&&Ye(e,n,"name",d.name,d,null),Ye(e,n,"formEncType",d.formEncType,d,null),Ye(e,n,"formMethod",d.formMethod,d,null),Ye(e,n,"formTarget",d.formTarget,d,null)):(Ye(e,n,"encType",d.encType,d,null),Ye(e,n,"method",d.method,d,null),Ye(e,n,"target",d.target,d,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=ki(""+i),e.setAttribute(r,i);break;case"onClick":i!=null&&(e.onclick=$n);break;case"onScroll":i!=null&&Le("scroll",e);break;case"onScrollEnd":i!=null&&Le("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(r=i.__html,r!=null){if(d.children!=null)throw Error(s(60));e.innerHTML=r}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}r=ki(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""+i):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":i===!0?e.setAttribute(r,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,i):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(r,i):e.removeAttribute(r);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(r):e.setAttribute(r,i);break;case"popover":Le("beforetoggle",e),Le("toggle",e),bi(e,"popover",i);break;case"xlinkActuate":Yn(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Yn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Yn(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Yn(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Yn(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Yn(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":bi(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=G1.get(r)||r,bi(e,r,i))}}function Ld(e,n,r,i,d,h){switch(r){case"style":jp(e,i,h);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(r=i.__html,r!=null){if(d.children!=null)throw Error(s(60));e.innerHTML=r}}break;case"children":typeof i=="string"?Kr(e,i):(typeof i=="number"||typeof i=="bigint")&&Kr(e,""+i);break;case"onScroll":i!=null&&Le("scroll",e);break;case"onScrollEnd":i!=null&&Le("scrollend",e);break;case"onClick":i!=null&&(e.onclick=$n);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!bp.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(d=r.endsWith("Capture"),n=r.slice(2,d?r.length-7:void 0),h=e[Ht]||null,h=h!=null?h[r]:null,typeof h=="function"&&e.removeEventListener(n,h,d),typeof i=="function")){typeof h!="function"&&h!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(n,i,d);break e}r in e?e[r]=i:i===!0?e.setAttribute(r,""):bi(e,r,i)}}}function Et(e,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Le("error",e),Le("load",e);var i=!1,d=!1,h;for(h in r)if(r.hasOwnProperty(h)){var x=r[h];if(x!=null)switch(h){case"src":i=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Ye(e,n,h,x,r,null)}}d&&Ye(e,n,"srcSet",r.srcSet,r,null),i&&Ye(e,n,"src",r.src,r,null);return;case"input":Le("invalid",e);var _=h=x=d=null,z=null,Y=null;for(i in r)if(r.hasOwnProperty(i)){var te=r[i];if(te!=null)switch(i){case"name":d=te;break;case"type":x=te;break;case"checked":z=te;break;case"defaultChecked":Y=te;break;case"value":h=te;break;case"defaultValue":_=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(s(137,n));break;default:Ye(e,n,i,te,r,null)}}Ep(e,h,_,z,Y,x,d,!1);return;case"select":Le("invalid",e),i=x=h=null;for(d in r)if(r.hasOwnProperty(d)&&(_=r[d],_!=null))switch(d){case"value":h=_;break;case"defaultValue":x=_;break;case"multiple":i=_;default:Ye(e,n,d,_,r,null)}n=h,r=x,e.multiple=!!i,n!=null?Fr(e,!!i,n,!1):r!=null&&Fr(e,!!i,r,!0);return;case"textarea":Le("invalid",e),h=d=i=null;for(x in r)if(r.hasOwnProperty(x)&&(_=r[x],_!=null))switch(x){case"value":i=_;break;case"defaultValue":d=_;break;case"children":h=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:Ye(e,n,x,_,r,null)}Tp(e,i,d,h);return;case"option":for(z in r)r.hasOwnProperty(z)&&(i=r[z],i!=null)&&(z==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":Ye(e,n,z,i,r,null));return;case"dialog":Le("beforetoggle",e),Le("toggle",e),Le("cancel",e),Le("close",e);break;case"iframe":case"object":Le("load",e);break;case"video":case"audio":for(i=0;i<_s.length;i++)Le(_s[i],e);break;case"image":Le("error",e),Le("load",e);break;case"details":Le("toggle",e);break;case"embed":case"source":case"link":Le("error",e),Le("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in r)if(r.hasOwnProperty(Y)&&(i=r[Y],i!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Ye(e,n,Y,i,r,null)}return;default:if(Gc(n)){for(te in r)r.hasOwnProperty(te)&&(i=r[te],i!==void 0&&Ld(e,n,te,i,r,void 0));return}}for(_ in r)r.hasOwnProperty(_)&&(i=r[_],i!=null&&Ye(e,n,_,i,r,null))}function k2(e,n,r,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,h=null,x=null,_=null,z=null,Y=null,te=null;for(ee in r){var oe=r[ee];if(r.hasOwnProperty(ee)&&oe!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":z=oe;default:i.hasOwnProperty(ee)||Ye(e,n,ee,null,i,oe)}}for(var X in i){var ee=i[X];if(oe=r[X],i.hasOwnProperty(X)&&(ee!=null||oe!=null))switch(X){case"type":h=ee;break;case"name":d=ee;break;case"checked":Y=ee;break;case"defaultChecked":te=ee;break;case"value":x=ee;break;case"defaultValue":_=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(s(137,n));break;default:ee!==oe&&Ye(e,n,X,ee,i,oe)}}$c(e,x,_,z,Y,te,h,d);return;case"select":ee=x=_=X=null;for(h in r)if(z=r[h],r.hasOwnProperty(h)&&z!=null)switch(h){case"value":break;case"multiple":ee=z;default:i.hasOwnProperty(h)||Ye(e,n,h,null,i,z)}for(d in i)if(h=i[d],z=r[d],i.hasOwnProperty(d)&&(h!=null||z!=null))switch(d){case"value":X=h;break;case"defaultValue":_=h;break;case"multiple":x=h;default:h!==z&&Ye(e,n,d,h,i,z)}n=_,r=x,i=ee,X!=null?Fr(e,!!r,X,!1):!!i!=!!r&&(n!=null?Fr(e,!!r,n,!0):Fr(e,!!r,r?[]:"",!1));return;case"textarea":ee=X=null;for(_ in r)if(d=r[_],r.hasOwnProperty(_)&&d!=null&&!i.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:Ye(e,n,_,null,i,d)}for(x in i)if(d=i[x],h=r[x],i.hasOwnProperty(x)&&(d!=null||h!=null))switch(x){case"value":X=d;break;case"defaultValue":ee=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(s(91));break;default:d!==h&&Ye(e,n,x,d,i,h)}Cp(e,X,ee);return;case"option":for(var me in r)X=r[me],r.hasOwnProperty(me)&&X!=null&&!i.hasOwnProperty(me)&&(me==="selected"?e.selected=!1:Ye(e,n,me,null,i,X));for(z in i)X=i[z],ee=r[z],i.hasOwnProperty(z)&&X!==ee&&(X!=null||ee!=null)&&(z==="selected"?e.selected=X&&typeof X!="function"&&typeof X!="symbol":Ye(e,n,z,X,i,ee));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in r)X=r[Ee],r.hasOwnProperty(Ee)&&X!=null&&!i.hasOwnProperty(Ee)&&Ye(e,n,Ee,null,i,X);for(Y in i)if(X=i[Y],ee=r[Y],i.hasOwnProperty(Y)&&X!==ee&&(X!=null||ee!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,n));break;default:Ye(e,n,Y,X,i,ee)}return;default:if(Gc(n)){for(var $e in r)X=r[$e],r.hasOwnProperty($e)&&X!==void 0&&!i.hasOwnProperty($e)&&Ld(e,n,$e,void 0,i,X);for(te in i)X=i[te],ee=r[te],!i.hasOwnProperty(te)||X===ee||X===void 0&&ee===void 0||Ld(e,n,te,X,i,ee);return}}for(var I in r)X=r[I],r.hasOwnProperty(I)&&X!=null&&!i.hasOwnProperty(I)&&Ye(e,n,I,null,i,X);for(oe in i)X=i[oe],ee=r[oe],!i.hasOwnProperty(oe)||X===ee||X==null&&ee==null||Ye(e,n,oe,X,i,ee)}function Av(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function S2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,r=performance.getEntriesByType("resource"),i=0;i<r.length;i++){var d=r[i],h=d.transferSize,x=d.initiatorType,_=d.duration;if(h&&_&&Av(x)){for(x=0,_=d.responseEnd,i+=1;i<r.length;i++){var z=r[i],Y=z.startTime;if(Y>_)break;var te=z.transferSize,oe=z.initiatorType;te&&Av(oe)&&(z=z.responseEnd,x+=te*(z<_?1:(_-Y)/(z-Y)))}if(--i,n+=8*(h+x)/(d.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var zd=null,Hd=null;function vl(e){return e.nodeType===9?e:e.ownerDocument}function _v(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Rv(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Ud(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Bd=null;function E2(){var e=window.event;return e&&e.type==="popstate"?e===Bd?!1:(Bd=e,!0):(Bd=null,!1)}var Ov=typeof setTimeout=="function"?setTimeout:void 0,C2=typeof clearTimeout=="function"?clearTimeout:void 0,Dv=typeof Promise=="function"?Promise:void 0,T2=typeof queueMicrotask=="function"?queueMicrotask:typeof Dv<"u"?function(e){return Dv.resolve(null).then(e).catch(N2)}:Ov;function N2(e){setTimeout(function(){throw e})}function Ua(e){return e==="head"}function Mv(e,n){var r=n,i=0;do{var d=r.nextSibling;if(e.removeChild(r),d&&d.nodeType===8)if(r=d.data,r==="/$"||r==="/&"){if(i===0){e.removeChild(d),So(n);return}i--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")i++;else if(r==="html")Os(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Os(r);for(var h=r.firstChild;h;){var x=h.nextSibling,_=h.nodeName;h[Xo]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=x}}else r==="body"&&Os(e.ownerDocument.body);r=d}while(r);So(n)}function Lv(e,n){var r=e;e=0;do{var i=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=i}while(r)}function Wd(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Wd(r),Kc(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function j2(e,n,r,i){for(;e.nodeType===1;){var d=r;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Xo])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=vn(e.nextSibling),e===null)break}return null}function A2(e,n,r){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=vn(e.nextSibling),e===null))return null;return e}function zv(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=vn(e.nextSibling),e===null))return null;return e}function Id(e){return e.data==="$?"||e.data==="$~"}function qd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function _2(e,n){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||r.readyState!=="loading")n();else{var i=function(){n(),r.removeEventListener("DOMContentLoaded",i)};r.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function vn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Pd=null;function Hv(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(n===0)return vn(e.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}e=e.nextSibling}return null}function Uv(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return e;n--}else r!=="/$"&&r!=="/&"||n++}e=e.previousSibling}return null}function Bv(e,n,r){switch(n=vl(r),e){case"html":if(e=n.documentElement,!e)throw Error(s(452));return e;case"head":if(e=n.head,!e)throw Error(s(453));return e;case"body":if(e=n.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function Os(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Kc(e)}var yn=new Map,Wv=new Set;function yl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ca=U.d;U.d={f:R2,r:O2,D:D2,C:M2,L:L2,m:z2,X:U2,S:H2,M:B2};function R2(){var e=ca.f(),n=cl();return e||n}function O2(e){var n=Ir(e);n!==null&&n.tag===5&&n.type==="form"?ag(n):ca.r(e)}var wo=typeof document>"u"?null:document;function Iv(e,n,r){var i=wo;if(i&&typeof n=="string"&&n){var d=un(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof r=="string"&&(d+='[crossorigin="'+r+'"]'),Wv.has(d)||(Wv.add(d),e={rel:e,crossOrigin:r,href:n},i.querySelector(d)===null&&(n=i.createElement("link"),Et(n,"link",e),gt(n),i.head.appendChild(n)))}}function D2(e){ca.D(e),Iv("dns-prefetch",e,null)}function M2(e,n){ca.C(e,n),Iv("preconnect",e,n)}function L2(e,n,r){ca.L(e,n,r);var i=wo;if(i&&e&&n){var d='link[rel="preload"][as="'+un(n)+'"]';n==="image"&&r&&r.imageSrcSet?(d+='[imagesrcset="'+un(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(d+='[imagesizes="'+un(r.imageSizes)+'"]')):d+='[href="'+un(e)+'"]';var h=d;switch(n){case"style":h=xo(e);break;case"script":h=ko(e)}yn.has(h)||(e=v({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:e,as:n},r),yn.set(h,e),i.querySelector(d)!==null||n==="style"&&i.querySelector(Ds(h))||n==="script"&&i.querySelector(Ms(h))||(n=i.createElement("link"),Et(n,"link",e),gt(n),i.head.appendChild(n)))}}function z2(e,n){ca.m(e,n);var r=wo;if(r&&e){var i=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+un(i)+'"][href="'+un(e)+'"]',h=d;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=ko(e)}if(!yn.has(h)&&(e=v({rel:"modulepreload",href:e},n),yn.set(h,e),r.querySelector(d)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Ms(h)))return}i=r.createElement("link"),Et(i,"link",e),gt(i),r.head.appendChild(i)}}}function H2(e,n,r){ca.S(e,n,r);var i=wo;if(i&&e){var d=qr(i).hoistableStyles,h=xo(e);n=n||"default";var x=d.get(h);if(!x){var _={loading:0,preload:null};if(x=i.querySelector(Ds(h)))_.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":n},r),(r=yn.get(h))&&Fd(e,r);var z=x=i.createElement("link");gt(z),Et(z,"link",e),z._p=new Promise(function(Y,te){z.onload=Y,z.onerror=te}),z.addEventListener("load",function(){_.loading|=1}),z.addEventListener("error",function(){_.loading|=2}),_.loading|=4,bl(x,n,i)}x={type:"stylesheet",instance:x,count:1,state:_},d.set(h,x)}}}function U2(e,n){ca.X(e,n);var r=wo;if(r&&e){var i=qr(r).hoistableScripts,d=ko(e),h=i.get(d);h||(h=r.querySelector(Ms(d)),h||(e=v({src:e,async:!0},n),(n=yn.get(d))&&Kd(e,n),h=r.createElement("script"),gt(h),Et(h,"link",e),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},i.set(d,h))}}function B2(e,n){ca.M(e,n);var r=wo;if(r&&e){var i=qr(r).hoistableScripts,d=ko(e),h=i.get(d);h||(h=r.querySelector(Ms(d)),h||(e=v({src:e,async:!0,type:"module"},n),(n=yn.get(d))&&Kd(e,n),h=r.createElement("script"),gt(h),Et(h,"link",e),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},i.set(d,h))}}function qv(e,n,r,i){var d=(d=fe.current)?yl(d):null;if(!d)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=xo(r.href),r=qr(d).hoistableStyles,i=r.get(n),i||(i={type:"style",instance:null,count:0,state:null},r.set(n,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=xo(r.href);var h=qr(d).hoistableStyles,x=h.get(e);if(x||(d=d.ownerDocument||d,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=d.querySelector(Ds(e)))&&!h._p&&(x.instance=h,x.state.loading=5),yn.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},yn.set(e,r),h||W2(d,e,r,x.state))),n&&i===null)throw Error(s(528,""));return x}if(n&&i!==null)throw Error(s(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ko(r),r=qr(d).hoistableScripts,i=r.get(n),i||(i={type:"script",instance:null,count:0,state:null},r.set(n,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function xo(e){return'href="'+un(e)+'"'}function Ds(e){return'link[rel="stylesheet"]['+e+"]"}function Pv(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function W2(e,n,r,i){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?i.loading=1:(n=e.createElement("link"),i.preload=n,n.addEventListener("load",function(){return i.loading|=1}),n.addEventListener("error",function(){return i.loading|=2}),Et(n,"link",r),gt(n),e.head.appendChild(n))}function ko(e){return'[src="'+un(e)+'"]'}function Ms(e){return"script[async]"+e}function Fv(e,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var i=e.querySelector('style[data-href~="'+un(r.href)+'"]');if(i)return n.instance=i,gt(i),i;var d=v({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),gt(i),Et(i,"style",d),bl(i,r.precedence,e),n.instance=i;case"stylesheet":d=xo(r.href);var h=e.querySelector(Ds(d));if(h)return n.state.loading|=4,n.instance=h,gt(h),h;i=Pv(r),(d=yn.get(d))&&Fd(i,d),h=(e.ownerDocument||e).createElement("link"),gt(h);var x=h;return x._p=new Promise(function(_,z){x.onload=_,x.onerror=z}),Et(h,"link",i),n.state.loading|=4,bl(h,r.precedence,e),n.instance=h;case"script":return h=ko(r.src),(d=e.querySelector(Ms(h)))?(n.instance=d,gt(d),d):(i=r,(d=yn.get(h))&&(i=v({},r),Kd(i,d)),e=e.ownerDocument||e,d=e.createElement("script"),gt(d),Et(d,"link",i),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(i=n.instance,n.state.loading|=4,bl(i,r.precedence,e));return n.instance}function bl(e,n,r){for(var i=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=i.length?i[i.length-1]:null,h=d,x=0;x<i.length;x++){var _=i[x];if(_.dataset.precedence===n)h=_;else if(h!==d)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(e,n.firstChild))}function Fd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Kd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var wl=null;function Kv(e,n,r){if(wl===null){var i=new Map,d=wl=new Map;d.set(r,i)}else d=wl,i=d.get(r),i||(i=new Map,d.set(r,i));if(i.has(e))return i;for(i.set(e,null),r=r.getElementsByTagName(e),d=0;d<r.length;d++){var h=r[d];if(!(h[Xo]||h[wt]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var _=i.get(x);_?_.push(h):i.set(x,[h])}}return i}function Yv(e,n,r){e=e.ownerDocument||e,e.head.insertBefore(r,n==="title"?e.querySelector("head > title"):null)}function I2(e,n,r){if(r===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(e=n.disabled,typeof n.precedence=="string"&&e==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function $v(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function q2(e,n,r,i){if(r.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var d=xo(i.href),h=n.querySelector(Ds(d));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=xl.bind(e),n.then(e,e)),r.state.loading|=4,r.instance=h,gt(h);return}h=n.ownerDocument||n,i=Pv(i),(d=yn.get(d))&&Fd(i,d),h=h.createElement("link"),gt(h);var x=h;x._p=new Promise(function(_,z){x.onload=_,x.onerror=z}),Et(h,"link",i),r.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=xl.bind(e),n.addEventListener("load",r),n.addEventListener("error",r))}}var Yd=0;function P2(e,n){return e.stylesheets&&e.count===0&&Sl(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var i=setTimeout(function(){if(e.stylesheets&&Sl(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Yd===0&&(Yd=62500*S2());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Sl(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Yd?50:800)+n);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(d)}}:null}function xl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Sl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var kl=null;function Sl(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,kl=new Map,n.forEach(F2,e),kl=null,xl.call(e))}function F2(e,n){if(!(n.state.loading&4)){var r=kl.get(e);if(r)var i=r.get(null);else{r=new Map,kl.set(e,r);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<d.length;h++){var x=d[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(r.set(x.dataset.precedence,x),i=x)}i&&r.set(null,i)}d=n.instance,x=d.getAttribute("data-precedence"),h=r.get(x)||i,h===i&&r.set(null,d),r.set(x,d),this.count++,i=xl.bind(this),d.addEventListener("load",i),d.addEventListener("error",i),h?h.parentNode.insertBefore(d,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var Ls={$$typeof:j,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function K2(e,n,r,i,d,h,x,_,z){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ic(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ic(0),this.hiddenUpdates=Ic(null),this.identifierPrefix=i,this.onUncaughtError=d,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=z,this.incompleteTransitions=new Map}function Vv(e,n,r,i,d,h,x,_,z,Y,te,oe){return e=new K2(e,n,r,x,z,Y,te,oe,_),n=1,h===!0&&(n|=24),h=Xt(3,null,null,n),e.current=h,h.stateNode=e,n=Cu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:i,isDehydrated:r,cache:n},Au(h),e}function Gv(e){return e?(e=Qr,e):Qr}function Xv(e,n,r,i,d,h){d=Gv(d),i.context===null?i.context=d:i.pendingContext=d,i=Na(n),i.payload={element:r},h=h===void 0?null:h,h!==null&&(i.callback=h),r=ja(e,i,n),r!==null&&(Pt(r,e,n),ms(r,e,n))}function Zv(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<n?r:n}}function $d(e,n){Zv(e,n),(e=e.alternate)&&Zv(e,n)}function Qv(e){if(e.tag===13||e.tag===31){var n=dr(e,67108864);n!==null&&Pt(n,e,67108864),$d(e,67108864)}}function Jv(e){if(e.tag===13||e.tag===31){var n=tn();n=qc(n);var r=dr(e,n);r!==null&&Pt(r,e,n),$d(e,n)}}var El=!0;function Y2(e,n,r,i){var d=M.T;M.T=null;var h=U.p;try{U.p=2,Vd(e,n,r,i)}finally{U.p=h,M.T=d}}function $2(e,n,r,i){var d=M.T;M.T=null;var h=U.p;try{U.p=8,Vd(e,n,r,i)}finally{U.p=h,M.T=d}}function Vd(e,n,r,i){if(El){var d=Gd(i);if(d===null)Md(e,n,i,Cl,r),ty(e,i);else if(G2(d,e,n,r,i))i.stopPropagation();else if(ty(e,i),n&4&&-1<V2.indexOf(e)){for(;d!==null;){var h=Ir(d);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=sr(h.pendingLanes);if(x!==0){var _=h;for(_.pendingLanes|=2,_.entangledLanes|=2;x;){var z=1<<31-ht(x);_.entanglements[1]|=z,x&=~z}Ln(h),(qe&6)===0&&(il=Se()+500,As(0))}}break;case 31:case 13:_=dr(h,2),_!==null&&Pt(_,h,2),cl(),$d(h,2)}if(h=Gd(i),h===null&&Md(e,n,i,Cl,r),h===d)break;d=h}d!==null&&i.stopPropagation()}else Md(e,n,i,null,r)}}function Gd(e){return e=Zc(e),Xd(e)}var Cl=null;function Xd(e){if(Cl=null,e=Wr(e),e!==null){var n=u(e);if(n===null)e=null;else{var r=n.tag;if(r===13){if(e=f(n),e!==null)return e;e=null}else if(r===31){if(e=m(n),e!==null)return e;e=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Cl=e,null}function ey(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(nt()){case ar:return 2;case rr:return 8;case de:case Ue:return 32;case st:return 268435456;default:return 32}default:return 32}}var Zd=!1,Ba=null,Wa=null,Ia=null,zs=new Map,Hs=new Map,qa=[],V2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ty(e,n){switch(e){case"focusin":case"focusout":Ba=null;break;case"dragenter":case"dragleave":Wa=null;break;case"mouseover":case"mouseout":Ia=null;break;case"pointerover":case"pointerout":zs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hs.delete(n.pointerId)}}function Us(e,n,r,i,d,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:r,eventSystemFlags:i,nativeEvent:h,targetContainers:[d]},n!==null&&(n=Ir(n),n!==null&&Qv(n)),e):(e.eventSystemFlags|=i,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function G2(e,n,r,i,d){switch(n){case"focusin":return Ba=Us(Ba,e,n,r,i,d),!0;case"dragenter":return Wa=Us(Wa,e,n,r,i,d),!0;case"mouseover":return Ia=Us(Ia,e,n,r,i,d),!0;case"pointerover":var h=d.pointerId;return zs.set(h,Us(zs.get(h)||null,e,n,r,i,d)),!0;case"gotpointercapture":return h=d.pointerId,Hs.set(h,Us(Hs.get(h)||null,e,n,r,i,d)),!0}return!1}function ny(e){var n=Wr(e.target);if(n!==null){var r=u(n);if(r!==null){if(n=r.tag,n===13){if(n=f(r),n!==null){e.blockedOn=n,gp(e.priority,function(){Jv(r)});return}}else if(n===31){if(n=m(r),n!==null){e.blockedOn=n,gp(e.priority,function(){Jv(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Tl(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var r=Gd(e.nativeEvent);if(r===null){r=e.nativeEvent;var i=new r.constructor(r.type,r);Xc=i,r.target.dispatchEvent(i),Xc=null}else return n=Ir(r),n!==null&&Qv(n),e.blockedOn=r,!1;n.shift()}return!0}function ay(e,n,r){Tl(e)&&r.delete(n)}function X2(){Zd=!1,Ba!==null&&Tl(Ba)&&(Ba=null),Wa!==null&&Tl(Wa)&&(Wa=null),Ia!==null&&Tl(Ia)&&(Ia=null),zs.forEach(ay),Hs.forEach(ay)}function Nl(e,n){e.blockedOn===n&&(e.blockedOn=null,Zd||(Zd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,X2)))}var jl=null;function ry(e){jl!==e&&(jl=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jl===e&&(jl=null);for(var n=0;n<e.length;n+=3){var r=e[n],i=e[n+1],d=e[n+2];if(typeof i!="function"){if(Xd(i||r)===null)continue;break}var h=Ir(r);h!==null&&(e.splice(n,3),n-=3,Gu(h,{pending:!0,data:d,method:r.method,action:i},i,d))}}))}function So(e){function n(z){return Nl(z,e)}Ba!==null&&Nl(Ba,e),Wa!==null&&Nl(Wa,e),Ia!==null&&Nl(Ia,e),zs.forEach(n),Hs.forEach(n);for(var r=0;r<qa.length;r++){var i=qa[r];i.blockedOn===e&&(i.blockedOn=null)}for(;0<qa.length&&(r=qa[0],r.blockedOn===null);)ny(r),r.blockedOn===null&&qa.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(i=0;i<r.length;i+=3){var d=r[i],h=r[i+1],x=d[Ht]||null;if(typeof h=="function")x||ry(r);else if(x){var _=null;if(h&&h.hasAttribute("formAction")){if(d=h,x=h[Ht]||null)_=x.formAction;else if(Xd(d)!==null)continue}else _=x.action;typeof _=="function"?r[i+1]=_:(r.splice(i,3),i-=3),ry(r)}}}function oy(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return d=x})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),i||setTimeout(r,20)}function r(){if(!i&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function Qd(e){this._internalRoot=e}Al.prototype.render=Qd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(s(409));var r=n.current,i=tn();Xv(r,i,e,n,null,null)},Al.prototype.unmount=Qd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Xv(e.current,2,null,e,null,null),cl(),n[Br]=null}};function Al(e){this._internalRoot=e}Al.prototype.unstable_scheduleHydration=function(e){if(e){var n=hp();e={blockedOn:null,target:e,priority:n};for(var r=0;r<qa.length&&n!==0&&n<qa[r].priority;r++);qa.splice(r,0,e),r===0&&ny(e)}};var sy=a.version;if(sy!=="19.2.5")throw Error(s(527,sy,"19.2.5"));U.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=p(n),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var Z2={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_l.isDisabled&&_l.supportsFiber)try{ya=_l.inject(Z2),bt=_l}catch{}}return Ws.createRoot=function(e,n){if(!l(e))throw Error(s(299));var r=!1,i="",d=mg,h=pg,x=hg;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=Vv(e,1,!1,null,null,r,i,null,d,h,x,oy),e[Br]=n.current,Dd(e),new Qd(n)},Ws.hydrateRoot=function(e,n,r){if(!l(e))throw Error(s(299));var i=!1,d="",h=mg,x=pg,_=hg,z=null;return r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(_=r.onRecoverableError),r.formState!==void 0&&(z=r.formState)),n=Vv(e,1,!0,n,r??null,i,d,z,h,x,_,oy),n.context=Gv(null),r=n.current,i=tn(),i=qc(i),d=Na(i),d.callback=null,ja(r,d,i),r=i,n.current.lanes=r,Go(n,r),Ln(n),e[Br]=n.current,Dd(e),new Al(n)},Ws.version="19.2.5",Ws}var gy;function lS(){if(gy)return tf.exports;gy=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),tf.exports=iS(),tf.exports}var cS=lS();const uS="modulepreload",dS=function(t){return"/"+t},vy={},Mt=function(a,o,s){let l=Promise.resolve();if(o&&o.length>0){let g=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=f?.nonce||f?.getAttribute("nonce");l=g(o.map(p=>{if(p=dS(p),p in vy)return;vy[p]=!0;const b=p.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const k=document.createElement("link");if(k.rel=b?"stylesheet":uS,b||(k.as="script"),k.crossOrigin="",k.href=p,m&&k.setAttribute("nonce",m),document.head.appendChild(k),b)return new Promise((E,S)=>{k.addEventListener("load",E),k.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${p}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return l.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return a().catch(u)})},fS=y.lazy(()=>Mt(()=>import("./WorkspaceTaskDrawer-DdAAFy8G.js"),__vite__mapDeps([0,1])).then(t=>({default:t.WorkspaceTaskDrawer}))),mS=y.lazy(()=>Mt(()=>import("./AddWorkspaceFlow-BxT9VxkV.js"),[]).then(t=>({default:t.AddWorkspaceFlow}))),pS=y.lazy(()=>Mt(()=>import("./FirstRunWizard-S7Pb_5iy.js"),[]).then(t=>({default:t.FirstRunWizard}))),hS=y.lazy(()=>Mt(()=>import("./WhatsNewDialog-D-UzFajD.js"),[]).then(t=>({default:t.WhatsNewDialog}))),gS=({addDialogTrigger:t,onAddWorkspace:a,onCloseTaskGraph:o,onCloseWizard:s,onCreateWorkspace:l,onTryDemo:u,taskGraphOpen:f,tasksFile:m,wizardOpen:g,whatsNewOpen:p,whatsNewEntries:b,onCloseWhatsNew:v,workspacePath:k,workers:E,onSelectOwner:S,connectionStale:w})=>c.jsxs(c.Fragment,{children:[k?c.jsx(y.Suspense,{fallback:null,children:c.jsx(fS,{open:f,tasksFile:m,onClose:o,workspacePath:k,...E?{workers:E}:{},...S?{onSelectOwner:S}:{},...w!==void 0?{connectionStale:w}:{}})}):null,t>0?c.jsx(y.Suspense,{fallback:null,children:c.jsx(mS,{onClose:()=>{},onCreate:l,onTryDemo:u,trigger:t})}):null,g?c.jsx(y.Suspense,{fallback:null,children:c.jsx(pS,{open:g,onClose:s,onAddWorkspace:a,onTryDemo:u})}):null,p?c.jsx(y.Suspense,{fallback:null,children:c.jsx(hS,{open:p,entries:[...b],onClose:v})}):null]});const o0=(...t)=>t.filter((a,o,s)=>!!a&&a.trim()!==""&&s.indexOf(a)===o).join(" ").trim();const vS=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const yS=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,o,s)=>s?s.toUpperCase():o.toLowerCase());const yy=t=>{const a=yS(t);return a.charAt(0).toUpperCase()+a.slice(1)};var of={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const bS=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1},wS=y.createContext({}),xS=()=>y.useContext(wS),kS=y.forwardRef(({color:t,size:a,strokeWidth:o,absoluteStrokeWidth:s,className:l="",children:u,iconNode:f,...m},g)=>{const{size:p=24,strokeWidth:b=2,absoluteStrokeWidth:v=!1,color:k="currentColor",className:E=""}=xS()??{},S=s??v?Number(o??b)*24/Number(a??p):o??b;return y.createElement("svg",{ref:g,...of,width:a??p??of.width,height:a??p??of.height,stroke:t??k,strokeWidth:S,className:o0("lucide",E,l),...!u&&!bS(m)&&{"aria-hidden":"true"},...m},[...f.map(([w,C])=>y.createElement(w,C)),...Array.isArray(u)?u:[u]])});const ve=(t,a)=>{const o=y.forwardRef(({className:s,...l},u)=>y.createElement(kS,{ref:u,iconNode:a,className:o0(`lucide-${vS(yy(t))}`,`lucide-${t}`,s),...l}));return o.displayName=yy(t),o};const SS=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],bc=ve("activity",SS);const ES=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],CS=ve("arrow-right",ES);const TS=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Gf=ve("bell",TS);const NS=[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]],jS=ve("book-open-check",NS);const AS=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],_S=ve("brain",AS);const RS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ga=ve("check",RS);const OS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qo=ve("chevron-down",OS);const DS=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],MS=ve("chevron-left",DS);const LS=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wc=ve("chevron-right",LS);const zS=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],HS=ve("chevrons-left",zS);const US=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],BS=ve("chevrons-right",US);const WS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],s0=ve("circle-check",WS);const IS=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],qS=ve("circle-play",IS);const PS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],FS=ve("circle-question-mark",PS);const KS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],YS=ve("circle-x",KS);const $S=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],VS=ve("circle",$S);const GS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],XS=ve("clock-3",GS);const ZS=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],QS=ve("code-xml",ZS);const JS=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Dr=ve("copy",JS);const eE=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],Am=ve("crown",eE);const tE=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],nE=ve("ellipsis-vertical",tE);const aE=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],_m=ve("external-link",aE);const rE=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],i0=ve("file-text",rE);const oE=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Ql=ve("flask-conical",oE);const sE=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],l0=ve("folder-plus",sE);const iE=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],lE=ve("hammer",iE);const cE=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],by=ve("image-plus",cE);const uE=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],c0=ve("image",uE);const dE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],u0=ve("info",dE);const fE=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],mE=ve("languages",fE);const pE=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],sf=ve("laptop",pE);const hE=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],d0=ve("list-checks",hE);const gE=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ja=ve("loader-circle",gE);const vE=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],yE=ve("log-out",vE);const bE=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],wE=ve("maximize-2",bE);const xE=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],kE=ve("minimize-2",xE);const SE=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],EE=ve("package",SE);const CE=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],f0=ve("pencil",CE);const TE=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Po=ve("play",TE);const NE=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Jl=ve("plus",NE);const jE=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],wy=ve("radio",jE);const AE=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Rm=ve("refresh-cw",AE);const _E=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],xc=ve("rotate-ccw",_E);const RE=[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],OE=ve("search-check",RE);const DE=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],ME=ve("send",DE);const LE=[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]],zE=ve("server-crash",LE);const HE=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Xf=ve("settings",HE);const UE=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],BE=ve("shield-check",UE);const WE=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],IE=ve("sliders-horizontal",WE);const qE=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],m0=ve("smartphone",qE);const PE=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],p0=ve("sparkles",PE);const FE=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],h0=ve("square",FE);const KE=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],kc=ve("terminal",KE);const YE=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Sc=ve("trash-2",YE);const $E=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Js=ve("triangle-alert",$E);const VE=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],lf=ve("user-plus",VE);const GE=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],XE=ve("user-round",GE);const ZE=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Ec=ve("users",ZE);const QE=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],ec=ve("volume-2",QE);const JE=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],g0=ve("volume-x",JE);const eC=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],tC=ve("webhook",eC);const nC=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],v0=ve("workflow",nC);const aC=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fa=ve("x",aC),rC=t=>t==="en"||t==="zh",y0="hive.uiLanguage",b0={"addWorker.agentCli":"Agent CLI","addWorker.agentNotFound":"not found","addWorker.agentExists":"Member name already exists","addWorker.cancel":"Cancel","addWorker.create":"Add Member","addWorker.creating":"Creating…","addWorker.customPlaceholder":"You are a security reviewer focused on auth and input validation. Use team report to hand findings back to the orchestrator.","addWorker.description":"Pick a role and a CLI agent. The orchestrator dispatches work via {command}.","addWorker.enterName":"Enter a name","addWorker.genericAgent":"Generic command","addWorker.genericCommand":"startup command only","addWorker.loadingPresets":"Loading presets…","addWorker.name":"Name","addWorker.namePlaceholder":"e.g. Alice","addWorker.modifiedFrom":"Modified from {role} default","addWorker.pickCliOrStartup":"Pick a CLI agent or enter a startup command","addWorker.random":"Random","addWorker.randomAria":"Generate random member name","addWorker.randomTooltip":"Suggest a random name","addWorker.role":"Role","addWorker.roleInstructions":"Role instructions","addWorker.roleInstructionsTitle":"Injected into the agent's startup prompt and every dispatch. Hive's team protocol stays fixed; this only steers role behavior.","addWorker.reset":"Reset","addWorker.saveAsTemplate":"Save as template","addWorker.startupCommand":"Startup command","addWorker.startupHelp":"Optional. Runs through your shell in this Workspace (bash/zsh/fish on POSIX, cmd.exe on Windows). Use it for custom agents or native resume commands such as {example}.","addWorker.startupOverrides":"overrides CLI launch","addWorker.template":"Saved templates","addWorker.templateClear":"Use blank Custom (no template)","addWorker.templateDeleteAria":"Delete template {name}","addWorker.templateDeleteConfirm":'Delete the saved template "{name}"? This cannot be undone.',"addWorker.templateDeleteConfirmLabel":"Delete","addWorker.templateDeleteTitle":"Delete role template","addWorker.templateEmpty":"No saved templates yet. Fill in role instructions and save one.","addWorker.templateNamePlaceholder":"Template name","addWorker.templateNoMatch":"No templates match this search.","addWorker.templatePickPlaceholder":"Choose a saved template…","addWorker.templateSaveConfirm":"Save","addWorker.templateSearchPlaceholder":"Search templates","addWorker.title":"Add team member","addWorker.unavailable":"{name} is not installed","addWorker.emptyInstructions":"Add role instructions","actionCenter.activity.cancelled":"{worker} cancelled {ago}","actionCenter.activity.queued":"{worker} received work {ago}","actionCenter.activity.reported":"{worker} reported {ago}","actionCenter.activity.submitted":"{worker} started {ago}","actionCenter.attention":"Attention","actionCenter.attention.noWorkers":"No team members yet.","actionCenter.attention.remoteError":"Remote request errored at {endpoint}.","actionCenter.attention.remoteRejected":"Remote request rejected at {endpoint}: {reason}.","actionCenter.attention.stoppedWithQueue":"{worker} is stopped with open work.","actionCenter.attention.waitingReport":"{worker} has been waiting to report for {minutes}m.","actionCenter.attentionSubtitle":"Blocked or stale work that may need orchestration.","actionCenter.allClear":"All clear","actionCenter.collapse":"Collapse Action Center","actionCenter.copyRecap":"Copy recap","actionCenter.currentDispatch":"Current","actionCenter.expand":"Expand Action Center","actionCenter.latestReport":"Report","actionCenter.loadFailed":"Could not load team activity.","actionCenter.liveSnapshot":"Live snapshot","actionCenter.loading":"Loading team activity...","actionCenter.metrics":"Action Center metrics","actionCenter.needsAttention":"{count} need attention","actionCenter.noActivity":"No recent team activity.","actionCenter.noAttention":"No blocked work or remote errors right now.","actionCenter.noWorkerEvidence":"No active worker evidence.","actionCenter.openDispatches":"Open dispatches","actionCenter.recapCopied":"Recap copied to clipboard.","actionCenter.recapCopyFailed":"Could not copy recap.","actionCenter.recent":"Recent","actionCenter.recentReports":"Recent reports","actionCenter.recentSubtitle":"Dispatches, reports, and cancellations in order.","actionCenter.reportCount":"{count} reports","actionCenter.runningCount":"{count} running","actionCenter.subtitle":"Team activity, open dispatches, and evidence for the next orchestration move","actionCenter.terminalHint":"Terminal","actionCenter.title":"Action Center","actionCenter.totalWorkers":"Team members","actionCenter.unknownWorker":"Unknown member","actionCenter.updated":"Updated {ago}","actionCenter.workingWorkers":"Working now","actionCenter.workerStatus":"Status","actionCenter.workers":"Workers","actionCenter.workersSubtitle":"Current work, latest reports, and terminal hints.","common.cancel":"Cancel","common.close":"Close","common.dismiss":"Dismiss","common.never":"Never","common.error":"Error","common.closeDialog":"Close dialog","common.time.sAgo":"{count}s ago","common.time.mAgo":"{count}m ago","common.time.hAgo":"{count}h ago","common.time.dAgo":"{count}d ago","common.copied":"Copied","common.copyError":"Copy error","common.delete":"Delete","common.idle":"idle","common.loading":"Loading…","common.refresh":"Refresh","common.restart":"Restart","common.retry":"Retry","common.running":"running","common.save":"Save","common.saving":"Saving…","common.start":"Start","common.starting":"Starting…","common.stop":"Stop","common.stopped":"stopped","common.working":"working","connect.login.failed":"Sign-in failed — check your connection and try again.","connect.login.heading":"Connect to your Hive","connect.login.subtitle":"Sign in to reach the computers running Hive on your account.","connect.login.github":"Continue with GitHub","connect.login.google":"Continue with Google","connect.login.signingIn":"Signing in…","connect.machines.back":"Back","connect.machines.connecting":"Connecting…","connect.machines.heading":"Your computers","connect.machines.empty":"No computers yet. Run Hive on a computer and enable remote access.","connect.machines.lastSeen":"Last seen {ago} ago","connect.machines.manageDevices":"Manage devices","connect.machines.offline":"Offline","connect.machines.online":"Online","connect.machines.revoked":"Access revoked","connect.machines.revokedHint":"This device's access was revoked — enter a new pairing code to connect again.","connect.machines.select":"Connect","connect.pair.back":"Back","connect.pair.finalizing":"Confirmed — preparing your session…","connect.pair.guideHeading":"Pair this phone","connect.pair.guideStep1":"On that computer, open Settings → Remote access.","connect.pair.guideStep2":"Click Add device and keep the pairing code visible.","connect.pair.guideStep3":"Enter that pairing code below.","connect.pair.qrLabel":"Pairing code","connect.pair.sasInstruction":"On your computer, open Settings → Remote access and tap Confirm if this code matches.","connect.pair.sasPrompt":"Confirm this code matches the one shown on your computer:","connect.pair.startOver":"Start over","connect.pair.submit":"Pair","connect.error.selectFailed":"Couldn't reach that computer. Your saved session may have expired, or it's offline — pair again below.","connect.error.invalidCode":"That pairing code doesn't look right. Check it and try again.","demo.banner":"Demo mode — interactive product replay.","demo.exit":"Exit demo","demo.replaySubtitle":"A local replay of planning, dispatch, report, and task closure.","demo.replayTitle":"Hive demo workspace","demo.tasksTitle":"Task graph","demo.teamTitle":"Team","firstRun.addWorkspace":"Add Workspace","firstRun.back":"Back","firstRun.desc":"Coordinate multiple CLI coding agents — locally.","firstRun.getStarted":"Get started","firstRun.howItWorks":"How it works","firstRun.next":"Next","firstRun.optionDesc":"Choose how you want to begin.","firstRun.slide1Desc":"Pick a project folder.","firstRun.slide1Title":"Add a Workspace","firstRun.slide2Desc":"Antigravity CLI, Claude Code, Codex, Gemini, OpenCode, Hermes, Qwen Code, Pi — your choice.","firstRun.slide2Title":"Pick an Orchestrator","firstRun.slide3Desc":"The Orchestrator dispatches `team send <worker> <task>` to team members.","firstRun.slide3Title":"Dispatch tasks","firstRun.skip":"Skip","firstRun.skipForNow":"Skip for now","firstRun.step":"Step {current} of {total}","firstRun.subtitle":"Each Workspace runs an Orchestrator that dispatches tasks to team members.","firstRun.title":"Welcome to Hive","firstRun.tryDemo":"Try Demo","language.aria":"Switch language","language.currentEn":"EN","language.currentZh":"中","language.en":"EN","language.switchToEn":"Switch language to English","language.switchToZh":"Switch language to 中文","language.tooltip":"Language","language.zh":"中文","marketplace.allCategories":"All","marketplace.backToList":"Back to list","marketplace.close":"Close marketplace","marketplace.empty":"No matching agents","marketplace.importButton":"Fill into form","marketplace.importedBadge":"You have a saved template with this name","marketplace.loading":"Loading…","marketplace.imported":"Filled the form from {name}","marketplace.loadFailed":"Failed to load marketplace","marketplace.openFromAddWorker":"Browse marketplace","marketplace.searchPlaceholder":"Search agents…","marketplace.showAllCategories":"Show {count} more categories","marketplace.showCoreOnly":"Show core only","marketplace.sourceLabel":"Curated from {repo}","marketplace.title":"Template marketplace","marketplace.viewSource":"View on GitHub","mobile.nav.aria":"Main navigation","mobile.focus.enter":"Focus the terminal (hide navigation)","mobile.focus.exit":"Show navigation","mobile.nav.flows":"Flows","mobile.nav.more":"More","mobile.nav.settings":"Settings","mobile.nav.tasks":"Tasks","mobile.nav.team":"Team","mobile.reconnect.disconnected":"Disconnected.","mobile.reconnect.reconnecting":"Reconnecting…","mobile.reconnect.retry":"Retry","mobile.reconnect.revoked":"Access revoked — re-pair this device from your computer.","mobile.section.about":"About","mobile.section.demo":"Demo","mobile.section.devices":"Devices","mobile.section.settings":"Settings","mobile.section.workflows":"Workflows","mobile.section.workspaces":"Workspaces","mobile.tasks.noWorkspaceDesc":"Pick or add a workspace to see its task graph.","mobile.tasks.noWorkspaceTitle":"No workspace selected","mobile.team.orchestrator":"Orchestrator","mobile.team.workers":"Workers","mobile.workspaces.switch":"Switch workspace","openWorkspace.error.appNotInstalled":"Couldn't find {app}. Make sure it's installed and reachable.","openWorkspace.error.commandNotInPath":"Couldn't run the launcher for {app}. Add its CLI to your PATH and retry.","openWorkspace.error.invalidPath":"The workspace path contains characters that are unsafe to launch.","openWorkspace.error.invalidTarget":"That app is no longer a supported open target.","openWorkspace.error.unknown":"Couldn't open in {app}.","openWorkspace.noWorkspace":"Select a workspace to enable","openWorkspace.open":"Open","openWorkspace.opened":"Opened {workspace} in {app} on your computer","openWorkspace.openIn":"Open {workspace} in {app}","openWorkspace.openInAria":"Open workspace {workspace} in {app}","openWorkspace.selectTarget":"Choose app","openWorkspace.target.cursor":"Cursor","openWorkspace.target.finder.linux":"File Manager","openWorkspace.target.finder.mac":"Finder","openWorkspace.target.finder.windows":"File Explorer","openWorkspace.target.ghostty":"Ghostty","openWorkspace.target.terminal":"Terminal","openWorkspace.target.vscode":"VS Code","openWorkspace.target.vscodeInsiders":"VS Code Insiders","openWorkspace.target.zed":"Zed","packageUpdate.body":"You are running v{current}. Update when you are ready; Hive will keep running.","packageUpdate.commandCopied":"Command copied","packageUpdate.commandCopyFailed":"Could not copy command","packageUpdate.copyCommand":"Copy command","packageUpdate.later":"Later","packageUpdate.openRelease":"Open release notes","packageUpdate.release":"Release","packageUpdate.title":"Hive v{version} is available","orchestrator.copyErrorAria":"Copy error message","orchestrator.failed":"Orchestrator failed to start","orchestrator.removeWorkspace":"Remove workspace","orchestrator.start":"Start Orchestrator","orchestrator.stop":"Stop Orchestrator","orchestrator.startingDesc":"Preparing the Orchestrator terminal.","orchestrator.startingTitle":"Starting Orchestrator","orchestrator.stoppedDesc":"Start the Orchestrator to plan tasks and dispatch them to team members.","orchestrator.stoppedTitle":"Orchestrator is stopped","role.coder":"Coder","role.custom":"Custom","role.reviewer":"Reviewer","role.tester":"Tester","runtime.retryNow":"Retry now","runtime.staleBody":"Writes are paused until Hive reconnects to the local runtime.","runtime.staleTitle":"Hive runtime connection lost","runtime.writeDisabled":"Hive runtime connection lost; retry once it is back.","sidebar.deleteAria":"Delete Workspace {name}","sidebar.deleteConfirm":'Delete Workspace "{name}"?',"sidebar.deleteDescription":"This stops its agents and removes it from Hive. The folder on disk ({path}) is left untouched. {summary}.","sidebar.deleteFailed":"Failed to delete: {message}","sidebar.deleteLabel":"Delete Workspace","sidebar.deleting":"Deleting…","sidebar.dismissRepository":"Hide the GitHub link","sidebar.noMembers":"no team members yet","sidebar.newWorkspace":"New Workspace","sidebar.noWorkspaces":"No Workspaces","sidebar.noWorkspacesDesc":"Add one to start. Hive will load .hive/tasks.md and start the Orchestrator.","sidebar.oneWorking":"One team member working","sidebar.demoVideo":"Demo video","sidebar.openDemoVideo":"Watch the Hive demo video","sidebar.openRepository":"Open the Hive GitHub repository","sidebar.removed":'Removed Workspace "{name}".',"sidebar.teamMemberCount":"{count} team members","sidebar.workingCount":"{working} of {total} working","sidebar.workingMembers":"{count} team members working","sidebar.workspaces":"Workspaces","shellTerminal.closeFailed":"Failed to close shell: {message}","shellTerminal.open":"Terminal","shellTerminal.openAria":"Open workspace terminal","pairing.awaitingConfirm":"Confirm on your computer to finish pairing.","pairing.cancel":"Cancel","pairing.connecting":"Connecting to your computer…","pairing.failed.expired":"Pairing expired — start again.","pairing.failed.mintForbidden":"Pairing was not confirmed on your computer.","pairing.failed.rejected":"Pairing was rejected.","pairing.failed.socket":"Lost the connection before pairing finished.","pairing.failed.version":"This phone and computer are on different versions.","pairing.handshaking":"Verifying…","pairing.paired":"Paired.","pairing.sasPrompt":"Check that this code matches the one on your computer:","pwa.appShellUpdated":"Web UI updated","pwa.reloadToActivate":"Reload to activate","pwa.reloading":"Reloading…","pwa.runtimeOffline.autoReconnect":"Auto-reconnect on — Hive will reload when the runtime is back.","pwa.runtimeOffline.body":"Start the Hive daemon by running `hive` in a terminal.","pwa.runtimeOffline.retry":"Retry now","pwa.runtimeOffline.retrying":"Retrying…","pwa.runtimeOffline.title":"Hive runtime is not running","pwa.runtimeOffline.tryDemo":"Try Demo instead","pwa.waitForAgents":"Wait for agents to finish","remote.addDevice":"Add device","remote.audit.bytes":"{count} bytes","remote.audit.empty":"No remote activity yet.","remote.audit.heading":"Remote activity","remote.audit.hide":"Hide activity","remote.audit.loadFailed":"Could not load activity.","remote.audit.result.error":"error","remote.audit.result.ok":"ok","remote.audit.result.rejected":"rejected","remote.audit.show":"Show activity","remote.connect.connecting":"Connecting…","remote.connect.disconnected":"Disconnected","remote.connect.online":"Connected","remote.connect.reconnecting":"Reconnecting…","remote.connect.sessionExpired":"Session expired — sign in again.","remote.confirm.confirm":"Confirm","remote.confirm.confirming":"Confirming…","remote.confirm.description":"A phone is trying to pair as “{name}”. Compare this code with the one shown on the phone — they must match.","remote.confirm.expired":"Pairing request expired.","remote.confirm.failed":"Could not complete — try pairing again.","remote.confirm.paired":"Paired “{name}”.","remote.confirm.reject":"Reject","remote.confirm.rejected":"Pairing rejected.","remote.confirm.sasLabel":"Verification code","remote.confirm.title":"Confirm new device","remote.confirm.warning":"Only confirm if you started this and the codes match.","remote.devices.activeNow":"Active just now","remote.devices.empty":"No paired devices yet.","remote.devices.heading":"Paired devices","remote.devices.lastActive":"Active {ago} ago","remote.devices.loadFailed":"Could not load devices.","remote.devices.neverActive":"Not active yet","remote.devices.revoke":"Revoke","remote.devices.revokeAria":"Revoke device {name}","remote.devices.revokeConfirm":"Revoke “{name}”? Its open sessions close immediately and it must pair again.","remote.devices.revokeFailed":"Could not revoke — try again.","remote.devices.revokeTitle":"Revoke device","remote.devices.revoked":"Revoked “{name}”.","remote.diagnostics.copy":"Copy diagnostics","remote.diagnostics.copied":"Diagnostics copied","remote.diagnostics.copyFailed":"Could not copy diagnostics.","remote.diagnostics.copying":"Copying...","remote.retention.activeDays":"active days","remote.retention.loadFailed":"Could not load local retention signals.","remote.retention.localOnly":"local only","remote.retention.reports":"reports","remote.retention.sends":"sends","remote.retention.streak":"current streak","remote.retention.title":"Protocol activity","remote.disable.confirmBody":"Remote devices (including this one) will disconnect immediately. You can only re-enable it from the desktop.","remote.disable.confirmTitle":"Turn off remote access?","remote.enable.description":"Reach this machine from your phone over an end-to-end encrypted tunnel. Off by default.","remote.enable.label":"Remote access","remote.qr.cancel":"Cancel","remote.qr.expired":"Code expired — generate a new one.","remote.qr.expiresIn":"Expires in {seconds}s","remote.qr.instructions":"Enter this code on your phone. Keep this open until you confirm here.","remote.qr.regenerate":"New code","remote.qr.startFailed":"Could not start pairing — try again.","remote.qr.title":"Pairing code","remote.section":"Remote access","remote.status.connected":"Tunnel connected","remote.status.disconnected":"Tunnel offline","remote.status.linked":"Linked to {gateway}","remote.status.notLinked":"Not linked — run `hive remote login` in a terminal.","remote.status.connecting":"Connecting to the gateway…","remote.status.reconnecting":"Reconnecting…","remote.status.revoked":"Access revoked — re-link to restore remote access.","scenario.applied":"Team assembled — the goal is with the Orchestrator","scenario.apply":"Assemble team & start","scenario.applying":"Assembling…","scenario.build_review_test.desc":"Coder + Reviewer + Tester running a build–review–verify loop.","scenario.build_review_test.title":"Build · Review · Test","scenario.cancel":"Cancel","scenario.docs_pipeline.desc":"A drafter writes the doc, a doc reviewer checks facts and flow.","scenario.docs_pipeline.title":"Docs pipeline","scenario.goalHint":"Sent to the Orchestrator — it dispatches with team send/team spawn, or uses team workflow for staged or 3+ worker work.","scenario.goalLabel":"Goal","scenario.research_factcheck.desc":"A researcher gathers sourced findings, a fact-checker verifies them.","scenario.research_factcheck.title":"Research & Fact-check","scenario.sectionTitle":"Or start with a scenario team","settings.aria":"Settings","settings.autostaff.description":"Let the orchestrator size the team to each task — spawn the right mix of coders / testers / reviewers. On by default.","settings.autostaff.label":"Auto-staff team","settings.experimental":"Experimental","settings.language":"Language","settings.heading":"Settings","settings.notifications":"Notifications","settings.subtitle":"Features, webhooks, and remote access.","settings.saveError":"Could not save — check the runtime connection and try again.","settings.tooltip":"Settings","settings.webhook.description":"POST a small JSON payload to this URL when a worker reports or a workflow finishes — wire it to Slack, ntfy, Feishu, etc. Best-effort; the runtime sends to whatever URL you set, so keep it private.","settings.webhook.label":"Completion webhook","settings.webhook.saved":"Saved","settings.workflows.description":"Let the orchestrator author and run multi-agent workflows (`team workflow`). Off by default.","settings.workflows.label":"Workflows","topbar.hideTodo":"Hide Tasks","topbar.openWebsite":"Open hivehq.dev","topbar.showTodo":"Show Tasks (.hive/tasks.md)","topbar.todo":"Tasks","topbar.todoOpen":"Tasks — {count} open tasks","topbar.copyUpdateCommand":"Copy update command","topbar.openRelease":"Open release notes","topbar.updateAvailable":"Update available","topbar.updateCommandCopied":"Update command copied","topbar.updateCommandCopyFailed":"Could not copy update command","topbar.hideMemory":"Hide Memory","topbar.showMemory":"Show Memory","topbar.memory":"Memory","topbar.hideWorkflows":"Hide Workflows","topbar.showWorkflows":"Show Workflows","topbar.workflows":"Workflows","memory.title":"Memory","memory.subtitle":"Workspace knowledge and Dream audit trail","memory.searchPlaceholder":"Search...","memory.tabActive":"Active","memory.tabArchived":"Archived","memory.tabDreams":"Dreams","memory.runNow":"Run now","memory.emptyActive":"No memory entries","memory.emptyActiveDesc":"Entries appear here after the orchestrator adds memory or Dream extracts it.","memory.emptyDreams":"No dream runs yet","memory.emptyDreamsDesc":"Run history appears after a manual or scheduled Dream pass.","memory.archiveTitle":"Archive Memory","memory.archiveDesc":"Archived memory stops appearing in startup, recovery, and dispatch injection.","memory.archiveButton":"Archive","memory.revertTitle":"Revert Dream Run","memory.revertDesc":"This restores the memory rows changed by the selected Dream run and archives entries it added.","memory.revertButton":"Revert","memory.sources":"Sources","memory.noSources":"No source evidence.","memory.updated":"Updated {time}","memory.injected":"Injected {time}","memory.started":"Started {time}","memory.finished":"Finished {time}","memory.revertTooltip":"Revert dream run","memory.status.pending":"pending","memory.status.running":"running","memory.status.completed":"completed","memory.status.failed":"failed","memory.status.reverted":"reverted","memory.trigger.manual":"manual","memory.trigger.cron":"scheduled","memory.trigger.scheduled":"scheduled","memory.noReport":"No report","memory.noInput":"No input","memory.seq":"Seq","memory.reportAdded":"added","memory.reportRewritten":"rewritten","memory.reportArchived":"archived","memory.reportMerged":"merged","memory.diff.added":"Added","memory.diff.rewritten":"Rewritten","memory.diff.archived":"Archived","memory.diff.merged":"Merged","memory.pinned":"Pinned","memory.scopeUser":"User","memory.disabled":"Disabled","memory.unpinTooltip":"Unpin","memory.pinTooltip":"Pin","memory.enableTooltip":"Enable","memory.disableTooltip":"Disable","memory.entries":"entries","memory.runs":"runs","memory.kind.decision":"Decision","memory.kind.fact":"Fact","memory.kind.pitfall":"Pitfall","memory.kind.preference":"Preference","memory.kind.procedure_ref":"Procedure","tasks.title":"Tasks","tasks.subtitle":"Project todo list parsed from .hive/tasks.md","tasks.editMarkdown":"Edit Markdown","tasks.save":"Save","tasks.local":"Keep Local","tasks.reload":"Reload","tasks.noTasks":"No task entries","tasks.noTasksDesc":"Orchestrators parse task items formatted as checkboxes from tasks.md.","workflows.title":"Workflows","workflows.subtitle":"Multi-agent workflows, dispatches, and logs","workflows.description":"Hive workflows are authored and run by the Orchestrator via team workflow run --stdin (recurring runs go through team workflow schedule). Native CLI subagents/workflows do not appear here; this panel observes Hive phases, workers, logs, and schedule controls.","workflows.recentRuns":"Recent runs","workflows.filterAll":"All","workflows.filterRunning":"Running","workflows.filterFailed":"Failed","workflows.emptyRuns":"No runs yet","workflows.emptyRunsDesc":"Ask the Orchestrator to run a Hive workflow for work that fans out across multiple workers.","workflows.emptyFilter":"No runs matching this filter.","workflows.schedules":"Schedules","workflows.noAgents":"No agent() calls in this run.","workflows.narrator":"Narrator ({count} lines)","workflows.narratorOne":"Narrator (1 line)","workflows.runError":"Run error: {error}","workflows.stopTooltip":"Stop run","workflows.deleteScheduleTooltip":"Delete schedule","workflows.pauseTooltip":"Pause","workflows.resumeTooltip":"Resume","workflows.loading":"Loading…","workflows.status.pending":"pending","workflows.status.running":"running","workflows.status.completed":"completed","workflows.status.failed":"failed","workflows.status.interrupted":"interrupted","workflows.status.stopped":"stopped","workflows.dispatchStatus.queued":"queued","workflows.dispatchStatus.submitted":"submitted","workflows.dispatchStatus.reported":"reported","workflows.dispatchStatus.cancelled":"cancelled","workflows.dispatchStatus.awaitingReport":"awaiting report…","workflows.cli.title":"Workflow agent CLI","workflows.cli.desc":"Which CLI a workflow agent launches when its script doesn't name one, and which CLIs are allowed. Custom role templates keep their own CLI.","workflows.cli.default":"Default","workflows.cli.allowed":"Allowed","workflows.cli.saving":"Saving…","workflows.cli.save":"Save","workflows.cli.pickOne":"Pick at least one CLI","workflows.cli.saved":"Saved","workflows.cli.failed":"Failed to save","welcome.addWorkspace":"Add your first Workspace","welcome.demo":"or try the demo (no install needed)","welcome.desc":"Coordinate Antigravity CLI, Claude Code, Codex, Gemini, OpenCode, Hermes, Qwen Code, Pi — locally.","welcome.step1Desc":"Pick a project folder.","welcome.step1Title":"Add a Workspace","welcome.step2Desc":"Antigravity / Claude / Codex / Gemini / OpenCode / Hermes / Qwen / Pi.","welcome.step2Title":"Choose an Orchestrator","welcome.step3Desc":"The Orchestrator routes work via team send.","welcome.step3Title":"Dispatch tasks","welcome.title":"Welcome to Hive","worker.deleteAria":"Delete team member {name}","worker.deleteConfirm":"Delete {name}?","worker.deleteDescription":"This stops {name}'s terminal and removes it from the workspace. All queued dispatches are dropped.","worker.deleteMember":"Delete member","worker.detail":"{name} detail","worker.closeOutsideHint":"Click outside the member window to close.","worker.emptyAdd":"Add your first member","worker.emptyDesc":"Add team members (Antigravity CLI, Claude Code, Codex, Gemini, OpenCode, Hermes, Qwen Code, Pi) and the Orchestrator will route tasks to them.","worker.emptyTitle":"No team members yet","worker.actionsAria":"Actions for {name}","worker.avatar":"Avatar","worker.avatarChange":"Change avatar","worker.avatarChangeAria":"Change avatar for {name}","worker.avatarDefault":"Use default","worker.avatarLoadFailed":"Could not load that image.","worker.avatarNotImage":"Choose a PNG, JPEG, or WebP image.","worker.avatarSourceTooLarge":"Choose an image under 5 MB.","worker.avatarTitle":"Change avatar","worker.avatarTooLarge":"Avatar image is too large.","worker.avatarUpload":"Upload image","worker.avatarHelpText":"Supports PNG, JPEG or WebP, up to 5 MB.","worker.avatarUsingDefault":"Using default avatar","worker.avatarUsingCustom":"Using custom avatar","worker.lastActivity":"Latest terminal output (a hint, not a reported reply).","worker.open":"Open {name}","worker.rename":"Rename","worker.renameAria":"Rename {name}","worker.restartAria":"Restart {name}","worker.renameDesc":"Pick a new display name. The agent's id and PTY are unchanged.","worker.renameFailed":"Rename failed: {message}","worker.renameSuccess":'Renamed to "{name}".',"worker.renameTitle":"Rename team member","worker.startAgent":"Start the agent to begin receiving dispatches.","worker.startAria":"Start {name}","worker.stopAria":"Stop {name}","worker.teamMembers":"Team members","worker.terminalNotStarted":"PTY not started yet — ","worker.terminalStopped":"PTY stopped — ","worker.widthResize":"Resize worker detail width","worker.workingLegend":"Working = busy or waiting for input. Hive doesn’t detect stalls automatically — open the terminal to check.","workerPane.resize":"Resize Orchestrator and Team Members panes","tasks.action.addSubtask":"Add subtask","tasks.action.backToList":"Back to list","tasks.action.closeTodo":"Close Tasks","tasks.action.copied":"Copied","tasks.action.copyLine":"Copy line","tasks.action.delete":"Delete","tasks.action.edit":"Edit","tasks.action.viewSource":"View source","tasks.aria.addSubtask":"Add subtask","tasks.aria.collapseSubtasks":"Collapse {count} subtasks","tasks.aria.copiedTaskLine":"Copied task line","tasks.aria.copyTaskLine":"Copy task line","tasks.aria.deleteTask":"Delete task","tasks.aria.drawer":"Tasks","tasks.aria.editTask":"Edit task","tasks.aria.expandSubtasks":"Expand {count} subtasks","tasks.aria.progress":"Task completion","tasks.button.addTask":"Add task","tasks.completed.toggle":"{count} completed","tasks.empty.description":"Ask the Orchestrator to split the work via team send/team spawn, or team workflow for staged or 3+ worker work — or add your first task to bootstrap .hive/tasks.md.","tasks.empty.title":"No tasks yet","tasks.placeholder.editTask":"Edit task","tasks.placeholder.newSubtask":"New subtask","tasks.placeholder.newTask":"What needs to be done?","tasks.progress.subtaskTitle":"{done} of {total} direct subtasks complete","tasks.raw.conflictDescription":"Reloading will discard the current draft; Keep local will continue editing it.","tasks.raw.conflictTitle":"File changed externally","tasks.raw.keepLocal":"Keep local","tasks.raw.label":"Tasks Markdown","tasks.raw.lineCount":"{count} lines","tasks.raw.reload":"Reload","tasks.raw.save":"Save tasks","tasks.title.todo":"Tasks","notifications.desktop.aria":"Browser notifications","notifications.desktop.helper":"Use system notifications when permission is granted.","notifications.desktop.label":"Browser notifications","notifications.desktop.unsupported":"Not supported in this browser.","notifications.detail.brief.description":"Compact status line","notifications.detail.brief.label":"Brief","notifications.detail.detailed.description":"Workspace and queue context","notifications.detail.detailed.label":"Detailed","notifications.detail.sectionLabel":"Information","notifications.settings.aria":"Notification settings","notifications.settings.heading":"Notifications","notifications.settings.subtitle":"Choose how Hive alerts you when team members report or stop.","notifications.settings.tooltip":"Notifications","notifications.sound.beacon.description":"Distinct question tone","notifications.sound.beacon.label":"Signal","notifications.sound.cascade.description":"Layered success tone","notifications.sound.cascade.label":"Cascade","notifications.sound.chime.description":"Clean glass tap","notifications.sound.chime.label":"Glass","notifications.sound.longerBadge":"longer","notifications.sound.off.description":"Mute sounds","notifications.sound.off.label":"Off","notifications.sound.ping.description":"Tiny UI tick","notifications.sound.ping.label":"Tap","notifications.sound.previewAria":"Preview {label} sound","notifications.sound.resolve.description":"Longer completion cue","notifications.sound.resolve.label":"Done","notifications.sound.sectionLabel":"Sound","notifications.sound.soft.description":"Warm default chime","notifications.sound.soft.label":"Soft","notifications.test.brief":"Hive notifications are working.","notifications.test.button":"Test","notifications.test.detail":"Hive notifications are working with your selected sound and detail level.","notifications.test.title":"Hive notification test","notifications.remoteSession.brief":"{name} connected","notifications.remoteSession.detail":"{name} established a remote session.","notifications.remoteSession.title":"Remote device connected","notifications.toast.blocked":"Browser notifications are blocked.","notifications.toast.declined":"Browser notifications were not enabled.","notifications.toast.unsupported":"This browser does not support notifications.","notifications.workerReported.brief":"{name} reported","notifications.workerReported.detail":"{name} reported in {workspace}.","notifications.workerReported.title":"Team member report","notifications.workerStarted.brief":"{name} started","notifications.workerStarted.detail":"{name} started in {workspace} as {role}.","notifications.workerStarted.title":"Team member started","notifications.workerStopped.brief":"{name} stopped","notifications.workerStopped.detail":"{name} stopped in {workspace}.","notifications.workerStopped.title":"Team member stopped","workspace.add.manualHint":"Type or paste the absolute path to a project folder on your computer.","workspace.advanced.browse":"Advanced: browse server filesystem","workspace.advanced.pastePath":"Advanced: paste path","workspace.advanced.settings":"Advanced Options","workspace.advanced.startup":"Advanced: custom startup command","workspace.browse.breadcrumb":"Breadcrumb","workspace.browse.drivesAria":"Show all drives","workspace.browse.drivesRoot":"This PC","workspace.browse.empty":"This directory is empty.","workspace.browse.gitBadge":"git","workspace.browse.openAria":"Open {name}","workspace.browse.parentAria":"Go to parent directory","workspace.browse.root":"root: {path}","workspace.browse.rootLoading":"(loading)","workspace.browse.selected":"Selected","workspace.browse.title":"Browse server filesystem","workspace.browse.up":"up","workspace.confirm.create":"Create Workspace","workspace.confirm.description":"Hive will load .hive/tasks.md and start the Orchestrator here.","workspace.confirm.title":"Add Workspace","workspace.error.createFailed":"Failed to create workspace","workspace.error.createTitle":"Could not create workspace","workspace.error.outsideSandbox":"Picked folder is not inside the Hive sandbox. Use paste path.","workspace.error.pastePathInstead":"Paste path instead","workspace.error.pickerFailed":"Folder picker failed","workspace.field.absolutePath":"Absolute path","workspace.field.absolutePathPlaceholder":"C:\\path\\to\\project or /absolute/path","workspace.field.name":"Workspace name","workspace.field.nameDefaultPlaceholder":"my-project","workspace.field.path":"Path","workspace.field.pathEmptyPlaceholder":"(no folder picked — use paste path below)","workspace.field.startup":"Startup command","workspace.field.startupPlaceholder":"claude --resume <session-id>","workspace.git.detached":"detached","workspace.git.detected":"git repository detected","workspace.git.none":"No git repository at this path.","workspace.git.noneShort":"no git","workspace.git.short":"git · {branch}","workspace.picking.message":"Opening system folder picker…","workspace.picking.title":"Opening folder picker","workspace.preset.label":"Orchestrator CLI","workspace.preset.generic":"Generic command","workspace.preset.genericPreview":"custom startup command only","workspace.preset.genericRequiresStartup":"Generic command requires a startup command.","workspace.preset.installCopy":"Copy","workspace.preset.installCopyAria":"Copy install command","workspace.preset.installDocs":"Install guide","workspace.preset.installHint":"Install {name}:","workspace.preset.loadFailed":"Failed to load CLI presets; using server default.","workspace.preset.loading":"Loading CLI presets…","workspace.preset.noneAvailable":"No supported CLI agent was found on this machine. You can watch the demo first — no install needed.","workspace.preset.notFoundSuffix":" (not found)","workspace.preset.notInstalled":"{name} is not installed. Choose another CLI or add a custom startup command.","workspace.preset.optionsAria":"Orchestrator CLI options","workspace.preset.pathHelpBody":"Hive detects CLIs using the PATH of the shell that launched it. With nvm or a GUI launcher, that PATH can differ from your terminal. Quit Hive and re-run `hive` from a terminal where this CLI works.","workspace.preset.pathHelpTitle":"Installed it, but still shown as not found?","workspace.preset.tryDemo":"Try the demo first","workspace.yolo.notice":"Agents start in auto-approve mode: CLI permission prompts are skipped (e.g. `--dangerously-skip-permissions`), so an agent can run commands and edit files as you. The Stop button on each card halts a runaway agent.","workspace.startup.hint":"Overrides the preset for this Orchestrator. Runs in the workspace directory through your shell (bash/zsh/fish on POSIX, cmd.exe on Windows), so only paste commands you trust.","workspace.startup.hintShort":"Runs through your shell in the workspace directory. Only paste commands you trust.","demo.orchestratorLabel":"Orchestrator — pre-recorded","demo.readOnlyBadge":"DEMO read-only","layout.sidebarAria":"Workspace sidebar","layout.sidebarResizeAria":"Resize Workspace sidebar","layout.sidebarCollapse":"Collapse sidebar","layout.sidebarExpand":"Expand sidebar","terminal.composer.placeholder":"Type a command…","terminal.composer.send":"Send","terminal.composer.sendEnter":"Send ⏎","terminal.paste.button":"Paste","terminal.paste.cancel":"Cancel","terminal.paste.confirm":"Paste","terminal.paste.denied":"Clipboard access was denied — long-press the input to paste instead.","terminal.paste.lengthChars":"{count} characters","terminal.paste.preview":"Preview","terminal.paste.title":"Paste into terminal?","terminal.renderer.canvasFallbackNotice":"WebGL unavailable — using the canvas renderer.","terminal.firstRunSetup":"Finish this CLI setup in the terminal, then Hive will send startup instructions.","terminal.scrollToBottom":"Jump to latest","terminal.statusConnecting":"Connecting","terminal.statusRunning":"Running","terminalPanel.closePanel":"Close terminal panel","terminalPanel.closeTab":"Close {name}","terminalPanel.maximize":"Maximize terminal panel","terminalPanel.newShell":"New shell","terminalPanel.resizeAria":"Resize terminal panel height","terminalPanel.restore":"Restore terminal panel","terminalPanel.tablistAria":"Workspace terminal tabs","terminalPanel.workerStopped":"{name} is stopped — start the member to attach a terminal.","terminalPanels.aria":"Terminal panels","toast.dismissAria":"Dismiss","whatsNew.gotIt":"Got it","whatsNew.subtitle":"Updates since you were last here","whatsNew.title":"What's New","whatsNew.versionLabel":"Version {version}","workspaceList.empty":"No Workspaces yet"},oC={"addWorker.agentCli":"Agent CLI","addWorker.agentNotFound":"未找到","addWorker.agentExists":"成员名字已存在","addWorker.cancel":"取消","addWorker.create":"添加成员","addWorker.creating":"创建中…","addWorker.customPlaceholder":"你是安全审查成员,重点关注鉴权和输入校验。用 team report 把发现交还给 Orchestrator。","addWorker.description":"选择角色和 CLI Agent。Orchestrator 会通过 {command} 分派任务。","addWorker.emptyInstructions":"补充角色说明","addWorker.enterName":"请输入名称","addWorker.genericAgent":"通用命令","addWorker.genericCommand":"仅使用启动命令","addWorker.loadingPresets":"正在加载预设…","addWorker.name":"名称","addWorker.namePlaceholder":"例如 鲁班","addWorker.modifiedFrom":"已修改 {role} 默认说明","addWorker.pickCliOrStartup":"请选择 CLI Agent,或填写启动命令","addWorker.random":"随机","addWorker.randomAria":"生成随机成员名","addWorker.randomTooltip":"随机来一个","addWorker.role":"角色","addWorker.roleInstructions":"角色说明","addWorker.roleInstructionsTitle":"会注入到 Agent 启动提示和每次派单中。Hive 的 team 协议保持不变,这里只影响角色行为。","addWorker.reset":"重置","addWorker.saveAsTemplate":"保存为模板","addWorker.startupCommand":"启动命令","addWorker.startupHelp":"可选。会在当前 Workspace 里通过当前 shell 运行(POSIX 上是 bash/zsh/fish,Windows 上是 cmd.exe)。适合自定义 Agent 或原生命令恢复会话,例如 {example}。","addWorker.startupOverrides":"覆盖 CLI 启动","addWorker.template":"已保存的模板","addWorker.templateClear":"不使用模板(空白 Custom)","addWorker.templateDeleteAria":"删除模板 {name}","addWorker.templateDeleteConfirm":'删除已保存的模板"{name}"?该操作无法撤销。',"addWorker.templateDeleteConfirmLabel":"删除","addWorker.templateDeleteTitle":"删除角色模板","addWorker.templateEmpty":"还没有已保存的模板。在下方填写角色说明并保存。","addWorker.templateNamePlaceholder":"模板名称","addWorker.templateNoMatch":"没有匹配的模板。","addWorker.templatePickPlaceholder":"选择已保存的模板…","addWorker.templateSaveConfirm":"保存","addWorker.templateSearchPlaceholder":"搜索模板","addWorker.title":"添加团队成员","addWorker.unavailable":"{name} 未安装","actionCenter.activity.cancelled":"{worker} 已取消 · {ago}","actionCenter.activity.queued":"{worker} 已接收任务 · {ago}","actionCenter.activity.reported":"{worker} 已汇报 · {ago}","actionCenter.activity.submitted":"{worker} 已开始 · {ago}","actionCenter.attention":"注意","actionCenter.attention.noWorkers":"还没有团队成员。","actionCenter.attention.remoteError":"远程请求在 {endpoint} 出错。","actionCenter.attention.remoteRejected":"远程请求在 {endpoint} 被拒绝:{reason}。","actionCenter.attention.stoppedWithQueue":"{worker} 已停止,但还有未处理任务。","actionCenter.attention.waitingReport":"{worker} 已等待汇报 {minutes} 分钟。","actionCenter.attentionSubtitle":"可能需要 Orchestrator 处理的阻塞、等待或远程错误。","actionCenter.allClear":"状态正常","actionCenter.collapse":"收起 Action Center","actionCenter.copyRecap":"复制战报","actionCenter.currentDispatch":"当前","actionCenter.expand":"展开 Action Center","actionCenter.latestReport":"汇报","actionCenter.loadFailed":"无法加载团队动态。","actionCenter.liveSnapshot":"实时快照","actionCenter.loading":"正在加载团队动态...","actionCenter.metrics":"Action Center 指标","actionCenter.needsAttention":"{count} 项需关注","actionCenter.noActivity":"暂无团队动态。","actionCenter.noAttention":"当前没有阻塞任务或远程错误。","actionCenter.noWorkerEvidence":"暂无活跃成员证据。","actionCenter.openDispatches":"打开的任务","actionCenter.recapCopied":"战报已复制到剪贴板。","actionCenter.recapCopyFailed":"复制战报失败。","actionCenter.recent":"最近","actionCenter.recentReports":"近期汇报","actionCenter.recentSubtitle":"按时间排列的派发、汇报和取消记录。","actionCenter.reportCount":"{count} 条汇报","actionCenter.runningCount":"{count} 个运行中","actionCenter.subtitle":"团队动态、打开任务与下一步调度需要的证据","actionCenter.terminalHint":"终端","actionCenter.title":"Action Center","actionCenter.totalWorkers":"团队成员","actionCenter.unknownWorker":"未知成员","actionCenter.updated":"更新于 {ago}","actionCenter.workingWorkers":"正在工作","actionCenter.workerStatus":"状态","actionCenter.workers":"成员","actionCenter.workersSubtitle":"当前任务、最新汇报与终端线索。","common.cancel":"取消","common.close":"关闭","common.dismiss":"关闭提示","common.never":"从未","common.error":"错误","common.closeDialog":"关闭对话框","common.time.sAgo":"{count} 秒前","common.time.mAgo":"{count} 分钟前","common.time.hAgo":"{count} 小时前","common.time.dAgo":"{count} 天前","common.copied":"已复制","common.copyError":"复制错误","common.delete":"删除","common.idle":"空闲","common.loading":"加载中…","common.refresh":"刷新","common.restart":"重启","common.retry":"重试","common.running":"运行中","common.save":"保存","common.saving":"保存中…","common.start":"启动","common.starting":"启动中…","common.stop":"停止","common.stopped":"已停止","common.working":"工作中","connect.login.failed":"登录失败——请检查网络后重试。","connect.login.heading":"连接到你的 Hive","connect.login.subtitle":"登录后即可访问你账号下正在运行 Hive 的电脑。","connect.login.github":"使用 GitHub 登录","connect.login.google":"使用 Google 登录","connect.login.signingIn":"登录中…","connect.machines.back":"返回","connect.machines.connecting":"连接中…","connect.machines.heading":"你的电脑","connect.machines.empty":"还没有电脑。在电脑上运行 Hive 并开启远程访问。","connect.machines.lastSeen":"{ago}前在线","connect.machines.manageDevices":"管理设备","connect.machines.offline":"离线","connect.machines.online":"在线","connect.machines.revoked":"访问已被吊销","connect.machines.revokedHint":"此设备的访问已被吊销——请输入新的配对码重新连接。","connect.machines.select":"连接","connect.pair.back":"返回","connect.pair.finalizing":"已确认——正在准备会话…","connect.pair.guideHeading":"配对这台手机","connect.pair.guideStep1":"在那台电脑上,打开 设置 → 远程访问。","connect.pair.guideStep2":"点击添加设备,并保持配对码可见。","connect.pair.guideStep3":"在下面输入那个配对码。","connect.pair.qrLabel":"配对码","connect.pair.sasInstruction":"在你的电脑上,打开 设置 → 远程访问,确认验证码一致后点击确认。","connect.pair.sasPrompt":"确认此验证码与电脑上显示的一致:","connect.pair.startOver":"重新开始","connect.pair.submit":"配对","connect.error.selectFailed":"无法连接那台电脑。你保存的会话可能已失效,或它已离线 —— 请在下方重新配对。","connect.error.invalidCode":"这个配对码看起来不对,请检查后重试。","demo.banner":"演示模式 — 本地交互回放。","demo.exit":"退出演示","demo.replaySubtitle":"本地回放规划、派单、汇报和任务闭环。","demo.replayTitle":"Hive 演示工作区","demo.tasksTitle":"任务图","demo.teamTitle":"团队","firstRun.addWorkspace":"添加 Workspace","firstRun.back":"返回","firstRun.desc":"在本地协调多个 CLI 编码 Agent。","firstRun.getStarted":"开始使用","firstRun.howItWorks":"工作方式","firstRun.next":"下一步","firstRun.optionDesc":"选择一个开始方式。","firstRun.slide1Desc":"选择一个项目目录。","firstRun.slide1Title":"添加 Workspace","firstRun.slide2Desc":"Antigravity CLI、Claude Code、Codex、Gemini、OpenCode、Hermes、Qwen Code、Pi,任选。","firstRun.slide2Title":"选择 Orchestrator","firstRun.slide3Desc":"Orchestrator 通过 `team send <worker> <task>` 向团队成员派单。","firstRun.slide3Title":"分派任务","firstRun.skip":"跳过","firstRun.skipForNow":"暂时跳过","firstRun.step":"第 {current} / {total} 步","firstRun.subtitle":"每个 Workspace 运行一个 Orchestrator,再把任务派给团队成员。","firstRun.title":"欢迎使用 Hive","firstRun.tryDemo":"试用演示","language.aria":"切换语言","language.currentEn":"EN","language.currentZh":"中","language.en":"EN","language.switchToEn":"切换语言到 English","language.switchToZh":"切换语言到中文","language.tooltip":"语言","language.zh":"中文","marketplace.allCategories":"全部","marketplace.backToList":"返回列表","marketplace.close":"关闭模板市场","marketplace.empty":"没有匹配的角色","marketplace.importButton":"填入表单","marketplace.importedBadge":"本地已有同名模板","marketplace.loading":"加载中…","marketplace.imported":"已把 {name} 填入表单","marketplace.loadFailed":"加载失败","marketplace.openFromAddWorker":"从模板市场选择","marketplace.searchPlaceholder":"搜索角色…","marketplace.showAllCategories":"显示其他 {count} 个分类","marketplace.showCoreOnly":"只看核心分类","marketplace.sourceLabel":"由 {repo} 提供","marketplace.title":"模板市场","marketplace.viewSource":"在 GitHub 查看","mobile.nav.aria":"主导航","mobile.focus.enter":"专注终端(隐藏导航)","mobile.focus.exit":"显示导航","mobile.nav.flows":"工作流","mobile.nav.more":"更多","mobile.nav.settings":"设置","mobile.nav.tasks":"任务","mobile.nav.team":"团队","mobile.reconnect.disconnected":"已断开。","mobile.reconnect.reconnecting":"正在重新连接…","mobile.reconnect.retry":"重试","mobile.reconnect.revoked":"访问已被吊销——请在电脑上重新配对此设备。","mobile.section.about":"关于","mobile.section.demo":"演示","mobile.section.devices":"设备","mobile.section.settings":"设置","mobile.section.workflows":"工作流","mobile.section.workspaces":"工作区","mobile.tasks.noWorkspaceDesc":"选择或添加一个工作区即可查看其任务图。","mobile.tasks.noWorkspaceTitle":"未选择工作区","mobile.team.orchestrator":"Orchestrator","mobile.team.workers":"成员","mobile.workspaces.switch":"切换工作区","openWorkspace.error.appNotInstalled":"未找到 {app},请确认已安装并可启动。","openWorkspace.error.commandNotInPath":"{app} 的命令行入口不可用,请把它的 CLI 加入 PATH 后重试。","openWorkspace.error.invalidPath":"workspace 路径包含无法安全启动的字符。","openWorkspace.error.invalidTarget":"该应用已不在支持的打开目标列表里。","openWorkspace.error.unknown":"在 {app} 中打开失败。","openWorkspace.noWorkspace":"请先选择一个 workspace","openWorkspace.open":"打开","openWorkspace.opened":"已在你的电脑上用 {app} 打开 {workspace}","openWorkspace.openIn":"用 {app} 打开 {workspace}","openWorkspace.openInAria":"用 {app} 打开 workspace {workspace}","openWorkspace.selectTarget":"选择应用","openWorkspace.target.cursor":"Cursor","openWorkspace.target.finder.linux":"文件管理器","openWorkspace.target.finder.mac":"访达","openWorkspace.target.finder.windows":"文件资源管理器","openWorkspace.target.ghostty":"Ghostty","openWorkspace.target.terminal":"终端","openWorkspace.target.vscode":"VS Code","openWorkspace.target.vscodeInsiders":"VS Code Insiders","openWorkspace.target.zed":"Zed","packageUpdate.body":"当前运行的是 v{current}。准备好后再升级,Hive 会继续运行。","packageUpdate.commandCopied":"命令已复制","packageUpdate.commandCopyFailed":"复制命令失败","packageUpdate.copyCommand":"复制命令","packageUpdate.later":"稍后","packageUpdate.openRelease":"查看版本说明","packageUpdate.release":"版本说明","packageUpdate.title":"Hive v{version} 可用","orchestrator.copyErrorAria":"复制错误信息","orchestrator.failed":"Orchestrator 启动失败","orchestrator.removeWorkspace":"移除 workspace","orchestrator.start":"启动 Orchestrator","orchestrator.stop":"停止 Orchestrator","orchestrator.startingDesc":"正在准备 Orchestrator 终端。","orchestrator.startingTitle":"Orchestrator 启动中","orchestrator.stoppedDesc":"启动 Orchestrator 后才能规划任务并分派给团队成员。","orchestrator.stoppedTitle":"Orchestrator 已停止","role.coder":"开发","role.custom":"自定义","role.reviewer":"审查","role.tester":"测试","runtime.retryNow":"立即重试","runtime.staleBody":"重新连接本地后端前,写操作已暂停。","runtime.staleTitle":"Hive 后端连接已断开","runtime.writeDisabled":"Hive 后端连接已断开,恢复后再重试。","sidebar.deleteAria":"删除 Workspace {name}","sidebar.deleteConfirm":'删除 Workspace "{name}"?',"sidebar.deleteDescription":"这会停止其中的 Agent,并从 Hive 移除它。磁盘目录({path})不会被删除。{summary}。","sidebar.deleteFailed":"删除失败:{message}","sidebar.deleteLabel":"删除 Workspace","sidebar.deleting":"删除中…","sidebar.dismissRepository":"隐藏 GitHub 链接","sidebar.noMembers":"还没有团队成员","sidebar.newWorkspace":"新建 Workspace","sidebar.noWorkspaces":"还没有 Workspace","sidebar.noWorkspacesDesc":"添加一个开始使用。Hive 会加载 .hive/tasks.md 并启动 Orchestrator。","sidebar.oneWorking":"1 个团队成员工作中","sidebar.demoVideo":"演示视频","sidebar.openDemoVideo":"观看 Hive 演示视频","sidebar.openRepository":"打开 Hive GitHub 仓库","sidebar.removed":'已移除 Workspace "{name}"。',"sidebar.teamMemberCount":"{count} 个团队成员","sidebar.workingCount":"{working} / {total} 工作中","sidebar.workingMembers":"{count} 个团队成员工作中","sidebar.workspaces":"Workspaces","shellTerminal.closeFailed":"关闭 shell 失败:{message}","shellTerminal.open":"终端","shellTerminal.openAria":"打开 workspace 终端","pairing.awaitingConfirm":"在电脑上确认以完成配对。","pairing.cancel":"取消","pairing.connecting":"正在连接你的电脑…","pairing.failed.expired":"配对已过期——请重新开始。","pairing.failed.mintForbidden":"电脑端尚未确认此次配对。","pairing.failed.rejected":"配对被拒绝。","pairing.failed.socket":"配对完成前连接已断开。","pairing.failed.version":"手机与电脑版本不一致。","pairing.handshaking":"校验中…","pairing.paired":"已配对。","pairing.sasPrompt":"请核对此验证码与电脑上显示的一致:","pwa.appShellUpdated":"Web UI 已更新","pwa.reloadToActivate":"刷新以应用","pwa.reloading":"正在刷新…","pwa.runtimeOffline.autoReconnect":"已开启自动重连——后端恢复后会自动刷新。","pwa.runtimeOffline.body":"在终端运行 `hive` 启动后端。","pwa.runtimeOffline.retry":"立即重试","pwa.runtimeOffline.retrying":"重试中…","pwa.runtimeOffline.title":"Hive 后端未启动","pwa.runtimeOffline.tryDemo":"改试用演示","pwa.waitForAgents":"等待 Agent 完成","remote.addDevice":"添加设备","remote.audit.bytes":"{count} 字节","remote.audit.empty":"还没有远程活动。","remote.audit.heading":"远程活动","remote.audit.hide":"隐藏活动","remote.audit.loadFailed":"无法加载活动记录。","remote.audit.result.error":"错误","remote.audit.result.ok":"成功","remote.audit.result.rejected":"已拒绝","remote.audit.show":"查看活动","remote.connect.connecting":"连接中…","remote.connect.disconnected":"已断开","remote.connect.online":"已连接","remote.connect.reconnecting":"重连中…","remote.connect.sessionExpired":"会话已过期 —— 请重新登录。","remote.confirm.confirm":"确认","remote.confirm.confirming":"确认中…","remote.confirm.description":"一台手机正尝试以“{name}”配对。请把这个码和手机上显示的对比 —— 两者必须一致。","remote.confirm.expired":"配对请求已过期。","remote.confirm.failed":"无法完成 —— 请重新配对。","remote.confirm.paired":"已配对“{name}”。","remote.confirm.reject":"拒绝","remote.confirm.rejected":"已拒绝配对。","remote.confirm.sasLabel":"校验码","remote.confirm.title":"确认新设备","remote.confirm.warning":"仅在你发起配对且两个码一致时确认。","remote.devices.activeNow":"刚刚活跃","remote.devices.empty":"还没有已配对的设备。","remote.devices.heading":"已配对设备","remote.devices.lastActive":"{ago}前活跃","remote.devices.loadFailed":"无法加载设备列表。","remote.devices.neverActive":"尚未活跃","remote.devices.revoke":"吊销","remote.devices.revokeAria":"吊销设备 {name}","remote.devices.revokeConfirm":"吊销“{name}”?它的会话会立即断开,需要重新配对。","remote.devices.revokeFailed":"吊销失败 —— 请重试。","remote.devices.revokeTitle":"吊销设备","remote.devices.revoked":"已吊销“{name}”。","remote.diagnostics.copy":"复制诊断信息","remote.diagnostics.copied":"诊断信息已复制","remote.diagnostics.copyFailed":"无法复制诊断信息。","remote.diagnostics.copying":"正在复制...","remote.retention.activeDays":"活跃天数","remote.retention.loadFailed":"无法加载本地留存信号。","remote.retention.localOnly":"仅本地","remote.retention.reports":"汇报","remote.retention.sends":"派单","remote.retention.streak":"当前连续天数","remote.retention.title":"协议活动","remote.disable.confirmBody":"远程设备(包括本设备)将立即断开。只能在桌面端重新开启。","remote.disable.confirmTitle":"关闭远程访问?","remote.enable.description":"通过端到端加密隧道从手机访问这台机器。默认关闭。","remote.enable.label":"远程访问","remote.qr.cancel":"取消","remote.qr.expired":"配对码已过期 —— 请重新生成。","remote.qr.expiresIn":"{seconds} 秒后过期","remote.qr.instructions":"在手机上输入这个配对码。在这里确认前请保持打开。","remote.qr.regenerate":"重新生成","remote.qr.startFailed":"无法开始配对 —— 请重试。","remote.qr.title":"配对码","remote.section":"远程访问","remote.status.connected":"隧道已连接","remote.status.disconnected":"隧道离线","remote.status.linked":"已连接到 {gateway}","remote.status.notLinked":"未连接 —— 在终端运行 `hive remote login`。","remote.status.connecting":"正在连接网关…","remote.status.reconnecting":"正在重连…","remote.status.revoked":"访问已被吊销 —— 重新连接以恢复远程访问。","scenario.applied":"团队已组建,目标已交给 Orchestrator","scenario.apply":"组队并开工","scenario.applying":"组队中…","scenario.build_review_test.desc":"Coder + Reviewer + Tester,实现—审查—验证闭环。","scenario.build_review_test.title":"开发 · 审查 · 测试","scenario.cancel":"取消","scenario.docs_pipeline.desc":"起草成员成文,审稿成员核对事实与表达。","scenario.docs_pipeline.title":"文档流水线","scenario.goalHint":"将以你的名义发给 Orchestrator——由它拆解任务并用 team send 派单。","scenario.goalLabel":"目标","scenario.research_factcheck.desc":"调研员收集带出处的发现,核查员逐条复核。","scenario.research_factcheck.title":"调研与核查","scenario.sectionTitle":"或从场景一键组队","settings.aria":"设置","settings.autostaff.description":"让 Orchestrator 按任务自动配置团队规模,动态补充合适的开发、测试和审查成员。默认开启。","settings.autostaff.label":"自动组队","settings.experimental":"实验性功能","settings.language":"语言","settings.heading":"设置","settings.notifications":"通知","settings.subtitle":"功能开关、Webhook 和远程访问。","settings.saveError":"保存失败 —— 检查 runtime 连接后重试。","settings.tooltip":"设置","settings.webhook.description":"worker 汇报或 workflow 完成时,向此 URL POST 一小段 JSON —— 可接入 Slack、ntfy、飞书等。尽力投递;runtime 会发往你填的任意 URL,请妥善保管。","settings.webhook.label":"完成通知 Webhook","settings.webhook.saved":"已保存","settings.workflows.description":"允许 orchestrator 编写并运行多 agent 工作流(team workflow)。默认关闭。","settings.workflows.label":"工作流","topbar.hideTodo":"隐藏任务","topbar.openWebsite":"访问官网 hivehq.dev","topbar.showTodo":"显示任务 (.hive/tasks.md)","topbar.todo":"任务","topbar.todoOpen":"任务 — {count} 个未完成","topbar.copyUpdateCommand":"复制更新命令","topbar.openRelease":"查看版本","topbar.updateAvailable":"有新版本","topbar.updateCommandCopied":"已复制更新命令","topbar.updateCommandCopyFailed":"复制更新命令失败","topbar.hideMemory":"隐藏记忆","topbar.showMemory":"显示记忆","topbar.memory":"记忆","topbar.hideWorkflows":"隐藏工作流","topbar.showWorkflows":"显示工作流","topbar.workflows":"工作流","memory.title":"记忆","memory.subtitle":"工作区知识积累与 Dream 运行审计","memory.searchPlaceholder":"搜索记忆...","memory.tabActive":"活跃中","memory.tabArchived":"已归档","memory.tabDreams":"Dream 运行记录","memory.runNow":"立即运行","memory.emptyActive":"暂无记忆条目","memory.emptyActiveDesc":"当 Orchestrator 添加记忆或 Dream 提取出知识后,此处会显示记录。","memory.emptyDreams":"暂无 Dream 运行记录","memory.emptyDreamsDesc":"在执行手动或定时的 Dream 优化后,此处将展示运行历史。","memory.archiveTitle":"归档记忆","memory.archiveDesc":"归档后的记忆将不再注入到启动、恢复以及 dispatch 阶段。","memory.archiveButton":"归档","memory.revertTitle":"撤销 Dream 运行","memory.revertDesc":"这将恢复由选定的 Dream 运行所修改的记忆行,并归档其新添加的条目。","memory.revertButton":"撤销","memory.sources":"来源证据","memory.noSources":"暂无来源证据。","memory.updated":"更新于 {time}","memory.injected":"注入于 {time}","memory.started":"启动于 {time}","memory.finished":"结束于 {time}","memory.revertTooltip":"撤销 Dream 运行效果","memory.status.pending":"待处理","memory.status.running":"进行中","memory.status.completed":"已完成","memory.status.failed":"已失败","memory.status.reverted":"已撤销","memory.trigger.manual":"手动触发","memory.trigger.cron":"定时计划","memory.trigger.scheduled":"定时计划","memory.noReport":"无报告","memory.noInput":"无输入","memory.seq":"序列号","memory.reportAdded":"新增","memory.reportRewritten":"已重写","memory.reportArchived":"已归档","memory.reportMerged":"已合并","memory.diff.added":"新增知识","memory.diff.rewritten":"重写知识","memory.diff.archived":"归档知识","memory.diff.merged":"合并知识","memory.pinned":"已置顶","memory.scopeUser":"用户偏好","memory.disabled":"已禁用","memory.unpinTooltip":"取消置顶","memory.pinTooltip":"置顶","memory.enableTooltip":"启用","memory.disableTooltip":"禁用","memory.entries":"条记录","memory.runs":"次运行记录","memory.kind.decision":"决议","memory.kind.fact":"事实","memory.kind.pitfall":"踩坑避雷","memory.kind.preference":"偏好","memory.kind.procedure_ref":"流程步骤","tasks.title":"任务清单","tasks.subtitle":"解析自项目内 .hive/tasks.md 的代办任务图","tasks.editMarkdown":"编辑 Markdown","tasks.save":"保存","tasks.local":"保留本地","tasks.reload":"重新加载","tasks.noTasks":"暂无任务条目","tasks.noTasksDesc":"Orchestrator 会从 tasks.md 中解析出复选框格式的任务项。","workflows.title":"工作流","workflows.subtitle":"多 Agent 工作流、分派任务与运行日志","workflows.description":"Hive 工作流由 Orchestrator 通过 team workflow run --stdin 编写并运行(循环任务会经过 team workflow schedule)。当前 CLI 内建的 subagent/workflow 不会出现在这里;此面板只观察 Hive 阶段、成员、日志和定时计划。","workflows.recentRuns":"最近运行","workflows.filterAll":"全部","workflows.filterRunning":"运行中","workflows.filterFailed":"已失败","workflows.emptyRuns":"暂无运行记录","workflows.emptyRunsDesc":"让 Orchestrator 为需要多个成员并行的任务启动 Hive workflow。","workflows.emptyFilter":"没有与此过滤条件匹配的运行记录。","workflows.schedules":"定时计划","workflows.noAgents":"本次运行没有调用任何 agent()。","workflows.narrator":"叙述器(共 {count} 行)","workflows.narratorOne":"叙述器(共 1 行)","workflows.runError":"运行错误:{error}","workflows.stopTooltip":"停止运行","workflows.deleteScheduleTooltip":"删除定时计划","workflows.pauseTooltip":"暂停","workflows.resumeTooltip":"恢复","workflows.loading":"加载中…","workflows.status.pending":"待处理","workflows.status.running":"运行中","workflows.status.completed":"已完成","workflows.status.failed":"已失败","workflows.status.interrupted":"已中断","workflows.status.stopped":"已停止","workflows.dispatchStatus.queued":"待派发","workflows.dispatchStatus.submitted":"提交中","workflows.dispatchStatus.reported":"已报告","workflows.dispatchStatus.cancelled":"已取消","workflows.dispatchStatus.awaitingReport":"等待报告…","workflows.cli.title":"工作流 Agent 运行环境 (CLI)","workflows.cli.desc":"设置工作流中未指定运行环境的 Agent 默认使用的 CLI,以及允许被工作流调用的 CLI 列表。自定义成员模板使用其自身的 CLI 设定。","workflows.cli.default":"默认运行环境","workflows.cli.allowed":"允许调用的环境","workflows.cli.saving":"保存中…","workflows.cli.save":"保存","workflows.cli.pickOne":"请至少选择一个 CLI","workflows.cli.saved":"保存成功","workflows.cli.failed":"保存失败","welcome.addWorkspace":"添加第一个 Workspace","welcome.demo":"或试用演示(无需安装 CLI)","welcome.desc":"在本地协调 Antigravity CLI、Claude Code、Codex、Gemini、OpenCode、Hermes、Qwen Code、Pi。","welcome.step1Desc":"选择一个项目目录。","welcome.step1Title":"添加 Workspace","welcome.step2Desc":"Antigravity / Claude / Codex / Gemini / OpenCode / Hermes / Qwen / Pi。","welcome.step2Title":"选择 Orchestrator","welcome.step3Desc":"Orchestrator 通过 team send 分派任务。","welcome.step3Title":"分派任务","welcome.title":"欢迎使用 Hive","worker.deleteAria":"删除团队成员 {name}","worker.deleteConfirm":"删除 {name}?","worker.deleteDescription":"这会停止 {name} 的终端,并从 workspace 中移除它。未处理任务会被丢弃。","worker.deleteMember":"删除成员","worker.detail":"{name} 详情","worker.closeOutsideHint":"点击成员窗口外任意区域关闭。","worker.emptyAdd":"添加第一个成员","worker.emptyDesc":"添加团队成员(Antigravity CLI、Claude Code、Codex、Gemini、OpenCode、Hermes、Qwen Code、Pi),Orchestrator 会分派任务。","worker.emptyTitle":"还没有团队成员","worker.actionsAria":"{name} 的操作","worker.avatar":"头像","worker.avatarChange":"更换头像","worker.avatarChangeAria":"更换 {name} 的头像","worker.avatarDefault":"使用默认","worker.avatarLoadFailed":"无法读取这张图片。","worker.avatarNotImage":"请选择 PNG、JPEG 或 WebP 图片。","worker.avatarSourceTooLarge":"请选择 5 MB 以内的图片。","worker.avatarTitle":"更换头像","worker.avatarTooLarge":"头像图片过大。","worker.avatarUpload":"上传图片","worker.avatarHelpText":"支持 PNG、JPEG 或 WebP 图片,5 MB 以内。","worker.avatarUsingDefault":"已应用默认头像","worker.avatarUsingCustom":"已应用自定义头像","worker.lastActivity":"终端最新输出(仅供参考,不是汇报内容)。","worker.open":"打开 {name}","worker.rename":"重命名","worker.renameAria":"重命名 {name}","worker.restartAria":"重启 {name}","worker.renameDesc":"选择新的显示名称。Agent id 和终端不会变化。","worker.renameFailed":"重命名失败:{message}","worker.renameSuccess":'已重命名为 "{name}"。',"worker.renameTitle":"重命名团队成员","worker.startAgent":"启动 Agent 后即可接收派单。","worker.startAria":"启动 {name}","worker.stopAria":"停止 {name}","worker.teamMembers":"团队成员","worker.terminalNotStarted":"终端未启动 — ","worker.terminalStopped":"终端已停止 — ","worker.widthResize":"调整成员详情宽度","worker.workingLegend":"工作中 = 忙碌或等待输入。Hive 不会自动检测卡死 —— 打开终端查看。","workerPane.resize":"调整 Orchestrator 和团队成员面板宽度","tasks.action.addSubtask":"添加子任务","tasks.action.backToList":"返回列表","tasks.action.closeTodo":"关闭任务清单","tasks.action.copied":"已复制","tasks.action.copyLine":"复制行","tasks.action.delete":"删除","tasks.action.edit":"编辑","tasks.action.viewSource":"查看源码","tasks.aria.addSubtask":"添加子任务","tasks.aria.collapseSubtasks":"折叠 {count} 个子任务","tasks.aria.copiedTaskLine":"已复制任务行","tasks.aria.copyTaskLine":"复制任务行","tasks.aria.deleteTask":"删除任务","tasks.aria.drawer":"任务清单","tasks.aria.editTask":"编辑任务","tasks.aria.expandSubtasks":"展开 {count} 个子任务","tasks.aria.progress":"任务完成度","tasks.button.addTask":"添加任务","tasks.completed.toggle":"{count} 个已完成","tasks.empty.description":"让 Orchestrator 拆分任务并用 team send/team spawn 派给成员,或手动加第一条任务来创建 .hive/tasks.md。","tasks.empty.title":"还没有任务","tasks.placeholder.editTask":"编辑任务","tasks.placeholder.newSubtask":"新建子任务","tasks.placeholder.newTask":"下一步要做什么?","tasks.progress.subtaskTitle":"已完成 {done} / {total} 个直接子任务","tasks.raw.conflictDescription":"重新载入会丢弃当前草稿;保留本地会继续编辑当前内容。","tasks.raw.conflictTitle":"文件已在外部变化","tasks.raw.keepLocal":"保留本地","tasks.raw.label":"任务 Markdown","tasks.raw.lineCount":"{count} 行","tasks.raw.reload":"重新载入","tasks.raw.save":"保存任务","tasks.title.todo":"任务","notifications.desktop.aria":"浏览器通知","notifications.desktop.helper":"授权后使用系统通知。","notifications.desktop.label":"浏览器通知","notifications.desktop.unsupported":"此浏览器不支持。","notifications.detail.brief.description":"一行状态摘要","notifications.detail.brief.label":"简略","notifications.detail.detailed.description":"包含 Workspace 和队列信息","notifications.detail.detailed.label":"详细","notifications.detail.sectionLabel":"信息","notifications.settings.aria":"通知设置","notifications.settings.heading":"通知","notifications.settings.subtitle":"选择团队成员汇报或停止时 Hive 的提醒方式。","notifications.settings.tooltip":"通知","notifications.sound.beacon.description":"清晰的提示音","notifications.sound.beacon.label":"信号","notifications.sound.cascade.description":"层次更丰富的完成音","notifications.sound.cascade.label":"瀑布","notifications.sound.chime.description":"干净的玻璃轻点","notifications.sound.chime.label":"玻璃","notifications.sound.longerBadge":"更长","notifications.sound.off.description":"静音","notifications.sound.off.label":"关闭","notifications.sound.ping.description":"很短的界面轻点","notifications.sound.ping.label":"轻点","notifications.sound.previewAria":"试听 {label} 声音","notifications.sound.resolve.description":"更长的完成提示","notifications.sound.resolve.label":"完成","notifications.sound.sectionLabel":"声音","notifications.sound.soft.description":"温和的默认提示","notifications.sound.soft.label":"轻柔","notifications.test.brief":"Hive 通知正常工作。","notifications.test.button":"测试","notifications.test.detail":"Hive 通知按你选择的声音和详情级别正常工作。","notifications.test.title":"Hive 通知测试","notifications.remoteSession.brief":"{name} 已连接","notifications.remoteSession.detail":"{name} 建立了远程会话。","notifications.remoteSession.title":"远程设备已连接","notifications.toast.blocked":"浏览器通知被屏蔽。","notifications.toast.declined":"未启用浏览器通知。","notifications.toast.unsupported":"此浏览器不支持通知。","notifications.workerReported.brief":"{name} 已汇报","notifications.workerReported.detail":"{name} 已在 {workspace} 汇报。","notifications.workerReported.title":"团队成员汇报","notifications.workerStarted.brief":"{name} 已启动","notifications.workerStarted.detail":"{name} 已在 {workspace} 以 {role} 角色启动。","notifications.workerStarted.title":"团队成员已启动","notifications.workerStopped.brief":"{name} 已停止","notifications.workerStopped.detail":"{name} 已在 {workspace} 停止。","notifications.workerStopped.title":"团队成员已停止","workspace.add.manualHint":"输入或粘贴你电脑上某个项目文件夹的绝对路径。","workspace.advanced.browse":"高级:浏览服务器文件系统","workspace.advanced.pastePath":"高级:粘贴路径","workspace.advanced.settings":"高级选项","workspace.advanced.startup":"高级:自定义启动命令","workspace.browse.breadcrumb":"面包屑","workspace.browse.drivesAria":"显示所有磁盘","workspace.browse.drivesRoot":"此电脑","workspace.browse.empty":"此目录为空。","workspace.browse.gitBadge":"git","workspace.browse.openAria":"打开 {name}","workspace.browse.parentAria":"返回上级目录","workspace.browse.root":"根目录:{path}","workspace.browse.rootLoading":"(加载中)","workspace.browse.selected":"已选择","workspace.browse.title":"浏览服务器文件系统","workspace.browse.up":"上级","workspace.confirm.create":"创建 Workspace","workspace.confirm.description":"Hive 会在此加载 .hive/tasks.md 并启动 Orchestrator。","workspace.confirm.title":"添加 Workspace","workspace.error.createFailed":"创建 Workspace 失败","workspace.error.createTitle":"无法创建 Workspace","workspace.error.outsideSandbox":"所选目录不在 Hive 沙盒内,请改用粘贴路径。","workspace.error.pastePathInstead":"改为粘贴路径","workspace.error.pickerFailed":"目录选择失败","workspace.field.absolutePath":"绝对路径","workspace.field.absolutePathPlaceholder":"C:\\path\\to\\project 或 /absolute/path","workspace.field.name":"Workspace 名称","workspace.field.nameDefaultPlaceholder":"my-project","workspace.field.path":"路径","workspace.field.pathEmptyPlaceholder":"(未选择目录 — 请使用下方粘贴路径)","workspace.field.startup":"启动命令","workspace.field.startupPlaceholder":"claude --resume <session-id>","workspace.git.detached":"游离 HEAD","workspace.git.detected":"检测到 git 仓库","workspace.git.none":"此路径下没有 git 仓库。","workspace.git.noneShort":"无 git","workspace.git.short":"git · {branch}","workspace.picking.message":"正在打开系统目录选择器…","workspace.picking.title":"正在打开目录选择器","workspace.preset.label":"Orchestrator CLI","workspace.preset.generic":"通用命令","workspace.preset.genericPreview":"仅使用自定义启动命令","workspace.preset.genericRequiresStartup":"通用命令需要填写启动命令。","workspace.preset.installCopy":"复制","workspace.preset.installCopyAria":"复制安装命令","workspace.preset.installDocs":"安装指南","workspace.preset.installHint":"安装 {name}:","workspace.preset.loadFailed":"加载 CLI 预设失败,使用服务器默认值。","workspace.preset.loading":"正在加载 CLI 预设…","workspace.preset.noneAvailable":"本机未检测到任何支持的 CLI agent。可以先看演示,无需安装。","workspace.preset.notFoundSuffix":"(未找到)","workspace.preset.notInstalled":"{name} 未安装。请选择其他 CLI 或填写启动命令。","workspace.preset.optionsAria":"Orchestrator CLI 选项","workspace.preset.pathHelpBody":"Hive 用启动它的那个 shell 的 PATH 探测 CLI。使用 nvm 或从图形界面启动时,该 PATH 可能与你的终端不同。请退出 Hive,在装有该 CLI 的终端里重新运行 `hive`。","workspace.preset.pathHelpTitle":"装了却显示未找到?","workspace.preset.tryDemo":"先看演示","workspace.yolo.notice":"Agent 默认以自动批准模式运行:CLI 的权限确认会被跳过(如 `--dangerously-skip-permissions`),agent 可以像你本人一样执行命令、修改文件。每张卡片上的 Stop 按钮可随时叫停失控的 agent。","workspace.startup.hint":"覆盖该 Orchestrator 的预设。通过当前 shell(POSIX 上是 bash/zsh/fish,Windows 上是 cmd.exe)在 Workspace 目录中运行,请只粘贴你信任的命令。","workspace.startup.hintShort":"通过当前 shell 在 Workspace 目录中运行。请只粘贴你信任的命令。","demo.orchestratorLabel":"Orchestrator — 预录数据","demo.readOnlyBadge":"演示 只读","layout.sidebarAria":"Workspace 侧栏","layout.sidebarResizeAria":"调整 Workspace 侧栏宽度","layout.sidebarCollapse":"收起侧栏","layout.sidebarExpand":"展开侧栏","terminal.composer.placeholder":"输入命令…","terminal.composer.send":"发送","terminal.composer.sendEnter":"发送 ⏎","terminal.paste.button":"粘贴","terminal.paste.cancel":"取消","terminal.paste.confirm":"粘贴","terminal.paste.denied":"剪贴板访问被拒绝——请长按输入框粘贴。","terminal.paste.lengthChars":"共 {count} 个字符","terminal.paste.preview":"预览","terminal.paste.title":"粘贴到终端?","terminal.renderer.canvasFallbackNotice":"WebGL 不可用——已改用 canvas 渲染器。","terminal.firstRunSetup":"请先在终端完成该 CLI 的首次设置,随后 Hive 会发送启动指令。","terminal.scrollToBottom":"回到底部","terminal.statusConnecting":"连接中","terminal.statusRunning":"运行中","terminalPanel.closePanel":"关闭终端面板","terminalPanel.closeTab":"关闭 {name}","terminalPanel.maximize":"最大化终端面板","terminalPanel.newShell":"新建 shell","terminalPanel.resizeAria":"调整终端面板高度","terminalPanel.restore":"还原终端面板","terminalPanel.tablistAria":"Workspace 终端标签","terminalPanel.workerStopped":"{name} 已停止——启动该成员后会自动连接终端。","terminalPanels.aria":"终端面板","toast.dismissAria":"关闭","whatsNew.gotIt":"知道了","whatsNew.subtitle":"上次使用以来的更新","whatsNew.title":"更新内容","whatsNew.versionLabel":"版本 {version}","workspaceList.empty":"还没有 Workspace"},sC={en:b0,zh:oC},iC=()=>{if(typeof window>"u")return"en";const t=lC();return t||(window.navigator.language.toLowerCase().startsWith("zh")?"zh":"en")},lC=()=>{try{const t=window.localStorage.getItem(y0);return rC(t)?t:null}catch{return null}},cC=t=>{try{window.localStorage.setItem(y0,t)}catch{}},w0=t=>(a,o={})=>(sC[t][a]??b0[a]??a).replace(/\{(\w+)\}/g,(l,u)=>{const f=o[u];return f===void 0?l:String(f)}),uC={language:"en",setLanguage:()=>{},t:w0("en")},x0=y.createContext(uC),dC=({children:t})=>{const[a,o]=y.useState(iC),s=y.useMemo(()=>({language:a,setLanguage:u=>{o(u),cC(u)},t:w0(a)}),[a]);return c.jsx(x0.Provider,{value:s,children:t})},be=()=>y.useContext(x0),fC=({onExit:t})=>{const{t:a}=be();return c.jsxs("section",{"aria-label":"Demo mode","data-testid":"demo-banner",className:"flex shrink-0 items-center justify-between border-b px-4 py-2 text-xs",style:{background:"var(--status-yellow-bg, #3a2c1c)",borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex items-center gap-2 text-pri",children:[c.jsx(p0,{size:14,"aria-hidden":!0}),c.jsx("span",{children:a("demo.banner")})]}),c.jsx("button",{type:"button",onClick:t,className:"icon-btn icon-btn--ghost",children:a("demo.exit")})]})},Rl=[{label:"Plan",terminal:["$ hive demo","Orchestrator: turning the request into .hive/tasks.md","$ team spawn coder --name ada-lovelace","$ team spawn reviewer --name socrates"],doneTasks:1,workerStates:["idle","idle"]},{label:"Dispatch",terminal:['$ team send ada-lovelace "Implement POST /todos with SQLite persistence"',"Hive: dispatch queued and delivered to ada-lovelace","ada-lovelace: editing src/routes/todos.ts"],doneTasks:2,workerStates:["working","idle"]},{label:"Report",terminal:['ada-lovelace: team report "POST /todos implemented; tests added"',"Orchestrator: marking implementation done, sending review",'$ team send socrates "Review todo endpoint and tests"'],doneTasks:3,workerStates:["idle","working"]},{label:"Close",terminal:['socrates: team report "No blocker; one naming nit fixed"',"Orchestrator: validation complete","tasks.md: all demo tasks checked"],doneTasks:5,workerStates:["idle","idle"]}],cf=["Create the Todo API route","Persist todos in SQLite","Add Vitest coverage","Review route behavior","Mark .hive/tasks.md complete"],mC=[{name:"ada-lovelace",role:"Coder"},{name:"socrates",role:"Reviewer"}],pC=({onExit:t})=>{const{t:a}=be(),[o,s]=y.useState(0);y.useEffect(()=>{const f=window.setInterval(()=>{s(m=>(m+1)%Rl.length)},1800);return()=>window.clearInterval(f)},[]);const l=Rl[o]??Rl[0],u=y.useMemo(()=>Rl.slice(0,o+1).flatMap(f=>f.terminal),[o]);return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[c.jsx(fC,{onExit:t}),c.jsx("div",{className:"scroll-y min-h-0 flex-1 px-4 py-4",style:{background:"var(--bg-2)"},children:c.jsxs("section",{className:"mx-auto grid h-full min-h-[520px] w-full max-w-6xl gap-3 lg:grid-cols-[minmax(0,1.35fr)_minmax(320px,0.65fr)]","data-testid":"demo-replay-panel",children:[c.jsxs("div",{className:"flex min-h-0 flex-col rounded-md border bg-0",children:[c.jsxs("header",{className:"flex items-center justify-between border-b px-3 py-2",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(kc,{size:15,className:"text-accent"}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("h1",{className:"truncate text-sm font-semibold text-pri",children:a("demo.replayTitle")}),c.jsx("p",{className:"text-xs text-ter",children:a("demo.replaySubtitle")})]})]}),c.jsx("span",{className:"rounded border px-2 py-1 text-[11px] text-sec",children:l.label})]}),c.jsx("pre",{className:"mono min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-4 text-xs leading-6 text-sec","data-testid":"demo-replay-terminal",children:u.join(`
11
+ `)})]}),c.jsxs("aside",{className:"flex min-h-0 flex-col gap-3",children:[c.jsxs("div",{className:"rounded-md border bg-0 p-3","data-testid":"demo-task-graph",children:[c.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[c.jsx("h2",{className:"text-sm font-semibold text-pri",children:a("demo.tasksTitle")}),c.jsxs("span",{className:"text-xs text-ter",children:[Math.min(l.doneTasks,cf.length),"/",cf.length]})]}),c.jsx("ul",{className:"space-y-2",children:cf.map((f,m)=>{const g=m<l.doneTasks;return c.jsxs("li",{className:"flex items-start gap-2 text-sm","data-testid":`demo-task-${m}`,"data-done":g||void 0,children:[g?c.jsx(s0,{size:16,className:"mt-0.5 shrink-0 text-status-green"}):c.jsx(VS,{size:16,className:"mt-0.5 shrink-0 text-ter"}),c.jsx("span",{className:g?"text-pri":"text-sec",children:f})]},f)})})]}),c.jsxs("div",{className:"rounded-md border bg-0 p-3","data-testid":"demo-team",children:[c.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[c.jsx(Ec,{size:15,className:"text-accent"}),c.jsx("h2",{className:"text-sm font-semibold text-pri",children:a("demo.teamTitle")})]}),c.jsx("div",{className:"grid gap-2",children:mC.map((f,m)=>{const g=l.workerStates[m]??"idle";return c.jsxs("div",{className:"rounded border px-3 py-2","data-testid":`demo-worker-${f.name}`,style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-sm font-medium text-pri",children:f.name}),c.jsx("span",{className:"rounded px-1.5 py-0.5 text-[11px] text-sec bg-2",children:g})]}),c.jsx("p",{className:"mt-1 text-xs text-ter",children:f.role})]},f.name)})})]})]})]})})]})};function Kt(t,a,{checkForDefaultPrevented:o=!0}={}){return function(l){if(t?.(l),o===!1||!l.defaultPrevented)return a?.(l)}}function xy(t,a){if(typeof t=="function")return t(a);t!=null&&(t.current=a)}function k0(...t){return a=>{let o=!1;const s=t.map(l=>{const u=xy(l,a);return!o&&typeof u=="function"&&(o=!0),u});if(o)return()=>{for(let l=0;l<s.length;l++){const u=s[l];typeof u=="function"?u():xy(t[l],null)}}}}function _n(...t){return y.useCallback(k0(...t),t)}function hC(t,a){const o=y.createContext(a),s=u=>{const{children:f,...m}=u,g=y.useMemo(()=>m,Object.values(m));return c.jsx(o.Provider,{value:g,children:f})};s.displayName=t+"Provider";function l(u){const f=y.useContext(o);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${t}\``)}return[s,l]}function Om(t,a=[]){let o=[];function s(u,f){const m=y.createContext(f),g=o.length;o=[...o,f];const p=v=>{const{scope:k,children:E,...S}=v,w=k?.[t]?.[g]||m,C=y.useMemo(()=>S,Object.values(S));return c.jsx(w.Provider,{value:C,children:E})};p.displayName=u+"Provider";function b(v,k){const E=k?.[t]?.[g]||m,S=y.useContext(E);if(S)return S;if(f!==void 0)return f;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[p,b]}const l=()=>{const u=o.map(f=>y.createContext(f));return function(m){const g=m?.[t]||u;return y.useMemo(()=>({[`__scope${t}`]:{...m,[t]:g}}),[m,g])}};return l.scopeName=t,[s,gC(l,...a)]}function gC(...t){const a=t[0];if(t.length===1)return a;const o=()=>{const s=t.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(u){const f=s.reduce((m,{useScope:g,scopeName:p})=>{const v=g(u)[`__scope${p}`];return{...m,...v}},{});return y.useMemo(()=>({[`__scope${a.scopeName}`]:f}),[f])}};return o.scopeName=a.scopeName,o}var er=globalThis?.document?y.useLayoutEffect:()=>{},vC=a0[" useId ".trim().toString()]||(()=>{}),yC=0;function Pl(t){const[a,o]=y.useState(vC());return er(()=>{o(s=>s??String(yC++))},[t]),t||(a?`radix-${a}`:"")}var bC=a0[" useInsertionEffect ".trim().toString()]||er;function S0({prop:t,defaultProp:a,onChange:o=()=>{},caller:s}){const[l,u,f]=wC({defaultProp:a,onChange:o}),m=t!==void 0,g=m?t:l;{const b=y.useRef(t!==void 0);y.useEffect(()=>{const v=b.current;v!==m&&console.warn(`${s} is changing from ${v?"controlled":"uncontrolled"} to ${m?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),b.current=m},[m,s])}const p=y.useCallback(b=>{if(m){const v=xC(b)?b(t):b;v!==t&&f.current?.(v)}else u(b)},[m,t,u,f]);return[g,p]}function wC({defaultProp:t,onChange:a}){const[o,s]=y.useState(t),l=y.useRef(o),u=y.useRef(a);return bC(()=>{u.current=a},[a]),y.useEffect(()=>{l.current!==o&&(u.current?.(o),l.current=o)},[o,l]),[o,s,u]}function xC(t){return typeof t=="function"}var Cc=r0();const kC=n0(Cc);function E0(t){const a=SC(t),o=y.forwardRef((s,l)=>{const{children:u,...f}=s,m=y.Children.toArray(u),g=m.find(CC);if(g){const p=g.props.children,b=m.map(v=>v===g?y.Children.count(p)>1?y.Children.only(null):y.isValidElement(p)?p.props.children:null:v);return c.jsx(a,{...f,ref:l,children:y.isValidElement(p)?y.cloneElement(p,void 0,b):null})}return c.jsx(a,{...f,ref:l,children:u})});return o.displayName=`${t}.Slot`,o}function SC(t){const a=y.forwardRef((o,s)=>{const{children:l,...u}=o;if(y.isValidElement(l)){const f=NC(l),m=TC(u,l.props);return l.type!==y.Fragment&&(m.ref=s?k0(s,f):f),y.cloneElement(l,m)}return y.Children.count(l)>1?y.Children.only(null):null});return a.displayName=`${t}.SlotClone`,a}var C0=Symbol("radix.slottable");function EC(t){const a=({children:o})=>c.jsx(c.Fragment,{children:o});return a.displayName=`${t}.Slottable`,a.__radixId=C0,a}function CC(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===C0}function TC(t,a){const o={...a};for(const s in a){const l=t[s],u=a[s];/^on[A-Z]/.test(s)?l&&u?o[s]=(...m)=>{const g=u(...m);return l(...m),g}:l&&(o[s]=l):s==="style"?o[s]={...l,...u}:s==="className"&&(o[s]=[l,u].filter(Boolean).join(" "))}return{...t,...o}}function NC(t){let a=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning;return o?t.ref:(a=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var jC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vt=jC.reduce((t,a)=>{const o=E0(`Primitive.${a}`),s=y.forwardRef((l,u)=>{const{asChild:f,...m}=l,g=f?o:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(g,{...m,ref:u})});return s.displayName=`Primitive.${a}`,{...t,[a]:s}},{});function AC(t,a){t&&Cc.flushSync(()=>t.dispatchEvent(a))}function zo(t){const a=y.useRef(t);return y.useEffect(()=>{a.current=t}),y.useMemo(()=>(...o)=>a.current?.(...o),[])}function _C(t,a=globalThis?.document){const o=zo(t);y.useEffect(()=>{const s=l=>{l.key==="Escape"&&o(l)};return a.addEventListener("keydown",s,{capture:!0}),()=>a.removeEventListener("keydown",s,{capture:!0})},[o,a])}var RC="DismissableLayer",Zf="dismissableLayer.update",OC="dismissableLayer.pointerDownOutside",DC="dismissableLayer.focusOutside",ky,T0=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Dm=y.forwardRef((t,a)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,onDismiss:m,...g}=t,p=y.useContext(T0),[b,v]=y.useState(null),k=b?.ownerDocument??globalThis?.document,[,E]=y.useState({}),S=_n(a,L=>v(L)),w=Array.from(p.layers),[C]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),T=w.indexOf(C),N=b?w.indexOf(b):-1,j=p.layersWithOutsidePointerEventsDisabled.size>0,A=N>=T,O=zC(L=>{const P=L.target,J=[...p.branches].some(Q=>Q.contains(P));!A||J||(l?.(L),f?.(L),L.defaultPrevented||m?.())},k),D=HC(L=>{const P=L.target;[...p.branches].some(Q=>Q.contains(P))||(u?.(L),f?.(L),L.defaultPrevented||m?.())},k);return _C(L=>{N===p.layers.size-1&&(s?.(L),!L.defaultPrevented&&m&&(L.preventDefault(),m()))},k),y.useEffect(()=>{if(b)return o&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(ky=k.body.style.pointerEvents,k.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(b)),p.layers.add(b),Sy(),()=>{o&&p.layersWithOutsidePointerEventsDisabled.size===1&&(k.body.style.pointerEvents=ky)}},[b,k,o,p]),y.useEffect(()=>()=>{b&&(p.layers.delete(b),p.layersWithOutsidePointerEventsDisabled.delete(b),Sy())},[b,p]),y.useEffect(()=>{const L=()=>E({});return document.addEventListener(Zf,L),()=>document.removeEventListener(Zf,L)},[]),c.jsx(Vt.div,{...g,ref:S,style:{pointerEvents:j?A?"auto":"none":void 0,...t.style},onFocusCapture:Kt(t.onFocusCapture,D.onFocusCapture),onBlurCapture:Kt(t.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Kt(t.onPointerDownCapture,O.onPointerDownCapture)})});Dm.displayName=RC;var MC="DismissableLayerBranch",LC=y.forwardRef((t,a)=>{const o=y.useContext(T0),s=y.useRef(null),l=_n(a,s);return y.useEffect(()=>{const u=s.current;if(u)return o.branches.add(u),()=>{o.branches.delete(u)}},[o.branches]),c.jsx(Vt.div,{...t,ref:l})});LC.displayName=MC;function zC(t,a=globalThis?.document){const o=zo(t),s=y.useRef(!1),l=y.useRef(()=>{});return y.useEffect(()=>{const u=m=>{if(m.target&&!s.current){let g=function(){N0(OC,o,p,{discrete:!0})};const p={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",l.current),l.current=g,a.addEventListener("click",l.current,{once:!0})):g()}else a.removeEventListener("click",l.current);s.current=!1},f=window.setTimeout(()=>{a.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(f),a.removeEventListener("pointerdown",u),a.removeEventListener("click",l.current)}},[a,o]),{onPointerDownCapture:()=>s.current=!0}}function HC(t,a=globalThis?.document){const o=zo(t),s=y.useRef(!1);return y.useEffect(()=>{const l=u=>{u.target&&!s.current&&N0(DC,o,{originalEvent:u},{discrete:!1})};return a.addEventListener("focusin",l),()=>a.removeEventListener("focusin",l)},[a,o]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Sy(){const t=new CustomEvent(Zf);document.dispatchEvent(t)}function N0(t,a,o,{discrete:s}){const l=o.originalEvent.target,u=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:o});a&&l.addEventListener(t,a,{once:!0}),s?AC(l,u):l.dispatchEvent(u)}var uf="focusScope.autoFocusOnMount",df="focusScope.autoFocusOnUnmount",Ey={bubbles:!1,cancelable:!0},UC="FocusScope",j0=y.forwardRef((t,a)=>{const{loop:o=!1,trapped:s=!1,onMountAutoFocus:l,onUnmountAutoFocus:u,...f}=t,[m,g]=y.useState(null),p=zo(l),b=zo(u),v=y.useRef(null),k=_n(a,w=>g(w)),E=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(s){let w=function(j){if(E.paused||!m)return;const A=j.target;m.contains(A)?v.current=A:$a(v.current,{select:!0})},C=function(j){if(E.paused||!m)return;const A=j.relatedTarget;A!==null&&(m.contains(A)||$a(v.current,{select:!0}))},T=function(j){if(document.activeElement===document.body)for(const O of j)O.removedNodes.length>0&&$a(m)};document.addEventListener("focusin",w),document.addEventListener("focusout",C);const N=new MutationObserver(T);return m&&N.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",C),N.disconnect()}}},[s,m,E.paused]),y.useEffect(()=>{if(m){Ty.add(E);const w=document.activeElement;if(!m.contains(w)){const T=new CustomEvent(uf,Ey);m.addEventListener(uf,p),m.dispatchEvent(T),T.defaultPrevented||(BC(FC(A0(m)),{select:!0}),document.activeElement===w&&$a(m))}return()=>{m.removeEventListener(uf,p),setTimeout(()=>{const T=new CustomEvent(df,Ey);m.addEventListener(df,b),m.dispatchEvent(T),T.defaultPrevented||$a(w??document.body,{select:!0}),m.removeEventListener(df,b),Ty.remove(E)},0)}}},[m,p,b,E]);const S=y.useCallback(w=>{if(!o&&!s||E.paused)return;const C=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,T=document.activeElement;if(C&&T){const N=w.currentTarget,[j,A]=WC(N);j&&A?!w.shiftKey&&T===A?(w.preventDefault(),o&&$a(j,{select:!0})):w.shiftKey&&T===j&&(w.preventDefault(),o&&$a(A,{select:!0})):T===N&&w.preventDefault()}},[o,s,E.paused]);return c.jsx(Vt.div,{tabIndex:-1,...f,ref:k,onKeyDown:S})});j0.displayName=UC;function BC(t,{select:a=!1}={}){const o=document.activeElement;for(const s of t)if($a(s,{select:a}),document.activeElement!==o)return}function WC(t){const a=A0(t),o=Cy(a,t),s=Cy(a.reverse(),t);return[o,s]}function A0(t){const a=[],o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const l=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||l?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)a.push(o.currentNode);return a}function Cy(t,a){for(const o of t)if(!IC(o,{upTo:a}))return o}function IC(t,{upTo:a}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(a!==void 0&&t===a)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function qC(t){return t instanceof HTMLInputElement&&"select"in t}function $a(t,{select:a=!1}={}){if(t&&t.focus){const o=document.activeElement;t.focus({preventScroll:!0}),t!==o&&qC(t)&&a&&t.select()}}var Ty=PC();function PC(){let t=[];return{add(a){const o=t[0];a!==o&&o?.pause(),t=Ny(t,a),t.unshift(a)},remove(a){t=Ny(t,a),t[0]?.resume()}}}function Ny(t,a){const o=[...t],s=o.indexOf(a);return s!==-1&&o.splice(s,1),o}function FC(t){return t.filter(a=>a.tagName!=="A")}var KC="Portal",Mm=y.forwardRef((t,a)=>{const{container:o,...s}=t,[l,u]=y.useState(!1);er(()=>u(!0),[]);const f=o||l&&globalThis?.document?.body;return f?kC.createPortal(c.jsx(Vt.div,{...s,ref:a}),f):null});Mm.displayName=KC;function YC(t,a){return y.useReducer((o,s)=>a[o][s]??o,t)}var Fo=t=>{const{present:a,children:o}=t,s=$C(a),l=typeof o=="function"?o({present:s.isPresent}):y.Children.only(o),u=_n(s.ref,VC(l));return typeof o=="function"||s.isPresent?y.cloneElement(l,{ref:u}):null};Fo.displayName="Presence";function $C(t){const[a,o]=y.useState(),s=y.useRef(null),l=y.useRef(t),u=y.useRef("none"),f=t?"mounted":"unmounted",[m,g]=YC(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const p=Ol(s.current);u.current=m==="mounted"?p:"none"},[m]),er(()=>{const p=s.current,b=l.current;if(b!==t){const k=u.current,E=Ol(p);t?g("MOUNT"):E==="none"||p?.display==="none"?g("UNMOUNT"):g(b&&k!==E?"ANIMATION_OUT":"UNMOUNT"),l.current=t}},[t,g]),er(()=>{if(a){let p;const b=a.ownerDocument.defaultView??window,v=E=>{const w=Ol(s.current).includes(CSS.escape(E.animationName));if(E.target===a&&w&&(g("ANIMATION_END"),!l.current)){const C=a.style.animationFillMode;a.style.animationFillMode="forwards",p=b.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=C)})}},k=E=>{E.target===a&&(u.current=Ol(s.current))};return a.addEventListener("animationstart",k),a.addEventListener("animationcancel",v),a.addEventListener("animationend",v),()=>{b.clearTimeout(p),a.removeEventListener("animationstart",k),a.removeEventListener("animationcancel",v),a.removeEventListener("animationend",v)}}else g("ANIMATION_END")},[a,g]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:y.useCallback(p=>{s.current=p?getComputedStyle(p):null,o(p)},[])}}function Ol(t){return t?.animationName||"none"}function VC(t){let a=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning;return o?t.ref:(a=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var ff=0;function GC(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??jy()),document.body.insertAdjacentElement("beforeend",t[1]??jy()),ff++,()=>{ff===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),ff--}},[])}function jy(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Un=function(){return Un=Object.assign||function(a){for(var o,s=1,l=arguments.length;s<l;s++){o=arguments[s];for(var u in o)Object.prototype.hasOwnProperty.call(o,u)&&(a[u]=o[u])}return a},Un.apply(this,arguments)};function _0(t,a){var o={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&a.indexOf(s)<0&&(o[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,s=Object.getOwnPropertySymbols(t);l<s.length;l++)a.indexOf(s[l])<0&&Object.prototype.propertyIsEnumerable.call(t,s[l])&&(o[s[l]]=t[s[l]]);return o}function XC(t,a,o){if(o||arguments.length===2)for(var s=0,l=a.length,u;s<l;s++)(u||!(s in a))&&(u||(u=Array.prototype.slice.call(a,0,s)),u[s]=a[s]);return t.concat(u||Array.prototype.slice.call(a))}var Fl="right-scroll-bar-position",Kl="width-before-scroll-bar",ZC="with-scroll-bars-hidden",QC="--removed-body-scroll-bar-size";function mf(t,a){return typeof t=="function"?t(a):t&&(t.current=a),t}function JC(t,a){var o=y.useState(function(){return{value:t,callback:a,facade:{get current(){return o.value},set current(s){var l=o.value;l!==s&&(o.value=s,o.callback(s,l))}}}})[0];return o.callback=a,o.facade}var eT=typeof window<"u"?y.useLayoutEffect:y.useEffect,Ay=new WeakMap;function tT(t,a){var o=JC(null,function(s){return t.forEach(function(l){return mf(l,s)})});return eT(function(){var s=Ay.get(o);if(s){var l=new Set(s),u=new Set(t),f=o.current;l.forEach(function(m){u.has(m)||mf(m,null)}),u.forEach(function(m){l.has(m)||mf(m,f)})}Ay.set(o,t)},[t]),o}function nT(t){return t}function aT(t,a){a===void 0&&(a=nT);var o=[],s=!1,l={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return o.length?o[o.length-1]:t},useMedium:function(u){var f=a(u,s);return o.push(f),function(){o=o.filter(function(m){return m!==f})}},assignSyncMedium:function(u){for(s=!0;o.length;){var f=o;o=[],f.forEach(u)}o={push:function(m){return u(m)},filter:function(){return o}}},assignMedium:function(u){s=!0;var f=[];if(o.length){var m=o;o=[],m.forEach(u),f=o}var g=function(){var b=f;f=[],b.forEach(u)},p=function(){return Promise.resolve().then(g)};p(),o={push:function(b){f.push(b),p()},filter:function(b){return f=f.filter(b),o}}}};return l}function rT(t){t===void 0&&(t={});var a=aT(null);return a.options=Un({async:!0,ssr:!1},t),a}var R0=function(t){var a=t.sideCar,o=_0(t,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=a.read();if(!s)throw new Error("Sidecar medium not found");return y.createElement(s,Un({},o))};R0.isSideCarExport=!0;function oT(t,a){return t.useMedium(a),R0}var O0=rT(),pf=function(){},Tc=y.forwardRef(function(t,a){var o=y.useRef(null),s=y.useState({onScrollCapture:pf,onWheelCapture:pf,onTouchMoveCapture:pf}),l=s[0],u=s[1],f=t.forwardProps,m=t.children,g=t.className,p=t.removeScrollBar,b=t.enabled,v=t.shards,k=t.sideCar,E=t.noRelative,S=t.noIsolation,w=t.inert,C=t.allowPinchZoom,T=t.as,N=T===void 0?"div":T,j=t.gapMode,A=_0(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=k,D=tT([o,a]),L=Un(Un({},A),l);return y.createElement(y.Fragment,null,b&&y.createElement(O,{sideCar:O0,removeScrollBar:p,shards:v,noRelative:E,noIsolation:S,inert:w,setCallbacks:u,allowPinchZoom:!!C,lockRef:o,gapMode:j}),f?y.cloneElement(y.Children.only(m),Un(Un({},L),{ref:D})):y.createElement(N,Un({},L,{className:g,ref:D}),m))});Tc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Tc.classNames={fullWidth:Kl,zeroRight:Fl};var sT=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function iT(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var a=sT();return a&&t.setAttribute("nonce",a),t}function lT(t,a){t.styleSheet?t.styleSheet.cssText=a:t.appendChild(document.createTextNode(a))}function cT(t){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(t)}var uT=function(){var t=0,a=null;return{add:function(o){t==0&&(a=iT())&&(lT(a,o),cT(a)),t++},remove:function(){t--,!t&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},dT=function(){var t=uT();return function(a,o){y.useEffect(function(){return t.add(a),function(){t.remove()}},[a&&o])}},D0=function(){var t=dT(),a=function(o){var s=o.styles,l=o.dynamic;return t(s,l),null};return a},fT={left:0,top:0,right:0,gap:0},hf=function(t){return parseInt(t||"",10)||0},mT=function(t){var a=window.getComputedStyle(document.body),o=a[t==="padding"?"paddingLeft":"marginLeft"],s=a[t==="padding"?"paddingTop":"marginTop"],l=a[t==="padding"?"paddingRight":"marginRight"];return[hf(o),hf(s),hf(l)]},pT=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return fT;var a=mT(t),o=document.documentElement.clientWidth,s=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,s-o+a[2]-a[0])}},hT=D0(),Oo="data-scroll-locked",gT=function(t,a,o,s){var l=t.left,u=t.top,f=t.right,m=t.gap;return o===void 0&&(o="margin"),`
12
+ .`.concat(ZC,` {
13
13
  overflow: hidden `).concat(s,`;
14
14
  padding-right: `).concat(m,"px ").concat(s,`;
15
15
  }
@@ -43,42 +43,40 @@ Error generating stack: `+i.message+`
43
43
  }
44
44
 
45
45
  body[`).concat(Oo,`] {
46
- `).concat(eT,": ").concat(m,`px;
46
+ `).concat(QC,": ").concat(m,`px;
47
47
  }
48
- `)},_y=function(){var t=parseInt(document.body.getAttribute(Oo)||"0",10);return isFinite(t)?t:0},bT=function(){y.useEffect(function(){return document.body.setAttribute(Oo,(_y()+1).toString()),function(){var t=_y()-1;t<=0?document.body.removeAttribute(Oo):document.body.setAttribute(Oo,t.toString())}},[])},wT=function(t){var a=t.noRelative,o=t.noImportant,s=t.gapMode,l=s===void 0?"margin":s;bT();var u=y.useMemo(function(){return gT(l)},[l]);return y.createElement(vT,{styles:yT(u,!a,l,o?"":"!important")})},Qf=!1;if(typeof window<"u")try{var Dl=Object.defineProperty({},"passive",{get:function(){return Qf=!0,!0}});window.addEventListener("test",Dl,Dl),window.removeEventListener("test",Dl,Dl)}catch{Qf=!1}var Eo=Qf?{passive:!1}:!1,xT=function(t){return t.tagName==="TEXTAREA"},M0=function(t,a){if(!(t instanceof Element))return!1;var o=window.getComputedStyle(t);return o[a]!=="hidden"&&!(o.overflowY===o.overflowX&&!xT(t)&&o[a]==="visible")},kT=function(t){return M0(t,"overflowY")},ST=function(t){return M0(t,"overflowX")},Ry=function(t,a){var o=a.ownerDocument,s=a;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var l=L0(t,s);if(l){var u=z0(t,s),f=u[1],m=u[2];if(f>m)return!0}s=s.parentNode}while(s&&s!==o.body);return!1},ET=function(t){var a=t.scrollTop,o=t.scrollHeight,s=t.clientHeight;return[a,o,s]},CT=function(t){var a=t.scrollLeft,o=t.scrollWidth,s=t.clientWidth;return[a,o,s]},L0=function(t,a){return t==="v"?kT(a):ST(a)},z0=function(t,a){return t==="v"?ET(a):CT(a)},TT=function(t,a){return t==="h"&&a==="rtl"?-1:1},NT=function(t,a,o,s,l){var u=TT(t,window.getComputedStyle(a).direction),f=u*s,m=o.target,g=a.contains(m),p=!1,b=f>0,v=0,k=0;do{if(!m)break;var E=z0(t,m),S=E[0],w=E[1],C=E[2],T=w-C-u*S;(S||T)&&L0(t,m)&&(v+=T,k+=S);var N=m.parentNode;m=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!g&&m!==document.body||g&&(a.contains(m)||a===m));return(b&&Math.abs(v)<1||!b&&Math.abs(k)<1)&&(p=!0),p},Ml=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Oy=function(t){return[t.deltaX,t.deltaY]},Dy=function(t){return t&&"current"in t?t.current:t},jT=function(t,a){return t[0]===a[0]&&t[1]===a[1]},AT=function(t){return`
48
+ `)},_y=function(){var t=parseInt(document.body.getAttribute(Oo)||"0",10);return isFinite(t)?t:0},vT=function(){y.useEffect(function(){return document.body.setAttribute(Oo,(_y()+1).toString()),function(){var t=_y()-1;t<=0?document.body.removeAttribute(Oo):document.body.setAttribute(Oo,t.toString())}},[])},yT=function(t){var a=t.noRelative,o=t.noImportant,s=t.gapMode,l=s===void 0?"margin":s;vT();var u=y.useMemo(function(){return pT(l)},[l]);return y.createElement(hT,{styles:gT(u,!a,l,o?"":"!important")})},Qf=!1;if(typeof window<"u")try{var Dl=Object.defineProperty({},"passive",{get:function(){return Qf=!0,!0}});window.addEventListener("test",Dl,Dl),window.removeEventListener("test",Dl,Dl)}catch{Qf=!1}var Eo=Qf?{passive:!1}:!1,bT=function(t){return t.tagName==="TEXTAREA"},M0=function(t,a){if(!(t instanceof Element))return!1;var o=window.getComputedStyle(t);return o[a]!=="hidden"&&!(o.overflowY===o.overflowX&&!bT(t)&&o[a]==="visible")},wT=function(t){return M0(t,"overflowY")},xT=function(t){return M0(t,"overflowX")},Ry=function(t,a){var o=a.ownerDocument,s=a;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var l=L0(t,s);if(l){var u=z0(t,s),f=u[1],m=u[2];if(f>m)return!0}s=s.parentNode}while(s&&s!==o.body);return!1},kT=function(t){var a=t.scrollTop,o=t.scrollHeight,s=t.clientHeight;return[a,o,s]},ST=function(t){var a=t.scrollLeft,o=t.scrollWidth,s=t.clientWidth;return[a,o,s]},L0=function(t,a){return t==="v"?wT(a):xT(a)},z0=function(t,a){return t==="v"?kT(a):ST(a)},ET=function(t,a){return t==="h"&&a==="rtl"?-1:1},CT=function(t,a,o,s,l){var u=ET(t,window.getComputedStyle(a).direction),f=u*s,m=o.target,g=a.contains(m),p=!1,b=f>0,v=0,k=0;do{if(!m)break;var E=z0(t,m),S=E[0],w=E[1],C=E[2],T=w-C-u*S;(S||T)&&L0(t,m)&&(v+=T,k+=S);var N=m.parentNode;m=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!g&&m!==document.body||g&&(a.contains(m)||a===m));return(b&&Math.abs(v)<1||!b&&Math.abs(k)<1)&&(p=!0),p},Ml=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Oy=function(t){return[t.deltaX,t.deltaY]},Dy=function(t){return t&&"current"in t?t.current:t},TT=function(t,a){return t[0]===a[0]&&t[1]===a[1]},NT=function(t){return`
49
49
  .block-interactivity-`.concat(t,` {pointer-events: none;}
50
50
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
51
- `)},_T=0,Co=[];function RT(t){var a=y.useRef([]),o=y.useRef([0,0]),s=y.useRef(),l=y.useState(_T++)[0],u=y.useState(D0)[0],f=y.useRef(t);y.useEffect(function(){f.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(l));var w=QC([t.lockRef.current],(t.shards||[]).map(Dy),!0).filter(Boolean);return w.forEach(function(C){return C.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),w.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(l))})}}},[t.inert,t.lockRef.current,t.shards]);var m=y.useCallback(function(w,C){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!f.current.allowPinchZoom;var T=Ml(w),N=o.current,j="deltaX"in w?w.deltaX:N[0]-T[0],A="deltaY"in w?w.deltaY:N[1]-T[1],O,D=w.target,L=Math.abs(j)>Math.abs(A)?"h":"v";if("touches"in w&&L==="h"&&D.type==="range")return!1;var P=window.getSelection(),J=P&&P.anchorNode,Q=J?J===D||J.contains(D):!1;if(Q)return!1;var $=Ry(L,D);if(!$)return!0;if($?O=L:(O=L==="v"?"h":"v",$=Ry(L,D)),!$)return!1;if(!s.current&&"changedTouches"in w&&(j||A)&&(s.current=O),!O)return!0;var F=s.current||O;return NT(F,C,w,F==="h"?j:A)},[]),g=y.useCallback(function(w){var C=w;if(!(!Co.length||Co[Co.length-1]!==u)){var T="deltaY"in C?Oy(C):Ml(C),N=a.current.filter(function(O){return O.name===C.type&&(O.target===C.target||C.target===O.shadowParent)&&jT(O.delta,T)})[0];if(N&&N.should){C.cancelable&&C.preventDefault();return}if(!N){var j=(f.current.shards||[]).map(Dy).filter(Boolean).filter(function(O){return O.contains(C.target)}),A=j.length>0?m(C,j[0]):!f.current.noIsolation;A&&C.cancelable&&C.preventDefault()}}},[]),p=y.useCallback(function(w,C,T,N){var j={name:w,delta:C,target:T,should:N,shadowParent:OT(T)};a.current.push(j),setTimeout(function(){a.current=a.current.filter(function(A){return A!==j})},1)},[]),b=y.useCallback(function(w){o.current=Ml(w),s.current=void 0},[]),v=y.useCallback(function(w){p(w.type,Oy(w),w.target,m(w,t.lockRef.current))},[]),k=y.useCallback(function(w){p(w.type,Ml(w),w.target,m(w,t.lockRef.current))},[]);y.useEffect(function(){return Co.push(u),t.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:k}),document.addEventListener("wheel",g,Eo),document.addEventListener("touchmove",g,Eo),document.addEventListener("touchstart",b,Eo),function(){Co=Co.filter(function(w){return w!==u}),document.removeEventListener("wheel",g,Eo),document.removeEventListener("touchmove",g,Eo),document.removeEventListener("touchstart",b,Eo)}},[]);var E=t.removeScrollBar,S=t.inert;return y.createElement(y.Fragment,null,S?y.createElement(u,{styles:AT(l)}):null,E?y.createElement(wT,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function OT(t){for(var a=null;t!==null;)t instanceof ShadowRoot&&(a=t.host,t=t.host),t=t.parentNode;return a}const DT=iT(O0,RT);var H0=y.forwardRef(function(t,a){return y.createElement(Tc,Un({},t,{ref:a,sideCar:DT}))});H0.classNames=Tc.classNames;var MT=function(t){if(typeof document>"u")return null;var a=Array.isArray(t)?t[0]:t;return a.ownerDocument.body},To=new WeakMap,Ll=new WeakMap,zl={},gf=0,U0=function(t){return t&&(t.host||U0(t.parentNode))},LT=function(t,a){return a.map(function(o){if(t.contains(o))return o;var s=U0(o);return s&&t.contains(s)?s:(console.error("aria-hidden",o,"in not contained inside",t,". Doing nothing"),null)}).filter(function(o){return!!o})},zT=function(t,a,o,s){var l=LT(a,Array.isArray(t)?t:[t]);zl[o]||(zl[o]=new WeakMap);var u=zl[o],f=[],m=new Set,g=new Set(l),p=function(v){!v||m.has(v)||(m.add(v),p(v.parentNode))};l.forEach(p);var b=function(v){!v||g.has(v)||Array.prototype.forEach.call(v.children,function(k){if(m.has(k))b(k);else try{var E=k.getAttribute(s),S=E!==null&&E!=="false",w=(To.get(k)||0)+1,C=(u.get(k)||0)+1;To.set(k,w),u.set(k,C),f.push(k),w===1&&S&&Ll.set(k,!0),C===1&&k.setAttribute(o,"true"),S||k.setAttribute(s,"true")}catch(T){console.error("aria-hidden: cannot operate on ",k,T)}})};return b(a),m.clear(),gf++,function(){f.forEach(function(v){var k=To.get(v)-1,E=u.get(v)-1;To.set(v,k),u.set(v,E),k||(Ll.has(v)||v.removeAttribute(s),Ll.delete(v)),E||v.removeAttribute(o)}),gf--,gf||(To=new WeakMap,To=new WeakMap,Ll=new WeakMap,zl={})}},HT=function(t,a,o){o===void 0&&(o="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),l=MT(t);return l?(s.push.apply(s,Array.from(l.querySelectorAll("[aria-live], script"))),zT(s,l,o,"aria-hidden")):function(){return null}},Nc="Dialog",[B0]=Om(Nc),[UT,Rn]=B0(Nc),W0=t=>{const{__scopeDialog:a,children:o,open:s,defaultOpen:l,onOpenChange:u,modal:f=!0}=t,m=y.useRef(null),g=y.useRef(null),[p,b]=S0({prop:s,defaultProp:l??!1,onChange:u,caller:Nc});return c.jsx(UT,{scope:a,triggerRef:m,contentRef:g,contentId:Pl(),titleId:Pl(),descriptionId:Pl(),open:p,onOpenChange:b,onOpenToggle:y.useCallback(()=>b(v=>!v),[b]),modal:f,children:o})};W0.displayName=Nc;var I0="DialogTrigger",q0=y.forwardRef((t,a)=>{const{__scopeDialog:o,...s}=t,l=Rn(I0,o),u=_n(a,l.triggerRef);return c.jsx(Vt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":Hm(l.open),...s,ref:u,onClick:Kt(t.onClick,l.onOpenToggle)})});q0.displayName=I0;var Lm="DialogPortal",[BT,P0]=B0(Lm,{forceMount:void 0}),F0=t=>{const{__scopeDialog:a,forceMount:o,children:s,container:l}=t,u=Rn(Lm,a);return c.jsx(BT,{scope:a,forceMount:o,children:y.Children.map(s,f=>c.jsx(Fo,{present:o||u.open,children:c.jsx(Mm,{asChild:!0,container:l,children:f})}))})};F0.displayName=Lm;var tc="DialogOverlay",K0=y.forwardRef((t,a)=>{const o=P0(tc,t.__scopeDialog),{forceMount:s=o.forceMount,...l}=t,u=Rn(tc,t.__scopeDialog);return u.modal?c.jsx(Fo,{present:s||u.open,children:c.jsx(IT,{...l,ref:a})}):null});K0.displayName=tc;var WT=E0("DialogOverlay.RemoveScroll"),IT=y.forwardRef((t,a)=>{const{__scopeDialog:o,...s}=t,l=Rn(tc,o);return c.jsx(H0,{as:WT,allowPinchZoom:!0,shards:[l.contentRef],children:c.jsx(Vt.div,{"data-state":Hm(l.open),...s,ref:a,style:{pointerEvents:"auto",...s.style}})})}),Rr="DialogContent",Y0=y.forwardRef((t,a)=>{const o=P0(Rr,t.__scopeDialog),{forceMount:s=o.forceMount,...l}=t,u=Rn(Rr,t.__scopeDialog);return c.jsx(Fo,{present:s||u.open,children:u.modal?c.jsx(qT,{...l,ref:a}):c.jsx(PT,{...l,ref:a})})});Y0.displayName=Rr;var qT=y.forwardRef((t,a)=>{const o=Rn(Rr,t.__scopeDialog),s=y.useRef(null),l=_n(a,o.contentRef,s);return y.useEffect(()=>{const u=s.current;if(u)return HT(u)},[]),c.jsx($0,{...t,ref:l,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kt(t.onCloseAutoFocus,u=>{u.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:Kt(t.onPointerDownOutside,u=>{const f=u.detail.originalEvent,m=f.button===0&&f.ctrlKey===!0;(f.button===2||m)&&u.preventDefault()}),onFocusOutside:Kt(t.onFocusOutside,u=>u.preventDefault())})}),PT=y.forwardRef((t,a)=>{const o=Rn(Rr,t.__scopeDialog),s=y.useRef(!1),l=y.useRef(!1);return c.jsx($0,{...t,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{t.onCloseAutoFocus?.(u),u.defaultPrevented||(s.current||o.triggerRef.current?.focus(),u.preventDefault()),s.current=!1,l.current=!1},onInteractOutside:u=>{t.onInteractOutside?.(u),u.defaultPrevented||(s.current=!0,u.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const f=u.target;o.triggerRef.current?.contains(f)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&l.current&&u.preventDefault()}})}),$0=y.forwardRef((t,a)=>{const{__scopeDialog:o,trapFocus:s,onOpenAutoFocus:l,onCloseAutoFocus:u,...f}=t,m=Rn(Rr,o),g=y.useRef(null),p=_n(a,g);return ZC(),c.jsxs(c.Fragment,{children:[c.jsx(j0,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:l,onUnmountAutoFocus:u,children:c.jsx(Dm,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":Hm(m.open),...f,ref:p,onDismiss:()=>m.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(FT,{titleId:m.titleId}),c.jsx(YT,{contentRef:g,descriptionId:m.descriptionId})]})]})}),zm="DialogTitle",V0=y.forwardRef((t,a)=>{const{__scopeDialog:o,...s}=t,l=Rn(zm,o);return c.jsx(Vt.h2,{id:l.titleId,...s,ref:a})});V0.displayName=zm;var G0="DialogDescription",X0=y.forwardRef((t,a)=>{const{__scopeDialog:o,...s}=t,l=Rn(G0,o);return c.jsx(Vt.p,{id:l.descriptionId,...s,ref:a})});X0.displayName=G0;var Z0="DialogClose",Q0=y.forwardRef((t,a)=>{const{__scopeDialog:o,...s}=t,l=Rn(Z0,o);return c.jsx(Vt.button,{type:"button",...s,ref:a,onClick:Kt(t.onClick,()=>l.onOpenChange(!1))})});Q0.displayName=Z0;function Hm(t){return t?"open":"closed"}var J0="DialogTitleWarning",[PM,ew]=vC(J0,{contentName:Rr,titleName:zm,docsSlug:"dialog"}),FT=({titleId:t})=>{const a=ew(J0),o=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
51
+ `)},jT=0,Co=[];function AT(t){var a=y.useRef([]),o=y.useRef([0,0]),s=y.useRef(),l=y.useState(jT++)[0],u=y.useState(D0)[0],f=y.useRef(t);y.useEffect(function(){f.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(l));var w=XC([t.lockRef.current],(t.shards||[]).map(Dy),!0).filter(Boolean);return w.forEach(function(C){return C.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),w.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(l))})}}},[t.inert,t.lockRef.current,t.shards]);var m=y.useCallback(function(w,C){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!f.current.allowPinchZoom;var T=Ml(w),N=o.current,j="deltaX"in w?w.deltaX:N[0]-T[0],A="deltaY"in w?w.deltaY:N[1]-T[1],O,D=w.target,L=Math.abs(j)>Math.abs(A)?"h":"v";if("touches"in w&&L==="h"&&D.type==="range")return!1;var P=window.getSelection(),J=P&&P.anchorNode,Q=J?J===D||J.contains(D):!1;if(Q)return!1;var $=Ry(L,D);if(!$)return!0;if($?O=L:(O=L==="v"?"h":"v",$=Ry(L,D)),!$)return!1;if(!s.current&&"changedTouches"in w&&(j||A)&&(s.current=O),!O)return!0;var F=s.current||O;return CT(F,C,w,F==="h"?j:A)},[]),g=y.useCallback(function(w){var C=w;if(!(!Co.length||Co[Co.length-1]!==u)){var T="deltaY"in C?Oy(C):Ml(C),N=a.current.filter(function(O){return O.name===C.type&&(O.target===C.target||C.target===O.shadowParent)&&TT(O.delta,T)})[0];if(N&&N.should){C.cancelable&&C.preventDefault();return}if(!N){var j=(f.current.shards||[]).map(Dy).filter(Boolean).filter(function(O){return O.contains(C.target)}),A=j.length>0?m(C,j[0]):!f.current.noIsolation;A&&C.cancelable&&C.preventDefault()}}},[]),p=y.useCallback(function(w,C,T,N){var j={name:w,delta:C,target:T,should:N,shadowParent:_T(T)};a.current.push(j),setTimeout(function(){a.current=a.current.filter(function(A){return A!==j})},1)},[]),b=y.useCallback(function(w){o.current=Ml(w),s.current=void 0},[]),v=y.useCallback(function(w){p(w.type,Oy(w),w.target,m(w,t.lockRef.current))},[]),k=y.useCallback(function(w){p(w.type,Ml(w),w.target,m(w,t.lockRef.current))},[]);y.useEffect(function(){return Co.push(u),t.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:k}),document.addEventListener("wheel",g,Eo),document.addEventListener("touchmove",g,Eo),document.addEventListener("touchstart",b,Eo),function(){Co=Co.filter(function(w){return w!==u}),document.removeEventListener("wheel",g,Eo),document.removeEventListener("touchmove",g,Eo),document.removeEventListener("touchstart",b,Eo)}},[]);var E=t.removeScrollBar,S=t.inert;return y.createElement(y.Fragment,null,S?y.createElement(u,{styles:NT(l)}):null,E?y.createElement(yT,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function _T(t){for(var a=null;t!==null;)t instanceof ShadowRoot&&(a=t.host,t=t.host),t=t.parentNode;return a}const RT=oT(O0,AT);var H0=y.forwardRef(function(t,a){return y.createElement(Tc,Un({},t,{ref:a,sideCar:RT}))});H0.classNames=Tc.classNames;var OT=function(t){if(typeof document>"u")return null;var a=Array.isArray(t)?t[0]:t;return a.ownerDocument.body},To=new WeakMap,Ll=new WeakMap,zl={},gf=0,U0=function(t){return t&&(t.host||U0(t.parentNode))},DT=function(t,a){return a.map(function(o){if(t.contains(o))return o;var s=U0(o);return s&&t.contains(s)?s:(console.error("aria-hidden",o,"in not contained inside",t,". Doing nothing"),null)}).filter(function(o){return!!o})},MT=function(t,a,o,s){var l=DT(a,Array.isArray(t)?t:[t]);zl[o]||(zl[o]=new WeakMap);var u=zl[o],f=[],m=new Set,g=new Set(l),p=function(v){!v||m.has(v)||(m.add(v),p(v.parentNode))};l.forEach(p);var b=function(v){!v||g.has(v)||Array.prototype.forEach.call(v.children,function(k){if(m.has(k))b(k);else try{var E=k.getAttribute(s),S=E!==null&&E!=="false",w=(To.get(k)||0)+1,C=(u.get(k)||0)+1;To.set(k,w),u.set(k,C),f.push(k),w===1&&S&&Ll.set(k,!0),C===1&&k.setAttribute(o,"true"),S||k.setAttribute(s,"true")}catch(T){console.error("aria-hidden: cannot operate on ",k,T)}})};return b(a),m.clear(),gf++,function(){f.forEach(function(v){var k=To.get(v)-1,E=u.get(v)-1;To.set(v,k),u.set(v,E),k||(Ll.has(v)||v.removeAttribute(s),Ll.delete(v)),E||v.removeAttribute(o)}),gf--,gf||(To=new WeakMap,To=new WeakMap,Ll=new WeakMap,zl={})}},LT=function(t,a,o){o===void 0&&(o="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),l=OT(t);return l?(s.push.apply(s,Array.from(l.querySelectorAll("[aria-live], script"))),MT(s,l,o,"aria-hidden")):function(){return null}},Nc="Dialog",[B0]=Om(Nc),[zT,Rn]=B0(Nc),W0=t=>{const{__scopeDialog:a,children:o,open:s,defaultOpen:l,onOpenChange:u,modal:f=!0}=t,m=y.useRef(null),g=y.useRef(null),[p,b]=S0({prop:s,defaultProp:l??!1,onChange:u,caller:Nc});return c.jsx(zT,{scope:a,triggerRef:m,contentRef:g,contentId:Pl(),titleId:Pl(),descriptionId:Pl(),open:p,onOpenChange:b,onOpenToggle:y.useCallback(()=>b(v=>!v),[b]),modal:f,children:o})};W0.displayName=Nc;var I0="DialogTrigger",q0=y.forwardRef((t,a)=>{const{__scopeDialog:o,...s}=t,l=Rn(I0,o),u=_n(a,l.triggerRef);return c.jsx(Vt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":Hm(l.open),...s,ref:u,onClick:Kt(t.onClick,l.onOpenToggle)})});q0.displayName=I0;var Lm="DialogPortal",[HT,P0]=B0(Lm,{forceMount:void 0}),F0=t=>{const{__scopeDialog:a,forceMount:o,children:s,container:l}=t,u=Rn(Lm,a);return c.jsx(HT,{scope:a,forceMount:o,children:y.Children.map(s,f=>c.jsx(Fo,{present:o||u.open,children:c.jsx(Mm,{asChild:!0,container:l,children:f})}))})};F0.displayName=Lm;var tc="DialogOverlay",K0=y.forwardRef((t,a)=>{const o=P0(tc,t.__scopeDialog),{forceMount:s=o.forceMount,...l}=t,u=Rn(tc,t.__scopeDialog);return u.modal?c.jsx(Fo,{present:s||u.open,children:c.jsx(BT,{...l,ref:a})}):null});K0.displayName=tc;var UT=E0("DialogOverlay.RemoveScroll"),BT=y.forwardRef((t,a)=>{const{__scopeDialog:o,...s}=t,l=Rn(tc,o);return c.jsx(H0,{as:UT,allowPinchZoom:!0,shards:[l.contentRef],children:c.jsx(Vt.div,{"data-state":Hm(l.open),...s,ref:a,style:{pointerEvents:"auto",...s.style}})})}),Rr="DialogContent",Y0=y.forwardRef((t,a)=>{const o=P0(Rr,t.__scopeDialog),{forceMount:s=o.forceMount,...l}=t,u=Rn(Rr,t.__scopeDialog);return c.jsx(Fo,{present:s||u.open,children:u.modal?c.jsx(WT,{...l,ref:a}):c.jsx(IT,{...l,ref:a})})});Y0.displayName=Rr;var WT=y.forwardRef((t,a)=>{const o=Rn(Rr,t.__scopeDialog),s=y.useRef(null),l=_n(a,o.contentRef,s);return y.useEffect(()=>{const u=s.current;if(u)return LT(u)},[]),c.jsx($0,{...t,ref:l,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kt(t.onCloseAutoFocus,u=>{u.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:Kt(t.onPointerDownOutside,u=>{const f=u.detail.originalEvent,m=f.button===0&&f.ctrlKey===!0;(f.button===2||m)&&u.preventDefault()}),onFocusOutside:Kt(t.onFocusOutside,u=>u.preventDefault())})}),IT=y.forwardRef((t,a)=>{const o=Rn(Rr,t.__scopeDialog),s=y.useRef(!1),l=y.useRef(!1);return c.jsx($0,{...t,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{t.onCloseAutoFocus?.(u),u.defaultPrevented||(s.current||o.triggerRef.current?.focus(),u.preventDefault()),s.current=!1,l.current=!1},onInteractOutside:u=>{t.onInteractOutside?.(u),u.defaultPrevented||(s.current=!0,u.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const f=u.target;o.triggerRef.current?.contains(f)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&l.current&&u.preventDefault()}})}),$0=y.forwardRef((t,a)=>{const{__scopeDialog:o,trapFocus:s,onOpenAutoFocus:l,onCloseAutoFocus:u,...f}=t,m=Rn(Rr,o),g=y.useRef(null),p=_n(a,g);return GC(),c.jsxs(c.Fragment,{children:[c.jsx(j0,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:l,onUnmountAutoFocus:u,children:c.jsx(Dm,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":Hm(m.open),...f,ref:p,onDismiss:()=>m.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(qT,{titleId:m.titleId}),c.jsx(FT,{contentRef:g,descriptionId:m.descriptionId})]})]})}),zm="DialogTitle",V0=y.forwardRef((t,a)=>{const{__scopeDialog:o,...s}=t,l=Rn(zm,o);return c.jsx(Vt.h2,{id:l.titleId,...s,ref:a})});V0.displayName=zm;var G0="DialogDescription",X0=y.forwardRef((t,a)=>{const{__scopeDialog:o,...s}=t,l=Rn(G0,o);return c.jsx(Vt.p,{id:l.descriptionId,...s,ref:a})});X0.displayName=G0;var Z0="DialogClose",Q0=y.forwardRef((t,a)=>{const{__scopeDialog:o,...s}=t,l=Rn(Z0,o);return c.jsx(Vt.button,{type:"button",...s,ref:a,onClick:Kt(t.onClick,()=>l.onOpenChange(!1))})});Q0.displayName=Z0;function Hm(t){return t?"open":"closed"}var J0="DialogTitleWarning",[BM,ew]=hC(J0,{contentName:Rr,titleName:zm,docsSlug:"dialog"}),qT=({titleId:t})=>{const a=ew(J0),o=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
52
52
 
53
53
  If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
54
54
 
55
- For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return y.useEffect(()=>{t&&(document.getElementById(t)||console.error(o))},[o,t]),null},KT="DialogDescriptionWarning",YT=({contentRef:t,descriptionId:a})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ew(KT).contentName}}.`;return y.useEffect(()=>{const l=t.current?.getAttribute("aria-describedby");a&&l&&(document.getElementById(a)||console.warn(s))},[s,t,a]),null},Mr=W0,$T=q0,Lr=F0,zr=K0,Hr=Y0,Ur=V0,Ko=X0,VT=Q0;const GT=(t,a={})=>{const o=new URL(t,window.location.href);o.protocol=o.protocol==="https:"?"wss:":"ws:";for(const[s,l]of Object.entries(a))l!==void 0&&o.searchParams.set(s,String(l));return o.toString()},XT={requiresUiSession:!0,fetch(t,a){return fetch(t,a)},openWebSocket(t,a){return new WebSocket(GT(t,a))}};let Ho=XT;const ZT=t=>{Ho=t},tw=()=>Ho,nw=()=>Ho.requiresUiSession!==!1,Um=t=>({id:t.id,name:t.name,role:t.role,status:t.status,pendingTaskCount:t.pending_task_count,...t.avatar?{avatar:t.avatar}:{},...t.last_pty_line?{lastPtyLine:t.last_pty_line}:{},...t.command_preset_id?{commandPresetId:t.command_preset_id}:{},...t.ephemeral===!0?{ephemeral:!0}:{},...t.spawned_by?{spawnedBy:t.spawned_by}:{}}),_e=async(t,a)=>{try{const o=await t.json();if(typeof o.error=="string"&&o.error.trim())return o.error}catch{}return a},QT=async t=>{if(t.status!==403)return!1;try{return(await t.clone().json()).error==="UI endpoint requires valid UI token"}catch{return!1}},aw=async()=>{if(!nw())return;const t=await Ho.fetch("/api/ui/session",{mode:"same-origin"});if(!t.ok)throw new Error("Failed to initialize UI session");await t.json()};let vf=null;const JT=()=>(vf??=aw().finally(()=>{vf=null}),vf),pe=async(t,a)=>{const o=await Ho.fetch(t,a);return!nw()||!await QT(o)?o:(await JT(),Ho.fetch(t,a))},eN=async()=>{const t=await pe("/api/workspaces");if(!t.ok)throw new Error("Failed to load workspaces");return await t.json()},tN=async()=>{const t=await pe("/api/version");if(!t.ok)throw new Error("Failed to load version info");const a=await t.json();return{canRunHiveUpdate:a.can_run_hive_update??a.install_hint==="hive update",currentVersion:a.current_version,installHint:a.install_hint,installSource:a.install_source??"unknown",latestVersion:a.latest_version,packageName:a.package_name,releaseUrl:a.release_url,updateNote:a.update_note??"",updateAvailable:a.update_available}},rw=t=>({description:t.description,id:t.id,isBuiltin:t.is_builtin,name:t.name,roleType:t.role_type}),nN=t=>({name:t.name,role_type:t.roleType,description:t.description,default_command:"",default_args:[],default_env:{}}),aN=async t=>{const a=await pe("/api/workspaces",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(await _e(a,"Failed to create workspace"));return await a.json()},rN=async t=>{const a=await pe(`/api/workspaces/${t}`,{method:"DELETE"});if(!a.ok)throw new Error(await _e(a,"Failed to delete workspace"))},ei=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/agents/${a}/start`,{method:"POST"});if(!o.ok)throw new Error(await _e(o,"Failed to start agent run"));return{runId:(await o.json()).run_id}},nc=async t=>{if(!(await pe(`/api/runtime/runs/${t}/stop`,{method:"POST"})).ok)throw new Error("Failed to stop agent run")};class ow extends Error{constructor(a,o){super(o),this.status=a,this.name="RuntimeRunProbeError"}status}const oN=async t=>{const a=await pe(`/api/runtime/runs/${encodeURIComponent(t)}`,{mode:"same-origin"});if(a.status===404)return!1;if(!a.ok)throw new ow(a.status,await _e(a,"Failed to load agent run"));const o=await a.json();return o.status==="starting"||o.status==="running"},sN=async(t,a,o)=>(await nc(o).catch(s=>{console.error("[hive] swallowed:restartAgentRun.stop",s)}),ei(t,a)),iN=async()=>{const t=await pe("/api/settings/app-state/active_workspace_id");if(!t.ok)throw new Error("Failed to load active workspace");return(await t.json()).value},sw=async t=>{if(!(await pe("/api/settings/app-state/active_workspace_id",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:t})})).ok)throw new Error("Failed to save active workspace")},iw="notifications.webhook-url",lN=async()=>{const t=await pe(`/api/settings/app-state/${iw}`);if(!t.ok)throw new Error("Failed to load webhook URL");return(await t.json()).value??""},cN=async t=>{if(!(await pe(`/api/settings/app-state/${iw}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:t.trim()})})).ok)throw new Error("Failed to save webhook URL")},FM=async()=>{const t=await pe("/api/settings/workflow-cli-policy");if(!t.ok)throw new Error("Failed to load workflow CLI policy");return await t.json()},KM=async t=>{const a=await pe("/api/settings/workflow-cli-policy",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error("Failed to save workflow CLI policy");return await a.json()},uN=async()=>{const t=await pe("/api/settings/workflow-feature");if(!t.ok)throw new Error("Failed to load workflow feature flag");return await t.json()},dN=async t=>{const a=await pe("/api/settings/workflow-feature",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!a.ok)throw new Error("Failed to save workflow feature flag");return await a.json()},fN=async()=>{const t=await pe("/api/settings/team-autostaff");if(!t.ok)throw new Error("Failed to load auto-staff feature flag");return await t.json()},mN=async t=>{const a=await pe("/api/settings/team-autostaff",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!a.ok)throw new Error("Failed to save auto-staff feature flag");return await a.json()},pN=async t=>{const a=await pe(`/api/ui/workspaces/${t}/team`,{mode:"same-origin"});if(!a.ok)throw new Error("Failed to load workers");return(await a.json()).map(Um)},hN=async()=>{const t=await pe("/api/settings/command-presets");if(!t.ok)throw new Error("Failed to load command presets");return(await t.json()).map(a=>({args:a.args,available:a.available,command:a.command,displayName:a.display_name,id:a.id}))},gN=t=>`${t}:shell`,ti=(t,a)=>t.agent_id===gN(a),vN=async t=>{const a=await pe(`/api/workspaces/${t}/shell/start`,{method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to start workspace terminal"));return await a.json()},yN=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/shell/${a}`,{method:"DELETE"});if(!o.ok)throw new Error(await _e(o,"Failed to close workspace terminal"))},bN=async()=>{const t=await pe("/api/settings/role-templates",{mode:"same-origin"});if(!t.ok)throw new Error("Failed to load role templates");return(await t.json()).map(rw)},wN=async t=>{const a=await pe("/api/settings/role-templates",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(nN(t))});if(!a.ok)throw new Error(await _e(a,"Failed to create role template"));return rw(await a.json())},xN=async t=>{const a=await pe(`/api/settings/role-templates/${t}`,{method:"DELETE"});if(!a.ok)throw new Error(await _e(a,"Failed to delete role template"))},YM=async t=>{const a=await pe(`/api/marketplace/manifest?lang=${t}`,{mode:"same-origin"});if(!a.ok)throw new Error(await _e(a,"Failed to load marketplace manifest"));return await a.json()},$M=async(t,a)=>{const o=await pe(`/api/marketplace/agent?lang=${t}&path=${encodeURIComponent(a)}`,{mode:"same-origin"});if(!o.ok)throw new Error(await _e(o,"Failed to load marketplace agent"));return await o.json()},kN=async t=>{const a=await pe(`/api/ui/workspaces/${t}/runs`,{mode:"same-origin"});if(!a.ok)throw new Error("Failed to load terminal runs");return await a.json()},SN=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/workers`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error(await _e(o,"Failed to create worker"));const s=await o.json();return{agentStart:{error:s.agent_start?.error??null,ok:s.agent_start?.ok??!1,runId:s.agent_start?.run_id??null},worker:Um(s)}},EN=async(t,a,o,s)=>{const l=await pe(`/api/workspaces/${t}/scenarios/${encodeURIComponent(a)}/apply`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({goal:o,locale:s})});if(!l.ok)throw new Error(await _e(l,"Failed to assemble the scenario team"));return{createdWorkers:(await l.json()).created_workers}},CN=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/workers/${a}`,{method:"DELETE"});if(!o.ok)throw new Error(await _e(o,"Failed to delete worker"))},TN=async(t,a,o)=>{const s=await pe(`/api/workspaces/${t}/workers/${a}`,{body:JSON.stringify({name:o}),headers:{"content-type":"application/json"},method:"PATCH"});if(!s.ok)throw new Error(await _e(s,"Failed to rename worker"))},NN=async(t,a,o)=>{const s=await pe(`/api/workspaces/${t}/workers/${a}`,{body:JSON.stringify({avatar:o}),headers:{"content-type":"application/json"},method:"PATCH"});if(!s.ok)throw new Error(await _e(s,"Failed to update worker avatar"));return Um(await s.json())},jN=async t=>{const a=await pe(`/api/workspaces/${t}/tasks`);if(!a.ok)throw new Error("Failed to load tasks");return await a.json()},Hl=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/tasks`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error("Failed to save tasks");return await o.json()},VM=async t=>{const a=t?`?path=${encodeURIComponent(t)}`:"";return await(await pe(`/api/fs/browse${a}`,{mode:"same-origin"})).json()},GM=async t=>await(await pe(`/api/fs/probe?path=${encodeURIComponent(t)}`,{mode:"same-origin"})).json(),XM=async()=>await(await pe("/api/fs/pick-folder",{method:"POST",mode:"same-origin"})).json(),AN=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/open`,{body:JSON.stringify({target_id:a}),headers:{"content-type":"application/json"},method:"POST"});if(o.status===200)return{ok:!0,effectiveTargetId:(await o.json()).effective_target_id};if(o.status===502){const s=await o.json();return{ok:!1,effectiveTargetId:s.effective_target_id,errorCode:s.error_code}}throw new Error(await _e(o,"Failed to open workspace"))},_N=t=>({actorAgentIdSnapshot:t.actor_agent_id_snapshot,actorNameSnapshot:t.actor_name_snapshot,actorRoleSnapshot:t.actor_role_snapshot,createdAt:t.created_at,excerpt:t.excerpt,id:t.id,memoryId:t.memory_id,sourceId:t.source_id,sourceSequence:t.source_sequence,sourceType:t.source_type,textHash:t.text_hash}),jc=t=>({archivedAt:t.archived_at,body:t.body,confidence:t.confidence,createdAt:t.created_at,disabled:t.disabled,id:t.id,kind:t.kind,lastInjectedAt:t.last_injected_at,pinned:t.pinned,procedureRef:t.procedure_ref,scope:t.scope,source:t.source,sources:t.sources.map(_N),status:t.status,tags:t.tags,updatedAt:t.updated_at,workspaceId:t.workspace_id}),RN=t=>({contextType:t.context_type,dispatchId:t.dispatch_id,id:t.id,injectedAt:t.injected_at,memory:jc(t.memory),memoryId:t.memory_id,targetAgentIdSnapshot:t.target_agent_id_snapshot,workspaceId:t.workspace_id}),ZM=async(t,a={})=>{const o=new URLSearchParams;a.status&&o.set("status",a.status),a.scope&&o.set("scope",a.scope),a.query?.trim()&&o.set("query",a.query.trim()),a.limit!==void 0&&o.set("limit",String(a.limit));const s=o.size>0?`?${o}`:"",l=await pe(`/api/ui/workspaces/${t}/memory${s}`);if(!l.ok)throw new Error(await _e(l,"Failed to load memory"));return(await l.json()).memories.map(jc)},QM=async(t,a,o)=>{const s=await pe(`/api/ui/workspaces/${t}/memory/${a}`,{body:JSON.stringify(o),headers:{"content-type":"application/json"},method:"PATCH"});if(!s.ok)throw new Error(await _e(s,"Failed to update memory"));const l=await s.json();return jc(l.memory)},ON=async(t,a,o)=>{const s=await pe(`/api/ui/workspaces/${t}/memory/${a}/${o}`,{method:"POST"});if(!s.ok)throw new Error(await _e(s,`Failed to ${o} memory`));const l=await s.json();return jc(l.memory)},JM=(t,a)=>ON(t,a,"archive"),Bm=t=>({error:t.error,finishedAt:t.finished_at,id:t.id,inputSeqFrom:t.input_seq_from,inputSeqTo:t.input_seq_to,report:t.report,startedAt:t.started_at,status:t.status,trigger:t.trigger,workspaceId:t.workspace_id}),e8=async(t,a={})=>{const o=new URLSearchParams;a.limit!==void 0&&o.set("limit",String(a.limit));const s=o.size>0?`?${o}`:"",l=await pe(`/api/ui/workspaces/${t}/memory/dream-runs${s}`);if(!l.ok)throw new Error(await _e(l,"Failed to load dream runs"));return(await l.json()).runs.map(Bm)},t8=async t=>{const a=await pe(`/api/ui/workspaces/${t}/memory/dream-runs`,{body:JSON.stringify({}),headers:{"content-type":"application/json"},method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to run dream"));const o=await a.json();return Bm(o.run)},n8=async(t,a)=>{const o=await pe(`/api/ui/workspaces/${t}/memory/dream-runs/${a}/revert`,{body:JSON.stringify({}),headers:{"content-type":"application/json"},method:"POST"});if(!o.ok)throw new Error(await _e(o,"Failed to revert dream run"));const s=await o.json();return Bm(s.run)},a8=async(t,a)=>{const o=new URLSearchParams({dispatch_id:a}),s=await pe(`/api/ui/workspaces/${t}/memory/injections?${o}`);if(!s.ok)throw new Error(await _e(s,"Failed to load memory injections"));return(await s.json()).injections.map(RN)},DN=t=>({id:t.id,workspaceId:t.workspace_id,scriptPath:t.script_path,name:t.name,status:t.status,startedAt:t.started_at,finishedAt:t.finished_at,error:t.error,phase:t.phase,result:t.result??null,args:t.args??null,agentCount:typeof t.agent_count=="number"?t.agent_count:0,parentRunId:t.parent_run_id??null}),r8=async t=>{const a=await pe(`/api/workspaces/${t}/workflows/runs`);if(!a.ok)throw new Error(await _e(a,"Failed to list workflow runs"));return(await a.json()).runs.map(DN)},lw=t=>({id:t.id,workspaceId:t.workspace_id,scriptPath:t.script_path,cron:t.cron,args:t.args,enabled:t.enabled,lastRunAt:t.last_run_at,nextRunAt:t.next_run_at,createdAt:t.created_at,updatedAt:t.updated_at}),o8=async t=>{const a=await pe(`/api/workspaces/${t}/workflow-schedules`);if(!a.ok)throw new Error(await _e(a,"Failed to list workflow schedules"));return(await a.json()).schedules.map(lw)},s8=async(t,a)=>{const o=await pe(`/api/workflow-schedules/${t}`,{body:JSON.stringify(a),headers:{"content-type":"application/json"},method:"PATCH"});if(!o.ok)throw new Error(await _e(o,"Failed to update workflow schedule"));const s=await o.json();return lw(s.schedule)},MN=t=>({id:t.id,workspaceId:t.workspace_id,fromAgentId:t.from_agent_id,toAgentId:t.to_agent_id,text:t.text,status:t.status,reportText:t.report_text,reportedAt:t.reported_at,createdAt:t.created_at,workflowRunId:t.workflow_run_id,stepIndex:t.step_index,phase:t.phase,label:t.label,...t.last_pty_line?{lastPtyLine:t.last_pty_line}:{}}),i8=async t=>{const a=await pe(`/api/workflows/runs/${t}/stop`,{method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to stop workflow run"))},l8=async t=>{const a=await pe(`/api/workflows/runs/${t}/dispatches`);if(!a.ok)throw new Error(await _e(a,"Failed to load workflow run dispatches"));return(await a.json()).dispatches.map(MN)},c8=async t=>{const a=await pe(`/api/workflows/runs/${t}/logs`);if(!a.ok)throw new Error(await _e(a,"Failed to load workflow run logs"));return(await a.json()).logs},u8=async t=>{const a=await pe(`/api/workflow-schedules/${t}`,{method:"DELETE"});if(!a.ok)throw new Error(await _e(a,"Failed to delete workflow schedule"))},LN=["disabled","loggedOut","connecting","online","reconnecting","revoked"],zN=(t,a)=>typeof t=="string"&&LN.includes(t)?t:a?"online":"disabled",$s=(t,a)=>{if(typeof t=="string"&&t.length>0)return t;throw new Error(`Remote payload missing ${a}`)},cw=(t,a)=>{if(typeof t=="number"&&Number.isFinite(t))return t;throw new Error(`Remote payload missing ${a}`)},uw=t=>({enabled:t.enabled===!0,loggedIn:t.logged_in===!0,gatewayUrl:t.gateway_url??null,connected:t.connected===!0,connection:zN(t.connection,t.connected===!0)}),HN=t=>({deviceId:t.id,name:t.name,lastActive:t.last_active,createdAt:t.created_at,revoked:t.revoked_at!==null}),UN=t=>({pairingId:$s(t.pairing_id,"pairing_id"),qr:$s(t.qr,"qr"),code:$s(t.code,"code"),expiresAt:cw(t.expires_at,"expires_at")}),BN=t=>({pairingId:$s(t.pairing_id,"pairing_id"),deviceName:t.device_name??null,sas:$s(t.sas,"sas"),expiresAt:cw(t.expires_at,"expires_at")}),WN=t=>({id:t.id,deviceId:t.device_id,ts:t.ts,workspaceId:t.workspace_id,action:t.action,endpoint:t.endpoint,result:t.result,rejectReason:t.reject_reason,byteCount:t.byte_count,preview:t.preview}),yf=async()=>{const t=await pe("/api/remote/status");if(!t.ok)throw new Error(await _e(t,"Failed to load remote status"));return uw(await t.json())},IN=async t=>{const a=await pe("/api/remote/enabled",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!a.ok)throw new Error(await _e(a,"Failed to update remote access"));return uw(await a.json())},qN=async()=>{const t=await pe("/api/remote/pairings",{method:"POST"});if(!t.ok)throw new Error(await _e(t,"Failed to start pairing"));return UN(await t.json())},My=async()=>{const t=await pe("/api/remote/pairings/pending");if(!t.ok)throw new Error(await _e(t,"Failed to load pending pairing"));const o=(await t.json())[0];return o?BN(o):null},PN=async t=>{const a=await pe(`/api/remote/pairings/${t}/confirm`,{method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to confirm pairing"))},FN=async t=>{const a=await pe(`/api/remote/pairings/${t}/reject`,{method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to reject pairing"))},dw=async()=>{const t=await pe("/api/remote/devices");if(!t.ok)throw new Error(await _e(t,"Failed to load devices"));return(await t.json()).map(HN)},KN=async t=>{const a=await pe(`/api/remote/devices/${t}/revoke`,{method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to revoke device"))},YN=async(t=100)=>{const a=await pe(`/api/remote/audit?limit=${t}`);if(!a.ok)throw new Error(await _e(a,"Failed to load remote activity"));return(await a.json()).map(WN)},$N=t=>t.kind==="stopped_with_queue"?{kind:t.kind,openDispatches:t.open_dispatches,pendingTaskCount:t.pending_task_count,severity:t.severity,workerId:t.worker_id,workerName:t.worker_name}:t.kind==="dispatch_waiting_report"?{dispatchId:t.dispatch_id,kind:t.kind,minutesAgo:t.minutes_ago,severity:t.severity,submittedAt:t.submitted_at,workerId:t.worker_id,workerName:t.worker_name}:t,bf=t=>({createdAt:t.created_at,id:t.id,label:t.label,phase:t.phase,reportPreview:t.report_preview??null,status:t.status,submittedAt:t.submitted_at,taskPreview:t.task_preview??null,timestamp:t.timestamp,toAgentId:t.to_agent_id,toWorkerName:t.to_worker_name,workflowRunId:t.workflow_run_id}),VN=t=>({attention:(t.attention??[]).map($N),generatedAt:t.generated_at,recentActivity:t.recent_activity.map(a=>({...bf(a),kind:a.kind})),summary:{idleWorkers:t.summary.idle_workers,openDispatches:t.summary.open_dispatches,recentReports:t.summary.recent_reports,stoppedWithQueue:t.summary.stopped_with_queue,stoppedWorkers:t.summary.stopped_workers,totalWorkers:t.summary.total_workers,waitingReports:t.summary.waiting_reports??0,workingWorkers:t.summary.working_workers},workers:t.workers.map(a=>({currentDispatch:a.current_dispatch?bf(a.current_dispatch):null,id:a.id,latestReport:a.latest_report?bf(a.latest_report):null,name:a.name,pendingTaskCount:a.pending_task_count,role:a.role,status:a.status,terminalHint:a.terminal_hint??null})),workspaceId:t.workspace_id}),GN=async(t,a)=>{const o=await pe(`/api/ui/workspaces/${t}/action-center`,a);if(!o.ok)throw new Error(await _e(o,"Failed to load action center"));return VN(await o.json())},XN=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/recap`,a);if(!o.ok)throw new Error(await _e(o,"Failed to load team recap"));const s=await o.json();return{generatedAt:s.generated_at,markdown:s.markdown}},ZN=async()=>{const t=await pe("/api/diagnostics/support-bundle");if(!t.ok)throw new Error(await _e(t,"Failed to load diagnostics"));return await t.json()},QN=async()=>{const t=await pe("/api/diagnostics/retention");if(!t.ok)throw new Error(await _e(t,"Failed to load retention diagnostics"));return await t.json()},fw=async t=>{if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(t);return}catch{}const a=document.createElement("textarea");a.value=t,a.setAttribute("readonly",""),a.style.position="fixed",a.style.top="0",a.style.left="-9999px",a.style.opacity="0";const o=document.activeElement instanceof HTMLElement?document.activeElement:null;let s=!1;try{document.body.appendChild(a),a.focus(),a.select(),a.setSelectionRange(0,a.value.length),s=document.execCommand("copy")}finally{a.remove(),o?.focus()}if(!s)throw new Error("Clipboard copy failed")},mw=async t=>{if(navigator.clipboard?.write&&typeof ClipboardItem<"u"){const a=t.then(o=>new Blob([o],{type:"text/plain"}));a.catch(()=>{});try{await navigator.clipboard.write([new ClipboardItem({"text/plain":a})]);return}catch{}}await fw(await t)},Ly="(max-width: 767px)",pw=y.createContext({mode:"wide"}),wf={mode:"wide"},JN={mode:"mobile"},ej=(t=typeof window<"u"?window.matchMedia.bind(window):void 0)=>{const a=s=>{if(!t)return()=>{};const l=t(Ly);return l.addEventListener?.("change",s),()=>l.removeEventListener?.("change",s)},o=()=>t&&t(Ly).matches?JN:wf;return y.useSyncExternalStore(a,o,()=>wf)},tj=({children:t,value:a})=>{const o=ej();return c.jsx(pw.Provider,{value:a??o,children:t})},hw=()=>y.useContext(pw),yt=()=>hw().mode==="mobile",nj=["top","right","bottom","left"],tr=Math.min,an=Math.max,ac=Math.round,Ul=Math.floor,In=t=>({x:t,y:t}),aj={left:"right",right:"left",bottom:"top",top:"bottom"};function Jf(t,a,o){return an(t,tr(a,o))}function ma(t,a){return typeof t=="function"?t(a):t}function pa(t){return t.split("-")[0]}function Yo(t){return t.split("-")[1]}function Wm(t){return t==="x"?"y":"x"}function Im(t){return t==="y"?"height":"width"}function Wn(t){const a=t[0];return a==="t"||a==="b"?"y":"x"}function qm(t){return Wm(Wn(t))}function rj(t,a,o){o===void 0&&(o=!1);const s=Yo(t),l=qm(t),u=Im(l);let f=l==="x"?s===(o?"end":"start")?"right":"left":s==="start"?"bottom":"top";return a.reference[u]>a.floating[u]&&(f=rc(f)),[f,rc(f)]}function oj(t){const a=rc(t);return[em(t),a,em(a)]}function em(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const zy=["left","right"],Hy=["right","left"],sj=["top","bottom"],ij=["bottom","top"];function lj(t,a,o){switch(t){case"top":case"bottom":return o?a?Hy:zy:a?zy:Hy;case"left":case"right":return a?sj:ij;default:return[]}}function cj(t,a,o,s){const l=Yo(t);let u=lj(pa(t),o==="start",s);return l&&(u=u.map(f=>f+"-"+l),a&&(u=u.concat(u.map(em)))),u}function rc(t){const a=pa(t);return aj[a]+t.slice(a.length)}function uj(t){return{top:0,right:0,bottom:0,left:0,...t}}function gw(t){return typeof t!="number"?uj(t):{top:t,right:t,bottom:t,left:t}}function oc(t){const{x:a,y:o,width:s,height:l}=t;return{width:s,height:l,top:o,left:a,right:a+s,bottom:o+l,x:a,y:o}}function Uy(t,a,o){let{reference:s,floating:l}=t;const u=Wn(a),f=qm(a),m=Im(f),g=pa(a),p=u==="y",b=s.x+s.width/2-l.width/2,v=s.y+s.height/2-l.height/2,k=s[m]/2-l[m]/2;let E;switch(g){case"top":E={x:b,y:s.y-l.height};break;case"bottom":E={x:b,y:s.y+s.height};break;case"right":E={x:s.x+s.width,y:v};break;case"left":E={x:s.x-l.width,y:v};break;default:E={x:s.x,y:s.y}}switch(Yo(a)){case"start":E[f]-=k*(o&&p?-1:1);break;case"end":E[f]+=k*(o&&p?-1:1);break}return E}async function dj(t,a){var o;a===void 0&&(a={});const{x:s,y:l,platform:u,rects:f,elements:m,strategy:g}=t,{boundary:p="clippingAncestors",rootBoundary:b="viewport",elementContext:v="floating",altBoundary:k=!1,padding:E=0}=ma(a,t),S=gw(E),C=m[k?v==="floating"?"reference":"floating":v],T=oc(await u.getClippingRect({element:(o=await(u.isElement==null?void 0:u.isElement(C)))==null||o?C:C.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(m.floating)),boundary:p,rootBoundary:b,strategy:g})),N=v==="floating"?{x:s,y:l,width:f.floating.width,height:f.floating.height}:f.reference,j=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m.floating)),A=await(u.isElement==null?void 0:u.isElement(j))?await(u.getScale==null?void 0:u.getScale(j))||{x:1,y:1}:{x:1,y:1},O=oc(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:m,rect:N,offsetParent:j,strategy:g}):N);return{top:(T.top-O.top+S.top)/A.y,bottom:(O.bottom-T.bottom+S.bottom)/A.y,left:(T.left-O.left+S.left)/A.x,right:(O.right-T.right+S.right)/A.x}}const fj=50,mj=async(t,a,o)=>{const{placement:s="bottom",strategy:l="absolute",middleware:u=[],platform:f}=o,m=f.detectOverflow?f:{...f,detectOverflow:dj},g=await(f.isRTL==null?void 0:f.isRTL(a));let p=await f.getElementRects({reference:t,floating:a,strategy:l}),{x:b,y:v}=Uy(p,s,g),k=s,E=0;const S={};for(let w=0;w<u.length;w++){const C=u[w];if(!C)continue;const{name:T,fn:N}=C,{x:j,y:A,data:O,reset:D}=await N({x:b,y:v,initialPlacement:s,placement:k,strategy:l,middlewareData:S,rects:p,platform:m,elements:{reference:t,floating:a}});b=j??b,v=A??v,S[T]={...S[T],...O},D&&E<fj&&(E++,typeof D=="object"&&(D.placement&&(k=D.placement),D.rects&&(p=D.rects===!0?await f.getElementRects({reference:t,floating:a,strategy:l}):D.rects),{x:b,y:v}=Uy(p,k,g)),w=-1)}return{x:b,y:v,placement:k,strategy:l,middlewareData:S}},pj=t=>({name:"arrow",options:t,async fn(a){const{x:o,y:s,placement:l,rects:u,platform:f,elements:m,middlewareData:g}=a,{element:p,padding:b=0}=ma(t,a)||{};if(p==null)return{};const v=gw(b),k={x:o,y:s},E=qm(l),S=Im(E),w=await f.getDimensions(p),C=E==="y",T=C?"top":"left",N=C?"bottom":"right",j=C?"clientHeight":"clientWidth",A=u.reference[S]+u.reference[E]-k[E]-u.floating[S],O=k[E]-u.reference[E],D=await(f.getOffsetParent==null?void 0:f.getOffsetParent(p));let L=D?D[j]:0;(!L||!await(f.isElement==null?void 0:f.isElement(D)))&&(L=m.floating[j]||u.floating[S]);const P=A/2-O/2,J=L/2-w[S]/2-1,Q=tr(v[T],J),$=tr(v[N],J),F=Q,ne=L-w[S]-$,Z=L/2-w[S]/2+P,q=Jf(F,Z,ne),M=!g.arrow&&Yo(l)!=null&&Z!==q&&u.reference[S]/2-(Z<F?Q:$)-w[S]/2<0,U=M?Z<F?Z-F:Z-ne:0;return{[E]:k[E]+U,data:{[E]:q,centerOffset:Z-q-U,...M&&{alignmentOffset:U}},reset:M}}}),hj=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(a){var o,s;const{placement:l,middlewareData:u,rects:f,initialPlacement:m,platform:g,elements:p}=a,{mainAxis:b=!0,crossAxis:v=!0,fallbackPlacements:k,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...C}=ma(t,a);if((o=u.arrow)!=null&&o.alignmentOffset)return{};const T=pa(l),N=Wn(m),j=pa(m)===m,A=await(g.isRTL==null?void 0:g.isRTL(p.floating)),O=k||(j||!w?[rc(m)]:oj(m)),D=S!=="none";!k&&D&&O.push(...cj(m,w,S,A));const L=[m,...O],P=await g.detectOverflow(a,C),J=[];let Q=((s=u.flip)==null?void 0:s.overflows)||[];if(b&&J.push(P[T]),v){const Z=rj(l,f,A);J.push(P[Z[0]],P[Z[1]])}if(Q=[...Q,{placement:l,overflows:J}],!J.every(Z=>Z<=0)){var $,F;const Z=((($=u.flip)==null?void 0:$.index)||0)+1,q=L[Z];if(q&&(!(v==="alignment"?N!==Wn(q):!1)||Q.every(W=>Wn(W.placement)===N?W.overflows[0]>0:!0)))return{data:{index:Z,overflows:Q},reset:{placement:q}};let M=(F=Q.filter(U=>U.overflows[0]<=0).sort((U,W)=>U.overflows[1]-W.overflows[1])[0])==null?void 0:F.placement;if(!M)switch(E){case"bestFit":{var ne;const U=(ne=Q.filter(W=>{if(D){const G=Wn(W.placement);return G===N||G==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(G=>G>0).reduce((G,V)=>G+V,0)]).sort((W,G)=>W[1]-G[1])[0])==null?void 0:ne[0];U&&(M=U);break}case"initialPlacement":M=m;break}if(l!==M)return{reset:{placement:M}}}return{}}}};function By(t,a){return{top:t.top-a.height,right:t.right-a.width,bottom:t.bottom-a.height,left:t.left-a.width}}function Wy(t){return nj.some(a=>t[a]>=0)}const gj=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(a){const{rects:o,platform:s}=a,{strategy:l="referenceHidden",...u}=ma(t,a);switch(l){case"referenceHidden":{const f=await s.detectOverflow(a,{...u,elementContext:"reference"}),m=By(f,o.reference);return{data:{referenceHiddenOffsets:m,referenceHidden:Wy(m)}}}case"escaped":{const f=await s.detectOverflow(a,{...u,altBoundary:!0}),m=By(f,o.floating);return{data:{escapedOffsets:m,escaped:Wy(m)}}}default:return{}}}}},vw=new Set(["left","top"]);async function vj(t,a){const{placement:o,platform:s,elements:l}=t,u=await(s.isRTL==null?void 0:s.isRTL(l.floating)),f=pa(o),m=Yo(o),g=Wn(o)==="y",p=vw.has(f)?-1:1,b=u&&g?-1:1,v=ma(a,t);let{mainAxis:k,crossAxis:E,alignmentAxis:S}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return m&&typeof S=="number"&&(E=m==="end"?S*-1:S),g?{x:E*b,y:k*p}:{x:k*p,y:E*b}}const yj=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(a){var o,s;const{x:l,y:u,placement:f,middlewareData:m}=a,g=await vj(a,t);return f===((o=m.offset)==null?void 0:o.placement)&&(s=m.arrow)!=null&&s.alignmentOffset?{}:{x:l+g.x,y:u+g.y,data:{...g,placement:f}}}}},bj=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(a){const{x:o,y:s,placement:l,platform:u}=a,{mainAxis:f=!0,crossAxis:m=!1,limiter:g={fn:T=>{let{x:N,y:j}=T;return{x:N,y:j}}},...p}=ma(t,a),b={x:o,y:s},v=await u.detectOverflow(a,p),k=Wn(pa(l)),E=Wm(k);let S=b[E],w=b[k];if(f){const T=E==="y"?"top":"left",N=E==="y"?"bottom":"right",j=S+v[T],A=S-v[N];S=Jf(j,S,A)}if(m){const T=k==="y"?"top":"left",N=k==="y"?"bottom":"right",j=w+v[T],A=w-v[N];w=Jf(j,w,A)}const C=g.fn({...a,[E]:S,[k]:w});return{...C,data:{x:C.x-o,y:C.y-s,enabled:{[E]:f,[k]:m}}}}}},wj=function(t){return t===void 0&&(t={}),{options:t,fn(a){const{x:o,y:s,placement:l,rects:u,middlewareData:f}=a,{offset:m=0,mainAxis:g=!0,crossAxis:p=!0}=ma(t,a),b={x:o,y:s},v=Wn(l),k=Wm(v);let E=b[k],S=b[v];const w=ma(m,a),C=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(g){const j=k==="y"?"height":"width",A=u.reference[k]-u.floating[j]+C.mainAxis,O=u.reference[k]+u.reference[j]-C.mainAxis;E<A?E=A:E>O&&(E=O)}if(p){var T,N;const j=k==="y"?"width":"height",A=vw.has(pa(l)),O=u.reference[v]-u.floating[j]+(A&&((T=f.offset)==null?void 0:T[v])||0)+(A?0:C.crossAxis),D=u.reference[v]+u.reference[j]+(A?0:((N=f.offset)==null?void 0:N[v])||0)-(A?C.crossAxis:0);S<O?S=O:S>D&&(S=D)}return{[k]:E,[v]:S}}}},xj=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(a){var o,s;const{placement:l,rects:u,platform:f,elements:m}=a,{apply:g=()=>{},...p}=ma(t,a),b=await f.detectOverflow(a,p),v=pa(l),k=Yo(l),E=Wn(l)==="y",{width:S,height:w}=u.floating;let C,T;v==="top"||v==="bottom"?(C=v,T=k===(await(f.isRTL==null?void 0:f.isRTL(m.floating))?"start":"end")?"left":"right"):(T=v,C=k==="end"?"top":"bottom");const N=w-b.top-b.bottom,j=S-b.left-b.right,A=tr(w-b[C],N),O=tr(S-b[T],j),D=!a.middlewareData.shift;let L=A,P=O;if((o=a.middlewareData.shift)!=null&&o.enabled.x&&(P=j),(s=a.middlewareData.shift)!=null&&s.enabled.y&&(L=N),D&&!k){const Q=an(b.left,0),$=an(b.right,0),F=an(b.top,0),ne=an(b.bottom,0);E?P=S-2*(Q!==0||$!==0?Q+$:an(b.left,b.right)):L=w-2*(F!==0||ne!==0?F+ne:an(b.top,b.bottom))}await g({...a,availableWidth:P,availableHeight:L});const J=await f.getDimensions(m.floating);return S!==J.width||w!==J.height?{reset:{rects:!0}}:{}}}};function Ac(){return typeof window<"u"}function $o(t){return yw(t)?(t.nodeName||"").toLowerCase():"#document"}function on(t){var a;return(t==null||(a=t.ownerDocument)==null?void 0:a.defaultView)||window}function Pn(t){var a;return(a=(yw(t)?t.ownerDocument:t.document)||window.document)==null?void 0:a.documentElement}function yw(t){return Ac()?t instanceof Node||t instanceof on(t).Node:!1}function jn(t){return Ac()?t instanceof Element||t instanceof on(t).Element:!1}function va(t){return Ac()?t instanceof HTMLElement||t instanceof on(t).HTMLElement:!1}function Iy(t){return!Ac()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof on(t).ShadowRoot}function di(t){const{overflow:a,overflowX:o,overflowY:s,display:l}=An(t);return/auto|scroll|overlay|hidden|clip/.test(a+s+o)&&l!=="inline"&&l!=="contents"}function kj(t){return/^(table|td|th)$/.test($o(t))}function _c(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const Sj=/transform|translate|scale|rotate|perspective|filter/,Ej=/paint|layout|strict|content/,Er=t=>!!t&&t!=="none";let xf;function Pm(t){const a=jn(t)?An(t):t;return Er(a.transform)||Er(a.translate)||Er(a.scale)||Er(a.rotate)||Er(a.perspective)||!Fm()&&(Er(a.backdropFilter)||Er(a.filter))||Sj.test(a.willChange||"")||Ej.test(a.contain||"")}function Cj(t){let a=nr(t);for(;va(a)&&!Uo(a);){if(Pm(a))return a;if(_c(a))return null;a=nr(a)}return null}function Fm(){return xf==null&&(xf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),xf}function Uo(t){return/^(html|body|#document)$/.test($o(t))}function An(t){return on(t).getComputedStyle(t)}function Rc(t){return jn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function nr(t){if($o(t)==="html")return t;const a=t.assignedSlot||t.parentNode||Iy(t)&&t.host||Pn(t);return Iy(a)?a.host:a}function bw(t){const a=nr(t);return Uo(a)?t.ownerDocument?t.ownerDocument.body:t.body:va(a)&&di(a)?a:bw(a)}function ni(t,a,o){var s;a===void 0&&(a=[]),o===void 0&&(o=!0);const l=bw(t),u=l===((s=t.ownerDocument)==null?void 0:s.body),f=on(l);if(u){const m=tm(f);return a.concat(f,f.visualViewport||[],di(l)?l:[],m&&o?ni(m):[])}else return a.concat(l,ni(l,[],o))}function tm(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ww(t){const a=An(t);let o=parseFloat(a.width)||0,s=parseFloat(a.height)||0;const l=va(t),u=l?t.offsetWidth:o,f=l?t.offsetHeight:s,m=ac(o)!==u||ac(s)!==f;return m&&(o=u,s=f),{width:o,height:s,$:m}}function Km(t){return jn(t)?t:t.contextElement}function Do(t){const a=Km(t);if(!va(a))return In(1);const o=a.getBoundingClientRect(),{width:s,height:l,$:u}=ww(a);let f=(u?ac(o.width):o.width)/s,m=(u?ac(o.height):o.height)/l;return(!f||!Number.isFinite(f))&&(f=1),(!m||!Number.isFinite(m))&&(m=1),{x:f,y:m}}const Tj=In(0);function xw(t){const a=on(t);return!Fm()||!a.visualViewport?Tj:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function Nj(t,a,o){return a===void 0&&(a=!1),!o||a&&o!==on(t)?!1:a}function Or(t,a,o,s){a===void 0&&(a=!1),o===void 0&&(o=!1);const l=t.getBoundingClientRect(),u=Km(t);let f=In(1);a&&(s?jn(s)&&(f=Do(s)):f=Do(t));const m=Nj(u,o,s)?xw(u):In(0);let g=(l.left+m.x)/f.x,p=(l.top+m.y)/f.y,b=l.width/f.x,v=l.height/f.y;if(u){const k=on(u),E=s&&jn(s)?on(s):s;let S=k,w=tm(S);for(;w&&s&&E!==S;){const C=Do(w),T=w.getBoundingClientRect(),N=An(w),j=T.left+(w.clientLeft+parseFloat(N.paddingLeft))*C.x,A=T.top+(w.clientTop+parseFloat(N.paddingTop))*C.y;g*=C.x,p*=C.y,b*=C.x,v*=C.y,g+=j,p+=A,S=on(w),w=tm(S)}}return oc({width:b,height:v,x:g,y:p})}function Oc(t,a){const o=Rc(t).scrollLeft;return a?a.left+o:Or(Pn(t)).left+o}function kw(t,a){const o=t.getBoundingClientRect(),s=o.left+a.scrollLeft-Oc(t,o),l=o.top+a.scrollTop;return{x:s,y:l}}function jj(t){let{elements:a,rect:o,offsetParent:s,strategy:l}=t;const u=l==="fixed",f=Pn(s),m=a?_c(a.floating):!1;if(s===f||m&&u)return o;let g={scrollLeft:0,scrollTop:0},p=In(1);const b=In(0),v=va(s);if((v||!v&&!u)&&(($o(s)!=="body"||di(f))&&(g=Rc(s)),v)){const E=Or(s);p=Do(s),b.x=E.x+s.clientLeft,b.y=E.y+s.clientTop}const k=f&&!v&&!u?kw(f,g):In(0);return{width:o.width*p.x,height:o.height*p.y,x:o.x*p.x-g.scrollLeft*p.x+b.x+k.x,y:o.y*p.y-g.scrollTop*p.y+b.y+k.y}}function Aj(t){return Array.from(t.getClientRects())}function _j(t){const a=Pn(t),o=Rc(t),s=t.ownerDocument.body,l=an(a.scrollWidth,a.clientWidth,s.scrollWidth,s.clientWidth),u=an(a.scrollHeight,a.clientHeight,s.scrollHeight,s.clientHeight);let f=-o.scrollLeft+Oc(t);const m=-o.scrollTop;return An(s).direction==="rtl"&&(f+=an(a.clientWidth,s.clientWidth)-l),{width:l,height:u,x:f,y:m}}const qy=25;function Rj(t,a){const o=on(t),s=Pn(t),l=o.visualViewport;let u=s.clientWidth,f=s.clientHeight,m=0,g=0;if(l){u=l.width,f=l.height;const b=Fm();(!b||b&&a==="fixed")&&(m=l.offsetLeft,g=l.offsetTop)}const p=Oc(s);if(p<=0){const b=s.ownerDocument,v=b.body,k=getComputedStyle(v),E=b.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,S=Math.abs(s.clientWidth-v.clientWidth-E);S<=qy&&(u-=S)}else p<=qy&&(u+=p);return{width:u,height:f,x:m,y:g}}function Oj(t,a){const o=Or(t,!0,a==="fixed"),s=o.top+t.clientTop,l=o.left+t.clientLeft,u=va(t)?Do(t):In(1),f=t.clientWidth*u.x,m=t.clientHeight*u.y,g=l*u.x,p=s*u.y;return{width:f,height:m,x:g,y:p}}function Py(t,a,o){let s;if(a==="viewport")s=Rj(t,o);else if(a==="document")s=_j(Pn(t));else if(jn(a))s=Oj(a,o);else{const l=xw(t);s={x:a.x-l.x,y:a.y-l.y,width:a.width,height:a.height}}return oc(s)}function Sw(t,a){const o=nr(t);return o===a||!jn(o)||Uo(o)?!1:An(o).position==="fixed"||Sw(o,a)}function Dj(t,a){const o=a.get(t);if(o)return o;let s=ni(t,[],!1).filter(m=>jn(m)&&$o(m)!=="body"),l=null;const u=An(t).position==="fixed";let f=u?nr(t):t;for(;jn(f)&&!Uo(f);){const m=An(f),g=Pm(f);!g&&m.position==="fixed"&&(l=null),(u?!g&&!l:!g&&m.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||di(f)&&!g&&Sw(t,f))?s=s.filter(b=>b!==f):l=m,f=nr(f)}return a.set(t,s),s}function Mj(t){let{element:a,boundary:o,rootBoundary:s,strategy:l}=t;const f=[...o==="clippingAncestors"?_c(a)?[]:Dj(a,this._c):[].concat(o),s],m=Py(a,f[0],l);let g=m.top,p=m.right,b=m.bottom,v=m.left;for(let k=1;k<f.length;k++){const E=Py(a,f[k],l);g=an(E.top,g),p=tr(E.right,p),b=tr(E.bottom,b),v=an(E.left,v)}return{width:p-v,height:b-g,x:v,y:g}}function Lj(t){const{width:a,height:o}=ww(t);return{width:a,height:o}}function zj(t,a,o){const s=va(a),l=Pn(a),u=o==="fixed",f=Or(t,!0,u,a);let m={scrollLeft:0,scrollTop:0};const g=In(0);function p(){g.x=Oc(l)}if(s||!s&&!u)if(($o(a)!=="body"||di(l))&&(m=Rc(a)),s){const E=Or(a,!0,u,a);g.x=E.x+a.clientLeft,g.y=E.y+a.clientTop}else l&&p();u&&!s&&l&&p();const b=l&&!s&&!u?kw(l,m):In(0),v=f.left+m.scrollLeft-g.x-b.x,k=f.top+m.scrollTop-g.y-b.y;return{x:v,y:k,width:f.width,height:f.height}}function kf(t){return An(t).position==="static"}function Fy(t,a){if(!va(t)||An(t).position==="fixed")return null;if(a)return a(t);let o=t.offsetParent;return Pn(t)===o&&(o=o.ownerDocument.body),o}function Ew(t,a){const o=on(t);if(_c(t))return o;if(!va(t)){let l=nr(t);for(;l&&!Uo(l);){if(jn(l)&&!kf(l))return l;l=nr(l)}return o}let s=Fy(t,a);for(;s&&kj(s)&&kf(s);)s=Fy(s,a);return s&&Uo(s)&&kf(s)&&!Pm(s)?o:s||Cj(t)||o}const Hj=async function(t){const a=this.getOffsetParent||Ew,o=this.getDimensions,s=await o(t.floating);return{reference:zj(t.reference,await a(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Uj(t){return An(t).direction==="rtl"}const Bj={convertOffsetParentRelativeRectToViewportRelativeRect:jj,getDocumentElement:Pn,getClippingRect:Mj,getOffsetParent:Ew,getElementRects:Hj,getClientRects:Aj,getDimensions:Lj,getScale:Do,isElement:jn,isRTL:Uj};function Cw(t,a){return t.x===a.x&&t.y===a.y&&t.width===a.width&&t.height===a.height}function Wj(t,a){let o=null,s;const l=Pn(t);function u(){var m;clearTimeout(s),(m=o)==null||m.disconnect(),o=null}function f(m,g){m===void 0&&(m=!1),g===void 0&&(g=1),u();const p=t.getBoundingClientRect(),{left:b,top:v,width:k,height:E}=p;if(m||a(),!k||!E)return;const S=Ul(v),w=Ul(l.clientWidth-(b+k)),C=Ul(l.clientHeight-(v+E)),T=Ul(b),j={rootMargin:-S+"px "+-w+"px "+-C+"px "+-T+"px",threshold:an(0,tr(1,g))||1};let A=!0;function O(D){const L=D[0].intersectionRatio;if(L!==g){if(!A)return f();L?f(!1,L):s=setTimeout(()=>{f(!1,1e-7)},1e3)}L===1&&!Cw(p,t.getBoundingClientRect())&&f(),A=!1}try{o=new IntersectionObserver(O,{...j,root:l.ownerDocument})}catch{o=new IntersectionObserver(O,j)}o.observe(t)}return f(!0),u}function Ij(t,a,o,s){s===void 0&&(s={});const{ancestorScroll:l=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:m=typeof IntersectionObserver=="function",animationFrame:g=!1}=s,p=Km(t),b=l||u?[...p?ni(p):[],...a?ni(a):[]]:[];b.forEach(T=>{l&&T.addEventListener("scroll",o,{passive:!0}),u&&T.addEventListener("resize",o)});const v=p&&m?Wj(p,o):null;let k=-1,E=null;f&&(E=new ResizeObserver(T=>{let[N]=T;N&&N.target===p&&E&&a&&(E.unobserve(a),cancelAnimationFrame(k),k=requestAnimationFrame(()=>{var j;(j=E)==null||j.observe(a)})),o()}),p&&!g&&E.observe(p),a&&E.observe(a));let S,w=g?Or(t):null;g&&C();function C(){const T=Or(t);w&&!Cw(w,T)&&o(),w=T,S=requestAnimationFrame(C)}return o(),()=>{var T;b.forEach(N=>{l&&N.removeEventListener("scroll",o),u&&N.removeEventListener("resize",o)}),v?.(),(T=E)==null||T.disconnect(),E=null,g&&cancelAnimationFrame(S)}}const qj=yj,Pj=bj,Fj=hj,Kj=xj,Yj=gj,Ky=pj,$j=wj,Vj=(t,a,o)=>{const s=new Map,l={platform:Bj,...o},u={...l.platform,_c:s};return mj(t,a,{...l,platform:u})};var Gj=typeof document<"u",Xj=function(){},Yl=Gj?y.useLayoutEffect:Xj;function sc(t,a){if(t===a)return!0;if(typeof t!=typeof a)return!1;if(typeof t=="function"&&t.toString()===a.toString())return!0;let o,s,l;if(t&&a&&typeof t=="object"){if(Array.isArray(t)){if(o=t.length,o!==a.length)return!1;for(s=o;s--!==0;)if(!sc(t[s],a[s]))return!1;return!0}if(l=Object.keys(t),o=l.length,o!==Object.keys(a).length)return!1;for(s=o;s--!==0;)if(!{}.hasOwnProperty.call(a,l[s]))return!1;for(s=o;s--!==0;){const u=l[s];if(!(u==="_owner"&&t.$$typeof)&&!sc(t[u],a[u]))return!1}return!0}return t!==t&&a!==a}function Tw(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Yy(t,a){const o=Tw(t);return Math.round(a*o)/o}function Sf(t){const a=y.useRef(t);return Yl(()=>{a.current=t}),a}function Zj(t){t===void 0&&(t={});const{placement:a="bottom",strategy:o="absolute",middleware:s=[],platform:l,elements:{reference:u,floating:f}={},transform:m=!0,whileElementsMounted:g,open:p}=t,[b,v]=y.useState({x:0,y:0,strategy:o,placement:a,middlewareData:{},isPositioned:!1}),[k,E]=y.useState(s);sc(k,s)||E(s);const[S,w]=y.useState(null),[C,T]=y.useState(null),N=y.useCallback(W=>{W!==D.current&&(D.current=W,w(W))},[]),j=y.useCallback(W=>{W!==L.current&&(L.current=W,T(W))},[]),A=u||S,O=f||C,D=y.useRef(null),L=y.useRef(null),P=y.useRef(b),J=g!=null,Q=Sf(g),$=Sf(l),F=Sf(p),ne=y.useCallback(()=>{if(!D.current||!L.current)return;const W={placement:a,strategy:o,middleware:k};$.current&&(W.platform=$.current),Vj(D.current,L.current,W).then(G=>{const V={...G,isPositioned:F.current!==!1};Z.current&&!sc(P.current,V)&&(P.current=V,Cc.flushSync(()=>{v(V)}))})},[k,a,o,$,F]);Yl(()=>{p===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,v(W=>({...W,isPositioned:!1})))},[p]);const Z=y.useRef(!1);Yl(()=>(Z.current=!0,()=>{Z.current=!1}),[]),Yl(()=>{if(A&&(D.current=A),O&&(L.current=O),A&&O){if(Q.current)return Q.current(A,O,ne);ne()}},[A,O,ne,Q,J]);const q=y.useMemo(()=>({reference:D,floating:L,setReference:N,setFloating:j}),[N,j]),M=y.useMemo(()=>({reference:A,floating:O}),[A,O]),U=y.useMemo(()=>{const W={position:o,left:0,top:0};if(!M.floating)return W;const G=Yy(M.floating,b.x),V=Yy(M.floating,b.y);return m?{...W,transform:"translate("+G+"px, "+V+"px)",...Tw(M.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:G,top:V}},[o,m,M.floating,b.x,b.y]);return y.useMemo(()=>({...b,update:ne,refs:q,elements:M,floatingStyles:U}),[b,ne,q,M,U])}const Qj=t=>{function a(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:t,fn(o){const{element:s,padding:l}=typeof t=="function"?t(o):t;return s&&a(s)?s.current!=null?Ky({element:s.current,padding:l}).fn(o):{}:s?Ky({element:s,padding:l}).fn(o):{}}}},Jj=(t,a)=>{const o=qj(t);return{name:o.name,fn:o.fn,options:[t,a]}},eA=(t,a)=>{const o=Pj(t);return{name:o.name,fn:o.fn,options:[t,a]}},tA=(t,a)=>({fn:$j(t).fn,options:[t,a]}),nA=(t,a)=>{const o=Fj(t);return{name:o.name,fn:o.fn,options:[t,a]}},aA=(t,a)=>{const o=Kj(t);return{name:o.name,fn:o.fn,options:[t,a]}},rA=(t,a)=>{const o=Yj(t);return{name:o.name,fn:o.fn,options:[t,a]}},oA=(t,a)=>{const o=Qj(t);return{name:o.name,fn:o.fn,options:[t,a]}};var sA="Arrow",Nw=y.forwardRef((t,a)=>{const{children:o,width:s=10,height:l=5,...u}=t;return c.jsx(Vt.svg,{...u,ref:a,width:s,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?o:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});Nw.displayName=sA;var iA=Nw;function lA(t){const[a,o]=y.useState(void 0);return er(()=>{if(t){o({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const u=l[0];let f,m;if("borderBoxSize"in u){const g=u.borderBoxSize,p=Array.isArray(g)?g[0]:g;f=p.inlineSize,m=p.blockSize}else f=t.offsetWidth,m=t.offsetHeight;o({width:f,height:m})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else o(void 0)},[t]),a}var Ym="Popper",[jw,Aw]=Om(Ym),[cA,_w]=jw(Ym),Rw=t=>{const{__scopePopper:a,children:o}=t,[s,l]=y.useState(null);return c.jsx(cA,{scope:a,anchor:s,onAnchorChange:l,children:o})};Rw.displayName=Ym;var Ow="PopperAnchor",Dw=y.forwardRef((t,a)=>{const{__scopePopper:o,virtualRef:s,...l}=t,u=_w(Ow,o),f=y.useRef(null),m=_n(a,f),g=y.useRef(null);return y.useEffect(()=>{const p=g.current;g.current=s?.current||f.current,p!==g.current&&u.onAnchorChange(g.current)}),s?null:c.jsx(Vt.div,{...l,ref:m})});Dw.displayName=Ow;var $m="PopperContent",[uA,dA]=jw($m),Mw=y.forwardRef((t,a)=>{const{__scopePopper:o,side:s="bottom",sideOffset:l=0,align:u="center",alignOffset:f=0,arrowPadding:m=0,avoidCollisions:g=!0,collisionBoundary:p=[],collisionPadding:b=0,sticky:v="partial",hideWhenDetached:k=!1,updatePositionStrategy:E="optimized",onPlaced:S,...w}=t,C=_w($m,o),[T,N]=y.useState(null),j=_n(a,ue=>N(ue)),[A,O]=y.useState(null),D=lA(A),L=D?.width??0,P=D?.height??0,J=s+(u!=="center"?"-"+u:""),Q=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},$=Array.isArray(p)?p:[p],F=$.length>0,ne={padding:Q,boundary:$.filter(mA),altBoundary:F},{refs:Z,floatingStyles:q,placement:M,isPositioned:U,middlewareData:W}=Zj({strategy:"fixed",placement:J,whileElementsMounted:(...ue)=>Ij(...ue,{animationFrame:E==="always"}),elements:{reference:C.anchor},middleware:[Jj({mainAxis:l+P,alignmentAxis:f}),g&&eA({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?tA():void 0,...ne}),g&&nA({...ne}),aA({...ne,apply:({elements:ue,rects:le,availableWidth:ie,availableHeight:xe})=>{const{width:Ne,height:he}=le.reference,we=ue.floating.style;we.setProperty("--radix-popper-available-width",`${ie}px`),we.setProperty("--radix-popper-available-height",`${xe}px`),we.setProperty("--radix-popper-anchor-width",`${Ne}px`),we.setProperty("--radix-popper-anchor-height",`${he}px`)}}),A&&oA({element:A,padding:m}),pA({arrowWidth:L,arrowHeight:P}),k&&rA({strategy:"referenceHidden",...ne})]}),[G,V]=Hw(M),R=zo(S);er(()=>{U&&R?.()},[U,R]);const B=W.arrow?.x,se=W.arrow?.y,re=W.arrow?.centerOffset!==0,[ce,fe]=y.useState();return er(()=>{T&&fe(window.getComputedStyle(T).zIndex)},[T]),c.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:U?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:c.jsx(uA,{scope:o,placedSide:G,onArrowChange:O,arrowX:B,arrowY:se,shouldHideArrow:re,children:c.jsx(Vt.div,{"data-side":G,"data-align":V,...w,ref:j,style:{...w.style,animation:U?void 0:"none"}})})})});Mw.displayName=$m;var Lw="PopperArrow",fA={top:"bottom",right:"left",bottom:"top",left:"right"},zw=y.forwardRef(function(a,o){const{__scopePopper:s,...l}=a,u=dA(Lw,s),f=fA[u.placedSide];return c.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:c.jsx(iA,{...l,ref:o,style:{...l.style,display:"block"}})})});zw.displayName=Lw;function mA(t){return t!==null}var pA=t=>({name:"transformOrigin",options:t,fn(a){const{placement:o,rects:s,middlewareData:l}=a,f=l.arrow?.centerOffset!==0,m=f?0:t.arrowWidth,g=f?0:t.arrowHeight,[p,b]=Hw(o),v={start:"0%",center:"50%",end:"100%"}[b],k=(l.arrow?.x??0)+m/2,E=(l.arrow?.y??0)+g/2;let S="",w="";return p==="bottom"?(S=f?v:`${k}px`,w=`${-g}px`):p==="top"?(S=f?v:`${k}px`,w=`${s.floating.height+g}px`):p==="right"?(S=`${-g}px`,w=f?v:`${E}px`):p==="left"&&(S=`${s.floating.width+g}px`,w=f?v:`${E}px`),{data:{x:S,y:w}}}});function Hw(t){const[a,o="center"]=t.split("-");return[a,o]}var hA=Rw,gA=Dw,vA=Mw,yA=zw,bA=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),wA="VisuallyHidden",Uw=y.forwardRef((t,a)=>c.jsx(Vt.span,{...t,ref:a,style:{...bA,...t.style}}));Uw.displayName=wA;var xA=Uw,[Dc]=Om("Tooltip",[Aw]),Mc=Aw(),Bw="TooltipProvider",kA=700,nm="tooltip.open",[SA,Vm]=Dc(Bw),Ww=t=>{const{__scopeTooltip:a,delayDuration:o=kA,skipDelayDuration:s=300,disableHoverableContent:l=!1,children:u}=t,f=y.useRef(!0),m=y.useRef(!1),g=y.useRef(0);return y.useEffect(()=>{const p=g.current;return()=>window.clearTimeout(p)},[]),c.jsx(SA,{scope:a,isOpenDelayedRef:f,delayDuration:o,onOpen:y.useCallback(()=>{window.clearTimeout(g.current),f.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>f.current=!0,s)},[s]),isPointerInTransitRef:m,onPointerInTransitChange:y.useCallback(p=>{m.current=p},[]),disableHoverableContent:l,children:u})};Ww.displayName=Bw;var ai="Tooltip",[EA,fi]=Dc(ai),Iw=t=>{const{__scopeTooltip:a,children:o,open:s,defaultOpen:l,onOpenChange:u,disableHoverableContent:f,delayDuration:m}=t,g=Vm(ai,t.__scopeTooltip),p=Mc(a),[b,v]=y.useState(null),k=Pl(),E=y.useRef(0),S=f??g.disableHoverableContent,w=m??g.delayDuration,C=y.useRef(!1),[T,N]=S0({prop:s,defaultProp:l??!1,onChange:L=>{L?(g.onOpen(),document.dispatchEvent(new CustomEvent(nm))):g.onClose(),u?.(L)},caller:ai}),j=y.useMemo(()=>T?C.current?"delayed-open":"instant-open":"closed",[T]),A=y.useCallback(()=>{window.clearTimeout(E.current),E.current=0,C.current=!1,N(!0)},[N]),O=y.useCallback(()=>{window.clearTimeout(E.current),E.current=0,N(!1)},[N]),D=y.useCallback(()=>{window.clearTimeout(E.current),E.current=window.setTimeout(()=>{C.current=!0,N(!0),E.current=0},w)},[w,N]);return y.useEffect(()=>()=>{E.current&&(window.clearTimeout(E.current),E.current=0)},[]),c.jsx(hA,{...p,children:c.jsx(EA,{scope:a,contentId:k,open:T,stateAttribute:j,trigger:b,onTriggerChange:v,onTriggerEnter:y.useCallback(()=>{g.isOpenDelayedRef.current?D():A()},[g.isOpenDelayedRef,D,A]),onTriggerLeave:y.useCallback(()=>{S?O():(window.clearTimeout(E.current),E.current=0)},[O,S]),onOpen:A,onClose:O,disableHoverableContent:S,children:o})})};Iw.displayName=ai;var am="TooltipTrigger",qw=y.forwardRef((t,a)=>{const{__scopeTooltip:o,...s}=t,l=fi(am,o),u=Vm(am,o),f=Mc(o),m=y.useRef(null),g=_n(a,m,l.onTriggerChange),p=y.useRef(!1),b=y.useRef(!1),v=y.useCallback(()=>p.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),c.jsx(gA,{asChild:!0,...f,children:c.jsx(Vt.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...s,ref:g,onPointerMove:Kt(t.onPointerMove,k=>{k.pointerType!=="touch"&&!b.current&&!u.isPointerInTransitRef.current&&(l.onTriggerEnter(),b.current=!0)}),onPointerLeave:Kt(t.onPointerLeave,()=>{l.onTriggerLeave(),b.current=!1}),onPointerDown:Kt(t.onPointerDown,()=>{l.open&&l.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:Kt(t.onFocus,()=>{p.current||l.onOpen()}),onBlur:Kt(t.onBlur,l.onClose),onClick:Kt(t.onClick,l.onClose)})})});qw.displayName=am;var Gm="TooltipPortal",[CA,TA]=Dc(Gm,{forceMount:void 0}),Pw=t=>{const{__scopeTooltip:a,forceMount:o,children:s,container:l}=t,u=fi(Gm,a);return c.jsx(CA,{scope:a,forceMount:o,children:c.jsx(Fo,{present:o||u.open,children:c.jsx(Mm,{asChild:!0,container:l,children:s})})})};Pw.displayName=Gm;var Bo="TooltipContent",Fw=y.forwardRef((t,a)=>{const o=TA(Bo,t.__scopeTooltip),{forceMount:s=o.forceMount,side:l="top",...u}=t,f=fi(Bo,t.__scopeTooltip);return c.jsx(Fo,{present:s||f.open,children:f.disableHoverableContent?c.jsx(Kw,{side:l,...u,ref:a}):c.jsx(NA,{side:l,...u,ref:a})})}),NA=y.forwardRef((t,a)=>{const o=fi(Bo,t.__scopeTooltip),s=Vm(Bo,t.__scopeTooltip),l=y.useRef(null),u=_n(a,l),[f,m]=y.useState(null),{trigger:g,onClose:p}=o,b=l.current,{onPointerInTransitChange:v}=s,k=y.useCallback(()=>{m(null),v(!1)},[v]),E=y.useCallback((S,w)=>{const C=S.currentTarget,T={x:S.clientX,y:S.clientY},N=OA(T,C.getBoundingClientRect()),j=DA(T,N),A=MA(w.getBoundingClientRect()),O=zA([...j,...A]);m(O),v(!0)},[v]);return y.useEffect(()=>()=>k(),[k]),y.useEffect(()=>{if(g&&b){const S=C=>E(C,b),w=C=>E(C,g);return g.addEventListener("pointerleave",S),b.addEventListener("pointerleave",w),()=>{g.removeEventListener("pointerleave",S),b.removeEventListener("pointerleave",w)}}},[g,b,E,k]),y.useEffect(()=>{if(f){const S=w=>{const C=w.target,T={x:w.clientX,y:w.clientY},N=g?.contains(C)||b?.contains(C),j=!LA(T,f);N?k():j&&(k(),p())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[g,b,f,p,k]),c.jsx(Kw,{...t,ref:u})}),[jA,AA]=Dc(ai,{isInside:!1}),_A=TC("TooltipContent"),Kw=y.forwardRef((t,a)=>{const{__scopeTooltip:o,children:s,"aria-label":l,onEscapeKeyDown:u,onPointerDownOutside:f,...m}=t,g=fi(Bo,o),p=Mc(o),{onClose:b}=g;return y.useEffect(()=>(document.addEventListener(nm,b),()=>document.removeEventListener(nm,b)),[b]),y.useEffect(()=>{if(g.trigger){const v=k=>{k.target?.contains(g.trigger)&&b()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[g.trigger,b]),c.jsx(Dm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:v=>v.preventDefault(),onDismiss:b,children:c.jsxs(vA,{"data-state":g.stateAttribute,...p,...m,ref:a,style:{...m.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(_A,{children:s}),c.jsx(jA,{scope:o,isInside:!0,children:c.jsx(xA,{id:g.contentId,role:"tooltip",children:l||s})})]})})});Fw.displayName=Bo;var Yw="TooltipArrow",RA=y.forwardRef((t,a)=>{const{__scopeTooltip:o,...s}=t,l=Mc(o);return AA(Yw,o).isInside?null:c.jsx(yA,{...l,...s,ref:a})});RA.displayName=Yw;function OA(t,a){const o=Math.abs(a.top-t.y),s=Math.abs(a.bottom-t.y),l=Math.abs(a.right-t.x),u=Math.abs(a.left-t.x);switch(Math.min(o,s,l,u)){case u:return"left";case l:return"right";case o:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function DA(t,a,o=5){const s=[];switch(a){case"top":s.push({x:t.x-o,y:t.y+o},{x:t.x+o,y:t.y+o});break;case"bottom":s.push({x:t.x-o,y:t.y-o},{x:t.x+o,y:t.y-o});break;case"left":s.push({x:t.x+o,y:t.y-o},{x:t.x+o,y:t.y+o});break;case"right":s.push({x:t.x-o,y:t.y-o},{x:t.x-o,y:t.y+o});break}return s}function MA(t){const{top:a,right:o,bottom:s,left:l}=t;return[{x:l,y:a},{x:o,y:a},{x:o,y:s},{x:l,y:s}]}function LA(t,a){const{x:o,y:s}=t;let l=!1;for(let u=0,f=a.length-1;u<a.length;f=u++){const m=a[u],g=a[f],p=m.x,b=m.y,v=g.x,k=g.y;b>s!=k>s&&o<(v-p)*(s-b)/(k-b)+p&&(l=!l)}return l}function zA(t){const a=t.slice();return a.sort((o,s)=>o.x<s.x?-1:o.x>s.x?1:o.y<s.y?-1:o.y>s.y?1:0),HA(a)}function HA(t){if(t.length<=1)return t.slice();const a=[];for(let s=0;s<t.length;s++){const l=t[s];for(;a.length>=2;){const u=a[a.length-1],f=a[a.length-2];if((u.x-f.x)*(l.y-f.y)>=(u.y-f.y)*(l.x-f.x))a.pop();else break}a.push(l)}a.pop();const o=[];for(let s=t.length-1;s>=0;s--){const l=t[s];for(;o.length>=2;){const u=o[o.length-1],f=o[o.length-2];if((u.x-f.x)*(l.y-f.y)>=(u.y-f.y)*(l.x-f.x))o.pop();else break}o.push(l)}return o.pop(),a.length===1&&o.length===1&&a[0].x===o[0].x&&a[0].y===o[0].y?a:a.concat(o)}var $w=Ww,UA=Iw,BA=qw,WA=Pw,IA=Fw;const Je=({children:t,label:a,side:o="top",align:s="center"})=>a?c.jsx($w,{delayDuration:250,skipDelayDuration:150,children:c.jsxs(UA,{children:[c.jsx(BA,{asChild:!0,children:t}),c.jsx(WA,{children:c.jsx(IA,{className:"tooltip",side:o,align:s,sideOffset:6,children:a})})]})}):c.jsx(c.Fragment,{children:t}),Vw=y.createContext(null),Gw=y.createContext([]),Ef=3,qA=t=>t==="success"?3e3:t==="warning"?5e3:0;let $y=0;const PA=()=>($y+=1,`t-${$y.toString(36)}-${Date.now().toString(36)}`),FA=({children:t})=>{const[a,o]=y.useState([]),s=y.useRef(new Map),l=y.useCallback(v=>{const k=s.current.get(v);k?.timer&&clearTimeout(k.timer),s.current.delete(v)},[]),u=y.useCallback(v=>{o(k=>k.filter(E=>E.id!==v)),l(v)},[l]),f=y.useCallback(({kind:v,message:k,durationMs:E})=>{const S=PA();o(C=>{const T=[...C,{id:S,kind:v,message:k}];if(T.length<=Ef)return T;const N=T.slice(0,T.length-Ef);for(const j of N)l(j.id);return T.slice(T.length-Ef)});const w=E??qA(v);if(w>0){const C=setTimeout(()=>u(S),w);s.current.set(S,{timer:C,dueAt:Date.now()+w,durationMs:w,remainingMs:w})}return S},[u,l]),m=y.useCallback(v=>{const k=s.current.get(v);k?.timer&&(clearTimeout(k.timer),s.current.set(v,{...k,timer:null,remainingMs:Math.max(0,k.dueAt-Date.now())}))},[]),g=y.useCallback(v=>{const k=s.current.get(v);if(!k||k.timer||k.remainingMs<=0)return;const E=setTimeout(()=>u(v),k.remainingMs);s.current.set(v,{...k,timer:E,dueAt:Date.now()+k.remainingMs})},[u]),p=y.useCallback(v=>s.current.get(v)?.durationMs??0,[]);y.useEffect(()=>{const v=s.current;return()=>{for(const k of v.values())k.timer&&clearTimeout(k.timer);v.clear()}},[]);const b=y.useMemo(()=>({show:f,dismiss:u,pauseDismiss:m,resumeDismiss:g,getDuration:p}),[f,u,m,g,p]);return c.jsx(Vw.Provider,{value:b,children:c.jsx(Gw.Provider,{value:a,children:t})})},sn=()=>{const t=y.useContext(Vw);if(!t)throw new Error("useToast must be used within ToastProvider");return t},KA=()=>y.useContext(Gw),YA=2e3,Cf=()=>document.visibilityState==="hidden",Xw=(t,a)=>{const o=Math.max(0,Math.floor((Date.now()-t)/1e3));return o<60?a("common.time.sAgo",{count:o}):o<3600?a("common.time.mAgo",{count:Math.floor(o/60)}):o<86400?a("common.time.hAgo",{count:Math.floor(o/3600)}):a("common.time.dAgo",{count:Math.floor(o/86400)})},$A={cancelled:"actionCenter.activity.cancelled",queued:"actionCenter.activity.queued",reported:"actionCenter.activity.reported",submitted:"actionCenter.activity.submitted"},ic=(t,a)=>{const o=t.toWorkerName??a("actionCenter.unknownWorker");return a($A[t.kind],{ago:Xw(t.timestamp,a),worker:o})},Xm=t=>t.reportPreview??t.taskPreview??t.label??t.phase,Zw=t=>t.currentDispatch?.taskPreview??t.latestReport?.reportPreview??t.terminalHint??null,Qw=(t,a)=>t.currentDispatch?a("actionCenter.currentDispatch"):t.latestReport?a("actionCenter.latestReport"):t.terminalHint?a("actionCenter.terminalHint"):a("actionCenter.workerStatus"),rm=(t,a)=>t.kind==="no_workers"?a("actionCenter.attention.noWorkers"):t.kind==="stopped_with_queue"?a("actionCenter.attention.stoppedWithQueue",{worker:t.workerName}):t.kind==="dispatch_waiting_report"?a("actionCenter.attention.waitingReport",{minutes:t.minutesAgo,worker:t.workerName??a("actionCenter.unknownWorker")}):a(t.kind==="remote_error"?"actionCenter.attention.remoteError":"actionCenter.attention.remoteRejected",{endpoint:t.endpoint??t.action,reason:t.reason??"unknown"}),lc=t=>t.kind==="stopped_with_queue"?`${t.kind}-${t.workerId}`:t.kind==="dispatch_waiting_report"?`${t.kind}-${t.dispatchId}`:t.kind==="remote_error"||t.kind==="remote_rejected"?`${t.kind}-${t.ts}-${t.action}-${t.endpoint??""}-${t.reason??""}`:t.kind,Jw=t=>{const[a,o]=y.useState(null),[s,l]=y.useState(!1),u=y.useCallback(async f=>GN(t,f?{signal:f}:void 0),[t]);return y.useEffect(()=>{let f=!1,m=!1,g=null,p=null;const b=async()=>{if(!(f||m||Cf())){m=!0,p=new AbortController;try{const k=await u(p.signal);if(f)return;o(k),l(!1)}catch{f||l(!0)}finally{p=null,m=!1}!f&&!Cf()&&(g=setTimeout(b,YA))}},v=()=>{f||Cf()||(g&&(clearTimeout(g),g=null),b())};return document.addEventListener("visibilitychange",v),b(),()=>{f=!0,p?.abort(),g&&clearTimeout(g),document.removeEventListener("visibilitychange",v)}},[u]),{error:s,summary:a}},ex=t=>{const{t:a}=be(),o=sn(),[s,l]=y.useState(!1);return{copyingRecap:s,handleCopyRecap:()=>{if(s)return;l(!0);const f=XN(t).then(m=>m.markdown);mw(f).then(()=>o.show({kind:"success",message:a("actionCenter.recapCopied")})).catch(()=>o.show({kind:"error",message:a("actionCenter.recapCopyFailed")})).finally(()=>l(!1))}}},Zm=t=>{const a=t?.recentActivity[0]??null,o=a?Xm(a):null,s=t?.attention.slice(0,5)??[],l=t?.workers.filter(f=>f.currentDispatch||f.latestReport||f.terminalHint||f.status==="working").slice(0,6)??[],u=t?.recentActivity.slice(0,6)??[];return{attention:s,evidenceWorkers:l,latest:a,latestDetail:o,recentActivity:u}},VA=t=>t==="reported"?"green":t==="cancelled"?"red":t==="queued"?"orange":"accent",GA=({copyingRecap:t,onCopyRecap:a,onOpenWorker:o,summary:s})=>{const{t:l}=be(),{attention:u,evidenceWorkers:f,recentActivity:m}=Zm(s);return c.jsxs("div",{className:"mt-2 grid gap-2 md:grid-cols-2","data-testid":"action-center-evidence",children:[c.jsx("div",{className:"flex min-w-0 justify-end md:col-span-2",children:c.jsxs("button",{type:"button",onClick:a,disabled:t,className:"inline-flex items-center gap-1.5 rounded border border-bright/40 px-2 py-1 text-xs text-sec hover:bg-2 hover:text-pri disabled:cursor-default disabled:opacity-60","data-testid":"action-center-copy-recap",children:[c.jsx(Dr,{size:12,"aria-hidden":!0}),l("actionCenter.copyRecap")]})}),u.length>0?c.jsxs("div",{className:"min-w-0 md:col-span-2",children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-ter",children:l("actionCenter.attention")}),c.jsx("ul",{className:"flex flex-col gap-px rounded border border-bright/40 bg-0",children:u.map(g=>c.jsx("li",{children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2 py-1.5 text-xs","data-testid":`action-center-attention-${lc(g)}`,children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 shrink-0 rounded-full",style:{background:g.severity==="error"?"var(--status-red)":g.severity==="warning"?"var(--status-orange)":"var(--text-tertiary)"},"aria-hidden":!0}),c.jsx("span",{className:"min-w-0 truncate text-sec",title:rm(g,l),children:rm(g,l)})]})},lc(g)))})]}):null,c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-ter",children:l("actionCenter.recent")}),m.length>0?c.jsx("ul",{className:"flex max-h-36 flex-col gap-px overflow-auto rounded border border-bright/40 bg-0",children:m.map(g=>{const p=Xm(g);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>o?.(g.toAgentId),className:"flex w-full min-w-0 items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-2 disabled:cursor-default disabled:hover:bg-transparent",disabled:!o,"data-testid":`action-center-activity-${g.id}`,children:[c.jsx("span",{className:"shrink-0 text-sec",children:ic(g,l)}),p?c.jsx("span",{className:"min-w-0 truncate text-ter",title:p,children:p}):null]})},g.id)})}):c.jsx("div",{className:"rounded border border-dashed border-bright/40 px-2 py-2 text-xs text-ter",children:l("actionCenter.noActivity")})]}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-ter",children:l("actionCenter.workers")}),f.length>0?c.jsx("ul",{className:"flex max-h-36 flex-col gap-px overflow-auto rounded border border-bright/40 bg-0",children:f.map(g=>{const p=Zw(g);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>o?.(g.id),className:"flex w-full min-w-0 items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-2 disabled:cursor-default disabled:hover:bg-transparent",disabled:!o,"data-testid":`action-center-worker-${g.id}`,children:[c.jsx("span",{className:"min-w-0 flex-1 truncate text-sec",children:g.name}),c.jsx("span",{className:"shrink-0 text-ter",children:Qw(g,l)}),p?c.jsx("span",{className:"min-w-0 flex-[1.4] truncate text-ter",title:p,children:p}):null]})},g.id)})}):c.jsx("div",{className:"rounded border border-dashed border-bright/40 px-2 py-2 text-xs text-ter",children:l("actionCenter.noWorkerEvidence")})]})]})},Bl=({icon:t,label:a,tone:o="neutral",value:s})=>c.jsxs("div",{className:"action-center-metric","data-tone":o,children:[c.jsx("div",{className:"action-center-metric__icon","aria-hidden":!0,children:t}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"mono text-lg font-semibold leading-none text-pri",children:s}),c.jsx("div",{className:"mt-1 truncate text-[11px] font-medium text-ter",children:a})]})]}),XA=({copyingRecap:t,error:a,onClose:o,onCopyRecap:s,onOpenWorker:l,open:u,summary:f})=>{const{t:m}=be(),g=yt(),{attention:p,evidenceWorkers:b,latest:v,latestDetail:k,recentActivity:E}=Zm(f),S=w=>{l?.(w),o()};return c.jsx(Mr,{open:u,onOpenChange:w=>!w&&o(),children:c.jsxs(Lr,{children:[c.jsx(zr,{"data-testid":"action-center-overlay",className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:c.jsxs(Hr,{"data-testid":"action-center-drawer","aria-label":m("actionCenter.title"),"data-mobile":g||void 0,className:"dialog-scale-pop elev-2 pointer-events-auto flex flex-col rounded-lg border",style:g?{background:"var(--bg-1)",borderColor:"var(--border-bright)"}:{background:"var(--bg-1)",borderColor:"var(--border-bright)",height:"min(720px, calc(100vh - 48px))",width:"min(820px, calc(100vw - 48px))"},children:[c.jsxs("header",{className:"flex items-center justify-between gap-3 border-b px-4 py-2",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs(Ur,{className:"flex items-center gap-2 text-base font-semibold text-pri",children:[c.jsx(bc,{size:17,className:"text-accent","aria-hidden":!0}),m("actionCenter.title")]}),c.jsx(Ko,{className:"text-xs text-ter",children:m("actionCenter.subtitle")})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[c.jsx(Je,{label:m("actionCenter.copyRecap"),children:c.jsxs("button",{type:"button",onClick:s,disabled:t||!f,className:"drawer-action-btn pointer-coarse:min-h-10","data-testid":"action-center-copy-recap",children:[t?c.jsx(Ja,{size:14,className:"animate-spin"}):c.jsx(Dr,{size:14}),c.jsx("span",{className:"hidden sm:inline",children:m("actionCenter.copyRecap")})]})}),c.jsx(Je,{label:m("common.close"),children:c.jsx("button",{type:"button",onClick:o,"aria-label":m("common.close"),className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:c.jsx(fa,{size:14})})})]})]}),c.jsxs("div",{className:"scroll-y min-h-0 flex-1 px-4 py-4",children:[a?c.jsxs("div",{className:"action-center-alert action-center-alert--error",children:[c.jsx(Js,{size:15,"aria-hidden":!0}),c.jsx("span",{children:m("actionCenter.loadFailed")})]}):null,f?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("section",{className:"action-center-hero","data-state":p.length>0?"attention":"calm",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"action-center-kicker",children:[c.jsx(wy,{size:13,"aria-hidden":!0}),m("actionCenter.liveSnapshot")]}),c.jsx("span",{className:"text-[11px] text-ter",children:m("actionCenter.updated",{ago:Xw(f.generatedAt,m)})})]}),c.jsx("p",{className:"mt-2 text-sm font-medium text-pri",children:v?ic(v,m):m("actionCenter.noActivity")}),k?c.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-sec",title:k,children:k}):null]}),c.jsx("div",{className:"action-center-hero__status",children:p.length>0?m("actionCenter.needsAttention",{count:p.length}):m("actionCenter.allClear")})]}),c.jsxs("section",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4","aria-label":m("actionCenter.metrics"),children:[c.jsx(Bl,{icon:c.jsx(Ec,{size:15}),label:m("actionCenter.totalWorkers"),value:f.summary.totalWorkers}),c.jsx(Bl,{icon:c.jsx(wy,{size:15}),label:m("actionCenter.workingWorkers"),tone:"green",value:f.summary.workingWorkers}),c.jsx(Bl,{icon:c.jsx(XS,{size:15}),label:m("actionCenter.openDispatches"),tone:f.summary.openDispatches>0?"orange":"neutral",value:f.summary.openDispatches}),c.jsx(Bl,{icon:c.jsx(i0,{size:15}),label:m("actionCenter.recentReports"),tone:"accent",value:f.summary.recentReports})]}),c.jsxs("section",{className:"grid gap-3 lg:grid-cols-[1fr_1fr]",children:[c.jsxs("div",{className:"action-center-panel lg:col-span-2",children:[c.jsx("div",{className:"action-center-panel__header",children:c.jsxs("div",{children:[c.jsx("h3",{children:m("actionCenter.attention")}),c.jsx("p",{children:m("actionCenter.attentionSubtitle")})]})}),p.length>0?c.jsx("ul",{className:"space-y-2",children:p.map(w=>c.jsx("li",{children:c.jsxs("div",{className:"action-center-attention-row","data-severity":w.severity,"data-testid":`action-center-attention-${lc(w)}`,children:[c.jsx(Js,{size:14,"aria-hidden":!0}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:rm(w,m)})]})},lc(w)))}):c.jsx("div",{className:"action-center-empty",children:m("actionCenter.noAttention")})]}),c.jsxs("div",{className:"action-center-panel",children:[c.jsx("div",{className:"action-center-panel__header",children:c.jsxs("div",{children:[c.jsx("h3",{children:m("actionCenter.recent")}),c.jsx("p",{children:m("actionCenter.recentSubtitle")})]})}),E.length>0?c.jsx("ul",{className:"space-y-1.5",children:E.map(w=>{const C=Xm(w);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>S(w.toAgentId),className:"action-center-list-row","data-tone":VA(w.kind),disabled:!l,"data-testid":`action-center-activity-${w.id}`,children:[c.jsx("span",{className:"action-center-row-dot","aria-hidden":!0}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsx("span",{className:"block truncate text-xs font-medium text-pri",children:ic(w,m)}),C?c.jsx("span",{className:"block truncate text-[11px] text-ter",children:C}):null]})]})},w.id)})}):c.jsx("div",{className:"action-center-empty",children:m("actionCenter.noActivity")})]}),c.jsxs("div",{className:"action-center-panel",children:[c.jsx("div",{className:"action-center-panel__header",children:c.jsxs("div",{children:[c.jsx("h3",{children:m("actionCenter.workers")}),c.jsx("p",{children:m("actionCenter.workersSubtitle")})]})}),b.length>0?c.jsx("ul",{className:"space-y-1.5",children:b.map(w=>{const C=Zw(w);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>S(w.id),className:"action-center-list-row","data-tone":w.status==="working"?"green":"neutral",disabled:!l,"data-testid":`action-center-worker-${w.id}`,children:[c.jsx("span",{className:"action-center-worker-avatar","aria-hidden":!0,children:c.jsx(QE,{size:13})}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c.jsx("span",{className:"truncate text-xs font-medium text-pri",children:w.name}),c.jsx("span",{className:"shrink-0 text-[11px] text-ter",children:Qw(w,m)})]}),C?c.jsx("span",{className:"block truncate text-[11px] text-ter",children:C}):null]})]})},w.id)})}):c.jsx("div",{className:"action-center-empty",children:m("actionCenter.noWorkerEvidence")})]})]})]}):c.jsxs("div",{className:"flex h-[320px] items-center justify-center text-ter",children:[c.jsx(Ja,{size:18,className:"animate-spin"}),c.jsx("span",{className:"ml-2 text-sm",children:m("actionCenter.loading")})]})]})]})})]})})},ZA=({onOpenWorker:t,workspaceId:a})=>{const{t:o}=be(),{error:s,summary:l}=Jw(a),{copyingRecap:u,handleCopyRecap:f}=ex(a),[m,g]=y.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsx(Je,{label:o(m?"actionCenter.collapse":"actionCenter.expand"),children:c.jsxs("button",{type:"button",onClick:()=>g(p=>!p),"aria-expanded":m,"aria-haspopup":"dialog","aria-label":o(m?"actionCenter.collapse":"actionCenter.expand"),"data-testid":"topbar-action-center",className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(bc,{size:13,"aria-hidden":!0}),c.jsx("span",{children:o("actionCenter.title")}),l&&l.summary.workingWorkers>0?c.jsx("span",{className:"mono rounded bg-3 px-1 text-[11px] text-accent",children:l.summary.workingWorkers}):null]})}),c.jsx(XA,{copyingRecap:u,error:s,onClose:()=>g(!1),onCopyRecap:f,onOpenWorker:t,open:m,summary:l})]})},QA=({onOpenWorker:t,workspaceId:a})=>{const{t:o}=be(),{error:s,summary:l}=Jw(a),{copyingRecap:u,handleCopyRecap:f}=ex(a),[m,g]=y.useState(!1),{latest:p,latestDetail:b}=Zm(l);return c.jsxs("section",{className:"shrink-0 border-b px-4 py-2","data-testid":"action-center-strip",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>g(v=>!v),"aria-expanded":m,"aria-label":o(m?"actionCenter.collapse":"actionCenter.expand"),className:"inline-flex items-center gap-1.5 rounded px-1 py-0.5 text-xs font-semibold uppercase tracking-wide text-ter hover:bg-3 hover:text-pri",children:[m?c.jsx(qo,{size:13,"aria-hidden":!0}):c.jsx(wc,{size:13,"aria-hidden":!0}),c.jsx(bc,{size:13,"aria-hidden":!0}),o("actionCenter.title")]}),c.jsx("span",{className:"pill pill--green",children:o("actionCenter.runningCount",{count:l?.summary.workingWorkers??0})}),c.jsx("span",{className:"pill pill--ghost",children:o("actionCenter.reportCount",{count:l?.summary.recentReports??0})})]}),c.jsx("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-xs text-sec",children:s?c.jsx("span",{style:{color:"var(--text-error)"},children:o("actionCenter.loadFailed")}):p?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"shrink-0 text-ter",children:ic(p,o)}),b?c.jsxs("span",{className:"min-w-0 truncate text-ter",title:b,children:["· ",b]}):null]}):c.jsx("span",{className:"text-ter",children:o(l?"actionCenter.noActivity":"actionCenter.loading")})}),m&&l?c.jsx(GA,{copyingRecap:u,onCopyRecap:f,onOpenWorker:t,summary:l}):null]})};let cc=!1;const om=new Set,JA=()=>cc,tx=t=>{if(cc!==t){cc=t;for(const a of om)a()}},e_=()=>{tx(!cc)},t_=t=>(om.add(t),()=>om.delete(t)),nx=()=>y.useSyncExternalStore(t_,JA,()=>!1),ax="hive.notification.settings",No={desktop:!1,detail:"brief",sound:"soft"},n_={beacon:"/sounds/hive-beacon.ogg",cascade:"/sounds/hive-cascade.ogg",chime:"/sounds/hive-chime.ogg",ping:"/sounds/hive-ping.ogg",resolve:"/sounds/hive-resolve.ogg",soft:"/sounds/hive-soft.ogg"},a_=t=>t==="off"||t==="ping"||t==="chime"||t==="soft"||t==="cascade"||t==="beacon"||t==="resolve",r_=()=>{if(typeof window>"u")return No;try{const t=window.localStorage.getItem(ax);if(!t)return No;const a=JSON.parse(t);return{desktop:typeof a.desktop=="boolean"?a.desktop:No.desktop,detail:a.detail==="detailed"?"detailed":No.detail,sound:a_(a.sound)?a.sound:No.sound}}catch{return No}},o_=t=>{try{window.localStorage.setItem(ax,JSON.stringify(t))}catch{}},Vy=t=>{if(!(t==="off"||typeof window>"u"))try{const a=new window.Audio(n_[t]);a.preload="auto",a.volume=.72,a.play()?.catch(()=>{})}catch{}},rx=y.createContext(null),s_=({children:t})=>{const a=sn(),{t:o}=be(),[s,l]=y.useState(()=>r_());y.useEffect(()=>{o_(s)},[s]);const u=y.useCallback(b=>{l(v=>({...v,...b}))},[]),f=y.useCallback(async()=>{if(typeof window>"u"||!("Notification"in window))return u({desktop:!1}),a.show({kind:"warning",message:o("notifications.toast.unsupported")}),!1;if(window.Notification.permission==="granted")return u({desktop:!0}),!0;if(window.Notification.permission==="denied")return u({desktop:!1}),a.show({kind:"warning",message:o("notifications.toast.blocked")}),!1;const v=await window.Notification.requestPermission()==="granted";return u({desktop:v}),v||a.show({kind:"warning",message:o("notifications.toast.declined")}),v},[o,a,u]),m=y.useCallback(({brief:b,detail:v,kind:k,title:E})=>{const S=s.detail==="detailed"&&v?v:b;if(a.show({kind:k,message:S}),Vy(s.sound),s.desktop&&typeof window<"u"&&"Notification"in window&&window.Notification.permission==="granted")try{new window.Notification(E,{body:S})}catch{}},[s,a]),g=y.useCallback(b=>{Vy(b)},[]),p=y.useMemo(()=>({notify:m,previewSound:g,requestDesktopNotifications:f,settings:s,updateSettings:u}),[m,g,f,s,u]);return c.jsx(rx.Provider,{value:p,children:t})},Lc=()=>{const t=y.useContext(rx);if(!t)throw new Error("useNotifications must be used within NotificationProvider");return t},i_={coder:"role.coder",custom:"role.custom",reviewer:"role.reviewer",sentinel:"role.sentinel",tester:"role.tester"},l_=t=>new Map(t.map(a=>[a.id,{id:a.id,name:a.name,pendingTaskCount:a.pendingTaskCount,role:a.role,status:a.status}])),c_=({terminalRuns:t,workers:a,workspace:o})=>{const{notify:s}=Lc(),{t:l}=be(),u=y.useRef(null);return y.useEffect(()=>{if(!o){u.current=null;return}const f=l_(a),m=u.current;if(u.current={workers:f,workspaceId:o.id},!(!m||m.workspaceId!==o.id))for(const g of f.values()){const p=m.workers.get(g.id);if(!p)continue;if(p.status!=="stopped"&&g.status==="stopped"){s({brief:l("notifications.workerStopped.brief",{name:g.name}),detail:l("notifications.workerStopped.detail",{name:g.name,workspace:o.name}),kind:"error",title:l("notifications.workerStopped.title")});continue}if(p.status==="stopped"&&g.status!=="stopped"){s({brief:l("notifications.workerStarted.brief",{name:g.name}),detail:l("notifications.workerStarted.detail",{name:g.name,workspace:o.name,role:l(i_[g.role])}),kind:"success",title:l("notifications.workerStarted.title")});continue}(g.pendingTaskCount<p.pendingTaskCount||p.status==="working"&&g.status==="idle")&&s({brief:l("notifications.workerReported.brief",{name:g.name}),detail:l("notifications.workerReported.detail",{name:g.name,workspace:o.name}),kind:"success",title:l("notifications.workerReported.title")})}},[s,l,a,o]),null},u_=({tabs:t,activeId:a,onSelect:o,onClose:s,onClosePanel:l,onNewShell:u,newShellPending:f})=>{const{t:m}=be();return c.jsxs("div",{role:"tablist","aria-label":m("terminalPanel.tablistAria"),className:"scrollbar-thin flex h-9 min-h-9 w-full items-stretch overflow-x-auto pointer-coarse:h-12 pointer-coarse:min-h-12",style:{background:"var(--bg-2)",borderBottom:"1px solid var(--border)"},"data-testid":"terminal-tab-strip",children:[t.map(g=>{const p=g.id===a,b=m("terminalPanel.closeTab",{name:g.label}),v=k=>{k.stopPropagation(),s(g.id)};return c.jsxs("div",{role:"tab","aria-selected":p,"data-testid":`terminal-tab-${g.id}`,onClick:()=>o(g.id),className:"group relative flex max-w-[200px] shrink-0 cursor-pointer items-center gap-1.5 border-r text-xs",style:{background:p?"var(--bg-1)":"transparent",borderRightColor:"var(--border)",color:p?"var(--text-primary)":"var(--text-secondary)"},children:[p?c.jsx("span",{"data-tab-accent":!0,"aria-hidden":!0,className:"pointer-events-none absolute top-0 right-0 left-0 h-0.5",style:{background:"var(--accent)"}}):null,c.jsxs("button",{type:"button","data-testid":`terminal-tab-select-${g.id}`,onClick:k=>{k.stopPropagation(),o(g.id)},className:"flex min-w-0 flex-1 items-center gap-1.5 py-2 pr-1 pl-3 text-left",style:{color:"inherit"},children:[c.jsx(kc,{size:12,"aria-hidden":!0}),c.jsx("span",{className:"truncate",children:g.label})]}),c.jsx(Je,{label:b,children:c.jsx("button",{type:"button","aria-label":b,"data-testid":`terminal-tab-close-${g.id}`,onClick:v,className:`mr-1 rounded p-0.5 pointer-coarse:p-2 transition ${p?"opacity-100":"opacity-0 group-hover:opacity-100 pointer-coarse:opacity-100"}`,style:{color:"var(--text-secondary)"},children:c.jsx(fa,{size:12,"aria-hidden":!0})})})]},g.id)}),c.jsxs("div",{className:"flex flex-1 items-center justify-end gap-1 px-2",children:[c.jsx(Je,{label:m("terminalPanel.closePanel"),children:c.jsx("button",{type:"button","aria-label":m("terminalPanel.closePanel"),"data-testid":"terminal-panel-close",onClick:l,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded border text-sec transition hover:text-pri disabled:opacity-50 pointer-coarse:h-10 pointer-coarse:w-10",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:c.jsx(fa,{size:12,"aria-hidden":!0})})}),c.jsx(Je,{label:m("terminalPanel.newShell"),children:c.jsx("button",{type:"button","aria-label":m("terminalPanel.newShell"),"data-testid":"terminal-tab-new-shell",onClick:u,disabled:f,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded border text-sec transition hover:text-pri disabled:opacity-50 pointer-coarse:h-10 pointer-coarse:w-10",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:f?c.jsx(Ja,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(Jl,{size:12,"aria-hidden":!0})})})]})]})},ox="hive.terminal-panel.height",sx="hive.terminal-panel.collapsed",sm=160,d_=.35,f_=160,Vs=t=>{const a=typeof window<"u"?window.innerHeight:800,o=Math.max(sm,a-f_);return Math.min(Math.max(t,sm),o)},Tf=()=>{const t=typeof window<"u"?window.innerHeight:800;return Vs(Math.floor(t*d_))},m_=()=>{try{const t=window.localStorage.getItem(ox);if(!t)return Tf();const a=Number.parseInt(t,10);return Number.isFinite(a)?Vs(a):Tf()}catch{return Tf()}},p_=()=>{try{return window.localStorage.getItem(sx)==="1"}catch{return!1}},h_=()=>{const[t,a]=y.useState(()=>m_()),[o,s]=y.useState(()=>p_()),[l,u]=y.useState(!1);y.useEffect(()=>{try{window.localStorage.setItem(ox,String(Math.round(t)))}catch{}},[t]),y.useEffect(()=>{try{window.localStorage.setItem(sx,o?"1":"0")}catch{}},[o]),y.useEffect(()=>{const p=()=>a(b=>Vs(b));return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]);const f=y.useCallback(p=>a(Vs(p)),[]),m=y.useCallback(p=>s(p),[]),g=y.useCallback(p=>{p.preventDefault();const b=p.clientY;let v=t;a(C=>(v=C,C)),u(!0);const k=document.body.style.cursor,E=document.body.style.userSelect;document.body.style.cursor="ns-resize",document.body.style.userSelect="none";const S=C=>{const T=C.clientY-b;a(Vs(v-T))},w=()=>{u(!1),document.body.style.cursor=k,document.body.style.userSelect=E,document.removeEventListener("pointermove",S),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w)};document.addEventListener("pointermove",S),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w)},[t]);return{height:t,collapsed:o,dragging:l,setHeight:f,setCollapsed:m,beginDrag:g}},g_=(t,a)=>a?t.find(o=>o.id===a)??null:null,v_=({tabs:t,activeId:a,onSelect:o,onClose:s,onClosePanel:l,onNewShell:u,newShellPending:f,onStartWorker:m,startingWorkerId:g})=>{const{t:p}=be(),b=h_(),v=yt();if(t.length===0)return null;const k=g_(t,a)??t[0]??null;return c.jsxs("div",{"data-testid":"terminal-bottom-panel",className:"relative flex shrink-0 flex-col",style:{height:v?"45%":b.height,minHeight:v?"min(160px, 60%)":void 0,background:"var(--bg-1)",borderTop:"1px solid var(--border)"},tabIndex:-1,onKeyDown:E=>{(E.metaKey||E.ctrlKey)&&!E.altKey&&!E.shiftKey&&E.key.toLowerCase()==="w"&&a&&(E.preventDefault(),s(a))},children:[v?null:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":p("terminalPanel.resizeAria"),"aria-valuemin":sm,"aria-valuenow":Math.round(b.height),className:"absolute top-0 right-0 left-0 z-10 h-2 -translate-y-1 cursor-ns-resize",tabIndex:-1,"data-resizing":b.dragging||void 0,"data-testid":"terminal-panel-resize-handle",onPointerDown:b.beginDrag}),c.jsx(u_,{tabs:t,activeId:k?.id??null,onSelect:o,onClose:s,onClosePanel:l,onNewShell:u,newShellPending:f}),c.jsx("div",{className:"relative min-h-0 flex-1",style:{background:"var(--bg-crust)"},children:t.map(E=>c.jsx(y_,{tab:E,isActive:E.id===(k?.id??null),onStartWorker:m,startingWorkerId:g},E.id))})]})},y_=({tab:t,isActive:a,onStartWorker:o,startingWorkerId:s})=>{const{t:l}=be(),u=a?"flex h-full w-full":"hidden";if(t.kind==="worker"){if(!t.runId){const f=s===t.workerId;return c.jsxs("div",{className:a?"flex h-full w-full flex-col items-center justify-center gap-3 px-6 text-center text-xs text-ter":"hidden","data-testid":"terminal-panel-stopped-worker",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(kc,{size:14,"aria-hidden":!0}),l("terminalPanel.workerStopped",{name:t.label})]}),c.jsxs("button",{type:"button",onClick:()=>o(t.workerId),disabled:f,className:"icon-btn icon-btn--primary","data-testid":"terminal-panel-start-worker",children:[f?c.jsx(Ja,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(Po,{size:12,"aria-hidden":!0}),l(f?"common.starting":"common.start")]})]})}return c.jsx("div",{id:`worker-pty-${t.runId}`,className:u,"data-pty-slot":"worker","data-testid":`terminal-panel-slot-worker-${t.workerId}`})}return c.jsx("div",{id:`shell-pty-${t.runId}`,className:u,"data-pty-slot":"shell","data-testid":`terminal-panel-slot-shell-${t.runId}`})},Nf=t=>`hive.terminal-panel.tabs.${t}`,jf=t=>`hive.terminal-panel.active.${t}`,b_=t=>`worker:${t}`,w_=t=>`shell:${t}`,Gy=t=>{try{const a=window.localStorage.getItem(t);if(!a)return[];const o=JSON.parse(a);return Array.isArray(o)?o.filter(s=>typeof s=="string"):[]}catch{return[]}},Xy=t=>{try{return window.localStorage.getItem(t)??""}catch{return""}},Zy=(t,a)=>{try{window.localStorage.setItem(t,a)}catch{}},x_=({workspaceId:t,workers:a,terminalRuns:o})=>{const[s,l]=y.useState(()=>Gy(Nf(t))),[u,f]=y.useState(()=>{const N=Xy(jf(t));return N.length>0?N:null}),m=y.useRef(s);m.current=s;const g=y.useRef(t);y.useEffect(()=>{if(g.current===t)return;g.current=t,l(Gy(Nf(t)));const N=Xy(jf(t));f(N.length>0?N:null)},[t]);const p=y.useRef(!1);y.useEffect(()=>{p.current=a.length>0||o.length>0},[t]),y.useEffect(()=>{(a.length>0||o.length>0)&&(p.current=!0)},[a,o]),y.useEffect(()=>{p.current&&Zy(Nf(t),JSON.stringify(s))},[s,t]),y.useEffect(()=>{p.current&&Zy(jf(t),u??"")},[u,t]);const b=y.useMemo(()=>new Map(a.map(N=>[N.id,N])),[a]),{runByAgentId:v,shellRunById:k}=y.useMemo(()=>{const N=new Map,j=new Map;for(const A of o)N.set(A.agent_id,A),ti(A,t)&&j.set(A.run_id,A);return{runByAgentId:N,shellRunById:j}},[o,t]),E=y.useMemo(()=>{const N=[];for(const j of s)if(j.startsWith("worker:")){const A=j.slice(7),O=b.get(A);if(!O)continue;const D=v.get(O.id);N.push({id:j,kind:"worker",workerId:A,runId:D?.run_id??null,label:O.name})}else if(j.startsWith("shell:")){const A=j.slice(6),O=k.get(A);if(!O)continue;N.push({id:j,kind:"shell",runId:A,label:O.agent_name})}return N},[s,b,v,k]);y.useEffect(()=>{p.current&&l(N=>{const j=N.filter(A=>A.startsWith("worker:")?b.has(A.slice(7)):A.startsWith("shell:")?k.has(A.slice(6)):!1);return j.length===N.length?N:j})},[b,k]),y.useEffect(()=>{p.current&&(u&&E.some(N=>N.id===u)||f(E[0]?.id??null))},[u,E]);const S=y.useCallback(N=>{p.current=!0;const j=b_(N);l(A=>A.includes(j)?A:[...A,j]),f(j)},[]),w=y.useCallback(N=>{p.current=!0;const j=w_(N);l(A=>A.includes(j)?A:[...A,j]),f(j)},[]),C=y.useCallback(N=>{const j=m.current,A=j.filter(O=>O!==N);A.length!==j.length&&(l(A),f(O=>{if(O!==N)return O;const D=j.indexOf(N);return A[D]??A[D-1]??A[0]??null}))},[]),T=y.useCallback(N=>f(N),[]);return{tabs:E,activeId:u,openWorkerTab:S,openShellTab:w,closeTab:C,setActive:T}},Qy=500,k_=2500,S_=5e3,E_=t=>t.status==="starting",C_=(t,a)=>t>0?Math.min(Qy*2**t,S_):a.some(E_)?Qy:k_,Qm=t=>`${t}:orchestrator`,T_=(t,a)=>t.length!==a.length?!1:t.every((o,s)=>{const l=a[s];return l!==void 0&&o.agent_id===l.agent_id&&o.agent_name===l.agent_name&&o.run_id===l.run_id&&o.status===l.status&&o.terminal_input_profile===l.terminal_input_profile}),N_=t=>{const[a,o]=y.useState([]);return y.useEffect(()=>{if(!t){o([]);return}let s=!1,l=0,u=!1,f=[],m;const g=()=>{s||(m=window.setTimeout(p,C_(l,f)))},p=()=>{u||(u=!0,kN(t).then(b=>{s||(l=0,f=b,o(v=>T_(v,b)?v:b))}).catch(b=>{s||(l=Math.min(l+1,4),o(v=>v.length===0?v:[])),console.error("[hive] swallowed:terminalRuns.list",b)}).finally(()=>{u=!1,g()}))};return p(),()=>{s=!0,m!==void 0&&window.clearTimeout(m)}},[t]),a},j_=(t,a)=>t.find(o=>o.agent_id===Qm(a)),A_=(t,a)=>t.find(o=>o.agent_id===a),__=({onCloseFailed:t,onShellRunClosed:a,onShellRunStarted:o,panelTabs:s,shellRuns:l,workspaceId:u})=>{const[f,m]=y.useState(null),[g,p]=y.useState(null),[b,v]=y.useState(!1),k=y.useRef(new Map),E=y.useRef(0),S=y.useRef(new Map),w=y.useRef(new Map),C=y.useRef(new Set),T=y.useRef(u),j=(l.find(F=>F.run_id===g)??l[0]??null)?.run_id??null,A=y.useCallback((F,ne)=>{const Z=S.current.get(F)??new Set;Z.add(ne),S.current.set(F,Z)},[]),O=y.useCallback((F,ne,Z)=>{const q=w.current.get(F)??new Map;q.set(ne,Z),w.current.set(F,q),Z.finally(()=>{const M=w.current.get(F);M&&(M.delete(ne),M.size===0&&w.current.delete(F))}).catch(()=>{})},[]),D=y.useCallback((F,ne)=>{const Z=S.current.get(F);Z&&(Z.delete(ne),Z.size===0&&S.current.delete(F))},[]);y.useLayoutEffect(()=>{T.current=u},[u]),y.useEffect(()=>()=>{S.current.clear(),w.current.clear(),C.current.clear()},[]),y.useEffect(()=>{m(null),p(null),v(!1)},[u]),y.useEffect(()=>{if(!u)return;const F=S.current.get(u);if(!F)return;const ne=new Set(l.map(q=>q.run_id)),Z=w.current.get(u);for(const q of Array.from(F))Z?.has(q)||ne.has(q)||D(u,q)},[l,D,u]);const L=()=>{if(!u||k.current.has(u))return;const F=u,ne=E.current+1;E.current=ne,k.current.set(F,ne);const Z=()=>T.current===F,q=()=>k.current.get(F)===ne;m(null),v(!0),vN(F).then(M=>{o?.(F,M),Z()&&(p(M.run_id),s.openShellTab(M.run_id))}).catch(M=>{Z()&&m(M instanceof Error?M.message:String(M))}).finally(()=>{q()&&k.current.delete(F),Z()&&v(!1)})},P=()=>{if(!u||k.current.has(u)||C.current.has(u))return;const F=u,ne=Array.from(w.current.get(F)?.values()??[]);if(ne.length===0){L();return}C.current.add(F),m(null),v(!0),Promise.allSettled(ne).then(Z=>{Z.some(q=>q.status==="rejected")||T.current===F&&(k.current.has(F)||L())}).finally(()=>{C.current.delete(F),T.current===F&&!k.current.has(F)&&v(!1)})};return{closeShellTab:F=>{if(!u)return;const ne=l.find(q=>q.run_id!==F)??null;j===F&&p(ne?.run_id??null),a?.(u,F),A(u,F);const Z=yN(u,F).catch(q=>{throw D(u,F),t(q instanceof Error?q.message:String(q)),q});O(u,F,Z),Z.catch(()=>{})},openShell:()=>{if(!u||k.current.has(u)||b)return;const F=s.tabs.find(q=>q.kind==="shell");if(F){s.setActive(F.id);return}const ne=S.current.get(u)??new Set,Z=l.find(q=>!ne.has(q.run_id));if(Z){p(Z.run_id),s.openShellTab(Z.run_id);return}if(ne.size>0){P();return}L()},shellError:f,shellStarting:b,startNewShell:()=>{if(!u||k.current.has(u)||b)return;if((S.current.get(u)??new Set).size>0){P();return}L()}}},ix="hive.split.orch-pct",Ks=.3,Ys=.78,$l=.6,Jy=.02,Vl=(t,a,o)=>Math.min(o,Math.max(a,t)),R_=()=>{try{const t=localStorage.getItem(ix);if(!t)return $l;const a=Number.parseFloat(t);return Number.isFinite(a)?Vl(a,Ks,Ys):$l}catch{return $l}},O_=()=>{const t=y.useRef(null),[a,o]=y.useState(()=>R_()),[s,l]=y.useState(!1);y.useEffect(()=>{try{localStorage.setItem(ix,a.toFixed(4))}catch{}},[a]);const u=y.useCallback(m=>{m.preventDefault();const g=t.current;if(!g)return;l(!0);const p=document.body.style.userSelect,b=document.body.style.cursor;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const v=E=>{const S=g.getBoundingClientRect();if(S.width<=0)return;const w=(E.clientX-S.left)/S.width;o(Vl(w,Ks,Ys))},k=()=>{l(!1),document.body.style.userSelect=p,document.body.style.cursor=b,document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k)};document.addEventListener("pointermove",v),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k)},[]),f=y.useCallback(m=>{m.key==="ArrowLeft"?(m.preventDefault(),o(g=>Vl(g-Jy,Ks,Ys))):m.key==="ArrowRight"?(m.preventDefault(),o(g=>Vl(g+Jy,Ks,Ys))):m.key==="Home"?(m.preventDefault(),o(Ks)):m.key==="End"?(m.preventDefault(),o(Ys)):m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),o($l))},[]);return{containerRef:t,orchPct:a,dragging:s,beginDrag:u,onKeyDown:f}},mi=({title:t,description:a,icon:o,action:s})=>c.jsxs("div",{className:"m-auto flex max-w-[380px] flex-col items-center gap-3 px-6 py-8 text-center","data-testid":"empty-state",children:[o?c.jsx("div",{"data-testid":"empty-state-icon","aria-hidden":!0,className:"flex h-12 w-12 items-center justify-center rounded text-sec",style:{background:"var(--bg-2)",border:"1px solid var(--border-bright)"},children:o}):null,c.jsx("div",{className:"text-lg font-semibold text-pri","data-testid":"empty-state-title",children:t}),c.jsx("div",{className:"text-sm text-ter","data-testid":"empty-state-description",children:a}),s]}),Va=t=>a=>{console.error(`[hive] swallowed:${t}`,a)},D_={agy:{command:"curl -fsSL https://antigravity.google/cli/install.sh | bash",docsUrl:"https://antigravity.google/docs/cli-getting-started"},claude:{command:"npm install -g @anthropic-ai/claude-code",docsUrl:"https://github.com/anthropics/claude-code"},codex:{command:"npm install -g @openai/codex",docsUrl:"https://github.com/openai/codex"},cursor:{command:"curl https://cursor.com/install -fsS | bash",docsUrl:"https://cursor.com/docs/cli/installation"},gemini:{command:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli"},grok:{command:"curl -fsSL https://x.ai/cli/install.sh | bash",docsUrl:"https://x.ai/cli"},hermes:{command:"curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",docsUrl:"https://github.com/NousResearch/hermes-agent"},opencode:{command:"npm install -g opencode-ai",docsUrl:"https://opencode.ai/docs"},qwen:{command:"npm install -g @qwen-code/qwen-code@latest",docsUrl:"https://github.com/QwenLM/qwen-code"}},M_=t=>D_[t]??null,L_=({presetId:t,presetName:a})=>{const{t:o}=be(),s=M_(t),[l,u]=y.useState(!1),[f,m]=y.useState(!1),g=y.useRef(null);y.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const p=()=>{s&&fw(s.command).then(()=>{u(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{u(!1),g.current=null},1500)}).catch(Va("cli-install-copy"))};return c.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border p-3",style:{background:"var(--bg-2)",borderColor:"var(--border)"},"data-testid":"cli-install-guidance",children:[s?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-xs text-sec",children:o("workspace.preset.installHint",{name:a})}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("code",{className:"mono min-w-0 flex-1 truncate rounded border px-2 py-1.5 text-xs text-pri",style:{background:"var(--bg-1)",borderColor:"var(--border)"},title:s.command,children:s.command}),c.jsxs("button",{type:"button",onClick:p,className:"icon-btn shrink-0 inline-flex items-center gap-1.5","aria-label":o("workspace.preset.installCopyAria"),"data-testid":"cli-install-copy",children:[l?c.jsx(ga,{size:13,"aria-hidden":!0}):c.jsx(Dr,{size:13,"aria-hidden":!0}),c.jsx("span",{className:"text-xs",children:o(l?"common.copied":"workspace.preset.installCopy")})]})]}),c.jsxs("a",{href:s.docsUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 self-start text-xs text-sec underline hover:text-pri","data-testid":"cli-install-docs",children:[c.jsx(_m,{size:11,"aria-hidden":!0}),o("workspace.preset.installDocs")]})]}):null,c.jsxs("button",{type:"button",onClick:()=>m(b=>!b),"aria-expanded":f,className:"flex items-center gap-1 text-left text-xs text-sec hover:text-pri cursor-pointer","data-testid":"cli-install-path-help-toggle",children:[f?c.jsx(qo,{size:12,"aria-hidden":!0}):c.jsx(wc,{size:12,"aria-hidden":!0}),o("workspace.preset.pathHelpTitle")]}),f?c.jsx("p",{className:"text-xs leading-relaxed text-ter","data-testid":"cli-install-path-help-body",children:o("workspace.preset.pathHelpBody")}):null]})},z_={"cursor-agent":"cursor"},H_=/^(\S+) CLI not found in PATH/u,U_=()=>{const{t}=be();return c.jsx("div",{"data-testid":"orchestrator-starting-body",className:"flex flex-1",children:c.jsx(mi,{icon:c.jsx(Ja,{size:24,className:"animate-spin"}),title:t("orchestrator.startingTitle"),description:t("orchestrator.startingDesc")})})},B_=({onStart:t})=>{const{t:a}=be();return c.jsx("div",{"data-testid":"orchestrator-stopped-body",className:"flex flex-1",children:c.jsx(mi,{icon:c.jsx(Am,{size:24}),title:a("orchestrator.stoppedTitle"),description:a("orchestrator.stoppedDesc"),action:c.jsxs("button",{type:"button",onClick:t,className:"icon-btn icon-btn--primary","data-testid":"orchestrator-start",children:[c.jsx(Po,{size:12,"aria-hidden":!0})," ",a("orchestrator.start")]})})})},W_=({error:t,onRemoveWorkspace:a,onRestart:o})=>{const{t:s}=be(),[l,u]=y.useState(!1),f=()=>{navigator.clipboard?.writeText(t).then(()=>{u(!0),window.setTimeout(()=>u(!1),1500)}).catch(()=>{})},m=H_.exec(t)?.[1];return c.jsxs("div",{"data-testid":"orchestrator-failed-body",className:"m-auto flex max-w-[480px] flex-col items-center gap-3 px-6 py-8",children:[c.jsx("div",{"aria-hidden":!0,className:"flex h-12 w-12 items-center justify-center rounded text-sec",style:{background:"var(--bg-2)",border:"1px solid var(--border-bright)"},children:c.jsx(Am,{size:24})}),c.jsx("div",{className:"text-lg font-semibold text-pri",children:s("orchestrator.failed")}),c.jsxs("div",{className:"relative w-full",children:[c.jsx("pre",{"data-testid":"orchestrator-error-message",className:"mono w-full max-h-40 overflow-auto whitespace-pre-wrap break-all rounded p-3 text-left text-xs",style:{background:"color-mix(in oklab, var(--status-red) 8%, var(--bg-2))",border:"1px solid color-mix(in oklab, var(--status-red) 24%, transparent)",color:"var(--text-secondary)"},children:t}),c.jsx(Je,{label:s(l?"common.copied":"common.copyError"),children:c.jsx("button",{type:"button",onClick:f,"aria-label":s("orchestrator.copyErrorAria"),className:"icon-btn icon-btn--ghost absolute right-1 top-1 h-6 px-1.5","data-testid":"orchestrator-copy-error",children:c.jsx(Dr,{size:12,"aria-hidden":!0})})})]}),m?c.jsx("div",{className:"w-full",children:c.jsx(L_,{presetId:z_[m]??m,presetName:m})}):null,c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("button",{type:"button",onClick:o,className:"icon-btn icon-btn--primary","data-testid":"orchestrator-retry",children:[c.jsx(xc,{size:12,"aria-hidden":!0})," ",s("common.retry")]}),c.jsx("button",{type:"button",onClick:a,className:"icon-btn icon-btn--danger","data-testid":"orchestrator-remove-workspace",children:s("orchestrator.removeWorkspace")})]}),c.jsx("span",{"data-testid":"orchestrator-retry-header",className:"sr-only",children:s("common.retry")})]})},I_=({state:t,onRemoveWorkspace:a,onRestart:o,onStart:s})=>{const{t:l}=be(),u=yt();return c.jsx("div",{className:"orchestrator-pane-root relative flex h-full w-full min-w-0 flex-col",style:{background:"var(--bg-crust)",...u?{}:{borderRight:"1px solid var(--border)"}},"data-testid":"orchestrator-terminal-slot",children:t.kind==="running"?c.jsx("div",{id:`orch-pty-${t.runId}`,className:"orchestrator-pty-slot relative flex h-full w-full","data-pty-slot":"orchestrator","data-terminal-auto-focus":"true",children:u?c.jsx("div",{className:"orchestrator-pty-placeholder pointer-events-none absolute inset-0 flex items-center justify-center px-4 text-center","data-testid":"orchestrator-running-placeholder",children:c.jsx("div",{className:"mono text-xs text-ter",children:l("terminal.statusConnecting")})}):null}):t.kind==="failed"?c.jsx(W_,{error:t.error,onRemoveWorkspace:a,onRestart:o}):t.kind==="stopped"?c.jsx(B_,{onStart:s}):c.jsx(U_,{})})},q_=({workspaceId:t,terminalRuns:a,autostartError:o,onClearAutostartError:s,onAfterStart:l,onRunClosed:u})=>{const f=j_(a,t),m=Qm(t),[g,p]=y.useState(null);y.useEffect(()=>{f&&p(null)},[f]);let b;f?b={hasUserInputSinceStart:f.has_user_input_since_start===!0,kind:"running",runId:f.run_id,startupBlockedReason:f.startup_blocked_reason??null}:g===t?b={kind:"starting"}:o?b={kind:"failed",error:o}:b={kind:"stopped"};const v=y.useCallback(()=>{!t||g===t||f||(s(),p(t),ei(t,m).then(S=>{l?.({ok:!0,error:null,run_id:S.runId})}).catch(S=>{const w=S instanceof Error?S.message:"Failed to start Queen";l?.({ok:!1,error:w,run_id:null})}).finally(()=>p(S=>S===t?null:S)))},[m,l,s,f,g,t]),k=y.useCallback(()=>{f&&nc(f.run_id).then(()=>{u?.(t,f.run_id)}).catch(S=>{console.error("[hive] swallowed:orchestrator.stop",S)})},[u,f,t]),E=y.useCallback(()=>{if(s(),f){nc(f.run_id).catch(S=>{console.error("[hive] swallowed:orchestrator.restart.stop",S)}).then(()=>ei(t,m)).then(S=>{u?.(t,f.run_id),l?.({ok:!0,error:null,run_id:S.runId})}).catch(S=>{const w=S instanceof Error?S.message:"Failed to restart Queen";l?.({ok:!1,error:w,run_id:null})});return}v()},[m,l,s,u,f,v,t]);return{state:b,start:v,stop:k,restart:E}},lx=["ada-lovelace","archimedes","babbage","bell","da-vinci","edison","eiffel","euclid","euler","fermat","fibonacci","gutenberg","leibniz","marconi","morse","nobel","pascal","pythagoras","tesla","turing","watt","wright-brothers"],cx=["adam-smith","aquinas","aristotle","augustine","bacon","calvin","cicero","democritus","descartes","epicurus","hegel","herodotus","hobbes","hume","kant","kierkegaard","locke","luther","machiavelli","marcus-aurelius","montesquieu","nietzsche","plato","rousseau","seneca","socrates","spinoza","voltaire"],ux=["amundsen","boyle","cook","copernicus","curie","da-gama","darwin","drake","faraday","fleming","galileo","halley","hippocrates","kepler","magellan","marco-polo","mendel","mendeleev","newton","pasteur","planck","ptolemy","rutherford","volta"],P_=["alexander","augustus","austen","bach","beethoven","brahms","byron","caesar","cervantes","charlemagne","chopin","cleopatra","dante","dickens","dostoevsky","dumas","einstein","elizabeth-i","franklin","goethe","goya","handel","hannibal","henry-viii","homer","hugo","jefferson","joan-of-arc","keats","leonidas","lincoln","liszt","louis-xiv","michelangelo","milton","monet","mozart","napoleon","nightingale","orwell","picasso","poe","raphael","rembrandt","schubert","shakespeare","sophocles","tchaikovsky","titian","tolstoy","twain","van-gogh","velazquez","verdi","vermeer","virgil","vivaldi","wagner","washington","whitman","wilde","woolf","wordsworth"],dx=["八大山人","毕昇","蔡伦","干将","顾恺之","黄道婆","李冰","柳公权","鲁班","莫邪","墨子","沈括","宋应星","唐寅","王羲之","文徵明","吴道子","颜真卿","张衡","张择端","郑板桥","祖冲之"],fx=["班固","包拯","狄仁杰","董仲舒","范仲淹","顾炎武","管仲","海瑞","韩非","韩愈","嵇康","贾谊","孔子","老子","林则徐","柳宗元","孟子","欧阳修","商鞅","司马光","司马迁","谭嗣同","王安石","王守仁","魏徵","荀子","张居正","周敦颐","朱熹","庄子"],mx=["班超","扁鹊","法显","葛洪","华佗","鉴真","郦道元","李时珍","神农","苏武","孙思邈","陶弘景","徐光启","徐霞客","玄奘","张骞","张仲景","郑和"],F_=["白居易","蔡文姬","曹操","曹雪芹","曹植","程咬金","大禹","杜甫","杜牧","范蠡","关羽","汉武帝","韩信","忽必烈","花木兰","黄帝","霍去病","姜子牙","康熙","李白","李广","李靖","李清照","李煜","刘邦","刘备","刘伯温","柳永","陆游","罗贯中","吕布","吕不韦","孟浩然","蒙恬","努尔哈赤","庞统","蒲松龄","戚继光","乾隆","秦始皇","屈原","上官婉儿","施耐庵","司马懿","苏轼","孙膑","孙权","孙武","孙中山","唐太宗","唐玄宗","陶渊明","王维","卫青","文天祥","吴承恩","吴起","萧何","谢安","辛弃疾","杨贵妃","雍正","虞姬","岳飞","张飞","张良","张仪","赵子龙","周瑜","朱棣","诸葛亮","朱元璋","左宗棠"],K_=[...lx,...cx,...ux,...P_],Y_=[...dx,...fx,...mx,...F_],$_=["argus","cassandra","copernicus","halley","herodotus","hypatia","kepler","ptolemy","thucydides","tycho-brahe"],V_=["班固","郭守敬","沈括","司马光","司马迁","一行","张衡","祖冲之"],G_={en:{coder:lx,reviewer:cx,tester:ux,sentinel:$_,custom:K_},zh:{coder:dx,reviewer:fx,tester:mx,sentinel:V_,custom:Y_}},X_=()=>{const t=new Uint32Array(1);return globalThis.crypto.getRandomValues(t),t[0]??0},Af=({language:t="en",role:a="coder",usedNames:o,nextUint32:s=X_}={})=>{const l=G_[t][a],u=o&&o.size>0?l.filter(m=>!o.has(m)):l,f=u.length>0?u:l;return f[s()%f.length]},Gs={en:{coder:["You are a Coder. Turn clearly scoped tasks into the smallest correct code change.","Working style:","- Read the relevant files and local patterns before editing.","- Prefer small changes; avoid unrelated refactors and scope creep.","- Run validation that covers the risk. If you cannot validate, explain why.","Report changed files, verification, remaining risk, and blockers."].join(`
55
+ For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return y.useEffect(()=>{t&&(document.getElementById(t)||console.error(o))},[o,t]),null},PT="DialogDescriptionWarning",FT=({contentRef:t,descriptionId:a})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ew(PT).contentName}}.`;return y.useEffect(()=>{const l=t.current?.getAttribute("aria-describedby");a&&l&&(document.getElementById(a)||console.warn(s))},[s,t,a]),null},Mr=W0,KT=q0,Lr=F0,zr=K0,Hr=Y0,Ur=V0,Ko=X0,YT=Q0;const $T=(t,a={})=>{const o=new URL(t,window.location.href);o.protocol=o.protocol==="https:"?"wss:":"ws:";for(const[s,l]of Object.entries(a))l!==void 0&&o.searchParams.set(s,String(l));return o.toString()},VT={requiresUiSession:!0,fetch(t,a){return fetch(t,a)},openWebSocket(t,a){return new WebSocket($T(t,a))}};let Ho=VT;const GT=t=>{Ho=t},tw=()=>Ho,nw=()=>Ho.requiresUiSession!==!1,Um=t=>({id:t.id,name:t.name,role:t.role,status:t.status,pendingTaskCount:t.pending_task_count,...t.avatar?{avatar:t.avatar}:{},...t.last_pty_line?{lastPtyLine:t.last_pty_line}:{},...t.command_preset_id?{commandPresetId:t.command_preset_id}:{},...t.ephemeral===!0?{ephemeral:!0}:{},...t.spawned_by?{spawnedBy:t.spawned_by}:{}}),_e=async(t,a)=>{try{const o=await t.json();if(typeof o.error=="string"&&o.error.trim())return o.error}catch{}return a},XT=async t=>{if(t.status!==403)return!1;try{return(await t.clone().json()).error==="UI endpoint requires valid UI token"}catch{return!1}},aw=async()=>{if(!nw())return;const t=await Ho.fetch("/api/ui/session",{mode:"same-origin"});if(!t.ok)throw new Error("Failed to initialize UI session");await t.json()};let vf=null;const ZT=()=>(vf??=aw().finally(()=>{vf=null}),vf),pe=async(t,a)=>{const o=await Ho.fetch(t,a);return!nw()||!await XT(o)?o:(await ZT(),Ho.fetch(t,a))},QT=async()=>{const t=await pe("/api/workspaces");if(!t.ok)throw new Error("Failed to load workspaces");return await t.json()},JT=async()=>{const t=await pe("/api/version");if(!t.ok)throw new Error("Failed to load version info");const a=await t.json();return{canRunHiveUpdate:a.can_run_hive_update??a.install_hint==="hive update",currentVersion:a.current_version,installHint:a.install_hint,installSource:a.install_source??"unknown",latestVersion:a.latest_version,packageName:a.package_name,releaseUrl:a.release_url,updateNote:a.update_note??"",updateAvailable:a.update_available}},rw=t=>({description:t.description,id:t.id,isBuiltin:t.is_builtin,name:t.name,roleType:t.role_type}),eN=t=>({name:t.name,role_type:t.roleType,description:t.description,default_command:"",default_args:[],default_env:{}}),tN=async t=>{const a=await pe("/api/workspaces",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(await _e(a,"Failed to create workspace"));return await a.json()},nN=async t=>{const a=await pe(`/api/workspaces/${t}`,{method:"DELETE"});if(!a.ok)throw new Error(await _e(a,"Failed to delete workspace"))},ei=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/agents/${a}/start`,{method:"POST"});if(!o.ok)throw new Error(await _e(o,"Failed to start agent run"));return{runId:(await o.json()).run_id}},nc=async t=>{if(!(await pe(`/api/runtime/runs/${t}/stop`,{method:"POST"})).ok)throw new Error("Failed to stop agent run")};class ow extends Error{constructor(a,o){super(o),this.status=a,this.name="RuntimeRunProbeError"}status}const aN=async t=>{const a=await pe(`/api/runtime/runs/${encodeURIComponent(t)}`,{mode:"same-origin"});if(a.status===404)return!1;if(!a.ok)throw new ow(a.status,await _e(a,"Failed to load agent run"));const o=await a.json();return o.status==="starting"||o.status==="running"},rN=async(t,a,o)=>(await nc(o).catch(s=>{console.error("[hive] swallowed:restartAgentRun.stop",s)}),ei(t,a)),oN=async()=>{const t=await pe("/api/settings/app-state/active_workspace_id");if(!t.ok)throw new Error("Failed to load active workspace");return(await t.json()).value},sw=async t=>{if(!(await pe("/api/settings/app-state/active_workspace_id",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:t})})).ok)throw new Error("Failed to save active workspace")},iw="notifications.webhook-url",sN=async()=>{const t=await pe(`/api/settings/app-state/${iw}`);if(!t.ok)throw new Error("Failed to load webhook URL");return(await t.json()).value??""},iN=async t=>{if(!(await pe(`/api/settings/app-state/${iw}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:t.trim()})})).ok)throw new Error("Failed to save webhook URL")},WM=async()=>{const t=await pe("/api/settings/workflow-cli-policy");if(!t.ok)throw new Error("Failed to load workflow CLI policy");return await t.json()},IM=async t=>{const a=await pe("/api/settings/workflow-cli-policy",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error("Failed to save workflow CLI policy");return await a.json()},lN=async()=>{const t=await pe("/api/settings/workflow-feature");if(!t.ok)throw new Error("Failed to load workflow feature flag");return await t.json()},cN=async t=>{const a=await pe("/api/settings/workflow-feature",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!a.ok)throw new Error("Failed to save workflow feature flag");return await a.json()},uN=async()=>{const t=await pe("/api/settings/team-autostaff");if(!t.ok)throw new Error("Failed to load auto-staff feature flag");return await t.json()},dN=async t=>{const a=await pe("/api/settings/team-autostaff",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!a.ok)throw new Error("Failed to save auto-staff feature flag");return await a.json()},fN=async t=>{const a=await pe(`/api/ui/workspaces/${t}/team`,{mode:"same-origin"});if(!a.ok)throw new Error("Failed to load workers");return(await a.json()).map(Um)},mN=async()=>{const t=await pe("/api/settings/command-presets");if(!t.ok)throw new Error("Failed to load command presets");return(await t.json()).map(a=>({args:a.args,available:a.available,command:a.command,displayName:a.display_name,id:a.id}))},pN=t=>`${t}:shell`,ti=(t,a)=>t.agent_id===pN(a),hN=async t=>{const a=await pe(`/api/workspaces/${t}/shell/start`,{method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to start workspace terminal"));return await a.json()},gN=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/shell/${a}`,{method:"DELETE"});if(!o.ok)throw new Error(await _e(o,"Failed to close workspace terminal"))},vN=async()=>{const t=await pe("/api/settings/role-templates",{mode:"same-origin"});if(!t.ok)throw new Error("Failed to load role templates");return(await t.json()).map(rw)},yN=async t=>{const a=await pe("/api/settings/role-templates",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(eN(t))});if(!a.ok)throw new Error(await _e(a,"Failed to create role template"));return rw(await a.json())},bN=async t=>{const a=await pe(`/api/settings/role-templates/${t}`,{method:"DELETE"});if(!a.ok)throw new Error(await _e(a,"Failed to delete role template"))},qM=async t=>{const a=await pe(`/api/marketplace/manifest?lang=${t}`,{mode:"same-origin"});if(!a.ok)throw new Error(await _e(a,"Failed to load marketplace manifest"));return await a.json()},PM=async(t,a)=>{const o=await pe(`/api/marketplace/agent?lang=${t}&path=${encodeURIComponent(a)}`,{mode:"same-origin"});if(!o.ok)throw new Error(await _e(o,"Failed to load marketplace agent"));return await o.json()},wN=async t=>{const a=await pe(`/api/ui/workspaces/${t}/runs`,{mode:"same-origin"});if(!a.ok)throw new Error("Failed to load terminal runs");return await a.json()},xN=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/workers`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error(await _e(o,"Failed to create worker"));const s=await o.json();return{agentStart:{error:s.agent_start?.error??null,ok:s.agent_start?.ok??!1,runId:s.agent_start?.run_id??null},worker:Um(s)}},kN=async(t,a,o,s)=>{const l=await pe(`/api/workspaces/${t}/scenarios/${encodeURIComponent(a)}/apply`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({goal:o,locale:s})});if(!l.ok)throw new Error(await _e(l,"Failed to assemble the scenario team"));return{createdWorkers:(await l.json()).created_workers}},SN=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/workers/${a}`,{method:"DELETE"});if(!o.ok)throw new Error(await _e(o,"Failed to delete worker"))},EN=async(t,a,o)=>{const s=await pe(`/api/workspaces/${t}/workers/${a}`,{body:JSON.stringify({name:o}),headers:{"content-type":"application/json"},method:"PATCH"});if(!s.ok)throw new Error(await _e(s,"Failed to rename worker"))},CN=async(t,a,o)=>{const s=await pe(`/api/workspaces/${t}/workers/${a}`,{body:JSON.stringify({avatar:o}),headers:{"content-type":"application/json"},method:"PATCH"});if(!s.ok)throw new Error(await _e(s,"Failed to update worker avatar"));return Um(await s.json())},TN=async t=>{const a=await pe(`/api/workspaces/${t}/tasks`);if(!a.ok)throw new Error("Failed to load tasks");return await a.json()},Hl=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/tasks`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error("Failed to save tasks");return await o.json()},FM=async t=>{const a=t?`?path=${encodeURIComponent(t)}`:"";return await(await pe(`/api/fs/browse${a}`,{mode:"same-origin"})).json()},KM=async t=>await(await pe(`/api/fs/probe?path=${encodeURIComponent(t)}`,{mode:"same-origin"})).json(),YM=async()=>await(await pe("/api/fs/pick-folder",{method:"POST",mode:"same-origin"})).json(),NN=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/open`,{body:JSON.stringify({target_id:a}),headers:{"content-type":"application/json"},method:"POST"});if(o.status===200)return{ok:!0,effectiveTargetId:(await o.json()).effective_target_id};if(o.status===502){const s=await o.json();return{ok:!1,effectiveTargetId:s.effective_target_id,errorCode:s.error_code}}throw new Error(await _e(o,"Failed to open workspace"))},jN=t=>({actorAgentIdSnapshot:t.actor_agent_id_snapshot,actorNameSnapshot:t.actor_name_snapshot,actorRoleSnapshot:t.actor_role_snapshot,createdAt:t.created_at,excerpt:t.excerpt,id:t.id,memoryId:t.memory_id,sourceId:t.source_id,sourceSequence:t.source_sequence,sourceType:t.source_type,textHash:t.text_hash}),jc=t=>({archivedAt:t.archived_at,body:t.body,confidence:t.confidence,createdAt:t.created_at,disabled:t.disabled,id:t.id,kind:t.kind,lastInjectedAt:t.last_injected_at,pinned:t.pinned,procedureRef:t.procedure_ref,scope:t.scope,source:t.source,sources:t.sources.map(jN),status:t.status,tags:t.tags,updatedAt:t.updated_at,workspaceId:t.workspace_id}),AN=t=>({contextType:t.context_type,dispatchId:t.dispatch_id,id:t.id,injectedAt:t.injected_at,memory:jc(t.memory),memoryId:t.memory_id,targetAgentIdSnapshot:t.target_agent_id_snapshot,workspaceId:t.workspace_id}),$M=async(t,a={})=>{const o=new URLSearchParams;a.status&&o.set("status",a.status),a.scope&&o.set("scope",a.scope),a.query?.trim()&&o.set("query",a.query.trim()),a.limit!==void 0&&o.set("limit",String(a.limit));const s=o.size>0?`?${o}`:"",l=await pe(`/api/ui/workspaces/${t}/memory${s}`);if(!l.ok)throw new Error(await _e(l,"Failed to load memory"));return(await l.json()).memories.map(jc)},VM=async(t,a,o)=>{const s=await pe(`/api/ui/workspaces/${t}/memory/${a}`,{body:JSON.stringify(o),headers:{"content-type":"application/json"},method:"PATCH"});if(!s.ok)throw new Error(await _e(s,"Failed to update memory"));const l=await s.json();return jc(l.memory)},_N=async(t,a,o)=>{const s=await pe(`/api/ui/workspaces/${t}/memory/${a}/${o}`,{method:"POST"});if(!s.ok)throw new Error(await _e(s,`Failed to ${o} memory`));const l=await s.json();return jc(l.memory)},GM=(t,a)=>_N(t,a,"archive"),Bm=t=>({error:t.error,finishedAt:t.finished_at,id:t.id,inputSeqFrom:t.input_seq_from,inputSeqTo:t.input_seq_to,report:t.report,startedAt:t.started_at,status:t.status,trigger:t.trigger,workspaceId:t.workspace_id}),XM=async(t,a={})=>{const o=new URLSearchParams;a.limit!==void 0&&o.set("limit",String(a.limit));const s=o.size>0?`?${o}`:"",l=await pe(`/api/ui/workspaces/${t}/memory/dream-runs${s}`);if(!l.ok)throw new Error(await _e(l,"Failed to load dream runs"));return(await l.json()).runs.map(Bm)},ZM=async t=>{const a=await pe(`/api/ui/workspaces/${t}/memory/dream-runs`,{body:JSON.stringify({}),headers:{"content-type":"application/json"},method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to run dream"));const o=await a.json();return Bm(o.run)},QM=async(t,a)=>{const o=await pe(`/api/ui/workspaces/${t}/memory/dream-runs/${a}/revert`,{body:JSON.stringify({}),headers:{"content-type":"application/json"},method:"POST"});if(!o.ok)throw new Error(await _e(o,"Failed to revert dream run"));const s=await o.json();return Bm(s.run)},JM=async(t,a)=>{const o=new URLSearchParams({dispatch_id:a}),s=await pe(`/api/ui/workspaces/${t}/memory/injections?${o}`);if(!s.ok)throw new Error(await _e(s,"Failed to load memory injections"));return(await s.json()).injections.map(AN)},RN=t=>({id:t.id,workspaceId:t.workspace_id,scriptPath:t.script_path,name:t.name,status:t.status,startedAt:t.started_at,finishedAt:t.finished_at,error:t.error,phase:t.phase,result:t.result??null,args:t.args??null,agentCount:typeof t.agent_count=="number"?t.agent_count:0,parentRunId:t.parent_run_id??null}),e8=async t=>{const a=await pe(`/api/workspaces/${t}/workflows/runs`);if(!a.ok)throw new Error(await _e(a,"Failed to list workflow runs"));return(await a.json()).runs.map(RN)},lw=t=>({id:t.id,workspaceId:t.workspace_id,scriptPath:t.script_path,cron:t.cron,args:t.args,enabled:t.enabled,lastRunAt:t.last_run_at,nextRunAt:t.next_run_at,createdAt:t.created_at,updatedAt:t.updated_at}),t8=async t=>{const a=await pe(`/api/workspaces/${t}/workflow-schedules`);if(!a.ok)throw new Error(await _e(a,"Failed to list workflow schedules"));return(await a.json()).schedules.map(lw)},n8=async(t,a)=>{const o=await pe(`/api/workflow-schedules/${t}`,{body:JSON.stringify(a),headers:{"content-type":"application/json"},method:"PATCH"});if(!o.ok)throw new Error(await _e(o,"Failed to update workflow schedule"));const s=await o.json();return lw(s.schedule)},ON=t=>({id:t.id,workspaceId:t.workspace_id,fromAgentId:t.from_agent_id,toAgentId:t.to_agent_id,text:t.text,status:t.status,reportText:t.report_text,reportedAt:t.reported_at,createdAt:t.created_at,workflowRunId:t.workflow_run_id,stepIndex:t.step_index,phase:t.phase,label:t.label,...t.last_pty_line?{lastPtyLine:t.last_pty_line}:{}}),a8=async t=>{const a=await pe(`/api/workflows/runs/${t}/stop`,{method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to stop workflow run"))},r8=async t=>{const a=await pe(`/api/workflows/runs/${t}/dispatches`);if(!a.ok)throw new Error(await _e(a,"Failed to load workflow run dispatches"));return(await a.json()).dispatches.map(ON)},o8=async t=>{const a=await pe(`/api/workflows/runs/${t}/logs`);if(!a.ok)throw new Error(await _e(a,"Failed to load workflow run logs"));return(await a.json()).logs},s8=async t=>{const a=await pe(`/api/workflow-schedules/${t}`,{method:"DELETE"});if(!a.ok)throw new Error(await _e(a,"Failed to delete workflow schedule"))},DN=["disabled","loggedOut","connecting","online","reconnecting","revoked"],MN=(t,a)=>typeof t=="string"&&DN.includes(t)?t:a?"online":"disabled",$s=(t,a)=>{if(typeof t=="string"&&t.length>0)return t;throw new Error(`Remote payload missing ${a}`)},cw=(t,a)=>{if(typeof t=="number"&&Number.isFinite(t))return t;throw new Error(`Remote payload missing ${a}`)},uw=t=>({enabled:t.enabled===!0,loggedIn:t.logged_in===!0,gatewayUrl:t.gateway_url??null,connected:t.connected===!0,connection:MN(t.connection,t.connected===!0)}),LN=t=>({deviceId:t.id,name:t.name,lastActive:t.last_active,createdAt:t.created_at,revoked:t.revoked_at!==null}),zN=t=>({pairingId:$s(t.pairing_id,"pairing_id"),qr:$s(t.qr,"qr"),code:$s(t.code,"code"),expiresAt:cw(t.expires_at,"expires_at")}),HN=t=>({pairingId:$s(t.pairing_id,"pairing_id"),deviceName:t.device_name??null,sas:$s(t.sas,"sas"),expiresAt:cw(t.expires_at,"expires_at")}),UN=t=>({id:t.id,deviceId:t.device_id,ts:t.ts,workspaceId:t.workspace_id,action:t.action,endpoint:t.endpoint,result:t.result,rejectReason:t.reject_reason,byteCount:t.byte_count,preview:t.preview}),yf=async()=>{const t=await pe("/api/remote/status");if(!t.ok)throw new Error(await _e(t,"Failed to load remote status"));return uw(await t.json())},BN=async t=>{const a=await pe("/api/remote/enabled",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!a.ok)throw new Error(await _e(a,"Failed to update remote access"));return uw(await a.json())},WN=async()=>{const t=await pe("/api/remote/pairings",{method:"POST"});if(!t.ok)throw new Error(await _e(t,"Failed to start pairing"));return zN(await t.json())},My=async()=>{const t=await pe("/api/remote/pairings/pending");if(!t.ok)throw new Error(await _e(t,"Failed to load pending pairing"));const o=(await t.json())[0];return o?HN(o):null},IN=async t=>{const a=await pe(`/api/remote/pairings/${t}/confirm`,{method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to confirm pairing"))},qN=async t=>{const a=await pe(`/api/remote/pairings/${t}/reject`,{method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to reject pairing"))},dw=async()=>{const t=await pe("/api/remote/devices");if(!t.ok)throw new Error(await _e(t,"Failed to load devices"));return(await t.json()).map(LN)},PN=async t=>{const a=await pe(`/api/remote/devices/${t}/revoke`,{method:"POST"});if(!a.ok)throw new Error(await _e(a,"Failed to revoke device"))},FN=async(t=100)=>{const a=await pe(`/api/remote/audit?limit=${t}`);if(!a.ok)throw new Error(await _e(a,"Failed to load remote activity"));return(await a.json()).map(UN)},KN=t=>t.kind==="stopped_with_queue"?{kind:t.kind,openDispatches:t.open_dispatches,pendingTaskCount:t.pending_task_count,severity:t.severity,workerId:t.worker_id,workerName:t.worker_name}:t.kind==="dispatch_waiting_report"?{dispatchId:t.dispatch_id,kind:t.kind,minutesAgo:t.minutes_ago,severity:t.severity,submittedAt:t.submitted_at,workerId:t.worker_id,workerName:t.worker_name}:t,bf=t=>({createdAt:t.created_at,id:t.id,label:t.label,phase:t.phase,reportPreview:t.report_preview??null,status:t.status,submittedAt:t.submitted_at,taskPreview:t.task_preview??null,timestamp:t.timestamp,toAgentId:t.to_agent_id,toWorkerName:t.to_worker_name,workflowRunId:t.workflow_run_id}),YN=t=>({attention:(t.attention??[]).map(KN),generatedAt:t.generated_at,recentActivity:t.recent_activity.map(a=>({...bf(a),kind:a.kind})),summary:{idleWorkers:t.summary.idle_workers,openDispatches:t.summary.open_dispatches,recentReports:t.summary.recent_reports,stoppedWithQueue:t.summary.stopped_with_queue,stoppedWorkers:t.summary.stopped_workers,totalWorkers:t.summary.total_workers,waitingReports:t.summary.waiting_reports??0,workingWorkers:t.summary.working_workers},workers:t.workers.map(a=>({currentDispatch:a.current_dispatch?bf(a.current_dispatch):null,id:a.id,latestReport:a.latest_report?bf(a.latest_report):null,name:a.name,pendingTaskCount:a.pending_task_count,role:a.role,status:a.status,terminalHint:a.terminal_hint??null})),workspaceId:t.workspace_id}),$N=async(t,a)=>{const o=await pe(`/api/ui/workspaces/${t}/action-center`,a);if(!o.ok)throw new Error(await _e(o,"Failed to load action center"));return YN(await o.json())},VN=async(t,a)=>{const o=await pe(`/api/workspaces/${t}/recap`,a);if(!o.ok)throw new Error(await _e(o,"Failed to load team recap"));const s=await o.json();return{generatedAt:s.generated_at,markdown:s.markdown}},GN=async()=>{const t=await pe("/api/diagnostics/support-bundle");if(!t.ok)throw new Error(await _e(t,"Failed to load diagnostics"));return await t.json()},XN=async()=>{const t=await pe("/api/diagnostics/retention");if(!t.ok)throw new Error(await _e(t,"Failed to load retention diagnostics"));return await t.json()},fw=async t=>{if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(t);return}catch{}const a=document.createElement("textarea");a.value=t,a.setAttribute("readonly",""),a.style.position="fixed",a.style.top="0",a.style.left="-9999px",a.style.opacity="0";const o=document.activeElement instanceof HTMLElement?document.activeElement:null;let s=!1;try{document.body.appendChild(a),a.focus(),a.select(),a.setSelectionRange(0,a.value.length),s=document.execCommand("copy")}finally{a.remove(),o?.focus()}if(!s)throw new Error("Clipboard copy failed")},mw=async t=>{if(navigator.clipboard?.write&&typeof ClipboardItem<"u"){const a=t.then(o=>new Blob([o],{type:"text/plain"}));a.catch(()=>{});try{await navigator.clipboard.write([new ClipboardItem({"text/plain":a})]);return}catch{}}await fw(await t)},Ly="(max-width: 767px)",pw=y.createContext({mode:"wide"}),wf={mode:"wide"},ZN={mode:"mobile"},QN=(t=typeof window<"u"?window.matchMedia.bind(window):void 0)=>{const a=s=>{if(!t)return()=>{};const l=t(Ly);return l.addEventListener?.("change",s),()=>l.removeEventListener?.("change",s)},o=()=>t&&t(Ly).matches?ZN:wf;return y.useSyncExternalStore(a,o,()=>wf)},JN=({children:t,value:a})=>{const o=QN();return c.jsx(pw.Provider,{value:a??o,children:t})},hw=()=>y.useContext(pw),yt=()=>hw().mode==="mobile",ej=["top","right","bottom","left"],tr=Math.min,an=Math.max,ac=Math.round,Ul=Math.floor,In=t=>({x:t,y:t}),tj={left:"right",right:"left",bottom:"top",top:"bottom"};function Jf(t,a,o){return an(t,tr(a,o))}function ma(t,a){return typeof t=="function"?t(a):t}function pa(t){return t.split("-")[0]}function Yo(t){return t.split("-")[1]}function Wm(t){return t==="x"?"y":"x"}function Im(t){return t==="y"?"height":"width"}function Wn(t){const a=t[0];return a==="t"||a==="b"?"y":"x"}function qm(t){return Wm(Wn(t))}function nj(t,a,o){o===void 0&&(o=!1);const s=Yo(t),l=qm(t),u=Im(l);let f=l==="x"?s===(o?"end":"start")?"right":"left":s==="start"?"bottom":"top";return a.reference[u]>a.floating[u]&&(f=rc(f)),[f,rc(f)]}function aj(t){const a=rc(t);return[em(t),a,em(a)]}function em(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const zy=["left","right"],Hy=["right","left"],rj=["top","bottom"],oj=["bottom","top"];function sj(t,a,o){switch(t){case"top":case"bottom":return o?a?Hy:zy:a?zy:Hy;case"left":case"right":return a?rj:oj;default:return[]}}function ij(t,a,o,s){const l=Yo(t);let u=sj(pa(t),o==="start",s);return l&&(u=u.map(f=>f+"-"+l),a&&(u=u.concat(u.map(em)))),u}function rc(t){const a=pa(t);return tj[a]+t.slice(a.length)}function lj(t){return{top:0,right:0,bottom:0,left:0,...t}}function gw(t){return typeof t!="number"?lj(t):{top:t,right:t,bottom:t,left:t}}function oc(t){const{x:a,y:o,width:s,height:l}=t;return{width:s,height:l,top:o,left:a,right:a+s,bottom:o+l,x:a,y:o}}function Uy(t,a,o){let{reference:s,floating:l}=t;const u=Wn(a),f=qm(a),m=Im(f),g=pa(a),p=u==="y",b=s.x+s.width/2-l.width/2,v=s.y+s.height/2-l.height/2,k=s[m]/2-l[m]/2;let E;switch(g){case"top":E={x:b,y:s.y-l.height};break;case"bottom":E={x:b,y:s.y+s.height};break;case"right":E={x:s.x+s.width,y:v};break;case"left":E={x:s.x-l.width,y:v};break;default:E={x:s.x,y:s.y}}switch(Yo(a)){case"start":E[f]-=k*(o&&p?-1:1);break;case"end":E[f]+=k*(o&&p?-1:1);break}return E}async function cj(t,a){var o;a===void 0&&(a={});const{x:s,y:l,platform:u,rects:f,elements:m,strategy:g}=t,{boundary:p="clippingAncestors",rootBoundary:b="viewport",elementContext:v="floating",altBoundary:k=!1,padding:E=0}=ma(a,t),S=gw(E),C=m[k?v==="floating"?"reference":"floating":v],T=oc(await u.getClippingRect({element:(o=await(u.isElement==null?void 0:u.isElement(C)))==null||o?C:C.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(m.floating)),boundary:p,rootBoundary:b,strategy:g})),N=v==="floating"?{x:s,y:l,width:f.floating.width,height:f.floating.height}:f.reference,j=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m.floating)),A=await(u.isElement==null?void 0:u.isElement(j))?await(u.getScale==null?void 0:u.getScale(j))||{x:1,y:1}:{x:1,y:1},O=oc(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:m,rect:N,offsetParent:j,strategy:g}):N);return{top:(T.top-O.top+S.top)/A.y,bottom:(O.bottom-T.bottom+S.bottom)/A.y,left:(T.left-O.left+S.left)/A.x,right:(O.right-T.right+S.right)/A.x}}const uj=50,dj=async(t,a,o)=>{const{placement:s="bottom",strategy:l="absolute",middleware:u=[],platform:f}=o,m=f.detectOverflow?f:{...f,detectOverflow:cj},g=await(f.isRTL==null?void 0:f.isRTL(a));let p=await f.getElementRects({reference:t,floating:a,strategy:l}),{x:b,y:v}=Uy(p,s,g),k=s,E=0;const S={};for(let w=0;w<u.length;w++){const C=u[w];if(!C)continue;const{name:T,fn:N}=C,{x:j,y:A,data:O,reset:D}=await N({x:b,y:v,initialPlacement:s,placement:k,strategy:l,middlewareData:S,rects:p,platform:m,elements:{reference:t,floating:a}});b=j??b,v=A??v,S[T]={...S[T],...O},D&&E<uj&&(E++,typeof D=="object"&&(D.placement&&(k=D.placement),D.rects&&(p=D.rects===!0?await f.getElementRects({reference:t,floating:a,strategy:l}):D.rects),{x:b,y:v}=Uy(p,k,g)),w=-1)}return{x:b,y:v,placement:k,strategy:l,middlewareData:S}},fj=t=>({name:"arrow",options:t,async fn(a){const{x:o,y:s,placement:l,rects:u,platform:f,elements:m,middlewareData:g}=a,{element:p,padding:b=0}=ma(t,a)||{};if(p==null)return{};const v=gw(b),k={x:o,y:s},E=qm(l),S=Im(E),w=await f.getDimensions(p),C=E==="y",T=C?"top":"left",N=C?"bottom":"right",j=C?"clientHeight":"clientWidth",A=u.reference[S]+u.reference[E]-k[E]-u.floating[S],O=k[E]-u.reference[E],D=await(f.getOffsetParent==null?void 0:f.getOffsetParent(p));let L=D?D[j]:0;(!L||!await(f.isElement==null?void 0:f.isElement(D)))&&(L=m.floating[j]||u.floating[S]);const P=A/2-O/2,J=L/2-w[S]/2-1,Q=tr(v[T],J),$=tr(v[N],J),F=Q,ne=L-w[S]-$,Z=L/2-w[S]/2+P,q=Jf(F,Z,ne),M=!g.arrow&&Yo(l)!=null&&Z!==q&&u.reference[S]/2-(Z<F?Q:$)-w[S]/2<0,U=M?Z<F?Z-F:Z-ne:0;return{[E]:k[E]+U,data:{[E]:q,centerOffset:Z-q-U,...M&&{alignmentOffset:U}},reset:M}}}),mj=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(a){var o,s;const{placement:l,middlewareData:u,rects:f,initialPlacement:m,platform:g,elements:p}=a,{mainAxis:b=!0,crossAxis:v=!0,fallbackPlacements:k,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...C}=ma(t,a);if((o=u.arrow)!=null&&o.alignmentOffset)return{};const T=pa(l),N=Wn(m),j=pa(m)===m,A=await(g.isRTL==null?void 0:g.isRTL(p.floating)),O=k||(j||!w?[rc(m)]:aj(m)),D=S!=="none";!k&&D&&O.push(...ij(m,w,S,A));const L=[m,...O],P=await g.detectOverflow(a,C),J=[];let Q=((s=u.flip)==null?void 0:s.overflows)||[];if(b&&J.push(P[T]),v){const Z=nj(l,f,A);J.push(P[Z[0]],P[Z[1]])}if(Q=[...Q,{placement:l,overflows:J}],!J.every(Z=>Z<=0)){var $,F;const Z=((($=u.flip)==null?void 0:$.index)||0)+1,q=L[Z];if(q&&(!(v==="alignment"?N!==Wn(q):!1)||Q.every(W=>Wn(W.placement)===N?W.overflows[0]>0:!0)))return{data:{index:Z,overflows:Q},reset:{placement:q}};let M=(F=Q.filter(U=>U.overflows[0]<=0).sort((U,W)=>U.overflows[1]-W.overflows[1])[0])==null?void 0:F.placement;if(!M)switch(E){case"bestFit":{var ne;const U=(ne=Q.filter(W=>{if(D){const G=Wn(W.placement);return G===N||G==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(G=>G>0).reduce((G,V)=>G+V,0)]).sort((W,G)=>W[1]-G[1])[0])==null?void 0:ne[0];U&&(M=U);break}case"initialPlacement":M=m;break}if(l!==M)return{reset:{placement:M}}}return{}}}};function By(t,a){return{top:t.top-a.height,right:t.right-a.width,bottom:t.bottom-a.height,left:t.left-a.width}}function Wy(t){return ej.some(a=>t[a]>=0)}const pj=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(a){const{rects:o,platform:s}=a,{strategy:l="referenceHidden",...u}=ma(t,a);switch(l){case"referenceHidden":{const f=await s.detectOverflow(a,{...u,elementContext:"reference"}),m=By(f,o.reference);return{data:{referenceHiddenOffsets:m,referenceHidden:Wy(m)}}}case"escaped":{const f=await s.detectOverflow(a,{...u,altBoundary:!0}),m=By(f,o.floating);return{data:{escapedOffsets:m,escaped:Wy(m)}}}default:return{}}}}},vw=new Set(["left","top"]);async function hj(t,a){const{placement:o,platform:s,elements:l}=t,u=await(s.isRTL==null?void 0:s.isRTL(l.floating)),f=pa(o),m=Yo(o),g=Wn(o)==="y",p=vw.has(f)?-1:1,b=u&&g?-1:1,v=ma(a,t);let{mainAxis:k,crossAxis:E,alignmentAxis:S}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return m&&typeof S=="number"&&(E=m==="end"?S*-1:S),g?{x:E*b,y:k*p}:{x:k*p,y:E*b}}const gj=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(a){var o,s;const{x:l,y:u,placement:f,middlewareData:m}=a,g=await hj(a,t);return f===((o=m.offset)==null?void 0:o.placement)&&(s=m.arrow)!=null&&s.alignmentOffset?{}:{x:l+g.x,y:u+g.y,data:{...g,placement:f}}}}},vj=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(a){const{x:o,y:s,placement:l,platform:u}=a,{mainAxis:f=!0,crossAxis:m=!1,limiter:g={fn:T=>{let{x:N,y:j}=T;return{x:N,y:j}}},...p}=ma(t,a),b={x:o,y:s},v=await u.detectOverflow(a,p),k=Wn(pa(l)),E=Wm(k);let S=b[E],w=b[k];if(f){const T=E==="y"?"top":"left",N=E==="y"?"bottom":"right",j=S+v[T],A=S-v[N];S=Jf(j,S,A)}if(m){const T=k==="y"?"top":"left",N=k==="y"?"bottom":"right",j=w+v[T],A=w-v[N];w=Jf(j,w,A)}const C=g.fn({...a,[E]:S,[k]:w});return{...C,data:{x:C.x-o,y:C.y-s,enabled:{[E]:f,[k]:m}}}}}},yj=function(t){return t===void 0&&(t={}),{options:t,fn(a){const{x:o,y:s,placement:l,rects:u,middlewareData:f}=a,{offset:m=0,mainAxis:g=!0,crossAxis:p=!0}=ma(t,a),b={x:o,y:s},v=Wn(l),k=Wm(v);let E=b[k],S=b[v];const w=ma(m,a),C=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(g){const j=k==="y"?"height":"width",A=u.reference[k]-u.floating[j]+C.mainAxis,O=u.reference[k]+u.reference[j]-C.mainAxis;E<A?E=A:E>O&&(E=O)}if(p){var T,N;const j=k==="y"?"width":"height",A=vw.has(pa(l)),O=u.reference[v]-u.floating[j]+(A&&((T=f.offset)==null?void 0:T[v])||0)+(A?0:C.crossAxis),D=u.reference[v]+u.reference[j]+(A?0:((N=f.offset)==null?void 0:N[v])||0)-(A?C.crossAxis:0);S<O?S=O:S>D&&(S=D)}return{[k]:E,[v]:S}}}},bj=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(a){var o,s;const{placement:l,rects:u,platform:f,elements:m}=a,{apply:g=()=>{},...p}=ma(t,a),b=await f.detectOverflow(a,p),v=pa(l),k=Yo(l),E=Wn(l)==="y",{width:S,height:w}=u.floating;let C,T;v==="top"||v==="bottom"?(C=v,T=k===(await(f.isRTL==null?void 0:f.isRTL(m.floating))?"start":"end")?"left":"right"):(T=v,C=k==="end"?"top":"bottom");const N=w-b.top-b.bottom,j=S-b.left-b.right,A=tr(w-b[C],N),O=tr(S-b[T],j),D=!a.middlewareData.shift;let L=A,P=O;if((o=a.middlewareData.shift)!=null&&o.enabled.x&&(P=j),(s=a.middlewareData.shift)!=null&&s.enabled.y&&(L=N),D&&!k){const Q=an(b.left,0),$=an(b.right,0),F=an(b.top,0),ne=an(b.bottom,0);E?P=S-2*(Q!==0||$!==0?Q+$:an(b.left,b.right)):L=w-2*(F!==0||ne!==0?F+ne:an(b.top,b.bottom))}await g({...a,availableWidth:P,availableHeight:L});const J=await f.getDimensions(m.floating);return S!==J.width||w!==J.height?{reset:{rects:!0}}:{}}}};function Ac(){return typeof window<"u"}function $o(t){return yw(t)?(t.nodeName||"").toLowerCase():"#document"}function on(t){var a;return(t==null||(a=t.ownerDocument)==null?void 0:a.defaultView)||window}function Pn(t){var a;return(a=(yw(t)?t.ownerDocument:t.document)||window.document)==null?void 0:a.documentElement}function yw(t){return Ac()?t instanceof Node||t instanceof on(t).Node:!1}function jn(t){return Ac()?t instanceof Element||t instanceof on(t).Element:!1}function va(t){return Ac()?t instanceof HTMLElement||t instanceof on(t).HTMLElement:!1}function Iy(t){return!Ac()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof on(t).ShadowRoot}function di(t){const{overflow:a,overflowX:o,overflowY:s,display:l}=An(t);return/auto|scroll|overlay|hidden|clip/.test(a+s+o)&&l!=="inline"&&l!=="contents"}function wj(t){return/^(table|td|th)$/.test($o(t))}function _c(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const xj=/transform|translate|scale|rotate|perspective|filter/,kj=/paint|layout|strict|content/,Er=t=>!!t&&t!=="none";let xf;function Pm(t){const a=jn(t)?An(t):t;return Er(a.transform)||Er(a.translate)||Er(a.scale)||Er(a.rotate)||Er(a.perspective)||!Fm()&&(Er(a.backdropFilter)||Er(a.filter))||xj.test(a.willChange||"")||kj.test(a.contain||"")}function Sj(t){let a=nr(t);for(;va(a)&&!Uo(a);){if(Pm(a))return a;if(_c(a))return null;a=nr(a)}return null}function Fm(){return xf==null&&(xf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),xf}function Uo(t){return/^(html|body|#document)$/.test($o(t))}function An(t){return on(t).getComputedStyle(t)}function Rc(t){return jn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function nr(t){if($o(t)==="html")return t;const a=t.assignedSlot||t.parentNode||Iy(t)&&t.host||Pn(t);return Iy(a)?a.host:a}function bw(t){const a=nr(t);return Uo(a)?t.ownerDocument?t.ownerDocument.body:t.body:va(a)&&di(a)?a:bw(a)}function ni(t,a,o){var s;a===void 0&&(a=[]),o===void 0&&(o=!0);const l=bw(t),u=l===((s=t.ownerDocument)==null?void 0:s.body),f=on(l);if(u){const m=tm(f);return a.concat(f,f.visualViewport||[],di(l)?l:[],m&&o?ni(m):[])}else return a.concat(l,ni(l,[],o))}function tm(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ww(t){const a=An(t);let o=parseFloat(a.width)||0,s=parseFloat(a.height)||0;const l=va(t),u=l?t.offsetWidth:o,f=l?t.offsetHeight:s,m=ac(o)!==u||ac(s)!==f;return m&&(o=u,s=f),{width:o,height:s,$:m}}function Km(t){return jn(t)?t:t.contextElement}function Do(t){const a=Km(t);if(!va(a))return In(1);const o=a.getBoundingClientRect(),{width:s,height:l,$:u}=ww(a);let f=(u?ac(o.width):o.width)/s,m=(u?ac(o.height):o.height)/l;return(!f||!Number.isFinite(f))&&(f=1),(!m||!Number.isFinite(m))&&(m=1),{x:f,y:m}}const Ej=In(0);function xw(t){const a=on(t);return!Fm()||!a.visualViewport?Ej:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function Cj(t,a,o){return a===void 0&&(a=!1),!o||a&&o!==on(t)?!1:a}function Or(t,a,o,s){a===void 0&&(a=!1),o===void 0&&(o=!1);const l=t.getBoundingClientRect(),u=Km(t);let f=In(1);a&&(s?jn(s)&&(f=Do(s)):f=Do(t));const m=Cj(u,o,s)?xw(u):In(0);let g=(l.left+m.x)/f.x,p=(l.top+m.y)/f.y,b=l.width/f.x,v=l.height/f.y;if(u){const k=on(u),E=s&&jn(s)?on(s):s;let S=k,w=tm(S);for(;w&&s&&E!==S;){const C=Do(w),T=w.getBoundingClientRect(),N=An(w),j=T.left+(w.clientLeft+parseFloat(N.paddingLeft))*C.x,A=T.top+(w.clientTop+parseFloat(N.paddingTop))*C.y;g*=C.x,p*=C.y,b*=C.x,v*=C.y,g+=j,p+=A,S=on(w),w=tm(S)}}return oc({width:b,height:v,x:g,y:p})}function Oc(t,a){const o=Rc(t).scrollLeft;return a?a.left+o:Or(Pn(t)).left+o}function kw(t,a){const o=t.getBoundingClientRect(),s=o.left+a.scrollLeft-Oc(t,o),l=o.top+a.scrollTop;return{x:s,y:l}}function Tj(t){let{elements:a,rect:o,offsetParent:s,strategy:l}=t;const u=l==="fixed",f=Pn(s),m=a?_c(a.floating):!1;if(s===f||m&&u)return o;let g={scrollLeft:0,scrollTop:0},p=In(1);const b=In(0),v=va(s);if((v||!v&&!u)&&(($o(s)!=="body"||di(f))&&(g=Rc(s)),v)){const E=Or(s);p=Do(s),b.x=E.x+s.clientLeft,b.y=E.y+s.clientTop}const k=f&&!v&&!u?kw(f,g):In(0);return{width:o.width*p.x,height:o.height*p.y,x:o.x*p.x-g.scrollLeft*p.x+b.x+k.x,y:o.y*p.y-g.scrollTop*p.y+b.y+k.y}}function Nj(t){return Array.from(t.getClientRects())}function jj(t){const a=Pn(t),o=Rc(t),s=t.ownerDocument.body,l=an(a.scrollWidth,a.clientWidth,s.scrollWidth,s.clientWidth),u=an(a.scrollHeight,a.clientHeight,s.scrollHeight,s.clientHeight);let f=-o.scrollLeft+Oc(t);const m=-o.scrollTop;return An(s).direction==="rtl"&&(f+=an(a.clientWidth,s.clientWidth)-l),{width:l,height:u,x:f,y:m}}const qy=25;function Aj(t,a){const o=on(t),s=Pn(t),l=o.visualViewport;let u=s.clientWidth,f=s.clientHeight,m=0,g=0;if(l){u=l.width,f=l.height;const b=Fm();(!b||b&&a==="fixed")&&(m=l.offsetLeft,g=l.offsetTop)}const p=Oc(s);if(p<=0){const b=s.ownerDocument,v=b.body,k=getComputedStyle(v),E=b.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,S=Math.abs(s.clientWidth-v.clientWidth-E);S<=qy&&(u-=S)}else p<=qy&&(u+=p);return{width:u,height:f,x:m,y:g}}function _j(t,a){const o=Or(t,!0,a==="fixed"),s=o.top+t.clientTop,l=o.left+t.clientLeft,u=va(t)?Do(t):In(1),f=t.clientWidth*u.x,m=t.clientHeight*u.y,g=l*u.x,p=s*u.y;return{width:f,height:m,x:g,y:p}}function Py(t,a,o){let s;if(a==="viewport")s=Aj(t,o);else if(a==="document")s=jj(Pn(t));else if(jn(a))s=_j(a,o);else{const l=xw(t);s={x:a.x-l.x,y:a.y-l.y,width:a.width,height:a.height}}return oc(s)}function Sw(t,a){const o=nr(t);return o===a||!jn(o)||Uo(o)?!1:An(o).position==="fixed"||Sw(o,a)}function Rj(t,a){const o=a.get(t);if(o)return o;let s=ni(t,[],!1).filter(m=>jn(m)&&$o(m)!=="body"),l=null;const u=An(t).position==="fixed";let f=u?nr(t):t;for(;jn(f)&&!Uo(f);){const m=An(f),g=Pm(f);!g&&m.position==="fixed"&&(l=null),(u?!g&&!l:!g&&m.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||di(f)&&!g&&Sw(t,f))?s=s.filter(b=>b!==f):l=m,f=nr(f)}return a.set(t,s),s}function Oj(t){let{element:a,boundary:o,rootBoundary:s,strategy:l}=t;const f=[...o==="clippingAncestors"?_c(a)?[]:Rj(a,this._c):[].concat(o),s],m=Py(a,f[0],l);let g=m.top,p=m.right,b=m.bottom,v=m.left;for(let k=1;k<f.length;k++){const E=Py(a,f[k],l);g=an(E.top,g),p=tr(E.right,p),b=tr(E.bottom,b),v=an(E.left,v)}return{width:p-v,height:b-g,x:v,y:g}}function Dj(t){const{width:a,height:o}=ww(t);return{width:a,height:o}}function Mj(t,a,o){const s=va(a),l=Pn(a),u=o==="fixed",f=Or(t,!0,u,a);let m={scrollLeft:0,scrollTop:0};const g=In(0);function p(){g.x=Oc(l)}if(s||!s&&!u)if(($o(a)!=="body"||di(l))&&(m=Rc(a)),s){const E=Or(a,!0,u,a);g.x=E.x+a.clientLeft,g.y=E.y+a.clientTop}else l&&p();u&&!s&&l&&p();const b=l&&!s&&!u?kw(l,m):In(0),v=f.left+m.scrollLeft-g.x-b.x,k=f.top+m.scrollTop-g.y-b.y;return{x:v,y:k,width:f.width,height:f.height}}function kf(t){return An(t).position==="static"}function Fy(t,a){if(!va(t)||An(t).position==="fixed")return null;if(a)return a(t);let o=t.offsetParent;return Pn(t)===o&&(o=o.ownerDocument.body),o}function Ew(t,a){const o=on(t);if(_c(t))return o;if(!va(t)){let l=nr(t);for(;l&&!Uo(l);){if(jn(l)&&!kf(l))return l;l=nr(l)}return o}let s=Fy(t,a);for(;s&&wj(s)&&kf(s);)s=Fy(s,a);return s&&Uo(s)&&kf(s)&&!Pm(s)?o:s||Sj(t)||o}const Lj=async function(t){const a=this.getOffsetParent||Ew,o=this.getDimensions,s=await o(t.floating);return{reference:Mj(t.reference,await a(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function zj(t){return An(t).direction==="rtl"}const Hj={convertOffsetParentRelativeRectToViewportRelativeRect:Tj,getDocumentElement:Pn,getClippingRect:Oj,getOffsetParent:Ew,getElementRects:Lj,getClientRects:Nj,getDimensions:Dj,getScale:Do,isElement:jn,isRTL:zj};function Cw(t,a){return t.x===a.x&&t.y===a.y&&t.width===a.width&&t.height===a.height}function Uj(t,a){let o=null,s;const l=Pn(t);function u(){var m;clearTimeout(s),(m=o)==null||m.disconnect(),o=null}function f(m,g){m===void 0&&(m=!1),g===void 0&&(g=1),u();const p=t.getBoundingClientRect(),{left:b,top:v,width:k,height:E}=p;if(m||a(),!k||!E)return;const S=Ul(v),w=Ul(l.clientWidth-(b+k)),C=Ul(l.clientHeight-(v+E)),T=Ul(b),j={rootMargin:-S+"px "+-w+"px "+-C+"px "+-T+"px",threshold:an(0,tr(1,g))||1};let A=!0;function O(D){const L=D[0].intersectionRatio;if(L!==g){if(!A)return f();L?f(!1,L):s=setTimeout(()=>{f(!1,1e-7)},1e3)}L===1&&!Cw(p,t.getBoundingClientRect())&&f(),A=!1}try{o=new IntersectionObserver(O,{...j,root:l.ownerDocument})}catch{o=new IntersectionObserver(O,j)}o.observe(t)}return f(!0),u}function Bj(t,a,o,s){s===void 0&&(s={});const{ancestorScroll:l=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:m=typeof IntersectionObserver=="function",animationFrame:g=!1}=s,p=Km(t),b=l||u?[...p?ni(p):[],...a?ni(a):[]]:[];b.forEach(T=>{l&&T.addEventListener("scroll",o,{passive:!0}),u&&T.addEventListener("resize",o)});const v=p&&m?Uj(p,o):null;let k=-1,E=null;f&&(E=new ResizeObserver(T=>{let[N]=T;N&&N.target===p&&E&&a&&(E.unobserve(a),cancelAnimationFrame(k),k=requestAnimationFrame(()=>{var j;(j=E)==null||j.observe(a)})),o()}),p&&!g&&E.observe(p),a&&E.observe(a));let S,w=g?Or(t):null;g&&C();function C(){const T=Or(t);w&&!Cw(w,T)&&o(),w=T,S=requestAnimationFrame(C)}return o(),()=>{var T;b.forEach(N=>{l&&N.removeEventListener("scroll",o),u&&N.removeEventListener("resize",o)}),v?.(),(T=E)==null||T.disconnect(),E=null,g&&cancelAnimationFrame(S)}}const Wj=gj,Ij=vj,qj=mj,Pj=bj,Fj=pj,Ky=fj,Kj=yj,Yj=(t,a,o)=>{const s=new Map,l={platform:Hj,...o},u={...l.platform,_c:s};return dj(t,a,{...l,platform:u})};var $j=typeof document<"u",Vj=function(){},Yl=$j?y.useLayoutEffect:Vj;function sc(t,a){if(t===a)return!0;if(typeof t!=typeof a)return!1;if(typeof t=="function"&&t.toString()===a.toString())return!0;let o,s,l;if(t&&a&&typeof t=="object"){if(Array.isArray(t)){if(o=t.length,o!==a.length)return!1;for(s=o;s--!==0;)if(!sc(t[s],a[s]))return!1;return!0}if(l=Object.keys(t),o=l.length,o!==Object.keys(a).length)return!1;for(s=o;s--!==0;)if(!{}.hasOwnProperty.call(a,l[s]))return!1;for(s=o;s--!==0;){const u=l[s];if(!(u==="_owner"&&t.$$typeof)&&!sc(t[u],a[u]))return!1}return!0}return t!==t&&a!==a}function Tw(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Yy(t,a){const o=Tw(t);return Math.round(a*o)/o}function Sf(t){const a=y.useRef(t);return Yl(()=>{a.current=t}),a}function Gj(t){t===void 0&&(t={});const{placement:a="bottom",strategy:o="absolute",middleware:s=[],platform:l,elements:{reference:u,floating:f}={},transform:m=!0,whileElementsMounted:g,open:p}=t,[b,v]=y.useState({x:0,y:0,strategy:o,placement:a,middlewareData:{},isPositioned:!1}),[k,E]=y.useState(s);sc(k,s)||E(s);const[S,w]=y.useState(null),[C,T]=y.useState(null),N=y.useCallback(W=>{W!==D.current&&(D.current=W,w(W))},[]),j=y.useCallback(W=>{W!==L.current&&(L.current=W,T(W))},[]),A=u||S,O=f||C,D=y.useRef(null),L=y.useRef(null),P=y.useRef(b),J=g!=null,Q=Sf(g),$=Sf(l),F=Sf(p),ne=y.useCallback(()=>{if(!D.current||!L.current)return;const W={placement:a,strategy:o,middleware:k};$.current&&(W.platform=$.current),Yj(D.current,L.current,W).then(G=>{const V={...G,isPositioned:F.current!==!1};Z.current&&!sc(P.current,V)&&(P.current=V,Cc.flushSync(()=>{v(V)}))})},[k,a,o,$,F]);Yl(()=>{p===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,v(W=>({...W,isPositioned:!1})))},[p]);const Z=y.useRef(!1);Yl(()=>(Z.current=!0,()=>{Z.current=!1}),[]),Yl(()=>{if(A&&(D.current=A),O&&(L.current=O),A&&O){if(Q.current)return Q.current(A,O,ne);ne()}},[A,O,ne,Q,J]);const q=y.useMemo(()=>({reference:D,floating:L,setReference:N,setFloating:j}),[N,j]),M=y.useMemo(()=>({reference:A,floating:O}),[A,O]),U=y.useMemo(()=>{const W={position:o,left:0,top:0};if(!M.floating)return W;const G=Yy(M.floating,b.x),V=Yy(M.floating,b.y);return m?{...W,transform:"translate("+G+"px, "+V+"px)",...Tw(M.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:G,top:V}},[o,m,M.floating,b.x,b.y]);return y.useMemo(()=>({...b,update:ne,refs:q,elements:M,floatingStyles:U}),[b,ne,q,M,U])}const Xj=t=>{function a(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:t,fn(o){const{element:s,padding:l}=typeof t=="function"?t(o):t;return s&&a(s)?s.current!=null?Ky({element:s.current,padding:l}).fn(o):{}:s?Ky({element:s,padding:l}).fn(o):{}}}},Zj=(t,a)=>{const o=Wj(t);return{name:o.name,fn:o.fn,options:[t,a]}},Qj=(t,a)=>{const o=Ij(t);return{name:o.name,fn:o.fn,options:[t,a]}},Jj=(t,a)=>({fn:Kj(t).fn,options:[t,a]}),eA=(t,a)=>{const o=qj(t);return{name:o.name,fn:o.fn,options:[t,a]}},tA=(t,a)=>{const o=Pj(t);return{name:o.name,fn:o.fn,options:[t,a]}},nA=(t,a)=>{const o=Fj(t);return{name:o.name,fn:o.fn,options:[t,a]}},aA=(t,a)=>{const o=Xj(t);return{name:o.name,fn:o.fn,options:[t,a]}};var rA="Arrow",Nw=y.forwardRef((t,a)=>{const{children:o,width:s=10,height:l=5,...u}=t;return c.jsx(Vt.svg,{...u,ref:a,width:s,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?o:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});Nw.displayName=rA;var oA=Nw;function sA(t){const[a,o]=y.useState(void 0);return er(()=>{if(t){o({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const u=l[0];let f,m;if("borderBoxSize"in u){const g=u.borderBoxSize,p=Array.isArray(g)?g[0]:g;f=p.inlineSize,m=p.blockSize}else f=t.offsetWidth,m=t.offsetHeight;o({width:f,height:m})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else o(void 0)},[t]),a}var Ym="Popper",[jw,Aw]=Om(Ym),[iA,_w]=jw(Ym),Rw=t=>{const{__scopePopper:a,children:o}=t,[s,l]=y.useState(null);return c.jsx(iA,{scope:a,anchor:s,onAnchorChange:l,children:o})};Rw.displayName=Ym;var Ow="PopperAnchor",Dw=y.forwardRef((t,a)=>{const{__scopePopper:o,virtualRef:s,...l}=t,u=_w(Ow,o),f=y.useRef(null),m=_n(a,f),g=y.useRef(null);return y.useEffect(()=>{const p=g.current;g.current=s?.current||f.current,p!==g.current&&u.onAnchorChange(g.current)}),s?null:c.jsx(Vt.div,{...l,ref:m})});Dw.displayName=Ow;var $m="PopperContent",[lA,cA]=jw($m),Mw=y.forwardRef((t,a)=>{const{__scopePopper:o,side:s="bottom",sideOffset:l=0,align:u="center",alignOffset:f=0,arrowPadding:m=0,avoidCollisions:g=!0,collisionBoundary:p=[],collisionPadding:b=0,sticky:v="partial",hideWhenDetached:k=!1,updatePositionStrategy:E="optimized",onPlaced:S,...w}=t,C=_w($m,o),[T,N]=y.useState(null),j=_n(a,ue=>N(ue)),[A,O]=y.useState(null),D=sA(A),L=D?.width??0,P=D?.height??0,J=s+(u!=="center"?"-"+u:""),Q=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},$=Array.isArray(p)?p:[p],F=$.length>0,ne={padding:Q,boundary:$.filter(dA),altBoundary:F},{refs:Z,floatingStyles:q,placement:M,isPositioned:U,middlewareData:W}=Gj({strategy:"fixed",placement:J,whileElementsMounted:(...ue)=>Bj(...ue,{animationFrame:E==="always"}),elements:{reference:C.anchor},middleware:[Zj({mainAxis:l+P,alignmentAxis:f}),g&&Qj({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?Jj():void 0,...ne}),g&&eA({...ne}),tA({...ne,apply:({elements:ue,rects:le,availableWidth:ie,availableHeight:xe})=>{const{width:Ne,height:he}=le.reference,we=ue.floating.style;we.setProperty("--radix-popper-available-width",`${ie}px`),we.setProperty("--radix-popper-available-height",`${xe}px`),we.setProperty("--radix-popper-anchor-width",`${Ne}px`),we.setProperty("--radix-popper-anchor-height",`${he}px`)}}),A&&aA({element:A,padding:m}),fA({arrowWidth:L,arrowHeight:P}),k&&nA({strategy:"referenceHidden",...ne})]}),[G,V]=Hw(M),R=zo(S);er(()=>{U&&R?.()},[U,R]);const B=W.arrow?.x,se=W.arrow?.y,re=W.arrow?.centerOffset!==0,[ce,fe]=y.useState();return er(()=>{T&&fe(window.getComputedStyle(T).zIndex)},[T]),c.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:U?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:c.jsx(lA,{scope:o,placedSide:G,onArrowChange:O,arrowX:B,arrowY:se,shouldHideArrow:re,children:c.jsx(Vt.div,{"data-side":G,"data-align":V,...w,ref:j,style:{...w.style,animation:U?void 0:"none"}})})})});Mw.displayName=$m;var Lw="PopperArrow",uA={top:"bottom",right:"left",bottom:"top",left:"right"},zw=y.forwardRef(function(a,o){const{__scopePopper:s,...l}=a,u=cA(Lw,s),f=uA[u.placedSide];return c.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:c.jsx(oA,{...l,ref:o,style:{...l.style,display:"block"}})})});zw.displayName=Lw;function dA(t){return t!==null}var fA=t=>({name:"transformOrigin",options:t,fn(a){const{placement:o,rects:s,middlewareData:l}=a,f=l.arrow?.centerOffset!==0,m=f?0:t.arrowWidth,g=f?0:t.arrowHeight,[p,b]=Hw(o),v={start:"0%",center:"50%",end:"100%"}[b],k=(l.arrow?.x??0)+m/2,E=(l.arrow?.y??0)+g/2;let S="",w="";return p==="bottom"?(S=f?v:`${k}px`,w=`${-g}px`):p==="top"?(S=f?v:`${k}px`,w=`${s.floating.height+g}px`):p==="right"?(S=`${-g}px`,w=f?v:`${E}px`):p==="left"&&(S=`${s.floating.width+g}px`,w=f?v:`${E}px`),{data:{x:S,y:w}}}});function Hw(t){const[a,o="center"]=t.split("-");return[a,o]}var mA=Rw,pA=Dw,hA=Mw,gA=zw,vA=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),yA="VisuallyHidden",Uw=y.forwardRef((t,a)=>c.jsx(Vt.span,{...t,ref:a,style:{...vA,...t.style}}));Uw.displayName=yA;var bA=Uw,[Dc]=Om("Tooltip",[Aw]),Mc=Aw(),Bw="TooltipProvider",wA=700,nm="tooltip.open",[xA,Vm]=Dc(Bw),Ww=t=>{const{__scopeTooltip:a,delayDuration:o=wA,skipDelayDuration:s=300,disableHoverableContent:l=!1,children:u}=t,f=y.useRef(!0),m=y.useRef(!1),g=y.useRef(0);return y.useEffect(()=>{const p=g.current;return()=>window.clearTimeout(p)},[]),c.jsx(xA,{scope:a,isOpenDelayedRef:f,delayDuration:o,onOpen:y.useCallback(()=>{window.clearTimeout(g.current),f.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>f.current=!0,s)},[s]),isPointerInTransitRef:m,onPointerInTransitChange:y.useCallback(p=>{m.current=p},[]),disableHoverableContent:l,children:u})};Ww.displayName=Bw;var ai="Tooltip",[kA,fi]=Dc(ai),Iw=t=>{const{__scopeTooltip:a,children:o,open:s,defaultOpen:l,onOpenChange:u,disableHoverableContent:f,delayDuration:m}=t,g=Vm(ai,t.__scopeTooltip),p=Mc(a),[b,v]=y.useState(null),k=Pl(),E=y.useRef(0),S=f??g.disableHoverableContent,w=m??g.delayDuration,C=y.useRef(!1),[T,N]=S0({prop:s,defaultProp:l??!1,onChange:L=>{L?(g.onOpen(),document.dispatchEvent(new CustomEvent(nm))):g.onClose(),u?.(L)},caller:ai}),j=y.useMemo(()=>T?C.current?"delayed-open":"instant-open":"closed",[T]),A=y.useCallback(()=>{window.clearTimeout(E.current),E.current=0,C.current=!1,N(!0)},[N]),O=y.useCallback(()=>{window.clearTimeout(E.current),E.current=0,N(!1)},[N]),D=y.useCallback(()=>{window.clearTimeout(E.current),E.current=window.setTimeout(()=>{C.current=!0,N(!0),E.current=0},w)},[w,N]);return y.useEffect(()=>()=>{E.current&&(window.clearTimeout(E.current),E.current=0)},[]),c.jsx(mA,{...p,children:c.jsx(kA,{scope:a,contentId:k,open:T,stateAttribute:j,trigger:b,onTriggerChange:v,onTriggerEnter:y.useCallback(()=>{g.isOpenDelayedRef.current?D():A()},[g.isOpenDelayedRef,D,A]),onTriggerLeave:y.useCallback(()=>{S?O():(window.clearTimeout(E.current),E.current=0)},[O,S]),onOpen:A,onClose:O,disableHoverableContent:S,children:o})})};Iw.displayName=ai;var am="TooltipTrigger",qw=y.forwardRef((t,a)=>{const{__scopeTooltip:o,...s}=t,l=fi(am,o),u=Vm(am,o),f=Mc(o),m=y.useRef(null),g=_n(a,m,l.onTriggerChange),p=y.useRef(!1),b=y.useRef(!1),v=y.useCallback(()=>p.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),c.jsx(pA,{asChild:!0,...f,children:c.jsx(Vt.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...s,ref:g,onPointerMove:Kt(t.onPointerMove,k=>{k.pointerType!=="touch"&&!b.current&&!u.isPointerInTransitRef.current&&(l.onTriggerEnter(),b.current=!0)}),onPointerLeave:Kt(t.onPointerLeave,()=>{l.onTriggerLeave(),b.current=!1}),onPointerDown:Kt(t.onPointerDown,()=>{l.open&&l.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:Kt(t.onFocus,()=>{p.current||l.onOpen()}),onBlur:Kt(t.onBlur,l.onClose),onClick:Kt(t.onClick,l.onClose)})})});qw.displayName=am;var Gm="TooltipPortal",[SA,EA]=Dc(Gm,{forceMount:void 0}),Pw=t=>{const{__scopeTooltip:a,forceMount:o,children:s,container:l}=t,u=fi(Gm,a);return c.jsx(SA,{scope:a,forceMount:o,children:c.jsx(Fo,{present:o||u.open,children:c.jsx(Mm,{asChild:!0,container:l,children:s})})})};Pw.displayName=Gm;var Bo="TooltipContent",Fw=y.forwardRef((t,a)=>{const o=EA(Bo,t.__scopeTooltip),{forceMount:s=o.forceMount,side:l="top",...u}=t,f=fi(Bo,t.__scopeTooltip);return c.jsx(Fo,{present:s||f.open,children:f.disableHoverableContent?c.jsx(Kw,{side:l,...u,ref:a}):c.jsx(CA,{side:l,...u,ref:a})})}),CA=y.forwardRef((t,a)=>{const o=fi(Bo,t.__scopeTooltip),s=Vm(Bo,t.__scopeTooltip),l=y.useRef(null),u=_n(a,l),[f,m]=y.useState(null),{trigger:g,onClose:p}=o,b=l.current,{onPointerInTransitChange:v}=s,k=y.useCallback(()=>{m(null),v(!1)},[v]),E=y.useCallback((S,w)=>{const C=S.currentTarget,T={x:S.clientX,y:S.clientY},N=_A(T,C.getBoundingClientRect()),j=RA(T,N),A=OA(w.getBoundingClientRect()),O=MA([...j,...A]);m(O),v(!0)},[v]);return y.useEffect(()=>()=>k(),[k]),y.useEffect(()=>{if(g&&b){const S=C=>E(C,b),w=C=>E(C,g);return g.addEventListener("pointerleave",S),b.addEventListener("pointerleave",w),()=>{g.removeEventListener("pointerleave",S),b.removeEventListener("pointerleave",w)}}},[g,b,E,k]),y.useEffect(()=>{if(f){const S=w=>{const C=w.target,T={x:w.clientX,y:w.clientY},N=g?.contains(C)||b?.contains(C),j=!DA(T,f);N?k():j&&(k(),p())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[g,b,f,p,k]),c.jsx(Kw,{...t,ref:u})}),[TA,NA]=Dc(ai,{isInside:!1}),jA=EC("TooltipContent"),Kw=y.forwardRef((t,a)=>{const{__scopeTooltip:o,children:s,"aria-label":l,onEscapeKeyDown:u,onPointerDownOutside:f,...m}=t,g=fi(Bo,o),p=Mc(o),{onClose:b}=g;return y.useEffect(()=>(document.addEventListener(nm,b),()=>document.removeEventListener(nm,b)),[b]),y.useEffect(()=>{if(g.trigger){const v=k=>{k.target?.contains(g.trigger)&&b()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[g.trigger,b]),c.jsx(Dm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:v=>v.preventDefault(),onDismiss:b,children:c.jsxs(hA,{"data-state":g.stateAttribute,...p,...m,ref:a,style:{...m.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(jA,{children:s}),c.jsx(TA,{scope:o,isInside:!0,children:c.jsx(bA,{id:g.contentId,role:"tooltip",children:l||s})})]})})});Fw.displayName=Bo;var Yw="TooltipArrow",AA=y.forwardRef((t,a)=>{const{__scopeTooltip:o,...s}=t,l=Mc(o);return NA(Yw,o).isInside?null:c.jsx(gA,{...l,...s,ref:a})});AA.displayName=Yw;function _A(t,a){const o=Math.abs(a.top-t.y),s=Math.abs(a.bottom-t.y),l=Math.abs(a.right-t.x),u=Math.abs(a.left-t.x);switch(Math.min(o,s,l,u)){case u:return"left";case l:return"right";case o:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function RA(t,a,o=5){const s=[];switch(a){case"top":s.push({x:t.x-o,y:t.y+o},{x:t.x+o,y:t.y+o});break;case"bottom":s.push({x:t.x-o,y:t.y-o},{x:t.x+o,y:t.y-o});break;case"left":s.push({x:t.x+o,y:t.y-o},{x:t.x+o,y:t.y+o});break;case"right":s.push({x:t.x-o,y:t.y-o},{x:t.x-o,y:t.y+o});break}return s}function OA(t){const{top:a,right:o,bottom:s,left:l}=t;return[{x:l,y:a},{x:o,y:a},{x:o,y:s},{x:l,y:s}]}function DA(t,a){const{x:o,y:s}=t;let l=!1;for(let u=0,f=a.length-1;u<a.length;f=u++){const m=a[u],g=a[f],p=m.x,b=m.y,v=g.x,k=g.y;b>s!=k>s&&o<(v-p)*(s-b)/(k-b)+p&&(l=!l)}return l}function MA(t){const a=t.slice();return a.sort((o,s)=>o.x<s.x?-1:o.x>s.x?1:o.y<s.y?-1:o.y>s.y?1:0),LA(a)}function LA(t){if(t.length<=1)return t.slice();const a=[];for(let s=0;s<t.length;s++){const l=t[s];for(;a.length>=2;){const u=a[a.length-1],f=a[a.length-2];if((u.x-f.x)*(l.y-f.y)>=(u.y-f.y)*(l.x-f.x))a.pop();else break}a.push(l)}a.pop();const o=[];for(let s=t.length-1;s>=0;s--){const l=t[s];for(;o.length>=2;){const u=o[o.length-1],f=o[o.length-2];if((u.x-f.x)*(l.y-f.y)>=(u.y-f.y)*(l.x-f.x))o.pop();else break}o.push(l)}return o.pop(),a.length===1&&o.length===1&&a[0].x===o[0].x&&a[0].y===o[0].y?a:a.concat(o)}var $w=Ww,zA=Iw,HA=qw,UA=Pw,BA=Fw;const Je=({children:t,label:a,side:o="top",align:s="center"})=>a?c.jsx($w,{delayDuration:250,skipDelayDuration:150,children:c.jsxs(zA,{children:[c.jsx(HA,{asChild:!0,children:t}),c.jsx(UA,{children:c.jsx(BA,{className:"tooltip",side:o,align:s,sideOffset:6,children:a})})]})}):c.jsx(c.Fragment,{children:t}),Vw=y.createContext(null),Gw=y.createContext([]),Ef=3,WA=t=>t==="success"?3e3:t==="warning"?5e3:0;let $y=0;const IA=()=>($y+=1,`t-${$y.toString(36)}-${Date.now().toString(36)}`),qA=({children:t})=>{const[a,o]=y.useState([]),s=y.useRef(new Map),l=y.useCallback(v=>{const k=s.current.get(v);k?.timer&&clearTimeout(k.timer),s.current.delete(v)},[]),u=y.useCallback(v=>{o(k=>k.filter(E=>E.id!==v)),l(v)},[l]),f=y.useCallback(({kind:v,message:k,durationMs:E})=>{const S=IA();o(C=>{const T=[...C,{id:S,kind:v,message:k}];if(T.length<=Ef)return T;const N=T.slice(0,T.length-Ef);for(const j of N)l(j.id);return T.slice(T.length-Ef)});const w=E??WA(v);if(w>0){const C=setTimeout(()=>u(S),w);s.current.set(S,{timer:C,dueAt:Date.now()+w,durationMs:w,remainingMs:w})}return S},[u,l]),m=y.useCallback(v=>{const k=s.current.get(v);k?.timer&&(clearTimeout(k.timer),s.current.set(v,{...k,timer:null,remainingMs:Math.max(0,k.dueAt-Date.now())}))},[]),g=y.useCallback(v=>{const k=s.current.get(v);if(!k||k.timer||k.remainingMs<=0)return;const E=setTimeout(()=>u(v),k.remainingMs);s.current.set(v,{...k,timer:E,dueAt:Date.now()+k.remainingMs})},[u]),p=y.useCallback(v=>s.current.get(v)?.durationMs??0,[]);y.useEffect(()=>{const v=s.current;return()=>{for(const k of v.values())k.timer&&clearTimeout(k.timer);v.clear()}},[]);const b=y.useMemo(()=>({show:f,dismiss:u,pauseDismiss:m,resumeDismiss:g,getDuration:p}),[f,u,m,g,p]);return c.jsx(Vw.Provider,{value:b,children:c.jsx(Gw.Provider,{value:a,children:t})})},sn=()=>{const t=y.useContext(Vw);if(!t)throw new Error("useToast must be used within ToastProvider");return t},PA=()=>y.useContext(Gw),FA=2e3,Cf=()=>document.visibilityState==="hidden",Xw=(t,a)=>{const o=Math.max(0,Math.floor((Date.now()-t)/1e3));return o<60?a("common.time.sAgo",{count:o}):o<3600?a("common.time.mAgo",{count:Math.floor(o/60)}):o<86400?a("common.time.hAgo",{count:Math.floor(o/3600)}):a("common.time.dAgo",{count:Math.floor(o/86400)})},KA={cancelled:"actionCenter.activity.cancelled",queued:"actionCenter.activity.queued",reported:"actionCenter.activity.reported",submitted:"actionCenter.activity.submitted"},ic=(t,a)=>{const o=t.toWorkerName??a("actionCenter.unknownWorker");return a(KA[t.kind],{ago:Xw(t.timestamp,a),worker:o})},Xm=t=>t.reportPreview??t.taskPreview??t.label??t.phase,Zw=t=>t.currentDispatch?.taskPreview??t.latestReport?.reportPreview??t.terminalHint??null,Qw=(t,a)=>t.currentDispatch?a("actionCenter.currentDispatch"):t.latestReport?a("actionCenter.latestReport"):t.terminalHint?a("actionCenter.terminalHint"):a("actionCenter.workerStatus"),rm=(t,a)=>t.kind==="no_workers"?a("actionCenter.attention.noWorkers"):t.kind==="stopped_with_queue"?a("actionCenter.attention.stoppedWithQueue",{worker:t.workerName}):t.kind==="dispatch_waiting_report"?a("actionCenter.attention.waitingReport",{minutes:t.minutesAgo,worker:t.workerName??a("actionCenter.unknownWorker")}):a(t.kind==="remote_error"?"actionCenter.attention.remoteError":"actionCenter.attention.remoteRejected",{endpoint:t.endpoint??t.action,reason:t.reason??"unknown"}),lc=t=>t.kind==="stopped_with_queue"?`${t.kind}-${t.workerId}`:t.kind==="dispatch_waiting_report"?`${t.kind}-${t.dispatchId}`:t.kind==="remote_error"||t.kind==="remote_rejected"?`${t.kind}-${t.ts}-${t.action}-${t.endpoint??""}-${t.reason??""}`:t.kind,Jw=t=>{const[a,o]=y.useState(null),[s,l]=y.useState(!1),u=y.useCallback(async f=>$N(t,f?{signal:f}:void 0),[t]);return y.useEffect(()=>{let f=!1,m=!1,g=null,p=null;const b=async()=>{if(!(f||m||Cf())){m=!0,p=new AbortController;try{const k=await u(p.signal);if(f)return;o(k),l(!1)}catch{f||l(!0)}finally{p=null,m=!1}!f&&!Cf()&&(g=setTimeout(b,FA))}},v=()=>{f||Cf()||(g&&(clearTimeout(g),g=null),b())};return document.addEventListener("visibilitychange",v),b(),()=>{f=!0,p?.abort(),g&&clearTimeout(g),document.removeEventListener("visibilitychange",v)}},[u]),{error:s,summary:a}},ex=t=>{const{t:a}=be(),o=sn(),[s,l]=y.useState(!1);return{copyingRecap:s,handleCopyRecap:()=>{if(s)return;l(!0);const f=VN(t).then(m=>m.markdown);mw(f).then(()=>o.show({kind:"success",message:a("actionCenter.recapCopied")})).catch(()=>o.show({kind:"error",message:a("actionCenter.recapCopyFailed")})).finally(()=>l(!1))}}},Zm=t=>{const a=t?.recentActivity[0]??null,o=a?Xm(a):null,s=t?.attention.slice(0,5)??[],l=t?.workers.filter(f=>f.currentDispatch||f.latestReport||f.terminalHint||f.status==="working").slice(0,6)??[],u=t?.recentActivity.slice(0,6)??[];return{attention:s,evidenceWorkers:l,latest:a,latestDetail:o,recentActivity:u}},YA=t=>t==="reported"?"green":t==="cancelled"?"red":t==="queued"?"orange":"accent",$A=({copyingRecap:t,onCopyRecap:a,onOpenWorker:o,summary:s})=>{const{t:l}=be(),{attention:u,evidenceWorkers:f,recentActivity:m}=Zm(s);return c.jsxs("div",{className:"mt-2 grid gap-2 md:grid-cols-2","data-testid":"action-center-evidence",children:[c.jsx("div",{className:"flex min-w-0 justify-end md:col-span-2",children:c.jsxs("button",{type:"button",onClick:a,disabled:t,className:"inline-flex items-center gap-1.5 rounded border border-bright/40 px-2 py-1 text-xs text-sec hover:bg-2 hover:text-pri disabled:cursor-default disabled:opacity-60","data-testid":"action-center-copy-recap",children:[c.jsx(Dr,{size:12,"aria-hidden":!0}),l("actionCenter.copyRecap")]})}),u.length>0?c.jsxs("div",{className:"min-w-0 md:col-span-2",children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-ter",children:l("actionCenter.attention")}),c.jsx("ul",{className:"flex flex-col gap-px rounded border border-bright/40 bg-0",children:u.map(g=>c.jsx("li",{children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2 py-1.5 text-xs","data-testid":`action-center-attention-${lc(g)}`,children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 shrink-0 rounded-full",style:{background:g.severity==="error"?"var(--status-red)":g.severity==="warning"?"var(--status-orange)":"var(--text-tertiary)"},"aria-hidden":!0}),c.jsx("span",{className:"min-w-0 truncate text-sec",title:rm(g,l),children:rm(g,l)})]})},lc(g)))})]}):null,c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-ter",children:l("actionCenter.recent")}),m.length>0?c.jsx("ul",{className:"flex max-h-36 flex-col gap-px overflow-auto rounded border border-bright/40 bg-0",children:m.map(g=>{const p=Xm(g);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>o?.(g.toAgentId),className:"flex w-full min-w-0 items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-2 disabled:cursor-default disabled:hover:bg-transparent",disabled:!o,"data-testid":`action-center-activity-${g.id}`,children:[c.jsx("span",{className:"shrink-0 text-sec",children:ic(g,l)}),p?c.jsx("span",{className:"min-w-0 truncate text-ter",title:p,children:p}):null]})},g.id)})}):c.jsx("div",{className:"rounded border border-dashed border-bright/40 px-2 py-2 text-xs text-ter",children:l("actionCenter.noActivity")})]}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-ter",children:l("actionCenter.workers")}),f.length>0?c.jsx("ul",{className:"flex max-h-36 flex-col gap-px overflow-auto rounded border border-bright/40 bg-0",children:f.map(g=>{const p=Zw(g);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>o?.(g.id),className:"flex w-full min-w-0 items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-2 disabled:cursor-default disabled:hover:bg-transparent",disabled:!o,"data-testid":`action-center-worker-${g.id}`,children:[c.jsx("span",{className:"min-w-0 flex-1 truncate text-sec",children:g.name}),c.jsx("span",{className:"shrink-0 text-ter",children:Qw(g,l)}),p?c.jsx("span",{className:"min-w-0 flex-[1.4] truncate text-ter",title:p,children:p}):null]})},g.id)})}):c.jsx("div",{className:"rounded border border-dashed border-bright/40 px-2 py-2 text-xs text-ter",children:l("actionCenter.noWorkerEvidence")})]})]})},Bl=({icon:t,label:a,tone:o="neutral",value:s})=>c.jsxs("div",{className:"action-center-metric","data-tone":o,children:[c.jsx("div",{className:"action-center-metric__icon","aria-hidden":!0,children:t}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"mono text-lg font-semibold leading-none text-pri",children:s}),c.jsx("div",{className:"mt-1 truncate text-[11px] font-medium text-ter",children:a})]})]}),VA=({copyingRecap:t,error:a,onClose:o,onCopyRecap:s,onOpenWorker:l,open:u,summary:f})=>{const{t:m}=be(),g=yt(),{attention:p,evidenceWorkers:b,latest:v,latestDetail:k,recentActivity:E}=Zm(f),S=w=>{l?.(w),o()};return c.jsx(Mr,{open:u,onOpenChange:w=>!w&&o(),children:c.jsxs(Lr,{children:[c.jsx(zr,{"data-testid":"action-center-overlay",className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:c.jsxs(Hr,{"data-testid":"action-center-drawer","aria-label":m("actionCenter.title"),"data-mobile":g||void 0,className:"dialog-scale-pop elev-2 pointer-events-auto flex flex-col rounded-lg border",style:g?{background:"var(--bg-1)",borderColor:"var(--border-bright)"}:{background:"var(--bg-1)",borderColor:"var(--border-bright)",height:"min(720px, calc(100vh - 48px))",width:"min(820px, calc(100vw - 48px))"},children:[c.jsxs("header",{className:"flex items-center justify-between gap-3 border-b px-4 py-2",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs(Ur,{className:"flex items-center gap-2 text-base font-semibold text-pri",children:[c.jsx(bc,{size:17,className:"text-accent","aria-hidden":!0}),m("actionCenter.title")]}),c.jsx(Ko,{className:"text-xs text-ter",children:m("actionCenter.subtitle")})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[c.jsx(Je,{label:m("actionCenter.copyRecap"),children:c.jsxs("button",{type:"button",onClick:s,disabled:t||!f,className:"drawer-action-btn pointer-coarse:min-h-10","data-testid":"action-center-copy-recap",children:[t?c.jsx(Ja,{size:14,className:"animate-spin"}):c.jsx(Dr,{size:14}),c.jsx("span",{className:"hidden sm:inline",children:m("actionCenter.copyRecap")})]})}),c.jsx(Je,{label:m("common.close"),children:c.jsx("button",{type:"button",onClick:o,"aria-label":m("common.close"),className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:c.jsx(fa,{size:14})})})]})]}),c.jsxs("div",{className:"scroll-y min-h-0 flex-1 px-4 py-4",children:[a?c.jsxs("div",{className:"action-center-alert action-center-alert--error",children:[c.jsx(Js,{size:15,"aria-hidden":!0}),c.jsx("span",{children:m("actionCenter.loadFailed")})]}):null,f?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("section",{className:"action-center-hero","data-state":p.length>0?"attention":"calm",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"action-center-kicker",children:[c.jsx(wy,{size:13,"aria-hidden":!0}),m("actionCenter.liveSnapshot")]}),c.jsx("span",{className:"text-[11px] text-ter",children:m("actionCenter.updated",{ago:Xw(f.generatedAt,m)})})]}),c.jsx("p",{className:"mt-2 text-sm font-medium text-pri",children:v?ic(v,m):m("actionCenter.noActivity")}),k?c.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-sec",title:k,children:k}):null]}),c.jsx("div",{className:"action-center-hero__status",children:p.length>0?m("actionCenter.needsAttention",{count:p.length}):m("actionCenter.allClear")})]}),c.jsxs("section",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4","aria-label":m("actionCenter.metrics"),children:[c.jsx(Bl,{icon:c.jsx(Ec,{size:15}),label:m("actionCenter.totalWorkers"),value:f.summary.totalWorkers}),c.jsx(Bl,{icon:c.jsx(wy,{size:15}),label:m("actionCenter.workingWorkers"),tone:"green",value:f.summary.workingWorkers}),c.jsx(Bl,{icon:c.jsx(XS,{size:15}),label:m("actionCenter.openDispatches"),tone:f.summary.openDispatches>0?"orange":"neutral",value:f.summary.openDispatches}),c.jsx(Bl,{icon:c.jsx(i0,{size:15}),label:m("actionCenter.recentReports"),tone:"accent",value:f.summary.recentReports})]}),c.jsxs("section",{className:"grid gap-3 lg:grid-cols-[1fr_1fr]",children:[c.jsxs("div",{className:"action-center-panel lg:col-span-2",children:[c.jsx("div",{className:"action-center-panel__header",children:c.jsxs("div",{children:[c.jsx("h3",{children:m("actionCenter.attention")}),c.jsx("p",{children:m("actionCenter.attentionSubtitle")})]})}),p.length>0?c.jsx("ul",{className:"space-y-2",children:p.map(w=>c.jsx("li",{children:c.jsxs("div",{className:"action-center-attention-row","data-severity":w.severity,"data-testid":`action-center-attention-${lc(w)}`,children:[c.jsx(Js,{size:14,"aria-hidden":!0}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:rm(w,m)})]})},lc(w)))}):c.jsx("div",{className:"action-center-empty",children:m("actionCenter.noAttention")})]}),c.jsxs("div",{className:"action-center-panel",children:[c.jsx("div",{className:"action-center-panel__header",children:c.jsxs("div",{children:[c.jsx("h3",{children:m("actionCenter.recent")}),c.jsx("p",{children:m("actionCenter.recentSubtitle")})]})}),E.length>0?c.jsx("ul",{className:"space-y-1.5",children:E.map(w=>{const C=Xm(w);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>S(w.toAgentId),className:"action-center-list-row","data-tone":YA(w.kind),disabled:!l,"data-testid":`action-center-activity-${w.id}`,children:[c.jsx("span",{className:"action-center-row-dot","aria-hidden":!0}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsx("span",{className:"block truncate text-xs font-medium text-pri",children:ic(w,m)}),C?c.jsx("span",{className:"block truncate text-[11px] text-ter",children:C}):null]})]})},w.id)})}):c.jsx("div",{className:"action-center-empty",children:m("actionCenter.noActivity")})]}),c.jsxs("div",{className:"action-center-panel",children:[c.jsx("div",{className:"action-center-panel__header",children:c.jsxs("div",{children:[c.jsx("h3",{children:m("actionCenter.workers")}),c.jsx("p",{children:m("actionCenter.workersSubtitle")})]})}),b.length>0?c.jsx("ul",{className:"space-y-1.5",children:b.map(w=>{const C=Zw(w);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>S(w.id),className:"action-center-list-row","data-tone":w.status==="working"?"green":"neutral",disabled:!l,"data-testid":`action-center-worker-${w.id}`,children:[c.jsx("span",{className:"action-center-worker-avatar","aria-hidden":!0,children:c.jsx(XE,{size:13})}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c.jsx("span",{className:"truncate text-xs font-medium text-pri",children:w.name}),c.jsx("span",{className:"shrink-0 text-[11px] text-ter",children:Qw(w,m)})]}),C?c.jsx("span",{className:"block truncate text-[11px] text-ter",children:C}):null]})]})},w.id)})}):c.jsx("div",{className:"action-center-empty",children:m("actionCenter.noWorkerEvidence")})]})]})]}):c.jsxs("div",{className:"flex h-[320px] items-center justify-center text-ter",children:[c.jsx(Ja,{size:18,className:"animate-spin"}),c.jsx("span",{className:"ml-2 text-sm",children:m("actionCenter.loading")})]})]})]})})]})})},GA=({onOpenWorker:t,workspaceId:a})=>{const{t:o}=be(),{error:s,summary:l}=Jw(a),{copyingRecap:u,handleCopyRecap:f}=ex(a),[m,g]=y.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsx(Je,{label:o(m?"actionCenter.collapse":"actionCenter.expand"),children:c.jsxs("button",{type:"button",onClick:()=>g(p=>!p),"aria-expanded":m,"aria-haspopup":"dialog","aria-label":o(m?"actionCenter.collapse":"actionCenter.expand"),"data-testid":"topbar-action-center",className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(bc,{size:13,"aria-hidden":!0}),c.jsx("span",{children:o("actionCenter.title")}),l&&l.summary.workingWorkers>0?c.jsx("span",{className:"mono rounded bg-3 px-1 text-[11px] text-accent",children:l.summary.workingWorkers}):null]})}),c.jsx(VA,{copyingRecap:u,error:s,onClose:()=>g(!1),onCopyRecap:f,onOpenWorker:t,open:m,summary:l})]})},XA=({onOpenWorker:t,workspaceId:a})=>{const{t:o}=be(),{error:s,summary:l}=Jw(a),{copyingRecap:u,handleCopyRecap:f}=ex(a),[m,g]=y.useState(!1),{latest:p,latestDetail:b}=Zm(l);return c.jsxs("section",{className:"shrink-0 border-b px-4 py-2","data-testid":"action-center-strip",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>g(v=>!v),"aria-expanded":m,"aria-label":o(m?"actionCenter.collapse":"actionCenter.expand"),className:"inline-flex items-center gap-1.5 rounded px-1 py-0.5 text-xs font-semibold uppercase tracking-wide text-ter hover:bg-3 hover:text-pri",children:[m?c.jsx(qo,{size:13,"aria-hidden":!0}):c.jsx(wc,{size:13,"aria-hidden":!0}),c.jsx(bc,{size:13,"aria-hidden":!0}),o("actionCenter.title")]}),c.jsx("span",{className:"pill pill--green",children:o("actionCenter.runningCount",{count:l?.summary.workingWorkers??0})}),c.jsx("span",{className:"pill pill--ghost",children:o("actionCenter.reportCount",{count:l?.summary.recentReports??0})})]}),c.jsx("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-xs text-sec",children:s?c.jsx("span",{style:{color:"var(--text-error)"},children:o("actionCenter.loadFailed")}):p?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"shrink-0 text-ter",children:ic(p,o)}),b?c.jsxs("span",{className:"min-w-0 truncate text-ter",title:b,children:["· ",b]}):null]}):c.jsx("span",{className:"text-ter",children:o(l?"actionCenter.noActivity":"actionCenter.loading")})}),m&&l?c.jsx($A,{copyingRecap:u,onCopyRecap:f,onOpenWorker:t,summary:l}):null]})};let cc=!1;const om=new Set,ZA=()=>cc,tx=t=>{if(cc!==t){cc=t;for(const a of om)a()}},QA=()=>{tx(!cc)},JA=t=>(om.add(t),()=>om.delete(t)),nx=()=>y.useSyncExternalStore(JA,ZA,()=>!1),ax="hive.notification.settings",No={desktop:!1,detail:"brief",sound:"soft"},e_={beacon:"/sounds/hive-beacon.ogg",cascade:"/sounds/hive-cascade.ogg",chime:"/sounds/hive-chime.ogg",ping:"/sounds/hive-ping.ogg",resolve:"/sounds/hive-resolve.ogg",soft:"/sounds/hive-soft.ogg"},t_=t=>t==="off"||t==="ping"||t==="chime"||t==="soft"||t==="cascade"||t==="beacon"||t==="resolve",n_=()=>{if(typeof window>"u")return No;try{const t=window.localStorage.getItem(ax);if(!t)return No;const a=JSON.parse(t);return{desktop:typeof a.desktop=="boolean"?a.desktop:No.desktop,detail:a.detail==="detailed"?"detailed":No.detail,sound:t_(a.sound)?a.sound:No.sound}}catch{return No}},a_=t=>{try{window.localStorage.setItem(ax,JSON.stringify(t))}catch{}},Vy=t=>{if(!(t==="off"||typeof window>"u"))try{const a=new window.Audio(e_[t]);a.preload="auto",a.volume=.72,a.play()?.catch(()=>{})}catch{}},rx=y.createContext(null),r_=({children:t})=>{const a=sn(),{t:o}=be(),[s,l]=y.useState(()=>n_());y.useEffect(()=>{a_(s)},[s]);const u=y.useCallback(b=>{l(v=>({...v,...b}))},[]),f=y.useCallback(async()=>{if(typeof window>"u"||!("Notification"in window))return u({desktop:!1}),a.show({kind:"warning",message:o("notifications.toast.unsupported")}),!1;if(window.Notification.permission==="granted")return u({desktop:!0}),!0;if(window.Notification.permission==="denied")return u({desktop:!1}),a.show({kind:"warning",message:o("notifications.toast.blocked")}),!1;const v=await window.Notification.requestPermission()==="granted";return u({desktop:v}),v||a.show({kind:"warning",message:o("notifications.toast.declined")}),v},[o,a,u]),m=y.useCallback(({brief:b,detail:v,kind:k,title:E})=>{const S=s.detail==="detailed"&&v?v:b;if(a.show({kind:k,message:S}),Vy(s.sound),s.desktop&&typeof window<"u"&&"Notification"in window&&window.Notification.permission==="granted")try{new window.Notification(E,{body:S})}catch{}},[s,a]),g=y.useCallback(b=>{Vy(b)},[]),p=y.useMemo(()=>({notify:m,previewSound:g,requestDesktopNotifications:f,settings:s,updateSettings:u}),[m,g,f,s,u]);return c.jsx(rx.Provider,{value:p,children:t})},Lc=()=>{const t=y.useContext(rx);if(!t)throw new Error("useNotifications must be used within NotificationProvider");return t},o_={coder:"role.coder",custom:"role.custom",reviewer:"role.reviewer",tester:"role.tester"},s_=t=>new Map(t.map(a=>[a.id,{id:a.id,name:a.name,pendingTaskCount:a.pendingTaskCount,role:a.role,status:a.status}])),i_=({terminalRuns:t,workers:a,workspace:o})=>{const{notify:s}=Lc(),{t:l}=be(),u=y.useRef(null);return y.useEffect(()=>{if(!o){u.current=null;return}const f=s_(a),m=u.current;if(u.current={workers:f,workspaceId:o.id},!(!m||m.workspaceId!==o.id))for(const g of f.values()){const p=m.workers.get(g.id);if(!p)continue;if(p.status!=="stopped"&&g.status==="stopped"){s({brief:l("notifications.workerStopped.brief",{name:g.name}),detail:l("notifications.workerStopped.detail",{name:g.name,workspace:o.name}),kind:"error",title:l("notifications.workerStopped.title")});continue}if(p.status==="stopped"&&g.status!=="stopped"){s({brief:l("notifications.workerStarted.brief",{name:g.name}),detail:l("notifications.workerStarted.detail",{name:g.name,workspace:o.name,role:l(o_[g.role])}),kind:"success",title:l("notifications.workerStarted.title")});continue}(g.pendingTaskCount<p.pendingTaskCount||p.status==="working"&&g.status==="idle")&&s({brief:l("notifications.workerReported.brief",{name:g.name}),detail:l("notifications.workerReported.detail",{name:g.name,workspace:o.name}),kind:"success",title:l("notifications.workerReported.title")})}},[s,l,a,o]),null},l_=({tabs:t,activeId:a,onSelect:o,onClose:s,onClosePanel:l,onNewShell:u,newShellPending:f})=>{const{t:m}=be();return c.jsxs("div",{role:"tablist","aria-label":m("terminalPanel.tablistAria"),className:"scrollbar-thin flex h-9 min-h-9 w-full items-stretch overflow-x-auto pointer-coarse:h-12 pointer-coarse:min-h-12",style:{background:"var(--bg-2)",borderBottom:"1px solid var(--border)"},"data-testid":"terminal-tab-strip",children:[t.map(g=>{const p=g.id===a,b=m("terminalPanel.closeTab",{name:g.label}),v=k=>{k.stopPropagation(),s(g.id)};return c.jsxs("div",{role:"tab","aria-selected":p,"data-testid":`terminal-tab-${g.id}`,onClick:()=>o(g.id),className:"group relative flex max-w-[200px] shrink-0 cursor-pointer items-center gap-1.5 border-r text-xs",style:{background:p?"var(--bg-1)":"transparent",borderRightColor:"var(--border)",color:p?"var(--text-primary)":"var(--text-secondary)"},children:[p?c.jsx("span",{"data-tab-accent":!0,"aria-hidden":!0,className:"pointer-events-none absolute top-0 right-0 left-0 h-0.5",style:{background:"var(--accent)"}}):null,c.jsxs("button",{type:"button","data-testid":`terminal-tab-select-${g.id}`,onClick:k=>{k.stopPropagation(),o(g.id)},className:"flex min-w-0 flex-1 items-center gap-1.5 py-2 pr-1 pl-3 text-left",style:{color:"inherit"},children:[c.jsx(kc,{size:12,"aria-hidden":!0}),c.jsx("span",{className:"truncate",children:g.label})]}),c.jsx(Je,{label:b,children:c.jsx("button",{type:"button","aria-label":b,"data-testid":`terminal-tab-close-${g.id}`,onClick:v,className:`mr-1 rounded p-0.5 pointer-coarse:p-2 transition ${p?"opacity-100":"opacity-0 group-hover:opacity-100 pointer-coarse:opacity-100"}`,style:{color:"var(--text-secondary)"},children:c.jsx(fa,{size:12,"aria-hidden":!0})})})]},g.id)}),c.jsxs("div",{className:"flex flex-1 items-center justify-end gap-1 px-2",children:[c.jsx(Je,{label:m("terminalPanel.closePanel"),children:c.jsx("button",{type:"button","aria-label":m("terminalPanel.closePanel"),"data-testid":"terminal-panel-close",onClick:l,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded border text-sec transition hover:text-pri disabled:opacity-50 pointer-coarse:h-10 pointer-coarse:w-10",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:c.jsx(fa,{size:12,"aria-hidden":!0})})}),c.jsx(Je,{label:m("terminalPanel.newShell"),children:c.jsx("button",{type:"button","aria-label":m("terminalPanel.newShell"),"data-testid":"terminal-tab-new-shell",onClick:u,disabled:f,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded border text-sec transition hover:text-pri disabled:opacity-50 pointer-coarse:h-10 pointer-coarse:w-10",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:f?c.jsx(Ja,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(Jl,{size:12,"aria-hidden":!0})})})]})]})},ox="hive.terminal-panel.height",sx="hive.terminal-panel.collapsed",sm=160,c_=.35,u_=160,Vs=t=>{const a=typeof window<"u"?window.innerHeight:800,o=Math.max(sm,a-u_);return Math.min(Math.max(t,sm),o)},Tf=()=>{const t=typeof window<"u"?window.innerHeight:800;return Vs(Math.floor(t*c_))},d_=()=>{try{const t=window.localStorage.getItem(ox);if(!t)return Tf();const a=Number.parseInt(t,10);return Number.isFinite(a)?Vs(a):Tf()}catch{return Tf()}},f_=()=>{try{return window.localStorage.getItem(sx)==="1"}catch{return!1}},m_=()=>{const[t,a]=y.useState(()=>d_()),[o,s]=y.useState(()=>f_()),[l,u]=y.useState(!1);y.useEffect(()=>{try{window.localStorage.setItem(ox,String(Math.round(t)))}catch{}},[t]),y.useEffect(()=>{try{window.localStorage.setItem(sx,o?"1":"0")}catch{}},[o]),y.useEffect(()=>{const p=()=>a(b=>Vs(b));return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]);const f=y.useCallback(p=>a(Vs(p)),[]),m=y.useCallback(p=>s(p),[]),g=y.useCallback(p=>{p.preventDefault();const b=p.clientY;let v=t;a(C=>(v=C,C)),u(!0);const k=document.body.style.cursor,E=document.body.style.userSelect;document.body.style.cursor="ns-resize",document.body.style.userSelect="none";const S=C=>{const T=C.clientY-b;a(Vs(v-T))},w=()=>{u(!1),document.body.style.cursor=k,document.body.style.userSelect=E,document.removeEventListener("pointermove",S),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w)};document.addEventListener("pointermove",S),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w)},[t]);return{height:t,collapsed:o,dragging:l,setHeight:f,setCollapsed:m,beginDrag:g}},p_=(t,a)=>a?t.find(o=>o.id===a)??null:null,h_=({tabs:t,activeId:a,onSelect:o,onClose:s,onClosePanel:l,onNewShell:u,newShellPending:f,onStartWorker:m,startingWorkerId:g})=>{const{t:p}=be(),b=m_(),v=yt();if(t.length===0)return null;const k=p_(t,a)??t[0]??null;return c.jsxs("div",{"data-testid":"terminal-bottom-panel",className:"relative flex shrink-0 flex-col",style:{height:v?"45%":b.height,minHeight:v?"min(160px, 60%)":void 0,background:"var(--bg-1)",borderTop:"1px solid var(--border)"},tabIndex:-1,onKeyDown:E=>{(E.metaKey||E.ctrlKey)&&!E.altKey&&!E.shiftKey&&E.key.toLowerCase()==="w"&&a&&(E.preventDefault(),s(a))},children:[v?null:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":p("terminalPanel.resizeAria"),"aria-valuemin":sm,"aria-valuenow":Math.round(b.height),className:"absolute top-0 right-0 left-0 z-10 h-2 -translate-y-1 cursor-ns-resize",tabIndex:-1,"data-resizing":b.dragging||void 0,"data-testid":"terminal-panel-resize-handle",onPointerDown:b.beginDrag}),c.jsx(l_,{tabs:t,activeId:k?.id??null,onSelect:o,onClose:s,onClosePanel:l,onNewShell:u,newShellPending:f}),c.jsx("div",{className:"relative min-h-0 flex-1",style:{background:"var(--bg-crust)"},children:t.map(E=>c.jsx(g_,{tab:E,isActive:E.id===(k?.id??null),onStartWorker:m,startingWorkerId:g},E.id))})]})},g_=({tab:t,isActive:a,onStartWorker:o,startingWorkerId:s})=>{const{t:l}=be(),u=a?"flex h-full w-full":"hidden";if(t.kind==="worker"){if(!t.runId){const f=s===t.workerId;return c.jsxs("div",{className:a?"flex h-full w-full flex-col items-center justify-center gap-3 px-6 text-center text-xs text-ter":"hidden","data-testid":"terminal-panel-stopped-worker",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(kc,{size:14,"aria-hidden":!0}),l("terminalPanel.workerStopped",{name:t.label})]}),c.jsxs("button",{type:"button",onClick:()=>o(t.workerId),disabled:f,className:"icon-btn icon-btn--primary","data-testid":"terminal-panel-start-worker",children:[f?c.jsx(Ja,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(Po,{size:12,"aria-hidden":!0}),l(f?"common.starting":"common.start")]})]})}return c.jsx("div",{id:`worker-pty-${t.runId}`,className:u,"data-pty-slot":"worker","data-testid":`terminal-panel-slot-worker-${t.workerId}`})}return c.jsx("div",{id:`shell-pty-${t.runId}`,className:u,"data-pty-slot":"shell","data-testid":`terminal-panel-slot-shell-${t.runId}`})},Nf=t=>`hive.terminal-panel.tabs.${t}`,jf=t=>`hive.terminal-panel.active.${t}`,v_=t=>`worker:${t}`,y_=t=>`shell:${t}`,Gy=t=>{try{const a=window.localStorage.getItem(t);if(!a)return[];const o=JSON.parse(a);return Array.isArray(o)?o.filter(s=>typeof s=="string"):[]}catch{return[]}},Xy=t=>{try{return window.localStorage.getItem(t)??""}catch{return""}},Zy=(t,a)=>{try{window.localStorage.setItem(t,a)}catch{}},b_=({workspaceId:t,workers:a,terminalRuns:o})=>{const[s,l]=y.useState(()=>Gy(Nf(t))),[u,f]=y.useState(()=>{const N=Xy(jf(t));return N.length>0?N:null}),m=y.useRef(s);m.current=s;const g=y.useRef(t);y.useEffect(()=>{if(g.current===t)return;g.current=t,l(Gy(Nf(t)));const N=Xy(jf(t));f(N.length>0?N:null)},[t]);const p=y.useRef(!1);y.useEffect(()=>{p.current=a.length>0||o.length>0},[t]),y.useEffect(()=>{(a.length>0||o.length>0)&&(p.current=!0)},[a,o]),y.useEffect(()=>{p.current&&Zy(Nf(t),JSON.stringify(s))},[s,t]),y.useEffect(()=>{p.current&&Zy(jf(t),u??"")},[u,t]);const b=y.useMemo(()=>new Map(a.map(N=>[N.id,N])),[a]),{runByAgentId:v,shellRunById:k}=y.useMemo(()=>{const N=new Map,j=new Map;for(const A of o)N.set(A.agent_id,A),ti(A,t)&&j.set(A.run_id,A);return{runByAgentId:N,shellRunById:j}},[o,t]),E=y.useMemo(()=>{const N=[];for(const j of s)if(j.startsWith("worker:")){const A=j.slice(7),O=b.get(A);if(!O)continue;const D=v.get(O.id);N.push({id:j,kind:"worker",workerId:A,runId:D?.run_id??null,label:O.name})}else if(j.startsWith("shell:")){const A=j.slice(6),O=k.get(A);if(!O)continue;N.push({id:j,kind:"shell",runId:A,label:O.agent_name})}return N},[s,b,v,k]);y.useEffect(()=>{p.current&&l(N=>{const j=N.filter(A=>A.startsWith("worker:")?b.has(A.slice(7)):A.startsWith("shell:")?k.has(A.slice(6)):!1);return j.length===N.length?N:j})},[b,k]),y.useEffect(()=>{p.current&&(u&&E.some(N=>N.id===u)||f(E[0]?.id??null))},[u,E]);const S=y.useCallback(N=>{p.current=!0;const j=v_(N);l(A=>A.includes(j)?A:[...A,j]),f(j)},[]),w=y.useCallback(N=>{p.current=!0;const j=y_(N);l(A=>A.includes(j)?A:[...A,j]),f(j)},[]),C=y.useCallback(N=>{const j=m.current,A=j.filter(O=>O!==N);A.length!==j.length&&(l(A),f(O=>{if(O!==N)return O;const D=j.indexOf(N);return A[D]??A[D-1]??A[0]??null}))},[]),T=y.useCallback(N=>f(N),[]);return{tabs:E,activeId:u,openWorkerTab:S,openShellTab:w,closeTab:C,setActive:T}},Qy=500,w_=2500,x_=5e3,k_=t=>t.status==="starting",S_=(t,a)=>t>0?Math.min(Qy*2**t,x_):a.some(k_)?Qy:w_,Qm=t=>`${t}:orchestrator`,E_=(t,a)=>t.length!==a.length?!1:t.every((o,s)=>{const l=a[s];return l!==void 0&&o.agent_id===l.agent_id&&o.agent_name===l.agent_name&&o.run_id===l.run_id&&o.status===l.status&&o.terminal_input_profile===l.terminal_input_profile}),C_=t=>{const[a,o]=y.useState([]);return y.useEffect(()=>{if(!t){o([]);return}let s=!1,l=0,u=!1,f=[],m;const g=()=>{s||(m=window.setTimeout(p,S_(l,f)))},p=()=>{u||(u=!0,wN(t).then(b=>{s||(l=0,f=b,o(v=>E_(v,b)?v:b))}).catch(b=>{s||(l=Math.min(l+1,4),o(v=>v.length===0?v:[])),console.error("[hive] swallowed:terminalRuns.list",b)}).finally(()=>{u=!1,g()}))};return p(),()=>{s=!0,m!==void 0&&window.clearTimeout(m)}},[t]),a},T_=(t,a)=>t.find(o=>o.agent_id===Qm(a)),N_=(t,a)=>t.find(o=>o.agent_id===a),j_=({onCloseFailed:t,onShellRunClosed:a,onShellRunStarted:o,panelTabs:s,shellRuns:l,workspaceId:u})=>{const[f,m]=y.useState(null),[g,p]=y.useState(null),[b,v]=y.useState(!1),k=y.useRef(new Map),E=y.useRef(0),S=y.useRef(new Map),w=y.useRef(new Map),C=y.useRef(new Set),T=y.useRef(u),j=(l.find(F=>F.run_id===g)??l[0]??null)?.run_id??null,A=y.useCallback((F,ne)=>{const Z=S.current.get(F)??new Set;Z.add(ne),S.current.set(F,Z)},[]),O=y.useCallback((F,ne,Z)=>{const q=w.current.get(F)??new Map;q.set(ne,Z),w.current.set(F,q),Z.finally(()=>{const M=w.current.get(F);M&&(M.delete(ne),M.size===0&&w.current.delete(F))}).catch(()=>{})},[]),D=y.useCallback((F,ne)=>{const Z=S.current.get(F);Z&&(Z.delete(ne),Z.size===0&&S.current.delete(F))},[]);y.useLayoutEffect(()=>{T.current=u},[u]),y.useEffect(()=>()=>{S.current.clear(),w.current.clear(),C.current.clear()},[]),y.useEffect(()=>{m(null),p(null),v(!1)},[u]),y.useEffect(()=>{if(!u)return;const F=S.current.get(u);if(!F)return;const ne=new Set(l.map(q=>q.run_id)),Z=w.current.get(u);for(const q of Array.from(F))Z?.has(q)||ne.has(q)||D(u,q)},[l,D,u]);const L=()=>{if(!u||k.current.has(u))return;const F=u,ne=E.current+1;E.current=ne,k.current.set(F,ne);const Z=()=>T.current===F,q=()=>k.current.get(F)===ne;m(null),v(!0),hN(F).then(M=>{o?.(F,M),Z()&&(p(M.run_id),s.openShellTab(M.run_id))}).catch(M=>{Z()&&m(M instanceof Error?M.message:String(M))}).finally(()=>{q()&&k.current.delete(F),Z()&&v(!1)})},P=()=>{if(!u||k.current.has(u)||C.current.has(u))return;const F=u,ne=Array.from(w.current.get(F)?.values()??[]);if(ne.length===0){L();return}C.current.add(F),m(null),v(!0),Promise.allSettled(ne).then(Z=>{Z.some(q=>q.status==="rejected")||T.current===F&&(k.current.has(F)||L())}).finally(()=>{C.current.delete(F),T.current===F&&!k.current.has(F)&&v(!1)})};return{closeShellTab:F=>{if(!u)return;const ne=l.find(q=>q.run_id!==F)??null;j===F&&p(ne?.run_id??null),a?.(u,F),A(u,F);const Z=gN(u,F).catch(q=>{throw D(u,F),t(q instanceof Error?q.message:String(q)),q});O(u,F,Z),Z.catch(()=>{})},openShell:()=>{if(!u||k.current.has(u)||b)return;const F=s.tabs.find(q=>q.kind==="shell");if(F){s.setActive(F.id);return}const ne=S.current.get(u)??new Set,Z=l.find(q=>!ne.has(q.run_id));if(Z){p(Z.run_id),s.openShellTab(Z.run_id);return}if(ne.size>0){P();return}L()},shellError:f,shellStarting:b,startNewShell:()=>{if(!u||k.current.has(u)||b)return;if((S.current.get(u)??new Set).size>0){P();return}L()}}},ix="hive.split.orch-pct",Ks=.3,Ys=.78,$l=.6,Jy=.02,Vl=(t,a,o)=>Math.min(o,Math.max(a,t)),A_=()=>{try{const t=localStorage.getItem(ix);if(!t)return $l;const a=Number.parseFloat(t);return Number.isFinite(a)?Vl(a,Ks,Ys):$l}catch{return $l}},__=()=>{const t=y.useRef(null),[a,o]=y.useState(()=>A_()),[s,l]=y.useState(!1);y.useEffect(()=>{try{localStorage.setItem(ix,a.toFixed(4))}catch{}},[a]);const u=y.useCallback(m=>{m.preventDefault();const g=t.current;if(!g)return;l(!0);const p=document.body.style.userSelect,b=document.body.style.cursor;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const v=E=>{const S=g.getBoundingClientRect();if(S.width<=0)return;const w=(E.clientX-S.left)/S.width;o(Vl(w,Ks,Ys))},k=()=>{l(!1),document.body.style.userSelect=p,document.body.style.cursor=b,document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k)};document.addEventListener("pointermove",v),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k)},[]),f=y.useCallback(m=>{m.key==="ArrowLeft"?(m.preventDefault(),o(g=>Vl(g-Jy,Ks,Ys))):m.key==="ArrowRight"?(m.preventDefault(),o(g=>Vl(g+Jy,Ks,Ys))):m.key==="Home"?(m.preventDefault(),o(Ks)):m.key==="End"?(m.preventDefault(),o(Ys)):m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),o($l))},[]);return{containerRef:t,orchPct:a,dragging:s,beginDrag:u,onKeyDown:f}},mi=({title:t,description:a,icon:o,action:s})=>c.jsxs("div",{className:"m-auto flex max-w-[380px] flex-col items-center gap-3 px-6 py-8 text-center","data-testid":"empty-state",children:[o?c.jsx("div",{"data-testid":"empty-state-icon","aria-hidden":!0,className:"flex h-12 w-12 items-center justify-center rounded text-sec",style:{background:"var(--bg-2)",border:"1px solid var(--border-bright)"},children:o}):null,c.jsx("div",{className:"text-lg font-semibold text-pri","data-testid":"empty-state-title",children:t}),c.jsx("div",{className:"text-sm text-ter","data-testid":"empty-state-description",children:a}),s]}),Va=t=>a=>{console.error(`[hive] swallowed:${t}`,a)},R_={agy:{command:"curl -fsSL https://antigravity.google/cli/install.sh | bash",docsUrl:"https://antigravity.google/docs/cli-getting-started"},claude:{command:"npm install -g @anthropic-ai/claude-code",docsUrl:"https://github.com/anthropics/claude-code"},codex:{command:"npm install -g @openai/codex",docsUrl:"https://github.com/openai/codex"},cursor:{command:"curl https://cursor.com/install -fsS | bash",docsUrl:"https://cursor.com/docs/cli/installation"},gemini:{command:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli"},grok:{command:"curl -fsSL https://x.ai/cli/install.sh | bash",docsUrl:"https://x.ai/cli"},hermes:{command:"curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",docsUrl:"https://github.com/NousResearch/hermes-agent"},opencode:{command:"npm install -g opencode-ai",docsUrl:"https://opencode.ai/docs"},qwen:{command:"npm install -g @qwen-code/qwen-code@latest",docsUrl:"https://github.com/QwenLM/qwen-code"}},O_=t=>R_[t]??null,D_=({presetId:t,presetName:a})=>{const{t:o}=be(),s=O_(t),[l,u]=y.useState(!1),[f,m]=y.useState(!1),g=y.useRef(null);y.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const p=()=>{s&&fw(s.command).then(()=>{u(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{u(!1),g.current=null},1500)}).catch(Va("cli-install-copy"))};return c.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border p-3",style:{background:"var(--bg-2)",borderColor:"var(--border)"},"data-testid":"cli-install-guidance",children:[s?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-xs text-sec",children:o("workspace.preset.installHint",{name:a})}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("code",{className:"mono min-w-0 flex-1 truncate rounded border px-2 py-1.5 text-xs text-pri",style:{background:"var(--bg-1)",borderColor:"var(--border)"},title:s.command,children:s.command}),c.jsxs("button",{type:"button",onClick:p,className:"icon-btn shrink-0 inline-flex items-center gap-1.5","aria-label":o("workspace.preset.installCopyAria"),"data-testid":"cli-install-copy",children:[l?c.jsx(ga,{size:13,"aria-hidden":!0}):c.jsx(Dr,{size:13,"aria-hidden":!0}),c.jsx("span",{className:"text-xs",children:o(l?"common.copied":"workspace.preset.installCopy")})]})]}),c.jsxs("a",{href:s.docsUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 self-start text-xs text-sec underline hover:text-pri","data-testid":"cli-install-docs",children:[c.jsx(_m,{size:11,"aria-hidden":!0}),o("workspace.preset.installDocs")]})]}):null,c.jsxs("button",{type:"button",onClick:()=>m(b=>!b),"aria-expanded":f,className:"flex items-center gap-1 text-left text-xs text-sec hover:text-pri cursor-pointer","data-testid":"cli-install-path-help-toggle",children:[f?c.jsx(qo,{size:12,"aria-hidden":!0}):c.jsx(wc,{size:12,"aria-hidden":!0}),o("workspace.preset.pathHelpTitle")]}),f?c.jsx("p",{className:"text-xs leading-relaxed text-ter","data-testid":"cli-install-path-help-body",children:o("workspace.preset.pathHelpBody")}):null]})},M_={"cursor-agent":"cursor"},L_=/^(\S+) CLI not found in PATH/u,z_=()=>{const{t}=be();return c.jsx("div",{"data-testid":"orchestrator-starting-body",className:"flex flex-1",children:c.jsx(mi,{icon:c.jsx(Ja,{size:24,className:"animate-spin"}),title:t("orchestrator.startingTitle"),description:t("orchestrator.startingDesc")})})},H_=({onStart:t})=>{const{t:a}=be();return c.jsx("div",{"data-testid":"orchestrator-stopped-body",className:"flex flex-1",children:c.jsx(mi,{icon:c.jsx(Am,{size:24}),title:a("orchestrator.stoppedTitle"),description:a("orchestrator.stoppedDesc"),action:c.jsxs("button",{type:"button",onClick:t,className:"icon-btn icon-btn--primary","data-testid":"orchestrator-start",children:[c.jsx(Po,{size:12,"aria-hidden":!0})," ",a("orchestrator.start")]})})})},U_=({error:t,onRemoveWorkspace:a,onRestart:o})=>{const{t:s}=be(),[l,u]=y.useState(!1),f=()=>{navigator.clipboard?.writeText(t).then(()=>{u(!0),window.setTimeout(()=>u(!1),1500)}).catch(()=>{})},m=L_.exec(t)?.[1];return c.jsxs("div",{"data-testid":"orchestrator-failed-body",className:"m-auto flex max-w-[480px] flex-col items-center gap-3 px-6 py-8",children:[c.jsx("div",{"aria-hidden":!0,className:"flex h-12 w-12 items-center justify-center rounded text-sec",style:{background:"var(--bg-2)",border:"1px solid var(--border-bright)"},children:c.jsx(Am,{size:24})}),c.jsx("div",{className:"text-lg font-semibold text-pri",children:s("orchestrator.failed")}),c.jsxs("div",{className:"relative w-full",children:[c.jsx("pre",{"data-testid":"orchestrator-error-message",className:"mono w-full max-h-40 overflow-auto whitespace-pre-wrap break-all rounded p-3 text-left text-xs",style:{background:"color-mix(in oklab, var(--status-red) 8%, var(--bg-2))",border:"1px solid color-mix(in oklab, var(--status-red) 24%, transparent)",color:"var(--text-secondary)"},children:t}),c.jsx(Je,{label:s(l?"common.copied":"common.copyError"),children:c.jsx("button",{type:"button",onClick:f,"aria-label":s("orchestrator.copyErrorAria"),className:"icon-btn icon-btn--ghost absolute right-1 top-1 h-6 px-1.5","data-testid":"orchestrator-copy-error",children:c.jsx(Dr,{size:12,"aria-hidden":!0})})})]}),m?c.jsx("div",{className:"w-full",children:c.jsx(D_,{presetId:M_[m]??m,presetName:m})}):null,c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("button",{type:"button",onClick:o,className:"icon-btn icon-btn--primary","data-testid":"orchestrator-retry",children:[c.jsx(xc,{size:12,"aria-hidden":!0})," ",s("common.retry")]}),c.jsx("button",{type:"button",onClick:a,className:"icon-btn icon-btn--danger","data-testid":"orchestrator-remove-workspace",children:s("orchestrator.removeWorkspace")})]}),c.jsx("span",{"data-testid":"orchestrator-retry-header",className:"sr-only",children:s("common.retry")})]})},B_=({state:t,onRemoveWorkspace:a,onRestart:o,onStart:s})=>{const{t:l}=be(),u=yt();return c.jsx("div",{className:"orchestrator-pane-root relative flex h-full w-full min-w-0 flex-col",style:{background:"var(--bg-crust)",...u?{}:{borderRight:"1px solid var(--border)"}},"data-testid":"orchestrator-terminal-slot",children:t.kind==="running"?c.jsx("div",{id:`orch-pty-${t.runId}`,className:"orchestrator-pty-slot relative flex h-full w-full","data-pty-slot":"orchestrator","data-terminal-auto-focus":"true",children:u?c.jsx("div",{className:"orchestrator-pty-placeholder pointer-events-none absolute inset-0 flex items-center justify-center px-4 text-center","data-testid":"orchestrator-running-placeholder",children:c.jsx("div",{className:"mono text-xs text-ter",children:l("terminal.statusConnecting")})}):null}):t.kind==="failed"?c.jsx(U_,{error:t.error,onRemoveWorkspace:a,onRestart:o}):t.kind==="stopped"?c.jsx(H_,{onStart:s}):c.jsx(z_,{})})},W_=({workspaceId:t,terminalRuns:a,autostartError:o,onClearAutostartError:s,onAfterStart:l,onRunClosed:u})=>{const f=T_(a,t),m=Qm(t),[g,p]=y.useState(null);y.useEffect(()=>{f&&p(null)},[f]);let b;f?b={hasUserInputSinceStart:f.has_user_input_since_start===!0,kind:"running",runId:f.run_id,startupBlockedReason:f.startup_blocked_reason??null}:g===t?b={kind:"starting"}:o?b={kind:"failed",error:o}:b={kind:"stopped"};const v=y.useCallback(()=>{!t||g===t||f||(s(),p(t),ei(t,m).then(S=>{l?.({ok:!0,error:null,run_id:S.runId})}).catch(S=>{const w=S instanceof Error?S.message:"Failed to start Queen";l?.({ok:!1,error:w,run_id:null})}).finally(()=>p(S=>S===t?null:S)))},[m,l,s,f,g,t]),k=y.useCallback(()=>{f&&nc(f.run_id).then(()=>{u?.(t,f.run_id)}).catch(S=>{console.error("[hive] swallowed:orchestrator.stop",S)})},[u,f,t]),E=y.useCallback(()=>{if(s(),f){nc(f.run_id).catch(S=>{console.error("[hive] swallowed:orchestrator.restart.stop",S)}).then(()=>ei(t,m)).then(S=>{u?.(t,f.run_id),l?.({ok:!0,error:null,run_id:S.runId})}).catch(S=>{const w=S instanceof Error?S.message:"Failed to restart Queen";l?.({ok:!1,error:w,run_id:null})});return}v()},[m,l,s,u,f,v,t]);return{state:b,start:v,stop:k,restart:E}},lx=["ada-lovelace","archimedes","babbage","bell","da-vinci","edison","eiffel","euclid","euler","fermat","fibonacci","gutenberg","leibniz","marconi","morse","nobel","pascal","pythagoras","tesla","turing","watt","wright-brothers"],cx=["adam-smith","aquinas","aristotle","augustine","bacon","calvin","cicero","democritus","descartes","epicurus","hegel","herodotus","hobbes","hume","kant","kierkegaard","locke","luther","machiavelli","marcus-aurelius","montesquieu","nietzsche","plato","rousseau","seneca","socrates","spinoza","voltaire"],ux=["amundsen","boyle","cook","copernicus","curie","da-gama","darwin","drake","faraday","fleming","galileo","halley","hippocrates","kepler","magellan","marco-polo","mendel","mendeleev","newton","pasteur","planck","ptolemy","rutherford","volta"],I_=["alexander","augustus","austen","bach","beethoven","brahms","byron","caesar","cervantes","charlemagne","chopin","cleopatra","dante","dickens","dostoevsky","dumas","einstein","elizabeth-i","franklin","goethe","goya","handel","hannibal","henry-viii","homer","hugo","jefferson","joan-of-arc","keats","leonidas","lincoln","liszt","louis-xiv","michelangelo","milton","monet","mozart","napoleon","nightingale","orwell","picasso","poe","raphael","rembrandt","schubert","shakespeare","sophocles","tchaikovsky","titian","tolstoy","twain","van-gogh","velazquez","verdi","vermeer","virgil","vivaldi","wagner","washington","whitman","wilde","woolf","wordsworth"],dx=["八大山人","毕昇","蔡伦","干将","顾恺之","黄道婆","李冰","柳公权","鲁班","莫邪","墨子","沈括","宋应星","唐寅","王羲之","文徵明","吴道子","颜真卿","张衡","张择端","郑板桥","祖冲之"],fx=["班固","包拯","狄仁杰","董仲舒","范仲淹","顾炎武","管仲","海瑞","韩非","韩愈","嵇康","贾谊","孔子","老子","林则徐","柳宗元","孟子","欧阳修","商鞅","司马光","司马迁","谭嗣同","王安石","王守仁","魏徵","荀子","张居正","周敦颐","朱熹","庄子"],mx=["班超","扁鹊","法显","葛洪","华佗","鉴真","郦道元","李时珍","神农","苏武","孙思邈","陶弘景","徐光启","徐霞客","玄奘","张骞","张仲景","郑和"],q_=["白居易","蔡文姬","曹操","曹雪芹","曹植","程咬金","大禹","杜甫","杜牧","范蠡","关羽","汉武帝","韩信","忽必烈","花木兰","黄帝","霍去病","姜子牙","康熙","李白","李广","李靖","李清照","李煜","刘邦","刘备","刘伯温","柳永","陆游","罗贯中","吕布","吕不韦","孟浩然","蒙恬","努尔哈赤","庞统","蒲松龄","戚继光","乾隆","秦始皇","屈原","上官婉儿","施耐庵","司马懿","苏轼","孙膑","孙权","孙武","孙中山","唐太宗","唐玄宗","陶渊明","王维","卫青","文天祥","吴承恩","吴起","萧何","谢安","辛弃疾","杨贵妃","雍正","虞姬","岳飞","张飞","张良","张仪","赵子龙","周瑜","朱棣","诸葛亮","朱元璋","左宗棠"],P_=[...lx,...cx,...ux,...I_],F_=[...dx,...fx,...mx,...q_],K_={en:{coder:lx,reviewer:cx,tester:ux,custom:P_},zh:{coder:dx,reviewer:fx,tester:mx,custom:F_}},Y_=()=>{const t=new Uint32Array(1);return globalThis.crypto.getRandomValues(t),t[0]??0},Af=({language:t="en",role:a="coder",usedNames:o,nextUint32:s=Y_}={})=>{const l=K_[t][a],u=o&&o.size>0?l.filter(m=>!o.has(m)):l,f=u.length>0?u:l;return f[s()%f.length]},Gs={en:{coder:["You are a Coder. Turn clearly scoped tasks into the smallest correct code change.","Working style:","- Read the relevant files and local patterns before editing.","- Prefer small changes; avoid unrelated refactors and scope creep.","- Run validation that covers the risk. If you cannot validate, explain why.","Report changed files, verification, remaining risk, and blockers."].join(`
56
56
  `),custom:["You are a custom team member. Rewrite this into the member's operating contract.","Recommended shape:","- Goal: what this member owns.","- Boundaries: what to do and what to avoid.","- Working style: how to inspect, edit, verify, or review.","- Done means: what results, risks, and blockers to report."].join(`
57
57
  `),reviewer:["You are a Reviewer. Focus on quality review; do not replace the Orchestrator or edit by default.","Working style:","- Prioritize real bugs, regressions, edge cases, and test gaps.","- For each issue, include severity, file/line, trigger condition, and minimal fix.","- If no high-risk issue exists, state residual risk and unverified scope.","Report blocking issues first, ordered by severity."].join(`
58
- `),sentinel:["You are a Sentinel: a read-only patrol observer. You never execute tasks or modify anything.","Working style:","- The runtime periodically injects a workspace snapshot (worker states, open dispatches, possible orphans).","- Cross-check it against your own observations; surface only what deserves a human glance.","- A long-quiet dispatch is not necessarily stuck — big tasks are slow by nature.","Hard boundaries:","- Observe only: no file edits, no side-effecting commands, no dispatching.",'- You take no dispatches and have no `team report`; report findings via `team status "<finding>"`.',"- When nothing is unusual, stay quiet."].join(`
59
58
  `),tester:["You are a Tester. Reproduce, test, and produce concrete verification evidence.","Working style:","- Clarify the behavior, entry point, and failure condition under test.","- Prefer real commands or real paths. Add a minimal test when useful.","- Record commands, results, key output, and uncovered scenarios.","Report pass/fail/unverified separately, then suggest the next step."].join(`
60
59
  `)},zh:{coder:["你是实现型 Coder,负责把明确任务落成最小正确代码改动。","工作方式:","- 先阅读相关文件和现有模式,再动手。","- 优先小步修改,避免无关重构和范围扩张。","- 改动后运行能覆盖风险的验证命令;不能验证时说明原因。","交付说明要包含:改动文件、验证结果、剩余风险或阻塞。"].join(`
61
60
  `),custom:["你是自定义成员。请把这段改成该成员的行为契约。","建议包含:","- 目标:这个成员主要负责什么。","- 边界:哪些事可以做,哪些事不要做。","- 工作方式:如何调查、修改、验证或审查。","- 完成标准:交付时需要说明哪些结果、风险和阻塞。"].join(`
62
61
  `),reviewer:["你是监工型 Reviewer,负责质量审查,不替代 Orchestrator,也不默认改代码。","工作方式:","- 优先找真实 bug、回归风险、边界条件和测试缺口。","- 发现问题时给出严重度、文件/行号、触发条件和最小修复建议。","- 没有高风险问题时明确说清剩余风险和未验证范围。","交付说明按严重度排序,先列 blocking 问题。"].join(`
63
- `),sentinel:["你是只读巡检型 Sentinel,负责观察团队运行状态,不执行任务、不修改任何东西。","工作方式:","- 系统会定期向你注入工作区快照(成员状态、未关闭派单、疑似孤儿单)。",'- 把快照与你自己的观察对照,只把"值得人看一眼"的事项报上去。',"- 长时间无汇报不等于卡死——正常的大任务本来就慢。","硬性边界:","- 只观察:不改文件、不跑有副作用的命令、不派活。",'- 你不接派单,也没有 `team report`;发现统一用 `team status "<巡检发现>"` 汇报。',"- 没有异常时保持安静。"].join(`
64
62
  `),tester:["你是验证型 Tester,负责复现、测试和证据化验证。","工作方式:","- 先明确要验证的行为、入口和失败条件。","- 优先跑真实命令或真实链路;必要时补充最小测试。","- 记录命令、结果、关键输出和不能覆盖的场景。","交付说明要区分通过、失败、未验证和建议下一步。"].join(`
65
- `)}},_f=(t,a,o)=>t==="custom"?a.find(s=>s.roleType==="custom"&&s.isBuiltin)?.description??Gs[o].custom:Gs[o][t],Z_=({createWorker:t,open:a,workers:o})=>{const{language:s}=be(),[l,u]=y.useState(""),[f,m]=y.useState("coder"),[g,p]=y.useState([]),[b,v]=y.useState(null),[k,E]=y.useState(!1),[S,w]=y.useState(null),[C,T]=y.useState(Gs[s].coder),[N,j]=y.useState([]),[A,O]=y.useState("claude"),[D,L]=y.useState(null),[P,J]=y.useState(""),[Q,$]=y.useState(null),[F,ne]=y.useState(!1),Z=y.useRef(!1),q=y.useRef(!1),M=y.useRef(!1),U=_f(f,g,s),W=y.useMemo(()=>g.filter(he=>!he.isBuiltin),[g]);y.useEffect(()=>{if(!a)return;let he=!1;return hN().then(we=>{he||(j(we),O(Ce=>we.some(Ae=>Ae.id===Ce&&Ae.available)?Ce:we.find(Ae=>Ae.id==="claude"&&Ae.available)?.id??we.find(Ae=>Ae.available)?.id??we[0]?.id??""))}).catch(we=>{he||$(we instanceof Error?we.message:String(we))}),()=>{he=!0}},[a]),y.useEffect(()=>{if(!a)return;let he=!1;return bN().then(we=>{he||p(we)}).catch(we=>{he||$(we instanceof Error?we.message:String(we))}),()=>{he=!0}},[a]),y.useEffect(()=>{b===null&&(q.current||T(_f(f,g,s)))},[s,g,f,b]);const G=he=>{q.current=!0,T(he)},V=he=>{Z.current=!1,u(he)},R=y.useMemo(()=>new Set(o.map(he=>he.name)),[o]),B=y.useRef(R);B.current=R;const se=()=>{Z.current=!0,u(Af({language:s,role:f,usedNames:R}))};y.useEffect(()=>{const he=a&&!M.current;if(M.current=a,!!a){if(he){Z.current=!0,u(Af({language:s,role:f,usedNames:B.current}));return}Z.current&&u(Af({language:s,role:f,usedNames:B.current}))}},[a,s,f]);const re=he=>{m(he),v(null),q.current=!1,T(_f(he,g,s))};return{avatar:D,commandPresets:N,commandPresetId:A,createWorkerError:Q,creating:F,customTemplates:W,roleDescription:C,roleDescriptionDefault:U,selectedTemplateId:b,startupCommand:P,templateBusy:k,templateError:S,workerName:l,workerRole:f,setCommandPresetId:he=>{O(he)},setAvatar:L,setRoleDescription:G,setStartupCommand:J,setWorkerName:V,setWorkerRole:re,selectTemplate:he=>{if(he===null){m("custom"),v(null),q.current=!1,T(Gs[s].custom);return}const we=g.find(Ce=>Ce.id===he);!we||we.isBuiltin||(m("custom"),v(he),q.current=!1,T(we.description))},saveAsTemplate:async he=>{const we=he.trim(),Ce=C.trim();if(!(!we||!Ce)){E(!0),w(null);try{const Ae=await wN({name:we,roleType:"custom",description:Ce});p(pt=>[...pt,Ae]),v(Ae.id),m("custom"),q.current=!1,T(Ae.description)}catch(Ae){throw w(Ae instanceof Error?Ae.message:String(Ae)),Ae}finally{E(!1)}}},deleteTemplate:async he=>{const we=g.find(Ce=>Ce.id===he);if(!(!we||we.isBuiltin)){E(!0),w(null);try{await xN(he),p(Ce=>Ce.filter(Ae=>Ae.id!==he)),b===he&&(v(null),q.current=!1,T(Gs[s].custom))}catch(Ce){throw w(Ce instanceof Error?Ce.message:String(Ce)),Ce}finally{E(!1)}}},randomizeWorkerName:se,resetRoleDescription:()=>{q.current=!1,T(U)},resetError:()=>$(null),applyMarketplaceImport:({name:he,description:we})=>{Z.current=!1,u(he),v(null),m("custom"),q.current=!0,T(we)},submit:(he,we)=>{he.preventDefault(),ne(!0),$(null),t({avatar:D,commandPresetId:A,name:l,role:f,roleDescription:C,startupCommand:P}).then(({error:Ce})=>{u(""),Z.current=!1,re("coder"),v(null),O("claude"),L(null),J(""),we(),Ce&&$(Ce)}).catch(Ce=>{$(Ce instanceof Error?Ce.message:String(Ce))}).finally(()=>ne(!1))}}},Q_=[{icon:c.jsx(l0,{size:16}),titleKey:"welcome.step1Title",descriptionKey:"welcome.step1Desc"},{icon:c.jsx(Ec,{size:16}),titleKey:"welcome.step2Title",descriptionKey:"welcome.step2Desc"},{icon:c.jsx(zE,{size:16}),titleKey:"welcome.step3Title",descriptionKey:"welcome.step3Desc"}],J_=({onAddWorkspace:t,onTryDemo:a,heroImageSrc:o,disabledReason:s})=>{const{t:l}=be(),u=!!s;return c.jsxs("div",{"data-testid":"welcome-pane",className:"m-auto flex w-full flex-col items-center gap-6 px-6 py-12 text-center",style:{maxWidth:"540px"},children:[o?c.jsx("img",{src:o,alt:"",className:"h-24 w-24","aria-hidden":!0}):null,c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-2xl font-semibold text-pri",children:l("welcome.title")}),c.jsx("div",{className:"text-sm text-sec",children:l("welcome.desc")})]}),c.jsx("ol",{className:"grid w-full grid-cols-1 gap-3 text-left md:grid-cols-3",children:Q_.map((f,m)=>c.jsxs("li",{className:"rounded border bg-1 p-3",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"mb-1 flex items-center gap-2 text-pri",children:[c.jsx("span",{className:"font-medium text-xs text-ter",children:m+1}),f.icon]}),c.jsx("div",{className:"text-xs font-medium text-pri",children:l(f.titleKey)}),c.jsx("div",{className:"mt-1 text-xs text-ter",children:l(f.descriptionKey)})]},f.titleKey))}),u?c.jsxs("div",{role:"alert","data-testid":"welcome-pane-disabled-reason",className:"flex items-start gap-2 rounded px-3 py-2 text-left text-xs",style:{background:"color-mix(in oklab, var(--status-red) 10%, transparent)",border:"1px solid color-mix(in oklab, var(--status-red) 28%, transparent)",color:"var(--status-red)"},children:[c.jsx(Js,{size:14,className:"mt-0.5 shrink-0","aria-hidden":!0}),c.jsx("span",{className:"break-words",children:s})]}):null,c.jsxs("button",{type:"button",disabled:u,onClick:u?void 0:t,"aria-disabled":u||void 0,title:s,className:"icon-btn icon-btn--primary inline-flex items-center gap-2 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"welcome-pane-add",children:[c.jsx("span",{children:l("welcome.addWorkspace")}),c.jsx(CS,{size:14,"aria-hidden":!0})]}),a?c.jsx("button",{type:"button",onClick:a,className:"text-xs text-sec underline hover:text-pri",children:l("welcome.demo")}):null]})},Rf=t=>t==="danger"?"var(--status-red)":"var(--accent)",pi=({open:t,onOpenChange:a,title:o,description:s,confirmLabel:l,confirmKind:u="default",cancelLabel:f,onConfirm:m})=>{const{t:g}=be(),p=f??g("common.cancel");return c.jsx(Mr,{open:t,onOpenChange:a,children:c.jsxs(Lr,{children:[c.jsx(zr,{"data-testid":"confirm-overlay",className:"app-overlay fixed inset-0 z-[60]"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-[70] grid place-items-center p-4",children:c.jsxs(Hr,{"data-testid":"confirm-content",className:"dialog-scale-pop elev-2 pointer-events-auto w-[440px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{"aria-hidden":!0,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:`color-mix(in oklab, ${Rf(u)} 14%, transparent)`,color:Rf(u),border:`1px solid color-mix(in oklab, ${Rf(u)} 30%, transparent)`},children:u==="danger"?c.jsx(Js,{size:18}):c.jsx(FS,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(Ur,{"data-testid":"confirm-title",className:"text-lg font-semibold text-pri",children:o}),c.jsx(Ko,{"data-testid":"confirm-description",className:"mt-1.5 text-sm text-sec",children:s})]})]}),c.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[c.jsx("button",{type:"button","data-testid":"confirm-cancel",onClick:()=>a(!1),autoFocus:u==="danger",className:"icon-btn",children:p}),c.jsx("button",{type:"button","data-testid":"confirm-action",onClick:()=>{m(),a(!1)},autoFocus:u!=="danger",className:u==="danger"?"icon-btn icon-btn--danger-solid":"icon-btn icon-btn--primary",children:l})]})]})})]})})},eR=["You are a Researcher. Collect facts, data, and sources for the assigned topic.","How to work:","- Break the topic into key questions first, then investigate each one.","- Prefer primary sources and real project files; attach a source or file path to every conclusion.","- Separate facts, inferences, and unknowns; never present guesses as facts.","Delivery: include findings by topic, source list, and unresolved questions."].join(`
66
- `),tR=["你是 Researcher,负责为指定主题收集事实、数据和来源。","工作方式:","- 先拆出要回答的关键问题,再逐项调查。","- 优先一手来源和项目内真实文件;每个结论都附上来源或文件路径。","- 区分事实、推断和未知,不把猜测写成结论。","交付说明:按主题列出发现、来源清单和未解决问题。"].join(`
67
- `),nR=["You are a Fact-checker. Verify research claims and evidence strength without expanding the scope by default.","How to work:","- Check every claim against its source and mark supported, uncertain, or unsupported.","- Cross-check critical claims with a second source, command, or direct file read.","- When a claim is wrong, provide the corrected wording and evidence.","Delivery: group by confidence and list refuted or uncertain claims first."].join(`
68
- `),aR=["你是 Fact-checker,负责验证研究结论和证据强度,默认不扩范围。","工作方式:","- 逐条核对结论与其来源,标注支持、存疑或不支持。","- 对关键结论用第二来源、命令或直接读文件做交叉验证。","- 发现错误时给出纠正后的表述和依据。","交付说明:按可信度分组,先列被推翻或存疑的结论。"].join(`
69
- `),rR=["You are a Drafter. Turn goals and source material into a clear first-draft document.","How to work:","- Confirm audience, purpose, and scope before outlining and writing.","- Use real project code and files as the source of truth; do not invent behavior or APIs.","- Mark missing material and points that need confirmation.","Delivery: include document path, structure overview, and confirmation checklist."].join(`
70
- `),oR=["你是 Drafter,负责把目标和素材写成清晰的第一版文档。","工作方式:","- 先确认读者、目的和范围,再列提纲,后成文。","- 以项目内真实代码和文件为准,不编造行为或接口。","- 标注待确认和缺素材的位置。","交付说明:包含文档路径、结构概览和确认清单。"].join(`
71
- `),sR=["You are a Document Reviewer. Check a draft for accuracy and readability; do not rewrite the whole document by default.","How to work:","- Verify technical details against real code and files first.","- Check structure, terminology consistency, and whether readers can follow the document.","- List issues by severity with concrete edits or rewrite examples.","Delivery: list factual errors first, then structure and wording issues."].join(`
72
- `),iR=["你是 Document Reviewer,负责检查草稿的准确性和可读性;默认不要整篇重写。","工作方式:","- 先对照项目真实代码和文件核对技术细节。","- 检查结构、术语一致性,以及读者能否按文档完成操作。","- 问题按严重度列出,给出具体修改建议或改写示例。","交付说明:先列事实错误,再列结构和表达问题。"].join(`
73
- `),lR=[{id:"build_review_test",workers:[{nameStem:"coder",role:"coder"},{nameStem:"reviewer",role:"reviewer"},{nameStem:"tester",role:"tester"}],goalTemplate:{en:"Implement <feature>: have the Coder implement, Reviewer audit, and Tester verify; describe what to build, key constraints, and validation commands or acceptance criteria.",zh:"实现 X 功能:让 Coder 实现、Reviewer 审查、Tester 验证;写清楚要做什么、关键约束,以及验证命令或验收标准。"}},{id:"research_factcheck",workers:[{nameStem:"researcher",role:"custom",descriptionOverride:{en:eR,zh:tR}},{nameStem:"factchecker",role:"custom",descriptionOverride:{en:nR,zh:aR}}],goalTemplate:{en:"Research <topic>: have the Researcher gather evidence and the Factchecker verify it; list questions, trusted sources, and the decision this research should support.",zh:"调研 X 主题:让 Researcher 收集证据、Factchecker 复核;列出要回答的问题、可信来源要求,以及这次调研要支撑的决策。"}},{id:"docs_pipeline",workers:[{nameStem:"drafter",role:"custom",descriptionOverride:{en:rR,zh:oR}},{nameStem:"doc-reviewer",role:"custom",descriptionOverride:{en:sR,zh:iR}}],goalTemplate:{en:"Write <doc>: have the Drafter write and the Doc Reviewer review; state the audience, scope, required sections, and code or files it should describe.",zh:"撰写 X 文档:让 Drafter 撰写、Doc Reviewer 审查;写明读者、范围、必备章节,以及它要描述的代码或文件。"}}],eb={build_review_test:{icon:c.jsx(uE,{size:16,"aria-hidden":!0}),titleKey:"scenario.build_review_test.title",descKey:"scenario.build_review_test.desc"},research_factcheck:{icon:c.jsx(jS,{size:16,"aria-hidden":!0}),titleKey:"scenario.research_factcheck.title",descKey:"scenario.research_factcheck.desc"},docs_pipeline:{icon:c.jsx(i0,{size:16,"aria-hidden":!0}),titleKey:"scenario.docs_pipeline.title",descKey:"scenario.docs_pipeline.desc"}},cR=({workspaceId:t})=>{const{language:a,t:o}=be(),s=sn(),[l,u]=y.useState(null),[f,m]=y.useState(""),[g,p]=y.useState(!1),b=E=>{m(E.goalTemplate[a]),u(E)},v=()=>{g||u(null)},k=()=>{!l||g||!f.trim()||(p(!0),EN(t,l.id,f,a).then(()=>{s.show({kind:"success",message:o("scenario.applied")}),u(null)}).catch(E=>{s.show({kind:"error",message:E instanceof Error?E.message:String(E)})}).finally(()=>p(!1)))};return c.jsxs("div",{className:"mx-auto mt-6 w-full max-w-[420px]","data-testid":"scenario-team-cards",children:[c.jsxs("div",{className:"mb-2 flex items-center justify-center gap-1.5 text-xs font-medium uppercase tracking-wide text-ter",children:[c.jsx(p0,{size:12,"aria-hidden":!0}),o("scenario.sectionTitle")]}),c.jsx("div",{className:"flex flex-col gap-2",children:lR.map(E=>{const S=eb[E.id];return c.jsxs("button",{type:"button",onClick:()=>b(E),className:"rounded border bg-1 p-3 text-left transition-colors hover:bg-3",style:{borderColor:"var(--border)"},"data-testid":`scenario-card-${E.id}`,children:[c.jsxs("div",{className:"flex items-center gap-2 text-pri",children:[S.icon,c.jsx("span",{className:"text-sm font-medium",children:o(S.titleKey)})]}),c.jsx("div",{className:"mt-1 text-xs text-ter",children:o(S.descKey)})]},E.id)})}),c.jsx(Mr,{open:l!==null,onOpenChange:E=>{E||v()},children:c.jsxs(Lr,{children:[c.jsx(zr,{className:"app-overlay fixed inset-0 z-[60]"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-[70] grid place-items-center p-4",children:c.jsxs(Hr,{"data-testid":"scenario-goal-dialog",className:"dialog-scale-pop elev-2 pointer-events-auto w-[480px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},onEscapeKeyDown:E=>{g&&E.preventDefault()},onPointerDownOutside:E=>{g&&E.preventDefault()},children:[c.jsx(Ur,{className:"text-lg font-semibold text-pri",children:l?o(eb[l.id].titleKey):""}),c.jsx(Ko,{className:"mt-1 text-xs text-ter",children:o("scenario.goalHint")}),c.jsxs("label",{className:"mt-4 block",children:[c.jsx("span",{className:"mb-1 block text-xs font-medium text-sec",children:o("scenario.goalLabel")}),c.jsx("textarea",{value:f,onChange:E=>m(E.target.value),rows:5,className:"w-full resize-y rounded border bg-1 p-2 text-sm text-pri outline-none focus:border-[var(--accent)]",style:{borderColor:"var(--border)"},disabled:g,"data-testid":"scenario-goal-input"})]}),c.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"icon-btn",onClick:v,disabled:g,"data-testid":"scenario-goal-cancel",children:o("scenario.cancel")}),c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary disabled:cursor-not-allowed disabled:opacity-50",onClick:k,disabled:g||!f.trim(),"data-testid":"scenario-goal-apply",children:o(g?"scenario.applying":"scenario.apply")})]})]})})]})})]})},px=16e4,uR=/^data:image\/(png|jpeg|webp);base64,([A-Za-z0-9+/]+={0,2})$/,dR=t=>{try{const a=globalThis.atob(t),o=new Uint8Array(a.length);for(let s=0;s<a.length;s+=1)o[s]=a.charCodeAt(s);return o}catch{throw new Error("Worker avatar must be valid base64")}},Of=(t,a)=>t.length>=a.length&&a.every((o,s)=>t[s]===o),fR=(t,a)=>t==="png"?Of(a,[137,80,78,71,13,10,26,10]):t==="jpeg"?Of(a,[255,216,255]):a.length>=12&&Of(a,[82,73,70,70])&&a[8]===87&&a[9]===69&&a[10]===66&&a[11]===80,mR=t=>{if(t==null||t==="")return null;if(typeof t!="string")throw new Error("Worker avatar must be an image data URL or null");const a=t.trim();if(!a)return null;if(a.length>px)throw new Error("Worker avatar is too large");const o=uR.exec(a);if(!o)throw new Error("Worker avatar must be a PNG, JPEG, or WebP data URL");const s=o[1],l=o[2];if(!s||!l)throw new Error("Worker avatar must be a PNG, JPEG, or WebP data URL");const u=dR(l);if(!fR(s,u))throw new Error("Worker avatar data does not match its image type");return a},hx=({size:t,children:a,color:o,fontRatio:s=.4,ringColor:l=null,ringSurface:u="var(--bg-1)",mono:f=!1,decoration:m,testId:g,data:p,className:b="",style:v={}})=>{const k={};if(p)for(const[E,S]of Object.entries(p))S!==void 0&&(k[`data-${E}`]=S);return c.jsxs("span",{"data-testid":g,...k,className:`relative inline-flex shrink-0 items-center justify-center rounded font-semibold ${f?"mono ":""}${b}`.trim(),style:{width:`${t}px`,height:`${t}px`,fontSize:`${Math.round(t*s)}px`,color:o,background:`color-mix(in oklab, ${o} 14%, transparent)`,border:`1px solid color-mix(in oklab, ${o} 35%, transparent)`,boxShadow:l?`0 0 0 2px ${u}, 0 0 0 4px ${l}`:void 0,...v},"aria-hidden":!0,children:[a,m]})},pR={orchestrator:Am,coder:QS,reviewer:ME,tester:Ql,sentinel:oE,custom:PE},hR={orchestrator:"crown",coder:"code",reviewer:"review",tester:"test",sentinel:"sentinel",custom:"custom"},gR={orchestrator:"var(--accent)",coder:"var(--status-blue)",reviewer:"var(--status-purple)",tester:"var(--status-orange)",sentinel:"var(--status-green)",custom:"var(--text-secondary)"},vR={working:"var(--status-green)",idle:"var(--text-tertiary)",stopped:"var(--status-red)"},yR=({role:t,size:a=32,statusRing:o="none"})=>{const s=pR[t];return c.jsx(hx,{size:a,color:gR[t],ringColor:o==="none"?null:vR[o],ringSurface:"var(--bg-2)",testId:"role-avatar",data:{role:t,icon:hR[t],"status-ring":o},children:c.jsx(s,{size:Math.round(a*.56),"aria-hidden":!0})})},bR={agy:{src:"/cli-icons/agy.png",surface:"#f4f4f4"},claude:{src:"/cli-icons/claude.png",surface:"#f7f5f2"},codex:{src:"/cli-icons/codex.png",surface:"#f4f4f4"},cursor:{src:"/cli-icons/cursor.ico",surface:"#ffffff"},gemini:{src:"/cli-icons/gemini.png",surface:"#f4f4f4"},grok:{src:"/cli-icons/grok.ico",surface:"#ffffff"},hermes:{src:"/cli-icons/hermes.png",surface:"#ffffff"},opencode:{src:"/cli-icons/opencode.svg",surface:"#f4f4f4"},pi:{src:"/cli-icons/pi.svg",surface:"#1a1a1a"},qwen:{src:"/cli-icons/qwen.png",surface:"#f4f8ff"}},wR={working:"var(--status-green)",idle:"var(--text-tertiary)",stopped:"var(--status-red)"},gx=t=>t?bR[t]??null:null,d8=({commandPresetId:t,fallback:a=null,size:o=20,testId:s="cli-agent-logo"})=>{const l=gx(t);if(!l)return a;const u=Math.round(o*.78);return c.jsx("span",{"data-testid":s,"data-command-preset":t,className:"inline-flex shrink-0 items-center justify-center overflow-hidden rounded","aria-hidden":!0,style:{width:`${o}px`,height:`${o}px`,background:l.surface,border:"1px solid color-mix(in oklab, var(--text-primary) 12%, transparent)"},children:c.jsx("img",{src:l.src,alt:"",decoding:"sync",width:u,height:u,style:{width:`${u}px`,height:`${u}px`,objectFit:"contain"}})})},Jm=({commandPresetId:t,customAvatar:a,workerRole:o,size:s=32,statusRing:l="none"})=>{const u=l==="none"?null:wR[l];if(a)return c.jsx("span",{"data-testid":"custom-agent-avatar","data-status-ring":l,className:"relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded","aria-hidden":!0,style:{width:`${s}px`,height:`${s}px`,background:"var(--bg-2)",border:"1px solid color-mix(in oklab, var(--text-primary) 12%, transparent)",boxShadow:u?`0 0 0 2px var(--bg-1), 0 0 0 4px ${u}`:void 0},children:c.jsx("img",{src:a,alt:"",decoding:"async",width:s,height:s,style:{width:`${s}px`,height:`${s}px`,objectFit:"cover"}})});const f=gx(t);if(!f)return c.jsx(yR,{role:o,size:s,statusRing:l});const m=Math.round(s*.78);return c.jsx("span",{"data-testid":"cli-agent-avatar","data-command-preset":t,"data-status-ring":l,className:"relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded","aria-hidden":!0,style:{width:`${s}px`,height:`${s}px`,background:f.surface,border:"1px solid color-mix(in oklab, var(--text-primary) 12%, transparent)",boxShadow:u?`0 0 0 2px var(--bg-1), 0 0 0 4px ${u}`:void 0},children:c.jsx("img",{src:f.src,alt:"",decoding:"sync",width:m,height:m,style:{width:`${m}px`,height:`${m}px`,objectFit:"contain"}})})},xR=5*1024*1024,kR=[{quality:.86,size:192,type:"image/webp"},{quality:.78,size:160,type:"image/webp"},{quality:.76,size:128,type:"image/jpeg"}],SR=(t,a)=>new Promise((o,s)=>{const l=URL.createObjectURL(t),u=new Image;u.onload=()=>{URL.revokeObjectURL(l),o(u)},u.onerror=()=>{URL.revokeObjectURL(l),s(new Error(a))},u.src=l}),ER=(t,a)=>{const o=Math.min(t.naturalWidth,t.naturalHeight),s=Math.max(0,Math.floor((t.naturalWidth-o)/2)),l=Math.max(0,Math.floor((t.naturalHeight-o)/2));let u=null;for(const f of kR){const m=document.createElement("canvas");m.width=f.size,m.height=f.size;const g=m.getContext("2d");if(!g)throw new Error("Canvas is not available");g.drawImage(t,s,l,o,o,0,0,f.size,f.size);try{return mR(m.toDataURL(f.type,f.quality))??""}catch(p){u=p}}throw u instanceof Error?u:new Error(a)},tb=async(t,a)=>{if(!t.type.startsWith("image/"))throw new Error(a.notImage);if(t.size>xR)throw new Error(a.sourceTooLarge);const o=await SR(t,a.loadFailed),s=ER(o,a.avatarTooLarge);if(s.length>px)throw new Error(a.avatarTooLarge);return s},CR=({avatar:t,commandPresetId:a,disabled:o=!1,onChange:s,workerRole:l,showStatus:u=!1})=>{const{t:f}=be(),m=y.useRef(null),[g,p]=y.useState(null),[b,v]=y.useState(!1),[k,E]=y.useState(!1),S=T=>{T.preventDefault(),!(o||b)&&E(!0)},w=()=>{E(!1)},C=T=>{if(T.preventDefault(),E(!1),o||b)return;const N=T.dataTransfer.files?.[0];N&&(v(!0),p(null),tb(N,{avatarTooLarge:f("worker.avatarTooLarge"),loadFailed:f("worker.avatarLoadFailed"),notImage:f("worker.avatarNotImage"),sourceTooLarge:f("worker.avatarSourceTooLarge")}).then(j=>s(j)).catch(j=>{p(j instanceof Error?j.message:String(j))}).finally(()=>v(!1)))};return c.jsxs("div",{className:"flex flex-col items-start gap-2 w-full",children:[c.jsx("span",{className:"text-sm font-semibold text-sec",children:f("worker.avatar")}),c.jsxs("div",{className:"flex w-full items-center gap-4 py-2 select-none",onDragOver:S,onDragLeave:w,onDrop:C,children:[c.jsxs("button",{type:"button",className:"group relative shrink-0 rounded overflow-hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 transition-all duration-200 cursor-pointer shadow-sm hover:shadow-md hover:scale-[1.02]",style:{transform:k?"scale(1.05)":"none",boxShadow:k?"0 0 0 2px var(--accent)":void 0},disabled:o||b,onClick:()=>m.current?.click(),"aria-label":f("worker.avatarUpload"),children:[c.jsx(Jm,{commandPresetId:a,customAvatar:t,workerRole:l,size:56}),c.jsx("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-center justify-center text-white",children:c.jsx(by,{size:16})})]}),c.jsxs("div",{className:"flex flex-col justify-center gap-2 min-w-0 flex-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsxs("button",{type:"button",className:"icon-btn h-8 rounded-md px-3 text-xs flex items-center gap-1.5 font-medium transition-colors",disabled:o||b,onClick:()=>m.current?.click(),children:[c.jsx(by,{size:12,"aria-hidden":!0}),f(b?"common.loading":"worker.avatarUpload")]}),t?c.jsxs("button",{type:"button",className:"icon-btn icon-btn--ghost h-8 rounded-md px-3 text-xs flex items-center gap-1.5 transition-colors",disabled:o||b,onClick:()=>{p(null),s(null)},children:[c.jsx(xc,{size:12,"aria-hidden":!0}),f("worker.avatarDefault")]}):null,u?c.jsxs("div",{className:"flex items-center gap-1.5 text-xs select-none ml-1 shrink-0",style:{color:t?"var(--text-primary)":"var(--text-tertiary)"},children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"var(--accent)":"var(--text-tertiary)"}}),c.jsx("span",{className:"font-medium",children:f(t?"worker.avatarUsingCustom":"worker.avatarUsingDefault")})]}):null]}),c.jsx("p",{className:"text-xs text-ter leading-normal",children:f("worker.avatarHelpText")}),c.jsx("input",{ref:m,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",disabled:o||b,onChange:T=>{const N=T.currentTarget.files?.[0];T.currentTarget.value="",N&&(v(!0),p(null),tb(N,{avatarTooLarge:f("worker.avatarTooLarge"),loadFailed:f("worker.avatarLoadFailed"),notImage:f("worker.avatarNotImage"),sourceTooLarge:f("worker.avatarSourceTooLarge")}).then(j=>s(j)).catch(j=>{p(j instanceof Error?j.message:String(j))}).finally(()=>v(!1)))}}),g?c.jsx("span",{className:"text-xs font-semibold px-2.5 py-1 rounded-lg bg-red-500/10 border border-red-500/15 w-fit",style:{color:"var(--status-red)"},children:g}):null]})]})]})},TR=({onClose:t,onSave:a,worker:o})=>{const{t:s}=be(),l=yt(),[u,f]=y.useState(o.avatar??null),[m,g]=y.useState(!1),[p,b]=y.useState(null),v=u!==(o.avatar??null),k=()=>{g(!0),b(null),a(u).then(E=>{if(E.error){b(E.error);return}t()}).catch(E=>b(E instanceof Error?E.message:String(E))).finally(()=>g(!1))};return c.jsx(Mr,{open:!0,onOpenChange:E=>E?void 0:t(),children:c.jsxs(Lr,{children:[c.jsx(zr,{className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4 max-md:items-end max-md:p-0",children:c.jsxs(Hr,{className:`${l?"dialog-slide-up max-md:w-full max-md:rounded-b-none max-md:rounded-t-xl":"dialog-scale-pop w-[420px] max-w-full"} elev-2 pointer-events-auto flex flex-col gap-4 rounded-lg border p-4`,style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx(Ur,{className:"text-base font-semibold text-pri",children:s("worker.avatarTitle")}),c.jsx(Ko,{className:"mt-1 truncate text-sm text-ter",children:o.name})]}),c.jsx(VT,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":s("common.closeDialog"),className:"icon-btn icon-btn--ghost h-8 w-8 px-0 justify-center",children:c.jsx(fa,{size:16,"aria-hidden":!0})})})]}),c.jsx(CR,{avatar:u,commandPresetId:o.commandPresetId,disabled:m,onChange:f,workerRole:o.role}),p?c.jsx("div",{className:"text-sm",style:{color:"var(--status-red)"},children:p}):null,c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"icon-btn",onClick:t,children:s("common.cancel")}),c.jsxs("button",{type:"button",className:"icon-btn icon-btn--primary",disabled:!v||m,onClick:k,children:[c.jsx(ga,{size:14,"aria-hidden":!0}),s(m?"common.saving":"common.save")]})]})]})})]})})},vx=({initialValue:t,saving:a,setSaving:o,onSave:s,onCancel:l,className:u})=>{const f=sn(),[m,g]=y.useState(t),p=y.useRef(null),b=y.useRef(!1);y.useEffect(()=>{const S=setTimeout(()=>{p.current?.focus(),p.current?.select()},50);return()=>clearTimeout(S)},[]);const v=async()=>{const S=m.trim();if(!S||S===t){l();return}o(!0);try{const w=await s(S);if(w.error){f.show({kind:"error",message:w.error}),g(t),setTimeout(()=>{p.current?.focus(),p.current?.select()},50),o(!1);return}}catch(w){const C=w instanceof Error?w.message:"Failed to rename worker";f.show({kind:"error",message:C}),g(t),setTimeout(()=>{p.current?.focus(),p.current?.select()},50),o(!1);return}o(!1),l()},k=S=>{S.stopPropagation(),S.key==="Enter"?(S.preventDefault(),v()):S.key==="Escape"&&(S.preventDefault(),b.current=!0,l())},E=()=>{b.current||v()};return c.jsx("input",{ref:p,type:"text",value:m,disabled:a,onChange:S=>g(S.target.value),onKeyDown:k,onBlur:E,maxLength:64,className:u,onClick:S=>S.stopPropagation()})},yx=t=>t.status==="working"?{kind:"working",label:"working",dotClass:"status-dot status-dot--working",tone:"var(--status-green)"}:t.status==="stopped"?{kind:"stopped",label:"stopped",dotClass:"status-dot status-dot--stopped",tone:"var(--status-red)"}:{kind:"idle",label:"idle",dotClass:"status-dot status-dot--idle",tone:"var(--text-tertiary)"},f8=t=>t?{kind:"working",label:"running",dotClass:"status-dot status-dot--working",tone:"var(--status-green)"}:{kind:"stopped",label:"stopped",dotClass:"status-dot status-dot--stopped",tone:"var(--status-red)"},bx={working:"pill--green",idle:"pill--ghost",stopped:"pill--red"},wx=t=>`role.${t}`,uc=t=>t==="working"?"common.running":t==="idle"?"common.idle":"common.stopped",NR=({hasRun:t,isPending:a=!1,isEditing:o=!1,onRenameWorker:s,onStartEditing:l,onCancelEditing:u,onAction:f,onClick:m,worker:g})=>{const{t:p}=be(),b=yt(),v=yx(g),[k,E]=y.useState(!1),S=j=>A=>{if(A.stopPropagation(),j==="rename"){l?.();return}f?.(j,g)},w=g.ephemeral===!0&&g.spawnedBy==="workflow",C=g.ephemeral===!0&&g.spawnedBy==="orchestrator",T=w?"workflow":C?"orchestrator":null;if(b)return c.jsx(jR,{ephemeralTone:T,hasRun:t,isPending:a,onAction:f,onClick:m,status:v,worker:g,isEditing:o,onRenameWorker:s,onCancelEditing:u});const N=o?"div":"button";return c.jsxs("div",{className:"worker-card-shell relative","data-status":v.kind,"data-worker-name":g.name,"data-ephemeral":g.ephemeral===!0?"true":void 0,"data-spawned-by":g.spawnedBy??void 0,"data-mobile":b?"true":void 0,children:[c.jsxs(N,{type:o?void 0:"button",onClick:o?void 0:()=>m(g),"aria-label":o?void 0:p("worker.open",{name:g.name}),className:`card worker-card relative flex w-full flex-col gap-3 overflow-hidden p-4 text-left ${o?"":"card--interactive"}`,"data-testid":`worker-card-${g.id}`,"data-status":v.kind,style:T?{borderStyle:"dashed",borderColor:T==="workflow"?"var(--accent)":"var(--border-bright)"}:void 0,children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Jm,{commandPresetId:g.commandPresetId,customAvatar:g.avatar,workerRole:g.role,size:40,statusRing:v.kind}),T?c.jsx("span",{className:"ml-auto rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",style:{background:T==="workflow"?"color-mix(in oklab, var(--accent) 18%, transparent)":"color-mix(in oklab, var(--text-secondary) 14%, transparent)",color:T==="workflow"?"var(--accent)":"var(--text-secondary)"},"data-testid":"worker-card-ephemeral-badge",title:T==="workflow"?"Spawned by a workflow run — auto-dismissed when its dispatch reports back.":"Spawned by the orchestrator via `team spawn` — auto-dismissed when the orchestrator exits.",children:T==="workflow"?"workflow":"temp"}):null]}),c.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o?c.jsx(vx,{initialValue:g.name,saving:k,setSaving:E,onSave:j=>s(g,j),onCancel:()=>u?.(),className:"worker-card-name-input"}):c.jsx("span",{className:"truncate text-base font-medium leading-tight text-pri",title:g.name,children:g.name}),c.jsx("span",{className:"worker-card__role-tag truncate leading-none mt-1",children:p(wx(g.role))})]}),c.jsx("div",{className:"flex min-w-0 flex-col gap-1.5",children:c.jsx("div",{className:"flex items-center gap-1.5",children:c.jsxs("span",{className:`pill ${bx[v.kind]} worker-card__status`,role:"status",title:v.kind==="working"?p("worker.workingLegend"):p(uc(v.kind)),children:[c.jsx("span",{className:v.dotClass,"aria-hidden":!0}),p(uc(v.kind))]})})})]}),f?c.jsxs("div",{className:"worker-card__actions",children:[t?b?c.jsxs(c.Fragment,{children:[c.jsx(jo,{title:p("common.stop"),onClick:S("stop"),disabled:a,variant:"danger",testId:`worker-card-stop-${g.id}`,ariaLabel:p("worker.stopAria",{name:g.name}),children:c.jsx(h0,{size:12,"aria-hidden":!0})}),c.jsx(jo,{title:p("common.restart"),onClick:S("restart"),disabled:a,testId:`worker-card-restart-${g.id}`,ariaLabel:p("worker.restartAria",{name:g.name}),children:c.jsx(xc,{size:12,"aria-hidden":!0})})]}):null:c.jsx(jo,{title:p("common.start"),onClick:S("start"),disabled:a,variant:"primary",testId:`worker-card-start-${g.id}`,ariaLabel:p("worker.startAria",{name:g.name}),children:c.jsx(Po,{size:12,"aria-hidden":!0})}),c.jsx(jo,{title:p("worker.rename"),onClick:S("rename"),disabled:a||v.kind==="working",testId:`worker-card-rename-${g.id}`,ariaLabel:p("worker.renameAria",{name:g.name}),children:c.jsx(f0,{size:12,"aria-hidden":!0})}),c.jsx(jo,{title:p("worker.avatarChange"),onClick:S("avatar"),disabled:a,testId:`worker-card-avatar-${g.id}`,ariaLabel:p("worker.avatarChangeAria",{name:g.name}),children:c.jsx(c0,{size:12,"aria-hidden":!0})}),c.jsx(jo,{title:p("common.delete"),onClick:S("delete"),variant:"danger",testId:`worker-card-delete-${g.id}`,ariaLabel:p("worker.deleteAria",{name:g.name}),children:c.jsx(Sc,{size:12,"aria-hidden":!0})})]}):null]})},jo=({ariaLabel:t,children:a,disabled:o,onClick:s,testId:l,title:u,variant:f="default"})=>c.jsx(Je,{label:u,children:c.jsx("button",{type:"button",onClick:s,disabled:o,"aria-label":t,"data-testid":l,"data-variant":f,className:"worker-card__action",children:a})}),jR=({ephemeralTone:t,hasRun:a,isPending:o,onAction:s,onClick:l,status:u,worker:f,isEditing:m=!1,onRenameWorker:g,onCancelEditing:p})=>{const{t:b}=be(),[v,k]=y.useState(!1),[E,S]=y.useState(!1),w=y.useRef(!1),C=j=>{j==="rename"&&(w.current=!0),k(!1),s?.(j,f)},T=b(wx(f.role)),N=m?"div":"button";return c.jsxs("div",{className:"worker-card-shell relative","data-status":u.kind,"data-worker-name":f.name,"data-ephemeral":f.ephemeral===!0?"true":void 0,"data-spawned-by":f.spawnedBy??void 0,"data-mobile":"true",children:[c.jsxs(N,{type:m?void 0:"button",onClick:m?void 0:()=>l(f),"aria-label":m?void 0:b("worker.open",{name:f.name}),className:`card worker-card flex w-full items-center gap-3 p-3 pr-12 text-left ${m?"":"card--interactive"}`,"data-testid":`worker-card-${f.id}`,"data-status":u.kind,style:t?{borderStyle:"dashed",borderColor:t==="workflow"?"var(--accent)":"var(--border-bright)"}:void 0,children:[c.jsx(Jm,{commandPresetId:f.commandPresetId,customAvatar:f.avatar,workerRole:f.role,size:40,statusRing:u.kind}),c.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[c.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[m?c.jsx(vx,{initialValue:f.name,saving:E,setSaving:S,onSave:j=>g(f,j),onCancel:()=>p?.(),className:"worker-card-name-input flex-1"}):c.jsx("span",{className:"truncate text-sm font-medium text-pri",children:f.name}),t?c.jsx("span",{className:"shrink-0 rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",style:{background:t==="workflow"?"color-mix(in oklab, var(--accent) 18%, transparent)":"color-mix(in oklab, var(--text-secondary) 14%, transparent)",color:t==="workflow"?"var(--accent)":"var(--text-secondary)"},"data-testid":"worker-card-ephemeral-badge",children:t==="workflow"?"workflow":"temp"}):null]}),c.jsx("span",{className:"truncate text-xs text-ter",children:T})]}),c.jsxs("span",{className:`pill ${bx[u.kind]} worker-card__status shrink-0`,role:"status",children:[c.jsx("span",{className:u.dotClass,"aria-hidden":!0}),b(uc(u.kind))]})]}),s?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button","aria-label":b("worker.actionsAria",{name:f.name}),"data-testid":`worker-card-menu-${f.id}`,onClick:()=>k(!0),className:"absolute top-1/2 right-1 z-[2] flex h-11 w-11 -translate-y-1/2 items-center justify-center rounded-md text-ter",children:c.jsx(nE,{size:18,"aria-hidden":!0})}),c.jsx(Mr,{open:v,onOpenChange:k,children:c.jsxs(Lr,{children:[c.jsx(zr,{className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid items-end",children:c.jsxs(Hr,{onCloseAutoFocus:j=>{w.current&&(j.preventDefault(),w.current=!1)},"data-testid":`worker-action-sheet-${f.id}`,className:"dialog-slide-up elev-2 pointer-events-auto flex w-full flex-col overflow-hidden rounded-t-xl border-t pb-[max(8px,env(safe-area-inset-bottom))]",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs(Ur,{className:"flex items-center gap-2 border-b px-4 py-3 text-sm font-semibold text-pri",style:{borderColor:"var(--border)"},children:[c.jsx("span",{className:"truncate",children:f.name}),c.jsx("span",{className:"shrink-0 text-xs font-normal text-ter",children:b(uc(u.kind))})]}),c.jsx(Ko,{className:"sr-only",children:b("worker.actionsAria",{name:f.name})}),a?c.jsxs(c.Fragment,{children:[c.jsx(Ao,{disabled:o,icon:c.jsx(h0,{size:16,"aria-hidden":!0}),label:b("common.stop"),onSelect:()=>C("stop"),testId:`worker-card-stop-${f.id}`,danger:!0}),c.jsx(Ao,{disabled:o,icon:c.jsx(xc,{size:16,"aria-hidden":!0}),label:b("common.restart"),onSelect:()=>C("restart"),testId:`worker-card-restart-${f.id}`})]}):c.jsx(Ao,{disabled:o,icon:c.jsx(Po,{size:16,"aria-hidden":!0}),label:b("common.start"),onSelect:()=>C("start"),testId:`worker-card-start-${f.id}`}),c.jsx(Ao,{disabled:o||u.kind==="working",icon:c.jsx(f0,{size:16,"aria-hidden":!0}),label:b("worker.rename"),onSelect:()=>C("rename"),testId:`worker-card-rename-${f.id}`}),c.jsx(Ao,{disabled:o,icon:c.jsx(c0,{size:16,"aria-hidden":!0}),label:b("worker.avatarChange"),onSelect:()=>C("avatar"),testId:`worker-card-avatar-${f.id}`}),c.jsx(Ao,{icon:c.jsx(Sc,{size:16,"aria-hidden":!0}),label:b("common.delete"),onSelect:()=>C("delete"),testId:`worker-card-delete-${f.id}`,danger:!0})]})})]})})]}):null]})},Ao=({danger:t=!1,disabled:a=!1,icon:o,label:s,onSelect:l,testId:u})=>c.jsxs("button",{type:"button",disabled:a,"data-testid":u,onClick:l,className:"flex min-h-12 w-full items-center gap-3 px-4 text-left text-sm disabled:opacity-50",style:{color:t?"var(--status-red)":"var(--text-primary)"},children:[o,s]}),AR=["working","idle","stopped"],nb=t=>t==="working"?"common.running":t==="idle"?"common.idle":"common.stopped",_R=t=>{const a={idle:[],working:[],stopped:[]};for(const o of t)a[yx(o).kind].push(o);return{sections:AR.filter(o=>a[o].length>0).map(o=>({kind:o,workers:a[o]})),summary:{idle:a.idle.length,stopped:a.stopped.length,working:a.working.length}}},RR=({onAddWorkerClick:t,onDeleteWorker:a,onOpenShellTerminal:o,onOpenWorker:s,onRenameWorker:l,onUpdateWorkerAvatar:u,onStopWorker:f,onRestartWorker:m,onStartWorker:g,shellTerminalAvailable:p=!0,startingWorkerId:b,terminalRuns:v,workers:k,workspaceId:E})=>{const{t:S}=be(),{sections:w,summary:C}=y.useMemo(()=>_R(k),[k]),T=y.useMemo(()=>new Map(v.map(Q=>[Q.agent_id,Q.run_id])),[v]),[N,j]=y.useState(null),[A,O]=y.useState(null),[D,L]=y.useState(null),P=(Q,$)=>{if(Q==="start"){g($);return}if(Q==="stop"){const F=T.get($.id);F&&f?.(F);return}if(Q==="restart"){const F=T.get($.id);F&&m?.($.id,F);return}if(Q==="rename"){L($.id);return}if(Q==="avatar"){O($);return}Q==="delete"&&j($)},J=()=>{N&&(a(N),j(null))};return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",style:{background:"var(--bg-2)"},"data-testid":"workers-pane",children:[c.jsxs("div",{className:"flex shrink-0 flex-col gap-1 px-4 pt-3 pb-2.5",style:{boxShadow:"inset 0 -1px 0 var(--border)"},children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx("span",{className:"text-lg font-semibold text-pri",children:S("worker.teamMembers")}),c.jsx("span",{className:"mono inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-3 px-1 text-[11px] font-medium tabular-nums leading-none text-sec",children:k.length}),c.jsx("div",{className:"flex-1"}),p?c.jsxs("button",{type:"button",onClick:o,className:"icon-btn icon-btn--tertiary","aria-label":S("shellTerminal.openAria"),"data-testid":"open-workspace-shell",children:[c.jsx(kc,{size:14,"aria-hidden":!0})," ",S("shellTerminal.open")]}):null,c.jsxs("button",{type:"button",onClick:t,className:"icon-btn icon-btn--primary","data-testid":"add-worker-trigger",children:[c.jsx(lf,{size:14,"aria-hidden":!0})," ",S("addWorker.create")]})]}),k.length>0?c.jsxs("div",{className:"flex items-center gap-3 text-xs text-ter",children:[c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{className:"status-dot status-dot--working","aria-hidden":!0}),c.jsx("span",{className:"text-sec",children:C.working})," ",S("common.running")]}),c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{className:"status-dot status-dot--idle","aria-hidden":!0}),c.jsx("span",{className:"text-sec",children:C.idle})," ",S("common.idle")]}),c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{className:"status-dot status-dot--stopped","aria-hidden":!0}),c.jsx("span",{className:"text-sec",children:C.stopped})," ",S("common.stopped")]})]}):null]}),c.jsx("div",{className:"workers-pane-body scroll-y min-h-0 min-w-0 flex-1 px-2 py-2",children:k.length===0?c.jsxs(c.Fragment,{children:[c.jsx(mi,{icon:c.jsx(lf,{size:28}),title:S("worker.emptyTitle"),description:S("worker.emptyDesc"),action:c.jsxs("button",{type:"button",onClick:t,className:"icon-btn icon-btn--primary","data-testid":"add-worker-empty",children:[c.jsx(lf,{size:14,"aria-hidden":!0})," ",S("worker.emptyAdd")]})}),E?c.jsx(cR,{workspaceId:E}):null]}):c.jsx("div",{"data-testid":"worker-grid",children:w.map(Q=>c.jsxs("section",{className:"mb-3 last:mb-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium uppercase tracking-wide text-ter",children:[S(nb(Q.kind)),c.jsx("span",{className:"mono inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-1 text-[11px] font-medium tabular-nums leading-none",children:Q.workers.length})]}),c.jsx("ul",{"aria-label":`${S(nb(Q.kind))} team members`,className:"worker-card-grid",children:Q.workers.map($=>c.jsx("li",{children:c.jsx(NR,{hasRun:T.has($.id),isPending:b===$.id||$.status==="working"&&!T.has($.id),isEditing:D===$.id,onRenameWorker:async(F,ne)=>k.some(q=>q.id!==F.id&&q.name.toLowerCase()===ne.toLowerCase())?{error:S("addWorker.agentExists")}:l(F,ne),onStartEditing:()=>L($.id),onCancelEditing:()=>L(null),onAction:P,onClick:s,worker:$})},$.id))})]},Q.kind))})}),c.jsx(pi,{open:N!==null,onOpenChange:Q=>{Q||j(null)},title:N?S("worker.deleteConfirm",{name:N.name}):"",description:N?S("worker.deleteDescription",{name:N.name}):"",confirmLabel:S("worker.deleteMember"),confirmKind:"danger",onConfirm:J}),A?c.jsx(TR,{worker:A,onClose:()=>O(null),onSave:Q=>u(A.id,Q)}):null]})},OR=y.lazy(()=>Mt(()=>import("./AddWorkerDialog-CPQkMvDz.js"),__vite__mapDeps([2,3,4])).then(t=>({default:t.AddWorkerDialog}))),DR=y.lazy(()=>Mt(()=>import("./WorkerModal-BN3jQTBO.js"),[]).then(t=>({default:t.WorkerModal}))),MR=({activeWorkerId:t,onCreateWorker:a,onDeleteWorker:o,onDeleteWorkspace:s,onUpdateWorkerAvatar:l,onStartWorker:u,onStopWorker:f,onRestartWorker:m,onOrchestratorResult:g,onOrchestratorRunClosed:p,onRequestAddWorkspace:b,onShellRunClosed:v,onShellRunStarted:k,onTryDemo:E,welcomeDisabledReason:S,orchestratorAutostartError:w,terminalRuns:C,workers:T,workspace:N,onActiveWorkerChange:j,showInlineActionCenter:A=!0})=>{const{t:O}=be(),D=yt(),[L,P]=y.useState(null),J=t===void 0?L:t,Q=y.useCallback(de=>{j?j(de):P(de)},[j]),[$,F]=y.useState(!1),[ne,Z]=y.useState("orchestrator"),q=nx();y.useEffect(()=>()=>tx(!1),[]);const[M,U]=y.useState(null),[W,G]=y.useState(null),[V,R]=y.useState(null),[B,se]=y.useState(!1),re=sn(),ce=Z_({createWorker:a,open:$,workers:T}),fe=q_({workspaceId:N?.id??"",terminalRuns:C,autostartError:w,onClearAutostartError:()=>{N&&g(N.id,{ok:!0,error:null,run_id:null})},onAfterStart:de=>{N&&g(N.id,de)},onRunClosed:p}),ue=O_(),le=T.find(de=>de.id===J)??null;y.useEffect(()=>{J&&!le&&Q(null)},[J,le,Q]);const ie=x_({workspaceId:N?.id??"",workers:T,terminalRuns:C}),xe=ie.tabs.filter(de=>de.kind==="shell"),Ne=N?C.filter(de=>ti(de,N.id)):[],{closeShellTab:he,openShell:we,shellError:Ce,shellStarting:Ae,startNewShell:pt}=__({onCloseFailed:de=>re.show({kind:"error",message:O("shellTerminal.closeFailed",{message:de})}),onShellRunClosed:v,onShellRunStarted:k,panelTabs:ie,shellRuns:Ne,workspaceId:N?.id??null});if(y.useEffect(()=>{ce.createWorkerError&&re.show({kind:"error",message:ce.createWorkerError})},[ce.createWorkerError,re]),y.useEffect(()=>{M&&re.show({kind:"error",message:M})},[M,re]),y.useEffect(()=>{W&&re.show({kind:"error",message:W})},[W,re]),y.useEffect(()=>{Ce&&re.show({kind:"error",message:Ce})},[Ce,re]),y.useEffect(()=>{Q(null),U(null),G(null),R(null),se(!1),Z("orchestrator")},[N?.id,Q]),!N){const de={onAddWorkspace:b};return E&&(de.onTryDemo=E),S&&(de.disabledReason=S),c.jsx(J_,{...de})}const dt=le?A_(C,le.id):void 0,wn=de=>{U(null),o(de.id).then(()=>Q(null)).catch(Ue=>{U(Ue instanceof Error?Ue.message:String(Ue))})},Nt=de=>{G(null),R(de.id),u(de.id).then(({error:Ue})=>{Ue&&G(Ue)}).catch(Ue=>{G(Ue instanceof Error?Ue.message:String(Ue))}).finally(()=>R(null))},Fn=de=>{f(de).then(({error:Ue})=>{Ue&&re.show({kind:"error",message:Ue})})},ft=(de,Ue)=>{G(null),R(de),m(de,Ue).then(({error:st})=>{st&&G(st)}).catch(st=>{G(st instanceof Error?st.message:String(st))}).finally(()=>R(null))},zt=async(de,Ue)=>{try{return await TN(N.id,de.id,Ue),re.show({kind:"success",message:O("worker.renameSuccess",{name:Ue})}),{error:null}}catch(st){const Kn=st instanceof Error?st.message:String(st);return re.show({kind:"error",message:O("worker.renameFailed",{message:Kn})}),{error:Kn}}},ln=`${(ue.orchPct*100).toFixed(2)}%`,Se=()=>{se(!1),we()},nt=()=>{se(!1),pt()},ar=c.jsx(I_,{state:fe.state,onRemoveWorkspace:()=>{s(N).catch(de=>{const Ue=de instanceof Error?de.message:String(de);re.show({kind:"error",message:`Delete failed: ${Ue}`})})},onStart:fe.start,onRestart:fe.restart}),rr=c.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[c.jsx(RR,{onAddWorkerClick:()=>F(!0),onDeleteWorker:wn,onOpenShellTerminal:Se,onOpenWorker:de=>Q(de.id),onRenameWorker:zt,onUpdateWorkerAvatar:l,onStartWorker:Nt,onStopWorker:Fn,onRestartWorker:ft,startingWorkerId:V,terminalRuns:C,workers:T,workspaceId:N.id}),B?null:c.jsx(v_,{tabs:xe,activeId:ie.activeId,scopeKey:N.id,onSelect:ie.setActive,onClose:de=>{de.startsWith("shell:")&&he(de.slice(6)),ie.closeTab(de)},onClosePanel:()=>se(!0),onNewShell:nt,newShellPending:Ae,onStartWorker:de=>{const Ue=T.find(st=>st.id===de);Ue&&Nt(Ue)},startingWorkerId:V})]});return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",style:{background:"var(--bg-2)"},children:[c.jsx(c_,{terminalRuns:C,workers:T,workspace:N}),A?c.jsx(QA,{workspaceId:N.id,onOpenWorker:Q},N.id):null,D?c.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden","data-mobile":"true","data-testid":"workspace-detail-panes",children:[c.jsxs("div",{role:"tablist","aria-label":O("mobile.nav.team"),className:"flex shrink-0 items-center gap-1 border-b p-2",style:{borderColor:"var(--border)"},children:[["orchestrator","workers"].map(de=>{const Ue=ne===de,st=`mobile-team-tab-${de}`,Kn=`mobile-team-panel-${de}`;return c.jsxs("button",{id:st,type:"button",role:"tab","aria-selected":Ue,"aria-controls":Kn,tabIndex:Ue?0:-1,"data-active":Ue||void 0,"data-testid":st,onClick:()=>Z(de),className:"flex min-h-11 flex-1 items-center justify-center gap-1.5 rounded-md text-sm font-medium",style:Ue?{background:"var(--accent)",color:"var(--bg-0)"}:{background:"var(--bg-3)",color:"var(--text-secondary)"},children:[c.jsx("span",{children:O(de==="orchestrator"?"mobile.team.orchestrator":"mobile.team.workers")}),de==="workers"&&T.length>0?c.jsx("span",{className:"inline-flex items-center justify-center rounded-full min-w-[18px] h-[18px] px-1 text-[11px] font-medium tabular-nums leading-none",style:Ue?{background:"var(--bg-0)",color:"var(--accent)"}:{background:"var(--bg-1)",color:"var(--text-secondary)"},children:T.length}):null]},de)}),c.jsx("button",{type:"button",onClick:e_,"aria-pressed":q,"aria-label":O(q?"mobile.focus.exit":"mobile.focus.enter"),"data-testid":"mobile-focus-toggle",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-md",style:{background:"var(--bg-3)",color:"var(--text-secondary)"},children:q?c.jsx(EE,{size:16,"aria-hidden":!0}):c.jsx(kE,{size:16,"aria-hidden":!0})})]}),c.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1 overflow-hidden","data-testid":"mobile-team-panel",children:[c.jsx("div",{id:"mobile-team-panel-orchestrator",role:"tabpanel","aria-labelledby":"mobile-team-tab-orchestrator","aria-hidden":ne!=="orchestrator",className:"mobile-team-pane flex min-h-0 min-w-0 flex-col","data-active":ne==="orchestrator"?"true":"false",children:ar}),c.jsx("div",{id:"mobile-team-panel-workers",role:"tabpanel","aria-labelledby":"mobile-team-tab-workers","aria-hidden":ne!=="workers",className:"mobile-team-pane flex min-h-0 min-w-0 flex-col","data-active":ne==="workers"?"true":"false",children:rr})]})]}):c.jsxs("div",{ref:ue.containerRef,className:"relative flex min-h-0 min-w-0 flex-1 overflow-hidden","data-testid":"workspace-detail-panes",children:[c.jsx("div",{className:"flex min-w-[480px] shrink-0 flex-col overflow-hidden",style:{width:ln},"data-testid":"orchestrator-pane-shell",children:ar}),c.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":O("workerPane.resize"),"aria-valuenow":Math.round(ue.orchPct*100),"aria-valuemin":30,"aria-valuemax":78,tabIndex:0,className:"pane-splitter",style:{left:`calc(${ln} - 4px)`},"data-dragging":ue.dragging||void 0,"data-testid":"pane-splitter",onPointerDown:ue.beginDrag,onKeyDown:ue.onKeyDown}),rr]}),le?c.jsx(y.Suspense,{fallback:null,children:c.jsx(DR,{onClose:()=>Q(null),onStart:Nt,runId:dt?.run_id??null,startError:W,starting:V===le.id,worker:le})}):null,$?c.jsx(y.Suspense,{fallback:null,children:c.jsx(OR,{avatar:ce.avatar,commandPresets:ce.commandPresets,commandPresetId:ce.commandPresetId,creating:ce.creating,customTemplates:ce.customTemplates,onApplyMarketplaceImport:ce.applyMarketplaceImport,onAvatarChange:ce.setAvatar,onClose:()=>F(!1),onDeleteTemplate:ce.deleteTemplate,onNameChange:ce.setWorkerName,onPresetChange:ce.setCommandPresetId,onRandomName:ce.randomizeWorkerName,onRoleDescriptionChange:ce.setRoleDescription,onRoleDescriptionReset:ce.resetRoleDescription,onRoleChange:ce.setWorkerRole,onSaveAsTemplate:ce.saveAsTemplate,onSubmit:de=>ce.submit(de,()=>F(!1)),onStartupCommandChange:ce.setStartupCommand,onTemplateChange:ce.selectTemplate,roleDescription:ce.roleDescription,roleDescriptionDefault:ce.roleDescriptionDefault,selectedTemplateId:ce.selectedTemplateId,startupCommand:ce.startupCommand,templateBusy:ce.templateBusy,workerName:ce.workerName,workerRole:ce.workerRole})}):null]})},LR=({activeId:t,activeWorkspace:a,activeWorkerId:o,bootstrapError:s,demoMode:l,onActiveWorkerChange:u,onDeleteWorkspace:f,onExitDemo:m,onOrchestratorRunClosed:g,onRequestAddWorkspace:p,onShellRunClosed:b,onShellRunStarted:v,onTryDemo:k,orchestratorAutostartErrors:E,recordOrchestratorResult:S,terminalRuns:w,workerActions:C,workers:T,workspacesLoading:N,showInlineActionCenter:j})=>l?c.jsx(gC,{onExit:m}):N&&!a?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(Ja,{size:24,className:"animate-spin text-ter"})}):c.jsx(MR,{activeWorkerId:o,onCreateWorker:C.createWorker,onDeleteWorker:C.deleteWorker,onDeleteWorkspace:f,onUpdateWorkerAvatar:C.updateWorkerAvatar,onStartWorker:C.startWorker,onStopWorker:C.stopWorkerRun,onRestartWorker:C.restartWorkerRun,onOrchestratorResult:S,onOrchestratorRunClosed:g,onRequestAddWorkspace:p,onShellRunClosed:b,onShellRunStarted:v,onTryDemo:k,onActiveWorkerChange:u,welcomeDisabledReason:s??void 0,orchestratorAutostartError:t?E[t]??null:null,terminalRuns:w,workers:T,workspace:a,showInlineActionCenter:j}),Wl={id:"demo-workspace",name:"demo-todo-app",path:"/Users/you/demo-todo-app"},zR=[{id:"demo-coder",name:"ada-lovelace",role:"coder",status:"working",pendingTaskCount:1,lastPtyLine:"Editing src/routes/todos.ts (line 42)",commandPresetId:"claude"},{id:"demo-reviewer",name:"socrates",role:"reviewer",status:"idle",pendingTaskCount:0,commandPresetId:"gemini"}],HR=`# Todo app
63
+ `)}},_f=(t,a,o)=>t==="custom"?a.find(s=>s.roleType==="custom"&&s.isBuiltin)?.description??Gs[o].custom:Gs[o][t],$_=({createWorker:t,open:a,workers:o})=>{const{language:s}=be(),[l,u]=y.useState(""),[f,m]=y.useState("coder"),[g,p]=y.useState([]),[b,v]=y.useState(null),[k,E]=y.useState(!1),[S,w]=y.useState(null),[C,T]=y.useState(Gs[s].coder),[N,j]=y.useState([]),[A,O]=y.useState("claude"),[D,L]=y.useState(null),[P,J]=y.useState(""),[Q,$]=y.useState(null),[F,ne]=y.useState(!1),Z=y.useRef(!1),q=y.useRef(!1),M=y.useRef(!1),U=_f(f,g,s),W=y.useMemo(()=>g.filter(he=>!he.isBuiltin),[g]);y.useEffect(()=>{if(!a)return;let he=!1;return mN().then(we=>{he||(j(we),O(Ce=>we.some(Ae=>Ae.id===Ce&&Ae.available)?Ce:we.find(Ae=>Ae.id==="claude"&&Ae.available)?.id??we.find(Ae=>Ae.available)?.id??we[0]?.id??""))}).catch(we=>{he||$(we instanceof Error?we.message:String(we))}),()=>{he=!0}},[a]),y.useEffect(()=>{if(!a)return;let he=!1;return vN().then(we=>{he||p(we)}).catch(we=>{he||$(we instanceof Error?we.message:String(we))}),()=>{he=!0}},[a]),y.useEffect(()=>{b===null&&(q.current||T(_f(f,g,s)))},[s,g,f,b]);const G=he=>{q.current=!0,T(he)},V=he=>{Z.current=!1,u(he)},R=y.useMemo(()=>new Set(o.map(he=>he.name)),[o]),B=y.useRef(R);B.current=R;const se=()=>{Z.current=!0,u(Af({language:s,role:f,usedNames:R}))};y.useEffect(()=>{const he=a&&!M.current;if(M.current=a,!!a){if(he){Z.current=!0,u(Af({language:s,role:f,usedNames:B.current}));return}Z.current&&u(Af({language:s,role:f,usedNames:B.current}))}},[a,s,f]);const re=he=>{m(he),v(null),q.current=!1,T(_f(he,g,s))};return{avatar:D,commandPresets:N,commandPresetId:A,createWorkerError:Q,creating:F,customTemplates:W,roleDescription:C,roleDescriptionDefault:U,selectedTemplateId:b,startupCommand:P,templateBusy:k,templateError:S,workerName:l,workerRole:f,setCommandPresetId:he=>{O(he)},setAvatar:L,setRoleDescription:G,setStartupCommand:J,setWorkerName:V,setWorkerRole:re,selectTemplate:he=>{if(he===null){m("custom"),v(null),q.current=!1,T(Gs[s].custom);return}const we=g.find(Ce=>Ce.id===he);!we||we.isBuiltin||(m("custom"),v(he),q.current=!1,T(we.description))},saveAsTemplate:async he=>{const we=he.trim(),Ce=C.trim();if(!(!we||!Ce)){E(!0),w(null);try{const Ae=await yN({name:we,roleType:"custom",description:Ce});p(pt=>[...pt,Ae]),v(Ae.id),m("custom"),q.current=!1,T(Ae.description)}catch(Ae){throw w(Ae instanceof Error?Ae.message:String(Ae)),Ae}finally{E(!1)}}},deleteTemplate:async he=>{const we=g.find(Ce=>Ce.id===he);if(!(!we||we.isBuiltin)){E(!0),w(null);try{await bN(he),p(Ce=>Ce.filter(Ae=>Ae.id!==he)),b===he&&(v(null),q.current=!1,T(Gs[s].custom))}catch(Ce){throw w(Ce instanceof Error?Ce.message:String(Ce)),Ce}finally{E(!1)}}},randomizeWorkerName:se,resetRoleDescription:()=>{q.current=!1,T(U)},resetError:()=>$(null),applyMarketplaceImport:({name:he,description:we})=>{Z.current=!1,u(he),v(null),m("custom"),q.current=!0,T(we)},submit:(he,we)=>{he.preventDefault(),ne(!0),$(null),t({avatar:D,commandPresetId:A,name:l,role:f,roleDescription:C,startupCommand:P}).then(({error:Ce})=>{u(""),Z.current=!1,re("coder"),v(null),O("claude"),L(null),J(""),we(),Ce&&$(Ce)}).catch(Ce=>{$(Ce instanceof Error?Ce.message:String(Ce))}).finally(()=>ne(!1))}}},V_=[{icon:c.jsx(l0,{size:16}),titleKey:"welcome.step1Title",descriptionKey:"welcome.step1Desc"},{icon:c.jsx(Ec,{size:16}),titleKey:"welcome.step2Title",descriptionKey:"welcome.step2Desc"},{icon:c.jsx(ME,{size:16}),titleKey:"welcome.step3Title",descriptionKey:"welcome.step3Desc"}],G_=({onAddWorkspace:t,onTryDemo:a,heroImageSrc:o,disabledReason:s})=>{const{t:l}=be(),u=!!s;return c.jsxs("div",{"data-testid":"welcome-pane",className:"m-auto flex w-full flex-col items-center gap-6 px-6 py-12 text-center",style:{maxWidth:"540px"},children:[o?c.jsx("img",{src:o,alt:"",className:"h-24 w-24","aria-hidden":!0}):null,c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-2xl font-semibold text-pri",children:l("welcome.title")}),c.jsx("div",{className:"text-sm text-sec",children:l("welcome.desc")})]}),c.jsx("ol",{className:"grid w-full grid-cols-1 gap-3 text-left md:grid-cols-3",children:V_.map((f,m)=>c.jsxs("li",{className:"rounded border bg-1 p-3",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"mb-1 flex items-center gap-2 text-pri",children:[c.jsx("span",{className:"font-medium text-xs text-ter",children:m+1}),f.icon]}),c.jsx("div",{className:"text-xs font-medium text-pri",children:l(f.titleKey)}),c.jsx("div",{className:"mt-1 text-xs text-ter",children:l(f.descriptionKey)})]},f.titleKey))}),u?c.jsxs("div",{role:"alert","data-testid":"welcome-pane-disabled-reason",className:"flex items-start gap-2 rounded px-3 py-2 text-left text-xs",style:{background:"color-mix(in oklab, var(--status-red) 10%, transparent)",border:"1px solid color-mix(in oklab, var(--status-red) 28%, transparent)",color:"var(--status-red)"},children:[c.jsx(Js,{size:14,className:"mt-0.5 shrink-0","aria-hidden":!0}),c.jsx("span",{className:"break-words",children:s})]}):null,c.jsxs("button",{type:"button",disabled:u,onClick:u?void 0:t,"aria-disabled":u||void 0,title:s,className:"icon-btn icon-btn--primary inline-flex items-center gap-2 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"welcome-pane-add",children:[c.jsx("span",{children:l("welcome.addWorkspace")}),c.jsx(CS,{size:14,"aria-hidden":!0})]}),a?c.jsx("button",{type:"button",onClick:a,className:"text-xs text-sec underline hover:text-pri",children:l("welcome.demo")}):null]})},Rf=t=>t==="danger"?"var(--status-red)":"var(--accent)",pi=({open:t,onOpenChange:a,title:o,description:s,confirmLabel:l,confirmKind:u="default",cancelLabel:f,onConfirm:m})=>{const{t:g}=be(),p=f??g("common.cancel");return c.jsx(Mr,{open:t,onOpenChange:a,children:c.jsxs(Lr,{children:[c.jsx(zr,{"data-testid":"confirm-overlay",className:"app-overlay fixed inset-0 z-[60]"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-[70] grid place-items-center p-4",children:c.jsxs(Hr,{"data-testid":"confirm-content",className:"dialog-scale-pop elev-2 pointer-events-auto w-[440px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{"aria-hidden":!0,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:`color-mix(in oklab, ${Rf(u)} 14%, transparent)`,color:Rf(u),border:`1px solid color-mix(in oklab, ${Rf(u)} 30%, transparent)`},children:u==="danger"?c.jsx(Js,{size:18}):c.jsx(FS,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(Ur,{"data-testid":"confirm-title",className:"text-lg font-semibold text-pri",children:o}),c.jsx(Ko,{"data-testid":"confirm-description",className:"mt-1.5 text-sm text-sec",children:s})]})]}),c.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[c.jsx("button",{type:"button","data-testid":"confirm-cancel",onClick:()=>a(!1),autoFocus:u==="danger",className:"icon-btn",children:p}),c.jsx("button",{type:"button","data-testid":"confirm-action",onClick:()=>{m(),a(!1)},autoFocus:u!=="danger",className:u==="danger"?"icon-btn icon-btn--danger-solid":"icon-btn icon-btn--primary",children:l})]})]})})]})})},X_=["You are a Researcher. Collect facts, data, and sources for the assigned topic.","How to work:","- Break the topic into key questions first, then investigate each one.","- Prefer primary sources and real project files; attach a source or file path to every conclusion.","- Separate facts, inferences, and unknowns; never present guesses as facts.","Delivery: include findings by topic, source list, and unresolved questions."].join(`
64
+ `),Z_=["你是 Researcher,负责为指定主题收集事实、数据和来源。","工作方式:","- 先拆出要回答的关键问题,再逐项调查。","- 优先一手来源和项目内真实文件;每个结论都附上来源或文件路径。","- 区分事实、推断和未知,不把猜测写成结论。","交付说明:按主题列出发现、来源清单和未解决问题。"].join(`
65
+ `),Q_=["You are a Fact-checker. Verify research claims and evidence strength without expanding the scope by default.","How to work:","- Check every claim against its source and mark supported, uncertain, or unsupported.","- Cross-check critical claims with a second source, command, or direct file read.","- When a claim is wrong, provide the corrected wording and evidence.","Delivery: group by confidence and list refuted or uncertain claims first."].join(`
66
+ `),J_=["你是 Fact-checker,负责验证研究结论和证据强度,默认不扩范围。","工作方式:","- 逐条核对结论与其来源,标注支持、存疑或不支持。","- 对关键结论用第二来源、命令或直接读文件做交叉验证。","- 发现错误时给出纠正后的表述和依据。","交付说明:按可信度分组,先列被推翻或存疑的结论。"].join(`
67
+ `),eR=["You are a Drafter. Turn goals and source material into a clear first-draft document.","How to work:","- Confirm audience, purpose, and scope before outlining and writing.","- Use real project code and files as the source of truth; do not invent behavior or APIs.","- Mark missing material and points that need confirmation.","Delivery: include document path, structure overview, and confirmation checklist."].join(`
68
+ `),tR=["你是 Drafter,负责把目标和素材写成清晰的第一版文档。","工作方式:","- 先确认读者、目的和范围,再列提纲,后成文。","- 以项目内真实代码和文件为准,不编造行为或接口。","- 标注待确认和缺素材的位置。","交付说明:包含文档路径、结构概览和确认清单。"].join(`
69
+ `),nR=["You are a Document Reviewer. Check a draft for accuracy and readability; do not rewrite the whole document by default.","How to work:","- Verify technical details against real code and files first.","- Check structure, terminology consistency, and whether readers can follow the document.","- List issues by severity with concrete edits or rewrite examples.","Delivery: list factual errors first, then structure and wording issues."].join(`
70
+ `),aR=["你是 Document Reviewer,负责检查草稿的准确性和可读性;默认不要整篇重写。","工作方式:","- 先对照项目真实代码和文件核对技术细节。","- 检查结构、术语一致性,以及读者能否按文档完成操作。","- 问题按严重度列出,给出具体修改建议或改写示例。","交付说明:先列事实错误,再列结构和表达问题。"].join(`
71
+ `),rR=[{id:"build_review_test",workers:[{nameStem:"coder",role:"coder"},{nameStem:"reviewer",role:"reviewer"},{nameStem:"tester",role:"tester"}],goalTemplate:{en:"Implement <feature>: have the Coder implement, Reviewer audit, and Tester verify; describe what to build, key constraints, and validation commands or acceptance criteria.",zh:"实现 X 功能:让 Coder 实现、Reviewer 审查、Tester 验证;写清楚要做什么、关键约束,以及验证命令或验收标准。"}},{id:"research_factcheck",workers:[{nameStem:"researcher",role:"custom",descriptionOverride:{en:X_,zh:Z_}},{nameStem:"factchecker",role:"custom",descriptionOverride:{en:Q_,zh:J_}}],goalTemplate:{en:"Research <topic>: have the Researcher gather evidence and the Factchecker verify it; list questions, trusted sources, and the decision this research should support.",zh:"调研 X 主题:让 Researcher 收集证据、Factchecker 复核;列出要回答的问题、可信来源要求,以及这次调研要支撑的决策。"}},{id:"docs_pipeline",workers:[{nameStem:"drafter",role:"custom",descriptionOverride:{en:eR,zh:tR}},{nameStem:"doc-reviewer",role:"custom",descriptionOverride:{en:nR,zh:aR}}],goalTemplate:{en:"Write <doc>: have the Drafter write and the Doc Reviewer review; state the audience, scope, required sections, and code or files it should describe.",zh:"撰写 X 文档:让 Drafter 撰写、Doc Reviewer 审查;写明读者、范围、必备章节,以及它要描述的代码或文件。"}}],eb={build_review_test:{icon:c.jsx(lE,{size:16,"aria-hidden":!0}),titleKey:"scenario.build_review_test.title",descKey:"scenario.build_review_test.desc"},research_factcheck:{icon:c.jsx(jS,{size:16,"aria-hidden":!0}),titleKey:"scenario.research_factcheck.title",descKey:"scenario.research_factcheck.desc"},docs_pipeline:{icon:c.jsx(i0,{size:16,"aria-hidden":!0}),titleKey:"scenario.docs_pipeline.title",descKey:"scenario.docs_pipeline.desc"}},oR=({workspaceId:t})=>{const{language:a,t:o}=be(),s=sn(),[l,u]=y.useState(null),[f,m]=y.useState(""),[g,p]=y.useState(!1),b=E=>{m(E.goalTemplate[a]),u(E)},v=()=>{g||u(null)},k=()=>{!l||g||!f.trim()||(p(!0),kN(t,l.id,f,a).then(()=>{s.show({kind:"success",message:o("scenario.applied")}),u(null)}).catch(E=>{s.show({kind:"error",message:E instanceof Error?E.message:String(E)})}).finally(()=>p(!1)))};return c.jsxs("div",{className:"mx-auto mt-6 w-full max-w-[420px]","data-testid":"scenario-team-cards",children:[c.jsxs("div",{className:"mb-2 flex items-center justify-center gap-1.5 text-xs font-medium uppercase tracking-wide text-ter",children:[c.jsx(p0,{size:12,"aria-hidden":!0}),o("scenario.sectionTitle")]}),c.jsx("div",{className:"flex flex-col gap-2",children:rR.map(E=>{const S=eb[E.id];return c.jsxs("button",{type:"button",onClick:()=>b(E),className:"rounded border bg-1 p-3 text-left transition-colors hover:bg-3",style:{borderColor:"var(--border)"},"data-testid":`scenario-card-${E.id}`,children:[c.jsxs("div",{className:"flex items-center gap-2 text-pri",children:[S.icon,c.jsx("span",{className:"text-sm font-medium",children:o(S.titleKey)})]}),c.jsx("div",{className:"mt-1 text-xs text-ter",children:o(S.descKey)})]},E.id)})}),c.jsx(Mr,{open:l!==null,onOpenChange:E=>{E||v()},children:c.jsxs(Lr,{children:[c.jsx(zr,{className:"app-overlay fixed inset-0 z-[60]"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-[70] grid place-items-center p-4",children:c.jsxs(Hr,{"data-testid":"scenario-goal-dialog",className:"dialog-scale-pop elev-2 pointer-events-auto w-[480px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},onEscapeKeyDown:E=>{g&&E.preventDefault()},onPointerDownOutside:E=>{g&&E.preventDefault()},children:[c.jsx(Ur,{className:"text-lg font-semibold text-pri",children:l?o(eb[l.id].titleKey):""}),c.jsx(Ko,{className:"mt-1 text-xs text-ter",children:o("scenario.goalHint")}),c.jsxs("label",{className:"mt-4 block",children:[c.jsx("span",{className:"mb-1 block text-xs font-medium text-sec",children:o("scenario.goalLabel")}),c.jsx("textarea",{value:f,onChange:E=>m(E.target.value),rows:5,className:"w-full resize-y rounded border bg-1 p-2 text-sm text-pri outline-none focus:border-[var(--accent)]",style:{borderColor:"var(--border)"},disabled:g,"data-testid":"scenario-goal-input"})]}),c.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"icon-btn",onClick:v,disabled:g,"data-testid":"scenario-goal-cancel",children:o("scenario.cancel")}),c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary disabled:cursor-not-allowed disabled:opacity-50",onClick:k,disabled:g||!f.trim(),"data-testid":"scenario-goal-apply",children:o(g?"scenario.applying":"scenario.apply")})]})]})})]})})]})},px=16e4,sR=/^data:image\/(png|jpeg|webp);base64,([A-Za-z0-9+/]+={0,2})$/,iR=t=>{try{const a=globalThis.atob(t),o=new Uint8Array(a.length);for(let s=0;s<a.length;s+=1)o[s]=a.charCodeAt(s);return o}catch{throw new Error("Worker avatar must be valid base64")}},Of=(t,a)=>t.length>=a.length&&a.every((o,s)=>t[s]===o),lR=(t,a)=>t==="png"?Of(a,[137,80,78,71,13,10,26,10]):t==="jpeg"?Of(a,[255,216,255]):a.length>=12&&Of(a,[82,73,70,70])&&a[8]===87&&a[9]===69&&a[10]===66&&a[11]===80,cR=t=>{if(t==null||t==="")return null;if(typeof t!="string")throw new Error("Worker avatar must be an image data URL or null");const a=t.trim();if(!a)return null;if(a.length>px)throw new Error("Worker avatar is too large");const o=sR.exec(a);if(!o)throw new Error("Worker avatar must be a PNG, JPEG, or WebP data URL");const s=o[1],l=o[2];if(!s||!l)throw new Error("Worker avatar must be a PNG, JPEG, or WebP data URL");const u=iR(l);if(!lR(s,u))throw new Error("Worker avatar data does not match its image type");return a},hx=({size:t,children:a,color:o,fontRatio:s=.4,ringColor:l=null,ringSurface:u="var(--bg-1)",mono:f=!1,decoration:m,testId:g,data:p,className:b="",style:v={}})=>{const k={};if(p)for(const[E,S]of Object.entries(p))S!==void 0&&(k[`data-${E}`]=S);return c.jsxs("span",{"data-testid":g,...k,className:`relative inline-flex shrink-0 items-center justify-center rounded font-semibold ${f?"mono ":""}${b}`.trim(),style:{width:`${t}px`,height:`${t}px`,fontSize:`${Math.round(t*s)}px`,color:o,background:`color-mix(in oklab, ${o} 14%, transparent)`,border:`1px solid color-mix(in oklab, ${o} 35%, transparent)`,boxShadow:l?`0 0 0 2px ${u}, 0 0 0 4px ${l}`:void 0,...v},"aria-hidden":!0,children:[a,m]})},uR={orchestrator:Am,coder:QS,reviewer:OE,tester:Ql,custom:IE},dR={orchestrator:"crown",coder:"code",reviewer:"review",tester:"test",custom:"custom"},fR={orchestrator:"var(--accent)",coder:"var(--status-blue)",reviewer:"var(--status-purple)",tester:"var(--status-orange)",custom:"var(--text-secondary)"},mR={working:"var(--status-green)",idle:"var(--text-tertiary)",stopped:"var(--status-red)"},pR=({role:t,size:a=32,statusRing:o="none"})=>{const s=uR[t];return c.jsx(hx,{size:a,color:fR[t],ringColor:o==="none"?null:mR[o],ringSurface:"var(--bg-2)",testId:"role-avatar",data:{role:t,icon:dR[t],"status-ring":o},children:c.jsx(s,{size:Math.round(a*.56),"aria-hidden":!0})})},hR={agy:{src:"/cli-icons/agy.png",surface:"#f4f4f4"},claude:{src:"/cli-icons/claude.png",surface:"#f7f5f2"},codex:{src:"/cli-icons/codex.png",surface:"#f4f4f4"},cursor:{src:"/cli-icons/cursor.ico",surface:"#ffffff"},gemini:{src:"/cli-icons/gemini.png",surface:"#f4f4f4"},grok:{src:"/cli-icons/grok.ico",surface:"#ffffff"},hermes:{src:"/cli-icons/hermes.png",surface:"#ffffff"},opencode:{src:"/cli-icons/opencode.svg",surface:"#f4f4f4"},pi:{src:"/cli-icons/pi.svg",surface:"#1a1a1a"},qwen:{src:"/cli-icons/qwen.png",surface:"#f4f8ff"}},gR={working:"var(--status-green)",idle:"var(--text-tertiary)",stopped:"var(--status-red)"},gx=t=>t?hR[t]??null:null,i8=({commandPresetId:t,fallback:a=null,size:o=20,testId:s="cli-agent-logo"})=>{const l=gx(t);if(!l)return a;const u=Math.round(o*.78);return c.jsx("span",{"data-testid":s,"data-command-preset":t,className:"inline-flex shrink-0 items-center justify-center overflow-hidden rounded","aria-hidden":!0,style:{width:`${o}px`,height:`${o}px`,background:l.surface,border:"1px solid color-mix(in oklab, var(--text-primary) 12%, transparent)"},children:c.jsx("img",{src:l.src,alt:"",decoding:"sync",width:u,height:u,style:{width:`${u}px`,height:`${u}px`,objectFit:"contain"}})})},Jm=({commandPresetId:t,customAvatar:a,workerRole:o,size:s=32,statusRing:l="none"})=>{const u=l==="none"?null:gR[l];if(a)return c.jsx("span",{"data-testid":"custom-agent-avatar","data-status-ring":l,className:"relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded","aria-hidden":!0,style:{width:`${s}px`,height:`${s}px`,background:"var(--bg-2)",border:"1px solid color-mix(in oklab, var(--text-primary) 12%, transparent)",boxShadow:u?`0 0 0 2px var(--bg-1), 0 0 0 4px ${u}`:void 0},children:c.jsx("img",{src:a,alt:"",decoding:"async",width:s,height:s,style:{width:`${s}px`,height:`${s}px`,objectFit:"cover"}})});const f=gx(t);if(!f)return c.jsx(pR,{role:o,size:s,statusRing:l});const m=Math.round(s*.78);return c.jsx("span",{"data-testid":"cli-agent-avatar","data-command-preset":t,"data-status-ring":l,className:"relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded","aria-hidden":!0,style:{width:`${s}px`,height:`${s}px`,background:f.surface,border:"1px solid color-mix(in oklab, var(--text-primary) 12%, transparent)",boxShadow:u?`0 0 0 2px var(--bg-1), 0 0 0 4px ${u}`:void 0},children:c.jsx("img",{src:f.src,alt:"",decoding:"sync",width:m,height:m,style:{width:`${m}px`,height:`${m}px`,objectFit:"contain"}})})},vR=5*1024*1024,yR=[{quality:.86,size:192,type:"image/webp"},{quality:.78,size:160,type:"image/webp"},{quality:.76,size:128,type:"image/jpeg"}],bR=(t,a)=>new Promise((o,s)=>{const l=URL.createObjectURL(t),u=new Image;u.onload=()=>{URL.revokeObjectURL(l),o(u)},u.onerror=()=>{URL.revokeObjectURL(l),s(new Error(a))},u.src=l}),wR=(t,a)=>{const o=Math.min(t.naturalWidth,t.naturalHeight),s=Math.max(0,Math.floor((t.naturalWidth-o)/2)),l=Math.max(0,Math.floor((t.naturalHeight-o)/2));let u=null;for(const f of yR){const m=document.createElement("canvas");m.width=f.size,m.height=f.size;const g=m.getContext("2d");if(!g)throw new Error("Canvas is not available");g.drawImage(t,s,l,o,o,0,0,f.size,f.size);try{return cR(m.toDataURL(f.type,f.quality))??""}catch(p){u=p}}throw u instanceof Error?u:new Error(a)},tb=async(t,a)=>{if(!t.type.startsWith("image/"))throw new Error(a.notImage);if(t.size>vR)throw new Error(a.sourceTooLarge);const o=await bR(t,a.loadFailed),s=wR(o,a.avatarTooLarge);if(s.length>px)throw new Error(a.avatarTooLarge);return s},xR=({avatar:t,commandPresetId:a,disabled:o=!1,onChange:s,workerRole:l,showStatus:u=!1})=>{const{t:f}=be(),m=y.useRef(null),[g,p]=y.useState(null),[b,v]=y.useState(!1),[k,E]=y.useState(!1),S=T=>{T.preventDefault(),!(o||b)&&E(!0)},w=()=>{E(!1)},C=T=>{if(T.preventDefault(),E(!1),o||b)return;const N=T.dataTransfer.files?.[0];N&&(v(!0),p(null),tb(N,{avatarTooLarge:f("worker.avatarTooLarge"),loadFailed:f("worker.avatarLoadFailed"),notImage:f("worker.avatarNotImage"),sourceTooLarge:f("worker.avatarSourceTooLarge")}).then(j=>s(j)).catch(j=>{p(j instanceof Error?j.message:String(j))}).finally(()=>v(!1)))};return c.jsxs("div",{className:"flex flex-col items-start gap-2 w-full",children:[c.jsx("span",{className:"text-sm font-semibold text-sec",children:f("worker.avatar")}),c.jsxs("div",{className:"flex w-full items-center gap-4 py-2 select-none",onDragOver:S,onDragLeave:w,onDrop:C,children:[c.jsxs("button",{type:"button",className:"group relative shrink-0 rounded overflow-hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 transition-all duration-200 cursor-pointer shadow-sm hover:shadow-md hover:scale-[1.02]",style:{transform:k?"scale(1.05)":"none",boxShadow:k?"0 0 0 2px var(--accent)":void 0},disabled:o||b,onClick:()=>m.current?.click(),"aria-label":f("worker.avatarUpload"),children:[c.jsx(Jm,{commandPresetId:a,customAvatar:t,workerRole:l,size:56}),c.jsx("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-center justify-center text-white",children:c.jsx(by,{size:16})})]}),c.jsxs("div",{className:"flex flex-col justify-center gap-2 min-w-0 flex-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsxs("button",{type:"button",className:"icon-btn h-8 rounded-md px-3 text-xs flex items-center gap-1.5 font-medium transition-colors",disabled:o||b,onClick:()=>m.current?.click(),children:[c.jsx(by,{size:12,"aria-hidden":!0}),f(b?"common.loading":"worker.avatarUpload")]}),t?c.jsxs("button",{type:"button",className:"icon-btn icon-btn--ghost h-8 rounded-md px-3 text-xs flex items-center gap-1.5 transition-colors",disabled:o||b,onClick:()=>{p(null),s(null)},children:[c.jsx(xc,{size:12,"aria-hidden":!0}),f("worker.avatarDefault")]}):null,u?c.jsxs("div",{className:"flex items-center gap-1.5 text-xs select-none ml-1 shrink-0",style:{color:t?"var(--text-primary)":"var(--text-tertiary)"},children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:t?"var(--accent)":"var(--text-tertiary)"}}),c.jsx("span",{className:"font-medium",children:f(t?"worker.avatarUsingCustom":"worker.avatarUsingDefault")})]}):null]}),c.jsx("p",{className:"text-xs text-ter leading-normal",children:f("worker.avatarHelpText")}),c.jsx("input",{ref:m,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",disabled:o||b,onChange:T=>{const N=T.currentTarget.files?.[0];T.currentTarget.value="",N&&(v(!0),p(null),tb(N,{avatarTooLarge:f("worker.avatarTooLarge"),loadFailed:f("worker.avatarLoadFailed"),notImage:f("worker.avatarNotImage"),sourceTooLarge:f("worker.avatarSourceTooLarge")}).then(j=>s(j)).catch(j=>{p(j instanceof Error?j.message:String(j))}).finally(()=>v(!1)))}}),g?c.jsx("span",{className:"text-xs font-semibold px-2.5 py-1 rounded-lg bg-red-500/10 border border-red-500/15 w-fit",style:{color:"var(--status-red)"},children:g}):null]})]})]})},kR=({onClose:t,onSave:a,worker:o})=>{const{t:s}=be(),l=yt(),[u,f]=y.useState(o.avatar??null),[m,g]=y.useState(!1),[p,b]=y.useState(null),v=u!==(o.avatar??null),k=()=>{g(!0),b(null),a(u).then(E=>{if(E.error){b(E.error);return}t()}).catch(E=>b(E instanceof Error?E.message:String(E))).finally(()=>g(!1))};return c.jsx(Mr,{open:!0,onOpenChange:E=>E?void 0:t(),children:c.jsxs(Lr,{children:[c.jsx(zr,{className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4 max-md:items-end max-md:p-0",children:c.jsxs(Hr,{className:`${l?"dialog-slide-up max-md:w-full max-md:rounded-b-none max-md:rounded-t-xl":"dialog-scale-pop w-[420px] max-w-full"} elev-2 pointer-events-auto flex flex-col gap-4 rounded-lg border p-4`,style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx(Ur,{className:"text-base font-semibold text-pri",children:s("worker.avatarTitle")}),c.jsx(Ko,{className:"mt-1 truncate text-sm text-ter",children:o.name})]}),c.jsx(YT,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":s("common.closeDialog"),className:"icon-btn icon-btn--ghost h-8 w-8 px-0 justify-center",children:c.jsx(fa,{size:16,"aria-hidden":!0})})})]}),c.jsx(xR,{avatar:u,commandPresetId:o.commandPresetId,disabled:m,onChange:f,workerRole:o.role}),p?c.jsx("div",{className:"text-sm",style:{color:"var(--status-red)"},children:p}):null,c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"icon-btn",onClick:t,children:s("common.cancel")}),c.jsxs("button",{type:"button",className:"icon-btn icon-btn--primary",disabled:!v||m,onClick:k,children:[c.jsx(ga,{size:14,"aria-hidden":!0}),s(m?"common.saving":"common.save")]})]})]})})]})})},vx=({initialValue:t,saving:a,setSaving:o,onSave:s,onCancel:l,className:u})=>{const f=sn(),[m,g]=y.useState(t),p=y.useRef(null),b=y.useRef(!1);y.useEffect(()=>{const S=setTimeout(()=>{p.current?.focus(),p.current?.select()},50);return()=>clearTimeout(S)},[]);const v=async()=>{const S=m.trim();if(!S||S===t){l();return}o(!0);try{const w=await s(S);if(w.error){f.show({kind:"error",message:w.error}),g(t),setTimeout(()=>{p.current?.focus(),p.current?.select()},50),o(!1);return}}catch(w){const C=w instanceof Error?w.message:"Failed to rename worker";f.show({kind:"error",message:C}),g(t),setTimeout(()=>{p.current?.focus(),p.current?.select()},50),o(!1);return}o(!1),l()},k=S=>{S.stopPropagation(),S.key==="Enter"?(S.preventDefault(),v()):S.key==="Escape"&&(S.preventDefault(),b.current=!0,l())},E=()=>{b.current||v()};return c.jsx("input",{ref:p,type:"text",value:m,disabled:a,onChange:S=>g(S.target.value),onKeyDown:k,onBlur:E,maxLength:64,className:u,onClick:S=>S.stopPropagation()})},yx=t=>t.status==="working"?{kind:"working",label:"working",dotClass:"status-dot status-dot--working",tone:"var(--status-green)"}:t.status==="stopped"?{kind:"stopped",label:"stopped",dotClass:"status-dot status-dot--stopped",tone:"var(--status-red)"}:{kind:"idle",label:"idle",dotClass:"status-dot status-dot--idle",tone:"var(--text-tertiary)"},l8=t=>t?{kind:"working",label:"running",dotClass:"status-dot status-dot--working",tone:"var(--status-green)"}:{kind:"stopped",label:"stopped",dotClass:"status-dot status-dot--stopped",tone:"var(--status-red)"},bx={working:"pill--green",idle:"pill--ghost",stopped:"pill--red"},wx=t=>`role.${t}`,uc=t=>t==="working"?"common.running":t==="idle"?"common.idle":"common.stopped",SR=({hasRun:t,isPending:a=!1,isEditing:o=!1,onRenameWorker:s,onStartEditing:l,onCancelEditing:u,onAction:f,onClick:m,worker:g})=>{const{t:p}=be(),b=yt(),v=yx(g),[k,E]=y.useState(!1),S=j=>A=>{if(A.stopPropagation(),j==="rename"){l?.();return}f?.(j,g)},w=g.ephemeral===!0&&g.spawnedBy==="workflow",C=g.ephemeral===!0&&g.spawnedBy==="orchestrator",T=w?"workflow":C?"orchestrator":null;if(b)return c.jsx(ER,{ephemeralTone:T,hasRun:t,isPending:a,onAction:f,onClick:m,status:v,worker:g,isEditing:o,onRenameWorker:s,onCancelEditing:u});const N=o?"div":"button";return c.jsxs("div",{className:"worker-card-shell relative","data-status":v.kind,"data-worker-name":g.name,"data-ephemeral":g.ephemeral===!0?"true":void 0,"data-spawned-by":g.spawnedBy??void 0,"data-mobile":b?"true":void 0,children:[c.jsxs(N,{type:o?void 0:"button",onClick:o?void 0:()=>m(g),"aria-label":o?void 0:p("worker.open",{name:g.name}),className:`card worker-card relative flex w-full flex-col gap-3 overflow-hidden p-4 text-left ${o?"":"card--interactive"}`,"data-testid":`worker-card-${g.id}`,"data-status":v.kind,style:T?{borderStyle:"dashed",borderColor:T==="workflow"?"var(--accent)":"var(--border-bright)"}:void 0,children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Jm,{commandPresetId:g.commandPresetId,customAvatar:g.avatar,workerRole:g.role,size:40,statusRing:v.kind}),T?c.jsx("span",{className:"ml-auto rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",style:{background:T==="workflow"?"color-mix(in oklab, var(--accent) 18%, transparent)":"color-mix(in oklab, var(--text-secondary) 14%, transparent)",color:T==="workflow"?"var(--accent)":"var(--text-secondary)"},"data-testid":"worker-card-ephemeral-badge",title:T==="workflow"?"Spawned by a workflow run — auto-dismissed when its dispatch reports back.":"Spawned by the orchestrator via `team spawn` — auto-dismissed when the orchestrator exits.",children:T==="workflow"?"workflow":"temp"}):null]}),c.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o?c.jsx(vx,{initialValue:g.name,saving:k,setSaving:E,onSave:j=>s(g,j),onCancel:()=>u?.(),className:"worker-card-name-input"}):c.jsx("span",{className:"truncate text-base font-medium leading-tight text-pri",title:g.name,children:g.name}),c.jsx("span",{className:"worker-card__role-tag truncate leading-none mt-1",children:p(wx(g.role))})]}),c.jsx("div",{className:"flex min-w-0 flex-col gap-1.5",children:c.jsx("div",{className:"flex items-center gap-1.5",children:c.jsxs("span",{className:`pill ${bx[v.kind]} worker-card__status`,role:"status",title:v.kind==="working"?p("worker.workingLegend"):p(uc(v.kind)),children:[c.jsx("span",{className:v.dotClass,"aria-hidden":!0}),p(uc(v.kind))]})})})]}),f?c.jsxs("div",{className:"worker-card__actions",children:[t?b?c.jsxs(c.Fragment,{children:[c.jsx(jo,{title:p("common.stop"),onClick:S("stop"),disabled:a,variant:"danger",testId:`worker-card-stop-${g.id}`,ariaLabel:p("worker.stopAria",{name:g.name}),children:c.jsx(h0,{size:12,"aria-hidden":!0})}),c.jsx(jo,{title:p("common.restart"),onClick:S("restart"),disabled:a,testId:`worker-card-restart-${g.id}`,ariaLabel:p("worker.restartAria",{name:g.name}),children:c.jsx(xc,{size:12,"aria-hidden":!0})})]}):null:c.jsx(jo,{title:p("common.start"),onClick:S("start"),disabled:a,variant:"primary",testId:`worker-card-start-${g.id}`,ariaLabel:p("worker.startAria",{name:g.name}),children:c.jsx(Po,{size:12,"aria-hidden":!0})}),c.jsx(jo,{title:p("worker.rename"),onClick:S("rename"),disabled:a||v.kind==="working",testId:`worker-card-rename-${g.id}`,ariaLabel:p("worker.renameAria",{name:g.name}),children:c.jsx(f0,{size:12,"aria-hidden":!0})}),c.jsx(jo,{title:p("worker.avatarChange"),onClick:S("avatar"),disabled:a,testId:`worker-card-avatar-${g.id}`,ariaLabel:p("worker.avatarChangeAria",{name:g.name}),children:c.jsx(c0,{size:12,"aria-hidden":!0})}),c.jsx(jo,{title:p("common.delete"),onClick:S("delete"),variant:"danger",testId:`worker-card-delete-${g.id}`,ariaLabel:p("worker.deleteAria",{name:g.name}),children:c.jsx(Sc,{size:12,"aria-hidden":!0})})]}):null]})},jo=({ariaLabel:t,children:a,disabled:o,onClick:s,testId:l,title:u,variant:f="default"})=>c.jsx(Je,{label:u,children:c.jsx("button",{type:"button",onClick:s,disabled:o,"aria-label":t,"data-testid":l,"data-variant":f,className:"worker-card__action",children:a})}),ER=({ephemeralTone:t,hasRun:a,isPending:o,onAction:s,onClick:l,status:u,worker:f,isEditing:m=!1,onRenameWorker:g,onCancelEditing:p})=>{const{t:b}=be(),[v,k]=y.useState(!1),[E,S]=y.useState(!1),w=y.useRef(!1),C=j=>{j==="rename"&&(w.current=!0),k(!1),s?.(j,f)},T=b(wx(f.role)),N=m?"div":"button";return c.jsxs("div",{className:"worker-card-shell relative","data-status":u.kind,"data-worker-name":f.name,"data-ephemeral":f.ephemeral===!0?"true":void 0,"data-spawned-by":f.spawnedBy??void 0,"data-mobile":"true",children:[c.jsxs(N,{type:m?void 0:"button",onClick:m?void 0:()=>l(f),"aria-label":m?void 0:b("worker.open",{name:f.name}),className:`card worker-card flex w-full items-center gap-3 p-3 pr-12 text-left ${m?"":"card--interactive"}`,"data-testid":`worker-card-${f.id}`,"data-status":u.kind,style:t?{borderStyle:"dashed",borderColor:t==="workflow"?"var(--accent)":"var(--border-bright)"}:void 0,children:[c.jsx(Jm,{commandPresetId:f.commandPresetId,customAvatar:f.avatar,workerRole:f.role,size:40,statusRing:u.kind}),c.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[c.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[m?c.jsx(vx,{initialValue:f.name,saving:E,setSaving:S,onSave:j=>g(f,j),onCancel:()=>p?.(),className:"worker-card-name-input flex-1"}):c.jsx("span",{className:"truncate text-sm font-medium text-pri",children:f.name}),t?c.jsx("span",{className:"shrink-0 rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",style:{background:t==="workflow"?"color-mix(in oklab, var(--accent) 18%, transparent)":"color-mix(in oklab, var(--text-secondary) 14%, transparent)",color:t==="workflow"?"var(--accent)":"var(--text-secondary)"},"data-testid":"worker-card-ephemeral-badge",children:t==="workflow"?"workflow":"temp"}):null]}),c.jsx("span",{className:"truncate text-xs text-ter",children:T})]}),c.jsxs("span",{className:`pill ${bx[u.kind]} worker-card__status shrink-0`,role:"status",children:[c.jsx("span",{className:u.dotClass,"aria-hidden":!0}),b(uc(u.kind))]})]}),s?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button","aria-label":b("worker.actionsAria",{name:f.name}),"data-testid":`worker-card-menu-${f.id}`,onClick:()=>k(!0),className:"absolute top-1/2 right-1 z-[2] flex h-11 w-11 -translate-y-1/2 items-center justify-center rounded-md text-ter",children:c.jsx(nE,{size:18,"aria-hidden":!0})}),c.jsx(Mr,{open:v,onOpenChange:k,children:c.jsxs(Lr,{children:[c.jsx(zr,{className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid items-end",children:c.jsxs(Hr,{onCloseAutoFocus:j=>{w.current&&(j.preventDefault(),w.current=!1)},"data-testid":`worker-action-sheet-${f.id}`,className:"dialog-slide-up elev-2 pointer-events-auto flex w-full flex-col overflow-hidden rounded-t-xl border-t pb-[max(8px,env(safe-area-inset-bottom))]",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs(Ur,{className:"flex items-center gap-2 border-b px-4 py-3 text-sm font-semibold text-pri",style:{borderColor:"var(--border)"},children:[c.jsx("span",{className:"truncate",children:f.name}),c.jsx("span",{className:"shrink-0 text-xs font-normal text-ter",children:b(uc(u.kind))})]}),c.jsx(Ko,{className:"sr-only",children:b("worker.actionsAria",{name:f.name})}),a?c.jsxs(c.Fragment,{children:[c.jsx(Ao,{disabled:o,icon:c.jsx(h0,{size:16,"aria-hidden":!0}),label:b("common.stop"),onSelect:()=>C("stop"),testId:`worker-card-stop-${f.id}`,danger:!0}),c.jsx(Ao,{disabled:o,icon:c.jsx(xc,{size:16,"aria-hidden":!0}),label:b("common.restart"),onSelect:()=>C("restart"),testId:`worker-card-restart-${f.id}`})]}):c.jsx(Ao,{disabled:o,icon:c.jsx(Po,{size:16,"aria-hidden":!0}),label:b("common.start"),onSelect:()=>C("start"),testId:`worker-card-start-${f.id}`}),c.jsx(Ao,{disabled:o||u.kind==="working",icon:c.jsx(f0,{size:16,"aria-hidden":!0}),label:b("worker.rename"),onSelect:()=>C("rename"),testId:`worker-card-rename-${f.id}`}),c.jsx(Ao,{disabled:o,icon:c.jsx(c0,{size:16,"aria-hidden":!0}),label:b("worker.avatarChange"),onSelect:()=>C("avatar"),testId:`worker-card-avatar-${f.id}`}),c.jsx(Ao,{icon:c.jsx(Sc,{size:16,"aria-hidden":!0}),label:b("common.delete"),onSelect:()=>C("delete"),testId:`worker-card-delete-${f.id}`,danger:!0})]})})]})})]}):null]})},Ao=({danger:t=!1,disabled:a=!1,icon:o,label:s,onSelect:l,testId:u})=>c.jsxs("button",{type:"button",disabled:a,"data-testid":u,onClick:l,className:"flex min-h-12 w-full items-center gap-3 px-4 text-left text-sm disabled:opacity-50",style:{color:t?"var(--status-red)":"var(--text-primary)"},children:[o,s]}),CR=["working","idle","stopped"],nb=t=>t==="working"?"common.running":t==="idle"?"common.idle":"common.stopped",TR=t=>{const a={idle:[],working:[],stopped:[]};for(const o of t)a[yx(o).kind].push(o);return{sections:CR.filter(o=>a[o].length>0).map(o=>({kind:o,workers:a[o]})),summary:{idle:a.idle.length,stopped:a.stopped.length,working:a.working.length}}},NR=({onAddWorkerClick:t,onDeleteWorker:a,onOpenShellTerminal:o,onOpenWorker:s,onRenameWorker:l,onUpdateWorkerAvatar:u,onStopWorker:f,onRestartWorker:m,onStartWorker:g,shellTerminalAvailable:p=!0,startingWorkerId:b,terminalRuns:v,workers:k,workspaceId:E})=>{const{t:S}=be(),{sections:w,summary:C}=y.useMemo(()=>TR(k),[k]),T=y.useMemo(()=>new Map(v.map(Q=>[Q.agent_id,Q.run_id])),[v]),[N,j]=y.useState(null),[A,O]=y.useState(null),[D,L]=y.useState(null),P=(Q,$)=>{if(Q==="start"){g($);return}if(Q==="stop"){const F=T.get($.id);F&&f?.(F);return}if(Q==="restart"){const F=T.get($.id);F&&m?.($.id,F);return}if(Q==="rename"){L($.id);return}if(Q==="avatar"){O($);return}Q==="delete"&&j($)},J=()=>{N&&(a(N),j(null))};return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",style:{background:"var(--bg-2)"},"data-testid":"workers-pane",children:[c.jsxs("div",{className:"flex shrink-0 flex-col gap-1 px-4 pt-3 pb-2.5",style:{boxShadow:"inset 0 -1px 0 var(--border)"},children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx("span",{className:"text-lg font-semibold text-pri",children:S("worker.teamMembers")}),c.jsx("span",{className:"mono inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-3 px-1 text-[11px] font-medium tabular-nums leading-none text-sec",children:k.length}),c.jsx("div",{className:"flex-1"}),p?c.jsxs("button",{type:"button",onClick:o,className:"icon-btn icon-btn--tertiary","aria-label":S("shellTerminal.openAria"),"data-testid":"open-workspace-shell",children:[c.jsx(kc,{size:14,"aria-hidden":!0})," ",S("shellTerminal.open")]}):null,c.jsxs("button",{type:"button",onClick:t,className:"icon-btn icon-btn--primary","data-testid":"add-worker-trigger",children:[c.jsx(lf,{size:14,"aria-hidden":!0})," ",S("addWorker.create")]})]}),k.length>0?c.jsxs("div",{className:"flex items-center gap-3 text-xs text-ter",children:[c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{className:"status-dot status-dot--working","aria-hidden":!0}),c.jsx("span",{className:"text-sec",children:C.working})," ",S("common.running")]}),c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{className:"status-dot status-dot--idle","aria-hidden":!0}),c.jsx("span",{className:"text-sec",children:C.idle})," ",S("common.idle")]}),c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{className:"status-dot status-dot--stopped","aria-hidden":!0}),c.jsx("span",{className:"text-sec",children:C.stopped})," ",S("common.stopped")]})]}):null]}),c.jsx("div",{className:"workers-pane-body scroll-y min-h-0 min-w-0 flex-1 px-2 py-2",children:k.length===0?c.jsxs(c.Fragment,{children:[c.jsx(mi,{icon:c.jsx(lf,{size:28}),title:S("worker.emptyTitle"),description:S("worker.emptyDesc"),action:c.jsxs("button",{type:"button",onClick:t,className:"icon-btn icon-btn--primary","data-testid":"add-worker-empty",children:[c.jsx(lf,{size:14,"aria-hidden":!0})," ",S("worker.emptyAdd")]})}),E?c.jsx(oR,{workspaceId:E}):null]}):c.jsx("div",{"data-testid":"worker-grid",children:w.map(Q=>c.jsxs("section",{className:"mb-3 last:mb-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium uppercase tracking-wide text-ter",children:[S(nb(Q.kind)),c.jsx("span",{className:"mono inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-1 text-[11px] font-medium tabular-nums leading-none",children:Q.workers.length})]}),c.jsx("ul",{"aria-label":`${S(nb(Q.kind))} team members`,className:"worker-card-grid",children:Q.workers.map($=>c.jsx("li",{children:c.jsx(SR,{hasRun:T.has($.id),isPending:b===$.id||$.status==="working"&&!T.has($.id),isEditing:D===$.id,onRenameWorker:async(F,ne)=>k.some(q=>q.id!==F.id&&q.name.toLowerCase()===ne.toLowerCase())?{error:S("addWorker.agentExists")}:l(F,ne),onStartEditing:()=>L($.id),onCancelEditing:()=>L(null),onAction:P,onClick:s,worker:$})},$.id))})]},Q.kind))})}),c.jsx(pi,{open:N!==null,onOpenChange:Q=>{Q||j(null)},title:N?S("worker.deleteConfirm",{name:N.name}):"",description:N?S("worker.deleteDescription",{name:N.name}):"",confirmLabel:S("worker.deleteMember"),confirmKind:"danger",onConfirm:J}),A?c.jsx(kR,{worker:A,onClose:()=>O(null),onSave:Q=>u(A.id,Q)}):null]})},jR=y.lazy(()=>Mt(()=>import("./AddWorkerDialog-BrvNv3RW.js"),__vite__mapDeps([2,3,4])).then(t=>({default:t.AddWorkerDialog}))),AR=y.lazy(()=>Mt(()=>import("./WorkerModal-DxAQnNYF.js"),[]).then(t=>({default:t.WorkerModal}))),_R=({activeWorkerId:t,onCreateWorker:a,onDeleteWorker:o,onDeleteWorkspace:s,onUpdateWorkerAvatar:l,onStartWorker:u,onStopWorker:f,onRestartWorker:m,onOrchestratorResult:g,onOrchestratorRunClosed:p,onRequestAddWorkspace:b,onShellRunClosed:v,onShellRunStarted:k,onTryDemo:E,welcomeDisabledReason:S,orchestratorAutostartError:w,terminalRuns:C,workers:T,workspace:N,onActiveWorkerChange:j,showInlineActionCenter:A=!0})=>{const{t:O}=be(),D=yt(),[L,P]=y.useState(null),J=t===void 0?L:t,Q=y.useCallback(de=>{j?j(de):P(de)},[j]),[$,F]=y.useState(!1),[ne,Z]=y.useState("orchestrator"),q=nx();y.useEffect(()=>()=>tx(!1),[]);const[M,U]=y.useState(null),[W,G]=y.useState(null),[V,R]=y.useState(null),[B,se]=y.useState(!1),re=sn(),ce=$_({createWorker:a,open:$,workers:T}),fe=W_({workspaceId:N?.id??"",terminalRuns:C,autostartError:w,onClearAutostartError:()=>{N&&g(N.id,{ok:!0,error:null,run_id:null})},onAfterStart:de=>{N&&g(N.id,de)},onRunClosed:p}),ue=__(),le=T.find(de=>de.id===J)??null;y.useEffect(()=>{J&&!le&&Q(null)},[J,le,Q]);const ie=b_({workspaceId:N?.id??"",workers:T,terminalRuns:C}),xe=ie.tabs.filter(de=>de.kind==="shell"),Ne=N?C.filter(de=>ti(de,N.id)):[],{closeShellTab:he,openShell:we,shellError:Ce,shellStarting:Ae,startNewShell:pt}=j_({onCloseFailed:de=>re.show({kind:"error",message:O("shellTerminal.closeFailed",{message:de})}),onShellRunClosed:v,onShellRunStarted:k,panelTabs:ie,shellRuns:Ne,workspaceId:N?.id??null});if(y.useEffect(()=>{ce.createWorkerError&&re.show({kind:"error",message:ce.createWorkerError})},[ce.createWorkerError,re]),y.useEffect(()=>{M&&re.show({kind:"error",message:M})},[M,re]),y.useEffect(()=>{W&&re.show({kind:"error",message:W})},[W,re]),y.useEffect(()=>{Ce&&re.show({kind:"error",message:Ce})},[Ce,re]),y.useEffect(()=>{Q(null),U(null),G(null),R(null),se(!1),Z("orchestrator")},[N?.id,Q]),!N){const de={onAddWorkspace:b};return E&&(de.onTryDemo=E),S&&(de.disabledReason=S),c.jsx(G_,{...de})}const dt=le?N_(C,le.id):void 0,wn=de=>{U(null),o(de.id).then(()=>Q(null)).catch(Ue=>{U(Ue instanceof Error?Ue.message:String(Ue))})},Nt=de=>{G(null),R(de.id),u(de.id).then(({error:Ue})=>{Ue&&G(Ue)}).catch(Ue=>{G(Ue instanceof Error?Ue.message:String(Ue))}).finally(()=>R(null))},Fn=de=>{f(de).then(({error:Ue})=>{Ue&&re.show({kind:"error",message:Ue})})},ft=(de,Ue)=>{G(null),R(de),m(de,Ue).then(({error:st})=>{st&&G(st)}).catch(st=>{G(st instanceof Error?st.message:String(st))}).finally(()=>R(null))},zt=async(de,Ue)=>{try{return await EN(N.id,de.id,Ue),re.show({kind:"success",message:O("worker.renameSuccess",{name:Ue})}),{error:null}}catch(st){const Kn=st instanceof Error?st.message:String(st);return re.show({kind:"error",message:O("worker.renameFailed",{message:Kn})}),{error:Kn}}},ln=`${(ue.orchPct*100).toFixed(2)}%`,Se=()=>{se(!1),we()},nt=()=>{se(!1),pt()},ar=c.jsx(B_,{state:fe.state,onRemoveWorkspace:()=>{s(N).catch(de=>{const Ue=de instanceof Error?de.message:String(de);re.show({kind:"error",message:`Delete failed: ${Ue}`})})},onStart:fe.start,onRestart:fe.restart}),rr=c.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[c.jsx(NR,{onAddWorkerClick:()=>F(!0),onDeleteWorker:wn,onOpenShellTerminal:Se,onOpenWorker:de=>Q(de.id),onRenameWorker:zt,onUpdateWorkerAvatar:l,onStartWorker:Nt,onStopWorker:Fn,onRestartWorker:ft,startingWorkerId:V,terminalRuns:C,workers:T,workspaceId:N.id}),B?null:c.jsx(h_,{tabs:xe,activeId:ie.activeId,scopeKey:N.id,onSelect:ie.setActive,onClose:de=>{de.startsWith("shell:")&&he(de.slice(6)),ie.closeTab(de)},onClosePanel:()=>se(!0),onNewShell:nt,newShellPending:Ae,onStartWorker:de=>{const Ue=T.find(st=>st.id===de);Ue&&Nt(Ue)},startingWorkerId:V})]});return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",style:{background:"var(--bg-2)"},children:[c.jsx(i_,{terminalRuns:C,workers:T,workspace:N}),A?c.jsx(XA,{workspaceId:N.id,onOpenWorker:Q},N.id):null,D?c.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden","data-mobile":"true","data-testid":"workspace-detail-panes",children:[c.jsxs("div",{role:"tablist","aria-label":O("mobile.nav.team"),className:"flex shrink-0 items-center gap-1 border-b p-2",style:{borderColor:"var(--border)"},children:[["orchestrator","workers"].map(de=>{const Ue=ne===de,st=`mobile-team-tab-${de}`,Kn=`mobile-team-panel-${de}`;return c.jsxs("button",{id:st,type:"button",role:"tab","aria-selected":Ue,"aria-controls":Kn,tabIndex:Ue?0:-1,"data-active":Ue||void 0,"data-testid":st,onClick:()=>Z(de),className:"flex min-h-11 flex-1 items-center justify-center gap-1.5 rounded-md text-sm font-medium",style:Ue?{background:"var(--accent)",color:"var(--bg-0)"}:{background:"var(--bg-3)",color:"var(--text-secondary)"},children:[c.jsx("span",{children:O(de==="orchestrator"?"mobile.team.orchestrator":"mobile.team.workers")}),de==="workers"&&T.length>0?c.jsx("span",{className:"inline-flex items-center justify-center rounded-full min-w-[18px] h-[18px] px-1 text-[11px] font-medium tabular-nums leading-none",style:Ue?{background:"var(--bg-0)",color:"var(--accent)"}:{background:"var(--bg-1)",color:"var(--text-secondary)"},children:T.length}):null]},de)}),c.jsx("button",{type:"button",onClick:QA,"aria-pressed":q,"aria-label":O(q?"mobile.focus.exit":"mobile.focus.enter"),"data-testid":"mobile-focus-toggle",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-md",style:{background:"var(--bg-3)",color:"var(--text-secondary)"},children:q?c.jsx(kE,{size:16,"aria-hidden":!0}):c.jsx(wE,{size:16,"aria-hidden":!0})})]}),c.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1 overflow-hidden","data-testid":"mobile-team-panel",children:[c.jsx("div",{id:"mobile-team-panel-orchestrator",role:"tabpanel","aria-labelledby":"mobile-team-tab-orchestrator","aria-hidden":ne!=="orchestrator",className:"mobile-team-pane flex min-h-0 min-w-0 flex-col","data-active":ne==="orchestrator"?"true":"false",children:ar}),c.jsx("div",{id:"mobile-team-panel-workers",role:"tabpanel","aria-labelledby":"mobile-team-tab-workers","aria-hidden":ne!=="workers",className:"mobile-team-pane flex min-h-0 min-w-0 flex-col","data-active":ne==="workers"?"true":"false",children:rr})]})]}):c.jsxs("div",{ref:ue.containerRef,className:"relative flex min-h-0 min-w-0 flex-1 overflow-hidden","data-testid":"workspace-detail-panes",children:[c.jsx("div",{className:"flex min-w-[480px] shrink-0 flex-col overflow-hidden",style:{width:ln},"data-testid":"orchestrator-pane-shell",children:ar}),c.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":O("workerPane.resize"),"aria-valuenow":Math.round(ue.orchPct*100),"aria-valuemin":30,"aria-valuemax":78,tabIndex:0,className:"pane-splitter",style:{left:`calc(${ln} - 4px)`},"data-dragging":ue.dragging||void 0,"data-testid":"pane-splitter",onPointerDown:ue.beginDrag,onKeyDown:ue.onKeyDown}),rr]}),le?c.jsx(y.Suspense,{fallback:null,children:c.jsx(AR,{onClose:()=>Q(null),onStart:Nt,runId:dt?.run_id??null,startError:W,starting:V===le.id,worker:le})}):null,$?c.jsx(y.Suspense,{fallback:null,children:c.jsx(jR,{avatar:ce.avatar,commandPresets:ce.commandPresets,commandPresetId:ce.commandPresetId,creating:ce.creating,customTemplates:ce.customTemplates,onApplyMarketplaceImport:ce.applyMarketplaceImport,onAvatarChange:ce.setAvatar,onClose:()=>F(!1),onDeleteTemplate:ce.deleteTemplate,onNameChange:ce.setWorkerName,onPresetChange:ce.setCommandPresetId,onRandomName:ce.randomizeWorkerName,onRoleDescriptionChange:ce.setRoleDescription,onRoleDescriptionReset:ce.resetRoleDescription,onRoleChange:ce.setWorkerRole,onSaveAsTemplate:ce.saveAsTemplate,onSubmit:de=>ce.submit(de,()=>F(!1)),onStartupCommandChange:ce.setStartupCommand,onTemplateChange:ce.selectTemplate,roleDescription:ce.roleDescription,roleDescriptionDefault:ce.roleDescriptionDefault,selectedTemplateId:ce.selectedTemplateId,startupCommand:ce.startupCommand,templateBusy:ce.templateBusy,workerName:ce.workerName,workerRole:ce.workerRole})}):null]})},RR=({activeId:t,activeWorkspace:a,activeWorkerId:o,bootstrapError:s,demoMode:l,onActiveWorkerChange:u,onDeleteWorkspace:f,onExitDemo:m,onOrchestratorRunClosed:g,onRequestAddWorkspace:p,onShellRunClosed:b,onShellRunStarted:v,onTryDemo:k,orchestratorAutostartErrors:E,recordOrchestratorResult:S,terminalRuns:w,workerActions:C,workers:T,workspacesLoading:N,showInlineActionCenter:j})=>l?c.jsx(pC,{onExit:m}):N&&!a?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(Ja,{size:24,className:"animate-spin text-ter"})}):c.jsx(_R,{activeWorkerId:o,onCreateWorker:C.createWorker,onDeleteWorker:C.deleteWorker,onDeleteWorkspace:f,onUpdateWorkerAvatar:C.updateWorkerAvatar,onStartWorker:C.startWorker,onStopWorker:C.stopWorkerRun,onRestartWorker:C.restartWorkerRun,onOrchestratorResult:S,onOrchestratorRunClosed:g,onRequestAddWorkspace:p,onShellRunClosed:b,onShellRunStarted:v,onTryDemo:k,onActiveWorkerChange:u,welcomeDisabledReason:s??void 0,orchestratorAutostartError:t?E[t]??null:null,terminalRuns:w,workers:T,workspace:a,showInlineActionCenter:j}),Wl={id:"demo-workspace",name:"demo-todo-app",path:"/Users/you/demo-todo-app"},OR=[{id:"demo-coder",name:"ada-lovelace",role:"coder",status:"working",pendingTaskCount:1,lastPtyLine:"Editing src/routes/todos.ts (line 42)",commandPresetId:"claude"},{id:"demo-reviewer",name:"socrates",role:"reviewer",status:"idle",pendingTaskCount:0,commandPresetId:"gemini"}],DR=`# Todo app
74
72
 
75
73
  - [x] Set up Express server
76
74
  - [x] Add /todos GET endpoint
77
75
  - [ ] Add /todos POST endpoint
78
76
  - [ ] Write Vitest for both endpoints
79
77
  - [ ] Wire up SQLite for persistence
80
- `,UR=()=>{const[t,a]=y.useState(!1);return{demoMode:t,enableDemo:()=>a(!0),exitDemo:()=>a(!1)}},BR=t=>{const{demoMode:a,workspaces:o,activeWorkspaceId:s,workersByWorkspaceId:l}=t,u=a?[Wl]:o,f=a?{[Wl.id]:zR}:l,m=a?Wl.id:s,g=a?Wl:o?.find(b=>b.id===s);return{effectiveActiveWorkspaceId:m,effectiveWorkspaces:u,effectiveWorkersByWorkspaceId:f,effectiveActiveWorkspace:g,pollWorkspaceId:a?null:s}},WR=[{accent:"var(--status-green)",descriptionKey:"notifications.sound.soft.description",labelKey:"notifications.sound.soft.label",length:"short",value:"soft"},{accent:"var(--status-blue)",descriptionKey:"notifications.sound.ping.description",labelKey:"notifications.sound.ping.label",length:"short",value:"ping"},{accent:"var(--status-gold)",descriptionKey:"notifications.sound.chime.description",labelKey:"notifications.sound.chime.label",length:"short",value:"chime"},{accent:"var(--accent)",descriptionKey:"notifications.sound.cascade.description",labelKey:"notifications.sound.cascade.label",length:"long",value:"cascade"},{accent:"var(--status-orange)",descriptionKey:"notifications.sound.beacon.description",labelKey:"notifications.sound.beacon.label",length:"long",value:"beacon"},{accent:"var(--status-purple)",descriptionKey:"notifications.sound.resolve.description",labelKey:"notifications.sound.resolve.label",length:"long",value:"resolve"},{accent:"var(--text-tertiary)",descriptionKey:"notifications.sound.off.description",labelKey:"notifications.sound.off.label",length:"silent",value:"off"}],IR=[{descriptionKey:"notifications.detail.brief.description",labelKey:"notifications.detail.brief.label",value:"brief"},{descriptionKey:"notifications.detail.detailed.description",labelKey:"notifications.detail.detailed.label",value:"detailed"}],qR=()=>{const{t}=be(),a=yt(),[o,s]=y.useState(!1),l=y.useRef(null),u=y.useRef(null),{notify:f,previewSound:m,requestDesktopNotifications:g,settings:p,updateSettings:b}=Lc(),v=typeof window<"u"&&!("Notification"in window),k=y.useMemo(()=>WR.map(w=>({...w,description:t(w.descriptionKey),label:t(w.labelKey)})),[t]),E=y.useMemo(()=>IR.map(w=>({...w,description:t(w.descriptionKey),label:t(w.labelKey)})),[t]),S=w=>{if(!w){b({desktop:!1});return}g()};return y.useEffect(()=>{if(!o)return;const w=T=>{T.key==="Escape"&&(s(!1),u.current?.focus())},C=T=>{const N=l.current;N&&!N.contains(T.target)&&s(!1)};return document.addEventListener("keydown",w),document.addEventListener("pointerdown",C),()=>{document.removeEventListener("keydown",w),document.removeEventListener("pointerdown",C)}},[o]),c.jsxs("div",{ref:l,className:"relative",children:[c.jsx(Je,{label:t("notifications.settings.tooltip"),children:c.jsx("button",{ref:u,type:"button","aria-expanded":o,"aria-haspopup":"dialog","aria-label":t("notifications.settings.aria"),className:"flex h-7 w-7 max-md:min-w-11 cursor-pointer items-center justify-center rounded text-sec hover:bg-3 hover:text-pri","data-testid":"topbar-settings",onClick:()=>s(w=>!w),children:c.jsx(Gf,{size:14,"aria-hidden":!0})})}),o?c.jsxs("div",{role:"dialog","aria-modal":a?"true":void 0,"aria-label":t("notifications.settings.aria"),className:a?"fixed inset-0 z-50 flex flex-col overflow-y-auto":"elev-2 absolute top-8 right-0 z-50 w-[380px] rounded border p-3",style:a?{background:"var(--bg-0)"}:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-testid":"notification-settings",children:[c.jsxs("div",{className:a?"flex shrink-0 items-center gap-2 border-b px-4 py-3":"mb-3 flex items-start gap-2",style:a?{borderColor:"var(--border)"}:void 0,children:[c.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded bg-3 text-sec",children:c.jsx(Gf,{size:16,"aria-hidden":!0})}),c.jsxs("div",{className:a?"min-w-0 flex-1":"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-pri",children:t("notifications.settings.heading")}),a?null:c.jsx("div",{className:"text-ter text-xs",children:t("notifications.settings.subtitle")})]}),a?c.jsx("button",{type:"button","aria-label":t("common.close"),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded text-sec hover:bg-3 hover:text-pri",onClick:()=>s(!1),children:c.jsx(fa,{size:20,"aria-hidden":!0})}):null]}),c.jsxs("div",{className:a?"flex-1 overflow-y-auto p-4":"contents",children:[c.jsxs("section",{className:"mb-3",children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-xs uppercase tracking-wider",children:[c.jsx(ec,{size:12,"aria-hidden":!0}),t("notifications.sound.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.sound.sectionLabel"),className:a?"grid grid-cols-1 gap-2":"grid grid-cols-2 gap-2",children:k.map(w=>c.jsxs("div",{className:"relative min-h-[78px] rounded border transition-colors",style:{background:p.sound===w.value?`color-mix(in oklab, ${w.accent} 10%, var(--bg-2))`:"var(--bg-2)",borderColor:p.sound===w.value?`color-mix(in oklab, ${w.accent} 54%, var(--border-bright))`:"var(--border)"},children:[c.jsxs("label",{className:"block h-full w-full cursor-pointer rounded px-3 py-2 pr-10 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",children:[c.jsx("input",{type:"radio",name:"notification-sound",value:w.value,checked:p.sound===w.value,className:"sr-only",onChange:()=>b({sound:w.value})}),c.jsxs("span",{className:"mb-1 flex items-center gap-2",children:[c.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:`color-mix(in oklab, ${w.accent} 16%, transparent)`,color:w.accent},children:w.value==="off"?c.jsx(g0,{size:12,"aria-hidden":!0}):c.jsx(ec,{size:12,"aria-hidden":!0})}),c.jsx("span",{className:"font-medium text-pri text-xs",children:w.label}),w.length==="long"?c.jsx("span",{className:"rounded border border-[var(--border-bright)] px-1.5 py-0.5 text-xs text-ter uppercase",children:t("notifications.sound.longerBadge")}):null,p.sound===w.value?c.jsx(ga,{size:12,className:"ml-auto text-pri","aria-hidden":!0}):null]}),c.jsx("span",{className:"block text-ter text-xs",children:w.description})]}),w.value!=="off"?c.jsx("button",{type:"button","aria-label":t("notifications.sound.previewAria",{label:w.label}),className:"absolute right-2 bottom-2 flex h-6 w-6 pointer-coarse:h-10 pointer-coarse:w-10 items-center justify-center rounded border text-sec transition-colors hover:bg-3 hover:text-pri",style:{borderColor:"var(--border-bright)"},onClick:()=>m(w.value),children:c.jsx(Po,{size:12,"aria-hidden":!0})}):null]},w.value))})]}),c.jsxs("section",{className:"mb-3",children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-xs uppercase tracking-wider",children:[c.jsx(u0,{size:12,"aria-hidden":!0}),t("notifications.detail.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.detail.sectionLabel"),className:"grid grid-cols-2 rounded border p-1",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:E.map(w=>c.jsxs("label",{className:"cursor-pointer rounded px-3 py-2 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",style:{background:p.detail===w.value?"var(--bg-3)":"transparent",color:p.detail===w.value?"var(--text-primary)":"var(--text-secondary)"},children:[c.jsx("input",{type:"radio",name:"notification-detail",value:w.value,checked:p.detail===w.value,className:"sr-only",onChange:()=>b({detail:w.value})}),c.jsx("span",{className:"block font-medium text-xs",children:w.label}),c.jsx("span",{className:"block text-ter text-xs",children:w.description})]},w.value))})]}),c.jsxs("label",{className:"mb-3 flex items-start gap-2 rounded border p-2 text-sec text-xs",children:[c.jsx("input",{type:"checkbox","aria-label":t("notifications.desktop.aria"),checked:p.desktop,disabled:v,className:"mt-0.5",onChange:w=>S(w.currentTarget.checked)}),c.jsxs("span",{children:[c.jsx("span",{className:"block font-medium text-pri",children:t("notifications.desktop.label")}),c.jsx("span",{className:"text-ter",children:t(v?"notifications.desktop.unsupported":"notifications.desktop.helper")})]})]}),c.jsxs("div",{className:"flex justify-end gap-2 border-t pt-3",style:{borderColor:"var(--border)"},children:[c.jsx("button",{type:"button",className:"icon-btn",onClick:()=>s(!1),children:t("common.close")}),c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary",onClick:()=>f({brief:t("notifications.test.brief"),detail:t("notifications.test.detail"),kind:"success",title:t("notifications.test.title")}),children:t("notifications.test.button")})]})]})]}):null]})},xx=({checked:t,disabled:a,onChange:o,...s})=>c.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":s["aria-label"],disabled:a,className:"settings-switch","data-checked":t||void 0,"data-testid":s["data-testid"],onClick:l=>{l.stopPropagation(),o(!t)},children:c.jsx("span",{className:"settings-switch__thumb"})}),PR=t=>Math.max(0,Math.ceil((t-Date.now())/1e3)),FR=()=>{const{t}=be(),[a,o]=y.useState(null),[s,l]=y.useState(!1),[u,f]=y.useState(!1),[m,g]=y.useState(()=>Date.now());y.useEffect(()=>{if(!a)return;const k=window.setInterval(()=>g(Date.now()),1e3);return()=>window.clearInterval(k)},[a]);const p=async()=>{f(!1),l(!0);try{const k=await qN();o(k),g(Date.now())}catch{f(!0)}finally{l(!1)}};if(!a)return c.jsxs("div",{className:"p-1.5",children:[c.jsxs("button",{type:"button","data-testid":"settings-remote-add-device",onClick:()=>{p()},disabled:s,className:"icon-btn icon-btn--primary flex items-center gap-1.5",children:[c.jsx(m0,{size:14,"aria-hidden":!0}),t("remote.addDevice")]}),u?c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--text-error)"},role:"alert",children:t("remote.qr.startFailed")}):null]});const b=PR(a.expiresAt),v=b<=0||m>=a.expiresAt;return c.jsxs("div",{className:"p-1.5","data-testid":"remote-qr-panel",children:[c.jsx("div",{className:"text-sm font-medium text-pri",children:t("remote.qr.title")}),c.jsx("p",{className:"mt-0.5 mb-2 text-xs text-ter",children:t("remote.qr.instructions")}),c.jsxs("div",{className:"flex flex-col items-center gap-2",children:[v?c.jsx("div",{className:"text-xs",style:{color:"var(--text-error)"},"data-testid":"remote-qr-expired",children:t("remote.qr.expired")}):c.jsxs(c.Fragment,{children:[c.jsx("div",{"data-testid":"remote-pair-code",className:"mono rounded-lg border px-4 py-3 text-center text-2xl font-semibold tracking-[0.18em] text-pri",style:{borderColor:"var(--border)"},children:a.code}),c.jsx("div",{className:"text-xs text-ter","data-testid":"remote-qr-countdown",children:t("remote.qr.expiresIn",{seconds:b})})]}),c.jsxs("div",{className:"flex gap-2",children:[v?c.jsx("button",{type:"button","data-testid":"remote-qr-regenerate",onClick:()=>{p()},disabled:s,className:"icon-btn icon-btn--primary",children:t("remote.qr.regenerate")}):null,c.jsx("button",{type:"button","data-testid":"remote-qr-cancel",onClick:()=>o(null),className:"icon-btn",children:t("remote.qr.cancel")})]})]})]})},KR={ok:"remote.audit.result.ok",rejected:"remote.audit.result.rejected",error:"remote.audit.result.error"},YR=t=>{const a=Math.max(0,Date.now()-t),o=Math.floor(a/1e3);if(o<60)return"<1m";const s=Math.floor(o/60);if(s<60)return`${s}m`;const l=Math.floor(s/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`},$R=()=>{const{t}=be(),[a,o]=y.useState(!1),[s,l]=y.useState(null),[u,f]=y.useState(!1),m=y.useCallback(async()=>{f(!1);try{l(await YN(100))}catch{f(!0)}},[]);return y.useEffect(()=>{a&&m()},[a,m]),c.jsxs("div",{className:"mt-2","data-testid":"remote-audit-view",children:[c.jsxs("button",{type:"button","data-testid":"remote-audit-toggle",onClick:()=>o(g=>!g),className:"flex w-full items-center gap-1.5 rounded px-2 py-1.5 text-xs font-medium text-sec transition-colors hover:bg-3 hover:text-pri","aria-expanded":a,children:[c.jsx(bc,{size:12,"aria-hidden":!0,className:"shrink-0"}),c.jsx("span",{className:"flex-1 text-left",children:t(a?"remote.audit.hide":"remote.audit.show")}),a?c.jsx(qo,{size:12,"aria-hidden":!0,className:"shrink-0 text-ter"}):c.jsx(wc,{size:12,"aria-hidden":!0,className:"shrink-0 text-ter"})]}),a?c.jsx("div",{className:"mt-1.5",children:u?c.jsx("div",{className:"rounded px-2 py-2 text-xs",style:{color:"var(--text-error)",background:"color-mix(in oklab, var(--status-red) 8%, transparent)"},role:"alert",children:t("remote.audit.loadFailed")}):!s||s.length===0?c.jsx("div",{className:"px-2 py-2 text-xs text-ter",children:t("remote.audit.empty")}):c.jsx("ul",{className:"scroll-y flex max-h-[160px] flex-col gap-px rounded border",style:{borderColor:"var(--border)",background:"var(--bg-0)"},children:s.map(g=>{const p=g.result!=="ok";return c.jsxs("li",{className:"flex items-center gap-2 px-2.5 py-1.5 text-xs","data-testid":`remote-audit-row-${g.id}`,style:p?{background:"color-mix(in oklab, var(--status-red) 6%, transparent)"}:void 0,children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 shrink-0 rounded-full",style:{background:p?"var(--status-red)":"var(--status-green)"},"aria-hidden":!0}),c.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[c.jsx("span",{className:"font-medium text-pri",children:g.action}),g.endpoint?c.jsx("span",{className:"ml-1 text-ter",children:g.endpoint}):null,g.preview?c.jsxs("span",{className:"ml-1 text-ter",children:["· ",g.preview]}):null,typeof g.byteCount=="number"?c.jsxs("span",{className:"ml-1 text-ter",children:["· ",t("remote.audit.bytes",{count:g.byteCount})]}):null]}),p?c.jsxs("span",{className:"shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium",style:{color:"color-mix(in oklab, var(--status-red) 55%, white)",background:"color-mix(in oklab, var(--status-red) 14%, transparent)"},children:[t(KR[g.result]),g.rejectReason?` · ${g.rejectReason}`:""]}):null,c.jsx("span",{className:"shrink-0 tabular-nums text-ter",children:YR(g.ts)})]},g.id)})})}):null]})},ab=t=>{const a=Math.max(0,Date.now()-t),o=Math.floor(a/6e4);if(o<1)return"<1m";if(o<60)return`${o}m`;const s=Math.floor(o/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`},VR=({reloadKey:t=0})=>{const{t:a}=be(),o=sn(),[s,l]=y.useState(null),[u,f]=y.useState(!1),[m,g]=y.useState(null),p=y.useCallback(async()=>{f(!1);try{const k=await dw();l(k)}catch{f(!0)}},[]);y.useEffect(()=>{p()},[p,t]);const b=async k=>{try{await KN(k.deviceId),o.show({kind:"success",message:a("remote.devices.revoked",{name:k.name})}),await p()}catch{o.show({kind:"error",message:a("remote.devices.revokeFailed")})}},v=(s??[]).filter(k=>!k.revoked);return c.jsxs("div",{className:"p-1.5","data-testid":"remote-device-list",children:[c.jsx("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-ter",children:a("remote.devices.heading")}),u?c.jsx("div",{className:"text-xs",style:{color:"var(--text-error)"},role:"alert",children:a("remote.devices.loadFailed")}):v.length===0?c.jsx("div",{className:"text-xs text-ter",children:a("remote.devices.empty")}):c.jsx("ul",{className:"flex flex-col gap-1",children:v.map(k=>c.jsxs("li",{className:"flex items-center justify-between gap-2 rounded p-1.5 hover:bg-3","data-testid":`remote-device-${k.deviceId}`,children:[c.jsxs("span",{className:"min-w-0",children:[c.jsx("span",{className:"block truncate text-sm text-pri",children:k.name}),c.jsx("span",{className:"block text-xs text-ter",children:k.lastActive===null?a("remote.devices.neverActive"):ab(k.lastActive)==="<1m"?a("remote.devices.activeNow"):a("remote.devices.lastActive",{ago:ab(k.lastActive)})})]}),c.jsx("button",{type:"button","data-testid":`remote-device-revoke-${k.deviceId}`,"aria-label":a("remote.devices.revokeAria",{name:k.name}),onClick:()=>g(k),className:"icon-btn icon-btn--danger shrink-0",children:a("remote.devices.revoke")})]},k.deviceId))}),c.jsx(pi,{open:m!==null,onOpenChange:k=>{k||g(null)},title:a("remote.devices.revokeTitle"),description:m?a("remote.devices.revokeConfirm",{name:m.name}):"",confirmLabel:a("remote.devices.revoke"),confirmKind:"danger",onConfirm:()=>{m&&b(m)}})]})},GR=2e3,im={enabled:!1,loggedIn:!1,gatewayUrl:null,connected:!1,connection:"disabled"},kx=y.createContext({status:im,loading:!0,setEnabled:async()=>{},pending:null,refresh:async()=>{}}),XR=({children:t})=>{const a=yt(),[o,s]=y.useState(im),[l,u]=y.useState(!0),[f,m]=y.useState(null);y.useEffect(()=>{let v=!1;return yf().then(k=>{v||s(k)}).catch(()=>{}).finally(()=>{v||u(!1)}),()=>{v=!0}},[]);const g=y.useCallback(async v=>{const k=await IN(v);s(k),k.enabled||m(null)},[]),p=y.useCallback(async()=>{const v=await yf().catch(()=>im);s(v),v.enabled&&v.loggedIn&&!a?m(await My().catch(()=>null)):m(null)},[a]),b=o.enabled&&o.loggedIn&&!a;return y.useEffect(()=>{if(!b){m(null);return}let v=!1;const k=()=>{yf().then(S=>{v||s(S)}).catch(()=>{}),My().then(S=>{v||m(S)}).catch(()=>{})};k();const E=window.setInterval(k,GR);return()=>{v=!0,window.clearInterval(E)}},[b]),c.jsx(kx.Provider,{value:{status:o,loading:l,setEnabled:g,pending:f,refresh:p},children:t})},ep=()=>y.useContext(kx),ZR={online:"var(--status-green)",connecting:"var(--status-amber, #d29922)",reconnecting:"var(--status-amber, #d29922)",revoked:"var(--status-red, #f85149)",loggedOut:"var(--text-ter)",disabled:"var(--text-ter)"},QR={connecting:"remote.status.connecting",reconnecting:"remote.status.reconnecting",revoked:"remote.status.revoked"},JR=()=>{const{t}=be(),a=sn(),o=yt(),{status:s,loading:l,setEnabled:u,pending:f}=ep(),m=ZR[s.connection],g=QR[s.connection],[p,b]=y.useState(!1),[v,k]=y.useState(!1),[E,S]=y.useState(!1),[w,C]=y.useState(!1),[T,N]=y.useState(!1),[j,A]=y.useState(null),[O,D]=y.useState(!1),L=y.useRef(null),[P,J]=y.useState(0),Q=y.useRef(!1);y.useEffect(()=>{f?Q.current=!0:Q.current&&(Q.current=!1,J(W=>W+1))},[f]),y.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]),y.useEffect(()=>{let W=!1;return QN().then(G=>{W||(A(G),D(!1))}).catch(()=>{W||D(!0)}),()=>{W=!0}},[]);const $=async W=>{k(!1),b(!0);try{await u(W)}catch{k(!0)}finally{b(!1)}},F=W=>{if(!W&&o){S(!0);return}$(W)},ne=async()=>{if(!w){C(!0);try{const W=ZN().then(G=>JSON.stringify(G,null,2));await mw(W),N(!0),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{N(!1),L.current=null},1200),a.show({kind:"success",message:t("remote.diagnostics.copied")})}catch{a.show({kind:"error",message:t("remote.diagnostics.copyFailed")})}finally{C(!1)}}},Z=j?.current_streak_days??0,q=j?.days_active_total??0,M=j?.totals?.send??0,U=j?.totals?.report??0;return c.jsxs("div",{className:"settings-section","data-testid":"remote-access-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(m0,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("remote.section")})]}),c.jsxs("div",{className:"settings-toggle-row",onClick:()=>{!l&&!p&&F(!s.enabled)},children:[c.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[c.jsx("span",{className:"block text-sm font-medium text-pri",children:t("remote.enable.label")}),c.jsx("span",{className:"mt-0.5 block text-xs text-ter leading-relaxed",children:t("remote.enable.description")})]}),c.jsx("div",{className:"mt-0.5 shrink-0",children:c.jsx(xx,{checked:s.enabled,disabled:l||p,onChange:F,"data-testid":"settings-toggle-remote","aria-label":t("remote.enable.label")})})]}),v?c.jsx("div",{className:"mt-1 ml-2 text-xs",style:{color:"var(--text-error)"},role:"alert",children:t("settings.saveError")}):null,c.jsxs("button",{type:"button","data-testid":"remote-copy-diagnostics",onClick:ne,disabled:w,className:"icon-btn mt-2 w-full justify-center pointer-coarse:min-h-11",children:[T?c.jsx(ga,{size:12,"aria-hidden":!0}):c.jsx(Dr,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t(w?"remote.diagnostics.copying":T?"remote.diagnostics.copied":"remote.diagnostics.copy")})]}),c.jsxs("div",{className:"mt-2 rounded border px-3 py-2 text-xs","data-testid":"retention-diagnostics-panel",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[c.jsx("span",{className:"font-medium text-sec",children:t("remote.retention.title")}),c.jsx("span",{className:"text-ter",children:t("remote.retention.localOnly")})]}),O?c.jsx("p",{className:"text-ter",children:t("remote.retention.loadFailed")}):j?c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:Z}),c.jsx("div",{className:"text-ter",children:t("remote.retention.streak")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:q}),c.jsx("div",{className:"text-ter",children:t("remote.retention.activeDays")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:M}),c.jsx("div",{className:"text-ter",children:t("remote.retention.sends")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:U}),c.jsx("div",{className:"text-ter",children:t("remote.retention.reports")})]})]}):c.jsx("p",{className:"text-ter",children:t("common.loading")})]}),s.enabled?c.jsxs("div",{className:"mt-2 border-t pt-2",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex items-center gap-2 rounded px-2 py-1.5 text-xs","data-testid":"remote-login-status",children:[c.jsx("span",{"aria-hidden":!0,"data-connection":s.connection,className:"inline-block h-2 w-2 rounded-full",style:{background:m}}),c.jsx("span",{className:"min-w-0 text-sec",children:g?t(g):s.loggedIn?t("remote.status.linked",{gateway:s.gatewayUrl??""}):t("remote.status.notLinked")})]}),s.loggedIn&&!o?c.jsx(FR,{}):null,c.jsx(VR,{reloadKey:P}),c.jsx($R,{})]}):null,c.jsx(pi,{open:E,onOpenChange:W=>{W||S(!1)},title:t("remote.disable.confirmTitle"),description:t("remote.disable.confirmBody"),confirmLabel:t("common.stop"),confirmKind:"danger",onConfirm:()=>{$(!1)}})]})},Sx=y.createContext({enabled:!0,loading:!0,setEnabled:async()=>{}}),e3=({children:t})=>{const[a,o]=y.useState(!0),[s,l]=y.useState(!0);y.useEffect(()=>{let f=!1;return fN().then(m=>{f||o(m.enabled)}).catch(()=>{}).finally(()=>{f||l(!1)}),()=>{f=!0}},[]);const u=y.useCallback(async f=>{const m=await mN(f);o(m.enabled)},[]);return c.jsx(Sx.Provider,{value:{enabled:a,loading:s,setEnabled:u},children:t})},t3=()=>y.useContext(Sx),Ex=y.createContext({enabled:!1,loading:!0,setEnabled:async()=>{}}),n3=({children:t})=>{const[a,o]=y.useState(!1),[s,l]=y.useState(!0);y.useEffect(()=>{let f=!1;return uN().then(m=>{f||o(m.enabled)}).catch(()=>{}).finally(()=>{f||l(!1)}),()=>{f=!0}},[]);const u=y.useCallback(async f=>{const m=await dN(f);o(m.enabled)},[]);return c.jsx(Ex.Provider,{value:{enabled:a,loading:s,setEnabled:u},children:t})},Cx=()=>y.useContext(Ex),a3=()=>{const{language:t,setLanguage:a,t:o}=be();return c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(hE,{size:12,"aria-hidden":!0}),c.jsx("span",{children:o("settings.language")})]}),c.jsxs("div",{className:"flex gap-1 p-1 rounded border",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:[c.jsx("button",{type:"button",className:"flex-1 py-1 px-2 rounded text-xs font-medium transition-colors cursor-pointer",style:{background:t==="zh"?"var(--bg-3)":"transparent",color:t==="zh"?"var(--text-primary)":"var(--text-secondary)",border:"none"},onClick:()=>a("zh"),"data-testid":"language-zh-btn",children:"中文"}),c.jsx("button",{type:"button",className:"flex-1 py-1 px-2 rounded text-xs font-medium transition-colors cursor-pointer",style:{background:t==="en"?"var(--bg-3)":"transparent",color:t==="en"?"var(--text-primary)":"var(--text-secondary)",border:"none"},onClick:()=>a("en"),"data-testid":"language-en-btn",children:"English"})]})]})},rb=({feature:t,label:a,description:o,testId:s})=>{const{t:l}=be(),[u,f]=y.useState(!1),[m,g]=y.useState(!1),p=async b=>{g(!1),f(!0);try{await t.setEnabled(b)}catch{g(!0)}finally{f(!1)}};return c.jsxs("div",{className:"settings-toggle-row",onClick:()=>{!t.loading&&!u&&p(!t.enabled)},children:[c.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[c.jsx("span",{className:"block text-sm font-medium text-pri",children:a}),c.jsx("span",{className:"mt-0.5 block text-xs text-ter leading-relaxed",children:o}),m?c.jsx("span",{className:"mt-1 block text-xs",style:{color:"var(--text-error)"},role:"alert",children:l("settings.saveError")}):null]}),c.jsx("div",{className:"mt-0.5 shrink-0",children:c.jsx(xx,{checked:t.enabled,disabled:t.loading||u,onChange:b=>{p(b)},"data-testid":s,"aria-label":a})})]})},r3=()=>{const{t}=be(),[a,o]=y.useState(""),[s,l]=y.useState(!1),[u,f]=y.useState(!1),[m,g]=y.useState(null);y.useEffect(()=>{let b=!1;return lN().then(v=>{b||(o(v),l(!0))}).catch(()=>{b||l(!0)}),()=>{b=!0}},[]);const p=async()=>{g(null),f(!0);try{await cN(a),g("saved")}catch{g("error")}finally{f(!1)}};return c.jsxs("div",{children:[c.jsx("label",{className:"mb-1.5 block text-sm font-medium text-pri",htmlFor:"settings-webhook-url",children:t("settings.webhook.label")}),c.jsx("span",{className:"mb-2 block text-xs text-ter leading-relaxed",children:t("settings.webhook.description")}),c.jsx("input",{id:"settings-webhook-url",type:"url",inputMode:"url",placeholder:"https://…",className:"input",value:a,disabled:!s||u,onChange:b=>{g(null),o(b.target.value)},onBlur:()=>{p()},onKeyDown:b=>{if(b.key==="Enter"){if(b.nativeEvent.isComposing||b.keyCode===229)return;b.currentTarget.blur()}},"data-testid":"settings-webhook-url"}),m==="saved"?c.jsxs("span",{className:"mt-1.5 block text-xs",style:{color:"var(--status-green)"},children:["✓ ",t("settings.webhook.saved")]}):null,m==="error"?c.jsx("span",{className:"mt-1.5 block text-xs",style:{color:"var(--text-error)"},role:"alert",children:t("settings.saveError")}):null]})},Tx=()=>{const{t}=be(),a=Cx(),o=t3();return c.jsxs("div",{className:"flex flex-col gap-2.5",children:[c.jsx(a3,{}),c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(Ql,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("settings.experimental")})]}),c.jsx(rb,{feature:a,label:t("settings.workflows.label"),description:t("settings.workflows.description"),testId:"settings-toggle-workflows"}),c.jsx(rb,{feature:o,label:t("settings.autostaff.label"),description:t("settings.autostaff.description"),testId:"settings-toggle-autostaff"})]}),c.jsx(JR,{}),c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(aC,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("settings.webhook.label")})]}),c.jsx(r3,{})]})]})},Nx=()=>{const{t}=be(),a=yt(),[o,s]=y.useState(!1),l=y.useRef(null),u=y.useRef(null);return y.useEffect(()=>{if(!o)return;const f=g=>{g.key==="Escape"&&(s(!1),u.current?.focus())},m=g=>{const p=l.current;p&&!p.contains(g.target)&&s(!1)};return document.addEventListener("keydown",f),document.addEventListener("pointerdown",m),()=>{document.removeEventListener("keydown",f),document.removeEventListener("pointerdown",m)}},[o]),c.jsxs("div",{ref:l,className:"relative",children:[c.jsx(Je,{label:t("settings.tooltip"),children:c.jsx("button",{ref:u,type:"button","aria-expanded":o,"aria-haspopup":"dialog","aria-label":t("settings.aria"),className:"flex h-7 w-7 cursor-pointer items-center justify-center rounded text-sec hover:bg-3 hover:text-pri","data-testid":"topbar-app-settings",onClick:()=>s(f=>!f),children:c.jsx(Xf,{size:14,"aria-hidden":!0})})}),o?c.jsxs("div",{role:"dialog","aria-label":t("settings.aria"),className:a?"settings-sheet fixed inset-0 z-50 flex flex-col overflow-y-auto p-4":"settings-popover elev-2 absolute top-8 right-0 z-50 w-[380px] max-h-[calc(100vh-64px)] overflow-y-auto scroll-y rounded-lg border p-4","data-mobile":a||void 0,style:a?{background:"var(--bg-0)"}:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-testid":"app-settings-menu",children:[c.jsxs("div",{className:"mb-4 flex items-start gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent)"},children:c.jsx(Xf,{size:18,"aria-hidden":!0})}),c.jsxs("div",{className:a?"min-w-0 flex-1":"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-pri",children:t("settings.heading")}),c.jsx("div",{className:"text-xs text-ter",children:t("settings.subtitle")})]}),a?c.jsx("button",{type:"button",onClick:()=>s(!1),"aria-label":t("common.close"),"data-testid":"mobile-settings-close",className:"icon-btn icon-btn--ghost shrink-0",children:c.jsx(fa,{size:16,"aria-hidden":!0})}):null]}),c.jsx(Tx,{})]}):null]})},jx=t=>{const[a,o]=y.useState(null);return y.useEffect(()=>{if(t!==void 0)return;let s=!0;return tN().then(l=>{s&&o(l)}).catch(()=>{s&&o(null)}),()=>{s=!1}},[t]),t===void 0?a:t},o3="2.1.16",s3={version:o3},tp=s3.version,i3=({actions:t,hideActions:a=!1,memoryOpen:o=!1,onToggleMemory:s,onToggleTaskGraph:l,openTaskCount:u=0,taskGraphOpen:f=!1,onToggleWorkflows:m,workflowsOpen:g=!1,version:p=tp,versionInfo:b})=>{const{t:v}=be(),[k,E]=y.useState("idle"),S=jx(b),w=S?.updateAvailable&&S.latestVersion!==p?S:null,C=!!w?.installHint,T=u>0,N=f?v("topbar.hideTodo"):T?v("topbar.todoOpen",{count:u}):v("topbar.showTodo"),j=async()=>{if(w?.installHint)try{await navigator.clipboard.writeText(w.installHint),E("copied"),window.setTimeout(()=>E("idle"),1600)}catch{E("error"),window.setTimeout(()=>E("idle"),2200)}},A=v(k==="copied"?"topbar.updateCommandCopied":k==="error"?"topbar.updateCommandCopyFailed":"topbar.copyUpdateCommand");return c.jsxs("header",{className:"flex h-11 shrink-0 items-center px-4",style:{background:"var(--bg-0)",borderBottom:"1px solid var(--border)"},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsxs("a",{href:"https://hivehq.dev",target:"_blank",rel:"noopener noreferrer","aria-label":v("topbar.openWebsite"),title:v("topbar.openWebsite"),className:"-mx-1 flex items-center gap-2 rounded px-1 transition-opacity hover:opacity-80 focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-brand-link",children:[c.jsx("img",{src:"/logo.png",alt:"","aria-hidden":!0,className:"h-5 w-5 rounded-md","data-testid":"topbar-logo"}),c.jsx("span",{className:"font-semibold text-pri",children:"Hive"}),c.jsxs("span",{className:"text-ter text-xs tabular-nums",children:["v",p]})]}),w?c.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-xs","data-testid":"topbar-update-badge",children:[c.jsx("span",{className:"rounded border px-2 py-0.5 font-medium",style:{background:"color-mix(in oklab, var(--accent) 10%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 30%, transparent)",color:"var(--accent)"},children:v("topbar.updateAvailable")}),c.jsxs("span",{className:"hidden text-ter sm:inline",children:["v",p," → v",w.latestVersion]}),C?c.jsx("code",{className:"mono hidden max-w-[18rem] truncate rounded border px-1.5 py-0.5 text-ter md:inline-block",title:w.updateNote||w.installHint,style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:w.installHint}):null,w.updateNote?c.jsx("span",{className:"hidden max-w-[18rem] truncate text-ter xl:inline",title:w.updateNote,children:w.updateNote}):null,C?c.jsx(Je,{label:A,children:c.jsx("button",{type:"button",onClick:j,"aria-label":A,className:"flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded border text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-copy-update-command",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:k==="copied"?c.jsx(ga,{size:12}):c.jsx(Dr,{size:12})})}):null,w.releaseUrl?c.jsx(Je,{label:v("topbar.openRelease"),children:c.jsx("a",{href:w.releaseUrl,target:"_blank",rel:"noopener noreferrer","aria-label":v("topbar.openRelease"),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded border text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-open-release",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:c.jsx(_m,{size:12})})}):null]}):null]}),c.jsx("div",{className:"flex-1"}),a?null:c.jsxs("div",{className:"flex items-center gap-1",children:[t,s?c.jsx(Je,{label:v(o?"topbar.hideMemory":"topbar.showMemory"),children:c.jsxs("button",{type:"button",onClick:s,"aria-pressed":o,"aria-label":v(o?"topbar.hideMemory":"topbar.showMemory"),className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-memory",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(_S,{size:13}),c.jsx("span",{children:v("topbar.memory")})]})}):null,l?c.jsx(Je,{label:N,children:c.jsxs("button",{type:"button",onClick:l,"aria-pressed":f,"aria-label":N,"data-has-tasks":T?"true":void 0,className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-blueprint",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(d0,{size:13,className:T?"text-accent":void 0}),c.jsx("span",{children:v("topbar.todo")})]})}):null,m?c.jsx(Je,{label:v(g?"topbar.hideWorkflows":"topbar.showWorkflows"),children:c.jsxs("button",{type:"button",onClick:m,"aria-pressed":g,"aria-label":v(g?"topbar.hideWorkflows":"topbar.showWorkflows"),className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-workflows",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(v0,{size:13}),c.jsx("span",{children:v("topbar.workflows")})]})}):null,c.jsx(qR,{}),c.jsx(Nx,{})]})]})},Ax="hive.workspace-sidebar.width",ri=56,np=280,Df=ri,ob=16,l3=240,sb=96,Gl=t=>Math.min(np,Math.max(ri,t)),c3=()=>{try{const t=localStorage.getItem(Ax);if(!t)return Df;const a=Number.parseInt(t,10);return Number.isFinite(a)?Gl(a):Df}catch{return Df}},u3=()=>{const[t,a]=y.useState(c3),[o,s]=y.useState(!1);y.useEffect(()=>{try{localStorage.setItem(Ax,String(Math.round(t)))}catch{}},[t]);const l=y.useCallback(g=>{g.preventDefault();const p=g.clientX,b=t;s(!0);const v=document.body.style.cursor,k=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const E=w=>{a(Gl(b+w.clientX-p))},S=()=>{s(!1),document.body.style.cursor=v,document.body.style.userSelect=k,document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",S)};document.addEventListener("mousemove",E),document.addEventListener("mouseup",S)},[t]),u=t<=sb,f=y.useCallback(()=>{a(g=>g<=sb?l3:ri)},[]),m=y.useCallback(g=>{g.key==="ArrowLeft"?(g.preventDefault(),a(p=>Gl(p-ob))):g.key==="ArrowRight"?(g.preventDefault(),a(p=>Gl(p+ob))):g.key==="Home"?(g.preventDefault(),a(ri)):g.key==="End"&&(g.preventDefault(),a(np))},[]);return{beginResize:l,collapsed:u,onResizeKeyDown:m,resizing:o,toggleCollapsed:f,width:t}},d3=({children:t,hideTopbarActions:a=!1,memoryOpen:o=!1,onToggleMemory:s,onToggleTaskGraph:l,openTaskCount:u=0,onToggleWorkflows:f,workflowsOpen:m=!1,sidebar:g,sidebarResize:p,taskGraphOpen:b=!1,topbarActions:v,versionInfo:k})=>{const{t:E}=be();return c.jsxs("div",{className:"flex h-screen w-full flex-col overflow-hidden",style:{background:"var(--bg-0)",color:"var(--text-primary)"},children:[c.jsx(i3,{actions:v,hideActions:a,memoryOpen:o,onToggleMemory:s,onToggleTaskGraph:l,openTaskCount:u,taskGraphOpen:b,onToggleWorkflows:f,versionInfo:k,workflowsOpen:m}),c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden",children:[c.jsxs("aside",{"aria-label":E("layout.sidebarAria"),className:"workspace-sidebar relative flex shrink-0 flex-col","data-resizing":p.resizing?"true":"false",style:{background:"var(--bg-0)",boxShadow:"inset -1px 0 0 var(--border)",width:`${p.width}px`},children:[g,c.jsx("hr",{"aria-label":E("layout.sidebarResizeAria"),"aria-orientation":"vertical","aria-valuemin":ri,"aria-valuemax":np,"aria-valuenow":Math.round(p.width),tabIndex:0,className:"workspace-sidebar-resizer","data-resizing":p.resizing?"true":"false",onMouseDown:p.beginResize,onKeyDown:p.onResizeKeyDown})]}),c.jsx("section",{className:"relative flex min-w-0 flex-1 overflow-hidden",children:t})]})]})},f3={disconnected:"mobile.reconnect.disconnected",reconnecting:"mobile.reconnect.reconnecting",revoked:"mobile.reconnect.revoked"},m3=({status:t})=>{const{t:a}=be();if(!t||t.state!=="reconnecting"&&t.state!=="disconnected"&&t.state!=="revoked")return null;const o=t.state==="revoked"?"var(--status-red)":"var(--status-orange)",s=t.state==="disconnected"?t.retry:void 0;return c.jsxs("div",{role:"status","data-testid":"mobile-reconnect-banner",className:"flex items-center justify-center gap-2 px-3 py-1.5 text-center text-xs",style:{background:`color-mix(in oklab, ${o} 18%, var(--bg-0))`,color:o},children:[c.jsx("span",{children:a(f3[t.state])}),s?c.jsx("button",{type:"button","data-testid":"mobile-reconnect-retry",className:"rounded border px-2 py-0.5 font-medium",style:{borderColor:"currentColor",color:"currentColor"},onClick:s,children:a("mobile.reconnect.retry")}):null]})},p3=[{accent:"var(--status-green)",descriptionKey:"notifications.sound.soft.description",labelKey:"notifications.sound.soft.label",length:"short",value:"soft"},{accent:"var(--status-blue)",descriptionKey:"notifications.sound.ping.description",labelKey:"notifications.sound.ping.label",length:"short",value:"ping"},{accent:"var(--status-gold)",descriptionKey:"notifications.sound.chime.description",labelKey:"notifications.sound.chime.label",length:"short",value:"chime"},{accent:"var(--accent)",descriptionKey:"notifications.sound.cascade.description",labelKey:"notifications.sound.cascade.label",length:"long",value:"cascade"},{accent:"var(--status-orange)",descriptionKey:"notifications.sound.beacon.description",labelKey:"notifications.sound.beacon.label",length:"long",value:"beacon"},{accent:"var(--status-purple)",descriptionKey:"notifications.sound.resolve.description",labelKey:"notifications.sound.resolve.label",length:"long",value:"resolve"},{accent:"var(--text-tertiary)",descriptionKey:"notifications.sound.off.description",labelKey:"notifications.sound.off.label",length:"silent",value:"off"}],h3=[{descriptionKey:"notifications.detail.brief.description",labelKey:"notifications.detail.brief.label",value:"brief"},{descriptionKey:"notifications.detail.detailed.description",labelKey:"notifications.detail.detailed.label",value:"detailed"}],g3=()=>{const{t}=be(),a=yt(),{notify:o,previewSound:s,requestDesktopNotifications:l,settings:u,updateSettings:f}=Lc(),m=typeof window<"u"&&!("Notification"in window),g=y.useMemo(()=>p3.map(v=>({...v,description:t(v.descriptionKey),label:t(v.labelKey)})),[t]),p=y.useMemo(()=>h3.map(v=>({...v,description:t(v.descriptionKey),label:t(v.labelKey)})),[t]),b=v=>{if(!v){f({desktop:!1});return}l()};return c.jsxs("details",{className:"settings-details group",children:[c.jsxs("summary",{className:"settings-details__summary",children:[c.jsxs("div",{className:"settings-section__heading !mb-0",children:[c.jsx(Gf,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("notifications.settings.heading")})]}),c.jsx(qo,{size:14,className:"text-sec transition-transform group-open:rotate-180","aria-hidden":!0})]}),c.jsxs("div",{className:"settings-details__content flex flex-col gap-3.5",children:[c.jsxs("section",{children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-[10px] font-semibold uppercase tracking-wider",children:[c.jsx(ec,{size:12,"aria-hidden":!0}),t("notifications.sound.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.sound.sectionLabel"),className:a?"grid grid-cols-1 gap-2":"grid grid-cols-2 gap-2",children:g.map(v=>c.jsxs("div",{className:"relative min-h-[78px] rounded border transition-colors",style:{background:u.sound===v.value?`color-mix(in oklab, ${v.accent} 10%, var(--bg-2))`:"var(--bg-2)",borderColor:u.sound===v.value?`color-mix(in oklab, ${v.accent} 54%, var(--border-bright))`:"var(--border)"},children:[c.jsxs("label",{className:"block h-full w-full cursor-pointer rounded px-3 py-2 pr-10 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",children:[c.jsx("input",{type:"radio",name:"notification-sound",value:v.value,checked:u.sound===v.value,className:"sr-only",onChange:()=>f({sound:v.value})}),c.jsxs("span",{className:"mb-1 flex items-center gap-2",children:[c.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:`color-mix(in oklab, ${v.accent} 16%, transparent)`,color:v.accent},children:v.value==="off"?c.jsx(g0,{size:12,"aria-hidden":!0}):c.jsx(ec,{size:12,"aria-hidden":!0})}),c.jsx("span",{className:"font-medium text-pri text-xs",children:v.label}),v.length==="long"?c.jsx("span",{className:"rounded border border-[var(--border-bright)] px-1.5 py-0.5 text-[10px] text-ter uppercase",children:t("notifications.sound.longerBadge")}):null,u.sound===v.value?c.jsx(ga,{size:12,className:"ml-auto text-pri","aria-hidden":!0}):null]}),c.jsx("span",{className:"block text-ter text-[11px] leading-relaxed",children:v.description})]}),v.value!=="off"?c.jsx("button",{type:"button","aria-label":t("notifications.sound.previewAria",{label:v.label}),className:"absolute right-2 bottom-2 flex h-6 w-6 pointer-coarse:h-10 pointer-coarse:w-10 items-center justify-center rounded border text-sec transition-colors hover:bg-3 hover:text-pri cursor-pointer",style:{borderColor:"var(--border-bright)"},onClick:()=>s(v.value),children:c.jsx(Po,{size:12,"aria-hidden":!0})}):null]},v.value))})]}),c.jsxs("section",{children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-[10px] font-semibold uppercase tracking-wider",children:[c.jsx(u0,{size:12,"aria-hidden":!0}),t("notifications.detail.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.detail.sectionLabel"),className:"grid grid-cols-2 rounded border p-1",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:p.map(v=>c.jsxs("label",{className:"cursor-pointer rounded px-3 py-2 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",style:{background:u.detail===v.value?"var(--bg-3)":"transparent",color:u.detail===v.value?"var(--text-primary)":"var(--text-secondary)"},children:[c.jsx("input",{type:"radio",name:"notification-detail",value:v.value,checked:u.detail===v.value,className:"sr-only",onChange:()=>f({detail:v.value})}),c.jsx("span",{className:"block font-medium text-xs",children:v.label}),c.jsx("span",{className:"block text-ter text-[11px] leading-relaxed",children:v.description})]},v.value))})]}),c.jsxs("label",{className:"flex items-start gap-2 rounded border p-2 text-sec text-xs cursor-pointer",children:[c.jsx("input",{type:"checkbox","aria-label":t("notifications.desktop.aria"),checked:u.desktop,disabled:m,className:"mt-0.5 cursor-pointer",onChange:v=>b(v.currentTarget.checked)}),c.jsxs("span",{children:[c.jsx("span",{className:"block font-medium text-pri",children:t("notifications.desktop.label")}),c.jsx("span",{className:"text-ter leading-relaxed",children:t(m?"notifications.desktop.unsupported":"notifications.desktop.helper")})]})]}),c.jsx("div",{className:"flex justify-end gap-2 border-t pt-3",style:{borderColor:"var(--border)"},children:c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary ml-auto cursor-pointer",onClick:()=>o({brief:t("notifications.test.brief"),detail:t("notifications.test.detail"),kind:"success",title:t("notifications.test.title")}),children:t("notifications.test.button")})})]})]})},v3=({demoMode:t,onTryDemo:a,onExitDemo:o})=>{const{t:s}=be();return c.jsxs("div",{className:"mobile-settings-section flex min-h-full flex-col p-4","data-testid":"mobile-settings-section",children:[c.jsx("h1",{className:"mb-4 text-base font-semibold text-pri",children:s("mobile.section.settings")}),c.jsx(Tx,{}),c.jsx(g3,{}),c.jsxs("div",{className:"settings-section mt-3",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(Ql,{size:12,"aria-hidden":!0}),c.jsx("span",{children:s("mobile.section.demo")})]}),t?c.jsxs("button",{type:"button","data-testid":"mobile-settings-exit-demo",onClick:o,className:"flex w-full items-center gap-3 rounded p-2 text-left text-sm text-pri hover:bg-3",children:[c.jsx(wE,{size:16,"aria-hidden":!0,className:"text-ter"}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:s("demo.exit")})]}):c.jsxs("button",{type:"button","data-testid":"mobile-settings-demo",onClick:a,className:"flex w-full items-center gap-3 rounded p-2 text-left text-sm text-pri hover:bg-3",children:[c.jsx(Ql,{size:16,"aria-hidden":!0,className:"text-ter"}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:s("mobile.section.demo")})]})]})]})},y3={team:Ec,tasks:d0,flows:v0,settings:Xf},b3={team:"mobile.nav.team",tasks:"mobile.nav.tasks",flows:"mobile.nav.flows",settings:"mobile.nav.settings"},w3=({active:t,onSelect:a,sections:o,openTaskCount:s=0,workingCount:l=0})=>{const{t:u}=be();return c.jsx("nav",{"aria-label":u("mobile.nav.aria"),className:"mobile-bottom-nav flex shrink-0 items-stretch","data-testid":"mobile-bottom-nav",style:{background:"var(--bg-0)",borderTop:"1px solid var(--border)"},children:o.map(f=>{const m=y3[f],g=u(b3[f]),p=f===t,b=f==="tasks"&&s>0?s:f==="team"&&l>0?l:0;return c.jsxs("button",{type:"button","aria-label":g,"aria-current":p?"page":void 0,"data-testid":`mobile-nav-${f}`,"data-active":p?"true":void 0,onClick:()=>a(f),className:"mobile-bottom-nav__tab relative flex flex-1 cursor-pointer flex-col items-center justify-center gap-0.5 py-2 text-xs",style:{color:p?"var(--text-primary)":"var(--text-tertiary)"},children:[p?c.jsx("span",{"aria-hidden":!0,className:"absolute top-0 left-1/2 h-0.5 w-8 -translate-x-1/2 rounded-b",style:{background:"var(--accent)"}}):null,c.jsx(m,{size:20,"aria-hidden":!0}),c.jsx("span",{children:g}),b>0?c.jsx("span",{className:"absolute top-1 right-[calc(50%-18px)] inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-1 text-[11px] font-medium tabular-nums leading-none","data-testid":`mobile-nav-${f}-badge`,style:{background:"var(--accent)",color:"#ffffff"},children:b}):null]},f)})})},x3=({workspaceSwitcher:t,actions:a,banner:o})=>c.jsxs("header",{className:"mobile-topbar flex shrink-0 flex-col","data-testid":"mobile-topbar",style:{background:"var(--bg-0)",borderBottom:"1px solid var(--border)"},children:[c.jsxs("div",{className:"flex h-12 items-center gap-2 px-3",children:[c.jsx("div",{className:"min-w-0 flex-1",children:t??c.jsx("span",{className:"font-semibold text-pri",children:"Hive"})}),c.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a})]}),o]}),k3=()=>typeof navigator<"u"&&/iP(hone|ad|od)/.test(navigator.platform??navigator.userAgent),S3=()=>{const[t,a]=y.useState(null);return y.useEffect(()=>{if(!k3())return;const o=typeof window<"u"?window.visualViewport:null;if(!o)return;const s=()=>{const l=Math.abs(o.height-window.innerHeight)<10;a(l?null:o.height)};return s(),o.addEventListener("resize",s),()=>{o.removeEventListener("resize",s)}},[]),t},E3={team:"mobile-section-team",tasks:"mobile-section-tasks",flows:"mobile-section-flows",settings:"mobile-section-settings"},C3=({workspaceSwitcher:t,topbarActions:a,banner:o,fullBleed:s,team:l,tasks:u,flows:f,settings:m,terminalPanels:g,overlays:p,openTaskCount:b=0,workingCount:v=0,activeSection:k,onSectionChange:E})=>{const[S,w]=y.useState("team"),C=k??S,T=S3(),N=P=>{w(P),E?.(P)},j={team:l,tasks:u,flows:f,settings:m},A=["team","tasks"];f!=null&&A.push("flows"),m!=null&&A.push("settings");const O=A.includes(C)?C:"team",L=nx()&&O==="team"&&s==null;return c.jsxs("div",{className:`mobile-shell flex h-dvh w-full max-w-[100vw] min-w-0 flex-col overflow-hidden${L?" mobile-shell--focus":""}`,"data-mobile-shell":"true","data-testid":"mobile-shell","data-focus-mode":L?"true":void 0,style:{background:"var(--bg-0)",color:"var(--text-primary)",...T!=null?{height:`${T}px`}:{}},children:[L?o:c.jsx(x3,{workspaceSwitcher:t,actions:a,banner:o}),c.jsx("main",{className:"relative min-h-0 min-w-0 flex-1 overflow-hidden",children:s??c.jsx("div",{className:O==="team"?"flex h-full min-w-0 flex-col overflow-hidden":"flex h-full min-w-0 flex-col overflow-y-auto","data-testid":E3[O],"data-mobile-section":O,children:j[O]})}),g,s!=null||L?null:c.jsx(w3,{active:O,onSelect:N,sections:A,openTaskCount:b,workingCount:v}),p]})},T3=[],N3=y.lazy(()=>Mt(()=>import("./TaskGraphDrawer-DRVJ4Z7z.js"),[]).then(t=>({default:t.TaskGraphContent}))),j3=({tasksFile:t,workspacePath:a,workers:o,onSelectOwner:s,onAddWorkspace:l,demoMode:u=!1})=>{const{t:f}=be(),m=o??T3,g=y.useMemo(()=>m.length?m.map(p=>p.name):void 0,[m]);return a?c.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[u?c.jsx("div",{className:"flex shrink-0 items-center justify-end px-3 py-1",children:c.jsx("span",{className:"pill pill--neutral text-xs",children:f("demo.readOnlyBadge")})}):null,c.jsx("div",{className:"min-h-0 flex-1",children:c.jsx(y.Suspense,{fallback:null,children:c.jsx(N3,{content:t.content,hasConflict:t.hasConflict,onContentChange:t.onChange,onKeepLocal:t.onKeepLocal,onReload:t.onReload,onSave:t.onSave,onToggleTaskLine:p=>{t.toggleTaskAtLine(p).catch(Va("tasks.toggleTaskAtLine"))},onAppendTask:p=>{t.appendTask(p).catch(Va("tasks.appendTask"))},onAppendSubtask:(p,b)=>{t.appendSubtask(p,b).catch(Va("tasks.appendSubtask"))},onUpdateTaskText:(p,b)=>{t.updateTaskText(p,b).catch(Va("tasks.updateTaskText"))},onDeleteTask:p=>{t.deleteTask(p).catch(Va("tasks.deleteTask"))},workspacePath:a,...g?{knownWorkerNames:g}:{},...s?{onSelectOwner:s}:{}})})})]}):c.jsx("div",{className:"flex h-full flex-col","data-testid":"mobile-tasks-empty",children:c.jsx(mi,{title:f("mobile.tasks.noWorkspaceTitle"),description:f("mobile.tasks.noWorkspaceDesc"),action:l?c.jsx("button",{type:"button",onClick:l,className:"icon-btn icon-btn--primary mt-1 flex min-h-11 items-center gap-1.5 px-4 py-2 text-xs font-medium",children:f("firstRun.addWorkspace")}):void 0})})},ib=[{token:"var(--accent)",label:"accent"},{token:"var(--status-blue)",label:"blue"},{token:"var(--status-purple)",label:"purple"},{token:"var(--status-orange)",label:"orange"},{token:"var(--status-green)",label:"green"},{token:"var(--status-gold)",label:"gold"}],A3=t=>{let a=0;for(let s=0;s<t.length;s+=1)a=a*31+t.charCodeAt(s)|0;const o=Math.abs(a)%ib.length;return ib[o]},_3=t=>{const a=t.trim();if(a.length===0)return"?";const o=a.codePointAt(0);return o===void 0?"?":String.fromCodePoint(o).toUpperCase()},lm=({workspaceId:t,name:a,isActive:o,working:s,workingCount:l,size:u=32})=>{const{token:f,label:m}=A3(t),g=_3(a),p=l&&l>1?l:null;return c.jsx(hx,{size:u,color:f,fontRatio:.45,ringColor:o?f:null,testId:"workspace-avatar",data:{"workspace-id":t,active:o?"true":void 0,"color-label":m},decoration:p!==null?c.jsx("span",{className:"absolute flex h-[16px] min-w-[16px] items-center justify-center rounded-full px-1 font-medium text-xs tabular-nums leading-none",style:{right:"-4px",bottom:"-4px",background:"var(--status-green)",color:"#0a1f0a",boxShadow:"0 0 0 2px var(--bg-1)"},"data-testid":"workspace-avatar-working-count","aria-hidden":!0,children:p>9?"9+":p}):s?c.jsx("span",{className:"status-dot status-dot--working absolute",style:{right:"-2px",bottom:"-2px",boxShadow:"0 0 0 2px var(--bg-1)"},"aria-hidden":!0}):null,children:g})},lb=(t,a)=>{if(!t||t.length===0)return a("sidebar.noMembers");const o=t.filter(s=>s.status==="working").length;return o>0?a("sidebar.workingCount",{working:o,total:t.length}):a("sidebar.teamMemberCount",{count:t.length})},R3=({activeWorkspaceId:t,workspaces:a,workersByWorkspaceId:o,createDisabledReason:s,onSelectWorkspace:l,onCreateClick:u,onDeleteWorkspace:f})=>{const{t:m}=be(),g=sn(),[p,b]=y.useState(!1),[v,k]=y.useState(null),[E,S]=y.useState(!1),w=a?.find(T=>T.id===t)?.name??m("mobile.section.workspaces"),C=()=>{if(!v||E)return;const T=v;S(!0),Promise.resolve(f(T)).then(()=>{g.show({kind:"success",message:m("sidebar.removed",{name:T.name})})}).catch(N=>{const j=N instanceof Error?N.message:String(N);g.show({kind:"error",message:m("sidebar.deleteFailed",{message:j})})}).finally(()=>{S(!1),k(null)})};return c.jsxs(Mr,{open:p,onOpenChange:b,children:[c.jsx($T,{asChild:!0,children:c.jsxs("button",{type:"button","data-testid":"mobile-workspace-switcher-trigger","aria-label":m("mobile.workspaces.switch"),className:"mobile-ws-switcher flex min-h-11 w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left hover:bg-2",children:[c.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-pri",children:w}),c.jsx(qo,{size:16,"aria-hidden":!0,className:"shrink-0 text-ter"})]})}),c.jsxs(Lr,{children:[c.jsx(zr,{"data-testid":"mobile-workspace-switcher-overlay",className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid items-end",children:c.jsxs(Hr,{"data-testid":"mobile-workspace-switcher-sheet",className:"dialog-slide-up elev-2 pointer-events-auto flex max-h-[70dvh] w-full flex-col overflow-hidden rounded-t-xl border-t",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsx(Ur,{asChild:!0,children:c.jsxs("div",{className:"flex shrink-0 items-baseline gap-2 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[c.jsx("span",{className:"text-base font-semibold text-pri",children:m("sidebar.workspaces")}),a&&a.length>0?c.jsx("span",{className:"text-xs text-ter tabular-nums",children:a.length}):null]})}),c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:!a||a.length===0?c.jsxs("div",{className:"flex flex-col items-center gap-1 px-6 py-8 text-center",children:[c.jsx("span",{className:"text-sm font-medium text-sec",children:m("sidebar.noWorkspaces")}),c.jsx("span",{className:"text-xs text-ter",children:s??m("sidebar.noWorkspacesDesc")})]}):a.map(T=>{const N=T.id===t,j=o[T.id],A=j?.filter(O=>O.status==="working").length??0;return c.jsxs("div",{className:"flex items-center gap-1 pr-2",children:[c.jsxs("button",{type:"button","data-testid":`mobile-ws-row-${T.id}`,onClick:()=>{b(!1),l(T.id)},className:"flex min-h-14 min-w-0 flex-1 items-center gap-3 px-4 py-2 text-left",style:N?{background:"color-mix(in oklab, var(--accent) 10%, transparent)"}:void 0,children:[c.jsx(lm,{workspaceId:T.id,name:T.name,isActive:N,working:A>0,workingCount:A,size:36}),c.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[c.jsx("span",{className:"truncate text-sm font-medium text-pri",children:T.name}),c.jsx("span",{className:"truncate text-xs text-ter",children:lb(j,m)})]}),N?c.jsx(ga,{size:18,className:"shrink-0 text-accent","aria-hidden":!0}):null]}),c.jsx("button",{type:"button","aria-label":m("sidebar.deleteAria",{name:T.name}),"data-testid":`mobile-ws-delete-${T.id}`,onClick:()=>k(T),className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-ter",children:c.jsx(Sc,{size:16,"aria-hidden":!0})})]},T.id)})}),c.jsx("div",{className:"shrink-0 border-t px-4 pt-3 pb-[max(12px,env(safe-area-inset-bottom))]",style:{borderColor:"var(--border)",background:"var(--bg-2)"},children:c.jsxs("button",{type:"button",disabled:!!s,title:s,"data-testid":"mobile-ws-create",onClick:()=>{b(!1),u()},className:"icon-btn icon-btn--primary flex w-full min-h-11 items-center justify-center gap-1.5",children:[c.jsx(Jl,{size:16,"aria-hidden":!0}),m("sidebar.newWorkspace")]})})]})})]}),c.jsx(pi,{open:v!==null,onOpenChange:T=>{!T&&!E&&k(null)},title:v?m("sidebar.deleteConfirm",{name:v.name}):m("sidebar.deleteLabel"),description:v?m("sidebar.deleteDescription",{path:v.path,summary:lb(o[v.id],m)}):"",confirmLabel:m(E?"sidebar.deleting":"sidebar.deleteLabel"),confirmKind:"danger",onConfirm:C})]})},O3=4e3,D3=t=>{const[a,o]=y.useState([]);return y.useEffect(()=>{if(!t){o([]);return}let s=!1;const l=()=>{dw().then(f=>{s||o(f)}).catch(()=>{})};l();const u=window.setInterval(l,O3);return()=>{s=!0,window.clearInterval(u)}},[t]),a},M3=({devices:t,enabled:a})=>{const{notify:o}=Lc(),{t:s}=be(),l=y.useRef(null);return y.useEffect(()=>{if(!a){l.current=null;return}const u=new Map(t.filter(m=>!m.revoked).map(m=>[m.deviceId,m])),f=l.current;if(l.current=new Set(u.keys()),!!f)for(const[m,g]of u)f.has(m)||o({brief:s("notifications.remoteSession.brief",{name:g.name}),detail:s("notifications.remoteSession.detail",{name:g.name}),kind:"success",title:s("notifications.remoteSession.title")})},[t,a,o,s]),null},L3=()=>{const{status:t}=ep(),a=t.enabled&&t.loggedIn,o=D3(a);return c.jsx(M3,{devices:o,enabled:a})};let cm=!1;const _x=()=>{cm=!0,window.location.reload()},z3=t=>{y.useEffect(()=>{const a=o=>{if(cm){cm=!1;return}o.preventDefault(),o.returnValue=""};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[t])},H3=3e3,U3=({onTryDemo:t}={})=>{const{t:a}=be(),[o,s]=y.useState(!1),l=y.useRef(!0),u=y.useCallback(()=>{typeof window>"u"||_x()},[]),f=y.useCallback(async()=>{try{return(await fetch("/api/version",{credentials:"include"})).ok}catch{return!1}},[]);y.useEffect(()=>{l.current=!0;const g=window.setInterval(async()=>{l.current&&await f()&&u()},H3);return()=>{l.current=!1,window.clearInterval(g)}},[f,u]);const m=async()=>{s(!0);try{if(await f()){u();return}}finally{window.setTimeout(()=>{l.current&&s(!1)},400)}};return c.jsx("div",{className:"flex flex-1 items-center justify-center p-8","data-testid":"runtime-offline-page",children:c.jsxs("div",{className:"elev-1 flex max-w-md flex-col items-center gap-3 rounded border p-6 text-center",style:{background:"var(--bg-elevated)",borderColor:"var(--border)"},children:[c.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full",style:{background:"var(--bg-3)",color:"var(--status-orange)"},children:c.jsx(UE,{size:24,"aria-hidden":!0})}),c.jsx("div",{className:"font-semibold text-pri",children:a("pwa.runtimeOffline.title")}),c.jsx("div",{className:"text-sec text-sm leading-relaxed",children:a("pwa.runtimeOffline.body")}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-center gap-2",children:[c.jsxs("button",{type:"button",className:"icon-btn icon-btn--primary flex items-center gap-2","data-testid":"runtime-offline-retry",disabled:o,onClick:()=>{m()},children:[o?c.jsx(Ja,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(Rm,{size:12,"aria-hidden":!0}),a(o?"pwa.runtimeOffline.retrying":"pwa.runtimeOffline.retry")]}),t?c.jsxs("button",{type:"button",className:"icon-btn flex items-center gap-2","data-testid":"runtime-offline-try-demo",onClick:t,children:[c.jsx(qS,{size:12,"aria-hidden":!0}),a("pwa.runtimeOffline.tryDemo")]}):null]}),c.jsx("div",{className:"text-ter text-xs",children:a("pwa.runtimeOffline.autoReconnect")})]})})},um=new Set;let Rx=null;const B3=t=>{Rx=t;for(const a of um)a(t)},W3=t=>(um.add(t),t(Rx),()=>{um.delete(t)}),I3=2e3,q3=async t=>{if(!t.serviceWorker)return;let a;try{a=await t.serviceWorker.register("/sw.js")}catch{return}const o=l=>{const u=()=>{l.state==="installed"&&t.serviceWorker?.controller&&B3(()=>{l.postMessage({type:"SKIP_WAITING"}),setTimeout(t.reload,I3)})};l.addEventListener("statechange",u)};a.waiting&&t.serviceWorker.controller&&o(a.waiting),a.installing&&o(a.installing),a.addEventListener("updatefound",()=>{a.installing&&o(a.installing)});let s=!1;t.serviceWorker.addEventListener("controllerchange",()=>{s||(s=!0,t.reload())})},P3=()=>typeof navigator>"u"||typeof window>"u"?Promise.resolve():q3({isProd:!0,serviceWorker:"serviceWorker"in navigator?navigator.serviceWorker:null,reload:_x}),cb=({terminalRuns:t})=>{const{t:a}=be(),o=yt(),[s,l]=y.useState(null),[u,f]=y.useState(!1);if(y.useEffect(()=>W3(b=>{l(()=>b)}),[]),!s)return null;const m=t.every(b=>b.status==="stopped"),g=!m||u,p=a(u?"pwa.reloading":m?"pwa.reloadToActivate":"pwa.waitForAgents");return c.jsxs("div",{className:"update-toast elev-2 fixed right-4 bottom-8 z-50 flex items-center gap-3 rounded border px-3 py-2",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-mobile":o||void 0,"data-testid":"update-available-toast",role:"status","aria-live":"polite",children:[c.jsx(Rm,{size:14,className:"text-sec","aria-hidden":!0}),c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"font-medium text-pri text-xs",children:a("pwa.appShellUpdated")}),c.jsx("span",{className:"text-ter text-xs",children:a(m?"pwa.reloadToActivate":"pwa.waitForAgents")})]}),c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary","data-testid":"update-available-reload",disabled:g,onClick:()=>{f(!0),s()},children:p})]})},F3=new Set(["add-workspace","try-demo"]),K3=t=>t!==null&&F3.has(t),Y3=({onAddWorkspace:t,onTryDemo:a,ready:o})=>{const s=y.useRef(!1);y.useEffect(()=>{if(!o||s.current||typeof window>"u")return;const u=new URLSearchParams(window.location.search).get("action");K3(u)&&(s.current=!0,window.history.replaceState({},"",window.location.pathname),u==="add-workspace"?t():u==="try-demo"&&a())},[o,t,a])},ub=()=>{const{t}=be(),a=sn(),o=yt(),{pending:s,refresh:l}=ep(),[u,f]=y.useState(!1),m=y.useRef(!1),g=s?.deviceName??"",p=s?.pairingId??null,b=s?.expiresAt??null;y.useEffect(()=>{p!==null&&(m.current=!1)},[p]);const v=y.useCallback(async()=>{if(!(!p||u||m.current)){m.current=!0,f(!0);try{await PN(p),a.show({kind:"success",message:t("remote.confirm.paired",{name:g})})}catch{m.current=!1,a.show({kind:"error",message:t("remote.confirm.failed")})}finally{f(!1),await l()}}},[p,u,g,l,t,a]),k=y.useCallback(async E=>{if(!(!p||m.current)){m.current=!0;try{await FN(p)}catch{}a.show({kind:E==="expired"?"warning":"success",message:t(E==="expired"?"remote.confirm.expired":"remote.confirm.rejected")}),f(!1),await l()}},[p,l,t,a]);return y.useEffect(()=>{if(b===null)return;const E=b-Date.now();if(E<=0){k("expired");return}const S=window.setTimeout(()=>{k("expired")},E);return()=>window.clearTimeout(S)},[b,k]),!s||o?null:c.jsx(Mr,{open:!0,onOpenChange:E=>{E||k("rejected")},children:c.jsxs(Lr,{children:[c.jsx(zr,{"data-testid":"remote-pairing-confirm-overlay",className:"app-overlay fixed inset-0 z-[80]"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-[90] grid place-items-center p-4",children:c.jsxs(Hr,{"data-testid":"remote-pairing-confirm",className:"dialog-scale-pop elev-2 pointer-events-auto w-[440px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{"aria-hidden":!0,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",color:"var(--accent)",border:"1px solid color-mix(in oklab, var(--accent) 30%, transparent)"},children:c.jsx(IE,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(Ur,{className:"text-lg font-semibold text-pri",children:t("remote.confirm.title")}),c.jsx(Ko,{className:"mt-1.5 text-sm text-sec",children:t("remote.confirm.description",{name:g})})]})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-ter",children:t("remote.confirm.sasLabel")}),c.jsx("div",{"data-testid":"remote-pairing-sas",className:"rounded border bg-2 py-3 text-center font-mono text-3xl tracking-[0.4em] text-pri",style:{borderColor:"var(--border)"},children:s.sas}),c.jsx("p",{className:"mt-2 text-xs text-ter",children:t("remote.confirm.warning")})]}),c.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[c.jsx("button",{type:"button","data-testid":"remote-pairing-reject",onClick:()=>{k("rejected")},disabled:u,className:"icon-btn",children:t("remote.confirm.reject")}),c.jsx("button",{type:"button","data-testid":"remote-pairing-confirm-action",onClick:()=>{v()},disabled:u,className:"icon-btn icon-btn--primary",children:t(u?"remote.confirm.confirming":"remote.confirm.confirm")})]})]})})]})})},$3=t=>!!t?.some(a=>a.status==="working"),V3=t=>t?.filter(a=>a.status==="working").length??0,G3=(t,a)=>{if(!t||t.length===0)return a("sidebar.noMembers");const o=t.filter(s=>s.status==="working").length;return o>0?a("sidebar.workingCount",{working:o,total:t.length}):a("sidebar.teamMemberCount",{count:t.length})},Ox="hive.sidebar.githubDismissed",X3="https://www.bilibili.com/video/BV1UHLp6nEQR",Z3=()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ox)==="1"}catch{return!1}},Q3=({activeWorkspaceId:t,collapsed:a=!1,createDisabledReason:o,onCreateClick:s,onDeleteWorkspace:l,onSelectWorkspace:u,onToggleCollapse:f,workersByWorkspaceId:m,workspaces:g})=>{const{t:p}=be(),[b,v]=y.useState(null),[k,E]=y.useState(!1),[S,w]=y.useState(Z3),C=sn(),T=()=>{w(!0);try{window.localStorage.setItem(Ox,"1")}catch{}},N=!!o,j=D=>{v(D)},A=()=>{if(!b||k)return;const D=b;E(!0),Promise.resolve(l(D)).then(()=>{C.show({kind:"success",message:p("sidebar.removed",{name:D.name})})}).catch(L=>{const P=L instanceof Error?L.message:String(L);C.show({kind:"error",message:p("sidebar.deleteFailed",{message:P})})}).finally(()=>{E(!1),v(null)})},O=c.jsx(pi,{open:b!==null,onOpenChange:D=>{!D&&!k&&v(null)},title:b?p("sidebar.deleteConfirm",{name:b.name}):p("sidebar.deleteLabel"),description:b?p("sidebar.deleteDescription",{path:b.path,summary:G3(m[b.id],p)}):"",confirmLabel:p(k?"sidebar.deleting":"sidebar.deleteLabel"),confirmKind:"danger",onConfirm:A});return c.jsxs("nav",{"aria-label":"Workspaces",className:"flex h-full flex-col",children:[c.jsxs("div",{className:"ws-sidebar-header flex items-center justify-between gap-2 px-3 pt-3 pb-2",style:{boxShadow:"inset 0 -1px 0 var(--border)"},children:[c.jsxs("div",{className:"ws-sidebar-title flex min-w-0 items-center gap-2",children:[c.jsx("span",{className:"ws-sidebar-title__text text-xs font-medium text-ter","data-testid":"workspace-sidebar-title",children:p("sidebar.workspaces")}),g&&g.length>0?c.jsx("span",{className:"ws-sidebar-count mono rounded bg-2 px-1.5 py-0.5 text-xs text-ter",children:g.length}):null]}),f?c.jsx(Je,{side:"right",label:p(a?"layout.sidebarExpand":"layout.sidebarCollapse"),children:c.jsx("button",{type:"button","aria-label":p(a?"layout.sidebarExpand":"layout.sidebarCollapse"),"aria-expanded":!a,"data-testid":"workspace-sidebar-toggle",onClick:f,className:"ws-collapse-toggle",children:a?c.jsx(BS,{size:16,"aria-hidden":!0}):c.jsx(HS,{size:16,"aria-hidden":!0})})}):null]}),g===null?c.jsx("p",{className:"px-3 py-2 text-xs text-ter",children:p("common.loading")}):g.length===0?c.jsx("div",{className:"ws-empty flex-1 px-2 py-4",children:c.jsx("div",{className:"ws-empty__wide",children:c.jsx(mi,{title:p("sidebar.noWorkspaces"),description:o??p("sidebar.noWorkspacesDesc"),icon:c.jsx(l0,{size:20}),action:c.jsxs("button",{type:"button",onClick:N?void 0:s,disabled:N,"aria-label":p("sidebar.newWorkspace"),title:o??p("sidebar.newWorkspace"),className:"icon-btn icon-btn--primary mt-1 flex items-center gap-1.5 px-4 py-2 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50",children:[c.jsx(Jl,{size:14,"aria-hidden":!0}),p("sidebar.newWorkspace")]})})})}):c.jsxs("ul",{className:"flex-1 scroll-y pb-2",children:[g.map(D=>{const L=m[D.id],P=D.id===t,J=$3(L),Q=V3(L);return c.jsxs("li",{className:"group relative",children:[c.jsx(Je,{side:"right",label:c.jsxs("span",{className:"flex flex-col gap-0.5",children:[c.jsx("span",{className:"font-medium",children:D.name}),c.jsx("span",{className:"mono text-ter",children:D.path})]}),children:c.jsxs("button",{type:"button","aria-label":D.name,"aria-current":P?"true":void 0,"data-workspace-path":D.path,onClick:()=>u(D.id),className:`ws-row flex w-full items-center gap-2.5 py-1.5 pr-7 pl-2 text-left pointer-coarse:min-h-11${P?" active":""}`,children:[c.jsx(lm,{workspaceId:D.id,name:D.name,isActive:!1,working:J,workingCount:Q}),c.jsx("span",{className:`min-w-0 flex-1 truncate text-sm ${P?"font-medium text-pri":"text-pri"}`,children:D.name})]})}),c.jsx(Je,{side:"right",label:c.jsxs("span",{className:"flex flex-col gap-0.5",children:[c.jsx("span",{className:"font-medium",children:D.name}),c.jsx("span",{className:"mono text-ter",children:D.path})]}),children:c.jsx("button",{type:"button","aria-label":D.name,"aria-current":P?"true":void 0,onClick:()=>u(D.id),className:"ws-avatar-cell hidden w-full justify-center py-2","data-testid":"ws-avatar-cell",children:c.jsx(lm,{workspaceId:D.id,name:D.name,isActive:P,working:J,workingCount:Q})})}),c.jsx(Je,{label:p("sidebar.deleteAria",{name:D.name}),children:c.jsx("button",{type:"button","aria-label":p("sidebar.deleteAria",{name:D.name}),onClick:()=>j(D),className:"ws-row-delete absolute top-2 right-2 flex h-6 w-6 items-center justify-center rounded text-ter opacity-0 transition-colors pointer-coarse:h-10 pointer-coarse:w-10 hover:text-status-red focus:opacity-100 group-hover:opacity-100",children:c.jsx(Sc,{size:14,"aria-hidden":!0})})})]},D.id)}),c.jsx("li",{children:c.jsx(Je,{label:o??p("sidebar.newWorkspace"),children:c.jsxs("button",{type:"button",onClick:N?void 0:s,disabled:N,"aria-label":p("sidebar.newWorkspace"),title:o??void 0,className:"ws-add ws-add--inline flex items-center justify-center gap-1.5 rounded border border-dashed px-3 py-2 text-xs font-medium text-sec transition-colors disabled:cursor-not-allowed disabled:opacity-50",style:{borderColor:"var(--border-bright)"},children:[c.jsx(Jl,{size:14,"aria-hidden":!0}),c.jsx("span",{className:"ws-add__label",children:p("sidebar.newWorkspace")})]})})})]}),S?null:c.jsxs("div",{className:"ws-sidebar-footer group relative",children:[c.jsxs("a",{href:X3,target:"_blank",rel:"noopener noreferrer","aria-label":p("sidebar.openDemoVideo"),title:p("sidebar.openDemoVideo"),className:"ws-sidebar-footer__link flex items-center gap-2.5 px-3 py-3 text-sm text-ter transition-colors hover:text-pri",children:[c.jsx("img",{src:"/bilibili.ico",alt:"","aria-hidden":"true",className:"h-[18px] w-[18px] rounded-[4px] object-cover",draggable:!1}),c.jsx("span",{className:"ws-sidebar-footer__label",children:p("sidebar.demoVideo")})]}),c.jsxs("a",{href:"https://github.com/tt-a1i/hive",target:"_blank",rel:"noopener noreferrer","aria-label":p("sidebar.openRepository"),title:p("sidebar.openRepository"),className:"ws-sidebar-footer__link flex items-center gap-2.5 px-3 py-3 text-sm text-ter transition-colors hover:text-pri",children:[c.jsx("svg",{width:"18",height:"18",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:c.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})}),c.jsx("span",{className:"ws-sidebar-footer__label",children:"GitHub"})]}),c.jsx("button",{type:"button","aria-label":p("sidebar.dismissRepository"),title:p("sidebar.dismissRepository"),onClick:T,className:"ws-sidebar-footer__dismiss absolute top-1.5 right-1.5 flex h-4 w-4 items-center justify-center rounded text-ter opacity-0 transition-opacity pointer-coarse:h-8 pointer-coarse:w-8 hover:bg-3 hover:text-pri focus:opacity-100 group-hover:opacity-100",children:c.jsx(fa,{size:10,"aria-hidden":!0})})]}),O]})},qn=/^(\s*)-\s+\[( |x|X)\]\s+(.*)$/,J3=/(?:^|[\s\p{P}])(@[A-Za-z0-9_-]+)/gu,e4=t=>{const a=[];for(const o of t.matchAll(J3))o[1]&&a.push(o[1]);return a},t4=t=>{const a=new Map;for(const o of t){const s=o.trim();s&&a.set(s.toLowerCase(),s)}return a},m8=(t,a={})=>{const o=[],s=[],l=t.split(/\r?\n/),u=a.knownWorkerNames?t4(a.knownWorkerNames):null;for(let f=0;f<l.length;f++){const m=l[f];if(!m)continue;const g=m.match(qn);if(!g)continue;const[,p="",b=" ",v=""]=g,k=p.replace(/\t/g," ").length,E=e4(v);let S;if(u){S=[];for(const N of E){const j=u.get(N.slice(1).toLowerCase());j&&S.push(`@${j}`)}}else S=E;let w=v;for(const N of S){const j=N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");w=w.replace(new RegExp(`(?:^|(?<=\\s|\\p{P}))${j}(?!\\w)`,"u"),"")}w=w.replace(/\s+/g," ").trim();const C={checked:b.toLowerCase()==="x",children:[],indent:k,line:f,mentions:S,text:w};for(;s.length>0;){const N=s[s.length-1];if(N&&N.indent<k)break;s.pop()}const T=s[s.length-1];T?T.children.push(C):o.push(C),s.push(C)}return o},n4=t=>{let a=0;const o=[],s=t.split(/\r?\n/);for(const l of s){if(!l)continue;const u=l.match(qn);if(!u)continue;const[,f="",m=" "]=u,g=f.replace(/\t/g," ").length;for(;o.length>0;){const p=o[o.length-1];if(p&&p.indent<g)break;o.pop()}!o[o.length-1]&&m.toLowerCase()!=="x"&&(a+=1),o.push({indent:g})}return a},p8=t=>{if(t.children.length===0)return null;let a=0;for(const o of t.children)o.checked&&(a+=1);return{done:a,total:t.children.length}},hi=t=>t.includes(`\r
78
+ `,MR=()=>{const[t,a]=y.useState(!1);return{demoMode:t,enableDemo:()=>a(!0),exitDemo:()=>a(!1)}},LR=t=>{const{demoMode:a,workspaces:o,activeWorkspaceId:s,workersByWorkspaceId:l}=t,u=a?[Wl]:o,f=a?{[Wl.id]:OR}:l,m=a?Wl.id:s,g=a?Wl:o?.find(b=>b.id===s);return{effectiveActiveWorkspaceId:m,effectiveWorkspaces:u,effectiveWorkersByWorkspaceId:f,effectiveActiveWorkspace:g,pollWorkspaceId:a?null:s}},zR=[{accent:"var(--status-green)",descriptionKey:"notifications.sound.soft.description",labelKey:"notifications.sound.soft.label",length:"short",value:"soft"},{accent:"var(--status-blue)",descriptionKey:"notifications.sound.ping.description",labelKey:"notifications.sound.ping.label",length:"short",value:"ping"},{accent:"var(--status-gold)",descriptionKey:"notifications.sound.chime.description",labelKey:"notifications.sound.chime.label",length:"short",value:"chime"},{accent:"var(--accent)",descriptionKey:"notifications.sound.cascade.description",labelKey:"notifications.sound.cascade.label",length:"long",value:"cascade"},{accent:"var(--status-orange)",descriptionKey:"notifications.sound.beacon.description",labelKey:"notifications.sound.beacon.label",length:"long",value:"beacon"},{accent:"var(--status-purple)",descriptionKey:"notifications.sound.resolve.description",labelKey:"notifications.sound.resolve.label",length:"long",value:"resolve"},{accent:"var(--text-tertiary)",descriptionKey:"notifications.sound.off.description",labelKey:"notifications.sound.off.label",length:"silent",value:"off"}],HR=[{descriptionKey:"notifications.detail.brief.description",labelKey:"notifications.detail.brief.label",value:"brief"},{descriptionKey:"notifications.detail.detailed.description",labelKey:"notifications.detail.detailed.label",value:"detailed"}],UR=()=>{const{t}=be(),a=yt(),[o,s]=y.useState(!1),l=y.useRef(null),u=y.useRef(null),{notify:f,previewSound:m,requestDesktopNotifications:g,settings:p,updateSettings:b}=Lc(),v=typeof window<"u"&&!("Notification"in window),k=y.useMemo(()=>zR.map(w=>({...w,description:t(w.descriptionKey),label:t(w.labelKey)})),[t]),E=y.useMemo(()=>HR.map(w=>({...w,description:t(w.descriptionKey),label:t(w.labelKey)})),[t]),S=w=>{if(!w){b({desktop:!1});return}g()};return y.useEffect(()=>{if(!o)return;const w=T=>{T.key==="Escape"&&(s(!1),u.current?.focus())},C=T=>{const N=l.current;N&&!N.contains(T.target)&&s(!1)};return document.addEventListener("keydown",w),document.addEventListener("pointerdown",C),()=>{document.removeEventListener("keydown",w),document.removeEventListener("pointerdown",C)}},[o]),c.jsxs("div",{ref:l,className:"relative",children:[c.jsx(Je,{label:t("notifications.settings.tooltip"),children:c.jsx("button",{ref:u,type:"button","aria-expanded":o,"aria-haspopup":"dialog","aria-label":t("notifications.settings.aria"),className:"flex h-7 w-7 max-md:min-w-11 cursor-pointer items-center justify-center rounded text-sec hover:bg-3 hover:text-pri","data-testid":"topbar-settings",onClick:()=>s(w=>!w),children:c.jsx(Gf,{size:14,"aria-hidden":!0})})}),o?c.jsxs("div",{role:"dialog","aria-modal":a?"true":void 0,"aria-label":t("notifications.settings.aria"),className:a?"fixed inset-0 z-50 flex flex-col overflow-y-auto":"elev-2 absolute top-8 right-0 z-50 w-[380px] rounded border p-3",style:a?{background:"var(--bg-0)"}:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-testid":"notification-settings",children:[c.jsxs("div",{className:a?"flex shrink-0 items-center gap-2 border-b px-4 py-3":"mb-3 flex items-start gap-2",style:a?{borderColor:"var(--border)"}:void 0,children:[c.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded bg-3 text-sec",children:c.jsx(Gf,{size:16,"aria-hidden":!0})}),c.jsxs("div",{className:a?"min-w-0 flex-1":"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-pri",children:t("notifications.settings.heading")}),a?null:c.jsx("div",{className:"text-ter text-xs",children:t("notifications.settings.subtitle")})]}),a?c.jsx("button",{type:"button","aria-label":t("common.close"),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded text-sec hover:bg-3 hover:text-pri",onClick:()=>s(!1),children:c.jsx(fa,{size:20,"aria-hidden":!0})}):null]}),c.jsxs("div",{className:a?"flex-1 overflow-y-auto p-4":"contents",children:[c.jsxs("section",{className:"mb-3",children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-xs uppercase tracking-wider",children:[c.jsx(ec,{size:12,"aria-hidden":!0}),t("notifications.sound.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.sound.sectionLabel"),className:a?"grid grid-cols-1 gap-2":"grid grid-cols-2 gap-2",children:k.map(w=>c.jsxs("div",{className:"relative min-h-[78px] rounded border transition-colors",style:{background:p.sound===w.value?`color-mix(in oklab, ${w.accent} 10%, var(--bg-2))`:"var(--bg-2)",borderColor:p.sound===w.value?`color-mix(in oklab, ${w.accent} 54%, var(--border-bright))`:"var(--border)"},children:[c.jsxs("label",{className:"block h-full w-full cursor-pointer rounded px-3 py-2 pr-10 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",children:[c.jsx("input",{type:"radio",name:"notification-sound",value:w.value,checked:p.sound===w.value,className:"sr-only",onChange:()=>b({sound:w.value})}),c.jsxs("span",{className:"mb-1 flex items-center gap-2",children:[c.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:`color-mix(in oklab, ${w.accent} 16%, transparent)`,color:w.accent},children:w.value==="off"?c.jsx(g0,{size:12,"aria-hidden":!0}):c.jsx(ec,{size:12,"aria-hidden":!0})}),c.jsx("span",{className:"font-medium text-pri text-xs",children:w.label}),w.length==="long"?c.jsx("span",{className:"rounded border border-[var(--border-bright)] px-1.5 py-0.5 text-xs text-ter uppercase",children:t("notifications.sound.longerBadge")}):null,p.sound===w.value?c.jsx(ga,{size:12,className:"ml-auto text-pri","aria-hidden":!0}):null]}),c.jsx("span",{className:"block text-ter text-xs",children:w.description})]}),w.value!=="off"?c.jsx("button",{type:"button","aria-label":t("notifications.sound.previewAria",{label:w.label}),className:"absolute right-2 bottom-2 flex h-6 w-6 pointer-coarse:h-10 pointer-coarse:w-10 items-center justify-center rounded border text-sec transition-colors hover:bg-3 hover:text-pri",style:{borderColor:"var(--border-bright)"},onClick:()=>m(w.value),children:c.jsx(Po,{size:12,"aria-hidden":!0})}):null]},w.value))})]}),c.jsxs("section",{className:"mb-3",children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-xs uppercase tracking-wider",children:[c.jsx(u0,{size:12,"aria-hidden":!0}),t("notifications.detail.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.detail.sectionLabel"),className:"grid grid-cols-2 rounded border p-1",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:E.map(w=>c.jsxs("label",{className:"cursor-pointer rounded px-3 py-2 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",style:{background:p.detail===w.value?"var(--bg-3)":"transparent",color:p.detail===w.value?"var(--text-primary)":"var(--text-secondary)"},children:[c.jsx("input",{type:"radio",name:"notification-detail",value:w.value,checked:p.detail===w.value,className:"sr-only",onChange:()=>b({detail:w.value})}),c.jsx("span",{className:"block font-medium text-xs",children:w.label}),c.jsx("span",{className:"block text-ter text-xs",children:w.description})]},w.value))})]}),c.jsxs("label",{className:"mb-3 flex items-start gap-2 rounded border p-2 text-sec text-xs",children:[c.jsx("input",{type:"checkbox","aria-label":t("notifications.desktop.aria"),checked:p.desktop,disabled:v,className:"mt-0.5",onChange:w=>S(w.currentTarget.checked)}),c.jsxs("span",{children:[c.jsx("span",{className:"block font-medium text-pri",children:t("notifications.desktop.label")}),c.jsx("span",{className:"text-ter",children:t(v?"notifications.desktop.unsupported":"notifications.desktop.helper")})]})]}),c.jsxs("div",{className:"flex justify-end gap-2 border-t pt-3",style:{borderColor:"var(--border)"},children:[c.jsx("button",{type:"button",className:"icon-btn",onClick:()=>s(!1),children:t("common.close")}),c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary",onClick:()=>f({brief:t("notifications.test.brief"),detail:t("notifications.test.detail"),kind:"success",title:t("notifications.test.title")}),children:t("notifications.test.button")})]})]})]}):null]})},xx=({checked:t,disabled:a,onChange:o,...s})=>c.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":s["aria-label"],disabled:a,className:"settings-switch","data-checked":t||void 0,"data-testid":s["data-testid"],onClick:l=>{l.stopPropagation(),o(!t)},children:c.jsx("span",{className:"settings-switch__thumb"})}),BR=t=>Math.max(0,Math.ceil((t-Date.now())/1e3)),WR=()=>{const{t}=be(),[a,o]=y.useState(null),[s,l]=y.useState(!1),[u,f]=y.useState(!1),[m,g]=y.useState(()=>Date.now());y.useEffect(()=>{if(!a)return;const k=window.setInterval(()=>g(Date.now()),1e3);return()=>window.clearInterval(k)},[a]);const p=async()=>{f(!1),l(!0);try{const k=await WN();o(k),g(Date.now())}catch{f(!0)}finally{l(!1)}};if(!a)return c.jsxs("div",{className:"p-1.5",children:[c.jsxs("button",{type:"button","data-testid":"settings-remote-add-device",onClick:()=>{p()},disabled:s,className:"icon-btn icon-btn--primary flex items-center gap-1.5",children:[c.jsx(m0,{size:14,"aria-hidden":!0}),t("remote.addDevice")]}),u?c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--text-error)"},role:"alert",children:t("remote.qr.startFailed")}):null]});const b=BR(a.expiresAt),v=b<=0||m>=a.expiresAt;return c.jsxs("div",{className:"p-1.5","data-testid":"remote-qr-panel",children:[c.jsx("div",{className:"text-sm font-medium text-pri",children:t("remote.qr.title")}),c.jsx("p",{className:"mt-0.5 mb-2 text-xs text-ter",children:t("remote.qr.instructions")}),c.jsxs("div",{className:"flex flex-col items-center gap-2",children:[v?c.jsx("div",{className:"text-xs",style:{color:"var(--text-error)"},"data-testid":"remote-qr-expired",children:t("remote.qr.expired")}):c.jsxs(c.Fragment,{children:[c.jsx("div",{"data-testid":"remote-pair-code",className:"mono rounded-lg border px-4 py-3 text-center text-2xl font-semibold tracking-[0.18em] text-pri",style:{borderColor:"var(--border)"},children:a.code}),c.jsx("div",{className:"text-xs text-ter","data-testid":"remote-qr-countdown",children:t("remote.qr.expiresIn",{seconds:b})})]}),c.jsxs("div",{className:"flex gap-2",children:[v?c.jsx("button",{type:"button","data-testid":"remote-qr-regenerate",onClick:()=>{p()},disabled:s,className:"icon-btn icon-btn--primary",children:t("remote.qr.regenerate")}):null,c.jsx("button",{type:"button","data-testid":"remote-qr-cancel",onClick:()=>o(null),className:"icon-btn",children:t("remote.qr.cancel")})]})]})]})},IR={ok:"remote.audit.result.ok",rejected:"remote.audit.result.rejected",error:"remote.audit.result.error"},qR=t=>{const a=Math.max(0,Date.now()-t),o=Math.floor(a/1e3);if(o<60)return"<1m";const s=Math.floor(o/60);if(s<60)return`${s}m`;const l=Math.floor(s/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`},PR=()=>{const{t}=be(),[a,o]=y.useState(!1),[s,l]=y.useState(null),[u,f]=y.useState(!1),m=y.useCallback(async()=>{f(!1);try{l(await FN(100))}catch{f(!0)}},[]);return y.useEffect(()=>{a&&m()},[a,m]),c.jsxs("div",{className:"mt-2","data-testid":"remote-audit-view",children:[c.jsxs("button",{type:"button","data-testid":"remote-audit-toggle",onClick:()=>o(g=>!g),className:"flex w-full items-center gap-1.5 rounded px-2 py-1.5 text-xs font-medium text-sec transition-colors hover:bg-3 hover:text-pri","aria-expanded":a,children:[c.jsx(bc,{size:12,"aria-hidden":!0,className:"shrink-0"}),c.jsx("span",{className:"flex-1 text-left",children:t(a?"remote.audit.hide":"remote.audit.show")}),a?c.jsx(qo,{size:12,"aria-hidden":!0,className:"shrink-0 text-ter"}):c.jsx(wc,{size:12,"aria-hidden":!0,className:"shrink-0 text-ter"})]}),a?c.jsx("div",{className:"mt-1.5",children:u?c.jsx("div",{className:"rounded px-2 py-2 text-xs",style:{color:"var(--text-error)",background:"color-mix(in oklab, var(--status-red) 8%, transparent)"},role:"alert",children:t("remote.audit.loadFailed")}):!s||s.length===0?c.jsx("div",{className:"px-2 py-2 text-xs text-ter",children:t("remote.audit.empty")}):c.jsx("ul",{className:"scroll-y flex max-h-[160px] flex-col gap-px rounded border",style:{borderColor:"var(--border)",background:"var(--bg-0)"},children:s.map(g=>{const p=g.result!=="ok";return c.jsxs("li",{className:"flex items-center gap-2 px-2.5 py-1.5 text-xs","data-testid":`remote-audit-row-${g.id}`,style:p?{background:"color-mix(in oklab, var(--status-red) 6%, transparent)"}:void 0,children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 shrink-0 rounded-full",style:{background:p?"var(--status-red)":"var(--status-green)"},"aria-hidden":!0}),c.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[c.jsx("span",{className:"font-medium text-pri",children:g.action}),g.endpoint?c.jsx("span",{className:"ml-1 text-ter",children:g.endpoint}):null,g.preview?c.jsxs("span",{className:"ml-1 text-ter",children:["· ",g.preview]}):null,typeof g.byteCount=="number"?c.jsxs("span",{className:"ml-1 text-ter",children:["· ",t("remote.audit.bytes",{count:g.byteCount})]}):null]}),p?c.jsxs("span",{className:"shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium",style:{color:"color-mix(in oklab, var(--status-red) 55%, white)",background:"color-mix(in oklab, var(--status-red) 14%, transparent)"},children:[t(IR[g.result]),g.rejectReason?` · ${g.rejectReason}`:""]}):null,c.jsx("span",{className:"shrink-0 tabular-nums text-ter",children:qR(g.ts)})]},g.id)})})}):null]})},ab=t=>{const a=Math.max(0,Date.now()-t),o=Math.floor(a/6e4);if(o<1)return"<1m";if(o<60)return`${o}m`;const s=Math.floor(o/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`},FR=({reloadKey:t=0})=>{const{t:a}=be(),o=sn(),[s,l]=y.useState(null),[u,f]=y.useState(!1),[m,g]=y.useState(null),p=y.useCallback(async()=>{f(!1);try{const k=await dw();l(k)}catch{f(!0)}},[]);y.useEffect(()=>{p()},[p,t]);const b=async k=>{try{await PN(k.deviceId),o.show({kind:"success",message:a("remote.devices.revoked",{name:k.name})}),await p()}catch{o.show({kind:"error",message:a("remote.devices.revokeFailed")})}},v=(s??[]).filter(k=>!k.revoked);return c.jsxs("div",{className:"p-1.5","data-testid":"remote-device-list",children:[c.jsx("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-ter",children:a("remote.devices.heading")}),u?c.jsx("div",{className:"text-xs",style:{color:"var(--text-error)"},role:"alert",children:a("remote.devices.loadFailed")}):v.length===0?c.jsx("div",{className:"text-xs text-ter",children:a("remote.devices.empty")}):c.jsx("ul",{className:"flex flex-col gap-1",children:v.map(k=>c.jsxs("li",{className:"flex items-center justify-between gap-2 rounded p-1.5 hover:bg-3","data-testid":`remote-device-${k.deviceId}`,children:[c.jsxs("span",{className:"min-w-0",children:[c.jsx("span",{className:"block truncate text-sm text-pri",children:k.name}),c.jsx("span",{className:"block text-xs text-ter",children:k.lastActive===null?a("remote.devices.neverActive"):ab(k.lastActive)==="<1m"?a("remote.devices.activeNow"):a("remote.devices.lastActive",{ago:ab(k.lastActive)})})]}),c.jsx("button",{type:"button","data-testid":`remote-device-revoke-${k.deviceId}`,"aria-label":a("remote.devices.revokeAria",{name:k.name}),onClick:()=>g(k),className:"icon-btn icon-btn--danger shrink-0",children:a("remote.devices.revoke")})]},k.deviceId))}),c.jsx(pi,{open:m!==null,onOpenChange:k=>{k||g(null)},title:a("remote.devices.revokeTitle"),description:m?a("remote.devices.revokeConfirm",{name:m.name}):"",confirmLabel:a("remote.devices.revoke"),confirmKind:"danger",onConfirm:()=>{m&&b(m)}})]})},KR=2e3,im={enabled:!1,loggedIn:!1,gatewayUrl:null,connected:!1,connection:"disabled"},kx=y.createContext({status:im,loading:!0,setEnabled:async()=>{},pending:null,refresh:async()=>{}}),YR=({children:t})=>{const a=yt(),[o,s]=y.useState(im),[l,u]=y.useState(!0),[f,m]=y.useState(null);y.useEffect(()=>{let v=!1;return yf().then(k=>{v||s(k)}).catch(()=>{}).finally(()=>{v||u(!1)}),()=>{v=!0}},[]);const g=y.useCallback(async v=>{const k=await BN(v);s(k),k.enabled||m(null)},[]),p=y.useCallback(async()=>{const v=await yf().catch(()=>im);s(v),v.enabled&&v.loggedIn&&!a?m(await My().catch(()=>null)):m(null)},[a]),b=o.enabled&&o.loggedIn&&!a;return y.useEffect(()=>{if(!b){m(null);return}let v=!1;const k=()=>{yf().then(S=>{v||s(S)}).catch(()=>{}),My().then(S=>{v||m(S)}).catch(()=>{})};k();const E=window.setInterval(k,KR);return()=>{v=!0,window.clearInterval(E)}},[b]),c.jsx(kx.Provider,{value:{status:o,loading:l,setEnabled:g,pending:f,refresh:p},children:t})},ep=()=>y.useContext(kx),$R={online:"var(--status-green)",connecting:"var(--status-amber, #d29922)",reconnecting:"var(--status-amber, #d29922)",revoked:"var(--status-red, #f85149)",loggedOut:"var(--text-ter)",disabled:"var(--text-ter)"},VR={connecting:"remote.status.connecting",reconnecting:"remote.status.reconnecting",revoked:"remote.status.revoked"},GR=()=>{const{t}=be(),a=sn(),o=yt(),{status:s,loading:l,setEnabled:u,pending:f}=ep(),m=$R[s.connection],g=VR[s.connection],[p,b]=y.useState(!1),[v,k]=y.useState(!1),[E,S]=y.useState(!1),[w,C]=y.useState(!1),[T,N]=y.useState(!1),[j,A]=y.useState(null),[O,D]=y.useState(!1),L=y.useRef(null),[P,J]=y.useState(0),Q=y.useRef(!1);y.useEffect(()=>{f?Q.current=!0:Q.current&&(Q.current=!1,J(W=>W+1))},[f]),y.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]),y.useEffect(()=>{let W=!1;return XN().then(G=>{W||(A(G),D(!1))}).catch(()=>{W||D(!0)}),()=>{W=!0}},[]);const $=async W=>{k(!1),b(!0);try{await u(W)}catch{k(!0)}finally{b(!1)}},F=W=>{if(!W&&o){S(!0);return}$(W)},ne=async()=>{if(!w){C(!0);try{const W=GN().then(G=>JSON.stringify(G,null,2));await mw(W),N(!0),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{N(!1),L.current=null},1200),a.show({kind:"success",message:t("remote.diagnostics.copied")})}catch{a.show({kind:"error",message:t("remote.diagnostics.copyFailed")})}finally{C(!1)}}},Z=j?.current_streak_days??0,q=j?.days_active_total??0,M=j?.totals?.send??0,U=j?.totals?.report??0;return c.jsxs("div",{className:"settings-section","data-testid":"remote-access-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(m0,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("remote.section")})]}),c.jsxs("div",{className:"settings-toggle-row",onClick:()=>{!l&&!p&&F(!s.enabled)},children:[c.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[c.jsx("span",{className:"block text-sm font-medium text-pri",children:t("remote.enable.label")}),c.jsx("span",{className:"mt-0.5 block text-xs text-ter leading-relaxed",children:t("remote.enable.description")})]}),c.jsx("div",{className:"mt-0.5 shrink-0",children:c.jsx(xx,{checked:s.enabled,disabled:l||p,onChange:F,"data-testid":"settings-toggle-remote","aria-label":t("remote.enable.label")})})]}),v?c.jsx("div",{className:"mt-1 ml-2 text-xs",style:{color:"var(--text-error)"},role:"alert",children:t("settings.saveError")}):null,c.jsxs("button",{type:"button","data-testid":"remote-copy-diagnostics",onClick:ne,disabled:w,className:"icon-btn mt-2 w-full justify-center pointer-coarse:min-h-11",children:[T?c.jsx(ga,{size:12,"aria-hidden":!0}):c.jsx(Dr,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t(w?"remote.diagnostics.copying":T?"remote.diagnostics.copied":"remote.diagnostics.copy")})]}),c.jsxs("div",{className:"mt-2 rounded border px-3 py-2 text-xs","data-testid":"retention-diagnostics-panel",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[c.jsx("span",{className:"font-medium text-sec",children:t("remote.retention.title")}),c.jsx("span",{className:"text-ter",children:t("remote.retention.localOnly")})]}),O?c.jsx("p",{className:"text-ter",children:t("remote.retention.loadFailed")}):j?c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:Z}),c.jsx("div",{className:"text-ter",children:t("remote.retention.streak")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:q}),c.jsx("div",{className:"text-ter",children:t("remote.retention.activeDays")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:M}),c.jsx("div",{className:"text-ter",children:t("remote.retention.sends")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:U}),c.jsx("div",{className:"text-ter",children:t("remote.retention.reports")})]})]}):c.jsx("p",{className:"text-ter",children:t("common.loading")})]}),s.enabled?c.jsxs("div",{className:"mt-2 border-t pt-2",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex items-center gap-2 rounded px-2 py-1.5 text-xs","data-testid":"remote-login-status",children:[c.jsx("span",{"aria-hidden":!0,"data-connection":s.connection,className:"inline-block h-2 w-2 rounded-full",style:{background:m}}),c.jsx("span",{className:"min-w-0 text-sec",children:g?t(g):s.loggedIn?t("remote.status.linked",{gateway:s.gatewayUrl??""}):t("remote.status.notLinked")})]}),s.loggedIn&&!o?c.jsx(WR,{}):null,c.jsx(FR,{reloadKey:P}),c.jsx(PR,{})]}):null,c.jsx(pi,{open:E,onOpenChange:W=>{W||S(!1)},title:t("remote.disable.confirmTitle"),description:t("remote.disable.confirmBody"),confirmLabel:t("common.stop"),confirmKind:"danger",onConfirm:()=>{$(!1)}})]})},Sx=y.createContext({enabled:!0,loading:!0,setEnabled:async()=>{}}),XR=({children:t})=>{const[a,o]=y.useState(!0),[s,l]=y.useState(!0);y.useEffect(()=>{let f=!1;return uN().then(m=>{f||o(m.enabled)}).catch(()=>{}).finally(()=>{f||l(!1)}),()=>{f=!0}},[]);const u=y.useCallback(async f=>{const m=await dN(f);o(m.enabled)},[]);return c.jsx(Sx.Provider,{value:{enabled:a,loading:s,setEnabled:u},children:t})},ZR=()=>y.useContext(Sx),Ex=y.createContext({enabled:!1,loading:!0,setEnabled:async()=>{}}),QR=({children:t})=>{const[a,o]=y.useState(!1),[s,l]=y.useState(!0);y.useEffect(()=>{let f=!1;return lN().then(m=>{f||o(m.enabled)}).catch(()=>{}).finally(()=>{f||l(!1)}),()=>{f=!0}},[]);const u=y.useCallback(async f=>{const m=await cN(f);o(m.enabled)},[]);return c.jsx(Ex.Provider,{value:{enabled:a,loading:s,setEnabled:u},children:t})},Cx=()=>y.useContext(Ex),JR=()=>{const{language:t,setLanguage:a,t:o}=be();return c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(mE,{size:12,"aria-hidden":!0}),c.jsx("span",{children:o("settings.language")})]}),c.jsxs("div",{className:"flex gap-1 p-1 rounded border",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:[c.jsx("button",{type:"button",className:"flex-1 py-1 px-2 rounded text-xs font-medium transition-colors cursor-pointer",style:{background:t==="zh"?"var(--bg-3)":"transparent",color:t==="zh"?"var(--text-primary)":"var(--text-secondary)",border:"none"},onClick:()=>a("zh"),"data-testid":"language-zh-btn",children:"中文"}),c.jsx("button",{type:"button",className:"flex-1 py-1 px-2 rounded text-xs font-medium transition-colors cursor-pointer",style:{background:t==="en"?"var(--bg-3)":"transparent",color:t==="en"?"var(--text-primary)":"var(--text-secondary)",border:"none"},onClick:()=>a("en"),"data-testid":"language-en-btn",children:"English"})]})]})},rb=({feature:t,label:a,description:o,testId:s})=>{const{t:l}=be(),[u,f]=y.useState(!1),[m,g]=y.useState(!1),p=async b=>{g(!1),f(!0);try{await t.setEnabled(b)}catch{g(!0)}finally{f(!1)}};return c.jsxs("div",{className:"settings-toggle-row",onClick:()=>{!t.loading&&!u&&p(!t.enabled)},children:[c.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[c.jsx("span",{className:"block text-sm font-medium text-pri",children:a}),c.jsx("span",{className:"mt-0.5 block text-xs text-ter leading-relaxed",children:o}),m?c.jsx("span",{className:"mt-1 block text-xs",style:{color:"var(--text-error)"},role:"alert",children:l("settings.saveError")}):null]}),c.jsx("div",{className:"mt-0.5 shrink-0",children:c.jsx(xx,{checked:t.enabled,disabled:t.loading||u,onChange:b=>{p(b)},"data-testid":s,"aria-label":a})})]})},e3=()=>{const{t}=be(),[a,o]=y.useState(""),[s,l]=y.useState(!1),[u,f]=y.useState(!1),[m,g]=y.useState(null);y.useEffect(()=>{let b=!1;return sN().then(v=>{b||(o(v),l(!0))}).catch(()=>{b||l(!0)}),()=>{b=!0}},[]);const p=async()=>{g(null),f(!0);try{await iN(a),g("saved")}catch{g("error")}finally{f(!1)}};return c.jsxs("div",{children:[c.jsx("label",{className:"mb-1.5 block text-sm font-medium text-pri",htmlFor:"settings-webhook-url",children:t("settings.webhook.label")}),c.jsx("span",{className:"mb-2 block text-xs text-ter leading-relaxed",children:t("settings.webhook.description")}),c.jsx("input",{id:"settings-webhook-url",type:"url",inputMode:"url",placeholder:"https://…",className:"input",value:a,disabled:!s||u,onChange:b=>{g(null),o(b.target.value)},onBlur:()=>{p()},onKeyDown:b=>{if(b.key==="Enter"){if(b.nativeEvent.isComposing||b.keyCode===229)return;b.currentTarget.blur()}},"data-testid":"settings-webhook-url"}),m==="saved"?c.jsxs("span",{className:"mt-1.5 block text-xs",style:{color:"var(--status-green)"},children:["✓ ",t("settings.webhook.saved")]}):null,m==="error"?c.jsx("span",{className:"mt-1.5 block text-xs",style:{color:"var(--text-error)"},role:"alert",children:t("settings.saveError")}):null]})},Tx=()=>{const{t}=be(),a=Cx(),o=ZR();return c.jsxs("div",{className:"flex flex-col gap-2.5",children:[c.jsx(JR,{}),c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(Ql,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("settings.experimental")})]}),c.jsx(rb,{feature:a,label:t("settings.workflows.label"),description:t("settings.workflows.description"),testId:"settings-toggle-workflows"}),c.jsx(rb,{feature:o,label:t("settings.autostaff.label"),description:t("settings.autostaff.description"),testId:"settings-toggle-autostaff"})]}),c.jsx(GR,{}),c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(tC,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("settings.webhook.label")})]}),c.jsx(e3,{})]})]})},Nx=()=>{const{t}=be(),a=yt(),[o,s]=y.useState(!1),l=y.useRef(null),u=y.useRef(null);return y.useEffect(()=>{if(!o)return;const f=g=>{g.key==="Escape"&&(s(!1),u.current?.focus())},m=g=>{const p=l.current;p&&!p.contains(g.target)&&s(!1)};return document.addEventListener("keydown",f),document.addEventListener("pointerdown",m),()=>{document.removeEventListener("keydown",f),document.removeEventListener("pointerdown",m)}},[o]),c.jsxs("div",{ref:l,className:"relative",children:[c.jsx(Je,{label:t("settings.tooltip"),children:c.jsx("button",{ref:u,type:"button","aria-expanded":o,"aria-haspopup":"dialog","aria-label":t("settings.aria"),className:"flex h-7 w-7 cursor-pointer items-center justify-center rounded text-sec hover:bg-3 hover:text-pri","data-testid":"topbar-app-settings",onClick:()=>s(f=>!f),children:c.jsx(Xf,{size:14,"aria-hidden":!0})})}),o?c.jsxs("div",{role:"dialog","aria-label":t("settings.aria"),className:a?"settings-sheet fixed inset-0 z-50 flex flex-col overflow-y-auto p-4":"settings-popover elev-2 absolute top-8 right-0 z-50 w-[380px] max-h-[calc(100vh-64px)] overflow-y-auto scroll-y rounded-lg border p-4","data-mobile":a||void 0,style:a?{background:"var(--bg-0)"}:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-testid":"app-settings-menu",children:[c.jsxs("div",{className:"mb-4 flex items-start gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent)"},children:c.jsx(Xf,{size:18,"aria-hidden":!0})}),c.jsxs("div",{className:a?"min-w-0 flex-1":"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-pri",children:t("settings.heading")}),c.jsx("div",{className:"text-xs text-ter",children:t("settings.subtitle")})]}),a?c.jsx("button",{type:"button",onClick:()=>s(!1),"aria-label":t("common.close"),"data-testid":"mobile-settings-close",className:"icon-btn icon-btn--ghost shrink-0",children:c.jsx(fa,{size:16,"aria-hidden":!0})}):null]}),c.jsx(Tx,{})]}):null]})},jx=t=>{const[a,o]=y.useState(null);return y.useEffect(()=>{if(t!==void 0)return;let s=!0;return JT().then(l=>{s&&o(l)}).catch(()=>{s&&o(null)}),()=>{s=!1}},[t]),t===void 0?a:t},t3="2.1.17",n3={version:t3},tp=n3.version,a3=({actions:t,hideActions:a=!1,memoryOpen:o=!1,onToggleMemory:s,onToggleTaskGraph:l,openTaskCount:u=0,taskGraphOpen:f=!1,onToggleWorkflows:m,workflowsOpen:g=!1,version:p=tp,versionInfo:b})=>{const{t:v}=be(),[k,E]=y.useState("idle"),S=jx(b),w=S?.updateAvailable&&S.latestVersion!==p?S:null,C=!!w?.installHint,T=u>0,N=f?v("topbar.hideTodo"):T?v("topbar.todoOpen",{count:u}):v("topbar.showTodo"),j=async()=>{if(w?.installHint)try{await navigator.clipboard.writeText(w.installHint),E("copied"),window.setTimeout(()=>E("idle"),1600)}catch{E("error"),window.setTimeout(()=>E("idle"),2200)}},A=v(k==="copied"?"topbar.updateCommandCopied":k==="error"?"topbar.updateCommandCopyFailed":"topbar.copyUpdateCommand");return c.jsxs("header",{className:"flex h-11 shrink-0 items-center px-4",style:{background:"var(--bg-0)",borderBottom:"1px solid var(--border)"},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsxs("a",{href:"https://hivehq.dev",target:"_blank",rel:"noopener noreferrer","aria-label":v("topbar.openWebsite"),title:v("topbar.openWebsite"),className:"-mx-1 flex items-center gap-2 rounded px-1 transition-opacity hover:opacity-80 focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-brand-link",children:[c.jsx("img",{src:"/logo.png",alt:"","aria-hidden":!0,className:"h-5 w-5 rounded-md","data-testid":"topbar-logo"}),c.jsx("span",{className:"font-semibold text-pri",children:"Hive"}),c.jsxs("span",{className:"text-ter text-xs tabular-nums",children:["v",p]})]}),w?c.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-xs","data-testid":"topbar-update-badge",children:[c.jsx("span",{className:"rounded border px-2 py-0.5 font-medium",style:{background:"color-mix(in oklab, var(--accent) 10%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 30%, transparent)",color:"var(--accent)"},children:v("topbar.updateAvailable")}),c.jsxs("span",{className:"hidden text-ter sm:inline",children:["v",p," → v",w.latestVersion]}),C?c.jsx("code",{className:"mono hidden max-w-[18rem] truncate rounded border px-1.5 py-0.5 text-ter md:inline-block",title:w.updateNote||w.installHint,style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:w.installHint}):null,w.updateNote?c.jsx("span",{className:"hidden max-w-[18rem] truncate text-ter xl:inline",title:w.updateNote,children:w.updateNote}):null,C?c.jsx(Je,{label:A,children:c.jsx("button",{type:"button",onClick:j,"aria-label":A,className:"flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded border text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-copy-update-command",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:k==="copied"?c.jsx(ga,{size:12}):c.jsx(Dr,{size:12})})}):null,w.releaseUrl?c.jsx(Je,{label:v("topbar.openRelease"),children:c.jsx("a",{href:w.releaseUrl,target:"_blank",rel:"noopener noreferrer","aria-label":v("topbar.openRelease"),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded border text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-open-release",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:c.jsx(_m,{size:12})})}):null]}):null]}),c.jsx("div",{className:"flex-1"}),a?null:c.jsxs("div",{className:"flex items-center gap-1",children:[t,s?c.jsx(Je,{label:v(o?"topbar.hideMemory":"topbar.showMemory"),children:c.jsxs("button",{type:"button",onClick:s,"aria-pressed":o,"aria-label":v(o?"topbar.hideMemory":"topbar.showMemory"),className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-memory",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(_S,{size:13}),c.jsx("span",{children:v("topbar.memory")})]})}):null,l?c.jsx(Je,{label:N,children:c.jsxs("button",{type:"button",onClick:l,"aria-pressed":f,"aria-label":N,"data-has-tasks":T?"true":void 0,className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-blueprint",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(d0,{size:13,className:T?"text-accent":void 0}),c.jsx("span",{children:v("topbar.todo")})]})}):null,m?c.jsx(Je,{label:v(g?"topbar.hideWorkflows":"topbar.showWorkflows"),children:c.jsxs("button",{type:"button",onClick:m,"aria-pressed":g,"aria-label":v(g?"topbar.hideWorkflows":"topbar.showWorkflows"),className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-workflows",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(v0,{size:13}),c.jsx("span",{children:v("topbar.workflows")})]})}):null,c.jsx(UR,{}),c.jsx(Nx,{})]})]})},Ax="hive.workspace-sidebar.width",ri=56,np=280,Df=ri,ob=16,r3=240,sb=96,Gl=t=>Math.min(np,Math.max(ri,t)),o3=()=>{try{const t=localStorage.getItem(Ax);if(!t)return Df;const a=Number.parseInt(t,10);return Number.isFinite(a)?Gl(a):Df}catch{return Df}},s3=()=>{const[t,a]=y.useState(o3),[o,s]=y.useState(!1);y.useEffect(()=>{try{localStorage.setItem(Ax,String(Math.round(t)))}catch{}},[t]);const l=y.useCallback(g=>{g.preventDefault();const p=g.clientX,b=t;s(!0);const v=document.body.style.cursor,k=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const E=w=>{a(Gl(b+w.clientX-p))},S=()=>{s(!1),document.body.style.cursor=v,document.body.style.userSelect=k,document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",S)};document.addEventListener("mousemove",E),document.addEventListener("mouseup",S)},[t]),u=t<=sb,f=y.useCallback(()=>{a(g=>g<=sb?r3:ri)},[]),m=y.useCallback(g=>{g.key==="ArrowLeft"?(g.preventDefault(),a(p=>Gl(p-ob))):g.key==="ArrowRight"?(g.preventDefault(),a(p=>Gl(p+ob))):g.key==="Home"?(g.preventDefault(),a(ri)):g.key==="End"&&(g.preventDefault(),a(np))},[]);return{beginResize:l,collapsed:u,onResizeKeyDown:m,resizing:o,toggleCollapsed:f,width:t}},i3=({children:t,hideTopbarActions:a=!1,memoryOpen:o=!1,onToggleMemory:s,onToggleTaskGraph:l,openTaskCount:u=0,onToggleWorkflows:f,workflowsOpen:m=!1,sidebar:g,sidebarResize:p,taskGraphOpen:b=!1,topbarActions:v,versionInfo:k})=>{const{t:E}=be();return c.jsxs("div",{className:"flex h-screen w-full flex-col overflow-hidden",style:{background:"var(--bg-0)",color:"var(--text-primary)"},children:[c.jsx(a3,{actions:v,hideActions:a,memoryOpen:o,onToggleMemory:s,onToggleTaskGraph:l,openTaskCount:u,taskGraphOpen:b,onToggleWorkflows:f,versionInfo:k,workflowsOpen:m}),c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden",children:[c.jsxs("aside",{"aria-label":E("layout.sidebarAria"),className:"workspace-sidebar relative flex shrink-0 flex-col","data-resizing":p.resizing?"true":"false",style:{background:"var(--bg-0)",boxShadow:"inset -1px 0 0 var(--border)",width:`${p.width}px`},children:[g,c.jsx("hr",{"aria-label":E("layout.sidebarResizeAria"),"aria-orientation":"vertical","aria-valuemin":ri,"aria-valuemax":np,"aria-valuenow":Math.round(p.width),tabIndex:0,className:"workspace-sidebar-resizer","data-resizing":p.resizing?"true":"false",onMouseDown:p.beginResize,onKeyDown:p.onResizeKeyDown})]}),c.jsx("section",{className:"relative flex min-w-0 flex-1 overflow-hidden",children:t})]})]})},l3={disconnected:"mobile.reconnect.disconnected",reconnecting:"mobile.reconnect.reconnecting",revoked:"mobile.reconnect.revoked"},c3=({status:t})=>{const{t:a}=be();if(!t||t.state!=="reconnecting"&&t.state!=="disconnected"&&t.state!=="revoked")return null;const o=t.state==="revoked"?"var(--status-red)":"var(--status-orange)",s=t.state==="disconnected"?t.retry:void 0;return c.jsxs("div",{role:"status","data-testid":"mobile-reconnect-banner",className:"flex items-center justify-center gap-2 px-3 py-1.5 text-center text-xs",style:{background:`color-mix(in oklab, ${o} 18%, var(--bg-0))`,color:o},children:[c.jsx("span",{children:a(l3[t.state])}),s?c.jsx("button",{type:"button","data-testid":"mobile-reconnect-retry",className:"rounded border px-2 py-0.5 font-medium",style:{borderColor:"currentColor",color:"currentColor"},onClick:s,children:a("mobile.reconnect.retry")}):null]})},u3=[{accent:"var(--status-green)",descriptionKey:"notifications.sound.soft.description",labelKey:"notifications.sound.soft.label",length:"short",value:"soft"},{accent:"var(--status-blue)",descriptionKey:"notifications.sound.ping.description",labelKey:"notifications.sound.ping.label",length:"short",value:"ping"},{accent:"var(--status-gold)",descriptionKey:"notifications.sound.chime.description",labelKey:"notifications.sound.chime.label",length:"short",value:"chime"},{accent:"var(--accent)",descriptionKey:"notifications.sound.cascade.description",labelKey:"notifications.sound.cascade.label",length:"long",value:"cascade"},{accent:"var(--status-orange)",descriptionKey:"notifications.sound.beacon.description",labelKey:"notifications.sound.beacon.label",length:"long",value:"beacon"},{accent:"var(--status-purple)",descriptionKey:"notifications.sound.resolve.description",labelKey:"notifications.sound.resolve.label",length:"long",value:"resolve"},{accent:"var(--text-tertiary)",descriptionKey:"notifications.sound.off.description",labelKey:"notifications.sound.off.label",length:"silent",value:"off"}],d3=[{descriptionKey:"notifications.detail.brief.description",labelKey:"notifications.detail.brief.label",value:"brief"},{descriptionKey:"notifications.detail.detailed.description",labelKey:"notifications.detail.detailed.label",value:"detailed"}],f3=()=>{const{t}=be(),a=yt(),{notify:o,previewSound:s,requestDesktopNotifications:l,settings:u,updateSettings:f}=Lc(),m=typeof window<"u"&&!("Notification"in window),g=y.useMemo(()=>u3.map(v=>({...v,description:t(v.descriptionKey),label:t(v.labelKey)})),[t]),p=y.useMemo(()=>d3.map(v=>({...v,description:t(v.descriptionKey),label:t(v.labelKey)})),[t]),b=v=>{if(!v){f({desktop:!1});return}l()};return c.jsxs("details",{className:"settings-details group",children:[c.jsxs("summary",{className:"settings-details__summary",children:[c.jsxs("div",{className:"settings-section__heading !mb-0",children:[c.jsx(Gf,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("notifications.settings.heading")})]}),c.jsx(qo,{size:14,className:"text-sec transition-transform group-open:rotate-180","aria-hidden":!0})]}),c.jsxs("div",{className:"settings-details__content flex flex-col gap-3.5",children:[c.jsxs("section",{children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-[10px] font-semibold uppercase tracking-wider",children:[c.jsx(ec,{size:12,"aria-hidden":!0}),t("notifications.sound.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.sound.sectionLabel"),className:a?"grid grid-cols-1 gap-2":"grid grid-cols-2 gap-2",children:g.map(v=>c.jsxs("div",{className:"relative min-h-[78px] rounded border transition-colors",style:{background:u.sound===v.value?`color-mix(in oklab, ${v.accent} 10%, var(--bg-2))`:"var(--bg-2)",borderColor:u.sound===v.value?`color-mix(in oklab, ${v.accent} 54%, var(--border-bright))`:"var(--border)"},children:[c.jsxs("label",{className:"block h-full w-full cursor-pointer rounded px-3 py-2 pr-10 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",children:[c.jsx("input",{type:"radio",name:"notification-sound",value:v.value,checked:u.sound===v.value,className:"sr-only",onChange:()=>f({sound:v.value})}),c.jsxs("span",{className:"mb-1 flex items-center gap-2",children:[c.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:`color-mix(in oklab, ${v.accent} 16%, transparent)`,color:v.accent},children:v.value==="off"?c.jsx(g0,{size:12,"aria-hidden":!0}):c.jsx(ec,{size:12,"aria-hidden":!0})}),c.jsx("span",{className:"font-medium text-pri text-xs",children:v.label}),v.length==="long"?c.jsx("span",{className:"rounded border border-[var(--border-bright)] px-1.5 py-0.5 text-[10px] text-ter uppercase",children:t("notifications.sound.longerBadge")}):null,u.sound===v.value?c.jsx(ga,{size:12,className:"ml-auto text-pri","aria-hidden":!0}):null]}),c.jsx("span",{className:"block text-ter text-[11px] leading-relaxed",children:v.description})]}),v.value!=="off"?c.jsx("button",{type:"button","aria-label":t("notifications.sound.previewAria",{label:v.label}),className:"absolute right-2 bottom-2 flex h-6 w-6 pointer-coarse:h-10 pointer-coarse:w-10 items-center justify-center rounded border text-sec transition-colors hover:bg-3 hover:text-pri cursor-pointer",style:{borderColor:"var(--border-bright)"},onClick:()=>s(v.value),children:c.jsx(Po,{size:12,"aria-hidden":!0})}):null]},v.value))})]}),c.jsxs("section",{children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-[10px] font-semibold uppercase tracking-wider",children:[c.jsx(u0,{size:12,"aria-hidden":!0}),t("notifications.detail.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.detail.sectionLabel"),className:"grid grid-cols-2 rounded border p-1",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:p.map(v=>c.jsxs("label",{className:"cursor-pointer rounded px-3 py-2 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",style:{background:u.detail===v.value?"var(--bg-3)":"transparent",color:u.detail===v.value?"var(--text-primary)":"var(--text-secondary)"},children:[c.jsx("input",{type:"radio",name:"notification-detail",value:v.value,checked:u.detail===v.value,className:"sr-only",onChange:()=>f({detail:v.value})}),c.jsx("span",{className:"block font-medium text-xs",children:v.label}),c.jsx("span",{className:"block text-ter text-[11px] leading-relaxed",children:v.description})]},v.value))})]}),c.jsxs("label",{className:"flex items-start gap-2 rounded border p-2 text-sec text-xs cursor-pointer",children:[c.jsx("input",{type:"checkbox","aria-label":t("notifications.desktop.aria"),checked:u.desktop,disabled:m,className:"mt-0.5 cursor-pointer",onChange:v=>b(v.currentTarget.checked)}),c.jsxs("span",{children:[c.jsx("span",{className:"block font-medium text-pri",children:t("notifications.desktop.label")}),c.jsx("span",{className:"text-ter leading-relaxed",children:t(m?"notifications.desktop.unsupported":"notifications.desktop.helper")})]})]}),c.jsx("div",{className:"flex justify-end gap-2 border-t pt-3",style:{borderColor:"var(--border)"},children:c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary ml-auto cursor-pointer",onClick:()=>o({brief:t("notifications.test.brief"),detail:t("notifications.test.detail"),kind:"success",title:t("notifications.test.title")}),children:t("notifications.test.button")})})]})]})},m3=({demoMode:t,onTryDemo:a,onExitDemo:o})=>{const{t:s}=be();return c.jsxs("div",{className:"mobile-settings-section flex min-h-full flex-col p-4","data-testid":"mobile-settings-section",children:[c.jsx("h1",{className:"mb-4 text-base font-semibold text-pri",children:s("mobile.section.settings")}),c.jsx(Tx,{}),c.jsx(f3,{}),c.jsxs("div",{className:"settings-section mt-3",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(Ql,{size:12,"aria-hidden":!0}),c.jsx("span",{children:s("mobile.section.demo")})]}),t?c.jsxs("button",{type:"button","data-testid":"mobile-settings-exit-demo",onClick:o,className:"flex w-full items-center gap-3 rounded p-2 text-left text-sm text-pri hover:bg-3",children:[c.jsx(yE,{size:16,"aria-hidden":!0,className:"text-ter"}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:s("demo.exit")})]}):c.jsxs("button",{type:"button","data-testid":"mobile-settings-demo",onClick:a,className:"flex w-full items-center gap-3 rounded p-2 text-left text-sm text-pri hover:bg-3",children:[c.jsx(Ql,{size:16,"aria-hidden":!0,className:"text-ter"}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:s("mobile.section.demo")})]})]})]})},p3={team:Ec,tasks:d0,flows:v0,settings:Xf},h3={team:"mobile.nav.team",tasks:"mobile.nav.tasks",flows:"mobile.nav.flows",settings:"mobile.nav.settings"},g3=({active:t,onSelect:a,sections:o,openTaskCount:s=0,workingCount:l=0})=>{const{t:u}=be();return c.jsx("nav",{"aria-label":u("mobile.nav.aria"),className:"mobile-bottom-nav flex shrink-0 items-stretch","data-testid":"mobile-bottom-nav",style:{background:"var(--bg-0)",borderTop:"1px solid var(--border)"},children:o.map(f=>{const m=p3[f],g=u(h3[f]),p=f===t,b=f==="tasks"&&s>0?s:f==="team"&&l>0?l:0;return c.jsxs("button",{type:"button","aria-label":g,"aria-current":p?"page":void 0,"data-testid":`mobile-nav-${f}`,"data-active":p?"true":void 0,onClick:()=>a(f),className:"mobile-bottom-nav__tab relative flex flex-1 cursor-pointer flex-col items-center justify-center gap-0.5 py-2 text-xs",style:{color:p?"var(--text-primary)":"var(--text-tertiary)"},children:[p?c.jsx("span",{"aria-hidden":!0,className:"absolute top-0 left-1/2 h-0.5 w-8 -translate-x-1/2 rounded-b",style:{background:"var(--accent)"}}):null,c.jsx(m,{size:20,"aria-hidden":!0}),c.jsx("span",{children:g}),b>0?c.jsx("span",{className:"absolute top-1 right-[calc(50%-18px)] inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-1 text-[11px] font-medium tabular-nums leading-none","data-testid":`mobile-nav-${f}-badge`,style:{background:"var(--accent)",color:"#ffffff"},children:b}):null]},f)})})},v3=({workspaceSwitcher:t,actions:a,banner:o})=>c.jsxs("header",{className:"mobile-topbar flex shrink-0 flex-col","data-testid":"mobile-topbar",style:{background:"var(--bg-0)",borderBottom:"1px solid var(--border)"},children:[c.jsxs("div",{className:"flex h-12 items-center gap-2 px-3",children:[c.jsx("div",{className:"min-w-0 flex-1",children:t??c.jsx("span",{className:"font-semibold text-pri",children:"Hive"})}),c.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a})]}),o]}),y3=()=>typeof navigator<"u"&&/iP(hone|ad|od)/.test(navigator.platform??navigator.userAgent),b3=()=>{const[t,a]=y.useState(null);return y.useEffect(()=>{if(!y3())return;const o=typeof window<"u"?window.visualViewport:null;if(!o)return;const s=()=>{const l=Math.abs(o.height-window.innerHeight)<10;a(l?null:o.height)};return s(),o.addEventListener("resize",s),()=>{o.removeEventListener("resize",s)}},[]),t},w3={team:"mobile-section-team",tasks:"mobile-section-tasks",flows:"mobile-section-flows",settings:"mobile-section-settings"},x3=({workspaceSwitcher:t,topbarActions:a,banner:o,fullBleed:s,team:l,tasks:u,flows:f,settings:m,terminalPanels:g,overlays:p,openTaskCount:b=0,workingCount:v=0,activeSection:k,onSectionChange:E})=>{const[S,w]=y.useState("team"),C=k??S,T=b3(),N=P=>{w(P),E?.(P)},j={team:l,tasks:u,flows:f,settings:m},A=["team","tasks"];f!=null&&A.push("flows"),m!=null&&A.push("settings");const O=A.includes(C)?C:"team",L=nx()&&O==="team"&&s==null;return c.jsxs("div",{className:`mobile-shell flex h-dvh w-full max-w-[100vw] min-w-0 flex-col overflow-hidden${L?" mobile-shell--focus":""}`,"data-mobile-shell":"true","data-testid":"mobile-shell","data-focus-mode":L?"true":void 0,style:{background:"var(--bg-0)",color:"var(--text-primary)",...T!=null?{height:`${T}px`}:{}},children:[L?o:c.jsx(v3,{workspaceSwitcher:t,actions:a,banner:o}),c.jsx("main",{className:"relative min-h-0 min-w-0 flex-1 overflow-hidden",children:s??c.jsx("div",{className:O==="team"?"flex h-full min-w-0 flex-col overflow-hidden":"flex h-full min-w-0 flex-col overflow-y-auto","data-testid":w3[O],"data-mobile-section":O,children:j[O]})}),g,s!=null||L?null:c.jsx(g3,{active:O,onSelect:N,sections:A,openTaskCount:b,workingCount:v}),p]})},k3=[],S3=y.lazy(()=>Mt(()=>import("./TaskGraphDrawer-Bc3ntINN.js"),[]).then(t=>({default:t.TaskGraphContent}))),E3=({tasksFile:t,workspacePath:a,workers:o,onSelectOwner:s,onAddWorkspace:l,demoMode:u=!1})=>{const{t:f}=be(),m=o??k3,g=y.useMemo(()=>m.length?m.map(p=>p.name):void 0,[m]);return a?c.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[u?c.jsx("div",{className:"flex shrink-0 items-center justify-end px-3 py-1",children:c.jsx("span",{className:"pill pill--neutral text-xs",children:f("demo.readOnlyBadge")})}):null,c.jsx("div",{className:"min-h-0 flex-1",children:c.jsx(y.Suspense,{fallback:null,children:c.jsx(S3,{content:t.content,hasConflict:t.hasConflict,onContentChange:t.onChange,onKeepLocal:t.onKeepLocal,onReload:t.onReload,onSave:t.onSave,onToggleTaskLine:p=>{t.toggleTaskAtLine(p).catch(Va("tasks.toggleTaskAtLine"))},onAppendTask:p=>{t.appendTask(p).catch(Va("tasks.appendTask"))},onAppendSubtask:(p,b)=>{t.appendSubtask(p,b).catch(Va("tasks.appendSubtask"))},onUpdateTaskText:(p,b)=>{t.updateTaskText(p,b).catch(Va("tasks.updateTaskText"))},onDeleteTask:p=>{t.deleteTask(p).catch(Va("tasks.deleteTask"))},workspacePath:a,...g?{knownWorkerNames:g}:{},...s?{onSelectOwner:s}:{}})})})]}):c.jsx("div",{className:"flex h-full flex-col","data-testid":"mobile-tasks-empty",children:c.jsx(mi,{title:f("mobile.tasks.noWorkspaceTitle"),description:f("mobile.tasks.noWorkspaceDesc"),action:l?c.jsx("button",{type:"button",onClick:l,className:"icon-btn icon-btn--primary mt-1 flex min-h-11 items-center gap-1.5 px-4 py-2 text-xs font-medium",children:f("firstRun.addWorkspace")}):void 0})})},ib=[{token:"var(--accent)",label:"accent"},{token:"var(--status-blue)",label:"blue"},{token:"var(--status-purple)",label:"purple"},{token:"var(--status-orange)",label:"orange"},{token:"var(--status-green)",label:"green"},{token:"var(--status-gold)",label:"gold"}],C3=t=>{let a=0;for(let s=0;s<t.length;s+=1)a=a*31+t.charCodeAt(s)|0;const o=Math.abs(a)%ib.length;return ib[o]},T3=t=>{const a=t.trim();if(a.length===0)return"?";const o=a.codePointAt(0);return o===void 0?"?":String.fromCodePoint(o).toUpperCase()},lm=({workspaceId:t,name:a,isActive:o,working:s,workingCount:l,size:u=32})=>{const{token:f,label:m}=C3(t),g=T3(a),p=l&&l>1?l:null;return c.jsx(hx,{size:u,color:f,fontRatio:.45,ringColor:o?f:null,testId:"workspace-avatar",data:{"workspace-id":t,active:o?"true":void 0,"color-label":m},decoration:p!==null?c.jsx("span",{className:"absolute flex h-[16px] min-w-[16px] items-center justify-center rounded-full px-1 font-medium text-xs tabular-nums leading-none",style:{right:"-4px",bottom:"-4px",background:"var(--status-green)",color:"#0a1f0a",boxShadow:"0 0 0 2px var(--bg-1)"},"data-testid":"workspace-avatar-working-count","aria-hidden":!0,children:p>9?"9+":p}):s?c.jsx("span",{className:"status-dot status-dot--working absolute",style:{right:"-2px",bottom:"-2px",boxShadow:"0 0 0 2px var(--bg-1)"},"aria-hidden":!0}):null,children:g})},lb=(t,a)=>{if(!t||t.length===0)return a("sidebar.noMembers");const o=t.filter(s=>s.status==="working").length;return o>0?a("sidebar.workingCount",{working:o,total:t.length}):a("sidebar.teamMemberCount",{count:t.length})},N3=({activeWorkspaceId:t,workspaces:a,workersByWorkspaceId:o,createDisabledReason:s,onSelectWorkspace:l,onCreateClick:u,onDeleteWorkspace:f})=>{const{t:m}=be(),g=sn(),[p,b]=y.useState(!1),[v,k]=y.useState(null),[E,S]=y.useState(!1),w=a?.find(T=>T.id===t)?.name??m("mobile.section.workspaces"),C=()=>{if(!v||E)return;const T=v;S(!0),Promise.resolve(f(T)).then(()=>{g.show({kind:"success",message:m("sidebar.removed",{name:T.name})})}).catch(N=>{const j=N instanceof Error?N.message:String(N);g.show({kind:"error",message:m("sidebar.deleteFailed",{message:j})})}).finally(()=>{S(!1),k(null)})};return c.jsxs(Mr,{open:p,onOpenChange:b,children:[c.jsx(KT,{asChild:!0,children:c.jsxs("button",{type:"button","data-testid":"mobile-workspace-switcher-trigger","aria-label":m("mobile.workspaces.switch"),className:"mobile-ws-switcher flex min-h-11 w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left hover:bg-2",children:[c.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-pri",children:w}),c.jsx(qo,{size:16,"aria-hidden":!0,className:"shrink-0 text-ter"})]})}),c.jsxs(Lr,{children:[c.jsx(zr,{"data-testid":"mobile-workspace-switcher-overlay",className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid items-end",children:c.jsxs(Hr,{"data-testid":"mobile-workspace-switcher-sheet",className:"dialog-slide-up elev-2 pointer-events-auto flex max-h-[70dvh] w-full flex-col overflow-hidden rounded-t-xl border-t",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsx(Ur,{asChild:!0,children:c.jsxs("div",{className:"flex shrink-0 items-baseline gap-2 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[c.jsx("span",{className:"text-base font-semibold text-pri",children:m("sidebar.workspaces")}),a&&a.length>0?c.jsx("span",{className:"text-xs text-ter tabular-nums",children:a.length}):null]})}),c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:!a||a.length===0?c.jsxs("div",{className:"flex flex-col items-center gap-1 px-6 py-8 text-center",children:[c.jsx("span",{className:"text-sm font-medium text-sec",children:m("sidebar.noWorkspaces")}),c.jsx("span",{className:"text-xs text-ter",children:s??m("sidebar.noWorkspacesDesc")})]}):a.map(T=>{const N=T.id===t,j=o[T.id],A=j?.filter(O=>O.status==="working").length??0;return c.jsxs("div",{className:"flex items-center gap-1 pr-2",children:[c.jsxs("button",{type:"button","data-testid":`mobile-ws-row-${T.id}`,onClick:()=>{b(!1),l(T.id)},className:"flex min-h-14 min-w-0 flex-1 items-center gap-3 px-4 py-2 text-left",style:N?{background:"color-mix(in oklab, var(--accent) 10%, transparent)"}:void 0,children:[c.jsx(lm,{workspaceId:T.id,name:T.name,isActive:N,working:A>0,workingCount:A,size:36}),c.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[c.jsx("span",{className:"truncate text-sm font-medium text-pri",children:T.name}),c.jsx("span",{className:"truncate text-xs text-ter",children:lb(j,m)})]}),N?c.jsx(ga,{size:18,className:"shrink-0 text-accent","aria-hidden":!0}):null]}),c.jsx("button",{type:"button","aria-label":m("sidebar.deleteAria",{name:T.name}),"data-testid":`mobile-ws-delete-${T.id}`,onClick:()=>k(T),className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-ter",children:c.jsx(Sc,{size:16,"aria-hidden":!0})})]},T.id)})}),c.jsx("div",{className:"shrink-0 border-t px-4 pt-3 pb-[max(12px,env(safe-area-inset-bottom))]",style:{borderColor:"var(--border)",background:"var(--bg-2)"},children:c.jsxs("button",{type:"button",disabled:!!s,title:s,"data-testid":"mobile-ws-create",onClick:()=>{b(!1),u()},className:"icon-btn icon-btn--primary flex w-full min-h-11 items-center justify-center gap-1.5",children:[c.jsx(Jl,{size:16,"aria-hidden":!0}),m("sidebar.newWorkspace")]})})]})})]}),c.jsx(pi,{open:v!==null,onOpenChange:T=>{!T&&!E&&k(null)},title:v?m("sidebar.deleteConfirm",{name:v.name}):m("sidebar.deleteLabel"),description:v?m("sidebar.deleteDescription",{path:v.path,summary:lb(o[v.id],m)}):"",confirmLabel:m(E?"sidebar.deleting":"sidebar.deleteLabel"),confirmKind:"danger",onConfirm:C})]})},j3=4e3,A3=t=>{const[a,o]=y.useState([]);return y.useEffect(()=>{if(!t){o([]);return}let s=!1;const l=()=>{dw().then(f=>{s||o(f)}).catch(()=>{})};l();const u=window.setInterval(l,j3);return()=>{s=!0,window.clearInterval(u)}},[t]),a},_3=({devices:t,enabled:a})=>{const{notify:o}=Lc(),{t:s}=be(),l=y.useRef(null);return y.useEffect(()=>{if(!a){l.current=null;return}const u=new Map(t.filter(m=>!m.revoked).map(m=>[m.deviceId,m])),f=l.current;if(l.current=new Set(u.keys()),!!f)for(const[m,g]of u)f.has(m)||o({brief:s("notifications.remoteSession.brief",{name:g.name}),detail:s("notifications.remoteSession.detail",{name:g.name}),kind:"success",title:s("notifications.remoteSession.title")})},[t,a,o,s]),null},R3=()=>{const{status:t}=ep(),a=t.enabled&&t.loggedIn,o=A3(a);return c.jsx(_3,{devices:o,enabled:a})};let cm=!1;const _x=()=>{cm=!0,window.location.reload()},O3=t=>{y.useEffect(()=>{const a=o=>{if(cm){cm=!1;return}o.preventDefault(),o.returnValue=""};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[t])},D3=3e3,M3=({onTryDemo:t}={})=>{const{t:a}=be(),[o,s]=y.useState(!1),l=y.useRef(!0),u=y.useCallback(()=>{typeof window>"u"||_x()},[]),f=y.useCallback(async()=>{try{return(await fetch("/api/version",{credentials:"include"})).ok}catch{return!1}},[]);y.useEffect(()=>{l.current=!0;const g=window.setInterval(async()=>{l.current&&await f()&&u()},D3);return()=>{l.current=!1,window.clearInterval(g)}},[f,u]);const m=async()=>{s(!0);try{if(await f()){u();return}}finally{window.setTimeout(()=>{l.current&&s(!1)},400)}};return c.jsx("div",{className:"flex flex-1 items-center justify-center p-8","data-testid":"runtime-offline-page",children:c.jsxs("div",{className:"elev-1 flex max-w-md flex-col items-center gap-3 rounded border p-6 text-center",style:{background:"var(--bg-elevated)",borderColor:"var(--border)"},children:[c.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full",style:{background:"var(--bg-3)",color:"var(--status-orange)"},children:c.jsx(zE,{size:24,"aria-hidden":!0})}),c.jsx("div",{className:"font-semibold text-pri",children:a("pwa.runtimeOffline.title")}),c.jsx("div",{className:"text-sec text-sm leading-relaxed",children:a("pwa.runtimeOffline.body")}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-center gap-2",children:[c.jsxs("button",{type:"button",className:"icon-btn icon-btn--primary flex items-center gap-2","data-testid":"runtime-offline-retry",disabled:o,onClick:()=>{m()},children:[o?c.jsx(Ja,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(Rm,{size:12,"aria-hidden":!0}),a(o?"pwa.runtimeOffline.retrying":"pwa.runtimeOffline.retry")]}),t?c.jsxs("button",{type:"button",className:"icon-btn flex items-center gap-2","data-testid":"runtime-offline-try-demo",onClick:t,children:[c.jsx(qS,{size:12,"aria-hidden":!0}),a("pwa.runtimeOffline.tryDemo")]}):null]}),c.jsx("div",{className:"text-ter text-xs",children:a("pwa.runtimeOffline.autoReconnect")})]})})},um=new Set;let Rx=null;const L3=t=>{Rx=t;for(const a of um)a(t)},z3=t=>(um.add(t),t(Rx),()=>{um.delete(t)}),H3=2e3,U3=async t=>{if(!t.serviceWorker)return;let a;try{a=await t.serviceWorker.register("/sw.js")}catch{return}const o=l=>{const u=()=>{l.state==="installed"&&t.serviceWorker?.controller&&L3(()=>{l.postMessage({type:"SKIP_WAITING"}),setTimeout(t.reload,H3)})};l.addEventListener("statechange",u)};a.waiting&&t.serviceWorker.controller&&o(a.waiting),a.installing&&o(a.installing),a.addEventListener("updatefound",()=>{a.installing&&o(a.installing)});let s=!1;t.serviceWorker.addEventListener("controllerchange",()=>{s||(s=!0,t.reload())})},B3=()=>typeof navigator>"u"||typeof window>"u"?Promise.resolve():U3({isProd:!0,serviceWorker:"serviceWorker"in navigator?navigator.serviceWorker:null,reload:_x}),cb=({terminalRuns:t})=>{const{t:a}=be(),o=yt(),[s,l]=y.useState(null),[u,f]=y.useState(!1);if(y.useEffect(()=>z3(b=>{l(()=>b)}),[]),!s)return null;const m=t.every(b=>b.status==="stopped"),g=!m||u,p=a(u?"pwa.reloading":m?"pwa.reloadToActivate":"pwa.waitForAgents");return c.jsxs("div",{className:"update-toast elev-2 fixed right-4 bottom-8 z-50 flex items-center gap-3 rounded border px-3 py-2",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-mobile":o||void 0,"data-testid":"update-available-toast",role:"status","aria-live":"polite",children:[c.jsx(Rm,{size:14,className:"text-sec","aria-hidden":!0}),c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"font-medium text-pri text-xs",children:a("pwa.appShellUpdated")}),c.jsx("span",{className:"text-ter text-xs",children:a(m?"pwa.reloadToActivate":"pwa.waitForAgents")})]}),c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary","data-testid":"update-available-reload",disabled:g,onClick:()=>{f(!0),s()},children:p})]})},W3=new Set(["add-workspace","try-demo"]),I3=t=>t!==null&&W3.has(t),q3=({onAddWorkspace:t,onTryDemo:a,ready:o})=>{const s=y.useRef(!1);y.useEffect(()=>{if(!o||s.current||typeof window>"u")return;const u=new URLSearchParams(window.location.search).get("action");I3(u)&&(s.current=!0,window.history.replaceState({},"",window.location.pathname),u==="add-workspace"?t():u==="try-demo"&&a())},[o,t,a])},ub=()=>{const{t}=be(),a=sn(),o=yt(),{pending:s,refresh:l}=ep(),[u,f]=y.useState(!1),m=y.useRef(!1),g=s?.deviceName??"",p=s?.pairingId??null,b=s?.expiresAt??null;y.useEffect(()=>{p!==null&&(m.current=!1)},[p]);const v=y.useCallback(async()=>{if(!(!p||u||m.current)){m.current=!0,f(!0);try{await IN(p),a.show({kind:"success",message:t("remote.confirm.paired",{name:g})})}catch{m.current=!1,a.show({kind:"error",message:t("remote.confirm.failed")})}finally{f(!1),await l()}}},[p,u,g,l,t,a]),k=y.useCallback(async E=>{if(!(!p||m.current)){m.current=!0;try{await qN(p)}catch{}a.show({kind:E==="expired"?"warning":"success",message:t(E==="expired"?"remote.confirm.expired":"remote.confirm.rejected")}),f(!1),await l()}},[p,l,t,a]);return y.useEffect(()=>{if(b===null)return;const E=b-Date.now();if(E<=0){k("expired");return}const S=window.setTimeout(()=>{k("expired")},E);return()=>window.clearTimeout(S)},[b,k]),!s||o?null:c.jsx(Mr,{open:!0,onOpenChange:E=>{E||k("rejected")},children:c.jsxs(Lr,{children:[c.jsx(zr,{"data-testid":"remote-pairing-confirm-overlay",className:"app-overlay fixed inset-0 z-[80]"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-[90] grid place-items-center p-4",children:c.jsxs(Hr,{"data-testid":"remote-pairing-confirm",className:"dialog-scale-pop elev-2 pointer-events-auto w-[440px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{"aria-hidden":!0,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",color:"var(--accent)",border:"1px solid color-mix(in oklab, var(--accent) 30%, transparent)"},children:c.jsx(BE,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(Ur,{className:"text-lg font-semibold text-pri",children:t("remote.confirm.title")}),c.jsx(Ko,{className:"mt-1.5 text-sm text-sec",children:t("remote.confirm.description",{name:g})})]})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-ter",children:t("remote.confirm.sasLabel")}),c.jsx("div",{"data-testid":"remote-pairing-sas",className:"rounded border bg-2 py-3 text-center font-mono text-3xl tracking-[0.4em] text-pri",style:{borderColor:"var(--border)"},children:s.sas}),c.jsx("p",{className:"mt-2 text-xs text-ter",children:t("remote.confirm.warning")})]}),c.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[c.jsx("button",{type:"button","data-testid":"remote-pairing-reject",onClick:()=>{k("rejected")},disabled:u,className:"icon-btn",children:t("remote.confirm.reject")}),c.jsx("button",{type:"button","data-testid":"remote-pairing-confirm-action",onClick:()=>{v()},disabled:u,className:"icon-btn icon-btn--primary",children:t(u?"remote.confirm.confirming":"remote.confirm.confirm")})]})]})})]})})},P3=t=>!!t?.some(a=>a.status==="working"),F3=t=>t?.filter(a=>a.status==="working").length??0,K3=(t,a)=>{if(!t||t.length===0)return a("sidebar.noMembers");const o=t.filter(s=>s.status==="working").length;return o>0?a("sidebar.workingCount",{working:o,total:t.length}):a("sidebar.teamMemberCount",{count:t.length})},Ox="hive.sidebar.githubDismissed",Y3="https://www.bilibili.com/video/BV1UHLp6nEQR",$3=()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ox)==="1"}catch{return!1}},V3=({activeWorkspaceId:t,collapsed:a=!1,createDisabledReason:o,onCreateClick:s,onDeleteWorkspace:l,onSelectWorkspace:u,onToggleCollapse:f,workersByWorkspaceId:m,workspaces:g})=>{const{t:p}=be(),[b,v]=y.useState(null),[k,E]=y.useState(!1),[S,w]=y.useState($3),C=sn(),T=()=>{w(!0);try{window.localStorage.setItem(Ox,"1")}catch{}},N=!!o,j=D=>{v(D)},A=()=>{if(!b||k)return;const D=b;E(!0),Promise.resolve(l(D)).then(()=>{C.show({kind:"success",message:p("sidebar.removed",{name:D.name})})}).catch(L=>{const P=L instanceof Error?L.message:String(L);C.show({kind:"error",message:p("sidebar.deleteFailed",{message:P})})}).finally(()=>{E(!1),v(null)})},O=c.jsx(pi,{open:b!==null,onOpenChange:D=>{!D&&!k&&v(null)},title:b?p("sidebar.deleteConfirm",{name:b.name}):p("sidebar.deleteLabel"),description:b?p("sidebar.deleteDescription",{path:b.path,summary:K3(m[b.id],p)}):"",confirmLabel:p(k?"sidebar.deleting":"sidebar.deleteLabel"),confirmKind:"danger",onConfirm:A});return c.jsxs("nav",{"aria-label":"Workspaces",className:"flex h-full flex-col",children:[c.jsxs("div",{className:"ws-sidebar-header flex items-center justify-between gap-2 px-3 pt-3 pb-2",style:{boxShadow:"inset 0 -1px 0 var(--border)"},children:[c.jsxs("div",{className:"ws-sidebar-title flex min-w-0 items-center gap-2",children:[c.jsx("span",{className:"ws-sidebar-title__text text-xs font-medium text-ter","data-testid":"workspace-sidebar-title",children:p("sidebar.workspaces")}),g&&g.length>0?c.jsx("span",{className:"ws-sidebar-count mono rounded bg-2 px-1.5 py-0.5 text-xs text-ter",children:g.length}):null]}),f?c.jsx(Je,{side:"right",label:p(a?"layout.sidebarExpand":"layout.sidebarCollapse"),children:c.jsx("button",{type:"button","aria-label":p(a?"layout.sidebarExpand":"layout.sidebarCollapse"),"aria-expanded":!a,"data-testid":"workspace-sidebar-toggle",onClick:f,className:"ws-collapse-toggle",children:a?c.jsx(BS,{size:16,"aria-hidden":!0}):c.jsx(HS,{size:16,"aria-hidden":!0})})}):null]}),g===null?c.jsx("p",{className:"px-3 py-2 text-xs text-ter",children:p("common.loading")}):g.length===0?c.jsx("div",{className:"ws-empty flex-1 px-2 py-4",children:c.jsx("div",{className:"ws-empty__wide",children:c.jsx(mi,{title:p("sidebar.noWorkspaces"),description:o??p("sidebar.noWorkspacesDesc"),icon:c.jsx(l0,{size:20}),action:c.jsxs("button",{type:"button",onClick:N?void 0:s,disabled:N,"aria-label":p("sidebar.newWorkspace"),title:o??p("sidebar.newWorkspace"),className:"icon-btn icon-btn--primary mt-1 flex items-center gap-1.5 px-4 py-2 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50",children:[c.jsx(Jl,{size:14,"aria-hidden":!0}),p("sidebar.newWorkspace")]})})})}):c.jsxs("ul",{className:"flex-1 scroll-y pb-2",children:[g.map(D=>{const L=m[D.id],P=D.id===t,J=P3(L),Q=F3(L);return c.jsxs("li",{className:"group relative",children:[c.jsx(Je,{side:"right",label:c.jsxs("span",{className:"flex flex-col gap-0.5",children:[c.jsx("span",{className:"font-medium",children:D.name}),c.jsx("span",{className:"mono text-ter",children:D.path})]}),children:c.jsxs("button",{type:"button","aria-label":D.name,"aria-current":P?"true":void 0,"data-workspace-path":D.path,onClick:()=>u(D.id),className:`ws-row flex w-full items-center gap-2.5 py-1.5 pr-7 pl-2 text-left pointer-coarse:min-h-11${P?" active":""}`,children:[c.jsx(lm,{workspaceId:D.id,name:D.name,isActive:!1,working:J,workingCount:Q}),c.jsx("span",{className:`min-w-0 flex-1 truncate text-sm ${P?"font-medium text-pri":"text-pri"}`,children:D.name})]})}),c.jsx(Je,{side:"right",label:c.jsxs("span",{className:"flex flex-col gap-0.5",children:[c.jsx("span",{className:"font-medium",children:D.name}),c.jsx("span",{className:"mono text-ter",children:D.path})]}),children:c.jsx("button",{type:"button","aria-label":D.name,"aria-current":P?"true":void 0,onClick:()=>u(D.id),className:"ws-avatar-cell hidden w-full justify-center py-2","data-testid":"ws-avatar-cell",children:c.jsx(lm,{workspaceId:D.id,name:D.name,isActive:P,working:J,workingCount:Q})})}),c.jsx(Je,{label:p("sidebar.deleteAria",{name:D.name}),children:c.jsx("button",{type:"button","aria-label":p("sidebar.deleteAria",{name:D.name}),onClick:()=>j(D),className:"ws-row-delete absolute top-2 right-2 flex h-6 w-6 items-center justify-center rounded text-ter opacity-0 transition-colors pointer-coarse:h-10 pointer-coarse:w-10 hover:text-status-red focus:opacity-100 group-hover:opacity-100",children:c.jsx(Sc,{size:14,"aria-hidden":!0})})})]},D.id)}),c.jsx("li",{children:c.jsx(Je,{label:o??p("sidebar.newWorkspace"),children:c.jsxs("button",{type:"button",onClick:N?void 0:s,disabled:N,"aria-label":p("sidebar.newWorkspace"),title:o??void 0,className:"ws-add ws-add--inline flex items-center justify-center gap-1.5 rounded border border-dashed px-3 py-2 text-xs font-medium text-sec transition-colors disabled:cursor-not-allowed disabled:opacity-50",style:{borderColor:"var(--border-bright)"},children:[c.jsx(Jl,{size:14,"aria-hidden":!0}),c.jsx("span",{className:"ws-add__label",children:p("sidebar.newWorkspace")})]})})})]}),S?null:c.jsxs("div",{className:"ws-sidebar-footer group relative",children:[c.jsxs("a",{href:Y3,target:"_blank",rel:"noopener noreferrer","aria-label":p("sidebar.openDemoVideo"),title:p("sidebar.openDemoVideo"),className:"ws-sidebar-footer__link flex items-center gap-2.5 px-3 py-3 text-sm text-ter transition-colors hover:text-pri",children:[c.jsx("img",{src:"/bilibili.ico",alt:"","aria-hidden":"true",className:"h-[18px] w-[18px] rounded-[4px] object-cover",draggable:!1}),c.jsx("span",{className:"ws-sidebar-footer__label",children:p("sidebar.demoVideo")})]}),c.jsxs("a",{href:"https://github.com/tt-a1i/hive",target:"_blank",rel:"noopener noreferrer","aria-label":p("sidebar.openRepository"),title:p("sidebar.openRepository"),className:"ws-sidebar-footer__link flex items-center gap-2.5 px-3 py-3 text-sm text-ter transition-colors hover:text-pri",children:[c.jsx("svg",{width:"18",height:"18",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:c.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})}),c.jsx("span",{className:"ws-sidebar-footer__label",children:"GitHub"})]}),c.jsx("button",{type:"button","aria-label":p("sidebar.dismissRepository"),title:p("sidebar.dismissRepository"),onClick:T,className:"ws-sidebar-footer__dismiss absolute top-1.5 right-1.5 flex h-4 w-4 items-center justify-center rounded text-ter opacity-0 transition-opacity pointer-coarse:h-8 pointer-coarse:w-8 hover:bg-3 hover:text-pri focus:opacity-100 group-hover:opacity-100",children:c.jsx(fa,{size:10,"aria-hidden":!0})})]}),O]})},qn=/^(\s*)-\s+\[( |x|X)\]\s+(.*)$/,G3=/(?:^|[\s\p{P}])(@[A-Za-z0-9_-]+)/gu,X3=t=>{const a=[];for(const o of t.matchAll(G3))o[1]&&a.push(o[1]);return a},Z3=t=>{const a=new Map;for(const o of t){const s=o.trim();s&&a.set(s.toLowerCase(),s)}return a},c8=(t,a={})=>{const o=[],s=[],l=t.split(/\r?\n/),u=a.knownWorkerNames?Z3(a.knownWorkerNames):null;for(let f=0;f<l.length;f++){const m=l[f];if(!m)continue;const g=m.match(qn);if(!g)continue;const[,p="",b=" ",v=""]=g,k=p.replace(/\t/g," ").length,E=X3(v);let S;if(u){S=[];for(const N of E){const j=u.get(N.slice(1).toLowerCase());j&&S.push(`@${j}`)}}else S=E;let w=v;for(const N of S){const j=N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");w=w.replace(new RegExp(`(?:^|(?<=\\s|\\p{P}))${j}(?!\\w)`,"u"),"")}w=w.replace(/\s+/g," ").trim();const C={checked:b.toLowerCase()==="x",children:[],indent:k,line:f,mentions:S,text:w};for(;s.length>0;){const N=s[s.length-1];if(N&&N.indent<k)break;s.pop()}const T=s[s.length-1];T?T.children.push(C):o.push(C),s.push(C)}return o},Q3=t=>{let a=0;const o=[],s=t.split(/\r?\n/);for(const l of s){if(!l)continue;const u=l.match(qn);if(!u)continue;const[,f="",m=" "]=u,g=f.replace(/\t/g," ").length;for(;o.length>0;){const p=o[o.length-1];if(p&&p.indent<g)break;o.pop()}!o[o.length-1]&&m.toLowerCase()!=="x"&&(a+=1),o.push({indent:g})}return a},u8=t=>{if(t.children.length===0)return null;let a=0;for(const o of t.children)o.checked&&(a+=1);return{done:a,total:t.children.length}},hi=t=>t.includes(`\r
81
79
  `)?`\r
82
80
  `:`
83
- `,a4=(t,a)=>{const o=hi(t),s=t.length>0&&!t.endsWith(`
84
- `);return`${t}${s?o:""}- [ ] ${a}${o}`},r4=(t,a)=>{const o=t.split(/\r?\n/),s=o[a];if(s===void 0)return t;const l=s.match(qn);if(!l)return t;const u=(l[2]??" ").toLowerCase()==="x",f=s.replace(qn,(m,g,p,b)=>`${g}- [${u?" ":"x"}] ${b}`);return o[a]=f,o.join(hi(t))},Dx=t=>t.replace(/\r?\n/g," ").replace(/\s+/g," ").trim(),o4=(t,a,o)=>{const s=t.split(/\r?\n/),l=s[a];if(l===void 0||!l.match(qn))return t;const f=Dx(o);if(!f)return t;const m=l.replace(qn,(g,p,b)=>`${p}- [${b}] ${f}`);return s[a]=m,s.join(hi(t))},s4=(t,a)=>{const o=t.split(/\r?\n/),s=o[a];if(s===void 0)return t;const l=s.match(qn);if(!l)return t;const u=(l[1]??"").replace(/\t/g," ").length;let f=a+1;for(;f<o.length;){const m=o[f];if(m===void 0)break;const g=m.match(qn);if(!g||(g[1]??"").replace(/\t/g," ").length<=u)break;f+=1}return o.splice(a,f-a),o.join(hi(t))},i4=(t,a,o)=>{const s=Dx(o);if(!s)return t;const l=t.split(/\r?\n/),u=l[a];if(u===void 0)return t;const f=u.match(qn);if(!f)return t;const m=f[1]??"",g=m.replace(/\t/g," ").length;let p=a+1;for(;p<l.length;){const v=l[p];if(v===void 0)break;const k=v.match(qn);if(!k||(k[1]??"").replace(/\t/g," ").length<=g)break;p+=1}const b=`${m} `;return l.splice(p,0,`${b}- [ ] ${s}`),l.join(hi(t))},l4=(t,a,o)=>t===a||t===o,c4=(t,a)=>{const[o,s]=y.useState(""),[l,u]=y.useState(!1),[f,m]=y.useState(!1),[g,p]=y.useState(null),b=y.useRef(!1),v=y.useRef(""),k=y.useRef(""),E=y.useCallback((w,C)=>{if(!b.current){v.current=w,k.current=w,s(w),m(!1),p(null);return}l4(w,v.current,C)||(p(w),m(!0))},[]);if(y.useEffect(()=>{if(!t){s(""),u(!1),m(!1),p(null),b.current=!1,v.current="",k.current="";return}let w=!1;return s(""),u(!1),m(!1),p(null),b.current=!1,v.current="",k.current="",jN(t).then(({content:C})=>{w||(v.current=C,b.current=!1,k.current=C,s(C),u(!0),m(!1),p(null))}).catch(C=>{w||(v.current="",b.current=!1,k.current="",s(""),u(!0),m(!1),console.error("[hive] swallowed:tasks.initialLoad",C),p(null))}),()=>{w=!0}},[t]),y.useEffect(()=>{if(!t)return;let w=!1,C=null,T=0,N=null;const j=()=>{if(w)return;const A=tw().openWebSocket(`/ws/tasks/${t}`);N=A,A.onmessage=O=>{if(w)return;const D=JSON.parse(String(O.data));D.type!=="tasks-snapshot"&&D.type!=="tasks-updated"||typeof D.content=="string"&&(T=0,E(D.content,k.current))},A.onclose=()=>{if(w)return;T+=1;const O=Math.min(3e4,500*2**(T-1));C=setTimeout(j,O)}};return j(),()=>{w=!0,C!==null&&(clearTimeout(C),C=null),N?.close()}},[E,t]),a!==void 0)return{content:a,hasConflict:!1,loaded:!0,onChange:w=>{},onKeepLocal:()=>{},onReload:()=>{},onSave:async()=>{},toggleTaskAtLine:async w=>{},appendTask:async w=>{},appendSubtask:async(w,C)=>{},updateTaskText:async(w,C)=>{},deleteTask:async w=>{}};const S=async(w,C)=>{if(!t)return;const T=k.current,N=w(T);if(N!==T){v.current=N,k.current=N,b.current=!1,s(N);try{const j=await Hl(t,{content:N});v.current=j.content,k.current=j.content,s(j.content)}catch(j){throw v.current=T,k.current=T,s(T),console.error(`[hive] swallowed:tasks.${C}`,j),j}}};return{content:o,hasConflict:f,loaded:l,onChange:w=>{b.current=w!==v.current,k.current=w,s(w)},onKeepLocal:()=>{m(!1),p(null)},onReload:()=>{const w=g??v.current;v.current=w,b.current=!1,k.current=w,s(w),m(!1),p(null)},onSave:async()=>{if(!t)return;const w=await Hl(t,{content:o});v.current=w.content,b.current=!1,k.current=w.content,s(w.content),m(!1),p(null)},toggleTaskAtLine:async w=>{if(!t)return;const C=k.current,T=r4(C,w);if(T!==C){v.current=T,k.current=T,b.current=!1,s(T);try{const N=await Hl(t,{content:T});v.current=N.content,k.current=N.content,s(N.content)}catch(N){throw v.current=C,k.current=C,s(C),N}}},appendTask:async w=>{const C=w.trim();if(!t||!C)return;const T=k.current,N=a4(T,C);v.current=N,k.current=N,b.current=!1,s(N);try{const j=await Hl(t,{content:N});v.current=j.content,k.current=j.content,s(j.content)}catch(j){throw v.current=T,k.current=T,s(T),j}},appendSubtask:async(w,C)=>{const T=C.trim();T&&await S(N=>i4(N,w,T),"appendSubtask")},updateTaskText:async(w,C)=>{const T=C.trim();T&&await S(N=>o4(N,w,T),"updateTaskText")},deleteTask:async w=>{await S(C=>s4(C,w),"deleteTask")}}},Mx=(t,a,o)=>{const s=new Set(t.map(u=>u.run_id)),l=new Set(t.map(u=>u.agent_id));return[...t,...a.filter(u=>s.has(u.run_id)?!1:o&&ti(u,o)?!0:!l.has(u.agent_id))]},u4=(t,a,o=[])=>{const[s,l]=y.useState({}),u=y.useCallback((p,b)=>{l(v=>({...v,[p]:(v[p]??[]).filter(k=>k.agent_id!==b)}))},[]),f=y.useCallback((p,b)=>{l(v=>({...v,[p]:(v[p]??[]).filter(k=>k.run_id!==b)}))},[]);y.useEffect(()=>{if(!t)return;const p=new Set(a.map(k=>k.run_id)),b=new Set(a.map(k=>k.agent_id)),v=new Set(o.filter(k=>k.status==="stopped").map(k=>k.id));l(k=>{const E=k[t]??[],S=E.filter(w=>p.has(w.run_id)?!1:ti(w,t)?!0:b.has(w.agent_id)?!1:!v.has(w.agent_id));return S.length===E.length?k:{...k,[t]:S}})},[a,o,t]);const m=y.useCallback(({agentId:p,agentName:b,runId:v,status:k="starting",terminalInputProfile:E="default",workspaceId:S})=>{const w={agent_id:p,agent_name:b,run_id:v,status:k,terminal_input_profile:E};l(C=>{const T=ti(w,S),N=(C[S]??[]).filter(j=>j.run_id===w.run_id?!1:T?!0:j.agent_id!==w.agent_id);return{...C,[S]:[...N,w]}})},[]),g=y.useMemo(()=>Mx(a,t?s[t]??[]:[],t),[a,s,t]);return{forgetOptimisticAgent:u,forgetOptimisticRun:f,optimisticRunsByWorkspaceId:s,recordOptimisticRun:m,terminalRuns:g}};let Lx=null;const dm=new Set,d4=t=>{Lx=t;for(const a of dm)a()},f4=t=>(dm.add(t),()=>dm.delete(t)),m4=()=>Lx,zx="hive.package-update.dismissed-version",p4=()=>{try{return window.localStorage.getItem(zx)}catch{return null}},h4=t=>{try{window.localStorage.setItem(zx,t)}catch{}},db=({currentVersion:t=tp,versionInfo:a})=>{const{t:o}=be(),s=yt(),[l,u]=y.useState(p4),[f,m]=y.useState("idle"),g=a?.updateAvailable&&a.latestVersion!==t?a:null;if(!g||l===g.latestVersion)return null;const p=!!g.installHint,b=o(f==="copied"?"packageUpdate.commandCopied":f==="error"?"packageUpdate.commandCopyFailed":"packageUpdate.copyCommand"),v=()=>{h4(g.latestVersion),u(g.latestVersion)},k=async()=>{if(g.installHint)try{await navigator.clipboard.writeText(g.installHint),m("copied"),window.setTimeout(()=>m("idle"),1600)}catch{m("error"),window.setTimeout(()=>m("idle"),2200)}};return c.jsxs("div",{className:"package-update-toast elev-2 toast-pop fixed right-4 bottom-24 z-50 flex w-[min(420px,calc(100vw-2rem))] items-start gap-3 rounded border px-3 py-2.5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-mobile":s||void 0,"data-testid":"package-update-toast",role:"status","aria-live":"polite",children:[c.jsx("div",{className:"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded border",style:{background:"color-mix(in oklab, var(--accent) 10%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 28%, transparent)",color:"var(--accent)"},"aria-hidden":!0,children:c.jsx(TE,{size:15})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"font-medium text-pri text-xs",children:o("packageUpdate.title",{version:g.latestVersion})}),c.jsx("div",{className:"mt-0.5 text-ter text-xs",children:o("packageUpdate.body",{current:t,latest:g.latestVersion})}),p?c.jsx("code",{className:"mono mt-2 block truncate rounded border px-2 py-1 text-ter text-xs",title:g.updateNote||g.installHint,style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:g.installHint}):g.updateNote?c.jsx("div",{className:"mt-2 text-ter text-xs",children:g.updateNote}):null,c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[p?c.jsxs("button",{type:"button",className:"icon-btn icon-btn--primary","data-testid":"package-update-copy-command",onClick:k,"aria-label":b,title:b,children:[f==="copied"?c.jsx(ga,{size:13}):c.jsx(Dr,{size:13}),c.jsx("span",{children:b})]}):null,g.releaseUrl?c.jsxs("a",{href:g.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"icon-btn","data-testid":"package-update-open-release","aria-label":o("packageUpdate.openRelease"),title:o("packageUpdate.openRelease"),children:[c.jsx(_m,{size:13}),c.jsx("span",{children:o("packageUpdate.release")})]}):null,c.jsx("button",{type:"button",className:"icon-btn","data-testid":"package-update-dismiss",onClick:v,children:o("packageUpdate.later")})]})]}),c.jsx(Je,{label:o("common.dismiss"),children:c.jsx("button",{type:"button",className:"flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"package-update-close",onClick:v,"aria-label":o("common.dismiss"),children:c.jsx(fa,{size:13})})})]})},g4=(t=typeof window<"u"?window.matchMedia.bind(window):void 0,a=typeof navigator<"u"?navigator.standalone:void 0)=>t?.("(display-mode: standalone)").matches?!0:a===!0,v4=t=>{if(!t||!(t instanceof HTMLElement))return!1;const a=t.tagName.toLowerCase();return!!(a==="input"||a==="textarea"||a==="select"||t.isContentEditable||t.closest(".xterm"))},y4=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),b4=(t,a)=>a?t.metaKey:t.ctrlKey,w4=(t,a,o=y4)=>!(t.key.toLowerCase()!==a.key||(a.mod??!1)!==b4(t,o)||(a.alt??!1)!==t.altKey||(a.shift??!1)!==t.shiftKey),x4=t=>{y.useEffect(()=>{const a=o=>{if(!v4(o.target))for(const s of t){if(!w4(o,s))continue;s.handler(o)!==!1&&o.preventDefault();return}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t])},k4=({bootstrapError:t,onSelectWorkspace:a,onTriggerAddDialog:o,workspaces:s})=>{const l=y.useMemo(()=>{if(!g4())return[];const u=(s??[]).slice(0,9).map((f,m)=>({key:String(m+1),mod:!0,handler:()=>a(f.id)}));return[{key:"n",mod:!0,shift:!0,handler:()=>{t||o()}},...u]},[t,a,o,s]);x4(l)},S4=15e3,E4=async(t,a=S4)=>new Promise((o,s)=>{let l=!1;const u=window.setTimeout(()=>{l=!0,s(new Error("Hive runtime bootstrap timed out"))},a);t.then(f=>{l||(l=!0,window.clearTimeout(u),o(f))},f=>{l||(l=!0,window.clearTimeout(u),s(f))})}),C4=(t,a)=>a&&t.some(o=>o.id===a)?a:t[0]?.id??null,T4=(t,a)=>{if(t===null)return a;const o=new Map(t.map(s=>[s.id,s]));for(const s of a)o.set(s.id,s);return Array.from(o.values())},N4=(t,a,o)=>{y.useEffect(()=>{let s=!1;const l=aw().then(async()=>{const[u,f]=await Promise.all([eN(),iN().catch(()=>null)]);return{items:u,persistedId:f}});return E4(l).then(({items:u,persistedId:f})=>{s||t(m=>{const g=T4(m,u),p=C4(g,f);return a(p),f!==p&&sw(p).catch(b=>{console.error("[hive] swallowed:initSession.save",b)}),g})}).catch(u=>{s||(a(null),o&&o("Could not reach Hive runtime. Refresh once the runtime is back up.")),console.error("[hive] swallowed:initSession.bootstrap",u)}),()=>{s=!0}},[a,t,o])},j4=()=>{const t=y.useRef(null);return y.useCallback(a=>{if(typeof document>"u")return;const o=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(a):a.replace(/"/g,'\\"'),s=document.querySelector(`[data-worker-name="${o}"]`);s&&(s.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),s.classList.add("worker-card-shell--highlight"),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{s.classList.remove("worker-card-shell--highlight"),t.current=null},1e3))},[])},A4=({onWorkspaceCreated:t,onError:a,onOrchestratorRunStarted:o})=>{const{language:s}=be(),[l,u]=y.useState({}),f=y.useCallback((g,p)=>{u(b=>({...b,[g]:p.ok?null:p.error})),p.ok&&p.run_id&&o?.(g,p.run_id)},[o]),m=y.useCallback(async g=>{try{const p=await aN({name:g.name,path:g.path,autostart_orchestrator:!0,command_preset_id:g.commandPresetId,startup_command:g.startupCommand??null,ui_language:s});return f(p.id,p.orchestrator_start),t({id:p.id,name:p.name,path:p.path}),p}catch(p){const b=p instanceof Error?p.message:"Failed to create workspace";throw a?.(b),p}},[s,t,a,f]);return{orchestratorAutostartErrors:l,recordOrchestratorResult:f,createNewWorkspace:m}},_4=(t,a)=>{const o=t.findIndex(l=>l.id===a),s=t.filter(l=>l.id!==a);return o<0?s[0]?.id??null:s[Math.min(o,s.length-1)]?.id??null},R4=({activeWorkspaceId:t,onActiveDeleted:a,selectWorkspace:o,setWorkersByWorkspaceId:s,setWorkspaces:l,workspaces:u})=>async f=>{const g=_4(u??[],f.id);await rN(f.id),l(p=>p?.filter(b=>b.id!==f.id)??p),s(p=>{const b={...p};return delete b[f.id],b}),f.id===t&&(a(),o(g))},O4=()=>{const[t,a]=y.useState(null),o=y.useRef(Promise.resolve());return{activeWorkspaceId:t,selectWorkspace:l=>{a(l),o.current=o.current.catch(Va("selectWorkspace.prevQueue")).then(()=>sw(l)).catch(Va("selectWorkspace.save"))},setActiveWorkspaceId:a}},Hx=500,D4=5e3,M4=5e3,L4=()=>({failureCount:0,inFlight:!1,lastSettledAt:null}),z4=(t,a)=>Math.min((a?Hx:D4)*2**t,M4),H4=(t,a)=>t.length!==a.length?!1:t.every((o,s)=>{const l=a[s];return l!==void 0&&o.avatar===l.avatar&&o.commandPresetId===l.commandPresetId&&o.id===l.id&&o.lastPtyLine===l.lastPtyLine&&o.name===l.name&&o.pendingTaskCount===l.pendingTaskCount&&o.role===l.role&&o.status===l.status}),fb=(t,a)=>{const o=Object.keys(t),s=Object.keys(a);return o.length!==s.length?!1:s.every(l=>Object.hasOwn(t,l)&&H4(t[l]??[],a[l]??[]))},U4=(t,a={})=>{const o=t.join("\0"),s=y.useRef(a.activeWorkspaceId),l=y.useRef(new Map),u=y.useRef(null),[f,m]=y.useState({});return s.current=a.activeWorkspaceId,y.useEffect(()=>{if(!o){m({}),l.current.clear();return}let g=!1,p;const b=o.split("\0"),v=new Set(b);for(const T of l.current.keys())v.has(T)||l.current.delete(T);m(T=>{const N={};for(const j of b)N[j]=T[j]??[];return fb(T,N)?T:N});const k=T=>{let N=l.current.get(T);return N||(N=L4(),l.current.set(T,N)),N},E=T=>s.current===T,S=T=>{const N=k(T);N.inFlight||(N.inFlight=!0,pN(T).then(j=>{g||(N.failureCount=0,m(A=>{if(!v.has(T))return A;const O={};for(const D of b)O[D]=D===T?j:A[D]??[];return fb(A,O)?A:O}))}).catch(j=>{g||(N.failureCount=Math.min(N.failureCount+1,4),console.error("[hive] swallowed:workspaceWorkers.list",j))}).finally(()=>{N.inFlight=!1,N.lastSettledAt=g?null:Date.now()}))},w=()=>{const T=Date.now();for(const N of b){const j=k(N);if(j.inFlight)continue;if(j.lastSettledAt===null){S(N);continue}const A=z4(j.failureCount,E(N));T-j.lastSettledAt>=A&&S(N)}},C=(T=Hx)=>{g||(p!==void 0&&window.clearTimeout(p),p=window.setTimeout(()=>{p=void 0,w(),C()},T))};return u.current=()=>{p!==void 0&&(window.clearTimeout(p),p=void 0),w(),C()},w(),C(),()=>{g=!0,p!==void 0&&window.clearTimeout(p),u.current&&(u.current=null)}},[o]),y.useEffect(()=>{const g=a.activeWorkspaceId;if(!g||!o.split("\0").includes(g))return;const p=l.current.get(g);p&&!p.inFlight&&(p.lastSettledAt=null,p.failureCount=0),u.current?.()},[a.activeWorkspaceId,o]),[f,m]},fm="hive:terminal-visible-resize",B4=t=>new CustomEvent(fm,{detail:{runId:t}}),W4="\x1B[200~",mb="\x1B[201~",I4=(t,a)=>{const o=t.split(mb).join("");return a?.modes?.bracketedPasteMode===!1?o:`${W4}${o}${mb}`},Lt="\x1B",pb="\x07",q4=new RegExp(`${Lt}\\[[0-?]*[ -/]*[@-~]`,"gu"),P4=new RegExp(`${Lt}\\][^${pb}${Lt}]*(?:${pb}|${Lt}\\\\)`,"gu"),F4=new RegExp("[\0-]","gu"),K4=new RegExp(`${Lt}\\[([0135]) q`,"gu"),Y4=new RegExp(`${Lt}\\[[0135] q`,"u"),$4=new RegExp(`${Lt}\\[[246] q`,"gu"),Ux=new RegExp(`${Lt}\\[[0-?]*K`,"u"),V4=new RegExp(`${Lt}\\[[0-9]*D`,"u"),G4=new RegExp(`${Lt}\\[[0-9]+(?:;[0-9]+)?[Hf]`,"gu"),Bx="\b",Wx="",X4="",Z4="",Q4=t=>{switch(t){case"3":return"4";case"5":return"6";default:return"2"}},J4=t=>t.replace(P4,"").replace(q4,"").replace(F4,""),eO=t=>J4(t).trim().length>0,tO=t=>Ux.test(t)&&(V4.test(t)||t.includes(Bx)||t.includes(Wx)),nO=t=>!eO(t)&&t.includes(`${Lt}[?2026`)&&t.includes(`${Lt}[?25`)&&Y4.test(t)&&Ux.test(t)&&!tO(t),hb=(t,a)=>{let o=null;a.lastIndex=0;for(const s of t.matchAll(a))o=s[0];return o},gb=t=>t.includes(Bx)||t.includes(Wx)||t.includes(X4)||t.includes(Z4)||t.includes(`${Lt}[3~`),vb=(t,a={})=>{const o=t.replace(K4,(u,f)=>`${Lt}[${Q4(f)} q`);if(!nO(t))return{chunk:o,suppress:!1};if(a.preservePromptEditFrame)return{chunk:o,consumedPromptEraseInput:!0,suppress:!1};const s=hb(o,G4);return s?{chunk:`${hb(o,$4)??""}${Lt}[?25h${s}`,suppress:!1}:{chunk:o,suppress:!0}},aO=(t,a)=>{let o,s=!1,l=!1;const u=()=>{t.value="",t.scrollLeft=0,t.scrollTop=0},f=()=>{o!==void 0&&clearTimeout(o),o=setTimeout(()=>{o=void 0,s=!1,l=!1,a.setComposing(!1)},0)},m=S=>S.data||t.value,g=S=>S.inputType==="insertText"||S.inputType==="insertFromComposition"||S.inputType==="insertReplacementText"||S.inputType==="insertDictationResult",p=()=>{s=!0,l=!1,a.setComposing(!0)},b=()=>{s=!0,a.setComposing(!0)},v=S=>{const C=S.data||t.value;!l&&C&&a.commit(C),u(),f()},k=S=>{const w=S;if(s||w.isComposing){if(g(w)){const C=m(w);C&&(a.commit(C),l=!0),u()}return}w.defaultPrevented&&g(w)&&u()},E={capture:!0};return t.addEventListener("compositionstart",p,E),t.addEventListener("compositionupdate",b,E),t.addEventListener("compositionend",v,E),t.addEventListener("input",k,E),()=>{o!==void 0&&clearTimeout(o),t.removeEventListener("compositionstart",p,E),t.removeEventListener("compositionupdate",b,E),t.removeEventListener("compositionend",v,E),t.removeEventListener("input",k,E)}},rO=()=>typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform),Hn={killToLineStart:"",lineStart:"",lineEnd:"",killWordBack:"\x1B",wordBack:"\x1Bb",wordForward:"\x1Bf",shiftEnter:"\x1B[13;2u"},oO=(t,a={})=>{const o=a.isMac??rO();if(t.key==="Enter"&&t.shiftKey)return t.type==="keypress"?{kind:"send",bytes:Hn.shiftEnter}:{kind:"block"};if(!o&&t.type==="keydown"&&t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey&&(t.key==="c"||t.key==="C")&&a.hasSelection)return{kind:"copy"};if(!o||t.type!=="keydown")return{kind:"passthrough"};const s=t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.shiftKey,l=t.altKey&&!t.metaKey&&!t.ctrlKey;if(s)switch(t.key){case"Backspace":return{kind:"send",bytes:Hn.killToLineStart};case"ArrowLeft":return{kind:"send",bytes:Hn.lineStart};case"ArrowRight":return{kind:"send",bytes:Hn.lineEnd};case"k":case"K":return{kind:"clear"}}if(l)switch(t.key){case"Backspace":return{kind:"send",bytes:Hn.killWordBack};case"ArrowLeft":return{kind:"send",bytes:Hn.wordBack};case"ArrowRight":return{kind:"send",bytes:Hn.wordForward}}return{kind:"passthrough"}},sO=16,iO=.3,lO={up:"A",down:"B",right:"C",left:"D"},mm=(t,a)=>{const o=lO[a];return t?`\x1BO${o}`:`\x1B[${o}`},cO=(t,a,o)=>a==="codex"||a==="grok"||a==="opencode"?o==="up"?"\x1B[5~":"\x1B[6~":mm(t.modes?.applicationCursorKeysMode,o),uO=t=>t==="codex"||t==="grok"||t==="opencode",Ix=(t,a="default")=>{let o=0;return s=>{if(t.buffer?.active?.type!=="alternate")return o=0,{handled:!1,input:null};if(!uO(a)&&t.modes?.mouseTrackingMode&&t.modes.mouseTrackingMode!=="none")return o=0,{handled:!1,input:null};if(s.deltaY===0||s.shiftKey)return{handled:!1,input:null};let l=s.deltaY;return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=sO,Math.abs(s.deltaY)<50&&(l*=iO),o+=l,l=Math.trunc(o),o%=1):o=0,l===0?{handled:!0,input:null}:{handled:!0,input:cO(t,a,l<0?"up":"down")}}},dO=({element:t,profile:a="default",sendInput:o,terminal:s})=>{const l=Ix(s,a),u=m=>{const{handled:g,input:p}=l(m);return g?(m.preventDefault(),m.stopPropagation(),p&&o(p),!1):!0};if(typeof s.attachCustomWheelEventHandler=="function")return s.attachCustomWheelEventHandler(u),()=>{};const f=m=>{u(m)||m.stopImmediatePropagation()};return t.addEventListener("wheel",f,{capture:!0,passive:!1}),()=>t.removeEventListener("wheel",f,{capture:!0})},fO=(t,a={})=>{switch(t){case"esc":return"\x1B";case"tab":return" ";case"enter":return"\r";case"arrowUp":return mm(a.applicationCursorKeys,"up");case"arrowDown":return mm(a.applicationCursorKeys,"down");case"arrowRight":return a.applicationCursorKeys?"\x1BOC":"\x1B[C";case"arrowLeft":return a.applicationCursorKeys?"\x1BOD":"\x1B[D";case"home":return"\x1B[H";case"end":return"\x1B[F";case"ctrlC":return"";case"ctrlD":return"";case"ctrlZ":return"";case"ctrlL":return"\f";case"ctrlR":return"";case"ctrlU":return Hn.killToLineStart;case"ctrlA":return Hn.lineStart;case"ctrlE":return Hn.lineEnd;case"ctrlW":return""}},mO="Invalid terminal control message",pO=t=>{let a;try{a=JSON.parse(String(t))}catch{return null}if(!a||typeof a!="object")return null;const o=a;return o.type==="error"&&typeof o.message=="string"?{type:"error",message:o.message}:o.type==="exit"&&(o.code===null||typeof o.code=="number")?{type:"exit",code:o.code}:o.type==="restore"&&typeof o.snapshot=="string"?{type:"restore",snapshot:o.snapshot}:null},hO=({initialSize:t,onError:a,onExit:o,onOutput:s,onRestore:l,onClose:u,runId:f})=>{const m=crypto.randomUUID(),g={...t,clientId:m},p=tw(),b=p.openWebSocket(`/ws/terminal/${f}/io`,g),v=p.openWebSocket(`/ws/terminal/${f}/control`,g);let k=!1,E=!1,S=!1;const w=[];let C=null;const T=()=>{E||S||(S=!0,u?.())};b.onclose=T,v.onclose=T;const N=()=>{!C||v.readyState!==v.OPEN||(v.send(JSON.stringify({type:"resize",...C})),C=null)};return b.onmessage=j=>{const A=typeof j.data=="string"?j.data:"",O=D=>{v.readyState===v.OPEN&&v.send(JSON.stringify({type:"output_ack",bytes:D}))};if(!k){w.push({chunk:A,acknowledge:O});return}s(A,O)},v.onopen=()=>{N()},v.onmessage=j=>{const A=pO(j.data);if(!A){a(mO);return}if(A.type==="exit"&&o(A.code),A.type==="error"&&a(A.message),A.type==="restore"){let O=!1;const D=()=>{if(!O){O=!0,k=!0,v.readyState===v.OPEN&&v.send(JSON.stringify({type:"restore_complete"}));for(const L of w.splice(0))s(L.chunk,L.acknowledge)}};l(A.snapshot,D)}},{dispose(){E=!0,b.close(),v.close()},resize(j,A,O,D){C={cols:j,rows:A},O!==void 0&&(C.pixelWidth=O),D!==void 0&&(C.pixelHeight=D),N()},sendBinaryInput(j){if(b.readyState!==b.OPEN)return;const A=new Uint8Array(j.length);for(let O=0;O<j.length;O++)A[O]=j.charCodeAt(O)&255;b.send(A)},sendInput(j){b.readyState===b.OPEN&&b.send(j)}}},gO=50,vO=1e3,yO=({canRender:t,write:a})=>{let o=!1,s,l=null,u,f=0,m=[],g,p=0,b=!1;function v(){return f>0||m.length>0}function k(){s!==void 0&&(window.clearTimeout(s),s=void 0)}function E(){g!==void 0&&(window.clearTimeout(g),g=void 0)}function S(N,j){!N||j<=0||N(j)}function w(){const N=f,j=u;f=0,u=void 0,S(j,N)}function C(){if(o||b||s!==void 0||!v())return;const N=l===null?0:Math.max(0,gO-(Date.now()-l));if(N===0){T();return}s=window.setTimeout(()=>{s=void 0,T()},N)}function T(){if(k(),o||b||!v())return;if(!t()){w();return}const N=m.join(""),j=f,A=u;if(m=[],f=0,u=void 0,l=Date.now(),N.length===0){S(A,j),C();return}b=!0;const O=++p,D=()=>{!b||O!==p||(E(),b=!1,S(A,j),C())};g=window.setTimeout(D,vO);try{a(N,D)}catch{D()}}return{dispose(){o=!0,k(),E(),m=[],f=0,u=void 0},enqueue(N,j,A){if(!o){if(N.length===0){S(A,j);return}N.length>0&&m.push(N),t()?(f+=j,u=A):S(A,j),C()}},flush:T}},bO=16,wO=.08,xO=.96,kO=.025,yb=5,SO=100,EO=8,CO=6,TO=4,NO=.5,jO=250,AO=24,_O=2,RO=".xterm-viewport",OO=".xterm-screen";function DO({element:t,profile:a="default",sendInput:o,terminal:s}){let l=null,u=0,f=0,m,g=0,p=null,b=0,v=!1,k=null,E=null,S=bO,w=0,C=0,T=null,N=[];const j=Ix(s,a),A=()=>{p!==null&&(window.cancelAnimationFrame(p),p=null)},O=()=>{T!==null&&(window.cancelAnimationFrame(T),T=null)},D=()=>(k?.isConnected||(k=t.querySelector(RO)),k),L=()=>(E?.isConnected||(E=t.querySelector(OO)),E),P=()=>{const le=D(),ie=s.rows;if(!le||!ie||ie<=0)return;const xe=le.clientHeight/ie;xe>=6&&xe<=64&&(S=xe)},J=()=>{const le=L();le&&(le.style.transform=w!==0?`translateY(${-w}px)`:"")},Q=()=>{w!==0&&(w=0,J())},$=()=>{if(Math.abs(w)>=S/2){const le=D();if(le){const ie=le.scrollHeight-le.clientHeight,xe=w>0?S:-S;le.scrollTop=Math.min(ie,Math.max(0,le.scrollTop+xe))}}Q()},F=le=>{const ie=D();if(!ie)return"missing";const xe=ie.scrollHeight-ie.clientHeight;if(xe<=0)return Q(),"stuck";const Ne=w+le,he=Math.trunc(Ne/S);let we=Ne-he*S;const Ce=ie.scrollTop,Ae=Math.min(xe,Math.max(0,Ce+he*S)),pt=Ae!==Ce;pt&&(ie.scrollTop=Ae),(Ae<=0&&Ne<0||Ae>=xe&&Ne>0)&&(we=0);const dt=we!==w;return w=we,dt&&J(),pt||dt?"moved":"stuck"},ne=le=>{u+=le/S;const ie=Math.trunc(u);return u%=1,ie===0||s.scrollLines?.(ie),!0},Z=(le,ie)=>{const xe=[];for(let Ne=0;Ne<ie;Ne++){const{handled:he,input:we}=j({deltaMode:WheelEvent.DOM_DELTA_LINE,deltaY:le,shiftKey:!1});if(!he)break;we&&xe.push(we)}return xe.length>0&&o(xe.join("")),xe.length},q=le=>{f+=le/S;const ie=Math.trunc(f);if(f%=1,ie===0)return!1;const xe=a==="codex"||a==="opencode"?TO:CO;return Z(ie<0?-1:1,Math.min(Math.abs(ie),xe))>0},M=le=>{const ie=s.buffer?.active?.type;return ie!==m&&(u=0,f=0,m=ie,Q()),ie==="alternate"?{moved:q(le),normalBuffer:!1}:{moved:F(le)==="moved"||ne(le),normalBuffer:!0}},U=()=>{T=null;const le=C;C=0,le!==0&&(v=M(le).normalBuffer)},W=()=>{T===null&&(T=window.requestAnimationFrame(U))},G=(le,ie)=>{N.push({t:le,y:ie}),N.length>EO&&N.shift()},V=le=>{const ie=le-SO,xe=N.filter(Ae=>Ae.t>=ie),Ne=xe[0],he=xe[xe.length-1];if(!Ne||!he||Ne===he)return 0;const we=he.t-Ne.t;if(we<=0)return 0;const Ce=(Ne.y-he.y)/we;return Math.max(-yb,Math.min(yb,Ce))};let R=0;const B=()=>{if(p=null,R===0)return;if(s.buffer?.active?.type!=="alternate"){R=0;return}const le=R>0?1:-1,ie=Math.min(Math.abs(R),_O);if(Z(le,ie)<ie){R=0;return}R-=le*ie,R!==0&&(p=window.requestAnimationFrame(B))},se=le=>{const ie=Math.min(32,Math.max(1,le-b));b=le;const{moved:xe,normalBuffer:Ne}=M(g*ie);if(!xe||!Ne){p=null,u=0,g=0,$();return}if(g*=xO**(ie/16.67),Math.abs(g)<kO){p=null,u=0,$();return}p=window.requestAnimationFrame(se)},re=le=>{A(),R=0,O(),C=0,N=[],l=le.touches.length===1?le.touches[0]?.clientY??null:null,l!==null&&G(le.timeStamp,l),g=0,v=!1,D(),P()},ce=le=>{if(l===null||le.touches.length!==1)return;const ie=le.touches[0]?.clientY??l,xe=l-ie;Math.abs(xe)<1||(l=ie,le.preventDefault(),C+=xe,G(le.timeStamp,ie),W())},fe=le=>{l=null,O(),U();const ie=V(le.timeStamp);if(N=[],v&&Math.abs(ie)>=wO){g=ie,b=performance.now(),p=window.requestAnimationFrame(se);return}if(!v&&a!=="opencode"&&Math.abs(ie)>=NO&&s.buffer?.active?.type==="alternate"){const xe=Math.min(AO,Math.round(Math.abs(ie)*jO/S));if(xe>0){R=ie>0?xe:-xe,p=window.requestAnimationFrame(B);return}}g=0,u=0,$()},ue=()=>{A(),R=0,O(),C=0,N=[],l=null,u=0,f=0,g=0,v=!1,Q()};return t.addEventListener("touchstart",re,{passive:!0}),t.addEventListener("touchmove",ce,{passive:!1}),t.addEventListener("touchend",fe,{passive:!0}),t.addEventListener("touchcancel",ue,{passive:!0}),()=>{t.removeEventListener("touchstart",re),t.removeEventListener("touchmove",ce),t.removeEventListener("touchend",fe),t.removeEventListener("touchcancel",ue),A(),O(),Q()}}const MO=(t=()=>typeof document<"u"?document.createElement("canvas"):null)=>{const a=t();if(!a||typeof a.getContext!="function")return!1;try{return!!(a.getContext("webgl2")||a.getContext("webgl"))}catch{return!1}},LO=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),zO=t=>!(t instanceof HTMLElement)||t.classList.contains("xterm-helper-textarea")?!1:t.isContentEditable||t instanceof HTMLTextAreaElement?!0:t instanceof HTMLInputElement?!t.disabled&&!t.readOnly&&!LO.has(t.type):!1,HO=(t,a)=>{if(!a?.isConnected||!a.contains(t)||document.visibilityState==="hidden"||t.closest('[data-terminal-host-parked="true"]'))return!1;const o=document.activeElement;return!o||o===document.body||o===document.documentElement||t.contains(o)?!0:!zO(o)},UO=t=>t instanceof Error&&t.message?`Terminal failed to load: ${t.message}`:"Terminal failed to load. Refresh this page and try again.",BO=new RegExp("\x1B\\[M([\\s\\S])([\\s\\S])([\\s\\S])","g"),WO=new TextEncoder,IO=5e3,qO=(t,a,o,s)=>{const l=a.charCodeAt(0)-32,u=o.charCodeAt(0)-32,f=s.charCodeAt(0)-32;if(l<0||u<1||f<1)return t;const g=(l&3)===3&&(l&32)===0&&(l&64)===0?"m":"M";return`\x1B[<${l};${u};${f}${g}`},PO=(t,a)=>{if(a!=="grok"&&a!=="opencode")return{binary:!0,chunk:t};const o=t.replace(BO,qO);return{binary:o===t,chunk:o}},FO=(t,a="default",o,s={})=>{const l=yt(),u=y.useRef(null),[f,m]=y.useState(null),[g,p]=y.useState("connecting"),b=y.useRef("connecting"),v=y.useRef(null),[k,E]=y.useState(0),S=y.useRef(null),w=y.useRef(null),C=y.useRef(null),T=y.useRef(void 0),N=y.useRef(!1),j=y.useRef(!1),[A,O]=y.useState("canvas"),[D,L]=y.useState(!1),P=y.useRef(!1),J=y.useRef(o);y.useEffect(()=>{J.current=o},[o]);const Q=y.useCallback(()=>{const U=u.current,W=w.current;!U||!W||HO(U,C.current)&&W.focus()},[]),$=y.useCallback(()=>{!C.current||T.current!==void 0||(T.current=window.setTimeout(()=>{T.current=void 0,Q()},0))},[Q]);y.useEffect(()=>{C.current=s.autoFocusTarget??null,$()},[s.autoFocusTarget,$]),y.useEffect(()=>{const U=()=>$(),W=()=>{document.visibilityState!=="hidden"&&$()};return window.addEventListener("focus",U),document.addEventListener("visibilitychange",W),()=>{window.removeEventListener("focus",U),document.removeEventListener("visibilitychange",W),T.current!==void 0&&(window.clearTimeout(T.current),T.current=void 0)}},[$]);const F=y.useCallback(U=>{O(U);const W=u.current;W&&(W.dataset.renderer=U)},[]),ne=y.useCallback(U=>{N.current||(a==="codex"&&gb(U)&&(j.current=!0),S.current?.sendInput(U))},[a]),Z=y.useCallback(U=>{const W=w.current?.modes?.applicationCursorKeysMode;ne(fO(U,W===void 0?{}:{applicationCursorKeys:W}))},[ne]),q=y.useCallback(U=>{const W=I4(U,w.current??void 0);return S.current?.sendInput(W),W},[]),M=y.useCallback(()=>{const U=()=>{w.current?.scrollToBottom();const W=u.current?.querySelector(".xterm-viewport");W&&(W.scrollTop=W.scrollHeight)};U(),window.requestAnimationFrame(()=>{U(),window.requestAnimationFrame(U)}),window.setTimeout(U,80),P.current=!1,L(!1)},[]);return y.useEffect(()=>{if(!u.current)return;let U=!1,W,G,V,R,B,se,re,ce,fe,ue,le,ie,xe,Ne=null,he,we,Ce,Ae,pt=0,dt;m(null);const wn=v.current===t?"running":"connecting";b.current=wn,p(wn),P.current=!1,L(!1);const Nt=ft=>{ft==="running"&&(v.current=t),b.current!==ft&&(b.current=ft,p(ft))},Fn=()=>{const ft=++pt;oN(t).then(zt=>{if(!(U||ft!==pt)){if(!zt){Nt("stopped"),J.current?.();return}E(ln=>ln+1)}}).catch(zt=>{if(!(U||ft!==pt)){if(zt instanceof ow&&(zt.status===401||zt.status===403)){m(zt.message);return}E(ln=>ln+1)}})};return Promise.all([Mt(()=>import("./xterm-B-qIQCd3.js"),[]),Mt(()=>import("./addon-fit-DX4qG4td.js"),[]),Mt(()=>import("./addon-unicode11-Bt8F3D7-.js"),[]),Mt(()=>import("./addon-clipboard-wHJhZAA4.js"),[])]).then(([ft,zt,ln,Se])=>{if(U||!u.current)return;const nt=typeof window<"u"?getComputedStyle(document.documentElement):null,ar=nt?.getPropertyValue("--bg-crust").trim()||"#0e0e0e",rr=nt?.getPropertyValue("--text-primary").trim()||"#ebebeb",de=new ft.Terminal({allowProposedApi:!0,convertEol:!1,fontFamily:"'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:l?12:13,letterSpacing:0,lineHeight:1,scrollback:1e4,theme:{background:ar,foreground:rr}}),Ue=new zt.FitAddon;de.loadAddon(Ue),de.loadAddon(new ln.Unicode11Addon),de.unicode.activeVersion="11",de.loadAddon(new Se.ClipboardAddon),de.open(u.current),F("canvas"),Ue.fit(),se=de,w.current=de,re=Ue,$();const st=()=>{const Te=de.buffer.active,De=Te.viewportY<Te.baseY;P.current!==De&&(P.current=De,L(De))},Kn=()=>{Ae===void 0&&(Ae=window.requestAnimationFrame(()=>{Ae=void 0,st()}))};we=de.onScroll(Kn),Ce=de.buffer.onBufferChange(Kn);const or=Te=>{a==="codex"&&gb(Te)&&(j.current=!0),B?.sendInput(Te)};ie=dO({element:u.current,profile:a,sendInput:or,terminal:de}),l&&(xe=DO({element:u.current,profile:a,sendInput:or,terminal:de})),Ne=u.current.querySelector(".xterm-helper-textarea"),Ne&&(he=aO(Ne,{setComposing:Te=>{N.current=Te},commit:or})),typeof de.attachCustomKeyEventHandler=="function"&&de.attachCustomKeyEventHandler(Te=>{const De=oO(Te,{hasSelection:de.hasSelection()});switch(De.kind){case"send":return Te.preventDefault(),or(De.bytes),!1;case"clear":return Te.preventDefault(),de.clear(),!1;case"copy":{Te.preventDefault();const Ot=de.getSelection();return Ot&&navigator.clipboard?.writeText(Ot).catch(()=>{}),de.clearSelection(),!1}case"block":return!1;case"passthrough":return!0}});const ya=()=>{const Te=u.current;return Te?.isConnected?!Te.closest('[data-terminal-host-parked="true"]'):!1};fe=yO({canRender:ya,write:(Te,De)=>de.write(Te,De)});const bt=()=>{if(!u.current)return{};const Te=u.current.clientWidth,De=u.current.clientHeight,Ot={};return De>0&&(Ot.pixelHeight=De),Te>0&&(Ot.pixelWidth=Te),Ot},xn=()=>{if(!u.current||!ya())return;const Te=bt();if(!Te.pixelHeight||!Te.pixelWidth||dt&&dt.pixelHeight===Te.pixelHeight&&dt.pixelWidth===Te.pixelWidth)return;re?.fit();const De={cols:se?.cols??80,rows:se?.rows??24,...bt()};dt&&dt.cols===De.cols&&dt.rows===De.rows&&dt.pixelHeight===De.pixelHeight&&dt.pixelWidth===De.pixelWidth||(dt=De,B?.resize(De.cols,De.rows,De.pixelWidth,De.pixelHeight))},ht=()=>{ue&&window.clearTimeout(ue),ue=window.setTimeout(()=>{ue=void 0,xn()},50)};Mt(()=>import("./addon-web-links-DIbG5aQx.js"),[]).then(Te=>{U||se!==de||de.loadAddon(new Te.WebLinksAddon)}).catch(()=>{}),MO()&&Mt(()=>import("./addon-webgl-DCtw1yLn.js"),[]).then(Te=>{if(!(U||se!==de))try{const De=new Te.WebglAddon;De.onContextLoss(()=>{De.dispose(),F("canvas")}),de.loadAddon(De),F("webgl"),ht()}catch{F("canvas")}}).catch(()=>{F("canvas")}),B=hO({initialSize:{cols:de.cols,rows:de.rows,...bt()},onError(Te){m(Te)},onExit(){Nt("stopped"),J.current?.()},onOutput(Te,De){Nt("running");const Ot=WO.encode(Te).byteLength;if(a==="codex"){const ba=vb(Te,{preservePromptEditFrame:j.current});if(ba.consumedPromptEraseInput&&(j.current=!1),ba.suppress){fe?.enqueue("",Ot,De);return}fe?.enqueue(ba.chunk,Ot,De);return}fe?.enqueue(Te,Ot,De)},onRestore(Te,De){Nt("running");const Ot=a==="codex"?vb(Te).chunk:Te;if(Ot.length===0){De();return}de.write(Ot,De)},onClose(){U||Fn()},runId:t}),le=window.setTimeout(()=>{le=void 0,!(U||b.current!=="connecting")&&E(Te=>Te+1)},IO),S.current=B,R=de.onData(Te=>{N.current||or(Te)}),typeof de.onBinary=="function"&&(V=de.onBinary(Te=>{const De=PO(Te,a);De.binary?B?.sendBinaryInput(De.chunk):B?.sendInput(De.chunk)})),xn(),typeof ResizeObserver<"u"&&u.current&&(ce=new ResizeObserver(ht),ce.observe(u.current)),W=Te=>{Te.detail?.runId===t&&(fe?.flush(),ht())},G=()=>ht(),window.addEventListener(fm,W),window.addEventListener("resize",G)}).catch(ft=>{U||(m(UO(ft)),Nt("stopped"))}),()=>{U=!0,W&&window.removeEventListener(fm,W),G&&window.removeEventListener("resize",G),ce?.disconnect(),ue&&window.clearTimeout(ue),le&&window.clearTimeout(le),ie?.(),xe?.(),he?.(),fe?.dispose(),Ae!==void 0&&window.cancelAnimationFrame(Ae),we?.dispose(),Ce?.dispose(),V?.dispose(),R?.dispose(),B?.dispose(),se?.dispose(),re?.dispose(),S.current=null,w.current=null}},[t,a,k]),{containerRef:u,error:f,status:g,sendInput:ne,sendKey:Z,beginPaste:q,renderer:A,isScrolledUp:D,scrollToBottom:M}},KO={connecting:"terminal.statusConnecting",running:"terminal.statusRunning",stopped:"common.stopped"},pm="hive-terminal-parking-lot",YO=500,$O=t=>[`worker-pty-${t}`,`orch-pty-${t}`,`shell-pty-${t}`],VO=t=>{for(let a=t;a;a=a.parentElement){if(a.hidden||a.getAttribute("aria-hidden")==="true"||a.classList.contains("hidden"))return!0;const o=window.getComputedStyle?.(a);if(o?.display==="none"||o?.visibility==="hidden")return!0}return!1},GO=t=>{const a=Array.from(document.querySelectorAll("[data-pty-slot]")).filter(o=>o.id===t&&o.isConnected&&!VO(o));return a[a.length-1]??null},XO=()=>{let t=document.getElementById(pm);return t||(t=document.createElement("div"),t.id=pm,t.hidden=!0,t.style.display="none",(document.body??document.documentElement).appendChild(t)),t},Mf=()=>{const t=document.getElementById(pm);t&&t.childElementCount===0&&t.remove()},bb="[data-pty-slot]",Xl=new Set;let Xs,Zs;const qx=t=>t instanceof Element?t.matches(bb)||t.querySelector(bb)!==null:!1,wb=t=>{for(let a=0;a<t.length;a+=1){const o=t.item(a);if(o&&qx(o))return!0}return!1},ZO=t=>t.type==="attributes"&&t.attributeName==="data-pty-slot"?!0:!(t.target instanceof Element)||t.target.closest("[data-terminal-host-run-id]")?!1:wb(t.addedNodes)||wb(t.removedNodes)?!0:t.target===document.body||t.target===document.documentElement?!1:qx(t.target),xb=t=>{if(!(t&&!t.some(ZO)))for(const a of Xl)a()},QO=()=>{Xs?.disconnect(),Xs=void 0,Zs!==void 0&&(window.clearInterval(Zs),Zs=void 0)},JO=()=>{if(Xs||Zs!==void 0)return;const t=document.body??document.documentElement;if(typeof MutationObserver<"u"&&t){Xs=new MutationObserver(xb),Xs.observe(t,{attributeFilter:["aria-hidden","class","data-pty-slot","data-terminal-auto-focus","hidden","id","style"],attributes:!0,childList:!0,subtree:!0});return}Zs=window.setInterval(xb,100)},e5=t=>(Xl.add(t),JO(),()=>{Xl.delete(t),Xl.size===0&&QO()}),t5=[50,150,300],n5=t=>t?.dataset.terminalAutoFocus==="true",a5=t=>{const a=[],o=[],s=()=>window.dispatchEvent(B4(t)),l=(u,f)=>{const m=window.setTimeout(()=>{const g=o.indexOf(m);g>=0&&o.splice(g,1),f()},u);o.push(m)};if(typeof window.requestAnimationFrame=="function"){const u=window.requestAnimationFrame(()=>{s();const f=window.requestAnimationFrame(s);a.push(f)});a.push(u)}else l(0,s);for(const u of t5)l(u,s);return()=>{for(const u of a)window.cancelAnimationFrame?.(u);for(const u of o)window.clearTimeout(u);a.length=0,o.length=0}},r5=t=>{const[a,o]=y.useState(null);return y.useEffect(()=>{const s=$O(t),l=()=>{for(const f of s){const m=GO(f);if(m)return m}return null},u=()=>{const f=l();o(m=>m===f?m:f)};return u(),e5(u)},[t]),a},o5=(t,a)=>{const[o,s]=y.useState(!1),[l,u]=y.useState(null),f=y.useRef(null),m=y.useRef(void 0),g=y.useRef(null),p=y.useRef(void 0),b=y.useCallback(()=>{m.current!==void 0&&(window.clearTimeout(m.current),m.current=void 0)},[]),v=y.useCallback(()=>{p.current?.(),p.current=void 0},[]),k=y.useCallback(()=>{const S=f.current;S?.dataset.terminalSlotRunId===t&&delete S.dataset.terminalSlotRunId,f.current=null},[t]),E=y.useCallback(S=>{const w=f.current;w&&w!==S&&w.dataset.terminalSlotRunId===t&&delete w.dataset.terminalSlotRunId,S.dataset.terminalSlotRunId=t,f.current=S},[t]);return y.useLayoutEffect(()=>{const S=document.createElement("div");return S.dataset.terminalHostRunId=t,S.dataset.terminalHostParked="false",S.className="h-full min-h-0 w-full min-w-0",g.current=S,u(S),()=>{b(),k(),v(),S.remove(),g.current=null,Mf()}},[k,b,v,t]),y.useLayoutEffect(()=>{if(a){b(),s(!0);return}if(!(!o||m.current!==void 0))return m.current=window.setTimeout(()=>{m.current=void 0,s(!1)},YO),b},[o,b,a]),y.useLayoutEffect(()=>{const S=g.current;if(!S)return;if(!o){v(),k(),S.remove(),S.dataset.terminalHostParked="false",Mf();return}const w=a??XO();if(S.parentElement===w){a?E(a):k();return}const C=S.parentElement!==null,T=document.activeElement;a||(v(),k()),!a&&T instanceof HTMLElement&&S.contains(T)&&T.blur(),S.dataset.terminalHostParked=a?"false":"true",w.appendChild(S),a&&E(a),Mf(),a&&C&&(v(),p.current=a5(t))},[o,k,v,E,t,a]),o?l:null},s5=({inputProfile:t="default",onRunExited:a,runId:o,startupBlockedReason:s,title:l})=>{const u=r5(o),f=o5(o,u);if(!f)return null;const m=n5(u)?u:null;return Cc.createPortal(c.jsx(i5,{autoFocusTarget:m,inputProfile:t,onRunExited:a,runId:o,startupBlockedReason:s??null,title:l}),f)},i5=({autoFocusTarget:t,inputProfile:a,onRunExited:o,runId:s,startupBlockedReason:l,title:u})=>{const{t:f}=be(),m=yt(),g=y.useCallback(()=>{o?.(s)},[o,s]),{containerRef:p,error:b,status:v,isScrolledUp:k,scrollToBottom:E}=FO(s,a,g,{autoFocusTarget:t}),S=KO[v],w=y.useCallback(()=>{p.current?.querySelector(".xterm-helper-textarea")?.blur(),E()},[p,E]);return c.jsxs("div",{className:"flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden",children:[c.jsx("p",{className:"sr-only",children:S?f(S):v}),b?c.jsx("p",{role:"alert",className:"mono shrink-0 break-words px-3 py-2 text-xs",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",borderBottom:"1px solid color-mix(in oklab, var(--status-red) 30%, transparent)",color:"var(--status-red)"},children:b}):null,!b&&l==="first_run_setup"?c.jsx("p",{className:"mono shrink-0 break-words px-3 py-2 text-xs","data-testid":`terminal-startup-setup-${s}`,style:{background:"color-mix(in oklab, var(--status-orange) 12%, transparent)",borderBottom:"1px solid color-mix(in oklab, var(--status-orange) 28%, transparent)",color:"var(--text-secondary)"},children:f("terminal.firstRunSetup")}):null,c.jsxs("div",{className:"relative h-full min-h-0 w-full min-w-0 flex-1 overflow-hidden",children:[c.jsx("div",{"data-testid":`terminal-${s}`,ref:p,className:"bg-crust h-full min-h-0 w-full min-w-0 overflow-hidden"}),!b&&v==="connecting"?c.jsx("div",{role:"status",className:"mono pointer-events-none absolute inset-0 flex items-center justify-center px-4 text-center text-xs",style:{color:"var(--text-muted)"},children:f("terminal.statusConnecting")}):null,m&&k?c.jsx(l5,{label:f("terminal.scrollToBottom"),onJump:w}):null]})]})},l5=({label:t,onJump:a})=>{const o=y.useRef(null),s=y.useRef(Number.NEGATIVE_INFINITY),l=y.useCallback(u=>{u.preventDefault?.(),u.stopPropagation?.();const f=u.timeStamp??performance.now();f-s.current<250||(s.current=f,a())},[a]);return y.useEffect(()=>{const u=o.current;if(!u)return;const f=m=>{m.cancelable&&m.preventDefault(),m.stopImmediatePropagation(),l(m)};return u.addEventListener("touchstart",f,{capture:!0,passive:!1}),u.addEventListener("pointerdown",f,{capture:!0}),u.addEventListener("mousedown",f,{capture:!0}),()=>{u.removeEventListener("touchstart",f,{capture:!0}),u.removeEventListener("pointerdown",f,{capture:!0}),u.removeEventListener("mousedown",f,{capture:!0})}},[l]),c.jsx("button",{ref:o,type:"button","aria-label":t,className:"icon-btn icon-btn--primary mobile-terminal-jump-button absolute bottom-2 left-1/2 -translate-x-1/2",tabIndex:-1,onClick:l,onFocus:u=>u.currentTarget.blur(),children:t})},c5=({hidden:t=!1,onTerminalRunExited:a,optimisticRuns:o=[],terminalRuns:s,workspaceId:l})=>{const{t:u}=be(),f=Mx(s,o,l);return c.jsx("section",{hidden:t,"aria-hidden":t||void 0,"aria-label":u("terminalPanels.aria"),children:f.map(m=>c.jsx(s5,{inputProfile:m.terminal_input_profile??"default",onRunExited:g=>a?.(l,g),runId:m.run_id,startupBlockedReason:m.startup_blocked_reason??null,title:`${m.agent_name} (${m.status})`},m.run_id))})},u5=[{version:"2.1.16",date:"2026-07-08",en:["Codex workers are less likely to appear to lose context after a temporary resume failure. Hive now keeps the saved session when the underlying Codex conversation still exists.","If the saved Codex session is truly gone, Hive clears the stale pointer and starts fresh instead of retrying a broken resume.","Session cleanup now uses the same existence check across supported native session stores, keeping resume behavior more consistent across CLI presets."],zh:["Codex 成员在临时 resume 失败后更不容易看起来“丢上下文”。只要底层 Codex 对话还在,Hive 会保留已保存的 session。","如果已保存的 Codex session 确实不存在了,Hive 会清掉陈旧指针并重新启动,而不是反复尝试坏掉的 resume。","Session 清理现在复用同一套原生 session 存在性检查,让不同 CLI preset 的恢复行为更一致。"]},{version:"2.1.15",date:"2026-07-02",en:["Workers can now have custom avatars. Upload and crop an image from the team UI, and Hive will persist it with the worker.","Worker avatars appear in the browser workspace without bloating CLI `team list` output.","Terminal rendering is more reliable under heavy output and reconnect/restore flows, reducing stale or duplicated frames.","`team report` is clearer when Hive has accepted a report and durable Orchestrator delivery is still in progress, avoiding false failure wording.","Orchestrator guidance now waits more patiently for accepted dispatches to report back before nudging or cancelling members."],zh:["成员现在可以设置自定义头像。你可以在团队界面上传并裁剪图片,Hive 会把头像随成员一起保存。","成员头像会显示在浏览器 workspace 中,但不会塞进 CLI 的 `team list` 输出。","终端在大量输出、重连和恢复场景下的渲染更可靠,减少陈旧或重复的终端画面。","当 Hive 已接收 `team report`、但仍在把报告可靠投递给 Orchestrator 时,命令行提示会更准确,不再误报成失败。","Orchestrator 指引现在会更耐心等待已接收派单的成员回报,减少过早催促或取消。"]},{version:"2.1.14",date:"2026-06-25",en:["Returning to a Hive browser tab now focuses the active Orchestrator terminal automatically, so you can keep typing without an extra click.","Opening a member panel now focuses that member terminal automatically, while Hive still avoids stealing focus from normal text fields or workspace shell terminals.","Dream memory consolidation is less likely to fail on procedure-reference validation: ordinary workflow advice is now steered toward regular memory unless it points to a real saved workflow, skill, procedure, template, or document."],zh:["从其他浏览器标签页切回 Hive 时,当前 Orchestrator 终端会自动获得焦点,可以直接继续输入,不用再点一次终端。","打开成员面板时,该成员终端也会自动获得焦点;同时 Hive 不会抢普通文本输入框或 workspace shell 终端的焦点。","Dream 记忆整理更不容易因为 procedure_ref 校验失败:普通流程经验会被引导保存为常规记忆,只有真正指向已有 workflow、skill、procedure、template 或文档时才使用 procedure reference。"]},{version:"2.1.12",date:"2026-06-25",en:["Hive now starts on the less common local port 9483 by default, reducing collisions with other development services. You can still use `hive --port 0` to ask the OS for any free port.","Pi is now a built-in agent preset. Hive can launch `pi --approve`, wait for the Pi prompt before sending startup input, and allow Pi in workflow CLI policy.","The Supervisor MCP adapter and development proxy now follow the same default runtime port, so external supervisors and local development stay aligned."],zh:["Hive 默认启动端口改为较少冲突的本机端口 9483,降低和常见开发服务撞端口的概率;仍可用 `hive --port 0` 让系统自动分配空闲端口。","Pi 现在是内置 agent preset。Hive 可以启动 `pi --approve`,等待 Pi 提示符就绪后再注入启动输入,并允许 workflow CLI policy 使用 Pi。","Supervisor MCP adapter 和开发代理也改为跟随同一个默认 runtime 端口,外部 supervisor 和本地开发配置保持一致。"]},{version:"2.1.11",date:"2026-06-25",en:["Hive now includes a local Supervisor MCP adapter, so external agents can hand goals to the Hive Orchestrator and wait on durable structured goal events.","Orchestrators can report external goal progress, blocked states, failures, and completion with `team goal report`, while external supervisors still cannot directly spawn members, send member tasks, read raw scrollback, or write PTYs.","OpenCode startup input delivery is more reliable after completed turns and interrupt-status screens, and Codex prompt editing now preserves repaint frames after Backspace/Delete-style input."],zh:["Hive 现在包含本地 Supervisor MCP adapter,外部 agent 可以把目标交给 Hive Orchestrator,并通过持久化结构化 goal events 等待进度和结果。","Orchestrator 可以用 `team goal report` 回报 external goal 的进度、阻塞、失败和完成;外部 supervisor 仍不能直接 spawn 成员、给成员派单、读取原始 scrollback 或写 PTY。","OpenCode 在完成一轮和显示 interrupt 状态后的启动输入投递更可靠;Codex 在 Backspace/Delete 类输入后的提示行重绘也会被保留。"]},{version:"2.1.10",date:"2026-06-23",en:["One-click scenario teams now start their members immediately, so they are ready for the Orchestrator to assign work instead of appearing as stopped cards.","OpenCode members are more reliable after startup: Hive now recognizes OpenCode completed-turn footers as a safe dispatch point and asks members to acknowledge received dispatches.","Terminal panes now follow real run lifecycle events more closely, and Codex cursor repaint frames keep the final cursor position during editing."],zh:["一键场景组队现在会立即启动创建出的成员,成员不会再以 stopped 卡片停在那里,Orchestrator 可以直接派工。","OpenCode 成员启动后的派发更可靠:Hive 现在能识别 OpenCode 完成一轮后的 footer,并要求成员收到派单后先发出确认状态。","终端面板现在更贴近真实 run 生命周期;Codex 编辑时的光标刷新也会保留最终光标位置。"]},{version:"2.1.9",date:"2026-06-23",en:["Hive now gives Orchestrators a shorter startup prompt and points them to focused `team guide` topics when they need dispatch, task, memory, workflow, or member details.","Agent-facing language now consistently talks about Hive members, matching the product model you see in the UI.","This release also includes the Codex CJK backspace repaint fix and the cleaner desktop member-window outside-click close behavior."],zh:["Hive 现在给 Orchestrator 注入更短的启动提示,并在需要派单、任务、记忆、workflow 或成员细节时,引导它读取对应的 `team guide`。","面向 agent 的文案统一改为 Hive 成员口径,更贴近界面里的产品模型。","本次也包含 Codex 中文/CJK 删除键刷新修复,以及桌面端成员窗口点击外部关闭的更清爽交互。"]},{version:"2.1.8",date:"2026-06-23",en:["Codex terminals now repaint CJK input correctly when you press Backspace, so deleted characters disappear immediately instead of lingering on screen.","Desktop member windows no longer show a visible close button over the terminal corner; click outside the window to close it, while mobile keeps its full-screen close button."],zh:["Codex 终端现在能正确刷新中文/CJK 输入:按下删除键后,被删字符会立即从画面消失,不再残留。","桌面端成员窗口不再在终端右上角显示关闭按钮;点击窗口外即可关闭,移动端全屏窗口仍保留关闭按钮。"]},{version:"2.1.7",date:"2026-06-23",en:["Worker reports are now queued for durable redelivery when the Orchestrator is offline or restarting, so completed work is not silently lost.","Cancels, dismissed workers, and queued dispatch recovery now produce clearer outcomes when work can no longer be delivered.","User input now fails honestly when the Orchestrator terminal is offline instead of being recorded as if it had been sent.","Remote access has a stricter pairing boundary: phones cannot read or approve desktop-only pairing requests through the tunnel."],zh:["当 Orchestrator 离线或重启时,worker report 现在会进入持久化重投递队列,完成的工作不会再静默丢失。","取消任务、删除 worker 和排队派单恢复路径现在会给出更明确的结果,避免无法投递的工作一直悬着。","当 Orchestrator 终端离线时,用户输入现在会真实失败,不再被记录成已经发送。","远程访问的配对边界更严格:手机端不能通过 tunnel 读取或审批只能在桌面完成的新设备配对请求。"]},{version:"2.1.6",date:"2026-06-21",en:["Hive now shows a global package-update prompt when a newer npm version is available, so upgrade visibility is not limited to the topbar.","Newly started workers send a ready status after receiving Hive startup instructions, giving the Orchestrator a clearer signal that the member actually came online.","The Orchestrator pane no longer exposes a stop button in its chrome, reducing accidental shutdowns of the central coordinator.","Action Center now opens as a dedicated drawer with live workspace health, attention items, recent activity, and worker selection instead of a compact popover."],zh:["检测到新的 npm 版本时,Hive 现在会显示全局更新提示,不再只依赖顶部栏的小提示。","新启动的成员收到 Hive 启动指令后会主动发送 ready 状态,让 Orchestrator 更清楚成员已经真正上线。","Orchestrator 面板不再显示关闭按钮,降低误关中央协调者的风险。","Action Center 改为专用抽屉面板,集中展示 workspace 健康状态、待关注事项、最近动态和成员选择,不再使用紧凑 popover。"]},{version:"2.1.5",date:"2026-06-21",en:["Team memory is more ambient: the Memory drawer no longer asks you to review candidates, while active memory, archived entries, and Dream history stay available for audit.","Hive can now keep lightweight user preferences separately from workspace project facts, so personal working style does not pollute team knowledge.","Workflow and skill memories can point to structured procedure references instead of copying long instructions into memory text.","Dispatch memory retrieval is stricter about relevance, avoiding unrelated role-only matches when a worker receives a new task.","Dream consolidation can run in the background with transactional apply, source checks, isolated failures, and one-step revert."],zh:["团队记忆更低打扰:Memory 抽屉不再让你处理候选记忆,但 active 记忆、归档项和 Dream 历史仍可审计。","Hive 现在可以把轻量用户偏好与 workspace 项目事实分开保存,个人工作风格不会污染团队知识。","流程和 skill 类记忆可以引用结构化 procedure,不再把长流程说明直接塞进记忆正文。","派单记忆检索更严格,只在任务相关时注入,避免仅因 worker 角色匹配就带入无关记忆。","Dream 整理可在后台完成,带事务 apply、source window 校验、失败隔离和一键回滚。"]},{version:"2.1.4",date:"2026-06-21",en:["The first workspace screen is quieter: Hive no longer pushes an Orchestrator dispatch prompt before you have a concrete task.","Team activity is easier to scan, with dispatch pulse effects and queue-count badges removed from the visible UI.","The collapsed empty-workspace sidebar no longer shows a stray compact add button.","Maintainer release checks now use a faster package-focused default gate, with the full test gate still available for high-risk releases."],zh:["第一个 workspace 页面更安静:在你还没有明确任务前,Hive 不再主动提示 Orchestrator 派发工作。","团队动态更好扫读:可见 UI 里的派单脉冲和排队数量徽标已移除。","空 workspace 的折叠侧栏不再出现孤立的紧凑添加按钮。","维护者发布检查改为默认使用更快的打包发版闸门;高风险发版仍保留完整测试闸门。"]},{version:"2.1.3",date:"2026-06-18",en:["Hive now waits when first-run CLI setup screens are visible, so startup instructions no longer collide with trust, login, or confirmation prompts.","User input reports a real delivery failure if the Orchestrator terminal is offline.","Built-in role contracts and scenario/spawn defaults are language-aware, so English workspaces receive English worker prompts by default.","The demo is now a local self-running Hive replay with task progress, worker state changes, and team dispatch flow instead of an external video.","Release checks include a local CLI compatibility report for native modules and Tier-1 agent CLIs.","Settings now shows local-only retention diagnostics, and Memory keeps ambient Dream-maintained workspace knowledge without a candidate review surface."],zh:["首次运行 CLI 出现信任、登录或确认提示时,Hive 现在会等待,不再把启动指令盲注入到 onboarding 屏幕里。","如果 Orchestrator 终端已离线,用户输入会明确返回投递失败,而不是假装成功。","内置角色契约和场景/派生成员默认值已支持语言感知,英文 workspace 默认收到英文 worker prompt。","Demo 改成本地自运行 Hive replay,直接展示任务进度、worker 状态变化和团队派单流,不再依赖外部视频。","发布检查新增本地 CLI 兼容报告,覆盖原生模块和 Tier-1 agent CLI。","Settings 增加本地留存诊断;Memory 保持由 Dream 维护的低打扰工作区知识,不再展示人工复核入口。"]},{version:"2.1.2",date:"2026-06-16",en:["Newly spawned workers now wake correctly for their first team send instead of leaving the task parked in the stopped queue.","If a spawned worker is later stopped manually, Hive still keeps the normal queued-task behavior until you start that worker again.","Claude Code sessions on Windows are more tolerant of large Hive startup and dispatch injections, reducing premature submit or leftover input."],zh:["新建的 worker 现在会正确接住第一次 team send,不会把任务停在 stopped 队列里。","如果这个 worker 后续被手动停止,Hive 仍会保留正常的排队语义:任务等你再次启动该 worker 后再投递。","Windows 上的 Claude Code 会更稳地处理大段 Hive 启动与派单注入,减少过早回车或输入残留。"]},{version:"2.1.1",date:"2026-06-14",en:["Codex terminal input is smoother and more reliable when prompts are pasted or injected for an agent.","Action Center layout and interaction details are cleaner on narrow and mobile-sized screens."],zh:["Codex 终端在粘贴或注入 prompt 时输入更顺、更可靠。","活动中心在窄屏和手机尺寸下的布局与交互细节更干净。"]},{version:"2.1.0",date:"2026-06-13",en:["New Sentinel role: a read-only patrol member that watches the team and flags stalled or orphaned work, without taking dispatches or editing memory itself.","One-click scenario team assembly — spin up a ready-made team from a preset instead of adding members one by one.",'Team memory "Dream" consolidation now runs through your Orchestrator where you can see and review it, instead of a hidden background pass. Workers can be asked to review proposed changes, but only the Orchestrator commits them — and every run can be reverted in one step.',"Action Center adds a one-click copyable team recap and a diagnostics bundle, so sharing status and getting support is faster.","Dispatch pulse: a team send now visibly flows from the Orchestrator to the worker, so you can watch work being handed off.","The add-workspace dialog now guides you to install any missing CLI before you start.","More reliable dispatching: queued tasks replay when a worker starts, delivery failures notify the issuer instead of being lost, and team list shows open dispatches.","Remote/mobile fixes: large uploads over the tunnel no longer fail, and terminal scrolling is restored for CLIs launched through wrapper or legacy commands (such as Codex on Windows).","Hardened prompts and workflow runtime against prompt-injection, with clearer protocol errors and onboarding."],zh:["新增 Sentinel 巡检角色:只读巡检成员,盯团队进度、提示停滞或孤儿任务,自己不接派单、不改记忆。","一键场景组队:从预设模板直接拉起一支现成团队,不用逐个添加成员。","团队记忆 Dream 整理改为经由 Orchestrator 执行,你能看到也能复核,不再后台静默处理。可让 worker 协助评审建议,但只有 Orchestrator 能提交,且每次整理都可一键回滚。","活动中心新增一键复制团队战报与诊断信息包,分享状态、寻求支持更快。","派单脉冲:team send 现在会从蜂后可视化地流向工蜂,派单交接一目了然。","添加 workspace 时,若缺少对应 CLI 会引导你先安装。","派单更可靠:worker 启动时重放排队任务、投递失败会通知发起方而不再丢失、team list 会列出未完成派单。","远程/移动端修复:隧道大文件上传不再失败;经包装或旧版命令启动的 CLI(如 Windows 上的 Codex)终端滚动已恢复。","强化了提示词与 workflow 运行时对提示注入的防护,协议报错与新手引导更清晰。"]},{version:"2.0.2",date:"2026-06-10",en:["Windows Codex terminals now keep the Codex-specific wheel scrolling behavior even when an older saved launch command points through node.exe and @openai/codex/bin/codex.js."],zh:["Windows 上的 Codex 终端滚轮修复:即使旧配置还通过 node.exe 和 @openai/codex/bin/codex.js 启动,Hive 也会继续使用 Codex 专用的滚轮翻页行为。"]},{version:"2.0.1",date:"2026-06-09",en:["Team memory is now available: Hive can keep useful workspace context and bring back prior decisions, constraints, and project notes when your team needs them.","The Memory and Workflows drawers have cleaner desktop and mobile layouts, clearer tabs, and a search field that stays out of the way on wide screens.","Worker cards are easier to scan, with clearer status styling, higher contrast, cleaner role text, and in-place rename instead of a separate edit dialog.","Pending dispatch status is clearer while the Orchestrator is coordinating queued or waiting worker activity.","The current remote/mobile build is now published under the original official @tt-a1i/hive package name."],zh:["团队记忆上线:Hive 可以保留有用的 workspace 上下文,并在团队需要时重新带回之前的决策、约束和项目笔记。","Memory 和 Workflows 抽屉做了桌面端与移动端布局优化,tab 更清楚,宽屏上的搜索框也更不挡内容。","Worker 卡片更容易扫读:状态样式更清晰、对比度更高、角色文字更干净,并改成卡片内直接重命名。","Orchestrator 协调排队或等待中的 worker 活动时,pending dispatch 状态显示更明确。","当前远程访问和移动端构建已通过原来的官方 @tt-a1i/hive 包名发布。"]},{version:"2.0.0",date:"2026-06-07",en:["Remote access is here, off by default: open your running Hive from a phone browser over an end-to-end encrypted tunnel, with the same authority as your local desktop browser.","The new gateway handles identity and routing only. It supports GitHub/Google sign-in, version-pinned mobile bundles, and self-hosting; your agents, terminals, workspaces, and project data stay on your computer.","Pairing is desktop-confirmed: create a short-lived pairing code on the computer, enter it on the phone, compare the 6-digit SAS code on both screens, then confirm on the desktop before the device is trusted.","Manage paired devices from Settings or the CLI: list devices, revoke one, drop a live remote session, and review the audit trail for remote requests and denials.","New CLI commands: hive remote login / status / logout / devices / revoke link the machine to a gateway account and manage trusted devices from the host.","The phone UI is the same Hive reflowed for a small screen: sign-in and machine selection, bottom navigation, workspace switching, full-screen Team / Tasks panels, reconnect banners, and update prompts.","Mobile terminals are writable directly in xterm. Worker terminals open full-screen, focus mode hides surrounding chrome while you work, and touch scrolling is smoother for shell output and faster in full-screen TUI agents.","Local-first behavior stays intact: Hive still works on 127.0.0.1 without any gateway, the tunnel is limited to Hive /api/* and /ws/*, and phones cannot approve new devices or turn Remote access back on."],zh:["远程访问上线,默认关闭:用手机浏览器通过端到端加密隧道打开正在本机运行的 Hive,权限与本地桌面浏览器等同。","新网关只做身份和路由:支持 GitHub / Google 登录、按版本固定的手机端 bundle、以及 self-host;Agent、终端、Workspace 和项目数据都留在你的电脑上。","配对必须由桌面确认:电脑生成短时配对码,手机输入后,两边显示同一个 6 位 SAS 短码;只有在电脑上确认后,新设备才会被信任。","可以在 Settings 或 CLI 里管理已配对设备:查看列表、吊销设备、立即断开正在连接的远程会话,并查看远程请求和拒绝记录的审计流水。","新增 CLI:hive remote login / status / logout / devices / revoke,可在本机完成网关联动和受信设备管理。","手机 UI 是同一个 Hive 的小屏重排:登录与机器选择、底部导航、Workspace 切换、全屏 Team / Tasks 面板、重连提示和更新提示。","移动端终端可以直接在 xterm 里输入。成员终端全屏打开,focus mode 会隐藏周边 chrome;shell 输出滚动更顺,全屏 TUI agent 里的触摸滚动也更跟手。","本地优先不变:没有网关时 Hive 仍照常运行在 127.0.0.1;隧道只允许访问 Hive 自己的 /api/* 和 /ws/*;手机不能批准新设备,也不能在关闭远程后自行重新开启。"]},{version:"1.7.0",date:"2026-06-05",en:["Hermes is now a built-in CLI agent preset alongside Claude Code, Codex, OpenCode, and Gemini — usable as Orchestrator or Worker, via team spawn --cli hermes, and in workflows.","Hermes sessions survive crashes: Hive captures the session id from the CLI startup output and resumes with --resume on restart.","Existing installs get the new preset automatically — just have hermes on your PATH."],zh:["Hermes 成为第五个内置 CLI agent preset,与 Claude Code、Codex、OpenCode、Gemini 并列 —— 可当 Orchestrator 或 Worker,支持 team spawn --cli hermes 和 workflow。","Hermes 会话可在崩溃后恢复:Hive 从 CLI 启动输出捕获 session id,重启时用 --resume 续上。","已有安装会自动获得新 preset —— 只要 PATH 里有 hermes 即可。"]},{version:"1.6.0",date:"2026-06-02",en:["A Stop button on the running Orchestrator lets you halt a runaway agent straight from the UI.","Worker cards now show queue depth and the latest activity line, and the working badge explains that Hive does not auto-detect stalls — check the terminal.","Worker reports are no longer lost when the Orchestrator is down or restarting; they are queued and redelivered automatically.","Deliberately stopping and restarting the Orchestrator no longer replays a stale crash-recovery handover.","A new completion webhook can POST to a URL you choose (Slack, ntfy, Feishu, …) when a worker reports or a workflow finishes.","Workflow agent() gains opt-in structured output via outputSchema, and the new team next lists tasks unblocked by [needs:] dependencies in tasks.md."],zh:["运行中的 Orchestrator 面板新增 Stop 按钮,可以直接在 UI 里停掉跑飞的 agent。","Worker 卡片现在显示队列数和最近活动行;working 状态会说明 Hive 不会自动检测卡死 —— 以终端为准。","Orchestrator 掉线或重启时,Worker 的汇报不再丢失,会自动排队并补投。","手动停止后再重启 Orchestrator,不会再灌入陈旧的崩溃恢复接管。","新增完成通知 Webhook:Worker 汇报或 Workflow 完成时,向你设置的 URL POST(可接 Slack、ntfy、飞书等)。","Workflow 的 agent() 支持 outputSchema 结构化输出;新增 team next 可列出 tasks.md 里被 [needs:] 解除阻塞、当前可做的任务。"]},{version:"1.5.0",date:"2026-05-31",en:["Experimental Workflows let the Orchestrator run multi-agent plans across real Hive workers, with run details, logs, stop controls, and schedules in the Workflows drawer.","Workflow-created agents can now follow your selected default CLI and allowed CLI policy instead of always falling back to Claude Code.","Experimental auto-staff can let the Orchestrator size the worker roster to the task and create task-scoped coders, testers, or reviewers.","Codex dispatches stay reliable for long pasted tasks, while short worker reports now submit quickly instead of waiting several seconds in the input box.","Runtime hardening covers malformed WebSocket frames, Windows Codex startup paths, and workflow worker cleanup edge cases."],zh:["实验性的 Workflows 可以让 Orchestrator 用真实 Hive Worker 执行多 Agent 计划,并在 Workflows 抽屉里查看详情、日志、停止控制和定时任务。","Workflow 创建的 Agent 现在会遵守你选择的默认 CLI 和允许列表,不再总是回退到 Claude Code。","实验性的自动组队可以让 Orchestrator 按任务规模创建临时 coder、tester 或 reviewer。","Codex 的长任务粘贴仍保持可靠;短的 Worker 汇报现在会快速提交,不再在输入框里等好几秒。","运行时加固覆盖了异常 WebSocket 帧、Windows Codex 启动路径和 Workflow Worker 清理等边界情况。"]},{version:"1.4.4",date:"2026-05-30",en:["Windows .cmd and .bat startup commands now launch reliably, including quoted nvm4w and Program Files paths.","Worker shutdown is more robust on Windows, with process-tree cleanup before PTY termination.","Folder picking, filesystem browsing, editor launch, hive update, and port recovery are friendlier on Windows.","Task files keep CRLF line endings, and the watcher handles atomic-save editors more gracefully."],zh:["Windows 上的 .cmd / .bat 启动命令更可靠,包括带引号的 nvm4w 和 Program Files 路径。","Windows 下 Worker 关闭更稳,会先清理进程树再终止 PTY。","文件夹选择、文件浏览、编辑器打开、hive update 和端口占用恢复在 Windows 上更顺手。","任务文件会保留 CRLF 换行,watcher 对原子保存编辑器也更宽容。"]}],kb=t=>{const[a="",o=""]=t.split("-",2),[s=0,l=0,u=0]=a.split(".").map(f=>Number.parseInt(f,10)||0);return{core:[s,l,u],prerelease:o}},Lf=(t,a)=>{const o=kb(t),s=kb(a);for(let l=0;l<3;l+=1){const u=(o.core[l]??0)-(s.core[l]??0);if(u!==0)return u}return o.prerelease===s.prerelease?0:o.prerelease?s.prerelease?o.prerelease.localeCompare(s.prerelease,void 0,{numeric:!0}):-1:1},d5=(t,a,o=u5)=>{if(a===null)return{show:!1,entries:[],seedOnly:!0};if(Lf(t,a)<=0)return{show:!1,entries:[],seedOnly:!1};const s=o.filter(l=>Lf(l.version,a)>0&&Lf(l.version,t)<=0);return s.length===0?{show:!1,entries:[],seedOnly:!0}:{show:!0,entries:s,seedOnly:!1}},Px="hive.last-seen-version",f5="1.7.0",m5=(t,a)=>{try{const o=window.localStorage.getItem(Px);return o||(a?f5:null)}catch{return t}},Sb=t=>{try{window.localStorage.setItem(Px,t)}catch{}},p5=({hasExistingWorkspace:t,wizardOpen:a})=>{const o=tp,[s,l]=y.useState(void 0);y.useEffect(()=>{s!==void 0||t===null||l(m5(o,t))},[t,s]);const u=y.useMemo(()=>s===void 0?{show:!1,entries:[],seedOnly:!1}:d5(o,s),[s]),[f,m]=y.useState(!1);y.useEffect(()=>{u.seedOnly&&Sb(o)},[u.seedOnly]);const g=y.useCallback(()=>{Sb(o),m(!0)},[]);return{open:u.show&&!f&&!a,entries:u.entries,close:g}},Eb="hive.first-run-seen",h5=()=>{const[t,a]=y.useState(()=>{try{return window.localStorage.getItem(Eb)==="1"}catch{return!0}}),o=y.useCallback(()=>{try{window.localStorage.setItem(Eb,"1")}catch{}a(!0)},[]);return{seen:t,markSeen:o}},g5=t=>{const{seen:a,markSeen:o}=h5(),[s,l]=y.useState(!1);y.useEffect(()=>{!a&&t!==null&&t.length===0&&l(!0)},[a,t]);const u=y.useCallback((f=!0)=>{f&&o(),l(!1)},[o]);return{wizardOpen:s,closeWizard:u}},zf=(t,a)=>t.findIndex(s=>s.id===a.id)===-1?[...t,a]:t.map(s=>s.id===a.id?a:s),Fx=t=>t==="codex"?"codex":t==="grok"?"grok":t==="opencode"?"opencode":"default",Cb=(t,a)=>Fx(t.find(o=>o.id===a)?.commandPresetId),Is=t=>t instanceof Error?t.message:String(t),v5=({activeWorkspaceId:t,onWorkerDeleted:a,onWorkerStartFailed:o,onWorkerRunStarted:s,onWorkerRunClosed:l,setWorkersByWorkspaceId:u,workers:f})=>{const{language:m}=be(),g=y.useCallback(async({avatar:S,commandPresetId:w,name:C,role:T,roleDescription:N,startupCommand:j})=>{if(!t)return{error:"No active workspace",runId:null};const A=j.trim(),O=await SN(t,{autostart:!1,avatar:S??null,command_preset_id:w||null,description:N.trim(),name:C,role:T,startup_command:A||null,ui_language:m});u(L=>({...L,[t]:zf(L[t]??[],{...O.worker,status:"idle"})}));const D=t;return ei(D,O.worker.id).then(L=>{s?.({agentId:O.worker.id,agentName:O.worker.name,runId:L.runId,terminalInputProfile:Fx(w),workspaceId:D})}).catch(L=>{const P=Is(L);console.error("[hive] swallowed:createWorker.start",L),u(J=>({...J,[D]:zf(J[D]??[],{...O.worker,status:"stopped"})})),o?.(P)}),{error:null,runId:null}},[t,m,s,o,u]),p=y.useCallback(async S=>{if(!t)throw new Error("No active workspace");await CN(t,S),u(w=>({...w,[t]:(w[t]??[]).filter(C=>C.id!==S)})),a?.(t,S)},[t,a,u]),b=y.useCallback(async(S,w)=>{if(!t)return{error:"No active workspace"};try{const C=await NN(t,S,w);return u(T=>({...T,[t]:zf(T[t]??[],C)})),{error:null}}catch(C){return{error:Is(C)}}},[t,u]),v=y.useCallback(async S=>{if(!t)return{error:"No active workspace",runId:null};try{const w=await ei(t,S);return s?.({agentId:S,agentName:S,runId:w.runId,terminalInputProfile:Cb(f,S),workspaceId:t}),{error:null,runId:w.runId}}catch(w){return{error:Is(w),runId:null}}},[t,s,f]),k=y.useCallback(async S=>{if(!t)return{error:"No active workspace"};try{return await nc(S),l?.(t,S),{error:null}}catch(w){return{error:Is(w)}}},[t,l]),E=y.useCallback(async(S,w)=>{if(!t)return{error:"No active workspace",runId:null};try{const C=await sN(t,S,w);return l?.(t,w),s?.({agentId:S,agentName:S,runId:C.runId,terminalInputProfile:Cb(f,S),workspaceId:t}),{error:null,runId:C.runId}}catch(C){return{error:Is(C),runId:null}}},[t,l,s,f]);return{createWorker:g,deleteWorker:p,updateWorkerAvatar:b,startWorker:v,stopWorkerRun:k,restartWorkerRun:E}},ap={mac:["vscode","vscode-insiders","cursor","finder","terminal","ghostty","zed"],windows:["vscode","vscode-insiders","cursor","finder","zed"],linux:["vscode","vscode-insiders","cursor","finder","zed"],other:["vscode","vscode-insiders","finder"]},y5=new Set(ap.mac),b5=t=>typeof t=="string"&&y5.has(t),Kx=(t,a)=>ap[a].includes(t),Yx=t=>t==="mac"||t==="windows"||t==="linux"?"finder":"vscode",w5="data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='%23FFFFFF'%20d='M11.503.131%201.891%205.678a.84.84%200%200%200-.42.726v11.188c0%20.3.162.575.42.724l9.609%205.55a1%201%200%200%200%20.998%200l9.61-5.55a.84.84%200%200%200%20.42-.724V6.404a.84.84%200%200%200-.42-.726L12.497.131a1.01%201.01%200%200%200-.996%200M2.657%206.338h18.55c.263%200%20.43.287.297.515L12.23%2022.918c-.062.107-.229.064-.229-.06V12.335a.59.59%200%200%200-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23'/%3e%3c/svg%3e",Hf="data:image/svg+xml,%3csvg%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='5'%20y='13'%20width='54'%20height='40'%20rx='8'%20fill='%23F2B73B'/%3e%3cpath%20d='M5%2021C5%2016.58%208.58%2013%2013%2013H25.2C27.2%2013%2029.1%2013.94%2030.3%2015.54L33.2%2019.4H51C55.42%2019.4%2059%2022.98%2059%2027.4V31H5V21Z'%20fill='%23FFD565'/%3e%3cpath%20d='M8%2027H56C58.76%2027%2061%2029.24%2061%2032V49C61%2051.76%2058.76%2054%2056%2054H8C5.24%2054%203%2051.76%203%2049V32C3%2029.24%205.24%2027%208%2027Z'%20fill='%23F8C344'/%3e%3cpath%20d='M8%2032C8%2030.9%208.9%2030%2010%2030H54C55.1%2030%2056%2030.9%2056%2032V48C56%2049.1%2055.1%2050%2054%2050H10C8.9%2050%208%2049.1%208%2048V32Z'%20fill='%23F4B43B'/%3e%3cpath%20d='M10%2031H54C55.1%2031%2056%2031.9%2056%2033V36H8V33C8%2031.9%208.9%2031%2010%2031Z'%20fill='%23FFE082'/%3e%3cpath%20d='M12%2037H52C53.1%2037%2054%2037.9%2054%2039V47C54%2048.1%2053.1%2049%2052%2049H12C10.9%2049%2010%2048.1%2010%2047V39C10%2037.9%2010.9%2037%2012%2037Z'%20fill='%23F0A82F'/%3e%3c/svg%3e",$x="/assets/finder-C4Jmsb0B.png",x5="/assets/ghostty-D-Js4rdm.png",k5="data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='4'%20fill='%232D2D2E'/%3e%3cpath%20d='M6.5%209%20L10%2012%20L6.5%2015'%20stroke='%23FFFFFF'%20stroke-width='1.7'%20fill='none'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cline%20x1='12.5'%20y1='15.5'%20x2='17.5'%20y2='15.5'%20stroke='%23FFFFFF'%20stroke-width='1.7'%20stroke-linecap='round'/%3e%3c/svg%3e",S5="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23007ACC'%20d='M22%205.75v12.48c0%20.49-.28.94-.72%201.15-.91.43-2.46%201.18-3.33%201.59.03-.16.05-.33.05-.5V3.53C18%203.3%2017.97%203.12%2017.94%203c.94.46%202.44%201.18%203.33%201.6C21.72%204.81%2022%205.26%2022%205.75zM3.91%2013.35c.89.8%201.73%201.56%202.51%202.28l-1.48%201.12c-.37.28-.89.27-1.25-.03l-.94-.79c-.46-.39-.48-1.09-.03-1.5C3.05%2014.13%203.46%2013.76%203.91%2013.35zM16%203.53v4.81l-3.16%202.4-3.3-2.5c2.29-2.07%204.46-4.05%205.59-5.1.23-.22.56-.16.74.04.05.06.09.13.11.22C15.99%203.44%2016%203.48%2016%203.53zM16%2020.47v-4.81L4.938%207.252c-.372-.283-.889-.27-1.247.03L2.754%208.066C2.289%208.456%202.271%209.162%202.72%209.569c2.747%202.488%209.998%209.06%2012.41%2011.291C15.462%2021.167%2016%2020.93%2016%2020.47z'/%3e%3c/svg%3e",E5="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%2324BFA5'%20d='M22%205.75v12.48c0%20.49-.28.94-.72%201.15-.91.43-2.46%201.18-3.33%201.59.03-.16.05-.33.05-.5V3.53C18%203.3%2017.97%203.12%2017.94%203c.94.46%202.44%201.18%203.33%201.6C21.72%204.81%2022%205.26%2022%205.75zM3.91%2013.35c.89.8%201.73%201.56%202.51%202.28l-1.48%201.12c-.37.28-.89.27-1.25-.03l-.94-.79c-.46-.39-.48-1.09-.03-1.5C3.05%2014.13%203.46%2013.76%203.91%2013.35zM16%203.53v4.81l-3.16%202.4-3.3-2.5c2.29-2.07%204.46-4.05%205.59-5.1.23-.22.56-.16.74.04.05.06.09.13.11.22C15.99%203.44%2016%203.48%2016%203.53zM16%2020.47v-4.81L4.938%207.252c-.372-.283-.889-.27-1.247.03L2.754%208.066C2.289%208.456%202.271%209.162%202.72%209.569c2.747%202.488%209.998%209.06%2012.41%2011.291C15.462%2021.167%2016%2020.93%2016%2020.47z'/%3e%3c/svg%3e",C5="/assets/zed-C5BQT8X3.png",T5={mac:"openWorkspace.target.finder.mac",windows:"openWorkspace.target.finder.windows",linux:"openWorkspace.target.finder.linux",other:"openWorkspace.target.finder.linux"},N5={mac:$x,windows:Hf,linux:Hf,other:Hf},zc={vscode:{labelKey:"openWorkspace.target.vscode",iconSrc:S5},"vscode-insiders":{labelKey:"openWorkspace.target.vscodeInsiders",iconSrc:E5},cursor:{labelKey:"openWorkspace.target.cursor",iconSrc:w5},finder:{labelKey:"openWorkspace.target.finder.mac",iconSrc:$x},terminal:{labelKey:"openWorkspace.target.terminal",iconSrc:k5},ghostty:{labelKey:"openWorkspace.target.ghostty",iconSrc:x5,iconScale:1.2},zed:{labelKey:"openWorkspace.target.zed",iconSrc:C5}},Vx=(t,a)=>t==="finder"?T5[a]:zc[t].labelKey,Gx=(t,a)=>t==="finder"?N5[a]:zc[t].iconSrc,Uf=(t,a)=>{const o=Kx(t,a)?t:Yx(a),s=zc[o];return{id:o,iconSrc:Gx(o,a),labelKey:Vx(o,a),...s.iconScale!==void 0?{iconScale:s.iconScale}:{}}},j5=t=>ap[t].map(a=>{const o=zc[a];return{id:a,iconSrc:Gx(a,t),labelKey:Vx(a,t),...o.iconScale!==void 0?{iconScale:o.iconScale}:{}}}),A5=()=>{if(typeof navigator>"u")return"other";const t=`${navigator.userAgent} ${navigator.platform}`.toLowerCase();return t.includes("mac")||t.includes("darwin")?"mac":t.includes("win")?"windows":t.includes("linux")||t.includes("x11")?"linux":"other"},Xx="hive.openTarget.preferred",_5=()=>{try{return window.localStorage.getItem(Xx)}catch{return null}},R5=t=>{const a=Yx(t);if(typeof window>"u")return a;const o=_5();if(!o)return a;const s=o==="ghostie"?"ghostty":o;return b5(s)&&Kx(s,t)?s:a},O5=t=>{try{window.localStorage.setItem(Xx,t)}catch{}},D5={"app-not-installed":"openWorkspace.error.appNotInstalled","command-not-in-path":"openWorkspace.error.commandNotInPath","invalid-path":"openWorkspace.error.invalidPath","invalid-target":"openWorkspace.error.invalidTarget",unknown:"openWorkspace.error.unknown"},M5=({workspace:t})=>{const{t:a}=be(),{mode:o}=hw(),s=sn(),l=y.useMemo(()=>A5(),[]),u=j5(l),[f,m]=y.useState(()=>R5(l)),[g,p]=y.useState(!1),[b,v]=y.useState(!1),k=y.useRef(null),E=y.useRef(null),S=Uf(f,l),w=a(S.labelKey);y.useEffect(()=>{if(!g)return;const D=P=>{P.key==="Escape"&&p(!1)},L=P=>{const J=k.current;J&&!J.contains(P.target)&&p(!1)};return document.addEventListener("keydown",D),document.addEventListener("pointerdown",L),()=>{document.removeEventListener("keydown",D),document.removeEventListener("pointerdown",L)}},[g]);const C=y.useCallback(D=>{m(D),O5(D),p(!1),E.current?.focus()},[]),T=y.useCallback(async()=>{if(!(!t||b)){v(!0);try{const D=await AN(t.id,f);if(D.ok){if(o==="mobile"){const L=Uf(D.effectiveTargetId,l).labelKey;s.show({kind:"success",message:a("openWorkspace.opened",{app:a(L),workspace:t.name})})}}else{const L=Uf(D.effectiveTargetId,l).labelKey;s.show({kind:"error",message:a(D5[D.errorCode],{app:a(L)})})}}catch(D){const L=D instanceof Error?D.message:String(D);s.show({kind:"error",message:L})}finally{v(!1)}}},[b,o,l,f,a,s,t]),N=!t,j=a("openWorkspace.noWorkspace"),A=t?a("openWorkspace.openIn",{app:w,workspace:t.name}):j,O=t?a("openWorkspace.openInAria",{app:w,workspace:t.name}):j;return c.jsxs("div",{ref:k,className:"open-workspace relative flex",children:[c.jsx(Je,{label:A,children:c.jsx("span",{className:"flex",children:c.jsxs("button",{ref:E,type:"button","aria-label":O,"data-testid":"topbar-open-workspace",disabled:N||b,onClick:()=>{T()},className:"open-workspace__main",children:[c.jsx("span",{className:"open-workspace__trigger-icon","aria-hidden":!0,children:b?c.jsx(Ja,{size:13,className:"animate-spin"}):c.jsx("img",{src:S.iconSrc,alt:"",className:"open-workspace__trigger-img",style:{transform:S.iconScale?`scale(${S.iconScale})`:void 0}})}),c.jsx("span",{children:a("openWorkspace.open")})]})})}),c.jsx(Je,{label:a("openWorkspace.selectTarget"),children:c.jsx("button",{type:"button","aria-label":a("openWorkspace.selectTarget"),"aria-haspopup":"menu","aria-expanded":g,"data-testid":"topbar-open-workspace-chevron",disabled:N,onClick:()=>p(D=>!D),className:"open-workspace__chevron",children:c.jsx(qo,{size:12,"aria-hidden":!0})})}),g?c.jsx("div",{role:"menu","aria-label":a("openWorkspace.selectTarget"),className:"open-workspace__menu elev-2","data-testid":"topbar-open-workspace-menu",children:u.map(D=>{const L=D.id===f;return c.jsxs("button",{role:"menuitemradio","aria-checked":L,type:"button",onClick:()=>C(D.id),className:"open-workspace__option","data-selected":L?"true":void 0,"data-testid":`topbar-open-workspace-option-${D.id}`,children:[c.jsx("span",{className:"open-workspace__option-icon","aria-hidden":!0,children:c.jsx("img",{src:D.iconSrc,alt:"",className:"open-workspace__option-img",style:{transform:D.iconScale?`scale(${D.iconScale})`:void 0}})}),c.jsx("span",{className:"flex-1",children:a(D.labelKey)}),c.jsx("span",{className:"open-workspace__check","aria-hidden":!0,children:L?c.jsx(ga,{size:13}):null})]},D.id)})}):null]})},L5=y.lazy(()=>Mt(()=>import("./WorkflowsDrawer-Clv5ROhE.js"),__vite__mapDeps([5,4])).then(t=>({default:t.WorkflowsDrawer}))),z5=y.lazy(()=>Mt(()=>import("./WorkspaceMemoryDrawer-DVZT9TqV.js"),__vite__mapDeps([6,3])).then(t=>({default:t.WorkspaceMemoryDrawer}))),H5=()=>{const[t,a]=y.useState(null),{activeWorkspaceId:o,selectWorkspace:s,setActiveWorkspaceId:l}=O4(),{demoMode:u,enableDemo:f,exitDemo:m}=UR(),g=u||!t?[]:t.map(({id:Se})=>Se),[p,b]=U4(g,{activeWorkspaceId:o}),[v,k]=y.useState(0),[E,S]=y.useState(!1),[w,C]=y.useState(!1),[T,N]=y.useState(!1),[j,A]=y.useState(null),[O,D]=y.useState("team"),L=u3(),P=sn(),J=jx(),{wizardOpen:Q,closeWizard:$}=g5(t),F=p5({hasExistingWorkspace:t===null?null:t.length>0,wizardOpen:Q}),Z=Cx().enabled;y.useEffect(()=>{Z||(N(!1),D(Se=>Se==="flows"?"team":Se))},[Z]);const q=y.useCallback(()=>k(Se=>Se+1),[]),[M,U]=y.useState(null),W=y.useCallback(Se=>{U(Se),P.show({kind:"error",message:Se})},[P]);N4(a,l,W);const V=BR({demoMode:u,workspaces:t,activeWorkspaceId:o,workersByWorkspaceId:p}),R=V.effectiveActiveWorkspace?.id,B=R?V.effectiveWorkersByWorkspaceId[R]??[]:[];y.useEffect(()=>{A(Se=>Se&&B.some(nt=>nt.id===Se)?Se:null)},[B]);const se=N_(V.pollWorkspaceId),re=u4(V.pollWorkspaceId,se,B),ce=A4({onWorkspaceCreated:Se=>{a(nt=>nt===null?[Se]:[...nt,Se]),s(Se.id),b(nt=>({...nt,[Se.id]:[]}))},onError:Se=>P.show({kind:"error",message:Se}),onOrchestratorRunStarted:(Se,nt)=>re.recordOptimisticRun({agentId:Qm(Se),agentName:"Orchestrator",runId:nt,status:"starting",workspaceId:Se})});z3(!0);const fe=c4(u?null:o??null,u?HR:void 0),ue=y.useMemo(()=>V.effectiveActiveWorkspace?n4(fe.content):0,[V.effectiveActiveWorkspace,fe.content]),le=v5({activeWorkspaceId:o,onWorkerDeleted:re.forgetOptimisticAgent,onWorkerRunClosed:re.forgetOptimisticRun,onWorkerStartFailed:Se=>P.show({kind:"error",message:Se}),onWorkerRunStarted:re.recordOptimisticRun,setWorkersByWorkspaceId:b,workers:B}),ie=R4({activeWorkspaceId:o,onActiveDeleted:()=>{C(!1),S(!1),N(!1)},selectWorkspace:s,setWorkersByWorkspaceId:b,setWorkspaces:a,workspaces:t});k4({bootstrapError:M,onSelectWorkspace:s,onTriggerAddDialog:q,workspaces:V.effectiveWorkspaces}),Y3({onAddWorkspace:q,onTryDemo:f,ready:u||t!==null||M!==null});const xe=j4(),Ne=M!==null&&!u&&t===null,he=yt(),we=y.useSyncExternalStore(f4,m4),Ce=he?c.jsx(m3,{status:we}):null,Ae=R?re.optimisticRunsByWorkspaceId[R]??[]:[],dt=!Ne&&!u&&R!==void 0&&(re.terminalRuns.length>0||Ae.length>0)?c.jsx(c5,{onTerminalRunExited:re.forgetOptimisticRun,optimisticRuns:Ae,terminalRuns:re.terminalRuns,workspaceId:R},`terminal-${R}`):null,wn=Ne?c.jsx(U3,{onTryDemo:f}):c.jsx(LR,{activeId:R,activeWorkspace:V.effectiveActiveWorkspace,activeWorkerId:j,bootstrapError:M,demoMode:u,workspacesLoading:!u&&t===null,onActiveWorkerChange:A,onDeleteWorkspace:ie,onExitDemo:m,onOrchestratorRunClosed:re.forgetOptimisticRun,onRequestAddWorkspace:q,onShellRunClosed:re.forgetOptimisticRun,onShellRunStarted:(Se,nt)=>re.recordOptimisticRun({agentId:nt.agent_id,agentName:nt.agent_name,runId:nt.run_id,status:nt.status,terminalInputProfile:nt.terminal_input_profile??"default",workspaceId:Se}),onTryDemo:f,orchestratorAutostartErrors:ce.orchestratorAutostartErrors,recordOrchestratorResult:ce.recordOrchestratorResult,terminalRuns:re.terminalRuns,workerActions:le,workers:B,showInlineActionCenter:he}),Nt=c.jsx(gS,{addDialogTrigger:v,wizardOpen:Q,whatsNewOpen:F.open,whatsNewEntries:F.entries,onCloseWhatsNew:F.close,onAddWorkspace:q,onCloseTaskGraph:()=>S(!1),onCloseWizard:$,onCreateWorkspace:ce.createNewWorkspace,onTryDemo:f,taskGraphOpen:E,tasksFile:fe,workspacePath:V.effectiveActiveWorkspace?.path??null,workers:B,onSelectOwner:xe}),Fn=T&&!u&&Z?c.jsx(y.Suspense,{fallback:null,children:c.jsx(L5,{open:!0,onClose:()=>N(!1),workspaceId:o??null})}):null,ft=w&&!u?c.jsx(y.Suspense,{fallback:null,children:c.jsx(z5,{open:!0,onClose:()=>C(!1),workspaceId:o??null})}):null,zt=c.jsx(Q3,{activeWorkspaceId:V.effectiveActiveWorkspaceId,collapsed:L.collapsed,createDisabledReason:M??void 0,onCreateClick:q,onDeleteWorkspace:ie,onSelectWorkspace:s,onToggleCollapse:L.toggleCollapsed,workersByWorkspaceId:V.effectiveWorkersByWorkspaceId,workspaces:V.effectiveWorkspaces}),ln=c.jsxs(c.Fragment,{children:[c.jsx(M5,{workspace:V.effectiveActiveWorkspace}),Ne||u||!R?null:c.jsx(ZA,{workspaceId:R,onOpenWorker:A},R)]});return he?c.jsxs(c.Fragment,{children:[c.jsx(C3,{workspaceSwitcher:Ne?void 0:c.jsx(R3,{activeWorkspaceId:V.effectiveActiveWorkspaceId,workspaces:V.effectiveWorkspaces,workersByWorkspaceId:V.effectiveWorkersByWorkspaceId,createDisabledReason:M??void 0,onCreateClick:q,onDeleteWorkspace:ie,onSelectWorkspace:s}),topbarActions:Ne?void 0:c.jsx(c.Fragment,{children:c.jsx(Nx,{})}),openTaskCount:ue,workingCount:B.filter(Se=>Se.status==="working").length,banner:Ce,terminalPanels:dt,fullBleed:Ne?wn:void 0,team:Ne?null:wn,tasks:Ne?null:c.jsx(j3,{tasksFile:fe,workspacePath:V.effectiveActiveWorkspace?.path??null,workers:B,onSelectOwner:xe,onAddWorkspace:q,demoMode:u}),settings:Ne||!u?void 0:c.jsx(v3,{demoMode:u,onTryDemo:f,onExitDemo:m}),activeSection:O,onSectionChange:D,overlays:Nt}),c.jsx(db,{versionInfo:J}),c.jsx(cb,{terminalRuns:re.terminalRuns}),c.jsx(ub,{})]}):c.jsxs(c.Fragment,{children:[c.jsxs(d3,{hideTopbarActions:!V.effectiveActiveWorkspace,memoryOpen:w,onToggleMemory:u?void 0:()=>C(Se=>!Se),onToggleTaskGraph:()=>S(Se=>!Se),openTaskCount:ue,topbarActions:ln,taskGraphOpen:E,onToggleWorkflows:u||!Z?void 0:()=>N(Se=>!Se),workflowsOpen:T,sidebarResize:L,sidebar:zt,versionInfo:J,children:[wn,dt,Nt,ft,Fn]}),c.jsx(db,{versionInfo:J}),c.jsx(cb,{terminalRuns:re.terminalRuns}),c.jsx(ub,{}),c.jsx(L3,{})]})},U5={success:s0,warning:Js,error:YS},Bf={success:"var(--status-green)",warning:"var(--status-orange)",error:"var(--status-red)"},Tb=({toast:t,api:a})=>{const{t:o}=be(),s=U5[t.kind],l=a.getDuration(t.id);return c.jsxs("div",{"data-testid":"toast","data-kind":t.kind,onMouseEnter:()=>a.pauseDismiss(t.id),onMouseLeave:()=>a.resumeDismiss(t.id),className:"toast elev-2 toast-pop pointer-events-auto relative flex min-w-[260px] max-w-[400px] items-start gap-3 overflow-hidden rounded-lg border px-3 py-2.5",style:{background:"var(--bg-elevated)",borderColor:`color-mix(in oklab, ${Bf[t.kind]} 35%, var(--border))`},children:[c.jsx("span",{className:"mt-0.5 shrink-0",style:{color:Bf[t.kind]},"aria-hidden":!0,children:c.jsx(s,{size:14})}),c.jsx("div",{className:"min-w-0 flex-1 break-words text-sm text-pri",children:t.message}),c.jsx("button",{type:"button","data-testid":"toast-close",onClick:()=>a.dismiss(t.id),className:"-mt-0.5 -mr-1 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-ter transition-colors hover:bg-3 hover:text-pri","aria-label":o("toast.dismissAria"),children:c.jsx(fa,{size:14,"aria-hidden":!0})}),l>0?c.jsx("span",{className:"toast-progress-bar",style:{background:Bf[t.kind],animationDuration:`${l}ms`},"aria-hidden":!0}):null]})},B5=()=>{const t=KA(),a=sn(),o=yt();if(t.length===0)return null;const s=t.filter(u=>u.kind==="error"),l=t.filter(u=>u.kind!=="error");return c.jsxs("div",{className:"toaster pointer-events-none fixed right-4 bottom-8 z-50 flex flex-col gap-2","data-mobile":o||void 0,"data-testid":"toaster",children:[c.jsx("div",{role:"status","aria-live":"polite",className:"flex flex-col gap-2",children:l.map(u=>c.jsx(Tb,{toast:u,api:a},u.id))}),c.jsx("div",{role:"alert","aria-live":"assertive",className:"flex flex-col gap-2",children:s.map(u=>c.jsx(Tb,{toast:u,api:a},u.id))})]})},W5=({children:t})=>c.jsx($w,{delayDuration:250,skipDelayDuration:150,children:c.jsx(mC,{children:c.jsx(FA,{children:c.jsx(s_,{children:c.jsx(n3,{children:c.jsx(e3,{children:c.jsxs(XR,{children:[t,c.jsx(B5,{})]})})})})})})}),I5=()=>c.jsx(tj,{children:c.jsx(W5,{children:c.jsx(H5,{})})}),Nb="\0gw:",Ar={Unauthorized:4401,Forbidden:4403,DaemonOffline:4404,Revoked:4410,InternalError:4500},Zx="hb:ping",Qx="hb:pong",q5=t=>t===Ar.Unauthorized||t===Ar.Revoked;function P5(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function hm(t){if(typeof t!="boolean")throw new TypeError(`boolean expected, not ${t}`)}function Mo(t){if(typeof t!="number")throw new TypeError("number expected, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError("positive integer expected, got "+t)}function _t(t,a,o=""){const s=P5(t),l=t?.length,u=a!==void 0;if(!s||u&&l!==a){const f=o&&`"${o}" `,m=u?` of length ${a}`:"",g=s?`length=${l}`:`type=${typeof t}`,p=f+"expected Uint8Array"+m+", got "+g;throw s?new RangeError(p):new TypeError(p)}return t}function jb(t,a=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(a&&t.finished)throw new Error("Hash#digest() has already been called")}function F5(t,a,o=!1){_t(t,void 0,"output");const s=a.outputLen;if(t.length<s)throw new RangeError("digestInto() expects output buffer of length at least "+s);if(o&&!oi(t))throw new Error("invalid output, must be aligned")}function da(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Za(...t){for(let a=0;a<t.length;a++)t[a].fill(0)}function K5(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const _r=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Jx=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,At=_r?t=>t:t=>Jx(t)>>>0,Y5=t=>{for(let a=0;a<t.length;a++)t[a]=Jx(t[a]);return t},Ga=_r?t=>t:Y5;function $5(t,a){if(a==null||typeof a!="object")throw new Error("options must be defined");return Object.assign(t,a)}function V5(t,a){if(t.length!==a.length)return!1;let o=0;for(let s=0;s<t.length;s++)o|=t[s]^a[s];return o===0}function G5(t,a,o){const s=a,l=(()=>[]),u=(m,g)=>s(g,...l(m)).update(m).digest(),f=s(new Uint8Array(t),...l(new Uint8Array(0)));return u.outputLen=f.outputLen,u.blockLen=f.blockLen,u.create=(m,...g)=>s(m,...g),u}const X5=(t,a)=>{function o(s,...l){if(_t(s,void 0,"key"),t.nonceLength!==void 0){const b=l[0];_t(b,t.varSizeNonce?void 0:t.nonceLength,"nonce")}const u=t.tagLength;u&&l[1]!==void 0&&_t(l[1],void 0,"AAD");const f=a(s,...l),m=(b,v)=>{if(v!==void 0){if(b!==2)throw new Error("cipher output not supported");_t(v,void 0,"output")}};let g=!1;return{encrypt(b,v){if(g)throw new Error("cannot encrypt() twice with same key + nonce");return g=!0,_t(b),m(f.encrypt.length,v),f.encrypt(b,v)},decrypt(b,v){if(_t(b),u&&b.length<u)throw new Error('"ciphertext" expected length bigger than tagLength='+u);return m(f.decrypt.length,v),f.decrypt(b,v)}}}return Object.assign(o,t),o};function gm(t,a,o=!0){if(a===void 0)return new Uint8Array(t);if(_t(a,void 0,"output"),a.length!==t)throw new Error('"output" expected Uint8Array of length '+t+", got: "+a.length);if(o&&!oi(a))throw new Error("invalid output, must be aligned");return a}function Z5(t,a,o){Mo(t),Mo(a),hm(o);const s=new Uint8Array(16),l=K5(s);return l.setBigUint64(0,BigInt(a),o),l.setBigUint64(8,BigInt(t),o),s}function oi(t){return t.byteOffset%4===0}function dc(t){return Uint8Array.from(_t(t))}function e1(t=32){Mo(t);const a=typeof globalThis=="object"?globalThis.crypto:null;if(typeof a?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return a.getRandomValues(new Uint8Array(t))}const t1=t=>Uint8Array.from(t.split(""),a=>a.charCodeAt(0)),Q5=Ga(da(t1("expand 16-byte k"))),J5=Ga(da(t1("expand 32-byte k")));function ge(t,a){return t<<a|t>>>32-a}const qs=64,e6=16,vm=2**32-1,Ab=Uint32Array.of();function t6(t,a,o,s,l,u,f,m){const g=l.length,p=new Uint8Array(qs),b=da(p),v=_r&&oi(l)&&oi(u),k=v?da(l):Ab,E=v?da(u):Ab;if(!_r){for(let S=0;S<g;f++){if(t(a,o,s,b,f,m),Ga(b),f>=vm)throw new Error("arx: counter overflow");const w=Math.min(qs,g-S);for(let C=0,T;C<w;C++)T=S+C,u[T]=l[T]^p[C];S+=w}return}for(let S=0;S<g;f++){if(t(a,o,s,b,f,m),f>=vm)throw new Error("arx: counter overflow");const w=Math.min(qs,g-S);if(v&&w===qs){const C=S/4;if(S%4!==0)throw new Error("arx: invalid block position");for(let T=0,N;T<e6;T++)N=C+T,E[N]=k[N]^b[T];S+=qs;continue}for(let C=0,T;C<w;C++)T=S+C,u[T]=l[T]^p[C];S+=w}}function n6(t,a){const{allowShortKeys:o,extendNonceFn:s,counterLength:l,counterRight:u,rounds:f}=$5({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},a);if(typeof t!="function")throw new Error("core must be a function");return Mo(l),Mo(f),hm(u),hm(o),(m,g,p,b,v=0)=>{_t(m,void 0,"key"),_t(g,void 0,"nonce"),_t(p,void 0,"data");const k=p.length;if(b=gm(k,b,!1),Mo(v),v<0||v>=vm)throw new Error("arx: counter overflow");const E=[];let S=m.length,w,C;if(S===32)E.push(w=dc(m)),C=J5;else if(S===16&&o)w=new Uint8Array(32),w.set(m),w.set(m,16),C=Q5,E.push(w);else throw _t(m,32,"arx key"),new Error("invalid key size");(!_r||!oi(g))&&E.push(g=dc(g));let T=da(w);if(s){if(g.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const A=g.subarray(0,16);if(_r)s(C,T,da(A),T);else{const O=Ga(Uint32Array.from(C));s(O,T,da(A),T),Za(O),Ga(T)}g=g.subarray(16)}else _r||Ga(T);const N=16-l;if(N!==g.length)throw new Error(`arx: nonce must be ${N} or 16 bytes`);if(N!==12){const A=new Uint8Array(12);A.set(g,u?0:12-g.length),g=A,E.push(g)}const j=Ga(da(g));try{return t6(t,C,T,j,p,b,v,f),b}finally{Za(...E)}}}function Ct(t,a){return t[a++]&255|(t[a++]&255)<<8}class a6{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(a){a=dc(_t(a,32,"key"));const o=Ct(a,0),s=Ct(a,2),l=Ct(a,4),u=Ct(a,6),f=Ct(a,8),m=Ct(a,10),g=Ct(a,12),p=Ct(a,14);this.r[0]=o&8191,this.r[1]=(o>>>13|s<<3)&8191,this.r[2]=(s>>>10|l<<6)&7939,this.r[3]=(l>>>7|u<<9)&8191,this.r[4]=(u>>>4|f<<12)&255,this.r[5]=f>>>1&8190,this.r[6]=(f>>>14|m<<2)&8191,this.r[7]=(m>>>11|g<<5)&8065,this.r[8]=(g>>>8|p<<8)&8191,this.r[9]=p>>>5&127;for(let b=0;b<8;b++)this.pad[b]=Ct(a,16+2*b)}process(a,o,s=!1){const l=s?0:2048,{h:u,r:f}=this,m=f[0],g=f[1],p=f[2],b=f[3],v=f[4],k=f[5],E=f[6],S=f[7],w=f[8],C=f[9],T=Ct(a,o+0),N=Ct(a,o+2),j=Ct(a,o+4),A=Ct(a,o+6),O=Ct(a,o+8),D=Ct(a,o+10),L=Ct(a,o+12),P=Ct(a,o+14);let J=u[0]+(T&8191),Q=u[1]+((T>>>13|N<<3)&8191),$=u[2]+((N>>>10|j<<6)&8191),F=u[3]+((j>>>7|A<<9)&8191),ne=u[4]+((A>>>4|O<<12)&8191),Z=u[5]+(O>>>1&8191),q=u[6]+((O>>>14|D<<2)&8191),M=u[7]+((D>>>11|L<<5)&8191),U=u[8]+((L>>>8|P<<8)&8191),W=u[9]+(P>>>5|l),G=0,V=G+J*m+Q*(5*C)+$*(5*w)+F*(5*S)+ne*(5*E);G=V>>>13,V&=8191,V+=Z*(5*k)+q*(5*v)+M*(5*b)+U*(5*p)+W*(5*g),G+=V>>>13,V&=8191;let R=G+J*g+Q*m+$*(5*C)+F*(5*w)+ne*(5*S);G=R>>>13,R&=8191,R+=Z*(5*E)+q*(5*k)+M*(5*v)+U*(5*b)+W*(5*p),G+=R>>>13,R&=8191;let B=G+J*p+Q*g+$*m+F*(5*C)+ne*(5*w);G=B>>>13,B&=8191,B+=Z*(5*S)+q*(5*E)+M*(5*k)+U*(5*v)+W*(5*b),G+=B>>>13,B&=8191;let se=G+J*b+Q*p+$*g+F*m+ne*(5*C);G=se>>>13,se&=8191,se+=Z*(5*w)+q*(5*S)+M*(5*E)+U*(5*k)+W*(5*v),G+=se>>>13,se&=8191;let re=G+J*v+Q*b+$*p+F*g+ne*m;G=re>>>13,re&=8191,re+=Z*(5*C)+q*(5*w)+M*(5*S)+U*(5*E)+W*(5*k),G+=re>>>13,re&=8191;let ce=G+J*k+Q*v+$*b+F*p+ne*g;G=ce>>>13,ce&=8191,ce+=Z*m+q*(5*C)+M*(5*w)+U*(5*S)+W*(5*E),G+=ce>>>13,ce&=8191;let fe=G+J*E+Q*k+$*v+F*b+ne*p;G=fe>>>13,fe&=8191,fe+=Z*g+q*m+M*(5*C)+U*(5*w)+W*(5*S),G+=fe>>>13,fe&=8191;let ue=G+J*S+Q*E+$*k+F*v+ne*b;G=ue>>>13,ue&=8191,ue+=Z*p+q*g+M*m+U*(5*C)+W*(5*w),G+=ue>>>13,ue&=8191;let le=G+J*w+Q*S+$*E+F*k+ne*v;G=le>>>13,le&=8191,le+=Z*b+q*p+M*g+U*m+W*(5*C),G+=le>>>13,le&=8191;let ie=G+J*C+Q*w+$*S+F*E+ne*k;G=ie>>>13,ie&=8191,ie+=Z*v+q*b+M*p+U*g+W*m,G+=ie>>>13,ie&=8191,G=(G<<2)+G|0,G=G+V|0,V=G&8191,G=G>>>13,R+=G,u[0]=V,u[1]=R,u[2]=B,u[3]=se,u[4]=re,u[5]=ce,u[6]=fe,u[7]=ue,u[8]=le,u[9]=ie}finalize(){const{h:a,pad:o}=this,s=new Uint16Array(10);let l=a[1]>>>13;a[1]&=8191;for(let m=2;m<10;m++)a[m]+=l,l=a[m]>>>13,a[m]&=8191;a[0]+=l*5,l=a[0]>>>13,a[0]&=8191,a[1]+=l,l=a[1]>>>13,a[1]&=8191,a[2]+=l,s[0]=a[0]+5,l=s[0]>>>13,s[0]&=8191;for(let m=1;m<10;m++)s[m]=a[m]+l,l=s[m]>>>13,s[m]&=8191;s[9]-=8192;let u=(l^1)-1;for(let m=0;m<10;m++)s[m]&=u;u=~u;for(let m=0;m<10;m++)a[m]=a[m]&u|s[m];a[0]=(a[0]|a[1]<<13)&65535,a[1]=(a[1]>>>3|a[2]<<10)&65535,a[2]=(a[2]>>>6|a[3]<<7)&65535,a[3]=(a[3]>>>9|a[4]<<4)&65535,a[4]=(a[4]>>>12|a[5]<<1|a[6]<<14)&65535,a[5]=(a[6]>>>2|a[7]<<11)&65535,a[6]=(a[7]>>>5|a[8]<<8)&65535,a[7]=(a[8]>>>8|a[9]<<5)&65535;let f=a[0]+o[0];a[0]=f&65535;for(let m=1;m<8;m++)f=(a[m]+o[m]|0)+(f>>>16)|0,a[m]=f&65535;Za(s)}update(a){jb(this),_t(a),a=dc(a);const{buffer:o,blockLen:s}=this,l=a.length;for(let u=0;u<l;){const f=Math.min(s-this.pos,l-u);if(f===s){for(;s<=l-u;u+=s)this.process(a,u);continue}o.set(a.subarray(u,u+f),this.pos),this.pos+=f,u+=f,this.pos===s&&(this.process(o,0,!1),this.pos=0)}return this}destroy(){this.destroyed=!0,Za(this.h,this.r,this.buffer,this.pad)}digestInto(a){jb(this),F5(a,this),this.finished=!0;const{buffer:o,h:s}=this;let{pos:l}=this;if(l){for(o[l++]=1;l<16;l++)o[l]=0;this.process(o,0,!0)}this.finalize();let u=0;for(let f=0;f<8;f++)a[u++]=s[f]>>>0,a[u++]=s[f]>>>8}digest(){const{buffer:a,outputLen:o}=this;this.digestInto(a);const s=a.slice(0,o);return this.destroy(),s}}const r6=G5(32,t=>new a6(t));function o6(t,a,o,s,l,u=20){let f=t[0],m=t[1],g=t[2],p=t[3],b=a[0],v=a[1],k=a[2],E=a[3],S=a[4],w=a[5],C=a[6],T=a[7],N=l,j=o[0],A=o[1],O=o[2],D=f,L=m,P=g,J=p,Q=b,$=v,F=k,ne=E,Z=S,q=w,M=C,U=T,W=N,G=j,V=A,R=O;for(let se=0;se<u;se+=2)D=D+Q|0,W=ge(W^D,16),Z=Z+W|0,Q=ge(Q^Z,12),D=D+Q|0,W=ge(W^D,8),Z=Z+W|0,Q=ge(Q^Z,7),L=L+$|0,G=ge(G^L,16),q=q+G|0,$=ge($^q,12),L=L+$|0,G=ge(G^L,8),q=q+G|0,$=ge($^q,7),P=P+F|0,V=ge(V^P,16),M=M+V|0,F=ge(F^M,12),P=P+F|0,V=ge(V^P,8),M=M+V|0,F=ge(F^M,7),J=J+ne|0,R=ge(R^J,16),U=U+R|0,ne=ge(ne^U,12),J=J+ne|0,R=ge(R^J,8),U=U+R|0,ne=ge(ne^U,7),D=D+$|0,R=ge(R^D,16),M=M+R|0,$=ge($^M,12),D=D+$|0,R=ge(R^D,8),M=M+R|0,$=ge($^M,7),L=L+F|0,W=ge(W^L,16),U=U+W|0,F=ge(F^U,12),L=L+F|0,W=ge(W^L,8),U=U+W|0,F=ge(F^U,7),P=P+ne|0,G=ge(G^P,16),Z=Z+G|0,ne=ge(ne^Z,12),P=P+ne|0,G=ge(G^P,8),Z=Z+G|0,ne=ge(ne^Z,7),J=J+Q|0,V=ge(V^J,16),q=q+V|0,Q=ge(Q^q,12),J=J+Q|0,V=ge(V^J,8),q=q+V|0,Q=ge(Q^q,7);let B=0;s[B++]=f+D|0,s[B++]=m+L|0,s[B++]=g+P|0,s[B++]=p+J|0,s[B++]=b+Q|0,s[B++]=v+$|0,s[B++]=k+F|0,s[B++]=E+ne|0,s[B++]=S+Z|0,s[B++]=w+q|0,s[B++]=C+M|0,s[B++]=T+U|0,s[B++]=N+W|0,s[B++]=j+G|0,s[B++]=A+V|0,s[B++]=O+R|0}function s6(t,a,o,s){let l=At(t[0]),u=At(t[1]),f=At(t[2]),m=At(t[3]),g=At(a[0]),p=At(a[1]),b=At(a[2]),v=At(a[3]),k=At(a[4]),E=At(a[5]),S=At(a[6]),w=At(a[7]),C=At(o[0]),T=At(o[1]),N=At(o[2]),j=At(o[3]);for(let O=0;O<20;O+=2)l=l+g|0,C=ge(C^l,16),k=k+C|0,g=ge(g^k,12),l=l+g|0,C=ge(C^l,8),k=k+C|0,g=ge(g^k,7),u=u+p|0,T=ge(T^u,16),E=E+T|0,p=ge(p^E,12),u=u+p|0,T=ge(T^u,8),E=E+T|0,p=ge(p^E,7),f=f+b|0,N=ge(N^f,16),S=S+N|0,b=ge(b^S,12),f=f+b|0,N=ge(N^f,8),S=S+N|0,b=ge(b^S,7),m=m+v|0,j=ge(j^m,16),w=w+j|0,v=ge(v^w,12),m=m+v|0,j=ge(j^m,8),w=w+j|0,v=ge(v^w,7),l=l+p|0,j=ge(j^l,16),S=S+j|0,p=ge(p^S,12),l=l+p|0,j=ge(j^l,8),S=S+j|0,p=ge(p^S,7),u=u+b|0,C=ge(C^u,16),w=w+C|0,b=ge(b^w,12),u=u+b|0,C=ge(C^u,8),w=w+C|0,b=ge(b^w,7),f=f+v|0,T=ge(T^f,16),k=k+T|0,v=ge(v^k,12),f=f+v|0,T=ge(T^f,8),k=k+T|0,v=ge(v^k,7),m=m+g|0,N=ge(N^m,16),E=E+N|0,g=ge(g^E,12),m=m+g|0,N=ge(N^m,8),E=E+N|0,g=ge(g^E,7);let A=0;s[A++]=l,s[A++]=u,s[A++]=f,s[A++]=m,s[A++]=C,s[A++]=T,s[A++]=N,s[A++]=j,Ga(s)}const i6=n6(o6,{counterRight:!1,counterLength:8,extendNonceFn:s6,allowShortKeys:!1}),l6=new Uint8Array(16),_b=(t,a)=>{t.update(a);const o=a.length%16;o&&t.update(l6.subarray(o))},c6=new Uint8Array(32);function Rb(t,a,o,s,l){l!==void 0&&_t(l,void 0,"AAD");const u=t(a,o,c6),f=Z5(s.length,l?l.length:0,!0),m=r6.create(u);l&&_b(m,l),_b(m,s),m.update(f);const g=m.digest();return Za(u,f),g}const u6=t=>(a,o,s)=>({encrypt(u,f){const m=u.length;f=gm(m+16,f,!1),f.set(u);const g=f.subarray(0,-16);t(a,o,g,g,1);const p=Rb(t,a,o,g,s);return f.set(p,m),Za(p),f},decrypt(u,f){f=gm(u.length-16,f,!1);const m=u.subarray(0,-16),g=u.subarray(-16),p=Rb(t,a,o,m,s);if(!V5(g,p))throw Za(p),new Error("invalid tag");return f.set(u.subarray(0,-16)),t(a,o,f,f,1),Za(p),f}}),n1=X5({blockSize:64,nonceLength:24,tagLength:16},u6(i6));function d6(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function Wo(t,a=""){if(typeof t!="number"){const o=a&&`"${a}" `;throw new TypeError(`${o}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){const o=a&&`"${a}" `;throw new RangeError(`${o}expected integer >= 0, got ${t}`)}}function ha(t,a,o=""){const s=d6(t),l=t?.length,u=a!==void 0;if(!s||u&&l!==a){const f=o&&`"${o}" `,m=u?` of length ${a}`:"",g=s?`length=${l}`:`type=${typeof t}`,p=f+"expected Uint8Array"+m+", got "+g;throw s?new RangeError(p):new TypeError(p)}return t}function rp(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Wo(t.outputLen),Wo(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function fc(t,a=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(a&&t.finished)throw new Error("Hash#digest() has already been called")}function a1(t,a){ha(t,void 0,"digestInto() output");const o=a.outputLen;if(t.length<o)throw new RangeError('"digestInto() output" expected to be of length >='+o)}function si(...t){for(let a=0;a<t.length;a++)t[a].fill(0)}function Wf(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function zn(t,a){return t<<32-a|t>>>a}const r1=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",f6=Array.from({length:256},(t,a)=>a.toString(16).padStart(2,"0"));function op(t){if(ha(t),r1)return t.toHex();let a="";for(let o=0;o<t.length;o++)a+=f6[t[o]];return a}const ua={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ob(t){if(t>=ua._0&&t<=ua._9)return t-ua._0;if(t>=ua.A&&t<=ua.F)return t-(ua.A-10);if(t>=ua.a&&t<=ua.f)return t-(ua.a-10)}function sp(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);if(r1)try{return Uint8Array.fromHex(t)}catch(l){throw l instanceof SyntaxError?new RangeError(l.message):l}const a=t.length,o=a/2;if(a%2)throw new RangeError("hex string expected, got unpadded hex of length "+a);const s=new Uint8Array(o);for(let l=0,u=0;l<o;l++,u+=2){const f=Ob(t.charCodeAt(u)),m=Ob(t.charCodeAt(u+1));if(f===void 0||m===void 0){const g=t[u]+t[u+1];throw new RangeError('hex string expected, got non-hex character "'+g+'" at index '+u)}s[l]=f*16+m}return s}function m6(t,a={}){const o=(l,u)=>t(u).update(l).digest(),s=t(void 0);return o.outputLen=s.outputLen,o.blockLen=s.blockLen,o.canXOF=s.canXOF,o.create=l=>t(l),Object.assign(o,a),Object.freeze(o)}function p6(t=32){Wo(t,"bytesLength");const a=typeof globalThis=="object"?globalThis.crypto:null;if(typeof a?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return a.getRandomValues(new Uint8Array(t))}const h6=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function g6(t,a,o){return t&a^~t&o}function v6(t,a,o){return t&a^t&o^a&o}class y6{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(a,o,s,l){this.blockLen=a,this.outputLen=o,this.padOffset=s,this.isLE=l,this.buffer=new Uint8Array(a),this.view=Wf(this.buffer)}update(a){fc(this),ha(a);const{view:o,buffer:s,blockLen:l}=this,u=a.length;for(let f=0;f<u;){const m=Math.min(l-this.pos,u-f);if(m===l){const g=Wf(a);for(;l<=u-f;f+=l)this.process(g,f);continue}s.set(a.subarray(f,f+m),this.pos),this.pos+=m,f+=m,this.pos===l&&(this.process(o,0),this.pos=0)}return this.length+=a.length,this.roundClean(),this}digestInto(a){fc(this),a1(a,this),this.finished=!0;const{buffer:o,view:s,blockLen:l,isLE:u}=this;let{pos:f}=this;o[f++]=128,si(this.buffer.subarray(f)),this.padOffset>l-f&&(this.process(s,0),f=0);for(let v=f;v<l;v++)o[v]=0;s.setBigUint64(l-8,BigInt(this.length*8),u),this.process(s,0);const m=Wf(a),g=this.outputLen;if(g%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const p=g/4,b=this.get();if(p>b.length)throw new Error("_sha2: outputLen bigger than state");for(let v=0;v<p;v++)m.setUint32(4*v,b[v],u)}digest(){const{buffer:a,outputLen:o}=this;this.digestInto(a);const s=a.slice(0,o);return this.destroy(),s}_cloneInto(a){a||=new this.constructor,a.set(...this.get());const{blockLen:o,buffer:s,length:l,finished:u,destroyed:f,pos:m}=this;return a.destroyed=f,a.finished=u,a.length=l,a.pos=m,l%o&&a.buffer.set(s),a}clone(){return this._cloneInto()}}const Fa=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),b6=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ka=new Uint32Array(64);class w6 extends y6{constructor(a){super(64,a,8,!1)}get(){const{A:a,B:o,C:s,D:l,E:u,F:f,G:m,H:g}=this;return[a,o,s,l,u,f,m,g]}set(a,o,s,l,u,f,m,g){this.A=a|0,this.B=o|0,this.C=s|0,this.D=l|0,this.E=u|0,this.F=f|0,this.G=m|0,this.H=g|0}process(a,o){for(let v=0;v<16;v++,o+=4)Ka[v]=a.getUint32(o,!1);for(let v=16;v<64;v++){const k=Ka[v-15],E=Ka[v-2],S=zn(k,7)^zn(k,18)^k>>>3,w=zn(E,17)^zn(E,19)^E>>>10;Ka[v]=w+Ka[v-7]+S+Ka[v-16]|0}let{A:s,B:l,C:u,D:f,E:m,F:g,G:p,H:b}=this;for(let v=0;v<64;v++){const k=zn(m,6)^zn(m,11)^zn(m,25),E=b+k+g6(m,g,p)+b6[v]+Ka[v]|0,w=(zn(s,2)^zn(s,13)^zn(s,22))+v6(s,l,u)|0;b=p,p=g,g=m,m=f+E|0,f=u,u=l,l=s,s=E+w|0}s=s+this.A|0,l=l+this.B|0,u=u+this.C|0,f=f+this.D|0,m=m+this.E|0,g=g+this.F|0,p=p+this.G|0,b=b+this.H|0,this.set(s,l,u,f,m,g,p,b)}roundClean(){si(Ka)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),si(this.buffer)}}class x6 extends w6{A=Fa[0]|0;B=Fa[1]|0;C=Fa[2]|0;D=Fa[3]|0;E=Fa[4]|0;F=Fa[5]|0;G=Fa[6]|0;H=Fa[7]|0;constructor(){super(32)}}const Lo=m6(()=>new x6,h6(1));const Qa=(t,a,o)=>ha(t,a,o),o1=Wo,s1=op,k6=t=>sp(t),S6=t=>p6(t),mc=BigInt(0),ym=BigInt(1);function i1(t,a=""){if(typeof t!="boolean"){const o=a&&`"${a}" `;throw new TypeError(o+"expected boolean, got type="+typeof t)}return t}function E6(t){if(typeof t=="bigint"){if(!Zl(t))throw new RangeError("positive bigint expected, got "+t)}else o1(t);return t}function Db(t,a=""){if(typeof t!="number"){const o=a&&`"${a}" `;throw new TypeError(o+"expected number, got type="+typeof t)}if(!Number.isSafeInteger(t)){const o=a&&`"${a}" `;throw new RangeError(o+"expected safe integer, got "+t)}}function l1(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);return t===""?mc:BigInt("0x"+t)}function C6(t){return l1(op(t))}function ii(t){return l1(op(li(ha(t)).reverse()))}function c1(t,a){if(Wo(a),a===0)throw new RangeError("zero length");t=E6(t);const o=t.toString(16);if(o.length>a*2)throw new RangeError("number too large");return sp(o.padStart(a*2,"0"))}function u1(t,a){return c1(t,a).reverse()}function T6(t,a){if(t=Qa(t),a=Qa(a),t.length!==a.length)return!1;let o=0;for(let s=0;s<t.length;s++)o|=t[s]^a[s];return o===0}function li(t){return Uint8Array.from(Qa(t))}const Zl=t=>typeof t=="bigint"&&mc<=t;function N6(t,a,o){return Zl(t)&&Zl(a)&&Zl(o)&&a<=t&&t<o}function pc(t,a,o,s){if(!N6(a,o,s))throw new RangeError("expected valid "+t+": "+o+" <= n < "+s+", got "+a)}function j6(t){if(t<mc)throw new Error("expected non-negative bigint, got "+t);let a;for(a=0;t>mc;t>>=ym,a+=1);return a}const A6=t=>(ym<<BigInt(t))-ym;function ip(t,a={},o={}){if(Object.prototype.toString.call(t)!=="[object Object]")throw new TypeError("expected valid options object");function s(u,f,m){if(!m&&f!=="function"&&!Object.hasOwn(t,u))throw new TypeError(`param "${u}" is invalid: expected own property`);const g=t[u];if(m&&g===void 0)return;const p=typeof g;if(p!==f||g===null)throw new TypeError(`param "${u}" is invalid: expected ${f}, got ${p}`)}const l=(u,f)=>Object.entries(u).forEach(([m,g])=>s(m,g,f));l(a,!1),l(o,!0)}const Mb=()=>{throw new Error("not implemented")};const Rt=BigInt(0),Tt=BigInt(1),Nr=BigInt(2),d1=BigInt(3),f1=BigInt(4),m1=BigInt(5),_6=BigInt(7),p1=BigInt(8),R6=BigInt(9),h1=BigInt(16);function ot(t,a){if(a<=Rt)throw new Error("mod: expected positive modulus, got "+a);const o=t%a;return o>=Rt?o:a+o}function Cn(t,a,o){if(a<Rt)throw new Error("pow2: expected non-negative exponent, got "+a);let s=t;for(;a-- >Rt;)s*=s,s%=o;return s}function Lb(t,a){if(t===Rt)throw new Error("invert: expected non-zero number");if(a<=Rt)throw new Error("invert: expected positive modulus, got "+a);let o=ot(t,a),s=a,l=Rt,u=Tt;for(;o!==Rt;){const m=s/o,g=s-o*m,p=l-u*m;s=o,o=g,l=u,u=p}if(s!==Tt)throw new Error("invert: does not exist");return ot(l,a)}function lp(t,a,o){const s=t;if(!s.eql(s.sqr(a),o))throw new Error("Cannot find square root")}function g1(t,a){const o=t,s=(o.ORDER+Tt)/f1,l=o.pow(a,s);return lp(o,l,a),l}function O6(t,a){const o=t,s=(o.ORDER-m1)/p1,l=o.mul(a,Nr),u=o.pow(l,s),f=o.mul(a,u),m=o.mul(o.mul(f,Nr),u),g=o.mul(f,o.sub(m,o.ONE));return lp(o,g,a),g}function D6(t){const a=cp(t),o=v1(t),s=o(a,a.neg(a.ONE)),l=o(a,s),u=o(a,a.neg(s)),f=(t+_6)/h1;return((m,g)=>{const p=m;let b=p.pow(g,f),v=p.mul(b,s);const k=p.mul(b,l),E=p.mul(b,u),S=p.eql(p.sqr(v),g),w=p.eql(p.sqr(k),g);b=p.cmov(b,v,S),v=p.cmov(E,k,w);const C=p.eql(p.sqr(v),g),T=p.cmov(b,v,C);return lp(p,T,g),T})}function v1(t){if(t<d1)throw new Error("sqrt is not defined for small field");let a=t-Tt,o=0;for(;a%Nr===Rt;)a/=Nr,o++;let s=Nr;const l=cp(t);for(;zb(l,s)===1;)if(s++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(o===1)return g1;let u=l.pow(s,a);const f=(a+Tt)/Nr;return function(g,p){const b=g;if(b.is0(p))return p;if(zb(b,p)!==1)throw new Error("Cannot find square root");let v=o,k=b.mul(b.ONE,u),E=b.pow(p,a),S=b.pow(p,f);for(;!b.eql(E,b.ONE);){if(b.is0(E))return b.ZERO;let w=1,C=b.sqr(E);for(;!b.eql(C,b.ONE);)if(w++,C=b.sqr(C),w===v)throw new Error("Cannot find square root");const T=Tt<<BigInt(v-w-1),N=b.pow(k,T);v=w,k=b.sqr(N),E=b.mul(E,k),S=b.mul(S,N)}return S}}function M6(t){return t%f1===d1?g1:t%p1===m1?O6:t%h1===R6?D6(t):v1(t)}const Cr=(t,a)=>(ot(t,a)&Tt)===Tt,L6=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function z6(t){const a={ORDER:"bigint",BYTES:"number",BITS:"number"},o=L6.reduce((s,l)=>(s[l]="function",s),a);if(ip(t,o),Db(t.BYTES,"BYTES"),Db(t.BITS,"BITS"),t.BYTES<1||t.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(t.ORDER<=Tt)throw new Error("invalid field: expected ORDER > 1, got "+t.ORDER);return t}function H6(t,a,o){const s=t;if(o<Rt)throw new Error("invalid exponent, negatives unsupported");if(o===Rt)return s.ONE;if(o===Tt)return a;let l=s.ONE,u=a;for(;o>Rt;)o&Tt&&(l=s.mul(l,u)),u=s.sqr(u),o>>=Tt;return l}function y1(t,a,o=!1){const s=t,l=new Array(a.length).fill(o?s.ZERO:void 0),u=a.reduce((m,g,p)=>s.is0(g)?m:(l[p]=m,s.mul(m,g)),s.ONE),f=s.inv(u);return a.reduceRight((m,g,p)=>s.is0(g)?m:(l[p]=s.mul(m,l[p]),s.mul(m,g)),f),l}function zb(t,a){const o=t,s=(o.ORDER-Tt)/Nr,l=o.pow(a,s),u=o.eql(l,o.ONE),f=o.eql(l,o.ZERO),m=o.eql(l,o.neg(o.ONE));if(!u&&!f&&!m)throw new Error("invalid Legendre symbol result");return u?1:f?0:-1}function U6(t,a){if(a!==void 0&&o1(a),t<=Rt)throw new Error("invalid n length: expected positive n, got "+t);if(a!==void 0&&a<1)throw new Error("invalid n length: expected positive bit length, got "+a);const o=j6(t);if(a!==void 0&&a<o)throw new Error(`invalid n length: expected bit length (${o}) >= n.length (${a})`);const s=a!==void 0?a:o,l=Math.ceil(s/8);return{nBitLength:s,nByteLength:l}}const Hb=new WeakMap;class b1{ORDER;BITS;BYTES;isLE;ZERO=Rt;ONE=Tt;_lengths;_mod;constructor(a,o={}){if(a<=Tt)throw new Error("invalid field: expected ORDER > 1, got "+a);let s;this.isLE=!1,o!=null&&typeof o=="object"&&(typeof o.BITS=="number"&&(s=o.BITS),typeof o.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:o.sqrt,enumerable:!0}),typeof o.isLE=="boolean"&&(this.isLE=o.isLE),o.allowedLengths&&(this._lengths=Object.freeze(o.allowedLengths.slice())),typeof o.modFromBytes=="boolean"&&(this._mod=o.modFromBytes));const{nBitLength:l,nByteLength:u}=U6(a,s);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=a,this.BITS=l,this.BYTES=u,Object.freeze(this)}create(a){return ot(a,this.ORDER)}isValid(a){if(typeof a!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof a);return Rt<=a&&a<this.ORDER}is0(a){return a===Rt}isValidNot0(a){return!this.is0(a)&&this.isValid(a)}isOdd(a){return(a&Tt)===Tt}neg(a){return ot(-a,this.ORDER)}eql(a,o){return a===o}sqr(a){return ot(a*a,this.ORDER)}add(a,o){return ot(a+o,this.ORDER)}sub(a,o){return ot(a-o,this.ORDER)}mul(a,o){return ot(a*o,this.ORDER)}pow(a,o){return H6(this,a,o)}div(a,o){return ot(a*Lb(o,this.ORDER),this.ORDER)}sqrN(a){return a*a}addN(a,o){return a+o}subN(a,o){return a-o}mulN(a,o){return a*o}inv(a){return Lb(a,this.ORDER)}sqrt(a){let o=Hb.get(this);return o||Hb.set(this,o=M6(this.ORDER)),o(this,a)}toBytes(a){return this.isLE?u1(a,this.BYTES):c1(a,this.BYTES)}fromBytes(a,o=!1){Qa(a);const{_lengths:s,BYTES:l,isLE:u,ORDER:f,_mod:m}=this;if(s){if(a.length<1||!s.includes(a.length)||a.length>l)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);const p=new Uint8Array(l);p.set(a,u?0:p.length-a.length),a=p}if(a.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+a.length);let g=u?ii(a):C6(a);if(m&&(g=ot(g,f)),!o&&!this.isValid(g))throw new Error("invalid field element: outside of range 0..ORDER");return g}invertBatch(a){return y1(this,a)}cmov(a,o,s){return i1(s,"condition"),s?o:a}}Object.freeze(b1.prototype);function cp(t,a={}){return new b1(t,a)}const hc=BigInt(0),bm=BigInt(1);function Ub(t,a){const o=a.negate();return t?o:a}function If(t,a){const o=y1(t.Fp,a.map(s=>s.Z));return a.map((s,l)=>t.fromAffine(s.toAffine(o[l])))}function w1(t,a){if(!Number.isSafeInteger(t)||t<=0||t>a)throw new Error("invalid window size, expected [1.."+a+"], got W="+t)}function qf(t,a){w1(t,a);const o=Math.ceil(a/t)+1,s=2**(t-1),l=2**t,u=A6(t),f=BigInt(t);return{windows:o,windowSize:s,mask:u,maxNumber:l,shiftBy:f}}function Bb(t,a,o){const{windowSize:s,mask:l,maxNumber:u,shiftBy:f}=o;let m=Number(t&l),g=t>>f;m>s&&(m-=u,g+=bm);const p=a*s,b=p+Math.abs(m)-1,v=m===0,k=m<0,E=a%2!==0;return{nextN:g,offset:b,isZero:v,isNeg:k,isNegF:E,offsetF:p}}const Pf=new WeakMap,x1=new WeakMap;function Ff(t){return x1.get(t)||1}function Wb(t){if(t!==hc)throw new Error("invalid wNAF")}class B6{BASE;ZERO;Fn;bits;constructor(a,o){this.BASE=a.BASE,this.ZERO=a.ZERO,this.Fn=a.Fn,this.bits=o}_unsafeLadder(a,o,s=this.ZERO){let l=a;for(;o>hc;)o&bm&&(s=s.add(l)),l=l.double(),o>>=bm;return s}precomputeWindow(a,o){const{windows:s,windowSize:l}=qf(o,this.bits),u=[];let f=a,m=f;for(let g=0;g<s;g++){m=f,u.push(m);for(let p=1;p<l;p++)m=m.add(f),u.push(m);f=m.double()}return u}wNAF(a,o,s){if(!this.Fn.isValid(s))throw new Error("invalid scalar");let l=this.ZERO,u=this.BASE;const f=qf(a,this.bits);for(let m=0;m<f.windows;m++){const{nextN:g,offset:p,isZero:b,isNeg:v,isNegF:k,offsetF:E}=Bb(s,m,f);s=g,b?u=u.add(Ub(k,o[E])):l=l.add(Ub(v,o[p]))}return Wb(s),{p:l,f:u}}wNAFUnsafe(a,o,s,l=this.ZERO){const u=qf(a,this.bits);for(let f=0;f<u.windows&&s!==hc;f++){const{nextN:m,offset:g,isZero:p,isNeg:b}=Bb(s,f,u);if(s=m,!p){const v=o[g];l=l.add(b?v.negate():v)}}return Wb(s),l}getPrecomputes(a,o,s){let l=Pf.get(o);return l||(l=this.precomputeWindow(o,a),a!==1&&(typeof s=="function"&&(l=s(l)),Pf.set(o,l))),l}cached(a,o,s){const l=Ff(a);return this.wNAF(l,this.getPrecomputes(l,a,s),o)}unsafe(a,o,s,l){const u=Ff(a);return u===1?this._unsafeLadder(a,o,l):this.wNAFUnsafe(u,this.getPrecomputes(u,a,s),o,l)}createCache(a,o){w1(o,this.bits),x1.set(a,o),Pf.delete(a)}hasCache(a){return Ff(a)!==1}}function Ib(t,a,o){if(a){if(a.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return z6(a),a}else return cp(t,{isLE:o})}function W6(t,a,o={},s){if(s===void 0&&(s=t==="edwards"),!a||typeof a!="object")throw new Error(`expected valid ${t} CURVE object`);for(const g of["p","n","h"]){const p=a[g];if(!(typeof p=="bigint"&&p>hc))throw new Error(`CURVE.${g} must be positive bigint`)}const l=Ib(a.p,o.Fp,s),u=Ib(a.n,o.Fn,s),m=["Gx","Gy","a","d"];for(const g of m)if(!l.isValid(a[g]))throw new Error(`CURVE.${g} must be valid field element of CURVE.Fp`);return a=Object.freeze(Object.assign({},a)),{CURVE:a,Fp:l,Fn:u}}function I6(t,a){return function(s){const l=t(s);return{secretKey:l,publicKey:a(l)}}}const Ya=BigInt(0),Ft=BigInt(1),Kf=BigInt(2),q6=BigInt(8);function P6(t,a,o,s){const l=t.sqr(o),u=t.sqr(s),f=t.add(t.mul(a.a,l),u),m=t.add(t.ONE,t.mul(a.d,t.mul(l,u)));return t.eql(f,m)}function F6(t,a={}){const o=a,s=W6("edwards",t,o,o.FpFnLE),{Fp:l,Fn:u}=s;let f=s.CURVE;const{h:m}=f;ip(o,{},{uvRatio:"function"});const g=Kf<<BigInt(u.BYTES*8)-Ft,p=w=>l.create(w),b=o.uvRatio===void 0?(w,C)=>{try{return{isValid:!0,value:l.sqrt(l.div(w,C))}}catch{return{isValid:!1,value:Ya}}}:o.uvRatio;if(!P6(l,f,f.Gx,f.Gy))throw new Error("bad curve params: generator point");function v(w,C,T=!1){const N=T?Ft:Ya;return pc("coordinate "+w,C,N,g),C}function k(w){if(!(w instanceof E))throw new Error("EdwardsPoint expected")}class E{static BASE=new E(f.Gx,f.Gy,Ft,p(f.Gx*f.Gy));static ZERO=new E(Ya,Ft,Ft,Ya);static Fp=l;static Fn=u;X;Y;Z;T;constructor(C,T,N,j){this.X=v("x",C),this.Y=v("y",T),this.Z=v("z",N,!0),this.T=v("t",j),Object.freeze(this)}static CURVE(){return f}static fromAffine(C){if(C instanceof E)throw new Error("extended point not allowed");const{x:T,y:N}=C||{};return v("x",T),v("y",N),new E(T,N,Ft,p(T*N))}static fromBytes(C,T=!1){const N=l.BYTES,{a:j,d:A}=f;C=li(Qa(C,N,"point")),i1(T,"zip215");const O=li(C),D=C[N-1];O[N-1]=D&-129;const L=ii(O),P=T?g:l.ORDER;pc("point.y",L,Ya,P);const J=p(L*L),Q=p(J-Ft),$=p(A*J-j);let{isValid:F,value:ne}=b(Q,$);if(!F)throw new Error("bad point: invalid y coordinate");const Z=(ne&Ft)===Ft,q=(D&128)!==0;if(!T&&ne===Ya&&q)throw new Error("bad point: x=0 and x_0=1");return q!==Z&&(ne=p(-ne)),E.fromAffine({x:ne,y:L})}static fromHex(C,T=!1){return E.fromBytes(k6(C),T)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(C=8,T=!0){return S.createCache(this,C),T||this.multiply(Kf),this}assertValidity(){const C=this,{a:T,d:N}=f;if(C.is0())throw new Error("bad point: ZERO");const{X:j,Y:A,Z:O,T:D}=C,L=p(j*j),P=p(A*A),J=p(O*O),Q=p(J*J),$=p(L*T),F=p(J*p($+P)),ne=p(Q+p(N*p(L*P)));if(F!==ne)throw new Error("bad point: equation left != right (1)");const Z=p(j*A),q=p(O*D);if(Z!==q)throw new Error("bad point: equation left != right (2)")}equals(C){k(C);const{X:T,Y:N,Z:j}=this,{X:A,Y:O,Z:D}=C,L=p(T*D),P=p(A*j),J=p(N*D),Q=p(O*j);return L===P&&J===Q}is0(){return this.equals(E.ZERO)}negate(){return new E(p(-this.X),this.Y,this.Z,p(-this.T))}double(){const{a:C}=f,{X:T,Y:N,Z:j}=this,A=p(T*T),O=p(N*N),D=p(Kf*p(j*j)),L=p(C*A),P=T+N,J=p(p(P*P)-A-O),Q=L+O,$=Q-D,F=L-O,ne=p(J*$),Z=p(Q*F),q=p(J*F),M=p($*Q);return new E(ne,Z,M,q)}add(C){k(C);const{a:T,d:N}=f,{X:j,Y:A,Z:O,T:D}=this,{X:L,Y:P,Z:J,T:Q}=C,$=p(j*L),F=p(A*P),ne=p(D*N*Q),Z=p(O*J),q=p((j+A)*(L+P)-$-F),M=Z-ne,U=Z+ne,W=p(F-T*$),G=p(q*M),V=p(U*W),R=p(q*W),B=p(M*U);return new E(G,V,B,R)}subtract(C){return k(C),this.add(C.negate())}multiply(C){if(!u.isValidNot0(C))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");const{p:T,f:N}=S.cached(this,C,j=>If(E,j));return If(E,[T,N])[0]}multiplyUnsafe(C){if(!u.isValid(C))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return C===Ya?E.ZERO:this.is0()||C===Ft?this:S.unsafe(this,C,T=>If(E,T))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return S.unsafe(this,f.n).is0()}toAffine(C){const T=this;let N=C;const{X:j,Y:A,Z:O}=T,D=T.is0();N==null&&(N=D?q6:l.inv(O));const L=p(j*N),P=p(A*N),J=l.mul(O,N);if(D)return{x:Ya,y:Ft};if(J!==Ft)throw new Error("invZ was invalid");return{x:L,y:P}}clearCofactor(){return m===Ft?this:this.multiplyUnsafe(m)}toBytes(){const{x:C,y:T}=this.toAffine(),N=l.toBytes(T);return N[N.length-1]|=C&Ft?128:0,N}toHex(){return s1(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const S=new B6(E,u.BITS);return u.BITS>=8&&E.BASE.precompute(8),Object.freeze(E.prototype),Object.freeze(E),E}class K6{static BASE;static ZERO;static Fp;static Fn;ep;constructor(a){this.ep=a}static fromBytes(a){Mb()}static fromHex(a){Mb()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(a){return this.ep.toAffine(a)}toHex(){return s1(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(a){return this.assertSame(a),this.init(this.ep.add(a.ep))}subtract(a){return this.assertSame(a),this.init(this.ep.subtract(a.ep))}multiply(a){return this.init(this.ep.multiply(a))}multiplyUnsafe(a){return this.init(this.ep.multiplyUnsafe(a))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(a,o){return this.ep.precompute(a,o),this}}const Ps=BigInt(0),_o=BigInt(1),Il=BigInt(2);function Y6(t){return ip(t,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...t})}function $6(t){const a=Y6(t),{P:o,type:s,adjustScalarBytes:l,powPminus2:u,randomBytes:f}=a,m=s==="x25519";if(!m&&s!=="x448")throw new Error("invalid type");const g=f===void 0?S6:f,p=m?255:448,b=m?32:56,v=BigInt(m?9:5),k=BigInt(m?121665:39081),E=m?Il**BigInt(254):Il**BigInt(447),S=m?BigInt(8)*Il**BigInt(251)-_o:BigInt(4)*Il**BigInt(445)-_o,w=E+S+_o,C=Z=>ot(Z,o),T=N(v);function N(Z){return u1(C(Z),b)}function j(Z){const q=li(Qa(Z,b,"uCoordinate"));return m&&(q[31]&=127),C(ii(q))}function A(Z){return ii(l(li(Qa(Z,b,"scalar"))))}function O(Z,q){const M=Q(j(q),A(Z));if(M===Ps)throw new Error("invalid private or public key received");return N(M)}function D(Z){return O(Z,T)}const L=D,P=O;function J(Z,q,M){const U=C(Z*(q-M));return q=C(q-U),M=C(M+U),{x_2:q,x_3:M}}function Q(Z,q){pc("u",Z,Ps,o),pc("scalar",q,E,w);const M=q,U=Z;let W=_o,G=Ps,V=Z,R=_o,B=Ps;for(let re=BigInt(p-1);re>=Ps;re--){const ce=M>>re&_o;B^=ce,{x_2:W,x_3:V}=J(B,W,V),{x_2:G,x_3:R}=J(B,G,R),B=ce;const fe=W+G,ue=C(fe*fe),le=W-G,ie=C(le*le),xe=ue-ie,Ne=V+R,he=V-R,we=C(he*fe),Ce=C(Ne*le),Ae=we+Ce,pt=we-Ce;V=C(Ae*Ae),R=C(U*C(pt*pt)),W=C(ue*ie),G=C(xe*(ue+C(k*xe)))}({x_2:W,x_3:V}=J(B,W,V)),{x_2:G,x_3:R}=J(B,G,R);const se=u(G);return C(W*se)}const $={secretKey:b,publicKey:b,seed:b},F=Z=>(Z=Z===void 0?g(b):Z,Qa(Z,$.seed,"seed"),Z),ne={randomSecretKey:F};return Object.freeze($),Object.freeze(ne),Object.freeze({keygen:I6(F,L),getSharedSecret:P,getPublicKey:L,scalarMult:O,scalarMultBase:D,utils:ne,GuBytes:T.slice(),lengths:$})}const V6=BigInt(0),Qs=BigInt(1),qb=BigInt(2),G6=BigInt(3),X6=BigInt(5),Z6=BigInt(8),Io=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),k1={p:Io,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Z6,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function S1(t){const a=BigInt(10),o=BigInt(20),s=BigInt(40),l=BigInt(80),u=Io,m=t*t%u*t%u,g=Cn(m,qb,u)*m%u,p=Cn(g,Qs,u)*t%u,b=Cn(p,X6,u)*p%u,v=Cn(b,a,u)*b%u,k=Cn(v,o,u)*v%u,E=Cn(k,s,u)*k%u,S=Cn(E,l,u)*E%u,w=Cn(S,l,u)*E%u,C=Cn(w,a,u)*b%u;return{pow_p_5_8:Cn(C,qb,u)*t%u,b2:m}}function Q6(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const wm=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function E1(t,a){const o=Io,s=ot(a*a*a,o),l=ot(s*s*a,o),u=S1(t*l).pow_p_5_8;let f=ot(t*s*u,o);const m=ot(a*f*f,o),g=f,p=ot(f*wm,o),b=m===t,v=m===ot(-t,o),k=m===ot(-t*wm,o);return b&&(f=g),(v||k)&&(f=p),Cr(f,o)&&(f=ot(-f,o)),{isValid:b||v,value:f}}const Ro=F6(k1,{uvRatio:E1}),Tr=Ro.Fp,J6=Ro.Fn,xm=(()=>{const t=Io;return $6({P:t,type:"x25519",powPminus2:a=>{const{pow_p_5_8:o,b2:s}=S1(a);return ot(Cn(o,G6,t)*s,t)},adjustScalarBytes:Q6})})(),Pb=wm,eD=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Fb=t=>E1(Qs,t),tD=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),nD=t=>Tr.create(ii(t)&tD);class nn extends K6{static BASE=new nn(Ro.BASE);static ZERO=new nn(Ro.ZERO);static Fp=Tr;static Fn=J6;constructor(a){super(a)}static fromAffine(a){return new nn(Ro.fromAffine(a))}assertSame(a){if(!(a instanceof nn))throw new Error("RistrettoPoint expected")}init(a){return new nn(a)}static fromBytes(a){ha(a,32);const{a:o,d:s}=k1,l=Io,u=A=>Tr.create(A),f=nD(a);if(!T6(Tr.toBytes(f),a)||Cr(f,l))throw new Error("invalid ristretto255 encoding 1");const m=u(f*f),g=u(Qs+o*m),p=u(Qs-o*m),b=u(g*g),v=u(p*p),k=u(o*s*b-v),{isValid:E,value:S}=Fb(u(k*v)),w=u(S*p),C=u(S*w*k);let T=u((f+f)*w);Cr(T,l)&&(T=u(-T));const N=u(g*C),j=u(T*N);if(!E||Cr(j,l)||N===V6)throw new Error("invalid ristretto255 encoding 2");return new nn(new Ro(T,N,Qs,j))}static fromHex(a){return nn.fromBytes(sp(a))}toBytes(){let{X:a,Y:o,Z:s,T:l}=this.ep;const u=Io,f=C=>Tr.create(C),m=f(f(s+o)*f(s-o)),g=f(a*o),p=f(g*g),{value:b}=Fb(f(m*p)),v=f(b*m),k=f(b*g),E=f(v*k*l);let S;if(Cr(l*E,u)){let C=f(o*Pb),T=f(a*Pb);a=C,o=T,S=f(v*eD)}else S=k;Cr(a*E,u)&&(o=f(-o));let w=f((s-o)*S);return Cr(w,u)&&(w=f(-w)),Tr.toBytes(w)}equals(a){this.assertSame(a);const{X:o,Y:s}=this.ep,{X:l,Y:u}=a.ep,f=p=>Tr.create(p),m=f(o*u)===f(s*l),g=f(s*u)===f(o*l);return m||g}is0(){return this.equals(nn.ZERO)}}Object.freeze(nn.BASE);Object.freeze(nn.ZERO);Object.freeze(nn.prototype);Object.freeze(nn);class Kb{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(a,o){if(rp(a),ha(o,void 0,"key"),this.iHash=a.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,l=new Uint8Array(s);l.set(o.length>s?a.create().update(o).digest():o);for(let u=0;u<l.length;u++)l[u]^=54;this.iHash.update(l),this.oHash=a.create();for(let u=0;u<l.length;u++)l[u]^=106;this.oHash.update(l),si(l)}update(a){return fc(this),this.iHash.update(a),this}digestInto(a){fc(this),a1(a,this),this.finished=!0;const o=a.subarray(0,this.outputLen);this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const a=new Uint8Array(this.oHash.outputLen);return this.digestInto(a),a}_cloneInto(a){a||=Object.create(Object.getPrototypeOf(this),{});const{oHash:o,iHash:s,finished:l,destroyed:u,blockLen:f,outputLen:m}=this;return a=a,a.finished=l,a.destroyed=u,a.blockLen=f,a.outputLen=m,a.oHash=o._cloneInto(a.oHash),a.iHash=s._cloneInto(a.iHash),a}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const C1=(()=>{const t=((a,o,s)=>new Kb(a,o).update(s).digest());return t.create=(a,o)=>new Kb(a,o),t})();function aD(t,a,o){return rp(t),o===void 0&&(o=new Uint8Array(t.outputLen)),C1(t,o,a)}const Yf=Uint8Array.of(0),Yb=Uint8Array.of();function rD(t,a,o,s=32){rp(t),Wo(s,"length"),ha(a,void 0,"prk");const l=t.outputLen;if(a.length<l)throw new Error('"prk" must be at least HashLen octets');if(s>255*l)throw new Error("Length must be <= 255*HashLen");const u=Math.ceil(s/l);o===void 0?o=Yb:ha(o,void 0,"info");const f=new Uint8Array(u*l),m=C1.create(t,a),g=m._cloneInto(),p=new Uint8Array(m.outputLen);for(let b=0;b<u;b++)Yf[0]=b+1,g.update(b===0?Yb:p).update(o).update(Yf).digestInto(p),f.set(p,l*b),m._cloneInto(g);return m.destroy(),g.destroy(),si(p,Yf),f.slice(0,s)}const ci=(t,a,o,s,l)=>rD(t,aD(t,a,o),s,l),Nn=2,$b=32,oD=32,Xa=32,sD=24,km=32,T1=32,iD=6,Sm=32,N1="hive/remote/v1/pair",lD="hive/remote/v1/key/daemon->device",cD="hive/remote/v1/key/device->daemon",uD="hive/remote/v1/sas",dD="hive/remote/v1/transcript",fD="hive/remote/v2/conn/daemon->device",mD="hive/remote/v2/conn/device->daemon",pD="hive/remote/v2/conn-salt",hD=1,gD=2,vD=4,yD=8,j1=12,bD=new TextEncoder;function rn(t){return bD.encode(t)}function Bn(...t){let a=0;for(const l of t)a+=l.length;const o=new Uint8Array(a);let s=0;for(const l of t)o.set(l,s),s+=l.length;return o}function Hc(t){if(!Number.isInteger(t)||t<0||t>4294967295)throw new RangeError(`u32be out of range: ${t}`);const a=new Uint8Array(4);return new DataView(a.buffer).setUint32(0,t),a}function up(t,a=0){if(t.length<a+4)throw new RangeError("u32beRead: buffer too short");return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(a)}function wD(t){if(!Number.isSafeInteger(t)||t<0)throw new RangeError(`u64be out of range: ${t}`);const a=new Uint8Array(8),o=Math.floor(t/4294967296),s=t>>>0,l=new DataView(a.buffer);return l.setUint32(0,o),l.setUint32(4,s),a}function gc(t){if(t.length>65535)throw new RangeError("lp: value too long for u16 length prefix");const a=new Uint8Array(2+t.length);return new DataView(a.buffer).setUint16(0,t.length),a.set(t,2),a}function bn(t,a,o){if(t.length!==a)throw new RangeError(`${o} must be ${a} bytes, got ${t.length}`)}const Tn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",xD=(()=>{const t=new Int16Array(128).fill(-1);for(let a=0;a<Tn.length;a++)t[Tn.charCodeAt(a)]=a;return t})();function jr(t){let a="",o=0;for(;o+3<=t.length;o+=3){const l=t[o],u=t[o+1],f=t[o+2];a+=Tn[l>>2],a+=Tn[(l&3)<<4|u>>4],a+=Tn[(u&15)<<2|f>>6],a+=Tn[f&63]}const s=t.length-o;if(s===1){const l=t[o];a+=Tn[l>>2],a+=Tn[(l&3)<<4]}else if(s===2){const l=t[o],u=t[o+1];a+=Tn[l>>2],a+=Tn[(l&3)<<4|u>>4],a+=Tn[(u&15)<<2]}return a}function ui(t){if(t.length%4===1)throw new RangeError("invalid base64url");const a=t.length>>2,o=t.length&3,s=a*3+(o===0?0:o-1),l=new Uint8Array(s),u=g=>{if(g>=128)throw new RangeError("invalid base64url");const p=xD[g];if(p<0)throw new RangeError("invalid base64url");return p};let f=0,m=0;for(;m+4<=t.length;m+=4){const g=u(t.charCodeAt(m)),p=u(t.charCodeAt(m+1)),b=u(t.charCodeAt(m+2)),v=u(t.charCodeAt(m+3));l[f++]=g<<2|p>>4,l[f++]=(p&15)<<4|b>>2,l[f++]=(b&3)<<6|v}if(o===2){const g=u(t.charCodeAt(m)),p=u(t.charCodeAt(m+1));l[f++]=g<<2|p>>4}else if(o===3){const g=u(t.charCodeAt(m)),p=u(t.charCodeAt(m+1)),b=u(t.charCodeAt(m+2));l[f++]=g<<2|p>>4,l[f++]=(p&15)<<4|b>>2}return l}function kD(t){return JSON.stringify(t)}function SD(t){let a;try{a=JSON.parse(t)}catch{throw new RangeError("invalid pairing payload: not JSON")}if(typeof a!="object"||a===null)throw new RangeError("invalid pairing payload: not an object");const o=a;if(o.v!==Nn)throw new RangeError(`unsupported pairing version: ${String(o.v)}`);if(typeof o.gatewayUrl!="string"||o.gatewayUrl.length===0)throw new RangeError("invalid pairing payload: gatewayUrl");if(typeof o.daemonId!="string"||o.daemonId.length===0)throw new RangeError("invalid pairing payload: daemonId");if(typeof o.pairingSecret!="string")throw new RangeError("invalid pairing payload: pairingSecret");if(ui(o.pairingSecret).length!==km)throw new RangeError(`pairingSecret must be ${km} bytes`);return{v:o.v,gatewayUrl:o.gatewayUrl,daemonId:o.daemonId,pairingSecret:o.pairingSecret}}function ED(){const t=xm.utils.randomSecretKey(),a=xm.getPublicKey(t);return{secretKey:t,publicKey:a}}function CD(t){return{secretKey:jr(t.secretKey),publicKey:jr(t.publicKey)}}function TD(){return e1(T1)}function ND(t){bn(t.pairingSecret,km,"pairingSecret"),bn(t.sessionSalt,T1,"sessionSalt"),bn(t.daemonPublicKey,$b,"daemonPublicKey"),bn(t.devicePublicKey,$b,"devicePublicKey");const a=xm.getSharedSecret(t.localSecretKey,t.peerPublicKey);bn(a,oD,"sharedSecret");const o=Bn(t.pairingSecret,a),s=Bn(rn(dD),Uint8Array.of(0),Hc(t.ids.protocolVersion),gc(rn(t.ids.daemonId)),gc(rn(t.ids.deviceId)),t.daemonPublicKey,t.devicePublicKey,t.sessionSalt),l=Lo(s),u=Bn(rn(N1),t.sessionSalt),f=ci(Lo,o,u,Bn(rn(lD),Uint8Array.of(0),l),Xa),m=ci(Lo,o,u,Bn(rn(cD),Uint8Array.of(0),l),Xa),g=RD(l,t.ids);return{d2p:f,p2d:m,sas:g,transcriptHash:l}}function jD(t){return ND({localSecretKey:t.deviceSecretKey,peerPublicKey:t.daemonPublicKey,daemonPublicKey:t.daemonPublicKey,devicePublicKey:t.devicePublicKey,pairingSecret:t.pairingSecret,sessionSalt:t.sessionSalt,ids:t.ids})}function AD(){return e1(Sm)}function _D(t){bn(t.rootD2p,Xa,"rootD2p"),bn(t.rootP2d,Xa,"rootP2d"),bn(t.phoneConnSalt,Sm,"phoneConnSalt"),bn(t.daemonConnSalt,Sm,"daemonConnSalt");const a=Bn(rn(pD),t.phoneConnSalt,t.daemonConnSalt),o=Bn(Uint8Array.of(0),Hc(t.ids.protocolVersion),gc(rn(t.ids.daemonId)),gc(rn(t.ids.deviceId)),t.phoneConnSalt,t.daemonConnSalt),s=ci(Lo,t.rootD2p,a,Bn(rn(fD),o),Xa),l=ci(Lo,t.rootP2d,a,Bn(rn(mD),o),Xa);return{d2p:s,p2d:l}}function RD(t,a){bn(t,32,"transcriptHash");const o=ci(Lo,t,rn(N1),Bn(rn(uD),Uint8Array.of(0),Hc(a.protocolVersion)),4);return(up(o)%1e6).toString().padStart(iD,"0")}function A1(t,a,o){if(!Number.isInteger(a)||a<0||a>4294967295)throw new RangeError(`streamId out of range: ${a}`);const s=new Uint8Array(sD);return s[0]=t==="d2p"?hD:gD,s.set(Hc(a),1),s.set(wD(o),8),s}function _1(t){if(t.length<j1)throw new RangeError("headerBytes too short");return up(t,vD)}function Uc(t){if(t.length<j1)throw new RangeError("headerBytes too short");return up(t,yD)}function OD(t){bn(t.key,Xa,"key");const a=_1(t.headerBytes),o=Uc(t.headerBytes),s=A1(t.direction,a,o);return n1(t.key,s,t.headerBytes).encrypt(t.payload)}function DD(t){bn(t.key,Xa,"key");const a=_1(t.headerBytes),o=Uc(t.headerBytes),s=A1(t.direction,a,o);return n1(t.key,s,t.headerBytes).decrypt(t.ciphertext)}function MD(t){return{direction:t,nextSeq:0}}function LD(t){return{direction:t,lastSeq:-1}}function zD(t,a){const o=Uc(a.headerBytes);if(o!==t.nextSeq)throw new RangeError(`header seq ${o} does not match sealer.nextSeq ${t.nextSeq}`);const s=OD({key:a.key,direction:t.direction,headerBytes:a.headerBytes,payload:a.payload}),l=t.nextSeq;return t.nextSeq+=1,{seq:l,ciphertext:s}}function HD(t,a){if(a.seq!==t.lastSeq+1)throw new RangeError("out-of-order or replayed frame");if(Uc(a.headerBytes)!==a.seq)throw new RangeError("out-of-order or replayed frame");const s=DD({key:a.key,direction:t.direction,headerBytes:a.headerBytes,ciphertext:a.ciphertext});return t.lastSeq=a.seq,s}const UD=(t,a)=>{const o=new URL(t);if(o.protocol==="https:"?o.protocol="wss:":o.protocol==="http:"&&(o.protocol="ws:"),o.protocol!=="wss:"&&o.protocol!=="ws:")throw new Error(`unsupported pairing gateway protocol: ${o.protocol}`);return`${o.toString().replace(/\/+$/,"")}/relay/pair?daemonId=${encodeURIComponent(a)}`},BD=t=>typeof t=="object"&&t!==null&&typeof t.t=="string",WD=2e4,ID=1e4;function qD(t,a,o){const s=o.generateKeyPair??ED,l=o.generateSalt??TD,u=o.heartbeatMs??WD,f=o.heartbeatDeadlineMs??ID;let m="idle",g=null,p=null,b=null,v=!1,k=null,E=null,S=null,w=null,C=null,T=null,N="",j="",A=null;const O=V=>{m=V,a.onPhase(V)},D=()=>{E!==null&&(clearTimeout(E),E=null)},L=()=>{k!==null&&(clearInterval(k),k=null),D()},P=V=>{L(),k=setInterval(()=>{if(!v){try{V.send(Zx)}catch{}E===null&&(E=setTimeout(()=>{if(E=null,!v){try{V.close()}catch{}q()}},f))}},u)},J=()=>{S?.secretKey.fill(0),w?.fill(0),C&&(C.d2p.fill(0),C.p2d.fill(0),C.transcriptHash.fill(0)),S=null,w=null,C=null},Q=V=>{if(!v){v=!0,L(),J();try{b?.close()}catch{}b=null,A?.(V)}},$=(V,R)=>{if(v)return;const B={code:V,message:R};O(V==="rejected"?"rejected":V==="expired"?"expired":"error"),a.onFailure(B),Q({ok:!1,failure:B})},F=V=>{if(m!=="connecting"&&m!=="handshaking")return;if(V.protocolVersion!==Nn){$("protocol_version",`unsupported pairing protocol version ${V.protocolVersion}`);return}if(!S||!w){$("pair_ack_invalid","pair-ack arrived before the phone keypair was ready");return}let R;try{R=ui(V.daemonPublicKey)}catch{$("pair_ack_invalid","pair-ack daemonPublicKey is not valid base64url");return}const B={daemonId:V.daemonId,deviceId:V.deviceId,protocolVersion:V.protocolVersion};try{C=jD({deviceSecretKey:S.secretKey,daemonPublicKey:R,devicePublicKey:S.publicKey,pairingSecret:W,sessionSalt:w,ids:B})}catch(se){$("pair_ack_invalid",`handshake derivation failed: ${se.message}`);return}p=V.deviceId,j=V.daemonId,T=V.daemonPublicKey,g=C.sas,O("awaiting_confirm"),a.onSas(g)},ne=()=>{if(!v){if(!C||!S||!p){$("pair_ack_invalid","cannot mint before the handshake produced a session");return}O("minting"),o.mintSession(N,{daemonId:j,deviceId:p}).then(()=>{if(v||!S||!T||!p||!C)return;const V={v:2,gatewayUrl:N,daemonId:j,deviceId:p,deviceKeyPair:CD(S),daemonPublicKey:T,rootKeys:{d2p:jr(C.d2p),p2d:jr(C.p2d)},protocolVersion:Nn,pairedAt:(o.now??Date.now)()};o.store.save(V);const R=p;O("paired"),Q({ok:!0,deviceId:R})}).catch(V=>{V.status===403?$("mint_forbidden","gateway refused to mint a device session (not confirmed)"):$("mint_failed",`device session mint failed: ${V.message??"unknown"}`)})}},Z=V=>{if(m==="awaiting_confirm"){if(!C||!S||!p||V.deviceId!==p){$("pair_ack_invalid","confirmed for an unexpected device");return}ne()}},q=()=>{if(!v){if(m==="awaiting_confirm"){ne();return}m!=="minting"&&$("socket_closed","pairing socket closed before the device was paired")}},M=V=>{if(v||typeof V!="string")return;if(V===Qx){D();return}let R;try{R=JSON.parse(V)}catch{return}if(BD(R))switch(m==="connecting"&&R.t==="pair-ack"&&O("handshaking"),R.t){case"pair-ack":F(R);break;case"confirmed":Z(R);break;case"rejected":{const B=R.reason;B==="expired"||B==="pairing_expired"?$("expired","pairing code expired; generate a new pairing code"):$("rejected",B??"pairing rejected at the desktop")}break}},U=SD(t),W=ui(U.pairingSecret);return N=U.gatewayUrl,j=U.daemonId,{get phase(){return m},get sas(){return g},get deviceId(){return p},start:()=>v?Promise.resolve({ok:!1,failure:{code:"cancelled",message:"already settled"}}):new Promise(V=>{A=V,S=s(),w=l(),O("connecting");const R=UD(U.gatewayUrl,U.daemonId);try{b=o.openSocket(R)}catch(B){$("socket_closed",`failed to open pairing socket: ${B.message}`);return}b.addEventListener("open",()=>{if(v||!b||!S||!w)return;P(b);const B={t:"hello",devicePublicKey:jr(S.publicKey),sessionSalt:jr(w),...o.proposedName?{proposedName:o.proposedName}:{},...o.boundJti?{boundJti:o.boundJti}:{}};b?.send(JSON.stringify(B))}),b.addEventListener("message",B=>{M(B.data)}),b.addEventListener("close",q),b.addEventListener("error",q)}),cancel:()=>{v||(O("rejected"),$("cancelled","pairing cancelled"))},dispose:()=>{v?J():Q({ok:!1,failure:{code:"cancelled",message:"disposed"}})}}}const PD=t=>async(a,o)=>{const s=await t(`${a}/pair/session`,{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw Object.assign(new Error(`mint failed: ${s.status}`),{status:s.status})};function FD(t){const a=t.fetchImpl??globalThis.fetch.bind(globalThis),o=t.gatewayBaseUrl??window.location.origin,s=t.redirect??(S=>window.location.assign(S)),l=t.createPairing??qD,u=t.mintSession??PD(a);let f=t.authProvider??"github",m="login",g=null;const p=S=>{m=S,t.onPhase?.(S)},b=S=>t.store.load(o,S),v=async S=>{S&&(f=S);const w=await a(`${o}/pair/machines`,{credentials:"include"});if(w.status===401){const N=encodeURIComponent(window.location.pathname+window.location.search);return p("login"),s(`${o}/auth/${f}?redirect=${N}`),{daemons:[],selfDeviceId:null}}if(!w.ok)throw new Error(`Failed to load machines: ${w.status}`);const C=await w.json(),T=C.daemons.map(N=>({id:N.id,name:N.name,lastSeen:N.lastSeen,revoked:N.revoked,online:N.online}));return p("machines"),{daemons:T,selfDeviceId:C.self.deviceId}},k=S=>{p("pairing");const C=l(S,{onPhase:T=>t.onPairingPhase?.(T),onSas:T=>t.onPairingSas?.(T),onFailure:T=>t.onPairingFailure?.(T)},{openSocket:(T,N)=>new WebSocket(T,N),store:t.store,mintSession:u,...t.proposedName?{proposedName:t.proposedName}:{},...t.boundJti?{boundJti:t.boundJti}:{}});return g=C,C.start()};return{get phase(){return m},get pairingClient(){return g},loadMachines:v,selectDaemon:async(S,w)=>{g=null;const C=b(S);if(C&&!w){const A=await t.connectTransport({daemonId:S,deviceId:C.deviceId,stored:C});return A.ok?(p("connected"),A):(!A.ok&&A.failure.code==="relay_revoked"&&t.store.clear(o,S),p("selecting"),A)}if(p("selecting"),!w)return{ok:!1,failure:{code:"needs_pairing",message:"this device is not paired with that computer — enter its pairing code first"}};const T=await k(w);if(!T.ok)return T;const N=b(S),j=await t.connectTransport({daemonId:S,deviceId:T.deviceId,stored:N});return j.ok?(p("connected"),j):(j.failure.code==="relay_revoked"&&t.store.clear(o,S),p("selecting"),j)}}}const R1="0123456789ABCDEFGHJKMNPQRSTVWXYZ",KD=12,YD="hive-remote-pairing-code-v1:",$D=t=>{const a=t.trim().toUpperCase().replace(/[\s-]+/g,"").replace(/O/g,"0").replace(/[IL]/g,"1");if(a.length!==KD)return null;for(const o of a)if(!R1.includes(o))return null;return a},VD=new TextEncoder,GD=t=>new URL(t).origin,XD=async t=>{const a=$D(t.code);if(!a)return null;const o=await crypto.subtle.digest("SHA-256",VD.encode(`${YD}${a}`));return kD({v:Nn,gatewayUrl:GD(t.gatewayUrl),daemonId:t.daemonId,pairingSecret:jr(new Uint8Array(o))})},ZD="hive.device-session.v2",QD="hive.device-session.v1",$f=(t,a)=>`${ZD}:${t}:${a}`,Vb=(t,a)=>`${QD}:${t}:${a}`,JD=t=>{if(typeof t!="object"||t===null)return!1;const a=t;if(a.v!==2||typeof a.gatewayUrl!="string"||typeof a.daemonId!="string"||typeof a.deviceId!="string"||typeof a.daemonPublicKey!="string"||typeof a.protocolVersion!="number"||typeof a.pairedAt!="number")return!1;const o=a.deviceKeyPair;if(typeof o!="object"||o===null)return!1;const s=o;if(typeof s.secretKey!="string"||typeof s.publicKey!="string")return!1;const l=a.rootKeys;if(typeof l!="object"||l===null)return!1;const u=l;return typeof u.d2p=="string"&&typeof u.p2d=="string"},eM=(t=globalThis.localStorage??null)=>({load:(a,o)=>{if(!t)return null;t.getItem(Vb(a,o))!==null&&t.removeItem(Vb(a,o));const s=t.getItem($f(a,o));if(s===null)return null;try{const l=JSON.parse(s);return JD(l)?l:null}catch{return null}},save:a=>{t&&t.setItem($f(a.gatewayUrl,a.daemonId),JSON.stringify(a))},clear:(a,o)=>{t&&t.removeItem($f(a,o))}}),O1=()=>{const t=window.location.hostname;return!(t==="127.0.0.1"||t==="localhost"||t==="[::1]"||t==="::1")},D1=t=>{switch(t){case"rejected":case"cancelled":return"pairing.failed.rejected";case"expired":return"pairing.failed.expired";case"mint_forbidden":return"pairing.failed.mintForbidden";case"protocol_version":return"pairing.failed.version";case"socket_closed":case"pair_ack_invalid":case"mint_failed":return"pairing.failed.socket";default:return null}},tM=(t,a)=>{const o=D1(a);if(o)return o;switch(t){case"connecting":return"pairing.connecting";case"handshaking":case"minting":return"pairing.handshaking";case"awaiting_confirm":return null;case"paired":return"pairing.paired";case"rejected":return"pairing.failed.rejected";case"expired":return"pairing.failed.expired";case"error":return"pairing.failed.socket";default:return null}},nM=t=>t==="select_failed"?"connect.error.selectFailed":t==="invalid_code"?"connect.error.invalidCode":t==="relay_revoked"?"connect.machines.revokedHint":null,aM=t=>{const a=Math.floor((Date.now()-t)/1e3);if(a<60)return null;const o=Math.floor(a/60);if(o<60)return`${o}m`;const s=Math.floor(o/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`},rM={O:"0",I:"1",L:"1"},oM=t=>{const a=t.toUpperCase();let o="";for(const l of a){const u=rM[l]??l;if(R1.includes(u)&&(o+=u,o.length===12))break}const s=[];for(let l=0;l<o.length;l+=4)s.push(o.slice(l,l+4));return s.join("-")},sM=t=>t==="minting"||t==="paired",ql=({children:t,className:a="",testId:o})=>c.jsx("div",{"data-testid":o,className:`connect-screen flex min-h-full flex-col p-6 ${a}`,children:t}),Fs=({primary:t,children:a,disabled:o,onClick:s,testId:l,type:u="button"})=>c.jsx("button",{type:u,"data-testid":l,disabled:o,onClick:s,className:"flex w-full items-center justify-center rounded-lg px-4 text-sm font-semibold transition-colors",style:{minHeight:"44px",background:t?"var(--accent)":"var(--bg-2)",color:t?"#ffffff":"var(--text-secondary)",border:`1px solid ${t?"var(--accent)":"var(--border-bright)"}`,opacity:o?.4:1,cursor:o?"not-allowed":"pointer"},children:a}),iM=({flow:t,phase:a,machines:o,selectedMachineId:s,pairingPhase:l,pairingFailureCode:u,connectError:f,sas:m,isSigningIn:g=!1,pendingMachineId:p,loginError:b=!1,isGatewayBundle:v=!1,onRefreshMachines:k,onSelectProvider:E,onSelectMachine:S,onSubmitCode:w,onCancelPairing:C,onGoBack:T})=>{const{t:N}=be(),[j,A]=y.useState(""),O=y.useRef(!1),D=tM(l,u),L=nM(f),P=D1(u)!=null,J=sM(l),Q=m!=null&&m.length>0&&(l==="awaiting_confirm"||J),$=q=>{const M=oM(q);A(M),M.replace(/-/g,"").length===12&&s&&!O.current&&(O.current=!0,w(s,M.trim()))},F=j.replace(/-/g,"").length===12,ne=!!s&&F,Z=v?"/brand/icon-192.png":"/logo.png";if(a==="login")return c.jsxs(ql,{testId:"connect-login",className:"justify-center gap-6",children:[c.jsxs("div",{className:"mb-2 flex flex-col items-center gap-3 text-center",children:[c.jsx("img",{src:Z,width:72,height:72,alt:"",style:{filter:"drop-shadow(0 8px 28px rgba(51,88,212,.38))"}}),c.jsx("span",{className:"text-2xl font-bold tracking-tight",style:{color:"var(--text-primary)"},children:"Hive"})]}),c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"text-xl font-semibold text-pri",children:N("connect.login.heading")}),c.jsx("p",{className:"mt-2 text-sm text-ter",children:N("connect.login.subtitle")})]}),b?c.jsx("p",{"data-testid":"connect-login-error",className:"rounded-lg px-3 py-2 text-center text-sm",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",color:"var(--status-red)"},children:N("connect.login.failed")}):null,c.jsx("div",{className:"flex flex-col gap-3",children:g?c.jsx("div",{className:"flex items-center justify-center text-sm text-ter",style:{minHeight:"44px"},children:N("connect.login.signingIn")}):c.jsxs(c.Fragment,{children:[c.jsx(Fs,{primary:!0,testId:"connect-login-github",onClick:()=>E("github"),children:N("connect.login.github")}),c.jsx(Fs,{testId:"connect-login-google",onClick:()=>E("google"),children:N("connect.login.google")})]})})]});if(a==="machines"){const q=p!=null;return c.jsxs(ql,{testId:"connect-machines",className:"gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("img",{src:Z,width:20,height:20,alt:"",className:"shrink-0"}),c.jsx("span",{className:"text-sm font-semibold text-sec",children:"Hive"})]}),c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("h1",{className:"text-xl font-semibold text-pri",children:N("connect.machines.heading")}),k?c.jsx("button",{type:"button","aria-label":N("common.refresh"),"data-testid":"connect-machines-refresh",onClick:k,className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-sec",style:{background:"var(--bg-2)",border:"1px solid var(--border-bright)"},children:c.jsx(Rm,{size:16,"aria-hidden":!0})}):null]}),L?c.jsx("p",{"data-testid":"connect-error",className:"rounded-lg px-3 py-2 text-sm",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",color:"var(--status-red)"},children:N(L)}):null,o.length===0?c.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 px-4 text-center",children:[c.jsx("span",{className:"flex h-16 w-16 items-center justify-center rounded-2xl",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent-hover, var(--accent))"},"aria-hidden":!0,children:c.jsx(sf,{size:28})}),c.jsx("p",{"data-testid":"connect-machines-empty",className:"max-w-[280px] text-sm text-ter",children:N("connect.machines.empty")}),c.jsx("div",{className:"flex w-full max-w-[320px] flex-col gap-3 pt-2",children:c.jsx(Fs,{testId:"connect-machines-back",...T?{onClick:T}:{},children:N("connect.machines.back")})})]}):c.jsx("ul",{className:"flex flex-col gap-2.5",children:o.map(M=>{const U=p===M.id,W=!M.online||M.revoked||q;let G,V="var(--text-tertiary)";if(M.revoked)G=N("connect.machines.revoked"),V="var(--status-red)";else if(M.online)U?(G=N("connect.machines.connecting"),V="var(--text-secondary)"):(G=N("connect.machines.online"),V="var(--status-green)");else{const B=M.lastSeen!=null?aM(M.lastSeen):null;G=B!=null?N("connect.machines.lastSeen",{ago:B}):N("connect.machines.offline")}const R=M.revoked?"var(--status-red)":M.online?"var(--status-green)":"var(--text-tertiary)";return c.jsx("li",{children:c.jsxs("button",{type:"button","data-testid":`connect-machine-${M.id}`,className:"flex w-full items-center gap-3 rounded-xl border px-3.5 py-3 text-left transition-colors",style:{minHeight:"64px",borderColor:"var(--border-bright)",background:U?"var(--bg-2)":"var(--bg-1)",opacity:W&&!U?.55:1,cursor:W?"not-allowed":"pointer"},disabled:W,"aria-disabled":W,onClick:()=>S(M.id),children:[c.jsxs("span",{className:"relative shrink-0","aria-hidden":!0,children:[c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-lg",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent-hover, var(--accent))"},children:c.jsx(sf,{size:20})}),c.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 h-3 w-3 rounded-full border-2",style:{background:R,borderColor:"var(--bg-1)"}})]}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsx("span",{className:"block truncate text-[15px] font-medium text-pri",children:M.name}),c.jsx("span",{className:"mt-0.5 block text-xs",style:{color:V},children:G})]}),U?c.jsx("span",{"aria-hidden":!0,className:"h-4 w-4 shrink-0 animate-spin rounded-full border-2",style:{borderColor:"var(--border-bright)",borderTopColor:"var(--accent)"}}):W?null:c.jsx(wc,{size:18,className:"shrink-0 text-ter","aria-hidden":!0})]})},M.id)})}),v?c.jsx("div",{className:"mt-auto pt-4 text-center",children:c.jsx("a",{href:"/machines",className:"text-xs underline-offset-2 hover:underline",style:{color:"var(--text-tertiary)"},children:N("connect.machines.manageDevices")})}):null]})}if(a==="selecting"){const q=o.find(M=>M.id===s);return c.jsxs(ql,{testId:"connect-pair-guide",className:"gap-4",children:[c.jsxs("button",{type:"button",className:"-ml-2 flex items-center gap-1 self-start rounded-md px-2 text-sm text-sec",style:{minHeight:"44px"},onClick:T,children:[c.jsx(MS,{size:16,"aria-hidden":!0}),N("connect.pair.back")]}),c.jsxs("div",{children:[c.jsx("h1",{className:"text-xl font-semibold text-pri",children:N("connect.pair.guideHeading")}),q?c.jsxs("p",{className:"mt-1 flex items-center gap-1.5 text-sm text-ter",children:[c.jsx(sf,{size:14,"aria-hidden":!0,className:"shrink-0"}),c.jsx("span",{className:"truncate",children:q.name})]}):null]}),L?c.jsx("p",{"data-testid":"connect-error",className:"rounded-lg px-3 py-2 text-sm",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",color:"var(--status-red)"},children:N(L)}):null,c.jsx("ol",{className:"flex flex-col gap-3",children:["connect.pair.guideStep1","connect.pair.guideStep2","connect.pair.guideStep3"].map((M,U)=>c.jsxs("li",{className:"flex items-start gap-3 text-sm text-sec",children:[c.jsx("span",{"aria-hidden":!0,className:"mt-px flex h-[22px] w-[22px] shrink-0 items-center justify-center rounded-lg text-xs font-semibold",style:{background:"color-mix(in oklab, var(--accent) 13%, transparent)",border:"1px solid color-mix(in oklab, var(--accent) 34%, transparent)",color:"var(--accent-hover)"},children:U+1}),c.jsx("span",{className:"min-w-0 leading-relaxed",children:N(M)})]},M))}),c.jsxs("label",{className:"flex flex-col gap-2 text-xs uppercase tracking-wider text-ter",children:[N("connect.pair.qrLabel"),c.jsx("input",{type:"text","data-testid":"connect-code-input",className:"input mono text-center",inputMode:"text",autoCapitalize:"characters",autoCorrect:"off",autoComplete:"off",spellCheck:!1,placeholder:"XXXX-XXXX-XXXX",maxLength:14,value:j,onChange:M=>{O.current=!1,$(M.target.value)},style:{fontSize:"18px",letterSpacing:"0.12em",minHeight:"52px"}})]}),c.jsx(Fs,{primary:!0,testId:"connect-code-submit",disabled:!ne,onClick:()=>{s&&!O.current&&(O.current=!0,w(s,j.trim()))},children:N("connect.pair.submit")})]})}if(a==="pairing"){const q=P;return c.jsxs(ql,{testId:"connect-pairing",className:"justify-center gap-6",children:[Q&&!q?c.jsxs("div",{className:"flex flex-col items-center gap-4",children:[c.jsx("div",{"data-testid":"connect-pairing-sas",className:"mono rounded-2xl border px-7 py-5 font-bold text-pri","aria-live":"polite",style:{fontSize:"2.5rem",letterSpacing:"0.25em",paddingRight:"calc(1.75rem - 0.25em)",background:"var(--bg-1)",borderColor:"var(--border-bright)"},children:m}),c.jsx("p",{className:"text-center text-sm text-ter",style:{maxWidth:"280px"},children:N(J?"connect.pair.finalizing":"connect.pair.sasInstruction")}),J?c.jsx("span",{"aria-hidden":!0,className:"h-5 w-5 animate-spin rounded-full border-2",style:{borderColor:"var(--border-bright)",borderTopColor:"var(--accent)"}}):null]}):null,D&&!Q&&!q?c.jsx("p",{"data-testid":"connect-pairing-phase",className:"text-center text-sm text-ter",children:N(D)}):null,q&&D?c.jsx("p",{"data-testid":"connect-pairing-phase",className:"text-center text-sm",style:{color:"var(--status-red)"},children:N(D)}):null,J?null:c.jsx("div",{className:"flex flex-col gap-3",children:c.jsx(Fs,{primary:q,testId:"connect-pairing-cancel",onClick:()=>{A(""),O.current=!1,C?C():t.pairingClient?.cancel()},children:N(q?"connect.pair.startOver":"common.cancel")})})]})}return null},lM=()=>{if(typeof navigator>"u")return"Phone";const t=navigator.userAgent??"";let a="Phone";/iPad/.test(t)?a="iPad":/iPhone/.test(t)?a="iPhone":/Android/.test(t)&&(a="Android");let o="Browser";return/EdgA?\//.test(t)?o="Edge":/SamsungBrowser\//.test(t)?o="Samsung":/OPR\/|OPT\//.test(t)?o="Opera":/Firefox\//.test(t)?o="Firefox":/Chrome\//.test(t)?o="Chrome":/Safari\//.test(t)&&(o="Safari"),`${a} · ${o}`.slice(0,48)},cM=({children:t,connectTransport:a,createFlow:o=FD,store:s,gatewayBaseUrl:l,isGateway:u=O1})=>{const f=u(),[m,g]=y.useState("login"),[p,b]=y.useState([]),[v,k]=y.useState(null),[E,S]=y.useState(void 0),[w,C]=y.useState(null),[T,N]=y.useState(null),[j,A]=y.useState(null),[O,D]=y.useState(null),[L,P]=y.useState(!1),[J,Q]=y.useState(null),[$,F]=y.useState(!1),[ne,Z]=y.useState(!0),q=y.useMemo(()=>o({store:s??eM(),connectTransport:a,...l?{gatewayBaseUrl:l}:{},proposedName:lM(),onPhase:g,onPairingPhase:ue=>{C(ue),ue!=="error"&&ue!=="expired"&&ue!=="rejected"&&N(null)},onPairingSas:D,onPairingFailure:ue=>N(ue.code)}),[o,s,a,l]),M=y.useRef(q);M.current=q;const U=y.useRef(0),W=y.useCallback(()=>{C(null),N(null),D(null)},[]),G=y.useCallback(()=>(U.current+=1,U.current),[]),V=y.useCallback(ue=>U.current===ue,[]);y.useEffect(()=>{let ue=!1;return M.current.loadMachines().then(({daemons:le,selfDeviceId:ie})=>{ue||(b(le),k(ie))}).catch(()=>{}).finally(()=>{ue||Z(!1)}),()=>{ue=!0}},[]);const R=y.useCallback(()=>{const ue=G();A(null),W(),P(!0),M.current.loadMachines().then(({daemons:le,selfDeviceId:ie})=>{V(ue)&&(b(le),k(ie))}).finally(()=>{V(ue)&&P(!1)})},[W,V,G]),B=y.useCallback(ue=>{const le=G();A(null),W(),F(!1),P(!0),M.current.loadMachines(ue).then(({daemons:ie,selfDeviceId:xe})=>{V(le)&&(b(ie),k(xe))}).catch(()=>{V(le)&&F(!0)}).finally(()=>{V(le)&&P(!1)})},[W,V,G]),se=y.useCallback(ue=>{const le=G();S(ue),A(null),W(),Q(ue),(async()=>{const ie=await M.current.selectDaemon(ue);V(le)&&(Q(null),!ie.ok&&ie.failure.code==="select_failed"&&A("select_failed"),!ie.ok&&ie.failure.code==="relay_revoked"&&A("relay_revoked"))})()},[W,V,G]),re=y.useCallback((ue,le)=>{const ie=G();A(null),W(),(async()=>{const xe=await XD({code:le,daemonId:ue,gatewayUrl:l??window.location.origin});if(!V(ie))return;if(!xe){A("invalid_code");return}const Ne=await M.current.selectDaemon(ue,xe);V(ie)&&(!Ne.ok&&Ne.failure.code==="select_failed"&&A("select_failed"),!Ne.ok&&Ne.failure.code==="relay_revoked"&&A("relay_revoked"))})()},[W,l,V,G]),ce=y.useCallback(()=>{G(),M.current.pairingClient?.cancel(),W(),A(null),g(E?"selecting":"machines")},[W,G,E]),fe=y.useCallback(()=>{G(),A(null),W(),g("machines")},[W,G]);return m==="connected"?(typeof history<"u"&&history.replaceState(null,"","/app"),c.jsx(c.Fragment,{children:t})):ne?c.jsxs("div",{className:"connect-screen flex min-h-full flex-col items-center justify-center gap-3 p-6",children:[c.jsx("img",{src:f?"/brand/icon-192.png":"/logo.png",width:56,height:56,alt:"",className:"animate-pulse"}),c.jsx("span",{className:"sr-only","aria-live":"polite",children:"…"})]}):c.jsx(iM,{flow:q,phase:m,machines:p,selfDeviceId:v,...E?{selectedMachineId:E}:{},pairingPhase:w,pairingFailureCode:T,connectError:j,sas:O,isSigningIn:L,pendingMachineId:J,loginError:$,isGatewayBundle:f,onRefreshMachines:R,onSelectProvider:B,onSelectMachine:se,onSubmitCode:re,onCancelPairing:ce,onGoBack:fe})},uM=(t,a,o)=>t.mode==="tunnel"?c.jsx(o,{connectTransport:t.connectTransport,children:c.jsx(a,{})}):c.jsx(a,{}),Ge={Open:1,Data:2,End:3,Reset:4,Ping:5,Ack:6},vc={Http:1,Ws:2},Yt={ProtocolError:1,VersionMismatch:4},Gb={INITIAL_WINDOW:256*1024,ACK_THRESHOLD:32*1024},yc=12,Xb=0,Em=4294967295,M1=4294967295,dM=0,L1=1;class $t extends Error{code;constructor(a,o){super(a),this.name="ProtocolError",this.code=o}}const fM=new TextEncoder,mM=new TextDecoder;function z1(t){return fM.encode(t)}function Bc(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function Cm(t,a){if(!Number.isInteger(t)||t<0||t>M1)throw new RangeError(`${a} out of u32 range: ${t}`)}function H1(t){return t===Ge.Open||t===Ge.Data||t===Ge.End||t===Ge.Reset||t===Ge.Ping||t===Ge.Ack}function U1(t){return(t&-2)===0}function Zb(t){if(t.version!==Nn)throw new RangeError(`version must be ${Nn}`);if(!H1(t.kind))throw new RangeError(`unknown kind: ${t.kind}`);if(!Number.isInteger(t.flags)||t.flags<0||t.flags>65535)throw new RangeError(`flags out of u16 range: ${t.flags}`);if(t.kind===Ge.Data){if(!U1(t.flags))throw new RangeError("reserved flag bits set on Data frame")}else if(t.flags!==0)throw new RangeError("flags must be 0 on a non-Data frame");Cm(t.streamId,"streamId"),Cm(t.seq,"seq");const a=new Uint8Array(yc),o=Bc(a);return o.setUint8(0,t.version),o.setUint8(1,t.kind),o.setUint16(2,t.flags),o.setUint32(4,t.streamId),o.setUint32(8,t.seq),a}function pM(t){if(t.length<yc)throw new $t("header too short",Yt.ProtocolError);const a=Bc(t),o=a.getUint8(0);if(o!==Nn)throw new $t(`bad version ${o}`,Yt.VersionMismatch);const s=a.getUint8(1);if(!H1(s))throw new $t(`unknown kind ${s}`,Yt.ProtocolError);const l=a.getUint16(2);if(s===Ge.Data){if(!U1(l))throw new $t("reserved flag bits set on Data frame",Yt.ProtocolError)}else if(l!==0)throw new $t("flags must be 0 on a non-Data frame",Yt.ProtocolError);const u=a.getUint32(4),f=a.getUint32(8);return{version:o,kind:s,flags:l,streamId:u,seq:f}}function Qb(t){let a;if(t.transport===vc.Http){if(!t.http)throw new RangeError("http meta required for Http transport");a=t.http}else if(t.transport===vc.Ws){if(!t.ws)throw new RangeError("ws meta required for Ws transport");a=t.ws}else throw new RangeError(`unknown transport: ${t.transport}`);const o=z1(JSON.stringify(a));if(o.length>65535)throw new RangeError("open meta too large");const s=new Uint8Array(3+o.length);return s[0]=t.transport,Bc(s).setUint16(1,o.length),s.set(o,3),s}function hM(t){if(!Array.isArray(t))return!1;for(const a of t)if(!Array.isArray(a)||a.length!==2||typeof a[0]!="string"||typeof a[1]!="string")return!1;return!0}const Wc={ConnSalt:1,Hello:2},Tm={daemon:1,device:2},gM=34;function vM(t){if(t.salt.length!==32)throw new RangeError(`conn salt must be 32 bytes, got ${t.salt.length}`);const a=new Uint8Array(34);return a[0]=Wc.ConnSalt,a[1]=Tm.device,a.set(t.salt,2),a}function yM(t){if(t.length!==gM)throw new $t("conn salt must be 34 bytes",Yt.ProtocolError);if(t[0]!==Wc.ConnSalt)throw new $t("not a ConnSalt frame",Yt.ProtocolError);const a=t[1],o=a===Tm.daemon?"daemon":a===Tm.device?"device":null;if(o===null)throw new $t("bad conn salt role",Yt.ProtocolError);return{role:o,salt:t.slice(2)}}function bM(t){return t.length>=1&&t[0]===Wc.ConnSalt}function wM(t){if(t.role!=="daemon"&&t.role!=="device")throw new RangeError(`bad role: ${t.role}`);const a=z1(JSON.stringify(t)),o=new Uint8Array(1+a.length);return o[0]=Wc.Hello,o.set(a,1),o}function xM(t){Cm(t,"cumulativeBytes");const a=new Uint8Array(4);return Bc(a).setUint32(0,t),a}function kM(t,a){const o=new Uint8Array(1+t.length);return o[0]=a?1:0,o.set(t,1),o}function SM(t){if(t.length<1)throw new $t("ws message too short",Yt.ProtocolError);const a=t[0];if(a!==0&&a!==1)throw new $t("bad ws isText flag",Yt.ProtocolError);return{data:t.slice(1),isText:a===1}}function Jb(t){const a=new Uint8Array(1+t.length);return a[0]=L1,a.set(t,1),a}function EM(t){if(t.length<1)throw new $t("http data too short",Yt.ProtocolError);const a=t[0];if(a===dM){let o;try{o=JSON.parse(mM.decode(t.subarray(1)))}catch{throw new $t("http head not JSON",Yt.ProtocolError)}const s=o;if(typeof s.status!="number"||!hM(s.headers))throw new $t("bad http head",Yt.ProtocolError);return{kind:"head",head:{status:s.status,headers:s.headers}}}if(a===L1)return{kind:"body",data:t.slice(1)};throw new $t(`unknown http disc ${a}`,Yt.ProtocolError)}function e0(t){let a=1;return()=>{a===Em&&(a+=2);const o=a;if(a+=2,a>M1)throw new RangeError("stream id space exhausted; re-handshake required");return o}}const CM={ok:!0};function t0(t=Gb.INITIAL_WINDOW,a=Gb.ACK_THRESHOLD){let o=0,s=0,l=0,u=0;const f=()=>o-s,m=()=>f()>=t;return{trySend(g){return f()+g>t?{ok:!1,reason:"WindowExhausted"}:(o+=g,CM)},applyAck(g){const p=m();return g<=s?{resumed:!1}:(s=Math.min(g,o),{resumed:p&&!m()})},onConsume(g){return l+=g,l-u>=a?(u=l,{ackCumulative:l}):null},flushAck(){return u=l,{ackCumulative:l}},isPaused:()=>m()}}const TM=1,Vf=256*1024,Nm=new TextEncoder,NM=new TextDecoder,jM=t=>{let a=0;for(const l of t)a+=l.length;const o=new Uint8Array(a);let s=0;for(const l of t)o.set(l,s),s+=l.length;return o},AM=t=>{if(typeof t=="string")return{bytes:Nm.encode(t),isText:!0};if(t instanceof Uint8Array)return{bytes:t,isText:!1};if(t instanceof ArrayBuffer)return{bytes:new Uint8Array(t),isText:!1};const a=t;return{bytes:new Uint8Array(a.buffer,a.byteOffset,a.byteLength),isText:!1}},_M=t=>{const a=t.generateConnSalt??AD;let o=null,s=null,l=null,u=null,f=null,m=e0();const g=new Map,p=(j,A)=>{if(j.length!==A.length)return!1;for(let O=0;O<j.length;O++)if(j[O]!==A[O])return!1;return!0},b=(j,A,O,D=0)=>{if(!s||!o)throw new Error("frame-mux: seal before channel handshake complete");const L=Zb({version:Nn,kind:j,flags:D,streamId:A,seq:s.nextSeq});t.onSeal?.({key:o.p2d,direction:"p2d",headerBytes:L});const{ciphertext:P}=zD(s,{key:o.p2d,headerBytes:L,payload:O}),J=new Uint8Array(L.length+P.length);return J.set(L,0),J.set(P,L.length),J},v=()=>{t.send(b(Ge.Data,Xb,wM({protocolVersion:Nn,role:"device",daemonId:t.daemonId,deviceId:t.deviceId})))},k=j=>{u&&(f&&p(f,j)||(o=_D({rootD2p:t.roots.d2p,rootP2d:t.roots.p2d,phoneConnSalt:u,daemonConnSalt:j,ids:{daemonId:t.daemonId,deviceId:t.deviceId,protocolVersion:Nn}}),s=MD("p2d"),l=LD("d2p"),f=Uint8Array.from(j),v(),t.onReady?.()))},E=(j,A)=>{t.send(b(Ge.Ack,j,xM(A)))},S=(j,A)=>{if(!o)return Promise.reject(new Error("tunnel: channel not ready"));const O=m(),D=(A?.method??"GET").toUpperCase(),L=[];A?.headers&&new Headers(A.headers).forEach(($,F)=>{L.push([F,$])});const P=A?.body===void 0||A.body===null?void 0:RM(A.body),J=P!==void 0&&P.length>0;return new Promise((Q,$)=>{const F={kind:"http",body:[],recvFlow:t0(),resolve:Q,reject:$,settled:!1};g.set(O,F),t.send(b(Ge.Open,O,Qb({transport:vc.Http,http:{method:D,path:j,headers:L,hasBody:J}}))),J&&P?P.length<=Vf?(t.send(b(Ge.Data,O,Jb(P))),t.send(b(Ge.End,O,new Uint8Array(0)))):w(O,F,P):t.send(b(Ge.End,O,new Uint8Array(0)))})},w=async(j,A,O)=>{try{for(let D=0;D<O.length;D+=Vf){if(D>0&&t.awaitDrain&&await t.awaitDrain(),A.settled)return;t.send(b(Ge.Data,j,Jb(O.subarray(D,D+Vf))))}if(A.settled)return;t.send(b(Ge.End,j,new Uint8Array(0)))}catch(D){if(A.settled)return;A.settled=!0,g.delete(j),A.reject(D)}},C=(j,A)=>{if(A.settled)return;A.settled=!0,g.delete(j);const O=A.head,D=jM(A.body);if(!O){A.reject(new Error("tunnel: stream ended without an HTTP head"));return}let L=null;if(D.length>0){const P=new ArrayBuffer(D.length);new Uint8Array(P).set(D),L=P}A.resolve(new Response(L,{status:O.status,headers:O.headers}))};class T{OPEN=1;readyState=0;onopen=null;onmessage=null;onclose=null;onerror=null;streamId;constructor(A){this.streamId=A}send(A){if(this.readyState!==this.OPEN)return;const{bytes:O,isText:D}=AM(A);t.send(b(Ge.Data,this.streamId,kM(O,D)))}close(A,O){if(this.readyState===3)return;const D=this.readyState===this.OPEN;this.readyState=3,D&&t.send(b(Ge.End,this.streamId,new Uint8Array(0))),g.delete(this.streamId)}_deliver(A,O){this.onmessage&&this.onmessage({data:O?NM.decode(A):A})}_remoteClose(A,O){this.readyState!==3&&(this.readyState=3,g.delete(this.streamId),this.onclose?.(O===void 0?{code:A}:{code:A,reason:O}))}}return{beginChannel(){u=a(),o=null,s=null,l=null,f=null,this.resetAll("rekey"),m=e0();const j=Zb({version:Nn,kind:Ge.Data,flags:0,streamId:Em,seq:0}),A=vM({salt:u}),O=new Uint8Array(j.length+A.length);O.set(j,0),O.set(A,j.length),t.send(O)},onFrame(j){const A=j.subarray(0,yc),O=j.subarray(yc),D=pM(A);if(D.streamId===Em&&bM(O)){const{role:J,salt:Q}=yM(O);J==="daemon"&&k(Q);return}if(!l||!o)return;const L=HD(l,{key:o.d2p,headerBytes:A,ciphertext:O,seq:D.seq});if(D.streamId===Xb)return;const P=g.get(D.streamId);if(P){if(P.kind==="http"){if(D.kind===Ge.Reset){P.settled||(P.settled=!0,g.delete(D.streamId),P.reject(new Error("tunnel: HTTP stream reset by daemon")));return}if(D.kind===Ge.Data){const J=EM(L);if(J.kind==="head")P.head=J.head;else{P.body.push(J.data);const Q=P.recvFlow.onConsume(J.data.length);Q&&E(D.streamId,Q.ackCumulative)}(D.flags&TM)!==0&&C(D.streamId,P);return}if(D.kind===Ge.End){C(D.streamId,P);return}return}if(D.kind===Ge.Data){const J=SM(L),Q=P.recvFlow.onConsume(J.data.length);Q&&E(D.streamId,Q.ackCumulative),P.socket._deliver(J.data,J.isText);return}if(D.kind===Ge.End||D.kind===Ge.Reset){P.socket._remoteClose(D.kind===Ge.Reset?1011:1e3);return}}},fetch:S,openWebSocket:(j,A)=>{if(!o){const P=new T(-1);return queueMicrotask(()=>P._remoteClose(1011,"tunnel: channel not ready")),P}const O=m(),D=[];if(A)for(const[P,J]of Object.entries(A))J!==void 0&&D.push([P,String(J)]);const L=new T(O);return g.set(O,{kind:"ws",recvFlow:t0(),socket:L}),t.send(b(Ge.Open,O,Qb({transport:vc.Ws,ws:D.length>0?{path:j,query:D}:{path:j}}))),queueMicrotask(()=>{L.readyState===0&&(L.readyState=L.OPEN,L.onopen?.())}),L},resetAll(j){for(const[A,O]of[...g.entries()])g.delete(A),O.kind==="http"?O.settled||(O.settled=!0,O.reject(new Error(`tunnel: connection lost (${j})`))):O.socket._remoteClose(1006,j)}}},RM=t=>typeof t=="string"?Nm.encode(t):t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Nm.encode(String(t)),OM=2e4,DM=1e4,MM=6,LM=()=>{let t=0;return{next(){t+=1;const a=Math.min(3e4,500*2**(t-1));return Math.floor(a/2+Math.random()*(a/2))},reset(){t=0}}},zM=(t,a)=>!a&&(t===Ar.Forbidden||t===Ar.Unauthorized),HM=(t,a)=>{const o=t.WebSocketImpl??WebSocket,s=t.setTimer??(($,F)=>setTimeout($,F)),l=t.clearTimer??($=>clearTimeout($)),u=t.backoff??LM(),f=t.heartbeatMs??OM,m=t.heartbeatDeadlineMs??DM,g=t.maxOfflineRetries??MM;let p=null,b=0,v=!1,k=!1,E=!1,S=0,w=null,C=null,T=null;const N=`${t.gatewayUrl}/relay?daemonId=${encodeURIComponent(t.daemonId)}`,j=()=>{T!==null&&(l(T),T=null)},A=()=>{C!==null&&(clearInterval(C),C=null),j()},O=($,F)=>{A(),C=setInterval(()=>{if($.readyState===$.OPEN){try{$.send(Zx)}catch{}T===null&&(T=s(()=>{if(T=null,!(F!==b||k)){A();try{$.close()}catch{}}},m))}},f)},D=()=>{if(k||v||E)return;const $=++b;let F=!1;const ne=new o(N,[`bearer.${t.phoneSessionToken}`]);ne.binaryType="arraybuffer",p=ne,ne.onopen=()=>{$!==b||k||(F=!0,u.reset(),S=0,O(ne,$),a.onUp())},ne.onmessage=Z=>{if($!==b||k)return;const q=Z.data;if(typeof q=="string"){if(q.startsWith(Nb)){let U;try{U=JSON.parse(q.slice(Nb.length))}catch{return}if(U.t==="revoked"){L(Ar.Revoked),a.onControl(U);return}a.onControl(U);return}q===Qx&&j();return}const M=q instanceof ArrayBuffer?new Uint8Array(q):new Uint8Array(q);a.onFrame(M)},ne.onerror=()=>{},ne.onclose=Z=>{if($!==b||k)return;A(),p=null;const q=Z.code??Ar.InternalError;if(q5(q)||zM(q,F)){L(q);return}if(q===Ar.DaemonOffline){if(S+=1,S>=g){E=!0,a.onDown({code:q,authFatal:!1,daemonOffline:!0});return}}else S=0;const M=u.next();a.onDown({code:q,authFatal:!1,nextRetryInMs:M}),w=s(()=>{w=null,D()},M)}},L=$=>{v||(v=!0,A(),w!==null&&(l(w),w=null),a.onDown({code:$,authFatal:!0}))},P=()=>{k||v||E||p!==null&&(p.readyState===p.OPEN||p.readyState===WebSocket.CONNECTING)||(w!==null&&(l(w),w=null),D())},J=()=>{typeof document<"u"&&document.visibilityState==="visible"&&P()},Q=()=>P();return typeof document<"u"&&document.addEventListener("visibilitychange",J),typeof window<"u"&&window.addEventListener("online",Q),D(),{send($){p&&p.readyState===p.OPEN&&p.send($)},bufferedAmount:()=>p&&p.readyState===p.OPEN?p.bufferedAmount:0,isOpen:()=>p!==null&&p.readyState===p.OPEN,resume(){k||v||!E||(E=!1,S=0,u.reset(),D())},close(){if(k=!0,b+=1,A(),w!==null&&(l(w),w=null),p){try{p.close()}catch{}p=null}typeof document<"u"&&document.removeEventListener("visibilitychange",J),typeof window<"u"&&window.removeEventListener("online",Q)}}};function UM(t){const a=t.session??t.persistedSession?.()??null;if(!a)throw new Error("createTunnelTransport: no session and persistedSession() returned null");let o={state:"connecting"};const s=(A,O)=>{o={state:A,...O?.reason?{reason:O.reason}:{},...O?.nextRetryInMs!==void 0?{nextRetryInMs:O.nextRetryInMs}:{},...O?.retry?{retry:O.retry}:{}},t.onStatus(o)};let l=null,u=!1,f=!1,m=!1;const g=new Set,p=t.setTimer??((A,O)=>setTimeout(A,O)),b=t.clearTimer??(A=>clearTimeout(A)),v=()=>{for(const A of g)A.timer!==null&&b(A.timer),A.resolve();g.clear()},k=A=>{for(const O of g)O.timer!==null&&b(O.timer),O.reject(new Error(`tunnel: ${A}`));g.clear()},E=()=>{u=!1},S=()=>{u||(m=!1,f=!1,u=!0,s("online"),v())},w=()=>{m=!0,u=!1,j.beginChannel()},C=4*1024*1024,T=50,N=()=>new Promise(A=>{const O=()=>{if(!l||l.bufferedAmount()<=C){A();return}p(O,T)};O()}),j=_M({roots:a.roots,daemonId:a.daemonId,deviceId:a.deviceId,send:A=>l?.send(A),onReady:S,awaitDrain:N});return l=HM({gatewayUrl:a.gatewayUrl,daemonId:a.daemonId,phoneSessionToken:a.phoneSessionToken,...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{},...t.setTimer?{setTimer:t.setTimer}:{},...t.clearTimer?{clearTimer:t.clearTimer}:{},...t.backoff?{backoff:t.backoff}:{}},{onFrame:A=>{try{j.onFrame(A)}catch{j.resetAll("frame_open_failed"),l?.close(),s("disconnected",{reason:"integrity"})}},onControl:A=>{if(A.t==="peer-offline"&&A.role==="daemon")f=!0,m=!1,E(),j.resetAll("peer_offline"),s("reconnecting");else if(A.t==="peer-online"&&A.role==="daemon"){if(u||m||!f)return;f=!1,w()}else A.t==="revoked"&&(f=!1,m=!1,E(),j.resetAll("revoked"),k(A.reason??"revoked"),s("revoked",{reason:A.reason}))},onUp:()=>{f=!1,w()},onDown:A=>{f=!1,m=!1,E(),j.resetAll(A.authFatal?"auth_fatal":A.daemonOffline?"daemon_offline":"transient"),A.authFatal?(k("auth_fatal"),s("revoked")):A.daemonOffline?(k("daemon_offline"),s("disconnected",{reason:"daemon_offline",retry:()=>l?.resume()})):s("reconnecting",A.nextRetryInMs!==void 0?{nextRetryInMs:A.nextRetryInMs}:void 0)}}),{requiresUiSession:!1,fetch:(A,O)=>j.fetch(A,O),openWebSocket:(A,O)=>j.openWebSocket(A,O),status:()=>o,ready:(A={})=>{if(u)return Promise.resolve();const O=A.timeoutMs??1e4;return new Promise((D,L)=>{const P={resolve:D,reject:L,timer:null};P.timer=p(()=>{g.delete(P),L(new Error("tunnel: channel ready timed out"))},O),g.add(P)})},dispose:()=>{f=!1,m=!1,E(),l?.close(),l=null,j.resetAll("disposed"),k("disposed")}}}const BM=t=>{const a=t.onStatus??(()=>{});return async({daemonId:o,deviceId:s,stored:l})=>{let u;try{u=await t.resolveSession({daemonId:o,deviceId:s,stored:l})}catch(m){return m.relayTokenStatus===403?{ok:!1,failure:{code:"relay_revoked",message:`device session revoked for ${o}`}}:{ok:!1,failure:{code:"select_failed",message:`could not establish a session for ${o}: ${m.message}`}}}const f=UM({session:u,onStatus:a,...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{}});try{await f.ready({timeoutMs:t.readyTimeoutMs??1e4})}catch(m){return f.dispose(),{ok:!1,failure:{code:"select_failed",message:`could not open a ready tunnel for ${o}: ${m.message}`}}}return ZT(f),{ok:!0}}},WM=(t={})=>{if(!(t.isGateway??O1)())return{mode:"direct"};if(!t.resolveSession)throw new Error("bootTransport: a gateway bundle requires resolveSession to build the tunnel");return{mode:"tunnel",connectTransport:BM({resolveSession:t.resolveSession,...t.onStatus?{onStatus:t.onStatus}:{},...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{},...t.readyTimeoutMs!==void 0?{readyTimeoutMs:t.readyTimeoutMs}:{}})}},IM=async({stored:t})=>{if(!t)throw new Error("mobileResolveSession: no persisted device session for the selected daemon");const a=window.location.origin,o=a.replace(/^http/,"ws"),s=await fetch(`${a}/pair/relay-token`,{method:"POST",credentials:"include"});if(!s.ok)throw Object.assign(new Error(`mobileResolveSession: relay-token request failed (${s.status})`),{relayTokenStatus:s.status});const{token:l}=await s.json();return{roots:{d2p:ui(t.rootKeys.d2p),p2d:ui(t.rootKeys.p2d)},deviceId:t.deviceId,daemonId:t.daemonId,gatewayUrl:o,phoneSessionToken:l}},B1=document.getElementById("root");if(!B1)throw new Error("Root element not found");const qM=WM({resolveSession:IM,onStatus:d4});cS.createRoot(B1).render(c.jsx(y.StrictMode,{children:uM(qM,I5,cM)}));P3();export{L_ as $,bc as A,a8 as B,qo as C,ZM as D,mi as E,e8 as F,p0 as G,pi as H,u0 as I,t8 as J,xc as K,Ja as L,kE as M,oE as N,zr as O,Lr as P,n8 as Q,Mr as R,IE as S,Je as T,QM as U,JM as V,v0 as W,fa as X,Va as Y,kc as Z,Ko as _,o8 as a,VM as a0,GM as a1,hN as a2,XM as a3,Js as a4,hw as a5,Rm as a6,m8 as a7,d0 as a8,i0 as a9,Jl as aa,VS as ab,p8 as ac,f0 as ad,yR as ae,d8 as af,CR as ag,Mt as ah,tx as ai,Jm as aj,f8 as ak,JA as al,_m as am,YM as an,$M as ao,MS as ap,wc as b,ve as c,s0 as d,sn as e,i8 as f,FM as g,PE as h,yt as i,c as j,Hr as k,r8 as l,Ur as m,YS as n,l8 as o,c8 as p,Po as q,y as r,KM as s,Sc as t,be as u,u8 as v,s8 as w,ga as x,Dr as y,VT as z};
81
+ `,J3=(t,a)=>{const o=hi(t),s=t.length>0&&!t.endsWith(`
82
+ `);return`${t}${s?o:""}- [ ] ${a}${o}`},e4=(t,a)=>{const o=t.split(/\r?\n/),s=o[a];if(s===void 0)return t;const l=s.match(qn);if(!l)return t;const u=(l[2]??" ").toLowerCase()==="x",f=s.replace(qn,(m,g,p,b)=>`${g}- [${u?" ":"x"}] ${b}`);return o[a]=f,o.join(hi(t))},Dx=t=>t.replace(/\r?\n/g," ").replace(/\s+/g," ").trim(),t4=(t,a,o)=>{const s=t.split(/\r?\n/),l=s[a];if(l===void 0||!l.match(qn))return t;const f=Dx(o);if(!f)return t;const m=l.replace(qn,(g,p,b)=>`${p}- [${b}] ${f}`);return s[a]=m,s.join(hi(t))},n4=(t,a)=>{const o=t.split(/\r?\n/),s=o[a];if(s===void 0)return t;const l=s.match(qn);if(!l)return t;const u=(l[1]??"").replace(/\t/g," ").length;let f=a+1;for(;f<o.length;){const m=o[f];if(m===void 0)break;const g=m.match(qn);if(!g||(g[1]??"").replace(/\t/g," ").length<=u)break;f+=1}return o.splice(a,f-a),o.join(hi(t))},a4=(t,a,o)=>{const s=Dx(o);if(!s)return t;const l=t.split(/\r?\n/),u=l[a];if(u===void 0)return t;const f=u.match(qn);if(!f)return t;const m=f[1]??"",g=m.replace(/\t/g," ").length;let p=a+1;for(;p<l.length;){const v=l[p];if(v===void 0)break;const k=v.match(qn);if(!k||(k[1]??"").replace(/\t/g," ").length<=g)break;p+=1}const b=`${m} `;return l.splice(p,0,`${b}- [ ] ${s}`),l.join(hi(t))},r4=(t,a,o)=>t===a||t===o,o4=(t,a)=>{const[o,s]=y.useState(""),[l,u]=y.useState(!1),[f,m]=y.useState(!1),[g,p]=y.useState(null),b=y.useRef(!1),v=y.useRef(""),k=y.useRef(""),E=y.useCallback((w,C)=>{if(!b.current){v.current=w,k.current=w,s(w),m(!1),p(null);return}r4(w,v.current,C)||(p(w),m(!0))},[]);if(y.useEffect(()=>{if(!t){s(""),u(!1),m(!1),p(null),b.current=!1,v.current="",k.current="";return}let w=!1;return s(""),u(!1),m(!1),p(null),b.current=!1,v.current="",k.current="",TN(t).then(({content:C})=>{w||(v.current=C,b.current=!1,k.current=C,s(C),u(!0),m(!1),p(null))}).catch(C=>{w||(v.current="",b.current=!1,k.current="",s(""),u(!0),m(!1),console.error("[hive] swallowed:tasks.initialLoad",C),p(null))}),()=>{w=!0}},[t]),y.useEffect(()=>{if(!t)return;let w=!1,C=null,T=0,N=null;const j=()=>{if(w)return;const A=tw().openWebSocket(`/ws/tasks/${t}`);N=A,A.onmessage=O=>{if(w)return;const D=JSON.parse(String(O.data));D.type!=="tasks-snapshot"&&D.type!=="tasks-updated"||typeof D.content=="string"&&(T=0,E(D.content,k.current))},A.onclose=()=>{if(w)return;T+=1;const O=Math.min(3e4,500*2**(T-1));C=setTimeout(j,O)}};return j(),()=>{w=!0,C!==null&&(clearTimeout(C),C=null),N?.close()}},[E,t]),a!==void 0)return{content:a,hasConflict:!1,loaded:!0,onChange:w=>{},onKeepLocal:()=>{},onReload:()=>{},onSave:async()=>{},toggleTaskAtLine:async w=>{},appendTask:async w=>{},appendSubtask:async(w,C)=>{},updateTaskText:async(w,C)=>{},deleteTask:async w=>{}};const S=async(w,C)=>{if(!t)return;const T=k.current,N=w(T);if(N!==T){v.current=N,k.current=N,b.current=!1,s(N);try{const j=await Hl(t,{content:N});v.current=j.content,k.current=j.content,s(j.content)}catch(j){throw v.current=T,k.current=T,s(T),console.error(`[hive] swallowed:tasks.${C}`,j),j}}};return{content:o,hasConflict:f,loaded:l,onChange:w=>{b.current=w!==v.current,k.current=w,s(w)},onKeepLocal:()=>{m(!1),p(null)},onReload:()=>{const w=g??v.current;v.current=w,b.current=!1,k.current=w,s(w),m(!1),p(null)},onSave:async()=>{if(!t)return;const w=await Hl(t,{content:o});v.current=w.content,b.current=!1,k.current=w.content,s(w.content),m(!1),p(null)},toggleTaskAtLine:async w=>{if(!t)return;const C=k.current,T=e4(C,w);if(T!==C){v.current=T,k.current=T,b.current=!1,s(T);try{const N=await Hl(t,{content:T});v.current=N.content,k.current=N.content,s(N.content)}catch(N){throw v.current=C,k.current=C,s(C),N}}},appendTask:async w=>{const C=w.trim();if(!t||!C)return;const T=k.current,N=J3(T,C);v.current=N,k.current=N,b.current=!1,s(N);try{const j=await Hl(t,{content:N});v.current=j.content,k.current=j.content,s(j.content)}catch(j){throw v.current=T,k.current=T,s(T),j}},appendSubtask:async(w,C)=>{const T=C.trim();T&&await S(N=>a4(N,w,T),"appendSubtask")},updateTaskText:async(w,C)=>{const T=C.trim();T&&await S(N=>t4(N,w,T),"updateTaskText")},deleteTask:async w=>{await S(C=>n4(C,w),"deleteTask")}}},Mx=(t,a,o)=>{const s=new Set(t.map(u=>u.run_id)),l=new Set(t.map(u=>u.agent_id));return[...t,...a.filter(u=>s.has(u.run_id)?!1:o&&ti(u,o)?!0:!l.has(u.agent_id))]},s4=(t,a,o=[])=>{const[s,l]=y.useState({}),u=y.useCallback((p,b)=>{l(v=>({...v,[p]:(v[p]??[]).filter(k=>k.agent_id!==b)}))},[]),f=y.useCallback((p,b)=>{l(v=>({...v,[p]:(v[p]??[]).filter(k=>k.run_id!==b)}))},[]);y.useEffect(()=>{if(!t)return;const p=new Set(a.map(k=>k.run_id)),b=new Set(a.map(k=>k.agent_id)),v=new Set(o.filter(k=>k.status==="stopped").map(k=>k.id));l(k=>{const E=k[t]??[],S=E.filter(w=>p.has(w.run_id)?!1:ti(w,t)?!0:b.has(w.agent_id)?!1:!v.has(w.agent_id));return S.length===E.length?k:{...k,[t]:S}})},[a,o,t]);const m=y.useCallback(({agentId:p,agentName:b,runId:v,status:k="starting",terminalInputProfile:E="default",workspaceId:S})=>{const w={agent_id:p,agent_name:b,run_id:v,status:k,terminal_input_profile:E};l(C=>{const T=ti(w,S),N=(C[S]??[]).filter(j=>j.run_id===w.run_id?!1:T?!0:j.agent_id!==w.agent_id);return{...C,[S]:[...N,w]}})},[]),g=y.useMemo(()=>Mx(a,t?s[t]??[]:[],t),[a,s,t]);return{forgetOptimisticAgent:u,forgetOptimisticRun:f,optimisticRunsByWorkspaceId:s,recordOptimisticRun:m,terminalRuns:g}};let Lx=null;const dm=new Set,i4=t=>{Lx=t;for(const a of dm)a()},l4=t=>(dm.add(t),()=>dm.delete(t)),c4=()=>Lx,zx="hive.package-update.dismissed-version",u4=()=>{try{return window.localStorage.getItem(zx)}catch{return null}},d4=t=>{try{window.localStorage.setItem(zx,t)}catch{}},db=({currentVersion:t=tp,versionInfo:a})=>{const{t:o}=be(),s=yt(),[l,u]=y.useState(u4),[f,m]=y.useState("idle"),g=a?.updateAvailable&&a.latestVersion!==t?a:null;if(!g||l===g.latestVersion)return null;const p=!!g.installHint,b=o(f==="copied"?"packageUpdate.commandCopied":f==="error"?"packageUpdate.commandCopyFailed":"packageUpdate.copyCommand"),v=()=>{d4(g.latestVersion),u(g.latestVersion)},k=async()=>{if(g.installHint)try{await navigator.clipboard.writeText(g.installHint),m("copied"),window.setTimeout(()=>m("idle"),1600)}catch{m("error"),window.setTimeout(()=>m("idle"),2200)}};return c.jsxs("div",{className:"package-update-toast elev-2 toast-pop fixed right-4 bottom-24 z-50 flex w-[min(420px,calc(100vw-2rem))] items-start gap-3 rounded border px-3 py-2.5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-mobile":s||void 0,"data-testid":"package-update-toast",role:"status","aria-live":"polite",children:[c.jsx("div",{className:"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded border",style:{background:"color-mix(in oklab, var(--accent) 10%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 28%, transparent)",color:"var(--accent)"},"aria-hidden":!0,children:c.jsx(EE,{size:15})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"font-medium text-pri text-xs",children:o("packageUpdate.title",{version:g.latestVersion})}),c.jsx("div",{className:"mt-0.5 text-ter text-xs",children:o("packageUpdate.body",{current:t,latest:g.latestVersion})}),p?c.jsx("code",{className:"mono mt-2 block truncate rounded border px-2 py-1 text-ter text-xs",title:g.updateNote||g.installHint,style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:g.installHint}):g.updateNote?c.jsx("div",{className:"mt-2 text-ter text-xs",children:g.updateNote}):null,c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[p?c.jsxs("button",{type:"button",className:"icon-btn icon-btn--primary","data-testid":"package-update-copy-command",onClick:k,"aria-label":b,title:b,children:[f==="copied"?c.jsx(ga,{size:13}):c.jsx(Dr,{size:13}),c.jsx("span",{children:b})]}):null,g.releaseUrl?c.jsxs("a",{href:g.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"icon-btn","data-testid":"package-update-open-release","aria-label":o("packageUpdate.openRelease"),title:o("packageUpdate.openRelease"),children:[c.jsx(_m,{size:13}),c.jsx("span",{children:o("packageUpdate.release")})]}):null,c.jsx("button",{type:"button",className:"icon-btn","data-testid":"package-update-dismiss",onClick:v,children:o("packageUpdate.later")})]})]}),c.jsx(Je,{label:o("common.dismiss"),children:c.jsx("button",{type:"button",className:"flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"package-update-close",onClick:v,"aria-label":o("common.dismiss"),children:c.jsx(fa,{size:13})})})]})},f4=(t=typeof window<"u"?window.matchMedia.bind(window):void 0,a=typeof navigator<"u"?navigator.standalone:void 0)=>t?.("(display-mode: standalone)").matches?!0:a===!0,m4=t=>{if(!t||!(t instanceof HTMLElement))return!1;const a=t.tagName.toLowerCase();return!!(a==="input"||a==="textarea"||a==="select"||t.isContentEditable||t.closest(".xterm"))},p4=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),h4=(t,a)=>a?t.metaKey:t.ctrlKey,g4=(t,a,o=p4)=>!(t.key.toLowerCase()!==a.key||(a.mod??!1)!==h4(t,o)||(a.alt??!1)!==t.altKey||(a.shift??!1)!==t.shiftKey),v4=t=>{y.useEffect(()=>{const a=o=>{if(!m4(o.target))for(const s of t){if(!g4(o,s))continue;s.handler(o)!==!1&&o.preventDefault();return}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t])},y4=({bootstrapError:t,onSelectWorkspace:a,onTriggerAddDialog:o,workspaces:s})=>{const l=y.useMemo(()=>{if(!f4())return[];const u=(s??[]).slice(0,9).map((f,m)=>({key:String(m+1),mod:!0,handler:()=>a(f.id)}));return[{key:"n",mod:!0,shift:!0,handler:()=>{t||o()}},...u]},[t,a,o,s]);v4(l)},b4=15e3,w4=async(t,a=b4)=>new Promise((o,s)=>{let l=!1;const u=window.setTimeout(()=>{l=!0,s(new Error("Hive runtime bootstrap timed out"))},a);t.then(f=>{l||(l=!0,window.clearTimeout(u),o(f))},f=>{l||(l=!0,window.clearTimeout(u),s(f))})}),x4=(t,a)=>a&&t.some(o=>o.id===a)?a:t[0]?.id??null,k4=(t,a)=>{if(t===null)return a;const o=new Map(t.map(s=>[s.id,s]));for(const s of a)o.set(s.id,s);return Array.from(o.values())},S4=(t,a,o)=>{y.useEffect(()=>{let s=!1;const l=aw().then(async()=>{const[u,f]=await Promise.all([QT(),oN().catch(()=>null)]);return{items:u,persistedId:f}});return w4(l).then(({items:u,persistedId:f})=>{s||t(m=>{const g=k4(m,u),p=x4(g,f);return a(p),f!==p&&sw(p).catch(b=>{console.error("[hive] swallowed:initSession.save",b)}),g})}).catch(u=>{s||(a(null),o&&o("Could not reach Hive runtime. Refresh once the runtime is back up.")),console.error("[hive] swallowed:initSession.bootstrap",u)}),()=>{s=!0}},[a,t,o])},E4=()=>{const t=y.useRef(null);return y.useCallback(a=>{if(typeof document>"u")return;const o=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(a):a.replace(/"/g,'\\"'),s=document.querySelector(`[data-worker-name="${o}"]`);s&&(s.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),s.classList.add("worker-card-shell--highlight"),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{s.classList.remove("worker-card-shell--highlight"),t.current=null},1e3))},[])},C4=({onWorkspaceCreated:t,onError:a,onOrchestratorRunStarted:o})=>{const{language:s}=be(),[l,u]=y.useState({}),f=y.useCallback((g,p)=>{u(b=>({...b,[g]:p.ok?null:p.error})),p.ok&&p.run_id&&o?.(g,p.run_id)},[o]),m=y.useCallback(async g=>{try{const p=await tN({name:g.name,path:g.path,autostart_orchestrator:!0,command_preset_id:g.commandPresetId,startup_command:g.startupCommand??null,ui_language:s});return f(p.id,p.orchestrator_start),t({id:p.id,name:p.name,path:p.path}),p}catch(p){const b=p instanceof Error?p.message:"Failed to create workspace";throw a?.(b),p}},[s,t,a,f]);return{orchestratorAutostartErrors:l,recordOrchestratorResult:f,createNewWorkspace:m}},T4=(t,a)=>{const o=t.findIndex(l=>l.id===a),s=t.filter(l=>l.id!==a);return o<0?s[0]?.id??null:s[Math.min(o,s.length-1)]?.id??null},N4=({activeWorkspaceId:t,onActiveDeleted:a,selectWorkspace:o,setWorkersByWorkspaceId:s,setWorkspaces:l,workspaces:u})=>async f=>{const g=T4(u??[],f.id);await nN(f.id),l(p=>p?.filter(b=>b.id!==f.id)??p),s(p=>{const b={...p};return delete b[f.id],b}),f.id===t&&(a(),o(g))},j4=()=>{const[t,a]=y.useState(null),o=y.useRef(Promise.resolve());return{activeWorkspaceId:t,selectWorkspace:l=>{a(l),o.current=o.current.catch(Va("selectWorkspace.prevQueue")).then(()=>sw(l)).catch(Va("selectWorkspace.save"))},setActiveWorkspaceId:a}},Hx=500,A4=5e3,_4=5e3,R4=()=>({failureCount:0,inFlight:!1,lastSettledAt:null}),O4=(t,a)=>Math.min((a?Hx:A4)*2**t,_4),D4=(t,a)=>t.length!==a.length?!1:t.every((o,s)=>{const l=a[s];return l!==void 0&&o.avatar===l.avatar&&o.commandPresetId===l.commandPresetId&&o.id===l.id&&o.lastPtyLine===l.lastPtyLine&&o.name===l.name&&o.pendingTaskCount===l.pendingTaskCount&&o.role===l.role&&o.status===l.status}),fb=(t,a)=>{const o=Object.keys(t),s=Object.keys(a);return o.length!==s.length?!1:s.every(l=>Object.hasOwn(t,l)&&D4(t[l]??[],a[l]??[]))},M4=(t,a={})=>{const o=t.join("\0"),s=y.useRef(a.activeWorkspaceId),l=y.useRef(new Map),u=y.useRef(null),[f,m]=y.useState({});return s.current=a.activeWorkspaceId,y.useEffect(()=>{if(!o){m({}),l.current.clear();return}let g=!1,p;const b=o.split("\0"),v=new Set(b);for(const T of l.current.keys())v.has(T)||l.current.delete(T);m(T=>{const N={};for(const j of b)N[j]=T[j]??[];return fb(T,N)?T:N});const k=T=>{let N=l.current.get(T);return N||(N=R4(),l.current.set(T,N)),N},E=T=>s.current===T,S=T=>{const N=k(T);N.inFlight||(N.inFlight=!0,fN(T).then(j=>{g||(N.failureCount=0,m(A=>{if(!v.has(T))return A;const O={};for(const D of b)O[D]=D===T?j:A[D]??[];return fb(A,O)?A:O}))}).catch(j=>{g||(N.failureCount=Math.min(N.failureCount+1,4),console.error("[hive] swallowed:workspaceWorkers.list",j))}).finally(()=>{N.inFlight=!1,N.lastSettledAt=g?null:Date.now()}))},w=()=>{const T=Date.now();for(const N of b){const j=k(N);if(j.inFlight)continue;if(j.lastSettledAt===null){S(N);continue}const A=O4(j.failureCount,E(N));T-j.lastSettledAt>=A&&S(N)}},C=(T=Hx)=>{g||(p!==void 0&&window.clearTimeout(p),p=window.setTimeout(()=>{p=void 0,w(),C()},T))};return u.current=()=>{p!==void 0&&(window.clearTimeout(p),p=void 0),w(),C()},w(),C(),()=>{g=!0,p!==void 0&&window.clearTimeout(p),u.current&&(u.current=null)}},[o]),y.useEffect(()=>{const g=a.activeWorkspaceId;if(!g||!o.split("\0").includes(g))return;const p=l.current.get(g);p&&!p.inFlight&&(p.lastSettledAt=null,p.failureCount=0),u.current?.()},[a.activeWorkspaceId,o]),[f,m]},fm="hive:terminal-visible-resize",L4=t=>new CustomEvent(fm,{detail:{runId:t}}),z4="\x1B[200~",mb="\x1B[201~",H4=(t,a)=>{const o=t.split(mb).join("");return a?.modes?.bracketedPasteMode===!1?o:`${z4}${o}${mb}`},Lt="\x1B",pb="\x07",U4=new RegExp(`${Lt}\\[[0-?]*[ -/]*[@-~]`,"gu"),B4=new RegExp(`${Lt}\\][^${pb}${Lt}]*(?:${pb}|${Lt}\\\\)`,"gu"),W4=new RegExp("[\0-]","gu"),I4=new RegExp(`${Lt}\\[([0135]) q`,"gu"),q4=new RegExp(`${Lt}\\[[0135] q`,"u"),P4=new RegExp(`${Lt}\\[[246] q`,"gu"),Ux=new RegExp(`${Lt}\\[[0-?]*K`,"u"),F4=new RegExp(`${Lt}\\[[0-9]*D`,"u"),K4=new RegExp(`${Lt}\\[[0-9]+(?:;[0-9]+)?[Hf]`,"gu"),Bx="\b",Wx="",Y4="",$4="",V4=t=>{switch(t){case"3":return"4";case"5":return"6";default:return"2"}},G4=t=>t.replace(B4,"").replace(U4,"").replace(W4,""),X4=t=>G4(t).trim().length>0,Z4=t=>Ux.test(t)&&(F4.test(t)||t.includes(Bx)||t.includes(Wx)),Q4=t=>!X4(t)&&t.includes(`${Lt}[?2026`)&&t.includes(`${Lt}[?25`)&&q4.test(t)&&Ux.test(t)&&!Z4(t),hb=(t,a)=>{let o=null;a.lastIndex=0;for(const s of t.matchAll(a))o=s[0];return o},gb=t=>t.includes(Bx)||t.includes(Wx)||t.includes(Y4)||t.includes($4)||t.includes(`${Lt}[3~`),vb=(t,a={})=>{const o=t.replace(I4,(u,f)=>`${Lt}[${V4(f)} q`);if(!Q4(t))return{chunk:o,suppress:!1};if(a.preservePromptEditFrame)return{chunk:o,consumedPromptEraseInput:!0,suppress:!1};const s=hb(o,K4);return s?{chunk:`${hb(o,P4)??""}${Lt}[?25h${s}`,suppress:!1}:{chunk:o,suppress:!0}},J4=(t,a)=>{let o,s=!1,l=!1;const u=()=>{t.value="",t.scrollLeft=0,t.scrollTop=0},f=()=>{o!==void 0&&clearTimeout(o),o=setTimeout(()=>{o=void 0,s=!1,l=!1,a.setComposing(!1)},0)},m=S=>S.data||t.value,g=S=>S.inputType==="insertText"||S.inputType==="insertFromComposition"||S.inputType==="insertReplacementText"||S.inputType==="insertDictationResult",p=()=>{s=!0,l=!1,a.setComposing(!0)},b=()=>{s=!0,a.setComposing(!0)},v=S=>{const C=S.data||t.value;!l&&C&&a.commit(C),u(),f()},k=S=>{const w=S;if(s||w.isComposing){if(g(w)){const C=m(w);C&&(a.commit(C),l=!0),u()}return}w.defaultPrevented&&g(w)&&u()},E={capture:!0};return t.addEventListener("compositionstart",p,E),t.addEventListener("compositionupdate",b,E),t.addEventListener("compositionend",v,E),t.addEventListener("input",k,E),()=>{o!==void 0&&clearTimeout(o),t.removeEventListener("compositionstart",p,E),t.removeEventListener("compositionupdate",b,E),t.removeEventListener("compositionend",v,E),t.removeEventListener("input",k,E)}},eO=()=>typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform),Hn={killToLineStart:"",lineStart:"",lineEnd:"",killWordBack:"\x1B",wordBack:"\x1Bb",wordForward:"\x1Bf",shiftEnter:"\x1B[13;2u"},tO=(t,a={})=>{const o=a.isMac??eO();if(t.key==="Enter"&&t.shiftKey)return t.type==="keypress"?{kind:"send",bytes:Hn.shiftEnter}:{kind:"block"};if(!o&&t.type==="keydown"&&t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey&&(t.key==="c"||t.key==="C")&&a.hasSelection)return{kind:"copy"};if(!o||t.type!=="keydown")return{kind:"passthrough"};const s=t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.shiftKey,l=t.altKey&&!t.metaKey&&!t.ctrlKey;if(s)switch(t.key){case"Backspace":return{kind:"send",bytes:Hn.killToLineStart};case"ArrowLeft":return{kind:"send",bytes:Hn.lineStart};case"ArrowRight":return{kind:"send",bytes:Hn.lineEnd};case"k":case"K":return{kind:"clear"}}if(l)switch(t.key){case"Backspace":return{kind:"send",bytes:Hn.killWordBack};case"ArrowLeft":return{kind:"send",bytes:Hn.wordBack};case"ArrowRight":return{kind:"send",bytes:Hn.wordForward}}return{kind:"passthrough"}},nO=16,aO=.3,rO={up:"A",down:"B",right:"C",left:"D"},mm=(t,a)=>{const o=rO[a];return t?`\x1BO${o}`:`\x1B[${o}`},oO=(t,a,o)=>a==="codex"||a==="grok"||a==="opencode"?o==="up"?"\x1B[5~":"\x1B[6~":mm(t.modes?.applicationCursorKeysMode,o),sO=t=>t==="codex"||t==="grok"||t==="opencode",Ix=(t,a="default")=>{let o=0;return s=>{if(t.buffer?.active?.type!=="alternate")return o=0,{handled:!1,input:null};if(!sO(a)&&t.modes?.mouseTrackingMode&&t.modes.mouseTrackingMode!=="none")return o=0,{handled:!1,input:null};if(s.deltaY===0||s.shiftKey)return{handled:!1,input:null};let l=s.deltaY;return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=nO,Math.abs(s.deltaY)<50&&(l*=aO),o+=l,l=Math.trunc(o),o%=1):o=0,l===0?{handled:!0,input:null}:{handled:!0,input:oO(t,a,l<0?"up":"down")}}},iO=({element:t,profile:a="default",sendInput:o,terminal:s})=>{const l=Ix(s,a),u=m=>{const{handled:g,input:p}=l(m);return g?(m.preventDefault(),m.stopPropagation(),p&&o(p),!1):!0};if(typeof s.attachCustomWheelEventHandler=="function")return s.attachCustomWheelEventHandler(u),()=>{};const f=m=>{u(m)||m.stopImmediatePropagation()};return t.addEventListener("wheel",f,{capture:!0,passive:!1}),()=>t.removeEventListener("wheel",f,{capture:!0})},lO=(t,a={})=>{switch(t){case"esc":return"\x1B";case"tab":return" ";case"enter":return"\r";case"arrowUp":return mm(a.applicationCursorKeys,"up");case"arrowDown":return mm(a.applicationCursorKeys,"down");case"arrowRight":return a.applicationCursorKeys?"\x1BOC":"\x1B[C";case"arrowLeft":return a.applicationCursorKeys?"\x1BOD":"\x1B[D";case"home":return"\x1B[H";case"end":return"\x1B[F";case"ctrlC":return"";case"ctrlD":return"";case"ctrlZ":return"";case"ctrlL":return"\f";case"ctrlR":return"";case"ctrlU":return Hn.killToLineStart;case"ctrlA":return Hn.lineStart;case"ctrlE":return Hn.lineEnd;case"ctrlW":return""}},cO="Invalid terminal control message",uO=t=>{let a;try{a=JSON.parse(String(t))}catch{return null}if(!a||typeof a!="object")return null;const o=a;return o.type==="error"&&typeof o.message=="string"?{type:"error",message:o.message}:o.type==="exit"&&(o.code===null||typeof o.code=="number")?{type:"exit",code:o.code}:o.type==="restore"&&typeof o.snapshot=="string"?{type:"restore",snapshot:o.snapshot}:null},dO=({initialSize:t,onError:a,onExit:o,onOutput:s,onRestore:l,onClose:u,runId:f})=>{const m=crypto.randomUUID(),g={...t,clientId:m},p=tw(),b=p.openWebSocket(`/ws/terminal/${f}/io`,g),v=p.openWebSocket(`/ws/terminal/${f}/control`,g);let k=!1,E=!1,S=!1;const w=[];let C=null;const T=()=>{E||S||(S=!0,u?.())};b.onclose=T,v.onclose=T;const N=()=>{!C||v.readyState!==v.OPEN||(v.send(JSON.stringify({type:"resize",...C})),C=null)};return b.onmessage=j=>{const A=typeof j.data=="string"?j.data:"",O=D=>{v.readyState===v.OPEN&&v.send(JSON.stringify({type:"output_ack",bytes:D}))};if(!k){w.push({chunk:A,acknowledge:O});return}s(A,O)},v.onopen=()=>{N()},v.onmessage=j=>{const A=uO(j.data);if(!A){a(cO);return}if(A.type==="exit"&&o(A.code),A.type==="error"&&a(A.message),A.type==="restore"){let O=!1;const D=()=>{if(!O){O=!0,k=!0,v.readyState===v.OPEN&&v.send(JSON.stringify({type:"restore_complete"}));for(const L of w.splice(0))s(L.chunk,L.acknowledge)}};l(A.snapshot,D)}},{dispose(){E=!0,b.close(),v.close()},resize(j,A,O,D){C={cols:j,rows:A},O!==void 0&&(C.pixelWidth=O),D!==void 0&&(C.pixelHeight=D),N()},sendBinaryInput(j){if(b.readyState!==b.OPEN)return;const A=new Uint8Array(j.length);for(let O=0;O<j.length;O++)A[O]=j.charCodeAt(O)&255;b.send(A)},sendInput(j){b.readyState===b.OPEN&&b.send(j)}}},fO=50,mO=1e3,pO=({canRender:t,write:a})=>{let o=!1,s,l=null,u,f=0,m=[],g,p=0,b=!1;function v(){return f>0||m.length>0}function k(){s!==void 0&&(window.clearTimeout(s),s=void 0)}function E(){g!==void 0&&(window.clearTimeout(g),g=void 0)}function S(N,j){!N||j<=0||N(j)}function w(){const N=f,j=u;f=0,u=void 0,S(j,N)}function C(){if(o||b||s!==void 0||!v())return;const N=l===null?0:Math.max(0,fO-(Date.now()-l));if(N===0){T();return}s=window.setTimeout(()=>{s=void 0,T()},N)}function T(){if(k(),o||b||!v())return;if(!t()){w();return}const N=m.join(""),j=f,A=u;if(m=[],f=0,u=void 0,l=Date.now(),N.length===0){S(A,j),C();return}b=!0;const O=++p,D=()=>{!b||O!==p||(E(),b=!1,S(A,j),C())};g=window.setTimeout(D,mO);try{a(N,D)}catch{D()}}return{dispose(){o=!0,k(),E(),m=[],f=0,u=void 0},enqueue(N,j,A){if(!o){if(N.length===0){S(A,j);return}N.length>0&&m.push(N),t()?(f+=j,u=A):S(A,j),C()}},flush:T}},hO=16,gO=.08,vO=.96,yO=.025,yb=5,bO=100,wO=8,xO=6,kO=4,SO=.5,EO=250,CO=24,TO=2,NO=".xterm-viewport",jO=".xterm-screen";function AO({element:t,profile:a="default",sendInput:o,terminal:s}){let l=null,u=0,f=0,m,g=0,p=null,b=0,v=!1,k=null,E=null,S=hO,w=0,C=0,T=null,N=[];const j=Ix(s,a),A=()=>{p!==null&&(window.cancelAnimationFrame(p),p=null)},O=()=>{T!==null&&(window.cancelAnimationFrame(T),T=null)},D=()=>(k?.isConnected||(k=t.querySelector(NO)),k),L=()=>(E?.isConnected||(E=t.querySelector(jO)),E),P=()=>{const le=D(),ie=s.rows;if(!le||!ie||ie<=0)return;const xe=le.clientHeight/ie;xe>=6&&xe<=64&&(S=xe)},J=()=>{const le=L();le&&(le.style.transform=w!==0?`translateY(${-w}px)`:"")},Q=()=>{w!==0&&(w=0,J())},$=()=>{if(Math.abs(w)>=S/2){const le=D();if(le){const ie=le.scrollHeight-le.clientHeight,xe=w>0?S:-S;le.scrollTop=Math.min(ie,Math.max(0,le.scrollTop+xe))}}Q()},F=le=>{const ie=D();if(!ie)return"missing";const xe=ie.scrollHeight-ie.clientHeight;if(xe<=0)return Q(),"stuck";const Ne=w+le,he=Math.trunc(Ne/S);let we=Ne-he*S;const Ce=ie.scrollTop,Ae=Math.min(xe,Math.max(0,Ce+he*S)),pt=Ae!==Ce;pt&&(ie.scrollTop=Ae),(Ae<=0&&Ne<0||Ae>=xe&&Ne>0)&&(we=0);const dt=we!==w;return w=we,dt&&J(),pt||dt?"moved":"stuck"},ne=le=>{u+=le/S;const ie=Math.trunc(u);return u%=1,ie===0||s.scrollLines?.(ie),!0},Z=(le,ie)=>{const xe=[];for(let Ne=0;Ne<ie;Ne++){const{handled:he,input:we}=j({deltaMode:WheelEvent.DOM_DELTA_LINE,deltaY:le,shiftKey:!1});if(!he)break;we&&xe.push(we)}return xe.length>0&&o(xe.join("")),xe.length},q=le=>{f+=le/S;const ie=Math.trunc(f);if(f%=1,ie===0)return!1;const xe=a==="codex"||a==="opencode"?kO:xO;return Z(ie<0?-1:1,Math.min(Math.abs(ie),xe))>0},M=le=>{const ie=s.buffer?.active?.type;return ie!==m&&(u=0,f=0,m=ie,Q()),ie==="alternate"?{moved:q(le),normalBuffer:!1}:{moved:F(le)==="moved"||ne(le),normalBuffer:!0}},U=()=>{T=null;const le=C;C=0,le!==0&&(v=M(le).normalBuffer)},W=()=>{T===null&&(T=window.requestAnimationFrame(U))},G=(le,ie)=>{N.push({t:le,y:ie}),N.length>wO&&N.shift()},V=le=>{const ie=le-bO,xe=N.filter(Ae=>Ae.t>=ie),Ne=xe[0],he=xe[xe.length-1];if(!Ne||!he||Ne===he)return 0;const we=he.t-Ne.t;if(we<=0)return 0;const Ce=(Ne.y-he.y)/we;return Math.max(-yb,Math.min(yb,Ce))};let R=0;const B=()=>{if(p=null,R===0)return;if(s.buffer?.active?.type!=="alternate"){R=0;return}const le=R>0?1:-1,ie=Math.min(Math.abs(R),TO);if(Z(le,ie)<ie){R=0;return}R-=le*ie,R!==0&&(p=window.requestAnimationFrame(B))},se=le=>{const ie=Math.min(32,Math.max(1,le-b));b=le;const{moved:xe,normalBuffer:Ne}=M(g*ie);if(!xe||!Ne){p=null,u=0,g=0,$();return}if(g*=vO**(ie/16.67),Math.abs(g)<yO){p=null,u=0,$();return}p=window.requestAnimationFrame(se)},re=le=>{A(),R=0,O(),C=0,N=[],l=le.touches.length===1?le.touches[0]?.clientY??null:null,l!==null&&G(le.timeStamp,l),g=0,v=!1,D(),P()},ce=le=>{if(l===null||le.touches.length!==1)return;const ie=le.touches[0]?.clientY??l,xe=l-ie;Math.abs(xe)<1||(l=ie,le.preventDefault(),C+=xe,G(le.timeStamp,ie),W())},fe=le=>{l=null,O(),U();const ie=V(le.timeStamp);if(N=[],v&&Math.abs(ie)>=gO){g=ie,b=performance.now(),p=window.requestAnimationFrame(se);return}if(!v&&a!=="opencode"&&Math.abs(ie)>=SO&&s.buffer?.active?.type==="alternate"){const xe=Math.min(CO,Math.round(Math.abs(ie)*EO/S));if(xe>0){R=ie>0?xe:-xe,p=window.requestAnimationFrame(B);return}}g=0,u=0,$()},ue=()=>{A(),R=0,O(),C=0,N=[],l=null,u=0,f=0,g=0,v=!1,Q()};return t.addEventListener("touchstart",re,{passive:!0}),t.addEventListener("touchmove",ce,{passive:!1}),t.addEventListener("touchend",fe,{passive:!0}),t.addEventListener("touchcancel",ue,{passive:!0}),()=>{t.removeEventListener("touchstart",re),t.removeEventListener("touchmove",ce),t.removeEventListener("touchend",fe),t.removeEventListener("touchcancel",ue),A(),O(),Q()}}const _O=(t=()=>typeof document<"u"?document.createElement("canvas"):null)=>{const a=t();if(!a||typeof a.getContext!="function")return!1;try{return!!(a.getContext("webgl2")||a.getContext("webgl"))}catch{return!1}},RO=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),OO=t=>!(t instanceof HTMLElement)||t.classList.contains("xterm-helper-textarea")?!1:t.isContentEditable||t instanceof HTMLTextAreaElement?!0:t instanceof HTMLInputElement?!t.disabled&&!t.readOnly&&!RO.has(t.type):!1,DO=(t,a)=>{if(!a?.isConnected||!a.contains(t)||document.visibilityState==="hidden"||t.closest('[data-terminal-host-parked="true"]'))return!1;const o=document.activeElement;return!o||o===document.body||o===document.documentElement||t.contains(o)?!0:!OO(o)},MO=t=>t instanceof Error&&t.message?`Terminal failed to load: ${t.message}`:"Terminal failed to load. Refresh this page and try again.",LO=new RegExp("\x1B\\[M([\\s\\S])([\\s\\S])([\\s\\S])","g"),zO=new TextEncoder,HO=5e3,UO=(t,a,o,s)=>{const l=a.charCodeAt(0)-32,u=o.charCodeAt(0)-32,f=s.charCodeAt(0)-32;if(l<0||u<1||f<1)return t;const g=(l&3)===3&&(l&32)===0&&(l&64)===0?"m":"M";return`\x1B[<${l};${u};${f}${g}`},BO=(t,a)=>{if(a!=="grok"&&a!=="opencode")return{binary:!0,chunk:t};const o=t.replace(LO,UO);return{binary:o===t,chunk:o}},WO=(t,a="default",o,s={})=>{const l=yt(),u=y.useRef(null),[f,m]=y.useState(null),[g,p]=y.useState("connecting"),b=y.useRef("connecting"),v=y.useRef(null),[k,E]=y.useState(0),S=y.useRef(null),w=y.useRef(null),C=y.useRef(null),T=y.useRef(void 0),N=y.useRef(!1),j=y.useRef(!1),[A,O]=y.useState("canvas"),[D,L]=y.useState(!1),P=y.useRef(!1),J=y.useRef(o);y.useEffect(()=>{J.current=o},[o]);const Q=y.useCallback(()=>{const U=u.current,W=w.current;!U||!W||DO(U,C.current)&&W.focus()},[]),$=y.useCallback(()=>{!C.current||T.current!==void 0||(T.current=window.setTimeout(()=>{T.current=void 0,Q()},0))},[Q]);y.useEffect(()=>{C.current=s.autoFocusTarget??null,$()},[s.autoFocusTarget,$]),y.useEffect(()=>{const U=()=>$(),W=()=>{document.visibilityState!=="hidden"&&$()};return window.addEventListener("focus",U),document.addEventListener("visibilitychange",W),()=>{window.removeEventListener("focus",U),document.removeEventListener("visibilitychange",W),T.current!==void 0&&(window.clearTimeout(T.current),T.current=void 0)}},[$]);const F=y.useCallback(U=>{O(U);const W=u.current;W&&(W.dataset.renderer=U)},[]),ne=y.useCallback(U=>{N.current||(a==="codex"&&gb(U)&&(j.current=!0),S.current?.sendInput(U))},[a]),Z=y.useCallback(U=>{const W=w.current?.modes?.applicationCursorKeysMode;ne(lO(U,W===void 0?{}:{applicationCursorKeys:W}))},[ne]),q=y.useCallback(U=>{const W=H4(U,w.current??void 0);return S.current?.sendInput(W),W},[]),M=y.useCallback(()=>{const U=()=>{w.current?.scrollToBottom();const W=u.current?.querySelector(".xterm-viewport");W&&(W.scrollTop=W.scrollHeight)};U(),window.requestAnimationFrame(()=>{U(),window.requestAnimationFrame(U)}),window.setTimeout(U,80),P.current=!1,L(!1)},[]);return y.useEffect(()=>{if(!u.current)return;let U=!1,W,G,V,R,B,se,re,ce,fe,ue,le,ie,xe,Ne=null,he,we,Ce,Ae,pt=0,dt;m(null);const wn=v.current===t?"running":"connecting";b.current=wn,p(wn),P.current=!1,L(!1);const Nt=ft=>{ft==="running"&&(v.current=t),b.current!==ft&&(b.current=ft,p(ft))},Fn=()=>{const ft=++pt;aN(t).then(zt=>{if(!(U||ft!==pt)){if(!zt){Nt("stopped"),J.current?.();return}E(ln=>ln+1)}}).catch(zt=>{if(!(U||ft!==pt)){if(zt instanceof ow&&(zt.status===401||zt.status===403)){m(zt.message);return}E(ln=>ln+1)}})};return Promise.all([Mt(()=>import("./xterm-B-qIQCd3.js"),[]),Mt(()=>import("./addon-fit-DX4qG4td.js"),[]),Mt(()=>import("./addon-unicode11-Bt8F3D7-.js"),[]),Mt(()=>import("./addon-clipboard-wHJhZAA4.js"),[])]).then(([ft,zt,ln,Se])=>{if(U||!u.current)return;const nt=typeof window<"u"?getComputedStyle(document.documentElement):null,ar=nt?.getPropertyValue("--bg-crust").trim()||"#0e0e0e",rr=nt?.getPropertyValue("--text-primary").trim()||"#ebebeb",de=new ft.Terminal({allowProposedApi:!0,convertEol:!1,fontFamily:"'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:l?12:13,letterSpacing:0,lineHeight:1,scrollback:1e4,theme:{background:ar,foreground:rr}}),Ue=new zt.FitAddon;de.loadAddon(Ue),de.loadAddon(new ln.Unicode11Addon),de.unicode.activeVersion="11",de.loadAddon(new Se.ClipboardAddon),de.open(u.current),F("canvas"),Ue.fit(),se=de,w.current=de,re=Ue,$();const st=()=>{const Te=de.buffer.active,De=Te.viewportY<Te.baseY;P.current!==De&&(P.current=De,L(De))},Kn=()=>{Ae===void 0&&(Ae=window.requestAnimationFrame(()=>{Ae=void 0,st()}))};we=de.onScroll(Kn),Ce=de.buffer.onBufferChange(Kn);const or=Te=>{a==="codex"&&gb(Te)&&(j.current=!0),B?.sendInput(Te)};ie=iO({element:u.current,profile:a,sendInput:or,terminal:de}),l&&(xe=AO({element:u.current,profile:a,sendInput:or,terminal:de})),Ne=u.current.querySelector(".xterm-helper-textarea"),Ne&&(he=J4(Ne,{setComposing:Te=>{N.current=Te},commit:or})),typeof de.attachCustomKeyEventHandler=="function"&&de.attachCustomKeyEventHandler(Te=>{const De=tO(Te,{hasSelection:de.hasSelection()});switch(De.kind){case"send":return Te.preventDefault(),or(De.bytes),!1;case"clear":return Te.preventDefault(),de.clear(),!1;case"copy":{Te.preventDefault();const Ot=de.getSelection();return Ot&&navigator.clipboard?.writeText(Ot).catch(()=>{}),de.clearSelection(),!1}case"block":return!1;case"passthrough":return!0}});const ya=()=>{const Te=u.current;return Te?.isConnected?!Te.closest('[data-terminal-host-parked="true"]'):!1};fe=pO({canRender:ya,write:(Te,De)=>de.write(Te,De)});const bt=()=>{if(!u.current)return{};const Te=u.current.clientWidth,De=u.current.clientHeight,Ot={};return De>0&&(Ot.pixelHeight=De),Te>0&&(Ot.pixelWidth=Te),Ot},xn=()=>{if(!u.current||!ya())return;const Te=bt();if(!Te.pixelHeight||!Te.pixelWidth||dt&&dt.pixelHeight===Te.pixelHeight&&dt.pixelWidth===Te.pixelWidth)return;re?.fit();const De={cols:se?.cols??80,rows:se?.rows??24,...bt()};dt&&dt.cols===De.cols&&dt.rows===De.rows&&dt.pixelHeight===De.pixelHeight&&dt.pixelWidth===De.pixelWidth||(dt=De,B?.resize(De.cols,De.rows,De.pixelWidth,De.pixelHeight))},ht=()=>{ue&&window.clearTimeout(ue),ue=window.setTimeout(()=>{ue=void 0,xn()},50)};Mt(()=>import("./addon-web-links-DIbG5aQx.js"),[]).then(Te=>{U||se!==de||de.loadAddon(new Te.WebLinksAddon)}).catch(()=>{}),_O()&&Mt(()=>import("./addon-webgl-DCtw1yLn.js"),[]).then(Te=>{if(!(U||se!==de))try{const De=new Te.WebglAddon;De.onContextLoss(()=>{De.dispose(),F("canvas")}),de.loadAddon(De),F("webgl"),ht()}catch{F("canvas")}}).catch(()=>{F("canvas")}),B=dO({initialSize:{cols:de.cols,rows:de.rows,...bt()},onError(Te){m(Te)},onExit(){Nt("stopped"),J.current?.()},onOutput(Te,De){Nt("running");const Ot=zO.encode(Te).byteLength;if(a==="codex"){const ba=vb(Te,{preservePromptEditFrame:j.current});if(ba.consumedPromptEraseInput&&(j.current=!1),ba.suppress){fe?.enqueue("",Ot,De);return}fe?.enqueue(ba.chunk,Ot,De);return}fe?.enqueue(Te,Ot,De)},onRestore(Te,De){Nt("running");const Ot=a==="codex"?vb(Te).chunk:Te;if(Ot.length===0){De();return}de.write(Ot,De)},onClose(){U||Fn()},runId:t}),le=window.setTimeout(()=>{le=void 0,!(U||b.current!=="connecting")&&E(Te=>Te+1)},HO),S.current=B,R=de.onData(Te=>{N.current||or(Te)}),typeof de.onBinary=="function"&&(V=de.onBinary(Te=>{const De=BO(Te,a);De.binary?B?.sendBinaryInput(De.chunk):B?.sendInput(De.chunk)})),xn(),typeof ResizeObserver<"u"&&u.current&&(ce=new ResizeObserver(ht),ce.observe(u.current)),W=Te=>{Te.detail?.runId===t&&(fe?.flush(),ht())},G=()=>ht(),window.addEventListener(fm,W),window.addEventListener("resize",G)}).catch(ft=>{U||(m(MO(ft)),Nt("stopped"))}),()=>{U=!0,W&&window.removeEventListener(fm,W),G&&window.removeEventListener("resize",G),ce?.disconnect(),ue&&window.clearTimeout(ue),le&&window.clearTimeout(le),ie?.(),xe?.(),he?.(),fe?.dispose(),Ae!==void 0&&window.cancelAnimationFrame(Ae),we?.dispose(),Ce?.dispose(),V?.dispose(),R?.dispose(),B?.dispose(),se?.dispose(),re?.dispose(),S.current=null,w.current=null}},[t,a,k]),{containerRef:u,error:f,status:g,sendInput:ne,sendKey:Z,beginPaste:q,renderer:A,isScrolledUp:D,scrollToBottom:M}},IO={connecting:"terminal.statusConnecting",running:"terminal.statusRunning",stopped:"common.stopped"},pm="hive-terminal-parking-lot",qO=500,PO=t=>[`worker-pty-${t}`,`orch-pty-${t}`,`shell-pty-${t}`],FO=t=>{for(let a=t;a;a=a.parentElement){if(a.hidden||a.getAttribute("aria-hidden")==="true"||a.classList.contains("hidden"))return!0;const o=window.getComputedStyle?.(a);if(o?.display==="none"||o?.visibility==="hidden")return!0}return!1},KO=t=>{const a=Array.from(document.querySelectorAll("[data-pty-slot]")).filter(o=>o.id===t&&o.isConnected&&!FO(o));return a[a.length-1]??null},YO=()=>{let t=document.getElementById(pm);return t||(t=document.createElement("div"),t.id=pm,t.hidden=!0,t.style.display="none",(document.body??document.documentElement).appendChild(t)),t},Mf=()=>{const t=document.getElementById(pm);t&&t.childElementCount===0&&t.remove()},bb="[data-pty-slot]",Xl=new Set;let Xs,Zs;const qx=t=>t instanceof Element?t.matches(bb)||t.querySelector(bb)!==null:!1,wb=t=>{for(let a=0;a<t.length;a+=1){const o=t.item(a);if(o&&qx(o))return!0}return!1},$O=t=>t.type==="attributes"&&t.attributeName==="data-pty-slot"?!0:!(t.target instanceof Element)||t.target.closest("[data-terminal-host-run-id]")?!1:wb(t.addedNodes)||wb(t.removedNodes)?!0:t.target===document.body||t.target===document.documentElement?!1:qx(t.target),xb=t=>{if(!(t&&!t.some($O)))for(const a of Xl)a()},VO=()=>{Xs?.disconnect(),Xs=void 0,Zs!==void 0&&(window.clearInterval(Zs),Zs=void 0)},GO=()=>{if(Xs||Zs!==void 0)return;const t=document.body??document.documentElement;if(typeof MutationObserver<"u"&&t){Xs=new MutationObserver(xb),Xs.observe(t,{attributeFilter:["aria-hidden","class","data-pty-slot","data-terminal-auto-focus","hidden","id","style"],attributes:!0,childList:!0,subtree:!0});return}Zs=window.setInterval(xb,100)},XO=t=>(Xl.add(t),GO(),()=>{Xl.delete(t),Xl.size===0&&VO()}),ZO=[50,150,300],QO=t=>t?.dataset.terminalAutoFocus==="true",JO=t=>{const a=[],o=[],s=()=>window.dispatchEvent(L4(t)),l=(u,f)=>{const m=window.setTimeout(()=>{const g=o.indexOf(m);g>=0&&o.splice(g,1),f()},u);o.push(m)};if(typeof window.requestAnimationFrame=="function"){const u=window.requestAnimationFrame(()=>{s();const f=window.requestAnimationFrame(s);a.push(f)});a.push(u)}else l(0,s);for(const u of ZO)l(u,s);return()=>{for(const u of a)window.cancelAnimationFrame?.(u);for(const u of o)window.clearTimeout(u);a.length=0,o.length=0}},e5=t=>{const[a,o]=y.useState(null);return y.useEffect(()=>{const s=PO(t),l=()=>{for(const f of s){const m=KO(f);if(m)return m}return null},u=()=>{const f=l();o(m=>m===f?m:f)};return u(),XO(u)},[t]),a},t5=(t,a)=>{const[o,s]=y.useState(!1),[l,u]=y.useState(null),f=y.useRef(null),m=y.useRef(void 0),g=y.useRef(null),p=y.useRef(void 0),b=y.useCallback(()=>{m.current!==void 0&&(window.clearTimeout(m.current),m.current=void 0)},[]),v=y.useCallback(()=>{p.current?.(),p.current=void 0},[]),k=y.useCallback(()=>{const S=f.current;S?.dataset.terminalSlotRunId===t&&delete S.dataset.terminalSlotRunId,f.current=null},[t]),E=y.useCallback(S=>{const w=f.current;w&&w!==S&&w.dataset.terminalSlotRunId===t&&delete w.dataset.terminalSlotRunId,S.dataset.terminalSlotRunId=t,f.current=S},[t]);return y.useLayoutEffect(()=>{const S=document.createElement("div");return S.dataset.terminalHostRunId=t,S.dataset.terminalHostParked="false",S.className="h-full min-h-0 w-full min-w-0",g.current=S,u(S),()=>{b(),k(),v(),S.remove(),g.current=null,Mf()}},[k,b,v,t]),y.useLayoutEffect(()=>{if(a){b(),s(!0);return}if(!(!o||m.current!==void 0))return m.current=window.setTimeout(()=>{m.current=void 0,s(!1)},qO),b},[o,b,a]),y.useLayoutEffect(()=>{const S=g.current;if(!S)return;if(!o){v(),k(),S.remove(),S.dataset.terminalHostParked="false",Mf();return}const w=a??YO();if(S.parentElement===w){a?E(a):k();return}const C=S.parentElement!==null,T=document.activeElement;a||(v(),k()),!a&&T instanceof HTMLElement&&S.contains(T)&&T.blur(),S.dataset.terminalHostParked=a?"false":"true",w.appendChild(S),a&&E(a),Mf(),a&&C&&(v(),p.current=JO(t))},[o,k,v,E,t,a]),o?l:null},n5=({inputProfile:t="default",onRunExited:a,runId:o,startupBlockedReason:s,title:l})=>{const u=e5(o),f=t5(o,u);if(!f)return null;const m=QO(u)?u:null;return Cc.createPortal(c.jsx(a5,{autoFocusTarget:m,inputProfile:t,onRunExited:a,runId:o,startupBlockedReason:s??null,title:l}),f)},a5=({autoFocusTarget:t,inputProfile:a,onRunExited:o,runId:s,startupBlockedReason:l,title:u})=>{const{t:f}=be(),m=yt(),g=y.useCallback(()=>{o?.(s)},[o,s]),{containerRef:p,error:b,status:v,isScrolledUp:k,scrollToBottom:E}=WO(s,a,g,{autoFocusTarget:t}),S=IO[v],w=y.useCallback(()=>{p.current?.querySelector(".xterm-helper-textarea")?.blur(),E()},[p,E]);return c.jsxs("div",{className:"flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden",children:[c.jsx("p",{className:"sr-only",children:S?f(S):v}),b?c.jsx("p",{role:"alert",className:"mono shrink-0 break-words px-3 py-2 text-xs",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",borderBottom:"1px solid color-mix(in oklab, var(--status-red) 30%, transparent)",color:"var(--status-red)"},children:b}):null,!b&&l==="first_run_setup"?c.jsx("p",{className:"mono shrink-0 break-words px-3 py-2 text-xs","data-testid":`terminal-startup-setup-${s}`,style:{background:"color-mix(in oklab, var(--status-orange) 12%, transparent)",borderBottom:"1px solid color-mix(in oklab, var(--status-orange) 28%, transparent)",color:"var(--text-secondary)"},children:f("terminal.firstRunSetup")}):null,c.jsxs("div",{className:"relative h-full min-h-0 w-full min-w-0 flex-1 overflow-hidden",children:[c.jsx("div",{"data-testid":`terminal-${s}`,ref:p,className:"bg-crust h-full min-h-0 w-full min-w-0 overflow-hidden"}),!b&&v==="connecting"?c.jsx("div",{role:"status",className:"mono pointer-events-none absolute inset-0 flex items-center justify-center px-4 text-center text-xs",style:{color:"var(--text-muted)"},children:f("terminal.statusConnecting")}):null,m&&k?c.jsx(r5,{label:f("terminal.scrollToBottom"),onJump:w}):null]})]})},r5=({label:t,onJump:a})=>{const o=y.useRef(null),s=y.useRef(Number.NEGATIVE_INFINITY),l=y.useCallback(u=>{u.preventDefault?.(),u.stopPropagation?.();const f=u.timeStamp??performance.now();f-s.current<250||(s.current=f,a())},[a]);return y.useEffect(()=>{const u=o.current;if(!u)return;const f=m=>{m.cancelable&&m.preventDefault(),m.stopImmediatePropagation(),l(m)};return u.addEventListener("touchstart",f,{capture:!0,passive:!1}),u.addEventListener("pointerdown",f,{capture:!0}),u.addEventListener("mousedown",f,{capture:!0}),()=>{u.removeEventListener("touchstart",f,{capture:!0}),u.removeEventListener("pointerdown",f,{capture:!0}),u.removeEventListener("mousedown",f,{capture:!0})}},[l]),c.jsx("button",{ref:o,type:"button","aria-label":t,className:"icon-btn icon-btn--primary mobile-terminal-jump-button absolute bottom-2 left-1/2 -translate-x-1/2",tabIndex:-1,onClick:l,onFocus:u=>u.currentTarget.blur(),children:t})},o5=({hidden:t=!1,onTerminalRunExited:a,optimisticRuns:o=[],terminalRuns:s,workspaceId:l})=>{const{t:u}=be(),f=Mx(s,o,l);return c.jsx("section",{hidden:t,"aria-hidden":t||void 0,"aria-label":u("terminalPanels.aria"),children:f.map(m=>c.jsx(n5,{inputProfile:m.terminal_input_profile??"default",onRunExited:g=>a?.(l,g),runId:m.run_id,startupBlockedReason:m.startup_blocked_reason??null,title:`${m.agent_name} (${m.status})`},m.run_id))})},s5=[{version:"2.1.17",date:"2026-07-08",en:["The retired Sentinel patrol role has been removed from team setup and role settings. Hive now keeps the worker role set focused on Coder, Reviewer, Tester, and Custom.","Existing local databases are cleaned up on upgrade so stale Sentinel templates and workers no longer remain in the roster.",'Dispatches are quieter: members no longer send an immediate "accepted dispatch" status for every task, and instead report when the task is done, blocked, failed, or partially complete.'],zh:["已移除废弃的 Sentinel 巡检角色,不再出现在组队和角色设置里。Hive 现在只保留 Coder、Reviewer、Tester 和 Custom 这组 worker 角色。","升级时会清理本地数据库里遗留的 Sentinel 模板和成员,避免旧巡检角色继续留在团队列表中。","派单更安静:成员收到任务后不再先发一条“accepted dispatch”状态,而是直接开始工作,并在完成、阻塞、失败或部分完成时汇报。"]},{version:"2.1.16",date:"2026-07-08",en:["Codex workers are less likely to appear to lose context after a temporary resume failure. Hive now keeps the saved session when the underlying Codex conversation still exists.","If the saved Codex session is truly gone, Hive clears the stale pointer and starts fresh instead of retrying a broken resume.","Session cleanup now uses the same existence check across supported native session stores, keeping resume behavior more consistent across CLI presets."],zh:["Codex 成员在临时 resume 失败后更不容易看起来“丢上下文”。只要底层 Codex 对话还在,Hive 会保留已保存的 session。","如果已保存的 Codex session 确实不存在了,Hive 会清掉陈旧指针并重新启动,而不是反复尝试坏掉的 resume。","Session 清理现在复用同一套原生 session 存在性检查,让不同 CLI preset 的恢复行为更一致。"]},{version:"2.1.15",date:"2026-07-02",en:["Workers can now have custom avatars. Upload and crop an image from the team UI, and Hive will persist it with the worker.","Worker avatars appear in the browser workspace without bloating CLI `team list` output.","Terminal rendering is more reliable under heavy output and reconnect/restore flows, reducing stale or duplicated frames.","`team report` is clearer when Hive has accepted a report and durable Orchestrator delivery is still in progress, avoiding false failure wording.","Orchestrator guidance now waits more patiently for accepted dispatches to report back before nudging or cancelling members."],zh:["成员现在可以设置自定义头像。你可以在团队界面上传并裁剪图片,Hive 会把头像随成员一起保存。","成员头像会显示在浏览器 workspace 中,但不会塞进 CLI 的 `team list` 输出。","终端在大量输出、重连和恢复场景下的渲染更可靠,减少陈旧或重复的终端画面。","当 Hive 已接收 `team report`、但仍在把报告可靠投递给 Orchestrator 时,命令行提示会更准确,不再误报成失败。","Orchestrator 指引现在会更耐心等待已接收派单的成员回报,减少过早催促或取消。"]},{version:"2.1.14",date:"2026-06-25",en:["Returning to a Hive browser tab now focuses the active Orchestrator terminal automatically, so you can keep typing without an extra click.","Opening a member panel now focuses that member terminal automatically, while Hive still avoids stealing focus from normal text fields or workspace shell terminals.","Dream memory consolidation is less likely to fail on procedure-reference validation: ordinary workflow advice is now steered toward regular memory unless it points to a real saved workflow, skill, procedure, template, or document."],zh:["从其他浏览器标签页切回 Hive 时,当前 Orchestrator 终端会自动获得焦点,可以直接继续输入,不用再点一次终端。","打开成员面板时,该成员终端也会自动获得焦点;同时 Hive 不会抢普通文本输入框或 workspace shell 终端的焦点。","Dream 记忆整理更不容易因为 procedure_ref 校验失败:普通流程经验会被引导保存为常规记忆,只有真正指向已有 workflow、skill、procedure、template 或文档时才使用 procedure reference。"]},{version:"2.1.12",date:"2026-06-25",en:["Hive now starts on the less common local port 9483 by default, reducing collisions with other development services. You can still use `hive --port 0` to ask the OS for any free port.","Pi is now a built-in agent preset. Hive can launch `pi --approve`, wait for the Pi prompt before sending startup input, and allow Pi in workflow CLI policy.","The Supervisor MCP adapter and development proxy now follow the same default runtime port, so external supervisors and local development stay aligned."],zh:["Hive 默认启动端口改为较少冲突的本机端口 9483,降低和常见开发服务撞端口的概率;仍可用 `hive --port 0` 让系统自动分配空闲端口。","Pi 现在是内置 agent preset。Hive 可以启动 `pi --approve`,等待 Pi 提示符就绪后再注入启动输入,并允许 workflow CLI policy 使用 Pi。","Supervisor MCP adapter 和开发代理也改为跟随同一个默认 runtime 端口,外部 supervisor 和本地开发配置保持一致。"]},{version:"2.1.11",date:"2026-06-25",en:["Hive now includes a local Supervisor MCP adapter, so external agents can hand goals to the Hive Orchestrator and wait on durable structured goal events.","Orchestrators can report external goal progress, blocked states, failures, and completion with `team goal report`, while external supervisors still cannot directly spawn members, send member tasks, read raw scrollback, or write PTYs.","OpenCode startup input delivery is more reliable after completed turns and interrupt-status screens, and Codex prompt editing now preserves repaint frames after Backspace/Delete-style input."],zh:["Hive 现在包含本地 Supervisor MCP adapter,外部 agent 可以把目标交给 Hive Orchestrator,并通过持久化结构化 goal events 等待进度和结果。","Orchestrator 可以用 `team goal report` 回报 external goal 的进度、阻塞、失败和完成;外部 supervisor 仍不能直接 spawn 成员、给成员派单、读取原始 scrollback 或写 PTY。","OpenCode 在完成一轮和显示 interrupt 状态后的启动输入投递更可靠;Codex 在 Backspace/Delete 类输入后的提示行重绘也会被保留。"]},{version:"2.1.10",date:"2026-06-23",en:["One-click scenario teams now start their members immediately, so they are ready for the Orchestrator to assign work instead of appearing as stopped cards.","OpenCode members are more reliable after startup: Hive now recognizes OpenCode completed-turn footers as a safe dispatch point and asks members to acknowledge received dispatches.","Terminal panes now follow real run lifecycle events more closely, and Codex cursor repaint frames keep the final cursor position during editing."],zh:["一键场景组队现在会立即启动创建出的成员,成员不会再以 stopped 卡片停在那里,Orchestrator 可以直接派工。","OpenCode 成员启动后的派发更可靠:Hive 现在能识别 OpenCode 完成一轮后的 footer,并要求成员收到派单后先发出确认状态。","终端面板现在更贴近真实 run 生命周期;Codex 编辑时的光标刷新也会保留最终光标位置。"]},{version:"2.1.9",date:"2026-06-23",en:["Hive now gives Orchestrators a shorter startup prompt and points them to focused `team guide` topics when they need dispatch, task, memory, workflow, or member details.","Agent-facing language now consistently talks about Hive members, matching the product model you see in the UI.","This release also includes the Codex CJK backspace repaint fix and the cleaner desktop member-window outside-click close behavior."],zh:["Hive 现在给 Orchestrator 注入更短的启动提示,并在需要派单、任务、记忆、workflow 或成员细节时,引导它读取对应的 `team guide`。","面向 agent 的文案统一改为 Hive 成员口径,更贴近界面里的产品模型。","本次也包含 Codex 中文/CJK 删除键刷新修复,以及桌面端成员窗口点击外部关闭的更清爽交互。"]},{version:"2.1.8",date:"2026-06-23",en:["Codex terminals now repaint CJK input correctly when you press Backspace, so deleted characters disappear immediately instead of lingering on screen.","Desktop member windows no longer show a visible close button over the terminal corner; click outside the window to close it, while mobile keeps its full-screen close button."],zh:["Codex 终端现在能正确刷新中文/CJK 输入:按下删除键后,被删字符会立即从画面消失,不再残留。","桌面端成员窗口不再在终端右上角显示关闭按钮;点击窗口外即可关闭,移动端全屏窗口仍保留关闭按钮。"]},{version:"2.1.7",date:"2026-06-23",en:["Worker reports are now queued for durable redelivery when the Orchestrator is offline or restarting, so completed work is not silently lost.","Cancels, dismissed workers, and queued dispatch recovery now produce clearer outcomes when work can no longer be delivered.","User input now fails honestly when the Orchestrator terminal is offline instead of being recorded as if it had been sent.","Remote access has a stricter pairing boundary: phones cannot read or approve desktop-only pairing requests through the tunnel."],zh:["当 Orchestrator 离线或重启时,worker report 现在会进入持久化重投递队列,完成的工作不会再静默丢失。","取消任务、删除 worker 和排队派单恢复路径现在会给出更明确的结果,避免无法投递的工作一直悬着。","当 Orchestrator 终端离线时,用户输入现在会真实失败,不再被记录成已经发送。","远程访问的配对边界更严格:手机端不能通过 tunnel 读取或审批只能在桌面完成的新设备配对请求。"]},{version:"2.1.6",date:"2026-06-21",en:["Hive now shows a global package-update prompt when a newer npm version is available, so upgrade visibility is not limited to the topbar.","Newly started workers send a ready status after receiving Hive startup instructions, giving the Orchestrator a clearer signal that the member actually came online.","The Orchestrator pane no longer exposes a stop button in its chrome, reducing accidental shutdowns of the central coordinator.","Action Center now opens as a dedicated drawer with live workspace health, attention items, recent activity, and worker selection instead of a compact popover."],zh:["检测到新的 npm 版本时,Hive 现在会显示全局更新提示,不再只依赖顶部栏的小提示。","新启动的成员收到 Hive 启动指令后会主动发送 ready 状态,让 Orchestrator 更清楚成员已经真正上线。","Orchestrator 面板不再显示关闭按钮,降低误关中央协调者的风险。","Action Center 改为专用抽屉面板,集中展示 workspace 健康状态、待关注事项、最近动态和成员选择,不再使用紧凑 popover。"]},{version:"2.1.5",date:"2026-06-21",en:["Team memory is more ambient: the Memory drawer no longer asks you to review candidates, while active memory, archived entries, and Dream history stay available for audit.","Hive can now keep lightweight user preferences separately from workspace project facts, so personal working style does not pollute team knowledge.","Workflow and skill memories can point to structured procedure references instead of copying long instructions into memory text.","Dispatch memory retrieval is stricter about relevance, avoiding unrelated role-only matches when a worker receives a new task.","Dream consolidation can run in the background with transactional apply, source checks, isolated failures, and one-step revert."],zh:["团队记忆更低打扰:Memory 抽屉不再让你处理候选记忆,但 active 记忆、归档项和 Dream 历史仍可审计。","Hive 现在可以把轻量用户偏好与 workspace 项目事实分开保存,个人工作风格不会污染团队知识。","流程和 skill 类记忆可以引用结构化 procedure,不再把长流程说明直接塞进记忆正文。","派单记忆检索更严格,只在任务相关时注入,避免仅因 worker 角色匹配就带入无关记忆。","Dream 整理可在后台完成,带事务 apply、source window 校验、失败隔离和一键回滚。"]},{version:"2.1.4",date:"2026-06-21",en:["The first workspace screen is quieter: Hive no longer pushes an Orchestrator dispatch prompt before you have a concrete task.","Team activity is easier to scan, with dispatch pulse effects and queue-count badges removed from the visible UI.","The collapsed empty-workspace sidebar no longer shows a stray compact add button.","Maintainer release checks now use a faster package-focused default gate, with the full test gate still available for high-risk releases."],zh:["第一个 workspace 页面更安静:在你还没有明确任务前,Hive 不再主动提示 Orchestrator 派发工作。","团队动态更好扫读:可见 UI 里的派单脉冲和排队数量徽标已移除。","空 workspace 的折叠侧栏不再出现孤立的紧凑添加按钮。","维护者发布检查改为默认使用更快的打包发版闸门;高风险发版仍保留完整测试闸门。"]},{version:"2.1.3",date:"2026-06-18",en:["Hive now waits when first-run CLI setup screens are visible, so startup instructions no longer collide with trust, login, or confirmation prompts.","User input reports a real delivery failure if the Orchestrator terminal is offline.","Built-in role contracts and scenario/spawn defaults are language-aware, so English workspaces receive English worker prompts by default.","The demo is now a local self-running Hive replay with task progress, worker state changes, and team dispatch flow instead of an external video.","Release checks include a local CLI compatibility report for native modules and Tier-1 agent CLIs.","Settings now shows local-only retention diagnostics, and Memory keeps ambient Dream-maintained workspace knowledge without a candidate review surface."],zh:["首次运行 CLI 出现信任、登录或确认提示时,Hive 现在会等待,不再把启动指令盲注入到 onboarding 屏幕里。","如果 Orchestrator 终端已离线,用户输入会明确返回投递失败,而不是假装成功。","内置角色契约和场景/派生成员默认值已支持语言感知,英文 workspace 默认收到英文 worker prompt。","Demo 改成本地自运行 Hive replay,直接展示任务进度、worker 状态变化和团队派单流,不再依赖外部视频。","发布检查新增本地 CLI 兼容报告,覆盖原生模块和 Tier-1 agent CLI。","Settings 增加本地留存诊断;Memory 保持由 Dream 维护的低打扰工作区知识,不再展示人工复核入口。"]},{version:"2.1.2",date:"2026-06-16",en:["Newly spawned workers now wake correctly for their first team send instead of leaving the task parked in the stopped queue.","If a spawned worker is later stopped manually, Hive still keeps the normal queued-task behavior until you start that worker again.","Claude Code sessions on Windows are more tolerant of large Hive startup and dispatch injections, reducing premature submit or leftover input."],zh:["新建的 worker 现在会正确接住第一次 team send,不会把任务停在 stopped 队列里。","如果这个 worker 后续被手动停止,Hive 仍会保留正常的排队语义:任务等你再次启动该 worker 后再投递。","Windows 上的 Claude Code 会更稳地处理大段 Hive 启动与派单注入,减少过早回车或输入残留。"]},{version:"2.1.1",date:"2026-06-14",en:["Codex terminal input is smoother and more reliable when prompts are pasted or injected for an agent.","Action Center layout and interaction details are cleaner on narrow and mobile-sized screens."],zh:["Codex 终端在粘贴或注入 prompt 时输入更顺、更可靠。","活动中心在窄屏和手机尺寸下的布局与交互细节更干净。"]},{version:"2.1.0",date:"2026-06-13",en:["One-click scenario team assembly — spin up a ready-made team from a preset instead of adding members one by one.",'Team memory "Dream" consolidation now runs through your Orchestrator where you can see and review it, instead of a hidden background pass. Workers can be asked to review proposed changes, but only the Orchestrator commits them — and every run can be reverted in one step.',"Action Center adds a one-click copyable team recap and a diagnostics bundle, so sharing status and getting support is faster.","Dispatch pulse: a team send now visibly flows from the Orchestrator to the worker, so you can watch work being handed off.","The add-workspace dialog now guides you to install any missing CLI before you start.","More reliable dispatching: queued tasks replay when a worker starts, delivery failures notify the issuer instead of being lost, and team list shows open dispatches.","Remote/mobile fixes: large uploads over the tunnel no longer fail, and terminal scrolling is restored for CLIs launched through wrapper or legacy commands (such as Codex on Windows).","Hardened prompts and workflow runtime against prompt-injection, with clearer protocol errors and onboarding."],zh:["一键场景组队:从预设模板直接拉起一支现成团队,不用逐个添加成员。","团队记忆 Dream 整理改为经由 Orchestrator 执行,你能看到也能复核,不再后台静默处理。可让 worker 协助评审建议,但只有 Orchestrator 能提交,且每次整理都可一键回滚。","活动中心新增一键复制团队战报与诊断信息包,分享状态、寻求支持更快。","派单脉冲:team send 现在会从蜂后可视化地流向工蜂,派单交接一目了然。","添加 workspace 时,若缺少对应 CLI 会引导你先安装。","派单更可靠:worker 启动时重放排队任务、投递失败会通知发起方而不再丢失、team list 会列出未完成派单。","远程/移动端修复:隧道大文件上传不再失败;经包装或旧版命令启动的 CLI(如 Windows 上的 Codex)终端滚动已恢复。","强化了提示词与 workflow 运行时对提示注入的防护,协议报错与新手引导更清晰。"]},{version:"2.0.2",date:"2026-06-10",en:["Windows Codex terminals now keep the Codex-specific wheel scrolling behavior even when an older saved launch command points through node.exe and @openai/codex/bin/codex.js."],zh:["Windows 上的 Codex 终端滚轮修复:即使旧配置还通过 node.exe 和 @openai/codex/bin/codex.js 启动,Hive 也会继续使用 Codex 专用的滚轮翻页行为。"]},{version:"2.0.1",date:"2026-06-09",en:["Team memory is now available: Hive can keep useful workspace context and bring back prior decisions, constraints, and project notes when your team needs them.","The Memory and Workflows drawers have cleaner desktop and mobile layouts, clearer tabs, and a search field that stays out of the way on wide screens.","Worker cards are easier to scan, with clearer status styling, higher contrast, cleaner role text, and in-place rename instead of a separate edit dialog.","Pending dispatch status is clearer while the Orchestrator is coordinating queued or waiting worker activity.","The current remote/mobile build is now published under the original official @tt-a1i/hive package name."],zh:["团队记忆上线:Hive 可以保留有用的 workspace 上下文,并在团队需要时重新带回之前的决策、约束和项目笔记。","Memory 和 Workflows 抽屉做了桌面端与移动端布局优化,tab 更清楚,宽屏上的搜索框也更不挡内容。","Worker 卡片更容易扫读:状态样式更清晰、对比度更高、角色文字更干净,并改成卡片内直接重命名。","Orchestrator 协调排队或等待中的 worker 活动时,pending dispatch 状态显示更明确。","当前远程访问和移动端构建已通过原来的官方 @tt-a1i/hive 包名发布。"]},{version:"2.0.0",date:"2026-06-07",en:["Remote access is here, off by default: open your running Hive from a phone browser over an end-to-end encrypted tunnel, with the same authority as your local desktop browser.","The new gateway handles identity and routing only. It supports GitHub/Google sign-in, version-pinned mobile bundles, and self-hosting; your agents, terminals, workspaces, and project data stay on your computer.","Pairing is desktop-confirmed: create a short-lived pairing code on the computer, enter it on the phone, compare the 6-digit SAS code on both screens, then confirm on the desktop before the device is trusted.","Manage paired devices from Settings or the CLI: list devices, revoke one, drop a live remote session, and review the audit trail for remote requests and denials.","New CLI commands: hive remote login / status / logout / devices / revoke link the machine to a gateway account and manage trusted devices from the host.","The phone UI is the same Hive reflowed for a small screen: sign-in and machine selection, bottom navigation, workspace switching, full-screen Team / Tasks panels, reconnect banners, and update prompts.","Mobile terminals are writable directly in xterm. Worker terminals open full-screen, focus mode hides surrounding chrome while you work, and touch scrolling is smoother for shell output and faster in full-screen TUI agents.","Local-first behavior stays intact: Hive still works on 127.0.0.1 without any gateway, the tunnel is limited to Hive /api/* and /ws/*, and phones cannot approve new devices or turn Remote access back on."],zh:["远程访问上线,默认关闭:用手机浏览器通过端到端加密隧道打开正在本机运行的 Hive,权限与本地桌面浏览器等同。","新网关只做身份和路由:支持 GitHub / Google 登录、按版本固定的手机端 bundle、以及 self-host;Agent、终端、Workspace 和项目数据都留在你的电脑上。","配对必须由桌面确认:电脑生成短时配对码,手机输入后,两边显示同一个 6 位 SAS 短码;只有在电脑上确认后,新设备才会被信任。","可以在 Settings 或 CLI 里管理已配对设备:查看列表、吊销设备、立即断开正在连接的远程会话,并查看远程请求和拒绝记录的审计流水。","新增 CLI:hive remote login / status / logout / devices / revoke,可在本机完成网关联动和受信设备管理。","手机 UI 是同一个 Hive 的小屏重排:登录与机器选择、底部导航、Workspace 切换、全屏 Team / Tasks 面板、重连提示和更新提示。","移动端终端可以直接在 xterm 里输入。成员终端全屏打开,focus mode 会隐藏周边 chrome;shell 输出滚动更顺,全屏 TUI agent 里的触摸滚动也更跟手。","本地优先不变:没有网关时 Hive 仍照常运行在 127.0.0.1;隧道只允许访问 Hive 自己的 /api/* 和 /ws/*;手机不能批准新设备,也不能在关闭远程后自行重新开启。"]},{version:"1.7.0",date:"2026-06-05",en:["Hermes is now a built-in CLI agent preset alongside Claude Code, Codex, OpenCode, and Gemini — usable as Orchestrator or Worker, via team spawn --cli hermes, and in workflows.","Hermes sessions survive crashes: Hive captures the session id from the CLI startup output and resumes with --resume on restart.","Existing installs get the new preset automatically — just have hermes on your PATH."],zh:["Hermes 成为第五个内置 CLI agent preset,与 Claude Code、Codex、OpenCode、Gemini 并列 —— 可当 Orchestrator 或 Worker,支持 team spawn --cli hermes 和 workflow。","Hermes 会话可在崩溃后恢复:Hive 从 CLI 启动输出捕获 session id,重启时用 --resume 续上。","已有安装会自动获得新 preset —— 只要 PATH 里有 hermes 即可。"]},{version:"1.6.0",date:"2026-06-02",en:["A Stop button on the running Orchestrator lets you halt a runaway agent straight from the UI.","Worker cards now show queue depth and the latest activity line, and the working badge explains that Hive does not auto-detect stalls — check the terminal.","Worker reports are no longer lost when the Orchestrator is down or restarting; they are queued and redelivered automatically.","Deliberately stopping and restarting the Orchestrator no longer replays a stale crash-recovery handover.","A new completion webhook can POST to a URL you choose (Slack, ntfy, Feishu, …) when a worker reports or a workflow finishes.","Workflow agent() gains opt-in structured output via outputSchema, and the new team next lists tasks unblocked by [needs:] dependencies in tasks.md."],zh:["运行中的 Orchestrator 面板新增 Stop 按钮,可以直接在 UI 里停掉跑飞的 agent。","Worker 卡片现在显示队列数和最近活动行;working 状态会说明 Hive 不会自动检测卡死 —— 以终端为准。","Orchestrator 掉线或重启时,Worker 的汇报不再丢失,会自动排队并补投。","手动停止后再重启 Orchestrator,不会再灌入陈旧的崩溃恢复接管。","新增完成通知 Webhook:Worker 汇报或 Workflow 完成时,向你设置的 URL POST(可接 Slack、ntfy、飞书等)。","Workflow 的 agent() 支持 outputSchema 结构化输出;新增 team next 可列出 tasks.md 里被 [needs:] 解除阻塞、当前可做的任务。"]},{version:"1.5.0",date:"2026-05-31",en:["Experimental Workflows let the Orchestrator run multi-agent plans across real Hive workers, with run details, logs, stop controls, and schedules in the Workflows drawer.","Workflow-created agents can now follow your selected default CLI and allowed CLI policy instead of always falling back to Claude Code.","Experimental auto-staff can let the Orchestrator size the worker roster to the task and create task-scoped coders, testers, or reviewers.","Codex dispatches stay reliable for long pasted tasks, while short worker reports now submit quickly instead of waiting several seconds in the input box.","Runtime hardening covers malformed WebSocket frames, Windows Codex startup paths, and workflow worker cleanup edge cases."],zh:["实验性的 Workflows 可以让 Orchestrator 用真实 Hive Worker 执行多 Agent 计划,并在 Workflows 抽屉里查看详情、日志、停止控制和定时任务。","Workflow 创建的 Agent 现在会遵守你选择的默认 CLI 和允许列表,不再总是回退到 Claude Code。","实验性的自动组队可以让 Orchestrator 按任务规模创建临时 coder、tester 或 reviewer。","Codex 的长任务粘贴仍保持可靠;短的 Worker 汇报现在会快速提交,不再在输入框里等好几秒。","运行时加固覆盖了异常 WebSocket 帧、Windows Codex 启动路径和 Workflow Worker 清理等边界情况。"]},{version:"1.4.4",date:"2026-05-30",en:["Windows .cmd and .bat startup commands now launch reliably, including quoted nvm4w and Program Files paths.","Worker shutdown is more robust on Windows, with process-tree cleanup before PTY termination.","Folder picking, filesystem browsing, editor launch, hive update, and port recovery are friendlier on Windows.","Task files keep CRLF line endings, and the watcher handles atomic-save editors more gracefully."],zh:["Windows 上的 .cmd / .bat 启动命令更可靠,包括带引号的 nvm4w 和 Program Files 路径。","Windows 下 Worker 关闭更稳,会先清理进程树再终止 PTY。","文件夹选择、文件浏览、编辑器打开、hive update 和端口占用恢复在 Windows 上更顺手。","任务文件会保留 CRLF 换行,watcher 对原子保存编辑器也更宽容。"]}],kb=t=>{const[a="",o=""]=t.split("-",2),[s=0,l=0,u=0]=a.split(".").map(f=>Number.parseInt(f,10)||0);return{core:[s,l,u],prerelease:o}},Lf=(t,a)=>{const o=kb(t),s=kb(a);for(let l=0;l<3;l+=1){const u=(o.core[l]??0)-(s.core[l]??0);if(u!==0)return u}return o.prerelease===s.prerelease?0:o.prerelease?s.prerelease?o.prerelease.localeCompare(s.prerelease,void 0,{numeric:!0}):-1:1},i5=(t,a,o=s5)=>{if(a===null)return{show:!1,entries:[],seedOnly:!0};if(Lf(t,a)<=0)return{show:!1,entries:[],seedOnly:!1};const s=o.filter(l=>Lf(l.version,a)>0&&Lf(l.version,t)<=0);return s.length===0?{show:!1,entries:[],seedOnly:!0}:{show:!0,entries:s,seedOnly:!1}},Px="hive.last-seen-version",l5="1.7.0",c5=(t,a)=>{try{const o=window.localStorage.getItem(Px);return o||(a?l5:null)}catch{return t}},Sb=t=>{try{window.localStorage.setItem(Px,t)}catch{}},u5=({hasExistingWorkspace:t,wizardOpen:a})=>{const o=tp,[s,l]=y.useState(void 0);y.useEffect(()=>{s!==void 0||t===null||l(c5(o,t))},[t,s]);const u=y.useMemo(()=>s===void 0?{show:!1,entries:[],seedOnly:!1}:i5(o,s),[s]),[f,m]=y.useState(!1);y.useEffect(()=>{u.seedOnly&&Sb(o)},[u.seedOnly]);const g=y.useCallback(()=>{Sb(o),m(!0)},[]);return{open:u.show&&!f&&!a,entries:u.entries,close:g}},Eb="hive.first-run-seen",d5=()=>{const[t,a]=y.useState(()=>{try{return window.localStorage.getItem(Eb)==="1"}catch{return!0}}),o=y.useCallback(()=>{try{window.localStorage.setItem(Eb,"1")}catch{}a(!0)},[]);return{seen:t,markSeen:o}},f5=t=>{const{seen:a,markSeen:o}=d5(),[s,l]=y.useState(!1);y.useEffect(()=>{!a&&t!==null&&t.length===0&&l(!0)},[a,t]);const u=y.useCallback((f=!0)=>{f&&o(),l(!1)},[o]);return{wizardOpen:s,closeWizard:u}},zf=(t,a)=>t.findIndex(s=>s.id===a.id)===-1?[...t,a]:t.map(s=>s.id===a.id?a:s),Fx=t=>t==="codex"?"codex":t==="grok"?"grok":t==="opencode"?"opencode":"default",Cb=(t,a)=>Fx(t.find(o=>o.id===a)?.commandPresetId),Is=t=>t instanceof Error?t.message:String(t),m5=({activeWorkspaceId:t,onWorkerDeleted:a,onWorkerStartFailed:o,onWorkerRunStarted:s,onWorkerRunClosed:l,setWorkersByWorkspaceId:u,workers:f})=>{const{language:m}=be(),g=y.useCallback(async({avatar:S,commandPresetId:w,name:C,role:T,roleDescription:N,startupCommand:j})=>{if(!t)return{error:"No active workspace",runId:null};const A=j.trim(),O=await xN(t,{autostart:!1,avatar:S??null,command_preset_id:w||null,description:N.trim(),name:C,role:T,startup_command:A||null,ui_language:m});u(L=>({...L,[t]:zf(L[t]??[],{...O.worker,status:"idle"})}));const D=t;return ei(D,O.worker.id).then(L=>{s?.({agentId:O.worker.id,agentName:O.worker.name,runId:L.runId,terminalInputProfile:Fx(w),workspaceId:D})}).catch(L=>{const P=Is(L);console.error("[hive] swallowed:createWorker.start",L),u(J=>({...J,[D]:zf(J[D]??[],{...O.worker,status:"stopped"})})),o?.(P)}),{error:null,runId:null}},[t,m,s,o,u]),p=y.useCallback(async S=>{if(!t)throw new Error("No active workspace");await SN(t,S),u(w=>({...w,[t]:(w[t]??[]).filter(C=>C.id!==S)})),a?.(t,S)},[t,a,u]),b=y.useCallback(async(S,w)=>{if(!t)return{error:"No active workspace"};try{const C=await CN(t,S,w);return u(T=>({...T,[t]:zf(T[t]??[],C)})),{error:null}}catch(C){return{error:Is(C)}}},[t,u]),v=y.useCallback(async S=>{if(!t)return{error:"No active workspace",runId:null};try{const w=await ei(t,S);return s?.({agentId:S,agentName:S,runId:w.runId,terminalInputProfile:Cb(f,S),workspaceId:t}),{error:null,runId:w.runId}}catch(w){return{error:Is(w),runId:null}}},[t,s,f]),k=y.useCallback(async S=>{if(!t)return{error:"No active workspace"};try{return await nc(S),l?.(t,S),{error:null}}catch(w){return{error:Is(w)}}},[t,l]),E=y.useCallback(async(S,w)=>{if(!t)return{error:"No active workspace",runId:null};try{const C=await rN(t,S,w);return l?.(t,w),s?.({agentId:S,agentName:S,runId:C.runId,terminalInputProfile:Cb(f,S),workspaceId:t}),{error:null,runId:C.runId}}catch(C){return{error:Is(C),runId:null}}},[t,l,s,f]);return{createWorker:g,deleteWorker:p,updateWorkerAvatar:b,startWorker:v,stopWorkerRun:k,restartWorkerRun:E}},ap={mac:["vscode","vscode-insiders","cursor","finder","terminal","ghostty","zed"],windows:["vscode","vscode-insiders","cursor","finder","zed"],linux:["vscode","vscode-insiders","cursor","finder","zed"],other:["vscode","vscode-insiders","finder"]},p5=new Set(ap.mac),h5=t=>typeof t=="string"&&p5.has(t),Kx=(t,a)=>ap[a].includes(t),Yx=t=>t==="mac"||t==="windows"||t==="linux"?"finder":"vscode",g5="data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='%23FFFFFF'%20d='M11.503.131%201.891%205.678a.84.84%200%200%200-.42.726v11.188c0%20.3.162.575.42.724l9.609%205.55a1%201%200%200%200%20.998%200l9.61-5.55a.84.84%200%200%200%20.42-.724V6.404a.84.84%200%200%200-.42-.726L12.497.131a1.01%201.01%200%200%200-.996%200M2.657%206.338h18.55c.263%200%20.43.287.297.515L12.23%2022.918c-.062.107-.229.064-.229-.06V12.335a.59.59%200%200%200-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23'/%3e%3c/svg%3e",Hf="data:image/svg+xml,%3csvg%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='5'%20y='13'%20width='54'%20height='40'%20rx='8'%20fill='%23F2B73B'/%3e%3cpath%20d='M5%2021C5%2016.58%208.58%2013%2013%2013H25.2C27.2%2013%2029.1%2013.94%2030.3%2015.54L33.2%2019.4H51C55.42%2019.4%2059%2022.98%2059%2027.4V31H5V21Z'%20fill='%23FFD565'/%3e%3cpath%20d='M8%2027H56C58.76%2027%2061%2029.24%2061%2032V49C61%2051.76%2058.76%2054%2056%2054H8C5.24%2054%203%2051.76%203%2049V32C3%2029.24%205.24%2027%208%2027Z'%20fill='%23F8C344'/%3e%3cpath%20d='M8%2032C8%2030.9%208.9%2030%2010%2030H54C55.1%2030%2056%2030.9%2056%2032V48C56%2049.1%2055.1%2050%2054%2050H10C8.9%2050%208%2049.1%208%2048V32Z'%20fill='%23F4B43B'/%3e%3cpath%20d='M10%2031H54C55.1%2031%2056%2031.9%2056%2033V36H8V33C8%2031.9%208.9%2031%2010%2031Z'%20fill='%23FFE082'/%3e%3cpath%20d='M12%2037H52C53.1%2037%2054%2037.9%2054%2039V47C54%2048.1%2053.1%2049%2052%2049H12C10.9%2049%2010%2048.1%2010%2047V39C10%2037.9%2010.9%2037%2012%2037Z'%20fill='%23F0A82F'/%3e%3c/svg%3e",$x="/assets/finder-C4Jmsb0B.png",v5="/assets/ghostty-D-Js4rdm.png",y5="data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='4'%20fill='%232D2D2E'/%3e%3cpath%20d='M6.5%209%20L10%2012%20L6.5%2015'%20stroke='%23FFFFFF'%20stroke-width='1.7'%20fill='none'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cline%20x1='12.5'%20y1='15.5'%20x2='17.5'%20y2='15.5'%20stroke='%23FFFFFF'%20stroke-width='1.7'%20stroke-linecap='round'/%3e%3c/svg%3e",b5="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23007ACC'%20d='M22%205.75v12.48c0%20.49-.28.94-.72%201.15-.91.43-2.46%201.18-3.33%201.59.03-.16.05-.33.05-.5V3.53C18%203.3%2017.97%203.12%2017.94%203c.94.46%202.44%201.18%203.33%201.6C21.72%204.81%2022%205.26%2022%205.75zM3.91%2013.35c.89.8%201.73%201.56%202.51%202.28l-1.48%201.12c-.37.28-.89.27-1.25-.03l-.94-.79c-.46-.39-.48-1.09-.03-1.5C3.05%2014.13%203.46%2013.76%203.91%2013.35zM16%203.53v4.81l-3.16%202.4-3.3-2.5c2.29-2.07%204.46-4.05%205.59-5.1.23-.22.56-.16.74.04.05.06.09.13.11.22C15.99%203.44%2016%203.48%2016%203.53zM16%2020.47v-4.81L4.938%207.252c-.372-.283-.889-.27-1.247.03L2.754%208.066C2.289%208.456%202.271%209.162%202.72%209.569c2.747%202.488%209.998%209.06%2012.41%2011.291C15.462%2021.167%2016%2020.93%2016%2020.47z'/%3e%3c/svg%3e",w5="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%2324BFA5'%20d='M22%205.75v12.48c0%20.49-.28.94-.72%201.15-.91.43-2.46%201.18-3.33%201.59.03-.16.05-.33.05-.5V3.53C18%203.3%2017.97%203.12%2017.94%203c.94.46%202.44%201.18%203.33%201.6C21.72%204.81%2022%205.26%2022%205.75zM3.91%2013.35c.89.8%201.73%201.56%202.51%202.28l-1.48%201.12c-.37.28-.89.27-1.25-.03l-.94-.79c-.46-.39-.48-1.09-.03-1.5C3.05%2014.13%203.46%2013.76%203.91%2013.35zM16%203.53v4.81l-3.16%202.4-3.3-2.5c2.29-2.07%204.46-4.05%205.59-5.1.23-.22.56-.16.74.04.05.06.09.13.11.22C15.99%203.44%2016%203.48%2016%203.53zM16%2020.47v-4.81L4.938%207.252c-.372-.283-.889-.27-1.247.03L2.754%208.066C2.289%208.456%202.271%209.162%202.72%209.569c2.747%202.488%209.998%209.06%2012.41%2011.291C15.462%2021.167%2016%2020.93%2016%2020.47z'/%3e%3c/svg%3e",x5="/assets/zed-C5BQT8X3.png",k5={mac:"openWorkspace.target.finder.mac",windows:"openWorkspace.target.finder.windows",linux:"openWorkspace.target.finder.linux",other:"openWorkspace.target.finder.linux"},S5={mac:$x,windows:Hf,linux:Hf,other:Hf},zc={vscode:{labelKey:"openWorkspace.target.vscode",iconSrc:b5},"vscode-insiders":{labelKey:"openWorkspace.target.vscodeInsiders",iconSrc:w5},cursor:{labelKey:"openWorkspace.target.cursor",iconSrc:g5},finder:{labelKey:"openWorkspace.target.finder.mac",iconSrc:$x},terminal:{labelKey:"openWorkspace.target.terminal",iconSrc:y5},ghostty:{labelKey:"openWorkspace.target.ghostty",iconSrc:v5,iconScale:1.2},zed:{labelKey:"openWorkspace.target.zed",iconSrc:x5}},Vx=(t,a)=>t==="finder"?k5[a]:zc[t].labelKey,Gx=(t,a)=>t==="finder"?S5[a]:zc[t].iconSrc,Uf=(t,a)=>{const o=Kx(t,a)?t:Yx(a),s=zc[o];return{id:o,iconSrc:Gx(o,a),labelKey:Vx(o,a),...s.iconScale!==void 0?{iconScale:s.iconScale}:{}}},E5=t=>ap[t].map(a=>{const o=zc[a];return{id:a,iconSrc:Gx(a,t),labelKey:Vx(a,t),...o.iconScale!==void 0?{iconScale:o.iconScale}:{}}}),C5=()=>{if(typeof navigator>"u")return"other";const t=`${navigator.userAgent} ${navigator.platform}`.toLowerCase();return t.includes("mac")||t.includes("darwin")?"mac":t.includes("win")?"windows":t.includes("linux")||t.includes("x11")?"linux":"other"},Xx="hive.openTarget.preferred",T5=()=>{try{return window.localStorage.getItem(Xx)}catch{return null}},N5=t=>{const a=Yx(t);if(typeof window>"u")return a;const o=T5();if(!o)return a;const s=o==="ghostie"?"ghostty":o;return h5(s)&&Kx(s,t)?s:a},j5=t=>{try{window.localStorage.setItem(Xx,t)}catch{}},A5={"app-not-installed":"openWorkspace.error.appNotInstalled","command-not-in-path":"openWorkspace.error.commandNotInPath","invalid-path":"openWorkspace.error.invalidPath","invalid-target":"openWorkspace.error.invalidTarget",unknown:"openWorkspace.error.unknown"},_5=({workspace:t})=>{const{t:a}=be(),{mode:o}=hw(),s=sn(),l=y.useMemo(()=>C5(),[]),u=E5(l),[f,m]=y.useState(()=>N5(l)),[g,p]=y.useState(!1),[b,v]=y.useState(!1),k=y.useRef(null),E=y.useRef(null),S=Uf(f,l),w=a(S.labelKey);y.useEffect(()=>{if(!g)return;const D=P=>{P.key==="Escape"&&p(!1)},L=P=>{const J=k.current;J&&!J.contains(P.target)&&p(!1)};return document.addEventListener("keydown",D),document.addEventListener("pointerdown",L),()=>{document.removeEventListener("keydown",D),document.removeEventListener("pointerdown",L)}},[g]);const C=y.useCallback(D=>{m(D),j5(D),p(!1),E.current?.focus()},[]),T=y.useCallback(async()=>{if(!(!t||b)){v(!0);try{const D=await NN(t.id,f);if(D.ok){if(o==="mobile"){const L=Uf(D.effectiveTargetId,l).labelKey;s.show({kind:"success",message:a("openWorkspace.opened",{app:a(L),workspace:t.name})})}}else{const L=Uf(D.effectiveTargetId,l).labelKey;s.show({kind:"error",message:a(A5[D.errorCode],{app:a(L)})})}}catch(D){const L=D instanceof Error?D.message:String(D);s.show({kind:"error",message:L})}finally{v(!1)}}},[b,o,l,f,a,s,t]),N=!t,j=a("openWorkspace.noWorkspace"),A=t?a("openWorkspace.openIn",{app:w,workspace:t.name}):j,O=t?a("openWorkspace.openInAria",{app:w,workspace:t.name}):j;return c.jsxs("div",{ref:k,className:"open-workspace relative flex",children:[c.jsx(Je,{label:A,children:c.jsx("span",{className:"flex",children:c.jsxs("button",{ref:E,type:"button","aria-label":O,"data-testid":"topbar-open-workspace",disabled:N||b,onClick:()=>{T()},className:"open-workspace__main",children:[c.jsx("span",{className:"open-workspace__trigger-icon","aria-hidden":!0,children:b?c.jsx(Ja,{size:13,className:"animate-spin"}):c.jsx("img",{src:S.iconSrc,alt:"",className:"open-workspace__trigger-img",style:{transform:S.iconScale?`scale(${S.iconScale})`:void 0}})}),c.jsx("span",{children:a("openWorkspace.open")})]})})}),c.jsx(Je,{label:a("openWorkspace.selectTarget"),children:c.jsx("button",{type:"button","aria-label":a("openWorkspace.selectTarget"),"aria-haspopup":"menu","aria-expanded":g,"data-testid":"topbar-open-workspace-chevron",disabled:N,onClick:()=>p(D=>!D),className:"open-workspace__chevron",children:c.jsx(qo,{size:12,"aria-hidden":!0})})}),g?c.jsx("div",{role:"menu","aria-label":a("openWorkspace.selectTarget"),className:"open-workspace__menu elev-2","data-testid":"topbar-open-workspace-menu",children:u.map(D=>{const L=D.id===f;return c.jsxs("button",{role:"menuitemradio","aria-checked":L,type:"button",onClick:()=>C(D.id),className:"open-workspace__option","data-selected":L?"true":void 0,"data-testid":`topbar-open-workspace-option-${D.id}`,children:[c.jsx("span",{className:"open-workspace__option-icon","aria-hidden":!0,children:c.jsx("img",{src:D.iconSrc,alt:"",className:"open-workspace__option-img",style:{transform:D.iconScale?`scale(${D.iconScale})`:void 0}})}),c.jsx("span",{className:"flex-1",children:a(D.labelKey)}),c.jsx("span",{className:"open-workspace__check","aria-hidden":!0,children:L?c.jsx(ga,{size:13}):null})]},D.id)})}):null]})},R5=y.lazy(()=>Mt(()=>import("./WorkflowsDrawer-_JG5sK9V.js"),__vite__mapDeps([5,4])).then(t=>({default:t.WorkflowsDrawer}))),O5=y.lazy(()=>Mt(()=>import("./WorkspaceMemoryDrawer-CmesL_Hn.js"),__vite__mapDeps([6,3])).then(t=>({default:t.WorkspaceMemoryDrawer}))),D5=()=>{const[t,a]=y.useState(null),{activeWorkspaceId:o,selectWorkspace:s,setActiveWorkspaceId:l}=j4(),{demoMode:u,enableDemo:f,exitDemo:m}=MR(),g=u||!t?[]:t.map(({id:Se})=>Se),[p,b]=M4(g,{activeWorkspaceId:o}),[v,k]=y.useState(0),[E,S]=y.useState(!1),[w,C]=y.useState(!1),[T,N]=y.useState(!1),[j,A]=y.useState(null),[O,D]=y.useState("team"),L=s3(),P=sn(),J=jx(),{wizardOpen:Q,closeWizard:$}=f5(t),F=u5({hasExistingWorkspace:t===null?null:t.length>0,wizardOpen:Q}),Z=Cx().enabled;y.useEffect(()=>{Z||(N(!1),D(Se=>Se==="flows"?"team":Se))},[Z]);const q=y.useCallback(()=>k(Se=>Se+1),[]),[M,U]=y.useState(null),W=y.useCallback(Se=>{U(Se),P.show({kind:"error",message:Se})},[P]);S4(a,l,W);const V=LR({demoMode:u,workspaces:t,activeWorkspaceId:o,workersByWorkspaceId:p}),R=V.effectiveActiveWorkspace?.id,B=R?V.effectiveWorkersByWorkspaceId[R]??[]:[];y.useEffect(()=>{A(Se=>Se&&B.some(nt=>nt.id===Se)?Se:null)},[B]);const se=C_(V.pollWorkspaceId),re=s4(V.pollWorkspaceId,se,B),ce=C4({onWorkspaceCreated:Se=>{a(nt=>nt===null?[Se]:[...nt,Se]),s(Se.id),b(nt=>({...nt,[Se.id]:[]}))},onError:Se=>P.show({kind:"error",message:Se}),onOrchestratorRunStarted:(Se,nt)=>re.recordOptimisticRun({agentId:Qm(Se),agentName:"Orchestrator",runId:nt,status:"starting",workspaceId:Se})});O3(!0);const fe=o4(u?null:o??null,u?DR:void 0),ue=y.useMemo(()=>V.effectiveActiveWorkspace?Q3(fe.content):0,[V.effectiveActiveWorkspace,fe.content]),le=m5({activeWorkspaceId:o,onWorkerDeleted:re.forgetOptimisticAgent,onWorkerRunClosed:re.forgetOptimisticRun,onWorkerStartFailed:Se=>P.show({kind:"error",message:Se}),onWorkerRunStarted:re.recordOptimisticRun,setWorkersByWorkspaceId:b,workers:B}),ie=N4({activeWorkspaceId:o,onActiveDeleted:()=>{C(!1),S(!1),N(!1)},selectWorkspace:s,setWorkersByWorkspaceId:b,setWorkspaces:a,workspaces:t});y4({bootstrapError:M,onSelectWorkspace:s,onTriggerAddDialog:q,workspaces:V.effectiveWorkspaces}),q3({onAddWorkspace:q,onTryDemo:f,ready:u||t!==null||M!==null});const xe=E4(),Ne=M!==null&&!u&&t===null,he=yt(),we=y.useSyncExternalStore(l4,c4),Ce=he?c.jsx(c3,{status:we}):null,Ae=R?re.optimisticRunsByWorkspaceId[R]??[]:[],dt=!Ne&&!u&&R!==void 0&&(re.terminalRuns.length>0||Ae.length>0)?c.jsx(o5,{onTerminalRunExited:re.forgetOptimisticRun,optimisticRuns:Ae,terminalRuns:re.terminalRuns,workspaceId:R},`terminal-${R}`):null,wn=Ne?c.jsx(M3,{onTryDemo:f}):c.jsx(RR,{activeId:R,activeWorkspace:V.effectiveActiveWorkspace,activeWorkerId:j,bootstrapError:M,demoMode:u,workspacesLoading:!u&&t===null,onActiveWorkerChange:A,onDeleteWorkspace:ie,onExitDemo:m,onOrchestratorRunClosed:re.forgetOptimisticRun,onRequestAddWorkspace:q,onShellRunClosed:re.forgetOptimisticRun,onShellRunStarted:(Se,nt)=>re.recordOptimisticRun({agentId:nt.agent_id,agentName:nt.agent_name,runId:nt.run_id,status:nt.status,terminalInputProfile:nt.terminal_input_profile??"default",workspaceId:Se}),onTryDemo:f,orchestratorAutostartErrors:ce.orchestratorAutostartErrors,recordOrchestratorResult:ce.recordOrchestratorResult,terminalRuns:re.terminalRuns,workerActions:le,workers:B,showInlineActionCenter:he}),Nt=c.jsx(gS,{addDialogTrigger:v,wizardOpen:Q,whatsNewOpen:F.open,whatsNewEntries:F.entries,onCloseWhatsNew:F.close,onAddWorkspace:q,onCloseTaskGraph:()=>S(!1),onCloseWizard:$,onCreateWorkspace:ce.createNewWorkspace,onTryDemo:f,taskGraphOpen:E,tasksFile:fe,workspacePath:V.effectiveActiveWorkspace?.path??null,workers:B,onSelectOwner:xe}),Fn=T&&!u&&Z?c.jsx(y.Suspense,{fallback:null,children:c.jsx(R5,{open:!0,onClose:()=>N(!1),workspaceId:o??null})}):null,ft=w&&!u?c.jsx(y.Suspense,{fallback:null,children:c.jsx(O5,{open:!0,onClose:()=>C(!1),workspaceId:o??null})}):null,zt=c.jsx(V3,{activeWorkspaceId:V.effectiveActiveWorkspaceId,collapsed:L.collapsed,createDisabledReason:M??void 0,onCreateClick:q,onDeleteWorkspace:ie,onSelectWorkspace:s,onToggleCollapse:L.toggleCollapsed,workersByWorkspaceId:V.effectiveWorkersByWorkspaceId,workspaces:V.effectiveWorkspaces}),ln=c.jsxs(c.Fragment,{children:[c.jsx(_5,{workspace:V.effectiveActiveWorkspace}),Ne||u||!R?null:c.jsx(GA,{workspaceId:R,onOpenWorker:A},R)]});return he?c.jsxs(c.Fragment,{children:[c.jsx(x3,{workspaceSwitcher:Ne?void 0:c.jsx(N3,{activeWorkspaceId:V.effectiveActiveWorkspaceId,workspaces:V.effectiveWorkspaces,workersByWorkspaceId:V.effectiveWorkersByWorkspaceId,createDisabledReason:M??void 0,onCreateClick:q,onDeleteWorkspace:ie,onSelectWorkspace:s}),topbarActions:Ne?void 0:c.jsx(c.Fragment,{children:c.jsx(Nx,{})}),openTaskCount:ue,workingCount:B.filter(Se=>Se.status==="working").length,banner:Ce,terminalPanels:dt,fullBleed:Ne?wn:void 0,team:Ne?null:wn,tasks:Ne?null:c.jsx(E3,{tasksFile:fe,workspacePath:V.effectiveActiveWorkspace?.path??null,workers:B,onSelectOwner:xe,onAddWorkspace:q,demoMode:u}),settings:Ne||!u?void 0:c.jsx(m3,{demoMode:u,onTryDemo:f,onExitDemo:m}),activeSection:O,onSectionChange:D,overlays:Nt}),c.jsx(db,{versionInfo:J}),c.jsx(cb,{terminalRuns:re.terminalRuns}),c.jsx(ub,{})]}):c.jsxs(c.Fragment,{children:[c.jsxs(i3,{hideTopbarActions:!V.effectiveActiveWorkspace,memoryOpen:w,onToggleMemory:u?void 0:()=>C(Se=>!Se),onToggleTaskGraph:()=>S(Se=>!Se),openTaskCount:ue,topbarActions:ln,taskGraphOpen:E,onToggleWorkflows:u||!Z?void 0:()=>N(Se=>!Se),workflowsOpen:T,sidebarResize:L,sidebar:zt,versionInfo:J,children:[wn,dt,Nt,ft,Fn]}),c.jsx(db,{versionInfo:J}),c.jsx(cb,{terminalRuns:re.terminalRuns}),c.jsx(ub,{}),c.jsx(R3,{})]})},M5={success:s0,warning:Js,error:YS},Bf={success:"var(--status-green)",warning:"var(--status-orange)",error:"var(--status-red)"},Tb=({toast:t,api:a})=>{const{t:o}=be(),s=M5[t.kind],l=a.getDuration(t.id);return c.jsxs("div",{"data-testid":"toast","data-kind":t.kind,onMouseEnter:()=>a.pauseDismiss(t.id),onMouseLeave:()=>a.resumeDismiss(t.id),className:"toast elev-2 toast-pop pointer-events-auto relative flex min-w-[260px] max-w-[400px] items-start gap-3 overflow-hidden rounded-lg border px-3 py-2.5",style:{background:"var(--bg-elevated)",borderColor:`color-mix(in oklab, ${Bf[t.kind]} 35%, var(--border))`},children:[c.jsx("span",{className:"mt-0.5 shrink-0",style:{color:Bf[t.kind]},"aria-hidden":!0,children:c.jsx(s,{size:14})}),c.jsx("div",{className:"min-w-0 flex-1 break-words text-sm text-pri",children:t.message}),c.jsx("button",{type:"button","data-testid":"toast-close",onClick:()=>a.dismiss(t.id),className:"-mt-0.5 -mr-1 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-ter transition-colors hover:bg-3 hover:text-pri","aria-label":o("toast.dismissAria"),children:c.jsx(fa,{size:14,"aria-hidden":!0})}),l>0?c.jsx("span",{className:"toast-progress-bar",style:{background:Bf[t.kind],animationDuration:`${l}ms`},"aria-hidden":!0}):null]})},L5=()=>{const t=PA(),a=sn(),o=yt();if(t.length===0)return null;const s=t.filter(u=>u.kind==="error"),l=t.filter(u=>u.kind!=="error");return c.jsxs("div",{className:"toaster pointer-events-none fixed right-4 bottom-8 z-50 flex flex-col gap-2","data-mobile":o||void 0,"data-testid":"toaster",children:[c.jsx("div",{role:"status","aria-live":"polite",className:"flex flex-col gap-2",children:l.map(u=>c.jsx(Tb,{toast:u,api:a},u.id))}),c.jsx("div",{role:"alert","aria-live":"assertive",className:"flex flex-col gap-2",children:s.map(u=>c.jsx(Tb,{toast:u,api:a},u.id))})]})},z5=({children:t})=>c.jsx($w,{delayDuration:250,skipDelayDuration:150,children:c.jsx(dC,{children:c.jsx(qA,{children:c.jsx(r_,{children:c.jsx(QR,{children:c.jsx(XR,{children:c.jsxs(YR,{children:[t,c.jsx(L5,{})]})})})})})})}),H5=()=>c.jsx(JN,{children:c.jsx(z5,{children:c.jsx(D5,{})})}),Nb="\0gw:",Ar={Unauthorized:4401,Forbidden:4403,DaemonOffline:4404,Revoked:4410,InternalError:4500},Zx="hb:ping",Qx="hb:pong",U5=t=>t===Ar.Unauthorized||t===Ar.Revoked;function B5(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function hm(t){if(typeof t!="boolean")throw new TypeError(`boolean expected, not ${t}`)}function Mo(t){if(typeof t!="number")throw new TypeError("number expected, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError("positive integer expected, got "+t)}function _t(t,a,o=""){const s=B5(t),l=t?.length,u=a!==void 0;if(!s||u&&l!==a){const f=o&&`"${o}" `,m=u?` of length ${a}`:"",g=s?`length=${l}`:`type=${typeof t}`,p=f+"expected Uint8Array"+m+", got "+g;throw s?new RangeError(p):new TypeError(p)}return t}function jb(t,a=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(a&&t.finished)throw new Error("Hash#digest() has already been called")}function W5(t,a,o=!1){_t(t,void 0,"output");const s=a.outputLen;if(t.length<s)throw new RangeError("digestInto() expects output buffer of length at least "+s);if(o&&!oi(t))throw new Error("invalid output, must be aligned")}function da(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Za(...t){for(let a=0;a<t.length;a++)t[a].fill(0)}function I5(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const _r=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Jx=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,At=_r?t=>t:t=>Jx(t)>>>0,q5=t=>{for(let a=0;a<t.length;a++)t[a]=Jx(t[a]);return t},Ga=_r?t=>t:q5;function P5(t,a){if(a==null||typeof a!="object")throw new Error("options must be defined");return Object.assign(t,a)}function F5(t,a){if(t.length!==a.length)return!1;let o=0;for(let s=0;s<t.length;s++)o|=t[s]^a[s];return o===0}function K5(t,a,o){const s=a,l=(()=>[]),u=(m,g)=>s(g,...l(m)).update(m).digest(),f=s(new Uint8Array(t),...l(new Uint8Array(0)));return u.outputLen=f.outputLen,u.blockLen=f.blockLen,u.create=(m,...g)=>s(m,...g),u}const Y5=(t,a)=>{function o(s,...l){if(_t(s,void 0,"key"),t.nonceLength!==void 0){const b=l[0];_t(b,t.varSizeNonce?void 0:t.nonceLength,"nonce")}const u=t.tagLength;u&&l[1]!==void 0&&_t(l[1],void 0,"AAD");const f=a(s,...l),m=(b,v)=>{if(v!==void 0){if(b!==2)throw new Error("cipher output not supported");_t(v,void 0,"output")}};let g=!1;return{encrypt(b,v){if(g)throw new Error("cannot encrypt() twice with same key + nonce");return g=!0,_t(b),m(f.encrypt.length,v),f.encrypt(b,v)},decrypt(b,v){if(_t(b),u&&b.length<u)throw new Error('"ciphertext" expected length bigger than tagLength='+u);return m(f.decrypt.length,v),f.decrypt(b,v)}}}return Object.assign(o,t),o};function gm(t,a,o=!0){if(a===void 0)return new Uint8Array(t);if(_t(a,void 0,"output"),a.length!==t)throw new Error('"output" expected Uint8Array of length '+t+", got: "+a.length);if(o&&!oi(a))throw new Error("invalid output, must be aligned");return a}function $5(t,a,o){Mo(t),Mo(a),hm(o);const s=new Uint8Array(16),l=I5(s);return l.setBigUint64(0,BigInt(a),o),l.setBigUint64(8,BigInt(t),o),s}function oi(t){return t.byteOffset%4===0}function dc(t){return Uint8Array.from(_t(t))}function e1(t=32){Mo(t);const a=typeof globalThis=="object"?globalThis.crypto:null;if(typeof a?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return a.getRandomValues(new Uint8Array(t))}const t1=t=>Uint8Array.from(t.split(""),a=>a.charCodeAt(0)),V5=Ga(da(t1("expand 16-byte k"))),G5=Ga(da(t1("expand 32-byte k")));function ge(t,a){return t<<a|t>>>32-a}const qs=64,X5=16,vm=2**32-1,Ab=Uint32Array.of();function Z5(t,a,o,s,l,u,f,m){const g=l.length,p=new Uint8Array(qs),b=da(p),v=_r&&oi(l)&&oi(u),k=v?da(l):Ab,E=v?da(u):Ab;if(!_r){for(let S=0;S<g;f++){if(t(a,o,s,b,f,m),Ga(b),f>=vm)throw new Error("arx: counter overflow");const w=Math.min(qs,g-S);for(let C=0,T;C<w;C++)T=S+C,u[T]=l[T]^p[C];S+=w}return}for(let S=0;S<g;f++){if(t(a,o,s,b,f,m),f>=vm)throw new Error("arx: counter overflow");const w=Math.min(qs,g-S);if(v&&w===qs){const C=S/4;if(S%4!==0)throw new Error("arx: invalid block position");for(let T=0,N;T<X5;T++)N=C+T,E[N]=k[N]^b[T];S+=qs;continue}for(let C=0,T;C<w;C++)T=S+C,u[T]=l[T]^p[C];S+=w}}function Q5(t,a){const{allowShortKeys:o,extendNonceFn:s,counterLength:l,counterRight:u,rounds:f}=P5({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},a);if(typeof t!="function")throw new Error("core must be a function");return Mo(l),Mo(f),hm(u),hm(o),(m,g,p,b,v=0)=>{_t(m,void 0,"key"),_t(g,void 0,"nonce"),_t(p,void 0,"data");const k=p.length;if(b=gm(k,b,!1),Mo(v),v<0||v>=vm)throw new Error("arx: counter overflow");const E=[];let S=m.length,w,C;if(S===32)E.push(w=dc(m)),C=G5;else if(S===16&&o)w=new Uint8Array(32),w.set(m),w.set(m,16),C=V5,E.push(w);else throw _t(m,32,"arx key"),new Error("invalid key size");(!_r||!oi(g))&&E.push(g=dc(g));let T=da(w);if(s){if(g.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const A=g.subarray(0,16);if(_r)s(C,T,da(A),T);else{const O=Ga(Uint32Array.from(C));s(O,T,da(A),T),Za(O),Ga(T)}g=g.subarray(16)}else _r||Ga(T);const N=16-l;if(N!==g.length)throw new Error(`arx: nonce must be ${N} or 16 bytes`);if(N!==12){const A=new Uint8Array(12);A.set(g,u?0:12-g.length),g=A,E.push(g)}const j=Ga(da(g));try{return Z5(t,C,T,j,p,b,v,f),b}finally{Za(...E)}}}function Ct(t,a){return t[a++]&255|(t[a++]&255)<<8}class J5{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(a){a=dc(_t(a,32,"key"));const o=Ct(a,0),s=Ct(a,2),l=Ct(a,4),u=Ct(a,6),f=Ct(a,8),m=Ct(a,10),g=Ct(a,12),p=Ct(a,14);this.r[0]=o&8191,this.r[1]=(o>>>13|s<<3)&8191,this.r[2]=(s>>>10|l<<6)&7939,this.r[3]=(l>>>7|u<<9)&8191,this.r[4]=(u>>>4|f<<12)&255,this.r[5]=f>>>1&8190,this.r[6]=(f>>>14|m<<2)&8191,this.r[7]=(m>>>11|g<<5)&8065,this.r[8]=(g>>>8|p<<8)&8191,this.r[9]=p>>>5&127;for(let b=0;b<8;b++)this.pad[b]=Ct(a,16+2*b)}process(a,o,s=!1){const l=s?0:2048,{h:u,r:f}=this,m=f[0],g=f[1],p=f[2],b=f[3],v=f[4],k=f[5],E=f[6],S=f[7],w=f[8],C=f[9],T=Ct(a,o+0),N=Ct(a,o+2),j=Ct(a,o+4),A=Ct(a,o+6),O=Ct(a,o+8),D=Ct(a,o+10),L=Ct(a,o+12),P=Ct(a,o+14);let J=u[0]+(T&8191),Q=u[1]+((T>>>13|N<<3)&8191),$=u[2]+((N>>>10|j<<6)&8191),F=u[3]+((j>>>7|A<<9)&8191),ne=u[4]+((A>>>4|O<<12)&8191),Z=u[5]+(O>>>1&8191),q=u[6]+((O>>>14|D<<2)&8191),M=u[7]+((D>>>11|L<<5)&8191),U=u[8]+((L>>>8|P<<8)&8191),W=u[9]+(P>>>5|l),G=0,V=G+J*m+Q*(5*C)+$*(5*w)+F*(5*S)+ne*(5*E);G=V>>>13,V&=8191,V+=Z*(5*k)+q*(5*v)+M*(5*b)+U*(5*p)+W*(5*g),G+=V>>>13,V&=8191;let R=G+J*g+Q*m+$*(5*C)+F*(5*w)+ne*(5*S);G=R>>>13,R&=8191,R+=Z*(5*E)+q*(5*k)+M*(5*v)+U*(5*b)+W*(5*p),G+=R>>>13,R&=8191;let B=G+J*p+Q*g+$*m+F*(5*C)+ne*(5*w);G=B>>>13,B&=8191,B+=Z*(5*S)+q*(5*E)+M*(5*k)+U*(5*v)+W*(5*b),G+=B>>>13,B&=8191;let se=G+J*b+Q*p+$*g+F*m+ne*(5*C);G=se>>>13,se&=8191,se+=Z*(5*w)+q*(5*S)+M*(5*E)+U*(5*k)+W*(5*v),G+=se>>>13,se&=8191;let re=G+J*v+Q*b+$*p+F*g+ne*m;G=re>>>13,re&=8191,re+=Z*(5*C)+q*(5*w)+M*(5*S)+U*(5*E)+W*(5*k),G+=re>>>13,re&=8191;let ce=G+J*k+Q*v+$*b+F*p+ne*g;G=ce>>>13,ce&=8191,ce+=Z*m+q*(5*C)+M*(5*w)+U*(5*S)+W*(5*E),G+=ce>>>13,ce&=8191;let fe=G+J*E+Q*k+$*v+F*b+ne*p;G=fe>>>13,fe&=8191,fe+=Z*g+q*m+M*(5*C)+U*(5*w)+W*(5*S),G+=fe>>>13,fe&=8191;let ue=G+J*S+Q*E+$*k+F*v+ne*b;G=ue>>>13,ue&=8191,ue+=Z*p+q*g+M*m+U*(5*C)+W*(5*w),G+=ue>>>13,ue&=8191;let le=G+J*w+Q*S+$*E+F*k+ne*v;G=le>>>13,le&=8191,le+=Z*b+q*p+M*g+U*m+W*(5*C),G+=le>>>13,le&=8191;let ie=G+J*C+Q*w+$*S+F*E+ne*k;G=ie>>>13,ie&=8191,ie+=Z*v+q*b+M*p+U*g+W*m,G+=ie>>>13,ie&=8191,G=(G<<2)+G|0,G=G+V|0,V=G&8191,G=G>>>13,R+=G,u[0]=V,u[1]=R,u[2]=B,u[3]=se,u[4]=re,u[5]=ce,u[6]=fe,u[7]=ue,u[8]=le,u[9]=ie}finalize(){const{h:a,pad:o}=this,s=new Uint16Array(10);let l=a[1]>>>13;a[1]&=8191;for(let m=2;m<10;m++)a[m]+=l,l=a[m]>>>13,a[m]&=8191;a[0]+=l*5,l=a[0]>>>13,a[0]&=8191,a[1]+=l,l=a[1]>>>13,a[1]&=8191,a[2]+=l,s[0]=a[0]+5,l=s[0]>>>13,s[0]&=8191;for(let m=1;m<10;m++)s[m]=a[m]+l,l=s[m]>>>13,s[m]&=8191;s[9]-=8192;let u=(l^1)-1;for(let m=0;m<10;m++)s[m]&=u;u=~u;for(let m=0;m<10;m++)a[m]=a[m]&u|s[m];a[0]=(a[0]|a[1]<<13)&65535,a[1]=(a[1]>>>3|a[2]<<10)&65535,a[2]=(a[2]>>>6|a[3]<<7)&65535,a[3]=(a[3]>>>9|a[4]<<4)&65535,a[4]=(a[4]>>>12|a[5]<<1|a[6]<<14)&65535,a[5]=(a[6]>>>2|a[7]<<11)&65535,a[6]=(a[7]>>>5|a[8]<<8)&65535,a[7]=(a[8]>>>8|a[9]<<5)&65535;let f=a[0]+o[0];a[0]=f&65535;for(let m=1;m<8;m++)f=(a[m]+o[m]|0)+(f>>>16)|0,a[m]=f&65535;Za(s)}update(a){jb(this),_t(a),a=dc(a);const{buffer:o,blockLen:s}=this,l=a.length;for(let u=0;u<l;){const f=Math.min(s-this.pos,l-u);if(f===s){for(;s<=l-u;u+=s)this.process(a,u);continue}o.set(a.subarray(u,u+f),this.pos),this.pos+=f,u+=f,this.pos===s&&(this.process(o,0,!1),this.pos=0)}return this}destroy(){this.destroyed=!0,Za(this.h,this.r,this.buffer,this.pad)}digestInto(a){jb(this),W5(a,this),this.finished=!0;const{buffer:o,h:s}=this;let{pos:l}=this;if(l){for(o[l++]=1;l<16;l++)o[l]=0;this.process(o,0,!0)}this.finalize();let u=0;for(let f=0;f<8;f++)a[u++]=s[f]>>>0,a[u++]=s[f]>>>8}digest(){const{buffer:a,outputLen:o}=this;this.digestInto(a);const s=a.slice(0,o);return this.destroy(),s}}const e6=K5(32,t=>new J5(t));function t6(t,a,o,s,l,u=20){let f=t[0],m=t[1],g=t[2],p=t[3],b=a[0],v=a[1],k=a[2],E=a[3],S=a[4],w=a[5],C=a[6],T=a[7],N=l,j=o[0],A=o[1],O=o[2],D=f,L=m,P=g,J=p,Q=b,$=v,F=k,ne=E,Z=S,q=w,M=C,U=T,W=N,G=j,V=A,R=O;for(let se=0;se<u;se+=2)D=D+Q|0,W=ge(W^D,16),Z=Z+W|0,Q=ge(Q^Z,12),D=D+Q|0,W=ge(W^D,8),Z=Z+W|0,Q=ge(Q^Z,7),L=L+$|0,G=ge(G^L,16),q=q+G|0,$=ge($^q,12),L=L+$|0,G=ge(G^L,8),q=q+G|0,$=ge($^q,7),P=P+F|0,V=ge(V^P,16),M=M+V|0,F=ge(F^M,12),P=P+F|0,V=ge(V^P,8),M=M+V|0,F=ge(F^M,7),J=J+ne|0,R=ge(R^J,16),U=U+R|0,ne=ge(ne^U,12),J=J+ne|0,R=ge(R^J,8),U=U+R|0,ne=ge(ne^U,7),D=D+$|0,R=ge(R^D,16),M=M+R|0,$=ge($^M,12),D=D+$|0,R=ge(R^D,8),M=M+R|0,$=ge($^M,7),L=L+F|0,W=ge(W^L,16),U=U+W|0,F=ge(F^U,12),L=L+F|0,W=ge(W^L,8),U=U+W|0,F=ge(F^U,7),P=P+ne|0,G=ge(G^P,16),Z=Z+G|0,ne=ge(ne^Z,12),P=P+ne|0,G=ge(G^P,8),Z=Z+G|0,ne=ge(ne^Z,7),J=J+Q|0,V=ge(V^J,16),q=q+V|0,Q=ge(Q^q,12),J=J+Q|0,V=ge(V^J,8),q=q+V|0,Q=ge(Q^q,7);let B=0;s[B++]=f+D|0,s[B++]=m+L|0,s[B++]=g+P|0,s[B++]=p+J|0,s[B++]=b+Q|0,s[B++]=v+$|0,s[B++]=k+F|0,s[B++]=E+ne|0,s[B++]=S+Z|0,s[B++]=w+q|0,s[B++]=C+M|0,s[B++]=T+U|0,s[B++]=N+W|0,s[B++]=j+G|0,s[B++]=A+V|0,s[B++]=O+R|0}function n6(t,a,o,s){let l=At(t[0]),u=At(t[1]),f=At(t[2]),m=At(t[3]),g=At(a[0]),p=At(a[1]),b=At(a[2]),v=At(a[3]),k=At(a[4]),E=At(a[5]),S=At(a[6]),w=At(a[7]),C=At(o[0]),T=At(o[1]),N=At(o[2]),j=At(o[3]);for(let O=0;O<20;O+=2)l=l+g|0,C=ge(C^l,16),k=k+C|0,g=ge(g^k,12),l=l+g|0,C=ge(C^l,8),k=k+C|0,g=ge(g^k,7),u=u+p|0,T=ge(T^u,16),E=E+T|0,p=ge(p^E,12),u=u+p|0,T=ge(T^u,8),E=E+T|0,p=ge(p^E,7),f=f+b|0,N=ge(N^f,16),S=S+N|0,b=ge(b^S,12),f=f+b|0,N=ge(N^f,8),S=S+N|0,b=ge(b^S,7),m=m+v|0,j=ge(j^m,16),w=w+j|0,v=ge(v^w,12),m=m+v|0,j=ge(j^m,8),w=w+j|0,v=ge(v^w,7),l=l+p|0,j=ge(j^l,16),S=S+j|0,p=ge(p^S,12),l=l+p|0,j=ge(j^l,8),S=S+j|0,p=ge(p^S,7),u=u+b|0,C=ge(C^u,16),w=w+C|0,b=ge(b^w,12),u=u+b|0,C=ge(C^u,8),w=w+C|0,b=ge(b^w,7),f=f+v|0,T=ge(T^f,16),k=k+T|0,v=ge(v^k,12),f=f+v|0,T=ge(T^f,8),k=k+T|0,v=ge(v^k,7),m=m+g|0,N=ge(N^m,16),E=E+N|0,g=ge(g^E,12),m=m+g|0,N=ge(N^m,8),E=E+N|0,g=ge(g^E,7);let A=0;s[A++]=l,s[A++]=u,s[A++]=f,s[A++]=m,s[A++]=C,s[A++]=T,s[A++]=N,s[A++]=j,Ga(s)}const a6=Q5(t6,{counterRight:!1,counterLength:8,extendNonceFn:n6,allowShortKeys:!1}),r6=new Uint8Array(16),_b=(t,a)=>{t.update(a);const o=a.length%16;o&&t.update(r6.subarray(o))},o6=new Uint8Array(32);function Rb(t,a,o,s,l){l!==void 0&&_t(l,void 0,"AAD");const u=t(a,o,o6),f=$5(s.length,l?l.length:0,!0),m=e6.create(u);l&&_b(m,l),_b(m,s),m.update(f);const g=m.digest();return Za(u,f),g}const s6=t=>(a,o,s)=>({encrypt(u,f){const m=u.length;f=gm(m+16,f,!1),f.set(u);const g=f.subarray(0,-16);t(a,o,g,g,1);const p=Rb(t,a,o,g,s);return f.set(p,m),Za(p),f},decrypt(u,f){f=gm(u.length-16,f,!1);const m=u.subarray(0,-16),g=u.subarray(-16),p=Rb(t,a,o,m,s);if(!F5(g,p))throw Za(p),new Error("invalid tag");return f.set(u.subarray(0,-16)),t(a,o,f,f,1),Za(p),f}}),n1=Y5({blockSize:64,nonceLength:24,tagLength:16},s6(a6));function i6(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function Wo(t,a=""){if(typeof t!="number"){const o=a&&`"${a}" `;throw new TypeError(`${o}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){const o=a&&`"${a}" `;throw new RangeError(`${o}expected integer >= 0, got ${t}`)}}function ha(t,a,o=""){const s=i6(t),l=t?.length,u=a!==void 0;if(!s||u&&l!==a){const f=o&&`"${o}" `,m=u?` of length ${a}`:"",g=s?`length=${l}`:`type=${typeof t}`,p=f+"expected Uint8Array"+m+", got "+g;throw s?new RangeError(p):new TypeError(p)}return t}function rp(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Wo(t.outputLen),Wo(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function fc(t,a=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(a&&t.finished)throw new Error("Hash#digest() has already been called")}function a1(t,a){ha(t,void 0,"digestInto() output");const o=a.outputLen;if(t.length<o)throw new RangeError('"digestInto() output" expected to be of length >='+o)}function si(...t){for(let a=0;a<t.length;a++)t[a].fill(0)}function Wf(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function zn(t,a){return t<<32-a|t>>>a}const r1=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",l6=Array.from({length:256},(t,a)=>a.toString(16).padStart(2,"0"));function op(t){if(ha(t),r1)return t.toHex();let a="";for(let o=0;o<t.length;o++)a+=l6[t[o]];return a}const ua={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ob(t){if(t>=ua._0&&t<=ua._9)return t-ua._0;if(t>=ua.A&&t<=ua.F)return t-(ua.A-10);if(t>=ua.a&&t<=ua.f)return t-(ua.a-10)}function sp(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);if(r1)try{return Uint8Array.fromHex(t)}catch(l){throw l instanceof SyntaxError?new RangeError(l.message):l}const a=t.length,o=a/2;if(a%2)throw new RangeError("hex string expected, got unpadded hex of length "+a);const s=new Uint8Array(o);for(let l=0,u=0;l<o;l++,u+=2){const f=Ob(t.charCodeAt(u)),m=Ob(t.charCodeAt(u+1));if(f===void 0||m===void 0){const g=t[u]+t[u+1];throw new RangeError('hex string expected, got non-hex character "'+g+'" at index '+u)}s[l]=f*16+m}return s}function c6(t,a={}){const o=(l,u)=>t(u).update(l).digest(),s=t(void 0);return o.outputLen=s.outputLen,o.blockLen=s.blockLen,o.canXOF=s.canXOF,o.create=l=>t(l),Object.assign(o,a),Object.freeze(o)}function u6(t=32){Wo(t,"bytesLength");const a=typeof globalThis=="object"?globalThis.crypto:null;if(typeof a?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return a.getRandomValues(new Uint8Array(t))}const d6=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function f6(t,a,o){return t&a^~t&o}function m6(t,a,o){return t&a^t&o^a&o}class p6{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(a,o,s,l){this.blockLen=a,this.outputLen=o,this.padOffset=s,this.isLE=l,this.buffer=new Uint8Array(a),this.view=Wf(this.buffer)}update(a){fc(this),ha(a);const{view:o,buffer:s,blockLen:l}=this,u=a.length;for(let f=0;f<u;){const m=Math.min(l-this.pos,u-f);if(m===l){const g=Wf(a);for(;l<=u-f;f+=l)this.process(g,f);continue}s.set(a.subarray(f,f+m),this.pos),this.pos+=m,f+=m,this.pos===l&&(this.process(o,0),this.pos=0)}return this.length+=a.length,this.roundClean(),this}digestInto(a){fc(this),a1(a,this),this.finished=!0;const{buffer:o,view:s,blockLen:l,isLE:u}=this;let{pos:f}=this;o[f++]=128,si(this.buffer.subarray(f)),this.padOffset>l-f&&(this.process(s,0),f=0);for(let v=f;v<l;v++)o[v]=0;s.setBigUint64(l-8,BigInt(this.length*8),u),this.process(s,0);const m=Wf(a),g=this.outputLen;if(g%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const p=g/4,b=this.get();if(p>b.length)throw new Error("_sha2: outputLen bigger than state");for(let v=0;v<p;v++)m.setUint32(4*v,b[v],u)}digest(){const{buffer:a,outputLen:o}=this;this.digestInto(a);const s=a.slice(0,o);return this.destroy(),s}_cloneInto(a){a||=new this.constructor,a.set(...this.get());const{blockLen:o,buffer:s,length:l,finished:u,destroyed:f,pos:m}=this;return a.destroyed=f,a.finished=u,a.length=l,a.pos=m,l%o&&a.buffer.set(s),a}clone(){return this._cloneInto()}}const Fa=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),h6=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ka=new Uint32Array(64);class g6 extends p6{constructor(a){super(64,a,8,!1)}get(){const{A:a,B:o,C:s,D:l,E:u,F:f,G:m,H:g}=this;return[a,o,s,l,u,f,m,g]}set(a,o,s,l,u,f,m,g){this.A=a|0,this.B=o|0,this.C=s|0,this.D=l|0,this.E=u|0,this.F=f|0,this.G=m|0,this.H=g|0}process(a,o){for(let v=0;v<16;v++,o+=4)Ka[v]=a.getUint32(o,!1);for(let v=16;v<64;v++){const k=Ka[v-15],E=Ka[v-2],S=zn(k,7)^zn(k,18)^k>>>3,w=zn(E,17)^zn(E,19)^E>>>10;Ka[v]=w+Ka[v-7]+S+Ka[v-16]|0}let{A:s,B:l,C:u,D:f,E:m,F:g,G:p,H:b}=this;for(let v=0;v<64;v++){const k=zn(m,6)^zn(m,11)^zn(m,25),E=b+k+f6(m,g,p)+h6[v]+Ka[v]|0,w=(zn(s,2)^zn(s,13)^zn(s,22))+m6(s,l,u)|0;b=p,p=g,g=m,m=f+E|0,f=u,u=l,l=s,s=E+w|0}s=s+this.A|0,l=l+this.B|0,u=u+this.C|0,f=f+this.D|0,m=m+this.E|0,g=g+this.F|0,p=p+this.G|0,b=b+this.H|0,this.set(s,l,u,f,m,g,p,b)}roundClean(){si(Ka)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),si(this.buffer)}}class v6 extends g6{A=Fa[0]|0;B=Fa[1]|0;C=Fa[2]|0;D=Fa[3]|0;E=Fa[4]|0;F=Fa[5]|0;G=Fa[6]|0;H=Fa[7]|0;constructor(){super(32)}}const Lo=c6(()=>new v6,d6(1));const Qa=(t,a,o)=>ha(t,a,o),o1=Wo,s1=op,y6=t=>sp(t),b6=t=>u6(t),mc=BigInt(0),ym=BigInt(1);function i1(t,a=""){if(typeof t!="boolean"){const o=a&&`"${a}" `;throw new TypeError(o+"expected boolean, got type="+typeof t)}return t}function w6(t){if(typeof t=="bigint"){if(!Zl(t))throw new RangeError("positive bigint expected, got "+t)}else o1(t);return t}function Db(t,a=""){if(typeof t!="number"){const o=a&&`"${a}" `;throw new TypeError(o+"expected number, got type="+typeof t)}if(!Number.isSafeInteger(t)){const o=a&&`"${a}" `;throw new RangeError(o+"expected safe integer, got "+t)}}function l1(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);return t===""?mc:BigInt("0x"+t)}function x6(t){return l1(op(t))}function ii(t){return l1(op(li(ha(t)).reverse()))}function c1(t,a){if(Wo(a),a===0)throw new RangeError("zero length");t=w6(t);const o=t.toString(16);if(o.length>a*2)throw new RangeError("number too large");return sp(o.padStart(a*2,"0"))}function u1(t,a){return c1(t,a).reverse()}function k6(t,a){if(t=Qa(t),a=Qa(a),t.length!==a.length)return!1;let o=0;for(let s=0;s<t.length;s++)o|=t[s]^a[s];return o===0}function li(t){return Uint8Array.from(Qa(t))}const Zl=t=>typeof t=="bigint"&&mc<=t;function S6(t,a,o){return Zl(t)&&Zl(a)&&Zl(o)&&a<=t&&t<o}function pc(t,a,o,s){if(!S6(a,o,s))throw new RangeError("expected valid "+t+": "+o+" <= n < "+s+", got "+a)}function E6(t){if(t<mc)throw new Error("expected non-negative bigint, got "+t);let a;for(a=0;t>mc;t>>=ym,a+=1);return a}const C6=t=>(ym<<BigInt(t))-ym;function ip(t,a={},o={}){if(Object.prototype.toString.call(t)!=="[object Object]")throw new TypeError("expected valid options object");function s(u,f,m){if(!m&&f!=="function"&&!Object.hasOwn(t,u))throw new TypeError(`param "${u}" is invalid: expected own property`);const g=t[u];if(m&&g===void 0)return;const p=typeof g;if(p!==f||g===null)throw new TypeError(`param "${u}" is invalid: expected ${f}, got ${p}`)}const l=(u,f)=>Object.entries(u).forEach(([m,g])=>s(m,g,f));l(a,!1),l(o,!0)}const Mb=()=>{throw new Error("not implemented")};const Rt=BigInt(0),Tt=BigInt(1),Nr=BigInt(2),d1=BigInt(3),f1=BigInt(4),m1=BigInt(5),T6=BigInt(7),p1=BigInt(8),N6=BigInt(9),h1=BigInt(16);function ot(t,a){if(a<=Rt)throw new Error("mod: expected positive modulus, got "+a);const o=t%a;return o>=Rt?o:a+o}function Cn(t,a,o){if(a<Rt)throw new Error("pow2: expected non-negative exponent, got "+a);let s=t;for(;a-- >Rt;)s*=s,s%=o;return s}function Lb(t,a){if(t===Rt)throw new Error("invert: expected non-zero number");if(a<=Rt)throw new Error("invert: expected positive modulus, got "+a);let o=ot(t,a),s=a,l=Rt,u=Tt;for(;o!==Rt;){const m=s/o,g=s-o*m,p=l-u*m;s=o,o=g,l=u,u=p}if(s!==Tt)throw new Error("invert: does not exist");return ot(l,a)}function lp(t,a,o){const s=t;if(!s.eql(s.sqr(a),o))throw new Error("Cannot find square root")}function g1(t,a){const o=t,s=(o.ORDER+Tt)/f1,l=o.pow(a,s);return lp(o,l,a),l}function j6(t,a){const o=t,s=(o.ORDER-m1)/p1,l=o.mul(a,Nr),u=o.pow(l,s),f=o.mul(a,u),m=o.mul(o.mul(f,Nr),u),g=o.mul(f,o.sub(m,o.ONE));return lp(o,g,a),g}function A6(t){const a=cp(t),o=v1(t),s=o(a,a.neg(a.ONE)),l=o(a,s),u=o(a,a.neg(s)),f=(t+T6)/h1;return((m,g)=>{const p=m;let b=p.pow(g,f),v=p.mul(b,s);const k=p.mul(b,l),E=p.mul(b,u),S=p.eql(p.sqr(v),g),w=p.eql(p.sqr(k),g);b=p.cmov(b,v,S),v=p.cmov(E,k,w);const C=p.eql(p.sqr(v),g),T=p.cmov(b,v,C);return lp(p,T,g),T})}function v1(t){if(t<d1)throw new Error("sqrt is not defined for small field");let a=t-Tt,o=0;for(;a%Nr===Rt;)a/=Nr,o++;let s=Nr;const l=cp(t);for(;zb(l,s)===1;)if(s++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(o===1)return g1;let u=l.pow(s,a);const f=(a+Tt)/Nr;return function(g,p){const b=g;if(b.is0(p))return p;if(zb(b,p)!==1)throw new Error("Cannot find square root");let v=o,k=b.mul(b.ONE,u),E=b.pow(p,a),S=b.pow(p,f);for(;!b.eql(E,b.ONE);){if(b.is0(E))return b.ZERO;let w=1,C=b.sqr(E);for(;!b.eql(C,b.ONE);)if(w++,C=b.sqr(C),w===v)throw new Error("Cannot find square root");const T=Tt<<BigInt(v-w-1),N=b.pow(k,T);v=w,k=b.sqr(N),E=b.mul(E,k),S=b.mul(S,N)}return S}}function _6(t){return t%f1===d1?g1:t%p1===m1?j6:t%h1===N6?A6(t):v1(t)}const Cr=(t,a)=>(ot(t,a)&Tt)===Tt,R6=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function O6(t){const a={ORDER:"bigint",BYTES:"number",BITS:"number"},o=R6.reduce((s,l)=>(s[l]="function",s),a);if(ip(t,o),Db(t.BYTES,"BYTES"),Db(t.BITS,"BITS"),t.BYTES<1||t.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(t.ORDER<=Tt)throw new Error("invalid field: expected ORDER > 1, got "+t.ORDER);return t}function D6(t,a,o){const s=t;if(o<Rt)throw new Error("invalid exponent, negatives unsupported");if(o===Rt)return s.ONE;if(o===Tt)return a;let l=s.ONE,u=a;for(;o>Rt;)o&Tt&&(l=s.mul(l,u)),u=s.sqr(u),o>>=Tt;return l}function y1(t,a,o=!1){const s=t,l=new Array(a.length).fill(o?s.ZERO:void 0),u=a.reduce((m,g,p)=>s.is0(g)?m:(l[p]=m,s.mul(m,g)),s.ONE),f=s.inv(u);return a.reduceRight((m,g,p)=>s.is0(g)?m:(l[p]=s.mul(m,l[p]),s.mul(m,g)),f),l}function zb(t,a){const o=t,s=(o.ORDER-Tt)/Nr,l=o.pow(a,s),u=o.eql(l,o.ONE),f=o.eql(l,o.ZERO),m=o.eql(l,o.neg(o.ONE));if(!u&&!f&&!m)throw new Error("invalid Legendre symbol result");return u?1:f?0:-1}function M6(t,a){if(a!==void 0&&o1(a),t<=Rt)throw new Error("invalid n length: expected positive n, got "+t);if(a!==void 0&&a<1)throw new Error("invalid n length: expected positive bit length, got "+a);const o=E6(t);if(a!==void 0&&a<o)throw new Error(`invalid n length: expected bit length (${o}) >= n.length (${a})`);const s=a!==void 0?a:o,l=Math.ceil(s/8);return{nBitLength:s,nByteLength:l}}const Hb=new WeakMap;class b1{ORDER;BITS;BYTES;isLE;ZERO=Rt;ONE=Tt;_lengths;_mod;constructor(a,o={}){if(a<=Tt)throw new Error("invalid field: expected ORDER > 1, got "+a);let s;this.isLE=!1,o!=null&&typeof o=="object"&&(typeof o.BITS=="number"&&(s=o.BITS),typeof o.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:o.sqrt,enumerable:!0}),typeof o.isLE=="boolean"&&(this.isLE=o.isLE),o.allowedLengths&&(this._lengths=Object.freeze(o.allowedLengths.slice())),typeof o.modFromBytes=="boolean"&&(this._mod=o.modFromBytes));const{nBitLength:l,nByteLength:u}=M6(a,s);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=a,this.BITS=l,this.BYTES=u,Object.freeze(this)}create(a){return ot(a,this.ORDER)}isValid(a){if(typeof a!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof a);return Rt<=a&&a<this.ORDER}is0(a){return a===Rt}isValidNot0(a){return!this.is0(a)&&this.isValid(a)}isOdd(a){return(a&Tt)===Tt}neg(a){return ot(-a,this.ORDER)}eql(a,o){return a===o}sqr(a){return ot(a*a,this.ORDER)}add(a,o){return ot(a+o,this.ORDER)}sub(a,o){return ot(a-o,this.ORDER)}mul(a,o){return ot(a*o,this.ORDER)}pow(a,o){return D6(this,a,o)}div(a,o){return ot(a*Lb(o,this.ORDER),this.ORDER)}sqrN(a){return a*a}addN(a,o){return a+o}subN(a,o){return a-o}mulN(a,o){return a*o}inv(a){return Lb(a,this.ORDER)}sqrt(a){let o=Hb.get(this);return o||Hb.set(this,o=_6(this.ORDER)),o(this,a)}toBytes(a){return this.isLE?u1(a,this.BYTES):c1(a,this.BYTES)}fromBytes(a,o=!1){Qa(a);const{_lengths:s,BYTES:l,isLE:u,ORDER:f,_mod:m}=this;if(s){if(a.length<1||!s.includes(a.length)||a.length>l)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);const p=new Uint8Array(l);p.set(a,u?0:p.length-a.length),a=p}if(a.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+a.length);let g=u?ii(a):x6(a);if(m&&(g=ot(g,f)),!o&&!this.isValid(g))throw new Error("invalid field element: outside of range 0..ORDER");return g}invertBatch(a){return y1(this,a)}cmov(a,o,s){return i1(s,"condition"),s?o:a}}Object.freeze(b1.prototype);function cp(t,a={}){return new b1(t,a)}const hc=BigInt(0),bm=BigInt(1);function Ub(t,a){const o=a.negate();return t?o:a}function If(t,a){const o=y1(t.Fp,a.map(s=>s.Z));return a.map((s,l)=>t.fromAffine(s.toAffine(o[l])))}function w1(t,a){if(!Number.isSafeInteger(t)||t<=0||t>a)throw new Error("invalid window size, expected [1.."+a+"], got W="+t)}function qf(t,a){w1(t,a);const o=Math.ceil(a/t)+1,s=2**(t-1),l=2**t,u=C6(t),f=BigInt(t);return{windows:o,windowSize:s,mask:u,maxNumber:l,shiftBy:f}}function Bb(t,a,o){const{windowSize:s,mask:l,maxNumber:u,shiftBy:f}=o;let m=Number(t&l),g=t>>f;m>s&&(m-=u,g+=bm);const p=a*s,b=p+Math.abs(m)-1,v=m===0,k=m<0,E=a%2!==0;return{nextN:g,offset:b,isZero:v,isNeg:k,isNegF:E,offsetF:p}}const Pf=new WeakMap,x1=new WeakMap;function Ff(t){return x1.get(t)||1}function Wb(t){if(t!==hc)throw new Error("invalid wNAF")}class L6{BASE;ZERO;Fn;bits;constructor(a,o){this.BASE=a.BASE,this.ZERO=a.ZERO,this.Fn=a.Fn,this.bits=o}_unsafeLadder(a,o,s=this.ZERO){let l=a;for(;o>hc;)o&bm&&(s=s.add(l)),l=l.double(),o>>=bm;return s}precomputeWindow(a,o){const{windows:s,windowSize:l}=qf(o,this.bits),u=[];let f=a,m=f;for(let g=0;g<s;g++){m=f,u.push(m);for(let p=1;p<l;p++)m=m.add(f),u.push(m);f=m.double()}return u}wNAF(a,o,s){if(!this.Fn.isValid(s))throw new Error("invalid scalar");let l=this.ZERO,u=this.BASE;const f=qf(a,this.bits);for(let m=0;m<f.windows;m++){const{nextN:g,offset:p,isZero:b,isNeg:v,isNegF:k,offsetF:E}=Bb(s,m,f);s=g,b?u=u.add(Ub(k,o[E])):l=l.add(Ub(v,o[p]))}return Wb(s),{p:l,f:u}}wNAFUnsafe(a,o,s,l=this.ZERO){const u=qf(a,this.bits);for(let f=0;f<u.windows&&s!==hc;f++){const{nextN:m,offset:g,isZero:p,isNeg:b}=Bb(s,f,u);if(s=m,!p){const v=o[g];l=l.add(b?v.negate():v)}}return Wb(s),l}getPrecomputes(a,o,s){let l=Pf.get(o);return l||(l=this.precomputeWindow(o,a),a!==1&&(typeof s=="function"&&(l=s(l)),Pf.set(o,l))),l}cached(a,o,s){const l=Ff(a);return this.wNAF(l,this.getPrecomputes(l,a,s),o)}unsafe(a,o,s,l){const u=Ff(a);return u===1?this._unsafeLadder(a,o,l):this.wNAFUnsafe(u,this.getPrecomputes(u,a,s),o,l)}createCache(a,o){w1(o,this.bits),x1.set(a,o),Pf.delete(a)}hasCache(a){return Ff(a)!==1}}function Ib(t,a,o){if(a){if(a.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return O6(a),a}else return cp(t,{isLE:o})}function z6(t,a,o={},s){if(s===void 0&&(s=t==="edwards"),!a||typeof a!="object")throw new Error(`expected valid ${t} CURVE object`);for(const g of["p","n","h"]){const p=a[g];if(!(typeof p=="bigint"&&p>hc))throw new Error(`CURVE.${g} must be positive bigint`)}const l=Ib(a.p,o.Fp,s),u=Ib(a.n,o.Fn,s),m=["Gx","Gy","a","d"];for(const g of m)if(!l.isValid(a[g]))throw new Error(`CURVE.${g} must be valid field element of CURVE.Fp`);return a=Object.freeze(Object.assign({},a)),{CURVE:a,Fp:l,Fn:u}}function H6(t,a){return function(s){const l=t(s);return{secretKey:l,publicKey:a(l)}}}const Ya=BigInt(0),Ft=BigInt(1),Kf=BigInt(2),U6=BigInt(8);function B6(t,a,o,s){const l=t.sqr(o),u=t.sqr(s),f=t.add(t.mul(a.a,l),u),m=t.add(t.ONE,t.mul(a.d,t.mul(l,u)));return t.eql(f,m)}function W6(t,a={}){const o=a,s=z6("edwards",t,o,o.FpFnLE),{Fp:l,Fn:u}=s;let f=s.CURVE;const{h:m}=f;ip(o,{},{uvRatio:"function"});const g=Kf<<BigInt(u.BYTES*8)-Ft,p=w=>l.create(w),b=o.uvRatio===void 0?(w,C)=>{try{return{isValid:!0,value:l.sqrt(l.div(w,C))}}catch{return{isValid:!1,value:Ya}}}:o.uvRatio;if(!B6(l,f,f.Gx,f.Gy))throw new Error("bad curve params: generator point");function v(w,C,T=!1){const N=T?Ft:Ya;return pc("coordinate "+w,C,N,g),C}function k(w){if(!(w instanceof E))throw new Error("EdwardsPoint expected")}class E{static BASE=new E(f.Gx,f.Gy,Ft,p(f.Gx*f.Gy));static ZERO=new E(Ya,Ft,Ft,Ya);static Fp=l;static Fn=u;X;Y;Z;T;constructor(C,T,N,j){this.X=v("x",C),this.Y=v("y",T),this.Z=v("z",N,!0),this.T=v("t",j),Object.freeze(this)}static CURVE(){return f}static fromAffine(C){if(C instanceof E)throw new Error("extended point not allowed");const{x:T,y:N}=C||{};return v("x",T),v("y",N),new E(T,N,Ft,p(T*N))}static fromBytes(C,T=!1){const N=l.BYTES,{a:j,d:A}=f;C=li(Qa(C,N,"point")),i1(T,"zip215");const O=li(C),D=C[N-1];O[N-1]=D&-129;const L=ii(O),P=T?g:l.ORDER;pc("point.y",L,Ya,P);const J=p(L*L),Q=p(J-Ft),$=p(A*J-j);let{isValid:F,value:ne}=b(Q,$);if(!F)throw new Error("bad point: invalid y coordinate");const Z=(ne&Ft)===Ft,q=(D&128)!==0;if(!T&&ne===Ya&&q)throw new Error("bad point: x=0 and x_0=1");return q!==Z&&(ne=p(-ne)),E.fromAffine({x:ne,y:L})}static fromHex(C,T=!1){return E.fromBytes(y6(C),T)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(C=8,T=!0){return S.createCache(this,C),T||this.multiply(Kf),this}assertValidity(){const C=this,{a:T,d:N}=f;if(C.is0())throw new Error("bad point: ZERO");const{X:j,Y:A,Z:O,T:D}=C,L=p(j*j),P=p(A*A),J=p(O*O),Q=p(J*J),$=p(L*T),F=p(J*p($+P)),ne=p(Q+p(N*p(L*P)));if(F!==ne)throw new Error("bad point: equation left != right (1)");const Z=p(j*A),q=p(O*D);if(Z!==q)throw new Error("bad point: equation left != right (2)")}equals(C){k(C);const{X:T,Y:N,Z:j}=this,{X:A,Y:O,Z:D}=C,L=p(T*D),P=p(A*j),J=p(N*D),Q=p(O*j);return L===P&&J===Q}is0(){return this.equals(E.ZERO)}negate(){return new E(p(-this.X),this.Y,this.Z,p(-this.T))}double(){const{a:C}=f,{X:T,Y:N,Z:j}=this,A=p(T*T),O=p(N*N),D=p(Kf*p(j*j)),L=p(C*A),P=T+N,J=p(p(P*P)-A-O),Q=L+O,$=Q-D,F=L-O,ne=p(J*$),Z=p(Q*F),q=p(J*F),M=p($*Q);return new E(ne,Z,M,q)}add(C){k(C);const{a:T,d:N}=f,{X:j,Y:A,Z:O,T:D}=this,{X:L,Y:P,Z:J,T:Q}=C,$=p(j*L),F=p(A*P),ne=p(D*N*Q),Z=p(O*J),q=p((j+A)*(L+P)-$-F),M=Z-ne,U=Z+ne,W=p(F-T*$),G=p(q*M),V=p(U*W),R=p(q*W),B=p(M*U);return new E(G,V,B,R)}subtract(C){return k(C),this.add(C.negate())}multiply(C){if(!u.isValidNot0(C))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");const{p:T,f:N}=S.cached(this,C,j=>If(E,j));return If(E,[T,N])[0]}multiplyUnsafe(C){if(!u.isValid(C))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return C===Ya?E.ZERO:this.is0()||C===Ft?this:S.unsafe(this,C,T=>If(E,T))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return S.unsafe(this,f.n).is0()}toAffine(C){const T=this;let N=C;const{X:j,Y:A,Z:O}=T,D=T.is0();N==null&&(N=D?U6:l.inv(O));const L=p(j*N),P=p(A*N),J=l.mul(O,N);if(D)return{x:Ya,y:Ft};if(J!==Ft)throw new Error("invZ was invalid");return{x:L,y:P}}clearCofactor(){return m===Ft?this:this.multiplyUnsafe(m)}toBytes(){const{x:C,y:T}=this.toAffine(),N=l.toBytes(T);return N[N.length-1]|=C&Ft?128:0,N}toHex(){return s1(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const S=new L6(E,u.BITS);return u.BITS>=8&&E.BASE.precompute(8),Object.freeze(E.prototype),Object.freeze(E),E}class I6{static BASE;static ZERO;static Fp;static Fn;ep;constructor(a){this.ep=a}static fromBytes(a){Mb()}static fromHex(a){Mb()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(a){return this.ep.toAffine(a)}toHex(){return s1(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(a){return this.assertSame(a),this.init(this.ep.add(a.ep))}subtract(a){return this.assertSame(a),this.init(this.ep.subtract(a.ep))}multiply(a){return this.init(this.ep.multiply(a))}multiplyUnsafe(a){return this.init(this.ep.multiplyUnsafe(a))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(a,o){return this.ep.precompute(a,o),this}}const Ps=BigInt(0),_o=BigInt(1),Il=BigInt(2);function q6(t){return ip(t,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...t})}function P6(t){const a=q6(t),{P:o,type:s,adjustScalarBytes:l,powPminus2:u,randomBytes:f}=a,m=s==="x25519";if(!m&&s!=="x448")throw new Error("invalid type");const g=f===void 0?b6:f,p=m?255:448,b=m?32:56,v=BigInt(m?9:5),k=BigInt(m?121665:39081),E=m?Il**BigInt(254):Il**BigInt(447),S=m?BigInt(8)*Il**BigInt(251)-_o:BigInt(4)*Il**BigInt(445)-_o,w=E+S+_o,C=Z=>ot(Z,o),T=N(v);function N(Z){return u1(C(Z),b)}function j(Z){const q=li(Qa(Z,b,"uCoordinate"));return m&&(q[31]&=127),C(ii(q))}function A(Z){return ii(l(li(Qa(Z,b,"scalar"))))}function O(Z,q){const M=Q(j(q),A(Z));if(M===Ps)throw new Error("invalid private or public key received");return N(M)}function D(Z){return O(Z,T)}const L=D,P=O;function J(Z,q,M){const U=C(Z*(q-M));return q=C(q-U),M=C(M+U),{x_2:q,x_3:M}}function Q(Z,q){pc("u",Z,Ps,o),pc("scalar",q,E,w);const M=q,U=Z;let W=_o,G=Ps,V=Z,R=_o,B=Ps;for(let re=BigInt(p-1);re>=Ps;re--){const ce=M>>re&_o;B^=ce,{x_2:W,x_3:V}=J(B,W,V),{x_2:G,x_3:R}=J(B,G,R),B=ce;const fe=W+G,ue=C(fe*fe),le=W-G,ie=C(le*le),xe=ue-ie,Ne=V+R,he=V-R,we=C(he*fe),Ce=C(Ne*le),Ae=we+Ce,pt=we-Ce;V=C(Ae*Ae),R=C(U*C(pt*pt)),W=C(ue*ie),G=C(xe*(ue+C(k*xe)))}({x_2:W,x_3:V}=J(B,W,V)),{x_2:G,x_3:R}=J(B,G,R);const se=u(G);return C(W*se)}const $={secretKey:b,publicKey:b,seed:b},F=Z=>(Z=Z===void 0?g(b):Z,Qa(Z,$.seed,"seed"),Z),ne={randomSecretKey:F};return Object.freeze($),Object.freeze(ne),Object.freeze({keygen:H6(F,L),getSharedSecret:P,getPublicKey:L,scalarMult:O,scalarMultBase:D,utils:ne,GuBytes:T.slice(),lengths:$})}const F6=BigInt(0),Qs=BigInt(1),qb=BigInt(2),K6=BigInt(3),Y6=BigInt(5),$6=BigInt(8),Io=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),k1={p:Io,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:$6,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function S1(t){const a=BigInt(10),o=BigInt(20),s=BigInt(40),l=BigInt(80),u=Io,m=t*t%u*t%u,g=Cn(m,qb,u)*m%u,p=Cn(g,Qs,u)*t%u,b=Cn(p,Y6,u)*p%u,v=Cn(b,a,u)*b%u,k=Cn(v,o,u)*v%u,E=Cn(k,s,u)*k%u,S=Cn(E,l,u)*E%u,w=Cn(S,l,u)*E%u,C=Cn(w,a,u)*b%u;return{pow_p_5_8:Cn(C,qb,u)*t%u,b2:m}}function V6(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const wm=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function E1(t,a){const o=Io,s=ot(a*a*a,o),l=ot(s*s*a,o),u=S1(t*l).pow_p_5_8;let f=ot(t*s*u,o);const m=ot(a*f*f,o),g=f,p=ot(f*wm,o),b=m===t,v=m===ot(-t,o),k=m===ot(-t*wm,o);return b&&(f=g),(v||k)&&(f=p),Cr(f,o)&&(f=ot(-f,o)),{isValid:b||v,value:f}}const Ro=W6(k1,{uvRatio:E1}),Tr=Ro.Fp,G6=Ro.Fn,xm=(()=>{const t=Io;return P6({P:t,type:"x25519",powPminus2:a=>{const{pow_p_5_8:o,b2:s}=S1(a);return ot(Cn(o,K6,t)*s,t)},adjustScalarBytes:V6})})(),Pb=wm,X6=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Fb=t=>E1(Qs,t),Z6=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Q6=t=>Tr.create(ii(t)&Z6);class nn extends I6{static BASE=new nn(Ro.BASE);static ZERO=new nn(Ro.ZERO);static Fp=Tr;static Fn=G6;constructor(a){super(a)}static fromAffine(a){return new nn(Ro.fromAffine(a))}assertSame(a){if(!(a instanceof nn))throw new Error("RistrettoPoint expected")}init(a){return new nn(a)}static fromBytes(a){ha(a,32);const{a:o,d:s}=k1,l=Io,u=A=>Tr.create(A),f=Q6(a);if(!k6(Tr.toBytes(f),a)||Cr(f,l))throw new Error("invalid ristretto255 encoding 1");const m=u(f*f),g=u(Qs+o*m),p=u(Qs-o*m),b=u(g*g),v=u(p*p),k=u(o*s*b-v),{isValid:E,value:S}=Fb(u(k*v)),w=u(S*p),C=u(S*w*k);let T=u((f+f)*w);Cr(T,l)&&(T=u(-T));const N=u(g*C),j=u(T*N);if(!E||Cr(j,l)||N===F6)throw new Error("invalid ristretto255 encoding 2");return new nn(new Ro(T,N,Qs,j))}static fromHex(a){return nn.fromBytes(sp(a))}toBytes(){let{X:a,Y:o,Z:s,T:l}=this.ep;const u=Io,f=C=>Tr.create(C),m=f(f(s+o)*f(s-o)),g=f(a*o),p=f(g*g),{value:b}=Fb(f(m*p)),v=f(b*m),k=f(b*g),E=f(v*k*l);let S;if(Cr(l*E,u)){let C=f(o*Pb),T=f(a*Pb);a=C,o=T,S=f(v*X6)}else S=k;Cr(a*E,u)&&(o=f(-o));let w=f((s-o)*S);return Cr(w,u)&&(w=f(-w)),Tr.toBytes(w)}equals(a){this.assertSame(a);const{X:o,Y:s}=this.ep,{X:l,Y:u}=a.ep,f=p=>Tr.create(p),m=f(o*u)===f(s*l),g=f(s*u)===f(o*l);return m||g}is0(){return this.equals(nn.ZERO)}}Object.freeze(nn.BASE);Object.freeze(nn.ZERO);Object.freeze(nn.prototype);Object.freeze(nn);class Kb{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(a,o){if(rp(a),ha(o,void 0,"key"),this.iHash=a.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,l=new Uint8Array(s);l.set(o.length>s?a.create().update(o).digest():o);for(let u=0;u<l.length;u++)l[u]^=54;this.iHash.update(l),this.oHash=a.create();for(let u=0;u<l.length;u++)l[u]^=106;this.oHash.update(l),si(l)}update(a){return fc(this),this.iHash.update(a),this}digestInto(a){fc(this),a1(a,this),this.finished=!0;const o=a.subarray(0,this.outputLen);this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const a=new Uint8Array(this.oHash.outputLen);return this.digestInto(a),a}_cloneInto(a){a||=Object.create(Object.getPrototypeOf(this),{});const{oHash:o,iHash:s,finished:l,destroyed:u,blockLen:f,outputLen:m}=this;return a=a,a.finished=l,a.destroyed=u,a.blockLen=f,a.outputLen=m,a.oHash=o._cloneInto(a.oHash),a.iHash=s._cloneInto(a.iHash),a}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const C1=(()=>{const t=((a,o,s)=>new Kb(a,o).update(s).digest());return t.create=(a,o)=>new Kb(a,o),t})();function J6(t,a,o){return rp(t),o===void 0&&(o=new Uint8Array(t.outputLen)),C1(t,o,a)}const Yf=Uint8Array.of(0),Yb=Uint8Array.of();function eD(t,a,o,s=32){rp(t),Wo(s,"length"),ha(a,void 0,"prk");const l=t.outputLen;if(a.length<l)throw new Error('"prk" must be at least HashLen octets');if(s>255*l)throw new Error("Length must be <= 255*HashLen");const u=Math.ceil(s/l);o===void 0?o=Yb:ha(o,void 0,"info");const f=new Uint8Array(u*l),m=C1.create(t,a),g=m._cloneInto(),p=new Uint8Array(m.outputLen);for(let b=0;b<u;b++)Yf[0]=b+1,g.update(b===0?Yb:p).update(o).update(Yf).digestInto(p),f.set(p,l*b),m._cloneInto(g);return m.destroy(),g.destroy(),si(p,Yf),f.slice(0,s)}const ci=(t,a,o,s,l)=>eD(t,J6(t,a,o),s,l),Nn=2,$b=32,tD=32,Xa=32,nD=24,km=32,T1=32,aD=6,Sm=32,N1="hive/remote/v1/pair",rD="hive/remote/v1/key/daemon->device",oD="hive/remote/v1/key/device->daemon",sD="hive/remote/v1/sas",iD="hive/remote/v1/transcript",lD="hive/remote/v2/conn/daemon->device",cD="hive/remote/v2/conn/device->daemon",uD="hive/remote/v2/conn-salt",dD=1,fD=2,mD=4,pD=8,j1=12,hD=new TextEncoder;function rn(t){return hD.encode(t)}function Bn(...t){let a=0;for(const l of t)a+=l.length;const o=new Uint8Array(a);let s=0;for(const l of t)o.set(l,s),s+=l.length;return o}function Hc(t){if(!Number.isInteger(t)||t<0||t>4294967295)throw new RangeError(`u32be out of range: ${t}`);const a=new Uint8Array(4);return new DataView(a.buffer).setUint32(0,t),a}function up(t,a=0){if(t.length<a+4)throw new RangeError("u32beRead: buffer too short");return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(a)}function gD(t){if(!Number.isSafeInteger(t)||t<0)throw new RangeError(`u64be out of range: ${t}`);const a=new Uint8Array(8),o=Math.floor(t/4294967296),s=t>>>0,l=new DataView(a.buffer);return l.setUint32(0,o),l.setUint32(4,s),a}function gc(t){if(t.length>65535)throw new RangeError("lp: value too long for u16 length prefix");const a=new Uint8Array(2+t.length);return new DataView(a.buffer).setUint16(0,t.length),a.set(t,2),a}function bn(t,a,o){if(t.length!==a)throw new RangeError(`${o} must be ${a} bytes, got ${t.length}`)}const Tn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",vD=(()=>{const t=new Int16Array(128).fill(-1);for(let a=0;a<Tn.length;a++)t[Tn.charCodeAt(a)]=a;return t})();function jr(t){let a="",o=0;for(;o+3<=t.length;o+=3){const l=t[o],u=t[o+1],f=t[o+2];a+=Tn[l>>2],a+=Tn[(l&3)<<4|u>>4],a+=Tn[(u&15)<<2|f>>6],a+=Tn[f&63]}const s=t.length-o;if(s===1){const l=t[o];a+=Tn[l>>2],a+=Tn[(l&3)<<4]}else if(s===2){const l=t[o],u=t[o+1];a+=Tn[l>>2],a+=Tn[(l&3)<<4|u>>4],a+=Tn[(u&15)<<2]}return a}function ui(t){if(t.length%4===1)throw new RangeError("invalid base64url");const a=t.length>>2,o=t.length&3,s=a*3+(o===0?0:o-1),l=new Uint8Array(s),u=g=>{if(g>=128)throw new RangeError("invalid base64url");const p=vD[g];if(p<0)throw new RangeError("invalid base64url");return p};let f=0,m=0;for(;m+4<=t.length;m+=4){const g=u(t.charCodeAt(m)),p=u(t.charCodeAt(m+1)),b=u(t.charCodeAt(m+2)),v=u(t.charCodeAt(m+3));l[f++]=g<<2|p>>4,l[f++]=(p&15)<<4|b>>2,l[f++]=(b&3)<<6|v}if(o===2){const g=u(t.charCodeAt(m)),p=u(t.charCodeAt(m+1));l[f++]=g<<2|p>>4}else if(o===3){const g=u(t.charCodeAt(m)),p=u(t.charCodeAt(m+1)),b=u(t.charCodeAt(m+2));l[f++]=g<<2|p>>4,l[f++]=(p&15)<<4|b>>2}return l}function yD(t){return JSON.stringify(t)}function bD(t){let a;try{a=JSON.parse(t)}catch{throw new RangeError("invalid pairing payload: not JSON")}if(typeof a!="object"||a===null)throw new RangeError("invalid pairing payload: not an object");const o=a;if(o.v!==Nn)throw new RangeError(`unsupported pairing version: ${String(o.v)}`);if(typeof o.gatewayUrl!="string"||o.gatewayUrl.length===0)throw new RangeError("invalid pairing payload: gatewayUrl");if(typeof o.daemonId!="string"||o.daemonId.length===0)throw new RangeError("invalid pairing payload: daemonId");if(typeof o.pairingSecret!="string")throw new RangeError("invalid pairing payload: pairingSecret");if(ui(o.pairingSecret).length!==km)throw new RangeError(`pairingSecret must be ${km} bytes`);return{v:o.v,gatewayUrl:o.gatewayUrl,daemonId:o.daemonId,pairingSecret:o.pairingSecret}}function wD(){const t=xm.utils.randomSecretKey(),a=xm.getPublicKey(t);return{secretKey:t,publicKey:a}}function xD(t){return{secretKey:jr(t.secretKey),publicKey:jr(t.publicKey)}}function kD(){return e1(T1)}function SD(t){bn(t.pairingSecret,km,"pairingSecret"),bn(t.sessionSalt,T1,"sessionSalt"),bn(t.daemonPublicKey,$b,"daemonPublicKey"),bn(t.devicePublicKey,$b,"devicePublicKey");const a=xm.getSharedSecret(t.localSecretKey,t.peerPublicKey);bn(a,tD,"sharedSecret");const o=Bn(t.pairingSecret,a),s=Bn(rn(iD),Uint8Array.of(0),Hc(t.ids.protocolVersion),gc(rn(t.ids.daemonId)),gc(rn(t.ids.deviceId)),t.daemonPublicKey,t.devicePublicKey,t.sessionSalt),l=Lo(s),u=Bn(rn(N1),t.sessionSalt),f=ci(Lo,o,u,Bn(rn(rD),Uint8Array.of(0),l),Xa),m=ci(Lo,o,u,Bn(rn(oD),Uint8Array.of(0),l),Xa),g=ND(l,t.ids);return{d2p:f,p2d:m,sas:g,transcriptHash:l}}function ED(t){return SD({localSecretKey:t.deviceSecretKey,peerPublicKey:t.daemonPublicKey,daemonPublicKey:t.daemonPublicKey,devicePublicKey:t.devicePublicKey,pairingSecret:t.pairingSecret,sessionSalt:t.sessionSalt,ids:t.ids})}function CD(){return e1(Sm)}function TD(t){bn(t.rootD2p,Xa,"rootD2p"),bn(t.rootP2d,Xa,"rootP2d"),bn(t.phoneConnSalt,Sm,"phoneConnSalt"),bn(t.daemonConnSalt,Sm,"daemonConnSalt");const a=Bn(rn(uD),t.phoneConnSalt,t.daemonConnSalt),o=Bn(Uint8Array.of(0),Hc(t.ids.protocolVersion),gc(rn(t.ids.daemonId)),gc(rn(t.ids.deviceId)),t.phoneConnSalt,t.daemonConnSalt),s=ci(Lo,t.rootD2p,a,Bn(rn(lD),o),Xa),l=ci(Lo,t.rootP2d,a,Bn(rn(cD),o),Xa);return{d2p:s,p2d:l}}function ND(t,a){bn(t,32,"transcriptHash");const o=ci(Lo,t,rn(N1),Bn(rn(sD),Uint8Array.of(0),Hc(a.protocolVersion)),4);return(up(o)%1e6).toString().padStart(aD,"0")}function A1(t,a,o){if(!Number.isInteger(a)||a<0||a>4294967295)throw new RangeError(`streamId out of range: ${a}`);const s=new Uint8Array(nD);return s[0]=t==="d2p"?dD:fD,s.set(Hc(a),1),s.set(gD(o),8),s}function _1(t){if(t.length<j1)throw new RangeError("headerBytes too short");return up(t,mD)}function Uc(t){if(t.length<j1)throw new RangeError("headerBytes too short");return up(t,pD)}function jD(t){bn(t.key,Xa,"key");const a=_1(t.headerBytes),o=Uc(t.headerBytes),s=A1(t.direction,a,o);return n1(t.key,s,t.headerBytes).encrypt(t.payload)}function AD(t){bn(t.key,Xa,"key");const a=_1(t.headerBytes),o=Uc(t.headerBytes),s=A1(t.direction,a,o);return n1(t.key,s,t.headerBytes).decrypt(t.ciphertext)}function _D(t){return{direction:t,nextSeq:0}}function RD(t){return{direction:t,lastSeq:-1}}function OD(t,a){const o=Uc(a.headerBytes);if(o!==t.nextSeq)throw new RangeError(`header seq ${o} does not match sealer.nextSeq ${t.nextSeq}`);const s=jD({key:a.key,direction:t.direction,headerBytes:a.headerBytes,payload:a.payload}),l=t.nextSeq;return t.nextSeq+=1,{seq:l,ciphertext:s}}function DD(t,a){if(a.seq!==t.lastSeq+1)throw new RangeError("out-of-order or replayed frame");if(Uc(a.headerBytes)!==a.seq)throw new RangeError("out-of-order or replayed frame");const s=AD({key:a.key,direction:t.direction,headerBytes:a.headerBytes,ciphertext:a.ciphertext});return t.lastSeq=a.seq,s}const MD=(t,a)=>{const o=new URL(t);if(o.protocol==="https:"?o.protocol="wss:":o.protocol==="http:"&&(o.protocol="ws:"),o.protocol!=="wss:"&&o.protocol!=="ws:")throw new Error(`unsupported pairing gateway protocol: ${o.protocol}`);return`${o.toString().replace(/\/+$/,"")}/relay/pair?daemonId=${encodeURIComponent(a)}`},LD=t=>typeof t=="object"&&t!==null&&typeof t.t=="string",zD=2e4,HD=1e4;function UD(t,a,o){const s=o.generateKeyPair??wD,l=o.generateSalt??kD,u=o.heartbeatMs??zD,f=o.heartbeatDeadlineMs??HD;let m="idle",g=null,p=null,b=null,v=!1,k=null,E=null,S=null,w=null,C=null,T=null,N="",j="",A=null;const O=V=>{m=V,a.onPhase(V)},D=()=>{E!==null&&(clearTimeout(E),E=null)},L=()=>{k!==null&&(clearInterval(k),k=null),D()},P=V=>{L(),k=setInterval(()=>{if(!v){try{V.send(Zx)}catch{}E===null&&(E=setTimeout(()=>{if(E=null,!v){try{V.close()}catch{}q()}},f))}},u)},J=()=>{S?.secretKey.fill(0),w?.fill(0),C&&(C.d2p.fill(0),C.p2d.fill(0),C.transcriptHash.fill(0)),S=null,w=null,C=null},Q=V=>{if(!v){v=!0,L(),J();try{b?.close()}catch{}b=null,A?.(V)}},$=(V,R)=>{if(v)return;const B={code:V,message:R};O(V==="rejected"?"rejected":V==="expired"?"expired":"error"),a.onFailure(B),Q({ok:!1,failure:B})},F=V=>{if(m!=="connecting"&&m!=="handshaking")return;if(V.protocolVersion!==Nn){$("protocol_version",`unsupported pairing protocol version ${V.protocolVersion}`);return}if(!S||!w){$("pair_ack_invalid","pair-ack arrived before the phone keypair was ready");return}let R;try{R=ui(V.daemonPublicKey)}catch{$("pair_ack_invalid","pair-ack daemonPublicKey is not valid base64url");return}const B={daemonId:V.daemonId,deviceId:V.deviceId,protocolVersion:V.protocolVersion};try{C=ED({deviceSecretKey:S.secretKey,daemonPublicKey:R,devicePublicKey:S.publicKey,pairingSecret:W,sessionSalt:w,ids:B})}catch(se){$("pair_ack_invalid",`handshake derivation failed: ${se.message}`);return}p=V.deviceId,j=V.daemonId,T=V.daemonPublicKey,g=C.sas,O("awaiting_confirm"),a.onSas(g)},ne=()=>{if(!v){if(!C||!S||!p){$("pair_ack_invalid","cannot mint before the handshake produced a session");return}O("minting"),o.mintSession(N,{daemonId:j,deviceId:p}).then(()=>{if(v||!S||!T||!p||!C)return;const V={v:2,gatewayUrl:N,daemonId:j,deviceId:p,deviceKeyPair:xD(S),daemonPublicKey:T,rootKeys:{d2p:jr(C.d2p),p2d:jr(C.p2d)},protocolVersion:Nn,pairedAt:(o.now??Date.now)()};o.store.save(V);const R=p;O("paired"),Q({ok:!0,deviceId:R})}).catch(V=>{V.status===403?$("mint_forbidden","gateway refused to mint a device session (not confirmed)"):$("mint_failed",`device session mint failed: ${V.message??"unknown"}`)})}},Z=V=>{if(m==="awaiting_confirm"){if(!C||!S||!p||V.deviceId!==p){$("pair_ack_invalid","confirmed for an unexpected device");return}ne()}},q=()=>{if(!v){if(m==="awaiting_confirm"){ne();return}m!=="minting"&&$("socket_closed","pairing socket closed before the device was paired")}},M=V=>{if(v||typeof V!="string")return;if(V===Qx){D();return}let R;try{R=JSON.parse(V)}catch{return}if(LD(R))switch(m==="connecting"&&R.t==="pair-ack"&&O("handshaking"),R.t){case"pair-ack":F(R);break;case"confirmed":Z(R);break;case"rejected":{const B=R.reason;B==="expired"||B==="pairing_expired"?$("expired","pairing code expired; generate a new pairing code"):$("rejected",B??"pairing rejected at the desktop")}break}},U=bD(t),W=ui(U.pairingSecret);return N=U.gatewayUrl,j=U.daemonId,{get phase(){return m},get sas(){return g},get deviceId(){return p},start:()=>v?Promise.resolve({ok:!1,failure:{code:"cancelled",message:"already settled"}}):new Promise(V=>{A=V,S=s(),w=l(),O("connecting");const R=MD(U.gatewayUrl,U.daemonId);try{b=o.openSocket(R)}catch(B){$("socket_closed",`failed to open pairing socket: ${B.message}`);return}b.addEventListener("open",()=>{if(v||!b||!S||!w)return;P(b);const B={t:"hello",devicePublicKey:jr(S.publicKey),sessionSalt:jr(w),...o.proposedName?{proposedName:o.proposedName}:{},...o.boundJti?{boundJti:o.boundJti}:{}};b?.send(JSON.stringify(B))}),b.addEventListener("message",B=>{M(B.data)}),b.addEventListener("close",q),b.addEventListener("error",q)}),cancel:()=>{v||(O("rejected"),$("cancelled","pairing cancelled"))},dispose:()=>{v?J():Q({ok:!1,failure:{code:"cancelled",message:"disposed"}})}}}const BD=t=>async(a,o)=>{const s=await t(`${a}/pair/session`,{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw Object.assign(new Error(`mint failed: ${s.status}`),{status:s.status})};function WD(t){const a=t.fetchImpl??globalThis.fetch.bind(globalThis),o=t.gatewayBaseUrl??window.location.origin,s=t.redirect??(S=>window.location.assign(S)),l=t.createPairing??UD,u=t.mintSession??BD(a);let f=t.authProvider??"github",m="login",g=null;const p=S=>{m=S,t.onPhase?.(S)},b=S=>t.store.load(o,S),v=async S=>{S&&(f=S);const w=await a(`${o}/pair/machines`,{credentials:"include"});if(w.status===401){const N=encodeURIComponent(window.location.pathname+window.location.search);return p("login"),s(`${o}/auth/${f}?redirect=${N}`),{daemons:[],selfDeviceId:null}}if(!w.ok)throw new Error(`Failed to load machines: ${w.status}`);const C=await w.json(),T=C.daemons.map(N=>({id:N.id,name:N.name,lastSeen:N.lastSeen,revoked:N.revoked,online:N.online}));return p("machines"),{daemons:T,selfDeviceId:C.self.deviceId}},k=S=>{p("pairing");const C=l(S,{onPhase:T=>t.onPairingPhase?.(T),onSas:T=>t.onPairingSas?.(T),onFailure:T=>t.onPairingFailure?.(T)},{openSocket:(T,N)=>new WebSocket(T,N),store:t.store,mintSession:u,...t.proposedName?{proposedName:t.proposedName}:{},...t.boundJti?{boundJti:t.boundJti}:{}});return g=C,C.start()};return{get phase(){return m},get pairingClient(){return g},loadMachines:v,selectDaemon:async(S,w)=>{g=null;const C=b(S);if(C&&!w){const A=await t.connectTransport({daemonId:S,deviceId:C.deviceId,stored:C});return A.ok?(p("connected"),A):(!A.ok&&A.failure.code==="relay_revoked"&&t.store.clear(o,S),p("selecting"),A)}if(p("selecting"),!w)return{ok:!1,failure:{code:"needs_pairing",message:"this device is not paired with that computer — enter its pairing code first"}};const T=await k(w);if(!T.ok)return T;const N=b(S),j=await t.connectTransport({daemonId:S,deviceId:T.deviceId,stored:N});return j.ok?(p("connected"),j):(j.failure.code==="relay_revoked"&&t.store.clear(o,S),p("selecting"),j)}}}const R1="0123456789ABCDEFGHJKMNPQRSTVWXYZ",ID=12,qD="hive-remote-pairing-code-v1:",PD=t=>{const a=t.trim().toUpperCase().replace(/[\s-]+/g,"").replace(/O/g,"0").replace(/[IL]/g,"1");if(a.length!==ID)return null;for(const o of a)if(!R1.includes(o))return null;return a},FD=new TextEncoder,KD=t=>new URL(t).origin,YD=async t=>{const a=PD(t.code);if(!a)return null;const o=await crypto.subtle.digest("SHA-256",FD.encode(`${qD}${a}`));return yD({v:Nn,gatewayUrl:KD(t.gatewayUrl),daemonId:t.daemonId,pairingSecret:jr(new Uint8Array(o))})},$D="hive.device-session.v2",VD="hive.device-session.v1",$f=(t,a)=>`${$D}:${t}:${a}`,Vb=(t,a)=>`${VD}:${t}:${a}`,GD=t=>{if(typeof t!="object"||t===null)return!1;const a=t;if(a.v!==2||typeof a.gatewayUrl!="string"||typeof a.daemonId!="string"||typeof a.deviceId!="string"||typeof a.daemonPublicKey!="string"||typeof a.protocolVersion!="number"||typeof a.pairedAt!="number")return!1;const o=a.deviceKeyPair;if(typeof o!="object"||o===null)return!1;const s=o;if(typeof s.secretKey!="string"||typeof s.publicKey!="string")return!1;const l=a.rootKeys;if(typeof l!="object"||l===null)return!1;const u=l;return typeof u.d2p=="string"&&typeof u.p2d=="string"},XD=(t=globalThis.localStorage??null)=>({load:(a,o)=>{if(!t)return null;t.getItem(Vb(a,o))!==null&&t.removeItem(Vb(a,o));const s=t.getItem($f(a,o));if(s===null)return null;try{const l=JSON.parse(s);return GD(l)?l:null}catch{return null}},save:a=>{t&&t.setItem($f(a.gatewayUrl,a.daemonId),JSON.stringify(a))},clear:(a,o)=>{t&&t.removeItem($f(a,o))}}),O1=()=>{const t=window.location.hostname;return!(t==="127.0.0.1"||t==="localhost"||t==="[::1]"||t==="::1")},D1=t=>{switch(t){case"rejected":case"cancelled":return"pairing.failed.rejected";case"expired":return"pairing.failed.expired";case"mint_forbidden":return"pairing.failed.mintForbidden";case"protocol_version":return"pairing.failed.version";case"socket_closed":case"pair_ack_invalid":case"mint_failed":return"pairing.failed.socket";default:return null}},ZD=(t,a)=>{const o=D1(a);if(o)return o;switch(t){case"connecting":return"pairing.connecting";case"handshaking":case"minting":return"pairing.handshaking";case"awaiting_confirm":return null;case"paired":return"pairing.paired";case"rejected":return"pairing.failed.rejected";case"expired":return"pairing.failed.expired";case"error":return"pairing.failed.socket";default:return null}},QD=t=>t==="select_failed"?"connect.error.selectFailed":t==="invalid_code"?"connect.error.invalidCode":t==="relay_revoked"?"connect.machines.revokedHint":null,JD=t=>{const a=Math.floor((Date.now()-t)/1e3);if(a<60)return null;const o=Math.floor(a/60);if(o<60)return`${o}m`;const s=Math.floor(o/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`},eM={O:"0",I:"1",L:"1"},tM=t=>{const a=t.toUpperCase();let o="";for(const l of a){const u=eM[l]??l;if(R1.includes(u)&&(o+=u,o.length===12))break}const s=[];for(let l=0;l<o.length;l+=4)s.push(o.slice(l,l+4));return s.join("-")},nM=t=>t==="minting"||t==="paired",ql=({children:t,className:a="",testId:o})=>c.jsx("div",{"data-testid":o,className:`connect-screen flex min-h-full flex-col p-6 ${a}`,children:t}),Fs=({primary:t,children:a,disabled:o,onClick:s,testId:l,type:u="button"})=>c.jsx("button",{type:u,"data-testid":l,disabled:o,onClick:s,className:"flex w-full items-center justify-center rounded-lg px-4 text-sm font-semibold transition-colors",style:{minHeight:"44px",background:t?"var(--accent)":"var(--bg-2)",color:t?"#ffffff":"var(--text-secondary)",border:`1px solid ${t?"var(--accent)":"var(--border-bright)"}`,opacity:o?.4:1,cursor:o?"not-allowed":"pointer"},children:a}),aM=({flow:t,phase:a,machines:o,selectedMachineId:s,pairingPhase:l,pairingFailureCode:u,connectError:f,sas:m,isSigningIn:g=!1,pendingMachineId:p,loginError:b=!1,isGatewayBundle:v=!1,onRefreshMachines:k,onSelectProvider:E,onSelectMachine:S,onSubmitCode:w,onCancelPairing:C,onGoBack:T})=>{const{t:N}=be(),[j,A]=y.useState(""),O=y.useRef(!1),D=ZD(l,u),L=QD(f),P=D1(u)!=null,J=nM(l),Q=m!=null&&m.length>0&&(l==="awaiting_confirm"||J),$=q=>{const M=tM(q);A(M),M.replace(/-/g,"").length===12&&s&&!O.current&&(O.current=!0,w(s,M.trim()))},F=j.replace(/-/g,"").length===12,ne=!!s&&F,Z=v?"/brand/icon-192.png":"/logo.png";if(a==="login")return c.jsxs(ql,{testId:"connect-login",className:"justify-center gap-6",children:[c.jsxs("div",{className:"mb-2 flex flex-col items-center gap-3 text-center",children:[c.jsx("img",{src:Z,width:72,height:72,alt:"",style:{filter:"drop-shadow(0 8px 28px rgba(51,88,212,.38))"}}),c.jsx("span",{className:"text-2xl font-bold tracking-tight",style:{color:"var(--text-primary)"},children:"Hive"})]}),c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"text-xl font-semibold text-pri",children:N("connect.login.heading")}),c.jsx("p",{className:"mt-2 text-sm text-ter",children:N("connect.login.subtitle")})]}),b?c.jsx("p",{"data-testid":"connect-login-error",className:"rounded-lg px-3 py-2 text-center text-sm",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",color:"var(--status-red)"},children:N("connect.login.failed")}):null,c.jsx("div",{className:"flex flex-col gap-3",children:g?c.jsx("div",{className:"flex items-center justify-center text-sm text-ter",style:{minHeight:"44px"},children:N("connect.login.signingIn")}):c.jsxs(c.Fragment,{children:[c.jsx(Fs,{primary:!0,testId:"connect-login-github",onClick:()=>E("github"),children:N("connect.login.github")}),c.jsx(Fs,{testId:"connect-login-google",onClick:()=>E("google"),children:N("connect.login.google")})]})})]});if(a==="machines"){const q=p!=null;return c.jsxs(ql,{testId:"connect-machines",className:"gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("img",{src:Z,width:20,height:20,alt:"",className:"shrink-0"}),c.jsx("span",{className:"text-sm font-semibold text-sec",children:"Hive"})]}),c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("h1",{className:"text-xl font-semibold text-pri",children:N("connect.machines.heading")}),k?c.jsx("button",{type:"button","aria-label":N("common.refresh"),"data-testid":"connect-machines-refresh",onClick:k,className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-sec",style:{background:"var(--bg-2)",border:"1px solid var(--border-bright)"},children:c.jsx(Rm,{size:16,"aria-hidden":!0})}):null]}),L?c.jsx("p",{"data-testid":"connect-error",className:"rounded-lg px-3 py-2 text-sm",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",color:"var(--status-red)"},children:N(L)}):null,o.length===0?c.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 px-4 text-center",children:[c.jsx("span",{className:"flex h-16 w-16 items-center justify-center rounded-2xl",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent-hover, var(--accent))"},"aria-hidden":!0,children:c.jsx(sf,{size:28})}),c.jsx("p",{"data-testid":"connect-machines-empty",className:"max-w-[280px] text-sm text-ter",children:N("connect.machines.empty")}),c.jsx("div",{className:"flex w-full max-w-[320px] flex-col gap-3 pt-2",children:c.jsx(Fs,{testId:"connect-machines-back",...T?{onClick:T}:{},children:N("connect.machines.back")})})]}):c.jsx("ul",{className:"flex flex-col gap-2.5",children:o.map(M=>{const U=p===M.id,W=!M.online||M.revoked||q;let G,V="var(--text-tertiary)";if(M.revoked)G=N("connect.machines.revoked"),V="var(--status-red)";else if(M.online)U?(G=N("connect.machines.connecting"),V="var(--text-secondary)"):(G=N("connect.machines.online"),V="var(--status-green)");else{const B=M.lastSeen!=null?JD(M.lastSeen):null;G=B!=null?N("connect.machines.lastSeen",{ago:B}):N("connect.machines.offline")}const R=M.revoked?"var(--status-red)":M.online?"var(--status-green)":"var(--text-tertiary)";return c.jsx("li",{children:c.jsxs("button",{type:"button","data-testid":`connect-machine-${M.id}`,className:"flex w-full items-center gap-3 rounded-xl border px-3.5 py-3 text-left transition-colors",style:{minHeight:"64px",borderColor:"var(--border-bright)",background:U?"var(--bg-2)":"var(--bg-1)",opacity:W&&!U?.55:1,cursor:W?"not-allowed":"pointer"},disabled:W,"aria-disabled":W,onClick:()=>S(M.id),children:[c.jsxs("span",{className:"relative shrink-0","aria-hidden":!0,children:[c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-lg",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent-hover, var(--accent))"},children:c.jsx(sf,{size:20})}),c.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 h-3 w-3 rounded-full border-2",style:{background:R,borderColor:"var(--bg-1)"}})]}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsx("span",{className:"block truncate text-[15px] font-medium text-pri",children:M.name}),c.jsx("span",{className:"mt-0.5 block text-xs",style:{color:V},children:G})]}),U?c.jsx("span",{"aria-hidden":!0,className:"h-4 w-4 shrink-0 animate-spin rounded-full border-2",style:{borderColor:"var(--border-bright)",borderTopColor:"var(--accent)"}}):W?null:c.jsx(wc,{size:18,className:"shrink-0 text-ter","aria-hidden":!0})]})},M.id)})}),v?c.jsx("div",{className:"mt-auto pt-4 text-center",children:c.jsx("a",{href:"/machines",className:"text-xs underline-offset-2 hover:underline",style:{color:"var(--text-tertiary)"},children:N("connect.machines.manageDevices")})}):null]})}if(a==="selecting"){const q=o.find(M=>M.id===s);return c.jsxs(ql,{testId:"connect-pair-guide",className:"gap-4",children:[c.jsxs("button",{type:"button",className:"-ml-2 flex items-center gap-1 self-start rounded-md px-2 text-sm text-sec",style:{minHeight:"44px"},onClick:T,children:[c.jsx(MS,{size:16,"aria-hidden":!0}),N("connect.pair.back")]}),c.jsxs("div",{children:[c.jsx("h1",{className:"text-xl font-semibold text-pri",children:N("connect.pair.guideHeading")}),q?c.jsxs("p",{className:"mt-1 flex items-center gap-1.5 text-sm text-ter",children:[c.jsx(sf,{size:14,"aria-hidden":!0,className:"shrink-0"}),c.jsx("span",{className:"truncate",children:q.name})]}):null]}),L?c.jsx("p",{"data-testid":"connect-error",className:"rounded-lg px-3 py-2 text-sm",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",color:"var(--status-red)"},children:N(L)}):null,c.jsx("ol",{className:"flex flex-col gap-3",children:["connect.pair.guideStep1","connect.pair.guideStep2","connect.pair.guideStep3"].map((M,U)=>c.jsxs("li",{className:"flex items-start gap-3 text-sm text-sec",children:[c.jsx("span",{"aria-hidden":!0,className:"mt-px flex h-[22px] w-[22px] shrink-0 items-center justify-center rounded-lg text-xs font-semibold",style:{background:"color-mix(in oklab, var(--accent) 13%, transparent)",border:"1px solid color-mix(in oklab, var(--accent) 34%, transparent)",color:"var(--accent-hover)"},children:U+1}),c.jsx("span",{className:"min-w-0 leading-relaxed",children:N(M)})]},M))}),c.jsxs("label",{className:"flex flex-col gap-2 text-xs uppercase tracking-wider text-ter",children:[N("connect.pair.qrLabel"),c.jsx("input",{type:"text","data-testid":"connect-code-input",className:"input mono text-center",inputMode:"text",autoCapitalize:"characters",autoCorrect:"off",autoComplete:"off",spellCheck:!1,placeholder:"XXXX-XXXX-XXXX",maxLength:14,value:j,onChange:M=>{O.current=!1,$(M.target.value)},style:{fontSize:"18px",letterSpacing:"0.12em",minHeight:"52px"}})]}),c.jsx(Fs,{primary:!0,testId:"connect-code-submit",disabled:!ne,onClick:()=>{s&&!O.current&&(O.current=!0,w(s,j.trim()))},children:N("connect.pair.submit")})]})}if(a==="pairing"){const q=P;return c.jsxs(ql,{testId:"connect-pairing",className:"justify-center gap-6",children:[Q&&!q?c.jsxs("div",{className:"flex flex-col items-center gap-4",children:[c.jsx("div",{"data-testid":"connect-pairing-sas",className:"mono rounded-2xl border px-7 py-5 font-bold text-pri","aria-live":"polite",style:{fontSize:"2.5rem",letterSpacing:"0.25em",paddingRight:"calc(1.75rem - 0.25em)",background:"var(--bg-1)",borderColor:"var(--border-bright)"},children:m}),c.jsx("p",{className:"text-center text-sm text-ter",style:{maxWidth:"280px"},children:N(J?"connect.pair.finalizing":"connect.pair.sasInstruction")}),J?c.jsx("span",{"aria-hidden":!0,className:"h-5 w-5 animate-spin rounded-full border-2",style:{borderColor:"var(--border-bright)",borderTopColor:"var(--accent)"}}):null]}):null,D&&!Q&&!q?c.jsx("p",{"data-testid":"connect-pairing-phase",className:"text-center text-sm text-ter",children:N(D)}):null,q&&D?c.jsx("p",{"data-testid":"connect-pairing-phase",className:"text-center text-sm",style:{color:"var(--status-red)"},children:N(D)}):null,J?null:c.jsx("div",{className:"flex flex-col gap-3",children:c.jsx(Fs,{primary:q,testId:"connect-pairing-cancel",onClick:()=>{A(""),O.current=!1,C?C():t.pairingClient?.cancel()},children:N(q?"connect.pair.startOver":"common.cancel")})})]})}return null},rM=()=>{if(typeof navigator>"u")return"Phone";const t=navigator.userAgent??"";let a="Phone";/iPad/.test(t)?a="iPad":/iPhone/.test(t)?a="iPhone":/Android/.test(t)&&(a="Android");let o="Browser";return/EdgA?\//.test(t)?o="Edge":/SamsungBrowser\//.test(t)?o="Samsung":/OPR\/|OPT\//.test(t)?o="Opera":/Firefox\//.test(t)?o="Firefox":/Chrome\//.test(t)?o="Chrome":/Safari\//.test(t)&&(o="Safari"),`${a} · ${o}`.slice(0,48)},oM=({children:t,connectTransport:a,createFlow:o=WD,store:s,gatewayBaseUrl:l,isGateway:u=O1})=>{const f=u(),[m,g]=y.useState("login"),[p,b]=y.useState([]),[v,k]=y.useState(null),[E,S]=y.useState(void 0),[w,C]=y.useState(null),[T,N]=y.useState(null),[j,A]=y.useState(null),[O,D]=y.useState(null),[L,P]=y.useState(!1),[J,Q]=y.useState(null),[$,F]=y.useState(!1),[ne,Z]=y.useState(!0),q=y.useMemo(()=>o({store:s??XD(),connectTransport:a,...l?{gatewayBaseUrl:l}:{},proposedName:rM(),onPhase:g,onPairingPhase:ue=>{C(ue),ue!=="error"&&ue!=="expired"&&ue!=="rejected"&&N(null)},onPairingSas:D,onPairingFailure:ue=>N(ue.code)}),[o,s,a,l]),M=y.useRef(q);M.current=q;const U=y.useRef(0),W=y.useCallback(()=>{C(null),N(null),D(null)},[]),G=y.useCallback(()=>(U.current+=1,U.current),[]),V=y.useCallback(ue=>U.current===ue,[]);y.useEffect(()=>{let ue=!1;return M.current.loadMachines().then(({daemons:le,selfDeviceId:ie})=>{ue||(b(le),k(ie))}).catch(()=>{}).finally(()=>{ue||Z(!1)}),()=>{ue=!0}},[]);const R=y.useCallback(()=>{const ue=G();A(null),W(),P(!0),M.current.loadMachines().then(({daemons:le,selfDeviceId:ie})=>{V(ue)&&(b(le),k(ie))}).finally(()=>{V(ue)&&P(!1)})},[W,V,G]),B=y.useCallback(ue=>{const le=G();A(null),W(),F(!1),P(!0),M.current.loadMachines(ue).then(({daemons:ie,selfDeviceId:xe})=>{V(le)&&(b(ie),k(xe))}).catch(()=>{V(le)&&F(!0)}).finally(()=>{V(le)&&P(!1)})},[W,V,G]),se=y.useCallback(ue=>{const le=G();S(ue),A(null),W(),Q(ue),(async()=>{const ie=await M.current.selectDaemon(ue);V(le)&&(Q(null),!ie.ok&&ie.failure.code==="select_failed"&&A("select_failed"),!ie.ok&&ie.failure.code==="relay_revoked"&&A("relay_revoked"))})()},[W,V,G]),re=y.useCallback((ue,le)=>{const ie=G();A(null),W(),(async()=>{const xe=await YD({code:le,daemonId:ue,gatewayUrl:l??window.location.origin});if(!V(ie))return;if(!xe){A("invalid_code");return}const Ne=await M.current.selectDaemon(ue,xe);V(ie)&&(!Ne.ok&&Ne.failure.code==="select_failed"&&A("select_failed"),!Ne.ok&&Ne.failure.code==="relay_revoked"&&A("relay_revoked"))})()},[W,l,V,G]),ce=y.useCallback(()=>{G(),M.current.pairingClient?.cancel(),W(),A(null),g(E?"selecting":"machines")},[W,G,E]),fe=y.useCallback(()=>{G(),A(null),W(),g("machines")},[W,G]);return m==="connected"?(typeof history<"u"&&history.replaceState(null,"","/app"),c.jsx(c.Fragment,{children:t})):ne?c.jsxs("div",{className:"connect-screen flex min-h-full flex-col items-center justify-center gap-3 p-6",children:[c.jsx("img",{src:f?"/brand/icon-192.png":"/logo.png",width:56,height:56,alt:"",className:"animate-pulse"}),c.jsx("span",{className:"sr-only","aria-live":"polite",children:"…"})]}):c.jsx(aM,{flow:q,phase:m,machines:p,selfDeviceId:v,...E?{selectedMachineId:E}:{},pairingPhase:w,pairingFailureCode:T,connectError:j,sas:O,isSigningIn:L,pendingMachineId:J,loginError:$,isGatewayBundle:f,onRefreshMachines:R,onSelectProvider:B,onSelectMachine:se,onSubmitCode:re,onCancelPairing:ce,onGoBack:fe})},sM=(t,a,o)=>t.mode==="tunnel"?c.jsx(o,{connectTransport:t.connectTransport,children:c.jsx(a,{})}):c.jsx(a,{}),Ge={Open:1,Data:2,End:3,Reset:4,Ping:5,Ack:6},vc={Http:1,Ws:2},Yt={ProtocolError:1,VersionMismatch:4},Gb={INITIAL_WINDOW:256*1024,ACK_THRESHOLD:32*1024},yc=12,Xb=0,Em=4294967295,M1=4294967295,iM=0,L1=1;class $t extends Error{code;constructor(a,o){super(a),this.name="ProtocolError",this.code=o}}const lM=new TextEncoder,cM=new TextDecoder;function z1(t){return lM.encode(t)}function Bc(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function Cm(t,a){if(!Number.isInteger(t)||t<0||t>M1)throw new RangeError(`${a} out of u32 range: ${t}`)}function H1(t){return t===Ge.Open||t===Ge.Data||t===Ge.End||t===Ge.Reset||t===Ge.Ping||t===Ge.Ack}function U1(t){return(t&-2)===0}function Zb(t){if(t.version!==Nn)throw new RangeError(`version must be ${Nn}`);if(!H1(t.kind))throw new RangeError(`unknown kind: ${t.kind}`);if(!Number.isInteger(t.flags)||t.flags<0||t.flags>65535)throw new RangeError(`flags out of u16 range: ${t.flags}`);if(t.kind===Ge.Data){if(!U1(t.flags))throw new RangeError("reserved flag bits set on Data frame")}else if(t.flags!==0)throw new RangeError("flags must be 0 on a non-Data frame");Cm(t.streamId,"streamId"),Cm(t.seq,"seq");const a=new Uint8Array(yc),o=Bc(a);return o.setUint8(0,t.version),o.setUint8(1,t.kind),o.setUint16(2,t.flags),o.setUint32(4,t.streamId),o.setUint32(8,t.seq),a}function uM(t){if(t.length<yc)throw new $t("header too short",Yt.ProtocolError);const a=Bc(t),o=a.getUint8(0);if(o!==Nn)throw new $t(`bad version ${o}`,Yt.VersionMismatch);const s=a.getUint8(1);if(!H1(s))throw new $t(`unknown kind ${s}`,Yt.ProtocolError);const l=a.getUint16(2);if(s===Ge.Data){if(!U1(l))throw new $t("reserved flag bits set on Data frame",Yt.ProtocolError)}else if(l!==0)throw new $t("flags must be 0 on a non-Data frame",Yt.ProtocolError);const u=a.getUint32(4),f=a.getUint32(8);return{version:o,kind:s,flags:l,streamId:u,seq:f}}function Qb(t){let a;if(t.transport===vc.Http){if(!t.http)throw new RangeError("http meta required for Http transport");a=t.http}else if(t.transport===vc.Ws){if(!t.ws)throw new RangeError("ws meta required for Ws transport");a=t.ws}else throw new RangeError(`unknown transport: ${t.transport}`);const o=z1(JSON.stringify(a));if(o.length>65535)throw new RangeError("open meta too large");const s=new Uint8Array(3+o.length);return s[0]=t.transport,Bc(s).setUint16(1,o.length),s.set(o,3),s}function dM(t){if(!Array.isArray(t))return!1;for(const a of t)if(!Array.isArray(a)||a.length!==2||typeof a[0]!="string"||typeof a[1]!="string")return!1;return!0}const Wc={ConnSalt:1,Hello:2},Tm={daemon:1,device:2},fM=34;function mM(t){if(t.salt.length!==32)throw new RangeError(`conn salt must be 32 bytes, got ${t.salt.length}`);const a=new Uint8Array(34);return a[0]=Wc.ConnSalt,a[1]=Tm.device,a.set(t.salt,2),a}function pM(t){if(t.length!==fM)throw new $t("conn salt must be 34 bytes",Yt.ProtocolError);if(t[0]!==Wc.ConnSalt)throw new $t("not a ConnSalt frame",Yt.ProtocolError);const a=t[1],o=a===Tm.daemon?"daemon":a===Tm.device?"device":null;if(o===null)throw new $t("bad conn salt role",Yt.ProtocolError);return{role:o,salt:t.slice(2)}}function hM(t){return t.length>=1&&t[0]===Wc.ConnSalt}function gM(t){if(t.role!=="daemon"&&t.role!=="device")throw new RangeError(`bad role: ${t.role}`);const a=z1(JSON.stringify(t)),o=new Uint8Array(1+a.length);return o[0]=Wc.Hello,o.set(a,1),o}function vM(t){Cm(t,"cumulativeBytes");const a=new Uint8Array(4);return Bc(a).setUint32(0,t),a}function yM(t,a){const o=new Uint8Array(1+t.length);return o[0]=a?1:0,o.set(t,1),o}function bM(t){if(t.length<1)throw new $t("ws message too short",Yt.ProtocolError);const a=t[0];if(a!==0&&a!==1)throw new $t("bad ws isText flag",Yt.ProtocolError);return{data:t.slice(1),isText:a===1}}function Jb(t){const a=new Uint8Array(1+t.length);return a[0]=L1,a.set(t,1),a}function wM(t){if(t.length<1)throw new $t("http data too short",Yt.ProtocolError);const a=t[0];if(a===iM){let o;try{o=JSON.parse(cM.decode(t.subarray(1)))}catch{throw new $t("http head not JSON",Yt.ProtocolError)}const s=o;if(typeof s.status!="number"||!dM(s.headers))throw new $t("bad http head",Yt.ProtocolError);return{kind:"head",head:{status:s.status,headers:s.headers}}}if(a===L1)return{kind:"body",data:t.slice(1)};throw new $t(`unknown http disc ${a}`,Yt.ProtocolError)}function e0(t){let a=1;return()=>{a===Em&&(a+=2);const o=a;if(a+=2,a>M1)throw new RangeError("stream id space exhausted; re-handshake required");return o}}const xM={ok:!0};function t0(t=Gb.INITIAL_WINDOW,a=Gb.ACK_THRESHOLD){let o=0,s=0,l=0,u=0;const f=()=>o-s,m=()=>f()>=t;return{trySend(g){return f()+g>t?{ok:!1,reason:"WindowExhausted"}:(o+=g,xM)},applyAck(g){const p=m();return g<=s?{resumed:!1}:(s=Math.min(g,o),{resumed:p&&!m()})},onConsume(g){return l+=g,l-u>=a?(u=l,{ackCumulative:l}):null},flushAck(){return u=l,{ackCumulative:l}},isPaused:()=>m()}}const kM=1,Vf=256*1024,Nm=new TextEncoder,SM=new TextDecoder,EM=t=>{let a=0;for(const l of t)a+=l.length;const o=new Uint8Array(a);let s=0;for(const l of t)o.set(l,s),s+=l.length;return o},CM=t=>{if(typeof t=="string")return{bytes:Nm.encode(t),isText:!0};if(t instanceof Uint8Array)return{bytes:t,isText:!1};if(t instanceof ArrayBuffer)return{bytes:new Uint8Array(t),isText:!1};const a=t;return{bytes:new Uint8Array(a.buffer,a.byteOffset,a.byteLength),isText:!1}},TM=t=>{const a=t.generateConnSalt??CD;let o=null,s=null,l=null,u=null,f=null,m=e0();const g=new Map,p=(j,A)=>{if(j.length!==A.length)return!1;for(let O=0;O<j.length;O++)if(j[O]!==A[O])return!1;return!0},b=(j,A,O,D=0)=>{if(!s||!o)throw new Error("frame-mux: seal before channel handshake complete");const L=Zb({version:Nn,kind:j,flags:D,streamId:A,seq:s.nextSeq});t.onSeal?.({key:o.p2d,direction:"p2d",headerBytes:L});const{ciphertext:P}=OD(s,{key:o.p2d,headerBytes:L,payload:O}),J=new Uint8Array(L.length+P.length);return J.set(L,0),J.set(P,L.length),J},v=()=>{t.send(b(Ge.Data,Xb,gM({protocolVersion:Nn,role:"device",daemonId:t.daemonId,deviceId:t.deviceId})))},k=j=>{u&&(f&&p(f,j)||(o=TD({rootD2p:t.roots.d2p,rootP2d:t.roots.p2d,phoneConnSalt:u,daemonConnSalt:j,ids:{daemonId:t.daemonId,deviceId:t.deviceId,protocolVersion:Nn}}),s=_D("p2d"),l=RD("d2p"),f=Uint8Array.from(j),v(),t.onReady?.()))},E=(j,A)=>{t.send(b(Ge.Ack,j,vM(A)))},S=(j,A)=>{if(!o)return Promise.reject(new Error("tunnel: channel not ready"));const O=m(),D=(A?.method??"GET").toUpperCase(),L=[];A?.headers&&new Headers(A.headers).forEach(($,F)=>{L.push([F,$])});const P=A?.body===void 0||A.body===null?void 0:NM(A.body),J=P!==void 0&&P.length>0;return new Promise((Q,$)=>{const F={kind:"http",body:[],recvFlow:t0(),resolve:Q,reject:$,settled:!1};g.set(O,F),t.send(b(Ge.Open,O,Qb({transport:vc.Http,http:{method:D,path:j,headers:L,hasBody:J}}))),J&&P?P.length<=Vf?(t.send(b(Ge.Data,O,Jb(P))),t.send(b(Ge.End,O,new Uint8Array(0)))):w(O,F,P):t.send(b(Ge.End,O,new Uint8Array(0)))})},w=async(j,A,O)=>{try{for(let D=0;D<O.length;D+=Vf){if(D>0&&t.awaitDrain&&await t.awaitDrain(),A.settled)return;t.send(b(Ge.Data,j,Jb(O.subarray(D,D+Vf))))}if(A.settled)return;t.send(b(Ge.End,j,new Uint8Array(0)))}catch(D){if(A.settled)return;A.settled=!0,g.delete(j),A.reject(D)}},C=(j,A)=>{if(A.settled)return;A.settled=!0,g.delete(j);const O=A.head,D=EM(A.body);if(!O){A.reject(new Error("tunnel: stream ended without an HTTP head"));return}let L=null;if(D.length>0){const P=new ArrayBuffer(D.length);new Uint8Array(P).set(D),L=P}A.resolve(new Response(L,{status:O.status,headers:O.headers}))};class T{OPEN=1;readyState=0;onopen=null;onmessage=null;onclose=null;onerror=null;streamId;constructor(A){this.streamId=A}send(A){if(this.readyState!==this.OPEN)return;const{bytes:O,isText:D}=CM(A);t.send(b(Ge.Data,this.streamId,yM(O,D)))}close(A,O){if(this.readyState===3)return;const D=this.readyState===this.OPEN;this.readyState=3,D&&t.send(b(Ge.End,this.streamId,new Uint8Array(0))),g.delete(this.streamId)}_deliver(A,O){this.onmessage&&this.onmessage({data:O?SM.decode(A):A})}_remoteClose(A,O){this.readyState!==3&&(this.readyState=3,g.delete(this.streamId),this.onclose?.(O===void 0?{code:A}:{code:A,reason:O}))}}return{beginChannel(){u=a(),o=null,s=null,l=null,f=null,this.resetAll("rekey"),m=e0();const j=Zb({version:Nn,kind:Ge.Data,flags:0,streamId:Em,seq:0}),A=mM({salt:u}),O=new Uint8Array(j.length+A.length);O.set(j,0),O.set(A,j.length),t.send(O)},onFrame(j){const A=j.subarray(0,yc),O=j.subarray(yc),D=uM(A);if(D.streamId===Em&&hM(O)){const{role:J,salt:Q}=pM(O);J==="daemon"&&k(Q);return}if(!l||!o)return;const L=DD(l,{key:o.d2p,headerBytes:A,ciphertext:O,seq:D.seq});if(D.streamId===Xb)return;const P=g.get(D.streamId);if(P){if(P.kind==="http"){if(D.kind===Ge.Reset){P.settled||(P.settled=!0,g.delete(D.streamId),P.reject(new Error("tunnel: HTTP stream reset by daemon")));return}if(D.kind===Ge.Data){const J=wM(L);if(J.kind==="head")P.head=J.head;else{P.body.push(J.data);const Q=P.recvFlow.onConsume(J.data.length);Q&&E(D.streamId,Q.ackCumulative)}(D.flags&kM)!==0&&C(D.streamId,P);return}if(D.kind===Ge.End){C(D.streamId,P);return}return}if(D.kind===Ge.Data){const J=bM(L),Q=P.recvFlow.onConsume(J.data.length);Q&&E(D.streamId,Q.ackCumulative),P.socket._deliver(J.data,J.isText);return}if(D.kind===Ge.End||D.kind===Ge.Reset){P.socket._remoteClose(D.kind===Ge.Reset?1011:1e3);return}}},fetch:S,openWebSocket:(j,A)=>{if(!o){const P=new T(-1);return queueMicrotask(()=>P._remoteClose(1011,"tunnel: channel not ready")),P}const O=m(),D=[];if(A)for(const[P,J]of Object.entries(A))J!==void 0&&D.push([P,String(J)]);const L=new T(O);return g.set(O,{kind:"ws",recvFlow:t0(),socket:L}),t.send(b(Ge.Open,O,Qb({transport:vc.Ws,ws:D.length>0?{path:j,query:D}:{path:j}}))),queueMicrotask(()=>{L.readyState===0&&(L.readyState=L.OPEN,L.onopen?.())}),L},resetAll(j){for(const[A,O]of[...g.entries()])g.delete(A),O.kind==="http"?O.settled||(O.settled=!0,O.reject(new Error(`tunnel: connection lost (${j})`))):O.socket._remoteClose(1006,j)}}},NM=t=>typeof t=="string"?Nm.encode(t):t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Nm.encode(String(t)),jM=2e4,AM=1e4,_M=6,RM=()=>{let t=0;return{next(){t+=1;const a=Math.min(3e4,500*2**(t-1));return Math.floor(a/2+Math.random()*(a/2))},reset(){t=0}}},OM=(t,a)=>!a&&(t===Ar.Forbidden||t===Ar.Unauthorized),DM=(t,a)=>{const o=t.WebSocketImpl??WebSocket,s=t.setTimer??(($,F)=>setTimeout($,F)),l=t.clearTimer??($=>clearTimeout($)),u=t.backoff??RM(),f=t.heartbeatMs??jM,m=t.heartbeatDeadlineMs??AM,g=t.maxOfflineRetries??_M;let p=null,b=0,v=!1,k=!1,E=!1,S=0,w=null,C=null,T=null;const N=`${t.gatewayUrl}/relay?daemonId=${encodeURIComponent(t.daemonId)}`,j=()=>{T!==null&&(l(T),T=null)},A=()=>{C!==null&&(clearInterval(C),C=null),j()},O=($,F)=>{A(),C=setInterval(()=>{if($.readyState===$.OPEN){try{$.send(Zx)}catch{}T===null&&(T=s(()=>{if(T=null,!(F!==b||k)){A();try{$.close()}catch{}}},m))}},f)},D=()=>{if(k||v||E)return;const $=++b;let F=!1;const ne=new o(N,[`bearer.${t.phoneSessionToken}`]);ne.binaryType="arraybuffer",p=ne,ne.onopen=()=>{$!==b||k||(F=!0,u.reset(),S=0,O(ne,$),a.onUp())},ne.onmessage=Z=>{if($!==b||k)return;const q=Z.data;if(typeof q=="string"){if(q.startsWith(Nb)){let U;try{U=JSON.parse(q.slice(Nb.length))}catch{return}if(U.t==="revoked"){L(Ar.Revoked),a.onControl(U);return}a.onControl(U);return}q===Qx&&j();return}const M=q instanceof ArrayBuffer?new Uint8Array(q):new Uint8Array(q);a.onFrame(M)},ne.onerror=()=>{},ne.onclose=Z=>{if($!==b||k)return;A(),p=null;const q=Z.code??Ar.InternalError;if(U5(q)||OM(q,F)){L(q);return}if(q===Ar.DaemonOffline){if(S+=1,S>=g){E=!0,a.onDown({code:q,authFatal:!1,daemonOffline:!0});return}}else S=0;const M=u.next();a.onDown({code:q,authFatal:!1,nextRetryInMs:M}),w=s(()=>{w=null,D()},M)}},L=$=>{v||(v=!0,A(),w!==null&&(l(w),w=null),a.onDown({code:$,authFatal:!0}))},P=()=>{k||v||E||p!==null&&(p.readyState===p.OPEN||p.readyState===WebSocket.CONNECTING)||(w!==null&&(l(w),w=null),D())},J=()=>{typeof document<"u"&&document.visibilityState==="visible"&&P()},Q=()=>P();return typeof document<"u"&&document.addEventListener("visibilitychange",J),typeof window<"u"&&window.addEventListener("online",Q),D(),{send($){p&&p.readyState===p.OPEN&&p.send($)},bufferedAmount:()=>p&&p.readyState===p.OPEN?p.bufferedAmount:0,isOpen:()=>p!==null&&p.readyState===p.OPEN,resume(){k||v||!E||(E=!1,S=0,u.reset(),D())},close(){if(k=!0,b+=1,A(),w!==null&&(l(w),w=null),p){try{p.close()}catch{}p=null}typeof document<"u"&&document.removeEventListener("visibilitychange",J),typeof window<"u"&&window.removeEventListener("online",Q)}}};function MM(t){const a=t.session??t.persistedSession?.()??null;if(!a)throw new Error("createTunnelTransport: no session and persistedSession() returned null");let o={state:"connecting"};const s=(A,O)=>{o={state:A,...O?.reason?{reason:O.reason}:{},...O?.nextRetryInMs!==void 0?{nextRetryInMs:O.nextRetryInMs}:{},...O?.retry?{retry:O.retry}:{}},t.onStatus(o)};let l=null,u=!1,f=!1,m=!1;const g=new Set,p=t.setTimer??((A,O)=>setTimeout(A,O)),b=t.clearTimer??(A=>clearTimeout(A)),v=()=>{for(const A of g)A.timer!==null&&b(A.timer),A.resolve();g.clear()},k=A=>{for(const O of g)O.timer!==null&&b(O.timer),O.reject(new Error(`tunnel: ${A}`));g.clear()},E=()=>{u=!1},S=()=>{u||(m=!1,f=!1,u=!0,s("online"),v())},w=()=>{m=!0,u=!1,j.beginChannel()},C=4*1024*1024,T=50,N=()=>new Promise(A=>{const O=()=>{if(!l||l.bufferedAmount()<=C){A();return}p(O,T)};O()}),j=TM({roots:a.roots,daemonId:a.daemonId,deviceId:a.deviceId,send:A=>l?.send(A),onReady:S,awaitDrain:N});return l=DM({gatewayUrl:a.gatewayUrl,daemonId:a.daemonId,phoneSessionToken:a.phoneSessionToken,...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{},...t.setTimer?{setTimer:t.setTimer}:{},...t.clearTimer?{clearTimer:t.clearTimer}:{},...t.backoff?{backoff:t.backoff}:{}},{onFrame:A=>{try{j.onFrame(A)}catch{j.resetAll("frame_open_failed"),l?.close(),s("disconnected",{reason:"integrity"})}},onControl:A=>{if(A.t==="peer-offline"&&A.role==="daemon")f=!0,m=!1,E(),j.resetAll("peer_offline"),s("reconnecting");else if(A.t==="peer-online"&&A.role==="daemon"){if(u||m||!f)return;f=!1,w()}else A.t==="revoked"&&(f=!1,m=!1,E(),j.resetAll("revoked"),k(A.reason??"revoked"),s("revoked",{reason:A.reason}))},onUp:()=>{f=!1,w()},onDown:A=>{f=!1,m=!1,E(),j.resetAll(A.authFatal?"auth_fatal":A.daemonOffline?"daemon_offline":"transient"),A.authFatal?(k("auth_fatal"),s("revoked")):A.daemonOffline?(k("daemon_offline"),s("disconnected",{reason:"daemon_offline",retry:()=>l?.resume()})):s("reconnecting",A.nextRetryInMs!==void 0?{nextRetryInMs:A.nextRetryInMs}:void 0)}}),{requiresUiSession:!1,fetch:(A,O)=>j.fetch(A,O),openWebSocket:(A,O)=>j.openWebSocket(A,O),status:()=>o,ready:(A={})=>{if(u)return Promise.resolve();const O=A.timeoutMs??1e4;return new Promise((D,L)=>{const P={resolve:D,reject:L,timer:null};P.timer=p(()=>{g.delete(P),L(new Error("tunnel: channel ready timed out"))},O),g.add(P)})},dispose:()=>{f=!1,m=!1,E(),l?.close(),l=null,j.resetAll("disposed"),k("disposed")}}}const LM=t=>{const a=t.onStatus??(()=>{});return async({daemonId:o,deviceId:s,stored:l})=>{let u;try{u=await t.resolveSession({daemonId:o,deviceId:s,stored:l})}catch(m){return m.relayTokenStatus===403?{ok:!1,failure:{code:"relay_revoked",message:`device session revoked for ${o}`}}:{ok:!1,failure:{code:"select_failed",message:`could not establish a session for ${o}: ${m.message}`}}}const f=MM({session:u,onStatus:a,...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{}});try{await f.ready({timeoutMs:t.readyTimeoutMs??1e4})}catch(m){return f.dispose(),{ok:!1,failure:{code:"select_failed",message:`could not open a ready tunnel for ${o}: ${m.message}`}}}return GT(f),{ok:!0}}},zM=(t={})=>{if(!(t.isGateway??O1)())return{mode:"direct"};if(!t.resolveSession)throw new Error("bootTransport: a gateway bundle requires resolveSession to build the tunnel");return{mode:"tunnel",connectTransport:LM({resolveSession:t.resolveSession,...t.onStatus?{onStatus:t.onStatus}:{},...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{},...t.readyTimeoutMs!==void 0?{readyTimeoutMs:t.readyTimeoutMs}:{}})}},HM=async({stored:t})=>{if(!t)throw new Error("mobileResolveSession: no persisted device session for the selected daemon");const a=window.location.origin,o=a.replace(/^http/,"ws"),s=await fetch(`${a}/pair/relay-token`,{method:"POST",credentials:"include"});if(!s.ok)throw Object.assign(new Error(`mobileResolveSession: relay-token request failed (${s.status})`),{relayTokenStatus:s.status});const{token:l}=await s.json();return{roots:{d2p:ui(t.rootKeys.d2p),p2d:ui(t.rootKeys.p2d)},deviceId:t.deviceId,daemonId:t.daemonId,gatewayUrl:o,phoneSessionToken:l}},B1=document.getElementById("root");if(!B1)throw new Error("Root element not found");const UM=zM({resolveSession:HM,onStatus:i4});cS.createRoot(B1).render(c.jsx(y.StrictMode,{children:sM(UM,H5,oM)}));B3();export{FM as $,bc as A,JM as B,qo as C,$M as D,mi as E,XM as F,p0 as G,pi as H,u0 as I,ZM as J,xc as K,Ja as L,wE as M,QM as N,zr as O,Lr as P,VM as Q,Mr as R,BE as S,Je as T,GM as U,Va as V,v0 as W,fa as X,kc as Y,Ko as Z,D_ as _,t8 as a,KM as a0,mN as a1,YM as a2,Js as a3,hw as a4,Rm as a5,c8 as a6,d0 as a7,i0 as a8,Jl as a9,VS as aa,u8 as ab,f0 as ac,pR as ad,i8 as ae,xR as af,Mt as ag,tx as ah,Jm as ai,l8 as aj,ZA as ak,_m as al,qM as am,PM as an,MS as ao,wc as b,ve as c,s0 as d,sn as e,a8 as f,WM as g,IE as h,yt as i,c as j,Hr as k,e8 as l,Ur as m,YS as n,r8 as o,o8 as p,Po as q,y as r,IM as s,Sc as t,be as u,s8 as v,n8 as w,ga as x,Dr as y,YT as z};