@straiffi/archon 1.10.8 → 1.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{ActivityView-PGEex8sS.js → ActivityView-CKvbDXeA.js} +1 -1
- package/dist/client/assets/{GitHubActionsDialog-CwsZRevc.js → GitHubActionsDialog-Dzo0vtak.js} +1 -1
- package/dist/client/assets/{VerificationDialog-BYE1M9T2.js → VerificationDialog-BJnOitrJ.js} +1 -1
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-CzUKSWJZ.js → architectureDiagram-3BPJPVTR-BAIGV9Mj.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-DoNm6BnS.js → blockDiagram-GPEHLZMM-B-5v5jSZ.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-C7ocs3wQ.js → c4Diagram-AAUBKEIU-C6wU415o.js} +1 -1
- package/dist/client/assets/channel-5mIy7nm1.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-DUmaxCq8.js → chunk-2J33WTMH-COmvX2tP.js} +1 -1
- package/dist/client/assets/{chunk-3OPIFGDE-CX2MPsMQ.js → chunk-3OPIFGDE-BlANptdY.js} +1 -1
- package/dist/client/assets/{chunk-5ZQYHXKU-B103kU_y.js → chunk-5ZQYHXKU-ETyA2_GU.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-BmLJ4h5X.js → chunk-727SXJPM-D5-DudwF.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-Cnv1b4Vd.js → chunk-AQP2D5EJ-k1AJ4sA3.js} +1 -1
- package/dist/client/assets/{chunk-CSCIHK7Q-CkIUhpY9.js → chunk-CSCIHK7Q-jfksXwY9.js} +1 -1
- package/dist/client/assets/{chunk-KSCS5N6A-wmkCuZ5U.js → chunk-KSCS5N6A-CHj0FDj9.js} +1 -1
- package/dist/client/assets/{chunk-L5ZTLDWV-D9AdL5mv.js → chunk-L5ZTLDWV-1ODGxXhG.js} +1 -1
- package/dist/client/assets/{chunk-LZXEDZCA-rMyTvR3J.js → chunk-LZXEDZCA-Bgh9X2W0.js} +2 -2
- package/dist/client/assets/{chunk-ND2GUHAM-19HTozu8.js → chunk-ND2GUHAM-DDkb3sp4.js} +1 -1
- package/dist/client/assets/{chunk-NZK2D7GU-DBHgwKcS.js → chunk-NZK2D7GU-B6B8PZ_-.js} +1 -1
- package/dist/client/assets/{chunk-O5CBEL6O-4WpSG06s.js → chunk-O5CBEL6O-DhiUIFgj.js} +1 -1
- package/dist/client/assets/{chunk-WU5MYG2G-loqCl7ki.js → chunk-WU5MYG2G-Dzd0fbP3.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-BiQ-X2Sg.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CF-wCYW-.js +1 -0
- package/dist/client/assets/{dagre-BM42HDAG-FVpIr0qZ.js → dagre-BM42HDAG-DoNDMCXI.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-Dgj8FaDO.js → diagram-2AECGRRQ-ETDXSa5q.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-DNpYKz_a.js → diagram-5GNKFQAL-CgTUep7e.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-N7R7efvN.js → diagram-KO2AKTUF-BKTx2iRe.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-hoOvd_tG.js → diagram-LMA3HP47-9iEiScHT.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-ze25ZIy6.js → diagram-OG6HWLK6-UIZRh7Qa.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-780zvNNZ.js → erDiagram-TEJ5UH35-BpNJmJva.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-x4UB_M_4.js → flowDiagram-I6XJVG4X-C-rK0XZ1.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-B5Wl0y91.js → ganttDiagram-6RSMTGT7-DWyfPvv_.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-CZtVHpBH.js → gitGraphDiagram-PVQCEYII-x71bzdc_.js} +1 -1
- package/dist/client/assets/index-CIAO5aE_.css +2 -0
- package/dist/client/assets/{index-Cy3ZoenG.js → index-nCGyalrn.js} +6 -6
- package/dist/client/assets/{infoDiagram-5YYISTIA-BOzLwsnA.js → infoDiagram-5YYISTIA-CbRus0Xu.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-ButBhNg6.js → ishikawaDiagram-YF4QCWOH-DvaMHrgN.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-CO0Db0Gn.js → journeyDiagram-JHISSGLW-BQBu4YGn.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-B6KT8yln.js → kanban-definition-UN3LZRKU-8rU-U7L1.js} +1 -1
- package/dist/client/assets/{line-Cv-WaOjt.js → line-CSZnwjLA.js} +1 -1
- package/dist/client/assets/{mermaid-parser.core-DgJy4Qlx.js → mermaid-parser.core-CTOl2slE.js} +1 -1
- package/dist/client/assets/{mermaid.core-YpvipwZo.js → mermaid.core-B9gr0Vqf.js} +3 -3
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-DGgtT98Y.js → mindmap-definition-RKZ34NQL-But1_PWQ.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-CgqnLewO.js → pieDiagram-4H26LBE5-CnlVmfSG.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-Ci_0SzdR.js → quadrantDiagram-W4KKPZXB-Dww1ZGuR.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-wJl0DP74.js → requirementDiagram-4Y6WPE33-CNf_loe8.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-CE7aDnzF.js → sankeyDiagram-5OEKKPKP-DBhi37Jj.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-CW0bF1i6.js → sequenceDiagram-3UESZ5HK-B64hb4E4.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-Ccl0RXsJ.js → stateDiagram-AJRCARHV-DcS6oB-S.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-PWeeL0tR.js +1 -0
- package/dist/client/assets/{timeline-definition-PNZ67QCA-TuF6SUnb.js → timeline-definition-PNZ67QCA-Dq-4tXfh.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-D8OvSROI.js → vennDiagram-CIIHVFJN-CeDklSE_.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-DXW3R5NJ.js → wardleyDiagram-YWT4CUSO-D2cJISMm.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-qdiUQDW9.js → xychartDiagram-2RQKCTM6-CBF-tTpF.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/index.js +25 -21
- package/dist/server/index.js.map +1 -1
- package/dist/server/lib/boundedProcess.js +129 -0
- package/dist/server/lib/boundedProcess.js.map +1 -0
- package/dist/server/lib/bundleReviewOperations.js +7 -0
- package/dist/server/lib/bundleReviewOperations.js.map +1 -1
- package/dist/server/lib/chats.js +12 -0
- package/dist/server/lib/chats.js.map +1 -1
- package/dist/server/lib/git.js +89 -48
- package/dist/server/lib/git.js.map +1 -1
- package/dist/server/lib/integrations/github.js +49 -105
- package/dist/server/lib/integrations/github.js.map +1 -1
- package/dist/server/lib/mobileAccess.js.map +1 -1
- package/dist/server/lib/reviewFindings.js +31 -2
- package/dist/server/lib/reviewFindings.js.map +1 -1
- package/dist/server/lib/tickets.js +46 -8
- package/dist/server/lib/tickets.js.map +1 -1
- package/dist/server/lib/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/channel-b-KoJfeL.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-2c5Acffy.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-ClrW9LEB.js +0 -1
- package/dist/client/assets/index-BXsDja_y.css +0 -2
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-k65NSsdn.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-B9gr0Vqf.js","assets/chunk-O5CBEL6O-DhiUIFgj.js","assets/src-BRjoYtUW.js","assets/chunk-BNv3lrIs.js","assets/chunk-5ZQYHXKU-ETyA2_GU.js","assets/dist-CERhmQhR.js","assets/chunk-CSCIHK7Q-jfksXwY9.js","assets/chunk-3OPIFGDE-BlANptdY.js","assets/chunk-L5ZTLDWV-1ODGxXhG.js","assets/chunk-NZK2D7GU-B6B8PZ_-.js","assets/rough.esm-BoTisKeL.js","assets/chunk-BSJP7CBP-DJ57XcV5.js","assets/chunk-KSCS5N6A-CHj0FDj9.js","assets/line-CSZnwjLA.js","assets/path-sMK4d_s9.js","assets/array-BNor45A1.js","assets/chunk-LZXEDZCA-Bgh9X2W0.js","assets/chunk-WU5MYG2G-Dzd0fbP3.js","assets/chunk-XPW4576I-DObFPxjB.js","assets/VerificationDialog-BJnOitrJ.js","assets/GitHubActionsDialog-Dzo0vtak.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{a as e,i as t,n,r,t as i}from"./chunk-BNv3lrIs.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var a=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),o=i(((e,t)=>{t.exports=a()})),s=i((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),c=i(((e,t)=>{t.exports=s()})),l=i((e=>{var t=c();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.5`})),u=i(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=l()})),d=i((e=>{var t=o(),n=c(),r=u();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(s(e)!==e)throw Error(i(188))}function p(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return f(a),e;if(o===r)return f(a),t;o=o.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=o;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=o;break}if(l===r){c=!0,r=a,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=a;break}if(l===r){c=!0,r=o,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},z=[],ee=-1;function B(e){return{current:e}}function V(e){0>ee||(e.current=z[ee],z[ee]=null,ee--)}function te(e,t){ee++,z[ee]=e.current,e.current=t}var H=B(null),U=B(null),ne=B(null),re=B(null);function ie(e,t){switch(te(ne,t),te(U,e),te(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Wd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Wd(t),e=Gd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}V(H),te(H,e)}function ae(){V(H),V(U),V(ne)}function oe(e){e.memoizedState!==null&&te(re,e);var t=H.current,n=Gd(t,e.type);t!==n&&(te(U,e),te(H,n))}function W(e){U.current===e&&(V(H),V(U)),re.current===e&&(V(re),tp._currentValue=R)}var se,ce;function le(e){if(se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);se=t&&t[1]||``,ce=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+se+e+ce}var ue=!1;function de(e,t){if(!e||ue)return``;ue=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -51,11 +51,11 @@ Error generating stack: `+e.message+`
|
|
|
51
51
|
|
|
52
52
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
53
53
|
|
|
54
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Os=`DialogDescriptionWarning`,ks=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Es(Os).contentName}}.`;return p.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},As=ts,js=ss,Ms=ls,Ns=ps,Ps=vs,Fs=bs,Is=Ss;function Ls(e){let t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Rs(e){let[t,n]=p.useState(void 0);return yi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var zs=[`top`,`right`,`bottom`,`left`],Bs=Math.min,Vs=Math.max,Hs=Math.round,Us=Math.floor,Ws=e=>({x:e,y:e}),Gs={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ks(e,t,n){return Vs(e,Bs(t,n))}function qs(e,t){return typeof e==`function`?e(t):e}function Js(e){return e.split(`-`)[0]}function Ys(e){return e.split(`-`)[1]}function Xs(e){return e===`x`?`y`:`x`}function Zs(e){return e===`y`?`height`:`width`}function Qs(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $s(e){return Xs(Qs(e))}function ec(e,t,n){n===void 0&&(n=!1);let r=Ys(e),i=$s(e),a=Zs(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=lc(o)),[o,lc(o)]}function tc(e){let t=lc(e);return[nc(e),t,nc(t)]}function nc(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rc=[`left`,`right`],ic=[`right`,`left`],ac=[`top`,`bottom`],oc=[`bottom`,`top`];function sc(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ic:rc:t?rc:ic;case`left`:case`right`:return t?ac:oc;default:return[]}}function cc(e,t,n,r){let i=Ys(e),a=sc(Js(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(nc)))),a}function lc(e){let t=Js(e);return Gs[t]+e.slice(t.length)}function uc(e){return{top:0,right:0,bottom:0,left:0,...e}}function dc(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:uc(e)}function fc(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pc(e,t,n){let{reference:r,floating:i}=e,a=Qs(t),o=$s(t),s=Zs(o),c=Js(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Ys(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function mc(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=qs(t,e),p=dc(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=fc(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=fc(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var hc=50,gc=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:mc},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=pc(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<hc&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=pc(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},_c=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=qs(e,t)||{};if(l==null)return{};let d=dc(u),f={x:n,y:r},p=$s(i),m=Zs(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Bs(d[_],T),D=Bs(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Ks(O,A,k),M=!c.arrow&&Ys(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),vc=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=qs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Js(r),_=Qs(o),v=Js(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[lc(o)]:tc(o)),x=p!==`none`;!d&&x&&b.push(...cc(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ec(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Qs(t))||T.every(e=>Qs(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Qs(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function yc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bc(e){return zs.some(t=>e[t]>=0)}var xc=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=qs(e,t);switch(i){case`referenceHidden`:{let e=yc(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:bc(e)}}}case`escaped`:{let e=yc(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:bc(e)}}}default:return{}}}}},Sc=new Set([`left`,`top`]);async function Cc(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Js(n),s=Ys(n),c=Qs(n)===`y`,l=Sc.has(o)?-1:1,u=a&&c?-1:1,d=qs(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var wc=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Cc(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Tc=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=qs(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Qs(Js(i)),p=Xs(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Ks(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Ks(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Ec=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=qs(e,t),u={x:n,y:r},d=Qs(i),f=Xs(d),p=u[f],m=u[d],h=qs(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Sc.has(Js(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Dc=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=qs(e,t),u=await o.detectOverflow(t,l),d=Js(i),f=Ys(i),p=Qs(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Bs(h-u[g],v),x=Bs(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Vs(u.left,0),t=Vs(u.right,0),n=Vs(u.top,0),r=Vs(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Vs(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Vs(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Oc(){return typeof window<`u`}function kc(e){return Mc(e)?(e.nodeName||``).toLowerCase():`#document`}function Ac(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function jc(e){return((Mc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Mc(e){return Oc()?e instanceof Node||e instanceof Ac(e).Node:!1}function Nc(e){return Oc()?e instanceof Element||e instanceof Ac(e).Element:!1}function Pc(e){return Oc()?e instanceof HTMLElement||e instanceof Ac(e).HTMLElement:!1}function Fc(e){return!Oc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ac(e).ShadowRoot}function Ic(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=qc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Lc(e){return/^(table|td|th)$/.test(kc(e))}function Rc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var zc=/transform|translate|scale|rotate|perspective|filter/,Bc=/paint|layout|strict|content/,Vc=e=>!!e&&e!==`none`,Hc;function Uc(e){let t=Nc(e)?qc(e):e;return Vc(t.transform)||Vc(t.translate)||Vc(t.scale)||Vc(t.rotate)||Vc(t.perspective)||!Gc()&&(Vc(t.backdropFilter)||Vc(t.filter))||zc.test(t.willChange||``)||Bc.test(t.contain||``)}function Wc(e){let t=Yc(e);for(;Pc(t)&&!Kc(t);){if(Uc(t))return t;if(Rc(t))return null;t=Yc(t)}return null}function Gc(){return Hc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Hc}function Kc(e){return/^(html|body|#document)$/.test(kc(e))}function qc(e){return Ac(e).getComputedStyle(e)}function Jc(e){return Nc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yc(e){if(kc(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fc(e)&&e.host||jc(e);return Fc(t)?t.host:t}function Xc(e){let t=Yc(e);return Kc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pc(t)&&Ic(t)?t:Xc(t)}function Zc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Xc(e),i=r===e.ownerDocument?.body,a=Ac(r);if(i){let e=Qc(a);return t.concat(a,a.visualViewport||[],Ic(r)?r:[],e&&n?Zc(e):[])}else return t.concat(r,Zc(r,[],n))}function Qc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $c(e){let t=qc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Pc(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Hs(n)!==a||Hs(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function el(e){return Nc(e)?e:e.contextElement}function tl(e){let t=el(e);if(!Pc(t))return Ws(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$c(t),o=(a?Hs(n.width):n.width)/r,s=(a?Hs(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var nl=Ws(0);function rl(e){let t=Ac(e);return!Gc()||!t.visualViewport?nl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function il(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ac(e)?!1:t}function al(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=el(e),o=Ws(1);t&&(r?Nc(r)&&(o=tl(r)):o=tl(e));let s=il(a,n,r)?rl(a):Ws(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Ac(a),t=r&&Nc(r)?Ac(r):r,n=e,i=Qc(n);for(;i&&r&&t!==n;){let e=tl(i),t=i.getBoundingClientRect(),r=qc(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ac(i),i=Qc(n)}}return fc({width:u,height:d,x:c,y:l})}function ol(e,t){let n=Jc(e).scrollLeft;return t?t.left+n:al(jc(e)).left+n}function sl(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ol(e,n),y:n.top+t.scrollTop}}function cl(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=jc(r),s=t?Rc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ws(1),u=Ws(0),d=Pc(r);if((d||!d&&!a)&&((kc(r)!==`body`||Ic(o))&&(c=Jc(r)),d)){let e=al(r);l=tl(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?sl(o,c):Ws(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ll(e){return Array.from(e.getClientRects())}function ul(e){let t=jc(e),n=Jc(e),r=e.ownerDocument.body,i=Vs(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Vs(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+ol(e),s=-n.scrollTop;return qc(r).direction===`rtl`&&(o+=Vs(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var dl=25;function fl(e,t){let n=Ac(e),r=jc(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Gc();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=ol(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=dl&&(a-=o)}else l<=dl&&(a+=l);return{width:a,height:o,x:s,y:c}}function pl(e,t){let n=al(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Pc(e)?tl(e):Ws(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ml(e,t,n){let r;if(t===`viewport`)r=fl(e,n);else if(t===`document`)r=ul(jc(e));else if(Nc(t))r=pl(t,n);else{let n=rl(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return fc(r)}function hl(e,t){let n=Yc(e);return n===t||!Nc(n)||Kc(n)?!1:qc(n).position===`fixed`||hl(n,t)}function gl(e,t){let n=t.get(e);if(n)return n;let r=Zc(e,[],!1).filter(e=>Nc(e)&&kc(e)!==`body`),i=null,a=qc(e).position===`fixed`,o=a?Yc(e):e;for(;Nc(o)&&!Kc(o);){let t=qc(o),n=Uc(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Ic(o)&&!n&&hl(e,o))?r=r.filter(e=>e!==o):i=t,o=Yc(o)}return t.set(e,r),r}function _l(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Rc(t)?[]:gl(t,this._c):[].concat(n),r],o=ml(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ml(t,a[e],i);s=Vs(n.top,s),c=Bs(n.right,c),l=Bs(n.bottom,l),u=Vs(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function vl(e){let{width:t,height:n}=$c(e);return{width:t,height:n}}function yl(e,t,n){let r=Pc(t),i=jc(t),a=n===`fixed`,o=al(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ws(0);function l(){c.x=ol(i)}if(r||!r&&!a)if((kc(t)!==`body`||Ic(i))&&(s=Jc(t)),r){let e=al(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?sl(i,s):Ws(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function bl(e){return qc(e).position===`static`}function xl(e,t){if(!Pc(e)||qc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return jc(e)===n&&(n=n.ownerDocument.body),n}function Sl(e,t){let n=Ac(e);if(Rc(e))return n;if(!Pc(e)){let t=Yc(e);for(;t&&!Kc(t);){if(Nc(t)&&!bl(t))return t;t=Yc(t)}return n}let r=xl(e,t);for(;r&&Lc(r)&&bl(r);)r=xl(r,t);return r&&Kc(r)&&bl(r)&&!Uc(r)?n:r||Wc(e)||n}var Cl=async function(e){let t=this.getOffsetParent||Sl,n=this.getDimensions,r=await n(e.floating);return{reference:yl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wl(e){return qc(e).direction===`rtl`}var Tl={convertOffsetParentRelativeRectToViewportRelativeRect:cl,getDocumentElement:jc,getClippingRect:_l,getOffsetParent:Sl,getElementRects:Cl,getClientRects:ll,getDimensions:vl,getScale:tl,isElement:Nc,isRTL:wl};function El(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Dl(e,t){let n=null,r,i=jc(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Us(d),h=Us(i.clientWidth-(u+f)),g=Us(i.clientHeight-(d+p)),_=Us(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Vs(0,Bs(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!El(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Ol(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=el(e),u=i||a?[...l?Zc(l):[],...t?Zc(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Dl(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?al(e):null;c&&g();function g(){let t=al(e);h&&!El(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var kl=wc,Al=Tc,jl=vc,Ml=Dc,Nl=xc,Pl=_c,Fl=Ec,Il=(e,t,n)=>{let r=new Map,i={platform:Tl,...n},a={...i.platform,_c:r};return gc(e,t,{...i,platform:a})},Ll=typeof document<`u`?p.useLayoutEffect:function(){};function Rl(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Rl(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Rl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function zl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bl(e,t){let n=zl(e);return Math.round(t*n)/n}function Vl(e){let t=p.useRef(e);return Ll(()=>{t.current=e}),t}function Hl(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=p.useState(r);Rl(f,r)||h(r);let[g,_]=p.useState(null),[v,y]=p.useState(null),b=p.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=p.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||g,C=o||v,w=p.useRef(null),T=p.useRef(null),E=p.useRef(u),D=c!=null,O=Vl(c),k=Vl(i),A=Vl(l),j=p.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),Il(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Rl(E.current,t)&&(E.current=t,m.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Ll(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=p.useRef(!1);Ll(()=>(M.current=!0,()=>{M.current=!1}),[]),Ll(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=p.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=p.useMemo(()=>({reference:S,floating:C}),[S,C]),F=p.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Bl(P.floating,u.x),r=Bl(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...zl(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return p.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Ul=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Pl({element:r.current,padding:i}).fn(n):r?Pl({element:r,padding:i}).fn(n):{}}}},Wl=(e,t)=>{let n=kl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gl=(e,t)=>{let n=Al(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kl=(e,t)=>({fn:Fl(e).fn,options:[e,t]}),ql=(e,t)=>{let n=jl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jl=(e,t)=>{let n=Ml(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yl=(e,t)=>{let n=Nl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xl=(e,t)=>{let n=Ul(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zl=`Arrow`,Ql=p.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,X.jsx)(ci.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,X.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Ql.displayName=Zl;var $l=Ql,eu=`Popper`,[tu,nu]=hi(eu),[ru,iu]=tu(eu),au=e=>{let{__scopePopper:t,children:n}=e,[r,i]=p.useState(null);return(0,X.jsx)(ru,{scope:t,anchor:r,onAnchorChange:i,children:n})};au.displayName=eu;var ou=`PopperAnchor`,su=p.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=iu(ou,n),o=p.useRef(null),s=$r(t,o),c=p.useRef(null);return p.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,X.jsx)(ci.div,{...i,ref:s})});su.displayName=ou;var cu=`PopperContent`,[lu,uu]=tu(cu),du=p.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=iu(cu,n),[v,y]=p.useState(null),b=$r(t,e=>y(e)),[x,S]=p.useState(null),C=Rs(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(hu),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Hl({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Ol(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[Wl({mainAxis:i+T,alignmentAxis:o}),c&&Gl({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Kl():void 0,...A}),c&&ql({...A}),Jl({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Xl({element:x,padding:s}),gu({arrowWidth:w,arrowHeight:T}),f&&Yl({strategy:`referenceHidden`,...A})]}),[I,L]=_u(N),R=Yi(h);yi(()=>{P&&R?.()},[P,R]);let z=F.arrow?.x,ee=F.arrow?.y,B=F.arrow?.centerOffset!==0,[V,te]=p.useState();return yi(()=>{v&&te(window.getComputedStyle(v).zIndex)},[v]),(0,X.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:V,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,X.jsx)(lu,{scope:n,placedSide:I,onArrowChange:S,arrowX:z,arrowY:ee,shouldHideArrow:B,children:(0,X.jsx)(ci.div,{"data-side":I,"data-align":L,...g,ref:b,style:{...g.style,animation:P?void 0:`none`}})})})});du.displayName=cu;var fu=`PopperArrow`,pu={top:`bottom`,right:`left`,bottom:`top`,left:`right`},mu=p.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=uu(fu,n),a=pu[i.placedSide];return(0,X.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,X.jsx)($l,{...r,ref:t,style:{...r.style,display:`block`}})})});mu.displayName=fu;function hu(e){return e!==null}var gu=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=_u(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function _u(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var vu=au,yu=su,bu=du,xu=mu,Su=`rovingFocusGroup.onEntryFocus`,Cu={bubbles:!1,cancelable:!0},wu=`RovingFocusGroup`,[Tu,Eu,Du]=_i(wu),[Ou,ku]=hi(wu,[Du]),[Au,ju]=Ou(wu),Mu=p.forwardRef((e,t)=>(0,X.jsx)(Tu.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(Tu.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(Nu,{...e,ref:t})})}));Mu.displayName=wu;var Nu=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=p.useRef(null),m=$r(t,f),h=Ji(a),[g,_]=xi({prop:o,defaultProp:s??null,onChange:c,caller:wu}),[v,y]=p.useState(!1),b=Yi(l),x=Eu(n),S=p.useRef(!1),[C,w]=p.useState(0);return p.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Su,b),()=>e.removeEventListener(Su,b)},[b]),(0,X.jsx)(Au,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:g,onItemFocus:p.useCallback(e=>_(e),[_]),onItemShiftTab:p.useCallback(()=>y(!0),[]),onFocusableItemAdd:p.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:p.useCallback(()=>w(e=>e-1),[]),children:(0,X.jsx)(ci.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:`none`,...e.style},onMouseDown:vi(e.onMouseDown,()=>{S.current=!0}),onFocus:vi(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(Su,Cu);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);zu([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:vi(e.onBlur,()=>y(!1))})})}),Pu=`RovingFocusGroupItem`,Fu=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=ji(),l=a||c,u=ju(Pu,n),d=u.currentTabStopId===l,f=Eu(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=u;return p.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),(0,X.jsx)(Tu.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,X.jsx)(ci.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:vi(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:vi(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:vi(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Ru(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Bu(n,r+1):n.slice(r+1)}setTimeout(()=>zu(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})});Fu.displayName=Pu;var Iu={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Lu(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Ru(e,t,n){let r=Lu(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Iu[r]}function zu(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Bu(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vu=Mu,Hu=Fu,Uu=[`Enter`,` `],Wu=[`ArrowDown`,`PageUp`,`Home`],Gu=[`ArrowUp`,`PageDown`,`End`],Ku=[...Wu,...Gu],qu={ltr:[...Uu,`ArrowRight`],rtl:[...Uu,`ArrowLeft`]},Ju={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Yu=`Menu`,[Xu,Zu,Qu]=_i(Yu),[$u,ed]=hi(Yu,[Qu,nu,ku]),td=nu(),nd=ku(),[rd,id]=$u(Yu),[ad,od]=$u(Yu),sd=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=td(t),[c,l]=p.useState(null),u=p.useRef(!1),d=Yi(a),f=Ji(i);return p.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,X.jsx)(vu,{...s,children:(0,X.jsx)(rd,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,X.jsx)(ad,{scope:t,onClose:p.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};sd.displayName=Yu;var cd=`MenuAnchor`,ld=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=td(n);return(0,X.jsx)(yu,{...i,...r,ref:t})});ld.displayName=cd;var ud=`MenuPortal`,[dd,fd]=$u(ud,{forceMount:void 0}),pd=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=id(ud,t);return(0,X.jsx)(dd,{scope:t,forceMount:n,children:(0,X.jsx)(Ti,{present:n||a.open,children:(0,X.jsx)(Da,{asChild:!0,container:i,children:r})})})};pd.displayName=ud;var md=`MenuContent`,[hd,gd]=$u(md),_d=p.forwardRef((e,t)=>{let n=fd(md,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=id(md,e.__scopeMenu),o=od(md,e.__scopeMenu);return(0,X.jsx)(Xu.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(Ti,{present:r||a.open,children:(0,X.jsx)(Xu.Slot,{scope:e.__scopeMenu,children:o.modal?(0,X.jsx)(vd,{...i,ref:t}):(0,X.jsx)(yd,{...i,ref:t})})})})}),vd=p.forwardRef((e,t)=>{let n=id(md,e.__scopeMenu),r=p.useRef(null),i=$r(t,r);return p.useEffect(()=>{let e=r.current;if(e)return Yo(e)},[]),(0,X.jsx)(xd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:vi(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),yd=p.forwardRef((e,t)=>{let n=id(md,e.__scopeMenu);return(0,X.jsx)(xd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),bd=ei(`MenuContent.ScrollLock`),xd=p.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:m,disableOutsideScroll:h,...g}=e,_=id(md,n),v=od(md,n),y=td(n),b=nd(n),x=Zu(n),[S,C]=p.useState(null),w=p.useRef(null),T=$r(t,w,_.onContentChange),E=p.useRef(0),D=p.useRef(``),O=p.useRef(0),k=p.useRef(null),A=p.useRef(`right`),j=p.useRef(0),M=h?Bo:p.Fragment,N=h?{as:bd,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=of(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};p.useEffect(()=>()=>window.clearTimeout(E.current),[]),ka();let F=p.useCallback(e=>A.current===k.current?.side&&cf(e,k.current?.area),[]);return(0,X.jsx)(hd,{scope:n,searchRef:D,onItemEnter:p.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:p.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:p.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:p.useCallback(e=>{k.current=e},[]),children:(0,X.jsx)(M,{...N,children:(0,X.jsx)(ma,{asChild:!0,trapped:i,onMountAutoFocus:vi(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,X.jsx)(ra,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:m,children:(0,X.jsx)(Vu,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:vi(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,X.jsx)(bu,{role:`menu`,"aria-orientation":`vertical`,"data-state":ef(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:vi(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!Ku.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Gu.includes(e.key)&&a.reverse(),rf(a)}),onBlur:vi(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:vi(e.onPointerMove,lf(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});_d.displayName=md;var Sd=`MenuGroup`,Cd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(ci.div,{role:`group`,...r,ref:t})});Cd.displayName=Sd;var wd=`MenuLabel`,Td=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(ci.div,{...r,ref:t})});Td.displayName=wd;var Ed=`MenuItem`,Dd=`menu.itemSelect`,Od=p.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=p.useRef(null),o=od(Ed,e.__scopeMenu),s=gd(Ed,e.__scopeMenu),c=$r(t,a),l=p.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Dd,{bubbles:!0,cancelable:!0});e.addEventListener(Dd,e=>r?.(e),{once:!0}),li(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,X.jsx)(kd,{...i,ref:c,disabled:n,onClick:vi(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:vi(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:vi(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Uu.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Od.displayName=Ed;var kd=p.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=gd(Ed,n),s=nd(n),c=p.useRef(null),l=$r(t,c),[u,d]=p.useState(!1),[f,m]=p.useState(``);return p.useEffect(()=>{let e=c.current;e&&m((e.textContent??``).trim())},[a.children]),(0,X.jsx)(Xu.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,X.jsx)(Hu,{asChild:!0,...s,focusable:!r,children:(0,X.jsx)(ci.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:vi(e.onPointerMove,lf(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:vi(e.onPointerLeave,lf(e=>o.onItemLeave(e))),onFocus:vi(e.onFocus,()=>d(!0)),onBlur:vi(e.onBlur,()=>d(!1))})})})}),Ad=`MenuCheckboxItem`,jd=p.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,X.jsx)(zd,{scope:e.__scopeMenu,checked:n,children:(0,X.jsx)(Od,{role:`menuitemcheckbox`,"aria-checked":tf(n)?`mixed`:n,...i,ref:t,"data-state":nf(n),onSelect:vi(i.onSelect,()=>r?.(tf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});jd.displayName=Ad;var Md=`MenuRadioGroup`,[Nd,Pd]=$u(Md,{value:void 0,onValueChange:()=>{}}),Fd=p.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Yi(r);return(0,X.jsx)(Nd,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,X.jsx)(Cd,{...i,ref:t})})});Fd.displayName=Md;var Id=`MenuRadioItem`,Ld=p.forwardRef((e,t)=>{let{value:n,...r}=e,i=Pd(Id,e.__scopeMenu),a=n===i.value;return(0,X.jsx)(zd,{scope:e.__scopeMenu,checked:a,children:(0,X.jsx)(Od,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":nf(a),onSelect:vi(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Ld.displayName=Id;var Rd=`MenuItemIndicator`,[zd,Bd]=$u(Rd,{checked:!1}),Vd=p.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Bd(Rd,n);return(0,X.jsx)(Ti,{present:r||tf(a.checked)||a.checked===!0,children:(0,X.jsx)(ci.span,{...i,ref:t,"data-state":nf(a.checked)})})});Vd.displayName=Rd;var Hd=`MenuSeparator`,Ud=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(ci.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Ud.displayName=Hd;var Wd=`MenuArrow`,Gd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=td(n);return(0,X.jsx)(xu,{...i,...r,ref:t})});Gd.displayName=Wd;var Kd=`MenuSub`,[qd,Jd]=$u(Kd),Yd=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=id(Kd,t),o=td(t),[s,c]=p.useState(null),[l,u]=p.useState(null),d=Yi(i);return p.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,X.jsx)(vu,{...o,children:(0,X.jsx)(rd,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,X.jsx)(qd,{scope:t,contentId:ji(),triggerId:ji(),trigger:s,onTriggerChange:c,children:n})})})};Yd.displayName=Kd;var Xd=`MenuSubTrigger`,Zd=p.forwardRef((e,t)=>{let n=id(Xd,e.__scopeMenu),r=od(Xd,e.__scopeMenu),i=Jd(Xd,e.__scopeMenu),a=gd(Xd,e.__scopeMenu),o=p.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=p.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return p.useEffect(()=>u,[u]),p.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,X.jsx)(ld,{asChild:!0,...l,children:(0,X.jsx)(kd,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":ef(n.open),...e,ref:Qr(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:vi(e.onPointerMove,lf(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:vi(e.onPointerLeave,lf(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:vi(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||qu[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Zd.displayName=Xd;var Qd=`MenuSubContent`,$d=p.forwardRef((e,t)=>{let n=fd(md,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=id(md,e.__scopeMenu),o=od(md,e.__scopeMenu),s=Jd(Qd,e.__scopeMenu),c=p.useRef(null),l=$r(t,c);return(0,X.jsx)(Xu.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(Ti,{present:r||a.open,children:(0,X.jsx)(Xu.Slot,{scope:e.__scopeMenu,children:(0,X.jsx)(xd,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:vi(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:vi(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:vi(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Ju[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});$d.displayName=Qd;function ef(e){return e?`open`:`closed`}function tf(e){return e===`indeterminate`}function nf(e){return tf(e)?`indeterminate`:e?`checked`:`unchecked`}function rf(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function af(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function of(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=af(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function sf(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function cf(e,t){return t?sf({x:e.clientX,y:e.clientY},t):!1}function lf(e){return t=>t.pointerType===`mouse`?e(t):void 0}var uf=sd,df=ld,ff=pd,pf=_d,mf=Cd,hf=Td,gf=Od,_f=jd,vf=Fd,yf=Ld,bf=Vd,xf=Ud,Sf=Gd,Cf=Zd,wf=$d,Tf=`DropdownMenu`,[Ef,Df]=hi(Tf,[ed]),Of=ed(),[kf,Af]=Ef(Tf),jf=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Of(t),l=p.useRef(null),[u,d]=xi({prop:i,defaultProp:a??!1,onChange:o,caller:Tf});return(0,X.jsx)(kf,{scope:t,triggerId:ji(),triggerRef:l,contentId:ji(),open:u,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,X.jsx)(uf,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};jf.displayName=Tf;var Mf=`DropdownMenuTrigger`,Nf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Af(Mf,n),o=Of(n);return(0,X.jsx)(df,{asChild:!0,...o,children:(0,X.jsx)(ci.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:Qr(t,a.triggerRef),onPointerDown:vi(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:vi(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Nf.displayName=Mf;var Pf=`DropdownMenuPortal`,Ff=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Of(t);return(0,X.jsx)(ff,{...r,...n})};Ff.displayName=Pf;var If=`DropdownMenuContent`,Lf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Af(If,n),a=Of(n),o=p.useRef(!1);return(0,X.jsx)(pf,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:vi(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:vi(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Lf.displayName=If;var Rf=`DropdownMenuGroup`,zf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(mf,{...i,...r,ref:t})});zf.displayName=Rf;var Bf=`DropdownMenuLabel`,Vf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(hf,{...i,...r,ref:t})});Vf.displayName=Bf;var Hf=`DropdownMenuItem`,Uf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(gf,{...i,...r,ref:t})});Uf.displayName=Hf;var Wf=`DropdownMenuCheckboxItem`,Gf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(_f,{...i,...r,ref:t})});Gf.displayName=Wf;var Kf=`DropdownMenuRadioGroup`,qf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(vf,{...i,...r,ref:t})});qf.displayName=Kf;var Jf=`DropdownMenuRadioItem`,Yf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(yf,{...i,...r,ref:t})});Yf.displayName=Jf;var Xf=`DropdownMenuItemIndicator`,Zf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(bf,{...i,...r,ref:t})});Zf.displayName=Xf;var Qf=`DropdownMenuSeparator`,$f=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(xf,{...i,...r,ref:t})});$f.displayName=Qf;var ep=`DropdownMenuArrow`,tp=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(Sf,{...i,...r,ref:t})});tp.displayName=ep;var np=`DropdownMenuSubTrigger`,rp=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(Cf,{...i,...r,ref:t})});rp.displayName=np;var ip=`DropdownMenuSubContent`,ap=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(wf,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});ap.displayName=ip;var op=jf,sp=Nf,cp=Ff,lp=Lf,up=Uf,dp=`Label`,fp=p.forwardRef((e,t)=>(0,X.jsx)(ci.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));fp.displayName=dp;var pp=fp,mp=`Popover`,[hp,gp]=hi(mp,[nu]),_p=nu(),[vp,yp]=hp(mp),bp=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=_p(t),c=p.useRef(null),[l,u]=p.useState(!1),[d,f]=xi({prop:r,defaultProp:i??!1,onChange:a,caller:mp});return(0,X.jsx)(vu,{...s,children:(0,X.jsx)(vp,{scope:t,contentId:ji(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:p.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:p.useCallback(()=>u(!0),[]),onCustomAnchorRemove:p.useCallback(()=>u(!1),[]),modal:o,children:n})})};bp.displayName=mp;var xp=`PopoverAnchor`,Sp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=yp(xp,n),a=_p(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return p.useEffect(()=>(o(),()=>s()),[o,s]),(0,X.jsx)(yu,{...a,...r,ref:t})});Sp.displayName=xp;var Cp=`PopoverTrigger`,wp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=yp(Cp,n),a=_p(n),o=$r(t,i.triggerRef),s=(0,X.jsx)(ci.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":zp(i.open),...r,ref:o,onClick:vi(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,X.jsx)(yu,{asChild:!0,...a,children:s})});wp.displayName=Cp;var Tp=`PopoverPortal`,[Ep,Dp]=hp(Tp,{forceMount:void 0}),Op=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=yp(Tp,t);return(0,X.jsx)(Ep,{scope:t,forceMount:n,children:(0,X.jsx)(Ti,{present:n||a.open,children:(0,X.jsx)(Da,{asChild:!0,container:i,children:r})})})};Op.displayName=Tp;var kp=`PopoverContent`,Ap=p.forwardRef((e,t)=>{let n=Dp(kp,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=yp(kp,e.__scopePopover);return(0,X.jsx)(Ti,{present:r||a.open,children:a.modal?(0,X.jsx)(Mp,{...i,ref:t}):(0,X.jsx)(Np,{...i,ref:t})})});Ap.displayName=kp;var jp=ei(`PopoverContent.RemoveScroll`),Mp=p.forwardRef((e,t)=>{let n=yp(kp,e.__scopePopover),r=p.useRef(null),i=$r(t,r),a=p.useRef(!1);return p.useEffect(()=>{let e=r.current;if(e)return Yo(e)},[]),(0,X.jsx)(Bo,{as:jp,allowPinchZoom:!0,children:(0,X.jsx)(Pp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vi(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:vi(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:vi(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Np=p.forwardRef((e,t)=>{let n=yp(kp,e.__scopePopover),r=p.useRef(!1),i=p.useRef(!1);return(0,X.jsx)(Pp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Pp=p.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=yp(kp,n),p=_p(n);return ka(),(0,X.jsx)(ma,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,X.jsx)(ra,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,X.jsx)(bu,{"data-state":zp(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Fp=`PopoverClose`,Ip=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=yp(Fp,n);return(0,X.jsx)(ci.button,{type:`button`,...r,ref:t,onClick:vi(e.onClick,()=>i.onOpenChange(!1))})});Ip.displayName=Fp;var Lp=`PopoverArrow`,Rp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=_p(n);return(0,X.jsx)(xu,{...i,...r,ref:t})});Rp.displayName=Lp;function zp(e){return e?`open`:`closed`}var Bp=bp,Vp=wp,Hp=Op,eee=Ap,Up=`Switch`,[tee,nee]=hi(Up),[ree,iee]=tee(Up),Wp=p.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,m]=p.useState(null),h=$r(t,e=>m(e)),g=p.useRef(!1),_=f?u||!!f.closest(`form`):!0,[v,y]=xi({prop:i,defaultProp:a??!1,onChange:l,caller:Up});return(0,X.jsxs)(ree,{scope:n,checked:v,disabled:s,children:[(0,X.jsx)(ci.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":Yp(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:h,onClick:vi(e.onClick,e=>{y(e=>!e),_&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),_&&(0,X.jsx)(Jp,{control:f,bubbles:!g.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});Wp.displayName=Up;var Gp=`SwitchThumb`,Kp=p.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=iee(Gp,n);return(0,X.jsx)(ci.span,{"data-state":Yp(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Kp.displayName=Gp;var qp=`SwitchBubbleInput`,Jp=p.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=p.useRef(null),s=$r(o,a),c=Ls(n),l=Rs(t);return p.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,X.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Jp.displayName=qp;function Yp(e){return e?`checked`:`unchecked`}var Xp=Wp,aee=Kp,Zp=`Tabs`,[oee,see]=hi(Zp,[ku]),Qp=ku(),[cee,$p]=oee(Zp),em=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Ji(s),[d,f]=xi({prop:r,onChange:i,defaultProp:a??``,caller:Zp});return(0,X.jsx)(cee,{scope:n,baseId:ji(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,X.jsx)(ci.div,{dir:u,"data-orientation":o,...l,ref:t})})});em.displayName=Zp;var tm=`TabsList`,nm=p.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=$p(tm,n),o=Qp(n);return(0,X.jsx)(Vu,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,X.jsx)(ci.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});nm.displayName=tm;var rm=`TabsTrigger`,im=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=$p(rm,n),s=Qp(n),c=sm(o.baseId,r),l=cm(o.baseId,r),u=r===o.value;return(0,X.jsx)(Hu,{asChild:!0,...s,focusable:!i,active:u,children:(0,X.jsx)(ci.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:vi(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:vi(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:vi(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});im.displayName=rm;var am=`TabsContent`,om=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=$p(am,n),c=sm(s.baseId,r),l=cm(s.baseId,r),u=r===s.value,d=p.useRef(u);return p.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,X.jsx)(Ti,{present:i||u,children:({present:n})=>(0,X.jsx)(ci.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});om.displayName=am;function sm(e,t){return`${e}-trigger-${t}`}function cm(e,t){return`${e}-content-${t}`}var lm=em,um=nm,dm=im,fm=om,pm=`Toggle`,mm=p.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=xi({prop:n,onChange:i,defaultProp:r??!1,caller:pm});return(0,X.jsx)(ci.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:vi(e.onClick,()=>{e.disabled||s(!o)})})});mm.displayName=pm;var hm=`ToggleGroup`,[gm,lee]=hi(hm,[ku]),_m=ku(),vm=p.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,X.jsx)(xm,{...r,ref:t});if(n===`multiple`)return(0,X.jsx)(Sm,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${hm}\``)});vm.displayName=hm;var[ym,bm]=gm(hm),xm=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=xi({prop:n,defaultProp:r??``,onChange:i,caller:hm});return(0,X.jsx)(ym,{scope:e.__scopeToggleGroup,type:`single`,value:p.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:p.useCallback(()=>s(``),[s]),children:(0,X.jsx)(Tm,{...a,ref:t})})}),Sm=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=xi({prop:n,defaultProp:r??[],onChange:i,caller:hm}),c=p.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=p.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,X.jsx)(ym,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,X.jsx)(Tm,{...a,ref:t})})});vm.displayName=hm;var[Cm,wm]=gm(hm),Tm=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=_m(n),u=Ji(o),d={role:`group`,dir:u,...c};return(0,X.jsx)(Cm,{scope:n,rovingFocus:i,disabled:r,children:i?(0,X.jsx)(Vu,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,X.jsx)(ci.div,{...d,ref:t})}):(0,X.jsx)(ci.div,{...d,ref:t})})}),Em=`ToggleGroupItem`,Dm=p.forwardRef((e,t)=>{let n=bm(Em,e.__scopeToggleGroup),r=wm(Em,e.__scopeToggleGroup),i=_m(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=p.useRef(null);return r.rovingFocus?(0,X.jsx)(Hu,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,X.jsx)(Om,{...s,ref:t})}):(0,X.jsx)(Om,{...s,ref:t})});Dm.displayName=Em;var Om=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=bm(Em,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,X.jsx)(mm,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),km=vm,Am=Dm,[jm,uee]=hi(`Tooltip`,[nu]),Mm=nu(),Nm=`TooltipProvider`,Pm=700,Fm=`tooltip.open`,[dee,Im]=jm(Nm),Lm=e=>{let{__scopeTooltip:t,delayDuration:n=Pm,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=p.useRef(!0),s=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,X.jsx)(dee,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:p.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Lm.displayName=Nm;var Rm=`Tooltip`,[fee,zm]=jm(Rm),Bm=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Im(Rm,e.__scopeTooltip),l=Mm(t),[u,d]=p.useState(null),f=ji(),m=p.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=p.useRef(!1),[v,y]=xi({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Fm))):c.onClose(),a?.(e)},caller:Rm}),b=p.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),S=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),C=p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return p.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,X.jsx)(vu,{...l,children:(0,X.jsx)(fee,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:p.useCallback(()=>{h?S():(window.clearTimeout(m.current),m.current=0)},[S,h]),onOpen:x,onClose:S,disableHoverableContent:h,children:n})})};Bm.displayName=Rm;var Vm=`TooltipTrigger`,Hm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=zm(Vm,n),a=Im(Vm,n),o=Mm(n),s=$r(t,p.useRef(null),i.onTriggerChange),c=p.useRef(!1),l=p.useRef(!1),u=p.useCallback(()=>c.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,X.jsx)(yu,{asChild:!0,...o,children:(0,X.jsx)(ci.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:vi(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:vi(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:vi(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:vi(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:vi(e.onBlur,i.onClose),onClick:vi(e.onClick,i.onClose)})})});Hm.displayName=Vm;var Um=`TooltipPortal`,[pee,mee]=jm(Um,{forceMount:void 0}),Wm=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=zm(Um,t);return(0,X.jsx)(pee,{scope:t,forceMount:n,children:(0,X.jsx)(Ti,{present:n||a.open,children:(0,X.jsx)(Da,{asChild:!0,container:i,children:r})})})};Wm.displayName=Um;var Gm=`TooltipContent`,Km=p.forwardRef((e,t)=>{let n=mee(Gm,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=zm(Gm,e.__scopeTooltip);return(0,X.jsx)(Ti,{present:r||o.open,children:o.disableHoverableContent?(0,X.jsx)(qm,{side:i,...a,ref:t}):(0,X.jsx)(hee,{side:i,...a,ref:t})})}),hee=p.forwardRef((e,t)=>{let n=zm(Gm,e.__scopeTooltip),r=Im(Gm,e.__scopeTooltip),i=p.useRef(null),a=$r(t,i),[o,s]=p.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=p.useCallback(()=>{s(null),d(!1)},[d]),m=p.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=bee(r,yee(r,n.getBoundingClientRect())),a=xee(t.getBoundingClientRect());s(Xm([...i,...a])),d(!0)},[d]);return p.useEffect(()=>()=>f(),[f]),p.useEffect(()=>{if(c&&u){let e=e=>m(e,u),t=e=>m(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,m,f]),p.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!See(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,X.jsx)(qm,{...e,ref:a})}),[gee,_ee]=jm(Rm,{isInside:!1}),vee=ii(`TooltipContent`),qm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=zm(Gm,n),l=Mm(n),{onClose:u}=c;return p.useEffect(()=>(document.addEventListener(Fm,u),()=>document.removeEventListener(Fm,u)),[u]),p.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,X.jsx)(ra,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,X.jsxs)(bu,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.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:[(0,X.jsx)(vee,{children:r}),(0,X.jsx)(gee,{scope:n,isInside:!0,children:(0,X.jsx)(pi,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Km.displayName=Gm;var Jm=`TooltipArrow`,Ym=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Mm(n);return _ee(Jm,n).isInside?null:(0,X.jsx)(xu,{...i,...r,ref:t})});Ym.displayName=Jm;function yee(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function bee(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function xee(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function See(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Xm(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Zm(t)}function Zm(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Qm=Lm,$m=Bm,eh=Hm,th=Wm,nh=Km,rh=Ym,ih=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ah=(e,t)=>({classGroupId:e,validator:t}),oh=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),sh=`-`,ch=[],lh=`arbitrary..`,uh=e=>{let t=ph(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return fh(e);let n=e.split(sh);return dh(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ih(i,t):t:i||ch}return n[e]||ch}}},dh=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=dh(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(sh):e.slice(t).join(sh),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},fh=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?lh+r:void 0})(),ph=e=>{let{theme:t,classGroups:n}=e;return mh(n,t)},mh=(e,t)=>{let n=oh();for(let r in e){let i=e[r];hh(i,n,r,t)}return n},hh=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];gh(i,t,n,r)}},gh=(e,t,n,r)=>{if(typeof e==`string`){_h(e,t,n);return}if(typeof e==`function`){vh(e,t,n,r);return}yh(e,t,n,r)},_h=(e,t,n)=>{let r=e===``?t:bh(t,e);r.classGroupId=n},vh=(e,t,n,r)=>{if(xh(e)){hh(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ah(n,e))},yh=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];hh(o,bh(t,a),n,r)}},bh=(e,t)=>{let n=e,r=t.split(sh),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=oh(),n.nextPart.set(t,i)),n=i}return n},xh=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Sh=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ch=`!`,wh=`:`,Th=[],Eh=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Dh=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===wh){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ch)?(c=s.slice(0,-1),l=!0):s.startsWith(Ch)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Eh(t,l,c,u)};if(t){let e=t+wh,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Eh(Th,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Oh=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},kh=e=>({cache:Sh(e.cacheSize),parseClassName:Dh(e),sortModifiers:Oh(e),...uh(e)}),Ah=/\s+/,jh=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Ah),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Ch:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Mh=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Nh(n))&&(i&&(i+=` `),i+=r);return i},Nh=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Nh(e[r]))&&(n&&(n+=` `),n+=t);return n},Ph=(e,...t)=>{let n,r,i,a,o=o=>(n=kh(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=jh(e,n);return i(e,a),a};return a=o,(...e)=>a(Mh(...e))},Fh=[],Ih=e=>{let t=t=>t[e]||Fh;return t.isThemeGetter=!0,t},Lh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Rh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Bh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Uh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gh=e=>zh.test(e),Kh=e=>!!e&&!Number.isNaN(Number(e)),qh=e=>!!e&&Number.isInteger(Number(e)),Jh=e=>e.endsWith(`%`)&&Kh(e.slice(0,-1)),Yh=e=>Bh.test(e),Xh=()=>!0,Zh=e=>Vh.test(e)&&!Hh.test(e),Qh=()=>!1,$h=e=>Uh.test(e),eg=e=>Wh.test(e),tg=e=>!rg(e)&&!dg(e),ng=e=>yg(e,Cg,Qh),rg=e=>Lh.test(e),ig=e=>yg(e,wg,Zh),ag=e=>yg(e,Cee,Kh),og=e=>yg(e,Eg,Xh),sg=e=>yg(e,Tg,Qh),cg=e=>yg(e,xg,Qh),lg=e=>yg(e,Sg,eg),ug=e=>yg(e,Dg,$h),dg=e=>Rh.test(e),fg=e=>bg(e,wg),pg=e=>bg(e,Tg),mg=e=>bg(e,xg),hg=e=>bg(e,Cg),gg=e=>bg(e,Sg),_g=e=>bg(e,Dg,!0),vg=e=>bg(e,Eg,!0),yg=(e,t,n)=>{let r=Lh.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},bg=(e,t,n=!1)=>{let r=Rh.exec(e);return r?r[1]?t(r[1]):n:!1},xg=e=>e===`position`||e===`percentage`,Sg=e=>e===`image`||e===`url`,Cg=e=>e===`length`||e===`size`||e===`bg-size`,wg=e=>e===`length`,Cee=e=>e===`number`,Tg=e=>e===`family-name`,Eg=e=>e===`number`||e===`weight`,Dg=e=>e===`shadow`,wee=Ph(()=>{let e=Ih(`color`),t=Ih(`font`),n=Ih(`text`),r=Ih(`font-weight`),i=Ih(`tracking`),a=Ih(`leading`),o=Ih(`breakpoint`),s=Ih(`container`),c=Ih(`spacing`),l=Ih(`radius`),u=Ih(`shadow`),d=Ih(`inset-shadow`),f=Ih(`text-shadow`),p=Ih(`drop-shadow`),m=Ih(`blur`),h=Ih(`perspective`),g=Ih(`aspect`),_=Ih(`ease`),v=Ih(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),dg,rg],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[dg,rg,c],T=()=>[Gh,`full`,`auto`,...w()],E=()=>[qh,`none`,`subgrid`,dg,rg],D=()=>[`auto`,{span:[`full`,qh,dg,rg]},qh,dg,rg],O=()=>[qh,`auto`,dg,rg],k=()=>[`auto`,`min`,`max`,`fr`,dg,rg],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Gh,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Gh,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Gh,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,dg,rg],L=()=>[...b(),mg,cg,{position:[dg,rg]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],z=()=>[`auto`,`cover`,`contain`,hg,ng,{size:[dg,rg]}],ee=()=>[Jh,fg,ig],B=()=>[``,`none`,`full`,l,dg,rg],V=()=>[``,Kh,fg,ig],te=()=>[`solid`,`dashed`,`dotted`,`double`],H=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],U=()=>[Kh,Jh,mg,cg],ne=()=>[``,`none`,m,dg,rg],re=()=>[`none`,Kh,dg,rg],ie=()=>[`none`,Kh,dg,rg],ae=()=>[Kh,dg,rg],oe=()=>[Gh,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Yh],breakpoint:[Yh],color:[Xh],container:[Yh],"drop-shadow":[Yh],ease:[`in`,`out`,`in-out`],font:[tg],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Yh],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Yh],shadow:[Yh],spacing:[`px`,Kh],text:[Yh],"text-shadow":[Yh],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Gh,rg,dg,g]}],container:[`container`],columns:[{columns:[Kh,rg,dg,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[qh,`auto`,dg,rg]}],basis:[{basis:[Gh,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Kh,Gh,`auto`,`initial`,`none`,rg]}],grow:[{grow:[``,Kh,dg,rg]}],shrink:[{shrink:[``,Kh,dg,rg]}],order:[{order:[qh,`first`,`last`,`none`,dg,rg]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,fg,ig]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,vg,og]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Jh,rg]}],"font-family":[{font:[pg,sg,t]}],"font-features":[{"font-features":[rg]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,dg,rg]}],"line-clamp":[{"line-clamp":[Kh,`none`,dg,ag]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,dg,rg]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,dg,rg]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...te(),`wavy`]}],"text-decoration-thickness":[{decoration:[Kh,`from-font`,`auto`,dg,ig]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Kh,`auto`,dg,rg]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,dg,rg]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,dg,rg]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:z()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},qh,dg,rg],radial:[``,dg,rg],conic:[qh,dg,rg]},gg,lg]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":V()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...te(),`hidden`,`none`]}],"divide-style":[{divide:[...te(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...te(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Kh,dg,rg]}],"outline-w":[{outline:[``,Kh,fg,ig]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,_g,ug]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,_g,ug]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Kh,ig]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,_g,ug]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Kh,dg,rg]}],"mix-blend":[{"mix-blend":[...H(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":H()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Kh]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[dg,rg]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Kh]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,dg,rg]}],filter:[{filter:[``,`none`,dg,rg]}],blur:[{blur:ne()}],brightness:[{brightness:[Kh,dg,rg]}],contrast:[{contrast:[Kh,dg,rg]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,_g,ug]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Kh,dg,rg]}],"hue-rotate":[{"hue-rotate":[Kh,dg,rg]}],invert:[{invert:[``,Kh,dg,rg]}],saturate:[{saturate:[Kh,dg,rg]}],sepia:[{sepia:[``,Kh,dg,rg]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,dg,rg]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Kh,dg,rg]}],"backdrop-contrast":[{"backdrop-contrast":[Kh,dg,rg]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Kh,dg,rg]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Kh,dg,rg]}],"backdrop-invert":[{"backdrop-invert":[``,Kh,dg,rg]}],"backdrop-opacity":[{"backdrop-opacity":[Kh,dg,rg]}],"backdrop-saturate":[{"backdrop-saturate":[Kh,dg,rg]}],"backdrop-sepia":[{"backdrop-sepia":[``,Kh,dg,rg]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,dg,rg]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Kh,`initial`,dg,rg]}],ease:[{ease:[`linear`,`initial`,_,dg,rg]}],delay:[{delay:[Kh,dg,rg]}],animate:[{animate:[`none`,v,dg,rg]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,dg,rg]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[dg,rg,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,dg,rg]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,dg,rg]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Kh,fg,ig,ag]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}}),Z=(...e)=>wee(qr(e)),Tee=Xr(`inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-xl border text-sm font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`border-primary/60 bg-primary text-primary-foreground shadow-[0_8px_24px_rgba(108,63,217,0.28)] hover:bg-primary/92 hover:border-primary/70`,outline:`border-border bg-card/80 text-foreground hover:bg-accent hover:text-accent-foreground`,secondary:`border-border bg-secondary text-secondary-foreground hover:bg-secondary/85`,ghost:`border-transparent bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,destructive:`border-red-500/30 bg-destructive/15 text-red-200 hover:bg-destructive/25`,success:`border-emerald-300/80 bg-emerald-400 text-[#07130d] shadow-[0_10px_30px_rgba(16,185,129,0.28)] hover:border-emerald-200 hover:bg-emerald-300`,warning:`border-amber-500/30 bg-amber-500/12 text-amber-200 hover:bg-amber-500/20`,link:`border-transparent px-0 text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4`,xs:`h-7 px-2.5 text-xs`,sm:`h-8 px-3 text-sm`,lg:`h-11 px-5 text-sm`,icon:`size-10`,"icon-xs":`size-7 [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8`,"icon-lg":`size-11`}},defaultVariants:{variant:`default`,size:`default`}}),Q=({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i})=>(0,X.jsx)(r?ti:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Z(Tee({variant:t,size:n,className:e})),...i}),Og=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Eee=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Dee=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),kg=e=>{let t=Dee(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ag={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`},Oee=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},kee=(0,p.createContext)({}),Aee=()=>(0,p.useContext)(kee),jee=(0,p.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:m=``}=Aee()??{},h=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,p.createElement)(`svg`,{ref:c,...Ag,width:t??l??Ag.width,height:t??l??Ag.height,stroke:e??f,strokeWidth:h,className:Og(`lucide`,m,i),...!a&&!Oee(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,p.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),jg=(e,t)=>{let n=(0,p.forwardRef)(({className:n,...r},i)=>(0,p.createElement)(jee,{ref:i,iconNode:t,className:Og(`lucide-${Eee(kg(e))}`,`lucide-${e}`,n),...r}));return n.displayName=kg(e),n},Mg=jg(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),Mee=jg(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Nee=jg(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Pee=jg(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Fee=jg(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Iee=jg(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Lee=jg(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Ree=jg(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Ng=jg(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Pg=jg(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),zee=jg(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Bee=jg(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),Vee=jg(`copy`,[[`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`}]]),Hee=jg(`crosshair`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]),Uee=jg(`ellipsis-vertical`,[[`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`}]]),Wee=jg(`external-link`,[[`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`}]]),Gee=jg(`file-code`,[[`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 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Kee=jg(`file-text`,[[`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`}]]),qee=jg(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),Jee=jg(`flask-conical`,[[`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`}]]),Yee=jg(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Xee=jg(`folder`,[[`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`}]]),Zee=jg(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Fg=jg(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Qee=jg(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),$ee=jg(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ete=jg(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),tte=jg(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),nte=jg(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),rte=jg(`list-checks`,[[`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`}]]),ite=jg(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ate=jg(`log-out`,[[`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`}]]),ote=jg(`maximize-2`,[[`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`}]]),ste=jg(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),cte=jg(`minimize-2`,[[`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`}]]),lte=jg(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ute=jg(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),dte=jg(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),fte=jg(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),pte=jg(`pencil`,[[`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`}]]),mte=jg(`play`,[[`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`}]]),hte=jg(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),gte=jg(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),_te=jg(`refresh-cw`,[[`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`}]]),vte=jg(`rotate-ccw`,[[`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`}]]),yte=jg(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Ig=jg(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),bte=jg(`settings`,[[`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`}]]),xte=jg(`square-kanban`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 7v7`,key:`1x2jlm`}],[`path`,{d:`M12 7v4`,key:`xawao1`}],[`path`,{d:`M16 7v9`,key:`1hp2iy`}]]),Ste=jg(`square-mouse-pointer`,[[`path`,{d:`M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z`,key:`xwnzip`}],[`path`,{d:`M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6`,key:`14rsvq`}]]),Cte=jg(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),wte=jg(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Lg=jg(`trash-2`,[[`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`}]]),Rg=jg(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),zg=jg(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Bg=1,Tte=.9,Ete=.8,Dte=.17,Vg=.1,Hg=.999,Ote=.9999,kte=.99,Ate=/[\\\/_+.#"@\[\(\{&]/,jte=/[\\\/_+.#"@\[\(\{&]/g,Mte=/[\s-]/,Ug=/[\s-]/g;function Wg(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Bg:kte;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Wg(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Bg:Ate.test(e.charAt(l-1))?(d*=Ete,p=e.slice(i,l-1).match(jte),p&&i>0&&(d*=Hg**+p.length)):Mte.test(e.charAt(l-1))?(d*=Tte,m=e.slice(i,l-1).match(Ug),m&&i>0&&(d*=Hg**+m.length)):(d*=Dte,i>0&&(d*=Hg**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Ote)),(d<Vg&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Wg(e,t,n,r,l+1,a+2,o),f*Vg>d&&(d=f*Vg)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Gg(e){return e.toLowerCase().replace(Ug,` `)}function Nte(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Wg(e,t,Gg(e),Gg(t),0,0,{})}var Kg=`[cmdk-group=""]`,qg=`[cmdk-group-items=""]`,Jg=`[cmdk-group-heading=""]`,Yg=`[cmdk-item=""]`,Xg=`${Yg}:not([aria-disabled="true"])`,Zg=`cmdk-item-select`,Qg=`data-value`,$g=(e,t,n)=>Nte(e,t,n),e_=p.createContext(void 0),t_=()=>p.useContext(e_),n_=p.createContext(void 0),r_=()=>p.useContext(n_),i_=p.createContext(void 0),a_=p.forwardRef((e,t)=>{let n=v_(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=v_(()=>new Set),i=v_(()=>new Map),a=v_(()=>new Map),o=v_(()=>new Set),s=g_(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,y=ji(),b=ji(),x=ji(),S=p.useRef(null),C=Fte();__(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),__(()=>{C(6,A)},[]);let w=p.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=p.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??$g;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(qg);t?t.appendChild(e.parentElement===t?e:e.closest(`${qg} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${qg} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${Kg}[${Qg}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Qg);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Kg)?.querySelector(Jg))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${Yg}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(Xg)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(Qg))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(Qg))}function F(e){let t=j()?.closest(Kg),n;for(;t&&!n;)t=e>0?h_(t,Kg):Pte(t,Kg),n=t?.querySelector(Xg);n?w.setState(`value`,n.getAttribute(Qg)):P(e)}let I=()=>N(M().length-1),L=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},R=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return p.createElement(ci.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:_&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:_&&e.ctrlKey&&R(e);break;case`ArrowUp`:R(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(Zg);t.dispatchEvent(e)}}}}},p.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Lte},c),x_(e,e=>p.createElement(n_.Provider,{value:w},p.createElement(e_.Provider,{value:T},e))))}),o_=p.forwardRef((e,t)=>{let n=ji(),r=p.useRef(null),i=p.useContext(i_),a=t_(),o=g_(e),s=o.current?.forceMount??i?.forceMount;__(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=b_(n,r,[e.value,e.children,r],e.keywords),l=r_(),u=y_(e=>e.value&&e.value===c.current),d=y_(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);p.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Zg,f),()=>t.removeEventListener(Zg,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;m(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function m(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:h,value:g,onSelect:_,forceMount:v,keywords:y,...b}=e;return p.createElement(ci.div,{ref:Qr(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:f},e.children)}),s_=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=ji(),s=p.useRef(null),c=p.useRef(null),l=ji(),u=t_(),d=y_(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);__(()=>u.group(o),[]),b_(o,s,[e.value,e.heading,c]);let f=p.useMemo(()=>({id:o,forceMount:i}),[i]);return p.createElement(ci.div,{ref:Qr(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&p.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),x_(e,e=>p.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},p.createElement(i_.Provider,{value:f},e))))}),c_=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=p.useRef(null),a=y_(e=>!e.search);return!n&&!a?null:p.createElement(ci.div,{ref:Qr(i,t),...r,"cmdk-separator":``,role:`separator`})}),l_=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=r_(),o=y_(e=>e.search),s=y_(e=>e.selectedItemId),c=t_();return p.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),p.createElement(ci.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),u_=p.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=p.useRef(null),o=p.useRef(null),s=y_(e=>e.selectedItemId),c=t_();return p.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),p.createElement(ci.div,{ref:Qr(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},x_(e,e=>p.createElement(`div`,{ref:Qr(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),d_=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return p.createElement(As,{open:n,onOpenChange:r},p.createElement(js,{container:o},p.createElement(Ms,{"cmdk-overlay":``,className:i}),p.createElement(Ns,{"aria-label":e.label,"cmdk-dialog":``,className:a},p.createElement(a_,{ref:t,...s}))))}),f_=p.forwardRef((e,t)=>y_(e=>e.filtered.count===0)?p.createElement(ci.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),p_=p.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return p.createElement(ci.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},x_(e,e=>p.createElement(`div`,{"aria-hidden":!0},e)))}),m_=Object.assign(a_,{List:u_,Item:o_,Input:l_,Group:s_,Separator:c_,Dialog:d_,Empty:f_,Loading:p_});function h_(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Pte(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function g_(e){let t=p.useRef(e);return __(()=>{t.current=e}),t}var __=typeof window>`u`?p.useEffect:p.useLayoutEffect;function v_(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function y_(e){let t=r_(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function b_(e,t,n,r=[]){let i=p.useRef(),a=t_();return __(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Qg,s),i.current=s}),i}var Fte=()=>{let[e,t]=p.useState(),n=v_(()=>new Map);return __(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ite(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function x_({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Ite(t),{ref:t.ref},n(t.props.children)):n(t)}var Lte={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},S_=e=>(0,X.jsx)(As,{"data-slot":`dialog`,...e}),Rte=e=>(0,X.jsx)(js,{"data-slot":`dialog-portal`,...e}),C_=e=>(0,X.jsx)(Is,{"data-slot":`dialog-close`,...e}),zte=({className:e,...t})=>(0,X.jsx)(Ms,{"data-slot":`dialog-overlay`,className:Z(`fixed inset-0 isolate z-50 bg-black/70 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t}),w_=({className:e,children:t,showCloseButton:n=!0,overlayClassName:r,...i})=>(0,X.jsxs)(Rte,{children:[(0,X.jsx)(zte,{className:r}),(0,X.jsxs)(Ns,{"data-slot":`dialog-content`,className:Z(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-2xl border border-border bg-card p-6 text-sm text-card-foreground shadow-2xl shadow-black/30 duration-100 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...i,children:[t,n&&(0,X.jsx)(Is,{"data-slot":`dialog-close`,asChild:!0,children:(0,X.jsxs)(Q,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`,children:[(0,X.jsx)(zg,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]}),T_=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`dialog-header`,className:Z(`flex flex-col gap-1.5`,e),...t}),E_=({className:e,showCloseButton:t=!1,children:n,...r})=>(0,X.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Z(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,X.jsx)(Is,{asChild:!0,children:(0,X.jsx)(Q,{variant:`outline`,children:`Close`})})]}),D_=({className:e,...t})=>(0,X.jsx)(Ps,{"data-slot":`dialog-title`,className:Z(`font-heading text-base leading-none font-medium`,e),...t}),O_=({className:e,...t})=>(0,X.jsx)(Fs,{"data-slot":`dialog-description`,className:Z(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t}),k_=(0,p.forwardRef)(({className:e,type:t,...n},r)=>(0,X.jsx)(`input`,{ref:r,type:t,"data-slot":`input`,className:Z(`h-10 w-full min-w-0 rounded-xl border border-input bg-input/40 px-3 py-2 text-sm text-foreground transition-[border-color,box-shadow,background-color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20`,e),...n})),A_=(0,p.forwardRef)(({className:e,...t},n)=>(0,X.jsx)(`textarea`,{ref:n,"data-slot":`textarea`,className:Z(`flex min-h-24 w-full resize-none rounded-xl border border-input bg-input/40 px-3 py-2.5 text-sm text-foreground transition-[border-color,box-shadow,background-color] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20`,e),...t}));A_.displayName=`Textarea`;function j_({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:Z(`group/input-group relative flex h-9 w-full min-w-0 items-center rounded-4xl border border-transparent bg-input/50 transition-[color,box-shadow,background-color] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-3xl has-data-[align=block-start]:rounded-3xl has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-2xl has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var Bte=Xr(`flex h-auto cursor-text items-center justify-center gap-2 py-2 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-3xl **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1.5 [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-3 has-[>button]:-ml-1 has-[>kbd]:-ml-1`,"inline-end":`order-last pr-3 has-[>button]:-mr-1 has-[>kbd]:-mr-1`,"block-start":`order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-3.5 [.border-b]:pb-3.5`,"block-end":`order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-3.5 [.border-t]:pt-3.5`}},defaultVariants:{align:`inline-start`}});function M_({className:e,align:t=`inline-start`,...n}){return(0,X.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:Z(Bte({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var Vte=Xr(`flex items-center gap-2 rounded-4xl text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-xl px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-xl p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function Hte({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,X.jsx)(Q,{type:t,"data-size":r,variant:n,className:Z(Vte({size:r}),e),...i})}function Ute({className:e,...t}){return(0,X.jsx)(k_,{"data-slot":`input-group-control`,className:Z(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function N_({className:e,...t}){return(0,X.jsx)(m_,{"data-slot":`command`,className:Z(`flex size-full flex-col overflow-hidden rounded-4xl bg-popover p-1 text-popover-foreground`,e),...t})}function P_({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,X.jsxs)(j_,{className:`h-9 bg-input/50`,children:[(0,X.jsx)(m_.Input,{"data-slot":`command-input`,className:Z(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,X.jsx)(M_,{children:(0,X.jsx)(Ig,{className:`size-4 shrink-0 opacity-50`})})]})})}function F_({className:e,...t}){return(0,X.jsx)(m_.List,{"data-slot":`command-list`,className:Z(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),onWheelCapture:e=>{e.stopPropagation(),t.onWheelCapture?.(e)},...t})}function I_({className:e,...t}){return(0,X.jsx)(m_.Empty,{"data-slot":`command-empty`,className:Z(`py-6 text-center text-sm`,e),...t})}function L_({className:e,...t}){return(0,X.jsx)(m_.Group,{"data-slot":`command-group`,className:Z(`overflow-hidden p-1.5 text-foreground **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-2 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function R_({className:e,children:t,...n}){return(0,X.jsxs)(m_.Item,{"data-slot":`command-item`,className:Z(`group/command-item relative flex cursor-pointer items-center gap-2 rounded-2xl px-3 py-2 text-sm font-medium outline-hidden select-none in-data-[slot=dialog-content]:rounded-3xl data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,X.jsx)(Ng,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function z_({className:e,...t}){return(0,X.jsx)(pp,{"data-slot":`label`,className:Z(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var B_=e=>(0,X.jsx)(Bp,{"data-slot":`popover`,...e}),V_=e=>(0,X.jsx)(Vp,{"data-slot":`popover-trigger`,...e}),H_=({className:e,align:t=`center`,sideOffset:n=4,...r})=>(0,X.jsx)(Hp,{children:(0,X.jsx)(eee,{"data-slot":`popover-content`,align:t,sideOffset:n,className:Z(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2 rounded-xl border border-border bg-popover p-2 text-sm text-popover-foreground shadow-2xl shadow-black/30 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})}),U_=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`popover-header`,className:Z(`flex flex-col gap-1 text-sm`,e),...t}),W_=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`popover-title`,className:Z(`font-heading text-base font-medium`,e),...t}),G_=/[\s\-_/.:]+/,K_=/\d(?:[._:-]*\d)+/g,q_=e=>e.toLowerCase().trim().split(G_).filter(Boolean),J_=(e,t)=>t===e?300:t.startsWith(e)?200:e.length>=3&&t.includes(e)?100:0,Y_=e=>(e.toLowerCase().match(K_)??[]).map(e=>e.replace(/\D/g,``)).filter(e=>e.length>=2),X_=e=>/^\d+$/.test(e),Z_=(e,t)=>{let n=0;for(let r of t){if(r===e){n=Math.max(n,250);continue}r.startsWith(e)&&(n=Math.max(n,150))}return n},Q_=(e,t)=>{let n=q_(e);if(n.length===0)return 1;let r=t.flatMap(e=>q_(e??``)),i=[...new Set(t.flatMap(e=>Y_(e??``)))];if(r.length===0&&i.length===0)return 0;let a=0;for(let e of n){let t=0;for(let n of r){let r=J_(e,n);r>t&&(t=r)}if(t===0&&X_(e)&&(t=Z_(e,i)),t===0)return 0;a+=t}return a},$_=({label:e,triggerLabel:t,triggerAriaLabel:n,selectId:r,groups:i,disabled:a=!1,className:o,labelClassName:s,contentClassName:c,triggerClassName:l,isSelected:u,onSelect:d,closeOnSelect:f=!0})=>{let[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(!1),v=(0,p.useRef)(null),y=i.reduce((e,t)=>e+t.options.length,0)>4,b=(0,p.useCallback)(()=>{let e=v.current?.getBoundingClientRect();if(!e)return!1;let t=window.innerHeight-e.bottom-16,n=e.top-16;return t<320&&n>t},[]);return(0,p.useEffect)(()=>{if(!m)return;let e=()=>{_(b())};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[b,m]),(0,X.jsxs)(`div`,{className:Z(`flex flex-col gap-1.5`,o),children:[e&&(0,X.jsx)(z_,{className:Z(`text-xs font-medium text-muted-foreground`,s),htmlFor:r,children:e}),(0,X.jsxs)(B_,{open:m,onOpenChange:e=>{e&&_(b()),h(e)},children:[(0,X.jsx)(`div`,{className:`relative`,ref:v,children:(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsxs)(Q,{id:r,type:`button`,variant:`outline`,"aria-label":n??t,disabled:a,className:Z(`w-full justify-between bg-input/40 px-3 text-left font-normal`,l),children:[(0,X.jsx)(`span`,{className:`truncate`,children:t}),(0,X.jsx)(Pg,{className:`h-4 w-4 text-muted-foreground`})]})})}),(0,X.jsx)(H_,{side:g?`top`:`bottom`,align:`start`,className:Z(`w-[var(--radix-popover-trigger-width)] p-0`,c),children:(0,X.jsxs)(N_,{filter:(e,t,n)=>Q_(t,[e,...n??[]]),children:[y&&(0,X.jsx)(P_,{placeholder:`Filter...`}),(0,X.jsxs)(F_,{className:`max-h-72`,children:[(0,X.jsx)(I_,{children:`No matches`}),i.map((e,t)=>e.options.length===0?null:(0,X.jsx)(L_,{heading:e.label||void 0,className:Z(e.label?`border-t border-border/60 first:border-t-0 first:pt-0`:``),children:e.options.map(t=>(0,X.jsx)(R_,{value:`${t.label} ${t.value}`,keywords:[t.label,t.value,e.label],disabled:t.disabled,"data-checked":u(t.value),onSelect:()=>{t.disabled||(d(t.value),f&&h(!1))},children:(0,X.jsx)(`span`,{className:`truncate`,children:t.label})},t.value))},e.label||`group-${t}`))]})]})})]})]})},ev=({label:e,triggerLabel:t,triggerAriaLabel:n,selectId:r,groups:i,selectedValue:a,onChange:o,disabled:s=!1,className:c,labelClassName:l,contentClassName:u,triggerClassName:d})=>(0,X.jsx)($_,{label:e,triggerLabel:t,triggerAriaLabel:n,selectId:r,groups:i,disabled:s,className:c,labelClassName:l,contentClassName:u,triggerClassName:d,isSelected:e=>a===e,onSelect:o}),tv=({model:e,showModelSelector:t,availableModels:n,onModelChange:r,selectId:i,label:a=`Model`,triggerAriaLabel:o,disabled:s=!1,className:c,triggerClassName:l,defaultModelLabel:u=`Use default model`,selectedValueLabel:d,notice:f})=>{let m=(0,p.useMemo)(()=>{let e=new Map;for(let t of n){let n=t.provider;e.has(n)||e.set(n,[]),e.get(n)?.push({value:t.id,label:t.label})}return Array.from(e.entries()).map(([e,t])=>({provider:e,models:t}))},[n]),h=d??(e||u);return!t&&!f?null:(0,X.jsxs)(`div`,{className:Z(c),children:[t&&(0,X.jsx)(ev,{label:a,triggerLabel:h,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:u}]},...m.map(e=>({label:e.provider,options:e.models}))]}),f]})},nv=({variant:e,selectedModel:t,showVariantSelector:n,onVariantChange:r,selectId:i,label:a=`Variant`,triggerAriaLabel:o,disabled:s=!1,className:c,triggerClassName:l,defaultVariantLabel:u=`Use model default`,availableVariantsLabel:d=`Available levels`,unavailableVariant:f,unavailableSelectionLabel:p=`Unavailable`})=>{if(!n||!t)return null;let m=f===e?`${e} (${p})`:e||u;return(0,X.jsx)(`div`,{className:Z(c),children:(0,X.jsx)(ev,{label:a,triggerLabel:m,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:u}]},{label:d,options:t.variants.map(e=>({value:e,label:e===f?`${e} (${p})`:e}))}]})})},rv=({model:e,variant:t,availableModels:n,isLoadingModels:r,onModelChange:i,onVariantChange:a,modelSelectId:o,variantSelectId:s,title:c,description:l,loadingDescription:u,unavailableDescription:d,modelLabel:f,variantLabel:p,defaultModelLabel:m,defaultVariantLabel:h,availableVariantsLabel:g,unavailableSelectionLabel:_,className:v,compact:y=!1,showHeader:b=!0,disabled:x=!1})=>{let S=n.find(t=>t.id===e)??null,C=!!(e&&!S),w=!!(t&&(!S||!S.variants.includes(t))),T=C?[{id:e,label:`${e} (${_})`,provider:``,supports_reasoning:!1,variants:t?[t]:[]},...n]:n,E=T.find(t=>t.id===e)??null,D=E&&w&&!E.variants.includes(t)?{...E,variants:[...E.variants,t]}:E,O=T.length>0,k=D!==null&&D.variants.length>0;return(0,X.jsxs)(`div`,{className:Z(`rounded-2xl border border-border/70 bg-background/25 p-4`,v),children:[b&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:c}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:l})]}),r?(0,X.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,b&&`mt-4`),children:u}):O?(0,X.jsxs)(`div`,{className:Z(b&&`mt-4`,`gap-3`,y?`flex flex-col`:`flex flex-wrap`),children:[(0,X.jsx)(tv,{model:e,showModelSelector:!0,availableModels:T,onModelChange:i,selectId:o,label:f,defaultModelLabel:m,selectedValueLabel:C?`${e} (${_})`:void 0,disabled:x,className:y?`min-w-0`:`min-w-[10rem] flex-[1.35_1_10rem]`}),k&&(0,X.jsx)(nv,{variant:t,selectedModel:D,showVariantSelector:!0,onVariantChange:a,selectId:s,label:p,defaultVariantLabel:h,availableVariantsLabel:g,unavailableVariant:w?t:void 0,unavailableSelectionLabel:_,disabled:x,className:y?`min-w-0`:`min-w-[7rem] flex-[0.7_1_7rem]`})]}):(0,X.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,b&&`mt-4`),children:d})]})},iv=({helperModel:e,helperVariant:t,availableModels:n,isLoadingModels:r,onHelperModelChange:i,onHelperVariantChange:a,modelSelectId:o,variantSelectId:s,className:c,compact:l=!1,showHeader:u=!0})=>{let{t:d}=K(`projects`);return(0,X.jsx)(rv,{model:e,variant:t,availableModels:n,isLoadingModels:r,onModelChange:i,onVariantChange:a,modelSelectId:o,variantSelectId:s,title:d(`advanced.helperModel.title`),description:d(`advanced.helperModel.panelDescription`),loadingDescription:d(`advanced.modelSelection.loading`),unavailableDescription:d(`advanced.helperModel.unavailable`),modelLabel:d(`advanced.modelSelection.modelLabel`),variantLabel:d(`advanced.modelSelection.variantLabel`),defaultModelLabel:d(`advanced.modelSelection.defaultModel`),defaultVariantLabel:d(`advanced.modelSelection.defaultVariant`),availableVariantsLabel:d(`advanced.modelSelection.availableVariants`),unavailableSelectionLabel:d(`advanced.modelSelection.unavailableSelection`),className:c,compact:l,showHeader:u})},av=({delayDuration:e=0,...t})=>(0,X.jsx)(Qm,{"data-slot":`tooltip-provider`,delayDuration:e,...t}),ov=e=>(0,X.jsx)($m,{"data-slot":`tooltip`,...e}),sv=e=>(0,X.jsx)(eh,{"data-slot":`tooltip-trigger`,...e}),cv=({className:e,sideOffset:t=8,children:n,...r})=>(0,X.jsx)(th,{children:(0,X.jsxs)(nh,{"data-slot":`tooltip-content`,sideOffset:t,className:Z(`pointer-events-none z-[100] inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) select-none items-center gap-1.5 rounded-md border border-sky-500/20 bg-popover px-2.5 py-1.5 text-xs font-medium text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,X.jsx)(rh,{className:`fill-popover`})]})}),lv=({content:e,children:t,align:n,side:r,sideOffset:i,disabled:a=!1,contentClassName:o,delayDuration:s=0})=>(0,X.jsx)(av,{delayDuration:s,disableHoverableContent:!0,children:(0,X.jsxs)(ov,{children:[(0,X.jsx)(sv,{asChild:!0,children:t}),a?null:(0,X.jsx)(cv,{className:o,align:n,side:r,sideOffset:i??8,children:e})]})}),uv=({value:e,items:t,onChange:n,disabled:r=!1,className:i})=>(0,X.jsx)(`div`,{className:Z(`inline-flex items-center gap-1 rounded-xl border border-border/70 bg-background/70 p-1 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]`,i),children:t.map(t=>{let i=t.value===e,a=(0,X.jsx)(Q,{type:`button`,variant:i?t.activeVariant??`default`:`ghost`,size:`sm`,disabled:r,className:Z(`h-7 rounded-lg px-2.5 text-xs`,i?t.activeClassName:t.inactiveClassName??`text-muted-foreground hover:text-foreground`),onClick:()=>n(t.value),children:t.label},t.value);return i||!t.inactiveTooltip||r?a:(0,X.jsx)(lv,{content:t.inactiveTooltip,children:a},t.value)})}),dv=({activeTool:e,agents:t,onChange:n})=>(0,X.jsx)(uv,{value:e,items:t.map(e=>({value:e.id,label:e.displayName})),onChange:n}),fv=({activeTool:e,agents:t=[],availableHelperModels:n,helperModel:r,helperVariant:i,isHelperModelsLoaded:a,isToolLoaded:o,onCreateProject:s,onHelperModelChange:c,onHelperVariantChange:l,onToolChange:u})=>{let{t:d}=K(`common`);return(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-10`,children:(0,X.jsxs)(`div`,{className:`w-full max-w-3xl overflow-hidden rounded-[2rem] border border-border bg-[radial-gradient(circle_at_top_left,_rgba(52,211,153,0.18),_transparent_42%),linear-gradient(160deg,_rgba(20,24,34,1),_rgba(10,12,18,1))] p-8 shadow-2xl shadow-black/20 sm:p-10`,children:[(0,X.jsx)(`h2`,{className:`max-w-xl text-3xl font-semibold tracking-tight text-foreground sm:text-4xl`,children:d(`emptyState.title`)}),(0,X.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3`,children:[(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`emptyState.description`)}),o?(0,X.jsx)(`div`,{className:`w-fit`,children:(0,X.jsx)(dv,{activeTool:e,agents:t,onChange:u})}):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`emptyState.loadingToolPreference`)}),(0,X.jsx)(iv,{helperModel:r,helperVariant:i,availableModels:n,isLoadingModels:!a,onHelperModelChange:c,onHelperVariantChange:l,modelSelectId:`welcome-helper-model`,variantSelectId:`welcome-helper-variant`,compact:!0})]}),(0,X.jsx)(`div`,{className:`mt-8 flex flex-col gap-3 sm:flex-row sm:items-center`,children:(0,X.jsx)(Q,{type:`button`,onClick:s,variant:`success`,size:`lg`,children:d(`emptyState.createFirstProject`)})})]})})},pv=({isTransientError:e=!1,requestedProjectExists:t,retainedProject:n,defaultProject:r,onCreateProject:i,onOpenProject:a,onOpenWorkspace:o,onRetry:s})=>{let{t:c}=K(`common`);return(0,X.jsx)(`main`,{className:`flex flex-1 items-center justify-center px-6 py-10`,children:(0,X.jsxs)(`section`,{"aria-labelledby":`destination-unavailable-title`,className:`w-full max-w-2xl rounded-2xl border border-border bg-card p-8 shadow-xl shadow-black/20`,children:[(0,X.jsx)(`h2`,{id:`destination-unavailable-title`,className:`text-2xl font-semibold tracking-tight`,children:c(e?`destinationUnavailable.errorTitle`:t?`destinationUnavailable.destinationTitle`:`destinationUnavailable.projectTitle`)}),(0,X.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:c(e?`destinationUnavailable.errorDescription`:t?`destinationUnavailable.destinationDescription`:`destinationUnavailable.projectDescription`)}),(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[e&&s&&(0,X.jsx)(Q,{type:`button`,onClick:s,children:c(`destinationUnavailable.retry`)}),t&&!e&&(0,X.jsx)(Q,{type:`button`,onClick:o,children:c(`destinationUnavailable.openWorkspace`)}),n&&(0,X.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>a(n),children:c(`destinationUnavailable.openRetainedProject`,{project:n.name})}),!n&&r&&(0,X.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>a(r),children:c(`destinationUnavailable.openDefaultProject`,{project:r.name})}),!r&&(0,X.jsx)(Q,{type:`button`,onClick:i,children:c(`destinationUnavailable.createProject`)})]})]})})},mv=({className:e})=>(0,X.jsx)(Pg,{"aria-hidden":`true`,className:e}),hv=({className:e})=>(0,X.jsx)(hte,{"aria-hidden":`true`,className:e}),gv=({className:e})=>(0,X.jsx)(bte,{"aria-hidden":`true`,className:e}),_v=({activeProjectId:e,onCreateProject:t,projects:n,onEditProject:r,onProjectChange:i})=>{let{t:a}=K(`projects`),[o,s]=(0,p.useState)(!1),[c,l]=(0,p.useState)(!1),u=(0,p.useRef)(null),d=n.find(t=>t.id===e)??null,f=n.length>4,m=(0,p.useCallback)(()=>{let e=u.current?.getBoundingClientRect();if(!e)return!1;let t=window.innerHeight-e.bottom-16,n=e.top-16;return t<320&&n>t},[]);return(0,p.useEffect)(()=>{if(!o)return;let e=()=>{l(m())};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[m,o]),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-stretch`,children:[(0,X.jsxs)(B_,{open:o,onOpenChange:e=>{e&&l(m()),s(e)},children:[(0,X.jsx)(`div`,{className:`relative min-w-0 flex-1`,ref:u,children:(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"aria-label":a(`identity.activeProjectAriaLabel`),disabled:n.length===0,className:`group flex h-10 w-full min-w-0 cursor-pointer items-center justify-between gap-2 rounded-l-xl rounded-r-none border border-border/70 bg-card/70 px-3 text-left transition-colors hover:border-border hover:bg-accent/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-60`,children:[(0,X.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,X.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:d?.name??a(`identity.emptyLabel`)})}),(0,X.jsx)(`span`,{className:`flex h-6 w-6 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground`,children:(0,X.jsx)(mv,{className:`h-4 w-4`})})]})})}),(0,X.jsxs)(H_,{side:c?`top`:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:[(0,X.jsxs)(N_,{filter:(e,t,n)=>Q_(t,[e,...n??[]]),children:[f&&(0,X.jsx)(P_,{placeholder:a(`identity.filterPlaceholder`)}),(0,X.jsxs)(F_,{className:`max-h-72`,children:[(0,X.jsx)(I_,{children:a(`identity.emptySearch`)}),(0,X.jsx)(L_,{children:n.map(t=>(0,X.jsx)(R_,{value:`${t.name} ${t.id}`,keywords:[t.name,t.repo_path,t.id],"data-checked":t.id===e,onSelect:()=>{i(t.id),s(!1)},children:(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:t.name}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:t.repo_path})]})},t.id))})]})]}),(0,X.jsx)(`div`,{className:`border-t border-border/70 p-1.5`,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":a(`identity.newProjectAriaLabel`),onClick:()=>{s(!1),t()},variant:`ghost`,className:`h-10 w-full justify-start gap-2 rounded-lg px-3`,children:[(0,X.jsx)(hv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:a(`identity.newProject`)})]})})]})]}),(0,X.jsx)(Q,{type:`button`,"aria-label":a(`identity.editProjectSettingsAriaLabel`),onClick:r,disabled:!e,variant:`outline`,size:`icon-sm`,className:`h-10 rounded-l-none border-l-0 border-border/70 bg-card/70`,children:(0,X.jsx)(gv,{className:`h-4 w-4`})})]})};function vv({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:Z(`animate-pulse rounded-2xl bg-muted`,e),...t})}var yv=({className:e=``})=>(0,X.jsx)(vv,{"aria-hidden":`true`,className:Z(`inline-flex rounded-md bg-[linear-gradient(90deg,_rgba(30,35,49,0.9),_rgba(63,72,98,0.95),_rgba(30,35,49,0.9))]`,e)}),bv=({stats:e=null,isLoading:t=!1,showFiles:n=!1,className:r=``})=>{if(t)return(0,X.jsx)(`div`,{"data-testid":`ticket-diff-stats-skeleton`,className:`flex items-center gap-2 text-[11px] font-medium ${r}`.trim(),children:(0,X.jsx)(yv,{className:`h-3.5 shrink-0 rounded-full ${n?`w-28`:`w-20`}`})});if(!e)return null;let i=e.files_changed===1?`1 file`:`${e.files_changed} files`;return(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium ${r}`.trim(),children:[n&&(0,X.jsx)(`span`,{className:`text-muted-foreground text-nowrap`,children:i}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,e.additions]}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,e.deletions]})]})},xv=({className:e})=>(0,X.jsx)(rte,{"aria-hidden":`true`,className:e}),Sv=({className:e})=>(0,X.jsx)(Yee,{"aria-hidden":`true`,className:e}),Cv=({className:e})=>(0,X.jsx)(Fg,{"aria-hidden":`true`,className:e}),wv=({className:e})=>(0,X.jsx)(Mg,{"aria-hidden":`true`,className:e}),Tv=({className:e})=>(0,X.jsx)(ite,{"aria-hidden":`true`,className:e}),Ev=({className:e})=>(0,X.jsx)(mte,{"aria-hidden":`true`,className:e}),Dv=({className:e})=>(0,X.jsx)(Fg,{"aria-hidden":`true`,className:e}),Ov=({className:e})=>(0,X.jsx)(Cte,{"aria-hidden":`true`,className:e}),kv=({className:e})=>(0,X.jsx)(wte,{"aria-hidden":`true`,className:e});function Av(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var jv=e=>{switch(e){case`success`:return Pv;case`info`:return Gte;case`warning`:return Wte;case`error`:return Kte;default:return null}},Mv=Array(12).fill(0),Nv=({visible:e,className:t})=>p.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},p.createElement(`div`,{className:`sonner-spinner`},Mv.map((e,t)=>p.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Pv=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Wte=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Gte=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),Kte=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),qte=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},p.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),p.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),Jte=()=>{let[e,t]=p.useState(document.hidden);return p.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},Fv=1,Iv=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:Fv++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],p.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Xte(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||Fv++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Yte=(e,t)=>{let n=t?.id||Fv++;return Iv.addToast({title:e,...t,id:n}),n},Xte=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,$=Object.assign(Yte,{success:Iv.success,info:Iv.info,warning:Iv.warning,error:Iv.error,custom:Iv.custom,message:Iv.message,promise:Iv.promise,dismiss:Iv.dismiss,loading:Iv.loading},{getHistory:()=>Iv.toasts,getToasts:()=>Iv.getActiveToasts()});Av(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Lv(e){return e.label!==void 0}var Zte=3,Qte=`24px`,$te=`16px`,Rv=4e3,ene=356,tne=14,nne=45,rne=200;function zv(...e){return e.filter(Boolean).join(` `)}function ine(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var ane=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:m,style:h,cancelButtonStyle:g,actionButtonStyle:_,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,expandByDefault:C,classNames:w,icons:T,closeButtonAriaLabel:E=`Close toast`}=e,[D,O]=p.useState(null),[k,A]=p.useState(null),[j,M]=p.useState(!1),[N,P]=p.useState(!1),[F,I]=p.useState(!1),[L,R]=p.useState(!1),[z,ee]=p.useState(!1),[B,V]=p.useState(0),[te,H]=p.useState(0),U=p.useRef(n.duration||b||Rv),ne=p.useRef(null),re=p.useRef(null),ie=c===0,ae=c+1<=o,oe=n.type,W=n.dismissible!==!1,se=n.className||``,ce=n.descriptionClassName||``,le=p.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ue=p.useMemo(()=>n.closeButton??m,[n.closeButton,m]),de=p.useMemo(()=>n.duration||b||Rv,[n.duration,b]),fe=p.useRef(0),pe=p.useRef(0),me=p.useRef(0),he=p.useRef(null),[ge,_e]=x.split(`-`),ve=p.useMemo(()=>s.reduce((e,t,n)=>n>=le?e:e+t.height,0),[s,le]),ye=Jte(),be=n.invert||t,xe=oe===`loading`;pe.current=p.useMemo(()=>le*S+ve,[le,ve]),p.useEffect(()=>{U.current=de},[de]),p.useEffect(()=>{M(!0)},[]),p.useEffect(()=>{let e=re.current;if(e){let t=e.getBoundingClientRect().height;return H(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),p.useLayoutEffect(()=>{if(!j)return;let e=re.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,H(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[j,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Se=p.useCallback(()=>{P(!0),V(pe.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},rne)},[n,d,a,pe]);p.useEffect(()=>{if(n.promise&&oe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||ye?(()=>{if(me.current<fe.current){let e=new Date().getTime()-fe.current;U.current-=e}me.current=new Date().getTime()})():U.current!==1/0&&(fe.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Se()},U.current)),()=>clearTimeout(e)},[u,i,n,oe,ye,Se]),p.useEffect(()=>{n.delete&&(Se(),n.onDismiss==null||n.onDismiss.call(n,n))},[Se,n.delete]);function Ce(){return T?.loading?p.createElement(`div`,{className:zv(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":oe===`loading`},T.loading):p.createElement(Nv,{className:zv(w?.loader,n?.classNames?.loader),visible:oe===`loading`})}let we=n.icon||T?.[oe]||jv(oe);return p.createElement(`li`,{tabIndex:0,ref:re,className:zv(v,se,w?.toast,n?.classNames?.toast,w?.default,w?.[oe],n?.classNames?.[oe]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":j,"data-promise":!!n.promise,"data-swiped":z,"data-removed":N,"data-visible":ae,"data-y-position":ge,"data-x-position":_e,"data-index":c,"data-front":ie,"data-swiping":F,"data-dismissible":W,"data-type":oe,"data-invert":be,"data-swipe-out":L,"data-swipe-direction":k,"data-expanded":!!(u||C&&j),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${N?B:pe.current}px`,"--initial-height":C?`auto`:`${te}px`,...h,...n.style},onDragEnd:()=>{I(!1),O(null),he.current=null},onPointerDown:e=>{e.button!==2&&(xe||!W||(ne.current=new Date,V(pe.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(I(!0),he.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!W)return;he.current=null;let e=Number(re.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(re.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ne.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=nne||a>.11){V(pe.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Se(),R(!0);return}else{var o,s;(o=re.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=re.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}ee(!1),I(!1),O(null)},onPointerMove:t=>{var n,r;if(!he.current||!W||window.getSelection()?.toString().length>0)return;let i=t.clientY-he.current.y,a=t.clientX-he.current.x,o=e.swipeDirections??ine(x);!D&&(Math.abs(a)>1||Math.abs(i)>1)&&O(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(D===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&ee(!0),(n=re.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=re.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ue&&!n.jsx&&oe!==`loading`?p.createElement(`button`,{"aria-label":E,"data-disabled":xe,"data-close-button":!0,onClick:xe||!W?()=>{}:()=>{Se(),n.onDismiss==null||n.onDismiss.call(n,n)},className:zv(w?.closeButton,n?.classNames?.closeButton)},T?.close??qte):null,(oe||n.icon||n.promise)&&n.icon!==null&&(T?.[oe]!==null||n.icon)?p.createElement(`div`,{"data-icon":``,className:zv(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ce():null,n.type===`loading`?null:we):null,p.createElement(`div`,{"data-content":``,className:zv(w?.content,n?.classNames?.content)},p.createElement(`div`,{"data-title":``,className:zv(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?p.createElement(`div`,{"data-description":``,className:zv(y,ce,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),p.isValidElement(n.cancel)?n.cancel:n.cancel&&Lv(n.cancel)?p.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||g,onClick:e=>{Lv(n.cancel)&&W&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Se())},className:zv(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,p.isValidElement(n.action)?n.action:n.action&&Lv(n.action)?p.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||_,onClick:e=>{Lv(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Se())},className:zv(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Bv(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function one(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?$te:Qte;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var sne=p.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:h,style:g,visibleToasts:_=Zte,toastOptions:v,dir:y=Bv(),gap:b=tne,icons:x,containerAriaLabel:S=`Notifications`}=e,[C,w]=p.useState([]),T=p.useMemo(()=>n?C.filter(e=>e.toasterId===n):C.filter(e=>!e.toasterId),[C,n]),E=p.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[D,O]=p.useState([]),[k,A]=p.useState(!1),[j,M]=p.useState(!1),[N,P]=p.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),F=p.useRef(null),I=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),L=p.useRef(null),R=p.useRef(!1),z=p.useCallback(e=>{w(t=>(t.find(t=>t.id===e.id)?.delete||Iv.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return p.useEffect(()=>Iv.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{w(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{m.flushSync(()=>{w(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[C]),p.useEffect(()=>{if(d!==`system`){P(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),p.useEffect(()=>{C.length<=1&&A(!1)},[C]),p.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;A(!0),(t=F.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===F.current||F.current?.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),p.useEffect(()=>{if(F.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,R.current=!1)}},[F.current]),p.createElement(`section`,{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,n)=>{let[i,a]=t.split(`-`);return T.length?p.createElement(`ol`,{key:t,dir:y===`auto`?Bv():y,tabIndex:-1,ref:F,className:c,"data-sonner-toaster":!0,"data-sonner-theme":N,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${ene}px`,"--gap":`${b}px`,...g,...one(l,u)},onBlur:e=>{R.current&&!e.currentTarget.contains(e.relatedTarget)&&(R.current=!1,L.current&&=(L.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||R.current||(R.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M(!0)},onPointerUp:()=>M(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>p.createElement(ane,{key:n.id,icons:x,index:i,toast:n,defaultRichColors:f,duration:v?.duration??h,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:r,visibleToasts:_,closeButton:v?.closeButton??s,interacting:j,position:t,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:z,toasts:T.filter(e=>e.position==n.position),heights:D.filter(e=>e.position==n.position),setHeights:O,expandByDefault:o,gap:b,expanded:k,swipeDirections:e.swipeDirections}))):null}))}),Vv=({className:e})=>(0,X.jsx)(Zee,{"aria-hidden":`true`,className:e}),cne=(e,t)=>{let n=e.created_at.localeCompare(t.created_at);if(n!==0)return n;let r=e.title.localeCompare(t.title,void 0,{sensitivity:`base`});return r===0?e.id.localeCompare(t.id):r},Hv=12,Uv=e=>({x:e.left+e.width/2,y:e.top+e.height/2}),Wv=e=>`${e.blocker_ticket_id}:${e.dependent_ticket_id}`,Gv=(e,t)=>e.filter(e=>e.blocker_ticket_id!==t&&e.dependent_ticket_id!==t),Kv=(e,t)=>{let n=e.filter(e=>Wv(e)!==Wv(t));return n.push(t),n.sort((e,t)=>Wv(e).localeCompare(Wv(t))),n},qv=(e,t,n)=>e.filter(e=>!(e.blocker_ticket_id===t&&e.dependent_ticket_id===n)),lne=(e,t,n)=>{let r=[n],i=new Set;for(;r.length>0;){let n=r.shift();if(!(!n||i.has(n))){if(n===t)return!0;i.add(n);for(let t of e)t.blocker_ticket_id===n&&r.push(t.dependent_ticket_id)}}return!1},Jv=(e,t,n)=>t===n?{valid:!1,reason:`self`}:e.some(e=>e.blocker_ticket_id===t&&e.dependent_ticket_id===n)?{valid:!1,reason:`duplicate`}:lne(e,t,n)?{valid:!1,reason:`cycle`}:{valid:!0},une=e=>e===`self`?`A ticket cannot depend on itself.`:e===`duplicate`?`This dependency already exists.`:`This dependency would create a cycle.`,Yv=e=>e?e.build_completed_at!==null&&e.build_completed_at!==void 0||e.state===`review`?!0:e.state===`build`&&e.agent_status===`done`:!1,Xv=e=>!e||e.has_worktree===!1?!1:e.run_setup_status===`ready`?!0:Yv(e),Zv=e=>{if(!(!e||e.has_worktree===!1)){if(e.run_setup_status===`preparing`)return`Setting up worktree...`;if(!Xv(e))return`Run unlocks after setup finishes.`}},dne=(e,t,n)=>n.filter(t=>t.dependent_ticket_id===e.id).map(e=>t.get(e.blocker_ticket_id)).filter(e=>!!e&&!Yv(e)),fne=(e,t)=>{let n=[e],r=new Set,i=new Set;for(;n.length>0;){let e=n.shift();if(!(!e||r.has(e))){r.add(e);for(let r of t)r.blocker_ticket_id===e&&(i.add(r.dependent_ticket_id),n.push(r.dependent_ticket_id))}}return i},Qv=(e,t,n)=>{let r=n.get(t);if(!r){e.push(t);return}let i=!1;for(let a=0;a<e.length;a+=1){let o=n.get(e[a]);if(o&&cne(r,o)<0){e.splice(a,0,t),i=!0;break}}i||e.push(t)},pne=(e,t,n)=>{if(!t.get(e))return[];let r=fne(e,n);if(r.size===0)return[];let i=[e,...r],a=new Set(i),o=new Map,s=new Map;for(let e of i)o.set(e,0),s.set(e,[]);for(let e of n)!a.has(e.blocker_ticket_id)||!a.has(e.dependent_ticket_id)||(s.get(e.blocker_ticket_id)?.push(e.dependent_ticket_id),o.set(e.dependent_ticket_id,(o.get(e.dependent_ticket_id)??0)+1));let c=[];for(let e of i)(o.get(e)??0)===0&&Qv(c,e,t);let l=[];for(;c.length>0;){let e=c.shift();if(e){l.push(e);for(let n of s.get(e)??[]){let e=(o.get(n)??0)-1;o.set(n,e),e===0&&Qv(c,n,t)}}}return l.map(e=>t.get(e)).filter(e=>!!e)},$v=(e,t,n)=>{let r=pne(e.id,t,n),i=r.filter(e=>!Yv(e)),a=r.length>1,o=dne(e,t,n).length>0,s=e.state===`plan`&&a&&!o;return{buildChainOrder:r,pendingBuildChainOrder:i,hasDependents:a,hasOpenBlockers:o,canStartBuildChain:s,isVisibleStartPoint:e.build_chain?.is_root===!0||s,skippedBuildChainCount:r.length-i.length}},ey=(e,t)=>{let n=Uv(e),r=Uv(t),i=e.left+e.width,a=t.left+t.width,o=e.top+e.height,s=t.top+t.height;return e.left<a&&i>t.left?r.y>=n.y?{start:{x:n.x,y:o-Hv},end:{x:r.x,y:t.top+Hv}}:{start:{x:n.x,y:e.top+Hv},end:{x:r.x,y:s-Hv}}:r.x>=n.x?{start:{x:i-Hv,y:n.y},end:{x:t.left+Hv,y:r.y}}:{start:{x:e.left+Hv,y:n.y},end:{x:a-Hv,y:r.y}}},mne=(e,t)=>{let n=t.x-e.x,r=t.y-e.y;if(Math.abs(n)>=Math.abs(r)){let r=Math.max(64,Math.abs(n)*.6),i={x:e.x+Math.sign(n||1)*r,y:e.y},a={x:t.x-Math.sign(n||1)*r,y:t.y};return{path:`M ${e.x} ${e.y} C ${i.x} ${i.y}, ${a.x} ${a.y}, ${t.x} ${t.y}`,angle:Math.atan2(t.y-a.y,t.x-a.x)}}let i=Math.max(18,Math.round(Math.abs(r)*.4)),a=Math.max(24,Math.min(36,Math.round(Math.abs(r)*.18+Math.abs(n)*.1))),o=Math.round(a*.35),s=n>=0?1:-1,c={x:e.x+s*a,y:e.y+Math.sign(r||1)*i},l={x:t.x+s*o,y:t.y-Math.sign(r||1)*i};return{path:`M ${e.x} ${e.y} C ${c.x} ${c.y}, ${l.x} ${l.y}, ${t.x} ${t.y}`,angle:Math.atan2(t.y-l.y,t.x-l.x)}},ty={plan:0,build:1,review:2},hne={plan:`build`,build:`review`},ny=e=>hne[e]??null,ry=e=>e===`plan`?`plan`:e===`build`||e===`review`||e===`done`?`build`:`default`,iy=e=>e.worktree_bundle_id??e.id,gne=(e,t)=>{if(!e)return null;let n=t.find(t=>t.id===e.ticket_id);return n?iy(n):e.ticket_id},_ne=({bundleId:e,activeRunContextKey:t,isProjectRootRunActive:n})=>n?!0:t!==null&&t!==e,ay=(e,t,n,r)=>n||t!==null&&t!==iy(e)?r:Zv(e),oy=(e,t)=>t?{...e,...t,diff_stats:t.diff_stats===void 0?e.diff_stats:t.diff_stats,is_stale:t.is_stale===void 0?e.is_stale:t.is_stale,messages:t.messages===void 0?e.messages:t.messages,agent_log:t.agent_log===void 0?e.agent_log:t.agent_log,streaming_response:t.streaming_response===void 0?e.streaming_response:t.streaming_response}:e,vne=(e,t)=>t.map(t=>{let n=e.find(e=>e.id===t.id);return!n||n.agent_status!==`running`||t.agent_status===`running`||n.updated_at<t.updated_at?t:oy(t,n)}),yne=(e,t)=>{let n=e.toLowerCase().trim().split(/\s+/).filter(Boolean);if(n.length===0)return!0;let r=[t.title,t.description,t.bundle?.name??``,t.bundle?.branch??``,t.branch??``].map(e=>e.toLowerCase());return n.every(e=>r.some(t=>t.includes(e)))},sy=e=>e.state===`build`||e.state===`review`&&e.review_follow_up_active===!0,cy=e=>e.state===`review`&&e.review_follow_up_active!==!0,ly=e=>e.parked_at!==null,uy=e=>ly(e)?`done`:e.state,dy=e=>e.is_stale===!0,bne=e=>e?e.files_changed===0&&e.additions===0&&e.deletions===0:!1,fy=(e,t)=>!t||e===`plan`?!1:!(e===`done`&&bne(t)),py=e=>ly(e)||e.agent_status===`running`?!1:e.state===`build`?e.agent_status===`done`:e.state===`review`,xne=(e,t)=>ly(e)&&e.state===t,my=e=>e.tickets.length>0&&e.tickets.every(e=>gy(e,`trash`)),Sne=e=>e.tickets.length>0&&e.tickets.every(e=>gy(e,`done`)),Cne=e=>e.column===`done`&&e.tickets.length>0&&e.tickets.every(e=>e.state!==`plan`),hy=(e,t)=>t===`build`?{agent_status:null,agent_log:null,streaming_response:null,build_completed_at:null,planning_context:e.planning_context?{...e.planning_context,open_questions:[]}:null}:t===`review`?{agent_status:null,agent_log:null,streaming_response:null}:{},wne=(e,t)=>e===`plan`&&t===`build`?`build`:e===`build`&&t===`review`?`review`:e===`review`&&t===`build`?`undoReview`:null,Tne=(e,t,n)=>t===`review`&&n===`build`?{}:hy(e,n),gy=(e,t)=>e.agent_status===`running`?!1:t===`done`?py(e):!(t!==`trash`&&ty[t]<=ty[e.state]||t===`review`&&(e.state!==`build`||e.agent_status!==`done`&&e.agent_status!==`stopped`)),Ene=e=>{let t=ny(e.state);return!t||gy(e,t)?null:e.state===`build`?e.agent_status===`running`?`Finish the current build before moving to review.`:e.agent_status===`error`?`Retry and finish the build before moving to review.`:`Build must be done before moving to review.`:e.state===`plan`?`Finish planning before moving to build.`:null},Dne=[...[`plan`,`build`,`review`],`done`],_y=e=>[...e].sort((e,t)=>{let n=e.bundle_execution_position??2**53-1,r=t.bundle_execution_position??2**53-1;if(n!==r)return n-r;if(e.created_at!==t.created_at)return e.created_at.localeCompare(t.created_at);let i=e.title.localeCompare(t.title,void 0,{sensitivity:`base`});return i===0?e.id.localeCompare(t.id):i}),One=(e,t)=>{let n=e.worktree_bundle_id?t.get(e.worktree_bundle_id)??null:null;return e.bundle&&n?{...e.bundle,...n,pull_request:n.pull_request??e.bundle.pull_request}:n??e.bundle??null},vy=e=>e.kind===`project_root`?!0:e.has_prepared_worktree!==!1,yy=e=>e.filter(e=>e.kind!==`project_root`&&vy(e)),by=e=>[...e].filter(e=>e.session_id).sort((e,t)=>e.updated_at===t.updated_at?t.id.localeCompare(e.id):t.updated_at.localeCompare(e.updated_at))[0]??null,xy=e=>[...e].filter(e=>e.state!==`plan`&&e.build_completed_at).sort((e,t)=>{let n=e.build_completed_at??``,r=t.build_completed_at??``;return n===r?e.updated_at===t.updated_at?t.id.localeCompare(e.id):t.updated_at.localeCompare(e.updated_at):r.localeCompare(n)})[0]??null,Sy=e=>{let t=e.filter(e=>e.state!==`plan`&&e.parked_at===null),n=xy(t);if(n)return n;let r=_y(t);return r[r.length-1]??null},Cy=e=>e.has_worktree??!!(e.bundle?.branch??e.branch),wy=(e,t)=>vy(e)||t.some(t=>t.worktree_bundle_id===e.id&&Cy(t)),Ty=(e,t={})=>{let n=t.targetTicketId?e.find(e=>e.id===t.targetTicketId)??null:null,r=t.reviewOwnerTicketId?e.find(e=>e.id===t.reviewOwnerTicketId)??null:null,i=xy(e),a=Sy(e),o=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId&&e.session_id)??null:by(e),s=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId)??null:null;return a??n??r??i??o??s??e.find(e=>Cy(e))??e.find(e=>e.state!==`plan`)??e[0]??null},Ey=(e,t,n)=>{let r=new Map(t.map(e=>[e.id,e])),i=e.filter(e=>n===`done`?e.parked_at!==null:e.state===n&&e.parked_at===null),a=new Map;for(let e of i){if(!e.worktree_bundle_id)continue;let t=a.get(e.worktree_bundle_id);if(t){t.push(e);continue}a.set(e.worktree_bundle_id,[e])}let o=new Set;return i.flatMap(e=>{if(!e.worktree_bundle_id)return[{kind:`ticket`,ticket:e}];if(o.has(e.worktree_bundle_id))return[];o.add(e.worktree_bundle_id);let t=a.get(e.worktree_bundle_id)??[e];if(t.length===1)return[{kind:`ticket`,ticket:t[0]}];let i=One(t[0],r);return i?[{kind:`bundle`,group:{id:`${i.id}:${n}`,bundle:i,column:n,tickets:_y(t)}}]:t.map(e=>({kind:`ticket`,ticket:e}))})},Dy=e=>`bundle-group:${e.id}`,Oy=e=>{let t=new Map;for(let n of e){if(!n.worktree_bundle_id)continue;let e=t.get(n.worktree_bundle_id);if(e){e.add(uy(n));continue}t.set(n.worktree_bundle_id,new Set([uy(n)]))}let n=new Set;for(let[e,r]of t)r.size>=2&&n.add(e);return n},ky=e=>{if(!e.startsWith(`bundle-group:`))return null;let t=e.slice(13),n=t.lastIndexOf(`:`);if(n<=0)return null;let r=t.slice(0,n),i=t.slice(n+1);return Dne.includes(i)?{bundleId:r,column:i}:null},Ay=e=>{let t=e.trim();for(;t!==``;){let e=t.match(/^(.*?) \(([^()]+)\)$/);if(!e)return t;let n=e[1]?.trim()??``,r=e[2]?.trim()??``,i=n.toLowerCase(),a=r.toLowerCase();if(i===a){t=n;continue}if(i.endsWith(` (${a})`)){t=n;continue}return t}return e.trim()},jy=(e,t)=>{let n=Ay(e),r=t.trim();if(n===``||r===``)return n;let i=` (${r})`,a=n;for(;a.toLowerCase().endsWith(i.toLowerCase());)a=a.slice(0,-i.length).trimEnd();return a||n},My=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?e.name??``:e.branch??``;let t=Ay(e.name||e.branch||``);return e.branch?jy(t,e.branch):t},Ny=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?`Project root`:`Project root (${e.branch})`;let t=My(e),n=e.branch??``,r=t.trim().toLowerCase(),i=n.trim().toLowerCase();return t===``||n===``?t||n:r===i?t:`${t} (${n})`},Py=(e,t,n)=>e.active_target_kind===`bundle`?n===null?`text-muted-foreground`:n?`text-amber-300`:`text-emerald-200`:t?.status===`ready`?t.canPull?`text-amber-300`:`text-emerald-200`:`text-muted-foreground`,Fy=({activeProject:e,branchState:t,bundles:n,branchSuggestions:r,activeTargetCanPull:i=null,isBundleLoading:a=!1,isLoading:o,presentation:s=`footer`,closeAfterSelection:c=!0,triggerAriaLabel:l,onOpenChange:u,onSelectBundle:d,onSelectRepoRoot:f,targetGitStatus:m=null,activeBranchAction:h=null,onRebase:g,onManageBundles:_})=>{let{t:v}=K(`common`),[y,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(!1),T=s===`composer`,E=e.active_target_kind!==`bundle`,D=(0,p.useMemo)(()=>yy(n),[n]),O=(0,p.useMemo)(()=>e.active_target_kind!==`bundle`||!e.active_target_bundle_id?null:n.find(t=>t.id===e.active_target_bundle_id)??null,[e.active_target_bundle_id,e.active_target_kind,n]),k=(0,p.useMemo)(()=>!t||t.status===`loading`?null:t.status===`ready`&&t.branch?t.branch:t.status===`detached`?v(`projectTargetSelector.status.detachedHead`):v(`projectTargetSelector.status.unknownBranch`),[t,v]),A=(0,p.useMemo)(()=>e.active_target_kind===`bundle`&&e.active_target_bundle_id?O?Ny(O):v(`projectTargetSelector.activeBundleUnavailable`):k??v(`projectTargetSelector.loadingTarget`),[O,e.active_target_bundle_id,e.active_target_kind,k,v]),j=k?v(`projectTargetSelector.repoRootWithBranch`,{branch:k}):v(`projectTargetSelector.repoRoot`),M=(0,p.useMemo)(()=>Py(e,t,i),[e,i,t]),N=o||a,P=e.active_target_kind===`bundle`&&!!e.active_target_bundle_id&&O===null&&a,F=E&&t?.status===`loading`||P,I=(0,p.useMemo)(()=>F?v(`projectTargetSelector.status.loading`):E?t?.status===`detached`?v(`projectTargetSelector.status.detachedHead`):t?.status===`ready`?t.canPull?v(`projectTargetSelector.status.pullAvailable`):v(`projectTargetSelector.status.upToDate`):v(`projectTargetSelector.status.unknownBranch`):v(O?i===null?`projectTargetSelector.status.loading`:i?`projectTargetSelector.status.pullAvailable`:`projectTargetSelector.status.upToDate`:`projectTargetSelector.status.unavailable`),[O,i,t?.canPull,t?.status,E,F,v]),L=(0,p.useMemo)(()=>{let e=r.current_branch;return[{key:`default`,label:v(`projectTargetSelector.defaultBranch`),branch:r.default_branch},{key:`previous`,label:v(`projectTargetSelector.previousBranch`),branch:r.previous_branch}].filter(t=>t.branch&&t.branch!==e).filter((e,t,n)=>n.findIndex(t=>t.branch===e.branch)===t)},[r,v]),R=m?.base_branch?v(`projectFooter.rebaseOnto`,{branch:m.base_branch}):v(`projectFooter.rebase`),z=m?.operation_state===`idle`,ee=!g||!z||!!m?.rebase_disabled_reason||h!==null||C;(0,p.useEffect)(()=>{y&&S(t?.branch??``)},[t?.branch,y]);let B=e=>{b(e),u?.(e)},V=()=>{c&&B(!1)},te=async e=>{w(!0);try{await d(e)&&V()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.bundleSwitch`))}finally{w(!1)}},H=async(e,t)=>{w(!0);try{await f(e,t)&&V()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.repoRootSwitch`))}finally{w(!1)}},U=async()=>{if(g){w(!0);try{await g(),B(!1)}catch(e){$.error(e instanceof Error?e.message:v(`projectFooter.rebaseFallbackError`))}finally{w(!1)}}};return(0,X.jsxs)(B_,{open:y,onOpenChange:B,children:[(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":l,"aria-busy":F,className:T?`flex h-9 max-w-64 cursor-pointer items-center overflow-hidden rounded-lg border border-border bg-background px-3 text-left text-xs transition hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-50`:`flex max-w-full cursor-pointer items-center overflow-hidden rounded-xl border border-border/70 bg-card/70 px-3 py-2 text-left shadow-sm transition hover:border-border hover:bg-accent/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60`,"data-testid":T?`new-chat-project-target`:`active-project-branch`,children:F?(0,X.jsx)(yv,{className:`h-3.5 w-20`}):(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 ${M}`,children:[(0,X.jsx)(Vv,{className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate font-medium`,children:A})]})})}),(0,X.jsx)(H_,{align:`start`,className:T?`w-[22rem] max-w-[calc(100vw-2rem)] p-3`:`w-[28rem] max-w-[calc(100vw-2rem)] p-4`,children:(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:v(`projectTargetSelector.title`)}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:v(`projectTargetSelector.description`)})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.targetLabel`)}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:I})]}),(0,X.jsxs)(N_,{className:`rounded-xl border border-border/70 bg-background/40 p-0`,label:v(`projectTargetSelector.searchAriaLabel`),shouldFilter:!0,children:[(0,X.jsx)(P_,{placeholder:v(`projectTargetSelector.searchPlaceholder`),"aria-label":v(`projectTargetSelector.searchAriaLabel`)}),(0,X.jsxs)(F_,{className:`max-h-56 p-1`,"data-testid":`project-target-options`,children:[(0,X.jsx)(I_,{children:v(N?`projectTargetSelector.loadingTargets`:`projectTargetSelector.noSearchResults`)}),(0,X.jsxs)(R_,{value:`${v(`projectTargetSelector.repoRoot`)} ${k??``}`,"data-checked":E,disabled:N||C,"aria-label":`${j}. ${E?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{H(null)},className:`min-h-12`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`truncate`,children:v(`projectTargetSelector.repoRoot`)}),(0,X.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:k??v(`projectTargetSelector.loadingTarget`)})]}),E&&(0,X.jsx)(`span`,{className:`mr-6 text-xs text-muted-foreground`,children:v(`projectTargetSelector.status.selected`)})]}),D.map(t=>{let n=My(t),r=Ny(t),i=e.active_target_kind===`bundle`&&e.active_target_bundle_id===t.id;return(0,X.jsxs)(R_,{value:r,"data-checked":i,disabled:N||C,"aria-label":`${r}. ${i?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{te(t.id)},className:`min-h-12`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`truncate`,children:n}),t.branch&&n.toLowerCase()!==t.branch.toLowerCase()&&(0,X.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:t.branch})]}),i&&(0,X.jsx)(`span`,{className:`mr-6 text-xs text-muted-foreground`,children:v(`projectTargetSelector.status.selected`)})]},t.id)}),N&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground`,role:`status`,"data-testid":`project-target-options-spinner`,children:[(0,X.jsx)(Tv,{className:`h-3.5 w-3.5 animate-spin`}),(0,X.jsx)(`span`,{children:v(`projectTargetSelector.loadingTargets`)})]}),!N&&D.length===0&&(0,X.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:v(`projectTargetSelector.noBundles`)})]})]}),!T&&_&&(0,X.jsx)(Q,{type:`button`,variant:`outline`,className:`w-full justify-start`,disabled:C,onClick:()=>{B(!1),_?.()},children:v(`projectTargetSelector.manageBundles`)})]}),!T&&(0,X.jsxs)(`div`,{className:`space-y-2 border-t border-border/70 pt-4`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.repoRootBranch`)}),(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-3`,children:[(0,X.jsx)(`div`,{className:`space-y-2`,children:L.length>0?L.map(({key:e,label:t,branch:n})=>(0,X.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between`,disabled:!E||C||!n,onClick:()=>{H(n)},children:[(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n})]},e)):(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v(o?`projectTargetSelector.loadingBranches`:`projectTargetSelector.noSuggestedBranches`)})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 sm:flex-nowrap`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 basis-56 space-y-1`,children:[(0,X.jsx)(z_,{htmlFor:`project-target-branch-input`,className:`text-xs text-muted-foreground`,children:v(`projectTargetSelector.switchOrCreateBranch`)}),(0,X.jsx)(k_,{id:`project-target-branch-input`,value:x,disabled:!E||C,onChange:e=>S(e.target.value),placeholder:v(`projectTargetSelector.branchPlaceholder`)})]}),(0,X.jsx)(Q,{type:`button`,disabled:!E||!x.trim()||C,onClick:()=>{H(x)},children:v(`projectTargetSelector.switchBranch`)})]})]})]}),!T&&z&&(0,X.jsxs)(`div`,{className:`space-y-2 border-t border-border/70 pt-4`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.actions`)}),(0,X.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between`,disabled:ee,title:m?.rebase_disabled_reason??void 0,onClick:()=>{U()},children:[(0,X.jsx)(`span`,{children:R}),h===`rebase`&&(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`})]})]})]})})]})},Iy=(e,t=!1)=>e?e.status===`loading`?{kind:`loading`}:e.status===`ready`&&e.branch?{kind:`text`,toneClassName:t?`text-amber-300`:`text-emerald-200`,value:e.branch}:e.status===`detached`?{kind:`text`,toneClassName:`text-[#8d92aa]`,value:``,translationKey:`projectFooter.detachedHead`}:{kind:`text`,toneClassName:`text-[#8d92aa]`,value:``,translationKey:`projectFooter.unknownBranch`}:null,Ly=({activeProject:e,activeRun:t,branchState:n,targetGitStatus:r,isBoardLoadedForActiveProject:i,activeProjectBranchAction:a,isProjectIdeAvailable:o,isProjectRunAvailable:s,isRunStatusLoadedForActiveProject:c,isTerminalOpen:l,hasConfiguredTests:u,hasConfiguredChecks:d,targetBundles:f,targetBranchSuggestions:p,isTargetBundleLoading:m,isTargetSelectorLoading:h,isTargetGitStatusLoading:g,onProjectFilesOpen:_,onProjectChangesOpen:v,onProjectVerificationOpen:y,onProjectPull:b,onProjectRebase:x,onProjectAbortGitOperation:S,onProjectRunToggle:C,onTerminalToggle:w,onProjectIdeOpen:T,onTargetSelectorOpenChange:E,onSelectBundleTarget:D,onSelectRepoRootTarget:O,onManageBundles:k})=>{let{t:A}=K(`common`),j=r?.operation_state??`idle`,M=!!(e&&r&&r.behind>0&&j===`idle`),N=(()=>{let e=Iy(n,M);return e?.kind!==`text`||!e.translationKey?e:{...e,value:A(e.translationKey)}})(),P=N?.kind===`loading`,F=a===`pull`,I=a===`abort`,L=!!(e&&r&&r.branch&&r.behind>0&&a===null),R=(r?.behind??0)>0&&(r?.ahead??0)>0?A(`projectFooter.sync`):A(`projectFooter.pull`),z=j===`merge`||j===`rebase`,ee=A(j===`merge`?`projectFooter.abortMerge`:`projectFooter.abortRebase`),B=!!e,V=!!(e&&n?.diffStats?.is_dirty),te=A(l?`workspaceControls.hideTerminalAriaLabel`:`workspaceControls.openTerminalAriaLabel`),H=e?.active_target_kind??`repo_root`,U=e?.active_target_bundle_id??null,ne=H!==`bundle`||f.some(e=>e.id===U&&e.has_prepared_worktree===!0),re=e!==null&&t?.kind===`project`&&t.project_id===e.id&&(t.target_kind??`repo_root`)===H&&((t.target_kind??`repo_root`)!==`bundle`||t.target_bundle_id===U),ie=e!==null&&!re&&(!i||!c),ae=!e||!re&&(!s||t!==null||ie),oe=A(re?`projectFooter.stop`:`projectFooter.run`),W=(()=>{if(!e)return A(`projectFooter.selectProjectFirst`);if(!re){if(!s)return A(`projectFooter.addRunConfig`);if(ie)return A(`projectFooter.loadingProjectStatus`);if(t?.kind===`project`)return A(`projectFooter.stopSelectedTargetRun`);if(t?.kind===`ticket`)return A(`projectFooter.stopTicketBeforeSelectedTargetRun`)}})();return(0,X.jsx)(`footer`,{className:`border-t border-border bg-background/95 px-6 py-3 backdrop-blur`,"data-testid":`project-footer`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-3 overflow-hidden px-1 text-xs text-muted-foreground sm:gap-4`,children:[e&&N&&(0,X.jsx)(`div`,{className:`flex max-w-full items-center gap-2 overflow-hidden`,children:(0,X.jsx)(Fy,{activeProject:e,branchState:n,bundles:f,branchSuggestions:p,activeTargetCanPull:e?.active_target_kind===`bundle`?r?r.behind>0:g?null:!1:null,isBundleLoading:m,isLoading:h||P,presentation:`footer`,closeAfterSelection:!1,onOpenChange:E,onSelectBundle:D,onSelectRepoRoot:O,targetGitStatus:r,activeBranchAction:a,onRebase:x,onManageBundles:k})}),z&&(0,X.jsxs)(Q,{type:`button`,onClick:()=>{S()},disabled:a!==null,variant:`outline`,className:`h-8 gap-2 px-3 text-xs`,children:[I?(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Ov,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:I?A(`projectFooter.aborting`):ee})]}),M&&(0,X.jsxs)(Q,{type:`button`,onClick:b,disabled:!L,variant:`outline`,className:`h-8 gap-2 px-3 text-xs`,children:[F?(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Dv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:F?R===A(`projectFooter.sync`)?A(`projectFooter.syncing`):A(`projectFooter.pulling`):R})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3 sm:gap-4`,children:[V&&n?.diffStats&&(0,X.jsx)(bv,{stats:n.diffStats,showFiles:!0,className:`text-xs`}),B&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.changes`),onClick:v,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(Cv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.changes`)})]}),(0,X.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.files`),onClick:_,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(Sv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.files`)})]})]}),(d||u)&&ne&&(0,X.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.verification`),onClick:y,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(xv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.verification`)})]}),(0,X.jsxs)(Q,{type:`button`,"aria-label":te,"aria-pressed":l,onClick:w,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(kv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.terminal`)})]}),e&&o&&(0,X.jsxs)(Q,{type:`button`,onClick:T,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(wv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.openIde`)})]}),(0,X.jsxs)(Q,{type:`button`,"data-testid":`project-root-run-button`,disabled:ae,title:W,onClick:C,variant:re?`destructive`:`secondary`,className:[`gap-2`,re?``:`bg-sky-700 text-sky-100 hover:bg-sky-600 hover:text-white`,ae?`bg-slate-700 text-slate-400 hover:bg-slate-700 hover:text-slate-400`:``].join(` `),children:[re&&(0,X.jsx)(`span`,{className:`h-2 w-2 flex-shrink-0 rounded-full bg-emerald-400 animate-pulse`,"data-testid":`project-root-run-indicator`}),re?(0,X.jsx)(Ov,{className:`h-4 w-4`}):(0,X.jsx)(Ev,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:oe})]})]})]})})},Ry=e=>(0,X.jsx)(op,{"data-slot":`dropdown-menu`,...e}),zy=e=>(0,X.jsx)(sp,{"data-slot":`dropdown-menu-trigger`,...e}),By=({className:e,align:t=`end`,sideOffset:n=6,...r})=>(0,X.jsx)(cp,{children:(0,X.jsx)(lp,{"data-slot":`dropdown-menu-content`,align:t,sideOffset:n,className:Z(`z-[90] min-w-44 overflow-hidden rounded-xl border border-border bg-popover p-1 text-sm text-popover-foreground shadow-2xl shadow-black/30 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r})}),Vy=({className:e,inset:t=!1,...n})=>(0,X.jsx)(up,{"data-slot":`dropdown-menu-item`,"data-inset":t,className:Z(`relative flex cursor-default select-none items-center gap-2 rounded-lg px-2.5 py-2 text-sm outline-hidden transition-colors data-[disabled]:opacity-50 data-[disabled]:text-muted-foreground focus:bg-accent focus:text-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}),Hy=({state:e,className:t})=>e?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-activity-indicator":`true`,"data-state":e,"data-testid":`workspace-activity-indicator`,className:Z(`h-2 w-2 flex-shrink-0 rounded-full`,e===`running`?`animate-pulse bg-amber-300`:e===`inactive`?`bg-zinc-500/70 ring-1 ring-zinc-400/20`:e===`interrupted`?`bg-amber-400/80 ring-1 ring-amber-400/30`:e===`error`?`bg-rose-400/90 ring-1 ring-rose-400/30`:`bg-emerald-400/80 ring-1 ring-emerald-400/30`,t)}):null,Uy=({className:e})=>(0,X.jsx)(Rg,{"aria-hidden":`true`,className:e}),Wy=({className:e})=>(0,X.jsx)(gte,{"aria-hidden":`true`,className:e}),Gy=class extends Error{constructor(e){super(e),this.name=`UpgradeInProgressError`}},Ky=async e=>{let t=await fetch(q(`/tools/upgrade`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tool:e})});if(t.status===409)throw new Gy(await Xe(t,`upgrade already running`));if(!t.ok)throw new Ke(await Xe(t,`Upgrade failed.`),t.status);return await t.json()},qy=({onUpgrade:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)({opencode:`idle`,claude:`idle`}),i=e=>({opencode:{success:t(`toolsMenu.openCodeSuccess`),successWithVersion:t(`toolsMenu.openCodeSuccessWithVersion`),upToDate:t(`toolsMenu.openCodeUpToDate`),upToDateWithVersion:t(`toolsMenu.openCodeUpToDateWithVersion`),failed:t(`toolsMenu.openCodeFailed`),alreadyRunning:t(`toolsMenu.openCodeAlreadyRunning`)},claude:{success:t(`toolsMenu.claudeSuccess`),successWithVersion:t(`toolsMenu.claudeSuccessWithVersion`),upToDate:t(`toolsMenu.claudeUpToDate`),upToDateWithVersion:t(`toolsMenu.claudeUpToDateWithVersion`),failed:t(`toolsMenu.claudeFailed`),alreadyRunning:t(`toolsMenu.claudeAlreadyRunning`)}})[e],a=async a=>{if(n[a]===`running`)return;r(e=>({...e,[a]:`running`}));let o=i(a);try{let e=await Ky(a);if(e.ok){if(e.upToDate){$.info(e.version?o.upToDateWithVersion.replace(`{{version}}`,e.version):o.upToDate);return}$.success(e.version?o.successWithVersion.replace(`{{version}}`,e.version):o.success);return}$.error(o.failed)}catch(e){if(e instanceof Gy){$.info(o.alreadyRunning);return}let n=e instanceof Error?e.message:t(`toolsMenu.networkError`);$.error(n)}finally{r(e=>e[a]===`running`?{...e,[a]:`idle`}:e),await e?.(a)}},o=(e,t,r)=>{let i=n[e]===`running`;return(0,X.jsxs)(Vy,{disabled:i,onSelect:t=>{t.preventDefault(),a(e)},children:[i?(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Wy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:i?r:t})]})};return{hasRunningUpgrade:Object.values(n).some(e=>e===`running`),renderUpgradeMenuItems:()=>(0,X.jsxs)(X.Fragment,{children:[o(`opencode`,t(`toolsMenu.updateOpenCode`),t(`toolsMenu.openCodeRunning`)),o(`claude`,t(`toolsMenu.updateClaude`),t(`toolsMenu.claudeRunning`))]})}},Jy=({onUpgrade:e,onOpenExecutionRuntimes:t})=>{let{t:n}=K(`common`),{renderUpgradeMenuItems:r}=qy({onUpgrade:e});return(0,X.jsxs)(Ry,{children:[(0,X.jsx)(zy,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,"aria-label":n(`toolsMenu.triggerAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`rounded-xl border border-border/70`,children:(0,X.jsx)(Uy,{className:`h-4 w-4`})})}),(0,X.jsxs)(By,{align:`end`,className:`w-60`,children:[t&&(0,X.jsxs)(Vy,{onSelect:t,children:[(0,X.jsx)(Uy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:n(`toolsMenu.runtimes`)})]}),r()]})]})},Yy=({className:e})=>(0,X.jsx)(Ree,{"aria-hidden":`true`,className:e}),Xy=({className:e})=>(0,X.jsx)(Ng,{"aria-hidden":`true`,className:e}),Zy=({className:e})=>(0,X.jsx)(`svg`,{"aria-hidden":`true`,className:e,viewBox:`0 0 16 16`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,X.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.5-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.82a7.65 7.65 0 0 1 4 0c1.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 0 0 16 8c0-4.42-3.58-8-8-8Z`})}),Qy=({className:e})=>(0,X.jsx)(Kee,{"aria-hidden":`true`,className:e}),$y={"X-Archon-Desktop-Action":`mobile-access`},eb=e=>Y(q(`/mobile-access/status`),{signal:e}),tb=e=>Y(q(`/mobile-access/enable`),{method:`POST`,headers:$y,body:e}),nb=()=>Y(q(`/mobile-access/disable`),{method:`POST`,headers:$y}),rb=e=>Y(q(`/mobile-access/regenerate-pairing`),{method:`POST`,headers:$y,body:{preferred_project_id:e??null}}),ib=e=>Y(q(`/mobile-access/sessions/${encodeURIComponent(e)}/revoke`),{method:`POST`,headers:$y}),ab=new Set,ob=null,sb=null,cb=()=>{for(let e of ab)e(ob)},lb=()=>{sb!==null&&(window.clearTimeout(sb),sb=null)},ub=e=>{if(typeof window>`u`||(lb(),e?.state!==`awaiting_pairing`||!e.pairing))return;let t=new Date(e.pairing.expires_at).getTime();if(Number.isNaN(t))return;let n=()=>{ob?.state!==`awaiting_pairing`||ob.pairing?.expires_at!==e.pairing?.expires_at||db({...ob,state:`expired`,pairing:null})},r=t-Date.now();if(r<=0){n();return}sb=window.setTimeout(n,r)},db=e=>{ob=e,ub(e),cb()},fb=async e=>{let t=await eb(e);return db(t),t},pb=()=>{let[e,t]=(0,p.useState)(ob);return(0,p.useEffect)(()=>(ab.add(t),()=>{ab.delete(t)}),[]),e},mb=e=>{(0,p.useEffect)(()=>{if(!e)return;let t=null,n=()=>{t?.abort(),t=new AbortController;let e=t;fb(e.signal).catch(e=>{Ye(e)}).finally(()=>{t===e&&(t=null)})};n();let r=e=>{db(e)},i=()=>{n()};return e.on(`mobile-access:status`,r),e.on(`connect`,i),()=>{t?.abort(),e.off(`mobile-access:status`,r),e.off(`connect`,i)}},[e])},hb=`(min-width: 1440px)`,gb=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(e).matches,_b=e=>{let[t,n]=(0,p.useState)(()=>gb(e));return(0,p.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>{n(t.matches)};return r(),t.addEventListener(`change`,r),()=>{t.removeEventListener(`change`,r)}},[e]),t},vb=e=>e?.state===`awaiting_pairing`?`border-amber-400/30 bg-amber-500/10 text-amber-100 hover:bg-amber-500/15 hover:text-amber-50`:e?.state===`connected`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-100 hover:bg-emerald-500/15 hover:text-emerald-50`:e?.state===`expired`?`border-amber-400/20 bg-amber-500/6 text-amber-100/90 hover:bg-amber-500/12 hover:text-amber-50`:e?.state===`error`?`border-rose-400/30 bg-rose-500/10 text-rose-100 hover:bg-rose-500/15 hover:text-rose-50`:`border-border/70 bg-background/70 text-muted-foreground hover:bg-accent/20 hover:text-foreground`,yb=(e,t)=>{if(!e||e.state===`disabled`){let n=t(`projectHeader.runtime.mobileDisabled`);return{buttonClassName:vb(e),indicatorState:`inactive`,isActive:!1,statusLabel:n,tooltip:n}}if(e.state===`awaiting_pairing`){let n=t(`projectHeader.runtime.mobileReadyToPair`);return{buttonClassName:vb(e),indicatorState:`running`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`connected`){let n=t(`projectHeader.runtime.mobileConnected`);return{buttonClassName:vb(e),indicatorState:`finished`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`expired`){let n=t(`projectHeader.runtime.mobilePairingExpired`);return{buttonClassName:vb(e),indicatorState:`interrupted`,isActive:!0,statusLabel:n,tooltip:n}}return{buttonClassName:vb(e),indicatorState:`error`,isActive:!0,statusLabel:t(`projectHeader.runtime.mobileUnavailable`),tooltip:e.error??t(`projectHeader.runtime.mobileUnavailable`)}},bb=(e,t)=>t.find(t=>t.id===e)?.displayName??e,xb=({activeTool:e,agents:t=[],onToolChange:n})=>{let{t:r}=K(`common`);return(0,X.jsx)(`div`,{role:`group`,"aria-label":r(`projectHeader.agent.triggerAriaLabel`),className:`flex items-center gap-1 rounded-xl border border-border/70 bg-background/70 p-1 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]`,children:t.map(t=>{let r=e===t.id;return(0,X.jsx)(Q,{type:`button`,variant:r?`secondary`:`ghost`,size:`xs`,className:r?`rounded-lg px-2.5 text-xs text-foreground`:`rounded-lg px-2.5 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>n(t.id),children:t.displayName},t.id)})})},Sb=({activeTool:e,agents:t=[],onToolChange:n})=>{let{t:r}=K(`common`);return(0,X.jsxs)(Ry,{children:[(0,X.jsx)(zy,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":r(`projectHeader.agent.menuAriaLabel`),variant:`ghost`,className:`h-8 gap-2 rounded-xl border border-border/70 bg-background/70 px-3 text-sm font-medium text-foreground hover:bg-accent/20`,children:[(0,X.jsx)(Yy,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{children:bb(e,t)}),(0,X.jsx)(mv,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,X.jsx)(By,{align:`end`,className:`w-44`,children:t.map(t=>{let r=e===t.id;return(0,X.jsxs)(Vy,{onSelect:()=>n(t.id),children:[(0,X.jsx)(Yy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:t.displayName}),r&&(0,X.jsx)(Xy,{className:`h-4 w-4 text-muted-foreground`})]},t.id)})})]})},Cb=({hasActiveGitHubRuns:e=!1,onOpenGitHubActions:t})=>{let{t:n}=K(`common`);return t?(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsxs)(Q,{type:`button`,"aria-label":n(`workspaceControls.openGitHubActionsAriaLabel`),onClick:t,variant:`ghost`,className:`h-8 gap-2 rounded-xl border border-border/70 bg-background/70 px-3 text-sm font-medium text-muted-foreground hover:bg-accent/20 hover:text-foreground`,children:[(0,X.jsx)(Zy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:n(`workspaceControls.githubActions`)})]}),e&&(0,X.jsx)(Hy,{state:`running`,className:`absolute -top-0.5 -right-0.5`})]}):null},wb=({onOpenActivity:e})=>{let{t}=K(`common`);return e?(0,X.jsxs)(Q,{type:`button`,"aria-label":t(`projectHeader.runtime.openActivity`),onClick:e,variant:`ghost`,className:`h-8 gap-2 rounded-xl border border-border/70 bg-background/70 px-3 text-sm font-medium text-muted-foreground hover:bg-accent/20 hover:text-foreground`,children:[(0,X.jsx)(Qy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:t(`projectHeader.runtime.activityLabel`)})]}):null},Tb=({mobileAccessStatus:e,onMobileAccessOpen:t})=>{let{t:n}=K(`common`);if(!t)return null;let r=yb(e,n);return(0,X.jsx)(lv,{content:r.tooltip,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":n(`projectHeader.runtime.openMobileAccess`),onClick:t,variant:`ghost`,className:`h-8 gap-2 rounded-xl border px-3 text-sm font-medium ${r.buttonClassName}`,children:[(0,X.jsx)(Hy,{state:r.indicatorState,className:`mt-0`}),(0,X.jsx)(`span`,{children:n(`projectHeader.runtime.mobileLabel`)})]})})},Eb=({hasActiveGitHubRuns:e=!1,mobileAccessStatus:t,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i,onOpenExecutionRuntimes:a})=>{let{t:o}=K(`common`),{hasRunningUpgrade:s,renderUpgradeMenuItems:c}=qy({}),l=yb(t,o),u=o(`projectHeader.runtime.triggerLabel`),d=null;return i&&e?d=`running`:n&&l.isActive?(u=l.statusLabel,d=l.indicatorState):s&&(u=o(`projectHeader.runtime.toolUpdateRunning`),d=`running`),(0,X.jsxs)(Ry,{children:[(0,X.jsx)(zy,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":o(`projectHeader.runtime.triggerAriaLabel`),variant:`ghost`,className:`relative h-8 gap-2 rounded-xl border border-border/70 bg-background/70 px-3 text-sm font-medium text-foreground hover:bg-accent/20`,children:[(0,X.jsx)(Uy,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{children:u}),d&&(0,X.jsx)(Hy,{state:d,className:`absolute -top-0.5 -right-0.5`})]})}),(0,X.jsxs)(By,{align:`end`,className:`w-60`,children:[a&&(0,X.jsxs)(Vy,{onSelect:a,children:[(0,X.jsx)(Uy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openExecutionRuntimes`)})]}),r&&(0,X.jsxs)(Vy,{onSelect:r,children:[(0,X.jsx)(Qy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openActivity`)})]}),i&&(0,X.jsxs)(Vy,{onSelect:i,children:[(0,X.jsx)(Zy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openGitHubActions`)}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(e?`projectHeader.runtime.githubStatusRunning`:`projectHeader.runtime.githubStatusIdle`)})]}),n&&(0,X.jsxs)(Vy,{onSelect:n,children:[(0,X.jsx)(Hy,{state:l.indicatorState,className:`mt-0`}),(0,X.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openMobileAccess`)}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l.statusLabel})]}),c()]})]})},Db=({activeTool:e,agents:t=[],hasActiveGitHubRuns:n,onMobileAccessOpen:r,onOpenActivity:i,onOpenGitHubActions:a,onOpenExecutionRuntimes:o,onToolChange:s})=>{let c=pb(),l=_b(hb);return(0,X.jsxs)(`div`,{className:`flex w-full min-w-0 items-center justify-end gap-2`,children:[l?(0,X.jsx)(xb,{activeTool:e,agents:t,onToolChange:s}):(0,X.jsx)(Sb,{activeTool:e,agents:t,onToolChange:s}),l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Cb,{hasActiveGitHubRuns:n,onOpenGitHubActions:a}),(0,X.jsx)(wb,{onOpenActivity:i}),(0,X.jsx)(Tb,{mobileAccessStatus:c,onMobileAccessOpen:r}),(0,X.jsx)(Jy,{onOpenExecutionRuntimes:o})]}):(0,X.jsx)(Eb,{hasActiveGitHubRuns:n,mobileAccessStatus:c,onMobileAccessOpen:r,onOpenActivity:i,onOpenGitHubActions:a,onOpenExecutionRuntimes:o})]})},Ob=`common`,kb={en:{common:{appName:`Archon`,codeBlock:{copy:`Copy code`,copied:`Code copied`,failure:`Unable to copy code.`},postBuildChecks:{blockedReason:`Wait for post-Build Checks to finish before sending another prompt.`,progress:`{{passed}} passed, {{failed}} failed`,status:{queued:`Checks queued`,running:`Checks running`,waiting:`Checks waiting`,completed:`Checks passed`,failed:`Checks failed`,cancelled:`Checks stopped`,interrupted:`Checks interrupted`},autoFix:{attempt:`Attempt {{current}} of {{total}}`,phase:{dispatching:`Starting automatic repair`,repairing:`Repairing checks`,rerunning:`Rerunning the originating check batch`,stopping:`Stopping automatic repair`,terminal:`Automatic repair finished`,fallback:`Continuation was rejected; starting a fresh repair`},terminal:{passed:`Automatic repair passed all checks`,ineligible:`These failures cannot be repaired automatically`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The repair agent failed`,no_workspace_changes:`The repair agent made no changes`,unchanged_failures:`Automatic repair made no progress`,user_cancelled:`Automatic repair was stopped by the user`,stale:`Check definitions or workspace became stale`,exhausted:`Automatic repair used all three attempts`,interrupted:`Automatic repair was interrupted`}}},workspaceTabs:{ariaLabel:`Project workspace`,board:`Board`,chat:`Chat`,spec:`Spec`,memory:`Memory`},destinationUnavailable:{errorTitle:`Unable to open destination`,errorDescription:`Archon could not load this destination. Check your connection and try again.`,retry:`Try again`,destinationTitle:`Destination unavailable`,destinationDescription:`This item may have been deleted, may not belong to this project, or is not available in this workspace.`,projectTitle:`Project unavailable`,projectDescription:`This project no longer exists or is not available for this link.`,openWorkspace:`Open nearest workspace`,openRetainedProject:`Open {{project}}`,openDefaultProject:`Open {{project}}`,createProject:`Create project`},executionEnvironmentBadge:{ariaLabel:`Execution environment: {{evidence}}`,provider:{host:`Host`,docker_sandbox:`Docker Sandbox`,unknown:`Unknown provider`},isolation:{host_process:`Host process`,microvm:`MicroVM`,unknown:`Unknown isolation`},lifecycle:{queued:`Queued`,preparing:`Preparing`,ready:`Ready`,running:`Running`,stopped:`Stopped`,retiring:`Retiring`,cleanup_pending:`Cleanup pending`,retired:`Retired`,failed:`Failed`,unavailable:`Unavailable`,unknown:`State unavailable`},degraded:`Degraded`},activityView:{title:`Activity`,description:`Durable execution history for activity in this project.`,timelineAriaLabel:`Lifecycle timeline`,runTitle:`{{kind}} · {{status}}`,runAttemptTitle:`{{kind}}, attempt {{count}}`,scope:{project:{title:`Activity`,description:`Durable execution history for activity in this project.`,srTitle:`Project activity`,srDescription:`Inspect durable execution runs and transition evidence for this project.`,emptyTitle:`No activity yet`,emptyDescription:`Execution runs will appear here when they start.`},ticket:{title:`Ticket activity`,description:`Durable execution history for this ticket.`,srTitle:`Ticket activity`,srDescription:`Inspect durable execution runs and transition evidence for this ticket.`,emptyTitle:`No ticket activity yet`,emptyDescription:`Execution runs linked to this ticket will appear here.`},bundle:{title:`Bundle activity`,description:`Durable execution history for this bundle.`,srTitle:`Bundle activity`,srDescription:`Inspect durable execution runs and transition evidence for this bundle.`,emptyTitle:`No bundle activity yet`,emptyDescription:`Execution runs linked to this bundle will appear here.`},chat:{title:`Chat activity`,description:`Durable execution history for this Chat session.`,srTitle:`Chat activity`,srDescription:`Inspect durable execution runs and transition evidence for this Chat session.`,emptyTitle:`No Chat activity yet`,emptyDescription:`Execution runs linked to this Chat session will appear here.`},spec:{title:`Spec activity`,description:`Durable execution history for this Spec session.`,srTitle:`Spec activity`,srDescription:`Inspect durable execution runs and transition evidence for this Spec session.`,emptyTitle:`No Spec activity yet`,emptyDescription:`Execution runs linked to this Spec session will appear here.`}},filters:{ariaLabel:`Activity filters`,kind:`Run type`,allKinds:`All runs`,status:`Status`,allStatuses:`All statuses`},automationLoop:{kind:{review_auto_fix:`Review repair loop`,check_auto_fix:`Check repair loop`},phase:{observing:`Observing Review findings`,acting:`Applying repairs`,gating:`Evaluating required checks`,verifying:`Running fresh Review verification`,dispatching:`Dispatching repair`,repairing:`Repairing checks`,rerunning:`Rerunning checks`,stopping:`Stopping`,paused:`Paused`,terminal:`Finished`},iteration:`Iteration {{current}} of {{total}}`,state:{unavailable:`Outcome unavailable`},completedIn:`Completed in {{duration}}`,duration:{milliseconds_one:`{{count}} ms`,milliseconds_other:`{{count}} ms`,seconds_one:`{{count}} second`,seconds_other:`{{count}} seconds`,minutes_one:`{{count}} minute`,minutes_other:`{{count}} minutes`,hours_one:`{{count}} hour`,hours_other:`{{count}} hours`},outcome:{review_auto_fix:{repaired:`Blocking Review findings were repaired`,continuing:`Another Review repair iteration is required`,unchanged:`Blocking Review findings remain unchanged`,exhausted:`The Review repair budget was exhausted`,failed:`The Review repair loop failed`,cancelled:`The Review repair loop was cancelled`,interrupted:`The Review repair loop was interrupted`,paused:`The Review repair loop is paused`},check_auto_fix:{passed:`Checks passed after automatic repair`,ineligible:`Failed checks were not eligible for automatic repair`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The check repair agent failed`,no_workspace_changes:`The repair made no workspace changes`,unchanged_failures:`The same check failures remain`,user_cancelled:`Automatic check repair was cancelled`,stale:`Check definitions or workspace evidence became stale`,exhausted:`The check repair budget was exhausted`,interrupted:`Automatic check repair was interrupted`}},stopReason:{review_auto_fix:{no_blocking_findings:`Fresh Review verification found no blocking findings`,max_iterations:`The historical iteration limit was reached`,automation_disabled:`Review repair automation was disabled`,action_failed:`The repair action failed`,gate_failed:`The required-check gate blocked progression`,verification_failed:`Fresh Review verification failed`,no_progress:`Fresh Review verification found no progress`,open_questions:`Open questions require attention`,configuration_changed:`Automation configuration changed`,invalid_lineage:`The automation lineage became invalid`,stale_evidence:`Required evidence became stale`,manual_pause:`The loop was paused manually`,cancelled:`The loop was cancelled`,interrupted:`The loop was interrupted`},check_auto_fix:{passed:`Checks passed after automatic repair`,ineligible:`Failed checks were not eligible for automatic repair`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The check repair agent failed`,no_workspace_changes:`The repair made no workspace changes`,unchanged_failures:`The same check failures remain`,user_cancelled:`Automatic check repair was cancelled`,stale:`Check definitions or workspace evidence became stale`,exhausted:`The check repair budget was exhausted`,interrupted:`Automatic check repair was interrupted`}}},kind:{test:`Tests`,check_batch:`Check batch`,check_attempt:`Check attempt`,check_repair:`Check repair`,check_auto_fix:`Automatic check repair`,github_actions:`GitHub Actions`,plan:`Plan`,planning_agent:`Planning agent`,build:`Build`,review:`Review`,chat_turn:`Chat turn`,spec_turn:`Spec turn`,spec_review:`Spec review`,build_follow_up:`Build follow-up`,plan_follow_up:`Plan follow-up`,automation_progression:`Automation progression`,automation_review_fix:`Automated review fix`,automation_commit:`Automated commit`,automation_push:`Automated push`,automation_pull_request:`Automated pull request`,repository_graph_scan:`Repository graph scan`,environment_validation:`Environment validation`,git_push:`Git push`,service:`Service`,unknown:`Run`},status:{queued:`Queued`,running:`Running`,waiting:`Waiting`,approval_required:`Awaiting approval`,completed:`Completed`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`,unknown:`Unknown status`},checkOutcome:{passed:`Passed`,command_failure:`Command failed`,spawn_failure:`Process could not start`,infrastructure_failure:`Check infrastructure failed`,evidence_persistence_failure:`Check evidence could not be saved`,timeout:`Timed out`,workspace_changed_before_start:`Workspace changed before start`,user_stop:`Stopped by user`,restart_loss:`Interrupted by server restart`,shutdown_loss:`Interrupted by server shutdown`},currency:{current:`Current`,stale:`Stale`,pending:`Pending completion`,unavailable:`Unable to verify`},actions:{retry:`Retry`,retrying:`Retrying...`,rerun:`Rerun`,rerunning:`Rerunning...`,openSource:`View source`,openProvider:`Open in GitHub`,tryAgain:`Try again`,viewDetails:`View details`,viewDetailsForRun:`View details for {{kind}}, attempt {{count}}`,viewDetailsForRunWithLoopSummary:`{{run}}. {{summary}}`,viewDetailsForCheck:`View details for {{name}}`,loadMore:`Load more`,cancel:`Cancel`,close:`Close`},states:{loading:`Loading activity...`,reconnecting:`Connection lost. Reconnecting and preserving the last known activity...`,error:`Unable to load activity right now.`,emptyTitle:`No activity yet`,emptyDescription:`Execution runs will appear here when they start.`},errors:{list:`Unable to load execution runs right now.`,details:`Unable to load run details right now.`,event:`Unable to load the requested activity event right now.`,retry:`Unable to retry this run right now.`},events:{fallback:`Run state changed`,sequence:`Sequence`,transition:`Status`,transitionValue:`{{from}} to {{to}}`,outcome:`Outcome`,timeInState:`Time in state`},group:{ariaLabel:`Execution sequence`,parentOutsidePage:`{{kind}} parent outside the loaded page`},environmentContext:{summary:`{{target}} · revision {{revision}} · {{provider}}`,unknown:`Unknown`},buildEvidence:{timeline:{host:`Build environment: This machine (host)`,docker_sandbox:`Build environment: Docker Sandbox · revision {{revision}}`,unknown:`Build environment: Unknown`},unknown:`Unknown`,profileSelection:`Profile {{fingerprint}} · {{reason}}`,selectionReason:{project_active_at_acceptance:`selected when the Build was accepted`,historical_lineage:`retained from historical Build lineage`,unknown:`selection reason not recognized`},worktreePreparation:{worktree_and_sync_only:`Host prepared the worktree and synchronized files only; this is not sandbox evidence.`,host_orchestration_and_execution:`Host prepared the worktree and also executed the Build workload.`,unknown:`Preparation authority was not recorded.`},setupOutcome:{running:`Setup is running ({{count}} commands)`,completed:`Setup executed ({{count}} commands)`,noop:`No setup commands were configured`,reused:`Setup evidence was reused ({{count}} commands)`,failed:`Setup failed ({{count}} commands)`},launcher:{host_shell:`Host shell`,host_process:`Host process`,docker_sandbox_exec:`Docker Sandbox execution`,unknown:`Unknown launcher classification`},authentication:{api_key:`API key`,oauth:`OAuth`,unknown:`Unknown authentication class`},credentialDelivery:{host_environment_inheritance:`legacy host environment inheritance`,docker_brokered:`Docker-brokered`,none_required:`none required`,unknown:`credential delivery unknown`},credentialClassification:{brokered_api_key:`validated brokered API key`,brokered_oauth:`validated brokered OAuth`,file_exposed:`credential exposed by file`,environment_exposed:`credential exposed by environment`,guest_stored:`credential stored in guest`,unavailable:`credential unavailable`,unknown:`credential delivery unknown`,legacy_host_inherited:`legacy host inheritance`},credential:`{{agent}} · {{authentication}} · {{delivery}}`,noCredentialRequirements:`No runtime credential requirements recorded`,network:{summary:`Network: {{mode}} · {{enforcement}}`,mode:{unrestricted:`Unrestricted requested`,allowlist:`Destination allowlist requested`},enforcement:{enforced_scoped:`Sandbox-scoped enforcement proven`,declarative_only:`Declarative only`,none:`No network enforcement requested`,unknown:`Network enforcement not proven`},posture:{allow_all:`Global allow-all`,deny_all:`Global deny-all`,mixed:`Mixed global policy`,none_initialized:`Policy not initialized`,unknown:`Unknown global posture`}},fallback:{block:`Blocked rather than falling back`,explicit_host:`Explicit host fallback allowed but not used`,used:`Fallback was used; inspect the recorded reason`,unknown:`Fallback policy was not recognized`},target:`{{kind}}: {{key}}`,provider:{host:`This machine (host)`,docker_sandbox:`Docker Sandbox`,unknown:`Unknown`}},environmentLifecycle:{queued:`Queued`,preparing:`Preparing`,ready:`Ready`,running:`Running`,stopped:`Stopped`,retiring:`Retiring`,cleanup_pending:`Cleanup pending`,retired:`Retired`,failed:`Failed`,unavailable:`Unavailable`,unknown:`Unknown`},artifacts:{title:`Artifacts`,evidence:`Evidence`,summaryAriaLabel_one:`Evidence, {{count}} artifact`,summaryAriaLabel_other:`Evidence, {{count}} artifacts`,count_one:`{{count}} artifact`,count_other:`{{count}} artifacts`,overflow_one:`+{{count}} more`,overflow_other:`+{{count}} more`,overflowDescription_one:`{{count}} additional artifact is not shown in this summary.`,overflowDescription_other:`{{count}} additional artifacts are not shown in this summary.`,sensitiveTitle:`Sensitive artifact`,untitledTitle:`Untitled artifact`,kindLabel:`Kind`,mediaType:`Media type`,size:`Size`,expires:`Expires`,sensitivityLabel:`Sensitivity`,availabilityLabel:`Availability`,downloadOnly:`Download only. Preview and external access are disabled for sensitive artifacts.`,kind:{report:`Report`,screenshot:`Screenshot`,log_excerpt:`Log excerpt`,structured_result:`Structured result`},sensitivity:{normal:`Standard`,sensitive:`Sensitive`},availability:{available:`Available`,expired:`Expired`,missing:`Missing`,deletion_failed:`Deletion pending`,deleted:`Deleted`},actions:{download:`Download`,downloadAriaLabel:`Download {{title}}`,open:`Open`,openAriaLabel:`Open {{title}}`},unavailable:{expired:`This artifact has expired and is no longer available.`,missing:`This artifact can no longer be found.`,deletion_failed:`This artifact is unavailable while deletion is completed.`,deleted:`This artifact has been deleted.`,noAction:`No action is available for this artifact.`}},retry:{confirmTitle:`Retry as a new attempt?`,confirmDescription:`A fresh attempt and provider session will be created. The previous attempt and all retained evidence will remain in history.`,confirmAction:`Create new attempt`,retentionNotice:`Retrying creates a fresh attempt while retaining this attempt and its evidence.`},rerun:{confirmTitle:`Rerun this check batch?`,confirmDescription:`A new batch will run the same source checks. This batch and its retained evidence will remain in history.`,confirmAction:`Rerun checks`,retentionNotice:`Rerunning creates a new batch while retaining this batch and its evidence.`},retryDenial:{unsupported_kind:`This run type cannot be retried.`,status_not_retryable:`This run is not in a retryable status.`,automation_resume_required:`Resume this run from its automation controls instead.`,retry_already_created:`A newer retry attempt already exists.`,retry_source_superseded:`Newer source activity has superseded this run.`,attempt_superseded:`A newer attempt has superseded this run.`,retry_target_missing:`The retry target no longer exists.`,retry_target_busy:`The retry target is currently busy.`,retry_state_incompatible:`The source is no longer in a compatible state for retry.`,retry_input_unavailable:`The exact input required for this retry is no longer available.`,retry_workspace_unavailable:`The required workspace is unavailable.`,unknown:`This run cannot be retried right now.`},details:{ariaLabel:`Run details`,title:`Run details`,selectPrompt:`Select a run to inspect its durable details and transition evidence.`,status:`Status`,attempt:`Attempt`,attemptValue:`Attempt {{count}}`,lineage:`Lineage`,retryOfAttempt:`Retry of attempt {{count}}`,retryLineage:`Retry lineage · attempt {{count}}`,priorAttemptUnavailable:`Prior attempt is outside retained history`,source:`Source`,environment:`Environment`,sourceUnavailable:`Source unavailable`,created:`Created`,started:`Started`,completed:`Completed`,failureReason:`Failure reason`,environmentValidationEvidence:`Environment validation evidence`,buildExecutionEvidence:`Build execution evidence`,buildExecutionEvidenceNotice:`Recorded for this Build run. Later project setting changes do not alter this evidence or its follow-up lineage.`,buildExecutionUnknown:`No recognized provider evidence was recorded. Archon does not assume host execution.`,buildProvider:`Build environment`,environmentId:`Environment ID`,providerVersion:`Provider version`,targetWorkspace:`Target workspace`,validationFingerprint:`Validation fingerprint`,capabilities:`Capabilities`,capabilityDetails:{empty:`No capability observations recorded`,labels:{filesystem:`Filesystem`,workspace_access:`Workspace access`,workspace_path:`Workspace path`,additional_mounts:`Additional mounts`,integration_access:`Integration access`,remote_git:`Remote Git`,resources:`Resources`,isolation:`Isolation`,directWritableWorkspace:`Direct writable workspace`,transparentHeadlessStreams:`Transparent headless streams`,credentialBrokering:`Credential brokering`,enforcedNetworkAllowlist:`Enforced network allowlist`,persistentEnvironments:`Persistent environments`,resourceIsolation:`Resource isolation`,nestedContainers:`Nested containers`,publishedPorts:`Published ports`,resourceControls:`Resource controls`},values:{supported:`Supported`,unsupported:`Unsupported`,unknown:`Unknown`,microvm:`MicroVM`,"host-process":`Host process`,exact_target:`Exact target`,none:`None`,denied:`Denied`,provider_defaults:`Provider defaults`}},degradation:`Degradation`,authenticationMode:`Authentication mode`,credentialDelivery:`Credential delivery`,profileFingerprint:`Profile fingerprint`,profileRevision:`Profile revision`,profileSelected:`Profile selected`,worktreePreparation:`Worktree preparation`,setupExecution:`Setup execution`,setupPlacement:`Setup placement`,setupLauncher:`Setup launcher`,setupReusedFrom:`Setup reused from`,agentPlacement:`Agent placement`,agentLauncher:`Agent launcher`,runtimeCredentials:`Runtime credential class`,unsupportedRequirements:`Unsupported requirements`,networkEnforcement:`Network enforcement`,networkMode:`Requested network mode`,networkPosture:`Observed network posture`,networkDestinations:`Network destination decisions`,effectiveCapabilities:`Effective filesystem, integration, Git, and resource capabilities`,fallbackEvidence:`Fallback`,fallbackSource:`Fallback source`,fallbackReason:`Fallback reason`,agent:`Agent`,unknown:`Unknown`,none:`None`,environmentRevision:`Environment revision`,environmentLifecycle:`Persistent environment state`,restartInterruptionEvidence:`This validation was interrupted by a server restart. The persistent environment is tracked separately and may still be available.`,loading:`Loading run details...`,testEvidence:`Test evidence`,checkBatchEvidence:`Check batch`,checkAttemptEvidence:`Check attempt`,checkRepairEvidence:`Repair provenance`,checkAutoFixEvidence:`Automatic repair history`,repairSource:`Repair source`,causalBuild:`Causal Build run`,causalExecution:`Causal execution run`,currentPhase:`Current phase`,launchDecision:`Launch decision`,continuation:`Continued provider session`,freshLaunch:`Fresh provider session`,fallbackUsed:`Fallback used`,fallbackYes:`Yes, before execution`,fallbackNo:`No`,repairAttempt:`Repair attempt {{current}} of {{total}}`,terminalExplanation:`Terminal explanation`,repairSourceType:{ticket:`Ticket`,chat_session:`Chat session`},launch:{continued:`Continued exact provider session`,fresh:`Fresh same-configuration session`},autoFixPhase:{dispatching:`Dispatching automatic repair`,repairing:`Repairing checks`,rerunning:`Rerunning originating batch`,stopping:`Stopping`,terminal:`Terminal`},autoFixTerminal:{passed:`Passed`,ineligible:`Not auto-fixable`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`Agent failure`,no_workspace_changes:`No workspace changes`,unchanged_failures:`No progress`,user_cancelled:`Cancelled by user`,stale:`Definitions or workspace became stale`,exhausted:`Three attempts exhausted`,interrupted:`Interrupted`},reviewLoop:{title:`Review repair progression`,description:`Each iteration separates the observed Review, repair action, required-check gate, and fresh Review verification.`,iterationsAriaLabel:`Review repair iterations`,iteration:`Iteration {{current}} of {{total}}`,phase:{label:`{{presentation}} · {{authoritative}}`,presentation:{observing:`Observing`,acting:`Acting`,gating:`Gating`,verifying:`Verifying`,paused:`Paused`,terminal:`Terminal`},authoritative:{observed:`Observed`,action_claimed:`Action claimed`,action_active:`Action active`,gate_pending:`Gate pending`,gate_active:`Gate active`,verification_pending:`Verification pending`,verification_active:`Verification active`,paused:`Paused`,terminal:`Terminal`}},role:{observation:`Observation`,actionEnvelope:`Action envelope`,action:`Action`,gate:`Required-check gate`,verification:`Fresh Review verification`},state:{available:`Available`,unavailable:`Unavailable`,not_started:`Not started`,not_required:`Not required`},navigation:{openReview:`Open observed Review run`,openActionEnvelope:`Open action envelope run`,openAction:`Open repair action run`,openGate:`Open required checks`,openVerification:`Open verification Review run`},blocking:{triggering:`Blocking findings observed`,resulting:`Blocking findings after verification`,failedResult:`Unavailable because verification did not produce a result`},evaluator:{observation:`Observation evaluator`,verification:`Verification evaluator`,modelVariant:`{{model}} · {{variant}}`},outcome:{label:`Iteration outcome`,pending:`Outcome pending`,repaired:`Repaired`,continuing:`Continuing`,unchanged:`Unchanged`,exhausted:`Budget exhausted`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`,paused:`Paused`},stopReason:{label:`Stop reason`,no_blocking_findings:`No blocking findings remained after fresh Review verification`,max_iterations:`The historical iteration limit was reached`,automation_disabled:`Review repair automation was disabled`,action_failed:`The repair action failed`,gate_failed:`The required-check gate failed`,verification_failed:`Fresh Review verification failed`,no_progress:`Fresh Review verification found no progress`,open_questions:`Open questions require attention`,configuration_changed:`Automation configuration changed`,invalid_lineage:`The automation lineage became invalid`,stale_evidence:`Required evidence became stale`,manual_pause:`The loop was paused manually`,cancelled:`The loop was cancelled`,interrupted:`The loop was interrupted`},policy:{title:`Historical automation policy and decisions`,historicalNotice:`These snapshots record the policy used at each decision. Current project settings may differ.`,depth:`Automation depth`,maximum:`Maximum Review iterations`,fixEnabled:`Review repair`,pauseOnQuestions:`Pause on open questions`,severity:`Blocking severity`,decisionsAriaLabel:`Historical Review repair decisions`,depthValue:{manual:`Manual`,auto_review:`Automatic Review`,auto_commit:`Automatic commit`,auto_push:`Automatic push`,auto_pr:`Automatic pull request`},severityValue:{high:`High`,medium:`Medium`,low:`Low`}},value:{enabled:`Enabled`,disabled:`Disabled`},decisionPoint:{claim:`Repair claimed`,action_completion:`Action completed`,gate_admission:`Gate admission`,verification_scheduling:`Verification scheduled`,verification_completion:`Verification completed`,resume:`Progression resumed`},decisionCode:{repair_admitted:`Repair was admitted`,action_completed:`Repair action completed`,required_checks_passed:`Required checks passed`,required_checks_blocked:`Required checks blocked progression`,checks_not_required:`Required checks were not required`,verification_admitted:`Fresh Review verification was admitted`,verification_completed:`Fresh Review verification completed`,verification_failed:`Fresh Review verification failed`,resume_iteration_requested:`Iteration resume was requested`,verification_reconciled_on_resume:`Verification was reconciled on resume`,resume_verification_repair_admitted:`A verification repair was admitted on resume`,resume_repair_admitted:`A repair was admitted on resume`,resume_repair_claimed:`A repair was claimed on resume`,verification_reconciled_on_startup:`Verification was reconciled after startup`,startup_verification_repair_admitted:`A verification repair was admitted after startup`,unknown:`A historical automation decision was recorded`},gateEvidence:{title:`Required-check gate evidence`,decision:`Gate decision`,policy:`Historical policy state`,reasons:`Reasons: {{reasons}}`,checksAriaLabel:`Required checks evaluated by the gate`},gateDecision:{passed:`Passed`,blocked:`Blocked`},policyStatus:{valid:`Valid`,invalid:`Invalid`},currency:{current:`Current evidence`,stale:`Stale evidence`},gateReason:{not_required:`Checks were not required`,policy_invalid:`The required-check policy was invalid`,policy_drift:`The required-check policy changed`,workspace_unavailable:`Workspace identity was unavailable`,intended_identity_mismatch:`Workspace identity did not match`,missing_evidence:`Required evidence was missing`,target_mismatch:`Check evidence targeted another workspace`,batch_not_completed:`The check batch was incomplete`,incomplete_evidence:`Check evidence was incomplete`,duplicate_evidence:`Duplicate check evidence was present`,extra_evidence:`Unexpected check evidence was present`,definition_drift:`Check definitions changed`,attempt_failed:`A required check failed`,attempt_stale:`A required check was stale`,target_busy:`The check target was busy`,check_start_failed:`Required checks could not start`,unknown:`An unavailable gate reason was recorded`},gateCheckOutcome:{passed:`Passed`,command_failure:`Command failed`,spawn_failure:`Process could not start`,infrastructure_failure:`Check infrastructure failed`,evidence_persistence_failure:`Check evidence could not be saved`,timeout:`Timed out`,workspace_changed_before_start:`Workspace changed before start`,user_stop:`Stopped by user`,restart_loss:`Interrupted by server restart`,shutdown_loss:`Interrupted by server shutdown`,ambiguous_process_loss:`Process outcome was ambiguous`,environment_loss:`Execution environment was lost`,unknown:`Outcome unavailable`},agentEvidence:{title_one:`{{count}} bounded agent evidence item`,title_other:`{{count}} bounded agent evidence items`,boundedNotice:`Only bounded response and failure summaries are retained here. Conversations and internal prompts are not included.`,truncated:`This bounded summary was truncated by the evidence limit.`},agentStatus:{running:`Running`,done:`Completed`,error:`Failed`,stopped:`Stopped`}},autoFix:{title:`Automatic check repair`,attemptsAriaLabel:`Automatic repair attempts`,phaseWithAttempt:`{{phase}} · attempt {{current}} of {{total}}`,phase:{dispatching:`Dispatching automatic repair`,repairing:`Repairing checks`,rerunning:`Verifying repairs`,stopping:`Stopping automatic repair`,terminal:`Automatic repair finished`},budget:{consumed:`Attempts consumed`,maximum:`Maximum attempts`,remaining:`Attempts remaining`},cancellation:{label:`Cancellation`,requested:`Requested`,notRequested:`Not requested`},loopDuration:`Total duration`,completedIn:`Completed in {{duration}}`,causalExecution:`Causal execution run`,attempt:`Attempt {{current}} of {{total}}`,role:{observation:`Observation`,action:`Action`,verification:`Verification`},state:{notStarted:`Not started`,unavailable:`Unavailable`},navigation:{openSourceChecks:`Open source checks`,openRepairRun:`Open repair run`,openVerificationChecks:`Open verification checks`,openCausalRun:`Open causal run`},launchMode:{label:`Launch mode`,continued:`Continued provider session`,fresh:`Fresh provider session`},fallback:{label:`Continuation fallback`,used:`A fresh session was used after continuation was unavailable`},outcome:{label:`Outcome`},attemptOutcome:{active:`Repair is active`,pending:`Waiting for repair to start`,completed:`Repair action completed`,failed:`Repair failed`,cancelled:`Repair was cancelled`,interrupted:`Repair was interrupted`,dispatch_rejected:`Repair dispatch was rejected`},overallOutcome:{active:`Automatic repair is active`,passed:`Checks passed after automatic repair`,ineligible:`The failed checks were not eligible for automatic repair`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The repair agent failed`,no_workspace_changes:`The repair completed without workspace changes`,unchanged_failures:`The same check failures remained after repair`,user_cancelled:`Automatic repair was cancelled by the user`,stale:`Check definitions or the workspace changed during repair`,exhausted:`{{count}} attempts were exhausted without passing checks`,interrupted:`Automatic repair was interrupted`},source:{label:`Repair source`,ticket:`Ticket`,chat_session:`Chat session`},diagnostics:{loop:`Diagnostic evidence`,attempt:`Attempt diagnostic evidence`},duration:{milliseconds_one:`{{count}} ms`,milliseconds_other:`{{count}} ms`,seconds_one:`{{count}} second`,seconds_other:`{{count}} seconds`,minutes_one:`{{count}} minute`,minutes_other:`{{count}} minutes`,hours_one:`{{count}} hour`,hours_other:`{{count}} hours`}},deterministicEvidenceNotice:`Diagnostics and rerun results are deterministic records. Agent repair summaries are not check evidence.`,sourceBatch:`Source check batch`,sourceAttempts:`Source attempts`,sourceDiagnostics:`Source diagnostics`,sourceRawOutputAttempts:`Source raw-output attempts`,repairWrapper:`Repair wrapper`,followUpRun:`Build follow-up child`,repairChildRun:`Repair child run`,rerunBatch:`Rerun batch`,nextBoundary:`Next automation boundary`,policyFingerprint:`Policy fingerprint`,configurationFingerprint:`Check configuration`,repairResult:`Repair result`,repairPending:`Repair agent or rerun is still active`,boundary:{automation_review:`Pre-Review checks, then automatic Review`,automation_commit:`Required checks, then commit creation`,automation_push:`Required checks, then push`,automation_pull_request:`Required checks, then pull-request creation`,unknown:`No delivery progression is claimed`},providerEvidence:`Provider evidence`,command:`Command`,cwd:`Working directory`,target:`Target`,exitCode:`Exit code`,duration:`Duration`,output:`Output`,outputEmpty:`This run produced no output.`,outputExpired:`Test output expired under the short-retention policy. The run result and summary remain available.`,workflow:`Workflow`,branch:`Branch or ref`,conclusion:`Conclusion`,unnamedJob:`Unnamed job`,jobsExpired:`GitHub Actions job snapshots expired under the short-retention policy. Provider status and conclusion remain available.`,outputTruncated:`Older output was removed by the retention limit.`,selectedChecks:`Selected checks`,batchCounts:`{{passed}} passed, {{failed}} failed, {{running}} running, {{queued}} queued`,outcome:`Outcome`,directory:`Directory`,timeout:`Timeout`,currency:`Currency`,current:`Current`,stale:`Workspace changed`,retainedRange:`Retained byte range`,retainedRangeValue:`{{start}}-{{end}} of {{total}} bytes`,rerunSource:`Rerun source`,rerunSourceValue:`Attempt {{id}}`,evidenceUnavailable:`Detailed evidence is no longer available, but this durable run record remains inspectable.`,sourceNoLongerAvailable:`The original source no longer exists, so navigation is unavailable.`,transitions:`Transitions`,noTransitions:`No retained transitions are available for this run.`,evidenceAriaLabel:`Run transition evidence`},dialog:{srTitle:`Project activity`,srDescription:`Inspect durable execution runs and transition evidence for this project.`,closeAriaLabel:`Close Activity`}},approvalRequest:{title:`Exact action approval`,loading:`Loading approval evidence...`,refresh:`Refresh`,none:`None`,reason:`Decision note (optional)`,reasonPlaceholder:`Add context for the audit history`,conflict:`This request changed elsewhere or its exact action is stale. The authoritative state is shown below; refresh before returning to the originating action.`,history:`Approval history ({{count}})`,action:{git_push:`Force push`,custom_check:`Production custom check`},impact:{git_push:`This replaces remote branch history with the exact local commit shown below.`,custom_check:`This command may change an external production system.`},fields:{action:`Action`,target:`Target`,command:`Command`,branch:`Branch`,head:`Local commit`,remoteHead:`Remote commit`,profile:`Execution profile`,launcher:`Launcher`,environment:`Batch environment`,placement:`Attempt placement`,authority:`Effective capabilities`,degradations:`Capability degradation`,secrets:`Logical secret references`,expires:`Expires`},values:{noHostEnvironment:`None; this action runs on the host`,hostPlacement:`This machine (host)`,sandboxPlacement:`Docker Sandbox · {{id}}`,sandboxPlacementUnavailable:`Docker Sandbox placement unavailable`,launcher:{host_shell:`Host shell`,docker_sandbox_exec:`Docker Sandbox exec`}},status:{pending:`Awaiting approval`,approved:`Approved`,denied:`Denied`,cancelled:`Cancelled`,expired:`Expired`,invalidated:`Invalidated`,consumed:`Executing or completed`},actions:{approve:`Approve exact action`,approving:`Approving...`,deny:`Deny`,denying:`Denying...`,cancel:`Cancel request`,cancelling:`Cancelling...`},remediation:{approved:`Approved. The server will revalidate the exact action before execution.`,denied:`Denied. Return to the originating action if a different operation should be requested.`,cancelled:`Cancelled. Return to the originating action to create a new request.`,expired:`Expired. Return to the originating action to capture current state in a new request.`,invalidated:`The target or authority changed. Refresh the origin and request approval for the current exact action.`,consumed:`Approval was consumed. Use lifecycle evidence to confirm whether execution completed, failed, or became ambiguous.`,pending:`This request still needs a decision.`},errors:{load:`Unable to load approval evidence right now.`,decision:`Unable to update this approval request right now.`},notification:{title:`Action awaiting approval`,forcePush:`A force push is waiting for your decision.`,productionCheck:`A production check is waiting for your decision.`},context:{title:`Pending approvals`,action:{git_push:`Force push awaiting approval`,custom_check:`Production check awaiting approval`},openActivity:`Open Activity`,openChecks:`Open Checks`}},emptyState:{title:`Create your first project to start routing tickets into a real repo.`,description:`Pick the default agent Archon should use for planning and ticket work. Auto-config can optionally use a separate helper model.`,loadingToolPreference:`Loading tool preference...`,createFirstProject:`Create first project`},boardConfirmEmptyDoneModal:{heading:`Empty Done`,deletePrompt_one:`Delete {{count}} done ticket from the Done column?`,deletePrompt_other:`Delete {{count}} done tickets from the Done column?`,description:`Standalone ticket worktrees will be removed when applicable. Deleting the last parked ticket in a bundle also removes that shared bundle worktree.`,cancel:`Cancel`,deleting:`Deleting...`,confirm:`Delete all`},cardConfirmDeleteModal:{heading:`Delete ticket`,descriptionInBundle:`This removes the ticket from bundle "{{bundleName}}". The bundle and shared worktree stay available.`,descriptionStandalone:`This will also remove the worktree if one exists.`,cancel:`Cancel`,confirm:`Delete`},cardConfirmUndoModal:{defaultSubjectLabel:`ticket`,headingReview:`Undo review`,headingBuild:`Undo build`,descriptionReview:`This will revert the current review-step changes and move the {{subjectLabel}} back to build-done.`,descriptionBuild:`This will revert the current build-step changes and move the {{subjectLabel}} back to plan.`,cancel:`Cancel`,confirm:`Undo`},bundleSelector:{label:`Bundle`,emptyLabel:`No bundle`},jiraImportField:{error:`Unable to load the Jira issue right now.`,label:`Import from Jira`,placeholder:`PROJ-123 or issue URL`,importing:`Importing...`,import:`Import`},githubImportField:{error:`Unable to load the GitHub issue right now.`,label:`Import from GitHub`,placeholder:`Issue # or URL`,importing:`Importing...`,import:`Import`},externalImportField:{error:`Unable to load the {{provider}} issue right now.`,label:`Import issue`,importing:`Importing...`,import:`Import`,detectError:`Could not detect the source. Use a Jira key like PROJ-123, a GitHub number like 123, owner/repo#123, or a full issue URL.`,disabledProvider:`This looks like a {{provider}} reference, but {{provider}} is not connected.`,placeholderBoth:`PROJ-123, 123, owner/repo#123, or paste a URL`,formatsHintExamples:`Examples: PROJ-123 (Jira), 123 or owner/repo#123 (GitHub), or paste a full issue URL.`,formatsHintConnected:`Connected: {{providers}}`,formatsHintAriaLabel:`Accepted import formats`},externalSourceBadge:{tooltip:{jira:`Imported from Jira issue {{key}}`,github:`Imported from GitHub issue {{key}}`}},newTicketModal:{heading:`New Ticket`,actions:{plan:`Plan`,createTicket:`Create Ticket`,createAndBuild:`Create & Build`}},assignedIssuesInbox:{buttonAriaLabel:`Assigned issues inbox`,badgeAriaLabel:`{{count}} untracked assigned issues`,title:`Assigned to you`,emptyState:`You're all caught up — no untracked assigned issues for this project.`,errorState:`Unable to load assigned issues right now.`,refresh:`Refresh`,viewJira:`View on Jira`,viewGithub:`View on GitHub`,createTicket:`Create ticket`,spec:`Spec`,providerJira:`Jira`,providerGithub:`GitHub`},bundleCard:{addTicketTooltip:`Add ticket to this bundle`,addTicketAriaLabel:`Add ticket to bundle {{bundleName}}`,openActionsAriaLabel:`Open actions menu for bundle {{bundleName}}`,verification:`Verification`},ticketEditor:{automaticBundleLabel:`Create automatically`,planningFailed:`Planning failed. Please try again.`,bundleCreationUnavailable:`Bundle creation is unavailable.`,titleLabel:`Title`,titlePlaceholder:`What needs to be done?`,descriptionLabel:`Description`,descriptionPlaceholder:`Describe the task, acceptance criteria, context...`,bundlePreview:`Bundle preview:`,manageBundles:`Manage bundles`,cancel:`Cancel`,planning:`Planning...`},manageBundlesModal:{createError:`Unable to create the bundle right now.`,deleteError:`Unable to delete the bundle right now.`,title:`Manage bundles`,createTitle:`Create bundle`,createPendingTitle:`Preparing bundle workspace`,createPendingDescription:`Creating the worktree, syncing files, and running setup commands.`,bundleNameLabel:`Bundle name`,bundleNameAriaLabel:`Bundle name`,bundleNamePlaceholder:`Checkout flow`,createAction:`Create bundle`,existingTitle:`Existing bundles`,empty:`No bundles yet.`,selected:`Selected`,currentTarget:`Current target`,projectRootDescription:`Uses the project root on branch {{branch}}.`,switchTargetDescription:`Switch the project target away from this bundle before deleting it.`,inUseDescription:`Used by {{ticketCount}}.`,unusedDescription:`Unused and ready to delete.`,ticketCount_one:`{{count}} ticket`,ticketCount_other:`{{count}} tickets`,cancel:`Cancel`,deleting:`Deleting...`,deleteBundle:`Delete bundle`,delete:`Delete`,close:`Close`},card:{advance:{reviewBundle:`Review Bundle`,rerunReview:`Re-run review`},columnLabels:{plan:`Plan`,build:`Build`,review:`Review`,done:`Done`,trash:`Trash`},returnTo:`Return to {{state}}`,drawDependency:`Draw dependency`,createDependencyAriaLabel:`Create dependency from {{title}}`,undoInProgress:`Undo in progress...`},cardActionsMenu:{openAriaLabel:`Open actions menu for {{title}}`,delete:`Delete`,undoReview:`Undo Review`,undoBuild:`Undo Build`,buildChain:`Build Chain`,addTicketToBundle:`Add ticket`,run:`Run`,startingRun:`Starting Run...`,stopRun:`Stop Run`,stopping:`Stopping...`,pauseBuild:`Pause Build`,resumeBuild:`Resume Build`,interruptReview:`Interrupt Review`,interruptingReview:`Interrupting Review...`,files:`Files`,changes:`Changes`,verification:`Verification`,openIde:`Open IDE`,stopBuildChain:`Stop Build Chain`,done:`Done`,startChat:`Start Chat`},reviewInterrupt:{error:`Unable to interrupt the review right now.`},toolsMenu:{triggerAriaLabel:`Open tools menu`,runtimes:`Runtimes`,updateOpenCode:`Update OpenCode`,updateClaude:`Update Claude`,openCodeRunning:`Updating OpenCode...`,claudeRunning:`Updating Claude...`,openCodeSuccess:`OpenCode updated`,claudeSuccess:`Claude updated`,openCodeSuccessWithVersion:`OpenCode updated to {{version}}`,claudeSuccessWithVersion:`Claude updated to {{version}}`,openCodeUpToDate:`OpenCode is already up to date`,claudeUpToDate:`Claude is already up to date`,openCodeUpToDateWithVersion:`OpenCode is already up to date ({{version}})`,claudeUpToDateWithVersion:`Claude is already up to date ({{version}})`,openCodeFailed:`OpenCode update failed`,claudeFailed:`Claude update failed`,openCodeAlreadyRunning:`OpenCode update already running`,claudeAlreadyRunning:`Claude update already running`,networkError:`Unable to reach the server.`},statusBadge:{queued:`Queued`,planning:`Planning...`,building:`Building`,buildingWithGlyph:`⏳ Building`,reviewing:`Reviewing`,automation:`Automation`,checks:`Checks`,autoFix:`Auto-fix`,commit:`Commit`,push:`Push`,pr:`PR`,done:`✓ Done`,error:`✗ Error`,stopped:`Stopped`},cardStatusBadges:{stale:`Stale`,retry:`Retry`,openQuestions:`Open questions`,chainStart:`Chain start`},ticketAutomation:{depth:{manual:`Manual`,auto_review:`Auto-review`,auto_commit:`Auto-commit`,auto_push:`Auto-push`,auto_pr:`Auto-PR`},override:{title:`Ticket automation`,ariaLabel:`Ticket automation override`,depthAriaLabel:`Automation depth override`,inherit:`Inherit`,summaryLabel:`Automation: {{depth}} ({{source}})`,summaryInherited:`inherited`,summaryOverride:`override`,saving:`Saving...`,updateError:`Unable to update the bundle automation and reviewer settings right now.`,overridingProject:`Override`,autoPrDisabledHint:`Connect the GitHub integration to enable Auto-PR.`,fixToggleLabel:`Auto-fix review findings`,fixToggleDescription:`When automation reaches review, automatically fix blocking findings and re-review until the review is clean or the iteration cap is hit.`,fixToggleAriaLabel:`Auto-fix review findings override`,maxIterationsLabel:`Max fix iterations`,maxIterationsDescription:`Set how many review-fix passes this bundle may run before pausing with the findings unresolved.`,maxIterationsAriaLabel:`Max fix iterations source`,inheritProjectSetting:`Inherit project setting`,overrideSetting:`Override setting`,maxIterationsInputLabel:`Iterations`,maxIterationsInputAriaLabel:`Max fix iterations`,openQuestionsLabel:`Open Questions checkpoint`,openQuestionsDescription:`Pause before Review when Build has unresolved implementation questions.`,openQuestionsAriaLabel:`Open Questions checkpoint override`,enabled:`Enabled`,disabled:`Disabled`},reviewer:{title:`Reviewer`,description:`Choose a model for reviews in this bundle, or inherit the project setting.`,effective:`{{model}} · {{variant}}`,fallback:`Implementing model per ticket`,perTicketVariant:`Variant per ticket`,defaultVariant:`Model default`,sourceAriaLabel:`Reviewer setting source`,modelLabel:`Reviewer model`,variantLabel:`Reviewer variant`,clearOverride:`Clear bundle override`,availableVariants:`Available variants`,unavailableSelection:`Unavailable`,loading:`Loading reviewer models...`,unavailable:`Model discovery is unavailable. Reviewer override selection cannot be changed right now.`,sources:{bundle:`Bundle`,project:`Project`,fallback:`Fallback`},claudeTicketProvenance:`This workflow uses Claude. The Reviewer setting shown here follows the active agent in the application header.`},pause:{label:`Automation paused`,resume:`Resume`,resumePending:`Resume is starting. Wait for the bundle state to update.`,dismiss:`Dismiss`,abandon:`Abandon automation`,openChecks:`Open checks`,stop:`Stop automation`,stopTooltip:`Stop the automation work that is currently running for this bundle.`,abandonTooltip:`Discard the saved automation continuation and keep its execution history for diagnostics.`,iterationCounter:`Review fix iteration {{current}} of {{max}}`,resolveQuestions:`Resolve questions`,diagnostic:`Details: {{reason}}`,resumeOutcome:{complete_manual_boundary:`Resume closes the saved automation progression at the current manual boundary.`,start_review:`Resume starts automatic Review for this bundle.`,resume_review:`Resume continues the interrupted Review session before delivery automation can continue.`,rerun_review:`Resume reruns automatic Review for the latest bundle changes.`,start_review_fix:`Resume starts the next review-fix pass, then reviews the changes again.`,continue_commit_chain:`Resume continues automation with the commit chain.`,reconcile_commit:`Resume verifies whether the commit completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,reconcile_push:`Resume verifies whether the push completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,reconcile_pull_request:`Resume verifies whether the pull request action completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,rerun_required_checks:`Resume reruns the required checks against the current workspace before automated delivery continues.`,rerun_review_checks:`Resume reruns the pre-review checks against the current workspace before automatic Review starts.`},resumeDisabled:{bundle_agent_running:`Resume is unavailable while a Build agent is running in this bundle.`,bundle_build_incomplete:`Resume is unavailable until every active ticket in this bundle completes Build.`,run_setup_preparing:`Resume is unavailable while a bundle run is preparing.`,review_running:`Resume is unavailable because Review is already running for this bundle.`,invalid_progression:`Resume is unavailable because automation progression ownership is invalid.`,invalid_stage_lineage:`Resume is unavailable because the paused stage does not belong to the active automation progression.`,no_resumable_owner:`Resume is unavailable because no ticket currently owns a resumable automation state.`},guidance:{preconditionFailed:`Review the current bundle state and resolve any blockers before continuing.`,stageFailed:`Review the failed stage details, then resume when the issue is resolved.`,serverRestart:`Automation was interrupted by a server restart. Resume to continue from the saved stage.`,reconciliationFailed:`Verify the repository state before resuming because automation could not confirm the latest stage result.`,sideEffectAmbiguous:`Verify whether the last external action completed before resuming.`,manualTransition:`Review the current ticket state before resuming because it changed while automation was running.`,configurationChanged:`Review the current automation settings before resuming because they changed during the run.`,targetBusy:`Another operation owns this target. Review Checks and wait for it to finish before resuming.`,requiredChecksFailed:`Required checks govern automated delivery. Review their durable evidence, then resume to rerun them.`,invalidLineage:`Automation ownership changed. Review the current bundle state before continuing.`,generic:`Review the current bundle state before resuming automation.`},requiredChecks:{boundary:{check_completion:`check completion`,automation_review:`Review progression`,automation_commit:`commit`,automation_push:`push`,automation_pull_request:`pull-request creation`},reason:{not_required:`required checks are not configured`,policy_invalid:`the required-check policy is invalid`,policy_drift:`the required-check policy changed`,workspace_unavailable:`the workspace is unavailable`,intended_identity_mismatch:`the checked workspace no longer matches the automation target`,missing_evidence:`required check evidence is missing`,target_mismatch:`the checks targeted a different workspace or bundle`,batch_not_completed:`the required-check batch has not finished`,incomplete_evidence:`required check evidence is incomplete`,duplicate_evidence:`duplicate required check evidence was found`,extra_evidence:`unexpected required check evidence was found`,definition_drift:`a required check definition changed`,attempt_failed:`one or more required checks failed`,attempt_stale:`required check evidence is stale`,target_busy:`another check run is already using the target`,check_start_failed:`required checks could not start`},fallbackReason:`the required checks did not produce usable evidence`,failure:`Required checks blocked the automated {{boundary}}. {{explanation}} Review the check results and rerun any failed or unfinished checks before resuming automation.`}},deliveryReady:{guidance:`Review is complete. Continue with Commit to accept the current findings and proceed with delivery.`,action:`Continue with Commit`,pending:`Starting Commit...`,error:`Unable to continue bundle delivery right now.`}},buildOpenQuestionsDialog:{title:`Resolve open questions`,description:`Every Build question in this bundle must be answered or dismissed before continuing.`,ticketHeading:`Ticket: {{title}}`,answerOption:`Answer`,dismissOption:`Dismiss`,answerLabel:`Implementation decision for: {{question}}`,answerPlaceholder:`Enter the implementation decision`,dismissSummary:`All questions are dismissed. The bundle will proceed to Review without another Build pass.`,incompleteSummary:`Answer or dismiss every question to continue.`,refreshedError:`The bundle questions changed. Review the refreshed complete batch before submitting.`,conflictError:`The questions changed on the server. Your matching drafts were preserved; review the refreshed batch.`,refreshFailedError:`The questions changed, but the refreshed batch could not be loaded. Close and reopen this dialog to try again.`,submitError:`The decisions could not be applied. Your drafts have been preserved.`,empty:`There are no unresolved Build questions in this bundle.`,reviewRefreshed:`I reviewed the refreshed batch`,cancel:`Cancel`,submit:`Apply decisions and continue`,submitting:`Applying decisions...`,openAction:`Resolve questions`,openActionAriaLabel:`Resolve {{count}} open Build questions`,count_one:`{{count}} open Build question`,count_other:`{{count}} open Build questions`},column:{loadingCard:`Loading card {{index}}`,runDisabledReason:`Stop the currently running ticket before starting another run.`,newTicket:`+ New ticket`,undoInProgress:`Undo in progress...`},board:{notifications:{planningDoneTitle:`Planning done`,planningDoneBody_one:`{{count}} ticket created`,planningDoneBody_other:`{{count}} tickets created`},search:{placeholder:`Search tickets`,ariaLabel:`Search tickets`,clearAriaLabel:`Clear search`,hideStaleAriaLabel:`Hide stale tickets`,hideStaleLabel:`Hide stale tickets`,hideBundlesWithPullRequestsAriaLabel:`Hide bundles with PRs`,hideBundlesWithPullRequestsLabel:`Hide bundles with PRs`},preview:{disabledProjectRoot:`Preview selection is unavailable for project root runs.`,disabledBuildCapable:`Preview selection is only available for build-capable ticket runs.`,disabledPlanMode:`Preview selection is unavailable while this ticket is in Plan mode.`,followUpBundlePlaceholder:`Follow up on this bundle`,followUpTicketPlaceholder:`Follow up on this ticket`},errors:{runBlockedByActive:`Stop the currently running ticket before starting another run.`,moveTicket:`Unable to move the ticket right now.`,createBundleWithoutProject:`Cannot create a bundle without an active project.`,missingBundleReviewTicket:`Requested ticket was not returned from the bundle review response.`,parkTicket:`Unable to park the ticket right now.`,returnTicket:`Unable to return the ticket right now.`,moveBundleToDone:`Unable to move the bundle to Done right now.`,restoreBundle:`Unable to restore the bundle right now.`,deleteBundleTickets:`Unable to delete the bundle tickets right now.`,generateTickets:`Unable to generate tickets right now.`,deleteTicket:`Unable to delete the ticket right now.`,undoTicket:`Unable to undo the ticket right now.`,retryTicket:`Unable to retry the ticket right now.`,startRun:`Unable to start the run right now.`,openIde:`Unable to open the IDE right now.`,sendFollowUp:`Unable to send the follow-up prompt right now.`,buildBundle:`Unable to build the bundle right now.`,reviewBundle:`Unable to review the bundle right now.`,continueBundleReview:`Unable to continue the bundle review right now.`,undoBundleReview:`Unable to undo the bundle review right now.`,moveBundle:`Unable to move the bundle right now.`,startBuildChain:`Unable to start the build chain right now.`,stopBuildChain:`Unable to stop the build chain right now.`,emptyDone:`Unable to empty Done right now.`},toasts:{deleteDonePartial_one:`Deleted {{deletedCount}} done ticket, but {{failedCount}} failed.`,deleteDonePartial_other:`Deleted {{deletedCount}} done tickets, but {{failedCount}} failed.`,deleteDoneSuccess_one:`Deleted {{count}} done ticket.`,deleteDoneSuccess_other:`Deleted {{count}} done tickets.`,movedBundleToDonePartial:`Moved {{movedCount}} of {{totalCount}} bundle tickets to Done.`,restoredBundlePartial:`Restored {{restoredCount}} of {{totalCount}} bundle tickets.`,deletedBundleTicketsPartial:`Deleted {{deletedCount}} of {{totalCount}} bundle tickets.`,planningAgentCardsCreated_one:`{{count}} card created`,planningAgentCardsCreated_other:`{{count}} cards created`},doneColumn:{emptyAction:`Empty`},changes:{reviewPromptDisabledReason:`Wait for all bundle tickets to finish building before sending a follow-up prompt.`,modifyChangesDisabledReason:`Wait for all bundle tickets to finish building before modifying changes.`,targetUnavailableReason:`This workspace target is no longer available.`}},projectPreviewPane:{presets:{responsive:`Responsive`,phone:`Phone`,tablet:`Tablet`,laptop:`Laptop`},selection:{unavailableBuildCapable:`Preview selection is only available for build-capable ticket runs.`,waitForLoad:`Wait for the preview to finish loading first.`,enableMode:`Enable selection mode`,disableMode:`Disable selection mode`},targetSummary:{element:`Element`,unknownElement:`Unknown element`},iframeTitle:`Project preview`,pendingComments:{triggerLabel:`Pending comments`,title:`Pending comments`,description:`Review preview comments before sending them back to the agent.`,empty:`No preview comments queued yet.`,clearAll:`Clear all`,sending:`Sending...`,sendFixes:`Send fixes ({{count}})`,deleteAriaLabel:`Delete pending comment for {{elementLabel}}`},prompt:{bundlePlaceholder:`Follow up on this bundle`,ticketPlaceholder:`Follow up on this ticket`,defaultPlaceholder:`Describe what Archon should do next.`,toggleAriaLabel:`Toggle preview prompt`,button:`Prompt`,sent:`Prompt sent.`,sendError:`Unable to send the preview prompt right now.`},commentComposer:{editTitle:`Edit preview comment`,addTitle:`Add preview comment`,closeAriaLabel:`Close preview comment composer`,commentAriaLabel:`Preview comment`,placeholder:`Describe the change you want here.`,cancel:`Cancel`,save:`Save comment`,add:`Add comment`},toasts:{fixesSubmitted:`Fixes submitted.`,fixesError:`Unable to submit the preview review right now.`},states:{loadingTitle:`Loading preview`,loadingDescription:`Archon is loading the current preview state for this project.`,readyMissingUrlTitle:`Preview error`,readyMissingUrlDescription:`Archon did not provide a preview URL for the active run.`,detectingTitle:`Detecting preview`,detectingDescription:`Waiting for the preview service to report a browser URL.`,unsupportedTitle:`Preview unavailable`,unsupportedDescription:`This run cannot be embedded as an in-app preview.`,sandboxPublicationUnsupportedTitle:`Sandbox preview unavailable`,sandboxPublicationUnsupportedDescription:`This Docker Sandbox release cannot safely publish and independently revoke preview ports. Stopping the service affects the whole sandbox environment.`,errorTitle:`Preview error`,errorDescription:`Archon could not load the current preview target.`,idleTitle:`Preview idle`,idleDescription:`Start a run to load the in-app preview.`},toolbar:{viewportPresetAriaLabel:`Preview viewport preset`,reloadAriaLabel:`Reload preview`,reloadTooltip:`Reload`,openNewTabAriaLabel:`Open preview in new tab`,openNewTabTooltip:`Open in new tab`,toggleSelectionAriaLabel:`Toggle preview selection mode`,stopRunAriaLabel:`Stop preview run`,stopSandboxAriaLabel:`Stop the entire sandbox environment`,stopping:`Stopping...`,stop:`Stop`,stopSandbox:`Stop sandbox`,collapseAriaLabel:`Collapse preview`,collapseTooltip:`Collapse`,expandAriaLabel:`Expand preview`,expandTooltip:`Expand`,closeAriaLabel:`Close preview`,closeTooltip:`Close`}},mobileApp:{agentSettings:{loading:`Wait for the active agent model catalog to finish loading.`},agentSelector:{ariaLabel:`Choose active agent`,sessionLocked:`This existing session keeps its saved {{agent}} agent and model.`},approvals:{title:`Pending approvals`,count:`{{count}} exact action awaiting a decision`,count_other:`{{count}} exact actions awaiting a decision`,action:{git_push:`Force push`,custom_check:`Production custom check`},impact:{git_push:`This replaces remote branch history with the captured local commit.`,custom_check:`This command may change an external production system.`},expires:`Expires {{value}}`,loadingDetail:`Loading approval evidence...`,detailError:`Unable to load this approval request.`,none:`None`,history:`Approval history ({{count}})`,fields:{action:`Action`,target:`Target`,command:`Command`,cwd:`Working directory`,branch:`Branch`,head:`Local commit`,remoteHead:`Remote commit`,profile:`Execution profile`,launcher:`Launcher`,environment:`Batch environment`,placement:`Attempt placement`,authority:`Effective capabilities`,degradations:`Capability degradation`,secrets:`Logical secret references`,expires:`Expires`},values:{noHostEnvironment:`None; this action runs on the host`,hostPlacement:`This machine (host)`,sandboxPlacement:`Docker Sandbox · {{id}}`,sandboxPlacementUnavailable:`Docker Sandbox placement unavailable`,launcher:{host_shell:`Host shell`,docker_sandbox_exec:`Docker Sandbox exec`}},status:{pending:`Awaiting approval`,approved:`Approved`,denied:`Denied`,cancelled:`Cancelled`,expired:`Expired`,invalidated:`Invalidated`,consumed:`Executing or completed`},reason:`Decision note (optional)`,approve:`Approve exact action`,deny:`Deny`,cancel:`Cancel request`,loadError:`Unable to load pending approvals.`,decisionError:`Unable to update this approval request.`,remediation:{approved:`Approved. The server will revalidate the exact action before execution.`,denied:`Denied. Return to the originating action to request a different operation.`,cancelled:`Cancelled. Return to the originating action to create a new request.`,expired:`Expired. Return to the originating action to capture current evidence.`,invalidated:`The target or authority changed. Request approval for the current exact action.`,consumed:`Approval was consumed. Check lifecycle evidence for the final or ambiguous outcome.`,pending:`This request still needs a decision.`}},navigation:{overview:`Overview`,tickets:`Tickets`,chats:`Chats`,spec:`Spec`},overviewActions:{ticketsAriaLabel:`Go to tickets section`,chatsAriaLabel:`Go to chats section`,specAriaLabel:`Go to spec section`},chatDetail:{interrupt:`Interrupt`,interrupting:`Interrupting...`,resume:`Resume`,resuming:`Resuming...`,resumeError:`Unable to resume the chat response.`},specList:{title:`Specs`,loading:`Loading specs...`,emptyTitle:`No specs`,emptyDescription:`Start a new spec to plan a feature from this project.`,newSpec:`New spec`,startSpec:`Start a spec`,listError:`Specs unavailable`,retry:`Retry specs`},specDetail:{newSpecTitle:`New spec`,loadingTitle:`Loading spec`,loading:`Loading spec transcript...`,unavailableTitle:`Spec unavailable`,back:`Back to specs`,retry:`Retry spec`,composerPlaceholder:`Describe the feature you want to plan...`,composerPlaceholderDraft:`Describe the feature, architecture, or changes you want to spec out.`,emptyMessages:`No messages yet.`,emptyDraft:`Start a new spec from this phone.`,interrupt:`Interrupt`,interrupting:`Interrupting...`,resume:`Resume`,resuming:`Resuming...`,listError:`Unable to load spec sessions.`,detailError:`Unable to load spec transcript.`,sendError:`Unable to send the spec prompt.`,stopError:`Unable to stop the spec response.`,resumeError:`Unable to resume the spec response.`,modeError:`Unable to update the spec mode right now.`,targetMismatch:`This Spec targets {{sessionTarget}}, but {{currentTarget}} is selected.`,targetUnavailable:`This Spec target is unavailable.`,targetLoading:`Checking the current project branch before this Spec can continue...`,targetLoadError:`Unable to verify the current project branch. {{error}}`,targetRefreshError:`Unable to verify the current project target. {{error}}`,retryTarget:`Retry branch check`,switchBack:`Switch back to {{target}}`,switchingBack:`Switching target...`,updateTargetError:`Unable to update the project target right now.`}},chatView:{tool:{claude:`Claude`,opencode:`OpenCode`},mode:{plan:`Plan`,build:`Build`},startBuilding:{label:`Start building`,ariaLabel:`Start building this plan`},placeholders:{plan:`Ask Archon to scope, sequence, or reason through project work`,build:`Ask Archon to build, change, or verify something in this project`},shortcuts:{modifierMac:`CMD`,modifierDefault:`CTRL`,startNewSession:`Start new session`,switchToPlan:`Switch to Plan`,switchToBuild:`Switch to Build`},user:{you:`You`},targets:{bundleFallback:`Bundle target`,repoRoot:`Repo root`,repoRootWithBranch:`Repo root ({{branch}})`,currentTarget:`current target`,selectedBundleTarget:`selected bundle target`},pendingMemorySuggestions_one:`{{count}} pending memory suggestion`,pendingMemorySuggestions_other:`{{count}} pending memory suggestions`,deleteSessionModal:{title:`Delete chat session`,bulkTitle:`Delete chat sessions`,description:`This permanently removes the transcript history for this chat session.`,bulkDescription_one:`This permanently removes the transcript history for {{count}} chat session.`,bulkDescription_other:`This permanently removes the transcript history for {{count}} chat sessions.`,cancel:`Cancel`,deleting:`Deleting...`,delete:`Delete`},sidebar:{ariaLabel:`Chat sessions sidebar`,newSession:`New session`,select:`Select`,cancelSelection:`Cancel`,addPreset:`Preset`,selectedCount_one:`{{count}} selected`,selectedCount_other:`{{count}} selected`,deleteSelected:`Delete selected`,collapseAriaLabel:`Collapse sessions panel`,openAriaLabel:`Open sessions panel`,loadingSessions:`Loading chat sessions...`,noSessions:`No chat sessions yet.`,deleteDisabledReason:`Wait for the current chat response to finish before deleting this session.`,running:`Running`,interrupted:`Interrupted`,finished:`Finished`,targetUnavailable:`Target unavailable`,deleteSessionAriaLabel:`Delete chat session`,deleteSessionTitle:`Delete {{title}}`,selectSessionAriaLabel:`Select {{title}}`,selectSessionTitle:`Select {{title}}`,presets:{unavailable:`Unavailable`,older:`Older`}},toasts:{deleteSelectedPartial_one:`Deleted {{deletedCount}} chat session, but {{failedCount}} failed.`,deleteSelectedPartial_other:`Deleted {{deletedCount}} chat sessions, but {{failedCount}} failed.`,deleteSelectedSuccess_one:`Deleted {{count}} chat session.`,deleteSelectedSuccess_other:`Deleted {{count}} chat sessions.`},ticketProposal:{createdTitle:`Tickets created`,createdDescription_one:`Created {{count}} ticket from this proposal.`,createdDescription_other:`Created {{count}} tickets from this proposal.`,proposedTitle:`Proposed tickets`,proposedDescription:`Review these tickets before adding them to the board.`,dependenciesLabel:`Dependencies: {{value}}`,creating:`Creating tickets...`,create:`Create tickets`,createdFromChat_one:`Created {{count}} ticket from chat.`,createdFromChat_other:`Created {{count}} tickets from chat.`},errors:{loadSessions:`Unable to load chat sessions right now.`,loadSession:`Unable to load the chat session right now.`,loadMemorySuggestions:`Unable to load chat memory suggestions right now.`,restoreTarget:`Unable to restore the chat target right now.`,updateMode:`Unable to update the chat mode right now.`,interruptResponse:`Unable to interrupt the chat response right now.`,resumeResponse:`Unable to resume the chat response right now.`,deleteSession:`Unable to delete the chat session right now.`,uploadAttachments:`Unable to upload images right now.`,removeAttachment:`Unable to remove the image right now.`,sendPrompt:`Unable to send the chat prompt right now.`,createTickets:`Unable to create tickets from the chat proposal right now.`,resolveQuestions:`Unable to resolve the plan questions right now.`},composer:{newChatTitle:`New chat`,chatTitle:`Chat`,loadingMemory:`Loading memory...`,memorySuggestions:`Memory suggestions`,switchBack:`Switch back`,noSessionSelectedTitle:`No session selected`,noSessionSelectedDescription:`Select a chat session to restore its saved target, or start a new session on the current target.`,startNewSession:`Start new session`,loadingSession:`Loading chat session...`,openDiff:`Open diff`,resizeDiffPanel:`Resize diff panel`,diff:`Diff`,memorySuggestionsTitle:`Memory suggestions`,memorySuggestionsDescription:`Review pending suggestions from this chat before saving them into project memory.`,memorySuggestionsEmpty:`No pending memory suggestions for this chat session.`,closeMemorySuggestions:`Close memory suggestions`},review:{missingTarget:`Open or create a chat session to send review comments.`,unavailableTarget:`Target unavailable for this chat session.`,restoreTargetFallback:`Restore the session target to continue.`,waitTurn:`Wait for the current chat turn to finish before sending review comments.`,waitUpload:`Wait for the current image upload to finish before sending this turn.`,waitPrompt:`Wait for the current chat prompt to finish sending before submitting review comments.`,waitTurnShort:`Wait for the current chat turn to finish.`,mismatchReason:`This session targets {{sessionTarget}}, but the current target is {{currentTarget}}. Restore the session target to continue.`,interrupting:`Interrupting...`,interrupt:`Interrupt`,resuming:`Resuming...`,resume:`Resume`}},specView:{errors:{loadSessions:`Unable to load spec sessions right now.`,loadSession:`Unable to load the spec session right now.`,loadMemorySuggestions:`Unable to load spec memory suggestions right now.`,stopSession:`Unable to interrupt the spec response right now.`,resumeSession:`Unable to resume the spec response right now.`,deleteSession:`Unable to delete the spec session right now.`,sendPrompt:`Unable to send the spec prompt right now.`,upload:`Unable to upload images right now.`,removeAttachment:`Unable to remove the image right now.`,initialSessionMissing:`Spec no longer exists.`,resolveQuestions:`Unable to resolve the plan questions right now.`,restoreTarget:`Unable to restore the spec target right now.`},targets:{mismatchReason:`This Spec targets {{sessionTarget}}, but the current target is {{currentTarget}}. Restore the Spec target to continue.`,unavailable:`Target unavailable for this Spec.`,switchBack:`Switch back`,switchingBack:`Switching...`},importNotice:{title:`Import notice`,importedOnly:`Imported {{importedCount}} image(s).`,importedWithSkips:`Imported {{importedCount}} image(s). Skipped {{skippedCount}} reference(s): {{skippedSummary}}.`,skippedOnly:`Skipped {{skippedCount}} reference(s): {{skippedSummary}}.`,skipReasons:{third_party_url:`{{count}} third-party URL(s)`,download_failed:`{{count}} failed download(s)`,permission_denied:`{{count}} permission error(s)`,unsupported_type:`{{count}} unsupported image(s)`,non_image_content:`{{count}} non-image file(s)`,oversize:`{{count}} oversized image(s)`,over_limit:`{{count}} over the 4-image limit`}},composer:{placeholderSpec:`Describe the feature you want to plan...`,describeFeature:`Describe the feature, architecture, or changes you want to spec out.`,loadingMemory:`Loading memory...`,memorySuggestions:`Memory suggestions`,memorySuggestionsTitle:`Memory suggestions`,memorySuggestionsDescription:`Review pending suggestions from this spec before saving them into project memory.`,memorySuggestionsEmpty:`No pending memory suggestions for this spec session.`,closeMemorySuggestions:`Close memory suggestions`,waitTurn:`Wait for the current spec turn to finish.`,waitUpload:`Wait for the current image upload to finish.`,waitGrill:`Answer the question above to continue.`,stop:`Stop`,interrupt:`Interrupt`,interrupting:`Interrupting...`,resume:`Resume`,resuming:`Resuming...`,noSessionSelectedTitle:`No spec session selected`,noSessionSelectedDescription:`Select a spec session or start a new one to plan features.`,startNewSession:`Start new spec`,loadingSession:`Loading spec session...`,newSpecTitle:`New spec`,specTitle:`Spec`},pendingMemorySuggestions_one:`{{count}} pending memory suggestion`,pendingMemorySuggestions_other:`{{count}} pending memory suggestions`,sidebar:{ariaLabel:`Spec sessions sidebar`,newSession:`New spec`,select:`Select`,cancelSelection:`Cancel`,addPreset:`Preset`,deleteSelected:`Delete selected`,collapseAriaLabel:`Collapse sessions panel`,openAriaLabel:`Open sessions panel`,loadingSessions:`Loading spec sessions...`,noSessions:`No spec sessions yet.`,deleteSessionAriaLabel:`Delete spec session`,deleteSessionTitle:`Delete {{title}}`,selectSessionAriaLabel:`Select {{title}}`,selectSessionTitle:`Select {{title}}`,presets:{unavailable:`Unavailable`,older:`Older`},cannotDeleteRunning:`Wait for the current spec response to finish before deleting this session.`,newSessionTooltip:`Start a new spec session`,interrupted:`Interrupted`,linkedImplementationsTooltip:`{{ticketCount}} ticket(s), {{chatCount}} chat session(s) from this spec`,linkedImplementationsAriaLabel:`{{itemCount}} linked implementation(s)`,linkedImplementationsTooltipHistorical:`Work was performed from this spec`,linkedImplementationsAriaLabelHistorical:`Work was performed from this spec`},deleteModal:{title:`Delete spec session`,bulkTitle:`Delete spec sessions`,description:`This permanently removes the transcript history for this spec session.`,bulkDescription_one:`This permanently removes transcript history for the selected spec session.`,bulkDescription_other:`This permanently removes transcript history for {{count}} spec sessions.`,delete:`Delete`,cancel:`Cancel`,deleting:`Deleting...`},toasts:{deleteSelectedSuccess_one:`Deleted {{count}} spec session.`,deleteSelectedSuccess_other:`Deleted {{count}} spec sessions.`,importPreparing:`Importing issue and downloading images...`,importSuccess:`Issue imported.`,importPartialSuccess:`Issue imported with some images skipped.`,importError:`Unable to import the issue right now.`},artifactPanel:{title:`Spec Artifact`,open:`Open artifacts`,resize:`Resize artifact panel`,close:`Close artifact panel`,summary:`Summary`,visualization:`Visualization`,likelyFiles:`Likely Files`,newFile:`New file`,fileRelationGraph:`File relationships`,repositoryEvidence:{captureLabel:`Capture state`,freshnessLabel:`Captured scan freshness`,capture:{complete:`Complete`,stale:`Stale at capture`,truncated:`Truncated`,unavailable:`Unavailable`},freshness:{fresh:`Current`,stale:`Not current`,unavailable:`Unavailable`},origin:{planner:`Planner`,graph:`Repository graph`,both:`Planner + graph`},class:{deterministic:`Deterministic`,structural_heuristic:`Structural heuristic`,historical_heuristic:`Historical heuristic`},affectedTests:`Affected tests`,affectedTest:`Affected test`,impactHeading:`Repository impact`,impactDescription:`Repository-derived signals are advisory and are not planned edits.`,impactFiles_one:`{{count}} possible file signal`,impactFiles_other:`{{count}} possible file signals`,impactTests_one:`{{count}} possible test signal`,impactTests_other:`{{count}} possible test signals`,impactNone:`No candidates captured`,potentiallyAffectedFiles:`Potentially affected files`,showChains_one:`Show evidence chain`,showChains_other:`Show {{count}} evidence chains`,chainLabel:`Chain {{number}}`,chainSummary_one:`{{seed}} reaches {{candidate}} through {{count}} repository relation.`,chainSummary_other:`{{seed}} reaches {{candidate}} through {{count}} repository relations.`,truncatedNotice:`This capture reached a repository evidence limit, so additional candidates or chains may exist.`,historicalNotice:`Historical heuristic evidence reflects prior co-change patterns and is not a current deterministic relationship.`,impactFallback:`The repository graph projection did not capture any candidates for this snapshot.`,diagramDescription:`Planner-generated relationships between the files in this plan.`},proposedTickets:`Proposed Tickets`,bundleGroups:`Bundle Groups`,proposedTicketCount_one:`{{count}} proposed ticket`,proposedTicketCount_other:`{{count}} proposed tickets`,dependencies:`Dependencies`,openQuestions:`Open Questions`,assumptions:`Assumptions`,noSnapshot:`Run a spec turn to generate an artifact.`,noDiagram:`No diagram available for this spec.`,mermaidParseError:`Unable to render this Mermaid graph; showing raw text instead.`,uiMockup:`UI Mockup`,noMockup:`No UI mockup available for this spec.`,loading:`Loading artifact...`},actions:{createTickets:`Create tickets`,ticketsCreated:`Tickets created`,creatingTickets:`Creating tickets...`,implementInChat:`Implement in Chat`,implementInChatMultiBundleUnavailable:`Multi-bundle Specs must be materialized through Create tickets before implementation.`,startingImplementation:`Starting implementation...`,exportSpec:`Export to docs/plans`,exportingSpec:`Exporting...`,createTicketsSuccess:`Created {{count}} ticket(s) from this spec.`,exportSuccess:`Exported spec to docs/plans.`,exportConflictTitle:`Export already exists`,exportConflictDescription:`A spec has already been exported to {{path}}. Do you want to overwrite the existing file?`,exportConflictConfirm:`Overwrite`,exportConflictCancel:`Cancel`},provenance:{viewSourceSpec:`View source spec`},grill:{toggleTooltip:`Grill mode: pressure-test the plan one focused question at a time before writing the spec. Toggle off to skip remaining questions and write it now.`,toggleAriaLabelOn:`Turn Grill mode off (currently on)`,toggleAriaLabelOff:`Turn Grill mode on`,rationaleLabel:`Why`,suggestionsLabel:`Suggested answers`,recommendedSuggestionLabel:`Recommended`,answerPlaceholder:`Type your answer, or pick a suggestion above to fill this field...`,submitLabel:`Submit answer`,submittingLabel:`Submitting...`,finalizePrompt:`Grilling ended. Write the complete concrete plan now using everything we discussed.`,finalizeError:`Unable to finalize grilling right now.`,updateModeError:`Unable to change Grill mode right now.`,activeDisabledReason:`Wait for the current spec turn to finish before toggling Grill.`},review:{heading:`Review`,launch:`Review spec`,launchAction:`Review spec`,stop:`Stop review`,running:`Running...`,loading:`Loading review...`,noFindings:`No issues found.`,stoppedExplanation:`The review was stopped before it completed.`,errorExplanation:`The review could not be completed because the agent encountered an error.`,parseFailedExplanation:`The review completed, but its findings could not be parsed.`,why:`Why`,suggestion:`Suggestion`,sendToPlanner:`Send to planner`,sendingToPlanner:`Building revision draft...`,popoverTitle:`Spec review`,model:`Model`,variant:`Thinking level`,findingsCount_one:`{{count}} finding`,findingsCount_other:`{{count}} findings`,severity:{high:`high`,medium:`medium`,low:`low`},status:{running:`Running`,completed:`Completed`,parse_failed:`Parse failed`,stopped:`Stopped`,error:`Error`}}},conversationPane:{agentActivityAriaLabel:`Agent activity indicator`,agentWorkingSrText:`Agent is working`,agentError:`Agent error`,statusWorking:`Working...`,liveElapsedAriaLabel:`Approximate elapsed response time: {{duration}}`,statusInterrupted:`Interrupted`,loadingConversation:`Loading conversation...`,noMessagesYet:`No messages yet.`,attachmentPreviewAlt:`Attached image: {{name}}`,showThinkingAriaLabel:`Show thinking`,showThinkingLabel:`Show thinking`,sectionAriaLabel:`Ticket conversation`,contentAriaLabel:`Ticket conversation content`,scrollToLatestAriaLabel:`Scroll to latest message`,changesCommentBadge:`Changes comment`},questionSet:{eyebrow:`Plan clarification`,progress:`Question {{current}} of {{total}}`,questionsAriaLabel:`Questions`,rationaleLabel:`Why`,suggestionsLabel:`Suggested answers`,recommended:`Recommended`,answerLabel:`Your answer`,answerPlaceholder:`Type your answer, or choose a suggestion above...`,dismissOne:`Dismiss this question`,dismissAll:`Dismiss all questions`,saveContinue:`Save and continue`,submitting:`Submitting...`,waitForResolution:`Resolve the plan questions above to continue.`,historicalAnswer:`Answer`,historicalDismissed:`Dismissed`,status:{answered:`Answered`,dismissed:`Dismissed`,current:`Current`,unanswered:`Unanswered`},historicalStatus:{pending:`Awaiting resolution`,resolved:`Resolved`,dismissed:`Dismissed`,superseded:`Superseded`}},multiAgentTranscript:{tabAriaLabel:`Agent run tabs`,mainAgent:`Main agent`,noContent:`No transcript content was captured.`,waitingForOutput:`Waiting for subagent output...`,responseTruncated:`Response transcript truncated after 100 KB.`,thinkingTruncated:`Thinking transcript truncated after 100 KB.`,status:{running:`Running`,done:`Done`,error:`Error`,stopped:`Stopped`}},promptComposer:{followUpPromptAriaLabel:`Follow-up prompt`,sendingPromptAriaLabel:`Sending prompt`,sendPromptAriaLabel:`Send prompt`,attachImageAriaLabel:`Attach images`,uploadingImageAriaLabel:`Uploading images`,removeAttachmentAriaLabel:`Remove {{name}}`,attachmentPreviewAlt:`Selected image: {{name}}`,dropImagePrompt:`Drop images to attach`,dropImageAriaLabel:`Drop image files to attach them`},attachmentPreviewDialog:{title:`Image preview: {{name}}`,description:`Preview the attached image {{name}}.`,imageAlt:`Preview image: {{name}}`,previewImageAriaLabel:`Preview image: {{name}}`,openInNewTab:`Open in new tab`,closeAriaLabel:`Close image preview`},mermaidPreviewDialog:{title:`Diagram Preview`,description:`Preview the spec diagram in full screen.`,controlsAriaLabel:`Diagram controls`,canvasAriaLabel:`Diagram canvas. Drag with the mouse to pan.`,zoomInAriaLabel:`Zoom in`,zoomOutAriaLabel:`Zoom out`,resetViewAriaLabel:`Reset view`,zoomLevel:`{{zoom}}%`,zoomLevelAriaLabel:`Zoom level: {{zoom}}%`,closeAriaLabel:`Close diagram preview`,clickToExpand:`Click to expand diagram`},mockupPreviewDialog:{title:`UI Mockup Preview`,description:`Preview the UI mockup in full screen.`,closeAriaLabel:`Close UI mockup preview`,clickToExpand:`Click to expand UI mockup`},workspaceControls:{files:`Files`,changes:`Changes`,tests:`Tests`,checks:`Checks`,verification:`Verification`,graph:`Graph`,openIde:`Open IDE`,terminal:`Terminal`,chat:`Chat`,close:`Close`,openTerminalAriaLabel:`Open terminal`,hideTerminalAriaLabel:`Hide terminal`,terminalTitle:`Terminal`,ticketMetadataAriaLabel:`Ticket metadata`,githubActions:`Actions`,openGitHubActionsAriaLabel:`Open GitHub Actions`},projectHeader:{agent:{triggerAriaLabel:`Choose active agent`,menuAriaLabel:`Open active agent menu`,openCode:`OpenCode`,claude:`Claude`},runtime:{activityLabel:`Activity`,triggerLabel:`Tools`,triggerAriaLabel:`Open runtime tools`,githubActionsRunning:`Actions`,toolUpdateRunning:`Tool update running`,openGitHubActions:`Open GitHub Actions`,openActivity:`Open Activity`,openMobileAccess:`Open mobile access`,mobileLabel:`Mobile`,githubStatusIdle:`Idle`,githubStatusRunning:`Running`,mobileDisabled:`Mobile disabled`,mobileReadyToPair:`Mobile ready to pair`,mobileConnected:`Mobile connected`,mobilePairingExpired:`Mobile pairing expired`,mobileUnavailable:`Mobile unavailable`,openExecutionRuntimes:`Open execution runtimes`}},executionRuntimes:{title:`Execution runtimes`,description:`Check whether optional execution environments can operate on this machine.`,closeAriaLabel:`Close execution runtimes`,provider:`Optional runtime`,dockerSandbox:`Docker Sandbox`,loading:`Checking this machine...`,errorMessage:`Unable to check Docker Sandbox readiness right now.`,guidance:`Opening or rechecking these diagnostics only reads readiness and does not start services. Install and configure Docker Sandboxes using the official Docker instructions, then recheck this machine.`,productionNotice:`Docker Sandbox Build execution is opt-in and fails closed when the exact target, agent, or model is not ready.`,openGuide:`Open setup guide`,recheck:`Recheck`,rechecking:`Rechecking...`,version:`sbx {{version}}`,versionUnknown:`Version unknown`,releaseStatus:{recommended:`Recommended`,deprecated:`Deprecated`,unsupported:`Not qualified`,security_blocked:`Security blocked`},deprecatedReleaseNotice:`This release remains qualified during the upgrade window. Upgrade to the recommended sbx {{version}} release.`,securityBlockedReleaseNotice:`This release is blocked due to a security issue. Install the recommended sbx {{version}} release before using Docker Sandbox execution.`,unavailableSummary:`The remaining checks were skipped because sbx is unavailable.`,state:{loading:`Loading runtime readiness.`,unsupported:`This platform or sbx version is unsupported.`,setupRequired:`Setup is required before validation can run.`,eligible:`Available to activate when validation needs it.`,degraded:`Readiness is degraded because some evidence is unknown.`,ready:`This machine is ready for Docker Sandbox validation.`,error:`Readiness could not be checked.`},observationState:{ready:`Ready`,not_ready:`Setup required`,unknown:`Unknown`,deferred:`Deferred`,unsupported:`Unsupported`},deferredSummary:{opencode_template:`Validate OpenCode support per project target in execution settings.`,claude_template:`Validate Claude support per project target in execution settings.`},checks:{cli:`CLI`,version:`Supported version`,platform:`Platform`,virtualization:`Virtualization`,daemon:`Docker Sandbox daemon`,docker_login:`Docker account`,network_policy:`Network policy`,opencode_template:`OpenCode built-in agent`,claude_template:`Claude built-in agent`},checkDescription:{cli:`Checks whether the qualified sbx command is available.`,version:`Checks the installed sbx version against the approved command contract.`,platform:`Checks operating system and architecture support.`,virtualization:`Checks whether required virtualization support is available.`,daemon:`Checks whether the Docker Sandbox daemon can respond.`,docker_login:`Classifies Docker account readiness without displaying account or credential values.`,network_policy:`Checks whether sandbox network policy is initialized.`,opencode_template:`Checks built-in OpenCode template support.`,claude_template:`Checks built-in Claude template support.`},checkRemediation:`Follow the official setup guide, resolve this requirement, then recheck.`,virtualizationRemediation:{not_ready:`Resolve the host virtualization requirement in the official Docker Sandboxes guide, then recheck.`,unknown:`Review host virtualization diagnostics in the official Docker Sandboxes guide, then recheck.`,unsupported:`Use Linux x64 or macOS Sonoma 14+ on Apple silicon for Docker Sandboxes.`}},ticketModal:{loadingDiff:`Loading diff...`,planningChatAriaLabel:`Planning chat`,planningChatTitle:`Planning Chat`,closePlanningChatAriaLabel:`Close planning chat`,planningOpenQuestions_one:`{{count}} open question`,planningOpenQuestions_other:`{{count}} open questions`,planningFollowUpPlaceholder:`Ask the agent to refine this plan`,followUpPlanPlaceholder:`Ask a question about this implementation`,ticketChatAriaLabel:`Ticket chat`,ticketChatTitle:`Ticket Chat`,closeTicketChatAriaLabel:`Close ticket chat`,planningFailedPrefix:`Planning failed: `,openQuestionsBadge:`Open questions`,resolveQuestionsError:`Unable to resolve the plan questions right now.`,ticketTerminalAriaLabel:`Ticket terminal`,discardUnsavedTitle:`Discard unsaved edits?`,discardUnsavedDescription:`Any changes made will be lost.`,discardUnsavedConfirm:`Discard`,discardUnsavedCancel:`Keep editing`},ticketPlanDetails:{title:`Details`,ariaLabel:`Ticket details`,triggerAriaLabel:`Toggle ticket details`,closeAriaLabel:`Close details`,editTicket:`Edit ticket`,aiSettings:`AI settings`,aiSettingsAriaLabel:`AI settings`,attentionAriaLabel:`Attention required`,openPlanningChat:`Open planning chat`,viewBlockers:`View blockers`,unfinishedBlockers_one:`{{count}} unfinished blocker`,unfinishedBlockers_other:`{{count}} unfinished blockers`,targetSection:`Target`,dependenciesSection:`Dependencies`,defaultModel:`Default model`,defaultVariant:`Default variant`,usingDefaults:`Using defaults`,skillCount_one:`{{count}} skill`,skillCount_other:`{{count}} skills`},modelSelector:{dockerSandboxNotice:`Docker Sandbox only shows models from providers verified for the selected target.`,openExecutionSettings:`Verify providers in execution settings`},ticketChangesModal:{pushBranch:`Push branch`,pushing:`Pushing...`,morePushActions:`More push actions`,forcePushWithLease:`Force push with lease`,forcePushing:`Force pushing...`,loadingPullRequest:`Loading PR...`,checkingPullRequest:`Checking PR...`,createPullRequest:`Create PR`,createPullRequestTitle:`Create pull request`,createPullRequestFallbackError:`Unable to create the pull request right now.`,pullRequestCreated:`Pull request created.`,pullRequestFieldTitle:`Title`,pullRequestFieldBaseBranch:`Base branch`,pullRequestFieldDescription:`Description`,pullRequestTitlePlaceholder:`Pull request title`,pullRequestBaseBranchDescription:`Optional. Leave blank to use the repository default branch.`,pullRequestBaseBranchPlaceholder:`main`,pullRequestDescriptionPlaceholder:`Summarize the changes for reviewers.`,creatingPullRequest:`Creating PR...`,creating:`Creating...`,generatingDescription:`Generating...`,generateDescription:`Generate`,branchUnavailable:`Branch information is not available right now.`,branchPushed:`Branch pushed.`,pushCompleted:`Push completed.`,branchForcePushed:`Branch force-pushed.`,forcePushCompleted:`Force push completed.`,forcePushApprovalRequired:`Force push is waiting for approval.`,openForcePushApproval:`Open Activity detail`,pushFallbackError:`Unable to push the branch right now.`,forcePushFallbackError:`Unable to force-push the branch right now.`,viewSourceSpec:`View source spec`,switchToPlan:`Switch to Plan`,switchToBuild:`Switch to Build`,committedDiffFallbackError:`Unable to load committed changes right now.`,committedSelectionUnavailable:`That local commit is no longer available. Returned to Uncommitted changes.`,committedDiffEmpty:`No committed changes to show.`,committedFiles:`Committed files`,committedFilesDescription:`Review the selected committed changes.`,allListedCommits:`All listed commits`,viewingCommittedSource:`Viewing: {{source}}`,committedReadOnly:`This committed diff is read-only.`,squashCompleted:`Local commits squashed.`,squashFallbackError:`Unable to squash local commits right now.`},bundleDetailsModal:{bundleTerminalAriaLabel:`Bundle terminal`,rename:`Rename`,renameFieldLabel:`Bundle name`,renameDescription:`The branch name will be regenerated before the branch and worktree are created.`,saveName:`Save name`,savingName:`Saving...`,cancelRename:`Cancel`,renameFallbackError:`Unable to rename the bundle right now.`,renameUnavailable:`Rename availability could not be verified. Refresh the bundle and try again.`,renameProjectContextUnavailable:`Select a project before renaming this bundle.`,continueReview:`Continue review`,rerunReview:`Re-run review`,reviewBundle:`Review Bundle`,agentSettingsFor:`Agent settings for {{title}}`,agentSettingsLocked:`Locked for the active Build`,agentSettingsSaveError:`Unable to update this ticket’s agent settings.`,waitForAgentSettings:`Wait for all ticket agent settings to finish saving before building the bundle.`,renameReasons:{project_root:`Project root bundles cannot be renamed.`,tickets_not_plan:`Rename is unavailable because one or more bundle tickets have left Plan.`,agent_running:`Rename is unavailable while an agent is running for this bundle.`,branch_exists:`Rename is unavailable because this bundle branch already exists.`,worktree_exists:`Rename is unavailable because this bundle already has a worktree.`}},projectFooter:{detachedHead:`Detached HEAD`,unknownBranch:`Unknown branch`,branchActions:`Branch actions`,currentTargetActions:`Current target actions`,pull:`Pull`,pulling:`Pulling...`,sync:`Sync`,syncing:`Syncing...`,rebase:`Rebase`,rebaseOnto:`Rebase onto {{branch}}`,rebasing:`Rebasing...`,abortMerge:`Abort merge`,abortRebase:`Abort rebase`,aborting:`Aborting...`,branchSynced:`Project branch synced.`,branchUpdated:`Project branch updated.`,branchRebased:`Branch rebased.`,branchRebasedOnto:`Branch rebased onto {{branch}}.`,gitOperationAborted:`Git operation aborted.`,syncFallbackError:`Unable to sync the current branch right now.`,rebaseFallbackError:`Unable to rebase the current branch right now.`,abortFallbackError:`Unable to abort the current git operation right now.`,run:`Run`,stop:`Stop`,selectProjectFirst:`Select a project first.`,addRunConfig:`Add a Run config in project settings to enable selected-target runs.`,loadingProjectStatus:`Loading project status...`,stopSelectedTargetRun:`Stop the currently running selected-target run before starting another run.`,stopTicketBeforeSelectedTargetRun:`Stop the currently running ticket before starting the selected target run.`},repositoryGraphDialog:{title:`Repository graph`,target:`Target: {{target}}`,repoRootTarget:`Repo root`,repoRootTargetWithBranch:`Repo root / {{branch}}`,bundleTarget:`{{name}} / {{branch}}`,startScan:`Start scan`,refreshScan:`Refresh scan`,cancelScan:`Cancel scan`,retryScan:`Retry scan`,retryLoad:`Try again`,close:`Close`,truncatedScan:`This scan reached one or more analysis limits. Results remain useful but do not represent complete coverage.`,freshnessUnavailable:`The target is currently unavailable. Persisted results remain inspectable, but freshness cannot be verified.`,status:{title:`Status`,loading:`Loading scan status...`,neverScanned:`Never scanned`,unknown:`Scan status unavailable`,queued:`Queued`,running:`Running`,complete:`Complete and current`,completeUnverified:`Complete; freshness unavailable`,stale:`Complete but stale`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`},counts:{files:`Files`,relationships:`Relationships`,diagnostics:`Diagnostics`,analyzer:`Analyzer`},diagnostics:{show:`View diagnostics ({{count}})`,truncated:`Only a bounded diagnostic summary is shown.`},relationships:{title:`Inspect relationships`,description:`Search by file name or repository-relative path, then choose a file to inspect direct incoming or outgoing relationships.`,pathLabel:`Repository path`,pathPlaceholder:`Search files by name or path`,suggestionsLoading:`Loading file paths...`,noSuggestions:`No matching files found.`,direction:`Direction`,directions:{combined:`Both`,incoming:`Incoming`,outgoing:`Outgoing`},unavailable:`Relationship inspection is available after a scan completes.`,loading:`Loading relationships...`,truncated:`The relationship query reached its result limit. The list does not represent complete coverage.`,empty:`No direct relationships were found for this path and direction.`,showEvidence:`Show evidence`,loadingEvidence:`Loading evidence...`,kinds:{imports:`Import relationship with {{path}}`,dynamic_imports:`Dynamic import relationship with {{path}}`,requires:`Require relationship with {{path}}`,re_exports:`Re-export relationship with {{path}}`,config_reference:`Configuration relationship with {{path}}`,package_dependency:`Package dependency relationship with {{path}}`,package_export:`Package export relationship with {{path}}`,package_import:`Package import relationship with {{path}}`,workspace_member:`Workspace membership relationship with {{path}}`,tests:`Test relationship with {{path}}`,co_changes:`Often changes with {{path}}`},explanations:{imports:`Static repository analysis identified an import between these paths.`,dynamic_imports:`Static repository analysis identified a dynamic import between these paths.`,requires:`Static repository analysis identified a CommonJS require between these paths.`,re_exports:`Static repository analysis identified a re-export between these paths.`,config_reference:`A repository configuration file references the related path.`,package_dependency:`A package manifest identifies this package dependency.`,package_export:`A package manifest identifies this exported path.`,package_import:`A package manifest identifies this imported path.`,workspace_member:`Workspace configuration identifies this package membership.`,tests:`Repository structure identifies this test as covering the related path.`,co_changes:`Git history recorded these paths changing together.`},evidenceDetail:{value:`Matched value`,changeCount:`Shared changes`,sampledCommits:`Sample commits`,coverage:`Evidence coverage`,samplesTruncated:`Only a bounded sample of matching commits is shown.`}},evidence:{deterministic:{label:`Deterministic`,description:`Direct static analysis produced this relationship.`},structural_heuristic:{label:`Structural heuristic`,description:`Repository naming or layout suggests this relationship. It is not a required dependency.`},historical_heuristic:{label:`Historical heuristic`,description:`Version-control history suggests this relationship. It is not a required dependency.`}},errors:{status:`Unable to load repository graph status right now.`,operation:`Unable to update the repository graph scan right now.`,pathNotFound:`That path was not found in this scan.`,impact:`Unable to load relationships for that path right now.`,explanation:`Unable to load evidence for this relationship right now.`}},projectTargetSelector:{title:`Project target`,description:`Controls where chats, changes, tests, and project actions run.`,targetLabel:`Target`,repoRoot:`Repo root`,repoRootWithBranch:`Repo root ({{branch}})`,repoRootBranch:`Repo root branch`,activeBundleUnavailable:`Selected bundle unavailable`,loadingTarget:`Loading target...`,loadingTargets:`Loading targets...`,noBundles:`No prepared bundles yet. Manage bundles to prepare another target.`,noSearchResults:`No prepared targets match your search.`,searchPlaceholder:`Search bundles or branches`,searchAriaLabel:`Search project targets`,defaultBranch:`Default branch`,previousBranch:`Previous branch`,loadingBranches:`Loading branch suggestions...`,noSuggestedBranches:`No suggested branches available.`,switchOrCreateBranch:`Switch or create branch`,branchPlaceholder:`feature/quick-fix`,switchBranch:`Switch`,actions:`Target actions`,manageBundles:`Manage bundles`,newChatAriaLabel:`Select project target for new chat`,newSpecAriaLabel:`Select project target for new spec`,status:{selected:`Selected`,loading:`Loading status`,detachedHead:`Detached HEAD`,unknownBranch:`Unknown branch`,unavailable:`Target unavailable`,upToDate:`Up to date`,pullAvailable:`Pull available`},errors:{bundleSwitch:`Unable to switch to that bundle right now.`,repoRootSwitch:`Unable to switch the repo root target right now.`}},checksDialog:{title:`Checks`,description:`Run configured checks and inspect durable output for the selected target.`,openActivity:`Open activity`,close:`Close Checks`,configured:`Configured checks`,required:`Required for delivery`,optional:`Configured, not required`,preReview:`Runs before automatic Review`,finalOnly:`Final delivery only`,policySource:{project:`Inherited project policy`},policySummary:{title:`Required checks`,counts:`{{requiredCount}} delivery checks · {{preReviewCount}} pre-Review checks`,source:`Source: {{source}}`},gateTitle:`Automated delivery gate`,gatePassed:`Passed`,gateBlocked:`Blocked`,gateStale:`No longer current`,gateUnverifiable:`Unable to verify`,gatePolicy:`Policy {{fingerprint}}`,gateBoundary:{label:`Automation step: {{boundary}}`,check_completion:`Check completion`,automation_review:`Pre-Review checks, then automatic Review`,automation_commit:`Required checks, then commit creation`,automation_push:`Required checks, then push`,automation_pull_request:`Required checks, then pull-request creation`},gateSourceBatch:`Source batch: {{batchId}}`,gateNoBatch:`No source batch was available.`,gateScope:`Required checks govern automated delivery. They do not prevent manual or external Git operations.`,gateLoading:`Loading automated delivery gate...`,gateDetails:`Gate details`,gateReasonSummary:`Most relevant reason: {{reason}}`,gatePassedSummary:`All required checks passed for this delivery boundary.`,gateBlockedSummary:`Required evidence does not currently satisfy this delivery boundary.`,gatePolicyStatus:`Policy status: {{status}}`,gatePolicyValid:`Valid`,gatePolicyInvalid:`Invalid`,gateReasonsTitle:`Decision reasons`,gateEvidenceTitle:`Per-check evidence`,gateApplicability:{label:`Applicability to current state: workspace {{workspace}} · policy {{policy}} · overall applicability: {{overall}}`,current:`current`,stale:`stale`,unavailable:`unavailable`,overallCurrent:`applies`,overallStale:`does not apply`,overallUnverifiable:`unable to verify`},evidence:{current:`Current`,stale:`Stale`,failed:`Failed`,missing:`Missing`,interrupted:`Interrupted`,blocked:`Blocked`},reason:{not_required:`No checks were required.`,policy_invalid:`The persisted required-check policy is invalid.`,policy_drift:`The required-check policy changed.`,workspace_unavailable:`The workspace could not be inspected.`,intended_identity_mismatch:`The workspace no longer matches the intended delivery state.`,missing_evidence:`Required evidence is missing.`,target_mismatch:`Evidence belongs to a different target.`,batch_not_completed:`The source batch did not complete.`,incomplete_evidence:`The source batch has incomplete evidence.`,duplicate_evidence:`The source batch contains duplicate evidence.`,extra_evidence:`The source batch contains unexpected evidence.`,definition_drift:`A required check definition changed.`,attempt_failed:`A required check failed.`,attempt_stale:`Required evidence is stale because the workspace changed.`,target_busy:`Another check batch is already running for this target.`,check_start_failed:`Required checks could not start.`},attempts:`Check attempts`,runActions:`Check run actions`,selectionHint:`Select checks to run`,selectForRun:`Select {{name}} for the next run`,inspectAttempt:`Inspect {{name}}, {{status}}`,evidenceSelected_one:`{{count}} repair evidence source selected`,evidenceSelected_other:`{{count}} repair evidence sources selected`,selectAttemptTitle:`Select a check attempt`,selectAttemptDescription:`Choose a completed or active attempt from the check list to inspect its output and evidence.`,notRunDescription:`This check was not included in the latest run. Its configuration is shown below.`,runSelected:`Run selected`,starting:`Starting...`,stop:`Stop batch`,stopping:`Stopping...`,rerunAll:`Rerun all`,rerunFailed:`Rerun failed`,loading:`Loading durable check state...`,emptyTitle:`No check batches yet`,emptyDescription:`Select one or more configured checks to create a batch.`,stopRequested:`Stop requested`,summary:`{{passed}} passed · {{failed}} failed · {{running}} running · {{queued}} queued`,environment:{batchOwnership_one:`This batch owns one environment lease shared by {{count}} queued or running attempt.`,batchOwnership_other:`This batch owns one environment lease shared by {{count}} queued or running attempts.`,wholeSandboxStop:`Stopping the batch stops its processes; if an individual guest process cannot be terminated safely, the provider may stop the whole sandbox.`,attemptPlacementRecorded:`Exact attempt placement was recorded for target {{target}}.`,attemptPlacementPending:`Exact attempt placement is not available yet.`},command:`Command`,directory:`Directory`,targetRoot:`Target root`,outcome:`Outcome`,currencyLabel:`Currency`,policyLabel:`Policy`,output:`Output`,rawOutput:`Raw output`,outputEmpty:`This check has not produced output yet.`,outputExpired:`Output expired under the retention policy. The durable outcome remains available.`,outputTruncated:`Older output was removed by the retention limit.`,diagnostics:{title:`Structured diagnostics`,loading:`Loading parser state...`,availableCount_one:`{{count}} structured diagnostic available`,availableCount_other:`{{count}} structured diagnostics available`,noneAvailable:`No structured diagnostics are available.`,failureOutcome:`Failure outcome: {{outcome}}`,severitySummaryLabel:`Diagnostic counts by severity`,severityCount_one:`{{count}} {{severity}}`,severityCount_other:`{{count}} {{severity}}`,totalAvailable:`{{count}} total recorded`,noStructuredDiagnostics:`No structured diagnostics were returned. Retained raw output may be available below.`,structuredDetailsUnavailable:`Structured issue details are unavailable. The recorded total remains available.`,summary_one:`{{count}} structured diagnostic from {{parser}}`,summary_other:`{{count}} structured diagnostics from {{parser}}`,selectLegend:`Select diagnostics to repair`,selectedEvidence_one:`{{count}} repair evidence source selected`,selectedEvidence_other:`{{count}} repair evidence sources selected`,diagnosticLimit:`A repair can include up to {{count}} diagnostics. Clear a selection to choose another.`,attemptLimit:`A repair can include diagnostics from up to {{count}} check attempts. Clear a selection from another attempt to continue.`,rawOutputSelect:`Use retained raw output as repair evidence`,rawOutputHint:`The server will send this persisted check output to the repair agent. Output is treated as untrusted evidence, not instructions.`,rawOutputTruncated:`Earlier output was removed by the retention limit.`,technicalDetails:`Technical details`,technicalDetailsHint:`Review evidence and repair context.`,parserLabel:`Parser`,parserStateLabel:`Parser state`,parserRetentionLabel:`Parser retention`,outputRetentionLabel:`Output retention`,applicabilityLabel:`Applicability`,sourceLabel:`Source`,source:`Source: {{source}}`,repositoryLocation:`Repository-root diagnostic (no file range)`,applicability:`Present applicability: {{state}}`,repairApplicability:`Applies to the retained batch terminal state`,retention:`Retention: {{state}}`,expired:`Structured diagnostics expired. Issue details are unavailable; retained raw output may still be available below.`,truncated:`The parser reached its diagnostic limit. Use raw output as the primary fallback.`,destinationTitle:`Repair destination`,destinationHint:`The server determines this from the blocked automation boundary.`,destination:{pre_review:`Next: pre-Review checks, then automatic Review.`,commit:`Next: required checks, then commit creation.`,push:`Next: required delivery checks, then push.`,pull_request:`Next: required delivery checks, then pull-request creation.`,manual:`Next: rerun the affected checks. No automation progression is claimed.`,unknown:`Next boundary is unavailable. No delivery progression is claimed.`},ticketLabel:`Repair ticket`,ticketPlaceholder:`Select a ticket for this repair`,repairSelected_one:`Repair {{count}} diagnostic`,repairSelected_other:`Repair {{count}} diagnostics`,repairSelectedEvidence_one:`Repair from {{count}} evidence source`,repairSelectedEvidence_other:`Repair from {{count}} evidence sources`,starting:`Starting repair...`,stopRepair:`Stop repair`,repairRunning:`Repair is running`,repairResult:{passed:`Repair rerun passed`,failed:`Repair failed`,cancelled:`Repair was stopped`,interrupted:`Repair was interrupted`},autoFix:{attempt:`Attempt {{current}} of {{total}}`,stop:`Stop automatic repair`,phase:{dispatching:`Starting automatic repair`,repairing:`Repairing checks`,fallback:`Provider continuation was rejected before execution; starting a fresh repair`,rerunning:`Rerunning checks for attempt {{current}} of {{total}}`,stopping:`Stopping automatic repair`,terminal:`Automatic repair finished`},terminal:{passed:`Automatic repair passed all checks`,ineligible:`These failures cannot be repaired automatically`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The repair agent failed`,no_workspace_changes:`The repair agent made no changes`,unchanged_failures:`Automatic repair made no progress`,user_cancelled:`Automatic repair was stopped by the user`,stale:`Check definitions or workspace became stale`,exhausted:`Automatic repair used all three attempts`,interrupted:`Automatic repair was interrupted`}},parser:{typescript:`TypeScript`,eslint:`ESLint`,none:`raw output`},state:{pending:`Parsing`,complete:`Parsed`,unsupported:`Unsupported parser`,malformed:`Parsing failed`,interrupted:`Parsing interrupted`},fallback:{unsupported:`This output format is unsupported. Raw output is the primary evidence.`,malformed:`Structured parsing failed. Raw output is the primary evidence.`,interrupted:`Structured parsing was interrupted. Raw output is the primary evidence.`},severity:{error:`Error`,warning:`Warning`,info:`Info`,unknown:`Unknown`},applicabilityState:{current:`current workspace`,stale:`stale workspace`,pending:`pending completion`,unavailable:`unable to verify`},retentionState:{retained:`retained`,expired:`expired`},disabled:{stale:`Repair is disabled because this diagnostic does not apply to the current workspace.`,definition_stale:`Repair is disabled because the check definition changed after this batch ran.`,workspace_changed:`Repair is disabled because the workspace changed after this batch finished.`,workspace_unavailable:`Repair is disabled because the current workspace identity could not be verified.`,evidence_identity_unavailable:`Repair is disabled because the batch terminal workspace identity is unavailable.`,unsupported:`Repair is disabled because structured parsing is unsupported or failed.`,expired:`Repair is disabled because required diagnostics or raw output expired.`,repository_root:`Repair is unavailable for repository-root attempts.`,busy:`Repair is disabled while this target has active checks or another repair.`,non_repairable:`These diagnostics are not eligible for repair.`}},status:{queued:`Queued`,running:`Running`,waiting:`Waiting`,completed:`Passed`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`,notRun:`Not run`},category:{test:`Test`,typecheck:`Typecheck`,lint:`Lint`,"format-check":`Format check`,build:`Build`,coverage:`Coverage`,security:`Security`,custom:`Custom`},outcomeValue:{passed:`Passed`,command_failure:`Command failed`,spawn_failure:`Process could not start`,infrastructure_failure:`Check infrastructure failed`,evidence_persistence_failure:`Check evidence could not be saved`,timeout:`Timed out`,workspace_changed_before_start:`Workspace changed before start`,user_stop:`Stopped by user`,restart_loss:`Interrupted by server restart`,shutdown_loss:`Interrupted by server shutdown`},currency:{current:`Current`,stale:`Stale`,pending:`Pending completion`,unavailable:`Unable to verify`},errors:{load:`Unable to load checks right now.`,run:`Unable to start checks right now.`,stop:`Unable to stop this batch right now.`,rerun:`Unable to rerun checks right now.`,diagnostics:`Unable to load structured diagnostics. Raw output remains available.`,repair:`Unable to start repair right now.`,repairStop:`Unable to stop repair right now.`}},verificationDialog:{title:`Verification`,description:`Run configured checks or explore tests for the selected target.`,close:`Close verification`,openActivity:`Open Activity`,tabsAriaLabel:`Verification modes`,tabs:{checks:{label:`Checks`,description:`Run tests and other configured quality gates together as a batch.`},tests:{label:`Test Explorer`,description:`Discover and run a granular test suite, file, or case.`}},status:{checks:{inactive:`Check batch idle`,running:`Check batch running`,finished:`Check batch completed`,error:`Check batch failed`,interrupted:`Check batch interrupted`},tests:{inactive:`Test run idle`,running:`Test run running`,finished:`Test run passed`,error:`Test run failed`,interrupted:`Test run stopped`}}},testsDialog:{status:{passed:`Passed`,failed:`Failed`,running:`Running`,error:`Error`,stopped:`Stopped`,idle:`Idle`},selection:{noRunYet:`No test run yet`,allTests:`All tests`},actions:{run:`Run`,stop:`Stop`},caseRow:{runAriaLabel:`Run {{name}}`},fileRow:{expandAriaLabel:`Expand {{path}}`,collapseAriaLabel:`Collapse {{path}}`,runAriaLabel:`Run {{path}}`,testCount_one:`{{count}} test`,testCount_other:`{{count}} tests`,noNamedTests:`No named tests were detected in this file.`},scope:{label:`Test scope`,selectedCommandAriaLabel:`Selected test command`,selectTestScope:`Select test scope`,fullSuiteOnlyNotice:`This scope supports full-suite runs only, so file and case selection is disabled.`},filter:{placeholder:`Filter`,ariaLabel:`Filter test cases`,clearAriaLabel:`Clear test case filter`},discovery:{noCommands:`No test commands are configured for this target yet.`,fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`,caseCount_one:`{{count}} test case`,caseCount_other:`{{count}} test cases`,noFilesDetected:`No JS or TS test files were detected for this target yet.`,noFilterMatches:`No test cases match this filter.`},summaryCounts:{failed:`failed`,passed:`passed`,filesFailed:`files failed`,filesPassed:`files passed`},output:{trimmed:`Output trimmed to recent logs`,ariaLabel:`Test output`,empty:`No test output yet.`},messages:{loadRunnerError:`Unable to load the test runner right now.`,discoverError:`Unable to discover tests right now.`,startError:`Unable to start the selected tests right now.`,stopError:`Unable to stop the test run right now.`},dialog:{srTitle:`Tests`,srDescription:`Run configured tests for the selected project target. Completed attempts remain in project Activity after this dialog closes.`,title:`Tests`,preparingTarget:`Preparing target...`,closeAriaLabel:`Close modal`},closeConfirmation:{title:`Stop test run and close?`,description:`Closing stops the active process and removes this live discovery session. The durable attempt and its retained evidence remain in Activity.`,keepRunning:`Keep running`,stopAndClose:`Stop and close`}},githubActions:{dialog:{srTitle:`GitHub Actions`,srDescription:`List GitHub Actions workflows, dispatch them with inputs, and watch run status.`,title:`GitHub Actions`,closeAriaLabel:`Close modal`},actions:{run:`Run`,dispatch:`Run workflow`,cancel:`Cancel`,refresh:`Refresh`,openOnGithub:`Open on GitHub`},workflows:{title:`Workflows`,ariaLabel:`GitHub Actions workflows`,runAriaLabel:`Run workflow {{name}}`,stateActive:`Active`,stateDisabled:`Disabled`,empty:`No workflows found in this repository.`,emptyHint:`Add a workflow file under .github/workflows to get started.`,docsLink:`Learn more about GitHub Actions`,loadError:`Unable to load workflows right now.`,loading:`Loading workflows...`},inputs:{title:`Workflow inputs`,refLabel:`Branch or tag`,refPlaceholder:`main`,refAriaLabel:`Branch or tag ref to run the workflow on`,requiredLabel:`Required`,requiredValidationError:`Please fill in all required inputs.`,booleanYes:`Yes`,booleanNo:`No`,selectPlaceholder:`Select an option`,notDispatchable:`This workflow cannot be triggered manually.`,loading:`Loading workflow inputs...`},runs:{title:`Recent runs`,ariaLabel:`Recent GitHub Actions runs`,empty:`No runs yet. Dispatch a workflow to see its status here.`,resolving:`Resolving run...`,notVisible:`Run dispatched but not yet visible on GitHub.`,unknownRef:`Unknown branch or ref`,trackingState:{resolving:`Waiting for this run to become visible on GitHub...`,resolved:`The GitHub run was resolved.`,not_visible:`The dispatched run did not become visible on GitHub.`,ambiguous:`More than one GitHub run matched this dispatch, so Archon could not identify the run safely.`,failed:`GitHub could not provide the run state.`},durationLabel:`Duration`,stepsLabel:`Steps`,jobsLabel:`Jobs`,loadError:`Unable to load runs right now.`},status:{queued:`Queued`,in_progress:`In progress`,completed:`Completed`,unknown:`Unknown`},conclusion:{success:`Success`,failure:`Failure`,cancelled:`Cancelled`,neutral:`Neutral`,skipped:`Skipped`,timed_out:`Timed out`,action_required:`Action required`,stale:`Stale`},messages:{dispatched:`Workflow dispatched. Tracking run status...`,dispatchError:`Unable to dispatch the workflow right now.`}},planningAgentSidebar:{runStatus:{planning:`Planning...`,done:`Done`,failed:`Failed`},runSummary:{tickets:`{{count}} tickets`,dependencies:`{{count}} dependencies`,openQuestions_one:`{{count}} open question`,openQuestions_other:`{{count}} open questions`},actions:{planTickets:`Plan tickets`,openAriaLabel:`Open planning agent`,closeAriaLabel:`Close planning agent`,closePanelAriaLabel:`Close planning agent panel`,manageBundles:`Manage bundles`},tooltip:`Planning agent`,ariaLabel:`Planning agent sidebar`,title:`Planning agent`,description:`Turn a larger initiative into plan-stage tickets with dependencies and bundle context.`,descriptionLabel:`Description`,descriptionAriaLabel:`Planning description`,descriptionPlaceholder:`Describe the task, acceptance criteria, context...`,autoCreateBundle:`Auto-create bundle`,activeRuns:`Active planning runs`,recentRuns:`Recent runs`},reviewFollowUpBubble:{finding:`Finding {{count}}`,externalFix:`External fix {{count}}`,previewComment:`Preview comment {{count}}`,comment:`Comment {{count}}`,unknownTarget:`Unknown target`,textLabel:`Text`,hrefLabel:`Href`,srcLabel:`Src`,changedLineLabel:`Changed line`,selectedFixes:`Selected fixes`,fixCount_one:`{{count}} fix`,fixCount_other:`{{count}} fixes`,locationFile_one:`{{count}} file`,locationFile_other:`{{count}} files`,locationPage_one:`{{count}} page`,locationPage_other:`{{count}} pages`,locationTarget_one:`{{count}} target`,locationTarget_other:`{{count}} targets`,showRawPrompt:`Show raw prompt`,hideRawPrompt:`Hide raw prompt`,rawPrompt:`Raw prompt`},buildRequirementResolutionBubble:{displayTitle:`Build decisions`,title:`Answered Build requirements`,requirementCount_one:`{{count}} decision`,requirementCount_other:`{{count}} decisions`,ticketCount_one:`{{count}} ticket`,ticketCount_other:`{{count}} tickets`,summary:`{{requirementLabel}} across {{ticketLabel}}`,question:`Question`,decision:`Decision`,showRawPrompt:`Show raw prompt`,hideRawPrompt:`Hide raw prompt`,rawPrompt:`Raw prompt`},githubCommentMarkdown:{suggestionLabel:`Suggested change`},ticketStaticDescription:{ariaLabel:`Ticket description`,title:`Description`},ticketDependencyDetails:{blocksTitle:`Blocks`,buildReadinessAriaLabel:`Build readiness`,buildReadinessTitle:`Build readiness`,ready:`Ready`,blocked:`Blocked`,summaryReady:`All blockers have finished build.`,summaryBlocked_one:`{{count}} blocker is still waiting on build.`,summaryBlocked_other:`{{count}} blockers are still waiting on build.`,buildDone:`Build done`,waitingOnBuild:`Waiting on build`,remove:`Remove`,dependencyDetails:`Dependency details`,show:`Show`,hide:`Hide`,unknownTicket:`Unknown ticket`},ticketBuildChainPreview:{ariaLabel:`Build chain`,title:`Build chain`},runControl:{stopAriaLabel:`Stop`,stoppingAriaLabel:`Stopping run`,stoppingTitle:`Stopping run...`,stop:`Stop`,runAriaLabel:`Run`,startingAriaLabel:`Starting run`,startingTitle:`Starting run...`,run:`Run`,disabledReason:`Stop the currently running ticket before starting another run.`},sandboxPreviewRunDialog:{title:`Choose where to run the preview`,description:`This Docker Sandbox release can run the service, but it cannot safely publish its preview port. You can keep the service isolated without an in-app preview, or run this service on the host machine.`,hostWarning:`Running on the host removes sandbox isolation for setup and service commands. The process can access the host filesystem, network, and eligible host credentials. This choice applies only to this run and does not change the project default.`,cancel:`Cancel`,runInSandbox:`Run in sandbox without preview`,runOnHost:`Run on host with preview`},ticketChangesCommitPanel:{title:`Commit selected files`,selectedFiles_one:`{{count}} file selected`,selectedFiles_other:`{{count}} files selected`,commitMessageAriaLabel:`Commit message`,commitMessagePlaceholder:`Commit message`,generateCommitMessageAriaLabel:`Generate commit message`,generating:`Generating...`,generate:`Generate`,committing:`Committing...`,commit:`Commit`},ticketChangesCommitsPanel:{changesLabel:`Local commits`,changesAriaLabel:`Local commits`,changesMenuAriaLabel:`Changes menu`,viewChangesLabel:`View changes`,viewChangesAriaLabel:`View changes`,viewChangesTitle:`View changes`,viewChangesDescription:`Choose which changes to inspect.`,localCommitsLabel:`Local commits`,localCommitsAriaLabel:`Local commits`,localCommitsTitle:`Local commits`,localCommitsDescription:`View local commits on this branch.`,diffSource:`Diff source`,branchDiff:`Branch diff`,uncommittedChanges:`Uncommitted changes`,allListedCommits:`All listed commits`,individualCommits:`Individual commits`,loading:`Loading branch commits...`,undoing:`Undoing...`,undoLatestCommit:`Undo latest commit`,squashCommits:`Squash commits...`,squashTitle:`Squash {{count}} commits?`,squashDescription:`This rewrites your unpushed commit history into one commit. Remote commits will not be changed.`,squashMessageLabel:`New commit message`,squashMessagePlaceholder:`Commit message`,squashCleanWorkspaceWarning:`The workspace must be clean. Commit, stash, or discard current changes before squashing.`,cancel:`Cancel`,squash:`Squash commits`,squashing:`Squashing...`},workspaceReviewModal:{changes:`Changes`,files:`Files`,modeAriaLabel:`Review mode`,closeAriaLabel:`Close workspace review`,chatRequired:`Open Chat to submit review comments.`},workspaceFiles:{target:`Target`,repositoryRoot:`Repository root`,bundleTarget:`{{name}}`,ticketTarget:`Ticket: {{id}}`,fileBrowser:`File browser`,searchFiles:`Search files`,searchPlaceholder:`Search by path`,changedOnly:`Changed files only`,repositoryTree:`Repository tree`,noSearchResults:`No files match your search.`,noFilterResults:`No files match this filter.`,loadingManifest:`Loading workspace files...`,manifestError:`Unable to load workspace files.`,noProject:`No project is selected.`,retry:`Retry`,truncated:`File list truncated at the server limit.`,selectFile:`Select a file`,tracked:`Tracked`,refreshFiles:`Refresh files`,viewChanges:`View changes`,empty:`Choose a readable file from the repository tree to inspect its source.`,loadingFile:`Loading {{path}}...`,contentError:`Unable to load this file.`,viewMode:{ariaLabel:`File view mode`,preview:`Preview`,source:`Source`,sourceRequiredLargeFile:`Source mode is required because this Markdown file is too large to preview.`},expandedFolder:`Expanded: {{path}}`,collapsedFolder:`Collapsed: {{path}}`,fileLabel:`{{status}}{{path}}{{comments}}`,commentsSuffix:`, {{count}} comments`,unsupported:{absolute_path:`Absolute paths cannot be opened.`,binary:`Binary files cannot be displayed.`,deleted:`This file has been deleted.`,invalid_utf8:`This file is not valid UTF-8 text.`,missing:`This file is no longer present in the workspace.`,not_in_manifest:`This file is no longer in the workspace manifest.`,not_regular_file:`This path is not a regular file.`,nul_byte:`This file contains binary data and cannot be displayed.`,oversized:`This file is too large to display.`,path_traversal:`This path is outside the selected workspace.`,symlink:`Symbolic links cannot be opened here.`,unreadable:`This file cannot be read.`},source:{ariaLabel:`Source code`,empty:`This file is empty.`,highlightingDisabledLargeFile:`Syntax highlighting is disabled because this file is too large.`,search:{open:`Search within file`,inputLabel:`Find in file`,placeholder:`Find in file`,matchCount:`{{current}} of {{total}}`,noMatches:`No matches`,previous:`Previous match`,next:`Next match`,close:`Close search`},commentOnLine:`Comment on line {{lineNumber}}`,stale:`Stale`,edit:`Edit`,remove:`Remove`,placeholder:`Tell the agent what should change`,cancel:`Cancel`,add:`Add comment`,save:`Save comment`},markdown:{ariaLabel:`Markdown preview`,empty:`This Markdown file is empty.`,disabledLargeFile:`Markdown preview is disabled because this file is too large.`,imagePlaceholder:`Image not loaded: {{alt}} ({{source}})`,imagePlaceholderNoAlt:`Image not loaded ({{source}})`,missingImageSource:`source unavailable`,missingLinkSource:`unsupported link`}},chatChangesPanel:{unknownFile:`Unknown file`,picker:{diff:`Diff`,file:`File`,allChanges:`All changes`,openChangedFilesAriaLabel:`Open changed files`,fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`,title:`Changed files`,allChangesDescription:`Review the full workspace diff.`},fileStatus:{modified:`Modified`,added:`Added`,deleted:`Deleted`,renamed:`Renamed`,untracked:`Untracked`,typechanged:`Type changed`,staged:`Staged`,unstaged:`Unstaged`,conflicted:`Conflicted`,renamedFrom:`from {{path}}`},errors:{loadDiff:`Unable to load the diff right now.`,sendChanges:`Unable to send the changes right now.`},toasts:{sendChangesSuccess:`Changes sent to chat.`},closeAriaLabel:`Close diff panel`,emptyStateTitle:`No uncommitted changes.`,emptyStateDescription:`The current project branch is clean.`},pendingFixesPopover:{triggerLabel:`Pending fixes`,title:`Pending fixes`,description:`Review selected comments and findings before sending them back to the agent.`,empty:`No pending fixes selected yet.`,manualCommentTitle:`Manual comment`,manualBadge:`Manual`,sourceLocation:`Workspace file · {{path}} · line {{line}}`,staleSource:`Source changed since this comment was added.`,edit:`Edit`,remove:`Remove`,cancel:`Cancel`,save:`Save`,editCommentLabel:`Edit pending comment`,findingTitle:`Finding {{ordinal}}`,githubReviewSummary:`GitHub review summary`,githubReviewComment:`GitHub review comment`,clear:`Clear`,sending:`Sending...`,sendFixes:`Send fixes ({{count}})`,lineReference:{oldAndNew:`old {{oldLine}}, new {{newLine}}`,newOnly:`new {{newLine}}`,oldOnly:`old {{oldLine}}`,unavailable:`line unavailable`}},ticketChangesDiffPanel:{stats:{fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`},reviewComment:{manualBadge:`Manual`,commentOnLine:`Comment on line {{lineNumber}}`,addCommentToLine:`Add a comment to line {{lineNumber}}`,ariaLabel:`Review comment for {{filePath}}`,placeholder:`Add a review comment for this change`,edit:`Edit`,remove:`Remove`,add:`Add comment`,cancel:`Cancel`},lineReference:{oldAndNew:`old {{oldLine}}, new {{newLine}}`,newOnly:`new {{newLine}}`,oldOnly:`old {{oldLine}}`,unavailable:`line unavailable`},reviewFinding:{title:`Finding {{ordinal}}`,selected:`Selected`,fix:`Fix`,hideDetails:`Hide details`,details:`Details`,whyItMatters:`Why it matters`,requestedFix:`Requested fix`,sectionTitle:`Review findings`,reviewerModel:`Reviewed with {{model}}`,reviewerModelVariant:`Reviewed with {{model}} · {{variant}}`},githubComment:{badge:`GitHub`,reviewSummary:`Review summary`,fileComment:`File comment`,inlineComment:`Inline comment`,outdated:`Outdated`,openOnGitHub:`Open on GitHub`,sectionTitle:`GitHub review comments`},viewType:{unified:`Unified`,split:`Split`},header:{allChanges:`All changes`,viewCurrentFile:`View file`,nextComment:`Next comment`,nextCommentAriaLabel:`Next review comment`,nextCommentTooltip:`Jump to the next review comment`},states:{loading:`Loading diff...`,refreshing:`Refreshing diff... Displayed changes may be outdated.`,retry:`Retry`,emptyTitle:`No changes to show.`,noRenderableFileTitle:`No renderable diff for this file in the UI.`},fileBadge:{newFile:`New file`}}},projects:{identity:{activeProjectAriaLabel:`Active project`,emptyLabel:`No projects yet`,filterPlaceholder:`Filter projects...`,emptySearch:`No matches`,newProject:`New project`,newProjectAriaLabel:`Create a new project`,editProjectSettingsAriaLabel:`Edit project settings`},modal:{dialogTitle:{create:`Add a repository to Archon`,edit:`Edit project settings`},dialogDescription:`Configure a project repository, setup commands, services, and IDE launch settings.`,header:{title:{create:`Add project`,edit:`Edit project settings`},description:{create:`Point Archon at a repository, then define only the behavior you want Archon to manage.`,edit:`Update how Archon prepares and opens worktrees for this repository.`},close:`Close modal`},navigation:{title:`Settings`,general:`General`,automation:`Automation`,execution:`Execution`,services:`Services`,checks:`Checks`,sync:`Sync`,memory:`Memory`,integrations:`Integrations`,danger:`Danger Zone`,summary:{required:`Required`,configured:`Configured`,optional:`Optional`,none:`None`,enabled:`Enabled`,disabled:`Disabled`,loading:`Loading`,blocked:`Blocked`,ready:`Ready`,host:`This machine`,dockerSandbox:`Docker Sandbox`,count:`{{count}}`,integrationsCount_one:`{{count}} enabled`,integrationsCount_other:`{{count}} enabled`}},sections:{general:{title:`General`,description:`Start with the repository Archon should use when it creates and manages worktrees for this project.`},automation:{title:`Automation`,description:`Configure helper defaults, setup behavior, and optional workflow rules Archon can apply to this project.`},execution:{title:`Execution`,description:`Choose where Build agents run and validate Docker Sandbox environments for the exact selected target.`},services:{title:`Services`,description:`Add long-running commands that Archon should start automatically inside each worktree.`},checks:{title:`Checks`,description:`Configure reusable commands and manage their project-wide execution policies.`},sync:{title:`Sync`,description:`Define which local files Archon should copy or symlink into a worktree the first time it is created.`},memory:{title:`Memory`,description:`Turn project memory on or off and manage the saved context Archon keeps outside the repository.`},integrations:{title:`Integrations`,description:`Connect external systems that add richer context to planning, tickets, and pull requests for this project.`},danger:{title:`Danger Zone`,description:`Delete this project only after its tickets and worktrees are already gone. This action cannot be undone.`}},linkedProjects:{none:`No linked projects`,count_one:`{{count}} linked project`,count_other:`{{count}} linked projects`},repoPath:{initializable:`Archon will initialize this directory as a git repository when you create the project.`,invalid:`Repository path is not a valid git repository.`,validateFailed:`Unable to validate the repository path right now.`,browseFailed:`Unable to open the folder picker.`},autoConfig:{applied:`Auto-config applied.`,noop:`Auto-config found no empty fields to fill.`,failed:`Auto-config failed.`},generatedCheckName:{scoped:`{{directory}} {{category}}`,repo:`repo {{category}}`,categories:{test:`tests`,typecheck:`typecheck`,lint:`lint`,"format-check":`format check`,build:`build`,coverage:`coverage`,security:`security`,custom:`check`}},validation:{projectNameRequired:`Project name is required.`,repositoryPathRequired:`Repository path is required.`,serviceCommandRequired:`A service command is required when a service row has values.`,syncSourceRequired:`A source path is required when a sync row has values.`,checkCommandRequired:`A command is required when a check row has values.`,checkDraftPending:`Confirm this check or cancel the draft before saving or closing.`,checkDraftNeedsAttention:`Fix the highlighted check fields, then add the check or cancel the draft.`,checkIdUnique:`Each check must have a unique ID.`,checkDirectoryRelative:`Directory must be a relative path inside the project repository.`,checkTimeoutRange:`Timeout must be a whole number between {{min}} and {{max}} milliseconds.`,checkProductionCustomOnly:`Only custom checks can require production approval.`,previewServiceRequired:`Choose a named service before enabling preview.`},actions:{cancel:`Cancel`,createProject:`Create project`,createProjectBusy:`Creating...`,saveChanges:`Save changes`,saveChangesBusy:`Saving...`}},execution:{loading:`Loading execution readiness...`,loadError:`Unable to load project execution readiness.`,unknown:`Unknown`,profile:{title:`Enforced Build profile`,description:`These choices are selected when a Build is accepted. Queued and historical runs keep that recorded revision even if this profile changes later.`,loading:`Loading the enforced Build profile...`,loadError:`Unable to load the enforced Build profile.`,saveError:`Unable to save the enforced Build profile. Review the selected requirements and try again.`,staleError:`This profile changed elsewhere. Reload the project settings before saving.`,invalidCombination:`Choose a provider, isolation, fallback, and credential protection combination supported by this profile.`,governedHostWarning:`This governed Host profile does not inherit host CLI credentials. Claude may appear logged out during Build even when Plan works.`,useHostCredentialCompatibility:`Use host credential compatibility`,activeFingerprint:`Active profile: {{fingerprint}}`,provider:`Execution provider preference`,isolation:`Required isolation`,isolationOption:{host_process_allowed:`Host process allowed`,microvm_required:`MicroVM required`},fallback:`Fallback`,fallbackOption:{block:`Block when unavailable`,explicit_host:`Allow explicit host fallback`},credential:{title:`Build credential requirements`,description:`Declare only the credential class that the selected Build agent requires. Credentials are configured outside Archon; this form never accepts credential values, OAuth responses, or private provider identifiers.`,item:`Requirement {{count}}`,agent:`Agent`,modelProvider:`Model provider`,authentication:`Authentication class`,protection:`Required protection`,none:`No model credential requirement is declared.`,add:`Add credential requirement`,remove:`Remove`},authentication:{api_key:`Provider API key`,oauth:`Supported OAuth authentication`},protection:{docker_brokered:`Docker brokering required`,legacy_host_inheritance:`Legacy host inheritance allowed`},invalidNetwork:`Fix the network access errors before applying execution settings.`,payloadTooLargeError:`The execution settings were rejected because the profile payload is too large. Remove destinations or requirements and try again.`,invalidDetailError:`The execution settings were rejected: {{detail}}`,network:{title:`Network access`,description:`Declare whether Build agents may reach the network and which destinations a sandbox allowlist must prove. This form never accepts credential values or secrets.`,mode:`Network mode`,modeAria:`Network mode`,modeOption:{unrestricted:`Unrestricted`,allowlist:`Allowlist`},limitReached:`At most {{count}} destinations can be allowlisted.`,hostProviderWarning:`The host provider cannot enforce an allowlist. Select Docker Sandbox for this profile so its destination rules are enforced during validations and runs.`,error:{missing_host:`Enter a destination host.`,invalid_host:`Use an exact hostname or a *.domain wildcard subdomain.`,invalid_port:`Use a port between 1 and 65535.`,invalid_purpose:`Keep the purpose short, non-empty, and under 256 characters.`,empty_allowlist:`Allowlist mode requires at least one destination.`},destination:{title:`Allowlisted destinations`,description:`Each row is one allowed destination: an exact hostname or *.domain wildcard subdomain, an optional port, and an optional short purpose.`,count:`{{count}} of {{max}} destinations`,item:`Destination {{count}}`,none:`No destinations are allowlisted yet.`,add:`Add destination`,removeAria:`Remove destination {{count}}`,hostPlaceholder:`api.example.com`,portPlaceholder:`443`,host:`Host`,hostAria:`Destination {{count}} host`,port:`Port (optional)`,portAria:`Destination {{count}} port`,purpose:`Purpose (optional)`,purposeAria:`Destination {{count}} purpose`}},runtimeBlocked:`Docker Sandbox can remain selected, but these execution settings cannot be applied until runtime readiness is eligible or ready.`,applyDescription:`Apply execution settings commits provider and advanced policy changes. The dialog’s Save changes action does not commit them.`,unsavedWarning:`Execution settings have unapplied changes. Validation remains unavailable until they are applied.`,save:`Apply execution settings`,saving:`Applying execution settings...`},provider:{title:`Where should Builds run?`,description:`Choose where new Builds run. Existing runs keep the environment recorded when they started.`,host:{label:`This machine`,description:`Run Build agents directly on the Archon host for compatibility with the existing workflow.`},docker_sandbox:{label:`Docker Sandbox`,description:`Run Build agents in validated, exact-target Docker Sandbox environments.`,status:{loading:`Checking runtime readiness...`,error:`Unavailable until runtime diagnostics can be checked.`,blocked:`Setup required before this choice can be applied.`,eligible:`Available; the daemon will start when needed.`,ready:`Available for validation.`}}},runtime:{title:`Docker Sandbox runtime`,loadError:`Unable to check Docker Sandbox runtime readiness.`,openDiagnostics:`Open runtime diagnostics`,setup:`Set up Docker Sandbox`,setupTitle:`Docker Sandbox setup`,open:`Open Runtimes`,retry:`Retry readiness check`,state:{loading:`Checking whether Docker Sandbox can run on this machine.`,error:`Readiness could not be confirmed.`,blocked:`Setup is required before Docker Sandbox settings can be applied.`,eligible:`Ready to activate when validation needs it.`,ready:`Ready for project validation.`}},create:{staged:`Create project stages only this provider choice. Profile policy and agent validation become available after the project exists.`,validationAfterCreate:`Create the project before validating OpenCode or Claude. Each agent can be validated independently.`},host:{title:`Builds run on this machine`,summary:`Build agents run directly on this computer for the broadest compatibility. You can prepare Docker Sandbox now without changing the saved provider.`},advanced:{title:`Advanced execution settings`,description:`Review isolation, fallback, credential requirements, the current target, and the active profile identity.`},effective:{title:`Effective Build environment`,host:`This machine (host)`,docker_sandbox:`Docker Sandbox`},readiness:{loading:`Checking whether every agent environment is ready...`,runtimeLoading:`Checking Docker Sandbox runtime readiness...`,runtimeBlocked:`Blocked: configure Docker Sandbox runtime prerequisites before validating this target.`,runtimeError:`Unavailable: Docker Sandbox readiness could not be confirmed. Open runtime diagnostics and retry.`,projectRequired:`Create the project, then validate {{agents}} before starting a sandboxed Build.`,providerRequired:`Select the OpenCode provider that Docker Sandbox should validate before starting a sandboxed Build.`,ready:`Ready. {{agents}} have current validation for this exact target.`,blocked:`Blocked: {{ready}} of {{total}} required agent validations are ready for this exact target and provider.`},requirements:{title:`Docker Sandbox requirements`,exactTarget:`The environment and validation must match the exact current project target.`,agents:`OpenCode and Claude are validated independently; each Build requires its selected agent to be ready.`,failClosed:`Builds do not fall back to this machine when Docker Sandbox is selected. Missing, stale, leased, or invalid evidence blocks execution.`},target:{title:`Current target`,selected:`Selected target`,path:`Writable path`,warning:`Direct mode mounts this worktree read-write. It does not protect the selected worktree from edits made by the sandboxed agent.`,kind:{"project-root":`Repository root`,"bundle-worktree":`Bundle worktree`,"branch-worktree":`Branch worktree`}},agent:{opencode:`OpenCode`,claude:`Claude`},validation:{title:`Agent sandbox validation`,action:`Validate {{agent}}`,retry:`Retry {{agent}}`,validating:`Validating...`,notValidated:`Not validated`,ready:`Ready`,failed:`Failed`,failedSummary:`This agent is not ready for Docker Sandbox on the current target.`,details:`Details`,technicalDetails:`Technical details`,environmentWillPrepare:`Every explicit validation rechecks runtime readiness and may automatically start the Docker Sandbox daemon when eligible before it prepares, reconnects to, or revalidates this agent's dedicated exact-target sandbox.`,saveProfileFirst:`Apply execution settings before validating this environment.`,stale:`This result belongs to a prior execution environment or project target and is stale.`,runState:`Execution-run state`,provider:`Validation provider`,providerLabel:`OpenCode provider for validation`,providerDescription:`Docker Sandbox validates provider access with a representative model. Models from the approved provider can then be selected for ticket Build, with the selected model rechecked before execution.`,probeModel:`Probe model`,runtimeVersion:`Agent runtime version`,providerNotSelected:`Not selected`,modelLabel:`OpenCode model for validation`,modelPlaceholder:`Select an exact OpenCode model`,modelCatalogLoading:`Loading discovered OpenCode models. Validation will be available when discovery finishes.`,modelCatalogEmpty:`No OpenCode models were discovered. Validation is unavailable until model discovery succeeds.`,modelCatalogRetry:`Retry model discovery`,providerFirst:`Select a provider to see its discovered models.`,modelUnavailable:`No discovered models are available for this provider. Select another provider or refresh discovery.`,inProgressOtherContext:`A validation is already running for another provider or model. You can edit this selection, but wait for it to finish before validating again.`,credentialDescription:`Docker Sandbox uses its own template or proxy credential setup; host OpenCode and Claude logins are not imported automatically.`,credentialSupportEvidence:`Credential support is classified by server validation evidence. Archon does not infer support from the provider name and never receives the credential value.`,providerLoading:`Loading available OpenCode providers...`,providerPlaceholder:`Select a provider`,verifiedOption:`sandbox verified`,modelNotSelected:`Not selected`,isolation:`Effective isolation`,template:`Template identity`,authentication:`Authentication`,skills:`Sandbox skills`,destinations:`Required destinations`,checkKind:{workspace_location:`Workspace location`,workspace_readable:`Workspace readability`,workspace_writable:`Workspace writability`,executable:`Executable`,headless:`Headless mode`,authentication:`Authentication`,skills:`Sandbox skills`,destination:`Destination access`,network:`Network policy`},destinationReason:{invalid_json:`The agent returned an invalid structured response.`,nonzero_exit:`The destination command exited unsuccessfully.`,timeout:`The destination validation exceeded its time limit.`,provider_error:`The provider reported an error while serving the selected model.`,model_not_found:`The selected model is not available in the sandbox provider.`,credential_rejected:`The provider rejected the sandbox credential or proxy mapping.`,empty_completion:`The automatically provisioned OpenCode runtime completed without assistant text. This sandbox template is incompatible and requires an Archon or Docker Sandbox template update.`,unexpected_response:`The agent response did not match the validation sentinel.`},checkReason:{model_required:`An explicit OpenCode model is required for this validation.`,provider_required:`An explicit OpenCode provider is required for this validation.`,credential_inventory_unavailable:`Docker Sandbox credential inventory could not be read, so provider-specific access could not be verified.`,runtime_version_unrecognized:`The automatically provisioned OpenCode runtime version could not be identified. Update Archon or the Docker Sandbox template before retrying.`},evidence:{title:`{{check}} evidence`,reason:`Reason: {{reason}}`,providerName:`Provider error: {{name}}.`,providerMessage:`Provider message: {{message}}`,providerReference:`Provider reference: {{reference}}`,runReference:`Archon run: {{runId}}; correlation: {{correlationId}}`,exitCode:`Exit code: {{code}}.`,exitCodeUnknown:`unknown`,truncated:`Output was truncated.`},interruption:`Interruption`,interrupted:`Interrupted; the persistent environment may still be available`,notInterrupted:`Not interrupted`,network:{title:`Effective network evidence`,modeLabel:`Requested network mode`,mode:{unrestricted:`Unrestricted`,allowlist:`Allowlist`},postureLabel:`Observed posture`,posture:{allow_all:`Allow-all`,deny_all:`Deny-all`,mixed:`Mixed outcomes observed`,none_initialized:`No sandbox posture observed`,unknown:`Unknown`},enforcementLabel:`Enforcement class`,enforcement:{enforced_scoped:`Scoped allowlist enforced`,declarative_only:`Declarative only`,none:`No scoped policy requested`,unknown:`Not proven`},enforcementNote:{declarative_only:`The Docker Sandbox global posture is allow-all, so the recorded allowlist is declarative only and does not restrict the Build runtime.`,unknown:`Scoped network enforcement could not be proven by this validation. Revalidate this agent for current evidence.`},decisionsLabel:`Per-destination decisions`,decision:{allow:`Allowed`,deny:`Denied`,unknown:`Unproven`},staleDecision:`Interrupted; evidence is stale and must be revalidated`,degradation:{denied:`A required destination was denied by the sandbox policy. Update the sandbox posture or the profile allowlist, then validate again.`,unknown:`Revalidate this agent to refresh network enforcement evidence before relying on these destinations.`},contextualBlock:`The requested destination allowlist is blocked because Docker Sandbox did not prove active, exact sandbox-scoped enforcement. Review Technical details and initialize or narrow the sandbox policy before retrying.`},remediation:`Resolve the failed checks, configure provider access through the Docker Sandbox setup, and validate this provider again.`,error:`Unable to validate the {{agent}} environment.`,failure:`Failure`,unsupportedRequirement:`The recorded validation does not satisfy the requested credential protection. This requirement blocks Build execution until a supported environment is validated.`},environment:{lastUsed:`Last used`,idlePolicy:`Idle policy`,idleScheduled:`Scheduled to stop {{value}}`,idleOnRelease:`Stops automatically after the final workload lease is released`,machineDisk:`Machine storage`,diskAvailable:`{{value}} available`,diskState:{not_ready:`No available capacity reported`,unknown:`Capacity unavailable`},privateDisk:`Private environment disk`,privateDiskUnsupported:`Unsupported by this provider version`,cleanupRetry:`Next cleanup retry`},checkState:{passed:`Passed`,failed:`Setup required`,cancelled:`Interrupted`},credentialSource:{stored:`stored credential`,environment:`environment or proxy credential`,brokered:`Docker credential proxy`,brokeredWithService:`Docker credential proxy: {{service}}`,guest:`guest authentication`,none:`no credential source`,unknown:`unknown credential source`},credentialClassification:{brokered_api_key:`brokered API key`,brokered_oauth:`brokered OAuth`,file_exposed:`file exposed to guest`,environment_exposed:`environment exposed to guest`,guest_stored:`stored in guest`,unavailable:`unavailable`,unknown:`unknown delivery protection`,legacy_host_inherited:`legacy host inheritance`},reset:{action:`Reset sandbox`,confirm:`Reset this Docker Sandbox? It removes the persistent sandbox state and requires validation again.`,resetting:`Resetting...`,error:`Unable to reset the Docker Sandbox.`},stop:{action:`Stop environment`,confirm:`Stop this entire Docker Sandbox environment? Active workloads in this sandbox may be interrupted.`,stopping:`Stopping environment...`,error:`Unable to stop the Docker Sandbox environment.`,reconnect:`The environment reconnects automatically when an eligible workload is admitted. There is no manual start action.`,wholeSandbox:`Stop environment affects the whole sandbox. Use workflow Stop controls to stop an individual process when exact process termination is available.`},retire:{action:`Retire environment`,confirm:`Retire this Docker Sandbox? It will be removed permanently after active leases are released.`,retiring:`Retiring environment...`,error:`Unable to retire the Docker Sandbox environment.`},cleanupRetry:{action:`Retry cleanup`,confirm:`Retry cleanup for this Docker Sandbox now?`,retrying:`Retrying cleanup...`,error:`Unable to retry Docker Sandbox cleanup.`},runState:{queued:`Queued`,running:`Running`,waiting:`Waiting`,completed:`Completed`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`},isolation:{microvm:`MicroVM`,unknown:`Unknown`}},advanced:{agentProjection:`Showing settings for {{agent}}. Switch the active agent in the application header to edit another agent. Existing sessions keep their saved agent and model.`,summary:{none:`None`,configured:`Configured`,toolDefault:`Tool default`,implementingModel:`Implementing model per ticket`,default:`Default`,customRules:`Custom rules`,autoParkOn:`Auto-park on`,specAwareOn:`Spec coverage on`,modified:`Modified`,enabled:`Enabled`,manualOnly:`Manual only`,depthOnly:`{{depth}}`,depthWithFix:`{{depth}} + fix loop`,disabled:`Disabled`,watching:`Watching {{name}}`,commandCount_one:`{{count}} command`,commandCount_other:`{{count}} commands`,serviceCount_one:`{{count}} service`,serviceCount_other:`{{count}} services`,ruleCount_one:`{{count}} rule`,ruleCount_other:`{{count}} rules`},autoConfigPanel:{badge:`Auto-config`,description:`Inspect the repo and fill any empty setup, service, or sync fields.`,note:`Existing values stay untouched. Uses helper model if set, otherwise the selected tool's default model.`,loading:`Inspecting repo...`,action:`Auto-config`},helperModel:{title:`Helper model`,description:`Set an optional helper model for auto-config and other lightweight project tasks.`,panelDescription:`Used for auto-config and other lightweight project tasks. Leave empty to use the active agent's default model.`,unavailable:`Model discovery is unavailable right now. A previously saved model remains selected.`},reviewerModel:{title:`Reviewer model`,description:`Set an optional reviewer model for project code and spec reviews.`,unavailable:`Model discovery is unavailable right now. A previously saved model remains selected.`,modelLabel:`Reviewer model`,variantLabel:`Reviewer variant`,defaultModel:`Implementing model per ticket`},modelSelection:{loading:`Loading models...`,modelLabel:`Model`,variantLabel:`Variant`,defaultModel:`Use default model`,defaultVariant:`Use model default`,availableVariants:`Available variants`,unavailableSelection:`Unavailable`},commitMessages:{title:`Commit messages`,description:`Guide auto-generated commit subjects with a project-specific style or format.`,fieldLabel:`Commit message rules`,fieldDescription:`Optional. Example: Use Conventional Commits. Format: type(scope?): subject`,ariaLabel:`Commit message rules`,placeholder:`e.g. conventional commits`},checkpointCommits:{title:`Commit after each bundle ticket`,description:`Create a server-side checkpoint commit after each successful ticket in a ticket worktree bundle, before the next queued ticket starts. This does not apply to project-root targets.`,toggleLabel:`Commit completed ticket changes`,toggleDescription:`Create a checkpoint commit after each successful ticket, before the next ticket starts.`,toggleAriaLabel:`Commit completed ticket changes after each successful bundle ticket`,warning:`Turning this on during an active bundle may include existing uncommitted bundle changes in the first checkpoint.`},linkedProjects:{title:`Linked projects`,description:`Let Archon inspect related repos during planning when extra context helps.`,noneAvailable:`No other projects are available to link yet.`,triggerAriaLabel:`Linked projects`,selectedNone:`None`,selectedCount:`{{count}} linked`},setupCommands:{title:`Setup commands`,description:`Run these for fresh worktrees before builds, and again before Archon starts manual worktree services.`,fieldLabel:`Setup commands`,fieldDescription:`One command per line.`,ariaLabel:`Setup commands`,placeholder:`pnpm install
|
|
54
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Os=`DialogDescriptionWarning`,ks=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Es(Os).contentName}}.`;return p.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},As=ts,js=ss,Ms=ls,Ns=ps,Ps=vs,Fs=bs,Is=Ss;function Ls(e){let t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Rs(e){let[t,n]=p.useState(void 0);return yi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var zs=[`top`,`right`,`bottom`,`left`],Bs=Math.min,Vs=Math.max,Hs=Math.round,Us=Math.floor,Ws=e=>({x:e,y:e}),Gs={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ks(e,t,n){return Vs(e,Bs(t,n))}function qs(e,t){return typeof e==`function`?e(t):e}function Js(e){return e.split(`-`)[0]}function Ys(e){return e.split(`-`)[1]}function Xs(e){return e===`x`?`y`:`x`}function Zs(e){return e===`y`?`height`:`width`}function Qs(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $s(e){return Xs(Qs(e))}function ec(e,t,n){n===void 0&&(n=!1);let r=Ys(e),i=$s(e),a=Zs(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=lc(o)),[o,lc(o)]}function tc(e){let t=lc(e);return[nc(e),t,nc(t)]}function nc(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rc=[`left`,`right`],ic=[`right`,`left`],ac=[`top`,`bottom`],oc=[`bottom`,`top`];function sc(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ic:rc:t?rc:ic;case`left`:case`right`:return t?ac:oc;default:return[]}}function cc(e,t,n,r){let i=Ys(e),a=sc(Js(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(nc)))),a}function lc(e){let t=Js(e);return Gs[t]+e.slice(t.length)}function uc(e){return{top:0,right:0,bottom:0,left:0,...e}}function dc(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:uc(e)}function fc(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pc(e,t,n){let{reference:r,floating:i}=e,a=Qs(t),o=$s(t),s=Zs(o),c=Js(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Ys(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function mc(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=qs(t,e),p=dc(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=fc(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=fc(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var hc=50,gc=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:mc},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=pc(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<hc&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=pc(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},_c=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=qs(e,t)||{};if(l==null)return{};let d=dc(u),f={x:n,y:r},p=$s(i),m=Zs(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Bs(d[_],T),D=Bs(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Ks(O,A,k),M=!c.arrow&&Ys(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),vc=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=qs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Js(r),_=Qs(o),v=Js(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[lc(o)]:tc(o)),x=p!==`none`;!d&&x&&b.push(...cc(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ec(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Qs(t))||T.every(e=>Qs(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Qs(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function yc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bc(e){return zs.some(t=>e[t]>=0)}var xc=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=qs(e,t);switch(i){case`referenceHidden`:{let e=yc(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:bc(e)}}}case`escaped`:{let e=yc(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:bc(e)}}}default:return{}}}}},Sc=new Set([`left`,`top`]);async function Cc(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Js(n),s=Ys(n),c=Qs(n)===`y`,l=Sc.has(o)?-1:1,u=a&&c?-1:1,d=qs(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var wc=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Cc(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Tc=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=qs(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Qs(Js(i)),p=Xs(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Ks(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Ks(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Ec=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=qs(e,t),u={x:n,y:r},d=Qs(i),f=Xs(d),p=u[f],m=u[d],h=qs(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Sc.has(Js(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Dc=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=qs(e,t),u=await o.detectOverflow(t,l),d=Js(i),f=Ys(i),p=Qs(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Bs(h-u[g],v),x=Bs(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Vs(u.left,0),t=Vs(u.right,0),n=Vs(u.top,0),r=Vs(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Vs(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Vs(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Oc(){return typeof window<`u`}function kc(e){return Mc(e)?(e.nodeName||``).toLowerCase():`#document`}function Ac(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function jc(e){return((Mc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Mc(e){return Oc()?e instanceof Node||e instanceof Ac(e).Node:!1}function Nc(e){return Oc()?e instanceof Element||e instanceof Ac(e).Element:!1}function Pc(e){return Oc()?e instanceof HTMLElement||e instanceof Ac(e).HTMLElement:!1}function Fc(e){return!Oc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ac(e).ShadowRoot}function Ic(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=qc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Lc(e){return/^(table|td|th)$/.test(kc(e))}function Rc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var zc=/transform|translate|scale|rotate|perspective|filter/,Bc=/paint|layout|strict|content/,Vc=e=>!!e&&e!==`none`,Hc;function Uc(e){let t=Nc(e)?qc(e):e;return Vc(t.transform)||Vc(t.translate)||Vc(t.scale)||Vc(t.rotate)||Vc(t.perspective)||!Gc()&&(Vc(t.backdropFilter)||Vc(t.filter))||zc.test(t.willChange||``)||Bc.test(t.contain||``)}function Wc(e){let t=Yc(e);for(;Pc(t)&&!Kc(t);){if(Uc(t))return t;if(Rc(t))return null;t=Yc(t)}return null}function Gc(){return Hc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Hc}function Kc(e){return/^(html|body|#document)$/.test(kc(e))}function qc(e){return Ac(e).getComputedStyle(e)}function Jc(e){return Nc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yc(e){if(kc(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fc(e)&&e.host||jc(e);return Fc(t)?t.host:t}function Xc(e){let t=Yc(e);return Kc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pc(t)&&Ic(t)?t:Xc(t)}function Zc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Xc(e),i=r===e.ownerDocument?.body,a=Ac(r);if(i){let e=Qc(a);return t.concat(a,a.visualViewport||[],Ic(r)?r:[],e&&n?Zc(e):[])}else return t.concat(r,Zc(r,[],n))}function Qc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $c(e){let t=qc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Pc(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Hs(n)!==a||Hs(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function el(e){return Nc(e)?e:e.contextElement}function tl(e){let t=el(e);if(!Pc(t))return Ws(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$c(t),o=(a?Hs(n.width):n.width)/r,s=(a?Hs(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var nl=Ws(0);function rl(e){let t=Ac(e);return!Gc()||!t.visualViewport?nl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function il(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ac(e)?!1:t}function al(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=el(e),o=Ws(1);t&&(r?Nc(r)&&(o=tl(r)):o=tl(e));let s=il(a,n,r)?rl(a):Ws(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Ac(a),t=r&&Nc(r)?Ac(r):r,n=e,i=Qc(n);for(;i&&r&&t!==n;){let e=tl(i),t=i.getBoundingClientRect(),r=qc(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ac(i),i=Qc(n)}}return fc({width:u,height:d,x:c,y:l})}function ol(e,t){let n=Jc(e).scrollLeft;return t?t.left+n:al(jc(e)).left+n}function sl(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ol(e,n),y:n.top+t.scrollTop}}function cl(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=jc(r),s=t?Rc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ws(1),u=Ws(0),d=Pc(r);if((d||!d&&!a)&&((kc(r)!==`body`||Ic(o))&&(c=Jc(r)),d)){let e=al(r);l=tl(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?sl(o,c):Ws(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ll(e){return Array.from(e.getClientRects())}function ul(e){let t=jc(e),n=Jc(e),r=e.ownerDocument.body,i=Vs(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Vs(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+ol(e),s=-n.scrollTop;return qc(r).direction===`rtl`&&(o+=Vs(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var dl=25;function fl(e,t){let n=Ac(e),r=jc(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Gc();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=ol(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=dl&&(a-=o)}else l<=dl&&(a+=l);return{width:a,height:o,x:s,y:c}}function pl(e,t){let n=al(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Pc(e)?tl(e):Ws(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ml(e,t,n){let r;if(t===`viewport`)r=fl(e,n);else if(t===`document`)r=ul(jc(e));else if(Nc(t))r=pl(t,n);else{let n=rl(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return fc(r)}function hl(e,t){let n=Yc(e);return n===t||!Nc(n)||Kc(n)?!1:qc(n).position===`fixed`||hl(n,t)}function gl(e,t){let n=t.get(e);if(n)return n;let r=Zc(e,[],!1).filter(e=>Nc(e)&&kc(e)!==`body`),i=null,a=qc(e).position===`fixed`,o=a?Yc(e):e;for(;Nc(o)&&!Kc(o);){let t=qc(o),n=Uc(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Ic(o)&&!n&&hl(e,o))?r=r.filter(e=>e!==o):i=t,o=Yc(o)}return t.set(e,r),r}function _l(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Rc(t)?[]:gl(t,this._c):[].concat(n),r],o=ml(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ml(t,a[e],i);s=Vs(n.top,s),c=Bs(n.right,c),l=Bs(n.bottom,l),u=Vs(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function vl(e){let{width:t,height:n}=$c(e);return{width:t,height:n}}function yl(e,t,n){let r=Pc(t),i=jc(t),a=n===`fixed`,o=al(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ws(0);function l(){c.x=ol(i)}if(r||!r&&!a)if((kc(t)!==`body`||Ic(i))&&(s=Jc(t)),r){let e=al(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?sl(i,s):Ws(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function bl(e){return qc(e).position===`static`}function xl(e,t){if(!Pc(e)||qc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return jc(e)===n&&(n=n.ownerDocument.body),n}function Sl(e,t){let n=Ac(e);if(Rc(e))return n;if(!Pc(e)){let t=Yc(e);for(;t&&!Kc(t);){if(Nc(t)&&!bl(t))return t;t=Yc(t)}return n}let r=xl(e,t);for(;r&&Lc(r)&&bl(r);)r=xl(r,t);return r&&Kc(r)&&bl(r)&&!Uc(r)?n:r||Wc(e)||n}var Cl=async function(e){let t=this.getOffsetParent||Sl,n=this.getDimensions,r=await n(e.floating);return{reference:yl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wl(e){return qc(e).direction===`rtl`}var Tl={convertOffsetParentRelativeRectToViewportRelativeRect:cl,getDocumentElement:jc,getClippingRect:_l,getOffsetParent:Sl,getElementRects:Cl,getClientRects:ll,getDimensions:vl,getScale:tl,isElement:Nc,isRTL:wl};function El(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Dl(e,t){let n=null,r,i=jc(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Us(d),h=Us(i.clientWidth-(u+f)),g=Us(i.clientHeight-(d+p)),_=Us(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Vs(0,Bs(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!El(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Ol(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=el(e),u=i||a?[...l?Zc(l):[],...t?Zc(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Dl(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?al(e):null;c&&g();function g(){let t=al(e);h&&!El(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var kl=wc,Al=Tc,jl=vc,Ml=Dc,Nl=xc,Pl=_c,Fl=Ec,Il=(e,t,n)=>{let r=new Map,i={platform:Tl,...n},a={...i.platform,_c:r};return gc(e,t,{...i,platform:a})},Ll=typeof document<`u`?p.useLayoutEffect:function(){};function Rl(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Rl(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Rl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function zl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bl(e,t){let n=zl(e);return Math.round(t*n)/n}function Vl(e){let t=p.useRef(e);return Ll(()=>{t.current=e}),t}function Hl(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=p.useState(r);Rl(f,r)||h(r);let[g,_]=p.useState(null),[v,y]=p.useState(null),b=p.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=p.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||g,C=o||v,w=p.useRef(null),T=p.useRef(null),E=p.useRef(u),D=c!=null,O=Vl(c),k=Vl(i),A=Vl(l),j=p.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),Il(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Rl(E.current,t)&&(E.current=t,m.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Ll(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=p.useRef(!1);Ll(()=>(M.current=!0,()=>{M.current=!1}),[]),Ll(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=p.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=p.useMemo(()=>({reference:S,floating:C}),[S,C]),F=p.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Bl(P.floating,u.x),r=Bl(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...zl(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return p.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Ul=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Pl({element:r.current,padding:i}).fn(n):r?Pl({element:r,padding:i}).fn(n):{}}}},Wl=(e,t)=>{let n=kl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gl=(e,t)=>{let n=Al(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kl=(e,t)=>({fn:Fl(e).fn,options:[e,t]}),ql=(e,t)=>{let n=jl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jl=(e,t)=>{let n=Ml(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yl=(e,t)=>{let n=Nl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xl=(e,t)=>{let n=Ul(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zl=`Arrow`,Ql=p.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,X.jsx)(ci.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,X.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Ql.displayName=Zl;var $l=Ql,eu=`Popper`,[tu,nu]=hi(eu),[ru,iu]=tu(eu),au=e=>{let{__scopePopper:t,children:n}=e,[r,i]=p.useState(null);return(0,X.jsx)(ru,{scope:t,anchor:r,onAnchorChange:i,children:n})};au.displayName=eu;var ou=`PopperAnchor`,su=p.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=iu(ou,n),o=p.useRef(null),s=$r(t,o),c=p.useRef(null);return p.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,X.jsx)(ci.div,{...i,ref:s})});su.displayName=ou;var cu=`PopperContent`,[lu,uu]=tu(cu),du=p.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=iu(cu,n),[v,y]=p.useState(null),b=$r(t,e=>y(e)),[x,S]=p.useState(null),C=Rs(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(hu),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Hl({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Ol(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[Wl({mainAxis:i+T,alignmentAxis:o}),c&&Gl({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Kl():void 0,...A}),c&&ql({...A}),Jl({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Xl({element:x,padding:s}),gu({arrowWidth:w,arrowHeight:T}),f&&Yl({strategy:`referenceHidden`,...A})]}),[I,L]=_u(N),R=Yi(h);yi(()=>{P&&R?.()},[P,R]);let z=F.arrow?.x,ee=F.arrow?.y,B=F.arrow?.centerOffset!==0,[V,te]=p.useState();return yi(()=>{v&&te(window.getComputedStyle(v).zIndex)},[v]),(0,X.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:V,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,X.jsx)(lu,{scope:n,placedSide:I,onArrowChange:S,arrowX:z,arrowY:ee,shouldHideArrow:B,children:(0,X.jsx)(ci.div,{"data-side":I,"data-align":L,...g,ref:b,style:{...g.style,animation:P?void 0:`none`}})})})});du.displayName=cu;var fu=`PopperArrow`,pu={top:`bottom`,right:`left`,bottom:`top`,left:`right`},mu=p.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=uu(fu,n),a=pu[i.placedSide];return(0,X.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,X.jsx)($l,{...r,ref:t,style:{...r.style,display:`block`}})})});mu.displayName=fu;function hu(e){return e!==null}var gu=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=_u(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function _u(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var vu=au,yu=su,bu=du,xu=mu,Su=`rovingFocusGroup.onEntryFocus`,Cu={bubbles:!1,cancelable:!0},wu=`RovingFocusGroup`,[Tu,Eu,Du]=_i(wu),[Ou,ku]=hi(wu,[Du]),[Au,ju]=Ou(wu),Mu=p.forwardRef((e,t)=>(0,X.jsx)(Tu.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(Tu.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(Nu,{...e,ref:t})})}));Mu.displayName=wu;var Nu=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=p.useRef(null),m=$r(t,f),h=Ji(a),[g,_]=xi({prop:o,defaultProp:s??null,onChange:c,caller:wu}),[v,y]=p.useState(!1),b=Yi(l),x=Eu(n),S=p.useRef(!1),[C,w]=p.useState(0);return p.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Su,b),()=>e.removeEventListener(Su,b)},[b]),(0,X.jsx)(Au,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:g,onItemFocus:p.useCallback(e=>_(e),[_]),onItemShiftTab:p.useCallback(()=>y(!0),[]),onFocusableItemAdd:p.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:p.useCallback(()=>w(e=>e-1),[]),children:(0,X.jsx)(ci.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:`none`,...e.style},onMouseDown:vi(e.onMouseDown,()=>{S.current=!0}),onFocus:vi(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(Su,Cu);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);zu([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:vi(e.onBlur,()=>y(!1))})})}),Pu=`RovingFocusGroupItem`,Fu=p.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=ji(),l=a||c,u=ju(Pu,n),d=u.currentTabStopId===l,f=Eu(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=u;return p.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),(0,X.jsx)(Tu.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,X.jsx)(ci.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:vi(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:vi(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:vi(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Ru(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Bu(n,r+1):n.slice(r+1)}setTimeout(()=>zu(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})});Fu.displayName=Pu;var Iu={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Lu(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Ru(e,t,n){let r=Lu(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Iu[r]}function zu(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Bu(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vu=Mu,Hu=Fu,Uu=[`Enter`,` `],Wu=[`ArrowDown`,`PageUp`,`Home`],Gu=[`ArrowUp`,`PageDown`,`End`],Ku=[...Wu,...Gu],qu={ltr:[...Uu,`ArrowRight`],rtl:[...Uu,`ArrowLeft`]},Ju={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Yu=`Menu`,[Xu,Zu,Qu]=_i(Yu),[$u,ed]=hi(Yu,[Qu,nu,ku]),td=nu(),nd=ku(),[rd,id]=$u(Yu),[ad,od]=$u(Yu),sd=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=td(t),[c,l]=p.useState(null),u=p.useRef(!1),d=Yi(a),f=Ji(i);return p.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,X.jsx)(vu,{...s,children:(0,X.jsx)(rd,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,X.jsx)(ad,{scope:t,onClose:p.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};sd.displayName=Yu;var cd=`MenuAnchor`,ld=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=td(n);return(0,X.jsx)(yu,{...i,...r,ref:t})});ld.displayName=cd;var ud=`MenuPortal`,[dd,fd]=$u(ud,{forceMount:void 0}),pd=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=id(ud,t);return(0,X.jsx)(dd,{scope:t,forceMount:n,children:(0,X.jsx)(Ti,{present:n||a.open,children:(0,X.jsx)(Da,{asChild:!0,container:i,children:r})})})};pd.displayName=ud;var md=`MenuContent`,[hd,gd]=$u(md),_d=p.forwardRef((e,t)=>{let n=fd(md,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=id(md,e.__scopeMenu),o=od(md,e.__scopeMenu);return(0,X.jsx)(Xu.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(Ti,{present:r||a.open,children:(0,X.jsx)(Xu.Slot,{scope:e.__scopeMenu,children:o.modal?(0,X.jsx)(vd,{...i,ref:t}):(0,X.jsx)(yd,{...i,ref:t})})})})}),vd=p.forwardRef((e,t)=>{let n=id(md,e.__scopeMenu),r=p.useRef(null),i=$r(t,r);return p.useEffect(()=>{let e=r.current;if(e)return Yo(e)},[]),(0,X.jsx)(xd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:vi(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),yd=p.forwardRef((e,t)=>{let n=id(md,e.__scopeMenu);return(0,X.jsx)(xd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),bd=ei(`MenuContent.ScrollLock`),xd=p.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:m,disableOutsideScroll:h,...g}=e,_=id(md,n),v=od(md,n),y=td(n),b=nd(n),x=Zu(n),[S,C]=p.useState(null),w=p.useRef(null),T=$r(t,w,_.onContentChange),E=p.useRef(0),D=p.useRef(``),O=p.useRef(0),k=p.useRef(null),A=p.useRef(`right`),j=p.useRef(0),M=h?Bo:p.Fragment,N=h?{as:bd,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=of(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};p.useEffect(()=>()=>window.clearTimeout(E.current),[]),ka();let F=p.useCallback(e=>A.current===k.current?.side&&cf(e,k.current?.area),[]);return(0,X.jsx)(hd,{scope:n,searchRef:D,onItemEnter:p.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:p.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:p.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:p.useCallback(e=>{k.current=e},[]),children:(0,X.jsx)(M,{...N,children:(0,X.jsx)(ma,{asChild:!0,trapped:i,onMountAutoFocus:vi(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,X.jsx)(ra,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:m,children:(0,X.jsx)(Vu,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:vi(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,X.jsx)(bu,{role:`menu`,"aria-orientation":`vertical`,"data-state":ef(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:vi(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!Ku.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Gu.includes(e.key)&&a.reverse(),rf(a)}),onBlur:vi(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:vi(e.onPointerMove,lf(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});_d.displayName=md;var Sd=`MenuGroup`,Cd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(ci.div,{role:`group`,...r,ref:t})});Cd.displayName=Sd;var wd=`MenuLabel`,Td=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(ci.div,{...r,ref:t})});Td.displayName=wd;var Ed=`MenuItem`,Dd=`menu.itemSelect`,Od=p.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=p.useRef(null),o=od(Ed,e.__scopeMenu),s=gd(Ed,e.__scopeMenu),c=$r(t,a),l=p.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Dd,{bubbles:!0,cancelable:!0});e.addEventListener(Dd,e=>r?.(e),{once:!0}),li(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,X.jsx)(kd,{...i,ref:c,disabled:n,onClick:vi(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:vi(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:vi(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Uu.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Od.displayName=Ed;var kd=p.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=gd(Ed,n),s=nd(n),c=p.useRef(null),l=$r(t,c),[u,d]=p.useState(!1),[f,m]=p.useState(``);return p.useEffect(()=>{let e=c.current;e&&m((e.textContent??``).trim())},[a.children]),(0,X.jsx)(Xu.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,X.jsx)(Hu,{asChild:!0,...s,focusable:!r,children:(0,X.jsx)(ci.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:vi(e.onPointerMove,lf(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:vi(e.onPointerLeave,lf(e=>o.onItemLeave(e))),onFocus:vi(e.onFocus,()=>d(!0)),onBlur:vi(e.onBlur,()=>d(!1))})})})}),Ad=`MenuCheckboxItem`,jd=p.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,X.jsx)(zd,{scope:e.__scopeMenu,checked:n,children:(0,X.jsx)(Od,{role:`menuitemcheckbox`,"aria-checked":tf(n)?`mixed`:n,...i,ref:t,"data-state":nf(n),onSelect:vi(i.onSelect,()=>r?.(tf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});jd.displayName=Ad;var Md=`MenuRadioGroup`,[Nd,Pd]=$u(Md,{value:void 0,onValueChange:()=>{}}),Fd=p.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Yi(r);return(0,X.jsx)(Nd,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,X.jsx)(Cd,{...i,ref:t})})});Fd.displayName=Md;var Id=`MenuRadioItem`,Ld=p.forwardRef((e,t)=>{let{value:n,...r}=e,i=Pd(Id,e.__scopeMenu),a=n===i.value;return(0,X.jsx)(zd,{scope:e.__scopeMenu,checked:a,children:(0,X.jsx)(Od,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":nf(a),onSelect:vi(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Ld.displayName=Id;var Rd=`MenuItemIndicator`,[zd,Bd]=$u(Rd,{checked:!1}),Vd=p.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Bd(Rd,n);return(0,X.jsx)(Ti,{present:r||tf(a.checked)||a.checked===!0,children:(0,X.jsx)(ci.span,{...i,ref:t,"data-state":nf(a.checked)})})});Vd.displayName=Rd;var Hd=`MenuSeparator`,Ud=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(ci.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Ud.displayName=Hd;var Wd=`MenuArrow`,Gd=p.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=td(n);return(0,X.jsx)(xu,{...i,...r,ref:t})});Gd.displayName=Wd;var Kd=`MenuSub`,[qd,Jd]=$u(Kd),Yd=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=id(Kd,t),o=td(t),[s,c]=p.useState(null),[l,u]=p.useState(null),d=Yi(i);return p.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,X.jsx)(vu,{...o,children:(0,X.jsx)(rd,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,X.jsx)(qd,{scope:t,contentId:ji(),triggerId:ji(),trigger:s,onTriggerChange:c,children:n})})})};Yd.displayName=Kd;var Xd=`MenuSubTrigger`,Zd=p.forwardRef((e,t)=>{let n=id(Xd,e.__scopeMenu),r=od(Xd,e.__scopeMenu),i=Jd(Xd,e.__scopeMenu),a=gd(Xd,e.__scopeMenu),o=p.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=p.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return p.useEffect(()=>u,[u]),p.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,X.jsx)(ld,{asChild:!0,...l,children:(0,X.jsx)(kd,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":ef(n.open),...e,ref:Qr(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:vi(e.onPointerMove,lf(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:vi(e.onPointerLeave,lf(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:vi(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||qu[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Zd.displayName=Xd;var Qd=`MenuSubContent`,$d=p.forwardRef((e,t)=>{let n=fd(md,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=id(md,e.__scopeMenu),o=od(md,e.__scopeMenu),s=Jd(Qd,e.__scopeMenu),c=p.useRef(null),l=$r(t,c);return(0,X.jsx)(Xu.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(Ti,{present:r||a.open,children:(0,X.jsx)(Xu.Slot,{scope:e.__scopeMenu,children:(0,X.jsx)(xd,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:vi(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:vi(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:vi(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Ju[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});$d.displayName=Qd;function ef(e){return e?`open`:`closed`}function tf(e){return e===`indeterminate`}function nf(e){return tf(e)?`indeterminate`:e?`checked`:`unchecked`}function rf(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function af(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function of(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=af(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function sf(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function cf(e,t){return t?sf({x:e.clientX,y:e.clientY},t):!1}function lf(e){return t=>t.pointerType===`mouse`?e(t):void 0}var uf=sd,df=ld,ff=pd,pf=_d,mf=Cd,hf=Td,gf=Od,_f=jd,vf=Fd,yf=Ld,bf=Vd,xf=Ud,Sf=Gd,Cf=Zd,wf=$d,Tf=`DropdownMenu`,[Ef,Df]=hi(Tf,[ed]),Of=ed(),[kf,Af]=Ef(Tf),jf=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Of(t),l=p.useRef(null),[u,d]=xi({prop:i,defaultProp:a??!1,onChange:o,caller:Tf});return(0,X.jsx)(kf,{scope:t,triggerId:ji(),triggerRef:l,contentId:ji(),open:u,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,X.jsx)(uf,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};jf.displayName=Tf;var Mf=`DropdownMenuTrigger`,Nf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Af(Mf,n),o=Of(n);return(0,X.jsx)(df,{asChild:!0,...o,children:(0,X.jsx)(ci.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:Qr(t,a.triggerRef),onPointerDown:vi(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:vi(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Nf.displayName=Mf;var Pf=`DropdownMenuPortal`,Ff=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Of(t);return(0,X.jsx)(ff,{...r,...n})};Ff.displayName=Pf;var If=`DropdownMenuContent`,Lf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Af(If,n),a=Of(n),o=p.useRef(!1);return(0,X.jsx)(pf,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:vi(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:vi(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Lf.displayName=If;var Rf=`DropdownMenuGroup`,zf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(mf,{...i,...r,ref:t})});zf.displayName=Rf;var Bf=`DropdownMenuLabel`,Vf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(hf,{...i,...r,ref:t})});Vf.displayName=Bf;var Hf=`DropdownMenuItem`,Uf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(gf,{...i,...r,ref:t})});Uf.displayName=Hf;var Wf=`DropdownMenuCheckboxItem`,Gf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(_f,{...i,...r,ref:t})});Gf.displayName=Wf;var Kf=`DropdownMenuRadioGroup`,qf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(vf,{...i,...r,ref:t})});qf.displayName=Kf;var Jf=`DropdownMenuRadioItem`,Yf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(yf,{...i,...r,ref:t})});Yf.displayName=Jf;var Xf=`DropdownMenuItemIndicator`,Zf=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(bf,{...i,...r,ref:t})});Zf.displayName=Xf;var Qf=`DropdownMenuSeparator`,$f=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(xf,{...i,...r,ref:t})});$f.displayName=Qf;var ep=`DropdownMenuArrow`,tp=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(Sf,{...i,...r,ref:t})});tp.displayName=ep;var np=`DropdownMenuSubTrigger`,rp=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(Cf,{...i,...r,ref:t})});rp.displayName=np;var ip=`DropdownMenuSubContent`,ap=p.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Of(n);return(0,X.jsx)(wf,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});ap.displayName=ip;var op=jf,sp=Nf,cp=Ff,lp=Lf,up=Uf,dp=`Label`,fp=p.forwardRef((e,t)=>(0,X.jsx)(ci.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));fp.displayName=dp;var pp=fp,mp=`Popover`,[hp,gp]=hi(mp,[nu]),_p=nu(),[vp,yp]=hp(mp),bp=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=_p(t),c=p.useRef(null),[l,u]=p.useState(!1),[d,f]=xi({prop:r,defaultProp:i??!1,onChange:a,caller:mp});return(0,X.jsx)(vu,{...s,children:(0,X.jsx)(vp,{scope:t,contentId:ji(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:p.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:p.useCallback(()=>u(!0),[]),onCustomAnchorRemove:p.useCallback(()=>u(!1),[]),modal:o,children:n})})};bp.displayName=mp;var xp=`PopoverAnchor`,Sp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=yp(xp,n),a=_p(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return p.useEffect(()=>(o(),()=>s()),[o,s]),(0,X.jsx)(yu,{...a,...r,ref:t})});Sp.displayName=xp;var Cp=`PopoverTrigger`,wp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=yp(Cp,n),a=_p(n),o=$r(t,i.triggerRef),s=(0,X.jsx)(ci.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":zp(i.open),...r,ref:o,onClick:vi(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,X.jsx)(yu,{asChild:!0,...a,children:s})});wp.displayName=Cp;var Tp=`PopoverPortal`,[Ep,Dp]=hp(Tp,{forceMount:void 0}),Op=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=yp(Tp,t);return(0,X.jsx)(Ep,{scope:t,forceMount:n,children:(0,X.jsx)(Ti,{present:n||a.open,children:(0,X.jsx)(Da,{asChild:!0,container:i,children:r})})})};Op.displayName=Tp;var kp=`PopoverContent`,Ap=p.forwardRef((e,t)=>{let n=Dp(kp,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=yp(kp,e.__scopePopover);return(0,X.jsx)(Ti,{present:r||a.open,children:a.modal?(0,X.jsx)(Mp,{...i,ref:t}):(0,X.jsx)(Np,{...i,ref:t})})});Ap.displayName=kp;var jp=ei(`PopoverContent.RemoveScroll`),Mp=p.forwardRef((e,t)=>{let n=yp(kp,e.__scopePopover),r=p.useRef(null),i=$r(t,r),a=p.useRef(!1);return p.useEffect(()=>{let e=r.current;if(e)return Yo(e)},[]),(0,X.jsx)(Bo,{as:jp,allowPinchZoom:!0,children:(0,X.jsx)(Pp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vi(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:vi(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:vi(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Np=p.forwardRef((e,t)=>{let n=yp(kp,e.__scopePopover),r=p.useRef(!1),i=p.useRef(!1);return(0,X.jsx)(Pp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Pp=p.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=yp(kp,n),p=_p(n);return ka(),(0,X.jsx)(ma,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,X.jsx)(ra,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,X.jsx)(bu,{"data-state":zp(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Fp=`PopoverClose`,Ip=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=yp(Fp,n);return(0,X.jsx)(ci.button,{type:`button`,...r,ref:t,onClick:vi(e.onClick,()=>i.onOpenChange(!1))})});Ip.displayName=Fp;var Lp=`PopoverArrow`,Rp=p.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=_p(n);return(0,X.jsx)(xu,{...i,...r,ref:t})});Rp.displayName=Lp;function zp(e){return e?`open`:`closed`}var Bp=bp,Vp=wp,Hp=Op,eee=Ap,Up=`Switch`,[tee,nee]=hi(Up),[ree,iee]=tee(Up),Wp=p.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,m]=p.useState(null),h=$r(t,e=>m(e)),g=p.useRef(!1),_=f?u||!!f.closest(`form`):!0,[v,y]=xi({prop:i,defaultProp:a??!1,onChange:l,caller:Up});return(0,X.jsxs)(ree,{scope:n,checked:v,disabled:s,children:[(0,X.jsx)(ci.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":Yp(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:h,onClick:vi(e.onClick,e=>{y(e=>!e),_&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),_&&(0,X.jsx)(Jp,{control:f,bubbles:!g.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});Wp.displayName=Up;var Gp=`SwitchThumb`,Kp=p.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=iee(Gp,n);return(0,X.jsx)(ci.span,{"data-state":Yp(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Kp.displayName=Gp;var qp=`SwitchBubbleInput`,Jp=p.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=p.useRef(null),s=$r(o,a),c=Ls(n),l=Rs(t);return p.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,X.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Jp.displayName=qp;function Yp(e){return e?`checked`:`unchecked`}var Xp=Wp,aee=Kp,Zp=`Tabs`,[oee,see]=hi(Zp,[ku]),Qp=ku(),[cee,$p]=oee(Zp),em=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Ji(s),[d,f]=xi({prop:r,onChange:i,defaultProp:a??``,caller:Zp});return(0,X.jsx)(cee,{scope:n,baseId:ji(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,X.jsx)(ci.div,{dir:u,"data-orientation":o,...l,ref:t})})});em.displayName=Zp;var tm=`TabsList`,nm=p.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=$p(tm,n),o=Qp(n);return(0,X.jsx)(Vu,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,X.jsx)(ci.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});nm.displayName=tm;var rm=`TabsTrigger`,im=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=$p(rm,n),s=Qp(n),c=sm(o.baseId,r),l=cm(o.baseId,r),u=r===o.value;return(0,X.jsx)(Hu,{asChild:!0,...s,focusable:!i,active:u,children:(0,X.jsx)(ci.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:vi(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:vi(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:vi(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});im.displayName=rm;var am=`TabsContent`,om=p.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=$p(am,n),c=sm(s.baseId,r),l=cm(s.baseId,r),u=r===s.value,d=p.useRef(u);return p.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,X.jsx)(Ti,{present:i||u,children:({present:n})=>(0,X.jsx)(ci.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});om.displayName=am;function sm(e,t){return`${e}-trigger-${t}`}function cm(e,t){return`${e}-content-${t}`}var lm=em,um=nm,dm=im,fm=om,pm=`Toggle`,mm=p.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=xi({prop:n,onChange:i,defaultProp:r??!1,caller:pm});return(0,X.jsx)(ci.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:vi(e.onClick,()=>{e.disabled||s(!o)})})});mm.displayName=pm;var hm=`ToggleGroup`,[gm,lee]=hi(hm,[ku]),_m=ku(),vm=p.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,X.jsx)(xm,{...r,ref:t});if(n===`multiple`)return(0,X.jsx)(Sm,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${hm}\``)});vm.displayName=hm;var[ym,bm]=gm(hm),xm=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=xi({prop:n,defaultProp:r??``,onChange:i,caller:hm});return(0,X.jsx)(ym,{scope:e.__scopeToggleGroup,type:`single`,value:p.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:p.useCallback(()=>s(``),[s]),children:(0,X.jsx)(Tm,{...a,ref:t})})}),Sm=p.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=xi({prop:n,defaultProp:r??[],onChange:i,caller:hm}),c=p.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=p.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,X.jsx)(ym,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,X.jsx)(Tm,{...a,ref:t})})});vm.displayName=hm;var[Cm,wm]=gm(hm),Tm=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=_m(n),u=Ji(o),d={role:`group`,dir:u,...c};return(0,X.jsx)(Cm,{scope:n,rovingFocus:i,disabled:r,children:i?(0,X.jsx)(Vu,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,X.jsx)(ci.div,{...d,ref:t})}):(0,X.jsx)(ci.div,{...d,ref:t})})}),Em=`ToggleGroupItem`,Dm=p.forwardRef((e,t)=>{let n=bm(Em,e.__scopeToggleGroup),r=wm(Em,e.__scopeToggleGroup),i=_m(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=p.useRef(null);return r.rovingFocus?(0,X.jsx)(Hu,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,X.jsx)(Om,{...s,ref:t})}):(0,X.jsx)(Om,{...s,ref:t})});Dm.displayName=Em;var Om=p.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=bm(Em,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,X.jsx)(mm,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),km=vm,Am=Dm,[jm,uee]=hi(`Tooltip`,[nu]),Mm=nu(),Nm=`TooltipProvider`,Pm=700,Fm=`tooltip.open`,[dee,Im]=jm(Nm),Lm=e=>{let{__scopeTooltip:t,delayDuration:n=Pm,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=p.useRef(!0),s=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,X.jsx)(dee,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:p.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Lm.displayName=Nm;var Rm=`Tooltip`,[fee,zm]=jm(Rm),Bm=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Im(Rm,e.__scopeTooltip),l=Mm(t),[u,d]=p.useState(null),f=ji(),m=p.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=p.useRef(!1),[v,y]=xi({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Fm))):c.onClose(),a?.(e)},caller:Rm}),b=p.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),S=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),C=p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return p.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,X.jsx)(vu,{...l,children:(0,X.jsx)(fee,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:p.useCallback(()=>{h?S():(window.clearTimeout(m.current),m.current=0)},[S,h]),onOpen:x,onClose:S,disableHoverableContent:h,children:n})})};Bm.displayName=Rm;var Vm=`TooltipTrigger`,Hm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=zm(Vm,n),a=Im(Vm,n),o=Mm(n),s=$r(t,p.useRef(null),i.onTriggerChange),c=p.useRef(!1),l=p.useRef(!1),u=p.useCallback(()=>c.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,X.jsx)(yu,{asChild:!0,...o,children:(0,X.jsx)(ci.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:vi(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:vi(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:vi(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:vi(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:vi(e.onBlur,i.onClose),onClick:vi(e.onClick,i.onClose)})})});Hm.displayName=Vm;var Um=`TooltipPortal`,[pee,mee]=jm(Um,{forceMount:void 0}),Wm=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=zm(Um,t);return(0,X.jsx)(pee,{scope:t,forceMount:n,children:(0,X.jsx)(Ti,{present:n||a.open,children:(0,X.jsx)(Da,{asChild:!0,container:i,children:r})})})};Wm.displayName=Um;var Gm=`TooltipContent`,Km=p.forwardRef((e,t)=>{let n=mee(Gm,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=zm(Gm,e.__scopeTooltip);return(0,X.jsx)(Ti,{present:r||o.open,children:o.disableHoverableContent?(0,X.jsx)(qm,{side:i,...a,ref:t}):(0,X.jsx)(hee,{side:i,...a,ref:t})})}),hee=p.forwardRef((e,t)=>{let n=zm(Gm,e.__scopeTooltip),r=Im(Gm,e.__scopeTooltip),i=p.useRef(null),a=$r(t,i),[o,s]=p.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=p.useCallback(()=>{s(null),d(!1)},[d]),m=p.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=bee(r,yee(r,n.getBoundingClientRect())),a=xee(t.getBoundingClientRect());s(Xm([...i,...a])),d(!0)},[d]);return p.useEffect(()=>()=>f(),[f]),p.useEffect(()=>{if(c&&u){let e=e=>m(e,u),t=e=>m(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,m,f]),p.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!See(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,X.jsx)(qm,{...e,ref:a})}),[gee,_ee]=jm(Rm,{isInside:!1}),vee=ii(`TooltipContent`),qm=p.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=zm(Gm,n),l=Mm(n),{onClose:u}=c;return p.useEffect(()=>(document.addEventListener(Fm,u),()=>document.removeEventListener(Fm,u)),[u]),p.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,X.jsx)(ra,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,X.jsxs)(bu,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.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:[(0,X.jsx)(vee,{children:r}),(0,X.jsx)(gee,{scope:n,isInside:!0,children:(0,X.jsx)(pi,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Km.displayName=Gm;var Jm=`TooltipArrow`,Ym=p.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Mm(n);return _ee(Jm,n).isInside?null:(0,X.jsx)(xu,{...i,...r,ref:t})});Ym.displayName=Jm;function yee(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function bee(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function xee(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function See(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Xm(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Zm(t)}function Zm(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Qm=Lm,$m=Bm,eh=Hm,th=Wm,nh=Km,rh=Ym,ih=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ah=(e,t)=>({classGroupId:e,validator:t}),oh=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),sh=`-`,ch=[],lh=`arbitrary..`,uh=e=>{let t=ph(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return fh(e);let n=e.split(sh);return dh(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ih(i,t):t:i||ch}return n[e]||ch}}},dh=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=dh(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(sh):e.slice(t).join(sh),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},fh=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?lh+r:void 0})(),ph=e=>{let{theme:t,classGroups:n}=e;return mh(n,t)},mh=(e,t)=>{let n=oh();for(let r in e){let i=e[r];hh(i,n,r,t)}return n},hh=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];gh(i,t,n,r)}},gh=(e,t,n,r)=>{if(typeof e==`string`){_h(e,t,n);return}if(typeof e==`function`){vh(e,t,n,r);return}yh(e,t,n,r)},_h=(e,t,n)=>{let r=e===``?t:bh(t,e);r.classGroupId=n},vh=(e,t,n,r)=>{if(xh(e)){hh(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ah(n,e))},yh=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];hh(o,bh(t,a),n,r)}},bh=(e,t)=>{let n=e,r=t.split(sh),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=oh(),n.nextPart.set(t,i)),n=i}return n},xh=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Sh=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ch=`!`,wh=`:`,Th=[],Eh=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Dh=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===wh){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ch)?(c=s.slice(0,-1),l=!0):s.startsWith(Ch)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Eh(t,l,c,u)};if(t){let e=t+wh,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Eh(Th,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Oh=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},kh=e=>({cache:Sh(e.cacheSize),parseClassName:Dh(e),sortModifiers:Oh(e),...uh(e)}),Ah=/\s+/,jh=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Ah),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Ch:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Mh=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Nh(n))&&(i&&(i+=` `),i+=r);return i},Nh=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Nh(e[r]))&&(n&&(n+=` `),n+=t);return n},Ph=(e,...t)=>{let n,r,i,a,o=o=>(n=kh(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=jh(e,n);return i(e,a),a};return a=o,(...e)=>a(Mh(...e))},Fh=[],Ih=e=>{let t=t=>t[e]||Fh;return t.isThemeGetter=!0,t},Lh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Rh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Bh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Uh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gh=e=>zh.test(e),Kh=e=>!!e&&!Number.isNaN(Number(e)),qh=e=>!!e&&Number.isInteger(Number(e)),Jh=e=>e.endsWith(`%`)&&Kh(e.slice(0,-1)),Yh=e=>Bh.test(e),Xh=()=>!0,Zh=e=>Vh.test(e)&&!Hh.test(e),Qh=()=>!1,$h=e=>Uh.test(e),eg=e=>Wh.test(e),tg=e=>!rg(e)&&!dg(e),ng=e=>yg(e,Cg,Qh),rg=e=>Lh.test(e),ig=e=>yg(e,wg,Zh),ag=e=>yg(e,Cee,Kh),og=e=>yg(e,Eg,Xh),sg=e=>yg(e,Tg,Qh),cg=e=>yg(e,xg,Qh),lg=e=>yg(e,Sg,eg),ug=e=>yg(e,Dg,$h),dg=e=>Rh.test(e),fg=e=>bg(e,wg),pg=e=>bg(e,Tg),mg=e=>bg(e,xg),hg=e=>bg(e,Cg),gg=e=>bg(e,Sg),_g=e=>bg(e,Dg,!0),vg=e=>bg(e,Eg,!0),yg=(e,t,n)=>{let r=Lh.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},bg=(e,t,n=!1)=>{let r=Rh.exec(e);return r?r[1]?t(r[1]):n:!1},xg=e=>e===`position`||e===`percentage`,Sg=e=>e===`image`||e===`url`,Cg=e=>e===`length`||e===`size`||e===`bg-size`,wg=e=>e===`length`,Cee=e=>e===`number`,Tg=e=>e===`family-name`,Eg=e=>e===`number`||e===`weight`,Dg=e=>e===`shadow`,wee=Ph(()=>{let e=Ih(`color`),t=Ih(`font`),n=Ih(`text`),r=Ih(`font-weight`),i=Ih(`tracking`),a=Ih(`leading`),o=Ih(`breakpoint`),s=Ih(`container`),c=Ih(`spacing`),l=Ih(`radius`),u=Ih(`shadow`),d=Ih(`inset-shadow`),f=Ih(`text-shadow`),p=Ih(`drop-shadow`),m=Ih(`blur`),h=Ih(`perspective`),g=Ih(`aspect`),_=Ih(`ease`),v=Ih(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),dg,rg],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[dg,rg,c],T=()=>[Gh,`full`,`auto`,...w()],E=()=>[qh,`none`,`subgrid`,dg,rg],D=()=>[`auto`,{span:[`full`,qh,dg,rg]},qh,dg,rg],O=()=>[qh,`auto`,dg,rg],k=()=>[`auto`,`min`,`max`,`fr`,dg,rg],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Gh,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Gh,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Gh,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,dg,rg],L=()=>[...b(),mg,cg,{position:[dg,rg]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],z=()=>[`auto`,`cover`,`contain`,hg,ng,{size:[dg,rg]}],ee=()=>[Jh,fg,ig],B=()=>[``,`none`,`full`,l,dg,rg],V=()=>[``,Kh,fg,ig],te=()=>[`solid`,`dashed`,`dotted`,`double`],H=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],U=()=>[Kh,Jh,mg,cg],ne=()=>[``,`none`,m,dg,rg],re=()=>[`none`,Kh,dg,rg],ie=()=>[`none`,Kh,dg,rg],ae=()=>[Kh,dg,rg],oe=()=>[Gh,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Yh],breakpoint:[Yh],color:[Xh],container:[Yh],"drop-shadow":[Yh],ease:[`in`,`out`,`in-out`],font:[tg],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Yh],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Yh],shadow:[Yh],spacing:[`px`,Kh],text:[Yh],"text-shadow":[Yh],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Gh,rg,dg,g]}],container:[`container`],columns:[{columns:[Kh,rg,dg,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[qh,`auto`,dg,rg]}],basis:[{basis:[Gh,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Kh,Gh,`auto`,`initial`,`none`,rg]}],grow:[{grow:[``,Kh,dg,rg]}],shrink:[{shrink:[``,Kh,dg,rg]}],order:[{order:[qh,`first`,`last`,`none`,dg,rg]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,fg,ig]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,vg,og]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Jh,rg]}],"font-family":[{font:[pg,sg,t]}],"font-features":[{"font-features":[rg]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,dg,rg]}],"line-clamp":[{"line-clamp":[Kh,`none`,dg,ag]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,dg,rg]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,dg,rg]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...te(),`wavy`]}],"text-decoration-thickness":[{decoration:[Kh,`from-font`,`auto`,dg,ig]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Kh,`auto`,dg,rg]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,dg,rg]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,dg,rg]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:z()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},qh,dg,rg],radial:[``,dg,rg],conic:[qh,dg,rg]},gg,lg]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":V()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...te(),`hidden`,`none`]}],"divide-style":[{divide:[...te(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...te(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Kh,dg,rg]}],"outline-w":[{outline:[``,Kh,fg,ig]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,_g,ug]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,_g,ug]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Kh,ig]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,_g,ug]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Kh,dg,rg]}],"mix-blend":[{"mix-blend":[...H(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":H()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Kh]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[dg,rg]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Kh]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,dg,rg]}],filter:[{filter:[``,`none`,dg,rg]}],blur:[{blur:ne()}],brightness:[{brightness:[Kh,dg,rg]}],contrast:[{contrast:[Kh,dg,rg]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,_g,ug]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Kh,dg,rg]}],"hue-rotate":[{"hue-rotate":[Kh,dg,rg]}],invert:[{invert:[``,Kh,dg,rg]}],saturate:[{saturate:[Kh,dg,rg]}],sepia:[{sepia:[``,Kh,dg,rg]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,dg,rg]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Kh,dg,rg]}],"backdrop-contrast":[{"backdrop-contrast":[Kh,dg,rg]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Kh,dg,rg]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Kh,dg,rg]}],"backdrop-invert":[{"backdrop-invert":[``,Kh,dg,rg]}],"backdrop-opacity":[{"backdrop-opacity":[Kh,dg,rg]}],"backdrop-saturate":[{"backdrop-saturate":[Kh,dg,rg]}],"backdrop-sepia":[{"backdrop-sepia":[``,Kh,dg,rg]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,dg,rg]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Kh,`initial`,dg,rg]}],ease:[{ease:[`linear`,`initial`,_,dg,rg]}],delay:[{delay:[Kh,dg,rg]}],animate:[{animate:[`none`,v,dg,rg]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,dg,rg]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[dg,rg,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,dg,rg]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,dg,rg]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Kh,fg,ig,ag]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}}),Z=(...e)=>wee(qr(e)),Tee=Xr(`inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-xl border text-sm font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`border-primary/60 bg-primary text-primary-foreground shadow-[0_8px_24px_rgba(108,63,217,0.28)] hover:bg-primary/92 hover:border-primary/70`,outline:`border-border bg-card/80 text-foreground hover:bg-accent hover:text-accent-foreground`,secondary:`border-border bg-secondary text-secondary-foreground hover:bg-secondary/85`,ghost:`border-transparent bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,destructive:`border-red-500/30 bg-destructive/15 text-red-200 hover:bg-destructive/25`,success:`border-emerald-300/80 bg-emerald-400 text-[#07130d] shadow-[0_10px_30px_rgba(16,185,129,0.28)] hover:border-emerald-200 hover:bg-emerald-300`,warning:`border-amber-500/30 bg-amber-500/12 text-amber-200 hover:bg-amber-500/20`,link:`border-transparent px-0 text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4`,xs:`h-7 px-2.5 text-xs`,sm:`h-8 px-3 text-sm`,lg:`h-11 px-5 text-sm`,icon:`size-10`,"icon-xs":`size-7 [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8`,"icon-lg":`size-11`}},defaultVariants:{variant:`default`,size:`default`}}),Q=({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i})=>(0,X.jsx)(r?ti:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Z(Tee({variant:t,size:n,className:e})),...i}),Og=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Eee=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Dee=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),kg=e=>{let t=Dee(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ag={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`},Oee=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},kee=(0,p.createContext)({}),Aee=()=>(0,p.useContext)(kee),jee=(0,p.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:m=``}=Aee()??{},h=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,p.createElement)(`svg`,{ref:c,...Ag,width:t??l??Ag.width,height:t??l??Ag.height,stroke:e??f,strokeWidth:h,className:Og(`lucide`,m,i),...!a&&!Oee(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,p.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),jg=(e,t)=>{let n=(0,p.forwardRef)(({className:n,...r},i)=>(0,p.createElement)(jee,{ref:i,iconNode:t,className:Og(`lucide-${Eee(kg(e))}`,`lucide-${e}`,n),...r}));return n.displayName=kg(e),n},Mg=jg(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),Mee=jg(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Nee=jg(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Pee=jg(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Fee=jg(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Iee=jg(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Lee=jg(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Ree=jg(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Ng=jg(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Pg=jg(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),zee=jg(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Bee=jg(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),Vee=jg(`copy`,[[`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`}]]),Hee=jg(`crosshair`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]),Uee=jg(`ellipsis-vertical`,[[`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`}]]),Wee=jg(`external-link`,[[`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`}]]),Gee=jg(`file-code`,[[`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 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Kee=jg(`file-text`,[[`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`}]]),qee=jg(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),Jee=jg(`flask-conical`,[[`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`}]]),Yee=jg(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Xee=jg(`folder`,[[`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`}]]),Zee=jg(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Fg=jg(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Qee=jg(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),$ee=jg(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ete=jg(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),tte=jg(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),nte=jg(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),rte=jg(`list-checks`,[[`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`}]]),ite=jg(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ate=jg(`log-out`,[[`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`}]]),ote=jg(`maximize-2`,[[`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`}]]),ste=jg(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),cte=jg(`minimize-2`,[[`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`}]]),lte=jg(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ute=jg(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),dte=jg(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),fte=jg(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),pte=jg(`pencil`,[[`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`}]]),mte=jg(`play`,[[`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`}]]),hte=jg(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),gte=jg(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),_te=jg(`refresh-cw`,[[`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`}]]),vte=jg(`rotate-ccw`,[[`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`}]]),yte=jg(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Ig=jg(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),bte=jg(`settings`,[[`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`}]]),xte=jg(`square-kanban`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 7v7`,key:`1x2jlm`}],[`path`,{d:`M12 7v4`,key:`xawao1`}],[`path`,{d:`M16 7v9`,key:`1hp2iy`}]]),Ste=jg(`square-mouse-pointer`,[[`path`,{d:`M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z`,key:`xwnzip`}],[`path`,{d:`M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6`,key:`14rsvq`}]]),Cte=jg(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),wte=jg(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Lg=jg(`trash-2`,[[`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`}]]),Rg=jg(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),zg=jg(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Bg=1,Tte=.9,Ete=.8,Dte=.17,Vg=.1,Hg=.999,Ote=.9999,kte=.99,Ate=/[\\\/_+.#"@\[\(\{&]/,jte=/[\\\/_+.#"@\[\(\{&]/g,Mte=/[\s-]/,Ug=/[\s-]/g;function Wg(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Bg:kte;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Wg(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Bg:Ate.test(e.charAt(l-1))?(d*=Ete,p=e.slice(i,l-1).match(jte),p&&i>0&&(d*=Hg**+p.length)):Mte.test(e.charAt(l-1))?(d*=Tte,m=e.slice(i,l-1).match(Ug),m&&i>0&&(d*=Hg**+m.length)):(d*=Dte,i>0&&(d*=Hg**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Ote)),(d<Vg&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Wg(e,t,n,r,l+1,a+2,o),f*Vg>d&&(d=f*Vg)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Gg(e){return e.toLowerCase().replace(Ug,` `)}function Nte(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Wg(e,t,Gg(e),Gg(t),0,0,{})}var Kg=`[cmdk-group=""]`,qg=`[cmdk-group-items=""]`,Jg=`[cmdk-group-heading=""]`,Yg=`[cmdk-item=""]`,Xg=`${Yg}:not([aria-disabled="true"])`,Zg=`cmdk-item-select`,Qg=`data-value`,$g=(e,t,n)=>Nte(e,t,n),e_=p.createContext(void 0),t_=()=>p.useContext(e_),n_=p.createContext(void 0),r_=()=>p.useContext(n_),i_=p.createContext(void 0),a_=p.forwardRef((e,t)=>{let n=v_(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=v_(()=>new Set),i=v_(()=>new Map),a=v_(()=>new Map),o=v_(()=>new Set),s=g_(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,y=ji(),b=ji(),x=ji(),S=p.useRef(null),C=Fte();__(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),__(()=>{C(6,A)},[]);let w=p.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=p.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??$g;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(qg);t?t.appendChild(e.parentElement===t?e:e.closest(`${qg} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${qg} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${Kg}[${Qg}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Qg);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Kg)?.querySelector(Jg))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${Yg}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(Xg)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(Qg))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(Qg))}function F(e){let t=j()?.closest(Kg),n;for(;t&&!n;)t=e>0?h_(t,Kg):Pte(t,Kg),n=t?.querySelector(Xg);n?w.setState(`value`,n.getAttribute(Qg)):P(e)}let I=()=>N(M().length-1),L=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},R=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return p.createElement(ci.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:_&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:_&&e.ctrlKey&&R(e);break;case`ArrowUp`:R(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(Zg);t.dispatchEvent(e)}}}}},p.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Lte},c),x_(e,e=>p.createElement(n_.Provider,{value:w},p.createElement(e_.Provider,{value:T},e))))}),o_=p.forwardRef((e,t)=>{let n=ji(),r=p.useRef(null),i=p.useContext(i_),a=t_(),o=g_(e),s=o.current?.forceMount??i?.forceMount;__(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=b_(n,r,[e.value,e.children,r],e.keywords),l=r_(),u=y_(e=>e.value&&e.value===c.current),d=y_(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);p.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Zg,f),()=>t.removeEventListener(Zg,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;m(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function m(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:h,value:g,onSelect:_,forceMount:v,keywords:y,...b}=e;return p.createElement(ci.div,{ref:Qr(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:f},e.children)}),s_=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=ji(),s=p.useRef(null),c=p.useRef(null),l=ji(),u=t_(),d=y_(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);__(()=>u.group(o),[]),b_(o,s,[e.value,e.heading,c]);let f=p.useMemo(()=>({id:o,forceMount:i}),[i]);return p.createElement(ci.div,{ref:Qr(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&p.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),x_(e,e=>p.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},p.createElement(i_.Provider,{value:f},e))))}),c_=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=p.useRef(null),a=y_(e=>!e.search);return!n&&!a?null:p.createElement(ci.div,{ref:Qr(i,t),...r,"cmdk-separator":``,role:`separator`})}),l_=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=r_(),o=y_(e=>e.search),s=y_(e=>e.selectedItemId),c=t_();return p.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),p.createElement(ci.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),u_=p.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=p.useRef(null),o=p.useRef(null),s=y_(e=>e.selectedItemId),c=t_();return p.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),p.createElement(ci.div,{ref:Qr(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},x_(e,e=>p.createElement(`div`,{ref:Qr(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),d_=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return p.createElement(As,{open:n,onOpenChange:r},p.createElement(js,{container:o},p.createElement(Ms,{"cmdk-overlay":``,className:i}),p.createElement(Ns,{"aria-label":e.label,"cmdk-dialog":``,className:a},p.createElement(a_,{ref:t,...s}))))}),f_=p.forwardRef((e,t)=>y_(e=>e.filtered.count===0)?p.createElement(ci.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),p_=p.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return p.createElement(ci.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},x_(e,e=>p.createElement(`div`,{"aria-hidden":!0},e)))}),m_=Object.assign(a_,{List:u_,Item:o_,Input:l_,Group:s_,Separator:c_,Dialog:d_,Empty:f_,Loading:p_});function h_(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Pte(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function g_(e){let t=p.useRef(e);return __(()=>{t.current=e}),t}var __=typeof window>`u`?p.useEffect:p.useLayoutEffect;function v_(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function y_(e){let t=r_(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function b_(e,t,n,r=[]){let i=p.useRef(),a=t_();return __(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Qg,s),i.current=s}),i}var Fte=()=>{let[e,t]=p.useState(),n=v_(()=>new Map);return __(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ite(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function x_({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Ite(t),{ref:t.ref},n(t.props.children)):n(t)}var Lte={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},S_=e=>(0,X.jsx)(As,{"data-slot":`dialog`,...e}),Rte=e=>(0,X.jsx)(js,{"data-slot":`dialog-portal`,...e}),C_=e=>(0,X.jsx)(Is,{"data-slot":`dialog-close`,...e}),zte=({className:e,...t})=>(0,X.jsx)(Ms,{"data-slot":`dialog-overlay`,"data-archon-modal":`true`,className:Z(`fixed inset-0 isolate z-50 bg-black/70 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t}),w_=({className:e,children:t,showCloseButton:n=!0,overlayClassName:r,...i})=>(0,X.jsxs)(Rte,{children:[(0,X.jsx)(zte,{className:r}),(0,X.jsxs)(Ns,{"data-slot":`dialog-content`,"data-archon-modal":`true`,className:Z(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-2xl border border-border bg-card p-6 text-sm text-card-foreground shadow-2xl shadow-black/30 duration-100 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...i,children:[t,n&&(0,X.jsx)(Is,{"data-slot":`dialog-close`,asChild:!0,children:(0,X.jsxs)(Q,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`,children:[(0,X.jsx)(zg,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]}),T_=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`dialog-header`,className:Z(`flex flex-col gap-1.5`,e),...t}),E_=({className:e,showCloseButton:t=!1,children:n,...r})=>(0,X.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Z(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,X.jsx)(Is,{asChild:!0,children:(0,X.jsx)(Q,{variant:`outline`,children:`Close`})})]}),D_=({className:e,...t})=>(0,X.jsx)(Ps,{"data-slot":`dialog-title`,className:Z(`font-heading text-base leading-none font-medium`,e),...t}),O_=({className:e,...t})=>(0,X.jsx)(Fs,{"data-slot":`dialog-description`,className:Z(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t}),k_=(0,p.forwardRef)(({className:e,type:t,...n},r)=>(0,X.jsx)(`input`,{ref:r,type:t,"data-slot":`input`,className:Z(`h-10 w-full min-w-0 rounded-xl border border-input bg-input/40 px-3 py-2 text-sm text-foreground transition-[border-color,box-shadow,background-color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20`,e),...n})),A_=(0,p.forwardRef)(({className:e,...t},n)=>(0,X.jsx)(`textarea`,{ref:n,"data-slot":`textarea`,className:Z(`flex min-h-24 w-full resize-none rounded-xl border border-input bg-input/40 px-3 py-2.5 text-sm text-foreground transition-[border-color,box-shadow,background-color] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20`,e),...t}));A_.displayName=`Textarea`;function j_({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:Z(`group/input-group relative flex h-9 w-full min-w-0 items-center rounded-4xl border border-transparent bg-input/50 transition-[color,box-shadow,background-color] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-3xl has-data-[align=block-start]:rounded-3xl has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-2xl has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var Bte=Xr(`flex h-auto cursor-text items-center justify-center gap-2 py-2 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-3xl **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1.5 [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-3 has-[>button]:-ml-1 has-[>kbd]:-ml-1`,"inline-end":`order-last pr-3 has-[>button]:-mr-1 has-[>kbd]:-mr-1`,"block-start":`order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-3.5 [.border-b]:pb-3.5`,"block-end":`order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-3.5 [.border-t]:pt-3.5`}},defaultVariants:{align:`inline-start`}});function M_({className:e,align:t=`inline-start`,...n}){return(0,X.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:Z(Bte({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var Vte=Xr(`flex items-center gap-2 rounded-4xl text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-xl px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-xl p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function Hte({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,X.jsx)(Q,{type:t,"data-size":r,variant:n,className:Z(Vte({size:r}),e),...i})}function Ute({className:e,...t}){return(0,X.jsx)(k_,{"data-slot":`input-group-control`,className:Z(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function N_({className:e,...t}){return(0,X.jsx)(m_,{"data-slot":`command`,className:Z(`flex size-full flex-col overflow-hidden rounded-4xl bg-popover p-1 text-popover-foreground`,e),...t})}function P_({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,X.jsxs)(j_,{className:`h-9 bg-input/50`,children:[(0,X.jsx)(m_.Input,{"data-slot":`command-input`,className:Z(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,X.jsx)(M_,{children:(0,X.jsx)(Ig,{className:`size-4 shrink-0 opacity-50`})})]})})}function F_({className:e,...t}){return(0,X.jsx)(m_.List,{"data-slot":`command-list`,className:Z(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),onWheelCapture:e=>{e.stopPropagation(),t.onWheelCapture?.(e)},...t})}function I_({className:e,...t}){return(0,X.jsx)(m_.Empty,{"data-slot":`command-empty`,className:Z(`py-6 text-center text-sm`,e),...t})}function L_({className:e,...t}){return(0,X.jsx)(m_.Group,{"data-slot":`command-group`,className:Z(`overflow-hidden p-1.5 text-foreground **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-2 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function R_({className:e,children:t,...n}){return(0,X.jsxs)(m_.Item,{"data-slot":`command-item`,className:Z(`group/command-item relative flex cursor-pointer items-center gap-2 rounded-2xl px-3 py-2 text-sm font-medium outline-hidden select-none in-data-[slot=dialog-content]:rounded-3xl data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,X.jsx)(Ng,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function z_({className:e,...t}){return(0,X.jsx)(pp,{"data-slot":`label`,className:Z(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var B_=e=>(0,X.jsx)(Bp,{"data-slot":`popover`,...e}),V_=e=>(0,X.jsx)(Vp,{"data-slot":`popover-trigger`,...e}),H_=({className:e,align:t=`center`,sideOffset:n=4,...r})=>(0,X.jsx)(Hp,{children:(0,X.jsx)(eee,{"data-slot":`popover-content`,align:t,sideOffset:n,className:Z(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2 rounded-xl border border-border bg-popover p-2 text-sm text-popover-foreground shadow-2xl shadow-black/30 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})}),U_=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`popover-header`,className:Z(`flex flex-col gap-1 text-sm`,e),...t}),W_=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`popover-title`,className:Z(`font-heading text-base font-medium`,e),...t}),G_=/[\s\-_/.:]+/,K_=/\d(?:[._:-]*\d)+/g,q_=e=>e.toLowerCase().trim().split(G_).filter(Boolean),J_=(e,t)=>t===e?300:t.startsWith(e)?200:e.length>=3&&t.includes(e)?100:0,Y_=e=>(e.toLowerCase().match(K_)??[]).map(e=>e.replace(/\D/g,``)).filter(e=>e.length>=2),X_=e=>/^\d+$/.test(e),Z_=(e,t)=>{let n=0;for(let r of t){if(r===e){n=Math.max(n,250);continue}r.startsWith(e)&&(n=Math.max(n,150))}return n},Q_=(e,t)=>{let n=q_(e);if(n.length===0)return 1;let r=t.flatMap(e=>q_(e??``)),i=[...new Set(t.flatMap(e=>Y_(e??``)))];if(r.length===0&&i.length===0)return 0;let a=0;for(let e of n){let t=0;for(let n of r){let r=J_(e,n);r>t&&(t=r)}if(t===0&&X_(e)&&(t=Z_(e,i)),t===0)return 0;a+=t}return a},$_=({label:e,triggerLabel:t,triggerAriaLabel:n,selectId:r,groups:i,disabled:a=!1,className:o,labelClassName:s,contentClassName:c,triggerClassName:l,isSelected:u,onSelect:d,closeOnSelect:f=!0})=>{let[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(!1),v=(0,p.useRef)(null),y=i.reduce((e,t)=>e+t.options.length,0)>4,b=(0,p.useCallback)(()=>{let e=v.current?.getBoundingClientRect();if(!e)return!1;let t=window.innerHeight-e.bottom-16,n=e.top-16;return t<320&&n>t},[]);return(0,p.useEffect)(()=>{if(!m)return;let e=()=>{_(b())};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[b,m]),(0,X.jsxs)(`div`,{className:Z(`flex flex-col gap-1.5`,o),children:[e&&(0,X.jsx)(z_,{className:Z(`text-xs font-medium text-muted-foreground`,s),htmlFor:r,children:e}),(0,X.jsxs)(B_,{open:m,onOpenChange:e=>{e&&_(b()),h(e)},children:[(0,X.jsx)(`div`,{className:`relative`,ref:v,children:(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsxs)(Q,{id:r,type:`button`,variant:`outline`,"aria-label":n??t,disabled:a,className:Z(`w-full justify-between bg-input/40 px-3 text-left font-normal`,l),children:[(0,X.jsx)(`span`,{className:`truncate`,children:t}),(0,X.jsx)(Pg,{className:`h-4 w-4 text-muted-foreground`})]})})}),(0,X.jsx)(H_,{side:g?`top`:`bottom`,align:`start`,className:Z(`w-[var(--radix-popover-trigger-width)] p-0`,c),children:(0,X.jsxs)(N_,{filter:(e,t,n)=>Q_(t,[e,...n??[]]),children:[y&&(0,X.jsx)(P_,{placeholder:`Filter...`}),(0,X.jsxs)(F_,{className:`max-h-72`,children:[(0,X.jsx)(I_,{children:`No matches`}),i.map((e,t)=>e.options.length===0?null:(0,X.jsx)(L_,{heading:e.label||void 0,className:Z(e.label?`border-t border-border/60 first:border-t-0 first:pt-0`:``),children:e.options.map(t=>(0,X.jsx)(R_,{value:`${t.label} ${t.value}`,keywords:[t.label,t.value,e.label],disabled:t.disabled,"data-checked":u(t.value),onSelect:()=>{t.disabled||(d(t.value),f&&h(!1))},children:(0,X.jsx)(`span`,{className:`truncate`,children:t.label})},t.value))},e.label||`group-${t}`))]})]})})]})]})},ev=({label:e,triggerLabel:t,triggerAriaLabel:n,selectId:r,groups:i,selectedValue:a,onChange:o,disabled:s=!1,className:c,labelClassName:l,contentClassName:u,triggerClassName:d})=>(0,X.jsx)($_,{label:e,triggerLabel:t,triggerAriaLabel:n,selectId:r,groups:i,disabled:s,className:c,labelClassName:l,contentClassName:u,triggerClassName:d,isSelected:e=>a===e,onSelect:o}),tv=({model:e,showModelSelector:t,availableModels:n,onModelChange:r,selectId:i,label:a=`Model`,triggerAriaLabel:o,disabled:s=!1,className:c,triggerClassName:l,defaultModelLabel:u=`Use default model`,selectedValueLabel:d,notice:f})=>{let m=(0,p.useMemo)(()=>{let e=new Map;for(let t of n){let n=t.provider;e.has(n)||e.set(n,[]),e.get(n)?.push({value:t.id,label:t.label})}return Array.from(e.entries()).map(([e,t])=>({provider:e,models:t}))},[n]),h=d??(e||u);return!t&&!f?null:(0,X.jsxs)(`div`,{className:Z(c),children:[t&&(0,X.jsx)(ev,{label:a,triggerLabel:h,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:u}]},...m.map(e=>({label:e.provider,options:e.models}))]}),f]})},nv=({variant:e,selectedModel:t,showVariantSelector:n,onVariantChange:r,selectId:i,label:a=`Variant`,triggerAriaLabel:o,disabled:s=!1,className:c,triggerClassName:l,defaultVariantLabel:u=`Use model default`,availableVariantsLabel:d=`Available levels`,unavailableVariant:f,unavailableSelectionLabel:p=`Unavailable`})=>{if(!n||!t)return null;let m=f===e?`${e} (${p})`:e||u;return(0,X.jsx)(`div`,{className:Z(c),children:(0,X.jsx)(ev,{label:a,triggerLabel:m,triggerAriaLabel:o,selectId:i,selectedValue:e,onChange:r,disabled:s,contentClassName:`min-w-[22rem]`,triggerClassName:l,groups:[{label:``,options:[{value:``,label:u}]},{label:d,options:t.variants.map(e=>({value:e,label:e===f?`${e} (${p})`:e}))}]})})},rv=({model:e,variant:t,availableModels:n,isLoadingModels:r,onModelChange:i,onVariantChange:a,modelSelectId:o,variantSelectId:s,title:c,description:l,loadingDescription:u,unavailableDescription:d,modelLabel:f,variantLabel:p,defaultModelLabel:m,defaultVariantLabel:h,availableVariantsLabel:g,unavailableSelectionLabel:_,className:v,compact:y=!1,showHeader:b=!0,disabled:x=!1})=>{let S=n.find(t=>t.id===e)??null,C=!!(e&&!S),w=!!(t&&(!S||!S.variants.includes(t))),T=C?[{id:e,label:`${e} (${_})`,provider:``,supports_reasoning:!1,variants:t?[t]:[]},...n]:n,E=T.find(t=>t.id===e)??null,D=E&&w&&!E.variants.includes(t)?{...E,variants:[...E.variants,t]}:E,O=T.length>0,k=D!==null&&D.variants.length>0;return(0,X.jsxs)(`div`,{className:Z(`rounded-2xl border border-border/70 bg-background/25 p-4`,v),children:[b&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:c}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:l})]}),r?(0,X.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,b&&`mt-4`),children:u}):O?(0,X.jsxs)(`div`,{className:Z(b&&`mt-4`,`gap-3`,y?`flex flex-col`:`flex flex-wrap`),children:[(0,X.jsx)(tv,{model:e,showModelSelector:!0,availableModels:T,onModelChange:i,selectId:o,label:f,defaultModelLabel:m,selectedValueLabel:C?`${e} (${_})`:void 0,disabled:x,className:y?`min-w-0`:`min-w-[10rem] flex-[1.35_1_10rem]`}),k&&(0,X.jsx)(nv,{variant:t,selectedModel:D,showVariantSelector:!0,onVariantChange:a,selectId:s,label:p,defaultVariantLabel:h,availableVariantsLabel:g,unavailableVariant:w?t:void 0,unavailableSelectionLabel:_,disabled:x,className:y?`min-w-0`:`min-w-[7rem] flex-[0.7_1_7rem]`})]}):(0,X.jsx)(`p`,{className:Z(`text-sm text-muted-foreground`,b&&`mt-4`),children:d})]})},iv=({helperModel:e,helperVariant:t,availableModels:n,isLoadingModels:r,onHelperModelChange:i,onHelperVariantChange:a,modelSelectId:o,variantSelectId:s,className:c,compact:l=!1,showHeader:u=!0})=>{let{t:d}=K(`projects`);return(0,X.jsx)(rv,{model:e,variant:t,availableModels:n,isLoadingModels:r,onModelChange:i,onVariantChange:a,modelSelectId:o,variantSelectId:s,title:d(`advanced.helperModel.title`),description:d(`advanced.helperModel.panelDescription`),loadingDescription:d(`advanced.modelSelection.loading`),unavailableDescription:d(`advanced.helperModel.unavailable`),modelLabel:d(`advanced.modelSelection.modelLabel`),variantLabel:d(`advanced.modelSelection.variantLabel`),defaultModelLabel:d(`advanced.modelSelection.defaultModel`),defaultVariantLabel:d(`advanced.modelSelection.defaultVariant`),availableVariantsLabel:d(`advanced.modelSelection.availableVariants`),unavailableSelectionLabel:d(`advanced.modelSelection.unavailableSelection`),className:c,compact:l,showHeader:u})},av=({delayDuration:e=0,...t})=>(0,X.jsx)(Qm,{"data-slot":`tooltip-provider`,delayDuration:e,...t}),ov=e=>(0,X.jsx)($m,{"data-slot":`tooltip`,...e}),sv=e=>(0,X.jsx)(eh,{"data-slot":`tooltip-trigger`,...e}),cv=({className:e,sideOffset:t=8,children:n,...r})=>(0,X.jsx)(th,{children:(0,X.jsxs)(nh,{"data-slot":`tooltip-content`,sideOffset:t,className:Z(`pointer-events-none z-[100] inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) select-none items-center gap-1.5 rounded-md border border-sky-500/20 bg-popover px-2.5 py-1.5 text-xs font-medium text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,X.jsx)(rh,{className:`fill-popover`})]})}),lv=({content:e,children:t,align:n,side:r,sideOffset:i,disabled:a=!1,contentClassName:o,delayDuration:s=0})=>(0,X.jsx)(av,{delayDuration:s,disableHoverableContent:!0,children:(0,X.jsxs)(ov,{children:[(0,X.jsx)(sv,{asChild:!0,children:t}),a?null:(0,X.jsx)(cv,{className:o,align:n,side:r,sideOffset:i??8,children:e})]})}),uv=({value:e,items:t,onChange:n,disabled:r=!1,className:i})=>(0,X.jsx)(`div`,{className:Z(`inline-flex items-center gap-1 rounded-xl border border-border/70 bg-background/70 p-1 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]`,i),children:t.map(t=>{let i=t.value===e,a=(0,X.jsx)(Q,{type:`button`,variant:i?t.activeVariant??`default`:`ghost`,size:`sm`,disabled:r,className:Z(`h-7 rounded-lg px-2.5 text-xs`,i?t.activeClassName:t.inactiveClassName??`text-muted-foreground hover:text-foreground`),onClick:()=>n(t.value),children:t.label},t.value);return i||!t.inactiveTooltip||r?a:(0,X.jsx)(lv,{content:t.inactiveTooltip,children:a},t.value)})}),dv=({activeTool:e,agents:t,onChange:n})=>(0,X.jsx)(uv,{value:e,items:t.map(e=>({value:e.id,label:e.displayName})),onChange:n}),fv=({activeTool:e,agents:t=[],availableHelperModels:n,helperModel:r,helperVariant:i,isHelperModelsLoaded:a,isToolLoaded:o,onCreateProject:s,onHelperModelChange:c,onHelperVariantChange:l,onToolChange:u})=>{let{t:d}=K(`common`);return(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-10`,children:(0,X.jsxs)(`div`,{className:`w-full max-w-3xl overflow-hidden rounded-[2rem] border border-border bg-[radial-gradient(circle_at_top_left,_rgba(52,211,153,0.18),_transparent_42%),linear-gradient(160deg,_rgba(20,24,34,1),_rgba(10,12,18,1))] p-8 shadow-2xl shadow-black/20 sm:p-10`,children:[(0,X.jsx)(`h2`,{className:`max-w-xl text-3xl font-semibold tracking-tight text-foreground sm:text-4xl`,children:d(`emptyState.title`)}),(0,X.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3`,children:[(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`emptyState.description`)}),o?(0,X.jsx)(`div`,{className:`w-fit`,children:(0,X.jsx)(dv,{activeTool:e,agents:t,onChange:u})}):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`emptyState.loadingToolPreference`)}),(0,X.jsx)(iv,{helperModel:r,helperVariant:i,availableModels:n,isLoadingModels:!a,onHelperModelChange:c,onHelperVariantChange:l,modelSelectId:`welcome-helper-model`,variantSelectId:`welcome-helper-variant`,compact:!0})]}),(0,X.jsx)(`div`,{className:`mt-8 flex flex-col gap-3 sm:flex-row sm:items-center`,children:(0,X.jsx)(Q,{type:`button`,onClick:s,variant:`success`,size:`lg`,children:d(`emptyState.createFirstProject`)})})]})})},pv=({isTransientError:e=!1,requestedProjectExists:t,retainedProject:n,defaultProject:r,onCreateProject:i,onOpenProject:a,onOpenWorkspace:o,onRetry:s})=>{let{t:c}=K(`common`);return(0,X.jsx)(`main`,{className:`flex flex-1 items-center justify-center px-6 py-10`,children:(0,X.jsxs)(`section`,{"aria-labelledby":`destination-unavailable-title`,className:`w-full max-w-2xl rounded-2xl border border-border bg-card p-8 shadow-xl shadow-black/20`,children:[(0,X.jsx)(`h2`,{id:`destination-unavailable-title`,className:`text-2xl font-semibold tracking-tight`,children:c(e?`destinationUnavailable.errorTitle`:t?`destinationUnavailable.destinationTitle`:`destinationUnavailable.projectTitle`)}),(0,X.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:c(e?`destinationUnavailable.errorDescription`:t?`destinationUnavailable.destinationDescription`:`destinationUnavailable.projectDescription`)}),(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[e&&s&&(0,X.jsx)(Q,{type:`button`,onClick:s,children:c(`destinationUnavailable.retry`)}),t&&!e&&(0,X.jsx)(Q,{type:`button`,onClick:o,children:c(`destinationUnavailable.openWorkspace`)}),n&&(0,X.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>a(n),children:c(`destinationUnavailable.openRetainedProject`,{project:n.name})}),!n&&r&&(0,X.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>a(r),children:c(`destinationUnavailable.openDefaultProject`,{project:r.name})}),!r&&(0,X.jsx)(Q,{type:`button`,onClick:i,children:c(`destinationUnavailable.createProject`)})]})]})})},mv=({className:e})=>(0,X.jsx)(Pg,{"aria-hidden":`true`,className:e}),hv=({className:e})=>(0,X.jsx)(hte,{"aria-hidden":`true`,className:e}),gv=({className:e})=>(0,X.jsx)(bte,{"aria-hidden":`true`,className:e}),_v=({activeProjectId:e,onCreateProject:t,projects:n,onEditProject:r,onProjectChange:i})=>{let{t:a}=K(`projects`),[o,s]=(0,p.useState)(!1),[c,l]=(0,p.useState)(!1),u=(0,p.useRef)(null),d=n.find(t=>t.id===e)??null,f=n.length>4,m=(0,p.useCallback)(()=>{let e=u.current?.getBoundingClientRect();if(!e)return!1;let t=window.innerHeight-e.bottom-16,n=e.top-16;return t<320&&n>t},[]);return(0,p.useEffect)(()=>{if(!o)return;let e=()=>{l(m())};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[m,o]),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-stretch`,children:[(0,X.jsxs)(B_,{open:o,onOpenChange:e=>{e&&l(m()),s(e)},children:[(0,X.jsx)(`div`,{className:`relative min-w-0 flex-1`,ref:u,children:(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"aria-label":a(`identity.activeProjectAriaLabel`),disabled:n.length===0,className:`group flex h-10 w-full min-w-0 cursor-pointer items-center justify-between gap-2 rounded-l-xl rounded-r-none border border-border/70 bg-card/70 px-3 text-left transition-colors hover:border-border hover:bg-accent/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-60`,children:[(0,X.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,X.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:d?.name??a(`identity.emptyLabel`)})}),(0,X.jsx)(`span`,{className:`flex h-6 w-6 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground`,children:(0,X.jsx)(mv,{className:`h-4 w-4`})})]})})}),(0,X.jsxs)(H_,{side:c?`top`:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:[(0,X.jsxs)(N_,{filter:(e,t,n)=>Q_(t,[e,...n??[]]),children:[f&&(0,X.jsx)(P_,{placeholder:a(`identity.filterPlaceholder`)}),(0,X.jsxs)(F_,{className:`max-h-72`,children:[(0,X.jsx)(I_,{children:a(`identity.emptySearch`)}),(0,X.jsx)(L_,{children:n.map(t=>(0,X.jsx)(R_,{value:`${t.name} ${t.id}`,keywords:[t.name,t.repo_path,t.id],"data-checked":t.id===e,onSelect:()=>{i(t.id),s(!1)},children:(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:t.name}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:t.repo_path})]})},t.id))})]})]}),(0,X.jsx)(`div`,{className:`border-t border-border/70 p-1.5`,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":a(`identity.newProjectAriaLabel`),onClick:()=>{s(!1),t()},variant:`ghost`,className:`h-10 w-full justify-start gap-2 rounded-lg px-3`,children:[(0,X.jsx)(hv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:a(`identity.newProject`)})]})})]})]}),(0,X.jsx)(Q,{type:`button`,"aria-label":a(`identity.editProjectSettingsAriaLabel`),onClick:r,disabled:!e,variant:`outline`,size:`icon-sm`,className:`h-10 rounded-l-none border-l-0 border-border/70 bg-card/70`,children:(0,X.jsx)(gv,{className:`h-4 w-4`})})]})};function vv({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:Z(`animate-pulse rounded-2xl bg-muted`,e),...t})}var yv=({className:e=``})=>(0,X.jsx)(vv,{"aria-hidden":`true`,className:Z(`inline-flex rounded-md bg-[linear-gradient(90deg,_rgba(30,35,49,0.9),_rgba(63,72,98,0.95),_rgba(30,35,49,0.9))]`,e)}),bv=({stats:e=null,isLoading:t=!1,showFiles:n=!1,className:r=``})=>{if(t)return(0,X.jsx)(`div`,{"data-testid":`ticket-diff-stats-skeleton`,className:`flex items-center gap-2 text-[11px] font-medium ${r}`.trim(),children:(0,X.jsx)(yv,{className:`h-3.5 shrink-0 rounded-full ${n?`w-28`:`w-20`}`})});if(!e)return null;let i=e.files_changed===1?`1 file`:`${e.files_changed} files`;return(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium ${r}`.trim(),children:[n&&(0,X.jsx)(`span`,{className:`text-muted-foreground text-nowrap`,children:i}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,e.additions]}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,e.deletions]})]})},xv=({className:e})=>(0,X.jsx)(rte,{"aria-hidden":`true`,className:e}),Sv=({className:e})=>(0,X.jsx)(Yee,{"aria-hidden":`true`,className:e}),Cv=({className:e})=>(0,X.jsx)(Fg,{"aria-hidden":`true`,className:e}),wv=({className:e})=>(0,X.jsx)(Mg,{"aria-hidden":`true`,className:e}),Tv=({className:e})=>(0,X.jsx)(ite,{"aria-hidden":`true`,className:e}),Ev=({className:e})=>(0,X.jsx)(mte,{"aria-hidden":`true`,className:e}),Dv=({className:e})=>(0,X.jsx)(Fg,{"aria-hidden":`true`,className:e}),Ov=({className:e})=>(0,X.jsx)(Cte,{"aria-hidden":`true`,className:e}),kv=({className:e})=>(0,X.jsx)(wte,{"aria-hidden":`true`,className:e});function Av(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var jv=e=>{switch(e){case`success`:return Pv;case`info`:return Gte;case`warning`:return Wte;case`error`:return Kte;default:return null}},Mv=Array(12).fill(0),Nv=({visible:e,className:t})=>p.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},p.createElement(`div`,{className:`sonner-spinner`},Mv.map((e,t)=>p.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Pv=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Wte=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Gte=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),Kte=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),qte=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},p.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),p.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),Jte=()=>{let[e,t]=p.useState(document.hidden);return p.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},Fv=1,Iv=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:Fv++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],p.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Xte(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||Fv++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Yte=(e,t)=>{let n=t?.id||Fv++;return Iv.addToast({title:e,...t,id:n}),n},Xte=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,$=Object.assign(Yte,{success:Iv.success,info:Iv.info,warning:Iv.warning,error:Iv.error,custom:Iv.custom,message:Iv.message,promise:Iv.promise,dismiss:Iv.dismiss,loading:Iv.loading},{getHistory:()=>Iv.toasts,getToasts:()=>Iv.getActiveToasts()});Av(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Lv(e){return e.label!==void 0}var Zte=3,Qte=`24px`,$te=`16px`,Rv=4e3,ene=356,tne=14,nne=45,rne=200;function zv(...e){return e.filter(Boolean).join(` `)}function ine(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var ane=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:m,style:h,cancelButtonStyle:g,actionButtonStyle:_,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,expandByDefault:C,classNames:w,icons:T,closeButtonAriaLabel:E=`Close toast`}=e,[D,O]=p.useState(null),[k,A]=p.useState(null),[j,M]=p.useState(!1),[N,P]=p.useState(!1),[F,I]=p.useState(!1),[L,R]=p.useState(!1),[z,ee]=p.useState(!1),[B,V]=p.useState(0),[te,H]=p.useState(0),U=p.useRef(n.duration||b||Rv),ne=p.useRef(null),re=p.useRef(null),ie=c===0,ae=c+1<=o,oe=n.type,W=n.dismissible!==!1,se=n.className||``,ce=n.descriptionClassName||``,le=p.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ue=p.useMemo(()=>n.closeButton??m,[n.closeButton,m]),de=p.useMemo(()=>n.duration||b||Rv,[n.duration,b]),fe=p.useRef(0),pe=p.useRef(0),me=p.useRef(0),he=p.useRef(null),[ge,_e]=x.split(`-`),ve=p.useMemo(()=>s.reduce((e,t,n)=>n>=le?e:e+t.height,0),[s,le]),ye=Jte(),be=n.invert||t,xe=oe===`loading`;pe.current=p.useMemo(()=>le*S+ve,[le,ve]),p.useEffect(()=>{U.current=de},[de]),p.useEffect(()=>{M(!0)},[]),p.useEffect(()=>{let e=re.current;if(e){let t=e.getBoundingClientRect().height;return H(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),p.useLayoutEffect(()=>{if(!j)return;let e=re.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,H(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[j,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Se=p.useCallback(()=>{P(!0),V(pe.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},rne)},[n,d,a,pe]);p.useEffect(()=>{if(n.promise&&oe===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||ye?(()=>{if(me.current<fe.current){let e=new Date().getTime()-fe.current;U.current-=e}me.current=new Date().getTime()})():U.current!==1/0&&(fe.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Se()},U.current)),()=>clearTimeout(e)},[u,i,n,oe,ye,Se]),p.useEffect(()=>{n.delete&&(Se(),n.onDismiss==null||n.onDismiss.call(n,n))},[Se,n.delete]);function Ce(){return T?.loading?p.createElement(`div`,{className:zv(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":oe===`loading`},T.loading):p.createElement(Nv,{className:zv(w?.loader,n?.classNames?.loader),visible:oe===`loading`})}let we=n.icon||T?.[oe]||jv(oe);return p.createElement(`li`,{tabIndex:0,ref:re,className:zv(v,se,w?.toast,n?.classNames?.toast,w?.default,w?.[oe],n?.classNames?.[oe]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":j,"data-promise":!!n.promise,"data-swiped":z,"data-removed":N,"data-visible":ae,"data-y-position":ge,"data-x-position":_e,"data-index":c,"data-front":ie,"data-swiping":F,"data-dismissible":W,"data-type":oe,"data-invert":be,"data-swipe-out":L,"data-swipe-direction":k,"data-expanded":!!(u||C&&j),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${N?B:pe.current}px`,"--initial-height":C?`auto`:`${te}px`,...h,...n.style},onDragEnd:()=>{I(!1),O(null),he.current=null},onPointerDown:e=>{e.button!==2&&(xe||!W||(ne.current=new Date,V(pe.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(I(!0),he.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!W)return;he.current=null;let e=Number(re.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(re.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ne.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=nne||a>.11){V(pe.current),n.onDismiss==null||n.onDismiss.call(n,n),A(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Se(),R(!0);return}else{var o,s;(o=re.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=re.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}ee(!1),I(!1),O(null)},onPointerMove:t=>{var n,r;if(!he.current||!W||window.getSelection()?.toString().length>0)return;let i=t.clientY-he.current.y,a=t.clientX-he.current.x,o=e.swipeDirections??ine(x);!D&&(Math.abs(a)>1||Math.abs(i)>1)&&O(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(D===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&ee(!0),(n=re.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=re.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ue&&!n.jsx&&oe!==`loading`?p.createElement(`button`,{"aria-label":E,"data-disabled":xe,"data-close-button":!0,onClick:xe||!W?()=>{}:()=>{Se(),n.onDismiss==null||n.onDismiss.call(n,n)},className:zv(w?.closeButton,n?.classNames?.closeButton)},T?.close??qte):null,(oe||n.icon||n.promise)&&n.icon!==null&&(T?.[oe]!==null||n.icon)?p.createElement(`div`,{"data-icon":``,className:zv(w?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ce():null,n.type===`loading`?null:we):null,p.createElement(`div`,{"data-content":``,className:zv(w?.content,n?.classNames?.content)},p.createElement(`div`,{"data-title":``,className:zv(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?p.createElement(`div`,{"data-description":``,className:zv(y,ce,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),p.isValidElement(n.cancel)?n.cancel:n.cancel&&Lv(n.cancel)?p.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||g,onClick:e=>{Lv(n.cancel)&&W&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Se())},className:zv(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,p.isValidElement(n.action)?n.action:n.action&&Lv(n.action)?p.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||_,onClick:e=>{Lv(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Se())},className:zv(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Bv(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function one(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?$te:Qte;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var sne=p.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:h,style:g,visibleToasts:_=Zte,toastOptions:v,dir:y=Bv(),gap:b=tne,icons:x,containerAriaLabel:S=`Notifications`}=e,[C,w]=p.useState([]),T=p.useMemo(()=>n?C.filter(e=>e.toasterId===n):C.filter(e=>!e.toasterId),[C,n]),E=p.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[D,O]=p.useState([]),[k,A]=p.useState(!1),[j,M]=p.useState(!1),[N,P]=p.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),F=p.useRef(null),I=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),L=p.useRef(null),R=p.useRef(!1),z=p.useCallback(e=>{w(t=>(t.find(t=>t.id===e.id)?.delete||Iv.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return p.useEffect(()=>Iv.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{w(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{m.flushSync(()=>{w(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[C]),p.useEffect(()=>{if(d!==`system`){P(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),p.useEffect(()=>{C.length<=1&&A(!1)},[C]),p.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;A(!0),(t=F.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===F.current||F.current?.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),p.useEffect(()=>{if(F.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,R.current=!1)}},[F.current]),p.createElement(`section`,{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,n)=>{let[i,a]=t.split(`-`);return T.length?p.createElement(`ol`,{key:t,dir:y===`auto`?Bv():y,tabIndex:-1,ref:F,className:c,"data-sonner-toaster":!0,"data-sonner-theme":N,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${ene}px`,"--gap":`${b}px`,...g,...one(l,u)},onBlur:e=>{R.current&&!e.currentTarget.contains(e.relatedTarget)&&(R.current=!1,L.current&&=(L.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||R.current||(R.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M(!0)},onPointerUp:()=>M(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>p.createElement(ane,{key:n.id,icons:x,index:i,toast:n,defaultRichColors:f,duration:v?.duration??h,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:r,visibleToasts:_,closeButton:v?.closeButton??s,interacting:j,position:t,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:z,toasts:T.filter(e=>e.position==n.position),heights:D.filter(e=>e.position==n.position),setHeights:O,expandByDefault:o,gap:b,expanded:k,swipeDirections:e.swipeDirections}))):null}))}),Vv=({className:e})=>(0,X.jsx)(Zee,{"aria-hidden":`true`,className:e}),cne=(e,t)=>{let n=e.created_at.localeCompare(t.created_at);if(n!==0)return n;let r=e.title.localeCompare(t.title,void 0,{sensitivity:`base`});return r===0?e.id.localeCompare(t.id):r},Hv=12,Uv=e=>({x:e.left+e.width/2,y:e.top+e.height/2}),Wv=e=>`${e.blocker_ticket_id}:${e.dependent_ticket_id}`,Gv=(e,t)=>e.filter(e=>e.blocker_ticket_id!==t&&e.dependent_ticket_id!==t),Kv=(e,t)=>{let n=e.filter(e=>Wv(e)!==Wv(t));return n.push(t),n.sort((e,t)=>Wv(e).localeCompare(Wv(t))),n},qv=(e,t,n)=>e.filter(e=>!(e.blocker_ticket_id===t&&e.dependent_ticket_id===n)),lne=(e,t,n)=>{let r=[n],i=new Set;for(;r.length>0;){let n=r.shift();if(!(!n||i.has(n))){if(n===t)return!0;i.add(n);for(let t of e)t.blocker_ticket_id===n&&r.push(t.dependent_ticket_id)}}return!1},Jv=(e,t,n)=>t===n?{valid:!1,reason:`self`}:e.some(e=>e.blocker_ticket_id===t&&e.dependent_ticket_id===n)?{valid:!1,reason:`duplicate`}:lne(e,t,n)?{valid:!1,reason:`cycle`}:{valid:!0},une=e=>e===`self`?`A ticket cannot depend on itself.`:e===`duplicate`?`This dependency already exists.`:`This dependency would create a cycle.`,Yv=e=>e?e.build_completed_at!==null&&e.build_completed_at!==void 0||e.state===`review`?!0:e.state===`build`&&e.agent_status===`done`:!1,Xv=e=>!e||e.has_worktree===!1?!1:e.run_setup_status===`ready`?!0:Yv(e),Zv=e=>{if(!(!e||e.has_worktree===!1)){if(e.run_setup_status===`preparing`)return`Setting up worktree...`;if(!Xv(e))return`Run unlocks after setup finishes.`}},dne=(e,t,n)=>n.filter(t=>t.dependent_ticket_id===e.id).map(e=>t.get(e.blocker_ticket_id)).filter(e=>!!e&&!Yv(e)),fne=(e,t)=>{let n=[e],r=new Set,i=new Set;for(;n.length>0;){let e=n.shift();if(!(!e||r.has(e))){r.add(e);for(let r of t)r.blocker_ticket_id===e&&(i.add(r.dependent_ticket_id),n.push(r.dependent_ticket_id))}}return i},Qv=(e,t,n)=>{let r=n.get(t);if(!r){e.push(t);return}let i=!1;for(let a=0;a<e.length;a+=1){let o=n.get(e[a]);if(o&&cne(r,o)<0){e.splice(a,0,t),i=!0;break}}i||e.push(t)},pne=(e,t,n)=>{if(!t.get(e))return[];let r=fne(e,n);if(r.size===0)return[];let i=[e,...r],a=new Set(i),o=new Map,s=new Map;for(let e of i)o.set(e,0),s.set(e,[]);for(let e of n)!a.has(e.blocker_ticket_id)||!a.has(e.dependent_ticket_id)||(s.get(e.blocker_ticket_id)?.push(e.dependent_ticket_id),o.set(e.dependent_ticket_id,(o.get(e.dependent_ticket_id)??0)+1));let c=[];for(let e of i)(o.get(e)??0)===0&&Qv(c,e,t);let l=[];for(;c.length>0;){let e=c.shift();if(e){l.push(e);for(let n of s.get(e)??[]){let e=(o.get(n)??0)-1;o.set(n,e),e===0&&Qv(c,n,t)}}}return l.map(e=>t.get(e)).filter(e=>!!e)},$v=(e,t,n)=>{let r=pne(e.id,t,n),i=r.filter(e=>!Yv(e)),a=r.length>1,o=dne(e,t,n).length>0,s=e.state===`plan`&&a&&!o;return{buildChainOrder:r,pendingBuildChainOrder:i,hasDependents:a,hasOpenBlockers:o,canStartBuildChain:s,isVisibleStartPoint:e.build_chain?.is_root===!0||s,skippedBuildChainCount:r.length-i.length}},ey=(e,t)=>{let n=Uv(e),r=Uv(t),i=e.left+e.width,a=t.left+t.width,o=e.top+e.height,s=t.top+t.height;return e.left<a&&i>t.left?r.y>=n.y?{start:{x:n.x,y:o-Hv},end:{x:r.x,y:t.top+Hv}}:{start:{x:n.x,y:e.top+Hv},end:{x:r.x,y:s-Hv}}:r.x>=n.x?{start:{x:i-Hv,y:n.y},end:{x:t.left+Hv,y:r.y}}:{start:{x:e.left+Hv,y:n.y},end:{x:a-Hv,y:r.y}}},mne=(e,t)=>{let n=t.x-e.x,r=t.y-e.y;if(Math.abs(n)>=Math.abs(r)){let r=Math.max(64,Math.abs(n)*.6),i={x:e.x+Math.sign(n||1)*r,y:e.y},a={x:t.x-Math.sign(n||1)*r,y:t.y};return{path:`M ${e.x} ${e.y} C ${i.x} ${i.y}, ${a.x} ${a.y}, ${t.x} ${t.y}`,angle:Math.atan2(t.y-a.y,t.x-a.x)}}let i=Math.max(18,Math.round(Math.abs(r)*.4)),a=Math.max(24,Math.min(36,Math.round(Math.abs(r)*.18+Math.abs(n)*.1))),o=Math.round(a*.35),s=n>=0?1:-1,c={x:e.x+s*a,y:e.y+Math.sign(r||1)*i},l={x:t.x+s*o,y:t.y-Math.sign(r||1)*i};return{path:`M ${e.x} ${e.y} C ${c.x} ${c.y}, ${l.x} ${l.y}, ${t.x} ${t.y}`,angle:Math.atan2(t.y-l.y,t.x-l.x)}},ty={plan:0,build:1,review:2},hne={plan:`build`,build:`review`},ny=e=>hne[e]??null,ry=e=>e===`plan`?`plan`:e===`build`||e===`review`||e===`done`?`build`:`default`,iy=e=>e.worktree_bundle_id??e.id,gne=(e,t)=>{if(!e)return null;let n=t.find(t=>t.id===e.ticket_id);return n?iy(n):e.ticket_id},_ne=({bundleId:e,activeRunContextKey:t,isProjectRootRunActive:n})=>n?!0:t!==null&&t!==e,ay=(e,t,n,r)=>n||t!==null&&t!==iy(e)?r:Zv(e),oy=(e,t)=>t?{...e,...t,diff_stats:t.diff_stats===void 0?e.diff_stats:t.diff_stats,is_stale:t.is_stale===void 0?e.is_stale:t.is_stale,messages:t.messages===void 0?e.messages:t.messages,agent_log:t.agent_log===void 0?e.agent_log:t.agent_log,streaming_response:t.streaming_response===void 0?e.streaming_response:t.streaming_response}:e,vne=(e,t)=>t.map(t=>{let n=e.find(e=>e.id===t.id);return!n||n.agent_status!==`running`||t.agent_status===`running`||n.updated_at<t.updated_at?t:oy(t,n)}),yne=(e,t)=>{let n=e.toLowerCase().trim().split(/\s+/).filter(Boolean);if(n.length===0)return!0;let r=[t.title,t.description,t.bundle?.name??``,t.bundle?.branch??``,t.branch??``].map(e=>e.toLowerCase());return n.every(e=>r.some(t=>t.includes(e)))},sy=e=>e.state===`build`||e.state===`review`&&e.review_follow_up_active===!0,cy=e=>e.state===`review`&&e.review_follow_up_active!==!0,ly=e=>e.parked_at!==null,uy=e=>ly(e)?`done`:e.state,dy=e=>e.is_stale===!0,bne=e=>e?e.files_changed===0&&e.additions===0&&e.deletions===0:!1,fy=(e,t)=>!t||e===`plan`?!1:!(e===`done`&&bne(t)),py=e=>ly(e)||e.agent_status===`running`?!1:e.state===`build`?e.agent_status===`done`:e.state===`review`,xne=(e,t)=>ly(e)&&e.state===t,my=e=>e.tickets.length>0&&e.tickets.every(e=>gy(e,`trash`)),Sne=e=>e.tickets.length>0&&e.tickets.every(e=>gy(e,`done`)),Cne=e=>e.column===`done`&&e.tickets.length>0&&e.tickets.every(e=>e.state!==`plan`),hy=(e,t)=>t===`build`?{agent_status:null,agent_log:null,streaming_response:null,build_completed_at:null,planning_context:e.planning_context?{...e.planning_context,open_questions:[]}:null}:t===`review`?{agent_status:null,agent_log:null,streaming_response:null}:{},wne=(e,t)=>e===`plan`&&t===`build`?`build`:e===`build`&&t===`review`?`review`:e===`review`&&t===`build`?`undoReview`:null,Tne=(e,t,n)=>t===`review`&&n===`build`?{}:hy(e,n),gy=(e,t)=>e.agent_status===`running`?!1:t===`done`?py(e):!(t!==`trash`&&ty[t]<=ty[e.state]||t===`review`&&(e.state!==`build`||e.agent_status!==`done`&&e.agent_status!==`stopped`)),Ene=e=>{let t=ny(e.state);return!t||gy(e,t)?null:e.state===`build`?e.agent_status===`running`?`Finish the current build before moving to review.`:e.agent_status===`error`?`Retry and finish the build before moving to review.`:`Build must be done before moving to review.`:e.state===`plan`?`Finish planning before moving to build.`:null},Dne=[...[`plan`,`build`,`review`],`done`],_y=e=>[...e].sort((e,t)=>{let n=e.bundle_execution_position??2**53-1,r=t.bundle_execution_position??2**53-1;if(n!==r)return n-r;if(e.created_at!==t.created_at)return e.created_at.localeCompare(t.created_at);let i=e.title.localeCompare(t.title,void 0,{sensitivity:`base`});return i===0?e.id.localeCompare(t.id):i}),One=(e,t)=>{let n=e.worktree_bundle_id?t.get(e.worktree_bundle_id)??null:null;return e.bundle&&n?{...e.bundle,...n,pull_request:n.pull_request??e.bundle.pull_request}:n??e.bundle??null},vy=e=>e.kind===`project_root`?!0:e.has_prepared_worktree!==!1,yy=e=>e.filter(e=>e.kind!==`project_root`&&vy(e)),by=e=>[...e].filter(e=>e.session_id).sort((e,t)=>e.updated_at===t.updated_at?t.id.localeCompare(e.id):t.updated_at.localeCompare(e.updated_at))[0]??null,xy=e=>[...e].filter(e=>e.state!==`plan`&&e.build_completed_at).sort((e,t)=>{let n=e.build_completed_at??``,r=t.build_completed_at??``;return n===r?e.updated_at===t.updated_at?t.id.localeCompare(e.id):t.updated_at.localeCompare(e.updated_at):r.localeCompare(n)})[0]??null,Sy=e=>{let t=e.filter(e=>e.state!==`plan`&&e.parked_at===null),n=xy(t);if(n)return n;let r=_y(t);return r[r.length-1]??null},Cy=e=>e.has_worktree??!!(e.bundle?.branch??e.branch),wy=(e,t)=>vy(e)||t.some(t=>t.worktree_bundle_id===e.id&&Cy(t)),Ty=(e,t={})=>{let n=t.targetTicketId?e.find(e=>e.id===t.targetTicketId)??null:null,r=t.reviewOwnerTicketId?e.find(e=>e.id===t.reviewOwnerTicketId)??null:null,i=xy(e),a=Sy(e),o=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId&&e.session_id)??null:by(e),s=t.latestSessionTicketId?e.find(e=>e.id===t.latestSessionTicketId)??null:null;return a??n??r??i??o??s??e.find(e=>Cy(e))??e.find(e=>e.state!==`plan`)??e[0]??null},Ey=(e,t,n)=>{let r=new Map(t.map(e=>[e.id,e])),i=e.filter(e=>n===`done`?e.parked_at!==null:e.state===n&&e.parked_at===null),a=new Map;for(let e of i){if(!e.worktree_bundle_id)continue;let t=a.get(e.worktree_bundle_id);if(t){t.push(e);continue}a.set(e.worktree_bundle_id,[e])}let o=new Set;return i.flatMap(e=>{if(!e.worktree_bundle_id)return[{kind:`ticket`,ticket:e}];if(o.has(e.worktree_bundle_id))return[];o.add(e.worktree_bundle_id);let t=a.get(e.worktree_bundle_id)??[e];if(t.length===1)return[{kind:`ticket`,ticket:t[0]}];let i=One(t[0],r);return i?[{kind:`bundle`,group:{id:`${i.id}:${n}`,bundle:i,column:n,tickets:_y(t)}}]:t.map(e=>({kind:`ticket`,ticket:e}))})},Dy=e=>`bundle-group:${e.id}`,Oy=e=>{let t=new Map;for(let n of e){if(!n.worktree_bundle_id)continue;let e=t.get(n.worktree_bundle_id);if(e){e.add(uy(n));continue}t.set(n.worktree_bundle_id,new Set([uy(n)]))}let n=new Set;for(let[e,r]of t)r.size>=2&&n.add(e);return n},ky=e=>{if(!e.startsWith(`bundle-group:`))return null;let t=e.slice(13),n=t.lastIndexOf(`:`);if(n<=0)return null;let r=t.slice(0,n),i=t.slice(n+1);return Dne.includes(i)?{bundleId:r,column:i}:null},Ay=e=>{let t=e.trim();for(;t!==``;){let e=t.match(/^(.*?) \(([^()]+)\)$/);if(!e)return t;let n=e[1]?.trim()??``,r=e[2]?.trim()??``,i=n.toLowerCase(),a=r.toLowerCase();if(i===a){t=n;continue}if(i.endsWith(` (${a})`)){t=n;continue}return t}return e.trim()},jy=(e,t)=>{let n=Ay(e),r=t.trim();if(n===``||r===``)return n;let i=` (${r})`,a=n;for(;a.toLowerCase().endsWith(i.toLowerCase());)a=a.slice(0,-i.length).trimEnd();return a||n},My=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?e.name??``:e.branch??``;let t=Ay(e.name||e.branch||``);return e.branch?jy(t,e.branch):t},Ny=e=>{if(e.kind===`project_root`)return e.branch===`__project_root__`?`Project root`:`Project root (${e.branch})`;let t=My(e),n=e.branch??``,r=t.trim().toLowerCase(),i=n.trim().toLowerCase();return t===``||n===``?t||n:r===i?t:`${t} (${n})`},Py=(e,t,n)=>e.active_target_kind===`bundle`?n===null?`text-muted-foreground`:n?`text-amber-300`:`text-emerald-200`:t?.status===`ready`?t.canPull?`text-amber-300`:`text-emerald-200`:`text-muted-foreground`,Fy=({activeProject:e,branchState:t,bundles:n,branchSuggestions:r,activeTargetCanPull:i=null,isBundleLoading:a=!1,isLoading:o,presentation:s=`footer`,closeAfterSelection:c=!0,triggerAriaLabel:l,onOpenChange:u,onSelectBundle:d,onSelectRepoRoot:f,targetGitStatus:m=null,activeBranchAction:h=null,onRebase:g,onManageBundles:_})=>{let{t:v}=K(`common`),[y,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(!1),T=s===`composer`,E=e.active_target_kind!==`bundle`,D=(0,p.useMemo)(()=>yy(n),[n]),O=(0,p.useMemo)(()=>e.active_target_kind!==`bundle`||!e.active_target_bundle_id?null:n.find(t=>t.id===e.active_target_bundle_id)??null,[e.active_target_bundle_id,e.active_target_kind,n]),k=(0,p.useMemo)(()=>!t||t.status===`loading`?null:t.status===`ready`&&t.branch?t.branch:t.status===`detached`?v(`projectTargetSelector.status.detachedHead`):v(`projectTargetSelector.status.unknownBranch`),[t,v]),A=(0,p.useMemo)(()=>e.active_target_kind===`bundle`&&e.active_target_bundle_id?O?Ny(O):v(`projectTargetSelector.activeBundleUnavailable`):k??v(`projectTargetSelector.loadingTarget`),[O,e.active_target_bundle_id,e.active_target_kind,k,v]),j=k?v(`projectTargetSelector.repoRootWithBranch`,{branch:k}):v(`projectTargetSelector.repoRoot`),M=(0,p.useMemo)(()=>Py(e,t,i),[e,i,t]),N=o||a,P=e.active_target_kind===`bundle`&&!!e.active_target_bundle_id&&O===null&&a,F=E&&t?.status===`loading`||P,I=(0,p.useMemo)(()=>F?v(`projectTargetSelector.status.loading`):E?t?.status===`detached`?v(`projectTargetSelector.status.detachedHead`):t?.status===`ready`?t.canPull?v(`projectTargetSelector.status.pullAvailable`):v(`projectTargetSelector.status.upToDate`):v(`projectTargetSelector.status.unknownBranch`):v(O?i===null?`projectTargetSelector.status.loading`:i?`projectTargetSelector.status.pullAvailable`:`projectTargetSelector.status.upToDate`:`projectTargetSelector.status.unavailable`),[O,i,t?.canPull,t?.status,E,F,v]),L=(0,p.useMemo)(()=>{let e=r.current_branch;return[{key:`default`,label:v(`projectTargetSelector.defaultBranch`),branch:r.default_branch},{key:`previous`,label:v(`projectTargetSelector.previousBranch`),branch:r.previous_branch}].filter(t=>t.branch&&t.branch!==e).filter((e,t,n)=>n.findIndex(t=>t.branch===e.branch)===t)},[r,v]),R=m?.base_branch?v(`projectFooter.rebaseOnto`,{branch:m.base_branch}):v(`projectFooter.rebase`),z=m?.operation_state===`idle`,ee=!g||!z||!!m?.rebase_disabled_reason||h!==null||C;(0,p.useEffect)(()=>{y&&S(t?.branch??``)},[t?.branch,y]);let B=e=>{b(e),u?.(e)},V=()=>{c&&B(!1)},te=async e=>{w(!0);try{await d(e)&&V()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.bundleSwitch`))}finally{w(!1)}},H=async(e,t)=>{w(!0);try{await f(e,t)&&V()}catch(e){$.error(e instanceof Error?e.message:v(`projectTargetSelector.errors.repoRootSwitch`))}finally{w(!1)}},U=async()=>{if(g){w(!0);try{await g(),B(!1)}catch(e){$.error(e instanceof Error?e.message:v(`projectFooter.rebaseFallbackError`))}finally{w(!1)}}};return(0,X.jsxs)(B_,{open:y,onOpenChange:B,children:[(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":l,"aria-busy":F,className:T?`flex h-9 max-w-64 cursor-pointer items-center overflow-hidden rounded-lg border border-border bg-background px-3 text-left text-xs transition hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-50`:`flex max-w-full cursor-pointer items-center overflow-hidden rounded-xl border border-border/70 bg-card/70 px-3 py-2 text-left shadow-sm transition hover:border-border hover:bg-accent/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60`,"data-testid":T?`new-chat-project-target`:`active-project-branch`,children:F?(0,X.jsx)(yv,{className:`h-3.5 w-20`}):(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 ${M}`,children:[(0,X.jsx)(Vv,{className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate font-medium`,children:A})]})})}),(0,X.jsx)(H_,{align:`start`,className:T?`w-[22rem] max-w-[calc(100vw-2rem)] p-3`:`w-[28rem] max-w-[calc(100vw-2rem)] p-4`,children:(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:v(`projectTargetSelector.title`)}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:v(`projectTargetSelector.description`)})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.targetLabel`)}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:I})]}),(0,X.jsxs)(N_,{className:`rounded-xl border border-border/70 bg-background/40 p-0`,label:v(`projectTargetSelector.searchAriaLabel`),shouldFilter:!0,children:[(0,X.jsx)(P_,{placeholder:v(`projectTargetSelector.searchPlaceholder`),"aria-label":v(`projectTargetSelector.searchAriaLabel`)}),(0,X.jsxs)(F_,{className:`max-h-56 p-1`,"data-testid":`project-target-options`,children:[(0,X.jsx)(I_,{children:v(N?`projectTargetSelector.loadingTargets`:`projectTargetSelector.noSearchResults`)}),(0,X.jsxs)(R_,{value:`${v(`projectTargetSelector.repoRoot`)} ${k??``}`,"data-checked":E,disabled:N||C,"aria-label":`${j}. ${E?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{H(null)},className:`min-h-12`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`truncate`,children:v(`projectTargetSelector.repoRoot`)}),(0,X.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:k??v(`projectTargetSelector.loadingTarget`)})]}),E&&(0,X.jsx)(`span`,{className:`mr-6 text-xs text-muted-foreground`,children:v(`projectTargetSelector.status.selected`)})]}),D.map(t=>{let n=My(t),r=Ny(t),i=e.active_target_kind===`bundle`&&e.active_target_bundle_id===t.id;return(0,X.jsxs)(R_,{value:r,"data-checked":i,disabled:N||C,"aria-label":`${r}. ${i?v(`projectTargetSelector.status.selected`):``}`.trim(),onSelect:()=>{te(t.id)},className:`min-h-12`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`span`,{className:`truncate`,children:n}),t.branch&&n.toLowerCase()!==t.branch.toLowerCase()&&(0,X.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:t.branch})]}),i&&(0,X.jsx)(`span`,{className:`mr-6 text-xs text-muted-foreground`,children:v(`projectTargetSelector.status.selected`)})]},t.id)}),N&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground`,role:`status`,"data-testid":`project-target-options-spinner`,children:[(0,X.jsx)(Tv,{className:`h-3.5 w-3.5 animate-spin`}),(0,X.jsx)(`span`,{children:v(`projectTargetSelector.loadingTargets`)})]}),!N&&D.length===0&&(0,X.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:v(`projectTargetSelector.noBundles`)})]})]}),!T&&_&&(0,X.jsx)(Q,{type:`button`,variant:`outline`,className:`w-full justify-start`,disabled:C,onClick:()=>{B(!1),_?.()},children:v(`projectTargetSelector.manageBundles`)})]}),!T&&(0,X.jsxs)(`div`,{className:`space-y-2 border-t border-border/70 pt-4`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.repoRootBranch`)}),(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-3`,children:[(0,X.jsx)(`div`,{className:`space-y-2`,children:L.length>0?L.map(({key:e,label:t,branch:n})=>(0,X.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between`,disabled:!E||C||!n,onClick:()=>{H(n)},children:[(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n})]},e)):(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v(o?`projectTargetSelector.loadingBranches`:`projectTargetSelector.noSuggestedBranches`)})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 sm:flex-nowrap`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 basis-56 space-y-1`,children:[(0,X.jsx)(z_,{htmlFor:`project-target-branch-input`,className:`text-xs text-muted-foreground`,children:v(`projectTargetSelector.switchOrCreateBranch`)}),(0,X.jsx)(k_,{id:`project-target-branch-input`,value:x,disabled:!E||C,onChange:e=>S(e.target.value),placeholder:v(`projectTargetSelector.branchPlaceholder`)})]}),(0,X.jsx)(Q,{type:`button`,disabled:!E||!x.trim()||C,onClick:()=>{H(x)},children:v(`projectTargetSelector.switchBranch`)})]})]})]}),!T&&z&&(0,X.jsxs)(`div`,{className:`space-y-2 border-t border-border/70 pt-4`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium text-muted-foreground`,children:v(`projectTargetSelector.actions`)}),(0,X.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between`,disabled:ee,title:m?.rebase_disabled_reason??void 0,onClick:()=>{U()},children:[(0,X.jsx)(`span`,{children:R}),h===`rebase`&&(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`})]})]})]})})]})},Iy=(e,t=!1)=>e?e.status===`loading`?{kind:`loading`}:e.status===`ready`&&e.branch?{kind:`text`,toneClassName:t?`text-amber-300`:`text-emerald-200`,value:e.branch}:e.status===`detached`?{kind:`text`,toneClassName:`text-[#8d92aa]`,value:``,translationKey:`projectFooter.detachedHead`}:{kind:`text`,toneClassName:`text-[#8d92aa]`,value:``,translationKey:`projectFooter.unknownBranch`}:null,Ly=({activeProject:e,activeRun:t,branchState:n,targetGitStatus:r,isBoardLoadedForActiveProject:i,activeProjectBranchAction:a,isProjectIdeAvailable:o,isProjectRunAvailable:s,isRunStatusLoadedForActiveProject:c,isTerminalOpen:l,hasConfiguredTests:u,hasConfiguredChecks:d,targetBundles:f,targetBranchSuggestions:p,isTargetBundleLoading:m,isTargetSelectorLoading:h,isTargetGitStatusLoading:g,onProjectFilesOpen:_,onProjectChangesOpen:v,onProjectVerificationOpen:y,onProjectPull:b,onProjectRebase:x,onProjectAbortGitOperation:S,onProjectRunToggle:C,onTerminalToggle:w,onProjectIdeOpen:T,onTargetSelectorOpenChange:E,onSelectBundleTarget:D,onSelectRepoRootTarget:O,onManageBundles:k})=>{let{t:A}=K(`common`),j=r?.operation_state??`idle`,M=!!(e&&r&&r.behind>0&&j===`idle`),N=(()=>{let e=Iy(n,M);return e?.kind!==`text`||!e.translationKey?e:{...e,value:A(e.translationKey)}})(),P=N?.kind===`loading`,F=a===`pull`,I=a===`abort`,L=!!(e&&r&&r.branch&&r.behind>0&&a===null),R=(r?.behind??0)>0&&(r?.ahead??0)>0?A(`projectFooter.sync`):A(`projectFooter.pull`),z=j===`merge`||j===`rebase`,ee=A(j===`merge`?`projectFooter.abortMerge`:`projectFooter.abortRebase`),B=!!e,V=!!(e&&n?.diffStats?.is_dirty),te=A(l?`workspaceControls.hideTerminalAriaLabel`:`workspaceControls.openTerminalAriaLabel`),H=e?.active_target_kind??`repo_root`,U=e?.active_target_bundle_id??null,ne=H!==`bundle`||f.some(e=>e.id===U&&e.has_prepared_worktree===!0),re=e!==null&&t?.kind===`project`&&t.project_id===e.id&&(t.target_kind??`repo_root`)===H&&((t.target_kind??`repo_root`)!==`bundle`||t.target_bundle_id===U),ie=e!==null&&!re&&(!i||!c),ae=!e||!re&&(!s||t!==null||ie),oe=A(re?`projectFooter.stop`:`projectFooter.run`),W=(()=>{if(!e)return A(`projectFooter.selectProjectFirst`);if(!re){if(!s)return A(`projectFooter.addRunConfig`);if(ie)return A(`projectFooter.loadingProjectStatus`);if(t?.kind===`project`)return A(`projectFooter.stopSelectedTargetRun`);if(t?.kind===`ticket`)return A(`projectFooter.stopTicketBeforeSelectedTargetRun`)}})();return(0,X.jsx)(`footer`,{className:`border-t border-border bg-background/95 px-6 py-3 backdrop-blur`,"data-testid":`project-footer`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-3 overflow-hidden px-1 text-xs text-muted-foreground sm:gap-4`,children:[e&&N&&(0,X.jsx)(`div`,{className:`flex max-w-full items-center gap-2 overflow-hidden`,children:(0,X.jsx)(Fy,{activeProject:e,branchState:n,bundles:f,branchSuggestions:p,activeTargetCanPull:e?.active_target_kind===`bundle`?r?r.behind>0:g?null:!1:null,isBundleLoading:m,isLoading:h||P,presentation:`footer`,closeAfterSelection:!1,onOpenChange:E,onSelectBundle:D,onSelectRepoRoot:O,targetGitStatus:r,activeBranchAction:a,onRebase:x,onManageBundles:k})}),z&&(0,X.jsxs)(Q,{type:`button`,onClick:()=>{S()},disabled:a!==null,variant:`outline`,className:`h-8 gap-2 px-3 text-xs`,children:[I?(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Ov,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:I?A(`projectFooter.aborting`):ee})]}),M&&(0,X.jsxs)(Q,{type:`button`,onClick:b,disabled:!L,variant:`outline`,className:`h-8 gap-2 px-3 text-xs`,children:[F?(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Dv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:F?R===A(`projectFooter.sync`)?A(`projectFooter.syncing`):A(`projectFooter.pulling`):R})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3 sm:gap-4`,children:[V&&n?.diffStats&&(0,X.jsx)(bv,{stats:n.diffStats,showFiles:!0,className:`text-xs`}),B&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.changes`),onClick:v,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(Cv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.changes`)})]}),(0,X.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.files`),onClick:_,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(Sv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.files`)})]})]}),(d||u)&&ne&&(0,X.jsxs)(Q,{type:`button`,"aria-label":A(`workspaceControls.verification`),onClick:y,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(xv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.verification`)})]}),(0,X.jsxs)(Q,{type:`button`,"aria-label":te,"aria-pressed":l,onClick:w,disabled:!e,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(kv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.terminal`)})]}),e&&o&&(0,X.jsxs)(Q,{type:`button`,onClick:T,variant:`outline`,className:`gap-2`,children:[(0,X.jsx)(wv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:A(`workspaceControls.openIde`)})]}),(0,X.jsxs)(Q,{type:`button`,"data-testid":`project-root-run-button`,disabled:ae,title:W,onClick:C,variant:re?`destructive`:`secondary`,className:[`gap-2`,re?``:`bg-sky-700 text-sky-100 hover:bg-sky-600 hover:text-white`,ae?`bg-slate-700 text-slate-400 hover:bg-slate-700 hover:text-slate-400`:``].join(` `),children:[re&&(0,X.jsx)(`span`,{className:`h-2 w-2 flex-shrink-0 rounded-full bg-emerald-400 animate-pulse`,"data-testid":`project-root-run-indicator`}),re?(0,X.jsx)(Ov,{className:`h-4 w-4`}):(0,X.jsx)(Ev,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:oe})]})]})]})})},Ry=e=>(0,X.jsx)(op,{"data-slot":`dropdown-menu`,...e}),zy=e=>(0,X.jsx)(sp,{"data-slot":`dropdown-menu-trigger`,...e}),By=({className:e,align:t=`end`,sideOffset:n=6,...r})=>(0,X.jsx)(cp,{children:(0,X.jsx)(lp,{"data-slot":`dropdown-menu-content`,align:t,sideOffset:n,className:Z(`z-[90] min-w-44 overflow-hidden rounded-xl border border-border bg-popover p-1 text-sm text-popover-foreground shadow-2xl shadow-black/30 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r})}),Vy=({className:e,inset:t=!1,...n})=>(0,X.jsx)(up,{"data-slot":`dropdown-menu-item`,"data-inset":t,className:Z(`relative flex cursor-default select-none items-center gap-2 rounded-lg px-2.5 py-2 text-sm outline-hidden transition-colors data-[disabled]:opacity-50 data-[disabled]:text-muted-foreground focus:bg-accent focus:text-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}),Hy=({state:e,className:t})=>e?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-activity-indicator":`true`,"data-state":e,"data-testid":`workspace-activity-indicator`,className:Z(`h-2 w-2 flex-shrink-0 rounded-full`,e===`running`?`animate-pulse bg-amber-300`:e===`inactive`?`bg-zinc-500/70 ring-1 ring-zinc-400/20`:e===`interrupted`?`bg-amber-400/80 ring-1 ring-amber-400/30`:e===`error`?`bg-rose-400/90 ring-1 ring-rose-400/30`:`bg-emerald-400/80 ring-1 ring-emerald-400/30`,t)}):null,Uy=({className:e})=>(0,X.jsx)(Rg,{"aria-hidden":`true`,className:e}),Wy=({className:e})=>(0,X.jsx)(gte,{"aria-hidden":`true`,className:e}),Gy=class extends Error{constructor(e){super(e),this.name=`UpgradeInProgressError`}},Ky=async e=>{let t=await fetch(q(`/tools/upgrade`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tool:e})});if(t.status===409)throw new Gy(await Xe(t,`upgrade already running`));if(!t.ok)throw new Ke(await Xe(t,`Upgrade failed.`),t.status);return await t.json()},qy=({onUpgrade:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)({opencode:`idle`,claude:`idle`}),i=e=>({opencode:{success:t(`toolsMenu.openCodeSuccess`),successWithVersion:t(`toolsMenu.openCodeSuccessWithVersion`),upToDate:t(`toolsMenu.openCodeUpToDate`),upToDateWithVersion:t(`toolsMenu.openCodeUpToDateWithVersion`),failed:t(`toolsMenu.openCodeFailed`),alreadyRunning:t(`toolsMenu.openCodeAlreadyRunning`)},claude:{success:t(`toolsMenu.claudeSuccess`),successWithVersion:t(`toolsMenu.claudeSuccessWithVersion`),upToDate:t(`toolsMenu.claudeUpToDate`),upToDateWithVersion:t(`toolsMenu.claudeUpToDateWithVersion`),failed:t(`toolsMenu.claudeFailed`),alreadyRunning:t(`toolsMenu.claudeAlreadyRunning`)}})[e],a=async a=>{if(n[a]===`running`)return;r(e=>({...e,[a]:`running`}));let o=i(a);try{let e=await Ky(a);if(e.ok){if(e.upToDate){$.info(e.version?o.upToDateWithVersion.replace(`{{version}}`,e.version):o.upToDate);return}$.success(e.version?o.successWithVersion.replace(`{{version}}`,e.version):o.success);return}$.error(o.failed)}catch(e){if(e instanceof Gy){$.info(o.alreadyRunning);return}let n=e instanceof Error?e.message:t(`toolsMenu.networkError`);$.error(n)}finally{r(e=>e[a]===`running`?{...e,[a]:`idle`}:e),await e?.(a)}},o=(e,t,r)=>{let i=n[e]===`running`;return(0,X.jsxs)(Vy,{disabled:i,onSelect:t=>{t.preventDefault(),a(e)},children:[i?(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(Wy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:i?r:t})]})};return{hasRunningUpgrade:Object.values(n).some(e=>e===`running`),renderUpgradeMenuItems:()=>(0,X.jsxs)(X.Fragment,{children:[o(`opencode`,t(`toolsMenu.updateOpenCode`),t(`toolsMenu.openCodeRunning`)),o(`claude`,t(`toolsMenu.updateClaude`),t(`toolsMenu.claudeRunning`))]})}},Jy=({onUpgrade:e,onOpenExecutionRuntimes:t})=>{let{t:n}=K(`common`),{renderUpgradeMenuItems:r}=qy({onUpgrade:e});return(0,X.jsxs)(Ry,{children:[(0,X.jsx)(zy,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,"aria-label":n(`toolsMenu.triggerAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`rounded-xl border border-border/70`,children:(0,X.jsx)(Uy,{className:`h-4 w-4`})})}),(0,X.jsxs)(By,{align:`end`,className:`w-60`,children:[t&&(0,X.jsxs)(Vy,{onSelect:t,children:[(0,X.jsx)(Uy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:n(`toolsMenu.runtimes`)})]}),r()]})]})},Yy=({className:e})=>(0,X.jsx)(Ree,{"aria-hidden":`true`,className:e}),Xy=({className:e})=>(0,X.jsx)(Ng,{"aria-hidden":`true`,className:e}),Zy=({className:e})=>(0,X.jsx)(`svg`,{"aria-hidden":`true`,className:e,viewBox:`0 0 16 16`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,X.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.5-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.82a7.65 7.65 0 0 1 4 0c1.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 0 0 16 8c0-4.42-3.58-8-8-8Z`})}),Qy=({className:e})=>(0,X.jsx)(Kee,{"aria-hidden":`true`,className:e}),$y={"X-Archon-Desktop-Action":`mobile-access`},eb=e=>Y(q(`/mobile-access/status`),{signal:e}),tb=e=>Y(q(`/mobile-access/enable`),{method:`POST`,headers:$y,body:e}),nb=()=>Y(q(`/mobile-access/disable`),{method:`POST`,headers:$y}),rb=e=>Y(q(`/mobile-access/regenerate-pairing`),{method:`POST`,headers:$y,body:{preferred_project_id:e??null}}),ib=e=>Y(q(`/mobile-access/sessions/${encodeURIComponent(e)}/revoke`),{method:`POST`,headers:$y}),ab=new Set,ob=null,sb=null,cb=()=>{for(let e of ab)e(ob)},lb=()=>{sb!==null&&(window.clearTimeout(sb),sb=null)},ub=e=>{if(typeof window>`u`||(lb(),e?.state!==`awaiting_pairing`||!e.pairing))return;let t=new Date(e.pairing.expires_at).getTime();if(Number.isNaN(t))return;let n=()=>{ob?.state!==`awaiting_pairing`||ob.pairing?.expires_at!==e.pairing?.expires_at||db({...ob,state:`expired`,pairing:null})},r=t-Date.now();if(r<=0){n();return}sb=window.setTimeout(n,r)},db=e=>{ob=e,ub(e),cb()},fb=async e=>{let t=await eb(e);return db(t),t},pb=()=>{let[e,t]=(0,p.useState)(ob);return(0,p.useEffect)(()=>(ab.add(t),()=>{ab.delete(t)}),[]),e},mb=e=>{(0,p.useEffect)(()=>{if(!e)return;let t=null,n=()=>{t?.abort(),t=new AbortController;let e=t;fb(e.signal).catch(e=>{Ye(e)}).finally(()=>{t===e&&(t=null)})};n();let r=e=>{db(e)},i=()=>{n()};return e.on(`mobile-access:status`,r),e.on(`connect`,i),()=>{t?.abort(),e.off(`mobile-access:status`,r),e.off(`connect`,i)}},[e])},hb=`(min-width: 1440px)`,gb=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(e).matches,_b=e=>{let[t,n]=(0,p.useState)(()=>gb(e));return(0,p.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>{n(t.matches)};return r(),t.addEventListener(`change`,r),()=>{t.removeEventListener(`change`,r)}},[e]),t},vb=e=>e?.state===`awaiting_pairing`?`border-amber-400/30 bg-amber-500/10 text-amber-100 hover:bg-amber-500/15 hover:text-amber-50`:e?.state===`connected`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-100 hover:bg-emerald-500/15 hover:text-emerald-50`:e?.state===`expired`?`border-amber-400/20 bg-amber-500/6 text-amber-100/90 hover:bg-amber-500/12 hover:text-amber-50`:e?.state===`error`?`border-rose-400/30 bg-rose-500/10 text-rose-100 hover:bg-rose-500/15 hover:text-rose-50`:`border-border/70 bg-background/70 text-muted-foreground hover:bg-accent/20 hover:text-foreground`,yb=(e,t)=>{if(!e||e.state===`disabled`){let n=t(`projectHeader.runtime.mobileDisabled`);return{buttonClassName:vb(e),indicatorState:`inactive`,isActive:!1,statusLabel:n,tooltip:n}}if(e.state===`awaiting_pairing`){let n=t(`projectHeader.runtime.mobileReadyToPair`);return{buttonClassName:vb(e),indicatorState:`running`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`connected`){let n=t(`projectHeader.runtime.mobileConnected`);return{buttonClassName:vb(e),indicatorState:`finished`,isActive:!0,statusLabel:n,tooltip:n}}if(e.state===`expired`){let n=t(`projectHeader.runtime.mobilePairingExpired`);return{buttonClassName:vb(e),indicatorState:`interrupted`,isActive:!0,statusLabel:n,tooltip:n}}return{buttonClassName:vb(e),indicatorState:`error`,isActive:!0,statusLabel:t(`projectHeader.runtime.mobileUnavailable`),tooltip:e.error??t(`projectHeader.runtime.mobileUnavailable`)}},bb=(e,t)=>t.find(t=>t.id===e)?.displayName??e,xb=({activeTool:e,agents:t=[],onToolChange:n})=>{let{t:r}=K(`common`);return(0,X.jsx)(`div`,{role:`group`,"aria-label":r(`projectHeader.agent.triggerAriaLabel`),className:`flex items-center gap-1 rounded-xl border border-border/70 bg-background/70 p-1 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]`,children:t.map(t=>{let r=e===t.id;return(0,X.jsx)(Q,{type:`button`,variant:r?`secondary`:`ghost`,size:`xs`,className:r?`rounded-lg px-2.5 text-xs text-foreground`:`rounded-lg px-2.5 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>n(t.id),children:t.displayName},t.id)})})},Sb=({activeTool:e,agents:t=[],onToolChange:n})=>{let{t:r}=K(`common`);return(0,X.jsxs)(Ry,{children:[(0,X.jsx)(zy,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":r(`projectHeader.agent.menuAriaLabel`),variant:`ghost`,className:`h-8 gap-2 rounded-xl border border-border/70 bg-background/70 px-3 text-sm font-medium text-foreground hover:bg-accent/20`,children:[(0,X.jsx)(Yy,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{children:bb(e,t)}),(0,X.jsx)(mv,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,X.jsx)(By,{align:`end`,className:`w-44`,children:t.map(t=>{let r=e===t.id;return(0,X.jsxs)(Vy,{onSelect:()=>n(t.id),children:[(0,X.jsx)(Yy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:t.displayName}),r&&(0,X.jsx)(Xy,{className:`h-4 w-4 text-muted-foreground`})]},t.id)})})]})},Cb=({hasActiveGitHubRuns:e=!1,onOpenGitHubActions:t})=>{let{t:n}=K(`common`);return t?(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsxs)(Q,{type:`button`,"aria-label":n(`workspaceControls.openGitHubActionsAriaLabel`),onClick:t,variant:`ghost`,className:`h-8 gap-2 rounded-xl border border-border/70 bg-background/70 px-3 text-sm font-medium text-muted-foreground hover:bg-accent/20 hover:text-foreground`,children:[(0,X.jsx)(Zy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:n(`workspaceControls.githubActions`)})]}),e&&(0,X.jsx)(Hy,{state:`running`,className:`absolute -top-0.5 -right-0.5`})]}):null},wb=({onOpenActivity:e})=>{let{t}=K(`common`);return e?(0,X.jsxs)(Q,{type:`button`,"aria-label":t(`projectHeader.runtime.openActivity`),onClick:e,variant:`ghost`,className:`h-8 gap-2 rounded-xl border border-border/70 bg-background/70 px-3 text-sm font-medium text-muted-foreground hover:bg-accent/20 hover:text-foreground`,children:[(0,X.jsx)(Qy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:t(`projectHeader.runtime.activityLabel`)})]}):null},Tb=({mobileAccessStatus:e,onMobileAccessOpen:t})=>{let{t:n}=K(`common`);if(!t)return null;let r=yb(e,n);return(0,X.jsx)(lv,{content:r.tooltip,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":n(`projectHeader.runtime.openMobileAccess`),onClick:t,variant:`ghost`,className:`h-8 gap-2 rounded-xl border px-3 text-sm font-medium ${r.buttonClassName}`,children:[(0,X.jsx)(Hy,{state:r.indicatorState,className:`mt-0`}),(0,X.jsx)(`span`,{children:n(`projectHeader.runtime.mobileLabel`)})]})})},Eb=({hasActiveGitHubRuns:e=!1,mobileAccessStatus:t,onMobileAccessOpen:n,onOpenActivity:r,onOpenGitHubActions:i,onOpenExecutionRuntimes:a})=>{let{t:o}=K(`common`),{hasRunningUpgrade:s,renderUpgradeMenuItems:c}=qy({}),l=yb(t,o),u=o(`projectHeader.runtime.triggerLabel`),d=null;return i&&e?d=`running`:n&&l.isActive?(u=l.statusLabel,d=l.indicatorState):s&&(u=o(`projectHeader.runtime.toolUpdateRunning`),d=`running`),(0,X.jsxs)(Ry,{children:[(0,X.jsx)(zy,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,"aria-label":o(`projectHeader.runtime.triggerAriaLabel`),variant:`ghost`,className:`relative h-8 gap-2 rounded-xl border border-border/70 bg-background/70 px-3 text-sm font-medium text-foreground hover:bg-accent/20`,children:[(0,X.jsx)(Uy,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{children:u}),d&&(0,X.jsx)(Hy,{state:d,className:`absolute -top-0.5 -right-0.5`})]})}),(0,X.jsxs)(By,{align:`end`,className:`w-60`,children:[a&&(0,X.jsxs)(Vy,{onSelect:a,children:[(0,X.jsx)(Uy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openExecutionRuntimes`)})]}),r&&(0,X.jsxs)(Vy,{onSelect:r,children:[(0,X.jsx)(Qy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openActivity`)})]}),i&&(0,X.jsxs)(Vy,{onSelect:i,children:[(0,X.jsx)(Zy,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openGitHubActions`)}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(e?`projectHeader.runtime.githubStatusRunning`:`projectHeader.runtime.githubStatusIdle`)})]}),n&&(0,X.jsxs)(Vy,{onSelect:n,children:[(0,X.jsx)(Hy,{state:l.indicatorState,className:`mt-0`}),(0,X.jsx)(`span`,{className:`flex-1`,children:o(`projectHeader.runtime.openMobileAccess`)}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l.statusLabel})]}),c()]})]})},Db=({activeTool:e,agents:t=[],hasActiveGitHubRuns:n,onMobileAccessOpen:r,onOpenActivity:i,onOpenGitHubActions:a,onOpenExecutionRuntimes:o,onToolChange:s})=>{let c=pb(),l=_b(hb);return(0,X.jsxs)(`div`,{className:`flex w-full min-w-0 items-center justify-end gap-2`,children:[l?(0,X.jsx)(xb,{activeTool:e,agents:t,onToolChange:s}):(0,X.jsx)(Sb,{activeTool:e,agents:t,onToolChange:s}),l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Cb,{hasActiveGitHubRuns:n,onOpenGitHubActions:a}),(0,X.jsx)(wb,{onOpenActivity:i}),(0,X.jsx)(Tb,{mobileAccessStatus:c,onMobileAccessOpen:r}),(0,X.jsx)(Jy,{onOpenExecutionRuntimes:o})]}):(0,X.jsx)(Eb,{hasActiveGitHubRuns:n,mobileAccessStatus:c,onMobileAccessOpen:r,onOpenActivity:i,onOpenGitHubActions:a,onOpenExecutionRuntimes:o})]})},Ob=`common`,kb={en:{common:{appName:`Archon`,codeBlock:{copy:`Copy code`,copied:`Code copied`,failure:`Unable to copy code.`},postBuildChecks:{blockedReason:`Wait for post-Build Checks to finish before sending another prompt.`,progress:`{{passed}} passed, {{failed}} failed`,status:{queued:`Checks queued`,running:`Checks running`,waiting:`Checks waiting`,completed:`Checks passed`,failed:`Checks failed`,cancelled:`Checks stopped`,interrupted:`Checks interrupted`},autoFix:{attempt:`Attempt {{current}} of {{total}}`,phase:{dispatching:`Starting automatic repair`,repairing:`Repairing checks`,rerunning:`Rerunning the originating check batch`,stopping:`Stopping automatic repair`,terminal:`Automatic repair finished`,fallback:`Continuation was rejected; starting a fresh repair`},terminal:{passed:`Automatic repair passed all checks`,ineligible:`These failures cannot be repaired automatically`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The repair agent failed`,no_workspace_changes:`The repair agent made no changes`,unchanged_failures:`Automatic repair made no progress`,user_cancelled:`Automatic repair was stopped by the user`,stale:`Check definitions or workspace became stale`,exhausted:`Automatic repair used all three attempts`,interrupted:`Automatic repair was interrupted`}}},workspaceTabs:{ariaLabel:`Project workspace`,board:`Board`,chat:`Chat`,spec:`Spec`,memory:`Memory`},destinationUnavailable:{errorTitle:`Unable to open destination`,errorDescription:`Archon could not load this destination. Check your connection and try again.`,retry:`Try again`,destinationTitle:`Destination unavailable`,destinationDescription:`This item may have been deleted, may not belong to this project, or is not available in this workspace.`,projectTitle:`Project unavailable`,projectDescription:`This project no longer exists or is not available for this link.`,openWorkspace:`Open nearest workspace`,openRetainedProject:`Open {{project}}`,openDefaultProject:`Open {{project}}`,createProject:`Create project`},executionEnvironmentBadge:{ariaLabel:`Execution environment: {{evidence}}`,provider:{host:`Host`,docker_sandbox:`Docker Sandbox`,unknown:`Unknown provider`},isolation:{host_process:`Host process`,microvm:`MicroVM`,unknown:`Unknown isolation`},lifecycle:{queued:`Queued`,preparing:`Preparing`,ready:`Ready`,running:`Running`,stopped:`Stopped`,retiring:`Retiring`,cleanup_pending:`Cleanup pending`,retired:`Retired`,failed:`Failed`,unavailable:`Unavailable`,unknown:`State unavailable`},degraded:`Degraded`},activityView:{title:`Activity`,description:`Durable execution history for activity in this project.`,timelineAriaLabel:`Lifecycle timeline`,runTitle:`{{kind}} · {{status}}`,runAttemptTitle:`{{kind}}, attempt {{count}}`,scope:{project:{title:`Activity`,description:`Durable execution history for activity in this project.`,srTitle:`Project activity`,srDescription:`Inspect durable execution runs and transition evidence for this project.`,emptyTitle:`No activity yet`,emptyDescription:`Execution runs will appear here when they start.`},ticket:{title:`Ticket activity`,description:`Durable execution history for this ticket.`,srTitle:`Ticket activity`,srDescription:`Inspect durable execution runs and transition evidence for this ticket.`,emptyTitle:`No ticket activity yet`,emptyDescription:`Execution runs linked to this ticket will appear here.`},bundle:{title:`Bundle activity`,description:`Durable execution history for this bundle.`,srTitle:`Bundle activity`,srDescription:`Inspect durable execution runs and transition evidence for this bundle.`,emptyTitle:`No bundle activity yet`,emptyDescription:`Execution runs linked to this bundle will appear here.`},chat:{title:`Chat activity`,description:`Durable execution history for this Chat session.`,srTitle:`Chat activity`,srDescription:`Inspect durable execution runs and transition evidence for this Chat session.`,emptyTitle:`No Chat activity yet`,emptyDescription:`Execution runs linked to this Chat session will appear here.`},spec:{title:`Spec activity`,description:`Durable execution history for this Spec session.`,srTitle:`Spec activity`,srDescription:`Inspect durable execution runs and transition evidence for this Spec session.`,emptyTitle:`No Spec activity yet`,emptyDescription:`Execution runs linked to this Spec session will appear here.`}},filters:{ariaLabel:`Activity filters`,kind:`Run type`,allKinds:`All runs`,status:`Status`,allStatuses:`All statuses`},automationLoop:{kind:{review_auto_fix:`Review repair loop`,check_auto_fix:`Check repair loop`},phase:{observing:`Observing Review findings`,acting:`Applying repairs`,gating:`Evaluating required checks`,verifying:`Running fresh Review verification`,dispatching:`Dispatching repair`,repairing:`Repairing checks`,rerunning:`Rerunning checks`,stopping:`Stopping`,paused:`Paused`,terminal:`Finished`},iteration:`Iteration {{current}} of {{total}}`,state:{unavailable:`Outcome unavailable`},completedIn:`Completed in {{duration}}`,duration:{milliseconds_one:`{{count}} ms`,milliseconds_other:`{{count}} ms`,seconds_one:`{{count}} second`,seconds_other:`{{count}} seconds`,minutes_one:`{{count}} minute`,minutes_other:`{{count}} minutes`,hours_one:`{{count}} hour`,hours_other:`{{count}} hours`},outcome:{review_auto_fix:{repaired:`Blocking Review findings were repaired`,continuing:`Another Review repair iteration is required`,unchanged:`Blocking Review findings remain unchanged`,exhausted:`The Review repair budget was exhausted`,failed:`The Review repair loop failed`,cancelled:`The Review repair loop was cancelled`,interrupted:`The Review repair loop was interrupted`,paused:`The Review repair loop is paused`},check_auto_fix:{passed:`Checks passed after automatic repair`,ineligible:`Failed checks were not eligible for automatic repair`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The check repair agent failed`,no_workspace_changes:`The repair made no workspace changes`,unchanged_failures:`The same check failures remain`,user_cancelled:`Automatic check repair was cancelled`,stale:`Check definitions or workspace evidence became stale`,exhausted:`The check repair budget was exhausted`,interrupted:`Automatic check repair was interrupted`}},stopReason:{review_auto_fix:{no_blocking_findings:`Fresh Review verification found no blocking findings`,max_iterations:`The historical iteration limit was reached`,automation_disabled:`Review repair automation was disabled`,action_failed:`The repair action failed`,gate_failed:`The required-check gate blocked progression`,verification_failed:`Fresh Review verification failed`,no_progress:`Fresh Review verification found no progress`,open_questions:`Open questions require attention`,configuration_changed:`Automation configuration changed`,invalid_lineage:`The automation lineage became invalid`,stale_evidence:`Required evidence became stale`,manual_pause:`The loop was paused manually`,cancelled:`The loop was cancelled`,interrupted:`The loop was interrupted`},check_auto_fix:{passed:`Checks passed after automatic repair`,ineligible:`Failed checks were not eligible for automatic repair`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The check repair agent failed`,no_workspace_changes:`The repair made no workspace changes`,unchanged_failures:`The same check failures remain`,user_cancelled:`Automatic check repair was cancelled`,stale:`Check definitions or workspace evidence became stale`,exhausted:`The check repair budget was exhausted`,interrupted:`Automatic check repair was interrupted`}}},kind:{test:`Tests`,check_batch:`Check batch`,check_attempt:`Check attempt`,check_repair:`Check repair`,check_auto_fix:`Automatic check repair`,github_actions:`GitHub Actions`,plan:`Plan`,planning_agent:`Planning agent`,build:`Build`,review:`Review`,chat_turn:`Chat turn`,spec_turn:`Spec turn`,spec_review:`Spec review`,build_follow_up:`Build follow-up`,plan_follow_up:`Plan follow-up`,automation_progression:`Automation progression`,automation_review_fix:`Automated review fix`,automation_commit:`Automated commit`,automation_push:`Automated push`,automation_pull_request:`Automated pull request`,repository_graph_scan:`Repository graph scan`,environment_validation:`Environment validation`,git_push:`Git push`,service:`Service`,unknown:`Run`},status:{queued:`Queued`,running:`Running`,waiting:`Waiting`,approval_required:`Awaiting approval`,completed:`Completed`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`,unknown:`Unknown status`},checkOutcome:{passed:`Passed`,command_failure:`Command failed`,spawn_failure:`Process could not start`,infrastructure_failure:`Check infrastructure failed`,evidence_persistence_failure:`Check evidence could not be saved`,timeout:`Timed out`,workspace_changed_before_start:`Workspace changed before start`,user_stop:`Stopped by user`,restart_loss:`Interrupted by server restart`,shutdown_loss:`Interrupted by server shutdown`},currency:{current:`Current`,stale:`Stale`,pending:`Pending completion`,unavailable:`Unable to verify`},actions:{retry:`Retry`,retrying:`Retrying...`,rerun:`Rerun`,rerunning:`Rerunning...`,openSource:`View source`,openProvider:`Open in GitHub`,tryAgain:`Try again`,viewDetails:`View details`,viewDetailsForRun:`View details for {{kind}}, attempt {{count}}`,viewDetailsForRunWithLoopSummary:`{{run}}. {{summary}}`,viewDetailsForCheck:`View details for {{name}}`,loadMore:`Load more`,cancel:`Cancel`,close:`Close`},states:{loading:`Loading activity...`,reconnecting:`Connection lost. Reconnecting and preserving the last known activity...`,error:`Unable to load activity right now.`,emptyTitle:`No activity yet`,emptyDescription:`Execution runs will appear here when they start.`},errors:{list:`Unable to load execution runs right now.`,details:`Unable to load run details right now.`,event:`Unable to load the requested activity event right now.`,retry:`Unable to retry this run right now.`},events:{fallback:`Run state changed`,sequence:`Sequence`,transition:`Status`,transitionValue:`{{from}} to {{to}}`,outcome:`Outcome`,timeInState:`Time in state`},group:{ariaLabel:`Execution sequence`,parentOutsidePage:`{{kind}} parent outside the loaded page`},environmentContext:{summary:`{{target}} · revision {{revision}} · {{provider}}`,unknown:`Unknown`},buildEvidence:{timeline:{host:`Build environment: This machine (host)`,docker_sandbox:`Build environment: Docker Sandbox · revision {{revision}}`,unknown:`Build environment: Unknown`},unknown:`Unknown`,profileSelection:`Profile {{fingerprint}} · {{reason}}`,selectionReason:{project_active_at_acceptance:`selected when the Build was accepted`,historical_lineage:`retained from historical Build lineage`,unknown:`selection reason not recognized`},worktreePreparation:{worktree_and_sync_only:`Host prepared the worktree and synchronized files only; this is not sandbox evidence.`,host_orchestration_and_execution:`Host prepared the worktree and also executed the Build workload.`,unknown:`Preparation authority was not recorded.`},setupOutcome:{running:`Setup is running ({{count}} commands)`,completed:`Setup executed ({{count}} commands)`,noop:`No setup commands were configured`,reused:`Setup evidence was reused ({{count}} commands)`,failed:`Setup failed ({{count}} commands)`},launcher:{host_shell:`Host shell`,host_process:`Host process`,docker_sandbox_exec:`Docker Sandbox execution`,unknown:`Unknown launcher classification`},authentication:{api_key:`API key`,oauth:`OAuth`,unknown:`Unknown authentication class`},credentialDelivery:{host_environment_inheritance:`legacy host environment inheritance`,docker_brokered:`Docker-brokered`,none_required:`none required`,unknown:`credential delivery unknown`},credentialClassification:{brokered_api_key:`validated brokered API key`,brokered_oauth:`validated brokered OAuth`,file_exposed:`credential exposed by file`,environment_exposed:`credential exposed by environment`,guest_stored:`credential stored in guest`,unavailable:`credential unavailable`,unknown:`credential delivery unknown`,legacy_host_inherited:`legacy host inheritance`},credential:`{{agent}} · {{authentication}} · {{delivery}}`,noCredentialRequirements:`No runtime credential requirements recorded`,network:{summary:`Network: {{mode}} · {{enforcement}}`,mode:{unrestricted:`Unrestricted requested`,allowlist:`Destination allowlist requested`},enforcement:{enforced_scoped:`Sandbox-scoped enforcement proven`,declarative_only:`Declarative only`,none:`No network enforcement requested`,unknown:`Network enforcement not proven`},posture:{allow_all:`Global allow-all`,deny_all:`Global deny-all`,mixed:`Mixed global policy`,none_initialized:`Policy not initialized`,unknown:`Unknown global posture`}},fallback:{block:`Blocked rather than falling back`,explicit_host:`Explicit host fallback allowed but not used`,used:`Fallback was used; inspect the recorded reason`,unknown:`Fallback policy was not recognized`},target:`{{kind}}: {{key}}`,provider:{host:`This machine (host)`,docker_sandbox:`Docker Sandbox`,unknown:`Unknown`}},environmentLifecycle:{queued:`Queued`,preparing:`Preparing`,ready:`Ready`,running:`Running`,stopped:`Stopped`,retiring:`Retiring`,cleanup_pending:`Cleanup pending`,retired:`Retired`,failed:`Failed`,unavailable:`Unavailable`,unknown:`Unknown`},artifacts:{title:`Artifacts`,evidence:`Evidence`,summaryAriaLabel_one:`Evidence, {{count}} artifact`,summaryAriaLabel_other:`Evidence, {{count}} artifacts`,count_one:`{{count}} artifact`,count_other:`{{count}} artifacts`,overflow_one:`+{{count}} more`,overflow_other:`+{{count}} more`,overflowDescription_one:`{{count}} additional artifact is not shown in this summary.`,overflowDescription_other:`{{count}} additional artifacts are not shown in this summary.`,sensitiveTitle:`Sensitive artifact`,untitledTitle:`Untitled artifact`,kindLabel:`Kind`,mediaType:`Media type`,size:`Size`,expires:`Expires`,sensitivityLabel:`Sensitivity`,availabilityLabel:`Availability`,downloadOnly:`Download only. Preview and external access are disabled for sensitive artifacts.`,kind:{report:`Report`,screenshot:`Screenshot`,log_excerpt:`Log excerpt`,structured_result:`Structured result`},sensitivity:{normal:`Standard`,sensitive:`Sensitive`},availability:{available:`Available`,expired:`Expired`,missing:`Missing`,deletion_failed:`Deletion pending`,deleted:`Deleted`},actions:{download:`Download`,downloadAriaLabel:`Download {{title}}`,open:`Open`,openAriaLabel:`Open {{title}}`},unavailable:{expired:`This artifact has expired and is no longer available.`,missing:`This artifact can no longer be found.`,deletion_failed:`This artifact is unavailable while deletion is completed.`,deleted:`This artifact has been deleted.`,noAction:`No action is available for this artifact.`}},retry:{confirmTitle:`Retry as a new attempt?`,confirmDescription:`A fresh attempt and provider session will be created. The previous attempt and all retained evidence will remain in history.`,confirmAction:`Create new attempt`,retentionNotice:`Retrying creates a fresh attempt while retaining this attempt and its evidence.`},rerun:{confirmTitle:`Rerun this check batch?`,confirmDescription:`A new batch will run the same source checks. This batch and its retained evidence will remain in history.`,confirmAction:`Rerun checks`,retentionNotice:`Rerunning creates a new batch while retaining this batch and its evidence.`},retryDenial:{unsupported_kind:`This run type cannot be retried.`,status_not_retryable:`This run is not in a retryable status.`,automation_resume_required:`Resume this run from its automation controls instead.`,retry_already_created:`A newer retry attempt already exists.`,retry_source_superseded:`Newer source activity has superseded this run.`,attempt_superseded:`A newer attempt has superseded this run.`,retry_target_missing:`The retry target no longer exists.`,retry_target_busy:`The retry target is currently busy.`,retry_state_incompatible:`The source is no longer in a compatible state for retry.`,retry_input_unavailable:`The exact input required for this retry is no longer available.`,retry_workspace_unavailable:`The required workspace is unavailable.`,unknown:`This run cannot be retried right now.`},details:{ariaLabel:`Run details`,title:`Run details`,selectPrompt:`Select a run to inspect its durable details and transition evidence.`,status:`Status`,attempt:`Attempt`,attemptValue:`Attempt {{count}}`,lineage:`Lineage`,retryOfAttempt:`Retry of attempt {{count}}`,retryLineage:`Retry lineage · attempt {{count}}`,priorAttemptUnavailable:`Prior attempt is outside retained history`,source:`Source`,environment:`Environment`,sourceUnavailable:`Source unavailable`,created:`Created`,started:`Started`,completed:`Completed`,failureReason:`Failure reason`,environmentValidationEvidence:`Environment validation evidence`,buildExecutionEvidence:`Build execution evidence`,buildExecutionEvidenceNotice:`Recorded for this Build run. Later project setting changes do not alter this evidence or its follow-up lineage.`,buildExecutionUnknown:`No recognized provider evidence was recorded. Archon does not assume host execution.`,buildProvider:`Build environment`,environmentId:`Environment ID`,providerVersion:`Provider version`,targetWorkspace:`Target workspace`,validationFingerprint:`Validation fingerprint`,capabilities:`Capabilities`,capabilityDetails:{empty:`No capability observations recorded`,labels:{filesystem:`Filesystem`,workspace_access:`Workspace access`,workspace_path:`Workspace path`,additional_mounts:`Additional mounts`,integration_access:`Integration access`,remote_git:`Remote Git`,resources:`Resources`,isolation:`Isolation`,directWritableWorkspace:`Direct writable workspace`,transparentHeadlessStreams:`Transparent headless streams`,credentialBrokering:`Credential brokering`,enforcedNetworkAllowlist:`Enforced network allowlist`,persistentEnvironments:`Persistent environments`,resourceIsolation:`Resource isolation`,nestedContainers:`Nested containers`,publishedPorts:`Published ports`,resourceControls:`Resource controls`},values:{supported:`Supported`,unsupported:`Unsupported`,unknown:`Unknown`,microvm:`MicroVM`,"host-process":`Host process`,exact_target:`Exact target`,none:`None`,denied:`Denied`,provider_defaults:`Provider defaults`}},degradation:`Degradation`,authenticationMode:`Authentication mode`,credentialDelivery:`Credential delivery`,profileFingerprint:`Profile fingerprint`,profileRevision:`Profile revision`,profileSelected:`Profile selected`,worktreePreparation:`Worktree preparation`,setupExecution:`Setup execution`,setupPlacement:`Setup placement`,setupLauncher:`Setup launcher`,setupReusedFrom:`Setup reused from`,agentPlacement:`Agent placement`,agentLauncher:`Agent launcher`,runtimeCredentials:`Runtime credential class`,unsupportedRequirements:`Unsupported requirements`,networkEnforcement:`Network enforcement`,networkMode:`Requested network mode`,networkPosture:`Observed network posture`,networkDestinations:`Network destination decisions`,effectiveCapabilities:`Effective filesystem, integration, Git, and resource capabilities`,fallbackEvidence:`Fallback`,fallbackSource:`Fallback source`,fallbackReason:`Fallback reason`,agent:`Agent`,unknown:`Unknown`,none:`None`,environmentRevision:`Environment revision`,environmentLifecycle:`Persistent environment state`,restartInterruptionEvidence:`This validation was interrupted by a server restart. The persistent environment is tracked separately and may still be available.`,loading:`Loading run details...`,testEvidence:`Test evidence`,checkBatchEvidence:`Check batch`,checkAttemptEvidence:`Check attempt`,checkRepairEvidence:`Repair provenance`,checkAutoFixEvidence:`Automatic repair history`,repairSource:`Repair source`,causalBuild:`Causal Build run`,causalExecution:`Causal execution run`,currentPhase:`Current phase`,launchDecision:`Launch decision`,continuation:`Continued provider session`,freshLaunch:`Fresh provider session`,fallbackUsed:`Fallback used`,fallbackYes:`Yes, before execution`,fallbackNo:`No`,repairAttempt:`Repair attempt {{current}} of {{total}}`,terminalExplanation:`Terminal explanation`,repairSourceType:{ticket:`Ticket`,chat_session:`Chat session`},launch:{continued:`Continued exact provider session`,fresh:`Fresh same-configuration session`},autoFixPhase:{dispatching:`Dispatching automatic repair`,repairing:`Repairing checks`,rerunning:`Rerunning originating batch`,stopping:`Stopping`,terminal:`Terminal`},autoFixTerminal:{passed:`Passed`,ineligible:`Not auto-fixable`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`Agent failure`,no_workspace_changes:`No workspace changes`,unchanged_failures:`No progress`,user_cancelled:`Cancelled by user`,stale:`Definitions or workspace became stale`,exhausted:`Three attempts exhausted`,interrupted:`Interrupted`},reviewLoop:{title:`Review repair progression`,description:`Each iteration separates the observed Review, repair action, required-check gate, and fresh Review verification.`,iterationsAriaLabel:`Review repair iterations`,iteration:`Iteration {{current}} of {{total}}`,phase:{label:`{{presentation}} · {{authoritative}}`,presentation:{observing:`Observing`,acting:`Acting`,gating:`Gating`,verifying:`Verifying`,paused:`Paused`,terminal:`Terminal`},authoritative:{observed:`Observed`,action_claimed:`Action claimed`,action_active:`Action active`,gate_pending:`Gate pending`,gate_active:`Gate active`,verification_pending:`Verification pending`,verification_active:`Verification active`,paused:`Paused`,terminal:`Terminal`}},role:{observation:`Observation`,actionEnvelope:`Action envelope`,action:`Action`,gate:`Required-check gate`,verification:`Fresh Review verification`},state:{available:`Available`,unavailable:`Unavailable`,not_started:`Not started`,not_required:`Not required`},navigation:{openReview:`Open observed Review run`,openActionEnvelope:`Open action envelope run`,openAction:`Open repair action run`,openGate:`Open required checks`,openVerification:`Open verification Review run`},blocking:{triggering:`Blocking findings observed`,resulting:`Blocking findings after verification`,failedResult:`Unavailable because verification did not produce a result`},evaluator:{observation:`Observation evaluator`,verification:`Verification evaluator`,modelVariant:`{{model}} · {{variant}}`},outcome:{label:`Iteration outcome`,pending:`Outcome pending`,repaired:`Repaired`,continuing:`Continuing`,unchanged:`Unchanged`,exhausted:`Budget exhausted`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`,paused:`Paused`},stopReason:{label:`Stop reason`,no_blocking_findings:`No blocking findings remained after fresh Review verification`,max_iterations:`The historical iteration limit was reached`,automation_disabled:`Review repair automation was disabled`,action_failed:`The repair action failed`,gate_failed:`The required-check gate failed`,verification_failed:`Fresh Review verification failed`,no_progress:`Fresh Review verification found no progress`,open_questions:`Open questions require attention`,configuration_changed:`Automation configuration changed`,invalid_lineage:`The automation lineage became invalid`,stale_evidence:`Required evidence became stale`,manual_pause:`The loop was paused manually`,cancelled:`The loop was cancelled`,interrupted:`The loop was interrupted`},policy:{title:`Historical automation policy and decisions`,historicalNotice:`These snapshots record the policy used at each decision. Current project settings may differ.`,depth:`Automation depth`,maximum:`Maximum Review iterations`,fixEnabled:`Review repair`,pauseOnQuestions:`Pause on open questions`,severity:`Blocking severity`,decisionsAriaLabel:`Historical Review repair decisions`,depthValue:{manual:`Manual`,auto_review:`Automatic Review`,auto_commit:`Automatic commit`,auto_push:`Automatic push`,auto_pr:`Automatic pull request`},severityValue:{high:`High`,medium:`Medium`,low:`Low`}},value:{enabled:`Enabled`,disabled:`Disabled`},decisionPoint:{claim:`Repair claimed`,action_completion:`Action completed`,gate_admission:`Gate admission`,verification_scheduling:`Verification scheduled`,verification_completion:`Verification completed`,resume:`Progression resumed`},decisionCode:{repair_admitted:`Repair was admitted`,action_completed:`Repair action completed`,required_checks_passed:`Required checks passed`,required_checks_blocked:`Required checks blocked progression`,checks_not_required:`Required checks were not required`,verification_admitted:`Fresh Review verification was admitted`,verification_completed:`Fresh Review verification completed`,verification_failed:`Fresh Review verification failed`,resume_iteration_requested:`Iteration resume was requested`,verification_reconciled_on_resume:`Verification was reconciled on resume`,resume_verification_repair_admitted:`A verification repair was admitted on resume`,resume_repair_admitted:`A repair was admitted on resume`,resume_repair_claimed:`A repair was claimed on resume`,verification_reconciled_on_startup:`Verification was reconciled after startup`,startup_verification_repair_admitted:`A verification repair was admitted after startup`,unknown:`A historical automation decision was recorded`},gateEvidence:{title:`Required-check gate evidence`,decision:`Gate decision`,policy:`Historical policy state`,reasons:`Reasons: {{reasons}}`,checksAriaLabel:`Required checks evaluated by the gate`},gateDecision:{passed:`Passed`,blocked:`Blocked`},policyStatus:{valid:`Valid`,invalid:`Invalid`},currency:{current:`Current evidence`,stale:`Stale evidence`},gateReason:{not_required:`Checks were not required`,policy_invalid:`The required-check policy was invalid`,policy_drift:`The required-check policy changed`,workspace_unavailable:`Workspace identity was unavailable`,intended_identity_mismatch:`Workspace identity did not match`,missing_evidence:`Required evidence was missing`,target_mismatch:`Check evidence targeted another workspace`,batch_not_completed:`The check batch was incomplete`,incomplete_evidence:`Check evidence was incomplete`,duplicate_evidence:`Duplicate check evidence was present`,extra_evidence:`Unexpected check evidence was present`,definition_drift:`Check definitions changed`,attempt_failed:`A required check failed`,attempt_stale:`A required check was stale`,target_busy:`The check target was busy`,check_start_failed:`Required checks could not start`,unknown:`An unavailable gate reason was recorded`},gateCheckOutcome:{passed:`Passed`,command_failure:`Command failed`,spawn_failure:`Process could not start`,infrastructure_failure:`Check infrastructure failed`,evidence_persistence_failure:`Check evidence could not be saved`,timeout:`Timed out`,workspace_changed_before_start:`Workspace changed before start`,user_stop:`Stopped by user`,restart_loss:`Interrupted by server restart`,shutdown_loss:`Interrupted by server shutdown`,ambiguous_process_loss:`Process outcome was ambiguous`,environment_loss:`Execution environment was lost`,unknown:`Outcome unavailable`},agentEvidence:{title_one:`{{count}} bounded agent evidence item`,title_other:`{{count}} bounded agent evidence items`,boundedNotice:`Only bounded response and failure summaries are retained here. Conversations and internal prompts are not included.`,truncated:`This bounded summary was truncated by the evidence limit.`},agentStatus:{running:`Running`,done:`Completed`,error:`Failed`,stopped:`Stopped`}},autoFix:{title:`Automatic check repair`,attemptsAriaLabel:`Automatic repair attempts`,phaseWithAttempt:`{{phase}} · attempt {{current}} of {{total}}`,phase:{dispatching:`Dispatching automatic repair`,repairing:`Repairing checks`,rerunning:`Verifying repairs`,stopping:`Stopping automatic repair`,terminal:`Automatic repair finished`},budget:{consumed:`Attempts consumed`,maximum:`Maximum attempts`,remaining:`Attempts remaining`},cancellation:{label:`Cancellation`,requested:`Requested`,notRequested:`Not requested`},loopDuration:`Total duration`,completedIn:`Completed in {{duration}}`,causalExecution:`Causal execution run`,attempt:`Attempt {{current}} of {{total}}`,role:{observation:`Observation`,action:`Action`,verification:`Verification`},state:{notStarted:`Not started`,unavailable:`Unavailable`},navigation:{openSourceChecks:`Open source checks`,openRepairRun:`Open repair run`,openVerificationChecks:`Open verification checks`,openCausalRun:`Open causal run`},launchMode:{label:`Launch mode`,continued:`Continued provider session`,fresh:`Fresh provider session`},fallback:{label:`Continuation fallback`,used:`A fresh session was used after continuation was unavailable`},outcome:{label:`Outcome`},attemptOutcome:{active:`Repair is active`,pending:`Waiting for repair to start`,completed:`Repair action completed`,failed:`Repair failed`,cancelled:`Repair was cancelled`,interrupted:`Repair was interrupted`,dispatch_rejected:`Repair dispatch was rejected`},overallOutcome:{active:`Automatic repair is active`,passed:`Checks passed after automatic repair`,ineligible:`The failed checks were not eligible for automatic repair`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The repair agent failed`,no_workspace_changes:`The repair completed without workspace changes`,unchanged_failures:`The same check failures remained after repair`,user_cancelled:`Automatic repair was cancelled by the user`,stale:`Check definitions or the workspace changed during repair`,exhausted:`{{count}} attempts were exhausted without passing checks`,interrupted:`Automatic repair was interrupted`},source:{label:`Repair source`,ticket:`Ticket`,chat_session:`Chat session`},diagnostics:{loop:`Diagnostic evidence`,attempt:`Attempt diagnostic evidence`},duration:{milliseconds_one:`{{count}} ms`,milliseconds_other:`{{count}} ms`,seconds_one:`{{count}} second`,seconds_other:`{{count}} seconds`,minutes_one:`{{count}} minute`,minutes_other:`{{count}} minutes`,hours_one:`{{count}} hour`,hours_other:`{{count}} hours`}},deterministicEvidenceNotice:`Diagnostics and rerun results are deterministic records. Agent repair summaries are not check evidence.`,sourceBatch:`Source check batch`,sourceAttempts:`Source attempts`,sourceDiagnostics:`Source diagnostics`,sourceRawOutputAttempts:`Source raw-output attempts`,repairWrapper:`Repair wrapper`,followUpRun:`Build follow-up child`,repairChildRun:`Repair child run`,rerunBatch:`Rerun batch`,nextBoundary:`Next automation boundary`,policyFingerprint:`Policy fingerprint`,configurationFingerprint:`Check configuration`,repairResult:`Repair result`,repairPending:`Repair agent or rerun is still active`,boundary:{automation_review:`Pre-Review checks, then automatic Review`,automation_commit:`Required checks, then commit creation`,automation_push:`Required checks, then push`,automation_pull_request:`Required checks, then pull-request creation`,unknown:`No delivery progression is claimed`},providerEvidence:`Provider evidence`,command:`Command`,cwd:`Working directory`,target:`Target`,exitCode:`Exit code`,duration:`Duration`,output:`Output`,outputEmpty:`This run produced no output.`,outputExpired:`Test output expired under the short-retention policy. The run result and summary remain available.`,workflow:`Workflow`,branch:`Branch or ref`,conclusion:`Conclusion`,unnamedJob:`Unnamed job`,jobsExpired:`GitHub Actions job snapshots expired under the short-retention policy. Provider status and conclusion remain available.`,outputTruncated:`Older output was removed by the retention limit.`,selectedChecks:`Selected checks`,batchCounts:`{{passed}} passed, {{failed}} failed, {{running}} running, {{queued}} queued`,outcome:`Outcome`,directory:`Directory`,timeout:`Timeout`,currency:`Currency`,current:`Current`,stale:`Workspace changed`,retainedRange:`Retained byte range`,retainedRangeValue:`{{start}}-{{end}} of {{total}} bytes`,rerunSource:`Rerun source`,rerunSourceValue:`Attempt {{id}}`,evidenceUnavailable:`Detailed evidence is no longer available, but this durable run record remains inspectable.`,sourceNoLongerAvailable:`The original source no longer exists, so navigation is unavailable.`,transitions:`Transitions`,noTransitions:`No retained transitions are available for this run.`,evidenceAriaLabel:`Run transition evidence`},dialog:{srTitle:`Project activity`,srDescription:`Inspect durable execution runs and transition evidence for this project.`,closeAriaLabel:`Close Activity`}},approvalRequest:{title:`Exact action approval`,loading:`Loading approval evidence...`,refresh:`Refresh`,none:`None`,reason:`Decision note (optional)`,reasonPlaceholder:`Add context for the audit history`,conflict:`This request changed elsewhere or its exact action is stale. The authoritative state is shown below; refresh before returning to the originating action.`,history:`Approval history ({{count}})`,action:{git_push:`Force push`,custom_check:`Production custom check`},impact:{git_push:`This replaces remote branch history with the exact local commit shown below.`,custom_check:`This command may change an external production system.`},fields:{action:`Action`,target:`Target`,command:`Command`,branch:`Branch`,head:`Local commit`,remoteHead:`Remote commit`,profile:`Execution profile`,launcher:`Launcher`,environment:`Batch environment`,placement:`Attempt placement`,authority:`Effective capabilities`,degradations:`Capability degradation`,secrets:`Logical secret references`,expires:`Expires`},values:{noHostEnvironment:`None; this action runs on the host`,hostPlacement:`This machine (host)`,sandboxPlacement:`Docker Sandbox · {{id}}`,sandboxPlacementUnavailable:`Docker Sandbox placement unavailable`,launcher:{host_shell:`Host shell`,docker_sandbox_exec:`Docker Sandbox exec`}},status:{pending:`Awaiting approval`,approved:`Approved`,denied:`Denied`,cancelled:`Cancelled`,expired:`Expired`,invalidated:`Invalidated`,consumed:`Executing or completed`},actions:{approve:`Approve exact action`,approving:`Approving...`,deny:`Deny`,denying:`Denying...`,cancel:`Cancel request`,cancelling:`Cancelling...`},remediation:{approved:`Approved. The server will revalidate the exact action before execution.`,denied:`Denied. Return to the originating action if a different operation should be requested.`,cancelled:`Cancelled. Return to the originating action to create a new request.`,expired:`Expired. Return to the originating action to capture current state in a new request.`,invalidated:`The target or authority changed. Refresh the origin and request approval for the current exact action.`,consumed:`Approval was consumed. Use lifecycle evidence to confirm whether execution completed, failed, or became ambiguous.`,pending:`This request still needs a decision.`},errors:{load:`Unable to load approval evidence right now.`,decision:`Unable to update this approval request right now.`},notification:{title:`Action awaiting approval`,forcePush:`A force push is waiting for your decision.`,productionCheck:`A production check is waiting for your decision.`},context:{title:`Pending approvals`,action:{git_push:`Force push awaiting approval`,custom_check:`Production check awaiting approval`},openActivity:`Open Activity`,openChecks:`Open Checks`}},emptyState:{title:`Create your first project to start routing tickets into a real repo.`,description:`Pick the default agent Archon should use for planning and ticket work. Auto-config can optionally use a separate helper model.`,loadingToolPreference:`Loading tool preference...`,createFirstProject:`Create first project`},boardConfirmEmptyDoneModal:{heading:`Empty Done`,deletePrompt_one:`Delete {{count}} done ticket from the Done column?`,deletePrompt_other:`Delete {{count}} done tickets from the Done column?`,description:`Standalone ticket worktrees will be removed when applicable. Deleting the last parked ticket in a bundle also removes that shared bundle worktree.`,cancel:`Cancel`,deleting:`Deleting...`,confirm:`Delete all`},cardConfirmDeleteModal:{heading:`Delete ticket`,descriptionInBundle:`This removes the ticket from bundle "{{bundleName}}". The bundle and shared worktree stay available.`,descriptionStandalone:`This will also remove the worktree if one exists.`,cancel:`Cancel`,confirm:`Delete`},cardConfirmUndoModal:{defaultSubjectLabel:`ticket`,headingReview:`Undo review`,headingBuild:`Undo build`,descriptionReview:`This will revert the current review-step changes and move the {{subjectLabel}} back to build-done.`,descriptionBuild:`This will revert the current build-step changes and move the {{subjectLabel}} back to plan.`,cancel:`Cancel`,confirm:`Undo`},bundleSelector:{label:`Bundle`,emptyLabel:`No bundle`},jiraImportField:{error:`Unable to load the Jira issue right now.`,label:`Import from Jira`,placeholder:`PROJ-123 or issue URL`,importing:`Importing...`,import:`Import`},githubImportField:{error:`Unable to load the GitHub issue right now.`,label:`Import from GitHub`,placeholder:`Issue # or URL`,importing:`Importing...`,import:`Import`},externalImportField:{error:`Unable to load the {{provider}} issue right now.`,label:`Import issue`,importing:`Importing...`,import:`Import`,detectError:`Could not detect the source. Use a Jira key like PROJ-123, a GitHub number like 123, owner/repo#123, or a full issue URL.`,disabledProvider:`This looks like a {{provider}} reference, but {{provider}} is not connected.`,placeholderBoth:`PROJ-123, 123, owner/repo#123, or paste a URL`,formatsHintExamples:`Examples: PROJ-123 (Jira), 123 or owner/repo#123 (GitHub), or paste a full issue URL.`,formatsHintConnected:`Connected: {{providers}}`,formatsHintAriaLabel:`Accepted import formats`},externalSourceBadge:{tooltip:{jira:`Imported from Jira issue {{key}}`,github:`Imported from GitHub issue {{key}}`}},newTicketModal:{heading:`New Ticket`,actions:{plan:`Plan`,createTicket:`Create Ticket`,createAndBuild:`Create & Build`}},assignedIssuesInbox:{buttonAriaLabel:`Assigned issues inbox`,badgeAriaLabel:`{{count}} untracked assigned issues`,title:`Assigned to you`,emptyState:`You're all caught up — no untracked assigned issues for this project.`,errorState:`Unable to load assigned issues right now.`,refresh:`Refresh`,viewJira:`View on Jira`,viewGithub:`View on GitHub`,createTicket:`Create ticket`,spec:`Spec`,providerJira:`Jira`,providerGithub:`GitHub`},bundleCard:{addTicketTooltip:`Add ticket to this bundle`,addTicketAriaLabel:`Add ticket to bundle {{bundleName}}`,openActionsAriaLabel:`Open actions menu for bundle {{bundleName}}`,verification:`Verification`},ticketEditor:{automaticBundleLabel:`Create automatically`,planningFailed:`Planning failed. Please try again.`,bundleCreationUnavailable:`Bundle creation is unavailable.`,titleLabel:`Title`,titlePlaceholder:`What needs to be done?`,descriptionLabel:`Description`,descriptionPlaceholder:`Describe the task, acceptance criteria, context...`,bundlePreview:`Bundle preview:`,manageBundles:`Manage bundles`,cancel:`Cancel`,planning:`Planning...`},manageBundlesModal:{createError:`Unable to create the bundle right now.`,deleteError:`Unable to delete the bundle right now.`,title:`Manage bundles`,createTitle:`Create bundle`,createPendingTitle:`Preparing bundle workspace`,createPendingDescription:`Creating the worktree, syncing files, and running setup commands.`,bundleNameLabel:`Bundle name`,bundleNameAriaLabel:`Bundle name`,bundleNamePlaceholder:`Checkout flow`,createAction:`Create bundle`,existingTitle:`Existing bundles`,empty:`No bundles yet.`,selected:`Selected`,currentTarget:`Current target`,projectRootDescription:`Uses the project root on branch {{branch}}.`,switchTargetDescription:`Switch the project target away from this bundle before deleting it.`,inUseDescription:`Used by {{ticketCount}}.`,unusedDescription:`Unused and ready to delete.`,ticketCount_one:`{{count}} ticket`,ticketCount_other:`{{count}} tickets`,cancel:`Cancel`,deleting:`Deleting...`,deleteBundle:`Delete bundle`,delete:`Delete`,close:`Close`},card:{advance:{reviewBundle:`Review Bundle`,rerunReview:`Re-run review`},columnLabels:{plan:`Plan`,build:`Build`,review:`Review`,done:`Done`,trash:`Trash`},returnTo:`Return to {{state}}`,drawDependency:`Draw dependency`,createDependencyAriaLabel:`Create dependency from {{title}}`,undoInProgress:`Undo in progress...`},cardActionsMenu:{openAriaLabel:`Open actions menu for {{title}}`,delete:`Delete`,undoReview:`Undo Review`,undoBuild:`Undo Build`,buildChain:`Build Chain`,addTicketToBundle:`Add ticket`,run:`Run`,startingRun:`Starting Run...`,stopRun:`Stop Run`,stopping:`Stopping...`,pauseBuild:`Pause Build`,resumeBuild:`Resume Build`,interruptReview:`Interrupt Review`,interruptingReview:`Interrupting Review...`,files:`Files`,changes:`Changes`,verification:`Verification`,openIde:`Open IDE`,stopBuildChain:`Stop Build Chain`,done:`Done`,startChat:`Start Chat`},reviewInterrupt:{error:`Unable to interrupt the review right now.`},toolsMenu:{triggerAriaLabel:`Open tools menu`,runtimes:`Runtimes`,updateOpenCode:`Update OpenCode`,updateClaude:`Update Claude`,openCodeRunning:`Updating OpenCode...`,claudeRunning:`Updating Claude...`,openCodeSuccess:`OpenCode updated`,claudeSuccess:`Claude updated`,openCodeSuccessWithVersion:`OpenCode updated to {{version}}`,claudeSuccessWithVersion:`Claude updated to {{version}}`,openCodeUpToDate:`OpenCode is already up to date`,claudeUpToDate:`Claude is already up to date`,openCodeUpToDateWithVersion:`OpenCode is already up to date ({{version}})`,claudeUpToDateWithVersion:`Claude is already up to date ({{version}})`,openCodeFailed:`OpenCode update failed`,claudeFailed:`Claude update failed`,openCodeAlreadyRunning:`OpenCode update already running`,claudeAlreadyRunning:`Claude update already running`,networkError:`Unable to reach the server.`},statusBadge:{queued:`Queued`,planning:`Planning...`,building:`Building`,buildingWithGlyph:`⏳ Building`,reviewing:`Reviewing`,automation:`Automation`,checks:`Checks`,autoFix:`Auto-fix`,commit:`Commit`,push:`Push`,pr:`PR`,done:`✓ Done`,error:`✗ Error`,stopped:`Stopped`},cardStatusBadges:{stale:`Stale`,retry:`Retry`,openQuestions:`Open questions`,chainStart:`Chain start`},ticketAutomation:{depth:{manual:`Manual`,auto_review:`Auto-review`,auto_commit:`Auto-commit`,auto_push:`Auto-push`,auto_pr:`Auto-PR`},override:{title:`Ticket automation`,ariaLabel:`Ticket automation override`,depthAriaLabel:`Automation depth override`,inherit:`Inherit`,summaryLabel:`Automation: {{depth}} ({{source}})`,summaryInherited:`inherited`,summaryOverride:`override`,saving:`Saving...`,updateError:`Unable to update the bundle automation and reviewer settings right now.`,overridingProject:`Override`,autoPrDisabledHint:`Connect the GitHub integration to enable Auto-PR.`,fixToggleLabel:`Auto-fix review findings`,fixToggleDescription:`When automation reaches review, automatically fix blocking findings and re-review until the review is clean or the iteration cap is hit.`,fixToggleAriaLabel:`Auto-fix review findings override`,maxIterationsLabel:`Max fix iterations`,maxIterationsDescription:`Set how many review-fix passes this bundle may run before pausing with the findings unresolved.`,maxIterationsAriaLabel:`Max fix iterations source`,inheritProjectSetting:`Inherit project setting`,overrideSetting:`Override setting`,maxIterationsInputLabel:`Iterations`,maxIterationsInputAriaLabel:`Max fix iterations`,openQuestionsLabel:`Open Questions checkpoint`,openQuestionsDescription:`Pause before Review when Build has unresolved implementation questions.`,openQuestionsAriaLabel:`Open Questions checkpoint override`,enabled:`Enabled`,disabled:`Disabled`},reviewer:{title:`Reviewer`,description:`Choose a model for reviews in this bundle, or inherit the project setting.`,effective:`{{model}} · {{variant}}`,fallback:`Implementing model per ticket`,perTicketVariant:`Variant per ticket`,defaultVariant:`Model default`,sourceAriaLabel:`Reviewer setting source`,modelLabel:`Reviewer model`,variantLabel:`Reviewer variant`,clearOverride:`Clear bundle override`,availableVariants:`Available variants`,unavailableSelection:`Unavailable`,loading:`Loading reviewer models...`,unavailable:`Model discovery is unavailable. Reviewer override selection cannot be changed right now.`,sources:{bundle:`Bundle`,project:`Project`,fallback:`Fallback`},claudeTicketProvenance:`This workflow uses Claude. The Reviewer setting shown here follows the active agent in the application header.`},pause:{label:`Automation paused`,resume:`Resume`,resumePending:`Resume is starting. Wait for the bundle state to update.`,dismiss:`Dismiss`,abandon:`Abandon automation`,openChecks:`Open checks`,stop:`Stop automation`,stopTooltip:`Stop the automation work that is currently running for this bundle.`,abandonTooltip:`Discard the saved automation continuation and keep its execution history for diagnostics.`,iterationCounter:`Review fix iteration {{current}} of {{max}}`,resolveQuestions:`Resolve questions`,diagnostic:`Details: {{reason}}`,resumeOutcome:{complete_manual_boundary:`Resume closes the saved automation progression at the current manual boundary.`,start_review:`Resume starts automatic Review for this bundle.`,resume_review:`Resume continues the interrupted Review session before delivery automation can continue.`,rerun_review:`Resume reruns automatic Review for the latest bundle changes.`,start_review_fix:`Resume starts the next review-fix pass, then reviews the changes again.`,continue_commit_chain:`Resume continues automation with the commit chain.`,reconcile_commit:`Resume verifies whether the commit completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,reconcile_push:`Resume verifies whether the push completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,reconcile_pull_request:`Resume verifies whether the pull request action completed, continues if complete, retries only if confirmed absent, and stops safely if the result is ambiguous.`,rerun_required_checks:`Resume reruns the required checks against the current workspace before automated delivery continues.`,rerun_review_checks:`Resume reruns the pre-review checks against the current workspace before automatic Review starts.`},resumeDisabled:{bundle_agent_running:`Resume is unavailable while a Build agent is running in this bundle.`,bundle_build_incomplete:`Resume is unavailable until every active ticket in this bundle completes Build.`,run_setup_preparing:`Resume is unavailable while a bundle run is preparing.`,review_running:`Resume is unavailable because Review is already running for this bundle.`,invalid_progression:`Resume is unavailable because automation progression ownership is invalid.`,invalid_stage_lineage:`Resume is unavailable because the paused stage does not belong to the active automation progression.`,no_resumable_owner:`Resume is unavailable because no ticket currently owns a resumable automation state.`},guidance:{preconditionFailed:`Review the current bundle state and resolve any blockers before continuing.`,stageFailed:`Review the failed stage details, then resume when the issue is resolved.`,serverRestart:`Automation was interrupted by a server restart. Resume to continue from the saved stage.`,reconciliationFailed:`Verify the repository state before resuming because automation could not confirm the latest stage result.`,sideEffectAmbiguous:`Verify whether the last external action completed before resuming.`,manualTransition:`Review the current ticket state before resuming because it changed while automation was running.`,configurationChanged:`Review the current automation settings before resuming because they changed during the run.`,targetBusy:`Another operation owns this target. Review Checks and wait for it to finish before resuming.`,requiredChecksFailed:`Required checks govern automated delivery. Review their durable evidence, then resume to rerun them.`,invalidLineage:`Automation ownership changed. Review the current bundle state before continuing.`,generic:`Review the current bundle state before resuming automation.`},requiredChecks:{boundary:{check_completion:`check completion`,automation_review:`Review progression`,automation_commit:`commit`,automation_push:`push`,automation_pull_request:`pull-request creation`},reason:{not_required:`required checks are not configured`,policy_invalid:`the required-check policy is invalid`,policy_drift:`the required-check policy changed`,workspace_unavailable:`the workspace is unavailable`,intended_identity_mismatch:`the checked workspace no longer matches the automation target`,missing_evidence:`required check evidence is missing`,target_mismatch:`the checks targeted a different workspace or bundle`,batch_not_completed:`the required-check batch has not finished`,incomplete_evidence:`required check evidence is incomplete`,duplicate_evidence:`duplicate required check evidence was found`,extra_evidence:`unexpected required check evidence was found`,definition_drift:`a required check definition changed`,attempt_failed:`one or more required checks failed`,attempt_stale:`required check evidence is stale`,target_busy:`another check run is already using the target`,check_start_failed:`required checks could not start`},fallbackReason:`the required checks did not produce usable evidence`,failure:`Required checks blocked the automated {{boundary}}. {{explanation}} Review the check results and rerun any failed or unfinished checks before resuming automation.`}},deliveryReady:{guidance:`Review is complete. Continue with Commit to accept the current findings and proceed with delivery.`,action:`Continue with Commit`,pending:`Starting Commit...`,error:`Unable to continue bundle delivery right now.`}},buildOpenQuestionsDialog:{title:`Resolve open questions`,description:`Every Build question in this bundle must be answered or dismissed before continuing.`,ticketHeading:`Ticket: {{title}}`,answerOption:`Answer`,dismissOption:`Dismiss`,answerLabel:`Implementation decision for: {{question}}`,answerPlaceholder:`Enter the implementation decision`,dismissSummary:`All questions are dismissed. The bundle will proceed to Review without another Build pass.`,incompleteSummary:`Answer or dismiss every question to continue.`,refreshedError:`The bundle questions changed. Review the refreshed complete batch before submitting.`,conflictError:`The questions changed on the server. Your matching drafts were preserved; review the refreshed batch.`,refreshFailedError:`The questions changed, but the refreshed batch could not be loaded. Close and reopen this dialog to try again.`,submitError:`The decisions could not be applied. Your drafts have been preserved.`,empty:`There are no unresolved Build questions in this bundle.`,reviewRefreshed:`I reviewed the refreshed batch`,cancel:`Cancel`,submit:`Apply decisions and continue`,submitting:`Applying decisions...`,openAction:`Resolve questions`,openActionAriaLabel:`Resolve {{count}} open Build questions`,count_one:`{{count}} open Build question`,count_other:`{{count}} open Build questions`},column:{loadingCard:`Loading card {{index}}`,runDisabledReason:`Stop the currently running ticket before starting another run.`,newTicket:`+ New ticket`,undoInProgress:`Undo in progress...`},board:{notifications:{planningDoneTitle:`Planning done`,planningDoneBody_one:`{{count}} ticket created`,planningDoneBody_other:`{{count}} tickets created`},search:{placeholder:`Search tickets`,ariaLabel:`Search tickets`,clearAriaLabel:`Clear search`,hideStaleAriaLabel:`Hide stale tickets`,hideStaleLabel:`Hide stale tickets`,hideBundlesWithPullRequestsAriaLabel:`Hide bundles with PRs`,hideBundlesWithPullRequestsLabel:`Hide bundles with PRs`},preview:{disabledProjectRoot:`Preview selection is unavailable for project root runs.`,disabledBuildCapable:`Preview selection is only available for build-capable ticket runs.`,disabledPlanMode:`Preview selection is unavailable while this ticket is in Plan mode.`,followUpBundlePlaceholder:`Follow up on this bundle`,followUpTicketPlaceholder:`Follow up on this ticket`},errors:{runBlockedByActive:`Stop the currently running ticket before starting another run.`,moveTicket:`Unable to move the ticket right now.`,createBundleWithoutProject:`Cannot create a bundle without an active project.`,missingBundleReviewTicket:`Requested ticket was not returned from the bundle review response.`,parkTicket:`Unable to park the ticket right now.`,returnTicket:`Unable to return the ticket right now.`,moveBundleToDone:`Unable to move the bundle to Done right now.`,restoreBundle:`Unable to restore the bundle right now.`,deleteBundleTickets:`Unable to delete the bundle tickets right now.`,generateTickets:`Unable to generate tickets right now.`,deleteTicket:`Unable to delete the ticket right now.`,undoTicket:`Unable to undo the ticket right now.`,retryTicket:`Unable to retry the ticket right now.`,startRun:`Unable to start the run right now.`,openIde:`Unable to open the IDE right now.`,sendFollowUp:`Unable to send the follow-up prompt right now.`,buildBundle:`Unable to build the bundle right now.`,reviewBundle:`Unable to review the bundle right now.`,continueBundleReview:`Unable to continue the bundle review right now.`,undoBundleReview:`Unable to undo the bundle review right now.`,moveBundle:`Unable to move the bundle right now.`,startBuildChain:`Unable to start the build chain right now.`,stopBuildChain:`Unable to stop the build chain right now.`,emptyDone:`Unable to empty Done right now.`},toasts:{deleteDonePartial_one:`Deleted {{deletedCount}} done ticket, but {{failedCount}} failed.`,deleteDonePartial_other:`Deleted {{deletedCount}} done tickets, but {{failedCount}} failed.`,deleteDoneSuccess_one:`Deleted {{count}} done ticket.`,deleteDoneSuccess_other:`Deleted {{count}} done tickets.`,movedBundleToDonePartial:`Moved {{movedCount}} of {{totalCount}} bundle tickets to Done.`,restoredBundlePartial:`Restored {{restoredCount}} of {{totalCount}} bundle tickets.`,deletedBundleTicketsPartial:`Deleted {{deletedCount}} of {{totalCount}} bundle tickets.`,planningAgentCardsCreated_one:`{{count}} card created`,planningAgentCardsCreated_other:`{{count}} cards created`},doneColumn:{emptyAction:`Empty`},changes:{reviewPromptDisabledReason:`Wait for all bundle tickets to finish building before sending a follow-up prompt.`,modifyChangesDisabledReason:`Wait for all bundle tickets to finish building before modifying changes.`,targetUnavailableReason:`This workspace target is no longer available.`}},projectPreviewPane:{presets:{responsive:`Responsive`,phone:`Phone`,tablet:`Tablet`,laptop:`Laptop`},selection:{unavailableBuildCapable:`Preview selection is only available for build-capable ticket runs.`,waitForLoad:`Wait for the preview to finish loading first.`,enableMode:`Enable selection mode`,disableMode:`Disable selection mode`},targetSummary:{element:`Element`,unknownElement:`Unknown element`},iframeTitle:`Project preview`,pendingComments:{triggerLabel:`Pending comments`,title:`Pending comments`,description:`Review preview comments before sending them back to the agent.`,empty:`No preview comments queued yet.`,clearAll:`Clear all`,sending:`Sending...`,sendFixes:`Send fixes ({{count}})`,deleteAriaLabel:`Delete pending comment for {{elementLabel}}`},prompt:{bundlePlaceholder:`Follow up on this bundle`,ticketPlaceholder:`Follow up on this ticket`,defaultPlaceholder:`Describe what Archon should do next.`,toggleAriaLabel:`Toggle preview prompt`,button:`Prompt`,sent:`Prompt sent.`,sendError:`Unable to send the preview prompt right now.`},commentComposer:{editTitle:`Edit preview comment`,addTitle:`Add preview comment`,closeAriaLabel:`Close preview comment composer`,commentAriaLabel:`Preview comment`,placeholder:`Describe the change you want here.`,cancel:`Cancel`,save:`Save comment`,add:`Add comment`},toasts:{fixesSubmitted:`Fixes submitted.`,fixesError:`Unable to submit the preview review right now.`},states:{loadingTitle:`Loading preview`,loadingDescription:`Archon is loading the current preview state for this project.`,readyMissingUrlTitle:`Preview error`,readyMissingUrlDescription:`Archon did not provide a preview URL for the active run.`,detectingTitle:`Detecting preview`,detectingDescription:`Waiting for the preview service to report a browser URL.`,unsupportedTitle:`Preview unavailable`,unsupportedDescription:`This run cannot be embedded as an in-app preview.`,sandboxPublicationUnsupportedTitle:`Sandbox preview unavailable`,sandboxPublicationUnsupportedDescription:`This Docker Sandbox release cannot safely publish and independently revoke preview ports. Stopping the service affects the whole sandbox environment.`,errorTitle:`Preview error`,errorDescription:`Archon could not load the current preview target.`,idleTitle:`Preview idle`,idleDescription:`Start a run to load the in-app preview.`},toolbar:{viewportPresetAriaLabel:`Preview viewport preset`,reloadAriaLabel:`Reload preview`,reloadTooltip:`Reload`,openNewTabAriaLabel:`Open preview in new tab`,openNewTabTooltip:`Open in new tab`,toggleSelectionAriaLabel:`Toggle preview selection mode`,stopRunAriaLabel:`Stop preview run`,stopSandboxAriaLabel:`Stop the entire sandbox environment`,stopping:`Stopping...`,stop:`Stop`,stopSandbox:`Stop sandbox`,collapseAriaLabel:`Collapse preview`,collapseTooltip:`Collapse`,expandAriaLabel:`Expand preview`,expandTooltip:`Expand`,closeAriaLabel:`Close preview`,closeTooltip:`Close`}},mobileApp:{agentSettings:{loading:`Wait for the active agent model catalog to finish loading.`},agentSelector:{ariaLabel:`Choose active agent`,sessionLocked:`This existing session keeps its saved {{agent}} agent and model.`},approvals:{title:`Pending approvals`,count:`{{count}} exact action awaiting a decision`,count_other:`{{count}} exact actions awaiting a decision`,action:{git_push:`Force push`,custom_check:`Production custom check`},impact:{git_push:`This replaces remote branch history with the captured local commit.`,custom_check:`This command may change an external production system.`},expires:`Expires {{value}}`,loadingDetail:`Loading approval evidence...`,detailError:`Unable to load this approval request.`,none:`None`,history:`Approval history ({{count}})`,fields:{action:`Action`,target:`Target`,command:`Command`,cwd:`Working directory`,branch:`Branch`,head:`Local commit`,remoteHead:`Remote commit`,profile:`Execution profile`,launcher:`Launcher`,environment:`Batch environment`,placement:`Attempt placement`,authority:`Effective capabilities`,degradations:`Capability degradation`,secrets:`Logical secret references`,expires:`Expires`},values:{noHostEnvironment:`None; this action runs on the host`,hostPlacement:`This machine (host)`,sandboxPlacement:`Docker Sandbox · {{id}}`,sandboxPlacementUnavailable:`Docker Sandbox placement unavailable`,launcher:{host_shell:`Host shell`,docker_sandbox_exec:`Docker Sandbox exec`}},status:{pending:`Awaiting approval`,approved:`Approved`,denied:`Denied`,cancelled:`Cancelled`,expired:`Expired`,invalidated:`Invalidated`,consumed:`Executing or completed`},reason:`Decision note (optional)`,approve:`Approve exact action`,deny:`Deny`,cancel:`Cancel request`,loadError:`Unable to load pending approvals.`,decisionError:`Unable to update this approval request.`,remediation:{approved:`Approved. The server will revalidate the exact action before execution.`,denied:`Denied. Return to the originating action to request a different operation.`,cancelled:`Cancelled. Return to the originating action to create a new request.`,expired:`Expired. Return to the originating action to capture current evidence.`,invalidated:`The target or authority changed. Request approval for the current exact action.`,consumed:`Approval was consumed. Check lifecycle evidence for the final or ambiguous outcome.`,pending:`This request still needs a decision.`}},navigation:{overview:`Overview`,tickets:`Tickets`,chats:`Chats`,spec:`Spec`},overviewActions:{ticketsAriaLabel:`Go to tickets section`,chatsAriaLabel:`Go to chats section`,specAriaLabel:`Go to spec section`},chatDetail:{interrupt:`Interrupt`,interrupting:`Interrupting...`,resume:`Resume`,resuming:`Resuming...`,resumeError:`Unable to resume the chat response.`},specList:{title:`Specs`,loading:`Loading specs...`,emptyTitle:`No specs`,emptyDescription:`Start a new spec to plan a feature from this project.`,newSpec:`New spec`,startSpec:`Start a spec`,listError:`Specs unavailable`,retry:`Retry specs`},specDetail:{newSpecTitle:`New spec`,loadingTitle:`Loading spec`,loading:`Loading spec transcript...`,unavailableTitle:`Spec unavailable`,back:`Back to specs`,retry:`Retry spec`,composerPlaceholder:`Describe the feature you want to plan...`,composerPlaceholderDraft:`Describe the feature, architecture, or changes you want to spec out.`,emptyMessages:`No messages yet.`,emptyDraft:`Start a new spec from this phone.`,interrupt:`Interrupt`,interrupting:`Interrupting...`,resume:`Resume`,resuming:`Resuming...`,listError:`Unable to load spec sessions.`,detailError:`Unable to load spec transcript.`,sendError:`Unable to send the spec prompt.`,stopError:`Unable to stop the spec response.`,resumeError:`Unable to resume the spec response.`,modeError:`Unable to update the spec mode right now.`,targetMismatch:`This Spec targets {{sessionTarget}}, but {{currentTarget}} is selected.`,targetUnavailable:`This Spec target is unavailable.`,targetLoading:`Checking the current project branch before this Spec can continue...`,targetLoadError:`Unable to verify the current project branch. {{error}}`,targetRefreshError:`Unable to verify the current project target. {{error}}`,retryTarget:`Retry branch check`,switchBack:`Switch back to {{target}}`,switchingBack:`Switching target...`,updateTargetError:`Unable to update the project target right now.`}},chatView:{tool:{claude:`Claude`,opencode:`OpenCode`},mode:{plan:`Plan`,build:`Build`},startBuilding:{label:`Start building`,ariaLabel:`Start building this plan`},placeholders:{plan:`Ask Archon to scope, sequence, or reason through project work`,build:`Ask Archon to build, change, or verify something in this project`},shortcuts:{modifierMac:`CMD`,modifierDefault:`CTRL`,startNewSession:`Start new session`,switchToPlan:`Switch to Plan`,switchToBuild:`Switch to Build`},user:{you:`You`},targets:{bundleFallback:`Bundle target`,repoRoot:`Repo root`,repoRootWithBranch:`Repo root ({{branch}})`,currentTarget:`current target`,selectedBundleTarget:`selected bundle target`},pendingMemorySuggestions_one:`{{count}} pending memory suggestion`,pendingMemorySuggestions_other:`{{count}} pending memory suggestions`,deleteSessionModal:{title:`Delete chat session`,bulkTitle:`Delete chat sessions`,description:`This permanently removes the transcript history for this chat session.`,bulkDescription_one:`This permanently removes the transcript history for {{count}} chat session.`,bulkDescription_other:`This permanently removes the transcript history for {{count}} chat sessions.`,cancel:`Cancel`,deleting:`Deleting...`,delete:`Delete`},sidebar:{ariaLabel:`Chat sessions sidebar`,newSession:`New session`,select:`Select`,cancelSelection:`Cancel`,addPreset:`Preset`,selectedCount_one:`{{count}} selected`,selectedCount_other:`{{count}} selected`,deleteSelected:`Delete selected`,collapseAriaLabel:`Collapse sessions panel`,openAriaLabel:`Open sessions panel`,loadingSessions:`Loading chat sessions...`,noSessions:`No chat sessions yet.`,deleteDisabledReason:`Wait for the current chat response to finish before deleting this session.`,running:`Running`,interrupted:`Interrupted`,finished:`Finished`,targetUnavailable:`Target unavailable`,deleteSessionAriaLabel:`Delete chat session`,deleteSessionTitle:`Delete {{title}}`,selectSessionAriaLabel:`Select {{title}}`,selectSessionTitle:`Select {{title}}`,presets:{unavailable:`Unavailable`,older:`Older`}},toasts:{deleteSelectedPartial_one:`Deleted {{deletedCount}} chat session, but {{failedCount}} failed.`,deleteSelectedPartial_other:`Deleted {{deletedCount}} chat sessions, but {{failedCount}} failed.`,deleteSelectedSuccess_one:`Deleted {{count}} chat session.`,deleteSelectedSuccess_other:`Deleted {{count}} chat sessions.`},ticketProposal:{createdTitle:`Tickets created`,createdDescription_one:`Created {{count}} ticket from this proposal.`,createdDescription_other:`Created {{count}} tickets from this proposal.`,proposedTitle:`Proposed tickets`,proposedDescription:`Review these tickets before adding them to the board.`,dependenciesLabel:`Dependencies: {{value}}`,creating:`Creating tickets...`,create:`Create tickets`,createdFromChat_one:`Created {{count}} ticket from chat.`,createdFromChat_other:`Created {{count}} tickets from chat.`},errors:{loadSessions:`Unable to load chat sessions right now.`,loadSession:`Unable to load the chat session right now.`,loadMemorySuggestions:`Unable to load chat memory suggestions right now.`,restoreTarget:`Unable to restore the chat target right now.`,updateMode:`Unable to update the chat mode right now.`,interruptResponse:`Unable to interrupt the chat response right now.`,resumeResponse:`Unable to resume the chat response right now.`,deleteSession:`Unable to delete the chat session right now.`,uploadAttachments:`Unable to upload images right now.`,removeAttachment:`Unable to remove the image right now.`,sendPrompt:`Unable to send the chat prompt right now.`,createTickets:`Unable to create tickets from the chat proposal right now.`,resolveQuestions:`Unable to resolve the plan questions right now.`},composer:{newChatTitle:`New chat`,chatTitle:`Chat`,loadingMemory:`Loading memory...`,memorySuggestions:`Memory suggestions`,switchBack:`Switch back`,noSessionSelectedTitle:`No session selected`,noSessionSelectedDescription:`Select a chat session to restore its saved target, or start a new session on the current target.`,startNewSession:`Start new session`,loadingSession:`Loading chat session...`,openDiff:`Open diff`,resizeDiffPanel:`Resize diff panel`,diff:`Diff`,memorySuggestionsTitle:`Memory suggestions`,memorySuggestionsDescription:`Review pending suggestions from this chat before saving them into project memory.`,memorySuggestionsEmpty:`No pending memory suggestions for this chat session.`,closeMemorySuggestions:`Close memory suggestions`},review:{missingTarget:`Open or create a chat session to send review comments.`,unavailableTarget:`Target unavailable for this chat session.`,restoreTargetFallback:`Restore the session target to continue.`,waitTurn:`Wait for the current chat turn to finish before sending review comments.`,waitUpload:`Wait for the current image upload to finish before sending this turn.`,waitPrompt:`Wait for the current chat prompt to finish sending before submitting review comments.`,waitTurnShort:`Wait for the current chat turn to finish.`,mismatchReason:`This session targets {{sessionTarget}}, but the current target is {{currentTarget}}. Restore the session target to continue.`,interrupting:`Interrupting...`,interrupt:`Interrupt`,resuming:`Resuming...`,resume:`Resume`}},specView:{errors:{loadSessions:`Unable to load spec sessions right now.`,loadSession:`Unable to load the spec session right now.`,loadMemorySuggestions:`Unable to load spec memory suggestions right now.`,stopSession:`Unable to interrupt the spec response right now.`,resumeSession:`Unable to resume the spec response right now.`,deleteSession:`Unable to delete the spec session right now.`,sendPrompt:`Unable to send the spec prompt right now.`,upload:`Unable to upload images right now.`,removeAttachment:`Unable to remove the image right now.`,initialSessionMissing:`Spec no longer exists.`,resolveQuestions:`Unable to resolve the plan questions right now.`,restoreTarget:`Unable to restore the spec target right now.`},targets:{mismatchReason:`This Spec targets {{sessionTarget}}, but the current target is {{currentTarget}}. Restore the Spec target to continue.`,unavailable:`Target unavailable for this Spec.`,switchBack:`Switch back`,switchingBack:`Switching...`},importNotice:{title:`Import notice`,importedOnly:`Imported {{importedCount}} image(s).`,importedWithSkips:`Imported {{importedCount}} image(s). Skipped {{skippedCount}} reference(s): {{skippedSummary}}.`,skippedOnly:`Skipped {{skippedCount}} reference(s): {{skippedSummary}}.`,skipReasons:{third_party_url:`{{count}} third-party URL(s)`,download_failed:`{{count}} failed download(s)`,permission_denied:`{{count}} permission error(s)`,unsupported_type:`{{count}} unsupported image(s)`,non_image_content:`{{count}} non-image file(s)`,oversize:`{{count}} oversized image(s)`,over_limit:`{{count}} over the 4-image limit`}},composer:{placeholderSpec:`Describe the feature you want to plan...`,describeFeature:`Describe the feature, architecture, or changes you want to spec out.`,loadingMemory:`Loading memory...`,memorySuggestions:`Memory suggestions`,memorySuggestionsTitle:`Memory suggestions`,memorySuggestionsDescription:`Review pending suggestions from this spec before saving them into project memory.`,memorySuggestionsEmpty:`No pending memory suggestions for this spec session.`,closeMemorySuggestions:`Close memory suggestions`,waitTurn:`Wait for the current spec turn to finish.`,waitUpload:`Wait for the current image upload to finish.`,waitGrill:`Answer the question above to continue.`,stop:`Stop`,interrupt:`Interrupt`,interrupting:`Interrupting...`,resume:`Resume`,resuming:`Resuming...`,noSessionSelectedTitle:`No spec session selected`,noSessionSelectedDescription:`Select a spec session or start a new one to plan features.`,startNewSession:`Start new spec`,loadingSession:`Loading spec session...`,newSpecTitle:`New spec`,specTitle:`Spec`},pendingMemorySuggestions_one:`{{count}} pending memory suggestion`,pendingMemorySuggestions_other:`{{count}} pending memory suggestions`,sidebar:{ariaLabel:`Spec sessions sidebar`,newSession:`New spec`,select:`Select`,cancelSelection:`Cancel`,addPreset:`Preset`,deleteSelected:`Delete selected`,collapseAriaLabel:`Collapse sessions panel`,openAriaLabel:`Open sessions panel`,loadingSessions:`Loading spec sessions...`,noSessions:`No spec sessions yet.`,deleteSessionAriaLabel:`Delete spec session`,deleteSessionTitle:`Delete {{title}}`,selectSessionAriaLabel:`Select {{title}}`,selectSessionTitle:`Select {{title}}`,presets:{unavailable:`Unavailable`,older:`Older`},cannotDeleteRunning:`Wait for the current spec response to finish before deleting this session.`,newSessionTooltip:`Start a new spec session`,interrupted:`Interrupted`,linkedImplementationsTooltip:`{{ticketCount}} ticket(s), {{chatCount}} chat session(s) from this spec`,linkedImplementationsAriaLabel:`{{itemCount}} linked implementation(s)`,linkedImplementationsTooltipHistorical:`Work was performed from this spec`,linkedImplementationsAriaLabelHistorical:`Work was performed from this spec`},deleteModal:{title:`Delete spec session`,bulkTitle:`Delete spec sessions`,description:`This permanently removes the transcript history for this spec session.`,bulkDescription_one:`This permanently removes transcript history for the selected spec session.`,bulkDescription_other:`This permanently removes transcript history for {{count}} spec sessions.`,delete:`Delete`,cancel:`Cancel`,deleting:`Deleting...`},toasts:{deleteSelectedSuccess_one:`Deleted {{count}} spec session.`,deleteSelectedSuccess_other:`Deleted {{count}} spec sessions.`,importPreparing:`Importing issue and downloading images...`,importSuccess:`Issue imported.`,importPartialSuccess:`Issue imported with some images skipped.`,importError:`Unable to import the issue right now.`},artifactPanel:{title:`Spec Artifact`,open:`Open artifacts`,resize:`Resize artifact panel`,close:`Close artifact panel`,summary:`Summary`,visualization:`Visualization`,likelyFiles:`Likely Files`,newFile:`New file`,fileRelationGraph:`File relationships`,repositoryEvidence:{captureLabel:`Capture state`,freshnessLabel:`Captured scan freshness`,capture:{complete:`Complete`,stale:`Stale at capture`,truncated:`Truncated`,unavailable:`Unavailable`},freshness:{fresh:`Current`,stale:`Not current`,unavailable:`Unavailable`},origin:{planner:`Planner`,graph:`Repository graph`,both:`Planner + graph`},class:{deterministic:`Deterministic`,structural_heuristic:`Structural heuristic`,historical_heuristic:`Historical heuristic`},affectedTests:`Affected tests`,affectedTest:`Affected test`,impactHeading:`Repository impact`,impactDescription:`Repository-derived signals are advisory and are not planned edits.`,impactFiles_one:`{{count}} possible file signal`,impactFiles_other:`{{count}} possible file signals`,impactTests_one:`{{count}} possible test signal`,impactTests_other:`{{count}} possible test signals`,impactNone:`No candidates captured`,potentiallyAffectedFiles:`Potentially affected files`,showChains_one:`Show evidence chain`,showChains_other:`Show {{count}} evidence chains`,chainLabel:`Chain {{number}}`,chainSummary_one:`{{seed}} reaches {{candidate}} through {{count}} repository relation.`,chainSummary_other:`{{seed}} reaches {{candidate}} through {{count}} repository relations.`,truncatedNotice:`This capture reached a repository evidence limit, so additional candidates or chains may exist.`,historicalNotice:`Historical heuristic evidence reflects prior co-change patterns and is not a current deterministic relationship.`,impactFallback:`The repository graph projection did not capture any candidates for this snapshot.`,diagramDescription:`Planner-generated relationships between the files in this plan.`},proposedTickets:`Proposed Tickets`,bundleGroups:`Bundle Groups`,proposedTicketCount_one:`{{count}} proposed ticket`,proposedTicketCount_other:`{{count}} proposed tickets`,dependencies:`Dependencies`,openQuestions:`Open Questions`,assumptions:`Assumptions`,noSnapshot:`Run a spec turn to generate an artifact.`,noDiagram:`No diagram available for this spec.`,mermaidParseError:`Unable to render this Mermaid graph; showing raw text instead.`,uiMockup:`UI Mockup`,noMockup:`No UI mockup available for this spec.`,loading:`Loading artifact...`},actions:{createTickets:`Create tickets`,ticketsCreated:`Tickets created`,creatingTickets:`Creating tickets...`,implementInChat:`Implement in Chat`,implementInChatMultiBundleUnavailable:`Multi-bundle Specs must be materialized through Create tickets before implementation.`,startingImplementation:`Starting implementation...`,exportSpec:`Export to docs/plans`,exportingSpec:`Exporting...`,createTicketsSuccess:`Created {{count}} ticket(s) from this spec.`,exportSuccess:`Exported spec to docs/plans.`,exportConflictTitle:`Export already exists`,exportConflictDescription:`A spec has already been exported to {{path}}. Do you want to overwrite the existing file?`,exportConflictConfirm:`Overwrite`,exportConflictCancel:`Cancel`},provenance:{viewSourceSpec:`View source spec`},grill:{toggleTooltip:`Grill mode: pressure-test the plan one focused question at a time before writing the spec. Toggle off to skip remaining questions and write it now.`,toggleAriaLabelOn:`Turn Grill mode off (currently on)`,toggleAriaLabelOff:`Turn Grill mode on`,rationaleLabel:`Why`,suggestionsLabel:`Suggested answers`,recommendedSuggestionLabel:`Recommended`,answerPlaceholder:`Type your answer, or pick a suggestion above to fill this field...`,submitLabel:`Submit answer`,submittingLabel:`Submitting...`,finalizePrompt:`Grilling ended. Write the complete concrete plan now using everything we discussed.`,finalizeError:`Unable to finalize grilling right now.`,updateModeError:`Unable to change Grill mode right now.`,activeDisabledReason:`Wait for the current spec turn to finish before toggling Grill.`},review:{heading:`Review`,launch:`Review spec`,launchAction:`Review spec`,stop:`Stop review`,running:`Running...`,loading:`Loading review...`,noFindings:`No issues found.`,stoppedExplanation:`The review was stopped before it completed.`,errorExplanation:`The review could not be completed because the agent encountered an error.`,parseFailedExplanation:`The review completed, but its findings could not be parsed.`,why:`Why`,suggestion:`Suggestion`,sendToPlanner:`Send to planner`,sendingToPlanner:`Building revision draft...`,popoverTitle:`Spec review`,model:`Model`,variant:`Thinking level`,findingsCount_one:`{{count}} finding`,findingsCount_other:`{{count}} findings`,severity:{high:`high`,medium:`medium`,low:`low`},status:{running:`Running`,completed:`Completed`,parse_failed:`Parse failed`,stopped:`Stopped`,error:`Error`}}},conversationPane:{agentActivityAriaLabel:`Agent activity indicator`,agentWorkingSrText:`Agent is working`,agentError:`Agent error`,statusWorking:`Working...`,liveElapsedAriaLabel:`Approximate elapsed response time: {{duration}}`,statusInterrupted:`Interrupted`,loadingConversation:`Loading conversation...`,noMessagesYet:`No messages yet.`,attachmentPreviewAlt:`Attached image: {{name}}`,showThinkingAriaLabel:`Show thinking`,showThinkingLabel:`Show thinking`,sectionAriaLabel:`Ticket conversation`,contentAriaLabel:`Ticket conversation content`,scrollToLatestAriaLabel:`Scroll to latest message`,changesCommentBadge:`Changes comment`},questionSet:{eyebrow:`Plan clarification`,progress:`Question {{current}} of {{total}}`,questionsAriaLabel:`Questions`,rationaleLabel:`Why`,suggestionsLabel:`Suggested answers`,recommended:`Recommended`,answerLabel:`Your answer`,answerPlaceholder:`Type your answer, or choose a suggestion above...`,dismissOne:`Dismiss this question`,dismissAll:`Dismiss all questions`,saveContinue:`Save and continue`,submitting:`Submitting...`,waitForResolution:`Resolve the plan questions above to continue.`,historicalAnswer:`Answer`,historicalDismissed:`Dismissed`,status:{answered:`Answered`,dismissed:`Dismissed`,current:`Current`,unanswered:`Unanswered`},historicalStatus:{pending:`Awaiting resolution`,resolved:`Resolved`,dismissed:`Dismissed`,superseded:`Superseded`}},multiAgentTranscript:{tabAriaLabel:`Agent run tabs`,mainAgent:`Main agent`,noContent:`No transcript content was captured.`,waitingForOutput:`Waiting for subagent output...`,responseTruncated:`Response transcript truncated after 100 KB.`,thinkingTruncated:`Thinking transcript truncated after 100 KB.`,status:{running:`Running`,done:`Done`,error:`Error`,stopped:`Stopped`}},promptComposer:{followUpPromptAriaLabel:`Follow-up prompt`,sendingPromptAriaLabel:`Sending prompt`,sendPromptAriaLabel:`Send prompt`,attachImageAriaLabel:`Attach images`,uploadingImageAriaLabel:`Uploading images`,removeAttachmentAriaLabel:`Remove {{name}}`,attachmentPreviewAlt:`Selected image: {{name}}`,dropImagePrompt:`Drop images to attach`,dropImageAriaLabel:`Drop image files to attach them`},attachmentPreviewDialog:{title:`Image preview: {{name}}`,description:`Preview the attached image {{name}}.`,imageAlt:`Preview image: {{name}}`,previewImageAriaLabel:`Preview image: {{name}}`,openInNewTab:`Open in new tab`,closeAriaLabel:`Close image preview`},mermaidPreviewDialog:{title:`Diagram Preview`,description:`Preview the spec diagram in full screen.`,controlsAriaLabel:`Diagram controls`,canvasAriaLabel:`Diagram canvas. Drag with the mouse to pan.`,zoomInAriaLabel:`Zoom in`,zoomOutAriaLabel:`Zoom out`,resetViewAriaLabel:`Reset view`,zoomLevel:`{{zoom}}%`,zoomLevelAriaLabel:`Zoom level: {{zoom}}%`,closeAriaLabel:`Close diagram preview`,clickToExpand:`Click to expand diagram`},mockupPreviewDialog:{title:`UI Mockup Preview`,description:`Preview the UI mockup in full screen.`,closeAriaLabel:`Close UI mockup preview`,clickToExpand:`Click to expand UI mockup`},workspaceControls:{files:`Files`,changes:`Changes`,tests:`Tests`,checks:`Checks`,verification:`Verification`,graph:`Graph`,openIde:`Open IDE`,terminal:`Terminal`,chat:`Chat`,close:`Close`,openTerminalAriaLabel:`Open terminal`,hideTerminalAriaLabel:`Hide terminal`,terminalTitle:`Terminal`,ticketMetadataAriaLabel:`Ticket metadata`,githubActions:`Actions`,openGitHubActionsAriaLabel:`Open GitHub Actions`},projectHeader:{agent:{triggerAriaLabel:`Choose active agent`,menuAriaLabel:`Open active agent menu`,openCode:`OpenCode`,claude:`Claude`},runtime:{activityLabel:`Activity`,triggerLabel:`Tools`,triggerAriaLabel:`Open runtime tools`,githubActionsRunning:`Actions`,toolUpdateRunning:`Tool update running`,openGitHubActions:`Open GitHub Actions`,openActivity:`Open Activity`,openMobileAccess:`Open mobile access`,mobileLabel:`Mobile`,githubStatusIdle:`Idle`,githubStatusRunning:`Running`,mobileDisabled:`Mobile disabled`,mobileReadyToPair:`Mobile ready to pair`,mobileConnected:`Mobile connected`,mobilePairingExpired:`Mobile pairing expired`,mobileUnavailable:`Mobile unavailable`,openExecutionRuntimes:`Open execution runtimes`}},executionRuntimes:{title:`Execution runtimes`,description:`Check whether optional execution environments can operate on this machine.`,closeAriaLabel:`Close execution runtimes`,provider:`Optional runtime`,dockerSandbox:`Docker Sandbox`,loading:`Checking this machine...`,errorMessage:`Unable to check Docker Sandbox readiness right now.`,guidance:`Opening or rechecking these diagnostics only reads readiness and does not start services. Install and configure Docker Sandboxes using the official Docker instructions, then recheck this machine.`,productionNotice:`Docker Sandbox Build execution is opt-in and fails closed when the exact target, agent, or model is not ready.`,openGuide:`Open setup guide`,recheck:`Recheck`,rechecking:`Rechecking...`,version:`sbx {{version}}`,versionUnknown:`Version unknown`,releaseStatus:{recommended:`Recommended`,deprecated:`Deprecated`,unsupported:`Not qualified`,security_blocked:`Security blocked`},deprecatedReleaseNotice:`This release remains qualified during the upgrade window. Upgrade to the recommended sbx {{version}} release.`,securityBlockedReleaseNotice:`This release is blocked due to a security issue. Install the recommended sbx {{version}} release before using Docker Sandbox execution.`,unavailableSummary:`The remaining checks were skipped because sbx is unavailable.`,state:{loading:`Loading runtime readiness.`,unsupported:`This platform or sbx version is unsupported.`,setupRequired:`Setup is required before validation can run.`,eligible:`Available to activate when validation needs it.`,degraded:`Readiness is degraded because some evidence is unknown.`,ready:`This machine is ready for Docker Sandbox validation.`,error:`Readiness could not be checked.`},observationState:{ready:`Ready`,not_ready:`Setup required`,unknown:`Unknown`,deferred:`Deferred`,unsupported:`Unsupported`},deferredSummary:{opencode_template:`Validate OpenCode support per project target in execution settings.`,claude_template:`Validate Claude support per project target in execution settings.`},checks:{cli:`CLI`,version:`Supported version`,platform:`Platform`,virtualization:`Virtualization`,daemon:`Docker Sandbox daemon`,docker_login:`Docker account`,network_policy:`Network policy`,opencode_template:`OpenCode built-in agent`,claude_template:`Claude built-in agent`},checkDescription:{cli:`Checks whether the qualified sbx command is available.`,version:`Checks the installed sbx version against the approved command contract.`,platform:`Checks operating system and architecture support.`,virtualization:`Checks whether required virtualization support is available.`,daemon:`Checks whether the Docker Sandbox daemon can respond.`,docker_login:`Classifies Docker account readiness without displaying account or credential values.`,network_policy:`Checks whether sandbox network policy is initialized.`,opencode_template:`Checks built-in OpenCode template support.`,claude_template:`Checks built-in Claude template support.`},checkRemediation:`Follow the official setup guide, resolve this requirement, then recheck.`,virtualizationRemediation:{not_ready:`Resolve the host virtualization requirement in the official Docker Sandboxes guide, then recheck.`,unknown:`Review host virtualization diagnostics in the official Docker Sandboxes guide, then recheck.`,unsupported:`Use Linux x64 or macOS Sonoma 14+ on Apple silicon for Docker Sandboxes.`}},ticketModal:{loadingDiff:`Loading diff...`,planningChatAriaLabel:`Planning chat`,planningChatTitle:`Planning Chat`,closePlanningChatAriaLabel:`Close planning chat`,planningOpenQuestions_one:`{{count}} open question`,planningOpenQuestions_other:`{{count}} open questions`,planningFollowUpPlaceholder:`Ask the agent to refine this plan`,followUpPlanPlaceholder:`Ask a question about this implementation`,ticketChatAriaLabel:`Ticket chat`,ticketChatTitle:`Ticket Chat`,closeTicketChatAriaLabel:`Close ticket chat`,planningFailedPrefix:`Planning failed: `,openQuestionsBadge:`Open questions`,resolveQuestionsError:`Unable to resolve the plan questions right now.`,ticketTerminalAriaLabel:`Ticket terminal`,discardUnsavedTitle:`Discard unsaved edits?`,discardUnsavedDescription:`Any changes made will be lost.`,discardUnsavedConfirm:`Discard`,discardUnsavedCancel:`Keep editing`},ticketPlanDetails:{title:`Details`,ariaLabel:`Ticket details`,triggerAriaLabel:`Toggle ticket details`,closeAriaLabel:`Close details`,editTicket:`Edit ticket`,aiSettings:`AI settings`,aiSettingsAriaLabel:`AI settings`,attentionAriaLabel:`Attention required`,openPlanningChat:`Open planning chat`,viewBlockers:`View blockers`,unfinishedBlockers_one:`{{count}} unfinished blocker`,unfinishedBlockers_other:`{{count}} unfinished blockers`,targetSection:`Target`,dependenciesSection:`Dependencies`,defaultModel:`Default model`,defaultVariant:`Default variant`,usingDefaults:`Using defaults`,skillCount_one:`{{count}} skill`,skillCount_other:`{{count}} skills`},modelSelector:{dockerSandboxNotice:`Docker Sandbox only shows models from providers verified for the selected target.`,openExecutionSettings:`Verify providers in execution settings`},ticketChangesModal:{pushBranch:`Push branch`,pushing:`Pushing...`,morePushActions:`More push actions`,forcePushWithLease:`Force push with lease`,forcePushing:`Force pushing...`,loadingPullRequest:`Loading PR...`,checkingPullRequest:`Checking PR...`,createPullRequest:`Create PR`,createPullRequestTitle:`Create pull request`,createPullRequestFallbackError:`Unable to create the pull request right now.`,pullRequestCreated:`Pull request created.`,pullRequestFieldTitle:`Title`,pullRequestFieldBaseBranch:`Base branch`,pullRequestFieldDescription:`Description`,pullRequestTitlePlaceholder:`Pull request title`,pullRequestBaseBranchDescription:`Optional. Leave blank to use the repository default branch.`,pullRequestBaseBranchPlaceholder:`main`,pullRequestDescriptionPlaceholder:`Summarize the changes for reviewers.`,creatingPullRequest:`Creating PR...`,creating:`Creating...`,generatingDescription:`Generating...`,generateDescription:`Generate`,branchUnavailable:`Branch information is not available right now.`,branchPushed:`Branch pushed.`,pushCompleted:`Push completed.`,branchForcePushed:`Branch force-pushed.`,forcePushCompleted:`Force push completed.`,forcePushApprovalRequired:`Force push is waiting for approval.`,openForcePushApproval:`Open Activity detail`,pushFallbackError:`Unable to push the branch right now.`,forcePushFallbackError:`Unable to force-push the branch right now.`,viewSourceSpec:`View source spec`,switchToPlan:`Switch to Plan`,switchToBuild:`Switch to Build`,committedDiffFallbackError:`Unable to load committed changes right now.`,committedSelectionUnavailable:`That local commit is no longer available. Returned to Uncommitted changes.`,committedDiffEmpty:`No committed changes to show.`,committedFiles:`Committed files`,committedFilesDescription:`Review the selected committed changes.`,allListedCommits:`All listed commits`,viewingCommittedSource:`Viewing: {{source}}`,committedReadOnly:`This committed diff is read-only.`,squashCompleted:`Local commits squashed.`,squashFallbackError:`Unable to squash local commits right now.`},bundleDetailsModal:{bundleTerminalAriaLabel:`Bundle terminal`,rename:`Rename`,renameFieldLabel:`Bundle name`,renameDescription:`The branch name will be regenerated before the branch and worktree are created.`,saveName:`Save name`,savingName:`Saving...`,cancelRename:`Cancel`,renameFallbackError:`Unable to rename the bundle right now.`,renameUnavailable:`Rename availability could not be verified. Refresh the bundle and try again.`,renameProjectContextUnavailable:`Select a project before renaming this bundle.`,continueReview:`Continue review`,rerunReview:`Re-run review`,reviewBundle:`Review Bundle`,agentSettingsFor:`Agent settings for {{title}}`,agentSettingsLocked:`Locked for the active Build`,agentSettingsSaveError:`Unable to update this ticket’s agent settings.`,waitForAgentSettings:`Wait for all ticket agent settings to finish saving before building the bundle.`,renameReasons:{project_root:`Project root bundles cannot be renamed.`,tickets_not_plan:`Rename is unavailable because one or more bundle tickets have left Plan.`,agent_running:`Rename is unavailable while an agent is running for this bundle.`,branch_exists:`Rename is unavailable because this bundle branch already exists.`,worktree_exists:`Rename is unavailable because this bundle already has a worktree.`}},projectFooter:{detachedHead:`Detached HEAD`,unknownBranch:`Unknown branch`,branchActions:`Branch actions`,currentTargetActions:`Current target actions`,pull:`Pull`,pulling:`Pulling...`,sync:`Sync`,syncing:`Syncing...`,rebase:`Rebase`,rebaseOnto:`Rebase onto {{branch}}`,rebasing:`Rebasing...`,abortMerge:`Abort merge`,abortRebase:`Abort rebase`,aborting:`Aborting...`,branchSynced:`Project branch synced.`,branchUpdated:`Project branch updated.`,branchRebased:`Branch rebased.`,branchRebasedOnto:`Branch rebased onto {{branch}}.`,gitOperationAborted:`Git operation aborted.`,syncFallbackError:`Unable to sync the current branch right now.`,rebaseFallbackError:`Unable to rebase the current branch right now.`,abortFallbackError:`Unable to abort the current git operation right now.`,run:`Run`,stop:`Stop`,selectProjectFirst:`Select a project first.`,addRunConfig:`Add a Run config in project settings to enable selected-target runs.`,loadingProjectStatus:`Loading project status...`,stopSelectedTargetRun:`Stop the currently running selected-target run before starting another run.`,stopTicketBeforeSelectedTargetRun:`Stop the currently running ticket before starting the selected target run.`},repositoryGraphDialog:{title:`Repository graph`,target:`Target: {{target}}`,repoRootTarget:`Repo root`,repoRootTargetWithBranch:`Repo root / {{branch}}`,bundleTarget:`{{name}} / {{branch}}`,startScan:`Start scan`,refreshScan:`Refresh scan`,cancelScan:`Cancel scan`,retryScan:`Retry scan`,retryLoad:`Try again`,close:`Close`,truncatedScan:`This scan reached one or more analysis limits. Results remain useful but do not represent complete coverage.`,freshnessUnavailable:`The target is currently unavailable. Persisted results remain inspectable, but freshness cannot be verified.`,status:{title:`Status`,loading:`Loading scan status...`,neverScanned:`Never scanned`,unknown:`Scan status unavailable`,queued:`Queued`,running:`Running`,complete:`Complete and current`,completeUnverified:`Complete; freshness unavailable`,stale:`Complete but stale`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`},counts:{files:`Files`,relationships:`Relationships`,diagnostics:`Diagnostics`,analyzer:`Analyzer`},diagnostics:{show:`View diagnostics ({{count}})`,truncated:`Only a bounded diagnostic summary is shown.`},relationships:{title:`Inspect relationships`,description:`Search by file name or repository-relative path, then choose a file to inspect direct incoming or outgoing relationships.`,pathLabel:`Repository path`,pathPlaceholder:`Search files by name or path`,suggestionsLoading:`Loading file paths...`,noSuggestions:`No matching files found.`,direction:`Direction`,directions:{combined:`Both`,incoming:`Incoming`,outgoing:`Outgoing`},unavailable:`Relationship inspection is available after a scan completes.`,loading:`Loading relationships...`,truncated:`The relationship query reached its result limit. The list does not represent complete coverage.`,empty:`No direct relationships were found for this path and direction.`,showEvidence:`Show evidence`,loadingEvidence:`Loading evidence...`,kinds:{imports:`Import relationship with {{path}}`,dynamic_imports:`Dynamic import relationship with {{path}}`,requires:`Require relationship with {{path}}`,re_exports:`Re-export relationship with {{path}}`,config_reference:`Configuration relationship with {{path}}`,package_dependency:`Package dependency relationship with {{path}}`,package_export:`Package export relationship with {{path}}`,package_import:`Package import relationship with {{path}}`,workspace_member:`Workspace membership relationship with {{path}}`,tests:`Test relationship with {{path}}`,co_changes:`Often changes with {{path}}`},explanations:{imports:`Static repository analysis identified an import between these paths.`,dynamic_imports:`Static repository analysis identified a dynamic import between these paths.`,requires:`Static repository analysis identified a CommonJS require between these paths.`,re_exports:`Static repository analysis identified a re-export between these paths.`,config_reference:`A repository configuration file references the related path.`,package_dependency:`A package manifest identifies this package dependency.`,package_export:`A package manifest identifies this exported path.`,package_import:`A package manifest identifies this imported path.`,workspace_member:`Workspace configuration identifies this package membership.`,tests:`Repository structure identifies this test as covering the related path.`,co_changes:`Git history recorded these paths changing together.`},evidenceDetail:{value:`Matched value`,changeCount:`Shared changes`,sampledCommits:`Sample commits`,coverage:`Evidence coverage`,samplesTruncated:`Only a bounded sample of matching commits is shown.`}},evidence:{deterministic:{label:`Deterministic`,description:`Direct static analysis produced this relationship.`},structural_heuristic:{label:`Structural heuristic`,description:`Repository naming or layout suggests this relationship. It is not a required dependency.`},historical_heuristic:{label:`Historical heuristic`,description:`Version-control history suggests this relationship. It is not a required dependency.`}},errors:{status:`Unable to load repository graph status right now.`,operation:`Unable to update the repository graph scan right now.`,pathNotFound:`That path was not found in this scan.`,impact:`Unable to load relationships for that path right now.`,explanation:`Unable to load evidence for this relationship right now.`}},projectTargetSelector:{title:`Project target`,description:`Controls where chats, changes, tests, and project actions run.`,targetLabel:`Target`,repoRoot:`Repo root`,repoRootWithBranch:`Repo root ({{branch}})`,repoRootBranch:`Repo root branch`,activeBundleUnavailable:`Selected bundle unavailable`,loadingTarget:`Loading target...`,loadingTargets:`Loading targets...`,noBundles:`No prepared bundles yet. Manage bundles to prepare another target.`,noSearchResults:`No prepared targets match your search.`,searchPlaceholder:`Search bundles or branches`,searchAriaLabel:`Search project targets`,defaultBranch:`Default branch`,previousBranch:`Previous branch`,loadingBranches:`Loading branch suggestions...`,noSuggestedBranches:`No suggested branches available.`,switchOrCreateBranch:`Switch or create branch`,branchPlaceholder:`feature/quick-fix`,switchBranch:`Switch`,actions:`Target actions`,manageBundles:`Manage bundles`,newChatAriaLabel:`Select project target for new chat`,newSpecAriaLabel:`Select project target for new spec`,status:{selected:`Selected`,loading:`Loading status`,detachedHead:`Detached HEAD`,unknownBranch:`Unknown branch`,unavailable:`Target unavailable`,upToDate:`Up to date`,pullAvailable:`Pull available`},errors:{bundleSwitch:`Unable to switch to that bundle right now.`,repoRootSwitch:`Unable to switch the repo root target right now.`}},checksDialog:{title:`Checks`,description:`Run configured checks and inspect durable output for the selected target.`,openActivity:`Open activity`,close:`Close Checks`,configured:`Configured checks`,required:`Required for delivery`,optional:`Configured, not required`,preReview:`Runs before automatic Review`,finalOnly:`Final delivery only`,policySource:{project:`Inherited project policy`},policySummary:{title:`Required checks`,counts:`{{requiredCount}} delivery checks · {{preReviewCount}} pre-Review checks`,source:`Source: {{source}}`},gateTitle:`Automated delivery gate`,gatePassed:`Passed`,gateBlocked:`Blocked`,gateStale:`No longer current`,gateUnverifiable:`Unable to verify`,gatePolicy:`Policy {{fingerprint}}`,gateBoundary:{label:`Automation step: {{boundary}}`,check_completion:`Check completion`,automation_review:`Pre-Review checks, then automatic Review`,automation_commit:`Required checks, then commit creation`,automation_push:`Required checks, then push`,automation_pull_request:`Required checks, then pull-request creation`},gateSourceBatch:`Source batch: {{batchId}}`,gateNoBatch:`No source batch was available.`,gateScope:`Required checks govern automated delivery. They do not prevent manual or external Git operations.`,gateLoading:`Loading automated delivery gate...`,gateDetails:`Gate details`,gateReasonSummary:`Most relevant reason: {{reason}}`,gatePassedSummary:`All required checks passed for this delivery boundary.`,gateBlockedSummary:`Required evidence does not currently satisfy this delivery boundary.`,gatePolicyStatus:`Policy status: {{status}}`,gatePolicyValid:`Valid`,gatePolicyInvalid:`Invalid`,gateReasonsTitle:`Decision reasons`,gateEvidenceTitle:`Per-check evidence`,gateApplicability:{label:`Applicability to current state: workspace {{workspace}} · policy {{policy}} · overall applicability: {{overall}}`,current:`current`,stale:`stale`,unavailable:`unavailable`,overallCurrent:`applies`,overallStale:`does not apply`,overallUnverifiable:`unable to verify`},evidence:{current:`Current`,stale:`Stale`,failed:`Failed`,missing:`Missing`,interrupted:`Interrupted`,blocked:`Blocked`},reason:{not_required:`No checks were required.`,policy_invalid:`The persisted required-check policy is invalid.`,policy_drift:`The required-check policy changed.`,workspace_unavailable:`The workspace could not be inspected.`,intended_identity_mismatch:`The workspace no longer matches the intended delivery state.`,missing_evidence:`Required evidence is missing.`,target_mismatch:`Evidence belongs to a different target.`,batch_not_completed:`The source batch did not complete.`,incomplete_evidence:`The source batch has incomplete evidence.`,duplicate_evidence:`The source batch contains duplicate evidence.`,extra_evidence:`The source batch contains unexpected evidence.`,definition_drift:`A required check definition changed.`,attempt_failed:`A required check failed.`,attempt_stale:`Required evidence is stale because the workspace changed.`,target_busy:`Another check batch is already running for this target.`,check_start_failed:`Required checks could not start.`},attempts:`Check attempts`,runActions:`Check run actions`,selectionHint:`Select checks to run`,selectForRun:`Select {{name}} for the next run`,inspectAttempt:`Inspect {{name}}, {{status}}`,evidenceSelected_one:`{{count}} repair evidence source selected`,evidenceSelected_other:`{{count}} repair evidence sources selected`,selectAttemptTitle:`Select a check attempt`,selectAttemptDescription:`Choose a completed or active attempt from the check list to inspect its output and evidence.`,notRunDescription:`This check was not included in the latest run. Its configuration is shown below.`,runSelected:`Run selected`,starting:`Starting...`,stop:`Stop batch`,stopping:`Stopping...`,rerunAll:`Rerun all`,rerunFailed:`Rerun failed`,loading:`Loading durable check state...`,emptyTitle:`No check batches yet`,emptyDescription:`Select one or more configured checks to create a batch.`,stopRequested:`Stop requested`,summary:`{{passed}} passed · {{failed}} failed · {{running}} running · {{queued}} queued`,environment:{batchOwnership_one:`This batch owns one environment lease shared by {{count}} queued or running attempt.`,batchOwnership_other:`This batch owns one environment lease shared by {{count}} queued or running attempts.`,wholeSandboxStop:`Stopping the batch stops its processes; if an individual guest process cannot be terminated safely, the provider may stop the whole sandbox.`,attemptPlacementRecorded:`Exact attempt placement was recorded for target {{target}}.`,attemptPlacementPending:`Exact attempt placement is not available yet.`},command:`Command`,directory:`Directory`,targetRoot:`Target root`,outcome:`Outcome`,currencyLabel:`Currency`,policyLabel:`Policy`,output:`Output`,rawOutput:`Raw output`,outputEmpty:`This check has not produced output yet.`,outputExpired:`Output expired under the retention policy. The durable outcome remains available.`,outputTruncated:`Older output was removed by the retention limit.`,diagnostics:{title:`Structured diagnostics`,loading:`Loading parser state...`,availableCount_one:`{{count}} structured diagnostic available`,availableCount_other:`{{count}} structured diagnostics available`,noneAvailable:`No structured diagnostics are available.`,failureOutcome:`Failure outcome: {{outcome}}`,severitySummaryLabel:`Diagnostic counts by severity`,severityCount_one:`{{count}} {{severity}}`,severityCount_other:`{{count}} {{severity}}`,totalAvailable:`{{count}} total recorded`,noStructuredDiagnostics:`No structured diagnostics were returned. Retained raw output may be available below.`,structuredDetailsUnavailable:`Structured issue details are unavailable. The recorded total remains available.`,summary_one:`{{count}} structured diagnostic from {{parser}}`,summary_other:`{{count}} structured diagnostics from {{parser}}`,selectLegend:`Select diagnostics to repair`,selectedEvidence_one:`{{count}} repair evidence source selected`,selectedEvidence_other:`{{count}} repair evidence sources selected`,diagnosticLimit:`A repair can include up to {{count}} diagnostics. Clear a selection to choose another.`,attemptLimit:`A repair can include diagnostics from up to {{count}} check attempts. Clear a selection from another attempt to continue.`,rawOutputSelect:`Use retained raw output as repair evidence`,rawOutputHint:`The server will send this persisted check output to the repair agent. Output is treated as untrusted evidence, not instructions.`,rawOutputTruncated:`Earlier output was removed by the retention limit.`,technicalDetails:`Technical details`,technicalDetailsHint:`Review evidence and repair context.`,parserLabel:`Parser`,parserStateLabel:`Parser state`,parserRetentionLabel:`Parser retention`,outputRetentionLabel:`Output retention`,applicabilityLabel:`Applicability`,sourceLabel:`Source`,source:`Source: {{source}}`,repositoryLocation:`Repository-root diagnostic (no file range)`,applicability:`Present applicability: {{state}}`,repairApplicability:`Applies to the retained batch terminal state`,retention:`Retention: {{state}}`,expired:`Structured diagnostics expired. Issue details are unavailable; retained raw output may still be available below.`,truncated:`The parser reached its diagnostic limit. Use raw output as the primary fallback.`,destinationTitle:`Repair destination`,destinationHint:`The server determines this from the blocked automation boundary.`,destination:{pre_review:`Next: pre-Review checks, then automatic Review.`,commit:`Next: required checks, then commit creation.`,push:`Next: required delivery checks, then push.`,pull_request:`Next: required delivery checks, then pull-request creation.`,manual:`Next: rerun the affected checks. No automation progression is claimed.`,unknown:`Next boundary is unavailable. No delivery progression is claimed.`},ticketLabel:`Repair ticket`,ticketPlaceholder:`Select a ticket for this repair`,repairSelected_one:`Repair {{count}} diagnostic`,repairSelected_other:`Repair {{count}} diagnostics`,repairSelectedEvidence_one:`Repair from {{count}} evidence source`,repairSelectedEvidence_other:`Repair from {{count}} evidence sources`,starting:`Starting repair...`,stopRepair:`Stop repair`,repairRunning:`Repair is running`,repairResult:{passed:`Repair rerun passed`,failed:`Repair failed`,cancelled:`Repair was stopped`,interrupted:`Repair was interrupted`},autoFix:{attempt:`Attempt {{current}} of {{total}}`,stop:`Stop automatic repair`,phase:{dispatching:`Starting automatic repair`,repairing:`Repairing checks`,fallback:`Provider continuation was rejected before execution; starting a fresh repair`,rerunning:`Rerunning checks for attempt {{current}} of {{total}}`,stopping:`Stopping automatic repair`,terminal:`Automatic repair finished`},terminal:{passed:`Automatic repair passed all checks`,ineligible:`These failures cannot be repaired automatically`,non_auto_fixable_only:`Only non-auto-fixable failures remain`,agent_failure:`The repair agent failed`,no_workspace_changes:`The repair agent made no changes`,unchanged_failures:`Automatic repair made no progress`,user_cancelled:`Automatic repair was stopped by the user`,stale:`Check definitions or workspace became stale`,exhausted:`Automatic repair used all three attempts`,interrupted:`Automatic repair was interrupted`}},parser:{typescript:`TypeScript`,eslint:`ESLint`,none:`raw output`},state:{pending:`Parsing`,complete:`Parsed`,unsupported:`Unsupported parser`,malformed:`Parsing failed`,interrupted:`Parsing interrupted`},fallback:{unsupported:`This output format is unsupported. Raw output is the primary evidence.`,malformed:`Structured parsing failed. Raw output is the primary evidence.`,interrupted:`Structured parsing was interrupted. Raw output is the primary evidence.`},severity:{error:`Error`,warning:`Warning`,info:`Info`,unknown:`Unknown`},applicabilityState:{current:`current workspace`,stale:`stale workspace`,pending:`pending completion`,unavailable:`unable to verify`},retentionState:{retained:`retained`,expired:`expired`},disabled:{stale:`Repair is disabled because this diagnostic does not apply to the current workspace.`,definition_stale:`Repair is disabled because the check definition changed after this batch ran.`,workspace_changed:`Repair is disabled because the workspace changed after this batch finished.`,workspace_unavailable:`Repair is disabled because the current workspace identity could not be verified.`,evidence_identity_unavailable:`Repair is disabled because the batch terminal workspace identity is unavailable.`,unsupported:`Repair is disabled because structured parsing is unsupported or failed.`,expired:`Repair is disabled because required diagnostics or raw output expired.`,repository_root:`Repair is unavailable for repository-root attempts.`,busy:`Repair is disabled while this target has active checks or another repair.`,non_repairable:`These diagnostics are not eligible for repair.`}},status:{queued:`Queued`,running:`Running`,waiting:`Waiting`,completed:`Passed`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`,notRun:`Not run`},category:{test:`Test`,typecheck:`Typecheck`,lint:`Lint`,"format-check":`Format check`,build:`Build`,coverage:`Coverage`,security:`Security`,custom:`Custom`},outcomeValue:{passed:`Passed`,command_failure:`Command failed`,spawn_failure:`Process could not start`,infrastructure_failure:`Check infrastructure failed`,evidence_persistence_failure:`Check evidence could not be saved`,timeout:`Timed out`,workspace_changed_before_start:`Workspace changed before start`,user_stop:`Stopped by user`,restart_loss:`Interrupted by server restart`,shutdown_loss:`Interrupted by server shutdown`},currency:{current:`Current`,stale:`Stale`,pending:`Pending completion`,unavailable:`Unable to verify`},errors:{load:`Unable to load checks right now.`,run:`Unable to start checks right now.`,stop:`Unable to stop this batch right now.`,rerun:`Unable to rerun checks right now.`,diagnostics:`Unable to load structured diagnostics. Raw output remains available.`,repair:`Unable to start repair right now.`,repairStop:`Unable to stop repair right now.`}},verificationDialog:{title:`Verification`,description:`Run configured checks or explore tests for the selected target.`,close:`Close verification`,openActivity:`Open Activity`,tabsAriaLabel:`Verification modes`,tabs:{checks:{label:`Checks`,description:`Run tests and other configured quality gates together as a batch.`},tests:{label:`Test Explorer`,description:`Discover and run a granular test suite, file, or case.`}},status:{checks:{inactive:`Check batch idle`,running:`Check batch running`,finished:`Check batch completed`,error:`Check batch failed`,interrupted:`Check batch interrupted`},tests:{inactive:`Test run idle`,running:`Test run running`,finished:`Test run passed`,error:`Test run failed`,interrupted:`Test run stopped`}}},testsDialog:{status:{passed:`Passed`,failed:`Failed`,running:`Running`,error:`Error`,stopped:`Stopped`,idle:`Idle`},selection:{noRunYet:`No test run yet`,allTests:`All tests`},actions:{run:`Run`,stop:`Stop`},caseRow:{runAriaLabel:`Run {{name}}`},fileRow:{expandAriaLabel:`Expand {{path}}`,collapseAriaLabel:`Collapse {{path}}`,runAriaLabel:`Run {{path}}`,testCount_one:`{{count}} test`,testCount_other:`{{count}} tests`,noNamedTests:`No named tests were detected in this file.`},scope:{label:`Test scope`,selectedCommandAriaLabel:`Selected test command`,selectTestScope:`Select test scope`,fullSuiteOnlyNotice:`This scope supports full-suite runs only, so file and case selection is disabled.`},filter:{placeholder:`Filter`,ariaLabel:`Filter test cases`,clearAriaLabel:`Clear test case filter`},discovery:{noCommands:`No test commands are configured for this target yet.`,fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`,caseCount_one:`{{count}} test case`,caseCount_other:`{{count}} test cases`,noFilesDetected:`No JS or TS test files were detected for this target yet.`,noFilterMatches:`No test cases match this filter.`},summaryCounts:{failed:`failed`,passed:`passed`,filesFailed:`files failed`,filesPassed:`files passed`},output:{trimmed:`Output trimmed to recent logs`,ariaLabel:`Test output`,empty:`No test output yet.`},messages:{loadRunnerError:`Unable to load the test runner right now.`,discoverError:`Unable to discover tests right now.`,startError:`Unable to start the selected tests right now.`,stopError:`Unable to stop the test run right now.`},dialog:{srTitle:`Tests`,srDescription:`Run configured tests for the selected project target. Completed attempts remain in project Activity after this dialog closes.`,title:`Tests`,preparingTarget:`Preparing target...`,closeAriaLabel:`Close modal`},closeConfirmation:{title:`Stop test run and close?`,description:`Closing stops the active process and removes this live discovery session. The durable attempt and its retained evidence remain in Activity.`,keepRunning:`Keep running`,stopAndClose:`Stop and close`}},githubActions:{dialog:{srTitle:`GitHub Actions`,srDescription:`List GitHub Actions workflows, dispatch them with inputs, and watch run status.`,title:`GitHub Actions`,closeAriaLabel:`Close modal`},actions:{run:`Run`,dispatch:`Run workflow`,cancel:`Cancel`,refresh:`Refresh`,openOnGithub:`Open on GitHub`},workflows:{title:`Workflows`,ariaLabel:`GitHub Actions workflows`,runAriaLabel:`Run workflow {{name}}`,stateActive:`Active`,stateDisabled:`Disabled`,empty:`No workflows found in this repository.`,emptyHint:`Add a workflow file under .github/workflows to get started.`,docsLink:`Learn more about GitHub Actions`,loadError:`Unable to load workflows right now.`,loading:`Loading workflows...`},inputs:{title:`Workflow inputs`,refLabel:`Branch or tag`,refPlaceholder:`main`,refAriaLabel:`Branch or tag ref to run the workflow on`,requiredLabel:`Required`,requiredValidationError:`Please fill in all required inputs.`,booleanYes:`Yes`,booleanNo:`No`,selectPlaceholder:`Select an option`,notDispatchable:`This workflow cannot be triggered manually.`,loading:`Loading workflow inputs...`},runs:{title:`Recent runs`,ariaLabel:`Recent GitHub Actions runs`,empty:`No runs yet. Dispatch a workflow to see its status here.`,resolving:`Resolving run...`,notVisible:`Run dispatched but not yet visible on GitHub.`,unknownRef:`Unknown branch or ref`,trackingState:{resolving:`Waiting for this run to become visible on GitHub...`,resolved:`The GitHub run was resolved.`,not_visible:`The dispatched run did not become visible on GitHub.`,ambiguous:`More than one GitHub run matched this dispatch, so Archon could not identify the run safely.`,failed:`GitHub could not provide the run state.`},durationLabel:`Duration`,stepsLabel:`Steps`,jobsLabel:`Jobs`,loadError:`Unable to load runs right now.`},status:{queued:`Queued`,in_progress:`In progress`,completed:`Completed`,unknown:`Unknown`},conclusion:{success:`Success`,failure:`Failure`,cancelled:`Cancelled`,neutral:`Neutral`,skipped:`Skipped`,timed_out:`Timed out`,action_required:`Action required`,stale:`Stale`},messages:{dispatched:`Workflow dispatched. Tracking run status...`,dispatchError:`Unable to dispatch the workflow right now.`}},planningAgentSidebar:{runStatus:{planning:`Planning...`,done:`Done`,failed:`Failed`},runSummary:{tickets:`{{count}} tickets`,dependencies:`{{count}} dependencies`,openQuestions_one:`{{count}} open question`,openQuestions_other:`{{count}} open questions`},actions:{planTickets:`Plan tickets`,openAriaLabel:`Open planning agent`,closeAriaLabel:`Close planning agent`,closePanelAriaLabel:`Close planning agent panel`,manageBundles:`Manage bundles`},tooltip:`Planning agent`,ariaLabel:`Planning agent sidebar`,title:`Planning agent`,description:`Turn a larger initiative into plan-stage tickets with dependencies and bundle context.`,descriptionLabel:`Description`,descriptionAriaLabel:`Planning description`,descriptionPlaceholder:`Describe the task, acceptance criteria, context...`,autoCreateBundle:`Auto-create bundle`,activeRuns:`Active planning runs`,recentRuns:`Recent runs`},reviewFollowUpBubble:{finding:`Finding {{count}}`,externalFix:`External fix {{count}}`,previewComment:`Preview comment {{count}}`,comment:`Comment {{count}}`,unknownTarget:`Unknown target`,textLabel:`Text`,hrefLabel:`Href`,srcLabel:`Src`,changedLineLabel:`Changed line`,selectedFixes:`Selected fixes`,fixCount_one:`{{count}} fix`,fixCount_other:`{{count}} fixes`,locationFile_one:`{{count}} file`,locationFile_other:`{{count}} files`,locationPage_one:`{{count}} page`,locationPage_other:`{{count}} pages`,locationTarget_one:`{{count}} target`,locationTarget_other:`{{count}} targets`,showRawPrompt:`Show raw prompt`,hideRawPrompt:`Hide raw prompt`,rawPrompt:`Raw prompt`},buildRequirementResolutionBubble:{displayTitle:`Build decisions`,title:`Answered Build requirements`,requirementCount_one:`{{count}} decision`,requirementCount_other:`{{count}} decisions`,ticketCount_one:`{{count}} ticket`,ticketCount_other:`{{count}} tickets`,summary:`{{requirementLabel}} across {{ticketLabel}}`,question:`Question`,decision:`Decision`,showRawPrompt:`Show raw prompt`,hideRawPrompt:`Hide raw prompt`,rawPrompt:`Raw prompt`},githubCommentMarkdown:{suggestionLabel:`Suggested change`},ticketStaticDescription:{ariaLabel:`Ticket description`,title:`Description`},ticketDependencyDetails:{blocksTitle:`Blocks`,buildReadinessAriaLabel:`Build readiness`,buildReadinessTitle:`Build readiness`,ready:`Ready`,blocked:`Blocked`,summaryReady:`All blockers have finished build.`,summaryBlocked_one:`{{count}} blocker is still waiting on build.`,summaryBlocked_other:`{{count}} blockers are still waiting on build.`,buildDone:`Build done`,waitingOnBuild:`Waiting on build`,remove:`Remove`,dependencyDetails:`Dependency details`,show:`Show`,hide:`Hide`,unknownTicket:`Unknown ticket`},ticketBuildChainPreview:{ariaLabel:`Build chain`,title:`Build chain`},runControl:{stopAriaLabel:`Stop`,stoppingAriaLabel:`Stopping run`,stoppingTitle:`Stopping run...`,stop:`Stop`,runAriaLabel:`Run`,startingAriaLabel:`Starting run`,startingTitle:`Starting run...`,run:`Run`,disabledReason:`Stop the currently running ticket before starting another run.`},sandboxPreviewRunDialog:{title:`Choose where to run the preview`,description:`This Docker Sandbox release can run the service, but it cannot safely publish its preview port. You can keep the service isolated without an in-app preview, or run this service on the host machine.`,hostWarning:`Running on the host removes sandbox isolation for setup and service commands. The process can access the host filesystem, network, and eligible host credentials. This choice applies only to this run and does not change the project default.`,cancel:`Cancel`,runInSandbox:`Run in sandbox without preview`,runOnHost:`Run on host with preview`},ticketChangesCommitPanel:{title:`Commit selected files`,selectedFiles_one:`{{count}} file selected`,selectedFiles_other:`{{count}} files selected`,commitMessageAriaLabel:`Commit message`,commitMessagePlaceholder:`Commit message`,generateCommitMessageAriaLabel:`Generate commit message`,generating:`Generating...`,generate:`Generate`,committing:`Committing...`,commit:`Commit`},ticketChangesCommitsPanel:{changesLabel:`Local commits`,changesAriaLabel:`Local commits`,changesMenuAriaLabel:`Changes menu`,viewChangesLabel:`View changes`,viewChangesAriaLabel:`View changes`,viewChangesTitle:`View changes`,viewChangesDescription:`Choose which changes to inspect.`,localCommitsLabel:`Local commits`,localCommitsAriaLabel:`Local commits`,localCommitsTitle:`Local commits`,localCommitsDescription:`View local commits on this branch.`,diffSource:`Diff source`,branchDiff:`Branch diff`,uncommittedChanges:`Uncommitted changes`,allListedCommits:`All listed commits`,individualCommits:`Individual commits`,loading:`Loading branch commits...`,undoing:`Undoing...`,undoLatestCommit:`Undo latest commit`,squashCommits:`Squash commits...`,squashTitle:`Squash {{count}} commits?`,squashDescription:`This rewrites your unpushed commit history into one commit. Remote commits will not be changed.`,squashMessageLabel:`New commit message`,squashMessagePlaceholder:`Commit message`,squashCleanWorkspaceWarning:`The workspace must be clean. Commit, stash, or discard current changes before squashing.`,cancel:`Cancel`,squash:`Squash commits`,squashing:`Squashing...`},workspaceReviewModal:{changes:`Changes`,files:`Files`,modeAriaLabel:`Review mode`,closeAriaLabel:`Close workspace review`,chatRequired:`Open Chat to submit review comments.`},workspaceFiles:{target:`Target`,repositoryRoot:`Repository root`,bundleTarget:`{{name}}`,ticketTarget:`Ticket: {{id}}`,fileBrowser:`File browser`,searchFiles:`Search files`,searchPlaceholder:`Search by path`,changedOnly:`Changed files only`,repositoryTree:`Repository tree`,noSearchResults:`No files match your search.`,noFilterResults:`No files match this filter.`,loadingManifest:`Loading workspace files...`,manifestError:`Unable to load workspace files.`,noProject:`No project is selected.`,retry:`Retry`,truncated:`File list truncated at the server limit.`,selectFile:`Select a file`,tracked:`Tracked`,refreshFiles:`Refresh files`,viewChanges:`View changes`,empty:`Choose a readable file from the repository tree to inspect its source.`,loadingFile:`Loading {{path}}...`,contentError:`Unable to load this file.`,viewMode:{ariaLabel:`File view mode`,preview:`Preview`,source:`Source`,sourceRequiredLargeFile:`Source mode is required because this Markdown file is too large to preview.`},expandedFolder:`Expanded: {{path}}`,collapsedFolder:`Collapsed: {{path}}`,fileLabel:`{{status}}{{path}}{{comments}}`,commentsSuffix:`, {{count}} comments`,unsupported:{absolute_path:`Absolute paths cannot be opened.`,binary:`Binary files cannot be displayed.`,deleted:`This file has been deleted.`,invalid_utf8:`This file is not valid UTF-8 text.`,missing:`This file is no longer present in the workspace.`,not_in_manifest:`This file is no longer in the workspace manifest.`,not_regular_file:`This path is not a regular file.`,nul_byte:`This file contains binary data and cannot be displayed.`,oversized:`This file is too large to display.`,path_traversal:`This path is outside the selected workspace.`,symlink:`Symbolic links cannot be opened here.`,unreadable:`This file cannot be read.`},source:{ariaLabel:`Source code`,empty:`This file is empty.`,highlightingDisabledLargeFile:`Syntax highlighting is disabled because this file is too large.`,search:{open:`Search within file`,inputLabel:`Find in file`,placeholder:`Find in file`,matchCount:`{{current}} of {{total}}`,noMatches:`No matches`,previous:`Previous match`,next:`Next match`,close:`Close search`},commentOnLine:`Comment on line {{lineNumber}}`,stale:`Stale`,edit:`Edit`,remove:`Remove`,placeholder:`Tell the agent what should change`,cancel:`Cancel`,add:`Add comment`,save:`Save comment`},markdown:{ariaLabel:`Markdown preview`,empty:`This Markdown file is empty.`,disabledLargeFile:`Markdown preview is disabled because this file is too large.`,imagePlaceholder:`Image not loaded: {{alt}} ({{source}})`,imagePlaceholderNoAlt:`Image not loaded ({{source}})`,missingImageSource:`source unavailable`,missingLinkSource:`unsupported link`}},chatChangesPanel:{unknownFile:`Unknown file`,picker:{diff:`Diff`,file:`File`,allChanges:`All changes`,openChangedFilesAriaLabel:`Open changed files`,fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`,title:`Changed files`,allChangesDescription:`Review the full workspace diff.`},fileStatus:{modified:`Modified`,added:`Added`,deleted:`Deleted`,renamed:`Renamed`,untracked:`Untracked`,typechanged:`Type changed`,staged:`Staged`,unstaged:`Unstaged`,conflicted:`Conflicted`,renamedFrom:`from {{path}}`},errors:{loadDiff:`Unable to load the diff right now.`,sendChanges:`Unable to send the changes right now.`},toasts:{sendChangesSuccess:`Changes sent to chat.`},closeAriaLabel:`Close diff panel`,emptyStateTitle:`No uncommitted changes.`,emptyStateDescription:`The current project branch is clean.`},pendingFixesPopover:{triggerLabel:`Pending fixes`,title:`Pending fixes`,description:`Review selected comments and findings before sending them back to the agent.`,empty:`No pending fixes selected yet.`,manualCommentTitle:`Manual comment`,manualBadge:`Manual`,sourceLocation:`Workspace file · {{path}} · line {{line}}`,staleSource:`Source changed since this comment was added.`,edit:`Edit`,remove:`Remove`,cancel:`Cancel`,save:`Save`,editCommentLabel:`Edit pending comment`,findingTitle:`Finding {{ordinal}}`,githubReviewSummary:`GitHub review summary`,githubReviewComment:`GitHub review comment`,clear:`Clear`,sending:`Sending...`,sendFixes:`Send fixes ({{count}})`,lineReference:{oldAndNew:`old {{oldLine}}, new {{newLine}}`,newOnly:`new {{newLine}}`,oldOnly:`old {{oldLine}}`,unavailable:`line unavailable`}},ticketChangesDiffPanel:{stats:{fileCount_one:`{{count}} file`,fileCount_other:`{{count}} files`},reviewComment:{manualBadge:`Manual`,commentOnLine:`Comment on line {{lineNumber}}`,addCommentToLine:`Add a comment to line {{lineNumber}}`,ariaLabel:`Review comment for {{filePath}}`,placeholder:`Add a review comment for this change`,edit:`Edit`,remove:`Remove`,add:`Add comment`,cancel:`Cancel`},lineReference:{oldAndNew:`old {{oldLine}}, new {{newLine}}`,newOnly:`new {{newLine}}`,oldOnly:`old {{oldLine}}`,unavailable:`line unavailable`},reviewFinding:{title:`Finding {{ordinal}}`,selected:`Selected`,fix:`Fix`,hideDetails:`Hide details`,details:`Details`,whyItMatters:`Why it matters`,requestedFix:`Requested fix`,sectionTitle:`Review findings`,reviewerModel:`Reviewed with {{model}}`,reviewerModelVariant:`Reviewed with {{model}} · {{variant}}`},githubComment:{badge:`GitHub`,reviewSummary:`Review summary`,fileComment:`File comment`,inlineComment:`Inline comment`,outdated:`Outdated`,openOnGitHub:`Open on GitHub`,sectionTitle:`GitHub review comments`},viewType:{unified:`Unified`,split:`Split`},header:{allChanges:`All changes`,viewCurrentFile:`View file`,nextComment:`Next comment`,nextCommentAriaLabel:`Next review comment`,nextCommentTooltip:`Jump to the next review comment`},states:{loading:`Loading diff...`,refreshing:`Refreshing diff... Displayed changes may be outdated.`,retry:`Retry`,emptyTitle:`No changes to show.`,noRenderableFileTitle:`No renderable diff for this file in the UI.`},fileBadge:{newFile:`New file`}}},projects:{identity:{activeProjectAriaLabel:`Active project`,emptyLabel:`No projects yet`,filterPlaceholder:`Filter projects...`,emptySearch:`No matches`,newProject:`New project`,newProjectAriaLabel:`Create a new project`,editProjectSettingsAriaLabel:`Edit project settings`},modal:{dialogTitle:{create:`Add a repository to Archon`,edit:`Edit project settings`},dialogDescription:`Configure a project repository, setup commands, services, and IDE launch settings.`,header:{title:{create:`Add project`,edit:`Edit project settings`},description:{create:`Point Archon at a repository, then define only the behavior you want Archon to manage.`,edit:`Update how Archon prepares and opens worktrees for this repository.`},close:`Close modal`},navigation:{title:`Settings`,general:`General`,automation:`Automation`,execution:`Execution`,services:`Services`,checks:`Checks`,sync:`Sync`,memory:`Memory`,integrations:`Integrations`,danger:`Danger Zone`,summary:{required:`Required`,configured:`Configured`,optional:`Optional`,none:`None`,enabled:`Enabled`,disabled:`Disabled`,loading:`Loading`,blocked:`Blocked`,ready:`Ready`,host:`This machine`,dockerSandbox:`Docker Sandbox`,count:`{{count}}`,integrationsCount_one:`{{count}} enabled`,integrationsCount_other:`{{count}} enabled`}},sections:{general:{title:`General`,description:`Start with the repository Archon should use when it creates and manages worktrees for this project.`},automation:{title:`Automation`,description:`Configure helper defaults, setup behavior, and optional workflow rules Archon can apply to this project.`},execution:{title:`Execution`,description:`Choose where Build agents run and validate Docker Sandbox environments for the exact selected target.`},services:{title:`Services`,description:`Add long-running commands that Archon should start automatically inside each worktree.`},checks:{title:`Checks`,description:`Configure reusable commands and manage their project-wide execution policies.`},sync:{title:`Sync`,description:`Define which local files Archon should copy or symlink into a worktree the first time it is created.`},memory:{title:`Memory`,description:`Turn project memory on or off and manage the saved context Archon keeps outside the repository.`},integrations:{title:`Integrations`,description:`Connect external systems that add richer context to planning, tickets, and pull requests for this project.`},danger:{title:`Danger Zone`,description:`Delete this project only after its tickets and worktrees are already gone. This action cannot be undone.`}},linkedProjects:{none:`No linked projects`,count_one:`{{count}} linked project`,count_other:`{{count}} linked projects`},repoPath:{initializable:`Archon will initialize this directory as a git repository when you create the project.`,invalid:`Repository path is not a valid git repository.`,validateFailed:`Unable to validate the repository path right now.`,browseFailed:`Unable to open the folder picker.`},autoConfig:{applied:`Auto-config applied.`,noop:`Auto-config found no empty fields to fill.`,failed:`Auto-config failed.`},generatedCheckName:{scoped:`{{directory}} {{category}}`,repo:`repo {{category}}`,categories:{test:`tests`,typecheck:`typecheck`,lint:`lint`,"format-check":`format check`,build:`build`,coverage:`coverage`,security:`security`,custom:`check`}},validation:{projectNameRequired:`Project name is required.`,repositoryPathRequired:`Repository path is required.`,serviceCommandRequired:`A service command is required when a service row has values.`,syncSourceRequired:`A source path is required when a sync row has values.`,checkCommandRequired:`A command is required when a check row has values.`,checkDraftPending:`Confirm this check or cancel the draft before saving or closing.`,checkDraftNeedsAttention:`Fix the highlighted check fields, then add the check or cancel the draft.`,checkIdUnique:`Each check must have a unique ID.`,checkDirectoryRelative:`Directory must be a relative path inside the project repository.`,checkTimeoutRange:`Timeout must be a whole number between {{min}} and {{max}} milliseconds.`,checkProductionCustomOnly:`Only custom checks can require production approval.`,previewServiceRequired:`Choose a named service before enabling preview.`},actions:{cancel:`Cancel`,createProject:`Create project`,createProjectBusy:`Creating...`,saveChanges:`Save changes`,saveChangesBusy:`Saving...`}},execution:{loading:`Loading execution readiness...`,loadError:`Unable to load project execution readiness.`,unknown:`Unknown`,profile:{title:`Enforced Build profile`,description:`These choices are selected when a Build is accepted. Queued and historical runs keep that recorded revision even if this profile changes later.`,loading:`Loading the enforced Build profile...`,loadError:`Unable to load the enforced Build profile.`,saveError:`Unable to save the enforced Build profile. Review the selected requirements and try again.`,staleError:`This profile changed elsewhere. Reload the project settings before saving.`,invalidCombination:`Choose a provider, isolation, fallback, and credential protection combination supported by this profile.`,governedHostWarning:`This governed Host profile does not inherit host CLI credentials. Claude may appear logged out during Build even when Plan works.`,useHostCredentialCompatibility:`Use host credential compatibility`,activeFingerprint:`Active profile: {{fingerprint}}`,provider:`Execution provider preference`,isolation:`Required isolation`,isolationOption:{host_process_allowed:`Host process allowed`,microvm_required:`MicroVM required`},fallback:`Fallback`,fallbackOption:{block:`Block when unavailable`,explicit_host:`Allow explicit host fallback`},credential:{title:`Build credential requirements`,description:`Declare only the credential class that the selected Build agent requires. Credentials are configured outside Archon; this form never accepts credential values, OAuth responses, or private provider identifiers.`,item:`Requirement {{count}}`,agent:`Agent`,modelProvider:`Model provider`,authentication:`Authentication class`,protection:`Required protection`,none:`No model credential requirement is declared.`,add:`Add credential requirement`,remove:`Remove`},authentication:{api_key:`Provider API key`,oauth:`Supported OAuth authentication`},protection:{docker_brokered:`Docker brokering required`,legacy_host_inheritance:`Legacy host inheritance allowed`},invalidNetwork:`Fix the network access errors before applying execution settings.`,payloadTooLargeError:`The execution settings were rejected because the profile payload is too large. Remove destinations or requirements and try again.`,invalidDetailError:`The execution settings were rejected: {{detail}}`,network:{title:`Network access`,description:`Declare whether Build agents may reach the network and which destinations a sandbox allowlist must prove. This form never accepts credential values or secrets.`,mode:`Network mode`,modeAria:`Network mode`,modeOption:{unrestricted:`Unrestricted`,allowlist:`Allowlist`},limitReached:`At most {{count}} destinations can be allowlisted.`,hostProviderWarning:`The host provider cannot enforce an allowlist. Select Docker Sandbox for this profile so its destination rules are enforced during validations and runs.`,error:{missing_host:`Enter a destination host.`,invalid_host:`Use an exact hostname or a *.domain wildcard subdomain.`,invalid_port:`Use a port between 1 and 65535.`,invalid_purpose:`Keep the purpose short, non-empty, and under 256 characters.`,empty_allowlist:`Allowlist mode requires at least one destination.`},destination:{title:`Allowlisted destinations`,description:`Each row is one allowed destination: an exact hostname or *.domain wildcard subdomain, an optional port, and an optional short purpose.`,count:`{{count}} of {{max}} destinations`,item:`Destination {{count}}`,none:`No destinations are allowlisted yet.`,add:`Add destination`,removeAria:`Remove destination {{count}}`,hostPlaceholder:`api.example.com`,portPlaceholder:`443`,host:`Host`,hostAria:`Destination {{count}} host`,port:`Port (optional)`,portAria:`Destination {{count}} port`,purpose:`Purpose (optional)`,purposeAria:`Destination {{count}} purpose`}},runtimeBlocked:`Docker Sandbox can remain selected, but these execution settings cannot be applied until runtime readiness is eligible or ready.`,applyDescription:`Apply execution settings commits provider and advanced policy changes. The dialog’s Save changes action does not commit them.`,unsavedWarning:`Execution settings have unapplied changes. Validation remains unavailable until they are applied.`,save:`Apply execution settings`,saving:`Applying execution settings...`},provider:{title:`Where should Builds run?`,description:`Choose where new Builds run. Existing runs keep the environment recorded when they started.`,host:{label:`This machine`,description:`Run Build agents directly on the Archon host for compatibility with the existing workflow.`},docker_sandbox:{label:`Docker Sandbox`,description:`Run Build agents in validated, exact-target Docker Sandbox environments.`,status:{loading:`Checking runtime readiness...`,error:`Unavailable until runtime diagnostics can be checked.`,blocked:`Setup required before this choice can be applied.`,eligible:`Available; the daemon will start when needed.`,ready:`Available for validation.`}}},runtime:{title:`Docker Sandbox runtime`,loadError:`Unable to check Docker Sandbox runtime readiness.`,openDiagnostics:`Open runtime diagnostics`,setup:`Set up Docker Sandbox`,setupTitle:`Docker Sandbox setup`,open:`Open Runtimes`,retry:`Retry readiness check`,state:{loading:`Checking whether Docker Sandbox can run on this machine.`,error:`Readiness could not be confirmed.`,blocked:`Setup is required before Docker Sandbox settings can be applied.`,eligible:`Ready to activate when validation needs it.`,ready:`Ready for project validation.`}},create:{staged:`Create project stages only this provider choice. Profile policy and agent validation become available after the project exists.`,validationAfterCreate:`Create the project before validating OpenCode or Claude. Each agent can be validated independently.`},host:{title:`Builds run on this machine`,summary:`Build agents run directly on this computer for the broadest compatibility. You can prepare Docker Sandbox now without changing the saved provider.`},advanced:{title:`Advanced execution settings`,description:`Review isolation, fallback, credential requirements, the current target, and the active profile identity.`},effective:{title:`Effective Build environment`,host:`This machine (host)`,docker_sandbox:`Docker Sandbox`},readiness:{loading:`Checking whether every agent environment is ready...`,runtimeLoading:`Checking Docker Sandbox runtime readiness...`,runtimeBlocked:`Blocked: configure Docker Sandbox runtime prerequisites before validating this target.`,runtimeError:`Unavailable: Docker Sandbox readiness could not be confirmed. Open runtime diagnostics and retry.`,projectRequired:`Create the project, then validate {{agents}} before starting a sandboxed Build.`,providerRequired:`Select the OpenCode provider that Docker Sandbox should validate before starting a sandboxed Build.`,ready:`Ready. {{agents}} have current validation for this exact target.`,blocked:`Blocked: {{ready}} of {{total}} required agent validations are ready for this exact target and provider.`},requirements:{title:`Docker Sandbox requirements`,exactTarget:`The environment and validation must match the exact current project target.`,agents:`OpenCode and Claude are validated independently; each Build requires its selected agent to be ready.`,failClosed:`Builds do not fall back to this machine when Docker Sandbox is selected. Missing, stale, leased, or invalid evidence blocks execution.`},target:{title:`Current target`,selected:`Selected target`,path:`Writable path`,warning:`Direct mode mounts this worktree read-write. It does not protect the selected worktree from edits made by the sandboxed agent.`,kind:{"project-root":`Repository root`,"bundle-worktree":`Bundle worktree`,"branch-worktree":`Branch worktree`}},agent:{opencode:`OpenCode`,claude:`Claude`},validation:{title:`Agent sandbox validation`,action:`Validate {{agent}}`,retry:`Retry {{agent}}`,validating:`Validating...`,notValidated:`Not validated`,ready:`Ready`,failed:`Failed`,failedSummary:`This agent is not ready for Docker Sandbox on the current target.`,details:`Details`,technicalDetails:`Technical details`,environmentWillPrepare:`Every explicit validation rechecks runtime readiness and may automatically start the Docker Sandbox daemon when eligible before it prepares, reconnects to, or revalidates this agent's dedicated exact-target sandbox.`,saveProfileFirst:`Apply execution settings before validating this environment.`,stale:`This result belongs to a prior execution environment or project target and is stale.`,runState:`Execution-run state`,provider:`Validation provider`,providerLabel:`OpenCode provider for validation`,providerDescription:`Docker Sandbox validates provider access with a representative model. Models from the approved provider can then be selected for ticket Build, with the selected model rechecked before execution.`,probeModel:`Probe model`,runtimeVersion:`Agent runtime version`,providerNotSelected:`Not selected`,modelLabel:`OpenCode model for validation`,modelPlaceholder:`Select an exact OpenCode model`,modelCatalogLoading:`Loading discovered OpenCode models. Validation will be available when discovery finishes.`,modelCatalogEmpty:`No OpenCode models were discovered. Validation is unavailable until model discovery succeeds.`,modelCatalogRetry:`Retry model discovery`,providerFirst:`Select a provider to see its discovered models.`,modelUnavailable:`No discovered models are available for this provider. Select another provider or refresh discovery.`,inProgressOtherContext:`A validation is already running for another provider or model. You can edit this selection, but wait for it to finish before validating again.`,credentialDescription:`Docker Sandbox uses its own template or proxy credential setup; host OpenCode and Claude logins are not imported automatically.`,credentialSupportEvidence:`Credential support is classified by server validation evidence. Archon does not infer support from the provider name and never receives the credential value.`,providerLoading:`Loading available OpenCode providers...`,providerPlaceholder:`Select a provider`,verifiedOption:`sandbox verified`,modelNotSelected:`Not selected`,isolation:`Effective isolation`,template:`Template identity`,authentication:`Authentication`,skills:`Sandbox skills`,destinations:`Required destinations`,checkKind:{workspace_location:`Workspace location`,workspace_readable:`Workspace readability`,workspace_writable:`Workspace writability`,executable:`Executable`,headless:`Headless mode`,authentication:`Authentication`,skills:`Sandbox skills`,destination:`Destination access`,network:`Network policy`},destinationReason:{invalid_json:`The agent returned an invalid structured response.`,nonzero_exit:`The destination command exited unsuccessfully.`,timeout:`The destination validation exceeded its time limit.`,provider_error:`The provider reported an error while serving the selected model.`,model_not_found:`The selected model is not available in the sandbox provider.`,credential_rejected:`The provider rejected the sandbox credential or proxy mapping.`,empty_completion:`The automatically provisioned OpenCode runtime completed without assistant text. This sandbox template is incompatible and requires an Archon or Docker Sandbox template update.`,unexpected_response:`The agent response did not match the validation sentinel.`},checkReason:{model_required:`An explicit OpenCode model is required for this validation.`,provider_required:`An explicit OpenCode provider is required for this validation.`,credential_inventory_unavailable:`Docker Sandbox credential inventory could not be read, so provider-specific access could not be verified.`,runtime_version_unrecognized:`The automatically provisioned OpenCode runtime version could not be identified. Update Archon or the Docker Sandbox template before retrying.`},evidence:{title:`{{check}} evidence`,reason:`Reason: {{reason}}`,providerName:`Provider error: {{name}}.`,providerMessage:`Provider message: {{message}}`,providerReference:`Provider reference: {{reference}}`,runReference:`Archon run: {{runId}}; correlation: {{correlationId}}`,exitCode:`Exit code: {{code}}.`,exitCodeUnknown:`unknown`,truncated:`Output was truncated.`},interruption:`Interruption`,interrupted:`Interrupted; the persistent environment may still be available`,notInterrupted:`Not interrupted`,network:{title:`Effective network evidence`,modeLabel:`Requested network mode`,mode:{unrestricted:`Unrestricted`,allowlist:`Allowlist`},postureLabel:`Observed posture`,posture:{allow_all:`Allow-all`,deny_all:`Deny-all`,mixed:`Mixed outcomes observed`,none_initialized:`No sandbox posture observed`,unknown:`Unknown`},enforcementLabel:`Enforcement class`,enforcement:{enforced_scoped:`Scoped allowlist enforced`,declarative_only:`Declarative only`,none:`No scoped policy requested`,unknown:`Not proven`},enforcementNote:{declarative_only:`The Docker Sandbox global posture is allow-all, so the recorded allowlist is declarative only and does not restrict the Build runtime.`,unknown:`Scoped network enforcement could not be proven by this validation. Revalidate this agent for current evidence.`},decisionsLabel:`Per-destination decisions`,decision:{allow:`Allowed`,deny:`Denied`,unknown:`Unproven`},staleDecision:`Interrupted; evidence is stale and must be revalidated`,degradation:{denied:`A required destination was denied by the sandbox policy. Update the sandbox posture or the profile allowlist, then validate again.`,unknown:`Revalidate this agent to refresh network enforcement evidence before relying on these destinations.`},contextualBlock:`The requested destination allowlist is blocked because Docker Sandbox did not prove active, exact sandbox-scoped enforcement. Review Technical details and initialize or narrow the sandbox policy before retrying.`},remediation:`Resolve the failed checks, configure provider access through the Docker Sandbox setup, and validate this provider again.`,error:`Unable to validate the {{agent}} environment.`,failure:`Failure`,unsupportedRequirement:`The recorded validation does not satisfy the requested credential protection. This requirement blocks Build execution until a supported environment is validated.`},environment:{lastUsed:`Last used`,idlePolicy:`Idle policy`,idleScheduled:`Scheduled to stop {{value}}`,idleOnRelease:`Stops automatically after the final workload lease is released`,machineDisk:`Machine storage`,diskAvailable:`{{value}} available`,diskState:{not_ready:`No available capacity reported`,unknown:`Capacity unavailable`},privateDisk:`Private environment disk`,privateDiskUnsupported:`Unsupported by this provider version`,cleanupRetry:`Next cleanup retry`},checkState:{passed:`Passed`,failed:`Setup required`,cancelled:`Interrupted`},credentialSource:{stored:`stored credential`,environment:`environment or proxy credential`,brokered:`Docker credential proxy`,brokeredWithService:`Docker credential proxy: {{service}}`,guest:`guest authentication`,none:`no credential source`,unknown:`unknown credential source`},credentialClassification:{brokered_api_key:`brokered API key`,brokered_oauth:`brokered OAuth`,file_exposed:`file exposed to guest`,environment_exposed:`environment exposed to guest`,guest_stored:`stored in guest`,unavailable:`unavailable`,unknown:`unknown delivery protection`,legacy_host_inherited:`legacy host inheritance`},reset:{action:`Reset sandbox`,confirm:`Reset this Docker Sandbox? It removes the persistent sandbox state and requires validation again.`,resetting:`Resetting...`,error:`Unable to reset the Docker Sandbox.`},stop:{action:`Stop environment`,confirm:`Stop this entire Docker Sandbox environment? Active workloads in this sandbox may be interrupted.`,stopping:`Stopping environment...`,error:`Unable to stop the Docker Sandbox environment.`,reconnect:`The environment reconnects automatically when an eligible workload is admitted. There is no manual start action.`,wholeSandbox:`Stop environment affects the whole sandbox. Use workflow Stop controls to stop an individual process when exact process termination is available.`},retire:{action:`Retire environment`,confirm:`Retire this Docker Sandbox? It will be removed permanently after active leases are released.`,retiring:`Retiring environment...`,error:`Unable to retire the Docker Sandbox environment.`},cleanupRetry:{action:`Retry cleanup`,confirm:`Retry cleanup for this Docker Sandbox now?`,retrying:`Retrying cleanup...`,error:`Unable to retry Docker Sandbox cleanup.`},runState:{queued:`Queued`,running:`Running`,waiting:`Waiting`,completed:`Completed`,failed:`Failed`,cancelled:`Cancelled`,interrupted:`Interrupted`},isolation:{microvm:`MicroVM`,unknown:`Unknown`}},advanced:{agentProjection:`Showing settings for {{agent}}. Switch the active agent in the application header to edit another agent. Existing sessions keep their saved agent and model.`,summary:{none:`None`,configured:`Configured`,toolDefault:`Tool default`,implementingModel:`Implementing model per ticket`,default:`Default`,customRules:`Custom rules`,autoParkOn:`Auto-park on`,specAwareOn:`Spec coverage on`,modified:`Modified`,enabled:`Enabled`,manualOnly:`Manual only`,depthOnly:`{{depth}}`,depthWithFix:`{{depth}} + fix loop`,disabled:`Disabled`,watching:`Watching {{name}}`,commandCount_one:`{{count}} command`,commandCount_other:`{{count}} commands`,serviceCount_one:`{{count}} service`,serviceCount_other:`{{count}} services`,ruleCount_one:`{{count}} rule`,ruleCount_other:`{{count}} rules`},autoConfigPanel:{badge:`Auto-config`,description:`Inspect the repo and fill any empty setup, service, or sync fields.`,note:`Existing values stay untouched. Uses helper model if set, otherwise the selected tool's default model.`,loading:`Inspecting repo...`,action:`Auto-config`},helperModel:{title:`Helper model`,description:`Set an optional helper model for auto-config and other lightweight project tasks.`,panelDescription:`Used for auto-config and other lightweight project tasks. Leave empty to use the active agent's default model.`,unavailable:`Model discovery is unavailable right now. A previously saved model remains selected.`},reviewerModel:{title:`Reviewer model`,description:`Set an optional reviewer model for project code and spec reviews.`,unavailable:`Model discovery is unavailable right now. A previously saved model remains selected.`,modelLabel:`Reviewer model`,variantLabel:`Reviewer variant`,defaultModel:`Implementing model per ticket`},modelSelection:{loading:`Loading models...`,modelLabel:`Model`,variantLabel:`Variant`,defaultModel:`Use default model`,defaultVariant:`Use model default`,availableVariants:`Available variants`,unavailableSelection:`Unavailable`},commitMessages:{title:`Commit messages`,description:`Guide auto-generated commit subjects with a project-specific style or format.`,fieldLabel:`Commit message rules`,fieldDescription:`Optional. Example: Use Conventional Commits. Format: type(scope?): subject`,ariaLabel:`Commit message rules`,placeholder:`e.g. conventional commits`},checkpointCommits:{title:`Commit after each bundle ticket`,description:`Create a server-side checkpoint commit after each successful ticket in a ticket worktree bundle, before the next queued ticket starts. This does not apply to project-root targets.`,toggleLabel:`Commit completed ticket changes`,toggleDescription:`Create a checkpoint commit after each successful ticket, before the next ticket starts.`,toggleAriaLabel:`Commit completed ticket changes after each successful bundle ticket`,warning:`Turning this on during an active bundle may include existing uncommitted bundle changes in the first checkpoint.`},linkedProjects:{title:`Linked projects`,description:`Let Archon inspect related repos during planning when extra context helps.`,noneAvailable:`No other projects are available to link yet.`,triggerAriaLabel:`Linked projects`,selectedNone:`None`,selectedCount:`{{count}} linked`},setupCommands:{title:`Setup commands`,description:`Run these for fresh worktrees before builds, and again before Archon starts manual worktree services.`,fieldLabel:`Setup commands`,fieldDescription:`One command per line.`,ariaLabel:`Setup commands`,placeholder:`pnpm install
|
|
55
55
|
pnpm db:generate`},ideCommand:{title:`IDE command`,description:`Open the worktree in your editor after services start.`,fieldLabel:`IDE command`,fieldDescription:`Optional command to launch your preferred IDE.`,ariaLabel:`IDE command`,placeholder:`code --reuse-window`},staleHandling:{title:`Stale handling`,description:`Stale means build or review is finished, the worktree is clean, and the branch has no unpushed commits.`,toggleLabel:`Move stale tickets to Done automatically`,toggleAriaLabel:`Auto-park stale tickets`},specAwareReview:{title:`Spec-aware code review`,description:`On the first review of a spec-sourced bundle, also run a parallel pass that verifies the implementation against the originating spec snapshot.`,toggleLabel:`Run an additional spec-coverage review pass`,toggleAriaLabel:`Run spec-aware code review on the first spec-sourced bundle review`},pipelineAutomation:{title:`Pipeline automation`,description:`Advance tickets through review, commit, push, and PR automatically after you start a build. The chain always starts manually.`,depth:{label:`Pipeline depth`,description:`How far a ticket advances on its own after a manual start.`,ariaLabel:`Pipeline depth`,manual:`Manual`,autoReview:`Auto-review`,autoCommit:`Auto-commit`,autoPush:`Auto-push`,autoPr:`Auto-PR`,autoPrDisabledHint:`Connect a GitHub integration in the Integrations tab to enable Auto-PR.`},fixToggle:{label:`Auto-fix review findings`,description:`When the review stage is reached, run a follow-up turn against blocking findings and re-review until the review is clean or the iteration cap is hit.`,ariaLabel:`Auto-fix review findings`},openQuestionsToggle:{label:`Pause for Open Questions`,description:`Before automatic Review, pause the bundle when Build reports unresolved implementation questions.`,ariaLabel:`Pause automation for unresolved Build questions`},severity:{label:`Severity threshold`,description:`Findings at or above this severity block progression and enter the fix loop. Lower severities are informational.`,ariaLabel:`Severity threshold`,high:`High`,medium:`Medium`,low:`Low`},maxIterations:{label:`Max fix iterations`,description:`Cap on how many fix-and-re-review turns the loop runs before pausing. Between 1 and 10.`,ariaLabel:`Max fix iterations`}},services:{title:`Services`,description:`Launch background processes from each worktree when tickets start.`,backgroundProcesses:`Background processes`,addService:`Add service`,empty:`No services yet. Add one if this project needs long-running processes in each worktree.`},preview:{title:`In-app preview`,description:`Choose which named service should provide the browser preview Archon embeds beside the board.`,previewServiceLabel:`Preview service`,previewServiceDescription:`Only named services can be selected for preview.`,previewServiceAriaLabel:`Preview service`,noPreviewService:`No preview service`,previewPathLabel:`Preview path`,previewPathDescription:`Optional path override such as / or /dashboard.`,previewPathAriaLabel:`Preview path`,previewPathPlaceholder:`/`,capabilityModeLabel:`Capability mode`,capabilityModeDescription:`Override the automatic preview capability detection when needed.`,capabilityModeAriaLabel:`Preview capability mode`,capabilityMode:{auto:`Auto detect`,forceWeb:`Force web`,forceDisabled:`Disable preview`}},checks:{title:`Check definitions`,description:`Save reusable project-level commands. Execution policies are managed separately below.`,addCommand:`Add check`,empty:`No checks yet. Add one manually or use auto-config to seed a starting point.`,configuredTitle:`Configured checks`,composer:{title:`Add a check`,commandDetails:`Command details`,addAction:`Add check`,confirmAction:`Add to checks`,cancelAction:`Cancel draft`,nameAriaLabel:`Draft check name`,commandAriaLabel:`Draft check command`,categoryAriaLabel:`Draft check category`,directoryAriaLabel:`Draft check directory`,timeoutAriaLabel:`Draft check timeout`,runnerAriaLabel:`Draft test runner`,consequenceAriaLabel:`Draft check consequence`}},checkPolicies:{title:`Check policies`,description:`Choose when each configured check runs and whether Archon may repair its failures automatically. Run before Review requires Required for delivery; Auto-fix is independent.`,empty:`Add a check definition before configuring check policies.`,check:`Check`,required:`Required for delivery`,preReview:`Run before Review`,postBuild:`Run after build`,autoFix:`Auto-fix failures`,aria:{required:`Require {{name}} for delivery`,preReview:`Run {{name}} before Review`,postBuild:`Run {{name}} after build`,autoFix:`Auto-fix {{name}} failures`}},sync:{title:`Worktree sync`,description:`Copy or symlink files into a new worktree only the first time Archon creates it.`,addRule:`Add sync rule`,empty:`No sync rules yet. Add one for files like env or local config templates.`}},serviceRow:{title:`Service {{index}}`,description:`Runs from the worktree after setup completes.`,remove:`Remove`,fields:{nameLabel:`Name`,nameDescription:`Optional stable identifier used by preview selection.`,nameAriaLabel:`Service name {{index}}`,namePlaceholder:`web`,commandLabel:`Command`,commandAriaLabel:`Service command {{index}}`,commandPlaceholder:`npm run dev`,workingDirectoryLabel:`Working directory`,workingDirectoryDescription:`Relative to the worktree root.`,workingDirectoryAriaLabel:`Working directory {{index}}`,workingDirectoryPlaceholder:`client`}},checkDefinitionRow:{title:`Check {{index}}`,description:`A reusable project command. Test checks are also available in the Tests dialog.`,remove:`Remove`,removeAriaLabel:`Remove check {{name}}`,toggleAriaLabel:`Toggle check {{name}} details`,summary:{unnamed:`Unnamed check`,noCommand:`No command configured`,required:`Required`,preReview:`Pre-Review`,postBuild:`Post-Build`,runner:`Runner: {{runner}}`,production:`Production approval`},executionSettings:{title:`Execution settings`},required:{label:`Required for delivery`,description:`Automated commit, push, and pull request steps must satisfy this check. Manual Git operations are unaffected.`},preReview:{label:`Run before automatic Review`,description:`Automatic Review waits for this check before starting.`,disabledDescription:`Enable delivery requirement before selecting this check for pre-Review.`},postBuild:{label:`Run after manual Builds`,description:`Run this check after successful Ticket and Chat Build turns. Follow-up prompts wait until Checks finish.`},fields:{categoryLabel:`Category`,categoryAriaLabel:`Check category {{index}}`,categoryOptions:{test:`Test`,typecheck:`Typecheck`,lint:`Lint`,"format-check":`Format check`,build:`Build`,coverage:`Coverage`,security:`Security`,custom:`Custom`},nameLabel:`Name (optional)`,nameAriaLabel:`Check name {{index}}`,namePlaceholder:`client checks`,commandLabel:`Command`,commandAriaLabel:`Check command {{index}}`,commandPlaceholder:`npm --prefix client test`,directoryLabel:`Directory`,directoryDescription:`Optional relative path inside the selected target.`,directoryAriaLabel:`Check directory {{index}}`,directoryPlaceholder:`client`,timeoutLabel:`Timeout (ms)`,timeoutDescription:`Between 1,000 and 3,600,000 milliseconds.`,timeoutAriaLabel:`Check timeout {{index}}`,runnerLabel:`Runner`,runnerDescription:`Controls file and case selection support.`,runnerAriaLabel:`Test runner {{index}}`,runnerOptions:{auto:`Auto`,vitest:`Vitest`,jest:`Jest`,unknown:`Full suite only`},consequenceLabel:`Consequence`,consequenceDescription:`Production commands require explicit approval before each execution.`,consequenceAriaLabel:`Check consequence {{index}}`,consequenceOptions:{ordinary:`Ordinary`,production:`Production`}}},syncRow:{title:`Sync rule {{index}}`,description:`Applied only when Archon creates a worktree for the first time.`,remove:`Remove`,fields:{sourceLabel:`Source path`,sourceAriaLabel:`Sync source {{index}}`,sourcePlaceholder:`.env`,targetLabel:`Target path`,targetDescription:`Leave blank to reuse the source path.`,targetAriaLabel:`Sync target {{index}}`,targetPlaceholder:`.env.local`,modeLabel:`Mode`,modeAriaLabel:`Sync mode {{index}}`,modeOptions:{copy:`Copy`,symlink:`Symlink`}}},danger:{cardTitle:`Danger zone`,cardDescription:`Delete this project only after its tickets and worktrees are gone. This cannot be undone.`,deleteTitle:`Delete {{projectName}}`,deleteTitleFallback:`Delete this project`,deleteAvailable:`Delete is available because this project has no remaining tickets or worktrees.`,cancel:`Cancel`,deleteAction:`Delete project`,deleteBusy:`Deleting...`},integrations:{status:{connected:`Connected`,disconnected:`Disconnected`,error:`Error`},connectionMode:{directSummary:`API token`,ghSummary:`GitHub CLI`,directOption:`GitHub API token`,ghOption:`GitHub CLI (gh)`},card:{toggleAriaLabel:`Toggle {{title}} settings`,hide:`Hide`,show:`Show`},messages:{loadError:`Unable to load integrations right now.`,jiraSaveSuccess:`Jira settings saved.`,jiraConnectSuccess:`Jira connected.`,jiraConnectError:`Unable to connect Jira right now.`,jiraDisconnectSuccess:`Jira disconnected.`,jiraDisconnectError:`Unable to disconnect Jira right now.`,githubSaveSuccess:`GitHub settings saved.`,githubConnectSuccess:`GitHub connected.`,githubConnectError:`Unable to connect GitHub right now.`,githubDisconnectSuccess:`GitHub disconnected.`,githubDisconnectError:`Unable to disconnect GitHub right now.`},jira:{title:`Jira`,description:`Configure Jira imports and the additional issue fields Archon should include.`,connectedSummary:`Connected to {{baseUrl}} as {{email}}`,fields:{urlLabel:`Jira URL`,urlPlaceholder:`https://your-company.atlassian.net`,emailLabel:`Email`,emailPlaceholder:`name@company.com`,apiTokenLabel:`API token`,apiTokenPlaceholderConnected:`Leave blank to keep the current token`,apiTokenPlaceholderEmpty:`Paste a Jira API token`,additionalFieldsLabel:`Additional fields to include`,additionalFieldsDescription:`One Jira field name per line. Matching is case-insensitive. Example: Acceptance Criteria`,additionalFieldsPlaceholder:`Acceptance Criteria
|
|
56
56
|
Definition of Done`},actions:{disconnecting:`Disconnecting...`,disconnect:`Disconnect`,saving:`Saving...`,save:`Save`,connect:`Connect Jira`}},github:{title:`GitHub`,description:`Configure GitHub pull request tracking, issue import, and an optional default base branch override.`,connectedSummary:`Connected to {{repoOwner}}/{{repoName}} on {{host}} via {{mode}}`,fields:{connectionMethodLabel:`Connection method`,connectionMethodDescription:`Use a token stored by Archon, or use the authenticated gh CLI where the Archon server runs.`,defaultBaseBranchLabel:`Default base branch`,defaultBaseBranchDescription:`Optional override for new pull requests. Leave blank to use the repository default branch.`,defaultBaseBranchPlaceholder:`main`,apiTokenLabel:`GitHub API token`,apiTokenDescription:`Use a GitHub personal access token for API access.`,apiTokenPlaceholderConnected:`Leave blank to keep the current token`,apiTokenPlaceholderEmpty:`Paste a GitHub API token`},ghNotice:`Archon will run gh api from the server process. Run gh auth login in the same environment that starts Archon before connecting.`,actions:{disconnecting:`Disconnecting...`,disconnect:`Disconnect`,saving:`Saving...`,save:`Save`,connect:`Connect GitHub`}}},memory:{stageLabels:{plan:`Plan`,build:`Build`,review:`Review`,follow_up:`Follow-up`,plan_follow_up:`Plan follow-up`,chat:`Chat`},priorityLabels:{critical:`Critical`,normal:`Normal`,low:`Low`},injectionModeLabels:{always:`Always include`,relevant:`Only when relevant`},savedStateLabels:{superseded:`Superseded`,archived:`Archived`,active:`Active`},scanStatus:{notScanned:`Not scanned`,pending:`Pending`,running:`Running`,done:`Done`,error:`Error`},import:{noTitleConflicts:`No title conflicts.`,titleConflictCount_one:`{{count}} title conflict skipped.`,titleConflictCount_other:`{{count}} title conflicts skipped.`,readFileError:`Unable to read the selected file.`},artifact:{openAriaLabel:`Open scan artifact {{title}}`,emptyNotes:`No generated notes in this artifact yet.`},editor:{typeLabel:`Memory type`,typeAriaLabel:`Memory type`,decision:`Decision`,convention:`Convention`,titleLabel:`Title`,titleAriaLabel:`Memory title`,titlePlaceholderDecision:`Chat auto-scroll behavior`,titlePlaceholderConvention:`React change style`,scopeLabel:`Scope`,scopeDescription:`Optional`,scopeAriaLabel:`Memory scope`,scopePlaceholderDecision:`chat ui`,scopePlaceholderConvention:`react ui`,contentLabel:`Content`,contentAriaLabel:`Memory content`,contentPlaceholderDecision:`The chat should automatically scroll to the newest message by default.`,contentPlaceholderConvention:`Prefer extending existing component patterns instead of adding new abstraction layers for small UI changes.`,rationaleLabel:`Rationale`,rationaleDescription:`Optional`,rationaleAriaLabel:`Memory rationale`,rationalePlaceholderDecision:`The product is optimized for live agent output.`,rationalePlaceholderConvention:`This repo favors small local edits and consistent UI patterns.`,priorityLabel:`Priority`,priorityAriaLabel:`Memory priority`,injectionModeLabel:`Injection mode`,injectionModeAriaLabel:`Convention injection mode`,stagesLabel:`Stages`,stagesDescription:`Optional stage filter`,applicabilityDescription:`Optional, one per line`,pathGlobsLabel:`Path globs`,pathGlobsAriaLabel:`Memory path globs`,componentTagsLabel:`Component tags`,componentTagsAriaLabel:`Memory component tags`,implicationsLabel:`Implications`,implicationsDescription:`Optional, one per line`,implicationsAriaLabel:`Memory implications`,implicationsPlaceholder:`Preserve default bottom-follow behavior on new messages`,cancel:`Cancel`,saving:`Saving...`},suggested:{badge:`Suggested {{kind}}`,duplicateBadge:`Possible duplicate`,review:`Review`,saveAsNewDecision:`Save as new decision`,accept:`Accept`,acceptAs:`Accept as {{kind}}`,dismiss:`Dismiss`,dismissKind:`Dismiss {{kind}}`,reviewDescription:`Review this suggested {{kind}} before saving it into project memory.`,duplicateTitle:`Possible duplicate`,decision:`Decision`,instruction:`Instruction`,scope:`Scope:`,why:`Why:`,implications:`Implications:`,implicationsMultiline:`Implications (one per line)`,stages:`Stages:`,stagesMultiline:`Stages (comma or newline separated)`,priority:`Priority:`,injection:`Injection:`,noneSpecified:`None specified`,close:`Close`,edit:`Edit`,cancelEdits:`Cancel edits`,updateExistingDecision:`Update existing decision`,closestMemory:`Closest existing memory`,targetUnavailable:`The recommended target is no longer available.`,targetMemory:`target memory`,recommendation:`Recommended action:`,confidence:`Confidence:`,evidence:`Evidence`,dismissalReason:`Dismissal reason (optional)`,updateTarget:`Update {{title}}`,supersedeTarget:`Supersede {{title}}`,actions:{create:`Create new memory`,update:`Update existing memory`,supersede:`Supersede existing decision`},confidenceLevels:{low:`Low`,medium:`Medium`,high:`High`},dismissalReasons:{none:`No reason`,incorrect:`Incorrect`,not_durable:`Not durable`,already_captured:`Already captured`,too_broad:`Too broad`,not_useful:`Not useful`,other:`Other`}},provenance:{addedManually:`Added manually`,suggestedByAgent:`Suggested by agent`,source:`Source:`,stage:`Stage:`,addedAt:`Added:`,suggestedAt:`Suggested:`,viewSource:`View source`,sourceTypes:{ticket:`Ticket`,chat:`Chat`,spec:`Spec`}},ticketPanel:{title:`Project memory`,loadingBadge:`Loading`,scanStaleBadge:`Scan stale`,summaryLoading:`Loading saved project memory for this ticket.`,summarySaved:`Saved decisions, conventions and generated context`,summaryEmpty:`No saved project memory yet. Suggestions will still appear here when Archon finds them.`,decisionCount_one:`{{count}} decision`,decisionCount_other:`{{count}} decisions`,conventionCount_one:`{{count}} convention`,conventionCount_other:`{{count}} conventions`,scanCount_one:`{{count}} scan`,scanCount_other:`{{count}} scans`,viewDetails:`View details`,close:`Close`,suggestionsTitle:`Memory suggestions ({{count}})`,suggestionsDescription:`Review before saving`,dialogDescription:`Review the saved project context Archon can use while working on this ticket.`,decisionsTab:`Decisions`,conventionsTab:`Conventions`,generatedContextTab:`Generated context`,loading:`Loading project memory...`,memoryLoadError:`Unable to load saved project memory right now.`,suggestionsLoadError:`Unable to load project memory suggestions right now.`,retryMemory:`Retry memory`,retrySuggestions:`Retry suggestions`,noAcceptedDecisions:`No accepted decisions saved yet.`,noConventions:`No conventions saved yet.`,generatedContextStaleWarning:`Generated scan context may be outdated relative to the current repo HEAD.`,architecture:`Architecture:`,relevantAreas:`Relevant areas`,noRelevantAreas:`No relevant areas were captured in the latest scan.`,noGeneratedContext:`No generated context saved yet.`},scanControls:{title:`Repository scan files`,description:`Choose repository-relative paths for future generated-context scans. Enter one glob per line; excludes override includes.`,includeLabel:`Include globs`,includeDescription:`Leave empty to use Archon’s prioritized default selection.`,includeAriaLabel:`Repository scan include globs`,includePlaceholder:`src/**
|
|
57
57
|
docs/*.md`,excludeLabel:`Exclude globs`,excludeDescription:`Additional paths to omit. Built-in dependency, build, and VCS exclusions always apply.`,excludeAriaLabel:`Repository scan exclude globs`,excludePlaceholder:`**/*.snap
|
|
58
|
-
fixtures/**`,disclosure:`Selected repository excerpts are sent to the configured model provider. Archon applies best-effort secret redaction, but it cannot guarantee that every secret is detected.`},generatedContext:{disclosure:`Generated context is advisory. Selected repository excerpts are sent to the configured model provider with best-effort secret redaction.`,latestAttempt:`Latest scan attempt`,latestSuccessful:`Latest successful context`,viewDetails:`View scan details`,history:`Scan history`,noHistory:`No historical scans yet.`,loadMore:`Load more`,loadingMore:`Loading...`,historyError:`Unable to load scan history right now.`,detailError:`Unable to load scan details right now.`,detailTitle:`Scan details`,detailDescription:`Repository snapshot metadata, manifest, freshness, and generated artifacts.`,revision:`Revision`,branch:`Branch`,provider:`Provider`,toolModel:`Tool / model`,snapshotTime:`Snapshot finalized`,completionTime:`Artifacts persisted`,origin:`Origin`,unknownProvider:`Unknown provider`,unknown:`Unknown`,origins:{local_scan:`Local scan`,archive_import:`Archive import`},manifest:`Scan manifest`,noManifest:`No manifest is available for this historical scan.`,charactersSent:`{{count}} repository characters sent`,redactions:`{{count}} potential secrets redacted`,sampledPaths:`Sampled paths ({{count}})`,scanRules:`Selection rules`,includes:`Includes`,excludes:`Excludes`,hardExclusions:`Built-in exclusions`,skippedFiles:`Skipped observed files`,repositoryChangedDuringScan:`The repository changed while the model was generating this context.`,truncatedFields:`Oversized generated fields were truncated: {{fields}}`,skipReasons:{hard_excluded:`Built-in exclusion`,user_excluded:`Project exclusion`,not_included:`Outside include rules`,symlink:`Symbolic link`,binary:`Binary file`,unreadable:`Unreadable file`,file_size_limit:`File size limit`,file_count_limit:`File count limit`,directory_limit:`Directory limit`},defaultSelection:`Prioritized default selection`,none:`None`,artifacts:`Generated artifacts`,noSuccessfulContext:`No successful generated context is available yet.`,loadingDetail:`Loading scan details...`,freshness:{title:`Context review recommended`,current:`No freshness warnings detected.`,unavailable:`Some repository freshness comparisons are unavailable.`,branchChanged:`The current branch differs from the scanned branch.`,headChanged:`The current repository revision differs from the scanned revision.`,workingTree:`Current uncommitted content may differ from the sampled snapshot.`,age:`This context is more than 14 days old. Review it before relying on it.`,legacy:`Repository context may have changed since this scan.`}},messages:{loadError:`Unable to load project memory right now.`,refreshContextError:`Unable to refresh project context right now.`,saveError:`Unable to save the project memory right now.`,noExistingDecision:`No existing decision is available for this suggestion.`,noExistingMemory:`No existing memory is available for this suggestion.`,onlyDecisionSuggestionsCanUpdate:`Only decision suggestions can update an existing memory.`,saveSuggestionError:`Unable to save the memory suggestion right now.`,dismissSuggestionError:`Unable to dismiss the memory suggestion right now.`,archiveConventionError:`Unable to archive the project convention right now.`,restoreConventionError:`Unable to restore the project convention right now.`,archiveDecisionError:`Unable to archive the project decision right now.`,supersedeDecisionError:`Unable to supersede the project decision right now.`,restoreDecisionError:`Unable to restore the project decision right now.`,confirmConflicts:`This action creates conflicts with active project memory. Continue anyway?`,scanStarted:`Project context scan started.`,scanConflict:`A project context scan is already active for this project.`,scanStartError:`Unable to start the project context scan right now.`,exportSuccess:`Project memory exported.`,exportError:`Unable to export project memory right now.`,importSuccess:`Project memory imported.`,importError:`Unable to import project memory right now.`},validation:{titleRequired:`Enter a title.`,contentRequired:`Enter memory content.`,implications:{count:`Enter no more than {{implications}} implications.`,item:`Each implication must be {{implication}} characters or fewer.`}},transfer:{title:`Memory transfer`,description:`Export or import one Archon JSON archive for this project's saved conventions, decisions, and generated scan history.`,createProjectFirst:`Create the project first to export or import a memory archive.`,exporting:`Exporting...`,export:`Export`,importing:`Importing...`,import:`Import`,importAriaLabel:`Import project memory JSON`,importedConventions:`Imported {{imported}} conventions, skipped {{skipped}}`,importedDecisions:`Imported {{imported}} decisions, skipped {{skipped}}`,importedScans:`Imported {{imported}} scans, skipped {{skipped}}`,importedArtifacts:`Imported {{imported}} artifacts, skipped {{skipped}}`},archive:{scanning:`Scanning`,scanNow:`Scan now`,disabledNote:`Enable project memory to manage conventions, accepted decisions, and prompt context for this project.`,createNote:`Create the project first, then reopen settings to add conventions and decisions.`,saveFirstNote:`Save these settings to enable project memory, then reopen settings to manage conventions, accepted decisions, and manual scans.`,generatedContext:`Generated context`,scanArchive:`Scan archive`,loadingLatestScanStatus:`Loading latest scan status...`,noScanYet:`No scan yet. Run a manual scan when you want Archon to capture compact project context from the repository.`,stale:`Stale`,staleWarning:`The repository HEAD has changed since the latest successful scan. Generated context may be outdated.`,scanArtifactsCount:`Scan artifacts ({{count}})`,updating:`Updating`,noScanArtifactsYet:`No scan artifacts yet.`,memoryLabel:`Memory`,memoriesTitle:`Memories`,summaryMemories:`Memories`,summarySuggested:`Suggested`,summarySaved:`Saved`,suggestedMemoriesTitle:`Suggested memories`,itemsCount_one:`{{count}} item`,itemsCount_other:`{{count}} items`,stageCount_one:`{{count}} stage`,stageCount_other:`{{count}} stages`,loadingSuggestedMemories:`Loading suggested memories...`,noSuggestedMemories:`No suggested memories right now.`,savedMemoriesTitle:`Saved memories`,showArchivedAriaLabel:`Show archived memories`,showArchivedLabel:`Show archived`,newMemory:`New memory`,loadingSavedMemories:`Loading saved memories...`,openMemoryAriaLabel:`Open {{kind}} {{title}}`,noSavedMemories:`No saved memories yet.`,editMemory:`Edit memory`,createMemory:`Create memory`,editorDescription:`Keep the memory concise and durable — it should stand on its own.`,saveMemory:`Save memory`,archive:`Archive`,restore:`Restore`,supersede:`Supersede`,replacementDecision:`Replacement decision`,selectReplacementDecision:`Select an accepted decision`,scanArchiveDialogTitle:`Scan archive`,scanArchiveDialogDescription:`Read-only generated context.`},workspace:{title:`Memory archive`,selectProject:`Select a project to view memory.`,description:`Review suggestions, manage accepted guidance, and inspect generated repository context.`,retry:`Retry`,tabs:{inbox:`Inbox`,accepted:`Accepted memory`,context:`Generated context`},sources:{ticket:`Ticket suggestions`,chat:`Chat suggestions`,spec:`Spec suggestions`,unavailable:`Unavailable source`},search:`Search`,searchPlaceholder:`Search title, content, scope, or rationale`,clearFilters:`Clear filters`,resultCount:`Showing {{filtered}} of {{total}} memories`,noFilterResults:`No memories match these filters.`,archiveUndoMessage:`Memory archived.`,undo:`Undo`,dirtyCloseTitle:`Discard unsaved changes?`,dirtyCloseDescription:`Your edits have not been saved. You can keep editing or discard them.`,keepEditing:`Keep editing`,discardChanges:`Discard changes`,supersedeTitle:`Supersede this decision?`,supersedeDescription:`Replace “{{current}}” with “{{replacement}}”. The original decision remains available as superseded memory.`,status:{saved:`Memory saved.`,archived:`Memory archived.`,restored:`Memory restored.`,superseded:`Decision superseded.`,scanStarted:`Project context scan started.`},filters:{kind:`Kind`,status:`Status`,stage:`Stage`,source:`Source`,injection:`Injection mode`,sort:`Sort by`},options:{all:`All`,decision:`Decisions`,convention:`Conventions`,active:`Active`,archived:`Archived`,superseded:`Superseded`,plan:`Plan`,build:`Build`,review:`Review`,follow_up:`Follow-up`,plan_follow_up:`Plan follow-up`,chat:`Chat`,manual:`Manual`,ticket:`Ticket`,spec:`Spec`,always:`Always include`,relevant:`Only when relevant`,updated:`Recently updated`,title:`Title`,kind:`Kind`,priority:`Priority`}},activity:{recentUsage:`Recent run usage`,noUsage:`No recorded usage yet.`,history:`Update history`,noHistory:`No history recorded yet.`,loadError:`Unable to load memory activity.`,runMemory:`Memory used for this run`,runMemoryDescription:`Read-only snapshot of the exact project memory supplied to this agent run.`,revision:`Revision`,stage:`Stage`,characters:`characters`,scan:`Generated-context scan`,generatedWarnings:`Warnings supplied to this run`,generatedAreas:`Relevant generated areas`,always:`Always included`,relevant:`Selected for relevance`,why:`Why this memory?`,omitted:`Omitted memory`,conflicts:`Conflicts`,events:{created:`Created`,updated:`Updated`,archived:`Archived`,restored:`Restored`,superseded:`Superseded`,suggestion_applied:`Suggestion applied`}},activation:{title:`Enable project memory`,description:`Memory stays in Archon, not in the target repository. When disabled, Archon preserves saved items but stops injecting them into prompts.`,ariaLabel:`Enable project memory`}},basics:{cardTitle:`Project details`,cardDescription:`Start with the repo Archon should use for new worktrees.`,requiredBadge:`Required`,fields:{projectName:{label:`Project name`,description:`Shown in the project switcher.`,ariaLabel:`Project name`,placeholder:`Platform API`},repositoryPath:{label:`Repository path`,defaultDescription:`Select a git repository.`,ariaLabel:`Repository path`,placeholder:`/Users/you/code/platform-api`,browse:`Browse`,opening:`Opening...`}},repoPathStatus:{checking:{ariaLabel:`Repository path status: checking`,title:`Checking repository path`},valid:{ariaLabel:`Repository path status: valid`,title:`Valid git repository path`},initializable:{ariaLabel:`Repository path status: initializable`},invalid:{ariaLabel:`Repository path status: invalid`}}}}}},Ab=Object.keys(kb.en),jb=ye;jb.use(Re).init({resources:kb,lng:`en`,fallbackLng:`en`,defaultNS:Ob,ns:Ab,supportedLngs:[`en`],interpolation:{escapeValue:!1},initAsync:!1,returnNull:!1,react:{useSuspense:!1}});var Mb=e=>Y(q(`/execution-environments/diagnostics`),{signal:e,fallbackErrorMessage:jb.t(`common:executionRuntimes.errorMessage`)}),Nb=(e,t)=>Y(q(`/projects/${encodeURIComponent(e)}/execution-environments`),{signal:t,fallbackErrorMessage:jb.t(`projects:execution.loadError`)}),Pb=(e,t)=>Y(q(`/projects/${encodeURIComponent(e)}/execution-profile`),{signal:t,fallbackErrorMessage:jb.t(`projects:execution.profile.loadError`)}),Fb=(e,t,n,r)=>Y(q(`/projects/${encodeURIComponent(e)}/execution-profile`),{method:`PUT`,body:{profile:t,expected_active_revision_id:n},signal:r,fallbackErrorMessage:jb.t(`projects:execution.profile.saveError`)}),Ib=(e,t,n,r=null,i=null,a)=>Y(q(t?`/projects/${encodeURIComponent(e)}/execution-environments/${encodeURIComponent(t)}/validate`:`/projects/${encodeURIComponent(e)}/execution-environments/validate`),{method:`POST`,body:{agent:n,...r?{provider:r}:{},...i?{model:i}:{}},signal:a,fallbackErrorMessage:jb.t(`projects:execution.validation.error`)}),Lb=(e,t,n)=>Y(q(`/projects/${encodeURIComponent(e)}/execution-environments/${encodeURIComponent(t)}/reset`),{method:`POST`,signal:n,fallbackErrorMessage:jb.t(`projects:execution.reset.error`)}),Rb=(e,t,n,r,i)=>Y(q(`/projects/${encodeURIComponent(e)}/execution-environments/${encodeURIComponent(t)}/${n}`),{method:`POST`,signal:i,fallbackErrorMessage:r}),zb=(e,t,n)=>Rb(e,t,`stop`,jb.t(`projects:execution.stop.error`),n),Bb=(e,t,n)=>Rb(e,t,`retire`,jb.t(`projects:execution.retire.error`),n),Vb=(e,t,n)=>Rb(e,t,`cleanup-retry`,jb.t(`projects:execution.cleanupRetry.error`),n),Hb=({className:e})=>(0,X.jsx)(_te,{"aria-hidden":`true`,className:e}),Ub=({className:e})=>(0,X.jsx)(zg,{"aria-hidden":`true`,className:e}),Wb=new Set([`cli`,`version`,`platform`,`virtualization`,`daemon`,`docker_login`]),Gb=(e,t)=>{if(t)return`error`;if(!e)return`loading`;if(e.observations.some(e=>Wb.has(e.code)&&e.state===`unsupported`))return`unsupported`;let n=e.activation?.state??`blocked`;return n===`blocked`?`setupRequired`:n===`eligible`?`eligible`:e.observations.some(e=>Wb.has(e.code)&&e.state===`unknown`)?`degraded`:`ready`},Kb=({observation:e})=>{let{t}=K(`common`,{keyPrefix:`executionRuntimes`}),n=e.state===`unknown`&&e.code.endsWith(`_template`),r=n?null:e.code===`virtualization`&&e.remediation?t(`virtualizationRemediation.${e.state}`,{defaultValue:e.remediation}):e.remediation,i=t(n?`observationState.deferred`:`observationState.${e.state}`),a=n?t(`deferredSummary.${e.code}`):e.summary;return(0,X.jsxs)(`div`,{className:`grid gap-2 border-b border-border/60 py-3 last:border-0 sm:grid-cols-[11rem_minmax(0,1fr)]`,children:[(0,X.jsx)(`dt`,{className:`text-xs font-medium text-muted-foreground`,children:t(`checks.${e.code}`)}),(0,X.jsxs)(`dd`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:i}),(0,X.jsx)(`p`,{className:`mt-0.5 break-words text-xs text-muted-foreground`,children:a}),r&&(0,X.jsx)(`p`,{className:`mt-1 break-words text-xs text-amber-200`,children:r})]})]})},qb=({status:e})=>{let{t}=K(`common`,{keyPrefix:`executionRuntimes`});return(0,X.jsx)(`span`,{className:`rounded-full border px-3 py-1 text-xs font-medium ${e===`recommended`?`border-emerald-400/25 bg-emerald-500/10 text-emerald-100`:e===`deprecated`?`border-amber-400/25 bg-amber-500/10 text-amber-100`:`border-red-400/25 bg-red-500/10 text-red-100`}`,children:t(`releaseStatus.${e}`)})},Jb=({onClose:e})=>{let{t}=K(`common`,{keyPrefix:`executionRuntimes`}),[n,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(null),[o,s]=(0,p.useState)(!1),c=(0,p.useCallback)(e=>(s(!0),a(null),Mb(e).then(r).catch(e=>{Ye(e)||a(t(`errorMessage`))}).finally(()=>{e?.aborted||s(!1)})),[t]);(0,p.useEffect)(()=>{let e=new AbortController;return c(e.signal),()=>e.abort()},[c]);let l=Gb(n,i),u=n?.observations.find(e=>e.code===`cli`)??null,d=!!(n&&u?.state===`not_ready`&&n.observations.filter(e=>e.code!==`cli`).every(e=>e.state===`unknown`));return(0,X.jsx)(S_,{open:!0,onOpenChange:t=>{t||e()},children:(0,X.jsxs)(w_,{showCloseButton:!1,className:`flex max-h-[min(48rem,calc(100vh-2rem))] flex-col gap-0 overflow-hidden rounded-3xl p-0 sm:max-w-4xl`,children:[(0,X.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-border/70 px-5 py-5 sm:px-6`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,X.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-sky-400/20 bg-sky-500/10 text-sky-200`,children:(0,X.jsx)(Uy,{className:`h-5 w-5`})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(D_,{className:`text-xl font-semibold`,children:t(`title`)}),(0,X.jsx)(O_,{className:`mt-1`,children:t(`description`)})]})]}),(0,X.jsx)(C_,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":t(`closeAriaLabel`),children:(0,X.jsx)(Ub,{className:`h-4 w-4`})})})]}),(0,X.jsx)(`div`,{className:`min-h-0 overflow-y-auto p-5 sm:p-6`,children:(0,X.jsxs)(`section`,{className:`rounded-2xl border border-border/70 bg-background/35 p-4 sm:p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.2em] text-muted-foreground`,children:t(`provider`)}),(0,X.jsx)(`h2`,{className:`mt-1 text-lg font-semibold text-foreground`,children:t(`dockerSandbox`)}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:t(`state.${l}`)})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?.releaseStatus&&(0,X.jsx)(qb,{status:n.releaseStatus}),(0,X.jsx)(`span`,{className:`rounded-full border border-border/70 bg-card px-3 py-1 text-xs font-medium text-foreground`,children:n?.providerVersion?t(`version`,{version:n.providerVersion}):t(`versionUnknown`)})]})]}),i&&(0,X.jsx)(`p`,{className:`mt-4 rounded-xl border border-red-400/25 bg-red-500/10 p-3 text-sm text-red-200`,role:`alert`,children:i}),n&&d&&u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dl`,{className:`mt-4`,children:(0,X.jsx)(Kb,{observation:u})}),(0,X.jsx)(`p`,{className:`mt-3 rounded-xl border border-border/70 bg-background/35 p-3 text-xs text-muted-foreground`,children:t(`unavailableSummary`)})]}),n&&!d&&(0,X.jsx)(`dl`,{className:`mt-4`,children:n.observations.map(e=>(0,X.jsx)(Kb,{observation:e},e.code))}),n?.releaseStatus===`deprecated`&&(0,X.jsx)(`p`,{className:`mt-3 rounded-xl border border-amber-400/25 bg-amber-500/10 p-3 text-xs text-amber-100`,children:t(`deprecatedReleaseNotice`,{version:n.recommendedVersion})}),n?.releaseStatus===`security_blocked`&&(0,X.jsx)(`p`,{className:`mt-3 rounded-xl border border-red-400/25 bg-red-500/10 p-3 text-xs text-red-100`,role:`alert`,children:t(`securityBlockedReleaseNotice`,{version:n.recommendedVersion})}),!n&&!i&&(0,X.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,role:`status`,children:t(`loading`)}),(0,X.jsxs)(`div`,{className:`mt-5 rounded-xl border border-amber-400/20 bg-amber-500/8 p-3 text-sm text-amber-100`,children:[(0,X.jsx)(`p`,{children:t(`guidance`)}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-amber-100/75`,children:t(`productionNotice`)})]}),(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,X.jsx)(Q,{asChild:!0,variant:`outline`,children:(0,X.jsx)(`a`,{href:`https://docs.docker.com/ai/sandboxes/`,target:`_blank`,rel:`noreferrer`,children:t(`openGuide`)})}),(0,X.jsxs)(Q,{type:`button`,onClick:()=>void c(),disabled:o,children:[(0,X.jsx)(Hb,{className:`h-4 w-4 ${o?`animate-spin`:``}`}),t(o?`rechecking`:`recheck`)]})]})]})})]})})},Yb=`border-sky-500/30 bg-sky-500/15 text-sky-100`,Xb=`[--normal-bg:var(--info-bg)] [--normal-border:var(--info-border)] [--normal-text:var(--info-text)]`,Zb=()=>(0,X.jsx)(sne,{closeButton:!0,expand:!0,theme:`dark`,position:`top-left`,richColors:!0,toastOptions:{classNames:{toast:`border border-border bg-card text-card-foreground shadow-2xl shadow-black/35`,title:`text-sm font-medium text-card-foreground`,description:`text-xs text-muted-foreground`,closeButton:`border border-border bg-secondary text-secondary-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,error:`border-red-500/30 bg-destructive/20 text-red-100`,success:`border-emerald-500/30 bg-emerald-500/15 text-emerald-100`,warning:`border-amber-500/30 bg-amber-500/15 text-amber-100`,info:Yb,loading:Xb}}}),Qb=300,$b=(e,t={})=>{let n=t.dedupeMs??Qb,r=0,i=()=>{if(document.visibilityState!==`visible`)return;let t=Date.now();t-r<n||(r=t,e())};return window.addEventListener(`focus`,i),document.addEventListener(`visibilitychange`,i),()=>{window.removeEventListener(`focus`,i),document.removeEventListener(`visibilitychange`,i)}},ex=6e4,tx=(e,t)=>{let[n,r]=(0,p.useState)(0),[i,a]=(0,p.useState)({jira:0,github:0}),[o,s]=(0,p.useState)(!1),[c,l]=(0,p.useState)(null),[u,d]=(0,p.useState)(0),f=(0,p.useRef)(0),m=(0,p.useCallback)(()=>{d(e=>e+1)},[]);return(0,p.useEffect)(()=>{if(!e||!t){r(0),a({jira:0,github:0}),l(null),s(!1);return}let n=new AbortController,i=f.current+1;f.current=i;let o=async()=>{s(!0);try{let t=await mt(e,n.signal);if(n.signal.aborted||i!==f.current)return;r(t.count),a(t.providers),l(t.error)}catch(e){if(Ye(e)||i!==f.current)return;l(e instanceof Error?e.message:`Unable to load assigned issues right now.`)}finally{!n.signal.aborted&&i===f.current&&s(!1)}};o();let c=window.setInterval(()=>{o()},ex),u=$b(()=>{o()});return()=>{n.abort(),window.clearInterval(c),u()}},[e,t,u]),{count:n,providers:i,loading:o,error:c,refresh:m}},nx=new Set,rx=new Map,ix=(e,t)=>{rx.set(e,t),nx.forEach(n=>n(e,t))},ax=e=>rx.has(e),ox=e=>{let[t,n]=(0,p.useState)(()=>e?rx.get(e)??[]:[]);return(0,p.useEffect)(()=>{if(!e){n([]);return}n(rx.get(e)??[]);let t=(t,r)=>{t===e&&n(r)};return nx.add(t),()=>{nx.delete(t)}},[e]),t},sx=Object.create(null);sx.open=`0`,sx.close=`1`,sx.ping=`2`,sx.pong=`3`,sx.message=`4`,sx.upgrade=`5`,sx.noop=`6`;var cx=Object.create(null);Object.keys(sx).forEach(e=>{cx[sx[e]]=e});var lx={type:`error`,data:`parser error`},ux=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,dx=typeof ArrayBuffer==`function`,fx=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,px=({type:e,data:t},n,r)=>ux&&t instanceof Blob?n?r(t):mx(t,r):dx&&(t instanceof ArrayBuffer||fx(t))?n?r(t):mx(new Blob([t]),r):r(sx[e]+(t||``)),mx=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function hx(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var gx;function _x(e,t){if(ux&&e.data instanceof Blob)return e.data.arrayBuffer().then(hx).then(t);if(dx&&(e.data instanceof ArrayBuffer||fx(e.data)))return t(hx(e.data));px(e,!1,e=>{gx||=new TextEncoder,t(gx.encode(e))})}var vx=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,yx=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)yx[vx.charCodeAt(e)]=e;var bx=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=yx[e.charCodeAt(r)],o=yx[e.charCodeAt(r+1)],s=yx[e.charCodeAt(r+2)],c=yx[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},xx=typeof ArrayBuffer==`function`,Sx=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:wx(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:Cx(e.substring(1),t)}:cx[n]?e.length>1?{type:cx[n],data:e.substring(1)}:{type:cx[n]}:lx},Cx=(e,t)=>xx?wx(bx(e),t):{base64:!0,data:e},wx=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},Tx=``,Ex=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{px(e,!1,e=>{r[a]=e,++i===n&&t(r.join(Tx))})})},Dx=(e,t)=>{let n=e.split(Tx),r=[];for(let e=0;e<n.length;e++){let i=Sx(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Ox(){return new TransformStream({transform(e,t){_x(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var kx;function Ax(e){return e.reduce((e,t)=>e+t.length,0)}function jx(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Mx(e,t){kx||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(Ax(n)<1)break;let e=jx(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(Ax(n)<2)break;let e=jx(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(Ax(n)<8)break;let e=jx(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(lx);break}i=a*2**32+t.getUint32(4),r=3}else{if(Ax(n)<i)break;let e=jx(n,i);s.enqueue(Sx(a?e:kx.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(lx);break}}}})}function Nx(e){if(e)return Px(e)}function Px(e){for(var t in Nx.prototype)e[t]=Nx.prototype[t];return e}Nx.prototype.on=Nx.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},Nx.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Nx.prototype.off=Nx.prototype.removeListener=Nx.prototype.removeAllListeners=Nx.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},Nx.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},Nx.prototype.emitReserved=Nx.prototype.emit,Nx.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},Nx.prototype.hasListeners=function(e){return!!this.listeners(e).length};var Fx=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Ix=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),Lx=`arraybuffer`;function Rx(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var zx=Ix.setTimeout,Bx=Ix.clearTimeout;function Vx(e,t){t.useNativeTimers?(e.setTimeoutFn=zx.bind(Ix),e.clearTimeoutFn=Bx.bind(Ix)):(e.setTimeoutFn=Ix.setTimeout.bind(Ix),e.clearTimeoutFn=Ix.clearTimeout.bind(Ix))}var Hx=1.33;function Ux(e){return typeof e==`string`?Wx(e):Math.ceil((e.byteLength||e.size)*Hx)}function Wx(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function Gx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Kx(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function qx(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var Jx=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},Yx=class extends Nx{constructor(e){super(),this.writable=!1,Vx(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new Jx(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=Sx(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=Kx(e);return t.length?`?`+t:``}},Xx=class extends Yx{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){Dx(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,Ex(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=Gx()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},Zx=!1;try{Zx=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var Qx=Zx;function $x(){}var eS=class extends Xx{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},tS=class e extends Nx{constructor(e,t,n){super(),this.createRequest=e,Vx(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=Rx(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=$x,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(tS.requestsCount=0,tS.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,nS);else if(typeof addEventListener==`function`){let e=`onpagehide`in Ix?`pagehide`:`unload`;addEventListener(e,nS,!1)}}function nS(){for(let e in tS.requests)tS.requests.hasOwnProperty(e)&&tS.requests[e].abort()}var rS=(function(){let e=aS({xdomain:!1});return e&&e.responseType!==null})(),iS=class extends eS{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=rS&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new tS(aS,this.uri(),e)}};function aS(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||Qx))return new XMLHttpRequest}catch{}if(!t)try{return new Ix[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var oS=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,sS=class extends Yx{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=oS?{}:Rx(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;px(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&Fx(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Gx()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},cS=Ix.WebSocket||Ix.MozWebSocket,lS={websocket:class extends sS{createSocket(e,t,n){return oS?new cS(e,t,n):t?new cS(e,t):new cS(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends Yx{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Mx(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Ox();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&Fx(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:iS},uS=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,dS=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function fS(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=uS.exec(e||``),a={},o=14;for(;o--;)a[dS[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=pS(a,a.path),a.queryKey=mS(a,a.query),a}function pS(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function mS(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var hS=typeof addEventListener==`function`&&typeof removeEventListener==`function`,gS=[];hS&&addEventListener(`offline`,()=>{gS.forEach(e=>e())},!1);var _S=class e extends Nx{constructor(e,t){if(super(),this.binaryType=Lx,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=fS(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=fS(t.host).host);Vx(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=qx(this.opts.query)),hS&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},gS.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=Ux(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Fx(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),hS&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=gS.indexOf(this._offlineEventListener);e!==-1&&gS.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};_S.protocol=4;var vS=class extends _S{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;_S.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;_S.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},yS=class extends vS{constructor(e,t={}){let n=typeof e==`object`?e:t;(!n.transports||n.transports&&typeof n.transports[0]==`string`)&&(n.transports=(n.transports||[`polling`,`websocket`,`webtransport`]).map(e=>lS[e]).filter(e=>!!e)),super(e,n)}};yS.protocol;function bS(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=fS(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var xS=typeof ArrayBuffer==`function`,SS=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,CS=Object.prototype.toString,wS=typeof Blob==`function`||typeof Blob<`u`&&CS.call(Blob)===`[object BlobConstructor]`,TS=typeof File==`function`||typeof File<`u`&&CS.call(File)===`[object FileConstructor]`;function ES(e){return xS&&(e instanceof ArrayBuffer||SS(e))||wS&&e instanceof Blob||TS&&e instanceof File}function DS(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(DS(e[t]))return!0;return!1}if(ES(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return DS(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&DS(e[t]))return!0;return!1}function OS(e){let t=[],n=e.data,r=e;return r.data=kS(n,t),r.attachments=t.length,{packet:r,buffers:t}}function kS(e,t){if(!e)return e;if(ES(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=kS(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=kS(e[r],t));return n}return e}function AS(e,t){return e.data=jS(e.data,t),delete e.attachments,e}function jS(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=jS(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=jS(e[n],t));return e}var MS=r({Decoder:()=>IS,Encoder:()=>FS,PacketType:()=>PS,isPacketValid:()=>US,protocol:()=>5}),NS=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],PS;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(PS||={});var FS=class{constructor(e){this.replacer=e}encode(e){return(e.type===PS.EVENT||e.type===PS.ACK)&&DS(e)?this.encodeAsBinary({type:e.type===PS.EVENT?PS.BINARY_EVENT:PS.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===PS.BINARY_EVENT||e.type===PS.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=OS(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},IS=class e extends Nx{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===PS.BINARY_EVENT;n||t.type===PS.BINARY_ACK?(t.type=n?PS.EVENT:PS.ACK,this.reconstructor=new LS(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(ES(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(PS[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===PS.BINARY_EVENT||r.type===PS.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!zS(a)||a<0)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case PS.CONNECT:return VS(t);case PS.DISCONNECT:return t===void 0;case PS.CONNECT_ERROR:return typeof t==`string`||VS(t);case PS.EVENT:case PS.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&NS.indexOf(t[0])===-1);case PS.ACK:case PS.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},LS=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=AS(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function RS(e){return typeof e==`string`}var zS=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function BS(e){return e===void 0||zS(e)}function VS(e){return Object.prototype.toString.call(e)===`[object Object]`}function HS(e,t){switch(e){case PS.CONNECT:return t===void 0||VS(t);case PS.DISCONNECT:return t===void 0;case PS.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&NS.indexOf(t[0])===-1);case PS.ACK:return Array.isArray(t);case PS.CONNECT_ERROR:return typeof t==`string`||VS(t);default:return!1}}function US(e){return RS(e.nsp)&&BS(e.id)&&HS(e.type,e.data)}function WS(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var GS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),KS=class extends Nx{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[WS(e,`open`,this.onopen.bind(this)),WS(e,`packet`,this.onpacket.bind(this)),WS(e,`error`,this.onerror.bind(this)),WS(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(GS.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:PS.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:PS.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case PS.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case PS.EVENT:case PS.BINARY_EVENT:this.onevent(e);break;case PS.ACK:case PS.BINARY_ACK:this.onack(e);break;case PS.DISCONNECT:this.ondisconnect();break;case PS.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:PS.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PS.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function qS(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}qS.prototype.duration=function(){var e=this.ms*this.factor**+ this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},qS.prototype.reset=function(){this.attempts=0},qS.prototype.setMin=function(e){this.ms=e},qS.prototype.setMax=function(e){this.max=e},qS.prototype.setJitter=function(e){this.jitter=e};var JS=class extends Nx{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,Vx(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new qS({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||MS;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new yS(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=WS(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=WS(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(WS(e,`ping`,this.onping.bind(this)),WS(e,`data`,this.ondata.bind(this)),WS(e,`error`,this.onerror.bind(this)),WS(e,`close`,this.onclose.bind(this)),WS(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){Fx(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new KS(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},YS={};function XS(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=bS(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=YS[i]&&a in YS[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new JS(r,t):(YS[i]||(YS[i]=new JS(r,t)),c=YS[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(XS,{Manager:JS,Socket:KS,io:XS,connect:XS});var ZS=((e=Ge)=>XS(e))(),QS=({className:e})=>(0,X.jsx)(Qee,{"aria-hidden":`true`,className:e}),$S=({className:e})=>(0,X.jsx)(Wee,{"aria-hidden":`true`,className:e}),eC=({className:e})=>(0,X.jsx)(yte,{"aria-hidden":`true`,className:e}),tC=e=>{let t=e.external_source;if(t.provider===`github`){let e=t.metadata?.issue_number;if(typeof e==`number`||typeof e==`string`&&e.trim()!==``)return`#${e}`;let n=t.external_key.lastIndexOf(`#`);return n>=0&&n<t.external_key.length-1?`#${t.external_key.slice(n+1)}`:t.external_key}return t.external_key},nC=({draft:e,onCreateTicket:t,onStartSpec:n})=>{let{t:r}=K(`common`),i=e.external_source.provider,a=r(i===`jira`?`assignedIssuesInbox.providerJira`:`assignedIssuesInbox.providerGithub`),o=r(i===`jira`?`assignedIssuesInbox.viewJira`:`assignedIssuesInbox.viewGithub`),s=tC(e);return(0,X.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-border/50 p-3 last:border-b-0`,children:[(0,X.jsx)(`span`,{className:`shrink-0 self-start rounded bg-ticket-link/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-ticket-link`,children:a}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:s}),(0,X.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e.title||s})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:()=>t(e),children:r(`assignedIssuesInbox.createTicket`)}),(0,X.jsxs)(Q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 gap-1 text-xs`,onClick:()=>n(e),children:[(0,X.jsx)(eC,{className:`h-3 w-3`}),r(`assignedIssuesInbox.spec`)]}),e.external_source.external_url&&(0,X.jsxs)(`a`,{href:e.external_source.external_url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent/20 hover:text-foreground`,children:[(0,X.jsx)($S,{className:`h-3 w-3`}),o]})]})]})},rC=({projectId:e,onStartSpecFromDraft:t,onCreateTicketFromDraft:n})=>{let{t:r}=K(`common`),i=(ox(e)??[]).some(e=>e.status===`connected`),{count:a,refresh:o}=tx(e,i),[s,c]=(0,p.useState)(!1),[l,u]=(0,p.useState)([]),[d,f]=(0,p.useState)(!1),[m,h]=(0,p.useState)(null),g=(0,p.useRef)(null),_=(0,p.useCallback)(async t=>{if(!e)return;g.current?.abort();let n=new AbortController;g.current=n,f(!0);try{let r=await ht(e,n.signal,{force:t});if(n.signal.aborted)return;u(r.drafts),h(r.error),o()}catch(e){if(Ye(e))return;h(e instanceof Error?e.message:r(`assignedIssuesInbox.errorState`))}finally{n.signal.aborted||f(!1)}},[e,r,o]);(0,p.useEffect)(()=>(s&&e&&_(!1),()=>{g.current?.abort()}),[s,e,_]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{t.project_id===e&&o()};return ZS.on(`ticket:created`,t),()=>{ZS.off(`ticket:created`,t)}},[e,o]);let v=(0,p.useCallback)(e=>{n(e),c(!1)},[n]),y=(0,p.useCallback)(e=>{t?.(e),c(!1)},[t]),b=(0,p.useCallback)(()=>{_(!0),o()},[_,o]);return!e||!i?null:(0,X.jsxs)(B_,{open:s,onOpenChange:c,children:[(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,variant:`ghost`,"aria-label":r(`assignedIssuesInbox.buttonAriaLabel`),className:`relative h-8 rounded-xl border border-border/70 px-3 text-sm font-medium hover:bg-accent/20`,children:[(0,X.jsx)(QS,{className:`h-4 w-4`}),a>0&&(0,X.jsx)(`span`,{"aria-label":r(`assignedIssuesInbox.badgeAriaLabel`,{count:a}),className:`absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground ring-2 ring-background`,children:a>99?`99+`:a})]})}),(0,X.jsxs)(H_,{align:`end`,className:`w-[min(28rem,calc(100vw-2rem))] p-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-3 py-2`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:r(`assignedIssuesInbox.title`)}),(0,X.jsx)(Q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs`,onClick:b,disabled:d,children:r(`assignedIssuesInbox.refresh`)})]}),(0,X.jsx)(`div`,{className:`max-h-[24rem] overflow-y-auto`,children:d&&l.length===0?(0,X.jsx)(`div`,{className:`p-4 text-center text-sm text-muted-foreground`,children:`Loading...`}):m&&l.length===0?(0,X.jsx)(`div`,{className:`p-4 text-center text-sm text-rose-400`,children:m}):l.length===0?(0,X.jsx)(`div`,{className:`p-4 text-center text-sm text-muted-foreground`,children:r(`assignedIssuesInbox.emptyState`)}):(0,X.jsx)(`ul`,{children:l.map(e=>(0,X.jsx)(nC,{draft:e,onCreateTicket:v,onStartSpec:y},`${e.external_source.provider}:${e.external_source.external_key}`))})})]})]})},iC=[],aC=!1,oC=()=>{if(!(typeof window>`u`)){if(iC.length===0){aC&&=(window.removeEventListener(`keydown`,sC),!1);return}aC||=(window.addEventListener(`keydown`,sC),!0)}},sC=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=iC[iC.length-1];t&&t.onClose()},cC=(e,t={})=>{let{disabled:n=!1}=t,r=(0,p.useRef)(e);(0,p.useEffect)(()=>{r.current=e},[e]),(0,p.useEffect)(()=>{if(n)return;let e={id:Symbol(`escape-close`),onClose:()=>r.current()};return iC.push(e),oC(),()=>{let t=iC.findIndex(t=>t.id===e.id);t!==-1&&iC.splice(t,1),oC()}},[n])},lC=(...e)=>e.filter(Boolean).join(` `),uC=({children:e,onClose:t,overlayClassName:n,panelClassName:r,closeButtonClassName:i,closeButtonLabel:a=`Close modal`,renderContent:o})=>{cC(t);let s=(0,X.jsx)(Q,{type:`button`,"aria-label":a,variant:`ghost`,size:`icon-sm`,onClick:t,className:lC(`cursor-pointer text-muted-foreground hover:text-foreground`,i),children:(0,X.jsx)(Ub,{className:`h-4 w-4`})});return(0,X.jsx)(`div`,{className:lC(`fixed inset-0 z-50 flex items-center justify-center`,n),children:(0,X.jsx)(`div`,{className:lC(`relative flex flex-col`,r),role:`dialog`,"aria-modal":`true`,onClick:e=>e.stopPropagation(),children:o?o({closeButton:s}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:s}),e]})})})},dC=({title:e,description:t,confirmLabel:n,cancelLabel:r,confirmVariant:i=`default`,onConfirm:a,onCancel:o})=>(0,X.jsxs)(uC,{onClose:o,overlayClassName:`bg-black/70`,panelClassName:`max-w-md rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,X.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:e}),(0,X.jsx)(`p`,{className:`mb-6 text-sm text-foreground whitespace-pre-line`,children:t}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(Q,{type:`button`,variant:`ghost`,onClick:o,children:r}),(0,X.jsx)(Q,{type:`button`,variant:i,onClick:a,children:n})]})]}),fC=({onSelect:e})=>{let{t}=K(`common`);return(0,X.jsxs)(uC,{onClose:()=>e(null),overlayClassName:`bg-black/70`,panelClassName:`max-w-lg rounded-2xl border border-amber-500/30 bg-card p-6 shadow-2xl`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:t(`sandboxPreviewRunDialog.title`)}),(0,X.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:t(`sandboxPreviewRunDialog.description`)}),(0,X.jsx)(`div`,{className:`mt-4 rounded-lg border border-amber-500/25 bg-amber-500/10 p-3 text-sm leading-5 text-amber-100`,children:t(`sandboxPreviewRunDialog.hostWarning`)}),(0,X.jsxs)(`div`,{className:`mt-6 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,children:[(0,X.jsx)(Q,{type:`button`,variant:`ghost`,onClick:()=>e(null),children:t(`sandboxPreviewRunDialog.cancel`)}),(0,X.jsx)(Q,{type:`button`,variant:`secondary`,onClick:()=>e(`project_default`),children:t(`sandboxPreviewRunDialog.runInSandbox`)}),(0,X.jsx)(Q,{type:`button`,onClick:()=>e(`host`),children:t(`sandboxPreviewRunDialog.runOnHost`)})]})]})},pC=({isSubmitting:e,onCreateInitialCommit:t})=>(0,X.jsx)(`div`,{className:`mx-6 mt-4 mb-4 w-fit max-w-[calc(100%-3rem)] rounded-2xl border border-amber-500/35 bg-amber-500/10 px-4 py-3 text-sm text-amber-100`,role:`alert`,children:(0,X.jsxs)(`div`,{className:`flex flex-col items-start gap-4 lg:flex-row lg:items-center`,children:[(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:`This repository needs an initial commit before Archon can prepare bundle worktrees.`}),(0,X.jsx)(`p`,{className:`text-xs leading-5 text-amber-100/90`,children:`Repo root chat still works. Create an initial commit to unblock bundle worktrees.`})]}),(0,X.jsx)(Q,{type:`button`,variant:`warning`,className:`shrink-0`,disabled:e,onClick:t,children:e?`Creating initial commit...`:`Create initial commit`})]})}),mC=Xr(`inline-flex w-fit shrink-0 items-center justify-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium whitespace-nowrap transition-colors [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`border-primary/30 bg-primary/15 text-primary-foreground`,secondary:`border-border bg-secondary text-secondary-foreground`,destructive:`border-red-500/25 bg-destructive/15 text-red-200`,success:`border-emerald-500/25 bg-emerald-500/12 text-emerald-200`,warning:`border-amber-500/25 bg-amber-500/12 text-amber-200`,info:`border-sky-500/25 bg-sky-500/12 text-sky-200`,outline:`border-border bg-card text-muted-foreground`,ghost:`border-transparent bg-transparent text-muted-foreground`,hotkeyDark:`border-black/25 bg-transparent text-[#07130d]/75`,link:`border-transparent px-0 text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}}),hC=({className:e,variant:t=`default`,asChild:n=!1,...r})=>(0,X.jsx)(n?ti:`span`,{"data-slot":`badge`,"data-variant":t,className:Z(mC({variant:t}),e),...r}),gC=(0,p.forwardRef)(({className:e,size:t=`default`,...n},r)=>(0,X.jsx)(`div`,{ref:r,"data-slot":`card`,"data-size":t,className:Z(`flex flex-col gap-5 rounded-2xl border border-border/70 bg-card text-sm text-card-foreground shadow-xl shadow-black/10 data-[size=sm]:gap-4`,e),...n}));gC.displayName=`Card`;var _C=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-header`,className:Z(`grid auto-rows-min items-start gap-1.5 px-5 pt-5 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-5 data-[size=sm]:px-4 data-[size=sm]:pt-4`,e),...t}),vC=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-title`,className:Z(`font-heading text-base font-medium`,e),...t}),yC=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-description`,className:Z(`text-sm text-muted-foreground`,e),...t}),bC=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-action`,className:Z(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t}),xC=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-content`,className:Z(`px-5 pb-5 data-[size=sm]:px-4 data-[size=sm]:pb-4`,e),...t}),SC=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-footer`,className:Z(`flex items-center px-5 pb-5 data-[size=sm]:px-4 data-[size=sm]:pb-4 [.border-t]:pt-5`,e),...t}),CC=({label:e,labelTrailing:t,htmlFor:n,description:r,error:i,className:a,children:o})=>(0,X.jsxs)(`div`,{className:Z(`flex flex-col gap-1.5`,a),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium uppercase tracking-[0.22em] text-muted-foreground`,htmlFor:n,children:e}),t]}),o,r&&(0,X.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:r}),i&&(0,X.jsx)(`p`,{className:`text-sm text-red-300`,children:i})]}),wC=({className:e})=>(0,X.jsx)(Lg,{"aria-hidden":`true`,className:e}),TC=(e,t)=>e instanceof Error&&e.message?e.message:t,EC=({bundles:e,selectedBundleId:t,activeTargetBundleId:n=null,onSelectBundle:r,onCreateBundle:i,onDeleteBundle:a,onClose:o})=>{let{t:s}=K(`common`),c=yy(e),[l,u]=(0,p.useState)(``),[d,f]=(0,p.useState)(!1),[m,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),v=async e=>{e.preventDefault();let t=l.trim();if(!(!t||d)){f(!0);try{r((await i(t)).id),o()}catch(e){$.error(TC(e,s(`manageBundlesModal.createError`)),{id:`manage-bundles-error`}),f(!1)}}},y=async e=>{if(!(e.kind===`project_root`||e.ticket_count>0||g)){_(e.id);try{await a(e.id),t===e.id&&r(null),h(null)}catch(e){$.error(TC(e,s(`manageBundlesModal.deleteError`)),{id:`manage-bundles-error`})}finally{_(null)}}};return(0,X.jsx)(uC,{onClose:d?()=>{}:o,overlayClassName:`bg-black/70 px-4 py-8`,panelClassName:`w-full max-w-2xl rounded-3xl border border-[#2a2a38] bg-[#16161f] shadow-2xl`,renderContent:({closeButton:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-5`,children:[(0,X.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:s(`manageBundlesModal.title`)}),d?null:e]}),(0,X.jsxs)(`div`,{className:`flex max-h-[70vh] flex-col gap-6 px-6 py-5`,children:[(0,X.jsxs)(gC,{className:`rounded-3xl border-border bg-card/70 shadow-none`,children:[(0,X.jsx)(_C,{children:(0,X.jsx)(vC,{className:`text-sm font-semibold uppercase tracking-[0.24em] text-foreground`,children:s(`manageBundlesModal.createTitle`)})}),(0,X.jsx)(xC,{children:d?(0,X.jsx)(`div`,{className:`rounded-2xl border border-emerald-500/20 bg-emerald-500/5 px-4 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(`div`,{className:`mt-0.5 rounded-full bg-emerald-500/10 p-2 text-emerald-300`,children:(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`})}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:s(`manageBundlesModal.createPendingTitle`)}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`manageBundlesModal.createPendingDescription`)})]})]})}):(0,X.jsxs)(`form`,{onSubmit:v,className:`flex min-w-0 flex-col gap-4 sm:flex-row sm:items-end`,children:[(0,X.jsx)(CC,{label:s(`manageBundlesModal.bundleNameLabel`),className:`min-w-0 flex-1`,children:(0,X.jsx)(k_,{"aria-label":s(`manageBundlesModal.bundleNameAriaLabel`),type:`text`,value:l,onChange:e=>u(e.target.value),autoFocus:!0,placeholder:s(`manageBundlesModal.bundleNamePlaceholder`)})}),(0,X.jsx)(Q,{type:`submit`,disabled:!l.trim()||d,variant:`success`,size:`lg`,className:`sm:shrink-0`,children:s(`manageBundlesModal.createAction`)})]})})]}),(0,X.jsxs)(gC,{className:`flex min-h-0 flex-1 flex-col rounded-3xl border-border bg-card/70 shadow-none ${d?`opacity-60`:``}`,children:[(0,X.jsx)(_C,{children:(0,X.jsx)(vC,{className:`text-sm font-semibold uppercase tracking-[0.24em] text-foreground`,children:s(`manageBundlesModal.existingTitle`)})}),(0,X.jsx)(xC,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,X.jsx)(`div`,{className:`space-y-3`,children:c.length===0?(0,X.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border px-4 py-5 text-sm text-muted-foreground`,children:s(`manageBundlesModal.empty`)}):c.map(e=>{let r=t===e.id,i=n===e.id,a=e.kind===`project_root`||e.ticket_count>0||i||g!==null,o=m===e.id;return(0,X.jsx)(gC,{size:`sm`,className:`rounded-2xl border-border/80 bg-background/30 shadow-none`,children:(0,X.jsx)(xC,{className:`p-4`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:My(e)}),r&&(0,X.jsx)(hC,{variant:`info`,children:s(`manageBundlesModal.selected`)}),i&&(0,X.jsx)(hC,{variant:`info`,children:s(`manageBundlesModal.currentTarget`)})]}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.kind===`project_root`?s(`manageBundlesModal.projectRootDescription`,{branch:e.branch}):i?s(`manageBundlesModal.switchTargetDescription`):e.ticket_count>0?s(`manageBundlesModal.inUseDescription`,{ticketCount:s(`manageBundlesModal.ticketCount`,{count:e.ticket_count})}):s(`manageBundlesModal.unusedDescription`)})]}),(0,X.jsx)(`div`,{className:`flex items-center gap-2 sm:shrink-0`,children:o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{type:`button`,onClick:()=>h(null),variant:`ghost`,children:s(`manageBundlesModal.cancel`)}),(0,X.jsx)(Q,{type:`button`,onClick:()=>void y(e),disabled:a,variant:`destructive`,children:g===e.id?s(`manageBundlesModal.deleting`):s(`manageBundlesModal.deleteBundle`)})]}):(0,X.jsx)(Q,{type:`button`,onClick:()=>h(e.id),disabled:a,variant:`destructive`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,X.jsx)(wC,{className:`h-3.5 w-3.5`}),s(`manageBundlesModal.delete`)]})})})]})})},e.id)})})})]})]}),(0,X.jsx)(`div`,{className:`border-t border-border px-6 py-4`,children:(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(Q,{type:`button`,onClick:o,disabled:d,variant:`ghost`,children:s(`manageBundlesModal.close`)})})})]})})},DC=i(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),OC=i((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),kC=i((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),AC=i(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),jC=i(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),MC=i((e=>{var t=OC().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),NC=i((e=>{var t=OC().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),PC=i((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),FC=i((e=>{var t=kC(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),kne=i((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Ane=i((e=>{var t=kne();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),jne=i(((e,t)=>{var n=Ane();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),IC=i((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),LC=i((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
58
|
+
fixtures/**`,disclosure:`Selected repository excerpts are sent to the configured model provider. Archon applies best-effort secret redaction, but it cannot guarantee that every secret is detected.`},generatedContext:{disclosure:`Generated context is advisory. Selected repository excerpts are sent to the configured model provider with best-effort secret redaction.`,latestAttempt:`Latest scan attempt`,latestSuccessful:`Latest successful context`,viewDetails:`View scan details`,history:`Scan history`,noHistory:`No historical scans yet.`,loadMore:`Load more`,loadingMore:`Loading...`,historyError:`Unable to load scan history right now.`,detailError:`Unable to load scan details right now.`,detailTitle:`Scan details`,detailDescription:`Repository snapshot metadata, manifest, freshness, and generated artifacts.`,revision:`Revision`,branch:`Branch`,provider:`Provider`,toolModel:`Tool / model`,snapshotTime:`Snapshot finalized`,completionTime:`Artifacts persisted`,origin:`Origin`,unknownProvider:`Unknown provider`,unknown:`Unknown`,origins:{local_scan:`Local scan`,archive_import:`Archive import`},manifest:`Scan manifest`,noManifest:`No manifest is available for this historical scan.`,charactersSent:`{{count}} repository characters sent`,redactions:`{{count}} potential secrets redacted`,sampledPaths:`Sampled paths ({{count}})`,scanRules:`Selection rules`,includes:`Includes`,excludes:`Excludes`,hardExclusions:`Built-in exclusions`,skippedFiles:`Skipped observed files`,repositoryChangedDuringScan:`The repository changed while the model was generating this context.`,truncatedFields:`Oversized generated fields were truncated: {{fields}}`,skipReasons:{hard_excluded:`Built-in exclusion`,user_excluded:`Project exclusion`,not_included:`Outside include rules`,symlink:`Symbolic link`,binary:`Binary file`,unreadable:`Unreadable file`,file_size_limit:`File size limit`,file_count_limit:`File count limit`,directory_limit:`Directory limit`},defaultSelection:`Prioritized default selection`,none:`None`,artifacts:`Generated artifacts`,noSuccessfulContext:`No successful generated context is available yet.`,loadingDetail:`Loading scan details...`,freshness:{title:`Context review recommended`,current:`No freshness warnings detected.`,unavailable:`Some repository freshness comparisons are unavailable.`,branchChanged:`The current branch differs from the scanned branch.`,headChanged:`The current repository revision differs from the scanned revision.`,workingTree:`Current uncommitted content may differ from the sampled snapshot.`,age:`This context is more than 14 days old. Review it before relying on it.`,legacy:`Repository context may have changed since this scan.`}},messages:{loadError:`Unable to load project memory right now.`,refreshContextError:`Unable to refresh project context right now.`,saveError:`Unable to save the project memory right now.`,noExistingDecision:`No existing decision is available for this suggestion.`,noExistingMemory:`No existing memory is available for this suggestion.`,onlyDecisionSuggestionsCanUpdate:`Only decision suggestions can update an existing memory.`,saveSuggestionError:`Unable to save the memory suggestion right now.`,dismissSuggestionError:`Unable to dismiss the memory suggestion right now.`,archiveConventionError:`Unable to archive the project convention right now.`,restoreConventionError:`Unable to restore the project convention right now.`,archiveDecisionError:`Unable to archive the project decision right now.`,supersedeDecisionError:`Unable to supersede the project decision right now.`,restoreDecisionError:`Unable to restore the project decision right now.`,confirmConflicts:`This action creates conflicts with active project memory. Continue anyway?`,scanStarted:`Project context scan started.`,scanConflict:`A project context scan is already active for this project.`,scanStartError:`Unable to start the project context scan right now.`,exportSuccess:`Project memory exported.`,exportError:`Unable to export project memory right now.`,importSuccess:`Project memory imported.`,importError:`Unable to import project memory right now.`},validation:{titleRequired:`Enter a title.`,contentRequired:`Enter memory content.`,implications:{count:`Enter no more than {{implications}} implications.`,item:`Each implication must be {{implication}} characters or fewer.`}},transfer:{title:`Memory transfer`,description:`Export or import one Archon JSON archive for this project's saved conventions, decisions, and generated scan history.`,createProjectFirst:`Create the project first to export or import a memory archive.`,exporting:`Exporting...`,export:`Export`,importing:`Importing...`,import:`Import`,importAriaLabel:`Import project memory JSON`,importedConventions:`Imported {{imported}} conventions, skipped {{skipped}}`,importedDecisions:`Imported {{imported}} decisions, skipped {{skipped}}`,importedScans:`Imported {{imported}} scans, skipped {{skipped}}`,importedArtifacts:`Imported {{imported}} artifacts, skipped {{skipped}}`},archive:{scanning:`Scanning`,scanNow:`Scan now`,disabledNote:`Enable project memory to manage conventions, accepted decisions, and prompt context for this project.`,createNote:`Create the project first, then reopen settings to add conventions and decisions.`,saveFirstNote:`Save these settings to enable project memory, then reopen settings to manage conventions, accepted decisions, and manual scans.`,generatedContext:`Generated context`,scanArchive:`Scan archive`,loadingLatestScanStatus:`Loading latest scan status...`,noScanYet:`No scan yet. Run a manual scan when you want Archon to capture compact project context from the repository.`,stale:`Stale`,staleWarning:`The repository HEAD has changed since the latest successful scan. Generated context may be outdated.`,scanArtifactsCount:`Scan artifacts ({{count}})`,updating:`Updating`,noScanArtifactsYet:`No scan artifacts yet.`,memoryLabel:`Memory`,memoriesTitle:`Memories`,summaryMemories:`Memories`,summarySuggested:`Suggested`,summarySaved:`Saved`,suggestedMemoriesTitle:`Suggested memories`,itemsCount_one:`{{count}} item`,itemsCount_other:`{{count}} items`,stageCount_one:`{{count}} stage`,stageCount_other:`{{count}} stages`,loadingSuggestedMemories:`Loading suggested memories...`,noSuggestedMemories:`No suggested memories right now.`,savedMemoriesTitle:`Saved memories`,showArchivedAriaLabel:`Show archived memories`,showArchivedLabel:`Show archived`,newMemory:`New memory`,loadingSavedMemories:`Loading saved memories...`,openMemoryAriaLabel:`Open {{kind}} {{title}}`,noSavedMemories:`No saved memories yet.`,editMemory:`Edit memory`,createMemory:`Create memory`,editorDescription:`Keep the memory concise and durable — it should stand on its own.`,saveMemory:`Save memory`,archive:`Archive`,restore:`Restore`,supersede:`Supersede`,replacementDecision:`Replacement decision`,selectReplacementDecision:`Select an accepted decision`,scanArchiveDialogTitle:`Scan archive`,scanArchiveDialogDescription:`Read-only generated context.`},workspace:{title:`Memory archive`,selectProject:`Select a project to view memory.`,description:`Review suggestions, manage accepted guidance, and inspect generated repository context.`,retry:`Retry`,tabs:{inbox:`Inbox`,accepted:`Accepted memory`,context:`Generated context`},sources:{ticket:`Ticket suggestions`,chat:`Chat suggestions`,spec:`Spec suggestions`,unavailable:`Unavailable source`},search:`Search`,searchPlaceholder:`Search title, content, scope, or rationale`,clearFilters:`Clear filters`,resultCount:`Showing {{filtered}} of {{total}} memories`,noFilterResults:`No memories match these filters.`,archiveUndoMessage:`Memory archived.`,undo:`Undo`,dirtyCloseTitle:`Discard unsaved changes?`,dirtyCloseDescription:`Your edits have not been saved. You can keep editing or discard them.`,keepEditing:`Keep editing`,discardChanges:`Discard changes`,supersedeTitle:`Supersede this decision?`,supersedeDescription:`Replace “{{current}}” with “{{replacement}}”. The original decision remains available as superseded memory.`,status:{saved:`Memory saved.`,archived:`Memory archived.`,restored:`Memory restored.`,superseded:`Decision superseded.`,scanStarted:`Project context scan started.`},filters:{kind:`Kind`,status:`Status`,stage:`Stage`,source:`Source`,injection:`Injection mode`,sort:`Sort by`},options:{all:`All`,decision:`Decisions`,convention:`Conventions`,active:`Active`,archived:`Archived`,superseded:`Superseded`,plan:`Plan`,build:`Build`,review:`Review`,follow_up:`Follow-up`,plan_follow_up:`Plan follow-up`,chat:`Chat`,manual:`Manual`,ticket:`Ticket`,spec:`Spec`,always:`Always include`,relevant:`Only when relevant`,updated:`Recently updated`,title:`Title`,kind:`Kind`,priority:`Priority`}},activity:{recentUsage:`Recent run usage`,noUsage:`No recorded usage yet.`,history:`Update history`,noHistory:`No history recorded yet.`,loadError:`Unable to load memory activity.`,runMemory:`Memory used for this run`,runMemoryDescription:`Read-only snapshot of the exact project memory supplied to this agent run.`,revision:`Revision`,stage:`Stage`,characters:`characters`,scan:`Generated-context scan`,generatedWarnings:`Warnings supplied to this run`,generatedAreas:`Relevant generated areas`,always:`Always included`,relevant:`Selected for relevance`,why:`Why this memory?`,omitted:`Omitted memory`,conflicts:`Conflicts`,events:{created:`Created`,updated:`Updated`,archived:`Archived`,restored:`Restored`,superseded:`Superseded`,suggestion_applied:`Suggestion applied`}},activation:{title:`Enable project memory`,description:`Memory stays in Archon, not in the target repository. When disabled, Archon preserves saved items but stops injecting them into prompts.`,ariaLabel:`Enable project memory`}},basics:{cardTitle:`Project details`,cardDescription:`Start with the repo Archon should use for new worktrees.`,requiredBadge:`Required`,fields:{projectName:{label:`Project name`,description:`Shown in the project switcher.`,ariaLabel:`Project name`,placeholder:`Platform API`},repositoryPath:{label:`Repository path`,defaultDescription:`Select a git repository.`,ariaLabel:`Repository path`,placeholder:`/Users/you/code/platform-api`,browse:`Browse`,opening:`Opening...`}},repoPathStatus:{checking:{ariaLabel:`Repository path status: checking`,title:`Checking repository path`},valid:{ariaLabel:`Repository path status: valid`,title:`Valid git repository path`},initializable:{ariaLabel:`Repository path status: initializable`},invalid:{ariaLabel:`Repository path status: invalid`}}}}}},Ab=Object.keys(kb.en),jb=ye;jb.use(Re).init({resources:kb,lng:`en`,fallbackLng:`en`,defaultNS:Ob,ns:Ab,supportedLngs:[`en`],interpolation:{escapeValue:!1},initAsync:!1,returnNull:!1,react:{useSuspense:!1}});var Mb=e=>Y(q(`/execution-environments/diagnostics`),{signal:e,fallbackErrorMessage:jb.t(`common:executionRuntimes.errorMessage`)}),Nb=(e,t)=>Y(q(`/projects/${encodeURIComponent(e)}/execution-environments`),{signal:t,fallbackErrorMessage:jb.t(`projects:execution.loadError`)}),Pb=(e,t)=>Y(q(`/projects/${encodeURIComponent(e)}/execution-profile`),{signal:t,fallbackErrorMessage:jb.t(`projects:execution.profile.loadError`)}),Fb=(e,t,n,r)=>Y(q(`/projects/${encodeURIComponent(e)}/execution-profile`),{method:`PUT`,body:{profile:t,expected_active_revision_id:n},signal:r,fallbackErrorMessage:jb.t(`projects:execution.profile.saveError`)}),Ib=(e,t,n,r=null,i=null,a)=>Y(q(t?`/projects/${encodeURIComponent(e)}/execution-environments/${encodeURIComponent(t)}/validate`:`/projects/${encodeURIComponent(e)}/execution-environments/validate`),{method:`POST`,body:{agent:n,...r?{provider:r}:{},...i?{model:i}:{}},signal:a,fallbackErrorMessage:jb.t(`projects:execution.validation.error`)}),Lb=(e,t,n)=>Y(q(`/projects/${encodeURIComponent(e)}/execution-environments/${encodeURIComponent(t)}/reset`),{method:`POST`,signal:n,fallbackErrorMessage:jb.t(`projects:execution.reset.error`)}),Rb=(e,t,n,r,i)=>Y(q(`/projects/${encodeURIComponent(e)}/execution-environments/${encodeURIComponent(t)}/${n}`),{method:`POST`,signal:i,fallbackErrorMessage:r}),zb=(e,t,n)=>Rb(e,t,`stop`,jb.t(`projects:execution.stop.error`),n),Bb=(e,t,n)=>Rb(e,t,`retire`,jb.t(`projects:execution.retire.error`),n),Vb=(e,t,n)=>Rb(e,t,`cleanup-retry`,jb.t(`projects:execution.cleanupRetry.error`),n),Hb=({className:e})=>(0,X.jsx)(_te,{"aria-hidden":`true`,className:e}),Ub=({className:e})=>(0,X.jsx)(zg,{"aria-hidden":`true`,className:e}),Wb=new Set([`cli`,`version`,`platform`,`virtualization`,`daemon`,`docker_login`]),Gb=(e,t)=>{if(t)return`error`;if(!e)return`loading`;if(e.observations.some(e=>Wb.has(e.code)&&e.state===`unsupported`))return`unsupported`;let n=e.activation?.state??`blocked`;return n===`blocked`?`setupRequired`:n===`eligible`?`eligible`:e.observations.some(e=>Wb.has(e.code)&&e.state===`unknown`)?`degraded`:`ready`},Kb=({observation:e})=>{let{t}=K(`common`,{keyPrefix:`executionRuntimes`}),n=e.state===`unknown`&&e.code.endsWith(`_template`),r=n?null:e.code===`virtualization`&&e.remediation?t(`virtualizationRemediation.${e.state}`,{defaultValue:e.remediation}):e.remediation,i=t(n?`observationState.deferred`:`observationState.${e.state}`),a=n?t(`deferredSummary.${e.code}`):e.summary;return(0,X.jsxs)(`div`,{className:`grid gap-2 border-b border-border/60 py-3 last:border-0 sm:grid-cols-[11rem_minmax(0,1fr)]`,children:[(0,X.jsx)(`dt`,{className:`text-xs font-medium text-muted-foreground`,children:t(`checks.${e.code}`)}),(0,X.jsxs)(`dd`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:i}),(0,X.jsx)(`p`,{className:`mt-0.5 break-words text-xs text-muted-foreground`,children:a}),r&&(0,X.jsx)(`p`,{className:`mt-1 break-words text-xs text-amber-200`,children:r})]})]})},qb=({status:e})=>{let{t}=K(`common`,{keyPrefix:`executionRuntimes`});return(0,X.jsx)(`span`,{className:`rounded-full border px-3 py-1 text-xs font-medium ${e===`recommended`?`border-emerald-400/25 bg-emerald-500/10 text-emerald-100`:e===`deprecated`?`border-amber-400/25 bg-amber-500/10 text-amber-100`:`border-red-400/25 bg-red-500/10 text-red-100`}`,children:t(`releaseStatus.${e}`)})},Jb=({onClose:e})=>{let{t}=K(`common`,{keyPrefix:`executionRuntimes`}),[n,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(null),[o,s]=(0,p.useState)(!1),c=(0,p.useCallback)(e=>(s(!0),a(null),Mb(e).then(r).catch(e=>{Ye(e)||a(t(`errorMessage`))}).finally(()=>{e?.aborted||s(!1)})),[t]);(0,p.useEffect)(()=>{let e=new AbortController;return c(e.signal),()=>e.abort()},[c]);let l=Gb(n,i),u=n?.observations.find(e=>e.code===`cli`)??null,d=!!(n&&u?.state===`not_ready`&&n.observations.filter(e=>e.code!==`cli`).every(e=>e.state===`unknown`));return(0,X.jsx)(S_,{open:!0,onOpenChange:t=>{t||e()},children:(0,X.jsxs)(w_,{showCloseButton:!1,className:`flex max-h-[min(48rem,calc(100vh-2rem))] flex-col gap-0 overflow-hidden rounded-3xl p-0 sm:max-w-4xl`,children:[(0,X.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-border/70 px-5 py-5 sm:px-6`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,X.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-sky-400/20 bg-sky-500/10 text-sky-200`,children:(0,X.jsx)(Uy,{className:`h-5 w-5`})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(D_,{className:`text-xl font-semibold`,children:t(`title`)}),(0,X.jsx)(O_,{className:`mt-1`,children:t(`description`)})]})]}),(0,X.jsx)(C_,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":t(`closeAriaLabel`),children:(0,X.jsx)(Ub,{className:`h-4 w-4`})})})]}),(0,X.jsx)(`div`,{className:`min-h-0 overflow-y-auto p-5 sm:p-6`,children:(0,X.jsxs)(`section`,{className:`rounded-2xl border border-border/70 bg-background/35 p-4 sm:p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.2em] text-muted-foreground`,children:t(`provider`)}),(0,X.jsx)(`h2`,{className:`mt-1 text-lg font-semibold text-foreground`,children:t(`dockerSandbox`)}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:t(`state.${l}`)})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?.releaseStatus&&(0,X.jsx)(qb,{status:n.releaseStatus}),(0,X.jsx)(`span`,{className:`rounded-full border border-border/70 bg-card px-3 py-1 text-xs font-medium text-foreground`,children:n?.providerVersion?t(`version`,{version:n.providerVersion}):t(`versionUnknown`)})]})]}),i&&(0,X.jsx)(`p`,{className:`mt-4 rounded-xl border border-red-400/25 bg-red-500/10 p-3 text-sm text-red-200`,role:`alert`,children:i}),n&&d&&u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dl`,{className:`mt-4`,children:(0,X.jsx)(Kb,{observation:u})}),(0,X.jsx)(`p`,{className:`mt-3 rounded-xl border border-border/70 bg-background/35 p-3 text-xs text-muted-foreground`,children:t(`unavailableSummary`)})]}),n&&!d&&(0,X.jsx)(`dl`,{className:`mt-4`,children:n.observations.map(e=>(0,X.jsx)(Kb,{observation:e},e.code))}),n?.releaseStatus===`deprecated`&&(0,X.jsx)(`p`,{className:`mt-3 rounded-xl border border-amber-400/25 bg-amber-500/10 p-3 text-xs text-amber-100`,children:t(`deprecatedReleaseNotice`,{version:n.recommendedVersion})}),n?.releaseStatus===`security_blocked`&&(0,X.jsx)(`p`,{className:`mt-3 rounded-xl border border-red-400/25 bg-red-500/10 p-3 text-xs text-red-100`,role:`alert`,children:t(`securityBlockedReleaseNotice`,{version:n.recommendedVersion})}),!n&&!i&&(0,X.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,role:`status`,children:t(`loading`)}),(0,X.jsxs)(`div`,{className:`mt-5 rounded-xl border border-amber-400/20 bg-amber-500/8 p-3 text-sm text-amber-100`,children:[(0,X.jsx)(`p`,{children:t(`guidance`)}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-amber-100/75`,children:t(`productionNotice`)})]}),(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,X.jsx)(Q,{asChild:!0,variant:`outline`,children:(0,X.jsx)(`a`,{href:`https://docs.docker.com/ai/sandboxes/`,target:`_blank`,rel:`noreferrer`,children:t(`openGuide`)})}),(0,X.jsxs)(Q,{type:`button`,onClick:()=>void c(),disabled:o,children:[(0,X.jsx)(Hb,{className:`h-4 w-4 ${o?`animate-spin`:``}`}),t(o?`rechecking`:`recheck`)]})]})]})})]})})},Yb=`border-sky-500/30 bg-sky-500/15 text-sky-100`,Xb=`[--normal-bg:var(--info-bg)] [--normal-border:var(--info-border)] [--normal-text:var(--info-text)]`,Zb=()=>(0,X.jsx)(sne,{closeButton:!0,expand:!0,theme:`dark`,position:`top-left`,richColors:!0,toastOptions:{classNames:{toast:`border border-border bg-card text-card-foreground shadow-2xl shadow-black/35`,title:`text-sm font-medium text-card-foreground`,description:`text-xs text-muted-foreground`,closeButton:`border border-border bg-secondary text-secondary-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,error:`border-red-500/30 bg-destructive/20 text-red-100`,success:`border-emerald-500/30 bg-emerald-500/15 text-emerald-100`,warning:`border-amber-500/30 bg-amber-500/15 text-amber-100`,info:Yb,loading:Xb}}}),Qb=300,$b=(e,t={})=>{let n=t.dedupeMs??Qb,r=0,i=()=>{if(document.visibilityState!==`visible`)return;let t=Date.now();t-r<n||(r=t,e())};return window.addEventListener(`focus`,i),document.addEventListener(`visibilitychange`,i),()=>{window.removeEventListener(`focus`,i),document.removeEventListener(`visibilitychange`,i)}},ex=6e4,tx=(e,t)=>{let[n,r]=(0,p.useState)(0),[i,a]=(0,p.useState)({jira:0,github:0}),[o,s]=(0,p.useState)(!1),[c,l]=(0,p.useState)(null),[u,d]=(0,p.useState)(0),f=(0,p.useRef)(0),m=(0,p.useCallback)(()=>{d(e=>e+1)},[]);return(0,p.useEffect)(()=>{if(!e||!t){r(0),a({jira:0,github:0}),l(null),s(!1);return}let n=new AbortController,i=f.current+1;f.current=i;let o=async()=>{s(!0);try{let t=await mt(e,n.signal);if(n.signal.aborted||i!==f.current)return;r(t.count),a(t.providers),l(t.error)}catch(e){if(Ye(e)||i!==f.current)return;l(e instanceof Error?e.message:`Unable to load assigned issues right now.`)}finally{!n.signal.aborted&&i===f.current&&s(!1)}};o();let c=window.setInterval(()=>{o()},ex),u=$b(()=>{o()});return()=>{n.abort(),window.clearInterval(c),u()}},[e,t,u]),{count:n,providers:i,loading:o,error:c,refresh:m}},nx=new Set,rx=new Map,ix=(e,t)=>{rx.set(e,t),nx.forEach(n=>n(e,t))},ax=e=>rx.has(e),ox=e=>{let[t,n]=(0,p.useState)(()=>e?rx.get(e)??[]:[]);return(0,p.useEffect)(()=>{if(!e){n([]);return}n(rx.get(e)??[]);let t=(t,r)=>{t===e&&n(r)};return nx.add(t),()=>{nx.delete(t)}},[e]),t},sx=Object.create(null);sx.open=`0`,sx.close=`1`,sx.ping=`2`,sx.pong=`3`,sx.message=`4`,sx.upgrade=`5`,sx.noop=`6`;var cx=Object.create(null);Object.keys(sx).forEach(e=>{cx[sx[e]]=e});var lx={type:`error`,data:`parser error`},ux=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,dx=typeof ArrayBuffer==`function`,fx=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,px=({type:e,data:t},n,r)=>ux&&t instanceof Blob?n?r(t):mx(t,r):dx&&(t instanceof ArrayBuffer||fx(t))?n?r(t):mx(new Blob([t]),r):r(sx[e]+(t||``)),mx=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function hx(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var gx;function _x(e,t){if(ux&&e.data instanceof Blob)return e.data.arrayBuffer().then(hx).then(t);if(dx&&(e.data instanceof ArrayBuffer||fx(e.data)))return t(hx(e.data));px(e,!1,e=>{gx||=new TextEncoder,t(gx.encode(e))})}var vx=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,yx=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)yx[vx.charCodeAt(e)]=e;var bx=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=yx[e.charCodeAt(r)],o=yx[e.charCodeAt(r+1)],s=yx[e.charCodeAt(r+2)],c=yx[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},xx=typeof ArrayBuffer==`function`,Sx=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:wx(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:Cx(e.substring(1),t)}:cx[n]?e.length>1?{type:cx[n],data:e.substring(1)}:{type:cx[n]}:lx},Cx=(e,t)=>xx?wx(bx(e),t):{base64:!0,data:e},wx=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},Tx=``,Ex=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{px(e,!1,e=>{r[a]=e,++i===n&&t(r.join(Tx))})})},Dx=(e,t)=>{let n=e.split(Tx),r=[];for(let e=0;e<n.length;e++){let i=Sx(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Ox(){return new TransformStream({transform(e,t){_x(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var kx;function Ax(e){return e.reduce((e,t)=>e+t.length,0)}function jx(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Mx(e,t){kx||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(Ax(n)<1)break;let e=jx(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(Ax(n)<2)break;let e=jx(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(Ax(n)<8)break;let e=jx(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(lx);break}i=a*2**32+t.getUint32(4),r=3}else{if(Ax(n)<i)break;let e=jx(n,i);s.enqueue(Sx(a?e:kx.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(lx);break}}}})}function Nx(e){if(e)return Px(e)}function Px(e){for(var t in Nx.prototype)e[t]=Nx.prototype[t];return e}Nx.prototype.on=Nx.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},Nx.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Nx.prototype.off=Nx.prototype.removeListener=Nx.prototype.removeAllListeners=Nx.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},Nx.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},Nx.prototype.emitReserved=Nx.prototype.emit,Nx.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},Nx.prototype.hasListeners=function(e){return!!this.listeners(e).length};var Fx=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Ix=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),Lx=`arraybuffer`;function Rx(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var zx=Ix.setTimeout,Bx=Ix.clearTimeout;function Vx(e,t){t.useNativeTimers?(e.setTimeoutFn=zx.bind(Ix),e.clearTimeoutFn=Bx.bind(Ix)):(e.setTimeoutFn=Ix.setTimeout.bind(Ix),e.clearTimeoutFn=Ix.clearTimeout.bind(Ix))}var Hx=1.33;function Ux(e){return typeof e==`string`?Wx(e):Math.ceil((e.byteLength||e.size)*Hx)}function Wx(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function Gx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Kx(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function qx(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var Jx=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},Yx=class extends Nx{constructor(e){super(),this.writable=!1,Vx(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new Jx(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=Sx(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=Kx(e);return t.length?`?`+t:``}},Xx=class extends Yx{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){Dx(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,Ex(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=Gx()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},Zx=!1;try{Zx=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var Qx=Zx;function $x(){}var eS=class extends Xx{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},tS=class e extends Nx{constructor(e,t,n){super(),this.createRequest=e,Vx(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=Rx(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=$x,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(tS.requestsCount=0,tS.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,nS);else if(typeof addEventListener==`function`){let e=`onpagehide`in Ix?`pagehide`:`unload`;addEventListener(e,nS,!1)}}function nS(){for(let e in tS.requests)tS.requests.hasOwnProperty(e)&&tS.requests[e].abort()}var rS=(function(){let e=aS({xdomain:!1});return e&&e.responseType!==null})(),iS=class extends eS{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=rS&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new tS(aS,this.uri(),e)}};function aS(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||Qx))return new XMLHttpRequest}catch{}if(!t)try{return new Ix[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var oS=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,sS=class extends Yx{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=oS?{}:Rx(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;px(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&Fx(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Gx()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},cS=Ix.WebSocket||Ix.MozWebSocket,lS={websocket:class extends sS{createSocket(e,t,n){return oS?new cS(e,t,n):t?new cS(e,t):new cS(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends Yx{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Mx(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Ox();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&Fx(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:iS},uS=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,dS=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function fS(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=uS.exec(e||``),a={},o=14;for(;o--;)a[dS[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=pS(a,a.path),a.queryKey=mS(a,a.query),a}function pS(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function mS(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var hS=typeof addEventListener==`function`&&typeof removeEventListener==`function`,gS=[];hS&&addEventListener(`offline`,()=>{gS.forEach(e=>e())},!1);var _S=class e extends Nx{constructor(e,t){if(super(),this.binaryType=Lx,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=fS(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=fS(t.host).host);Vx(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=qx(this.opts.query)),hS&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},gS.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=Ux(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Fx(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),hS&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=gS.indexOf(this._offlineEventListener);e!==-1&&gS.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};_S.protocol=4;var vS=class extends _S{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;_S.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;_S.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},yS=class extends vS{constructor(e,t={}){let n=typeof e==`object`?e:t;(!n.transports||n.transports&&typeof n.transports[0]==`string`)&&(n.transports=(n.transports||[`polling`,`websocket`,`webtransport`]).map(e=>lS[e]).filter(e=>!!e)),super(e,n)}};yS.protocol;function bS(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=fS(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var xS=typeof ArrayBuffer==`function`,SS=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,CS=Object.prototype.toString,wS=typeof Blob==`function`||typeof Blob<`u`&&CS.call(Blob)===`[object BlobConstructor]`,TS=typeof File==`function`||typeof File<`u`&&CS.call(File)===`[object FileConstructor]`;function ES(e){return xS&&(e instanceof ArrayBuffer||SS(e))||wS&&e instanceof Blob||TS&&e instanceof File}function DS(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(DS(e[t]))return!0;return!1}if(ES(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return DS(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&DS(e[t]))return!0;return!1}function OS(e){let t=[],n=e.data,r=e;return r.data=kS(n,t),r.attachments=t.length,{packet:r,buffers:t}}function kS(e,t){if(!e)return e;if(ES(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=kS(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=kS(e[r],t));return n}return e}function AS(e,t){return e.data=jS(e.data,t),delete e.attachments,e}function jS(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=jS(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=jS(e[n],t));return e}var MS=r({Decoder:()=>IS,Encoder:()=>FS,PacketType:()=>PS,isPacketValid:()=>US,protocol:()=>5}),NS=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],PS;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(PS||={});var FS=class{constructor(e){this.replacer=e}encode(e){return(e.type===PS.EVENT||e.type===PS.ACK)&&DS(e)?this.encodeAsBinary({type:e.type===PS.EVENT?PS.BINARY_EVENT:PS.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===PS.BINARY_EVENT||e.type===PS.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=OS(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},IS=class e extends Nx{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===PS.BINARY_EVENT;n||t.type===PS.BINARY_ACK?(t.type=n?PS.EVENT:PS.ACK,this.reconstructor=new LS(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(ES(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(PS[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===PS.BINARY_EVENT||r.type===PS.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!zS(a)||a<0)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case PS.CONNECT:return VS(t);case PS.DISCONNECT:return t===void 0;case PS.CONNECT_ERROR:return typeof t==`string`||VS(t);case PS.EVENT:case PS.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&NS.indexOf(t[0])===-1);case PS.ACK:case PS.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},LS=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=AS(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function RS(e){return typeof e==`string`}var zS=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function BS(e){return e===void 0||zS(e)}function VS(e){return Object.prototype.toString.call(e)===`[object Object]`}function HS(e,t){switch(e){case PS.CONNECT:return t===void 0||VS(t);case PS.DISCONNECT:return t===void 0;case PS.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&NS.indexOf(t[0])===-1);case PS.ACK:return Array.isArray(t);case PS.CONNECT_ERROR:return typeof t==`string`||VS(t);default:return!1}}function US(e){return RS(e.nsp)&&BS(e.id)&&HS(e.type,e.data)}function WS(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var GS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),KS=class extends Nx{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[WS(e,`open`,this.onopen.bind(this)),WS(e,`packet`,this.onpacket.bind(this)),WS(e,`error`,this.onerror.bind(this)),WS(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(GS.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:PS.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:PS.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case PS.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case PS.EVENT:case PS.BINARY_EVENT:this.onevent(e);break;case PS.ACK:case PS.BINARY_ACK:this.onack(e);break;case PS.DISCONNECT:this.ondisconnect();break;case PS.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:PS.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PS.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function qS(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}qS.prototype.duration=function(){var e=this.ms*this.factor**+ this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},qS.prototype.reset=function(){this.attempts=0},qS.prototype.setMin=function(e){this.ms=e},qS.prototype.setMax=function(e){this.max=e},qS.prototype.setJitter=function(e){this.jitter=e};var JS=class extends Nx{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,Vx(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new qS({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||MS;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new yS(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=WS(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=WS(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(WS(e,`ping`,this.onping.bind(this)),WS(e,`data`,this.ondata.bind(this)),WS(e,`error`,this.onerror.bind(this)),WS(e,`close`,this.onclose.bind(this)),WS(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){Fx(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new KS(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},YS={};function XS(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=bS(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=YS[i]&&a in YS[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new JS(r,t):(YS[i]||(YS[i]=new JS(r,t)),c=YS[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(XS,{Manager:JS,Socket:KS,io:XS,connect:XS});var ZS=((e=Ge)=>XS(e))(),QS=({className:e})=>(0,X.jsx)(Qee,{"aria-hidden":`true`,className:e}),$S=({className:e})=>(0,X.jsx)(Wee,{"aria-hidden":`true`,className:e}),eC=({className:e})=>(0,X.jsx)(yte,{"aria-hidden":`true`,className:e}),tC=e=>{let t=e.external_source;if(t.provider===`github`){let e=t.metadata?.issue_number;if(typeof e==`number`||typeof e==`string`&&e.trim()!==``)return`#${e}`;let n=t.external_key.lastIndexOf(`#`);return n>=0&&n<t.external_key.length-1?`#${t.external_key.slice(n+1)}`:t.external_key}return t.external_key},nC=({draft:e,onCreateTicket:t,onStartSpec:n})=>{let{t:r}=K(`common`),i=e.external_source.provider,a=r(i===`jira`?`assignedIssuesInbox.providerJira`:`assignedIssuesInbox.providerGithub`),o=r(i===`jira`?`assignedIssuesInbox.viewJira`:`assignedIssuesInbox.viewGithub`),s=tC(e);return(0,X.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-border/50 p-3 last:border-b-0`,children:[(0,X.jsx)(`span`,{className:`shrink-0 self-start rounded bg-ticket-link/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-ticket-link`,children:a}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:s}),(0,X.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e.title||s})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:()=>t(e),children:r(`assignedIssuesInbox.createTicket`)}),(0,X.jsxs)(Q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 gap-1 text-xs`,onClick:()=>n(e),children:[(0,X.jsx)(eC,{className:`h-3 w-3`}),r(`assignedIssuesInbox.spec`)]}),e.external_source.external_url&&(0,X.jsxs)(`a`,{href:e.external_source.external_url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent/20 hover:text-foreground`,children:[(0,X.jsx)($S,{className:`h-3 w-3`}),o]})]})]})},rC=({projectId:e,onStartSpecFromDraft:t,onCreateTicketFromDraft:n})=>{let{t:r}=K(`common`),i=(ox(e)??[]).some(e=>e.status===`connected`),{count:a,refresh:o}=tx(e,i),[s,c]=(0,p.useState)(!1),[l,u]=(0,p.useState)([]),[d,f]=(0,p.useState)(!1),[m,h]=(0,p.useState)(null),g=(0,p.useRef)(null),_=(0,p.useCallback)(async t=>{if(!e)return;g.current?.abort();let n=new AbortController;g.current=n,f(!0);try{let r=await ht(e,n.signal,{force:t});if(n.signal.aborted)return;u(r.drafts),h(r.error),o()}catch(e){if(Ye(e))return;h(e instanceof Error?e.message:r(`assignedIssuesInbox.errorState`))}finally{n.signal.aborted||f(!1)}},[e,r,o]);(0,p.useEffect)(()=>(s&&e&&_(!1),()=>{g.current?.abort()}),[s,e,_]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{t.project_id===e&&o()};return ZS.on(`ticket:created`,t),()=>{ZS.off(`ticket:created`,t)}},[e,o]);let v=(0,p.useCallback)(e=>{n(e),c(!1)},[n]),y=(0,p.useCallback)(e=>{t?.(e),c(!1)},[t]),b=(0,p.useCallback)(()=>{_(!0),o()},[_,o]);return!e||!i?null:(0,X.jsxs)(B_,{open:s,onOpenChange:c,children:[(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,variant:`ghost`,"aria-label":r(`assignedIssuesInbox.buttonAriaLabel`),className:`relative h-8 rounded-xl border border-border/70 px-3 text-sm font-medium hover:bg-accent/20`,children:[(0,X.jsx)(QS,{className:`h-4 w-4`}),a>0&&(0,X.jsx)(`span`,{"aria-label":r(`assignedIssuesInbox.badgeAriaLabel`,{count:a}),className:`absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground ring-2 ring-background`,children:a>99?`99+`:a})]})}),(0,X.jsxs)(H_,{align:`end`,className:`w-[min(28rem,calc(100vw-2rem))] p-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-3 py-2`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:r(`assignedIssuesInbox.title`)}),(0,X.jsx)(Q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs`,onClick:b,disabled:d,children:r(`assignedIssuesInbox.refresh`)})]}),(0,X.jsx)(`div`,{className:`max-h-[24rem] overflow-y-auto`,children:d&&l.length===0?(0,X.jsx)(`div`,{className:`p-4 text-center text-sm text-muted-foreground`,children:`Loading...`}):m&&l.length===0?(0,X.jsx)(`div`,{className:`p-4 text-center text-sm text-rose-400`,children:m}):l.length===0?(0,X.jsx)(`div`,{className:`p-4 text-center text-sm text-muted-foreground`,children:r(`assignedIssuesInbox.emptyState`)}):(0,X.jsx)(`ul`,{children:l.map(e=>(0,X.jsx)(nC,{draft:e,onCreateTicket:v,onStartSpec:y},`${e.external_source.provider}:${e.external_source.external_key}`))})})]})]})},iC=[],aC=!1,oC=()=>{if(!(typeof window>`u`)){if(iC.length===0){aC&&=(window.removeEventListener(`keydown`,sC),!1);return}aC||=(window.addEventListener(`keydown`,sC),!0)}},sC=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=iC[iC.length-1];t&&t.onClose()},cC=(e,t={})=>{let{disabled:n=!1}=t,r=(0,p.useRef)(e);(0,p.useEffect)(()=>{r.current=e},[e]),(0,p.useEffect)(()=>{if(n)return;let e={id:Symbol(`escape-close`),onClose:()=>r.current()};return iC.push(e),oC(),()=>{let t=iC.findIndex(t=>t.id===e.id);t!==-1&&iC.splice(t,1),oC()}},[n])},lC=(...e)=>e.filter(Boolean).join(` `),uC=({children:e,onClose:t,overlayClassName:n,panelClassName:r,closeButtonClassName:i,closeButtonLabel:a=`Close modal`,renderContent:o})=>{cC(t);let s=(0,X.jsx)(Q,{type:`button`,"aria-label":a,variant:`ghost`,size:`icon-sm`,onClick:t,className:lC(`cursor-pointer text-muted-foreground hover:text-foreground`,i),children:(0,X.jsx)(Ub,{className:`h-4 w-4`})});return(0,X.jsx)(`div`,{"data-archon-modal":`true`,className:lC(`fixed inset-0 z-50 flex items-center justify-center`,n),children:(0,X.jsx)(`div`,{className:lC(`relative flex flex-col`,r),role:`dialog`,"aria-modal":`true`,onClick:e=>e.stopPropagation(),children:o?o({closeButton:s}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:s}),e]})})})},dC=({title:e,description:t,confirmLabel:n,cancelLabel:r,confirmVariant:i=`default`,onConfirm:a,onCancel:o})=>(0,X.jsxs)(uC,{onClose:o,overlayClassName:`bg-black/70`,panelClassName:`max-w-md rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,X.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:e}),(0,X.jsx)(`p`,{className:`mb-6 text-sm text-foreground whitespace-pre-line`,children:t}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(Q,{type:`button`,variant:`ghost`,onClick:o,children:r}),(0,X.jsx)(Q,{type:`button`,variant:i,onClick:a,children:n})]})]}),fC=({onSelect:e})=>{let{t}=K(`common`);return(0,X.jsxs)(uC,{onClose:()=>e(null),overlayClassName:`bg-black/70`,panelClassName:`max-w-lg rounded-2xl border border-amber-500/30 bg-card p-6 shadow-2xl`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:t(`sandboxPreviewRunDialog.title`)}),(0,X.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:t(`sandboxPreviewRunDialog.description`)}),(0,X.jsx)(`div`,{className:`mt-4 rounded-lg border border-amber-500/25 bg-amber-500/10 p-3 text-sm leading-5 text-amber-100`,children:t(`sandboxPreviewRunDialog.hostWarning`)}),(0,X.jsxs)(`div`,{className:`mt-6 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,children:[(0,X.jsx)(Q,{type:`button`,variant:`ghost`,onClick:()=>e(null),children:t(`sandboxPreviewRunDialog.cancel`)}),(0,X.jsx)(Q,{type:`button`,variant:`secondary`,onClick:()=>e(`project_default`),children:t(`sandboxPreviewRunDialog.runInSandbox`)}),(0,X.jsx)(Q,{type:`button`,onClick:()=>e(`host`),children:t(`sandboxPreviewRunDialog.runOnHost`)})]})]})},pC=({isSubmitting:e,onCreateInitialCommit:t})=>(0,X.jsx)(`div`,{className:`mx-6 mt-4 mb-4 w-fit max-w-[calc(100%-3rem)] rounded-2xl border border-amber-500/35 bg-amber-500/10 px-4 py-3 text-sm text-amber-100`,role:`alert`,children:(0,X.jsxs)(`div`,{className:`flex flex-col items-start gap-4 lg:flex-row lg:items-center`,children:[(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:`This repository needs an initial commit before Archon can prepare bundle worktrees.`}),(0,X.jsx)(`p`,{className:`text-xs leading-5 text-amber-100/90`,children:`Repo root chat still works. Create an initial commit to unblock bundle worktrees.`})]}),(0,X.jsx)(Q,{type:`button`,variant:`warning`,className:`shrink-0`,disabled:e,onClick:t,children:e?`Creating initial commit...`:`Create initial commit`})]})}),mC=Xr(`inline-flex w-fit shrink-0 items-center justify-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium whitespace-nowrap transition-colors [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`border-primary/30 bg-primary/15 text-primary-foreground`,secondary:`border-border bg-secondary text-secondary-foreground`,destructive:`border-red-500/25 bg-destructive/15 text-red-200`,success:`border-emerald-500/25 bg-emerald-500/12 text-emerald-200`,warning:`border-amber-500/25 bg-amber-500/12 text-amber-200`,info:`border-sky-500/25 bg-sky-500/12 text-sky-200`,outline:`border-border bg-card text-muted-foreground`,ghost:`border-transparent bg-transparent text-muted-foreground`,hotkeyDark:`border-black/25 bg-transparent text-[#07130d]/75`,link:`border-transparent px-0 text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}}),hC=({className:e,variant:t=`default`,asChild:n=!1,...r})=>(0,X.jsx)(n?ti:`span`,{"data-slot":`badge`,"data-variant":t,className:Z(mC({variant:t}),e),...r}),gC=(0,p.forwardRef)(({className:e,size:t=`default`,...n},r)=>(0,X.jsx)(`div`,{ref:r,"data-slot":`card`,"data-size":t,className:Z(`flex flex-col gap-5 rounded-2xl border border-border/70 bg-card text-sm text-card-foreground shadow-xl shadow-black/10 data-[size=sm]:gap-4`,e),...n}));gC.displayName=`Card`;var _C=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-header`,className:Z(`grid auto-rows-min items-start gap-1.5 px-5 pt-5 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-5 data-[size=sm]:px-4 data-[size=sm]:pt-4`,e),...t}),vC=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-title`,className:Z(`font-heading text-base font-medium`,e),...t}),yC=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-description`,className:Z(`text-sm text-muted-foreground`,e),...t}),bC=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-action`,className:Z(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t}),xC=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-content`,className:Z(`px-5 pb-5 data-[size=sm]:px-4 data-[size=sm]:pb-4`,e),...t}),SC=({className:e,...t})=>(0,X.jsx)(`div`,{"data-slot":`card-footer`,className:Z(`flex items-center px-5 pb-5 data-[size=sm]:px-4 data-[size=sm]:pb-4 [.border-t]:pt-5`,e),...t}),CC=({label:e,labelTrailing:t,htmlFor:n,description:r,error:i,className:a,children:o})=>(0,X.jsxs)(`div`,{className:Z(`flex flex-col gap-1.5`,a),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium uppercase tracking-[0.22em] text-muted-foreground`,htmlFor:n,children:e}),t]}),o,r&&(0,X.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:r}),i&&(0,X.jsx)(`p`,{className:`text-sm text-red-300`,children:i})]}),wC=({className:e})=>(0,X.jsx)(Lg,{"aria-hidden":`true`,className:e}),TC=(e,t)=>e instanceof Error&&e.message?e.message:t,EC=({bundles:e,selectedBundleId:t,activeTargetBundleId:n=null,onSelectBundle:r,onCreateBundle:i,onDeleteBundle:a,onClose:o})=>{let{t:s}=K(`common`),c=yy(e),[l,u]=(0,p.useState)(``),[d,f]=(0,p.useState)(!1),[m,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),v=async e=>{e.preventDefault();let t=l.trim();if(!(!t||d)){f(!0);try{r((await i(t)).id),o()}catch(e){$.error(TC(e,s(`manageBundlesModal.createError`)),{id:`manage-bundles-error`}),f(!1)}}},y=async e=>{if(!(e.kind===`project_root`||e.ticket_count>0||g)){_(e.id);try{await a(e.id),t===e.id&&r(null),h(null)}catch(e){$.error(TC(e,s(`manageBundlesModal.deleteError`)),{id:`manage-bundles-error`})}finally{_(null)}}};return(0,X.jsx)(uC,{onClose:d?()=>{}:o,overlayClassName:`bg-black/70 px-4 py-8`,panelClassName:`w-full max-w-2xl rounded-3xl border border-[#2a2a38] bg-[#16161f] shadow-2xl`,renderContent:({closeButton:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-5`,children:[(0,X.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:s(`manageBundlesModal.title`)}),d?null:e]}),(0,X.jsxs)(`div`,{className:`flex max-h-[70vh] flex-col gap-6 px-6 py-5`,children:[(0,X.jsxs)(gC,{className:`rounded-3xl border-border bg-card/70 shadow-none`,children:[(0,X.jsx)(_C,{children:(0,X.jsx)(vC,{className:`text-sm font-semibold uppercase tracking-[0.24em] text-foreground`,children:s(`manageBundlesModal.createTitle`)})}),(0,X.jsx)(xC,{children:d?(0,X.jsx)(`div`,{className:`rounded-2xl border border-emerald-500/20 bg-emerald-500/5 px-4 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(`div`,{className:`mt-0.5 rounded-full bg-emerald-500/10 p-2 text-emerald-300`,children:(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`})}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:s(`manageBundlesModal.createPendingTitle`)}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`manageBundlesModal.createPendingDescription`)})]})]})}):(0,X.jsxs)(`form`,{onSubmit:v,className:`flex min-w-0 flex-col gap-4 sm:flex-row sm:items-end`,children:[(0,X.jsx)(CC,{label:s(`manageBundlesModal.bundleNameLabel`),className:`min-w-0 flex-1`,children:(0,X.jsx)(k_,{"aria-label":s(`manageBundlesModal.bundleNameAriaLabel`),type:`text`,value:l,onChange:e=>u(e.target.value),autoFocus:!0,placeholder:s(`manageBundlesModal.bundleNamePlaceholder`)})}),(0,X.jsx)(Q,{type:`submit`,disabled:!l.trim()||d,variant:`success`,size:`lg`,className:`sm:shrink-0`,children:s(`manageBundlesModal.createAction`)})]})})]}),(0,X.jsxs)(gC,{className:`flex min-h-0 flex-1 flex-col rounded-3xl border-border bg-card/70 shadow-none ${d?`opacity-60`:``}`,children:[(0,X.jsx)(_C,{children:(0,X.jsx)(vC,{className:`text-sm font-semibold uppercase tracking-[0.24em] text-foreground`,children:s(`manageBundlesModal.existingTitle`)})}),(0,X.jsx)(xC,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,X.jsx)(`div`,{className:`space-y-3`,children:c.length===0?(0,X.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border px-4 py-5 text-sm text-muted-foreground`,children:s(`manageBundlesModal.empty`)}):c.map(e=>{let r=t===e.id,i=n===e.id,a=e.kind===`project_root`||e.ticket_count>0||i||g!==null,o=m===e.id;return(0,X.jsx)(gC,{size:`sm`,className:`rounded-2xl border-border/80 bg-background/30 shadow-none`,children:(0,X.jsx)(xC,{className:`p-4`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:My(e)}),r&&(0,X.jsx)(hC,{variant:`info`,children:s(`manageBundlesModal.selected`)}),i&&(0,X.jsx)(hC,{variant:`info`,children:s(`manageBundlesModal.currentTarget`)})]}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.kind===`project_root`?s(`manageBundlesModal.projectRootDescription`,{branch:e.branch}):i?s(`manageBundlesModal.switchTargetDescription`):e.ticket_count>0?s(`manageBundlesModal.inUseDescription`,{ticketCount:s(`manageBundlesModal.ticketCount`,{count:e.ticket_count})}):s(`manageBundlesModal.unusedDescription`)})]}),(0,X.jsx)(`div`,{className:`flex items-center gap-2 sm:shrink-0`,children:o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{type:`button`,onClick:()=>h(null),variant:`ghost`,children:s(`manageBundlesModal.cancel`)}),(0,X.jsx)(Q,{type:`button`,onClick:()=>void y(e),disabled:a,variant:`destructive`,children:g===e.id?s(`manageBundlesModal.deleting`):s(`manageBundlesModal.deleteBundle`)})]}):(0,X.jsx)(Q,{type:`button`,onClick:()=>h(e.id),disabled:a,variant:`destructive`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,X.jsx)(wC,{className:`h-3.5 w-3.5`}),s(`manageBundlesModal.delete`)]})})})]})})},e.id)})})})]})]}),(0,X.jsx)(`div`,{className:`border-t border-border px-6 py-4`,children:(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(Q,{type:`button`,onClick:o,disabled:d,variant:`ghost`,children:s(`manageBundlesModal.close`)})})})]})})},DC=i(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),OC=i((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),kC=i((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),AC=i(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),jC=i(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),MC=i((e=>{var t=OC().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),NC=i((e=>{var t=OC().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),PC=i((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),FC=i((e=>{var t=kC(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),kne=i((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Ane=i((e=>{var t=kne();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),jne=i(((e,t)=>{var n=Ane();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),IC=i((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),LC=i((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
59
59
|
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),RC=i((e=>{var t=IC(),n=LC();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Mne=i((e=>{var t=OC(),n=FC(),r=kC(),i=RC(),a=IC(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Nne=i((e=>{var t=OC(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Pne=i(((e,t)=>{var n=RC();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Fne=i(((e,t)=>{var n=RC(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Ine=i(((e,t)=>{var n=RC();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Lne=i(((e,t)=>{var n=RC(),r=OC();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
60
60
|
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Rne=i(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),zne=i((e=>{var t=RC(),n=Pne(),r=Fne(),i=Ine(),a=Lne(),o=LC(),s=OC(),c=Rne();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
61
61
|
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Bne=i((e=>{var t=OC(),n=kC(),r=AC(),i=jC(),a=MC(),o=NC(),s=PC(),c=FC(),l=jne(),u=Mne(),d=Nne(),f=RC(),p=zne();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
@@ -144,7 +144,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
144
144
|
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
145
145
|
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return xH(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=vU.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function OU(){return{exit:{taskListCheckValueChecked:AU,taskListCheckValueUnchecked:AU,paragraph:jU}}}function kU(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:MU}}}function AU(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function jU(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function MU(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=vU.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function NU(){return[zV(),lH(),mH(),yU(),OU()]}function PU(e){return{extensions:[BV(),uH(e),hH(),DU(e),kU()]}}var FU={tokenize:YU,partial:!0},IU={tokenize:XU,partial:!0},LU={tokenize:ZU,partial:!0},RU={tokenize:QU,partial:!0},zU={tokenize:$U,partial:!0},BU={name:`wwwAutolink`,tokenize:qU,previous:eW},VU={name:`protocolAutolink`,tokenize:JU,previous:tW},HU={name:`emailAutolink`,tokenize:KU,previous:nW},UU={};function WU(){return{text:UU}}for(var GU=48;GU<123;)UU[GU]=HU,GU++,GU===58?GU=65:GU===91&&(GU=97);UU[43]=HU,UU[45]=HU,UU[46]=HU,UU[95]=HU,UU[72]=[HU,VU],UU[104]=[HU,VU],UU[87]=[HU,BU],UU[119]=[HU,BU];function KU(e,t,n){let r=this,i,a;return o;function o(t){return!rW(t)||!nW.call(r,r.previous)||iW(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return rW(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(zU,u,l)(t):t===45||t===95||zI(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&RI(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function qU(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!eW.call(r,r.previous)||iW(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(FU,e.attempt(IU,e.attempt(LU,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function JU(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&tW.call(r,r.previous)&&!iW(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(RI(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||VI(t)||KI(t)||YI(t)||JI(t)?n(t):e.attempt(IU,e.attempt(LU,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function YU(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function XU(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(RU,c,s)(t):t===null||KI(t)||YI(t)||t!==45&&JI(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function ZU(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(RU,t,a)(o):o===null||KI(o)||YI(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function QU(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||KI(o)||YI(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||KI(e)||YI(e)?t(e):r(e)}function a(e){return RI(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):RI(t)?(e.consume(t),o):n(t)}}function $U(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return zI(e)?n(e):t(e)}}function eW(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||KI(e)}function tW(e){return!RI(e)}function nW(e){return!(e===47||rW(e))}function rW(e){return e===43||e===45||e===46||e===95||zI(e)}function iW(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var aW={tokenize:pW,partial:!0};function oW(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:uW,continuation:{tokenize:dW},exit:fW}},text:{91:{name:`gfmFootnoteCall`,tokenize:lW},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:sW,resolveTo:cW}}}}function sW(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=LI(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function cW(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function lW(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||KI(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(LI(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return KI(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function uW(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||KI(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=LI(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return KI(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),QI(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function dW(e,t,n){return e.check(pL,t,e.attempt(aW,t,n))}function fW(e){e.exit(`gfmFootnoteDefinition`)}function pW(e,t,n){let r=this;return QI(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function mW(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&MI(o,o.length,0,oL(s,e.slice(r+1,n),t)),MI(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),MI(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=aL(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=aL(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var hW=class{constructor(){this.map=[]}add(e,t,n){gW(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function gW(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function _W(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function vW(){return{flow:{null:{name:`table`,tokenize:yW,resolveAll:bW}}}}function yW(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):GI(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):qI(t)?QI(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||KI(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,qI(t)?QI(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return qI(t)?QI(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||GI(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return qI(t)?QI(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||GI(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||GI(n)?(e.exit(`tableRow`),t(n)):qI(n)?QI(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||KI(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function bW(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new hW;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(SW(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=xW(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=xW(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=xW(f,t,o,i,n,d)):(o[0]=o[1],d=xW(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&SW(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=_W(t.events,n))}return e}function xW(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},CW(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=CW(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=CW(t.events,n[2]),a=CW(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},CW(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function SW(e,t,n,r,i){let a=[],o=CW(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function CW(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var wW={name:`tasklistCheck`,tokenize:EW};function TW(){return{text:{91:wW}}}function EW(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return KI(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return GI(r)?t(r):qI(r)?e.check({tokenize:DW},t,n)(r):n(r)}}function DW(e,t,n){return QI(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function OW(e){return FI([WU(),oW(),mW(e),vW(),TW()])}var kW={};function AW(e){let t=this,n=e||kW,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(OW(n)),a.push(NU()),o.push(PU(n))}function jW(e){NV(e,[/\r?\n|\r/g,MW])}function MW(){return{type:`break`}}function NW(){return function(e){jW(e)}}var PW=/^\[(?:X|x| )\]\s+/,FW=e=>{let t=e.split(`
|
|
146
146
|
`).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0&&t.every(e=>PW.test(e))},IW=e=>FW(e)?e.split(`
|
|
147
|
-
`).map(e=>e.trim()).filter(e=>e.length>0):[],LW=`modulepreload`,RW=function(e){return`/`+e},zW={},BW=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=RW(t,n),t in zW)return;zW[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:LW,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},VW=e=>e.replace(/\\"/g,`"`),HW=100,UW=({mermaid:e,className:t,onClick:n})=>{let{t:r}=K(`common`),[i,a]=(0,p.useState)({kind:`loading`}),o=`mermaid-${(0,p.useId)().replace(/:/g,``)}`;(0,p.useEffect)(()=>{let t=!1;if(a({kind:`loading`}),!e){a({kind:`error`,rawText:``});return}let n=window.setTimeout(()=>{(async()=>{try{let n=await BW(()=>import(`./mermaid.core-YpvipwZo.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]));if(t)return;let r=n.default;r.initialize({startOnLoad:!1,theme:`dark`,themeVariables:{primaryColor:`#8b5cf6`,primaryTextColor:`#e2e8f0`,lineColor:`#94a3b8`,secondaryColor:`#1e293b`,tertiaryColor:`#334155`}});let i=VW(e);if(await r.parse(i),t)return;let{svg:s}=await r.render(o,i);if(t)return;a({kind:`rendered`,svg:s})}catch{t||a({kind:`error`,rawText:e})}})()},HW);return()=>{t=!0,window.clearTimeout(n)}},[e,o]);let s=(0,p.useCallback)(()=>{i.kind===`rendered`&&n&&n()},[i,n]);return i.kind===`loading`?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8 ${t??``}`,children:(0,X.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`})}):i.kind===`error`?i.rawText?(0,X.jsxs)(`div`,{className:t,children:[(0,X.jsx)(`div`,{className:`mb-2 text-xs text-amber-400`,children:r(`specView.artifactPanel.mermaidParseError`)}),(0,X.jsx)(`pre`,{className:`overflow-auto rounded-md border border-border/50 bg-surface p-3 text-xs text-muted-foreground whitespace-pre-wrap`,children:i.rawText})]}):(0,X.jsx)(`div`,{className:`py-4 text-sm text-muted-foreground ${t??``}`,children:r(`specView.artifactPanel.noDiagram`)}):(0,X.jsx)(`div`,{className:`spec-mermaid-diagram flex justify-center ${n?`cursor-zoom-in`:``} ${t??``}`,dangerouslySetInnerHTML:{__html:i.svg},onClick:s,role:n?`button`:void 0,tabIndex:n?0:void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())}:void 0,"aria-label":n?r(`mermaidPreviewDialog.clickToExpand`):void 0})},WW=({className:e})=>(0,X.jsx)(lte,{"aria-hidden":`true`,className:e}),GW=24,KW=4,qW=1.25,JW=1,YW={width:800,height:600},XW=e=>e.replace(/\\"/g,`"`),ZW=e=>Number.isFinite(e)&&e>0,QW=e=>{if(!e||e.trim().endsWith(`%`))return null;let t=Number.parseFloat(e);return ZW(t)?t:null},$W=e=>{let t=e.getAttribute(`viewBox`)?.trim().split(/[\s,]+/).map(Number);if(t?.length===4&&ZW(t[2])&&ZW(t[3]))return{width:t[2],height:t[3]};let n=QW(e.getAttribute(`width`)),r=QW(e.getAttribute(`height`));if(n&&r)return{width:n,height:r};let i=e.getBoundingClientRect();if(ZW(i.width)&&ZW(i.height))return{width:i.width,height:i.height};try{let t=e.getBBox();if(ZW(t.width)&&ZW(t.height))return{width:t.width,height:t.height}}catch{}return YW},eG=(e,t)=>{let n=Math.max(JW,t.width-GW*2),r=Math.max(JW,t.height-GW*2),i=Math.min(1,n/e.width,r/e.height);return ZW(i)?i:1},tG=(e,t,n)=>{let r=e.width*n,i=e.height*n,a=Math.max(t.width,r+GW*2),o=Math.max(t.height,i+GW*2);return{width:a,height:o,diagramWidth:r,diagramHeight:i,diagramLeft:Math.max(GW,(a-r)/2),diagramTop:Math.max(GW,(o-i)/2)}},nG=(e,t,n)=>Math.min(n,Math.max(t,e)),rG=(0,p.memo)(({svg:e,stageRef:t})=>(0,X.jsx)(`div`,{ref:t,"data-testid":`mermaid-preview-stage`,className:`relative shrink-0`,dangerouslySetInnerHTML:{__html:e}})),iG=({mermaid:e,open:t,onClose:n})=>{let{t:r}=K(`common`),[i,a]=(0,p.useState)({kind:`loading`}),[o,s]=(0,p.useState)(null),[c,l]=(0,p.useState)(null),u=(0,p.useRef)(null),d=(0,p.useRef)(null),f=(0,p.useRef)(null),m=(0,p.useRef)(null),h=(0,p.useRef)(null),g=(0,p.useRef)(null),_=(0,p.useRef)(null),v=`mermaid-preview-${(0,p.useId)().replace(/:/g,``)}`,y=(0,p.useCallback)((e,t=!0)=>{let n=u.current,r=_.current;!r||e!==void 0&&r.pointerId!==e||(t&&n?.hasPointerCapture?.(r.pointerId)&&n.releasePointerCapture(r.pointerId),document.body.style.userSelect=r.previousUserSelect,n?.removeAttribute(`data-dragging`),_.current=null)},[]),b=(0,p.useCallback)((e,t=null)=>{let n=u.current,r=d.current,i=r?.querySelector(`svg`),a=f.current,o=m.current,c=g.current;if(!n||!r||!i||!a||!o||c===null)return;let p=nG(e,c,KW),_=tG(a,o,p);r.style.width=`${_.width}px`,r.style.height=`${_.height}px`,r.dataset.diagramWidth=`${_.diagramWidth}`,r.dataset.diagramHeight=`${_.diagramHeight}`,i.setAttribute(`width`,`${_.diagramWidth}`),i.setAttribute(`height`,`${_.diagramHeight}`),i.style.width=`${_.diagramWidth}px`,i.style.height=`${_.diagramHeight}px`,i.style.maxWidth=`none`,i.style.maxHeight=`none`,i.style.position=`absolute`,i.style.left=`${_.diagramLeft}px`,i.style.top=`${_.diagramTop}px`;let v=Math.max(0,_.width-o.width),y=Math.max(0,_.height-o.height),b=t?_.diagramLeft+t.x*p-o.width/2:v/2,x=t?_.diagramTop+t.y*p-o.height/2:y/2;n.scrollLeft=nG(b,0,v),n.scrollTop=nG(x,0,y),h.current=p,s(p),l(c)},[]),x=(0,p.useCallback)(()=>{let e=u.current,t=f.current,n=m.current,r=h.current;if(!e||!t||!n||r===null)return null;let i=tG(t,n,r);return{x:(e.scrollLeft+n.width/2-i.diagramLeft)/r,y:(e.scrollTop+n.height/2-i.diagramTop)/r}},[]),S=(0,p.useCallback)(()=>{let e=f.current,t=m.current;if(!e||!t)return;let n=eG(e,t);g.current=n,b(n)},[b]),C=e=>{let t=h.current;t!==null&&b(t*e,x())};(0,p.useEffect)(()=>{if(!t)return;let n=!1;return a({kind:`loading`}),(async()=>{try{let t=await BW(()=>import(`./mermaid.core-YpvipwZo.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]));if(n)return;let r=t.default;r.initialize({startOnLoad:!1,theme:`dark`,themeVariables:{primaryColor:`#8b5cf6`,primaryTextColor:`#e2e8f0`,lineColor:`#94a3b8`,secondaryColor:`#1e293b`,tertiaryColor:`#334155`}});let i=XW(e);if(await r.parse(i),n)return;let{svg:o}=await r.render(v,i);if(n)return;a({kind:`rendered`,svg:o})}catch{n||a({kind:`error`,rawText:e})}})(),()=>{n=!0}},[e,v,t]),(0,p.useLayoutEffect)(()=>{if(!t||i.kind!==`rendered`)return;let e=d.current?.querySelector(`svg`);if(!e)return;let n=$W(e);return f.current=n,e.dataset.intrinsicWidth=`${n.width}`,e.dataset.intrinsicHeight=`${n.height}`,m.current&&S(),()=>{y(),f.current=null,h.current=null,g.current=null,s(null),l(null)}},[y,t,S,i]),(0,p.useLayoutEffect)(()=>{if(!t||i.kind!==`rendered`)return;let e=u.current;if(!e)return;let n=()=>{let t=e.clientWidth,n=e.clientHeight;if(!ZW(t)||!ZW(n))return;let r=m.current,i=f.current,a=h.current,o=g.current,s=r&&i&&a!==null?x():null,c={width:t,height:n};if(m.current=c,!i)return;let l=eG(i,c);g.current=l;let u=a===null||o===null||Math.abs(a-o)<1e-4;b(u?l:a,u?null:s)},r=new ResizeObserver(n);return r.observe(e),n(),()=>{r.disconnect(),m.current=null}},[b,x,t,i.kind]),(0,p.useEffect)(()=>()=>{y()},[y]);let w=e=>{if(e.pointerType!==`mouse`||e.button!==0||o===null)return;let t=e.currentTarget;y(),_.current={pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,previousUserSelect:document.body.style.userSelect},document.body.style.userSelect=`none`,t.dataset.dragging=`true`,t.setPointerCapture(e.pointerId),e.preventDefault()},T=e=>{let t=_.current,n=f.current,r=m.current,i=h.current;if(!t||t.pointerId!==e.pointerId||!n||!r||i===null)return;let a=tG(n,r,i);e.currentTarget.scrollLeft=nG(t.scrollLeft-(e.clientX-t.clientX),0,Math.max(0,a.width-r.width)),e.currentTarget.scrollTop=nG(t.scrollTop-(e.clientY-t.clientY),0,Math.max(0,a.height-r.height)),e.preventDefault()},E=e=>{y(e.pointerId)},D=e=>{y(e.pointerId,!1)},O=o===null?0:Math.round(o*100);return(0,X.jsx)(S_,{open:t,onOpenChange:e=>{e||n()},children:(0,X.jsxs)(w_,{showCloseButton:!1,overlayClassName:`bg-black/80`,className:`flex h-[calc(100vh-1rem)] max-h-[calc(100vh-1rem)] w-[calc(100vw-1rem)] max-w-[calc(100vw-1rem)] sm:max-w-[calc(100vw-1rem)] flex-col gap-0 overflow-hidden border-border/80 bg-background/95 p-0 shadow-2xl`,children:[(0,X.jsx)(D_,{className:`sr-only`,children:r(`mermaidPreviewDialog.title`)}),(0,X.jsx)(O_,{className:`sr-only`,children:r(`mermaidPreviewDialog.description`)}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-b border-border/70 px-4 py-2.5 sm:px-5`,children:[(0,X.jsx)(`p`,{className:`min-w-0 truncate text-sm font-semibold text-foreground sm:text-base`,children:r(`mermaidPreviewDialog.title`)}),(0,X.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-1`,"aria-label":r(`mermaidPreviewDialog.controlsAriaLabel`),children:[o!==null&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.zoomOutAriaLabel`),variant:`ghost`,size:`icon-sm`,disabled:c!==null&&o<=c+1e-4,onClick:()=>C(1/qW),children:(0,X.jsx)(WW,{className:`h-4 w-4`})}),(0,X.jsx)(`span`,{className:`w-12 text-center text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,"aria-label":r(`mermaidPreviewDialog.zoomLevelAriaLabel`,{zoom:O}),children:r(`mermaidPreviewDialog.zoomLevel`,{zoom:O})}),(0,X.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.zoomInAriaLabel`),variant:`ghost`,size:`icon-sm`,disabled:o>=KW-1e-4,onClick:()=>C(qW),children:(0,X.jsx)(hv,{className:`h-4 w-4`})}),(0,X.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.resetViewAriaLabel`),variant:`ghost`,size:`icon-sm`,onClick:S,children:(0,X.jsx)(Hb,{className:`h-4 w-4`})})]}),(0,X.jsx)(C_,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-foreground`,children:(0,X.jsx)(Ub,{className:`h-4 w-4`})})})]})]}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center bg-black/35 p-2 sm:p-3`,children:[i.kind===`loading`&&(0,X.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`}),i.kind===`error`&&(0,X.jsx)(`pre`,{className:`max-h-full max-w-full overflow-auto rounded-md border border-border/50 bg-surface p-4 text-xs text-muted-foreground whitespace-pre-wrap`,children:i.rawText}),i.kind===`rendered`&&(0,X.jsx)(`div`,{ref:u,"data-testid":`mermaid-preview-viewport`,"aria-label":r(`mermaidPreviewDialog.canvasAriaLabel`),className:`h-full w-full cursor-grab overflow-auto data-[dragging=true]:cursor-grabbing`,onPointerDown:w,onPointerMove:T,onPointerUp:E,onPointerCancel:E,onLostPointerCapture:D,children:(0,X.jsx)(rG,{svg:i.svg,stageRef:d})})]})]})})},aG=`*, *::before, *::after { box-sizing: border-box; }
|
|
147
|
+
`).map(e=>e.trim()).filter(e=>e.length>0):[],LW=`modulepreload`,RW=function(e){return`/`+e},zW={},BW=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=RW(t,n),t in zW)return;zW[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:LW,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},VW=e=>e.replace(/\\"/g,`"`),HW=100,UW=({mermaid:e,className:t,onClick:n})=>{let{t:r}=K(`common`),[i,a]=(0,p.useState)({kind:`loading`}),o=`mermaid-${(0,p.useId)().replace(/:/g,``)}`;(0,p.useEffect)(()=>{let t=!1;if(a({kind:`loading`}),!e){a({kind:`error`,rawText:``});return}let n=window.setTimeout(()=>{(async()=>{try{let n=await BW(()=>import(`./mermaid.core-B9gr0Vqf.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]));if(t)return;let r=n.default;r.initialize({startOnLoad:!1,theme:`dark`,themeVariables:{primaryColor:`#8b5cf6`,primaryTextColor:`#e2e8f0`,lineColor:`#94a3b8`,secondaryColor:`#1e293b`,tertiaryColor:`#334155`}});let i=VW(e);if(await r.parse(i),t)return;let{svg:s}=await r.render(o,i);if(t)return;a({kind:`rendered`,svg:s})}catch{t||a({kind:`error`,rawText:e})}})()},HW);return()=>{t=!0,window.clearTimeout(n)}},[e,o]);let s=(0,p.useCallback)(()=>{i.kind===`rendered`&&n&&n()},[i,n]);return i.kind===`loading`?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8 ${t??``}`,children:(0,X.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`})}):i.kind===`error`?i.rawText?(0,X.jsxs)(`div`,{className:t,children:[(0,X.jsx)(`div`,{className:`mb-2 text-xs text-amber-400`,children:r(`specView.artifactPanel.mermaidParseError`)}),(0,X.jsx)(`pre`,{className:`overflow-auto rounded-md border border-border/50 bg-surface p-3 text-xs text-muted-foreground whitespace-pre-wrap`,children:i.rawText})]}):(0,X.jsx)(`div`,{className:`py-4 text-sm text-muted-foreground ${t??``}`,children:r(`specView.artifactPanel.noDiagram`)}):(0,X.jsx)(`div`,{className:`spec-mermaid-diagram flex justify-center ${n?`cursor-zoom-in`:``} ${t??``}`,dangerouslySetInnerHTML:{__html:i.svg},onClick:s,role:n?`button`:void 0,tabIndex:n?0:void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())}:void 0,"aria-label":n?r(`mermaidPreviewDialog.clickToExpand`):void 0})},WW=({className:e})=>(0,X.jsx)(lte,{"aria-hidden":`true`,className:e}),GW=24,KW=4,qW=1.25,JW=1,YW={width:800,height:600},XW=e=>e.replace(/\\"/g,`"`),ZW=e=>Number.isFinite(e)&&e>0,QW=e=>{if(!e||e.trim().endsWith(`%`))return null;let t=Number.parseFloat(e);return ZW(t)?t:null},$W=e=>{let t=e.getAttribute(`viewBox`)?.trim().split(/[\s,]+/).map(Number);if(t?.length===4&&ZW(t[2])&&ZW(t[3]))return{width:t[2],height:t[3]};let n=QW(e.getAttribute(`width`)),r=QW(e.getAttribute(`height`));if(n&&r)return{width:n,height:r};let i=e.getBoundingClientRect();if(ZW(i.width)&&ZW(i.height))return{width:i.width,height:i.height};try{let t=e.getBBox();if(ZW(t.width)&&ZW(t.height))return{width:t.width,height:t.height}}catch{}return YW},eG=(e,t)=>{let n=Math.max(JW,t.width-GW*2),r=Math.max(JW,t.height-GW*2),i=Math.min(1,n/e.width,r/e.height);return ZW(i)?i:1},tG=(e,t,n)=>{let r=e.width*n,i=e.height*n,a=Math.max(t.width,r+GW*2),o=Math.max(t.height,i+GW*2);return{width:a,height:o,diagramWidth:r,diagramHeight:i,diagramLeft:Math.max(GW,(a-r)/2),diagramTop:Math.max(GW,(o-i)/2)}},nG=(e,t,n)=>Math.min(n,Math.max(t,e)),rG=(0,p.memo)(({svg:e,stageRef:t})=>(0,X.jsx)(`div`,{ref:t,"data-testid":`mermaid-preview-stage`,className:`relative shrink-0`,dangerouslySetInnerHTML:{__html:e}})),iG=({mermaid:e,open:t,onClose:n})=>{let{t:r}=K(`common`),[i,a]=(0,p.useState)({kind:`loading`}),[o,s]=(0,p.useState)(null),[c,l]=(0,p.useState)(null),u=(0,p.useRef)(null),d=(0,p.useRef)(null),f=(0,p.useRef)(null),m=(0,p.useRef)(null),h=(0,p.useRef)(null),g=(0,p.useRef)(null),_=(0,p.useRef)(null),v=`mermaid-preview-${(0,p.useId)().replace(/:/g,``)}`,y=(0,p.useCallback)((e,t=!0)=>{let n=u.current,r=_.current;!r||e!==void 0&&r.pointerId!==e||(t&&n?.hasPointerCapture?.(r.pointerId)&&n.releasePointerCapture(r.pointerId),document.body.style.userSelect=r.previousUserSelect,n?.removeAttribute(`data-dragging`),_.current=null)},[]),b=(0,p.useCallback)((e,t=null)=>{let n=u.current,r=d.current,i=r?.querySelector(`svg`),a=f.current,o=m.current,c=g.current;if(!n||!r||!i||!a||!o||c===null)return;let p=nG(e,c,KW),_=tG(a,o,p);r.style.width=`${_.width}px`,r.style.height=`${_.height}px`,r.dataset.diagramWidth=`${_.diagramWidth}`,r.dataset.diagramHeight=`${_.diagramHeight}`,i.setAttribute(`width`,`${_.diagramWidth}`),i.setAttribute(`height`,`${_.diagramHeight}`),i.style.width=`${_.diagramWidth}px`,i.style.height=`${_.diagramHeight}px`,i.style.maxWidth=`none`,i.style.maxHeight=`none`,i.style.position=`absolute`,i.style.left=`${_.diagramLeft}px`,i.style.top=`${_.diagramTop}px`;let v=Math.max(0,_.width-o.width),y=Math.max(0,_.height-o.height),b=t?_.diagramLeft+t.x*p-o.width/2:v/2,x=t?_.diagramTop+t.y*p-o.height/2:y/2;n.scrollLeft=nG(b,0,v),n.scrollTop=nG(x,0,y),h.current=p,s(p),l(c)},[]),x=(0,p.useCallback)(()=>{let e=u.current,t=f.current,n=m.current,r=h.current;if(!e||!t||!n||r===null)return null;let i=tG(t,n,r);return{x:(e.scrollLeft+n.width/2-i.diagramLeft)/r,y:(e.scrollTop+n.height/2-i.diagramTop)/r}},[]),S=(0,p.useCallback)(()=>{let e=f.current,t=m.current;if(!e||!t)return;let n=eG(e,t);g.current=n,b(n)},[b]),C=e=>{let t=h.current;t!==null&&b(t*e,x())};(0,p.useEffect)(()=>{if(!t)return;let n=!1;return a({kind:`loading`}),(async()=>{try{let t=await BW(()=>import(`./mermaid.core-B9gr0Vqf.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]));if(n)return;let r=t.default;r.initialize({startOnLoad:!1,theme:`dark`,themeVariables:{primaryColor:`#8b5cf6`,primaryTextColor:`#e2e8f0`,lineColor:`#94a3b8`,secondaryColor:`#1e293b`,tertiaryColor:`#334155`}});let i=XW(e);if(await r.parse(i),n)return;let{svg:o}=await r.render(v,i);if(n)return;a({kind:`rendered`,svg:o})}catch{n||a({kind:`error`,rawText:e})}})(),()=>{n=!0}},[e,v,t]),(0,p.useLayoutEffect)(()=>{if(!t||i.kind!==`rendered`)return;let e=d.current?.querySelector(`svg`);if(!e)return;let n=$W(e);return f.current=n,e.dataset.intrinsicWidth=`${n.width}`,e.dataset.intrinsicHeight=`${n.height}`,m.current&&S(),()=>{y(),f.current=null,h.current=null,g.current=null,s(null),l(null)}},[y,t,S,i]),(0,p.useLayoutEffect)(()=>{if(!t||i.kind!==`rendered`)return;let e=u.current;if(!e)return;let n=()=>{let t=e.clientWidth,n=e.clientHeight;if(!ZW(t)||!ZW(n))return;let r=m.current,i=f.current,a=h.current,o=g.current,s=r&&i&&a!==null?x():null,c={width:t,height:n};if(m.current=c,!i)return;let l=eG(i,c);g.current=l;let u=a===null||o===null||Math.abs(a-o)<1e-4;b(u?l:a,u?null:s)},r=new ResizeObserver(n);return r.observe(e),n(),()=>{r.disconnect(),m.current=null}},[b,x,t,i.kind]),(0,p.useEffect)(()=>()=>{y()},[y]);let w=e=>{if(e.pointerType!==`mouse`||e.button!==0||o===null)return;let t=e.currentTarget;y(),_.current={pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,previousUserSelect:document.body.style.userSelect},document.body.style.userSelect=`none`,t.dataset.dragging=`true`,t.setPointerCapture(e.pointerId),e.preventDefault()},T=e=>{let t=_.current,n=f.current,r=m.current,i=h.current;if(!t||t.pointerId!==e.pointerId||!n||!r||i===null)return;let a=tG(n,r,i);e.currentTarget.scrollLeft=nG(t.scrollLeft-(e.clientX-t.clientX),0,Math.max(0,a.width-r.width)),e.currentTarget.scrollTop=nG(t.scrollTop-(e.clientY-t.clientY),0,Math.max(0,a.height-r.height)),e.preventDefault()},E=e=>{y(e.pointerId)},D=e=>{y(e.pointerId,!1)},O=o===null?0:Math.round(o*100);return(0,X.jsx)(S_,{open:t,onOpenChange:e=>{e||n()},children:(0,X.jsxs)(w_,{showCloseButton:!1,overlayClassName:`bg-black/80`,className:`flex h-[calc(100vh-1rem)] max-h-[calc(100vh-1rem)] w-[calc(100vw-1rem)] max-w-[calc(100vw-1rem)] sm:max-w-[calc(100vw-1rem)] flex-col gap-0 overflow-hidden border-border/80 bg-background/95 p-0 shadow-2xl`,children:[(0,X.jsx)(D_,{className:`sr-only`,children:r(`mermaidPreviewDialog.title`)}),(0,X.jsx)(O_,{className:`sr-only`,children:r(`mermaidPreviewDialog.description`)}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-b border-border/70 px-4 py-2.5 sm:px-5`,children:[(0,X.jsx)(`p`,{className:`min-w-0 truncate text-sm font-semibold text-foreground sm:text-base`,children:r(`mermaidPreviewDialog.title`)}),(0,X.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-1`,"aria-label":r(`mermaidPreviewDialog.controlsAriaLabel`),children:[o!==null&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.zoomOutAriaLabel`),variant:`ghost`,size:`icon-sm`,disabled:c!==null&&o<=c+1e-4,onClick:()=>C(1/qW),children:(0,X.jsx)(WW,{className:`h-4 w-4`})}),(0,X.jsx)(`span`,{className:`w-12 text-center text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,"aria-label":r(`mermaidPreviewDialog.zoomLevelAriaLabel`,{zoom:O}),children:r(`mermaidPreviewDialog.zoomLevel`,{zoom:O})}),(0,X.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.zoomInAriaLabel`),variant:`ghost`,size:`icon-sm`,disabled:o>=KW-1e-4,onClick:()=>C(qW),children:(0,X.jsx)(hv,{className:`h-4 w-4`})}),(0,X.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.resetViewAriaLabel`),variant:`ghost`,size:`icon-sm`,onClick:S,children:(0,X.jsx)(Hb,{className:`h-4 w-4`})})]}),(0,X.jsx)(C_,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,"aria-label":r(`mermaidPreviewDialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-foreground`,children:(0,X.jsx)(Ub,{className:`h-4 w-4`})})})]})]}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center bg-black/35 p-2 sm:p-3`,children:[i.kind===`loading`&&(0,X.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`}),i.kind===`error`&&(0,X.jsx)(`pre`,{className:`max-h-full max-w-full overflow-auto rounded-md border border-border/50 bg-surface p-4 text-xs text-muted-foreground whitespace-pre-wrap`,children:i.rawText}),i.kind===`rendered`&&(0,X.jsx)(`div`,{ref:u,"data-testid":`mermaid-preview-viewport`,"aria-label":r(`mermaidPreviewDialog.canvasAriaLabel`),className:`h-full w-full cursor-grab overflow-auto data-[dragging=true]:cursor-grabbing`,onPointerDown:w,onPointerMove:T,onPointerUp:E,onPointerCancel:E,onLostPointerCapture:D,children:(0,X.jsx)(rG,{svg:i.svg,stageRef:d})})]})]})})},aG=`*, *::before, *::after { box-sizing: border-box; }
|
|
148
148
|
html, body {
|
|
149
149
|
margin: 0;
|
|
150
150
|
padding: 16px;
|
|
@@ -272,5 +272,5 @@ ${s.join(`
|
|
|
272
272
|
`),r=Math.max(0,t-4),i=Math.min(n.length,t+3);return n.slice(r,i).map((e,t)=>`${r+t+1}: ${e}`).join(`
|
|
273
273
|
`)},Kpe=e=>e?.status?[jb.t(`common:chatChangesPanel.fileStatus.${e.status}`),e.staged&&jb.t(`common:chatChangesPanel.fileStatus.staged`),e.unstaged&&jb.t(`common:chatChangesPanel.fileStatus.unstaged`),e.conflicted&&jb.t(`common:chatChangesPanel.fileStatus.conflicted`)].filter(Boolean).join(`, `):L6(`tracked`),qpe=({file:e,viewMode:t,comments:n,canComment:r,searchMatches:i,activeSearchMatchIndex:a,onAddComment:o})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:Z(`flex min-h-0 flex-1 flex-col`,t===`preview`&&`hidden`),children:(0,X.jsx)(Ape,{file:e,comments:n,canComment:r,isActive:t===`source`,searchMatches:i,activeSearchMatchIndex:a,onAddComment:o})}),t===`preview`&&(0,X.jsx)(kpe,{content:e.content})]}),Jpe=({projectId:e,target:t,isActive:n,canAddComments:r,comments:i,onCommentsChange:a,requestedPath:o=null,onRequestedPathHandled:s,onViewChanges:c,headerControls:l})=>{let[u,d]=(0,p.useState)(null),[f,m]=(0,p.useState)(null),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(``),y=(0,p.useDeferredValue)(_),[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(new Set),[w,T]=(0,p.useState)(null),[E,D]=(0,p.useState)(`source`),[O,k]=(0,p.useState)({kind:`empty`}),[A,j]=(0,p.useState)(!1),[M,N]=(0,p.useState)(``),[P,F]=(0,p.useState)(-1),I=(0,p.useRef)(new Map),L=(0,p.useRef)(null),R=(0,p.useRef)(null),z=(0,p.useRef)(o),ee=(0,p.useRef)(i),B=(0,p.useRef)(null),V=(0,p.useRef)(null),te=(0,p.useRef)(null),H=(0,p.useRef)(0),U=(0,p.useRef)(0),ne=(0,p.useRef)(0),re=(0,p.useRef)(null),ie=(0,p.useRef)(null),ae=(0,p.useRef)(!1),oe=(0,p.useMemo)(()=>{if(!u)return[];let e=y.trim().toLocaleLowerCase();return u.entries.filter(t=>{let n=!e||t.path.toLocaleLowerCase().includes(e),r=!b||t.status!==null;return n&&r})},[u,y,b]);L.current=u,R.current=w,z.current=o,ee.current=i;let W=(0,p.useCallback)(e=>{ee.current=e,a(e)},[a]),se=(0,p.useCallback)(()=>{j(!1),N(``),F(-1)},[]),ce=e?F6(e,t):null;(0,p.useEffect)(()=>{if(!e||!ce||B.current===ce||(B.current=ce,ee.current.length>0))return;let n=Hpe(localStorage.getItem(ce),t);n.length>0&&(W(n),I6(e,n).then(e=>{let t=new Map(e.map(e=>[e.id,e.stale])),n=ee.current,r=n.map(e=>{let n=t.get(e.id);return n===void 0?e:{...e,stale:n}});r.some((e,t)=>e.stale!==n[t]?.stale)&&W(r)}))},[W,e,ce,t]),(0,p.useEffect)(()=>{if(ce){if(i.length===0){localStorage.removeItem(ce);return}localStorage.setItem(ce,JSON.stringify(i))}},[i,ce]);let le=(0,p.useCallback)(async(n,r=!1)=>{if(!e)return;V.current?.abort(),U.current+=1;let i=U.current;if((L.current?.entries.find(e=>e.path===n)??null)?.status===`deleted`){k({kind:`unsupported`,path:n,reason:`deleted`,message:R6(`deleted`)});return}let a=I.current.get(n);if(a&&!r){k({kind:`content`,content:a});return}let o=new AbortController;V.current=o,k({kind:`loading`,path:n});try{let a=await w6(e,t,n,o.signal,r);if(i!==U.current)return;for(I.current.delete(n),I.current.set(n,a);I.current.size>Upe;){let e=I.current.keys().next().value;if(typeof e!=`string`)break;I.current.delete(e)}k({kind:`content`,content:a});let s=ee.current,c=s.map(e=>e.filePath===n?{...e,stale:e.contentSignature!==a.content_signature}:e);c.some((e,t)=>e.stale!==s[t]?.stale)&&W(c)}catch(e){if(i!==U.current||Ye(e))return;if(e instanceof Ke){let t=Wpe(e);if(t){k({kind:`unsupported`,path:n,reason:t.reason,message:R6(t.reason)});return}}k({kind:`error`,path:n,message:e instanceof Error?e.message:L6(`contentError`)})}},[W,e,t]),ue=(0,p.useCallback)(e=>{se(),R.current=e,T(e),D(z6(e)?`preview`:`source`),le(e)},[le,se]),de=(0,p.useCallback)(async(n=!1)=>{if(!e){m(L6(`noProject`));return}let r=new AbortController;te.current?.abort(),te.current=r,H.current+=1;let i=H.current;g(!0),m(null);try{let a=await ype(e,t,r.signal,n);if(i!==H.current)return;let o=L.current?.workspace_signature,s=o!==void 0&&o!==a.workspace_signature;L.current=a,d(a),s&&I.current.clear();let c=R.current;if(!c){let e=a.entries.filter(e=>e.status!==`deleted`);!z.current&&e.length===1&&ue(e[0].path);return}if(!a.entries.some(e=>e.path===c)){V.current?.abort(),U.current+=1,R.current=null,T(null),D(`source`),k({kind:`empty`}),se();return}(s||n)&&(I.current.delete(c),le(c,!0))}catch(e){i===H.current&&!Ye(e)&&m(e instanceof Error?e.message:L6(`manifestError`))}finally{i===H.current&&g(!1)}},[le,e,se,ue,t]);(0,p.useEffect)(()=>{if(!n){te.current?.abort(),V.current?.abort(),H.current+=1,U.current+=1;return}de(),re.current?.focus()},[n,de]),(0,p.useEffect)(()=>()=>{te.current?.abort(),V.current?.abort(),H.current+=1,U.current+=1},[]),(0,p.useEffect)(()=>{if(!o||!u)return;let e=u.entries.find(e=>e.path===o);if(!e||e.status===`deleted`){s?.(o);return}let t=o.split(`/`);C(e=>{let n=new Set(e);for(let e=1;e<t.length;e+=1)n.add(t.slice(0,e).join(`/`));return n}),ue(o),s?.(o)},[u,s,o,ue]),(0,p.useEffect)(()=>{oe.length===1&&w===null&&ue(oe[0].path)},[oe,w,ue]),(0,p.useEffect)(()=>{n&&!ae.current&&!o&&re.current?.focus(),ae.current=n},[n,o]);let fe=u?.entries.find(e=>e.path===w)??null,pe=z6(w)&&O.kind===`content`&&O.content.path===w,me=pe&&O.content.content.length>1e5,he=me?`source`:E,ge=(0,p.useMemo)(()=>{if(!A||O.kind!==`content`||M.length===0||/[\r\n]/.test(M))return[];let e=M.toLocaleLowerCase(),t=[];return O.content.content.split(`
|
|
274
274
|
`).forEach((n,r)=>{let i=n.toLocaleLowerCase(),a=i.indexOf(e);for(;a!==-1;)t.push({lineIndex:r,start:a,end:a+M.length}),a=i.indexOf(e,a+M.length)}),t},[M,O,A]),_e=ge.length>0?Math.min(Math.max(P,0),ge.length-1):-1,ve=(0,p.useMemo)(()=>i.filter(e=>e.filePath===w),[i,w]),ye=(0,p.useMemo)(()=>{let e=new Map;return i.forEach(t=>e.set(t.filePath,(e.get(t.filePath)??0)+1)),e},[i]),be=(0,p.useCallback)((e,n)=>{if(O.kind!==`content`)return;let r=O.content.content.split(`
|
|
275
|
-
`);ne.current+=1,W([...ee.current,{kind:`source`,id:`${O.content.path}:${e}:${Date.now()}:${ne.current}`,target:t,filePath:O.content.path,lineNumber:e,lineContent:r[e-1]??``,sourceContext:Gpe(O.content.content,e),contentSignature:O.content.content_signature,comment:n,stale:!1}])},[W,O,t]);(0,p.useEffect)(()=>{me&&D(`source`)},[me]);let xe=(0,p.useCallback)(()=>{O.kind===`content`&&(D(`source`),j(!0))},[O.kind]),Se=(0,p.useCallback)(e=>{ge.length!==0&&F(t=>((t<0?0:Math.min(t,ge.length-1))+e+ge.length)%ge.length)},[ge.length]);return(0,p.useEffect)(()=>{A&&ie.current?.focus({preventScroll:!0})},[A]),(0,p.useEffect)(()=>{let e=e=>{if(!(!n||O.kind!==`content`||e.defaultPrevented)){if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.key.toLocaleLowerCase()===`f`){e.preventDefault(),xe(),requestAnimationFrame(()=>ie.current?.focus({preventScroll:!0}));return}A&&e.key===`Escape`&&(e.preventDefault(),se())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O.kind,n,A,xe,se]),(0,X.jsxs)(`section`,{className:`flex min-h-0 flex-1 overflow-hidden rounded-xl border border-border`,"aria-label":`Files mode`,children:[(0,X.jsxs)(`aside`,{className:`flex w-80 shrink-0 flex-col border-r border-border bg-muted/10`,"aria-label":L6(`fileBrowser`),children:[(0,X.jsxs)(`div`,{className:`space-y-3 border-b border-border p-3`,children:[(0,X.jsxs)(`label`,{className:`block text-xs text-muted-foreground`,children:[L6(`searchFiles`),(0,X.jsx)(k_,{ref:re,type:`search`,className:`mt-1 h-8`,value:_,onChange:e=>v(e.target.value),placeholder:L6(`searchPlaceholder`)})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-foreground`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked)}),L6(`changedOnly`)]}),(0,X.jsx)(lv,{content:L6(`refreshFiles`),children:(0,X.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":L6(`refreshFiles`),disabled:h,onClick:()=>{de(!0)},children:h?(0,X.jsx)(Tv,{className:`size-3.5 animate-spin`}):(0,X.jsx)(Hb,{className:`size-3.5`})})})]})]}),h&&!u&&(0,X.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:L6(`loadingManifest`)}),f&&(0,X.jsxs)(`div`,{className:`space-y-3 p-4 text-sm text-destructive`,children:[(0,X.jsx)(`p`,{children:f}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void de(),children:L6(`retry`)})]}),u&&(0,X.jsxs)(X.Fragment,{children:[u.truncated&&(0,X.jsx)(`div`,{className:`border-b border-border px-3 py-2 text-xs text-amber-300`,children:L6(`truncated`)}),(0,X.jsx)(Bpe,{entries:u.entries,search:y,changedOnly:b,expandedPaths:S,selectedPath:w,commentCounts:ye,onExpandedPathsChange:C,onSelectPath:ue})]})]}),(0,X.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,X.jsxs)(`header`,{"data-testid":`workspace-file-header`,className:`flex min-h-12 shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`truncate font-mono text-xs text-foreground`,children:w??L6(`selectFile`)}),fe&&(0,X.jsx)(`div`,{className:`mt-0.5 text-[11px] capitalize text-muted-foreground`,children:Kpe(fe)})]}),(O.kind===`content`||pe||l||w&&fe?.status&&c)&&(0,X.jsxs)(`div`,{"data-testid":`workspace-file-header-actions`,className:`flex shrink-0 flex-wrap items-center justify-end gap-2 pr-10`,children:[pe&&(0,X.jsxs)(`div`,{className:`flex items-center rounded-lg border border-border bg-muted/20 p-0.5`,role:`group`,"aria-label":L6(`viewMode.ariaLabel`),children:[(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:he===`preview`?`secondary`:`ghost`,"aria-pressed":he===`preview`,disabled:me,onClick:()=>{D(`preview`)},children:L6(`viewMode.preview`)}),(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:he===`source`?`secondary`:`ghost`,"aria-pressed":he===`source`,onClick:()=>{D(`source`)},children:L6(`viewMode.source`)})]}),me&&(0,X.jsx)(`p`,{className:`text-xs text-amber-200`,role:`status`,children:L6(`viewMode.sourceRequiredLargeFile`)}),O.kind===`content`&&!A&&(0,X.jsx)(lv,{content:L6(`source.search.open`),children:(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":L6(`source.search.open`),onClick:xe,children:(0,X.jsx)(vpe,{className:`size-4`})})}),O.kind===`content`&&A&&(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 rounded-lg border border-border bg-muted/20 p-1`,role:`search`,children:[(0,X.jsx)(k_,{ref:ie,type:`search`,className:`h-7 w-40 rounded-md px-2 text-xs sm:w-56`,"aria-label":L6(`source.search.inputLabel`),placeholder:L6(`source.search.placeholder`),value:M,onChange:e=>{N(e.target.value),F(0)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Se(e.shiftKey?-1:1))}}),(0,X.jsx)(`output`,{className:`min-w-12 whitespace-nowrap px-1 text-center text-[11px] text-muted-foreground`,"aria-live":`polite`,children:ge.length>0?L6(`source.search.matchCount`,{current:_e+1,total:ge.length}):L6(`source.search.noMatches`)}),(0,X.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":L6(`source.search.previous`),disabled:ge.length===0,onClick:()=>Se(-1),children:(0,X.jsx)(mv,{className:`size-3.5 rotate-180`})}),(0,X.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":L6(`source.search.next`),disabled:ge.length===0,onClick:()=>Se(1),children:(0,X.jsx)(mv,{className:`size-3.5`})}),(0,X.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":L6(`source.search.close`),onClick:se,children:(0,X.jsx)(Ub,{className:`size-3.5`})})]}),w&&fe?.status&&c&&(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>c(w),children:L6(`viewChanges`)}),l]})]}),O.kind===`empty`&&(0,X.jsx)(`div`,{className:`m-auto max-w-sm text-center text-sm text-muted-foreground`,children:L6(`empty`)}),O.kind===`loading`&&(0,X.jsx)(`div`,{className:`m-auto text-sm text-muted-foreground`,children:L6(`loadingFile`,{path:O.path})}),O.kind===`unsupported`&&(0,X.jsxs)(`div`,{className:`m-auto max-w-md space-y-2 text-center`,children:[(0,X.jsx)(hC,{variant:`outline`,className:`capitalize`,children:O.reason.replace(/_/g,` `)}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:O.message})]}),O.kind===`error`&&(0,X.jsxs)(`div`,{className:`m-auto max-w-md space-y-3 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm text-destructive`,children:O.message}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void le(O.path,!0),children:L6(`retry`)})]}),O.kind===`content`&&(0,X.jsx)(qpe,{file:O.content,viewMode:he,comments:ve,canComment:r,searchMatches:ge,activeSearchMatchIndex:_e,onAddComment:be})]})]})},B6=r({WorkspaceReviewModal:()=>H6}),V6=e=>jb.t(`common:workspaceReviewModal.${e}`),Ype=({activeMode:e,availableModes:t,onModeChange:n})=>(0,X.jsx)(`div`,{role:`tablist`,"aria-label":V6(`modeAriaLabel`),className:`flex items-center gap-1 rounded-lg border border-border/80 bg-muted/30 p-1`,children:t.map(t=>(0,X.jsxs)(Q,{type:`button`,role:`tab`,size:`sm`,variant:e===t?`secondary`:`ghost`,"aria-selected":e===t,"aria-controls":`workspace-review-${t}-panel`,onClick:()=>n(t),children:[t===`files`?(0,X.jsx)(Sv,{className:`h-4 w-4`}):(0,X.jsx)(Cv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:V6(t)})]},t))}),H6=({target:e,initialMode:t=`changes`,reviewMode:n,onReviewModeChange:r,enabledModes:i=[`changes`],filesView:a,fileTarget:o,bundleTargetName:s=null,onClose:c,title:l,mode:u,onModeChange:d,canToggleMode:f=!1,modeActions:m,...h})=>{let[g,_]=(0,p.useState)(t),v=n??g,y=i.includes(v)?i:[v,...i],[b]=(0,p.useState)(e),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)([]),[D,O]=(0,p.useState)([]),k=(0,p.useRef)(D),[A,j]=(0,p.useState)(null);k.current=D;let M=(0,p.useCallback)(e=>{k.current=e,O(e)},[]),N=(0,p.useCallback)(()=>{k.current=[],O([])},[]),P=y.length>1,F=P&&a===void 0,[I]=(0,p.useState)(s),[L]=(0,p.useState)(()=>o??(b.scope===`project_root`?h.targetKind===`bundle`&&h.reviewCommentsBundleId?{kind:`bundle`,bundle_id:h.reviewCommentsBundleId,ticket_id:null}:{kind:`repo_root`,bundle_id:null,ticket_id:null}:h.reviewCommentsBundleId?{kind:`bundle`,bundle_id:h.reviewCommentsBundleId,ticket_id:null}:{kind:`ticket`,bundle_id:null,ticket_id:b.ticketId})),R=L.kind===`repo_root`?jb.t(`common:workspaceFiles.repositoryRoot`):L.kind===`bundle`?jb.t(`common:workspaceFiles.bundleTarget`,{name:I||L.bundle_id}):jb.t(`common:workspaceFiles.ticketTarget`,{id:L.ticket_id}),z=L.kind===`ticket`?l:R,ee=(0,p.useCallback)(async()=>{if(!h.projectId||D.length===0)return D;let e=await I6(h.projectId,D),t=new Map(e.map(e=>[e.id,e.stale])),n=k.current.map(e=>{let n=t.get(e.id);return n===void 0?e:{...e,stale:n}});return M(n),n},[h.projectId,D,M]),B=(0,p.useCallback)(()=>{h.projectId&&localStorage.removeItem(F6(h.projectId,L)),N()},[h.projectId,N,L]),V=(0,p.useCallback)(e=>{r?.(e),n===void 0&&_(e)},[r,n]),te=(0,p.useCallback)(e=>{S(e),V(`changes`)},[V]),H=(0,p.useCallback)(e=>{w(e),V(`files`)},[V]),U=(0,p.useCallback)(e=>{S(t=>t===e?null:t)},[]),ne=(0,p.useCallback)(e=>{w(t=>t===e?null:t)},[]),re=(0,p.useCallback)(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u!==void 0&&d&&(0,X.jsx)(UY,{value:u,disabled:!f||h.isUpdatingMode,onChange:d,planInactiveTooltip:(0,X.jsx)(eX,{label:jb.t(`common:ticketChangesModal.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(eX,{label:jb.t(`common:ticketChangesModal.switchToBuild`)})}),m,(0,X.jsx)(D3,{reviewComments:T,reviewFindings:e.reviewFindings,githubComments:e.githubComments,pendingFixCount:e.pendingFixCount,canSendReview:e.canSendReview,isSubmittingReview:e.isSubmittingReview,reviewSubmitDisabledReason:e.reviewSubmitDisabledReason,onClearPendingFixes:e.onClearPendingFixes,onSubmitReview:e.onSubmitReview,onUpdateReviewComment:e.onUpdateReviewComment,onRemoveReviewComment:e.onRemoveReviewComment})]}),[f,h.isUpdatingMode,u,m,d,T]),ie=(0,p.useCallback)(()=>A?re(A):null,[re,A]);return(0,p.useEffect)(()=>{if(!d||u===void 0)return;let e=e=>{!ZY(e)||!f||(e.preventDefault(),d(XY(u)))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[f,u,d]),(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(uC,{onClose:c,overlayClassName:`z-[70] bg-black/30 p-[5vh]`,panelClassName:`flex h-[92vh] w-full max-w-none flex-col overflow-hidden rounded-2xl border border-border bg-card p-6 shadow-2xl`,closeButtonLabel:V6(`closeAriaLabel`),renderContent:({closeButton:e})=>{let t=P?(0,X.jsx)(Ype,{activeMode:v,availableModes:y,onModeChange:V}):null,n=P?(0,X.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:t}):null,r=b.scope===`ticket`?(0,X.jsx)(S6,{...h,...b,projectId:h.projectId,title:l,onClose:c,mode:u,onModeChange:d,canToggleMode:f,headerControls:n,isActive:v===`changes`,onPendingReviewCommentsChange:E,onReviewControlsStateChange:j,renderReviewControls:re,showReviewControls:!P||v===`changes`,sourceReviewComments:D,onSourceReviewCommentsChange:M,onClearSourceReviewComments:N,onSourceReviewCommentsSubmitted:B,onValidateSourceReviewComments:ee,requestedDiffPath:x,onRequestedDiffPathHandled:U,onViewCurrentFile:F?H:void 0}):(0,X.jsx)(S6,{...h,scope:`project_root`,projectId:h.projectId,title:l,onClose:c,mode:u,onModeChange:d,canToggleMode:f,headerControls:n,isActive:v===`changes`,onPendingReviewCommentsChange:E,onReviewControlsStateChange:j,renderReviewControls:re,showReviewControls:!P||v===`changes`,sourceReviewComments:D,onSourceReviewCommentsChange:M,onClearSourceReviewComments:N,onSourceReviewCommentsSubmitted:B,onValidateSourceReviewComments:ee,requestedDiffPath:x,onRequestedDiffPathHandled:U,onViewCurrentFile:F?H:void 0}),i=P?(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[v===`files`&&(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-4`,children:[(0,X.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-lg font-semibold text-foreground`,children:z}),(0,X.jsx)(`div`,{"data-testid":`workspace-review-files-header-actions`,className:`flex min-w-0 max-w-full items-center gap-2 pr-10`,children:(0,X.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:t})})]}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,X.jsx)(`div`,{id:`workspace-review-changes-panel`,role:`tabpanel`,hidden:v!==`changes`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":v===`changes`,children:r}),(0,X.jsx)(`div`,{id:`workspace-review-files-panel`,role:`tabpanel`,hidden:v!==`files`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":v===`files`,children:a??(0,X.jsx)(Jpe,{projectId:h.projectId,target:L,isActive:v===`files`,canAddComments:h.canAddReviewComments??!1,comments:D,onCommentsChange:M,requestedPath:C,onRequestedPathHandled:ne,onViewChanges:te,headerControls:v===`files`&&A?ie():void 0})})]})]}):r;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`absolute right-4 top-4 z-10 mt-2`,children:e}),i]})}})})},Xpe=e=>!(e instanceof Ke)||e.status!==409||typeof e.data!=`object`||e.data===null?!1:`code`in e.data&&e.data.code===`build_open_questions_changed`,Zpe=e=>{let t=new Map((e.execution_order_ticket_ids??[]).map((e,t)=>[e,t]));return e.tickets.map(e=>({ticket:e,questions:(e.build_open_questions??[]).filter(e=>e.status===`open`).sort((e,t)=>e.created_at.localeCompare(t.created_at))})).filter(e=>e.questions.length>0).sort((e,n)=>(t.get(e.ticket.id)??e.ticket.bundle_execution_position??2**53-1)-(t.get(n.ticket.id)??n.ticket.bundle_execution_position??2**53-1))},Qpe=e=>e.flatMap(e=>e.questions.map(e=>`${e.id}:${e.updated_at}`)).join(`|`),$pe=({details:e,onClose:t,onRefresh:n,onSubmit:r})=>{let{t:i}=K(`common`),a=(0,p.useMemo)(()=>Zpe(e),[e]),o=(0,p.useMemo)(()=>a.flatMap(e=>e.questions),[a]),s=(0,p.useMemo)(()=>Qpe(a),[a]),c=(0,p.useRef)(s),[l,u]=(0,p.useState)(()=>Object.fromEntries(o.map(e=>[e.id,{mode:null,answer:``}]))),[d,f]=(0,p.useState)(!1),[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(null);(0,p.useEffect)(()=>{u(e=>Object.fromEntries(o.map(t=>[t.id,e[t.id]??{mode:null,answer:``}]))),c.current!==s&&(c.current=s,d||(h(!0),_(i(`buildOpenQuestionsDialog.refreshedError`))))},[d,o,s,i]);let v=o.length>0&&o.every(e=>{let t=l[e.id];return t?.mode===`dismiss`||t?.mode===`answer`&&t.answer.trim()!==``}),y=o.some(e=>l[e.id]?.mode===`answer`),b=o.length>0&&o.every(e=>l[e.id]?.mode===`dismiss`),x=(e,t)=>{u(n=>({...n,[e]:{...n[e]??{mode:null,answer:``},...t}})),_(null)};return(0,X.jsx)(S_,{open:!0,onOpenChange:e=>{e||t()},children:(0,X.jsx)(w_,{showCloseButton:!1,className:`flex max-h-[calc(100vh-2rem)] flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl`,children:(0,X.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),!(!v||m||d)){f(!0),_(null);try{await r({resolutions:o.map(e=>{let t=l[e.id];return t.mode===`dismiss`?{question_id:e.id,dismiss:!0}:{question_id:e.id,answer:t.answer.trim()}})})}catch(e){if(Xpe(e)){try{await n()}catch{_(i(`buildOpenQuestionsDialog.refreshFailedError`))}h(!0),_(e=>e??i(`buildOpenQuestionsDialog.conflictError`))}else _(e instanceof Ke?e.message:i(`buildOpenQuestionsDialog.submitError`))}finally{f(!1)}}},className:`flex min-h-0 flex-col`,children:[(0,X.jsxs)(T_,{className:`border-b border-border/70 px-5 py-4 sm:px-6`,children:[(0,X.jsx)(D_,{children:i(`buildOpenQuestionsDialog.title`)}),(0,X.jsx)(O_,{children:i(`buildOpenQuestionsDialog.description`)})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4 sm:px-6`,children:[a.map(e=>(0,X.jsxs)(`section`,{"aria-labelledby":`build-question-ticket-${e.ticket.id}`,children:[(0,X.jsx)(`h3`,{id:`build-question-ticket-${e.ticket.id}`,className:`text-sm font-semibold text-foreground`,children:i(`buildOpenQuestionsDialog.ticketHeading`,{title:e.ticket.title})}),(0,X.jsx)(`div`,{className:`mt-2 space-y-3`,children:e.questions.map(e=>{let t=l[e.id]??{mode:null,answer:``};return(0,X.jsxs)(`article`,{className:`min-w-0 rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-foreground`,children:e.question_text}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-2`,children:[(0,X.jsxs)(z_,{className:`flex cursor-pointer items-center gap-2 text-sm`,children:[(0,X.jsx)(`input`,{type:`radio`,name:`decision-${e.id}`,checked:t.mode===`answer`,onChange:()=>x(e.id,{mode:`answer`})}),i(`buildOpenQuestionsDialog.answerOption`)]}),(0,X.jsxs)(z_,{className:`flex cursor-pointer items-center gap-2 text-sm`,children:[(0,X.jsx)(`input`,{type:`radio`,name:`decision-${e.id}`,checked:t.mode===`dismiss`,onChange:()=>x(e.id,{mode:`dismiss`})}),i(`buildOpenQuestionsDialog.dismissOption`)]})]}),t.mode===`answer`&&(0,X.jsxs)(`div`,{className:`mt-3`,children:[(0,X.jsx)(z_,{htmlFor:`answer-${e.id}`,className:`sr-only`,children:i(`buildOpenQuestionsDialog.answerLabel`,{question:e.question_text})}),(0,X.jsx)(A_,{id:`answer-${e.id}`,value:t.answer,onChange:t=>x(e.id,{mode:`answer`,answer:t.target.value}),placeholder:i(`buildOpenQuestionsDialog.answerPlaceholder`),rows:3,className:`max-h-64 resize-y break-words`})]})]},e.id)})})]},e.ticket.id)),o.length===0&&!d&&(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`buildOpenQuestionsDialog.empty`)})]}),(0,X.jsxs)(E_,{className:`items-start border-t border-border/70 px-5 py-4 sm:items-center sm:px-6`,children:[(0,X.jsxs)(`div`,{className:`mr-auto min-w-0 text-xs leading-5 text-muted-foreground`,"aria-live":`polite`,children:[g&&(0,X.jsx)(`p`,{className:`text-destructive`,children:g}),!g&&b&&(0,X.jsx)(`p`,{children:i(`buildOpenQuestionsDialog.dismissSummary`)}),!g&&!y&&!b&&(0,X.jsx)(`p`,{children:i(`buildOpenQuestionsDialog.incompleteSummary`)})]}),m&&(0,X.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>{h(!1),_(null)},children:i(`buildOpenQuestionsDialog.reviewRefreshed`)}),(0,X.jsx)(Q,{type:`button`,variant:`ghost`,onClick:t,children:i(`buildOpenQuestionsDialog.cancel`)}),(0,X.jsx)(Q,{type:`submit`,disabled:!v||m||d,children:i(d?`buildOpenQuestionsDialog.submitting`:`buildOpenQuestionsDialog.submit`)})]})]})})})},U6={blocked:{className:`stroke-red-400/80`,markerId:`dependency-arrowhead-blocked`},ready:{className:`stroke-emerald-400/80`,markerId:`dependency-arrowhead-ready`},preview:{className:`stroke-amber-300/80`,markerId:`dependency-arrowhead-preview`}},eme=e=>Yv(e)?`ready`:`blocked`,W6=180,tme=560,G6=88,K6=12,q6=18,J6=`dependency-overlay-clip`,Y6=(e,t,n)=>Math.min(Math.max(e,t),n),nme=(e,t)=>{if(!e||e.width<=0||e.height<=0||t.length===0)return null;let n=`M 0 0 H ${e.width} V ${e.height} H 0 Z`,r=t.filter(e=>e.width>0&&e.height>0).map(e=>`M ${e.left} ${e.top} H ${e.left+e.width} V ${e.top+e.height} H ${e.left} Z`);return r.length===0?null:`${n} ${r.join(` `)}`},rme=(e,t,n)=>n&&n.width>0&&n.height>0?n:Object.values(e).reduce((e,t)=>({width:Math.max(e.width,t.left+t.width),height:Math.max(e.height,t.top+t.height)}),{width:t.x,height:t.y}),ime=(e,t)=>{let n=Y6(Math.round(e.length*7.2)+24,W6,tme),r=Math.max(W6,t-K6*2);return Math.min(n,r)},ame=(e,t,n,r,i)=>{let a=n.get(e.blockerTicketId);if(!a)return null;let o=e.hoveredTicketId&&e.hoveredTicketId!==e.blockerTicketId?r[e.hoveredTicketId]:null,s=e.hoveredTicketId&&e.hoveredTicketId!==e.blockerTicketId?n.get(e.hoveredTicketId):null,c=s?`${a.title} is blocking ${s.title}`:`${a.title} is blocking...`,{start:l,end:u}=ey(t,o??{left:e.pointer.x,top:e.pointer.y,width:0,height:0}),d=rme(r,e.pointer,i),f=o&&s?{x:l.x+(u.x-l.x)*.6,y:l.y+(u.y-l.y)*.6-28}:{x:u.x,y:u.y-28},p=ime(c,d.width);return{text:c,x:o&&s?Y6(f.x-p/2,K6,Math.max(K6,d.width-p-K6)):(()=>{let e=f.x+q6,t=f.x-q6-p;return e+p<=d.width-K6?e:t>=K6?t:Y6(e,K6,Math.max(K6,d.width-p-K6))})(),y:Y6(f.y,K6,Math.max(K6,d.height-G6-K6)),width:p}},X6=({blockerRect:e,dependentRect:t,className:n,testId:r,markerEnd:i})=>{let{start:a,end:o}=ey(e,t),{path:s}=mne(a,o);return(0,X.jsx)(`g`,{"data-testid":r,children:(0,X.jsx)(`path`,{d:s,className:n,fill:`none`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,markerEnd:i})})},ome=({preview:e,cardRects:t,ticketsById:n,overlaySize:r})=>{if(!e)return null;let i=t[e.blockerTicketId];if(!i)return null;let a=(e.hoveredTicketId&&e.hoveredTicketId!==e.blockerTicketId&&t[e.hoveredTicketId]?t[e.hoveredTicketId]:null)??{left:e.pointer.x,top:e.pointer.y,width:0,height:0},o=ame(e,i,n,t,r);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(X6,{blockerRect:i,dependentRect:a,className:U6.preview.className,testId:`dependency-preview`,markerEnd:`url(#${U6.preview.markerId})`}),(e=>o?(0,X.jsx)(`foreignObject`,{x:o.x,y:o.y,width:o.width,height:G6,"data-testid":`dependency-preview-label`,children:e}):null)((0,X.jsx)(`div`,{className:`pointer-events-none flex h-full w-full items-start`,children:(0,X.jsx)(`div`,{className:`max-w-full rounded-md border border-amber-300/60 bg-stone-950/85 px-3 py-1.5 text-xs font-medium leading-5 text-amber-100 shadow-lg shadow-stone-950/20 whitespace-normal break-words`,children:o?.text})}))]})},sme=({dependencies:e,cardRects:t,clipRects:n=[],preview:r,ticketsById:i,overlaySize:a})=>{let o=nme(a,n);return(0,X.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 z-10 h-full w-full overflow-visible`,children:[(0,X.jsxs)(`defs`,{children:[Object.values(U6).map(e=>(0,X.jsx)(`marker`,{id:e.markerId,markerWidth:`8`,markerHeight:`8`,refX:`7`,refY:`4`,orient:`auto`,markerUnits:`userSpaceOnUse`,children:(0,X.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8`,className:e.className,fill:`none`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})},e.markerId)),o&&(0,X.jsx)(`clipPath`,{id:J6,children:(0,X.jsx)(`path`,{d:o,clipRule:`evenodd`})})]}),(0,X.jsxs)(`g`,{"data-testid":`dependency-overlay-content`,clipPath:o?`url(#${J6})`:void 0,children:[e.map(e=>{let n=i.get(e.blocker_ticket_id),r=i.get(e.dependent_ticket_id),a=t[e.blocker_ticket_id],o=t[e.dependent_ticket_id];if(n?.parked_at||r?.parked_at)return null;let s=U6[eme(n)];return!a||!o?null:(0,X.jsx)(X6,{blockerRect:a,dependentRect:o,className:s.className,testId:`dependency-edge-${e.blocker_ticket_id}-${e.dependent_ticket_id}`,markerEnd:`url(#${s.markerId})`},`${e.blocker_ticket_id}:${e.dependent_ticket_id}`)}),(0,X.jsx)(ome,{preview:r,cardRects:t,ticketsById:i,overlaySize:a})]})]})},cme=({onOpenProjectExecutionSettings:e})=>{let{t}=K(`common`);return(0,X.jsxs)(`p`,{className:`mt-2 w-full max-w-none text-xs leading-relaxed text-amber-200/90`,role:`status`,children:[t(`modelSelector.dockerSandboxNotice`),e&&(0,X.jsx)(Q,{type:`button`,variant:`link`,size:`xs`,className:`ml-1 h-auto align-baseline px-0 text-xs font-medium text-amber-100`,onClick:e,children:t(`modelSelector.openExecutionSettings`)})]})},lme=({onSubmit:e,bundles:t,projectId:n=null,projectBranchState:r=null,tool:i,showModelSelector:a=!1,showSkillsSelector:o=!1,availableModels:s=[],availableSkills:c=[],initialModel:l=``,initialVariant:u=``,initialSkills:d=[],initialWorktreeBundleId:f=null,initialImportedDraft:p=null,onCreateBundle:m,onDeleteBundle:h,onRefreshBundles:g,showDockerSandboxModelNotice:_=!1,onOpenProjectExecutionSettings:v,onClose:y})=>{let{t:b}=K(`common`),{jiraImportState:x,importFromJira:S}=Mw(n),{gitHubImportState:C,importFromGitHub:w}=ew(n),T=[{key:`jira`,label:b(`jiraImportField.label`),placeholder:b(`jiraImportField.placeholder`),state:x,onImport:S},{key:`github`,label:b(`githubImportField.label`),placeholder:b(`githubImportField.placeholder`),state:C,onImport:w}];return(0,X.jsx)(uC,{onClose:y,overlayClassName:`bg-black/70`,panelClassName:`h-[92vh] w-[96vw] max-w-6xl overflow-y-auto rounded-2xl border border-border bg-card p-4 shadow-2xl sm:p-5 lg:p-6`,renderContent:({closeButton:x})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`absolute right-4 top-4 z-10 sm:right-5 sm:top-5 lg:right-6 lg:top-6`,children:x}),(0,X.jsx)(IY,{heading:b(`newTicketModal.heading`),bundles:t,agentSettingsScope:i,showModelSelector:a,showSkillsSelector:o,availableModels:s,availableSkills:c,projectId:n,initialModel:l,initialVariant:u,initialSkills:d,initialWorktreeBundleId:f,initialImportedDraft:p,projectBranchState:r,externalImportProviders:T,onCancel:y,onCreateBundle:m,onDeleteBundle:h,onRefreshBundles:g,modelSelectorNotice:_?(0,X.jsx)(cme,{onOpenProjectExecutionSettings:v}):void 0,titleInputId:`title`,descriptionInputId:`description`,bundleSelectId:`new-ticket-bundle`,modelSelectId:`new-model`,variantSelectId:`new-variant`,skillsSelectId:`new-skills`,showEmptyBundleOption:!0,planAction:i?{label:b(`newTicketModal.actions.plan`),onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`plan`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}}:void 0,primaryAction:{label:b(`newTicketModal.actions.createTicket`),variant:`subtle`,onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`create`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}},secondaryAction:{label:b(`newTicketModal.actions.createAndBuild`),variant:`brand`,showAdvanceIcon:!0,onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`build`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}}})]})})},ume=({className:e=``})=>{let{setNodeRef:t,isOver:n}=GP({id:`trash`});return(0,X.jsxs)(`div`,{ref:t,"data-testid":`delete-drop-zone`,className:`${e} flex min-w-[13rem] select-none items-center justify-between gap-4 rounded-2xl border px-4 py-3 backdrop-blur-sm transition-all duration-150 ${n?`scale-[1.02] border-red-400/70 bg-destructive/35 text-red-100 shadow-lg shadow-red-950/30`:`border-red-500/30 bg-background/82 text-red-200/85`}`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(hC,{variant:`destructive`,className:`text-[11px] uppercase tracking-[0.28em]`,children:`Delete`}),(0,X.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:n?`Release to delete`:`Drop here to delete`})]}),(0,X.jsx)(`div`,{className:`rounded-xl border p-2 transition-colors ${n?`border-red-400/60 bg-red-500/20`:`border-red-500/20 bg-background/60`}`,children:(0,X.jsx)(wC,{className:`h-5 w-5 transition-colors ${n?`text-red-100`:`text-red-300/70`}`})})]})},dme=(e,t)=>Y(J(`/ticket-dependencies`,e),{signal:t}),fme=(e,t)=>Y(J(`/ticket-dependencies`,e),{method:`POST`,body:t,fallbackErrorMessage:`Unable to create the dependency right now.`}),pme=(e,t,n)=>Ze(J(`/ticket-dependencies/${t}/${n}`,e),{method:`DELETE`,fallbackErrorMessage:`Unable to remove the dependency right now.`}),mme=(e,t)=>{let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.left!==i.left||n.top!==i.top||n.width!==i.width||n.height!==i.height)return!1}return!0},hme=(e,t)=>e.length===t.length?e.every((e,n)=>{let r=t[n];return r!==void 0&&e.left===r.left&&e.top===r.top&&e.width===r.width&&e.height===r.height}):!1,gme=(e,t)=>e===t?!0:!e||!t?!1:e.projectId===t.projectId&&e.blockerTicketId===t.blockerTicketId&&e.hoveredTicketId===t.hoveredTicketId&&e.pointer.x===t.pointer.x&&e.pointer.y===t.pointer.y,_me=({activeProjectId:e,tickets:t,dependencies:n,setDependencies:r,activeTicket:i,activeOverlayNode:a,dragOffset:o})=>{let[s,c]=(0,p.useState)({}),[l,u]=(0,p.useState)([]),[d,f]=(0,p.useState)({width:0,height:0}),[m,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(new Map),S=(0,p.useRef)(new Map),C=(0,p.useRef)({}),w=(0,p.useRef)(null),T=(0,p.useRef)(null),E=(0,p.useRef)(null),D=(0,p.useRef)(null),O=(0,p.useRef)(null),k=(0,p.useRef)(null),A=(0,p.useRef)(null),j=(0,p.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]);(0,p.useEffect)(()=>{O.current=g},[g]),(0,p.useLayoutEffect)(()=>{if(!i||!a||!y.current)return;let e=window.requestAnimationFrame(()=>{let e=y.current?.getBoundingClientRect(),t=a.getBoundingClientRect();e&&h({ticketId:i.id,rect:{left:t.left-e.left,top:t.top-e.top,width:t.width,height:t.height}})});return()=>{window.cancelAnimationFrame(e)}},[a,i,o.x,o.y]);let M=(0,p.useCallback)(()=>{w.current===null&&(w.current=window.requestAnimationFrame(()=>{w.current=null;let e=y.current;if(!e){b.current=null,C.current={},c({}),u([]),f({width:0,height:0});return}let t=e.getBoundingClientRect(),n={};b.current={left:t.left,top:t.top},f(e=>e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height});for(let[e,r]of x.current){let i=r.getBoundingClientRect();n[e]={left:i.left-t.left,top:i.top-t.top,width:i.width,height:i.height}}let r=Array.from(S.current.values()).flatMap(({columnNode:e,listNode:n})=>{let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),a=Math.max(0,i.top-r.top);return r.width<=0||a<=0?[]:[{left:r.left-t.left,top:r.top-t.top,width:r.width,height:a}]});u(e=>hme(e,r)?e:r),C.current=n,c(e=>mme(e,n)?e:n)}))},[]);(0,p.useEffect)(()=>{let e=v.current;if(!e)return;let t=()=>{M()};return e.addEventListener(`scroll`,t,!0),window.addEventListener(`resize`,t),()=>{e.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,t)}},[M]),(0,p.useEffect)(()=>{if(typeof ResizeObserver!=`function`)return;let e=new ResizeObserver(()=>{M()});T.current=e;for(let t of x.current.values())e.observe(t);return()=>{e.disconnect(),T.current===e&&(T.current=null)}},[M]),(0,p.useEffect)(()=>{if(typeof ResizeObserver!=`function`)return;let e=new ResizeObserver(()=>{M()});E.current=e;for(let t of S.current.values())e.observe(t.columnNode),e.observe(t.listNode);return()=>{e.disconnect(),E.current===e&&(E.current=null)}},[M]),(0,p.useEffect)(()=>{let e=v.current,t=y.current;if(!e&&!t)return;let n=new ResizeObserver(()=>{M()});return e&&n.observe(e),t&&t!==e&&n.observe(t),()=>{n.disconnect()}},[M]),(0,p.useEffect)(()=>(M(),()=>{w.current!==null&&(window.cancelAnimationFrame(w.current),w.current=null)}),[n,M,t]);let N=(0,p.useCallback)((e,t)=>{let n=x.current.get(e);if(t){if(n===t)return;x.current.set(e,t),T.current?.observe(t)}else{if(!n)return;x.current.delete(e),T.current?.unobserve(n)}M()},[M]),P=(0,p.useCallback)((e,t)=>{let n=S.current.get(e);if(t){if(n?.columnNode===t.columnNode&&n.listNode===t.listNode)return;n&&(E.current?.unobserve(n.columnNode),E.current?.unobserve(n.listNode)),S.current.set(e,t),E.current?.observe(t.columnNode),E.current?.observe(t.listNode)}else{if(!n)return;S.current.delete(e),E.current?.unobserve(n.columnNode),E.current?.unobserve(n.listNode)}M()},[M]),F=(0,p.useCallback)(e=>{gme(O.current,e)||(O.current=e,_(e))},[]),I=(0,p.useCallback)(()=>{k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),A.current=null},[]),L=(0,p.useCallback)(e=>{A.current=e,k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null;let e=A.current;A.current=null,F(e)}))},[F]),R=(0,p.useCallback)((e,t)=>{let n=b.current;if(!n&&y.current){let e=y.current.getBoundingClientRect();n={left:e.left,top:e.top},b.current=n}return n?{x:e-n.left,y:t-n.top}:{x:e,y:t}},[]),z=(0,p.useCallback)((e,t,n)=>{for(let[r,i]of Object.entries(C.current))if(r!==n&&e>=i.left&&e<=i.left+i.width&&t>=i.top&&t<=i.top+i.height)return r;return null},[]),ee=(0,p.useCallback)(async t=>{if(e)try{await pme(e,t.blocker_ticket_id,t.dependent_ticket_id),r(e=>qv(e,t.blocker_ticket_id,t.dependent_ticket_id))}catch(e){$.error(e instanceof Ke?e.message:`Unable to remove the dependency right now.`,{id:`board-dependency-error`})}},[e,r]),B=(0,p.useCallback)((t,i)=>{if(!e)return;i.preventDefault(),D.current?.();let a=(n,r,i=!1)=>{let a=R(n,r),o={projectId:e,blockerTicketId:t,hoveredTicketId:z(a.x,a.y,t),pointer:a};if(i){I(),F(o);return}L(o)};a(i.clientX,i.clientY,!0);let o=e=>{a(e.clientX,e.clientY)},s=async i=>{let a=R(i.clientX,i.clientY),o=z(a.x,a.y,t),s=o?Jv(n,t,o):null;if(D.current?.(),D.current=null,F(null),!(!o||!s)){if(!s.valid){$.error(une(s.reason),{id:`board-dependency-error`});return}try{let n=await fme(e,{blocker_ticket_id:t,dependent_ticket_id:o});r(e=>Kv(e,n))}catch(e){$.error(e instanceof Ke?e.message:`Unable to create the dependency right now.`,{id:`board-dependency-error`})}}};D.current=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),I()},window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s,{once:!0})},[e,I,n,z,R,L,r,F]);(0,p.useEffect)(()=>{D.current?.(),D.current=null,I(),O.current=null},[e,I]),(0,p.useEffect)(()=>()=>{D.current?.(),k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null)},[]);let V=(0,p.useMemo)(()=>{let r=g?.blockerTicketId;if(!r||g.projectId!==e||!j.has(r))return null;let i=new Map;for(let e of t){if(e.id===r){i.set(e.id,`source`);continue}let t=Jv(n,r,e.id);i.set(e.id,t.valid?`valid`:`idle`)}return i},[e,n,g,j,t]),te=(0,p.useCallback)(e=>{if(!V||!g)return`idle`;let t=V.get(e)??`idle`;return e===g.hoveredTicketId&&t===`idle`?`invalid`:t},[V,g]),H=(0,p.useMemo)(()=>!g||g.projectId!==e||!j.has(g.blockerTicketId)?null:{blockerTicketId:g.blockerTicketId,hoveredTicketId:g.hoveredTicketId,pointer:g.pointer},[e,g,j]);return{boardViewportRef:v,boardContentRef:y,registerTicketNode:N,registerDependencyClipNodes:P,measuredCardRects:(0,p.useMemo)(()=>{if(!i)return s;let e=s[i.id];return e?m?.ticketId===i.id?{...s,[i.id]:m.rect}:{...s,[i.id]:{...e,left:e.left+o.x,top:e.top+o.y}}:s},[m,i,s,o.x,o.y]),dependencyClipRects:l,overlayPreview:H,overlaySize:d,getDependencyTargetState:te,handleDependencyStart:B,handleDeleteDependency:ee}},vme=`[data-terminal-pane="true"]`,yme=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},bme=e=>e instanceof HTMLElement?e.closest(vme)!==null:!1,xme=e=>yme(e)||bme(e),Sme=(e,t={})=>{let{isBlocked:n}=t;(0,p.useEffect)(()=>{let t=t=>{if(t.defaultPrevented||t.repeat)return;let r=e.find(e=>!e.disabled&&e.key.toLowerCase()===t.key.toLowerCase()&&(e.ctrlKey??!1)===t.ctrlKey&&(e.altKey??!1)===t.altKey&&(e.metaKey??!1)===t.metaKey&&(e.shiftKey===void 0||e.shiftKey===t.shiftKey));r&&(n?.(document.activeElement)||(t.preventDefault(),r.onKeyDown()))};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,n])},Z6=new Set([`queued`,`running`]),Cme={check_batch:`checks`,check_repair:`auto_fix`,automation_review_fix:`auto_fix`,automation_commit:`commit`,automation_push:`push`,automation_pull_request:`pr`},Q6=e=>{if(!e.id)return null;let t=Date.parse(e.updated_at);return Number.isFinite(t)?t:null},wme=e=>{let t=e.source_reference;if(e.kind!==`automation_progression`||e.status!==`waiting`&&!Z6.has(e.status)||e.initiated_by!==`automation`&&e.initiated_by!==`recovery`||!t||typeof t!=`object`||t.kind!==`bundle`||typeof t.id!=`string`)return null;let n=t.id.trim(),r=Q6(e);return!n||r===null?null:{bundleId:n,id:e.id,isActive:Z6.has(e.status),updatedAt:r}},Tme=e=>{let t=Cme[e.kind],n=Q6(e);return!t||!Z6.has(e.status)||e.initiated_by!==`automation`||!e.parent_run_id||n===null?null:{id:e.id,parentRunId:e.parent_run_id,status:t,updatedAt:n}},$6=(e,t)=>e.updatedAt===t.updatedAt?e.id.localeCompare(t.id)>0:e.updatedAt>t.updatedAt,Eme=e=>{let t=new Map,n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=wme(r);if(e){let n=t.get(e.bundleId);(!n||$6(e,n))&&t.set(e.bundleId,e);continue}let i=Tme(r);i&&n.push(i)}let r=new Map,i=new Map;for(let e of t.values())e.isActive&&(r.set(e.id,e.bundleId),i.set(e.bundleId,`automation`));let a=new Map;for(let e of n){let t=r.get(e.parentRunId);if(!t)continue;let n=a.get(t);(!n||$6(e,n))&&a.set(t,e)}for(let[e,t]of a)i.set(e,t.status);return i},Dme=`archon.last-model-selection`,Ome=`archon.last-variant-selection`,e8=`archon.last-skills-selection`,t8=(e,t)=>`${e}.${t}`,kme=e=>{try{let t=window.localStorage.getItem(t8(e8,e)),n=t?JSON.parse(t):[];return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}catch{return[]}},n8=()=>({build:!1,stopBuild:!1,resumeBuild:!1,review:!1,undoReview:!1,run:!1,stop:!1,followUp:!1,bundleRefresh:!1}),Ame=(e,t,n,r)=>{let i=t8(Dme,e),a=t8(Ome,e),o=t8(e8,e);t?window.localStorage.setItem(i,t):window.localStorage.removeItem(i),n?window.localStorage.setItem(a,n):window.localStorage.removeItem(a),r.length>0?window.localStorage.setItem(o,JSON.stringify(r)):window.localStorage.removeItem(o)},r8=(e,t={})=>Ty(e,t),jme=e=>({model:window.localStorage.getItem(t8(`archon.last-model-selection`,e))??``,variant:window.localStorage.getItem(t8(`archon.last-variant-selection`,e))??``,skills:kme(e)}),i8={runs:[],events:[],isLoading:!1,isLoadingMore:!1,hasMoreRuns:!1,hasMoreEvents:!1,error:null},a8=(0,p.createContext)({state:new Map,loadMoreProject:()=>void 0,refreshProject:()=>void 0,subscribeProject:()=>()=>void 0}),Mme=[`queued`,`waiting`,`running`],Nme=(e,t,n,r)=>Oue(e,{cursor:t,limit:200,signal:n,statuses:r}),Pme=(e,t,n)=>kue(e,{cursor:t,limit:200,signal:n}),Fme=(e,t)=>{let n=t.created_at.localeCompare(e.created_at);return n===0?t.id.localeCompare(e.id):n},Ime=(e,t)=>{let n=t.created_at.localeCompare(e.created_at);if(n!==0)return n;let r=t.execution_run_id.localeCompare(e.execution_run_id);if(r!==0)return r;let i=t.sequence-e.sequence;return i===0?t.id.localeCompare(e.id):i},o8=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);(!t||e.updated_at>=t.updated_at)&&n.set(e.id,e)}return[...n.values()].sort(Fme)},s8=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));for(let e of t)n.set(e.id,e);return[...n.values()].sort(Ime)},Lme=async(e,t,n)=>{let r=null,i=[];do{let a=await e(t,r,n,Mme);i=o8(i,a.runs),r=a.next_cursor}while(r);return i},Rme=({socket:e,fetchRunsPage:t,fetchEventsPage:n,children:r})=>{let i=lq(),a=e??i,o=t??Nme,s=n??Pme,[c,l]=(0,p.useState)(()=>new Map),u=(0,p.useRef)(new Map),d=(0,p.useRef)(new Map),f=(0,p.useRef)(new Map),m=(0,p.useRef)(new Map),h=(0,p.useCallback)(e=>{d.current.get(e)?.abort();let t=new AbortController;d.current.set(e,t),m.current.set(e,{runs:[],events:[]}),l(t=>{let n=new Map(t),r=n.get(e)??i8;return n.set(e,{...r,isLoading:!0,isLoadingMore:!1,error:null}),n}),Promise.all([o(e,null,t.signal),Lme(o,e,t.signal),s(e,null,t.signal)]).then(([n,r,i])=>{if(t.signal.aborted||d.current.get(e)!==t)return;f.current.set(e,{runs:n.next_cursor,events:i.next_cursor});let a=m.current.get(e)??{runs:[],events:[]};l(t=>{let o=new Map(t);return o.set(e,{runs:o8(o8(n.runs,r),a.runs),events:s8(i.events,a.events),isLoading:!1,isLoadingMore:!1,hasMoreRuns:!!n.next_cursor,hasMoreEvents:!!i.next_cursor,error:null}),o})}).catch(t=>{Ye(t)||l(n=>{let r=new Map(n),i=r.get(e)??i8;return r.set(e,{...i,isLoading:!1,isLoadingMore:!1,error:t instanceof Error?t.message:`Unable to load activity right now.`}),r})}).finally(()=>{d.current.get(e)===t&&(d.current.delete(e),m.current.delete(e))})},[s,o]),g=(0,p.useCallback)(e=>{if(d.current.has(e))return;let t=f.current.get(e);if(!t||!t.runs&&!t.events)return;let n=new AbortController;d.current.set(e,n),l(t=>{let n=new Map(t),r=n.get(e)??i8;return n.set(e,{...r,isLoadingMore:!0,error:null}),n}),Promise.all([t.runs?o(e,t.runs,n.signal):Promise.resolve({runs:[],next_cursor:null}),t.events?s(e,t.events,n.signal):Promise.resolve({events:[],next_cursor:null})]).then(([t,r])=>{n.signal.aborted||d.current.get(e)!==n||(f.current.set(e,{runs:t.next_cursor,events:r.next_cursor}),l(n=>{let i=new Map(n),a=i.get(e)??i8;return i.set(e,{...a,runs:o8(a.runs,t.runs),events:s8(a.events,r.events),isLoadingMore:!1,hasMoreRuns:!!t.next_cursor,hasMoreEvents:!!r.next_cursor,error:null}),i}))}).catch(t=>{Ye(t)||l(n=>{let r=new Map(n),i=r.get(e)??i8;return r.set(e,{...i,isLoadingMore:!1,error:t instanceof Error?t.message:`Unable to load more activity right now.`}),r})}).finally(()=>{d.current.get(e)===n&&d.current.delete(e)})},[s,o]),_=(0,p.useCallback)(e=>{let t=u.current.get(e)??0;return u.current.set(e,t+1),t===0&&h(e),()=>{let t=(u.current.get(e)??1)-1;if(t>0){u.current.set(e,t);return}u.current.delete(e),d.current.get(e)?.abort(),d.current.delete(e),f.current.delete(e),m.current.delete(e),l(t=>{let n=new Map(t);return n.delete(e),n})}},[h]),v=(0,p.useCallback)(e=>{if(!e||!u.current.has(e.project_id))return;let t=m.current.get(e.project_id);t&&(t.runs=o8(t.runs,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??i8;return n.set(e.project_id,{...r,runs:o8(r.runs,[e]),isLoading:!1}),n})},[]),y=(0,p.useCallback)(e=>{if(!e||!u.current.has(e.project_id))return;let t=m.current.get(e.project_id);t&&(t.events=s8(t.events,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??i8;return n.set(e.project_id,{...r,events:s8(r.events,[e]),isLoading:!1}),n})},[]),b=(0,p.useCallback)(()=>{for(let e of u.current.keys())h(e)},[h]);(0,p.useEffect)(()=>(a.on(`execution-run:updated`,v),a.on(`lifecycle-event:created`,y),a.on(`connect`,b),()=>{a.off(`execution-run:updated`,v),a.off(`lifecycle-event:created`,y),a.off(`connect`,b)}),[b,y,v,a]),(0,p.useEffect)(()=>()=>{for(let e of d.current.values())e.abort()},[]);let x=(0,p.useMemo)(()=>({state:c,loadMoreProject:g,refreshProject:h,subscribeProject:_}),[g,h,c,_]);return(0,X.jsx)(a8.Provider,{value:x,children:r})},c8=e=>{let{loadMoreProject:t,refreshProject:n,state:r,subscribeProject:i}=(0,p.useContext)(a8);(0,p.useEffect)(()=>{if(e)return i(e)},[e,i]);let a=(0,p.useCallback)(()=>{e&&n(e)},[e,n]),o=(0,p.useCallback)(()=>{e&&t(e)},[t,e]);return{...e?r.get(e)??i8:i8,loadMore:o,refresh:a}},l8=e=>({...e,messages:void 0,agent_log:void 0,streaming_response:void 0}),u8=(e,t)=>e?e.state!==t.state||e.parked_at!==t.parked_at||e.worktree_bundle_id!==t.worktree_bundle_id:!0,d8=(e,t)=>{if(!e)return t;let n=t.worktree_bundle_id!==null&&e.worktree_bundle_id===t.worktree_bundle_id,r=t.bundle??(n&&e.bundle?.id===t.worktree_bundle_id?e.bundle:null),i=t.bundle_execution_position??(n?e.bundle_execution_position??null:null);return{...e,...t,diff_stats:t.diff_stats===void 0?e.diff_stats:t.diff_stats,is_stale:t.is_stale===void 0?e.is_stale:t.is_stale,bundle:r,bundle_execution_position:i}},f8=(e,t)=>{let n=e=>ly(t)?ly(e):e.state===t.state&&!ly(e),r=e.findIndex(e=>n(e));if(r===-1)return[...e,t];let i=[...e];return i.splice(r,0,t),i},p8=(e,t)=>{let n=e.find(e=>e.id===t.id);return[n&&n.pull_request!==void 0&&t.pull_request===void 0?{...n,...t,pull_request:n.pull_request}:t,...e.filter(e=>e.id!==t.id)]},m8=(e,t)=>{let n=e.find(e=>e.id===t.id);if(!n)return[...e,t];let r=d8(n,t);return e.map(e=>e.id===t.id?r:e)},h8=(e,t)=>{let n=d8(e.find(e=>e.id===t.id),t);return f8(g8(e,t.id),n)},zme=(e,t)=>{if(e.length===0)return[...t];let n=[...e];for(let e of t)n=u8(n.find(t=>t.id===e.id),e)?h8(n,e):m8(n,e);let r=new Set(t.map(e=>e.id));return n.filter(e=>r.has(e.id))},g8=(e,t)=>e.filter(e=>e.id!==t),_8=(e,t,n,r={},i={})=>{let a=e.findIndex(e=>e.id===t);if(a===-1)return e;let o={...e[a],state:n,...r},s=g8(e,t);if(i.preferredIndex!==void 0){let e=Math.max(0,Math.min(i.preferredIndex,s.length));return s.splice(e,0,o),s}return f8(s,o)},v8=e=>e.state===`review`&&e.agent_status===`done`&&!!e.automation_progression_run_id,Bme=e=>v8(e)&&!e.automation_paused_at,Vme=15*1e3,Hme=1e3,Ume=async(e,t)=>{let n=Nde({projectId:t,ticketId:e.id,agentMessageId:e.agent_message_id});if(!n)return;let r=e.worktree_bundle_id!==null&&e.state!==`plan`?{kind:`bundle`,projectId:t,bundleId:e.worktree_bundle_id}:{kind:`ticket`,projectId:t,ticketId:e.id};await t3({title:`Ticket done`,body:e.title,key:n,destination:r})},y8=e=>l8(e),Wme=(e,t)=>t===`running`&&e.agent_status===`done`?`Finished ${e.state} for "${e.title}"`:t===`running`&&e.agent_status===`error`?`Failed ${e.state} for "${e.title}"`:t!==`running`&&e.agent_status===`running`?`Running ${e.state} for "${e.title}"`:null,Gme=({activeProjectId:e,refreshKey:t=0,onLoadedProjectIdChange:n,onProjectUsageChange:r,onBundlesChange:i,onBundlesLoadingChange:a,children:o})=>{let s=lq(),[c,l]=(0,p.useState)([]),[u,d]=(0,p.useState)([]),[f,m]=(0,p.useState)([]),[h,g]=(0,p.useState)([]),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(null),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)(null),k=(0,p.useRef)(0),A=(0,p.useRef)(0),j=(0,p.useRef)(new Map),M=(0,p.useRef)(new Map),N=(0,p.useRef)([]),P=(0,p.useRef)(e),F=(0,p.useRef)(new Map),I=(0,p.useRef)(new Map),L=(0,p.useRef)(new Map),R=(0,p.useCallback)((e,t)=>{let n=I.current.get(t.id);return!n||!e||t.state===n?t:e},[]),z=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(I.current);for(let r of e)n.set(r,t);I.current=n},[]),ee=(0,p.useCallback)(e=>{if(e.length===0||I.current.size===0)return;let t=new Map(I.current);for(let n of e)t.delete(n);I.current=t},[]),B=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(L.current);for(let r of e)n.set(r,t);L.current=n},[]),V=(0,p.useCallback)(e=>{if(e.length===0||L.current.size===0)return;let t=new Map(L.current);for(let n of e)t.delete(n);L.current=t},[]),te=(0,p.useCallback)((e,t)=>{if(F.current.has(t.id))return null;let n=R(e,t);return L.current.has(t.id)?{...n,parked_at:L.current.get(t.id)??null}:n},[R]),H=(0,p.useCallback)((e,t)=>{if(F.current.size===0&&I.current.size===0&&L.current.size===0)return t;let n=new Map(e.map(e=>[e.id,e]));return t.flatMap(e=>{let t=te(n.get(e.id),e);return t?[t]:[]})},[te]),U=(0,p.useCallback)(async(e,t)=>{let n=await on(e,t,{detail:`board`});return Array.isArray(n)?(!t?.aborted&&P.current===e&&l(e=>zme(e,H(e,n).map(y8))),n):null},[H]),ne=(0,p.useCallback)(async(e,t)=>{await U(e,t)},[U]),re=(0,p.useCallback)(async(e,t)=>{let n=++A.current,r=await sn(e,t);if(!Array.isArray(r)||t?.aborted||P.current!==e||A.current!==n)return;let i=new Map(r.map(e=>[e.id,e]));l(e=>e.map(e=>{let t=i.get(e.id);return t?{...e,diff_stats:t.diff_stats??null,is_stale:t.is_stale}:e}))},[]),ie=(0,p.useCallback)(e=>e.some(e=>e.is_stale===void 0),[]),ae=(0,p.useCallback)(async e=>{let t=P.current;if(!t)return null;try{let n=await cn(e,t);if(P.current!==t)return null;let r=M.current.get(n.id),i=te(r,n);if(!i)return null;let a=y8(i),o=u8(r,a);return l(e=>o?h8(e,a):m8(e,a)),n}catch{return null}},[te]),oe=(0,p.useCallback)(async t=>{if(!e){m([]);return}m(await gt(e,t))},[e]),W=(0,p.useMemo)(()=>new Map(c.map(e=>[e.id,e])),[c]),se=(0,p.useMemo)(()=>{let e=c.filter(e=>e.agent_status===`running`),t=new Set(e.map(e=>e.worktree_bundle_id).filter(e=>typeof e==`string`&&e.trim().length>0));return{total_running:e.length,running_plan_count:e.filter(e=>e.state===`plan`).length,running_build_count:e.filter(e=>e.state===`build`).length,running_review_count:e.filter(e=>e.state===`review`).length,active_bundle_count:t.size,latest_message:D}},[D,c]);(0,p.useEffect)(()=>{if(M.current=W,N.current.length===0)return;let e=[],t=[];for(let n of N.current){let r=W.get(n.blocker_ticket_id),i=W.get(n.dependent_ticket_id);r&&i&&r.project_id===P.current&&i.project_id===P.current?e.push(n):t.push(n)}N.current=t,e.length>0&&d(t=>e.reduce((e,t)=>Kv(e,t),t))},[W]),(0,p.useEffect)(()=>{P.current=e,F.current.clear(),N.current=[],I.current.clear(),L.current.clear(),O(null),v(null),j.current.clear()},[e]),(0,p.useEffect)(()=>{n?.(C?null:y)},[y,C,n]),(0,p.useEffect)(()=>{if(i){if(!e){i(null,[]);return}if(x!==e){i(e,[]);return}i(e,f)}},[e,f,x,i]),(0,p.useEffect)(()=>{if(a){if(!e){a(null,!1);return}a(e,T===e)}},[e,T,a]),(0,p.useEffect)(()=>{let t=new AbortController,n=++k.current,r=null,i=async()=>{try{if(!e){l([]),d([]),m([]),b(null),S(null),w(null);return}l([]),d([]),m([]),b(null),S(null),w(e),E(e);let i=U(e,t.signal).finally(()=>{!t.signal.aborted&&k.current===n&&(b(e),w(null))}),a=dme(e,t.signal).then(e=>(!t.signal.aborted&&k.current===n&&d(e),e)),o=gt(e,t.signal).then(e=>(!t.signal.aborted&&k.current===n&&m(e),e)).finally(()=>{!t.signal.aborted&&k.current===n&&(S(e),E(null))}),[s,c,u]=await Promise.allSettled([i,a,o]);if(t.signal.aborted)return;s.status!==`fulfilled`&&!Ye(s.reason)&&l([]),c.status===`fulfilled`?d(c.value):Ye(c.reason)||d([]),u.status===`fulfilled`?m(u.value):Ye(u.reason)||m([]),s.status===`fulfilled`&&s.value!==null&&ie(s.value)&&(r=window.setTimeout(()=>{t.signal.aborted||re(e,t.signal)},Hme))}finally{!t.signal.aborted&&k.current===n&&(w(null),E(null))}},a=t=>{t.project_id===e&&(v(t),!F.current.has(t.id)&&(t.bundle&&m(e=>p8(e,t.bundle)),l(e=>h8(e,y8(t)))))},o=t=>{if(t.project_id===e&&v(t),l(n=>{if(t.project_id!==e)return g8(n,t.id);let r=n.find(e=>e.id===t.id),i=te(r,t);if(!i)return n;let a=y8(i);return u8(r,a)?h8(n,a):m8(n,a)}),t.project_id!==e){d(e=>Gv(e,t.id));return}t.bundle&&m(e=>p8(e,t.bundle))},c=({id:e})=>{F.current.delete(e),L.current.delete(e),I.current.delete(e),l(t=>g8(t,e)),d(t=>Gv(t,e))},u=({project_id:e,bundle_id:t,pull_request:n})=>{e===P.current&&(m(e=>e.map(e=>e.id===t?{...e,pull_request:n}:e)),l(e=>e.map(e=>e.worktree_bundle_id!==t||!e.bundle?e:{...e,bundle:{...e.bundle,pull_request:n}})),v(e=>e?.worktree_bundle_id!==t||!e.bundle?e:{...e,bundle:{...e.bundle,pull_request:n}}))},f=e=>{if(!e)return;let t=M.current.get(e.blocker_ticket_id),n=M.current.get(e.dependent_ticket_id);if(!t||!n){N.current.push(e);return}t.project_id!==P.current||n.project_id!==P.current||d(t=>Kv(t,e))},p=e=>{d(t=>qv(t,e.blocker_ticket_id,e.dependent_ticket_id))};return i(),s.on(`ticket:created`,a),s.on(`ticket:updated`,o),s.on(`ticket:deleted`,c),s.on(`bundle-pull-request:updated`,u),s.on(`ticket-dependency:created`,f),s.on(`ticket-dependency:deleted`,p),()=>{t.abort(),r!==null&&window.clearTimeout(r),s.off(`ticket:created`,a),s.off(`ticket:updated`,o),s.off(`ticket:deleted`,c),s.off(`bundle-pull-request:updated`,u),s.off(`ticket-dependency:created`,f),s.off(`ticket-dependency:deleted`,p)}},[e,re,t,ie,U,te,s]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=()=>{document.visibilityState===`visible`&&Promise.allSettled([U(e,t.signal),oe(t.signal)]).then(n=>{n[0]?.status===`fulfilled`&&n[0].value!==null&&ie(n[0].value)&&re(e,t.signal)}).catch(()=>{})},r=window.setInterval(n,Vme),i=$b(n);return()=>{t.abort(),window.clearInterval(r),i()}},[e,oe,re,ie,U]),(0,p.useEffect)(()=>{if(!e||!r||y!==e)return;let t=c.filter(e=>{let t=e.bundle?.branch??e.branch;return typeof t==`string`&&t.trim()!==``}).length;r({projectId:e,ticketCount:c.length,worktreeCount:t,repoPathLocked:c.length>0||t>0||f.length>0})},[e,f.length,y,r,c]),(0,p.useEffect)(()=>{if(e)for(let t of c){let n=j.current.get(t.id),r=v8(t),i=Wme(t,n);i&&!r&&O(i),!r&&n!==void 0&&n===`running`&&t.agent_status===`done`&&(t.state===`plan`||t.state===`build`||t.state===`review`)&&Ume(t,e),r||j.current.set(t.id,t.agent_status)}},[e,c]);let ce=(0,p.useCallback)(()=>{v(null)},[]),le=(0,p.useMemo)(()=>({tickets:c,setTickets:l,dependencies:u,setDependencies:d,bundles:f,setBundles:m,pendingApprovalRequests:h,setPendingApprovalRequests:g,latestDetailedTicketUpdate:_,clearLatestDetailedTicketUpdate:ce,loadedProjectId:y,bundlesLoadedProjectId:x,loadingProjectId:C,activeProjectIdRef:P,pendingDeletedTicketsRef:F,pendingOptimisticMovesRef:I,pendingParkedTicketsRef:L,refreshTickets:ne,requestSingleTicketRefresh:ae,refreshBundles:oe,resolvePendingTicket:te,resolvePendingTickets:H,markPendingOptimisticMoves:z,clearPendingOptimisticMoves:ee,markPendingParkedTickets:B,clearPendingParkedTickets:V,liveActivity:se}),[f,x,ce,ee,V,u,se,y,_,C,z,B,h,oe,ne,ae,te,H,c]);return(0,X.jsx)(n3.Provider,{value:le,children:o})},b8=(e,t)=>{let n=g8(e,t.ticket.id),r=Math.max(0,Math.min(t.index,n.length));return n.splice(r,0,t.ticket),n},x8=e=>!!e?.preview_service_name?.trim()&&e?.preview_capability_mode!==`force_disabled`,S8=e=>e?.build_execution_provider===`docker_sandbox`&&x8(e),C8=(0,p.lazy)(()=>BW(()=>import(`./VerificationDialog-BYE1M9T2.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),w8=[`plan`,`build`,`review`],T8=`done`,Kme=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,activeRun:r,activeTool:i,onPreviewReviewCapabilityChange:a,onRunStopped:o,onRunStatusChange:s,onViewSourceSpec:c,onNavigateToLifecycleSource:l,onStartChatFromBundle:u,refreshKey:d=0,boardFilterState:f,onBoardFilterStateChange:m,initialTicketId:h=null,onInitialTicketNavigationConsumed:g,onInitialTicketNavigationUnavailable:_,routedTicketId:v,routedModalStack:y=[],onTicketOpen:b,onTicketClose:x,routedBundleId:S,routedInspection:C=null,routedInspectionReviewCapability:w,inspectionOnly:T=!1,onBundleOpen:E,onBundleClose:D,onInspectionOpen:O,onInspectionModeChange:k,onInspectionClose:A,onInspectionUnavailable:j,initialImportedDraft:M=null,onInitialImportedDraftConsumed:N,onOpenProjectExecutionSettings:P})=>{let{t:F}=K(`common`),I=WN(UN(yP,{activationConstraint:{distance:5}})),{tickets:L,setTickets:R,dependencies:z,setDependencies:ee,bundles:B,setBundles:V,latestDetailedTicketUpdate:te,clearLatestDetailedTicketUpdate:H,loadedProjectId:U,bundlesLoadedProjectId:ne,loadingProjectId:re,activeProjectIdRef:ie,pendingDeletedTicketsRef:ae,requestSingleTicketRefresh:oe,refreshBundles:W,resolvePendingTicket:se,markPendingOptimisticMoves:ce,clearPendingOptimisticMoves:le,markPendingParkedTickets:ue,clearPendingParkedTickets:de}=r3(),{runs:fe}=c8(e),pe=(0,p.useMemo)(()=>{let e=Eme(fe);for(let t of L)t.worktree_bundle_id&&t.automation_paused_reason&&e.delete(t.worktree_bundle_id);return e},[fe,L]),[me,he]=(0,p.useState)(null),[ge,_e]=(0,p.useState)(null),[ve,ye]=(0,p.useState)(null),be=(0,p.useCallback)(e=>ye(e),[]),[xe,Se]=(0,p.useState)(null),[Ce,we]=(0,p.useState)({x:0,y:0}),[Te,Ee]=(0,p.useState)(null),[De,Oe]=(0,p.useState)(null),[ke,Ae]=(0,p.useState)([]),[je,Me]=(0,p.useState)(null),Ne=ZP(`opencode`),Pe=ZP(`claude`),Fe=(0,p.useMemo)(()=>({opencode:Ne.models,claude:Pe.models}),[Ne.models,Pe.models]),Ie={opencode:Ne.isLoading,claude:Pe.isLoading},Le=(0,p.useCallback)(e=>{let n=Fe[e]??[];return t?.build_execution_provider===`docker_sandbox`?Eie(n,je?je.approved_providers?.[e]??[]:[]):n},[t?.build_execution_provider,je,Fe]),Re=(0,p.useMemo)(()=>({opencode:Le(`opencode`),claude:Le(`claude`)}),[Le]);(0,p.useEffect)(()=>{if(!e||t?.build_execution_provider!==`docker_sandbox`){Me(null);return}let n=new AbortController;return Me(null),Nb(e,n.signal).then(e=>{n.signal.aborted||Me(e)}).catch(e=>{!Ye(e)&&!n.signal.aborted&&Me(null)}),()=>n.abort()},[t?.build_execution_provider,e]);let ze=(0,p.useMemo)(()=>{if(t?.build_execution_provider!==`docker_sandbox`)return ke;let e=je?.available_skills?.opencode;if(!e)return[];let n=new Map(ke.map(e=>[e.name,e]));return e.map(e=>n.get(e)??{name:e,description:``})},[t?.build_execution_provider,ke,je?.available_skills?.opencode]),[G,Be]=(0,p.useState)(!1),[Ve,He]=(0,p.useState)(!1),[Ue,We]=(0,p.useState)(!1),[Ge,qe]=(0,p.useState)(null),[q,Je]=(0,p.useState)(null),[J,Xe]=(0,p.useState)(null),Ze=(0,p.useRef)(null),Y=v===void 0?h:v,Qe=(0,p.useRef)(null),$e=(0,p.useRef)(null),[et,tt]=(0,p.useState)(null),nt=(0,p.useRef)(null),[rt,it]=(0,p.useState)(null),[at,ot]=(0,p.useState)(null),[st,ct]=(0,p.useState)(null),[lt,ut]=(0,p.useState)(null),dt=(0,p.useRef)(0),[ft,pt]=(0,p.useState)(null),[mt,ht]=(0,p.useState)(null),[gt,vt]=(0,p.useState)(null),[yt,St]=(0,p.useState)(!1),[Ct,wt]=(0,p.useState)(n8()),[At,jt]=(0,p.useState)(0),[Mt,Bt]=(0,p.useState)(()=>({query:``,hideStaleTickets:!1,hideBundlesWithPullRequests:!1})),Vt=f??Mt,Ht=e=>{let t={...Vt,...e};if(m){m(t);return}Bt(t)},Ut=bF(i)||bF(J?.tool)||!!at?.tickets.some(e=>bF(yF(e,i))),Wt=bF(i)&&(Le(i).length>0||t?.build_execution_provider===`docker_sandbox`&&Fe[i].length>0),Gt=bF(yF(J,i))&&Le(yF(J,i)).length>0,Kt=!!at?.tickets.some(e=>bF(yF(e,i)))&&(Re.opencode.length>0||Re.claude.length>0),qt=(0,p.useRef)(null),[Jt,Yt]=(0,p.useState)(null),Xt=L.find(e=>e.is_running)??null,Zt=Xt?iy(Xt):null,Qt=r?.context_key??null,$t=r?.kind===`ticket`?gne(r,L)??Zt:Zt,en=r?.kind===`project`,tn=$t??Jt,nn=(0,p.useCallback)(e=>_ne({bundleId:e,activeRunContextKey:tn,isProjectRootRunActive:en}),[tn,en]),rn=me!==null&&gy(me,`trash`)||ge!==null&&my(ge),an=re===e,on=(0,p.useMemo)(()=>t?uw(t):[],[t]),sn=(0,p.useMemo)(()=>pw(on),[on]),cn=(0,p.useMemo)(()=>t?dw(t):[],[t]),un=(0,p.useMemo)(()=>t?fw(t):[],[t]),fn=sn.length>0,pn=(0,p.useMemo)(()=>new Map(L.map(e=>[e.id,e])),[L]);(0,p.useEffect)(()=>{Yt(null)},[e]),(0,p.useEffect)(()=>{Jt!==null&&(en||$t!==null)&&Yt(null)},[$t,en,Jt]),(0,p.useEffect)(()=>{if(!q){Xe(null);return}let e=pn.get(q)??null;e&&Xe(t=>!t||t.id!==q?e:oy(t,e))},[q,pn]),(0,p.useEffect)(()=>{te&&(Xe(e=>!e||e.id!==te.id?e:oy(e,te)),ot(e=>{if(!e)return e;let t=te.worktree_bundle_id;if(!t||e.bundle.id!==t)return e;let n=e.tickets.some(e=>e.id===te.id)?e.tickets.map(e=>e.id===te.id?oy(e,te):e):[...e.tickets,te];return{...e,tickets:n}}))},[te]),(0,p.useEffect)(()=>{te===null||q!==null||et!==null||H()},[H,te,et,q]);let mn=(0,p.useCallback)(async e=>{let t=await oe(e);if(!t)return null;let n=pn.get(e),r=n?oy(t,n):t;return Xe(t=>t&&t.id!==e||q&&q!==e?t:r),r},[oe,q,pn]),hn=(0,p.useCallback)(e=>{Xe(e),Je(e.id),mn(e.id),b?.(e.id)},[b,mn]),gn=(0,p.useCallback)(()=>{nt.current=null,tt(null),it(null),ot(null),St(!1),wt(n8())},[]),_n=(0,p.useMemo)(()=>new Map(B.map(e=>[e.id,e])),[B]),vn=(0,p.useMemo)(()=>{if(!at)return null;let e=at.bundle.id,t=te?.worktree_bundle_id===e?te:null,n=L.filter(t=>t.worktree_bundle_id===e),r=new Map(n.map(e=>[e.id,e])),i=at.tickets.filter(e=>!ae.current.has(e.id)).map(e=>t&&e.id===t.id?oy(e,t):e);t&&!i.some(e=>e.id===t.id)&&!ae.current.has(t.id)&&i.push(t);let a=i.map(e=>oy(e,r.get(e.id)));for(let e of n)a.some(t=>t.id===e.id)||a.push(e);a=b3(a);let o=at.execution_order_ticket_ids??[],s=a.map(e=>e.id),c=[...o,...s].filter((e,t,n)=>s.includes(e)&&n.indexOf(e)===t),l=n.some(e=>e.can_re_review!==void 0||e.has_completed_review!==void 0||e.has_follow_up_since_last_review!==void 0),u=n.some(e=>e.agent_status===`running`),d={has_completed_review:n.some(e=>e.has_completed_review===!0),has_follow_up_since_last_review:n.some(e=>e.has_follow_up_since_last_review===!0),can_re_review:!u&&n.some(e=>e.can_re_review===!0)},f=by(a),p=a.find(e=>e.id===at.review_owner_ticket_id&&e.state===`review`)??null,m=Ty(a,{targetTicketId:at.target_ticket_id,reviewOwnerTicketId:p?.id??at.review_owner_ticket_id,latestSessionTicketId:f?.id??at.latest_session_ticket_id});return{...at,bundle:_n.get(e)??at.bundle,tickets:a,execution_order_ticket_ids:c,latest_session_ticket_id:f?.id??null,latest_session_id:f?.session_id??null,review_owner_ticket_id:p?.id??null,target_ticket_id:m?.id??null,has_completed_review:l?d.has_completed_review:at.has_completed_review,has_follow_up_since_last_review:l?d.has_follow_up_since_last_review:at.has_follow_up_since_last_review,can_re_review:l?d.can_re_review:at.can_re_review}},[_n,te,ae,at,L]),yn=(0,p.useMemo)(()=>L.filter(e=>{if(Vt.hideStaleTickets&&dy(e))return!1;if(Vt.hideBundlesWithPullRequests&&e.worktree_bundle_id){let t=_n.get(e.worktree_bundle_id);if(t&&t.pull_request!==void 0?t.pull_request:e.bundle?.pull_request)return!1}return yne(Vt.query,e)}),[Vt,_n,L]),bn=(0,p.useMemo)(()=>Oy(yn),[yn]),In=(0,p.useMemo)(()=>yn.filter(e=>ly(e)),[yn]),Rn=(0,p.useMemo)(()=>Ey(In,B,T8),[B,In]),{boardViewportRef:Vn,boardContentRef:Hn,registerTicketNode:Un,registerDependencyClipNodes:Wn,measuredCardRects:Gn,dependencyClipRects:Kn,overlayPreview:qn,overlaySize:Jn,getDependencyTargetState:Yn,handleDependencyStart:Xn,handleDeleteDependency:Zn}=_me({activeProjectId:e,tickets:L,dependencies:z,setDependencies:ee,activeTicket:me,activeOverlayNode:xe,dragOffset:Ce}),Qn=jme(i),$n=!!t?.run_ide?.trim(),er=(0,p.useCallback)((e,t,n=L)=>{let r=Ey(n,B,t).find(t=>t.kind===`bundle`&&t.group.bundle.id===e);return r?.kind===`bundle`?r.group:null},[B,L]),tr=(0,p.useCallback)(e=>{let n=yF(e,i);return(0,X.jsx)(f3,{ticket:e,allTickets:L,dependencies:z,bundles:B,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:e.worktree_bundle_id?pe.get(e.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:bF(n)&&Le(n).length>0,availableModels:Le(n),runDisabled:!0,hideBundleScopedControls:!0})},[t?.memory_enabled,i,pe,B,z,Le,L]),nr=(0,p.useCallback)(t=>Cy(t)?t.project_id===e?$n:!!t.has_run_ide:!1,[$n,e]),rr=(0,p.useCallback)(e=>!!e.project_id&&!!(e.bundle?.branch??e.branch)&&Cy(e),[]),ir=(0,p.useCallback)(e=>{let t=e?.tickets.find(t=>t.id===e.target_ticket_id)??e?.tickets.find(e=>e.has_worktree)??null;return t?nr(t):!1},[nr]),ar=(0,p.useCallback)(e=>{let t=b3(L.filter(t=>t.worktree_bundle_id===e));return at?.bundle.id===e?r8(b3(at.tickets.map(e=>t.find(t=>t.id===e.id)??e)),{targetTicketId:at.target_ticket_id,reviewOwnerTicketId:at.review_owner_ticket_id,latestSessionTicketId:at.latest_session_ticket_id}):r8(t)},[at,L]),or=(0,p.useCallback)(e=>{let t=ar(e),n=B.some(t=>t.id===e&&t.has_prepared_worktree===!0)||L.some(t=>t.worktree_bundle_id===e&&Cy(t))||!!(at?.bundle.id===e&&at.tickets.some(Cy));return!!(t?.project_id&&(t.bundle?.branch??t.branch)&&n)},[B,ar,at,L]),sr=(0,p.useCallback)(e=>{let t=_n.get(e),n=ar(e),r=at?.bundle.id===e?[...L,...at.tickets]:L;return!!(t&&n?.project_id&&wy(t,r))},[_n,ar,at,L]);(0,p.useEffect)(()=>{He(!1),We(!1),pt(null),vt(null)},[e,d]),(0,p.useEffect)(()=>{if(!Ut){Ae([]);return}let t=new AbortController;return(async()=>{try{Ae(await QP(`opencode`,t.signal,e))}catch(e){Ye(e)||Ae([])}})(),()=>{t.abort()}},[e,Ut]);let cr=({active:e})=>{Be(!1),Se(null),we({x:0,y:0}),ye(null);let t=ky(String(e.id));if(t){_e(er(t.bundleId,t.column)),he(null);return}_e(null),he(L.find(t=>t.id===e.id)??null)},lr=()=>{Be(!1),Se(null),we({x:0,y:0}),he(null),_e(null),ye(null)},ur=(0,p.useCallback)(e=>{R(t=>e.reduce((e,t)=>h8(e,t),t))},[R]),dr=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=e[0]?.state;n&&R(r=>e.reduce((e,r)=>_8(e,r.id,t,Tne(r,n,t)),r))},[R]),fr=(0,p.useCallback)((e,t=L)=>!e.worktree_bundle_id||!e.project_id||e.state!==`build`?[]:b3(t.filter(t=>t.project_id===e.project_id&&t.worktree_bundle_id===e.worktree_bundle_id&&t.state===`build`&&t.parked_at===null)),[L]),pr=async({active:e,over:t})=>{let n=ky(String(e.id)),r=L.find(t=>t.id===e.id),i=n?er(n.bundleId,n.column):null,a=t?.id===`trash`&&(r!==void 0&&gy(r,`trash`)||i!==null&&my(i)),o=t?.id&&w8.includes(t.id)?t.id:null;if(Be(a),Se(null),we({x:0,y:0}),he(null),_e(null),t){if(n){if(t.id===`trash`){if(!i||!my(i))return;await Tr(i);return}if(t.id===T8){if(!i||!Sne(i))return;await Sr(i);return}if(o){if(n.column===T8){if(!i||!Cne(i))return;await Cr(i);return}await mi(n.bundleId,n.column,o)}return}if(t.id===`trash`){if(!r||!gy(r,`trash`))return;Dr(e.id);return}if(t.id===T8){if(!r||!gy(r,T8))return;await br(e.id);return}if(o){if(r&&xne(r,o)){await xr(e.id);return}if(!(!r||!gy(r,o)))try{await vr(r,o,{optimistic:!0})}catch(e){$.error(e instanceof Ke?e.message:F(`board.errors.moveTicket`),{id:`board-move-error`})}}}},mr=async(t,n,r,a,o,s,c)=>{let l=await ln({title:t,description:n,tool:i,model:a,variant:o,skills:s,project_id:e,...c});if(Ame(i,a,o,s),R(e=>h8(e,l8(l))),l.bundle&&V(e=>p8(e,l.bundle)),r===`build`)try{await vr(l,`build`)}catch(e){$.error(e instanceof Ke?e.message:F(`board.errors.moveTicket`),{id:`board-move-error`})}r===`plan`&&Bn(l.id,l.project_id)},hr=async t=>{if(!e)throw Error(F(`board.errors.createBundleWithoutProject`));let n=await _t(e,{name:t,prepare:!0});return V(e=>p8(e,n)),n},gr=(0,p.useCallback)((e,t={})=>{let n=l8(e);R(e=>t.reorderInState?h8(e,n):m8(e,n)),Xe(t=>!t||t.id!==e.id?t:oy(e,n)),e.bundle&&V(t=>p8(t,e.bundle))},[V,R]),_r=(0,p.useCallback)(e=>{V(t=>p8(t,e)),R(t=>t.map(t=>t.worktree_bundle_id===e.id?{...t,bundle:e}:t)),ot(t=>!t||t.bundle.id!==e.id?t:{...t,bundle:e,tickets:t.tickets.map(t=>t.worktree_bundle_id===e.id?{...t,bundle:e}:t)})},[V,ot,R]),vr=async(e,t,n={})=>{let r=L.findIndex(t=>t.id===e.id),i=t===`review`?fr(e):[],a=t===`review`&&i.length>1,o=n.optimistic?a?i.map(e=>e.id):[e.id]:[];n.optimistic&&(ce(o,t),a?dr(i,t):R(n=>_8(n,e.id,t,hy(e,t))));try{if(a&&e.project_id&&e.worktree_bundle_id){let t=await Et(e.project_id,e.worktree_bundle_id);qr(t);let n=t.tickets.find(t=>t.id===e.id);if(!n)throw Error(F(`board.errors.missingBundleReviewTicket`));return le(o),n}let n=await dn(e.id,e.project_id,t);return R(r=>{let i=r.find(t=>t.id===e.id);return i?.state===t&&n.state===t&&i.agent_status!==n.agent_status&&n.agent_status===e.agent_status?r:u8(i,n)?h8(r,n):m8(r,n)}),n.bundle&&V(e=>p8(e,n.bundle)),le(o),n}catch(t){throw n.optimistic&&(a?ur(i):R(t=>_8(t,e.id,e.state,{agent_status:e.agent_status,agent_log:e.agent_log,build_completed_at:e.build_completed_at},{preferredIndex:r})),le(o)),t}},yr=(e,t)=>{R(n=>n.map(n=>n.id===e?{...n,...t}:n))},br=async t=>{let n=L.find(e=>e.id===t);if(n)try{let r=new Date().toISOString();ue([t],r),yr(t,{parked_at:r}),gr(await Tn(t,n.project_id??e),{reorderInState:!0}),de([t])}catch(e){de([t]),yr(t,{parked_at:n.parked_at}),$.error(e instanceof Ke?e.message:F(`board.errors.parkTicket`),{id:`board-park-error`})}},xr=async t=>{let n=L.find(e=>e.id===t);if(n)try{ue([t],null),yr(t,{parked_at:null}),gr(await En(t,n.project_id??e),{reorderInState:!0}),de([t])}catch(e){de([t]),yr(t,{parked_at:n.parked_at}),$.error(e instanceof Ke?e.message:F(`board.errors.returnTicket`),{id:`board-unpark-error`})}},Sr=(0,p.useCallback)(async e=>{let t=new Set(e.tickets.map(e=>e.id)),n=e.tickets.map(e=>({id:e.id,parked_at:e.parked_at})),r=new Date().toISOString();ue(e.tickets.map(e=>e.id),r),R(e=>e.map(e=>t.has(e.id)?{...e,parked_at:r}:e));let i=await Promise.allSettled(e.tickets.map(e=>Tn(e.id,e.project_id??ie.current))),a=new Set;if(i.forEach((t,n)=>{if(t.status===`fulfilled`){de([t.value.id]),gr(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&a.add(r.id)}),a.size===0)return;de([...a]),R(e=>e.map(e=>{if(!a.has(e.id))return e;let t=n.find(t=>t.id===e.id);return t?{...e,parked_at:t.parked_at}:e}));let o=i.find(e=>e.status===`rejected`),s=a.size===e.tickets.length?o?.reason instanceof Ke?o.reason.message:F(`board.errors.moveBundleToDone`):F(`board.toasts.movedBundleToDonePartial`,{movedCount:e.tickets.length-a.size,totalCount:e.tickets.length});$.error(s,{id:`board-bundle-park-error`})},[ie,gr,de,ue,R,F]),Cr=(0,p.useCallback)(async e=>{let t=new Set(e.tickets.map(e=>e.id)),n=e.tickets.map(e=>({id:e.id,parked_at:e.parked_at}));ue(e.tickets.map(e=>e.id),null),R(e=>e.map(e=>t.has(e.id)?{...e,parked_at:null}:e));let r=await Promise.allSettled(e.tickets.map(e=>En(e.id,e.project_id??ie.current))),i=new Set;if(r.forEach((t,n)=>{if(t.status===`fulfilled`){de([t.value.id]),gr(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&i.add(r.id)}),i.size===0)return;de([...i]),R(e=>e.map(e=>{if(!i.has(e.id))return e;let t=n.find(t=>t.id===e.id);return t?{...e,parked_at:t.parked_at}:e}));let a=r.find(e=>e.status===`rejected`),o=i.size===e.tickets.length?a?.reason instanceof Ke?a.reason.message:F(`board.errors.restoreBundle`):F(`board.toasts.restoredBundlePartial`,{restoredCount:e.tickets.length-i.size,totalCount:e.tickets.length});$.error(o,{id:`board-bundle-unpark-error`})},[ie,gr,de,ue,R,F]),wr=async t=>{if(!e)return;let n=await Ft(e,t);n.warning&&$.warning(n.warning,{id:`board-bundle-delete-warning`}),V(e=>e.filter(e=>e.id!==t))},Tr=(0,p.useCallback)(async t=>{let n=t.tickets.map(e=>({ticket:e,index:L.findIndex(t=>t.id===e.id)})).filter(e=>e.index!==-1);if(n.length===0)return;for(let e of n)ae.current.set(e.ticket.id,e);let r=new Set(n.map(e=>e.ticket.id));R(e=>e.filter(e=>!r.has(e.id))),ee(e=>e.filter(e=>!r.has(e.blocker_ticket_id)&&!r.has(e.dependent_ticket_id)));let i=await Promise.allSettled(n.map(async t=>(await Cn(t.ticket.id,t.ticket.project_id??e),ae.current.delete(t.ticket.id),t.ticket.id)));t.tickets.some(e=>e.project_id===ie.current)&&W().catch(()=>{});let a=n.filter((e,t)=>i[t]?.status===`rejected`);if(a.length===0)return;for(let e of a)ae.current.delete(e.ticket.id);a.some(e=>e.ticket.project_id===ie.current)&&R(e=>[...a].sort((e,t)=>e.index-t.index).reduce((e,t)=>b8(e,t),e));let o=i.find(e=>e.status===`rejected`),s=a.length===n.length?o?.reason instanceof Ke?o.reason.message:F(`board.errors.deleteBundleTickets`):F(`board.toasts.deletedBundleTicketsPartial`,{deletedCount:n.length-a.length,totalCount:n.length});$.error(s,{id:`board-delete-bundle-wrapper-error`})},[e,ie,ae,W,ee,R,L,F]),Er=e=>{let t=pn.get(e.id);gr(e,{reorderInState:t?t.state!==e.state||t.parked_at!==e.parked_at||t.worktree_bundle_id!==e.worktree_bundle_id:!1}),t?.worktree_bundle_id&&t.worktree_bundle_id!==e.worktree_bundle_id&&t.bundle?.ticket_count===1&&V(e=>e.filter(e=>e.id!==t.worktree_bundle_id)),(t?.worktree_bundle_id!==e.worktree_bundle_id||t?.bundle?.ticket_count!==e.bundle?.ticket_count)&&e.project_id===ie.current&&W().catch(()=>{})},Dr=async t=>{let n=L.find(e=>e.id===t),r=L.findIndex(e=>e.id===t);if(!(!n||r===-1)){ae.current.set(t,{ticket:n,index:r}),R(e=>g8(e,t)),ee(e=>Gv(e,t));try{await Cn(t,n.project_id??e),n.project_id===ie.current&&W().catch(()=>{}),ae.current.delete(t)}catch(e){let n=ae.current.get(t);ae.current.delete(t),n&&n.ticket.project_id===ie.current&&(R(e=>b8(e,n)),$.error(e instanceof Ke?e.message:F(`board.errors.deleteTicket`),{id:`board-delete-error`}))}}},Or=async t=>{let n=L.find(e=>e.id===t);if(!n)return;let r=n.state===`review`?`review`:`build`;try{if(qe(r),n.project_id&&n.worktree_bundle_id&&n.state===`review`){qr(await Ot(n.project_id,n.worktree_bundle_id));return}gr(await wn(t,n.project_id??e),{reorderInState:!0})}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.undoTicket`),{id:`board-undo-error`}),e}finally{qe(e=>e===r?null:e)}},kr=async t=>{let n=L.find(e=>e.id===t);try{await On(t,n?.project_id??e)}catch(e){$.error(e instanceof Ke?e.message:F(`board.errors.retryTicket`),{id:`board-retry-error`})}},Ar=async t=>{let n=L.find(e=>e.id===t),r=n?iy(n):t;try{Yt(r),await kn(t,n?.project_id??e),s?.()}catch(e){Yt(e=>e===r?null:e),$.error(e instanceof Ke?e.message:F(`board.errors.startRun`),{id:`board-run-error`})}},jr=(0,p.useCallback)(async t=>{let n=L.find(e=>e.id===t);try{await An(t,n?.project_id??e)}catch(e){$.error(e instanceof Ke?e.message:F(`board.errors.openIde`),{id:`board-open-ide-error`})}},[e,F,L]),Mr=async t=>{let n=L.find(e=>e.id===t),i=r?.kind===`ticket`&&n&&$t===iy(n)?Qt:null;try{await jn(t,n?.project_id??e),o?.(i),s?.()}catch{}},Nr=t=>{Mn(t,L.find(e=>e.id===t)?.project_id??e).then(()=>{R(e=>e.map(e=>e.id===t?{...e,agent_status:`stopped`,is_running:!1}:e))})},Pr=async t=>{let n=L.find(e=>e.id===t);try{await Nn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:F(`reviewInterrupt.error`))}},Fr=t=>{Pn(t,L.find(e=>e.id===t)?.project_id??e).then(()=>{R(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e))})},Ir=(0,p.useCallback)(e=>{let t=ar(e);!t||!nr(t)||jr(t.id)},[nr,ar,jr]),Lr=(0,p.useCallback)((e,t)=>{let n=ar(e),r=t===`files`?sr(e):or(e);if(!(!n||!r)){if(O){O({kind:`bundle`,bundleId:e},t);return}ht({target:{kind:`bundle`,bundleId:e,ticketId:n.id},projectId:n.project_id,title:n.bundle?My(n.bundle):n.title,bundleTargetName:n.bundle&&My(n.bundle)||null,initialMode:t,followUpMode:`build`})}},[sr,or,ar,O]),Rr=(0,p.useCallback)((e,t)=>{let n=ar(e);if(!n?.project_id||!Cy(n))return;let r=n.latest_check_gate_evaluation?.id??L.find(t=>t.worktree_bundle_id===e&&t.latest_check_gate_evaluation)?.latest_check_gate_evaluation?.id??null;if(on.length===0&&!r)return;let i=B.find(t=>t.id===e)??n.bundle;i&&vt({bundleId:e,label:My(i),requestedInitialTab:t,gateEvaluationId:r,requiredCheckPolicy:i.required_check_policy??null})},[B,ar,on.length,L]),zr=(0,p.useCallback)((e,t)=>{let n=L.find(t=>t.id===e);if(!(!n||!rr(n))){if(O){O({kind:`ticket`,ticketId:e},t);return}ht({target:{kind:`ticket`,ticketId:n.id},projectId:n.project_id,title:n.title,bundleTargetName:null,initialMode:t,followUpMode:`build`})}},[rr,O,L]),Br=(0,p.useCallback)(e=>Lr(e,`files`),[Lr]),Vr=(0,p.useCallback)(e=>Lr(e,`changes`),[Lr]),Hr=(0,p.useCallback)(e=>zr(e,`files`),[zr]),Ur=(0,p.useCallback)(e=>zr(e,`changes`),[zr]),Wr=(0,p.useCallback)(e=>{let t=L.find(t=>t.id===e);!t?.project_id||!Cy(t)||pt({ticketId:t.id,label:t.title})},[L]),Gr=(0,p.useCallback)(async(t,n,r=`build`,i)=>{let a=L.find(e=>e.id===t);if(a)try{gr(a.state===`plan`?await zn(t,a.project_id??e,n):await Fn(t,a.project_id??e,n,r,i))}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.sendFollowUp`),{id:`board-follow-up-error`}),e}},[e,gr,F,L]),Kr=(0,p.useCallback)(e=>{R(t=>e.reduce((e,t)=>{let n=e.find(e=>e.id===t.id),r=se(n,t);if(!r)return e;let i=l8(n&&n.state===r.state&&n.agent_status===`running`&&r.agent_status===null?{...r,agent_status:n.agent_status,session_id:n.session_id,is_running:n.is_running}:r);return u8(n,i)?h8(e,i):m8(e,i)},t))},[se,R]),qr=(0,p.useCallback)(e=>{ot(e),V(t=>p8(t,e.bundle)),Kr(e.tickets)},[Kr,V]),Jr=(0,p.useCallback)((e,t)=>{Array.isArray(t.tickets)&&ot(n=>{if(!n||n.bundle.id!==e)return n;let r=vne(n.tickets,t.tickets),i=n.tickets.find(e=>e.id===n.review_owner_ticket_id&&e.state===`review`&&e.agent_status===`running`&&e.updated_at>=(t.tickets.find(t=>t.id===e.id)?.updated_at??``))??null;return{...n,tickets:r,execution_order_ticket_ids:t.execution_order_ticket_ids,latest_session_ticket_id:t.latest_session_ticket_id,latest_session_id:t.latest_session_id,review_owner_ticket_id:t.review_owner_ticket_id??i?.id??null,target_ticket_id:i?.id??t.target_ticket_id}})},[]),Yr=(0,p.useCallback)(async e=>{let t=ie.current;if(!t)return null;let n=await bt(t,e);return ie.current!==t||nt.current!==e?null:(qr(n),n)},[ie,qr]),Xr=(0,p.useCallback)(async()=>{let e=lt?.bundle.id,t=ie.current;if(!e||!t)return null;let n=++dt.current,r=await bt(t,e);return n!==dt.current||ie.current!==t?null:(qr(r),ut(r),r)},[ie,qr,lt?.bundle.id]),Zr=(0,p.useCallback)(async t=>{if(!e)return;ct(t),ut(null);let n=++dt.current;try{let r=await bt(e,t);if(ie.current!==e||n!==dt.current)return;qr(r),ut(r)}catch{if(n!==dt.current||ie.current!==e)return;ct(null),$.error(F(`buildOpenQuestionsDialog.refreshFailedError`),{id:`board-build-open-questions-load-error`})}},[e,ie,qr,F]),Qr=(0,p.useCallback)(async t=>{let n=lt?.bundle.id;if(!e||!n)return;let r=++dt.current;await zt(e,n,t),r===dt.current&&(ct(null),ut(null))},[e,lt?.bundle.id]),$r=lt?.bundle.id??null;(0,p.useEffect)(()=>{if(!$r)return;let e=new Map(L.map(e=>[e.id,e])),t=B.find(e=>e.id===$r);ut(n=>!n||n.bundle.id!==$r?n:{...n,bundle:t?{...n.bundle,...t}:n.bundle,tickets:n.tickets.map(t=>{let n=e.get(t.id);return n?{...t,...n}:t})})},[B,$r,L]);let ei=(0,p.useCallback)(async e=>{let t=ie.current;if(!t)return null;let n=await xt(t,e);return ie.current!==t||nt.current!==e?null:(Jr(e,n),n)},[ie,Jr]),ti=(0,p.useCallback)(async(e,t=null)=>{let n=ie.current;if(!n)return;nt.current=e,Je(null),Xe(null),tt(e),it(t),wt(n8());let r=_n.get(e)??null,i=L.filter(t=>t.worktree_bundle_id===e);if(r&&i.length>0){let e=by(i),t=Ty(i,{latestSessionTicketId:e?.id??null});ot({bundle:r,tickets:i,latest_session_ticket_id:e?.id??null,latest_session_id:e?.session_id??null,review_owner_ticket_id:null,target_ticket_id:t?.id??null})}else ot(null);St(!0);try{await ei(e)}catch(t){if(t instanceof Ke&&t.status===404&&S===e){gn(),j?.();return}}finally{ie.current===n&&St(!1)}},[ie,_n,gn,j,ei,S,L]),ni=(0,p.useCallback)((e,t=null)=>{ti(e,t),E?.(e)},[E,ti]),ri=(0,p.useCallback)(async(e,t)=>{wt(t=>({...t,[e]:!0}));try{return await t()}finally{wt(t=>({...t,[e]:!1}))}},[]),ii=(0,p.useCallback)(async t=>{await ri(`stopBuild`,async()=>{let n=L.find(e=>e.id===t);await Mn(t,n?.project_id??e),R(e=>e.map(e=>e.id===t?{...e,agent_status:`stopped`,is_running:!1}:e)),n?.worktree_bundle_id&&await Yr(n.worktree_bundle_id)})},[e,Yr,ri,R,L]),ai=(0,p.useCallback)(async t=>{await ri(`stopBuild`,async()=>{let n=L.find(e=>e.id===t);try{await Nn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:F(`reviewInterrupt.error`))}})},[e,ri,F,L]),oi=(0,p.useCallback)(async t=>{await ri(`resumeBuild`,async()=>{let n=L.find(e=>e.id===t);await Pn(t,n?.project_id??e),R(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e)),n?.worktree_bundle_id&&await Yr(n.worktree_bundle_id)})},[e,Yr,ri,R,L]),si=(0,p.useCallback)(async t=>{if(e)try{qr(await ri(`build`,()=>Tt(e,t))),et===t&&it(`build`),s?.()}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.buildBundle`),{id:`board-bundle-build-error`}),e}},[e,qr,s,ri,et,F]),ci=(0,p.useCallback)(async t=>{if(e)try{qr(await ri(`review`,()=>Et(e,t))),et===t&&it(`review`)}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.reviewBundle`),{id:`board-bundle-review-error`}),e}},[e,qr,ri,et,F]),li=(0,p.useCallback)(async t=>{if(e)try{qr(await ri(`review`,()=>Dt(e,t))),et===t&&it(`review`)}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.continueBundleReview`),{id:`board-bundle-continue-review-error`}),e}},[e,qr,ri,et,F]),ui=(0,p.useCallback)(async t=>{if(e)try{qe(`review`),qr(await ri(`undoReview`,()=>Ot(e,t))),et===t&&it(`build`)}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.undoBundleReview`),{id:`board-bundle-undo-review-error`}),e}finally{qe(e=>e===`review`?null:e)}},[e,qr,ri,et,F]),di=(0,p.useCallback)(async t=>{if(e)try{qr(await It(e,t))}catch(e){$.error(e instanceof Ke?e.message:`Unable to resume the automation right now.`,{id:`board-bundle-resume-automation-error`})}},[e,qr]),fi=(0,p.useCallback)(async t=>{if(e)try{qr(await Lt(e,t))}catch(e){throw $.error(e instanceof Ke?e.message:F(`ticketAutomation.deliveryReady.error`),{id:`board-bundle-continue-delivery-error`}),e}},[e,qr,F]),pi=(0,p.useCallback)(async t=>{if(e)try{qr(await Rt(e,t))}catch(e){$.error(e instanceof Ke?e.message:`Unable to dismiss the automation pause right now.`,{id:`board-bundle-dismiss-automation-error`})}},[e,qr]),mi=(0,p.useCallback)(async(e,t,n)=>{if(t===T8||n===T8)return;let r=wne(t,n);if(!r)return;let i=L.filter(n=>n.worktree_bundle_id===e&&n.state===t&&n.parked_at===null);if(i.length===0)return;let a=i.map(e=>e.id);ce(a,n),dr(i,n);try{if(r===`build`){await si(e),le(a);return}if(r===`review`){await ci(e),le(a);return}await ui(e),le(a)}catch(e){ur(i),le(a),$.error(e instanceof Ke?e.message:F(`board.errors.moveBundle`),{id:`board-bundle-move-error`})}},[le,si,ci,ui,ce,dr,ur,L,F]),hi=async(t,n)=>{e&&(qr(await ri(`run`,()=>Nt(e,t,n))),s?.())},gi=async e=>{if(S8(t)){Oe(e);return}await hi(e,`project_default`)},_i=async t=>{if(!e)return;let n=r?.kind===`ticket`&&$t===t?Qt:null,i=await ri(`stop`,()=>Pt(e,t));o?.(n),qr(i),s?.()},vi=(0,p.useCallback)(async(t,n,r=`build`,i)=>{e&&qr(await ri(`followUp`,()=>kt(e,t,n,r,i)))},[e,qr,ri]);(0,p.useEffect)(()=>()=>{a?.(null)},[a]),(0,p.useEffect)(()=>{if(!a)return;if(!r){a(null);return}if(r.kind===`project`){a({target:null,canSelect:!1,disabledReason:F(`board.preview.disabledProjectRoot`),submitPrompt:null});return}let e=L.find(e=>e.id===r.ticket_id);if(!e){a({target:null,canSelect:!1,disabledReason:F(`board.preview.disabledBuildCapable`),submitPrompt:null});return}if(e.state===`plan`){a({target:{kind:`ticket`,id:e.id},canSelect:!1,disabledReason:F(`board.preview.disabledPlanMode`),submitPrompt:null});return}if(e.worktree_bundle_id){a({target:{kind:`bundle`,id:e.worktree_bundle_id,ticket_id:e.id},canSelect:!0,disabledReason:null,promptPlaceholder:F(`board.preview.followUpBundlePlaceholder`),submitPrompt:t=>vi(e.worktree_bundle_id,t)});return}a({target:{kind:`ticket`,id:e.id},canSelect:!0,disabledReason:null,promptPlaceholder:F(`board.preview.followUpTicketPlaceholder`),submitPrompt:t=>Gr(e.id,t)})},[r,Gr,vi,a,F,L]);let yi=async t=>{let n=L.find(e=>e.id===t),r=n?ny(n.state):null;if(n)try{if(n.state===`review`&&n.can_re_review&&n.agent_status!==`running`){let t=await Ln(n.id,n.project_id??e);gr(t),t.worktree_bundle_id&&await Yr(t.worktree_bundle_id);return}if(!r)return;if(n.worktree_bundle_id&&r===`review`){await ci(n.worktree_bundle_id);return}await vr(n,r)}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.moveTicket`),{id:`board-move-error`}),e}},bi=async t=>{let n=L.find(e=>e.id===t);try{gr(await xn(t,n?.project_id??e))}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.startBuildChain`),{id:`board-build-chain-error`}),e}},xi=async t=>{let n=L.find(e=>e.id===t);try{await Sn(t,n?.project_id??e)}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.stopBuildChain`),{id:`board-stop-build-chain-error`}),e}},Si=async()=>{if(!(!e||Ue)){We(!0);try{let t=await Dn(e);R(e=>e.filter(e=>!t.deleted_ticket_ids.includes(e.id))),ee(e=>t.deleted_ticket_ids.reduce(Gv,e)),await W(),He(!1),t.failed_count>0?$.error(F(`board.toasts.deleteDonePartial`,{count:t.deleted_count,deletedCount:t.deleted_count,failedCount:t.failed_count}),{id:`board-delete-parked-error`}):$.success(F(`board.toasts.deleteDoneSuccess`,{count:t.deleted_count}),{id:`board-delete-parked-success`})}catch(e){$.error(e instanceof Ke?e.message:F(`board.errors.emptyDone`),{id:`board-delete-parked-error`})}finally{We(!1)}}},Ci=({delta:e})=>{we(e)},wi=(0,p.useCallback)((t=null)=>{e&&Ee({initialWorktreeBundleId:t})},[e]);(0,p.useEffect)(()=>{!M||!e||(Ee({initialWorktreeBundleId:null,initialImportedDraft:M}),N?.())},[M,e,N]),(0,p.useEffect)(()=>{if(!Y||!e){Ze.current=null;return}let t=`${e}:${Y}`;if(U!==e||Ze.current===t)return;Ze.current=t;let n=pn.get(Y);n?hn(n):_?.(),v===void 0&&g?.()},[e,U,g,_,hn,Y,v,pn]),(0,p.useEffect)(()=>{v===void 0||v||!J||y.some(e=>e.kind===`ticket`&&e.ticketId===J.id)||(Je(null),Xe(null))},[y,v,J]),(0,p.useEffect)(()=>{!v||!e||U!==e||Ze.current!==`${e}:${v}`||q!==v||pn.has(v)||(Je(null),Xe(null),_?.())},[e,U,_,v,q,pn]),(0,p.useEffect)(()=>{if(!S){let e=C?.target.kind===`bundle`?C.target.bundleId:null,t=e!==null&&nt.current===e,n=nt.current!==null&&y.some(e=>e.kind===`bundle`&&e.bundleId===nt.current);Qe.current&&!t&&!n&&(Qe.current=null,e===null&&gn());return}let t=`${e}:${S}`;if(!(!e||U!==e||ne!==e||Qe.current===t)){if(Qe.current=t,!_n.has(S)){j?.();return}ti(S)}},[e,_n,ne,gn,U,j,ti,S,C,y,at,et]),(0,p.useEffect)(()=>{!S||!e||U!==e||ne!==e||Qe.current!==`${e}:${S}`||et!==S||_n.has(S)||(gn(),j?.())},[e,_n,ne,gn,U,j,S,et]),(0,p.useEffect)(()=>{if(!C){$e.current=null,ht(e=>e?.isRouteOwned?null:e);return}let t=C?.target.kind===`bundle`?U===e&&ne===e:U===e;if(!e||!t)return;let n=`${e}:${C.target.kind===`ticket`?`ticket:${C.target.ticketId}`:`bundle:${C.target.bundleId}`}`;if($e.current===n)return;$e.current=n;let r=C.target,i=r.kind===`ticket`&&y.some(e=>e.kind===`ticket`&&e.ticketId===r.ticketId),a=y.some(e=>e.kind===`bundle`&&e.bundleId===(r.kind===`bundle`?r.bundleId:nt.current));if(i||(Je(null),Xe(null)),!a&&r.kind===`ticket`&&gn(),ht(e=>e?.isRouteOwned?null:e),C.target.kind===`ticket`){let e=pn.get(C.target.ticketId);if(!e||!rr(e)){j?.();return}ht({target:{kind:`ticket`,ticketId:e.id},projectId:e.project_id,title:e.title,bundleTargetName:null,initialMode:C.mode,followUpMode:`build`,isRouteOwned:!0});return}let{bundleId:o}=C.target,s=ar(o),c=C.mode===`files`?sr(o):or(o);if(!s||!c){j?.();return}let l=_n.get(o)??s.bundle??null;ht({target:{kind:`bundle`,bundleId:o,ticketId:s.id},projectId:s.project_id,title:l?My(l):s.title,bundleTargetName:l&&My(l)||null,initialMode:C.mode,followUpMode:`build`,isRouteOwned:!0})},[e,_n,ne,sr,or,rr,gn,ar,U,j,C,y,at,et,pn]),(0,p.useEffect)(()=>{let t=C?.target.kind===`bundle`?U===e&&ne===e:U===e;if(!C||!e||!t)return;let n=C.target.kind===`ticket`?`ticket:${C.target.ticketId}`:`bundle:${C.target.bundleId}`;if($e.current!==`${e}:${n}`||!mt?.isRouteOwned)return;if(C.target.kind===`ticket`){if(mt.target.kind!==`ticket`||mt.target.ticketId!==C.target.ticketId)return;let e=pn.get(C.target.ticketId);(!e||!rr(e))&&(ht(null),j?.());return}if(mt.target.kind!==`bundle`||mt.target.bundleId!==C.target.bundleId)return;let{bundleId:r}=C.target,i=ar(r),a=C.mode===`files`?sr(r):or(r);if(!i||!a){ht(null),j?.();return}if(mt.target.ticketId!==i.id){let e=_n.get(r)??i.bundle??null;ht(t=>t?.isRouteOwned?{...t,target:{kind:`bundle`,bundleId:r,ticketId:i.id},projectId:i.project_id,title:e?My(e):i.title,bundleTargetName:e&&My(e)||null}:t)}},[e,_n,ne,sr,or,rr,ar,U,j,C,mt,pn]);let Ti=(0,p.useCallback)(()=>{qt.current?.focus({preventScroll:!0})},[]);return Sme([{key:`n`,onKeyDown:wi,disabled:!e},{key:`k`,ctrlKey:!0,onKeyDown:Ti}],{isBlocked:xme}),(0,X.jsxs)(X.Fragment,{children:[!T&&(0,X.jsxs)(use,{sensors:I,collisionDetection:voe,onDragStart:cr,onDragMove:Ci,onDragCancel:lr,onDragEnd:pr,children:[(0,X.jsx)(`div`,{className:`relative flex min-h-0 flex-1 overflow-hidden`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 overflow-hidden p-6`,children:[(0,X.jsx)(Gde,{query:Vt.query,inputRef:qt,hideStaleTickets:Vt.hideStaleTickets,hideBundlesWithPullRequests:Vt.hideBundlesWithPullRequests,onQueryChange:e=>Ht({query:e}),onClear:()=>{Ht({query:``}),qt.current?.focus()},onHideStaleTicketsChange:e=>Ht({hideStaleTickets:e}),onHideBundlesWithPullRequestsChange:e=>Ht({hideBundlesWithPullRequests:e})}),(0,X.jsx)(`div`,{ref:Vn,className:`flex min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,children:(0,X.jsxs)(`div`,{ref:Hn,className:`relative flex min-h-0 w-max min-w-full gap-4`,children:[(0,X.jsx)(sme,{dependencies:z,cardRects:Gn,clipRects:Kn,preview:qn,ticketsById:pn,overlaySize:Jn}),w8.map(t=>{let n=L.filter(e=>e.state===t&&!ly(e)),r=yn.filter(e=>e.state===t&&!ly(e)),a=Ey(r,B,t),o=an&&n.length===0?t===`plan`?1:t===`build`?2:0:0;return(0,X.jsx)(p3,{id:t,title:F(`card.columnLabels.${t}`),items:a,ticketCount:r.length,allTickets:L,dependencies:z,bundles:B,activeTool:i,modelsByTool:Re,availableSkills:ze,activeRunContextKey:tn,automationStatuses:pe,isProjectRootRunActive:en,isBundleRunDisabled:nn,getDependencyTargetState:Yn,onDependencyStart:Xn,onDeleteDependency:Zn,onRegisterTicketNode:Un,onRegisterDependencyClipNodes:Wn,onAddTicket:t===`plan`&&e?wi:void 0,onCreateBundle:t===`plan`&&e?hr:void 0,onDeleteBundle:t===`plan`&&e?wr:void 0,onDeleteBundleWrapper:Tr,onRefreshBundles:t===`plan`&&e?W:void 0,onUpdateTicket:Er,onDeleteTicket:Dr,onUndoTicket:Or,undoingColumn:Ge,onRetryTicket:kr,onAdvanceTicket:yi,onParkTicket:br,onUnparkTicket:xr,onBuildChainTicket:bi,onRunTicket:Ar,onOpenVerificationTicket:on.length>0?Wr:void 0,canOpenChangesForTicket:rr,onOpenFilesTicket:Hr,onOpenChangesTicket:Ur,canOpenIdeForTicket:nr,onOpenIdeTicket:jr,onStopTicket:Mr,onStopBuildTicket:Nr,onStopBuildChainTicket:xi,onResumeBuildTicket:Fr,onInterruptReviewTicket:Pr,onOpenBundleFiles:Br,onOpenBundleChanges:Vr,canOpenReviewForBundle:or,canOpenFilesForBundle:sr,onOpenBundleVerification:on.length>0?e=>Rr(e):void 0,onOpenBundleChecks:e=>Rr(e,`checks`),hasConfiguredChecks:on.length>0,onOpenBundleIde:Ir,onAddTicketToBundle:wi,onStartChatFromBundle:u,onFollowUpTicket:Gr,bundleActionState:Ct,onBuildBundle:si,onReviewBundle:ci,onUndoBundleReview:ui,onRunBundle:gi,onStopBundle:_i,onParkBundleWrapper:Sr,onUnparkBundleWrapper:Cr,onOpenTicketDetails:hn,onOpenBundleDetails:(e,t)=>{ni(e,t)},onRequestBundleRefresh:e=>{ri(`bundleRefresh`,()=>Yr(e))},onRequestTicketRefresh:oe,hoveredBundleId:ve,onHoverBundleChange:be,multiColumnBundleIds:bn,onResumeBundleAutomation:di,onContinueBundleDelivery:fi,onDismissBundleAutomationPause:pi,onOpenBuildQuestions:e=>{Zr(e)},loadingSkeletonCount:o},t)}),(0,X.jsx)(p3,{id:T8,title:F(`card.columnLabels.done`),items:Rn,ticketCount:In.length,allTickets:L,dependencies:z,activeTool:i,modelsByTool:Re,availableSkills:ze,bundles:B,activeRunContextKey:tn,automationStatuses:pe,isProjectRootRunActive:en,isBundleRunDisabled:nn,getDependencyTargetState:Yn,onDependencyStart:Xn,onDeleteDependency:Zn,onRegisterTicketNode:Un,onRegisterDependencyClipNodes:Wn,onUpdateTicket:Er,onDeleteTicket:Dr,onUndoTicket:Or,undoingColumn:Ge,onRetryTicket:kr,onAdvanceTicket:yi,onParkTicket:br,onUnparkTicket:xr,onBuildChainTicket:bi,onRunTicket:Ar,onOpenVerificationTicket:on.length>0?Wr:void 0,canOpenChangesForTicket:rr,onOpenFilesTicket:Hr,onOpenChangesTicket:Ur,canOpenIdeForTicket:nr,onOpenIdeTicket:jr,onStopTicket:Mr,onStopBuildTicket:Nr,onStopBuildChainTicket:xi,onResumeBuildTicket:Fr,onInterruptReviewTicket:Pr,onOpenBundleFiles:Br,onOpenBundleChanges:Vr,canOpenReviewForBundle:or,canOpenFilesForBundle:sr,onOpenBundleVerification:on.length>0?e=>Rr(e):void 0,onOpenBundleChecks:e=>Rr(e,`checks`),hasConfiguredChecks:on.length>0,onOpenBundleIde:Ir,onAddTicketToBundle:wi,onStartChatFromBundle:u,onFollowUpTicket:Gr,bundleActionState:Ct,onBuildBundle:si,onReviewBundle:ci,onUndoBundleReview:ui,onRunBundle:gi,onStopBundle:_i,onParkBundleWrapper:Sr,onUnparkBundleWrapper:Cr,onOpenTicketDetails:hn,onOpenBundleDetails:(e,t)=>{ni(e,t)},onRequestBundleRefresh:e=>{ri(`bundleRefresh`,()=>Yr(e))},onRequestTicketRefresh:oe,hoveredBundleId:ve,onHoverBundleChange:be,multiColumnBundleIds:bn,onResumeBundleAutomation:di,onContinueBundleDelivery:fi,onDismissBundleAutomationPause:pi,onOpenBuildQuestions:e=>{Zr(e)},className:`min-w-[272px] max-w-[272px] flex-[0.98] bg-card/65`,headerAccessory:(0,X.jsxs)(Q,{type:`button`,variant:`destructive`,size:`xs`,className:`gap-1.5`,disabled:In.length===0||Ue,onClick:()=>He(!0),children:[(0,X.jsx)(wC,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:F(`board.doneColumn.emptyAction`)})]})})]})})]})}),(0,X.jsxs)(Ese,{zIndex:5,dropAnimation:G?null:void 0,children:[me&&(0,X.jsx)(f3,{ticket:me,allTickets:L,dependencies:z,bundles:B,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:me.worktree_bundle_id?pe.get(me.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:(()=>{let e=yF(me,i);return bF(e)&&Le(e).length>0})(),availableModels:Le(yF(me,i)),runDisabled:ay(me,tn,en,F(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:ay(me,tn,en,F(`board.errors.runBlockedByActive`)),onDependencyStart:Xn,onDeleteDependency:Zn,onRegisterOverlayNode:Se,onCreateBundle:hr,onDeleteBundle:wr,onRefreshBundles:W,onUpdate:Er,onDelete:()=>Dr(me.id),onUndo:()=>Or(me.id),undoInProgress:Ge===me.state&&(me.state===`build`||me.state===`review`),onRetry:()=>kr(me.id),onAdvance:()=>yi(me.id),onPark:()=>br(me.id),onUnpark:()=>xr(me.id),onBuildChain:()=>bi(me.id),onRun:me.worktree_bundle_id===null&&Cy(me)&&me.has_run_config?()=>Ar(me.id):void 0,onOpenIde:me.worktree_bundle_id===null&&nr(me)?()=>jr(me.id):void 0,onStop:me.worktree_bundle_id===null?()=>Mr(me.id):void 0,onStopBuild:()=>Nr(me.id),onStopBuildChain:()=>xi(me.id),onResumeBuild:()=>Fr(me.id),onInterruptReview:()=>void Pr(me.id),onFollowUp:e=>Gr(me.id,e),onRequestTicketRefresh:oe}),!me&&ge&&(0,X.jsx)(CF,{group:ge,activeTool:i,modelsByTool:Re,automationStatus:pe.get(ge.bundle.id),overlay:!0,renderTicket:tr})]}),rn&&(0,X.jsx)(ume,{className:`pointer-events-auto fixed left-1/2 top-4 z-20 w-[min(14rem,calc(100vw-2rem))] -translate-x-1/2`})]}),Te&&(()=>{let r=Le(i),a=Wt&&Qn.model&&r.some(e=>e.id===Qn.model),o=a?Qn.model:``,s=a?Qn.variant:``;return(0,X.jsx)(lme,{onSubmit:mr,bundles:B,projectId:e,projectBranchState:n,tool:i,showModelSelector:Wt,showSkillsSelector:i===`opencode`,showDockerSandboxModelNotice:t?.build_execution_provider===`docker_sandbox`,onOpenProjectExecutionSettings:P,availableModels:r,availableSkills:ze,initialModel:o,initialVariant:s,initialSkills:Wt&&i===`opencode`?Qn.skills:[],initialWorktreeBundleId:Te.initialWorktreeBundleId,initialImportedDraft:Te.initialImportedDraft,onCreateBundle:hr,onDeleteBundle:wr,onRefreshBundles:W,onClose:()=>Ee(null)})})(),Ve&&(0,X.jsx)(Kde,{ticketCount:In.length,isDeleting:Ue,onCancel:()=>He(!1),onConfirm:()=>{Si()}}),De&&(0,X.jsx)(fC,{onSelect:e=>{let t=De;Oe(null),e&&hi(t,e)}}),J&&(0,X.jsx)(d3,{ticket:J,allTickets:L,dependencies:z,bundles:B,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:J.automation_paused_reason?null:J.worktree_bundle_id?pe.get(J.worktree_bundle_id):null,projectBranchState:n,onClose:()=>{let e=J.id;Je(null),Xe(null),R(t=>t.map(t=>t.id===e?l8(t):t)),x?.()},showModelSelector:Gt,showSkillsSelector:yF(J,i)===`opencode`,activeTool:i,availableModels:Le(yF(J,i)),availableReviewerModels:Fe[i],isLoadingReviewerModels:Ie[i],availableSkills:ze,runDisabled:ay(J,tn,en,F(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:ay(J,tn,en,F(`board.errors.runBlockedByActive`)),onDeleteDependency:Zn,onCreateBundle:hr,onDeleteBundle:wr,onRefreshBundles:W,onUpdate:Er,onAdvance:()=>yi(J.id),onBuildChain:()=>bi(J.id),onRun:Cy(J)&&J.has_run_config?()=>Ar(J.id):void 0,onOpenIde:nr(J)?()=>jr(J.id):void 0,onStop:()=>Mr(J.id),onStopBuild:()=>Nr(J.id),onStopBuildChain:()=>xi(J.id),onResumeBuild:()=>Fr(J.id),onInterruptReview:()=>void Pr(J.id),onFollowUp:(e,t)=>Gr(J.id,e,t),onReviewFollowUp:(e,t)=>J.worktree_bundle_id?vi(J.worktree_bundle_id,e,t,`changes`):Gr(J.id,e,t,`changes`),onProjectMemorySuggestionsChanged:()=>{jt(e=>e+1)},onRequestTicketRefresh:e=>{mn(e)},onWorkspaceReviewOpen:O?e=>{O({kind:`ticket`,ticketId:J.id},e)}:void 0,onViewSourceSpec:c,onNavigateToLifecycleSource:l,onOpenBuildQuestions:e=>{Zr(e)},onOpenChecks:J.worktree_bundle_id&&(on.length>0||J.latest_check_gate_evaluation)?()=>{Rr(J.worktree_bundle_id,`checks`)}:void 0,onStopAutomation:J.worktree_bundle_id?()=>_i(J.worktree_bundle_id):void 0}),ft&&e&&t&&(()=>{let t=L.find(e=>e.id===ft.ticketId);if(!t)return null;let n=!!t.worktree_bundle_id,r=t.worktree_bundle_id?_n.get(t.worktree_bundle_id)?.required_check_policy??t.bundle?.required_check_policy:void 0,i=r?.required_check_definition_ids??cn,a=r?.pre_review_check_definition_ids??un,o=n?{projectId:e,targetKind:`bundle`,targetBundleId:t.worktree_bundle_id}:null,s={scope:`ticket`,ticketId:t.id,projectId:t.project_id};return(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(C8,{targetLabel:ft.label,definitions:on,requiredDefinitionIds:i,preReviewDefinitionIds:a,checksTarget:o,testsTarget:s,onClose:()=>pt(null),requestedInitialTab:ft.requestedInitialTab})})})(),mt&&(()=>{let{target:e}=mt,t=L.find(t=>t.id===e.ticketId),n=e.kind===`bundle`,r=n?L.some(t=>t.worktree_bundle_id===e.bundleId):!!t,i=n?L.some(t=>t.worktree_bundle_id===e.bundleId&&t.agent_status===`running`):t?.agent_status===`running`,a=n?r&&!i:!!t&&!i,o=!!(mt.isRouteOwned&&w!==void 0),s=o?w:null,l=o?s?.canSubmitReviewPrompt??!1:a,u=i?F(`board.changes.reviewPromptDisabledReason`):r?!n&&t?s3(t).disabledReason??void 0:void 0:F(`board.changes.targetUnavailableReason`),d=!i&&(n||t?.state===`build`||t?.state===`review`),f=!!t?.messages?.some(e=>e.metadata?.ask_question?.status===`pending`),p=!!(!o&&t&&JY(t,mt.followUpMode,f)),m=async()=>{ht(e=>e&&{...e,followUpMode:`build`});try{n?await vi(e.bundleId,`Implement this plan.`,`build`,`changes`):await Gr(e.ticketId,`Implement this plan.`,`build`,`changes`)}catch(e){throw ht(e=>e&&{...e,followUpMode:`plan`}),e}},h=n?_n.get(e.bundleId):void 0;return(0,X.jsx)(H6,{target:{scope:`ticket`,ticketId:e.ticketId,onTicketUpdate:Er,onRequestTicketRefresh:oe},initialMode:mt.initialMode,reviewMode:mt.isRouteOwned?C?.mode:void 0,onReviewModeChange:mt.isRouteOwned?k:void 0,enabledModes:[`changes`,`files`],projectId:mt.projectId,reviewCommentsBundleId:n?e.bundleId:null,title:mt.title,bundleTargetName:mt.bundleTargetName,fileTarget:h?.kind===`project_root`?{kind:`repo_root`,bundle_id:null,ticket_id:null}:void 0,onSubmitReviewPrompt:o?s?.submitPrompt:t=>n?vi(e.bundleId,t,mt.followUpMode,`changes`):Gr(e.ticketId,t,mt.followUpMode,`changes`),canSubmitReviewPrompt:l,reviewSubmitDisabledReason:o?s?.reviewSubmitDisabledReason??F(`workspaceReviewModal.chatRequired`):u,canAddReviewComments:l,canModifyChanges:a,changesDisabledReason:i?F(`board.changes.modifyChangesDisabledReason`):u,mode:o?s?.mode:mt.followUpMode,onModeChange:o?s?.onModeChange:e=>{ht(t=>t&&{...t,followUpMode:e})},canToggleMode:o?s?.canSubmitReviewPrompt??!1:d,modeActions:p?(0,X.jsx)(tX,{disabled:!a,onClick:()=>void m()}):void 0,isUpdatingMode:s?.isUpdatingMode??!1,onClose:()=>{if(ht(null),mt.isRouteOwned&&A?.(),n){Yr(e.bundleId);return}mn(e.ticketId)},onViewSourceSpec:c,originSpecSessionId:t?.origin_spec_session_id??null,originSpecSnapshotId:t?.origin_spec_snapshot_id??null})})(),gt&&e&&t&&(()=>{let t=_n.get(gt.bundleId)?.required_check_policy??gt.requiredCheckPolicy,n=t?.required_check_definition_ids??cn,r=t?.pre_review_check_definition_ids??un;return(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(C8,{targetLabel:gt.label,definitions:on,requiredDefinitionIds:n,preReviewDefinitionIds:r,checksTarget:{projectId:e,targetKind:`bundle`,targetBundleId:gt.bundleId,gateEvaluationId:gt.gateEvaluationId},testsTarget:fn?{scope:`project`,projectId:e,targetKind:`bundle`,targetBundleId:gt.bundleId}:null,onClose:()=>vt(null),requestedInitialTab:gt.requestedInitialTab})})})(),et&&vn&&(0,X.jsx)(rfe,{details:vn,activeColumn:rt,isLoading:yt||Ct.bundleRefresh,actionState:Ct,canOpenIde:ir(vn),projectMemoryEnabled:!!t?.memory_enabled,memorySuggestionsRefreshKey:At,automationStatus:vn.tickets.some(e=>e.automation_paused_reason)?null:pe.get(vn.bundle.id),runDisabled:nn(vn.bundle.id),showModelSelector:Kt,activeTool:i,modelsByTool:Re,modelsLoadingByTool:Ie,availableSkills:ze,onClose:()=>{let e=vn.bundle.id;tt(null),it(null),ot(null),St(!1),wt(n8()),R(t=>t.map(t=>t.worktree_bundle_id===e&&t.id!==q?l8(t):t)),D?.()},onOpenTicketDetails:hn,onNavigateToLifecycleSource:l,onUpdateTicket:Er,onOpenIde:()=>{let e=vn.tickets.find(e=>e.id===vn.target_ticket_id)??vn.tickets.find(e=>e.has_worktree);e&&jr(e.id)},onOpenVerification:on.length>0?()=>{Rr(vn.bundle.id)}:void 0,onOpenChecks:on.length>0||vn.tickets.some(e=>e.latest_check_gate_evaluation)?()=>{Rr(vn.bundle.id,`checks`)}:void 0,onRefresh:e=>ri(`bundleRefresh`,()=>Yr(e)).then(()=>void 0),onWorkspaceReviewOpen:O?e=>{O({kind:`bundle`,bundleId:vn.bundle.id},e)}:void 0,onUpdateBundle:_r,onBuildBundle:si,onStopBuildTicket:ii,onResumeBuildTicket:oi,onInterruptReviewTicket:ai,onReviewBundle:ci,onContinueReviewBundle:li,onUndoBundleReview:ui,onRunBundle:gi,onStopBundle:_i,onFollowUpBundle:vi,onOpenBuildQuestions:e=>{Zr(e)},onResumeBundleAutomation:di,onContinueBundleDelivery:fi,onDismissBundleAutomationPause:pi}),st&<&&(0,X.jsx)($pe,{details:lt,onClose:()=>{dt.current+=1,ct(null),ut(null)},onRefresh:Xr,onSubmit:Qr})]})},E8=({count:e,title:t,isDeleting:n,onConfirm:r,onCancel:i,labels:a})=>{let o=e>1;return(0,X.jsxs)(uC,{onClose:i,overlayClassName:`bg-black/70`,panelClassName:`max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,X.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:o?a.bulkTitle:a.title}),t?(0,X.jsx)(`p`,{className:`mb-1 text-sm text-foreground`,children:t}):null,(0,X.jsx)(`p`,{className:`mb-6 text-xs text-muted-foreground`,children:o?a.bulkDescription(e):a.description}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(Q,{type:`button`,variant:`ghost`,onClick:i,disabled:n,children:a.cancel}),(0,X.jsx)(Q,{type:`button`,variant:`destructive`,onClick:r,disabled:n,children:n?a.deleting:a.delete})]})]})},D8=({label:e})=>(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-sm text-muted-foreground`,children:e}),O8=({label:e})=>(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-sm text-muted-foreground`,children:e}),k8=({title:e,description:t,startNewSessionLabel:n,onStartNewSession:r,canStartNewSession:i})=>(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6`,children:(0,X.jsxs)(gC,{className:`w-full max-w-lg border-dashed border-border/70 bg-card/40`,children:[(0,X.jsxs)(_C,{children:[(0,X.jsx)(vC,{children:e}),(0,X.jsx)(yC,{children:t})]}),(0,X.jsx)(xC,{children:(0,X.jsx)(Q,{type:`button`,onClick:r,disabled:!i,children:n})})]})}),qme=({className:e})=>(0,X.jsx)(Ste,{"aria-hidden":`true`,className:e}),Jme=({className:e})=>(0,X.jsx)(dte,{"aria-hidden":`true`,className:e}),Yme=({className:e})=>(0,X.jsx)(fte,{"aria-hidden":`true`,className:e}),A8=({sessions:e,sessionGroups:t,activeSessionId:n,isDraftOpen:r,isLoadingSessions:i,isOpen:a,onToggleOpen:o,testId:s,railTestId:c,onDraftOpen:l,isCreatingSession:u,isSendingPrompt:d,newSessionShortcutHint:f,newSessionTooltip:m,isSelectionMode:h,selectedSessionIds:g,selectedSessionCount:_,hasDeletableSessions:v,deletingSessionIds:y,onEnterSelectionMode:b,onExitSelectionMode:x,onToggleSessionSelection:S,onSetSessionSelection:C,onConfirmDeleteSelectedSessions:w,selectionPresets:T,onSessionSelect:E,onConfirmDeleteSession:D,getSessionId:O,getSessionTitle:k,getDeleteDisabledReason:A,getActivityState:j,getRowAriaLabel:M,renderRowContent:N,labels:P})=>{let F=(0,p.useMemo)(()=>new Set(e.filter(e=>!A(e)&&!y.has(O(e))).map(e=>O(e))),[y,A,O,e]),I=(0,p.useMemo)(()=>T.map(t=>({...t,matchingSessionIds:new Set(e.filter(e=>F.has(O(e))&&t.matches(e)).map(O))})),[O,F,T,e]),L=(0,p.useRef)(null),R=(0,p.useRef)(!1),z=(0,p.useRef)(null),ee=(0,p.useCallback)(()=>{z.current!==null&&(window.clearTimeout(z.current),z.current=null)},[]),B=(0,p.useCallback)(()=>{ee(),z.current=window.setTimeout(()=>{R.current=!1,z.current=null},0)},[ee]),V=(0,p.useCallback)(()=>{L.current&&(L.current=null,B())},[B]),te=(0,p.useCallback)(e=>{let t=L.current;!t||t.visitedSessionIds.has(e)||!F.has(e)||(t.visitedSessionIds.add(e),C(e,t.mode===`select`))},[C,F]),H=(0,p.useCallback)(e=>{let t=L.current;!t||e.pointerId!==t.pointerId||V()},[V]);return(0,p.useEffect)(()=>{if(!h){V();return}return window.addEventListener(`pointerup`,H),window.addEventListener(`pointercancel`,H),()=>{window.removeEventListener(`pointerup`,H),window.removeEventListener(`pointercancel`,H),V(),ee()}},[ee,H,h,V]),(0,X.jsx)(`aside`,{"data-testid":s,"data-state":a?`expanded`:`collapsed`,"aria-label":P.ariaLabel,className:Z(`relative z-20 flex h-full shrink-0 flex-col overflow-hidden border-r border-border/70 bg-background/40 transition-[width] duration-200 ease-out motion-reduce:transition-none`,a?`w-72`:`w-16`),children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-start gap-2 border-b border-border/70 px-4 py-3.5`,children:[(0,X.jsxs)(Q,{type:`button`,size:`sm`,className:`gap-2`,onClick:l,disabled:u||d,children:[(0,X.jsx)(hv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:P.newSession}),f]}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":P.collapseAriaLabel,"aria-expanded":a,className:`ml-auto`,onClick:o,children:(0,X.jsx)(Jme,{className:`h-4 w-4`})})]}),e.length>0?(0,X.jsx)(`div`,{className:`px-4 py-2.5`,children:h?(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:x,disabled:y.size>0,children:P.cancelSelection}),(0,X.jsxs)(Ry,{children:[(0,X.jsx)(zy,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`h-7 gap-1.5 px-2 text-xs`,children:P.addPreset})}),(0,X.jsx)(By,{align:`start`,className:`w-44`,children:I.map(e=>(0,X.jsx)(Vy,{disabled:e.matchingSessionIds.size===0,onSelect:()=>{for(let t of e.matchingSessionIds)C(t,!0)},children:e.label},e.key))})]}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`destructive`,className:`h-7 px-2 text-xs`,onClick:w,disabled:_===0||y.size>0,children:P.deleteSelected})]}),(0,X.jsx)(`div`,{className:`flex justify-end text-xs font-medium text-muted-foreground`,children:P.selectedCount(_)})]}):v?(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2 text-xs`,onClick:b,children:[(0,X.jsx)(qme,{className:`h-3.5 w-3.5`}),P.select]}):null}):null,(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2`,children:i&&e.length===0?(0,X.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground`,children:P.loadingSessions}):e.length===0?(0,X.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/70 px-3 py-4 text-sm text-muted-foreground`,children:P.noSessions}):(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:t.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{className:`px-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground/80`,children:e.label}),e.sessions.map(e=>{let t=O(e),i=!r&&t===n,a=A(e),o=y.has(t),s=!!a||o,c=g.has(t),l=j(e,i);return(0,X.jsxs)(`div`,{"data-session-id":t,"data-session-selectable":s?`false`:`true`,className:Z(`group relative rounded-xl border transition-colors`,i?`border-sky-400/40 bg-sky-500/10 text-foreground ring-1 ring-sky-400/40`:`border-border/50 bg-card/35 text-muted-foreground hover:border-border/80 hover:bg-card/60 hover:text-foreground`),onPointerDownCapture:e=>{!h||s||e.pointerType&&e.pointerType!==`mouse`||typeof e.button==`number`&&e.button!==0||(e.preventDefault(),ee(),R.current=!0,L.current={pointerId:e.pointerId,mode:c?`deselect`:`select`,visitedSessionIds:new Set},te(t))},onPointerMove:e=>{let n=L.current;!n||n.pointerId!==e.pointerId||te(t)},children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":M(e,l),className:`flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-xl px-3 py-2 pr-11 text-left transition-colors focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,onClick:()=>{if(h){if(R.current){R.current=!1;return}if(s)return;S(t);return}E(e)},children:N({session:e,isActive:i,activityState:l,isSelectionMode:h})}),h?(0,X.jsx)(`div`,{className:`absolute top-2 right-2 flex h-7 w-7 items-center justify-center`,title:a??P.selectSessionTitle(k(e)),children:(0,X.jsx)(`input`,{type:`checkbox`,"aria-label":P.selectSessionAriaLabel(k(e)),checked:c,disabled:s,onClick:e=>{e.stopPropagation()},onChange:()=>{R.current||S(t)},className:`h-4 w-4 rounded border-border bg-background text-primary`})}):(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":P.deleteSessionAriaLabel,className:Z(`absolute top-2 right-2 h-7 w-7 shrink-0 rounded-md border border-transparent text-muted-foreground transition-all duration-150 hover:border-border/70 hover:bg-card/80 hover:text-foreground focus-visible:border-border/70 focus-visible:bg-card/80 focus-visible:text-foreground`,`opacity-100 sm:opacity-0 sm:pointer-events-none sm:group-hover:pointer-events-auto sm:group-focus-within:pointer-events-auto sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,s&&`sm:disabled:opacity-0 sm:group-hover:disabled:opacity-50 sm:group-focus-within:disabled:opacity-50`,(i||o)&&`sm:pointer-events-auto sm:opacity-100 sm:disabled:opacity-50`,a&&`cursor-not-allowed text-muted-foreground/50 hover:border-transparent hover:bg-transparent hover:text-muted-foreground/50 focus-visible:border-transparent focus-visible:bg-transparent focus-visible:text-muted-foreground/50`),title:a??P.deleteSessionTitle(k(e)),disabled:s,onClick:e=>{e.stopPropagation(),D(t)},children:(0,X.jsx)(wC,{className:`h-4 w-4`})})]},t)})]},e.key))})})]}):(0,X.jsxs)(`div`,{"data-testid":c,className:`flex h-full w-full flex-col items-center gap-2 bg-background/80 py-3`,children:[m?(0,X.jsx)(lv,{content:m,side:`right`,children:(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":P.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,X.jsx)(hv,{className:`h-4 w-4`})})}):(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":P.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,X.jsx)(hv,{className:`h-4 w-4`})}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":P.openAriaLabel,"aria-expanded":a,className:`h-9 w-9`,onClick:o,children:(0,X.jsx)(Yme,{className:`h-4 w-4`})})]})})},j8=({action:e,isPending:t,disabled:n=!1,onAction:r,label:i,pendingLabel:a})=>(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:n||t,onClick:r,children:[t?(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`}):e===`resume`?(0,X.jsx)(Ev,{className:`h-4 w-4`}):(0,X.jsx)(Ov,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:t?a:i})]}),M8=4,Xme=5e3,N8=(e,t)=>jb.t(`common:chatChangesPanel.${e}`,t),P8=e=>e.replace(/^[ab]\//,``),F8=e=>{let t=`oldPath`in e&&typeof e.oldPath==`string`?P8(e.oldPath):``,n=`newPath`in e&&typeof e.newPath==`string`?P8(e.newPath):``;return[...new Set([n,t].filter(e=>e&&e!==`/dev/null`))]},I8=e=>{let[t,n]=F8(e);return!t&&!n?N8(`unknownFile`):t&&n&&t!==n?`${n} -> ${t}`:t??n??N8(`unknownFile`)},L8=e=>{let t=mG((()=>{let[t,n]=F8(e);return t??n??null})());if(!t)return null;try{return vj(e.hunks,{highlight:!0,refractor:lK.default,language:t,enhancers:[gj(e.hunks)]})}catch{return null}},R8=(e,t)=>e instanceof Error?e.message:t,Zme=(e,t)=>{if(!t)return e;let n=I8(t);return[t,...e.filter(e=>I8(e)!==n)]},Qme=e=>[...e].sort((e,t)=>{if(e.filePath!==t.filePath)return e.filePath.localeCompare(t.filePath);let n=e.newLineNumber??e.oldLineNumber??2**53-1,r=t.newLineNumber??t.oldLineNumber??2**53-1;return n===r?e.changeKey.localeCompare(t.changeKey):n-r}),$me=({diffResponse:e,gitStatus:t})=>{let n=new Map;for(let t of e?.files??[])n.set(t.path,t);return t?t.files.map(e=>{let t=n.get(e.path)??(e.original_path?n.get(e.original_path):void 0);return{path:e.path,originalPath:e.original_path,status:e.status,staged:e.staged,unstaged:e.unstaged,conflicted:e.conflicted,additions:t?.additions??0,deletions:t?.deletions??0}}):(e?.files??[]).map(e=>({path:e.path,originalPath:null,status:null,staged:!1,unstaged:!1,conflicted:!1,additions:e.additions,deletions:e.deletions}))},z8=e=>{let t=e.split(/[\\/]/);return t[t.length-1]||e},ehe={modified:`border-amber-500/40 bg-amber-500/10 text-amber-200`,added:`border-emerald-500/40 bg-emerald-500/10 text-emerald-200`,deleted:`border-rose-500/40 bg-rose-500/10 text-rose-200`,renamed:`border-sky-500/40 bg-sky-500/10 text-sky-200`,untracked:`border-violet-500/40 bg-violet-500/10 text-violet-200`,typechanged:`border-slate-500/40 bg-slate-500/10 text-slate-200`},the=e=>N8(`fileStatus.${e}`),nhe=({selectedDiffPath:e,sidebarFiles:t,diffStats:n,triggerMode:r=`full`,onSelectDiffPath:i})=>{let[a,o]=(0,p.useState)(!1),s=t.find(t=>t.path===e)??null,c=r===`compact`?e===`all`?N8(`picker.diff`):s?z8(s.path):N8(`picker.file`):e===`all`?N8(`picker.allChanges`):s?z8(s.path):e;return(0,X.jsxs)(B_,{open:a,onOpenChange:o,children:[(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:Z(`max-w-full gap-2`,r===`full`?`min-w-0 max-w-[18rem]`:`min-w-0 px-2.5`),"aria-label":N8(`picker.openChangedFilesAriaLabel`),title:e===`all`?void 0:s?.path??e,children:[(0,X.jsx)(`span`,{className:`truncate`,children:c}),r===`full`&&(0,X.jsx)(hC,{variant:`outline`,className:`shrink-0 text-[10px] uppercase tracking-wide`,children:N8(`picker.fileCount`,{count:t.length})}),(0,X.jsx)(mv,{className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,X.jsxs)(H_,{align:`start`,className:`z-[90] w-[28rem] max-w-[calc(100vw-2rem)] p-0`,children:[(0,X.jsx)(`div`,{className:`border-b border-border/80 px-4 py-3`,children:(0,X.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:N8(`picker.title`)})}),(0,X.jsx)(`div`,{className:`max-h-[min(28rem,calc(100vh-10rem))] overflow-y-auto p-3`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{i(`all`),o(!1)},className:Z(`flex w-full cursor-pointer items-start gap-3 rounded-xl border px-3 py-2.5 text-left transition-colors`,J3(e===`all`),`justify-between`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:N8(`picker.allChanges`)}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground transition-colors group-hover:text-foreground/70`,children:N8(`picker.allChangesDescription`)})]}),n&&(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 text-[11px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground transition-colors group-hover:text-foreground/70`,children:N8(`picker.fileCount`,{count:n.files_changed})}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,n.additions]}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,n.deletions]})]})]}),t.map(t=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>{i(t.path),o(!1)},className:Z(`flex w-full cursor-pointer items-start gap-3 rounded-xl border px-3 py-2.5 text-left transition-colors`,J3(e===t.path)),children:(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:z8(t.path)}),(0,X.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-[11px] text-muted-foreground transition-colors group-hover:text-foreground/70`,children:t.path})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 text-[11px]`,children:[(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,t.additions]}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,t.deletions]})]})]}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[t.status&&(0,X.jsx)(hC,{variant:`outline`,className:ehe[t.status],children:the(t.status)}),t.staged&&(0,X.jsx)(hC,{variant:`outline`,children:N8(`fileStatus.staged`)}),t.unstaged&&(0,X.jsx)(hC,{variant:`outline`,children:N8(`fileStatus.unstaged`)}),t.conflicted&&(0,X.jsx)(hC,{variant:`destructive`,children:N8(`fileStatus.conflicted`)}),t.originalPath&&(0,X.jsx)(`span`,{className:`break-all font-mono text-[11px] text-muted-foreground transition-colors group-hover:text-foreground/70`,children:t.status===`renamed`?N8(`fileStatus.renamedFrom`,{path:t.originalPath}):t.originalPath})]})]})},`${t.path}:${t.originalPath??``}`))]})})]})]})},B8=(0,p.memo)(({projectId:e,chatSessionId:t=null,canSubmitReviewPrompt:n,reviewSubmitDisabledReason:r,onSubmitReviewPrompt:i,state:a,onStateChange:o,isResizing:s=!1,onClose:c,desktopWidth:l,panelElementRef:u})=>{let[d,f]=(0,p.useState)(null),[m,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(!1),[,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(new Map),[C,w]=(0,p.useState)(!1),T=(0,p.useRef)(0),E=(0,p.useRef)(0),D=(0,p.useRef)(null),O=(0,p.useRef)(null),k=a.selectedDiffPath,A=a.activeReviewTarget,j=a.editingReviewCommentKey,M=A?.commentKey??j??`chat`,N=a.reviewDraftInput,P=(0,p.useMemo)(()=>new Map(a.reviewComments.map(e=>[Fj(e.filePath,e.changeKey),e])),[a.reviewComments]),F=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await FM(e,t):await ir(e)},[t,e]),I=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await IM(e,t):await dr(e)},[t,e]);(0,p.useEffect)(()=>{D.current=d},[d]),(0,p.useEffect)(()=>{O.current=m},[m]);let L=(0,p.useCallback)(async()=>{if(!e){E.current+=1,f(null),h(null),_(null),y(!1),b(!1);return}let t=T.current+1,n=E.current+1;T.current=t,E.current=n,y(!0),b(!0);let r=F().then(e=>{T.current===t&&(D.current=e,f(e),_(null))}).catch(e=>{T.current===t&&_(R8(e,N8(`errors.loadDiff`)))}).finally(()=>{T.current===t&&E.current===n&&y(!1)}),i=I().then(e=>{T.current===t&&(O.current=e,h(e))}).catch(()=>{}).finally(()=>{T.current===t&&b(!1)});await Promise.allSettled([r,i])},[F,I,e]),R=(0,p.useCallback)(async(t={})=>{if(!e)return;let{broadcastOnSignatureChange:n=!1}=t,r=T.current+1;T.current=r,b(!0);try{let t=await I();if(T.current!==r)return;let i=O.current?.workspace_signature??null,a=t.workspace_signature??null,o=!D.current||i!==a;if(O.current=t,h(t),!o){E.current+=1,y(!1);return}let s=!D.current,c=E.current+1;E.current=c,s&&y(!0);try{let t=await F();if(T.current!==r)return;D.current=t,f(t),_(null),n&&i!==a&&t6(e)}catch(e){if(T.current!==r)return;D.current||_(R8(e,N8(`errors.loadDiff`)))}finally{s&&E.current===c&&y(!1)}}catch{D.current||(E.current+=1,y(!1));return}finally{T.current===r&&b(!1)}},[F,I,e]);(0,p.useEffect)(()=>{L()},[L]),(0,p.useEffect)(()=>{if(e)return n6(t=>{t===e&&R()})},[e,R]),(0,p.useEffect)(()=>{if(!e)return;let t=$b(()=>{document.visibilityState===`visible`&&R({broadcastOnSignatureChange:!0})});return()=>{t()}},[e,R]),(0,p.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>{document.visibilityState===`visible`&&R({broadcastOnSignatureChange:!0})},Xme);return()=>{window.clearInterval(t)}},[e,R]);let z=(0,p.useMemo)(()=>{let e=typeof d?.diff==`string`?d.diff:``;return e.trim()?oD(e,{nearbySequences:`zip`}).map(e=>({...e,pathCandidates:F8(e)})):[]},[d]),ee=(0,p.useMemo)(()=>{let e=new Map;for(let t of z)for(let n of t.pathCandidates)e.has(n)||e.set(n,t);return e},[z]),B=(0,p.useMemo)(()=>$me({diffResponse:d,gitStatus:m}),[d,m]);(0,p.useEffect)(()=>{if(k!==`all`&&!(!d&&!m)){if(B.length===0){o(e=>({...e,selectedDiffPath:`all`}));return}B.some(e=>e.path===k)||o(e=>({...e,selectedDiffPath:`all`}))}},[d,m,o,k,B]);let V=k===`all`?null:ee.get(k)??null,te=(0,p.useMemo)(()=>Zme(z,V),[z,V]),H=(0,p.useMemo)(()=>k===`all`?z:V?[V]:[],[z,k,V]);(0,p.useEffect)(()=>{S(new Map)},[z]),(0,p.useEffect)(()=>{if(te.length===0)return;let e=!1,t=null,n=0,r=()=>{if(e)return;let i=te.slice(n,n+M8);i.length!==0&&(S(e=>{let t=new Map(e);for(let e of i){let n=I8(e);t.has(n)||t.set(n,L8(e))}return t}),n+=M8,n<te.length&&(t=window.setTimeout(r,0)))};return t=window.setTimeout(r,0),()=>{e=!0,t!==null&&window.clearTimeout(t)}},[te]);let U=(0,p.useMemo)(()=>{let e=new Map;for(let t of te.slice(0,M8))e.set(I8(t),L8(t));return e},[te]),ne=(0,p.useMemo)(()=>H.map(e=>({...e,tokens:x.get(I8(e))??U.get(I8(e))??null})),[U,x,H]),re=(0,p.useMemo)(()=>z.map(e=>({...e,tokens:null})),[z]),ie=(0,p.useMemo)(()=>Qme(a.reviewComments),[a.reviewComments]),ae=ie.length,oe=n&&!C&&ae>0,W=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}))},[o]),se=(0,p.useCallback)(({filePath:e,changeKey:t,commentKey:r})=>{let i=P.get(r);if(i){o(e=>({...e,selectedDiffPath:i.filePath,activeReviewTarget:null,editingReviewCommentKey:r,reviewDraftInput:i.comment}));return}n&&o(n=>({...n,activeReviewTarget:{filePath:e,changeKey:t,commentKey:r},editingReviewCommentKey:null,reviewDraftInput:``}))},[n,o,P]),ce=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``}))},[o]),le=(0,p.useCallback)(e=>{let t=P.has(e.commentKey);if(!n&&!t)return;let r=N.trim();if(!r)return;let i=e.change.type===`insert`?null:`oldLineNumber`in e.change?e.change.oldLineNumber:e.change.lineNumber,a=e.change.type===`delete`?null:`newLineNumber`in e.change?e.change.newLineNumber:e.change.lineNumber;o(t=>{let n=new Map(t.reviewComments.map(e=>[Fj(e.filePath,e.changeKey),e]));return n.set(e.commentKey,{scope:`uncommitted`,filePath:e.filePath,changeKey:e.changeKey,changeType:e.change.type,oldLineNumber:i,newLineNumber:a,hunkHeader:e.hunk.content,lineContent:e.change.content,diffSnippet:Ij(e.hunk,e.change),comment:r}),{...t,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[...n.values()]}})},[n,o,P,N]),ue=(0,p.useCallback)(e=>{let t=P.get(e);t&&o(n=>({...n,selectedDiffPath:t.filePath,activeReviewTarget:null,editingReviewCommentKey:e,reviewDraftInput:t.comment}))},[o,P]),de=(0,p.useCallback)(e=>{o(t=>({...t,activeReviewTarget:t.activeReviewTarget?.commentKey===e?null:t.activeReviewTarget,editingReviewCommentKey:t.editingReviewCommentKey===e?null:t.editingReviewCommentKey,reviewDraftInput:t.activeReviewTarget?.commentKey===e||t.editingReviewCommentKey===e?``:t.reviewDraftInput,reviewComments:t.reviewComments.filter(t=>Fj(t.filePath,t.changeKey)!==e)}))},[o]),fe=(0,p.useCallback)(async()=>{if(!oe)return;w(!0);let e=Gj({drafts:ie,findings:[],githubComments:[],uncommittedFiles:z});try{await i(e),W(),$.success(N8(`toasts.sendChangesSuccess`),{id:`chat-diff-review-submit-success`})}catch(e){$.error(R8(e,N8(`errors.sendChanges`)),{id:`chat-diff-review-submit-error`})}finally{w(!1)}},[oe,W,i,z,ie]),pe=(0,p.useCallback)(e=>(0,X.jsx)(D3,{reviewComments:ie,pendingFixCount:ae,triggerMode:e===`wide`?`full`:`compact`,canSendReview:oe,isSubmittingReview:C,reviewSubmitDisabledReason:r??void 0,onClearPendingFixes:W,onSubmitReview:()=>{fe()}}),[oe,W,fe,C,ae,ie,r]),me=c?(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":N8(`closeAriaLabel`),className:`text-muted-foreground hover:text-foreground`,onClick:c,children:(0,X.jsx)(Ub,{className:`h-4 w-4`})}):null,he=l?{"--chat-changes-panel-width":`${l}px`}:void 0;return(0,X.jsx)(`aside`,{"data-testid":`chat-changes-panel`,"data-desktop-width":l?String(l):void 0,ref:u,style:he,className:Z(`flex h-[26rem] min-h-0 w-full shrink-0 flex-col overflow-hidden border-t border-border/70 bg-background/20 xl:h-full xl:border-l xl:border-t-0`,l?`xl:w-[var(--chat-changes-panel-width)]`:`xl:w-[32rem]`),children:(0,X.jsx)(q3,{selectedDiffPath:k,sidebarFiles:B,diffResponse:d,isDiffLoading:v,diffError:g,allDiffFiles:re,renderedFiles:ne,viewType:`unified`,onViewTypeChange:()=>{},onRetry:()=>{L()},activeReviewTarget:A,editingReviewCommentKey:j,reviewDraftInstanceKey:M,reviewDraftInput:N,reviewComments:ie,reviewFindings:[],githubComments:[],selectedReviewFindingIds:[],selectedGitHubCommentIds:[],canSelectReviewTarget:n,canEditActiveReviewDraft:n,reviewFindingsError:null,gitHubCommentsError:null,hasStaleReviewFindings:!1,onSelectReviewTarget:se,onToggleReviewFindingSelection:()=>{},onToggleGitHubCommentSelection:()=>{},onReviewDraftInputChange:e=>{o(t=>({...t,reviewDraftInput:e}))},onCancelReviewDraft:ce,onEditReviewDraft:ue,onRemoveReviewDraft:de,onSaveReviewDraft:le,diffThemeClassName:Y3,resolveFilePath:I8,normalizeDiffPath:P8,emptyStateTitle:N8(`emptyStateTitle`),emptyStateDescription:N8(`emptyStateDescription`),filePickerControl:e=>(0,X.jsx)(nhe,{selectedDiffPath:k,sidebarFiles:B,diffStats:d?.stats??null,triggerMode:e===`wide`?`full`:`compact`,onSelectDiffPath:e=>{o(t=>({...t,selectedDiffPath:e}))}}),reviewSummaryControl:pe,extraHeaderControl:me,surfaceVariant:`flat`,showViewTypeToggle:!1,gutterVariant:`compact`,isResizing:s,resizePlaceholderLineThreshold:200})})});B8.displayName=`ChatChangesPanel`;var V8=({projectId:e,agentRunParentType:t=null,agentRunParentId:n=null,messages:r,internalLog:i,currentThinkingMessageId:a=null,previousThinkingLog:o=null,previousThinkingMessageId:s=null,pendingAgentTitle:c,streamingResponse:l,isRunning:u,isLoading:d=!1,canShowComposer:f,cardClassName:p,isExternallyResizing:m=!1,pendingAgentRevealKey:h=null,pendingAgentRevealDelayMs:g=0,liveResponseTiming:_=null,composerFocusNonce:v=0,blurComposerOnSendStart:y=!1,hidePendingAgentTitle:b=!1,forceScrollToBottomKey:x,header:S,composerControls:C,composerInlineControls:w,composerTheme:T=`default`,layoutKey:E,scrollLayoutKey:D,followUpPrompt:O,draftAttachments:k=[],followUpPlaceholder:A,emptyStateText:j=null,renderMessageFooter:M,renderMessageBody:N,isSendingFollowUp:P,isComposerSubmitDisabled:F=!1,isUploadingAttachments:I=!1,canAttachImages:L=!1,followUpDisabledReason:R,postBuildCheck:z=null,onFollowUpPromptChange:ee,onFollowUpKeyDown:B,onFollowUpPaste:V,onUploadAttachments:te,onRemoveAttachment:H,onFollowUpSubmit:U})=>(0,X.jsx)(VJ,{projectId:e,agentRunParentType:t,agentRunParentId:n,messages:r,internalLog:i,currentThinkingMessageId:a,previousThinkingLog:o,previousThinkingMessageId:s,pendingAgentTitle:c,streamingResponse:l,isRunning:u,isLoading:d,autoScrollBehavior:`sticky`,surfaceVariant:`chat`,canShowComposer:f,cardClassName:p,header:S,composerControls:C,composerInlineControls:w,composerTheme:T,composerSize:`compact-on-laptop`,showThinkingPlacement:`header`,pinComposerToBottom:!0,isExternallyResizing:m,pendingAgentRevealKey:h,pendingAgentRevealDelayMs:g,liveResponseTiming:_,composerFocusNonce:v,blurComposerOnSendStart:y,forceScrollToBottomKey:x,layoutKey:E,scrollLayoutKey:D,followUpPrompt:O,draftAttachments:k,followUpPlaceholder:A,emptyStateText:j,autoFocusComposer:!0,renderMessageFooter:M,renderMessageBody:N,isSendingFollowUp:P,isComposerSubmitDisabled:F,isUploadingAttachments:I,canAttachImages:L,followUpDisabledReason:R,postBuildCheck:z,hidePendingAgentTitle:b,onFollowUpPromptChange:ee,onFollowUpKeyDown:B,onFollowUpPaste:V,onUploadAttachments:te,onRemoveAttachment:H,onFollowUpSubmit:U}),rhe=`mt-1 flex min-h-5 flex-wrap items-center gap-2 text-xs text-muted-foreground`,ihe=({label:e})=>(0,X.jsx)(`div`,{className:`inline-flex items-center rounded-full border border-amber-500/30 bg-amber-500/10 px-2 py-0.5 text-[11px] font-medium text-amber-100`,children:e}),H8=({title:e,tool:t=null,modelLabel:n=null,interrupted:r=!1,interruptedLabel:i,usage:a=null,metadataExtra:o=null,actions:s=null,warnings:c=null})=>(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`truncate text-sm font-semibold text-foreground`,children:e}),(0,X.jsxs)(`div`,{className:rhe,children:[(0,X.jsx)(jF,{tool:t,className:`text-[11px]`}),n?(0,X.jsx)(`p`,{children:n}):null,r?(0,X.jsx)(ihe,{label:i}):null,a?(0,X.jsx)(MF,{totalTokens:a.totalTokens,contextWindow:a.contextWindow,cost:a.cost,tool:a.tool,model:a.model,availableModels:a.availableModels}):null,o]})]}),s]}),c]}),U8=({projectId:e,suggestions:t,title:n,description:r,emptyState:i=null,onSuggestionsChanged:a})=>(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(n||r)&&(0,X.jsxs)(`div`,{children:[n&&(0,X.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-[0.2em] text-muted-foreground`,children:n}),r&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r})]}),t.length>0?(0,X.jsx)(Qw,{projectId:e,suggestions:t,onChanged:(e,t)=>a?.(e,t)}):i&&(0,X.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/70 px-3 py-4 text-sm text-muted-foreground`,children:i})]}),W8=()=>({selectedDiffPath:`all`,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}),ahe=[{key:`today`,label:`Today`},{key:`yesterday`,label:`Yesterday`},{key:`last_7_days`,label:`Last 7 Days`},{key:`older`,label:`Older`}],ohe=e=>{if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t},G8=e=>e.activity_at??e.last_user_message_at??e.created_at,she=(e,t)=>{let n=G8(e),r=G8(t);return n===r?e.created_at===t.created_at?t.id.localeCompare(e.id):t.created_at.localeCompare(e.created_at):r.localeCompare(n)},K8=e=>[...e].sort(she),che=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),lhe=(e,t=new Date)=>{let n=ohe(G8(e));if(!n)return`older`;let r=che(t),i=new Date(r);i.setDate(i.getDate()-1);let a=new Date(r);return a.setDate(a.getDate()-6),n>=r?`today`:n>=i?`yesterday`:n>=a?`last_7_days`:`older`},q8=(e,t=new Date)=>{let n=new Map;for(let r of K8(e)){let e=lhe(r,t);n.set(e,[...n.get(e)??[],r])}return ahe.flatMap(e=>{let t=n.get(e.key)??[];return t.length===0?[]:[{key:e.key,label:e.label,sessions:t}]})},J8=e=>{let t={...e};return delete t.messages,t.agent_log=null,t.agent_message_id=null,t.previous_agent_log=null,t.previous_agent_message_id=null,t.streaming_response=null,t},Y8=e=>e===`claude`?jb.t(`chatView.tool.claude`):jb.t(`chatView.tool.opencode`),X8=e=>new Map(e.map(e=>[e.id,e.label])),Z8=({availableModelsById:e,model:t})=>t?e.get(t)??t:null,Q8=({modelLabel:e,tool:t})=>e??Y8(t),$8=()=>jb.t(`chatView.user.you`),e5=`archon.chat-draft`,t5=({projectId:e,tool:t,chatSessionId:n})=>n?`${e5}:${e}:session:${n}`:`${e5}:${e}:draft:${t}`,n5=e=>{if(!e)return``;try{return window.localStorage.getItem(e)??``}catch{return``}},r5=({storageKey:e,value:t})=>{if(e)try{if(t){window.localStorage.setItem(e,t);return}window.localStorage.removeItem(e)}catch{}},i5=({activeProject:e,activeProjectBranchState:t,session:n})=>!e||n.target_available===!1?!1:n.target_kind===`bundle`?e.active_target_kind===`bundle`&&!!n.target_bundle_id&&e.active_target_bundle_id===n.target_bundle_id:e.active_target_kind===`bundle`?!1:!t||!n.target_branch_snapshot?!0:t.status!==`ready`||!t.branch?!1:t.branch===n.target_branch_snapshot,a5=({session:e,activeProject:t,activeProjectBranchState:n})=>e.target_kind===`bundle`?e.target_label_snapshot||jb.t(`common:chatView.targets.bundleFallback`):!t||t.active_target_kind===`bundle`||n?.status!==`ready`||!n.branch||!e.target_branch_snapshot||n.branch===e.target_branch_snapshot?null:jb.t(`common:chatView.targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}),o5=e=>e.target_kind===`bundle`?e.target_label_snapshot||jb.t(`common:chatView.targets.bundleFallback`):e.target_branch_snapshot?jb.t(`common:chatView.targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}):jb.t(`common:chatView.targets.repoRoot`),s5=({activeProject:e,activeProjectBranchState:t})=>e?e.active_target_kind===`bundle`?jb.t(`common:chatView.targets.selectedBundleTarget`):t?.branch?jb.t(`common:chatView.targets.repoRootWithBranch`,{branch:t.branch}):jb.t(`common:chatView.targets.repoRoot`):jb.t(`common:chatView.targets.currentTarget`),c5=(e,t)=>jb.t(`chatView.${e}`,t),uhe=1500,dhe=`archon.chat-run-config`,fhe=`archon.chat-changes-panel-layout`,phe=`archon.chat-session-list-layout`,l5=512,u5=360,mhe=.6,hhe=6,d5=`/`,ghe=`Slash`,_he=`NumpadDivide`,vhe=600,f5=4,p5=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):l5;if(!Number.isFinite(t))return Math.max(u5,n);let r=Math.max(u5,Math.round(t*mhe));return Math.max(u5,Math.min(r,n))},yhe=e=>c5(e===`plan`?`mode.plan`:`mode.build`),m5=e=>c5(e===`plan`?`placeholders.plan`:`placeholders.build`),h5=e=>c5(`pendingMemorySuggestions`,{count:e}),bhe=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===d5||e.code===ghe||e.code===_he),g5=({modifierLabel:e,keys:t,ariaHidden:n=!1})=>(0,X.jsxs)(`span`,{"aria-hidden":n,className:`flex items-center gap-0.5 text-[10px] leading-none`,children:[(0,X.jsx)(WY,{"aria-hidden":n,children:e}),t.map(e=>(0,X.jsxs)(`span`,{className:`contents`,children:[(0,X.jsx)(`span`,{children:`+`}),(0,X.jsx)(WY,{"aria-hidden":n,children:e})]},e))]}),xhe=({label:e,modifierLabel:t,keys:n})=>(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(g5,{modifierLabel:t,keys:n,ariaHidden:!0})]}),_5=({projectId:e,tool:t})=>`${dhe}:${e}:${t}`,v5=e=>`${fhe}:${e}`,y5=e=>`${phe}:${e}`,She=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t):[],b5=e=>{if(!e)return{isOpen:!0,width:l5};try{let t=window.localStorage.getItem(v5(e));if(!t)return{isOpen:!0,width:l5};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max(u5,Math.round(n.width)):l5;return{isOpen:n.isOpen!==!1,width:r}}catch{return{isOpen:!0,width:l5}}},x5=e=>{if(!e)return{isOpen:!0};try{let t=window.localStorage.getItem(y5(e));return t?{isOpen:JSON.parse(t).isOpen!==!1}:{isOpen:!0}}catch{return{isOpen:!0}}},Che=({projectId:e,isOpen:t,width:n})=>{if(e)try{window.localStorage.setItem(v5(e),JSON.stringify({isOpen:t,width:n}))}catch{}},whe=({projectId:e,isOpen:t})=>{if(e)try{window.localStorage.setItem(y5(e),JSON.stringify({isOpen:t}))}catch{}},S5=({projectId:e,tool:t})=>{if(!e||t!==`opencode`&&t!==`claude`)return null;try{let n=window.localStorage.getItem(_5({projectId:e,tool:t}));if(!n)return null;let r=JSON.parse(n),i=(typeof r.model==`string`?r.model.trim():``)||null,a=r.mode===`plan`||r.mode===`build`?r.mode:null;return!i&&!a?null:{model:i,variant:i&&typeof r.variant==`string`&&r.variant.trim()||null,mode:a,skills:She(r.skills)}}catch{return null}},C5=({projectId:e,tool:t,model:n,variant:r,mode:i,skills:a})=>{if(!(!e||t!==`opencode`&&t!==`claude`||!n&&!i))try{window.localStorage.setItem(_5({projectId:e,tool:t}),JSON.stringify({model:n,variant:n?r:null,mode:i,skills:a}))}catch{}},The=({projectId:e,tool:t})=>{let n=S5({projectId:e,tool:t});!n||n.skills.length===0||C5({projectId:e,tool:t,...n,skills:[]})},w5=({projectId:e,tool:t})=>S5({projectId:e,tool:t})?.mode??`plan`,T5=({activeProjectId:e,helperModel:t,helperVariant:n,activeTool:r,availableModels:i,availableSkills:a})=>{let o=S5({projectId:e,tool:r}),s=t??``,c=o?.model??``,l=xF(c,i)?c:xF(s,i)?s:``,u=l===c?o?.variant??null:l&&l===s?n??null:null,d=i.find(e=>e.id===l)??null,f=d?d.variants.includes(u??``)?u??``:``:l?u??``:``,p=new Set(a.map(e=>e.name));return{model:l,variant:f,mode:o?.mode??`plan`,skills:r===`opencode`?(o?.skills??[]).filter(e=>p.has(e)):[]}},E5=e=>e&&e.replace(/\s+/g,` `).trim()||null,Ehe=e=>{let t=E5(e.first_user_message_preview);if(t)return t;let n=e.messages?.find(e=>e.role===`user`)?.content;return E5(n)},Dhe=({chatSessionId:e,instruction:t,attachments:n,createdAt:r})=>({id:`optimistic:${e}:${r}`,chat_session_id:e,role:`user`,kind:`prompt`,content:t,attachments:n,created_at:r}),Ohe=({session:e,instruction:t,attachments:n,createdAt:r})=>({...e,messages:[...e.messages??[],Dhe({chatSessionId:e.id,instruction:t,attachments:n,createdAt:r})],activity_at:r,last_user_message_at:r,updated_at:r}),khe=e=>!!(e.first_user_message_preview||e.last_user_message_at||e.messages?.some(e=>e.role===`user`)),D5=e=>e.agent_status===`running`?c5(`sidebar.deleteDisabledReason`):null,Ahe=({proposals:e,isApplying:t,onApply:n})=>e.status===`applied`?(0,X.jsxs)(`div`,{className:`w-full rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-3 text-sm`,children:[(0,X.jsx)(`div`,{className:`font-medium text-foreground`,children:c5(`ticketProposal.createdTitle`)}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:c5(`ticketProposal.createdDescription`,{count:e.created_tickets.length})}),e.created_tickets.length>0?(0,X.jsx)(`ul`,{className:`mt-3 space-y-1 text-foreground`,children:e.created_tickets.map(e=>(0,X.jsx)(`li`,{children:e.title},e.ticket_id))}):null]}):(0,X.jsxs)(`div`,{className:`w-full rounded-md border border-sky-500/30 bg-sky-500/10 px-3 py-3 text-sm`,children:[(0,X.jsx)(`div`,{className:`font-medium text-foreground`,children:c5(`ticketProposal.proposedTitle`)}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:c5(`ticketProposal.proposedDescription`)}),(0,X.jsx)(`ul`,{className:`mt-3 space-y-3`,children:e.tickets.map(e=>(0,X.jsxs)(`li`,{className:`rounded border border-border/60 bg-background/80 px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-medium text-foreground`,children:e.title}),(0,X.jsx)(`div`,{className:`mt-1 whitespace-pre-wrap text-muted-foreground`,children:e.description})]},e.key))}),e.dependencies.length>0?(0,X.jsx)(`div`,{className:`mt-3 text-muted-foreground`,children:c5(`ticketProposal.dependenciesLabel`,{value:e.dependencies.map(e=>`${e.blocker_key} -> ${e.dependent_key}`).join(`, `)})}):null,(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(Q,{type:`button`,size:`sm`,onClick:n,disabled:t,children:c5(t?`ticketProposal.creating`:`ticketProposal.create`)})})]}),jhe=({activeProjectId:e,activeProject:t,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c=async()=>!1,onSelectRepoRootTarget:l=async()=>!1,activeTool:u,routedChatSessionId:d,onRoutedChatNavigationUnavailable:f,onSessionNavigation:m,initialDraftOpen:h=!1,onInitialDraftOpenConsumed:g,initialSpecDraft:_=null,onInitialSpecDraftConsumed:v,onViewSourceSpec:y,onNavigateToLifecycleSource:b,onRestoreSessionTarget:x,onReviewCapabilityChange:S,isExternallyResizing:C=!1,showChangesPanel:w=!0})=>{let T=lq(),[E,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(null),[A,j]=(0,p.useState)(null),M=pF(A?.post_build_check),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(null),[z,ee]=(0,p.useState)(()=>w5({projectId:e,tool:u})),[B,V]=(0,p.useState)({}),[te,H]=(0,p.useState)({}),[U,ne]=(0,p.useState)({}),[re,ie]=(0,p.useState)([]),[ae,oe]=(0,p.useState)(``),[W,se]=(0,p.useState)(``),[ce,le]=(0,p.useState)([]),[ue,de]=(0,p.useState)(!1),[fe,pe]=(0,p.useState)(!1),[me,he]=(0,p.useState)(!1),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(!1),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)(null),[we,Te]=(0,p.useState)([]),[Ee,De]=(0,p.useState)(()=>new Set),[Oe,ke]=(0,p.useState)(!1),[Ae,je]=(0,p.useState)(()=>new Set),[Me,Ne]=(0,p.useState)(!1),[Pe,Fe]=(0,p.useState)(!1),[Ie,Le]=(0,p.useState)(null),[Re,ze]=(0,p.useState)(null),[G,Be]=(0,p.useState)([]),[Ve,He]=(0,p.useState)(!1),[Ue,K]=(0,p.useState)(!1),[We,Ge]=(0,p.useState)(0),[q,Je]=(0,p.useState)(W8),[J,Xe]=(0,p.useState)(()=>x5(e).isOpen),[Ze,Y]=(0,p.useState)(()=>b5(e).isOpen),[Qe,$e]=(0,p.useState)(!1),[et,tt]=(0,p.useState)(!1),[nt,rt]=(0,p.useState)(()=>b5(e).width),[it,at]=(0,p.useState)(0),[ot,st]=(0,p.useState)(null),[ct,lt]=(0,p.useState)(()=>new Set),ut=(0,p.useRef)({model:``,variant:``,skills:[],showModelSelector:!1}),dt=(0,p.useRef)(!1),ft=(0,p.useRef)(e),pt=(0,p.useRef)(L),mt=(0,p.useRef)(null),ht=(0,p.useRef)(null),gt=(0,p.useRef)(new Set),_t=(0,p.useRef)(0),vt=(0,p.useRef)(0),yt=(0,p.useRef)(d),bt=(0,p.useRef)(!1),xt=(0,p.useRef)(null),St=(0,p.useRef)(null),Ct=(0,p.useRef)(null),wt=(0,p.useRef)(null),Tt=(0,p.useRef)(null),Et=(0,p.useRef)(null),Dt=(0,p.useRef)(!1),Ot=(0,p.useRef)(!1),kt=(0,p.useRef)(0),At=(0,p.useRef)(l5),jt=(0,p.useRef)(l5),Mt=(0,p.useRef)(!1),Nt=(0,p.useRef)(0),Pt=(0,p.useRef)({id:null,status:null}),Ft=(0,p.useRef)(new Map),It=(0,p.useRef)({}),Lt=(0,p.useRef)({}),Rt=(0,p.useRef)(new Set),zt=(0,p.useRef)(!1),Bt=e?t5({projectId:e,tool:F?u:A?.tool??u,chatSessionId:F?null:O}):null,Vt=Bt?B[Bt]??``:``,Ht=F?u:A?.tool??u,Ut=A?te[A.id]??[]:[],Wt=(A?U[A.id]??0:0)>0;ft.current=e;let{models:Gt,isLoading:Kt}=ZP(Ht),qt=(0,p.useCallback)(()=>{le([]),The({projectId:e,tool:u})},[e,u]);(0,p.useEffect)(()=>{dt.current=F},[F]),(0,p.useEffect)(()=>{It.current=B},[B]),(0,p.useEffect)(()=>{Lt.current=te},[te]),yt.current=d,(0,p.useEffect)(()=>{if(!(d===void 0||!fe)){if(!d){dt.current||qt(),P(null),xe(null),k(null),j(null),I(!0);return}if(!(E.some(e=>e.id===d)||A?.id===d)){k(null),j(null),I(!1),f?.();return}O!==d&&(P(null),xe(null),k(d),j(null),I(!1),Mt.current=!0)}},[A?.id,O,fe,f,qt,d,E]),(0,p.useEffect)(()=>{if(!Bt||Rt.current.has(Bt))return;Rt.current.add(Bt);let e=n5(Bt);e&&V(t=>Object.prototype.hasOwnProperty.call(t,Bt)?t:{...t,[Bt]:e})},[Bt]),(0,p.useEffect)(()=>{!Bt||!Object.prototype.hasOwnProperty.call(B,Bt)||r5({storageKey:Bt,value:B[Bt]??``})},[Bt,B]),(0,p.useEffect)(()=>{if(!F){mt.current=null;return}let e=mt.current;!e||!Bt||Vt||V(t=>t[Bt]?t:{...t,[Bt]:e})},[F,Bt,Vt]),(0,p.useEffect)(()=>{ht.current=O},[O]),(0,p.useEffect)(()=>{pt.current=L},[L]);let Jt=(0,p.useCallback)(()=>{vt.current+=1},[]),Yt=(0,p.useCallback)(e=>{Jt(),j(e)},[Jt]);(0,p.useEffect)(()=>{if(!zt.current){zt.current=!0;return}let t=b5(e),n=x5(e);dt.current=!1,Mt.current=!1,Rt.current=new Set,gt.current.clear(),k(null),Yt(null),I(!1),V({}),H({}),ne({}),xe(null),Te([]),De(new Set),ke(!1),je(new Set),st(null),Be([]),K(!1),pe(!1),Je(W8()),lt(new Set),Ft.current=new Map,jt.current=t.width,Xe(n.isOpen),rt(t.width),Y(t.isOpen)},[e,Yt]),(0,p.useEffect)(()=>{Qe||(jt.current=nt,Ct.current&&(Ct.current.style.setProperty(`--chat-changes-panel-width`,`${nt}px`),Ct.current.setAttribute(`data-desktop-width`,String(nt))))},[nt,Qe]),(0,p.useEffect)(()=>{if(!w||!xt.current)return;let e=xt.current.getBoundingClientRect().width;if(e<=0)return;let t=p5(nt,e);t!==nt&&(jt.current=t,rt(t))},[nt,w]),(0,p.useEffect)(()=>{whe({projectId:e,isOpen:J})},[e,J]),(0,p.useEffect)(()=>{w&&Che({projectId:e,isOpen:Ze,width:nt})},[e,nt,Ze,w]),(0,p.useEffect)(()=>{K(!1)},[O,F]);let Xt=(0,p.useCallback)(e=>{let t=J8(e);D(e=>{let n=e.findIndex(e=>e.id===t.id);if(n===-1)return K8([...e,t]);let r=[...e];return r[n]=t,K8(r)})},[]),Zt=(0,p.useCallback)((t,n={})=>{let r=Array.from(new Set(t));if(r.length===0)return;let i=new Set(r),a=ht.current,o=n.preserveDraftRoute===!0,s=!!(o&&a&&i.has(a)&&yt.current===a),c=!!(!o&&a&&i.has(a)),l=c?E.find(e=>!i.has(e.id))??null:null;s&&(qt(),m?.(null)),c&&(l||qt(),m?.(l?.id??null));let d=e?r.map(t=>t5({projectId:e,tool:u,chatSessionId:t})):[];V(e=>{let t=d.filter(t=>Object.prototype.hasOwnProperty.call(e,t));if(t.length===0)return e;let n={...e};for(let e of t)delete n[e];return n}),H(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e}),ne(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e});for(let e of d)r5({storageKey:e,value:``});D(e=>{let t=e.filter(e=>!i.has(e.id));if(a&&i.has(a)){if(yt.current===a)return o?(k(null),Yt(null),I(!0),t):(k(null),Yt(null),I(l===null),Be([]),He(!1),K(!1),t);let e=t[0]??null;k(e?.id??null),Yt(null),I(e===null),Be([]),He(!1),K(!1)}return t}),lt(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),st(e=>e&&i.has(e.parentId)?null:e),xe(e=>e&&i.has(e)?null:e),Te(e=>e.filter(e=>!i.has(e))),De(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),je(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e})},[e,u,m,Yt,qt,E]),Qt=(0,p.useCallback)((e,t)=>{Zt([e],t)},[Zt]),$t=(0,p.useCallback)((e,t)=>{e&&V(n=>n[e]===t?n:{...n,[e]:t})},[]),en=(0,p.useCallback)(e=>{e&&(V(t=>t[e]===``?t:{...t,[e]:``}),r5({storageKey:e,value:``}))},[]),tn=(0,p.useCallback)((e,t)=>{H(n=>{if(t.length===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:t}})},[]),nn=(0,p.useCallback)(e=>{H(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),ne(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),rn=(0,p.useCallback)((e,t)=>{ne(n=>{let r=Math.max(0,(n[e]??0)+t);if(r===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:r}})},[]),an=(0,p.useCallback)(({fromStorageKey:e,toStorageKey:t})=>{if(!e||!t||e===t)return;let n=Object.prototype.hasOwnProperty.call(It.current,e)?It.current[e]??``:n5(e);V(r=>{let i={...r,[t]:n};return delete i[e],i}),r5({storageKey:t,value:n}),r5({storageKey:e,value:``})},[]),on=(0,p.useCallback)((e,t)=>{D(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n[r];if(i.pending_memory_suggestion_count===t)return n;let a=[...n];return a[r]={...i,pending_memory_suggestion_count:t},a}),j(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:(vt.current+=1,{...n,pending_memory_suggestion_count:t}))},[]),sn=(0,p.useCallback)(async r=>{if(!e){D([]),k(null),Yt(null),I(!1),pe(!1);return}de(!0);try{let i=await CM(e,r);if(r?.aborted)return;let a=K8(i.map(J8)),o=a[0]??null,s=t?.active_target_kind===`bundle`||n?.status!==`loading`;D(a),pe(!0),k(e=>d===void 0?dt.current?null:e&&a.some(t=>t.id===e)?e:e?a[0]?.id??null:Mt.current?null:o?s?(Mt.current=!0,i5({activeProject:t,activeProjectBranchState:n,session:o})?o.id:null):null:(Mt.current=!0,null):e),a.length===0&&!d&&!dt.current&&(qt(),I(!0))}catch(e){Ye(e)||$.error(e instanceof Error?e.message:c5(`errors.loadSessions`))}finally{r?.aborted||de(!1)}},[t,n,e,qt,Yt,d]),cn=(0,p.useCallback)(async(t,n)=>{if(!e){Yt(null);return}he(!0);let r=_t.current+1;_t.current=r;let i=vt.current;try{let a=await TM(e,t,n);if(n?.aborted)return;let o=vt.current!==i,s=_t.current===r,c=ht.current===t&&!dt.current;if(!s||o||!c)return;Yt(a),Xt(a)}catch(e){e instanceof Ke&&e.status===404&&yt.current===t&&ht.current===t?f?.():Ye(e)||$.error(e instanceof Error?e.message:c5(`errors.loadSession`))}finally{n?.aborted||he(!1)}},[e,f,Yt,Xt]),ln=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){Be([]),He(!1);return}He(!0);try{let t=await jr(e,null,r,n);if(r?.aborted)return;Be(t.suggestions),on(n,t.suggestions.length)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:c5(`errors.loadMemorySuggestions`))}finally{r?.aborted||He(!1)}},[t?.memory_enabled,e,on]),un=(0,p.useCallback)(e=>{Be(t=>{let n=t.filter(t=>t.id!==e);return O&&on(O,n.length),n}),Ge(e=>e+1),sn(),O&&cn(O)},[O,cn,sn,on]);(0,p.useEffect)(()=>{let e=new AbortController;return sn(e.signal),()=>{e.abort()}},[sn]),(0,p.useEffect)(()=>{if(d!==void 0||dt.current||F||O||Mt.current||E.length===0||t?.active_target_kind!==`bundle`&&n?.status===`loading`)return;Mt.current=!0;let e=E[0]??null;e&&i5({activeProject:t,activeProjectBranchState:n,session:e})&&k(e.id)},[t,n,O,F,d,E]),(0,p.useEffect)(()=>{if(Ht!==`opencode`&&Ht!==`claude`){ie([]),Fe(!1);return}if(Ht!==`opencode`){ie([]);return}let t=new AbortController;return(async()=>{Fe(!0);try{ie(await QP(Ht,t.signal,e))}catch(e){Ye(e)||ie(e=>e)}finally{t.signal.aborted||Fe(!1)}})(),()=>{t.abort()}},[e,Ht]),(0,p.useEffect)(()=>{if(F||!O){Yt(null);return}if(A?.id===O)return;Yt(null);let e=new AbortController;return cn(O,e.signal),()=>{e.abort()}},[A,O,F,cn,Yt]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||F||!O){Be([]),He(!1);return}let e=new AbortController;return ln(O,e.signal),()=>{e.abort()}},[t?.memory_enabled,O,F,ln,We]),(0,p.useEffect)(()=>{!Ue||Ve||G.length>0||K(!1)},[Ve,Ue,G.length]),(0,p.useEffect)(()=>{if(!O||A?.agent_status!==`running`)return;let e=new AbortController,t=window.setInterval(()=>{Promise.all([sn(e.signal),cn(O,e.signal)])},uhe);return()=>{e.abort(),window.clearInterval(t)}},[A?.agent_status,O,cn,sn]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||(t.id===O&&Yt(t),khe(t)&&Xt(t))},n=t=>{if(!t||t.project_id!==e)return;let n=gt.current.delete(t.id);Qt(t.id,n?{preserveDraftRoute:!0}:void 0)},r=()=>{sn();let e=ht.current;e&&!dt.current&&cn(e)};return T.on(`connect`,r),T.on(`chat-session:created`,t),T.on(`chat-session:updated`,t),T.on(`chat-session:deleted`,n),()=>{T.off(`connect`,r),T.off(`chat-session:created`,t),T.off(`chat-session:updated`,t),T.off(`chat-session:deleted`,n)}},[e,O,cn,sn,Qt,Yt,T,Xt]),(0,p.useEffect)(()=>{F&&(pt.current||ee(w5({projectId:e,tool:u})))},[e,u,F]),(0,p.useEffect)(()=>{if(Ht!==`opencode`&&Ht!==`claude`){oe(``),se(``),le([]);return}if(F){let n=vw(t?.helper_models,Ht),r=T5({activeProjectId:e,helperModel:n.model??(Ht===`opencode`?t?.helper_model:null)??null,helperVariant:n.variant??(Ht===`opencode`?t?.helper_variant:null)??null,activeTool:Ht,availableModels:Gt,availableSkills:re});oe(r.model),se(r.variant),le(r.skills);return}oe(A?.model??``),se(A?.variant??``)},[e,t?.helper_model,t?.helper_models,t?.helper_variant,A?.id,A?.model,A?.variant,Gt,re,Ht,F]),(0,p.useEffect)(()=>{if(Ht!==`opencode`){le([]);return}F||le(A?.skills??[])},[A?.skills,Ht,F]),(0,p.useEffect)(()=>{let e=Gt.find(e=>e.id===ae)??null;se(t=>e?e.variants.includes(t)?t:``:t)},[Gt,ae]),(0,p.useEffect)(()=>{if(Ht!==`opencode`||!F||!ae||W)return;let n=vw(t?.helper_models,Ht),r=T5({activeProjectId:e,helperModel:n.model??(Ht===`opencode`?t?.helper_model:null)??null,helperVariant:n.variant??(Ht===`opencode`?t?.helper_variant:null)??null,activeTool:Ht,availableModels:Gt,availableSkills:re});r.model===ae&&r.variant&&se(r.variant)},[e,t?.helper_model,t?.helper_models,t?.helper_variant,Ht,Gt,re,F,ae,W]),(0,p.useEffect)(()=>{if(!be)return;let e=A?.id===be?A:E.find(e=>e.id===be)??null;(!e||e.agent_status!==`running`)&&xe(null)},[A,be,E]),(0,p.useEffect)(()=>{let e=Pt.current,n=A?.id??null,r=A?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&Ge(e=>e+1),Pt.current={id:n,status:r}},[t?.memory_enabled,e,A?.agent_status,A?.id,A?.title]),(0,p.useEffect)(()=>{O&<(e=>{if(!e.has(O))return e;let t=new Set(e);return t.delete(O),t})},[O]),(0,p.useEffect)(()=>{ot&&(ot.parentId===O&&(ve||Se===O||A?.agent_status===`running`)||st(null))},[A?.agent_status,O,ve,ot,Se]),(0,p.useEffect)(()=>{let e=Ft.current,t=new Map,n=[];for(let r of E){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&a===`done`&&r.id!==O&&n.push(r),t.set(r.id,a)}Ft.current=t,lt(e=>{let t=new Set(e),r=!1,i=new Set(E.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of E){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===O||i!==`done`)&&t.delete(e.id)){r=!0;continue}a&&!t.has(e.id)&&(t.add(e.id),r=!0)}return r?t:e})},[e,O,E]);let dn=(0,p.useMemo)(()=>X8(Gt),[Gt]),fn=(0,p.useMemo)(()=>q8(E),[E]),pn=(0,p.useMemo)(()=>{let e=new Set(fn.find(e=>e.key===`older`)?.sessions.map(e=>e.id)??[]);return[{key:`unavailable`,label:c5(`sidebar.presets.unavailable`),matches:e=>e.target_available===!1},{key:`older`,label:c5(`sidebar.presets.older`),matches:t=>e.has(t.id)}]},[fn]),mn=(0,p.useMemo)(()=>we.length===0?[]:we.flatMap(e=>{let t=E.find(t=>t.id===e)??(A?.id===e?A:null);return t?[t]:[]}),[A,we,E]),hn=mn.length===1?mn[0]?.title??null:null;(0,p.useEffect)(()=>{we.length>0&&mn.length!==we.length&&Te(mn.map(e=>e.id))},[we,mn]),(0,p.useEffect)(()=>{let e=new Set(E.filter(e=>!D5(e)&&!Ee.has(e.id)).map(e=>e.id));je(t=>{let n=new Set(Array.from(t).filter(t=>e.has(t)));return n.size===t.size?t:n})},[Ee,E]),(0,p.useEffect)(()=>{!Oe||J||(ke(!1),je(new Set))},[J,Oe]);let gn=(0,p.useMemo)(()=>A?Q8({modelLabel:Z8({availableModelsById:dn,model:A.model}),tool:A.tool}):null,[A,dn]),_n=(0,p.useMemo)(()=>A?(A.messages??[]).map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,attachments:e.attachments??[],ticket_proposals:e.ticket_proposals??null,transcript_runs:e.transcript_runs??null,metadata:e.metadata,responseTiming:e.response_timing?GK(e.response_timing):null,created_at:e.created_at,displayTitle:e.role===`assistant`?gn??Y8(A.tool):$8()})):[],[A,gn]),vn=(0,p.useMemo)(()=>[...A?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[A]),yn=!!vn,bn=(0,p.useCallback)(async(t,n)=>{if(!e||!A||Re)return;let r=WJ({parentType:`chat`,parentId:A.id,setId:n.set_id});ze(n.set_id);try{let r=await kM(e,A.id,t,n);Yt(r),Xt(r)}catch(e){if(e instanceof Ke&&e.status===409){KJ(r);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?(Yt(t),Xt(t)):await cn(A.id)}throw $.error(e instanceof Error?e.message:c5(`errors.resolveQuestions`)),e}finally{ze(null)}},[e,A,cn,Yt,Re,Xt]),xn=(0,p.useCallback)(e=>{let t=e.metadata?.ask_question;if(e.role!==`assistant`||!t||!A)return;let n=WJ({parentType:`chat`,parentId:A.id,setId:t.id});return(0,X.jsx)($J,{messageContent:e.content,questionSet:t,storageKey:n,isActive:t.status===`pending`&&vn?.id===e.id,isDisabled:A.agent_status===`running`||Re===t.id,onResolve:t=>bn(e.id,t)})},[A,vn?.id,bn,Re]),Sn=A?.id&&A.agent_status===`running`&&ot?.parentId===A.id?ot.turnKey:null,Cn=(Ht===`opencode`||Ht===`claude`)&&Gt.length>0,wn=(Ht===`opencode`||Ht===`claude`)&&!Cn&&(Pe||Kt);(0,p.useEffect)(()=>{ut.current={model:ae,variant:W,skills:ce,showModelSelector:Cn}},[ae,ce,W,Cn]);let Tn=(0,p.useMemo)(()=>Gt.find(e=>e.id===ae)??null,[Gt,ae]),En=F?z:A?.mode??`build`,Dn=F?c5(`composer.newChatTitle`):A?.title??c5(`composer.chatTitle`),On=F?u:A?.tool??u,kn=(0,p.useMemo)(()=>YY(),[]),An=Cn?ae||null:A?.model??null,jn=On===`opencode`||On===`claude`,Mn=Z8({availableModelsById:dn,model:An}),Nn=F?`draft:${e??`none`}:${u}`:A?.id,Pn=(0,p.useCallback)(({model:t=ae,variant:n=W,skills:r=ce}={})=>{F&&C5({projectId:e,tool:u,model:Cn&&t||null,variant:Cn&&t&&n||null,mode:z,skills:Cn&&u===`opencode`?r:[]})},[e,u,z,F,ae,ce,W,Cn]),Fn=(0,p.useCallback)(()=>{dt.current=!0,ht.current=null,I(!0),qt(),ee(w5({projectId:e,tool:u})),P(null),k(null),Yt(null),xe(null),ke(!1),je(new Set),st(null),R(null),mt.current=null,m?.(null)},[e,u,m,Yt,qt]);(0,p.useEffect)(()=>{_&&(Fn(),ee(`build`),R({specSessionId:_.specSessionId,specSnapshotId:_.specSnapshotId}),mt.current=_.text,v?.())},[_,Fn,v]),(0,p.useEffect)(()=>{h&&(Fn(),g?.())},[h,Fn,g]);let In=(0,p.useCallback)((e,t=null)=>{dt.current=!1,ht.current=e,I(!1),P(null),k(e),Yt(t),R(null),m?.(e)},[m,Yt]),Ln=(0,p.useCallback)(async()=>{if(!(!A||!x)){P(A.id);try{await x(A)}catch(e){$.error(e instanceof Error?e.message:c5(`errors.restoreTarget`))}finally{P(e=>e===A.id?null:e)}}},[A,x]),Rn=!!(A&&A.target_available!==!1&&!F&&!i5({activeProject:t,activeProjectBranchState:n,session:A})),zn=Rn&&A?c5(`review.mismatchReason`,{sessionTarget:o5(A),currentTarget:s5({activeProject:t,activeProjectBranchState:n})}):null,Bn=N!==null,Vn=Rn&&N===null,Hn=(0,p.useCallback)(async r=>{P(r.id);let i=r;if(e)try{let t=await TM(e,r.id);i=t,Xt(t)}catch(e){$.error(e instanceof Error?e.message:c5(`errors.loadSession`)),P(e=>e===r.id?null:e);return}if(i.target_available===!1){In(i.id,i);return}if(!i5({activeProject:t,activeProjectBranchState:n,session:i})&&x)try{if(!await x(i)){P(e=>e===i.id?null:e);return}}catch(e){$.error(e instanceof Error?e.message:c5(`errors.restoreTarget`)),P(e=>e===i.id?null:e);return}In(i.id,i)},[t,n,e,x,In,Xt]),Un=(0,p.useCallback)(()=>{at(e=>e+1)},[]),Wn=(0,p.useCallback)(async t=>{if(F){let n=ut.current;return ee(t),C5({projectId:e,tool:u,model:n.showModelSelector&&n.model||null,variant:n.showModelSelector&&n.model&&n.variant||null,mode:t,skills:n.showModelSelector?n.skills:[]}),Un(),null}if(!e||!A||A.mode===t||Me||yn)return null;Ne(!0);try{let n=await DM(e,A.id,{mode:t});return C5({projectId:e,tool:n.tool,model:n.model,variant:n.variant,mode:n.mode,skills:n.skills}),Yt(n),Xt(n),Un(),n}catch(e){return $.error(e instanceof Error?e.message:c5(`errors.updateMode`)),null}finally{Ne(!1)}},[e,A,u,Un,yn,F,Me,Yt,Xt]),Gn=(0,p.useCallback)(async({instruction:t,attachments:n,targetSession:r,startedAt:i})=>{if(!e)return null;let a=ut.current;Nt.current+=1;let o={parentType:`chat`,parentId:r.id,turnKey:`${r.id}:${Nt.current}`,startedAt:i};st(o);try{let i=await OM(e,r.id,{instruction:t,...n.length>0?{attachment_ids:n.map(e=>e.id)}:{},tool:r.tool,model:a.showModelSelector&&a.model||null,variant:a.showModelSelector&&a.model&&a.variant||null,skills:a.showModelSelector?a.skills:[]});return C5({projectId:e,tool:i.tool,model:i.model,variant:i.variant,mode:i.mode,skills:i.skills}),dt.current=!1,Yt(i),k(i.id),I(!1),Xt(i),i}catch(e){throw st(e=>e?.turnKey===o.turnKey?null:e),e}},[e,Yt,Xt]),Kn=(0,p.useCallback)(async({fromStorageKey:t})=>{if(!e)return null;let n=ut.current,r=pt.current,i=await wM(e,{mode:En,tool:u,model:n.showModelSelector&&n.model||null,variant:n.showModelSelector&&n.model&&n.variant||null,skills:n.showModelSelector?n.skills:[],originSpecSessionId:r?.specSessionId??null,originSpecSnapshotId:r?.specSnapshotId??null});dt.current=!1,I(!1),k(i.id),Yt(i),m?.(i.id),R(null);let a=t5({projectId:e,tool:i.tool,chatSessionId:i.id});return an({fromStorageKey:t,toStorageKey:a}),{session:i,storageKey:a}},[e,u,En,an,m,Yt]),qn=(0,p.useCallback)(async(t,n={})=>{let r=n.targetSession??A,i=!r||r.messages?.length===0;if(!e||ve||ge||Wt||r?.agent_status===`running`||pF(r?.post_build_check)||r?.target_available===!1||Vn||yn)return!1;let a=t.trim(),o=n.preserveComposerDraft===!0,s=o?[]:r?Lt.current[r.id]??[]:[];if(!a&&s.length===0)return!1;ye(!0);let c=null,l=r,u=performance.now(),d=e&&r?t5({projectId:e,tool:r.tool,chatSessionId:r.id}):null,f=s;try{let t=r;if(!t){_e(!0);let e=await Kn({fromStorageKey:Bt});c=e?.session??null,t=c,d=e?.storageKey??null,f=c?Lt.current[c.id]??[]:[]}if(!t)return!1;o||en(d??Bt);let n=Ohe({session:t,instruction:a,attachments:f,createdAt:new Date().toISOString()});Yt(n),k(n.id),Xt(n);let s=await Gn({instruction:a,attachments:f,targetSession:t,startedAt:u});return s&&i&&C5({projectId:e,tool:s.tool,model:s.model,variant:s.variant,mode:s.mode,skills:[]}),o||en(s&&e?t5({projectId:e,tool:s.tool,chatSessionId:s.id}):d),s&&!o&&nn(s.id),!0}catch(e){o||$t(d??Bt,a);let t=qe(e,`chat_session`);if(t?(dt.current=!1,Yt(t),k(t.id),I(!1),Xt(t)):c?(Yt(c),k(c.id),I(!1),Xt(c)):l&&(Yt(l),Xt(l)),e instanceof Ke&&e.status===409&&!t){let e=c?.id??l?.id;e&&await cn(e)}throw e}finally{_e(!1),ye(!1)}},[e,A,nn,en,Kn,Bt,yn,ge,ve,Wt,cn,Yt,Gn,$t,Vn,Xt]),Jn=(0,p.useCallback)(async()=>{if(!(!A||!qY(A,yn)||bt.current)){bt.current=!0;try{let e=await Wn(`build`);if(!e)return;await qn(KY,{preserveComposerDraft:!0,targetSession:e})}catch(e){$.error(e instanceof Error?e.message:c5(`errors.sendPrompt`))}finally{bt.current=!1}}},[A,Wn,yn,qn]),Yn=(0,p.useCallback)(e=>{dt.current=!0,I(!0),qt(),ee(e),P(null),k(null),Yt(null),xe(null),st(null)},[Yt,qt]),Xn=(0,p.useCallback)(async t=>{if(e){gt.current.add(t.id);try{await PM(e,t.id),Qt(t.id,{preserveDraftRoute:!0}),Yn(t.mode)}catch(e){throw gt.current.delete(t.id),e}}},[e,Yn,Qt]),Zn=(0,p.useCallback)(async t=>{if(!e||t.length===0||Ht!==`opencode`&&Ht!==`claude`)return;let n=t.slice(0,f5);if(n.length===0)return;let r=null,i=A;try{if(i||=(_e(!0),r=await Kn({fromStorageKey:Bt}),r?.session??null),!i)return;if((Lt.current[i.id]??[]).length+n.length>f5){$.error(`You can attach up to 4 images per turn.`);return}rn(i.id,1);let t=await AM(e,i.id,n),a=Lt.current[i.id]??[];tn(i.id,[...a,...t.attachments])}catch(e){if(r&&!Vt.trim())try{await Xn(r.session)}catch{}$.error(e instanceof Error?e.message:c5(`errors.uploadAttachments`))}finally{i&&rn(i.id,-1),_e(!1)}},[e,A,Kn,Xn,Vt,Bt,rn,tn,Ht]),Qn=(0,p.useCallback)(async t=>{if(!e||!A)return;let n=(Lt.current[A.id]??[]).filter(e=>e.id!==t);try{await jM(e,A.id,t),tn(A.id,n),n.length===0&&!Vt.trim()&&(A.messages?.length??0)===0&&await Xn(A)}catch(e){$.error(e instanceof Error?e.message:c5(`errors.removeAttachment`))}},[e,A,Xn,Vt,tn]),$n=(0,p.useCallback)(e=>{if(Ht!==`opencode`&&Ht!==`claude`)return;let t=Array.from(e.clipboardData.items).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),Zn(t))},[Ht,Zn]),er=(0,p.useCallback)(async e=>{await qn(e)},[qn]),tr=!!(e&&(F||A&&A.target_available!==!1&&!Vn)),nr=A?.agent_status===`running`,rr=A?.agent_status===`stopped`,ir=nr&&be===A?.id,ar=rr&&A?.can_resume===!0,or=ar&&Se===A?.id,sr=or||ve||ge||Wt||yn||M||A?.target_available===!1||Bn||Vn,cr=tr&&!yn&&!nr&&!M&&!ve&&!ge&&!Wt,lr=tr?A?.target_available===!1?A.target_unavailable_reason??c5(`review.unavailableTarget`):Vn?zn??c5(`review.restoreTargetFallback`):yn?jb.t(`common:questionSet.waitForResolution`):nr?c5(`review.waitTurn`):M?jb.t(`common:postBuildChecks.blockedReason`):Wt?c5(`review.waitUpload`):ge||ve?c5(`review.waitPrompt`):null:c5(`review.missingTarget`),ur=(0,p.useCallback)(async()=>{if(!(!e||!A||A.agent_status!==`running`||ir)){xe(A.id);try{await MM(e,A.id)}catch(e){xe(e=>e===A.id?null:e),$.error(e instanceof Error?e.message:c5(`errors.interruptResponse`))}}},[e,A,ir]),dr=(0,p.useCallback)(async()=>{if(!e||!A||A.agent_status!==`stopped`||!A.can_resume||Se===A.id||Bn)return;let t=A.id,n=e,r=vt.current,i=performance.now();Ce(t);let a=NM(e,t,c5(`errors.resumeResponse`));Nt.current+=1;let o={parentType:`chat`,parentId:t,turnKey:`${t}:${Nt.current}`,startedAt:i};st(o);try{let e=await a;ft.current===n&&vt.current===r&&(Xt(e),ht.current===t&&!dt.current&&Yt(e))}catch(e){st(e=>e?.turnKey===o.turnKey?null:e);let i=qe(e,`chat_session`);i&&ft.current===n&&vt.current===r?(Xt(i),ht.current===t&&!dt.current&&Yt(i)):!i&&e instanceof Ke&&e.status===409&&ft.current===n&&ht.current===t&&!dt.current&&await cn(t),Ye(e)||$.error(e instanceof Error?e.message:c5(`errors.resumeResponse`))}finally{Ce(e=>e===t?null:e)}},[e,A,Bn,cn,Yt,Se,Xt]),fr=(0,p.useCallback)(async()=>{if(!e||we.length===0||Ee.size>0)return;let t=Array.from(new Set(we)),n=Oe||t.length>1;De(new Set(t));let r=await Promise.allSettled(t.map(async t=>(await PM(e,t),t))),i=[],a=[];for(let[e,n]of r.entries()){if(n.status===`fulfilled`){i.push(n.value);continue}a.push({sessionId:t[e]??``,message:n.reason instanceof Error?n.reason.message:null})}if(i.length>0&&Zt(i),De(new Set),a.length===0){Te([]),n&&(ke(!1),je(new Set),$.success(c5(`toasts.deleteSelectedSuccess`,{count:i.length})));return}let o=a.map(e=>e.sessionId);if(Te(o),n&&je(new Set(o)),i.length>0){$.error(c5(`toasts.deleteSelectedPartial`,{count:i.length,deletedCount:i.length,failedCount:a.length}));return}$.error(a[0]?.message??c5(`errors.deleteSession`))},[e,we,Ee,Oe,Zt]),pr=(0,p.useMemo)(()=>E.some(e=>!D5(e)),[E]),mr=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:e.agent_status===`stopped`?`interrupted`:!t&&ct.has(e.id)?`finished`:null,[ct]),hr=(0,p.useCallback)((e,n)=>[e.title,yhe(e.mode),Y8(e.tool),t?.memory_enabled&&e.pending_memory_suggestion_count>0?h5(e.pending_memory_suggestion_count):null,n===`running`?c5(`sidebar.running`):n===`interrupted`?c5(`sidebar.interrupted`):n===`finished`?c5(`sidebar.finished`):null].filter(Boolean).join(` `),[t]),gr=(0,p.useCallback)(({session:e,isActive:r,activityState:i})=>{let a=Ehe(e),o=a5({session:e,activeProject:t,activeProjectBranchState:n}),s=i===`interrupted`?null:i;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o?(0,X.jsx)(`div`,{className:`mb-1 truncate text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground/75`,children:o}):null,(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`div`,{className:`truncate text-[13px] font-medium leading-5`,children:e.title}),t?.memory_enabled&&e.pending_memory_suggestion_count>0?(0,X.jsx)(Ww,{tone:r?`default`:`muted`,className:`shrink-0`,"aria-label":h5(e.pending_memory_suggestion_count),title:h5(e.pending_memory_suggestion_count),children:e.pending_memory_suggestion_count}):null]}),a?(0,X.jsx)(`div`,{className:Z(`mt-0.5 line-clamp-1 text-xs leading-4`,r?`text-foreground/70`:`text-muted-foreground`),children:a}):null,e.target_available===!1?(0,X.jsx)(`div`,{className:`mt-1 line-clamp-1 text-[11px] leading-4 text-amber-200/90`,children:e.target_unavailable_reason??c5(`sidebar.targetUnavailable`)}):null]}),(0,X.jsx)(Hy,{state:s,className:`mt-1`})]})},[t,n]),_r=(0,p.useMemo)(()=>({ariaLabel:c5(`sidebar.ariaLabel`),newSession:c5(`sidebar.newSession`),collapseAriaLabel:c5(`sidebar.collapseAriaLabel`),openAriaLabel:c5(`sidebar.openAriaLabel`),cancelSelection:c5(`sidebar.cancelSelection`),addPreset:c5(`sidebar.addPreset`),deleteSelected:c5(`sidebar.deleteSelected`),selectedCount:e=>c5(`sidebar.selectedCount`,{count:e}),select:c5(`sidebar.select`),loadingSessions:c5(`sidebar.loadingSessions`),noSessions:c5(`sidebar.noSessions`),deleteSessionAriaLabel:c5(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>c5(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>c5(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>c5(`sidebar.deleteSessionTitle`,{title:e})}),[]),vr=(0,p.useMemo)(()=>({title:c5(`deleteSessionModal.title`),bulkTitle:c5(`deleteSessionModal.bulkTitle`),description:c5(`deleteSessionModal.description`),bulkDescription:e=>c5(`deleteSessionModal.bulkDescription`,{count:e}),cancel:c5(`deleteSessionModal.cancel`),delete:c5(`deleteSessionModal.delete`),deleting:c5(`deleteSessionModal.deleting`)}),[]),yr=(0,p.useMemo)(()=>(0,X.jsx)(g5,{modifierLabel:kn,keys:[d5],ariaHidden:!0}),[kn]),br=(0,p.useMemo)(()=>(0,X.jsx)(xhe,{label:c5(`shortcuts.startNewSession`),modifierLabel:kn,keys:[d5]}),[kn]),xr=(0,p.useCallback)((e,t)=>{je(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),Sr=(0,p.useMemo)(()=>nr?(0,X.jsx)(j8,{action:`interrupt`,isPending:ir,onAction:()=>{ur()},label:c5(`review.interrupt`),pendingLabel:c5(`review.interrupting`)}):ar?(0,X.jsx)(j8,{action:`resume`,isPending:or,disabled:sr,onAction:()=>{dr()},label:c5(`review.resume`),pendingLabel:c5(`review.resuming`)}):null,[ar,ur,dr,ir,sr,or,nr]),Cr=(0,p.useMemo)(()=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(UY,{value:En,planInactiveTooltip:(0,X.jsx)(eX,{label:c5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(eX,{label:c5(`shortcuts.switchToBuild`)}),disabled:Me||yn,onChange:e=>{Wn(e)}}),Sr]}),[En,Wn,yn,Me,Sr]),wr=(0,p.useMemo)(()=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(UY,{value:En,planInactiveTooltip:(0,X.jsx)(eX,{label:c5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(eX,{label:c5(`shortcuts.switchToBuild`)}),disabled:Me||yn,onChange:e=>{Wn(e)}}),A&&qY(A,yn)&&(0,X.jsx)(tX,{disabled:ve||Me,onClick:()=>void Jn()}),F&&t&&(0,X.jsx)(Fy,{activeProject:t,branchState:n,bundles:r,branchSuggestions:i,isBundleLoading:a,isLoading:o,presentation:`composer`,closeAfterSelection:!0,triggerAriaLabel:jb.t(`common:projectTargetSelector.newChatAriaLabel`),onOpenChange:s,onSelectBundle:c,onSelectRepoRoot:l}),Sr]}),[t,n,A,En,Wn,Jn,yn,F,ve,a,o,Me,c,l,s,Sr,i,r]),Tr=(0,p.useMemo)(()=>Cn?(0,X.jsx)(vY,{model:ae,variant:W,skills:ce,showModelSelector:!0,showSkillsSelector:re.length>0,availableModels:Gt,availableSkills:re,selectedModel:Tn,onModelChange:e=>{let t=Gt.find(t=>t.id===e)??null,n=t&&t.variants.includes(W)?W:``;oe(e),se(n),Pn({model:e,variant:n})},onVariantChange:e=>{se(e),Pn({variant:e})},onSkillsChange:e=>{le(e),Pn({skills:e})},modelSelectId:`project-chat-model-selector`,variantSelectId:`project-chat-variant-selector`,skillsSelectId:`project-chat-skills-selector`,disabled:ve||ge||A?.agent_status===`running`}):wn?(0,X.jsx)(_Y,{dataTestId:`chat-model-selector-skeleton`}):null,[A?.agent_status,Gt,re,ge,ve,Pn,Tn,ae,ce,W,Cn,wn]);(0,p.useEffect)(()=>{if(S)return()=>{S(null)}},[S]),(0,p.useEffect)(()=>{if(S){if(!e||!tr){S(null);return}S({chatSessionId:A?.id??null,canSubmitReviewPrompt:cr,reviewSubmitDisabledReason:lr,mode:En,onModeChange:async e=>{await Wn(e)},isUpdatingMode:Me,promptPlaceholder:m5(En),promptComposerControls:Cr,promptComposerInlineControls:Tr,submitPrompt:er})}},[e,A,cr,En,Wn,er,tr,Me,S,Cr,Tr,lr]);let Er=async()=>{if(!(!Vt.trim()&&Ut.length===0||Wt||yn||M))try{if(!await qn(Vt))return}catch(e){$.error(e instanceof Error?e.message:c5(`errors.sendPrompt`))}},Dr=e=>{e.key!==`Enter`||e.shiftKey||A?.agent_status===`running`||M||ge||ve||Wt||yn||(e.preventDefault(),Er())};(0,p.useEffect)(()=>{let t=t=>{if(bhe(t)){if(!e||ge||ve)return;t.preventDefault(),Fn(),Un();return}ZY(t)&&(!e||!F&&!A||(t.preventDefault(),Wn(XY(En))))};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,A,En,Un,Fn,Wn,ge,F,ve]);let Or=(0,p.useCallback)(async t=>{if(!(!e||!A)){Le(t);try{let n=await LM(e,A.id,t);Yt(n.chatSession),Xt(n.chatSession),$.success(c5(`ticketProposal.createdFromChat`,{count:n.created_tickets.length}))}catch(e){$.error(e instanceof Error?e.message:c5(`errors.createTickets`))}finally{Le(e=>e===t?null:e)}}},[e,A,Yt,Xt]),kr=(0,p.useCallback)(e=>e.ticket_proposals?(0,X.jsx)(Ahe,{proposals:e.ticket_proposals,isApplying:Ie===e.id,onApply:()=>{Or(e.id)}}):null,[Ie,Or]),Ar=(0,p.useCallback)(e=>{if(!xt.current)return;let t=xt.current.getBoundingClientRect().width,n=p5(e,t);jt.current=n,Ct.current&&(Ct.current.style.setProperty(`--chat-changes-panel-width`,`${n}px`),Ct.current.setAttribute(`data-desktop-width`,String(n)))},[]),Mr=(0,p.useCallback)(()=>{Et.current?.(),Et.current=null},[]),Nr=(0,p.useCallback)(e=>{let t=wt.current,n=Tt.current,r=Dt.current;if(t!==null){if(wt.current=null,Tt.current=null,Dt.current=!1,$e(!1),tt(!1),Mr(),e!==null&&typeof St.current?.hasPointerCapture==`function`&&St.current.hasPointerCapture(e)&&typeof St.current.releasePointerCapture==`function`&&St.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;rt(jt.current),Y(!0);return}rt(jt.current)}},[Mr]),Pr=(0,p.useCallback)((e,t)=>{if(wt.current!==e)return;let n=t-kt.current,r=At.current-n;if(Tt.current===`collapsed`){if(!Dt.current&&r<hhe)return;Dt.current||(Dt.current=!0,Ot.current=!0,tt(!0),$e(!0))}Ar(r)},[Ar]),Fr=(0,p.useCallback)((e,t)=>{if(wt.current===e){if(t!==null&&(Tt.current===`inline`||Dt.current)){let e=t-kt.current;Ar(At.current-e)}Nr(e)}},[Nr,Ar]),Ir=(0,p.useCallback)(e=>{if(!w)return;e.preventDefault(),wt.current=e.pointerId,Tt.current=Ze?`inline`:`collapsed`,Dt.current=!1,Ot.current=!1,kt.current=e.clientX,At.current=Ze?jt.current:0,$e(Ze),Mr(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{Pr(e.pointerId,e.clientX)},n=e=>{Fr(e.pointerId,e.clientX)},r=e=>{Fr(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),Et.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[Fr,Pr,Ze,w,Mr]),Lr=(0,p.useCallback)(e=>{Pr(e.pointerId,e.clientX)},[Pr]),Rr=(0,p.useCallback)(e=>{Fr(e.pointerId,e.clientX)},[Fr]),zr=(0,p.useCallback)(e=>{Fr(e.pointerId,e.clientX)},[Fr]),Br=(0,p.useCallback)(e=>{wt.current===e.pointerId&&Nr(e.pointerId)},[Nr]),Vr=(0,p.useCallback)(()=>{if(Ot.current){Ot.current=!1;return}Y(!0)},[]),Hr=(0,p.useCallback)(()=>{Y(!1)},[]),Ur=(0,p.useCallback)(e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),Vr())},[Vr]);(0,p.useEffect)(()=>{w||(wt.current=null,Tt.current=null,Dt.current=!1,Ot.current=!1,$e(!1),tt(!1),Mr())},[w,Mr]),(0,p.useEffect)(()=>()=>{Mr()},[Mr]);let Wr=!!O,Gr=A?.target_available===!1,Kr=Gr?A?.target_unavailable_reason??c5(`review.unavailableTarget`):null,qr=F||!!(A&&A.target_available!==!1&&!Vn),Jr=!!(t?.memory_enabled&&A&&(G.length>0||Ve)),Yr=w&&(F||Wr)&&!Gr&&!Vn,Xr=Yr&&!Ze&&!et,Zr=Yr&&(Ze||et),Qr=`${Nn??`none`}:${Yr?`changes-enabled`:`changes-disabled`}:${Zr?`panel-visible`:`panel-hidden`}`,$r=(0,p.useCallback)(e=>{mt.current=null,$t(Bt,e)},[Bt,$t]),ei=A||F?(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(V8,{projectId:e,agentRunParentType:A?`chat`:null,agentRunParentId:A?.id??null,messages:A?_n:[],internalLog:A?.agent_log??null,currentThinkingMessageId:A?.agent_message_id??null,previousThinkingLog:A?.previous_agent_log??null,previousThinkingMessageId:A?.previous_agent_message_id??null,pendingAgentTitle:gn,streamingResponse:A?.streaming_response??null,isRunning:A?.agent_status===`running`,isLoading:!F&&me,canShowComposer:qr,cardClassName:`border-t-0`,isExternallyResizing:C||Qe,pendingAgentRevealKey:Sn,pendingAgentRevealDelayMs:vhe,liveResponseTiming:ot,composerFocusNonce:it,header:(0,X.jsx)(H8,{title:Dn,tool:F?null:A?.tool??null,modelLabel:Mn,interrupted:rr,interruptedLabel:c5(`sidebar.interrupted`),usage:{totalTokens:A?.usage_snapshot_total_tokens??null,contextWindow:A?.usage_snapshot_context_window??null,cost:A?.usage_snapshot_cost??null,tool:On,model:An,availableModels:Gt},metadataExtra:(0,X.jsxs)(X.Fragment,{children:[A?.external_source?(0,X.jsx)(IF,{externalSource:A.external_source}):null,A?.origin_spec_session_id&&A.origin_spec_snapshot_id&&y?(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`ghost`,className:`h-6 px-2 text-[11px] text-violet-200 hover:text-violet-100`,onClick:()=>{y(A.origin_spec_session_id,A.origin_spec_snapshot_id)},children:jb.t(`common:specView.provenance.viewSourceSpec`)}):null]}),actions:A&&e?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Jr&&(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>K(!0),children:Ve?c5(`composer.loadingMemory`):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:c5(`composer.memorySuggestions`)}),(0,X.jsx)(Ww,{children:G.length})]})}),(0,X.jsx)(R4,{projectId:e,scope:{type:`chat`,id:A.id},size:`xs`,onNavigateToLifecycleSource:b})]}):null,warnings:Vn&&zn?(0,X.jsx)(`div`,{className:`w-fit max-w-md rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-50`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`div`,{children:zn}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{Ln()},children:c5(`composer.switchBack`)}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:Fn,children:c5(`composer.startNewSession`)})]})]})}):Gr&&Kr?(0,X.jsx)(`div`,{className:`w-fit max-w-md rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-50`,children:Kr}):null}),composerControls:wr,composerInlineControls:Tr,composerTheme:En,layoutKey:Nn,scrollLayoutKey:Qr,followUpPrompt:Vt,draftAttachments:Ut,followUpPlaceholder:m5(En),emptyStateText:null,renderMessageFooter:kr,renderMessageBody:xn,isSendingFollowUp:ve||ge,isComposerSubmitDisabled:yn||M,postBuildCheck:A?.post_build_check,isUploadingAttachments:Wt,canAttachImages:jn,followUpDisabledReason:Gr?Kr??void 0:A?.agent_status===`running`?c5(`review.waitTurnShort`):M?jb.t(`common:postBuildChecks.blockedReason`):Wt?c5(`review.waitUpload`):yn?jb.t(`common:questionSet.waitForResolution`):void 0,onFollowUpPromptChange:$r,onFollowUpKeyDown:Dr,onFollowUpPaste:$n,onUploadAttachments:e=>{Zn(e)},onRemoveAttachment:e=>{Qn(e)},onFollowUpSubmit:()=>{Er()}})}):Wr?(0,X.jsx)(D8,{label:c5(`composer.loadingSession`)}):!fe||ue?(0,X.jsx)(O8,{label:c5(`sidebar.loadingSessions`)}):(0,X.jsx)(k8,{title:c5(`composer.noSessionSelectedTitle`),description:c5(`composer.noSessionSelectedDescription`),startNewSessionLabel:c5(`composer.startNewSession`),onStartNewSession:Fn,canStartNewSession:!!e&&!ge&&!ve}),ti=Yr?(0,X.jsx)(`div`,{ref:St,"aria-label":c5(Xr?`composer.openDiff`:`composer.resizeDiffPanel`),"aria-orientation":Xr?void 0:`vertical`,className:Z(Xr?`group flex h-8 w-full shrink-0 touch-none select-none items-center justify-center border-t border-border/70 bg-background/90 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground xl:h-auto xl:w-7 xl:cursor-col-resize xl:border-l xl:border-t-0`:`group hidden w-5 shrink-0 cursor-col-resize touch-none select-none items-center justify-center border-l border-border/70 bg-background/80 transition-colors xl:flex`,Qe&&!Xr&&`bg-background`),"data-testid":Xr?`collapsed-changes-rail`:void 0,onLostPointerCapture:Br,onPointerCancel:zr,onPointerDown:Ir,onPointerMove:Lr,onPointerUp:Rr,onClick:Xr?Vr:void 0,onKeyDown:Xr?Ur:void 0,role:Xr?`button`:`separator`,tabIndex:Xr?0:void 0,children:Xr?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`hidden h-full w-full items-center justify-center xl:flex`,children:(0,X.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-[2.65rem] items-center justify-center text-sky-400/80 transition-colors group-hover:text-sky-300`,children:(0,X.jsx)(Cv,{className:`h-3 w-3 shrink-0`})}),(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 h-14 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-muted-foreground/70 transition-colors group-hover:bg-sky-300/90`})]})}),(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium xl:hidden`,children:[(0,X.jsx)(Cv,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:c5(`composer.diff`)})]})]}):(0,X.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,Qe?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})}):null,ni=Ue&&e&&t?.memory_enabled?(0,X.jsx)(uC,{onClose:()=>K(!1),overlayClassName:`bg-background/75 p-4`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,X.jsxs)(gC,{size:`sm`,className:`max-h-[calc(100vh-2rem)] w-full gap-0 overflow-hidden border-border/80 bg-card/95 shadow-2xl`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/80 pb-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(vC,{children:c5(`composer.memorySuggestionsTitle`)}),(0,X.jsx)(yC,{children:c5(`composer.memorySuggestionsDescription`)})]}),(0,X.jsx)(bC,{children:t})]}),(0,X.jsx)(xC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,X.jsx)(U8,{projectId:e,suggestions:G,emptyState:c5(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:un})})]}),closeButtonLabel:c5(`composer.closeMemorySuggestions`)}):null,ri=mn.length>0?(0,X.jsx)(E8,{count:mn.length,title:hn,isDeleting:Ee.size>0,onConfirm:()=>{fr()},onCancel:()=>{Ee.size>0||Te([])},labels:vr}):null;return(0,X.jsxs)(`div`,{"data-testid":`chat-view-shell`,className:`relative flex min-h-0 flex-1 overflow-hidden border-t border-border/70`,children:[(0,X.jsx)(A8,{sessions:E,sessionGroups:fn,activeSessionId:O,isDraftOpen:F,isLoadingSessions:ue,isOpen:J,onToggleOpen:()=>{Xe(e=>!e)},testId:`chat-sessions-sidebar`,railTestId:`chat-sessions-rail`,onDraftOpen:Fn,isCreatingSession:ge||!e,isSendingPrompt:ve,newSessionShortcutHint:yr,newSessionTooltip:br,isSelectionMode:Oe,selectedSessionIds:Ae,selectedSessionCount:Ae.size,hasDeletableSessions:pr,deletingSessionIds:Ee,onEnterSelectionMode:()=>{ke(!0),je(new Set)},onExitSelectionMode:()=>{ke(!1),je(new Set)},onToggleSessionSelection:e=>{je(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:xr,onConfirmDeleteSelectedSessions:()=>{Te(Array.from(Ae))},selectionPresets:pn,onSessionSelect:e=>{Hn(e)},onConfirmDeleteSession:e=>{Te([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:D5,getActivityState:mr,getRowAriaLabel:hr,renderRowContent:gr,labels:_r}),(0,X.jsxs)(`div`,{ref:xt,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden xl:flex-row`,children:[(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:ei}),Yr?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(lv,{content:c5(`composer.openDiff`),disabled:!Xr,side:`left`,children:ti}),Zr?(0,X.jsx)(B8,{projectId:e,chatSessionId:F?null:O,canSubmitReviewPrompt:cr,reviewSubmitDisabledReason:lr,onSubmitReviewPrompt:er,state:q,onStateChange:Je,isResizing:Qe,onClose:Hr,desktopWidth:nt,panelElementRef:Ct}):null]}):null]}),ni,ri]})},Mhe=({className:e})=>(0,X.jsx)(ute,{"aria-hidden":`true`,className:e}),Nhe=({activeProject:e,onNavigateToSource:t})=>{let{t:n}=K(`projects`);return e?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-6`,children:(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col gap-5`,children:[(0,X.jsx)(`div`,{className:`border-b border-border/60 pb-4`,children:(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground`,children:n(`memory.workspace.title`)}),(0,X.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:e.name})]})}),(0,X.jsx)(DT,{mode:`edit`,projectId:e.id,memoryEnabled:e.memory_enabled,persistedMemoryEnabled:e.memory_enabled,onMemoryEnabledChange:()=>{},showActivationControls:!1,archiveLayout:!0,onNavigateToSource:t})]})}):(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:n(`memory.workspace.selectProject`)})},Phe=(e,t,n,r)=>Y(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{method:`POST`,body:r,fallbackErrorMessage:`Unable to start the spec review right now.`}),Fhe=(e,t,n)=>Y(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the spec review right now.`}),O5=(e,t,n,r)=>Y(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{signal:r,fallbackErrorMessage:`Unable to load the spec review right now.`}),Ihe=(e,t,n,r)=>Y(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review-runs/${r}/revision-draft`),{method:`POST`,fallbackErrorMessage:`Unable to build the revision draft right now.`}),Lhe=(e,t)=>!!t&&e===t,Rhe=({suggestion:e,isRecommended:t,recommendedLabel:n,onPick:r})=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{r(e.value)},className:Z(`inline-flex min-w-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-left text-xs font-medium transition-colors`,t?`border-amber-500/40 bg-amber-500/15 text-amber-200 hover:bg-amber-500/25 hover:text-amber-100`:`border-border/70 bg-background/70 text-foreground hover:border-border hover:bg-background`),children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.label}),t?(0,X.jsx)(`span`,{className:`shrink-0 rounded-full bg-amber-500/30 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-amber-100`,children:n}):null]}),zhe=({question:e,labels:t})=>(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm font-medium leading-relaxed text-foreground`,children:e.question}),e.rationale?(0,X.jsxs)(`p`,{className:`whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`font-semibold`,children:[t.rationaleLabel,`: `]}),e.rationale]}):null]}),k5=({question:e,isActive:t,isDisabled:n=!1,onSubmitAnswer:r,labels:i})=>{let[a,o]=(0,p.useState)(``),s=(0,p.useRef)(null);if((0,p.useEffect)(()=>{t&&o(``)},[e.question,t]),(0,p.useEffect)(()=>{s.current&&PE(s.current)},[a]),!t)return(0,X.jsx)(zhe,{question:e,labels:i});let c=a.trim().length>0&&!n,l=e.suggestions.find(e=>e.recommended)?.id,u=e=>{o(e),requestAnimationFrame(()=>{s.current?.focus();let e=s.current;e&&e.setSelectionRange(e.value.length,e.value.length)})},d=()=>{let e=a.trim();!e||n||(r(e),o(``))};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(Yy,{className:`mt-0.5 h-4 w-4 flex-shrink-0 text-amber-300`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm font-medium leading-relaxed text-foreground`,children:e.question}),e.rationale?(0,X.jsxs)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`font-semibold`,children:[i.rationaleLabel,`: `]}),e.rationale]}):null]})]}),e.suggestions.length>0?(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:i.suggestionsLabel}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.suggestions.map(e=>(0,X.jsx)(Rhe,{suggestion:e,isRecommended:Lhe(e.id,l),recommendedLabel:i.recommendedSuggestionLabel,onPick:u},e.id))})]}):null,(0,X.jsx)(A_,{ref:s,value:a,placeholder:i.answerPlaceholder,disabled:n,onChange:e=>{o(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),d())}}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,disabled:!c,onClick:d,children:n?i.submittingLabel:i.submitLabel})})]})},Bhe=({className:e})=>(0,X.jsx)(qee,{"aria-hidden":`true`,className:e}),Vhe=[`h-10 w-10 px-0`,`border-amber-400/60 bg-amber-500/30 text-amber-100 shadow-[0_8px_24px_rgba(245,158,11,0.24)]`,`hover:bg-amber-500/45 hover:text-white hover:border-amber-300`,`focus-visible:border-ring/70 focus-visible:ring-2 focus-visible:ring-ring/20`].join(` `),Hhe=[`h-10 w-10 px-0 shadow-none`,`border-border/70 bg-transparent text-muted-foreground`,`hover:border-border hover:bg-background/60 hover:text-foreground`,`focus-visible:border-ring/70 focus-visible:ring-2 focus-visible:ring-ring/20`,`disabled:border-border/40 disabled:bg-transparent disabled:text-muted-foreground/50`].join(` `),A5=({on:e,disabled:t=!1,onToggle:n,tooltipContent:r,ariaLabelOn:i,ariaLabelOff:a,className:o})=>(0,X.jsx)(lv,{content:r,children:(0,X.jsx)(`span`,{className:`inline-flex`,children:(0,X.jsx)(Q,{type:`button`,size:`icon`,variant:e?`warning`:`ghost`,"aria-pressed":e,"aria-label":e?i:a,disabled:t,className:Z(e?Vhe:Hhe,o),onClick:()=>{t||n(!e)},children:(0,X.jsx)(Bhe,{className:`h-5 w-5`})})})}),Uhe=({projectId:e,specSessionId:t,messages:n,internalLog:r,currentThinkingMessageId:i=null,previousThinkingLog:a=null,previousThinkingMessageId:o=null,pendingAgentTitle:s,streamingResponse:c,isRunning:l,isLoading:u=!1,canShowComposer:d,cardClassName:f,isExternallyResizing:p=!1,pendingAgentRevealKey:m=null,pendingAgentRevealDelayMs:h=0,liveResponseTiming:g=null,composerFocusNonce:_=0,blurComposerOnSendStart:v=!1,hidePendingAgentTitle:y=!1,forceScrollToBottomKey:b,header:x,composerControls:S,composerInlineControls:C,composerTheme:w=`default`,layoutKey:T,scrollLayoutKey:E,followUpPrompt:D,draftAttachments:O=[],followUpPlaceholder:k,emptyStateText:A=null,renderMessageFooter:j,renderMessageBody:M,isSendingFollowUp:N,isComposerSubmitDisabled:P=!1,isUploadingAttachments:F=!1,canAttachImages:I=!1,followUpDisabledReason:L,onFollowUpPromptChange:R,onFollowUpKeyDown:z,onFollowUpPaste:ee,onUploadAttachments:B,onRemoveAttachment:V,onFollowUpSubmit:te})=>(0,X.jsx)(VJ,{projectId:e,agentRunParentType:t?`spec`:null,agentRunParentId:t,messages:n,internalLog:r,currentThinkingMessageId:i,previousThinkingLog:a,previousThinkingMessageId:o,pendingAgentTitle:s,streamingResponse:c,isRunning:l||!!(N&&g),isLoading:u,autoScrollBehavior:`sticky`,surfaceVariant:`chat`,canShowComposer:d,cardClassName:f,header:x,composerControls:S,composerInlineControls:C,composerTheme:w,composerSize:`compact-on-laptop`,showThinkingPlacement:`header`,pinComposerToBottom:!0,isExternallyResizing:p,pendingAgentRevealKey:m,pendingAgentRevealDelayMs:h,liveResponseTiming:g,composerFocusNonce:_,blurComposerOnSendStart:v,forceScrollToBottomKey:b,layoutKey:T,scrollLayoutKey:E,followUpPrompt:D,draftAttachments:O,followUpPlaceholder:k,emptyStateText:A,autoFocusComposer:!0,renderMessageFooter:j,renderMessageBody:M,isSendingFollowUp:N,isComposerSubmitDisabled:P,isUploadingAttachments:F,canAttachImages:I,followUpDisabledReason:L,hidePendingAgentTitle:y,onFollowUpPromptChange:R,onFollowUpKeyDown:z,onFollowUpPaste:ee,onUploadAttachments:B,onRemoveAttachment:V,onFollowUpSubmit:te}),j5=e=>{let t={...e};return delete t.messages,t.agent_log=null,t.agent_message_id=null,t.previous_agent_log=null,t.previous_agent_message_id=null,t.streaming_response=null,t},Whe=(e,t)=>t.messages===void 0&&(!e||e.id!==t.id)?e:!e||e.id!==t.id||t.messages!==void 0?t:{...t,messages:e.messages},M5=new Set([`deterministic`,`structural_heuristic`,`historical_heuristic`]),N5=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ghe=e=>N5(e)&&typeof e.seed_path==`string`&&typeof e.candidate_path==`string`&&M5.has(e.evidence_class)&&typeof e.depth==`number`&&Array.isArray(e.edge_ids),P5=e=>N5(e)&&typeof e.path==`string`&&typeof e.is_test==`boolean`&&M5.has(e.evidence_class)&&Array.isArray(e.chains)&&e.chains.length>0&&e.chains.every(Ghe),Khe=e=>!N5(e)||e.version!==1||![`complete`,`stale`,`truncated`,`unavailable`].includes(e.capture_state)||!Array.isArray(e.affected_files)||!Array.isArray(e.affected_tests)||!e.affected_files.every(P5)||!e.affected_tests.every(P5)?null:e,qhe=e=>!!(e.likely_files.some(e=>e.origin!==`graph`)||e.file_relation_graph),F5=({evidenceClass:e})=>{let{t}=K(`common`);return(0,X.jsx)(hC,{variant:`outline`,className:`shrink-0 px-1.5 py-0 text-[10px] ${e===`deterministic`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e===`structural_heuristic`?`border-amber-400/30 bg-amber-500/10 text-amber-200`:`border-sky-400/30 bg-sky-500/10 text-sky-200`}`,children:t(`specView.artifactPanel.repositoryEvidence.class.${e}`)})},Jhe=({candidate:e})=>{let{t}=K(`common`),n=e.chains.slice(0,2);return(0,X.jsxs)(`details`,{className:`group mt-2 border-t border-border/40 pt-2`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer list-none rounded-sm text-xs font-medium text-violet-300 outline-none hover:text-violet-200 focus-visible:ring-2 focus-visible:ring-ring/60 [&::-webkit-details-marker]:hidden`,children:t(`specView.artifactPanel.repositoryEvidence.showChains`,{count:n.length})}),(0,X.jsx)(`ol`,{className:`mt-2 space-y-2`,children:n.map((e,n)=>(0,X.jsxs)(`li`,{className:`min-w-0 rounded-md bg-background/35 px-2.5 py-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-foreground`,children:t(`specView.artifactPanel.repositoryEvidence.chainLabel`,{number:n+1})}),(0,X.jsx)(F5,{evidenceClass:e.evidence_class})]}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-xs leading-relaxed text-muted-foreground`,children:t(`specView.artifactPanel.repositoryEvidence.chainSummary`,{seed:e.seed_path,candidate:e.candidate_path,count:e.depth})})]},`${e.seed_path}:${e.candidate_path}:${e.edge_ids.join(`:`)}`))})]})},Yhe=({row:e,affectedTest:t=!1})=>{let{t:n}=K(`common`);return(0,X.jsxs)(`li`,{className:`min-w-0 overflow-hidden rounded-md border border-border/50 bg-surface-hover px-3 py-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`code`,{className:`min-w-0 break-all text-xs font-medium text-foreground`,children:e.path}),e.isNew&&(0,X.jsx)(hC,{variant:`success`,className:`shrink-0 px-1.5 py-0 text-[10px]`,children:n(`specView.artifactPanel.newFile`)})]}),(0,X.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:n(`specView.artifactPanel.repositoryEvidence.origin.${e.origin}`)}),t&&(0,X.jsx)(hC,{variant:`outline`,className:`px-1.5 py-0 text-[10px] text-violet-200`,children:n(`specView.artifactPanel.repositoryEvidence.affectedTest`)}),e.candidate&&(0,X.jsx)(F5,{evidenceClass:e.candidate.evidence_class})]}),e.reason&&(0,X.jsx)(`p`,{className:`mt-1 break-words text-xs leading-relaxed text-muted-foreground`,children:e.reason}),e.candidate&&(0,X.jsx)(Jhe,{candidate:e.candidate})]})},I5=e=>e.replace(/\\/g,`/`),Xhe=({snapshot:e,onMermaidClick:t})=>{let{t:n}=K(`common`);Khe(e.repository_evidence);let r=[],i=[],a=new Map(i.map(e=>[I5(e.path),e])),o=e.likely_files.filter(e=>e.origin!==`graph`),s=new Map(o.map(e=>[e.normalized_path??I5(e.path),e])),c=o.flatMap(e=>{let t=e.normalized_path??I5(e.path);return a.has(t)?[]:[{path:e.path,reason:e.reason||null,isNew:e.is_new,origin:e.origin??`planner`,candidate:null}]}),l=r.map(e=>{let t=s.get(I5(e.path));return{path:t?.path??e.path,reason:null,isNew:!1,origin:t?`both`:`graph`,candidate:e}}),u=new Set(r.map(e=>I5(e.path)));for(let t of e.likely_files.filter(e=>e.origin===`graph`)){let e=t.normalized_path??I5(t.path);u.has(e)||l.push({path:t.path,reason:t.reason||null,isNew:t.is_new,origin:`graph`,candidate:null})}return i.map(e=>{let t=s.get(I5(e.path));return{path:t?.path??e.path,reason:t?.reason??null,isNew:t?.is_new??!1,origin:t?`both`:`graph`,candidate:e}}),(0,X.jsxs)(`section`,{children:[c.length>0&&(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:c.map(e=>(0,X.jsx)(Yhe,{row:e},`${e.origin}:${e.path}`))}),!1,e.file_relation_graph&&(0,X.jsxs)(`section`,{className:`mt-4`,"aria-labelledby":`spec-file-relation-heading`,children:[(0,X.jsx)(`h3`,{id:`spec-file-relation-heading`,className:`text-xs font-semibold text-foreground`,children:n(`specView.artifactPanel.fileRelationGraph`)}),(0,X.jsx)(`p`,{className:`mb-2 mt-1 text-xs leading-relaxed text-muted-foreground`,children:n(`specView.artifactPanel.repositoryEvidence.diagramDescription`)}),(0,X.jsx)(`div`,{className:`overflow-auto rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,X.jsx)(UW,{mermaid:e.file_relation_graph,onClick:()=>{t(e.file_relation_graph)}})})]})]})},L5=({className:e})=>(0,X.jsx)(xte,{"aria-hidden":`true`,className:e}),Zhe=({className:e})=>(0,X.jsx)(Mg,{"aria-hidden":`true`,className:e}),R5=({className:e})=>(0,X.jsx)(Bee,{"aria-hidden":`true`,className:e}),z5=({heading:e,open:t,onOpenChange:n,children:r})=>(0,X.jsxs)(BC,{open:t,onOpenChange:n,children:[(0,X.jsx)(VC,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground transition-colors mb-2`,children:[(0,X.jsx)(mv,{className:`h-3 w-3 shrink-0 transition-transform ${t?``:`-rotate-90`}`}),e]})}),(0,X.jsx)(HC,{children:r})]}),Qhe=({actions:e})=>{let{t}=K(`common`);return e.hasExistingTicketsFromSnapshot?(0,X.jsxs)(`p`,{className:`flex w-full items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium text-muted-foreground`,children:[(0,X.jsx)(Xy,{className:`h-3.5 w-3.5 text-emerald-400`}),t(`specView.actions.ticketsCreated`)]}):(0,X.jsxs)(Q,{type:`button`,size:`sm`,onClick:e.onCreateTickets,disabled:!!e.unavailableReason||e.isCreatingTickets||e.isImplementingInChat||e.isExporting,title:e.unavailableReason??void 0,className:`w-full justify-center gap-1.5 border-violet-300/70 bg-violet-500/15 text-violet-100 hover:bg-violet-500/25`,children:[(0,X.jsx)(L5,{className:`h-3.5 w-3.5`}),e.isCreatingTickets?t(`specView.actions.creatingTickets`):t(`specView.actions.createTickets`)]})},B5=({ticket:e})=>(0,X.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`break-words text-xs font-medium text-foreground`,children:e.title}),e.key&&(0,X.jsx)(`div`,{className:`mt-0.5 break-all text-xs text-violet-400`,children:e.key})]}),$he=({snapshot:e})=>{let{t}=K(`common`),n=new Map(e.tickets.map(e=>[e.key,e]));return(0,X.jsx)(`section`,{className:`space-y-2.5`,children:e.bundle_groups.map(e=>{let r=e.ticket_keys.map(e=>n.get(e)).filter(e=>e!==void 0);return(0,X.jsxs)(`article`,{className:`min-w-0 rounded-md border border-border/50 bg-surface px-3 py-2.5`,children:[(0,X.jsx)(`h4`,{className:`break-all text-sm font-semibold text-foreground`,children:e.name}),(0,X.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:t(`specView.artifactPanel.proposedTicketCount`,{count:r.length})}),r.length>0&&(0,X.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:r.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(B5,{ticket:e})},e.key))})]},e.key)})})},V5={high:0,medium:1,low:2},ege=e=>[...e].sort((e,t)=>{let n=V5[e.severity]??99,r=V5[t.severity]??99;return n===r?e.ordinal-t.ordinal:n-r}),tge=e=>{let t={high:0,medium:0,low:0};for(let n of e)t[n.severity]+=1;return t},nge=({run:e})=>{let{t}=K(`common`),n=e.agent_status,r=t(`specView.review.status.${n}`,{defaultValue:n});return(0,X.jsx)(`span`,{className:`text-xs font-medium ${n===`running`?`text-violet-300`:n===`completed`?`text-emerald-300`:n===`error`||n===`parse_failed`?`text-rose-300`:`text-amber-300`}`,children:r})},rge=({review:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)(!0),i=e.review?.run??null,a=e.review?.findings??[],o=ege(a),s=tge(a),c=e.isRunning||i?.agent_status===`running`,l=c,u=!!i&&!c&&i?.agent_status===`completed`&&a.length>0,d=i?.agent_status===`completed`?`specView.review.noFindings`:i?.agent_status===`stopped`?`specView.review.stoppedExplanation`:i?.agent_status===`error`?`specView.review.errorExplanation`:i?.agent_status===`parse_failed`?`specView.review.parseFailedExplanation`:null,f=(0,p.useMemo)(()=>new Map(e.availableModels.map(e=>[e.id,e.label])),[e.availableModels]),m=i?.model?Z8({availableModelsById:f,model:i.model})??i.model:null,h=i?[m,t(`specView.review.findingsCount`,{count:a.length}),s.high>0?`${s.high} ${t(`specView.review.severity.high`)}`:null,s.medium>0?`${s.medium} ${t(`specView.review.severity.medium`)}`:null,s.low>0?`${s.low} ${t(`specView.review.severity.low`)}`:null].filter(Boolean).join(` · `):null;return(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(R5,{className:`h-3.5 w-3.5`}),t(`specView.review.heading`)]}),open:n,onOpenChange:r,children:(0,X.jsxs)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-3`,children:[i&&(0,X.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(nge,{run:i}),c&&(0,X.jsx)(`span`,{className:`inline-flex items-center gap-1 text-violet-300`,"aria-hidden":`true`,children:(0,X.jsx)(`span`,{className:`h-3 w-3 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`})}),h&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:h})]}),e.isLoading&&!i&&(0,X.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:t(`specView.review.loading`)}),o.length>0?(0,X.jsx)(`ul`,{className:`space-y-2`,children:o.map(e=>(0,X.jsxs)(`li`,{className:`rounded-md border border-border/40 bg-surface px-2.5 py-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[0.65rem] font-bold uppercase tracking-wide ${e.severity===`high`?`text-rose-300`:e.severity===`medium`?`text-amber-300`:`text-sky-300`}`,children:e.severity}),(0,X.jsx)(`span`,{className:`min-w-0 break-words text-xs font-medium text-foreground`,children:e.title})]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-foreground`,children:e.what_text}),e.why_text&&(0,X.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[t(`specView.review.why`),`:`]}),` `,e.why_text]}),e.suggestion_text&&(0,X.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[t(`specView.review.suggestion`),`:`]}),` `,e.suggestion_text]})]},e.id))}):d?(0,X.jsx)(`p`,{className:`text-xs ${i?.agent_status===`completed`?`text-emerald-300`:`text-muted-foreground`}`,children:t(d)}):null,l&&(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:e.onStopReview,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(Ov,{className:`h-3.5 w-3.5`}),t(`specView.review.stop`)]})}),u&&(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:e.onSendToPlanner,disabled:!!e.disabledReason||e.isSendingToPlanner,title:e.disabledReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(AE,{className:`h-3.5 w-3.5`}),e.isSendingToPlanner?t(`specView.review.sendingToPlanner`):t(`specView.review.sendToPlanner`)]})})]})})},ige=({review:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)(!1),i=e.isRunning||e.review?.run?.agent_status===`running`,a=e.showModelSelector&&e.selectedDiscoveredModel!==null&&e.selectedDiscoveredModel.variants.length>0,o=t(i?`specView.review.running`:`specView.review.launch`);return(0,X.jsxs)(B_,{open:n&&!i,onOpenChange:r,children:[(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,disabled:i||!!e.disabledReason,title:e.disabledReason??void 0,"aria-label":o,className:`gap-1.5 text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(R5,{className:`h-4 w-4`}),t(`specView.review.heading`)]})}),(0,X.jsx)(H_,{align:`end`,className:`w-72 max-w-[calc(100vw-2rem)] p-3`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.22em] text-muted-foreground`,children:t(`specView.review.popoverTitle`)}),(0,X.jsx)(tv,{model:e.runConfigModel,showModelSelector:e.showModelSelector,availableModels:e.availableModels,onModelChange:e.onRunConfigModelChange,selectId:`spec-review-model`,label:t(`specView.review.model`)}),(0,X.jsx)(nv,{variant:e.runConfigVariant,selectedModel:e.selectedDiscoveredModel,showVariantSelector:a,onVariantChange:e.onRunConfigVariantChange,selectId:`spec-review-variant`,label:t(`specView.review.variant`)}),(0,X.jsxs)(Q,{type:`button`,size:`sm`,onClick:()=>{r(!1),e.onLaunchReview()},className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(R5,{className:`h-3.5 w-3.5`}),t(`specView.review.launchAction`)]})]})})]})},age=(0,p.memo)((0,p.forwardRef)(({snapshot:e,isLoading:t,desktopWidth:n,onClose:r,actions:i,review:a,className:o},s)=>{let{t:c}=K(`common`),[l,u]=(0,p.useState)(null),[d,f]=(0,p.useState)(!1),[m,h]=(0,p.useState)(!0),[g,_]=(0,p.useState)(!0),[v,y]=(0,p.useState)(!0),[b,x]=(0,p.useState)(!0),[S,C]=(0,p.useState)(!0),[w,T]=(0,p.useState)(!0),[E,D]=(0,p.useState)(!0),[O,k]=(0,p.useState)(!0),[A,j]=(0,p.useState)(!0),M=(0,p.useCallback)(e=>{u(e)},[]),N=(0,p.useCallback)(()=>{f(!0)},[]),P=`flex h-[26rem] min-h-0 min-w-0 w-full shrink-0 flex-col overflow-hidden border-t border-border/70 bg-surface xl:h-full xl:border-l xl:border-t-0 ${o??``}`;if(t)return(0,X.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`text-muted-foreground hover:text-foreground`,"aria-label":c(`specView.artifactPanel.close`),onClick:r,children:(0,X.jsx)(Ub,{className:`h-4 w-4`})})]}),(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,X.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`})})]});if(!e)return(0,X.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`text-muted-foreground hover:text-foreground`,"aria-label":c(`specView.artifactPanel.close`),onClick:r,children:(0,X.jsx)(Ub,{className:`h-4 w-4`})})]}),(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4`,children:(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(`specView.artifactPanel.noSnapshot`)})})]});let F=qhe(e),I=e.tickets.length>0,L=e.bundle_groups.length>0,R=e.dependencies.length>0,z=e.open_questions.length>0,ee=e.assumptions.length>0;return(0,X.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a&&(0,X.jsx)(ige,{review:a}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`text-muted-foreground hover:text-foreground`,"aria-label":c(`specView.artifactPanel.close`),onClick:r,children:(0,X.jsx)(Ub,{className:`h-4 w-4`})})]})]}),(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4`,children:[a&&(a.review?.run||a.isRunning)&&(0,X.jsx)(rge,{review:a}),(0,X.jsx)(z5,{heading:c(`specView.artifactPanel.summary`),open:m,onOpenChange:h,children:(0,X.jsx)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-foreground whitespace-pre-wrap`,children:e.summary})})}),e.mermaid&&(0,X.jsx)(z5,{heading:c(`specView.artifactPanel.visualization`),open:g,onOpenChange:_,children:(0,X.jsx)(`section`,{className:`overflow-auto rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,X.jsx)(UW,{mermaid:e.mermaid,onClick:()=>{M(e.mermaid)}})})}),e.mockup&&(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Zhe,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.uiMockup`)]}),open:v,onOpenChange:y,children:(0,X.jsx)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,X.jsx)(sG,{html:e.mockup,onClick:N})})}),F&&(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Sv,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.likelyFiles`)]}),open:b,onOpenChange:x,children:(0,X.jsx)(Xhe,{snapshot:e,onMermaidClick:M})}),I&&!L&&(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(L5,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.proposedTickets`)]}),open:S,onOpenChange:C,children:(0,X.jsx)(`section`,{children:(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:e.tickets.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(B5,{ticket:e})},e.key))})})}),L&&(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Vv,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.bundleGroups`)]}),open:w,onOpenChange:T,children:(0,X.jsx)($he,{snapshot:e})}),R&&(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(ww,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.dependencies`)]}),open:E,onOpenChange:D,children:(0,X.jsx)(`section`,{children:(0,X.jsx)(`ul`,{className:`space-y-1`,children:e.dependencies.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`break-all font-mono text-violet-400`,children:e.blocker_key}),(0,X.jsx)(`span`,{children:`→`}),(0,X.jsx)(`span`,{className:`break-all font-mono text-violet-400`,children:e.dependent_key})]},t))})})}),z&&(0,X.jsx)(z5,{heading:c(`specView.artifactPanel.openQuestions`),open:O,onOpenChange:k,children:(0,X.jsx)(`section`,{children:(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:e.open_questions.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex gap-2 text-sm text-amber-300`,children:[(0,X.jsx)(`span`,{className:`mt-0.5 shrink-0 text-amber-500`,children:`?`}),(0,X.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]},t))})})}),ee&&(0,X.jsx)(z5,{heading:c(`specView.artifactPanel.assumptions`),open:A,onOpenChange:j,children:(0,X.jsx)(`section`,{children:(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:e.assumptions.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex gap-2 text-sm text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`mt-0.5 shrink-0 text-violet-500`,children:`•`}),(0,X.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]},t))})})})]}),i&&(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border/50 bg-surface/95 px-4 py-3 backdrop-blur`,children:[e.tickets.length>0&&(0,X.jsx)(Qhe,{actions:i}),(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:i.onImplementInChat,disabled:!!(i.unavailableReason||i.implementInChatUnavailableReason)||i.isCreatingTickets||i.isImplementingInChat||i.isExporting,title:i.unavailableReason??i.implementInChatUnavailableReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(AE,{className:`h-3.5 w-3.5`}),i.isImplementingInChat?c(`specView.actions.startingImplementation`):c(`specView.actions.implementInChat`)]}),(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:i.onExport,disabled:!!i.unavailableReason||i.isCreatingTickets||i.isImplementingInChat||i.isExporting,title:i.unavailableReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(Qy,{className:`h-3.5 w-3.5`}),i.isExporting?c(`specView.actions.exportingSpec`):c(`specView.actions.exportSpec`)]})]}),l&&(0,X.jsx)(iG,{mermaid:l,open:!0,onClose:()=>{u(null)}}),e.mockup&&(0,X.jsx)(cG,{html:e.mockup,open:d,onClose:()=>{f(!1)}})]})})),H5=({className:e})=>(0,X.jsx)(Jee,{"aria-hidden":`true`,className:e}),U5=(e,t)=>{if(!e||e.length===0)return!1;let n=e[e.length-1];return n?.kind===`grill-question`?t===null||n.created_at>t:!1},W5=(e,t)=>jb.t(`specView.${e}`,t),G5=e=>W5(`pendingMemorySuggestions`,{count:e}),K5=1500,q5=`archon.spec-draft`,J5=`archon.spec-run-config`,Y5=`archon.spec-review-run-config`,X5=`archon.spec-session-list-layout`,Z5=`archon.spec-artifact-panel-layout`,oge=`archon.spec-import-notice`,Q5=420,$5=320,e7=.5,sge=6,t7=`/`,cge=`Slash`,lge=`NumpadDivide`,uge=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===t7||e.code===cge||e.code===lge),n7=({modifierLabel:e,keys:t,ariaHidden:n=!1})=>(0,X.jsxs)(`span`,{"aria-hidden":n,className:`flex items-center gap-0.5 text-[10px] leading-none`,children:[(0,X.jsx)(WY,{"aria-hidden":n,children:e}),t.map(e=>(0,X.jsxs)(`span`,{className:`contents`,children:[(0,X.jsx)(`span`,{children:`+`}),(0,X.jsx)(WY,{"aria-hidden":n,children:e})]},e))]}),dge=({label:e,modifierLabel:t,keys:n})=>(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(n7,{modifierLabel:t,keys:n,ariaHidden:!0})]}),r7=({projectId:e,tool:t,sessionId:n=null})=>e?n?`${q5}/${e}/sessions/${n}`:`${q5}/${e}/draft/${t}`:null,i7=({projectId:e,sessionId:t})=>e&&t?`${oge}/${e}/${t}`:null,a7=({projectId:e,tool:t})=>{if(e)try{localStorage.setItem(`${q5}/${e}/tool`,t)}catch{}},o7=e=>{if(!e)return{isOpen:!0};try{let t=localStorage.getItem(`${X5}/${e}`);return{isOpen:(t?JSON.parse(t):null)?.isOpen??!0}}catch{return{isOpen:!0}}},fge=({projectId:e,isOpen:t})=>{if(e)try{localStorage.setItem(`${X5}/${e}`,JSON.stringify({isOpen:t}))}catch{}},s7=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):Q5;if(!Number.isFinite(t))return Math.max($5,n);let r=Math.max($5,Math.round(t*e7));return Math.max($5,Math.min(r,n))},c7=e=>{if(!e)return{isOpen:!1,width:Q5};try{let t=localStorage.getItem(`${Z5}/${e}`);if(!t)return{isOpen:!1,width:Q5};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max($5,Math.round(n.width)):Q5;return{isOpen:n.isOpen===!0,width:r}}catch{return{isOpen:!1,width:Q5}}},pge=({projectId:e,isOpen:t,width:n})=>{if(e)try{localStorage.setItem(`${Z5}/${e}`,JSON.stringify({isOpen:t,width:n}))}catch{}},mge=e=>{if(!e)return null;try{return localStorage.getItem(e)}catch{return null}},l7=({storageKey:e,value:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,t)}catch{}},hge=e=>{if(!e)return null;try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},u7=({storageKey:e,notice:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify(t))}catch{}},gge=e=>{if(!e)return null;let t=e.skipped.reduce((e,t)=>e+t.count,0),n=e.skipped.map(e=>W5(`importNotice.skipReasons.${e.code}`,{count:e.count})).join(`, `);return e.imported_count>0&&t>0?W5(`importNotice.importedWithSkips`,{importedCount:e.imported_count,skippedCount:t,skippedSummary:n}):e.imported_count>0?W5(`importNotice.importedOnly`,{importedCount:e.imported_count}):t>0?W5(`importNotice.skippedOnly`,{skippedCount:t,skippedSummary:n}):null},d7=({keyPrefix:e,projectId:t,tool:n})=>`${e}:${t}:${n}`,_ge=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t):[],f7=({keyPrefix:e,projectId:t,tool:n})=>{if(!t||n!==`opencode`&&n!==`claude`)return null;try{let r=window.localStorage.getItem(d7({keyPrefix:e,projectId:t,tool:n}));if(!r)return null;let i=JSON.parse(r),a=(typeof i.model==`string`?i.model.trim():``)||null;return a?{model:a,variant:a&&typeof i.variant==`string`&&i.variant.trim()||null,skills:_ge(i.skills)}:null}catch{return null}},p7=({keyPrefix:e,projectId:t,tool:n,model:r,variant:i,skills:a})=>{if(!(!t||n!==`opencode`&&n!==`claude`||!r))try{let o={model:r,variant:r?i:null,...a?{skills:a}:{}};window.localStorage.setItem(d7({keyPrefix:e,projectId:t,tool:n}),JSON.stringify(o))}catch{}},m7=({projectId:e,tool:t})=>f7({keyPrefix:J5,projectId:e,tool:t}),h7=({projectId:e,tool:t,model:n,variant:r,skills:i})=>p7({keyPrefix:J5,projectId:e,tool:t,model:n,variant:r,skills:i}),vge=({projectId:e,tool:t})=>{let n=m7({projectId:e,tool:t});!n||n.skills.length===0||h7({projectId:e,tool:t,...n,skills:[]})},yge=({projectId:e,tool:t})=>f7({keyPrefix:Y5,projectId:e,tool:t}),bge=({projectId:e,tool:t,model:n,variant:r})=>p7({keyPrefix:Y5,projectId:e,tool:t,model:n,variant:r}),xge=({projectId:e,tool:t})=>{if(e)try{window.localStorage.removeItem(d7({keyPrefix:Y5,projectId:e,tool:t}))}catch{}},Sge=`archon.spec-draft-grill`,g7=e=>e?`${Sge}/${e}`:null,_7=e=>{let t=g7(e);if(!t)return!1;try{return window.localStorage.getItem(t)===`true`}catch{return!1}},v7=({projectId:e,grillOn:t})=>{let n=g7(e);if(n)try{t?window.localStorage.setItem(n,`true`):window.localStorage.removeItem(n)}catch{}},Cge=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c=async()=>!1,onSelectRepoRootTarget:l=async()=>!1,onRestoreSessionTarget:u,activeTool:d,routedSpecSessionId:f,routedSpecSnapshotId:m,initialIssueDraft:h=null,onRoutedSpecNavigationUnavailable:g,onSessionNavigation:_,onInitialIssueDraftConsumed:v,onImplementInChat:y,onNavigateToLifecycleSource:b})=>{let x=lq(),{t:S}=K(`common`),{jiraImportState:C,prepareSpecImportFromJira:w}=Mw(e),{gitHubImportState:T,prepareSpecImportFromGitHub:E}=ew(e),[D,O]=(0,p.useState)([]),[k,A]=(0,p.useState)(null),[j,M]=(0,p.useState)(null),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(null),[z,ee]=(0,p.useState)({}),[B,V]=(0,p.useState)({}),[te,H]=(0,p.useState)(null),[U,ne]=(0,p.useState)({}),[re,ie]=(0,p.useState)({}),[ae,oe]=(0,p.useState)([]),[W,se]=(0,p.useState)(``),[ce,le]=(0,p.useState)(``),[ue,de]=(0,p.useState)([]),[fe,pe]=(0,p.useState)(!1),[me,he]=(0,p.useState)(!1),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(!1),[be,xe]=(0,p.useState)(!1),[Se,Ce]=(0,p.useState)(null),[we,Te]=(0,p.useState)(null),[Ee,De]=(0,p.useState)([]),[Oe,ke]=(0,p.useState)(()=>new Set),[Ae,je]=(0,p.useState)(!1),[Me,Ne]=(0,p.useState)(()=>new Set),[Pe,Fe]=(0,p.useState)(!1),[Ie,Le]=(0,p.useState)(()=>o7(e).isOpen),[Re,ze]=(0,p.useState)(0),[G,Be]=(0,p.useState)(null),[Ve,He]=(0,p.useState)(()=>new Set),[Ue,We]=(0,p.useState)(null),[Ge,q]=(0,p.useState)(null),[Je,J]=(0,p.useState)(!1),[Xe,Ze]=(0,p.useState)(()=>c7(e).isOpen),[Y,Qe]=(0,p.useState)(()=>c7(e).width),[$e,et]=(0,p.useState)(!1),[tt,nt]=(0,p.useState)(!1),[rt,it]=(0,p.useState)(!1),[at,ot]=(0,p.useState)(!1),[st,ct]=(0,p.useState)(!1),[lt,ut]=(0,p.useState)(null),[dt,ft]=(0,p.useState)(!1),[pt,mt]=(0,p.useState)(null),[ht,gt]=(0,p.useState)(()=>_7(e)),[_t,vt]=(0,p.useState)(!1),[yt,bt]=(0,p.useState)([]),[xt,St]=(0,p.useState)(!1),[Ct,wt]=(0,p.useState)(!1),[Tt,Et]=(0,p.useState)(0),[Dt,Ot]=(0,p.useState)(null),[kt,At]=(0,p.useState)(!1),[jt,Mt]=(0,p.useState)(!1),[Nt,Pt]=(0,p.useState)(!1),[Ft,It]=(0,p.useState)(!1),[Lt,Rt]=(0,p.useState)(``),[zt,Bt]=(0,p.useState)(``),[Vt,Ht]=(0,p.useState)(!1),Ut=(0,p.useRef)(null),Wt=(0,p.useRef)(null),Gt=(0,p.useRef)(null),Kt=(0,p.useRef)(null),qt=(0,p.useRef)(null),Jt=(0,p.useRef)(null),Yt=(0,p.useRef)(!1),Xt=(0,p.useRef)(!1),Zt=(0,p.useRef)(0),Qt=(0,p.useRef)(Q5),$t=(0,p.useRef)(Q5),en=(0,p.useRef)(null),tn=(0,p.useRef)(null),nn=(0,p.useRef)(e),rn=(0,p.useRef)(new Set),an=(0,p.useRef)(0),on=(0,p.useRef)(0),sn=(0,p.useRef)(f),cn=(0,p.useRef)(!1),ln=(0,p.useRef)(!1),un=(0,p.useRef)(!1),dn=(0,p.useRef)({}),fn=(0,p.useRef)({}),pn=(0,p.useRef)({}),mn=(0,p.useRef)(new Set),hn=(0,p.useRef)(new Set),gn=(0,p.useRef)(0),_n=(0,p.useRef)({id:null,status:null}),vn=(0,p.useRef)(new Map),yn=(0,p.useRef)(!1),bn=(0,p.useRef)(!1),xn=(0,p.useRef)(()=>{}),Sn=m===void 0?Ge:m;nn.current=e,sn.current=f,tn.current=j;let Cn=e?r7({projectId:e,tool:F?d:j?.tool??d,sessionId:j?.id??null}):null,wn=i7({projectId:e,sessionId:j?.id??null}),Tn=Cn?z[Cn]??``:``,En=j?B[wn??``]??null:te,Dn=F?d:j?.tool??d,On=(0,p.useMemo)(()=>j?U[j.id]??[]:[],[j,U]),kn=(0,p.useMemo)(()=>j?re[j.id]??0:0,[j,re])>0,{models:An,isLoading:jn}=ZP(Dn),Mn=(0,p.useCallback)(()=>{de(e=>e.length===0?e:[]),vge({projectId:e,tool:d})},[e,d]);(0,p.useEffect)(()=>{cn.current=F},[F]),(0,p.useEffect)(()=>{dn.current=z},[z]),(0,p.useEffect)(()=>{fn.current=B},[B]),(0,p.useEffect)(()=>{pn.current=U},[U]),(0,p.useEffect)(()=>{if(!Cn||mn.current.has(Cn))return;mn.current.add(Cn);let e=mge(Cn);e&&ee(t=>Object.prototype.hasOwnProperty.call(t,Cn)?t:{...t,[Cn]:e})},[Cn]),(0,p.useEffect)(()=>{if(!wn||hn.current.has(wn))return;hn.current.add(wn);let e=hge(wn);e&&V(t=>({...t,[wn]:e}))},[wn]),(0,p.useEffect)(()=>{!Cn||!Object.prototype.hasOwnProperty.call(z,Cn)||l7({storageKey:Cn,value:z[Cn]??``})},[Cn,z]),(0,p.useEffect)(()=>{!wn||!Object.prototype.hasOwnProperty.call(B,wn)||u7({storageKey:wn,notice:B[wn]??null})},[wn,B]),(0,p.useEffect)(()=>{en.current=k},[k]),(0,p.useEffect)(()=>{let t=Sn??j?.latest_snapshot_id;if(!j?.id||!t||!e){We(null),ft(!1),Ze(!1);return}let n=new AbortController;return J(!0),XM(e,j.id,t,n.signal).then(e=>{if(!n.signal.aborted){if(Sn&&e.spec_session_id!==j.id){We(null),ft(!1),g?.();return}We(e),ft((e.created_ticket_ids?.length??0)>0),Ze(!0)}}).catch(e=>{n.signal.aborted||(We(null),ft(!1),Sn&&e instanceof Ke&&e.status===404?g?.():$.error(e instanceof Error?e.message:W5(`errors.loadSession`)))}).finally(()=>{n.signal.aborted||J(!1)}),()=>{n.abort()}},[j?.latest_snapshot_id,j?.id,e,Sn,g]);let Nn=Ue?.id??null,Pn=j?.id??null;(0,p.useEffect)(()=>{if(!e||!Pn||!Nn){Ot(null);return}let t=new AbortController;return At(!0),O5(e,Pn,Nn,t.signal).then(e=>{t.signal.aborted||Ot(e)}).catch(()=>{t.signal.aborted||Ot(null)}).finally(()=>{t.signal.aborted||At(!1)}),()=>{t.abort()}},[e,Pn,Nn]);let Fn=(0,p.useCallback)(()=>{!e||!Pn||!Nn||O5(e,Pn,Nn).then(Ot).catch(()=>{})},[e,Pn,Nn]);(0,p.useEffect)(()=>{pge({projectId:e,isOpen:Xe,width:Y})},[e,Xe,Y]),(0,p.useEffect)(()=>{if(!(f===void 0||!me)){if(!f){cn.current||Mn(),Ce(null),A(null),M(null),q(null),I(!0);return}if(!(D.some(e=>e.id===f)||j?.id===f)){$.error(W5(`errors.initialSessionMissing`)),ln.current=!0,A(null),M(null),I(!1),g?.();return}k!==f&&(Ce(null),A(f),M(null),I(!1),ln.current=!0)}},[j?.id,k,me,g,Mn,f,D]),(0,p.useEffect)(()=>{$e||($t.current=Y,Gt.current&&(Gt.current.style.setProperty(`--spec-artifact-panel-width`,`${Y}px`),Gt.current.setAttribute(`data-desktop-width`,String(Y))))},[Y,$e]);let In=(0,p.useCallback)(async t=>{if(!e){O([]),pe(!1);return}pe(!me);try{let n=await RM(e,t);if(t?.aborted)return;O(K8(n)),he(!0);let r=new Set(n.map(e=>e.id));He(e=>{let t=new Set([...e].filter(e=>r.has(e)));return t.size===e.size?e:t})}catch(e){Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.loadSessions`))}finally{t?.aborted||pe(!1)}},[e,me]);(0,p.useEffect)(()=>{let e=vn.current,t=new Map,n=[];for(let r of D){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&(a===`done`||a===`error`)&&r.id!==k&&n.push(r),t.set(r.id,a)}vn.current=t,He(e=>{let t=new Set(e),r=!1,i=new Set(D.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of D){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===k||i!==`done`&&i!==`error`)&&t.delete(e.id)){r=!0;continue}a&&!t.has(e.id)&&(t.add(e.id),r=!0)}return r?t:e})},[e,k,D]);let Ln=(0,p.useCallback)(async(t,n)=>{if(!e)return;_e(!0);let r=an.current+1;an.current=r;let i=on.current;try{let a=await BM(e,t,n);if(n?.aborted)return;let o=on.current!==i,s=an.current===r,c=en.current===t&&!cn.current;if(!s||o||!c)return;M(a)}catch(e){e instanceof Ke&&e.status===404&&sn.current===t&&en.current===t?g?.():Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.loadSession`))}finally{n?.aborted||_e(!1)}},[e,g]),Rn=(0,p.useCallback)(e=>{O(t=>{let n=t.findIndex(t=>t.id===e.id);if(n===-1)return K8([...t,j5(e)]);let r=t.slice();return r[n]=j5(e),K8(r)})},[]),zn=(0,p.useCallback)((e,t)=>{O(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n[r];if(i.pending_memory_suggestion_count===t)return n;let a=[...n];return a[r]={...i,pending_memory_suggestion_count:t},a}),M(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:{...n,pending_memory_suggestion_count:t})},[]),Bn=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){bt([]),St(!1);return}St(!0);try{let t=await jr(e,null,r,void 0,n);if(r?.aborted)return;bt(t.suggestions),zn(n,t.suggestions.length)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.loadMemorySuggestions`))}finally{r?.aborted||St(!1)}},[t?.memory_enabled,e,zn]),Vn=(0,p.useCallback)(e=>{bt(t=>{let n=t.filter(t=>t.id!==e);return k&&zn(k,n.length),n}),Et(e=>e+1),In(),k&&Ln(k)},[k,Ln,In,zn]),Hn=(0,p.useCallback)(e=>!!(e.first_user_message_preview||e.last_user_message_at||e.messages?.some(e=>e.role===`user`)),[]),Un=(0,p.useCallback)(()=>({tool:d,mode:ht?`grill`:`standard`,model:An.length>0&&W||null,variant:An.length>0&&ce||null,skills:ae.length>0?ue:[]}),[d,ht,An.length,W,ce,ae.length,ue]),Wn=(0,p.useCallback)(()=>{cn.current=!0,en.current=null,I(!0),Mn(),A(null),q(null),M(null),We(null),R(null),H(null),Ce(null),Be(null)},[Mn]),Gn=(0,p.useCallback)(()=>{ve||be||(Wn(),_?.(null))},[ve,be,_,Wn]),Kn=(0,p.useMemo)(()=>YY(),[]),qn=(0,p.useMemo)(()=>(0,X.jsx)(n7,{modifierLabel:Kn,keys:[t7],ariaHidden:!0}),[Kn]),Jn=(0,p.useMemo)(()=>(0,X.jsx)(dge,{label:W5(`sidebar.newSessionTooltip`),modifierLabel:Kn,keys:[t7]}),[Kn]);(0,p.useEffect)(()=>{let t=t=>{if(uge(t)){if(!e||ve||be)return;t.preventDefault(),Gn(),ze(e=>e+1);return}};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,ve,be,Gn]);let Yn=(0,p.useCallback)(e=>{be||(Ce(null),en.current=e.id,cn.current=!1,A(e.id),q(null),I(!1),R(null),H(null),gn.current+=1,_?.(e.id))},[be,_]),Xn=(0,p.useCallback)(async r=>{if(!e)return!1;ut(r.id);try{let i=await BM(e,r.id);return Rn(i),en.current===i.id&&M(i),i.target_available===!1?($.error(i.target_unavailable_reason??W5(`targets.unavailable`)),!1):!t||i5({activeProject:t,activeProjectBranchState:n,session:i})?!0:u?await u(i):!1}catch(e){return Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.restoreTarget`)),!1}finally{ut(e=>e===r.id?null:e)}},[t,n,e,u,Rn]),Zn=(0,p.useCallback)(async t=>{if(e){Ce(t);try{await qM(e,t)}catch(e){Ce(e=>e===t?null:e),Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.stopSession`))}}},[e]);(0,p.useEffect)(()=>{if(!Se)return;let e=j?.id===Se?j:D.find(e=>e.id===Se)??null;(!e||e.agent_status!==`running`)&&Ce(null)},[j,Se,D]);let Qn=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ue)){it(!0);try{if(!await Xn(j))return;let t=await $M(e,j.id,Ue.id);ft(!0),$.success(W5(`actions.createTicketsSuccess`,{count:t.tickets.length})),In()}catch(e){if(Ye(e))return;if(qe(e,`existing_ticket_ids`)){ft(!0);return}$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{it(!1)}}},[e,j,Ue,In,Xn]),$n=(0,p.useCallback)(()=>{Qn()},[Qn]),er=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ue)&&y){ot(!0);try{if(!await Xn(j))return;let t=await eN(e,j.id,Ue.id);y(t.draft_text,t.spec_session_id,t.spec_snapshot_id)}catch(e){if(Ye(e))return;e instanceof Ke&&e.status===409&&await Ln(j.id),$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{ot(!1)}}},[e,j,Ue,Ln,y,Xn]),tr=(0,p.useCallback)(async t=>{let n=t?.projectId??e,r=t?.sessionId??j?.id,i=t?.snapshotId??Ue?.id;if(!(!n||!r||!i)){ct(!0);try{if(!j||j.id!==r||!await Xn(j))return;await QM(n,r,i,{overwrite:t?.overwrite}),mt(null),$.success(W5(`actions.exportSuccess`))}catch(e){if(Ye(e))return;if(e instanceof ZM){mt({path:e.conflictingPath,projectId:n,sessionId:r,snapshotId:i});return}e instanceof Ke&&e.status===409&&j&&await Ln(j.id),$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{ct(!1)}}},[e,j,Ue,Ln,Xn]),nr=(0,p.useCallback)(()=>{Jt.current?.(),Jt.current=null},[]),rr=(0,p.useCallback)(e=>{if(!Ut.current)return;let t=Ut.current.getBoundingClientRect().width,n=s7(e,t);$t.current=n,Gt.current&&(Gt.current.style.setProperty(`--spec-artifact-panel-width`,`${n}px`),Gt.current.setAttribute(`data-desktop-width`,String(n)))},[]),ir=(0,p.useCallback)(e=>{let t=Kt.current,n=qt.current,r=Yt.current;if(t!==null){if(Kt.current=null,qt.current=null,Yt.current=!1,et(!1),nt(!1),nr(),e!==null&&typeof Wt.current?.hasPointerCapture==`function`&&Wt.current.hasPointerCapture(e)&&typeof Wt.current.releasePointerCapture==`function`&&Wt.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;Qe($t.current),Ze(!0);return}Qe($t.current)}},[nr]),ar=(0,p.useCallback)((e,t)=>{if(Kt.current!==e)return;let n=t-Zt.current,r=Qt.current-n;if(qt.current===`collapsed`){if(!Yt.current&&r<sge)return;Yt.current||(Yt.current=!0,Xt.current=!0,nt(!0),et(!0))}rr(r)},[rr]),or=(0,p.useCallback)((e,t)=>{if(Kt.current===e){if(t!==null&&(qt.current===`inline`||Yt.current)){let e=t-Zt.current;rr(Qt.current-e)}ir(e)}},[ir,rr]),sr=(0,p.useCallback)(e=>{e.preventDefault(),Kt.current=e.pointerId,qt.current=Xe?`inline`:`collapsed`,Yt.current=!1,Xt.current=!1,Zt.current=e.clientX,Qt.current=Xe?$t.current:0,et(Xe),nr(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{ar(e.pointerId,e.clientX)},n=e=>{or(e.pointerId,e.clientX)},r=e=>{or(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),Jt.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[or,ar,Xe,nr]),cr=(0,p.useCallback)(e=>{ar(e.pointerId,e.clientX)},[ar]),lr=(0,p.useCallback)(e=>{or(e.pointerId,e.clientX)},[or]),ur=(0,p.useCallback)(e=>{or(e.pointerId,e.clientX)},[or]),dr=(0,p.useCallback)(e=>{Kt.current===e.pointerId&&ir(e.pointerId)},[ir]),fr=(0,p.useCallback)(()=>{Ze(!1)},[]),pr=(0,p.useCallback)(async()=>{if(!e||Ee.length===0)return;let t=Ee;ke(e=>{let n=new Set(e);for(let e of t)n.add(e);return n});let n=[],r=[];for(let i of t)try{await YM(e,i),r.push(i)}catch(e){Ye(e)||n.push(e instanceof Error?e.message:W5(`errors.deleteSession`))}if(ke(e=>{let n=new Set(e);for(let e of t)n.delete(e);return n}),De([]),xn.current(r),n.length>0){$.error(n.join(`
|
|
276
|
-
`));return}Ae&&(je(!1),Ne(new Set),$.success(W5(`toasts.deleteSelectedSuccess`,{count:t.length})))},[e,Ee,Ae]),mr=(0,p.useCallback)((t,n={})=>{let r=new Set(t);if(r.size===0)return;let i=en.current,a=n.preserveDraftRoute===!0,o=!!(a&&i&&r.has(i)&&sn.current===i),s=!!(!a&&i&&r.has(i)),c=s?D.find(e=>!r.has(e.id))??null:null;o&&(Mn(),_?.(null)),s&&(c||Mn(),_?.(c?.id??null));for(let t of r)l7({storageKey:r7({projectId:e,tool:d,sessionId:t}),value:``}),u7({storageKey:i7({projectId:e,sessionId:t}),notice:null});ne(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e}),V(t=>{let n={...t},i=!1;for(let t of r){let r=i7({projectId:e,sessionId:t});r&&Object.prototype.hasOwnProperty.call(n,r)&&(delete n[r],i=!0)}return i?n:t}),O(e=>{let t=e.filter(e=>!r.has(e.id));if(i&&r.has(i)){if(sn.current===i)return a?(A(null),M(null),q(null),I(!0),t):(A(null),M(null),q(null),I(c===null),t);let e=t[0]??null;A(e?.id??null),M(null),q(null),I(e===null)}return t}),He(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),Be(e=>e&&r.has(e.parentId)?null:e),Ce(e=>e&&r.has(e)?null:e),De(e=>e.filter(e=>!r.has(e))),ke(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),Ne(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e})},[e,d,_,Mn,D]),hr=(0,p.useCallback)((e,t)=>{mr([e],t)},[mr]);xn.current=mr;let gr=(0,p.useCallback)((e,t)=>{e&&ee(n=>n[e]===t?n:{...n,[e]:t})},[]),_r=(0,p.useCallback)((e,t)=>{ne(n=>{if(t.length===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:t}})},[]),vr=(0,p.useCallback)(e=>{ne(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),ie(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),yr=(0,p.useCallback)((e,t)=>{e&&V(n=>(n[e]??null)===t?n:{...n,[e]:t})},[]),br=(0,p.useCallback)(e=>{e&&(V(t=>!Object.prototype.hasOwnProperty.call(t,e)||t[e]===null?t:{...t,[e]:null}),u7({storageKey:e,notice:null}))},[]),xr=(0,p.useCallback)(t=>{if(e){if(t.spec_session){let n=r7({projectId:e,tool:t.spec_session.tool,sessionId:t.spec_session.id}),r=i7({projectId:e,sessionId:t.spec_session.id});gr(n,t.prompt_text),yr(r,t.import_notice),_r(t.spec_session.id,t.imported_attachments),Rn(t.spec_session),M(t.spec_session),A(t.spec_session.id),I(!1),R(null),H(null),ze(e=>e+1);return}R(t.external_source),H(t.import_notice),Mn(),I(!0),A(null),M(null),q(null),We(null),gr(r7({projectId:e,tool:d}),t.prompt_text),ze(e=>e+1)}},[e,d,Mn,gr,yr,_r,Rn]),Sr=(0,p.useCallback)(async({provider:e,issueReference:t})=>{let n=$.loading(W5(`toasts.importPreparing`));try{let r=e===`jira`?await w?.({issueReference:t,...Un()}):await E?.({issueReference:t,...Un()});if(!r)throw Error(W5(`toasts.importError`));return(r.import_notice?.skipped.reduce((e,t)=>e+t.count,0)??0)>0?$.warning(W5(`toasts.importPartialSuccess`),{id:n}):$.success(W5(`toasts.importSuccess`),{id:n}),r}catch(e){if(Ye(e))$.dismiss(n);else{let t=e instanceof Error&&e.message?e.message:W5(`toasts.importError`);$.error(t,{id:n})}throw e}},[Un,E,w]),Cr=(0,p.useMemo)(()=>[{key:`jira`,label:S(`jiraImportField.label`),placeholder:S(`jiraImportField.placeholder`),state:C,onImport:e=>Sr({provider:`jira`,issueReference:e})},{key:`github`,label:S(`githubImportField.label`),placeholder:S(`githubImportField.placeholder`),state:T,onImport:e=>Sr({provider:`github`,issueReference:e})}],[S,C,T,Sr]),wr=Cr.some(e=>e.state===`enabled`);(0,p.useEffect)(()=>{h&&(Sr({provider:h.external_source.provider,issueReference:h.external_source.external_key}).then(xr).catch(()=>void 0),v?.())},[h,Sr,xr,v]);let Tr=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ue)){Mt(!0);try{await Phe(e,j.id,Ue.id,{tool:j.tool,...Vt?{model:Lt||null,variant:zt||null}:{},skills:j.skills}),Vt&&bge({projectId:e,tool:j.tool,model:Lt||null,variant:zt||null}),Fn()}catch(e){if(Ye(e))return;e instanceof Ke&&e.status===409&&await Ln(j.id),$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{Mt(!1)}}},[e,j,Ue,Vt,Lt,zt,Fn,Ln]),Er=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ue)){Pt(!0);try{await Fhe(e,j.id,Ue.id),Fn()}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{Pt(!1)}}},[e,j,Ue,Fn]),Dr=(0,p.useCallback)(async()=>{if(!e||!j||!Ue)return;let t=Dt?.run;if(t){It(!0);try{gr(Cn,(await Ihe(e,j.id,Ue.id,t.id)).draft_text),ze(e=>e+1)}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{It(!1)}}},[e,j,Ue,Dt,gr,Cn]),Or=(0,p.useCallback)(e=>{e&&(ee(t=>t[e]===``?t:{...t,[e]:``}),l7({storageKey:e,value:``}))},[]),kr=(0,p.useCallback)((e,t)=>{ie(n=>{let r=Math.max(0,(n[e]??0)+t);if(r===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:r}})},[]),Ar=(0,p.useCallback)(async t=>{if(!(!e||_t||bn.current)&&!(j&&j.agent_status===`running`)){if(!k||!j){gt(t),v7({projectId:e,grillOn:t});return}if(j.mode===(t?`grill`:`standard`)){gt(t);return}vt(!0);try{let n=await HM(e,j.id,{mode:t?`grill`:`standard`});M(n),Rn(n),gt(t),t||U5(n.messages,n.latest_snapshot_created_at)&&await UM(e,n.id,{instruction:W5(`grill.finalizePrompt`),tool:n.tool,model:An.length>0&&W||null,variant:An.length>0&&ce||null,skills:ae.length>0?ue:[]})}catch(e){Ye(e)||$.error(e instanceof Error?e.message:W5(`grill.updateModeError`))}finally{vt(!1)}}},[e,j,k,_t,Rn,An,W,ce,ae,ue]),Mr=(0,p.useCallback)(async()=>{if(!e||ve||be||yn.current||bn.current||t&&j&&!i5({activeProject:t,activeProjectBranchState:n,session:j}))return;let r=Tn.trim();if(!r&&On.length===0)return;xe(!0);let i=Cn,a=performance.now();gn.current+=1;let o=`spec:${gn.current}`;try{let t=k,n=!t,s=n;if(t&&!j){let r=await BM(e,t);r?s=r.messages?.length===0:(n=!0,s=!0,t=null)}else j&&(s=j.messages?.length===0);if(n){ye(!0);let n=await zM(e,{tool:d,mode:ht?`grill`:`standard`,model:An.length>0&&W||null,variant:An.length>0&&ce||null,skills:ae.length>0?ue:[],external_source:L??null});t=n.id,A(t),M(n),I(!1),_?.(t),R(null),gt(!1),v7({projectId:e,grillOn:!1}),a7({projectId:e,tool:d}),ye(!1)}if(!t)throw Error(`Unable to resolve the spec session.`);Ce(e=>e===t?null:e),Be({parentType:`spec`,parentId:t,turnKey:o,startedAt:a});let c=On.map(e=>e.id),l=await UM(e,t,{instruction:r,tool:j?.tool??d,model:W||null,variant:ce||null,skills:ue,attachment_ids:c.length>0?c:void 0});M(l),h7({projectId:e,tool:l.tool,model:l.model,variant:l.variant,skills:s?[]:l.skills}),ze(e=>e+1),vr(t),Or(i),br(i7({projectId:e,sessionId:t})),H(null)}catch(e){Be(e=>e?.turnKey===o?null:e);let t=qe(e,`spec_session`);t?(M(t),Rn(t)):e instanceof Ke&&e.status===409&&en.current&&await Ln(en.current),Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{xe(!1),ye(!1)}},[t,n,e,ve,be,Tn,On,Cn,k,j,d,ht,An,W,ce,ae,ue,L,Ln,Rn,vr,Or,br,_]),Nr=(0,p.useCallback)(async t=>{if(e){rn.current.add(t.id);try{await YM(e,t.id),hr(t.id,{preserveDraftRoute:!0}),Wn()}catch(e){throw rn.current.delete(t.id),e}}},[e,Wn,hr]),Pr=(0,p.useCallback)(async t=>{if(!e||Dn!==`opencode`&&Dn!==`claude`)return;let n=k,r=null;if(!n&&t.length>0)try{ye(!0);let t=await zM(e,{tool:d,mode:ht?`grill`:`standard`,model:An.length>0&&W||null,variant:An.length>0&&ce||null,skills:ae.length>0?ue:[],external_source:L??null});r=t,n=t.id,A(n),M(t),I(!1),_?.(n),a7({projectId:e,tool:d})}catch(e){Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.upload`));return}finally{ye(!1)}if(n){kr(n,t.length);try{let r=await GM(e,n,t),i=[...pn.current[n]??[],...r.attachments];_r(n,i)}catch(e){if(r&&!Tn.trim())try{await Nr(r)}catch{}Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.upload`))}finally{kr(n,-t.length)}}},[e,k,d,Dn,An,W,ce,ae,ue,ht,L,Tn,Nr,kr,_,_r]),Fr=(0,p.useCallback)(async t=>{if(!e||!j)return;let n=j,r=n.id,i=(pn.current[r]??[]).filter(e=>e.id!==t);try{await KM(e,r,t),_r(r,i),i.length===0&&!Tn.trim()&&(n.messages?.length??0)===0&&await Nr(n)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.removeAttachment`))}},[e,j,Nr,Tn,_r]);(0,p.useEffect)(()=>{G&&(G.parentId===k&&(be||we===k||j?.agent_status===`running`)||Be(null))},[j?.agent_status,k,be,G,we]),(0,p.useEffect)(()=>{if(!un.current){un.current=!0;return}let t=o7(e),n=c7(e);cn.current=!1,ln.current=!1,mn.current=new Set,hn.current=new Set,A(null),M(null),q(null),We(null),I(!1),R(null),ee({}),V({}),H(null),ne({}),ie({}),rn.current.clear(),Ce(null),De([]),ke(new Set),je(!1),Ne(new Set),Be(null),bt([]),St(!1),wt(!1),he(!1),He(new Set),vn.current=new Map,$t.current=n.width,Le(t.isOpen),Qe(n.width),Ze(n.isOpen),gt(_7(e)),vt(!1)},[e]);let Ir=(0,p.useCallback)((e,t)=>{Ne(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,p.useEffect)(()=>{let e=new AbortController;return In(e.signal),()=>{e.abort()}},[In]),(0,p.useEffect)(()=>{if(f!==void 0||cn.current||F||k||ln.current||D.length===0||t?.active_target_kind!==`bundle`&&n?.status===`loading`)return;let e=t?D.find(e=>i5({activeProject:t,activeProjectBranchState:n,session:e}))??null:D[0]??null;ln.current=!0,e&&A(e.id)},[t,n,k,F,f,D]),(0,p.useEffect)(()=>{if(Dn!==`opencode`&&Dn!==`claude`){oe([]),Fe(!1);return}if(Dn!==`opencode`){oe([]);return}let t=new AbortController;return(async()=>{Fe(!0);try{oe(await QP(Dn,t.signal,e))}catch(e){Ye(e)||oe(e=>e)}finally{t.signal.aborted||Fe(!1)}})(),()=>{t.abort()}},[e,Dn]),(0,p.useEffect)(()=>{if(Dn!==`opencode`&&Dn!==`claude`){se(``),le(``),de([]);return}if(F){let t=m7({projectId:e,tool:Dn}),n=new Set(An.map(e=>e.id)),r=t?.model??``,i=r&&(n.size===0||n.has(r)),a=An.find(e=>e.id===r)??null,o=t?.variant??``,s=!a||a.variants.includes(o),c=new Set(ae.map(e=>e.name));se(i?r:``),le(e=>!i||!s?``:o||e),de(Dn===`opencode`?(t?.skills??[]).filter(e=>c.has(e)):[]);return}se(j?.model??``),le(j?.variant??``),de(j?.skills??[])},[e,j?.id,j?.model,j?.skills,j?.variant,An,ae,Dn,F]),(0,p.useEffect)(()=>{if(F||!k){M(null);return}if(j?.id===k)return;M(null);let e=new AbortController;return Ln(k,e.signal),()=>{e.abort()}},[j,k,F,Ln]),(0,p.useEffect)(()=>{wt(!1)},[k,F]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||F||!k){bt([]),St(!1);return}let e=new AbortController;return Bn(k,e.signal),()=>{e.abort()}},[t?.memory_enabled,k,F,Bn,Tt]),(0,p.useEffect)(()=>{!Ct||xt||yt.length>0||wt(!1)},[xt,Ct,yt.length]),(0,p.useEffect)(()=>{let e=_n.current,n=j?.id??null,r=j?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&Et(e=>e+1),_n.current={id:n,status:r}},[t?.memory_enabled,j?.agent_status,j?.id]),(0,p.useEffect)(()=>{if(!k||j?.agent_status!==`running`)return;let e=new AbortController,t=null,n=async()=>{await Promise.allSettled([In(e.signal),Ln(k,e.signal)]),e.signal.aborted||(t=window.setTimeout(()=>{n()},K5))};return t=window.setTimeout(()=>{n()},K5),()=>{e.abort(),t!==null&&window.clearTimeout(t)}},[j?.agent_status,k,Ln,In]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{if(!(!t||t.project_id!==e)){if(!F&&t.id===en.current){let e=tn.current;(t.messages!==void 0||e?.id===t.id&&e.messages!==void 0)&&(on.current+=1),M(e=>Whe(e,t))}Hn(t)&&Rn(t)}},n=t=>{if(!t||t.project_id!==e)return;let n=rn.current.delete(t.id);hr(t.id,n?{preserveDraftRoute:!0}:void 0)},r=()=>{In();let e=en.current;e&&!cn.current&&Ln(e)};return x.on(`connect`,r),x.on(`spec-session:created`,t),x.on(`spec-session:updated`,t),x.on(`spec-session:deleted`,n),()=>{x.off(`connect`,r),x.off(`spec-session:created`,t),x.off(`spec-session:updated`,t),x.off(`spec-session:deleted`,n)}},[e,F,Ln,In,Hn,Rn,hr,x]),(0,p.useEffect)(()=>{if(!e||!Nn)return;let t=e=>{!e||e.spec_snapshot_id!==Nn||Fn()};return x.on(`spec-review:updated`,t),()=>{x.off(`spec-review:updated`,t)}},[e,Nn,Fn,x]);let Lr=(0,p.useMemo)(()=>q8(D),[D]),Rr=(0,p.useMemo)(()=>{let e=new Set(Lr.find(e=>e.key===`older`)?.sessions.map(e=>e.id)??[]);return[{key:`unavailable`,label:W5(`sidebar.presets.unavailable`),matches:e=>e.target_available===!1},{key:`older`,label:W5(`sidebar.presets.older`),matches:t=>e.has(t.id)}]},[Lr]),zr=(0,p.useCallback)(e=>{e.key!==`Enter`||e.shiftKey||j?.agent_status===`running`||ve||be||kn||yn.current||bn.current||(e.preventDefault(),Mr())},[Mr,j?.agent_status,ve,be,kn]),Br=(0,p.useCallback)(t=>{if(!e||Dn!==`opencode`&&Dn!==`claude`)return;let n=Array.from(t.clipboardData.files).filter(e=>e.type.startsWith(`image/`));n.length!==0&&(t.preventDefault(),Pr(n))},[e,Dn,Pr]),Vr=(0,p.useMemo)(()=>X8(An),[An]),Hr=(0,p.useMemo)(()=>j?Q8({modelLabel:Z8({availableModelsById:Vr,model:j.model}),tool:j.tool}):null,[j,Vr]),Ur=(0,p.useMemo)(()=>j?.messages?j.messages.map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,attachments:e.attachments??[],responseTiming:e.response_timing?GK(e.response_timing):null,transcript_runs:e.transcript_runs??null,metadata:e.metadata,created_at:e.created_at,displayTitle:e.role===`assistant`?Hr??Y8(j.tool):$8()})):[],[j?.messages,j?.tool,Hr]),Wr=k!==null||F,Gr=F?null:j,Kr=Gr?.target_available===!1,qr=!!(t&&Gr&&!Kr&&!i5({activeProject:t,activeProjectBranchState:n,session:Gr})),Jr=qr&&Gr?W5(`targets.mismatchReason`,{sessionTarget:o5(Gr),currentTarget:s5({activeProject:t,activeProjectBranchState:n})}):null,Yr=Kr?Gr?.target_unavailable_reason??W5(`targets.unavailable`):null,Xr=Kr||qr,Zr=Gr?.streaming_response??null,Qr=Gr?.agent_status===`running`,$r=!!(be&&G?.parentType===`spec`&&G.parentId===k),ei=Qr||$r,ti=ei?Hr:null,ni=Qr&&Se===k,ri=Gr?.agent_status===`stopped`&&Gr.can_resume,ii=ri&&we===k,ai=!!e&&!ve&&(F||k!==null&&!Xr),oi=!!(t?.memory_enabled&&j&&!F&&(j.pending_memory_suggestion_count>0||xt)),si=(Dn===`opencode`||Dn===`claude`)&&(F||k!==null)&&Gr?.agent_status!==`running`,ci=(0,p.useCallback)(async()=>{if(!e||!j||j.agent_status!==`stopped`||!j.can_resume||we===j.id)return;let t=j.id,n=e,r=on.current,i=performance.now();Te(t);let a=JM(e,t,W5(`errors.resumeSession`));gn.current+=1;let o={parentType:`spec`,parentId:t,turnKey:`spec:${gn.current}`,startedAt:i};Be(o);try{let e=await a;nn.current===n&&on.current===r&&(Rn(e),en.current===t&&!cn.current&&(on.current+=1,M(e)))}catch(e){Be(e=>e?.turnKey===o.turnKey?null:e);let i=qe(e,`spec_session`);i&&nn.current===n&&on.current===r?(Rn(i),en.current===t&&!cn.current&&(on.current+=1,M(i))):!i&&e instanceof Ke&&e.status===409&&nn.current===n&&en.current===t&&!cn.current&&await Ln(t),Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.resumeSession`))}finally{Te(e=>e===t?null:e)}},[e,j,Ln,we,Rn]),li=(0,p.useMemo)(()=>{if(!j?.messages)return null;for(let e=j.messages.length-1;e>=0;--e){let t=j.messages[e];if(t.kind===`grill-question`)return t.id}return null},[j]),ui=(0,p.useMemo)(()=>!j||j.mode!==`grill`?!1:U5(j.messages,j.latest_snapshot_created_at),[j]),di=(0,p.useMemo)(()=>[...j?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[j]),fi=!!di,pi=ii||be||ve||kn||fi||ui||Xr||lt===k,mi=(0,p.useCallback)(async t=>{if(!e||!k||!j)return;xe(!0),gn.current+=1;let n={parentType:`spec`,parentId:k,turnKey:`spec:${gn.current}`,startedAt:performance.now()};Be(n);try{M(await UM(e,k,{instruction:t,tool:j.tool,model:An.length>0&&W||null,variant:An.length>0&&ce||null,skills:ae.length>0?ue:[]})),ze(e=>e+1)}catch(e){Be(e=>e?.turnKey===n.turnKey?null:e),Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{xe(!1)}},[e,k,j,An,W,ce,ae,ue]),hi=(0,p.useCallback)(async(t,n)=>{if(!e||!j||N)return;let r=WJ({parentType:`spec`,parentId:j.id,setId:n.set_id});P(n.set_id),xe(!0),gn.current+=1;let i={parentType:`spec`,parentId:j.id,turnKey:`spec:${gn.current}`,startedAt:performance.now()};Be(i);try{let r=await WM(e,j.id,t,n);M(r),Rn(r)}catch(e){if(e instanceof Ke&&e.status===409){KJ(r);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?(M(t),Rn(t)):await Ln(j.id)}throw Be(e=>e?.turnKey===i.turnKey?null:e),$.error(e instanceof Error?e.message:W5(`errors.resolveQuestions`)),e}finally{P(null),xe(!1)}},[e,j,Ln,N,Rn]),gi=(0,p.useCallback)(e=>{if(e.role!==`assistant`)return;let t=e.metadata,n=t?.ask_question;if(n&&j)return(0,X.jsx)($J,{messageContent:e.content,questionSet:n,storageKey:WJ({parentType:`spec`,parentId:j.id,setId:n.id}),isActive:n.status===`pending`&&di?.id===e.id,isDisabled:Xr||j.agent_status===`running`||N===n.id,onResolve:t=>hi(e.id,t)});if(e.kind!==`grill-question`)return;let r=t?.grill_question;if(r)return(0,X.jsx)(k5,{question:r,isActive:ei?!1:e.id===li&&j?.agent_status!==`running`&&j?.mode===`grill`,isDisabled:Xr||be||ve||_t,labels:{rationaleLabel:W5(`grill.rationaleLabel`),suggestionsLabel:W5(`grill.suggestionsLabel`),recommendedSuggestionLabel:W5(`grill.recommendedSuggestionLabel`),answerPlaceholder:W5(`grill.answerPlaceholder`),submitLabel:W5(`grill.submitLabel`),submittingLabel:W5(`grill.submittingLabel`)},onSubmitAnswer:e=>{mi(e)}})},[j,ei,be,ve,Xr,_t,li,di?.id,hi,N,mi]),_i=(Dn===`opencode`||Dn===`claude`)&&An.length>0,vi=Dn,yi=F?W5(`composer.newSpecTitle`):j?.title??W5(`composer.specTitle`),bi=_i?W||null:j?.model??null,xi=Z8({availableModelsById:Vr,model:bi}),Si=j?.agent_status===`stopped`,Ci=W5(`composer.placeholderSpec`),wi=D.some(e=>e.agent_status!==`running`),Ti=(0,p.useMemo)(()=>({ariaLabel:W5(`sidebar.ariaLabel`),newSession:W5(`sidebar.newSession`),collapseAriaLabel:W5(`sidebar.collapseAriaLabel`),openAriaLabel:W5(`sidebar.openAriaLabel`),cancelSelection:W5(`sidebar.cancelSelection`),addPreset:W5(`sidebar.addPreset`),deleteSelected:W5(`sidebar.deleteSelected`),selectedCount:e=>`${e} selected`,select:W5(`sidebar.select`),loadingSessions:W5(`sidebar.loadingSessions`),noSessions:W5(`sidebar.noSessions`),deleteSessionAriaLabel:W5(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>W5(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>W5(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>W5(`sidebar.deleteSessionTitle`,{title:e})}),[]),Ei=(0,p.useMemo)(()=>({title:W5(`deleteModal.title`),bulkTitle:W5(`deleteModal.bulkTitle`),description:W5(`deleteModal.description`),bulkDescription:e=>W5(`deleteModal.bulkDescription`,{count:e}),cancel:W5(`deleteModal.cancel`),delete:W5(`deleteModal.delete`),deleting:W5(`deleteModal.deleting`)}),[]),Di=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:!t&&Ve.has(e.id)?`finished`:null,[Ve]),Oi=(0,p.useCallback)(e=>e.agent_status===`running`?W5(`sidebar.cannotDeleteRunning`):null,[]),ki=!!(t?.memory_enabled&&k&&!F),Ai=(0,p.useCallback)(e=>{let r=a5({session:e,activeProject:t,activeProjectBranchState:n}),i=ki&&e.pending_memory_suggestion_count>0?G5(e.pending_memory_suggestion_count):null,a=(e.linked_ticket_count??0)+(e.linked_chat_count??0);return a>0?[e.title,r,i,W5(`sidebar.linkedImplementationsAriaLabel`,{itemCount:a})].filter(Boolean).join(` `):e.has_completed_work===1?[e.title,r,i,W5(`sidebar.linkedImplementationsAriaLabelHistorical`)].filter(Boolean).join(` `):[e.title,r,i].filter(Boolean).join(` `)},[t,n,ki]),ji=e=>{let t=e.first_user_message_preview??e.messages?.find(e=>e.role===`user`)?.content;return t&&t.replace(/\s+/g,` `).trim()||null},Mi=(0,p.useCallback)(({session:e,activityState:r})=>{let i=ji(e),a=a5({session:e,activeProject:t,activeProjectBranchState:n}),o=e.linked_ticket_count??0,s=e.linked_chat_count??0,c=o+s,l=e.has_completed_work===1||c>0,u=c>0,d=u?W5(`sidebar.linkedImplementationsTooltip`,{ticketCount:o,chatCount:s}):W5(`sidebar.linkedImplementationsTooltipHistorical`),f=ki&&e.pending_memory_suggestion_count>0;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,X.jsx)(`div`,{className:`mb-1 truncate text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground/75`,children:a}):null,(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 truncate text-[13px] font-medium leading-5`,children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.title}),f?(0,X.jsx)(Ww,{tone:`muted`,className:`shrink-0`,"aria-label":G5(e.pending_memory_suggestion_count),title:G5(e.pending_memory_suggestion_count),children:e.pending_memory_suggestion_count}):null,l&&(0,X.jsx)(lv,{content:d,children:(0,X.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 text-[11px] text-indigo-500 dark:text-indigo-400`,children:[(0,X.jsx)(wF,{className:`size-3`}),u&&(0,X.jsx)(`span`,{children:c})]})})]}),i?(0,X.jsx)(`div`,{className:`mt-0.5 line-clamp-1 text-xs leading-4 text-muted-foreground`,children:i}):null,e.target_available===!1?(0,X.jsx)(`div`,{className:`mt-1 line-clamp-1 text-[11px] leading-4 text-amber-200/90`,children:e.target_unavailable_reason??W5(`targets.unavailable`)}):null]}),(0,X.jsx)(Hy,{state:r,className:`mt-1`})]})},[t,n,ki]),Ni=Qr?(0,X.jsx)(j8,{action:`interrupt`,isPending:ni,onAction:()=>{k&&Zn(k)},label:W5(`composer.interrupt`),pendingLabel:W5(`composer.interrupting`)}):ri?(0,X.jsx)(j8,{action:`resume`,isPending:ii,disabled:pi,onAction:()=>{ci()},label:W5(`composer.resume`),pendingLabel:W5(`composer.resuming`)}):null,Pi=(0,p.useMemo)(()=>An.find(e=>e.id===W)??null,[An,W]),Fi=({model:t=W,variant:n=ce,skills:r=ue}={})=>{F&&h7({projectId:e,tool:d,model:t||null,variant:t&&n||null,skills:d===`opencode`?r:[]})},Ii=Dn===`opencode`||Dn===`claude`?Pe||jn?(0,X.jsx)(_Y,{}):An.length>0?(0,X.jsx)(vY,{model:W,variant:ce,skills:ue,showModelSelector:!0,showSkillsSelector:ae.length>0,availableModels:An,availableSkills:ae,selectedModel:Pi,onModelChange:e=>{let t=An.find(t=>t.id===e)??null,n=t&&t.variants.includes(ce)?ce:``;se(e),le(n),Fi({model:e,variant:n})},onVariantChange:e=>{le(e),Fi({variant:e})},onSkillsChange:e=>{de(e),Fi({skills:e})},modelSelectId:`spec-model-select`,variantSelectId:`spec-variant-select`,skillsSelectId:`spec-skills-select`}):null:null,Li=(0,p.useMemo)(()=>Ee.length===1?D.find(e=>e.id===Ee[0])?.title??``:``,[Ee,D]),Ri=(0,p.useMemo)(()=>D.filter(e=>Ee.includes(e.id)),[D,Ee]),zi=Wr&&j!==null,Bi=zi&&!Xe&&!tt,Vi=zi&&(Xe||tt);(0,p.useEffect)(()=>{if(!Vi||$e||!Ut.current)return;let e=Ut.current,t=()=>{let t=e.getBoundingClientRect().width;if(t<=0)return;let n=s7(Y,t);$t.current=n,Gt.current&&(Gt.current.style.setProperty(`--spec-artifact-panel-width`,`${n}px`),Gt.current.setAttribute(`data-desktop-width`,String(n))),Qe(e=>e===n?e:n)};if(t(),typeof ResizeObserver!=`function`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[Y,Vi,$e]);let Hi=j?.tool??d,Ui=Hi===`opencode`&&An.length>0,Wi=(0,p.useMemo)(()=>An.find(e=>e.id===Lt)??null,[An,Lt]),Gi=(0,p.useCallback)(t=>{let n=An.find(e=>e.id===t)??null;Rt(t),Ht(!!t),t||xge({projectId:e,tool:Hi}),Bt(e=>n&&n.variants.includes(e)?e:``)},[e,An,Hi]),Ki=(0,p.useCallback)(e=>{Bt(e),Ht(!!Lt)},[Lt]),qi=(0,p.useMemo)(()=>Ue&&zi?{review:Dt,isRunning:jt||Nt,isLoading:kt,availableModels:An,showModelSelector:Ui,runConfigTool:Hi,runConfigModel:Lt,runConfigVariant:zt,selectedDiscoveredModel:Wi,onRunConfigModelChange:Gi,onRunConfigVariantChange:Ki,onLaunchReview:Tr,onStopReview:Er,onSendToPlanner:Dr,isSendingToPlanner:Ft,disabledReason:Yr??Jr}:void 0,[Jr,Ue,An,zi,Tr,Dr,Gi,Ki,Er,kt,Ft,jt,Nt,Dt,Lt,zt,Wi,Ui,Hi,Yr]),Ji=(0,p.useMemo)(()=>{if(Ue)return{onCreateTickets:$n,onImplementInChat:er,onExport:tr,isCreatingTickets:rt,isImplementingInChat:at,isExporting:st,hasExistingTicketsFromSnapshot:dt,unavailableReason:Yr,implementInChatUnavailableReason:Ue.bundle_groups.length>1?W5(`actions.implementInChatMultiBundleUnavailable`):null}},[Ue,$n,tr,er,dt,rt,st,at,Yr]);(0,p.useEffect)(()=>{if(Hi!==`opencode`){Rt(``),Bt(``),Ht(!1);return}let t=yge({projectId:e,tool:Hi}),n=t?.model??``;Rt(n),Bt(n?t?.variant??``:``),Ht(!!n)},[e,Hi]),(0,p.useEffect)(()=>{zi||(Kt.current=null,qt.current=null,Yt.current=!1,Xt.current=!1,et(!1),nt(!1),nr())},[zi,nr]),(0,p.useEffect)(()=>()=>{nr()},[nr]);let Yi=(0,X.jsx)(lv,{content:W5(`artifactPanel.open`),disabled:!Bi,side:`left`,children:(0,X.jsx)(`div`,{ref:Wt,className:Z(Bi?`group flex shrink-0 touch-none select-none items-center justify-center border-l border-border/70 bg-background/90 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground xl:w-7 xl:cursor-col-resize`:`group hidden w-5 shrink-0 cursor-col-resize touch-none select-none items-center justify-center border-l border-border/70 bg-background/80 transition-colors xl:flex`,$e&&!Bi&&`bg-background`),role:Bi?`button`:`separator`,tabIndex:Bi?0:void 0,"aria-label":W5(Bi?`artifactPanel.open`:`artifactPanel.resize`),"aria-valuemin":Bi?void 0:$5,"aria-valuemax":Bi?void 0:Ut.current?Math.round(Ut.current.clientWidth*e7):800,"aria-valuenow":Bi?void 0:Y,onClick:Bi?()=>{if(Xt.current){Xt.current=!1;return}Ze(!0)}:void 0,onPointerDown:sr,onPointerMove:cr,onPointerUp:lr,onPointerCancel:ur,onLostPointerCapture:dr,children:Bi?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`hidden h-full w-full items-center justify-center xl:flex`,children:(0,X.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-[2.65rem] items-center justify-center text-sky-400/80 transition-colors group-hover:text-sky-300`,children:(0,X.jsx)(H5,{className:`h-3 w-3 shrink-0`})}),(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 h-14 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-muted-foreground/70 transition-colors group-hover:bg-sky-300/90`})]})}),(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium xl:hidden`,children:[(0,X.jsx)(H5,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:W5(`artifactPanel.title`)})]})]}):(0,X.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,$e?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})})}),Xi=F&&wr?(0,X.jsx)(AY,{providers:Cr,onImported:xr,inputId:`spec-draft-external-import`,className:`max-w-md`,showImportSpinner:!0,showImportErrorToast:!1}):null,Zi=j?j.mode===`grill`:ht,Qi=ui;yn.current=Qi,bn.current=fi;let $i=(0,X.jsx)(A5,{on:Zi,disabled:_t||Qr||ve||be||fi||Xr,tooltipContent:W5(`grill.toggleTooltip`),ariaLabelOn:W5(`grill.toggleAriaLabelOn`),ariaLabelOff:W5(`grill.toggleAriaLabelOff`),onToggle:e=>{Ar(e)}}),ea=gge(En),ta=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[ea?(0,X.jsxs)(`div`,{className:`rounded-md border border-sky-500/30 bg-sky-500/10 px-3 py-2 text-sm text-sky-950 dark:text-sky-100`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:W5(`importNotice.title`)}),(0,X.jsx)(`div`,{children:ea})]}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[$i,Xi,Ni,F&&t&&(0,X.jsx)(Fy,{activeProject:t,branchState:n,bundles:r,branchSuggestions:i,isBundleLoading:a,isLoading:o,presentation:`composer`,closeAfterSelection:!0,triggerAriaLabel:jb.t(`common:projectTargetSelector.newSpecAriaLabel`),onOpenChange:s,onSelectBundle:c,onSelectRepoRoot:l})]})]}),na=Ii,ra=(0,p.useCallback)(t=>{j?br(i7({projectId:e,sessionId:j.id})):H(null),gr(Cn,t)},[j,e,Cn,gr,br]),ia=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(Uhe,{projectId:e,specSessionId:F?null:k,messages:Ur,internalLog:Gr?.agent_log??null,currentThinkingMessageId:Gr?.agent_message_id??null,previousThinkingLog:Gr?.previous_agent_log??null,previousThinkingMessageId:Gr?.previous_agent_message_id??null,pendingAgentTitle:ti,streamingResponse:Zr,isRunning:ei,isLoading:!F&&ge,canShowComposer:ai,isExternallyResizing:$e,layoutKey:j?.id??`spec-draft`,scrollLayoutKey:zi?Vi?`artifact-visible`:`artifact-hidden`:`artifact-disabled`,header:(0,X.jsx)(H8,{title:yi,tool:F?null:j?.tool??null,modelLabel:xi,interrupted:Si,interruptedLabel:W5(`sidebar.interrupted`),usage:{totalTokens:j?.usage_snapshot_total_tokens??null,contextWindow:j?.usage_snapshot_context_window??null,cost:j?.usage_snapshot_cost??null,tool:vi,model:bi,availableModels:An},metadataExtra:j?.external_source?(0,X.jsx)(IF,{externalSource:j.external_source}):null,actions:j&&e?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[oi&&(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>wt(!0),children:xt?W5(`composer.loadingMemory`):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:W5(`composer.memorySuggestions`)}),(0,X.jsx)(Ww,{children:yt.length})]})}),(0,X.jsx)(R4,{projectId:e,scope:{type:`spec`,id:j.id},size:`xs`,onNavigateToLifecycleSource:b})]}):null,warnings:qr&&Jr?(0,X.jsx)(`div`,{className:`w-fit max-w-md rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-50`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`div`,{children:Jr}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,disabled:lt===j?.id,onClick:()=>{j&&Xn(j)},children:lt===j?.id?W5(`targets.switchingBack`):W5(`targets.switchBack`)}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:Gn,children:W5(`composer.startNewSession`)})]})]})}):Kr&&Yr?(0,X.jsx)(`div`,{className:`w-fit max-w-md rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-50`,children:Yr}):null}),composerControls:ta,composerInlineControls:na,composerTheme:`default`,composerFocusNonce:Re,pendingAgentRevealKey:ei&&G?.parentId===k?G?.turnKey??null:null,pendingAgentRevealDelayMs:ei&&G?.parentId===k?400:0,liveResponseTiming:G,followUpPrompt:Tn,draftAttachments:On,followUpPlaceholder:Ci,emptyStateText:null,isSendingFollowUp:be||ve,isComposerSubmitDisabled:Qi||fi||Xr,isUploadingAttachments:kn,canAttachImages:si,followUpDisabledReason:Yr??Jr??(Gr?.agent_status===`running`?W5(`composer.waitTurn`):kn?W5(`composer.waitUpload`):Qi?W5(`composer.waitGrill`):fi?jb.t(`common:questionSet.waitForResolution`):void 0),renderMessageBody:gi,onFollowUpPromptChange:ra,onFollowUpKeyDown:zr,onFollowUpPaste:Br,onUploadAttachments:e=>{Pr(e)},onRemoveAttachment:e=>{Fr(e)},onFollowUpSubmit:()=>{Mr()}})}),aa=!Wr&&me&&!fe?(0,X.jsx)(k8,{title:W5(`composer.noSessionSelectedTitle`),description:W5(`composer.noSessionSelectedDescription`),startNewSessionLabel:W5(`composer.startNewSession`),onStartNewSession:Gn,canStartNewSession:!!e&&!ve&&!be}):Wr&&!F&&!ge&&!j?(0,X.jsx)(D8,{label:W5(`composer.loadingSession`)}):!me||fe?(0,X.jsx)(O8,{label:W5(`sidebar.loadingSessions`)}):ia,oa=Ct&&e&&t?.memory_enabled?(0,X.jsx)(uC,{onClose:()=>wt(!1),overlayClassName:`bg-background/75 p-4`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,X.jsxs)(gC,{size:`sm`,className:`max-h-[calc(100vh-2rem)] w-full gap-0 overflow-hidden border-border/80 bg-card/95 shadow-2xl`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/80 pb-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(vC,{children:W5(`composer.memorySuggestionsTitle`)}),(0,X.jsx)(yC,{children:W5(`composer.memorySuggestionsDescription`)})]}),(0,X.jsx)(bC,{children:t})]}),(0,X.jsx)(xC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,X.jsx)(U8,{projectId:e,suggestions:yt,emptyState:W5(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:Vn})})]}),closeButtonLabel:W5(`composer.closeMemorySuggestions`)}):null,sa=Ri.length>0?(0,X.jsx)(E8,{count:Ri.length,title:Li,isDeleting:Oe.size>0,onConfirm:()=>{pr()},onCancel:()=>{Oe.size>0||De([])},labels:Ei}):null,ca=pt===null?null:(0,X.jsx)(dC,{title:W5(`actions.exportConflictTitle`),description:W5(`actions.exportConflictDescription`,{path:pt.path}),confirmLabel:W5(`actions.exportConflictConfirm`),cancelLabel:W5(`actions.exportConflictCancel`),confirmVariant:`destructive`,onConfirm:()=>{mt(null),tr({projectId:pt.projectId,sessionId:pt.sessionId,snapshotId:pt.snapshotId,overwrite:!0})},onCancel:()=>{mt(null)}});return(0,X.jsxs)(`div`,{"data-testid":`spec-view-shell`,className:`relative flex min-h-0 flex-1 overflow-hidden border-t border-border/70`,children:[(0,X.jsx)(A8,{sessions:D,sessionGroups:Lr,activeSessionId:k,isDraftOpen:F,isLoadingSessions:fe,isOpen:Ie,onToggleOpen:()=>{Le(t=>{let n=!t;return fge({projectId:e,isOpen:n}),n})},testId:`spec-sessions-sidebar`,railTestId:`spec-sessions-rail`,onDraftOpen:Gn,isCreatingSession:ve||!e,isSendingPrompt:be,newSessionShortcutHint:qn,newSessionTooltip:Jn,isSelectionMode:Ae,selectedSessionIds:Me,selectedSessionCount:Me.size,hasDeletableSessions:wi,deletingSessionIds:Oe,onEnterSelectionMode:()=>{je(!0),Ne(new Set)},onExitSelectionMode:()=>{je(!1),Ne(new Set)},onToggleSessionSelection:e=>{Ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:Ir,onConfirmDeleteSelectedSessions:()=>{De(Array.from(Me))},selectionPresets:Rr,onSessionSelect:e=>{Yn(e)},onConfirmDeleteSession:e=>{De([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:Oi,getActivityState:Di,getRowAriaLabel:Ai,renderRowContent:Mi,labels:Ti}),(0,X.jsxs)(`div`,{"data-testid":`spec-artifact-split-pane`,ref:Ut,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden xl:flex-row`,children:[(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:aa}),zi?(0,X.jsxs)(X.Fragment,{children:[Yi,Vi?(0,X.jsx)(age,{snapshot:Ue,isLoading:Je,desktopWidth:Y,onClose:fr,ref:Gt,actions:Ji,review:qi}):null]}):null]}),oa,sa,ca]})},y7=()=>({hasRunning:!1,hasFinishedUnseen:!1,hasErrorUnseen:!1}),b7=()=>({board:y7(),chat:y7(),spec:y7(),memory:y7()}),x7=(e,t)=>{let n=e[t];return!n.hasFinishedUnseen&&!n.hasErrorUnseen?e:{...e,[t]:{...n,hasFinishedUnseen:!1,hasErrorUnseen:!1}}},wge=e=>({hasRunning:e.board.hasRunning||e.chat.hasRunning||e.spec.hasRunning,hasFinishedUnseen:e.board.hasFinishedUnseen||e.chat.hasFinishedUnseen||e.spec.hasFinishedUnseen,hasErrorUnseen:e.board.hasErrorUnseen||e.chat.hasErrorUnseen||e.spec.hasErrorUnseen}),S7=e=>e.hasErrorUnseen?`error`:e.hasRunning?`running`:e.hasFinishedUnseen?`finished`:null,Tge=(e,t)=>t?null:S7(e),C7=e=>({id:e.id,project_id:e.project_id,title:e.title,agent_status:e.agent_status,agent_message_id:e.agent_message_id,latest_snapshot_id:e.latest_snapshot_id}),w7=(e,t)=>e.id===t.id&&e.project_id===t.project_id&&e.title===t.title&&e.agent_status===t.agent_status&&e.agent_message_id===t.agent_message_id&&e.latest_snapshot_id===t.latest_snapshot_id,T7=320,Ege=.7,Dge=28,Oge=6,kge=(e,t)=>{let n=Math.max(T7,Math.round(t*Ege));return Math.max(T7,Math.min(n,Math.round(e)))},Age=(e,t)=>{let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[...e,t];let r=e.slice();return r[n]=t,r},jge=(e,t)=>{let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[...e,t];if(w7(e[n],t))return e;let r=e.slice();return r[n]=t,r},E7=(e,t)=>e.length===t.length&&e.every((e,n)=>w7(e,t[n]))?e:t,Mge=(e,t)=>{if(t.type===`reset`)return b7();if(t.type===`mark-workspace-visible`)return x7(e,t.workspace);let n=e[t.workspace],r={...n,hasRunning:t.activity.hasRunning,hasFinishedUnseen:t.visibleWorkspace===t.workspace?!1:n.hasFinishedUnseen||t.activity.didFinish,hasErrorUnseen:t.visibleWorkspace===t.workspace?!1:n.hasErrorUnseen||t.activity.didError};return n.hasRunning===r.hasRunning&&n.hasFinishedUnseen===r.hasFinishedUnseen&&n.hasErrorUnseen===r.hasErrorUnseen?e:{...e,[t.workspace]:r}},Nge=({activeProjectId:e,onActivity:t})=>{let{tickets:n}=r3(),r=(0,p.useRef)(new Map);return(0,p.useEffect)(()=>{r.current=new Map},[e]),(0,p.useEffect)(()=>{let e=r.current,i=new Map,a=!1,o=!1;for(let t of n){let n=e.get(t.id)??null,r=t.agent_status??null,s=v8(t);!s&&n===`running`&&r===`done`&&(a=!0),n===`running`&&r===`error`&&(o=!0),i.set(t.id,s?n:r)}r.current=i,t({hasRunning:n.some(e=>e.agent_status===`running`||Bme(e)),didFinish:a,didError:o})},[t,n]),null},Pge=({activeProjectId:e})=>{let{t}=K(`common`,{keyPrefix:`approvalRequest.notification`}),n=lq(),{setPendingApprovalRequests:r}=r3();return(0,p.useEffect)(()=>{if(!e){r([]);return}let i=new AbortController,a=0,o=async(n,r)=>{if(n.status!==`pending`||i.signal.aborted||r!==void 0&&r!==a)return;let o=(await nN(e,n.id,i.signal)).approval_request;o.status!==`pending`||i.signal.aborted||r!==void 0&&r!==a||await t3({title:t(`title`),body:t(o.action_kind===`git_push`?`forcePush`:`productionCheck`),key:Ide(o),destination:e3(o)})},s=()=>{let t=++a;(async()=>{let t=[],n;do{let r=await tN(e,{statuses:[`pending`],limit:200,cursor:n,signal:i.signal});t.push(...r.approval_requests),n=r.next_cursor??void 0}while(n);return t})().then(e=>{if(!(i.signal.aborted||t!==a))return r(e),Promise.allSettled(e.map(e=>o(e,t)))}).catch(e=>{Ye(e)})},c=t=>{if(!t||typeof t!=`object`)return;let n=t;n.project_id!==e||typeof n.id!=`string`||s()};return s(),n.on(`approval-request:created`,c),n.on(`approval-request:updated`,s),n.on(`connect`,s),()=>{i.abort(),n.off(`approval-request:created`,c),n.off(`approval-request:updated`,s),n.off(`connect`,s)}},[e,r,n,t]),null},Fge=({activeProjectId:e,onActivity:t})=>{let n=lq(),[r,i]=(0,p.useState)([]),a=(0,p.useRef)(new Map);return(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController;return(async()=>{try{let n=await CM(e,t.signal);if(t.signal.aborted)return;i(n)}catch(e){Ye(e)}})(),()=>{t.abort()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=$b(()=>{document.visibilityState===`visible`&&CM(e,t.signal).then(e=>{t.signal.aborted||i(e)}).catch(e=>{Ye(e)})});return()=>{t.abort(),n()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||i(e=>Age(e,t))},r=t=>{!t||t.project_id!==e||i(e=>e.filter(e=>e.id!==t.id))};return n.on(`chat-session:created`,t),n.on(`chat-session:updated`,t),n.on(`chat-session:deleted`,r),()=>{n.off(`chat-session:created`,t),n.off(`chat-session:updated`,t),n.off(`chat-session:deleted`,r)}},[e,n]),(0,p.useEffect)(()=>{let n=a.current,i=new Map,o=[],s=!1;for(let e of r){let t=n.get(e.id)??null,r=e.agent_status??null;t===`running`&&r===`done`&&o.push(e),t===`running`&&r===`error`&&(s=!0),i.set(e.id,r)}a.current=i;for(let e of o)if(e.title){let t=Pde({projectId:e.project_id,chatSessionId:e.id,agentMessageId:e.agent_message_id});t&&t3({title:`Chat response ready`,body:e.title,key:t,destination:{kind:`chat-session`,projectId:e.project_id,chatSessionId:e.id}})}o.length>0&&e&&t6(e),t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:o.length>0,didError:s})},[e,t,r]),null},Ige=({activeProjectId:e,onActivity:t})=>{let n=lq(),[r,i]=(0,p.useState)([]),a=(0,p.useRef)(new Map);return(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController;return(async()=>{try{let n=await RM(e,t.signal);if(t.signal.aborted)return;let r=n.map(C7);i(e=>E7(e,r))}catch(e){Ye(e)}})(),()=>{t.abort()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=$b(()=>{document.visibilityState===`visible`&&RM(e,t.signal).then(e=>{if(t.signal.aborted)return;let n=e.map(C7);i(e=>E7(e,n))}).catch(e=>{Ye(e)})});return()=>{t.abort(),n()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{if(!t||t.project_id!==e)return;let n=C7(t);i(e=>jge(e,n))},r=t=>{!t||t.project_id!==e||i(e=>e.filter(e=>e.id!==t.id))};return n.on(`spec-session:created`,t),n.on(`spec-session:updated`,t),n.on(`spec-session:deleted`,r),()=>{n.off(`spec-session:created`,t),n.off(`spec-session:updated`,t),n.off(`spec-session:deleted`,r)}},[e,n]),(0,p.useEffect)(()=>{let e=a.current,n=new Map,i=[],o=!1;for(let t of r){let r=e.get(t.id)??null,a=t.agent_status??null;r===`running`&&a===`done`&&i.push(t),r===`running`&&a===`error`&&(o=!0),n.set(t.id,a)}a.current=n;for(let e of i)if(e.title){let t=Fde({projectId:e.project_id,specSessionId:e.id,agentMessageId:e.agent_message_id,latestSnapshotId:e.latest_snapshot_id});t&&t3({title:`Spec response ready`,body:e.title,key:t,destination:{kind:`spec-session`,projectId:e.project_id,specSessionId:e.id}})}t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:i.length>0,didError:o})},[e,t,r]),null},Lge=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,activeRun:u,activeTool:d,onRestoreSessionTarget:f,onChatReviewCapabilityChange:m,routedInspectionReviewCapability:h,onPreviewReviewCapabilityChange:g,previewDisplayMode:_=`hidden`,previewPane:v=null,previewPaneWidth:y=480,isPreviewButtonDisabled:b=!1,previewButtonTitle:x,visibleWorkspace:S,onProjectUsageChange:C,onBundlesChange:w,onBundlesLoadingChange:T,onBoardLoadedProjectIdChange:E,onPreviewToggle:D,onPreviewPaneWidthChange:O,onRunStopped:k,onRunStatusChange:A,onWorkspaceActivityChange:j,onWorkspaceActivityEvent:M,pendingWorkspaceNavigation:N=null,onPendingWorkspaceNavigationConsumed:P,routedTicketId:F=null,routedModalStack:I=[],onRoutedTicketOpen:L,onRoutedTicketClose:R,onRoutedTicketUnavailable:z,routedBundleId:ee=null,routedChatSessionId:B,routedSpecSessionId:V,routedSpecSnapshotId:te,routedInspection:H=null,onRoutedBundleOpen:U,onRoutedBundleClose:ne,onRoutedInspectionOpen:re,onRoutedInspectionModeChange:ie,onRoutedInspectionClose:ae,onChatSessionNavigation:oe,onSpecSessionNavigation:W,onRoutedEntityUnavailable:se,onSpecImplementationChatReady:ce,onViewSourceSpec:le,onNavigateToLifecycleSource:ue,onViewMemorySource:de,onStartChatFromBundle:fe,onOpenProjectExecutionSettings:pe,refreshKey:me=0,boardFilterState:he,onBoardFilterStateChange:ge})=>{let _e=(0,p.useRef)(null),ve=(0,p.useRef)(null),ye=(0,p.useRef)(null),be=(0,p.useRef)(null),xe=(0,p.useRef)(!1),Se=(0,p.useRef)(!1),Ce=(0,p.useRef)(0),we=(0,p.useRef)(y),Te=(0,p.useRef)(y),Ee=S===`board`||S===`chat`,De=v!==null,[Oe,ke]=(0,p.useState)(!1),[Ae,je]=(0,p.useState)(!1),[Me,Ne]=(0,p.useState)(y),[Pe,Fe]=(0,p.useReducer)(Mge,void 0,b7),Ie=Ee&&De&&_===`expanded`,Le=Ee&&De&&_===`inline`,Re=Ee&&De&&_===`hidden`&&!Ae,ze=(Le||Ae)&&!Ie,G=Ie||ze,Be=Ee&&De&&!Ie,Ve=Oe?Me:y,He=S!==`chat`||!ze,Ue=e=>{let t=ye.current,n=be.current,r=xe.current;if(t!==null){if(ye.current=null,be.current=null,xe.current=!1,ke(!1),je(!1),e!==null&&ve.current?.hasPointerCapture(e)&&ve.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;O?.(Te.current),D?.();return}O?.(Te.current)}},K=e=>{if(!_e.current)return;let t=_e.current.getBoundingClientRect().width,n=kge(e,t);Te.current=n,Ne(n)},We=e=>{O&&(Re&&b||(e.preventDefault(),ye.current=e.pointerId,be.current=Re?`collapsed`:`inline`,xe.current=!1,Se.current=!1,Ce.current=e.clientX,we.current=Re?0:Te.current,ke(!Re),e.currentTarget.setPointerCapture(e.pointerId)))},Ge=e=>{if(ye.current!==e.pointerId)return;let t=e.clientX-Ce.current,n=we.current-t;if(be.current===`collapsed`){if(!xe.current&&n<Oge)return;xe.current||(xe.current=!0,Se.current=!0,je(!0),ke(!0))}K(n)},Ke=e=>{if(ye.current===e.pointerId){if(be.current===`inline`||xe.current){let t=e.clientX-Ce.current;K(we.current-t)}Ue(e.pointerId)}},qe=e=>{ye.current===e.pointerId&&Ue(e.pointerId)},q=(0,p.useCallback)((e,t)=>{M?.(e,t),Fe({type:`update-workspace`,workspace:e,activity:t,visibleWorkspace:S})},[M,S]);(0,p.useEffect)(()=>{Fe({type:`reset`})},[e]),(0,p.useEffect)(()=>{S!==`memory`&&Fe({type:`mark-workspace-visible`,workspace:S})},[S]),(0,p.useEffect)(()=>{j?.(Pe)},[j,Pe]),(0,p.useEffect)(()=>{Oe||(Te.current=y),!De&&(ye.current=null,be.current=null,xe.current=!1,Se.current=!1,Te.current=y)},[De,Oe,y]);let Je=()=>{if(Se.current){Se.current=!1;return}b||D?.()},J=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),Je())},Ye=(r=!1)=>(0,X.jsx)(Kme,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,activeRun:u,activeTool:d,inspectionOnly:r,onPreviewReviewCapabilityChange:r?void 0:g,onRunStopped:k,onRunStatusChange:A,onViewSourceSpec:le,onNavigateToLifecycleSource:ue,onStartChatFromBundle:fe,onOpenProjectExecutionSettings:pe,refreshKey:me,boardFilterState:he,onBoardFilterStateChange:ge,onInitialTicketNavigationUnavailable:z,routedTicketId:F,routedModalStack:I,onTicketOpen:L,onTicketClose:R,routedBundleId:ee,routedInspection:H,routedInspectionReviewCapability:r&&S===`chat`?h:void 0,onBundleOpen:U,onBundleClose:ne,onInspectionOpen:re,onInspectionModeChange:ie,onInspectionClose:ae,onInspectionUnavailable:se,initialImportedDraft:N?.workspace===`board`&&`issueDraft`in N?N.draft:null,onInitialImportedDraftConsumed:P});return(0,X.jsx)(Gme,{activeProjectId:e,refreshKey:me,onLoadedProjectIdChange:E,onProjectUsageChange:C,onBundlesChange:w,onBundlesLoadingChange:T,children:(0,X.jsxs)(`div`,{ref:_e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(Nge,{activeProjectId:e,onActivity:e=>{q(`board`,e)}}),(0,X.jsx)(Pge,{activeProjectId:e}),(0,X.jsx)(Fge,{activeProjectId:e,onActivity:e=>{q(`chat`,e)}}),(0,X.jsx)(Ige,{activeProjectId:e,onActivity:e=>{q(`spec`,e)}}),S===`spec`?(0,X.jsx)(`div`,{id:`project-workspace-panel-spec`,role:`tabpanel`,"aria-labelledby":`project-workspace-tab-spec`,className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(Cge,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,targetBundles:r,targetBranchSuggestions:i,isTargetBundleLoading:a,isTargetSelectorLoading:o,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,onRestoreSessionTarget:f,activeTool:d,routedSpecSessionId:V,routedSpecSnapshotId:te,initialIssueDraft:N?.workspace===`spec`&&`issueDraft`in N?N.draft:null,onRoutedSpecNavigationUnavailable:se,onSessionNavigation:W,onInitialIssueDraftConsumed:P,onImplementInChat:ce,onNavigateToLifecycleSource:ue})}):S===`memory`?(0,X.jsx)(`div`,{id:`project-workspace-panel-memory`,role:`tabpanel`,"aria-labelledby":`project-workspace-tab-memory`,className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(Nhe,{activeProject:t,onNavigateToSource:de})}):(0,X.jsxs)(`div`,{id:S===`chat`?`project-workspace-panel-chat`:`project-workspace-panel-board`,role:`tabpanel`,"aria-labelledby":S===`chat`?`project-workspace-tab-chat`:`project-workspace-tab-board`,className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:S===`chat`?(0,X.jsx)(jhe,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,targetBundles:r,targetBranchSuggestions:i,isTargetBundleLoading:a,isTargetSelectorLoading:o,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,activeTool:d,routedChatSessionId:B,initialDraftOpen:N?.workspace===`chat`&&`startNewDraft`in N,onInitialDraftOpenConsumed:P,initialSpecDraft:N?.workspace===`chat`&&`draft`in N?{text:N.draftText,specSessionId:N.specSessionId,specSnapshotId:N.specSnapshotId}:null,onInitialSpecDraftConsumed:P,onRoutedChatNavigationUnavailable:se,onSessionNavigation:oe,onViewSourceSpec:le,onNavigateToLifecycleSource:ue,isExternallyResizing:Oe,onRestoreSessionTarget:f,onReviewCapabilityChange:m,showChangesPanel:He}):Ye()}),[Be?(0,X.jsx)(lv,{content:b?x??`Preview unavailable`:`Open preview`,disabled:!Re,side:`left`,children:(0,X.jsx)(`div`,{"aria-label":Re?x??`Show preview`:`Resize preview pane`,"aria-orientation":Re?void 0:`vertical`,className:Re?`group flex shrink-0 touch-none select-none items-center justify-center border-l border-border/70 bg-background/90 transition-colors ${b?`cursor-not-allowed text-muted-foreground/60`:`cursor-col-resize text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`:`group flex w-5 shrink-0 cursor-col-resize touch-none select-none items-center justify-center border-l border-border/70 bg-background/80 ${Oe?`bg-background`:``}`,"data-preview-divider":`true`,"data-testid":Re?`collapsed-preview-rail`:void 0,onLostPointerCapture:qe,onPointerCancel:Ke,onPointerDown:We,onPointerMove:Ge,onPointerUp:Ke,onClick:Re?Je:void 0,onKeyDown:Re?J:void 0,ref:ve,role:Re?`button`:`separator`,style:Re?{width:`${Dge}px`}:void 0,tabIndex:Re?b?-1:0:void 0,children:Re?(0,X.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-[2.65rem] items-center justify-center text-sky-400/80 transition-colors group-hover:text-sky-300`,children:(0,X.jsx)(Mhe,{className:`h-3 w-3 shrink-0`})}),(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 h-14 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-muted-foreground/70 transition-colors group-hover:bg-sky-300/90`})]}):(0,X.jsx)(`div`,{className:`h-14 w-1.5 rounded-full transition-colors ${Oe?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`}`})})},`preview-divider`):null,G?(0,X.jsx)(`div`,{className:Ie?`fixed inset-0 z-50 bg-black/70 p-4 sm:p-6`:`min-h-0 shrink-0 border-l border-border/70 bg-[#11131a]`,style:Ie?void 0:{width:`${Ve}px`},children:(0,X.jsx)(`div`,{className:`h-full w-full`,children:v})},`preview-container`):null]]}),S!==`board`&&H&&Ye(!0)]})})},Rge=({isExpanded:e,isVisible:t,project:n,onClose:r,onToggleExpanded:i})=>(0,X.jsx)(`div`,{className:[`fixed inset-x-4 bottom-24 z-40`,e?`top-20`:`h-[min(28rem,calc(100vh-8rem))]`,t?`block`:`hidden`].join(` `),children:(0,X.jsx)(e4,{createSession:()=>Gse(n.id),isExpanded:e,isVisible:t,ariaLabel:`Project terminal for ${n.name}`,title:n.name,closeLabel:`Close terminal`,className:e?`h-full w-full rounded-2xl shadow-2xl`:`mx-auto h-full max-w-6xl shadow-2xl`,onClose:r,onToggleExpanded:i})}),zge=({activeWorkspace:e,activityByWorkspace:t,className:n,memoryEnabled:r=!1,onWorkspaceChange:i})=>{let{t:a}=K(`common`,{keyPrefix:`workspaceTabs`}),o=r?[`board`,`chat`,`spec`,`memory`]:[`board`,`chat`,`spec`],s={board:a(`board`),chat:a(`chat`),spec:a(`spec`),memory:a(`memory`)};return(0,X.jsx)(`div`,{className:Z(`min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,n),children:(0,X.jsx)(`div`,{role:`tablist`,"aria-label":a(`ariaLabel`),className:`inline-flex min-w-max items-end gap-1 border-b border-border/70`,children:o.map(n=>{let r=e===n,a=Tge(t[n],r),o=n===`board`?`border-sky-300/70 bg-sky-500/8 text-sky-200`:n===`spec`?`border-violet-300/70 bg-violet-500/8 text-violet-200`:n===`memory`?`border-amber-300/70 bg-amber-500/8 text-amber-200`:`border-emerald-300/70 bg-emerald-500/8 text-emerald-200`;return(0,X.jsx)(`button`,{id:`project-workspace-tab-${n}`,type:`button`,role:`tab`,"aria-selected":r,"aria-controls":`project-workspace-panel-${n}`,tabIndex:r?0:-1,className:Z(`cursor-pointer rounded-t-lg border-b-2 px-3 py-2 text-sm font-medium transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 sm:px-4 sm:py-2.5 sm:text-[15px]`,r?o:`border-transparent text-muted-foreground hover:border-border hover:bg-background/35 hover:text-foreground`),onClick:()=>i(n),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2 whitespace-nowrap`,children:[(0,X.jsx)(`span`,{children:s[n]}),(0,X.jsx)(Hy,{state:a,className:`mt-0`})]})},n)})})})},D7=32,Bge=5.5,Vge=2,Hge=24,Uge=8,O7=new Map,Wge={running:{fill:`#fcd34d`,stroke:`#f59e0b`},finished:{fill:`#34d399`,stroke:`#059669`},error:{fill:`#fb7185`,stroke:`#e11d48`}},k7=e=>e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`),A7=e=>{if(!e)return null;let t=e.trim().match(/^([0-9]+(?:\.[0-9]+)?)/);return t?Number(t[1]):null},j7=e=>{let t=new DOMParser().parseFromString(e,`image/svg+xml`);if(t.querySelector(`parsererror`))return null;let n=t.documentElement;if(n.nodeName.toLowerCase()!==`svg`)return null;let r=n.getAttribute(`viewBox`)?.trim(),i=A7(n.getAttribute(`width`)),a=A7(n.getAttribute(`height`)),o=r??(i&&a?`0 0 ${i} ${a}`:`0 0 ${D7} ${D7}`);return`<svg ${[Array.from(n.attributes).filter(e=>![`width`,`height`,`viewBox`,`x`,`y`,`preserveAspectRatio`].includes(e.name)).map(e=>`${e.name}="${k7(e.value)}"`).join(` `),`x="0"`,`y="0"`,`width="${D7}"`,`height="${D7}"`,`viewBox="${k7(o)}"`,`preserveAspectRatio="xMidYMid meet"`].filter(e=>e.length>0).join(` `)}>${n.innerHTML}</svg>`},Gge=async e=>{if(!e)return null;let t=O7.get(e);if(t)return t;let n=(async()=>{try{if(e.startsWith(`data:image/svg+xml,`))return j7(decodeURIComponent(e.slice(19)));if(e.startsWith(`data:image/svg+xml;base64,`))return j7(atob(e.slice(26)));let t=await fetch(e);return t.ok?j7(await t.text()):null}catch{return null}})();return O7.set(e,n),n},Kge=async(e,t)=>{let{fill:n,stroke:r}=Wge[e],i=await Gge(t);return i?[`<svg xmlns="http://www.w3.org/2000/svg" width="${D7}" height="${D7}" viewBox="0 0 ${D7} ${D7}">`,i,`<circle cx="${Hge}" cy="${Uge}" r="${Bge}" fill="${n}" stroke="${r}" stroke-width="${Vge}"/>`,`</svg>`].join(``):null},qge=async(e,t)=>{if(!e)return t;let n=await Kge(e,t);return n?`data:image/svg+xml,${encodeURIComponent(n)}`:t},Jge=()=>{let e=document.querySelector(`link[rel="icon"]`);if(e)return e;let t=document.createElement(`link`);return t.rel=`icon`,document.head.appendChild(t),t},M7=({defaultHref:e,state:t})=>{let n=Jge(),r=Number(n.dataset.browserTabActivityRequestId??`0`)+1;if(n.dataset.browserTabActivityState=t??`default`,n.dataset.browserTabActivityRequestId=String(r),!t){if(e){n.href=e;return}n.removeAttribute(`href`);return}qge(t,e).then(e=>{if(n.dataset.browserTabActivityRequestId===String(r)){if(e){n.href=e;return}n.removeAttribute(`href`)}})},N7=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.archonDesktop===!0&&typeof t.modalHasParentEntry==`boolean`&&(t.modalParentDepth===void 0||Number.isInteger(t.modalParentDepth)&&t.modalParentDepth>0)&&(t.modalStack===void 0||Array.isArray(t.modalStack)&&t.modalStack.every(e=>!!e&&typeof e==`object`&&typeof e.kind==`string`&&typeof e.projectId==`string`))},P7=e=>!N7(e)||!e.modalHasParentEntry?0:e.modalParentDepth??1,F7=(e,t,n)=>!t||!n.isModal(t)?[]:N7(e)&&e.modalStack&&e.modalStack.length>0?e.modalStack:[t],I7=(e,t,n)=>({archonDesktop:!0,modalHasParentEntry:e,...t>1?{modalParentDepth:t}:{},...n.length>0?{modalStack:n}:{}}),Yge=(e=W4)=>{let[t,n]=(0,p.useState)(()=>e.parse(window.location.pathname)),[r,i]=(0,p.useState)(()=>{let t=e.parse(window.location.pathname);return t&&e.isModal(t)?[t]:[]}),[a,o]=(0,p.useState)(0),s=(0,p.useRef)(!1);(0,p.useEffect)(()=>{s.current||(s.current=!0,t&&e.isModal(t)&&window.history.replaceState(I7(!1,0,[t]),``,e.build(t)))},[e,t]),(0,p.useEffect)(()=>{let t=()=>{let t=e.parse(window.location.pathname);n(t),i(F7(window.history.state,t,e)),o(e=>e+1)};return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e]);let c=(0,p.useCallback)(r=>{let a=e.isModal(r)?t&&e.isModal(t)?[...F7(window.history.state,t,e).slice(0,-1),r]:[r]:[],s=e.isModal(r)?P7(window.history.state):0,c=I7(s>0,s,a);window.history.replaceState(c,``,e.build(r)),n(r),i(a),o(e=>e+1)},[e,t]),l=(0,p.useCallback)(r=>{let a=e.isModal(r),s=a?t&&e.isModal(t)?[...F7(window.history.state,t,e),r]:[r]:[];window.history.pushState(I7(a,0,s),``,e.build(r)),n(r),i(s),o(e=>e+1)},[e,t]),u=(0,p.useCallback)(r=>{let a=P7(window.history.state);if(a===0){c(r);return}let s=a>0?a+1:0,l=F7(window.history.state,t,e),u=l.length>0?[...l.slice(0,-1),r]:[r],d=I7(s>0,s,u);window.history.pushState(d,``,e.build(r)),n(r),i(u),o(e=>e+1)},[e,c,t]);return{closeModal:(0,p.useCallback)((t,n)=>{let r=e.parse(window.location.pathname);if(!r||e.build(r)!==e.build(t))return;let i=P7(window.history.state);if(i===1){window.history.back();return}if(i>1){window.history.go(-i);return}let a=e.parent(t),o=n??a;o&&c(o)},[e,c]),modalStack:r,navigationVersion:a,push:l,pushModalSibling:u,replace:c,route:t}},L7=(e,t)=>jb.t(`common:projectFooter.${e}`,t),Xge=(e,t)=>{if(e?.kind===`activity-run`)return e;for(let e=t.length-1;e>=0;--e){let n=t[e];if(n.kind===`activity-run`)return n}return null},Zge=1e3,R7=`archon.active-project-id`,z7=`archon.workspace-by-project`,B7=`archon.preview-mode-by-project`,V7=`archon.dismissed-preview-run-context-by-project`,H7=5e3,U7=`archon.preview-pane-width`,W7=`archon.preview-viewport-preset`,G7=`archon.preview-zoom`,Qge=480,$ge=`responsive`,e_e=1,K7={hasMounted:!1,isOpen:!1,isExpanded:!1},q7=`hidden`,t_e=(0,p.lazy)(()=>BW(()=>Promise.resolve().then(()=>B6).then(e=>({default:e.WorkspaceReviewModal})),void 0)),n_e=(0,p.lazy)(()=>BW(()=>import(`./VerificationDialog-BYE1M9T2.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),r_e=(0,p.lazy)(()=>BW(()=>import(`./GitHubActionsDialog-CwsZRevc.js`).then(e=>({default:e.GitHubActionsDialog})),__vite__mapDeps([20,3]))),i_e=(0,p.lazy)(()=>BW(()=>import(`./ActivityView-PGEex8sS.js`).then(e=>({default:e.ActivityView})),[])),J7=e=>{if(!e)return null;try{return JSON.parse(e)}catch{return null}},a_e=e=>{let t=e.startsWith(`/`)?e.slice(1).split(`/`):[];if(t[0]!==`app`||t[1]!==`projects`||!t[2])return null;try{return decodeURIComponent(t[2])||null}catch{return null}},o_e=e=>e?.kind===`workspace`?e.workspace:e?.kind===`chat-session`?`chat`:e?.kind===`spec-session`||e?.kind===`spec-snapshot`?`spec`:`board`,Y7=e=>{let t=J7(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0):[]},X7=e=>{let t=J7(e);return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e,n=typeof t.name==`string`?t.name:``,r=typeof t.cmd==`string`?t.cmd:``,i=typeof t.cwd==`string`?t.cwd:``;return n.trim()===``&&r.trim()===``&&i.trim()===``?[]:[{name:n,cmd:r,cwd:i}]}):[]},s_e=e=>{let t=J7(e);return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e,n=typeof t.source==`string`?t.source:``,r=typeof t.target==`string`?t.target:``,i=t.mode===`copy`||t.mode===`symlink`?t.mode:`copy`;return n.trim()===``&&r.trim()===``?[]:[{source:n,target:r,mode:i}]}):[]},c_e=(e,t)=>{let n=new Set(dw(e)),r=new Set(fw(e)),i=new Set(yre(e)),a=new Set(bre(e));return{name:e.name,repoPath:e.repo_path,buildExecutionProvider:e.build_execution_provider??`host`,linkedProjectIds:e.linked_project_ids,runSetup:Y7(e.run_setup),runServices:X7(e.run_services),checkDefinitions:uw(e).map(e=>({id:e.id,name:e.name,category:e.category,command:e.command,cwd:e.cwd??``,timeoutMs:String(e.timeout_ms),runner:e.category===`test`?e.runner:`auto`,consequence:e.consequence??`ordinary`,required:n.has(e.id),preReview:n.has(e.id)&&r.has(e.id),postBuild:i.has(e.id),autoFix:a.has(e.id)})),runIde:e.run_ide??``,previewServiceName:e.preview_service_name??``,previewPath:e.preview_path??``,previewCapabilityMode:e.preview_capability_mode??`auto`,helperModel:e.helper_models?.[t]?.model??(t===`opencode`?e.helper_model:null)??``,helperVariant:e.helper_models?.[t]?.variant??(t===`opencode`?e.helper_variant:null)??``,helperModels:e.helper_models??{},reviewerModel:e.reviewer_models?.[t]?.model??(t===`opencode`?e.reviewer_model:null)??``,reviewerVariant:e.reviewer_models?.[t]?.variant??(t===`opencode`?e.reviewer_variant:null)??``,reviewerModels:e.reviewer_models??{},commitMessageRules:e.commit_message_rules??``,commitAfterEachTicket:e.commit_after_each_ticket,autoParkStaleTickets:e.auto_park_stale_tickets,memoryEnabled:e.memory_enabled,scanIncludeGlobs:e.scan_include_globs??[],scanExcludeGlobs:e.scan_exclude_globs??[],worktreeSync:s_e(e.worktree_sync),specAwareCodeReviewEnabled:e.spec_aware_code_review_enabled,automationDepth:e.automation_depth??`manual`,automationReviewFixEnabled:e.automation_review_fix_enabled??!1,automationPauseOnOpenQuestions:e.automation_pause_on_open_questions??!1,automationReviewSeverity:e.automation_review_severity??`medium`,automationReviewMaxIterations:e.automation_review_max_iterations??3}},Z7=e=>{let t=e.previewServiceName?.trim()||null,n=e.previewPath?.trim()||``,r=n===``||n===`/`?null:n,i=t||r||e.previewCapabilityMode===`force_web`||e.previewCapabilityMode===`force_disabled`?e.previewCapabilityMode??`auto`:null;return{name:e.name,repo_path:e.repoPath,build_execution_provider:e.buildExecutionProvider??`host`,linked_project_ids:e.linkedProjectIds,run_setup:e.runSetup.length>0?e.runSetup:null,run_services:e.runServices.length>0?e.runServices.map(e=>({...e.name?{name:e.name}:{},cmd:e.cmd,...e.cwd?{cwd:e.cwd}:{}})):null,check_definitions:(e.checkDefinitions??[]).map(e=>e.category===`test`?{id:e.id,name:e.name,category:`test`,command:e.command,...e.cwd?{cwd:e.cwd}:{},timeout_ms:Number(e.timeoutMs),consequence:`ordinary`,runner:e.runner}:e.category===`custom`?{id:e.id,name:e.name,category:e.category,command:e.command,...e.cwd?{cwd:e.cwd}:{},timeout_ms:Number(e.timeoutMs),consequence:e.consequence??`ordinary`}:{id:e.id,name:e.name,category:e.category,command:e.command,...e.cwd?{cwd:e.cwd}:{},timeout_ms:Number(e.timeoutMs),consequence:`ordinary`}),required_check_definition_ids:(e.checkDefinitions??[]).filter(e=>e.required).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),pre_review_check_definition_ids:(e.checkDefinitions??[]).filter(e=>e.required&&e.preReview).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),post_build_check_definition_ids:(e.checkDefinitions??[]).filter(e=>e.postBuild).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),auto_fix_check_definition_ids:(e.checkDefinitions??[]).filter(e=>e.autoFix).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),run_ide:e.runIde||null,preview_service_name:t,preview_path:r,preview_capability_mode:i,helper_models:e.helperModels??{},reviewer_models:e.reviewerModels??{},commit_message_rules:e.commitMessageRules||null,commit_after_each_ticket:e.commitAfterEachTicket,auto_park_stale_tickets:e.autoParkStaleTickets,memory_enabled:e.memoryEnabled,scan_include_globs:e.scanIncludeGlobs??[],scan_exclude_globs:e.scanExcludeGlobs??[],worktree_sync:e.worktreeSync.length>0?e.worktreeSync.map(e=>({source:e.source,...e.target?{target:e.target}:{},mode:e.mode})):null,spec_aware_code_review_enabled:e.specAwareCodeReviewEnabled,automation_depth:e.automationDepth,automation_review_fix_enabled:e.automationReviewFixEnabled,automation_pause_on_open_questions:e.automationPauseOnOpenQuestions,automation_review_severity:e.automationReviewSeverity,automation_review_max_iterations:e.automationReviewMaxIterations}},l_e=e=>e?Y7(e.run_setup).length>0||X7(e.run_services).length>0||(e.run_ide?.trim().length??0)>0:!1,Q7=(e,t,n)=>`${e} ${e===1?t:n}`,u_e=e=>{if(!e.repo_path_locked)return null;let t=[];return e.ticket_count>0&&t.push(Q7(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&t.push(Q7(e.worktree_count,`worktree exists`,`worktrees exist`)),t.length===0?`Repository path is locked for this project.`:`Repository path is locked because ${t.join(` and `)}.`},d_e=(e,t)=>{if(t.length<=1)return`Keep at least one project in Archon.`;let n=[];e.ticket_count>0&&n.push(Q7(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&n.push(Q7(e.worktree_count,`worktree exists`,`worktrees exist`));let r=t.filter(t=>t.linked_project_ids.includes(e.id)).length;return r>0&&n.push(Q7(r,`project links to it`,`projects link to it`)),n.length===0?null:`This project can't be deleted while ${n.join(` and `)}.`},f_e=(e,t)=>e.id!==t.projectId||e.ticket_count===t.ticketCount&&e.worktree_count===t.worktreeCount&&e.repo_path_locked===t.repoPathLocked?e:{...e,ticket_count:t.ticketCount,worktree_count:t.worktreeCount,repo_path_locked:t.repoPathLocked},p_e=(e,t)=>({projectId:e,branch:t.branch,status:t.status,ahead:t.ahead??0,behind:t.behind??0,hasUpstream:t.has_upstream??!1,canPull:t.can_pull??!1,diffStats:t.diff_stats??null}),$7=e=>({projectId:e,branch:null,status:`loading`,ahead:0,behind:0,hasUpstream:!1,canPull:!1,diffStats:null}),e9=(e,t)=>t?e[t]??K7:K7,t9=(e,t)=>t?e[t]??q7:q7,m_e=()=>{let e=window.localStorage.getItem(U7),t=Number(e);return Number.isFinite(t)&&t>=320?t:Qge},h_e=()=>{let e=window.localStorage.getItem(W7);return e===`phone`||e===`tablet`||e===`laptop`||e===`responsive`?e:$ge},g_e=()=>{let e=Number(window.localStorage.getItem(G7));return Number.isFinite(e)&&e>0?e:e_e},__e=()=>{let e=J7(window.localStorage.getItem(z7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).flatMap(([e,t])=>t===`activity`?[[e,`board`]]:t===`board`||t===`chat`||t===`spec`||t===`memory`?[[e,t]]:[]))},v_e=()=>{let e=J7(window.localStorage.getItem(B7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>e===`hidden`||e===`inline`||e===`expanded`))},n9=()=>{let e=J7(window.localStorage.getItem(V7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`||e===null))},y_e=({activeRun:e,project:t})=>{if(!e||e.kind!==`project`||!t)return!1;let n=t.active_target_kind??`repo_root`,r=t.active_target_bundle_id??null;return e.project_id===t.id&&(e.target_kind??`repo_root`)===n&&((e.target_kind??`repo_root`)!==`bundle`||e.target_bundle_id===r)},b_e=({activeRun:e,project:t,projectId:n})=>!e||!n?null:e.kind===`ticket`?e.project_id===n?e:null:y_e({activeRun:e,project:t})?e:null,r9=`Project root has uncommitted changes. Confirm branch switch to continue.`,x_e=({activeProject:e,activeProjectBranchState:t,nextTarget:n})=>e?n.kind===`bundle`?e.active_target_kind!==`bundle`||e.active_target_bundle_id!==n.bundleId:e.active_target_kind===`bundle`?!0:n.branch?t?.branch!==n.branch:!1:!1,S_e=()=>{let e=Yge(),t=lq(),{closeModal:n,modalStack:r,navigationVersion:i,push:a,pushModalSibling:o,replace:s,route:c}=e,l=Xge(c,r),[u,d]=(0,p.useState)(`opencode`),[f,m]=(0,p.useState)(Vr),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)([]),[y,b]=(0,p.useState)(()=>window.localStorage.getItem(R7)),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)({}),[k,A]=(0,p.useState)({}),[j,M]=(0,p.useState)({}),[N,P]=(0,p.useState)({}),[F,I]=(0,p.useState)({}),[L,R]=(0,p.useState)(v_e),[z,ee]=(0,p.useState)(n9),[B,V]=(0,p.useState)(m_e),[te,H]=(0,p.useState)(h_e),[U,ne]=(0,p.useState)(g_e),[re,ie]=(0,p.useState)(null),[ae,oe]=(0,p.useState)({opencode:{models:[],loaded:!1},claude:{models:[],loaded:!1}}),[W,se]=(0,p.useState)(0),[ce,le]=(0,p.useState)({opencode:{model:``,variant:``},claude:{model:``,variant:``}}),[ue,de]=(0,p.useState)(!1),[fe,pe]=(0,p.useState)(null),[me,he]=(0,p.useState)(`general`),[ge,_e]=(0,p.useState)(null),[ve,ye]=(0,p.useState)(!1),[be,xe]=(0,p.useState)({}),[Se,Ce]=(0,p.useState)(__e),[we,Te]=(0,p.useState)(null),[Ee,De]=(0,p.useState)(()=>b7()),[Oe,ke]=(0,p.useState)(()=>y7()),[Ae,je]=(0,p.useState)(0),[Me,Ne]=(0,p.useState)(()=>({query:``,hideStaleTickets:!1,hideBundlesWithPullRequests:!1})),[Pe,Fe]=(0,p.useState)(null),[Ie,Le]=(0,p.useState)(null),[Re,ze]=(0,p.useState)({}),[G,Be]=(0,p.useState)({}),[Ve,He]=(0,p.useState)({}),[Ue,K]=(0,p.useState)({}),[We,Ge]=(0,p.useState)(!1),[qe,q]=(0,p.useState)(!1),[Je,J]=(0,p.useState)(!1),[Xe,Ze]=(0,p.useState)(!1),[Y,Qe]=(0,p.useState)(!1),[$e,et]=(0,p.useState)(!1),[tt,nt]=(0,p.useState)(`idle`),[rt,it]=(0,p.useState)(0),[ot,st]=(0,p.useState)(!1),{isGitHubConnected:ct,defaultBaseBranch:lt}=ew(y),[ut,dt]=(0,p.useState)(null),[ft,pt]=(0,p.useState)(!1),mt=(0,p.useRef)(null),ht=(0,p.useRef)(null),gt=(0,p.useRef)(null),vt=(0,p.useRef)(0),yt=(0,p.useRef)(-1),bt=(0,p.useRef)(!1),xt=(0,p.useRef)(0),St=(0,p.useRef)(window.localStorage.getItem(R7)),Ct=ae[u],wt=Ct.models,Tt=Ct.loaded,Et=ce[u].model,Dt=ce[u].variant,Ot=(0,p.useCallback)(()=>{oe(e=>({...e,[u]:{models:[],loaded:!1}})),se(e=>e+1)},[u]),kt=_.find(e=>e.id===y)??null,At=!!kt?.memory_enabled,jt=y?Se[y]??`board`:`board`,Mt=jt===`memory`?At?`memory`:`board`:jt,Nt=c?.projectId??a_e(window.location.pathname),Pt=Nt?_.find(e=>e.id===Nt)??null:null,It=c?.kind===`repository-inspection`?c:null,Lt=c?.kind===`workspace`&&c.workspace===`memory`&&Pt?.memory_enabled!==!0,Rt=tt===`error`,zt=!!(c&&Pt&&y!==c.projectId),Vt=ue&&window.location.pathname.startsWith(`/app`)&&(!c||!Pt||Lt||$e),Ht=_.find(e=>e.id===St.current)??null,Ut=_[0]??null,Wt=(0,p.useCallback)(t=>{if(!y)return;Ce(e=>({...e,[y]:t.workspace})),De(e=>x7(e,t.workspace));let n=t.workspace===`board`?{kind:`ticket`,projectId:y,ticketId:t.ticketId}:t.workspace===`chat`?{kind:`chat-session`,projectId:y,chatSessionId:t.chatSessionId}:t.specSnapshotId?{kind:`spec-snapshot`,projectId:y,specSessionId:t.specSessionId,specSnapshotId:t.specSnapshotId}:{kind:`spec-session`,projectId:y,specSessionId:t.specSessionId};if(c?.kind===`activity-run`){e.replace(n);return}e.push(n)},[y,e,c]),Kt=(0,p.useCallback)(t=>{y&&(Ce(e=>({...e,[y]:t.workspace})),De(e=>x7(e,t.workspace)),Te(t),e.push({kind:`workspace`,projectId:y,workspace:t.workspace}))},[y,e]),qt=(0,p.useCallback)((e,t,n)=>{y&&Kt({workspace:`chat`,draft:!0,draftText:e,specSessionId:t,specSnapshotId:n})},[y,Kt]),Yt=(0,p.useCallback)((e,t)=>{Wt({workspace:`spec`,specSessionId:e,specSnapshotId:t})},[Wt]),Xt=(0,p.useCallback)(e=>{if(e.source_available){if(e.ticket_id){Wt({workspace:`board`,ticketId:e.ticket_id});return}if(e.chat_session_id){Wt({workspace:`chat`,chatSessionId:e.chat_session_id});return}e.spec_session_id&&Wt({workspace:`spec`,specSessionId:e.spec_session_id})}},[Wt]),Zt=(0,p.useCallback)(e=>{if(e.available){if(J(!1),e.kind===`ticket`){Wt({workspace:`board`,ticketId:e.id});return}if(e.kind===`chat_session`){Wt({workspace:`chat`,chatSessionId:e.id});return}e.kind===`spec_session`&&Wt({workspace:`spec`,specSessionId:e.id})}},[Wt]),Qt=(0,p.useCallback)(e=>{Kt({workspace:`spec`,issueDraft:!0,draft:e})},[Kt]),$t=(0,p.useCallback)(e=>{Kt({workspace:`board`,issueDraft:!0,draft:e})},[Kt]),en=(0,p.useCallback)(()=>{Te(null)},[]),tn=kt!==null,on=l_e(kt),sn=!!kt?.run_ide?.trim(),cn=y!==null&&C===y,ln=y!==null&&(!on||T===y),un=y?D[y]??$7(y):null,dn=y?k[y]??null:null,fn=y?!!j[y]:!1,pn=y?N[y]??null:null,mn=(0,p.useMemo)(()=>y?Re[y]??[]:[],[y,Re]),hn=y?!!G[y]:!1,gn=y?Ve[y]??{current_branch:null,default_branch:null,previous_branch:null}:{current_branch:null,default_branch:null,previous_branch:null},_n=y?!!Ue[y]:!1,vn=y?F[y]??null:null,yn=t9(L,y),bn=yn!==`hidden`,xn=b_e({activeRun:x,project:kt,projectId:y}),Sn=xn?.context_key??null,Cn=y?z[y]??null:null,wn=x8(kt),Tn=Sn===re,En=(0,p.useMemo)(()=>wge(Ee),[Ee]),Dn=(0,p.useMemo)(()=>S7({hasRunning:En.hasRunning,hasFinishedUnseen:Oe.hasFinishedUnseen,hasErrorUnseen:Oe.hasErrorUnseen}),[En.hasRunning,Oe.hasErrorUnseen,Oe.hasFinishedUnseen]);(0,p.useEffect)(()=>{Fe(null),Le(null),ht.current=null},[y]),(0,p.useEffect)(()=>{Le(null)},[Mt]),(0,p.useEffect)(()=>{bn||(ht.current=null)},[bn]),(0,p.useEffect)(()=>{let e=Pe?.target?.kind??null;if(e===`ticket`||e===`bundle`){ht.current=Pe;return}(Mt===`board`||!bn)&&(ht.current=Pe)},[bn,Pe,Mt]),(0,p.useEffect)(()=>{De(b7())},[y]),(0,p.useEffect)(()=>{ke(y7())},[y]),(0,p.useEffect)(()=>{if(!y||ax(y))return;let e=new AbortController;return at(y,e.signal).then(e=>{ix(y,e.connections)}).catch(e=>{Ye(e)}),()=>{e.abort()}},[y]);let On=(0,p.useCallback)((e,t)=>{document.visibilityState!==`visible`&&(!t.didFinish&&!t.didError||ke(e=>{let n={...e,hasFinishedUnseen:e.hasFinishedUnseen||t.didFinish,hasErrorUnseen:e.hasErrorUnseen||t.didError};return e.hasFinishedUnseen===n.hasFinishedUnseen&&e.hasErrorUnseen===n.hasErrorUnseen?e:n}))},[]);(0,p.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&ke(e=>!e.hasFinishedUnseen&&!e.hasErrorUnseen?e:{...e,hasFinishedUnseen:!1,hasErrorUnseen:!1})};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[]),(0,p.useEffect)(()=>{let e=e=>{e.tool!==`claude`&&e.tool!==`opencode`||(vt.current+=1,d(e.tool),g(!0))};return t.on(`tool:updated`,e),()=>{t.off(`tool:updated`,e)}},[t]),(0,p.useEffect)(()=>(mt.current===null&&(mt.current=document.querySelector(`link[rel="icon"]`)?.getAttribute(`href`)??`/favicon.svg`),M7({defaultHref:mt.current,state:Dn}),()=>{M7({defaultHref:mt.current,state:null})}),[Dn]);let kn=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r}=t;try{let t=await er(e,r,{refreshRemote:n});if(r?.aborted)return;O(n=>({...n,[e]:p_e(e,t)}))}catch(t){if(Ye(t))return;if(t instanceof Ke&&t.status===404){O(t=>({...t,[e]:{...$7(e),status:`unknown`}}));return}O(t=>({...t,[e]:{projectId:e,branch:t[e]?.branch??null,status:`unknown`,ahead:t[e]?.ahead??0,behind:t[e]?.behind??0,hasUpstream:t[e]?.hasUpstream??!1,canPull:t[e]?.canPull??!1,diffStats:t[e]?.diffStats??null}}))}},[]),An=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r,suppressLoading:i=!1}=t;i||M(t=>({...t,[e]:!0}));try{let t=await dr(e,{refreshRemote:n,signal:r});if(r?.aborted)return;A(n=>({...n,[e]:t}))}catch(t){if(Ye(t))return;t instanceof Ke&&t.status===404&&A(t=>({...t,[e]:null}))}finally{!r?.aborted&&!i&&M(t=>({...t,[e]:!1}))}},[]),Mn=(0,p.useCallback)((e,t)=>{P(n=>({...n,[e]:t}))},[]),Nn=(0,p.useCallback)(async(e,t)=>{A(n=>({...n,[e.id]:t})),e.active_target_kind!==`bundle`&&await kn(e.id),t6(e.id)},[kn]);(0,p.useEffect)(()=>{let e=new AbortController;return(async()=>{let t=vt.current;try{let{tool:n}=await Wr(e.signal);vt.current===t&&d(n)}catch(e){Ye(e)}finally{e.signal.aborted||g(!0)}})(),Ur(e.signal).then(t=>{e.signal.aborted||m(t.length>0?t:Vr())}).catch(()=>{m(Vr())}),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(!ue||_.length>0&&fe===null||Ct.loaded)return;let e=new AbortController;return(async()=>{try{let t=await zr(u,e.signal);if(e.signal.aborted)return;oe(e=>({...e,[u]:{models:t,loaded:!0}}))}catch{}finally{e.signal.aborted||oe(e=>({...e,[u]:{...e[u],loaded:!0}}))}})(),()=>{e.abort()}},[Ct.loaded,u,W,fe,_.length,ue]),(0,p.useEffect)(()=>{let e=new AbortController;return(async()=>{try{let t=await Hn(e.signal);if(e.signal.aborted)return;v(t)}catch(e){Ye(e)||v([])}finally{e.signal.aborted||de(!0)}})(),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(!ue||yt.current===i)return;yt.current=i,et(!1),nt(`idle`),Te(e=>e&&c?.kind===`workspace`&&c.workspace===e.workspace?e:null);let e=r.some(e=>e.kind===`activity-run`),t=r.some(e=>e.kind===`checks`);if(!e&&c?.kind!==`activity-run`&&!bt.current&&J(!1),!t&&c?.kind!==`checks`&&_e(null),window.location.pathname===`/`){let e=_.find(e=>e.id===St.current)??_[0]??null;if(!e){b(null);return}let t=Se[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;b(e.id),Ce(t=>({...t,[e.id]:n})),s({kind:`workspace`,projectId:e.id,workspace:n});return}if(!c)return;let n=_.find(e=>e.id===c.projectId);if(!n)return;b(n.id);let a=c.kind===`workspace`?c.workspace:c.kind===`ticket`||c.kind===`bundle`?`board`:c.kind===`repository-inspection`||c.kind===`bundle-inspection`||c.kind===`ticket-inspection`?Se[n.id]??`board`:c.kind===`chat-session`?`chat`:c.kind===`spec-session`||c.kind===`spec-snapshot`?`spec`:Se[n.id]??`board`;Ce(e=>({...e,[n.id]:a})),bt.current&&c.kind!==`checks`&&(bt.current=!1,J(!0)),(c.kind===`activity-run`||e)&&J(!0),G4(c)!==window.location.pathname&&s(c)},[c,r,i,_,ue,s,Se]),(0,p.useEffect)(()=>{if(c?.kind!==`checks`||!ue)return;let e=_.find(e=>e.id===c.projectId);if(!e)return;let t=new AbortController,n=++xt.current;return nt(`loading`),Jt(e.id,c.batchRunId,t.signal).then(({batch:r})=>{t.signal.aborted||xt.current!==n||(_e({projectId:e.id,targetKind:r.target_kind,targetBundleId:r.target_bundle_id,targetLabel:r.target_label??e.name,definitions:r.selected_definition_snapshots,requiredDefinitionIds:[],preReviewDefinitionIds:[]}),nt(`idle`))}).catch(e=>{if(!Ye(e)){if(e instanceof Ke&&e.status===404){et(!0);return}nt(`error`)}}),()=>t.abort()},[c,_,ue,rt]),(0,p.useEffect)(()=>{if(st(!1),!y||!ct||Y)return;let e=new AbortController,t=async()=>{try{let t=await Gt(y,e.signal);e.signal.aborted||st(t.activeCount>0)}catch(e){Ye(e)}};t();let n=window.setInterval(()=>{t()},H7);return()=>{e.abort(),window.clearInterval(n)}},[y,Y,ct]),(0,p.useEffect)(()=>{if(ue){if(y){St.current=y,window.localStorage.setItem(R7,y);return}window.localStorage.removeItem(R7)}},[y,ue]),(0,p.useEffect)(()=>{window.localStorage.setItem(z7,JSON.stringify(Se))},[Se]),(0,p.useEffect)(()=>{window.localStorage.setItem(B7,JSON.stringify(L))},[L]),(0,p.useEffect)(()=>{window.localStorage.setItem(V7,JSON.stringify(z))},[z]),(0,p.useEffect)(()=>{O(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),A(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),M(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[_]),(0,p.useEffect)(()=>{xe(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[_]),(0,p.useEffect)(()=>{let e=new Set(_.map(e=>e.id));ze(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),Be(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),He(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),K(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t))))},[_]),(0,p.useEffect)(()=>{ue&&(I(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),R(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),ee(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}))},[_,ue]),(0,p.useEffect)(()=>{ue&&Ce(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[_,ue]),(0,p.useEffect)(()=>{if(!ue||!y||!tn)return;let e=!1,t=null,n=null;O(e=>e[y]?e:{...e,[y]:$7(y)});let r=async(r=!1)=>{let i=r?`remote`:`local`;if(t){if(n===`remote`||n===i)return;t.abort()}let a=new AbortController;t=a,n=i;try{await Promise.all([kn(y,{refreshRemote:r,signal:a.signal}),An(y,{refreshRemote:r,signal:a.signal})])}catch{if(e||a.signal.aborted)return}finally{t===a&&(t=null,n=null)}};r(!1);let i=$b(()=>{document.visibilityState===`visible`&&r(!1)});return()=>{e=!0,t?.abort(),i()}},[y,tn,ue,kn,An]),(0,p.useEffect)(()=>{if(y)return n6(e=>{e===y&&(kn(e),An(e))})},[y,kn,An]),(0,p.useEffect)(()=>{if(!y||!tn)return;let e=dn?.operation_state??`idle`;if(!(pn===`rebase`||e!==`idle`))return;let t=!1,n=null,r=null,i=async()=>{r?.abort(),r=new AbortController;try{await An(y,{signal:r.signal,suppressLoading:!0})}catch{}finally{t||(n=window.setTimeout(()=>{i()},Zge))}};return i(),()=>{t=!0,r?.abort(),n!==null&&window.clearTimeout(n)}},[pn,y,dn?.operation_state,tn,An]);let Pn=(0,p.useCallback)(async e=>{let t=y;if(!t){S(null),E(null);return}try{let n=await nn(t,e);e?.aborted||(S(n.active_run),E(t))}catch(e){Ye(e)}},[y]),Fn=(0,p.useCallback)(async e=>{let t=y;if(t)try{let n=await Bt(t,e);e?.aborted||I(e=>({...e,[t]:n}))}catch(e){Ye(e)}},[y]);(0,p.useEffect)(()=>{if(!ue)return;if(!on){S(null),E(null);return}if(!cn)return;let e=new AbortController;E(null),Pn(e.signal);let t=window.setInterval(()=>{Pn(e.signal)},H7),n=$b(()=>{document.visibilityState===`visible`&&Pn(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[cn,on,ue,Pn]),(0,p.useEffect)(()=>{if(!ue||!y||!cn||!wn)return;let e=new AbortController;Fn(e.signal);let t=window.setInterval(()=>{Fn(e.signal)},H7),n=$b(()=>{document.visibilityState===`visible`&&Fn(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[y,cn,wn,ue,Fn]),(0,p.useEffect)(()=>{window.localStorage.setItem(U7,String(B))},[B]),(0,p.useEffect)(()=>{window.localStorage.setItem(W7,te)},[te]),(0,p.useEffect)(()=>{window.localStorage.setItem(G7,String(U))},[U]),(0,p.useEffect)(()=>{y&&Sn&&ee(e=>{let t=e[y]??null;return!t||t===Sn?e:{...e,[y]:null}})},[y,Sn]),(0,p.useEffect)(()=>{!y||!xn||!x8(kt)||Cn!==xn.context_key&&R(e=>t9(e,y)===`hidden`?{...e,[y]:`inline`}:e)},[kt,y,Cn,xn]);let In=async e=>{let t=vt.current+1;vt.current=t;try{let n=await Gr(e);if(vt.current!==t)return;d(n.tool)}catch{}},Ln=(0,p.useCallback)(e=>{v(t=>t.map(t=>t.id===e.id?e:t))},[]),Rn=(0,p.useCallback)((e,t)=>{ze(n=>{let r=[t,...(n[e]??[]).filter(e=>e.id!==t.id)];return{...n,[e]:r}})},[]),zn=(0,p.useCallback)(async e=>{K(t=>({...t,[e]:!0}));try{let t=await Jn(e);He(n=>({...n,[e]:t}))}catch(e){$.error(e instanceof Ke?e.message:`Unable to load the project target options right now.`,{id:`project-target-selector-load-error`})}finally{K(t=>({...t,[e]:!1}))}},[]),Bn=async e=>{try{let t=await Un(Z7(e));return v(e=>[...e,t]),b(t.id),s({kind:`workspace`,projectId:t.id,workspace:`board`}),pe(null),null}catch(e){return e instanceof Ke?e.message:`Unable to create the project right now.`}},Vn=async e=>{if(!kt)return`Select a project before editing settings.`;try{let t=Z7(e);delete t.build_execution_provider;let n=await Wn(kt.id,t);return v(e=>e.map(e=>e.id===n.id?n:e)),je(e=>e+1),pe(null),null}catch(e){return e instanceof Ke?e.message:`Unable to update the project right now.`}},$n=async()=>{if(!kt)return`Select a project before deleting it.`;try{await Kn(kt.id);let e=_.filter(e=>e.id!==kt.id);return v(e),b(e[0]?.id??null),e[0]&&s({kind:`workspace`,projectId:e[0].id,workspace:`board`}),pe(null),null}catch(e){return e instanceof Ke?e.message:`Unable to delete the project right now.`}},ir=(0,p.useCallback)(e=>{v(t=>t.map(t=>f_e(t,e)))},[]),ar=(0,p.useCallback)((e,t)=>{e&&ze(n=>({...n,[e]:t}))},[]),or=(0,p.useCallback)((e,t)=>{e&&Be(n=>({...n,[e]:t}))},[]),sr=async(e,t,n)=>await Xn({repo_path:e,tool:u,helper_models:yw({},u,{model:t||null,variant:t&&n||null})}),cr=async()=>(await Zn()).repo_path,lr=(0,p.useCallback)(async e=>{let t=await Qn({repo_path:e});return{valid:t.valid,repoRoot:t.repo_root,error:t.error,willInitialize:t.will_initialize,hasInitialCommit:t.has_initial_commit}},[]),ur=(0,p.useCallback)(async()=>{if(!(!kt||ve)){ye(!0);try{let e=await Gn(kt.id);v(t=>t.map(t=>t.id===e.id?e:t)),$.success(`Initial commit created.`,{id:`project-initial-commit-success`}),kn(e.id),An(e.id)}catch(e){$.error(e instanceof Ke?e.message:`Unable to create the initial commit right now.`,{id:`project-initial-commit-error`})}finally{ye(!1)}}},[kt,ve,kn,An]),fr=(0,p.useCallback)((e,t)=>{R(t=>({...t,[e]:`hidden`})),t&&ee(n=>({...n,[e]:t}))},[]),pr=(0,p.useCallback)(()=>{y&&fr(y,Sn)},[y,fr,Sn]),mr=(0,p.useCallback)(e=>{y&&(R(e=>({...e,[y]:`hidden`})),e&&S(t=>t?.context_key===e?null:t))},[y]),hr=(0,p.useCallback)(async()=>{if(!xn||re===xn.context_key)return;let{context_key:e}=xn;ie(e);try{xn.kind===`ticket`?await jn(xn.ticket_id,xn.project_id):S((await an(xn.project_id)).active_run),mr(e),await Promise.all([Pn(),Fn()])}catch(e){$.error(e instanceof Ke?e.message:`Unable to stop the preview run right now.`,{id:`app-preview-run-stop-error`})}finally{ie(t=>t===e?null:t)}},[mr,xn,Fn,Pn,re]),gr=(0,p.useCallback)(e=>{!e||!y||zn(y)},[y,zn]),_r=(0,p.useCallback)(e=>new Promise(t=>{gt.current=t,dt(e)}),[]),vr=(0,p.useCallback)(e=>{let t=gt.current;gt.current=null,dt(null),t?.(e)},[]),yr=(0,p.useCallback)(async e=>{if(!kt||!y)throw Error(`Select a project first.`);if(!x_e({activeProject:kt,activeProjectBranchState:un,nextTarget:e})||!x||x.kind!==`project`||x.project_id!==kt.id)return!0;if(!await _r({title:`Stop current run and switch target?`,description:`Switching targets will stop the current run and close its preview.`,confirmLabel:`Stop and switch`,cancelLabel:`Keep current target`,confirmVariant:`destructive`}))return!1;try{let e=x.context_key,t=await an(kt.id);return mr(e),S(t.active_run),await Fn(),!0}catch(e){return $.error(e instanceof Ke?e.message:`Unable to stop the project run right now.`,{id:`project-target-switch-stop-run-error`}),!1}},[kt,un,y,x,mr,Fn,_r]),br=(0,p.useCallback)(async e=>{if(!y)throw Error(`Select a project first.`);return await yr({kind:`bundle`,bundleId:e})?(Ln(await Yn(y,{kind:`bundle`,bundle_id:e})),A(e=>({...e,[y]:null})),await Promise.all([kn(y),An(y)]),!0):!1},[y,yr,kn,An,Ln]),xr=(0,p.useCallback)(async(e,t={})=>{if(!y)throw Error(`Select a project first.`);if(!await yr({kind:`repo_root`,branch:e}))return!1;let n=n=>Yn(y,{kind:`repo_root`,...e?{branch:e}:{},...t.createBranch===!1?{create_branch:!1}:{},...n?{confirm_dirty_switch:!0}:{}}),r;try{r=await n(t.confirmDirtySwitch===!0)}catch(e){if(!t.confirmDirtySwitch&&e instanceof Ke&&e.status===409&&e.message===r9){if(!await _r({title:`Switch repo root branch?`,description:`${r9}\n\nSwitch anyway?`,confirmLabel:`Switch anyway`,cancelLabel:`Keep current branch`}))return!1;r=await n(!0)}else throw e}return Ln(r),A(e=>({...e,[y]:null})),await Promise.all([kn(y),An(y),zn(y)]),!0},[y,yr,zn,kn,An,Ln,_r]),Sr=(0,p.useCallback)(async e=>!e.target_kind||e.target_available===!1?!0:e.target_kind===`bundle`?e.target_bundle_id?await br(e.target_bundle_id):!1:await xr(e.target_branch_snapshot??null,{createBranch:!1}),[br,xr]),Cr=(0,p.useCallback)(async e=>{y&&await br(e)&&Kt({workspace:`chat`,startNewDraft:!0})},[y,br,Kt]),wr=(0,p.useCallback)(()=>{Ge(!0)},[]),Tr=(0,p.useCallback)(()=>{Ge(!1)},[]),Er=(0,p.useCallback)(e=>{if(e){br(e);return}xr(null)},[br,xr]),Dr=(0,p.useCallback)(async e=>{if(!y)throw Error(`Select a project first.`);let t=await _t(y,{name:e,prepare:!0});return Rn(y,t),je(e=>e+1),t},[y,Rn]),Or=(0,p.useCallback)(async e=>{if(!y)throw Error(`Select a project first.`);let t=await Ft(y,e);t.warning&&$.warning(t.warning,{id:`bundle-delete-warning`}),ze(t=>({...t,[y]:(t[y]??[]).filter(t=>t.id!==e)})),je(e=>e+1)},[y]),kr=(0,p.useCallback)(async(e=`project_default`,t=!1)=>{if(!kt)return;let n=kt.active_target_kind??`repo_root`,r=kt.active_target_bundle_id??null,i=x?.kind===`project`&&x.project_id===kt.id&&(x.target_kind??`repo_root`)===n&&((x.target_kind??`repo_root`)!==`bundle`||x.target_bundle_id===r),a=i?x?.context_key??null:null;if(!i&&!t&&S8(kt)){pt(!0);return}let o=!i&&x8(kt)&&yn===`hidden`;o&&(R(e=>({...e,[kt.id]:`inline`})),ee(e=>({...e,[kt.id]:null})));try{let t=i?await an(kt.id):await rn(kt.id,e);i&&mr(a),S(t.active_run),Fn()}catch(e){o&&R(e=>({...e,[kt.id]:`hidden`})),$.error(e instanceof Ke?e.message:`Unable to update the project run right now.`,{id:`app-project-run-error`})}},[yn,kt,x,mr,Fn]),Ar=(0,p.useCallback)(async()=>{if(!(!kt||!sn))try{await qn(kt.id)}catch(e){$.error(e instanceof Error?e.message:`Unable to open the IDE right now.`,{id:`app-project-open-ide-error`})}},[kt,sn]),jr=(0,p.useCallback)(async()=>{if(kt){Mn(kt.id,`pull`);try{let e=await tr(kt.id);await Nn(kt,e),$.success(e.behind===0?L7(`branchSynced`):L7(`branchUpdated`),{id:`app-project-pull-success`})}catch(e){$.error(e instanceof Ke?e.message:L7(`syncFallbackError`),{id:`app-project-pull-error`})}finally{Mn(kt.id,null)}}},[kt,Nn,Mn]),Mr=(0,p.useCallback)(async()=>{if(!kt)return;let e=dn?.base_branch??null;Mn(kt.id,`rebase`);try{let t=await nr(kt.id);await Nn(kt,t);let n=t.base_branch??e;$.success(n?L7(`branchRebasedOnto`,{branch:n}):L7(`branchRebased`),{id:`app-project-rebase-success`})}catch(e){await Promise.allSettled([kn(kt.id),An(kt.id,{suppressLoading:!0})]),$.error(e instanceof Ke?e.message:L7(`rebaseFallbackError`),{id:`app-project-rebase-error`})}finally{Mn(kt.id,null)}},[kt,dn?.base_branch,Nn,kn,An,Mn]),Nr=(0,p.useCallback)(async()=>{if(kt){Mn(kt.id,`abort`);try{await Nn(kt,await rr(kt.id)),$.success(L7(`gitOperationAborted`),{id:`app-project-abort-success`})}catch(e){$.error(e instanceof Ke?e.message:L7(`abortFallbackError`),{id:`app-project-abort-error`})}finally{Mn(kt.id,null)}}},[kt,Nn,Mn]),Pr=(0,p.useCallback)(e=>{kt&&a(kt.active_target_kind===`bundle`&&kt.active_target_bundle_id?{kind:`bundle-inspection`,projectId:kt.id,bundleId:kt.active_target_bundle_id,mode:e}:{kind:`repository-inspection`,projectId:kt.id,mode:e})},[kt,a]),Fr=(0,p.useCallback)(()=>{if(c?.kind!==`repository-inspection`)return;let{projectId:e}=c;n(c,{kind:`workspace`,projectId:e,workspace:`board`}),kn(e),An(e)},[n,c,kn,An]),Ir=(0,p.useCallback)(()=>{if(!kt)return;let e=kt.active_target_kind??`repo_root`,t=kt.active_target_bundle_id??null,n=e===`bundle`?mn.find(e=>e.id===t):null,r=n?.required_check_policy;_e({projectId:kt.id,targetKind:e,targetBundleId:t,targetLabel:n?My(n):kt.name,definitions:uw(kt),requiredDefinitionIds:r?.required_check_definition_ids??dw(kt),preReviewDefinitionIds:r?.pre_review_check_definition_ids??fw(kt)})},[kt,mn]),Lr=(0,p.useCallback)(()=>{_e(null),c?.kind===`checks`&&n(c)},[n,c]),Rr=(0,p.useCallback)(()=>{J(!1),_e(null),c?.kind===`activity-run`&&n(c)},[n,c]),Br=(0,p.useCallback)(()=>{c?.kind===`activity-run`&&(bt.current=!0,n(c))},[n,c]),Hr=(0,p.useCallback)(()=>{et(!0)},[]),Kr=(0,p.useCallback)((e,t)=>{if(!y)return;if(e.kind===`check_batch`){a({kind:`checks`,projectId:y,batchRunId:e.id});return}if(e.kind===`check_attempt`&&t){a({kind:`checks`,projectId:y,batchRunId:t,attemptRunId:e.id});return}let n={kind:`activity-run`,projectId:y,runId:e.id};c?.kind===`activity-run`?s(n):a(n)},[y,c,a,s]),qr=(0,p.useCallback)(e=>{if(!y)return;if(e.kind===`source_batch`||e.kind===`verification_batch`||e.kind===`required_check_gate`){Je&&c?.kind!==`activity-run`&&(bt.current=!0),a({kind:`checks`,projectId:y,batchRunId:e.executionRunId});return}let t={kind:`activity-run`,projectId:y,runId:e.executionRunId};c?.kind===`activity-run`?s(t):a(t)},[y,c,Je,a,s]),Jr=(0,p.useCallback)((e,t)=>{if(!y)return;let n={kind:`checks`,projectId:y,batchRunId:e,attemptRunId:t};if(c?.kind===`checks`){G4(c)!==G4(n)&&s(n);return}a(n)},[y,c,a,s]),Yr=e9(be,y),Xr=kt?mw(kt).length>0:!1,Zr=kt?uw(kt).length>0:!1,Qr=Mt===`chat`?Ie:null,$r=ht.current,ei=$r?.target?.kind??null,ti=Mt===`chat`?ei===`ticket`||ei===`bundle`?{target:$r?.target??null,canSelect:!1,disabledReason:`This preview belongs to a ticket run. Return to Board to send preview comments.`,promptMode:$r?.promptMode??null,onPromptModeChange:$r?.onPromptModeChange??null,isUpdatingPromptMode:$r?.isUpdatingPromptMode??!1,promptPlaceholder:$r?.promptPlaceholder??null,promptComposerControls:$r?.promptComposerControls,promptComposerInlineControls:$r?.promptComposerInlineControls,submitPrompt:null}:Qr?{target:{kind:`chat_session`,id:Qr.chatSessionId??`draft:${y}`},canSelect:Qr.canSubmitReviewPrompt,disabledReason:Qr.canSubmitReviewPrompt?null:Qr.reviewSubmitDisabledReason??`Wait for the current chat turn to finish before sending preview comments.`,promptMode:Qr.mode,onPromptModeChange:Qr.onModeChange,isUpdatingPromptMode:Qr.isUpdatingMode,promptPlaceholder:Qr.promptPlaceholder,promptComposerControls:Qr.promptComposerControls,promptComposerInlineControls:Qr.promptComposerInlineControls,submitPrompt:Qr.canSubmitReviewPrompt?Qr.submitPrompt:null}:{target:null,canSelect:!1,disabledReason:`Select a chat session to send preview comments.`,submitPrompt:null}:Pe,ni=Qr?.canSubmitReviewPrompt??!1,ri=Mt===`chat`?Qr?Qr.reviewSubmitDisabledReason:`Select a chat session to send review comments.`:jb.t(`common:workspaceReviewModal.chatRequired`),ii=(0,p.useCallback)(()=>{y&&xe(e=>{let t=e[y]??K7;return{...e,[y]:{hasMounted:!0,isOpen:!t.isOpen,isExpanded:t.isExpanded}}})},[y]),ai=(0,p.useCallback)(e=>{xe(t=>{let n=t[e]??K7;return!n.hasMounted||!n.isOpen?t:{...t,[e]:K7}})},[]),oi=(0,p.useCallback)(e=>{xe(t=>{let n=t[e]??K7;return{...t,[e]:{hasMounted:!0,isOpen:n.isOpen,isExpanded:!n.isExpanded}}})},[]),si=(0,p.useCallback)(()=>{he(`general`),pe(`create`)},[]),ci=(0,p.useCallback)((e=`general`)=>{he(e),pe(`edit`)},[]),li=(0,p.useCallback)(e=>{let t=Se[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;b(e.id),a({kind:`workspace`,projectId:e.id,workspace:n})},[a,Se]),ui=(0,p.useCallback)(e=>{y&&(c?.kind===`ticket`&&c.ticketId===e||a({kind:`ticket`,projectId:y,ticketId:e}))},[y,c,a]),di=(0,p.useCallback)(()=>{c?.kind===`ticket`&&n(c)},[n,c]),fi=(0,p.useCallback)(e=>{y&&(c?.kind===`bundle`&&c.bundleId===e||a({kind:`bundle`,projectId:y,bundleId:e}))},[y,c,a]),pi=(0,p.useCallback)(()=>{c?.kind===`bundle`&&n(c)},[n,c]),mi=(0,p.useCallback)((e,t)=>{y&&a(e.kind===`ticket`?{kind:`ticket-inspection`,projectId:y,ticketId:e.ticketId,mode:t}:{kind:`bundle-inspection`,projectId:y,bundleId:e.bundleId,mode:t})},[y,a]),hi=(0,p.useCallback)(e=>{if(c?.kind===`repository-inspection`){if(c.mode===e)return;o({...c,mode:e});return}if(c?.kind===`ticket-inspection`||c?.kind===`bundle-inspection`){if(c.mode===e)return;o({...c,mode:e})}},[c,o]),gi=(0,p.useCallback)(()=>{c?.kind!==`ticket-inspection`&&c?.kind!==`bundle-inspection`||n(c)},[n,c]),_i=(0,p.useCallback)(e=>{if(!y)return;let t=e?{kind:`chat-session`,projectId:y,chatSessionId:e}:{kind:`workspace`,projectId:y,workspace:`chat`};c&&G4(c)===G4(t)||a(t)},[y,c,a]),vi=(0,p.useCallback)(e=>{if(!y)return;let t=e?{kind:`spec-session`,projectId:y,specSessionId:e}:{kind:`workspace`,projectId:y,workspace:`spec`};c&&G4(c)===G4(t)||a(t)},[y,c,a]),yi=(0,p.useCallback)(()=>{if(y){if(bn){pr();return}R(e=>({...e,[y]:`inline`})),ee(e=>({...e,[y]:null}))}},[y,pr,bn]),bi=(0,p.useCallback)(()=>{y&&R(e=>{let t=t9(e,y);return{...e,[y]:t===`expanded`?`inline`:`expanded`}})},[y]),xi=kt?kt.preview_service_name?.trim()?kt.preview_capability_mode===`force_disabled`?`Preview is disabled for this project.`:vn?.state===`unsupported`?vn.message??`Preview is unavailable for this project.`:bn?`Hide preview`:`Show preview`:`Choose a named preview service in project settings first.`:`Select a project first.`,Si=!kt||!kt.preview_service_name?.trim()||kt.preview_capability_mode===`force_disabled`||vn?.state===`unsupported`,Ci=kt&&kt.preview_service_name?.trim()?(0,X.jsx)(SM,{project:kt,mode:yn===`expanded`?`expanded`:`inline`,status:vn,viewportPreset:te,zoom:U,activeRun:xn,reviewCapability:ti,isStoppingActiveRun:Tn,onHide:pr,onStopActiveRun:()=>{hr()},onToggleExpanded:bi,onViewportPresetChange:H,onZoomChange:ne}):null;return(0,X.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-[linear-gradient(180deg,_rgba(15,16,21,1),_rgba(9,10,14,1))] text-foreground`,children:[(0,X.jsx)(Zb,{}),_.length>0&&(0,X.jsx)(`header`,{className:`border-b border-border bg-background/95 px-6 py-3 backdrop-blur`,children:(0,X.jsxs)(`div`,{className:`grid items-start gap-3 [grid-template-columns:minmax(0,1fr)_auto] min-[1440px]:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] min-[1440px]:items-center`,children:[(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`div`,{className:`min-w-0 w-full sm:w-[20rem] sm:min-w-[20rem] sm:max-w-[20rem]`,children:(0,X.jsx)(_v,{activeProjectId:y,onCreateProject:si,projects:_,onEditProject:()=>ci(),onProjectChange:e=>{let t=_.find(t=>t.id===e);t&&li(t)}})}),y&&(0,X.jsx)(rC,{projectId:y,onStartSpecFromDraft:Qt,onCreateTicketFromDraft:$t})]})}),(0,X.jsx)(`div`,{className:`min-w-0 justify-self-end min-[1440px]:col-start-3 min-[1440px]:row-start-1`,children:(0,X.jsx)(Db,{activeTool:u,agents:f,onMobileAccessOpen:()=>q(!0),onOpenActivity:()=>J(!0),onOpenExecutionRuntimes:()=>Ze(!0),onToolChange:In,...ct?{hasActiveGitHubRuns:ot,onOpenGitHubActions:()=>Qe(!0)}:{}})}),y&&(0,X.jsx)(`div`,{className:`col-span-2 flex min-w-0 justify-center min-[1440px]:col-span-1 min-[1440px]:col-start-2 min-[1440px]:row-start-1 min-[1440px]:justify-self-center`,children:(0,X.jsx)(zge,{activeWorkspace:Mt,activityByWorkspace:Ee,className:`w-fit max-w-full`,memoryEnabled:At,onWorkspaceChange:e=>{y&&(Ce(t=>({...t,[y]:e})),De(t=>x7(t,e)),a({kind:`workspace`,projectId:y,workspace:e}))}})})]})}),!ue||zt?(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Loading projects...`}):Vt||Rt?(0,X.jsx)(pv,{isTransientError:Rt,requestedProjectExists:Pt!==null,retainedProject:Ht?.id===Pt?.id?null:Ht,defaultProject:Ut,onCreateProject:si,onRetry:()=>it(e=>e+1),onOpenProject:e=>{let t=Se[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;b(e.id),s({kind:`workspace`,projectId:e.id,workspace:n})},onOpenWorkspace:()=>{if(!Pt)return;let e=o_e(c),t=e===`memory`&&!Pt.memory_enabled?`board`:e;b(Pt.id),s({kind:`workspace`,projectId:Pt.id,workspace:t})}}):_.length===0?(0,X.jsx)(fv,{activeTool:u,agents:f,availableHelperModels:wt,helperModel:Et,helperVariant:Dt,isHelperModelsLoaded:Tt,isToolLoaded:h,onCreateProject:si,onHelperModelChange:e=>{le(t=>({...t,[u]:{model:e,variant:``}}))},onHelperVariantChange:e=>{le(t=>({...t,[u]:{...t[u],variant:e}}))},onToolChange:In}):(0,X.jsxs)(X.Fragment,{children:[kt?.has_initial_commit===!1&&(0,X.jsx)(pC,{isSubmitting:ve,onCreateInitialCommit:()=>{ur()}}),(0,X.jsx)(Lge,{activeProjectId:y,activeProject:kt,activeProjectBranchState:un,targetBundles:mn,targetBranchSuggestions:gn,isTargetBundleLoading:hn,isTargetSelectorLoading:_n,onTargetSelectorOpenChange:gr,onSelectBundleTarget:br,onSelectRepoRootTarget:xr,activeRun:x,activeTool:u,onOpenProjectExecutionSettings:()=>ci(`execution`),onRestoreSessionTarget:Sr,onChatReviewCapabilityChange:Le,routedInspectionReviewCapability:Mt===`chat`?Ie:null,isPreviewButtonDisabled:Si,onPreviewReviewCapabilityChange:Fe,onPreviewToggle:yi,onRunStopped:mr,onWorkspaceActivityChange:De,onWorkspaceActivityEvent:On,pendingWorkspaceNavigation:we,onPendingWorkspaceNavigationConsumed:en,routedTicketId:c?.kind===`ticket`?c.ticketId:null,routedModalStack:r,onRoutedTicketOpen:ui,onRoutedTicketClose:di,onRoutedTicketUnavailable:Hr,routedBundleId:c?.kind===`bundle`?c.bundleId:null,routedChatSessionId:c?.kind===`chat-session`?c.chatSessionId:void 0,routedSpecSessionId:c?.kind===`spec-session`||c?.kind===`spec-snapshot`?c.specSessionId:void 0,routedSpecSnapshotId:c?.kind===`spec-snapshot`?c.specSnapshotId:void 0,routedInspection:c?.kind===`ticket-inspection`?{target:{kind:`ticket`,ticketId:c.ticketId},mode:c.mode}:c?.kind===`bundle-inspection`?{target:{kind:`bundle`,bundleId:c.bundleId},mode:c.mode}:null,onRoutedBundleOpen:fi,onRoutedBundleClose:pi,onRoutedInspectionOpen:mi,onRoutedInspectionModeChange:hi,onRoutedInspectionClose:gi,onChatSessionNavigation:_i,onSpecSessionNavigation:vi,onRoutedEntityUnavailable:Hr,onSpecImplementationChatReady:qt,onViewSourceSpec:Yt,onNavigateToLifecycleSource:Zt,onViewMemorySource:Xt,onStartChatFromBundle:Cr,previewDisplayMode:yn,previewPane:Ci,previewPaneWidth:B,previewButtonTitle:xi,visibleWorkspace:Mt,refreshKey:Ae,boardFilterState:Me,onBoardFilterStateChange:Ne,onBoardLoadedProjectIdChange:w,onBundlesChange:ar,onBundlesLoadingChange:or,onPreviewPaneWidthChange:V,onProjectUsageChange:ir,onRunStatusChange:()=>{Pn(),Fn()}},y??`no-project`)]}),_.length>0&&(0,X.jsx)(Ly,{activeProject:kt,activeRun:x,branchState:un,targetGitStatus:dn,isBoardLoadedForActiveProject:cn,activeProjectBranchAction:pn,isProjectIdeAvailable:sn,isProjectRunAvailable:on,isRunStatusLoadedForActiveProject:ln,isTerminalOpen:Yr.isOpen,targetBundles:mn,targetBranchSuggestions:gn,isTargetBundleLoading:hn,isTargetSelectorLoading:_n,isTargetGitStatusLoading:fn,hasConfiguredTests:Xr,hasConfiguredChecks:Zr,onProjectIdeOpen:()=>{Ar()},onProjectPull:()=>{jr()},onProjectRebase:Mr,onProjectAbortGitOperation:Nr,onProjectRunToggle:()=>{kr()},onProjectFilesOpen:()=>Pr(`files`),onProjectChangesOpen:()=>Pr(`changes`),onProjectVerificationOpen:Ir,onTerminalToggle:ii,onTargetSelectorOpenChange:gr,onSelectBundleTarget:br,onSelectRepoRootTarget:xr,onManageBundles:wr}),(0,X.jsx)(dre,{activeProjectId:y,open:qe,onOpenChange:q}),(Je||l)&&y&&!Vt&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(i_e,{projectId:y,initialRunId:l?.runId??null,initialEventId:l?.eventId??null,onClose:Rr,onDetailsClose:Br,onRunSelectionChange:Kr,onRelatedReferenceSelection:qr,onUnavailable:c?.kind===`activity-run`?Hr:void 0,onNavigateToLifecycleSource:Zt})}),Y&&y&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(r_e,{projectId:y,defaultBranch:lt,onClose:()=>Qe(!1)})}),We&&kt&&(0,X.jsx)(EC,{bundles:mn,selectedBundleId:kt.active_target_kind===`bundle`?kt.active_target_bundle_id??null:null,activeTargetBundleId:kt.active_target_kind===`bundle`?kt.active_target_bundle_id??null:null,onSelectBundle:Er,onCreateBundle:Dr,onDeleteBundle:Or,onClose:Tr}),ut&&(0,X.jsx)(dC,{title:ut.title,description:ut.description,confirmLabel:ut.confirmLabel,cancelLabel:ut.cancelLabel,confirmVariant:ut.confirmVariant,onConfirm:()=>vr(!0),onCancel:()=>vr(!1)}),ft&&(0,X.jsx)(fC,{onSelect:e=>{pt(!1),e&&kr(e,!0)}}),_.map(e=>{let t=e9(be,e.id);return t.hasMounted?(0,X.jsx)(Rge,{project:e,isExpanded:t.isExpanded,isVisible:e.id===y&&t.isOpen,onClose:()=>ai(e.id),onToggleExpanded:()=>oi(e.id)},e.id):null}),fe&&(0,X.jsx)(vE,{activeTool:u,activeAgentName:f.find(e=>e.id===u)?.displayName??u,mode:fe,initialSection:me,projectId:fe===`edit`&&kt?kt.id:null,availableHelperModels:wt,isLoadingHelperModels:!Tt,onRetryValidationModels:Ot,isAutoConfigReady:h,initialValues:fe===`edit`&&kt?c_e(kt,u):_.length===0?{name:``,repoPath:``,linkedProjectIds:[],runSetup:[],runServices:[],checkDefinitions:[],runIde:``,previewServiceName:``,previewPath:``,previewCapabilityMode:`auto`,helperModel:Et,helperVariant:Dt,helperModels:yw({},u,{model:Et||null,variant:Et&&Dt||null}),reviewerModels:{},commitMessageRules:``,commitAfterEachTicket:!1,autoParkStaleTickets:!1,memoryEnabled:!1,worktreeSync:[],specAwareCodeReviewEnabled:!1,automationDepth:`manual`,automationReviewFixEnabled:!1,automationPauseOnOpenQuestions:!1,automationReviewSeverity:`medium`,automationReviewMaxIterations:3}:void 0,linkedProjectOptions:_.filter(e=>e.id!==kt?.id).map(e=>({id:e.id,name:e.name})),repoPathLocked:fe===`edit`&&kt?kt.repo_path_locked:!1,repoPathLockedMessage:fe===`edit`&&kt?u_e(kt):null,deleteBlockedMessage:fe===`edit`&&kt?d_e(kt,_):null,onDelete:fe===`edit`?$n:void 0,onAutoConfig:sr,onBrowseRepoPath:cr,onValidateRepoPath:lr,onOpenExecutionRuntimes:()=>Ze(!0),onExecutionProfileSaved:(e,t)=>{v(n=>n.map(n=>n.id===e?{...n,build_execution_provider:t}:n))},onClose:()=>pe(null),onSubmit:fe===`edit`?Vn:Bn}),Xe&&(0,X.jsx)(Jb,{onClose:()=>Ze(!1)}),It&&It.projectId===y&&kt&&un?.status!==`loading`&&!Vt&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(t_e,{target:{scope:`project_root`},initialMode:It.mode,reviewMode:It.mode,onReviewModeChange:hi,enabledModes:[`changes`,`files`],projectId:It.projectId,targetKind:`repo_root`,reviewCommentsBundleId:null,title:kt.name,bundleTargetName:null,hasHelperModel:!!(kt.helper_models?.[u]?.model??(u===`opencode`?kt.helper_model:null)),repoRootDefaultBranch:gn.default_branch,onSubmitReviewPrompt:Qr?.submitPrompt,canSubmitReviewPrompt:ni,reviewSubmitDisabledReason:ri??void 0,canAddReviewComments:ni,canModifyChanges:!0,mode:Qr?.mode,onModeChange:Qr?.onModeChange,canToggleMode:!!Qr?.canSubmitReviewPrompt,isUpdatingMode:Qr?.isUpdatingMode??!1,onClose:Fr})}),ge&&(!Je||c?.kind===`checks`)&&!Vt&&ge.projectId===y&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(n_e,{targetLabel:ge.targetLabel,definitions:ge.definitions,requiredDefinitionIds:ge.requiredDefinitionIds,preReviewDefinitionIds:ge.preReviewDefinitionIds,checksTarget:{projectId:ge.projectId,targetKind:ge.targetKind,targetBundleId:ge.targetBundleId},requestedInitialTab:c?.kind===`checks`?`checks`:void 0,directBatchRunId:c?.kind===`checks`?c.batchRunId:null,directAttemptRunId:c?.kind===`checks`?c.attemptRunId:null,onCheckSelectionChange:c?.kind===`checks`?Jr:void 0,onUnavailable:c?.kind===`checks`?Hr:void 0,testsTarget:{scope:`project`,projectId:ge.projectId,targetKind:ge.targetKind,targetBundleId:ge.targetBundleId},onClose:Lr,onOpenActivity:()=>{if(xt.current+=1,_e(null),c?.kind===`checks`){r.some(e=>e.kind===`activity-run`)?(J(!0),n(c)):(bt.current=!0,s({kind:`workspace`,projectId:c.projectId,workspace:`board`}));return}J(!0)}})})]})},i9=`X-Archon-Mobile-CSRF`,C_e=async(e,t={})=>{let n=await fetch(e,{credentials:`include`,...t});if(!n.ok){let e=null;try{e=await n.clone().json()}catch{}throw new Ke(await Xe(n,`Mobile request failed.`),n.status,e)}return n},a9=async(e,t={})=>await(await C_e(e,t)).json(),o9=e=>a9(`/mobile/projects`,{signal:e}),w_e=e=>a9(`/mobile/tool`,{signal:e}),T_e=(e,t)=>a9(`/mobile/tool`,s9(t,{tool:e})),E_e=async e=>Hr(await a9(`/mobile/agents`,{signal:e,cache:`no-store`})),D_e=(e,t)=>a9(`/mobile/projects/${encodeURIComponent(e)}/summary`,{signal:t}),O_e=async(e,t)=>{let n=[],r=null;do{let i=r?`?cursor=${encodeURIComponent(r)}`:``,a=await a9(`/mobile/projects/${encodeURIComponent(e)}/approval-requests${i}`,{signal:t});n.push(...a.approval_requests),r=a.next_cursor}while(r);return{approval_requests:n,next_cursor:null}},k_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/approval-requests/${encodeURIComponent(t)}`,{signal:n}),A_e=(e,t,n,r,i)=>a9(`/mobile/projects/${encodeURIComponent(e)}/approval-requests/${encodeURIComponent(t.id)}/${n}`,s9(r,{expected_action_fingerprint:t.action_fingerprint,...i?.trim()?{reason:i.trim()}:{}})),j_e=(e,t)=>a9(`/mobile/projects/${encodeURIComponent(e)}/target-options`,{signal:t}),M_e=(e,t)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,{signal:t}),N_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,{signal:n}),P_e=(e,t)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets`,{signal:t}),F_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,{signal:n}),I_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/agent-runs`,{signal:n}),L_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),R_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),z_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}`,{signal:n}),B_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/build`,s9(n)),V_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/review`,s9(n)),s9=(e,t,n=`POST`)=>({method:n,headers:{"Content-Type":`application/json`,[i9]:e},body:t===void 0?void 0:JSON.stringify(t)}),H_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,s9(t,n)),U_e=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/messages`,s9(n,r)),W_e=(e,t,n,r,i)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,s9(r,i)),G_e=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,s9(n,r,`PATCH`)),K_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/stop`,s9(n)),q_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/resume`,s9(n)),J_e=(e,t)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,{signal:t}),Y_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,{signal:n}),X_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,s9(t,n)),c9=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/messages`,s9(n,r)),Z_e=(e,t,n,r,i)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,s9(r,i)),Q_e=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,s9(n,r,`PATCH`)),$_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/stop`,s9(n)),eve=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/resume`,s9(n)),l9=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/state`,s9(n,{state:r},`PATCH`)),tve=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/run`,s9(n)),nve=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop`,s9(n)),u9=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop-build`,s9(n)),d9=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/resume-build`,s9(n)),rve=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,s9(n,r,`PATCH`)),ive=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-follow-up`,s9(n,{instruction:r})),ave=(e,t,n,r,i)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,s9(r,i)),ove=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/follow-up`,s9(n,{instruction:r})),sve=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/follow-up`,s9(n,{instruction:r})),f9=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/target`,s9(t,n)),cve=(e,t)=>a9(`/mobile/models?tool=${encodeURIComponent(e)}`,{signal:t}),lve=(e,t,n)=>{let r=new URLSearchParams({tool:e});return t&&r.set(`project_id`,t),a9(`/mobile/skills?${r.toString()}`,{signal:n})},uve=({className:e})=>(0,X.jsx)(ete,{"aria-hidden":`true`,className:e}),p9=e=>jb.t(`common:mobileApp.${e}`),dve={key:`overview`,label:p9(`navigation.overview`),Icon:uve},m9={key:`tickets`,label:p9(`navigation.tickets`),Icon:L5,ctaAriaLabel:p9(`overviewActions.ticketsAriaLabel`)},h9={key:`chats`,label:p9(`navigation.chats`),Icon:AE,ctaAriaLabel:p9(`overviewActions.chatsAriaLabel`)},g9={key:`spec`,label:p9(`navigation.spec`),Icon:eC,ctaAriaLabel:p9(`overviewActions.specAriaLabel`)},fve=[dve,m9,h9,g9],pve=({children:e})=>(0,X.jsx)(`main`,{className:`min-h-screen bg-background text-foreground`,children:(0,X.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-lg items-center px-4 py-8`,children:(0,X.jsx)(`div`,{className:`w-full`,children:e})})}),_9=({title:e,description:t,children:n})=>(0,X.jsx)(pve,{children:(0,X.jsxs)(gC,{className:`w-full border-border/80 bg-card/90 shadow-2xl shadow-black/20`,children:[(0,X.jsxs)(_C,{children:[(0,X.jsx)(vC,{children:e}),(0,X.jsx)(yC,{children:t})]}),n&&(0,X.jsx)(xC,{className:`space-y-4`,children:n})]})}),mve=e=>e===`connected`?{label:`Connected`,variant:`success`,indicatorState:`finished`}:e===`reconnecting`?{label:`Reconnecting`,variant:`warning`,indicatorState:`running`}:e===`unavailable`?{label:`Offline`,variant:`destructive`,indicatorState:`error`}:{label:`Connecting`,variant:`outline`,indicatorState:`running`},hve=({status:e})=>{let t=mve(e);return(0,X.jsxs)(hC,{variant:t.variant,className:`gap-1.5 px-2.5 py-1 text-[11px] uppercase tracking-[0.14em]`,children:[(0,X.jsx)(Hy,{state:t.indicatorState,className:`mt-0`}),t.label]})},gve=({status:e,onRetry:t})=>e===`connected`?null:e===`unavailable`?(0,X.jsx)(gC,{className:`border-red-500/25 bg-destructive/10 shadow-none`,children:(0,X.jsxs)(xC,{className:`flex flex-col gap-3 pt-5`,children:[(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-red-100`,children:`Desktop Archon is currently unreachable.`}),(0,X.jsx)(`p`,{className:`text-sm text-red-200/85`,children:`Mobile access may have been disabled, the backend may have restarted, or this phone lost network access.`})]}),(0,X.jsx)(`div`,{children:(0,X.jsx)(Q,{variant:`warning`,onClick:t,children:`Retry connection`})})]})}):(0,X.jsx)(gC,{className:`border-amber-500/25 bg-amber-500/10 shadow-none`,children:(0,X.jsx)(xC,{className:`pt-5 text-sm text-amber-100`,children:e===`connecting`?`Connecting to live updates from desktop Archon...`:`Reconnecting to desktop Archon. Existing content stays visible while this phone reconnects.`})}),_ve=({activeTool:e,agents:t,selectedProject:n,targetLabel:r,isTargetLoading:i,isTargetDisabled:a,connectionState:o,onOpenProjects:s,onOpenTargetSelector:c,onToolChange:l})=>(0,X.jsx)(`header`,{className:`sticky top-0 z-20 border-b border-border/70 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/85`,children:(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-3 px-3 pb-3 pt-4 sm:px-4`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-label":`Choose project`,className:`min-w-0 flex-1 text-left`,onClick:s,children:[(0,X.jsx)(`div`,{className:`truncate text-base font-medium text-foreground`,children:n?.name??`Choose a project`}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:n?.repo_path??`Select a desktop project to continue`})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(`select`,{"aria-label":jb.t(`common:mobileApp.agentSelector.ariaLabel`),className:`h-8 max-w-28 rounded-lg border border-border bg-background px-2 text-xs text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:e,onChange:e=>l(e.target.value),children:t.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.displayName},e.id))}),(0,X.jsx)(hve,{status:o}),(0,X.jsxs)(Q,{variant:`outline`,size:`sm`,"aria-label":`Choose target`,"data-testid":`mobile-target-trigger`,className:`h-8 max-w-32 gap-2 px-2.5 sm:max-w-40`,disabled:a,onClick:c,children:[(0,X.jsx)(Vv,{className:`h-3.5 w-3.5 shrink-0`}),i?(0,X.jsx)(yv,{className:`h-3.5 w-16`}):(0,X.jsx)(`span`,{className:`truncate text-xs sm:text-sm`,children:r})]}),(0,X.jsx)(Q,{variant:`outline`,size:`icon-sm`,"aria-label":`Choose project`,onClick:s,children:(0,X.jsx)(Sv,{className:`h-4 w-4`})})]})]})}),vve=({activeSection:e,onChange:t})=>(0,X.jsx)(`nav`,{className:`fixed inset-x-0 bottom-0 z-20 border-t border-border/70 bg-background/95 px-3 pb-[calc(env(safe-area-inset-bottom)+0.75rem)] pt-2 backdrop-blur supports-[backdrop-filter]:bg-background/85 sm:px-4 lg:hidden`,children:(0,X.jsx)(`div`,{className:`mx-auto flex max-w-6xl gap-2 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:fve.map(n=>{let r=n.key===e,i=n.Icon;return(0,X.jsxs)(Q,{type:`button`,variant:r?`secondary`:`ghost`,className:`h-11 shrink-0 gap-2 whitespace-nowrap`,"aria-current":r?`page`:void 0,onClick:()=>t(n.key),children:[(0,X.jsx)(i,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:n.label})]},n.key)})})}),v9=({title:e,description:t,action:n})=>(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsxs)(_C,{children:[(0,X.jsx)(vC,{children:e}),(0,X.jsx)(yC,{children:t})]}),n&&(0,X.jsx)(xC,{children:n})]}),y9=({text:e})=>(0,X.jsxs)(`div`,{"aria-live":`polite`,className:`flex items-center gap-2 px-1 py-3 text-sm text-muted-foreground`,role:`status`,children:[(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`}),(0,X.jsx)(`span`,{children:e})]}),yve=e=>e?`Repo root (${e})`:`Repo root`,bve=e=>{if(!e)return`Repo root`;if(e.length<=20)return e;let t=e.split(`/`).filter(Boolean),n=t[t.length-1]??e;return n.length<=17?`.../${n}`:`${n.slice(0,16)}...`},b9=(e,t)=>{if(!e)return`Target`;if(e.active_target_kind===`bundle`&&e.active_target_bundle_id){let n=t?.bundles.find(t=>t.id===e.active_target_bundle_id)??null;return n?My(n):`Selected bundle`}return bve(t?.current_branch??null)},x9=({title:e,description:t,children:n})=>(0,X.jsxs)(`div`,{className:`flex max-h-[80vh] flex-col overflow-hidden`,children:[(0,X.jsxs)(T_,{className:`border-b border-border/70 px-4 py-4`,children:[(0,X.jsx)(D_,{children:e}),t&&(0,X.jsx)(O_,{children:t})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:n})]}),xve=({projects:e,selectedProjectId:t,error:n,onSelectProject:r,onRetry:i})=>n?(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(`p`,{className:`text-sm text-red-200`,children:n}),(0,X.jsx)(Q,{variant:`warning`,onClick:i,children:`Retry projects`})]}):e?e.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No projects are available on the desktop instance yet.`}):(0,X.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let n=e.id===t;return(0,X.jsxs)(`button`,{type:`button`,className:Z(`w-full rounded-2xl border px-4 py-3 text-left transition-colors`,n?`border-primary/50 bg-primary/10`:`border-border/80 bg-card/60 hover:border-primary/30 hover:bg-accent/60`),onClick:()=>r(e.id),children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.repo_path})]}),n&&(0,X.jsx)(hC,{variant:`info`,children:`Current`})]}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:(0,X.jsxs)(`span`,{children:[e.ticket_count,` tickets`]})})]},e.id)})}):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading projects...`}),Sve=({open:e,projects:t,selectedProjectId:n,error:r,onOpenChange:i,onSelectProject:a,onRetry:o})=>(0,X.jsx)(S_,{open:e,onOpenChange:i,children:(0,X.jsx)(w_,{showCloseButton:!1,"aria-describedby":void 0,className:`top-auto right-0 bottom-0 left-0 max-w-none translate-x-0 translate-y-0 overflow-hidden rounded-t-3xl rounded-b-none border-x-0 border-b-0 p-0 sm:top-1/2 sm:right-auto sm:bottom-auto sm:left-1/2 sm:max-w-md sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-2xl sm:border sm:p-0`,children:(0,X.jsx)(x9,{title:`Projects`,children:(0,X.jsx)(xve,{projects:t,selectedProjectId:n,error:r,onSelectProject:e=>{a(e),i(!1)},onRetry:o})})})}),Cve=({open:e,project:t,targetOptions:n,error:r,isLoading:i,isSubmitting:a,onOpenChange:o,onRetry:s,onSelectBundle:c,onSelectRepoRoot:l})=>{let[u,d]=(0,p.useState)(``);(0,p.useEffect)(()=>{e&&d(n?.current_branch??``)},[e,n?.current_branch]);let f=t?.active_target_kind!==`bundle`,m=yy(n?.bundles??[]),h=[{key:`default`,label:`Default branch`,branch:n?.default_branch??null},{key:`previous`,label:`Previous branch`,branch:n?.previous_branch??null}].filter(e=>e.branch&&e.branch!==n?.current_branch).filter((e,t,n)=>n.findIndex(t=>t.branch===e.branch)===t),g=t?r?(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(`p`,{className:`text-sm text-red-200`,children:r}),(0,X.jsx)(Q,{variant:`warning`,onClick:s,children:`Retry target options`})]}):n?(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`Project target`}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Choose the repo root or a prepared bundle for new chats and desktop work launched from this phone.`})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium text-muted-foreground`,children:`Target`}),(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-2`,children:[(0,X.jsx)(Q,{type:`button`,variant:f?`secondary`:`ghost`,className:`w-full justify-start`,disabled:a,onClick:()=>l(null),children:yve(n.current_branch)}),(0,X.jsxs)(`div`,{className:`relative min-h-10`,"data-testid":`mobile-target-options`,children:[i&&(0,X.jsx)(`div`,{className:`pointer-events-none absolute right-2 top-2 z-10 text-muted-foreground`,"data-testid":`mobile-target-options-spinner`,children:(0,X.jsx)(Tv,{className:`h-3.5 w-3.5 animate-spin`})}),(0,X.jsx)(`div`,{className:`max-h-40 overflow-y-auto pr-7`,children:m.length===0&&!i?(0,X.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No prepared bundles are available yet.`}):m.map(e=>(0,X.jsx)(Q,{type:`button`,variant:t.active_target_kind===`bundle`&&t.active_target_bundle_id===e.id?`secondary`:`ghost`,className:`w-full justify-start`,disabled:a,onClick:()=>c(e.id),children:(0,X.jsx)(`span`,{className:`truncate`,children:My(e)})},e.id))})]})]})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium text-muted-foreground`,children:`Repo root branch`}),(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-3`,children:[(0,X.jsx)(`div`,{className:`space-y-2`,children:h.length>0?h.map(({key:e,label:t,branch:n})=>(0,X.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between gap-3`,disabled:!f||a||!n,onClick:()=>l(n),children:[(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n})]},e)):(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i?`Loading branch suggestions...`:`No suggested branches available.`})}),(0,X.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,X.jsx)(z_,{htmlFor:`mobile-project-target-branch-input`,className:`text-xs text-muted-foreground`,children:`Switch or create branch`}),(0,X.jsx)(k_,{id:`mobile-project-target-branch-input`,value:u,disabled:!f||a,onChange:e=>d(e.target.value),placeholder:`feature/quick-fix`})]}),(0,X.jsx)(Q,{type:`button`,disabled:!f||!u.trim()||a,onClick:()=>l(u.trim()),children:`Switch`})]}),!f&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Switch to repo root to choose a branch.`})]})]})]}):(0,X.jsx)(y9,{text:`Loading target options...`}):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a project before choosing a target.`});return(0,X.jsx)(S_,{open:e,onOpenChange:o,children:(0,X.jsx)(w_,{showCloseButton:!1,"aria-describedby":void 0,className:`top-auto right-0 bottom-0 left-0 max-w-none translate-x-0 translate-y-0 overflow-hidden rounded-t-3xl rounded-b-none border-x-0 border-b-0 p-0 sm:top-1/2 sm:right-auto sm:bottom-auto sm:left-1/2 sm:max-w-md sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-2xl sm:border sm:p-0`,children:(0,X.jsx)(x9,{title:`Target`,description:t?b9(t,n):void 0,children:g})})})},S9=e=>e.parked_at?`parked`:e.state,C9=e=>{let t=S9(e);return t===`parked`?`Done`:`${t.slice(0,1).toUpperCase()}${t.slice(1)}`},w9=e=>e===`plan`?`info`:e===`build`?`success`:e===`review`?`warning`:`outline`,T9=({ticket:e,isSelected:t,onSelectTicket:n,className:r})=>(0,X.jsxs)(`button`,{type:`button`,className:Z(`w-full rounded-2xl border px-4 py-3 text-left transition-colors`,t?`border-primary/50 bg-primary/10`:`border-border/70 bg-card/40 hover:border-primary/30 hover:bg-accent/50`,r),onClick:()=>n(e.id),children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.title})}),(0,X.jsx)(hC,{variant:w9(S9(e)),children:C9(e)})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:[e.agent_status&&(0,X.jsx)(`span`,{children:e.agent_status}),e.branch&&(0,X.jsx)(`span`,{children:e.branch}),e.bundle?.name&&(0,X.jsx)(`span`,{children:e.bundle.name})]})]}),wve=({group:e,selectedBundleId:t,selectedTicketId:n,onSelectBundle:r,onSelectTicket:i})=>{let a=e.bundle.id===t,o=e.tickets.some(e=>e.id===n),[s,c]=(0,p.useState)(o),l=My(e.bundle)||e.bundle.branch||e.bundle.name||`Bundle`,u=e.tickets.filter(e=>e.agent_status===`running`).length,d=a||o;return(0,p.useEffect)(()=>{o&&c(!0)},[o]),(0,X.jsxs)(BC,{open:s,onOpenChange:c,children:[(0,X.jsxs)(`div`,{className:Z(`flex items-start gap-2 rounded-2xl border px-4 py-3 transition-colors`,d?`border-primary/50 bg-primary/10`:`border-border/70 bg-card/40 hover:border-primary/30 hover:bg-accent/50`),children:[(0,X.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,"aria-label":`Open bundle ${l}`,onClick:()=>r(e.bundle.id),children:(0,X.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(hC,{variant:`outline`,children:`Bundle`}),(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:l})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:[(0,X.jsxs)(`span`,{children:[e.tickets.length,` ticket`,e.tickets.length===1?``:`s`]}),u>0&&(0,X.jsxs)(`span`,{children:[u,` running`]}),e.bundle.branch&&(0,X.jsx)(`span`,{children:e.bundle.branch})]})]})})}),(0,X.jsx)(VC,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`mt-0.5 shrink-0`,"aria-label":`Toggle bundle tickets for ${l}`,children:(0,X.jsx)(mv,{className:Z(`h-4 w-4 transition-transform`,s&&`rotate-180`)})})})]}),(0,X.jsx)(HC,{className:`pt-2`,children:(0,X.jsx)(`div`,{className:`space-y-2 pl-3`,children:e.tickets.map(t=>(0,X.jsx)(T9,{ticket:t,isSelected:t.id===n,onSelectTicket:t=>i(t,e.bundle.id),className:`rounded-xl`},t.id))})})]})},E9=(e,t)=>Ey(e,[],t),Tve=e=>[{key:`plan`,label:`Plan`,tickets:e.filter(e=>!e.parked_at&&e.state===`plan`),items:E9(e.filter(e=>!e.parked_at&&e.state===`plan`),`plan`)},{key:`build`,label:`Build`,tickets:e.filter(e=>!e.parked_at&&e.state===`build`),items:E9(e.filter(e=>!e.parked_at&&e.state===`build`),`build`)},{key:`review`,label:`Review`,tickets:e.filter(e=>!e.parked_at&&e.state===`review`),items:E9(e.filter(e=>!e.parked_at&&e.state===`review`),`review`)},{key:`parked`,label:`Done`,tickets:e.filter(e=>e.parked_at),items:E9(e.filter(e=>e.parked_at),`done`)}].filter(e=>e.tickets.length>0),D9=({selectedProjectId:e,tickets:t,selectedBundleId:n,selectedTicketId:r,error:i,onRetry:a,onSelectBundle:o,onSelectTicket:s})=>{if(!e)return(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a project before browsing tickets from this phone.`});if(i)return(0,X.jsx)(v9,{title:`Tickets unavailable`,description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:a,children:`Retry tickets`})});if(!t)return(0,X.jsx)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,X.jsx)(xC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading tickets...`})});if(t.length===0)return(0,X.jsx)(v9,{title:`No tickets`,description:`This project does not have any tickets yet.`});let c=Tve(t);return(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(vC,{children:`Tickets`}),(0,X.jsxs)(yC,{children:[t.length,` total`]})]}),(0,X.jsx)(xC,{className:`space-y-4 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:c.map(e=>(0,X.jsxs)(`section`,{className:`space-y-2`,"aria-label":`${e.label} tickets`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(`span`,{children:e.tickets.length})]}),(0,X.jsx)(`div`,{className:`space-y-2`,children:e.items.map(e=>e.kind===`bundle`?(0,X.jsx)(wve,{group:e.group,selectedBundleId:n,selectedTicketId:r,onSelectBundle:o,onSelectTicket:s},e.group.id):(0,X.jsx)(T9,{ticket:e.ticket,isSelected:e.ticket.id===r,onSelectTicket:e=>s(e,null)},e.ticket.id))})]},e.key))})]})},Eve=e=>a9(`/mobile-auth/status`,{signal:e}),Dve=(e,t)=>a9(`/mobile-auth/pair/preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t}),Ove=e=>a9(`/mobile-auth/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),kve=e=>a9(`/mobile-auth/logout`,{method:`POST`,headers:{[i9]:e}}),Ave=()=>XS(window.location.origin,{withCredentials:!0}),O9=({label:e,value:t,mono:n=!1})=>t?(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-1 border-b border-border/50 py-2 last:border-0`,children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,X.jsx)(`dd`,{className:n?`min-w-0 break-all font-mono text-xs text-foreground`:`min-w-0 break-words text-sm text-foreground`,children:t})]}):null,jve=({projectId:e,csrfToken:t,socket:n,initialRequests:r,onRequestError:i})=>{let{t:a,i18n:o}=K(`common`,{keyPrefix:`mobileApp.approvals`}),[s,c]=(0,p.useState)(r),[l,u]=(0,p.useState)(null),[d,f]=(0,p.useState)(null),[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(``),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)(null),[S,C]=(0,p.useState)(!1),[w,T]=(0,p.useState)(0),E=(0,p.useRef)(r);E.current=r;let D=l?`${e}:${l}`:null,O=(0,p.useRef)(D);O.current=D;let k=(0,p.useRef)(!0);(0,p.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]),(0,p.useEffect)(()=>{c(E.current),u(null)},[e]),(0,p.useEffect)(()=>{let t=new AbortController,n=e;return O_e(e,t.signal).then(r=>{if(t.signal.aborted||n!==e)return;let i=r?.approval_requests??[];c(i),u(e=>e&&i.some(t=>t.id===e)?e:null),y(null)}).catch(e=>{Ye(e)||i(e)||y(e instanceof Ke?e.message:a(`loadError`))}),()=>t.abort()},[i,e,w,a]),(0,p.useEffect)(()=>{if(f(null),_(``),C(!1),x(null),!l){h(!1);return}let t=new AbortController,n=`${e}:${l}`;return h(!0),k_e(e,l,t.signal).then(t=>{O.current===n&&t.approval_request.project_id===e&&t.approval_request.id===l&&f(t)}).catch(e=>{if(!Ye(e)&&O.current===n){if(i(e))return;x(e instanceof Ke?e.message:a(`detailError`))}}).finally(()=>{!t.signal.aborted&&O.current===n&&h(!1)}),()=>t.abort()},[i,e,w,l,a]),(0,p.useEffect)(()=>{if(!n)return;let t=t=>{t&&typeof t==`object`&&`project_id`in t&&t.project_id!==e||T(e=>e+1)};return n.on(`approval-request:created`,t),n.on(`approval-request:updated`,t),n.on(`connect`,t),()=>{n.off(`approval-request:created`,t),n.off(`approval-request:updated`,t),n.off(`connect`,t)}},[e,n]);let A=d?.approval_request.project_id===e&&d.approval_request.id===l?d.approval_request:null,j=A?.action.kind===`custom_check`?A.action.target.batch_environment:A?.authority.environment,M=A?.action.kind===`custom_check`?A.action.target.attempt_placement:A?.authority.execution_boundary?.attempt_placement,N=A?.action.kind===`git_push`?A.action.target.degradations??[]:[],P=async n=>{if(!A||S)return;let r=`${e}:${A.id}`;C(!0),x(null);try{if(await A_e(e,A,n,t,g),!k.current||O.current!==r)return;_(``),T(e=>e+1)}catch(e){if(!k.current||O.current!==r||i(e))return;let t=qe(e,`approval_request`);t&&(c(e=>e.map(e=>e.id===t.id?t:e).filter(e=>e.status===`pending`)),f(e=>e&&e.approval_request.id===t.id?{...e,approval_request:t}:e)),x(e instanceof Ke?e.message:a(`decisionError`))}finally{k.current&&O.current===r&&C(!1)}};return s.length===0&&!v&&!A&&!b?null:(0,X.jsxs)(`section`,{"aria-labelledby":`mobile-approvals-title`,className:`rounded-2xl border border-amber-300/30 bg-amber-500/5 p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{id:`mobile-approvals-title`,className:`font-semibold text-foreground`,children:a(`title`)}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:a(`count`,{count:s.length})})]}),(0,X.jsx)(`span`,{className:`rounded-full bg-amber-400/15 px-2.5 py-1 text-sm font-semibold text-amber-100`,children:s.length})]}),v&&(0,X.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-red-200`,children:v}),(0,X.jsx)(`div`,{className:`mt-3 space-y-2`,children:s.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>u(e.id),className:`w-full rounded-xl border border-border bg-card/70 p-3 text-left outline-none focus:ring-2 focus:ring-ring/50`,children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:a(`action.${e.action_kind}`)}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:a(`expires`,{value:new Intl.DateTimeFormat(o.language,{dateStyle:`short`,timeStyle:`short`}).format(new Date(e.expires_at))})})]},e.id))}),l&&m&&(0,X.jsx)(`p`,{className:`mt-4 border-t border-border/60 pt-4 text-sm text-muted-foreground`,children:a(`loadingDetail`)}),l&&b&&(0,X.jsx)(`p`,{role:`alert`,className:`mt-4 border-t border-border/60 pt-4 text-sm text-red-200`,children:b}),A&&(0,X.jsxs)(`div`,{className:`mt-4 border-t border-border/60 pt-4`,children:[(0,X.jsx)(`p`,{className:`text-sm text-foreground`,children:a(`impact.${A.action_kind}`)}),(0,X.jsxs)(`dl`,{className:`mt-3 max-h-72 overflow-y-auto rounded-xl border border-border/60 bg-background/35 px-3`,children:[(0,X.jsx)(O9,{label:a(`fields.action`),value:a(`action.${A.action_kind}`)}),(0,X.jsx)(O9,{label:a(`fields.target`),value:A.action.kind===`git_push`?`${A.action.target.remote_name} ${A.action.target.ref}`:`${A.action.target.scope_kind} ${A.action.target.scope_id}`}),(0,X.jsx)(O9,{label:a(`fields.command`),value:A.action.kind===`custom_check`?A.action.target.effective_command??A.action.target.definition_snapshot?.command:null,mono:!0}),(0,X.jsx)(O9,{label:a(`fields.cwd`),value:A.action.kind===`custom_check`?A.action.target.effective_cwd??A.action.workspace_git.workspace_path:A.action.workspace_git.workspace_path,mono:!0}),(0,X.jsx)(O9,{label:a(`fields.branch`),value:A.action.workspace_git.branch}),(0,X.jsx)(O9,{label:a(`fields.head`),value:A.action.workspace_git.head_sha,mono:!0}),(0,X.jsx)(O9,{label:a(`fields.remoteHead`),value:A.action.workspace_git.remote_head_sha,mono:!0}),(0,X.jsx)(O9,{label:a(`fields.profile`),value:A.authority.selected_profile?`${A.authority.selected_profile.revision_id} (r${A.authority.selected_profile.revision})`:null}),(0,X.jsx)(O9,{label:a(`fields.launcher`),value:A.action.kind===`custom_check`&&A.action.target.launcher?a(`values.launcher.${A.action.target.launcher}`):null}),(0,X.jsx)(O9,{label:a(`fields.environment`),value:j?`${j.id} (r${j.revision})`:A.authority.execution_boundary?.placement===`host`?a(`values.noHostEnvironment`):a(`none`),mono:!!j}),(0,X.jsx)(O9,{label:a(`fields.placement`),value:A.authority.execution_boundary?.placement===`host`?a(`values.hostPlacement`):M?.scope.kind===`exact-sandbox`?a(`values.sandboxPlacement`,{id:M.scope.externalId}):a(`values.sandboxPlacementUnavailable`),mono:!!M}),(0,X.jsx)(O9,{label:a(`fields.authority`),value:A.authority.effective_capabilities.join(`, `)||a(`none`)}),(0,X.jsx)(O9,{label:a(`fields.degradations`),value:N.join(`, `)}),(0,X.jsx)(O9,{label:a(`fields.secrets`),value:A.action.logical_secret_references.join(`, `)||a(`none`)}),(0,X.jsx)(O9,{label:a(`fields.expires`),value:new Intl.DateTimeFormat(o.language,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(A.expires_at))})]}),(0,X.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:a(`history`,{count:d?.events.length??0})}),!!d?.events.length&&(0,X.jsx)(`ol`,{className:`mt-2 max-h-36 space-y-1 overflow-y-auto text-xs text-muted-foreground`,children:d.events.map(e=>(0,X.jsxs)(`li`,{children:[a(`status.${e.to_status}`),` · `,new Intl.DateTimeFormat(o.language,{dateStyle:`short`,timeStyle:`short`}).format(new Date(e.created_at)),e.reason?` · ${e.reason}`:``]},e.id))}),A.status!==`pending`&&(0,X.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:a(`remediation.${A.status}`)}),A.status===`pending`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`label`,{className:`mt-3 block text-xs text-muted-foreground`,htmlFor:`mobile-approval-reason-${A.id}`,children:a(`reason`)}),(0,X.jsx)(`textarea`,{id:`mobile-approval-reason-${A.id}`,rows:2,maxLength:2e3,value:g,onChange:e=>_(a4(e.target.value)),className:`mt-1 w-full rounded-xl border border-border bg-card px-3 py-2 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring/50`}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,X.jsx)(Q,{disabled:S,onClick:()=>void P(`approve`),children:a(`approve`)}),(0,X.jsx)(Q,{variant:`outline`,disabled:S,onClick:()=>void P(`deny`),children:a(`deny`)}),(0,X.jsx)(Q,{variant:`ghost`,disabled:S,onClick:()=>void P(`cancel`),children:a(`cancel`)})]})]})]})]})},k9=e=>jb.t(`common:mobileApp.${e}`),A9=({selectedProjectId:e,chatSessions:t,selectedChatSessionId:n,error:r,onRetry:i,onOpenNewChat:a,onSelectChat:o})=>e?r?(0,X.jsx)(v9,{title:`Chats unavailable`,description:r,action:(0,X.jsx)(Q,{variant:`warning`,onClick:i,children:`Retry chats`})}):(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(vC,{children:`Chats`}),(0,X.jsx)(yC,{children:t?`${t.length} recent`:`Loading chats...`}),(0,X.jsx)(bC,{children:(0,X.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:`New chat`})})]}),(0,X.jsx)(xC,{className:`space-y-2 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:t?t.length===0?(0,X.jsx)(v9,{title:`No chats`,description:`Start a new chat to plan or build from this project.`,action:(0,X.jsx)(Q,{onClick:a,children:`Start a chat`})}):t.map(e=>(0,X.jsx)(`button`,{type:`button`,className:Z(`w-full rounded-xl border px-3 py-2.5 text-left transition-colors`,e.id===n?`border-primary/50 bg-primary/10`:`border-border/70 bg-card/40 hover:border-primary/30 hover:bg-accent/50`),onClick:()=>o(e.id),children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1 pr-2 text-sm font-medium text-foreground line-clamp-2 break-words`,children:e.title}),(0,X.jsx)(hC,{variant:e.agent_status===`running`?`warning`:e.mode===`plan`?`info`:`success`,children:e.agent_status??e.mode})]})},e.id)):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading chats...`})})]}):(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a project before browsing chats from this phone.`}),j9=({selectedProjectId:e,specSessions:t,selectedSpecSessionId:n,error:r,onRetry:i,onOpenNewSpec:a,onSelectSpec:o})=>e?r?(0,X.jsx)(v9,{title:k9(`specList.listError`),description:r,action:(0,X.jsx)(Q,{variant:`warning`,onClick:i,children:k9(`specList.retry`)})}):(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(vC,{children:k9(`specList.title`)}),(0,X.jsx)(yC,{children:t?`${t.length} recent`:k9(`specList.loading`)}),(0,X.jsx)(bC,{children:(0,X.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:k9(`specList.newSpec`)})})]}),(0,X.jsx)(xC,{className:`space-y-2 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:t?t.length===0?(0,X.jsx)(v9,{title:k9(`specList.emptyTitle`),description:k9(`specList.emptyDescription`),action:(0,X.jsx)(Q,{onClick:a,children:k9(`specList.startSpec`)})}):t.map(e=>(0,X.jsx)(`button`,{type:`button`,className:Z(`w-full rounded-xl border px-3 py-2.5 text-left transition-colors`,e.id===n?`border-primary/50 bg-primary/10`:`border-border/70 bg-card/40 hover:border-primary/30 hover:bg-accent/50`),onClick:()=>o(e.id),children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1 pr-2 text-sm font-medium text-foreground line-clamp-2 break-words`,children:e.title}),(0,X.jsx)(hC,{variant:e.agent_status===`running`?`warning`:e.mode===`grill`?`info`:`success`,children:e.agent_status??e.mode})]})},e.id)):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:k9(`specList.loading`)})})]}):(0,X.jsx)(v9,{title:k9(`specList.emptyTitle`),description:`Select a project before browsing specs from this phone.`}),M9=e=>{let t=e.tickets.filter(e=>!e.parked_at),n=t.filter(e=>e.state===`plan`),r=t.filter(e=>e.state===`build`),i=t.filter(e=>e.state===`review`),a=t.some(e=>e.agent_status===`running`),o=t.find(e=>sy(e)&&e.agent_status===`running`&&!!e.session_id)??null,s=t.find(e=>sy(e)&&e.agent_status===`stopped`&&!!e.session_id)??null,c=[];n.length>0&&c.push({id:`build`,label:`Build Bundle`,pendingLabel:`Building Bundle...`,ariaLabel:`Build Bundle`,disabled:!1,disabledReason:null});let l=r.length>0&&r.every(e=>e.agent_status===`done`),u=r.length===0&&i.length>0&&e.can_re_review===!0&&!a;return(l||u)&&c.push({id:`review`,label:u?`Re-run review`:`Review Bundle`,pendingLabel:`Reviewing Bundle...`,ariaLabel:u?`Re-run review`:`Review Bundle`,disabled:!1,disabledReason:null}),o&&c.push({id:`pause-build`,label:`Pause Build`,pendingLabel:`Pausing Build...`,ariaLabel:`Pause Build`,title:`Pause the build session. You can resume it later.`,disabled:!1,disabledReason:null}),!o&&s&&c.push({id:`resume-build`,label:`Resume`,pendingLabel:`Resuming...`,ariaLabel:`Resume`,disabled:!1,disabledReason:null}),{actions:c,runningBuildTicketId:o?.id??null,resumableBuildTicketId:s?.id??null}},N9=e=>[...e??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,Mve=({className:e})=>(0,X.jsx)(ate,{"aria-hidden":`true`,className:e}),Nve=()=>{let[e,t]=(0,p.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(min-width: 1024px)`).matches);return(0,p.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 1024px)`),n=n=>{t(n?.matches??e.matches)};return n(),typeof e.addEventListener==`function`?(e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)):(e.addListener(n),()=>e.removeListener(n))},[]),e},P9=({label:e,value:t,accentClassName:n})=>(0,X.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-card/70 p-3`,children:[(0,X.jsx)(`div`,{className:Z(`text-xl font-semibold text-foreground`,n),children:t}),(0,X.jsx)(`div`,{className:`mt-1 text-xs uppercase tracking-[0.14em] text-muted-foreground`,children:e})]}),Pve=()=>(0,X.jsxs)(`div`,{className:`space-y-3`,"data-testid":`mobile-overview-skeleton`,children:[(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(_C,{className:`border-b border-border/70 pb-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(yv,{className:`h-6 w-28`}),(0,X.jsx)(yv,{className:`h-6 w-28 rounded-full`})]})}),(0,X.jsxs)(xC,{className:`space-y-4 pt-5`,children:[(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,X.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-card/70 p-3`,children:[(0,X.jsx)(yv,{className:`h-6 w-10`}),(0,X.jsx)(yv,{className:`mt-2 h-3 w-16`})]},t))}),(0,X.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,X.jsx)(yv,{className:`h-10 w-full rounded-xl`}),(0,X.jsx)(yv,{className:`h-10 w-full rounded-xl`})]})]})]}),(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(_C,{children:(0,X.jsx)(yv,{className:`h-6 w-20`})}),(0,X.jsx)(xC,{children:(0,X.jsx)(yv,{className:`h-10 w-40 rounded-xl`})})]})]}),Fve=({isLoggingOut:e,onLogout:t})=>(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(_C,{children:(0,X.jsx)(vC,{children:`Session`})}),(0,X.jsx)(xC,{children:(0,X.jsxs)(Q,{variant:`destructive`,className:`gap-2`,disabled:e,onClick:t,children:[(0,X.jsx)(Mve,{className:`h-4 w-4`}),e?`Logging out...`:`Log out this phone`]})})]}),Ive=({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r})=>{let i=r?.agent_status===`running`||!!n?.some(e=>e.agent_status===`running`);if(e?.kind===`ticket`)return{label:`Ticket run active`,variant:`success`};if(i)return{label:`Chat active`,variant:`success`};if(e)return{label:`Project run active`,variant:`success`};let a=t?.filter(e=>e.agent_status===`running`&&e.parked_at===null)??[],o=gF(a.filter(e=>e.state===`review`));return o===`building`?{label:jb.t(`common:statusBadge.building`),variant:`success`}:o===`reviewing`?{label:jb.t(`common:statusBadge.reviewing`),variant:`warning`}:a.some(e=>e.state===`build`)?{label:jb.t(`common:statusBadge.building`),variant:`success`}:a.some(e=>e.state===`plan`)?{label:`Planning`,variant:`info`}:{label:`Idle`,variant:`outline`}},Lve=({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r})=>{let i=Ive({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r});return(0,X.jsx)(hC,{variant:i.variant,children:i.label})},Rve=({selectedProjectId:e,summary:t,tickets:n,error:r,chatSessions:i,chatSessionDetail:a,onRetry:o,onOpenTickets:s,onOpenChats:c,onOpenSpec:l})=>{let u=m9.Icon,d=h9.Icon,f=g9.Icon;return r?(0,X.jsx)(v9,{title:`Project summary unavailable`,description:r,action:(0,X.jsx)(Q,{variant:`warning`,onClick:o,children:`Retry summary`})}):e?!t||t.project.id!==e?(0,X.jsx)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,X.jsx)(xC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading project summary...`})}):(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(vC,{children:`Overview`}),(0,X.jsx)(bC,{children:(0,X.jsx)(Lve,{activeRun:t.active_run,tickets:n,chatSessions:i,chatSessionDetail:a})})]}),(0,X.jsxs)(xC,{className:`space-y-4 pt-5`,children:[(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:[(0,X.jsx)(P9,{label:`Tickets`,value:t.tickets.total}),(0,X.jsx)(P9,{label:`Plan`,value:t.tickets.plan,accentClassName:`text-sky-200`}),(0,X.jsx)(P9,{label:`Build`,value:t.tickets.build,accentClassName:`text-emerald-200`}),(0,X.jsx)(P9,{label:`Review`,value:t.tickets.review,accentClassName:`text-amber-200`}),(0,X.jsx)(P9,{label:`Done`,value:t.tickets.parked}),(0,X.jsx)(P9,{label:`Bundles`,value:t.project.bundle_count??0})]}),(0,X.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,X.jsxs)(Q,{variant:`outline`,className:`gap-2`,"aria-label":m9.ctaAriaLabel,onClick:s,children:[(0,X.jsx)(u,{className:`h-4 w-4`}),m9.label]}),(0,X.jsxs)(Q,{variant:`outline`,className:`gap-2`,"aria-label":h9.ctaAriaLabel,onClick:c,children:[(0,X.jsx)(d,{className:`h-4 w-4`}),h9.label]}),(0,X.jsxs)(Q,{variant:`outline`,className:`gap-2 sm:col-span-2`,"aria-label":g9.ctaAriaLabel,onClick:l,children:[(0,X.jsx)(f,{className:`h-4 w-4`}),g9.label]})]})]})]}):(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a desktop project before opening tickets or chats from this phone.`})},zve=({ticket:e})=>{let t=[{label:`State`,value:C9(e)},{label:`Tool`,value:yF(e,`opencode`)},{label:`Agent`,value:e.agent_status},{label:`Branch`,value:e.branch},{label:`Bundle`,value:e.bundle?.name??null},{label:`Model`,value:e.tool===`opencode`?e.model:null},{label:`Variant`,value:e.tool===`opencode`?e.variant:null}].filter(e=>!!e.value);return t.length===0?null:(0,X.jsxs)(`div`,{className:`min-w-0 space-y-2 rounded-xl border border-border/70 bg-background/40 px-3 py-3`,children:[(0,X.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Details`}),(0,X.jsx)(`dl`,{className:`grid gap-2 text-sm sm:grid-cols-2`,children:t.map(e=>(0,X.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border/60 bg-background/50 px-3 py-2`,children:[(0,X.jsx)(`dt`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:e.label}),(0,X.jsx)(`dd`,{className:`break-words text-foreground`,children:e.value})]},e.label))})]})},F9=({label:e,disabled:t,onClick:n})=>(0,X.jsx)(Q,{type:`button`,variant:`outline`,disabled:t,onClick:n,children:e}),Bve=({ticket:e,actionState:t,actionError:n,onAction:r})=>{let i=o3(e,{reviewLabel:e.worktree_bundle_id===null?`Review`:`Review Bundle`}),a=e.worktree_bundle_id===null&&e.state===`review`&&e.can_re_review===!0&&e.agent_status!==`running`&&!e.parked_at?[{id:`review`,label:`Re-run review`,pendingLabel:`Re-running review...`,ariaLabel:`Re-run review`,disabled:!1,disabledReason:null},...i]:i;return a.length===0?null:(0,X.jsx)(t4,{actions:a,activeAction:t,disableWhenActive:!0,className:`space-y-3`,heading:`Actions`,headingClassName:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,actionsClassName:`flex flex-wrap gap-2`,showDisabledReason:!0,disabledReasonClassName:`text-sm text-amber-200`,error:n,errorClassName:`text-sm text-red-200`,renderAction:({action:e,label:t,disabled:n})=>(0,X.jsx)(F9,{label:t,disabled:n,onClick:()=>r(e.id)},e.id)})},Vve=({bundleDetail:e,actionState:t,actionError:n,onAction:r})=>{let{actions:i}=M9(e);return i.length===0?null:(0,X.jsx)(t4,{actions:i,activeAction:t,disableWhenActive:!0,className:`space-y-3`,heading:`Actions`,headingClassName:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,actionsClassName:`flex flex-wrap gap-2`,error:n,errorClassName:`text-sm text-red-200`,renderAction:({action:e,label:t,disabled:n})=>(0,X.jsx)(F9,{label:t,disabled:n,onClick:()=>r(e.id)},e.id)})},I9=(e,t)=>(e??[]).map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,created_at:e.created_at,ticket_id:t??null,ticket_proposals:`ticket_proposals`in e?e.ticket_proposals??null:null,metadata:e.metadata,responseTiming:e.response_timing?GK(e.response_timing):null,transcript_runs:e.transcript_runs??null})),L9=({title:e,subtitle:t,badges:n,backLabel:r,onBack:i,action:a})=>(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[i?(0,X.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 px-2.5 lg:hidden`,"aria-label":r,onClick:i,children:[(0,X.jsx)(cF,{className:`h-4 w-4`}),`Back`]}):null,(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e}),t?(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:t}):null]})]}),a?(0,X.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),n?(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n}):null]}),Hve=({title:e,backLabel:t,onBack:n,action:r})=>(0,X.jsxs)(`div`,{className:`-mx-3 flex shrink-0 items-center justify-between gap-3 border-b border-border/80 bg-background/95 px-3 py-2.5 backdrop-blur supports-[backdrop-filter]:bg-background/85 sm:-mx-4 sm:px-4 lg:hidden`,children:[(0,X.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 px-2.5`,"aria-label":t,onClick:n,children:[(0,X.jsx)(cF,{className:`h-4 w-4`}),`Back`]}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-foreground`,children:e}),(0,X.jsx)(`div`,{className:`shrink-0`,children:r})]}),R9=({title:e,backLabel:t,onBack:n,action:r,subheader:i,children:a})=>(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,X.jsx)(Hve,{title:e,backLabel:t,onBack:n,action:r}),i?(0,X.jsx)(`div`,{className:`shrink-0 border-b border-border/70 py-2 lg:hidden`,children:i}):null,(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:a})]}),z9=({value:e,onTranscript:t,onDetails:n})=>(0,X.jsxs)(`div`,{className:`flex gap-2 px-3 sm:px-0`,children:[(0,X.jsx)(Q,{type:`button`,variant:e===`transcript`?`secondary`:`ghost`,className:`h-9 flex-1`,"aria-pressed":e===`transcript`,onClick:t,children:`Transcript`}),(0,X.jsx)(Q,{type:`button`,variant:e===`details`?`secondary`:`ghost`,className:`h-9 flex-1`,"aria-pressed":e===`details`,onClick:n,children:`Details`})]}),B9=({controls:e})=>{let[t,n]=(0,p.useState)(!1);return(0,X.jsxs)(BC,{open:t,onOpenChange:n,children:[(0,X.jsx)(`div`,{className:`px-1 pb-1`,children:(0,X.jsx)(VC,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2 text-xs text-muted-foreground`,children:[`Options`,(0,X.jsx)(mv,{className:Z(`h-3.5 w-3.5 transition-transform`,t&&`rotate-180`)})]})})}),(0,X.jsx)(HC,{className:`px-1 pb-1`,children:(0,X.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-background/35 p-2`,children:e})})]})},V9=({ticket:e,badges:t,actionState:n,actionError:r,onAction:i,className:a})=>(0,X.jsxs)(gC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,a),children:[(0,X.jsx)(_C,{className:`min-w-0 pb-3`,children:(0,X.jsx)(L9,{title:e.title,badges:t})}),(0,X.jsxs)(xC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,X.jsx)(Bve,{ticket:e,actionState:n,actionError:r,onAction:i}),e.description?(0,X.jsxs)(`div`,{className:`min-w-0 space-y-2 rounded-xl border border-border/70 bg-background/40 px-3 py-3`,children:[(0,X.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Description`}),(0,X.jsx)(WK,{content:e.description,className:`min-w-0 text-foreground`})]}):null,(0,X.jsx)(zve,{ticket:e})]})]}),H9=({bundleDetail:e,title:t,subtitle:n,badges:r,actionState:i,actionError:a,onAction:o,orderedTickets:s,highlightedTicketId:c,isTicketListOpen:l,onTicketListOpenChange:u,onSelectTicket:d,className:f,availableModels:p})=>(0,X.jsxs)(gC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,f),children:[(0,X.jsx)(_C,{className:`min-w-0 pb-3`,children:(0,X.jsx)(L9,{title:t,subtitle:n,badges:r})}),(0,X.jsxs)(xC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,X.jsx)(Vve,{bundleDetail:e,actionState:i,actionError:a,onAction:o}),(0,X.jsxs)(BC,{open:l,onOpenChange:u,children:[(0,X.jsx)(VC,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs text-muted-foreground`,children:[`Tickets`,(0,X.jsx)(mv,{className:Z(`h-3.5 w-3.5 transition-transform`,l&&`rotate-180`)})]})}),(0,X.jsx)(HC,{className:`pt-2`,children:(0,X.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-background/35 p-3`,children:(0,X.jsx)(h3,{tickets:s,highlightedTicketId:c,onOpenTicketDetails:e=>d(e.id,e.worktree_bundle_id),availableModels:p})})})]})]})]}),U9=({selectedProjectId:e,bundleId:t,bundleDetail:n,openNonce:r,mobileDetailView:i,error:a,actionState:o,actionError:s,followUpPrompt:c,isSendingFollowUp:l,followUpError:u,availableModels:d,onBack:f,onRetry:m,onAction:h,onDetailViewChange:g,onSelectTicket:_,onFollowUpPromptChange:v,onFollowUpKeyDown:y,onFollowUpSubmit:b,isLargeScreen:x})=>{let[S,C]=(0,p.useState)(!0);if((0,p.useEffect)(()=>{C(!0)},[t,r]),!e)return(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a project before opening bundle details from this phone.`});if(!t)return(0,X.jsx)(v9,{title:`Choose a bundle`,description:`Open a bundle to review its transcript and grouped ticket progress.`});if(a)return(0,X.jsx)(R9,{title:`Bundle unavailable`,backLabel:`Back to tickets`,onBack:f,children:(0,X.jsx)(v9,{title:`Bundle unavailable`,description:a,action:(0,X.jsx)(Q,{variant:`warning`,onClick:m,children:`Retry bundle`})})});if(!n||n.bundle.id!==t)return(0,X.jsx)(R9,{title:`Loading bundle`,backLabel:`Back to tickets`,onBack:f,children:(0,X.jsx)(y9,{text:`Loading bundle details...`})});let w=My(n.bundle)||n.bundle.branch||n.bundle.name||`Bundle`,T=new Map(d.map(e=>[e.id,e.label])),E=y3(n.tickets,T),D=S3(n),O=b3(n.tickets,n.execution_order_ticket_ids),k=x3(n.tickets,T,E,n.execution_order_ticket_ids),A=vF(n.tickets,D?.state??null),j=n.tickets.find(e=>e.agent_status===`running`)??D,M=j??D??n.tickets[0]??null,N=j?.agent_status===`running`?E[j.id]??j.model??`Agent`:null,P=!!(D&&D.state!==`plan`&&Cy(D)),F=n.tickets.some(e=>e.agent_status===`running`)?`Wait for all bundle tickets to finish building before sending a follow-up prompt.`:void 0,I=`mobile-bundle:${n.bundle.id}:${r}`,L=`${n.tickets.length} ticket${n.tickets.length===1?``:`s`}`,R=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(uF,{status:A}),(0,X.jsx)(hC,{variant:`outline`,children:L}),M?(0,X.jsxs)(hC,{variant:`outline`,children:[`Target: `,M.title]}):null]});return(0,X.jsx)(R9,{title:w,backLabel:`Back to tickets`,onBack:f,subheader:x?void 0:(0,X.jsx)(z9,{value:i,onTranscript:()=>g(`transcript`),onDetails:()=>g(`details`)}),children:x?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden pt-3`,children:[(0,X.jsx)(H9,{bundleDetail:n,title:w,subtitle:n.bundle.branch,badges:R,actionState:o,actionError:s,onAction:h,orderedTickets:O,highlightedTicketId:n.target_ticket_id,isTicketListOpen:S,onTicketListOpenChange:C,onSelectTicket:_,className:`shrink-0`,availableModels:d}),(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,X.jsx)(m3,{projectId:e,followUpTicketId:n.target_ticket_id,messages:k,internalLog:j?.agent_log??null,currentThinkingMessageId:j?.agent_message_id??D?.agent_message_id??null,legacyThinkingTicketId:j?.id??D?.id??null,previousThinkingLog:j?.previous_agent_log??D?.previous_agent_log??null,previousThinkingMessageId:j?.previous_agent_message_id??D?.previous_agent_message_id??null,pendingAgentTitle:N,streamingResponse:j?.streaming_response??null,isRunning:n.tickets.some(e=>e.agent_status===`running`),canShowComposer:P,composerTheme:ry(D?.state??null),layoutKey:I,scrollLayoutKey:I,followUpPrompt:c,followUpPlaceholder:M?`Follow up on: ${M.title}`:`Follow up on this bundle`,isSendingFollowUp:l,followUpDisabledReason:F,onFollowUpPromptChange:v,onFollowUpKeyDown:y,onFollowUpSubmit:b},I)}),u?(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-red-200`,children:u}):null]}):i===`details`?(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,X.jsx)(H9,{bundleDetail:n,title:w,subtitle:n.bundle.branch,badges:R,actionState:o,actionError:s,onAction:h,orderedTickets:O,highlightedTicketId:n.target_ticket_id,isTicketListOpen:S,onTicketListOpenChange:C,onSelectTicket:_,className:`h-full`,availableModels:d})}):(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,X.jsx)(m3,{projectId:e,followUpTicketId:n.target_ticket_id,messages:k,internalLog:j?.agent_log??null,currentThinkingMessageId:j?.agent_message_id??D?.agent_message_id??null,legacyThinkingTicketId:j?.id??D?.id??null,previousThinkingLog:j?.previous_agent_log??D?.previous_agent_log??null,previousThinkingMessageId:j?.previous_agent_message_id??D?.previous_agent_message_id??null,pendingAgentTitle:N,streamingResponse:j?.streaming_response??null,isRunning:n.tickets.some(e=>e.agent_status===`running`),canShowComposer:P,composerTheme:ry(D?.state??null),layoutKey:I,scrollLayoutKey:I,followUpPrompt:c,followUpPlaceholder:M?`Follow up on: ${M.title}`:`Follow up on this bundle`,isSendingFollowUp:l,followUpDisabledReason:F,onFollowUpPromptChange:v,onFollowUpKeyDown:y,onFollowUpSubmit:b},I),u?(0,X.jsx)(`p`,{className:`shrink-0 px-1 pt-2 text-sm text-red-200`,children:u}):null]})})},W9=({selectedProjectId:e,chatSession:t,chatSessionId:n,openNonce:r,error:i,isStopping:a,isResuming:o,isResumeDisabled:s,composerMode:c,composerTool:l,prompt:u,selectedModel:d,selectedVariant:f,selectedSkills:p,availableModels:m,availableSkills:h,isLoadingAgentSettings:g,isSending:_,isUpdatingMode:v,showStartBuilding:y,composerDisabledReason:b,onBack:x,onRetry:S,onStop:C,onResume:w,onModeChange:T,onStartBuilding:E,onPromptChange:D,onModelChange:O,onVariantChange:k,onSkillsChange:A,onPromptKeyDown:j,onSubmit:M,onResolveQuestionSet:N,liveResponseTiming:P,isLargeScreen:F})=>{if(!e)return(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a project before opening the chat workspace.`});if(n&&i)return(0,X.jsx)(v9,{title:`Chat unavailable`,description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:S,children:`Retry chat`})});if(n&&(!t||t.id!==n))return(0,X.jsx)(R9,{title:`Loading chat`,backLabel:`Back to chats`,onBack:x,children:(0,X.jsx)(y9,{text:`Loading chat transcript...`})});let I=t?.mode??c,L=m.length>0,R=m.find(e=>e.id===d)??null,z=I9(t?.messages),ee=N9(t?.messages),B=!!ee,V=pF(t?.post_build_check),te=V?jb.t(`common:postBuildChecks.blockedReason`):B?jb.t(`common:questionSet.waitForResolution`):b,H=t?.agent_status===`running`?(0,X.jsx)(j8,{action:`interrupt`,isPending:a,onAction:C,label:G9(`chatDetail.interrupt`),pendingLabel:G9(`chatDetail.interrupting`)}):t?.can_resume?(0,X.jsx)(j8,{action:`resume`,isPending:o,disabled:s||B||V,onAction:w,label:G9(`chatDetail.resume`),pendingLabel:G9(`chatDetail.resuming`)}):null,U=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(hC,{variant:I===`plan`?`info`:`success`,children:I}),(0,X.jsx)(hC,{variant:`outline`,children:t?.tool??l}),t?.agent_status?(0,X.jsx)(hC,{variant:`outline`,children:t.agent_status}):null]}),ne=L?(0,X.jsx)(vY,{model:d,variant:f,skills:p,showModelSelector:!0,showSkillsSelector:!0,availableModels:m,availableSkills:h,selectedModel:R,onModelChange:O,onVariantChange:k,onSkillsChange:A,modelSelectId:`mobile-chat-model-selector`,variantSelectId:`mobile-chat-variant-selector`,skillsSelectId:`mobile-chat-skills-selector`,disabled:!!te||_}):g?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,re=!F&&ne?(0,X.jsx)(B9,{controls:ne}):ne,ie=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(UY,{value:I,disabled:!!te||_||v,onChange:T}),y&&(0,X.jsx)(tX,{disabled:_||v,onClick:E})]}),ae=t?(0,X.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:jb.t(`common:mobileApp.agentSelector.sessionLocked`,{agent:t.tool})}):null,oe=F?void 0:({showThinkingControl:e})=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[ie,(0,X.jsx)(`div`,{className:`ml-auto`,children:e})]}),W=`mobile-chat:${n??`new`}:${r}`;return(0,X.jsx)(R9,{title:t?.title??`New chat`,backLabel:`Back to chats`,onBack:x,action:H,children:(0,X.jsx)(V8,{projectId:e,agentRunParentType:t?`chat`:null,agentRunParentId:t?.id??null,messages:z,internalLog:t?.agent_log??null,currentThinkingMessageId:t?.agent_message_id??null,previousThinkingLog:t?.previous_agent_log??null,previousThinkingMessageId:t?.previous_agent_message_id??null,pendingAgentTitle:t?.title??`Archon`,streamingResponse:t?.streaming_response??null,isRunning:t?.agent_status===`running`,pendingAgentRevealKey:P?.turnKey??null,liveResponseTiming:P,canShowComposer:!0,header:F?(0,X.jsx)(L9,{title:t?.title??`New chat`,subtitle:t?.target_label_snapshot??`Project root`,badges:U}):oe,composerControls:F?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[ae,ie]}):ae,composerInlineControls:re,composerTheme:I,forceScrollToBottomKey:W,layoutKey:W,scrollLayoutKey:W,composerFocusNonce:r,blurComposerOnSendStart:!F,followUpPrompt:u,followUpPlaceholder:n?`Continue this chat`:I===`plan`?`Ask Archon to scope or reason through project work`:`Ask Archon to build or verify something in this project`,emptyStateText:n?`No messages yet.`:`Start a new project chat from this phone.`,renderMessageBody:e=>{let n=e.metadata?.ask_question;if(!(e.role!==`assistant`||!n||!t))return(0,X.jsx)($J,{messageContent:e.content,questionSet:n,storageKey:WJ({parentType:`chat`,parentId:t.id,setId:n.id}),isActive:n.status===`pending`&&ee?.id===e.id,isDisabled:t.agent_status===`running`||_||v,onResolve:t=>N(e.id,t)})},isSendingFollowUp:_,isComposerSubmitDisabled:!!te,postBuildCheck:t?.post_build_check,followUpDisabledReason:te??void 0,hidePendingAgentTitle:!F,onFollowUpPromptChange:D,onFollowUpKeyDown:j,onFollowUpSubmit:M},W)})},Uve=e=>(e??[]).map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,created_at:e.created_at,ticket_id:null,ticket_proposals:null,metadata:e.metadata,responseTiming:e.response_timing?GK(e.response_timing):null,transcript_runs:e.transcript_runs??null})),Wve=e=>{if(!e)return null;for(let t=e.length-1;t>=0;--t)if(e[t].kind===`grill-question`)return e[t].id;return null},G9=e=>jb.t(`common:mobileApp.${e}`),K9=({selectedProjectId:e,specSession:t,specSessionId:n,openNonce:r,error:i,isStopping:a,isResuming:o,isResumeDisabled:s,composerMode:c,composerTool:l,prompt:u,selectedModel:d,selectedVariant:f,selectedSkills:p,availableModels:m,availableSkills:h,isLoadingAgentSettings:g,isSending:_,isUpdatingMode:v,composerDisabledReason:y,targetWarning:b,targetActionLabel:x,targetActionError:S,isRestoringTarget:C,onBack:w,onRetry:T,onStop:E,onResume:D,onModeChange:O,onPromptChange:k,onModelChange:A,onVariantChange:j,onSkillsChange:M,onPromptKeyDown:N,onSubmit:P,onSubmitAnswer:F,onResolveQuestionSet:I,onRestoreTarget:L,liveResponseTiming:R,isLargeScreen:z})=>{if(!e)return(0,X.jsx)(v9,{title:G9(`specList.emptyTitle`),description:`Select a project before opening the spec workspace.`});if(n&&i)return(0,X.jsx)(v9,{title:G9(`specDetail.unavailableTitle`),description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:T,children:G9(`specDetail.retry`)})});if(n&&(!t||t.id!==n))return(0,X.jsx)(R9,{title:G9(`specDetail.loadingTitle`),backLabel:G9(`specDetail.back`),onBack:w,children:(0,X.jsx)(y9,{text:G9(`specDetail.loading`)})});let ee=t?.mode??c,B=m.length>0,V=m.find(e=>e.id===d)??null,te=Uve(t?.messages),H=Wve(t?.messages),U=N9(t?.messages),ne=!!U,re=ne?jb.t(`common:questionSet.waitForResolution`):y,ie=t?.agent_status===`running`,ae=ie?(0,X.jsx)(j8,{action:`interrupt`,isPending:a,onAction:E,label:G9(`specDetail.interrupt`),pendingLabel:G9(`specDetail.interrupting`)}):t?.can_resume?(0,X.jsx)(j8,{action:`resume`,isPending:o,disabled:s||ne||!!b,onAction:D,label:G9(`specDetail.resume`),pendingLabel:G9(`specDetail.resuming`)}):null,oe=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(hC,{variant:ee===`grill`?`info`:`success`,children:ee}),(0,X.jsx)(hC,{variant:`outline`,children:t?.tool??l}),t?.agent_status?(0,X.jsx)(hC,{variant:`outline`,children:t.agent_status}):null]}),W=B?(0,X.jsx)(vY,{model:d,variant:f,skills:p,showModelSelector:!0,showSkillsSelector:!0,availableModels:m,availableSkills:h,selectedModel:V,onModelChange:A,onVariantChange:j,onSkillsChange:M,modelSelectId:`mobile-spec-model-selector`,variantSelectId:`mobile-spec-variant-selector`,skillsSelectId:`mobile-spec-skills-selector`,disabled:!!re||_}):l===`opencode`&&g?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,se=!z&&W?(0,X.jsx)(B9,{controls:W}):W,ce={rationaleLabel:jb.t(`common:specView.grill.rationaleLabel`),suggestionsLabel:jb.t(`common:specView.grill.suggestionsLabel`),recommendedSuggestionLabel:jb.t(`common:specView.grill.recommendedSuggestionLabel`),answerPlaceholder:jb.t(`common:specView.grill.answerPlaceholder`),submitLabel:jb.t(`common:specView.grill.submitLabel`),submittingLabel:jb.t(`common:specView.grill.submittingLabel`)},le=e=>{if(e.role!==`assistant`)return;let n=e.metadata,r=n?.ask_question;if(r&&t)return(0,X.jsx)($J,{messageContent:e.content,questionSet:r,storageKey:WJ({parentType:`spec`,parentId:t.id,setId:r.id}),isActive:r.status===`pending`&&U?.id===e.id,isDisabled:!!b||ie||_||v,onResolve:t=>I(e.id,t)});if(e.kind!==`grill-question`)return;let i=n?.grill_question;if(i)return(0,X.jsx)(k5,{question:i,isActive:ie?!1:e.id===H&&t?.agent_status!==`running`&&t?.mode===`grill`,isDisabled:!!b||_||v,labels:ce,onSubmitAnswer:F})},ue=(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,X.jsx)(A5,{on:ee===`grill`,disabled:!!re||_||v,onToggle:e=>O(e?`grill`:`standard`),tooltipContent:jb.t(`common:specView.grill.toggleTooltip`),ariaLabelOn:jb.t(`common:specView.grill.toggleAriaLabelOn`),ariaLabelOff:jb.t(`common:specView.grill.toggleAriaLabelOff`)})}),de=t?(0,X.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:jb.t(`common:mobileApp.agentSelector.sessionLocked`,{agent:t.tool})}):null,fe=z?void 0:({showThinkingControl:e})=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[ue,(0,X.jsx)(`div`,{className:`ml-auto`,children:e})]}),pe=`mobile-spec:${n??`new`}:${r}`;return(0,X.jsxs)(R9,{title:t?.title??G9(`specDetail.newSpecTitle`),backLabel:G9(`specDetail.back`),onBack:w,action:ae,children:[b&&(0,X.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-100`,children:[(0,X.jsx)(`p`,{children:b}),x&&(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`mt-2`,disabled:C,onClick:L,children:C?G9(`specDetail.switchingBack`):x}),S&&(0,X.jsx)(`p`,{className:`mt-2 text-red-200`,children:S})]}),(0,X.jsx)(V8,{projectId:e,agentRunParentType:n?`spec`:null,agentRunParentId:n,messages:te,internalLog:t?.agent_log??null,currentThinkingMessageId:t?.agent_message_id??null,previousThinkingLog:t?.previous_agent_log??null,previousThinkingMessageId:t?.previous_agent_message_id??null,pendingAgentTitle:t?.title??G9(`specDetail.newSpecTitle`),streamingResponse:t?.streaming_response??null,isRunning:ie,pendingAgentRevealKey:R?.turnKey??null,liveResponseTiming:R,canShowComposer:!0,header:z?(0,X.jsx)(L9,{title:t?.title??G9(`specDetail.newSpecTitle`),subtitle:t?.first_user_message_preview??null,badges:oe}):fe,composerControls:z?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[de,ue]}):de,composerInlineControls:se,composerTheme:`default`,forceScrollToBottomKey:pe,layoutKey:pe,scrollLayoutKey:pe,composerFocusNonce:r,blurComposerOnSendStart:!z,followUpPrompt:u,followUpPlaceholder:G9(n?`specDetail.composerPlaceholder`:`specDetail.composerPlaceholderDraft`),emptyStateText:G9(n?`specDetail.emptyMessages`:`specDetail.emptyDraft`),renderMessageBody:le,isSendingFollowUp:_,isComposerSubmitDisabled:!!re,followUpDisabledReason:re??void 0,hidePendingAgentTitle:!z,onFollowUpPromptChange:k,onFollowUpKeyDown:N,onFollowUpSubmit:P},pe)]})},q9=({selectedProjectId:e,ticketId:t,ticket:n,openNonce:r,error:i,actionState:a,actionError:o,followUpPrompt:s,followUpSelectedModel:c,followUpSelectedVariant:l,followUpSelectedSkills:u,availableModels:d,availableSkills:f,isLoadingAgentSettings:m,isSendingFollowUp:h,followUpError:g,onBack:_,onRetry:v,onAction:y,onFollowUpPromptChange:b,onFollowUpModelChange:x,onFollowUpVariantChange:S,onFollowUpSkillsChange:C,onFollowUpKeyDown:w,onFollowUpSubmit:T,onResolveQuestionSet:E,liveResponseTiming:D,isLargeScreen:O})=>{let[k,A]=(0,p.useState)(`transcript`);if((0,p.useEffect)(()=>{A(`transcript`)},[r,t]),!e)return(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a project before opening ticket details from this phone.`});if(!t)return(0,X.jsx)(v9,{title:`Choose a ticket`,description:`Open a ticket to review its transcript and continue the workflow.`});if(i)return(0,X.jsx)(v9,{title:`Ticket unavailable`,description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:v,children:`Retry ticket`})});if(!n||n.id!==t)return(0,X.jsx)(R9,{title:`Loading ticket`,backLabel:`Back to tickets`,onBack:_,children:(0,X.jsx)(y9,{text:`Loading ticket details...`})});let j=s3(n,{requireWorktree:!0}),M=I9(n.messages,n.id),N=N9(n.messages),P=!!N,F=pF(n.post_build_check),I=F?jb.t(`common:postBuildChecks.blockedReason`):P?jb.t(`common:questionSet.waitForResolution`):j.disabledReason,L=d.find(e=>e.id===c)??null,R=yF(n,`opencode`)===`opencode`&&d.length>0?(0,X.jsx)(vY,{model:c,variant:l,skills:u,showModelSelector:!0,showSkillsSelector:!0,availableModels:d,availableSkills:f,selectedModel:L,onModelChange:x,onVariantChange:S,onSkillsChange:C,modelSelectId:`mobile-ticket-follow-up-model-selector`,variantSelectId:`mobile-ticket-follow-up-variant-selector`,skillsSelectId:`mobile-ticket-follow-up-skills-selector`,disabled:!!I||h}):yF(n,`opencode`)===`opencode`&&m?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,z=!O&&R?(0,X.jsx)(B9,{controls:R}):R,ee=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(hC,{variant:w9(S9(n)),children:C9(n)}),n.tool?(0,X.jsx)(hC,{variant:`outline`,children:n.tool}):null,n.agent_status?(0,X.jsx)(hC,{variant:`outline`,children:n.agent_status}):null,n.branch?(0,X.jsx)(hC,{variant:`outline`,children:n.branch}):null,n.bundle?.name?(0,X.jsx)(hC,{variant:`outline`,children:n.bundle.name}):null]}),B=`mobile-ticket:${n.id}:${r}`,V=e=>{let t=e.metadata?.ask_question;if(!(e.role!==`assistant`||!t))return(0,X.jsx)($J,{messageContent:e.content,questionSet:t,storageKey:WJ({parentType:`ticket`,parentId:n.id,setId:t.id}),isActive:t.status===`pending`&&N?.id===e.id,isDisabled:n.agent_status===`running`||h,onResolve:t=>E(e.id,t)})},te=(0,X.jsx)(z9,{value:k,onTranscript:()=>A(`transcript`),onDetails:()=>A(`details`)});return(0,X.jsx)(R9,{title:n.title,backLabel:`Back to tickets`,onBack:_,subheader:O?void 0:te,children:O?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden pt-3`,children:[(0,X.jsx)(V9,{ticket:n,badges:ee,actionState:a,actionError:o,onAction:y,className:`shrink-0`}),(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,X.jsx)(oY,{projectId:e,followUpTicketId:n.id,messages:M,internalLog:n.agent_log??null,currentThinkingMessageId:n.agent_message_id??null,previousThinkingLog:n.previous_agent_log??null,previousThinkingMessageId:n.previous_agent_message_id??null,pendingAgentTitle:n.title,liveResponseTiming:D,streamingResponse:n.streaming_response??null,isRunning:n.agent_status===`running`,canShowComposer:!0,followUpComposerControls:R,composerTheme:ry(n.state),forceScrollToBottomKey:B,layoutKey:B,scrollLayoutKey:B,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:V,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},B)}),g?(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-red-200`,children:g}):null]}):k===`details`?(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,X.jsx)(V9,{ticket:n,badges:ee,actionState:a,actionError:o,onAction:y,className:`h-full`})}):(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,X.jsx)(oY,{projectId:e,followUpTicketId:n.id,messages:M,internalLog:n.agent_log??null,currentThinkingMessageId:n.agent_message_id??null,previousThinkingLog:n.previous_agent_log??null,previousThinkingMessageId:n.previous_agent_message_id??null,pendingAgentTitle:n.title,liveResponseTiming:D,streamingResponse:n.streaming_response??null,isRunning:n.agent_status===`running`,canShowComposer:!0,followUpComposerControls:z,composerTheme:ry(n.state),surfaceVariant:`chat`,composerSize:`compact-on-laptop`,forceScrollToBottomKey:B,layoutKey:B,scrollLayoutKey:B,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:V,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},B),g?(0,X.jsx)(`p`,{className:`shrink-0 px-1 pt-2 text-sm text-red-200`,children:g}):null]})})},Gve=[],Kve=[],qve=[],J9=e=>jb.t(`common:mobileApp.${e}`),Y9=`Project root has uncommitted changes. Confirm branch switch to continue.`,X9=(e,t)=>{if(!e)return e;let n=new Map(t.tickets.map(e=>[e.id,e]));return e.map(e=>n.get(e.id)??e)},Jve=()=>{let e=new URLSearchParams(window.location.search),t=new URLSearchParams(window.location.hash.slice(1)),n=e.get(`mobileAccessId`)??``,r=e.get(`pairingId`)??``,i=t.get(`pairingSecret`)??``;return!n||!r||!i?null:{mobileAccessId:n,pairingId:r,pairingSecret:i}},Yve=()=>{window.history.replaceState({},``,`/mobile`)},Xve=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},Z9=(e,t)=>e instanceof Ke&&e.message?e.message:t,Q9=e=>({status:`authenticated`,csrfToken:e,projects:null,selectedProjectId:null,projectError:null,projectSummary:null,projectSummaryError:null,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null,tickets:null,ticketsError:null,selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),$9=(e=`pairing_required`)=>({status:`unauthenticated`,reason:e}),Zve=e=>e instanceof Ke&&(e.status===401||e.status===403),Qve=()=>{let[e,t]=(0,p.useState)({status:`checking`}),[n,r]=(0,p.useState)(`connecting`),[i,a]=(0,p.useState)(`opencode`),[o,s]=(0,p.useState)(Vr),[c,l]=(0,p.useState)(null),[u,d]=(0,p.useState)(`overview`),[f,m]=(0,p.useState)(!1),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(!1),[y,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(!1),[C,w]=(0,p.useState)(!1),[T,E]=(0,p.useState)(``),[D,O]=(0,p.useState)(`build`),[k,A]=(0,p.useState)(``),[j,M]=(0,p.useState)(``),[N,P]=(0,p.useState)([]),[F,I]=(0,p.useState)([]),[L,R]=(0,p.useState)([]),[z,ee]=(0,p.useState)(null),[B,V]=(0,p.useState)(!1),[te,H]=(0,p.useState)(!1),[U,ne]=(0,p.useState)(!1),[re,ie]=(0,p.useState)(null),[ae,oe]=(0,p.useState)(null),[W,se]=(0,p.useState)(null),[ce,le]=(0,p.useState)(null),[ue,de]=(0,p.useState)(!1),[fe,pe]=(0,p.useState)(``),[me,he]=(0,p.useState)(`standard`),[ge,_e]=(0,p.useState)(``),[ve,ye]=(0,p.useState)(``),[be,xe]=(0,p.useState)([]),[Se,Ce]=(0,p.useState)(!1),[we,Te]=(0,p.useState)(!1),[Ee,De]=(0,p.useState)(null),[Oe,ke]=(0,p.useState)(null),[Ae,je]=(0,p.useState)(null),[Me,Ne]=(0,p.useState)(null),[Pe,Fe]=(0,p.useState)(0),[Ie,Le]=(0,p.useState)(null),[Re,ze]=(0,p.useState)(null),[G,Be]=(0,p.useState)(null),[Ve,He]=(0,p.useState)(null),[Ue,K]=(0,p.useState)(``),[We,Ge]=(0,p.useState)(``),[q,Je]=(0,p.useState)(``),[J,Xe]=(0,p.useState)([]),[Ze,Y]=(0,p.useState)(!1),[Qe,$e]=(0,p.useState)(null),[et,tt]=(0,p.useState)(null),[nt,rt]=(0,p.useState)(``),[it,at]=(0,p.useState)(!1),[ot,st]=(0,p.useState)(null),[ct,lt]=(0,p.useState)(0),[ut,dt]=(0,p.useState)(0),[ft,pt]=(0,p.useState)(0),[mt,ht]=(0,p.useState)(`transcript`),[gt,_t]=(0,p.useState)(null),[vt,yt]=(0,p.useState)(null),[bt,xt]=(0,p.useState)(!1),[St,Ct]=(0,p.useState)(!1),[wt,Tt]=(0,p.useState)(!1),[Et,Dt]=(0,p.useState)(null),[Ot,kt]=(0,p.useState)(null),At=(0,p.useRef)(null),jt=(0,p.useRef)(null),Mt=(0,p.useRef)(null),Nt=(0,p.useRef)(null),Pt=(0,p.useRef)(null),Ft=(0,p.useRef)(0),It=(0,p.useRef)(0),Lt=(0,p.useRef)(0),Rt=(0,p.useRef)(!1),zt=(0,p.useRef)(0),Bt=(0,p.useCallback)(e=>Zve(e)?(t($9(`session_revoked`)),r(`unavailable`),m(!1),g(!1),v(!1),b(!1),de(!1),!0):!1,[]),Vt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await F_e(n,r,i);t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedTicketId!==r?t:{...t,ticketDetail:a,ticketDetailError:null})}catch(i){if(!Ye(i)){if(Bt(i))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedTicketId!==r?t:{...t,ticketDetail:null,ticketDetailError:Z9(i,`Unable to load ticket details.`)})}}},[Bt]),Ht=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await z_e(n,r,i);t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedBundleId!==r?t:{...t,bundleDetail:a,bundleDetailError:null,tickets:X9(t.tickets,a)})}catch(i){if(!Ye(i)){if(Bt(i))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedBundleId!==r?t:{...t,bundleDetail:null,bundleDetailError:Z9(i,`Unable to load bundle details.`)})}}},[Bt]),Ut=(0,p.useCallback)(async(e,n,r)=>{try{let i=await P_e(n,r);t(t=>{if(t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n)return t;let r=t.selectedTicketId&&i.some(e=>e.id===t.selectedTicketId)?t.selectedTicketId:null,a=t.selectedBundleId&&i.some(e=>e.worktree_bundle_id===t.selectedBundleId)?t.selectedBundleId:null;return{...t,tickets:i,ticketsError:null,selectedBundleId:a,bundleDetail:a?t.bundleDetail:null,bundleDetailError:a?t.bundleDetailError:null,selectedTicketId:r,ticketDetail:r?t.ticketDetail:null,ticketDetailError:r?t.ticketDetailError:null}})}catch(r){if(!Ye(r)){if(Bt(r))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,tickets:null,ticketsError:Z9(r,`Unable to load project tickets.`),selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null})}}},[Bt]),Wt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await N_e(n,r,i);At.current===n&&jt.current===r&&(Ft.current+=1),t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedChatSessionId!==r?t:{...t,chatSessionDetail:a,chatSessionDetailError:null})}catch(i){if(!Ye(i)){if(Bt(i))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedChatSessionId!==r?t:{...t,chatSessionDetail:null,chatSessionDetailError:Z9(i,`Unable to load chat transcript.`)})}}},[Bt]),Gt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await M_e(n,r);t(t=>{if(t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n)return t;let r=t.selectedChatSessionId&&i.some(e=>e.id===t.selectedChatSessionId)?t.selectedChatSessionId:null;return{...t,chatSessions:i,chatSessionsError:null,selectedChatSessionId:r,chatSessionDetail:r?t.chatSessionDetail:null,chatSessionDetailError:r?t.chatSessionDetailError:null}})}catch(r){if(!Ye(r)){if(Bt(r))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,chatSessions:null,chatSessionsError:Z9(r,`Unable to load project chats.`),selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null})}}},[Bt]),Kt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await Y_e(n,r,i);At.current===n&&Pt.current===r&&(It.current+=1),t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedSpecSessionId!==r?t:{...t,specSessionDetail:a,specSessionDetailError:null})}catch(i){if(!Ye(i)){if(Bt(i))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedSpecSessionId!==r?t:{...t,specSessionDetail:null,specSessionDetailError:Z9(i,J9(`specDetail.detailError`))})}}},[Bt]),qt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await J_e(n,r);t(t=>{if(t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n)return t;let r=t.selectedSpecSessionId&&i.some(e=>e.id===t.selectedSpecSessionId)?t.selectedSpecSessionId:null;return{...t,specSessions:i,specSessionsError:null,selectedSpecSessionId:r,specSessionDetail:r?t.specSessionDetail:null,specSessionDetailError:r?t.specSessionDetailError:null}})}catch(r){if(!Ye(r)){if(Bt(r))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,specSessions:null,specSessionsError:Z9(r,J9(`specDetail.listError`)),selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null})}}},[Bt]),Jt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await D_e(n,r);t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,projectSummary:i,projectSummaryError:null})}catch(r){if(!Ye(r)){if(Bt(r))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,projectSummary:null,projectSummaryError:Z9(r,`Unable to load the project summary.`)})}}},[Bt]),Yt=(0,p.useCallback)(async(e,n,r=!1)=>{Ct(!0),yt(null);try{let[i,a]=await Promise.all([j_e(e,n),r?o9(n):Promise.resolve(null)]),o=At.current;if(o&&o!==e)return;if(_t(i),yt(null),Dt(null),a){let n=a.find(t=>t.id===e);n&&t(t=>t.status!==`authenticated`||t.selectedProjectId!==e?t:{...t,projects:t.projects?.map(t=>t.id===e?{...t,active_target_kind:n.active_target_kind,active_target_bundle_id:n.active_target_bundle_id}:t)??t.projects})}return!0}catch(t){if(!Ye(t)){if(Bt(t))return;let n=At.current;if(n&&n!==e)return;_t(null),yt(Z9(t,`Unable to load project target options.`))}return!1}finally{n?.aborted||Ct(!1)}},[Bt]),Xt=(0,p.useCallback)(e=>{t(t=>t.status===`authenticated`?{...t,projects:t.projects?.map(t=>t.id===e.id?e:t)??t.projects,projectSummary:t.projectSummary?.project.id===e.id?{...t.projectSummary,project:e}:t.projectSummary}:t)},[]),Zt=(0,p.useCallback)(async t=>{if(e.status!==`authenticated`)return;let n=zt.current+1;zt.current=n;try{let r=await T_e(t,e.csrfToken);zt.current===n&&a(r.tool)}catch{}},[e]),Qt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await o9(n),a=r&&i.some(e=>e.id===r)?r:i[0]?.id??null;t(t=>{if(t.status!==`authenticated`||t.csrfToken!==e)return t;let n=!!(t.selectedProjectId&&a&&t.selectedProjectId===a);return{...t,projects:i,selectedProjectId:a,projectError:null,projectSummary:n?t.projectSummary:null,projectSummaryError:n?t.projectSummaryError:null,chatSessions:n?t.chatSessions:null,chatSessionsError:n?t.chatSessionsError:null,selectedChatSessionId:n?t.selectedChatSessionId:null,chatSessionDetail:n?t.chatSessionDetail:null,chatSessionDetailError:n?t.chatSessionDetailError:null,tickets:n?t.tickets:null,ticketsError:n?t.ticketsError:null,selectedBundleId:n?t.selectedBundleId:null,bundleDetail:n?t.bundleDetail:null,bundleDetailError:n?t.bundleDetailError:null,selectedTicketId:n?t.selectedTicketId:null,ticketDetail:n?t.ticketDetail:null,ticketDetailError:n?t.ticketDetailError:null,specSessions:n?t.specSessions:null,specSessionsError:n?t.specSessionsError:null,selectedSpecSessionId:n?t.selectedSpecSessionId:null,specSessionDetail:n?t.specSessionDetail:null,specSessionDetailError:n?t.specSessionDetailError:null}});let o=a?i.find(e=>e.id===a)??null:null;a&&(Jt(e,a,n),o?.active_target_kind===`bundle`&&Yt(a,n),Gt(e,a,n),qt(e,a,n),Ut(e,a,n))}catch(n){if(!Ye(n)){if(Bt(n))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e?t:{...t,projects:t.projects??[],projectError:Z9(n,`Unable to load projects from desktop Archon.`)})}}},[Bt,Gt,Jt,Yt,qt,Ut]),$t=(0,p.useCallback)(async e=>{t({status:`checking`}),r(`connecting`);try{let n=await Eve(e);if(n.authenticated&&n.csrf_token){r(`connecting`),t(Q9(n.csrf_token)),Qt(n.csrf_token,e,n.preferred_project_id);return}t($9())}catch(e){Ye(e)||t({status:`error`,message:Z9(e,`Mobile access is unavailable. Make sure it is still enabled on desktop Archon.`)})}},[Qt]),en=(0,p.useCallback)((e,n,i)=>{r(`connecting`),t(Q9(e)),Qt(e,i,n)},[Qt]);(0,p.useEffect)(()=>{let e=new AbortController;if(window.location.pathname===`/mobile/pair`){let n=Jve();return Yve(),n?(t({status:`pairing`}),Dve(n,e.signal).then(e=>{t({status:`pairing_confirmation`,payload:n,displayCode:e.display_code,expiresAt:e.expires_at,error:null})}).catch(e=>{t({status:`error`,message:Z9(e,`Pairing failed. Regenerate the pairing link from desktop Archon and try again.`)})}),()=>e.abort()):(t({status:`error`,message:`Pairing link is missing required pairing details.`}),()=>e.abort())}return $t(e.signal),()=>e.abort()},[en,$t]),(0,p.useEffect)(()=>{if(e.status!==`authenticated`)return;let t=new AbortController,n=zt.current;return w_e(t.signal).then(e=>{zt.current===n&&a(e.tool)}).catch(e=>{Ye(e)||Bt(e)}),E_e(t.signal).then(e=>s(e.length>0?e:Vr())).catch(e=>{Ye(e)||Bt(e)||s(Vr())}),()=>t.abort()},[e.status,Bt]);let tn=e.status===`authenticated`?e.csrfToken:null,nn=e.status===`authenticated`?e.selectedProjectId:null,rn=e.status===`authenticated`?e.selectedChatSessionId:null,an=e.status===`authenticated`?e.selectedBundleId:null,on=e.status===`authenticated`?e.selectedTicketId:null,sn=e.status===`authenticated`?e.selectedSpecSessionId:null,cn=e.status===`authenticated`?e.projects?.find(t=>t.id===e.selectedProjectId)??null:null,ln=e.status===`authenticated`?e.chatSessionDetail:null,un=e.status===`authenticated`?e.bundleDetail:null,dn=e.status===`authenticated`?e.ticketDetail:null,fn=e.status===`authenticated`?e.specSessionDetail:null,pn=!St&>&&`current_branch`in gt?{status:`ready`,branch:gt.current_branch}:null,mn=!!(ln?.target_available===!1||ln&&St||ln?.target_kind===`repo_root`&&ln.target_branch_snapshot&&!pn||ln&&cn&&!i5({activeProject:cn,activeProjectBranchState:pn,session:ln})),hn=fn?.target_available===!1?fn.target_unavailable_reason??J9(`specDetail.targetUnavailable`):null,gn=!!(fn?.target_kind===`repo_root`&&fn.target_branch_snapshot&&cn?.active_target_kind!==`bundle`),_n=fn?.target_kind===`bundle`&&vt?jb.t(`common:mobileApp.specDetail.targetRefreshError`,{error:vt}):gn&&vt?jb.t(`common:mobileApp.specDetail.targetLoadError`,{error:vt}):null,vn=fn&&St||gn&&!pn&&!_n?J9(`specDetail.targetLoading`):_n,yn=!!(fn&&!hn&&!vn&&!i5({activeProject:cn,activeProjectBranchState:pn,session:fn})),bn=yn&&fn?jb.t(`common:mobileApp.specDetail.targetMismatch`,{sessionTarget:o5(fn),currentTarget:s5({activeProject:cn,activeProjectBranchState:pn})}):null,xn=b9(cn,gt),Sn=St&&(!cn||cn.active_target_kind===`bundle`),Cn=Nve(),wn=ln?.tool??i,Tn=fn?.tool??i,En=ln?.id??null,Dn=ln?.model??``,On=ln?.variant??``,kn=ln?.skills?.join(`\0`)??``,An=fn?.id??null,jn=fn?.model??``,Mn=fn?.variant??``,Nn=fn?.skills?.join(`\0`)??``,Pn=u===`spec`?Tn:u===`tickets`?dn?.tool??i:wn,Fn=z===Pn,In=Fn?F:Kve,Ln=Fn?L:qve,Rn=!!(tn&&nn)&&(!Fn||B),zn=jb.t(`common:mobileApp.agentSettings.loading`),Bn=!!N9(ln?.messages),Vn=!!N9(fn?.messages),Hn=!!N9(dn?.messages),Un=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:Rn?zn:U?`Wait for the chat mode change before sending another prompt.`:ln?.agent_status===`running`?`Stop or wait for the current response before sending another prompt.`:Bn?jb.t(`common:questionSet.waitForResolution`):null,Wn=!!(ln&&qY(ln,Bn)),Gn=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:Rn?zn:hn||vn||bn||(we?`Wait for the spec mode change before sending another prompt.`:fn?.agent_status===`running`?`Stop or wait for the current response before sending another prompt.`:Vn?jb.t(`common:questionSet.waitForResolution`):null),Kn=!Cn&&(u===`tickets`&&(_&&!!on||h&&!!an)||u===`chats`&&y||u===`spec`&&ue);(0,p.useEffect)(()=>{At.current=nn},[nn]),(0,p.useEffect)(()=>{nn||(_t(null),yt(null),Dt(null),xt(!1),Ct(!1),Tt(!1))},[nn]),(0,p.useEffect)(()=>{jt.current=rn},[rn]),(0,p.useEffect)(()=>{Mt.current=an},[an]),(0,p.useEffect)(()=>{Nt.current=on},[on]),(0,p.useEffect)(()=>{Pt.current=sn},[sn]),(0,p.useEffect)(()=>{if(!tn||!nn){I([]),R([]),ee(null),V(!1);return}let e=new AbortController;return V(!0),Promise.all([cve(Pn,e.signal),Pn===`opencode`?lve(Pn,nn,e.signal):Promise.resolve([])]).then(([t,n])=>{e.signal.aborted||(I(t),R(n),ee(Pn))}).catch(e=>{Bt(e)||Ye(e)||(I([]),R([]),ee(Pn))}).finally(()=>{e.signal.aborted||V(!1)}),()=>e.abort()},[Pn,tn,Bt,nn]),(0,p.useEffect)(()=>{let e=vw(cn?.helper_models,wn);A(En?Dn:e.model??(wn===`opencode`?cn?.helper_model:null)??``),M(En?On:e.variant??(wn===`opencode`?cn?.helper_variant:null)??``),P(kn?kn.split(`\0`):[])},[wn,Dn,En,kn,On,cn?.helper_model,cn?.helper_models,cn?.helper_variant,nn]),(0,p.useEffect)(()=>{ln?.mode&&O(ln.mode)},[ln?.id,ln?.mode]),(0,p.useEffect)(()=>{if(ln)return;let e=In.find(e=>e.id===k)??null;M(t=>e?e.variants.includes(t)?t:``:t)},[In,ln,k]),(0,p.useEffect)(()=>{K(``),$e(null),Ge(dn?.model??``),Je(dn?.variant??``),Xe(dn?.skills??[])},[dn?.id,dn?.model,dn?.skills,dn?.variant]),(0,p.useEffect)(()=>{rt(``),st(null)},[un?.bundle.id]),(0,p.useEffect)(()=>{let e=vw(cn?.helper_models,Tn);_e(An?jn:e.model??(Tn===`opencode`?cn?.helper_model:null)??``),ye(An?Mn:e.variant??(Tn===`opencode`?cn?.helper_variant:null)??``),xe(Nn?Nn.split(`\0`):[])},[cn?.helper_model,cn?.helper_models,cn?.helper_variant,nn,jn,An,Nn,Mn,Tn]),(0,p.useEffect)(()=>{fn?.mode&&he(fn.mode)},[fn?.id,fn?.mode]),(0,p.useEffect)(()=>{if(fn)return;let e=In.find(e=>e.id===ge)??null;ye(t=>e?e.variants.includes(t)?t:``:t)},[In,fn,ge]),(0,p.useEffect)(()=>{let e=In.find(e=>e.id===We)??null;Je(t=>e?e.variants.includes(t)?t:``:t)},[In,We]),(0,p.useEffect)(()=>{if(!tn)return;let e=Ave();l(e),r(`connecting`);let t=()=>{let e=At.current,t=jt.current,n=Mt.current,r=Nt.current,i=Pt.current;Qt(tn,void 0,e),e&&(Jt(tn,e),Gt(tn,e),qt(tn,e),Ut(tn,e)),e&&t&&Wt(tn,e,t),e&&n&&Ht(tn,e,n),e&&r&&Vt(tn,e,r),e&&i&&Kt(tn,e,i)},n=()=>{r(`connected`),t()},i=()=>{r(`reconnecting`)},o=()=>{r(`unavailable`)},s=()=>{Qt(tn,void 0,At.current)},c=(e=null)=>{let t=At.current;t&&(e?.project_id&&e.project_id!==t||Jt(tn,t))},u=(e=null)=>{let t=At.current;t&&(e?.project_id&&e.project_id!==t||Gt(tn,t))},d=(e=null)=>{let t=At.current;t&&(e?.project_id&&e.project_id!==t||Ut(tn,t))},f=(e=null)=>{let t=At.current,n=jt.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||Wt(tn,t,n)},p=(e=null)=>{let t=At.current,n=Nt.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||Vt(tn,t,n)},m=(e=null)=>{let t=At.current,n=Mt.current;!t||!n||e?.project_id&&e.project_id!==t||Ht(tn,t,n)},h=(e=null)=>{let t=At.current;t&&(e?.project_id&&e.project_id!==t||qt(tn,t))},g=(e=null)=>{let t=At.current,n=Pt.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||Kt(tn,t,n)},_=e=>{e.tool!==`claude`&&e.tool!==`opencode`||(zt.current+=1,a(e.tool))};return e.on(`connect`,n),e.on(`disconnect`,i),e.on(`connect_error`,o),e.on(`tool:updated`,_),e.on(`ticket:created`,c),e.on(`ticket:created`,d),e.on(`ticket:updated`,c),e.on(`ticket:updated`,d),e.on(`ticket:updated`,m),e.on(`ticket:updated`,p),e.on(`ticket:deleted`,s),e.on(`ticket:deleted`,d),e.on(`ticket:deleted`,m),e.on(`ticket-dependency:created`,c),e.on(`ticket-dependency:deleted`,c),e.on(`chat-session:created`,u),e.on(`chat-session:updated`,u),e.on(`chat-session:updated`,f),e.on(`chat-session:deleted`,u),e.on(`spec-session:created`,h),e.on(`spec-session:updated`,h),e.on(`spec-session:updated`,g),e.on(`spec-session:deleted`,h),()=>{e.off(`connect`,n),e.off(`disconnect`,i),e.off(`connect_error`,o),e.off(`tool:updated`,_),e.off(`ticket:created`,c),e.off(`ticket:created`,d),e.off(`ticket:updated`,c),e.off(`ticket:updated`,d),e.off(`ticket:updated`,m),e.off(`ticket:updated`,p),e.off(`ticket:deleted`,s),e.off(`ticket:deleted`,d),e.off(`ticket:deleted`,m),e.off(`ticket-dependency:created`,c),e.off(`ticket-dependency:deleted`,c),e.off(`chat-session:created`,u),e.off(`chat-session:updated`,u),e.off(`chat-session:updated`,f),e.off(`chat-session:deleted`,u),e.off(`spec-session:created`,h),e.off(`spec-session:updated`,h),e.off(`spec-session:updated`,g),e.off(`spec-session:deleted`,h),e.disconnect(),l(null)}},[tn,Ht,Wt,Gt,Jt,Qt,Kt,qt,Vt,Ut]),(0,p.useEffect)(()=>{an||g(!1)},[an]),(0,p.useEffect)(()=>{on||v(!1)},[on]);let qn=()=>{$t()},Jn=e=>{d(e),g(!1),v(!1),b(!1),de(!1),kt(null)},Yn=()=>{m(!0)},Xn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(Dt(null),xt(!0),!gt&&!St&&Yt(e.selectedProjectId))},Zn=()=>{e.status===`authenticated`&&(S(!0),kve(e.csrfToken).then(()=>t($9())).catch(e=>{Bt(e)||t({status:`error`,message:Z9(e,`Logout failed. Mobile access may have already been revoked from desktop Archon.`)})}).finally(()=>S(!1)))},Qn=()=>{if(e.status!==`pairing_confirmation`||C)return;let n=e.payload;w(!0),t({...e,error:null}),Ove(n).then(e=>{if(e.authenticated&&e.csrf_token){window.history.replaceState({},``,`/mobile`),en(e.csrf_token,e.preferred_project_id);return}t($9())}).catch(e=>{t(t=>t.status===`pairing_confirmation`?{...t,error:Z9(e,`Pairing failed. Regenerate the pairing link from desktop Archon and try again.`)}:t)}).finally(()=>w(!1))},$n=()=>{window.history.replaceState({},``,`/mobile`),t($9())},er=()=>{e.status===`authenticated`&&(t({...e,projects:null,projectError:null}),Qt(e.csrfToken))},tr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,projectSummary:null,projectSummaryError:null}),Jt(e.csrfToken,e.selectedProjectId))},nr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(_t(null),yt(null),Dt(null),Yt(e.selectedProjectId))},rr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),Gt(e.csrfToken,e.selectedProjectId))},ir=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||(t({...e,chatSessionDetail:null,chatSessionDetailError:null}),Wt(e.csrfToken,e.selectedProjectId,e.selectedChatSessionId))},ar=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,tickets:null,ticketsError:null,selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),Ut(e.csrfToken,e.selectedProjectId))},or=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||(t({...e,ticketDetail:null,ticketDetailError:null}),Vt(e.csrfToken,e.selectedProjectId,e.selectedTicketId))},sr=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||(t({...e,bundleDetail:null,bundleDetailError:null}),Ht(e.csrfToken,e.selectedProjectId,e.selectedBundleId))},cr=n=>{if(e.status!==`authenticated`)return;let r=e.projects?.find(e=>e.id===n)??null;At.current=n,t({...e,selectedProjectId:n,projectSummary:null,projectSummaryError:null,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null,tickets:null,ticketsError:null,selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),Le(null),ze(null),Be(null),He(null),se(null),He(null),je(null),st(null),_t(null),yt(null),Dt(null),m(!1),xt(!1),g(!1),v(!1),b(!1),de(!1),ht(`transcript`),kt(null),d(`overview`),Jt(e.csrfToken,n),r?.active_target_kind===`bundle`&&Yt(n),Gt(e.csrfToken,n),qt(e.csrfToken,n),Ut(e.csrfToken,n)},lr=async t=>{if(!(e.status!==`authenticated`||!e.selectedProjectId)){Tt(!0),Dt(null);try{Xt(await f9(e.selectedProjectId,e.csrfToken,{kind:`bundle`,bundle_id:t})),xt(!1),Jt(e.csrfToken,e.selectedProjectId),await Yt(e.selectedProjectId)}catch(e){if(Bt(e))return;Dt(Z9(e,J9(`specDetail.updateTargetError`)))}finally{Tt(!1)}}},ur=async(t,n={})=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;Tt(!0),Dt(null);let r=r=>f9(e.selectedProjectId??``,e.csrfToken,{kind:`repo_root`,...t?{branch:t}:{},...n.createBranch===!1?{create_branch:!1}:{},...r?{confirm_dirty_switch:!0}:{}});try{let t;try{t=await r(n.confirmDirtySwitch===!0)}catch(e){if(!n.confirmDirtySwitch&&e instanceof Ke&&e.status===409&&e.message===Y9){if(!window.confirm(`${Y9}\n\nSwitch anyway?`))return;t=await r(!0)}else throw e}Xt(t),xt(!1),Jt(e.csrfToken,e.selectedProjectId),await Yt(e.selectedProjectId)}catch(e){if(Bt(e))return;Dt(Z9(e,J9(`specDetail.updateTargetError`)))}finally{Tt(!1)}},dr=_n?nr:()=>{if(!(!fn||fn.target_available===!1)){if(fn.target_kind===`bundle`){fn.target_bundle_id&&lr(fn.target_bundle_id);return}ur(fn.target_branch_snapshot??null,{createBranch:!1})}},fr=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:n,chatSessionDetail:null,chatSessionDetailError:null}),se(null),lt(e=>e+1),b(!0),d(`chats`),Wt(e.csrfToken,e.selectedProjectId,n),Yt(e.selectedProjectId,void 0,!0))},pr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),se(null),E(``),lt(e=>e+1),b(!0),d(`chats`))},mr=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedBundleId:n,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),Le(null),ze(null),He(null),st(null),kt(null),ht(`transcript`),dt(e=>e+1),g(!0),v(!1),d(`tickets`),Ht(e.csrfToken,e.selectedProjectId,n))},hr=(n,r)=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedTicketId:n,ticketDetail:null,ticketDetailError:null}),kt(r),pt(e=>e+1),g(r!==null),v(!0),d(`tickets`),Vt(e.csrfToken,e.selectedProjectId,n))},gr=()=>{b(!1)},_r=async n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return null;if(!e.chatSessionDetail||!e.selectedChatSessionId)return O(n),null;if(e.chatSessionDetail.mode===n||U||Bn)return null;let r=e.selectedProjectId,i=e.selectedChatSessionId,a=e.csrfToken;ne(!0),se(null);try{let e=await G_e(r,i,a,{mode:n});return O(e.mode),t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedChatSessionId!==i)return t;let n=t.chatSessions?.map(t=>t.id===e.id?e:t)??t.chatSessions;return{...t,chatSessions:n,chatSessionDetail:e,chatSessionDetailError:null}}),e}catch(e){return Bt(e)||se(Z9(e,`Unable to update the chat mode right now.`)),null}finally{ne(!1)}},vr=()=>{if(e.status===`authenticated`&&Ot&&e.selectedBundleId===Ot){t({...e,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),v(!1),g(!0),kt(null);return}kt(null),v(!1)},yr=()=>{g(!1)},br=e=>{let t=In.find(t=>t.id===e)??null;A(e),M(e=>t&&t.variants.includes(e)?e:``)},xr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),wr())},Sr=(e,n,r,i)=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==e||i!==void 0&&Ft.current!==i?t:{...t,chatSessions:t.chatSessions?.map(e=>e.id===r.id?r:e)??t.chatSessions,chatSessionDetail:t.selectedChatSessionId===n?r:t.chatSessionDetail,chatSessionDetailError:t.selectedChatSessionId===n?null:t.chatSessionDetailError})},Cr=(n,r,i=e.status===`authenticated`?e.chatSessionDetail:null)=>{if(e.status!==`authenticated`||!e.selectedProjectId||te||Un)return Promise.resolve(!1);let a=n.trim();if(!a)return Promise.resolve(!1);let o=e.selectedProjectId,s=i?.id??null,c=e.csrfToken,l=k||null,u=k&&j?j:null,d=wn===`opencode`?N:[],f=performance.now();Lt.current+=1;let p=`mobile-chat:${Lt.current}`;i&&le({parentType:`chat`,parentId:i.id,turnKey:p,startedAt:f}),se(null),H(!0);let m=e=>U_e(o,e.id,c,{instruction:a,tool:e.tool,model:l,variant:u,skills:d});return(i?m(i):H_e(o,c,{mode:D,tool:wn,model:l,variant:u,skills:d}).then(m)).then(e=>(le({parentType:`chat`,parentId:e.id,turnKey:p,startedAt:f}),r&&E(``),b(!0),t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==o)return t;let n=t.chatSessions??[],r=n.some(t=>t.id===e.id)?n.map(t=>t.id===e.id?e:t):[e,...n];return{...t,chatSessions:r,selectedChatSessionId:e.id,chatSessionDetail:e,chatSessionDetailError:null}}),Gt(c,o),!0)).catch(async e=>{le(e=>e?.turnKey===p?null:e);let t=qe(e,`chat_session`);return t&&s?Sr(o,s,t):e instanceof Ke&&e.status===409&&s&&await Wt(c,o,s),Bt(e)||se(Z9(e,`Unable to send the chat prompt.`)),!1}).finally(()=>{H(!1)})},wr=()=>{T.trim()&&Cr(T,!0)},Tr=async()=>{let t=e.status===`authenticated`?e.chatSessionDetail:null;if(!(!t||!qY(t,Bn)||Rt.current||te||Un)){Rt.current=!0;try{let e=await _r(`build`);if(!e)return;await Cr(KY,!1,e)}finally{Rt.current=!1}}},Er=async(n,r)=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId)throw Error(`Chat question set is unavailable.`);let i=e.selectedProjectId,a=e.selectedChatSessionId,o=e.csrfToken,s=WJ({parentType:`chat`,parentId:a,setId:r.set_id});se(null);try{let e=await W_e(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedChatSessionId!==a?t:{...t,chatSessions:t.chatSessions?.map(t=>t.id===e.id?e:t)??t.chatSessions,chatSessionDetail:e,chatSessionDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){KJ(s);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?Sr(i,a,t):await Wt(o,i,a)}throw Bt(e)||se(Z9(e,`Unable to resolve the chat questions.`)),e}},Dr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||re)return;let t=e.selectedProjectId,n=e.selectedChatSessionId;se(null),ie(n),le(e=>e?.parentId===n?null:e),K_e(t,n,e.csrfToken).then(()=>Wt(e.csrfToken,t,n)).catch(e=>{Bt(e)||se(Z9(e,`Unable to stop the chat response.`))}).finally(()=>ie(null))},Or=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||ae||mn)return;let t=e.selectedProjectId,n=e.selectedChatSessionId,r=e.csrfToken,i=Ft.current,a=performance.now();se(null),oe(n);let o=q_e(t,n,r);Lt.current+=1;let s={parentType:`chat`,parentId:n,turnKey:`mobile-chat:${Lt.current}`,startedAt:a};le(s),o.then(e=>{Sr(t,n,e,i)}).catch(async e=>{le(e=>e?.turnKey===s.turnKey?null:e);let a=qe(e,`chat_session`);a?Sr(t,n,a,i):e instanceof Ke&&e.status===409&&await Wt(r,t,n),Bt(e)||se(Z9(e,J9(`chatDetail.resumeError`)))}).finally(()=>oe(e=>e===n?null:e))},kr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),qt(e.csrfToken,e.selectedProjectId))},Ar=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||(t({...e,specSessionDetail:null,specSessionDetailError:null}),Kt(e.csrfToken,e.selectedProjectId,e.selectedSpecSessionId))},jr=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:n,specSessionDetail:null,specSessionDetailError:null}),je(null),Dt(null),Fe(e=>e+1),de(!0),d(`spec`),Kt(e.csrfToken,e.selectedProjectId,n),Yt(e.selectedProjectId,void 0,!0))},Mr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),je(null),pe(``),Fe(e=>e+1),de(!0),d(`spec`))},Nr=()=>{de(!1)},Pr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;if(!e.specSessionDetail||!e.selectedSpecSessionId){he(n);return}if(e.specSessionDetail.mode===n||we||Vn)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken;Te(!0),je(null),Q_e(r,i,a,{mode:n}).then(e=>{he(e.mode),t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedSpecSessionId!==i)return t;let n=t.specSessions?.map(t=>t.id===e.id?e:t)??t.specSessions;return{...t,specSessions:n,specSessionDetail:e,specSessionDetailError:null}})}).catch(e=>{Bt(e)||je(Z9(e,J9(`specDetail.modeError`)))}).finally(()=>Te(!1))},Fr=e=>{let t=In.find(t=>t.id===e)??null;_e(e),ye(e=>t&&t.variants.includes(e)?e:``)},Ir=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Rr())},Lr=(e,n,r,i)=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==e||i!==void 0&&It.current!==i?t:{...t,specSessions:t.specSessions?.map(e=>e.id===r.id?r:e)??t.specSessions,specSessionDetail:t.selectedSpecSessionId===n?r:t.specSessionDetail,specSessionDetailError:t.selectedSpecSessionId===n?null:t.specSessionDetailError})},Rr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||Se||Gn)return;let n=fe.trim();if(!n)return;let r=e.selectedProjectId,i=e.specSessionDetail?.id??null,a=e.csrfToken,o=ge||null,s=ge&&ve?ve:null,c=Tn===`opencode`?be:[],l=performance.now();Lt.current+=1;let u=`mobile-spec:${Lt.current}`;e.specSessionDetail&&Ne({parentType:`spec`,parentId:e.specSessionDetail.id,turnKey:u,startedAt:l}),je(null),Ce(!0);let d=e=>c9(r,e.id,a,{instruction:n,tool:e.tool,model:o,variant:s,skills:c});(e.specSessionDetail?d(e.specSessionDetail):X_e(r,a,{mode:me,tool:Tn,model:o,variant:s,skills:c}).then(d)).then(e=>{Ne({parentType:`spec`,parentId:e.id,turnKey:u,startedAt:l}),pe(``),de(!0),t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==r)return t;let n=t.specSessions??[],i=n.some(t=>t.id===e.id)?n.map(t=>t.id===e.id?e:t):[e,...n];return{...t,specSessions:i,selectedSpecSessionId:e.id,specSessionDetail:e,specSessionDetailError:null}}),qt(a,r)}).catch(e=>{Ne(e=>e?.turnKey===u?null:e);let t=e instanceof Ke&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&i&&Lr(r,i,t),!Bt(e)&&je(Z9(e,J9(`specDetail.sendError`)))}).finally(()=>Ce(!1))},zr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||Se)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken,o=e.specSessionDetail?.tool??Tn,s=ge||null,c=ge&&ve?ve:null,l=Tn===`opencode`?be:[],u=performance.now();Lt.current+=1;let d=`mobile-spec:${Lt.current}`;Ne({parentType:`spec`,parentId:i,turnKey:d,startedAt:u}),je(null),Ce(!0),c9(r,i,a,{instruction:n,tool:o,model:s,variant:c,skills:l}).then(e=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedSpecSessionId!==i?t:{...t,specSessionDetail:e,specSessionDetailError:null})}).catch(e=>{Ne(e=>e?.turnKey===d?null:e);let t=e instanceof Ke&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&Lr(r,i,t),!Bt(e)&&je(Z9(e,J9(`specDetail.sendError`)))}).finally(()=>Ce(!1))},Br=async(n,r)=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId)throw Error(`Spec question set is unavailable.`);let i=e.selectedProjectId,a=e.selectedSpecSessionId,o=e.csrfToken,s=WJ({parentType:`spec`,parentId:a,setId:r.set_id});je(null);try{let e=await Z_e(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedSpecSessionId!==a?t:{...t,specSessions:t.specSessions?.map(t=>t.id===e.id?e:t)??t.specSessions,specSessionDetail:e,specSessionDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){KJ(s);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?Lr(i,a,t):await Kt(o,i,a)}throw Bt(e)||je(Z9(e,`Unable to resolve the spec questions.`)),e}},Hr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||Ee)return;let t=e.selectedProjectId,n=e.selectedSpecSessionId;je(null),De(n),Ne(e=>e?.parentId===n?null:e),$_e(t,n,e.csrfToken).then(()=>Kt(e.csrfToken,t,n)).catch(e=>{Bt(e)||je(Z9(e,J9(`specDetail.stopError`)))}).finally(()=>De(null))},Ur=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||Oe)return;let t=e.selectedProjectId,n=e.selectedSpecSessionId,r=e.csrfToken,i=It.current,a=performance.now();je(null),ke(n);let o=eve(t,n,r);Lt.current+=1;let s={parentType:`spec`,parentId:n,turnKey:`mobile-spec:${Lt.current}`,startedAt:a};Ne(s),o.then(e=>{Lr(t,n,e,i)}).catch(async e=>{Ne(e=>e?.turnKey===s.turnKey?null:e);let a=qe(e,`spec_session`);a?Lr(t,n,a,i):e instanceof Ke&&e.status===409&&await Kt(r,t,n),Bt(e)||je(Z9(e,J9(`specDetail.resumeError`)))}).finally(()=>ke(e=>e===n?null:e))},Wr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||G||(n===`stop-run`||n===`pause-build`)&&!window.confirm(`Stop this ticket action on the desktop machine?`))return;let r=e.selectedProjectId,i=e.selectedTicketId,a=e.csrfToken,o=n===`build`?l9(r,i,a,`build`):n===`review`?l9(r,i,a,`review`):n===`run`?tve(r,i,a):n===`stop-run`?nve(r,i,a):n===`pause-build`?u9(r,i,a):d9(r,i,a);Be(n),He(null),o.then(e=>{t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedTicketId!==i)return t;let n=t.tickets?.map(t=>t.id===e.id?e:t)??t.tickets;return{...t,tickets:n,ticketDetail:e,ticketDetailError:null}}),Jt(a,r),Ut(a,r),Vt(a,r,i)}).catch(e=>{Bt(e)||He(Z9(e,`Unable to update this ticket from mobile.`))}).finally(()=>Be(null))},Gr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||Ie)return;let r=e.selectedProjectId,i=e.selectedBundleId,a=e.csrfToken,o=e.bundleDetail,{runningBuildTicketId:s,resumableBuildTicketId:c}=M9(o);if(n===`pause-build`&&!window.confirm(`Pause this bundle build on the desktop machine?`))return;let l=e=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedBundleId!==i?t:{...t,tickets:X9(t.tickets,e),bundleDetail:e,bundleDetailError:null})},u=e=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedBundleId!==i?t:{...t,tickets:t.tickets?.map(t=>t.id===e.id?e:t)??t.tickets,bundleDetail:t.bundleDetail?{...t.bundleDetail,tickets:t.bundleDetail.tickets.map(t=>t.id===e.id?e:t)}:t.bundleDetail,bundleDetailError:null})},d=n===`build`?B_e(r,i,a):n===`review`?V_e(r,i,a):n===`pause-build`?s?u9(r,s,a):null:c?d9(r,c,a):null;d&&(Le(n),ze(null),d.then(e=>{`tickets`in e?l(e):u(e),Jt(a,r),Ut(a,r),Ht(a,r,i)}).catch(e=>{Bt(e)||ze(Z9(e,`Unable to update this bundle from mobile.`))}).finally(()=>Le(null)))},Kr=e=>{let t=In.find(t=>t.id===e)??null;Ge(e),Je(e=>t&&t.variants.includes(e)?e:``)},qr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Jr())},Jr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||!e.ticketDetail||Ze||Hn)return;let n=Ue.trim();if(!n)return;let r=e.selectedProjectId,i=e.ticketDetail,a=e.csrfToken,o=c3(i,{model:We||null,variant:q||null,skills:J});Lt.current+=1;let s={parentType:`ticket`,parentId:i.id,turnKey:`mobile-ticket:${Lt.current}`,startedAt:performance.now()};tt(s);let c=()=>i.state===`plan`?ive(r,i.id,a,n):ove(r,i.id,a,n),l=e=>{t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedTicketId!==i.id)return t;let n=t.tickets?.map(t=>t.id===e.id?e:t)??t.tickets;return{...t,tickets:n,ticketDetail:e,ticketDetailError:null}})};Y(!0),$e(null),(async()=>{o.shouldPersist&&l(await rve(r,i.id,a,{model:o.model,variant:o.variant,skills:o.skills})),l(await c()),K(``),Ut(a,r),Vt(a,r,i.id)})().catch(async e=>{tt(e=>e?.turnKey===s.turnKey?null:e);let t=qe(e,`ticket`);t?l(t):e instanceof Ke&&e.status===409&&await Vt(a,r,i.id),!Bt(e)&&$e(Z9(e,`Unable to send the ticket follow-up.`))}).finally(()=>Y(!1))},Yr=async(n,r)=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId)throw Error(`Ticket question set is unavailable.`);let i=e.selectedProjectId,a=e.selectedTicketId,o=e.csrfToken,s=WJ({parentType:`ticket`,parentId:a,setId:r.set_id});$e(null);try{let e=await ave(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedTicketId!==a?t:{...t,tickets:t.tickets?.map(t=>t.id===e.id?e:t)??t.tickets,ticketDetail:e,ticketDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){KJ(s);let n=e.data&&typeof e.data==`object`&&`ticket`in e.data?e.data.ticket:null;n?t(e=>e.status===`authenticated`&&e.selectedTicketId===a?{...e,ticketDetail:n}:e):await Vt(o,i,a)}throw Bt(e)||$e(Z9(e,`Unable to resolve the ticket questions.`)),e}},Xr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Zr())},Zr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||it)return;let n=nt.trim();if(!n)return;let r=e.selectedProjectId,i=e.selectedBundleId,a=e.csrfToken,o=e=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedBundleId!==i?t:{...t,tickets:X9(t.tickets,e),bundleDetail:e,bundleDetailError:null})};at(!0),st(null),sve(r,i,a,n).then(e=>{o(e),rt(``),Ut(a,r),Ht(a,r,i)}).catch(e=>{Bt(e)||st(Z9(e,`Unable to send the bundle follow-up.`))}).finally(()=>at(!1))},Qr=(0,p.useCallback)(async(e,t,n)=>{try{return await I_e(t??``,e,n)}catch(e){throw Bt(e),e}},[Bt]),$r=(0,p.useCallback)(async(e,t,n)=>{try{return await L_e(t??``,e,n)}catch(e){throw Bt(e),e}},[Bt]),ei=(0,p.useCallback)(async(e,t,n)=>{try{return await R_e(t??``,e,n)}catch(e){throw Bt(e),e}},[Bt]);return e.status===`checking`?(0,X.jsx)(_9,{title:`Checking mobile session`,description:`Archon is validating this browser before showing project controls.`}):e.status===`pairing`?(0,X.jsx)(_9,{title:`Checking pairing link`,description:`Keep this page open while Archon verifies the one-time pairing link.`}):e.status===`pairing_confirmation`?(0,X.jsxs)(_9,{title:`Compare pairing code`,description:`Confirm this code matches the desktop dialog before pairing this phone.`,children:[(0,X.jsx)(gC,{className:`border-primary/25 bg-primary/10 shadow-none`,children:(0,X.jsxs)(xC,{className:`space-y-2 pt-5 text-center`,children:[(0,X.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-foreground`,children:`Verification code`}),(0,X.jsx)(`div`,{className:`font-mono text-3xl font-semibold tracking-[0.18em] text-foreground`,children:e.displayCode}),(0,X.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Expires at `,Xve(e.expiresAt)]})]})}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`If this code does not match the desktop dialog, cancel and regenerate the pairing link from desktop Archon.`}),e.error?(0,X.jsx)(`p`,{className:`text-sm text-red-200`,children:e.error}):null,(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,X.jsx)(Q,{size:`lg`,disabled:C,onClick:Qn,children:C?`Pairing...`:`Pair this phone`}),(0,X.jsx)(Q,{variant:`outline`,size:`lg`,disabled:C,onClick:$n,children:`Cancel`})]})]}):e.status===`unauthenticated`?(0,X.jsx)(_9,{title:e.reason===`session_revoked`?`Mobile session revoked`:`Pairing required`,description:e.reason===`session_revoked`?`This mobile session is no longer valid. Scan the QR code or open the pairing link from desktop Archon to continue.`:`This browser is not paired. Scan the QR code or open the pairing link from desktop Archon.`,children:(0,X.jsx)(Q,{onClick:qn,children:`Retry`})}):e.status===`error`?(0,X.jsx)(_9,{title:`Mobile access unavailable`,description:e.message,children:(0,X.jsx)(Q,{onClick:qn,children:`Retry`})}):(0,X.jsx)(vq,{socket:c??void 0,fetchTicketRuns:Qr,fetchChatRuns:$r,fetchSpecRuns:ei,children:(0,X.jsxs)(`main`,{className:Z(`bg-background text-foreground`,Kn?`flex h-[100dvh] flex-col overflow-hidden`:`min-h-screen`),children:[(0,X.jsx)(Sve,{open:f,projects:e.projects,selectedProjectId:e.selectedProjectId,error:e.projectError,onOpenChange:m,onSelectProject:cr,onRetry:er}),(0,X.jsx)(Cve,{open:bt,project:cn,targetOptions:gt,error:Et??vt,isLoading:St,isSubmitting:wt,onOpenChange:xt,onRetry:nr,onSelectBundle:e=>{lr(e)},onSelectRepoRoot:(e,t)=>{ur(e,t)}}),(0,X.jsx)(_ve,{activeTool:i,agents:o,selectedProject:cn,targetLabel:xn,isTargetLoading:Sn,isTargetDisabled:!nn,connectionState:n,onOpenProjects:Yn,onOpenTargetSelector:Xn,onToolChange:e=>{Zt(e)}}),Kn?(0,X.jsxs)(`div`,{className:`mx-auto flex min-h-0 w-full max-w-6xl flex-1 flex-col overflow-hidden px-3 py-3 sm:px-4`,children:[u===`tickets`?(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:_&&e.selectedTicketId?(0,X.jsx)(q9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:ft,error:e.ticketDetailError,actionState:G,actionError:Ve,followUpPrompt:Ue,followUpSelectedModel:We,followUpSelectedVariant:q,followUpSelectedSkills:J,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSendingFollowUp:Ze,liveResponseTiming:dn?.agent_status===`running`&&et?.parentId===dn.id?et:null,followUpError:Qe,onBack:vr,onRetry:or,onAction:Wr,onFollowUpPromptChange:K,onFollowUpModelChange:Kr,onFollowUpVariantChange:Je,onFollowUpSkillsChange:Xe,onFollowUpKeyDown:qr,onFollowUpSubmit:Jr,onResolveQuestionSet:Yr,isLargeScreen:!1}):(0,X.jsx)(U9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:ut,mobileDetailView:mt,error:e.bundleDetailError,actionState:Ie,actionError:Re,followUpPrompt:nt,isSendingFollowUp:it,followUpError:ot,availableModels:In,onBack:yr,onRetry:sr,onAction:Gr,onDetailViewChange:ht,onSelectTicket:hr,onFollowUpPromptChange:rt,onFollowUpKeyDown:Xr,onFollowUpSubmit:Zr,isLargeScreen:!1})}):null,u===`chats`?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(W9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:ct,error:e.chatSessionDetailError,isStopping:re===e.selectedChatSessionId,isResuming:ae===e.selectedChatSessionId,isResumeDisabled:ae!==null||te||U||mn,composerMode:e.chatSessionDetail?.mode??D,composerTool:wn,prompt:T,selectedModel:k,selectedVariant:j,selectedSkills:N,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSending:te,liveResponseTiming:ln?.agent_status===`running`&&ce?.parentId===ln.id?ce:null,isUpdatingMode:U,showStartBuilding:Wn,composerDisabledReason:Un,onBack:gr,onRetry:ir,onStop:Dr,onResume:Or,onModeChange:_r,onStartBuilding:Tr,onPromptChange:E,onModelChange:br,onVariantChange:M,onSkillsChange:P,onPromptKeyDown:xr,onSubmit:wr,onResolveQuestionSet:Er,isLargeScreen:!1}),W?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:W}):null]}):null,u===`spec`?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(K9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:Pe,error:e.specSessionDetailError,isStopping:Ee===e.selectedSpecSessionId,isResuming:Oe===e.selectedSpecSessionId,isResumeDisabled:Oe!==null||Se||we||!!(hn||vn||bn),composerMode:e.specSessionDetail?.mode??me,composerTool:Tn,prompt:fe,selectedModel:ge,selectedVariant:ve,selectedSkills:be,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSending:Se,liveResponseTiming:fn?.agent_status===`running`&&Me?.parentId===fn.id?Me:null,isUpdatingMode:we,composerDisabledReason:Gn,targetWarning:hn??vn??bn,targetActionLabel:_n?J9(`specDetail.retryTarget`):yn&&fn?jb.t(`common:mobileApp.specDetail.switchBack`,{target:o5(fn)}):null,targetActionError:Et,isRestoringTarget:wt,onBack:Nr,onRetry:Ar,onStop:Hr,onResume:Ur,onModeChange:Pr,onPromptChange:pe,onModelChange:Fr,onVariantChange:ye,onSkillsChange:xe,onPromptKeyDown:Ir,onSubmit:Rr,onSubmitAnswer:zr,onResolveQuestionSet:Br,onRestoreTarget:dr,isLargeScreen:!1}),Ae?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:Ae}):null]}):null]}):(0,X.jsx)(`div`,{className:`mx-auto w-full max-w-6xl px-3 py-3 pb-[calc(env(safe-area-inset-bottom)+5rem)] sm:px-4 lg:flex lg:min-h-[calc(100dvh-4.5rem)] lg:flex-col lg:overflow-hidden lg:pb-4`,children:(0,X.jsxs)(`div`,{className:`space-y-3 lg:flex lg:min-h-0 lg:flex-1 lg:flex-col`,children:[(0,X.jsx)(gve,{status:n,onRetry:qn}),u===`overview`?(0,X.jsx)(`div`,{className:`space-y-3 lg:flex lg:min-h-0 lg:flex-1 lg:flex-col`,children:e.projectError?(0,X.jsx)(v9,{title:`Projects unavailable`,description:e.projectError,action:(0,X.jsx)(Q,{variant:`warning`,onClick:er,children:`Retry projects`})}):e.selectedProjectId&&!e.projectSummary&&!e.projectSummaryError?(0,X.jsx)(Pve,{}):(0,X.jsxs)(X.Fragment,{children:[e.selectedProjectId&&(0,X.jsx)(jve,{projectId:e.selectedProjectId,csrfToken:e.csrfToken,socket:c,initialRequests:e.projectSummary?.pending_approval_requests??Gve,onRequestError:Bt},e.selectedProjectId),(0,X.jsx)(Rve,{selectedProjectId:e.selectedProjectId,summary:e.projectSummary,tickets:e.tickets,error:e.projectSummaryError,chatSessions:e.chatSessions,chatSessionDetail:e.chatSessionDetail,onRetry:tr,onOpenTickets:()=>Jn(`tickets`),onOpenChats:()=>Jn(`chats`),onOpenSpec:()=>Jn(`spec`)}),(0,X.jsx)(Fve,{isLoggingOut:x,onLogout:Zn})]})}):null,u===`tickets`?Cn?(0,X.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,X.jsx)(`div`,{className:`min-h-0`,children:(0,X.jsx)(D9,{selectedProjectId:e.selectedProjectId,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:ar,onSelectBundle:mr,onSelectTicket:hr})}),(0,X.jsx)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:_&&e.selectedTicketId?(0,X.jsx)(q9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:ft,error:e.ticketDetailError,actionState:G,actionError:Ve,followUpPrompt:Ue,followUpSelectedModel:We,followUpSelectedVariant:q,followUpSelectedSkills:J,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSendingFollowUp:Ze,liveResponseTiming:dn?.agent_status===`running`&&et?.parentId===dn.id?et:null,followUpError:Qe,onBack:vr,onRetry:or,onAction:Wr,onFollowUpPromptChange:K,onFollowUpModelChange:Kr,onFollowUpVariantChange:Je,onFollowUpSkillsChange:Xe,onFollowUpKeyDown:qr,onFollowUpSubmit:Jr,onResolveQuestionSet:Yr,isLargeScreen:!0}):(0,X.jsx)(U9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:ut,mobileDetailView:mt,error:e.bundleDetailError,actionState:Ie,actionError:Re,followUpPrompt:nt,isSendingFollowUp:it,followUpError:ot,availableModels:In,onBack:yr,onRetry:sr,onAction:Gr,onDetailViewChange:ht,onSelectTicket:hr,onFollowUpPromptChange:rt,onFollowUpKeyDown:Xr,onFollowUpSubmit:Zr,isLargeScreen:!0})})]}):(0,X.jsx)(D9,{selectedProjectId:e.selectedProjectId,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:ar,onSelectBundle:mr,onSelectTicket:hr}):null,u===`chats`?Cn?(0,X.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,X.jsx)(`div`,{className:`min-h-0`,children:(0,X.jsx)(A9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:rr,onOpenNewChat:pr,onSelectChat:fr})}),(0,X.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,X.jsx)(W9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:ct,error:e.chatSessionDetailError,isStopping:re===e.selectedChatSessionId,isResuming:ae===e.selectedChatSessionId,isResumeDisabled:ae!==null||te||U||mn,composerMode:e.chatSessionDetail?.mode??D,composerTool:wn,prompt:T,selectedModel:k,selectedVariant:j,selectedSkills:N,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSending:te,liveResponseTiming:ln?.agent_status===`running`&&ce?.parentId===ln.id?ce:null,isUpdatingMode:U,showStartBuilding:Wn,composerDisabledReason:Un,onBack:gr,onRetry:ir,onStop:Dr,onResume:Or,onModeChange:_r,onStartBuilding:Tr,onPromptChange:E,onModelChange:br,onVariantChange:M,onSkillsChange:P,onPromptKeyDown:xr,onSubmit:wr,onResolveQuestionSet:Er,isLargeScreen:!0}),W?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:W}):null]})]}):(0,X.jsx)(A9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:rr,onOpenNewChat:pr,onSelectChat:fr}):null,u===`spec`?Cn?(0,X.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,X.jsx)(`div`,{className:`min-h-0`,children:(0,X.jsx)(j9,{selectedProjectId:e.selectedProjectId,specSessions:e.specSessions,selectedSpecSessionId:e.selectedSpecSessionId,error:e.specSessionsError,onRetry:kr,onOpenNewSpec:Mr,onSelectSpec:jr})}),(0,X.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,X.jsx)(K9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:Pe,error:e.specSessionDetailError,isStopping:Ee===e.selectedSpecSessionId,isResuming:Oe===e.selectedSpecSessionId,isResumeDisabled:Oe!==null||Se||we||!!(hn||vn||bn),composerMode:e.specSessionDetail?.mode??me,composerTool:Tn,prompt:fe,selectedModel:ge,selectedVariant:ve,selectedSkills:be,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSending:Se,liveResponseTiming:fn?.agent_status===`running`&&Me?.parentId===fn.id?Me:null,isUpdatingMode:we,composerDisabledReason:Gn,targetWarning:hn??vn??bn,targetActionLabel:_n?J9(`specDetail.retryTarget`):yn&&fn?jb.t(`common:mobileApp.specDetail.switchBack`,{target:o5(fn)}):null,targetActionError:Et,isRestoringTarget:wt,onBack:Nr,onRetry:Ar,onStop:Hr,onResume:Ur,onModeChange:Pr,onPromptChange:pe,onModelChange:Fr,onVariantChange:ye,onSkillsChange:xe,onPromptKeyDown:Ir,onSubmit:Rr,onSubmitAnswer:zr,onResolveQuestionSet:Br,onRestoreTarget:dr,isLargeScreen:!0}),Ae?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:Ae}):null]})]}):(0,X.jsx)(j9,{selectedProjectId:e.selectedProjectId,specSessions:e.specSessions,selectedSpecSessionId:e.selectedSpecSessionId,error:e.specSessionsError,onRetry:kr,onOpenNewSpec:Mr,onSelectSpec:jr}):null]})}),Kn?null:(0,X.jsx)(vve,{activeSection:u,onChange:Jn})]})})},$ve=({socket:e=ZS,children:t})=>(0,X.jsx)(cq.Provider,{value:e,children:t}),eye=()=>typeof window<`u`&&window.location.pathname.startsWith(`/mobile`),tye=()=>{let e=eye();return mb(e?null:ZS),(0,X.jsx)(We,{i18n:jb,children:(0,X.jsx)(it,{children:(0,X.jsxs)($ve,{children:[e&&(0,X.jsx)(Qve,{}),!e&&(0,X.jsx)(vq,{children:(0,X.jsx)(Rme,{children:(0,X.jsx)(S_e,{})})})]})})})};document.documentElement.classList.add(`dark`),document.documentElement.style.colorScheme=`dark`,Q4(),(0,f.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(tye,{}));export{Z as $,Zy as A,Sv as B,VC as C,$b as D,ZS as E,zy as F,S_ as G,mv as H,$ as I,O_ as J,C_ as K,Ov as L,Ry as M,By as N,Ub as O,Vy as P,Q,Ev as R,HC as S,c as St,$S as T,z_ as U,xv as V,k_ as W,T_ as X,E_ as Y,D_ as Z,tw as _,q as _t,b4 as a,qt as at,rw as b,Y as bt,jue as c,Zt as ct,BT as d,Ut as dt,Hn as et,IT as f,Ht as ft,pw as g,Ke as gt,mw as h,rt as ht,S4 as i,Qt as it,Hy as j,jb as k,lq as l,en as lt,bw as m,Vt as mt,c8 as n,Xt as nt,x4 as o,tn as ot,MT as p,Wt as pt,w_ as q,L4 as r,Yt as rt,s4 as s,Kt as st,H5 as t,Jt as tt,BW as u,$t as ut,iw as v,Ye as vt,hC as w,BC as x,K as xt,nw as y,Ze as yt,Tv as z};
|
|
275
|
+
`);ne.current+=1,W([...ee.current,{kind:`source`,id:`${O.content.path}:${e}:${Date.now()}:${ne.current}`,target:t,filePath:O.content.path,lineNumber:e,lineContent:r[e-1]??``,sourceContext:Gpe(O.content.content,e),contentSignature:O.content.content_signature,comment:n,stale:!1}])},[W,O,t]);(0,p.useEffect)(()=>{me&&D(`source`)},[me]);let xe=(0,p.useCallback)(()=>{O.kind===`content`&&(D(`source`),j(!0))},[O.kind]),Se=(0,p.useCallback)(e=>{ge.length!==0&&F(t=>((t<0?0:Math.min(t,ge.length-1))+e+ge.length)%ge.length)},[ge.length]);return(0,p.useEffect)(()=>{A&&ie.current?.focus({preventScroll:!0})},[A]),(0,p.useEffect)(()=>{let e=e=>{if(!(!n||O.kind!==`content`||e.defaultPrevented)){if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.key.toLocaleLowerCase()===`f`){e.preventDefault(),xe(),requestAnimationFrame(()=>ie.current?.focus({preventScroll:!0}));return}A&&e.key===`Escape`&&(e.preventDefault(),se())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O.kind,n,A,xe,se]),(0,X.jsxs)(`section`,{className:`flex min-h-0 flex-1 overflow-hidden rounded-xl border border-border`,"aria-label":`Files mode`,children:[(0,X.jsxs)(`aside`,{className:`flex w-80 shrink-0 flex-col border-r border-border bg-muted/10`,"aria-label":L6(`fileBrowser`),children:[(0,X.jsxs)(`div`,{className:`space-y-3 border-b border-border p-3`,children:[(0,X.jsxs)(`label`,{className:`block text-xs text-muted-foreground`,children:[L6(`searchFiles`),(0,X.jsx)(k_,{ref:re,type:`search`,className:`mt-1 h-8`,value:_,onChange:e=>v(e.target.value),placeholder:L6(`searchPlaceholder`)})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-foreground`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked)}),L6(`changedOnly`)]}),(0,X.jsx)(lv,{content:L6(`refreshFiles`),children:(0,X.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":L6(`refreshFiles`),disabled:h,onClick:()=>{de(!0)},children:h?(0,X.jsx)(Tv,{className:`size-3.5 animate-spin`}):(0,X.jsx)(Hb,{className:`size-3.5`})})})]})]}),h&&!u&&(0,X.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:L6(`loadingManifest`)}),f&&(0,X.jsxs)(`div`,{className:`space-y-3 p-4 text-sm text-destructive`,children:[(0,X.jsx)(`p`,{children:f}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void de(),children:L6(`retry`)})]}),u&&(0,X.jsxs)(X.Fragment,{children:[u.truncated&&(0,X.jsx)(`div`,{className:`border-b border-border px-3 py-2 text-xs text-amber-300`,children:L6(`truncated`)}),(0,X.jsx)(Bpe,{entries:u.entries,search:y,changedOnly:b,expandedPaths:S,selectedPath:w,commentCounts:ye,onExpandedPathsChange:C,onSelectPath:ue})]})]}),(0,X.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,X.jsxs)(`header`,{"data-testid":`workspace-file-header`,className:`flex min-h-12 shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`truncate font-mono text-xs text-foreground`,children:w??L6(`selectFile`)}),fe&&(0,X.jsx)(`div`,{className:`mt-0.5 text-[11px] capitalize text-muted-foreground`,children:Kpe(fe)})]}),(O.kind===`content`||pe||l||w&&fe?.status&&c)&&(0,X.jsxs)(`div`,{"data-testid":`workspace-file-header-actions`,className:`flex shrink-0 flex-wrap items-center justify-end gap-2 pr-10`,children:[pe&&(0,X.jsxs)(`div`,{className:`flex items-center rounded-lg border border-border bg-muted/20 p-0.5`,role:`group`,"aria-label":L6(`viewMode.ariaLabel`),children:[(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:he===`preview`?`secondary`:`ghost`,"aria-pressed":he===`preview`,disabled:me,onClick:()=>{D(`preview`)},children:L6(`viewMode.preview`)}),(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:he===`source`?`secondary`:`ghost`,"aria-pressed":he===`source`,onClick:()=>{D(`source`)},children:L6(`viewMode.source`)})]}),me&&(0,X.jsx)(`p`,{className:`text-xs text-amber-200`,role:`status`,children:L6(`viewMode.sourceRequiredLargeFile`)}),O.kind===`content`&&!A&&(0,X.jsx)(lv,{content:L6(`source.search.open`),children:(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":L6(`source.search.open`),onClick:xe,children:(0,X.jsx)(vpe,{className:`size-4`})})}),O.kind===`content`&&A&&(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 rounded-lg border border-border bg-muted/20 p-1`,role:`search`,children:[(0,X.jsx)(k_,{ref:ie,type:`search`,className:`h-7 w-40 rounded-md px-2 text-xs sm:w-56`,"aria-label":L6(`source.search.inputLabel`),placeholder:L6(`source.search.placeholder`),value:M,onChange:e=>{N(e.target.value),F(0)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Se(e.shiftKey?-1:1))}}),(0,X.jsx)(`output`,{className:`min-w-12 whitespace-nowrap px-1 text-center text-[11px] text-muted-foreground`,"aria-live":`polite`,children:ge.length>0?L6(`source.search.matchCount`,{current:_e+1,total:ge.length}):L6(`source.search.noMatches`)}),(0,X.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":L6(`source.search.previous`),disabled:ge.length===0,onClick:()=>Se(-1),children:(0,X.jsx)(mv,{className:`size-3.5 rotate-180`})}),(0,X.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":L6(`source.search.next`),disabled:ge.length===0,onClick:()=>Se(1),children:(0,X.jsx)(mv,{className:`size-3.5`})}),(0,X.jsx)(Q,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":L6(`source.search.close`),onClick:se,children:(0,X.jsx)(Ub,{className:`size-3.5`})})]}),w&&fe?.status&&c&&(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>c(w),children:L6(`viewChanges`)}),l]})]}),O.kind===`empty`&&(0,X.jsx)(`div`,{className:`m-auto max-w-sm text-center text-sm text-muted-foreground`,children:L6(`empty`)}),O.kind===`loading`&&(0,X.jsx)(`div`,{className:`m-auto text-sm text-muted-foreground`,children:L6(`loadingFile`,{path:O.path})}),O.kind===`unsupported`&&(0,X.jsxs)(`div`,{className:`m-auto max-w-md space-y-2 text-center`,children:[(0,X.jsx)(hC,{variant:`outline`,className:`capitalize`,children:O.reason.replace(/_/g,` `)}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:O.message})]}),O.kind===`error`&&(0,X.jsxs)(`div`,{className:`m-auto max-w-md space-y-3 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm text-destructive`,children:O.message}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void le(O.path,!0),children:L6(`retry`)})]}),O.kind===`content`&&(0,X.jsx)(qpe,{file:O.content,viewMode:he,comments:ve,canComment:r,searchMatches:ge,activeSearchMatchIndex:_e,onAddComment:be})]})]})},B6=r({WorkspaceReviewModal:()=>H6}),V6=e=>jb.t(`common:workspaceReviewModal.${e}`),Ype=({activeMode:e,availableModes:t,onModeChange:n})=>(0,X.jsx)(`div`,{role:`tablist`,"aria-label":V6(`modeAriaLabel`),className:`flex items-center gap-1 rounded-lg border border-border/80 bg-muted/30 p-1`,children:t.map(t=>(0,X.jsxs)(Q,{type:`button`,role:`tab`,size:`sm`,variant:e===t?`secondary`:`ghost`,"aria-selected":e===t,"aria-controls":`workspace-review-${t}-panel`,onClick:()=>n(t),children:[t===`files`?(0,X.jsx)(Sv,{className:`h-4 w-4`}):(0,X.jsx)(Cv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:V6(t)})]},t))}),H6=({target:e,initialMode:t=`changes`,reviewMode:n,onReviewModeChange:r,enabledModes:i=[`changes`],filesView:a,fileTarget:o,bundleTargetName:s=null,onClose:c,title:l,mode:u,onModeChange:d,canToggleMode:f=!1,modeActions:m,...h})=>{let[g,_]=(0,p.useState)(t),v=n??g,y=i.includes(v)?i:[v,...i],[b]=(0,p.useState)(e),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)([]),[D,O]=(0,p.useState)([]),k=(0,p.useRef)(D),[A,j]=(0,p.useState)(null);k.current=D;let M=(0,p.useCallback)(e=>{k.current=e,O(e)},[]),N=(0,p.useCallback)(()=>{k.current=[],O([])},[]),P=y.length>1,F=P&&a===void 0,[I]=(0,p.useState)(s),[L]=(0,p.useState)(()=>o??(b.scope===`project_root`?h.targetKind===`bundle`&&h.reviewCommentsBundleId?{kind:`bundle`,bundle_id:h.reviewCommentsBundleId,ticket_id:null}:{kind:`repo_root`,bundle_id:null,ticket_id:null}:h.reviewCommentsBundleId?{kind:`bundle`,bundle_id:h.reviewCommentsBundleId,ticket_id:null}:{kind:`ticket`,bundle_id:null,ticket_id:b.ticketId})),R=L.kind===`repo_root`?jb.t(`common:workspaceFiles.repositoryRoot`):L.kind===`bundle`?jb.t(`common:workspaceFiles.bundleTarget`,{name:I||L.bundle_id}):jb.t(`common:workspaceFiles.ticketTarget`,{id:L.ticket_id}),z=L.kind===`ticket`?l:R,ee=(0,p.useCallback)(async()=>{if(!h.projectId||D.length===0)return D;let e=await I6(h.projectId,D),t=new Map(e.map(e=>[e.id,e.stale])),n=k.current.map(e=>{let n=t.get(e.id);return n===void 0?e:{...e,stale:n}});return M(n),n},[h.projectId,D,M]),B=(0,p.useCallback)(()=>{h.projectId&&localStorage.removeItem(F6(h.projectId,L)),N()},[h.projectId,N,L]),V=(0,p.useCallback)(e=>{r?.(e),n===void 0&&_(e)},[r,n]),te=(0,p.useCallback)(e=>{S(e),V(`changes`)},[V]),H=(0,p.useCallback)(e=>{w(e),V(`files`)},[V]),U=(0,p.useCallback)(e=>{S(t=>t===e?null:t)},[]),ne=(0,p.useCallback)(e=>{w(t=>t===e?null:t)},[]),re=(0,p.useCallback)(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u!==void 0&&d&&(0,X.jsx)(UY,{value:u,disabled:!f||h.isUpdatingMode,onChange:d,planInactiveTooltip:(0,X.jsx)(eX,{label:jb.t(`common:ticketChangesModal.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(eX,{label:jb.t(`common:ticketChangesModal.switchToBuild`)})}),m,(0,X.jsx)(D3,{reviewComments:T,reviewFindings:e.reviewFindings,githubComments:e.githubComments,pendingFixCount:e.pendingFixCount,canSendReview:e.canSendReview,isSubmittingReview:e.isSubmittingReview,reviewSubmitDisabledReason:e.reviewSubmitDisabledReason,onClearPendingFixes:e.onClearPendingFixes,onSubmitReview:e.onSubmitReview,onUpdateReviewComment:e.onUpdateReviewComment,onRemoveReviewComment:e.onRemoveReviewComment})]}),[f,h.isUpdatingMode,u,m,d,T]),ie=(0,p.useCallback)(()=>A?re(A):null,[re,A]);return(0,p.useEffect)(()=>{if(!d||u===void 0)return;let e=e=>{!ZY(e)||!f||(e.preventDefault(),d(XY(u)))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[f,u,d]),(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(uC,{onClose:c,overlayClassName:`z-[70] bg-black/30 p-[5vh]`,panelClassName:`flex h-[92vh] w-full max-w-none flex-col overflow-hidden rounded-2xl border border-border bg-card p-6 shadow-2xl`,closeButtonLabel:V6(`closeAriaLabel`),renderContent:({closeButton:e})=>{let t=P?(0,X.jsx)(Ype,{activeMode:v,availableModes:y,onModeChange:V}):null,n=P?(0,X.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:t}):null,r=b.scope===`ticket`?(0,X.jsx)(S6,{...h,...b,projectId:h.projectId,title:l,onClose:c,mode:u,onModeChange:d,canToggleMode:f,headerControls:n,isActive:v===`changes`,onPendingReviewCommentsChange:E,onReviewControlsStateChange:j,renderReviewControls:re,showReviewControls:!P||v===`changes`,sourceReviewComments:D,onSourceReviewCommentsChange:M,onClearSourceReviewComments:N,onSourceReviewCommentsSubmitted:B,onValidateSourceReviewComments:ee,requestedDiffPath:x,onRequestedDiffPathHandled:U,onViewCurrentFile:F?H:void 0}):(0,X.jsx)(S6,{...h,scope:`project_root`,projectId:h.projectId,title:l,onClose:c,mode:u,onModeChange:d,canToggleMode:f,headerControls:n,isActive:v===`changes`,onPendingReviewCommentsChange:E,onReviewControlsStateChange:j,renderReviewControls:re,showReviewControls:!P||v===`changes`,sourceReviewComments:D,onSourceReviewCommentsChange:M,onClearSourceReviewComments:N,onSourceReviewCommentsSubmitted:B,onValidateSourceReviewComments:ee,requestedDiffPath:x,onRequestedDiffPathHandled:U,onViewCurrentFile:F?H:void 0}),i=P?(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[v===`files`&&(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-4`,children:[(0,X.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-lg font-semibold text-foreground`,children:z}),(0,X.jsx)(`div`,{"data-testid":`workspace-review-files-header-actions`,className:`flex min-w-0 max-w-full items-center gap-2 pr-10`,children:(0,X.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:t})})]}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,X.jsx)(`div`,{id:`workspace-review-changes-panel`,role:`tabpanel`,hidden:v!==`changes`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":v===`changes`,children:r}),(0,X.jsx)(`div`,{id:`workspace-review-files-panel`,role:`tabpanel`,hidden:v!==`files`,className:`min-h-0 flex-1 flex-col overflow-hidden data-[active=true]:flex`,"data-active":v===`files`,children:a??(0,X.jsx)(Jpe,{projectId:h.projectId,target:L,isActive:v===`files`,canAddComments:h.canAddReviewComments??!1,comments:D,onCommentsChange:M,requestedPath:C,onRequestedPathHandled:ne,onViewChanges:te,headerControls:v===`files`&&A?ie():void 0})})]})]}):r;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`absolute right-4 top-4 z-10 mt-2`,children:e}),i]})}})})},Xpe=e=>!(e instanceof Ke)||e.status!==409||typeof e.data!=`object`||e.data===null?!1:`code`in e.data&&e.data.code===`build_open_questions_changed`,Zpe=e=>{let t=new Map((e.execution_order_ticket_ids??[]).map((e,t)=>[e,t]));return e.tickets.map(e=>({ticket:e,questions:(e.build_open_questions??[]).filter(e=>e.status===`open`).sort((e,t)=>e.created_at.localeCompare(t.created_at))})).filter(e=>e.questions.length>0).sort((e,n)=>(t.get(e.ticket.id)??e.ticket.bundle_execution_position??2**53-1)-(t.get(n.ticket.id)??n.ticket.bundle_execution_position??2**53-1))},Qpe=e=>e.flatMap(e=>e.questions.map(e=>`${e.id}:${e.updated_at}`)).join(`|`),$pe=({details:e,onClose:t,onRefresh:n,onSubmit:r})=>{let{t:i}=K(`common`),a=(0,p.useMemo)(()=>Zpe(e),[e]),o=(0,p.useMemo)(()=>a.flatMap(e=>e.questions),[a]),s=(0,p.useMemo)(()=>Qpe(a),[a]),c=(0,p.useRef)(s),[l,u]=(0,p.useState)(()=>Object.fromEntries(o.map(e=>[e.id,{mode:null,answer:``}]))),[d,f]=(0,p.useState)(!1),[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(null);(0,p.useEffect)(()=>{u(e=>Object.fromEntries(o.map(t=>[t.id,e[t.id]??{mode:null,answer:``}]))),c.current!==s&&(c.current=s,d||(h(!0),_(i(`buildOpenQuestionsDialog.refreshedError`))))},[d,o,s,i]);let v=o.length>0&&o.every(e=>{let t=l[e.id];return t?.mode===`dismiss`||t?.mode===`answer`&&t.answer.trim()!==``}),y=o.some(e=>l[e.id]?.mode===`answer`),b=o.length>0&&o.every(e=>l[e.id]?.mode===`dismiss`),x=(e,t)=>{u(n=>({...n,[e]:{...n[e]??{mode:null,answer:``},...t}})),_(null)};return(0,X.jsx)(S_,{open:!0,onOpenChange:e=>{e||t()},children:(0,X.jsx)(w_,{showCloseButton:!1,className:`flex max-h-[calc(100vh-2rem)] flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl`,children:(0,X.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),!(!v||m||d)){f(!0),_(null);try{await r({resolutions:o.map(e=>{let t=l[e.id];return t.mode===`dismiss`?{question_id:e.id,dismiss:!0}:{question_id:e.id,answer:t.answer.trim()}})})}catch(e){if(Xpe(e)){try{await n()}catch{_(i(`buildOpenQuestionsDialog.refreshFailedError`))}h(!0),_(e=>e??i(`buildOpenQuestionsDialog.conflictError`))}else _(e instanceof Ke?e.message:i(`buildOpenQuestionsDialog.submitError`))}finally{f(!1)}}},className:`flex min-h-0 flex-col`,children:[(0,X.jsxs)(T_,{className:`border-b border-border/70 px-5 py-4 sm:px-6`,children:[(0,X.jsx)(D_,{children:i(`buildOpenQuestionsDialog.title`)}),(0,X.jsx)(O_,{children:i(`buildOpenQuestionsDialog.description`)})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4 sm:px-6`,children:[a.map(e=>(0,X.jsxs)(`section`,{"aria-labelledby":`build-question-ticket-${e.ticket.id}`,children:[(0,X.jsx)(`h3`,{id:`build-question-ticket-${e.ticket.id}`,className:`text-sm font-semibold text-foreground`,children:i(`buildOpenQuestionsDialog.ticketHeading`,{title:e.ticket.title})}),(0,X.jsx)(`div`,{className:`mt-2 space-y-3`,children:e.questions.map(e=>{let t=l[e.id]??{mode:null,answer:``};return(0,X.jsxs)(`article`,{className:`min-w-0 rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-foreground`,children:e.question_text}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-2`,children:[(0,X.jsxs)(z_,{className:`flex cursor-pointer items-center gap-2 text-sm`,children:[(0,X.jsx)(`input`,{type:`radio`,name:`decision-${e.id}`,checked:t.mode===`answer`,onChange:()=>x(e.id,{mode:`answer`})}),i(`buildOpenQuestionsDialog.answerOption`)]}),(0,X.jsxs)(z_,{className:`flex cursor-pointer items-center gap-2 text-sm`,children:[(0,X.jsx)(`input`,{type:`radio`,name:`decision-${e.id}`,checked:t.mode===`dismiss`,onChange:()=>x(e.id,{mode:`dismiss`})}),i(`buildOpenQuestionsDialog.dismissOption`)]})]}),t.mode===`answer`&&(0,X.jsxs)(`div`,{className:`mt-3`,children:[(0,X.jsx)(z_,{htmlFor:`answer-${e.id}`,className:`sr-only`,children:i(`buildOpenQuestionsDialog.answerLabel`,{question:e.question_text})}),(0,X.jsx)(A_,{id:`answer-${e.id}`,value:t.answer,onChange:t=>x(e.id,{mode:`answer`,answer:t.target.value}),placeholder:i(`buildOpenQuestionsDialog.answerPlaceholder`),rows:3,className:`max-h-64 resize-y break-words`})]})]},e.id)})})]},e.ticket.id)),o.length===0&&!d&&(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`buildOpenQuestionsDialog.empty`)})]}),(0,X.jsxs)(E_,{className:`items-start border-t border-border/70 px-5 py-4 sm:items-center sm:px-6`,children:[(0,X.jsxs)(`div`,{className:`mr-auto min-w-0 text-xs leading-5 text-muted-foreground`,"aria-live":`polite`,children:[g&&(0,X.jsx)(`p`,{className:`text-destructive`,children:g}),!g&&b&&(0,X.jsx)(`p`,{children:i(`buildOpenQuestionsDialog.dismissSummary`)}),!g&&!y&&!b&&(0,X.jsx)(`p`,{children:i(`buildOpenQuestionsDialog.incompleteSummary`)})]}),m&&(0,X.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>{h(!1),_(null)},children:i(`buildOpenQuestionsDialog.reviewRefreshed`)}),(0,X.jsx)(Q,{type:`button`,variant:`ghost`,onClick:t,children:i(`buildOpenQuestionsDialog.cancel`)}),(0,X.jsx)(Q,{type:`submit`,disabled:!v||m||d,children:i(d?`buildOpenQuestionsDialog.submitting`:`buildOpenQuestionsDialog.submit`)})]})]})})})},U6={blocked:{className:`stroke-red-400/80`,markerId:`dependency-arrowhead-blocked`},ready:{className:`stroke-emerald-400/80`,markerId:`dependency-arrowhead-ready`},preview:{className:`stroke-amber-300/80`,markerId:`dependency-arrowhead-preview`}},eme=e=>Yv(e)?`ready`:`blocked`,W6=180,tme=560,G6=88,K6=12,q6=18,J6=`dependency-overlay-clip`,Y6=(e,t,n)=>Math.min(Math.max(e,t),n),nme=(e,t)=>{if(!e||e.width<=0||e.height<=0||t.length===0)return null;let n=`M 0 0 H ${e.width} V ${e.height} H 0 Z`,r=t.filter(e=>e.width>0&&e.height>0).map(e=>`M ${e.left} ${e.top} H ${e.left+e.width} V ${e.top+e.height} H ${e.left} Z`);return r.length===0?null:`${n} ${r.join(` `)}`},rme=(e,t,n)=>n&&n.width>0&&n.height>0?n:Object.values(e).reduce((e,t)=>({width:Math.max(e.width,t.left+t.width),height:Math.max(e.height,t.top+t.height)}),{width:t.x,height:t.y}),ime=(e,t)=>{let n=Y6(Math.round(e.length*7.2)+24,W6,tme),r=Math.max(W6,t-K6*2);return Math.min(n,r)},ame=(e,t,n,r,i)=>{let a=n.get(e.blockerTicketId);if(!a)return null;let o=e.hoveredTicketId&&e.hoveredTicketId!==e.blockerTicketId?r[e.hoveredTicketId]:null,s=e.hoveredTicketId&&e.hoveredTicketId!==e.blockerTicketId?n.get(e.hoveredTicketId):null,c=s?`${a.title} is blocking ${s.title}`:`${a.title} is blocking...`,{start:l,end:u}=ey(t,o??{left:e.pointer.x,top:e.pointer.y,width:0,height:0}),d=rme(r,e.pointer,i),f=o&&s?{x:l.x+(u.x-l.x)*.6,y:l.y+(u.y-l.y)*.6-28}:{x:u.x,y:u.y-28},p=ime(c,d.width);return{text:c,x:o&&s?Y6(f.x-p/2,K6,Math.max(K6,d.width-p-K6)):(()=>{let e=f.x+q6,t=f.x-q6-p;return e+p<=d.width-K6?e:t>=K6?t:Y6(e,K6,Math.max(K6,d.width-p-K6))})(),y:Y6(f.y,K6,Math.max(K6,d.height-G6-K6)),width:p}},X6=({blockerRect:e,dependentRect:t,className:n,testId:r,markerEnd:i})=>{let{start:a,end:o}=ey(e,t),{path:s}=mne(a,o);return(0,X.jsx)(`g`,{"data-testid":r,children:(0,X.jsx)(`path`,{d:s,className:n,fill:`none`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,markerEnd:i})})},ome=({preview:e,cardRects:t,ticketsById:n,overlaySize:r})=>{if(!e)return null;let i=t[e.blockerTicketId];if(!i)return null;let a=(e.hoveredTicketId&&e.hoveredTicketId!==e.blockerTicketId&&t[e.hoveredTicketId]?t[e.hoveredTicketId]:null)??{left:e.pointer.x,top:e.pointer.y,width:0,height:0},o=ame(e,i,n,t,r);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(X6,{blockerRect:i,dependentRect:a,className:U6.preview.className,testId:`dependency-preview`,markerEnd:`url(#${U6.preview.markerId})`}),(e=>o?(0,X.jsx)(`foreignObject`,{x:o.x,y:o.y,width:o.width,height:G6,"data-testid":`dependency-preview-label`,children:e}):null)((0,X.jsx)(`div`,{className:`pointer-events-none flex h-full w-full items-start`,children:(0,X.jsx)(`div`,{className:`max-w-full rounded-md border border-amber-300/60 bg-stone-950/85 px-3 py-1.5 text-xs font-medium leading-5 text-amber-100 shadow-lg shadow-stone-950/20 whitespace-normal break-words`,children:o?.text})}))]})},sme=({dependencies:e,cardRects:t,clipRects:n=[],preview:r,ticketsById:i,overlaySize:a})=>{let o=nme(a,n);return(0,X.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 z-10 h-full w-full overflow-visible`,children:[(0,X.jsxs)(`defs`,{children:[Object.values(U6).map(e=>(0,X.jsx)(`marker`,{id:e.markerId,markerWidth:`8`,markerHeight:`8`,refX:`7`,refY:`4`,orient:`auto`,markerUnits:`userSpaceOnUse`,children:(0,X.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8`,className:e.className,fill:`none`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})},e.markerId)),o&&(0,X.jsx)(`clipPath`,{id:J6,children:(0,X.jsx)(`path`,{d:o,clipRule:`evenodd`})})]}),(0,X.jsxs)(`g`,{"data-testid":`dependency-overlay-content`,clipPath:o?`url(#${J6})`:void 0,children:[e.map(e=>{let n=i.get(e.blocker_ticket_id),r=i.get(e.dependent_ticket_id),a=t[e.blocker_ticket_id],o=t[e.dependent_ticket_id];if(n?.parked_at||r?.parked_at)return null;let s=U6[eme(n)];return!a||!o?null:(0,X.jsx)(X6,{blockerRect:a,dependentRect:o,className:s.className,testId:`dependency-edge-${e.blocker_ticket_id}-${e.dependent_ticket_id}`,markerEnd:`url(#${s.markerId})`},`${e.blocker_ticket_id}:${e.dependent_ticket_id}`)}),(0,X.jsx)(ome,{preview:r,cardRects:t,ticketsById:i,overlaySize:a})]})]})},cme=({onOpenProjectExecutionSettings:e})=>{let{t}=K(`common`);return(0,X.jsxs)(`p`,{className:`mt-2 w-full max-w-none text-xs leading-relaxed text-amber-200/90`,role:`status`,children:[t(`modelSelector.dockerSandboxNotice`),e&&(0,X.jsx)(Q,{type:`button`,variant:`link`,size:`xs`,className:`ml-1 h-auto align-baseline px-0 text-xs font-medium text-amber-100`,onClick:e,children:t(`modelSelector.openExecutionSettings`)})]})},lme=({onSubmit:e,bundles:t,projectId:n=null,projectBranchState:r=null,tool:i,showModelSelector:a=!1,showSkillsSelector:o=!1,availableModels:s=[],availableSkills:c=[],initialModel:l=``,initialVariant:u=``,initialSkills:d=[],initialWorktreeBundleId:f=null,initialImportedDraft:p=null,onCreateBundle:m,onDeleteBundle:h,onRefreshBundles:g,showDockerSandboxModelNotice:_=!1,onOpenProjectExecutionSettings:v,onClose:y})=>{let{t:b}=K(`common`),{jiraImportState:x,importFromJira:S}=Mw(n),{gitHubImportState:C,importFromGitHub:w}=ew(n),T=[{key:`jira`,label:b(`jiraImportField.label`),placeholder:b(`jiraImportField.placeholder`),state:x,onImport:S},{key:`github`,label:b(`githubImportField.label`),placeholder:b(`githubImportField.placeholder`),state:C,onImport:w}];return(0,X.jsx)(uC,{onClose:y,overlayClassName:`bg-black/70`,panelClassName:`h-[92vh] w-[96vw] max-w-6xl overflow-y-auto rounded-2xl border border-border bg-card p-4 shadow-2xl sm:p-5 lg:p-6`,renderContent:({closeButton:x})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`absolute right-4 top-4 z-10 sm:right-5 sm:top-5 lg:right-6 lg:top-6`,children:x}),(0,X.jsx)(IY,{heading:b(`newTicketModal.heading`),bundles:t,agentSettingsScope:i,showModelSelector:a,showSkillsSelector:o,availableModels:s,availableSkills:c,projectId:n,initialModel:l,initialVariant:u,initialSkills:d,initialWorktreeBundleId:f,initialImportedDraft:p,projectBranchState:r,externalImportProviders:T,onCancel:y,onCreateBundle:m,onDeleteBundle:h,onRefreshBundles:g,modelSelectorNotice:_?(0,X.jsx)(cme,{onOpenProjectExecutionSettings:v}):void 0,titleInputId:`title`,descriptionInputId:`description`,bundleSelectId:`new-ticket-bundle`,modelSelectId:`new-model`,variantSelectId:`new-variant`,skillsSelectId:`new-skills`,showEmptyBundleOption:!0,planAction:i?{label:b(`newTicketModal.actions.plan`),onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`plan`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}}:void 0,primaryAction:{label:b(`newTicketModal.actions.createTicket`),variant:`subtle`,onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`create`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}},secondaryAction:{label:b(`newTicketModal.actions.createAndBuild`),variant:`brand`,showAdvanceIcon:!0,onClick:async({title:t,description:n,model:r,variant:i,skills:a,worktree_bundle_id:o,external_source:s})=>{await e(t,n,`build`,r,i,a,{worktree_bundle_id:o??void 0,...s?{external_source:s}:{}}),y()}}})]})})},ume=({className:e=``})=>{let{setNodeRef:t,isOver:n}=GP({id:`trash`});return(0,X.jsxs)(`div`,{ref:t,"data-testid":`delete-drop-zone`,className:`${e} flex min-w-[13rem] select-none items-center justify-between gap-4 rounded-2xl border px-4 py-3 backdrop-blur-sm transition-all duration-150 ${n?`scale-[1.02] border-red-400/70 bg-destructive/35 text-red-100 shadow-lg shadow-red-950/30`:`border-red-500/30 bg-background/82 text-red-200/85`}`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(hC,{variant:`destructive`,className:`text-[11px] uppercase tracking-[0.28em]`,children:`Delete`}),(0,X.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:n?`Release to delete`:`Drop here to delete`})]}),(0,X.jsx)(`div`,{className:`rounded-xl border p-2 transition-colors ${n?`border-red-400/60 bg-red-500/20`:`border-red-500/20 bg-background/60`}`,children:(0,X.jsx)(wC,{className:`h-5 w-5 transition-colors ${n?`text-red-100`:`text-red-300/70`}`})})]})},dme=(e,t)=>Y(J(`/ticket-dependencies`,e),{signal:t}),fme=(e,t)=>Y(J(`/ticket-dependencies`,e),{method:`POST`,body:t,fallbackErrorMessage:`Unable to create the dependency right now.`}),pme=(e,t,n)=>Ze(J(`/ticket-dependencies/${t}/${n}`,e),{method:`DELETE`,fallbackErrorMessage:`Unable to remove the dependency right now.`}),mme=(e,t)=>{let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.left!==i.left||n.top!==i.top||n.width!==i.width||n.height!==i.height)return!1}return!0},hme=(e,t)=>e.length===t.length?e.every((e,n)=>{let r=t[n];return r!==void 0&&e.left===r.left&&e.top===r.top&&e.width===r.width&&e.height===r.height}):!1,gme=(e,t)=>e===t?!0:!e||!t?!1:e.projectId===t.projectId&&e.blockerTicketId===t.blockerTicketId&&e.hoveredTicketId===t.hoveredTicketId&&e.pointer.x===t.pointer.x&&e.pointer.y===t.pointer.y,_me=({activeProjectId:e,tickets:t,dependencies:n,setDependencies:r,activeTicket:i,activeOverlayNode:a,dragOffset:o})=>{let[s,c]=(0,p.useState)({}),[l,u]=(0,p.useState)([]),[d,f]=(0,p.useState)({width:0,height:0}),[m,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(new Map),S=(0,p.useRef)(new Map),C=(0,p.useRef)({}),w=(0,p.useRef)(null),T=(0,p.useRef)(null),E=(0,p.useRef)(null),D=(0,p.useRef)(null),O=(0,p.useRef)(null),k=(0,p.useRef)(null),A=(0,p.useRef)(null),j=(0,p.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]);(0,p.useEffect)(()=>{O.current=g},[g]),(0,p.useLayoutEffect)(()=>{if(!i||!a||!y.current)return;let e=window.requestAnimationFrame(()=>{let e=y.current?.getBoundingClientRect(),t=a.getBoundingClientRect();e&&h({ticketId:i.id,rect:{left:t.left-e.left,top:t.top-e.top,width:t.width,height:t.height}})});return()=>{window.cancelAnimationFrame(e)}},[a,i,o.x,o.y]);let M=(0,p.useCallback)(()=>{w.current===null&&(w.current=window.requestAnimationFrame(()=>{w.current=null;let e=y.current;if(!e){b.current=null,C.current={},c({}),u([]),f({width:0,height:0});return}let t=e.getBoundingClientRect(),n={};b.current={left:t.left,top:t.top},f(e=>e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height});for(let[e,r]of x.current){let i=r.getBoundingClientRect();n[e]={left:i.left-t.left,top:i.top-t.top,width:i.width,height:i.height}}let r=Array.from(S.current.values()).flatMap(({columnNode:e,listNode:n})=>{let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),a=Math.max(0,i.top-r.top);return r.width<=0||a<=0?[]:[{left:r.left-t.left,top:r.top-t.top,width:r.width,height:a}]});u(e=>hme(e,r)?e:r),C.current=n,c(e=>mme(e,n)?e:n)}))},[]);(0,p.useEffect)(()=>{let e=v.current;if(!e)return;let t=()=>{M()};return e.addEventListener(`scroll`,t,!0),window.addEventListener(`resize`,t),()=>{e.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,t)}},[M]),(0,p.useEffect)(()=>{if(typeof ResizeObserver!=`function`)return;let e=new ResizeObserver(()=>{M()});T.current=e;for(let t of x.current.values())e.observe(t);return()=>{e.disconnect(),T.current===e&&(T.current=null)}},[M]),(0,p.useEffect)(()=>{if(typeof ResizeObserver!=`function`)return;let e=new ResizeObserver(()=>{M()});E.current=e;for(let t of S.current.values())e.observe(t.columnNode),e.observe(t.listNode);return()=>{e.disconnect(),E.current===e&&(E.current=null)}},[M]),(0,p.useEffect)(()=>{let e=v.current,t=y.current;if(!e&&!t)return;let n=new ResizeObserver(()=>{M()});return e&&n.observe(e),t&&t!==e&&n.observe(t),()=>{n.disconnect()}},[M]),(0,p.useEffect)(()=>(M(),()=>{w.current!==null&&(window.cancelAnimationFrame(w.current),w.current=null)}),[n,M,t]);let N=(0,p.useCallback)((e,t)=>{let n=x.current.get(e);if(t){if(n===t)return;x.current.set(e,t),T.current?.observe(t)}else{if(!n)return;x.current.delete(e),T.current?.unobserve(n)}M()},[M]),P=(0,p.useCallback)((e,t)=>{let n=S.current.get(e);if(t){if(n?.columnNode===t.columnNode&&n.listNode===t.listNode)return;n&&(E.current?.unobserve(n.columnNode),E.current?.unobserve(n.listNode)),S.current.set(e,t),E.current?.observe(t.columnNode),E.current?.observe(t.listNode)}else{if(!n)return;S.current.delete(e),E.current?.unobserve(n.columnNode),E.current?.unobserve(n.listNode)}M()},[M]),F=(0,p.useCallback)(e=>{gme(O.current,e)||(O.current=e,_(e))},[]),I=(0,p.useCallback)(()=>{k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),A.current=null},[]),L=(0,p.useCallback)(e=>{A.current=e,k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null;let e=A.current;A.current=null,F(e)}))},[F]),R=(0,p.useCallback)((e,t)=>{let n=b.current;if(!n&&y.current){let e=y.current.getBoundingClientRect();n={left:e.left,top:e.top},b.current=n}return n?{x:e-n.left,y:t-n.top}:{x:e,y:t}},[]),z=(0,p.useCallback)((e,t,n)=>{for(let[r,i]of Object.entries(C.current))if(r!==n&&e>=i.left&&e<=i.left+i.width&&t>=i.top&&t<=i.top+i.height)return r;return null},[]),ee=(0,p.useCallback)(async t=>{if(e)try{await pme(e,t.blocker_ticket_id,t.dependent_ticket_id),r(e=>qv(e,t.blocker_ticket_id,t.dependent_ticket_id))}catch(e){$.error(e instanceof Ke?e.message:`Unable to remove the dependency right now.`,{id:`board-dependency-error`})}},[e,r]),B=(0,p.useCallback)((t,i)=>{if(!e)return;i.preventDefault(),D.current?.();let a=(n,r,i=!1)=>{let a=R(n,r),o={projectId:e,blockerTicketId:t,hoveredTicketId:z(a.x,a.y,t),pointer:a};if(i){I(),F(o);return}L(o)};a(i.clientX,i.clientY,!0);let o=e=>{a(e.clientX,e.clientY)},s=async i=>{let a=R(i.clientX,i.clientY),o=z(a.x,a.y,t),s=o?Jv(n,t,o):null;if(D.current?.(),D.current=null,F(null),!(!o||!s)){if(!s.valid){$.error(une(s.reason),{id:`board-dependency-error`});return}try{let n=await fme(e,{blocker_ticket_id:t,dependent_ticket_id:o});r(e=>Kv(e,n))}catch(e){$.error(e instanceof Ke?e.message:`Unable to create the dependency right now.`,{id:`board-dependency-error`})}}};D.current=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),I()},window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s,{once:!0})},[e,I,n,z,R,L,r,F]);(0,p.useEffect)(()=>{D.current?.(),D.current=null,I(),O.current=null},[e,I]),(0,p.useEffect)(()=>()=>{D.current?.(),k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null)},[]);let V=(0,p.useMemo)(()=>{let r=g?.blockerTicketId;if(!r||g.projectId!==e||!j.has(r))return null;let i=new Map;for(let e of t){if(e.id===r){i.set(e.id,`source`);continue}let t=Jv(n,r,e.id);i.set(e.id,t.valid?`valid`:`idle`)}return i},[e,n,g,j,t]),te=(0,p.useCallback)(e=>{if(!V||!g)return`idle`;let t=V.get(e)??`idle`;return e===g.hoveredTicketId&&t===`idle`?`invalid`:t},[V,g]),H=(0,p.useMemo)(()=>!g||g.projectId!==e||!j.has(g.blockerTicketId)?null:{blockerTicketId:g.blockerTicketId,hoveredTicketId:g.hoveredTicketId,pointer:g.pointer},[e,g,j]);return{boardViewportRef:v,boardContentRef:y,registerTicketNode:N,registerDependencyClipNodes:P,measuredCardRects:(0,p.useMemo)(()=>{if(!i)return s;let e=s[i.id];return e?m?.ticketId===i.id?{...s,[i.id]:m.rect}:{...s,[i.id]:{...e,left:e.left+o.x,top:e.top+o.y}}:s},[m,i,s,o.x,o.y]),dependencyClipRects:l,overlayPreview:H,overlaySize:d,getDependencyTargetState:te,handleDependencyStart:B,handleDeleteDependency:ee}},vme=`[data-terminal-pane="true"]`,yme=e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable},bme=e=>e instanceof HTMLElement?e.closest(vme)!==null:!1,xme=e=>yme(e)||bme(e),Sme=(e,t={})=>{let{isBlocked:n}=t;(0,p.useEffect)(()=>{let t=t=>{if(t.defaultPrevented||t.repeat)return;let r=e.find(e=>!e.disabled&&e.key.toLowerCase()===t.key.toLowerCase()&&(e.ctrlKey??!1)===t.ctrlKey&&(e.altKey??!1)===t.altKey&&(e.metaKey??!1)===t.metaKey&&(e.shiftKey===void 0||e.shiftKey===t.shiftKey));r&&(n?.(document.activeElement)||(t.preventDefault(),r.onKeyDown()))};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,n])},Z6=new Set([`queued`,`running`]),Cme={check_batch:`checks`,check_repair:`auto_fix`,automation_review_fix:`auto_fix`,automation_commit:`commit`,automation_push:`push`,automation_pull_request:`pr`},Q6=e=>{if(!e.id)return null;let t=Date.parse(e.updated_at);return Number.isFinite(t)?t:null},wme=e=>{let t=e.source_reference;if(e.kind!==`automation_progression`||e.status!==`waiting`&&!Z6.has(e.status)||e.initiated_by!==`automation`&&e.initiated_by!==`recovery`||!t||typeof t!=`object`||t.kind!==`bundle`||typeof t.id!=`string`)return null;let n=t.id.trim(),r=Q6(e);return!n||r===null?null:{bundleId:n,id:e.id,isActive:Z6.has(e.status),updatedAt:r}},Tme=e=>{let t=Cme[e.kind],n=Q6(e);return!t||!Z6.has(e.status)||e.initiated_by!==`automation`||!e.parent_run_id||n===null?null:{id:e.id,parentRunId:e.parent_run_id,status:t,updatedAt:n}},$6=(e,t)=>e.updatedAt===t.updatedAt?e.id.localeCompare(t.id)>0:e.updatedAt>t.updatedAt,Eme=e=>{let t=new Map,n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=wme(r);if(e){let n=t.get(e.bundleId);(!n||$6(e,n))&&t.set(e.bundleId,e);continue}let i=Tme(r);i&&n.push(i)}let r=new Map,i=new Map;for(let e of t.values())e.isActive&&(r.set(e.id,e.bundleId),i.set(e.bundleId,`automation`));let a=new Map;for(let e of n){let t=r.get(e.parentRunId);if(!t)continue;let n=a.get(t);(!n||$6(e,n))&&a.set(t,e)}for(let[e,t]of a)i.set(e,t.status);return i},Dme=`archon.last-model-selection`,Ome=`archon.last-variant-selection`,e8=`archon.last-skills-selection`,t8=(e,t)=>`${e}.${t}`,kme=e=>{try{let t=window.localStorage.getItem(t8(e8,e)),n=t?JSON.parse(t):[];return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}catch{return[]}},n8=()=>({build:!1,stopBuild:!1,resumeBuild:!1,review:!1,undoReview:!1,run:!1,stop:!1,followUp:!1,bundleRefresh:!1}),Ame=(e,t,n,r)=>{let i=t8(Dme,e),a=t8(Ome,e),o=t8(e8,e);t?window.localStorage.setItem(i,t):window.localStorage.removeItem(i),n?window.localStorage.setItem(a,n):window.localStorage.removeItem(a),r.length>0?window.localStorage.setItem(o,JSON.stringify(r)):window.localStorage.removeItem(o)},r8=(e,t={})=>Ty(e,t),jme=e=>({model:window.localStorage.getItem(t8(`archon.last-model-selection`,e))??``,variant:window.localStorage.getItem(t8(`archon.last-variant-selection`,e))??``,skills:kme(e)}),i8={runs:[],events:[],isLoading:!1,isLoadingMore:!1,hasMoreRuns:!1,hasMoreEvents:!1,error:null},a8=(0,p.createContext)({state:new Map,loadMoreProject:()=>void 0,refreshProject:()=>void 0,subscribeProject:()=>()=>void 0}),Mme=[`queued`,`waiting`,`running`],Nme=(e,t,n,r)=>Oue(e,{cursor:t,limit:200,signal:n,statuses:r}),Pme=(e,t,n)=>kue(e,{cursor:t,limit:200,signal:n}),Fme=(e,t)=>{let n=t.created_at.localeCompare(e.created_at);return n===0?t.id.localeCompare(e.id):n},Ime=(e,t)=>{let n=t.created_at.localeCompare(e.created_at);if(n!==0)return n;let r=t.execution_run_id.localeCompare(e.execution_run_id);if(r!==0)return r;let i=t.sequence-e.sequence;return i===0?t.id.localeCompare(e.id):i},o8=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);(!t||e.updated_at>=t.updated_at)&&n.set(e.id,e)}return[...n.values()].sort(Fme)},s8=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));for(let e of t)n.set(e.id,e);return[...n.values()].sort(Ime)},Lme=async(e,t,n)=>{let r=null,i=[];do{let a=await e(t,r,n,Mme);i=o8(i,a.runs),r=a.next_cursor}while(r);return i},Rme=({socket:e,fetchRunsPage:t,fetchEventsPage:n,children:r})=>{let i=lq(),a=e??i,o=t??Nme,s=n??Pme,[c,l]=(0,p.useState)(()=>new Map),u=(0,p.useRef)(new Map),d=(0,p.useRef)(new Map),f=(0,p.useRef)(new Map),m=(0,p.useRef)(new Map),h=(0,p.useCallback)(e=>{d.current.get(e)?.abort();let t=new AbortController;d.current.set(e,t),m.current.set(e,{runs:[],events:[]}),l(t=>{let n=new Map(t),r=n.get(e)??i8;return n.set(e,{...r,isLoading:!0,isLoadingMore:!1,error:null}),n}),Promise.all([o(e,null,t.signal),Lme(o,e,t.signal),s(e,null,t.signal)]).then(([n,r,i])=>{if(t.signal.aborted||d.current.get(e)!==t)return;f.current.set(e,{runs:n.next_cursor,events:i.next_cursor});let a=m.current.get(e)??{runs:[],events:[]};l(t=>{let o=new Map(t);return o.set(e,{runs:o8(o8(n.runs,r),a.runs),events:s8(i.events,a.events),isLoading:!1,isLoadingMore:!1,hasMoreRuns:!!n.next_cursor,hasMoreEvents:!!i.next_cursor,error:null}),o})}).catch(t=>{Ye(t)||l(n=>{let r=new Map(n),i=r.get(e)??i8;return r.set(e,{...i,isLoading:!1,isLoadingMore:!1,error:t instanceof Error?t.message:`Unable to load activity right now.`}),r})}).finally(()=>{d.current.get(e)===t&&(d.current.delete(e),m.current.delete(e))})},[s,o]),g=(0,p.useCallback)(e=>{if(d.current.has(e))return;let t=f.current.get(e);if(!t||!t.runs&&!t.events)return;let n=new AbortController;d.current.set(e,n),l(t=>{let n=new Map(t),r=n.get(e)??i8;return n.set(e,{...r,isLoadingMore:!0,error:null}),n}),Promise.all([t.runs?o(e,t.runs,n.signal):Promise.resolve({runs:[],next_cursor:null}),t.events?s(e,t.events,n.signal):Promise.resolve({events:[],next_cursor:null})]).then(([t,r])=>{n.signal.aborted||d.current.get(e)!==n||(f.current.set(e,{runs:t.next_cursor,events:r.next_cursor}),l(n=>{let i=new Map(n),a=i.get(e)??i8;return i.set(e,{...a,runs:o8(a.runs,t.runs),events:s8(a.events,r.events),isLoadingMore:!1,hasMoreRuns:!!t.next_cursor,hasMoreEvents:!!r.next_cursor,error:null}),i}))}).catch(t=>{Ye(t)||l(n=>{let r=new Map(n),i=r.get(e)??i8;return r.set(e,{...i,isLoadingMore:!1,error:t instanceof Error?t.message:`Unable to load more activity right now.`}),r})}).finally(()=>{d.current.get(e)===n&&d.current.delete(e)})},[s,o]),_=(0,p.useCallback)(e=>{let t=u.current.get(e)??0;return u.current.set(e,t+1),t===0&&h(e),()=>{let t=(u.current.get(e)??1)-1;if(t>0){u.current.set(e,t);return}u.current.delete(e),d.current.get(e)?.abort(),d.current.delete(e),f.current.delete(e),m.current.delete(e),l(t=>{let n=new Map(t);return n.delete(e),n})}},[h]),v=(0,p.useCallback)(e=>{if(!e||!u.current.has(e.project_id))return;let t=m.current.get(e.project_id);t&&(t.runs=o8(t.runs,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??i8;return n.set(e.project_id,{...r,runs:o8(r.runs,[e]),isLoading:!1}),n})},[]),y=(0,p.useCallback)(e=>{if(!e||!u.current.has(e.project_id))return;let t=m.current.get(e.project_id);t&&(t.events=s8(t.events,[e])),l(t=>{let n=new Map(t),r=n.get(e.project_id)??i8;return n.set(e.project_id,{...r,events:s8(r.events,[e]),isLoading:!1}),n})},[]),b=(0,p.useCallback)(()=>{for(let e of u.current.keys())h(e)},[h]);(0,p.useEffect)(()=>(a.on(`execution-run:updated`,v),a.on(`lifecycle-event:created`,y),a.on(`connect`,b),()=>{a.off(`execution-run:updated`,v),a.off(`lifecycle-event:created`,y),a.off(`connect`,b)}),[b,y,v,a]),(0,p.useEffect)(()=>()=>{for(let e of d.current.values())e.abort()},[]);let x=(0,p.useMemo)(()=>({state:c,loadMoreProject:g,refreshProject:h,subscribeProject:_}),[g,h,c,_]);return(0,X.jsx)(a8.Provider,{value:x,children:r})},c8=e=>{let{loadMoreProject:t,refreshProject:n,state:r,subscribeProject:i}=(0,p.useContext)(a8);(0,p.useEffect)(()=>{if(e)return i(e)},[e,i]);let a=(0,p.useCallback)(()=>{e&&n(e)},[e,n]),o=(0,p.useCallback)(()=>{e&&t(e)},[t,e]);return{...e?r.get(e)??i8:i8,loadMore:o,refresh:a}},l8=e=>({...e,messages:void 0,agent_log:void 0,streaming_response:void 0}),u8=(e,t)=>e?e.state!==t.state||e.parked_at!==t.parked_at||e.worktree_bundle_id!==t.worktree_bundle_id:!0,d8=(e,t)=>{if(!e)return t;let n=t.worktree_bundle_id!==null&&e.worktree_bundle_id===t.worktree_bundle_id,r=t.bundle??(n&&e.bundle?.id===t.worktree_bundle_id?e.bundle:null),i=t.bundle_execution_position??(n?e.bundle_execution_position??null:null);return{...e,...t,diff_stats:t.diff_stats===void 0?e.diff_stats:t.diff_stats,is_stale:t.is_stale===void 0?e.is_stale:t.is_stale,bundle:r,bundle_execution_position:i}},f8=(e,t)=>{let n=e=>ly(t)?ly(e):e.state===t.state&&!ly(e),r=e.findIndex(e=>n(e));if(r===-1)return[...e,t];let i=[...e];return i.splice(r,0,t),i},p8=(e,t)=>{let n=e.find(e=>e.id===t.id);return[n&&n.pull_request!==void 0&&t.pull_request===void 0?{...n,...t,pull_request:n.pull_request}:t,...e.filter(e=>e.id!==t.id)]},m8=(e,t)=>{let n=e.find(e=>e.id===t.id);if(!n)return[...e,t];let r=d8(n,t);return e.map(e=>e.id===t.id?r:e)},h8=(e,t)=>{let n=d8(e.find(e=>e.id===t.id),t);return f8(g8(e,t.id),n)},zme=(e,t)=>{if(e.length===0)return[...t];let n=[...e];for(let e of t)n=u8(n.find(t=>t.id===e.id),e)?h8(n,e):m8(n,e);let r=new Set(t.map(e=>e.id));return n.filter(e=>r.has(e.id))},g8=(e,t)=>e.filter(e=>e.id!==t),_8=(e,t,n,r={},i={})=>{let a=e.findIndex(e=>e.id===t);if(a===-1)return e;let o={...e[a],state:n,...r},s=g8(e,t);if(i.preferredIndex!==void 0){let e=Math.max(0,Math.min(i.preferredIndex,s.length));return s.splice(e,0,o),s}return f8(s,o)},v8=e=>e.state===`review`&&e.agent_status===`done`&&!!e.automation_progression_run_id,Bme=e=>v8(e)&&!e.automation_paused_at,Vme=15*1e3,Hme=1e3,Ume=async(e,t)=>{let n=Nde({projectId:t,ticketId:e.id,agentMessageId:e.agent_message_id});if(!n)return;let r=e.worktree_bundle_id!==null&&e.state!==`plan`?{kind:`bundle`,projectId:t,bundleId:e.worktree_bundle_id}:{kind:`ticket`,projectId:t,ticketId:e.id};await t3({title:`Ticket done`,body:e.title,key:n,destination:r})},y8=e=>l8(e),Wme=(e,t)=>t===`running`&&e.agent_status===`done`?`Finished ${e.state} for "${e.title}"`:t===`running`&&e.agent_status===`error`?`Failed ${e.state} for "${e.title}"`:t!==`running`&&e.agent_status===`running`?`Running ${e.state} for "${e.title}"`:null,Gme=({activeProjectId:e,refreshKey:t=0,onLoadedProjectIdChange:n,onProjectUsageChange:r,onBundlesChange:i,onBundlesLoadingChange:a,children:o})=>{let s=lq(),[c,l]=(0,p.useState)([]),[u,d]=(0,p.useState)([]),[f,m]=(0,p.useState)([]),[h,g]=(0,p.useState)([]),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(null),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)(null),k=(0,p.useRef)(0),A=(0,p.useRef)(0),j=(0,p.useRef)(new Map),M=(0,p.useRef)(new Map),N=(0,p.useRef)([]),P=(0,p.useRef)(e),F=(0,p.useRef)(new Map),I=(0,p.useRef)(new Map),L=(0,p.useRef)(new Map),R=(0,p.useCallback)((e,t)=>{let n=I.current.get(t.id);return!n||!e||t.state===n?t:e},[]),z=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(I.current);for(let r of e)n.set(r,t);I.current=n},[]),ee=(0,p.useCallback)(e=>{if(e.length===0||I.current.size===0)return;let t=new Map(I.current);for(let n of e)t.delete(n);I.current=t},[]),B=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=new Map(L.current);for(let r of e)n.set(r,t);L.current=n},[]),V=(0,p.useCallback)(e=>{if(e.length===0||L.current.size===0)return;let t=new Map(L.current);for(let n of e)t.delete(n);L.current=t},[]),te=(0,p.useCallback)((e,t)=>{if(F.current.has(t.id))return null;let n=R(e,t);return L.current.has(t.id)?{...n,parked_at:L.current.get(t.id)??null}:n},[R]),H=(0,p.useCallback)((e,t)=>{if(F.current.size===0&&I.current.size===0&&L.current.size===0)return t;let n=new Map(e.map(e=>[e.id,e]));return t.flatMap(e=>{let t=te(n.get(e.id),e);return t?[t]:[]})},[te]),U=(0,p.useCallback)(async(e,t)=>{let n=await on(e,t,{detail:`board`});return Array.isArray(n)?(!t?.aborted&&P.current===e&&l(e=>zme(e,H(e,n).map(y8))),n):null},[H]),ne=(0,p.useCallback)(async(e,t)=>{await U(e,t)},[U]),re=(0,p.useCallback)(async(e,t)=>{let n=++A.current,r=await sn(e,t);if(!Array.isArray(r)||t?.aborted||P.current!==e||A.current!==n)return;let i=new Map(r.map(e=>[e.id,e]));l(e=>e.map(e=>{let t=i.get(e.id);return t?{...e,diff_stats:t.diff_stats??null,is_stale:t.is_stale,can_re_review:t.can_re_review,re_review_eligibility_reason:t.re_review_eligibility_reason}:e}))},[]),ie=(0,p.useCallback)(e=>e.some(e=>e.is_stale===void 0),[]),ae=(0,p.useCallback)(async e=>{let t=P.current;if(!t)return null;try{let n=await cn(e,t);if(P.current!==t)return null;let r=M.current.get(n.id),i=te(r,n);if(!i)return null;let a=y8(i),o=u8(r,a);return l(e=>o?h8(e,a):m8(e,a)),n}catch{return null}},[te]),oe=(0,p.useCallback)(async t=>{if(!e){m([]);return}m(await gt(e,t))},[e]),W=(0,p.useMemo)(()=>new Map(c.map(e=>[e.id,e])),[c]),se=(0,p.useMemo)(()=>{let e=c.filter(e=>e.agent_status===`running`),t=new Set(e.map(e=>e.worktree_bundle_id).filter(e=>typeof e==`string`&&e.trim().length>0));return{total_running:e.length,running_plan_count:e.filter(e=>e.state===`plan`).length,running_build_count:e.filter(e=>e.state===`build`).length,running_review_count:e.filter(e=>e.state===`review`).length,active_bundle_count:t.size,latest_message:D}},[D,c]);(0,p.useEffect)(()=>{if(M.current=W,N.current.length===0)return;let e=[],t=[];for(let n of N.current){let r=W.get(n.blocker_ticket_id),i=W.get(n.dependent_ticket_id);r&&i&&r.project_id===P.current&&i.project_id===P.current?e.push(n):t.push(n)}N.current=t,e.length>0&&d(t=>e.reduce((e,t)=>Kv(e,t),t))},[W]),(0,p.useEffect)(()=>{P.current=e,F.current.clear(),N.current=[],I.current.clear(),L.current.clear(),O(null),v(null),j.current.clear()},[e]),(0,p.useEffect)(()=>{n?.(C?null:y)},[y,C,n]),(0,p.useEffect)(()=>{if(i){if(!e){i(null,[]);return}if(x!==e){i(e,[]);return}i(e,f)}},[e,f,x,i]),(0,p.useEffect)(()=>{if(a){if(!e){a(null,!1);return}a(e,T===e)}},[e,T,a]),(0,p.useEffect)(()=>{let t=new AbortController,n=++k.current,r=null,i=async()=>{try{if(!e){l([]),d([]),m([]),b(null),S(null),w(null);return}l([]),d([]),m([]),b(null),S(null),w(e),E(e);let i=U(e,t.signal).finally(()=>{!t.signal.aborted&&k.current===n&&(b(e),w(null))}),a=dme(e,t.signal).then(e=>(!t.signal.aborted&&k.current===n&&d(e),e)),o=gt(e,t.signal).then(e=>(!t.signal.aborted&&k.current===n&&m(e),e)).finally(()=>{!t.signal.aborted&&k.current===n&&(S(e),E(null))}),[s,c,u]=await Promise.allSettled([i,a,o]);if(t.signal.aborted)return;s.status!==`fulfilled`&&!Ye(s.reason)&&l([]),c.status===`fulfilled`?d(c.value):Ye(c.reason)||d([]),u.status===`fulfilled`?m(u.value):Ye(u.reason)||m([]),s.status===`fulfilled`&&s.value!==null&&ie(s.value)&&(r=window.setTimeout(()=>{t.signal.aborted||re(e,t.signal)},Hme))}finally{!t.signal.aborted&&k.current===n&&(w(null),E(null))}},a=t=>{t.project_id===e&&(v(t),!F.current.has(t.id)&&(t.bundle&&m(e=>p8(e,t.bundle)),l(e=>h8(e,y8(t)))))},o=t=>{if(t.project_id===e&&v(t),l(n=>{if(t.project_id!==e)return g8(n,t.id);let r=n.find(e=>e.id===t.id),i=te(r,t);if(!i)return n;let a=y8(i);return u8(r,a)?h8(n,a):m8(n,a)}),t.project_id!==e){d(e=>Gv(e,t.id));return}t.bundle&&m(e=>p8(e,t.bundle))},c=({id:e})=>{F.current.delete(e),L.current.delete(e),I.current.delete(e),l(t=>g8(t,e)),d(t=>Gv(t,e))},u=({project_id:e,bundle_id:t,pull_request:n})=>{e===P.current&&(m(e=>e.map(e=>e.id===t?{...e,pull_request:n}:e)),l(e=>e.map(e=>e.worktree_bundle_id!==t||!e.bundle?e:{...e,bundle:{...e.bundle,pull_request:n}})),v(e=>e?.worktree_bundle_id!==t||!e.bundle?e:{...e,bundle:{...e.bundle,pull_request:n}}))},f=e=>{if(!e)return;let t=M.current.get(e.blocker_ticket_id),n=M.current.get(e.dependent_ticket_id);if(!t||!n){N.current.push(e);return}t.project_id!==P.current||n.project_id!==P.current||d(t=>Kv(t,e))},p=e=>{d(t=>qv(t,e.blocker_ticket_id,e.dependent_ticket_id))};return i(),s.on(`ticket:created`,a),s.on(`ticket:updated`,o),s.on(`ticket:deleted`,c),s.on(`bundle-pull-request:updated`,u),s.on(`ticket-dependency:created`,f),s.on(`ticket-dependency:deleted`,p),()=>{t.abort(),r!==null&&window.clearTimeout(r),s.off(`ticket:created`,a),s.off(`ticket:updated`,o),s.off(`ticket:deleted`,c),s.off(`bundle-pull-request:updated`,u),s.off(`ticket-dependency:created`,f),s.off(`ticket-dependency:deleted`,p)}},[e,re,t,ie,U,te,s]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=()=>{document.visibilityState===`visible`&&Promise.allSettled([U(e,t.signal),oe(t.signal)]).then(n=>{n[0]?.status===`fulfilled`&&n[0].value!==null&&ie(n[0].value)&&re(e,t.signal)}).catch(()=>{})},r=window.setInterval(n,Vme),i=$b(n);return()=>{t.abort(),window.clearInterval(r),i()}},[e,oe,re,ie,U]),(0,p.useEffect)(()=>{if(!e||!r||y!==e)return;let t=c.filter(e=>{let t=e.bundle?.branch??e.branch;return typeof t==`string`&&t.trim()!==``}).length;r({projectId:e,ticketCount:c.length,worktreeCount:t,repoPathLocked:c.length>0||t>0||f.length>0})},[e,f.length,y,r,c]),(0,p.useEffect)(()=>{if(e)for(let t of c){let n=j.current.get(t.id),r=v8(t),i=Wme(t,n);i&&!r&&O(i),!r&&n!==void 0&&n===`running`&&t.agent_status===`done`&&(t.state===`plan`||t.state===`build`||t.state===`review`)&&Ume(t,e),r||j.current.set(t.id,t.agent_status)}},[e,c]);let ce=(0,p.useCallback)(()=>{v(null)},[]),le=(0,p.useMemo)(()=>({tickets:c,setTickets:l,dependencies:u,setDependencies:d,bundles:f,setBundles:m,pendingApprovalRequests:h,setPendingApprovalRequests:g,latestDetailedTicketUpdate:_,clearLatestDetailedTicketUpdate:ce,loadedProjectId:y,bundlesLoadedProjectId:x,loadingProjectId:C,activeProjectIdRef:P,pendingDeletedTicketsRef:F,pendingOptimisticMovesRef:I,pendingParkedTicketsRef:L,refreshTickets:ne,requestSingleTicketRefresh:ae,refreshBundles:oe,resolvePendingTicket:te,resolvePendingTickets:H,markPendingOptimisticMoves:z,clearPendingOptimisticMoves:ee,markPendingParkedTickets:B,clearPendingParkedTickets:V,liveActivity:se}),[f,x,ce,ee,V,u,se,y,_,C,z,B,h,oe,ne,ae,te,H,c]);return(0,X.jsx)(n3.Provider,{value:le,children:o})},b8=(e,t)=>{let n=g8(e,t.ticket.id),r=Math.max(0,Math.min(t.index,n.length));return n.splice(r,0,t.ticket),n},x8=e=>!!e?.preview_service_name?.trim()&&e?.preview_capability_mode!==`force_disabled`,S8=e=>e?.build_execution_provider===`docker_sandbox`&&x8(e),C8=(0,p.lazy)(()=>BW(()=>import(`./VerificationDialog-BJnOitrJ.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),w8=[`plan`,`build`,`review`],T8=`done`,Kme=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,activeRun:r,activeTool:i,onPreviewReviewCapabilityChange:a,onRunStopped:o,onRunStatusChange:s,onViewSourceSpec:c,onNavigateToLifecycleSource:l,onStartChatFromBundle:u,refreshKey:d=0,boardFilterState:f,onBoardFilterStateChange:m,initialTicketId:h=null,onInitialTicketNavigationConsumed:g,onInitialTicketNavigationUnavailable:_,routedTicketId:v,routedModalStack:y=[],onTicketOpen:b,onTicketClose:x,routedBundleId:S,routedInspection:C=null,routedInspectionReviewCapability:w,inspectionOnly:T=!1,onBundleOpen:E,onBundleClose:D,onInspectionOpen:O,onInspectionModeChange:k,onInspectionClose:A,onInspectionUnavailable:j,initialImportedDraft:M=null,onInitialImportedDraftConsumed:N,onOpenProjectExecutionSettings:P})=>{let{t:F}=K(`common`),I=WN(UN(yP,{activationConstraint:{distance:5}})),{tickets:L,setTickets:R,dependencies:z,setDependencies:ee,bundles:B,setBundles:V,latestDetailedTicketUpdate:te,clearLatestDetailedTicketUpdate:H,loadedProjectId:U,bundlesLoadedProjectId:ne,loadingProjectId:re,activeProjectIdRef:ie,pendingDeletedTicketsRef:ae,requestSingleTicketRefresh:oe,refreshBundles:W,resolvePendingTicket:se,markPendingOptimisticMoves:ce,clearPendingOptimisticMoves:le,markPendingParkedTickets:ue,clearPendingParkedTickets:de}=r3(),{runs:fe}=c8(e),pe=(0,p.useMemo)(()=>{let e=Eme(fe);for(let t of L)t.worktree_bundle_id&&t.automation_paused_reason&&e.delete(t.worktree_bundle_id);return e},[fe,L]),[me,he]=(0,p.useState)(null),[ge,_e]=(0,p.useState)(null),[ve,ye]=(0,p.useState)(null),be=(0,p.useCallback)(e=>ye(e),[]),[xe,Se]=(0,p.useState)(null),[Ce,we]=(0,p.useState)({x:0,y:0}),[Te,Ee]=(0,p.useState)(null),[De,Oe]=(0,p.useState)(null),[ke,Ae]=(0,p.useState)([]),[je,Me]=(0,p.useState)(null),Ne=ZP(`opencode`),Pe=ZP(`claude`),Fe=(0,p.useMemo)(()=>({opencode:Ne.models,claude:Pe.models}),[Ne.models,Pe.models]),Ie={opencode:Ne.isLoading,claude:Pe.isLoading},Le=(0,p.useCallback)(e=>{let n=Fe[e]??[];return t?.build_execution_provider===`docker_sandbox`?Eie(n,je?je.approved_providers?.[e]??[]:[]):n},[t?.build_execution_provider,je,Fe]),Re=(0,p.useMemo)(()=>({opencode:Le(`opencode`),claude:Le(`claude`)}),[Le]);(0,p.useEffect)(()=>{if(!e||t?.build_execution_provider!==`docker_sandbox`){Me(null);return}let n=new AbortController;return Me(null),Nb(e,n.signal).then(e=>{n.signal.aborted||Me(e)}).catch(e=>{!Ye(e)&&!n.signal.aborted&&Me(null)}),()=>n.abort()},[t?.build_execution_provider,e]);let ze=(0,p.useMemo)(()=>{if(t?.build_execution_provider!==`docker_sandbox`)return ke;let e=je?.available_skills?.opencode;if(!e)return[];let n=new Map(ke.map(e=>[e.name,e]));return e.map(e=>n.get(e)??{name:e,description:``})},[t?.build_execution_provider,ke,je?.available_skills?.opencode]),[G,Be]=(0,p.useState)(!1),[Ve,He]=(0,p.useState)(!1),[Ue,We]=(0,p.useState)(!1),[Ge,qe]=(0,p.useState)(null),[q,Je]=(0,p.useState)(null),[J,Xe]=(0,p.useState)(null),Ze=(0,p.useRef)(null),Y=v===void 0?h:v,Qe=(0,p.useRef)(null),$e=(0,p.useRef)(null),[et,tt]=(0,p.useState)(null),nt=(0,p.useRef)(null),[rt,it]=(0,p.useState)(null),[at,ot]=(0,p.useState)(null),[st,ct]=(0,p.useState)(null),[lt,ut]=(0,p.useState)(null),dt=(0,p.useRef)(0),[ft,pt]=(0,p.useState)(null),[mt,ht]=(0,p.useState)(null),[gt,vt]=(0,p.useState)(null),[yt,St]=(0,p.useState)(!1),[Ct,wt]=(0,p.useState)(n8()),[At,jt]=(0,p.useState)(0),[Mt,Bt]=(0,p.useState)(()=>({query:``,hideStaleTickets:!1,hideBundlesWithPullRequests:!1})),Vt=f??Mt,Ht=e=>{let t={...Vt,...e};if(m){m(t);return}Bt(t)},Ut=bF(i)||bF(J?.tool)||!!at?.tickets.some(e=>bF(yF(e,i))),Wt=bF(i)&&(Le(i).length>0||t?.build_execution_provider===`docker_sandbox`&&Fe[i].length>0),Gt=bF(yF(J,i))&&Le(yF(J,i)).length>0,Kt=!!at?.tickets.some(e=>bF(yF(e,i)))&&(Re.opencode.length>0||Re.claude.length>0),qt=(0,p.useRef)(null),[Jt,Yt]=(0,p.useState)(null),Xt=L.find(e=>e.is_running)??null,Zt=Xt?iy(Xt):null,Qt=r?.context_key??null,$t=r?.kind===`ticket`?gne(r,L)??Zt:Zt,en=r?.kind===`project`,tn=$t??Jt,nn=(0,p.useCallback)(e=>_ne({bundleId:e,activeRunContextKey:tn,isProjectRootRunActive:en}),[tn,en]),rn=me!==null&&gy(me,`trash`)||ge!==null&&my(ge),an=re===e,on=(0,p.useMemo)(()=>t?uw(t):[],[t]),sn=(0,p.useMemo)(()=>pw(on),[on]),cn=(0,p.useMemo)(()=>t?dw(t):[],[t]),un=(0,p.useMemo)(()=>t?fw(t):[],[t]),fn=sn.length>0,pn=(0,p.useMemo)(()=>new Map(L.map(e=>[e.id,e])),[L]);(0,p.useEffect)(()=>{Yt(null)},[e]),(0,p.useEffect)(()=>{Jt!==null&&(en||$t!==null)&&Yt(null)},[$t,en,Jt]),(0,p.useEffect)(()=>{if(!q){Xe(null);return}let e=pn.get(q)??null;e&&Xe(t=>!t||t.id!==q?e:oy(t,e))},[q,pn]),(0,p.useEffect)(()=>{te&&(Xe(e=>!e||e.id!==te.id?e:oy(e,te)),ot(e=>{if(!e)return e;let t=te.worktree_bundle_id;if(!t||e.bundle.id!==t)return e;let n=e.tickets.some(e=>e.id===te.id)?e.tickets.map(e=>e.id===te.id?oy(e,te):e):[...e.tickets,te];return{...e,tickets:n}}))},[te]),(0,p.useEffect)(()=>{te===null||q!==null||et!==null||H()},[H,te,et,q]);let mn=(0,p.useCallback)(async e=>{let t=await oe(e);if(!t)return null;let n=pn.get(e),r=n?oy(t,n):t;return Xe(t=>t&&t.id!==e||q&&q!==e?t:r),r},[oe,q,pn]),hn=(0,p.useCallback)(e=>{Xe(e),Je(e.id),mn(e.id),b?.(e.id)},[b,mn]),gn=(0,p.useCallback)(()=>{nt.current=null,tt(null),it(null),ot(null),St(!1),wt(n8())},[]),_n=(0,p.useMemo)(()=>new Map(B.map(e=>[e.id,e])),[B]),vn=(0,p.useMemo)(()=>{if(!at)return null;let e=at.bundle.id,t=te?.worktree_bundle_id===e?te:null,n=L.filter(t=>t.worktree_bundle_id===e),r=new Map(n.map(e=>[e.id,e])),i=at.tickets.filter(e=>!ae.current.has(e.id)).map(e=>t&&e.id===t.id?oy(e,t):e);t&&!i.some(e=>e.id===t.id)&&!ae.current.has(t.id)&&i.push(t);let a=i.map(e=>oy(e,r.get(e.id)));for(let e of n)a.some(t=>t.id===e.id)||a.push(e);a=b3(a);let o=at.execution_order_ticket_ids??[],s=a.map(e=>e.id),c=[...o,...s].filter((e,t,n)=>s.includes(e)&&n.indexOf(e)===t),l=n.some(e=>e.can_re_review!==void 0||e.re_review_eligibility_reason!==void 0||e.has_completed_review!==void 0||e.has_follow_up_since_last_review!==void 0),u=n.some(e=>e.agent_status===`running`),d={has_completed_review:n.some(e=>e.has_completed_review===!0),has_follow_up_since_last_review:n.some(e=>e.has_follow_up_since_last_review===!0),can_re_review:!u&&n.some(e=>e.can_re_review===!0),re_review_eligibility_reason:u?`activity_running`:n.find(e=>e.can_re_review===!0)?.re_review_eligibility_reason??n.find(e=>e.re_review_eligibility_reason!==void 0)?.re_review_eligibility_reason},f=by(a),p=a.find(e=>e.id===at.review_owner_ticket_id&&e.state===`review`)??null,m=Ty(a,{targetTicketId:at.target_ticket_id,reviewOwnerTicketId:p?.id??at.review_owner_ticket_id,latestSessionTicketId:f?.id??at.latest_session_ticket_id});return{...at,bundle:_n.get(e)??at.bundle,tickets:a,execution_order_ticket_ids:c,latest_session_ticket_id:f?.id??null,latest_session_id:f?.session_id??null,review_owner_ticket_id:p?.id??null,target_ticket_id:m?.id??null,has_completed_review:l?d.has_completed_review:at.has_completed_review,has_follow_up_since_last_review:l?d.has_follow_up_since_last_review:at.has_follow_up_since_last_review,can_re_review:l?d.can_re_review:at.can_re_review,re_review_eligibility_reason:l?d.re_review_eligibility_reason:at.re_review_eligibility_reason}},[_n,te,ae,at,L]),yn=(0,p.useMemo)(()=>L.filter(e=>{if(Vt.hideStaleTickets&&dy(e))return!1;if(Vt.hideBundlesWithPullRequests&&e.worktree_bundle_id){let t=_n.get(e.worktree_bundle_id);if(t&&t.pull_request!==void 0?t.pull_request:e.bundle?.pull_request)return!1}return yne(Vt.query,e)}),[Vt,_n,L]),bn=(0,p.useMemo)(()=>Oy(yn),[yn]),In=(0,p.useMemo)(()=>yn.filter(e=>ly(e)),[yn]),Rn=(0,p.useMemo)(()=>Ey(In,B,T8),[B,In]),{boardViewportRef:Vn,boardContentRef:Hn,registerTicketNode:Un,registerDependencyClipNodes:Wn,measuredCardRects:Gn,dependencyClipRects:Kn,overlayPreview:qn,overlaySize:Jn,getDependencyTargetState:Yn,handleDependencyStart:Xn,handleDeleteDependency:Zn}=_me({activeProjectId:e,tickets:L,dependencies:z,setDependencies:ee,activeTicket:me,activeOverlayNode:xe,dragOffset:Ce}),Qn=jme(i),$n=!!t?.run_ide?.trim(),er=(0,p.useCallback)((e,t,n=L)=>{let r=Ey(n,B,t).find(t=>t.kind===`bundle`&&t.group.bundle.id===e);return r?.kind===`bundle`?r.group:null},[B,L]),tr=(0,p.useCallback)(e=>{let n=yF(e,i);return(0,X.jsx)(f3,{ticket:e,allTickets:L,dependencies:z,bundles:B,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:e.worktree_bundle_id?pe.get(e.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:bF(n)&&Le(n).length>0,availableModels:Le(n),runDisabled:!0,hideBundleScopedControls:!0})},[t?.memory_enabled,i,pe,B,z,Le,L]),nr=(0,p.useCallback)(t=>Cy(t)?t.project_id===e?$n:!!t.has_run_ide:!1,[$n,e]),rr=(0,p.useCallback)(e=>!!e.project_id&&!!(e.bundle?.branch??e.branch)&&Cy(e),[]),ir=(0,p.useCallback)(e=>{let t=e?.tickets.find(t=>t.id===e.target_ticket_id)??e?.tickets.find(e=>e.has_worktree)??null;return t?nr(t):!1},[nr]),ar=(0,p.useCallback)(e=>{let t=b3(L.filter(t=>t.worktree_bundle_id===e));return at?.bundle.id===e?r8(b3(at.tickets.map(e=>t.find(t=>t.id===e.id)??e)),{targetTicketId:at.target_ticket_id,reviewOwnerTicketId:at.review_owner_ticket_id,latestSessionTicketId:at.latest_session_ticket_id}):r8(t)},[at,L]),or=(0,p.useCallback)(e=>{let t=ar(e),n=B.some(t=>t.id===e&&t.has_prepared_worktree===!0)||L.some(t=>t.worktree_bundle_id===e&&Cy(t))||!!(at?.bundle.id===e&&at.tickets.some(Cy));return!!(t?.project_id&&(t.bundle?.branch??t.branch)&&n)},[B,ar,at,L]),sr=(0,p.useCallback)(e=>{let t=_n.get(e),n=ar(e),r=at?.bundle.id===e?[...L,...at.tickets]:L;return!!(t&&n?.project_id&&wy(t,r))},[_n,ar,at,L]);(0,p.useEffect)(()=>{He(!1),We(!1),pt(null),vt(null)},[e,d]),(0,p.useEffect)(()=>{if(!Ut){Ae([]);return}let t=new AbortController;return(async()=>{try{Ae(await QP(`opencode`,t.signal,e))}catch(e){Ye(e)||Ae([])}})(),()=>{t.abort()}},[e,Ut]);let cr=({active:e})=>{Be(!1),Se(null),we({x:0,y:0}),ye(null);let t=ky(String(e.id));if(t){_e(er(t.bundleId,t.column)),he(null);return}_e(null),he(L.find(t=>t.id===e.id)??null)},lr=()=>{Be(!1),Se(null),we({x:0,y:0}),he(null),_e(null),ye(null)},ur=(0,p.useCallback)(e=>{R(t=>e.reduce((e,t)=>h8(e,t),t))},[R]),dr=(0,p.useCallback)((e,t)=>{if(e.length===0)return;let n=e[0]?.state;n&&R(r=>e.reduce((e,r)=>_8(e,r.id,t,Tne(r,n,t)),r))},[R]),fr=(0,p.useCallback)((e,t=L)=>!e.worktree_bundle_id||!e.project_id||e.state!==`build`?[]:b3(t.filter(t=>t.project_id===e.project_id&&t.worktree_bundle_id===e.worktree_bundle_id&&t.state===`build`&&t.parked_at===null)),[L]),pr=async({active:e,over:t})=>{let n=ky(String(e.id)),r=L.find(t=>t.id===e.id),i=n?er(n.bundleId,n.column):null,a=t?.id===`trash`&&(r!==void 0&&gy(r,`trash`)||i!==null&&my(i)),o=t?.id&&w8.includes(t.id)?t.id:null;if(Be(a),Se(null),we({x:0,y:0}),he(null),_e(null),t){if(n){if(t.id===`trash`){if(!i||!my(i))return;await Tr(i);return}if(t.id===T8){if(!i||!Sne(i))return;await Sr(i);return}if(o){if(n.column===T8){if(!i||!Cne(i))return;await Cr(i);return}await mi(n.bundleId,n.column,o)}return}if(t.id===`trash`){if(!r||!gy(r,`trash`))return;Dr(e.id);return}if(t.id===T8){if(!r||!gy(r,T8))return;await br(e.id);return}if(o){if(r&&xne(r,o)){await xr(e.id);return}if(!(!r||!gy(r,o)))try{await vr(r,o,{optimistic:!0})}catch(e){$.error(e instanceof Ke?e.message:F(`board.errors.moveTicket`),{id:`board-move-error`})}}}},mr=async(t,n,r,a,o,s,c)=>{let l=await ln({title:t,description:n,tool:i,model:a,variant:o,skills:s,project_id:e,...c});if(Ame(i,a,o,s),R(e=>h8(e,l8(l))),l.bundle&&V(e=>p8(e,l.bundle)),r===`build`)try{await vr(l,`build`)}catch(e){$.error(e instanceof Ke?e.message:F(`board.errors.moveTicket`),{id:`board-move-error`})}r===`plan`&&Bn(l.id,l.project_id)},hr=async t=>{if(!e)throw Error(F(`board.errors.createBundleWithoutProject`));let n=await _t(e,{name:t,prepare:!0});return V(e=>p8(e,n)),n},gr=(0,p.useCallback)((e,t={})=>{let n=l8(e);R(e=>t.reorderInState?h8(e,n):m8(e,n)),Xe(t=>!t||t.id!==e.id?t:oy(e,n)),e.bundle&&V(t=>p8(t,e.bundle))},[V,R]),_r=(0,p.useCallback)(e=>{V(t=>p8(t,e)),R(t=>t.map(t=>t.worktree_bundle_id===e.id?{...t,bundle:e}:t)),ot(t=>!t||t.bundle.id!==e.id?t:{...t,bundle:e,tickets:t.tickets.map(t=>t.worktree_bundle_id===e.id?{...t,bundle:e}:t)})},[V,ot,R]),vr=async(e,t,n={})=>{let r=L.findIndex(t=>t.id===e.id),i=t===`review`?fr(e):[],a=t===`review`&&i.length>1,o=n.optimistic?a?i.map(e=>e.id):[e.id]:[];n.optimistic&&(ce(o,t),a?dr(i,t):R(n=>_8(n,e.id,t,hy(e,t))));try{if(a&&e.project_id&&e.worktree_bundle_id){let t=await Et(e.project_id,e.worktree_bundle_id);qr(t);let n=t.tickets.find(t=>t.id===e.id);if(!n)throw Error(F(`board.errors.missingBundleReviewTicket`));return le(o),n}let n=await dn(e.id,e.project_id,t);return R(r=>{let i=r.find(t=>t.id===e.id);return i?.state===t&&n.state===t&&i.agent_status!==n.agent_status&&n.agent_status===e.agent_status?r:u8(i,n)?h8(r,n):m8(r,n)}),n.bundle&&V(e=>p8(e,n.bundle)),le(o),n}catch(t){throw n.optimistic&&(a?ur(i):R(t=>_8(t,e.id,e.state,{agent_status:e.agent_status,agent_log:e.agent_log,build_completed_at:e.build_completed_at},{preferredIndex:r})),le(o)),t}},yr=(e,t)=>{R(n=>n.map(n=>n.id===e?{...n,...t}:n))},br=async t=>{let n=L.find(e=>e.id===t);if(n)try{let r=new Date().toISOString();ue([t],r),yr(t,{parked_at:r}),gr(await Tn(t,n.project_id??e),{reorderInState:!0}),de([t])}catch(e){de([t]),yr(t,{parked_at:n.parked_at}),$.error(e instanceof Ke?e.message:F(`board.errors.parkTicket`),{id:`board-park-error`})}},xr=async t=>{let n=L.find(e=>e.id===t);if(n)try{ue([t],null),yr(t,{parked_at:null}),gr(await En(t,n.project_id??e),{reorderInState:!0}),de([t])}catch(e){de([t]),yr(t,{parked_at:n.parked_at}),$.error(e instanceof Ke?e.message:F(`board.errors.returnTicket`),{id:`board-unpark-error`})}},Sr=(0,p.useCallback)(async e=>{let t=new Set(e.tickets.map(e=>e.id)),n=e.tickets.map(e=>({id:e.id,parked_at:e.parked_at})),r=new Date().toISOString();ue(e.tickets.map(e=>e.id),r),R(e=>e.map(e=>t.has(e.id)?{...e,parked_at:r}:e));let i=await Promise.allSettled(e.tickets.map(e=>Tn(e.id,e.project_id??ie.current))),a=new Set;if(i.forEach((t,n)=>{if(t.status===`fulfilled`){de([t.value.id]),gr(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&a.add(r.id)}),a.size===0)return;de([...a]),R(e=>e.map(e=>{if(!a.has(e.id))return e;let t=n.find(t=>t.id===e.id);return t?{...e,parked_at:t.parked_at}:e}));let o=i.find(e=>e.status===`rejected`),s=a.size===e.tickets.length?o?.reason instanceof Ke?o.reason.message:F(`board.errors.moveBundleToDone`):F(`board.toasts.movedBundleToDonePartial`,{movedCount:e.tickets.length-a.size,totalCount:e.tickets.length});$.error(s,{id:`board-bundle-park-error`})},[ie,gr,de,ue,R,F]),Cr=(0,p.useCallback)(async e=>{let t=new Set(e.tickets.map(e=>e.id)),n=e.tickets.map(e=>({id:e.id,parked_at:e.parked_at}));ue(e.tickets.map(e=>e.id),null),R(e=>e.map(e=>t.has(e.id)?{...e,parked_at:null}:e));let r=await Promise.allSettled(e.tickets.map(e=>En(e.id,e.project_id??ie.current))),i=new Set;if(r.forEach((t,n)=>{if(t.status===`fulfilled`){de([t.value.id]),gr(t.value,{reorderInState:!0});return}let r=e.tickets[n];r&&i.add(r.id)}),i.size===0)return;de([...i]),R(e=>e.map(e=>{if(!i.has(e.id))return e;let t=n.find(t=>t.id===e.id);return t?{...e,parked_at:t.parked_at}:e}));let a=r.find(e=>e.status===`rejected`),o=i.size===e.tickets.length?a?.reason instanceof Ke?a.reason.message:F(`board.errors.restoreBundle`):F(`board.toasts.restoredBundlePartial`,{restoredCount:e.tickets.length-i.size,totalCount:e.tickets.length});$.error(o,{id:`board-bundle-unpark-error`})},[ie,gr,de,ue,R,F]),wr=async t=>{if(!e)return;let n=await Ft(e,t);n.warning&&$.warning(n.warning,{id:`board-bundle-delete-warning`}),V(e=>e.filter(e=>e.id!==t))},Tr=(0,p.useCallback)(async t=>{let n=t.tickets.map(e=>({ticket:e,index:L.findIndex(t=>t.id===e.id)})).filter(e=>e.index!==-1);if(n.length===0)return;for(let e of n)ae.current.set(e.ticket.id,e);let r=new Set(n.map(e=>e.ticket.id));R(e=>e.filter(e=>!r.has(e.id))),ee(e=>e.filter(e=>!r.has(e.blocker_ticket_id)&&!r.has(e.dependent_ticket_id)));let i=await Promise.allSettled(n.map(async t=>(await Cn(t.ticket.id,t.ticket.project_id??e),ae.current.delete(t.ticket.id),t.ticket.id)));t.tickets.some(e=>e.project_id===ie.current)&&W().catch(()=>{});let a=n.filter((e,t)=>i[t]?.status===`rejected`);if(a.length===0)return;for(let e of a)ae.current.delete(e.ticket.id);a.some(e=>e.ticket.project_id===ie.current)&&R(e=>[...a].sort((e,t)=>e.index-t.index).reduce((e,t)=>b8(e,t),e));let o=i.find(e=>e.status===`rejected`),s=a.length===n.length?o?.reason instanceof Ke?o.reason.message:F(`board.errors.deleteBundleTickets`):F(`board.toasts.deletedBundleTicketsPartial`,{deletedCount:n.length-a.length,totalCount:n.length});$.error(s,{id:`board-delete-bundle-wrapper-error`})},[e,ie,ae,W,ee,R,L,F]),Er=e=>{let t=pn.get(e.id);gr(e,{reorderInState:t?t.state!==e.state||t.parked_at!==e.parked_at||t.worktree_bundle_id!==e.worktree_bundle_id:!1}),t?.worktree_bundle_id&&t.worktree_bundle_id!==e.worktree_bundle_id&&t.bundle?.ticket_count===1&&V(e=>e.filter(e=>e.id!==t.worktree_bundle_id)),(t?.worktree_bundle_id!==e.worktree_bundle_id||t?.bundle?.ticket_count!==e.bundle?.ticket_count)&&e.project_id===ie.current&&W().catch(()=>{})},Dr=async t=>{let n=L.find(e=>e.id===t),r=L.findIndex(e=>e.id===t);if(!(!n||r===-1)){ae.current.set(t,{ticket:n,index:r}),R(e=>g8(e,t)),ee(e=>Gv(e,t));try{await Cn(t,n.project_id??e),n.project_id===ie.current&&W().catch(()=>{}),ae.current.delete(t)}catch(e){let n=ae.current.get(t);ae.current.delete(t),n&&n.ticket.project_id===ie.current&&(R(e=>b8(e,n)),$.error(e instanceof Ke?e.message:F(`board.errors.deleteTicket`),{id:`board-delete-error`}))}}},Or=async t=>{let n=L.find(e=>e.id===t);if(!n)return;let r=n.state===`review`?`review`:`build`;try{if(qe(r),n.project_id&&n.worktree_bundle_id&&n.state===`review`){qr(await Ot(n.project_id,n.worktree_bundle_id));return}gr(await wn(t,n.project_id??e),{reorderInState:!0})}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.undoTicket`),{id:`board-undo-error`}),e}finally{qe(e=>e===r?null:e)}},kr=async t=>{let n=L.find(e=>e.id===t);try{await On(t,n?.project_id??e)}catch(e){$.error(e instanceof Ke?e.message:F(`board.errors.retryTicket`),{id:`board-retry-error`})}},Ar=async t=>{let n=L.find(e=>e.id===t),r=n?iy(n):t;try{Yt(r),await kn(t,n?.project_id??e),s?.()}catch(e){Yt(e=>e===r?null:e),$.error(e instanceof Ke?e.message:F(`board.errors.startRun`),{id:`board-run-error`})}},jr=(0,p.useCallback)(async t=>{let n=L.find(e=>e.id===t);try{await An(t,n?.project_id??e)}catch(e){$.error(e instanceof Ke?e.message:F(`board.errors.openIde`),{id:`board-open-ide-error`})}},[e,F,L]),Mr=async t=>{let n=L.find(e=>e.id===t),i=r?.kind===`ticket`&&n&&$t===iy(n)?Qt:null;try{await jn(t,n?.project_id??e),o?.(i),s?.()}catch{}},Nr=t=>{Mn(t,L.find(e=>e.id===t)?.project_id??e).then(()=>{R(e=>e.map(e=>e.id===t?{...e,agent_status:`stopped`,is_running:!1}:e))})},Pr=async t=>{let n=L.find(e=>e.id===t);try{await Nn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:F(`reviewInterrupt.error`))}},Fr=t=>{Pn(t,L.find(e=>e.id===t)?.project_id??e).then(()=>{R(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e))})},Ir=(0,p.useCallback)(e=>{let t=ar(e);!t||!nr(t)||jr(t.id)},[nr,ar,jr]),Lr=(0,p.useCallback)((e,t)=>{let n=ar(e),r=t===`files`?sr(e):or(e);if(!(!n||!r)){if(O){O({kind:`bundle`,bundleId:e},t);return}ht({target:{kind:`bundle`,bundleId:e,ticketId:n.id},projectId:n.project_id,title:n.bundle?My(n.bundle):n.title,bundleTargetName:n.bundle&&My(n.bundle)||null,initialMode:t,followUpMode:`build`})}},[sr,or,ar,O]),Rr=(0,p.useCallback)((e,t)=>{let n=ar(e);if(!n?.project_id||!Cy(n))return;let r=n.latest_check_gate_evaluation?.id??L.find(t=>t.worktree_bundle_id===e&&t.latest_check_gate_evaluation)?.latest_check_gate_evaluation?.id??null;if(on.length===0&&!r)return;let i=B.find(t=>t.id===e)??n.bundle;i&&vt({bundleId:e,label:My(i),requestedInitialTab:t,gateEvaluationId:r,requiredCheckPolicy:i.required_check_policy??null})},[B,ar,on.length,L]),zr=(0,p.useCallback)((e,t)=>{let n=L.find(t=>t.id===e);if(!(!n||!rr(n))){if(O){O({kind:`ticket`,ticketId:e},t);return}ht({target:{kind:`ticket`,ticketId:n.id},projectId:n.project_id,title:n.title,bundleTargetName:null,initialMode:t,followUpMode:`build`})}},[rr,O,L]),Br=(0,p.useCallback)(e=>Lr(e,`files`),[Lr]),Vr=(0,p.useCallback)(e=>Lr(e,`changes`),[Lr]),Hr=(0,p.useCallback)(e=>zr(e,`files`),[zr]),Ur=(0,p.useCallback)(e=>zr(e,`changes`),[zr]),Wr=(0,p.useCallback)(e=>{let t=L.find(t=>t.id===e);!t?.project_id||!Cy(t)||pt({ticketId:t.id,label:t.title})},[L]),Gr=(0,p.useCallback)(async(t,n,r=`build`,i)=>{let a=L.find(e=>e.id===t);if(a)try{gr(a.state===`plan`?await zn(t,a.project_id??e,n):await Fn(t,a.project_id??e,n,r,i))}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.sendFollowUp`),{id:`board-follow-up-error`}),e}},[e,gr,F,L]),Kr=(0,p.useCallback)(e=>{R(t=>e.reduce((e,t)=>{let n=e.find(e=>e.id===t.id),r=se(n,t);if(!r)return e;let i=l8(n&&n.state===r.state&&n.agent_status===`running`&&r.agent_status===null?{...r,agent_status:n.agent_status,session_id:n.session_id,is_running:n.is_running}:r);return u8(n,i)?h8(e,i):m8(e,i)},t))},[se,R]),qr=(0,p.useCallback)(e=>{ot(e),V(t=>p8(t,e.bundle)),Kr(e.tickets)},[Kr,V]),Jr=(0,p.useCallback)((e,t)=>{Array.isArray(t.tickets)&&ot(n=>{if(!n||n.bundle.id!==e)return n;let r=vne(n.tickets,t.tickets),i=n.tickets.find(e=>e.id===n.review_owner_ticket_id&&e.state===`review`&&e.agent_status===`running`&&e.updated_at>=(t.tickets.find(t=>t.id===e.id)?.updated_at??``))??null;return{...n,tickets:r,execution_order_ticket_ids:t.execution_order_ticket_ids,latest_session_ticket_id:t.latest_session_ticket_id,latest_session_id:t.latest_session_id,review_owner_ticket_id:t.review_owner_ticket_id??i?.id??null,target_ticket_id:i?.id??t.target_ticket_id}})},[]),Yr=(0,p.useCallback)(async e=>{let t=ie.current;if(!t)return null;let n=await bt(t,e);return ie.current!==t||nt.current!==e?null:(qr(n),n)},[ie,qr]),Xr=(0,p.useCallback)(async()=>{let e=lt?.bundle.id,t=ie.current;if(!e||!t)return null;let n=++dt.current,r=await bt(t,e);return n!==dt.current||ie.current!==t?null:(qr(r),ut(r),r)},[ie,qr,lt?.bundle.id]),Zr=(0,p.useCallback)(async t=>{if(!e)return;ct(t),ut(null);let n=++dt.current;try{let r=await bt(e,t);if(ie.current!==e||n!==dt.current)return;qr(r),ut(r)}catch{if(n!==dt.current||ie.current!==e)return;ct(null),$.error(F(`buildOpenQuestionsDialog.refreshFailedError`),{id:`board-build-open-questions-load-error`})}},[e,ie,qr,F]),Qr=(0,p.useCallback)(async t=>{let n=lt?.bundle.id;if(!e||!n)return;let r=++dt.current;await zt(e,n,t),r===dt.current&&(ct(null),ut(null))},[e,lt?.bundle.id]),$r=lt?.bundle.id??null;(0,p.useEffect)(()=>{if(!$r)return;let e=new Map(L.map(e=>[e.id,e])),t=B.find(e=>e.id===$r);ut(n=>!n||n.bundle.id!==$r?n:{...n,bundle:t?{...n.bundle,...t}:n.bundle,tickets:n.tickets.map(t=>{let n=e.get(t.id);return n?{...t,...n}:t})})},[B,$r,L]);let ei=(0,p.useCallback)(async e=>{let t=ie.current;if(!t)return null;let n=await xt(t,e);return ie.current!==t||nt.current!==e?null:(Jr(e,n),n)},[ie,Jr]),ti=(0,p.useCallback)(async(e,t=null)=>{let n=ie.current;if(!n)return;nt.current=e,Je(null),Xe(null),tt(e),it(t),wt(n8());let r=_n.get(e)??null,i=L.filter(t=>t.worktree_bundle_id===e);if(r&&i.length>0){let e=by(i),t=Ty(i,{latestSessionTicketId:e?.id??null});ot({bundle:r,tickets:i,latest_session_ticket_id:e?.id??null,latest_session_id:e?.session_id??null,review_owner_ticket_id:null,target_ticket_id:t?.id??null})}else ot(null);St(!0);try{await ei(e)}catch(t){if(t instanceof Ke&&t.status===404&&S===e){gn(),j?.();return}}finally{ie.current===n&&St(!1)}},[ie,_n,gn,j,ei,S,L]),ni=(0,p.useCallback)((e,t=null)=>{ti(e,t),E?.(e)},[E,ti]),ri=(0,p.useCallback)(async(e,t)=>{wt(t=>({...t,[e]:!0}));try{return await t()}finally{wt(t=>({...t,[e]:!1}))}},[]),ii=(0,p.useCallback)(async t=>{await ri(`stopBuild`,async()=>{let n=L.find(e=>e.id===t);await Mn(t,n?.project_id??e),R(e=>e.map(e=>e.id===t?{...e,agent_status:`stopped`,is_running:!1}:e)),n?.worktree_bundle_id&&await Yr(n.worktree_bundle_id)})},[e,Yr,ri,R,L]),ai=(0,p.useCallback)(async t=>{await ri(`stopBuild`,async()=>{let n=L.find(e=>e.id===t);try{await Nn(t,n?.project_id??e)}catch(e){$.error(e instanceof Error?e.message:F(`reviewInterrupt.error`))}})},[e,ri,F,L]),oi=(0,p.useCallback)(async t=>{await ri(`resumeBuild`,async()=>{let n=L.find(e=>e.id===t);await Pn(t,n?.project_id??e),R(e=>e.map(e=>e.id===t?{...e,agent_status:`running`}:e)),n?.worktree_bundle_id&&await Yr(n.worktree_bundle_id)})},[e,Yr,ri,R,L]),si=(0,p.useCallback)(async t=>{if(e)try{qr(await ri(`build`,()=>Tt(e,t))),et===t&&it(`build`),s?.()}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.buildBundle`),{id:`board-bundle-build-error`}),e}},[e,qr,s,ri,et,F]),ci=(0,p.useCallback)(async t=>{if(e)try{qr(await ri(`review`,()=>Et(e,t))),et===t&&it(`review`)}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.reviewBundle`),{id:`board-bundle-review-error`}),e}},[e,qr,ri,et,F]),li=(0,p.useCallback)(async t=>{if(e)try{qr(await ri(`review`,()=>Dt(e,t))),et===t&&it(`review`)}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.continueBundleReview`),{id:`board-bundle-continue-review-error`}),e}},[e,qr,ri,et,F]),ui=(0,p.useCallback)(async t=>{if(e)try{qe(`review`),qr(await ri(`undoReview`,()=>Ot(e,t))),et===t&&it(`build`)}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.undoBundleReview`),{id:`board-bundle-undo-review-error`}),e}finally{qe(e=>e===`review`?null:e)}},[e,qr,ri,et,F]),di=(0,p.useCallback)(async t=>{if(e)try{qr(await It(e,t))}catch(e){$.error(e instanceof Ke?e.message:`Unable to resume the automation right now.`,{id:`board-bundle-resume-automation-error`})}},[e,qr]),fi=(0,p.useCallback)(async t=>{if(e)try{qr(await Lt(e,t))}catch(e){throw $.error(e instanceof Ke?e.message:F(`ticketAutomation.deliveryReady.error`),{id:`board-bundle-continue-delivery-error`}),e}},[e,qr,F]),pi=(0,p.useCallback)(async t=>{if(e)try{qr(await Rt(e,t))}catch(e){$.error(e instanceof Ke?e.message:`Unable to dismiss the automation pause right now.`,{id:`board-bundle-dismiss-automation-error`})}},[e,qr]),mi=(0,p.useCallback)(async(e,t,n)=>{if(t===T8||n===T8)return;let r=wne(t,n);if(!r)return;let i=L.filter(n=>n.worktree_bundle_id===e&&n.state===t&&n.parked_at===null);if(i.length===0)return;let a=i.map(e=>e.id);ce(a,n),dr(i,n);try{if(r===`build`){await si(e),le(a);return}if(r===`review`){await ci(e),le(a);return}await ui(e),le(a)}catch(e){ur(i),le(a),$.error(e instanceof Ke?e.message:F(`board.errors.moveBundle`),{id:`board-bundle-move-error`})}},[le,si,ci,ui,ce,dr,ur,L,F]),hi=async(t,n)=>{e&&(qr(await ri(`run`,()=>Nt(e,t,n))),s?.())},gi=async e=>{if(S8(t)){Oe(e);return}await hi(e,`project_default`)},_i=async t=>{if(!e)return;let n=r?.kind===`ticket`&&$t===t?Qt:null,i=await ri(`stop`,()=>Pt(e,t));o?.(n),qr(i),s?.()},vi=(0,p.useCallback)(async(t,n,r=`build`,i)=>{e&&qr(await ri(`followUp`,()=>kt(e,t,n,r,i)))},[e,qr,ri]);(0,p.useEffect)(()=>()=>{a?.(null)},[a]),(0,p.useEffect)(()=>{if(!a)return;if(!r){a(null);return}if(r.kind===`project`){a({target:null,canSelect:!1,disabledReason:F(`board.preview.disabledProjectRoot`),submitPrompt:null});return}let e=L.find(e=>e.id===r.ticket_id);if(!e){a({target:null,canSelect:!1,disabledReason:F(`board.preview.disabledBuildCapable`),submitPrompt:null});return}if(e.state===`plan`){a({target:{kind:`ticket`,id:e.id},canSelect:!1,disabledReason:F(`board.preview.disabledPlanMode`),submitPrompt:null});return}if(e.worktree_bundle_id){a({target:{kind:`bundle`,id:e.worktree_bundle_id,ticket_id:e.id},canSelect:!0,disabledReason:null,promptPlaceholder:F(`board.preview.followUpBundlePlaceholder`),submitPrompt:t=>vi(e.worktree_bundle_id,t)});return}a({target:{kind:`ticket`,id:e.id},canSelect:!0,disabledReason:null,promptPlaceholder:F(`board.preview.followUpTicketPlaceholder`),submitPrompt:t=>Gr(e.id,t)})},[r,Gr,vi,a,F,L]);let yi=async t=>{let n=L.find(e=>e.id===t),r=n?ny(n.state):null;if(n)try{if(n.state===`review`&&n.can_re_review&&n.agent_status!==`running`){let t=await Ln(n.id,n.project_id??e);gr(t),t.worktree_bundle_id&&await Yr(t.worktree_bundle_id);return}if(!r)return;if(n.worktree_bundle_id&&r===`review`){await ci(n.worktree_bundle_id);return}await vr(n,r)}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.moveTicket`),{id:`board-move-error`}),e}},bi=async t=>{let n=L.find(e=>e.id===t);try{gr(await xn(t,n?.project_id??e))}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.startBuildChain`),{id:`board-build-chain-error`}),e}},xi=async t=>{let n=L.find(e=>e.id===t);try{await Sn(t,n?.project_id??e)}catch(e){throw $.error(e instanceof Ke?e.message:F(`board.errors.stopBuildChain`),{id:`board-stop-build-chain-error`}),e}},Si=async()=>{if(!(!e||Ue)){We(!0);try{let t=await Dn(e);R(e=>e.filter(e=>!t.deleted_ticket_ids.includes(e.id))),ee(e=>t.deleted_ticket_ids.reduce(Gv,e)),await W(),He(!1),t.failed_count>0?$.error(F(`board.toasts.deleteDonePartial`,{count:t.deleted_count,deletedCount:t.deleted_count,failedCount:t.failed_count}),{id:`board-delete-parked-error`}):$.success(F(`board.toasts.deleteDoneSuccess`,{count:t.deleted_count}),{id:`board-delete-parked-success`})}catch(e){$.error(e instanceof Ke?e.message:F(`board.errors.emptyDone`),{id:`board-delete-parked-error`})}finally{We(!1)}}},Ci=({delta:e})=>{we(e)},wi=(0,p.useCallback)((t=null)=>{e&&Ee({initialWorktreeBundleId:t})},[e]);(0,p.useEffect)(()=>{!M||!e||(Ee({initialWorktreeBundleId:null,initialImportedDraft:M}),N?.())},[M,e,N]),(0,p.useEffect)(()=>{if(!Y||!e){Ze.current=null;return}let t=`${e}:${Y}`;if(U!==e||Ze.current===t)return;Ze.current=t;let n=pn.get(Y);n?hn(n):_?.(),v===void 0&&g?.()},[e,U,g,_,hn,Y,v,pn]),(0,p.useEffect)(()=>{v===void 0||v||!J||y.some(e=>e.kind===`ticket`&&e.ticketId===J.id)||(Je(null),Xe(null))},[y,v,J]),(0,p.useEffect)(()=>{!v||!e||U!==e||Ze.current!==`${e}:${v}`||q!==v||pn.has(v)||(Je(null),Xe(null),_?.())},[e,U,_,v,q,pn]),(0,p.useEffect)(()=>{if(!S){let e=C?.target.kind===`bundle`?C.target.bundleId:null,t=e!==null&&nt.current===e,n=nt.current!==null&&y.some(e=>e.kind===`bundle`&&e.bundleId===nt.current);Qe.current&&!t&&!n&&(Qe.current=null,e===null&&gn());return}let t=`${e}:${S}`;if(!(!e||U!==e||ne!==e||Qe.current===t)){if(Qe.current=t,!_n.has(S)){j?.();return}ti(S)}},[e,_n,ne,gn,U,j,ti,S,C,y,at,et]),(0,p.useEffect)(()=>{!S||!e||U!==e||ne!==e||Qe.current!==`${e}:${S}`||et!==S||_n.has(S)||(gn(),j?.())},[e,_n,ne,gn,U,j,S,et]),(0,p.useEffect)(()=>{if(!C){$e.current=null,ht(e=>e?.isRouteOwned?null:e);return}let t=C?.target.kind===`bundle`?U===e&&ne===e:U===e;if(!e||!t)return;let n=`${e}:${C.target.kind===`ticket`?`ticket:${C.target.ticketId}`:`bundle:${C.target.bundleId}`}`;if($e.current===n)return;$e.current=n;let r=C.target,i=r.kind===`ticket`&&y.some(e=>e.kind===`ticket`&&e.ticketId===r.ticketId),a=y.some(e=>e.kind===`bundle`&&e.bundleId===(r.kind===`bundle`?r.bundleId:nt.current));if(i||(Je(null),Xe(null)),!a&&r.kind===`ticket`&&gn(),ht(e=>e?.isRouteOwned?null:e),C.target.kind===`ticket`){let e=pn.get(C.target.ticketId);if(!e||!rr(e)){j?.();return}ht({target:{kind:`ticket`,ticketId:e.id},projectId:e.project_id,title:e.title,bundleTargetName:null,initialMode:C.mode,followUpMode:`build`,isRouteOwned:!0});return}let{bundleId:o}=C.target,s=ar(o),c=C.mode===`files`?sr(o):or(o);if(!s||!c){j?.();return}let l=_n.get(o)??s.bundle??null;ht({target:{kind:`bundle`,bundleId:o,ticketId:s.id},projectId:s.project_id,title:l?My(l):s.title,bundleTargetName:l&&My(l)||null,initialMode:C.mode,followUpMode:`build`,isRouteOwned:!0})},[e,_n,ne,sr,or,rr,gn,ar,U,j,C,y,at,et,pn]),(0,p.useEffect)(()=>{let t=C?.target.kind===`bundle`?U===e&&ne===e:U===e;if(!C||!e||!t)return;let n=C.target.kind===`ticket`?`ticket:${C.target.ticketId}`:`bundle:${C.target.bundleId}`;if($e.current!==`${e}:${n}`||!mt?.isRouteOwned)return;if(C.target.kind===`ticket`){if(mt.target.kind!==`ticket`||mt.target.ticketId!==C.target.ticketId)return;let e=pn.get(C.target.ticketId);(!e||!rr(e))&&(ht(null),j?.());return}if(mt.target.kind!==`bundle`||mt.target.bundleId!==C.target.bundleId)return;let{bundleId:r}=C.target,i=ar(r),a=C.mode===`files`?sr(r):or(r);if(!i||!a){ht(null),j?.();return}if(mt.target.ticketId!==i.id){let e=_n.get(r)??i.bundle??null;ht(t=>t?.isRouteOwned?{...t,target:{kind:`bundle`,bundleId:r,ticketId:i.id},projectId:i.project_id,title:e?My(e):i.title,bundleTargetName:e&&My(e)||null}:t)}},[e,_n,ne,sr,or,rr,ar,U,j,C,mt,pn]);let Ti=(0,p.useCallback)(()=>{qt.current?.focus({preventScroll:!0})},[]);return Sme([{key:`n`,onKeyDown:wi,disabled:!e},{key:`k`,ctrlKey:!0,onKeyDown:Ti}],{isBlocked:xme}),(0,X.jsxs)(X.Fragment,{children:[!T&&(0,X.jsxs)(use,{sensors:I,collisionDetection:voe,onDragStart:cr,onDragMove:Ci,onDragCancel:lr,onDragEnd:pr,children:[(0,X.jsx)(`div`,{className:`relative flex min-h-0 flex-1 overflow-hidden`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 overflow-hidden p-6`,children:[(0,X.jsx)(Gde,{query:Vt.query,inputRef:qt,hideStaleTickets:Vt.hideStaleTickets,hideBundlesWithPullRequests:Vt.hideBundlesWithPullRequests,onQueryChange:e=>Ht({query:e}),onClear:()=>{Ht({query:``}),qt.current?.focus()},onHideStaleTicketsChange:e=>Ht({hideStaleTickets:e}),onHideBundlesWithPullRequestsChange:e=>Ht({hideBundlesWithPullRequests:e})}),(0,X.jsx)(`div`,{ref:Vn,className:`flex min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,children:(0,X.jsxs)(`div`,{ref:Hn,className:`relative flex min-h-0 w-max min-w-full gap-4`,children:[(0,X.jsx)(sme,{dependencies:z,cardRects:Gn,clipRects:Kn,preview:qn,ticketsById:pn,overlaySize:Jn}),w8.map(t=>{let n=L.filter(e=>e.state===t&&!ly(e)),r=yn.filter(e=>e.state===t&&!ly(e)),a=Ey(r,B,t),o=an&&n.length===0?t===`plan`?1:t===`build`?2:0:0;return(0,X.jsx)(p3,{id:t,title:F(`card.columnLabels.${t}`),items:a,ticketCount:r.length,allTickets:L,dependencies:z,bundles:B,activeTool:i,modelsByTool:Re,availableSkills:ze,activeRunContextKey:tn,automationStatuses:pe,isProjectRootRunActive:en,isBundleRunDisabled:nn,getDependencyTargetState:Yn,onDependencyStart:Xn,onDeleteDependency:Zn,onRegisterTicketNode:Un,onRegisterDependencyClipNodes:Wn,onAddTicket:t===`plan`&&e?wi:void 0,onCreateBundle:t===`plan`&&e?hr:void 0,onDeleteBundle:t===`plan`&&e?wr:void 0,onDeleteBundleWrapper:Tr,onRefreshBundles:t===`plan`&&e?W:void 0,onUpdateTicket:Er,onDeleteTicket:Dr,onUndoTicket:Or,undoingColumn:Ge,onRetryTicket:kr,onAdvanceTicket:yi,onParkTicket:br,onUnparkTicket:xr,onBuildChainTicket:bi,onRunTicket:Ar,onOpenVerificationTicket:on.length>0?Wr:void 0,canOpenChangesForTicket:rr,onOpenFilesTicket:Hr,onOpenChangesTicket:Ur,canOpenIdeForTicket:nr,onOpenIdeTicket:jr,onStopTicket:Mr,onStopBuildTicket:Nr,onStopBuildChainTicket:xi,onResumeBuildTicket:Fr,onInterruptReviewTicket:Pr,onOpenBundleFiles:Br,onOpenBundleChanges:Vr,canOpenReviewForBundle:or,canOpenFilesForBundle:sr,onOpenBundleVerification:on.length>0?e=>Rr(e):void 0,onOpenBundleChecks:e=>Rr(e,`checks`),hasConfiguredChecks:on.length>0,onOpenBundleIde:Ir,onAddTicketToBundle:wi,onStartChatFromBundle:u,onFollowUpTicket:Gr,bundleActionState:Ct,onBuildBundle:si,onReviewBundle:ci,onUndoBundleReview:ui,onRunBundle:gi,onStopBundle:_i,onParkBundleWrapper:Sr,onUnparkBundleWrapper:Cr,onOpenTicketDetails:hn,onOpenBundleDetails:(e,t)=>{ni(e,t)},onRequestBundleRefresh:e=>{ri(`bundleRefresh`,()=>Yr(e))},onRequestTicketRefresh:oe,hoveredBundleId:ve,onHoverBundleChange:be,multiColumnBundleIds:bn,onResumeBundleAutomation:di,onContinueBundleDelivery:fi,onDismissBundleAutomationPause:pi,onOpenBuildQuestions:e=>{Zr(e)},loadingSkeletonCount:o},t)}),(0,X.jsx)(p3,{id:T8,title:F(`card.columnLabels.done`),items:Rn,ticketCount:In.length,allTickets:L,dependencies:z,activeTool:i,modelsByTool:Re,availableSkills:ze,bundles:B,activeRunContextKey:tn,automationStatuses:pe,isProjectRootRunActive:en,isBundleRunDisabled:nn,getDependencyTargetState:Yn,onDependencyStart:Xn,onDeleteDependency:Zn,onRegisterTicketNode:Un,onRegisterDependencyClipNodes:Wn,onUpdateTicket:Er,onDeleteTicket:Dr,onUndoTicket:Or,undoingColumn:Ge,onRetryTicket:kr,onAdvanceTicket:yi,onParkTicket:br,onUnparkTicket:xr,onBuildChainTicket:bi,onRunTicket:Ar,onOpenVerificationTicket:on.length>0?Wr:void 0,canOpenChangesForTicket:rr,onOpenFilesTicket:Hr,onOpenChangesTicket:Ur,canOpenIdeForTicket:nr,onOpenIdeTicket:jr,onStopTicket:Mr,onStopBuildTicket:Nr,onStopBuildChainTicket:xi,onResumeBuildTicket:Fr,onInterruptReviewTicket:Pr,onOpenBundleFiles:Br,onOpenBundleChanges:Vr,canOpenReviewForBundle:or,canOpenFilesForBundle:sr,onOpenBundleVerification:on.length>0?e=>Rr(e):void 0,onOpenBundleChecks:e=>Rr(e,`checks`),hasConfiguredChecks:on.length>0,onOpenBundleIde:Ir,onAddTicketToBundle:wi,onStartChatFromBundle:u,onFollowUpTicket:Gr,bundleActionState:Ct,onBuildBundle:si,onReviewBundle:ci,onUndoBundleReview:ui,onRunBundle:gi,onStopBundle:_i,onParkBundleWrapper:Sr,onUnparkBundleWrapper:Cr,onOpenTicketDetails:hn,onOpenBundleDetails:(e,t)=>{ni(e,t)},onRequestBundleRefresh:e=>{ri(`bundleRefresh`,()=>Yr(e))},onRequestTicketRefresh:oe,hoveredBundleId:ve,onHoverBundleChange:be,multiColumnBundleIds:bn,onResumeBundleAutomation:di,onContinueBundleDelivery:fi,onDismissBundleAutomationPause:pi,onOpenBuildQuestions:e=>{Zr(e)},className:`min-w-[272px] max-w-[272px] flex-[0.98] bg-card/65`,headerAccessory:(0,X.jsxs)(Q,{type:`button`,variant:`destructive`,size:`xs`,className:`gap-1.5`,disabled:In.length===0||Ue,onClick:()=>He(!0),children:[(0,X.jsx)(wC,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:F(`board.doneColumn.emptyAction`)})]})})]})})]})}),(0,X.jsxs)(Ese,{zIndex:5,dropAnimation:G?null:void 0,children:[me&&(0,X.jsx)(f3,{ticket:me,allTickets:L,dependencies:z,bundles:B,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:me.worktree_bundle_id?pe.get(me.worktree_bundle_id):null,overlay:!0,activeTool:i,showModelSelector:(()=>{let e=yF(me,i);return bF(e)&&Le(e).length>0})(),availableModels:Le(yF(me,i)),runDisabled:ay(me,tn,en,F(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:ay(me,tn,en,F(`board.errors.runBlockedByActive`)),onDependencyStart:Xn,onDeleteDependency:Zn,onRegisterOverlayNode:Se,onCreateBundle:hr,onDeleteBundle:wr,onRefreshBundles:W,onUpdate:Er,onDelete:()=>Dr(me.id),onUndo:()=>Or(me.id),undoInProgress:Ge===me.state&&(me.state===`build`||me.state===`review`),onRetry:()=>kr(me.id),onAdvance:()=>yi(me.id),onPark:()=>br(me.id),onUnpark:()=>xr(me.id),onBuildChain:()=>bi(me.id),onRun:me.worktree_bundle_id===null&&Cy(me)&&me.has_run_config?()=>Ar(me.id):void 0,onOpenIde:me.worktree_bundle_id===null&&nr(me)?()=>jr(me.id):void 0,onStop:me.worktree_bundle_id===null?()=>Mr(me.id):void 0,onStopBuild:()=>Nr(me.id),onStopBuildChain:()=>xi(me.id),onResumeBuild:()=>Fr(me.id),onInterruptReview:()=>void Pr(me.id),onFollowUp:e=>Gr(me.id,e),onRequestTicketRefresh:oe}),!me&&ge&&(0,X.jsx)(CF,{group:ge,activeTool:i,modelsByTool:Re,automationStatus:pe.get(ge.bundle.id),overlay:!0,renderTicket:tr})]}),rn&&(0,X.jsx)(ume,{className:`pointer-events-auto fixed left-1/2 top-4 z-20 w-[min(14rem,calc(100vw-2rem))] -translate-x-1/2`})]}),Te&&(()=>{let r=Le(i),a=Wt&&Qn.model&&r.some(e=>e.id===Qn.model),o=a?Qn.model:``,s=a?Qn.variant:``;return(0,X.jsx)(lme,{onSubmit:mr,bundles:B,projectId:e,projectBranchState:n,tool:i,showModelSelector:Wt,showSkillsSelector:i===`opencode`,showDockerSandboxModelNotice:t?.build_execution_provider===`docker_sandbox`,onOpenProjectExecutionSettings:P,availableModels:r,availableSkills:ze,initialModel:o,initialVariant:s,initialSkills:Wt&&i===`opencode`?Qn.skills:[],initialWorktreeBundleId:Te.initialWorktreeBundleId,initialImportedDraft:Te.initialImportedDraft,onCreateBundle:hr,onDeleteBundle:wr,onRefreshBundles:W,onClose:()=>Ee(null)})})(),Ve&&(0,X.jsx)(Kde,{ticketCount:In.length,isDeleting:Ue,onCancel:()=>He(!1),onConfirm:()=>{Si()}}),De&&(0,X.jsx)(fC,{onSelect:e=>{let t=De;Oe(null),e&&hi(t,e)}}),J&&(0,X.jsx)(d3,{ticket:J,allTickets:L,dependencies:z,bundles:B,projectMemoryEnabled:!!t?.memory_enabled,automationStatus:J.automation_paused_reason?null:J.worktree_bundle_id?pe.get(J.worktree_bundle_id):null,projectBranchState:n,onClose:()=>{let e=J.id;Je(null),Xe(null),R(t=>t.map(t=>t.id===e?l8(t):t)),x?.()},showModelSelector:Gt,showSkillsSelector:yF(J,i)===`opencode`,activeTool:i,availableModels:Le(yF(J,i)),availableReviewerModels:Fe[i],isLoadingReviewerModels:Ie[i],availableSkills:ze,runDisabled:ay(J,tn,en,F(`board.errors.runBlockedByActive`))!==void 0,runDisabledReason:ay(J,tn,en,F(`board.errors.runBlockedByActive`)),onDeleteDependency:Zn,onCreateBundle:hr,onDeleteBundle:wr,onRefreshBundles:W,onUpdate:Er,onAdvance:()=>yi(J.id),onBuildChain:()=>bi(J.id),onRun:Cy(J)&&J.has_run_config?()=>Ar(J.id):void 0,onOpenIde:nr(J)?()=>jr(J.id):void 0,onStop:()=>Mr(J.id),onStopBuild:()=>Nr(J.id),onStopBuildChain:()=>xi(J.id),onResumeBuild:()=>Fr(J.id),onInterruptReview:()=>void Pr(J.id),onFollowUp:(e,t)=>Gr(J.id,e,t),onReviewFollowUp:(e,t)=>J.worktree_bundle_id?vi(J.worktree_bundle_id,e,t,`changes`):Gr(J.id,e,t,`changes`),onProjectMemorySuggestionsChanged:()=>{jt(e=>e+1)},onRequestTicketRefresh:e=>{mn(e)},onWorkspaceReviewOpen:O?e=>{O({kind:`ticket`,ticketId:J.id},e)}:void 0,onViewSourceSpec:c,onNavigateToLifecycleSource:l,onOpenBuildQuestions:e=>{Zr(e)},onOpenChecks:J.worktree_bundle_id&&(on.length>0||J.latest_check_gate_evaluation)?()=>{Rr(J.worktree_bundle_id,`checks`)}:void 0,onStopAutomation:J.worktree_bundle_id?()=>_i(J.worktree_bundle_id):void 0}),ft&&e&&t&&(()=>{let t=L.find(e=>e.id===ft.ticketId);if(!t)return null;let n=!!t.worktree_bundle_id,r=t.worktree_bundle_id?_n.get(t.worktree_bundle_id)?.required_check_policy??t.bundle?.required_check_policy:void 0,i=r?.required_check_definition_ids??cn,a=r?.pre_review_check_definition_ids??un,o=n?{projectId:e,targetKind:`bundle`,targetBundleId:t.worktree_bundle_id}:null,s={scope:`ticket`,ticketId:t.id,projectId:t.project_id};return(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(C8,{targetLabel:ft.label,definitions:on,requiredDefinitionIds:i,preReviewDefinitionIds:a,checksTarget:o,testsTarget:s,onClose:()=>pt(null),requestedInitialTab:ft.requestedInitialTab})})})(),mt&&(()=>{let{target:e}=mt,t=L.find(t=>t.id===e.ticketId),n=e.kind===`bundle`,r=n?L.some(t=>t.worktree_bundle_id===e.bundleId):!!t,i=n?L.some(t=>t.worktree_bundle_id===e.bundleId&&t.agent_status===`running`):t?.agent_status===`running`,a=n?r&&!i:!!t&&!i,o=!!(mt.isRouteOwned&&w!==void 0),s=o?w:null,l=o?s?.canSubmitReviewPrompt??!1:a,u=i?F(`board.changes.reviewPromptDisabledReason`):r?!n&&t?s3(t).disabledReason??void 0:void 0:F(`board.changes.targetUnavailableReason`),d=!i&&(n||t?.state===`build`||t?.state===`review`),f=!!t?.messages?.some(e=>e.metadata?.ask_question?.status===`pending`),p=!!(!o&&t&&JY(t,mt.followUpMode,f)),m=async()=>{ht(e=>e&&{...e,followUpMode:`build`});try{n?await vi(e.bundleId,`Implement this plan.`,`build`,`changes`):await Gr(e.ticketId,`Implement this plan.`,`build`,`changes`)}catch(e){throw ht(e=>e&&{...e,followUpMode:`plan`}),e}},h=n?_n.get(e.bundleId):void 0;return(0,X.jsx)(H6,{target:{scope:`ticket`,ticketId:e.ticketId,onTicketUpdate:Er,onRequestTicketRefresh:oe},initialMode:mt.initialMode,reviewMode:mt.isRouteOwned?C?.mode:void 0,onReviewModeChange:mt.isRouteOwned?k:void 0,enabledModes:[`changes`,`files`],projectId:mt.projectId,reviewCommentsBundleId:n?e.bundleId:null,title:mt.title,bundleTargetName:mt.bundleTargetName,fileTarget:h?.kind===`project_root`?{kind:`repo_root`,bundle_id:null,ticket_id:null}:void 0,onSubmitReviewPrompt:o?s?.submitPrompt:t=>n?vi(e.bundleId,t,mt.followUpMode,`changes`):Gr(e.ticketId,t,mt.followUpMode,`changes`),canSubmitReviewPrompt:l,reviewSubmitDisabledReason:o?s?.reviewSubmitDisabledReason??F(`workspaceReviewModal.chatRequired`):u,canAddReviewComments:l,canModifyChanges:a,changesDisabledReason:i?F(`board.changes.modifyChangesDisabledReason`):u,mode:o?s?.mode:mt.followUpMode,onModeChange:o?s?.onModeChange:e=>{ht(t=>t&&{...t,followUpMode:e})},canToggleMode:o?s?.canSubmitReviewPrompt??!1:d,modeActions:p?(0,X.jsx)(tX,{disabled:!a,onClick:()=>void m()}):void 0,isUpdatingMode:s?.isUpdatingMode??!1,onClose:()=>{if(ht(null),mt.isRouteOwned&&A?.(),n){Yr(e.bundleId);return}mn(e.ticketId)},onViewSourceSpec:c,originSpecSessionId:t?.origin_spec_session_id??null,originSpecSnapshotId:t?.origin_spec_snapshot_id??null})})(),gt&&e&&t&&(()=>{let t=_n.get(gt.bundleId)?.required_check_policy??gt.requiredCheckPolicy,n=t?.required_check_definition_ids??cn,r=t?.pre_review_check_definition_ids??un;return(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(C8,{targetLabel:gt.label,definitions:on,requiredDefinitionIds:n,preReviewDefinitionIds:r,checksTarget:{projectId:e,targetKind:`bundle`,targetBundleId:gt.bundleId,gateEvaluationId:gt.gateEvaluationId},testsTarget:fn?{scope:`project`,projectId:e,targetKind:`bundle`,targetBundleId:gt.bundleId}:null,onClose:()=>vt(null),requestedInitialTab:gt.requestedInitialTab})})})(),et&&vn&&(0,X.jsx)(rfe,{details:vn,activeColumn:rt,isLoading:yt||Ct.bundleRefresh,actionState:Ct,canOpenIde:ir(vn),projectMemoryEnabled:!!t?.memory_enabled,memorySuggestionsRefreshKey:At,automationStatus:vn.tickets.some(e=>e.automation_paused_reason)?null:pe.get(vn.bundle.id),runDisabled:nn(vn.bundle.id),showModelSelector:Kt,activeTool:i,modelsByTool:Re,modelsLoadingByTool:Ie,availableSkills:ze,onClose:()=>{let e=vn.bundle.id;tt(null),it(null),ot(null),St(!1),wt(n8()),R(t=>t.map(t=>t.worktree_bundle_id===e&&t.id!==q?l8(t):t)),D?.()},onOpenTicketDetails:hn,onNavigateToLifecycleSource:l,onUpdateTicket:Er,onOpenIde:()=>{let e=vn.tickets.find(e=>e.id===vn.target_ticket_id)??vn.tickets.find(e=>e.has_worktree);e&&jr(e.id)},onOpenVerification:on.length>0?()=>{Rr(vn.bundle.id)}:void 0,onOpenChecks:on.length>0||vn.tickets.some(e=>e.latest_check_gate_evaluation)?()=>{Rr(vn.bundle.id,`checks`)}:void 0,onRefresh:e=>ri(`bundleRefresh`,()=>Yr(e)).then(()=>void 0),onWorkspaceReviewOpen:O?e=>{O({kind:`bundle`,bundleId:vn.bundle.id},e)}:void 0,onUpdateBundle:_r,onBuildBundle:si,onStopBuildTicket:ii,onResumeBuildTicket:oi,onInterruptReviewTicket:ai,onReviewBundle:ci,onContinueReviewBundle:li,onUndoBundleReview:ui,onRunBundle:gi,onStopBundle:_i,onFollowUpBundle:vi,onOpenBuildQuestions:e=>{Zr(e)},onResumeBundleAutomation:di,onContinueBundleDelivery:fi,onDismissBundleAutomationPause:pi}),st&<&&(0,X.jsx)($pe,{details:lt,onClose:()=>{dt.current+=1,ct(null),ut(null)},onRefresh:Xr,onSubmit:Qr})]})},E8=({count:e,title:t,isDeleting:n,onConfirm:r,onCancel:i,labels:a})=>{let o=e>1;return(0,X.jsxs)(uC,{onClose:i,overlayClassName:`bg-black/70`,panelClassName:`max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,X.jsx)(`h2`,{className:`mb-3 text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:o?a.bulkTitle:a.title}),t?(0,X.jsx)(`p`,{className:`mb-1 text-sm text-foreground`,children:t}):null,(0,X.jsx)(`p`,{className:`mb-6 text-xs text-muted-foreground`,children:o?a.bulkDescription(e):a.description}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(Q,{type:`button`,variant:`ghost`,onClick:i,disabled:n,children:a.cancel}),(0,X.jsx)(Q,{type:`button`,variant:`destructive`,onClick:r,disabled:n,children:n?a.deleting:a.delete})]})]})},D8=({label:e})=>(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-sm text-muted-foreground`,children:e}),O8=({label:e})=>(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-sm text-muted-foreground`,children:e}),k8=({title:e,description:t,startNewSessionLabel:n,onStartNewSession:r,canStartNewSession:i})=>(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6`,children:(0,X.jsxs)(gC,{className:`w-full max-w-lg border-dashed border-border/70 bg-card/40`,children:[(0,X.jsxs)(_C,{children:[(0,X.jsx)(vC,{children:e}),(0,X.jsx)(yC,{children:t})]}),(0,X.jsx)(xC,{children:(0,X.jsx)(Q,{type:`button`,onClick:r,disabled:!i,children:n})})]})}),qme=({className:e})=>(0,X.jsx)(Ste,{"aria-hidden":`true`,className:e}),Jme=({className:e})=>(0,X.jsx)(dte,{"aria-hidden":`true`,className:e}),Yme=({className:e})=>(0,X.jsx)(fte,{"aria-hidden":`true`,className:e}),A8=({sessions:e,sessionGroups:t,activeSessionId:n,isDraftOpen:r,isLoadingSessions:i,isOpen:a,onToggleOpen:o,testId:s,railTestId:c,onDraftOpen:l,isCreatingSession:u,isSendingPrompt:d,newSessionShortcutHint:f,newSessionTooltip:m,isSelectionMode:h,selectedSessionIds:g,selectedSessionCount:_,hasDeletableSessions:v,deletingSessionIds:y,onEnterSelectionMode:b,onExitSelectionMode:x,onToggleSessionSelection:S,onSetSessionSelection:C,onConfirmDeleteSelectedSessions:w,selectionPresets:T,onSessionSelect:E,onConfirmDeleteSession:D,getSessionId:O,getSessionTitle:k,getDeleteDisabledReason:A,getActivityState:j,getRowAriaLabel:M,renderRowContent:N,labels:P})=>{let F=(0,p.useMemo)(()=>new Set(e.filter(e=>!A(e)&&!y.has(O(e))).map(e=>O(e))),[y,A,O,e]),I=(0,p.useMemo)(()=>T.map(t=>({...t,matchingSessionIds:new Set(e.filter(e=>F.has(O(e))&&t.matches(e)).map(O))})),[O,F,T,e]),L=(0,p.useRef)(null),R=(0,p.useRef)(!1),z=(0,p.useRef)(null),ee=(0,p.useCallback)(()=>{z.current!==null&&(window.clearTimeout(z.current),z.current=null)},[]),B=(0,p.useCallback)(()=>{ee(),z.current=window.setTimeout(()=>{R.current=!1,z.current=null},0)},[ee]),V=(0,p.useCallback)(()=>{L.current&&(L.current=null,B())},[B]),te=(0,p.useCallback)(e=>{let t=L.current;!t||t.visitedSessionIds.has(e)||!F.has(e)||(t.visitedSessionIds.add(e),C(e,t.mode===`select`))},[C,F]),H=(0,p.useCallback)(e=>{let t=L.current;!t||e.pointerId!==t.pointerId||V()},[V]);return(0,p.useEffect)(()=>{if(!h){V();return}return window.addEventListener(`pointerup`,H),window.addEventListener(`pointercancel`,H),()=>{window.removeEventListener(`pointerup`,H),window.removeEventListener(`pointercancel`,H),V(),ee()}},[ee,H,h,V]),(0,X.jsx)(`aside`,{"data-testid":s,"data-state":a?`expanded`:`collapsed`,"aria-label":P.ariaLabel,className:Z(`relative z-20 flex h-full shrink-0 flex-col overflow-hidden border-r border-border/70 bg-background/40 transition-[width] duration-200 ease-out motion-reduce:transition-none`,a?`w-72`:`w-16`),children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-start gap-2 border-b border-border/70 px-4 py-3.5`,children:[(0,X.jsxs)(Q,{type:`button`,size:`sm`,className:`gap-2`,onClick:l,disabled:u||d,children:[(0,X.jsx)(hv,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:P.newSession}),f]}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":P.collapseAriaLabel,"aria-expanded":a,className:`ml-auto`,onClick:o,children:(0,X.jsx)(Jme,{className:`h-4 w-4`})})]}),e.length>0?(0,X.jsx)(`div`,{className:`px-4 py-2.5`,children:h?(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:x,disabled:y.size>0,children:P.cancelSelection}),(0,X.jsxs)(Ry,{children:[(0,X.jsx)(zy,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`h-7 gap-1.5 px-2 text-xs`,children:P.addPreset})}),(0,X.jsx)(By,{align:`start`,className:`w-44`,children:I.map(e=>(0,X.jsx)(Vy,{disabled:e.matchingSessionIds.size===0,onSelect:()=>{for(let t of e.matchingSessionIds)C(t,!0)},children:e.label},e.key))})]}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`destructive`,className:`h-7 px-2 text-xs`,onClick:w,disabled:_===0||y.size>0,children:P.deleteSelected})]}),(0,X.jsx)(`div`,{className:`flex justify-end text-xs font-medium text-muted-foreground`,children:P.selectedCount(_)})]}):v?(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2 text-xs`,onClick:b,children:[(0,X.jsx)(qme,{className:`h-3.5 w-3.5`}),P.select]}):null}):null,(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2`,children:i&&e.length===0?(0,X.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground`,children:P.loadingSessions}):e.length===0?(0,X.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/70 px-3 py-4 text-sm text-muted-foreground`,children:P.noSessions}):(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:t.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{className:`px-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground/80`,children:e.label}),e.sessions.map(e=>{let t=O(e),i=!r&&t===n,a=A(e),o=y.has(t),s=!!a||o,c=g.has(t),l=j(e,i);return(0,X.jsxs)(`div`,{"data-session-id":t,"data-session-selectable":s?`false`:`true`,className:Z(`group relative rounded-xl border transition-colors`,i?`border-sky-400/40 bg-sky-500/10 text-foreground ring-1 ring-sky-400/40`:`border-border/50 bg-card/35 text-muted-foreground hover:border-border/80 hover:bg-card/60 hover:text-foreground`),onPointerDownCapture:e=>{!h||s||e.pointerType&&e.pointerType!==`mouse`||typeof e.button==`number`&&e.button!==0||(e.preventDefault(),ee(),R.current=!0,L.current={pointerId:e.pointerId,mode:c?`deselect`:`select`,visitedSessionIds:new Set},te(t))},onPointerMove:e=>{let n=L.current;!n||n.pointerId!==e.pointerId||te(t)},children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":M(e,l),className:`flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-xl px-3 py-2 pr-11 text-left transition-colors focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,onClick:()=>{if(h){if(R.current){R.current=!1;return}if(s)return;S(t);return}E(e)},children:N({session:e,isActive:i,activityState:l,isSelectionMode:h})}),h?(0,X.jsx)(`div`,{className:`absolute top-2 right-2 flex h-7 w-7 items-center justify-center`,title:a??P.selectSessionTitle(k(e)),children:(0,X.jsx)(`input`,{type:`checkbox`,"aria-label":P.selectSessionAriaLabel(k(e)),checked:c,disabled:s,onClick:e=>{e.stopPropagation()},onChange:()=>{R.current||S(t)},className:`h-4 w-4 rounded border-border bg-background text-primary`})}):(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":P.deleteSessionAriaLabel,className:Z(`absolute top-2 right-2 h-7 w-7 shrink-0 rounded-md border border-transparent text-muted-foreground transition-all duration-150 hover:border-border/70 hover:bg-card/80 hover:text-foreground focus-visible:border-border/70 focus-visible:bg-card/80 focus-visible:text-foreground`,`opacity-100 sm:opacity-0 sm:pointer-events-none sm:group-hover:pointer-events-auto sm:group-focus-within:pointer-events-auto sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,s&&`sm:disabled:opacity-0 sm:group-hover:disabled:opacity-50 sm:group-focus-within:disabled:opacity-50`,(i||o)&&`sm:pointer-events-auto sm:opacity-100 sm:disabled:opacity-50`,a&&`cursor-not-allowed text-muted-foreground/50 hover:border-transparent hover:bg-transparent hover:text-muted-foreground/50 focus-visible:border-transparent focus-visible:bg-transparent focus-visible:text-muted-foreground/50`),title:a??P.deleteSessionTitle(k(e)),disabled:s,onClick:e=>{e.stopPropagation(),D(t)},children:(0,X.jsx)(wC,{className:`h-4 w-4`})})]},t)})]},e.key))})})]}):(0,X.jsxs)(`div`,{"data-testid":c,className:`flex h-full w-full flex-col items-center gap-2 bg-background/80 py-3`,children:[m?(0,X.jsx)(lv,{content:m,side:`right`,children:(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":P.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,X.jsx)(hv,{className:`h-4 w-4`})})}):(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,"aria-label":P.newSession,className:`h-9 w-9`,onClick:l,disabled:u||d,children:(0,X.jsx)(hv,{className:`h-4 w-4`})}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":P.openAriaLabel,"aria-expanded":a,className:`h-9 w-9`,onClick:o,children:(0,X.jsx)(Yme,{className:`h-4 w-4`})})]})})},j8=({action:e,isPending:t,disabled:n=!1,onAction:r,label:i,pendingLabel:a})=>(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`gap-2`,disabled:n||t,onClick:r,children:[t?(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`}):e===`resume`?(0,X.jsx)(Ev,{className:`h-4 w-4`}):(0,X.jsx)(Ov,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:t?a:i})]}),M8=4,Xme=5e3,N8=(e,t)=>jb.t(`common:chatChangesPanel.${e}`,t),P8=e=>e.replace(/^[ab]\//,``),F8=e=>{let t=`oldPath`in e&&typeof e.oldPath==`string`?P8(e.oldPath):``,n=`newPath`in e&&typeof e.newPath==`string`?P8(e.newPath):``;return[...new Set([n,t].filter(e=>e&&e!==`/dev/null`))]},I8=e=>{let[t,n]=F8(e);return!t&&!n?N8(`unknownFile`):t&&n&&t!==n?`${n} -> ${t}`:t??n??N8(`unknownFile`)},L8=e=>{let t=mG((()=>{let[t,n]=F8(e);return t??n??null})());if(!t)return null;try{return vj(e.hunks,{highlight:!0,refractor:lK.default,language:t,enhancers:[gj(e.hunks)]})}catch{return null}},R8=(e,t)=>e instanceof Error?e.message:t,Zme=(e,t)=>{if(!t)return e;let n=I8(t);return[t,...e.filter(e=>I8(e)!==n)]},Qme=e=>[...e].sort((e,t)=>{if(e.filePath!==t.filePath)return e.filePath.localeCompare(t.filePath);let n=e.newLineNumber??e.oldLineNumber??2**53-1,r=t.newLineNumber??t.oldLineNumber??2**53-1;return n===r?e.changeKey.localeCompare(t.changeKey):n-r}),$me=({diffResponse:e,gitStatus:t})=>{let n=new Map;for(let t of e?.files??[])n.set(t.path,t);return t?t.files.map(e=>{let t=n.get(e.path)??(e.original_path?n.get(e.original_path):void 0);return{path:e.path,originalPath:e.original_path,status:e.status,staged:e.staged,unstaged:e.unstaged,conflicted:e.conflicted,additions:t?.additions??0,deletions:t?.deletions??0}}):(e?.files??[]).map(e=>({path:e.path,originalPath:null,status:null,staged:!1,unstaged:!1,conflicted:!1,additions:e.additions,deletions:e.deletions}))},z8=e=>{let t=e.split(/[\\/]/);return t[t.length-1]||e},ehe={modified:`border-amber-500/40 bg-amber-500/10 text-amber-200`,added:`border-emerald-500/40 bg-emerald-500/10 text-emerald-200`,deleted:`border-rose-500/40 bg-rose-500/10 text-rose-200`,renamed:`border-sky-500/40 bg-sky-500/10 text-sky-200`,untracked:`border-violet-500/40 bg-violet-500/10 text-violet-200`,typechanged:`border-slate-500/40 bg-slate-500/10 text-slate-200`},the=e=>N8(`fileStatus.${e}`),nhe=({selectedDiffPath:e,sidebarFiles:t,diffStats:n,triggerMode:r=`full`,onSelectDiffPath:i})=>{let[a,o]=(0,p.useState)(!1),s=t.find(t=>t.path===e)??null,c=r===`compact`?e===`all`?N8(`picker.diff`):s?z8(s.path):N8(`picker.file`):e===`all`?N8(`picker.allChanges`):s?z8(s.path):e;return(0,X.jsxs)(B_,{open:a,onOpenChange:o,children:[(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,className:Z(`max-w-full gap-2`,r===`full`?`min-w-0 max-w-[18rem]`:`min-w-0 px-2.5`),"aria-label":N8(`picker.openChangedFilesAriaLabel`),title:e===`all`?void 0:s?.path??e,children:[(0,X.jsx)(`span`,{className:`truncate`,children:c}),r===`full`&&(0,X.jsx)(hC,{variant:`outline`,className:`shrink-0 text-[10px] uppercase tracking-wide`,children:N8(`picker.fileCount`,{count:t.length})}),(0,X.jsx)(mv,{className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,X.jsxs)(H_,{align:`start`,className:`z-[90] w-[28rem] max-w-[calc(100vw-2rem)] p-0`,children:[(0,X.jsx)(`div`,{className:`border-b border-border/80 px-4 py-3`,children:(0,X.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:N8(`picker.title`)})}),(0,X.jsx)(`div`,{className:`max-h-[min(28rem,calc(100vh-10rem))] overflow-y-auto p-3`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{i(`all`),o(!1)},className:Z(`flex w-full cursor-pointer items-start gap-3 rounded-xl border px-3 py-2.5 text-left transition-colors`,J3(e===`all`),`justify-between`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:N8(`picker.allChanges`)}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground transition-colors group-hover:text-foreground/70`,children:N8(`picker.allChangesDescription`)})]}),n&&(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 text-[11px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground transition-colors group-hover:text-foreground/70`,children:N8(`picker.fileCount`,{count:n.files_changed})}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,n.additions]}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,n.deletions]})]})]}),t.map(t=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>{i(t.path),o(!1)},className:Z(`flex w-full cursor-pointer items-start gap-3 rounded-xl border px-3 py-2.5 text-left transition-colors`,J3(e===t.path)),children:(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:z8(t.path)}),(0,X.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-[11px] text-muted-foreground transition-colors group-hover:text-foreground/70`,children:t.path})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 text-[11px]`,children:[(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[`+`,t.additions]}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-rose-400`,children:[`-`,t.deletions]})]})]}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[t.status&&(0,X.jsx)(hC,{variant:`outline`,className:ehe[t.status],children:the(t.status)}),t.staged&&(0,X.jsx)(hC,{variant:`outline`,children:N8(`fileStatus.staged`)}),t.unstaged&&(0,X.jsx)(hC,{variant:`outline`,children:N8(`fileStatus.unstaged`)}),t.conflicted&&(0,X.jsx)(hC,{variant:`destructive`,children:N8(`fileStatus.conflicted`)}),t.originalPath&&(0,X.jsx)(`span`,{className:`break-all font-mono text-[11px] text-muted-foreground transition-colors group-hover:text-foreground/70`,children:t.status===`renamed`?N8(`fileStatus.renamedFrom`,{path:t.originalPath}):t.originalPath})]})]})},`${t.path}:${t.originalPath??``}`))]})})]})]})},B8=(0,p.memo)(({projectId:e,chatSessionId:t=null,canSubmitReviewPrompt:n,reviewSubmitDisabledReason:r,onSubmitReviewPrompt:i,state:a,onStateChange:o,isResizing:s=!1,onClose:c,desktopWidth:l,panelElementRef:u})=>{let[d,f]=(0,p.useState)(null),[m,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(!1),[,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(new Map),[C,w]=(0,p.useState)(!1),T=(0,p.useRef)(0),E=(0,p.useRef)(0),D=(0,p.useRef)(null),O=(0,p.useRef)(null),k=a.selectedDiffPath,A=a.activeReviewTarget,j=a.editingReviewCommentKey,M=A?.commentKey??j??`chat`,N=a.reviewDraftInput,P=(0,p.useMemo)(()=>new Map(a.reviewComments.map(e=>[Fj(e.filePath,e.changeKey),e])),[a.reviewComments]),F=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await FM(e,t):await ir(e)},[t,e]),I=(0,p.useCallback)(async()=>{if(!e)throw Error(`Project id is required`);return t?await IM(e,t):await dr(e)},[t,e]);(0,p.useEffect)(()=>{D.current=d},[d]),(0,p.useEffect)(()=>{O.current=m},[m]);let L=(0,p.useCallback)(async()=>{if(!e){E.current+=1,f(null),h(null),_(null),y(!1),b(!1);return}let t=T.current+1,n=E.current+1;T.current=t,E.current=n,y(!0),b(!0);let r=F().then(e=>{T.current===t&&(D.current=e,f(e),_(null))}).catch(e=>{T.current===t&&_(R8(e,N8(`errors.loadDiff`)))}).finally(()=>{T.current===t&&E.current===n&&y(!1)}),i=I().then(e=>{T.current===t&&(O.current=e,h(e))}).catch(()=>{}).finally(()=>{T.current===t&&b(!1)});await Promise.allSettled([r,i])},[F,I,e]),R=(0,p.useCallback)(async(t={})=>{if(!e)return;let{broadcastOnSignatureChange:n=!1}=t,r=T.current+1;T.current=r,b(!0);try{let t=await I();if(T.current!==r)return;let i=O.current?.workspace_signature??null,a=t.workspace_signature??null,o=!D.current||i!==a;if(O.current=t,h(t),!o){E.current+=1,y(!1);return}let s=!D.current,c=E.current+1;E.current=c,s&&y(!0);try{let t=await F();if(T.current!==r)return;D.current=t,f(t),_(null),n&&i!==a&&t6(e)}catch(e){if(T.current!==r)return;D.current||_(R8(e,N8(`errors.loadDiff`)))}finally{s&&E.current===c&&y(!1)}}catch{D.current||(E.current+=1,y(!1));return}finally{T.current===r&&b(!1)}},[F,I,e]);(0,p.useEffect)(()=>{L()},[L]),(0,p.useEffect)(()=>{if(e)return n6(t=>{t===e&&R()})},[e,R]),(0,p.useEffect)(()=>{if(!e)return;let t=$b(()=>{document.visibilityState===`visible`&&R({broadcastOnSignatureChange:!0})});return()=>{t()}},[e,R]),(0,p.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>{document.visibilityState===`visible`&&R({broadcastOnSignatureChange:!0})},Xme);return()=>{window.clearInterval(t)}},[e,R]);let z=(0,p.useMemo)(()=>{let e=typeof d?.diff==`string`?d.diff:``;return e.trim()?oD(e,{nearbySequences:`zip`}).map(e=>({...e,pathCandidates:F8(e)})):[]},[d]),ee=(0,p.useMemo)(()=>{let e=new Map;for(let t of z)for(let n of t.pathCandidates)e.has(n)||e.set(n,t);return e},[z]),B=(0,p.useMemo)(()=>$me({diffResponse:d,gitStatus:m}),[d,m]);(0,p.useEffect)(()=>{if(k!==`all`&&!(!d&&!m)){if(B.length===0){o(e=>({...e,selectedDiffPath:`all`}));return}B.some(e=>e.path===k)||o(e=>({...e,selectedDiffPath:`all`}))}},[d,m,o,k,B]);let V=k===`all`?null:ee.get(k)??null,te=(0,p.useMemo)(()=>Zme(z,V),[z,V]),H=(0,p.useMemo)(()=>k===`all`?z:V?[V]:[],[z,k,V]);(0,p.useEffect)(()=>{S(new Map)},[z]),(0,p.useEffect)(()=>{if(te.length===0)return;let e=!1,t=null,n=0,r=()=>{if(e)return;let i=te.slice(n,n+M8);i.length!==0&&(S(e=>{let t=new Map(e);for(let e of i){let n=I8(e);t.has(n)||t.set(n,L8(e))}return t}),n+=M8,n<te.length&&(t=window.setTimeout(r,0)))};return t=window.setTimeout(r,0),()=>{e=!0,t!==null&&window.clearTimeout(t)}},[te]);let U=(0,p.useMemo)(()=>{let e=new Map;for(let t of te.slice(0,M8))e.set(I8(t),L8(t));return e},[te]),ne=(0,p.useMemo)(()=>H.map(e=>({...e,tokens:x.get(I8(e))??U.get(I8(e))??null})),[U,x,H]),re=(0,p.useMemo)(()=>z.map(e=>({...e,tokens:null})),[z]),ie=(0,p.useMemo)(()=>Qme(a.reviewComments),[a.reviewComments]),ae=ie.length,oe=n&&!C&&ae>0,W=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}))},[o]),se=(0,p.useCallback)(({filePath:e,changeKey:t,commentKey:r})=>{let i=P.get(r);if(i){o(e=>({...e,selectedDiffPath:i.filePath,activeReviewTarget:null,editingReviewCommentKey:r,reviewDraftInput:i.comment}));return}n&&o(n=>({...n,activeReviewTarget:{filePath:e,changeKey:t,commentKey:r},editingReviewCommentKey:null,reviewDraftInput:``}))},[n,o,P]),ce=(0,p.useCallback)(()=>{o(e=>({...e,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``}))},[o]),le=(0,p.useCallback)(e=>{let t=P.has(e.commentKey);if(!n&&!t)return;let r=N.trim();if(!r)return;let i=e.change.type===`insert`?null:`oldLineNumber`in e.change?e.change.oldLineNumber:e.change.lineNumber,a=e.change.type===`delete`?null:`newLineNumber`in e.change?e.change.newLineNumber:e.change.lineNumber;o(t=>{let n=new Map(t.reviewComments.map(e=>[Fj(e.filePath,e.changeKey),e]));return n.set(e.commentKey,{scope:`uncommitted`,filePath:e.filePath,changeKey:e.changeKey,changeType:e.change.type,oldLineNumber:i,newLineNumber:a,hunkHeader:e.hunk.content,lineContent:e.change.content,diffSnippet:Ij(e.hunk,e.change),comment:r}),{...t,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[...n.values()]}})},[n,o,P,N]),ue=(0,p.useCallback)(e=>{let t=P.get(e);t&&o(n=>({...n,selectedDiffPath:t.filePath,activeReviewTarget:null,editingReviewCommentKey:e,reviewDraftInput:t.comment}))},[o,P]),de=(0,p.useCallback)(e=>{o(t=>({...t,activeReviewTarget:t.activeReviewTarget?.commentKey===e?null:t.activeReviewTarget,editingReviewCommentKey:t.editingReviewCommentKey===e?null:t.editingReviewCommentKey,reviewDraftInput:t.activeReviewTarget?.commentKey===e||t.editingReviewCommentKey===e?``:t.reviewDraftInput,reviewComments:t.reviewComments.filter(t=>Fj(t.filePath,t.changeKey)!==e)}))},[o]),fe=(0,p.useCallback)(async()=>{if(!oe)return;w(!0);let e=Gj({drafts:ie,findings:[],githubComments:[],uncommittedFiles:z});try{await i(e),W(),$.success(N8(`toasts.sendChangesSuccess`),{id:`chat-diff-review-submit-success`})}catch(e){$.error(R8(e,N8(`errors.sendChanges`)),{id:`chat-diff-review-submit-error`})}finally{w(!1)}},[oe,W,i,z,ie]),pe=(0,p.useCallback)(e=>(0,X.jsx)(D3,{reviewComments:ie,pendingFixCount:ae,triggerMode:e===`wide`?`full`:`compact`,canSendReview:oe,isSubmittingReview:C,reviewSubmitDisabledReason:r??void 0,onClearPendingFixes:W,onSubmitReview:()=>{fe()}}),[oe,W,fe,C,ae,ie,r]),me=c?(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":N8(`closeAriaLabel`),className:`text-muted-foreground hover:text-foreground`,onClick:c,children:(0,X.jsx)(Ub,{className:`h-4 w-4`})}):null,he=l?{"--chat-changes-panel-width":`${l}px`}:void 0;return(0,X.jsx)(`aside`,{"data-testid":`chat-changes-panel`,"data-desktop-width":l?String(l):void 0,ref:u,style:he,className:Z(`flex h-[26rem] min-h-0 w-full shrink-0 flex-col overflow-hidden border-t border-border/70 bg-background/20 xl:h-full xl:border-l xl:border-t-0`,l?`xl:w-[var(--chat-changes-panel-width)]`:`xl:w-[32rem]`),children:(0,X.jsx)(q3,{selectedDiffPath:k,sidebarFiles:B,diffResponse:d,isDiffLoading:v,diffError:g,allDiffFiles:re,renderedFiles:ne,viewType:`unified`,onViewTypeChange:()=>{},onRetry:()=>{L()},activeReviewTarget:A,editingReviewCommentKey:j,reviewDraftInstanceKey:M,reviewDraftInput:N,reviewComments:ie,reviewFindings:[],githubComments:[],selectedReviewFindingIds:[],selectedGitHubCommentIds:[],canSelectReviewTarget:n,canEditActiveReviewDraft:n,reviewFindingsError:null,gitHubCommentsError:null,hasStaleReviewFindings:!1,onSelectReviewTarget:se,onToggleReviewFindingSelection:()=>{},onToggleGitHubCommentSelection:()=>{},onReviewDraftInputChange:e=>{o(t=>({...t,reviewDraftInput:e}))},onCancelReviewDraft:ce,onEditReviewDraft:ue,onRemoveReviewDraft:de,onSaveReviewDraft:le,diffThemeClassName:Y3,resolveFilePath:I8,normalizeDiffPath:P8,emptyStateTitle:N8(`emptyStateTitle`),emptyStateDescription:N8(`emptyStateDescription`),filePickerControl:e=>(0,X.jsx)(nhe,{selectedDiffPath:k,sidebarFiles:B,diffStats:d?.stats??null,triggerMode:e===`wide`?`full`:`compact`,onSelectDiffPath:e=>{o(t=>({...t,selectedDiffPath:e}))}}),reviewSummaryControl:pe,extraHeaderControl:me,surfaceVariant:`flat`,showViewTypeToggle:!1,gutterVariant:`compact`,isResizing:s,resizePlaceholderLineThreshold:200})})});B8.displayName=`ChatChangesPanel`;var V8=({projectId:e,agentRunParentType:t=null,agentRunParentId:n=null,messages:r,internalLog:i,currentThinkingMessageId:a=null,previousThinkingLog:o=null,previousThinkingMessageId:s=null,pendingAgentTitle:c,streamingResponse:l,isRunning:u,isLoading:d=!1,canShowComposer:f,cardClassName:p,isExternallyResizing:m=!1,pendingAgentRevealKey:h=null,pendingAgentRevealDelayMs:g=0,liveResponseTiming:_=null,composerFocusNonce:v=0,blurComposerOnSendStart:y=!1,hidePendingAgentTitle:b=!1,forceScrollToBottomKey:x,header:S,composerControls:C,composerInlineControls:w,composerTheme:T=`default`,layoutKey:E,scrollLayoutKey:D,followUpPrompt:O,draftAttachments:k=[],followUpPlaceholder:A,emptyStateText:j=null,renderMessageFooter:M,renderMessageBody:N,isSendingFollowUp:P,isComposerSubmitDisabled:F=!1,isUploadingAttachments:I=!1,canAttachImages:L=!1,followUpDisabledReason:R,postBuildCheck:z=null,onFollowUpPromptChange:ee,onFollowUpKeyDown:B,onFollowUpPaste:V,onUploadAttachments:te,onRemoveAttachment:H,onFollowUpSubmit:U})=>(0,X.jsx)(VJ,{projectId:e,agentRunParentType:t,agentRunParentId:n,messages:r,internalLog:i,currentThinkingMessageId:a,previousThinkingLog:o,previousThinkingMessageId:s,pendingAgentTitle:c,streamingResponse:l,isRunning:u,isLoading:d,autoScrollBehavior:`sticky`,surfaceVariant:`chat`,canShowComposer:f,cardClassName:p,header:S,composerControls:C,composerInlineControls:w,composerTheme:T,composerSize:`compact-on-laptop`,showThinkingPlacement:`header`,pinComposerToBottom:!0,isExternallyResizing:m,pendingAgentRevealKey:h,pendingAgentRevealDelayMs:g,liveResponseTiming:_,composerFocusNonce:v,blurComposerOnSendStart:y,forceScrollToBottomKey:x,layoutKey:E,scrollLayoutKey:D,followUpPrompt:O,draftAttachments:k,followUpPlaceholder:A,emptyStateText:j,autoFocusComposer:!0,renderMessageFooter:M,renderMessageBody:N,isSendingFollowUp:P,isComposerSubmitDisabled:F,isUploadingAttachments:I,canAttachImages:L,followUpDisabledReason:R,postBuildCheck:z,hidePendingAgentTitle:b,onFollowUpPromptChange:ee,onFollowUpKeyDown:B,onFollowUpPaste:V,onUploadAttachments:te,onRemoveAttachment:H,onFollowUpSubmit:U}),rhe=`mt-1 flex min-h-5 flex-wrap items-center gap-2 text-xs text-muted-foreground`,ihe=({label:e})=>(0,X.jsx)(`div`,{className:`inline-flex items-center rounded-full border border-amber-500/30 bg-amber-500/10 px-2 py-0.5 text-[11px] font-medium text-amber-100`,children:e}),H8=({title:e,tool:t=null,modelLabel:n=null,interrupted:r=!1,interruptedLabel:i,usage:a=null,metadataExtra:o=null,actions:s=null,warnings:c=null})=>(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`truncate text-sm font-semibold text-foreground`,children:e}),(0,X.jsxs)(`div`,{className:rhe,children:[(0,X.jsx)(jF,{tool:t,className:`text-[11px]`}),n?(0,X.jsx)(`p`,{children:n}):null,r?(0,X.jsx)(ihe,{label:i}):null,a?(0,X.jsx)(MF,{totalTokens:a.totalTokens,contextWindow:a.contextWindow,cost:a.cost,tool:a.tool,model:a.model,availableModels:a.availableModels}):null,o]})]}),s]}),c]}),U8=({projectId:e,suggestions:t,title:n,description:r,emptyState:i=null,onSuggestionsChanged:a})=>(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(n||r)&&(0,X.jsxs)(`div`,{children:[n&&(0,X.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-[0.2em] text-muted-foreground`,children:n}),r&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r})]}),t.length>0?(0,X.jsx)(Qw,{projectId:e,suggestions:t,onChanged:(e,t)=>a?.(e,t)}):i&&(0,X.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/70 px-3 py-4 text-sm text-muted-foreground`,children:i})]}),W8=()=>({selectedDiffPath:`all`,activeReviewTarget:null,editingReviewCommentKey:null,reviewDraftInput:``,reviewComments:[]}),ahe=[{key:`today`,label:`Today`},{key:`yesterday`,label:`Yesterday`},{key:`last_7_days`,label:`Last 7 Days`},{key:`older`,label:`Older`}],ohe=e=>{if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t},G8=e=>e.activity_at??e.last_user_message_at??e.created_at,she=(e,t)=>{let n=G8(e),r=G8(t);return n===r?e.created_at===t.created_at?t.id.localeCompare(e.id):t.created_at.localeCompare(e.created_at):r.localeCompare(n)},K8=e=>[...e].sort(she),che=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),lhe=(e,t=new Date)=>{let n=ohe(G8(e));if(!n)return`older`;let r=che(t),i=new Date(r);i.setDate(i.getDate()-1);let a=new Date(r);return a.setDate(a.getDate()-6),n>=r?`today`:n>=i?`yesterday`:n>=a?`last_7_days`:`older`},q8=(e,t=new Date)=>{let n=new Map;for(let r of K8(e)){let e=lhe(r,t);n.set(e,[...n.get(e)??[],r])}return ahe.flatMap(e=>{let t=n.get(e.key)??[];return t.length===0?[]:[{key:e.key,label:e.label,sessions:t}]})},J8=e=>{let t={...e};return delete t.messages,t.agent_log=null,t.agent_message_id=null,t.previous_agent_log=null,t.previous_agent_message_id=null,t.streaming_response=null,t},Y8=e=>e===`claude`?jb.t(`chatView.tool.claude`):jb.t(`chatView.tool.opencode`),X8=e=>new Map(e.map(e=>[e.id,e.label])),Z8=({availableModelsById:e,model:t})=>t?e.get(t)??t:null,Q8=({modelLabel:e,tool:t})=>e??Y8(t),$8=()=>jb.t(`chatView.user.you`),e5=`archon.chat-draft`,t5=({projectId:e,tool:t,chatSessionId:n})=>n?`${e5}:${e}:session:${n}`:`${e5}:${e}:draft:${t}`,n5=e=>{if(!e)return``;try{return window.localStorage.getItem(e)??``}catch{return``}},r5=({storageKey:e,value:t})=>{if(e)try{if(t){window.localStorage.setItem(e,t);return}window.localStorage.removeItem(e)}catch{}},i5=({activeProject:e,activeProjectBranchState:t,session:n})=>!e||n.target_available===!1?!1:n.target_kind===`bundle`?e.active_target_kind===`bundle`&&!!n.target_bundle_id&&e.active_target_bundle_id===n.target_bundle_id:e.active_target_kind===`bundle`?!1:!t||!n.target_branch_snapshot?!0:t.status!==`ready`||!t.branch?!1:t.branch===n.target_branch_snapshot,a5=({session:e,activeProject:t,activeProjectBranchState:n})=>e.target_kind===`bundle`?e.target_label_snapshot||jb.t(`common:chatView.targets.bundleFallback`):!t||t.active_target_kind===`bundle`||n?.status!==`ready`||!n.branch||!e.target_branch_snapshot||n.branch===e.target_branch_snapshot?null:jb.t(`common:chatView.targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}),o5=e=>e.target_kind===`bundle`?e.target_label_snapshot||jb.t(`common:chatView.targets.bundleFallback`):e.target_branch_snapshot?jb.t(`common:chatView.targets.repoRootWithBranch`,{branch:e.target_branch_snapshot}):jb.t(`common:chatView.targets.repoRoot`),s5=({activeProject:e,activeProjectBranchState:t})=>e?e.active_target_kind===`bundle`?jb.t(`common:chatView.targets.selectedBundleTarget`):t?.branch?jb.t(`common:chatView.targets.repoRootWithBranch`,{branch:t.branch}):jb.t(`common:chatView.targets.repoRoot`):jb.t(`common:chatView.targets.currentTarget`),c5=(e,t)=>jb.t(`chatView.${e}`,t),uhe=1500,dhe=`archon.chat-run-config`,fhe=`archon.chat-changes-panel-layout`,phe=`archon.chat-session-list-layout`,l5=512,u5=360,mhe=.6,hhe=6,d5=`/`,ghe=`Slash`,_he=`NumpadDivide`,vhe=600,f5=4,p5=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):l5;if(!Number.isFinite(t))return Math.max(u5,n);let r=Math.max(u5,Math.round(t*mhe));return Math.max(u5,Math.min(r,n))},yhe=e=>c5(e===`plan`?`mode.plan`:`mode.build`),m5=e=>c5(e===`plan`?`placeholders.plan`:`placeholders.build`),h5=e=>c5(`pendingMemorySuggestions`,{count:e}),bhe=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===d5||e.code===ghe||e.code===_he),g5=({modifierLabel:e,keys:t,ariaHidden:n=!1})=>(0,X.jsxs)(`span`,{"aria-hidden":n,className:`flex items-center gap-0.5 text-[10px] leading-none`,children:[(0,X.jsx)(WY,{"aria-hidden":n,children:e}),t.map(e=>(0,X.jsxs)(`span`,{className:`contents`,children:[(0,X.jsx)(`span`,{children:`+`}),(0,X.jsx)(WY,{"aria-hidden":n,children:e})]},e))]}),xhe=({label:e,modifierLabel:t,keys:n})=>(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(g5,{modifierLabel:t,keys:n,ariaHidden:!0})]}),_5=({projectId:e,tool:t})=>`${dhe}:${e}:${t}`,v5=e=>`${fhe}:${e}`,y5=e=>`${phe}:${e}`,She=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t):[],b5=e=>{if(!e)return{isOpen:!0,width:l5};try{let t=window.localStorage.getItem(v5(e));if(!t)return{isOpen:!0,width:l5};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max(u5,Math.round(n.width)):l5;return{isOpen:n.isOpen!==!1,width:r}}catch{return{isOpen:!0,width:l5}}},x5=e=>{if(!e)return{isOpen:!0};try{let t=window.localStorage.getItem(y5(e));return t?{isOpen:JSON.parse(t).isOpen!==!1}:{isOpen:!0}}catch{return{isOpen:!0}}},Che=({projectId:e,isOpen:t,width:n})=>{if(e)try{window.localStorage.setItem(v5(e),JSON.stringify({isOpen:t,width:n}))}catch{}},whe=({projectId:e,isOpen:t})=>{if(e)try{window.localStorage.setItem(y5(e),JSON.stringify({isOpen:t}))}catch{}},S5=({projectId:e,tool:t})=>{if(!e||t!==`opencode`&&t!==`claude`)return null;try{let n=window.localStorage.getItem(_5({projectId:e,tool:t}));if(!n)return null;let r=JSON.parse(n),i=(typeof r.model==`string`?r.model.trim():``)||null,a=r.mode===`plan`||r.mode===`build`?r.mode:null;return!i&&!a?null:{model:i,variant:i&&typeof r.variant==`string`&&r.variant.trim()||null,mode:a,skills:She(r.skills)}}catch{return null}},C5=({projectId:e,tool:t,model:n,variant:r,mode:i,skills:a})=>{if(!(!e||t!==`opencode`&&t!==`claude`||!n&&!i))try{window.localStorage.setItem(_5({projectId:e,tool:t}),JSON.stringify({model:n,variant:n?r:null,mode:i,skills:a}))}catch{}},The=({projectId:e,tool:t})=>{let n=S5({projectId:e,tool:t});!n||n.skills.length===0||C5({projectId:e,tool:t,...n,skills:[]})},w5=({projectId:e,tool:t})=>S5({projectId:e,tool:t})?.mode??`plan`,T5=({activeProjectId:e,helperModel:t,helperVariant:n,activeTool:r,availableModels:i,availableSkills:a})=>{let o=S5({projectId:e,tool:r}),s=t??``,c=o?.model??``,l=xF(c,i)?c:xF(s,i)?s:``,u=l===c?o?.variant??null:l&&l===s?n??null:null,d=i.find(e=>e.id===l)??null,f=d?d.variants.includes(u??``)?u??``:``:l?u??``:``,p=new Set(a.map(e=>e.name));return{model:l,variant:f,mode:o?.mode??`plan`,skills:r===`opencode`?(o?.skills??[]).filter(e=>p.has(e)):[]}},E5=e=>e&&e.replace(/\s+/g,` `).trim()||null,Ehe=e=>{let t=E5(e.first_user_message_preview);if(t)return t;let n=e.messages?.find(e=>e.role===`user`)?.content;return E5(n)},Dhe=({chatSessionId:e,instruction:t,attachments:n,createdAt:r})=>({id:`optimistic:${e}:${r}`,chat_session_id:e,role:`user`,kind:`prompt`,content:t,attachments:n,created_at:r}),Ohe=({session:e,instruction:t,attachments:n,createdAt:r})=>({...e,messages:[...e.messages??[],Dhe({chatSessionId:e.id,instruction:t,attachments:n,createdAt:r})],activity_at:r,last_user_message_at:r,updated_at:r}),khe=e=>!!(e.first_user_message_preview||e.last_user_message_at||e.messages?.some(e=>e.role===`user`)),D5=e=>e.agent_status===`running`?c5(`sidebar.deleteDisabledReason`):null,Ahe=({proposals:e,isApplying:t,onApply:n})=>e.status===`applied`?(0,X.jsxs)(`div`,{className:`w-full rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-3 text-sm`,children:[(0,X.jsx)(`div`,{className:`font-medium text-foreground`,children:c5(`ticketProposal.createdTitle`)}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:c5(`ticketProposal.createdDescription`,{count:e.created_tickets.length})}),e.created_tickets.length>0?(0,X.jsx)(`ul`,{className:`mt-3 space-y-1 text-foreground`,children:e.created_tickets.map(e=>(0,X.jsx)(`li`,{children:e.title},e.ticket_id))}):null]}):(0,X.jsxs)(`div`,{className:`w-full rounded-md border border-sky-500/30 bg-sky-500/10 px-3 py-3 text-sm`,children:[(0,X.jsx)(`div`,{className:`font-medium text-foreground`,children:c5(`ticketProposal.proposedTitle`)}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:c5(`ticketProposal.proposedDescription`)}),(0,X.jsx)(`ul`,{className:`mt-3 space-y-3`,children:e.tickets.map(e=>(0,X.jsxs)(`li`,{className:`rounded border border-border/60 bg-background/80 px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-medium text-foreground`,children:e.title}),(0,X.jsx)(`div`,{className:`mt-1 whitespace-pre-wrap text-muted-foreground`,children:e.description})]},e.key))}),e.dependencies.length>0?(0,X.jsx)(`div`,{className:`mt-3 text-muted-foreground`,children:c5(`ticketProposal.dependenciesLabel`,{value:e.dependencies.map(e=>`${e.blocker_key} -> ${e.dependent_key}`).join(`, `)})}):null,(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(Q,{type:`button`,size:`sm`,onClick:n,disabled:t,children:c5(t?`ticketProposal.creating`:`ticketProposal.create`)})})]}),jhe=({activeProjectId:e,activeProject:t,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c=async()=>!1,onSelectRepoRootTarget:l=async()=>!1,activeTool:u,routedChatSessionId:d,onRoutedChatNavigationUnavailable:f,onSessionNavigation:m,initialDraftOpen:h=!1,onInitialDraftOpenConsumed:g,initialSpecDraft:_=null,onInitialSpecDraftConsumed:v,onViewSourceSpec:y,onNavigateToLifecycleSource:b,onRestoreSessionTarget:x,onReviewCapabilityChange:S,isExternallyResizing:C=!1,showChangesPanel:w=!0})=>{let T=lq(),[E,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(null),[A,j]=(0,p.useState)(null),M=pF(A?.post_build_check),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(null),[z,ee]=(0,p.useState)(()=>w5({projectId:e,tool:u})),[B,V]=(0,p.useState)({}),[te,H]=(0,p.useState)({}),[U,ne]=(0,p.useState)({}),[re,ie]=(0,p.useState)([]),[ae,oe]=(0,p.useState)(``),[W,se]=(0,p.useState)(``),[ce,le]=(0,p.useState)([]),[ue,de]=(0,p.useState)(!1),[fe,pe]=(0,p.useState)(!1),[me,he]=(0,p.useState)(!1),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(!1),[be,xe]=(0,p.useState)(null),[Se,Ce]=(0,p.useState)(null),[we,Te]=(0,p.useState)([]),[Ee,De]=(0,p.useState)(()=>new Set),[Oe,ke]=(0,p.useState)(!1),[Ae,je]=(0,p.useState)(()=>new Set),[Me,Ne]=(0,p.useState)(!1),[Pe,Fe]=(0,p.useState)(!1),[Ie,Le]=(0,p.useState)(null),[Re,ze]=(0,p.useState)(null),[G,Be]=(0,p.useState)([]),[Ve,He]=(0,p.useState)(!1),[Ue,K]=(0,p.useState)(!1),[We,Ge]=(0,p.useState)(0),[q,Je]=(0,p.useState)(W8),[J,Xe]=(0,p.useState)(()=>x5(e).isOpen),[Ze,Y]=(0,p.useState)(()=>b5(e).isOpen),[Qe,$e]=(0,p.useState)(!1),[et,tt]=(0,p.useState)(!1),[nt,rt]=(0,p.useState)(()=>b5(e).width),[it,at]=(0,p.useState)(0),[ot,st]=(0,p.useState)(null),[ct,lt]=(0,p.useState)(()=>new Set),ut=(0,p.useRef)({model:``,variant:``,skills:[],showModelSelector:!1}),dt=(0,p.useRef)(!1),ft=(0,p.useRef)(e),pt=(0,p.useRef)(L),mt=(0,p.useRef)(null),ht=(0,p.useRef)(null),gt=(0,p.useRef)(new Set),_t=(0,p.useRef)(0),vt=(0,p.useRef)(0),yt=(0,p.useRef)(d),bt=(0,p.useRef)(!1),xt=(0,p.useRef)(null),St=(0,p.useRef)(null),Ct=(0,p.useRef)(null),wt=(0,p.useRef)(null),Tt=(0,p.useRef)(null),Et=(0,p.useRef)(null),Dt=(0,p.useRef)(!1),Ot=(0,p.useRef)(!1),kt=(0,p.useRef)(0),At=(0,p.useRef)(l5),jt=(0,p.useRef)(l5),Mt=(0,p.useRef)(!1),Nt=(0,p.useRef)(0),Pt=(0,p.useRef)({id:null,status:null}),Ft=(0,p.useRef)(new Map),It=(0,p.useRef)({}),Lt=(0,p.useRef)({}),Rt=(0,p.useRef)(new Set),zt=(0,p.useRef)(!1),Bt=e?t5({projectId:e,tool:F?u:A?.tool??u,chatSessionId:F?null:O}):null,Vt=Bt?B[Bt]??``:``,Ht=F?u:A?.tool??u,Ut=A?te[A.id]??[]:[],Wt=(A?U[A.id]??0:0)>0;ft.current=e;let{models:Gt,isLoading:Kt}=ZP(Ht),qt=(0,p.useCallback)(()=>{le([]),The({projectId:e,tool:u})},[e,u]);(0,p.useEffect)(()=>{dt.current=F},[F]),(0,p.useEffect)(()=>{It.current=B},[B]),(0,p.useEffect)(()=>{Lt.current=te},[te]),yt.current=d,(0,p.useEffect)(()=>{if(!(d===void 0||!fe)){if(!d){dt.current||qt(),P(null),xe(null),k(null),j(null),I(!0);return}if(!(E.some(e=>e.id===d)||A?.id===d)){k(null),j(null),I(!1),f?.();return}O!==d&&(P(null),xe(null),k(d),j(null),I(!1),Mt.current=!0)}},[A?.id,O,fe,f,qt,d,E]),(0,p.useEffect)(()=>{if(!Bt||Rt.current.has(Bt))return;Rt.current.add(Bt);let e=n5(Bt);e&&V(t=>Object.prototype.hasOwnProperty.call(t,Bt)?t:{...t,[Bt]:e})},[Bt]),(0,p.useEffect)(()=>{!Bt||!Object.prototype.hasOwnProperty.call(B,Bt)||r5({storageKey:Bt,value:B[Bt]??``})},[Bt,B]),(0,p.useEffect)(()=>{if(!F){mt.current=null;return}let e=mt.current;!e||!Bt||Vt||V(t=>t[Bt]?t:{...t,[Bt]:e})},[F,Bt,Vt]),(0,p.useEffect)(()=>{ht.current=O},[O]),(0,p.useEffect)(()=>{pt.current=L},[L]);let Jt=(0,p.useCallback)(()=>{vt.current+=1},[]),Yt=(0,p.useCallback)(e=>{Jt(),j(e)},[Jt]);(0,p.useEffect)(()=>{if(!zt.current){zt.current=!0;return}let t=b5(e),n=x5(e);dt.current=!1,Mt.current=!1,Rt.current=new Set,gt.current.clear(),k(null),Yt(null),I(!1),V({}),H({}),ne({}),xe(null),Te([]),De(new Set),ke(!1),je(new Set),st(null),Be([]),K(!1),pe(!1),Je(W8()),lt(new Set),Ft.current=new Map,jt.current=t.width,Xe(n.isOpen),rt(t.width),Y(t.isOpen)},[e,Yt]),(0,p.useEffect)(()=>{Qe||(jt.current=nt,Ct.current&&(Ct.current.style.setProperty(`--chat-changes-panel-width`,`${nt}px`),Ct.current.setAttribute(`data-desktop-width`,String(nt))))},[nt,Qe]),(0,p.useEffect)(()=>{if(!w||!xt.current)return;let e=xt.current.getBoundingClientRect().width;if(e<=0)return;let t=p5(nt,e);t!==nt&&(jt.current=t,rt(t))},[nt,w]),(0,p.useEffect)(()=>{whe({projectId:e,isOpen:J})},[e,J]),(0,p.useEffect)(()=>{w&&Che({projectId:e,isOpen:Ze,width:nt})},[e,nt,Ze,w]),(0,p.useEffect)(()=>{K(!1)},[O,F]);let Xt=(0,p.useCallback)(e=>{let t=J8(e);D(e=>{let n=e.findIndex(e=>e.id===t.id);if(n===-1)return K8([...e,t]);let r=[...e];return r[n]=t,K8(r)})},[]),Zt=(0,p.useCallback)((t,n={})=>{let r=Array.from(new Set(t));if(r.length===0)return;let i=new Set(r),a=ht.current,o=n.preserveDraftRoute===!0,s=!!(o&&a&&i.has(a)&&yt.current===a),c=!!(!o&&a&&i.has(a)),l=c?E.find(e=>!i.has(e.id))??null:null;s&&(qt(),m?.(null)),c&&(l||qt(),m?.(l?.id??null));let d=e?r.map(t=>t5({projectId:e,tool:u,chatSessionId:t})):[];V(e=>{let t=d.filter(t=>Object.prototype.hasOwnProperty.call(e,t));if(t.length===0)return e;let n={...e};for(let e of t)delete n[e];return n}),H(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e}),ne(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e});for(let e of d)r5({storageKey:e,value:``});D(e=>{let t=e.filter(e=>!i.has(e.id));if(a&&i.has(a)){if(yt.current===a)return o?(k(null),Yt(null),I(!0),t):(k(null),Yt(null),I(l===null),Be([]),He(!1),K(!1),t);let e=t[0]??null;k(e?.id??null),Yt(null),I(e===null),Be([]),He(!1),K(!1)}return t}),lt(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),st(e=>e&&i.has(e.parentId)?null:e),xe(e=>e&&i.has(e)?null:e),Te(e=>e.filter(e=>!i.has(e))),De(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),je(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e})},[e,u,m,Yt,qt,E]),Qt=(0,p.useCallback)((e,t)=>{Zt([e],t)},[Zt]),$t=(0,p.useCallback)((e,t)=>{e&&V(n=>n[e]===t?n:{...n,[e]:t})},[]),en=(0,p.useCallback)(e=>{e&&(V(t=>t[e]===``?t:{...t,[e]:``}),r5({storageKey:e,value:``}))},[]),tn=(0,p.useCallback)((e,t)=>{H(n=>{if(t.length===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:t}})},[]),nn=(0,p.useCallback)(e=>{H(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),ne(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),rn=(0,p.useCallback)((e,t)=>{ne(n=>{let r=Math.max(0,(n[e]??0)+t);if(r===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:r}})},[]),an=(0,p.useCallback)(({fromStorageKey:e,toStorageKey:t})=>{if(!e||!t||e===t)return;let n=Object.prototype.hasOwnProperty.call(It.current,e)?It.current[e]??``:n5(e);V(r=>{let i={...r,[t]:n};return delete i[e],i}),r5({storageKey:t,value:n}),r5({storageKey:e,value:``})},[]),on=(0,p.useCallback)((e,t)=>{D(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n[r];if(i.pending_memory_suggestion_count===t)return n;let a=[...n];return a[r]={...i,pending_memory_suggestion_count:t},a}),j(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:(vt.current+=1,{...n,pending_memory_suggestion_count:t}))},[]),sn=(0,p.useCallback)(async r=>{if(!e){D([]),k(null),Yt(null),I(!1),pe(!1);return}de(!0);try{let i=await CM(e,r);if(r?.aborted)return;let a=K8(i.map(J8)),o=a[0]??null,s=t?.active_target_kind===`bundle`||n?.status!==`loading`;D(a),pe(!0),k(e=>d===void 0?dt.current?null:e&&a.some(t=>t.id===e)?e:e?a[0]?.id??null:Mt.current?null:o?s?(Mt.current=!0,i5({activeProject:t,activeProjectBranchState:n,session:o})?o.id:null):null:(Mt.current=!0,null):e),a.length===0&&!d&&!dt.current&&(qt(),I(!0))}catch(e){Ye(e)||$.error(e instanceof Error?e.message:c5(`errors.loadSessions`))}finally{r?.aborted||de(!1)}},[t,n,e,qt,Yt,d]),cn=(0,p.useCallback)(async(t,n)=>{if(!e){Yt(null);return}he(!0);let r=_t.current+1;_t.current=r;let i=vt.current;try{let a=await TM(e,t,n);if(n?.aborted)return;let o=vt.current!==i,s=_t.current===r,c=ht.current===t&&!dt.current;if(!s||o||!c)return;Yt(a),Xt(a)}catch(e){e instanceof Ke&&e.status===404&&yt.current===t&&ht.current===t?f?.():Ye(e)||$.error(e instanceof Error?e.message:c5(`errors.loadSession`))}finally{n?.aborted||he(!1)}},[e,f,Yt,Xt]),ln=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){Be([]),He(!1);return}He(!0);try{let t=await jr(e,null,r,n);if(r?.aborted)return;Be(t.suggestions),on(n,t.suggestions.length)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:c5(`errors.loadMemorySuggestions`))}finally{r?.aborted||He(!1)}},[t?.memory_enabled,e,on]),un=(0,p.useCallback)(e=>{Be(t=>{let n=t.filter(t=>t.id!==e);return O&&on(O,n.length),n}),Ge(e=>e+1),sn(),O&&cn(O)},[O,cn,sn,on]);(0,p.useEffect)(()=>{let e=new AbortController;return sn(e.signal),()=>{e.abort()}},[sn]),(0,p.useEffect)(()=>{if(d!==void 0||dt.current||F||O||Mt.current||E.length===0||t?.active_target_kind!==`bundle`&&n?.status===`loading`)return;Mt.current=!0;let e=E[0]??null;e&&i5({activeProject:t,activeProjectBranchState:n,session:e})&&k(e.id)},[t,n,O,F,d,E]),(0,p.useEffect)(()=>{if(Ht!==`opencode`&&Ht!==`claude`){ie([]),Fe(!1);return}if(Ht!==`opencode`){ie([]);return}let t=new AbortController;return(async()=>{Fe(!0);try{ie(await QP(Ht,t.signal,e))}catch(e){Ye(e)||ie(e=>e)}finally{t.signal.aborted||Fe(!1)}})(),()=>{t.abort()}},[e,Ht]),(0,p.useEffect)(()=>{if(F||!O){Yt(null);return}if(A?.id===O)return;Yt(null);let e=new AbortController;return cn(O,e.signal),()=>{e.abort()}},[A,O,F,cn,Yt]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||F||!O){Be([]),He(!1);return}let e=new AbortController;return ln(O,e.signal),()=>{e.abort()}},[t?.memory_enabled,O,F,ln,We]),(0,p.useEffect)(()=>{!Ue||Ve||G.length>0||K(!1)},[Ve,Ue,G.length]),(0,p.useEffect)(()=>{if(!O||A?.agent_status!==`running`)return;let e=new AbortController,t=window.setInterval(()=>{Promise.all([sn(e.signal),cn(O,e.signal)])},uhe);return()=>{e.abort(),window.clearInterval(t)}},[A?.agent_status,O,cn,sn]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||(t.id===O&&Yt(t),khe(t)&&Xt(t))},n=t=>{if(!t||t.project_id!==e)return;let n=gt.current.delete(t.id);Qt(t.id,n?{preserveDraftRoute:!0}:void 0)},r=()=>{sn();let e=ht.current;e&&!dt.current&&cn(e)};return T.on(`connect`,r),T.on(`chat-session:created`,t),T.on(`chat-session:updated`,t),T.on(`chat-session:deleted`,n),()=>{T.off(`connect`,r),T.off(`chat-session:created`,t),T.off(`chat-session:updated`,t),T.off(`chat-session:deleted`,n)}},[e,O,cn,sn,Qt,Yt,T,Xt]),(0,p.useEffect)(()=>{F&&(pt.current||ee(w5({projectId:e,tool:u})))},[e,u,F]),(0,p.useEffect)(()=>{if(Ht!==`opencode`&&Ht!==`claude`){oe(``),se(``),le([]);return}if(F){let n=vw(t?.helper_models,Ht),r=T5({activeProjectId:e,helperModel:n.model??(Ht===`opencode`?t?.helper_model:null)??null,helperVariant:n.variant??(Ht===`opencode`?t?.helper_variant:null)??null,activeTool:Ht,availableModels:Gt,availableSkills:re});oe(r.model),se(r.variant),le(r.skills);return}oe(A?.model??``),se(A?.variant??``)},[e,t?.helper_model,t?.helper_models,t?.helper_variant,A?.id,A?.model,A?.variant,Gt,re,Ht,F]),(0,p.useEffect)(()=>{if(Ht!==`opencode`){le([]);return}F||le(A?.skills??[])},[A?.skills,Ht,F]),(0,p.useEffect)(()=>{let e=Gt.find(e=>e.id===ae)??null;se(t=>e?e.variants.includes(t)?t:``:t)},[Gt,ae]),(0,p.useEffect)(()=>{if(Ht!==`opencode`||!F||!ae||W)return;let n=vw(t?.helper_models,Ht),r=T5({activeProjectId:e,helperModel:n.model??(Ht===`opencode`?t?.helper_model:null)??null,helperVariant:n.variant??(Ht===`opencode`?t?.helper_variant:null)??null,activeTool:Ht,availableModels:Gt,availableSkills:re});r.model===ae&&r.variant&&se(r.variant)},[e,t?.helper_model,t?.helper_models,t?.helper_variant,Ht,Gt,re,F,ae,W]),(0,p.useEffect)(()=>{if(!be)return;let e=A?.id===be?A:E.find(e=>e.id===be)??null;(!e||e.agent_status!==`running`)&&xe(null)},[A,be,E]),(0,p.useEffect)(()=>{let e=Pt.current,n=A?.id??null,r=A?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&Ge(e=>e+1),Pt.current={id:n,status:r}},[t?.memory_enabled,e,A?.agent_status,A?.id,A?.title]),(0,p.useEffect)(()=>{O&<(e=>{if(!e.has(O))return e;let t=new Set(e);return t.delete(O),t})},[O]),(0,p.useEffect)(()=>{ot&&(ot.parentId===O&&(ve||Se===O||A?.agent_status===`running`)||st(null))},[A?.agent_status,O,ve,ot,Se]),(0,p.useEffect)(()=>{let e=Ft.current,t=new Map,n=[];for(let r of E){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&a===`done`&&r.id!==O&&n.push(r),t.set(r.id,a)}Ft.current=t,lt(e=>{let t=new Set(e),r=!1,i=new Set(E.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of E){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===O||i!==`done`)&&t.delete(e.id)){r=!0;continue}a&&!t.has(e.id)&&(t.add(e.id),r=!0)}return r?t:e})},[e,O,E]);let dn=(0,p.useMemo)(()=>X8(Gt),[Gt]),fn=(0,p.useMemo)(()=>q8(E),[E]),pn=(0,p.useMemo)(()=>{let e=new Set(fn.find(e=>e.key===`older`)?.sessions.map(e=>e.id)??[]);return[{key:`unavailable`,label:c5(`sidebar.presets.unavailable`),matches:e=>e.target_available===!1},{key:`older`,label:c5(`sidebar.presets.older`),matches:t=>e.has(t.id)}]},[fn]),mn=(0,p.useMemo)(()=>we.length===0?[]:we.flatMap(e=>{let t=E.find(t=>t.id===e)??(A?.id===e?A:null);return t?[t]:[]}),[A,we,E]),hn=mn.length===1?mn[0]?.title??null:null;(0,p.useEffect)(()=>{we.length>0&&mn.length!==we.length&&Te(mn.map(e=>e.id))},[we,mn]),(0,p.useEffect)(()=>{let e=new Set(E.filter(e=>!D5(e)&&!Ee.has(e.id)).map(e=>e.id));je(t=>{let n=new Set(Array.from(t).filter(t=>e.has(t)));return n.size===t.size?t:n})},[Ee,E]),(0,p.useEffect)(()=>{!Oe||J||(ke(!1),je(new Set))},[J,Oe]);let gn=(0,p.useMemo)(()=>A?Q8({modelLabel:Z8({availableModelsById:dn,model:A.model}),tool:A.tool}):null,[A,dn]),_n=(0,p.useMemo)(()=>A?(A.messages??[]).map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,attachments:e.attachments??[],ticket_proposals:e.ticket_proposals??null,transcript_runs:e.transcript_runs??null,metadata:e.metadata,responseTiming:e.response_timing?GK(e.response_timing):null,created_at:e.created_at,displayTitle:e.role===`assistant`?gn??Y8(A.tool):$8()})):[],[A,gn]),vn=(0,p.useMemo)(()=>[...A?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[A]),yn=!!vn,bn=(0,p.useCallback)(async(t,n)=>{if(!e||!A||Re)return;let r=WJ({parentType:`chat`,parentId:A.id,setId:n.set_id});ze(n.set_id);try{let r=await kM(e,A.id,t,n);Yt(r),Xt(r)}catch(e){if(e instanceof Ke&&e.status===409){KJ(r);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?(Yt(t),Xt(t)):await cn(A.id)}throw $.error(e instanceof Error?e.message:c5(`errors.resolveQuestions`)),e}finally{ze(null)}},[e,A,cn,Yt,Re,Xt]),xn=(0,p.useCallback)(e=>{let t=e.metadata?.ask_question;if(e.role!==`assistant`||!t||!A)return;let n=WJ({parentType:`chat`,parentId:A.id,setId:t.id});return(0,X.jsx)($J,{messageContent:e.content,questionSet:t,storageKey:n,isActive:t.status===`pending`&&vn?.id===e.id,isDisabled:A.agent_status===`running`||Re===t.id,onResolve:t=>bn(e.id,t)})},[A,vn?.id,bn,Re]),Sn=A?.id&&A.agent_status===`running`&&ot?.parentId===A.id?ot.turnKey:null,Cn=(Ht===`opencode`||Ht===`claude`)&&Gt.length>0,wn=(Ht===`opencode`||Ht===`claude`)&&!Cn&&(Pe||Kt);(0,p.useEffect)(()=>{ut.current={model:ae,variant:W,skills:ce,showModelSelector:Cn}},[ae,ce,W,Cn]);let Tn=(0,p.useMemo)(()=>Gt.find(e=>e.id===ae)??null,[Gt,ae]),En=F?z:A?.mode??`build`,Dn=F?c5(`composer.newChatTitle`):A?.title??c5(`composer.chatTitle`),On=F?u:A?.tool??u,kn=(0,p.useMemo)(()=>YY(),[]),An=Cn?ae||null:A?.model??null,jn=On===`opencode`||On===`claude`,Mn=Z8({availableModelsById:dn,model:An}),Nn=F?`draft:${e??`none`}:${u}`:A?.id,Pn=(0,p.useCallback)(({model:t=ae,variant:n=W,skills:r=ce}={})=>{F&&C5({projectId:e,tool:u,model:Cn&&t||null,variant:Cn&&t&&n||null,mode:z,skills:Cn&&u===`opencode`?r:[]})},[e,u,z,F,ae,ce,W,Cn]),Fn=(0,p.useCallback)(()=>{dt.current=!0,ht.current=null,I(!0),qt(),ee(w5({projectId:e,tool:u})),P(null),k(null),Yt(null),xe(null),ke(!1),je(new Set),st(null),R(null),mt.current=null,m?.(null)},[e,u,m,Yt,qt]);(0,p.useEffect)(()=>{_&&(Fn(),ee(`build`),R({specSessionId:_.specSessionId,specSnapshotId:_.specSnapshotId}),mt.current=_.text,v?.())},[_,Fn,v]),(0,p.useEffect)(()=>{h&&(Fn(),g?.())},[h,Fn,g]);let In=(0,p.useCallback)((e,t=null)=>{dt.current=!1,ht.current=e,I(!1),P(null),k(e),Yt(t),R(null),m?.(e)},[m,Yt]),Ln=(0,p.useCallback)(async()=>{if(!(!A||!x)){P(A.id);try{await x(A)}catch(e){$.error(e instanceof Error?e.message:c5(`errors.restoreTarget`))}finally{P(e=>e===A.id?null:e)}}},[A,x]),Rn=!!(A&&A.target_available!==!1&&!F&&!i5({activeProject:t,activeProjectBranchState:n,session:A})),zn=Rn&&A?c5(`review.mismatchReason`,{sessionTarget:o5(A),currentTarget:s5({activeProject:t,activeProjectBranchState:n})}):null,Bn=N!==null,Vn=Rn&&N===null,Hn=(0,p.useCallback)(async r=>{P(r.id);let i=r;if(e)try{let t=await TM(e,r.id);i=t,Xt(t)}catch(e){$.error(e instanceof Error?e.message:c5(`errors.loadSession`)),P(e=>e===r.id?null:e);return}if(i.target_available===!1){In(i.id,i);return}if(!i5({activeProject:t,activeProjectBranchState:n,session:i})&&x)try{if(!await x(i)){P(e=>e===i.id?null:e);return}}catch(e){$.error(e instanceof Error?e.message:c5(`errors.restoreTarget`)),P(e=>e===i.id?null:e);return}In(i.id,i)},[t,n,e,x,In,Xt]),Un=(0,p.useCallback)(()=>{at(e=>e+1)},[]),Wn=(0,p.useCallback)(async t=>{if(F){let n=ut.current;return ee(t),C5({projectId:e,tool:u,model:n.showModelSelector&&n.model||null,variant:n.showModelSelector&&n.model&&n.variant||null,mode:t,skills:n.showModelSelector?n.skills:[]}),Un(),null}if(!e||!A||A.mode===t||Me||yn)return null;Ne(!0);try{let n=await DM(e,A.id,{mode:t});return C5({projectId:e,tool:n.tool,model:n.model,variant:n.variant,mode:n.mode,skills:n.skills}),Yt(n),Xt(n),Un(),n}catch(e){return $.error(e instanceof Error?e.message:c5(`errors.updateMode`)),null}finally{Ne(!1)}},[e,A,u,Un,yn,F,Me,Yt,Xt]),Gn=(0,p.useCallback)(async({instruction:t,attachments:n,targetSession:r,startedAt:i})=>{if(!e)return null;let a=ut.current;Nt.current+=1;let o={parentType:`chat`,parentId:r.id,turnKey:`${r.id}:${Nt.current}`,startedAt:i};st(o);try{let i=await OM(e,r.id,{instruction:t,...n.length>0?{attachment_ids:n.map(e=>e.id)}:{},tool:r.tool,model:a.showModelSelector&&a.model||null,variant:a.showModelSelector&&a.model&&a.variant||null,skills:a.showModelSelector?a.skills:[]});return C5({projectId:e,tool:i.tool,model:i.model,variant:i.variant,mode:i.mode,skills:i.skills}),dt.current=!1,Yt(i),k(i.id),I(!1),Xt(i),i}catch(e){throw st(e=>e?.turnKey===o.turnKey?null:e),e}},[e,Yt,Xt]),Kn=(0,p.useCallback)(async({fromStorageKey:t})=>{if(!e)return null;let n=ut.current,r=pt.current,i=await wM(e,{mode:En,tool:u,model:n.showModelSelector&&n.model||null,variant:n.showModelSelector&&n.model&&n.variant||null,skills:n.showModelSelector?n.skills:[],originSpecSessionId:r?.specSessionId??null,originSpecSnapshotId:r?.specSnapshotId??null});dt.current=!1,I(!1),k(i.id),Yt(i),m?.(i.id),R(null);let a=t5({projectId:e,tool:i.tool,chatSessionId:i.id});return an({fromStorageKey:t,toStorageKey:a}),{session:i,storageKey:a}},[e,u,En,an,m,Yt]),qn=(0,p.useCallback)(async(t,n={})=>{let r=n.targetSession??A,i=!r||r.messages?.length===0;if(!e||ve||ge||Wt||r?.agent_status===`running`||pF(r?.post_build_check)||r?.target_available===!1||Vn||yn)return!1;let a=t.trim(),o=n.preserveComposerDraft===!0,s=o?[]:r?Lt.current[r.id]??[]:[];if(!a&&s.length===0)return!1;ye(!0);let c=null,l=r,u=performance.now(),d=e&&r?t5({projectId:e,tool:r.tool,chatSessionId:r.id}):null,f=s;try{let t=r;if(!t){_e(!0);let e=await Kn({fromStorageKey:Bt});c=e?.session??null,t=c,d=e?.storageKey??null,f=c?Lt.current[c.id]??[]:[]}if(!t)return!1;o||en(d??Bt);let n=Ohe({session:t,instruction:a,attachments:f,createdAt:new Date().toISOString()});Yt(n),k(n.id),Xt(n);let s=await Gn({instruction:a,attachments:f,targetSession:t,startedAt:u});return s&&i&&C5({projectId:e,tool:s.tool,model:s.model,variant:s.variant,mode:s.mode,skills:[]}),o||en(s&&e?t5({projectId:e,tool:s.tool,chatSessionId:s.id}):d),s&&!o&&nn(s.id),!0}catch(e){o||$t(d??Bt,a);let t=qe(e,`chat_session`);if(t?(dt.current=!1,Yt(t),k(t.id),I(!1),Xt(t)):c?(Yt(c),k(c.id),I(!1),Xt(c)):l&&(Yt(l),Xt(l)),e instanceof Ke&&e.status===409&&!t){let e=c?.id??l?.id;e&&await cn(e)}throw e}finally{_e(!1),ye(!1)}},[e,A,nn,en,Kn,Bt,yn,ge,ve,Wt,cn,Yt,Gn,$t,Vn,Xt]),Jn=(0,p.useCallback)(async()=>{if(!(!A||!qY(A,yn)||bt.current)){bt.current=!0;try{let e=await Wn(`build`);if(!e)return;await qn(KY,{preserveComposerDraft:!0,targetSession:e})}catch(e){$.error(e instanceof Error?e.message:c5(`errors.sendPrompt`))}finally{bt.current=!1}}},[A,Wn,yn,qn]),Yn=(0,p.useCallback)(e=>{dt.current=!0,I(!0),qt(),ee(e),P(null),k(null),Yt(null),xe(null),st(null)},[Yt,qt]),Xn=(0,p.useCallback)(async t=>{if(e){gt.current.add(t.id);try{await PM(e,t.id),Qt(t.id,{preserveDraftRoute:!0}),Yn(t.mode)}catch(e){throw gt.current.delete(t.id),e}}},[e,Yn,Qt]),Zn=(0,p.useCallback)(async t=>{if(!e||t.length===0||Ht!==`opencode`&&Ht!==`claude`)return;let n=t.slice(0,f5);if(n.length===0)return;let r=null,i=A;try{if(i||=(_e(!0),r=await Kn({fromStorageKey:Bt}),r?.session??null),!i)return;if((Lt.current[i.id]??[]).length+n.length>f5){$.error(`You can attach up to 4 images per turn.`);return}rn(i.id,1);let t=await AM(e,i.id,n),a=Lt.current[i.id]??[];tn(i.id,[...a,...t.attachments])}catch(e){if(r&&!Vt.trim())try{await Xn(r.session)}catch{}$.error(e instanceof Error?e.message:c5(`errors.uploadAttachments`))}finally{i&&rn(i.id,-1),_e(!1)}},[e,A,Kn,Xn,Vt,Bt,rn,tn,Ht]),Qn=(0,p.useCallback)(async t=>{if(!e||!A)return;let n=(Lt.current[A.id]??[]).filter(e=>e.id!==t);try{await jM(e,A.id,t),tn(A.id,n),n.length===0&&!Vt.trim()&&(A.messages?.length??0)===0&&await Xn(A)}catch(e){$.error(e instanceof Error?e.message:c5(`errors.removeAttachment`))}},[e,A,Xn,Vt,tn]),$n=(0,p.useCallback)(e=>{if(Ht!==`opencode`&&Ht!==`claude`)return;let t=Array.from(e.clipboardData.items).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),Zn(t))},[Ht,Zn]),er=(0,p.useCallback)(async e=>{await qn(e)},[qn]),tr=!!(e&&(F||A&&A.target_available!==!1&&!Vn)),nr=A?.agent_status===`running`,rr=A?.agent_status===`stopped`,ir=nr&&be===A?.id,ar=rr&&A?.can_resume===!0,or=ar&&Se===A?.id,sr=or||ve||ge||Wt||yn||M||A?.target_available===!1||Bn||Vn,cr=tr&&!yn&&!nr&&!M&&!ve&&!ge&&!Wt,lr=tr?A?.target_available===!1?A.target_unavailable_reason??c5(`review.unavailableTarget`):Vn?zn??c5(`review.restoreTargetFallback`):yn?jb.t(`common:questionSet.waitForResolution`):nr?c5(`review.waitTurn`):M?jb.t(`common:postBuildChecks.blockedReason`):Wt?c5(`review.waitUpload`):ge||ve?c5(`review.waitPrompt`):null:c5(`review.missingTarget`),ur=(0,p.useCallback)(async()=>{if(!(!e||!A||A.agent_status!==`running`||ir)){xe(A.id);try{await MM(e,A.id)}catch(e){xe(e=>e===A.id?null:e),$.error(e instanceof Error?e.message:c5(`errors.interruptResponse`))}}},[e,A,ir]),dr=(0,p.useCallback)(async()=>{if(!e||!A||A.agent_status!==`stopped`||!A.can_resume||Se===A.id||Bn)return;let t=A.id,n=e,r=vt.current,i=performance.now();Ce(t);let a=NM(e,t,c5(`errors.resumeResponse`));Nt.current+=1;let o={parentType:`chat`,parentId:t,turnKey:`${t}:${Nt.current}`,startedAt:i};st(o);try{let e=await a;ft.current===n&&vt.current===r&&(Xt(e),ht.current===t&&!dt.current&&Yt(e))}catch(e){st(e=>e?.turnKey===o.turnKey?null:e);let i=qe(e,`chat_session`);i&&ft.current===n&&vt.current===r?(Xt(i),ht.current===t&&!dt.current&&Yt(i)):!i&&e instanceof Ke&&e.status===409&&ft.current===n&&ht.current===t&&!dt.current&&await cn(t),Ye(e)||$.error(e instanceof Error?e.message:c5(`errors.resumeResponse`))}finally{Ce(e=>e===t?null:e)}},[e,A,Bn,cn,Yt,Se,Xt]),fr=(0,p.useCallback)(async()=>{if(!e||we.length===0||Ee.size>0)return;let t=Array.from(new Set(we)),n=Oe||t.length>1;De(new Set(t));let r=await Promise.allSettled(t.map(async t=>(await PM(e,t),t))),i=[],a=[];for(let[e,n]of r.entries()){if(n.status===`fulfilled`){i.push(n.value);continue}a.push({sessionId:t[e]??``,message:n.reason instanceof Error?n.reason.message:null})}if(i.length>0&&Zt(i),De(new Set),a.length===0){Te([]),n&&(ke(!1),je(new Set),$.success(c5(`toasts.deleteSelectedSuccess`,{count:i.length})));return}let o=a.map(e=>e.sessionId);if(Te(o),n&&je(new Set(o)),i.length>0){$.error(c5(`toasts.deleteSelectedPartial`,{count:i.length,deletedCount:i.length,failedCount:a.length}));return}$.error(a[0]?.message??c5(`errors.deleteSession`))},[e,we,Ee,Oe,Zt]),pr=(0,p.useMemo)(()=>E.some(e=>!D5(e)),[E]),mr=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:e.agent_status===`stopped`?`interrupted`:!t&&ct.has(e.id)?`finished`:null,[ct]),hr=(0,p.useCallback)((e,n)=>[e.title,yhe(e.mode),Y8(e.tool),t?.memory_enabled&&e.pending_memory_suggestion_count>0?h5(e.pending_memory_suggestion_count):null,n===`running`?c5(`sidebar.running`):n===`interrupted`?c5(`sidebar.interrupted`):n===`finished`?c5(`sidebar.finished`):null].filter(Boolean).join(` `),[t]),gr=(0,p.useCallback)(({session:e,isActive:r,activityState:i})=>{let a=Ehe(e),o=a5({session:e,activeProject:t,activeProjectBranchState:n}),s=i===`interrupted`?null:i;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o?(0,X.jsx)(`div`,{className:`mb-1 truncate text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground/75`,children:o}):null,(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`div`,{className:`truncate text-[13px] font-medium leading-5`,children:e.title}),t?.memory_enabled&&e.pending_memory_suggestion_count>0?(0,X.jsx)(Ww,{tone:r?`default`:`muted`,className:`shrink-0`,"aria-label":h5(e.pending_memory_suggestion_count),title:h5(e.pending_memory_suggestion_count),children:e.pending_memory_suggestion_count}):null]}),a?(0,X.jsx)(`div`,{className:Z(`mt-0.5 line-clamp-1 text-xs leading-4`,r?`text-foreground/70`:`text-muted-foreground`),children:a}):null,e.target_available===!1?(0,X.jsx)(`div`,{className:`mt-1 line-clamp-1 text-[11px] leading-4 text-amber-200/90`,children:e.target_unavailable_reason??c5(`sidebar.targetUnavailable`)}):null]}),(0,X.jsx)(Hy,{state:s,className:`mt-1`})]})},[t,n]),_r=(0,p.useMemo)(()=>({ariaLabel:c5(`sidebar.ariaLabel`),newSession:c5(`sidebar.newSession`),collapseAriaLabel:c5(`sidebar.collapseAriaLabel`),openAriaLabel:c5(`sidebar.openAriaLabel`),cancelSelection:c5(`sidebar.cancelSelection`),addPreset:c5(`sidebar.addPreset`),deleteSelected:c5(`sidebar.deleteSelected`),selectedCount:e=>c5(`sidebar.selectedCount`,{count:e}),select:c5(`sidebar.select`),loadingSessions:c5(`sidebar.loadingSessions`),noSessions:c5(`sidebar.noSessions`),deleteSessionAriaLabel:c5(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>c5(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>c5(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>c5(`sidebar.deleteSessionTitle`,{title:e})}),[]),vr=(0,p.useMemo)(()=>({title:c5(`deleteSessionModal.title`),bulkTitle:c5(`deleteSessionModal.bulkTitle`),description:c5(`deleteSessionModal.description`),bulkDescription:e=>c5(`deleteSessionModal.bulkDescription`,{count:e}),cancel:c5(`deleteSessionModal.cancel`),delete:c5(`deleteSessionModal.delete`),deleting:c5(`deleteSessionModal.deleting`)}),[]),yr=(0,p.useMemo)(()=>(0,X.jsx)(g5,{modifierLabel:kn,keys:[d5],ariaHidden:!0}),[kn]),br=(0,p.useMemo)(()=>(0,X.jsx)(xhe,{label:c5(`shortcuts.startNewSession`),modifierLabel:kn,keys:[d5]}),[kn]),xr=(0,p.useCallback)((e,t)=>{je(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),Sr=(0,p.useMemo)(()=>nr?(0,X.jsx)(j8,{action:`interrupt`,isPending:ir,onAction:()=>{ur()},label:c5(`review.interrupt`),pendingLabel:c5(`review.interrupting`)}):ar?(0,X.jsx)(j8,{action:`resume`,isPending:or,disabled:sr,onAction:()=>{dr()},label:c5(`review.resume`),pendingLabel:c5(`review.resuming`)}):null,[ar,ur,dr,ir,sr,or,nr]),Cr=(0,p.useMemo)(()=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(UY,{value:En,planInactiveTooltip:(0,X.jsx)(eX,{label:c5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(eX,{label:c5(`shortcuts.switchToBuild`)}),disabled:Me||yn,onChange:e=>{Wn(e)}}),Sr]}),[En,Wn,yn,Me,Sr]),wr=(0,p.useMemo)(()=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(UY,{value:En,planInactiveTooltip:(0,X.jsx)(eX,{label:c5(`shortcuts.switchToPlan`)}),buildInactiveTooltip:(0,X.jsx)(eX,{label:c5(`shortcuts.switchToBuild`)}),disabled:Me||yn,onChange:e=>{Wn(e)}}),A&&qY(A,yn)&&(0,X.jsx)(tX,{disabled:ve||Me,onClick:()=>void Jn()}),F&&t&&(0,X.jsx)(Fy,{activeProject:t,branchState:n,bundles:r,branchSuggestions:i,isBundleLoading:a,isLoading:o,presentation:`composer`,closeAfterSelection:!0,triggerAriaLabel:jb.t(`common:projectTargetSelector.newChatAriaLabel`),onOpenChange:s,onSelectBundle:c,onSelectRepoRoot:l}),Sr]}),[t,n,A,En,Wn,Jn,yn,F,ve,a,o,Me,c,l,s,Sr,i,r]),Tr=(0,p.useMemo)(()=>Cn?(0,X.jsx)(vY,{model:ae,variant:W,skills:ce,showModelSelector:!0,showSkillsSelector:re.length>0,availableModels:Gt,availableSkills:re,selectedModel:Tn,onModelChange:e=>{let t=Gt.find(t=>t.id===e)??null,n=t&&t.variants.includes(W)?W:``;oe(e),se(n),Pn({model:e,variant:n})},onVariantChange:e=>{se(e),Pn({variant:e})},onSkillsChange:e=>{le(e),Pn({skills:e})},modelSelectId:`project-chat-model-selector`,variantSelectId:`project-chat-variant-selector`,skillsSelectId:`project-chat-skills-selector`,disabled:ve||ge||A?.agent_status===`running`}):wn?(0,X.jsx)(_Y,{dataTestId:`chat-model-selector-skeleton`}):null,[A?.agent_status,Gt,re,ge,ve,Pn,Tn,ae,ce,W,Cn,wn]);(0,p.useEffect)(()=>{if(S)return()=>{S(null)}},[S]),(0,p.useEffect)(()=>{if(S){if(!e||!tr){S(null);return}S({chatSessionId:A?.id??null,canSubmitReviewPrompt:cr,reviewSubmitDisabledReason:lr,mode:En,onModeChange:async e=>{await Wn(e)},isUpdatingMode:Me,promptPlaceholder:m5(En),promptComposerControls:Cr,promptComposerInlineControls:Tr,submitPrompt:er})}},[e,A,cr,En,Wn,er,tr,Me,S,Cr,Tr,lr]);let Er=async()=>{if(!(!Vt.trim()&&Ut.length===0||Wt||yn||M))try{if(!await qn(Vt))return}catch(e){$.error(e instanceof Error?e.message:c5(`errors.sendPrompt`))}},Dr=e=>{e.key!==`Enter`||e.shiftKey||A?.agent_status===`running`||M||ge||ve||Wt||yn||(e.preventDefault(),Er())};(0,p.useEffect)(()=>{let t=t=>{if(bhe(t)){if(!e||ge||ve)return;t.preventDefault(),Fn(),Un();return}ZY(t)&&(!e||!F&&!A||(t.preventDefault(),Wn(XY(En))))};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,A,En,Un,Fn,Wn,ge,F,ve]);let Or=(0,p.useCallback)(async t=>{if(!(!e||!A)){Le(t);try{let n=await LM(e,A.id,t);Yt(n.chatSession),Xt(n.chatSession),$.success(c5(`ticketProposal.createdFromChat`,{count:n.created_tickets.length}))}catch(e){$.error(e instanceof Error?e.message:c5(`errors.createTickets`))}finally{Le(e=>e===t?null:e)}}},[e,A,Yt,Xt]),kr=(0,p.useCallback)(e=>e.ticket_proposals?(0,X.jsx)(Ahe,{proposals:e.ticket_proposals,isApplying:Ie===e.id,onApply:()=>{Or(e.id)}}):null,[Ie,Or]),Ar=(0,p.useCallback)(e=>{if(!xt.current)return;let t=xt.current.getBoundingClientRect().width,n=p5(e,t);jt.current=n,Ct.current&&(Ct.current.style.setProperty(`--chat-changes-panel-width`,`${n}px`),Ct.current.setAttribute(`data-desktop-width`,String(n)))},[]),Mr=(0,p.useCallback)(()=>{Et.current?.(),Et.current=null},[]),Nr=(0,p.useCallback)(e=>{let t=wt.current,n=Tt.current,r=Dt.current;if(t!==null){if(wt.current=null,Tt.current=null,Dt.current=!1,$e(!1),tt(!1),Mr(),e!==null&&typeof St.current?.hasPointerCapture==`function`&&St.current.hasPointerCapture(e)&&typeof St.current.releasePointerCapture==`function`&&St.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;rt(jt.current),Y(!0);return}rt(jt.current)}},[Mr]),Pr=(0,p.useCallback)((e,t)=>{if(wt.current!==e)return;let n=t-kt.current,r=At.current-n;if(Tt.current===`collapsed`){if(!Dt.current&&r<hhe)return;Dt.current||(Dt.current=!0,Ot.current=!0,tt(!0),$e(!0))}Ar(r)},[Ar]),Fr=(0,p.useCallback)((e,t)=>{if(wt.current===e){if(t!==null&&(Tt.current===`inline`||Dt.current)){let e=t-kt.current;Ar(At.current-e)}Nr(e)}},[Nr,Ar]),Ir=(0,p.useCallback)(e=>{if(!w)return;e.preventDefault(),wt.current=e.pointerId,Tt.current=Ze?`inline`:`collapsed`,Dt.current=!1,Ot.current=!1,kt.current=e.clientX,At.current=Ze?jt.current:0,$e(Ze),Mr(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{Pr(e.pointerId,e.clientX)},n=e=>{Fr(e.pointerId,e.clientX)},r=e=>{Fr(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),Et.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[Fr,Pr,Ze,w,Mr]),Lr=(0,p.useCallback)(e=>{Pr(e.pointerId,e.clientX)},[Pr]),Rr=(0,p.useCallback)(e=>{Fr(e.pointerId,e.clientX)},[Fr]),zr=(0,p.useCallback)(e=>{Fr(e.pointerId,e.clientX)},[Fr]),Br=(0,p.useCallback)(e=>{wt.current===e.pointerId&&Nr(e.pointerId)},[Nr]),Vr=(0,p.useCallback)(()=>{if(Ot.current){Ot.current=!1;return}Y(!0)},[]),Hr=(0,p.useCallback)(()=>{Y(!1)},[]),Ur=(0,p.useCallback)(e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),Vr())},[Vr]);(0,p.useEffect)(()=>{w||(wt.current=null,Tt.current=null,Dt.current=!1,Ot.current=!1,$e(!1),tt(!1),Mr())},[w,Mr]),(0,p.useEffect)(()=>()=>{Mr()},[Mr]);let Wr=!!O,Gr=A?.target_available===!1,Kr=Gr?A?.target_unavailable_reason??c5(`review.unavailableTarget`):null,qr=F||!!(A&&A.target_available!==!1&&!Vn),Jr=!!(t?.memory_enabled&&A&&(G.length>0||Ve)),Yr=w&&(F||Wr)&&!Gr&&!Vn,Xr=Yr&&!Ze&&!et,Zr=Yr&&(Ze||et),Qr=`${Nn??`none`}:${Yr?`changes-enabled`:`changes-disabled`}:${Zr?`panel-visible`:`panel-hidden`}`,$r=(0,p.useCallback)(e=>{mt.current=null,$t(Bt,e)},[Bt,$t]),ei=A||F?(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(V8,{projectId:e,agentRunParentType:A?`chat`:null,agentRunParentId:A?.id??null,messages:A?_n:[],internalLog:A?.agent_log??null,currentThinkingMessageId:A?.agent_message_id??null,previousThinkingLog:A?.previous_agent_log??null,previousThinkingMessageId:A?.previous_agent_message_id??null,pendingAgentTitle:gn,streamingResponse:A?.streaming_response??null,isRunning:A?.agent_status===`running`,isLoading:!F&&me,canShowComposer:qr,cardClassName:`border-t-0`,isExternallyResizing:C||Qe,pendingAgentRevealKey:Sn,pendingAgentRevealDelayMs:vhe,liveResponseTiming:ot,composerFocusNonce:it,header:(0,X.jsx)(H8,{title:Dn,tool:F?null:A?.tool??null,modelLabel:Mn,interrupted:rr,interruptedLabel:c5(`sidebar.interrupted`),usage:{totalTokens:A?.usage_snapshot_total_tokens??null,contextWindow:A?.usage_snapshot_context_window??null,cost:A?.usage_snapshot_cost??null,tool:On,model:An,availableModels:Gt},metadataExtra:(0,X.jsxs)(X.Fragment,{children:[A?.external_source?(0,X.jsx)(IF,{externalSource:A.external_source}):null,A?.origin_spec_session_id&&A.origin_spec_snapshot_id&&y?(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`ghost`,className:`h-6 px-2 text-[11px] text-violet-200 hover:text-violet-100`,onClick:()=>{y(A.origin_spec_session_id,A.origin_spec_snapshot_id)},children:jb.t(`common:specView.provenance.viewSourceSpec`)}):null]}),actions:A&&e?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Jr&&(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>K(!0),children:Ve?c5(`composer.loadingMemory`):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:c5(`composer.memorySuggestions`)}),(0,X.jsx)(Ww,{children:G.length})]})}),(0,X.jsx)(R4,{projectId:e,scope:{type:`chat`,id:A.id},size:`xs`,onNavigateToLifecycleSource:b})]}):null,warnings:Vn&&zn?(0,X.jsx)(`div`,{className:`w-fit max-w-md rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-50`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`div`,{children:zn}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{Ln()},children:c5(`composer.switchBack`)}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:Fn,children:c5(`composer.startNewSession`)})]})]})}):Gr&&Kr?(0,X.jsx)(`div`,{className:`w-fit max-w-md rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-50`,children:Kr}):null}),composerControls:wr,composerInlineControls:Tr,composerTheme:En,layoutKey:Nn,scrollLayoutKey:Qr,followUpPrompt:Vt,draftAttachments:Ut,followUpPlaceholder:m5(En),emptyStateText:null,renderMessageFooter:kr,renderMessageBody:xn,isSendingFollowUp:ve||ge,isComposerSubmitDisabled:yn||M,postBuildCheck:A?.post_build_check,isUploadingAttachments:Wt,canAttachImages:jn,followUpDisabledReason:Gr?Kr??void 0:A?.agent_status===`running`?c5(`review.waitTurnShort`):M?jb.t(`common:postBuildChecks.blockedReason`):Wt?c5(`review.waitUpload`):yn?jb.t(`common:questionSet.waitForResolution`):void 0,onFollowUpPromptChange:$r,onFollowUpKeyDown:Dr,onFollowUpPaste:$n,onUploadAttachments:e=>{Zn(e)},onRemoveAttachment:e=>{Qn(e)},onFollowUpSubmit:()=>{Er()}})}):Wr?(0,X.jsx)(D8,{label:c5(`composer.loadingSession`)}):!fe||ue?(0,X.jsx)(O8,{label:c5(`sidebar.loadingSessions`)}):(0,X.jsx)(k8,{title:c5(`composer.noSessionSelectedTitle`),description:c5(`composer.noSessionSelectedDescription`),startNewSessionLabel:c5(`composer.startNewSession`),onStartNewSession:Fn,canStartNewSession:!!e&&!ge&&!ve}),ti=Yr?(0,X.jsx)(`div`,{ref:St,"aria-label":c5(Xr?`composer.openDiff`:`composer.resizeDiffPanel`),"aria-orientation":Xr?void 0:`vertical`,className:Z(Xr?`group flex h-8 w-full shrink-0 touch-none select-none items-center justify-center border-t border-border/70 bg-background/90 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground xl:h-auto xl:w-7 xl:cursor-col-resize xl:border-l xl:border-t-0`:`group hidden w-5 shrink-0 cursor-col-resize touch-none select-none items-center justify-center border-l border-border/70 bg-background/80 transition-colors xl:flex`,Qe&&!Xr&&`bg-background`),"data-testid":Xr?`collapsed-changes-rail`:void 0,onLostPointerCapture:Br,onPointerCancel:zr,onPointerDown:Ir,onPointerMove:Lr,onPointerUp:Rr,onClick:Xr?Vr:void 0,onKeyDown:Xr?Ur:void 0,role:Xr?`button`:`separator`,tabIndex:Xr?0:void 0,children:Xr?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`hidden h-full w-full items-center justify-center xl:flex`,children:(0,X.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-[2.65rem] items-center justify-center text-sky-400/80 transition-colors group-hover:text-sky-300`,children:(0,X.jsx)(Cv,{className:`h-3 w-3 shrink-0`})}),(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 h-14 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-muted-foreground/70 transition-colors group-hover:bg-sky-300/90`})]})}),(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium xl:hidden`,children:[(0,X.jsx)(Cv,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:c5(`composer.diff`)})]})]}):(0,X.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,Qe?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})}):null,ni=Ue&&e&&t?.memory_enabled?(0,X.jsx)(uC,{onClose:()=>K(!1),overlayClassName:`bg-background/75 p-4`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,X.jsxs)(gC,{size:`sm`,className:`max-h-[calc(100vh-2rem)] w-full gap-0 overflow-hidden border-border/80 bg-card/95 shadow-2xl`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/80 pb-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(vC,{children:c5(`composer.memorySuggestionsTitle`)}),(0,X.jsx)(yC,{children:c5(`composer.memorySuggestionsDescription`)})]}),(0,X.jsx)(bC,{children:t})]}),(0,X.jsx)(xC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,X.jsx)(U8,{projectId:e,suggestions:G,emptyState:c5(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:un})})]}),closeButtonLabel:c5(`composer.closeMemorySuggestions`)}):null,ri=mn.length>0?(0,X.jsx)(E8,{count:mn.length,title:hn,isDeleting:Ee.size>0,onConfirm:()=>{fr()},onCancel:()=>{Ee.size>0||Te([])},labels:vr}):null;return(0,X.jsxs)(`div`,{"data-testid":`chat-view-shell`,className:`relative flex min-h-0 flex-1 overflow-hidden border-t border-border/70`,children:[(0,X.jsx)(A8,{sessions:E,sessionGroups:fn,activeSessionId:O,isDraftOpen:F,isLoadingSessions:ue,isOpen:J,onToggleOpen:()=>{Xe(e=>!e)},testId:`chat-sessions-sidebar`,railTestId:`chat-sessions-rail`,onDraftOpen:Fn,isCreatingSession:ge||!e,isSendingPrompt:ve,newSessionShortcutHint:yr,newSessionTooltip:br,isSelectionMode:Oe,selectedSessionIds:Ae,selectedSessionCount:Ae.size,hasDeletableSessions:pr,deletingSessionIds:Ee,onEnterSelectionMode:()=>{ke(!0),je(new Set)},onExitSelectionMode:()=>{ke(!1),je(new Set)},onToggleSessionSelection:e=>{je(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:xr,onConfirmDeleteSelectedSessions:()=>{Te(Array.from(Ae))},selectionPresets:pn,onSessionSelect:e=>{Hn(e)},onConfirmDeleteSession:e=>{Te([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:D5,getActivityState:mr,getRowAriaLabel:hr,renderRowContent:gr,labels:_r}),(0,X.jsxs)(`div`,{ref:xt,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden xl:flex-row`,children:[(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:ei}),Yr?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(lv,{content:c5(`composer.openDiff`),disabled:!Xr,side:`left`,children:ti}),Zr?(0,X.jsx)(B8,{projectId:e,chatSessionId:F?null:O,canSubmitReviewPrompt:cr,reviewSubmitDisabledReason:lr,onSubmitReviewPrompt:er,state:q,onStateChange:Je,isResizing:Qe,onClose:Hr,desktopWidth:nt,panelElementRef:Ct}):null]}):null]}),ni,ri]})},Mhe=({className:e})=>(0,X.jsx)(ute,{"aria-hidden":`true`,className:e}),Nhe=({activeProject:e,onNavigateToSource:t})=>{let{t:n}=K(`projects`);return e?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-6`,children:(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col gap-5`,children:[(0,X.jsx)(`div`,{className:`border-b border-border/60 pb-4`,children:(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground`,children:n(`memory.workspace.title`)}),(0,X.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:e.name})]})}),(0,X.jsx)(DT,{mode:`edit`,projectId:e.id,memoryEnabled:e.memory_enabled,persistedMemoryEnabled:e.memory_enabled,onMemoryEnabledChange:()=>{},showActivationControls:!1,archiveLayout:!0,onNavigateToSource:t})]})}):(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:n(`memory.workspace.selectProject`)})},Phe=(e,t,n,r)=>Y(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{method:`POST`,body:r,fallbackErrorMessage:`Unable to start the spec review right now.`}),Fhe=(e,t,n)=>Y(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the spec review right now.`}),O5=(e,t,n,r)=>Y(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review`),{signal:r,fallbackErrorMessage:`Unable to load the spec review right now.`}),Ihe=(e,t,n,r)=>Y(q(`/projects/${e}/spec-sessions/${t}/snapshots/${n}/review-runs/${r}/revision-draft`),{method:`POST`,fallbackErrorMessage:`Unable to build the revision draft right now.`}),Lhe=(e,t)=>!!t&&e===t,Rhe=({suggestion:e,isRecommended:t,recommendedLabel:n,onPick:r})=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{r(e.value)},className:Z(`inline-flex min-w-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-left text-xs font-medium transition-colors`,t?`border-amber-500/40 bg-amber-500/15 text-amber-200 hover:bg-amber-500/25 hover:text-amber-100`:`border-border/70 bg-background/70 text-foreground hover:border-border hover:bg-background`),children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.label}),t?(0,X.jsx)(`span`,{className:`shrink-0 rounded-full bg-amber-500/30 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-amber-100`,children:n}):null]}),zhe=({question:e,labels:t})=>(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm font-medium leading-relaxed text-foreground`,children:e.question}),e.rationale?(0,X.jsxs)(`p`,{className:`whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`font-semibold`,children:[t.rationaleLabel,`: `]}),e.rationale]}):null]}),k5=({question:e,isActive:t,isDisabled:n=!1,onSubmitAnswer:r,labels:i})=>{let[a,o]=(0,p.useState)(``),s=(0,p.useRef)(null);if((0,p.useEffect)(()=>{t&&o(``)},[e.question,t]),(0,p.useEffect)(()=>{s.current&&PE(s.current)},[a]),!t)return(0,X.jsx)(zhe,{question:e,labels:i});let c=a.trim().length>0&&!n,l=e.suggestions.find(e=>e.recommended)?.id,u=e=>{o(e),requestAnimationFrame(()=>{s.current?.focus();let e=s.current;e&&e.setSelectionRange(e.value.length,e.value.length)})},d=()=>{let e=a.trim();!e||n||(r(e),o(``))};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(Yy,{className:`mt-0.5 h-4 w-4 flex-shrink-0 text-amber-300`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm font-medium leading-relaxed text-foreground`,children:e.question}),e.rationale?(0,X.jsxs)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`font-semibold`,children:[i.rationaleLabel,`: `]}),e.rationale]}):null]})]}),e.suggestions.length>0?(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:i.suggestionsLabel}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.suggestions.map(e=>(0,X.jsx)(Rhe,{suggestion:e,isRecommended:Lhe(e.id,l),recommendedLabel:i.recommendedSuggestionLabel,onPick:u},e.id))})]}):null,(0,X.jsx)(A_,{ref:s,value:a,placeholder:i.answerPlaceholder,disabled:n,onChange:e=>{o(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),d())}}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,disabled:!c,onClick:d,children:n?i.submittingLabel:i.submitLabel})})]})},Bhe=({className:e})=>(0,X.jsx)(qee,{"aria-hidden":`true`,className:e}),Vhe=[`h-10 w-10 px-0`,`border-amber-400/60 bg-amber-500/30 text-amber-100 shadow-[0_8px_24px_rgba(245,158,11,0.24)]`,`hover:bg-amber-500/45 hover:text-white hover:border-amber-300`,`focus-visible:border-ring/70 focus-visible:ring-2 focus-visible:ring-ring/20`].join(` `),Hhe=[`h-10 w-10 px-0 shadow-none`,`border-border/70 bg-transparent text-muted-foreground`,`hover:border-border hover:bg-background/60 hover:text-foreground`,`focus-visible:border-ring/70 focus-visible:ring-2 focus-visible:ring-ring/20`,`disabled:border-border/40 disabled:bg-transparent disabled:text-muted-foreground/50`].join(` `),A5=({on:e,disabled:t=!1,onToggle:n,tooltipContent:r,ariaLabelOn:i,ariaLabelOff:a,className:o})=>(0,X.jsx)(lv,{content:r,children:(0,X.jsx)(`span`,{className:`inline-flex`,children:(0,X.jsx)(Q,{type:`button`,size:`icon`,variant:e?`warning`:`ghost`,"aria-pressed":e,"aria-label":e?i:a,disabled:t,className:Z(e?Vhe:Hhe,o),onClick:()=>{t||n(!e)},children:(0,X.jsx)(Bhe,{className:`h-5 w-5`})})})}),Uhe=({projectId:e,specSessionId:t,messages:n,internalLog:r,currentThinkingMessageId:i=null,previousThinkingLog:a=null,previousThinkingMessageId:o=null,pendingAgentTitle:s,streamingResponse:c,isRunning:l,isLoading:u=!1,canShowComposer:d,cardClassName:f,isExternallyResizing:p=!1,pendingAgentRevealKey:m=null,pendingAgentRevealDelayMs:h=0,liveResponseTiming:g=null,composerFocusNonce:_=0,blurComposerOnSendStart:v=!1,hidePendingAgentTitle:y=!1,forceScrollToBottomKey:b,header:x,composerControls:S,composerInlineControls:C,composerTheme:w=`default`,layoutKey:T,scrollLayoutKey:E,followUpPrompt:D,draftAttachments:O=[],followUpPlaceholder:k,emptyStateText:A=null,renderMessageFooter:j,renderMessageBody:M,isSendingFollowUp:N,isComposerSubmitDisabled:P=!1,isUploadingAttachments:F=!1,canAttachImages:I=!1,followUpDisabledReason:L,onFollowUpPromptChange:R,onFollowUpKeyDown:z,onFollowUpPaste:ee,onUploadAttachments:B,onRemoveAttachment:V,onFollowUpSubmit:te})=>(0,X.jsx)(VJ,{projectId:e,agentRunParentType:t?`spec`:null,agentRunParentId:t,messages:n,internalLog:r,currentThinkingMessageId:i,previousThinkingLog:a,previousThinkingMessageId:o,pendingAgentTitle:s,streamingResponse:c,isRunning:l||!!(N&&g),isLoading:u,autoScrollBehavior:`sticky`,surfaceVariant:`chat`,canShowComposer:d,cardClassName:f,header:x,composerControls:S,composerInlineControls:C,composerTheme:w,composerSize:`compact-on-laptop`,showThinkingPlacement:`header`,pinComposerToBottom:!0,isExternallyResizing:p,pendingAgentRevealKey:m,pendingAgentRevealDelayMs:h,liveResponseTiming:g,composerFocusNonce:_,blurComposerOnSendStart:v,forceScrollToBottomKey:b,layoutKey:T,scrollLayoutKey:E,followUpPrompt:D,draftAttachments:O,followUpPlaceholder:k,emptyStateText:A,autoFocusComposer:!0,renderMessageFooter:j,renderMessageBody:M,isSendingFollowUp:N,isComposerSubmitDisabled:P,isUploadingAttachments:F,canAttachImages:I,followUpDisabledReason:L,hidePendingAgentTitle:y,onFollowUpPromptChange:R,onFollowUpKeyDown:z,onFollowUpPaste:ee,onUploadAttachments:B,onRemoveAttachment:V,onFollowUpSubmit:te}),j5=e=>{let t={...e};return delete t.messages,t.agent_log=null,t.agent_message_id=null,t.previous_agent_log=null,t.previous_agent_message_id=null,t.streaming_response=null,t},Whe=(e,t)=>t.messages===void 0&&(!e||e.id!==t.id)?e:!e||e.id!==t.id||t.messages!==void 0?t:{...t,messages:e.messages},M5=new Set([`deterministic`,`structural_heuristic`,`historical_heuristic`]),N5=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ghe=e=>N5(e)&&typeof e.seed_path==`string`&&typeof e.candidate_path==`string`&&M5.has(e.evidence_class)&&typeof e.depth==`number`&&Array.isArray(e.edge_ids),P5=e=>N5(e)&&typeof e.path==`string`&&typeof e.is_test==`boolean`&&M5.has(e.evidence_class)&&Array.isArray(e.chains)&&e.chains.length>0&&e.chains.every(Ghe),Khe=e=>!N5(e)||e.version!==1||![`complete`,`stale`,`truncated`,`unavailable`].includes(e.capture_state)||!Array.isArray(e.affected_files)||!Array.isArray(e.affected_tests)||!e.affected_files.every(P5)||!e.affected_tests.every(P5)?null:e,qhe=e=>!!(e.likely_files.some(e=>e.origin!==`graph`)||e.file_relation_graph),F5=({evidenceClass:e})=>{let{t}=K(`common`);return(0,X.jsx)(hC,{variant:`outline`,className:`shrink-0 px-1.5 py-0 text-[10px] ${e===`deterministic`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e===`structural_heuristic`?`border-amber-400/30 bg-amber-500/10 text-amber-200`:`border-sky-400/30 bg-sky-500/10 text-sky-200`}`,children:t(`specView.artifactPanel.repositoryEvidence.class.${e}`)})},Jhe=({candidate:e})=>{let{t}=K(`common`),n=e.chains.slice(0,2);return(0,X.jsxs)(`details`,{className:`group mt-2 border-t border-border/40 pt-2`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer list-none rounded-sm text-xs font-medium text-violet-300 outline-none hover:text-violet-200 focus-visible:ring-2 focus-visible:ring-ring/60 [&::-webkit-details-marker]:hidden`,children:t(`specView.artifactPanel.repositoryEvidence.showChains`,{count:n.length})}),(0,X.jsx)(`ol`,{className:`mt-2 space-y-2`,children:n.map((e,n)=>(0,X.jsxs)(`li`,{className:`min-w-0 rounded-md bg-background/35 px-2.5 py-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-foreground`,children:t(`specView.artifactPanel.repositoryEvidence.chainLabel`,{number:n+1})}),(0,X.jsx)(F5,{evidenceClass:e.evidence_class})]}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-xs leading-relaxed text-muted-foreground`,children:t(`specView.artifactPanel.repositoryEvidence.chainSummary`,{seed:e.seed_path,candidate:e.candidate_path,count:e.depth})})]},`${e.seed_path}:${e.candidate_path}:${e.edge_ids.join(`:`)}`))})]})},Yhe=({row:e,affectedTest:t=!1})=>{let{t:n}=K(`common`);return(0,X.jsxs)(`li`,{className:`min-w-0 overflow-hidden rounded-md border border-border/50 bg-surface-hover px-3 py-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`code`,{className:`min-w-0 break-all text-xs font-medium text-foreground`,children:e.path}),e.isNew&&(0,X.jsx)(hC,{variant:`success`,className:`shrink-0 px-1.5 py-0 text-[10px]`,children:n(`specView.artifactPanel.newFile`)})]}),(0,X.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:n(`specView.artifactPanel.repositoryEvidence.origin.${e.origin}`)}),t&&(0,X.jsx)(hC,{variant:`outline`,className:`px-1.5 py-0 text-[10px] text-violet-200`,children:n(`specView.artifactPanel.repositoryEvidence.affectedTest`)}),e.candidate&&(0,X.jsx)(F5,{evidenceClass:e.candidate.evidence_class})]}),e.reason&&(0,X.jsx)(`p`,{className:`mt-1 break-words text-xs leading-relaxed text-muted-foreground`,children:e.reason}),e.candidate&&(0,X.jsx)(Jhe,{candidate:e.candidate})]})},I5=e=>e.replace(/\\/g,`/`),Xhe=({snapshot:e,onMermaidClick:t})=>{let{t:n}=K(`common`);Khe(e.repository_evidence);let r=[],i=[],a=new Map(i.map(e=>[I5(e.path),e])),o=e.likely_files.filter(e=>e.origin!==`graph`),s=new Map(o.map(e=>[e.normalized_path??I5(e.path),e])),c=o.flatMap(e=>{let t=e.normalized_path??I5(e.path);return a.has(t)?[]:[{path:e.path,reason:e.reason||null,isNew:e.is_new,origin:e.origin??`planner`,candidate:null}]}),l=r.map(e=>{let t=s.get(I5(e.path));return{path:t?.path??e.path,reason:null,isNew:!1,origin:t?`both`:`graph`,candidate:e}}),u=new Set(r.map(e=>I5(e.path)));for(let t of e.likely_files.filter(e=>e.origin===`graph`)){let e=t.normalized_path??I5(t.path);u.has(e)||l.push({path:t.path,reason:t.reason||null,isNew:t.is_new,origin:`graph`,candidate:null})}return i.map(e=>{let t=s.get(I5(e.path));return{path:t?.path??e.path,reason:t?.reason??null,isNew:t?.is_new??!1,origin:t?`both`:`graph`,candidate:e}}),(0,X.jsxs)(`section`,{children:[c.length>0&&(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:c.map(e=>(0,X.jsx)(Yhe,{row:e},`${e.origin}:${e.path}`))}),!1,e.file_relation_graph&&(0,X.jsxs)(`section`,{className:`mt-4`,"aria-labelledby":`spec-file-relation-heading`,children:[(0,X.jsx)(`h3`,{id:`spec-file-relation-heading`,className:`text-xs font-semibold text-foreground`,children:n(`specView.artifactPanel.fileRelationGraph`)}),(0,X.jsx)(`p`,{className:`mb-2 mt-1 text-xs leading-relaxed text-muted-foreground`,children:n(`specView.artifactPanel.repositoryEvidence.diagramDescription`)}),(0,X.jsx)(`div`,{className:`overflow-auto rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,X.jsx)(UW,{mermaid:e.file_relation_graph,onClick:()=>{t(e.file_relation_graph)}})})]})]})},L5=({className:e})=>(0,X.jsx)(xte,{"aria-hidden":`true`,className:e}),Zhe=({className:e})=>(0,X.jsx)(Mg,{"aria-hidden":`true`,className:e}),R5=({className:e})=>(0,X.jsx)(Bee,{"aria-hidden":`true`,className:e}),z5=({heading:e,open:t,onOpenChange:n,children:r})=>(0,X.jsxs)(BC,{open:t,onOpenChange:n,children:[(0,X.jsx)(VC,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground transition-colors mb-2`,children:[(0,X.jsx)(mv,{className:`h-3 w-3 shrink-0 transition-transform ${t?``:`-rotate-90`}`}),e]})}),(0,X.jsx)(HC,{children:r})]}),Qhe=({actions:e})=>{let{t}=K(`common`);return e.hasExistingTicketsFromSnapshot?(0,X.jsxs)(`p`,{className:`flex w-full items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium text-muted-foreground`,children:[(0,X.jsx)(Xy,{className:`h-3.5 w-3.5 text-emerald-400`}),t(`specView.actions.ticketsCreated`)]}):(0,X.jsxs)(Q,{type:`button`,size:`sm`,onClick:e.onCreateTickets,disabled:!!e.unavailableReason||e.isCreatingTickets||e.isImplementingInChat||e.isExporting,title:e.unavailableReason??void 0,className:`w-full justify-center gap-1.5 border-violet-300/70 bg-violet-500/15 text-violet-100 hover:bg-violet-500/25`,children:[(0,X.jsx)(L5,{className:`h-3.5 w-3.5`}),e.isCreatingTickets?t(`specView.actions.creatingTickets`):t(`specView.actions.createTickets`)]})},B5=({ticket:e})=>(0,X.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`break-words text-xs font-medium text-foreground`,children:e.title}),e.key&&(0,X.jsx)(`div`,{className:`mt-0.5 break-all text-xs text-violet-400`,children:e.key})]}),$he=({snapshot:e})=>{let{t}=K(`common`),n=new Map(e.tickets.map(e=>[e.key,e]));return(0,X.jsx)(`section`,{className:`space-y-2.5`,children:e.bundle_groups.map(e=>{let r=e.ticket_keys.map(e=>n.get(e)).filter(e=>e!==void 0);return(0,X.jsxs)(`article`,{className:`min-w-0 rounded-md border border-border/50 bg-surface px-3 py-2.5`,children:[(0,X.jsx)(`h4`,{className:`break-all text-sm font-semibold text-foreground`,children:e.name}),(0,X.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:t(`specView.artifactPanel.proposedTicketCount`,{count:r.length})}),r.length>0&&(0,X.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:r.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(B5,{ticket:e})},e.key))})]},e.key)})})},V5={high:0,medium:1,low:2},ege=e=>[...e].sort((e,t)=>{let n=V5[e.severity]??99,r=V5[t.severity]??99;return n===r?e.ordinal-t.ordinal:n-r}),tge=e=>{let t={high:0,medium:0,low:0};for(let n of e)t[n.severity]+=1;return t},nge=({run:e})=>{let{t}=K(`common`),n=e.agent_status,r=t(`specView.review.status.${n}`,{defaultValue:n});return(0,X.jsx)(`span`,{className:`text-xs font-medium ${n===`running`?`text-violet-300`:n===`completed`?`text-emerald-300`:n===`error`||n===`parse_failed`?`text-rose-300`:`text-amber-300`}`,children:r})},rge=({review:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)(!0),i=e.review?.run??null,a=e.review?.findings??[],o=ege(a),s=tge(a),c=e.isRunning||i?.agent_status===`running`,l=c,u=!!i&&!c&&i?.agent_status===`completed`&&a.length>0,d=i?.agent_status===`completed`?`specView.review.noFindings`:i?.agent_status===`stopped`?`specView.review.stoppedExplanation`:i?.agent_status===`error`?`specView.review.errorExplanation`:i?.agent_status===`parse_failed`?`specView.review.parseFailedExplanation`:null,f=(0,p.useMemo)(()=>new Map(e.availableModels.map(e=>[e.id,e.label])),[e.availableModels]),m=i?.model?Z8({availableModelsById:f,model:i.model})??i.model:null,h=i?[m,t(`specView.review.findingsCount`,{count:a.length}),s.high>0?`${s.high} ${t(`specView.review.severity.high`)}`:null,s.medium>0?`${s.medium} ${t(`specView.review.severity.medium`)}`:null,s.low>0?`${s.low} ${t(`specView.review.severity.low`)}`:null].filter(Boolean).join(` · `):null;return(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(R5,{className:`h-3.5 w-3.5`}),t(`specView.review.heading`)]}),open:n,onOpenChange:r,children:(0,X.jsxs)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-3`,children:[i&&(0,X.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(nge,{run:i}),c&&(0,X.jsx)(`span`,{className:`inline-flex items-center gap-1 text-violet-300`,"aria-hidden":`true`,children:(0,X.jsx)(`span`,{className:`h-3 w-3 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`})}),h&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:h})]}),e.isLoading&&!i&&(0,X.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:t(`specView.review.loading`)}),o.length>0?(0,X.jsx)(`ul`,{className:`space-y-2`,children:o.map(e=>(0,X.jsxs)(`li`,{className:`rounded-md border border-border/40 bg-surface px-2.5 py-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[0.65rem] font-bold uppercase tracking-wide ${e.severity===`high`?`text-rose-300`:e.severity===`medium`?`text-amber-300`:`text-sky-300`}`,children:e.severity}),(0,X.jsx)(`span`,{className:`min-w-0 break-words text-xs font-medium text-foreground`,children:e.title})]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-foreground`,children:e.what_text}),e.why_text&&(0,X.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[t(`specView.review.why`),`:`]}),` `,e.why_text]}),e.suggestion_text&&(0,X.jsxs)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[t(`specView.review.suggestion`),`:`]}),` `,e.suggestion_text]})]},e.id))}):d?(0,X.jsx)(`p`,{className:`text-xs ${i?.agent_status===`completed`?`text-emerald-300`:`text-muted-foreground`}`,children:t(d)}):null,l&&(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:e.onStopReview,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(Ov,{className:`h-3.5 w-3.5`}),t(`specView.review.stop`)]})}),u&&(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:e.onSendToPlanner,disabled:!!e.disabledReason||e.isSendingToPlanner,title:e.disabledReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(AE,{className:`h-3.5 w-3.5`}),e.isSendingToPlanner?t(`specView.review.sendingToPlanner`):t(`specView.review.sendToPlanner`)]})})]})})},ige=({review:e})=>{let{t}=K(`common`),[n,r]=(0,p.useState)(!1),i=e.isRunning||e.review?.run?.agent_status===`running`,a=e.showModelSelector&&e.selectedDiscoveredModel!==null&&e.selectedDiscoveredModel.variants.length>0,o=t(i?`specView.review.running`:`specView.review.launch`);return(0,X.jsxs)(B_,{open:n&&!i,onOpenChange:r,children:[(0,X.jsx)(V_,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,disabled:i||!!e.disabledReason,title:e.disabledReason??void 0,"aria-label":o,className:`gap-1.5 text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(R5,{className:`h-4 w-4`}),t(`specView.review.heading`)]})}),(0,X.jsx)(H_,{align:`end`,className:`w-72 max-w-[calc(100vw-2rem)] p-3`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.22em] text-muted-foreground`,children:t(`specView.review.popoverTitle`)}),(0,X.jsx)(tv,{model:e.runConfigModel,showModelSelector:e.showModelSelector,availableModels:e.availableModels,onModelChange:e.onRunConfigModelChange,selectId:`spec-review-model`,label:t(`specView.review.model`)}),(0,X.jsx)(nv,{variant:e.runConfigVariant,selectedModel:e.selectedDiscoveredModel,showVariantSelector:a,onVariantChange:e.onRunConfigVariantChange,selectId:`spec-review-variant`,label:t(`specView.review.variant`)}),(0,X.jsxs)(Q,{type:`button`,size:`sm`,onClick:()=>{r(!1),e.onLaunchReview()},className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(R5,{className:`h-3.5 w-3.5`}),t(`specView.review.launchAction`)]})]})})]})},age=(0,p.memo)((0,p.forwardRef)(({snapshot:e,isLoading:t,desktopWidth:n,onClose:r,actions:i,review:a,className:o},s)=>{let{t:c}=K(`common`),[l,u]=(0,p.useState)(null),[d,f]=(0,p.useState)(!1),[m,h]=(0,p.useState)(!0),[g,_]=(0,p.useState)(!0),[v,y]=(0,p.useState)(!0),[b,x]=(0,p.useState)(!0),[S,C]=(0,p.useState)(!0),[w,T]=(0,p.useState)(!0),[E,D]=(0,p.useState)(!0),[O,k]=(0,p.useState)(!0),[A,j]=(0,p.useState)(!0),M=(0,p.useCallback)(e=>{u(e)},[]),N=(0,p.useCallback)(()=>{f(!0)},[]),P=`flex h-[26rem] min-h-0 min-w-0 w-full shrink-0 flex-col overflow-hidden border-t border-border/70 bg-surface xl:h-full xl:border-l xl:border-t-0 ${o??``}`;if(t)return(0,X.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`text-muted-foreground hover:text-foreground`,"aria-label":c(`specView.artifactPanel.close`),onClick:r,children:(0,X.jsx)(Ub,{className:`h-4 w-4`})})]}),(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,X.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-violet-400 border-t-transparent`})})]});if(!e)return(0,X.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`text-muted-foreground hover:text-foreground`,"aria-label":c(`specView.artifactPanel.close`),onClick:r,children:(0,X.jsx)(Ub,{className:`h-4 w-4`})})]}),(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4`,children:(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(`specView.artifactPanel.noSnapshot`)})})]});let F=qhe(e),I=e.tickets.length>0,L=e.bundle_groups.length>0,R=e.dependencies.length>0,z=e.open_questions.length>0,ee=e.assumptions.length>0;return(0,X.jsxs)(`aside`,{ref:s,style:n?{"--spec-artifact-panel-width":`${n}px`}:void 0,className:n?`xl:w-[var(--spec-artifact-panel-width)] ${P}`:P,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border/50 px-4 py-3`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:c(`specView.artifactPanel.title`)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a&&(0,X.jsx)(ige,{review:a}),(0,X.jsx)(Q,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`text-muted-foreground hover:text-foreground`,"aria-label":c(`specView.artifactPanel.close`),onClick:r,children:(0,X.jsx)(Ub,{className:`h-4 w-4`})})]})]}),(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4`,children:[a&&(a.review?.run||a.isRunning)&&(0,X.jsx)(rge,{review:a}),(0,X.jsx)(z5,{heading:c(`specView.artifactPanel.summary`),open:m,onOpenChange:h,children:(0,X.jsx)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover px-3 py-2`,children:(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-foreground whitespace-pre-wrap`,children:e.summary})})}),e.mermaid&&(0,X.jsx)(z5,{heading:c(`specView.artifactPanel.visualization`),open:g,onOpenChange:_,children:(0,X.jsx)(`section`,{className:`overflow-auto rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,X.jsx)(UW,{mermaid:e.mermaid,onClick:()=>{M(e.mermaid)}})})}),e.mockup&&(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Zhe,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.uiMockup`)]}),open:v,onOpenChange:y,children:(0,X.jsx)(`section`,{className:`rounded-md border border-border/50 bg-surface-hover p-3`,children:(0,X.jsx)(sG,{html:e.mockup,onClick:N})})}),F&&(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Sv,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.likelyFiles`)]}),open:b,onOpenChange:x,children:(0,X.jsx)(Xhe,{snapshot:e,onMermaidClick:M})}),I&&!L&&(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(L5,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.proposedTickets`)]}),open:S,onOpenChange:C,children:(0,X.jsx)(`section`,{children:(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:e.tickets.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(B5,{ticket:e})},e.key))})})}),L&&(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Vv,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.bundleGroups`)]}),open:w,onOpenChange:T,children:(0,X.jsx)($he,{snapshot:e})}),R&&(0,X.jsx)(z5,{heading:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(ww,{className:`h-3.5 w-3.5`}),c(`specView.artifactPanel.dependencies`)]}),open:E,onOpenChange:D,children:(0,X.jsx)(`section`,{children:(0,X.jsx)(`ul`,{className:`space-y-1`,children:e.dependencies.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`break-all font-mono text-violet-400`,children:e.blocker_key}),(0,X.jsx)(`span`,{children:`→`}),(0,X.jsx)(`span`,{className:`break-all font-mono text-violet-400`,children:e.dependent_key})]},t))})})}),z&&(0,X.jsx)(z5,{heading:c(`specView.artifactPanel.openQuestions`),open:O,onOpenChange:k,children:(0,X.jsx)(`section`,{children:(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:e.open_questions.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex gap-2 text-sm text-amber-300`,children:[(0,X.jsx)(`span`,{className:`mt-0.5 shrink-0 text-amber-500`,children:`?`}),(0,X.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]},t))})})}),ee&&(0,X.jsx)(z5,{heading:c(`specView.artifactPanel.assumptions`),open:A,onOpenChange:j,children:(0,X.jsx)(`section`,{children:(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:e.assumptions.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex gap-2 text-sm text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`mt-0.5 shrink-0 text-violet-500`,children:`•`}),(0,X.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]},t))})})})]}),i&&(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border/50 bg-surface/95 px-4 py-3 backdrop-blur`,children:[e.tickets.length>0&&(0,X.jsx)(Qhe,{actions:i}),(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:i.onImplementInChat,disabled:!!(i.unavailableReason||i.implementInChatUnavailableReason)||i.isCreatingTickets||i.isImplementingInChat||i.isExporting,title:i.unavailableReason??i.implementInChatUnavailableReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(AE,{className:`h-3.5 w-3.5`}),i.isImplementingInChat?c(`specView.actions.startingImplementation`):c(`specView.actions.implementInChat`)]}),(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`outline`,onClick:i.onExport,disabled:!!i.unavailableReason||i.isCreatingTickets||i.isImplementingInChat||i.isExporting,title:i.unavailableReason??void 0,className:`w-full justify-center gap-1.5`,children:[(0,X.jsx)(Qy,{className:`h-3.5 w-3.5`}),i.isExporting?c(`specView.actions.exportingSpec`):c(`specView.actions.exportSpec`)]})]}),l&&(0,X.jsx)(iG,{mermaid:l,open:!0,onClose:()=>{u(null)}}),e.mockup&&(0,X.jsx)(cG,{html:e.mockup,open:d,onClose:()=>{f(!1)}})]})})),H5=({className:e})=>(0,X.jsx)(Jee,{"aria-hidden":`true`,className:e}),U5=(e,t)=>{if(!e||e.length===0)return!1;let n=e[e.length-1];return n?.kind===`grill-question`?t===null||n.created_at>t:!1},W5=(e,t)=>jb.t(`specView.${e}`,t),G5=e=>W5(`pendingMemorySuggestions`,{count:e}),K5=1500,q5=`archon.spec-draft`,J5=`archon.spec-run-config`,Y5=`archon.spec-review-run-config`,X5=`archon.spec-session-list-layout`,Z5=`archon.spec-artifact-panel-layout`,oge=`archon.spec-import-notice`,Q5=420,$5=320,e7=.5,sge=6,t7=`/`,cge=`Slash`,lge=`NumpadDivide`,uge=e=>!e.defaultPrevented&&!e.altKey&&!e.repeat&&(e.ctrlKey||e.metaKey)&&(e.key===t7||e.code===cge||e.code===lge),n7=({modifierLabel:e,keys:t,ariaHidden:n=!1})=>(0,X.jsxs)(`span`,{"aria-hidden":n,className:`flex items-center gap-0.5 text-[10px] leading-none`,children:[(0,X.jsx)(WY,{"aria-hidden":n,children:e}),t.map(e=>(0,X.jsxs)(`span`,{className:`contents`,children:[(0,X.jsx)(`span`,{children:`+`}),(0,X.jsx)(WY,{"aria-hidden":n,children:e})]},e))]}),dge=({label:e,modifierLabel:t,keys:n})=>(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(n7,{modifierLabel:t,keys:n,ariaHidden:!0})]}),r7=({projectId:e,tool:t,sessionId:n=null})=>e?n?`${q5}/${e}/sessions/${n}`:`${q5}/${e}/draft/${t}`:null,i7=({projectId:e,sessionId:t})=>e&&t?`${oge}/${e}/${t}`:null,a7=({projectId:e,tool:t})=>{if(e)try{localStorage.setItem(`${q5}/${e}/tool`,t)}catch{}},o7=e=>{if(!e)return{isOpen:!0};try{let t=localStorage.getItem(`${X5}/${e}`);return{isOpen:(t?JSON.parse(t):null)?.isOpen??!0}}catch{return{isOpen:!0}}},fge=({projectId:e,isOpen:t})=>{if(e)try{localStorage.setItem(`${X5}/${e}`,JSON.stringify({isOpen:t}))}catch{}},s7=(e,t)=>{let n=Number.isFinite(e)?Math.round(e):Q5;if(!Number.isFinite(t))return Math.max($5,n);let r=Math.max($5,Math.round(t*e7));return Math.max($5,Math.min(r,n))},c7=e=>{if(!e)return{isOpen:!1,width:Q5};try{let t=localStorage.getItem(`${Z5}/${e}`);if(!t)return{isOpen:!1,width:Q5};let n=JSON.parse(t),r=typeof n.width==`number`&&Number.isFinite(n.width)?Math.max($5,Math.round(n.width)):Q5;return{isOpen:n.isOpen===!0,width:r}}catch{return{isOpen:!1,width:Q5}}},pge=({projectId:e,isOpen:t,width:n})=>{if(e)try{localStorage.setItem(`${Z5}/${e}`,JSON.stringify({isOpen:t,width:n}))}catch{}},mge=e=>{if(!e)return null;try{return localStorage.getItem(e)}catch{return null}},l7=({storageKey:e,value:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,t)}catch{}},hge=e=>{if(!e)return null;try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},u7=({storageKey:e,notice:t})=>{if(e)try{if(!t){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify(t))}catch{}},gge=e=>{if(!e)return null;let t=e.skipped.reduce((e,t)=>e+t.count,0),n=e.skipped.map(e=>W5(`importNotice.skipReasons.${e.code}`,{count:e.count})).join(`, `);return e.imported_count>0&&t>0?W5(`importNotice.importedWithSkips`,{importedCount:e.imported_count,skippedCount:t,skippedSummary:n}):e.imported_count>0?W5(`importNotice.importedOnly`,{importedCount:e.imported_count}):t>0?W5(`importNotice.skippedOnly`,{skippedCount:t,skippedSummary:n}):null},d7=({keyPrefix:e,projectId:t,tool:n})=>`${e}:${t}:${n}`,_ge=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t):[],f7=({keyPrefix:e,projectId:t,tool:n})=>{if(!t||n!==`opencode`&&n!==`claude`)return null;try{let r=window.localStorage.getItem(d7({keyPrefix:e,projectId:t,tool:n}));if(!r)return null;let i=JSON.parse(r),a=(typeof i.model==`string`?i.model.trim():``)||null;return a?{model:a,variant:a&&typeof i.variant==`string`&&i.variant.trim()||null,skills:_ge(i.skills)}:null}catch{return null}},p7=({keyPrefix:e,projectId:t,tool:n,model:r,variant:i,skills:a})=>{if(!(!t||n!==`opencode`&&n!==`claude`||!r))try{let o={model:r,variant:r?i:null,...a?{skills:a}:{}};window.localStorage.setItem(d7({keyPrefix:e,projectId:t,tool:n}),JSON.stringify(o))}catch{}},m7=({projectId:e,tool:t})=>f7({keyPrefix:J5,projectId:e,tool:t}),h7=({projectId:e,tool:t,model:n,variant:r,skills:i})=>p7({keyPrefix:J5,projectId:e,tool:t,model:n,variant:r,skills:i}),vge=({projectId:e,tool:t})=>{let n=m7({projectId:e,tool:t});!n||n.skills.length===0||h7({projectId:e,tool:t,...n,skills:[]})},yge=({projectId:e,tool:t})=>f7({keyPrefix:Y5,projectId:e,tool:t}),bge=({projectId:e,tool:t,model:n,variant:r})=>p7({keyPrefix:Y5,projectId:e,tool:t,model:n,variant:r}),xge=({projectId:e,tool:t})=>{if(e)try{window.localStorage.removeItem(d7({keyPrefix:Y5,projectId:e,tool:t}))}catch{}},Sge=`archon.spec-draft-grill`,g7=e=>e?`${Sge}/${e}`:null,_7=e=>{let t=g7(e);if(!t)return!1;try{return window.localStorage.getItem(t)===`true`}catch{return!1}},v7=({projectId:e,grillOn:t})=>{let n=g7(e);if(n)try{t?window.localStorage.setItem(n,`true`):window.localStorage.removeItem(n)}catch{}},Cge=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c=async()=>!1,onSelectRepoRootTarget:l=async()=>!1,onRestoreSessionTarget:u,activeTool:d,routedSpecSessionId:f,routedSpecSnapshotId:m,initialIssueDraft:h=null,onRoutedSpecNavigationUnavailable:g,onSessionNavigation:_,onInitialIssueDraftConsumed:v,onImplementInChat:y,onNavigateToLifecycleSource:b})=>{let x=lq(),{t:S}=K(`common`),{jiraImportState:C,prepareSpecImportFromJira:w}=Mw(e),{gitHubImportState:T,prepareSpecImportFromGitHub:E}=ew(e),[D,O]=(0,p.useState)([]),[k,A]=(0,p.useState)(null),[j,M]=(0,p.useState)(null),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(null),[z,ee]=(0,p.useState)({}),[B,V]=(0,p.useState)({}),[te,H]=(0,p.useState)(null),[U,ne]=(0,p.useState)({}),[re,ie]=(0,p.useState)({}),[ae,oe]=(0,p.useState)([]),[W,se]=(0,p.useState)(``),[ce,le]=(0,p.useState)(``),[ue,de]=(0,p.useState)([]),[fe,pe]=(0,p.useState)(!1),[me,he]=(0,p.useState)(!1),[ge,_e]=(0,p.useState)(!1),[ve,ye]=(0,p.useState)(!1),[be,xe]=(0,p.useState)(!1),[Se,Ce]=(0,p.useState)(null),[we,Te]=(0,p.useState)(null),[Ee,De]=(0,p.useState)([]),[Oe,ke]=(0,p.useState)(()=>new Set),[Ae,je]=(0,p.useState)(!1),[Me,Ne]=(0,p.useState)(()=>new Set),[Pe,Fe]=(0,p.useState)(!1),[Ie,Le]=(0,p.useState)(()=>o7(e).isOpen),[Re,ze]=(0,p.useState)(0),[G,Be]=(0,p.useState)(null),[Ve,He]=(0,p.useState)(()=>new Set),[Ue,We]=(0,p.useState)(null),[Ge,q]=(0,p.useState)(null),[Je,J]=(0,p.useState)(!1),[Xe,Ze]=(0,p.useState)(()=>c7(e).isOpen),[Y,Qe]=(0,p.useState)(()=>c7(e).width),[$e,et]=(0,p.useState)(!1),[tt,nt]=(0,p.useState)(!1),[rt,it]=(0,p.useState)(!1),[at,ot]=(0,p.useState)(!1),[st,ct]=(0,p.useState)(!1),[lt,ut]=(0,p.useState)(null),[dt,ft]=(0,p.useState)(!1),[pt,mt]=(0,p.useState)(null),[ht,gt]=(0,p.useState)(()=>_7(e)),[_t,vt]=(0,p.useState)(!1),[yt,bt]=(0,p.useState)([]),[xt,St]=(0,p.useState)(!1),[Ct,wt]=(0,p.useState)(!1),[Tt,Et]=(0,p.useState)(0),[Dt,Ot]=(0,p.useState)(null),[kt,At]=(0,p.useState)(!1),[jt,Mt]=(0,p.useState)(!1),[Nt,Pt]=(0,p.useState)(!1),[Ft,It]=(0,p.useState)(!1),[Lt,Rt]=(0,p.useState)(``),[zt,Bt]=(0,p.useState)(``),[Vt,Ht]=(0,p.useState)(!1),Ut=(0,p.useRef)(null),Wt=(0,p.useRef)(null),Gt=(0,p.useRef)(null),Kt=(0,p.useRef)(null),qt=(0,p.useRef)(null),Jt=(0,p.useRef)(null),Yt=(0,p.useRef)(!1),Xt=(0,p.useRef)(!1),Zt=(0,p.useRef)(0),Qt=(0,p.useRef)(Q5),$t=(0,p.useRef)(Q5),en=(0,p.useRef)(null),tn=(0,p.useRef)(null),nn=(0,p.useRef)(e),rn=(0,p.useRef)(new Set),an=(0,p.useRef)(0),on=(0,p.useRef)(0),sn=(0,p.useRef)(f),cn=(0,p.useRef)(!1),ln=(0,p.useRef)(!1),un=(0,p.useRef)(!1),dn=(0,p.useRef)({}),fn=(0,p.useRef)({}),pn=(0,p.useRef)({}),mn=(0,p.useRef)(new Set),hn=(0,p.useRef)(new Set),gn=(0,p.useRef)(0),_n=(0,p.useRef)({id:null,status:null}),vn=(0,p.useRef)(new Map),yn=(0,p.useRef)(!1),bn=(0,p.useRef)(!1),xn=(0,p.useRef)(()=>{}),Sn=m===void 0?Ge:m;nn.current=e,sn.current=f,tn.current=j;let Cn=e?r7({projectId:e,tool:F?d:j?.tool??d,sessionId:j?.id??null}):null,wn=i7({projectId:e,sessionId:j?.id??null}),Tn=Cn?z[Cn]??``:``,En=j?B[wn??``]??null:te,Dn=F?d:j?.tool??d,On=(0,p.useMemo)(()=>j?U[j.id]??[]:[],[j,U]),kn=(0,p.useMemo)(()=>j?re[j.id]??0:0,[j,re])>0,{models:An,isLoading:jn}=ZP(Dn),Mn=(0,p.useCallback)(()=>{de(e=>e.length===0?e:[]),vge({projectId:e,tool:d})},[e,d]);(0,p.useEffect)(()=>{cn.current=F},[F]),(0,p.useEffect)(()=>{dn.current=z},[z]),(0,p.useEffect)(()=>{fn.current=B},[B]),(0,p.useEffect)(()=>{pn.current=U},[U]),(0,p.useEffect)(()=>{if(!Cn||mn.current.has(Cn))return;mn.current.add(Cn);let e=mge(Cn);e&&ee(t=>Object.prototype.hasOwnProperty.call(t,Cn)?t:{...t,[Cn]:e})},[Cn]),(0,p.useEffect)(()=>{if(!wn||hn.current.has(wn))return;hn.current.add(wn);let e=hge(wn);e&&V(t=>({...t,[wn]:e}))},[wn]),(0,p.useEffect)(()=>{!Cn||!Object.prototype.hasOwnProperty.call(z,Cn)||l7({storageKey:Cn,value:z[Cn]??``})},[Cn,z]),(0,p.useEffect)(()=>{!wn||!Object.prototype.hasOwnProperty.call(B,wn)||u7({storageKey:wn,notice:B[wn]??null})},[wn,B]),(0,p.useEffect)(()=>{en.current=k},[k]),(0,p.useEffect)(()=>{let t=Sn??j?.latest_snapshot_id;if(!j?.id||!t||!e){We(null),ft(!1),Ze(!1);return}let n=new AbortController;return J(!0),XM(e,j.id,t,n.signal).then(e=>{if(!n.signal.aborted){if(Sn&&e.spec_session_id!==j.id){We(null),ft(!1),g?.();return}We(e),ft((e.created_ticket_ids?.length??0)>0),Ze(!0)}}).catch(e=>{n.signal.aborted||(We(null),ft(!1),Sn&&e instanceof Ke&&e.status===404?g?.():$.error(e instanceof Error?e.message:W5(`errors.loadSession`)))}).finally(()=>{n.signal.aborted||J(!1)}),()=>{n.abort()}},[j?.latest_snapshot_id,j?.id,e,Sn,g]);let Nn=Ue?.id??null,Pn=j?.id??null;(0,p.useEffect)(()=>{if(!e||!Pn||!Nn){Ot(null);return}let t=new AbortController;return At(!0),O5(e,Pn,Nn,t.signal).then(e=>{t.signal.aborted||Ot(e)}).catch(()=>{t.signal.aborted||Ot(null)}).finally(()=>{t.signal.aborted||At(!1)}),()=>{t.abort()}},[e,Pn,Nn]);let Fn=(0,p.useCallback)(()=>{!e||!Pn||!Nn||O5(e,Pn,Nn).then(Ot).catch(()=>{})},[e,Pn,Nn]);(0,p.useEffect)(()=>{pge({projectId:e,isOpen:Xe,width:Y})},[e,Xe,Y]),(0,p.useEffect)(()=>{if(!(f===void 0||!me)){if(!f){cn.current||Mn(),Ce(null),A(null),M(null),q(null),I(!0);return}if(!(D.some(e=>e.id===f)||j?.id===f)){$.error(W5(`errors.initialSessionMissing`)),ln.current=!0,A(null),M(null),I(!1),g?.();return}k!==f&&(Ce(null),A(f),M(null),I(!1),ln.current=!0)}},[j?.id,k,me,g,Mn,f,D]),(0,p.useEffect)(()=>{$e||($t.current=Y,Gt.current&&(Gt.current.style.setProperty(`--spec-artifact-panel-width`,`${Y}px`),Gt.current.setAttribute(`data-desktop-width`,String(Y))))},[Y,$e]);let In=(0,p.useCallback)(async t=>{if(!e){O([]),pe(!1);return}pe(!me);try{let n=await RM(e,t);if(t?.aborted)return;O(K8(n)),he(!0);let r=new Set(n.map(e=>e.id));He(e=>{let t=new Set([...e].filter(e=>r.has(e)));return t.size===e.size?e:t})}catch(e){Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.loadSessions`))}finally{t?.aborted||pe(!1)}},[e,me]);(0,p.useEffect)(()=>{let e=vn.current,t=new Map,n=[];for(let r of D){let i=e.get(r.id)??null,a=r.agent_status??null;i===`running`&&(a===`done`||a===`error`)&&r.id!==k&&n.push(r),t.set(r.id,a)}vn.current=t,He(e=>{let t=new Set(e),r=!1,i=new Set(D.map(e=>e.id));for(let e of t)i.has(e)||(t.delete(e),r=!0);for(let e of D){let i=e.agent_status??null,a=n.some(t=>t.id===e.id);if((e.id===k||i!==`done`&&i!==`error`)&&t.delete(e.id)){r=!0;continue}a&&!t.has(e.id)&&(t.add(e.id),r=!0)}return r?t:e})},[e,k,D]);let Ln=(0,p.useCallback)(async(t,n)=>{if(!e)return;_e(!0);let r=an.current+1;an.current=r;let i=on.current;try{let a=await BM(e,t,n);if(n?.aborted)return;let o=on.current!==i,s=an.current===r,c=en.current===t&&!cn.current;if(!s||o||!c)return;M(a)}catch(e){e instanceof Ke&&e.status===404&&sn.current===t&&en.current===t?g?.():Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.loadSession`))}finally{n?.aborted||_e(!1)}},[e,g]),Rn=(0,p.useCallback)(e=>{O(t=>{let n=t.findIndex(t=>t.id===e.id);if(n===-1)return K8([...t,j5(e)]);let r=t.slice();return r[n]=j5(e),K8(r)})},[]),zn=(0,p.useCallback)((e,t)=>{O(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n[r];if(i.pending_memory_suggestion_count===t)return n;let a=[...n];return a[r]={...i,pending_memory_suggestion_count:t},a}),M(n=>!n||n.id!==e||n.pending_memory_suggestion_count===t?n:{...n,pending_memory_suggestion_count:t})},[]),Bn=(0,p.useCallback)(async(n,r)=>{if(!e||!t?.memory_enabled){bt([]),St(!1);return}St(!0);try{let t=await jr(e,null,r,void 0,n);if(r?.aborted)return;bt(t.suggestions),zn(n,t.suggestions.length)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.loadMemorySuggestions`))}finally{r?.aborted||St(!1)}},[t?.memory_enabled,e,zn]),Vn=(0,p.useCallback)(e=>{bt(t=>{let n=t.filter(t=>t.id!==e);return k&&zn(k,n.length),n}),Et(e=>e+1),In(),k&&Ln(k)},[k,Ln,In,zn]),Hn=(0,p.useCallback)(e=>!!(e.first_user_message_preview||e.last_user_message_at||e.messages?.some(e=>e.role===`user`)),[]),Un=(0,p.useCallback)(()=>({tool:d,mode:ht?`grill`:`standard`,model:An.length>0&&W||null,variant:An.length>0&&ce||null,skills:ae.length>0?ue:[]}),[d,ht,An.length,W,ce,ae.length,ue]),Wn=(0,p.useCallback)(()=>{cn.current=!0,en.current=null,I(!0),Mn(),A(null),q(null),M(null),We(null),R(null),H(null),Ce(null),Be(null)},[Mn]),Gn=(0,p.useCallback)(()=>{ve||be||(Wn(),_?.(null))},[ve,be,_,Wn]),Kn=(0,p.useMemo)(()=>YY(),[]),qn=(0,p.useMemo)(()=>(0,X.jsx)(n7,{modifierLabel:Kn,keys:[t7],ariaHidden:!0}),[Kn]),Jn=(0,p.useMemo)(()=>(0,X.jsx)(dge,{label:W5(`sidebar.newSessionTooltip`),modifierLabel:Kn,keys:[t7]}),[Kn]);(0,p.useEffect)(()=>{let t=t=>{if(uge(t)){if(!e||ve||be)return;t.preventDefault(),Gn(),ze(e=>e+1);return}};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,ve,be,Gn]);let Yn=(0,p.useCallback)(e=>{be||(Ce(null),en.current=e.id,cn.current=!1,A(e.id),q(null),I(!1),R(null),H(null),gn.current+=1,_?.(e.id))},[be,_]),Xn=(0,p.useCallback)(async r=>{if(!e)return!1;ut(r.id);try{let i=await BM(e,r.id);return Rn(i),en.current===i.id&&M(i),i.target_available===!1?($.error(i.target_unavailable_reason??W5(`targets.unavailable`)),!1):!t||i5({activeProject:t,activeProjectBranchState:n,session:i})?!0:u?await u(i):!1}catch(e){return Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.restoreTarget`)),!1}finally{ut(e=>e===r.id?null:e)}},[t,n,e,u,Rn]),Zn=(0,p.useCallback)(async t=>{if(e){Ce(t);try{await qM(e,t)}catch(e){Ce(e=>e===t?null:e),Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.stopSession`))}}},[e]);(0,p.useEffect)(()=>{if(!Se)return;let e=j?.id===Se?j:D.find(e=>e.id===Se)??null;(!e||e.agent_status!==`running`)&&Ce(null)},[j,Se,D]);let Qn=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ue)){it(!0);try{if(!await Xn(j))return;let t=await $M(e,j.id,Ue.id);ft(!0),$.success(W5(`actions.createTicketsSuccess`,{count:t.tickets.length})),In()}catch(e){if(Ye(e))return;if(qe(e,`existing_ticket_ids`)){ft(!0);return}$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{it(!1)}}},[e,j,Ue,In,Xn]),$n=(0,p.useCallback)(()=>{Qn()},[Qn]),er=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ue)&&y){ot(!0);try{if(!await Xn(j))return;let t=await eN(e,j.id,Ue.id);y(t.draft_text,t.spec_session_id,t.spec_snapshot_id)}catch(e){if(Ye(e))return;e instanceof Ke&&e.status===409&&await Ln(j.id),$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{ot(!1)}}},[e,j,Ue,Ln,y,Xn]),tr=(0,p.useCallback)(async t=>{let n=t?.projectId??e,r=t?.sessionId??j?.id,i=t?.snapshotId??Ue?.id;if(!(!n||!r||!i)){ct(!0);try{if(!j||j.id!==r||!await Xn(j))return;await QM(n,r,i,{overwrite:t?.overwrite}),mt(null),$.success(W5(`actions.exportSuccess`))}catch(e){if(Ye(e))return;if(e instanceof ZM){mt({path:e.conflictingPath,projectId:n,sessionId:r,snapshotId:i});return}e instanceof Ke&&e.status===409&&j&&await Ln(j.id),$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{ct(!1)}}},[e,j,Ue,Ln,Xn]),nr=(0,p.useCallback)(()=>{Jt.current?.(),Jt.current=null},[]),rr=(0,p.useCallback)(e=>{if(!Ut.current)return;let t=Ut.current.getBoundingClientRect().width,n=s7(e,t);$t.current=n,Gt.current&&(Gt.current.style.setProperty(`--spec-artifact-panel-width`,`${n}px`),Gt.current.setAttribute(`data-desktop-width`,String(n)))},[]),ir=(0,p.useCallback)(e=>{let t=Kt.current,n=qt.current,r=Yt.current;if(t!==null){if(Kt.current=null,qt.current=null,Yt.current=!1,et(!1),nt(!1),nr(),e!==null&&typeof Wt.current?.hasPointerCapture==`function`&&Wt.current.hasPointerCapture(e)&&typeof Wt.current.releasePointerCapture==`function`&&Wt.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;Qe($t.current),Ze(!0);return}Qe($t.current)}},[nr]),ar=(0,p.useCallback)((e,t)=>{if(Kt.current!==e)return;let n=t-Zt.current,r=Qt.current-n;if(qt.current===`collapsed`){if(!Yt.current&&r<sge)return;Yt.current||(Yt.current=!0,Xt.current=!0,nt(!0),et(!0))}rr(r)},[rr]),or=(0,p.useCallback)((e,t)=>{if(Kt.current===e){if(t!==null&&(qt.current===`inline`||Yt.current)){let e=t-Zt.current;rr(Qt.current-e)}ir(e)}},[ir,rr]),sr=(0,p.useCallback)(e=>{e.preventDefault(),Kt.current=e.pointerId,qt.current=Xe?`inline`:`collapsed`,Yt.current=!1,Xt.current=!1,Zt.current=e.clientX,Qt.current=Xe?$t.current:0,et(Xe),nr(),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId);let t=e=>{ar(e.pointerId,e.clientX)},n=e=>{or(e.pointerId,e.clientX)},r=e=>{or(e.pointerId,e.clientX)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,r),Jt.current=()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,r)}},[or,ar,Xe,nr]),cr=(0,p.useCallback)(e=>{ar(e.pointerId,e.clientX)},[ar]),lr=(0,p.useCallback)(e=>{or(e.pointerId,e.clientX)},[or]),ur=(0,p.useCallback)(e=>{or(e.pointerId,e.clientX)},[or]),dr=(0,p.useCallback)(e=>{Kt.current===e.pointerId&&ir(e.pointerId)},[ir]),fr=(0,p.useCallback)(()=>{Ze(!1)},[]),pr=(0,p.useCallback)(async()=>{if(!e||Ee.length===0)return;let t=Ee;ke(e=>{let n=new Set(e);for(let e of t)n.add(e);return n});let n=[],r=[];for(let i of t)try{await YM(e,i),r.push(i)}catch(e){Ye(e)||n.push(e instanceof Error?e.message:W5(`errors.deleteSession`))}if(ke(e=>{let n=new Set(e);for(let e of t)n.delete(e);return n}),De([]),xn.current(r),n.length>0){$.error(n.join(`
|
|
276
|
+
`));return}Ae&&(je(!1),Ne(new Set),$.success(W5(`toasts.deleteSelectedSuccess`,{count:t.length})))},[e,Ee,Ae]),mr=(0,p.useCallback)((t,n={})=>{let r=new Set(t);if(r.size===0)return;let i=en.current,a=n.preserveDraftRoute===!0,o=!!(a&&i&&r.has(i)&&sn.current===i),s=!!(!a&&i&&r.has(i)),c=s?D.find(e=>!r.has(e.id))??null:null;o&&(Mn(),_?.(null)),s&&(c||Mn(),_?.(c?.id??null));for(let t of r)l7({storageKey:r7({projectId:e,tool:d,sessionId:t}),value:``}),u7({storageKey:i7({projectId:e,sessionId:t}),notice:null});ne(e=>{let t={...e},n=!1;for(let e of r)Object.prototype.hasOwnProperty.call(t,e)&&(delete t[e],n=!0);return n?t:e}),V(t=>{let n={...t},i=!1;for(let t of r){let r=i7({projectId:e,sessionId:t});r&&Object.prototype.hasOwnProperty.call(n,r)&&(delete n[r],i=!0)}return i?n:t}),O(e=>{let t=e.filter(e=>!r.has(e.id));if(i&&r.has(i)){if(sn.current===i)return a?(A(null),M(null),q(null),I(!0),t):(A(null),M(null),q(null),I(c===null),t);let e=t[0]??null;A(e?.id??null),M(null),q(null),I(e===null)}return t}),He(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),Be(e=>e&&r.has(e.parentId)?null:e),Ce(e=>e&&r.has(e)?null:e),De(e=>e.filter(e=>!r.has(e))),ke(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e}),Ne(e=>{let t=new Set(e),n=!1;for(let e of r)t.delete(e)&&(n=!0);return n?t:e})},[e,d,_,Mn,D]),hr=(0,p.useCallback)((e,t)=>{mr([e],t)},[mr]);xn.current=mr;let gr=(0,p.useCallback)((e,t)=>{e&&ee(n=>n[e]===t?n:{...n,[e]:t})},[]),_r=(0,p.useCallback)((e,t)=>{ne(n=>{if(t.length===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:t}})},[]),vr=(0,p.useCallback)(e=>{ne(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),ie(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})},[]),yr=(0,p.useCallback)((e,t)=>{e&&V(n=>(n[e]??null)===t?n:{...n,[e]:t})},[]),br=(0,p.useCallback)(e=>{e&&(V(t=>!Object.prototype.hasOwnProperty.call(t,e)||t[e]===null?t:{...t,[e]:null}),u7({storageKey:e,notice:null}))},[]),xr=(0,p.useCallback)(t=>{if(e){if(t.spec_session){let n=r7({projectId:e,tool:t.spec_session.tool,sessionId:t.spec_session.id}),r=i7({projectId:e,sessionId:t.spec_session.id});gr(n,t.prompt_text),yr(r,t.import_notice),_r(t.spec_session.id,t.imported_attachments),Rn(t.spec_session),M(t.spec_session),A(t.spec_session.id),I(!1),R(null),H(null),ze(e=>e+1);return}R(t.external_source),H(t.import_notice),Mn(),I(!0),A(null),M(null),q(null),We(null),gr(r7({projectId:e,tool:d}),t.prompt_text),ze(e=>e+1)}},[e,d,Mn,gr,yr,_r,Rn]),Sr=(0,p.useCallback)(async({provider:e,issueReference:t})=>{let n=$.loading(W5(`toasts.importPreparing`));try{let r=e===`jira`?await w?.({issueReference:t,...Un()}):await E?.({issueReference:t,...Un()});if(!r)throw Error(W5(`toasts.importError`));return(r.import_notice?.skipped.reduce((e,t)=>e+t.count,0)??0)>0?$.warning(W5(`toasts.importPartialSuccess`),{id:n}):$.success(W5(`toasts.importSuccess`),{id:n}),r}catch(e){if(Ye(e))$.dismiss(n);else{let t=e instanceof Error&&e.message?e.message:W5(`toasts.importError`);$.error(t,{id:n})}throw e}},[Un,E,w]),Cr=(0,p.useMemo)(()=>[{key:`jira`,label:S(`jiraImportField.label`),placeholder:S(`jiraImportField.placeholder`),state:C,onImport:e=>Sr({provider:`jira`,issueReference:e})},{key:`github`,label:S(`githubImportField.label`),placeholder:S(`githubImportField.placeholder`),state:T,onImport:e=>Sr({provider:`github`,issueReference:e})}],[S,C,T,Sr]),wr=Cr.some(e=>e.state===`enabled`);(0,p.useEffect)(()=>{h&&(Sr({provider:h.external_source.provider,issueReference:h.external_source.external_key}).then(xr).catch(()=>void 0),v?.())},[h,Sr,xr,v]);let Tr=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ue)){Mt(!0);try{await Phe(e,j.id,Ue.id,{tool:j.tool,...Vt?{model:Lt||null,variant:zt||null}:{},skills:j.skills}),Vt&&bge({projectId:e,tool:j.tool,model:Lt||null,variant:zt||null}),Fn()}catch(e){if(Ye(e))return;e instanceof Ke&&e.status===409&&await Ln(j.id),$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{Mt(!1)}}},[e,j,Ue,Vt,Lt,zt,Fn,Ln]),Er=(0,p.useCallback)(async()=>{if(!(!e||!j||!Ue)){Pt(!0);try{await Fhe(e,j.id,Ue.id),Fn()}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{Pt(!1)}}},[e,j,Ue,Fn]),Dr=(0,p.useCallback)(async()=>{if(!e||!j||!Ue)return;let t=Dt?.run;if(t){It(!0);try{gr(Cn,(await Ihe(e,j.id,Ue.id,t.id)).draft_text),ze(e=>e+1)}catch(e){if(Ye(e))return;$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{It(!1)}}},[e,j,Ue,Dt,gr,Cn]),Or=(0,p.useCallback)(e=>{e&&(ee(t=>t[e]===``?t:{...t,[e]:``}),l7({storageKey:e,value:``}))},[]),kr=(0,p.useCallback)((e,t)=>{ie(n=>{let r=Math.max(0,(n[e]??0)+t);if(r===0){if(!Object.prototype.hasOwnProperty.call(n,e))return n;let t={...n};return delete t[e],t}return{...n,[e]:r}})},[]),Ar=(0,p.useCallback)(async t=>{if(!(!e||_t||bn.current)&&!(j&&j.agent_status===`running`)){if(!k||!j){gt(t),v7({projectId:e,grillOn:t});return}if(j.mode===(t?`grill`:`standard`)){gt(t);return}vt(!0);try{let n=await HM(e,j.id,{mode:t?`grill`:`standard`});M(n),Rn(n),gt(t),t||U5(n.messages,n.latest_snapshot_created_at)&&await UM(e,n.id,{instruction:W5(`grill.finalizePrompt`),tool:n.tool,model:An.length>0&&W||null,variant:An.length>0&&ce||null,skills:ae.length>0?ue:[]})}catch(e){Ye(e)||$.error(e instanceof Error?e.message:W5(`grill.updateModeError`))}finally{vt(!1)}}},[e,j,k,_t,Rn,An,W,ce,ae,ue]),Mr=(0,p.useCallback)(async()=>{if(!e||ve||be||yn.current||bn.current||t&&j&&!i5({activeProject:t,activeProjectBranchState:n,session:j}))return;let r=Tn.trim();if(!r&&On.length===0)return;xe(!0);let i=Cn,a=performance.now();gn.current+=1;let o=`spec:${gn.current}`;try{let t=k,n=!t,s=n;if(t&&!j){let r=await BM(e,t);r?s=r.messages?.length===0:(n=!0,s=!0,t=null)}else j&&(s=j.messages?.length===0);if(n){ye(!0);let n=await zM(e,{tool:d,mode:ht?`grill`:`standard`,model:An.length>0&&W||null,variant:An.length>0&&ce||null,skills:ae.length>0?ue:[],external_source:L??null});t=n.id,A(t),M(n),I(!1),_?.(t),R(null),gt(!1),v7({projectId:e,grillOn:!1}),a7({projectId:e,tool:d}),ye(!1)}if(!t)throw Error(`Unable to resolve the spec session.`);Ce(e=>e===t?null:e),Be({parentType:`spec`,parentId:t,turnKey:o,startedAt:a});let c=On.map(e=>e.id),l=await UM(e,t,{instruction:r,tool:j?.tool??d,model:W||null,variant:ce||null,skills:ue,attachment_ids:c.length>0?c:void 0});M(l),h7({projectId:e,tool:l.tool,model:l.model,variant:l.variant,skills:s?[]:l.skills}),ze(e=>e+1),vr(t),Or(i),br(i7({projectId:e,sessionId:t})),H(null)}catch(e){Be(e=>e?.turnKey===o?null:e);let t=qe(e,`spec_session`);t?(M(t),Rn(t)):e instanceof Ke&&e.status===409&&en.current&&await Ln(en.current),Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{xe(!1),ye(!1)}},[t,n,e,ve,be,Tn,On,Cn,k,j,d,ht,An,W,ce,ae,ue,L,Ln,Rn,vr,Or,br,_]),Nr=(0,p.useCallback)(async t=>{if(e){rn.current.add(t.id);try{await YM(e,t.id),hr(t.id,{preserveDraftRoute:!0}),Wn()}catch(e){throw rn.current.delete(t.id),e}}},[e,Wn,hr]),Pr=(0,p.useCallback)(async t=>{if(!e||Dn!==`opencode`&&Dn!==`claude`)return;let n=k,r=null;if(!n&&t.length>0)try{ye(!0);let t=await zM(e,{tool:d,mode:ht?`grill`:`standard`,model:An.length>0&&W||null,variant:An.length>0&&ce||null,skills:ae.length>0?ue:[],external_source:L??null});r=t,n=t.id,A(n),M(t),I(!1),_?.(n),a7({projectId:e,tool:d})}catch(e){Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.upload`));return}finally{ye(!1)}if(n){kr(n,t.length);try{let r=await GM(e,n,t),i=[...pn.current[n]??[],...r.attachments];_r(n,i)}catch(e){if(r&&!Tn.trim())try{await Nr(r)}catch{}Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.upload`))}finally{kr(n,-t.length)}}},[e,k,d,Dn,An,W,ce,ae,ue,ht,L,Tn,Nr,kr,_,_r]),Fr=(0,p.useCallback)(async t=>{if(!e||!j)return;let n=j,r=n.id,i=(pn.current[r]??[]).filter(e=>e.id!==t);try{await KM(e,r,t),_r(r,i),i.length===0&&!Tn.trim()&&(n.messages?.length??0)===0&&await Nr(n)}catch(e){Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.removeAttachment`))}},[e,j,Nr,Tn,_r]);(0,p.useEffect)(()=>{G&&(G.parentId===k&&(be||we===k||j?.agent_status===`running`)||Be(null))},[j?.agent_status,k,be,G,we]),(0,p.useEffect)(()=>{if(!un.current){un.current=!0;return}let t=o7(e),n=c7(e);cn.current=!1,ln.current=!1,mn.current=new Set,hn.current=new Set,A(null),M(null),q(null),We(null),I(!1),R(null),ee({}),V({}),H(null),ne({}),ie({}),rn.current.clear(),Ce(null),De([]),ke(new Set),je(!1),Ne(new Set),Be(null),bt([]),St(!1),wt(!1),he(!1),He(new Set),vn.current=new Map,$t.current=n.width,Le(t.isOpen),Qe(n.width),Ze(n.isOpen),gt(_7(e)),vt(!1)},[e]);let Ir=(0,p.useCallback)((e,t)=>{Ne(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,p.useEffect)(()=>{let e=new AbortController;return In(e.signal),()=>{e.abort()}},[In]),(0,p.useEffect)(()=>{if(f!==void 0||cn.current||F||k||ln.current||D.length===0||t?.active_target_kind!==`bundle`&&n?.status===`loading`)return;let e=t?D.find(e=>i5({activeProject:t,activeProjectBranchState:n,session:e}))??null:D[0]??null;ln.current=!0,e&&A(e.id)},[t,n,k,F,f,D]),(0,p.useEffect)(()=>{if(Dn!==`opencode`&&Dn!==`claude`){oe([]),Fe(!1);return}if(Dn!==`opencode`){oe([]);return}let t=new AbortController;return(async()=>{Fe(!0);try{oe(await QP(Dn,t.signal,e))}catch(e){Ye(e)||oe(e=>e)}finally{t.signal.aborted||Fe(!1)}})(),()=>{t.abort()}},[e,Dn]),(0,p.useEffect)(()=>{if(Dn!==`opencode`&&Dn!==`claude`){se(``),le(``),de([]);return}if(F){let t=m7({projectId:e,tool:Dn}),n=new Set(An.map(e=>e.id)),r=t?.model??``,i=r&&(n.size===0||n.has(r)),a=An.find(e=>e.id===r)??null,o=t?.variant??``,s=!a||a.variants.includes(o),c=new Set(ae.map(e=>e.name));se(i?r:``),le(e=>!i||!s?``:o||e),de(Dn===`opencode`?(t?.skills??[]).filter(e=>c.has(e)):[]);return}se(j?.model??``),le(j?.variant??``),de(j?.skills??[])},[e,j?.id,j?.model,j?.skills,j?.variant,An,ae,Dn,F]),(0,p.useEffect)(()=>{if(F||!k){M(null);return}if(j?.id===k)return;M(null);let e=new AbortController;return Ln(k,e.signal),()=>{e.abort()}},[j,k,F,Ln]),(0,p.useEffect)(()=>{wt(!1)},[k,F]),(0,p.useEffect)(()=>{if(!t?.memory_enabled||F||!k){bt([]),St(!1);return}let e=new AbortController;return Bn(k,e.signal),()=>{e.abort()}},[t?.memory_enabled,k,F,Bn,Tt]),(0,p.useEffect)(()=>{!Ct||xt||yt.length>0||wt(!1)},[xt,Ct,yt.length]),(0,p.useEffect)(()=>{let e=_n.current,n=j?.id??null,r=j?.agent_status??null;e.id===n&&e.status===`running`&&r===`done`&&t?.memory_enabled&&n&&Et(e=>e+1),_n.current={id:n,status:r}},[t?.memory_enabled,j?.agent_status,j?.id]),(0,p.useEffect)(()=>{if(!k||j?.agent_status!==`running`)return;let e=new AbortController,t=null,n=async()=>{await Promise.allSettled([In(e.signal),Ln(k,e.signal)]),e.signal.aborted||(t=window.setTimeout(()=>{n()},K5))};return t=window.setTimeout(()=>{n()},K5),()=>{e.abort(),t!==null&&window.clearTimeout(t)}},[j?.agent_status,k,Ln,In]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{if(!(!t||t.project_id!==e)){if(!F&&t.id===en.current){let e=tn.current;(t.messages!==void 0||e?.id===t.id&&e.messages!==void 0)&&(on.current+=1),M(e=>Whe(e,t))}Hn(t)&&Rn(t)}},n=t=>{if(!t||t.project_id!==e)return;let n=rn.current.delete(t.id);hr(t.id,n?{preserveDraftRoute:!0}:void 0)},r=()=>{In();let e=en.current;e&&!cn.current&&Ln(e)};return x.on(`connect`,r),x.on(`spec-session:created`,t),x.on(`spec-session:updated`,t),x.on(`spec-session:deleted`,n),()=>{x.off(`connect`,r),x.off(`spec-session:created`,t),x.off(`spec-session:updated`,t),x.off(`spec-session:deleted`,n)}},[e,F,Ln,In,Hn,Rn,hr,x]),(0,p.useEffect)(()=>{if(!e||!Nn)return;let t=e=>{!e||e.spec_snapshot_id!==Nn||Fn()};return x.on(`spec-review:updated`,t),()=>{x.off(`spec-review:updated`,t)}},[e,Nn,Fn,x]);let Lr=(0,p.useMemo)(()=>q8(D),[D]),Rr=(0,p.useMemo)(()=>{let e=new Set(Lr.find(e=>e.key===`older`)?.sessions.map(e=>e.id)??[]);return[{key:`unavailable`,label:W5(`sidebar.presets.unavailable`),matches:e=>e.target_available===!1},{key:`older`,label:W5(`sidebar.presets.older`),matches:t=>e.has(t.id)}]},[Lr]),zr=(0,p.useCallback)(e=>{e.key!==`Enter`||e.shiftKey||j?.agent_status===`running`||ve||be||kn||yn.current||bn.current||(e.preventDefault(),Mr())},[Mr,j?.agent_status,ve,be,kn]),Br=(0,p.useCallback)(t=>{if(!e||Dn!==`opencode`&&Dn!==`claude`)return;let n=Array.from(t.clipboardData.files).filter(e=>e.type.startsWith(`image/`));n.length!==0&&(t.preventDefault(),Pr(n))},[e,Dn,Pr]),Vr=(0,p.useMemo)(()=>X8(An),[An]),Hr=(0,p.useMemo)(()=>j?Q8({modelLabel:Z8({availableModelsById:Vr,model:j.model}),tool:j.tool}):null,[j,Vr]),Ur=(0,p.useMemo)(()=>j?.messages?j.messages.map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,attachments:e.attachments??[],responseTiming:e.response_timing?GK(e.response_timing):null,transcript_runs:e.transcript_runs??null,metadata:e.metadata,created_at:e.created_at,displayTitle:e.role===`assistant`?Hr??Y8(j.tool):$8()})):[],[j?.messages,j?.tool,Hr]),Wr=k!==null||F,Gr=F?null:j,Kr=Gr?.target_available===!1,qr=!!(t&&Gr&&!Kr&&!i5({activeProject:t,activeProjectBranchState:n,session:Gr})),Jr=qr&&Gr?W5(`targets.mismatchReason`,{sessionTarget:o5(Gr),currentTarget:s5({activeProject:t,activeProjectBranchState:n})}):null,Yr=Kr?Gr?.target_unavailable_reason??W5(`targets.unavailable`):null,Xr=Kr||qr,Zr=Gr?.streaming_response??null,Qr=Gr?.agent_status===`running`,$r=!!(be&&G?.parentType===`spec`&&G.parentId===k),ei=Qr||$r,ti=ei?Hr:null,ni=Qr&&Se===k,ri=Gr?.agent_status===`stopped`&&Gr.can_resume,ii=ri&&we===k,ai=!!e&&!ve&&(F||k!==null&&!Xr),oi=!!(t?.memory_enabled&&j&&!F&&(j.pending_memory_suggestion_count>0||xt)),si=(Dn===`opencode`||Dn===`claude`)&&(F||k!==null)&&Gr?.agent_status!==`running`,ci=(0,p.useCallback)(async()=>{if(!e||!j||j.agent_status!==`stopped`||!j.can_resume||we===j.id)return;let t=j.id,n=e,r=on.current,i=performance.now();Te(t);let a=JM(e,t,W5(`errors.resumeSession`));gn.current+=1;let o={parentType:`spec`,parentId:t,turnKey:`spec:${gn.current}`,startedAt:i};Be(o);try{let e=await a;nn.current===n&&on.current===r&&(Rn(e),en.current===t&&!cn.current&&(on.current+=1,M(e)))}catch(e){Be(e=>e?.turnKey===o.turnKey?null:e);let i=qe(e,`spec_session`);i&&nn.current===n&&on.current===r?(Rn(i),en.current===t&&!cn.current&&(on.current+=1,M(i))):!i&&e instanceof Ke&&e.status===409&&nn.current===n&&en.current===t&&!cn.current&&await Ln(t),Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.resumeSession`))}finally{Te(e=>e===t?null:e)}},[e,j,Ln,we,Rn]),li=(0,p.useMemo)(()=>{if(!j?.messages)return null;for(let e=j.messages.length-1;e>=0;--e){let t=j.messages[e];if(t.kind===`grill-question`)return t.id}return null},[j]),ui=(0,p.useMemo)(()=>!j||j.mode!==`grill`?!1:U5(j.messages,j.latest_snapshot_created_at),[j]),di=(0,p.useMemo)(()=>[...j?.messages??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,[j]),fi=!!di,pi=ii||be||ve||kn||fi||ui||Xr||lt===k,mi=(0,p.useCallback)(async t=>{if(!e||!k||!j)return;xe(!0),gn.current+=1;let n={parentType:`spec`,parentId:k,turnKey:`spec:${gn.current}`,startedAt:performance.now()};Be(n);try{M(await UM(e,k,{instruction:t,tool:j.tool,model:An.length>0&&W||null,variant:An.length>0&&ce||null,skills:ae.length>0?ue:[]})),ze(e=>e+1)}catch(e){Be(e=>e?.turnKey===n.turnKey?null:e),Ye(e)||$.error(e instanceof Error?e.message:W5(`errors.sendPrompt`))}finally{xe(!1)}},[e,k,j,An,W,ce,ae,ue]),hi=(0,p.useCallback)(async(t,n)=>{if(!e||!j||N)return;let r=WJ({parentType:`spec`,parentId:j.id,setId:n.set_id});P(n.set_id),xe(!0),gn.current+=1;let i={parentType:`spec`,parentId:j.id,turnKey:`spec:${gn.current}`,startedAt:performance.now()};Be(i);try{let r=await WM(e,j.id,t,n);M(r),Rn(r)}catch(e){if(e instanceof Ke&&e.status===409){KJ(r);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?(M(t),Rn(t)):await Ln(j.id)}throw Be(e=>e?.turnKey===i.turnKey?null:e),$.error(e instanceof Error?e.message:W5(`errors.resolveQuestions`)),e}finally{P(null),xe(!1)}},[e,j,Ln,N,Rn]),gi=(0,p.useCallback)(e=>{if(e.role!==`assistant`)return;let t=e.metadata,n=t?.ask_question;if(n&&j)return(0,X.jsx)($J,{messageContent:e.content,questionSet:n,storageKey:WJ({parentType:`spec`,parentId:j.id,setId:n.id}),isActive:n.status===`pending`&&di?.id===e.id,isDisabled:Xr||j.agent_status===`running`||N===n.id,onResolve:t=>hi(e.id,t)});if(e.kind!==`grill-question`)return;let r=t?.grill_question;if(r)return(0,X.jsx)(k5,{question:r,isActive:ei?!1:e.id===li&&j?.agent_status!==`running`&&j?.mode===`grill`,isDisabled:Xr||be||ve||_t,labels:{rationaleLabel:W5(`grill.rationaleLabel`),suggestionsLabel:W5(`grill.suggestionsLabel`),recommendedSuggestionLabel:W5(`grill.recommendedSuggestionLabel`),answerPlaceholder:W5(`grill.answerPlaceholder`),submitLabel:W5(`grill.submitLabel`),submittingLabel:W5(`grill.submittingLabel`)},onSubmitAnswer:e=>{mi(e)}})},[j,ei,be,ve,Xr,_t,li,di?.id,hi,N,mi]),_i=(Dn===`opencode`||Dn===`claude`)&&An.length>0,vi=Dn,yi=F?W5(`composer.newSpecTitle`):j?.title??W5(`composer.specTitle`),bi=_i?W||null:j?.model??null,xi=Z8({availableModelsById:Vr,model:bi}),Si=j?.agent_status===`stopped`,Ci=W5(`composer.placeholderSpec`),wi=D.some(e=>e.agent_status!==`running`),Ti=(0,p.useMemo)(()=>({ariaLabel:W5(`sidebar.ariaLabel`),newSession:W5(`sidebar.newSession`),collapseAriaLabel:W5(`sidebar.collapseAriaLabel`),openAriaLabel:W5(`sidebar.openAriaLabel`),cancelSelection:W5(`sidebar.cancelSelection`),addPreset:W5(`sidebar.addPreset`),deleteSelected:W5(`sidebar.deleteSelected`),selectedCount:e=>`${e} selected`,select:W5(`sidebar.select`),loadingSessions:W5(`sidebar.loadingSessions`),noSessions:W5(`sidebar.noSessions`),deleteSessionAriaLabel:W5(`sidebar.deleteSessionAriaLabel`),selectSessionAriaLabel:e=>W5(`sidebar.selectSessionAriaLabel`,{title:e}),selectSessionTitle:e=>W5(`sidebar.selectSessionTitle`,{title:e}),deleteSessionTitle:e=>W5(`sidebar.deleteSessionTitle`,{title:e})}),[]),Ei=(0,p.useMemo)(()=>({title:W5(`deleteModal.title`),bulkTitle:W5(`deleteModal.bulkTitle`),description:W5(`deleteModal.description`),bulkDescription:e=>W5(`deleteModal.bulkDescription`,{count:e}),cancel:W5(`deleteModal.cancel`),delete:W5(`deleteModal.delete`),deleting:W5(`deleteModal.deleting`)}),[]),Di=(0,p.useCallback)((e,t)=>e.agent_status===`running`?`running`:!t&&Ve.has(e.id)?`finished`:null,[Ve]),Oi=(0,p.useCallback)(e=>e.agent_status===`running`?W5(`sidebar.cannotDeleteRunning`):null,[]),ki=!!(t?.memory_enabled&&k&&!F),Ai=(0,p.useCallback)(e=>{let r=a5({session:e,activeProject:t,activeProjectBranchState:n}),i=ki&&e.pending_memory_suggestion_count>0?G5(e.pending_memory_suggestion_count):null,a=(e.linked_ticket_count??0)+(e.linked_chat_count??0);return a>0?[e.title,r,i,W5(`sidebar.linkedImplementationsAriaLabel`,{itemCount:a})].filter(Boolean).join(` `):e.has_completed_work===1?[e.title,r,i,W5(`sidebar.linkedImplementationsAriaLabelHistorical`)].filter(Boolean).join(` `):[e.title,r,i].filter(Boolean).join(` `)},[t,n,ki]),ji=e=>{let t=e.first_user_message_preview??e.messages?.find(e=>e.role===`user`)?.content;return t&&t.replace(/\s+/g,` `).trim()||null},Mi=(0,p.useCallback)(({session:e,activityState:r})=>{let i=ji(e),a=a5({session:e,activeProject:t,activeProjectBranchState:n}),o=e.linked_ticket_count??0,s=e.linked_chat_count??0,c=o+s,l=e.has_completed_work===1||c>0,u=c>0,d=u?W5(`sidebar.linkedImplementationsTooltip`,{ticketCount:o,chatCount:s}):W5(`sidebar.linkedImplementationsTooltipHistorical`),f=ki&&e.pending_memory_suggestion_count>0;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,X.jsx)(`div`,{className:`mb-1 truncate text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground/75`,children:a}):null,(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 truncate text-[13px] font-medium leading-5`,children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.title}),f?(0,X.jsx)(Ww,{tone:`muted`,className:`shrink-0`,"aria-label":G5(e.pending_memory_suggestion_count),title:G5(e.pending_memory_suggestion_count),children:e.pending_memory_suggestion_count}):null,l&&(0,X.jsx)(lv,{content:d,children:(0,X.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 text-[11px] text-indigo-500 dark:text-indigo-400`,children:[(0,X.jsx)(wF,{className:`size-3`}),u&&(0,X.jsx)(`span`,{children:c})]})})]}),i?(0,X.jsx)(`div`,{className:`mt-0.5 line-clamp-1 text-xs leading-4 text-muted-foreground`,children:i}):null,e.target_available===!1?(0,X.jsx)(`div`,{className:`mt-1 line-clamp-1 text-[11px] leading-4 text-amber-200/90`,children:e.target_unavailable_reason??W5(`targets.unavailable`)}):null]}),(0,X.jsx)(Hy,{state:r,className:`mt-1`})]})},[t,n,ki]),Ni=Qr?(0,X.jsx)(j8,{action:`interrupt`,isPending:ni,onAction:()=>{k&&Zn(k)},label:W5(`composer.interrupt`),pendingLabel:W5(`composer.interrupting`)}):ri?(0,X.jsx)(j8,{action:`resume`,isPending:ii,disabled:pi,onAction:()=>{ci()},label:W5(`composer.resume`),pendingLabel:W5(`composer.resuming`)}):null,Pi=(0,p.useMemo)(()=>An.find(e=>e.id===W)??null,[An,W]),Fi=({model:t=W,variant:n=ce,skills:r=ue}={})=>{F&&h7({projectId:e,tool:d,model:t||null,variant:t&&n||null,skills:d===`opencode`?r:[]})},Ii=Dn===`opencode`||Dn===`claude`?Pe||jn?(0,X.jsx)(_Y,{}):An.length>0?(0,X.jsx)(vY,{model:W,variant:ce,skills:ue,showModelSelector:!0,showSkillsSelector:ae.length>0,availableModels:An,availableSkills:ae,selectedModel:Pi,onModelChange:e=>{let t=An.find(t=>t.id===e)??null,n=t&&t.variants.includes(ce)?ce:``;se(e),le(n),Fi({model:e,variant:n})},onVariantChange:e=>{le(e),Fi({variant:e})},onSkillsChange:e=>{de(e),Fi({skills:e})},modelSelectId:`spec-model-select`,variantSelectId:`spec-variant-select`,skillsSelectId:`spec-skills-select`}):null:null,Li=(0,p.useMemo)(()=>Ee.length===1?D.find(e=>e.id===Ee[0])?.title??``:``,[Ee,D]),Ri=(0,p.useMemo)(()=>D.filter(e=>Ee.includes(e.id)),[D,Ee]),zi=Wr&&j!==null,Bi=zi&&!Xe&&!tt,Vi=zi&&(Xe||tt);(0,p.useEffect)(()=>{if(!Vi||$e||!Ut.current)return;let e=Ut.current,t=()=>{let t=e.getBoundingClientRect().width;if(t<=0)return;let n=s7(Y,t);$t.current=n,Gt.current&&(Gt.current.style.setProperty(`--spec-artifact-panel-width`,`${n}px`),Gt.current.setAttribute(`data-desktop-width`,String(n))),Qe(e=>e===n?e:n)};if(t(),typeof ResizeObserver!=`function`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[Y,Vi,$e]);let Hi=j?.tool??d,Ui=Hi===`opencode`&&An.length>0,Wi=(0,p.useMemo)(()=>An.find(e=>e.id===Lt)??null,[An,Lt]),Gi=(0,p.useCallback)(t=>{let n=An.find(e=>e.id===t)??null;Rt(t),Ht(!!t),t||xge({projectId:e,tool:Hi}),Bt(e=>n&&n.variants.includes(e)?e:``)},[e,An,Hi]),Ki=(0,p.useCallback)(e=>{Bt(e),Ht(!!Lt)},[Lt]),qi=(0,p.useMemo)(()=>Ue&&zi?{review:Dt,isRunning:jt||Nt,isLoading:kt,availableModels:An,showModelSelector:Ui,runConfigTool:Hi,runConfigModel:Lt,runConfigVariant:zt,selectedDiscoveredModel:Wi,onRunConfigModelChange:Gi,onRunConfigVariantChange:Ki,onLaunchReview:Tr,onStopReview:Er,onSendToPlanner:Dr,isSendingToPlanner:Ft,disabledReason:Yr??Jr}:void 0,[Jr,Ue,An,zi,Tr,Dr,Gi,Ki,Er,kt,Ft,jt,Nt,Dt,Lt,zt,Wi,Ui,Hi,Yr]),Ji=(0,p.useMemo)(()=>{if(Ue)return{onCreateTickets:$n,onImplementInChat:er,onExport:tr,isCreatingTickets:rt,isImplementingInChat:at,isExporting:st,hasExistingTicketsFromSnapshot:dt,unavailableReason:Yr,implementInChatUnavailableReason:Ue.bundle_groups.length>1?W5(`actions.implementInChatMultiBundleUnavailable`):null}},[Ue,$n,tr,er,dt,rt,st,at,Yr]);(0,p.useEffect)(()=>{if(Hi!==`opencode`){Rt(``),Bt(``),Ht(!1);return}let t=yge({projectId:e,tool:Hi}),n=t?.model??``;Rt(n),Bt(n?t?.variant??``:``),Ht(!!n)},[e,Hi]),(0,p.useEffect)(()=>{zi||(Kt.current=null,qt.current=null,Yt.current=!1,Xt.current=!1,et(!1),nt(!1),nr())},[zi,nr]),(0,p.useEffect)(()=>()=>{nr()},[nr]);let Yi=(0,X.jsx)(lv,{content:W5(`artifactPanel.open`),disabled:!Bi,side:`left`,children:(0,X.jsx)(`div`,{ref:Wt,className:Z(Bi?`group flex shrink-0 touch-none select-none items-center justify-center border-l border-border/70 bg-background/90 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground xl:w-7 xl:cursor-col-resize`:`group hidden w-5 shrink-0 cursor-col-resize touch-none select-none items-center justify-center border-l border-border/70 bg-background/80 transition-colors xl:flex`,$e&&!Bi&&`bg-background`),role:Bi?`button`:`separator`,tabIndex:Bi?0:void 0,"aria-label":W5(Bi?`artifactPanel.open`:`artifactPanel.resize`),"aria-valuemin":Bi?void 0:$5,"aria-valuemax":Bi?void 0:Ut.current?Math.round(Ut.current.clientWidth*e7):800,"aria-valuenow":Bi?void 0:Y,onClick:Bi?()=>{if(Xt.current){Xt.current=!1;return}Ze(!0)}:void 0,onPointerDown:sr,onPointerMove:cr,onPointerUp:lr,onPointerCancel:ur,onLostPointerCapture:dr,children:Bi?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`hidden h-full w-full items-center justify-center xl:flex`,children:(0,X.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-[2.65rem] items-center justify-center text-sky-400/80 transition-colors group-hover:text-sky-300`,children:(0,X.jsx)(H5,{className:`h-3 w-3 shrink-0`})}),(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 h-14 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-muted-foreground/70 transition-colors group-hover:bg-sky-300/90`})]})}),(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium xl:hidden`,children:[(0,X.jsx)(H5,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{children:W5(`artifactPanel.title`)})]})]}):(0,X.jsx)(`div`,{className:Z(`h-14 w-1.5 rounded-full transition-colors`,$e?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`)})})}),Xi=F&&wr?(0,X.jsx)(AY,{providers:Cr,onImported:xr,inputId:`spec-draft-external-import`,className:`max-w-md`,showImportSpinner:!0,showImportErrorToast:!1}):null,Zi=j?j.mode===`grill`:ht,Qi=ui;yn.current=Qi,bn.current=fi;let $i=(0,X.jsx)(A5,{on:Zi,disabled:_t||Qr||ve||be||fi||Xr,tooltipContent:W5(`grill.toggleTooltip`),ariaLabelOn:W5(`grill.toggleAriaLabelOn`),ariaLabelOff:W5(`grill.toggleAriaLabelOff`),onToggle:e=>{Ar(e)}}),ea=gge(En),ta=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[ea?(0,X.jsxs)(`div`,{className:`rounded-md border border-sky-500/30 bg-sky-500/10 px-3 py-2 text-sm text-sky-950 dark:text-sky-100`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:W5(`importNotice.title`)}),(0,X.jsx)(`div`,{children:ea})]}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[$i,Xi,Ni,F&&t&&(0,X.jsx)(Fy,{activeProject:t,branchState:n,bundles:r,branchSuggestions:i,isBundleLoading:a,isLoading:o,presentation:`composer`,closeAfterSelection:!0,triggerAriaLabel:jb.t(`common:projectTargetSelector.newSpecAriaLabel`),onOpenChange:s,onSelectBundle:c,onSelectRepoRoot:l})]})]}),na=Ii,ra=(0,p.useCallback)(t=>{j?br(i7({projectId:e,sessionId:j.id})):H(null),gr(Cn,t)},[j,e,Cn,gr,br]),ia=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(Uhe,{projectId:e,specSessionId:F?null:k,messages:Ur,internalLog:Gr?.agent_log??null,currentThinkingMessageId:Gr?.agent_message_id??null,previousThinkingLog:Gr?.previous_agent_log??null,previousThinkingMessageId:Gr?.previous_agent_message_id??null,pendingAgentTitle:ti,streamingResponse:Zr,isRunning:ei,isLoading:!F&&ge,canShowComposer:ai,isExternallyResizing:$e,layoutKey:j?.id??`spec-draft`,scrollLayoutKey:zi?Vi?`artifact-visible`:`artifact-hidden`:`artifact-disabled`,header:(0,X.jsx)(H8,{title:yi,tool:F?null:j?.tool??null,modelLabel:xi,interrupted:Si,interruptedLabel:W5(`sidebar.interrupted`),usage:{totalTokens:j?.usage_snapshot_total_tokens??null,contextWindow:j?.usage_snapshot_context_window??null,cost:j?.usage_snapshot_cost??null,tool:vi,model:bi,availableModels:An},metadataExtra:j?.external_source?(0,X.jsx)(IF,{externalSource:j.external_source}):null,actions:j&&e?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[oi&&(0,X.jsx)(Q,{type:`button`,size:`xs`,variant:`outline`,className:`gap-2`,onClick:()=>wt(!0),children:xt?W5(`composer.loadingMemory`):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:W5(`composer.memorySuggestions`)}),(0,X.jsx)(Ww,{children:yt.length})]})}),(0,X.jsx)(R4,{projectId:e,scope:{type:`spec`,id:j.id},size:`xs`,onNavigateToLifecycleSource:b})]}):null,warnings:qr&&Jr?(0,X.jsx)(`div`,{className:`w-fit max-w-md rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-50`,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`div`,{children:Jr}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`secondary`,disabled:lt===j?.id,onClick:()=>{j&&Xn(j)},children:lt===j?.id?W5(`targets.switchingBack`):W5(`targets.switchBack`)}),(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:Gn,children:W5(`composer.startNewSession`)})]})]})}):Kr&&Yr?(0,X.jsx)(`div`,{className:`w-fit max-w-md rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-50`,children:Yr}):null}),composerControls:ta,composerInlineControls:na,composerTheme:`default`,composerFocusNonce:Re,pendingAgentRevealKey:ei&&G?.parentId===k?G?.turnKey??null:null,pendingAgentRevealDelayMs:ei&&G?.parentId===k?400:0,liveResponseTiming:G,followUpPrompt:Tn,draftAttachments:On,followUpPlaceholder:Ci,emptyStateText:null,isSendingFollowUp:be||ve,isComposerSubmitDisabled:Qi||fi||Xr,isUploadingAttachments:kn,canAttachImages:si,followUpDisabledReason:Yr??Jr??(Gr?.agent_status===`running`?W5(`composer.waitTurn`):kn?W5(`composer.waitUpload`):Qi?W5(`composer.waitGrill`):fi?jb.t(`common:questionSet.waitForResolution`):void 0),renderMessageBody:gi,onFollowUpPromptChange:ra,onFollowUpKeyDown:zr,onFollowUpPaste:Br,onUploadAttachments:e=>{Pr(e)},onRemoveAttachment:e=>{Fr(e)},onFollowUpSubmit:()=>{Mr()}})}),aa=!Wr&&me&&!fe?(0,X.jsx)(k8,{title:W5(`composer.noSessionSelectedTitle`),description:W5(`composer.noSessionSelectedDescription`),startNewSessionLabel:W5(`composer.startNewSession`),onStartNewSession:Gn,canStartNewSession:!!e&&!ve&&!be}):Wr&&!F&&!ge&&!j?(0,X.jsx)(D8,{label:W5(`composer.loadingSession`)}):!me||fe?(0,X.jsx)(O8,{label:W5(`sidebar.loadingSessions`)}):ia,oa=Ct&&e&&t?.memory_enabled?(0,X.jsx)(uC,{onClose:()=>wt(!1),overlayClassName:`bg-background/75 p-4`,panelClassName:`w-full max-w-3xl`,renderContent:({closeButton:t})=>(0,X.jsxs)(gC,{size:`sm`,className:`max-h-[calc(100vh-2rem)] w-full gap-0 overflow-hidden border-border/80 bg-card/95 shadow-2xl`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/80 pb-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(vC,{children:W5(`composer.memorySuggestionsTitle`)}),(0,X.jsx)(yC,{children:W5(`composer.memorySuggestionsDescription`)})]}),(0,X.jsx)(bC,{children:t})]}),(0,X.jsx)(xC,{className:`min-h-0 flex-1 overflow-y-auto pt-4`,children:(0,X.jsx)(U8,{projectId:e,suggestions:yt,emptyState:W5(`composer.memorySuggestionsEmpty`),onSuggestionsChanged:Vn})})]}),closeButtonLabel:W5(`composer.closeMemorySuggestions`)}):null,sa=Ri.length>0?(0,X.jsx)(E8,{count:Ri.length,title:Li,isDeleting:Oe.size>0,onConfirm:()=>{pr()},onCancel:()=>{Oe.size>0||De([])},labels:Ei}):null,ca=pt===null?null:(0,X.jsx)(dC,{title:W5(`actions.exportConflictTitle`),description:W5(`actions.exportConflictDescription`,{path:pt.path}),confirmLabel:W5(`actions.exportConflictConfirm`),cancelLabel:W5(`actions.exportConflictCancel`),confirmVariant:`destructive`,onConfirm:()=>{mt(null),tr({projectId:pt.projectId,sessionId:pt.sessionId,snapshotId:pt.snapshotId,overwrite:!0})},onCancel:()=>{mt(null)}});return(0,X.jsxs)(`div`,{"data-testid":`spec-view-shell`,className:`relative flex min-h-0 flex-1 overflow-hidden border-t border-border/70`,children:[(0,X.jsx)(A8,{sessions:D,sessionGroups:Lr,activeSessionId:k,isDraftOpen:F,isLoadingSessions:fe,isOpen:Ie,onToggleOpen:()=>{Le(t=>{let n=!t;return fge({projectId:e,isOpen:n}),n})},testId:`spec-sessions-sidebar`,railTestId:`spec-sessions-rail`,onDraftOpen:Gn,isCreatingSession:ve||!e,isSendingPrompt:be,newSessionShortcutHint:qn,newSessionTooltip:Jn,isSelectionMode:Ae,selectedSessionIds:Me,selectedSessionCount:Me.size,hasDeletableSessions:wi,deletingSessionIds:Oe,onEnterSelectionMode:()=>{je(!0),Ne(new Set)},onExitSelectionMode:()=>{je(!1),Ne(new Set)},onToggleSessionSelection:e=>{Ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onSetSessionSelection:Ir,onConfirmDeleteSelectedSessions:()=>{De(Array.from(Me))},selectionPresets:Rr,onSessionSelect:e=>{Yn(e)},onConfirmDeleteSession:e=>{De([e])},getSessionId:e=>e.id,getSessionTitle:e=>e.title,getDeleteDisabledReason:Oi,getActivityState:Di,getRowAriaLabel:Ai,renderRowContent:Mi,labels:Ti}),(0,X.jsxs)(`div`,{"data-testid":`spec-artifact-split-pane`,ref:Ut,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden xl:flex-row`,children:[(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:aa}),zi?(0,X.jsxs)(X.Fragment,{children:[Yi,Vi?(0,X.jsx)(age,{snapshot:Ue,isLoading:Je,desktopWidth:Y,onClose:fr,ref:Gt,actions:Ji,review:qi}):null]}):null]}),oa,sa,ca]})},y7=()=>({hasRunning:!1,hasFinishedUnseen:!1,hasErrorUnseen:!1}),b7=()=>({board:y7(),chat:y7(),spec:y7(),memory:y7()}),x7=(e,t)=>{let n=e[t];return!n.hasFinishedUnseen&&!n.hasErrorUnseen?e:{...e,[t]:{...n,hasFinishedUnseen:!1,hasErrorUnseen:!1}}},wge=e=>({hasRunning:e.board.hasRunning||e.chat.hasRunning||e.spec.hasRunning,hasFinishedUnseen:e.board.hasFinishedUnseen||e.chat.hasFinishedUnseen||e.spec.hasFinishedUnseen,hasErrorUnseen:e.board.hasErrorUnseen||e.chat.hasErrorUnseen||e.spec.hasErrorUnseen}),S7=e=>e.hasErrorUnseen?`error`:e.hasRunning?`running`:e.hasFinishedUnseen?`finished`:null,Tge=(e,t)=>t?null:S7(e),C7=e=>({id:e.id,project_id:e.project_id,title:e.title,agent_status:e.agent_status,agent_message_id:e.agent_message_id,latest_snapshot_id:e.latest_snapshot_id}),w7=(e,t)=>e.id===t.id&&e.project_id===t.project_id&&e.title===t.title&&e.agent_status===t.agent_status&&e.agent_message_id===t.agent_message_id&&e.latest_snapshot_id===t.latest_snapshot_id,T7=320,Ege=.7,Dge=28,Oge=6,kge=(e,t)=>{let n=Math.max(T7,Math.round(t*Ege));return Math.max(T7,Math.min(n,Math.round(e)))},Age=(e,t)=>{let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[...e,t];let r=e.slice();return r[n]=t,r},jge=(e,t)=>{let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[...e,t];if(w7(e[n],t))return e;let r=e.slice();return r[n]=t,r},E7=(e,t)=>e.length===t.length&&e.every((e,n)=>w7(e,t[n]))?e:t,Mge=(e,t)=>{if(t.type===`reset`)return b7();if(t.type===`mark-workspace-visible`)return x7(e,t.workspace);let n=e[t.workspace],r={...n,hasRunning:t.activity.hasRunning,hasFinishedUnseen:t.visibleWorkspace===t.workspace?!1:n.hasFinishedUnseen||t.activity.didFinish,hasErrorUnseen:t.visibleWorkspace===t.workspace?!1:n.hasErrorUnseen||t.activity.didError};return n.hasRunning===r.hasRunning&&n.hasFinishedUnseen===r.hasFinishedUnseen&&n.hasErrorUnseen===r.hasErrorUnseen?e:{...e,[t.workspace]:r}},Nge=({activeProjectId:e,onActivity:t})=>{let{tickets:n}=r3(),r=(0,p.useRef)(new Map);return(0,p.useEffect)(()=>{r.current=new Map},[e]),(0,p.useEffect)(()=>{let e=r.current,i=new Map,a=!1,o=!1;for(let t of n){let n=e.get(t.id)??null,r=t.agent_status??null,s=v8(t);!s&&n===`running`&&r===`done`&&(a=!0),n===`running`&&r===`error`&&(o=!0),i.set(t.id,s?n:r)}r.current=i,t({hasRunning:n.some(e=>e.agent_status===`running`||Bme(e)),didFinish:a,didError:o})},[t,n]),null},Pge=({activeProjectId:e})=>{let{t}=K(`common`,{keyPrefix:`approvalRequest.notification`}),n=lq(),{setPendingApprovalRequests:r}=r3();return(0,p.useEffect)(()=>{if(!e){r([]);return}let i=new AbortController,a=0,o=async(n,r)=>{if(n.status!==`pending`||i.signal.aborted||r!==void 0&&r!==a)return;let o=(await nN(e,n.id,i.signal)).approval_request;o.status!==`pending`||i.signal.aborted||r!==void 0&&r!==a||await t3({title:t(`title`),body:t(o.action_kind===`git_push`?`forcePush`:`productionCheck`),key:Ide(o),destination:e3(o)})},s=()=>{let t=++a;(async()=>{let t=[],n;do{let r=await tN(e,{statuses:[`pending`],limit:200,cursor:n,signal:i.signal});t.push(...r.approval_requests),n=r.next_cursor??void 0}while(n);return t})().then(e=>{if(!(i.signal.aborted||t!==a))return r(e),Promise.allSettled(e.map(e=>o(e,t)))}).catch(e=>{Ye(e)})},c=t=>{if(!t||typeof t!=`object`)return;let n=t;n.project_id!==e||typeof n.id!=`string`||s()};return s(),n.on(`approval-request:created`,c),n.on(`approval-request:updated`,s),n.on(`connect`,s),()=>{i.abort(),n.off(`approval-request:created`,c),n.off(`approval-request:updated`,s),n.off(`connect`,s)}},[e,r,n,t]),null},Fge=({activeProjectId:e,onActivity:t})=>{let n=lq(),[r,i]=(0,p.useState)([]),a=(0,p.useRef)(new Map);return(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController;return(async()=>{try{let n=await CM(e,t.signal);if(t.signal.aborted)return;i(n)}catch(e){Ye(e)}})(),()=>{t.abort()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=$b(()=>{document.visibilityState===`visible`&&CM(e,t.signal).then(e=>{t.signal.aborted||i(e)}).catch(e=>{Ye(e)})});return()=>{t.abort(),n()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.project_id!==e||i(e=>Age(e,t))},r=t=>{!t||t.project_id!==e||i(e=>e.filter(e=>e.id!==t.id))};return n.on(`chat-session:created`,t),n.on(`chat-session:updated`,t),n.on(`chat-session:deleted`,r),()=>{n.off(`chat-session:created`,t),n.off(`chat-session:updated`,t),n.off(`chat-session:deleted`,r)}},[e,n]),(0,p.useEffect)(()=>{let n=a.current,i=new Map,o=[],s=!1;for(let e of r){let t=n.get(e.id)??null,r=e.agent_status??null;t===`running`&&r===`done`&&o.push(e),t===`running`&&r===`error`&&(s=!0),i.set(e.id,r)}a.current=i;for(let e of o)if(e.title){let t=Pde({projectId:e.project_id,chatSessionId:e.id,agentMessageId:e.agent_message_id});t&&t3({title:`Chat response ready`,body:e.title,key:t,destination:{kind:`chat-session`,projectId:e.project_id,chatSessionId:e.id}})}o.length>0&&e&&t6(e),t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:o.length>0,didError:s})},[e,t,r]),null},Ige=({activeProjectId:e,onActivity:t})=>{let n=lq(),[r,i]=(0,p.useState)([]),a=(0,p.useRef)(new Map);return(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController;return(async()=>{try{let n=await RM(e,t.signal);if(t.signal.aborted)return;let r=n.map(C7);i(e=>E7(e,r))}catch(e){Ye(e)}})(),()=>{t.abort()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=new AbortController,n=$b(()=>{document.visibilityState===`visible`&&RM(e,t.signal).then(e=>{if(t.signal.aborted)return;let n=e.map(C7);i(e=>E7(e,n))}).catch(e=>{Ye(e)})});return()=>{t.abort(),n()}},[e,n]),(0,p.useEffect)(()=>{if(!e)return;let t=t=>{if(!t||t.project_id!==e)return;let n=C7(t);i(e=>jge(e,n))},r=t=>{!t||t.project_id!==e||i(e=>e.filter(e=>e.id!==t.id))};return n.on(`spec-session:created`,t),n.on(`spec-session:updated`,t),n.on(`spec-session:deleted`,r),()=>{n.off(`spec-session:created`,t),n.off(`spec-session:updated`,t),n.off(`spec-session:deleted`,r)}},[e,n]),(0,p.useEffect)(()=>{let e=a.current,n=new Map,i=[],o=!1;for(let t of r){let r=e.get(t.id)??null,a=t.agent_status??null;r===`running`&&a===`done`&&i.push(t),r===`running`&&a===`error`&&(o=!0),n.set(t.id,a)}a.current=n;for(let e of i)if(e.title){let t=Fde({projectId:e.project_id,specSessionId:e.id,agentMessageId:e.agent_message_id,latestSnapshotId:e.latest_snapshot_id});t&&t3({title:`Spec response ready`,body:e.title,key:t,destination:{kind:`spec-session`,projectId:e.project_id,specSessionId:e.id}})}t({hasRunning:r.some(e=>e.agent_status===`running`),didFinish:i.length>0,didError:o})},[e,t,r]),null},Lge=({activeProjectId:e,activeProject:t=null,activeProjectBranchState:n=null,targetBundles:r=[],targetBranchSuggestions:i={current_branch:null,default_branch:null,previous_branch:null},isTargetBundleLoading:a=!1,isTargetSelectorLoading:o=!1,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,activeRun:u,activeTool:d,onRestoreSessionTarget:f,onChatReviewCapabilityChange:m,routedInspectionReviewCapability:h,onPreviewReviewCapabilityChange:g,previewDisplayMode:_=`hidden`,previewPane:v=null,previewPaneWidth:y=480,isPreviewButtonDisabled:b=!1,previewButtonTitle:x,visibleWorkspace:S,onProjectUsageChange:C,onBundlesChange:w,onBundlesLoadingChange:T,onBoardLoadedProjectIdChange:E,onPreviewToggle:D,onPreviewPaneWidthChange:O,onRunStopped:k,onRunStatusChange:A,onWorkspaceActivityChange:j,onWorkspaceActivityEvent:M,pendingWorkspaceNavigation:N=null,onPendingWorkspaceNavigationConsumed:P,routedTicketId:F=null,routedModalStack:I=[],onRoutedTicketOpen:L,onRoutedTicketClose:R,onRoutedTicketUnavailable:z,routedBundleId:ee=null,routedChatSessionId:B,routedSpecSessionId:V,routedSpecSnapshotId:te,routedInspection:H=null,onRoutedBundleOpen:U,onRoutedBundleClose:ne,onRoutedInspectionOpen:re,onRoutedInspectionModeChange:ie,onRoutedInspectionClose:ae,onChatSessionNavigation:oe,onSpecSessionNavigation:W,onRoutedEntityUnavailable:se,onSpecImplementationChatReady:ce,onViewSourceSpec:le,onNavigateToLifecycleSource:ue,onViewMemorySource:de,onStartChatFromBundle:fe,onOpenProjectExecutionSettings:pe,refreshKey:me=0,boardFilterState:he,onBoardFilterStateChange:ge})=>{let _e=(0,p.useRef)(null),ve=(0,p.useRef)(null),ye=(0,p.useRef)(null),be=(0,p.useRef)(null),xe=(0,p.useRef)(!1),Se=(0,p.useRef)(!1),Ce=(0,p.useRef)(0),we=(0,p.useRef)(y),Te=(0,p.useRef)(y),Ee=S===`board`||S===`chat`,De=v!==null,[Oe,ke]=(0,p.useState)(!1),[Ae,je]=(0,p.useState)(!1),[Me,Ne]=(0,p.useState)(y),[Pe,Fe]=(0,p.useReducer)(Mge,void 0,b7),Ie=Ee&&De&&_===`expanded`,Le=Ee&&De&&_===`inline`,Re=Ee&&De&&_===`hidden`&&!Ae,ze=(Le||Ae)&&!Ie,G=Ie||ze,Be=Ee&&De&&!Ie,Ve=Oe?Me:y,He=S!==`chat`||!ze,Ue=e=>{let t=ye.current,n=be.current,r=xe.current;if(t!==null){if(ye.current=null,be.current=null,xe.current=!1,ke(!1),je(!1),e!==null&&ve.current?.hasPointerCapture(e)&&ve.current.releasePointerCapture(e),n===`collapsed`){if(!r)return;O?.(Te.current),D?.();return}O?.(Te.current)}},K=e=>{if(!_e.current)return;let t=_e.current.getBoundingClientRect().width,n=kge(e,t);Te.current=n,Ne(n)},We=e=>{O&&(Re&&b||(e.preventDefault(),ye.current=e.pointerId,be.current=Re?`collapsed`:`inline`,xe.current=!1,Se.current=!1,Ce.current=e.clientX,we.current=Re?0:Te.current,ke(!Re),e.currentTarget.setPointerCapture(e.pointerId)))},Ge=e=>{if(ye.current!==e.pointerId)return;let t=e.clientX-Ce.current,n=we.current-t;if(be.current===`collapsed`){if(!xe.current&&n<Oge)return;xe.current||(xe.current=!0,Se.current=!0,je(!0),ke(!0))}K(n)},Ke=e=>{if(ye.current===e.pointerId){if(be.current===`inline`||xe.current){let t=e.clientX-Ce.current;K(we.current-t)}Ue(e.pointerId)}},qe=e=>{ye.current===e.pointerId&&Ue(e.pointerId)},q=(0,p.useCallback)((e,t)=>{M?.(e,t),Fe({type:`update-workspace`,workspace:e,activity:t,visibleWorkspace:S})},[M,S]);(0,p.useEffect)(()=>{Fe({type:`reset`})},[e]),(0,p.useEffect)(()=>{S!==`memory`&&Fe({type:`mark-workspace-visible`,workspace:S})},[S]),(0,p.useEffect)(()=>{j?.(Pe)},[j,Pe]),(0,p.useEffect)(()=>{Oe||(Te.current=y),!De&&(ye.current=null,be.current=null,xe.current=!1,Se.current=!1,Te.current=y)},[De,Oe,y]);let Je=()=>{if(Se.current){Se.current=!1;return}b||D?.()},J=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),Je())},Ye=(r=!1)=>(0,X.jsx)(Kme,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,activeRun:u,activeTool:d,inspectionOnly:r,onPreviewReviewCapabilityChange:r?void 0:g,onRunStopped:k,onRunStatusChange:A,onViewSourceSpec:le,onNavigateToLifecycleSource:ue,onStartChatFromBundle:fe,onOpenProjectExecutionSettings:pe,refreshKey:me,boardFilterState:he,onBoardFilterStateChange:ge,onInitialTicketNavigationUnavailable:z,routedTicketId:F,routedModalStack:I,onTicketOpen:L,onTicketClose:R,routedBundleId:ee,routedInspection:H,routedInspectionReviewCapability:r&&S===`chat`?h:void 0,onBundleOpen:U,onBundleClose:ne,onInspectionOpen:re,onInspectionModeChange:ie,onInspectionClose:ae,onInspectionUnavailable:se,initialImportedDraft:N?.workspace===`board`&&`issueDraft`in N?N.draft:null,onInitialImportedDraftConsumed:P});return(0,X.jsx)(Gme,{activeProjectId:e,refreshKey:me,onLoadedProjectIdChange:E,onProjectUsageChange:C,onBundlesChange:w,onBundlesLoadingChange:T,children:(0,X.jsxs)(`div`,{ref:_e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(Nge,{activeProjectId:e,onActivity:e=>{q(`board`,e)}}),(0,X.jsx)(Pge,{activeProjectId:e}),(0,X.jsx)(Fge,{activeProjectId:e,onActivity:e=>{q(`chat`,e)}}),(0,X.jsx)(Ige,{activeProjectId:e,onActivity:e=>{q(`spec`,e)}}),S===`spec`?(0,X.jsx)(`div`,{id:`project-workspace-panel-spec`,role:`tabpanel`,"aria-labelledby":`project-workspace-tab-spec`,className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(Cge,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,targetBundles:r,targetBranchSuggestions:i,isTargetBundleLoading:a,isTargetSelectorLoading:o,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,onRestoreSessionTarget:f,activeTool:d,routedSpecSessionId:V,routedSpecSnapshotId:te,initialIssueDraft:N?.workspace===`spec`&&`issueDraft`in N?N.draft:null,onRoutedSpecNavigationUnavailable:se,onSessionNavigation:W,onInitialIssueDraftConsumed:P,onImplementInChat:ce,onNavigateToLifecycleSource:ue})}):S===`memory`?(0,X.jsx)(`div`,{id:`project-workspace-panel-memory`,role:`tabpanel`,"aria-labelledby":`project-workspace-tab-memory`,className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(Nhe,{activeProject:t,onNavigateToSource:de})}):(0,X.jsxs)(`div`,{id:S===`chat`?`project-workspace-panel-chat`:`project-workspace-panel-board`,role:`tabpanel`,"aria-labelledby":S===`chat`?`project-workspace-tab-chat`:`project-workspace-tab-board`,className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:S===`chat`?(0,X.jsx)(jhe,{activeProjectId:e,activeProject:t,activeProjectBranchState:n,targetBundles:r,targetBranchSuggestions:i,isTargetBundleLoading:a,isTargetSelectorLoading:o,onTargetSelectorOpenChange:s,onSelectBundleTarget:c,onSelectRepoRootTarget:l,activeTool:d,routedChatSessionId:B,initialDraftOpen:N?.workspace===`chat`&&`startNewDraft`in N,onInitialDraftOpenConsumed:P,initialSpecDraft:N?.workspace===`chat`&&`draft`in N?{text:N.draftText,specSessionId:N.specSessionId,specSnapshotId:N.specSnapshotId}:null,onInitialSpecDraftConsumed:P,onRoutedChatNavigationUnavailable:se,onSessionNavigation:oe,onViewSourceSpec:le,onNavigateToLifecycleSource:ue,isExternallyResizing:Oe,onRestoreSessionTarget:f,onReviewCapabilityChange:m,showChangesPanel:He}):Ye()}),[Be?(0,X.jsx)(lv,{content:b?x??`Preview unavailable`:`Open preview`,disabled:!Re,side:`left`,children:(0,X.jsx)(`div`,{"aria-label":Re?x??`Show preview`:`Resize preview pane`,"aria-orientation":Re?void 0:`vertical`,className:Re?`group flex shrink-0 touch-none select-none items-center justify-center border-l border-border/70 bg-background/90 transition-colors ${b?`cursor-not-allowed text-muted-foreground/60`:`cursor-col-resize text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`:`group flex w-5 shrink-0 cursor-col-resize touch-none select-none items-center justify-center border-l border-border/70 bg-background/80 ${Oe?`bg-background`:``}`,"data-preview-divider":`true`,"data-testid":Re?`collapsed-preview-rail`:void 0,onLostPointerCapture:qe,onPointerCancel:Ke,onPointerDown:We,onPointerMove:Ge,onPointerUp:Ke,onClick:Re?Je:void 0,onKeyDown:Re?J:void 0,ref:ve,role:Re?`button`:`separator`,style:Re?{width:`${Dge}px`}:void 0,tabIndex:Re?b?-1:0:void 0,children:Re?(0,X.jsxs)(`span`,{className:`relative flex h-full w-full items-center justify-center`,children:[(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-[2.65rem] items-center justify-center text-sky-400/80 transition-colors group-hover:text-sky-300`,children:(0,X.jsx)(Mhe,{className:`h-3 w-3 shrink-0`})}),(0,X.jsx)(`span`,{className:`absolute top-1/2 left-1/2 h-14 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-muted-foreground/70 transition-colors group-hover:bg-sky-300/90`})]}):(0,X.jsx)(`div`,{className:`h-14 w-1.5 rounded-full transition-colors ${Oe?`bg-sky-300/90`:`bg-muted-foreground/70 group-hover:bg-sky-300/90`}`})})},`preview-divider`):null,G?(0,X.jsx)(`div`,{className:Ie?`fixed inset-0 z-50 bg-black/70 p-4 sm:p-6`:`min-h-0 shrink-0 border-l border-border/70 bg-[#11131a]`,style:Ie?void 0:{width:`${Ve}px`},children:(0,X.jsx)(`div`,{className:`h-full w-full`,children:v})},`preview-container`):null]]}),S!==`board`&&H&&Ye(!0)]})})},Rge=({isExpanded:e,isVisible:t,project:n,onClose:r,onToggleExpanded:i})=>(0,X.jsx)(`div`,{className:[`fixed inset-x-4 bottom-24 z-40`,e?`top-20`:`h-[min(28rem,calc(100vh-8rem))]`,t?`block`:`hidden`].join(` `),children:(0,X.jsx)(e4,{createSession:()=>Gse(n.id),isExpanded:e,isVisible:t,ariaLabel:`Project terminal for ${n.name}`,title:n.name,closeLabel:`Close terminal`,className:e?`h-full w-full rounded-2xl shadow-2xl`:`mx-auto h-full max-w-6xl shadow-2xl`,onClose:r,onToggleExpanded:i})}),zge=({activeWorkspace:e,activityByWorkspace:t,className:n,memoryEnabled:r=!1,onWorkspaceChange:i})=>{let{t:a}=K(`common`,{keyPrefix:`workspaceTabs`}),o=r?[`board`,`chat`,`spec`,`memory`]:[`board`,`chat`,`spec`],s={board:a(`board`),chat:a(`chat`),spec:a(`spec`),memory:a(`memory`)};return(0,X.jsx)(`div`,{className:Z(`min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,n),children:(0,X.jsx)(`div`,{role:`tablist`,"aria-label":a(`ariaLabel`),className:`inline-flex min-w-max items-end gap-1 border-b border-border/70`,children:o.map(n=>{let r=e===n,a=Tge(t[n],r),o=n===`board`?`border-sky-300/70 bg-sky-500/8 text-sky-200`:n===`spec`?`border-violet-300/70 bg-violet-500/8 text-violet-200`:n===`memory`?`border-amber-300/70 bg-amber-500/8 text-amber-200`:`border-emerald-300/70 bg-emerald-500/8 text-emerald-200`;return(0,X.jsx)(`button`,{id:`project-workspace-tab-${n}`,type:`button`,role:`tab`,"aria-selected":r,"aria-controls":`project-workspace-panel-${n}`,tabIndex:r?0:-1,className:Z(`cursor-pointer rounded-t-lg border-b-2 px-3 py-2 text-sm font-medium transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 sm:px-4 sm:py-2.5 sm:text-[15px]`,r?o:`border-transparent text-muted-foreground hover:border-border hover:bg-background/35 hover:text-foreground`),onClick:()=>i(n),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2 whitespace-nowrap`,children:[(0,X.jsx)(`span`,{children:s[n]}),(0,X.jsx)(Hy,{state:a,className:`mt-0`})]})},n)})})})},D7=32,Bge=5.5,Vge=2,Hge=24,Uge=8,O7=new Map,Wge={running:{fill:`#fcd34d`,stroke:`#f59e0b`},finished:{fill:`#34d399`,stroke:`#059669`},error:{fill:`#fb7185`,stroke:`#e11d48`}},k7=e=>e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`),A7=e=>{if(!e)return null;let t=e.trim().match(/^([0-9]+(?:\.[0-9]+)?)/);return t?Number(t[1]):null},j7=e=>{let t=new DOMParser().parseFromString(e,`image/svg+xml`);if(t.querySelector(`parsererror`))return null;let n=t.documentElement;if(n.nodeName.toLowerCase()!==`svg`)return null;let r=n.getAttribute(`viewBox`)?.trim(),i=A7(n.getAttribute(`width`)),a=A7(n.getAttribute(`height`)),o=r??(i&&a?`0 0 ${i} ${a}`:`0 0 ${D7} ${D7}`);return`<svg ${[Array.from(n.attributes).filter(e=>![`width`,`height`,`viewBox`,`x`,`y`,`preserveAspectRatio`].includes(e.name)).map(e=>`${e.name}="${k7(e.value)}"`).join(` `),`x="0"`,`y="0"`,`width="${D7}"`,`height="${D7}"`,`viewBox="${k7(o)}"`,`preserveAspectRatio="xMidYMid meet"`].filter(e=>e.length>0).join(` `)}>${n.innerHTML}</svg>`},Gge=async e=>{if(!e)return null;let t=O7.get(e);if(t)return t;let n=(async()=>{try{if(e.startsWith(`data:image/svg+xml,`))return j7(decodeURIComponent(e.slice(19)));if(e.startsWith(`data:image/svg+xml;base64,`))return j7(atob(e.slice(26)));let t=await fetch(e);return t.ok?j7(await t.text()):null}catch{return null}})();return O7.set(e,n),n},Kge=async(e,t)=>{let{fill:n,stroke:r}=Wge[e],i=await Gge(t);return i?[`<svg xmlns="http://www.w3.org/2000/svg" width="${D7}" height="${D7}" viewBox="0 0 ${D7} ${D7}">`,i,`<circle cx="${Hge}" cy="${Uge}" r="${Bge}" fill="${n}" stroke="${r}" stroke-width="${Vge}"/>`,`</svg>`].join(``):null},qge=async(e,t)=>{if(!e)return t;let n=await Kge(e,t);return n?`data:image/svg+xml,${encodeURIComponent(n)}`:t},Jge=()=>{let e=document.querySelector(`link[rel="icon"]`);if(e)return e;let t=document.createElement(`link`);return t.rel=`icon`,document.head.appendChild(t),t},M7=({defaultHref:e,state:t})=>{let n=Jge(),r=Number(n.dataset.browserTabActivityRequestId??`0`)+1;if(n.dataset.browserTabActivityState=t??`default`,n.dataset.browserTabActivityRequestId=String(r),!t){if(e){n.href=e;return}n.removeAttribute(`href`);return}qge(t,e).then(e=>{if(n.dataset.browserTabActivityRequestId===String(r)){if(e){n.href=e;return}n.removeAttribute(`href`)}})},N7=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.archonDesktop===!0&&typeof t.modalHasParentEntry==`boolean`&&(t.modalParentDepth===void 0||Number.isInteger(t.modalParentDepth)&&t.modalParentDepth>0)&&(t.modalStack===void 0||Array.isArray(t.modalStack)&&t.modalStack.every(e=>!!e&&typeof e==`object`&&typeof e.kind==`string`&&typeof e.projectId==`string`))},P7=e=>!N7(e)||!e.modalHasParentEntry?0:e.modalParentDepth??1,F7=(e,t,n)=>!t||!n.isModal(t)?[]:N7(e)&&e.modalStack&&e.modalStack.length>0?e.modalStack:[t],I7=(e,t,n)=>({archonDesktop:!0,modalHasParentEntry:e,...t>1?{modalParentDepth:t}:{},...n.length>0?{modalStack:n}:{}}),Yge=(e=W4)=>{let[t,n]=(0,p.useState)(()=>e.parse(window.location.pathname)),[r,i]=(0,p.useState)(()=>{let t=e.parse(window.location.pathname);return t&&e.isModal(t)?[t]:[]}),[a,o]=(0,p.useState)(0),s=(0,p.useRef)(!1);(0,p.useEffect)(()=>{s.current||(s.current=!0,t&&e.isModal(t)&&window.history.replaceState(I7(!1,0,[t]),``,e.build(t)))},[e,t]),(0,p.useEffect)(()=>{let t=()=>{let t=e.parse(window.location.pathname);n(t),i(F7(window.history.state,t,e)),o(e=>e+1)};return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e]);let c=(0,p.useCallback)(r=>{let a=e.isModal(r)?t&&e.isModal(t)?[...F7(window.history.state,t,e).slice(0,-1),r]:[r]:[],s=e.isModal(r)?P7(window.history.state):0,c=I7(s>0,s,a);window.history.replaceState(c,``,e.build(r)),n(r),i(a),o(e=>e+1)},[e,t]),l=(0,p.useCallback)(r=>{let a=e.isModal(r),s=a?t&&e.isModal(t)?[...F7(window.history.state,t,e),r]:[r]:[];window.history.pushState(I7(a,0,s),``,e.build(r)),n(r),i(s),o(e=>e+1)},[e,t]),u=(0,p.useCallback)(r=>{let a=P7(window.history.state);if(a===0){c(r);return}let s=a>0?a+1:0,l=F7(window.history.state,t,e),u=l.length>0?[...l.slice(0,-1),r]:[r],d=I7(s>0,s,u);window.history.pushState(d,``,e.build(r)),n(r),i(u),o(e=>e+1)},[e,c,t]);return{closeModal:(0,p.useCallback)((t,n)=>{let r=e.parse(window.location.pathname);if(!r||e.build(r)!==e.build(t))return;let i=P7(window.history.state);if(i===1){window.history.back();return}if(i>1){window.history.go(-i);return}let a=e.parent(t),o=n??a;o&&c(o)},[e,c]),modalStack:r,navigationVersion:a,push:l,pushModalSibling:u,replace:c,route:t}},L7=(e,t)=>jb.t(`common:projectFooter.${e}`,t),Xge=(e,t)=>{if(e?.kind===`activity-run`)return e;for(let e=t.length-1;e>=0;--e){let n=t[e];if(n.kind===`activity-run`)return n}return null},Zge=1e3,R7=`archon.active-project-id`,z7=`archon.workspace-by-project`,B7=`archon.preview-mode-by-project`,V7=`archon.dismissed-preview-run-context-by-project`,H7=5e3,U7=`archon.preview-pane-width`,W7=`archon.preview-viewport-preset`,G7=`archon.preview-zoom`,Qge=480,$ge=`responsive`,e_e=1,K7={hasMounted:!1,isOpen:!1,isExpanded:!1},q7=`hidden`,t_e=(0,p.lazy)(()=>BW(()=>Promise.resolve().then(()=>B6).then(e=>({default:e.WorkspaceReviewModal})),void 0)),n_e=(0,p.lazy)(()=>BW(()=>import(`./VerificationDialog-BJnOitrJ.js`).then(e=>({default:e.VerificationDialog})),__vite__mapDeps([19,3]))),r_e=(0,p.lazy)(()=>BW(()=>import(`./GitHubActionsDialog-Dzo0vtak.js`).then(e=>({default:e.GitHubActionsDialog})),__vite__mapDeps([20,3]))),i_e=(0,p.lazy)(()=>BW(()=>import(`./ActivityView-CKvbDXeA.js`).then(e=>({default:e.ActivityView})),[])),J7=e=>{if(!e)return null;try{return JSON.parse(e)}catch{return null}},a_e=e=>{let t=e.startsWith(`/`)?e.slice(1).split(`/`):[];if(t[0]!==`app`||t[1]!==`projects`||!t[2])return null;try{return decodeURIComponent(t[2])||null}catch{return null}},o_e=e=>e?.kind===`workspace`?e.workspace:e?.kind===`chat-session`?`chat`:e?.kind===`spec-session`||e?.kind===`spec-snapshot`?`spec`:`board`,Y7=e=>{let t=J7(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0):[]},X7=e=>{let t=J7(e);return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e,n=typeof t.name==`string`?t.name:``,r=typeof t.cmd==`string`?t.cmd:``,i=typeof t.cwd==`string`?t.cwd:``;return n.trim()===``&&r.trim()===``&&i.trim()===``?[]:[{name:n,cmd:r,cwd:i}]}):[]},s_e=e=>{let t=J7(e);return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e,n=typeof t.source==`string`?t.source:``,r=typeof t.target==`string`?t.target:``,i=t.mode===`copy`||t.mode===`symlink`?t.mode:`copy`;return n.trim()===``&&r.trim()===``?[]:[{source:n,target:r,mode:i}]}):[]},c_e=(e,t)=>{let n=new Set(dw(e)),r=new Set(fw(e)),i=new Set(yre(e)),a=new Set(bre(e));return{name:e.name,repoPath:e.repo_path,buildExecutionProvider:e.build_execution_provider??`host`,linkedProjectIds:e.linked_project_ids,runSetup:Y7(e.run_setup),runServices:X7(e.run_services),checkDefinitions:uw(e).map(e=>({id:e.id,name:e.name,category:e.category,command:e.command,cwd:e.cwd??``,timeoutMs:String(e.timeout_ms),runner:e.category===`test`?e.runner:`auto`,consequence:e.consequence??`ordinary`,required:n.has(e.id),preReview:n.has(e.id)&&r.has(e.id),postBuild:i.has(e.id),autoFix:a.has(e.id)})),runIde:e.run_ide??``,previewServiceName:e.preview_service_name??``,previewPath:e.preview_path??``,previewCapabilityMode:e.preview_capability_mode??`auto`,helperModel:e.helper_models?.[t]?.model??(t===`opencode`?e.helper_model:null)??``,helperVariant:e.helper_models?.[t]?.variant??(t===`opencode`?e.helper_variant:null)??``,helperModels:e.helper_models??{},reviewerModel:e.reviewer_models?.[t]?.model??(t===`opencode`?e.reviewer_model:null)??``,reviewerVariant:e.reviewer_models?.[t]?.variant??(t===`opencode`?e.reviewer_variant:null)??``,reviewerModels:e.reviewer_models??{},commitMessageRules:e.commit_message_rules??``,commitAfterEachTicket:e.commit_after_each_ticket,autoParkStaleTickets:e.auto_park_stale_tickets,memoryEnabled:e.memory_enabled,scanIncludeGlobs:e.scan_include_globs??[],scanExcludeGlobs:e.scan_exclude_globs??[],worktreeSync:s_e(e.worktree_sync),specAwareCodeReviewEnabled:e.spec_aware_code_review_enabled,automationDepth:e.automation_depth??`manual`,automationReviewFixEnabled:e.automation_review_fix_enabled??!1,automationPauseOnOpenQuestions:e.automation_pause_on_open_questions??!1,automationReviewSeverity:e.automation_review_severity??`medium`,automationReviewMaxIterations:e.automation_review_max_iterations??3}},Z7=e=>{let t=e.previewServiceName?.trim()||null,n=e.previewPath?.trim()||``,r=n===``||n===`/`?null:n,i=t||r||e.previewCapabilityMode===`force_web`||e.previewCapabilityMode===`force_disabled`?e.previewCapabilityMode??`auto`:null;return{name:e.name,repo_path:e.repoPath,build_execution_provider:e.buildExecutionProvider??`host`,linked_project_ids:e.linkedProjectIds,run_setup:e.runSetup.length>0?e.runSetup:null,run_services:e.runServices.length>0?e.runServices.map(e=>({...e.name?{name:e.name}:{},cmd:e.cmd,...e.cwd?{cwd:e.cwd}:{}})):null,check_definitions:(e.checkDefinitions??[]).map(e=>e.category===`test`?{id:e.id,name:e.name,category:`test`,command:e.command,...e.cwd?{cwd:e.cwd}:{},timeout_ms:Number(e.timeoutMs),consequence:`ordinary`,runner:e.runner}:e.category===`custom`?{id:e.id,name:e.name,category:e.category,command:e.command,...e.cwd?{cwd:e.cwd}:{},timeout_ms:Number(e.timeoutMs),consequence:e.consequence??`ordinary`}:{id:e.id,name:e.name,category:e.category,command:e.command,...e.cwd?{cwd:e.cwd}:{},timeout_ms:Number(e.timeoutMs),consequence:`ordinary`}),required_check_definition_ids:(e.checkDefinitions??[]).filter(e=>e.required).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),pre_review_check_definition_ids:(e.checkDefinitions??[]).filter(e=>e.required&&e.preReview).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),post_build_check_definition_ids:(e.checkDefinitions??[]).filter(e=>e.postBuild).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),auto_fix_check_definition_ids:(e.checkDefinitions??[]).filter(e=>e.autoFix).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),run_ide:e.runIde||null,preview_service_name:t,preview_path:r,preview_capability_mode:i,helper_models:e.helperModels??{},reviewer_models:e.reviewerModels??{},commit_message_rules:e.commitMessageRules||null,commit_after_each_ticket:e.commitAfterEachTicket,auto_park_stale_tickets:e.autoParkStaleTickets,memory_enabled:e.memoryEnabled,scan_include_globs:e.scanIncludeGlobs??[],scan_exclude_globs:e.scanExcludeGlobs??[],worktree_sync:e.worktreeSync.length>0?e.worktreeSync.map(e=>({source:e.source,...e.target?{target:e.target}:{},mode:e.mode})):null,spec_aware_code_review_enabled:e.specAwareCodeReviewEnabled,automation_depth:e.automationDepth,automation_review_fix_enabled:e.automationReviewFixEnabled,automation_pause_on_open_questions:e.automationPauseOnOpenQuestions,automation_review_severity:e.automationReviewSeverity,automation_review_max_iterations:e.automationReviewMaxIterations}},l_e=e=>e?Y7(e.run_setup).length>0||X7(e.run_services).length>0||(e.run_ide?.trim().length??0)>0:!1,Q7=(e,t,n)=>`${e} ${e===1?t:n}`,u_e=e=>{if(!e.repo_path_locked)return null;let t=[];return e.ticket_count>0&&t.push(Q7(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&t.push(Q7(e.worktree_count,`worktree exists`,`worktrees exist`)),t.length===0?`Repository path is locked for this project.`:`Repository path is locked because ${t.join(` and `)}.`},d_e=(e,t)=>{if(t.length<=1)return`Keep at least one project in Archon.`;let n=[];e.ticket_count>0&&n.push(Q7(e.ticket_count,`ticket is attached`,`tickets are attached`)),e.worktree_count>0&&n.push(Q7(e.worktree_count,`worktree exists`,`worktrees exist`));let r=t.filter(t=>t.linked_project_ids.includes(e.id)).length;return r>0&&n.push(Q7(r,`project links to it`,`projects link to it`)),n.length===0?null:`This project can't be deleted while ${n.join(` and `)}.`},f_e=(e,t)=>e.id!==t.projectId||e.ticket_count===t.ticketCount&&e.worktree_count===t.worktreeCount&&e.repo_path_locked===t.repoPathLocked?e:{...e,ticket_count:t.ticketCount,worktree_count:t.worktreeCount,repo_path_locked:t.repoPathLocked},p_e=(e,t)=>({projectId:e,branch:t.branch,status:t.status,ahead:t.ahead??0,behind:t.behind??0,hasUpstream:t.has_upstream??!1,canPull:t.can_pull??!1,diffStats:t.diff_stats??null}),$7=e=>({projectId:e,branch:null,status:`loading`,ahead:0,behind:0,hasUpstream:!1,canPull:!1,diffStats:null}),e9=(e,t)=>t?e[t]??K7:K7,t9=(e,t)=>t?e[t]??q7:q7,m_e=()=>{let e=window.localStorage.getItem(U7),t=Number(e);return Number.isFinite(t)&&t>=320?t:Qge},h_e=()=>{let e=window.localStorage.getItem(W7);return e===`phone`||e===`tablet`||e===`laptop`||e===`responsive`?e:$ge},g_e=()=>{let e=Number(window.localStorage.getItem(G7));return Number.isFinite(e)&&e>0?e:e_e},__e=()=>{let e=J7(window.localStorage.getItem(z7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).flatMap(([e,t])=>t===`activity`?[[e,`board`]]:t===`board`||t===`chat`||t===`spec`||t===`memory`?[[e,t]]:[]))},v_e=()=>{let e=J7(window.localStorage.getItem(B7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>e===`hidden`||e===`inline`||e===`expanded`))},n9=()=>{let e=J7(window.localStorage.getItem(V7));return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`||e===null))},y_e=({activeRun:e,project:t})=>{if(!e||e.kind!==`project`||!t)return!1;let n=t.active_target_kind??`repo_root`,r=t.active_target_bundle_id??null;return e.project_id===t.id&&(e.target_kind??`repo_root`)===n&&((e.target_kind??`repo_root`)!==`bundle`||e.target_bundle_id===r)},b_e=({activeRun:e,project:t,projectId:n})=>!e||!n?null:e.kind===`ticket`?e.project_id===n?e:null:y_e({activeRun:e,project:t})?e:null,r9=`Project root has uncommitted changes. Confirm branch switch to continue.`,x_e=({activeProject:e,activeProjectBranchState:t,nextTarget:n})=>e?n.kind===`bundle`?e.active_target_kind!==`bundle`||e.active_target_bundle_id!==n.bundleId:e.active_target_kind===`bundle`?!0:n.branch?t?.branch!==n.branch:!1:!1,S_e=()=>{let e=Yge(),t=lq(),{closeModal:n,modalStack:r,navigationVersion:i,push:a,pushModalSibling:o,replace:s,route:c}=e,l=Xge(c,r),[u,d]=(0,p.useState)(`opencode`),[f,m]=(0,p.useState)(Vr),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)([]),[y,b]=(0,p.useState)(()=>window.localStorage.getItem(R7)),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)({}),[k,A]=(0,p.useState)({}),[j,M]=(0,p.useState)({}),[N,P]=(0,p.useState)({}),[F,I]=(0,p.useState)({}),[L,R]=(0,p.useState)(v_e),[z,ee]=(0,p.useState)(n9),[B,V]=(0,p.useState)(m_e),[te,H]=(0,p.useState)(h_e),[U,ne]=(0,p.useState)(g_e),[re,ie]=(0,p.useState)(null),[ae,oe]=(0,p.useState)({opencode:{models:[],loaded:!1},claude:{models:[],loaded:!1}}),[W,se]=(0,p.useState)(0),[ce,le]=(0,p.useState)({opencode:{model:``,variant:``},claude:{model:``,variant:``}}),[ue,de]=(0,p.useState)(!1),[fe,pe]=(0,p.useState)(null),[me,he]=(0,p.useState)(`general`),[ge,_e]=(0,p.useState)(null),[ve,ye]=(0,p.useState)(!1),[be,xe]=(0,p.useState)({}),[Se,Ce]=(0,p.useState)(__e),[we,Te]=(0,p.useState)(null),[Ee,De]=(0,p.useState)(()=>b7()),[Oe,ke]=(0,p.useState)(()=>y7()),[Ae,je]=(0,p.useState)(0),[Me,Ne]=(0,p.useState)(()=>({query:``,hideStaleTickets:!1,hideBundlesWithPullRequests:!1})),[Pe,Fe]=(0,p.useState)(null),[Ie,Le]=(0,p.useState)(null),[Re,ze]=(0,p.useState)({}),[G,Be]=(0,p.useState)({}),[Ve,He]=(0,p.useState)({}),[Ue,K]=(0,p.useState)({}),[We,Ge]=(0,p.useState)(!1),[qe,q]=(0,p.useState)(!1),[Je,J]=(0,p.useState)(!1),[Xe,Ze]=(0,p.useState)(!1),[Y,Qe]=(0,p.useState)(!1),[$e,et]=(0,p.useState)(!1),[tt,nt]=(0,p.useState)(`idle`),[rt,it]=(0,p.useState)(0),[ot,st]=(0,p.useState)(!1),{isGitHubConnected:ct,defaultBaseBranch:lt}=ew(y),[ut,dt]=(0,p.useState)(null),[ft,pt]=(0,p.useState)(!1),mt=(0,p.useRef)(null),ht=(0,p.useRef)(null),gt=(0,p.useRef)(null),vt=(0,p.useRef)(0),yt=(0,p.useRef)(-1),bt=(0,p.useRef)(!1),xt=(0,p.useRef)(0),St=(0,p.useRef)(window.localStorage.getItem(R7)),Ct=ae[u],wt=Ct.models,Tt=Ct.loaded,Et=ce[u].model,Dt=ce[u].variant,Ot=(0,p.useCallback)(()=>{oe(e=>({...e,[u]:{models:[],loaded:!1}})),se(e=>e+1)},[u]),kt=_.find(e=>e.id===y)??null,At=!!kt?.memory_enabled,jt=y?Se[y]??`board`:`board`,Mt=jt===`memory`?At?`memory`:`board`:jt,Nt=c?.projectId??a_e(window.location.pathname),Pt=Nt?_.find(e=>e.id===Nt)??null:null,It=c?.kind===`repository-inspection`?c:null,Lt=c?.kind===`workspace`&&c.workspace===`memory`&&Pt?.memory_enabled!==!0,Rt=tt===`error`,zt=!!(c&&Pt&&y!==c.projectId),Vt=ue&&window.location.pathname.startsWith(`/app`)&&(!c||!Pt||Lt||$e),Ht=_.find(e=>e.id===St.current)??null,Ut=_[0]??null,Wt=(0,p.useCallback)(t=>{if(!y)return;Ce(e=>({...e,[y]:t.workspace})),De(e=>x7(e,t.workspace));let n=t.workspace===`board`?{kind:`ticket`,projectId:y,ticketId:t.ticketId}:t.workspace===`chat`?{kind:`chat-session`,projectId:y,chatSessionId:t.chatSessionId}:t.specSnapshotId?{kind:`spec-snapshot`,projectId:y,specSessionId:t.specSessionId,specSnapshotId:t.specSnapshotId}:{kind:`spec-session`,projectId:y,specSessionId:t.specSessionId};if(c?.kind===`activity-run`){e.replace(n);return}e.push(n)},[y,e,c]),Kt=(0,p.useCallback)(t=>{y&&(Ce(e=>({...e,[y]:t.workspace})),De(e=>x7(e,t.workspace)),Te(t),e.push({kind:`workspace`,projectId:y,workspace:t.workspace}))},[y,e]),qt=(0,p.useCallback)((e,t,n)=>{y&&Kt({workspace:`chat`,draft:!0,draftText:e,specSessionId:t,specSnapshotId:n})},[y,Kt]),Yt=(0,p.useCallback)((e,t)=>{Wt({workspace:`spec`,specSessionId:e,specSnapshotId:t})},[Wt]),Xt=(0,p.useCallback)(e=>{if(e.source_available){if(e.ticket_id){Wt({workspace:`board`,ticketId:e.ticket_id});return}if(e.chat_session_id){Wt({workspace:`chat`,chatSessionId:e.chat_session_id});return}e.spec_session_id&&Wt({workspace:`spec`,specSessionId:e.spec_session_id})}},[Wt]),Zt=(0,p.useCallback)(e=>{if(e.available){if(J(!1),e.kind===`ticket`){Wt({workspace:`board`,ticketId:e.id});return}if(e.kind===`chat_session`){Wt({workspace:`chat`,chatSessionId:e.id});return}e.kind===`spec_session`&&Wt({workspace:`spec`,specSessionId:e.id})}},[Wt]),Qt=(0,p.useCallback)(e=>{Kt({workspace:`spec`,issueDraft:!0,draft:e})},[Kt]),$t=(0,p.useCallback)(e=>{Kt({workspace:`board`,issueDraft:!0,draft:e})},[Kt]),en=(0,p.useCallback)(()=>{Te(null)},[]),tn=kt!==null,on=l_e(kt),sn=!!kt?.run_ide?.trim(),cn=y!==null&&C===y,ln=y!==null&&(!on||T===y),un=y?D[y]??$7(y):null,dn=y?k[y]??null:null,fn=y?!!j[y]:!1,pn=y?N[y]??null:null,mn=(0,p.useMemo)(()=>y?Re[y]??[]:[],[y,Re]),hn=y?!!G[y]:!1,gn=y?Ve[y]??{current_branch:null,default_branch:null,previous_branch:null}:{current_branch:null,default_branch:null,previous_branch:null},_n=y?!!Ue[y]:!1,vn=y?F[y]??null:null,yn=t9(L,y),bn=yn!==`hidden`,xn=b_e({activeRun:x,project:kt,projectId:y}),Sn=xn?.context_key??null,Cn=y?z[y]??null:null,wn=x8(kt),Tn=Sn===re,En=(0,p.useMemo)(()=>wge(Ee),[Ee]),Dn=(0,p.useMemo)(()=>S7({hasRunning:En.hasRunning,hasFinishedUnseen:Oe.hasFinishedUnseen,hasErrorUnseen:Oe.hasErrorUnseen}),[En.hasRunning,Oe.hasErrorUnseen,Oe.hasFinishedUnseen]);(0,p.useEffect)(()=>{Fe(null),Le(null),ht.current=null},[y]),(0,p.useEffect)(()=>{Le(null)},[Mt]),(0,p.useEffect)(()=>{bn||(ht.current=null)},[bn]),(0,p.useEffect)(()=>{let e=Pe?.target?.kind??null;if(e===`ticket`||e===`bundle`){ht.current=Pe;return}(Mt===`board`||!bn)&&(ht.current=Pe)},[bn,Pe,Mt]),(0,p.useEffect)(()=>{De(b7())},[y]),(0,p.useEffect)(()=>{ke(y7())},[y]),(0,p.useEffect)(()=>{if(!y||ax(y))return;let e=new AbortController;return at(y,e.signal).then(e=>{ix(y,e.connections)}).catch(e=>{Ye(e)}),()=>{e.abort()}},[y]);let On=(0,p.useCallback)((e,t)=>{document.visibilityState!==`visible`&&(!t.didFinish&&!t.didError||ke(e=>{let n={...e,hasFinishedUnseen:e.hasFinishedUnseen||t.didFinish,hasErrorUnseen:e.hasErrorUnseen||t.didError};return e.hasFinishedUnseen===n.hasFinishedUnseen&&e.hasErrorUnseen===n.hasErrorUnseen?e:n}))},[]);(0,p.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&ke(e=>!e.hasFinishedUnseen&&!e.hasErrorUnseen?e:{...e,hasFinishedUnseen:!1,hasErrorUnseen:!1})};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[]),(0,p.useEffect)(()=>{let e=e=>{e.tool!==`claude`&&e.tool!==`opencode`||(vt.current+=1,d(e.tool),g(!0))};return t.on(`tool:updated`,e),()=>{t.off(`tool:updated`,e)}},[t]),(0,p.useEffect)(()=>(mt.current===null&&(mt.current=document.querySelector(`link[rel="icon"]`)?.getAttribute(`href`)??`/favicon.svg`),M7({defaultHref:mt.current,state:Dn}),()=>{M7({defaultHref:mt.current,state:null})}),[Dn]);let kn=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r}=t;try{let t=await er(e,r,{refreshRemote:n});if(r?.aborted)return;O(n=>({...n,[e]:p_e(e,t)}))}catch(t){if(Ye(t))return;if(t instanceof Ke&&t.status===404){O(t=>({...t,[e]:{...$7(e),status:`unknown`}}));return}O(t=>({...t,[e]:{projectId:e,branch:t[e]?.branch??null,status:`unknown`,ahead:t[e]?.ahead??0,behind:t[e]?.behind??0,hasUpstream:t[e]?.hasUpstream??!1,canPull:t[e]?.canPull??!1,diffStats:t[e]?.diffStats??null}}))}},[]),An=(0,p.useCallback)(async(e,t={})=>{let{refreshRemote:n=!1,signal:r,suppressLoading:i=!1}=t;i||M(t=>({...t,[e]:!0}));try{let t=await dr(e,{refreshRemote:n,signal:r});if(r?.aborted)return;A(n=>({...n,[e]:t}))}catch(t){if(Ye(t))return;t instanceof Ke&&t.status===404&&A(t=>({...t,[e]:null}))}finally{!r?.aborted&&!i&&M(t=>({...t,[e]:!1}))}},[]),Mn=(0,p.useCallback)((e,t)=>{P(n=>({...n,[e]:t}))},[]),Nn=(0,p.useCallback)(async(e,t)=>{A(n=>({...n,[e.id]:t})),e.active_target_kind!==`bundle`&&await kn(e.id),t6(e.id)},[kn]);(0,p.useEffect)(()=>{let e=new AbortController;return(async()=>{let t=vt.current;try{let{tool:n}=await Wr(e.signal);vt.current===t&&d(n)}catch(e){Ye(e)}finally{e.signal.aborted||g(!0)}})(),Ur(e.signal).then(t=>{e.signal.aborted||m(t.length>0?t:Vr())}).catch(()=>{m(Vr())}),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(!ue||_.length>0&&fe===null||Ct.loaded)return;let e=new AbortController;return(async()=>{try{let t=await zr(u,e.signal);if(e.signal.aborted)return;oe(e=>({...e,[u]:{models:t,loaded:!0}}))}catch{}finally{e.signal.aborted||oe(e=>({...e,[u]:{...e[u],loaded:!0}}))}})(),()=>{e.abort()}},[Ct.loaded,u,W,fe,_.length,ue]),(0,p.useEffect)(()=>{let e=new AbortController;return(async()=>{try{let t=await Hn(e.signal);if(e.signal.aborted)return;v(t)}catch(e){Ye(e)||v([])}finally{e.signal.aborted||de(!0)}})(),()=>{e.abort()}},[]),(0,p.useEffect)(()=>{if(!ue||yt.current===i)return;yt.current=i,et(!1),nt(`idle`),Te(e=>e&&c?.kind===`workspace`&&c.workspace===e.workspace?e:null);let e=r.some(e=>e.kind===`activity-run`),t=r.some(e=>e.kind===`checks`);if(!e&&c?.kind!==`activity-run`&&!bt.current&&J(!1),!t&&c?.kind!==`checks`&&_e(null),window.location.pathname===`/`){let e=_.find(e=>e.id===St.current)??_[0]??null;if(!e){b(null);return}let t=Se[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;b(e.id),Ce(t=>({...t,[e.id]:n})),s({kind:`workspace`,projectId:e.id,workspace:n});return}if(!c)return;let n=_.find(e=>e.id===c.projectId);if(!n)return;b(n.id);let a=c.kind===`workspace`?c.workspace:c.kind===`ticket`||c.kind===`bundle`?`board`:c.kind===`repository-inspection`||c.kind===`bundle-inspection`||c.kind===`ticket-inspection`?Se[n.id]??`board`:c.kind===`chat-session`?`chat`:c.kind===`spec-session`||c.kind===`spec-snapshot`?`spec`:Se[n.id]??`board`;Ce(e=>({...e,[n.id]:a})),bt.current&&c.kind!==`checks`&&(bt.current=!1,J(!0)),(c.kind===`activity-run`||e)&&J(!0),G4(c)!==window.location.pathname&&s(c)},[c,r,i,_,ue,s,Se]),(0,p.useEffect)(()=>{if(c?.kind!==`checks`||!ue)return;let e=_.find(e=>e.id===c.projectId);if(!e)return;let t=new AbortController,n=++xt.current;return nt(`loading`),Jt(e.id,c.batchRunId,t.signal).then(({batch:r})=>{t.signal.aborted||xt.current!==n||(_e({projectId:e.id,targetKind:r.target_kind,targetBundleId:r.target_bundle_id,targetLabel:r.target_label??e.name,definitions:r.selected_definition_snapshots,requiredDefinitionIds:[],preReviewDefinitionIds:[]}),nt(`idle`))}).catch(e=>{if(!Ye(e)){if(e instanceof Ke&&e.status===404){et(!0);return}nt(`error`)}}),()=>t.abort()},[c,_,ue,rt]),(0,p.useEffect)(()=>{if(st(!1),!y||!ct||Y)return;let e=new AbortController,t=async()=>{try{let t=await Gt(y,e.signal);e.signal.aborted||st(t.activeCount>0)}catch(e){Ye(e)}};t();let n=window.setInterval(()=>{t()},H7);return()=>{e.abort(),window.clearInterval(n)}},[y,Y,ct]),(0,p.useEffect)(()=>{if(ue){if(y){St.current=y,window.localStorage.setItem(R7,y);return}window.localStorage.removeItem(R7)}},[y,ue]),(0,p.useEffect)(()=>{window.localStorage.setItem(z7,JSON.stringify(Se))},[Se]),(0,p.useEffect)(()=>{window.localStorage.setItem(B7,JSON.stringify(L))},[L]),(0,p.useEffect)(()=>{window.localStorage.setItem(V7,JSON.stringify(z))},[z]),(0,p.useEffect)(()=>{O(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),A(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),M(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[_]),(0,p.useEffect)(()=>{xe(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[_]),(0,p.useEffect)(()=>{let e=new Set(_.map(e=>e.id));ze(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),Be(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),He(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t)))),K(t=>Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t))))},[_]),(0,p.useEffect)(()=>{ue&&(I(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),R(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}),ee(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}))},[_,ue]),(0,p.useEffect)(()=>{ue&&Ce(e=>{let t=new Set(_.map(e=>e.id)),n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[_,ue]),(0,p.useEffect)(()=>{if(!ue||!y||!tn)return;let e=!1,t=null,n=null;O(e=>e[y]?e:{...e,[y]:$7(y)});let r=async(r=!1)=>{let i=r?`remote`:`local`;if(t){if(n===`remote`||n===i)return;t.abort()}let a=new AbortController;t=a,n=i;try{await Promise.all([kn(y,{refreshRemote:r,signal:a.signal}),An(y,{refreshRemote:r,signal:a.signal})])}catch{if(e||a.signal.aborted)return}finally{t===a&&(t=null,n=null)}};r(!1);let i=$b(()=>{document.visibilityState===`visible`&&r(!1)});return()=>{e=!0,t?.abort(),i()}},[y,tn,ue,kn,An]),(0,p.useEffect)(()=>{if(y)return n6(e=>{e===y&&(kn(e),An(e))})},[y,kn,An]),(0,p.useEffect)(()=>{if(!y||!tn)return;let e=dn?.operation_state??`idle`;if(!(pn===`rebase`||e!==`idle`))return;let t=!1,n=null,r=null,i=async()=>{r?.abort(),r=new AbortController;try{await An(y,{signal:r.signal,suppressLoading:!0})}catch{}finally{t||(n=window.setTimeout(()=>{i()},Zge))}};return i(),()=>{t=!0,r?.abort(),n!==null&&window.clearTimeout(n)}},[pn,y,dn?.operation_state,tn,An]);let Pn=(0,p.useCallback)(async e=>{let t=y;if(!t){S(null),E(null);return}try{let n=await nn(t,e);e?.aborted||(S(n.active_run),E(t))}catch(e){Ye(e)}},[y]),Fn=(0,p.useCallback)(async e=>{let t=y;if(t)try{let n=await Bt(t,e);e?.aborted||I(e=>({...e,[t]:n}))}catch(e){Ye(e)}},[y]);(0,p.useEffect)(()=>{if(!ue)return;if(!on){S(null),E(null);return}if(!cn)return;let e=new AbortController;E(null),Pn(e.signal);let t=window.setInterval(()=>{Pn(e.signal)},H7),n=$b(()=>{document.visibilityState===`visible`&&Pn(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[cn,on,ue,Pn]),(0,p.useEffect)(()=>{if(!ue||!y||!cn||!wn)return;let e=new AbortController;Fn(e.signal);let t=window.setInterval(()=>{Fn(e.signal)},H7),n=$b(()=>{document.visibilityState===`visible`&&Fn(e.signal)});return()=>{e.abort(),window.clearInterval(t),n()}},[y,cn,wn,ue,Fn]),(0,p.useEffect)(()=>{window.localStorage.setItem(U7,String(B))},[B]),(0,p.useEffect)(()=>{window.localStorage.setItem(W7,te)},[te]),(0,p.useEffect)(()=>{window.localStorage.setItem(G7,String(U))},[U]),(0,p.useEffect)(()=>{y&&Sn&&ee(e=>{let t=e[y]??null;return!t||t===Sn?e:{...e,[y]:null}})},[y,Sn]),(0,p.useEffect)(()=>{!y||!xn||!x8(kt)||Cn!==xn.context_key&&R(e=>t9(e,y)===`hidden`?{...e,[y]:`inline`}:e)},[kt,y,Cn,xn]);let In=async e=>{let t=vt.current+1;vt.current=t;try{let n=await Gr(e);if(vt.current!==t)return;d(n.tool)}catch{}},Ln=(0,p.useCallback)(e=>{v(t=>t.map(t=>t.id===e.id?e:t))},[]),Rn=(0,p.useCallback)((e,t)=>{ze(n=>{let r=[t,...(n[e]??[]).filter(e=>e.id!==t.id)];return{...n,[e]:r}})},[]),zn=(0,p.useCallback)(async e=>{K(t=>({...t,[e]:!0}));try{let t=await Jn(e);He(n=>({...n,[e]:t}))}catch(e){$.error(e instanceof Ke?e.message:`Unable to load the project target options right now.`,{id:`project-target-selector-load-error`})}finally{K(t=>({...t,[e]:!1}))}},[]),Bn=async e=>{try{let t=await Un(Z7(e));return v(e=>[...e,t]),b(t.id),s({kind:`workspace`,projectId:t.id,workspace:`board`}),pe(null),null}catch(e){return e instanceof Ke?e.message:`Unable to create the project right now.`}},Vn=async e=>{if(!kt)return`Select a project before editing settings.`;try{let t=Z7(e);delete t.build_execution_provider;let n=await Wn(kt.id,t);return v(e=>e.map(e=>e.id===n.id?n:e)),je(e=>e+1),pe(null),null}catch(e){return e instanceof Ke?e.message:`Unable to update the project right now.`}},$n=async()=>{if(!kt)return`Select a project before deleting it.`;try{await Kn(kt.id);let e=_.filter(e=>e.id!==kt.id);return v(e),b(e[0]?.id??null),e[0]&&s({kind:`workspace`,projectId:e[0].id,workspace:`board`}),pe(null),null}catch(e){return e instanceof Ke?e.message:`Unable to delete the project right now.`}},ir=(0,p.useCallback)(e=>{v(t=>t.map(t=>f_e(t,e)))},[]),ar=(0,p.useCallback)((e,t)=>{e&&ze(n=>({...n,[e]:t}))},[]),or=(0,p.useCallback)((e,t)=>{e&&Be(n=>({...n,[e]:t}))},[]),sr=async(e,t,n)=>await Xn({repo_path:e,tool:u,helper_models:yw({},u,{model:t||null,variant:t&&n||null})}),cr=async()=>(await Zn()).repo_path,lr=(0,p.useCallback)(async e=>{let t=await Qn({repo_path:e});return{valid:t.valid,repoRoot:t.repo_root,error:t.error,willInitialize:t.will_initialize,hasInitialCommit:t.has_initial_commit}},[]),ur=(0,p.useCallback)(async()=>{if(!(!kt||ve)){ye(!0);try{let e=await Gn(kt.id);v(t=>t.map(t=>t.id===e.id?e:t)),$.success(`Initial commit created.`,{id:`project-initial-commit-success`}),kn(e.id),An(e.id)}catch(e){$.error(e instanceof Ke?e.message:`Unable to create the initial commit right now.`,{id:`project-initial-commit-error`})}finally{ye(!1)}}},[kt,ve,kn,An]),fr=(0,p.useCallback)((e,t)=>{R(t=>({...t,[e]:`hidden`})),t&&ee(n=>({...n,[e]:t}))},[]),pr=(0,p.useCallback)(()=>{y&&fr(y,Sn)},[y,fr,Sn]),mr=(0,p.useCallback)(e=>{y&&(R(e=>({...e,[y]:`hidden`})),e&&S(t=>t?.context_key===e?null:t))},[y]),hr=(0,p.useCallback)(async()=>{if(!xn||re===xn.context_key)return;let{context_key:e}=xn;ie(e);try{xn.kind===`ticket`?await jn(xn.ticket_id,xn.project_id):S((await an(xn.project_id)).active_run),mr(e),await Promise.all([Pn(),Fn()])}catch(e){$.error(e instanceof Ke?e.message:`Unable to stop the preview run right now.`,{id:`app-preview-run-stop-error`})}finally{ie(t=>t===e?null:t)}},[mr,xn,Fn,Pn,re]),gr=(0,p.useCallback)(e=>{!e||!y||zn(y)},[y,zn]),_r=(0,p.useCallback)(e=>new Promise(t=>{gt.current=t,dt(e)}),[]),vr=(0,p.useCallback)(e=>{let t=gt.current;gt.current=null,dt(null),t?.(e)},[]),yr=(0,p.useCallback)(async e=>{if(!kt||!y)throw Error(`Select a project first.`);if(!x_e({activeProject:kt,activeProjectBranchState:un,nextTarget:e})||!x||x.kind!==`project`||x.project_id!==kt.id)return!0;if(!await _r({title:`Stop current run and switch target?`,description:`Switching targets will stop the current run and close its preview.`,confirmLabel:`Stop and switch`,cancelLabel:`Keep current target`,confirmVariant:`destructive`}))return!1;try{let e=x.context_key,t=await an(kt.id);return mr(e),S(t.active_run),await Fn(),!0}catch(e){return $.error(e instanceof Ke?e.message:`Unable to stop the project run right now.`,{id:`project-target-switch-stop-run-error`}),!1}},[kt,un,y,x,mr,Fn,_r]),br=(0,p.useCallback)(async e=>{if(!y)throw Error(`Select a project first.`);return await yr({kind:`bundle`,bundleId:e})?(Ln(await Yn(y,{kind:`bundle`,bundle_id:e})),A(e=>({...e,[y]:null})),await Promise.all([kn(y),An(y)]),!0):!1},[y,yr,kn,An,Ln]),xr=(0,p.useCallback)(async(e,t={})=>{if(!y)throw Error(`Select a project first.`);if(!await yr({kind:`repo_root`,branch:e}))return!1;let n=n=>Yn(y,{kind:`repo_root`,...e?{branch:e}:{},...t.createBranch===!1?{create_branch:!1}:{},...n?{confirm_dirty_switch:!0}:{}}),r;try{r=await n(t.confirmDirtySwitch===!0)}catch(e){if(!t.confirmDirtySwitch&&e instanceof Ke&&e.status===409&&e.message===r9){if(!await _r({title:`Switch repo root branch?`,description:`${r9}\n\nSwitch anyway?`,confirmLabel:`Switch anyway`,cancelLabel:`Keep current branch`}))return!1;r=await n(!0)}else throw e}return Ln(r),A(e=>({...e,[y]:null})),await Promise.all([kn(y),An(y),zn(y)]),!0},[y,yr,zn,kn,An,Ln,_r]),Sr=(0,p.useCallback)(async e=>!e.target_kind||e.target_available===!1?!0:e.target_kind===`bundle`?e.target_bundle_id?await br(e.target_bundle_id):!1:await xr(e.target_branch_snapshot??null,{createBranch:!1}),[br,xr]),Cr=(0,p.useCallback)(async e=>{y&&await br(e)&&Kt({workspace:`chat`,startNewDraft:!0})},[y,br,Kt]),wr=(0,p.useCallback)(()=>{Ge(!0)},[]),Tr=(0,p.useCallback)(()=>{Ge(!1)},[]),Er=(0,p.useCallback)(e=>{if(e){br(e);return}xr(null)},[br,xr]),Dr=(0,p.useCallback)(async e=>{if(!y)throw Error(`Select a project first.`);let t=await _t(y,{name:e,prepare:!0});return Rn(y,t),je(e=>e+1),t},[y,Rn]),Or=(0,p.useCallback)(async e=>{if(!y)throw Error(`Select a project first.`);let t=await Ft(y,e);t.warning&&$.warning(t.warning,{id:`bundle-delete-warning`}),ze(t=>({...t,[y]:(t[y]??[]).filter(t=>t.id!==e)})),je(e=>e+1)},[y]),kr=(0,p.useCallback)(async(e=`project_default`,t=!1)=>{if(!kt)return;let n=kt.active_target_kind??`repo_root`,r=kt.active_target_bundle_id??null,i=x?.kind===`project`&&x.project_id===kt.id&&(x.target_kind??`repo_root`)===n&&((x.target_kind??`repo_root`)!==`bundle`||x.target_bundle_id===r),a=i?x?.context_key??null:null;if(!i&&!t&&S8(kt)){pt(!0);return}let o=!i&&x8(kt)&&yn===`hidden`;o&&(R(e=>({...e,[kt.id]:`inline`})),ee(e=>({...e,[kt.id]:null})));try{let t=i?await an(kt.id):await rn(kt.id,e);i&&mr(a),S(t.active_run),Fn()}catch(e){o&&R(e=>({...e,[kt.id]:`hidden`})),$.error(e instanceof Ke?e.message:`Unable to update the project run right now.`,{id:`app-project-run-error`})}},[yn,kt,x,mr,Fn]),Ar=(0,p.useCallback)(async()=>{if(!(!kt||!sn))try{await qn(kt.id)}catch(e){$.error(e instanceof Error?e.message:`Unable to open the IDE right now.`,{id:`app-project-open-ide-error`})}},[kt,sn]),jr=(0,p.useCallback)(async()=>{if(kt){Mn(kt.id,`pull`);try{let e=await tr(kt.id);await Nn(kt,e),$.success(e.behind===0?L7(`branchSynced`):L7(`branchUpdated`),{id:`app-project-pull-success`})}catch(e){$.error(e instanceof Ke?e.message:L7(`syncFallbackError`),{id:`app-project-pull-error`})}finally{Mn(kt.id,null)}}},[kt,Nn,Mn]),Mr=(0,p.useCallback)(async()=>{if(!kt)return;let e=dn?.base_branch??null;Mn(kt.id,`rebase`);try{let t=await nr(kt.id);await Nn(kt,t);let n=t.base_branch??e;$.success(n?L7(`branchRebasedOnto`,{branch:n}):L7(`branchRebased`),{id:`app-project-rebase-success`})}catch(e){await Promise.allSettled([kn(kt.id),An(kt.id,{suppressLoading:!0})]),$.error(e instanceof Ke?e.message:L7(`rebaseFallbackError`),{id:`app-project-rebase-error`})}finally{Mn(kt.id,null)}},[kt,dn?.base_branch,Nn,kn,An,Mn]),Nr=(0,p.useCallback)(async()=>{if(kt){Mn(kt.id,`abort`);try{await Nn(kt,await rr(kt.id)),$.success(L7(`gitOperationAborted`),{id:`app-project-abort-success`})}catch(e){$.error(e instanceof Ke?e.message:L7(`abortFallbackError`),{id:`app-project-abort-error`})}finally{Mn(kt.id,null)}}},[kt,Nn,Mn]),Pr=(0,p.useCallback)(e=>{kt&&a(kt.active_target_kind===`bundle`&&kt.active_target_bundle_id?{kind:`bundle-inspection`,projectId:kt.id,bundleId:kt.active_target_bundle_id,mode:e}:{kind:`repository-inspection`,projectId:kt.id,mode:e})},[kt,a]),Fr=(0,p.useCallback)(()=>{if(c?.kind!==`repository-inspection`)return;let{projectId:e}=c;n(c,{kind:`workspace`,projectId:e,workspace:`board`}),kn(e),An(e)},[n,c,kn,An]),Ir=(0,p.useCallback)(()=>{if(!kt)return;let e=kt.active_target_kind??`repo_root`,t=kt.active_target_bundle_id??null,n=e===`bundle`?mn.find(e=>e.id===t):null,r=n?.required_check_policy;_e({projectId:kt.id,targetKind:e,targetBundleId:t,targetLabel:n?My(n):kt.name,definitions:uw(kt),requiredDefinitionIds:r?.required_check_definition_ids??dw(kt),preReviewDefinitionIds:r?.pre_review_check_definition_ids??fw(kt)})},[kt,mn]),Lr=(0,p.useCallback)(()=>{_e(null),c?.kind===`checks`&&n(c)},[n,c]),Rr=(0,p.useCallback)(()=>{J(!1),_e(null),c?.kind===`activity-run`&&n(c)},[n,c]),Br=(0,p.useCallback)(()=>{c?.kind===`activity-run`&&(bt.current=!0,n(c))},[n,c]),Hr=(0,p.useCallback)(()=>{et(!0)},[]),Kr=(0,p.useCallback)((e,t)=>{if(!y)return;if(e.kind===`check_batch`){a({kind:`checks`,projectId:y,batchRunId:e.id});return}if(e.kind===`check_attempt`&&t){a({kind:`checks`,projectId:y,batchRunId:t,attemptRunId:e.id});return}let n={kind:`activity-run`,projectId:y,runId:e.id};c?.kind===`activity-run`?s(n):a(n)},[y,c,a,s]),qr=(0,p.useCallback)(e=>{if(!y)return;if(e.kind===`source_batch`||e.kind===`verification_batch`||e.kind===`required_check_gate`){Je&&c?.kind!==`activity-run`&&(bt.current=!0),a({kind:`checks`,projectId:y,batchRunId:e.executionRunId});return}let t={kind:`activity-run`,projectId:y,runId:e.executionRunId};c?.kind===`activity-run`?s(t):a(t)},[y,c,Je,a,s]),Jr=(0,p.useCallback)((e,t)=>{if(!y)return;let n={kind:`checks`,projectId:y,batchRunId:e,attemptRunId:t};if(c?.kind===`checks`){G4(c)!==G4(n)&&s(n);return}a(n)},[y,c,a,s]),Yr=e9(be,y),Xr=kt?mw(kt).length>0:!1,Zr=kt?uw(kt).length>0:!1,Qr=Mt===`chat`?Ie:null,$r=ht.current,ei=$r?.target?.kind??null,ti=Mt===`chat`?ei===`ticket`||ei===`bundle`?{target:$r?.target??null,canSelect:!1,disabledReason:`This preview belongs to a ticket run. Return to Board to send preview comments.`,promptMode:$r?.promptMode??null,onPromptModeChange:$r?.onPromptModeChange??null,isUpdatingPromptMode:$r?.isUpdatingPromptMode??!1,promptPlaceholder:$r?.promptPlaceholder??null,promptComposerControls:$r?.promptComposerControls,promptComposerInlineControls:$r?.promptComposerInlineControls,submitPrompt:null}:Qr?{target:{kind:`chat_session`,id:Qr.chatSessionId??`draft:${y}`},canSelect:Qr.canSubmitReviewPrompt,disabledReason:Qr.canSubmitReviewPrompt?null:Qr.reviewSubmitDisabledReason??`Wait for the current chat turn to finish before sending preview comments.`,promptMode:Qr.mode,onPromptModeChange:Qr.onModeChange,isUpdatingPromptMode:Qr.isUpdatingMode,promptPlaceholder:Qr.promptPlaceholder,promptComposerControls:Qr.promptComposerControls,promptComposerInlineControls:Qr.promptComposerInlineControls,submitPrompt:Qr.canSubmitReviewPrompt?Qr.submitPrompt:null}:{target:null,canSelect:!1,disabledReason:`Select a chat session to send preview comments.`,submitPrompt:null}:Pe,ni=Qr?.canSubmitReviewPrompt??!1,ri=Mt===`chat`?Qr?Qr.reviewSubmitDisabledReason:`Select a chat session to send review comments.`:jb.t(`common:workspaceReviewModal.chatRequired`),ii=(0,p.useCallback)(()=>{y&&xe(e=>{let t=e[y]??K7;return{...e,[y]:{hasMounted:!0,isOpen:!t.isOpen,isExpanded:t.isExpanded}}})},[y]),ai=(0,p.useCallback)(e=>{xe(t=>{let n=t[e]??K7;return!n.hasMounted||!n.isOpen?t:{...t,[e]:K7}})},[]),oi=(0,p.useCallback)(e=>{xe(t=>{let n=t[e]??K7;return{...t,[e]:{hasMounted:!0,isOpen:n.isOpen,isExpanded:!n.isExpanded}}})},[]),si=(0,p.useCallback)(()=>{he(`general`),pe(`create`)},[]),ci=(0,p.useCallback)((e=`general`)=>{he(e),pe(`edit`)},[]),li=(0,p.useCallback)(e=>{let t=Se[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;b(e.id),a({kind:`workspace`,projectId:e.id,workspace:n})},[a,Se]),ui=(0,p.useCallback)(e=>{y&&(c?.kind===`ticket`&&c.ticketId===e||a({kind:`ticket`,projectId:y,ticketId:e}))},[y,c,a]),di=(0,p.useCallback)(()=>{c?.kind===`ticket`&&n(c)},[n,c]),fi=(0,p.useCallback)(e=>{y&&(c?.kind===`bundle`&&c.bundleId===e||a({kind:`bundle`,projectId:y,bundleId:e}))},[y,c,a]),pi=(0,p.useCallback)(()=>{c?.kind===`bundle`&&n(c)},[n,c]),mi=(0,p.useCallback)((e,t)=>{y&&a(e.kind===`ticket`?{kind:`ticket-inspection`,projectId:y,ticketId:e.ticketId,mode:t}:{kind:`bundle-inspection`,projectId:y,bundleId:e.bundleId,mode:t})},[y,a]),hi=(0,p.useCallback)(e=>{if(c?.kind===`repository-inspection`){if(c.mode===e)return;o({...c,mode:e});return}if(c?.kind===`ticket-inspection`||c?.kind===`bundle-inspection`){if(c.mode===e)return;o({...c,mode:e})}},[c,o]),gi=(0,p.useCallback)(()=>{c?.kind!==`ticket-inspection`&&c?.kind!==`bundle-inspection`||n(c)},[n,c]),_i=(0,p.useCallback)(e=>{if(!y)return;let t=e?{kind:`chat-session`,projectId:y,chatSessionId:e}:{kind:`workspace`,projectId:y,workspace:`chat`};c&&G4(c)===G4(t)||a(t)},[y,c,a]),vi=(0,p.useCallback)(e=>{if(!y)return;let t=e?{kind:`spec-session`,projectId:y,specSessionId:e}:{kind:`workspace`,projectId:y,workspace:`spec`};c&&G4(c)===G4(t)||a(t)},[y,c,a]),yi=(0,p.useCallback)(()=>{if(y){if(bn){pr();return}R(e=>({...e,[y]:`inline`})),ee(e=>({...e,[y]:null}))}},[y,pr,bn]),bi=(0,p.useCallback)(()=>{y&&R(e=>{let t=t9(e,y);return{...e,[y]:t===`expanded`?`inline`:`expanded`}})},[y]),xi=kt?kt.preview_service_name?.trim()?kt.preview_capability_mode===`force_disabled`?`Preview is disabled for this project.`:vn?.state===`unsupported`?vn.message??`Preview is unavailable for this project.`:bn?`Hide preview`:`Show preview`:`Choose a named preview service in project settings first.`:`Select a project first.`,Si=!kt||!kt.preview_service_name?.trim()||kt.preview_capability_mode===`force_disabled`||vn?.state===`unsupported`,Ci=kt&&kt.preview_service_name?.trim()?(0,X.jsx)(SM,{project:kt,mode:yn===`expanded`?`expanded`:`inline`,status:vn,viewportPreset:te,zoom:U,activeRun:xn,reviewCapability:ti,isStoppingActiveRun:Tn,onHide:pr,onStopActiveRun:()=>{hr()},onToggleExpanded:bi,onViewportPresetChange:H,onZoomChange:ne}):null;return(0,X.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-[linear-gradient(180deg,_rgba(15,16,21,1),_rgba(9,10,14,1))] text-foreground`,children:[(0,X.jsx)(Zb,{}),_.length>0&&(0,X.jsx)(`header`,{className:`border-b border-border bg-background/95 px-6 py-3 backdrop-blur`,children:(0,X.jsxs)(`div`,{className:`grid items-start gap-3 [grid-template-columns:minmax(0,1fr)_auto] min-[1440px]:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] min-[1440px]:items-center`,children:[(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`div`,{className:`min-w-0 w-full sm:w-[20rem] sm:min-w-[20rem] sm:max-w-[20rem]`,children:(0,X.jsx)(_v,{activeProjectId:y,onCreateProject:si,projects:_,onEditProject:()=>ci(),onProjectChange:e=>{let t=_.find(t=>t.id===e);t&&li(t)}})}),y&&(0,X.jsx)(rC,{projectId:y,onStartSpecFromDraft:Qt,onCreateTicketFromDraft:$t})]})}),(0,X.jsx)(`div`,{className:`min-w-0 justify-self-end min-[1440px]:col-start-3 min-[1440px]:row-start-1`,children:(0,X.jsx)(Db,{activeTool:u,agents:f,onMobileAccessOpen:()=>q(!0),onOpenActivity:()=>J(!0),onOpenExecutionRuntimes:()=>Ze(!0),onToolChange:In,...ct?{hasActiveGitHubRuns:ot,onOpenGitHubActions:()=>Qe(!0)}:{}})}),y&&(0,X.jsx)(`div`,{className:`col-span-2 flex min-w-0 justify-center min-[1440px]:col-span-1 min-[1440px]:col-start-2 min-[1440px]:row-start-1 min-[1440px]:justify-self-center`,children:(0,X.jsx)(zge,{activeWorkspace:Mt,activityByWorkspace:Ee,className:`w-fit max-w-full`,memoryEnabled:At,onWorkspaceChange:e=>{y&&(Ce(t=>({...t,[y]:e})),De(t=>x7(t,e)),a({kind:`workspace`,projectId:y,workspace:e}))}})})]})}),!ue||zt?(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Loading projects...`}):Vt||Rt?(0,X.jsx)(pv,{isTransientError:Rt,requestedProjectExists:Pt!==null,retainedProject:Ht?.id===Pt?.id?null:Ht,defaultProject:Ut,onCreateProject:si,onRetry:()=>it(e=>e+1),onOpenProject:e=>{let t=Se[e.id]??`board`,n=t===`memory`&&!e.memory_enabled?`board`:t;b(e.id),s({kind:`workspace`,projectId:e.id,workspace:n})},onOpenWorkspace:()=>{if(!Pt)return;let e=o_e(c),t=e===`memory`&&!Pt.memory_enabled?`board`:e;b(Pt.id),s({kind:`workspace`,projectId:Pt.id,workspace:t})}}):_.length===0?(0,X.jsx)(fv,{activeTool:u,agents:f,availableHelperModels:wt,helperModel:Et,helperVariant:Dt,isHelperModelsLoaded:Tt,isToolLoaded:h,onCreateProject:si,onHelperModelChange:e=>{le(t=>({...t,[u]:{model:e,variant:``}}))},onHelperVariantChange:e=>{le(t=>({...t,[u]:{...t[u],variant:e}}))},onToolChange:In}):(0,X.jsxs)(X.Fragment,{children:[kt?.has_initial_commit===!1&&(0,X.jsx)(pC,{isSubmitting:ve,onCreateInitialCommit:()=>{ur()}}),(0,X.jsx)(Lge,{activeProjectId:y,activeProject:kt,activeProjectBranchState:un,targetBundles:mn,targetBranchSuggestions:gn,isTargetBundleLoading:hn,isTargetSelectorLoading:_n,onTargetSelectorOpenChange:gr,onSelectBundleTarget:br,onSelectRepoRootTarget:xr,activeRun:x,activeTool:u,onOpenProjectExecutionSettings:()=>ci(`execution`),onRestoreSessionTarget:Sr,onChatReviewCapabilityChange:Le,routedInspectionReviewCapability:Mt===`chat`?Ie:null,isPreviewButtonDisabled:Si,onPreviewReviewCapabilityChange:Fe,onPreviewToggle:yi,onRunStopped:mr,onWorkspaceActivityChange:De,onWorkspaceActivityEvent:On,pendingWorkspaceNavigation:we,onPendingWorkspaceNavigationConsumed:en,routedTicketId:c?.kind===`ticket`?c.ticketId:null,routedModalStack:r,onRoutedTicketOpen:ui,onRoutedTicketClose:di,onRoutedTicketUnavailable:Hr,routedBundleId:c?.kind===`bundle`?c.bundleId:null,routedChatSessionId:c?.kind===`chat-session`?c.chatSessionId:void 0,routedSpecSessionId:c?.kind===`spec-session`||c?.kind===`spec-snapshot`?c.specSessionId:void 0,routedSpecSnapshotId:c?.kind===`spec-snapshot`?c.specSnapshotId:void 0,routedInspection:c?.kind===`ticket-inspection`?{target:{kind:`ticket`,ticketId:c.ticketId},mode:c.mode}:c?.kind===`bundle-inspection`?{target:{kind:`bundle`,bundleId:c.bundleId},mode:c.mode}:null,onRoutedBundleOpen:fi,onRoutedBundleClose:pi,onRoutedInspectionOpen:mi,onRoutedInspectionModeChange:hi,onRoutedInspectionClose:gi,onChatSessionNavigation:_i,onSpecSessionNavigation:vi,onRoutedEntityUnavailable:Hr,onSpecImplementationChatReady:qt,onViewSourceSpec:Yt,onNavigateToLifecycleSource:Zt,onViewMemorySource:Xt,onStartChatFromBundle:Cr,previewDisplayMode:yn,previewPane:Ci,previewPaneWidth:B,previewButtonTitle:xi,visibleWorkspace:Mt,refreshKey:Ae,boardFilterState:Me,onBoardFilterStateChange:Ne,onBoardLoadedProjectIdChange:w,onBundlesChange:ar,onBundlesLoadingChange:or,onPreviewPaneWidthChange:V,onProjectUsageChange:ir,onRunStatusChange:()=>{Pn(),Fn()}},y??`no-project`)]}),_.length>0&&(0,X.jsx)(Ly,{activeProject:kt,activeRun:x,branchState:un,targetGitStatus:dn,isBoardLoadedForActiveProject:cn,activeProjectBranchAction:pn,isProjectIdeAvailable:sn,isProjectRunAvailable:on,isRunStatusLoadedForActiveProject:ln,isTerminalOpen:Yr.isOpen,targetBundles:mn,targetBranchSuggestions:gn,isTargetBundleLoading:hn,isTargetSelectorLoading:_n,isTargetGitStatusLoading:fn,hasConfiguredTests:Xr,hasConfiguredChecks:Zr,onProjectIdeOpen:()=>{Ar()},onProjectPull:()=>{jr()},onProjectRebase:Mr,onProjectAbortGitOperation:Nr,onProjectRunToggle:()=>{kr()},onProjectFilesOpen:()=>Pr(`files`),onProjectChangesOpen:()=>Pr(`changes`),onProjectVerificationOpen:Ir,onTerminalToggle:ii,onTargetSelectorOpenChange:gr,onSelectBundleTarget:br,onSelectRepoRootTarget:xr,onManageBundles:wr}),(0,X.jsx)(dre,{activeProjectId:y,open:qe,onOpenChange:q}),(Je||l)&&y&&!Vt&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(i_e,{projectId:y,initialRunId:l?.runId??null,initialEventId:l?.eventId??null,onClose:Rr,onDetailsClose:Br,onRunSelectionChange:Kr,onRelatedReferenceSelection:qr,onUnavailable:c?.kind===`activity-run`?Hr:void 0,onNavigateToLifecycleSource:Zt})}),Y&&y&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(r_e,{projectId:y,defaultBranch:lt,onClose:()=>Qe(!1)})}),We&&kt&&(0,X.jsx)(EC,{bundles:mn,selectedBundleId:kt.active_target_kind===`bundle`?kt.active_target_bundle_id??null:null,activeTargetBundleId:kt.active_target_kind===`bundle`?kt.active_target_bundle_id??null:null,onSelectBundle:Er,onCreateBundle:Dr,onDeleteBundle:Or,onClose:Tr}),ut&&(0,X.jsx)(dC,{title:ut.title,description:ut.description,confirmLabel:ut.confirmLabel,cancelLabel:ut.cancelLabel,confirmVariant:ut.confirmVariant,onConfirm:()=>vr(!0),onCancel:()=>vr(!1)}),ft&&(0,X.jsx)(fC,{onSelect:e=>{pt(!1),e&&kr(e,!0)}}),_.map(e=>{let t=e9(be,e.id);return t.hasMounted?(0,X.jsx)(Rge,{project:e,isExpanded:t.isExpanded,isVisible:e.id===y&&t.isOpen,onClose:()=>ai(e.id),onToggleExpanded:()=>oi(e.id)},e.id):null}),fe&&(0,X.jsx)(vE,{activeTool:u,activeAgentName:f.find(e=>e.id===u)?.displayName??u,mode:fe,initialSection:me,projectId:fe===`edit`&&kt?kt.id:null,availableHelperModels:wt,isLoadingHelperModels:!Tt,onRetryValidationModels:Ot,isAutoConfigReady:h,initialValues:fe===`edit`&&kt?c_e(kt,u):_.length===0?{name:``,repoPath:``,linkedProjectIds:[],runSetup:[],runServices:[],checkDefinitions:[],runIde:``,previewServiceName:``,previewPath:``,previewCapabilityMode:`auto`,helperModel:Et,helperVariant:Dt,helperModels:yw({},u,{model:Et||null,variant:Et&&Dt||null}),reviewerModels:{},commitMessageRules:``,commitAfterEachTicket:!1,autoParkStaleTickets:!1,memoryEnabled:!1,worktreeSync:[],specAwareCodeReviewEnabled:!1,automationDepth:`manual`,automationReviewFixEnabled:!1,automationPauseOnOpenQuestions:!1,automationReviewSeverity:`medium`,automationReviewMaxIterations:3}:void 0,linkedProjectOptions:_.filter(e=>e.id!==kt?.id).map(e=>({id:e.id,name:e.name})),repoPathLocked:fe===`edit`&&kt?kt.repo_path_locked:!1,repoPathLockedMessage:fe===`edit`&&kt?u_e(kt):null,deleteBlockedMessage:fe===`edit`&&kt?d_e(kt,_):null,onDelete:fe===`edit`?$n:void 0,onAutoConfig:sr,onBrowseRepoPath:cr,onValidateRepoPath:lr,onOpenExecutionRuntimes:()=>Ze(!0),onExecutionProfileSaved:(e,t)=>{v(n=>n.map(n=>n.id===e?{...n,build_execution_provider:t}:n))},onClose:()=>pe(null),onSubmit:fe===`edit`?Vn:Bn}),Xe&&(0,X.jsx)(Jb,{onClose:()=>Ze(!1)}),It&&It.projectId===y&&kt&&un?.status!==`loading`&&!Vt&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(t_e,{target:{scope:`project_root`},initialMode:It.mode,reviewMode:It.mode,onReviewModeChange:hi,enabledModes:[`changes`,`files`],projectId:It.projectId,targetKind:`repo_root`,reviewCommentsBundleId:null,title:kt.name,bundleTargetName:null,hasHelperModel:!!(kt.helper_models?.[u]?.model??(u===`opencode`?kt.helper_model:null)),repoRootDefaultBranch:gn.default_branch,onSubmitReviewPrompt:Qr?.submitPrompt,canSubmitReviewPrompt:ni,reviewSubmitDisabledReason:ri??void 0,canAddReviewComments:ni,canModifyChanges:!0,mode:Qr?.mode,onModeChange:Qr?.onModeChange,canToggleMode:!!Qr?.canSubmitReviewPrompt,isUpdatingMode:Qr?.isUpdatingMode??!1,onClose:Fr})}),ge&&(!Je||c?.kind===`checks`)&&!Vt&&ge.projectId===y&&(0,X.jsx)(p.Suspense,{fallback:null,children:(0,X.jsx)(n_e,{targetLabel:ge.targetLabel,definitions:ge.definitions,requiredDefinitionIds:ge.requiredDefinitionIds,preReviewDefinitionIds:ge.preReviewDefinitionIds,checksTarget:{projectId:ge.projectId,targetKind:ge.targetKind,targetBundleId:ge.targetBundleId},requestedInitialTab:c?.kind===`checks`?`checks`:void 0,directBatchRunId:c?.kind===`checks`?c.batchRunId:null,directAttemptRunId:c?.kind===`checks`?c.attemptRunId:null,onCheckSelectionChange:c?.kind===`checks`?Jr:void 0,onUnavailable:c?.kind===`checks`?Hr:void 0,testsTarget:{scope:`project`,projectId:ge.projectId,targetKind:ge.targetKind,targetBundleId:ge.targetBundleId},onClose:Lr,onOpenActivity:()=>{if(xt.current+=1,_e(null),c?.kind===`checks`){r.some(e=>e.kind===`activity-run`)?(J(!0),n(c)):(bt.current=!0,s({kind:`workspace`,projectId:c.projectId,workspace:`board`}));return}J(!0)}})})]})},i9=`X-Archon-Mobile-CSRF`,C_e=async(e,t={})=>{let n=await fetch(e,{credentials:`include`,...t});if(!n.ok){let e=null;try{e=await n.clone().json()}catch{}throw new Ke(await Xe(n,`Mobile request failed.`),n.status,e)}return n},a9=async(e,t={})=>await(await C_e(e,t)).json(),o9=e=>a9(`/mobile/projects`,{signal:e}),w_e=e=>a9(`/mobile/tool`,{signal:e}),T_e=(e,t)=>a9(`/mobile/tool`,s9(t,{tool:e})),E_e=async e=>Hr(await a9(`/mobile/agents`,{signal:e,cache:`no-store`})),D_e=(e,t)=>a9(`/mobile/projects/${encodeURIComponent(e)}/summary`,{signal:t}),O_e=async(e,t)=>{let n=[],r=null;do{let i=r?`?cursor=${encodeURIComponent(r)}`:``,a=await a9(`/mobile/projects/${encodeURIComponent(e)}/approval-requests${i}`,{signal:t});n.push(...a.approval_requests),r=a.next_cursor}while(r);return{approval_requests:n,next_cursor:null}},k_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/approval-requests/${encodeURIComponent(t)}`,{signal:n}),A_e=(e,t,n,r,i)=>a9(`/mobile/projects/${encodeURIComponent(e)}/approval-requests/${encodeURIComponent(t.id)}/${n}`,s9(r,{expected_action_fingerprint:t.action_fingerprint,...i?.trim()?{reason:i.trim()}:{}})),j_e=(e,t)=>a9(`/mobile/projects/${encodeURIComponent(e)}/target-options`,{signal:t}),M_e=(e,t)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,{signal:t}),N_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,{signal:n}),P_e=(e,t)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets`,{signal:t}),F_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,{signal:n}),I_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/agent-runs`,{signal:n}),L_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),R_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/agent-runs`,{signal:n}),z_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}`,{signal:n}),B_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/build`,s9(n)),V_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/review`,s9(n)),s9=(e,t,n=`POST`)=>({method:n,headers:{"Content-Type":`application/json`,[i9]:e},body:t===void 0?void 0:JSON.stringify(t)}),H_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions`,s9(t,n)),U_e=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/messages`,s9(n,r)),W_e=(e,t,n,r,i)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,s9(r,i)),G_e=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}`,s9(n,r,`PATCH`)),K_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/stop`,s9(n)),q_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/chat-sessions/${encodeURIComponent(t)}/resume`,s9(n)),J_e=(e,t)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,{signal:t}),Y_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,{signal:n}),X_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions`,s9(t,n)),c9=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/messages`,s9(n,r)),Z_e=(e,t,n,r,i)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,s9(r,i)),Q_e=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}`,s9(n,r,`PATCH`)),$_e=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/stop`,s9(n)),eve=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/spec-sessions/${encodeURIComponent(t)}/resume`,s9(n)),l9=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/state`,s9(n,{state:r},`PATCH`)),tve=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/run`,s9(n)),nve=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop`,s9(n)),u9=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/stop-build`,s9(n)),d9=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/resume-build`,s9(n)),rve=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}`,s9(n,r,`PATCH`)),ive=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-follow-up`,s9(n,{instruction:r})),ave=(e,t,n,r,i)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/plan-questions/${encodeURIComponent(n)}/resolve`,s9(r,i)),ove=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/tickets/${encodeURIComponent(t)}/follow-up`,s9(n,{instruction:r})),sve=(e,t,n,r)=>a9(`/mobile/projects/${encodeURIComponent(e)}/bundles/${encodeURIComponent(t)}/follow-up`,s9(n,{instruction:r})),f9=(e,t,n)=>a9(`/mobile/projects/${encodeURIComponent(e)}/target`,s9(t,n)),cve=(e,t)=>a9(`/mobile/models?tool=${encodeURIComponent(e)}`,{signal:t}),lve=(e,t,n)=>{let r=new URLSearchParams({tool:e});return t&&r.set(`project_id`,t),a9(`/mobile/skills?${r.toString()}`,{signal:n})},uve=({className:e})=>(0,X.jsx)(ete,{"aria-hidden":`true`,className:e}),p9=e=>jb.t(`common:mobileApp.${e}`),dve={key:`overview`,label:p9(`navigation.overview`),Icon:uve},m9={key:`tickets`,label:p9(`navigation.tickets`),Icon:L5,ctaAriaLabel:p9(`overviewActions.ticketsAriaLabel`)},h9={key:`chats`,label:p9(`navigation.chats`),Icon:AE,ctaAriaLabel:p9(`overviewActions.chatsAriaLabel`)},g9={key:`spec`,label:p9(`navigation.spec`),Icon:eC,ctaAriaLabel:p9(`overviewActions.specAriaLabel`)},fve=[dve,m9,h9,g9],pve=({children:e})=>(0,X.jsx)(`main`,{className:`min-h-screen bg-background text-foreground`,children:(0,X.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-lg items-center px-4 py-8`,children:(0,X.jsx)(`div`,{className:`w-full`,children:e})})}),_9=({title:e,description:t,children:n})=>(0,X.jsx)(pve,{children:(0,X.jsxs)(gC,{className:`w-full border-border/80 bg-card/90 shadow-2xl shadow-black/20`,children:[(0,X.jsxs)(_C,{children:[(0,X.jsx)(vC,{children:e}),(0,X.jsx)(yC,{children:t})]}),n&&(0,X.jsx)(xC,{className:`space-y-4`,children:n})]})}),mve=e=>e===`connected`?{label:`Connected`,variant:`success`,indicatorState:`finished`}:e===`reconnecting`?{label:`Reconnecting`,variant:`warning`,indicatorState:`running`}:e===`unavailable`?{label:`Offline`,variant:`destructive`,indicatorState:`error`}:{label:`Connecting`,variant:`outline`,indicatorState:`running`},hve=({status:e})=>{let t=mve(e);return(0,X.jsxs)(hC,{variant:t.variant,className:`gap-1.5 px-2.5 py-1 text-[11px] uppercase tracking-[0.14em]`,children:[(0,X.jsx)(Hy,{state:t.indicatorState,className:`mt-0`}),t.label]})},gve=({status:e,onRetry:t})=>e===`connected`?null:e===`unavailable`?(0,X.jsx)(gC,{className:`border-red-500/25 bg-destructive/10 shadow-none`,children:(0,X.jsxs)(xC,{className:`flex flex-col gap-3 pt-5`,children:[(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-red-100`,children:`Desktop Archon is currently unreachable.`}),(0,X.jsx)(`p`,{className:`text-sm text-red-200/85`,children:`Mobile access may have been disabled, the backend may have restarted, or this phone lost network access.`})]}),(0,X.jsx)(`div`,{children:(0,X.jsx)(Q,{variant:`warning`,onClick:t,children:`Retry connection`})})]})}):(0,X.jsx)(gC,{className:`border-amber-500/25 bg-amber-500/10 shadow-none`,children:(0,X.jsx)(xC,{className:`pt-5 text-sm text-amber-100`,children:e===`connecting`?`Connecting to live updates from desktop Archon...`:`Reconnecting to desktop Archon. Existing content stays visible while this phone reconnects.`})}),_ve=({activeTool:e,agents:t,selectedProject:n,targetLabel:r,isTargetLoading:i,isTargetDisabled:a,connectionState:o,onOpenProjects:s,onOpenTargetSelector:c,onToolChange:l})=>(0,X.jsx)(`header`,{className:`sticky top-0 z-20 border-b border-border/70 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/85`,children:(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-3 px-3 pb-3 pt-4 sm:px-4`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-label":`Choose project`,className:`min-w-0 flex-1 text-left`,onClick:s,children:[(0,X.jsx)(`div`,{className:`truncate text-base font-medium text-foreground`,children:n?.name??`Choose a project`}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:n?.repo_path??`Select a desktop project to continue`})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(`select`,{"aria-label":jb.t(`common:mobileApp.agentSelector.ariaLabel`),className:`h-8 max-w-28 rounded-lg border border-border bg-background px-2 text-xs text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:e,onChange:e=>l(e.target.value),children:t.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.displayName},e.id))}),(0,X.jsx)(hve,{status:o}),(0,X.jsxs)(Q,{variant:`outline`,size:`sm`,"aria-label":`Choose target`,"data-testid":`mobile-target-trigger`,className:`h-8 max-w-32 gap-2 px-2.5 sm:max-w-40`,disabled:a,onClick:c,children:[(0,X.jsx)(Vv,{className:`h-3.5 w-3.5 shrink-0`}),i?(0,X.jsx)(yv,{className:`h-3.5 w-16`}):(0,X.jsx)(`span`,{className:`truncate text-xs sm:text-sm`,children:r})]}),(0,X.jsx)(Q,{variant:`outline`,size:`icon-sm`,"aria-label":`Choose project`,onClick:s,children:(0,X.jsx)(Sv,{className:`h-4 w-4`})})]})]})}),vve=({activeSection:e,onChange:t})=>(0,X.jsx)(`nav`,{className:`fixed inset-x-0 bottom-0 z-20 border-t border-border/70 bg-background/95 px-3 pb-[calc(env(safe-area-inset-bottom)+0.75rem)] pt-2 backdrop-blur supports-[backdrop-filter]:bg-background/85 sm:px-4 lg:hidden`,children:(0,X.jsx)(`div`,{className:`mx-auto flex max-w-6xl gap-2 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:fve.map(n=>{let r=n.key===e,i=n.Icon;return(0,X.jsxs)(Q,{type:`button`,variant:r?`secondary`:`ghost`,className:`h-11 shrink-0 gap-2 whitespace-nowrap`,"aria-current":r?`page`:void 0,onClick:()=>t(n.key),children:[(0,X.jsx)(i,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{children:n.label})]},n.key)})})}),v9=({title:e,description:t,action:n})=>(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsxs)(_C,{children:[(0,X.jsx)(vC,{children:e}),(0,X.jsx)(yC,{children:t})]}),n&&(0,X.jsx)(xC,{children:n})]}),y9=({text:e})=>(0,X.jsxs)(`div`,{"aria-live":`polite`,className:`flex items-center gap-2 px-1 py-3 text-sm text-muted-foreground`,role:`status`,children:[(0,X.jsx)(Tv,{className:`h-4 w-4 animate-spin`}),(0,X.jsx)(`span`,{children:e})]}),yve=e=>e?`Repo root (${e})`:`Repo root`,bve=e=>{if(!e)return`Repo root`;if(e.length<=20)return e;let t=e.split(`/`).filter(Boolean),n=t[t.length-1]??e;return n.length<=17?`.../${n}`:`${n.slice(0,16)}...`},b9=(e,t)=>{if(!e)return`Target`;if(e.active_target_kind===`bundle`&&e.active_target_bundle_id){let n=t?.bundles.find(t=>t.id===e.active_target_bundle_id)??null;return n?My(n):`Selected bundle`}return bve(t?.current_branch??null)},x9=({title:e,description:t,children:n})=>(0,X.jsxs)(`div`,{className:`flex max-h-[80vh] flex-col overflow-hidden`,children:[(0,X.jsxs)(T_,{className:`border-b border-border/70 px-4 py-4`,children:[(0,X.jsx)(D_,{children:e}),t&&(0,X.jsx)(O_,{children:t})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:n})]}),xve=({projects:e,selectedProjectId:t,error:n,onSelectProject:r,onRetry:i})=>n?(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(`p`,{className:`text-sm text-red-200`,children:n}),(0,X.jsx)(Q,{variant:`warning`,onClick:i,children:`Retry projects`})]}):e?e.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No projects are available on the desktop instance yet.`}):(0,X.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let n=e.id===t;return(0,X.jsxs)(`button`,{type:`button`,className:Z(`w-full rounded-2xl border px-4 py-3 text-left transition-colors`,n?`border-primary/50 bg-primary/10`:`border-border/80 bg-card/60 hover:border-primary/30 hover:bg-accent/60`),onClick:()=>r(e.id),children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.repo_path})]}),n&&(0,X.jsx)(hC,{variant:`info`,children:`Current`})]}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:(0,X.jsxs)(`span`,{children:[e.ticket_count,` tickets`]})})]},e.id)})}):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading projects...`}),Sve=({open:e,projects:t,selectedProjectId:n,error:r,onOpenChange:i,onSelectProject:a,onRetry:o})=>(0,X.jsx)(S_,{open:e,onOpenChange:i,children:(0,X.jsx)(w_,{showCloseButton:!1,"aria-describedby":void 0,className:`top-auto right-0 bottom-0 left-0 max-w-none translate-x-0 translate-y-0 overflow-hidden rounded-t-3xl rounded-b-none border-x-0 border-b-0 p-0 sm:top-1/2 sm:right-auto sm:bottom-auto sm:left-1/2 sm:max-w-md sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-2xl sm:border sm:p-0`,children:(0,X.jsx)(x9,{title:`Projects`,children:(0,X.jsx)(xve,{projects:t,selectedProjectId:n,error:r,onSelectProject:e=>{a(e),i(!1)},onRetry:o})})})}),Cve=({open:e,project:t,targetOptions:n,error:r,isLoading:i,isSubmitting:a,onOpenChange:o,onRetry:s,onSelectBundle:c,onSelectRepoRoot:l})=>{let[u,d]=(0,p.useState)(``);(0,p.useEffect)(()=>{e&&d(n?.current_branch??``)},[e,n?.current_branch]);let f=t?.active_target_kind!==`bundle`,m=yy(n?.bundles??[]),h=[{key:`default`,label:`Default branch`,branch:n?.default_branch??null},{key:`previous`,label:`Previous branch`,branch:n?.previous_branch??null}].filter(e=>e.branch&&e.branch!==n?.current_branch).filter((e,t,n)=>n.findIndex(t=>t.branch===e.branch)===t),g=t?r?(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(`p`,{className:`text-sm text-red-200`,children:r}),(0,X.jsx)(Q,{variant:`warning`,onClick:s,children:`Retry target options`})]}):n?(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`Project target`}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Choose the repo root or a prepared bundle for new chats and desktop work launched from this phone.`})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium text-muted-foreground`,children:`Target`}),(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-2`,children:[(0,X.jsx)(Q,{type:`button`,variant:f?`secondary`:`ghost`,className:`w-full justify-start`,disabled:a,onClick:()=>l(null),children:yve(n.current_branch)}),(0,X.jsxs)(`div`,{className:`relative min-h-10`,"data-testid":`mobile-target-options`,children:[i&&(0,X.jsx)(`div`,{className:`pointer-events-none absolute right-2 top-2 z-10 text-muted-foreground`,"data-testid":`mobile-target-options-spinner`,children:(0,X.jsx)(Tv,{className:`h-3.5 w-3.5 animate-spin`})}),(0,X.jsx)(`div`,{className:`max-h-40 overflow-y-auto pr-7`,children:m.length===0&&!i?(0,X.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No prepared bundles are available yet.`}):m.map(e=>(0,X.jsx)(Q,{type:`button`,variant:t.active_target_kind===`bundle`&&t.active_target_bundle_id===e.id?`secondary`:`ghost`,className:`w-full justify-start`,disabled:a,onClick:()=>c(e.id),children:(0,X.jsx)(`span`,{className:`truncate`,children:My(e)})},e.id))})]})]})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(z_,{className:`text-xs font-medium text-muted-foreground`,children:`Repo root branch`}),(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/70 bg-background/40 p-3`,children:[(0,X.jsx)(`div`,{className:`space-y-2`,children:h.length>0?h.map(({key:e,label:t,branch:n})=>(0,X.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full justify-between gap-3`,disabled:!f||a||!n,onClick:()=>l(n),children:[(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n})]},e)):(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i?`Loading branch suggestions...`:`No suggested branches available.`})}),(0,X.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,X.jsx)(z_,{htmlFor:`mobile-project-target-branch-input`,className:`text-xs text-muted-foreground`,children:`Switch or create branch`}),(0,X.jsx)(k_,{id:`mobile-project-target-branch-input`,value:u,disabled:!f||a,onChange:e=>d(e.target.value),placeholder:`feature/quick-fix`})]}),(0,X.jsx)(Q,{type:`button`,disabled:!f||!u.trim()||a,onClick:()=>l(u.trim()),children:`Switch`})]}),!f&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Switch to repo root to choose a branch.`})]})]})]}):(0,X.jsx)(y9,{text:`Loading target options...`}):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a project before choosing a target.`});return(0,X.jsx)(S_,{open:e,onOpenChange:o,children:(0,X.jsx)(w_,{showCloseButton:!1,"aria-describedby":void 0,className:`top-auto right-0 bottom-0 left-0 max-w-none translate-x-0 translate-y-0 overflow-hidden rounded-t-3xl rounded-b-none border-x-0 border-b-0 p-0 sm:top-1/2 sm:right-auto sm:bottom-auto sm:left-1/2 sm:max-w-md sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-2xl sm:border sm:p-0`,children:(0,X.jsx)(x9,{title:`Target`,description:t?b9(t,n):void 0,children:g})})})},S9=e=>e.parked_at?`parked`:e.state,C9=e=>{let t=S9(e);return t===`parked`?`Done`:`${t.slice(0,1).toUpperCase()}${t.slice(1)}`},w9=e=>e===`plan`?`info`:e===`build`?`success`:e===`review`?`warning`:`outline`,T9=({ticket:e,isSelected:t,onSelectTicket:n,className:r})=>(0,X.jsxs)(`button`,{type:`button`,className:Z(`w-full rounded-2xl border px-4 py-3 text-left transition-colors`,t?`border-primary/50 bg-primary/10`:`border-border/70 bg-card/40 hover:border-primary/30 hover:bg-accent/50`,r),onClick:()=>n(e.id),children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.title})}),(0,X.jsx)(hC,{variant:w9(S9(e)),children:C9(e)})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:[e.agent_status&&(0,X.jsx)(`span`,{children:e.agent_status}),e.branch&&(0,X.jsx)(`span`,{children:e.branch}),e.bundle?.name&&(0,X.jsx)(`span`,{children:e.bundle.name})]})]}),wve=({group:e,selectedBundleId:t,selectedTicketId:n,onSelectBundle:r,onSelectTicket:i})=>{let a=e.bundle.id===t,o=e.tickets.some(e=>e.id===n),[s,c]=(0,p.useState)(o),l=My(e.bundle)||e.bundle.branch||e.bundle.name||`Bundle`,u=e.tickets.filter(e=>e.agent_status===`running`).length,d=a||o;return(0,p.useEffect)(()=>{o&&c(!0)},[o]),(0,X.jsxs)(BC,{open:s,onOpenChange:c,children:[(0,X.jsxs)(`div`,{className:Z(`flex items-start gap-2 rounded-2xl border px-4 py-3 transition-colors`,d?`border-primary/50 bg-primary/10`:`border-border/70 bg-card/40 hover:border-primary/30 hover:bg-accent/50`),children:[(0,X.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,"aria-label":`Open bundle ${l}`,onClick:()=>r(e.bundle.id),children:(0,X.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(hC,{variant:`outline`,children:`Bundle`}),(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:l})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.14em] text-muted-foreground`,children:[(0,X.jsxs)(`span`,{children:[e.tickets.length,` ticket`,e.tickets.length===1?``:`s`]}),u>0&&(0,X.jsxs)(`span`,{children:[u,` running`]}),e.bundle.branch&&(0,X.jsx)(`span`,{children:e.bundle.branch})]})]})})}),(0,X.jsx)(VC,{asChild:!0,children:(0,X.jsx)(Q,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`mt-0.5 shrink-0`,"aria-label":`Toggle bundle tickets for ${l}`,children:(0,X.jsx)(mv,{className:Z(`h-4 w-4 transition-transform`,s&&`rotate-180`)})})})]}),(0,X.jsx)(HC,{className:`pt-2`,children:(0,X.jsx)(`div`,{className:`space-y-2 pl-3`,children:e.tickets.map(t=>(0,X.jsx)(T9,{ticket:t,isSelected:t.id===n,onSelectTicket:t=>i(t,e.bundle.id),className:`rounded-xl`},t.id))})})]})},E9=(e,t)=>Ey(e,[],t),Tve=e=>[{key:`plan`,label:`Plan`,tickets:e.filter(e=>!e.parked_at&&e.state===`plan`),items:E9(e.filter(e=>!e.parked_at&&e.state===`plan`),`plan`)},{key:`build`,label:`Build`,tickets:e.filter(e=>!e.parked_at&&e.state===`build`),items:E9(e.filter(e=>!e.parked_at&&e.state===`build`),`build`)},{key:`review`,label:`Review`,tickets:e.filter(e=>!e.parked_at&&e.state===`review`),items:E9(e.filter(e=>!e.parked_at&&e.state===`review`),`review`)},{key:`parked`,label:`Done`,tickets:e.filter(e=>e.parked_at),items:E9(e.filter(e=>e.parked_at),`done`)}].filter(e=>e.tickets.length>0),D9=({selectedProjectId:e,tickets:t,selectedBundleId:n,selectedTicketId:r,error:i,onRetry:a,onSelectBundle:o,onSelectTicket:s})=>{if(!e)return(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a project before browsing tickets from this phone.`});if(i)return(0,X.jsx)(v9,{title:`Tickets unavailable`,description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:a,children:`Retry tickets`})});if(!t)return(0,X.jsx)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,X.jsx)(xC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading tickets...`})});if(t.length===0)return(0,X.jsx)(v9,{title:`No tickets`,description:`This project does not have any tickets yet.`});let c=Tve(t);return(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(vC,{children:`Tickets`}),(0,X.jsxs)(yC,{children:[t.length,` total`]})]}),(0,X.jsx)(xC,{className:`space-y-4 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:c.map(e=>(0,X.jsxs)(`section`,{className:`space-y-2`,"aria-label":`${e.label} tickets`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(`span`,{children:e.tickets.length})]}),(0,X.jsx)(`div`,{className:`space-y-2`,children:e.items.map(e=>e.kind===`bundle`?(0,X.jsx)(wve,{group:e.group,selectedBundleId:n,selectedTicketId:r,onSelectBundle:o,onSelectTicket:s},e.group.id):(0,X.jsx)(T9,{ticket:e.ticket,isSelected:e.ticket.id===r,onSelectTicket:e=>s(e,null)},e.ticket.id))})]},e.key))})]})},Eve=e=>a9(`/mobile-auth/status`,{signal:e}),Dve=(e,t)=>a9(`/mobile-auth/pair/preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t}),Ove=e=>a9(`/mobile-auth/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),kve=e=>a9(`/mobile-auth/logout`,{method:`POST`,headers:{[i9]:e}}),Ave=()=>XS(window.location.origin,{withCredentials:!0}),O9=({label:e,value:t,mono:n=!1})=>t?(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-1 border-b border-border/50 py-2 last:border-0`,children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,X.jsx)(`dd`,{className:n?`min-w-0 break-all font-mono text-xs text-foreground`:`min-w-0 break-words text-sm text-foreground`,children:t})]}):null,jve=({projectId:e,csrfToken:t,socket:n,initialRequests:r,onRequestError:i})=>{let{t:a,i18n:o}=K(`common`,{keyPrefix:`mobileApp.approvals`}),[s,c]=(0,p.useState)(r),[l,u]=(0,p.useState)(null),[d,f]=(0,p.useState)(null),[m,h]=(0,p.useState)(!1),[g,_]=(0,p.useState)(``),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)(null),[S,C]=(0,p.useState)(!1),[w,T]=(0,p.useState)(0),E=(0,p.useRef)(r);E.current=r;let D=l?`${e}:${l}`:null,O=(0,p.useRef)(D);O.current=D;let k=(0,p.useRef)(!0);(0,p.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]),(0,p.useEffect)(()=>{c(E.current),u(null)},[e]),(0,p.useEffect)(()=>{let t=new AbortController,n=e;return O_e(e,t.signal).then(r=>{if(t.signal.aborted||n!==e)return;let i=r?.approval_requests??[];c(i),u(e=>e&&i.some(t=>t.id===e)?e:null),y(null)}).catch(e=>{Ye(e)||i(e)||y(e instanceof Ke?e.message:a(`loadError`))}),()=>t.abort()},[i,e,w,a]),(0,p.useEffect)(()=>{if(f(null),_(``),C(!1),x(null),!l){h(!1);return}let t=new AbortController,n=`${e}:${l}`;return h(!0),k_e(e,l,t.signal).then(t=>{O.current===n&&t.approval_request.project_id===e&&t.approval_request.id===l&&f(t)}).catch(e=>{if(!Ye(e)&&O.current===n){if(i(e))return;x(e instanceof Ke?e.message:a(`detailError`))}}).finally(()=>{!t.signal.aborted&&O.current===n&&h(!1)}),()=>t.abort()},[i,e,w,l,a]),(0,p.useEffect)(()=>{if(!n)return;let t=t=>{t&&typeof t==`object`&&`project_id`in t&&t.project_id!==e||T(e=>e+1)};return n.on(`approval-request:created`,t),n.on(`approval-request:updated`,t),n.on(`connect`,t),()=>{n.off(`approval-request:created`,t),n.off(`approval-request:updated`,t),n.off(`connect`,t)}},[e,n]);let A=d?.approval_request.project_id===e&&d.approval_request.id===l?d.approval_request:null,j=A?.action.kind===`custom_check`?A.action.target.batch_environment:A?.authority.environment,M=A?.action.kind===`custom_check`?A.action.target.attempt_placement:A?.authority.execution_boundary?.attempt_placement,N=A?.action.kind===`git_push`?A.action.target.degradations??[]:[],P=async n=>{if(!A||S)return;let r=`${e}:${A.id}`;C(!0),x(null);try{if(await A_e(e,A,n,t,g),!k.current||O.current!==r)return;_(``),T(e=>e+1)}catch(e){if(!k.current||O.current!==r||i(e))return;let t=qe(e,`approval_request`);t&&(c(e=>e.map(e=>e.id===t.id?t:e).filter(e=>e.status===`pending`)),f(e=>e&&e.approval_request.id===t.id?{...e,approval_request:t}:e)),x(e instanceof Ke?e.message:a(`decisionError`))}finally{k.current&&O.current===r&&C(!1)}};return s.length===0&&!v&&!A&&!b?null:(0,X.jsxs)(`section`,{"aria-labelledby":`mobile-approvals-title`,className:`rounded-2xl border border-amber-300/30 bg-amber-500/5 p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{id:`mobile-approvals-title`,className:`font-semibold text-foreground`,children:a(`title`)}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:a(`count`,{count:s.length})})]}),(0,X.jsx)(`span`,{className:`rounded-full bg-amber-400/15 px-2.5 py-1 text-sm font-semibold text-amber-100`,children:s.length})]}),v&&(0,X.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-red-200`,children:v}),(0,X.jsx)(`div`,{className:`mt-3 space-y-2`,children:s.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>u(e.id),className:`w-full rounded-xl border border-border bg-card/70 p-3 text-left outline-none focus:ring-2 focus:ring-ring/50`,children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:a(`action.${e.action_kind}`)}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:a(`expires`,{value:new Intl.DateTimeFormat(o.language,{dateStyle:`short`,timeStyle:`short`}).format(new Date(e.expires_at))})})]},e.id))}),l&&m&&(0,X.jsx)(`p`,{className:`mt-4 border-t border-border/60 pt-4 text-sm text-muted-foreground`,children:a(`loadingDetail`)}),l&&b&&(0,X.jsx)(`p`,{role:`alert`,className:`mt-4 border-t border-border/60 pt-4 text-sm text-red-200`,children:b}),A&&(0,X.jsxs)(`div`,{className:`mt-4 border-t border-border/60 pt-4`,children:[(0,X.jsx)(`p`,{className:`text-sm text-foreground`,children:a(`impact.${A.action_kind}`)}),(0,X.jsxs)(`dl`,{className:`mt-3 max-h-72 overflow-y-auto rounded-xl border border-border/60 bg-background/35 px-3`,children:[(0,X.jsx)(O9,{label:a(`fields.action`),value:a(`action.${A.action_kind}`)}),(0,X.jsx)(O9,{label:a(`fields.target`),value:A.action.kind===`git_push`?`${A.action.target.remote_name} ${A.action.target.ref}`:`${A.action.target.scope_kind} ${A.action.target.scope_id}`}),(0,X.jsx)(O9,{label:a(`fields.command`),value:A.action.kind===`custom_check`?A.action.target.effective_command??A.action.target.definition_snapshot?.command:null,mono:!0}),(0,X.jsx)(O9,{label:a(`fields.cwd`),value:A.action.kind===`custom_check`?A.action.target.effective_cwd??A.action.workspace_git.workspace_path:A.action.workspace_git.workspace_path,mono:!0}),(0,X.jsx)(O9,{label:a(`fields.branch`),value:A.action.workspace_git.branch}),(0,X.jsx)(O9,{label:a(`fields.head`),value:A.action.workspace_git.head_sha,mono:!0}),(0,X.jsx)(O9,{label:a(`fields.remoteHead`),value:A.action.workspace_git.remote_head_sha,mono:!0}),(0,X.jsx)(O9,{label:a(`fields.profile`),value:A.authority.selected_profile?`${A.authority.selected_profile.revision_id} (r${A.authority.selected_profile.revision})`:null}),(0,X.jsx)(O9,{label:a(`fields.launcher`),value:A.action.kind===`custom_check`&&A.action.target.launcher?a(`values.launcher.${A.action.target.launcher}`):null}),(0,X.jsx)(O9,{label:a(`fields.environment`),value:j?`${j.id} (r${j.revision})`:A.authority.execution_boundary?.placement===`host`?a(`values.noHostEnvironment`):a(`none`),mono:!!j}),(0,X.jsx)(O9,{label:a(`fields.placement`),value:A.authority.execution_boundary?.placement===`host`?a(`values.hostPlacement`):M?.scope.kind===`exact-sandbox`?a(`values.sandboxPlacement`,{id:M.scope.externalId}):a(`values.sandboxPlacementUnavailable`),mono:!!M}),(0,X.jsx)(O9,{label:a(`fields.authority`),value:A.authority.effective_capabilities.join(`, `)||a(`none`)}),(0,X.jsx)(O9,{label:a(`fields.degradations`),value:N.join(`, `)}),(0,X.jsx)(O9,{label:a(`fields.secrets`),value:A.action.logical_secret_references.join(`, `)||a(`none`)}),(0,X.jsx)(O9,{label:a(`fields.expires`),value:new Intl.DateTimeFormat(o.language,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(A.expires_at))})]}),(0,X.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:a(`history`,{count:d?.events.length??0})}),!!d?.events.length&&(0,X.jsx)(`ol`,{className:`mt-2 max-h-36 space-y-1 overflow-y-auto text-xs text-muted-foreground`,children:d.events.map(e=>(0,X.jsxs)(`li`,{children:[a(`status.${e.to_status}`),` · `,new Intl.DateTimeFormat(o.language,{dateStyle:`short`,timeStyle:`short`}).format(new Date(e.created_at)),e.reason?` · ${e.reason}`:``]},e.id))}),A.status!==`pending`&&(0,X.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:a(`remediation.${A.status}`)}),A.status===`pending`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`label`,{className:`mt-3 block text-xs text-muted-foreground`,htmlFor:`mobile-approval-reason-${A.id}`,children:a(`reason`)}),(0,X.jsx)(`textarea`,{id:`mobile-approval-reason-${A.id}`,rows:2,maxLength:2e3,value:g,onChange:e=>_(a4(e.target.value)),className:`mt-1 w-full rounded-xl border border-border bg-card px-3 py-2 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring/50`}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,X.jsx)(Q,{disabled:S,onClick:()=>void P(`approve`),children:a(`approve`)}),(0,X.jsx)(Q,{variant:`outline`,disabled:S,onClick:()=>void P(`deny`),children:a(`deny`)}),(0,X.jsx)(Q,{variant:`ghost`,disabled:S,onClick:()=>void P(`cancel`),children:a(`cancel`)})]})]})]})]})},k9=e=>jb.t(`common:mobileApp.${e}`),A9=({selectedProjectId:e,chatSessions:t,selectedChatSessionId:n,error:r,onRetry:i,onOpenNewChat:a,onSelectChat:o})=>e?r?(0,X.jsx)(v9,{title:`Chats unavailable`,description:r,action:(0,X.jsx)(Q,{variant:`warning`,onClick:i,children:`Retry chats`})}):(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(vC,{children:`Chats`}),(0,X.jsx)(yC,{children:t?`${t.length} recent`:`Loading chats...`}),(0,X.jsx)(bC,{children:(0,X.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:`New chat`})})]}),(0,X.jsx)(xC,{className:`space-y-2 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:t?t.length===0?(0,X.jsx)(v9,{title:`No chats`,description:`Start a new chat to plan or build from this project.`,action:(0,X.jsx)(Q,{onClick:a,children:`Start a chat`})}):t.map(e=>(0,X.jsx)(`button`,{type:`button`,className:Z(`w-full rounded-xl border px-3 py-2.5 text-left transition-colors`,e.id===n?`border-primary/50 bg-primary/10`:`border-border/70 bg-card/40 hover:border-primary/30 hover:bg-accent/50`),onClick:()=>o(e.id),children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1 pr-2 text-sm font-medium text-foreground line-clamp-2 break-words`,children:e.title}),(0,X.jsx)(hC,{variant:e.agent_status===`running`?`warning`:e.mode===`plan`?`info`:`success`,children:e.agent_status??e.mode})]})},e.id)):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading chats...`})})]}):(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a project before browsing chats from this phone.`}),j9=({selectedProjectId:e,specSessions:t,selectedSpecSessionId:n,error:r,onRetry:i,onOpenNewSpec:a,onSelectSpec:o})=>e?r?(0,X.jsx)(v9,{title:k9(`specList.listError`),description:r,action:(0,X.jsx)(Q,{variant:`warning`,onClick:i,children:k9(`specList.retry`)})}):(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none lg:flex lg:min-h-0 lg:flex-col`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(vC,{children:k9(`specList.title`)}),(0,X.jsx)(yC,{children:t?`${t.length} recent`:k9(`specList.loading`)}),(0,X.jsx)(bC,{children:(0,X.jsx)(Q,{variant:`outline`,size:`sm`,onClick:a,children:k9(`specList.newSpec`)})})]}),(0,X.jsx)(xC,{className:`space-y-2 pt-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto`,children:t?t.length===0?(0,X.jsx)(v9,{title:k9(`specList.emptyTitle`),description:k9(`specList.emptyDescription`),action:(0,X.jsx)(Q,{onClick:a,children:k9(`specList.startSpec`)})}):t.map(e=>(0,X.jsx)(`button`,{type:`button`,className:Z(`w-full rounded-xl border px-3 py-2.5 text-left transition-colors`,e.id===n?`border-primary/50 bg-primary/10`:`border-border/70 bg-card/40 hover:border-primary/30 hover:bg-accent/50`),onClick:()=>o(e.id),children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1 pr-2 text-sm font-medium text-foreground line-clamp-2 break-words`,children:e.title}),(0,X.jsx)(hC,{variant:e.agent_status===`running`?`warning`:e.mode===`grill`?`info`:`success`,children:e.agent_status??e.mode})]})},e.id)):(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:k9(`specList.loading`)})})]}):(0,X.jsx)(v9,{title:k9(`specList.emptyTitle`),description:`Select a project before browsing specs from this phone.`}),M9=e=>{let t=e.tickets.filter(e=>!e.parked_at),n=t.filter(e=>e.state===`plan`),r=t.filter(e=>e.state===`build`),i=t.filter(e=>e.state===`review`),a=t.some(e=>e.agent_status===`running`),o=t.find(e=>sy(e)&&e.agent_status===`running`&&!!e.session_id)??null,s=t.find(e=>sy(e)&&e.agent_status===`stopped`&&!!e.session_id)??null,c=[];n.length>0&&c.push({id:`build`,label:`Build Bundle`,pendingLabel:`Building Bundle...`,ariaLabel:`Build Bundle`,disabled:!1,disabledReason:null});let l=r.length>0&&r.every(e=>e.agent_status===`done`),u=r.length===0&&i.length>0&&e.can_re_review===!0&&!a;return(l||u)&&c.push({id:`review`,label:u?`Re-run review`:`Review Bundle`,pendingLabel:`Reviewing Bundle...`,ariaLabel:u?`Re-run review`:`Review Bundle`,disabled:!1,disabledReason:null}),o&&c.push({id:`pause-build`,label:`Pause Build`,pendingLabel:`Pausing Build...`,ariaLabel:`Pause Build`,title:`Pause the build session. You can resume it later.`,disabled:!1,disabledReason:null}),!o&&s&&c.push({id:`resume-build`,label:`Resume`,pendingLabel:`Resuming...`,ariaLabel:`Resume`,disabled:!1,disabledReason:null}),{actions:c,runningBuildTicketId:o?.id??null,resumableBuildTicketId:s?.id??null}},N9=e=>[...e??[]].reverse().find(e=>e.metadata?.ask_question?.status===`pending`)??null,Mve=({className:e})=>(0,X.jsx)(ate,{"aria-hidden":`true`,className:e}),Nve=()=>{let[e,t]=(0,p.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(min-width: 1024px)`).matches);return(0,p.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 1024px)`),n=n=>{t(n?.matches??e.matches)};return n(),typeof e.addEventListener==`function`?(e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)):(e.addListener(n),()=>e.removeListener(n))},[]),e},P9=({label:e,value:t,accentClassName:n})=>(0,X.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-card/70 p-3`,children:[(0,X.jsx)(`div`,{className:Z(`text-xl font-semibold text-foreground`,n),children:t}),(0,X.jsx)(`div`,{className:`mt-1 text-xs uppercase tracking-[0.14em] text-muted-foreground`,children:e})]}),Pve=()=>(0,X.jsxs)(`div`,{className:`space-y-3`,"data-testid":`mobile-overview-skeleton`,children:[(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(_C,{className:`border-b border-border/70 pb-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(yv,{className:`h-6 w-28`}),(0,X.jsx)(yv,{className:`h-6 w-28 rounded-full`})]})}),(0,X.jsxs)(xC,{className:`space-y-4 pt-5`,children:[(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,X.jsxs)(`div`,{className:`rounded-2xl border border-border/70 bg-card/70 p-3`,children:[(0,X.jsx)(yv,{className:`h-6 w-10`}),(0,X.jsx)(yv,{className:`mt-2 h-3 w-16`})]},t))}),(0,X.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,X.jsx)(yv,{className:`h-10 w-full rounded-xl`}),(0,X.jsx)(yv,{className:`h-10 w-full rounded-xl`})]})]})]}),(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(_C,{children:(0,X.jsx)(yv,{className:`h-6 w-20`})}),(0,X.jsx)(xC,{children:(0,X.jsx)(yv,{className:`h-10 w-40 rounded-xl`})})]})]}),Fve=({isLoggingOut:e,onLogout:t})=>(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsx)(_C,{children:(0,X.jsx)(vC,{children:`Session`})}),(0,X.jsx)(xC,{children:(0,X.jsxs)(Q,{variant:`destructive`,className:`gap-2`,disabled:e,onClick:t,children:[(0,X.jsx)(Mve,{className:`h-4 w-4`}),e?`Logging out...`:`Log out this phone`]})})]}),Ive=({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r})=>{let i=r?.agent_status===`running`||!!n?.some(e=>e.agent_status===`running`);if(e?.kind===`ticket`)return{label:`Ticket run active`,variant:`success`};if(i)return{label:`Chat active`,variant:`success`};if(e)return{label:`Project run active`,variant:`success`};let a=t?.filter(e=>e.agent_status===`running`&&e.parked_at===null)??[],o=gF(a.filter(e=>e.state===`review`));return o===`building`?{label:jb.t(`common:statusBadge.building`),variant:`success`}:o===`reviewing`?{label:jb.t(`common:statusBadge.reviewing`),variant:`warning`}:a.some(e=>e.state===`build`)?{label:jb.t(`common:statusBadge.building`),variant:`success`}:a.some(e=>e.state===`plan`)?{label:`Planning`,variant:`info`}:{label:`Idle`,variant:`outline`}},Lve=({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r})=>{let i=Ive({activeRun:e,tickets:t,chatSessions:n,chatSessionDetail:r});return(0,X.jsx)(hC,{variant:i.variant,children:i.label})},Rve=({selectedProjectId:e,summary:t,tickets:n,error:r,chatSessions:i,chatSessionDetail:a,onRetry:o,onOpenTickets:s,onOpenChats:c,onOpenSpec:l})=>{let u=m9.Icon,d=h9.Icon,f=g9.Icon;return r?(0,X.jsx)(v9,{title:`Project summary unavailable`,description:r,action:(0,X.jsx)(Q,{variant:`warning`,onClick:o,children:`Retry summary`})}):e?!t||t.project.id!==e?(0,X.jsx)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:(0,X.jsx)(xC,{className:`pt-5 text-sm text-muted-foreground`,children:`Loading project summary...`})}):(0,X.jsxs)(gC,{className:`border-border/80 bg-card/70 shadow-none`,children:[(0,X.jsxs)(_C,{className:`border-b border-border/70 pb-4`,children:[(0,X.jsx)(vC,{children:`Overview`}),(0,X.jsx)(bC,{children:(0,X.jsx)(Lve,{activeRun:t.active_run,tickets:n,chatSessions:i,chatSessionDetail:a})})]}),(0,X.jsxs)(xC,{className:`space-y-4 pt-5`,children:[(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:[(0,X.jsx)(P9,{label:`Tickets`,value:t.tickets.total}),(0,X.jsx)(P9,{label:`Plan`,value:t.tickets.plan,accentClassName:`text-sky-200`}),(0,X.jsx)(P9,{label:`Build`,value:t.tickets.build,accentClassName:`text-emerald-200`}),(0,X.jsx)(P9,{label:`Review`,value:t.tickets.review,accentClassName:`text-amber-200`}),(0,X.jsx)(P9,{label:`Done`,value:t.tickets.parked}),(0,X.jsx)(P9,{label:`Bundles`,value:t.project.bundle_count??0})]}),(0,X.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,X.jsxs)(Q,{variant:`outline`,className:`gap-2`,"aria-label":m9.ctaAriaLabel,onClick:s,children:[(0,X.jsx)(u,{className:`h-4 w-4`}),m9.label]}),(0,X.jsxs)(Q,{variant:`outline`,className:`gap-2`,"aria-label":h9.ctaAriaLabel,onClick:c,children:[(0,X.jsx)(d,{className:`h-4 w-4`}),h9.label]}),(0,X.jsxs)(Q,{variant:`outline`,className:`gap-2 sm:col-span-2`,"aria-label":g9.ctaAriaLabel,onClick:l,children:[(0,X.jsx)(f,{className:`h-4 w-4`}),g9.label]})]})]})]}):(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a desktop project before opening tickets or chats from this phone.`})},zve=({ticket:e})=>{let t=[{label:`State`,value:C9(e)},{label:`Tool`,value:yF(e,`opencode`)},{label:`Agent`,value:e.agent_status},{label:`Branch`,value:e.branch},{label:`Bundle`,value:e.bundle?.name??null},{label:`Model`,value:e.tool===`opencode`?e.model:null},{label:`Variant`,value:e.tool===`opencode`?e.variant:null}].filter(e=>!!e.value);return t.length===0?null:(0,X.jsxs)(`div`,{className:`min-w-0 space-y-2 rounded-xl border border-border/70 bg-background/40 px-3 py-3`,children:[(0,X.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Details`}),(0,X.jsx)(`dl`,{className:`grid gap-2 text-sm sm:grid-cols-2`,children:t.map(e=>(0,X.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border/60 bg-background/50 px-3 py-2`,children:[(0,X.jsx)(`dt`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:e.label}),(0,X.jsx)(`dd`,{className:`break-words text-foreground`,children:e.value})]},e.label))})]})},F9=({label:e,disabled:t,onClick:n})=>(0,X.jsx)(Q,{type:`button`,variant:`outline`,disabled:t,onClick:n,children:e}),Bve=({ticket:e,actionState:t,actionError:n,onAction:r})=>{let i=o3(e,{reviewLabel:e.worktree_bundle_id===null?`Review`:`Review Bundle`}),a=e.worktree_bundle_id===null&&e.state===`review`&&e.can_re_review===!0&&e.agent_status!==`running`&&!e.parked_at?[{id:`review`,label:`Re-run review`,pendingLabel:`Re-running review...`,ariaLabel:`Re-run review`,disabled:!1,disabledReason:null},...i]:i;return a.length===0?null:(0,X.jsx)(t4,{actions:a,activeAction:t,disableWhenActive:!0,className:`space-y-3`,heading:`Actions`,headingClassName:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,actionsClassName:`flex flex-wrap gap-2`,showDisabledReason:!0,disabledReasonClassName:`text-sm text-amber-200`,error:n,errorClassName:`text-sm text-red-200`,renderAction:({action:e,label:t,disabled:n})=>(0,X.jsx)(F9,{label:t,disabled:n,onClick:()=>r(e.id)},e.id)})},Vve=({bundleDetail:e,actionState:t,actionError:n,onAction:r})=>{let{actions:i}=M9(e);return i.length===0?null:(0,X.jsx)(t4,{actions:i,activeAction:t,disableWhenActive:!0,className:`space-y-3`,heading:`Actions`,headingClassName:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,actionsClassName:`flex flex-wrap gap-2`,error:n,errorClassName:`text-sm text-red-200`,renderAction:({action:e,label:t,disabled:n})=>(0,X.jsx)(F9,{label:t,disabled:n,onClick:()=>r(e.id)},e.id)})},I9=(e,t)=>(e??[]).map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,created_at:e.created_at,ticket_id:t??null,ticket_proposals:`ticket_proposals`in e?e.ticket_proposals??null:null,metadata:e.metadata,responseTiming:e.response_timing?GK(e.response_timing):null,transcript_runs:e.transcript_runs??null})),L9=({title:e,subtitle:t,badges:n,backLabel:r,onBack:i,action:a})=>(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[i?(0,X.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 px-2.5 lg:hidden`,"aria-label":r,onClick:i,children:[(0,X.jsx)(cF,{className:`h-4 w-4`}),`Back`]}):null,(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e}),t?(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:t}):null]})]}),a?(0,X.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),n?(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n}):null]}),Hve=({title:e,backLabel:t,onBack:n,action:r})=>(0,X.jsxs)(`div`,{className:`-mx-3 flex shrink-0 items-center justify-between gap-3 border-b border-border/80 bg-background/95 px-3 py-2.5 backdrop-blur supports-[backdrop-filter]:bg-background/85 sm:-mx-4 sm:px-4 lg:hidden`,children:[(0,X.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 px-2.5`,"aria-label":t,onClick:n,children:[(0,X.jsx)(cF,{className:`h-4 w-4`}),`Back`]}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-foreground`,children:e}),(0,X.jsx)(`div`,{className:`shrink-0`,children:r})]}),R9=({title:e,backLabel:t,onBack:n,action:r,subheader:i,children:a})=>(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,X.jsx)(Hve,{title:e,backLabel:t,onBack:n,action:r}),i?(0,X.jsx)(`div`,{className:`shrink-0 border-b border-border/70 py-2 lg:hidden`,children:i}):null,(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:a})]}),z9=({value:e,onTranscript:t,onDetails:n})=>(0,X.jsxs)(`div`,{className:`flex gap-2 px-3 sm:px-0`,children:[(0,X.jsx)(Q,{type:`button`,variant:e===`transcript`?`secondary`:`ghost`,className:`h-9 flex-1`,"aria-pressed":e===`transcript`,onClick:t,children:`Transcript`}),(0,X.jsx)(Q,{type:`button`,variant:e===`details`?`secondary`:`ghost`,className:`h-9 flex-1`,"aria-pressed":e===`details`,onClick:n,children:`Details`})]}),B9=({controls:e})=>{let[t,n]=(0,p.useState)(!1);return(0,X.jsxs)(BC,{open:t,onOpenChange:n,children:[(0,X.jsx)(`div`,{className:`px-1 pb-1`,children:(0,X.jsx)(VC,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2 text-xs text-muted-foreground`,children:[`Options`,(0,X.jsx)(mv,{className:Z(`h-3.5 w-3.5 transition-transform`,t&&`rotate-180`)})]})})}),(0,X.jsx)(HC,{className:`px-1 pb-1`,children:(0,X.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-background/35 p-2`,children:e})})]})},V9=({ticket:e,badges:t,actionState:n,actionError:r,onAction:i,className:a})=>(0,X.jsxs)(gC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,a),children:[(0,X.jsx)(_C,{className:`min-w-0 pb-3`,children:(0,X.jsx)(L9,{title:e.title,badges:t})}),(0,X.jsxs)(xC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,X.jsx)(Bve,{ticket:e,actionState:n,actionError:r,onAction:i}),e.description?(0,X.jsxs)(`div`,{className:`min-w-0 space-y-2 rounded-xl border border-border/70 bg-background/40 px-3 py-3`,children:[(0,X.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Description`}),(0,X.jsx)(WK,{content:e.description,className:`min-w-0 text-foreground`})]}):null,(0,X.jsx)(zve,{ticket:e})]})]}),H9=({bundleDetail:e,title:t,subtitle:n,badges:r,actionState:i,actionError:a,onAction:o,orderedTickets:s,highlightedTicketId:c,isTicketListOpen:l,onTicketListOpenChange:u,onSelectTicket:d,className:f,availableModels:p})=>(0,X.jsxs)(gC,{className:Z(`flex min-h-0 min-w-0 flex-col border-border/80 bg-card/70 shadow-none`,f),children:[(0,X.jsx)(_C,{className:`min-w-0 pb-3`,children:(0,X.jsx)(L9,{title:t,subtitle:n,badges:r})}),(0,X.jsxs)(xC,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-y-auto pt-0`,children:[(0,X.jsx)(Vve,{bundleDetail:e,actionState:i,actionError:a,onAction:o}),(0,X.jsxs)(BC,{open:l,onOpenChange:u,children:[(0,X.jsx)(VC,{asChild:!0,children:(0,X.jsxs)(Q,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs text-muted-foreground`,children:[`Tickets`,(0,X.jsx)(mv,{className:Z(`h-3.5 w-3.5 transition-transform`,l&&`rotate-180`)})]})}),(0,X.jsx)(HC,{className:`pt-2`,children:(0,X.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-background/35 p-3`,children:(0,X.jsx)(h3,{tickets:s,highlightedTicketId:c,onOpenTicketDetails:e=>d(e.id,e.worktree_bundle_id),availableModels:p})})})]})]})]}),U9=({selectedProjectId:e,bundleId:t,bundleDetail:n,openNonce:r,mobileDetailView:i,error:a,actionState:o,actionError:s,followUpPrompt:c,isSendingFollowUp:l,followUpError:u,availableModels:d,onBack:f,onRetry:m,onAction:h,onDetailViewChange:g,onSelectTicket:_,onFollowUpPromptChange:v,onFollowUpKeyDown:y,onFollowUpSubmit:b,isLargeScreen:x})=>{let[S,C]=(0,p.useState)(!0);if((0,p.useEffect)(()=>{C(!0)},[t,r]),!e)return(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a project before opening bundle details from this phone.`});if(!t)return(0,X.jsx)(v9,{title:`Choose a bundle`,description:`Open a bundle to review its transcript and grouped ticket progress.`});if(a)return(0,X.jsx)(R9,{title:`Bundle unavailable`,backLabel:`Back to tickets`,onBack:f,children:(0,X.jsx)(v9,{title:`Bundle unavailable`,description:a,action:(0,X.jsx)(Q,{variant:`warning`,onClick:m,children:`Retry bundle`})})});if(!n||n.bundle.id!==t)return(0,X.jsx)(R9,{title:`Loading bundle`,backLabel:`Back to tickets`,onBack:f,children:(0,X.jsx)(y9,{text:`Loading bundle details...`})});let w=My(n.bundle)||n.bundle.branch||n.bundle.name||`Bundle`,T=new Map(d.map(e=>[e.id,e.label])),E=y3(n.tickets,T),D=S3(n),O=b3(n.tickets,n.execution_order_ticket_ids),k=x3(n.tickets,T,E,n.execution_order_ticket_ids),A=vF(n.tickets,D?.state??null),j=n.tickets.find(e=>e.agent_status===`running`)??D,M=j??D??n.tickets[0]??null,N=j?.agent_status===`running`?E[j.id]??j.model??`Agent`:null,P=!!(D&&D.state!==`plan`&&Cy(D)),F=n.tickets.some(e=>e.agent_status===`running`)?`Wait for all bundle tickets to finish building before sending a follow-up prompt.`:void 0,I=`mobile-bundle:${n.bundle.id}:${r}`,L=`${n.tickets.length} ticket${n.tickets.length===1?``:`s`}`,R=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(uF,{status:A}),(0,X.jsx)(hC,{variant:`outline`,children:L}),M?(0,X.jsxs)(hC,{variant:`outline`,children:[`Target: `,M.title]}):null]});return(0,X.jsx)(R9,{title:w,backLabel:`Back to tickets`,onBack:f,subheader:x?void 0:(0,X.jsx)(z9,{value:i,onTranscript:()=>g(`transcript`),onDetails:()=>g(`details`)}),children:x?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden pt-3`,children:[(0,X.jsx)(H9,{bundleDetail:n,title:w,subtitle:n.bundle.branch,badges:R,actionState:o,actionError:s,onAction:h,orderedTickets:O,highlightedTicketId:n.target_ticket_id,isTicketListOpen:S,onTicketListOpenChange:C,onSelectTicket:_,className:`shrink-0`,availableModels:d}),(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,X.jsx)(m3,{projectId:e,followUpTicketId:n.target_ticket_id,messages:k,internalLog:j?.agent_log??null,currentThinkingMessageId:j?.agent_message_id??D?.agent_message_id??null,legacyThinkingTicketId:j?.id??D?.id??null,previousThinkingLog:j?.previous_agent_log??D?.previous_agent_log??null,previousThinkingMessageId:j?.previous_agent_message_id??D?.previous_agent_message_id??null,pendingAgentTitle:N,streamingResponse:j?.streaming_response??null,isRunning:n.tickets.some(e=>e.agent_status===`running`),canShowComposer:P,composerTheme:ry(D?.state??null),layoutKey:I,scrollLayoutKey:I,followUpPrompt:c,followUpPlaceholder:M?`Follow up on: ${M.title}`:`Follow up on this bundle`,isSendingFollowUp:l,followUpDisabledReason:F,onFollowUpPromptChange:v,onFollowUpKeyDown:y,onFollowUpSubmit:b},I)}),u?(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-red-200`,children:u}):null]}):i===`details`?(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,X.jsx)(H9,{bundleDetail:n,title:w,subtitle:n.bundle.branch,badges:R,actionState:o,actionError:s,onAction:h,orderedTickets:O,highlightedTicketId:n.target_ticket_id,isTicketListOpen:S,onTicketListOpenChange:C,onSelectTicket:_,className:`h-full`,availableModels:d})}):(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,X.jsx)(m3,{projectId:e,followUpTicketId:n.target_ticket_id,messages:k,internalLog:j?.agent_log??null,currentThinkingMessageId:j?.agent_message_id??D?.agent_message_id??null,legacyThinkingTicketId:j?.id??D?.id??null,previousThinkingLog:j?.previous_agent_log??D?.previous_agent_log??null,previousThinkingMessageId:j?.previous_agent_message_id??D?.previous_agent_message_id??null,pendingAgentTitle:N,streamingResponse:j?.streaming_response??null,isRunning:n.tickets.some(e=>e.agent_status===`running`),canShowComposer:P,composerTheme:ry(D?.state??null),layoutKey:I,scrollLayoutKey:I,followUpPrompt:c,followUpPlaceholder:M?`Follow up on: ${M.title}`:`Follow up on this bundle`,isSendingFollowUp:l,followUpDisabledReason:F,onFollowUpPromptChange:v,onFollowUpKeyDown:y,onFollowUpSubmit:b},I),u?(0,X.jsx)(`p`,{className:`shrink-0 px-1 pt-2 text-sm text-red-200`,children:u}):null]})})},W9=({selectedProjectId:e,chatSession:t,chatSessionId:n,openNonce:r,error:i,isStopping:a,isResuming:o,isResumeDisabled:s,composerMode:c,composerTool:l,prompt:u,selectedModel:d,selectedVariant:f,selectedSkills:p,availableModels:m,availableSkills:h,isLoadingAgentSettings:g,isSending:_,isUpdatingMode:v,showStartBuilding:y,composerDisabledReason:b,onBack:x,onRetry:S,onStop:C,onResume:w,onModeChange:T,onStartBuilding:E,onPromptChange:D,onModelChange:O,onVariantChange:k,onSkillsChange:A,onPromptKeyDown:j,onSubmit:M,onResolveQuestionSet:N,liveResponseTiming:P,isLargeScreen:F})=>{if(!e)return(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a project before opening the chat workspace.`});if(n&&i)return(0,X.jsx)(v9,{title:`Chat unavailable`,description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:S,children:`Retry chat`})});if(n&&(!t||t.id!==n))return(0,X.jsx)(R9,{title:`Loading chat`,backLabel:`Back to chats`,onBack:x,children:(0,X.jsx)(y9,{text:`Loading chat transcript...`})});let I=t?.mode??c,L=m.length>0,R=m.find(e=>e.id===d)??null,z=I9(t?.messages),ee=N9(t?.messages),B=!!ee,V=pF(t?.post_build_check),te=V?jb.t(`common:postBuildChecks.blockedReason`):B?jb.t(`common:questionSet.waitForResolution`):b,H=t?.agent_status===`running`?(0,X.jsx)(j8,{action:`interrupt`,isPending:a,onAction:C,label:G9(`chatDetail.interrupt`),pendingLabel:G9(`chatDetail.interrupting`)}):t?.can_resume?(0,X.jsx)(j8,{action:`resume`,isPending:o,disabled:s||B||V,onAction:w,label:G9(`chatDetail.resume`),pendingLabel:G9(`chatDetail.resuming`)}):null,U=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(hC,{variant:I===`plan`?`info`:`success`,children:I}),(0,X.jsx)(hC,{variant:`outline`,children:t?.tool??l}),t?.agent_status?(0,X.jsx)(hC,{variant:`outline`,children:t.agent_status}):null]}),ne=L?(0,X.jsx)(vY,{model:d,variant:f,skills:p,showModelSelector:!0,showSkillsSelector:!0,availableModels:m,availableSkills:h,selectedModel:R,onModelChange:O,onVariantChange:k,onSkillsChange:A,modelSelectId:`mobile-chat-model-selector`,variantSelectId:`mobile-chat-variant-selector`,skillsSelectId:`mobile-chat-skills-selector`,disabled:!!te||_}):g?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,re=!F&&ne?(0,X.jsx)(B9,{controls:ne}):ne,ie=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(UY,{value:I,disabled:!!te||_||v,onChange:T}),y&&(0,X.jsx)(tX,{disabled:_||v,onClick:E})]}),ae=t?(0,X.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:jb.t(`common:mobileApp.agentSelector.sessionLocked`,{agent:t.tool})}):null,oe=F?void 0:({showThinkingControl:e})=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[ie,(0,X.jsx)(`div`,{className:`ml-auto`,children:e})]}),W=`mobile-chat:${n??`new`}:${r}`;return(0,X.jsx)(R9,{title:t?.title??`New chat`,backLabel:`Back to chats`,onBack:x,action:H,children:(0,X.jsx)(V8,{projectId:e,agentRunParentType:t?`chat`:null,agentRunParentId:t?.id??null,messages:z,internalLog:t?.agent_log??null,currentThinkingMessageId:t?.agent_message_id??null,previousThinkingLog:t?.previous_agent_log??null,previousThinkingMessageId:t?.previous_agent_message_id??null,pendingAgentTitle:t?.title??`Archon`,streamingResponse:t?.streaming_response??null,isRunning:t?.agent_status===`running`,pendingAgentRevealKey:P?.turnKey??null,liveResponseTiming:P,canShowComposer:!0,header:F?(0,X.jsx)(L9,{title:t?.title??`New chat`,subtitle:t?.target_label_snapshot??`Project root`,badges:U}):oe,composerControls:F?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[ae,ie]}):ae,composerInlineControls:re,composerTheme:I,forceScrollToBottomKey:W,layoutKey:W,scrollLayoutKey:W,composerFocusNonce:r,blurComposerOnSendStart:!F,followUpPrompt:u,followUpPlaceholder:n?`Continue this chat`:I===`plan`?`Ask Archon to scope or reason through project work`:`Ask Archon to build or verify something in this project`,emptyStateText:n?`No messages yet.`:`Start a new project chat from this phone.`,renderMessageBody:e=>{let n=e.metadata?.ask_question;if(!(e.role!==`assistant`||!n||!t))return(0,X.jsx)($J,{messageContent:e.content,questionSet:n,storageKey:WJ({parentType:`chat`,parentId:t.id,setId:n.id}),isActive:n.status===`pending`&&ee?.id===e.id,isDisabled:t.agent_status===`running`||_||v,onResolve:t=>N(e.id,t)})},isSendingFollowUp:_,isComposerSubmitDisabled:!!te,postBuildCheck:t?.post_build_check,followUpDisabledReason:te??void 0,hidePendingAgentTitle:!F,onFollowUpPromptChange:D,onFollowUpKeyDown:j,onFollowUpSubmit:M},W)})},Uve=e=>(e??[]).map(e=>({id:e.id,role:e.role,kind:e.kind,content:e.content,created_at:e.created_at,ticket_id:null,ticket_proposals:null,metadata:e.metadata,responseTiming:e.response_timing?GK(e.response_timing):null,transcript_runs:e.transcript_runs??null})),Wve=e=>{if(!e)return null;for(let t=e.length-1;t>=0;--t)if(e[t].kind===`grill-question`)return e[t].id;return null},G9=e=>jb.t(`common:mobileApp.${e}`),K9=({selectedProjectId:e,specSession:t,specSessionId:n,openNonce:r,error:i,isStopping:a,isResuming:o,isResumeDisabled:s,composerMode:c,composerTool:l,prompt:u,selectedModel:d,selectedVariant:f,selectedSkills:p,availableModels:m,availableSkills:h,isLoadingAgentSettings:g,isSending:_,isUpdatingMode:v,composerDisabledReason:y,targetWarning:b,targetActionLabel:x,targetActionError:S,isRestoringTarget:C,onBack:w,onRetry:T,onStop:E,onResume:D,onModeChange:O,onPromptChange:k,onModelChange:A,onVariantChange:j,onSkillsChange:M,onPromptKeyDown:N,onSubmit:P,onSubmitAnswer:F,onResolveQuestionSet:I,onRestoreTarget:L,liveResponseTiming:R,isLargeScreen:z})=>{if(!e)return(0,X.jsx)(v9,{title:G9(`specList.emptyTitle`),description:`Select a project before opening the spec workspace.`});if(n&&i)return(0,X.jsx)(v9,{title:G9(`specDetail.unavailableTitle`),description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:T,children:G9(`specDetail.retry`)})});if(n&&(!t||t.id!==n))return(0,X.jsx)(R9,{title:G9(`specDetail.loadingTitle`),backLabel:G9(`specDetail.back`),onBack:w,children:(0,X.jsx)(y9,{text:G9(`specDetail.loading`)})});let ee=t?.mode??c,B=m.length>0,V=m.find(e=>e.id===d)??null,te=Uve(t?.messages),H=Wve(t?.messages),U=N9(t?.messages),ne=!!U,re=ne?jb.t(`common:questionSet.waitForResolution`):y,ie=t?.agent_status===`running`,ae=ie?(0,X.jsx)(j8,{action:`interrupt`,isPending:a,onAction:E,label:G9(`specDetail.interrupt`),pendingLabel:G9(`specDetail.interrupting`)}):t?.can_resume?(0,X.jsx)(j8,{action:`resume`,isPending:o,disabled:s||ne||!!b,onAction:D,label:G9(`specDetail.resume`),pendingLabel:G9(`specDetail.resuming`)}):null,oe=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(hC,{variant:ee===`grill`?`info`:`success`,children:ee}),(0,X.jsx)(hC,{variant:`outline`,children:t?.tool??l}),t?.agent_status?(0,X.jsx)(hC,{variant:`outline`,children:t.agent_status}):null]}),W=B?(0,X.jsx)(vY,{model:d,variant:f,skills:p,showModelSelector:!0,showSkillsSelector:!0,availableModels:m,availableSkills:h,selectedModel:V,onModelChange:A,onVariantChange:j,onSkillsChange:M,modelSelectId:`mobile-spec-model-selector`,variantSelectId:`mobile-spec-variant-selector`,skillsSelectId:`mobile-spec-skills-selector`,disabled:!!re||_}):l===`opencode`&&g?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,se=!z&&W?(0,X.jsx)(B9,{controls:W}):W,ce={rationaleLabel:jb.t(`common:specView.grill.rationaleLabel`),suggestionsLabel:jb.t(`common:specView.grill.suggestionsLabel`),recommendedSuggestionLabel:jb.t(`common:specView.grill.recommendedSuggestionLabel`),answerPlaceholder:jb.t(`common:specView.grill.answerPlaceholder`),submitLabel:jb.t(`common:specView.grill.submitLabel`),submittingLabel:jb.t(`common:specView.grill.submittingLabel`)},le=e=>{if(e.role!==`assistant`)return;let n=e.metadata,r=n?.ask_question;if(r&&t)return(0,X.jsx)($J,{messageContent:e.content,questionSet:r,storageKey:WJ({parentType:`spec`,parentId:t.id,setId:r.id}),isActive:r.status===`pending`&&U?.id===e.id,isDisabled:!!b||ie||_||v,onResolve:t=>I(e.id,t)});if(e.kind!==`grill-question`)return;let i=n?.grill_question;if(i)return(0,X.jsx)(k5,{question:i,isActive:ie?!1:e.id===H&&t?.agent_status!==`running`&&t?.mode===`grill`,isDisabled:!!b||_||v,labels:ce,onSubmitAnswer:F})},ue=(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,X.jsx)(A5,{on:ee===`grill`,disabled:!!re||_||v,onToggle:e=>O(e?`grill`:`standard`),tooltipContent:jb.t(`common:specView.grill.toggleTooltip`),ariaLabelOn:jb.t(`common:specView.grill.toggleAriaLabelOn`),ariaLabelOff:jb.t(`common:specView.grill.toggleAriaLabelOff`)})}),de=t?(0,X.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:jb.t(`common:mobileApp.agentSelector.sessionLocked`,{agent:t.tool})}):null,fe=z?void 0:({showThinkingControl:e})=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 py-1`,children:[ue,(0,X.jsx)(`div`,{className:`ml-auto`,children:e})]}),pe=`mobile-spec:${n??`new`}:${r}`;return(0,X.jsxs)(R9,{title:t?.title??G9(`specDetail.newSpecTitle`),backLabel:G9(`specDetail.back`),onBack:w,action:ae,children:[b&&(0,X.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-100`,children:[(0,X.jsx)(`p`,{children:b}),x&&(0,X.jsx)(Q,{type:`button`,size:`sm`,variant:`outline`,className:`mt-2`,disabled:C,onClick:L,children:C?G9(`specDetail.switchingBack`):x}),S&&(0,X.jsx)(`p`,{className:`mt-2 text-red-200`,children:S})]}),(0,X.jsx)(V8,{projectId:e,agentRunParentType:n?`spec`:null,agentRunParentId:n,messages:te,internalLog:t?.agent_log??null,currentThinkingMessageId:t?.agent_message_id??null,previousThinkingLog:t?.previous_agent_log??null,previousThinkingMessageId:t?.previous_agent_message_id??null,pendingAgentTitle:t?.title??G9(`specDetail.newSpecTitle`),streamingResponse:t?.streaming_response??null,isRunning:ie,pendingAgentRevealKey:R?.turnKey??null,liveResponseTiming:R,canShowComposer:!0,header:z?(0,X.jsx)(L9,{title:t?.title??G9(`specDetail.newSpecTitle`),subtitle:t?.first_user_message_preview??null,badges:oe}):fe,composerControls:z?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[de,ue]}):de,composerInlineControls:se,composerTheme:`default`,forceScrollToBottomKey:pe,layoutKey:pe,scrollLayoutKey:pe,composerFocusNonce:r,blurComposerOnSendStart:!z,followUpPrompt:u,followUpPlaceholder:G9(n?`specDetail.composerPlaceholder`:`specDetail.composerPlaceholderDraft`),emptyStateText:G9(n?`specDetail.emptyMessages`:`specDetail.emptyDraft`),renderMessageBody:le,isSendingFollowUp:_,isComposerSubmitDisabled:!!re,followUpDisabledReason:re??void 0,hidePendingAgentTitle:!z,onFollowUpPromptChange:k,onFollowUpKeyDown:N,onFollowUpSubmit:P},pe)]})},q9=({selectedProjectId:e,ticketId:t,ticket:n,openNonce:r,error:i,actionState:a,actionError:o,followUpPrompt:s,followUpSelectedModel:c,followUpSelectedVariant:l,followUpSelectedSkills:u,availableModels:d,availableSkills:f,isLoadingAgentSettings:m,isSendingFollowUp:h,followUpError:g,onBack:_,onRetry:v,onAction:y,onFollowUpPromptChange:b,onFollowUpModelChange:x,onFollowUpVariantChange:S,onFollowUpSkillsChange:C,onFollowUpKeyDown:w,onFollowUpSubmit:T,onResolveQuestionSet:E,liveResponseTiming:D,isLargeScreen:O})=>{let[k,A]=(0,p.useState)(`transcript`);if((0,p.useEffect)(()=>{A(`transcript`)},[r,t]),!e)return(0,X.jsx)(v9,{title:`Choose a project`,description:`Select a project before opening ticket details from this phone.`});if(!t)return(0,X.jsx)(v9,{title:`Choose a ticket`,description:`Open a ticket to review its transcript and continue the workflow.`});if(i)return(0,X.jsx)(v9,{title:`Ticket unavailable`,description:i,action:(0,X.jsx)(Q,{variant:`warning`,onClick:v,children:`Retry ticket`})});if(!n||n.id!==t)return(0,X.jsx)(R9,{title:`Loading ticket`,backLabel:`Back to tickets`,onBack:_,children:(0,X.jsx)(y9,{text:`Loading ticket details...`})});let j=s3(n,{requireWorktree:!0}),M=I9(n.messages,n.id),N=N9(n.messages),P=!!N,F=pF(n.post_build_check),I=F?jb.t(`common:postBuildChecks.blockedReason`):P?jb.t(`common:questionSet.waitForResolution`):j.disabledReason,L=d.find(e=>e.id===c)??null,R=yF(n,`opencode`)===`opencode`&&d.length>0?(0,X.jsx)(vY,{model:c,variant:l,skills:u,showModelSelector:!0,showSkillsSelector:!0,availableModels:d,availableSkills:f,selectedModel:L,onModelChange:x,onVariantChange:S,onSkillsChange:C,modelSelectId:`mobile-ticket-follow-up-model-selector`,variantSelectId:`mobile-ticket-follow-up-variant-selector`,skillsSelectId:`mobile-ticket-follow-up-skills-selector`,disabled:!!I||h}):yF(n,`opencode`)===`opencode`&&m?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading model controls...`}):null,z=!O&&R?(0,X.jsx)(B9,{controls:R}):R,ee=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(hC,{variant:w9(S9(n)),children:C9(n)}),n.tool?(0,X.jsx)(hC,{variant:`outline`,children:n.tool}):null,n.agent_status?(0,X.jsx)(hC,{variant:`outline`,children:n.agent_status}):null,n.branch?(0,X.jsx)(hC,{variant:`outline`,children:n.branch}):null,n.bundle?.name?(0,X.jsx)(hC,{variant:`outline`,children:n.bundle.name}):null]}),B=`mobile-ticket:${n.id}:${r}`,V=e=>{let t=e.metadata?.ask_question;if(!(e.role!==`assistant`||!t))return(0,X.jsx)($J,{messageContent:e.content,questionSet:t,storageKey:WJ({parentType:`ticket`,parentId:n.id,setId:t.id}),isActive:t.status===`pending`&&N?.id===e.id,isDisabled:n.agent_status===`running`||h,onResolve:t=>E(e.id,t)})},te=(0,X.jsx)(z9,{value:k,onTranscript:()=>A(`transcript`),onDetails:()=>A(`details`)});return(0,X.jsx)(R9,{title:n.title,backLabel:`Back to tickets`,onBack:_,subheader:O?void 0:te,children:O?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden pt-3`,children:[(0,X.jsx)(V9,{ticket:n,badges:ee,actionState:a,actionError:o,onAction:y,className:`shrink-0`}),(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,X.jsx)(oY,{projectId:e,followUpTicketId:n.id,messages:M,internalLog:n.agent_log??null,currentThinkingMessageId:n.agent_message_id??null,previousThinkingLog:n.previous_agent_log??null,previousThinkingMessageId:n.previous_agent_message_id??null,pendingAgentTitle:n.title,liveResponseTiming:D,streamingResponse:n.streaming_response??null,isRunning:n.agent_status===`running`,canShowComposer:!0,followUpComposerControls:R,composerTheme:ry(n.state),forceScrollToBottomKey:B,layoutKey:B,scrollLayoutKey:B,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:V,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},B)}),g?(0,X.jsx)(`p`,{className:`shrink-0 text-sm text-red-200`,children:g}):null]}):k===`details`?(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,X.jsx)(V9,{ticket:n,badges:ee,actionState:a,actionError:o,onAction:y,className:`h-full`})}):(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,X.jsx)(oY,{projectId:e,followUpTicketId:n.id,messages:M,internalLog:n.agent_log??null,currentThinkingMessageId:n.agent_message_id??null,previousThinkingLog:n.previous_agent_log??null,previousThinkingMessageId:n.previous_agent_message_id??null,pendingAgentTitle:n.title,liveResponseTiming:D,streamingResponse:n.streaming_response??null,isRunning:n.agent_status===`running`,canShowComposer:!0,followUpComposerControls:z,composerTheme:ry(n.state),surfaceVariant:`chat`,composerSize:`compact-on-laptop`,forceScrollToBottomKey:B,layoutKey:B,scrollLayoutKey:B,followUpPrompt:s,followUpPlaceholder:j.placeholder,emptyStateText:`No follow-up messages yet.`,renderMessageBody:V,isSendingFollowUp:h,isComposerSubmitDisabled:P||F,postBuildCheck:n.post_build_check,followUpDisabledReason:I??void 0,onFollowUpPromptChange:b,onFollowUpKeyDown:w,onFollowUpSubmit:T},B),g?(0,X.jsx)(`p`,{className:`shrink-0 px-1 pt-2 text-sm text-red-200`,children:g}):null]})})},Gve=[],Kve=[],qve=[],J9=e=>jb.t(`common:mobileApp.${e}`),Y9=`Project root has uncommitted changes. Confirm branch switch to continue.`,X9=(e,t)=>{if(!e)return e;let n=new Map(t.tickets.map(e=>[e.id,e]));return e.map(e=>n.get(e.id)??e)},Jve=()=>{let e=new URLSearchParams(window.location.search),t=new URLSearchParams(window.location.hash.slice(1)),n=e.get(`mobileAccessId`)??``,r=e.get(`pairingId`)??``,i=t.get(`pairingSecret`)??``;return!n||!r||!i?null:{mobileAccessId:n,pairingId:r,pairingSecret:i}},Yve=()=>{window.history.replaceState({},``,`/mobile`)},Xve=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},Z9=(e,t)=>e instanceof Ke&&e.message?e.message:t,Q9=e=>({status:`authenticated`,csrfToken:e,projects:null,selectedProjectId:null,projectError:null,projectSummary:null,projectSummaryError:null,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null,tickets:null,ticketsError:null,selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),$9=(e=`pairing_required`)=>({status:`unauthenticated`,reason:e}),Zve=e=>e instanceof Ke&&(e.status===401||e.status===403),Qve=()=>{let[e,t]=(0,p.useState)({status:`checking`}),[n,r]=(0,p.useState)(`connecting`),[i,a]=(0,p.useState)(`opencode`),[o,s]=(0,p.useState)(Vr),[c,l]=(0,p.useState)(null),[u,d]=(0,p.useState)(`overview`),[f,m]=(0,p.useState)(!1),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(!1),[y,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(!1),[C,w]=(0,p.useState)(!1),[T,E]=(0,p.useState)(``),[D,O]=(0,p.useState)(`build`),[k,A]=(0,p.useState)(``),[j,M]=(0,p.useState)(``),[N,P]=(0,p.useState)([]),[F,I]=(0,p.useState)([]),[L,R]=(0,p.useState)([]),[z,ee]=(0,p.useState)(null),[B,V]=(0,p.useState)(!1),[te,H]=(0,p.useState)(!1),[U,ne]=(0,p.useState)(!1),[re,ie]=(0,p.useState)(null),[ae,oe]=(0,p.useState)(null),[W,se]=(0,p.useState)(null),[ce,le]=(0,p.useState)(null),[ue,de]=(0,p.useState)(!1),[fe,pe]=(0,p.useState)(``),[me,he]=(0,p.useState)(`standard`),[ge,_e]=(0,p.useState)(``),[ve,ye]=(0,p.useState)(``),[be,xe]=(0,p.useState)([]),[Se,Ce]=(0,p.useState)(!1),[we,Te]=(0,p.useState)(!1),[Ee,De]=(0,p.useState)(null),[Oe,ke]=(0,p.useState)(null),[Ae,je]=(0,p.useState)(null),[Me,Ne]=(0,p.useState)(null),[Pe,Fe]=(0,p.useState)(0),[Ie,Le]=(0,p.useState)(null),[Re,ze]=(0,p.useState)(null),[G,Be]=(0,p.useState)(null),[Ve,He]=(0,p.useState)(null),[Ue,K]=(0,p.useState)(``),[We,Ge]=(0,p.useState)(``),[q,Je]=(0,p.useState)(``),[J,Xe]=(0,p.useState)([]),[Ze,Y]=(0,p.useState)(!1),[Qe,$e]=(0,p.useState)(null),[et,tt]=(0,p.useState)(null),[nt,rt]=(0,p.useState)(``),[it,at]=(0,p.useState)(!1),[ot,st]=(0,p.useState)(null),[ct,lt]=(0,p.useState)(0),[ut,dt]=(0,p.useState)(0),[ft,pt]=(0,p.useState)(0),[mt,ht]=(0,p.useState)(`transcript`),[gt,_t]=(0,p.useState)(null),[vt,yt]=(0,p.useState)(null),[bt,xt]=(0,p.useState)(!1),[St,Ct]=(0,p.useState)(!1),[wt,Tt]=(0,p.useState)(!1),[Et,Dt]=(0,p.useState)(null),[Ot,kt]=(0,p.useState)(null),At=(0,p.useRef)(null),jt=(0,p.useRef)(null),Mt=(0,p.useRef)(null),Nt=(0,p.useRef)(null),Pt=(0,p.useRef)(null),Ft=(0,p.useRef)(0),It=(0,p.useRef)(0),Lt=(0,p.useRef)(0),Rt=(0,p.useRef)(!1),zt=(0,p.useRef)(0),Bt=(0,p.useCallback)(e=>Zve(e)?(t($9(`session_revoked`)),r(`unavailable`),m(!1),g(!1),v(!1),b(!1),de(!1),!0):!1,[]),Vt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await F_e(n,r,i);t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedTicketId!==r?t:{...t,ticketDetail:a,ticketDetailError:null})}catch(i){if(!Ye(i)){if(Bt(i))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedTicketId!==r?t:{...t,ticketDetail:null,ticketDetailError:Z9(i,`Unable to load ticket details.`)})}}},[Bt]),Ht=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await z_e(n,r,i);t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedBundleId!==r?t:{...t,bundleDetail:a,bundleDetailError:null,tickets:X9(t.tickets,a)})}catch(i){if(!Ye(i)){if(Bt(i))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedBundleId!==r?t:{...t,bundleDetail:null,bundleDetailError:Z9(i,`Unable to load bundle details.`)})}}},[Bt]),Ut=(0,p.useCallback)(async(e,n,r)=>{try{let i=await P_e(n,r);t(t=>{if(t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n)return t;let r=t.selectedTicketId&&i.some(e=>e.id===t.selectedTicketId)?t.selectedTicketId:null,a=t.selectedBundleId&&i.some(e=>e.worktree_bundle_id===t.selectedBundleId)?t.selectedBundleId:null;return{...t,tickets:i,ticketsError:null,selectedBundleId:a,bundleDetail:a?t.bundleDetail:null,bundleDetailError:a?t.bundleDetailError:null,selectedTicketId:r,ticketDetail:r?t.ticketDetail:null,ticketDetailError:r?t.ticketDetailError:null}})}catch(r){if(!Ye(r)){if(Bt(r))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,tickets:null,ticketsError:Z9(r,`Unable to load project tickets.`),selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null})}}},[Bt]),Wt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await N_e(n,r,i);At.current===n&&jt.current===r&&(Ft.current+=1),t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedChatSessionId!==r?t:{...t,chatSessionDetail:a,chatSessionDetailError:null})}catch(i){if(!Ye(i)){if(Bt(i))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedChatSessionId!==r?t:{...t,chatSessionDetail:null,chatSessionDetailError:Z9(i,`Unable to load chat transcript.`)})}}},[Bt]),Gt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await M_e(n,r);t(t=>{if(t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n)return t;let r=t.selectedChatSessionId&&i.some(e=>e.id===t.selectedChatSessionId)?t.selectedChatSessionId:null;return{...t,chatSessions:i,chatSessionsError:null,selectedChatSessionId:r,chatSessionDetail:r?t.chatSessionDetail:null,chatSessionDetailError:r?t.chatSessionDetailError:null}})}catch(r){if(!Ye(r)){if(Bt(r))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,chatSessions:null,chatSessionsError:Z9(r,`Unable to load project chats.`),selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null})}}},[Bt]),Kt=(0,p.useCallback)(async(e,n,r,i)=>{try{let a=await Y_e(n,r,i);At.current===n&&Pt.current===r&&(It.current+=1),t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedSpecSessionId!==r?t:{...t,specSessionDetail:a,specSessionDetailError:null})}catch(i){if(!Ye(i)){if(Bt(i))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n||t.selectedSpecSessionId!==r?t:{...t,specSessionDetail:null,specSessionDetailError:Z9(i,J9(`specDetail.detailError`))})}}},[Bt]),qt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await J_e(n,r);t(t=>{if(t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n)return t;let r=t.selectedSpecSessionId&&i.some(e=>e.id===t.selectedSpecSessionId)?t.selectedSpecSessionId:null;return{...t,specSessions:i,specSessionsError:null,selectedSpecSessionId:r,specSessionDetail:r?t.specSessionDetail:null,specSessionDetailError:r?t.specSessionDetailError:null}})}catch(r){if(!Ye(r)){if(Bt(r))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,specSessions:null,specSessionsError:Z9(r,J9(`specDetail.listError`)),selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null})}}},[Bt]),Jt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await D_e(n,r);t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,projectSummary:i,projectSummaryError:null})}catch(r){if(!Ye(r)){if(Bt(r))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e||t.selectedProjectId!==n?t:{...t,projectSummary:null,projectSummaryError:Z9(r,`Unable to load the project summary.`)})}}},[Bt]),Yt=(0,p.useCallback)(async(e,n,r=!1)=>{Ct(!0),yt(null);try{let[i,a]=await Promise.all([j_e(e,n),r?o9(n):Promise.resolve(null)]),o=At.current;if(o&&o!==e)return;if(_t(i),yt(null),Dt(null),a){let n=a.find(t=>t.id===e);n&&t(t=>t.status!==`authenticated`||t.selectedProjectId!==e?t:{...t,projects:t.projects?.map(t=>t.id===e?{...t,active_target_kind:n.active_target_kind,active_target_bundle_id:n.active_target_bundle_id}:t)??t.projects})}return!0}catch(t){if(!Ye(t)){if(Bt(t))return;let n=At.current;if(n&&n!==e)return;_t(null),yt(Z9(t,`Unable to load project target options.`))}return!1}finally{n?.aborted||Ct(!1)}},[Bt]),Xt=(0,p.useCallback)(e=>{t(t=>t.status===`authenticated`?{...t,projects:t.projects?.map(t=>t.id===e.id?e:t)??t.projects,projectSummary:t.projectSummary?.project.id===e.id?{...t.projectSummary,project:e}:t.projectSummary}:t)},[]),Zt=(0,p.useCallback)(async t=>{if(e.status!==`authenticated`)return;let n=zt.current+1;zt.current=n;try{let r=await T_e(t,e.csrfToken);zt.current===n&&a(r.tool)}catch{}},[e]),Qt=(0,p.useCallback)(async(e,n,r)=>{try{let i=await o9(n),a=r&&i.some(e=>e.id===r)?r:i[0]?.id??null;t(t=>{if(t.status!==`authenticated`||t.csrfToken!==e)return t;let n=!!(t.selectedProjectId&&a&&t.selectedProjectId===a);return{...t,projects:i,selectedProjectId:a,projectError:null,projectSummary:n?t.projectSummary:null,projectSummaryError:n?t.projectSummaryError:null,chatSessions:n?t.chatSessions:null,chatSessionsError:n?t.chatSessionsError:null,selectedChatSessionId:n?t.selectedChatSessionId:null,chatSessionDetail:n?t.chatSessionDetail:null,chatSessionDetailError:n?t.chatSessionDetailError:null,tickets:n?t.tickets:null,ticketsError:n?t.ticketsError:null,selectedBundleId:n?t.selectedBundleId:null,bundleDetail:n?t.bundleDetail:null,bundleDetailError:n?t.bundleDetailError:null,selectedTicketId:n?t.selectedTicketId:null,ticketDetail:n?t.ticketDetail:null,ticketDetailError:n?t.ticketDetailError:null,specSessions:n?t.specSessions:null,specSessionsError:n?t.specSessionsError:null,selectedSpecSessionId:n?t.selectedSpecSessionId:null,specSessionDetail:n?t.specSessionDetail:null,specSessionDetailError:n?t.specSessionDetailError:null}});let o=a?i.find(e=>e.id===a)??null:null;a&&(Jt(e,a,n),o?.active_target_kind===`bundle`&&Yt(a,n),Gt(e,a,n),qt(e,a,n),Ut(e,a,n))}catch(n){if(!Ye(n)){if(Bt(n))return;t(t=>t.status!==`authenticated`||t.csrfToken!==e?t:{...t,projects:t.projects??[],projectError:Z9(n,`Unable to load projects from desktop Archon.`)})}}},[Bt,Gt,Jt,Yt,qt,Ut]),$t=(0,p.useCallback)(async e=>{t({status:`checking`}),r(`connecting`);try{let n=await Eve(e);if(n.authenticated&&n.csrf_token){r(`connecting`),t(Q9(n.csrf_token)),Qt(n.csrf_token,e,n.preferred_project_id);return}t($9())}catch(e){Ye(e)||t({status:`error`,message:Z9(e,`Mobile access is unavailable. Make sure it is still enabled on desktop Archon.`)})}},[Qt]),en=(0,p.useCallback)((e,n,i)=>{r(`connecting`),t(Q9(e)),Qt(e,i,n)},[Qt]);(0,p.useEffect)(()=>{let e=new AbortController;if(window.location.pathname===`/mobile/pair`){let n=Jve();return Yve(),n?(t({status:`pairing`}),Dve(n,e.signal).then(e=>{t({status:`pairing_confirmation`,payload:n,displayCode:e.display_code,expiresAt:e.expires_at,error:null})}).catch(e=>{t({status:`error`,message:Z9(e,`Pairing failed. Regenerate the pairing link from desktop Archon and try again.`)})}),()=>e.abort()):(t({status:`error`,message:`Pairing link is missing required pairing details.`}),()=>e.abort())}return $t(e.signal),()=>e.abort()},[en,$t]),(0,p.useEffect)(()=>{if(e.status!==`authenticated`)return;let t=new AbortController,n=zt.current;return w_e(t.signal).then(e=>{zt.current===n&&a(e.tool)}).catch(e=>{Ye(e)||Bt(e)}),E_e(t.signal).then(e=>s(e.length>0?e:Vr())).catch(e=>{Ye(e)||Bt(e)||s(Vr())}),()=>t.abort()},[e.status,Bt]);let tn=e.status===`authenticated`?e.csrfToken:null,nn=e.status===`authenticated`?e.selectedProjectId:null,rn=e.status===`authenticated`?e.selectedChatSessionId:null,an=e.status===`authenticated`?e.selectedBundleId:null,on=e.status===`authenticated`?e.selectedTicketId:null,sn=e.status===`authenticated`?e.selectedSpecSessionId:null,cn=e.status===`authenticated`?e.projects?.find(t=>t.id===e.selectedProjectId)??null:null,ln=e.status===`authenticated`?e.chatSessionDetail:null,un=e.status===`authenticated`?e.bundleDetail:null,dn=e.status===`authenticated`?e.ticketDetail:null,fn=e.status===`authenticated`?e.specSessionDetail:null,pn=!St&>&&`current_branch`in gt?{status:`ready`,branch:gt.current_branch}:null,mn=!!(ln?.target_available===!1||ln&&St||ln?.target_kind===`repo_root`&&ln.target_branch_snapshot&&!pn||ln&&cn&&!i5({activeProject:cn,activeProjectBranchState:pn,session:ln})),hn=fn?.target_available===!1?fn.target_unavailable_reason??J9(`specDetail.targetUnavailable`):null,gn=!!(fn?.target_kind===`repo_root`&&fn.target_branch_snapshot&&cn?.active_target_kind!==`bundle`),_n=fn?.target_kind===`bundle`&&vt?jb.t(`common:mobileApp.specDetail.targetRefreshError`,{error:vt}):gn&&vt?jb.t(`common:mobileApp.specDetail.targetLoadError`,{error:vt}):null,vn=fn&&St||gn&&!pn&&!_n?J9(`specDetail.targetLoading`):_n,yn=!!(fn&&!hn&&!vn&&!i5({activeProject:cn,activeProjectBranchState:pn,session:fn})),bn=yn&&fn?jb.t(`common:mobileApp.specDetail.targetMismatch`,{sessionTarget:o5(fn),currentTarget:s5({activeProject:cn,activeProjectBranchState:pn})}):null,xn=b9(cn,gt),Sn=St&&(!cn||cn.active_target_kind===`bundle`),Cn=Nve(),wn=ln?.tool??i,Tn=fn?.tool??i,En=ln?.id??null,Dn=ln?.model??``,On=ln?.variant??``,kn=ln?.skills?.join(`\0`)??``,An=fn?.id??null,jn=fn?.model??``,Mn=fn?.variant??``,Nn=fn?.skills?.join(`\0`)??``,Pn=u===`spec`?Tn:u===`tickets`?dn?.tool??i:wn,Fn=z===Pn,In=Fn?F:Kve,Ln=Fn?L:qve,Rn=!!(tn&&nn)&&(!Fn||B),zn=jb.t(`common:mobileApp.agentSettings.loading`),Bn=!!N9(ln?.messages),Vn=!!N9(fn?.messages),Hn=!!N9(dn?.messages),Un=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:Rn?zn:U?`Wait for the chat mode change before sending another prompt.`:ln?.agent_status===`running`?`Stop or wait for the current response before sending another prompt.`:Bn?jb.t(`common:questionSet.waitForResolution`):null,Wn=!!(ln&&qY(ln,Bn)),Gn=e.status!==`authenticated`||!e.selectedProjectId?`Choose a project before sending a prompt.`:Rn?zn:hn||vn||bn||(we?`Wait for the spec mode change before sending another prompt.`:fn?.agent_status===`running`?`Stop or wait for the current response before sending another prompt.`:Vn?jb.t(`common:questionSet.waitForResolution`):null),Kn=!Cn&&(u===`tickets`&&(_&&!!on||h&&!!an)||u===`chats`&&y||u===`spec`&&ue);(0,p.useEffect)(()=>{At.current=nn},[nn]),(0,p.useEffect)(()=>{nn||(_t(null),yt(null),Dt(null),xt(!1),Ct(!1),Tt(!1))},[nn]),(0,p.useEffect)(()=>{jt.current=rn},[rn]),(0,p.useEffect)(()=>{Mt.current=an},[an]),(0,p.useEffect)(()=>{Nt.current=on},[on]),(0,p.useEffect)(()=>{Pt.current=sn},[sn]),(0,p.useEffect)(()=>{if(!tn||!nn){I([]),R([]),ee(null),V(!1);return}let e=new AbortController;return V(!0),Promise.all([cve(Pn,e.signal),Pn===`opencode`?lve(Pn,nn,e.signal):Promise.resolve([])]).then(([t,n])=>{e.signal.aborted||(I(t),R(n),ee(Pn))}).catch(e=>{Bt(e)||Ye(e)||(I([]),R([]),ee(Pn))}).finally(()=>{e.signal.aborted||V(!1)}),()=>e.abort()},[Pn,tn,Bt,nn]),(0,p.useEffect)(()=>{let e=vw(cn?.helper_models,wn);A(En?Dn:e.model??(wn===`opencode`?cn?.helper_model:null)??``),M(En?On:e.variant??(wn===`opencode`?cn?.helper_variant:null)??``),P(kn?kn.split(`\0`):[])},[wn,Dn,En,kn,On,cn?.helper_model,cn?.helper_models,cn?.helper_variant,nn]),(0,p.useEffect)(()=>{ln?.mode&&O(ln.mode)},[ln?.id,ln?.mode]),(0,p.useEffect)(()=>{if(ln)return;let e=In.find(e=>e.id===k)??null;M(t=>e?e.variants.includes(t)?t:``:t)},[In,ln,k]),(0,p.useEffect)(()=>{K(``),$e(null),Ge(dn?.model??``),Je(dn?.variant??``),Xe(dn?.skills??[])},[dn?.id,dn?.model,dn?.skills,dn?.variant]),(0,p.useEffect)(()=>{rt(``),st(null)},[un?.bundle.id]),(0,p.useEffect)(()=>{let e=vw(cn?.helper_models,Tn);_e(An?jn:e.model??(Tn===`opencode`?cn?.helper_model:null)??``),ye(An?Mn:e.variant??(Tn===`opencode`?cn?.helper_variant:null)??``),xe(Nn?Nn.split(`\0`):[])},[cn?.helper_model,cn?.helper_models,cn?.helper_variant,nn,jn,An,Nn,Mn,Tn]),(0,p.useEffect)(()=>{fn?.mode&&he(fn.mode)},[fn?.id,fn?.mode]),(0,p.useEffect)(()=>{if(fn)return;let e=In.find(e=>e.id===ge)??null;ye(t=>e?e.variants.includes(t)?t:``:t)},[In,fn,ge]),(0,p.useEffect)(()=>{let e=In.find(e=>e.id===We)??null;Je(t=>e?e.variants.includes(t)?t:``:t)},[In,We]),(0,p.useEffect)(()=>{if(!tn)return;let e=Ave();l(e),r(`connecting`);let t=()=>{let e=At.current,t=jt.current,n=Mt.current,r=Nt.current,i=Pt.current;Qt(tn,void 0,e),e&&(Jt(tn,e),Gt(tn,e),qt(tn,e),Ut(tn,e)),e&&t&&Wt(tn,e,t),e&&n&&Ht(tn,e,n),e&&r&&Vt(tn,e,r),e&&i&&Kt(tn,e,i)},n=()=>{r(`connected`),t()},i=()=>{r(`reconnecting`)},o=()=>{r(`unavailable`)},s=()=>{Qt(tn,void 0,At.current)},c=(e=null)=>{let t=At.current;t&&(e?.project_id&&e.project_id!==t||Jt(tn,t))},u=(e=null)=>{let t=At.current;t&&(e?.project_id&&e.project_id!==t||Gt(tn,t))},d=(e=null)=>{let t=At.current;t&&(e?.project_id&&e.project_id!==t||Ut(tn,t))},f=(e=null)=>{let t=At.current,n=jt.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||Wt(tn,t,n)},p=(e=null)=>{let t=At.current,n=Nt.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||Vt(tn,t,n)},m=(e=null)=>{let t=At.current,n=Mt.current;!t||!n||e?.project_id&&e.project_id!==t||Ht(tn,t,n)},h=(e=null)=>{let t=At.current;t&&(e?.project_id&&e.project_id!==t||qt(tn,t))},g=(e=null)=>{let t=At.current,n=Pt.current;!t||!n||e?.project_id&&e.project_id!==t||e?.id&&e.id!==n||Kt(tn,t,n)},_=e=>{e.tool!==`claude`&&e.tool!==`opencode`||(zt.current+=1,a(e.tool))};return e.on(`connect`,n),e.on(`disconnect`,i),e.on(`connect_error`,o),e.on(`tool:updated`,_),e.on(`ticket:created`,c),e.on(`ticket:created`,d),e.on(`ticket:updated`,c),e.on(`ticket:updated`,d),e.on(`ticket:updated`,m),e.on(`ticket:updated`,p),e.on(`ticket:deleted`,s),e.on(`ticket:deleted`,d),e.on(`ticket:deleted`,m),e.on(`ticket-dependency:created`,c),e.on(`ticket-dependency:deleted`,c),e.on(`chat-session:created`,u),e.on(`chat-session:updated`,u),e.on(`chat-session:updated`,f),e.on(`chat-session:deleted`,u),e.on(`spec-session:created`,h),e.on(`spec-session:updated`,h),e.on(`spec-session:updated`,g),e.on(`spec-session:deleted`,h),()=>{e.off(`connect`,n),e.off(`disconnect`,i),e.off(`connect_error`,o),e.off(`tool:updated`,_),e.off(`ticket:created`,c),e.off(`ticket:created`,d),e.off(`ticket:updated`,c),e.off(`ticket:updated`,d),e.off(`ticket:updated`,m),e.off(`ticket:updated`,p),e.off(`ticket:deleted`,s),e.off(`ticket:deleted`,d),e.off(`ticket:deleted`,m),e.off(`ticket-dependency:created`,c),e.off(`ticket-dependency:deleted`,c),e.off(`chat-session:created`,u),e.off(`chat-session:updated`,u),e.off(`chat-session:updated`,f),e.off(`chat-session:deleted`,u),e.off(`spec-session:created`,h),e.off(`spec-session:updated`,h),e.off(`spec-session:updated`,g),e.off(`spec-session:deleted`,h),e.disconnect(),l(null)}},[tn,Ht,Wt,Gt,Jt,Qt,Kt,qt,Vt,Ut]),(0,p.useEffect)(()=>{an||g(!1)},[an]),(0,p.useEffect)(()=>{on||v(!1)},[on]);let qn=()=>{$t()},Jn=e=>{d(e),g(!1),v(!1),b(!1),de(!1),kt(null)},Yn=()=>{m(!0)},Xn=()=>{e.status!==`authenticated`||!e.selectedProjectId||(Dt(null),xt(!0),!gt&&!St&&Yt(e.selectedProjectId))},Zn=()=>{e.status===`authenticated`&&(S(!0),kve(e.csrfToken).then(()=>t($9())).catch(e=>{Bt(e)||t({status:`error`,message:Z9(e,`Logout failed. Mobile access may have already been revoked from desktop Archon.`)})}).finally(()=>S(!1)))},Qn=()=>{if(e.status!==`pairing_confirmation`||C)return;let n=e.payload;w(!0),t({...e,error:null}),Ove(n).then(e=>{if(e.authenticated&&e.csrf_token){window.history.replaceState({},``,`/mobile`),en(e.csrf_token,e.preferred_project_id);return}t($9())}).catch(e=>{t(t=>t.status===`pairing_confirmation`?{...t,error:Z9(e,`Pairing failed. Regenerate the pairing link from desktop Archon and try again.`)}:t)}).finally(()=>w(!1))},$n=()=>{window.history.replaceState({},``,`/mobile`),t($9())},er=()=>{e.status===`authenticated`&&(t({...e,projects:null,projectError:null}),Qt(e.csrfToken))},tr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,projectSummary:null,projectSummaryError:null}),Jt(e.csrfToken,e.selectedProjectId))},nr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(_t(null),yt(null),Dt(null),Yt(e.selectedProjectId))},rr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),Gt(e.csrfToken,e.selectedProjectId))},ir=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||(t({...e,chatSessionDetail:null,chatSessionDetailError:null}),Wt(e.csrfToken,e.selectedProjectId,e.selectedChatSessionId))},ar=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,tickets:null,ticketsError:null,selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),Ut(e.csrfToken,e.selectedProjectId))},or=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||(t({...e,ticketDetail:null,ticketDetailError:null}),Vt(e.csrfToken,e.selectedProjectId,e.selectedTicketId))},sr=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||(t({...e,bundleDetail:null,bundleDetailError:null}),Ht(e.csrfToken,e.selectedProjectId,e.selectedBundleId))},cr=n=>{if(e.status!==`authenticated`)return;let r=e.projects?.find(e=>e.id===n)??null;At.current=n,t({...e,selectedProjectId:n,projectSummary:null,projectSummaryError:null,chatSessions:null,chatSessionsError:null,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null,tickets:null,ticketsError:null,selectedBundleId:null,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),Le(null),ze(null),Be(null),He(null),se(null),He(null),je(null),st(null),_t(null),yt(null),Dt(null),m(!1),xt(!1),g(!1),v(!1),b(!1),de(!1),ht(`transcript`),kt(null),d(`overview`),Jt(e.csrfToken,n),r?.active_target_kind===`bundle`&&Yt(n),Gt(e.csrfToken,n),qt(e.csrfToken,n),Ut(e.csrfToken,n)},lr=async t=>{if(!(e.status!==`authenticated`||!e.selectedProjectId)){Tt(!0),Dt(null);try{Xt(await f9(e.selectedProjectId,e.csrfToken,{kind:`bundle`,bundle_id:t})),xt(!1),Jt(e.csrfToken,e.selectedProjectId),await Yt(e.selectedProjectId)}catch(e){if(Bt(e))return;Dt(Z9(e,J9(`specDetail.updateTargetError`)))}finally{Tt(!1)}}},ur=async(t,n={})=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;Tt(!0),Dt(null);let r=r=>f9(e.selectedProjectId??``,e.csrfToken,{kind:`repo_root`,...t?{branch:t}:{},...n.createBranch===!1?{create_branch:!1}:{},...r?{confirm_dirty_switch:!0}:{}});try{let t;try{t=await r(n.confirmDirtySwitch===!0)}catch(e){if(!n.confirmDirtySwitch&&e instanceof Ke&&e.status===409&&e.message===Y9){if(!window.confirm(`${Y9}\n\nSwitch anyway?`))return;t=await r(!0)}else throw e}Xt(t),xt(!1),Jt(e.csrfToken,e.selectedProjectId),await Yt(e.selectedProjectId)}catch(e){if(Bt(e))return;Dt(Z9(e,J9(`specDetail.updateTargetError`)))}finally{Tt(!1)}},dr=_n?nr:()=>{if(!(!fn||fn.target_available===!1)){if(fn.target_kind===`bundle`){fn.target_bundle_id&&lr(fn.target_bundle_id);return}ur(fn.target_branch_snapshot??null,{createBranch:!1})}},fr=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:n,chatSessionDetail:null,chatSessionDetailError:null}),se(null),lt(e=>e+1),b(!0),d(`chats`),Wt(e.csrfToken,e.selectedProjectId,n),Yt(e.selectedProjectId,void 0,!0))},pr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedChatSessionId:null,chatSessionDetail:null,chatSessionDetailError:null}),se(null),E(``),lt(e=>e+1),b(!0),d(`chats`))},mr=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedBundleId:n,bundleDetail:null,bundleDetailError:null,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),Le(null),ze(null),He(null),st(null),kt(null),ht(`transcript`),dt(e=>e+1),g(!0),v(!1),d(`tickets`),Ht(e.csrfToken,e.selectedProjectId,n))},hr=(n,r)=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedTicketId:n,ticketDetail:null,ticketDetailError:null}),kt(r),pt(e=>e+1),g(r!==null),v(!0),d(`tickets`),Vt(e.csrfToken,e.selectedProjectId,n))},gr=()=>{b(!1)},_r=async n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return null;if(!e.chatSessionDetail||!e.selectedChatSessionId)return O(n),null;if(e.chatSessionDetail.mode===n||U||Bn)return null;let r=e.selectedProjectId,i=e.selectedChatSessionId,a=e.csrfToken;ne(!0),se(null);try{let e=await G_e(r,i,a,{mode:n});return O(e.mode),t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedChatSessionId!==i)return t;let n=t.chatSessions?.map(t=>t.id===e.id?e:t)??t.chatSessions;return{...t,chatSessions:n,chatSessionDetail:e,chatSessionDetailError:null}}),e}catch(e){return Bt(e)||se(Z9(e,`Unable to update the chat mode right now.`)),null}finally{ne(!1)}},vr=()=>{if(e.status===`authenticated`&&Ot&&e.selectedBundleId===Ot){t({...e,selectedTicketId:null,ticketDetail:null,ticketDetailError:null}),v(!1),g(!0),kt(null);return}kt(null),v(!1)},yr=()=>{g(!1)},br=e=>{let t=In.find(t=>t.id===e)??null;A(e),M(e=>t&&t.variants.includes(e)?e:``)},xr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),wr())},Sr=(e,n,r,i)=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==e||i!==void 0&&Ft.current!==i?t:{...t,chatSessions:t.chatSessions?.map(e=>e.id===r.id?r:e)??t.chatSessions,chatSessionDetail:t.selectedChatSessionId===n?r:t.chatSessionDetail,chatSessionDetailError:t.selectedChatSessionId===n?null:t.chatSessionDetailError})},Cr=(n,r,i=e.status===`authenticated`?e.chatSessionDetail:null)=>{if(e.status!==`authenticated`||!e.selectedProjectId||te||Un)return Promise.resolve(!1);let a=n.trim();if(!a)return Promise.resolve(!1);let o=e.selectedProjectId,s=i?.id??null,c=e.csrfToken,l=k||null,u=k&&j?j:null,d=wn===`opencode`?N:[],f=performance.now();Lt.current+=1;let p=`mobile-chat:${Lt.current}`;i&&le({parentType:`chat`,parentId:i.id,turnKey:p,startedAt:f}),se(null),H(!0);let m=e=>U_e(o,e.id,c,{instruction:a,tool:e.tool,model:l,variant:u,skills:d});return(i?m(i):H_e(o,c,{mode:D,tool:wn,model:l,variant:u,skills:d}).then(m)).then(e=>(le({parentType:`chat`,parentId:e.id,turnKey:p,startedAt:f}),r&&E(``),b(!0),t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==o)return t;let n=t.chatSessions??[],r=n.some(t=>t.id===e.id)?n.map(t=>t.id===e.id?e:t):[e,...n];return{...t,chatSessions:r,selectedChatSessionId:e.id,chatSessionDetail:e,chatSessionDetailError:null}}),Gt(c,o),!0)).catch(async e=>{le(e=>e?.turnKey===p?null:e);let t=qe(e,`chat_session`);return t&&s?Sr(o,s,t):e instanceof Ke&&e.status===409&&s&&await Wt(c,o,s),Bt(e)||se(Z9(e,`Unable to send the chat prompt.`)),!1}).finally(()=>{H(!1)})},wr=()=>{T.trim()&&Cr(T,!0)},Tr=async()=>{let t=e.status===`authenticated`?e.chatSessionDetail:null;if(!(!t||!qY(t,Bn)||Rt.current||te||Un)){Rt.current=!0;try{let e=await _r(`build`);if(!e)return;await Cr(KY,!1,e)}finally{Rt.current=!1}}},Er=async(n,r)=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId)throw Error(`Chat question set is unavailable.`);let i=e.selectedProjectId,a=e.selectedChatSessionId,o=e.csrfToken,s=WJ({parentType:`chat`,parentId:a,setId:r.set_id});se(null);try{let e=await W_e(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedChatSessionId!==a?t:{...t,chatSessions:t.chatSessions?.map(t=>t.id===e.id?e:t)??t.chatSessions,chatSessionDetail:e,chatSessionDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){KJ(s);let t=e.data&&typeof e.data==`object`&&`chat_session`in e.data?e.data.chat_session:null;t?Sr(i,a,t):await Wt(o,i,a)}throw Bt(e)||se(Z9(e,`Unable to resolve the chat questions.`)),e}},Dr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||re)return;let t=e.selectedProjectId,n=e.selectedChatSessionId;se(null),ie(n),le(e=>e?.parentId===n?null:e),K_e(t,n,e.csrfToken).then(()=>Wt(e.csrfToken,t,n)).catch(e=>{Bt(e)||se(Z9(e,`Unable to stop the chat response.`))}).finally(()=>ie(null))},Or=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedChatSessionId||ae||mn)return;let t=e.selectedProjectId,n=e.selectedChatSessionId,r=e.csrfToken,i=Ft.current,a=performance.now();se(null),oe(n);let o=q_e(t,n,r);Lt.current+=1;let s={parentType:`chat`,parentId:n,turnKey:`mobile-chat:${Lt.current}`,startedAt:a};le(s),o.then(e=>{Sr(t,n,e,i)}).catch(async e=>{le(e=>e?.turnKey===s.turnKey?null:e);let a=qe(e,`chat_session`);a?Sr(t,n,a,i):e instanceof Ke&&e.status===409&&await Wt(r,t,n),Bt(e)||se(Z9(e,J9(`chatDetail.resumeError`)))}).finally(()=>oe(e=>e===n?null:e))},kr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,specSessions:null,specSessionsError:null,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),qt(e.csrfToken,e.selectedProjectId))},Ar=()=>{e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||(t({...e,specSessionDetail:null,specSessionDetailError:null}),Kt(e.csrfToken,e.selectedProjectId,e.selectedSpecSessionId))},jr=n=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:n,specSessionDetail:null,specSessionDetailError:null}),je(null),Dt(null),Fe(e=>e+1),de(!0),d(`spec`),Kt(e.csrfToken,e.selectedProjectId,n),Yt(e.selectedProjectId,void 0,!0))},Mr=()=>{e.status!==`authenticated`||!e.selectedProjectId||(t({...e,selectedSpecSessionId:null,specSessionDetail:null,specSessionDetailError:null}),je(null),pe(``),Fe(e=>e+1),de(!0),d(`spec`))},Nr=()=>{de(!1)},Pr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId)return;if(!e.specSessionDetail||!e.selectedSpecSessionId){he(n);return}if(e.specSessionDetail.mode===n||we||Vn)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken;Te(!0),je(null),Q_e(r,i,a,{mode:n}).then(e=>{he(e.mode),t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedSpecSessionId!==i)return t;let n=t.specSessions?.map(t=>t.id===e.id?e:t)??t.specSessions;return{...t,specSessions:n,specSessionDetail:e,specSessionDetailError:null}})}).catch(e=>{Bt(e)||je(Z9(e,J9(`specDetail.modeError`)))}).finally(()=>Te(!1))},Fr=e=>{let t=In.find(t=>t.id===e)??null;_e(e),ye(e=>t&&t.variants.includes(e)?e:``)},Ir=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Rr())},Lr=(e,n,r,i)=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==e||i!==void 0&&It.current!==i?t:{...t,specSessions:t.specSessions?.map(e=>e.id===r.id?r:e)??t.specSessions,specSessionDetail:t.selectedSpecSessionId===n?r:t.specSessionDetail,specSessionDetailError:t.selectedSpecSessionId===n?null:t.specSessionDetailError})},Rr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||Se||Gn)return;let n=fe.trim();if(!n)return;let r=e.selectedProjectId,i=e.specSessionDetail?.id??null,a=e.csrfToken,o=ge||null,s=ge&&ve?ve:null,c=Tn===`opencode`?be:[],l=performance.now();Lt.current+=1;let u=`mobile-spec:${Lt.current}`;e.specSessionDetail&&Ne({parentType:`spec`,parentId:e.specSessionDetail.id,turnKey:u,startedAt:l}),je(null),Ce(!0);let d=e=>c9(r,e.id,a,{instruction:n,tool:e.tool,model:o,variant:s,skills:c});(e.specSessionDetail?d(e.specSessionDetail):X_e(r,a,{mode:me,tool:Tn,model:o,variant:s,skills:c}).then(d)).then(e=>{Ne({parentType:`spec`,parentId:e.id,turnKey:u,startedAt:l}),pe(``),de(!0),t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==r)return t;let n=t.specSessions??[],i=n.some(t=>t.id===e.id)?n.map(t=>t.id===e.id?e:t):[e,...n];return{...t,specSessions:i,selectedSpecSessionId:e.id,specSessionDetail:e,specSessionDetailError:null}}),qt(a,r)}).catch(e=>{Ne(e=>e?.turnKey===u?null:e);let t=e instanceof Ke&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&i&&Lr(r,i,t),!Bt(e)&&je(Z9(e,J9(`specDetail.sendError`)))}).finally(()=>Ce(!1))},zr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||Se)return;let r=e.selectedProjectId,i=e.selectedSpecSessionId,a=e.csrfToken,o=e.specSessionDetail?.tool??Tn,s=ge||null,c=ge&&ve?ve:null,l=Tn===`opencode`?be:[],u=performance.now();Lt.current+=1;let d=`mobile-spec:${Lt.current}`;Ne({parentType:`spec`,parentId:i,turnKey:d,startedAt:u}),je(null),Ce(!0),c9(r,i,a,{instruction:n,tool:o,model:s,variant:c,skills:l}).then(e=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedSpecSessionId!==i?t:{...t,specSessionDetail:e,specSessionDetailError:null})}).catch(e=>{Ne(e=>e?.turnKey===d?null:e);let t=e instanceof Ke&&e.status===409&&e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t&&Lr(r,i,t),!Bt(e)&&je(Z9(e,J9(`specDetail.sendError`)))}).finally(()=>Ce(!1))},Br=async(n,r)=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId)throw Error(`Spec question set is unavailable.`);let i=e.selectedProjectId,a=e.selectedSpecSessionId,o=e.csrfToken,s=WJ({parentType:`spec`,parentId:a,setId:r.set_id});je(null);try{let e=await Z_e(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedSpecSessionId!==a?t:{...t,specSessions:t.specSessions?.map(t=>t.id===e.id?e:t)??t.specSessions,specSessionDetail:e,specSessionDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){KJ(s);let t=e.data&&typeof e.data==`object`&&`spec_session`in e.data?e.data.spec_session:null;t?Lr(i,a,t):await Kt(o,i,a)}throw Bt(e)||je(Z9(e,`Unable to resolve the spec questions.`)),e}},Hr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||Ee)return;let t=e.selectedProjectId,n=e.selectedSpecSessionId;je(null),De(n),Ne(e=>e?.parentId===n?null:e),$_e(t,n,e.csrfToken).then(()=>Kt(e.csrfToken,t,n)).catch(e=>{Bt(e)||je(Z9(e,J9(`specDetail.stopError`)))}).finally(()=>De(null))},Ur=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedSpecSessionId||Oe)return;let t=e.selectedProjectId,n=e.selectedSpecSessionId,r=e.csrfToken,i=It.current,a=performance.now();je(null),ke(n);let o=eve(t,n,r);Lt.current+=1;let s={parentType:`spec`,parentId:n,turnKey:`mobile-spec:${Lt.current}`,startedAt:a};Ne(s),o.then(e=>{Lr(t,n,e,i)}).catch(async e=>{Ne(e=>e?.turnKey===s.turnKey?null:e);let a=qe(e,`spec_session`);a?Lr(t,n,a,i):e instanceof Ke&&e.status===409&&await Kt(r,t,n),Bt(e)||je(Z9(e,J9(`specDetail.resumeError`)))}).finally(()=>ke(e=>e===n?null:e))},Wr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||G||(n===`stop-run`||n===`pause-build`)&&!window.confirm(`Stop this ticket action on the desktop machine?`))return;let r=e.selectedProjectId,i=e.selectedTicketId,a=e.csrfToken,o=n===`build`?l9(r,i,a,`build`):n===`review`?l9(r,i,a,`review`):n===`run`?tve(r,i,a):n===`stop-run`?nve(r,i,a):n===`pause-build`?u9(r,i,a):d9(r,i,a);Be(n),He(null),o.then(e=>{t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedTicketId!==i)return t;let n=t.tickets?.map(t=>t.id===e.id?e:t)??t.tickets;return{...t,tickets:n,ticketDetail:e,ticketDetailError:null}}),Jt(a,r),Ut(a,r),Vt(a,r,i)}).catch(e=>{Bt(e)||He(Z9(e,`Unable to update this ticket from mobile.`))}).finally(()=>Be(null))},Gr=n=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||Ie)return;let r=e.selectedProjectId,i=e.selectedBundleId,a=e.csrfToken,o=e.bundleDetail,{runningBuildTicketId:s,resumableBuildTicketId:c}=M9(o);if(n===`pause-build`&&!window.confirm(`Pause this bundle build on the desktop machine?`))return;let l=e=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedBundleId!==i?t:{...t,tickets:X9(t.tickets,e),bundleDetail:e,bundleDetailError:null})},u=e=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedBundleId!==i?t:{...t,tickets:t.tickets?.map(t=>t.id===e.id?e:t)??t.tickets,bundleDetail:t.bundleDetail?{...t.bundleDetail,tickets:t.bundleDetail.tickets.map(t=>t.id===e.id?e:t)}:t.bundleDetail,bundleDetailError:null})},d=n===`build`?B_e(r,i,a):n===`review`?V_e(r,i,a):n===`pause-build`?s?u9(r,s,a):null:c?d9(r,c,a):null;d&&(Le(n),ze(null),d.then(e=>{`tickets`in e?l(e):u(e),Jt(a,r),Ut(a,r),Ht(a,r,i)}).catch(e=>{Bt(e)||ze(Z9(e,`Unable to update this bundle from mobile.`))}).finally(()=>Le(null)))},Kr=e=>{let t=In.find(t=>t.id===e)??null;Ge(e),Je(e=>t&&t.variants.includes(e)?e:``)},qr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Jr())},Jr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId||!e.ticketDetail||Ze||Hn)return;let n=Ue.trim();if(!n)return;let r=e.selectedProjectId,i=e.ticketDetail,a=e.csrfToken,o=c3(i,{model:We||null,variant:q||null,skills:J});Lt.current+=1;let s={parentType:`ticket`,parentId:i.id,turnKey:`mobile-ticket:${Lt.current}`,startedAt:performance.now()};tt(s);let c=()=>i.state===`plan`?ive(r,i.id,a,n):ove(r,i.id,a,n),l=e=>{t(t=>{if(t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedTicketId!==i.id)return t;let n=t.tickets?.map(t=>t.id===e.id?e:t)??t.tickets;return{...t,tickets:n,ticketDetail:e,ticketDetailError:null}})};Y(!0),$e(null),(async()=>{o.shouldPersist&&l(await rve(r,i.id,a,{model:o.model,variant:o.variant,skills:o.skills})),l(await c()),K(``),Ut(a,r),Vt(a,r,i.id)})().catch(async e=>{tt(e=>e?.turnKey===s.turnKey?null:e);let t=qe(e,`ticket`);t?l(t):e instanceof Ke&&e.status===409&&await Vt(a,r,i.id),!Bt(e)&&$e(Z9(e,`Unable to send the ticket follow-up.`))}).finally(()=>Y(!1))},Yr=async(n,r)=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedTicketId)throw Error(`Ticket question set is unavailable.`);let i=e.selectedProjectId,a=e.selectedTicketId,o=e.csrfToken,s=WJ({parentType:`ticket`,parentId:a,setId:r.set_id});$e(null);try{let e=await ave(i,a,n,o,r);t(t=>t.status!==`authenticated`||t.selectedProjectId!==i||t.selectedTicketId!==a?t:{...t,tickets:t.tickets?.map(t=>t.id===e.id?e:t)??t.tickets,ticketDetail:e,ticketDetailError:null})}catch(e){if(e instanceof Ke&&e.status===409){KJ(s);let n=e.data&&typeof e.data==`object`&&`ticket`in e.data?e.data.ticket:null;n?t(e=>e.status===`authenticated`&&e.selectedTicketId===a?{...e,ticketDetail:n}:e):await Vt(o,i,a)}throw Bt(e)||$e(Z9(e,`Unable to resolve the ticket questions.`)),e}},Xr=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Zr())},Zr=()=>{if(e.status!==`authenticated`||!e.selectedProjectId||!e.selectedBundleId||!e.bundleDetail||it)return;let n=nt.trim();if(!n)return;let r=e.selectedProjectId,i=e.selectedBundleId,a=e.csrfToken,o=e=>{t(t=>t.status!==`authenticated`||t.selectedProjectId!==r||t.selectedBundleId!==i?t:{...t,tickets:X9(t.tickets,e),bundleDetail:e,bundleDetailError:null})};at(!0),st(null),sve(r,i,a,n).then(e=>{o(e),rt(``),Ut(a,r),Ht(a,r,i)}).catch(e=>{Bt(e)||st(Z9(e,`Unable to send the bundle follow-up.`))}).finally(()=>at(!1))},Qr=(0,p.useCallback)(async(e,t,n)=>{try{return await I_e(t??``,e,n)}catch(e){throw Bt(e),e}},[Bt]),$r=(0,p.useCallback)(async(e,t,n)=>{try{return await L_e(t??``,e,n)}catch(e){throw Bt(e),e}},[Bt]),ei=(0,p.useCallback)(async(e,t,n)=>{try{return await R_e(t??``,e,n)}catch(e){throw Bt(e),e}},[Bt]);return e.status===`checking`?(0,X.jsx)(_9,{title:`Checking mobile session`,description:`Archon is validating this browser before showing project controls.`}):e.status===`pairing`?(0,X.jsx)(_9,{title:`Checking pairing link`,description:`Keep this page open while Archon verifies the one-time pairing link.`}):e.status===`pairing_confirmation`?(0,X.jsxs)(_9,{title:`Compare pairing code`,description:`Confirm this code matches the desktop dialog before pairing this phone.`,children:[(0,X.jsx)(gC,{className:`border-primary/25 bg-primary/10 shadow-none`,children:(0,X.jsxs)(xC,{className:`space-y-2 pt-5 text-center`,children:[(0,X.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-foreground`,children:`Verification code`}),(0,X.jsx)(`div`,{className:`font-mono text-3xl font-semibold tracking-[0.18em] text-foreground`,children:e.displayCode}),(0,X.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Expires at `,Xve(e.expiresAt)]})]})}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`If this code does not match the desktop dialog, cancel and regenerate the pairing link from desktop Archon.`}),e.error?(0,X.jsx)(`p`,{className:`text-sm text-red-200`,children:e.error}):null,(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,X.jsx)(Q,{size:`lg`,disabled:C,onClick:Qn,children:C?`Pairing...`:`Pair this phone`}),(0,X.jsx)(Q,{variant:`outline`,size:`lg`,disabled:C,onClick:$n,children:`Cancel`})]})]}):e.status===`unauthenticated`?(0,X.jsx)(_9,{title:e.reason===`session_revoked`?`Mobile session revoked`:`Pairing required`,description:e.reason===`session_revoked`?`This mobile session is no longer valid. Scan the QR code or open the pairing link from desktop Archon to continue.`:`This browser is not paired. Scan the QR code or open the pairing link from desktop Archon.`,children:(0,X.jsx)(Q,{onClick:qn,children:`Retry`})}):e.status===`error`?(0,X.jsx)(_9,{title:`Mobile access unavailable`,description:e.message,children:(0,X.jsx)(Q,{onClick:qn,children:`Retry`})}):(0,X.jsx)(vq,{socket:c??void 0,fetchTicketRuns:Qr,fetchChatRuns:$r,fetchSpecRuns:ei,children:(0,X.jsxs)(`main`,{className:Z(`bg-background text-foreground`,Kn?`flex h-[100dvh] flex-col overflow-hidden`:`min-h-screen`),children:[(0,X.jsx)(Sve,{open:f,projects:e.projects,selectedProjectId:e.selectedProjectId,error:e.projectError,onOpenChange:m,onSelectProject:cr,onRetry:er}),(0,X.jsx)(Cve,{open:bt,project:cn,targetOptions:gt,error:Et??vt,isLoading:St,isSubmitting:wt,onOpenChange:xt,onRetry:nr,onSelectBundle:e=>{lr(e)},onSelectRepoRoot:(e,t)=>{ur(e,t)}}),(0,X.jsx)(_ve,{activeTool:i,agents:o,selectedProject:cn,targetLabel:xn,isTargetLoading:Sn,isTargetDisabled:!nn,connectionState:n,onOpenProjects:Yn,onOpenTargetSelector:Xn,onToolChange:e=>{Zt(e)}}),Kn?(0,X.jsxs)(`div`,{className:`mx-auto flex min-h-0 w-full max-w-6xl flex-1 flex-col overflow-hidden px-3 py-3 sm:px-4`,children:[u===`tickets`?(0,X.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:_&&e.selectedTicketId?(0,X.jsx)(q9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:ft,error:e.ticketDetailError,actionState:G,actionError:Ve,followUpPrompt:Ue,followUpSelectedModel:We,followUpSelectedVariant:q,followUpSelectedSkills:J,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSendingFollowUp:Ze,liveResponseTiming:dn?.agent_status===`running`&&et?.parentId===dn.id?et:null,followUpError:Qe,onBack:vr,onRetry:or,onAction:Wr,onFollowUpPromptChange:K,onFollowUpModelChange:Kr,onFollowUpVariantChange:Je,onFollowUpSkillsChange:Xe,onFollowUpKeyDown:qr,onFollowUpSubmit:Jr,onResolveQuestionSet:Yr,isLargeScreen:!1}):(0,X.jsx)(U9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:ut,mobileDetailView:mt,error:e.bundleDetailError,actionState:Ie,actionError:Re,followUpPrompt:nt,isSendingFollowUp:it,followUpError:ot,availableModels:In,onBack:yr,onRetry:sr,onAction:Gr,onDetailViewChange:ht,onSelectTicket:hr,onFollowUpPromptChange:rt,onFollowUpKeyDown:Xr,onFollowUpSubmit:Zr,isLargeScreen:!1})}):null,u===`chats`?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(W9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:ct,error:e.chatSessionDetailError,isStopping:re===e.selectedChatSessionId,isResuming:ae===e.selectedChatSessionId,isResumeDisabled:ae!==null||te||U||mn,composerMode:e.chatSessionDetail?.mode??D,composerTool:wn,prompt:T,selectedModel:k,selectedVariant:j,selectedSkills:N,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSending:te,liveResponseTiming:ln?.agent_status===`running`&&ce?.parentId===ln.id?ce:null,isUpdatingMode:U,showStartBuilding:Wn,composerDisabledReason:Un,onBack:gr,onRetry:ir,onStop:Dr,onResume:Or,onModeChange:_r,onStartBuilding:Tr,onPromptChange:E,onModelChange:br,onVariantChange:M,onSkillsChange:P,onPromptKeyDown:xr,onSubmit:wr,onResolveQuestionSet:Er,isLargeScreen:!1}),W?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:W}):null]}):null,u===`spec`?(0,X.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,X.jsx)(K9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:Pe,error:e.specSessionDetailError,isStopping:Ee===e.selectedSpecSessionId,isResuming:Oe===e.selectedSpecSessionId,isResumeDisabled:Oe!==null||Se||we||!!(hn||vn||bn),composerMode:e.specSessionDetail?.mode??me,composerTool:Tn,prompt:fe,selectedModel:ge,selectedVariant:ve,selectedSkills:be,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSending:Se,liveResponseTiming:fn?.agent_status===`running`&&Me?.parentId===fn.id?Me:null,isUpdatingMode:we,composerDisabledReason:Gn,targetWarning:hn??vn??bn,targetActionLabel:_n?J9(`specDetail.retryTarget`):yn&&fn?jb.t(`common:mobileApp.specDetail.switchBack`,{target:o5(fn)}):null,targetActionError:Et,isRestoringTarget:wt,onBack:Nr,onRetry:Ar,onStop:Hr,onResume:Ur,onModeChange:Pr,onPromptChange:pe,onModelChange:Fr,onVariantChange:ye,onSkillsChange:xe,onPromptKeyDown:Ir,onSubmit:Rr,onSubmitAnswer:zr,onResolveQuestionSet:Br,onRestoreTarget:dr,isLargeScreen:!1}),Ae?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:Ae}):null]}):null]}):(0,X.jsx)(`div`,{className:`mx-auto w-full max-w-6xl px-3 py-3 pb-[calc(env(safe-area-inset-bottom)+5rem)] sm:px-4 lg:flex lg:min-h-[calc(100dvh-4.5rem)] lg:flex-col lg:overflow-hidden lg:pb-4`,children:(0,X.jsxs)(`div`,{className:`space-y-3 lg:flex lg:min-h-0 lg:flex-1 lg:flex-col`,children:[(0,X.jsx)(gve,{status:n,onRetry:qn}),u===`overview`?(0,X.jsx)(`div`,{className:`space-y-3 lg:flex lg:min-h-0 lg:flex-1 lg:flex-col`,children:e.projectError?(0,X.jsx)(v9,{title:`Projects unavailable`,description:e.projectError,action:(0,X.jsx)(Q,{variant:`warning`,onClick:er,children:`Retry projects`})}):e.selectedProjectId&&!e.projectSummary&&!e.projectSummaryError?(0,X.jsx)(Pve,{}):(0,X.jsxs)(X.Fragment,{children:[e.selectedProjectId&&(0,X.jsx)(jve,{projectId:e.selectedProjectId,csrfToken:e.csrfToken,socket:c,initialRequests:e.projectSummary?.pending_approval_requests??Gve,onRequestError:Bt},e.selectedProjectId),(0,X.jsx)(Rve,{selectedProjectId:e.selectedProjectId,summary:e.projectSummary,tickets:e.tickets,error:e.projectSummaryError,chatSessions:e.chatSessions,chatSessionDetail:e.chatSessionDetail,onRetry:tr,onOpenTickets:()=>Jn(`tickets`),onOpenChats:()=>Jn(`chats`),onOpenSpec:()=>Jn(`spec`)}),(0,X.jsx)(Fve,{isLoggingOut:x,onLogout:Zn})]})}):null,u===`tickets`?Cn?(0,X.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,X.jsx)(`div`,{className:`min-h-0`,children:(0,X.jsx)(D9,{selectedProjectId:e.selectedProjectId,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:ar,onSelectBundle:mr,onSelectTicket:hr})}),(0,X.jsx)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:_&&e.selectedTicketId?(0,X.jsx)(q9,{selectedProjectId:e.selectedProjectId,ticketId:e.selectedTicketId,ticket:e.ticketDetail,openNonce:ft,error:e.ticketDetailError,actionState:G,actionError:Ve,followUpPrompt:Ue,followUpSelectedModel:We,followUpSelectedVariant:q,followUpSelectedSkills:J,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSendingFollowUp:Ze,liveResponseTiming:dn?.agent_status===`running`&&et?.parentId===dn.id?et:null,followUpError:Qe,onBack:vr,onRetry:or,onAction:Wr,onFollowUpPromptChange:K,onFollowUpModelChange:Kr,onFollowUpVariantChange:Je,onFollowUpSkillsChange:Xe,onFollowUpKeyDown:qr,onFollowUpSubmit:Jr,onResolveQuestionSet:Yr,isLargeScreen:!0}):(0,X.jsx)(U9,{selectedProjectId:e.selectedProjectId,bundleId:e.selectedBundleId,bundleDetail:e.bundleDetail,openNonce:ut,mobileDetailView:mt,error:e.bundleDetailError,actionState:Ie,actionError:Re,followUpPrompt:nt,isSendingFollowUp:it,followUpError:ot,availableModels:In,onBack:yr,onRetry:sr,onAction:Gr,onDetailViewChange:ht,onSelectTicket:hr,onFollowUpPromptChange:rt,onFollowUpKeyDown:Xr,onFollowUpSubmit:Zr,isLargeScreen:!0})})]}):(0,X.jsx)(D9,{selectedProjectId:e.selectedProjectId,tickets:e.tickets,selectedBundleId:e.selectedBundleId,selectedTicketId:e.selectedTicketId,error:e.ticketsError,onRetry:ar,onSelectBundle:mr,onSelectTicket:hr}):null,u===`chats`?Cn?(0,X.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,X.jsx)(`div`,{className:`min-h-0`,children:(0,X.jsx)(A9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:rr,onOpenNewChat:pr,onSelectChat:fr})}),(0,X.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,X.jsx)(W9,{selectedProjectId:e.selectedProjectId,chatSession:e.chatSessionDetail,chatSessionId:e.selectedChatSessionId,openNonce:ct,error:e.chatSessionDetailError,isStopping:re===e.selectedChatSessionId,isResuming:ae===e.selectedChatSessionId,isResumeDisabled:ae!==null||te||U||mn,composerMode:e.chatSessionDetail?.mode??D,composerTool:wn,prompt:T,selectedModel:k,selectedVariant:j,selectedSkills:N,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSending:te,liveResponseTiming:ln?.agent_status===`running`&&ce?.parentId===ln.id?ce:null,isUpdatingMode:U,showStartBuilding:Wn,composerDisabledReason:Un,onBack:gr,onRetry:ir,onStop:Dr,onResume:Or,onModeChange:_r,onStartBuilding:Tr,onPromptChange:E,onModelChange:br,onVariantChange:M,onSkillsChange:P,onPromptKeyDown:xr,onSubmit:wr,onResolveQuestionSet:Er,isLargeScreen:!0}),W?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:W}):null]})]}):(0,X.jsx)(A9,{selectedProjectId:e.selectedProjectId,chatSessions:e.chatSessions,selectedChatSessionId:e.selectedChatSessionId,error:e.chatSessionsError,onRetry:rr,onOpenNewChat:pr,onSelectChat:fr}):null,u===`spec`?Cn?(0,X.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden lg:grid-cols-[minmax(15rem,18rem)_minmax(0,1fr)]`,children:[(0,X.jsx)(`div`,{className:`min-h-0`,children:(0,X.jsx)(j9,{selectedProjectId:e.selectedProjectId,specSessions:e.specSessions,selectedSpecSessionId:e.selectedSpecSessionId,error:e.specSessionsError,onRetry:kr,onOpenNewSpec:Mr,onSelectSpec:jr})}),(0,X.jsxs)(`div`,{className:`hidden min-h-0 lg:flex lg:flex-col lg:overflow-hidden`,children:[(0,X.jsx)(K9,{selectedProjectId:e.selectedProjectId,specSession:e.specSessionDetail,specSessionId:e.selectedSpecSessionId,openNonce:Pe,error:e.specSessionDetailError,isStopping:Ee===e.selectedSpecSessionId,isResuming:Oe===e.selectedSpecSessionId,isResumeDisabled:Oe!==null||Se||we||!!(hn||vn||bn),composerMode:e.specSessionDetail?.mode??me,composerTool:Tn,prompt:fe,selectedModel:ge,selectedVariant:ve,selectedSkills:be,availableModels:In,availableSkills:Ln,isLoadingAgentSettings:Rn,isSending:Se,liveResponseTiming:fn?.agent_status===`running`&&Me?.parentId===fn.id?Me:null,isUpdatingMode:we,composerDisabledReason:Gn,targetWarning:hn??vn??bn,targetActionLabel:_n?J9(`specDetail.retryTarget`):yn&&fn?jb.t(`common:mobileApp.specDetail.switchBack`,{target:o5(fn)}):null,targetActionError:Et,isRestoringTarget:wt,onBack:Nr,onRetry:Ar,onStop:Hr,onResume:Ur,onModeChange:Pr,onPromptChange:pe,onModelChange:Fr,onVariantChange:ye,onSkillsChange:xe,onPromptKeyDown:Ir,onSubmit:Rr,onSubmitAnswer:zr,onResolveQuestionSet:Br,onRestoreTarget:dr,isLargeScreen:!0}),Ae?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-200`,children:Ae}):null]})]}):(0,X.jsx)(j9,{selectedProjectId:e.selectedProjectId,specSessions:e.specSessions,selectedSpecSessionId:e.selectedSpecSessionId,error:e.specSessionsError,onRetry:kr,onOpenNewSpec:Mr,onSelectSpec:jr}):null]})}),Kn?null:(0,X.jsx)(vve,{activeSection:u,onChange:Jn})]})})},$ve=({socket:e=ZS,children:t})=>(0,X.jsx)(cq.Provider,{value:e,children:t}),eye=()=>typeof window<`u`&&window.location.pathname.startsWith(`/mobile`),tye=()=>{let e=eye();return mb(e?null:ZS),(0,X.jsx)(We,{i18n:jb,children:(0,X.jsx)(it,{children:(0,X.jsxs)($ve,{children:[e&&(0,X.jsx)(Qve,{}),!e&&(0,X.jsx)(vq,{children:(0,X.jsx)(Rme,{children:(0,X.jsx)(S_e,{})})})]})})})};document.documentElement.classList.add(`dark`),document.documentElement.style.colorScheme=`dark`,Q4(),(0,f.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(tye,{}));export{Z as $,Zy as A,Sv as B,VC as C,$b as D,ZS as E,zy as F,S_ as G,mv as H,$ as I,O_ as J,C_ as K,Ov as L,Ry as M,By as N,Ub as O,Vy as P,Q,Ev as R,HC as S,c as St,$S as T,z_ as U,xv as V,k_ as W,T_ as X,E_ as Y,D_ as Z,tw as _,q as _t,b4 as a,qt as at,rw as b,Y as bt,jue as c,Zt as ct,BT as d,Ut as dt,Hn as et,IT as f,Ht as ft,pw as g,Ke as gt,mw as h,rt as ht,S4 as i,Qt as it,Hy as j,jb as k,lq as l,en as lt,bw as m,Vt as mt,c8 as n,Xt as nt,x4 as o,tn as ot,MT as p,Wt as pt,w_ as q,L4 as r,Yt as rt,s4 as s,Kt as st,H5 as t,Jt as tt,BW as u,$t as ut,iw as v,Ye as vt,hC as w,BC as x,K as xt,nw as y,Ze as yt,Tv as z};
|